@vue/runtime-dom 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/runtime-dom v3.6.0-beta.13
2
+ * @vue/runtime-dom v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2158,8 +2158,9 @@ var VueRuntimeDOM = (function(exports) {
2158
2158
  if (once && cb) {
2159
2159
  const _cb = cb;
2160
2160
  cb = (...args) => {
2161
- _cb(...args);
2161
+ const res = _cb(...args);
2162
2162
  this.stop();
2163
+ return res;
2163
2164
  };
2164
2165
  }
2165
2166
  this.cb = cb;
@@ -2173,7 +2174,7 @@ var VueRuntimeDOM = (function(exports) {
2173
2174
  if (!this.cb) return;
2174
2175
  const { immediate, deep, call } = this.options;
2175
2176
  if (initialRun && !immediate) return;
2176
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2177
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2177
2178
  cleanup(this);
2178
2179
  const currentWatcher = activeWatcher;
2179
2180
  activeWatcher = this;
@@ -2590,6 +2591,7 @@ var VueRuntimeDOM = (function(exports) {
2590
2591
  }
2591
2592
  flushIndex = 0;
2592
2593
  jobsLength = 0;
2594
+ jobs.length = 0;
2593
2595
  flushPostFlushCbs(seen);
2594
2596
  currentFlushPromise = null;
2595
2597
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2647,6 +2649,14 @@ var VueRuntimeDOM = (function(exports) {
2647
2649
  function normalizeClassComponent(component) {
2648
2650
  return isClassComponent(component) ? component.__vccOpts : component;
2649
2651
  }
2652
+ function hasDirtyAncestor(instance, dirtyInstances) {
2653
+ let parent = instance.parent;
2654
+ while (parent) {
2655
+ if (dirtyInstances.has(parent)) return true;
2656
+ parent = parent.parent;
2657
+ }
2658
+ return false;
2659
+ }
2650
2660
  function rerender(id, newRender) {
2651
2661
  const record = map.get(id);
2652
2662
  if (!record) return;
@@ -2678,42 +2688,69 @@ var VueRuntimeDOM = (function(exports) {
2678
2688
  const isVapor = record.initialDef.__vapor;
2679
2689
  updateComponentDef(record.initialDef, newComp);
2680
2690
  const instances = [...record.instances];
2681
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2691
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2682
2692
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2683
- for (const instance of instances) instance.hmrReload(newComp);
2684
- } else for (const instance of instances) {
2685
- const oldComp = normalizeClassComponent(instance.type);
2686
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2687
- if (!dirtyInstances) {
2688
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2689
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2690
- }
2691
- dirtyInstances.add(instance);
2692
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2693
- instance.appContext.propsCache.delete(instance.type);
2694
- instance.appContext.emitsCache.delete(instance.type);
2695
- instance.appContext.optionsCache.delete(instance.type);
2696
- if (instance.ceReload) {
2697
- dirtyInstances.add(instance);
2698
- instance.ceReload(newComp.styles);
2699
- dirtyInstances.delete(instance);
2700
- } else if (instance.parent) queueJob(() => {
2701
- isHmrUpdating = true;
2693
+ const dirtyInstances = new Set(instances);
2694
+ const rerenderedParents = /* @__PURE__ */ new Set();
2695
+ for (const instance of instances) {
2702
2696
  const parent = instance.parent;
2703
- if (parent.vapor) parent.hmrRerender();
2704
- else if (!(parent.effect.flags & 1024)) {
2705
- parent.renderCache = [];
2706
- parent.effect.run();
2697
+ if (parent) {
2698
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2699
+ rerenderedParents.add(parent);
2700
+ parent.hmrRerender();
2701
+ }
2702
+ } else instance.hmrReload(newComp);
2703
+ }
2704
+ } else {
2705
+ const parentUpdates = /* @__PURE__ */ new Map();
2706
+ const dirtyInstanceSet = new Set(instances);
2707
+ for (const instance of instances) {
2708
+ const oldComp = normalizeClassComponent(instance.type);
2709
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2710
+ if (!dirtyInstances) {
2711
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2712
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2707
2713
  }
2708
- nextTick(() => {
2709
- isHmrUpdating = false;
2714
+ dirtyInstances.add(instance);
2715
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2716
+ instance.appContext.propsCache.delete(instance.type);
2717
+ instance.appContext.emitsCache.delete(instance.type);
2718
+ instance.appContext.optionsCache.delete(instance.type);
2719
+ if (instance.ceReload) {
2720
+ dirtyInstances.add(instance);
2721
+ instance.ceReload(newComp.styles);
2722
+ dirtyInstances.delete(instance);
2723
+ } else if (instance.parent) {
2724
+ const parent = instance.parent;
2725
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2726
+ let updates = parentUpdates.get(parent);
2727
+ if (!updates) parentUpdates.set(parent, updates = []);
2728
+ updates.push([instance, dirtyInstances]);
2729
+ }
2730
+ } else if (instance.appContext.reload) instance.appContext.reload();
2731
+ else if (typeof window !== "undefined") window.location.reload();
2732
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2733
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2734
+ }
2735
+ parentUpdates.forEach((updates, parent) => {
2736
+ queueJob(() => {
2737
+ isHmrUpdating = true;
2738
+ if (parent.vapor) parent.hmrRerender();
2739
+ else {
2740
+ const i = parent;
2741
+ if (!(i.effect.flags & 1024)) {
2742
+ i.renderCache = [];
2743
+ i.effect.run();
2744
+ }
2745
+ }
2746
+ nextTick(() => {
2747
+ isHmrUpdating = false;
2748
+ });
2749
+ updates.forEach(([instance, dirtyInstances]) => {
2750
+ dirtyInstances.delete(instance);
2751
+ });
2710
2752
  });
2711
- dirtyInstances.delete(instance);
2712
2753
  });
2713
- else if (instance.appContext.reload) instance.appContext.reload();
2714
- else if (typeof window !== "undefined") window.location.reload();
2715
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2716
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2717
2754
  }
2718
2755
  queuePostFlushCb(() => {
2719
2756
  hmrDirtyComponents.clear();
@@ -4189,11 +4226,16 @@ var VueRuntimeDOM = (function(exports) {
4189
4226
  onError(err);
4190
4227
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4191
4228
  });
4192
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4229
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4193
4230
  load().then(() => {
4231
+ if (instance.isUnmounted) return;
4194
4232
  loaded.value = true;
4195
4233
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4196
4234
  }).catch((err) => {
4235
+ if (instance.isUnmounted) {
4236
+ setPendingRequest(null);
4237
+ return;
4238
+ }
4197
4239
  onError(err);
4198
4240
  error.value = err;
4199
4241
  });
@@ -4251,14 +4293,22 @@ var VueRuntimeDOM = (function(exports) {
4251
4293
  setPendingRequest: (request) => pendingRequest = request
4252
4294
  };
4253
4295
  }
4254
- const useAsyncComponentState = (delay, timeout, onError) => {
4296
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4255
4297
  const loaded = /* @__PURE__ */ ref(false);
4256
4298
  const error = /* @__PURE__ */ ref();
4257
4299
  const delayed = /* @__PURE__ */ ref(!!delay);
4258
- if (delay) setTimeout(() => {
4300
+ let timeoutTimer;
4301
+ let delayTimer;
4302
+ if (instance) onUnmounted(() => {
4303
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4304
+ if (delayTimer != null) clearTimeout(delayTimer);
4305
+ }, instance);
4306
+ if (delay) delayTimer = setTimeout(() => {
4307
+ if (instance && instance.isUnmounted) return;
4259
4308
  delayed.value = false;
4260
4309
  }, delay);
4261
- if (timeout != null) setTimeout(() => {
4310
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4311
+ if (instance && instance.isUnmounted) return;
4262
4312
  if (!loaded.value && !error.value) {
4263
4313
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4264
4314
  onError(err);
@@ -4661,6 +4711,7 @@ var VueRuntimeDOM = (function(exports) {
4661
4711
  slot: vaporSlot,
4662
4712
  fallback
4663
4713
  };
4714
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4664
4715
  return ret;
4665
4716
  }
4666
4717
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -5514,12 +5565,13 @@ var VueRuntimeDOM = (function(exports) {
5514
5565
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5515
5566
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5516
5567
  }
5517
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5568
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5569
+ if (!hasVModel) {
5518
5570
  localValue = value;
5519
5571
  trigger();
5520
5572
  }
5521
5573
  i.emit(`update:${name}`, emittedValue);
5522
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5574
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5523
5575
  prevSetValue = value;
5524
5576
  prevEmittedValue = emittedValue;
5525
5577
  }
@@ -8365,7 +8417,7 @@ var VueRuntimeDOM = (function(exports) {
8365
8417
  }
8366
8418
  //#endregion
8367
8419
  //#region packages/runtime-core/src/index.ts
8368
- const version = "3.6.0-beta.13";
8420
+ const version = "3.6.0-beta.15";
8369
8421
  const warn = warn$1;
8370
8422
  /**
8371
8423
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9500,7 +9552,7 @@ var VueRuntimeDOM = (function(exports) {
9500
9552
  prevChildren = [];
9501
9553
  if (children) for (let i = 0; i < children.length; i++) {
9502
9554
  const child = children[i];
9503
- if (child.el && child.el instanceof Element) {
9555
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
9504
9556
  prevChildren.push(child);
9505
9557
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9506
9558
  positionMap.set(child, getPosition(child.el));