@storybook/manager-api 7.1.0-alpha.8 → 7.1.0-beta.0

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/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import React, { ReactNode, Component, ReactElement, FC } from 'react';
2
- import { API_Provider, Addon_Types, API_Collection, API_Panels, API_StateMerger, API_Notification, API_Settings, API_LoadedRefData, StoryId, API_HashEntry, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, Args, API_IndexHash, API_ComposedRef, API_DocsEntry, API_Refs, API_SetRefData, API_ComposedRefUpdate, API_Layout, API_UI, API_PanelPositions, API_Versions, API_UnknownEntries, API_Version, Globals, GlobalTypes, Addon_Collection, Addon_Type, Addon_Config, API_ProviderData, API_OptionsData, Parameters, ArgTypes } from '@storybook/types';
2
+ import { API_IframeRenderer, Addon_Type, Addon_Types, API_Collection, API_Panels, API_StateMerger, API_Provider, API_Notification, API_Settings, API_LoadedRefData, StoryId, API_HashEntry, API_LeafEntry, API_PreparedStoryIndex, API_StoryEntry, Args, API_IndexHash, API_ComposedRef, API_DocsEntry, API_Refs, API_SetRefData, API_ComposedRefUpdate, API_Layout, API_UI, API_PanelPositions, API_Versions, API_UnknownEntries, API_Version, Globals, GlobalTypes, Addon_Collection, Addon_Config, API_ProviderData, API_OptionsData, Parameters, ArgTypes } from '@storybook/types';
3
3
  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, Addon_TypesEnum as types } from '@storybook/types';
4
4
  import { NavigateOptions, RouterData } from '@storybook/router';
5
5
  import { Listener, Channel } from '@storybook/channels';
6
6
  export { Listener as ChannelListener } from '@storybook/channels';
7
7
  import { toId } from '@storybook/csf';
8
8
  import { ThemeVars } from '@storybook/theming';
9
+ import { WhatsNewData } from '@storybook/core-events';
9
10
 
10
11
  type GetState = () => State;
11
12
  type SetState = (a: any, b: any) => any;
@@ -31,120 +32,439 @@ declare class Store {
31
32
  }
32
33
 
33
34
  interface SubAPI$c {
34
- renderPreview?: API_Provider<API>['renderPreview'];
35
+ renderPreview?: API_IframeRenderer;
35
36
  }
36
37
 
37
38
  interface SubAPI$b {
38
- getElements: <T>(type: Addon_Types) => API_Collection<T>;
39
+ /**
40
+ * Returns a collection of elements of a specific type.
41
+ * @protected This is used internally in storybook's manager.
42
+ * @template T - The type of the elements in the collection.
43
+ * @param {Addon_Types} type - The type of the elements to retrieve.
44
+ * @returns {API_Collection<T>} - A collection of elements of the specified type.
45
+ */
46
+ getElements: <T = Addon_Type>(type: Addon_Types) => API_Collection<T>;
47
+ /**
48
+ * Returns a collection of all panels.
49
+ * This is the same as calling getElements('panel')
50
+ * @protected This is used internally in storybook's manager.
51
+ * @deprecated please use getElements('panel') instead. This API will be removed in storybook 8.0.
52
+ * @returns {API_Panels} - A collection of all panels.
53
+ */
39
54
  getPanels: () => API_Panels;
55
+ /**
56
+ * Returns a collection of panels currently enabled for the selected story.
57
+ * @protected This is used internally in storybook's manager.
58
+ * @deprecated please use getElements('panel') instead, and do the filtering manually. This API will be removed in storybook 8.0.
59
+ * @returns {API_Panels} - A collection of all panels.
60
+ */
40
61
  getStoryPanels: () => API_Panels;
62
+ /**
63
+ * Returns the id of the currently selected panel.
64
+ * @returns {string} - The ID of the currently selected panel.
65
+ */
41
66
  getSelectedPanel: () => string;
67
+ /**
68
+ * Sets the currently selected panel via it's ID.
69
+ * @param {string} panelName - The ID of the panel to select.
70
+ * @returns {void}
71
+ */
42
72
  setSelectedPanel: (panelName: string) => void;
73
+ /**
74
+ * Sets the state of an addon with the given ID.
75
+ * @template S - The type of the addon state.
76
+ * @param {string} addonId - The ID of the addon to set the state for.
77
+ * @param {S | API_StateMerger<S>} newStateOrMerger - The new state to set, or a function that merges the current state with the new state.
78
+ * @param {Options} [options] - Optional options for the state update.
79
+ * @deprecated This API might get dropped, if you are using this, please file an issue.
80
+ * @returns {Promise<S>} - A promise that resolves with the new state after it has been set.
81
+ */
43
82
  setAddonState<S>(addonId: string, newStateOrMerger: S | API_StateMerger<S>, options?: Options): Promise<S>;
83
+ /**
84
+ * Returns the state of an addon with the given ID.
85
+ * @template S - The type of the addon state.
86
+ * @param {string} addonId - The ID of the addon to get the state for.
87
+ * @deprecated This API might get dropped, if you are using this, please file an issue.
88
+ * @returns {S} - The state of the addon with the given ID.
89
+ */
44
90
  getAddonState<S>(addonId: string): S;
45
91
  }
