@vue/runtime-core 3.2.41 → 3.2.42

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.
@@ -681,7 +681,7 @@ function emit$1(instance, event, ...rawArgs) {
681
681
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
682
682
  const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
683
683
  if (trim) {
684
- args = rawArgs.map(a => a.trim());
684
+ args = rawArgs.map(a => (shared.isString(a) ? a.trim() : a));
685
685
  }
686
686
  if (number) {
687
687
  args = rawArgs.map(shared.toNumber);
@@ -1746,7 +1746,8 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1746
1746
  };
1747
1747
  };
1748
1748
  // in SSR there is no need to setup an actual effect, and it should be noop
1749
- // unless it's eager
1749
+ // unless it's eager or sync flush
1750
+ let ssrCleanup;
1750
1751
  if (isInSSRComponentSetup) {
1751
1752
  // we will also not call the invalidate callback (+ runner is not set up)
1752
1753
  onCleanup = shared.NOOP;
@@ -1760,9 +1761,17 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1760
1761
  onCleanup
1761
1762
  ]);
1762
1763
  }
1763
- return shared.NOOP;
1764
+ if (flush === 'sync') {
1765
+ const ctx = useSSRContext();
1766
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1767
+ }
1768
+ else {
1769
+ return shared.NOOP;
1770
+ }
1764
1771
  }
1765
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
1772
+ let oldValue = isMultiSource
1773
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
1774
+ : INITIAL_WATCHER_VALUE;
1766
1775
  const job = () => {
1767
1776
  if (!effect.active) {
1768
1777
  return;
@@ -1783,7 +1792,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1783
1792
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1784
1793
  newValue,
1785
1794
  // pass undefined as the old value when it's changed for the first time
1786
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
1795
+ oldValue === INITIAL_WATCHER_VALUE ||
1796
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1797
+ ? undefined
1798
+ : oldValue,
1787
1799
  onCleanup
1788
1800
  ]);
1789
1801
  oldValue = newValue;
@@ -1831,12 +1843,15 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1831
1843
  else {
1832
1844
  effect.run();
1833
1845
  }
1834
- return () => {
1846
+ const unwatch = () => {
1835
1847
  effect.stop();
1836
1848
  if (instance && instance.scope) {
1837
1849
  shared.remove(instance.scope.effects, effect);
1838
1850
  }
1839
1851
  };
1852
+ if (ssrCleanup)
1853
+ ssrCleanup.push(unwatch);
1854
+ return unwatch;
1840
1855
  }
1841
1856
  // this.$watch
