storybook 9.0.0-alpha.2 → 9.0.0-alpha.20

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 (159) hide show
  1. package/README.md +1 -1
  2. package/assets/docs/addon-backgrounds.gif +0 -0
  3. package/assets/docs/addon-controls-args-annotated.png +0 -0
  4. package/assets/docs/addon-controls-args-background-color.png +0 -0
  5. package/assets/docs/addon-controls-args-background-string.png +0 -0
  6. package/assets/docs/addon-controls-args-docs.png +0 -0
  7. package/assets/docs/addon-controls-args-logging.png +0 -0
  8. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  9. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  10. package/assets/docs/addon-controls-args-reflow.png +0 -0
  11. package/assets/docs/addon-controls-args-template.png +0 -0
  12. package/assets/docs/addon-controls-expanded.png +0 -0
  13. package/assets/docs/addon-controls-hero.gif +0 -0
  14. package/assets/docs/addon-controls-install.png +0 -0
  15. package/assets/docs/hero.gif +0 -0
  16. package/assets/docs/highlight.png +0 -0
  17. package/assets/docs/viewport.png +0 -0
  18. package/bin/index.cjs +2 -2
  19. package/dist/actions/decorator.d.ts +6 -0
  20. package/dist/actions/decorator.js +138 -0
  21. package/dist/actions/index.cjs +126 -0
  22. package/dist/actions/index.d.ts +102 -0
  23. package/dist/actions/index.js +111 -0
  24. package/dist/actions/preview.cjs +164 -0
  25. package/dist/actions/preview.d.ts +54 -0
  26. package/dist/actions/preview.js +155 -0
  27. package/dist/backgrounds/index.cjs +148 -0
  28. package/dist/backgrounds/index.d.ts +91 -0
  29. package/dist/backgrounds/index.js +130 -0
  30. package/dist/backgrounds/preview.cjs +143 -0
  31. package/dist/backgrounds/preview.d.ts +54 -0
  32. package/dist/backgrounds/preview.js +127 -0
  33. package/dist/bin/index.cjs +66 -89
  34. package/dist/bin/index.js +62 -85
  35. package/dist/builder-manager/index.cjs +523 -540
  36. package/dist/builder-manager/index.js +544 -561
  37. package/dist/channels/index.cjs +1026 -981
  38. package/dist/channels/index.js +1194 -1165
  39. package/dist/cli/bin/index.cjs +483 -483
  40. package/dist/cli/bin/index.js +495 -495
  41. package/dist/cli/index.cjs +2279 -2295
  42. package/dist/cli/index.d.ts +4 -8
  43. package/dist/cli/index.js +740 -756
  44. package/dist/client-logger/index.cjs +56 -88
  45. package/dist/client-logger/index.js +41 -47
  46. package/dist/common/index.cjs +2496 -2480
  47. package/dist/common/index.d.ts +5 -29
  48. package/dist/common/index.js +2679 -2663
  49. package/dist/component-testing/index.cjs +23 -0
  50. package/dist/component-testing/index.d.ts +3 -0
  51. package/dist/component-testing/index.js +5 -0
  52. package/dist/component-testing/preview.cjs +40 -0
  53. package/dist/component-testing/preview.d.ts +5 -0
  54. package/dist/component-testing/preview.js +25 -0
  55. package/dist/components/index.cjs +11709 -20418
  56. package/dist/components/index.d.ts +94 -346
  57. package/dist/components/index.js +5827 -19157
  58. package/dist/controls/decorator.d.ts +5 -0
  59. package/dist/controls/decorator.js +8 -0
  60. package/dist/controls/index.cjs +26 -0
  61. package/dist/controls/index.d.ts +39 -0
  62. package/dist/controls/index.js +6 -0
  63. package/dist/controls/preview.cjs +26 -0
  64. package/dist/controls/preview.d.ts +54 -0
  65. package/dist/controls/preview.js +9 -0
  66. package/dist/core-events/index.cjs +91 -106
  67. package/dist/core-events/index.d.ts +139 -104
  68. package/dist/core-events/index.js +79 -94
  69. package/dist/core-server/index.cjs +14413 -13924
  70. package/dist/core-server/index.d.ts +270 -3
  71. package/dist/core-server/index.js +14003 -13519
  72. package/dist/core-server/presets/common-manager.css +170 -0
  73. package/dist/core-server/presets/common-manager.js +12099 -17
  74. package/dist/core-server/presets/common-preset.cjs +2760 -2914
  75. package/dist/core-server/presets/common-preset.js +2852 -3007
  76. package/dist/csf/index.cjs +76 -120
  77. package/dist/csf/index.d.ts +2 -6
  78. package/dist/csf/index.js +69 -113
  79. package/dist/csf-tools/index.cjs +412 -403
  80. package/dist/csf-tools/index.d.ts +0 -4
  81. package/dist/csf-tools/index.js +410 -401
  82. package/dist/docs-tools/index.cjs +2569 -575
  83. package/dist/docs-tools/index.d.ts +2 -2
  84. package/dist/docs-tools/index.js +2557 -564
  85. package/dist/highlight/index.cjs +27 -0
  86. package/dist/highlight/index.d.ts +17 -0
  87. package/dist/highlight/index.js +7 -0
  88. package/dist/highlight/preview.cjs +81 -0
  89. package/dist/highlight/preview.d.ts +54 -0
  90. package/dist/highlight/preview.js +67 -0
  91. package/dist/instrumenter/index.cjs +2207 -2342
  92. package/dist/instrumenter/index.d.ts +8 -7
  93. package/dist/instrumenter/index.js +2438 -2620
  94. package/dist/manager/globals-module-info.cjs +290 -151
  95. package/dist/manager/globals-module-info.d.ts +1 -1
  96. package/dist/manager/globals-module-info.js +274 -135
  97. package/dist/manager/globals-runtime.js +60016 -28331
  98. package/dist/manager/globals.cjs +23 -19
  99. package/dist/manager/globals.d.ts +8 -5
  100. package/dist/manager/globals.js +10 -6
  101. package/dist/manager/runtime.js +4645 -3946
  102. package/dist/manager-api/index.cjs +4228 -3833
  103. package/dist/manager-api/index.d.ts +398 -102
  104. package/dist/manager-api/index.js +3676 -3291
  105. package/dist/manager-errors.d.ts +25 -1
  106. package/dist/manager-errors.js +42 -26
  107. package/dist/measure/index.cjs +474 -0
  108. package/dist/measure/index.d.ts +66 -0
  109. package/dist/measure/index.js +462 -0
  110. package/dist/measure/preview.cjs +464 -0
  111. package/dist/measure/preview.d.ts +59 -0
  112. package/dist/measure/preview.js +448 -0
  113. package/dist/outline/index.cjs +528 -0
  114. package/dist/outline/index.d.ts +66 -0
  115. package/dist/outline/index.js +500 -0
  116. package/dist/outline/preview.cjs +518 -0
  117. package/dist/outline/preview.d.ts +59 -0
  118. package/dist/outline/preview.js +486 -0
  119. package/dist/preview/globals.cjs +21 -17
  120. package/dist/preview/globals.d.ts +4 -1
  121. package/dist/preview/globals.js +6 -2
  122. package/dist/preview/runtime.js +45697 -6618
  123. package/dist/preview-api/index.cjs +1363 -1898
  124. package/dist/preview-api/index.d.ts +449 -498
  125. package/dist/preview-api/index.js +1622 -2095
  126. package/dist/preview-errors.cjs +99 -82
  127. package/dist/preview-errors.d.ts +25 -1
  128. package/dist/preview-errors.js +110 -94
  129. package/dist/router/index.cjs +847 -871
  130. package/dist/router/index.js +193 -199
  131. package/dist/server-errors.cjs +156 -125
  132. package/dist/server-errors.d.ts +28 -2
  133. package/dist/server-errors.js +150 -119
  134. package/dist/telemetry/index.cjs +1050 -1977
  135. package/dist/telemetry/index.d.ts +26 -5
  136. package/dist/telemetry/index.js +1085 -2008
  137. package/dist/test/index.cjs +35686 -0
  138. package/dist/test/index.d.ts +186 -0
  139. package/dist/test/index.js +33752 -0
  140. package/dist/test/preview.cjs +15870 -0
  141. package/dist/test/preview.d.ts +54 -0
  142. package/dist/test/preview.js +14441 -0
  143. package/dist/test/spy.cjs +258 -0
  144. package/dist/test/spy.d.ts +66 -0
  145. package/dist/test/spy.js +240 -0
  146. package/dist/theming/create.cjs +79 -2269
  147. package/dist/theming/create.js +67 -841
  148. package/dist/theming/index.cjs +1065 -3232
  149. package/dist/theming/index.js +951 -1719
  150. package/dist/types/index.cjs +11 -12
  151. package/dist/types/index.d.ts +612 -157
  152. package/dist/types/index.js +1 -2
  153. package/dist/viewport/index.cjs +310 -0
  154. package/dist/viewport/index.d.ts +320 -0
  155. package/dist/viewport/index.js +290 -0
  156. package/dist/viewport/preview.cjs +35 -0
  157. package/dist/viewport/preview.d.ts +68 -0
  158. package/dist/viewport/preview.js +19 -0
  159. package/package.json +359 -12
