@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
  **/
@@ -376,7 +376,143 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
376
376
  }
377
377
  }
378
378
 
379
- const TeleportEndKey = Symbol("_vte");
379
+ function provide(key, value) {
380
+ if (currentInstance) {
381
+ let provides = currentInstance.provides;
382
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
383
+ if (parentProvides === provides) {
384
+ provides = currentInstance.provides = Object.create(parentProvides);
385
+ }
386
+ provides[key] = value;
387
+ }
388
+ }
389
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
390
+ const instance = getCurrentInstance();
391
+ if (instance || currentApp) {
392
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
393
+ if (provides && key in provides) {
394
+ return provides[key];
395
+ } else if (arguments.length > 1) {
396
+ return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
397
+ } else ;
398
+ }
399
+ }
400
+ function hasInjectionContext() {
401
+ return !!(getCurrentInstance() || currentApp);
402
+ }
403
+
404
+ const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
405
+ const useSSRContext = () => {
406
+ {
407
+ const ctx = inject(ssrContextKey);
408
+ return ctx;
409
+ }
410
+ };
411
+
412
+ function watchEffect(effect, options) {
413
+ return doWatch(effect, null, options);
414
+ }
415
+ function watchPostEffect(effect, options) {
416
+ return doWatch(
417
+ effect,
418
+ null,
419
+ { flush: "post" }
420
+ );
421
+ }
422
+ function watchSyncEffect(effect, options) {
423
+ return doWatch(
424
+ effect,
425
+ null,
426
+ { flush: "sync" }
427
+ );
428
+ }
429
+ function watch(source, cb, options) {
430
+ return doWatch(source, cb, options);
431
+ }
432
+ function doWatch(source, cb, options = shared.EMPTY_OBJ) {
433
+ const { immediate, deep, flush, once } = options;
434
+ const baseWatchOptions = shared.extend({}, options);
435
+ const runsImmediately = cb && immediate || !cb && flush !== "post";
436
+ let ssrCleanup;
437
+ if (isInSSRComponentSetup) {
438
+ if (flush === "sync") {
439
+ const ctx = useSSRContext();
440
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
441
+ } else if (!runsImmediately) {
442
+ const watchStopHandle = () => {
443
+ };
444
+ watchStopHandle.stop = shared.NOOP;
445
+ watchStopHandle.resume = shared.NOOP;
446
+ watchStopHandle.pause = shared.NOOP;
447
+ return watchStopHandle;
448
+ }
449
+ }
450
+ const instance = currentInstance;
451
+ baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
452
+ let isPre = false;
453
+ if (flush === "post") {
454
+ baseWatchOptions.scheduler = (job) => {
455
+ queuePostRenderEffect(job, instance && instance.suspense);
456
+ };
457
+ } else if (flush !== "sync") {
458
+ isPre = true;
459
+ baseWatchOptions.scheduler = (job, isFirstRun) => {
460
+ if (isFirstRun) {
461
+ job();
462
+ } else {
463
+ queueJob(job);
464
+ }
465
+ };
466
+ }
467
+ baseWatchOptions.augmentJob = (job) => {
468
+ if (cb) {
469
+ job.flags |= 4;
470
+ }
471
+ if (isPre) {
472
+ job.flags |= 2;
473
+ if (instance) {
474
+ job.id = instance.uid;
475
+ job.i = instance;
476
+ }
477
+ }
478
+ };
479
+ const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
480
+ if (isInSSRComponentSetup) {
481
+ if (ssrCleanup) {
482
+ ssrCleanup.push(watchHandle);
483
+ } else if (runsImmediately) {
484
+ watchHandle();
485
+ }
486
+ }
487
+ return watchHandle;
488
+ }
489
+ function instanceWatch(source, value, options) {
490
+ const publicThis = this.proxy;
491
+ const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
492
+ let cb;
493
+ if (shared.isFunction(value)) {
494
+ cb = value;
495
+ } else {
496
+ cb = value.handler;
497
+ options = value;
498
+ }
499
+ const reset = setCurrentInstance(this);
500
+ const res = doWatch(getter, cb.bind(publicThis), options);
501
+ reset();
502
+ return res;
503
+ }
504
+ function createPathGetter(ctx, path) {
505
+ const segments = path.split(".");
506
+ return () => {
507
+ let cur = ctx;
508
+ for (let i = 0; i < segments.length && cur; i++) {
509
+ cur = cur[segments[i]];
510
+ }
511
+ return cur;
512
+ };
513
+ }
514
+
515
+ const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
380
516
  const isTeleport = (type) => type.__isTeleport;
