storybook 9.0.0-alpha.11 → 9.0.0-alpha.13

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 (93) hide show
  1. package/assets/docs/addon-backgrounds.gif +0 -0
  2. package/assets/docs/highlight.png +0 -0
  3. package/bin/index.cjs +2 -2
  4. package/dist/actions/preview.d.ts +0 -1
  5. package/dist/backgrounds/index.cjs +148 -0
  6. package/dist/backgrounds/index.d.ts +91 -0
  7. package/dist/backgrounds/index.js +130 -0
  8. package/dist/backgrounds/preview.cjs +143 -0
  9. package/dist/backgrounds/preview.d.ts +54 -0
  10. package/dist/backgrounds/preview.js +127 -0
  11. package/dist/bin/index.cjs +49 -61
  12. package/dist/bin/index.js +49 -61
  13. package/dist/builder-manager/index.cjs +390 -380
  14. package/dist/builder-manager/index.js +489 -479
  15. package/dist/channels/index.cjs +17 -17
  16. package/dist/channels/index.js +3 -3
  17. package/dist/cli/bin/index.cjs +225 -225
  18. package/dist/cli/bin/index.js +234 -234
  19. package/dist/cli/index.cjs +1904 -1909
  20. package/dist/cli/index.d.ts +3 -7
  21. package/dist/cli/index.js +734 -739
  22. package/dist/common/index.cjs +2401 -2388
  23. package/dist/common/index.d.ts +1 -13
  24. package/dist/common/index.js +2609 -2596
  25. package/dist/components/index.cjs +5701 -5946
  26. package/dist/components/index.d.ts +3 -254
  27. package/dist/components/index.js +7271 -13724
  28. package/dist/controls/preview.d.ts +0 -1
  29. package/dist/core-events/index.cjs +91 -106
  30. package/dist/core-events/index.d.ts +2 -80
  31. package/dist/core-events/index.js +79 -94
  32. package/dist/core-server/index.cjs +5221 -5122
  33. package/dist/core-server/index.d.ts +32 -23
  34. package/dist/core-server/index.js +6511 -6412
  35. package/dist/core-server/presets/common-manager.js +9815 -12
  36. package/dist/core-server/presets/common-preset.cjs +2817 -2989
  37. package/dist/core-server/presets/common-preset.js +2896 -3068
  38. package/dist/csf/index.d.ts +0 -2
  39. package/dist/csf-tools/index.cjs +0 -8
  40. package/dist/csf-tools/index.d.ts +0 -4
  41. package/dist/csf-tools/index.js +0 -8
  42. package/dist/docs-tools/index.cjs +626 -600
  43. package/dist/docs-tools/index.js +613 -587
  44. package/dist/highlight/index.cjs +27 -0
  45. package/dist/highlight/index.d.ts +17 -0
  46. package/dist/highlight/index.js +7 -0
  47. package/dist/highlight/preview.cjs +81 -0
  48. package/dist/highlight/preview.d.ts +54 -0
  49. package/dist/highlight/preview.js +67 -0
  50. package/dist/instrumenter/index.cjs +70 -60
  51. package/dist/instrumenter/index.d.ts +8 -7
  52. package/dist/instrumenter/index.js +98 -88
  53. package/dist/manager/globals-module-info.cjs +21 -33
  54. package/dist/manager/globals-module-info.js +6 -18
  55. package/dist/manager/globals-runtime.js +22671 -22006
  56. package/dist/manager/runtime.js +4996 -4581
  57. package/dist/manager-api/index.cjs +1289 -1384
  58. package/dist/manager-api/index.d.ts +109 -114
  59. package/dist/manager-api/index.js +920 -1021
  60. package/dist/measure/index.cjs +474 -0
  61. package/dist/measure/index.d.ts +66 -0
  62. package/dist/measure/index.js +462 -0
  63. package/dist/measure/preview.cjs +464 -0
  64. package/dist/measure/preview.d.ts +59 -0
  65. package/dist/measure/preview.js +448 -0
  66. package/dist/outline/index.cjs +528 -0
  67. package/dist/outline/index.d.ts +66 -0
  68. package/dist/outline/index.js +500 -0
  69. package/dist/outline/preview.cjs +518 -0
  70. package/dist/outline/preview.d.ts +59 -0
  71. package/dist/outline/preview.js +486 -0
  72. package/dist/preview/runtime.js +14340 -13357
  73. package/dist/preview-api/index.cjs +1201 -1321
  74. package/dist/preview-api/index.d.ts +66 -120
  75. package/dist/preview-api/index.js +1546 -1665
  76. package/dist/telemetry/index.d.ts +1 -1
  77. package/dist/test/index.cjs +1547 -1546
  78. package/dist/test/index.js +2308 -2307
  79. package/dist/test/preview.cjs +1906 -1905
  80. package/dist/test/preview.d.ts +0 -6
  81. package/dist/test/preview.js +1439 -1438
  82. package/dist/test/spy.cjs +65 -64
  83. package/dist/test/spy.js +59 -58
  84. package/dist/types/index.cjs +11 -12
  85. package/dist/types/index.d.ts +502 -298
  86. package/dist/types/index.js +1 -2
  87. package/dist/viewport/preview.d.ts +0 -1
  88. package/package.json +124 -19
  89. package/dist/actions/manager.js +0 -1196
  90. package/dist/component-testing/manager.js +0 -3099
  91. package/dist/controls/manager.js +0 -5545
  92. package/dist/viewport/manager.js +0 -400
  93. /package/dist/{component-testing/manager.css → core-server/presets/common-manager.css} +0 -0
@@ -1,12 +1,211 @@
1
1
  import { StoryId, StoryName, ComponentTitle, Tag as Tag$1, Parameters, Args, ArgTypes, ComponentId, StoryKind, Globals, GlobalTypes, InputType, StoryContext, PartialStoryFn, LegacyStoryFn, ArgsStoryFn, StoryFn, DecoratorFunction, LoaderFunction, Renderer as Renderer$1, ViewMode as ViewMode$1, StoryIdentifier, ProjectAnnotations as ProjectAnnotations$1, StrictArgTypes, StrictGlobalTypes, StepRunner, BeforeAll, ComponentAnnotations, StoryAnnotations, StoryContextForEnhancers, CleanupCallback, Canvas, StoryAnnotationsOrFn, AnnotatedStoryFn } from 'storybook/internal/csf';
2
2
  export { AfterEach, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, ProjectAnnotations as BaseProjectAnnotations, BeforeAll, BeforeEach, Canvas, CleanupCallback, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, DecoratorApplicator, DecoratorFunction, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoaderFunction, Parameters, PartialStoryFn, PlayFunction, PlayFunctionContext, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, StepFunction, StepLabel, StepRunner, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryKind, StoryName, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag } from 'storybook/internal/csf';
3
3
  import { ReactElement, FC, ReactNode, PropsWithChildren } from 'react';
4
- import { Addon_TestProviderType as Addon_TestProviderType$1, NormalizedProjectAnnotations as NormalizedProjectAnnotations$1, ProjectAnnotations as ProjectAnnotations$2, ComposedStoryFn as ComposedStoryFn$1 } from 'storybook/internal/types';
5
4
  import { FileSystemCache } from 'storybook/internal/common';
