@storybook/web-components 10.6.0-alpha.0 → 10.6.0-alpha.1

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.
package/dist/index.d.ts CHANGED
@@ -1,46 +1,48 @@
1
- import { WebRenderer, Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Renderer, ArgsStoryFn } from 'storybook/internal/types';
2
- export { ArgTypes, Args, Parameters, StrictArgs } from 'storybook/internal/types';
3
- import { TemplateResult, SVGTemplateResult } from 'lit';
4
- import { PreviewAddon, InferTypes, AddonTypes, Preview as Preview$1, Meta as Meta$1, Story } from 'storybook/internal/csf';
1
+ import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ArgsStoryFn, ComponentAnnotations, DecoratorFunction, LoaderFunction, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Parameters as Parameters$1, ProjectAnnotations, Renderer, StoryAnnotations, StoryContext as StoryContext$1, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
2
+ import { SVGTemplateResult, TemplateResult } from "lit";
3
+ import { AddonTypes, InferTypes, Meta as Meta$1, Preview as Preview$1, PreviewAddon, Story } from "storybook/internal/csf";
5
4
 
5
+ //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/types.d.ts
6
6
  type StoryFnHtmlReturnType = string | Node | DocumentFragment | TemplateResult | SVGTemplateResult;
7
7
  interface WebComponentsRenderer extends WebRenderer {
8
- component: string;
9
- storyResult: StoryFnHtmlReturnType;
8
+ component: string;
9
+ storyResult: StoryFnHtmlReturnType;
10
10
  }
11
- interface WebComponentsTypes extends WebComponentsRenderer {
12
- }
13
-
11
+ interface WebComponentsTypes extends WebComponentsRenderer {}
12
+ //#endregion
13
+ //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/public-types.d.ts
14
14
  /**
15
15
  * Metadata to configure the stories for a component.
16
16
  *
17
17
  * @see [Default export](https://storybook.js.org/docs/api/csf#default-export)
18
18
  */
19
- type Meta<TArgs = Args> = ComponentAnnotations<WebComponentsRenderer, TArgs>;
19
+ type Meta<TArgs = Args$1> = ComponentAnnotations<WebComponentsRenderer, TArgs>;
20
20
  /**
21
21
  * Story function that represents a CSFv2 component example.
22
22
  *
23
23
  * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
24
24
  */
25
- type StoryFn<TArgs = Args> = AnnotatedStoryFn<WebComponentsRenderer, TArgs>;
25
+ type StoryFn<TArgs = Args$1> = AnnotatedStoryFn<WebComponentsRenderer, TArgs>;
26
26
  /**
27
27
  * Story object that represents a CSFv3 component example.
28
28
  *
29
29
  * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
30
30
  */
31
- type StoryObj<TArgs = Args> = StoryAnnotations<WebComponentsRenderer, TArgs>;
32
- type Decorator<TArgs = StrictArgs> = DecoratorFunction<WebComponentsRenderer, TArgs>;
33
- type Loader<TArgs = StrictArgs> = LoaderFunction<WebComponentsRenderer, TArgs>;
34
- type StoryContext<TArgs = StrictArgs> = StoryContext$1<WebComponentsRenderer, TArgs>;
31
+ type StoryObj<TArgs = Args$1> = StoryAnnotations<WebComponentsRenderer, TArgs>;
32
+ type Decorator<TArgs = StrictArgs$1> = DecoratorFunction<WebComponentsRenderer, TArgs>;
33
+ type Loader<TArgs = StrictArgs$1> = LoaderFunction<WebComponentsRenderer, TArgs>;
34
+ type StoryContext<TArgs = StrictArgs$1> = StoryContext$1<WebComponentsRenderer, TArgs>;
35
35
  type Preview = ProjectAnnotations<WebComponentsRenderer>;
36
-
36
+ //#endregion
37
+ //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/framework-api.d.ts
37
38
  declare function isValidComponent(tagName: string): boolean;
38
39
  declare function isValidMetaData(customElements: any): boolean;
39
40
  /** @param customElements `any` for now as spec is not super stable yet */
