@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
  });
@@ -1650,8 +1650,13 @@ function findInsertionIndex(id) {
1650
1650
  let end = queue.length;
1651
1651
  while (start < end) {
1652
1652
  const middle = start + end >>> 1;
1653
- const middleJobId = getId(queue[middle]);
1654
- middleJobId < id ? start = middle + 1 : end = middle;
1653
+ const middleJob = queue[middle];
1654
+ const middleJobId = getId(middleJob);
1655
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1656
+ start = middle + 1;
1657
+ } else {
1658
+ end = middle;
1659
+ }
1655
1660
  }
1656
1661
  return start;
1657
1662
  }
@@ -2929,6 +2934,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
2929
2934
  }
2930
2935
  }
2931
2936
 
2937
+ const COMPONENTS = "components";
2938
+ const DIRECTIVES = "directives";
2939
+ const FILTERS = "filters";
2940
+ function resolveComponent(name, maybeSelfReference) {
2941
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2942
+ }
2943
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2944
+ function resolveDynamicComponent(component) {
2945
+ if (isString(component)) {
2946
+ return resolveAsset(COMPONENTS, component, false) || component;
2947
+ } else {
2948
+ return component || NULL_DYNAMIC_COMPONENT;
2949
+ }
2950
+ }
2951
+ function resolveDirective(name) {
2952
+ return resolveAsset(DIRECTIVES, name);
2953
+ }
2954
+ function resolveFilter$1(name) {
2955
+ return resolveAsset(FILTERS, name);
2956
+ }
2957
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2958
+ const instance = currentRenderingInstance || currentInstance;
2959
+ if (instance) {
2960
+ const Component = instance.type;
2961
+ if (type === COMPONENTS) {
2962
+ const selfName = getComponentName(
2963
+ Component,
2964
+ false
2965
+ /* do not include inferred name to avoid breaking existing code */
2966
+ );
2967
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2968
+ return Component;
2969
+ }
2970
+ }
2971
+ const res = (
2972
+ // local registration
2973
+ // check instance[type] first which is resolved for options API
2974
+ resolve(instance[type] || Component[type], name) || // global registration
2975
+ resolve(instance.appContext[type], name)
2976
+ );
2977
+ if (!res && maybeSelfReference) {
2978
+ return Component;
2979
+ }
2980
+ if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
2981
+ const extra = type === COMPONENTS ? `
2982
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2983
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2984
+ }
2985
+ return res;
2986
+ } else if (!!(process.env.NODE_ENV !== "production")) {
2987
+ warn(
2988
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2989
+ );
2990
+ }
2991
+ }
2992
+ function resolve(registry, name) {
2993
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2994
+ }
2995
+
2932
2996
  const isSuspense = (type) => type.__isSuspense;
2933
2997
  const SuspenseImpl = {
2934
2998
  name: "Suspense",
@@ -3242,14 +3306,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3242
3306
  parentComponent: parentComponent2,
3243
3307
  container: container2
3244
3308
  } = suspense;
3309
+ let delayEnter = false;
3245
3310
  if (suspense.isHydrating) {
3246
3311
  suspense.isHydrating = false;
3247
3312
  } else if (!resume) {
3248
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3313
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3249
3314
  if (delayEnter) {
3250
3315
  activeBranch.transition.afterLeave = () => {
3251
3316
  if (pendingId === suspense.pendingId) {
3252
3317
  move(pendingBranch, container2, anchor2, 0);
3318
+ queuePostFlushCb(effects);
3253
3319
  }
3254
3320
  };
3255
3321
  }
@@ -3275,7 +3341,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3275
3341
  }
3276
3342
  parent = parent.parent;
3277
3343
  }
3278
- if (!hasUnresolvedAncestor) {
3344
+ if (!hasUnresolvedAncestor && !delayEnter) {
3279
3345
  queuePostFlushCb(effects);
3280
3346
  }
3281
3347
  suspense.effects = [];
@@ -3461,7 +3527,7 @@ function normalizeSuspenseSlot(s) {
3461
3527
  }
3462
3528
  if (isArray(s)) {
3463
3529
  const singleChild = filterSingleRoot(s);
3464
- if (!!(process.env.NODE_ENV !== "production") && !singleChild) {
3530
+ if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3465
3531
  warn(`<Suspense> slots expect a single root node.`);
3466
3532
  }
3467
3533
  s = singleChild;
@@ -4667,65 +4733,6 @@ function getCompatListeners(instance) {
4667
4733
  return listeners;
4668
4734
  }
4669
4735
 
4670
- const COMPONENTS = "components";
4671
- const DIRECTIVES = "directives";
4672
- const FILTERS = "filters";
4673
- function resolveComponent(name, maybeSelfReference) {
4674
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4675
- }
4676
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4677
- function resolveDynamicComponent(component) {
4678
- if (isString(component)) {
4679
- return resolveAsset(COMPONENTS, component, false) || component;
4680
- } else {
4681
- return component || NULL_DYNAMIC_COMPONENT;
4682
- }
4683
- }
4684
- function resolveDirective(name) {
4685
- return resolveAsset(DIRECTIVES, name);
4686
- }
4687
- function resolveFilter$1(name) {
4688
- return resolveAsset(FILTERS, name);
4689
- }
4690
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4691
- const instance = currentRenderingInstance || currentInstance;
4692
- if (instance) {
4693
- const Component = instance.type;
4694
- if (type === COMPONENTS) {
4695
- const selfName = getComponentName(
4696
- Component,
4697
- false
4698
- /* do not include inferred name to avoid breaking existing code */
4699
- );
4700
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4701
- return Component;
4702
- }
4703
- }
4704
- const res = (
4705
- // local registration
4706
- // check instance[type] first which is resolved for options API
4707
- resolve(instance[type] || Component[type], name) || // global registration
4708
- resolve(instance.appContext[type], name)
4709
- );
4710
- if (!res && maybeSelfReference) {
4711
- return Component;
4712
- }
4713
- if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
4714
- const extra = type === COMPONENTS ? `
4715
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4716
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4717
- }
4718
- return res;
4719
- } else if (!!(process.env.NODE_ENV !== "production")) {
4720
- warn(
4721
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4722
- );
4723
- }
4724
- }
4725
- function resolve(registry, name) {
4726
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4727
- }
4728
-
4729
4736
  function convertLegacyRenderFn(instance) {
4730
4737
  const Component2 = instance.type;
4731
4738
  const render = Component2.render;
@@ -6230,7 +6237,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6230
6237
  return vm;
6231
6238
  }