6
5
  import { Server, IncomingMessage, ServerResponse } from 'http';
7
6
  import { Server as Server$1 } from 'net';
7
+ import { NormalizedProjectAnnotations as NormalizedProjectAnnotations$1, ProjectAnnotations as ProjectAnnotations$2, ComposedStoryFn as ComposedStoryFn$1 } from 'storybook/internal/types';
8
8
  import { Channel as Channel$1 } from 'storybook/internal/channels';
9
9
 
10
+ /**
11
+ * A URL pathname, beginning with a /.
12
+ *
13
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
14
+ */
15
+ declare type Pathname = string;
16
+ /**
17
+ * A URL search string, beginning with a ?.
18
+ *
19
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
20
+ */
21
+ declare type Search = string;
22
+ /**
23
+ * A URL fragment identifier, beginning with a #.
24
+ *
25
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
26
+ */
27
+ declare type Hash = string;
28
+ /**
29
+ * A unique string associated with a location. May be used to safely store
30
+ * and retrieve data in some other storage API, like `localStorage`.
31
+ *
32
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
33
+ */
34
+ declare type Key = string;
35
+ /**
36
+ * The pathname, search, and hash values of a URL.
37
+ */
38
+ interface Path$1 {
39
+ /**
40
+ * A URL pathname, beginning with a /.
41
+ *
42
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
43
+ */
44
+ pathname: Pathname;
45
+ /**
46
+ * A URL search string, beginning with a ?.
47
+ *
48
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
49
+ */
50
+ search: Search;
51
+ /**
52
+ * A URL fragment identifier, beginning with a #.
53
+ *
54
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
55
+ */
56
+ hash: Hash;
57
+ }
58
+ /**
59
+ * An entry in a history stack. A location contains information about the
60
+ * URL path, as well as possibly some arbitrary state and a key.
61
+ *
62
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location
63
+ */
64
+ interface Location extends Path$1 {
65
+ /**
66
+ * A value of arbitrary data associated with this location.
67
+ *
68
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.state
69
+ */
70
+ state: unknown;
71
+ /**
72
+ * A unique string associated with this location. May be used to safely store
73
+ * and retrieve data in some other storage API, like `localStorage`.
74
+ *
75
+ * Note: This value is always "default" on the initial location.
76
+ *
77
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
78
+ */
79
+ key: Key;
80
+ }
81
+ /**
82
+ * Describes a location that is the destination of some navigation, either via
83
+ * `history.push` or `history.replace`. May be either a URL or the pieces of a
84
+ * URL path.
85
+ */
86
+ declare type To = string | Partial<Path$1>;
87
+
88
+ interface NavigateOptions$1 {
89
+ replace?: boolean;
90
+ state?: any;
91
+ }
92
+
93
+ interface StoryData {
94
+ viewMode?: string;
95
+ storyId?: string;
96
+ refId?: string;
97
+ }
98
+
99
+ interface Other extends StoryData {
100
+ path: string;
101
+ singleStory?: boolean;
102
+ }
103
+ type NavigateOptions = NavigateOptions$1 & {
104
+ plain?: boolean;
105
+ };
106
+ type NavigateFunction = (to: To | number, options?: NavigateOptions) => void;
107
+ type RouterData = {
108
+ location: Partial<Location>;
109
+ navigate: NavigateFunction;
110
+ } & Other;
111
+ type RenderData = Pick<RouterData, 'location'> & Other;
112
+
113
+ interface ThemeVars extends ThemeVarsBase, ThemeVarsColors {
114
+ }
115
+ interface ThemeVarsBase {
116
+ base: 'light' | 'dark';
117
+ }
118
+ interface ThemeVarsColors {
119
+ colorPrimary: string;
120
+ colorSecondary: string;
121
+ appBg: string;
122
+ appContentBg: string;
123
+ appPreviewBg: string;
124
+ appBorderColor: string;
125
+ appBorderRadius: number;
126
+ fontBase: string;
127
+ fontCode: string;
128
+ textColor: string;
129
+ textInverseColor: string;
130
+ textMutedColor: string;
131
+ barTextColor: string;
132
+ barHoverColor: string;
133
+ barSelectedColor: string;
134
+ barBg: string;
135
+ buttonBg: string;
136
+ buttonBorder: string;
137
+ booleanBg: string;
138
+ booleanSelectedBg: string;
139
+ inputBg: string;
140
+ inputBorder: string;
141
+ inputTextColor: string;
142
+ inputBorderRadius: number;
143
+ brandTitle?: string;
144
+ brandUrl?: string;
145
+ brandImage?: string;
146
+ brandTarget?: string;
147
+ gridCellSize?: number;
148
+ }
149
+
150
+ type ChannelHandler = (event: ChannelEvent) => void;
151
+ interface ChannelTransport {
152
+ send(event: ChannelEvent, options?: any): void;
153
+ setHandler(handler: ChannelHandler): void;
154
+ }
155
+ interface ChannelEvent {
156
+ type: string;
157
+ from: string;
158
+ args: any[];
159
+ }
160
+ interface Listener$1 {
161
+ (...args: any[]): void;
162
+ }
163
+ interface ChannelArgsSingle {
164
+ transport?: ChannelTransport;
165
+ async?: boolean;
166
+ }
167
+ interface ChannelArgsMulti {
168
+ transports: ChannelTransport[];
169
+ async?: boolean;
170
+ }
171
+
172
+ declare class Channel {
173
+ readonly isAsync: boolean;
174
+ private sender;
175
+ private events;
176
+ private data;
177
+ private readonly transports;
178
+ constructor(input: ChannelArgsMulti);
179
+ constructor(input: ChannelArgsSingle);
180
+ get hasTransport(): boolean;
181
+ addListener(eventName: string, listener: Listener$1): void;
182
+ emit(eventName: string, ...args: any): void;
183
+ last(eventName: string): any;
184
+ eventNames(): string[];
185
+ listenerCount(eventName: string): number;
186
+ listeners(eventName: string): Listener$1[] | undefined;
187
+ once(eventName: string, listener: Listener$1): void;
188
+ removeAllListeners(eventName?: string): void;
189
+ removeListener(eventName: string, listener: Listener$1): void;
190
+ on(eventName: string, listener: Listener$1): void;
191
+ off(eventName: string, listener: Listener$1): void;
192
+ private handleEvent;
193
+ private onceListener;
194
+ }
195
+
196
+ interface Options$1 {
197
+ allowRegExp: boolean;
198
+ allowFunction: boolean;
199
+ allowSymbol: boolean;
200
+ allowDate: boolean;
201
+ allowUndefined: boolean;
202
+ allowClass: boolean;
203
+ allowError: boolean;
204
+ maxDepth: number;
205
+ space: number | undefined;
206
+ lazyEval: boolean;
207
+ }
208
+
10
209
  /**
11
210
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
12
211
 
@@ -723,217 +922,6 @@ PackageJson$1.TypeScriptConfiguration &
723
922
  PackageJson$1.YarnConfiguration &
724
923
  PackageJson$1.JSPMConfiguration;
725
924
 
726
- type DateNow = number;
727
- type TestProviderConfig = Addon_TestProviderType$1;
728
- type TestingModuleProgressReportProgress = {
729
- startedAt: DateNow;
730
- finishedAt?: DateNow;
731
- numTotalTests?: number;
732
- numPassedTests?: number;
733
- numFailedTests?: number;
734
- numPendingTests?: number;
735
- percentageCompleted?: number;
736
- };
737
-
738
- /**
739
- * A URL pathname, beginning with a /.
740
- *
741
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
742
- */
743
- declare type Pathname = string;
744
- /**
745
- * A URL search string, beginning with a ?.
746
- *
747
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
748
- */
749
- declare type Search = string;
750
- /**
751
- * A URL fragment identifier, beginning with a #.
752
- *
753
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
754
- */
755
- declare type Hash = string;
756
- /**
757
- * A unique string associated with a location. May be used to safely store
758
- * and retrieve data in some other storage API, like `localStorage`.
759
- *
760
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
761
- */
762
- declare type Key = string;
763
- /**
764
- * The pathname, search, and hash values of a URL.
765
- */
766
- interface Path$1 {
767
- /**
768
- * A URL pathname, beginning with a /.
769
- *
770
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
771
- */
772
- pathname: Pathname;
773
- /**
774
- * A URL search string, beginning with a ?.
775
- *
776
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
777
- */
778
- search: Search;
779
- /**
780
- * A URL fragment identifier, beginning with a #.
781
- *
782
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
783
- */
784
- hash: Hash;
785
- }
786
- /**
787
- * An entry in a history stack. A location contains information about the
788
- * URL path, as well as possibly some arbitrary state and a key.
789
- *
790
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location
791
- */
792
- interface Location extends Path$1 {
793
- /**
794
- * A value of arbitrary data associated with this location.
795
- *
796
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.state
797
- */
798
- state: unknown;
799
- /**
800
- * A unique string associated with this location. May be used to safely store
801
- * and retrieve data in some other storage API, like `localStorage`.
802
- *
803
- * Note: This value is always "default" on the initial location.
804
- *
805
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
806
- */
807
- key: Key;
808
- }
809
- /**
810
- * Describes a location that is the destination of some navigation, either via
811
- * `history.push` or `history.replace`. May be either a URL or the pieces of a
812
- * URL path.
813
- */
814
- declare type To = string | Partial<Path$1>;
815
-
816
- interface NavigateOptions$1 {
817
- replace?: boolean;
818
- state?: any;
819
- }
820
-
821
- interface StoryData {
822
- viewMode?: string;
823
- storyId?: string;
824
- refId?: string;
825
- }
826
-
827
- interface Other extends StoryData {
828
- path: string;
829
- singleStory?: boolean;
830
- }
831
- type NavigateOptions = NavigateOptions$1 & {
832
- plain?: boolean;
833
- };
834
- type NavigateFunction = (to: To | number, options?: NavigateOptions) => void;
835
- type RouterData = {
836
- location: Partial<Location>;
837
- navigate: NavigateFunction;
838
- } & Other;
839
- type RenderData = Pick<RouterData, 'location'> & Other;
840
-
841
- interface ThemeVars extends ThemeVarsBase, ThemeVarsColors {
842
- }
843
- interface ThemeVarsBase {
844
- base: 'light' | 'dark';
845
- }
846
- interface ThemeVarsColors {
847
- colorPrimary: string;
848
- colorSecondary: string;
849
- appBg: string;
850
- appContentBg: string;
851
- appPreviewBg: string;
852
- appBorderColor: string;
853
- appBorderRadius: number;
854
- fontBase: string;
855
- fontCode: string;
856
- textColor: string;
857
- textInverseColor: string;
858
- textMutedColor: string;
859
- barTextColor: string;
860
- barHoverColor: string;
861
- barSelectedColor: string;
862
- barBg: string;
863
- buttonBg: string;
864
- buttonBorder: string;
865
- booleanBg: string;
866
- booleanSelectedBg: string;
867
- inputBg: string;
868
- inputBorder: string;
869
- inputTextColor: string;
870
- inputBorderRadius: number;
871
- brandTitle?: string;
872
- brandUrl?: string;
873
- brandImage?: string;
874
- brandTarget?: string;
875
- gridCellSize?: number;
876
- }
877
-
878
- type ChannelHandler = (event: ChannelEvent) => void;
879
- interface ChannelTransport {
880
- send(event: ChannelEvent, options?: any): void;
881
- setHandler(handler: ChannelHandler): void;
882
- }
883
- interface ChannelEvent {
884
- type: string;
885
- from: string;
886
- args: any[];
887
- }
888
- interface Listener {
889
- (...args: any[]): void;
890
- }
891
- interface ChannelArgsSingle {
892
- transport?: ChannelTransport;
893
- async?: boolean;
894
- }
895
- interface ChannelArgsMulti {
896
- transports: ChannelTransport[];
897
- async?: boolean;
898
- }
899
-
900
- declare class Channel {
901
- readonly isAsync: boolean;
902
- private sender;
903
- private events;
904
- private data;
905
- private readonly transports;
906
- constructor(input: ChannelArgsMulti);
907
- constructor(input: ChannelArgsSingle);
908
- get hasTransport(): boolean;
909
- addListener(eventName: string, listener: Listener): void;
910
- emit(eventName: string, ...args: any): void;
911
- last(eventName: string): any;
912
- eventNames(): string[];
913
- listenerCount(eventName: string): number;
914
- listeners(eventName: string): Listener[] | undefined;
915
- once(eventName: string, listener: Listener): void;
916
- removeAllListeners(eventName?: string): void;
917
- removeListener(eventName: string, listener: Listener): void;
918
- on(eventName: string, listener: Listener): void;
919
- off(eventName: string, listener: Listener): void;
920
- private handleEvent;
921
- private onceListener;
922
- }
923
-
924
- interface Options$1 {
925
- allowRegExp: boolean;
926
- allowFunction: boolean;
927
- allowSymbol: boolean;
928
- allowDate: boolean;
929
- allowUndefined: boolean;
930
- allowClass: boolean;
931
- allowError: boolean;
932
- maxDepth: number;
933
- space: number | undefined;
934
- lazyEval: boolean;
935
- }
936
-
937
925
  type ExportName = string;
