@vue/compat 3.6.0-alpha.5 → 3.6.0-alpha.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.5
2
+ * @vue/compat v3.6.0-alpha.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2070,6 +2070,16 @@ class EffectScope {
2070
2070
  return;
2071
2071
  }
2072
2072
  this.flags = 1024;
2073
+ this.reset();
2074
+ const sub = this.subs;
2075
+ if (sub !== void 0) {
2076
+ unlink(sub);
2077
+ }
2078
+ }
2079
+ /**
2080
+ * @internal
2081
+ */
2082
+ reset() {
2073
2083
  let dep = this.deps;
2074
2084
  while (dep !== void 0) {
2075
2085
  const node = dep.dep;
@@ -2080,10 +2090,6 @@ class EffectScope {
2080
2090
  dep = unlink(dep, this);
2081
2091
  }
2082
2092
  }
2083
- const sub = this.subs;
2084
- if (sub !== void 0) {
2085
- unlink(sub);
2086
- }
2087
2093
  cleanup(this);
2088
2094
  }
2089
2095
  }
@@ -2895,6 +2901,7 @@ function checkRecursiveUpdates(seen, fn) {
2895
2901
 
2896
2902
  let isHmrUpdating = false;
2897
2903
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2904
+ const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2898
2905
  {
2899
2906
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
2900
2907
  createRecord: tryWrap(createRecord),
@@ -2958,9 +2965,10 @@ function reload(id, newComp) {
2958
2965
  const record = map.get(id);
2959
2966
  if (!record) return;
2960
2967
  newComp = normalizeClassComponent(newComp);
2968
+ const isVapor = record.initialDef.__vapor;
2961
2969
  updateComponentDef(record.initialDef, newComp);
2962
2970
  const instances = [...record.instances];
2963
- if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
2971
+ if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2964
2972
  for (const instance of instances) {
2965
2973
  if (instance.root && instance.root.ce && instance !== instance.root) {
2966
2974
  instance.root.ce._removeChildStyle(instance.type);
@@ -2980,6 +2988,7 @@ function reload(id, newComp) {
2980
2988
  hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2981
2989
  }
2982
2990
  dirtyInstances.add(instance);
2991
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2983
2992
  instance.appContext.propsCache.delete(instance.type);
2984
2993
  instance.appContext.emitsCache.delete(instance.type);
2985
2994
  instance.appContext.optionsCache.delete(instance.type);
@@ -3020,6 +3029,7 @@ function reload(id, newComp) {
3020
3029
  }
3021
3030
  queuePostFlushCb(() => {
3022
3031
  hmrDirtyComponents.clear();
3032
+ hmrDirtyComponentsMode.clear();
3023
3033
  });
3024
3034
  }
3025
3035
  function updateComponentDef(oldComp, newComp) {
@@ -4178,7 +4188,7 @@ const BaseTransitionPropsValidators = {
4178
4188
  onAppearCancelled: TransitionHookValidator
4179
4189
  };
4180
4190
  const recursiveGetSubtree = (instance) => {
4181
- const subTree = instance.type.__vapor ? instance.block : instance.subTree;
4191
+ const subTree = isVaporComponent(instance.type) ? instance.block : instance.subTree;
4182
4192
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
4183
4193
  };
4184
4194
  const BaseTransitionImpl = {
@@ -4488,7 +4498,7 @@ function getInnerChild$1(vnode) {
4488
4498
  }
4489
4499
  function setTransitionHooks(vnode, hooks) {
4490
4500
  if (vnode.shapeFlag & 6 && vnode.component) {
4491
- if (vnode.type.__vapor) {
4501
+ if (isVaporComponent(vnode.type)) {
4492
4502
  getVaporInterface(vnode.component, vnode).setTransitionHooks(
4493
4503
  vnode.component,
4494
4504
  hooks
@@ -4897,7 +4907,8 @@ function createHydrationFunctions(rendererInternals) {
4897
4907
  node,
4898
4908
  container,
4899
4909
  null,
4900
- parentComponent
4910
+ parentComponent,
4911
+ parentSuspense
4901
4912
  );
4902
4913
  } else {
4903
4914
  mountComponent(
@@ -7687,7 +7698,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7687
7698
  return vm;
7688
7699
  }
7689
7700
  }
7690
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.5"}`;
7701
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.7"}`;
7691
7702
  Vue.config = singletonApp.config;
7692
7703
  Vue.use = (plugin, ...options) => {
7693
7704
  if (plugin && isFunction(plugin.install)) {
@@ -8786,29 +8797,7 @@ function renderComponentRoot(instance) {
8786
8797
  }
8787
8798
  root = cloneVNode(root, fallthroughAttrs, false, true);
8788
8799
  } else if (!accessedAttrs && root.type !== Comment) {
8789
- const allAttrs = Object.keys(attrs);
8790
- const eventAttrs = [];
8791
- const extraAttrs = [];
8792
- for (let i = 0, l = allAttrs.length; i < l; i++) {
8793
- const key = allAttrs[i];
8794
- if (isOn(key)) {
8795
- if (!isModelListener(key)) {
8796
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8797
- }
8798
- } else {
8799
- extraAttrs.push(key);
8800
- }
8801
- }
8802
- if (extraAttrs.length) {
8803
- warn$1(
8804
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8805
- );
8806
- }
8807
- if (eventAttrs.length) {
8808
- warn$1(
8809
- `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
8810
- );
8811
- }
8800
+ warnExtraneousAttributes(attrs);
8812
8801
  }
8813
8802
  }
8814
8803
  }
@@ -8881,6 +8870,31 @@ const getChildRoot = (vnode) => {
8881
8870
  };
8882
8871
  return [normalizeVNode(childRoot), setRoot];
8883
8872
  };
8873
+ function warnExtraneousAttributes(attrs) {
8874
+ const allAttrs = Object.keys(attrs);
8875
+ const eventAttrs = [];
8876
+ const extraAttrs = [];
8877
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
8878
+ const key = allAttrs[i];
8879
+ if (isOn(key)) {
8880
+ if (!isModelListener(key)) {
8881
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8882
+ }
8883
+ } else {
8884
+ extraAttrs.push(key);
8885
+ }
8886
+ }
8887
+ if (extraAttrs.length) {
8888
+ warn$1(
8889
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8890
+ );
8891
+ }
8892
+ if (eventAttrs.length) {
8893
+ warn$1(
8894
+ `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
8895
+ );
8896
+ }
8897
+ }
8884
8898
  function filterSingleRoot(children, recurse = true) {
8885
8899
  let singleRoot;
8886
8900
  for (let i = 0; i < children.length; i++) {
@@ -9702,7 +9716,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9702
9716
  );
9703
9717
  break;
9704
9718
  case VaporSlot:
9705
- getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
9719
+ getVaporInterface(parentComponent, n2).slot(
9720
+ n1,
9721
+ n2,
9722
+ container,
9723
+ anchor,
9724
+ parentComponent
9725
+ );
9706
9726
  break;
9707
9727
  default:
9708
9728
  if (shapeFlag & 1) {
@@ -10205,7 +10225,8 @@ function baseCreateRenderer(options, createHydrationFns) {
10205
10225
  n2,
10206
10226
  container,
10207
10227
  anchor,
10208
- parentComponent
10228
+ parentComponent,
10229
+ parentSuspense
10209
10230
  );
10210
10231
  }
10211
10232
  } else {
@@ -10267,7 +10288,42 @@ function baseCreateRenderer(options, createHydrationFns) {
10267
10288
  }
10268
10289
  if (isHmrUpdating) initialVNode.el = null;
10269
10290
  if (instance.asyncDep) {
10270
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
10291
+ if (parentSuspense) {
10292
+ const hydratedEl = instance.vnode.el;
10293
+ parentSuspense.registerDep(instance, (setupResult) => {
10294
+ const { vnode } = instance;
10295
+ {
10296
+ pushWarningContext(vnode);
10297
+ }
10298
+ handleSetupResult(instance, setupResult, false);
10299
+ if (hydratedEl) {
10300
+ vnode.el = hydratedEl;
10301
+ }
10302
+ const placeholder = !hydratedEl && instance.subTree.el;
10303
+ setupRenderEffect(
10304
+ instance,
10305
+ vnode,
10306
+ // component may have been moved before resolve.
10307
+ // if this is not a hydration, instance.subTree will be the comment
10308
+ // placeholder.
10309
+ hostParentNode(hydratedEl || instance.subTree.el),
10310
+ // anchor will not be used if this is hydration, so only need to
10311
+ // consider the comment placeholder case.
10312
+ hydratedEl ? null : getNextHostNode(instance.subTree),
10313
+ parentSuspense,
10314
+ namespace,
10315
+ optimized
10316
+ );
10317
+ if (placeholder) {
10318
+ vnode.placeholder = null;
10319
+ hostRemove(placeholder);
10320
+ }
10321
+ updateHOCHostEl(instance, vnode.el);
10322
+ {
10323
+ popWarningContext();
10324
+ }
10325
+ });
10326
+ }
10271
10327
  if (!initialVNode.el) {
10272
10328
  const placeholder = instance.subTree = createVNode(Comment);
10273
10329
  processCommentNode(null, placeholder, container, anchor);
@@ -10875,7 +10931,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10875
10931
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
10876
10932
  const { el, type, transition, children, shapeFlag } = vnode;
10877
10933
  if (shapeFlag & 6) {
10878
- if (type.__vapor) {
10934
+ if (isVaporComponent(type)) {
10879
10935
  getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
10880
10936
  } else {
10881
10937
  move(
@@ -10985,7 +11041,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10985
11041
  parentComponent.renderCache[cacheIndex] = void 0;
10986
11042
  }
10987
11043
  if (shapeFlag & 256) {
10988
- if (vnode.type.__vapor) {
11044
+ if (isVaporComponent(vnode.type)) {
10989
11045
  getVaporInterface(parentComponent, vnode).deactivate(
10990
11046
  vnode,
10991
11047
  parentComponent.ctx.getStorageContainer()
@@ -11002,7 +11058,7 @@ function baseCreateRenderer(options, createHydrationFns) {
11002
11058
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
11003
11059
  }
11004
11060
  if (shapeFlag & 6) {
11005
- if (type.__vapor) {
11061
+ if (isVaporComponent(type)) {
11006
11062
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
11007
11063
  return;
11008
11064
  } else {
@@ -11144,7 +11200,7 @@ function baseCreateRenderer(options, createHydrationFns) {
11144
11200
  };
11145
11201
  const getNextHostNode = (vnode) => {
11146
11202
  if (vnode.shapeFlag & 6) {
11147
- if (vnode.type.__vapor) {
11203
+ if (isVaporComponent(vnode.type)) {
11148
11204
  return hostNextSibling(vnode.anchor);
11149
11205
  }
11150
11206
  return getNextHostNode(vnode.component.subTree);
@@ -11336,6 +11392,12 @@ app.use(vaporInteropPlugin)
11336
11392
  }
11337
11393
  return res;
11338
11394
  }
11395
+ function isVaporComponent(type) {
11396
+ if (isHmrUpdating && hmrDirtyComponentsMode.has(type)) {
11397
+ return hmrDirtyComponentsMode.get(type);
11398
+ }
11399
+ return type.__vapor;
11400
+ }
11339
11401
  function getInheritedScopeIds(vnode, parentComponent) {
11340
11402
  const inheritedScopeIds = [];
11341
11403
  let currentParent = parentComponent;
@@ -11635,7 +11697,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11635
11697
  m: move,
11636
11698
  um: unmount,
11637
11699
  n: next,
11638
- o: { parentNode, remove }
11700
+ o: { parentNode }
11639
11701
  } = rendererInternals;
11640
11702
  let parentSuspenseId;
11641
11703
  const isSuspensible = isVNodeSuspensible(vnode);
@@ -11810,12 +11872,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11810
11872
  next() {
11811
11873
  return suspense.activeBranch && next(suspense.activeBranch);
11812
11874
  },
11813
- registerDep(instance, setupRenderEffect, optimized2) {
11875
+ registerDep(instance, onResolve) {
11814
11876
  const isInPendingSuspense = !!suspense.pendingBranch;
11815
11877
  if (isInPendingSuspense) {
11816
11878
  suspense.deps++;
11817
11879
  }
11818
- const hydratedEl = instance.vnode.el;
11819
11880
  instance.asyncDep.catch((err) => {
11820
11881
  handleError(err, instance, 0);
11821
11882
  }).then((asyncSetupResult) => {
@@ -11823,37 +11884,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11823
11884
  return;
11824
11885
  }
11825
11886
  instance.asyncResolved = true;
11826
- const { vnode: vnode2 } = instance;
11827
- {
11828
- pushWarningContext(vnode2);
11829
- }
11830
- handleSetupResult(instance, asyncSetupResult, false);
11831
- if (hydratedEl) {
11832
- vnode2.el = hydratedEl;
11833
- }
11834
- const placeholder = !hydratedEl && instance.subTree.el;
11835
- setupRenderEffect(
11836
- instance,
11837
- vnode2,
11838
- // component may have been moved before resolve.
11839
- // if this is not a hydration, instance.subTree will be the comment
11840
- // placeholder.
11841
- parentNode(hydratedEl || instance.subTree.el),
11842
- // anchor will not be used if this is hydration, so only need to
11843
- // consider the comment placeholder case.
11844
- hydratedEl ? null : next(instance.subTree),
11845
- suspense,
11846
- namespace,
11847
- optimized2
11848
- );
11849
- if (placeholder) {
11850
- vnode2.placeholder = null;
11851
- remove(placeholder);
11852
- }
11853
- updateHOCHostEl(instance, vnode2.el);
11854
- {
11855
- popWarningContext();
11856
- }
11887
+ onResolve(asyncSetupResult);
11857
11888
  if (isInPendingSuspense && --suspense.deps === 0) {
11858
11889
  suspense.resolve();
11859
11890
  }
@@ -13114,7 +13145,7 @@ function isMemoSame(cached, memo) {
13114
13145
  return true;
13115
13146
  }
13116
13147
 
13117
- const version = "3.6.0-alpha.5";
13148
+ const version = "3.6.0-alpha.7";
13118
13149
  const warn = warn$1 ;
13119
13150
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
13120
13151
  const devtools = devtools$1 ;
@@ -21061,7 +21092,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
21061
21092
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
21062
21093
  );
21063
21094
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
21064
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
21095
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(
21096
+ `onkeyup,onkeydown,onkeypress`
21097
+ );
21065
21098
  const resolveModifiers = (key, modifiers, context, loc) => {
21066
21099
  const keyModifiers = [];
21067
21100
  const nonKeyModifiers = [];