1842
1857
  function instanceWatch(source, value, options) {
@@ -2018,7 +2033,11 @@ const BaseTransitionImpl = {
2018
2033
  // return placeholder node and queue update when leave finishes
2019
2034
  leavingHooks.afterLeave = () => {
2020
2035
  state.isLeaving = false;
2021
- instance.update();
2036
+ // #6835
2037
+ // it also needs to be updated when active is undefined
2038
+ if (instance.update.active !== false) {
2039
+ instance.update();
2040
+ }
2022
2041
  };
2023
2042
  return emptyPlaceholder(child);
2024
2043
  }
@@ -2544,7 +2563,8 @@ const KeepAliveImpl = {
2544
2563
  : comp);
2545
2564
  const { include, exclude, max } = props;
2546
2565
  if ((include && (!name || !matches(include, name))) ||
2547
- (exclude && name && matches(exclude, name))) {
2566
+ (exclude && name && matches(exclude, name)) ||
2567
+ (hmrDirtyComponents.has(comp))) {
2548
2568
  current = vnode;
2549
2569
  return rawVNode;
2550
2570
  }
@@ -2756,23 +2776,25 @@ function withDirectives(vnode, directives) {
2756
2776
  const bindings = vnode.dirs || (vnode.dirs = []);
2757
2777
  for (let i = 0; i < directives.length; i++) {
2758
2778
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
2759
- if (shared.isFunction(dir)) {
2760
- dir = {
2761
- mounted: dir,
2762
- updated: dir
2763
- };
2764
- }
2765
- if (dir.deep) {
2766
- traverse(value);
2779
+ if (dir) {
2780
+ if (shared.isFunction(dir)) {
2781
+ dir = {
2782
+ mounted: dir,
2783
+ updated: dir
2784
+ };
2785
+ }
2786
+ if (dir.deep) {
2787
+ traverse(value);
2788
+ }
2789
+ bindings.push({
2790
+ dir,
2791
+ instance,
2792
+ value,
2793
+ oldValue: void 0,
2794
+ arg,
2795
+ modifiers
2796
+ });
2767
2797
  }
2768
- bindings.push({
2769
- dir,
2770
- instance,
2771
- value,
2772
- oldValue: void 0,
2773
- arg,
2774
- modifiers
2775
- });
2776
2798
  }
2777
2799
  return vnode;
2778
2800
  }
@@ -3985,7 +4007,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3985
4007
  if (validatePropName(normalizedKey)) {
3986
4008
  const opt = raw[key];
3987
4009
  const prop = (normalized[normalizedKey] =
3988
- shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : opt);
4010
+ shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : { ...opt });
3989
4011
  if (prop) {
3990
4012
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3991
4013
  const stringIndex = getTypeIndex(String, prop.type);
@@ -7326,6 +7348,9 @@ function getExposeProxy(instance) {
7326
7348
  else if (key in publicPropertiesMap) {
7327
7349
  return publicPropertiesMap[key](instance);
7328
7350
  }
7351
+ },
7352
+ has(target, key) {
7353
+ return key in target || key in publicPropertiesMap;
7329
7354
  }
7330
7355
  })));
7331
7356
  }
@@ -7783,7 +7808,7 @@ function isMemoSame(cached, memo) {
7783
7808
  }
7784
7809
 
7785
7810
  // Core API ------------------------------------------------------------------
7786
- const version = "3.2.41";
7811
+ const version = "3.2.42";
7787
7812
  const _ssrUtils = {
7788
7813
  createComponentInstance,
7789
7814
  setupComponent,
@@ -378,7 +378,7 @@ function emit(instance, event, ...rawArgs) {
378
378
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
379
379
  const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
380
380
  if (trim) {
381
- args = rawArgs.map(a => a.trim());
381
+ args = rawArgs.map(a => (shared.isString(a) ? a.trim() : a));
382
382
  }
383
383
  if (number) {
384
384
  args = rawArgs.map(shared.toNumber);
@@ -1270,7 +1270,8 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1270
1270
  };
1271
1271
  };
1272
1272
  // in SSR there is no need to setup an actual effect, and it should be noop
1273
- // unless it's eager
1273
+ // unless it's eager or sync flush
1274
+ let ssrCleanup;
1274
1275
  if (isInSSRComponentSetup) {
1275
1276
  // we will also not call the invalidate callback (+ runner is not set up)
1276
1277
  onCleanup = shared.NOOP;
@@ -1284,9 +1285,17 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1284
1285
  onCleanup
1285
1286
  ]);
1286
1287
  }
1287
- return shared.NOOP;
1288
+ if (flush === 'sync') {
1289
+ const ctx = useSSRContext();
1290
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1291
+ }
1292
+ else {
1293
+ return shared.NOOP;
1294
+ }
1288
1295
  }
1289
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
1296
+ let oldValue = isMultiSource
1297
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
1298
+ : INITIAL_WATCHER_VALUE;
1290
1299
  const job = () => {
1291
1300
  if (!effect.active) {
1292
1301
  return;
@@ -1307,7 +1316,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1307
1316
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1308
1317
  newValue,
1309
1318
  // pass undefined as the old value when it's changed for the first time
1310
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
1319
+ oldValue === INITIAL_WATCHER_VALUE ||
1320
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1321
+ ? undefined
1322
+ : oldValue,
1311
1323
  onCleanup
1312
1324
  ]);
1313
1325
  oldValue = newValue;
@@ -1351,12 +1363,15 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1351
1363
  else {
1352
1364
  effect.run();
1353
1365
  }
