vue 3.3.6 → 3.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -608,7 +608,7 @@ var Vue = (function (exports) {
608
608
  } else if (key === "length" && isArray(target)) {
609
609
  const newLength = Number(newValue);
610
610
  depsMap.forEach((dep, key2) => {
611
- if (key2 === "length" || key2 >= newLength) {
611
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
612
612
  deps.push(dep);
613
613
  }
614
614
  });
@@ -1704,8 +1704,13 @@ var Vue = (function (exports) {
1704
1704
  let end = queue.length;
1705
1705
  while (start < end) {
1706
1706
  const middle = start + end >>> 1;
1707
- const middleJobId = getId(queue[middle]);
1708
- middleJobId < id ? start = middle + 1 : end = middle;
1707
+ const middleJob = queue[middle];
1708
+ const middleJobId = getId(middleJob);
1709
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1710
+ start = middle + 1;
1711
+ } else {
1712
+ end = middle;
1713
+ }
1709
1714
  }
1710
1715
  return start;
1711
1716
  }
@@ -2507,6 +2512,61 @@ var Vue = (function (exports) {
2507
2512
  }
2508
2513
  }
2509
2514
 
2515
+ const COMPONENTS = "components";
2516
+ const DIRECTIVES = "directives";
2517
+ function resolveComponent(name, maybeSelfReference) {
2518
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2519
+ }
2520
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2521
+ function resolveDynamicComponent(component) {
2522
+ if (isString(component)) {
2523
+ return resolveAsset(COMPONENTS, component, false) || component;
2524
+ } else {
2525
+ return component || NULL_DYNAMIC_COMPONENT;
2526
+ }
2527
+ }
2528
+ function resolveDirective(name) {
2529
+ return resolveAsset(DIRECTIVES, name);
2530
+ }
2531
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2532
+ const instance = currentRenderingInstance || currentInstance;
2533
+ if (instance) {
2534
+ const Component = instance.type;
2535
+ if (type === COMPONENTS) {
2536
+ const selfName = getComponentName(
2537
+ Component,
2538
+ false
2539
+ /* do not include inferred name to avoid breaking existing code */
2540
+ );
2541
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2542
+ return Component;
2543
+ }
2544
+ }
2545
+ const res = (
2546
+ // local registration
2547
+ // check instance[type] first which is resolved for options API
2548
+ resolve(instance[type] || Component[type], name) || // global registration
2549
+ resolve(instance.appContext[type], name)
2550
+ );
2551
+ if (!res && maybeSelfReference) {
2552
+ return Component;
2553
+ }
2554
+ if (warnMissing && !res) {
2555
+ const extra = type === COMPONENTS ? `
2556
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2557
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2558
+ }
2559
+ return res;
2560
+ } else {
2561
+ warn(
2562
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2563
+ );
2564
+ }
2565
+ }
2566
+ function resolve(registry, name) {
2567
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2568
+ }
2569
+
2510
2570
  const isSuspense = (type) => type.__isSuspense;
2511
2571
  const SuspenseImpl = {
2512
2572
  name: "Suspense",
@@ -2820,14 +2880,16 @@ var Vue = (function (exports) {
2820
2880
  parentComponent: parentComponent2,
2821
2881
  container: container2
2822
2882
  } = suspense;
2883
+ let delayEnter = false;
2823
2884
  if (suspense.isHydrating) {
2824
2885
  suspense.isHydrating = false;
2825
2886
  } else if (!resume) {
2826
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2887
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2827
2888
  if (delayEnter) {
2828
2889
  activeBranch.transition.afterLeave = () => {
2829
2890
  if (pendingId === suspense.pendingId) {
2830
2891
  move(pendingBranch, container2, anchor2, 0);
2892
+ queuePostFlushCb(effects);
2831
2893
  }
2832
2894
  };
2833
2895
  }
@@ -2853,7 +2915,7 @@ var Vue = (function (exports) {
2853
2915
  }
2854
2916
  parent = parent.parent;
2855
2917
  }
2856
- if (!hasUnresolvedAncestor) {
2918
+ if (!hasUnresolvedAncestor && !delayEnter) {
2857
2919
  queuePostFlushCb(effects);
2858
2920
  }
2859
2921
  suspense.effects = [];
@@ -3039,7 +3101,7 @@ var Vue = (function (exports) {
3039
3101
  }
3040
3102
  if (isArray(s)) {
3041
3103
  const singleChild = filterSingleRoot(s);
3042
- if (!singleChild) {
3104
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3043
3105
  warn(`<Suspense> slots expect a single root node.`);
3044
3106
  }
3045
3107
  s = singleChild;
@@ -4124,61 +4186,6 @@ var Vue = (function (exports) {
4124
4186
  injectHook("ec", hook, target);
4125
4187
  }
4126
4188
 
4127
- const COMPONENTS = "components";
4128
- const DIRECTIVES = "directives";
4129
- function resolveComponent(name, maybeSelfReference) {
4130
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4131
- }
4132
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4133
- function resolveDynamicComponent(component) {
4134
- if (isString(component)) {
4135
- return resolveAsset(COMPONENTS, component, false) || component;
4136
- } else {
4137
- return component || NULL_DYNAMIC_COMPONENT;
4138
- }
4139
- }
4140
- function resolveDirective(name) {
4141
- return resolveAsset(DIRECTIVES, name);
4142
- }
4143
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4144
- const instance = currentRenderingInstance || currentInstance;
4145
- if (instance) {
4146
- const Component = instance.type;
4147
- if (type === COMPONENTS) {
4148
- const selfName = getComponentName(
4149
- Component,
4150
- false
4151
- /* do not include inferred name to avoid breaking existing code */
4152
- );
4153
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4154
- return Component;
4155
- }
4156
- }
4157
- const res = (
4158
- // local registration
4159
- // check instance[type] first which is resolved for options API
4160
- resolve(instance[type] || Component[type], name) || // global registration
4161
- resolve(instance.appContext[type], name)
4162
- );
4163
- if (!res && maybeSelfReference) {
4164
- return Component;
4165
- }
4166
- if (warnMissing && !res) {
4167
- const extra = type === COMPONENTS ? `
4168
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4169
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4170
- }
4171
- return res;
4172
- } else {
4173
- warn(
4174
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4175
- );
4176
- }
4177
- }
4178
- function resolve(registry, name) {
4179
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4180
- }
4181
-
4182
4189
  function renderList(source, renderItem, cache, index) {
4183
4190
  let ret;
4184
4191
  const cached = cache && cache[index];
@@ -5994,7 +6001,14 @@ If you want to remount the same app, move your app creation logic into a factory
5994
6001
  }