381
517
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
382
518
  const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
@@ -709,8 +845,8 @@ function prepareAnchor(target, vnode, createText, insert) {
709
845
  return targetAnchor;
710
846
  }
711
847
 
712
- const leaveCbKey = Symbol("_leaveCb");
713
- const enterCbKey = Symbol("_enterCb");
848
+ const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
849
+ const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
714
850
  function useTransitionState() {
715
851
  const state = {
716
852
  isMounted: false,
@@ -2003,7 +2139,9 @@ const KeepAliveImpl = {
2003
2139
  }
2004
2140
  function pruneCache(filter) {
2005
2141
  cache.forEach((vnode, key) => {
2006
- const name = getComponentName(vnode.type);
2142
+ const name = getComponentName(
2143
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
2144
+ );
2007
2145
  if (name && !filter(name)) {
2008
2146
  pruneCacheEntry(key);
2009
2147
  }
@@ -2222,7 +2360,7 @@ const DIRECTIVES = "directives";
2222
2360
  function resolveComponent(name, maybeSelfReference) {
2223
2361
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2224
2362
  }
2225
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2363
+ const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
2226
2364
  function resolveDynamicComponent(component) {
2227
2365
  if (shared.isString(component)) {
2228
2366
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -3075,142 +3213,6 @@ function createAppAPI(render, hydrate) {
3075
3213
  }
3076
3214
  let currentApp = null;
3077
3215
 
3078
- function provide(key, value) {
3079
- if (currentInstance) {
3080
- let provides = currentInstance.provides;
3081
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3082
- if (parentProvides === provides) {
3083
- provides = currentInstance.provides = Object.create(parentProvides);
3084
- }
3085
- provides[key] = value;
3086
- }
3087
- }
3088
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3089
- const instance = getCurrentInstance();
3090
- if (instance || currentApp) {
3091
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
3092
- if (provides && key in provides) {
3093
- return provides[key];
3094
- } else if (arguments.length > 1) {
3095
- return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
3096
- } else ;
3097
- }
3098
- }
3099
- function hasInjectionContext() {
3100
- return !!(getCurrentInstance() || currentApp);
3101
- }
3102
-
3103
- const ssrContextKey = Symbol.for("v-scx");
3104
- const useSSRContext = () => {
3105
- {
3106
- const ctx = inject(ssrContextKey);
3107
- return ctx;
3108
- }
3109
- };
3110
-
3111
- function watchEffect(effect, options) {
3112
- return doWatch(effect, null, options);
3113
- }
3114
- function watchPostEffect(effect, options) {
3115
- return doWatch(
3116
- effect,
3117
- null,
3118
- { flush: "post" }
3119
- );
3120
- }
3121
- function watchSyncEffect(effect, options) {
3122
- return doWatch(
3123
- effect,
3124
- null,
3125
- { flush: "sync" }
3126
- );
3127
- }
3128
- function watch(source, cb, options) {
3129
- return doWatch(source, cb, options);
3130
- }
3131
- function doWatch(source, cb, options = shared.EMPTY_OBJ) {
3132
- const { immediate, deep, flush, once } = options;
3133
- const baseWatchOptions = shared.extend({}, options);
3134
- const runsImmediately = cb && immediate || !cb && flush !== "post";
3135
- let ssrCleanup;
3136
- if (isInSSRComponentSetup) {
3137
- if (flush === "sync") {
3138
- const ctx = useSSRContext();
3139
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
3140
- } else if (!runsImmediately) {
3141
- const watchStopHandle = () => {
3142
- };
3143
- watchStopHandle.stop = shared.NOOP;
3144
- watchStopHandle.resume = shared.NOOP;
3145
- watchStopHandle.pause = shared.NOOP;
3146
- return watchStopHandle;
3147
- }
3148
- }
3149
- const instance = currentInstance;
3150
- baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
3151
- let isPre = false;
3152
- if (flush === "post") {
3153
- baseWatchOptions.scheduler = (job) => {
3154
- queuePostRenderEffect(job, instance && instance.suspense);
3155
- };
3156
- } else if (flush !== "sync") {
3157
- isPre = true;
3158
- baseWatchOptions.scheduler = (job, isFirstRun) => {
3159
- if (isFirstRun) {
3160
- job();
3161
- } else {
3162
- queueJob(job);
3163
- }
3164
- };
3165
- }
3166
- baseWatchOptions.augmentJob = (job) => {
3167
- if (cb) {
3168
- job.flags |= 4;
3169
- }
3170
- if (isPre) {
3171
- job.flags |= 2;
3172
- if (instance) {
3173
- job.id = instance.uid;
3174
- job.i = instance;
3175
- }
3176
- }
3177
- };
3178
- const watchHandle = reactivity.watch(source, cb, baseWatchOptions);
3179
- if (isInSSRComponentSetup) {
3180
- if (ssrCleanup) {
3181
- ssrCleanup.push(watchHandle);
3182
- } else if (runsImmediately) {
3183
- watchHandle();
3184
- }
3185
- }
3186
- return watchHandle;
3187
- }
3188
- function instanceWatch(source, value, options) {
3189
- const publicThis = this.proxy;
3190
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
3191
- let cb;
3192
- if (shared.isFunction(value)) {
3193
- cb = value;
3194
- } else {
3195
- cb = value.handler;
3196
- options = value;
3197
- }
3198
- const reset = setCurrentInstance(this);
3199
- const res = doWatch(getter, cb.bind(publicThis), options);
3200
- reset();
3201
- return res;
3202
- }
3203
- function createPathGetter(ctx, path) {
3204
- const segments = path.split(".");
3205
- return () => {
3206
- let cur = ctx;
3207
- for (let i = 0; i < segments.length && cur; i++) {
3208
- cur = cur[segments[i]];
3209
- }
3210
- return cur;
3211
- };
3212
- }
3213
-
3214
3216
  function useModel(props, name, options = shared.EMPTY_OBJ) {
3215
3217
  const i = getCurrentInstance();
3216
3218
  const camelizedName = shared.camelize(name);
@@ -4068,7 +4070,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4068
4070
  } else {
4069
4071
  const el = n2.el = n1.el;
4070
4072
  if (n2.children !== n1.children) {
4071
- hostSetText(el, n2.children);
4073
+ {
4074
+ hostSetText(el, n2.children);
4075
+ }
4072
4076
  }
4073
4077
  }
4074
4078
  };
@@ -4413,7 +4417,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4413
4417
  } else {
4414
4418
  if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
4415
4419
  // of renderSlot() with no valid children
4416
- n1.dynamicChildren) {
4420
+ n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
4417
4421
  patchBlockChildren(
4418
4422
  n1.dynamicChildren,
4419
4423
  dynamicChildren,
@@ -4930,8 +4934,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4930
4934
  const nextChild = c2[nextIndex];
4931
4935
  const anchorVNode = c2[nextIndex + 1];
4932
4936
  const anchor = nextIndex + 1 < l2 ? (
4933
- // #13559, fallback to el placeholder for unresolved async component
4934
- anchorVNode.el || anchorVNode.placeholder
4937
+ // #13559, #14173 fallback to el placeholder for unresolved async component
4938
+ anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
4935
4939
  ) : parentAnchor;
4936
4940
  if (newIndexToOldIndexMap[i] === 0) {
4937
4941
  patch(
@@ -5173,9 +5177,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5173
5177
  };
5174
5178
  let isFlushing = false;
5175
5179
  const render = (vnode, container, namespace) => {
5180
+ let instance;
5176
5181
  if (vnode == null) {
5177
5182
  if (container._vnode) {
5178
5183
  unmount(container._vnode, null, null, true);
5184
+ instance = container._vnode.component;
5179
5185
  }
5180
5186
  } else {
5181
5187
  patch(
@@ -5191,7 +5197,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5191
5197
  container._vnode = vnode;
5192
5198
  if (!isFlushing) {
5193
5199
  isFlushing = true;
5194
- flushPreFlushCbs();
5200
+ flushPreFlushCbs(instance);
5195
5201
  flushPostFlushCbs();
5196
5202
  isFlushing = false;
5197
5203
  }
@@ -5251,9 +5257,13 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5251
5257
  if (!shallow && c2.patchFlag !== -2)
5252
5258
  traverseStaticChildren(c1, c2);
5253
5259
  }
5254
- if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
5255
- c2.patchFlag !== -1) {
5256
- c2.el = c1.el;
5260
+ if (c2.type === Text) {
5261
+ if (c2.patchFlag !== -1) {
5262
+ c2.el = c1.el;
5263
+ } else {
5264
+ c2.__elIndex = i + // take fragment start anchor into account
5265
+ (n1.type === Fragment ? 1 : 0);
5266
+ }
5257
5267
  }
5258
5268
  if (c2.type === Comment && !c2.el) {
5259
5269
  c2.el = c1.el;
@@ -5317,6 +5327,16 @@ function invalidateMount(hooks) {
5317
5327
  hooks[i].flags |= 8;
5318
5328
  }
5319
5329
  }
5330
+ function resolveAsyncComponentPlaceholder(anchorVnode) {
5331
+ if (anchorVnode.placeholder) {
5332
+ return anchorVnode.placeholder;
5333
+ }
5334
+ const instance = anchorVnode.component;
5335
+ if (instance) {
5336
+ return resolveAsyncComponentPlaceholder(instance.subTree);
5337
+ }
5338
+ return null;
5339
+ }
5320
5340
 
5321
5341
  const isSuspense = (type) => type.__isSuspense;
5322
5342
  let suspenseId = 0;
@@ -5888,10 +5908,10 @@ function isVNodeSuspensible(vnode) {
5888
5908
  return suspensible != null && suspensible !== false;
5889
5909
  }
5890
5910
 
5891
- const Fragment = Symbol.for("v-fgt");
5892
- const Text = Symbol.for("v-txt");
5893
- const Comment = Symbol.for("v-cmt");
5894
- const Static = Symbol.for("v-stc");
5911
+ const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
5912
+ const Text = /* @__PURE__ */ Symbol.for("v-txt");
5913
+ const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
5914
+ const Static = /* @__PURE__ */ Symbol.for("v-stc");
5895
5915
  const blockStack = [];
5896
5916
  let currentBlock = null;
5897
5917
  function openBlock(disableTracking = false) {
@@ -6580,7 +6600,7 @@ function isMemoSame(cached, memo) {
6580
6600
  return true;
6581
6601
  }
6582
6602
 
6583
- const version = "3.5.25";
6603
+ const version = "3.5.26";
6584
6604
  const warn$1 = shared.NOOP;
6585
6605
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6586
6606
  const devtools = void 0;
@@ -196,7 +196,7 @@ export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<Type
196
196
  export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
197
197
  readonly [K in BKeys]-?: boolean;
198
198
  };
199
- type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends [boolean | undefined] ? K : never : never;
199
+ type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? T[K] extends boolean | undefined ? T[K] extends never | undefined ? never : K : never : never;
200
200
  /**
201
201
  * Vue `<script setup>` compiler macro for declaring a component's emitted
202
202
  * events. The expected argument is the same as the component `emits` option.
@@ -420,7 +420,7 @@ export interface ObjectDirective<HostElement = any, Value = any, Modifiers exten
420
420
  }
421
421
  export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg = any> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
422
422
  export type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg = any> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
423
- type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
423
+ export type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
424
424
  export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, any] | [Directive | undefined, any, any, DirectiveModifiers]>;
425
425
  /**
426
426
  * Adds directives to a VNode.