6232
6239
  }
6233
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6240
+ Vue.version = `2.6.14-compat:${"3.3.8"}`;
6234
6241
  Vue.config = singletonApp.config;
6235
6242
  Vue.use = (p, ...options) => {
6236
6243
  if (p && isFunction(p.install)) {
@@ -7562,7 +7569,14 @@ function createHydrationFunctions(rendererInternals) {
7562
7569
  }
7563
7570
  break;
7564
7571
  case Comment:
7565
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7572
+ if (isTemplateNode(node)) {
7573
+ nextNode = nextSibling(node);
7574
+ replaceNode(
7575
+ vnode.el = node.content.firstChild,
7576
+ node,
7577
+ parentComponent
7578
+ );
7579
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7566
7580
  nextNode = onMismatch();
7567
7581
  } else {
7568
7582
  nextNode = nextSibling(node);
@@ -7605,7 +7619,7 @@ function createHydrationFunctions(rendererInternals) {
7605
7619
  break;
7606
7620
  default:
7607
7621
  if (shapeFlag & 1) {
7608
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7622
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7609
7623
  nextNode = onMismatch();
7610
7624
  } else {
7611
7625
  nextNode = hydrateElement(
@@ -7620,6 +7634,13 @@ function createHydrationFunctions(rendererInternals) {
7620
7634
  } else if (shapeFlag & 6) {
7621
7635
  vnode.slotScopeIds = slotScopeIds;
7622
7636
  const container = parentNode(node);
7637
+ if (isFragmentStart) {
7638
+ nextNode = locateClosingAnchor(node);
7639
+ } else if (isComment(node) && node.data === "teleport start") {
7640
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7641
+ } else {
7642
+ nextNode = nextSibling(node);
7643
+ }
7623
7644
  mountComponent(
7624
7645
  vnode,
7625
7646
  container,
@@ -7629,10 +7650,6 @@ function createHydrationFunctions(rendererInternals) {
7629
7650
  isSVGContainer(container),
7630
7651
  optimized
7631
7652
  );
7632
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7633
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7634
- nextNode = nextSibling(nextNode);
7635
- }
7636
7653
  if (isAsyncWrapper(vnode)) {
7637
7654
  let subTree;
7638
7655
  if (isFragmentStart) {
@@ -7682,7 +7699,7 @@ function createHydrationFunctions(rendererInternals) {
7682
7699
  };
7683
7700
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7684
7701
  optimized = optimized || !!vnode.dynamicChildren;
7685
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7702
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7686
7703
  const forcePatchValue = type === "input" && dirs || type === "option";
7687
7704
  if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
7688
7705
  if (dirs) {
@@ -7719,12 +7736,23 @@ function createHydrationFunctions(rendererInternals) {
7719
7736
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7720
7737
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7721
7738
  }
7739
+ let needCallTransitionHooks = false;
7740
+ if (isTemplateNode(el)) {
7741
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7742
+ const content = el.content.firstChild;
7743
+ if (needCallTransitionHooks) {
7744
+ transition.beforeEnter(content);
7745
+ }
7746
+ replaceNode(content, el, parentComponent);
7747
+ vnode.el = el = content;
7748
+ }
7722
7749
  if (dirs) {
7723
7750
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7724
7751
  }
7725
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7752
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7726
7753
  queueEffectWithSuspense(() => {
7727
7754
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7755
+ needCallTransitionHooks && transition.enter(el);
7728
7756
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7729
7757
  }, parentSuspense);
7730
7758
  }
@@ -7842,7 +7870,7 @@ function createHydrationFunctions(rendererInternals) {
7842
7870
  );
7843
7871
  vnode.el = null;
7844
7872
  if (isFragment) {
7845
- const end = locateClosingAsyncAnchor(node);
7873
+ const end = locateClosingAnchor(node);
7846
7874
  while (true) {
7847
7875
  const next2 = nextSibling(node);
7848
7876
  if (next2 && next2 !== end) {
@@ -7867,14 +7895,14 @@ function createHydrationFunctions(rendererInternals) {
7867
7895
  );
7868
7896
  return next;
7869
7897
  };
7870
- const locateClosingAsyncAnchor = (node) => {
7898
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7871
7899
  let match = 0;
7872
7900
  while (node) {
7873
7901
  node = nextSibling(node);
7874
7902
  if (node && isComment(node)) {
7875
- if (node.data === "[")
7903
+ if (node.data === open)
7876
7904
  match++;
7877
- if (node.data === "]") {
7905
+ if (node.data === close) {
7878
7906
  if (match === 0) {
7879
7907
  return nextSibling(node);
7880
7908
  } else {
@@ -7885,6 +7913,22 @@ function createHydrationFunctions(rendererInternals) {
7885
7913
  }
7886
7914
  return node;
7887
7915
  };
7916
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7917
+ const parentNode2 = oldNode.parentNode;
7918
+ if (parentNode2) {
7919
+ parentNode2.replaceChild(newNode, oldNode);
7920
+ }
7921
+ let parent = parentComponent;
7922
+ while (parent) {
7923
+ if (parent.vnode.el === oldNode) {
7924
+ parent.vnode.el = parent.subTree.el = newNode;
7925
+ }
7926
+ parent = parent.parent;
7927
+ }
7928
+ };
7929
+ const isTemplateNode = (node) => {
7930
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7931
+ };
7888
7932
  return [hydrate, hydrateNode];
7889
7933
  }
7890
7934
 
@@ -8235,7 +8279,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8235
8279
  if (dirs) {
8236
8280
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8237
8281
  }
8238
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8282
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8239
8283
  if (needCallTransitionHooks) {
8240
8284
  transition.beforeEnter(el);
8241
8285
  }
@@ -9163,8 +9207,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9163
9207
  moveStaticNode(vnode, container, anchor);
9164
9208
  return;
9165
9209
  }
9166
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9167
- if (needTransition) {
9210
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9211
+ if (needTransition2) {
9168
9212
  if (moveType === 0) {
9169
9213
  transition.beforeEnter(el);
9170
9214
  hostInsert(el, container, anchor);
@@ -9393,6 +9437,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9393
9437
  function toggleRecurse({ effect, update }, allowed) {
9394
9438
  effect.allowRecurse = update.allowRecurse = allowed;
9395
9439
  }
9440
+ function needTransition(parentSuspense, transition) {
9441
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9442
+ }
9396
9443
  function traverseStaticChildren(n1, n2, shallow = false) {
9397
9444
  const ch1 = n1.children;
9398
9445
  const ch2 = n2.children;
@@ -10829,7 +10876,7 @@ function isMemoSame(cached, memo) {
10829
10876
  return true;
10830
10877
  }
10831
10878
 
10832
- const version = "3.3.6";
10879
+ const version = "3.3.8";
10833
10880
  const _ssrUtils = {
10834
10881
  createComponentInstance,
10835
10882
  setupComponent,