1354
- return () => {
1366
+ const unwatch = () => {
1355
1367
  effect.stop();
1356
1368
  if (instance && instance.scope) {
1357
1369
  shared.remove(instance.scope.effects, effect);
1358
1370
  }
1359
1371
  };
1372
+ if (ssrCleanup)
1373
+ ssrCleanup.push(unwatch);
1374
+ return unwatch;
1360
1375
  }
1361
1376
  // this.$watch
1362
1377
  function instanceWatch(source, value, options) {
@@ -1524,7 +1539,11 @@ const BaseTransitionImpl = {
1524
1539
  // return placeholder node and queue update when leave finishes
1525
1540
  leavingHooks.afterLeave = () => {
1526
1541
  state.isLeaving = false;
1527
- instance.update();
1542
+ // #6835
1543
+ // it also needs to be updated when active is undefined
1544
+ if (instance.update.active !== false) {
1545
+ instance.update();
1546
+ }
1528
1547
  };
1529
1548
  return emptyPlaceholder(child);
1530
1549
  }
@@ -2029,7 +2048,8 @@ const KeepAliveImpl = {
2029
2048
  : comp);
2030
2049
  const { include, exclude, max } = props;
2031
2050
  if ((include && (!name || !matches(include, name))) ||
2032
- (exclude && name && matches(exclude, name))) {
2051
+ (exclude && name && matches(exclude, name)) ||
2052
+ (false )) {
2033
2053
  current = vnode;
2034
2054
  return rawVNode;
2035
2055
  }
@@ -2226,23 +2246,25 @@ function withDirectives(vnode, directives) {
2226
2246
  const bindings = vnode.dirs || (vnode.dirs = []);
2227
2247
  for (let i = 0; i < directives.length; i++) {
2228
2248
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
2229
- if (shared.isFunction(dir)) {
2230
- dir = {
2231
- mounted: dir,
2232
- updated: dir
2233
- };
2234
- }
2235
- if (dir.deep) {
2236
- traverse(value);
2249
+ if (dir) {
2250
+ if (shared.isFunction(dir)) {
2251
+ dir = {
2252
+ mounted: dir,
2253
+ updated: dir
2254
+ };
2255
+ }
2256
+ if (dir.deep) {
2257
+ traverse(value);
2258
+ }
2259
+ bindings.push({
2260
+ dir,
2261
+ instance,
2262
+ value,
2263
+ oldValue: void 0,
2264
+ arg,
2265
+ modifiers
2266
+ });
2237
2267
  }
2238
- bindings.push({
2239
- dir,
2240
- instance,
2241
- value,
2242
- oldValue: void 0,
2243
- arg,
2244
- modifiers
2245
- });
2246
2268
  }
2247
2269
  return vnode;
2248
2270
  }
@@ -3218,7 +3240,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3218
3240
  if (validatePropName(normalizedKey)) {
3219
3241
  const opt = raw[key];
3220
3242
  const prop = (normalized[normalizedKey] =
3221
- shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : opt);
3243
+ shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : { ...opt });
3222
3244
  if (prop) {
3223
3245
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3224
3246
  const stringIndex = getTypeIndex(String, prop.type);
@@ -5951,6 +5973,9 @@ function getExposeProxy(instance) {
5951
5973
  else if (key in publicPropertiesMap) {
5952
5974
  return publicPropertiesMap[key](instance);
5953
5975
  }
5976
+ },
5977
+ has(target, key) {
5978
+ return key in target || key in publicPropertiesMap;
5954
5979
  }
5955
5980
  })));
5956
5981
  }
@@ -6197,7 +6222,7 @@ function isMemoSame(cached, memo) {
6197
6222
  }
6198
6223
 
6199
6224
  // Core API ------------------------------------------------------------------