@@ -0,0 +1,186 @@
1
+ import { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
2
+ import { AsymmetricMatchersContaining, JestAssertion, ExpectStatic, MatchersObject, MatcherState } from '@vitest/expect';
3
+ import * as domTestingLibrary from '@testing-library/dom';
4
+ import { BoundFunctions } from '@testing-library/dom';
5
+ import _userEvent, { userEvent as userEvent$1 } from '@testing-library/user-event';
6
+ import { MockInstance, spyOn as spyOn$1, Mock as Mock$1, MaybeMocked, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep } from '@vitest/spy';
7
+ export * from '@vitest/spy';
8
+ export { isMockFunction, mocks } from '@vitest/spy';
9
+
10
+ type Promisify<Fn> = Fn extends (...args: infer A) => infer R ? (...args: A) => R extends Promise<any> ? R : Promise<R> : Fn;
11
+ type PromisifyObject<O> = {
12
+ [K in keyof O]: Promisify<O[K]>;
13
+ };
14
+
15
+ type Matchers<T> = PromisifyObject<JestAssertion<T>> & TestingLibraryMatchers<ReturnType<ExpectStatic['stringContaining']>, Promise<void>>;
16
+ interface Assertion<T> extends Matchers<T> {
17
+ toHaveBeenCalledOnce(): Promise<void>;
18
+ toSatisfy<E>(matcher: (value: E) => boolean, message?: string): Promise<void>;
19
+ resolves: Assertion<T>;
20
+ rejects: Assertion<T>;
21
+ not: Assertion<T>;
22
+ }
23
+ interface Expect extends AsymmetricMatchersContaining {
24
+ <T>(actual: T, message?: string): Assertion<T>;
25
+ unreachable(message?: string): Promise<never>;
26
+ soft<T>(actual: T, message?: string): Assertion<T>;
27
+ extend(expects: MatchersObject): void;
28
+ assertions(expected: number): Promise<void>;
29
+ hasAssertions(): Promise<void>;
30
+ anything(): any;
31
+ any(constructor: unknown): any;
32
+ getState(): MatcherState;
33
+ setState(state: Partial<MatcherState>): void;
34
+ not: AsymmetricMatchersContaining;
35
+ }
36
+
37
+ declare const buildQueries: typeof domTestingLibrary.buildQueries;
38
+ declare const configure: typeof domTestingLibrary.configure;
39
+ declare const createEvent: domTestingLibrary.CreateObject & domTestingLibrary.CreateFunction;
40
+ declare const fireEvent: ((element: Element | Node | Document | Window, event: Event) => Promise<false> | Promise<true>) & PromisifyObject<domTestingLibrary.FireObject>;
41
+ declare const findAllByAltText: typeof domTestingLibrary.findAllByAltText;
42
+ declare const findAllByDisplayValue: typeof domTestingLibrary.findAllByDisplayValue;
43
+ declare const findAllByLabelText: typeof domTestingLibrary.findAllByLabelText;
44
+ declare const findAllByPlaceholderText: typeof domTestingLibrary.findAllByPlaceholderText;
45
+ declare const findAllByRole: typeof domTestingLibrary.findAllByRole;
46
+ declare const findAllByTestId: typeof domTestingLibrary.findAllByTestId;
47
+ declare const findAllByText: typeof domTestingLibrary.findAllByText;
48
+ declare const findAllByTitle: typeof domTestingLibrary.findAllByTitle;
49
+ declare const findByAltText: typeof domTestingLibrary.findByAltText;
50
+ declare const findByDisplayValue: typeof domTestingLibrary.findByDisplayValue;
51
+ declare const findByLabelText: typeof domTestingLibrary.findByLabelText;
52
+ declare const findByPlaceholderText: typeof domTestingLibrary.findByPlaceholderText;
53
+ declare const findByRole: typeof domTestingLibrary.findByRole;
54
+ declare const findByTestId: typeof domTestingLibrary.findByTestId;
55
+ declare const findByText: typeof domTestingLibrary.findByText;
56
+ declare const findByTitle: typeof domTestingLibrary.findByTitle;
57
+ declare const getAllByAltText: typeof domTestingLibrary.getAllByAltText;
58
+ declare const getAllByDisplayValue: typeof domTestingLibrary.getAllByDisplayValue;
59
+ declare const getAllByLabelText: typeof domTestingLibrary.getAllByLabelText;
60
+ declare const getAllByPlaceholderText: typeof domTestingLibrary.getAllByPlaceholderText;
61
+ declare const getAllByRole: typeof domTestingLibrary.getAllByRole;
62
+ declare const getAllByTestId: typeof domTestingLibrary.getAllByTestId;
63
+ declare const getAllByText: typeof domTestingLibrary.getAllByText;
64
+ declare const getAllByTitle: typeof domTestingLibrary.getAllByTitle;
65
+ declare const getByAltText: typeof domTestingLibrary.getByAltText;
66
+ declare const getByDisplayValue: typeof domTestingLibrary.getByDisplayValue;
67
+ declare const getByLabelText: typeof domTestingLibrary.getByLabelText;
68
+ declare const getByPlaceholderText: typeof domTestingLibrary.getByPlaceholderText;
69
+ declare const getByRole: typeof domTestingLibrary.getByRole;
70
+ declare const getByTestId: typeof domTestingLibrary.getByTestId;
71
+ declare const getByText: typeof domTestingLibrary.getByText;
72
+ declare const getByTitle: typeof domTestingLibrary.getByTitle;
73
+ declare const getConfig: typeof domTestingLibrary.getConfig;
74
+ declare const getDefaultNormalizer: typeof domTestingLibrary.getDefaultNormalizer;
75
+ declare const getElementError: typeof domTestingLibrary.getElementError;
76
+ declare const getNodeText: typeof domTestingLibrary.getNodeText;
77
+ declare const getQueriesForElement: typeof domTestingLibrary.getQueriesForElement;
78
+ declare const getRoles: typeof domTestingLibrary.getRoles;
79
+ declare const getSuggestedQuery: typeof domTestingLibrary.getSuggestedQuery;
80
+ declare const isInaccessible: typeof domTestingLibrary.isInaccessible;
81
+ declare const logDOM: typeof domTestingLibrary.logDOM;
82
+ declare const logRoles: typeof domTestingLibrary.logRoles;
83
+ declare const prettyDOM: typeof domTestingLibrary.prettyDOM;
84
+ declare const queries: typeof domTestingLibrary.queries;
85
+ declare const queryAllByAltText: typeof domTestingLibrary.queryAllByAltText;
86
+ declare const queryAllByAttribute: domTestingLibrary.AllByAttribute;
87
+ declare const queryAllByDisplayValue: typeof domTestingLibrary.queryAllByDisplayValue;
88
+ declare const queryAllByLabelText: typeof domTestingLibrary.queryAllByLabelText;
89
+ declare const queryAllByPlaceholderText: typeof domTestingLibrary.queryAllByPlaceholderText;
90
+ declare const queryAllByRole: typeof domTestingLibrary.queryAllByRole;
91
+ declare const queryAllByTestId: typeof domTestingLibrary.queryAllByTestId;
92
+ declare const queryAllByText: typeof domTestingLibrary.queryAllByText;
93
+ declare const queryAllByTitle: typeof domTestingLibrary.queryAllByTitle;
94
+ declare const queryByAltText: typeof domTestingLibrary.queryByAltText;
95
+ declare const queryByAttribute: domTestingLibrary.QueryByAttribute;
96
+ declare const queryByDisplayValue: typeof domTestingLibrary.queryByDisplayValue;
97
+ declare const queryByLabelText: typeof domTestingLibrary.queryByLabelText;
98
+ declare const queryByPlaceholderText: typeof domTestingLibrary.queryByPlaceholderText;
99
+ declare const queryByRole: typeof domTestingLibrary.queryByRole;
100
+ declare const queryByTestId: typeof domTestingLibrary.queryByTestId;
101
+ declare const queryByText: typeof domTestingLibrary.queryByText;
102
+ declare const queryByTitle: typeof domTestingLibrary.queryByTitle;
103
+ declare const queryHelpers: typeof domTestingLibrary.queryHelpers;
104
+ declare const screen: domTestingLibrary.Screen<typeof domTestingLibrary.queries>;
105
+ declare const waitFor: typeof domTestingLibrary.waitFor;
106
+ declare const waitForElementToBeRemoved: typeof domTestingLibrary.waitForElementToBeRemoved;
107
+ declare const within: typeof domTestingLibrary.getQueriesForElement;
108
+ declare const prettyFormat: typeof domTestingLibrary.prettyFormat;
109
+ type _UserEvent = typeof _userEvent;
110
+ interface UserEvent extends _UserEvent {
111
+ }
112
+ declare const userEvent: UserEvent;
113
+
114
+ type Listener = (mock: MockInstance, args: unknown[]) => void;
115
+ declare function onMockCall(callback: Listener): () => void;
116
+ declare const spyOn: typeof spyOn$1;
117
+ type Procedure = (...args: any[]) => any;
118
+ type Mock<T extends Procedure | any[] = any[], R = any> = T extends Procedure ? Mock$1<T> : T extends any[] ? Mock$1<(...args: T) => R> : never;
119
+ declare function fn<T extends Procedure = Procedure>(implementation?: T): Mock<T>;
120
+ declare function fn<TArgs extends any[] = any, R = any>(): Mock<(...args: TArgs) => R>;
121
+ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
122
+ declare function fn<TArgs extends any[] = any[], R = any>(implementation?: (...args: TArgs) => R): Mock<(...args: TArgs) => R>;
123
+ /**
124
+ * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will
125
+ * only empty `.mock` state, it will not reset implementation.
126
+ *
127
+ * It is useful if you need to clean up mock between different assertions.
128
+ */
129
+ declare function clearAllMocks(): void;
130
+ /**
131
+ * Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will
132
+ * empty `.mock` state, reset "once" implementations and force the base implementation to return
133
+ * `undefined` when invoked.
134
+ *
135
+ * This is useful when you want to completely reset a mock to the default state.
136
+ */
137
+ declare function resetAllMocks(): void;
138
+ /**
139
+ * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This
140
+ * will restore all original implementations.
141
+ */
142
+ declare function restoreAllMocks(): void;
143
+ /**
144
+ * Type helper for TypeScript. Just returns the object that was passed.
145
+ *
146
+ * When `partial` is `true` it will expect a `Partial<T>` as a return value. By default, this will
147
+ * only make TypeScript believe that the first level values are mocked. You can pass down `{ deep:
148
+ * true }` as a second argument to tell TypeScript that the whole object is mocked, if it actually
149
+ * is.
150
+ *
151
+ * @param item Anything that can be mocked
152
+ * @param deep If the object is deeply mocked
153
+ * @param options If the object is partially or deeply mocked
154
+ */
155
+ declare function mocked<T>(item: T, deep?: false): MaybeMocked<T>;
156
+ declare function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
157
+ declare function mocked<T>(item: T, options: {
158
+ partial?: false;
159
+ deep?: false;
160
+ }): MaybeMocked<T>;
161
+ declare function mocked<T>(item: T, options: {
162
+ partial?: false;
163
+ deep: true;
164
+ }): MaybeMockedDeep<T>;
165
+ declare function mocked<T>(item: T, options: {
166
+ partial: true;
167
+ deep?: false;
168
+ }): MaybePartiallyMocked<T>;
169
+ declare function mocked<T>(item: T, options: {
170
+ partial: true;
171
+ deep: true;
172
+ }): MaybePartiallyMockedDeep<T>;
173
+ declare function mocked<T>(item: T): MaybeMocked<T>;
174
+
175
+ type Queries = BoundFunctions<typeof queries>;
176
+ type UserEventObject = ReturnType<typeof userEvent$1.setup>;
177
+ declare module 'storybook/internal/csf' {
178
+ interface Canvas extends Queries {
179
+ }
180
+ interface StoryContext {
181
+ userEvent: UserEventObject;
182
+ }
183
+ }
184
+ declare const expect: Expect;
185
+
186
+ export { type Mock, type UserEvent, type UserEventObject, buildQueries, clearAllMocks, configure, createEvent, expect, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, fn, getAllByAltText, getAllByDisplayValue, getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getNodeText, getQueriesForElement, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, mocked, onMockCall, prettyDOM, prettyFormat, queries, queryAllByAltText, queryAllByAttribute, queryAllByDisplayValue, queryAllByLabelText, queryAllByPlaceholderText, queryAllByRole, queryAllByTestId, queryAllByText, queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, resetAllMocks, restoreAllMocks, screen, spyOn, userEvent, waitFor, waitForElementToBeRemoved, within };