storybook 9.0.0-alpha.5 → 9.0.0-alpha.7
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/bin/index.cjs +63 -63
- package/dist/bin/index.js +63 -63
- package/dist/builder-manager/index.cjs +253 -280
- package/dist/builder-manager/index.js +305 -332
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/common/index.cjs +63 -63
- package/dist/common/index.js +63 -63
- package/dist/components/index.cjs +2102 -2069
- package/dist/components/index.js +2311 -2278
- package/dist/core-server/index.cjs +10816 -10501
- package/dist/core-server/index.d.ts +260 -2
- package/dist/core-server/index.js +10920 -10611
- package/dist/core-server/presets/common-preset.cjs +59 -59
- package/dist/core-server/presets/common-preset.js +57 -57
- package/dist/csf/index.d.ts +1 -1
- package/dist/instrumenter/index.cjs +1784 -1546
- package/dist/instrumenter/index.js +2220 -2054
- package/dist/manager/globals-module-info.cjs +22 -8
- package/dist/manager/globals-module-info.js +20 -6
- package/dist/manager/globals-runtime.js +22673 -23887
- package/dist/manager/runtime.js +3286 -3200
- package/dist/manager-api/index.cjs +3506 -3179
- package/dist/manager-api/index.d.ts +325 -24
- package/dist/manager-api/index.js +3245 -2957
- package/dist/manager-errors.d.ts +25 -1
- package/dist/manager-errors.js +42 -26
- package/dist/preview/runtime.js +15216 -16734
- package/dist/preview-api/index.cjs +1234 -1683
- package/dist/preview-api/index.d.ts +3 -309
- package/dist/preview-api/index.js +1360 -1785
- package/dist/preview-errors.cjs +98 -81
- package/dist/preview-errors.d.ts +25 -1
- package/dist/preview-errors.js +109 -93
- package/dist/server-errors.cjs +92 -75
- package/dist/server-errors.d.ts +25 -1
- package/dist/server-errors.js +83 -66
- package/dist/test/index.cjs +12779 -11872
- package/dist/test/index.js +12417 -11582
- package/dist/test/preview.cjs +1466 -1467
- package/dist/test/preview.js +4 -5
- package/dist/test/spy.cjs +11 -12
- package/dist/test/spy.js +14 -15
- package/dist/types/index.d.ts +271 -13
- package/package.json +9 -9
|
@@ -2,11 +2,11 @@ import React, { FC, ReactNode, ReactElement, Component } from 'react';
|
|
|
2
2
|
import { Channel, Listener as Listener$1 } from 'storybook/internal/channels';
|
|
3
3
|
export { Listener as ChannelListener } from 'storybook/internal/channels';
|
|
4
4
|
import { RouterData, NavigateOptions } from 'storybook/internal/router';
|
|
5
|
-
import { Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, Addon_BaseType, Addon_SidebarTopType, Addon_SidebarBottomType, Addon_TestProviderType, Addon_PageType, Addon_WrapperType, Addon_Config, API_ProviderData, API_StateMerger, API_Provider, StoryId, Globals, GlobalTypes, API_PanelPositions, API_Layout, API_UI, API_Notification, API_IframeRenderer, API_ComposedRef, API_SetRefData, API_ComposedRefUpdate, API_Refs, API_Settings, API_HashEntry, API_ViewMode, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, Args, API_IndexHash, API_DocsEntry,
|
|
5
|
+
import { Addon_Types, Addon_TypesEnum, Addon_Collection, Addon_TypesMapping, Addon_BaseType, Addon_SidebarTopType, Addon_SidebarBottomType, Addon_TestProviderType, Addon_PageType, Addon_WrapperType, Addon_Config, API_ProviderData, API_StateMerger, API_Provider, StoryId, Globals, GlobalTypes, API_PanelPositions, API_Layout, API_UI, API_Notification, API_IframeRenderer, API_ComposedRef, API_SetRefData, API_ComposedRefUpdate, API_Refs, API_Settings, API_HashEntry, API_ViewMode, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, Args, API_IndexHash, API_DocsEntry, API_FilterFunction, API_LoadedRefData, API_Version, API_Versions, API_UnknownEntries, NormalizedProjectAnnotations, ProjectAnnotations, ComposedStoryFn, API_OptionsData, Parameters, ArgTypes } from 'storybook/internal/types';
|
|
6
6
|
export { Addon_Type as Addon, API_ComponentEntry as ComponentEntry, API_ComposedRef as ComposedRef, API_DocsEntry as DocsEntry, API_GroupEntry as GroupEntry, API_HashEntry as HashEntry, API_IndexHash as IndexHash, API_LeafEntry as LeafEntry, API_Refs as Refs, API_RootEntry as RootEntry, API_IndexHash as StoriesHash, API_StoryEntry as StoryEntry } from 'storybook/internal/types';
|
|
7
|
-
import { TestProviderState, TestProviderId, TestProviders, WhatsNewData } from 'storybook/internal/core-events';
|
|
7
|
+
import { TestProviderState as TestProviderState$1, TestProviderId as TestProviderId$1, TestProviders, WhatsNewData } from 'storybook/internal/core-events';
|
|
8
8
|
import { ThemeVars } from 'storybook/theming';
|
|
9
|
-
import { toId } from 'storybook/internal/csf';
|
|
9
|
+
import { toId, StoryId as StoryId$1 } from 'storybook/internal/csf';
|
|
10
10
|
|
|
11
11
|
declare function mockChannel(): Channel;
|
|
12
12
|
|
|
@@ -178,11 +178,11 @@ interface RunOptions {
|
|
|
178
178
|
entryId?: StoryId;
|
|
179
179
|
}
|
|
180
180
|
type SubAPI$b = {
|
|
181
|
-
getTestProviderState(id: string): TestProviderState | undefined;
|
|
182
|
-
updateTestProviderState(id: TestProviderId, update: Partial<TestProviderState>): void;
|
|
183
|
-
clearTestProviderState(id: TestProviderId): void;
|
|
184
|
-
runTestProvider(id: TestProviderId, options?: RunOptions): () => void;
|
|
185
|
-
cancelTestProvider(id: TestProviderId): void;
|
|
181
|
+
getTestProviderState(id: string): TestProviderState$1 | undefined;
|
|
182
|
+
updateTestProviderState(id: TestProviderId$1, update: Partial<TestProviderState$1>): void;
|
|
183
|
+
clearTestProviderState(id: TestProviderId$1): void;
|
|
184
|
+
runTestProvider(id: TestProviderId$1, options?: RunOptions): () => void;
|
|
185
|
+
cancelTestProvider(id: TestProviderId$1): void;
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
interface SubState$9 {
|
|
@@ -507,7 +507,6 @@ interface SubState$3 extends API_LoadedRefData {
|
|
|
507
507
|
storyId: StoryId;
|
|
508
508
|
internal_index?: API_PreparedStoryIndex;
|
|
509
509
|
viewMode: API_ViewMode;
|
|
510
|
-
status: API_StatusState;
|
|
511
510
|
filters: Record<string, API_FilterFunction>;
|
|
512
511
|
}
|
|
513
512
|
interface SubAPI$3 {
|
|
@@ -694,20 +693,6 @@ interface SubAPI$3 {
|
|
|
694
693
|
* @returns {Promise<void>} A promise that resolves when the preview has been set as initialized.
|
|
695
694
|
*/
|
|
696
695
|
setPreviewInitialized: (ref?: API_ComposedRef) => Promise<void>;
|
|
697
|
-
/**
|
|
698
|
-
* Returns the current status of the stories.
|
|
699
|
-
*
|
|
700
|
-
* @returns {API_StatusState} The current status of the stories.
|
|
701
|
-
*/
|
|
702
|
-
getCurrentStoryStatus: () => Record<string, API_StatusObject>;
|
|
703
|
-
/**
|
|
704
|
-
* Updates the status of a collection of stories.
|
|
705
|
-
*
|
|
706
|
-
* @param {string} addonId - The ID of the addon to update.
|
|
707
|
-
* @param {StatusUpdate} update - An object containing the updated status information.
|
|
708
|
-
* @returns {Promise<void>} A promise that resolves when the status has been updated.
|
|
709
|
-
*/
|
|
710
|
-
experimental_updateStatus: (addonId: string, update: API_StatusUpdate | ((state: API_StatusState) => API_StatusUpdate)) => Promise<void>;
|
|
711
696
|
/**
|
|
712
697
|
* Updates the filtering of the index.
|
|
713
698
|
*
|
|
@@ -1139,6 +1124,322 @@ declare class MockUniversalStore<State, CustomEvent extends {
|
|
|
1139
1124
|
unsubscribeAll(): void;
|
|
1140
1125
|
}
|
|
1141
1126
|
|
|
1127
|
+
declare global {
|
|
1128
|
+
interface SymbolConstructor {
|
|
1129
|
+
readonly observable: symbol;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
declare global {
|
|
1134
|
+
var globalProjectAnnotations: NormalizedProjectAnnotations<any>;
|
|
1135
|
+
var defaultProjectAnnotations: ProjectAnnotations<any>;
|
|
1136
|
+
}
|
|
1137
|
+
type WrappedStoryRef = {
|
|
1138
|
+
__pw_type: 'jsx' | 'importRef';
|
|
1139
|
+
};
|
|
1140
|
+
type UnwrappedJSXStoryRef = {
|
|
1141
|
+
__pw_type: 'jsx';
|
|
1142
|
+
type: UnwrappedImportStoryRef;
|
|
1143
|
+
};
|
|
1144
|
+
type UnwrappedImportStoryRef = ComposedStoryFn;
|
|
1145
|
+
declare global {
|
|
1146
|
+
function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise<UnwrappedJSXStoryRef | UnwrappedImportStoryRef>;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
type StatusValue = 'status-value:pending' | 'status-value:success' | 'status-value:error' | 'status-value:warning' | 'status-value:unknown';
|
|
1150
|
+
type StatusTypeId = string;
|
|
1151
|
+
type StatusByTypeId = Record<StatusTypeId, Status>;
|
|
1152
|
+
type StatusesByStoryIdAndTypeId = Record<StoryId$1, StatusByTypeId>;
|
|
1153
|
+
interface Status {
|
|
1154
|
+
value: StatusValue;
|
|
1155
|
+
typeId: StatusTypeId;
|
|
1156
|
+
storyId: StoryId$1;
|
|
1157
|
+
title: string;
|
|
1158
|
+
description: string;
|
|
1159
|
+
data?: any;
|
|
1160
|
+
sidebarContextMenu?: boolean;
|
|
1161
|
+
}
|
|
1162
|
+
type StatusStore = {
|
|
1163
|
+
getAll: () => StatusesByStoryIdAndTypeId;
|
|
1164
|
+
set: (statuses: Status[]) => void;
|
|
1165
|
+
onAllStatusChange: (listener: (statuses: StatusesByStoryIdAndTypeId, previousStatuses: StatusesByStoryIdAndTypeId) => void) => () => void;
|
|
1166
|
+
onSelect: (listener: (selectedStatuses: Status[]) => void) => () => void;
|
|
1167
|
+
unset: (storyIds?: StoryId$1[]) => void;
|
|
1168
|
+
};
|
|
1169
|
+
type StatusStoreByTypeId = StatusStore & {
|
|
1170
|
+
typeId: StatusTypeId;
|
|
1171
|
+
};
|
|
1172
|
+
type UseStatusStore = <T = StatusesByStoryIdAndTypeId>(selector?: (statuses: StatusesByStoryIdAndTypeId) => T) => T;
|
|
1173
|
+
|
|
1174
|
+
type TestProviderState = 'test-provider-state:pending' | 'test-provider-state:running' | 'test-provider-state:succeeded' | 'test-provider-state:crashed';
|
|
1175
|
+
type TestProviderId = string;
|
|
1176
|
+
type TestProviderStateByProviderId = Record<TestProviderId, TestProviderState>;
|
|
1177
|
+
type TestProviderStoreEventType = 'run-all' | 'clear-all' | 'settings-changed';
|
|
1178
|
+
type TestProviderStoreEvent = BaseEvent & {
|
|
1179
|
+
type: TestProviderStoreEventType;
|
|
1180
|
+
};
|
|
1181
|
+
type BaseTestProviderStore = {
|
|
1182
|
+
/**
|
|
1183
|
+
* Notifies all listeners that settings have changed for test providers. The Storybook UI will
|
|
1184
|
+
* highlight the test providers to tell the user that settings has changed.
|
|
1185
|
+
*/
|
|
1186
|
+
settingsChanged: () => void;
|
|
1187
|
+
/**
|
|
1188
|
+
* Subscribe to clicks on the "Run All" button, that is supposed to trigger all test providers to
|
|
1189
|
+
* run. Your test provider should do the "main thing" when this happens, similar to when the user
|
|
1190
|
+
* triggers your test provider specifically.
|
|
1191
|
+
*
|
|
1192
|
+
* @example
|
|
1193
|
+
*
|
|
1194
|
+
* ```typescript
|
|
1195
|
+
* // Subscribe to run-all events
|
|
1196
|
+
* const unsubscribe = myTestProviderStore.onRunAll(() => {
|
|
1197
|
+
* await runAllMyTests();
|
|
1198
|
+
* });
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
onRunAll: (listener: () => void) => () => void;
|
|
1202
|
+
/**
|
|
1203
|
+
* Subscribe to clicks on the "Clear All" button, that is supposed to clear all state from test
|
|
1204
|
+
* providers. Storybook already clears all statuses, but if your test provider has more
|
|
1205
|
+
* non-status-based state, you can use this to clear that here.
|
|
1206
|
+
*
|
|
1207
|
+
* @remarks
|
|
1208
|
+
* The purpose of this is _not_ to clear your test provider's settings, only the test results.
|
|
1209
|
+
* @example
|
|
1210
|
+
*
|
|
1211
|
+
* ```typescript
|
|
1212
|
+
* // Subscribe to clear-all events
|
|
1213
|
+
* const unsubscribe = myTestProviderStore.onClearAll(() => {
|
|
1214
|
+
* clearMyTestResults();
|
|
1215
|
+
* });
|
|
1216
|
+
*
|
|
1217
|
+
* // Later, when no longer needed
|
|
1218
|
+
* unsubscribe();
|
|
1219
|
+
* ```
|
|
1220
|
+
*/
|
|
1221
|
+
onClearAll: (listener: () => void) => () => void;
|
|
1222
|
+
};
|
|
1223
|
+
/**
|
|
1224
|
+
* Represents a store for a specific test provider, identified by its unique ID. This store provides
|
|
1225
|
+
* methods to manage the state of an individual test provider, including getting and setting its
|
|
1226
|
+
* state, running operations with automatic state management, and accessing its unique identifier.
|
|
1227
|
+
*
|
|
1228
|
+
* Each test provider has its own instance of this store, allowing for independent state management
|
|
1229
|
+
* across different test providers in the application.
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
*
|
|
1233
|
+
* ```typescript
|
|
1234
|
+
* // Get a store for a specific test provider
|
|
1235
|
+
* const grammarStore = getTestProviderStoreById('addon-grammar');
|
|
1236
|
+
*
|
|
1237
|
+
* // Check the current state
|
|
1238
|
+
* if (grammarStore.getState() === 'test-provider-state:pending') {
|
|
1239
|
+
* console.log('Grammar tests are ready to run');
|
|
1240
|
+
* }
|
|
1241
|
+
*
|
|
1242
|
+
* // Run tests with automatic state management
|
|
1243
|
+
* grammarStore.runWithState(async () => {
|
|
1244
|
+
* await runGrammarTests();
|
|
1245
|
+
* });
|
|
1246
|
+
* ```
|
|
1247
|
+
*
|
|
1248
|
+
* @see {@link TestProviderState} for possible state values
|
|
1249
|
+
* @see {@link BaseTestProviderStore} for methods inherited from the base store
|
|
1250
|
+
*/
|
|
1251
|
+
type TestProviderStoreById = BaseTestProviderStore & {
|
|
1252
|
+
/**
|
|
1253
|
+
* Gets the current state of this specific test provider
|
|
1254
|
+
*
|
|
1255
|
+
* The state represents the current execution status of the test provider, which can be one of the
|
|
1256
|
+
* following:
|
|
1257
|
+
*
|
|
1258
|
+
* - 'test-provider-state:pending': Tests have not been run yet
|
|
1259
|
+
* - 'test-provider-state:running': Tests are currently running
|
|
1260
|
+
* - 'test-provider-state:succeeded': Tests completed successfully
|
|
1261
|
+
* - 'test-provider-state:crashed': Running tests failed or encountered an error
|
|
1262
|
+
*
|
|
1263
|
+
* Storybook UI will use this state to determine what to show in the UI.
|
|
1264
|
+
*
|
|
1265
|
+
* @remarks
|
|
1266
|
+
* The 'test-provider-state:crashed' is meant to signify that the test run as a whole failed to
|
|
1267
|
+
* execute for some reason. It should _not_ be set just because a number of tests failed, use
|
|
1268
|
+
* statuses and the status store for that. See {@link TestStatusStore} for managing individual test
|
|
1269
|
+
* statuses.
|
|
1270
|
+
* @example
|
|
1271
|
+
*
|
|
1272
|
+
* ```typescript
|
|
1273
|
+
* // Get the current state of a specific test provider
|
|
1274
|
+
* const state = testProviderStore.getState();
|
|
1275
|
+
*
|
|
1276
|
+
* // Conditionally render UI based on the state
|
|
1277
|
+
* const TestStatus = () => {
|
|
1278
|
+
* const state = testProviderStore.getState();
|
|
1279
|
+
*
|
|
1280
|
+
* if (state === 'test-provider-state:running') {
|
|
1281
|
+
* return <Spinner />;
|
|
1282
|
+
* } else if (state === 'test-provider-state:succeeded') {
|
|
1283
|
+
* return <SuccessIcon />;
|
|
1284
|
+
* } else if (state === 'test-provider-state:crashed') {
|
|
1285
|
+
* return <ErrorIcon />;
|
|
1286
|
+
* }
|
|
1287
|
+
*
|
|
1288
|
+
* return <PendingIcon />;
|
|
1289
|
+
* };
|
|
1290
|
+
* ```
|
|
1291
|
+
*/
|
|
1292
|
+
getState: () => TestProviderState;
|
|
1293
|
+
/**
|
|
1294
|
+
* Sets the state of this specific test provider
|
|
1295
|
+
*
|
|
1296
|
+
* This method allows you to manually update the execution state of the test provider. It's
|
|
1297
|
+
* typically used when you need to reflect the current status of test execution in the UI or when
|
|
1298
|
+
* you want to programmatically control the test provider's state.
|
|
1299
|
+
*
|
|
1300
|
+
* Common use cases include:
|
|
1301
|
+
*
|
|
1302
|
+
* - Setting to 'running' when tests start
|
|
1303
|
+
* - Setting to 'succeeded' when tests complete successfully
|
|
1304
|
+
* - Setting to 'crashed' when tests fail or encounter errors
|
|
1305
|
+
* - Setting to 'pending' to reset the state
|
|
1306
|
+
*
|
|
1307
|
+
* The state represents the current execution status of the test provider, which can be one of the
|
|
1308
|
+
* following:
|
|
1309
|
+
*
|
|
1310
|
+
* - 'test-provider-state:pending': Tests have not been run yet
|
|
1311
|
+
* - 'test-provider-state:running': Tests are currently running
|
|
1312
|
+
* - 'test-provider-state:succeeded': Tests completed successfully
|
|
1313
|
+
* - 'test-provider-state:crashed': Running tests failed or encountered an error
|
|
1314
|
+
*
|
|
1315
|
+
* Storybook UI will use this state to determine what to show in the UI.
|
|
1316
|
+
*
|
|
1317
|
+
* @remarks
|
|
1318
|
+
* The 'test-provider-state:crashed' is meant to signify that the test run as a whole failed to
|
|
1319
|
+
* execute for some reason. It should _not_ be set just because a number of tests failed, use
|
|
1320
|
+
* statuses and the status store for that. See {@link TestStatusStore} for managing individual test
|
|
1321
|
+
* statuses.
|
|
1322
|
+
*
|
|
1323
|
+
* For most use cases, consider using {@link runWithState} instead, which provides automatic state
|
|
1324
|
+
* management and error handling during test execution.
|
|
1325
|
+
* @example
|
|
1326
|
+
*
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* // Update the state when tests start running
|
|
1329
|
+
* const startTests = async () => {
|
|
1330
|
+
* testProviderStore.setState('test-provider-state:running');
|
|
1331
|
+
* ... run tests ...
|
|
1332
|
+
* };
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
1335
|
+
setState: (state: TestProviderState) => void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Runs a callback and automatically updates the test provider's state with running, succeeded or
|
|
1338
|
+
* crashed, depending on the end result.
|
|
1339
|
+
*
|
|
1340
|
+
* - Immediately changes the state to 'running'
|
|
1341
|
+
* - If the callback returns/resolves, change the state to 'succeeded'.
|
|
1342
|
+
* - If the callback throws an error/rejects, change the state to 'crashed'.
|
|
1343
|
+
*
|
|
1344
|
+
* This approach helps prevent state inconsistencies that might occur if exceptions are thrown
|
|
1345
|
+
* during test execution.
|
|
1346
|
+
*
|
|
1347
|
+
* @example
|
|
1348
|
+
*
|
|
1349
|
+
* ```typescript
|
|
1350
|
+
* // Run tests with automatic state management
|
|
1351
|
+
* const runTests = () => {
|
|
1352
|
+
* testProviderStore.runWithState(async () => {
|
|
1353
|
+
* // The state is automatically set to 'running' before this callback
|
|
1354
|
+
*
|
|
1355
|
+
* // Run tests here...
|
|
1356
|
+
* const results = await executeTests();
|
|
1357
|
+
* });
|
|
1358
|
+
* };
|
|
1359
|
+
* ```
|
|
1360
|
+
*/
|
|
1361
|
+
runWithState: (callback: () => void | Promise<void>) => Promise<void>;
|
|
1362
|
+
/** The unique identifier for this test provider */
|
|
1363
|
+
testProviderId: TestProviderId;
|
|
1364
|
+
};
|
|
1365
|
+
/**
|
|
1366
|
+
* React OR preview hook for accessing the state of _all_ test providers. This hook will only
|
|
1367
|
+
* trigger a re-render when the state changes. It is recommended to pass the optional selector, to
|
|
1368
|
+
* get more fine-grained control of re-renders.
|
|
1369
|
+
*
|
|
1370
|
+
* @example
|
|
1371
|
+
*
|
|
1372
|
+
* ```typescript
|
|
1373
|
+
* const TestStatus = () => {
|
|
1374
|
+
* const state = useTestProviderStore((state) => state['my-test-provider']);
|
|
1375
|
+
* };
|
|
1376
|
+
* ```
|
|
1377
|
+
*/
|
|
1378
|
+
type UseTestProviderStore = <T = TestProviderStateByProviderId>(
|
|
1379
|
+
/**
|
|
1380
|
+
* Optional selector function to extract or transform specific parts of the state
|
|
1381
|
+
*
|
|
1382
|
+
* @example
|
|
1383
|
+
*
|
|
1384
|
+
* ```typescript
|
|
1385
|
+
* // Use the entire state
|
|
1386
|
+
* const allProviderStates = useTestProviderStore();
|
|
1387
|
+
*
|
|
1388
|
+
* // Get state for a specific provider
|
|
1389
|
+
* const myProviderState = useTestProviderStore((state) => state['my-test-provider']);
|
|
1390
|
+
*
|
|
1391
|
+
* // Get a count of providers in each state
|
|
1392
|
+
* const statusCounts = useTestProviderStore((state) => {
|
|
1393
|
+
* const counts = {
|
|
1394
|
+
* pending: 0,
|
|
1395
|
+
* running: 0,
|
|
1396
|
+
* succeeded: 0,
|
|
1397
|
+
* crashed: 0,
|
|
1398
|
+
* };
|
|
1399
|
+
*
|
|
1400
|
+
* Object.values(state).forEach((status) => {
|
|
1401
|
+
* if (status === 'test-provider-state:pending') counts.pending++;
|
|
1402
|
+
* else if (status === 'test-provider-state:running') counts.running++;
|
|
1403
|
+
* else if (status === 'test-provider-state:succeeded') counts.succeeded++;
|
|
1404
|
+
* else if (status === 'test-provider-state:crashed') counts.crashed++;
|
|
1405
|
+
* });
|
|
1406
|
+
*
|
|
1407
|
+
* return counts;
|
|
1408
|
+
* });
|
|
1409
|
+
*
|
|
1410
|
+
* // Check if all tests have completed
|
|
1411
|
+
* const allTestsCompleted = useTestProviderStore((state) => {
|
|
1412
|
+
* return Object.values(state).every(
|
|
1413
|
+
* (status) =>
|
|
1414
|
+
* status === 'test-provider-state:succeeded' ||
|
|
1415
|
+
* status === 'test-provider-state:crashed'
|
|
1416
|
+
* );
|
|
1417
|
+
* });
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
selector?: (state: TestProviderStateByProviderId) => T) => T;
|
|
1421
|
+
|
|
1422
|
+
declare const fullStatusStore: StatusStore & {
|
|
1423
|
+
selectStatuses: (statuses: Status[]) => void;
|
|
1424
|
+
typeId: undefined;
|
|
1425
|
+
};
|
|
1426
|
+
declare const getStatusStoreByTypeId: (typeId: StatusTypeId) => StatusStoreByTypeId;
|
|
1427
|
+
declare const useStatusStore: UseStatusStore;
|
|
1428
|
+
|
|
1429
|
+
declare const fullTestProviderStore: {
|
|
1430
|
+
settingsChanged: () => void;
|
|
1431
|
+
onRunAll: (listener: () => void) => () => void;
|
|
1432
|
+
onClearAll: (listener: () => void) => () => void;
|
|
1433
|
+
} & {
|
|
1434
|
+
getFullState: UniversalStore<TestProviderStateByProviderId, TestProviderStoreEvent>["getState"];
|
|
1435
|
+
setFullState: UniversalStore<TestProviderStateByProviderId, TestProviderStoreEvent>["setState"];
|
|
1436
|
+
onSettingsChanged: (listener: (testProviderId: TestProviderId) => void) => () => void;
|
|
1437
|
+
runAll: () => void;
|
|
1438
|
+
clearAll: () => void;
|
|
1439
|
+
};
|
|
1440
|
+
declare const getTestProviderStoreById: (testProviderId: TestProviderId) => TestProviderStoreById;
|
|
1441
|
+
declare const useTestProviderStore: UseTestProviderStore;
|
|
1442
|
+
|
|
1142
1443
|
declare const ActiveTabs: {
|
|
1143
1444
|
SIDEBAR: "sidebar";
|
|
1144
1445
|
CANVAS: "canvas";
|
|
@@ -1208,4 +1509,4 @@ declare function useArgTypes(): ArgTypes;
|
|
|
1208
1509
|
|
|
1209
1510
|
declare const typesX: typeof Addon_TypesEnum;
|
|
1210
1511
|
|
|
1211
|
-
export { type API, type API_EventMap, ActiveTabs, AddonStore, type Combo, ManagerConsumer as Consumer, type KeyboardEventLike, ManagerContext, type ManagerProviderProps, ManagerProvider as Provider, RequestResponseError, type State, type Options as StoreOptions, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, experimental_requestResponse, useUniversalStore as experimental_useUniversalStore, isMacLike, isShortcutTaken, keyToSymbol, _default as merge, mockChannel, optionOrAltSymbol, shortcutMatchesShortcut, shortcutToHumanString, typesX as types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState };
|
|
1512
|
+
export { type API, type API_EventMap, ActiveTabs, AddonStore, type Combo, ManagerConsumer as Consumer, type KeyboardEventLike, ManagerContext, type ManagerProviderProps, ManagerProvider as Provider, RequestResponseError, type State, type Options as StoreOptions, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, MockUniversalStore as experimental_MockUniversalStore, UniversalStore as experimental_UniversalStore, getStatusStoreByTypeId as experimental_getStatusStore, getTestProviderStoreById as experimental_getTestProviderStore, experimental_requestResponse, useStatusStore as experimental_useStatusStore, useTestProviderStore as experimental_useTestProviderStore, useUniversalStore as experimental_useUniversalStore, fullStatusStore as internal_fullStatusStore, fullTestProviderStore as internal_fullTestProviderStore, isMacLike, isShortcutTaken, keyToSymbol, _default as merge, mockChannel, optionOrAltSymbol, shortcutMatchesShortcut, shortcutToHumanString, typesX as types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState };
|