@storybook/angular 11.0.0-alpha.0 → 11.0.0-alpha.2

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,8 +1,8 @@
1
1
  import { n as FrameworkOptions, r as StorybookConfig, t as AngularOptions } from "./chunk-D12NRfQ8.js";
2
- import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ArgsStoryFn, ComponentAnnotations, DecoratorFunction, LoaderFunction, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Parameters as Parameters$2, Parameters as Parameters$3, ProjectAnnotations, Renderer, StoryAnnotations, StoryContext as StoryContext$1, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
2
+ import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ArgsStoryFn, ComponentAnnotations, DecoratorFunction, LoaderFunction, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations, Parameters as Parameters$1, Parameters as Parameters$2, ProjectAnnotations, StoryAnnotations, StoryContext as StoryContext$1, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
3
3
  import * as AngularCore from "@angular/core";
4
4
  import { ApplicationConfig, Provider, Type } from "@angular/core";
5
- import { AddonTypes, InferTypes, Meta as Meta$1, Preview as Preview$1, PreviewAddon, Story } from "storybook/internal/csf";
5
+ import { AddonTypes, InferTypes, Meta as Meta$1, MetaInput, MetaTypes, Preview as Preview$1, PreviewAddon, Story, StoryArgs, TypedMetaArgKeys, WithRenderArgs } from "storybook/internal/csf";
6
6
 
7
7
  //#region code/frameworks/angular/.dts-emit/code/frameworks/angular/src/client/types.d.ts
