@vue/runtime-core 3.3.0-beta.3 → 3.3.0-beta.5

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.
@@ -1135,7 +1135,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1135
1135
  );
1136
1136
  setActiveBranch(suspense, vnode.ssFallback);
1137
1137
  } else {
1138
- suspense.resolve();
1138
+ suspense.resolve(false, true);
1139
1139
  }
1140
1140
  }
1141
1141
  function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
@@ -1294,7 +1294,6 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1294
1294
  }
1295
1295
  let hasWarned = false;
1296
1296
  function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1297
- var _a;
1298
1297
  if (!hasWarned) {
1299
1298
  hasWarned = true;
1300
1299
  console[console.info ? "info" : "log"](
@@ -1309,10 +1308,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1309
1308
  o: { parentNode, remove }
1310
1309
  } = rendererInternals;
1311
1310
  let parentSuspenseId;
1312
- const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
1311
+ const isSuspensible = isVNodeSuspensible(vnode);
1313
1312
  if (isSuspensible) {
1314
1313
  if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
1315
- parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
1314
+ parentSuspenseId = parentSuspense.pendingId;
1316
1315
  parentSuspense.deps++;
1317
1316
  }
1318
1317
  }
@@ -1337,7 +1336,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1337
1336
  isHydrating,
1338
1337
  isUnmounted: false,
1339
1338
  effects: [],
1340
- resolve(resume = false) {
1339
+ resolve(resume = false, sync = false) {
1341
1340
  {
1342
1341
  if (!resume && !suspense.pendingBranch) {
1343
1342
  throw new Error(
@@ -1399,7 +1398,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1399
1398
  if (isSuspensible) {
1400
1399
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
1401
1400
  parentSuspense.deps--;
1402
- if (parentSuspense.deps === 0) {
1401
+ if (parentSuspense.deps === 0 && !sync) {
1403
1402
  parentSuspense.resolve();
1404
1403
  }
1405
1404
  }
@@ -1609,6 +1608,10 @@ function setActiveBranch(suspense, branch) {
1609
1608
  updateHOCHostEl(parentComponent, el);
1610
1609
  }
1611
1610
  }
1611
+ function isVNodeSuspensible(vnode) {
1612
+ var _a;
1613
+ return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
1614
+ }
1612
1615
 
1613
1616
  function watchEffect(effect, options) {
1614
1617
  return doWatch(effect, null, options);
@@ -2240,7 +2243,11 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2240
2243
  }
2241
2244
 
2242
2245
  function defineComponent(options, extraOptions) {
2243
- return shared.isFunction(options) ? shared.extend({}, extraOptions, { setup: options, name: options.name }) : options;
2246
+ return shared.isFunction(options) ? (
2247
+ // #8326: extend call and options.name access are considered side-effects
2248
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2249
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
2250
+ ) : options;
2244
2251
  }
2245
2252
 
2246
2253
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -6717,6 +6724,9 @@ const normalizeRef = ({
6717
6724
  ref_key,
6718
6725
  ref_for
6719
6726
  }) => {
6727
+ if (typeof ref === "number") {
6728
+ ref = "" + ref;
6729
+ }
6720
6730
  return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6721
6731
  };
6722
6732
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
@@ -7654,7 +7664,7 @@ function isMemoSame(cached, memo) {
7654
7664
  return true;
7655
7665
  }
7656
7666
 
7657
- const version = "3.3.0-beta.3";
7667
+ const version = "3.3.0-beta.5";
7658
7668
  const _ssrUtils = {
7659
7669
  createComponentInstance,
7660
7670
  setupComponent,
@@ -653,7 +653,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
653
653
  );
654
654
  setActiveBranch(suspense, vnode.ssFallback);
655
655
  } else {
656
- suspense.resolve();
656
+ suspense.resolve(false, true);
657
657
  }
658
658
  }
659
659
  function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
@@ -811,7 +811,6 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
811
811
  }
812
812
  }
813
813
  function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
814
- var _a;
815
814
  const {
816
815
  p: patch,
817
816
  m: move,
@@ -820,10 +819,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
820
819
  o: { parentNode, remove }
821
820
  } = rendererInternals;
822
821
  let parentSuspenseId;
823
- const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
822
+ const isSuspensible = isVNodeSuspensible(vnode);
824
823
  if (isSuspensible) {
825
824
  if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
826
- parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
825
+ parentSuspenseId = parentSuspense.pendingId;
827
826
  parentSuspense.deps++;
828
827
  }
829
828
  }
