storybook 9.0.0-alpha.2 → 9.0.0-alpha.4

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.
Files changed (79) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/decorator.d.ts +6 -0
  3. package/dist/actions/decorator.js +139 -0
  4. package/dist/actions/index.cjs +127 -0
  5. package/dist/actions/index.d.ts +105 -0
  6. package/dist/actions/index.js +112 -0
  7. package/dist/actions/manager.js +1196 -0
  8. package/dist/actions/preview.cjs +165 -0
  9. package/dist/actions/preview.d.ts +55 -0
  10. package/dist/actions/preview.js +156 -0
  11. package/dist/bin/index.cjs +63 -65
  12. package/dist/bin/index.js +63 -65
  13. package/dist/channels/index.cjs +209 -234
  14. package/dist/channels/index.js +304 -308
  15. package/dist/cli/bin/index.cjs +409 -409
  16. package/dist/cli/bin/index.js +414 -414
  17. package/dist/cli/index.cjs +1 -1
  18. package/dist/cli/index.d.ts +2 -2
  19. package/dist/cli/index.js +1 -1
  20. package/dist/client-logger/index.cjs +56 -88
  21. package/dist/client-logger/index.js +41 -47
  22. package/dist/common/index.cjs +148 -148
  23. package/dist/common/index.d.ts +1 -5
  24. package/dist/common/index.js +171 -171
  25. package/dist/components/index.cjs +9413 -11578
  26. package/dist/components/index.d.ts +92 -92
  27. package/dist/components/index.js +6768 -7544
  28. package/dist/core-events/index.d.ts +138 -25
  29. package/dist/core-server/index.cjs +5244 -5270
  30. package/dist/core-server/index.d.ts +1 -1
  31. package/dist/core-server/index.js +5356 -5380
  32. package/dist/core-server/presets/common-manager.js +11 -19
  33. package/dist/core-server/presets/common-preset.cjs +243 -242
  34. package/dist/core-server/presets/common-preset.js +379 -378
  35. package/dist/csf/index.cjs +76 -120
  36. package/dist/csf/index.d.ts +1 -3
  37. package/dist/csf/index.js +69 -113
  38. package/dist/docs-tools/index.cjs +1 -1
  39. package/dist/docs-tools/index.d.ts +2 -2
  40. package/dist/docs-tools/index.js +1 -1
  41. package/dist/instrumenter/index.cjs +1260 -1289
  42. package/dist/instrumenter/index.js +1344 -1348
  43. package/dist/manager/globals-module-info.cjs +272 -135
  44. package/dist/manager/globals-module-info.d.ts +1 -1
  45. package/dist/manager/globals-module-info.js +257 -120
  46. package/dist/manager/globals-runtime.js +59553 -22373
  47. package/dist/manager/globals.cjs +23 -19
  48. package/dist/manager/globals.d.ts +8 -5
  49. package/dist/manager/globals.js +10 -6
  50. package/dist/manager/runtime.js +129 -129
  51. package/dist/manager-api/index.cjs +1184 -1209
  52. package/dist/manager-api/index.d.ts +3 -3
  53. package/dist/manager-api/index.js +1012 -1012
  54. package/dist/preview/globals.cjs +21 -17
  55. package/dist/preview/globals.d.ts +4 -1
  56. package/dist/preview/globals.js +6 -2
  57. package/dist/preview/runtime.js +43946 -6548
  58. package/dist/preview-api/index.cjs +1245 -1243
  59. package/dist/preview-api/index.d.ts +105 -61
  60. package/dist/preview-api/index.js +1311 -1273
  61. package/dist/preview-errors.cjs +1 -1
  62. package/dist/preview-errors.js +1 -1
  63. package/dist/router/index.cjs +847 -871
  64. package/dist/router/index.js +193 -199
  65. package/dist/test/index.cjs +34778 -0
  66. package/dist/test/index.d.ts +186 -0
  67. package/dist/test/index.js +32916 -0
  68. package/dist/test/preview.cjs +15870 -0
  69. package/dist/test/preview.d.ts +54 -0
  70. package/dist/test/preview.js +14441 -0
  71. package/dist/test/spy.cjs +258 -0
  72. package/dist/test/spy.d.ts +66 -0
  73. package/dist/test/spy.js +240 -0
  74. package/dist/theming/create.cjs +79 -2269
  75. package/dist/theming/create.js +67 -841
  76. package/dist/theming/index.cjs +1065 -3232
  77. package/dist/theming/index.js +951 -1719
  78. package/dist/types/index.d.ts +242 -242
  79. package/package.json +155 -3
@@ -1,5 +1,5 @@
1
- import { ArgTypes } from 'storybook/internal/csf';
2
- import { Addon_TestProviderType, Addon_TestProviderState, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn } from 'storybook/internal/types';
1
+ import { Addon_TestProviderType, Addon_TestProviderState } from 'storybook/internal/types';
2
+ import { Report } from 'storybook/preview-api';
3
3
 
4
4
  interface CreateNewStoryRequestPayload {
5
5
  componentFilePath: string;
@@ -30,6 +30,142 @@ interface FileComponentSearchResponsePayload {
30
30
  }> | null;
31
31
  }
32
32
 