8
8
  interface NgModuleMetadata {
@@ -38,7 +38,7 @@ interface AngularRenderer extends WebRenderer {
38
38
  component: any;
39
39
  storyResult: StoryFnAngularReturnType;
40
40
  }
41
- type Parameters$1 = Parameters$3 & {
41
+ type Parameters = Parameters$2 & {
42
42
  bootstrapModuleOptions?: unknown;
43
43
  };
44
44
  //#endregion
@@ -120,373 +120,6 @@ type TransformEventType<T> = { [K in keyof T]: T[K] extends AngularCore.EventEmi
120
120
  */
121
121
  declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<AngularRenderer>;
122
122
  //#endregion
123
- //#region node_modules/type-fest/source/union-to-intersection.d.ts
124
- /**
125
- Convert a union type to an intersection type.
126
-
127
- Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
128
-
129
- @example
130
- ```
131
- import type {UnionToIntersection} from 'type-fest';
132
-
133
- type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
134
-
135
- type Intersection = UnionToIntersection<Union>;
136
- //=> {the(): void} & {great(arg: string): void} & {escape: boolean}
137
- ```
138
-
139
- @category Type
140
- */
141
- type UnionToIntersection<Union> = (// `extends unknown` is always going to be the case and is used to convert the
142
- // `Union` into a [distributive conditional
143
- // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
144
- Union extends unknown // The union type is used as the only argument to a function since the union
145
- // of function arguments is an intersection.
146
- ? (distributedUnion: Union) => void // This won't happen.
147
- : never // Infer the `Intersection` type since TypeScript represents the positional
148
- // arguments of unions of functions as an intersection of the union.
149
- ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
150
- ? Intersection & Union : never;
151
- //#endregion
152
- //#region node_modules/type-fest/source/keys-of-union.d.ts
153
- /**
154
- Create a union of all keys from a given type, even those exclusive to specific union members.
155
-
156
- Unlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member.
157
-
158
- @link https://stackoverflow.com/a/49402091
159
-
160
- @example
161
- ```
162
- import type {KeysOfUnion} from 'type-fest';
163
-
164
- type A = {
165
- common: string;
166
- a: number;
167
- };
168
-
169
- type B = {
170
- common: string;
171
- b: string;
172
- };
173
-
174
- type C = {
175
- common: string;
176
- c: boolean;
177
- };
178
-
179
- type Union = A | B | C;
180
-
181
- type CommonKeys = keyof Union;
182
- //=> 'common'
183
-
184
- type AllKeys = KeysOfUnion<Union>;
185
- //=> 'common' | 'a' | 'b' | 'c'
186
- ```
187
-
188
- @category Object
189
- */
190
- type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
191
- keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
192
- //#endregion
193
- //#region node_modules/type-fest/source/is-any.d.ts
194
- /**
195
- Returns a boolean for whether the given type is `any`.
196
-
197
- @link https://stackoverflow.com/a/49928360/1490091
198
-
199
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
200
-
201
- @example
202
- ```
203
- import type {IsAny} from 'type-fest';
204
-
205
- const typedObject = {a: 1, b: 2} as const;
206
- const anyObject: any = {a: 1, b: 2};
207
-
208
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
209
- return object[key];
210
- }
211
-
212
- const typedA = get(typedObject, 'a');
213
- //=> 1
214
-
215
- const anyA = get(anyObject, 'a');
216
- //=> any
217
- ```
218
-
219
- @category Type Guard
220
- @category Utilities
221
- */
222
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
223
- //#endregion
224
- //#region node_modules/type-fest/source/is-optional-key-of.d.ts
225
- /**
226
- Returns a boolean for whether the given key is an optional key of type.
227
-
228
- This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
229
-
230
- @example
231
- ```
232
- import type {IsOptionalKeyOf} from 'type-fest';
233
-
234
- type User = {
235
- name: string;
236
- surname: string;
237
-
238
- luckyNumber?: number;
239
- };
240
-
241
- type Admin = {
242
- name: string;
243
- surname?: string;
244
- };
245
-
246
- type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
247
- //=> true
248
-
249
- type T2 = IsOptionalKeyOf<User, 'name'>;
250
- //=> false
251
-
252
- type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
253
- //=> boolean
254
-
255
- type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
256
- //=> false
257
-
258
- type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
259
- //=> boolean
260
- ```
261
-
262
- @category Type Guard
263
- @category Utilities
264
- */
265
- 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;
266
- //#endregion
267
- //#region node_modules/type-fest/source/optional-keys-of.d.ts
268
- /**
269
- Extract all optional keys from the given type.
270
-
271
- This is useful when you want to create a new type that contains different type values for the optional keys only.
272
-
273
- @example
274
- ```
275
- import type {OptionalKeysOf, Except} from 'type-fest';
276
-
277
- type User = {
278
- name: string;
279
- surname: string;
280
-
281
- luckyNumber?: number;
282
- };
283
-
284
- const REMOVE_FIELD = Symbol('remove field symbol');
285
- type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
286
- [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
287
- };
288
-
289
- const update1: UpdateOperation<User> = {
290
- name: 'Alice',
291
- };
292
-
293
- const update2: UpdateOperation<User> = {
294
- name: 'Bob',
295
- luckyNumber: REMOVE_FIELD,
296
- };
297
- ```
298
-
299
- @category Utilities
300
- */
301
- type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
302
- ? (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`
303
- : never;
304
- //#endregion
305
- //#region node_modules/type-fest/source/required-keys-of.d.ts
306
- /**
307
- Extract all required keys from the given type.
308
-
309
- This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
310
-
311
- @example
312
- ```
313
- import type {RequiredKeysOf} from 'type-fest';
314
-
315
- declare function createValidation<
316
- Entity extends object,
317
- Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
318
- >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
319
-
320
- type User = {
321
- name: string;
322
- surname: string;
323
- luckyNumber?: number;
324
- };
325
-
326
- const validator1 = createValidation<User>('name', value => value.length < 25);
327
- const validator2 = createValidation<User>('surname', value => value.length < 25);
328
-
329
- // @ts-expect-error
330
- const validator3 = createValidation<User>('luckyNumber', value => value > 0);
331
- // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
332
- ```
333
-
334
- @category Utilities
335
- */
336
- type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
337
- ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
338
- //#endregion
339
- //#region node_modules/type-fest/source/is-never.d.ts
340
- /**
341
- Returns a boolean for whether the given type is `never`.
342
-
343
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
344
- @link https://stackoverflow.com/a/53984913/10292952
345
- @link https://www.zhenghao.io/posts/ts-never
346
-
347
- Useful in type utilities, such as checking if something does not occur.
348
-
349
- @example
350
- ```
351
- import type {IsNever, And} from 'type-fest';
352
-
353
- type A = IsNever<never>;
354
- //=> true
355
-
356
- type B = IsNever<any>;
357
- //=> false
358
-
359
- type C = IsNever<unknown>;
360
- //=> false
361
-
362
- type D = IsNever<never[]>;
363
- //=> false
364
-
365
- type E = IsNever<object>;
366
- //=> false
367
-
368
- type F = IsNever<string>;
369
- //=> false
370
- ```
371
-
372
- @example
373
- ```
374
- import type {IsNever} from 'type-fest';
375
-
376
- type IsTrue<T> = T extends true ? true : false;
377
-
378
- // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
379
- type A = IsTrue<never>;
380
- //=> never
381
-
382
- // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
383
- type IsTrueFixed<T> =
384
- IsNever<T> extends true ? false : T extends true ? true : false;
385
-
386
- type B = IsTrueFixed<never>;
387
- //=> false
388
- ```
389
-
390
- @category Type Guard
391
- @category Utilities
392
- */
393
- type IsNever<T> = [T] extends [never] ? true : false;
394
- //#endregion
395
- //#region node_modules/type-fest/source/if.d.ts
396
- /**
397
- An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
398
-
399
- Use-cases:
400
- - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
401
-
402
- Note:
403
- - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
404
- - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
405
-
406
- @example
407
- ```
408
- import type {If} from 'type-fest';
409
-
410
- type A = If<true, 'yes', 'no'>;
411
- //=> 'yes'
412
-
413
- type B = If<false, 'yes', 'no'>;
414
- //=> 'no'
415
-
416
- type C = If<boolean, 'yes', 'no'>;
417
- //=> 'yes' | 'no'
418
-
419
- type D = If<any, 'yes', 'no'>;
420
- //=> 'yes' | 'no'
421
-
422
- type E = If<never, 'yes', 'no'>;
423
- //=> 'no'
424
- ```
425
-
426
- @example
427
- ```
428
- import type {If, IsAny, IsNever} from 'type-fest';
429
-
430
- type A = If<IsAny<unknown>, 'is any', 'not any'>;
431
- //=> 'not any'
432
-
433
- type B = If<IsNever<never>, 'is never', 'not never'>;
434
- //=> 'is never'
435
- ```
436
-
437
- @example
438
- ```
439
- import type {If, IsEqual} from 'type-fest';
440
-
441
- type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
442
-
443
- type A = IfEqual<string, string, 'equal', 'not equal'>;
444
- //=> 'equal'
445
-
446
- type B = IfEqual<string, number, 'equal', 'not equal'>;
447
- //=> 'not equal'
448
- ```
449
-
450
- Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
451
-
452
- @example
453
- ```
454
- import type {If, IsEqual, StringRepeat} from 'type-fest';
455
-
456
- type HundredZeroes = StringRepeat<'0', 100>;
457
-
458
- // The following implementation is not tail recursive
459
- type Includes<S extends string, Char extends string> =
460
- S extends `${infer First}${infer Rest}`
461
- ? If<IsEqual<First, Char>,
462
- 'found',
463
- Includes<Rest, Char>>
464
- : 'not found';
465
-
466
- // Hence, instantiations with long strings will fail
467
- // @ts-expect-error
468
- type Fails = Includes<HundredZeroes, '1'>;
469
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
470
- // Error: Type instantiation is excessively deep and possibly infinite.
471
-
472
- // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
473
- type IncludesWithoutIf<S extends string, Char extends string> =
474
- S extends `${infer First}${infer Rest}`
475
- ? IsEqual<First, Char> extends true
476
- ? 'found'
477
- : IncludesWithoutIf<Rest, Char>
478
- : 'not found';
479
-
480
- // Now, instantiations with long strings will work
481
- type Works = IncludesWithoutIf<HundredZeroes, '1'>;
482
- //=> 'not found'
483
- ```
484
-
485
- @category Type Guard
486
- @category Utilities
487
- */
488
- type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
489
- //#endregion
490
123
  //#region node_modules/type-fest/source/simplify.d.ts
491
124
  /**
492
125
  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.
@@ -548,470 +181,6 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
548
181
  */
549
182
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
550
183
  //#endregion
551
- //#region node_modules/type-fest/source/is-equal.d.ts
552
- /**
553
- Returns a boolean for whether the two given types are equal.
554
-
555
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
556
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
557
-
558
- Use-cases:
559
- - If you want to make a conditional branch based on the result of a comparison of two types.
560
-
561
- @example
562
- ```
563
- import type {IsEqual} from 'type-fest';
564
-
565
- // This type returns a boolean for whether the given array includes the given item.
566
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
567
- type Includes<Value extends readonly any[], Item> =
568
- Value extends readonly [Value[0], ...infer rest]
569
- ? IsEqual<Value[0], Item> extends true
570
- ? true
571
- : Includes<rest, Item>
572
- : false;
573
- ```
574
-
575
- @category Type Guard
576
- @category Utilities
577
- */
578
- type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
579
- // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
580
- type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
581
- //#endregion
582
- //#region node_modules/type-fest/source/omit-index-signature.d.ts
583
- /**
584
- Omit any index signatures from the given object type, leaving only explicitly defined properties.
585
-
586
- This is the counterpart of `PickIndexSignature`.
587
-
588
- Use-cases:
589
- - Remove overly permissive signatures from third-party types.
590
-
591
- This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
592
-
593
- It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
594
-
595
- (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
596
-
597
- ```
598
- const indexed: Record<string, unknown> = {}; // Allowed
599
-
600
- // @ts-expect-error
601
- const keyed: Record<'foo', unknown> = {}; // Error
602
- // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
603
- ```
604
-
605
- Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
606
-
607
- ```
608
- type Indexed = {} extends Record<string, unknown>
609
- ? '✅ `{}` is assignable to `Record<string, unknown>`'
610
- : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
611
-
612
- type IndexedResult = Indexed;
613
- //=> '✅ `{}` is assignable to `Record<string, unknown>`'
614
-
615
- type Keyed = {} extends Record<'foo' | 'bar', unknown>
616
- ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
617
- : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
618
-
619
- type KeyedResult = Keyed;
620
- //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
621
- ```
622
-
623
- Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
624
-
625
- ```
626
- type OmitIndexSignature<ObjectType> = {
627
- [KeyType in keyof ObjectType // Map each key of `ObjectType`...
628
- ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
629
- };
630
- ```
631
-
632
- ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
633
-
634
- ```
635
- type OmitIndexSignature<ObjectType> = {
636
- [KeyType in keyof ObjectType
637
- // Is `{}` assignable to `Record<KeyType, unknown>`?
638
- as {} extends Record<KeyType, unknown>
639
- ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
640
- : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
641
- ]: ObjectType[KeyType];
642
- };
643
- ```
644
-
645
- If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
646
-
647
- @example
648
- ```
649
- import type {OmitIndexSignature} from 'type-fest';
650
-
651
- type Example = {
652
- // These index signatures will be removed.
653
- [x: string]: any;
654
- [x: number]: any;
655
- [x: symbol]: any;
656
- [x: `head-${string}`]: string;
657
- [x: `${string}-tail`]: string;
658
- [x: `head-${string}-tail`]: string;
659
- [x: `${bigint}`]: string;
660
- [x: `embedded-${number}`]: string;
661
-
662
- // These explicitly defined keys will remain.
663
- foo: 'bar';
664
- qux?: 'baz';
665
- };
666
-
667
- type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
668
- //=> {foo: 'bar'; qux?: 'baz'}
669
- ```
670
-
671
- @see {@link PickIndexSignature}
672
- @category Object
673
- */
674
- type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
675
- //#endregion
676
- //#region node_modules/type-fest/source/pick-index-signature.d.ts
677
- /**
678
- Pick only index signatures from the given object type, leaving out all explicitly defined properties.
679
-
680
- This is the counterpart of `OmitIndexSignature`.
681
-
682
- @example
683
- ```
684
- import type {PickIndexSignature} from 'type-fest';
685
-
686
- declare const symbolKey: unique symbol;
687
-
688
- type Example = {
689
- // These index signatures will remain.
690
- [x: string]: unknown;
691
- [x: number]: unknown;
692
- [x: symbol]: unknown;
693
- [x: `head-${string}`]: string;
694
- [x: `${string}-tail`]: string;
695
- [x: `head-${string}-tail`]: string;
696
- [x: `${bigint}`]: string;
697
- [x: `embedded-${number}`]: string;
698
-
699
- // These explicitly defined keys will be removed.
700
- ['kebab-case-key']: string;
701
- [symbolKey]: string;
702
- foo: 'bar';
703
- qux?: 'baz';
704
- };
705
-
706
- type ExampleIndexSignature = PickIndexSignature<Example>;
707
- // {
708
- // [x: string]: unknown;
709
- // [x: number]: unknown;
710
- // [x: symbol]: unknown;
711
- // [x: `head-${string}`]: string;
712
- // [x: `${string}-tail`]: string;
713
- // [x: `head-${string}-tail`]: string;
714
- // [x: `${bigint}`]: string;
715
- // [x: `embedded-${number}`]: string;
716
- // }
717
- ```
718
-
719
- @see {@link OmitIndexSignature}
720
- @category Object
721
- */
722
- type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
723
- //#endregion
724
- //#region node_modules/type-fest/source/merge.d.ts
725
- // Merges two objects without worrying about index signatures.
726
- type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
727
- /**
728
- Merge two types into a new type. Keys of the second type overrides keys of the first type.
729
-
730
- This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
731
-
732
- @example
733
- ```
734
- import type {Merge} from 'type-fest';
735
-
736
- type Foo = {
737
- a: string;
738
- b: number;
739
- };
740
-
741
- type Bar = {
742
- a: number; // Conflicts with Foo['a']
743
- c: boolean;
744
- };
745
-
746
- // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
747
- type WithIntersection = (Foo & Bar)['a'];
748
- //=> never
749
-
750
- // With `Merge`, `a` is cleanly overridden to `number`.
751
- type WithMerge = Merge<Foo, Bar>['a'];
752
- //=> number
753
- ```
754
-
755
- @example
756
- ```
757
- import type {Merge} from 'type-fest';
758
-
759
- type Foo = {
760
- [x: string]: unknown;
761
- [x: number]: unknown;
762
- foo: string;
763
- bar: symbol;
764
- };
765
-
766
- type Bar = {
767
- [x: number]: number;
768
- [x: symbol]: unknown;
769
- bar: Date;
770
- baz: boolean;
771
- };
772
-
773
- export type FooBar = Merge<Foo, Bar>;
774
- //=> {
775
- // [x: string]: unknown;
776
- // [x: number]: number;
777
- // [x: symbol]: unknown;
778
- // foo: string;
779
- // bar: Date;
780
- // baz: boolean;
781
- // }
782
- ```
783
-
784
- Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
785
-
786
- @see {@link ObjectMerge}
787
- @category Object
788
- */
789
- type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
790
- ? Source extends unknown // For distributing `Source`
791
- ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
792
- : never;
793
- // Should never happen
794
- type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
795
- //#endregion
796
- //#region node_modules/type-fest/source/internal/object.d.ts
797
- /**
798
- Works similar to the built-in `Pick` utility type, except for the following differences:
799
- - Distributes over union types and allows picking keys from any member of the union type.
800
- - Primitives types are returned as-is.
801
- - Picks all keys if `Keys` is `any`.
802
- - Doesn't pick `number` from a `string` index signature.
803
-
804
- @example
805
- ```
806
- type ImageUpload = {
807
- url: string;
808
- size: number;
809
- thumbnailUrl: string;
810
- };
811
-
812
- type VideoUpload = {
813
- url: string;
814
- duration: number;
815
- encodingFormat: string;
816
- };
817
-
818
- // Distributes over union types and allows picking keys from any member of the union type
819
- type MediaDisplay = HomomorphicPick<ImageUpload | VideoUpload, "url" | "size" | "duration">;
820
- //=> {url: string; size: number} | {url: string; duration: number}
821
-
822
- // Primitive types are returned as-is
823
- type Primitive = HomomorphicPick<string | number, 'toUpperCase' | 'toString'>;
824
- //=> string | number
825
-
826
- // Picks all keys if `Keys` is `any`
827
- type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
828
- //=> {a: 1; b: 2} | {c: 3}
829
-
830
- // Doesn't pick `number` from a `string` index signature
831
- type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
832
- //=> {}
833
- */
834
- type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
835
- /**
836
- Merges user specified options with default options.
837
-
838
- @example
839
- ```
840
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
841
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
842
- type SpecifiedOptions = {leavesOnly: true};
843
-
844
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
845
- //=> {maxRecursionDepth: 10; leavesOnly: true}
846
- ```
847
-
848
- @example
849
- ```
850
- // Complains if default values are not provided for optional options
851
-
852
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
853
- type DefaultPathsOptions = {maxRecursionDepth: 10};
854
- type SpecifiedOptions = {};
855
-
856
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
857
- // ~~~~~~~~~~~~~~~~~~~
858
- // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
859
- ```
860
-
861
- @example
862
- ```
863
- // Complains if an option's default type does not conform to the expected type
864
-
865
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
866
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
867
- type SpecifiedOptions = {};
868
-
869
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
870
- // ~~~~~~~~~~~~~~~~~~~
871
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
872
- ```
873
-
874
- @example
875
- ```
876
- // Complains if an option's specified type does not conform to the expected type
877
-
878
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
879
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
880
- type SpecifiedOptions = {leavesOnly: 'yes'};
881
-
882
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
883
- // ~~~~~~~~~~~~~~~~
884
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
885
- ```
886
- */
887
- 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>>>>;
888
- //#endregion
889
- //#region node_modules/type-fest/source/except.d.ts
890
- /**
891
- Filter out keys from an object.
892
-
893
- Returns `never` if `Exclude` is strictly equal to `Key`.
894
- Returns `never` if `Key` extends `Exclude`.
895
- Returns `Key` otherwise.
896
-
897
- @example
898
- ```
899
- type Filtered = Filter<'foo', 'foo'>;
900
- //=> never
901
- ```
902
-
903
- @example
904
- ```
905
- type Filtered = Filter<'bar', string>;
906
- //=> never
907
- ```
908
-
909
- @example
910
- ```
911
- type Filtered = Filter<'bar', 'foo'>;
912
- //=> 'bar'
913
- ```
914
-
915
- @see {Except}
916
- */
917
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
918
- type ExceptOptions = {
919
- /**
920
- Disallow assigning non-specified properties.
921
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
922
- @default false
923
- */
924
- requireExactProps?: boolean;
925
- };
926
- type DefaultExceptOptions = {
927
- requireExactProps: false;
928
- };
929
- /**
930
- Create a type from an object type without certain keys.
931
-
932
- We recommend setting the `requireExactProps` option to `true`.
933
-
934
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
935
-
936
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
937
-
938
- @example
939
- ```
940
- import type {Except} from 'type-fest';
941
-
942
- type Foo = {
943
- a: number;
944
- b: string;
945
- };
946
-
947
- type FooWithoutA = Except<Foo, 'a'>;
948
- //=> {b: string}
949
-
950
- // @ts-expect-error
951
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
952
- // errors: 'a' does not exist in type '{ b: string; }'
953
-
954
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
955
- //=> {a: number} & Partial<Record<'b', never>>
956
-
957
- // @ts-expect-error
958
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
959
- // errors at 'b': Type 'string' is not assignable to type 'undefined'.
960
-
961
- // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
962
-
963
- // Consider the following example:
964
-
965
- type UserData = {
966
- [metadata: string]: string;
967
- email: string;
968
- name: string;
969
- role: 'admin' | 'user';
970
- };
971
-
972
- // `Omit` clearly doesn't behave as expected in this case:
973
- type PostPayload = Omit<UserData, 'email'>;
974
- //=> {[x: string]: string; [x: number]: string}
975
-
976
- // In situations like this, `Except` works better.
977
- // It simply removes the `email` key while preserving all the other keys.
978
- type PostPayloadFixed = Except<UserData, 'email'>;
979
- //=> {[x: string]: string; name: string; role: 'admin' | 'user'}
980
- ```
981
-
982
- @category Object
983
- */
984
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
985
- 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>> : {});
986
- //#endregion
987
- //#region node_modules/type-fest/source/set-optional.d.ts
988
- /**
989
- Create a type that makes the given keys optional, while keeping the remaining keys as is.
990
-
991
- Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
992
-
993
- @example
994
- ```
995
- import type {SetOptional} from 'type-fest';
996
-
997
- type Foo = {
998
- a: number;
999
- b?: string;
1000
- c: boolean;
1001
- };
1002
-
1003
- type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
1004
- //=> {a: number; b?: string; c?: boolean}
1005
- ```
1006
-
1007
- @category Object
1008
- */
1009
- type SetOptional<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetOptional<BaseType, Keys>;
1010
- type _SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unknown // To distribute `BaseType` when it's a union type.
1011
- ? Simplify< // Pick just the keys that are readonly from the base type.
1012
- Except<BaseType, Keys> // Pick the keys that should be mutable from the base type and make them mutable.
1013
- & Partial<HomomorphicPick<BaseType, Keys>>> : never;
1014
- //#endregion
1015
184
  //#region code/frameworks/angular/.dts-emit/code/frameworks/angular/src/client/preview.d.ts
1016
185
  /**
1017
186
  * Creates an Angular-specific preview configuration with CSF factories support.
@@ -1035,11 +204,7 @@ Except<BaseType, Keys> // Pick the keys that should be mutable from the base typ
1035
204
  declare function __definePreview<Addons extends PreviewAddon<never>[]>(input: {
1036
205
  addons: Addons;
1037
206
  } & ProjectAnnotations<AngularRenderer & InferTypes<Addons>>): AngularPreview<AngularRenderer & InferTypes<Addons>>;
1038
- type InferArgs<TArgs, T, Decorators> = Simplify<TArgs & Simplify<OmitIndexSignature<DecoratorsArgs<AngularRenderer & T, Decorators>>>>;
1039
207
  type InferComponentArgs<C extends abstract new (...args: any) => any> = Partial<TransformComponentType<InstanceType<C>>>;
1040
- type InferAngularTypes<T, TArgs, Decorators> = AngularRenderer & T & {
1041
- args: Simplify<InferArgs<TArgs, T, Decorators>>;
1042
- };
1043
208
  /**
1044
209
  * Angular-specific Preview interface that provides type-safe CSF factory methods.
1045
210
  *
@@ -1068,23 +233,14 @@ interface AngularPreview<T extends AddonTypes> extends Preview$1<AngularRenderer
1068
233
  * ```
1069
234
  */
1070
235
  type<S>(): AngularPreview<T & S>;
1071
- meta<C extends abstract new (...args: any) => any, Decorators extends DecoratorFunction<AngularRenderer & T, any>, TMetaArgs extends Partial<InferComponentArgs<C> & T['args']>>(meta: {
1072
- component?: C;
1073
- args?: TMetaArgs;
1074
- decorators?: Decorators | Decorators[];
1075
- } & Omit<ComponentAnnotations<AngularRenderer & T, InferComponentArgs<C> & T['args']>, 'decorators' | 'component' | 'args'>): AngularMeta<InferAngularTypes<T, InferComponentArgs<C>, Decorators>, Omit<ComponentAnnotations<InferAngularTypes<T, InferComponentArgs<C>, Decorators>>, 'args'> & {
1076
- args: {} extends TMetaArgs ? {} : TMetaArgs;
1077
- }>;
1078
- meta<TArgs, Decorators extends DecoratorFunction<AngularRenderer & T, any>, TMetaArgs extends Partial<TArgs & T['args']>>(meta: {
236
+ meta<C extends abstract new (...args: any) => any, Decorators extends DecoratorFunction<AngularRenderer & T, any>, TRenderArgs = unknown, TMetaArgKeys extends PropertyKey = never>(meta: {
237
+ component: C;
238
+ render?: ArgsStoryFn<AngularRenderer & T, InferComponentArgs<C> & TRenderArgs & T['args']>;
239
+ } & MetaInput<AngularRenderer & T, WithRenderArgs<InferComponentArgs<C>, TRenderArgs>, Decorators, TMetaArgKeys>): AngularMeta<MetaTypes<AngularRenderer & T, WithRenderArgs<InferComponentArgs<C>, TRenderArgs>, Decorators, TMetaArgKeys>, TMetaArgKeys>;
240
+ meta<TArgs = Args$1, Decorators extends DecoratorFunction<AngularRenderer & T, any> = DecoratorFunction<AngularRenderer & T, any>, TMetaArgKeys extends PropertyKey = never>(meta: {
1079
241
  render?: ArgsStoryFn<AngularRenderer & T, TArgs & T['args']>;
1080
- args?: TMetaArgs;
1081
- decorators?: Decorators | Decorators[];
1082
- } & Omit<ComponentAnnotations<AngularRenderer & T, TArgs & T['args']>, 'decorators' | 'args' | 'render' | 'component'>): AngularMeta<InferAngularTypes<T, TArgs, Decorators>, Omit<ComponentAnnotations<InferAngularTypes<T, TArgs, Decorators>>, 'args'> & {
1083
- args: {} extends TMetaArgs ? {} : TMetaArgs;
1084
- }>;
242
+ } & MetaInput<AngularRenderer & T, TArgs, Decorators, TMetaArgKeys>): AngularMeta<MetaTypes<AngularRenderer & T, TArgs, Decorators, TMetaArgKeys>, TMetaArgKeys>;
1085
243
  }
1086
- /** Extracts and unions all args types from an array of decorators. */
1087
- type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
1088
244
  /**
1089
245
  * Angular-specific Meta interface returned by `preview.meta()`.
1090
246
  *
@@ -1092,7 +248,7 @@ type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersectio
1092
248
  * provided in meta become optional in stories, while missing required args must be provided at the
1093
249
  * story level.
1094
250
  */
1095
- interface AngularMeta<T extends AngularRenderer, MetaInput extends ComponentAnnotations<T>> extends Meta$1<T, MetaInput> {
251
+ interface AngularMeta<T extends AngularRenderer, TMetaArgKeys extends PropertyKey = never> extends Meta$1<T, TMetaArgKeys> {
1096
252
  /**
1097
253
  * Creates a story with a custom render function that takes no args.
1098
254
  *
@@ -1140,12 +296,12 @@ interface AngularMeta<T extends AngularRenderer, MetaInput extends ComponentAnno
1140
296
  * });
1141
297
  * ```
1142
298
  */
1143
- story<TInput extends Simplify<StoryAnnotations<T, T['args'], SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']>>>>(story: TInput): AngularStory<T, TInput>;
299
+ story<TInput extends Simplify<StoryAnnotations<T, T['args'], StoryArgs<T['args'], TMetaArgKeys>>>>(story: TInput): AngularStory<T, TInput>;
1144
300
  /**
1145
301
  * Creates a story with no additional configuration.
1146
302
  *
1147
303
  * This overload is only available when all required args have been provided in meta. The
1148
- * conditional type `Partial<T['args']> extends SetOptional<...>` checks if the remaining required
304
+ * conditional type `Partial<T['args']> extends StoryArgs<...>` checks if the remaining required
1149
305
  * args (after accounting for args provided in meta) are all optional. If so, the function accepts
1150
306
  * zero arguments `[]`. Otherwise, it requires `[never]` which makes this overload unmatchable,
1151
307
  * forcing the user to provide args.
@@ -1158,7 +314,12 @@ interface AngularMeta<T extends AngularRenderer, MetaInput extends ComponentAnno
1158
314
  * export const Default = meta.story(); // Valid - all args provided in meta
1159
315
  * ```
1160
316
  */
1161
- story(..._args: Partial<T['args']> extends SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']> ? [] : [never]): AngularStory<T, {}>;
317
+ story(..._args: Partial<T['args']> extends StoryArgs<T['args'], TMetaArgKeys> ? [] : [never]): AngularStory<T, {}>;
318
+ /**
319
+ * Add types to the stories created from the returned meta, such as an arg that only one story
320
+ * has: `meta.type<{ args: { icon: string } }>().story({ args: { icon: 'star' } })`.
321
+ */
322
+ type<S>(): AngularMeta<T & S, TypedMetaArgKeys<TMetaArgKeys, S>>;
1162
323
  }
1163
324
  /**
1164
325
  * Angular-specific Story interface returned by `meta.story()`.
@@ -1169,7 +330,7 @@ interface AngularMeta<T extends AngularRenderer, MetaInput extends ComponentAnno
1169
330
  interface AngularStory<T extends AngularRenderer, TInput extends StoryAnnotations<T, T['args']>> extends Story<T, TInput> {}
1170
331
  //#endregion
1171
332
  //#region code/frameworks/angular/.dts-emit/code/frameworks/angular/src/client/decorators.d.ts
1172
- declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularRenderer, TArgs>;
333
+ declare const moduleMetadata: <TArgs = any>(metadata: Partial<NgModuleMetadata> | null | undefined) => DecoratorFunction<AngularRenderer, TArgs>;
1173
334
  /**
1174
335
  * Decorator to set the config options which are available during the application bootstrap
1175
336
  * operation
@@ -1237,4 +398,4 @@ interface ArgsToTemplateOptions<T> {
1237
398
  */
1238
399
  declare function argsToTemplate<A extends Record<string, any>>(args: A, options?: ArgsToTemplateOptions<keyof A>): string;
1239
400
  //#endregion
1240
- export { AngularMeta, AngularOptions, type Parameters$1 as AngularParameters, AngularPreview, type AngularRenderer, AngularStory, type ArgTypes, type Args, Decorator, FrameworkOptions, type StoryFnAngularReturnType as IStory, Loader, Meta, type Parameters$2 as Parameters, Preview, StoryContext, StoryFn, StoryObj, StorybookConfig, type StrictArgs, TransformComponentType, __definePreview, __definePreview as definePreview, applicationConfig, argsToTemplate, componentWrapperDecorator, moduleMetadata, setProjectAnnotations };
401
+ export { AngularMeta, AngularOptions, type Parameters as AngularParameters, AngularPreview, type AngularRenderer, AngularStory, type ArgTypes, type Args, Decorator, FrameworkOptions, type StoryFnAngularReturnType as IStory, Loader, Meta, type Parameters$1 as Parameters, Preview, StoryContext, StoryFn, StoryObj, StorybookConfig, type StrictArgs, TransformComponentType, __definePreview, __definePreview as definePreview, applicationConfig, argsToTemplate, componentWrapperDecorator, moduleMetadata, setProjectAnnotations };