vue 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 v3.6.0-alpha.5
2
+ * vue v3.6.0-alpha.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-alpha.5
2
+ * vue v3.6.0-alpha.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-alpha.5
2
+ * vue 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) {
@@ -3650,7 +3660,7 @@ const BaseTransitionPropsValidators = {
3650
3660
  onAppearCancelled: TransitionHookValidator
3651
3661
  };
3652
3662
  const recursiveGetSubtree = (instance) => {
3653
- const subTree = instance.type.__vapor ? instance.block : instance.subTree;
3663
+ const subTree = isVaporComponent(instance.type) ? instance.block : instance.subTree;
3654
3664
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
3655
3665
  };
3656
3666
  const BaseTransitionImpl = {
@@ -3957,7 +3967,7 @@ function getInnerChild$1(vnode) {
3957
3967
  }
3958
3968
  function setTransitionHooks(vnode, hooks) {
3959
3969
  if (vnode.shapeFlag & 6 && vnode.component) {
3960
- if (vnode.type.__vapor) {
3970
+ if (isVaporComponent(vnode.type)) {
3961
3971
  getVaporInterface(vnode.component, vnode).setTransitionHooks(
3962
3972
  vnode.component,
3963
3973
  hooks
@@ -4366,7 +4376,8 @@ function createHydrationFunctions(rendererInternals) {
4366
4376
  node,
4367
4377
  container,
4368
4378
  null,
4369
- parentComponent
4379
+ parentComponent,
4380
+ parentSuspense
4370
4381
  );
4371
4382
  } else {
4372
4383
  mountComponent(
@@ -7219,29 +7230,7 @@ function renderComponentRoot(instance) {
7219
7230
  }
7220
7231
  root = cloneVNode(root, fallthroughAttrs, false, true);
7221
7232
  } else if (!accessedAttrs && root.type !== Comment) {
7222
- const allAttrs = Object.keys(attrs);
7223
- const eventAttrs = [];
7224
- const extraAttrs = [];
7225
- for (let i = 0, l = allAttrs.length; i < l; i++) {
7226
- const key = allAttrs[i];
7227
- if (isOn(key)) {
7228
- if (!isModelListener(key)) {
7229
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
7230
- }
7231
- } else {
7232
- extraAttrs.push(key);
7233
- }
7234
- }
7235
- if (extraAttrs.length) {
7236
- warn$1(
7237
- `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.`
7238
- );
7239
- }
7240
- if (eventAttrs.length) {
7241
- warn$1(
7242
- `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.`
7243
- );
7244
- }
7233
+ warnExtraneousAttributes(attrs);
7245
7234
  }
7246
7235
  }
7247
7236
  }
@@ -7293,6 +7282,31 @@ const getChildRoot = (vnode) => {
7293
7282
  };
7294
7283
  return [normalizeVNode(childRoot), setRoot];
7295
7284
  };
7285
+ function warnExtraneousAttributes(attrs) {
7286
+ const allAttrs = Object.keys(attrs);
7287
+ const eventAttrs = [];
7288
+ const extraAttrs = [];
7289
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
7290
+ const key = allAttrs[i];
7291
+ if (isOn(key)) {
7292
+ if (!isModelListener(key)) {
7293
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
7294
+ }
7295
+ } else {
7296
+ extraAttrs.push(key);
7297
+ }
7298
+ }
7299
+ if (extraAttrs.length) {
7300
+ warn$1(
7301
+ `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.`
7302
+ );
7303
+ }
7304
+ if (eventAttrs.length) {
7305
+ warn$1(
7306
+ `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.`
7307
+ );
7308
+ }
7309
+ }
7296
7310
  function filterSingleRoot(children, recurse = true) {
7297
7311
  let singleRoot;
7298
7312
  for (let i = 0; i < children.length; i++) {
@@ -8042,7 +8056,13 @@ function baseCreateRenderer(options, createHydrationFns) {
8042
8056
  );
8043
8057
  break;
8044
8058
  case VaporSlot:
8045
- getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
8059
+ getVaporInterface(parentComponent, n2).slot(
8060
+ n1,
8061
+ n2,
8062
+ container,
8063
+ anchor,
8064
+ parentComponent
8065
+ );
8046
8066
  break;
8047
8067
  default:
8048
8068
  if (shapeFlag & 1) {
@@ -8545,7 +8565,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8545
8565
  n2,
8546
8566
  container,
8547
8567
  anchor,
8548
- parentComponent
8568
+ parentComponent,
8569
+ parentSuspense
8549
8570
  );
8550
8571
  }
8551
8572
  } else {
@@ -8606,7 +8627,42 @@ function baseCreateRenderer(options, createHydrationFns) {
8606
8627
  }
8607
8628
  if (isHmrUpdating) initialVNode.el = null;
8608
8629
  if (instance.asyncDep) {
8609
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8630
+ if (parentSuspense) {
8631
+ const hydratedEl = instance.vnode.el;
8632
+ parentSuspense.registerDep(instance, (setupResult) => {
8633
+ const { vnode } = instance;
8634
+ {
8635
+ pushWarningContext(vnode);
8636
+ }
8637
+ handleSetupResult(instance, setupResult, false);
8638
+ if (hydratedEl) {
8639
+ vnode.el = hydratedEl;
8640
+ }
8641
+ const placeholder = !hydratedEl && instance.subTree.el;
8642
+ setupRenderEffect(
8643
+ instance,
8644
+ vnode,
8645
+ // component may have been moved before resolve.
8646
+ // if this is not a hydration, instance.subTree will be the comment
8647
+ // placeholder.
8648
+ hostParentNode(hydratedEl || instance.subTree.el),
8649
+ // anchor will not be used if this is hydration, so only need to
8650
+ // consider the comment placeholder case.
8651
+ hydratedEl ? null : getNextHostNode(instance.subTree),
8652
+ parentSuspense,
8653
+ namespace,
8654
+ optimized
8655
+ );
8656
+ if (placeholder) {
8657
+ vnode.placeholder = null;
8658
+ hostRemove(placeholder);
8659
+ }
8660
+ updateHOCHostEl(instance, vnode.el);
8661
+ {
8662
+ popWarningContext();
8663
+ }
8664
+ });
8665
+ }
8610
8666
  if (!initialVNode.el) {
8611
8667
  const placeholder = instance.subTree = createVNode(Comment);
8612
8668
  processCommentNode(null, placeholder, container, anchor);
@@ -9187,7 +9243,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9187
9243
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
9188
9244
  const { el, type, transition, children, shapeFlag } = vnode;
9189
9245
  if (shapeFlag & 6) {
9190
- if (type.__vapor) {
9246
+ if (isVaporComponent(type)) {
9191
9247
  getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
9192
9248
  } else {
9193
9249
  move(
@@ -9297,7 +9353,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9297
9353
  parentComponent.renderCache[cacheIndex] = void 0;
9298
9354
  }
9299
9355
  if (shapeFlag & 256) {
9300
- if (vnode.type.__vapor) {
9356
+ if (isVaporComponent(vnode.type)) {
9301
9357
  getVaporInterface(parentComponent, vnode).deactivate(
9302
9358
  vnode,
9303
9359
  parentComponent.ctx.getStorageContainer()
@@ -9314,7 +9370,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9314
9370
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
9315
9371
  }
9316
9372
  if (shapeFlag & 6) {
9317
- if (type.__vapor) {
9373
+ if (isVaporComponent(type)) {
9318
9374
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
9319
9375
  return;
9320
9376
  } else {
@@ -9446,7 +9502,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9446
9502
  };
9447
9503
  const getNextHostNode = (vnode) => {
9448
9504
  if (vnode.shapeFlag & 6) {
9449
- if (vnode.type.__vapor) {
9505
+ if (isVaporComponent(vnode.type)) {
9450
9506
  return hostNextSibling(vnode.anchor);
9451
9507
  }
9452
9508
  return getNextHostNode(vnode.component.subTree);
@@ -9636,6 +9692,12 @@ app.use(vaporInteropPlugin)
9636
9692
  }
9637
9693
  return res;
9638
9694
  }
9695
+ function isVaporComponent(type) {
9696
+ if (isHmrUpdating && hmrDirtyComponentsMode.has(type)) {
9697
+ return hmrDirtyComponentsMode.get(type);
9698
+ }
9699
+ return type.__vapor;
9700
+ }
9639
9701
  function getInheritedScopeIds(vnode, parentComponent) {
9640
9702
  const inheritedScopeIds = [];
9641
9703
  let currentParent = parentComponent;
@@ -9935,7 +9997,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9935
9997
  m: move,
9936
9998
  um: unmount,
9937
9999
  n: next,
9938
- o: { parentNode, remove }
10000
+ o: { parentNode }
9939
10001
  } = rendererInternals;
9940
10002
  let parentSuspenseId;
9941
10003
  const isSuspensible = isVNodeSuspensible(vnode);
@@ -10110,12 +10172,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10110
10172
  next() {
10111
10173
  return suspense.activeBranch && next(suspense.activeBranch);
10112
10174
  },
10113
- registerDep(instance, setupRenderEffect, optimized2) {
10175
+ registerDep(instance, onResolve) {
10114
10176
  const isInPendingSuspense = !!suspense.pendingBranch;
10115
10177
  if (isInPendingSuspense) {
10116
10178
  suspense.deps++;
10117
10179
  }
10118
- const hydratedEl = instance.vnode.el;
10119
10180
  instance.asyncDep.catch((err) => {
10120
10181
  handleError(err, instance, 0);
10121
10182
  }).then((asyncSetupResult) => {
@@ -10123,37 +10184,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10123
10184
  return;
10124
10185
  }
10125
10186
  instance.asyncResolved = true;
10126
- const { vnode: vnode2 } = instance;
10127
- {
10128
- pushWarningContext(vnode2);
10129
- }
10130
- handleSetupResult(instance, asyncSetupResult, false);
10131
- if (hydratedEl) {
10132
- vnode2.el = hydratedEl;
10133
- }
10134
- const placeholder = !hydratedEl && instance.subTree.el;
10135
- setupRenderEffect(
10136
- instance,
10137
- vnode2,
10138
- // component may have been moved before resolve.
10139
- // if this is not a hydration, instance.subTree will be the comment
10140
- // placeholder.
10141
- parentNode(hydratedEl || instance.subTree.el),
10142
- // anchor will not be used if this is hydration, so only need to
10143
- // consider the comment placeholder case.
10144
- hydratedEl ? null : next(instance.subTree),
10145
- suspense,
10146
- namespace,
10147
- optimized2
10148
- );
10149
- if (placeholder) {
10150
- vnode2.placeholder = null;
10151
- remove(placeholder);
10152
- }
10153
- updateHOCHostEl(instance, vnode2.el);
10154
- {
10155
- popWarningContext();
10156
- }
10187
+ onResolve(asyncSetupResult);
10157
10188
  if (isInPendingSuspense && --suspense.deps === 0) {
10158
10189
  suspense.resolve();
10159
10190
  }
@@ -11335,7 +11366,7 @@ function isMemoSame(cached, memo) {
11335
11366
  return true;
11336
11367
  }
11337
11368
 
11338
- const version = "3.6.0-alpha.5";
11369
+ const version = "3.6.0-alpha.7";
11339
11370
  const warn = warn$1 ;
11340
11371
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11341
11372
  const devtools = devtools$1 ;
@@ -18761,7 +18792,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
18761
18792
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
18762
18793
  );
18763
18794
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
18764
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
18795
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(
18796
+ `onkeyup,onkeydown,onkeypress`
18797
+ );
18765
18798
  const resolveModifiers = (key, modifiers, context, loc) => {
18766
18799
  const keyModifiers = [];
18767
18800
  const nonKeyModifiers = [];