vue 3.6.0-beta.13 → 3.6.0-beta.15

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 v3.6.0-beta.13
2
+ * vue v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -7,7 +7,7 @@ import * as runtimeDom from "@vue/runtime-dom";
7
7
  import { initCustomFormatter, registerRuntimeCompiler, warn } from "@vue/runtime-dom";
8
8
  import { compile } from "@vue/compiler-dom";
9
9
  import { NOOP, extend, genCacheKey, generateCodeFrame, isString } from "@vue/shared";
10
- import { withAsyncContext } from "@vue/runtime-vapor";
10
+ import { defineVaporAsyncComponent, withAsyncContext } from "@vue/runtime-vapor";
11
11
  export * from "@vue/runtime-dom";
12
12
  export * from "@vue/runtime-vapor";
13
13
  //#endregion
@@ -51,4 +51,4 @@ function compileToFunction(template, options) {
51
51
  }
52
52
  registerRuntimeCompiler(compileToFunction);
53
53
  //#endregion
54
- export { compileToFunction as compile, withAsyncContext };
54
+ export { compileToFunction as compile, defineVaporAsyncComponent, withAsyncContext };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.13
2
+ * vue v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2236,8 +2236,9 @@ var Vue = (function(exports) {
2236
2236
  if (once && cb) {
2237
2237
  const _cb = cb;
2238
2238
  cb = (...args) => {
2239
- _cb(...args);
2239
+ const res = _cb(...args);
2240
2240
  this.stop();
2241
+ return res;
2241
2242
  };
2242
2243
  }
2243
2244
  this.cb = cb;
@@ -2251,7 +2252,7 @@ var Vue = (function(exports) {
2251
2252
  if (!this.cb) return;
2252
2253
  const { immediate, deep, call } = this.options;
2253
2254
  if (initialRun && !immediate) return;
2254
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2255
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2255
2256
  cleanup(this);
2256
2257
  const currentWatcher = activeWatcher;
2257
2258
  activeWatcher = this;
@@ -2668,6 +2669,7 @@ var Vue = (function(exports) {
2668
2669
  }
2669
2670
  flushIndex = 0;
2670
2671
  jobsLength = 0;
2672
+ jobs.length = 0;
2671
2673
  flushPostFlushCbs(seen);
2672
2674
  currentFlushPromise = null;
2673
2675
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2725,6 +2727,14 @@ var Vue = (function(exports) {
2725
2727
  function normalizeClassComponent(component) {
2726
2728
  return isClassComponent(component) ? component.__vccOpts : component;
2727
2729
  }
2730
+ function hasDirtyAncestor(instance, dirtyInstances) {
2731
+ let parent = instance.parent;
2732
+ while (parent) {
2733
+ if (dirtyInstances.has(parent)) return true;
2734
+ parent = parent.parent;
2735
+ }
2736
+ return false;
2737
+ }
2728
2738
  function rerender(id, newRender) {
2729
2739
  const record = map.get(id);
2730
2740
  if (!record) return;
@@ -2756,42 +2766,69 @@ var Vue = (function(exports) {
2756
2766
  const isVapor = record.initialDef.__vapor;
2757
2767
  updateComponentDef(record.initialDef, newComp);
2758
2768
  const instances = [...record.instances];
2759
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2769
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2760
2770
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2761
- for (const instance of instances) instance.hmrReload(newComp);
2762
- } else for (const instance of instances) {
2763
- const oldComp = normalizeClassComponent(instance.type);
2764
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2765
- if (!dirtyInstances) {
2766
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2767
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2768
- }
2769
- dirtyInstances.add(instance);
2770
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2771
- instance.appContext.propsCache.delete(instance.type);
2772
- instance.appContext.emitsCache.delete(instance.type);
2773
- instance.appContext.optionsCache.delete(instance.type);
2774
- if (instance.ceReload) {
2775
- dirtyInstances.add(instance);
2776
- instance.ceReload(newComp.styles);
2777
- dirtyInstances.delete(instance);
2778
- } else if (instance.parent) queueJob(() => {
2779
- isHmrUpdating = true;
2771
+ const dirtyInstances = new Set(instances);
2772
+ const rerenderedParents = /* @__PURE__ */ new Set();
2773
+ for (const instance of instances) {
2780
2774
  const parent = instance.parent;
2781
- if (parent.vapor) parent.hmrRerender();
2782
- else if (!(parent.effect.flags & 1024)) {
2783
- parent.renderCache = [];
2784
- parent.effect.run();
2775
+ if (parent) {
2776
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2777
+ rerenderedParents.add(parent);
2778
+ parent.hmrRerender();
2779
+ }
2780
+ } else instance.hmrReload(newComp);
2781
+ }
2782
+ } else {
2783
+ const parentUpdates = /* @__PURE__ */ new Map();
2784
+ const dirtyInstanceSet = new Set(instances);
2785
+ for (const instance of instances) {
2786
+ const oldComp = normalizeClassComponent(instance.type);
2787
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2788
+ if (!dirtyInstances) {
2789
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2790
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2785
2791
  }
2786
- nextTick(() => {
2787
- isHmrUpdating = false;
2792
+ dirtyInstances.add(instance);
2793
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2794
+ instance.appContext.propsCache.delete(instance.type);
2795
+ instance.appContext.emitsCache.delete(instance.type);
2796
+ instance.appContext.optionsCache.delete(instance.type);
2797
+ if (instance.ceReload) {
2798
+ dirtyInstances.add(instance);
2799
+ instance.ceReload(newComp.styles);
2800
+ dirtyInstances.delete(instance);
2801
+ } else if (instance.parent) {
2802
+ const parent = instance.parent;
2803
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2804
+ let updates = parentUpdates.get(parent);
2805
+ if (!updates) parentUpdates.set(parent, updates = []);
2806
+ updates.push([instance, dirtyInstances]);
2807
+ }
2808
+ } else if (instance.appContext.reload) instance.appContext.reload();
2809
+ else if (typeof window !== "undefined") window.location.reload();
2810
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2811
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2812
+ }
2813
+ parentUpdates.forEach((updates, parent) => {
2814
+ queueJob(() => {
2815
+ isHmrUpdating = true;
2816
+ if (parent.vapor) parent.hmrRerender();
2817
+ else {
2818
+ const i = parent;
2819
+ if (!(i.effect.flags & 1024)) {
2820
+ i.renderCache = [];
2821
+ i.effect.run();
2822
+ }
2823
+ }
2824
+ nextTick(() => {
2825
+ isHmrUpdating = false;
2826
+ });
2827
+ updates.forEach(([instance, dirtyInstances]) => {
2828
+ dirtyInstances.delete(instance);
2829
+ });
2788
2830
  });
2789
- dirtyInstances.delete(instance);
2790
2831
  });
2791
- else if (instance.appContext.reload) instance.appContext.reload();
2792
- else if (typeof window !== "undefined") window.location.reload();
2793
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2794
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2795
2832
  }
2796
2833
  queuePostFlushCb(() => {
2797
2834
  hmrDirtyComponents.clear();
@@ -4267,11 +4304,16 @@ var Vue = (function(exports) {
4267
4304
  onError(err);
4268
4305
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4269
4306
  });
4270
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4307
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4271
4308
  load().then(() => {
4309
+ if (instance.isUnmounted) return;
4272
4310
  loaded.value = true;
4273
4311
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4274
4312
  }).catch((err) => {
4313
+ if (instance.isUnmounted) {
4314
+ setPendingRequest(null);
4315
+ return;
4316
+ }
4275
4317
  onError(err);
4276
4318
  error.value = err;
4277
4319
  });
@@ -4329,14 +4371,22 @@ var Vue = (function(exports) {
4329
4371
  setPendingRequest: (request) => pendingRequest = request
4330
4372
  };
4331
4373
  }
4332
- const useAsyncComponentState = (delay, timeout, onError) => {
4374
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4333
4375
  const loaded = /* @__PURE__ */ ref(false);
4334
4376
  const error = /* @__PURE__ */ ref();
4335
4377
  const delayed = /* @__PURE__ */ ref(!!delay);
4336
- if (delay) setTimeout(() => {
4378
+ let timeoutTimer;
4379
+ let delayTimer;
4380
+ if (instance) onUnmounted(() => {
4381
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4382
+ if (delayTimer != null) clearTimeout(delayTimer);
4383
+ }, instance);
4384
+ if (delay) delayTimer = setTimeout(() => {
4385
+ if (instance && instance.isUnmounted) return;
4337
4386
  delayed.value = false;
4338
4387
  }, delay);
4339
- if (timeout != null) setTimeout(() => {
4388
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4389
+ if (instance && instance.isUnmounted) return;
4340
4390
  if (!loaded.value && !error.value) {
4341
4391
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4342
4392
  onError(err);
@@ -4739,6 +4789,7 @@ var Vue = (function(exports) {
4739
4789
  slot: vaporSlot,
4740
4790
  fallback
4741
4791
  };
4792
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4742
4793
  return ret;
4743
4794
  }
4744
4795
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -5592,12 +5643,13 @@ var Vue = (function(exports) {
5592
5643
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5593
5644
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5594
5645
  }
5595
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5646
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5647
+ if (!hasVModel) {
5596
5648
  localValue = value;
5597
5649
  trigger();
5598
5650
  }
5599
5651
  i.emit(`update:${name}`, emittedValue);
5600
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5652
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5601
5653
  prevSetValue = value;
5602
5654
  prevEmittedValue = emittedValue;
5603
5655
  }
@@ -8443,7 +8495,7 @@ var Vue = (function(exports) {
8443
8495
  }
8444
8496
  //#endregion
8445
8497
  //#region packages/runtime-core/src/index.ts
8446
- const version = "3.6.0-beta.13";
8498
+ const version = "3.6.0-beta.15";
8447
8499
  const warn = warn$1;
8448
8500
  /**
8449
8501
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9578,7 +9630,7 @@ var Vue = (function(exports) {
9578
9630
  prevChildren = [];
9579
9631
  if (children) for (let i = 0; i < children.length; i++) {
9580
9632
  const child = children[i];
9581
- if (child.el && child.el instanceof Element) {
9633
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
9582
9634
  prevChildren.push(child);
9583
9635
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9584
9636
  positionMap.set(child, getPosition(child.el));
@@ -11515,7 +11567,7 @@ var Vue = (function(exports) {
11515
11567
  }
11516
11568
  },
11517
11569
  oncdata(start, end) {
11518
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
11570
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
11519
11571
  else emitError(1, start - 9);
11520
11572
  },
11521
11573
  onprocessinginstruction(start) {
@@ -11976,7 +12028,7 @@ var Vue = (function(exports) {
11976
12028
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
11977
12029
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
11978
12030
  }
11979
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
12031
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
11980
12032
  const context = {
11981
12033
  filename,
11982
12034
  selfName: getSelfName(filename),
@@ -11998,6 +12050,7 @@ var Vue = (function(exports) {
11998
12050
  bindingMetadata,
11999
12051
  inline,
12000
12052
  isTS,
12053
+ eventDelegation,
12001
12054
  onError,
12002
12055
  onWarn,
12003
12056
  compatConfig,
@@ -12009,6 +12062,7 @@ var Vue = (function(exports) {
12009
12062
  imports: [],
12010
12063
  cached: [],
12011
12064
  constantCache: /* @__PURE__ */ new WeakMap(),
12065
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
12012
12066
  temps: 0,
12013
12067
  identifiers: Object.create(null),
12014
12068
  identifierScopes: Object.create(null),
@@ -12629,7 +12683,7 @@ var Vue = (function(exports) {
12629
12683
  if (dir.type === 7 && dir.name !== "for") {
12630
12684
  const exp = dir.exp;
12631
12685
  const arg = dir.arg;
12632
- if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
12686
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
12633
12687
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
12634
12688
  }
12635
12689
  }
@@ -14192,6 +14246,7 @@ var Vue = (function(exports) {
14192
14246
  exports.defineProps = defineProps;
14193
14247
  exports.defineSSRCustomElement = defineSSRCustomElement;
14194
14248
  exports.defineSlots = defineSlots;
14249
+ exports.defineVaporAsyncComponent = defineAsyncComponent;
14195
14250
  exports.devtools = devtools;
14196
14251
  exports.effect = effect;
14197
14252
  exports.effectScope = effectScope;