@vue/runtime-dom 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.
@@ -543,7 +543,7 @@ var VueRuntimeDOM = (function (exports) {
543
543
  } else if (key === "length" && isArray(target)) {
544
544
  const newLength = Number(newValue);
545
545
  depsMap.forEach((dep, key2) => {
546
- if (key2 === "length" || key2 >= newLength) {
546
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
547
547
  deps.push(dep);
548
548
  }
549
549
  });
@@ -1639,8 +1639,13 @@ var VueRuntimeDOM = (function (exports) {
1639
1639
  let end = queue.length;
1640
1640
  while (start < end) {
1641
1641
  const middle = start + end >>> 1;
1642
- const middleJobId = getId(queue[middle]);
1643
- middleJobId < id ? start = middle + 1 : end = middle;
1642
+ const middleJob = queue[middle];
1643
+ const middleJobId = getId(middleJob);
1644
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1645
+ start = middle + 1;
1646
+ } else {
1647
+ end = middle;
1648
+ }
1644
1649
  }
1645
1650
  return start;
1646
1651
  }
@@ -2442,6 +2447,61 @@ var VueRuntimeDOM = (function (exports) {
2442
2447
  }
2443
2448
  }
2444
2449
 
2450
+ const COMPONENTS = "components";
2451
+ const DIRECTIVES = "directives";
2452
+ function resolveComponent(name, maybeSelfReference) {
2453
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2454
+ }
2455
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2456
+ function resolveDynamicComponent(component) {
2457
+ if (isString(component)) {
2458
+ return resolveAsset(COMPONENTS, component, false) || component;
2459
+ } else {
2460
+ return component || NULL_DYNAMIC_COMPONENT;
2461
+ }
2462
+ }
2463
+ function resolveDirective(name) {
2464
+ return resolveAsset(DIRECTIVES, name);
2465
+ }
2466
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2467
+ const instance = currentRenderingInstance || currentInstance;
2468
+ if (instance) {
2469
+ const Component = instance.type;
2470
+ if (type === COMPONENTS) {
2471
+ const selfName = getComponentName(
2472
+ Component,
2473
+ false
2474
+ /* do not include inferred name to avoid breaking existing code */
2475
+ );
2476
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2477
+ return Component;
2478
+ }
2479
+ }
2480
+ const res = (
2481
+ // local registration
2482
+ // check instance[type] first which is resolved for options API
2483
+ resolve(instance[type] || Component[type], name) || // global registration
2484
+ resolve(instance.appContext[type], name)
2485
+ );
2486
+ if (!res && maybeSelfReference) {
2487
+ return Component;
2488
+ }
2489
+ if (warnMissing && !res) {
2490
+ const extra = type === COMPONENTS ? `
2491
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2492
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2493
+ }
2494
+ return res;
2495
+ } else {
2496
+ warn(
2497
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2498
+ );
2499
+ }
2500
+ }
2501
+ function resolve(registry, name) {
2502
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2503
+ }
2504
+
2445
2505
  const isSuspense = (type) => type.__isSuspense;
2446
2506
  const SuspenseImpl = {
2447
2507
  name: "Suspense",
@@ -2755,14 +2815,16 @@ var VueRuntimeDOM = (function (exports) {
2755
2815
  parentComponent: parentComponent2,
2756
2816
  container: container2
2757
2817
  } = suspense;
2818
+ let delayEnter = false;
2758
2819
  if (suspense.isHydrating) {
2759
2820
  suspense.isHydrating = false;
2760
2821
  } else if (!resume) {
2761
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2822
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2762
2823
  if (delayEnter) {
2763
2824
  activeBranch.transition.afterLeave = () => {
2764
2825
  if (pendingId === suspense.pendingId) {
2765
2826
  move(pendingBranch, container2, anchor2, 0);
2827
+ queuePostFlushCb(effects);
2766
2828
  }
2767
2829
  };
2768
2830
  }
@@ -2788,7 +2850,7 @@ var VueRuntimeDOM = (function (exports) {
2788
2850
  }
2789
2851
  parent = parent.parent;
2790
2852
  }
2791
- if (!hasUnresolvedAncestor) {
2853
+ if (!hasUnresolvedAncestor && !delayEnter) {
2792
2854
  queuePostFlushCb(effects);
2793
2855
  }
2794
2856
  suspense.effects = [];
@@ -2974,7 +3036,7 @@ var VueRuntimeDOM = (function (exports) {
2974
3036
  }
2975
3037
  if (isArray(s)) {
2976
3038
  const singleChild = filterSingleRoot(s);
2977
- if (!singleChild) {
3039
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
2978
3040
  warn(`<Suspense> slots expect a single root node.`);
2979
3041
  }
2980
3042
  s = singleChild;
@@ -4059,61 +4121,6 @@ var VueRuntimeDOM = (function (exports) {
4059
4121
  injectHook("ec", hook, target);
4060
4122
  }
4061
4123
 
4062
- const COMPONENTS = "components";
4063
- const DIRECTIVES = "directives";
4064
- function resolveComponent(name, maybeSelfReference) {
4065
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4066
- }
4067
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4068
- function resolveDynamicComponent(component) {
4069
- if (isString(component)) {
4070
- return resolveAsset(COMPONENTS, component, false) || component;
4071
- } else {
4072
- return component || NULL_DYNAMIC_COMPONENT;
4073
- }
4074
- }
4075
- function resolveDirective(name) {
4076
- return resolveAsset(DIRECTIVES, name);
4077
- }
4078
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4079
- const instance = currentRenderingInstance || currentInstance;
4080
- if (instance) {
4081
- const Component = instance.type;
4082
- if (type === COMPONENTS) {
4083
- const selfName = getComponentName(
4084
- Component,
4085
- false
4086
- /* do not include inferred name to avoid breaking existing code */
4087
- );
4088
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4089
- return Component;
4090
- }
4091
- }
4092
- const res = (
4093
- // local registration
4094
- // check instance[type] first which is resolved for options API
4095
- resolve(instance[type] || Component[type], name) || // global registration
4096
- resolve(instance.appContext[type], name)
4097
- );
4098
- if (!res && maybeSelfReference) {
4099
- return Component;
4100
- }
4101
- if (warnMissing && !res) {
4102
- const extra = type === COMPONENTS ? `
4103
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4104
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4105
- }
4106
- return res;
4107
- } else {
4108
- warn(
4109
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4110
- );
4111
- }
4112
- }
4113
- function resolve(registry, name) {
4114
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4115
- }
4116
-
4117
4124
  function renderList(source, renderItem, cache, index) {
4118
4125
  let ret;
4119
4126
  const cached = cache && cache[index];
@@ -5929,7 +5936,14 @@ If you want to remount the same app, move your app creation logic into a factory
5929
5936
  }