40
41
  declare function setCustomElements(customElements: any): void;
41
42
  declare function setCustomElementsManifest(customElements: any): void;
42
43
  declare function getCustomElements(): any;
43
-
44
+ //#endregion
45
+ //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/portable-stories.d.ts
44
46
  /**
45
47
  * Function that sets the globalConfig of your storybook. The global config is the preview module of
46
48
  * your .storybook folder.
@@ -61,7 +63,8 @@ declare function getCustomElements(): any;
61
63
  * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
62
64
  */
63
65
  declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<WebComponentsRenderer>;
64
-
66
+ //#endregion
67
+ //#region node_modules/type-fest/source/union-to-intersection.d.ts
65
68
  /**
66
69
  Convert a union type to an intersection type.
67
70
 
@@ -79,23 +82,18 @@ type Intersection = UnionToIntersection<Union>;
79
82
 
80
83
  @category Type
81
84
  */
82
- type UnionToIntersection<Union> = (
83
- // `extends unknown` is always going to be the case and is used to convert the
84
- // `Union` into a [distributive conditional
85
- // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
86
- Union extends unknown
87
- // The union type is used as the only argument to a function since the union
88
- // of function arguments is an intersection.
89
- ? (distributedUnion: Union) => void
90
- // This won't happen.
91
- : never
92
- // Infer the `Intersection` type since TypeScript represents the positional
93
- // arguments of unions of functions as an intersection of the union.
94
- ) extends ((mergedIntersection: infer Intersection) => void)
95
- // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
96
- ? Intersection & Union
97
- : never;
98
-
85
+ type UnionToIntersection<Union> = (// `extends unknown` is always going to be the case and is used to convert the
86
+ // `Union` into a [distributive conditional
87
+ // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
88
+ Union extends unknown // The union type is used as the only argument to a function since the union
89
+ // of function arguments is an intersection.
90
+ ? (distributedUnion: Union) => void // This won't happen.
91
+ : never // Infer the `Intersection` type since TypeScript represents the positional
92
+ // arguments of unions of functions as an intersection of the union.
93
+ ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
94
+ ? Intersection & Union : never;
95
+ //#endregion
96
+ //#region node_modules/type-fest/source/keys-of-union.d.ts
99
97
  /**
100
98
  Create a union of all keys from a given type, even those exclusive to specific union members.
101
99
 
@@ -133,10 +131,10 @@ type AllKeys = KeysOfUnion<Union>;
133
131
 
134
132
  @category Object
135
133
  */
136
- type KeysOfUnion<ObjectType> =
137
- // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
138
- keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
139
-
134
+ type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
135
+ keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
136
+ //#endregion
137
+ //#region node_modules/type-fest/source/is-any.d.ts
140
138
  /**
141
139
  Returns a boolean for whether the given type is `any`.
142
140
 
@@ -166,7 +164,8 @@ const anyA = get(anyObject, 'a');
166
164
  @category Utilities
167
165
  */
168
166
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
169
-
167
+ //#endregion
168
+ //#region node_modules/type-fest/source/is-optional-key-of.d.ts
170
169
  /**
171
170
  Returns a boolean for whether the given key is an optional key of type.
172
171
 
@@ -207,14 +206,9 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
207
206
  @category Type Guard
208
207
  @category Utilities
209
208
  */
210
- type IsOptionalKeyOf<Type extends object, Key extends keyof Type> =
211
- IsAny<Type | Key> extends true ? never
212
- : Key extends keyof Type
213
- ? Type extends Record<Key, Type[Key]>
214
- ? false
215
- : true
216
- : false;
217
-
209
+ type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
210
+ //#endregion
211
+ //#region node_modules/type-fest/source/optional-keys-of.d.ts
218
212
  /**
219
213
  Extract all optional keys from the given type.
220
214
 
@@ -248,16 +242,11 @@ const update2: UpdateOperation<User> = {
248
242
 
249
243
  @category Utilities
250
244
  */
251
- type OptionalKeysOf<Type extends object> =
252
- Type extends unknown // For distributing `Type`
253
- ? (keyof {[Key in keyof Type as
254
- IsOptionalKeyOf<Type, Key> extends false
255
- ? never
256
- : Key
257
- ]: never
258
- }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
259
- : never; // Should never happen
260
-
245
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
246
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
247
+ : never;
248
+ //#endregion
249
+ //#region node_modules/type-fest/source/required-keys-of.d.ts
261
250
  /**
262
251
  Extract all required keys from the given type.
263
252
 
@@ -288,11 +277,10 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
288
277
 
289
278
  @category Utilities
290
279
  */
291
- type RequiredKeysOf<Type extends object> =
292
- Type extends unknown // For distributing `Type`
293
- ? Exclude<keyof Type, OptionalKeysOf<Type>>
294
- : never; // Should never happen
295
-
280
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
281
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
282
+ //#endregion
283
+ //#region node_modules/type-fest/source/is-never.d.ts
296
284
  /**
297
285
  Returns a boolean for whether the given type is `never`.
298
286
 
@@ -347,7 +335,8 @@ type B = IsTrueFixed<never>;
347
335
  @category Utilities
348
336
  */
349
337
  type IsNever<T> = [T] extends [never] ? true : false;
350
-
338
+ //#endregion
339
+ //#region node_modules/type-fest/source/if.d.ts
351
340
  /**
352
341
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
353
342
 
@@ -440,13 +429,9 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
440
429
  @category Type Guard
441
430
  @category Utilities
442
431
  */
443
- type If<Type extends boolean, IfBranch, ElseBranch> =
444
- IsNever<Type> extends true
445
- ? ElseBranch
446
- : Type extends true
447
- ? IfBranch
448
- : ElseBranch;
449
-
432
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
433
+ //#endregion
434
+ //#region node_modules/type-fest/source/simplify.d.ts
450
435
  /**
451
436
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
452
437
 
@@ -505,8 +490,9 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
505
490
  @see {@link SimplifyDeep}
506
491
  @category Object
507
492
  */
508
- type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
509
-
493
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
494
+ //#endregion
495
+ //#region node_modules/type-fest/source/is-equal.d.ts
510
496
  /**
511
497
  Returns a boolean for whether the two given types are equal.
512
498
 
@@ -533,20 +519,11 @@ type Includes<Value extends readonly any[], Item> =
533
519
  @category Type Guard
534
520
  @category Utilities
535
521
  */
536
- type IsEqual<A, B> =
537
- [A] extends [B]
538
- ? [B] extends [A]
539
- ? _IsEqual<A, B>
540
- : false
541
- : false;
542
-
522
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
543
523
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
544
- type _IsEqual<A, B> =
545
- (<G>() => G extends A & G | G ? 1 : 2) extends
546
- (<G>() => G extends B & G | G ? 1 : 2)
547
- ? true
548
- : false;
549
-
524
+ type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
525
+ //#endregion
526
+ //#region node_modules/type-fest/source/omit-index-signature.d.ts
550
527
  /**
551
528
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
552
529
 
@@ -638,12 +615,9 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
638
615
  @see {@link PickIndexSignature}
639
616
  @category Object
640
617
  */
641
- type OmitIndexSignature<ObjectType> = {
642
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
643
- ? never
644
- : KeyType]: ObjectType[KeyType];
645
- };
646
-
618
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
619
+ //#endregion
620
+ //#region node_modules/type-fest/source/pick-index-signature.d.ts
647
621
  /**
648
622
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
649
623
 
@@ -689,17 +663,11 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
689
663
  @see {@link OmitIndexSignature}
690
664
  @category Object
691
665
  */
692
- type PickIndexSignature<ObjectType> = {
693
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
694
- ? KeyType
695
- : never]: ObjectType[KeyType];
696
- };
697
-
666
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
667
+ //#endregion
668
+ //#region node_modules/type-fest/source/merge.d.ts
698
669
  // Merges two objects without worrying about index signatures.
