@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -2123,6 +2123,16 @@ class EffectScope {
2123
2123
  return;
2124
2124
  }
2125
2125
  this.flags = 1024;
2126
+ this.reset();
2127
+ const sub = this.subs;
2128
+ if (sub !== void 0) {
2129
+ unlink(sub);
2130
+ }
2131
+ }
2132
+ /**
2133
+ * @internal
2134
+ */
2135
+ reset() {
2126
2136
  let dep = this.deps;
2127
2137
  while (dep !== void 0) {
2128
2138
  const node = dep.dep;
@@ -2133,10 +2143,6 @@ class EffectScope {
2133
2143
  dep = unlink(dep, this);
2134
2144
  }
2135
2145
  }
2136
- const sub = this.subs;
2137
- if (sub !== void 0) {
2138
- unlink(sub);
2139
- }
2140
2146
  cleanup(this);
2141
2147
  }
2142
2148
  }
@@ -2948,6 +2954,7 @@ function checkRecursiveUpdates(seen, fn) {
2948
2954
 
2949
2955
  let isHmrUpdating = false;
2950
2956
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2957
+ const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2951
2958
  {
2952
2959
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
2953
2960
  createRecord: tryWrap(createRecord),
@@ -3011,9 +3018,10 @@ function reload(id, newComp) {
3011
3018
  const record = map.get(id);
3012
3019
  if (!record) return;
3013
3020
  newComp = normalizeClassComponent(newComp);
3021
+ const isVapor = record.initialDef.__vapor;
3014
3022
  updateComponentDef(record.initialDef, newComp);
3015
3023
  const instances = [...record.instances];
3016
- if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
3024
+ if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
3017
3025
  for (const instance of instances) {
3018
3026
  if (instance.root && instance.root.ce && instance !== instance.root) {
3019
3027
  instance.root.ce._removeChildStyle(instance.type);
@@ -3033,6 +3041,7 @@ function reload(id, newComp) {
3033
3041
  hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
3034
3042
  }
3035
3043
  dirtyInstances.add(instance);
3044
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
3036
3045
  instance.appContext.propsCache.delete(instance.type);
3037
3046
  instance.appContext.emitsCache.delete(instance.type);
3038
3047
  instance.appContext.optionsCache.delete(instance.type);
@@ -3073,6 +3082,7 @@ function reload(id, newComp) {
3073
3082
  }
3074
3083
  queuePostFlushCb(() => {
3075
3084
  hmrDirtyComponents.clear();
3085
+ hmrDirtyComponentsMode.clear();
3076
3086
  });
3077
3087
  }
3078
3088
  function updateComponentDef(oldComp, newComp) {
@@ -4231,7 +4241,7 @@ const BaseTransitionPropsValidators = {
4231
4241
  onAppearCancelled: TransitionHookValidator
4232
4242
  };
4233
4243
  const recursiveGetSubtree = (instance) => {
4234
- const subTree = instance.type.__vapor ? instance.block : instance.subTree;
4244
+ const subTree = isVaporComponent(instance.type) ? instance.block : instance.subTree;
4235
4245
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
4236
4246
  };
4237
4247
  const BaseTransitionImpl = {
@@ -4541,7 +4551,7 @@ function getInnerChild$1(vnode) {
4541
4551
  }
4542
4552
  function setTransitionHooks(vnode, hooks) {
4543
4553
  if (vnode.shapeFlag & 6 && vnode.component) {
4544
- if (vnode.type.__vapor) {
4554
+ if (isVaporComponent(vnode.type)) {
4545
4555
  getVaporInterface(vnode.component, vnode).setTransitionHooks(
4546
4556
  vnode.component,
4547
4557
  hooks
@@ -4950,7 +4960,8 @@ function createHydrationFunctions(rendererInternals) {
4950
4960
  node,
4951
4961
  container,
4952
4962
  null,
4953
- parentComponent
4963
+ parentComponent,
4964
+ parentSuspense
4954
4965
  );
4955
4966
  } else {
4956
4967
  mountComponent(
@@ -7737,7 +7748,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7737
7748
  return vm;
7738
7749
  }
7739
7750
  }
7740
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.5"}`;
7751
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.7"}`;
7741
7752
  Vue.config = singletonApp.config;
7742
7753
  Vue.use = (plugin, ...options) => {
7743
7754
  if (plugin && isFunction(plugin.install)) {
@@ -8836,29 +8847,7 @@ function renderComponentRoot(instance) {
8836
8847
  }
8837
8848
  root = cloneVNode(root, fallthroughAttrs, false, true);
8838
8849
  } else if (!accessedAttrs && root.type !== Comment) {
8839
- const allAttrs = Object.keys(attrs);
8840
- const eventAttrs = [];
8841
- const extraAttrs = [];
8842
- for (let i = 0, l = allAttrs.length; i < l; i++) {
8843
- const key = allAttrs[i];
8844
- if (isOn(key)) {
8845
- if (!isModelListener(key)) {
8846
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8847
- }
8848
- } else {
8849
- extraAttrs.push(key);
8850
- }
8851
- }
8852
- if (extraAttrs.length) {
8853
- warn$1(
8854
- `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.`
8855
- );
8856
- }
8857
- if (eventAttrs.length) {
8858
- warn$1(
8859
- `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.`
8860
- );
8861
- }
8850
+ warnExtraneousAttributes(attrs);
8862
8851
  }
8863
8852
  }
8864
8853
  }
@@ -8931,6 +8920,31 @@ const getChildRoot = (vnode) => {
8931
8920
  };
8932
8921
  return [normalizeVNode(childRoot), setRoot];
8933
8922
  };
8923
+ function warnExtraneousAttributes(attrs) {
8924
+ const allAttrs = Object.keys(attrs);
8925
+ const eventAttrs = [];
8926
+ const extraAttrs = [];
8927
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
8928
+ const key = allAttrs[i];
8929
+ if (isOn(key)) {
8930
+ if (!isModelListener(key)) {
8931
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8932
+ }
8933
+ } else {
8934
+ extraAttrs.push(key);
8935
+ }
8936
+ }
8937
+ if (extraAttrs.length) {
8938
+ warn$1(
8939
+ `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.`
8940
+ );
8941
+ }
8942
+ if (eventAttrs.length) {
8943
+ warn$1(
8944
+ `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.`
8945
+ );
8946
+ }
8947
+ }
8934
8948
  function filterSingleRoot(children, recurse = true) {
8935
8949
  let singleRoot;
8936
8950
  for (let i = 0; i < children.length; i++) {
@@ -9752,7 +9766,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9752
9766
  );
9753
9767
  break;
9754
9768
  case VaporSlot:
9755
- getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
9769
+ getVaporInterface(parentComponent, n2).slot(
9770
+ n1,
9771
+ n2,
9772
+ container,
9773
+ anchor,
9774
+ parentComponent
9775
+ );
9756
9776
  break;
9757
9777
  default:
9758
9778
  if (shapeFlag & 1) {
@@ -10255,7 +10275,8 @@ function baseCreateRenderer(options, createHydrationFns) {
10255
10275
  n2,
10256
10276
  container,
10257
10277
  anchor,
10258
- parentComponent
10278
+ parentComponent,
10279
+ parentSuspense
10259
10280
  );
10260
10281
  }
10261
10282
  } else {
@@ -10317,7 +10338,42 @@ function baseCreateRenderer(options, createHydrationFns) {
10317
10338
  }
10318
10339
  if (isHmrUpdating) initialVNode.el = null;
10319
10340
  if (instance.asyncDep) {
10320
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
10341
+ if (parentSuspense) {
10342
+ const hydratedEl = instance.vnode.el;
10343
+ parentSuspense.registerDep(instance, (setupResult) => {
10344
+ const { vnode } = instance;
10345
+ {
10346
+ pushWarningContext(vnode);
10347
+ }
10348
+ handleSetupResult(instance, setupResult, false);
10349
+ if (hydratedEl) {
10350
+ vnode.el = hydratedEl;
10351
+ }
10352
+ const placeholder = !hydratedEl && instance.subTree.el;
10353
+ setupRenderEffect(
10354
+ instance,
10355
+ vnode,
10356
+ // component may have been moved before resolve.
10357
+ // if this is not a hydration, instance.subTree will be the comment
10358
+ // placeholder.
10359
+ hostParentNode(hydratedEl || instance.subTree.el),
10360
+ // anchor will not be used if this is hydration, so only need to
10361
+ // consider the comment placeholder case.
10362
+ hydratedEl ? null : getNextHostNode(instance.subTree),
10363
+ parentSuspense,
10364
+ namespace,
10365
+ optimized
10366
+ );
10367
+ if (placeholder) {
10368
+ vnode.placeholder = null;
10369
+ hostRemove(placeholder);
10370
+ }
10371
+ updateHOCHostEl(instance, vnode.el);
10372
+ {
10373
+ popWarningContext();
10374
+ }
10375
+ });
10376
+ }
10321
10377
  if (!initialVNode.el) {
10322
10378
  const placeholder = instance.subTree = createVNode(Comment);
10323
10379
  processCommentNode(null, placeholder, container, anchor);
@@ -10925,7 +10981,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10925
10981
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
10926
10982
  const { el, type, transition, children, shapeFlag } = vnode;
10927
10983
  if (shapeFlag & 6) {
10928
- if (type.__vapor) {
10984
+ if (isVaporComponent(type)) {
10929
10985
  getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
10930
10986
  } else {
10931
10987
  move(
@@ -11035,7 +11091,7 @@ function baseCreateRenderer(options, createHydrationFns) {
11035
11091
  parentComponent.renderCache[cacheIndex] = void 0;
11036
11092
  }
11037
11093
  if (shapeFlag & 256) {
11038
- if (vnode.type.__vapor) {
11094
+ if (isVaporComponent(vnode.type)) {
11039
11095
  getVaporInterface(parentComponent, vnode).deactivate(
11040
11096
  vnode,
11041
11097
  parentComponent.ctx.getStorageContainer()
@@ -11052,7 +11108,7 @@ function baseCreateRenderer(options, createHydrationFns) {
11052
11108
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
11053
11109
  }
11054
11110
  if (shapeFlag & 6) {
11055
- if (type.__vapor) {
11111
+ if (isVaporComponent(type)) {
11056
11112
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
11057
11113
  return;
11058
11114
  } else {
@@ -11194,7 +11250,7 @@ function baseCreateRenderer(options, createHydrationFns) {
11194
11250
  };
11195
11251
  const getNextHostNode = (vnode) => {
11196
11252
  if (vnode.shapeFlag & 6) {
11197
- if (vnode.type.__vapor) {
11253
+ if (isVaporComponent(vnode.type)) {
11198
11254
  return hostNextSibling(vnode.anchor);
11199
11255
  }
11200
11256
  return getNextHostNode(vnode.component.subTree);
@@ -11386,6 +11442,12 @@ app.use(vaporInteropPlugin)
11386
11442
  }
11387
11443
  return res;
11388
11444
  }
11445
+ function isVaporComponent(type) {
11446
+ if (isHmrUpdating && hmrDirtyComponentsMode.has(type)) {
11447
+ return hmrDirtyComponentsMode.get(type);
11448
+ }
11449
+ return type.__vapor;
11450
+ }
11389
11451
  function getInheritedScopeIds(vnode, parentComponent) {
11390
11452
  const inheritedScopeIds = [];
11391
11453
  let currentParent = parentComponent;
@@ -11685,7 +11747,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11685
11747
  m: move,
11686
11748
  um: unmount,
11687
11749
  n: next,
11688
- o: { parentNode, remove }
11750
+ o: { parentNode }
11689
11751
  } = rendererInternals;
11690
11752
  let parentSuspenseId;
11691
11753
  const isSuspensible = isVNodeSuspensible(vnode);
@@ -11860,12 +11922,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11860
11922
  next() {
11861
11923
  return suspense.activeBranch && next(suspense.activeBranch);
11862
11924
  },
11863
- registerDep(instance, setupRenderEffect, optimized2) {
11925
+ registerDep(instance, onResolve) {
11864
11926
  const isInPendingSuspense = !!suspense.pendingBranch;
11865
11927
  if (isInPendingSuspense) {
11866
11928
  suspense.deps++;
11867
11929
  }
11868
- const hydratedEl = instance.vnode.el;
11869
11930
  instance.asyncDep.catch((err) => {
11870
11931
  handleError(err, instance, 0);
11871
11932
  }).then((asyncSetupResult) => {
@@ -11873,37 +11934,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11873
11934
  return;
11874
11935
  }
11875
11936
  instance.asyncResolved = true;
11876
- const { vnode: vnode2 } = instance;
11877
- {
11878
- pushWarningContext(vnode2);
11879
- }
11880
- handleSetupResult(instance, asyncSetupResult, false);
11881
- if (hydratedEl) {
11882
- vnode2.el = hydratedEl;
11883
- }
11884
- const placeholder = !hydratedEl && instance.subTree.el;
11885
- setupRenderEffect(
11886
- instance,
11887
- vnode2,
11888
- // component may have been moved before resolve.
11889
- // if this is not a hydration, instance.subTree will be the comment
11890
- // placeholder.
11891
- parentNode(hydratedEl || instance.subTree.el),
11892
- // anchor will not be used if this is hydration, so only need to
11893
- // consider the comment placeholder case.
11894
- hydratedEl ? null : next(instance.subTree),
11895
- suspense,
11896
- namespace,
11897
- optimized2
11898
- );
11899
- if (placeholder) {
11900
- vnode2.placeholder = null;
11901
- remove(placeholder);
11902
- }
11903
- updateHOCHostEl(instance, vnode2.el);
11904
- {
11905
- popWarningContext();
11906
- }
11937
+ onResolve(asyncSetupResult);
11907
11938
  if (isInPendingSuspense && --suspense.deps === 0) {
11908
11939
  suspense.resolve();
11909
11940
  }
@@ -13164,7 +13195,7 @@ function isMemoSame(cached, memo) {
13164
13195
  return true;
13165
13196
  }
13166
13197
 
13167
- const version = "3.6.0-alpha.5";
13198
+ const version = "3.6.0-alpha.7";
13168
13199
  const warn = warn$1 ;
13169
13200
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
13170
13201
  const devtools = devtools$1 ;
@@ -22087,7 +22118,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
22087
22118
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
22088
22119
  );
22089
22120
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
22090
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
22121
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(
22122
+ `onkeyup,onkeydown,onkeypress`
22123
+ );
22091
22124
  const resolveModifiers = (key, modifiers, context, loc) => {
22092
22125
  const keyModifiers = [];
22093
22126
  const nonKeyModifiers = [];