33
+ declare global {
34
+ interface SymbolConstructor {
35
+ readonly observable: symbol;
36
+ }
37
+ }
38
+
39
+ interface SBBaseType {
40
+ required?: boolean;
41
+ raw?: string;
42
+ }
43
+ type SBScalarType = SBBaseType & {
44
+ name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
45
+ };
46
+ type SBArrayType = SBBaseType & {
47
+ name: 'array';
48
+ value: SBType;
49
+ };
50
+ type SBObjectType = SBBaseType & {
51
+ name: 'object';
52
+ value: Record<string, SBType>;
53
+ };
54
+ type SBEnumType = SBBaseType & {
55
+ name: 'enum';
56
+ value: (string | number)[];
57
+ };
58
+ type SBIntersectionType = SBBaseType & {
59
+ name: 'intersection';
60
+ value: SBType[];
61
+ };
62
+ type SBUnionType = SBBaseType & {
63
+ name: 'union';
64
+ value: SBType[];
65
+ };
66
+ type SBOtherType = SBBaseType & {
67
+ name: 'other';
68
+ value: string;
69
+ };
70
+ type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
71
+
72
+ type ControlType = 'object' | 'boolean' | 'check' | 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select' | 'number' | 'range' | 'file' | 'color' | 'date' | 'text';
73
+ type ConditionalTest = {
74
+ truthy?: boolean;
75
+ } | {
76
+ exists: boolean;
77
+ } | {
78
+ eq: any;
79
+ } | {
80
+ neq: any;
81
+ };
82
+ type ConditionalValue = {
83
+ arg: string;
84
+ } | {
85
+ global: string;
86
+ };
87
+ type Conditional = ConditionalValue & ConditionalTest;
88
+ interface ControlBase {
89
+ [key: string]: any;
90
+ /** @see https://storybook.js.org/docs/api/arg-types#controltype */
91
+ type?: ControlType;
92
+ disable?: boolean;
93
+ }
94
+ type Control = ControlType | false | (ControlBase & (ControlBase | {
95
+ type: 'color';
96
+ /** @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors */
97
+ presetColors?: string[];
98
+ } | {
99
+ type: 'file';
100
+ /** @see https://storybook.js.org/docs/api/arg-types#controlaccept */
101
+ accept?: string;
102
+ } | {
103
+ type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select';
104
+ /** @see https://storybook.js.org/docs/api/arg-types#controllabels */
105
+ labels?: {
106
+ [options: string]: string;
107
+ };
108
+ } | {
109
+ type: 'number' | 'range';
110
+ /** @see https://storybook.js.org/docs/api/arg-types#controlmax */
111
+ max?: number;
112
+ /** @see https://storybook.js.org/docs/api/arg-types#controlmin */
113
+ min?: number;
114
+ /** @see https://storybook.js.org/docs/api/arg-types#controlstep */
115
+ step?: number;
116
+ }));
117
+ interface InputType {
118
+ /** @see https://storybook.js.org/docs/api/arg-types#control */
119
+ control?: Control;
120
+ /** @see https://storybook.js.org/docs/api/arg-types#description */
121
+ description?: string;
122
+ /** @see https://storybook.js.org/docs/api/arg-types#if */
123
+ if?: Conditional;
124
+ /** @see https://storybook.js.org/docs/api/arg-types#mapping */
125
+ mapping?: {
126
+ [key: string]: any;
127
+ };
128
+ /** @see https://storybook.js.org/docs/api/arg-types#name */
129
+ name?: string;
130
+ /** @see https://storybook.js.org/docs/api/arg-types#options */
131
+ options?: readonly any[];
132
+ /** @see https://storybook.js.org/docs/api/arg-types#table */
133
+ table?: {
134
+ [key: string]: unknown;
135
+ /** @see https://storybook.js.org/docs/api/arg-types#tablecategory */
136
+ category?: string;
137
+ /** @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue */
138
+ defaultValue?: {
139
+ summary?: string;
140
+ detail?: string;
141
+ };
142
+ /** @see https://storybook.js.org/docs/api/arg-types#tabledisable */
143
+ disable?: boolean;
144
+ /** @see https://storybook.js.org/docs/api/arg-types#tablesubcategory */
145
+ subcategory?: string;
146
+ /** @see https://storybook.js.org/docs/api/arg-types#tabletype */
147
+ type?: {
148
+ summary?: string;
149
+ detail?: string;
150
+ };
151
+ };
152
+ /** @see https://storybook.js.org/docs/api/arg-types#type */
153
+ type?: SBType | SBScalarType['name'];
154
+ /**
155
+ * @deprecated Use `table.defaultValue.summary` instead.
156
+ * @see https://storybook.js.org/docs/api/arg-types#defaultvalue
157
+ */
158
+ defaultValue?: any;
159
+ [key: string]: any;
160
+ }
161
+ interface Args {
162
+ [name: string]: any;
163
+ }
164
+ /** @see https://storybook.js.org/docs/api/arg-types#argtypes */
165
+ type ArgTypes<TArgs = Args> = {
166
+ [name in keyof TArgs]: InputType;
167
+ };
168
+
33
169
  interface ArgTypesRequestPayload {
34
170
  storyId: string;
35
171
  }
@@ -152,29 +288,6 @@ type TestingModuleCancelTestRunResponsePayload = {
152
288
  message: string;
153
289
  };
154
290
 
155
- declare global {
156
- var globalProjectAnnotations: NormalizedProjectAnnotations<any>;
157
- var defaultProjectAnnotations: ProjectAnnotations<any>;
158
- }
159
- type WrappedStoryRef = {
160
- __pw_type: 'jsx' | 'importRef';
161
- };
162
- type UnwrappedJSXStoryRef = {
163
- __pw_type: 'jsx';
164
- type: UnwrappedImportStoryRef;
165
- };
166
- type UnwrappedImportStoryRef = ComposedStoryFn;
167
- declare global {
168
- function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise<UnwrappedJSXStoryRef | UnwrappedImportStoryRef>;
169
- }
170
-
171
- interface Report<T = unknown> {
172
- type: string;
173
- version?: number;
174
- result: T;
175
- status: 'failed' | 'passed' | 'warning';
176
- }
177
-
178
291
  interface StoryFinishedPayload {
179
292
  storyId: string;
180
293
  status: 'error' | 'success';