699
- type SimpleMerge<Destination, Source> = Simplify<{
700
- [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
701
- } & Source>;
702
-
670
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
703
671
  /**
704
672
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
705
673
 
@@ -762,19 +730,14 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
762
730
  @see {@link ObjectMerge}
763
731
  @category Object
764
732
  */
765
- type Merge<Destination, Source> =
766
- Destination extends unknown // For distributing `Destination`
767
- ? Source extends unknown // For distributing `Source`
768
- ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>>
769
- : never // Should never happen
770
- : never; // Should never happen
771
-
772
- type _Merge<Destination, Source> =
773
- Simplify<
774
- SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
775
- & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
776
- >;
777
-
733
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
734
+ ? Source extends unknown // For distributing `Source`
735
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
736
+ : never;
737
+ // Should never happen
738
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
739
+ //#endregion
740
+ //#region node_modules/type-fest/source/internal/object.d.ts
778
741
  /**
779
742
  Works similar to the built-in `Pick` utility type, except for the following differences:
780
743
  - Distributes over union types and allows picking keys from any member of the union type.
@@ -812,10 +775,7 @@ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
812
775
  type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
813
776
  //=> {}
814
777
  */
815
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = {
816
- [P in keyof T as Extract<P, Keys>]: T[P]
817
- };
818
-
778
+ type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
819
779
  /**
820
780
  Merges user specified options with default options.
821
781
 
@@ -868,19 +828,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
868
828
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
869
829
  ```
870
830
  */
871
- type ApplyDefaultOptions<
872
- Options extends object,
873
- Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
874
- SpecifiedOptions extends Options,
875
- > =
876
- If<IsAny<SpecifiedOptions>, Defaults,
877
- If<IsNever<SpecifiedOptions>, Defaults,
878
- Simplify<Merge<Defaults, {
879
- [Key in keyof SpecifiedOptions
880
- as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key
881
- ]: SpecifiedOptions[Key]
882
- }> & Required<Options>>>>;
883
-
831
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
832
+ //#endregion
833
+ //#region node_modules/type-fest/source/except.d.ts
884
834
  /**
885
835
  Filter out keys from an object.
886
836
 
@@ -909,22 +859,17 @@ type Filtered = Filter<'bar', 'foo'>;
909
859
  @see {Except}
910
860
  */
911
861
  type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
912
-
913
862
  type ExceptOptions = {
914
- /**
915
- Disallow assigning non-specified properties.
916
-
917
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
918
-
919
- @default false
920
- */
921
- requireExactProps?: boolean;
863
+ /**
864
+ Disallow assigning non-specified properties.
865
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
866
+ @default false
867
+ */
868
+ requireExactProps?: boolean;
922
869
  };
923
-
924
870
  type DefaultExceptOptions = {
925
- requireExactProps: false;
871
+ requireExactProps: false;
926
872
  };
927
-
928
873
  /**
929
874
  Create a type from an object type without certain keys.
930
875
 
@@ -980,15 +925,10 @@ type PostPayloadFixed = Except<UserData, 'email'>;
980
925
 
981
926
  @category Object
982
927
  */
983
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =
984
- _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
985
-
986
- type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
987
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
988
- } & (Options['requireExactProps'] extends true
989
- ? Partial<Record<KeysType, never>>
990
- : {});
991
-
928
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
929
+ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
930
+ //#endregion
931
+ //#region node_modules/type-fest/source/set-optional.d.ts
992
932
  /**
993
933
  Create a type that makes the given keys optional, while keeping the remaining keys as is.
994
934
 
@@ -1010,22 +950,13 @@ type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
1010
950
 
1011
951
  @category Object
1012
952
  */