6200
- const version = "3.2.41";
6225
+ const version = "3.2.42";
6201
6226
  const _ssrUtils = {
6202
6227
  createComponentInstance,
6203
6228
  setupComponent,
@@ -29,6 +29,7 @@ import { normalizeProps } from '@vue/shared';
29
29
  import { normalizeStyle } from '@vue/shared';
30
30
  import { onScopeDispose } from '@vue/reactivity';
31
31
  import { proxyRefs } from '@vue/reactivity';
32
+ import { Raw } from '@vue/reactivity';
32
33
  import { reactive } from '@vue/reactivity';
33
34
  import { ReactiveEffect } from '@vue/reactivity';
34
35
  import { ReactiveEffectOptions } from '@vue/reactivity';
@@ -101,7 +102,7 @@ export declare interface AppConfig {
101
102
  readonly isNativeTag?: (tag: string) => boolean;
102
103
  performance: boolean;
103
104
  optionMergeStrategies: Record<string, OptionMergeFunction>;
104
- globalProperties: Record<string, any>;
105
+ globalProperties: ComponentCustomProperties & Record<string, any>;
105
106
  errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
106
107
  warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
107
108
  /**
@@ -324,7 +325,7 @@ export declare interface ComponentCustomProperties {
324
325
  export declare interface ComponentCustomProps {
325
326
  }
326
327
 
327
- declare type ComponentInjectOptions = string[] | ObjectInjectOptions;
328
+ export declare type ComponentInjectOptions = string[] | ObjectInjectOptions;
328
329
 
329
330
  /**
330
331
  * We expose a subset of properties on the internal instance as they are
@@ -444,7 +445,7 @@ export declare type ComponentObjectPropsOptions<P = Data> = {
444
445
 
445
446
  export declare type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E> & ThisType<CreateComponentPublicInstance<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>>>;
446
447
 
447
- export declare interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}> extends LegacyOptions<Props, D, C, M, Mixin, Extends>, ComponentInternalOptions, ComponentCustomOptions {
448
+ export declare interface ComponentOptionsBase<Props, RawBindings, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>, ComponentInternalOptions, ComponentCustomOptions {
448
449
  setup?: (this: void, props: Readonly<LooseRequired<Props & UnionToIntersection<ExtractOptionProp<Mixin>> & UnionToIntersection<ExtractOptionProp<Extends>>>>, ctx: SetupContext<E>) => Promise<RawBindings> | RawBindings | RenderFunction | void;
449
450
  name?: string;
450
451
  template?: string | object;
@@ -469,19 +470,19 @@ export declare interface ComponentOptionsBase<Props, RawBindings, D, C extends C
469
470
 
470
471
  export declare type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>;
471
472
 
472
- export declare type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, Props = Readonly<{
473
+ export declare type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{
473
474
  [key in PropNames]?: any;
474
- }> & EmitsToProps<E>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}> & {
475
+ }> & EmitsToProps<E>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II> & {
475
476
  props: PropNames[];
476
- } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E>>;
477
+ } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I>>;
477
478
 
478
- export declare type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, Props = Readonly<ExtractPropTypes<PropsOptions>> & EmitsToProps<E>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults> & {
479
+ export declare type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<ExtractPropTypes<PropsOptions>> & EmitsToProps<E>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II> & {
479
480
  props: PropsOptions & ThisType<void>;
480
- } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false>>;
481
+ } & ThisType<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I>>;
481
482
 
482
- export declare type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, PE = Props & EmitsToProps<E>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}> & {
483
+ export declare type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, PE = Props & EmitsToProps<E>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II> & {
483
484
  props?: undefined;
484
- } & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E>>;
485
+ } & ThisType<CreateComponentPublicInstance<PE, RawBindings, D, C, M, Mixin, Extends, E, PE, {}, false, I>>;
485
486
 
486
487
  export declare type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
487
488
 
@@ -490,7 +491,7 @@ export declare type ComponentProvideOptions = ObjectProvideOptions | Function;
490
491
  export declare type ComponentPublicInstance<P = {}, // props type extracted from props option
491
492
  B = {}, // raw bindings returned from setup()
492
493
  D = {}, // return from data()
493
- C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>> = {
494
+ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}> = {
494
495
  $: ComponentInternalInstance;
495
496
  $data: D;
496
497
  $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps;
@@ -504,8 +505,8 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
504
505
  $options: Options & MergedComponentOptionsOverride;
505
506
  $forceUpdate: () => void;
506
507
  $nextTick: typeof nextTick;
507
- $watch(source: string | Function, cb: Function, options?: WatchOptions): WatchStopHandle;
508
- } & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties;
508
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
509
+ } & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
509
510
 
510
511
  declare type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props, RawBindings, D, C, M> = ComponentPublicInstance<any>, Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions> = {
511
512
  __isFragment?: never;
@@ -567,7 +568,7 @@ declare function createCompatVue(createApp: CreateAppFunction<Element>, createSi
567
568
 
568
569
  declare function createComponentInstance(vnode: VNode, parent: ComponentInternalInstance | null, suspense: SuspenseBoundary | null): ComponentInternalInstance;
569
570
 
570
- export declare type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults>>;
571
+ export declare type CreateComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, 'D'> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, 'C'> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, 'M'> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, 'Defaults'> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults>, I>;
571
572
 
572
573
  /**
573
574
  * @private
@@ -662,13 +663,13 @@ export declare type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D
662
663
 
663
664
  export declare function defineComponent<Props, RawBindings = object>(setup: (props: Readonly<Props>, ctx: SetupContext) => RawBindings | RenderFunction): DefineComponent<Props, RawBindings>;
664
665
 
665
- export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE>;
666
+ export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE>;
666
667
 
667
- export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE>): DefineComponent<Readonly<{
668
+ export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II>): DefineComponent<Readonly<{
668
669
  [key in PropNames]?: any;
669
670
  }>, RawBindings, D, C, M, Mixin, Extends, E, EE>;
670
671
 
671
- export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE>;
672
+ export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE>;
672
673
 
673
674
  /**
674
675
  * Vue `<script setup>` compiler macro for declaring a component's emitted
@@ -814,7 +815,7 @@ declare interface DevtoolsHook {
814
815
 
815
816
  export declare type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
816
817
 
817
- export declare type DirectiveArguments = Array<[Directive] | [Directive, any] | [Directive, any, string] | [Directive, any, string, DirectiveModifiers]>;
818
+ export declare type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string, DirectiveModifiers]>;
818
819
 
819
820
  export declare interface DirectiveBinding<V = any> {
820
821
  instance: ComponentPublicInstance | null;
@@ -954,7 +955,7 @@ export declare function h<P>(type: ConcreteComponent | string, children?: RawChi
954
955
 
955
956
  export declare function h<P>(type: ConcreteComponent<P> | string, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren): VNode;
956
957
 
957
- export declare function h(type: Component, props: null, children?: RawChildren | RawSlots): VNode;
958
+ export declare function h<P>(type: Component<P>, props?: (RawProps & P) | null, children?: RawChildren | RawSlots): VNode;
958
959
 
959
960
  export declare function h<P>(type: ComponentOptions<P>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
960
961
 
@@ -1015,6 +1016,12 @@ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T
1015
1016
  export declare interface InjectionKey<T> extends Symbol {
1016
1017
  }
1017
1018
 
1019
+ declare type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
1020
+ [K in T[number]]?: unknown;
1021
+ } : T extends ObjectInjectOptions ? {
1022
+ [K in keyof T]?: unknown;
1023
+ } : never;
1024
+
1018
1025
  /* Excluded from this release type: InternalRenderFunction */
1019
1026
 
1020
1027
  declare type InternalSlots = {
@@ -1083,7 +1090,7 @@ export declare type LegacyConfig = {
1083
1090
  productionTip?: boolean;
1084
1091
  };
1085
1092
 
1086
- declare interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin> {
1093
+ declare interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string> {
1087
1094
  compatConfig?: CompatConfig;
1088
1095
  [key: string]: any;
1089
1096
  data?: (this: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstance<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
@@ -1091,7 +1098,7 @@ declare interface LegacyOptions<Props, D, C extends ComputedOptions, M extends M
1091
1098
  methods?: M;
1092
1099
  watch?: ComponentWatchOptions;
1093
1100
  provide?: ComponentProvideOptions;
1094
- inject?: ComponentInjectOptions;
1101
+ inject?: I | II[];
1095
1102
  filters?: Record<string, Function>;
1096
1103
  mixins?: Mixin[];
1097
1104
  extends?: Extends;
@@ -1380,7 +1387,7 @@ declare interface PropOptions<T = any, D = T> {
1380
1387
  }
1381
1388
 
1382
1389
  declare type PropsWithDefaults<Base, Defaults> = Base & {
1383
- [K in keyof Defaults]: K extends keyof Base ? NotUndefined<Base[K]> : never;
1390
+ [K in keyof Defaults]: K extends keyof Base ? Defaults[K] extends undefined ? Base[K] : NotUndefined<Base[K]> : never;
1384
1391
  };
1385
1392
 
1386
1393
  export declare type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
@@ -1399,6 +1406,8 @@ export declare function pushScopeId(id: string | null): void;
1399
1406
 
1400
1407
  export declare function queuePostFlushCb(cb: SchedulerJobs): void;
1401
1408
 
1409
+ export { Raw }
1410
+
1402
1411
  declare type RawChildren = string | number | boolean | VNode | VNodeArrayChildren | (() => any);
1403
1412
 
1404
1413
  declare type RawProps = VNodeProps & {
@@ -1907,7 +1916,7 @@ export declare type VNodeProps = {
1907
1916
 
1908
1917
  export declare type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
1909
1918
 
1910
- export declare type VNodeTypes = string | VNode | Component | typeof Text_2 | typeof Static | typeof Comment_2 | typeof Fragment | typeof TeleportImpl | typeof SuspenseImpl;
1919
+ export declare type VNodeTypes = string | VNode | Component | typeof Text_2 | typeof Static | typeof Comment_2 | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
1911
1920
 
1912
1921
  declare type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
1913
1922
 
@@ -686,7 +686,7 @@ function emit$1(instance, event, ...rawArgs) {
686
686
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
687
687
  const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
688
688
  if (trim) {
689
- args = rawArgs.map(a => a.trim());
689
+ args = rawArgs.map(a => (isString(a) ? a.trim() : a));
690
690
  }
691
691
  if (number) {
692
692
  args = rawArgs.map(toNumber);
@@ -1752,7 +1752,8 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1752
1752
  };
1753
1753
  };
1754
1754
  // in SSR there is no need to setup an actual effect, and it should be noop
1755
- // unless it's eager
1755
+ // unless it's eager or sync flush
1756
+ let ssrCleanup;
1756
1757
  if (isInSSRComponentSetup) {
1757
1758
  // we will also not call the invalidate callback (+ runner is not set up)
1758
1759
  onCleanup = NOOP;
@@ -1766,9 +1767,17 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1766
1767
  onCleanup
1767
1768
  ]);
1768
1769
  }
1769
- return NOOP;
1770
+ if (flush === 'sync') {
1771
+ const ctx = useSSRContext();
1772
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1773
+ }
1774
+ else {
1775
+ return NOOP;
1776
+ }
1770
1777
  }
1771
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
1778
+ let oldValue = isMultiSource
1779
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
1780
+ : INITIAL_WATCHER_VALUE;
1772
1781
  const job = () => {
1773
1782
  if (!effect.active) {
1774
1783
  return;
@@ -1789,7 +1798,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1789
1798
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1790
1799
  newValue,
1791
1800
  // pass undefined as the old value when it's changed for the first time
1792
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
1801
+ oldValue === INITIAL_WATCHER_VALUE ||
1802
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1803
+ ? undefined
1804
+ : oldValue,
1793
1805
  onCleanup
1794
1806
  ]);
1795
1807
  oldValue = newValue;
@@ -1837,12 +1849,15 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1837
1849
  else {
1838
1850
  effect.run();
1839
1851
  }
1840
- return () => {
1852
+ const unwatch = () => {
1841
1853
  effect.stop();
1842
1854
  if (instance && instance.scope) {
1843
1855
  remove(instance.scope.effects, effect);
1844
1856
  }
1845
1857
  };
1858
+ if (ssrCleanup)
1859
+ ssrCleanup.push(unwatch);
1860
+ return unwatch;
1846
1861
  }
1847
1862
  // this.$watch
1848
1863
  function instanceWatch(source, value, options) {
@@ -2027,7 +2042,11 @@ const BaseTransitionImpl = {
2027
2042
  // return placeholder node and queue update when leave finishes
2028
2043
  leavingHooks.afterLeave = () => {
2029
2044
  state.isLeaving = false;
2030
- instance.update();
2045
+ // #6835
2046
+ // it also needs to be updated when active is undefined
2047
+ if (instance.update.active !== false) {
2048
+ instance.update();
2049
+ }
2031
2050
  };
2032
2051
  return emptyPlaceholder(child);
2033
2052
  }
@@ -2553,7 +2572,8 @@ const KeepAliveImpl = {
2553
2572
  : comp);
2554
2573
  const { include, exclude, max } = props;
2555
2574
  if ((include && (!name || !matches(include, name))) ||
2556
- (exclude && name && matches(exclude, name))) {
2575
+ (exclude && name && matches(exclude, name)) ||
2576
+ ((process.env.NODE_ENV !== 'production') && hmrDirtyComponents.has(comp))) {
2557
2577
  current = vnode;
2558
2578
  return rawVNode;
2559
2579
  }
@@ -2765,23 +2785,25 @@ function withDirectives(vnode, directives) {
2765
2785
  const bindings = vnode.dirs || (vnode.dirs = []);
2766
2786
  for (let i = 0; i < directives.length; i++) {
2767
2787
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2768
- if (isFunction(dir)) {
2769
- dir = {
2770
- mounted: dir,
2771
- updated: dir
2772
- };
2773
- }
2774
- if (dir.deep) {
2775
- traverse(value);
2788
+ if (dir) {
2789
+ if (isFunction(dir)) {
2790
+ dir = {
2791
+ mounted: dir,
2792
+ updated: dir
2793
+ };
2794
+ }
2795
+ if (dir.deep) {
2796
+ traverse(value);
2797
+ }
2798
+ bindings.push({
2799
+ dir,
2800
+ instance,
2801
+ value,
2802
+ oldValue: void 0,
2803
+ arg,
2804
+ modifiers
2805
+ });
2776
2806
  }
2777
- bindings.push({
2778
- dir,
2779
- instance,
2780
- value,
2781
- oldValue: void 0,
2782
- arg,
2783
- modifiers
2784
- });
2785
2807
  }
2786
2808
  return vnode;
2787
2809
  }
@@ -4003,7 +4025,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4003
4025
  if (validatePropName(normalizedKey)) {
4004
4026
  const opt = raw[key];
4005
4027
  const prop = (normalized[normalizedKey] =
4006
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
4028
+ isArray(opt) || isFunction(opt) ? { type: opt } : Object.assign({}, opt));
4007
4029
  if (prop) {
4008
4030
  const booleanIndex = getTypeIndex(Boolean, prop.type);
4009
4031
  const stringIndex = getTypeIndex(String, prop.type);
@@ -7412,6 +7434,9 @@ function getExposeProxy(instance) {
7412
7434
  else if (key in publicPropertiesMap) {
7413
7435
  return publicPropertiesMap[key](instance);
7414
7436
  }
7437
+ },
7438
+ has(target, key) {
7439
+ return key in target || key in publicPropertiesMap;
7415
7440
  }
7416
7441
  })));
7417
7442
  }
@@ -7869,7 +7894,7 @@ function isMemoSame(cached, memo) {
7869
7894
  }
7870
7895
 
7871
7896
  // Core API ------------------------------------------------------------------
7872
- const version = "3.2.41";
7897
+ const version = "3.2.42";
7873
7898
  const _ssrUtils = {
7874
7899
  createComponentInstance,
7875
7900
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.2.41",
3
+ "version": "3.2.42",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.41",
36
- "@vue/reactivity": "3.2.41"
35
+ "@vue/shared": "3.2.42",
36
+ "@vue/reactivity": "3.2.42"
37
37
  }
38
38
  }