vue 3.6.0-beta.13 → 3.6.0-beta.14

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.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2588,6 +2588,7 @@ function flushJobs(seen) {
2588
2588
  }
2589
2589
  flushIndex = 0;
2590
2590
  jobsLength = 0;
2591
+ jobs.length = 0;
2591
2592
  flushPostFlushCbs(seen);
2592
2593
  currentFlushPromise = null;
2593
2594
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2645,6 +2646,14 @@ function createRecord(id, initialDef) {
2645
2646
  function normalizeClassComponent(component) {
2646
2647
  return isClassComponent(component) ? component.__vccOpts : component;
2647
2648
  }
2649
+ function hasDirtyAncestor(instance, dirtyInstances) {
2650
+ let parent = instance.parent;
2651
+ while (parent) {
2652
+ if (dirtyInstances.has(parent)) return true;
2653
+ parent = parent.parent;
2654
+ }
2655
+ return false;
2656
+ }
2648
2657
  function rerender(id, newRender) {
2649
2658
  const record = map.get(id);
2650
2659
  if (!record) return;
@@ -2676,42 +2685,69 @@ function reload(id, newComp) {
2676
2685
  const isVapor = record.initialDef.__vapor;
2677
2686
  updateComponentDef(record.initialDef, newComp);
2678
2687
  const instances = [...record.instances];
2679
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2688
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2680
2689
  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;
2690
+ const dirtyInstances = new Set(instances);
2691
+ const rerenderedParents = /* @__PURE__ */ new Set();
2692
+ for (const instance of instances) {
2700
2693
  const parent = instance.parent;
2701
- if (parent.vapor) parent.hmrRerender();
2702
- else if (!(parent.effect.flags & 1024)) {
2703
- parent.renderCache = [];
2704
- parent.effect.run();
2694
+ if (parent) {
2695
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2696
+ rerenderedParents.add(parent);
2697
+ parent.hmrRerender();
2698
+ }
2699
+ } else instance.hmrReload(newComp);
2700
+ }
2701
+ } else {
2702
+ const parentUpdates = /* @__PURE__ */ new Map();
2703
+ const dirtyInstanceSet = new Set(instances);
2704
+ for (const instance of instances) {
2705
+ const oldComp = normalizeClassComponent(instance.type);
2706
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2707
+ if (!dirtyInstances) {
2708
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2709
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2705
2710
  }
2706
- nextTick(() => {
2707
- isHmrUpdating = false;
2711
+ dirtyInstances.add(instance);
2712
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2713
+ instance.appContext.propsCache.delete(instance.type);
2714
+ instance.appContext.emitsCache.delete(instance.type);
2715
+ instance.appContext.optionsCache.delete(instance.type);
2716
+ if (instance.ceReload) {
2717
+ dirtyInstances.add(instance);
2718
+ instance.ceReload(newComp.styles);
2719
+ dirtyInstances.delete(instance);
2720
+ } else if (instance.parent) {
2721
+ const parent = instance.parent;
2722
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2723
+ let updates = parentUpdates.get(parent);
2724
+ if (!updates) parentUpdates.set(parent, updates = []);
2725
+ updates.push([instance, dirtyInstances]);
2726
+ }
2727
+ } else if (instance.appContext.reload) instance.appContext.reload();
2728
+ else if (typeof window !== "undefined") window.location.reload();
2729
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2730
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2731
+ }
2732
+ parentUpdates.forEach((updates, parent) => {
2733
+ queueJob(() => {
2734
+ isHmrUpdating = true;
2735
+ if (parent.vapor) parent.hmrRerender();
2736
+ else {
2737
+ const i = parent;
2738
+ if (!(i.effect.flags & 1024)) {
2739
+ i.renderCache = [];
2740
+ i.effect.run();
2741
+ }
2742
+ }
2743
+ nextTick(() => {
2744
+ isHmrUpdating = false;
2745
+ });
2746
+ updates.forEach(([instance, dirtyInstances]) => {
2747
+ dirtyInstances.delete(instance);
2748
+ });
2708
2749
  });
2709
- dirtyInstances.delete(instance);
2710
2750
  });
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
2751
  }
2716
2752
  queuePostFlushCb(() => {
2717
2753
  hmrDirtyComponents.clear();
@@ -4663,6 +4699,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4663
4699
  slot: vaporSlot,
4664
4700
  fallback
4665
4701
  };
4702
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4666
4703
  return ret;
4667
4704
  }
4668
4705
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -8367,7 +8404,7 @@ function isMemoSame(cached, memo) {
8367
8404
  }
8368
8405
  //#endregion
8369
8406
  //#region packages/runtime-core/src/index.ts
8370
- const version = "3.6.0-beta.13";
8407
+ const version = "3.6.0-beta.14";
8371
8408
  const warn = warn$1;
8372
8409
  /**
8373
8410
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10003,4 +10040,4 @@ const compile = (_template) => {
10003
10040
  return NOOP;
10004
10041
  };
10005
10042
  //#endregion
10006
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, VueElementBase, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, nodeOps, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setIsHydratingEnabled, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useInstanceOption, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
10043
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, VueElementBase, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineAsyncComponent as defineVaporAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, nodeOps, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setIsHydratingEnabled, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useInstanceOption, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };