vue 3.3.5 → 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 = [];
@@ -5152,7 +5159,7 @@ function createAppAPI(render, hydrate) {
5152
5159
  }
5153
5160
  });
5154
5161
  }
5155
- const installedPlugins = /* @__PURE__ */ new Set();
5162
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
5156
5163
  let isMounted = false;
5157
5164
  const app = context.app = {
5158
5165
  _uid: uid$1++,
@@ -5816,7 +5823,7 @@ const updateSlots = (instance, children, optimized) => {
5816
5823
  }
5817
5824
  if (needDeletionCheck) {
5818
5825
  for (const key in slots) {
5819
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5826
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
5820
5827
  delete slots[key];
5821
5828
  }
5822
5829
  }
@@ -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;
@@ -7979,19 +8027,18 @@ const TeleportImpl = {
7979
8027
  if (target) {
7980
8028
  hostRemove(targetAnchor);
7981
8029
  }
7982
- if (doRemove || !isTeleportDisabled(props)) {
7983
- hostRemove(anchor);
7984
- if (shapeFlag & 16) {
7985
- for (let i = 0; i < children.length; i++) {
7986
- const child = children[i];
7987
- unmount(
7988
- child,
7989
- parentComponent,
7990
- parentSuspense,
7991
- true,
7992
- !!child.dynamicChildren
7993
- );
7994
- }
8030
+ doRemove && hostRemove(anchor);
8031
+ if (shapeFlag & 16) {
8032
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
8033
+ for (let i = 0; i < children.length; i++) {
8034
+ const child = children[i];
8035
+ unmount(
8036
+ child,
8037
+ parentComponent,
8038
+ parentSuspense,
8039
+ shouldRemove,
8040
+ !!child.dynamicChildren
8041
+ );
7995
8042
  }
7996
8043
  }
7997
8044
  },
@@ -8075,7 +8122,7 @@ function updateCssVars(vnode) {
8075
8122
  const ctx = vnode.ctx;
8076
8123
  if (ctx && ctx.ut) {
8077
8124
  let node = vnode.children[0].el;
8078
- while (node !== vnode.targetAnchor) {
8125
+ while (node && node !== vnode.targetAnchor) {
8079
8126
  if (node.nodeType === 1)
8080
8127
  node.setAttribute("data-v-owner", ctx.uid);
8081
8128
  node = node.nextSibling;
@@ -9090,7 +9137,7 @@ function isMemoSame(cached, memo) {
9090
9137
  return true;
9091
9138
  }
9092
9139
 
9093
- const version = "3.3.5";
9140
+ const version = "3.3.7";
9094
9141
  const ssrUtils = null;
9095
9142
  const resolveFilter = null;
9096
9143
  const compatUtils = null;
@@ -12073,9 +12120,13 @@ function walk(node, context, doNotHoistNode = false) {
12073
12120
  context.transformHoist(children, context, node);
12074
12121
  }
12075
12122
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
12076
- node.codegenNode.children = context.hoist(
12123
+ const hoisted = context.hoist(
12077
12124
  createArrayExpression(node.codegenNode.children)
12078
12125
  );
12126
+ if (context.hmr) {
12127
+ hoisted.content = `[...${hoisted.content}]`;
12128
+ }
12129
+ node.codegenNode.children = hoisted;
12079
12130
  }
12080
12131
  }
12081
12132
  function getConstantType(node, context) {
@@ -12248,6 +12299,7 @@ function createTransformContext(root, {
12248
12299
  filename = "",
12249
12300
  prefixIdentifiers = false,
12250
12301
  hoistStatic: hoistStatic2 = false,
12302
+ hmr = false,
12251
12303
  cacheHandlers = false,
12252
12304
  nodeTransforms = [],
12253
12305
  directiveTransforms = {},
@@ -12273,6 +12325,7 @@ function createTransformContext(root, {
12273
12325
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12274
12326
  prefixIdentifiers,
12275
12327
  hoistStatic: hoistStatic2,
12328
+ hmr,
12276
12329
  cacheHandlers,
12277
12330
  nodeTransforms,
12278
12331
  directiveTransforms,
@@ -12298,7 +12351,7 @@ function createTransformContext(root, {
12298
12351
  directives: /* @__PURE__ */ new Set(),
12299
12352
  hoists: [],
12300
12353
  imports: [],
12301
- constantCache: /* @__PURE__ */ new Map(),
12354
+ constantCache: /* @__PURE__ */ new WeakMap(),
12302
12355
  temps: 0,
12303
12356
  cached: 0,
12304
12357
  identifiers: /* @__PURE__ */ Object.create(null),
@@ -13642,7 +13695,7 @@ const trackSlotScopes = (node, context) => {
13642
13695
  }
13643
13696
  }
13644
13697
  };
13645
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
13698
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
13646
13699
  props,
13647
13700
  children,
13648
13701
  false,
@@ -13664,7 +13717,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13664
13717
  slotsProperties.push(
13665
13718
  createObjectProperty(
13666
13719
  arg || createSimpleExpression("default", true),
13667
- buildSlotFn(exp, children, loc)
13720
+ buildSlotFn(exp, void 0, children, loc)
13668
13721
  )
13669
13722
  );
13670
13723
  }
@@ -13701,10 +13754,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13701
13754
  } else {
13702
13755
  hasDynamicSlots = true;
13703
13756
  }
13704
- 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
+ );
13705
13764
  let vIf;
13706
13765
  let vElse;
13707
- let vFor;
13708
13766
  if (vIf = findDir(slotElement, "if")) {
13709
13767
  hasDynamicSlots = true;
13710
13768
  dynamicSlots.push(
@@ -13749,7 +13807,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13749
13807
  createCompilerError(30, vElse.loc)
13750
13808
  );
13751
13809
  }
13752
- } else if (vFor = findDir(slotElement, "for")) {
13810
+ } else if (vFor) {
13753
13811
  hasDynamicSlots = true;
13754
13812
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
13755
13813
  if (parseResult) {
@@ -13790,7 +13848,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13790
13848
  }
13791
13849
  if (!onComponentSlot) {
13792
13850
  const buildDefaultSlotProperty = (props, children2) => {
13793
- const fn = buildSlotFn(props, children2, loc);
13851
+ const fn = buildSlotFn(props, void 0, children2, loc);
13794
13852
  return createObjectProperty(`default`, fn);
13795
13853
  };
13796
13854
  if (!hasTemplateSlots) {