@vue/compat 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.
@@ -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
  }
@@ -2912,6 +2917,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
2912
2917
  }
2913
2918
  }
2914
2919
 
2920
+ const COMPONENTS = "components";
2921
+ const DIRECTIVES = "directives";
2922
+ const FILTERS = "filters";
2923
+ function resolveComponent(name, maybeSelfReference) {
2924
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2925
+ }
2926
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2927
+ function resolveDynamicComponent(component) {
2928
+ if (isString(component)) {
2929
+ return resolveAsset(COMPONENTS, component, false) || component;
2930
+ } else {
2931
+ return component || NULL_DYNAMIC_COMPONENT;
2932
+ }
2933
+ }
2934
+ function resolveDirective(name) {
2935
+ return resolveAsset(DIRECTIVES, name);
2936
+ }
2937
+ function resolveFilter$1(name) {
2938
+ return resolveAsset(FILTERS, name);
2939
+ }
2940
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2941
+ const instance = currentRenderingInstance || currentInstance;
2942
+ if (instance) {
2943
+ const Component = instance.type;
2944
+ if (type === COMPONENTS) {
2945
+ const selfName = getComponentName(
2946
+ Component,
2947
+ false
2948
+ /* do not include inferred name to avoid breaking existing code */
2949
+ );
2950
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2951
+ return Component;
2952
+ }
2953
+ }
2954
+ const res = (
2955
+ // local registration
2956
+ // check instance[type] first which is resolved for options API
2957
+ resolve(instance[type] || Component[type], name) || // global registration
2958
+ resolve(instance.appContext[type], name)
2959
+ );
2960
+ if (!res && maybeSelfReference) {
2961
+ return Component;
2962
+ }
2963
+ if (warnMissing && !res) {
2964
+ const extra = type === COMPONENTS ? `
2965
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2966
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2967
+ }
2968
+ return res;
2969
+ } else {
2970
+ warn(
2971
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2972
+ );
2973
+ }
2974
+ }
2975
+ function resolve(registry, name) {
2976
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2977
+ }
2978
+
2915
2979
  const isSuspense = (type) => type.__isSuspense;
2916
2980
  const SuspenseImpl = {
2917
2981
  name: "Suspense",
@@ -3225,14 +3289,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3225
3289
  parentComponent: parentComponent2,
3226
3290
  container: container2
3227
3291
  } = suspense;
3292
+ let delayEnter = false;
3228
3293
  if (suspense.isHydrating) {
3229
3294
  suspense.isHydrating = false;
3230
3295
  } else if (!resume) {
3231
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3296
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3232
3297
  if (delayEnter) {
3233
3298
  activeBranch.transition.afterLeave = () => {
3234
3299
  if (pendingId === suspense.pendingId) {
3235
3300
  move(pendingBranch, container2, anchor2, 0);
3301
+ queuePostFlushCb(effects);
3236
3302
  }
3237
3303
  };
3238
3304
  }
@@ -3258,7 +3324,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3258
3324
  }
3259
3325
  parent = parent.parent;
3260
3326
  }
3261
- if (!hasUnresolvedAncestor) {
3327
+ if (!hasUnresolvedAncestor && !delayEnter) {
3262
3328
  queuePostFlushCb(effects);
3263
3329
  }
3264
3330
  suspense.effects = [];
@@ -3444,7 +3510,7 @@ function normalizeSuspenseSlot(s) {
3444
3510
  }
3445
3511
  if (isArray(s)) {
3446
3512
  const singleChild = filterSingleRoot(s);
3447
- if (!singleChild) {
3513
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3448
3514
  warn(`<Suspense> slots expect a single root node.`);
3449
3515
  }
3450
3516
  s = singleChild;
@@ -4621,65 +4687,6 @@ function getCompatListeners(instance) {
4621
4687
  return listeners;
4622
4688
  }
4623
4689
 
4624
- const COMPONENTS = "components";
4625
- const DIRECTIVES = "directives";
4626
- const FILTERS = "filters";
4627
- function resolveComponent(name, maybeSelfReference) {
4628
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4629
- }
4630
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4631
- function resolveDynamicComponent(component) {
4632
- if (isString(component)) {
4633
- return resolveAsset(COMPONENTS, component, false) || component;
4634
- } else {
4635
- return component || NULL_DYNAMIC_COMPONENT;
4636
- }
4637
- }
4638
- function resolveDirective(name) {
4639
- return resolveAsset(DIRECTIVES, name);
4640
- }
4641
- function resolveFilter$1(name) {
4642
- return resolveAsset(FILTERS, name);
4643
- }
4644
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4645
- const instance = currentRenderingInstance || currentInstance;
4646
- if (instance) {
4647
- const Component = instance.type;
4648
- if (type === COMPONENTS) {
4649
- const selfName = getComponentName(
4650
- Component,
4651
- false
4652
- /* do not include inferred name to avoid breaking existing code */
4653
- );
4654
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4655
- return Component;
4656
- }
4657
- }
4658
- const res = (
4659
- // local registration
4660
- // check instance[type] first which is resolved for options API
4661
- resolve(instance[type] || Component[type], name) || // global registration
4662
- resolve(instance.appContext[type], name)
4663
- );
4664
- if (!res && maybeSelfReference) {
4665
- return Component;
4666
- }
4667
- if (warnMissing && !res) {
4668
- const extra = type === COMPONENTS ? `
4669
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4670
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4671
- }
4672
- return res;
4673
- } else {
4674
- warn(
4675
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4676
- );
4677
- }
4678
- }
4679
- function resolve(registry, name) {
4680
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4681
- }
4682
-
4683
4690
  function convertLegacyRenderFn(instance) {
4684
4691
  const Component2 = instance.type;
4685
4692
  const render = Component2.render;
@@ -6182,7 +6189,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6182
6189
  return vm;
6183
6190
  }