1013
- type SetOptional<BaseType, Keys extends keyof BaseType> =
1014
- (BaseType extends (...arguments_: never) => any
1015
- ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType>
1016
- : unknown)
1017
- & _SetOptional<BaseType, Keys>;
1018
-
1019
- type _SetOptional<BaseType, Keys extends keyof BaseType> =
1020
- BaseType extends unknown // To distribute `BaseType` when it's a union type.
1021
- ? Simplify<
1022
- // Pick just the keys that are readonly from the base type.
1023
- Except<BaseType, Keys>
1024
- // Pick the keys that should be mutable from the base type and make them mutable.
1025
- & Partial<HomomorphicPick<BaseType, Keys>>
1026
- >
1027
- : never;
1028
-
953
+ type SetOptional<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetOptional<BaseType, Keys>;
954
+ type _SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unknown // To distribute `BaseType` when it's a union type.
955
+ ? Simplify< // Pick just the keys that are readonly from the base type.
956
+ Except<BaseType, Keys> // Pick the keys that should be mutable from the base type and make them mutable.
957
+ & Partial<HomomorphicPick<BaseType, Keys>>> : never;
958
+ //#endregion
959
+ //#region code/renderers/web-components/.dts-emit/code/renderers/web-components/src/preview.d.ts
1029
960
  /**
1030
961
  * Creates a Web Components-specific preview configuration with CSF factories support.
1031
962
  *
@@ -1046,11 +977,11 @@ type _SetOptional<BaseType, Keys extends keyof BaseType> =
1046
977
  * ```
1047
978
  */
