@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.
@@ -271,7 +271,7 @@ interface AriaAttributes {
271
271
  * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
272
272
  * @see aria-atomic.
273
273
  */
274
- 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text';
274
+ 'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals';
275
275
  /** Indicates that user input is required on the element before a form may be submitted. */
276
276
  'aria-required'?: Booleanish;
277
277
  /** Defines a human-readable, author-localized description for the role of an element. */
@@ -540,7 +540,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
540
540
  } else if (key === "length" && isArray(target)) {
541
541
  const newLength = Number(newValue);
542
542
  depsMap.forEach((dep, key2) => {
543
- if (key2 === "length" || key2 >= newLength) {
543
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
544
544
  deps.push(dep);
545
545
  }
546
546
  });
@@ -1636,8 +1636,13 @@ function findInsertionIndex(id) {
1636
1636
  let end = queue.length;
1637
1637
  while (start < end) {
1638
1638
  const middle = start + end >>> 1;
1639
- const middleJobId = getId(queue[middle]);
1640
- middleJobId < id ? start = middle + 1 : end = middle;
1639
+ const middleJob = queue[middle];
1640
+ const middleJobId = getId(middleJob);
1641
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1642
+ start = middle + 1;
1643
+ } else {
1644
+ end = middle;
1645
+ }
1641
1646
  }
1642
1647
  return start;
1643
1648
  }
@@ -2439,6 +2444,61 @@ function updateHOCHostEl({ vnode, parent }, el) {
2439
2444
  }
2440
2445
  }
2441
2446
 