5995
6002
  break;
5996
6003
  case Comment:
5997
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6004
+ if (isTemplateNode(node)) {
6005
+ nextNode = nextSibling(node);
6006
+ replaceNode(
6007
+ vnode.el = node.content.firstChild,
6008
+ node,
6009
+ parentComponent
6010
+ );
6011
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5998
6012
  nextNode = onMismatch();
5999
6013
  } else {
6000
6014
  nextNode = nextSibling(node);
@@ -6037,7 +6051,7 @@ If you want to remount the same app, move your app creation logic into a factory
6037
6051
  break;
6038
6052
  default:
6039
6053
  if (shapeFlag & 1) {
6040
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
6054
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6041
6055
  nextNode = onMismatch();
6042
6056
  } else {
6043
6057
  nextNode = hydrateElement(
@@ -6052,6 +6066,13 @@ If you want to remount the same app, move your app creation logic into a factory
6052
6066
  } else if (shapeFlag & 6) {
6053
6067
  vnode.slotScopeIds = slotScopeIds;
6054
6068
  const container = parentNode(node);
6069
+ if (isFragmentStart) {
6070
+ nextNode = locateClosingAnchor(node);
6071
+ } else if (isComment(node) && node.data === "teleport start") {
6072
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6073
+ } else {
6074
+ nextNode = nextSibling(node);
6075
+ }
6055
6076
  mountComponent(
6056
6077
  vnode,
6057
6078
  container,
@@ -6061,10 +6082,6 @@ If you want to remount the same app, move your app creation logic into a factory
6061
6082
  isSVGContainer(container),
6062
6083
  optimized
6063
6084
  );
6064
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
6065
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
6066
- nextNode = nextSibling(nextNode);
6067
- }
6068
6085
  if (isAsyncWrapper(vnode)) {
6069
6086
  let subTree;
6070
6087
  if (isFragmentStart) {
@@ -6114,7 +6131,7 @@ If you want to remount the same app, move your app creation logic into a factory
6114
6131
  };
6115
6132
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6116
6133
  optimized = optimized || !!vnode.dynamicChildren;
6117
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6134
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6118
6135
  const forcePatchValue = type === "input" && dirs || type === "option";
6119
6136
  {
6120
6137
  if (dirs) {
@@ -6151,12 +6168,23 @@ If you want to remount the same app, move your app creation logic into a factory
6151
6168
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6152
6169
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6153
6170
  }
6171
+ let needCallTransitionHooks = false;
6172
+ if (isTemplateNode(el)) {
6173
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6174
+ const content = el.content.firstChild;
6175
+ if (needCallTransitionHooks) {
6176
+ transition.beforeEnter(content);
6177
+ }
6178
+ replaceNode(content, el, parentComponent);
6179
+ vnode.el = el = content;
6180
+ }
6154
6181
  if (dirs) {
6155
6182
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6156
6183
  }
6157
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6184
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6158
6185
  queueEffectWithSuspense(() => {
6159
6186
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6187
+ needCallTransitionHooks && transition.enter(el);
6160
6188
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6161
6189
  }, parentSuspense);
6162
6190
  }
@@ -6274,7 +6302,7 @@ If you want to remount the same app, move your app creation logic into a factory
6274
6302
  );
6275
6303
  vnode.el = null;
6276
6304
  if (isFragment) {
6277
- const end = locateClosingAsyncAnchor(node);
6305
+ const end = locateClosingAnchor(node);
6278
6306
  while (true) {
6279
6307
  const next2 = nextSibling(node);
6280
6308
  if (next2 && next2 !== end) {
@@ -6299,14 +6327,14 @@ If you want to remount the same app, move your app creation logic into a factory
6299
6327
  );
6300
6328
  return next;
6301
6329
  };
6302
- const locateClosingAsyncAnchor = (node) => {
6330
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6303
6331
  let match = 0;
6304
6332
  while (node) {
6305
6333
  node = nextSibling(node);
6306
6334
  if (node && isComment(node)) {
6307
- if (node.data === "[")
6335
+ if (node.data === open)
6308
6336
  match++;
6309
- if (node.data === "]") {
6337
+ if (node.data === close) {
6310
6338
  if (match === 0) {
6311
6339
  return nextSibling(node);
6312
6340
  } else {
@@ -6317,6 +6345,22 @@ If you want to remount the same app, move your app creation logic into a factory
6317
6345
  }
6318
6346
  return node;
6319
6347
  };
6348
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6349
+ const parentNode2 = oldNode.parentNode;
6350
+ if (parentNode2) {
6351
+ parentNode2.replaceChild(newNode, oldNode);
6352
+ }
6353
+ let parent = parentComponent;
6354
+ while (parent) {
6355
+ if (parent.vnode.el === oldNode) {
6356
+ parent.vnode.el = parent.subTree.el = newNode;
6357
+ }
6358
+ parent = parent.parent;
6359
+ }
6360
+ };
6361
+ const isTemplateNode = (node) => {
6362
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6363
+ };
6320
6364
  return [hydrate, hydrateNode];
6321
6365
  }
6322
6366
 
@@ -6644,7 +6688,7 @@ If you want to remount the same app, move your app creation logic into a factory
6644
6688
  if (dirs) {
6645
6689
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6646
6690
  }
6647
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6691
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6648
6692
  if (needCallTransitionHooks) {
6649
6693
  transition.beforeEnter(el);
6650
6694
  }
@@ -7536,8 +7580,8 @@ If you want to remount the same app, move your app creation logic into a factory
7536
7580
  moveStaticNode(vnode, container, anchor);
7537
7581
  return;
7538
7582
  }
7539
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7540
- if (needTransition) {
7583
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7584
+ if (needTransition2) {
7541
7585
  if (moveType === 0) {
7542
7586
  transition.beforeEnter(el);
7543
7587
  hostInsert(el, container, anchor);
@@ -7757,6 +7801,9 @@ If you want to remount the same app, move your app creation logic into a factory
7757
7801
  function toggleRecurse({ effect, update }, allowed) {
7758
7802
  effect.allowRecurse = update.allowRecurse = allowed;
7759
7803
  }
7804
+ function needTransition(parentSuspense, transition) {
7805
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7806
+ }
7760
7807
  function traverseStaticChildren(n1, n2, shallow = false) {
7761
7808
  const ch1 = n1.children;
7762
7809
  const ch2 = n2.children;
@@ -9086,7 +9133,7 @@ Component that was made reactive: `,
9086
9133
  return true;
9087
9134
  }
9088
9135
 
9089
- const version = "3.3.6";
9136
+ const version = "3.3.8";
9090
9137
  const ssrUtils = null;
9091
9138
  const resolveFilter = null;
9092
9139
  const compatUtils = null;
@@ -11900,9 +11947,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
11900
11947
  context.transformHoist(children, context, node);
11901
11948
  }
11902
11949
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
11903
- node.codegenNode.children = context.hoist(
11950
+ const hoisted = context.hoist(
11904
11951
  createArrayExpression(node.codegenNode.children)
11905
11952
  );
11953
+ if (context.hmr) {
11954
+ hoisted.content = `[...${hoisted.content}]`;
11955
+ }
11956
+ node.codegenNode.children = hoisted;
11906
11957
  }
11907
11958
  }
11908
11959
  function getConstantType(node, context) {
@@ -12075,6 +12126,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12075
12126
  filename = "",
12076
12127
  prefixIdentifiers = false,
12077
12128
  hoistStatic: hoistStatic2 = false,
12129
+ hmr = false,
12078
12130
  cacheHandlers = false,
12079
12131
  nodeTransforms = [],
12080
12132
  directiveTransforms = {},
@@ -12100,6 +12152,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12100
12152
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12101
12153
  prefixIdentifiers,
12102
12154
  hoistStatic: hoistStatic2,
12155
+ hmr,
12103
12156
  cacheHandlers,
12104
12157
  nodeTransforms,
12105
12158
  directiveTransforms,
@@ -13469,7 +13522,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13469
13522
  }
13470
13523
  }
13471
13524
  };
13472
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
13525
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
13473
13526
  props,
13474
13527
  children,
13475
13528
  false,
@@ -13491,7 +13544,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13491
13544
  slotsProperties.push(
13492
13545
  createObjectProperty(
13493
13546
  arg || createSimpleExpression("default", true),
13494
- buildSlotFn(exp, children, loc)
13547
+ buildSlotFn(exp, void 0, children, loc)
13495
13548
  )
13496
13549
  );
13497
13550
  }
@@ -13528,10 +13581,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13528
13581
  } else {
13529
13582
  hasDynamicSlots = true;
13530
13583
  }
13531
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
13584
+ const vFor = findDir(slotElement, "for");
13585
+ const slotFunction = buildSlotFn(
13586
+ slotProps,
13587
+ vFor == null ? void 0 : vFor.exp,
13588
+ slotChildren,
13589
+ slotLoc
13590
+ );
13532
13591
  let vIf;
13533
13592
  let vElse;
13534
- let vFor;
13535
13593
  if (vIf = findDir(slotElement, "if")) {
13536
13594
  hasDynamicSlots = true;
13537
13595
  dynamicSlots.push(
@@ -13576,7 +13634,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13576
13634
  createCompilerError(30, vElse.loc)
13577
13635
  );
13578
13636
  }
13579
- } else if (vFor = findDir(slotElement, "for")) {
13637
+ } else if (vFor) {
13580
13638
  hasDynamicSlots = true;
13581
13639
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
13582
13640
  if (parseResult) {
@@ -13617,7 +13675,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13617
13675
  }
13618
13676
  if (!onComponentSlot) {
13619
13677
  const buildDefaultSlotProperty = (props, children2) => {
13620
- const fn = buildSlotFn(props, children2, loc);
13678
+ const fn = buildSlotFn(props, void 0, children2, loc);
13621
13679
  return createObjectProperty(`default`, fn);
13622
13680
  };
13623
13681
  if (!hasTemplateSlots) {