1048
979
  declare function __definePreview<Addons extends PreviewAddon<never>[]>(input: {
1049
- addons: Addons;
980
+ addons: Addons;
1050
981
  } & ProjectAnnotations<WebComponentsTypes & InferTypes<Addons>>): WebComponentsPreview<WebComponentsTypes & InferTypes<Addons>>;
1051
982
  type InferArgs<TArgs, T, Decorators> = Simplify<TArgs & Simplify<OmitIndexSignature<DecoratorsArgs<WebComponentsTypes & T, Decorators>>>>;
1052
983
  type InferWebComponentsTypes<T, TArgs, Decorators> = WebComponentsTypes & T & {
1053
- args: Simplify<InferArgs<TArgs, T, Decorators>>;
984
+ args: Simplify<InferArgs<TArgs, T, Decorators>>;
1054
985
  };
1055
986
  /**
1056
987
  * Infers args from a web component's HTMLElement type, allowing both camelCase properties and
@@ -1072,33 +1003,33 @@ type InferArgsFromComponent<C extends keyof HTMLElementTagNameMap> = Partial<HTM
1072
1003
  * ```
1073
1004
  */
1074
1005
  interface WebComponentsPreview<T extends AddonTypes> extends Preview$1<WebComponentsTypes & T> {
1075
- /**
1076
- * Narrows the type of the preview to include additional type information. This is useful when you
1077
- * need to add args that aren't inferred from the component.
1078
- *
1079
- * @example
1080
- *
1081
- * ```ts
1082
- * const meta = preview.type<{ args: { theme: 'light' | 'dark' } }>().meta({
1083
- * component: 'my-button',
1084
- * });
1085
- * ```
1086
- */
1087
- type<S>(): WebComponentsPreview<T & S>;
1088
- meta<C extends keyof HTMLElementTagNameMap, Decorators extends DecoratorFunction<WebComponentsTypes & T, any>, TMetaArgs extends InferArgsFromComponent<C> & Partial<T['args']>>(meta: {
1089
- component?: C;
1090
- args?: TMetaArgs;
1091
- decorators?: Decorators | Decorators[];
1092
- } & Omit<ComponentAnnotations<WebComponentsTypes & T, InferArgsFromComponent<C> & T['args']>, 'decorators' | 'component' | 'args'>): WebComponentsMeta<InferWebComponentsTypes<T, InferArgsFromComponent<C>, Decorators>, Omit<ComponentAnnotations<InferWebComponentsTypes<T, InferArgsFromComponent<C>, Decorators>>, 'args'> & {
1093
- args: {} extends TMetaArgs ? {} : TMetaArgs;
1094
- }>;
1095
- meta<TArgs, Decorators extends DecoratorFunction<WebComponentsTypes & T, any>, TMetaArgs extends Partial<TArgs>>(meta: {
1096
- render?: ArgsStoryFn<WebComponentsTypes & T, TArgs>;
1097
- args?: TMetaArgs;
1098
- decorators?: Decorators | Decorators[];
1099
- } & Omit<ComponentAnnotations<WebComponentsTypes & T, TArgs & T['args']>, 'decorators' | 'component' | 'args' | 'render'>): WebComponentsMeta<InferWebComponentsTypes<T, TArgs, Decorators>, Omit<ComponentAnnotations<InferWebComponentsTypes<T, TArgs, Decorators>>, 'args'> & {
1100
- args: {} extends TMetaArgs ? {} : TMetaArgs;
1101
- }>;
1006
+ /**
1007
+ * Narrows the type of the preview to include additional type information. This is useful when you
1008
+ * need to add args that aren't inferred from the component.
1009
+ *
1010
+ * @example
1011
+ *
1012
+ * ```ts
1013
+ * const meta = preview.type<{ args: { theme: 'light' | 'dark' } }>().meta({
1014
+ * component: 'my-button',
1015
+ * });
1016
+ * ```
1017
+ */
1018
+ type<S>(): WebComponentsPreview<T & S>;
1019
+ meta<C extends keyof HTMLElementTagNameMap, Decorators extends DecoratorFunction<WebComponentsTypes & T, any>, TMetaArgs extends InferArgsFromComponent<C> & Partial<T['args']>>(meta: {
1020
+ component?: C;
1021
+ args?: TMetaArgs;
1022
+ decorators?: Decorators | Decorators[];
1023
+ } & Omit<ComponentAnnotations<WebComponentsTypes & T, InferArgsFromComponent<C> & T['args']>, 'decorators' | 'component' | 'args'>): WebComponentsMeta<InferWebComponentsTypes<T, InferArgsFromComponent<C>, Decorators>, Omit<ComponentAnnotations<InferWebComponentsTypes<T, InferArgsFromComponent<C>, Decorators>>, 'args'> & {
1024
+ args: {} extends TMetaArgs ? {} : TMetaArgs;
1025
+ }>;
1026
+ meta<TArgs, Decorators extends DecoratorFunction<WebComponentsTypes & T, any>, TMetaArgs extends Partial<TArgs>>(meta: {
1027
+ render?: ArgsStoryFn<WebComponentsTypes & T, TArgs>;
1028
+ args?: TMetaArgs;
1029
+ decorators?: Decorators | Decorators[];
1030
+ } & Omit<ComponentAnnotations<WebComponentsTypes & T, TArgs & T['args']>, 'decorators' | 'component' | 'args' | 'render'>): WebComponentsMeta<InferWebComponentsTypes<T, TArgs, Decorators>, Omit<ComponentAnnotations<InferWebComponentsTypes<T, TArgs, Decorators>>, 'args'> & {
1031
+ args: {} extends TMetaArgs ? {} : TMetaArgs;
1032
+ }>;
1102
1033
  }
