vue 3.3.6 → 3.3.7

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.
@@ -605,7 +605,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
605
605
  } else if (key === "length" && isArray(target)) {
606
606
  const newLength = Number(newValue);
607
607
  depsMap.forEach((dep, key2) => {
608
- if (key2 === "length" || key2 >= newLength) {
608
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
609
609
  deps.push(dep);
610
610
  }
611
611
  });
@@ -1701,8 +1701,13 @@ function findInsertionIndex(id) {
1701
1701
  let end = queue.length;
1702
1702
  while (start < end) {
1703
1703
  const middle = start + end >>> 1;
1704
- const middleJobId = getId(queue[middle]);
1705
- middleJobId < id ? start = middle + 1 : end = middle;
1704
+ const middleJob = queue[middle];
1705
+ const middleJobId = getId(middleJob);
1706
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1707
+ start = middle + 1;
1708
+ } else {
1709
+ end = middle;
1710
+ }
1706
1711
  }
1707
1712
  return start;
1708
1713
  }
@@ -2817,14 +2822,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2817
2822
  parentComponent: parentComponent2,
2818
2823
  container: container2
2819
2824
  } = suspense;
2825
+ let delayEnter = false;
2820
2826
  if (suspense.isHydrating) {
2821
2827
  suspense.isHydrating = false;
2822
2828
  } else if (!resume) {
2823
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2829
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2824
2830
  if (delayEnter) {
2825
2831
  activeBranch.transition.afterLeave = () => {
2826
2832
  if (pendingId === suspense.pendingId) {
2827
2833
  move(pendingBranch, container2, anchor2, 0);
2834
+ queuePostFlushCb(effects);
2828
2835
  }
2829
2836
  };
2830
2837
  }
@@ -2850,7 +2857,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2850
2857
  }
2851
2858
  parent = parent.parent;
2852
2859
  }