6184
6191
  }
6185
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6192
+ Vue.version = `2.6.14-compat:${"3.3.8"}`;
6186
6193
  Vue.config = singletonApp.config;
6187
6194
  Vue.use = (p, ...options) => {
6188
6195
  if (p && isFunction(p.install)) {
@@ -7511,7 +7518,14 @@ function createHydrationFunctions(rendererInternals) {
7511
7518
  }
7512
7519
  break;
7513
7520
  case Comment:
7514
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7521
+ if (isTemplateNode(node)) {
7522
+ nextNode = nextSibling(node);
7523
+ replaceNode(
7524
+ vnode.el = node.content.firstChild,
7525
+ node,
7526
+ parentComponent
7527
+ );
7528
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7515
7529
  nextNode = onMismatch();
7516
7530
  } else {
7517
7531
  nextNode = nextSibling(node);
@@ -7554,7 +7568,7 @@ function createHydrationFunctions(rendererInternals) {
7554
7568
  break;
7555
7569
  default:
7556
7570
  if (shapeFlag & 1) {
7557
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7571
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7558
7572
  nextNode = onMismatch();
7559
7573
  } else {
7560
7574
  nextNode = hydrateElement(
@@ -7569,6 +7583,13 @@ function createHydrationFunctions(rendererInternals) {
7569
7583
  } else if (shapeFlag & 6) {
7570
7584
  vnode.slotScopeIds = slotScopeIds;
7571
7585
  const container = parentNode(node);
7586
+ if (isFragmentStart) {
7587
+ nextNode = locateClosingAnchor(node);
7588
+ } else if (isComment(node) && node.data === "teleport start") {
7589
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7590
+ } else {
7591
+ nextNode = nextSibling(node);
7592
+ }
7572
7593
  mountComponent(
7573
7594
  vnode,
7574
7595
  container,
@@ -7578,10 +7599,6 @@ function createHydrationFunctions(rendererInternals) {
7578
7599
  isSVGContainer(container),
7579
7600
  optimized
7580
7601
  );
7581
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7582
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7583
- nextNode = nextSibling(nextNode);
7584
- }
7585
7602
  if (isAsyncWrapper(vnode)) {
7586
7603
  let subTree;
7587
7604
  if (isFragmentStart) {
@@ -7631,7 +7648,7 @@ function createHydrationFunctions(rendererInternals) {
7631
7648
  };
7632
7649
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7633
7650
  optimized = optimized || !!vnode.dynamicChildren;
7634
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7651
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7635
7652
  const forcePatchValue = type === "input" && dirs || type === "option";
7636
7653
  {
7637
7654
  if (dirs) {
@@ -7668,12 +7685,23 @@ function createHydrationFunctions(rendererInternals) {
7668
7685
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7669
7686
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7670
7687
  }
7688
+ let needCallTransitionHooks = false;
7689
+ if (isTemplateNode(el)) {
7690
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7691
+ const content = el.content.firstChild;
7692
+ if (needCallTransitionHooks) {
7693
+ transition.beforeEnter(content);
7694
+ }
7695
+ replaceNode(content, el, parentComponent);
7696
+ vnode.el = el = content;
7697
+ }
7671
7698
  if (dirs) {
7672
7699
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7673
7700
  }
7674
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7701
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7675
7702
  queueEffectWithSuspense(() => {
7676
7703
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7704
+ needCallTransitionHooks && transition.enter(el);
7677
7705
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7678
7706
  }, parentSuspense);
7679
7707
  }
@@ -7791,7 +7819,7 @@ function createHydrationFunctions(rendererInternals) {
7791
7819
  );
7792
7820
  vnode.el = null;
7793
7821
  if (isFragment) {
7794
- const end = locateClosingAsyncAnchor(node);
7822
+ const end = locateClosingAnchor(node);
7795
7823
  while (true) {
7796
7824
  const next2 = nextSibling(node);
7797
7825
  if (next2 && next2 !== end) {
@@ -7816,14 +7844,14 @@ function createHydrationFunctions(rendererInternals) {
7816
7844
  );
7817
7845
  return next;
7818
7846
  };
7819
- const locateClosingAsyncAnchor = (node) => {
7847
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7820
7848
  let match = 0;
7821
7849
  while (node) {
7822
7850
  node = nextSibling(node);
7823
7851
  if (node && isComment(node)) {
7824
- if (node.data === "[")
7852
+ if (node.data === open)
7825
7853
  match++;
7826
- if (node.data === "]") {
7854
+ if (node.data === close) {
7827
7855
  if (match === 0) {
7828
7856
  return nextSibling(node);
7829
7857
  } else {
@@ -7834,6 +7862,22 @@ function createHydrationFunctions(rendererInternals) {
7834
7862
  }
7835
7863
  return node;
7836
7864
  };
7865
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7866
+ const parentNode2 = oldNode.parentNode;
7867
+ if (parentNode2) {
7868
+ parentNode2.replaceChild(newNode, oldNode);
7869
+ }
7870
+ let parent = parentComponent;
7871
+ while (parent) {
7872
+ if (parent.vnode.el === oldNode) {
7873
+ parent.vnode.el = parent.subTree.el = newNode;
7874
+ }
7875
+ parent = parent.parent;
7876
+ }
7877
+ };
7878
+ const isTemplateNode = (node) => {
7879
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7880
+ };
7837
7881
  return [hydrate, hydrateNode];
7838
7882
  }
7839
7883
 
@@ -8161,7 +8205,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8161
8205
  if (dirs) {
8162
8206
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8163
8207
  }
8164
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8208
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8165
8209
  if (needCallTransitionHooks) {
8166
8210
  transition.beforeEnter(el);
8167
8211
  }
@@ -9078,8 +9122,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9078
9122
  moveStaticNode(vnode, container, anchor);
9079
9123
  return;
9080
9124
  }
9081
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9082
- if (needTransition) {
9125
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9126
+ if (needTransition2) {
9083
9127
  if (moveType === 0) {
9084
9128
  transition.beforeEnter(el);
9085
9129
  hostInsert(el, container, anchor);
@@ -9308,6 +9352,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9308
9352
  function toggleRecurse({ effect, update }, allowed) {
9309
9353
  effect.allowRecurse = update.allowRecurse = allowed;
9310
9354
  }
9355
+ function needTransition(parentSuspense, transition) {
9356
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9357
+ }
9311
9358
  function traverseStaticChildren(n1, n2, shallow = false) {
9312
9359
  const ch1 = n1.children;
9313
9360
  const ch2 = n2.children;
@@ -10716,7 +10763,7 @@ function isMemoSame(cached, memo) {
10716
10763
  return true;
10717
10764
  }
10718
10765
 
10719
- const version = "3.3.6";
10766
+ const version = "3.3.8";
10720
10767
  const ssrUtils = null;
10721
10768
  const resolveFilter = resolveFilter$1 ;
10722
10769
  const _compatUtils = {