1 | import { AnnotatedStoryFn, Args, ComponentAnnotations, DecoratorFunction, LoaderFunction, StoryAnnotations, StoryContext as GenericStoryContext, StrictArgs, ProjectAnnotations } from 'storybook/internal/types';
|
2 | import * as AngularCore from '@angular/core';
|
3 | import { AngularRenderer } from './types';
|
4 | export type { Args, ArgTypes, Parameters, StrictArgs } from 'storybook/internal/types';
|
5 | export type { Parameters as AngularParameters } from './types';
|
6 | export type { AngularRenderer };
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export type Meta<TArgs = Args> = ComponentAnnotations<AngularRenderer, TransformComponentType<TArgs>>;
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export type StoryFn<TArgs = Args> = AnnotatedStoryFn<AngularRenderer, TransformComponentType<TArgs>>;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export type StoryObj<TArgs = Args> = StoryAnnotations<AngularRenderer, TransformComponentType<TArgs>>;
|
25 | export type Decorator<TArgs = StrictArgs> = DecoratorFunction<AngularRenderer, TArgs>;
|
26 | export type Loader<TArgs = StrictArgs> = LoaderFunction<AngularRenderer, TArgs>;
|
27 | export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<AngularRenderer, TArgs>;
|
28 | export type Preview = ProjectAnnotations<AngularRenderer>;
|
29 |
|
30 |
|
31 |
|
32 | type TransformComponentType<T> = TransformInputSignalType<TransformOutputSignalType<TransformEventType<T>>>;
|
33 |
|
34 | type AngularInputSignal<T> = AngularCore.InputSignal<T>;
|
35 |
|
36 | type AngularInputSignalWithTransform<T, U> = AngularCore.InputSignalWithTransform<T, U>;
|
37 |
|
38 | type AngularOutputEmitterRef<T> = AngularCore.OutputEmitterRef<T>;
|
39 | type AngularHasInputSignal = typeof AngularCore extends {
|
40 | input: infer U;
|
41 | } ? true : false;
|
42 | type AngularHasOutputSignal = typeof AngularCore extends {
|
43 | output: infer U;
|
44 | } ? true : false;
|
45 | type InputSignal<T> = AngularHasInputSignal extends true ? AngularInputSignal<T> : never;
|
46 | type InputSignalWithTransform<T, U> = AngularHasInputSignal extends true ? AngularInputSignalWithTransform<T, U> : never;
|
47 | type OutputEmitterRef<T> = AngularHasOutputSignal extends true ? AngularOutputEmitterRef<T> : never;
|
48 | type TransformInputSignalType<T> = {
|
49 | [K in keyof T]: T[K] extends InputSignal<infer E> ? E : T[K] extends InputSignalWithTransform<any, infer U> ? U : T[K];
|
50 | };
|
51 | type TransformOutputSignalType<T> = {
|
52 | [K in keyof T]: T[K] extends OutputEmitterRef<infer E> ? (e: E) => void : T[K];
|
53 | };
|
54 | type TransformEventType<T> = {
|
55 | [K in keyof T]: T[K] extends AngularCore.EventEmitter<infer E> ? (e: E) => void : T[K];
|
56 | };
|