2853
- if (!hasUnresolvedAncestor) {
2860
+ if (!hasUnresolvedAncestor && !delayEnter) {
2854
2861
  queuePostFlushCb(effects);
2855
2862
  }
2856
2863
  suspense.effects = [];
@@ -5992,7 +5999,14 @@ function createHydrationFunctions(rendererInternals) {
5992
5999
  break;
5993
6000
  case Comment:
5994
6001
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5995
- nextNode = onMismatch();
6002
+ if (node.tagName.toLowerCase() === "template") {
6003
+ const content = vnode.el.content.firstChild;
6004
+ replaceNode(content, node, parentComponent);
6005
+ vnode.el = node = content;
6006
+ nextNode = nextSibling(node);
6007
+ } else {
6008
+ nextNode = onMismatch();
6009
+ }
5996
6010
  } else {
5997
6011
  nextNode = nextSibling(node);
5998
6012
  }
@@ -6034,7 +6048,7 @@ function createHydrationFunctions(rendererInternals) {
6034
6048
  break;
6035
6049
  default:
6036
6050
  if (shapeFlag & 1) {
6037
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
6051
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6038
6052
  nextNode = onMismatch();
6039
6053
  } else {
6040
6054
  nextNode = hydrateElement(
@@ -6049,6 +6063,13 @@ function createHydrationFunctions(rendererInternals) {
6049
6063
  } else if (shapeFlag & 6) {
6050
6064
  vnode.slotScopeIds = slotScopeIds;
6051
6065
  const container = parentNode(node);
6066
+ if (isFragmentStart) {
6067
+ nextNode = locateClosingAnchor(node);
6068
+ } else if (isComment(node) && node.data === "teleport start") {
6069
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6070
+ } else {
6071
+ nextNode = nextSibling(node);
6072
+ }
6052
6073
  mountComponent(
6053
6074
  vnode,
6054
6075
  container,
@@ -6058,10 +6079,6 @@ function createHydrationFunctions(rendererInternals) {
6058
6079
  isSVGContainer(container),
6059
6080
  optimized
6060
6081
  );
6061
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
6062
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
6063
- nextNode = nextSibling(nextNode);
6064
- }
6065
6082
  if (isAsyncWrapper(vnode)) {
6066
6083
  let subTree;
6067
6084
  if (isFragmentStart) {
@@ -6111,7 +6128,7 @@ function createHydrationFunctions(rendererInternals) {
6111
6128
  };
6112
6129
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6113
6130
  optimized = optimized || !!vnode.dynamicChildren;
6114
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6131
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6115
6132
  const forcePatchValue = type === "input" && dirs || type === "option";
6116
6133
  {
6117
6134
  if (dirs) {
@@ -6148,12 +6165,23 @@ function createHydrationFunctions(rendererInternals) {
6148
6165
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6149
6166
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6150
6167
  }
6168
+ let needCallTransitionHooks = false;
6169
+ if (isTemplateNode(el)) {
6170
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6171
+ const content = el.content.firstChild;
6172
+ if (needCallTransitionHooks) {
6173
+ transition.beforeEnter(content);
6174
+ }
6175
+ replaceNode(content, el, parentComponent);
6176
+ vnode.el = el = content;
6177
+ }
6151
6178
  if (dirs) {
6152
6179
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6153
6180
  }
6154
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6181
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6155
6182
  queueEffectWithSuspense(() => {
6156
6183
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6184
+ needCallTransitionHooks && transition.enter(el);
6157
6185
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6158
6186
  }, parentSuspense);
6159
6187
  }
@@ -6271,7 +6299,7 @@ function createHydrationFunctions(rendererInternals) {
6271
6299
  );
6272
6300
  vnode.el = null;
6273
6301
  if (isFragment) {
6274
- const end = locateClosingAsyncAnchor(node);
6302
+ const end = locateClosingAnchor(node);
6275
6303
  while (true) {
6276
6304
  const next2 = nextSibling(node);
6277
6305
  if (next2 && next2 !== end) {
@@ -6296,14 +6324,14 @@ function createHydrationFunctions(rendererInternals) {
6296
6324
  );
6297
6325
  return next;
6298
6326
  };
6299
- const locateClosingAsyncAnchor = (node) => {
6327
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6300
6328
  let match = 0;
6301
6329
  while (node) {
6302
6330
  node = nextSibling(node);
6303
6331
  if (node && isComment(node)) {
6304
- if (node.data === "[")
6332
+ if (node.data === open)
6305
6333
  match++;
6306
- if (node.data === "]") {
6334
+ if (node.data === close) {
6307
6335
  if (match === 0) {
6308
6336
  return nextSibling(node);
6309
6337
  } else {
@@ -6314,6 +6342,23 @@ function createHydrationFunctions(rendererInternals) {
6314
6342
  }
6315
6343
  return node;
6316
6344
  };
6345
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6346
+ const parentNode2 = oldNode.parentNode;
6347
+ if (parentNode2) {
6348
+ parentNode2.replaceChild(newNode, oldNode);
6349
+ }
6350
+ let parent = parentComponent;
6351
+ while (parent) {
6352
+ if (parent.vnode.el === oldNode) {
6353
+ parent.vnode.el = newNode;
6354
+ parent.subTree.el = newNode;
6355
+ }
6356
+ parent = parent.parent;
6357
+ }
6358
+ };
6359
+ const isTemplateNode = (node) => {
6360
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6361
+ };
6317
6362
  return [hydrate, hydrateNode];
6318
6363
  }
6319
6364
 
@@ -6641,7 +6686,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6641
6686
  if (dirs) {
6642
6687
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6643
6688
  }
6644
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6689
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6645
6690
  if (needCallTransitionHooks) {
6646
6691
  transition.beforeEnter(el);
6647
6692
  }
@@ -7533,8 +7578,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7533
7578
  moveStaticNode(vnode, container, anchor);
7534
7579
  return;
7535
7580
  }
7536
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7537
- if (needTransition) {
7581
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7582
+ if (needTransition2) {
7538
7583
  if (moveType === 0) {
7539
7584
  transition.beforeEnter(el);
7540
7585
  hostInsert(el, container, anchor);
@@ -7754,6 +7799,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7754
7799
  function toggleRecurse({ effect, update }, allowed) {
7755
7800
  effect.allowRecurse = update.allowRecurse = allowed;
7756
7801
  }
7802
+ function needTransition(parentSuspense, transition) {
7803
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7804
+ }
7757
7805
  function traverseStaticChildren(n1, n2, shallow = false) {
7758
7806
  const ch1 = n1.children;
7759
7807
  const ch2 = n2.children;
@@ -9089,7 +9137,7 @@ function isMemoSame(cached, memo) {
9089
9137
  return true;
9090
9138
  }
9091
9139
 
9092
- const version = "3.3.6";
9140
+ const version = "3.3.7";
9093
9141
  const ssrUtils = null;
9094
9142
  const resolveFilter = null;
9095
9143
  const compatUtils = null;
@@ -12072,9 +12120,13 @@ function walk(node, context, doNotHoistNode = false) {
12072
12120
  context.transformHoist(children, context, node);
12073
12121
  }
12074
12122
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
12075
- node.codegenNode.children = context.hoist(
12123
+ const hoisted = context.hoist(
12076
12124
  createArrayExpression(node.codegenNode.children)
12077
12125
  );
12126
+ if (context.hmr) {
12127
+ hoisted.content = `[...${hoisted.content}]`;
12128
+ }
12129
+ node.codegenNode.children = hoisted;
12078
12130
  }
12079
12131
  }
12080
12132
  function getConstantType(node, context) {
@@ -12247,6 +12299,7 @@ function createTransformContext(root, {
12247
12299
  filename = "",
12248
12300
  prefixIdentifiers = false,
12249
12301
  hoistStatic: hoistStatic2 = false,
12302
+ hmr = false,
12250
12303
  cacheHandlers = false,
12251
12304
  nodeTransforms = [],
12252
12305
  directiveTransforms = {},
@@ -12272,6 +12325,7 @@ function createTransformContext(root, {
12272
12325
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12273
12326
  prefixIdentifiers,
12274
12327
  hoistStatic: hoistStatic2,
12328
+ hmr,
12275
12329
  cacheHandlers,
12276
12330
  nodeTransforms,
12277
12331
  directiveTransforms,
@@ -13641,7 +13695,7 @@ const trackSlotScopes = (node, context) => {
13641
13695
  }
13642
13696
  }
13643
13697
  };
13644
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
13698
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
13645
13699
  props,
13646
13700
  children,
13647
13701
  false,
@@ -13663,7 +13717,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13663
13717
  slotsProperties.push(
13664
13718
  createObjectProperty(
13665
13719
  arg || createSimpleExpression("default", true),
13666
- buildSlotFn(exp, children, loc)
13720
+ buildSlotFn(exp, void 0, children, loc)
13667
13721
  )
13668
13722
  );
13669
13723
  }
@@ -13700,10 +13754,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13700
13754
  } else {
13701
13755
  hasDynamicSlots = true;
13702
13756
  }
13703
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
13757
+ const vFor = findDir(slotElement, "for");
13758
+ const slotFunction = buildSlotFn(
13759
+ slotProps,
13760
+ vFor == null ? void 0 : vFor.exp,
13761
+ slotChildren,
13762
+ slotLoc
13763
+ );
13704
13764
  let vIf;
13705
13765
  let vElse;
13706
- let vFor;
13707
13766
  if (vIf = findDir(slotElement, "if")) {
13708
13767
  hasDynamicSlots = true;
13709
13768
  dynamicSlots.push(
@@ -13748,7 +13807,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13748
13807
  createCompilerError(30, vElse.loc)
13749
13808
  );
13750
13809
  }
13751
- } else if (vFor = findDir(slotElement, "for")) {
13810
+ } else if (vFor) {
13752
13811
  hasDynamicSlots = true;
13753
13812
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
13754
13813
  if (parseResult) {
@@ -13789,7 +13848,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13789
13848
  }
13790
13849
  if (!onComponentSlot) {
13791
13850
  const buildDefaultSlotProperty = (props, children2) => {
13792
- const fn = buildSlotFn(props, children2, loc);
13851
+ const fn = buildSlotFn(props, void 0, children2, loc);
13793
13852
  return createObjectProperty(`default`, fn);
13794
13853
  };
13795
13854
  if (!hasTemplateSlots) {