46
92
 
47
93
  interface SubAPI$a {
94
+ /**
95
+ * Returns the channel object.
96
+ * @protected Please do not use, it's for internal use only.
97
+ */
48
98
  getChannel: () => API_Provider<API>['channel'];
49
- on: (type: string, cb: Listener) => () => void;
50
- off: (type: string, cb: Listener) => void;
99
+ /**
100
+ * Adds a listener to the channel for the given event type.
101
+ * Returns a function that can be called to remove the listener.
102
+ * @param type - The event type to listen for. If using a core event, import it from `@storybook/core-events`.
103
+ * @param handler - The callback function to be called when the event is emitted.
104
+ * @returns A function that can be called to remove the listener.
105
+ */
106
+ on: (type: string, handler: Listener) => () => void;
107
+ /**
108
+ * Removes a listener from the channel for the given event type.
109
+ * @param type - The event type to remove the listener from. If using a core event, import it from `@storybook/core-events`.
110
+ * @param handler - The callback function to be removed.
111
+ */
112
+ off: (type: string, handler: Listener) => void;
113
+ /**
114
+ * Emits an event on the channel for the given event type.
115
+ * @param type - The event type to emit. If using a core event, import it from `@storybook/core-events`.
116
+ * @param args - The arguments to pass to the event listener.
117
+ */
51
118
  emit: (type: string, ...args: any[]) => void;
52
- once: (type: string, cb: Listener) => void;
119
+ /**
120
+ * Adds a one-time listener to the channel for the given event type.
121
+ * @param type - The event type to listen for. If using a core event, import it from `@storybook/core-events`.
122
+ * @param handler - The callback function to be called when the event is emitted.
123
+ */
124
+ once: (type: string, handler: Listener) => void;
125
+ /**
126
+ * Emits an event to collapse all stories in the UI.
127
+ * @deprecated Use `emit(STORIES_COLLAPSE_ALL)` instead. This API will be removed in Storybook 8.0.
128
+ */
53
129
  collapseAll: () => void;
130
+ /**
131
+ * Emits an event to expand all stories in the UI.
132
+ * @deprecated Use `emit(STORIES_EXPAND_ALL)` instead. This API will be removed in Storybook 8.0.
133
+ */
54
134
  expandAll: () => void;
55
135
  }
56
136
 
57
137
  interface SubState$9 {
58
138
  notifications: API_Notification[];
59
139
  }
140
+ /**
141
+ * The API for managing notifications.
142
+ */
60
143
  interface SubAPI$9 {
144
+ /**
145
+ * Adds a new notification to the list of notifications.
146
+ * If a notification with the same ID already exists, it will be replaced.
147
+ * @param notification - The notification to add.
148
+ */
61
149
  addNotification: (notification: API_Notification) => void;
150
+ /**
151
+ * Removes a notification from the list of notifications and calls the onClear callback.
152
+ * @param id - The ID of the notification to remove.
153
+ */
62
154
  clearNotification: (id: string) => void;
63
155
  }
64
156
 
65
157
  interface SubAPI$8 {
66
- changeSettingsTab: (tab: string) => void;
158
+ /**
159
+ * Changes the active settings tab.
160
+ * @param path - The path of the settings page to navigate to. The path NOT should include the `/settings` prefix.
161
+ * @example changeSettingsTab(`about`).
162
+ */
163
+ changeSettingsTab: (path: string) => void;
164
+ /**
165
+ * Closes the settings screen and returns to the last tracked story or the first story.
166
+ */
67
167
  closeSettings: () => void;
168
+ /**
169
+ * Checks if the settings screen is currently active.
170
+ * @returns A boolean indicating whether the settings screen is active.
171
+ */
68
172
  isSettingsScreenActive: () => boolean;
173
+ /**
174
+ * Navigates to the specified settings page.
175
+ * @param path - The path of the settings page to navigate to. The path should include the `/settings` prefix.
176
+ * @example navigateToSettingsPage(`/settings/about`).
177
+ * @deprecated Use `changeSettingsTab` instead.
178
+ */
69
179
  navigateToSettingsPage: (path: string) => Promise<void>;
70
180
  }