938
926
  type MetaId = string;
939
927
  interface StoriesSpecifier {
@@ -1298,13 +1286,6 @@ type CoreCommon_StorybookRefs = Record<string, {
1298
1286
  type DocsOptions = {
1299
1287
  /** What should we call the generated docs entries? */
1300
1288
  defaultName?: string;
1301
- /**
1302
- * Should we generate a docs entry per CSF file? Set to 'tag' (the default) to generate an entry
1303
- * for every CSF file with the 'autodocs' tag.
1304
- *
1305
- * @deprecated Use `tags: ['autodocs']` in `.storybook/preview.js` instead
1306
- */
1307
- autodocs?: boolean | 'tag';
1308
1289
  /** Only show doc entries in the side bar (usually set with the `--docs` CLI flag) */
1309
1290
  docsMode?: boolean;
1310
1291
  };
@@ -1711,8 +1692,6 @@ interface API_ProviderData<API> {
1711
1692
  }
1712
1693
  interface API_Provider<API> {
1713
1694
  channel?: Channel;
1714
- /** @deprecated Will be removed in 8.0, please use channel instead */
1715
- serverChannel?: Channel;
1716
1695
  renderPreview?: API_IframeRenderer;
1717
1696
  handleAPI(api: API): void;
1718
1697
  getConfig(): {
@@ -1751,8 +1730,6 @@ interface API_Layout {
1751
1730
  panelPosition: API_PanelPositions;
1752
1731
  showTabs: boolean;
1753
1732
  showToolbar: boolean;
1754
- /** @deprecated, will be removed in 8.0 - this API no longer works */
1755
- isToolshown?: boolean;
1756
1733
  }
1757
1734
  interface API_UI {
1758
1735
  name?: string;
@@ -1777,14 +1754,6 @@ interface OnClickOptions {
1777
1754
  /** Function to dismiss the notification. */
1778
1755
  onDismiss: () => void;
1779
1756
  }
1780
- /**
1781
- * @deprecated Use ReactNode for the icon instead.
1782
- * @see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#icons-is-deprecated
1783
- */
1784
- interface DeprecatedIconType {
1785
- name: string;
1786
- color?: string;
1787
- }
1788
1757
  interface API_Notification {
1789
1758
  id: string;
1790
1759
  content: {
@@ -1793,7 +1762,7 @@ interface API_Notification {
1793
1762
  };
1794
1763
  duration?: number;
1795
1764
  link?: string;
1796
- icon?: React.ReactNode | DeprecatedIconType;
1765
+ icon?: React.ReactNode;
1797
1766
  onClear?: (options: OnClearOptions) => void;
1798
1767
  onClick?: (options: OnClickOptions) => void;
1799
1768
  }
@@ -1827,7 +1796,7 @@ type API_Refs = Record<string, API_ComposedRef>;
1827
1796
  type API_RefId = string;
1828
1797
  type API_RefUrl = string;
1829
1798
 
1830
- type Addon_Types = Exclude<Addon_TypesEnum, Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_TEST_PROVIDER | Addon_TypesEnum.experimental_SIDEBAR_TOP>;
1799
+ type Addon_Types = Exclude<Addon_TypesEnum, Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_TEST_PROVIDER>;
1831
1800
  interface Addon_ArgType<TArg = unknown> extends InputType {
1832
1801
  defaultValue?: TArg;
1833
1802
  }
@@ -2018,7 +1987,6 @@ interface Addon_BaseMeta<ComponentType> {
2018
1987
  *
2019
1988
  * Used by addons for automatic prop table generation and display of other component metadata.
2020
1989
  *
2021
- * @deprecated
2022
1990
  * @example
2023
1991
  *
2024
1992
  * ```ts
@@ -2044,7 +2012,7 @@ type BaseStory<TArgs, StoryFnReturnType> = Addon_BaseStoryFn<TArgs, StoryFnRetur
2044
2012
  interface Addon_RenderOptions {
2045
2013
  active: boolean;
2046
2014
  }
2047
- type Addon_Type = Addon_BaseType | Addon_PageType | Addon_WrapperType | Addon_SidebarBottomType | Addon_SidebarTopType | Addon_TestProviderType<Addon_TestProviderState>;
2015
+ type Addon_Type = Addon_BaseType | Addon_PageType | Addon_WrapperType | Addon_TestProviderType;
2048
2016
  interface Addon_BaseType {
2049
2017
  /**
2050
2018
  * The title of the addon. This can be a simple string, but it can also be a
@@ -2060,7 +2028,7 @@ interface Addon_BaseType {
2060
2028
  * Addon_TypesEnum.PANEL;
2061
2029
  * ```
2062
2030
  */
2063
- type: Exclude<Addon_Types, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_SIDEBAR_TOP | Addon_TypesEnum.experimental_TEST_PROVIDER>;
2031
+ type: Exclude<Addon_Types, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_TEST_PROVIDER>;
2064
2032
  /**
2065
2033
  * The unique id of the addon.
2066
2034
  *
@@ -2147,63 +2115,20 @@ interface Addon_WrapperType {
2147
2115
  storyId: StoryId;
2148
2116
  }>>;
2149
2117
  }
2150
- /** @deprecated This doesn't do anything anymore and will be removed in Storybook 9.0. */
2151
- interface Addon_SidebarBottomType {
2152
- type: Addon_TypesEnum.experimental_SIDEBAR_BOTTOM;
2153
- /** The unique id of the tool. */
2154
- id: string;
2155
- /** A React.FunctionComponent. */
2156
- render: FC;
2157
- }
2158
- /** @deprecated This will be removed in Storybook 9.0. */
2159
- interface Addon_SidebarTopType {
2160
- type: Addon_TypesEnum.experimental_SIDEBAR_TOP;
2161
- /** The unique id of the tool. */
2162
- id: string;
2163
- /** A React.FunctionComponent. */
2164
- render: FC;
2165
- }
2166
- interface Addon_TestProviderType<Details extends {
2167
- [key: string]: any;
2168
- } = NonNullable<unknown>> {
2118
+ interface Addon_TestProviderType {
2169
2119
  type: Addon_TypesEnum.experimental_TEST_PROVIDER;
2170
2120
  /** The unique id of the test provider. */
2171
2121
  id: string;
2172
- name: string;
2173
- /** @deprecated Use render instead */
2174
- title?: (state: TestProviderConfig & Addon_TestProviderState<Details>) => ReactNode;
2175
- /** @deprecated Use render instead */
2176
- description?: (state: TestProviderConfig & Addon_TestProviderState<Details>) => ReactNode;
2177
- render?: (state: TestProviderConfig & Addon_TestProviderState<Details>) => ReactNode;
2122
+ render: () => ReactNode;
2178
2123
  sidebarContextMenu?: (options: {
2179
2124
  context: API_HashEntry;
2180
- state: TestProviderConfig & Addon_TestProviderState<Details>;
2181
2125
  }) => ReactNode;
2182
- stateUpdater?: (state: TestProviderConfig & Addon_TestProviderState<Details>, update: Partial<Addon_TestProviderState<Details>>) => void | Partial<TestProviderConfig & Addon_TestProviderState<Details>>;
2183
- runnable?: boolean;
2184
2126
  }
2185
- type Addon_TestProviderState<Details extends {
2186
- [key: string]: any;
2187
- } = NonNullable<unknown>> = Pick<Addon_TestProviderType, 'runnable'> & {
2188
- progress?: TestingModuleProgressReportProgress;
2189
- details: Details;
2190
- cancellable: boolean;
2191
- cancelling: boolean;
2192
- running: boolean;
2193
- failed: boolean;
2194
- crashed: boolean;
2195
- error?: {
2196
- name: string;
2197
- message?: string;
2198
- };
2199
- };
2200
- type Addon_TypeBaseNames = Exclude<Addon_TypesEnum, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_SIDEBAR_BOTTOM | Addon_TypesEnum.experimental_SIDEBAR_TOP | Addon_TypesEnum.experimental_TEST_PROVIDER>;
2127
+ type Addon_TypeBaseNames = Exclude<Addon_TypesEnum, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE | Addon_TypesEnum.experimental_TEST_PROVIDER>;
2201
2128
  interface Addon_TypesMapping extends Record<Addon_TypeBaseNames, Addon_BaseType> {
2202
2129
  [Addon_TypesEnum.PREVIEW]: Addon_WrapperType;
2203
2130
  [Addon_TypesEnum.experimental_PAGE]: Addon_PageType;
2204
- [Addon_TypesEnum.experimental_SIDEBAR_BOTTOM]: Addon_SidebarBottomType;
2205
- [Addon_TypesEnum.experimental_SIDEBAR_TOP]: Addon_SidebarTopType;
2206
- [Addon_TypesEnum.experimental_TEST_PROVIDER]: Addon_TestProviderType<Addon_TestProviderState>;
2131
+ [Addon_TypesEnum.experimental_TEST_PROVIDER]: Addon_TestProviderType;
2207
2132
  }
2208
2133
  type Addon_Loader<API> = (api: API) => void;
2209
2134
  interface Addon_Loaders<API> {
@@ -2252,18 +2177,6 @@ declare enum Addon_TypesEnum {
2252
2177
  * @unstable
2253
2178
  */
2254
2179
  experimental_PAGE = "page",
2255
- /**
2256
- * This adds items in the bottom of the sidebar.
2257
- *
2258
- * @deprecated This doesn't do anything anymore and will be removed in Storybook 9.0.
2259
- */
2260
- experimental_SIDEBAR_BOTTOM = "sidebar-bottom",
2261
- /**
2262
- * This adds items in the top of the sidebar.
2263
- *
2264
- * @deprecated This will be removed in Storybook 9.0.
2265
- */
2266
- experimental_SIDEBAR_TOP = "sidebar-top",
2267
2180
  /** This adds items to the Testing Module in the sidebar. */
2268
2181
  experimental_TEST_PROVIDER = "test-provider"
2269
2182
  }
@@ -2304,7 +2217,6 @@ interface ProjectAnnotations<TRenderer extends Renderer> extends ProjectAnnotati
2304
2217
  unmount: () => void;
2305
2218
  };
2306
2219
  renderToCanvas?: RenderToCanvas<TRenderer>;
2307
- renderToDOM?: RenderToCanvas<TRenderer>;
2308
2220
  }
2309
2221
  type NamedExportsOrDefault<TExport> = TExport | {
2310
2222
  default: TExport;
@@ -2519,10 +2431,250 @@ interface ComposeStoryFn<TRenderer extends Renderer$1 = Renderer$1, TArgs extend
2519
2431
  (storyAnnotations: AnnotatedStoryFn<TRenderer, TArgs> | StoryAnnotations<TRenderer, TArgs>, componentAnnotations: ComponentAnnotations<TRenderer, TArgs>, projectAnnotations: ProjectAnnotations$1<TRenderer>, exportsName?: string): ComposedStoryFn;
2520
2432
  }
2521
2433
 
2522
- type SupportedFrameworks = 'angular' | 'ember' | 'experimental-nextjs-vite' | 'html-vite' | 'html-webpack5' | 'nextjs' | 'preact-vite' | 'preact-webpack5' | 'react-native-web-vite' | 'react-vite' | 'react-webpack5' | 'server-webpack5' | 'svelte-vite' | 'svelte-webpack5' | 'sveltekit' | 'vue3-vite' | 'vue3-webpack5' | 'web-components-vite' | 'web-components-webpack5' | 'qwik' | 'solid' | 'nuxt' | 'react-rsbuild' | 'vue3-rsbuild';
2434
+ type SupportedFrameworks = 'angular' | 'ember' | 'html-vite' | 'nextjs' | 'nextjs-vite' | 'preact-vite' | 'react-native-web-vite' | 'react-vite' | 'react-webpack5' | 'server-webpack5' | 'svelte-vite' | 'svelte-webpack5' | 'sveltekit' | 'vue3-vite' | 'web-components-vite' | 'qwik' | 'solid' | 'nuxt' | 'react-rsbuild' | 'vue3-rsbuild';
2523
2435
 
2524
2436
  type SupportedRenderers = 'react' | 'react-native' | 'vue3' | 'angular' | 'ember' | 'preact' | 'svelte' | 'qwik' | 'html' | 'web-components' | 'server' | 'solid' | 'nuxt';
2525
2437
 
2438
+ type EnvironmentType = (typeof UniversalStore.Environment)[keyof typeof UniversalStore.Environment];
2439
+ type StatusType = (typeof UniversalStore.Status)[keyof typeof UniversalStore.Status];
2440
+ type StateUpdater<TState> = (prevState: TState) => TState;
2441
+ type Actor = {
2442
+ id: string;
2443
+ type: (typeof UniversalStore.ActorType)[keyof typeof UniversalStore.ActorType];
2444
+ environment: EnvironmentType;
2445
+ };
2446
+ type EventInfo = {
2447
+ actor: Actor;
2448
+ forwardingActor?: Actor;
2449
+ };
2450
+ type Listener<TEvent> = (event: TEvent, eventInfo: EventInfo) => void;
2451
+ type BaseEvent = {
2452
+ type: string;
2453
+ payload?: any;
2454
+ };
2455
+ interface SetStateEvent<TState> extends BaseEvent {
2456
+ type: typeof UniversalStore.InternalEventType.SET_STATE;
2457
+ payload: {
2458
+ state: TState;
2459
+ previousState: TState;
2460
+ };
2461
+ }
2462
+ interface ExistingStateRequestEvent extends BaseEvent {
2463
+ type: typeof UniversalStore.InternalEventType.EXISTING_STATE_REQUEST;
2464
+ payload: never;
2465
+ }
2466
+ interface ExistingStateResponseEvent<TState> extends BaseEvent {
2467
+ type: typeof UniversalStore.InternalEventType.EXISTING_STATE_RESPONSE;
2468
+ payload: TState;
2469
+ }
2470
+ interface LeaderCreatedEvent extends BaseEvent {
2471
+ type: typeof UniversalStore.InternalEventType.LEADER_CREATED;
2472
+ payload: never;
2473
+ }
2474
+ interface FollowerCreatedEvent extends BaseEvent {
2475
+ type: typeof UniversalStore.InternalEventType.FOLLOWER_CREATED;
2476
+ payload: never;
2477
+ }
2478
+ type InternalEvent<TState> = SetStateEvent<TState> | ExistingStateRequestEvent | ExistingStateResponseEvent<TState> | FollowerCreatedEvent | LeaderCreatedEvent;
2479
+ type Event<TState, TEvent extends BaseEvent> = TEvent | InternalEvent<TState>;
2480
+ type ChannelLike = Pick<Channel$1, 'on' | 'off' | 'emit'>;
2481
+ type StoreOptions<TState> = {
2482
+ id: string;
2483
+ leader?: boolean;
2484
+ initialState?: TState;
2485
+ debug?: boolean;
2486
+ };
2487
+ type EnvironmentOverrides = {
2488
+ channel: ChannelLike;
2489
+ environment: EnvironmentType;
2490
+ };
2491
+
2492
+ /**
2493
+ * A universal store implementation that synchronizes state across different environments using a
2494
+ * channel-based communication.
2495
+ *
2496
+ * The store follows a leader-follower pattern where:
2497
+ *
2498
+ * - Leader: The main store instance that owns and manages the state
2499
+ * - Follower: Store instances that mirror the leader's state
2500
+ *
2501
+ * Features:
2502
+ *
2503
+ * - State synchronization across environments
2504
+ * - Event-based communication
2505
+ * - Type-safe state and custom events
2506
+ * - Subscription system for state changes and custom events
2507
+ *
2508
+ * @remarks
2509
+ * - The store must be created using the static `create()` method, not the constructor
2510
+ * - Follower stores will automatically sync with their leader's state. If they have initial state, it
2511
+ * will be replaced immediately when it has synced with the leader.
2512
+ *
2513
+ * @example
2514
+ *
2515
+ * ```typescript
2516
+ * interface MyState {
2517
+ * count: number;
2518
+ * }
2519
+ * interface MyCustomEvent {
2520
+ * type: 'INCREMENT';
2521
+ * payload: number;
2522
+ * }
2523
+ *
2524
+ * // Create a leader store
2525
+ * const leaderStore = UniversalStore.create<MyState, MyCustomEvent>({
2526
+ * id: 'my-store',
2527
+ * leader: true,
2528
+ * initialState: { count: 0 },
2529
+ * });
2530
+ *
2531
+ * // Create a follower store
2532
+ * const followerStore = UniversalStore.create<MyState, MyCustomEvent>({
2533
+ * id: 'my-store',
2534
+ * leader: false,
2535
+ * });
2536
+ * ```
2537
+ *
2538
+ * @template State - The type of state managed by the store
2539
+ * @template CustomEvent - Custom events that can be sent through the store. Must have a `type`
2540
+ * string and optional `payload`
2541
+ * @throws {Error} If constructed directly instead of using `create()`
2542
+ * @throws {Error} If created without setting a channel first
2543
+ * @throws {Error} If a follower is created with initial state
2544
+ * @throws {Error} If a follower cannot find its leader within 1 second
2545
+ */
2546
+ declare class UniversalStore<State, CustomEvent extends {
2547
+ type: string;
2548
+ payload?: any;
2549
+ } = {
2550
+ type: string;
2551
+ payload?: any;
2552
+ }> {
2553
+ /**
2554
+ * Defines the possible actor types in the store system
2555
+ *
2556
+ * @readonly
2557
+ */
2558
+ static readonly ActorType: {
2559
+ readonly LEADER: "LEADER";
2560
+ readonly FOLLOWER: "FOLLOWER";
2561
+ };
2562
+ /**
2563
+ * Defines the possible environments the store can run in
2564
+ *
2565
+ * @readonly
2566
+ */
2567
+ static readonly Environment: {
2568
+ readonly SERVER: "SERVER";
2569
+ readonly MANAGER: "MANAGER";
2570
+ readonly PREVIEW: "PREVIEW";
2571
+ readonly UNKNOWN: "UNKNOWN";
2572
+ readonly MOCK: "MOCK";
2573
+ };
2574
+ /**
2575
+ * Internal event types used for store synchronization
2576
+ *
2577
+ * @readonly
2578
+ */
2579
+ static readonly InternalEventType: {
2580
+ readonly EXISTING_STATE_REQUEST: "__EXISTING_STATE_REQUEST";
2581
+ readonly EXISTING_STATE_RESPONSE: "__EXISTING_STATE_RESPONSE";
2582
+ readonly SET_STATE: "__SET_STATE";
2583
+ readonly LEADER_CREATED: "__LEADER_CREATED";
2584
+ readonly FOLLOWER_CREATED: "__FOLLOWER_CREATED";
2585
+ };
2586
+ static readonly Status: {
2587
+ readonly UNPREPARED: "UNPREPARED";
2588
+ readonly SYNCING: "SYNCING";
2589
+ readonly READY: "READY";
2590
+ readonly ERROR: "ERROR";
2591
+ };
2592
+ protected static isInternalConstructing: boolean;
2593
+ /**
2594
+ * The preparation construct is used to keep track of all store's preparation state the promise is
2595
+ * resolved when the store is prepared with the static __prepare() method which will also change
2596
+ * the state from PENDING to RESOLVED
2597
+ */
2598
+ private static preparation;
2599
+ private static setupPreparationPromise;
2600
+ /** Enable debug logs for this store */
2601
+ debugging: boolean;
2602
+ /** The actor object representing the store instance with a unique ID and a type */
2603
+ get actor(): Actor;
2604
+ /**
2605
+ * The current state of the store, that signals both if the store is prepared by Storybook and
2606
+ * also - in the case of a follower - if the state has been synced with the leader's state.
2607
+ */
2608
+ get status(): StatusType;
2609
+ /**
2610
+ * A promise that resolves when the store is fully ready. A leader will be ready when the store
2611
+ * has been prepared by Storybook, which is almost instantly.
2612
+ *
2613
+ * A follower will be ready when the state has been synced with the leader's state, within a few
2614
+ * hundred milliseconds.
2615
+ */
2616
+ untilReady(): Promise<[{
2617
+ channel: ChannelLike;
2618
+ environment: EnvironmentType;
2619
+ }, void | undefined]>;
2620
+ /**
2621
+ * The syncing construct is used to keep track of if the instance's state has been synced with the
2622
+ * other instances. A leader will immediately have the promise resolved. A follower will initially
2623
+ * be in a PENDING state, and resolve the the leader has sent the existing state, or reject if no
2624
+ * leader has responded before the timeout.
2625
+ */
2626
+ private syncing?;
2627
+ private channelEventName;
2628
+ private state;
2629
+ private channel?;
2630
+ private environment?;
2631
+ private listeners;
2632
+ private id;
2633
+ private actorId;
2634
+ private actorType;
2635
+ protected constructor(options: StoreOptions<State>, environmentOverrides?: EnvironmentOverrides);
2636
+ /** Creates a new instance of UniversalStore */
2637
+ static create<State = any, CustomEvent extends {
2638
+ type: string;
2639
+ payload?: any;
2640
+ } = {
2641
+ type: string;
2642
+ payload?: any;
2643
+ }>(options: StoreOptions<State>): UniversalStore<State, CustomEvent>;
2644
+ /** Gets the current state */
2645
+ getState: () => State;
2646
+ /**
2647
+ * Updates the store's state
2648
+ *
2649
+ * Either a new state or a state updater function can be passed to the method.
2650
+ */
2651
+ setState(updater: State | StateUpdater<State>): void;
2652
+ /**
2653
+ * Subscribes to store events
2654
+ *
2655
+ * @returns A function to unsubscribe
2656
+ */
2657
+ subscribe: {
2658
+ (listener: Listener<Event<State, CustomEvent>>): () => void;
2659
+ <EventType extends Event<State, CustomEvent>['type']>(eventType: EventType, listener: Listener<Extract<Event<State, CustomEvent>, {
2660
+ type: EventType;
2661
+ }>>): () => void;
2662
+ };
2663
+ /**
2664
+ * Subscribes to state changes
2665
+ *
2666
+ * @returns Unsubscribe function
2667
+ */
2668
+ onStateChange(listener: (state: State, previousState: State, eventInfo: EventInfo) => void): () => void;
2669
+ /** Sends a custom event to the other stores */
2670
+ send: (event: CustomEvent) => void;
2671
+ private emitToChannel;
2672
+ private prepareThis;
2673
+ private emitToListeners;
2674
+ private handleChannelEvents;
2675
+ private debug;
2676
+ }
2677
+
2526
2678
  type StatusValue = 'status-value:pending' | 'status-value:success' | 'status-value:error' | 'status-value:warning' | 'status-value:unknown';
2527
2679
  type StatusTypeId = string;
2528
2680
  type StatusByTypeId = Record<StatusTypeId, Status>;
@@ -2792,4 +2944,56 @@ type UseTestProviderStore = <T = TestProviderStateByProviderId>(
2792
2944
  */
2793
2945
  selector?: (state: TestProviderStateByProviderId) => T) => T;
2794
2946
 
2795
- export { type API_ActiveTabsType, type API_BaseEntry, type API_ComponentEntry, type API_ComposedRef, type API_ComposedRefUpdate, type API_DocsEntry, type API_FilterFunction, type API_GroupEntry, type API_HashEntry, type API_IframeRenderer, type API_IndexHash, type API_Layout, type API_LeafEntry, type API_LoadedRefData, type API_MatchOptions, type API_Notification, type API_OptionsData, type API_PanelPositions, type API_PreparedIndexEntry, type API_PreparedStoryIndex, type API_Provider, type API_ProviderData, type API_RefId, type API_RefUrl, type API_Refs, type API_ReleaseNotes, type API_RenderOptions, type API_RootEntry, type API_RouteOptions, type API_SetRefData, type API_Settings, type API_SidebarOptions, type API_StateMerger, type API_StoryEntry, type API_StoryMapper, type API_UI, type API_UIOptions, type API_UnknownEntries, type API_Version, type API_Versions$1 as API_Versions, type API_ViewMode, type Addon_AddStoryArgs, type Addon_Annotations, type Addon_ArgType, type Addon_ArgsStoryFn, type Addon_BaseAnnotations, type Addon_BaseDecorators, type Addon_BaseMeta, type Addon_BaseStoryFn, type Addon_BaseStoryObject, type Addon_BaseType, type Addon_ClientApiAddon, type Addon_ClientApiAddons, type Addon_ClientApiReturnFn, type Addon_ClientStoryApi, type Addon_Collection, type Addon_Comparator, type Addon_Config, type Addon_DecoratorFunction, type Addon_Elements, type Addon_LegacyStoryFn, type Addon_LoadFn, type Addon_Loadable, type Addon_Loader, type Addon_LoaderFunction, type Addon_Loaders, type Addon_MakeDecoratorResult, type Addon_OptionsParameter, type Addon_OptionsParameterV7, type Addon_PageType, type Addon_PartialStoryFn, type Addon_RenderOptions, type Addon_RequireContext, type Addon_SidebarBottomType, type Addon_SidebarTopType, type Addon_StoryApi, type Addon_StoryContext, type Addon_StoryContextUpdate, type Addon_StoryFn, type Addon_StorySortComparator, type Addon_StorySortComparatorV7, type Addon_StorySortMethod, type Addon_StorySortObjectParameter, type Addon_StorySortParameter, type Addon_StorySortParameterV7, type Addon_StoryWrapper, type Addon_TestProviderState, type Addon_TestProviderType, type Addon_ToolbarConfig, type Addon_Type, type Addon_Types, Addon_TypesEnum, type Addon_TypesMapping, type Addon_WrapperSettings, type Addon_WrapperType, type Addons_ArgTypes, type BaseIndexEntry, type BaseIndexInput, type BaseStory, type BoundStory, type Builder, type BuilderName, type BuilderOptions, type BuilderResult, type BuilderStats, type Builder_EnvsRaw, type Builder_Unpromise, type Builder_WithRequiredProperty, type CLIBaseOptions, type CLIOptions, type CSFFile, type CompatibleString, type ComposeStoryFn, type ComposedStoryFn, type CoreCommon_AddonEntry, type CoreCommon_AddonInfo, type CoreCommon_OptionsEntry, type CoreCommon_ResolvedAddonPreset, type CoreCommon_ResolvedAddonVirtual, type CoreCommon_StorybookInfo, type CoreConfig, type DocsContextProps, type DocsIndexEntry, type DocsIndexInput, type DocsOptions, type DocsPreparedPayload, type DocsRenderFunction, type Entry, type GlobalsUpdatedPayload, type IndexEntry, type IndexEntryLegacy, type IndexInput, type IndexInputStats, type IndexedCSFFile, type IndexedStory, type Indexer, type IndexerOptions, type LoadOptions, type LoadedPreset, type Middleware, type ModuleExport, type ModuleExports, type ModuleImportFn, type NamedOrDefaultProjectAnnotations, type NormalizedComponentAnnotations, type NormalizedProjectAnnotations, type NormalizedStoriesSpecifier, type NormalizedStoryAnnotations, type Options, type PackageJson, type PartialArgsStoryFn, type Path, type PreparedMeta, type PreparedStory, type Preset, type PresetConfig, type PresetProperty, type PresetPropertyFn, type PresetValue, type Presets, type PreviewAnnotation, type ProjectAnnotations, type Ref, type RenderContext, type RenderContextCallbacks, type RenderToCanvas, type Renderer, type RendererName, type ResolvedModuleExport, type ResolvedModuleExportFromType, type ResolvedModuleExportType, type SetGlobalsPayload, type SetStoriesPayload, type SetStoriesStory, type SetStoriesStoryData, type Stats, type Status, type StatusByTypeId, type StatusStore, type StatusStoreByTypeId, type StatusTypeId, type StatusValue, type StatusesByStoryIdAndTypeId, type Store_CSFExports, type StoriesEntry, type StoriesSpecifier, type StoriesWithPartialProps, type StoryIndex, type StoryIndexEntry, type StoryIndexInput, type StoryIndexV2, type StoryIndexV3, type StoryPreparedPayload, type StoryRenderOptions, type StorybookConfig, type StorybookConfigOptions, type StorybookConfigRaw, type StorybookInternalParameters, type StorybookParameters, type SupportedFrameworks, type SupportedRenderers, type TagOptions, type TagsOptions, type TeardownRenderToCanvas, type TestBuildConfig, type TestBuildFlags, type TestProviderId, type TestProviderState, type TestProviderStoreById, type TypescriptOptions, type UseStatusStore, type UseTestProviderStore, type V3CompatIndexEntry, type VersionCheck, type ViewMode, type WebRenderer };
2947
+ /**
2948
+ * A mock universal store that can be used when testing code that relies on a universal store. It
2949
+ * functions exactly like a normal universal store, with a few exceptions:
2950
+ *
2951
+ * - It is fully isolated, meaning that it doesn't interact with any channel, and it is always a
2952
+ * leader.
2953
+ *
2954
+ * If the second testUtils argument is provided, all the public methods are spied on, so they can be
2955
+ * asserted.
2956
+ *
2957
+ * When a mock store is re-used across tests (eg. in stories), you manually need to reset the state
2958
+ * after each test.
2959
+ *
2960
+ * @example
2961
+ *
2962
+ * ```ts
2963
+ * import * as testUtils from 'storybook/test'; // in stories
2964
+ * import { vi as testUtils } from 'vitest'; // ... or in Vitest tests
2965
+ *
2966
+ * const initialState = { ... };
2967
+ * const store = new MockUniversalStore({ initialState }, testUtils);
2968
+ *
2969
+ * export default {
2970
+ * title: 'My story',
2971
+ * beforeEach: () => {
2972
+ * return () => {
2973
+ * store.setState(initialState);
2974
+ * };
2975
+ * }
2976
+ * }
2977
+ * ```
2978
+ */
2979
+ declare class MockUniversalStore<State, CustomEvent extends {
2980
+ type: string;
2981
+ payload?: any;
2982
+ } = {
2983
+ type: string;
2984
+ payload?: any;
2985
+ }> extends UniversalStore<State, CustomEvent> {
2986
+ private testUtils;
2987
+ constructor(options: StoreOptions<State>, testUtils?: any);
2988
+ /** Create a mock universal store. This is just an alias for the constructor */
2989
+ static create<State = any, CustomEvent extends {
2990
+ type: string;
2991
+ payload?: any;
2992
+ } = {
2993
+ type: string;
2994
+ payload?: any;
2995
+ }>(options: StoreOptions<State>, testUtils?: any): MockUniversalStore<State, CustomEvent>;
2996
+ unsubscribeAll(): void;
2997
+ }
2998
+
2999
+ export { type API_ActiveTabsType, type API_BaseEntry, type API_ComponentEntry, type API_ComposedRef, type API_ComposedRefUpdate, type API_DocsEntry, type API_FilterFunction, type API_GroupEntry, type API_HashEntry, type API_IframeRenderer, type API_IndexHash, type API_Layout, type API_LeafEntry, type API_LoadedRefData, type API_MatchOptions, type API_Notification, type API_OptionsData, type API_PanelPositions, type API_PreparedIndexEntry, type API_PreparedStoryIndex, type API_Provider, type API_ProviderData, type API_RefId, type API_RefUrl, type API_Refs, type API_ReleaseNotes, type API_RenderOptions, type API_RootEntry, type API_RouteOptions, type API_SetRefData, type API_Settings, type API_SidebarOptions, type API_StateMerger, type API_StoryEntry, type API_StoryMapper, type API_UI, type API_UIOptions, type API_UnknownEntries, type API_Version, type API_Versions$1 as API_Versions, type API_ViewMode, type Actor, type Addon_AddStoryArgs, type Addon_Annotations, type Addon_ArgType, type Addon_ArgsStoryFn, type Addon_BaseAnnotations, type Addon_BaseDecorators, type Addon_BaseMeta, type Addon_BaseStoryFn, type Addon_BaseStoryObject, type Addon_BaseType, type Addon_ClientApiAddon, type Addon_ClientApiAddons, type Addon_ClientApiReturnFn, type Addon_ClientStoryApi, type Addon_Collection, type Addon_Comparator, type Addon_Config, type Addon_DecoratorFunction, type Addon_Elements, type Addon_LegacyStoryFn, type Addon_LoadFn, type Addon_Loadable, type Addon_Loader, type Addon_LoaderFunction, type Addon_Loaders, type Addon_MakeDecoratorResult, type Addon_OptionsParameter, type Addon_OptionsParameterV7, type Addon_PageType, type Addon_PartialStoryFn, type Addon_RenderOptions, type Addon_RequireContext, type Addon_StoryApi, type Addon_StoryContext, type Addon_StoryContextUpdate, type Addon_StoryFn, type Addon_StorySortComparator, type Addon_StorySortComparatorV7, type Addon_StorySortMethod, type Addon_StorySortObjectParameter, type Addon_StorySortParameter, type Addon_StorySortParameterV7, type Addon_StoryWrapper, type Addon_TestProviderType, type Addon_ToolbarConfig, type Addon_Type, type Addon_Types, Addon_TypesEnum, type Addon_TypesMapping, type Addon_WrapperSettings, type Addon_WrapperType, type Addons_ArgTypes, type BaseIndexEntry, type BaseIndexInput, type BaseStory, type BoundStory, type Builder, type BuilderName, type BuilderOptions, type BuilderResult, type BuilderStats, type Builder_EnvsRaw, type Builder_Unpromise, type Builder_WithRequiredProperty, type CLIBaseOptions, type CLIOptions, type CSFFile, type CompatibleString, type ComposeStoryFn, type ComposedStoryFn, type CoreCommon_AddonEntry, type CoreCommon_AddonInfo, type CoreCommon_OptionsEntry, type CoreCommon_ResolvedAddonPreset, type CoreCommon_ResolvedAddonVirtual, type CoreCommon_StorybookInfo, type CoreConfig, type DocsContextProps, type DocsIndexEntry, type DocsIndexInput, type DocsOptions, type DocsPreparedPayload, type DocsRenderFunction, type Entry, type Event, type EventInfo, type GlobalsUpdatedPayload, type IndexEntry, type IndexEntryLegacy, type IndexInput, type IndexInputStats, type IndexedCSFFile, type IndexedStory, type Indexer, type IndexerOptions, type LoadOptions, type LoadedPreset, type Middleware, MockUniversalStore, type ModuleExport, type ModuleExports, type ModuleImportFn, type NamedOrDefaultProjectAnnotations, type NormalizedComponentAnnotations, type NormalizedProjectAnnotations, type NormalizedStoriesSpecifier, type NormalizedStoryAnnotations, type Options, type PackageJson, type PartialArgsStoryFn, type Path, type PreparedMeta, type PreparedStory, type Preset, type PresetConfig, type PresetProperty, type PresetPropertyFn, type PresetValue, type Presets, type PreviewAnnotation, type ProjectAnnotations, type Ref, type RenderContext, type RenderContextCallbacks, type RenderToCanvas, type Renderer, type RendererName, type ResolvedModuleExport, type ResolvedModuleExportFromType, type ResolvedModuleExportType, type SetGlobalsPayload, type SetStoriesPayload, type SetStoriesStory, type SetStoriesStoryData, type Stats, type Status, type StatusByTypeId, type StatusStore, type StatusStoreByTypeId, type StatusTypeId, type StatusValue, type StatusesByStoryIdAndTypeId, type StoreOptions, type Store_CSFExports, type StoriesEntry, type StoriesSpecifier, type StoriesWithPartialProps, type StoryIndex, type StoryIndexEntry, type StoryIndexInput, type StoryIndexV2, type StoryIndexV3, type StoryPreparedPayload, type StoryRenderOptions, type StorybookConfig, type StorybookConfigOptions, type StorybookConfigRaw, type StorybookInternalParameters, type StorybookParameters, type SupportedFrameworks, type SupportedRenderers, type TagOptions, type TagsOptions, type TeardownRenderToCanvas, type TestBuildConfig, type TestBuildFlags, type TestProviderId, type TestProviderState, type TestProviderStateByProviderId, type TestProviderStoreById, type TypescriptOptions, UniversalStore, type UseStatusStore, type UseTestProviderStore, type V3CompatIndexEntry, type VersionCheck, type ViewMode, type WebRenderer };