2447
+ const COMPONENTS = "components";
2448
+ const DIRECTIVES = "directives";
2449
+ function resolveComponent(name, maybeSelfReference) {
2450
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2451
+ }
2452
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2453
+ function resolveDynamicComponent(component) {
2454
+ if (isString(component)) {
2455
+ return resolveAsset(COMPONENTS, component, false) || component;
2456
+ } else {
2457
+ return component || NULL_DYNAMIC_COMPONENT;
2458
+ }
2459
+ }
2460
+ function resolveDirective(name) {
2461
+ return resolveAsset(DIRECTIVES, name);
2462
+ }
2463
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2464
+ const instance = currentRenderingInstance || currentInstance;
2465
+ if (instance) {
2466
+ const Component = instance.type;
2467
+ if (type === COMPONENTS) {
2468
+ const selfName = getComponentName(
2469
+ Component,
2470
+ false
2471
+ /* do not include inferred name to avoid breaking existing code */
2472
+ );
2473
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2474
+ return Component;
2475
+ }
2476
+ }
2477
+ const res = (
2478
+ // local registration
2479
+ // check instance[type] first which is resolved for options API
2480
+ resolve(instance[type] || Component[type], name) || // global registration
2481
+ resolve(instance.appContext[type], name)
2482
+ );
2483
+ if (!res && maybeSelfReference) {
2484
+ return Component;
2485
+ }
2486
+ if (warnMissing && !res) {
2487
+ const extra = type === COMPONENTS ? `
2488
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2489
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2490
+ }
2491
+ return res;
2492
+ } else {
2493
+ warn(
2494
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2495
+ );
2496
+ }
2497
+ }
2498
+ function resolve(registry, name) {
2499
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2500
+ }
2501
+
2442
2502
  const isSuspense = (type) => type.__isSuspense;
2443
2503
  const SuspenseImpl = {
2444
2504
  name: "Suspense",
@@ -2752,14 +2812,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2752
2812
  parentComponent: parentComponent2,
2753
2813
  container: container2
2754
2814
  } = suspense;
2815
+ let delayEnter = false;
2755
2816
  if (suspense.isHydrating) {
2756
2817
  suspense.isHydrating = false;
2757
2818
  } else if (!resume) {
2758
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2819
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2759
2820
  if (delayEnter) {
2760
2821
  activeBranch.transition.afterLeave = () => {
2761
2822
  if (pendingId === suspense.pendingId) {
2762
2823
  move(pendingBranch, container2, anchor2, 0);
2824
+ queuePostFlushCb(effects);
2763
2825
  }
2764
2826
  };
2765
2827
  }
@@ -2785,7 +2847,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2785
2847
  }
2786
2848
  parent = parent.parent;
2787
2849
  }
2788
- if (!hasUnresolvedAncestor) {
2850
+ if (!hasUnresolvedAncestor && !delayEnter) {
2789
2851
  queuePostFlushCb(effects);
2790
2852
  }
2791
2853
  suspense.effects = [];
@@ -2971,7 +3033,7 @@ function normalizeSuspenseSlot(s) {
2971
3033
  }
2972
3034
  if (isArray(s)) {
2973
3035
  const singleChild = filterSingleRoot(s);
2974
- if (!singleChild) {
3036
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
2975
3037
  warn(`<Suspense> slots expect a single root node.`);
2976
3038
  }
2977
3039
  s = singleChild;
@@ -4056,61 +4118,6 @@ function onErrorCaptured(hook, target = currentInstance) {
4056
4118
  injectHook("ec", hook, target);
4057
4119
  }
4058
4120
 
4059
- const COMPONENTS = "components";
4060
- const DIRECTIVES = "directives";
4061
- function resolveComponent(name, maybeSelfReference) {
4062
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4063
- }
4064
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4065
- function resolveDynamicComponent(component) {
4066
- if (isString(component)) {
4067
- return resolveAsset(COMPONENTS, component, false) || component;
4068
- } else {
4069
- return component || NULL_DYNAMIC_COMPONENT;
4070
- }
4071
- }
4072
- function resolveDirective(name) {
4073
- return resolveAsset(DIRECTIVES, name);
4074
- }
4075
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4076
- const instance = currentRenderingInstance || currentInstance;
4077
- if (instance) {
4078
- const Component = instance.type;
4079
- if (type === COMPONENTS) {
4080
- const selfName = getComponentName(
4081
- Component,
4082
- false
4083
- /* do not include inferred name to avoid breaking existing code */
4084
- );
4085
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4086
- return Component;
4087
- }
4088
- }
4089
- const res = (
4090
- // local registration
4091
- // check instance[type] first which is resolved for options API
4092
- resolve(instance[type] || Component[type], name) || // global registration
4093
- resolve(instance.appContext[type], name)
4094
- );
4095
- if (!res && maybeSelfReference) {
4096
- return Component;
4097
- }
4098
- if (warnMissing && !res) {
4099
- const extra = type === COMPONENTS ? `
4100
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4101
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4102
- }
4103
- return res;
4104
- } else {
4105
- warn(
4106
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4107
- );
4108
- }
4109
- }
4110
- function resolve(registry, name) {
4111
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4112
- }
4113
-
4114
4121
  function renderList(source, renderItem, cache, index) {
4115
4122
  let ret;
4116
4123
  const cached = cache && cache[index];
@@ -5926,7 +5933,14 @@ function createHydrationFunctions(rendererInternals) {
5926
5933
  }
5927
5934
  break;
5928
5935
  case Comment:
5929
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5936
+ if (isTemplateNode(node)) {
5937
+ nextNode = nextSibling(node);
5938
+ replaceNode(
5939
+ vnode.el = node.content.firstChild,
5940
+ node,
5941
+ parentComponent
5942
+ );
5943
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
5930
5944
  nextNode = onMismatch();
5931
5945
  } else {
5932
5946
  nextNode = nextSibling(node);
@@ -5969,7 +5983,7 @@ function createHydrationFunctions(rendererInternals) {
5969
5983
  break;
5970
5984
  default:
5971
5985
  if (shapeFlag & 1) {
5972
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
5986
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
5973
5987
  nextNode = onMismatch();
5974
5988
  } else {
5975
5989
  nextNode = hydrateElement(
@@ -5984,6 +5998,13 @@ function createHydrationFunctions(rendererInternals) {
5984
5998
  } else if (shapeFlag & 6) {
5985
5999
  vnode.slotScopeIds = slotScopeIds;
5986
6000
  const container = parentNode(node);
6001
+ if (isFragmentStart) {
6002
+ nextNode = locateClosingAnchor(node);
6003
+ } else if (isComment(node) && node.data === "teleport start") {
6004
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6005
+ } else {
6006
+ nextNode = nextSibling(node);
6007
+ }
5987
6008
  mountComponent(
5988
6009
  vnode,
5989
6010
  container,
@@ -5993,10 +6014,6 @@ function createHydrationFunctions(rendererInternals) {
5993
6014
  isSVGContainer(container),
5994
6015
  optimized
5995
6016
  );
5996
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
5997
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
5998
- nextNode = nextSibling(nextNode);
5999
- }
6000
6017
  if (isAsyncWrapper(vnode)) {
6001
6018
  let subTree;
6002
6019
  if (isFragmentStart) {
@@ -6046,7 +6063,7 @@ function createHydrationFunctions(rendererInternals) {
6046
6063
  };
6047
6064
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6048
6065
  optimized = optimized || !!vnode.dynamicChildren;
6049
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6066
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6050
6067
  const forcePatchValue = type === "input" && dirs || type === "option";
6051
6068
  {
6052
6069
  if (dirs) {
@@ -6083,12 +6100,23 @@ function createHydrationFunctions(rendererInternals) {
6083
6100
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6084
6101
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6085
6102
  }
6103
+ let needCallTransitionHooks = false;
6104
+ if (isTemplateNode(el)) {
6105
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6106
+ const content = el.content.firstChild;
6107
+ if (needCallTransitionHooks) {
6108
+ transition.beforeEnter(content);
6109
+ }
6110
+ replaceNode(content, el, parentComponent);
6111
+ vnode.el = el = content;
6112
+ }
6086
6113
  if (dirs) {
6087
6114
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6088
6115
  }
6089
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6116
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6090
6117
  queueEffectWithSuspense(() => {
6091
6118
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6119
+ needCallTransitionHooks && transition.enter(el);
6092
6120
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6093
6121
  }, parentSuspense);
6094
6122
  }
@@ -6206,7 +6234,7 @@ function createHydrationFunctions(rendererInternals) {
6206
6234
  );
6207
6235
  vnode.el = null;
6208
6236
  if (isFragment) {
6209
- const end = locateClosingAsyncAnchor(node);
6237
+ const end = locateClosingAnchor(node);
6210
6238
  while (true) {
6211
6239
  const next2 = nextSibling(node);
6212
6240
  if (next2 && next2 !== end) {
@@ -6231,14 +6259,14 @@ function createHydrationFunctions(rendererInternals) {
6231
6259
  );
6232
6260
  return next;
6233
6261
  };
6234
- const locateClosingAsyncAnchor = (node) => {
6262
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6235
6263
  let match = 0;
6236
6264
  while (node) {
6237
6265
  node = nextSibling(node);
6238
6266
  if (node && isComment(node)) {
6239
- if (node.data === "[")
6267
+ if (node.data === open)
6240
6268
  match++;
6241
- if (node.data === "]") {
6269
+ if (node.data === close) {
6242
6270
  if (match === 0) {
6243
6271
  return nextSibling(node);
6244
6272
  } else {
@@ -6249,6 +6277,22 @@ function createHydrationFunctions(rendererInternals) {
6249
6277
  }
6250
6278
  return node;
6251
6279
  };
6280
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6281
+ const parentNode2 = oldNode.parentNode;
6282
+ if (parentNode2) {
6283
+ parentNode2.replaceChild(newNode, oldNode);
6284
+ }
6285
+ let parent = parentComponent;
6286
+ while (parent) {
6287
+ if (parent.vnode.el === oldNode) {
6288
+ parent.vnode.el = parent.subTree.el = newNode;
6289
+ }
6290
+ parent = parent.parent;
6291
+ }
6292
+ };
6293
+ const isTemplateNode = (node) => {
6294
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6295
+ };
6252
6296
  return [hydrate, hydrateNode];
6253
6297
  }
6254
6298
 
@@ -6576,7 +6620,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6576
6620
  if (dirs) {
6577
6621
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6578
6622
  }
6579
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6623
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6580
6624
  if (needCallTransitionHooks) {
6581
6625
  transition.beforeEnter(el);
6582
6626
  }
@@ -7468,8 +7512,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7468
7512
  moveStaticNode(vnode, container, anchor);
7469
7513
  return;
7470
7514
  }
7471
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7472
- if (needTransition) {
7515
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7516
+ if (needTransition2) {
7473
7517
  if (moveType === 0) {
7474
7518
  transition.beforeEnter(el);
7475
7519
  hostInsert(el, container, anchor);
@@ -7689,6 +7733,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7689
7733
  function toggleRecurse({ effect, update }, allowed) {
7690
7734
  effect.allowRecurse = update.allowRecurse = allowed;
7691
7735
  }
7736
+ function needTransition(parentSuspense, transition) {
7737
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7738
+ }
7692
7739
  function traverseStaticChildren(n1, n2, shallow = false) {
7693
7740
  const ch1 = n1.children;
7694
7741
  const ch2 = n2.children;
@@ -9024,7 +9071,7 @@ function isMemoSame(cached, memo) {
9024
9071
  return true;
9025
9072
  }
9026
9073
 
9027
- const version = "3.3.6";
9074
+ const version = "3.3.8";
9028
9075
  const ssrUtils = null;
9029
9076
  const resolveFilter = null;
9030
9077
  const compatUtils = null;