@vue/runtime-core 3.5.25 → 3.5.26

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-core v3.5.25
2
+ * @vue/runtime-core v3.5.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -765,7 +765,180 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
765
765
  }
766
766
  }
767
767
 
768
- const TeleportEndKey = Symbol("_vte");
768
+ function provide(key, value) {
769
+ {
770
+ if (!currentInstance || currentInstance.isMounted) {
771
+ warn$1(`provide() can only be used inside setup().`);
772
+ }
773
+ }
774
+ if (currentInstance) {
775
+ let provides = currentInstance.provides;
776
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
777
+ if (parentProvides === provides) {
778
+ provides = currentInstance.provides = Object.create(parentProvides);
779
+ }
780
+ provides[key] = value;
781
+ }
782
+ }
783
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
784
+ const instance = getCurrentInstance();
785
+ if (instance || currentApp) {
786
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
787
+ if (provides && key in provides) {
788
+ return provides[key];
789
+ } else if (arguments.length > 1) {
790
+ return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
791
+ } else {
792
+ warn$1(`injection "${String(key)}" not found.`);
793
+ }
794
+ } else {
795
+ warn$1(`inject() can only be used inside setup() or functional components.`);
796
+ }
797
+ }
798
+ function hasInjectionContext() {
799
+ return !!(getCurrentInstance() || currentApp);
800
+ }
801
+
802
+ const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
803
+ const useSSRContext = () => {
804
+ {
805
+ const ctx = inject(ssrContextKey);
806
+ if (!ctx) {
807
+ warn$1(
808
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
809
+ );
810
+ }
811
+ return ctx;
812
+ }
813
+ };
814
+
815
+ function watchEffect(effect, options) {
816
+ return doWatch(effect, null, options);
817
+ }
818
+ function watchPostEffect(effect, options) {
819
+ return doWatch(
820
+ effect,
821
+ null,
822
+ shared.extend({}, options, { flush: "post" })
823
+ );
824
+ }
825
+ function watchSyncEffect(effect, options) {
826
+ return doWatch(
827
+ effect,
828
+ null,
829
+ shared.extend({}, options, { flush: "sync" })
830
+ );
831
+ }
832
+ function watch(source, cb, options) {
833
+ if (!shared.isFunction(cb)) {
834
+ warn$1(
835
+ `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
836
+ );
837
+ }
838
+ return doWatch(source, cb, options);
839
+ }
840
+ function doWatch(source, cb, options = shared.EMPTY_OBJ) {
841
+ const { immediate, deep, flush, once } = options;
842
+ if (!cb) {
843
+ if (immediate !== void 0) {
844
+ warn$1(
845
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
846
+ );
847
+ }
848
+ if (deep !== void 0) {
849
+ warn$1(
850
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
851
+ );
852
+ }
853
+ if (once !== void 0) {
854
+ warn$1(
855
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
856
+ );
857
+ }
858
+ }
859
+ const baseWatchOptions = shared.extend({}, options);
860
+ baseWatchOptions.onWarn = warn$1;
861
+ const runsImmediately = cb && immediate || !cb && flush !== "post";
862
+ let ssrCleanup;
863
+ if (isInSSRComponentSetup) {
864
+ if (flush === "sync") {
865
+ const ctx = useSSRContext();
866
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
867
+ } else if (!runsImmediately) {
868
+ const watchStopHandle = () => {
869
+ };
870
+ watchStopHandle.stop = shared.NOOP;
871
+ watchStopHandle.resume = shared.NOOP;
872
+ watchStopHandle.pause = shared.NOOP;
873
+ return watchStopHandle;
874
+ }
875
+ }
876
+ const instance = currentInstance;
877
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
878
+ let isPre = false;
879
+ if (flush === "post") {
880
+ baseWatchOptions.scheduler = (job) => {
881
+ queuePostRenderEffect(job, instance && instance.suspense);
882
+ };
883
+ } else if (flush !== "sync") {
884
+ isPre = true;
885
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
886
+ if (isFirstRun) {
887
+ job();
888
+ } else {
889
+ queueJob(job);
890
+ }
891
+ };
892
+ }
893
+ baseWatchOptions.augmentJob = (job) => {
894
+ if (cb) {
895
+ job.flags |= 4;
896
+ }
897
+ if (isPre) {
898
+ job.flags |= 2;
899
+ if (instance) {
900
+ job.id = instance.uid;
901
+ job.i = instance;
902
+ }
903
+ }
904
+ };
905
+ const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
906
+ if (isInSSRComponentSetup) {
907
+ if (ssrCleanup) {
908
+ ssrCleanup.push(watchHandle);
909
+ } else if (runsImmediately) {
910
+ watchHandle();
911
+ }
912
+ }
913
+ return watchHandle;
914
+ }
915
+ function instanceWatch(source, value, options) {
916
+ const publicThis = this.proxy;
917
+ const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
918
+ let cb;
919
+ if (shared.isFunction(value)) {
920
+ cb = value;
921
+ } else {
922
+ cb = value.handler;
923
+ options = value;
924
+ }
925
+ const reset = setCurrentInstance(this);
926
+ const res = doWatch(getter, cb.bind(publicThis), options);
927
+ reset();
928
+ return res;
929
+ }
930
+ function createPathGetter(ctx, path) {
931
+ const segments = path.split(".");
932
+ return () => {
933
+ let cur = ctx;
934
+ for (let i = 0; i < segments.length && cur; i++) {
935
+ cur = cur[segments[i]];
936
+ }
937
+ return cur;
938
+ };
939
+ }
940
+
941
+ const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
769
942
  const isTeleport = (type) => type.__isTeleport;
770
943
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
771
944
  const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
@@ -1125,8 +1298,8 @@ function prepareAnchor(target, vnode, createText, insert) {
1125
1298
  return targetAnchor;
1126
1299
  }
1127
1300
 
1128
- const leaveCbKey = Symbol("_leaveCb");
1129
- const enterCbKey = Symbol("_enterCb");
1301
+ const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
1302
+ const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
1130
1303
  function useTransitionState() {
1131
1304
  const state = {
1132
1305
  isMounted: false,
@@ -2660,7 +2833,9 @@ const KeepAliveImpl = {
2660
2833
  }
2661
2834
  function pruneCache(filter) {
2662
2835
  cache.forEach((vnode, key) => {
2663
- const name = getComponentName(vnode.type);
2836
+ const name = getComponentName(
2837
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
2838
+ );
2664
2839
  if (name && !filter(name)) {
2665
2840
  pruneCacheEntry(key);
2666
2841
  }
@@ -2887,7 +3062,7 @@ const DIRECTIVES = "directives";
2887
3062
  function resolveComponent(name, maybeSelfReference) {
2888
3063
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2889
3064
  }
2890
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3065
+ const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
2891
3066
  function resolveDynamicComponent(component) {
2892
3067
  if (shared.isString(component)) {
2893
3068
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -4051,179 +4226,6 @@ If you want to remount the same app, move your app creation logic into a factory
4051
4226
  }
4052
4227
  let currentApp = null;
4053
4228
 
4054
- function provide(key, value) {
4055
- {
4056
- if (!currentInstance || currentInstance.isMounted) {
4057
- warn$1(`provide() can only be used inside setup().`);
4058
- }
4059
- }
4060
- if (currentInstance) {
4061
- let provides = currentInstance.provides;
4062
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
4063
- if (parentProvides === provides) {
4064
- provides = currentInstance.provides = Object.create(parentProvides);
4065
- }
4066
- provides[key] = value;
4067
- }
4068
- }
4069
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
4070
- const instance = getCurrentInstance();
4071
- if (instance || currentApp) {
4072
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
4073
- if (provides && key in provides) {
4074
- return provides[key];
4075
- } else if (arguments.length > 1) {
4076
- return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
4077
- } else {
4078
- warn$1(`injection "${String(key)}" not found.`);
4079
- }
4080
- } else {
4081
- warn$1(`inject() can only be used inside setup() or functional components.`);
4082
- }
4083
- }
4084
- function hasInjectionContext() {
4085
- return !!(getCurrentInstance() || currentApp);
4086
- }
4087
-
4088
- const ssrContextKey = Symbol.for("v-scx");
4089
- const useSSRContext = () => {
4090
- {
4091
- const ctx = inject(ssrContextKey);
4092
- if (!ctx) {
4093
- warn$1(
4094
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
4095
- );
4096
- }
4097
- return ctx;
4098
- }
4099
- };
4100
-
4101
- function watchEffect(effect, options) {
4102
- return doWatch(effect, null, options);
4103
- }
4104
- function watchPostEffect(effect, options) {
4105
- return doWatch(
4106
- effect,
4107
- null,
4108
- shared.extend({}, options, { flush: "post" })
4109
- );
4110
- }
4111
- function watchSyncEffect(effect, options) {
4112
- return doWatch(
4113
- effect,
4114
- null,
4115
- shared.extend({}, options, { flush: "sync" })
4116
- );
4117
- }
4118
- function watch(source, cb, options) {
4119
- if (!shared.isFunction(cb)) {
4120
- warn$1(
4121
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
4122
- );
4123
- }
4124
- return doWatch(source, cb, options);
4125
- }
4126
- function doWatch(source, cb, options = shared.EMPTY_OBJ) {
4127
- const { immediate, deep, flush, once } = options;
4128
- if (!cb) {
4129
- if (immediate !== void 0) {
4130
- warn$1(
4131
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
4132
- );
4133
- }
4134
- if (deep !== void 0) {
4135
- warn$1(
4136
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
4137
- );
4138
- }
4139
- if (once !== void 0) {
4140
- warn$1(
4141
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
4142
- );
4143
- }
4144
- }
4145
- const baseWatchOptions = shared.extend({}, options);
4146
- baseWatchOptions.onWarn = warn$1;
4147
- const runsImmediately = cb && immediate || !cb && flush !== "post";
4148
- let ssrCleanup;
4149
- if (isInSSRComponentSetup) {
4150
- if (flush === "sync") {
4151
- const ctx = useSSRContext();
4152
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
4153
- } else if (!runsImmediately) {
4154
- const watchStopHandle = () => {
4155
- };
4156
- watchStopHandle.stop = shared.NOOP;
4157
- watchStopHandle.resume = shared.NOOP;
4158
- watchStopHandle.pause = shared.NOOP;
4159
- return watchStopHandle;
4160
- }
4161
- }
4162
- const instance = currentInstance;
4163
- baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
4164
- let isPre = false;
4165
- if (flush === "post") {
4166
- baseWatchOptions.scheduler = (job) => {
4167
- queuePostRenderEffect(job, instance && instance.suspense);
4168
- };
4169
- } else if (flush !== "sync") {
4170
- isPre = true;
4171
- baseWatchOptions.scheduler = (job, isFirstRun) => {
4172
- if (isFirstRun) {
4173
- job();
4174
- } else {
4175
- queueJob(job);
4176
- }
4177
- };
4178
- }
4179
- baseWatchOptions.augmentJob = (job) => {
4180
- if (cb) {
4181
- job.flags |= 4;
4182
- }
4183
- if (isPre) {
4184
- job.flags |= 2;
4185
- if (instance) {
4186
- job.id = instance.uid;
4187
- job.i = instance;
4188
- }
4189
- }
4190
- };
4191
- const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
4192
- if (isInSSRComponentSetup) {
4193
- if (ssrCleanup) {
4194
- ssrCleanup.push(watchHandle);
4195
- } else if (runsImmediately) {
4196
- watchHandle();
4197
- }
4198
- }
4199
- return watchHandle;
4200
- }
4201
- function instanceWatch(source, value, options) {
4202
- const publicThis = this.proxy;
4203
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
4204
- let cb;
4205
- if (shared.isFunction(value)) {
4206
- cb = value;
4207
- } else {
4208
- cb = value.handler;
4209
- options = value;
4210
- }
4211
- const reset = setCurrentInstance(this);
4212
- const res = doWatch(getter, cb.bind(publicThis), options);
4213
- reset();
4214
- return res;
4215
- }
4216
- function createPathGetter(ctx, path) {
4217
- const segments = path.split(".");
4218
- return () => {
4219
- let cur = ctx;
4220
- for (let i = 0; i < segments.length && cur; i++) {
4221
- cur = cur[segments[i]];
4222
- }
4223
- return cur;
4224
- };
4225
- }
4226
-
4227
4229
  function useModel(props, name, options = shared.EMPTY_OBJ) {
4228
4230
  const i = getCurrentInstance();
4229
4231
  if (!i) {
@@ -5406,7 +5408,15 @@ function baseCreateRenderer(options, createHydrationFns) {
5406
5408
  } else {
5407
5409
  const el = n2.el = n1.el;
5408
5410
  if (n2.children !== n1.children) {
5409
- hostSetText(el, n2.children);
5411
+ if (isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) {
5412
+ const childNodes = container.childNodes;
5413
+ const newChild = hostCreateText(n2.children);
5414
+ const oldChild = childNodes[n2.__elIndex = n1.__elIndex];
5415
+ hostInsert(newChild, container, oldChild);
5416
+ hostRemove(oldChild);
5417
+ } else {
5418
+ hostSetText(el, n2.children);
5419
+ }
5410
5420
  }
5411
5421
  }
5412
5422
  };
@@ -5792,7 +5802,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5792
5802
  } else {
5793
5803
  if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
5794
5804
  // of renderSlot() with no valid children
5795
- n1.dynamicChildren) {
5805
+ n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
5796
5806
  patchBlockChildren(
5797
5807
  n1.dynamicChildren,
5798
5808
  dynamicChildren,
@@ -6381,8 +6391,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6381
6391
  const nextChild = c2[nextIndex];
6382
6392
  const anchorVNode = c2[nextIndex + 1];
6383
6393
  const anchor = nextIndex + 1 < l2 ? (
6384
- // #13559, fallback to el placeholder for unresolved async component
6385
- anchorVNode.el || anchorVNode.placeholder
6394
+ // #13559, #14173 fallback to el placeholder for unresolved async component
6395
+ anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
6386
6396
  ) : parentAnchor;
6387
6397
  if (newIndexToOldIndexMap[i] === 0) {
6388
6398
  patch(
@@ -6638,9 +6648,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6638
6648
  };
6639
6649
  let isFlushing = false;
6640
6650
  const render = (vnode, container, namespace) => {
6651
+ let instance;
6641
6652
  if (vnode == null) {
6642
6653
  if (container._vnode) {
6643
6654
  unmount(container._vnode, null, null, true);
6655
+ instance = container._vnode.component;
6644
6656
  }
6645
6657
  } else {
6646
6658
  patch(
@@ -6656,7 +6668,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6656
6668
  container._vnode = vnode;
6657
6669
  if (!isFlushing) {
6658
6670
  isFlushing = true;
6659
- flushPreFlushCbs();
6671
+ flushPreFlushCbs(instance);
6660
6672
  flushPostFlushCbs();
6661
6673
  isFlushing = false;
6662
6674
  }
@@ -6716,9 +6728,13 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6716
6728
  if (!shallow && c2.patchFlag !== -2)
6717
6729
  traverseStaticChildren(c1, c2);
6718
6730
  }
6719
- if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
6720
- c2.patchFlag !== -1) {
6721
- c2.el = c1.el;
6731
+ if (c2.type === Text) {
6732
+ if (c2.patchFlag !== -1) {
6733
+ c2.el = c1.el;
6734
+ } else {
6735
+ c2.__elIndex = i + // take fragment start anchor into account
6736
+ (n1.type === Fragment ? 1 : 0);
6737
+ }
6722
6738
  }
6723
6739
  if (c2.type === Comment && !c2.el) {
6724
6740
  c2.el = c1.el;
@@ -6785,6 +6801,16 @@ function invalidateMount(hooks) {
6785
6801
  hooks[i].flags |= 8;
6786
6802
  }
6787
6803
  }
6804
+ function resolveAsyncComponentPlaceholder(anchorVnode) {
6805
+ if (anchorVnode.placeholder) {
6806
+ return anchorVnode.placeholder;
6807
+ }
6808
+ const instance = anchorVnode.component;
6809
+ if (instance) {
6810
+ return resolveAsyncComponentPlaceholder(instance.subTree);
6811
+ }
6812
+ return null;
6813
+ }
6788
6814
 
6789
6815
  const isSuspense = (type) => type.__isSuspense;
6790
6816
  let suspenseId = 0;
@@ -7387,10 +7413,10 @@ function isVNodeSuspensible(vnode) {
7387
7413
  return suspensible != null && suspensible !== false;
7388
7414
  }
7389
7415
 
7390
- const Fragment = Symbol.for("v-fgt");
7391
- const Text = Symbol.for("v-txt");
7392
- const Comment = Symbol.for("v-cmt");
7393
- const Static = Symbol.for("v-stc");
7416
+ const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
7417
+ const Text = /* @__PURE__ */ Symbol.for("v-txt");
7418
+ const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
7419
+ const Static = /* @__PURE__ */ Symbol.for("v-stc");
7394
7420
  const blockStack = [];
7395
7421
  let currentBlock = null;
7396
7422
  function openBlock(disableTracking = false) {
@@ -8434,7 +8460,7 @@ function isMemoSame(cached, memo) {
8434
8460
  return true;
8435
8461
  }
8436
8462
 
8437
- const version = "3.5.25";
8463
+ const version = "3.5.26";
8438
8464
  const warn = warn$1 ;
8439
8465
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8440
8466
  const devtools = devtools$1 ;