1103
1034
  /** Extracts and unions all args types from an array of decorators. */
1104
1035
  type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
@@ -1109,73 +1040,71 @@ type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersectio
1109
1040
  * provided in meta become optional in stories, while missing required args must be provided at the
1110
1041
  * story level.
1111
1042
  */
1112
- interface WebComponentsMeta<T extends WebComponentsTypes, MetaInput extends ComponentAnnotations<T>>
1113
- /** @ts-expect-error WebComponentsMeta requires two type parameters, but Meta's constraints differ */
1114
- extends Meta$1<T, MetaInput> {
1115
- /**
1116
- * Creates a story with a custom render function that takes no args.
1117
- *
1118
- * This overload allows you to define a story using just a render function or an object with a
1119
- * render function that doesn't depend on args. Since the render function doesn't use args, no
1120
- * args need to be provided regardless of what's required by the component.
1121
- *
1122
- * @example
1123
- *
1124
- * ```ts
1125
- * // Using just a render function with lit-html
1126
- * export const CustomTemplate = meta.story(() => html`<div>Custom content</div>`);
1127
- *
1128
- * // Using an object with render
1129
- * export const WithRender = meta.story({
1130
- * render: () => html`<my-element></my-element>`,
1131
- * });
1132
- * ```
1133
- */
1134
- story<TInput extends (() => WebComponentsTypes['storyResult']) | (StoryAnnotations<T, T['args']> & {
1135
- render: () => WebComponentsTypes['storyResult'];
1136
- })>(story: TInput): WebComponentsStory<T, TInput extends () => WebComponentsTypes['storyResult'] ? {
1137
- render: TInput;
1138
- } : TInput>;
1139
- /**
1140
- * Creates a story with custom configuration including args, decorators, or other annotations.
1141
- *
1142
- * This is the primary overload for defining stories. Args that were already provided in meta
1143
- * become optional, while any remaining required args must be specified here.
1144
- *
1145
- * @example
1146
- *
1147
- * ```ts
1148
- * // Provide required args not in meta
1149
- * export const Primary = meta.story({
1150
- * args: { label: 'Click me', disabled: false },
1151
- * });
1152
- *
1153
- * // Override meta args and add story-specific configuration
1154
- * export const Disabled = meta.story({
1155
- * args: { disabled: true },
1156
- * decorators: [withCustomWrapper],
1157
- * });
1158
- * ```
1159
- */
1160
- story<TInput extends Simplify<StoryAnnotations<T, T['args'], SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']>>>>(story: TInput): WebComponentsStory<T, TInput>;
1161
- /**
1162
- * Creates a story with no additional configuration.
1163
- *
1164
- * This overload is only available when all required args have been provided in meta. The
1165
- * conditional type `Partial<T['args']> extends SetOptional<...>` checks if the remaining required
1166
- * args (after accounting for args provided in meta) are all optional. If so, the function accepts
1167
- * zero arguments `[]`. Otherwise, it requires `[never]` which makes this overload unmatchable,
1168
- * forcing the user to provide args.
1169
- *
1170
- * @example
1171
- *
1172
- * ```ts
1173
- * // When meta provides all required args, story() can be called with no arguments
1174
- * const meta = preview.meta({ component: 'my-button', args: { label: 'Hi' } });
1175
- * export const Default = meta.story(); // Valid - all args provided in meta
1176
- * ```
1177
- */
1178
- story(..._args: Partial<T['args']> extends SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']> ? [] : [never]): WebComponentsStory<T, {}>;
1043
+ interface WebComponentsMeta<T extends WebComponentsTypes, MetaInput extends ComponentAnnotations<T>> /** @ts-expect-error WebComponentsMeta requires two type parameters, but Meta's constraints differ */ extends Meta$1<T, MetaInput> {
1044
+ /**
1045
+ * Creates a story with a custom render function that takes no args.
1046
+ *
1047
+ * This overload allows you to define a story using just a render function or an object with a
1048
+ * render function that doesn't depend on args. Since the render function doesn't use args, no
1049
+ * args need to be provided regardless of what's required by the component.
1050
+ *
1051
+ * @example
1052
+ *
1053
+ * ```ts
1054
+ * // Using just a render function with lit-html
1055
+ * export const CustomTemplate = meta.story(() => html`<div>Custom content</div>`);
1056
+ *
1057
+ * // Using an object with render
1058
+ * export const WithRender = meta.story({
1059
+ * render: () => html`<my-element></my-element>`,
1060
+ * });
1061
+ * ```
1062
+ */
1063
+ story<TInput extends (() => WebComponentsTypes['storyResult']) | (StoryAnnotations<T, T['args']> & {
1064
+ render: () => WebComponentsTypes['storyResult'];
1065
+ })>(story: TInput): WebComponentsStory<T, TInput extends (() => WebComponentsTypes['storyResult']) ? {
1066
+ render: TInput;
1067
+ } : TInput>;
1068
+ /**
1069
+ * Creates a story with custom configuration including args, decorators, or other annotations.
1070
+ *
1071
+ * This is the primary overload for defining stories. Args that were already provided in meta
1072
+ * become optional, while any remaining required args must be specified here.
1073
+ *
1074
+ * @example
1075
+ *
1076
+ * ```ts
1077
+ * // Provide required args not in meta
1078
+ * export const Primary = meta.story({
1079
+ * args: { label: 'Click me', disabled: false },
1080
+ * });
1081
+ *
1082
+ * // Override meta args and add story-specific configuration
1083
+ * export const Disabled = meta.story({
1084
+ * args: { disabled: true },
1085
+ * decorators: [withCustomWrapper],
1086
+ * });
1087
+ * ```
1088
+ */
1089
+ story<TInput extends Simplify<StoryAnnotations<T, T['args'], SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']>>>>(story: TInput): WebComponentsStory<T, TInput>;
1090
+ /**
1091
+ * Creates a story with no additional configuration.
1092
+ *
1093
+ * This overload is only available when all required args have been provided in meta. The
1094
+ * conditional type `Partial<T['args']> extends SetOptional<...>` checks if the remaining required
1095
+ * args (after accounting for args provided in meta) are all optional. If so, the function accepts
1096
+ * zero arguments `[]`. Otherwise, it requires `[never]` which makes this overload unmatchable,
1097
+ * forcing the user to provide args.
1098
+ *
1099
+ * @example
1100
+ *
1101
+ * ```ts
1102
+ * // When meta provides all required args, story() can be called with no arguments
1103
+ * const meta = preview.meta({ component: 'my-button', args: { label: 'Hi' } });
1104
+ * export const Default = meta.story(); // Valid - all args provided in meta
1105
+ * ```
1106
+ */
1107
+ story(..._args: Partial<T['args']> extends SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']> ? [] : [never]): WebComponentsStory<T, {}>;
1179
1108
  }
1180
1109
  /**
1181
1110
  * Web Components-specific Story interface returned by `meta.story()`.
@@ -1183,7 +1112,6 @@ interface WebComponentsMeta<T extends WebComponentsTypes, MetaInput extends Comp
1183
1112
  * Represents a single story with its configuration and provides access to the composed story for
1184
1113
  * testing via `story.run()`.
1185
1114
  */
1186
- interface WebComponentsStory<T extends WebComponentsTypes, TInput extends StoryAnnotations<T, T['args']>> extends Story<T, TInput> {
1187
- }
1188
-
1189
- export { type Decorator, type Loader, type Meta, type Preview, type StoryContext, type StoryFn, type StoryObj, type WebComponentsMeta, type WebComponentsPreview, type WebComponentsRenderer, type WebComponentsStory, type WebComponentsTypes, __definePreview, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
1115
+ interface WebComponentsStory<T extends WebComponentsTypes, TInput extends StoryAnnotations<T, T['args']>> extends Story<T, TInput> {}
1116
+ //#endregion
1117
+ export { type ArgTypes, type Args, Decorator, Loader, Meta, type Parameters$1 as Parameters, Preview, StoryContext, StoryFn, StoryObj, type StrictArgs, WebComponentsMeta, WebComponentsPreview, type WebComponentsRenderer, WebComponentsStory, type WebComponentsTypes, __definePreview, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2hpvtnd8ya8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2hpvtnd8ya8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2hpvtnd8ya8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_tln6674yqc from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_tln6674yqc from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_tln6674yqc from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2hpvtnd8ya8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2hpvtnd8ya8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2hpvtnd8ya8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_tln6674yqc.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_tln6674yqc.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_tln6674yqc.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/web-components",
3
- "version": "10.6.0-alpha.0",
3
+ "version": "10.6.0-alpha.1",
4
4
  "description": "Storybook Web Components renderer: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -58,12 +58,12 @@
58
58
  "cross-spawn": "^7.0.6",
59
59
  "lit": "2.3.1",
60
60
  "tmp": "^0.2.3",
61
- "typescript": "^5.8.3",
61
+ "typescript": "^6.0.3",
62
62
  "web-component-analyzer": "^1.1.6"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "lit": "^2.0.0 || ^3.0.0",
66
- "storybook": "^10.6.0-alpha.0"
66
+ "storybook": "^10.6.0-alpha.1"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"