@@ -845,7 +844,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
845
844
  isHydrating,
846
845
  isUnmounted: false,
847
846
  effects: [],
848
- resolve(resume = false) {
847
+ resolve(resume = false, sync = false) {
849
848
  const {
850
849
  vnode: vnode2,
851
850
  activeBranch,
@@ -895,7 +894,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
895
894
  if (isSuspensible) {
896
895
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
897
896
  parentSuspense.deps--;
898
- if (parentSuspense.deps === 0) {
897
+ if (parentSuspense.deps === 0 && !sync) {
899
898
  parentSuspense.resolve();
900
899
  }
901
900
  }
@@ -1096,6 +1095,10 @@ function setActiveBranch(suspense, branch) {
1096
1095
  updateHOCHostEl(parentComponent, el);
1097
1096
  }
1098
1097
  }
1098
+ function isVNodeSuspensible(vnode) {
1099
+ var _a;
1100
+ return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
1101
+ }
1099
1102
 
1100
1103
  function watchEffect(effect, options) {
1101
1104
  return doWatch(effect, null, options);
@@ -1680,7 +1683,11 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1680
1683
  }
1681
1684
 
1682
1685
  function defineComponent(options, extraOptions) {
1683
- return shared.isFunction(options) ? shared.extend({}, extraOptions, { setup: options, name: options.name }) : options;
1686
+ return shared.isFunction(options) ? (
1687
+ // #8326: extend call and options.name access are considered side-effects
1688
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1689
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1690
+ ) : options;
1684
1691
  }
1685
1692
 
1686
1693
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -5406,6 +5413,9 @@ const normalizeRef = ({
5406
5413
  ref_key,
5407
5414
  ref_for
5408
5415
  }) => {
5416
+ if (typeof ref === "number") {
5417
+ ref = "" + ref;
5418
+ }
5409
5419
  return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
5410
5420
  };
5411
5421
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
@@ -6005,7 +6015,7 @@ function isMemoSame(cached, memo) {
6005
6015
  return true;
6006
6016
  }
6007
6017
 
6008
- const version = "3.3.0-beta.3";
6018
+ const version = "3.3.0-beta.5";
6009
6019
  const _ssrUtils = {
6010
6020
  createComponentInstance,
6011
6021
  setupComponent,
@@ -14,7 +14,8 @@ declare const SlotSymbol: unique symbol;
14
14
  export type SlotsType<T extends Record<string, any> = Record<string, any>> = {
15
15
  [SlotSymbol]?: T;
16
16
  };
17
- type TypedSlots<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
17
+ type StrictUnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<T>;
18
+ type UnwrapSlotsType<S extends SlotsType, T = NonNullable<S[typeof SlotSymbol]>> = [keyof S] extends [never] ? Slots : Readonly<Prettify<{
18
19
  [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : Slot<T[K]>;
19
20
  }>>;
20
21
  type RawSlots = {
@@ -118,7 +119,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
118
119
  $props: Prettify<MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps>;
119
120
  $attrs: Data;
120
121
  $refs: Data;
121
- $slots: TypedSlots<S>;
122
+ $slots: UnwrapSlotsType<S>;
122
123
  $root: ComponentPublicInstance | null;
123
124
  $parent: ComponentPublicInstance | null;
124
125
  $emit: EmitFn<E>;
@@ -169,6 +170,10 @@ declare const SuspenseImpl: {
169
170
  export declare const Suspense: {
170
171
  new (): {
171
172
  $props: VNodeProps & SuspenseProps;
173
+ $slots: {
174
+ default(): VNode[];
175
+ fallback(): VNode[];
176
+ };
172
177
  };
173
178
  __isSuspense: true;
174
179
  };
@@ -189,7 +194,7 @@ export interface SuspenseBoundary {
189
194
  isHydrating: boolean;
190
195
  isUnmounted: boolean;
191
196
  effects: Function[];
192
- resolve(force?: boolean): void;
197
+ resolve(force?: boolean, sync?: boolean): void;
193
198
  fallback(fallbackVNode: VNode): void;
194
199
  move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
195
200
  next(): RendererNode | null;
@@ -291,6 +296,9 @@ export interface KeepAliveProps {
291
296
  export declare const KeepAlive: {
292
297
  new (): {
293
298
  $props: VNodeProps & KeepAliveProps;
299
+ $slots: {
300
+ default(): VNode[];
301
+ };
294
302
  };
295
303
  __isKeepAlive: true;
296
304
  };
@@ -370,11 +378,36 @@ type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
370
378
  }] ? Date : [T] extends [(infer U)[] | {
371
379
  type: (infer U)[];
372
380
  }] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
381
+ /**
382
+ * Extract prop types from a runtime props options object.
383
+ * The extracted types are **internal** - i.e. the resolved props received by
384
+ * the component.
385
+ * - Boolean props are always present
386
+ * - Props with default values are always present
387
+ *
388
+ * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
389
+ */
373
390
  export type ExtractPropTypes<O> = {
374
391
  [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
375
392
  } & {
376
393
  [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
377
394
  };
395
+ type PublicRequiredKeys<T> = {
396
+ [K in keyof T]: T[K] extends {
397
+ required: true;
398
+ } ? K : never;
399
+ }[keyof T];
400
+ type PublicOptionalKeys<T> = Exclude<keyof T, PublicRequiredKeys<T>>;
401
+ /**
402
+ * Extract prop types from a runtime props options object.
403
+ * The extracted types are **public** - i.e. the expected props that can be
404
+ * passed to component.
405
+ */
406
+ export type ExtractPublicPropTypes<O> = {
407
+ [K in keyof Pick<O, PublicRequiredKeys<O>>]: InferPropType<O[K]>;
408
+ } & {
409
+ [K in keyof Pick<O, PublicOptionalKeys<O>>]?: InferPropType<O[K]>;
410
+ };
378
411
  declare const enum BooleanFlags {
379
412
  shouldCast = 0,
380
413
  shouldCastTrue = 1
@@ -662,7 +695,7 @@ type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M e
662
695
 
663
696
  export interface InjectionKey<T> extends Symbol {
664
697
  }
665
- export declare function provide<T extends InjectionKey<any>>(key: T | string | number, value: T extends InjectionKey<infer V> ? V : any): void;
698
+ export declare function provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): void;
666
699
  export declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
667
700
  export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
668
701
  export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory: true): T;
@@ -805,6 +838,9 @@ export declare const BaseTransitionPropsValidators: {
805
838
  };
806
839
  export declare const BaseTransition: new () => {
807
840
  $props: BaseTransitionProps<any>;
841
+ $slots: {
842
+ default(): VNode[];
843
+ };
808
844
  };
809
845
  export declare function resolveTransitionHooks(vnode: VNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance): TransitionHooks;
810
846
  export declare function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void;
@@ -832,6 +868,9 @@ declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentCompone
832
868
  export declare const Teleport: {
833
869
  new (): {
834
870
  $props: VNodeProps & TeleportProps;
871
+ $slots: {
872
+ default(): VNode[];
873
+ };
835
874
  };
836
875
  __isTeleport: true;
837
876
  };
@@ -1063,7 +1102,7 @@ export type Component<Props = any, RawBindings = any, D = any, C extends Compute
1063
1102
  type LifecycleHook<TFn = Function> = TFn[] | null;
1064
1103
  export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
1065
1104
  attrs: Data;
1066
- slots: TypedSlots<S>;
1105
+ slots: UnwrapSlotsType<S>;
1067
1106
  emit: EmitFn<E>;
1068
1107
  expose: (exposed?: Record<string, any>) => void;
1069
1108
  } : never;
@@ -1322,7 +1361,7 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
1322
1361
  expose?: undefined;
1323
1362
  slots?: undefined;
1324
1363
  }): void;
1325
- export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): TypedSlots<SlotsType<S>>;
1364
+ export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
1326
1365
  /**
1327
1366
  * (**Experimental**) Vue `<script setup>` compiler macro for declaring a
1328
1367
  * two-way binding prop that can be consumed via `v-model` from the parent
@@ -1139,7 +1139,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1139
1139
  );
1140
1140
  setActiveBranch(suspense, vnode.ssFallback);
1141
1141
  } else {
1142
- suspense.resolve();
1142
+ suspense.resolve(false, true);
1143
1143
  }
1144
1144
  }
1145
1145
  function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
@@ -1298,7 +1298,6 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1298
1298
  }
1299
1299
  let hasWarned = false;
1300
1300
  function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1301
- var _a;
1302
1301
  if (process.env.NODE_ENV !== "production" && true && !hasWarned) {
1303
1302
  hasWarned = true;
1304
1303
  console[console.info ? "info" : "log"](
@@ -1313,10 +1312,10 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1313
1312
  o: { parentNode, remove }
1314
1313
  } = rendererInternals;
1315
1314
  let parentSuspenseId;
1316
- const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
1315
+ const isSuspensible = isVNodeSuspensible(vnode);
1317
1316
  if (isSuspensible) {
1318
1317
  if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
1319
- parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
1318
+ parentSuspenseId = parentSuspense.pendingId;
1320
1319
  parentSuspense.deps++;
1321
1320
  }
1322
1321
  }
@@ -1341,7 +1340,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1341
1340
  isHydrating,
1342
1341
  isUnmounted: false,
1343
1342
  effects: [],
1344
- resolve(resume = false) {
1343
+ resolve(resume = false, sync = false) {
1345
1344
  if (process.env.NODE_ENV !== "production") {
1346
1345
  if (!resume && !suspense.pendingBranch) {
1347
1346
  throw new Error(
@@ -1403,7 +1402,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1403
1402
  if (isSuspensible) {
1404
1403
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
1405
1404
  parentSuspense.deps--;
1406
- if (parentSuspense.deps === 0) {
1405
+ if (parentSuspense.deps === 0 && !sync) {
1407
1406
  parentSuspense.resolve();
1408
1407
  }
1409
1408
  }
@@ -1613,6 +1612,10 @@ function setActiveBranch(suspense, branch) {
1613
1612
  updateHOCHostEl(parentComponent, el);
1614
1613
  }
1615
1614
  }
1615
+ function isVNodeSuspensible(vnode) {
1616
+ var _a;
1617
+ return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
1618
+ }
1616
1619
 
1617
1620
  function watchEffect(effect, options) {
1618
1621
  return doWatch(effect, null, options);
@@ -2246,7 +2249,11 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2246
2249
  }
2247
2250
 
2248
2251
  function defineComponent(options, extraOptions) {
2249
- return isFunction(options) ? extend({}, extraOptions, { setup: options, name: options.name }) : options;
2252
+ return isFunction(options) ? (
2253
+ // #8326: extend call and options.name access are considered side-effects
2254
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2255
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
2256
+ ) : options;
2250
2257
  }
2251
2258
 
2252
2259
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
@@ -6761,6 +6768,9 @@ const normalizeRef = ({
6761
6768
  ref_key,
6762
6769
  ref_for
6763
6770
  }) => {
6771
+ if (typeof ref === "number") {
6772
+ ref = "" + ref;
6773
+ }
6764
6774
  return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6765
6775
  };
6766
6776
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
@@ -7714,7 +7724,7 @@ function isMemoSame(cached, memo) {
7714
7724
  return true;
7715
7725
  }
7716
7726
 
7717
- const version = "3.3.0-beta.3";
7727
+ const version = "3.3.0-beta.5";
7718
7728
  const _ssrUtils = {
7719
7729
  createComponentInstance,
7720
7730
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.3.0-beta.3",
3
+ "version": "3.3.0-beta.5",
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.3.0-beta.3",
36
- "@vue/reactivity": "3.3.0-beta.3"
35
+ "@vue/shared": "3.3.0-beta.5",
36
+ "@vue/reactivity": "3.3.0-beta.5"
37
37
  }
38
38
  }