5930
5937
  break;
5931
5938
  case Comment:
5932
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5939
+ if (isTemplateNode(node)) {
5940
+ nextNode = nextSibling(node);
5941
+ replaceNode(
5942
+ vnode.el = node.content.firstChild,
5943
+ node,
5944
+ parentComponent
5945
+ );
5946
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5933
5947
  nextNode = onMismatch();
5934
5948
  } else {
5935
5949
  nextNode = nextSibling(node);
@@ -5972,7 +5986,7 @@ If you want to remount the same app, move your app creation logic into a factory
5972
5986
  break;
5973
5987
  default:
5974
5988
  if (shapeFlag & 1) {
5975
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
5989
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
5976
5990
  nextNode = onMismatch();
5977
5991
  } else {
5978
5992
  nextNode = hydrateElement(
@@ -5987,6 +6001,13 @@ If you want to remount the same app, move your app creation logic into a factory
5987
6001
  } else if (shapeFlag & 6) {
5988
6002
  vnode.slotScopeIds = slotScopeIds;
5989
6003
  const container = parentNode(node);
6004
+ if (isFragmentStart) {
6005
+ nextNode = locateClosingAnchor(node);
6006
+ } else if (isComment(node) && node.data === "teleport start") {
6007
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6008
+ } else {
6009
+ nextNode = nextSibling(node);
6010
+ }
5990
6011
  mountComponent(
5991
6012
  vnode,
5992
6013
  container,
@@ -5996,10 +6017,6 @@ If you want to remount the same app, move your app creation logic into a factory
5996
6017
  isSVGContainer(container),
5997
6018
  optimized
5998
6019
  );
5999
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
6000
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
6001
- nextNode = nextSibling(nextNode);
6002
- }
6003
6020
  if (isAsyncWrapper(vnode)) {
6004
6021
  let subTree;
6005
6022
  if (isFragmentStart) {
@@ -6049,7 +6066,7 @@ If you want to remount the same app, move your app creation logic into a factory
6049
6066
  };
6050
6067
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6051
6068
  optimized = optimized || !!vnode.dynamicChildren;
6052
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6069
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6053
6070
  const forcePatchValue = type === "input" && dirs || type === "option";
6054
6071
  {
6055
6072
  if (dirs) {
@@ -6086,12 +6103,23 @@ If you want to remount the same app, move your app creation logic into a factory
6086
6103
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6087
6104
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6088
6105
  }
6106
+ let needCallTransitionHooks = false;
6107
+ if (isTemplateNode(el)) {
6108
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6109
+ const content = el.content.firstChild;
6110
+ if (needCallTransitionHooks) {
6111
+ transition.beforeEnter(content);
6112
+ }
6113
+ replaceNode(content, el, parentComponent);
6114
+ vnode.el = el = content;
6115
+ }
6089
6116
  if (dirs) {
6090
6117
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6091
6118
  }
6092
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6119
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6093
6120
  queueEffectWithSuspense(() => {
6094
6121
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6122
+ needCallTransitionHooks && transition.enter(el);
6095
6123
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6096
6124
  }, parentSuspense);
6097
6125
  }
@@ -6209,7 +6237,7 @@ If you want to remount the same app, move your app creation logic into a factory
6209
6237
  );
6210
6238
  vnode.el = null;
6211
6239
  if (isFragment) {
6212
- const end = locateClosingAsyncAnchor(node);
6240
+ const end = locateClosingAnchor(node);
6213
6241
  while (true) {
6214
6242
  const next2 = nextSibling(node);
6215
6243
  if (next2 && next2 !== end) {
@@ -6234,14 +6262,14 @@ If you want to remount the same app, move your app creation logic into a factory
6234
6262
  );
6235
6263
  return next;
6236
6264
  };
6237
- const locateClosingAsyncAnchor = (node) => {
6265
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6238
6266
  let match = 0;
6239
6267
  while (node) {
6240
6268
  node = nextSibling(node);
6241
6269
  if (node && isComment(node)) {
6242
- if (node.data === "[")
6270
+ if (node.data === open)
6243
6271
  match++;
6244
- if (node.data === "]") {
6272
+ if (node.data === close) {
6245
6273
  if (match === 0) {
6246
6274
  return nextSibling(node);
6247
6275
  } else {
@@ -6252,6 +6280,22 @@ If you want to remount the same app, move your app creation logic into a factory
6252
6280
  }
6253
6281
  return node;
6254
6282
  };
6283
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6284
+ const parentNode2 = oldNode.parentNode;
6285
+ if (parentNode2) {
6286
+ parentNode2.replaceChild(newNode, oldNode);
6287
+ }
6288
+ let parent = parentComponent;
6289
+ while (parent) {
6290
+ if (parent.vnode.el === oldNode) {
6291
+ parent.vnode.el = parent.subTree.el = newNode;
6292
+ }
6293
+ parent = parent.parent;
6294
+ }
6295
+ };
6296
+ const isTemplateNode = (node) => {
6297
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6298
+ };
6255
6299
  return [hydrate, hydrateNode];
6256
6300
  }
6257
6301
 
@@ -6579,7 +6623,7 @@ If you want to remount the same app, move your app creation logic into a factory
6579
6623
  if (dirs) {
6580
6624
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6581
6625
  }
6582
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6626
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6583
6627
  if (needCallTransitionHooks) {
6584
6628
  transition.beforeEnter(el);
6585
6629
  }
@@ -7471,8 +7515,8 @@ If you want to remount the same app, move your app creation logic into a factory
7471
7515
  moveStaticNode(vnode, container, anchor);
7472
7516
  return;
7473
7517
  }
7474
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7475
- if (needTransition) {
7518
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7519
+ if (needTransition2) {
7476
7520
  if (moveType === 0) {
7477
7521
  transition.beforeEnter(el);
7478
7522
  hostInsert(el, container, anchor);
@@ -7692,6 +7736,9 @@ If you want to remount the same app, move your app creation logic into a factory
7692
7736
  function toggleRecurse({ effect, update }, allowed) {
7693
7737
  effect.allowRecurse = update.allowRecurse = allowed;
7694
7738
  }
7739
+ function needTransition(parentSuspense, transition) {
7740
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7741
+ }
7695
7742
  function traverseStaticChildren(n1, n2, shallow = false) {
7696
7743
  const ch1 = n1.children;
7697
7744
  const ch2 = n2.children;
@@ -9021,7 +9068,7 @@ Component that was made reactive: `,
9021
9068
  return true;
9022
9069
  }
9023
9070
 
9024
- const version = "3.3.6";
9071
+ const version = "3.3.8";
9025
9072
  const ssrUtils = null;
9026
9073
  const resolveFilter = null;
9027
9074
  const compatUtils = null;