71
181
  interface SubState$8 {
72
182
  settings: API_Settings;
73
183
  }
74
184
 
75
- interface SubAPI$7 {
76
- releaseNotesVersion: () => string;
77
- setDidViewReleaseNotes: () => void;
78
- showReleaseNotesOnLaunch: () => boolean;
79
- }
80
- interface SubState$7 {
81
- releaseNotesViewed: string[];
82
- }
83
-
84
185
  type Direction = -1 | 1;
85
186
  type ParameterName = string;
86
187
  type ViewMode = 'story' | 'info' | 'settings' | string | undefined;
87
188
  type StoryUpdate = Partial<Pick<API_StoryEntry, 'prepared' | 'parameters' | 'initialArgs' | 'argTypes' | 'args'>>;
189
+ interface StatusObject {
190
+ status: 'pending' | 'success' | 'error' | 'warn' | 'unknown';
191
+ title: string;
192
+ description: string;
193
+ data?: any;
194
+ }
195
+ type StatusState = Record<StoryId, Record<string, StatusObject>>;
196
+ type StatusUpdate = Record<StoryId, StatusObject>;
88
197
  type DocsUpdate = Partial<Pick<API_DocsEntry, 'prepared' | 'parameters'>>;
89
- interface SubState$6 extends API_LoadedRefData {
198
+ interface SubState$7 extends API_LoadedRefData {
90
199
  storyId: StoryId;
91
200
  viewMode: ViewMode;
201
+ status: StatusState;
92
202
  }
93
- interface SubAPI$6 {
203
+ interface SubAPI$7 {
204
+ /**
205
+ * The `storyId` method is a reference to the `toId` function from `@storybook/csf`, which is used to generate a unique ID for a story.
206
+ * This ID is used to identify a specific story in the Storybook index.
207
+ *
208
+ * @type {typeof toId}
209
+ */
94
210
  storyId: typeof toId;
211
+ /**
212
+ * Resolves a story, docs, component or group ID to its corresponding hash entry in the index.
213
+ *
214
+ * @param {StoryId} storyId - The ID of the story to resolve.
215
+ * @param {string} [refsId] - The ID of the refs to use for resolving the story.
216
+ * @returns {API_HashEntry} - The hash entry corresponding to the given story ID.
217
+ */
95
218
  resolveStory: (storyId: StoryId, refsId?: string) => API_HashEntry;
219
+ /**
220
+ * Selects the first story to display in the Storybook UI.
221
+ *
222
+ * @returns {void}
223
+ */
96
224
  selectFirstStory: () => void;
97
- selectStory: (kindOrId?: string, story?: string, obj?: {
225
+ /**
226
+ * Selects a story to display in the Storybook UI.
227
+ *
228
+ * @param {string} [kindOrId] - The kind or ID of the story to select.
229
+ * @param {StoryId} [story] - The ID of the story to select.
230
+ * @param {Object} [obj] - An optional object containing additional options.
231
+ * @param {string} [obj.ref] - The ref ID of the story to select.
232
+ * @param {ViewMode} [obj.viewMode] - The view mode to display the story in.
233
+ * @returns {void}
234
+ */
235
+ selectStory: (kindOrId?: string, story?: StoryId, obj?: {
98
236
  ref?: string;
99
237
  viewMode?: ViewMode;
100
238
  }) => void;
239
+ /**
240
+ * Returns the current story's data, including its ID, kind, name, and parameters.
241
+ *
242
+ * @returns {API_LeafEntry} The current story's data.
243
+ */
101
244
  getCurrentStoryData: () => API_LeafEntry;
245
+ /**
246
+ * Sets the prepared story index to the given value.
247
+ *
248
+ * @param {API_PreparedStoryIndex} index - The prepared story index to set.
249
+ * @returns {Promise<void>} A promise that resolves when the prepared story index has been set.
250
+ */
102
251
  setIndex: (index: API_PreparedStoryIndex) => Promise<void>;
252
+ /**
253
+ * Jumps to the next or previous component in the index.
254
+ *
255
+ * @param {Direction} direction - The direction to jump. Use -1 to jump to the previous component, and 1 to jump to the next component.
256
+ * @returns {void}
257
+ */
103
258
  jumpToComponent: (direction: Direction) => void;
259
+ /**
260
+ * Jumps to the next or previous story in the story index.
261
+ *
262
+ * @param {Direction} direction - The direction to jump. Use -1 to jump to the previous story, and 1 to jump to the next story.
263
+ * @returns {void}
264
+ */
104
265
  jumpToStory: (direction: Direction) => void;
266
+ /**
267
+ * Returns the data for the given story ID and optional ref ID.
268
+ *
269
+ * @param {StoryId} storyId - The ID of the story to retrieve data for.
270
+ * @param {string} [refId] - The ID of the ref to retrieve data for. If not provided, retrieves data for the default ref.
271
+ * @returns {API_LeafEntry} The data for the given story ID and optional ref ID.
272
+ */
105
273
  getData: (storyId: StoryId, refId?: string) => API_LeafEntry;
274
+ /**
275
+ * Returns a boolean indicating whether the given story ID and optional ref ID have been prepared.
276
+ *
277
+ * @param {StoryId} storyId - The ID of the story to check.
278
+ * @param {string} [refId] - The ID of the ref to check. If not provided, checks all refs for the given story ID.
279
+ * @returns {boolean} A boolean indicating whether the given story ID and optional ref ID have been prepared.
280
+ */
106
281
  isPrepared: (storyId: StoryId, refId?: string) => boolean;
282
+ /**
283
+ * Returns the parameters for the given story ID and optional ref ID.
284
+ *
285
+ * @param {StoryId | { storyId: StoryId; refId: string }} storyId - The ID of the story to retrieve parameters for, or an object containing the story ID and ref ID.
286
+ * @param {ParameterName} [parameterName] - The name of the parameter to retrieve. If not provided, returns all parameters.
287
+ * @returns {API_StoryEntry['parameters'] | any} The parameters for the given story ID and optional ref ID.
288
+ */
107
289
  getParameters: (storyId: StoryId | {
108
290
  storyId: StoryId;
109
291
  refId: string;
110
292
  }, parameterName?: ParameterName) => API_StoryEntry['parameters'] | any;
293
+ /**
294
+ * Returns the current value of the specified parameter for the currently selected story.
295
+ *
296
+ * @template S - The type of the parameter value.
297
+ * @param {ParameterName} [parameterName] - The name of the parameter to retrieve. If not provided, returns all parameters.
298
+ * @returns {S} The value of the specified parameter for the currently selected story.
299
+ */
111
300
  getCurrentParameter<S>(parameterName?: ParameterName): S;
301
+ /**
302
+ * Updates the arguments for the given story with the provided new arguments.
303
+ *
304
+ * @param {API_StoryEntry} story - The story to update the arguments for.
305
+ * @param {Args} newArgs - The new arguments to set for the story.
306
+ * @returns {void}
307
+ */
112
308
  updateStoryArgs(story: API_StoryEntry, newArgs: Args): void;
309
+ /**
310
+ * Resets the arguments for the given story to their initial values.
311
+ *
312
+ * @param {API_StoryEntry} story - The story to reset the arguments for.
313
+ * @param {string[]} [argNames] - An optional array of argument names to reset. If not provided, all arguments will be reset.
314
+ * @returns {void}
315
+ */
113
316
  resetStoryArgs: (story: API_StoryEntry, argNames?: string[]) => void;
317
+ /**
318
+ * Finds the leaf entry for the given story ID in the given story index.
319
+ *
320
+ * @param {API_IndexHash} index - The story index to search for the leaf entry in.
321
+ * @param {StoryId} storyId - The ID of the story to find the leaf entry for.
322
+ * @returns {API_LeafEntry} The leaf entry for the given story ID, or null if no leaf entry was found.
323
+ */
114
324
  findLeafEntry(index: API_IndexHash, storyId: StoryId): API_LeafEntry;
325
+ /**
326
+ * Finds the leaf story ID for the given component or group ID in the given index.
327
+ *
328
+ * @param {API_IndexHash} index - The story index to search for the leaf story ID in.
329
+ * @param {StoryId} storyId - The ID of the story to find the leaf story ID for.
330
+ * @returns {StoryId} The ID of the leaf story, or null if no leaf story was found.
331
+ */
115
332
  findLeafStoryId(index: API_IndexHash, storyId: StoryId): StoryId;
333
+ /**
334
+ * Finds the ID of the sibling story in the given direction for the given story ID in the given story index.
335
+ *
336
+ * @param {StoryId} storyId - The ID of the story to find the sibling of.
337
+ * @param {API_IndexHash} index - The story index to search for the sibling in.
338
+ * @param {Direction} direction - The direction to search for the sibling in.
339
+ * @param {boolean} toSiblingGroup - When true, skips over leafs within the same group.
340
+ * @returns {StoryId} The ID of the sibling story, or null if no sibling was found.
341
+ */
116
342
  findSiblingStoryId(storyId: StoryId, index: API_IndexHash, direction: Direction, toSiblingGroup: boolean): StoryId;
343
+ /**
344
+ * Fetches the story index from the server.
345
+ *
346
+ * @returns {Promise<void>} A promise that resolves when the index has been fetched.
347
+ */
117
348
  fetchIndex: () => Promise<void>;
349
+ /**
350
+ * Updates the story with the given ID with the provided update object.
351
+ *
352
+ * @param {StoryId} storyId - The ID of the story to update.
353
+ * @param {StoryUpdate} update - An object containing the updated story information.
354
+ * @param {API_ComposedRef} [ref] - The composed ref of the story to update.
355
+ * @returns {Promise<void>} A promise that resolves when the story has been updated.
356
+ */
118
357
  updateStory: (storyId: StoryId, update: StoryUpdate, ref?: API_ComposedRef) => Promise<void>;
358
+ /**
359
+ * Updates the documentation for the given story ID with the given update object.
360
+ *
361
+ * @param {StoryId} storyId - The ID of the story to update.
362
+ * @param {DocsUpdate} update - An object containing the updated documentation information.
363
+ * @param {API_ComposedRef} [ref] - The composed ref of the story to update.
364
+ * @returns {Promise<void>} A promise that resolves when the documentation has been updated.
365
+ */
119
366
  updateDocs: (storyId: StoryId, update: DocsUpdate, ref?: API_ComposedRef) => Promise<void>;
367
+ /**
368
+ * Sets the preview as initialized.
369
+ *
370
+ * @param {ComposedRef} [ref] - The composed ref of the story to set as initialized.
371
+ * @returns {Promise<void>} A promise that resolves when the preview has been set as initialized.
372
+ */
120
373
  setPreviewInitialized: (ref?: API_ComposedRef) => Promise<void>;
374
+ /**
375
+ * Updates the status of a collection of stories.
376
+ *
377
+ * @param {string} addonId - The ID of the addon to update.
378
+ * @param {StatusUpdate} update - An object containing the updated status information.
379
+ * @returns {Promise<void>} A promise that resolves when the status has been updated.
380
+ */
381
+ experimental_updateStatus: (addonId: string, update: StatusUpdate) => Promise<void>;
121
382
  }
122
383
 
123
- interface SubState$5 {
384
+ interface SubState$6 {
124
385
  refs: API_Refs;
125
386
  }
126
- interface SubAPI$5 {
387
+ interface SubAPI$6 {
388
+ /**
389
+ * Finds a composed ref by its source.
390
+ * @param {string} source - The source/URL of the composed ref.
391
+ * @returns {API_ComposedRef} - The composed ref object.
392
+ */
127
393
  findRef: (source: string) => API_ComposedRef;
394
+ /**
395
+ * Sets a composed ref by its ID and data.
396
+ * @param {string} id - The ID of the composed ref.
397
+ * @param {API_SetRefData} data - The data to set for the composed ref.
398
+ * @param {boolean} [ready] - Whether the composed ref is ready.
399
+ */
128
400
  setRef: (id: string, data: API_SetRefData, ready?: boolean) => void;
401
+ /**
402
+ * Updates a composed ref by its ID and update object.
403
+ * @param {string} id - The ID of the composed ref.
404
+ * @param {API_ComposedRefUpdate} ref - The update object for the composed ref.
405
+ */
129
406
  updateRef: (id: string, ref: API_ComposedRefUpdate) => void;
407
+ /**
408
+ * Gets all composed refs.
409
+ * @returns {API_Refs} - The composed refs object.
410
+ */
130
411
  getRefs: () => API_Refs;
412
+ /**
413
+ * Checks if a composed ref is valid.
414
+ * @param {API_SetRefData} ref - The composed ref to check.
415
+ * @returns {Promise<void>} - A promise that resolves when the check is complete.
416
+ */
131
417
  checkRef: (ref: API_SetRefData) => Promise<void>;
418
+ /**
419
+ * Changes the version of a composed ref by its ID and URL.
420
+ * @param {string} id - The ID of the composed ref.
421
+ * @param {string} url - The new URL for the composed ref.
422
+ */
132
423
  changeRefVersion: (id: string, url: string) => void;
424
+ /**
425
+ * Changes the state of a composed ref by its ID and previewInitialized flag.
426
+ * @param {string} id - The ID of the composed ref.
427
+ * @param {boolean} previewInitialized - The new previewInitialized flag for the composed ref.
428
+ */
133
429
  changeRefState: (id: string, previewInitialized: boolean) => void;
134
430
  }
135
431
 
136
- interface SubState$4 {
432
+ interface SubState$5 {
137
433
  layout: API_Layout;
138
434
  ui: API_UI;
139
435
  selectedPanel: string | undefined;
140
436
  theme: ThemeVars;
141
437
  }
142
- interface SubAPI$4 {
438
+ interface SubAPI$5 {
439
+ /**
440
+ * Toggles the fullscreen mode of the Storybook UI.
441
+ * @param toggled - Optional boolean value to set the fullscreen mode to. If not provided, it will toggle the current state.
442
+ */
143
443
  toggleFullscreen: (toggled?: boolean) => void;
444
+ /**
445
+ * Toggles the visibility of the panel in the Storybook UI.
446
+ * @param toggled - Optional boolean value to set the panel visibility to. If not provided, it will toggle the current state.
447
+ */
144
448
  togglePanel: (toggled?: boolean) => void;
449
+ /**
450
+ * Toggles the position of the panel in the Storybook UI.
451
+ * @param position - Optional string value to set the panel position to. If not provided, it will toggle between 'bottom' and 'right'.
452
+ */
145
453
  togglePanelPosition: (position?: API_PanelPositions) => void;
454
+ /**
455
+ * Toggles the visibility of the navigation bar in the Storybook UI.
456
+ * @param toggled - Optional boolean value to set the navigation bar visibility to. If not provided, it will toggle the current state.
457
+ */
146
458
  toggleNav: (toggled?: boolean) => void;
459
+ /**
460
+ * Toggles the visibility of the toolbar in the Storybook UI.
461
+ * @param toggled - Optional boolean value to set the toolbar visibility to. If not provided, it will toggle the current state.
462
+ */
147
463
  toggleToolbar: (toggled?: boolean) => void;
464
+ /**
465
+ * Sets the options for the Storybook UI.
466
+ * @param options - An object containing the options to set.
467
+ */
148
468
  setOptions: (options: any) => void;
149
469
  }
150
470
 
@@ -160,21 +480,70 @@ declare const eventMatchesShortcut: (e: KeyboardEventLike, shortcut: API_KeyColl
160
480
  declare const keyToSymbol: (key: string) => string;
161
481
  declare const shortcutToHumanString: (shortcut: API_KeyCollection) => string;
162
482
 
163
- interface SubState$3 {
483
+ interface SubState$4 {
164
484
  shortcuts: API_Shortcuts;
165
485
  }
166
- interface SubAPI$3 {
486
+ interface SubAPI$4 {
487
+ /**
488
+ * Returns the current shortcuts.
489
+ */
167
490
  getShortcutKeys(): API_Shortcuts;
491
+ /**
492
+ * Returns the default shortcuts.
493
+ */
168
494
  getDefaultShortcuts(): API_Shortcuts | API_AddonShortcutDefaults;
495
+ /**
496
+ * Returns the shortcuts for addons.
497
+ */
169
498
  getAddonsShortcuts(): API_AddonShortcuts;
499
+ /**
500
+ * Returns the labels for addon shortcuts.
501
+ */
170
502
  getAddonsShortcutLabels(): API_AddonShortcutLabels;
503
+ /**
504
+ * Returns the default shortcuts for addons.
505
+ */
171
506
  getAddonsShortcutDefaults(): API_AddonShortcutDefaults;
507
+ /**
508
+ * Sets the shortcuts to the given value.
509
+ * @param shortcuts The new shortcuts to set.
510
+ * @returns A promise that resolves to the new shortcuts.
511
+ */
172
512
  setShortcuts(shortcuts: API_Shortcuts): Promise<API_Shortcuts>;
513
+ /**
514
+ * Sets the shortcut for the given action to the given value.
515
+ * @param action The action to set the shortcut for.
516
+ * @param value The new shortcut to set.
517
+ * @returns A promise that resolves to the new shortcut.
518
+ */
173
519
  setShortcut(action: API_Action, value: API_KeyCollection): Promise<API_KeyCollection>;
520
+ /**
521
+ * Sets the shortcut for the given addon to the given value.
522
+ * @param addon The addon to set the shortcut for.
523
+ * @param shortcut The new shortcut to set.
524
+ * @returns A promise that resolves to the new addon shortcut.
525
+ */
174
526
  setAddonShortcut(addon: string, shortcut: API_AddonShortcut): Promise<API_AddonShortcut>;
527
+ /**
528
+ * Restores all default shortcuts.
529
+ * @returns A promise that resolves to the new shortcuts.
530
+ */
175
531
  restoreAllDefaultShortcuts(): Promise<API_Shortcuts>;
532
+ /**
533
+ * Restores the default shortcut for the given action.
534
+ * @param action The action to restore the default shortcut for.
535
+ * @returns A promise that resolves to the new shortcut.
536
+ */
176
537
  restoreDefaultShortcut(action: API_Action): Promise<API_KeyCollection>;
538
+ /**
539
+ * Handles a keydown event.
540
+ * @param event The event to handle.
541
+ */
177
542
  handleKeydownEvent(event: KeyboardEventLike): void;
543
+ /**
544
+ * Handles a shortcut feature.
545
+ * @param feature The feature to handle.
546
+ */
178
547
  handleShortcutFeature(feature: API_Action): void;
179
548
  }
180
549
  type API_KeyCollection = string[];
@@ -211,15 +580,39 @@ type API_AddonShortcuts = Record<string, API_AddonShortcut>;
211
580
  type API_AddonShortcutLabels = Record<string, string>;
212
581
  type API_AddonShortcutDefaults = Record<string, API_KeyCollection>;
213
582
 
214
- interface SubState$2 {
583
+ interface SubState$3 {
215
584
  customQueryParams: QueryParams;
216
585
  }
217
586
  interface QueryParams {
218
587
  [key: string]: string | null;
219
588
  }
220
- interface SubAPI$2 {
589
+ /**
590
+ * SubAPI for managing URL navigation and state.
591
+ */
592
+ interface SubAPI$3 {
593
+ /**
594
+ * Navigate to a new URL.
595
+ * @param {string} url - The URL to navigate to.
596
+ * @param {NavigateOptions} options - Options for the navigation.
597
+ * @returns {void}
598
+ */
221
599
  navigateUrl: (url: string, options: NavigateOptions) => void;
600
+ /**
601
+ * Get the value of a query parameter from the current URL.
602
+ * @param {string} key - The key of the query parameter to get.
603
+ * @returns {string | undefined} The value of the query parameter, or undefined if it does not exist.
604
+ */
222
605
  getQueryParam: (key: string) => string | undefined;
606
+ /**
607
+ * Returns an object containing the current state of the URL.
608
+ * @returns {{
609
+ * queryParams: QueryParams,
610
+ * path: string,
611
+ * viewMode?: string,
612
+ * storyId?: string,
613
+ * url: string
614
+ * }} An object containing the current state of the URL.
615
+ */
223
616
  getUrlState: () => {
224
617
  queryParams: QueryParams;
225
618
  path: string;
@@ -227,27 +620,68 @@ interface SubAPI$2 {
227
620
  storyId?: string;
228
621
  url: string;
229
622
  };
623
+ /**
624
+ * Set the query parameters for the current URL.
625
+ * @param {QueryParams} input - An object containing the query parameters to set.
626
+ * @returns {void}
627
+ */
230
628
  setQueryParams: (input: QueryParams) => void;
231
629
  }
232
630
 
233
- interface SubState$1 {
631
+ interface SubState$2 {
234
632
  versions: API_Versions & API_UnknownEntries;
235
633
  lastVersionCheck: number;
236
634
  dismissedVersionNotification: undefined | string;
237
635
  }
238
- interface SubAPI$1 {
636
+ interface SubAPI$2 {
637
+ /**
638
+ * Returns the current version of the Storybook Manager.
639
+ *
640
+ * @returns {API_Version} The current version of the Storybook Manager.
641
+ */
239
642
  getCurrentVersion: () => API_Version;
643
+ /**
644
+ * Returns the latest version of the Storybook Manager.
645
+ *
646
+ * @returns {API_Version} The latest version of the Storybook Manager.
647
+ */
240
648
  getLatestVersion: () => API_Version;
649
+ /**
650
+ * Checks if an update is available for the Storybook Manager.
651
+ *
652
+ * @returns {boolean} True if an update is available, false otherwise.
653
+ */
241
654
  versionUpdateAvailable: () => boolean;
242
655
  }
243
656
 
657
+ type SubState$1 = {
658
+ whatsNewData?: WhatsNewData;
659
+ };
660
+ type SubAPI$1 = {
661
+ isWhatsNewUnread(): boolean;
662
+ whatsNewHasBeenRead(): void;
663
+ };
664
+
244
665
  interface SubState {
245
666
  globals?: Globals;
246
667
  globalTypes?: GlobalTypes;
247
668
  }
248
669
  interface SubAPI {
670
+ /**
671
+ * Returns the current global data object.
672
+ * @returns {Globals} The current global data object.
673
+ */
249
674
  getGlobals: () => Globals;
675
+ /**
676
+ * Returns the current global types object.
677
+ * @returns {GlobalTypes} The current global types object.
678
+ */
250
679
  getGlobalTypes: () => GlobalTypes;
680
+ /**
681
+ * Updates the current global data object with the provided new global data object.
682
+ * @param {Globals} newGlobals - The new global data object to update with.
683
+ * @returns {void}
684
+ */
251
685
  updateGlobals: (newGlobals: Globals) => void;
252
686
  }
253
687
 
@@ -261,15 +695,27 @@ declare class AddonStore {
261
695
  private elements;
262
696
  private config;
263
697
  private channel;
698
+ /**
699
+ * @deprecated will be removed in 8.0
700
+ */
264
701
  private serverChannel;
265
702
  private promise;
266
703
  private resolve;
267
704
  getChannel: () => Channel;
705
+ /**
706
+ * @deprecated will be removed in 8.0, use getChannel instead
707
+ */
268
708
  getServerChannel: () => Channel;
269
709
  ready: () => Promise<Channel>;
270
710
  hasChannel: () => boolean;
711
+ /**
712
+ * @deprecated will be removed in 8.0, please use the normal channel instead
713
+ */
271
714
  hasServerChannel: () => boolean;
272
715
  setChannel: (channel: Channel) => void;
716
+ /**
717
+ * @deprecated will be removed in 8.0, please use the normal channel instead
718
+ */
273
719
  setServerChannel: (channel: Channel) => void;
274
720
  getElements: (type: Addon_Types) => Addon_Collection;
275
721
  addPanel: (name: string, options: Addon_Type) => void;
@@ -297,8 +743,8 @@ type ModuleArgs = RouterData & API_ProviderData<API> & {
297
743
  fullAPI: API;
298
744
  store: Store;
299
745
  };
300
- type State = SubState$4 & SubState$6 & SubState$5 & SubState$9 & SubState$1 & SubState$2 & SubState$3 & SubState$7 & SubState$8 & SubState & RouterData & API_OptionsData & DeprecatedState & Other;
301
- type API = SubAPI$b & SubAPI$a & SubAPI$c & SubAPI$6 & SubAPI$5 & SubAPI & SubAPI$4 & SubAPI$9 & SubAPI$3 & SubAPI$7 & SubAPI$8 & SubAPI$1 & SubAPI$2 & Other;
746
+ type State = SubState$5 & SubState$7 & SubState$6 & SubState$9 & SubState$2 & SubState$3 & SubState$4 & SubState$8 & SubState & SubState$1 & RouterData & API_OptionsData & DeprecatedState & Other;
747
+ type API = SubAPI$b & SubAPI$a & SubAPI$c & SubAPI$7 & SubAPI$6 & SubAPI & SubAPI$5 & SubAPI$9 & SubAPI$4 & SubAPI$8 & SubAPI$2 & SubAPI$3 & SubAPI$1 & Other;
302
748
  interface DeprecatedState {
303
749
  /**
304
750
  * @deprecated use index
@@ -339,7 +785,7 @@ declare class ManagerProvider extends Component<ManagerProviderProps, State> {
339
785
  static getDerivedStateFromProps(props: ManagerProviderProps, state: State): State;
340
786
  shouldComponentUpdate(nextProps: ManagerProviderProps, nextState: State): boolean;
341
787
  initModules: () => void;
342
- render(): JSX.Element;
788
+ render(): React.JSX.Element;
343
789
  }
344
790
  interface ManagerConsumerProps<P = unknown> {
345
791
  filter?: (combo: Combo) => P;