@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
  **/
@@ -1065,7 +1065,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
1065
1065
  prevChildren = [];
1066
1066
  if (children) for (let i = 0; i < children.length; i++) {
1067
1067
  const child = children[i];
1068
- if (child.el && child.el instanceof Element) {
1068
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
1069
1069
  prevChildren.push(child);
1070
1070
  (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1071
1071
  positionMap.set(child, getPosition(child.el));
@@ -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
  **/
@@ -1009,7 +1009,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
1009
1009
  prevChildren = [];
1010
1010
  if (children) for (let i = 0; i < children.length; i++) {
1011
1011
  const child = children[i];
1012
- if (child.el && child.el instanceof Element) {
1012
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
1013
1013
  prevChildren.push(child);
1014
1014
  (0, _vue_runtime_core.setTransitionHooks)(child, (0, _vue_runtime_core.resolveTransitionHooks)(child, cssTransitionProps, state, instance));
1015
1015
  positionMap.set(child, getPosition(child.el));
@@ -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
  **/
@@ -2156,8 +2156,9 @@ var WatcherEffect = class extends ReactiveEffect {
2156
2156
  if (once && cb) {
2157
2157
  const _cb = cb;
2158
2158
  cb = (...args) => {
2159
- _cb(...args);
2159
+ const res = _cb(...args);
2160
2160
  this.stop();
2161
+ return res;
2161
2162
  };
2162
2163
  }
2163
2164
  this.cb = cb;
@@ -2171,7 +2172,7 @@ var WatcherEffect = class extends ReactiveEffect {
2171
2172
  if (!this.cb) return;
2172
2173
  const { immediate, deep, call } = this.options;
2173
2174
  if (initialRun && !immediate) return;
2174
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2175
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2175
2176
  cleanup(this);
2176
2177
  const currentWatcher = activeWatcher;
2177
2178
  activeWatcher = this;
@@ -2588,6 +2589,7 @@ function flushJobs(seen) {
2588
2589
  }
2589
2590
  flushIndex = 0;
2590
2591
  jobsLength = 0;
2592
+ jobs.length = 0;
2591
2593
  flushPostFlushCbs(seen);
2592
2594
  currentFlushPromise = null;
2593
2595
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2645,6 +2647,14 @@ function createRecord(id, initialDef) {
2645
2647
  function normalizeClassComponent(component) {
2646
2648
  return isClassComponent(component) ? component.__vccOpts : component;
2647
2649
  }
2650
+ function hasDirtyAncestor(instance, dirtyInstances) {
2651
+ let parent = instance.parent;
2652
+ while (parent) {
2653
+ if (dirtyInstances.has(parent)) return true;
2654
+ parent = parent.parent;
2655
+ }
2656
+ return false;
2657
+ }
2648
2658
  function rerender(id, newRender) {
2649
2659
  const record = map.get(id);
2650
2660
  if (!record) return;
@@ -2676,42 +2686,69 @@ function reload(id, newComp) {
2676
2686
  const isVapor = record.initialDef.__vapor;
2677
2687
  updateComponentDef(record.initialDef, newComp);
2678
2688
  const instances = [...record.instances];
2679
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2689
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2680
2690
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2681
- for (const instance of instances) instance.hmrReload(newComp);
2682
- } else for (const instance of instances) {
2683
- const oldComp = normalizeClassComponent(instance.type);
2684
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2685
- if (!dirtyInstances) {
2686
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2687
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2688
- }
2689
- dirtyInstances.add(instance);
2690
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2691
- instance.appContext.propsCache.delete(instance.type);
2692
- instance.appContext.emitsCache.delete(instance.type);
2693
- instance.appContext.optionsCache.delete(instance.type);
2694
- if (instance.ceReload) {
2695
- dirtyInstances.add(instance);
2696
- instance.ceReload(newComp.styles);
2697
- dirtyInstances.delete(instance);
2698
- } else if (instance.parent) queueJob(() => {
2699
- isHmrUpdating = true;
2691
+ const dirtyInstances = new Set(instances);
2692
+ const rerenderedParents = /* @__PURE__ */ new Set();
2693
+ for (const instance of instances) {
2700
2694
  const parent = instance.parent;
2701
- if (parent.vapor) parent.hmrRerender();
2702
- else if (!(parent.effect.flags & 1024)) {
2703
- parent.renderCache = [];
2704
- parent.effect.run();
2695
+ if (parent) {
2696
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2697
+ rerenderedParents.add(parent);
2698
+ parent.hmrRerender();
2699
+ }
2700
+ } else instance.hmrReload(newComp);
2701
+ }
2702
+ } else {
2703
+ const parentUpdates = /* @__PURE__ */ new Map();
2704
+ const dirtyInstanceSet = new Set(instances);
2705
+ for (const instance of instances) {
2706
+ const oldComp = normalizeClassComponent(instance.type);
2707
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2708
+ if (!dirtyInstances) {
2709
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2710
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2705
2711
  }
2706
- nextTick(() => {
2707
- isHmrUpdating = false;
2712
+ dirtyInstances.add(instance);
2713
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2714
+ instance.appContext.propsCache.delete(instance.type);
2715
+ instance.appContext.emitsCache.delete(instance.type);
2716
+ instance.appContext.optionsCache.delete(instance.type);
2717
+ if (instance.ceReload) {
2718
+ dirtyInstances.add(instance);
2719
+ instance.ceReload(newComp.styles);
2720
+ dirtyInstances.delete(instance);
2721
+ } else if (instance.parent) {
2722
+ const parent = instance.parent;
2723
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2724
+ let updates = parentUpdates.get(parent);
2725
+ if (!updates) parentUpdates.set(parent, updates = []);
2726
+ updates.push([instance, dirtyInstances]);
2727
+ }
2728
+ } else if (instance.appContext.reload) instance.appContext.reload();
2729
+ else if (typeof window !== "undefined") window.location.reload();
2730
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2731
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2732
+ }
2733
+ parentUpdates.forEach((updates, parent) => {
2734
+ queueJob(() => {
2735
+ isHmrUpdating = true;
2736
+ if (parent.vapor) parent.hmrRerender();
2737
+ else {
2738
+ const i = parent;
2739
+ if (!(i.effect.flags & 1024)) {
2740
+ i.renderCache = [];
2741
+ i.effect.run();
2742
+ }
2743
+ }
2744
+ nextTick(() => {
2745
+ isHmrUpdating = false;
2746
+ });
2747
+ updates.forEach(([instance, dirtyInstances]) => {
2748
+ dirtyInstances.delete(instance);
2749
+ });
2708
2750
  });
2709
- dirtyInstances.delete(instance);
2710
2751
  });
2711
- else if (instance.appContext.reload) instance.appContext.reload();
2712
- else if (typeof window !== "undefined") window.location.reload();
2713
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2714
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2715
2752
  }
2716
2753
  queuePostFlushCb(() => {
2717
2754
  hmrDirtyComponents.clear();
@@ -4191,11 +4228,16 @@ function defineAsyncComponent(source) {
4191
4228
  onError(err);
4192
4229
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4193
4230
  });
4194
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4231
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4195
4232
  load().then(() => {
4233
+ if (instance.isUnmounted) return;
4196
4234
  loaded.value = true;
4197
4235
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4198
4236
  }).catch((err) => {
4237
+ if (instance.isUnmounted) {
4238
+ setPendingRequest(null);
4239
+ return;
4240
+ }
4199
4241
  onError(err);
4200
4242
  error.value = err;
4201
4243
  });
@@ -4253,14 +4295,22 @@ function createAsyncComponentContext(source) {
4253
4295
  setPendingRequest: (request) => pendingRequest = request
4254
4296
  };
4255
4297
  }
4256
- const useAsyncComponentState = (delay, timeout, onError) => {
4298
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4257
4299
  const loaded = /* @__PURE__ */ ref(false);
4258
4300
  const error = /* @__PURE__ */ ref();
4259
4301
  const delayed = /* @__PURE__ */ ref(!!delay);
4260
- if (delay) setTimeout(() => {
4302
+ let timeoutTimer;
4303
+ let delayTimer;
4304
+ if (instance) onUnmounted(() => {
4305
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4306
+ if (delayTimer != null) clearTimeout(delayTimer);
4307
+ }, instance);
4308
+ if (delay) delayTimer = setTimeout(() => {
4309
+ if (instance && instance.isUnmounted) return;
4261
4310
  delayed.value = false;
4262
4311
  }, delay);
4263
- if (timeout != null) setTimeout(() => {
4312
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4313
+ if (instance && instance.isUnmounted) return;
4264
4314
  if (!loaded.value && !error.value) {
4265
4315
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4266
4316
  onError(err);
@@ -4663,6 +4713,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4663
4713
  slot: vaporSlot,
4664
4714
  fallback
4665
4715
  };
4716
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4666
4717
  return ret;
4667
4718
  }
4668
4719
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -5516,12 +5567,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
5516
5567
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5517
5568
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5518
5569
  }
5519
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5570
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5571
+ if (!hasVModel) {
5520
5572
  localValue = value;
5521
5573
  trigger();
5522
5574
  }
5523
5575
  i.emit(`update:${name}`, emittedValue);
5524
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5576
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5525
5577
  prevSetValue = value;
5526
5578
  prevEmittedValue = emittedValue;
5527
5579
  }
@@ -8367,7 +8419,7 @@ function isMemoSame(cached, memo) {
8367
8419
  }
8368
8420
  //#endregion
8369
8421
  //#region packages/runtime-core/src/index.ts
8370
- const version = "3.6.0-beta.13";
8422
+ const version = "3.6.0-beta.15";
8371
8423
  const warn = warn$1;
8372
8424
  /**
8373
8425
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9518,7 +9570,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
9518
9570
  prevChildren = [];
9519
9571
  if (children) for (let i = 0; i < children.length; i++) {
9520
9572
  const child = children[i];
9521
- if (child.el && child.el instanceof Element) {
9573
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
9522
9574
  prevChildren.push(child);
9523
9575
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9524
9576
  positionMap.set(child, getPosition(child.el));