Skip to content

Commit fb296a7

Browse files
committed
Update vue.mjs
1 parent 3c86499 commit fb296a7

File tree

1 file changed

+88
-31
lines changed

1 file changed

+88
-31
lines changed

AiServer/wwwroot/lib/mjs/vue.mjs

Lines changed: 88 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue v3.5.12
2+
* vue v3.5.13
33
* (c) 2018-present Yuxi (Evan) You and Vue contributors
44
* @license MIT
55
**/
@@ -212,10 +212,9 @@ function parseStringStyle(cssText) {
212212
return ret;
213213
}
214214
function stringifyStyle(styles) {
215+
if (!styles) return "";
216+
if (isString(styles)) return styles;
215217
let ret = "";
216-
if (!styles || isString(styles)) {
217-
return ret;
218-
}
219218
for (const key in styles) {
220219
const value = styles[key];
221220
if (isString(value) || typeof value === "number") {
@@ -478,17 +477,21 @@ class EffectScope {
478477
}
479478
stop(fromParent) {
480479
if (this._active) {
480+
this._active = false;
481481
let i, l;
482482
for (i = 0, l = this.effects.length; i < l; i++) {
483483
this.effects[i].stop();
484484
}
485+
this.effects.length = 0;
485486
for (i = 0, l = this.cleanups.length; i < l; i++) {
486487
this.cleanups[i]();
487488
}
489+
this.cleanups.length = 0;
488490
if (this.scopes) {
489491
for (i = 0, l = this.scopes.length; i < l; i++) {
490492
this.scopes[i].stop(true);
491493
}
494+
this.scopes.length = 0;
492495
}
493496
if (!this.detached && this.parent && !fromParent) {
494497
const last = this.parent.scopes.pop();
@@ -498,7 +501,6 @@ class EffectScope {
498501
}
499502
}
500503
this.parent = void 0;
501-
this._active = false;
502504
}
503505
}
504506
}
@@ -1264,6 +1266,7 @@ class BaseReactiveHandler {
12641266
this._isShallow = _isShallow;
12651267
}
12661268
get(target, key, receiver) {
1269+
if (key === "__v_skip") return target["__v_skip"];
12671270
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
12681271
if (key === "__v_isReactive") {
12691272
return !isReadonly2;
@@ -2100,7 +2103,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
21002103
const scope = getCurrentScope();
21012104
const watchHandle = () => {
21022105
effect.stop();
2103-
if (scope) {
2106+
if (scope && scope.active) {
21042107
remove(scope.effects, effect);
21052108
}
21062109
};
@@ -3060,11 +3063,32 @@ const TeleportImpl = {
30603063
updateCssVars(n2, true);
30613064
}
30623065
if (isTeleportDeferred(n2.props)) {
3063-
queuePostRenderEffect(mountToTarget, parentSuspense);
3066+
queuePostRenderEffect(() => {
3067+
mountToTarget();
3068+
n2.el.__isMounted = true;
3069+
}, parentSuspense);
30643070
} else {
30653071
mountToTarget();
30663072
}
30673073
} else {
3074+
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3075+
queuePostRenderEffect(() => {
3076+
TeleportImpl.process(
3077+
n1,
3078+
n2,
3079+
container,
3080+
anchor,
3081+
parentComponent,
3082+
parentSuspense,
3083+
namespace,
3084+
slotScopeIds,
3085+
optimized,
3086+
internals
3087+
);
3088+
delete n1.el.__isMounted;
3089+
}, parentSuspense);
3090+
return;
3091+
}
30683092
n2.el = n1.el;
30693093
n2.targetStart = n1.targetStart;
30703094
const mainAnchor = n2.anchor = n1.anchor;
@@ -3370,10 +3394,9 @@ const BaseTransitionImpl = {
33703394
if (innerChild.type !== Comment) {
33713395
setTransitionHooks(innerChild, enterHooks);
33723396
}
3373-
const oldChild = instance.subTree;
3374-
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3397+
let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
33753398
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3376-
const leavingHooks = resolveTransitionHooks(
3399+
let leavingHooks = resolveTransitionHooks(
33773400
oldInnerChild,
33783401
rawProps,
33793402
state,
@@ -3388,6 +3411,7 @@ const BaseTransitionImpl = {
33883411
instance.update();
33893412
}
33903413
delete leavingHooks.afterLeave;
3414+
oldInnerChild = void 0;
33913415
};
33923416
return emptyPlaceholder(child);
33933417
} else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3401,10 +3425,19 @@ const BaseTransitionImpl = {
34013425
earlyRemove();
34023426
el[leaveCbKey] = void 0;
34033427
delete enterHooks.delayedLeave;
3428+
oldInnerChild = void 0;
3429+
};
3430+
enterHooks.delayedLeave = () => {
3431+
delayedLeave();
3432+
delete enterHooks.delayedLeave;
3433+
oldInnerChild = void 0;
34043434
};
3405-
enterHooks.delayedLeave = delayedLeave;
34063435
};
3436+
} else {
3437+
oldInnerChild = void 0;
34073438
}
3439+
} else if (oldInnerChild) {
3440+
oldInnerChild = void 0;
34083441
}
34093442
return child;
34103443
};
@@ -3709,6 +3742,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
37093742
return;
37103743
}
37113744
if (isAsyncWrapper(vnode) && !isUnmount) {
3745+
if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
3746+
setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
3747+
}
37123748
return;
37133749
}
37143750
const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
@@ -3973,7 +4009,7 @@ function createHydrationFunctions(rendererInternals) {
39734009
getContainerType(container),
39744010
optimized
39754011
);
3976-
if (isAsyncWrapper(vnode)) {
4012+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
39774013
let subTree;
39784014
if (isFragmentStart) {
39794015
subTree = createVNode(Fragment);
@@ -4242,6 +4278,10 @@ Server rendered element contains fewer child nodes than client vdom.`
42424278
getContainerType(container),
42434279
slotScopeIds
42444280
);
4281+
if (parentComponent) {
4282+
parentComponent.vnode.el = vnode.el;
4283+
updateHOCHostEl(parentComponent, vnode.el);
4284+
}
42454285
return next;
42464286
};
42474287
const locateClosingAnchor = (node, open = "[", close = "]") => {
@@ -8681,7 +8721,7 @@ function renderComponentRoot(instance) {
86818721
}
86828722
if (extraAttrs.length) {
86838723
warn$1(
8684-
`Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
8724+
`Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
86858725
);
86868726
}
86878727
if (eventAttrs.length) {
@@ -9464,9 +9504,9 @@ function closeBlock() {
94649504
currentBlock = blockStack[blockStack.length - 1] || null;
94659505
}
94669506
let isBlockTreeEnabled = 1;
9467-
function setBlockTracking(value) {
9507+
function setBlockTracking(value, inVOnce = false) {
94689508
isBlockTreeEnabled += value;
9469-
if (value < 0 && currentBlock) {
9509+
if (value < 0 && currentBlock && inVOnce) {
94709510
currentBlock.hasOnce = true;
94719511
}
94729512
}
@@ -10490,7 +10530,7 @@ function isMemoSame(cached, memo) {
1049010530
return true;
1049110531
}
1049210532

10493-
const version = "3.5.12";
10533+
const version = "3.5.13";
1049410534
const warn = warn$1 ;
1049510535
const ErrorTypeStrings = ErrorTypeStrings$1 ;
1049610536
const devtools = devtools$1 ;
@@ -10674,7 +10714,8 @@ function resolveTransitionProps(rawProps) {
1067410714
onAppear = onEnter,
1067510715
onAppearCancelled = onEnterCancelled
1067610716
} = baseProps;
10677-
const finishEnter = (el, isAppear, done) => {
10717+
const finishEnter = (el, isAppear, done, isCancelled) => {
10718+
el._enterCancelled = isCancelled;
1067810719
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
1067910720
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
1068010721
done && done();
@@ -10717,8 +10758,13 @@ function resolveTransitionProps(rawProps) {
1071710758
el._isLeaving = true;
1071810759
const resolve = () => finishLeave(el, done);
1071910760
addTransitionClass(el, leaveFromClass);
10720-
addTransitionClass(el, leaveActiveClass);
10721-
forceReflow();
10761+
if (!el._enterCancelled) {
10762+
forceReflow();
10763+
addTransitionClass(el, leaveActiveClass);
10764+
} else {
10765+
addTransitionClass(el, leaveActiveClass);
10766+
forceReflow();
10767+
}
1072210768
nextFrame(() => {
1072310769
if (!el._isLeaving) {
1072410770
return;
@@ -10732,11 +10778,11 @@ function resolveTransitionProps(rawProps) {
1073210778
callHook(onLeave, [el, resolve]);
1073310779
},
1073410780
onEnterCancelled(el) {
10735-
finishEnter(el, false);
10781+
finishEnter(el, false, void 0, true);
1073610782
callHook(onEnterCancelled, [el]);
1073710783
},
1073810784
onAppearCancelled(el) {
10739-
finishEnter(el, true);
10785+
finishEnter(el, true, void 0, true);
1074010786
callHook(onAppearCancelled, [el]);
1074110787
},
1074210788
onLeaveCancelled(el) {
@@ -10956,10 +11002,11 @@ function useCssVars(getter) {
1095611002
}
1095711003
updateTeleports(vars);
1095811004
};
10959-
onBeforeMount(() => {
10960-
watchPostEffect(setVars);
11005+
onBeforeUpdate(() => {
11006+
queuePostFlushCb(setVars);
1096111007
});
1096211008
onMounted(() => {
11009+
watch(setVars, NOOP, { flush: "post" });
1096311010
const ob = new MutationObserver(setVars);
1096411011
ob.observe(instance.subTree.el.parentNode, { childList: true });
1096511012
onUnmounted(() => ob.disconnect());
@@ -11566,13 +11613,16 @@ class VueElement extends BaseClass {
1156611613
this._update();
1156711614
}
1156811615
if (shouldReflect) {
11616+
const ob = this._ob;
11617+
ob && ob.disconnect();
1156911618
if (val === true) {
1157011619
this.setAttribute(hyphenate(key), "");
1157111620
} else if (typeof val === "string" || typeof val === "number") {
1157211621
this.setAttribute(hyphenate(key), val + "");
1157311622
} else if (!val) {
1157411623
this.removeAttribute(hyphenate(key));
1157511624
}
11625+
ob && ob.observe(this, { attributes: true });
1157611626
}
1157711627
}
1157811628
}
@@ -12771,12 +12821,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
1277112821
loc: locStub
1277212822
};
1277312823
}
12774-
function createCacheExpression(index, value, needPauseTracking = false) {
12824+
function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
1277512825
return {
1277612826
type: 20,
1277712827
index,
1277812828
value,
1277912829
needPauseTracking,
12830+
inVOnce,
1278012831
needArraySpread: false,
1278112832
loc: locStub
1278212833
};
@@ -15010,11 +15061,12 @@ function createTransformContext(root, {
1501015061
identifier.hoisted = exp;
1501115062
return identifier;
1501215063
},
15013-
cache(exp, isVNode = false) {
15064+
cache(exp, isVNode = false, inVOnce = false) {
1501415065
const cacheExp = createCacheExpression(
1501515066
context.cached.length,
1501615067
exp,
15017-
isVNode
15068+
isVNode,
15069+
inVOnce
1501815070
);
1501915071
context.cached.push(cacheExp);
1502015072
return cacheExp;
@@ -15713,7 +15765,9 @@ function genCacheExpression(node, context) {
1571315765
push(`_cache[${node.index}] || (`);
1571415766
if (needPauseTracking) {
1571515767
indent();
15716-
push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
15768+
push(`${helper(SET_BLOCK_TRACKING)}(-1`);
15769+
if (node.inVOnce) push(`, true`);
15770+
push(`),`);
1571715771
newline();
1571815772
push(`(`);
1571915773
}
@@ -15770,12 +15824,14 @@ const transformExpression = (node, context) => {
1577015824
context
1577115825
);
1577215826
} else if (node.type === 1) {
15827+
const memo = findDir(node, "memo");
1577315828
for (let i = 0; i < node.props.length; i++) {
1577415829
const dir = node.props[i];
1577515830
if (dir.type === 7 && dir.name !== "for") {
1577615831
const exp = dir.exp;
1577715832
const arg = dir.arg;
15778-
if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
15833+
if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
15834+
!(memo && arg && arg.type === 4 && arg.content === "key")) {
1577915835
dir.exp = processExpression(
1578015836
exp,
1578115837
context,
@@ -16103,10 +16159,11 @@ const transformFor = createStructuralDirectiveTransform(
1610316159
const isTemplate = isTemplateNode(node);
1610416160
const memo = findDir(node, "memo");
1610516161
const keyProp = findProp(node, `key`, false, true);
16106-
if (keyProp && keyProp.type === 7 && !keyProp.exp) {
16162+
const isDirKey = keyProp && keyProp.type === 7;
16163+
if (isDirKey && !keyProp.exp) {
1610716164
transformBindShorthand(keyProp);
1610816165
}
16109-
const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16166+
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
1611016167
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
1611116168
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
1611216169
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -17303,8 +17360,8 @@ const transformOnce = (node, context) => {
1730317360
if (cur.codegenNode) {
1730417361
cur.codegenNode = context.cache(
1730517362
cur.codegenNode,
17363+
true,
1730617364
true
17307-
/* isVNode */
1730817365
);
1730917366
}
1731017367
};

0 commit comments

Comments
 (0)