@storybook/types 7.3.2 → 7.4.0-alpha.1
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 +1111 -1105
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1430,6 +1430,65 @@ interface ThemeVarsColors {
|
|
|
1430
1430
|
gridCellSize?: number;
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
1433
|
+
type ChannelHandler = (event: ChannelEvent) => void;
|
|
1434
|
+
interface ChannelTransport {
|
|
1435
|
+
send(event: ChannelEvent, options?: any): void;
|
|
1436
|
+
setHandler(handler: ChannelHandler): void;
|
|
1437
|
+
}
|
|
1438
|
+
interface ChannelEvent {
|
|
1439
|
+
type: string;
|
|
1440
|
+
from: string;
|
|
1441
|
+
args: any[];
|
|
1442
|
+
}
|
|
1443
|
+
interface Listener {
|
|
1444
|
+
(...args: any[]): void;
|
|
1445
|
+
}
|
|
1446
|
+
interface ChannelArgsSingle {
|
|
1447
|
+
transport?: ChannelTransport;
|
|
1448
|
+
async?: boolean;
|
|
1449
|
+
}
|
|
1450
|
+
interface ChannelArgsMulti {
|
|
1451
|
+
transports: ChannelTransport[];
|
|
1452
|
+
async?: boolean;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
declare class Channel {
|
|
1456
|
+
readonly isAsync: boolean;
|
|
1457
|
+
private sender;
|
|
1458
|
+
private events;
|
|
1459
|
+
private data;
|
|
1460
|
+
private readonly transports;
|
|
1461
|
+
constructor(input: ChannelArgsMulti);
|
|
1462
|
+
constructor(input: ChannelArgsSingle);
|
|
1463
|
+
get hasTransport(): boolean;
|
|
1464
|
+
addListener(eventName: string, listener: Listener): void;
|
|
1465
|
+
emit(eventName: string, ...args: any): void;
|
|
1466
|
+
last(eventName: string): any;
|
|
1467
|
+
eventNames(): string[];
|
|
1468
|
+
listenerCount(eventName: string): number;
|
|
1469
|
+
listeners(eventName: string): Listener[] | undefined;
|
|
1470
|
+
once(eventName: string, listener: Listener): void;
|
|
1471
|
+
removeAllListeners(eventName?: string): void;
|
|
1472
|
+
removeListener(eventName: string, listener: Listener): void;
|
|
1473
|
+
on(eventName: string, listener: Listener): void;
|
|
1474
|
+
off(eventName: string, listener: Listener): void;
|
|
1475
|
+
private handleEvent;
|
|
1476
|
+
private onceListener;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
interface Options$1 {
|
|
1480
|
+
allowRegExp: boolean;
|
|
1481
|
+
allowFunction: boolean;
|
|
1482
|
+
allowSymbol: boolean;
|
|
1483
|
+
allowDate: boolean;
|
|
1484
|
+
allowUndefined: boolean;
|
|
1485
|
+
allowClass: boolean;
|
|
1486
|
+
allowError: boolean;
|
|
1487
|
+
maxDepth: number;
|
|
1488
|
+
space: number | undefined;
|
|
1489
|
+
lazyEval: boolean;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1433
1492
|
type ExportName = string;
|
|
1434
1493
|
type MetaId = string;
|
|
1435
1494
|
interface StoriesSpecifier {
|
|
@@ -1580,1258 +1639,1205 @@ interface StoryIndex {
|
|
|
1580
1639
|
entries: Record<StoryId, IndexEntry>;
|
|
1581
1640
|
}
|
|
1582
1641
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
type
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
[key in string]: Addon_ArgType<unknown>;
|
|
1591
|
-
};
|
|
1592
|
-
type Addon_Comparator<T> = ((a: T, b: T) => boolean) | ((a: T, b: T) => number);
|
|
1593
|
-
type Addon_StorySortMethod = 'configure' | 'alphabetical';
|
|
1594
|
-
interface Addon_StorySortObjectParameter {
|
|
1595
|
-
method?: Addon_StorySortMethod;
|
|
1596
|
-
order?: any[];
|
|
1597
|
-
locales?: string;
|
|
1598
|
-
includeNames?: boolean;
|
|
1599
|
-
}
|
|
1600
|
-
type IndexEntryLegacy = [StoryId, any, Parameters, Parameters];
|
|
1601
|
-
type Addon_StorySortComparator = Addon_Comparator<IndexEntryLegacy>;
|
|
1602
|
-
type Addon_StorySortParameter = Addon_StorySortComparator | Addon_StorySortObjectParameter;
|
|
1603
|
-
type Addon_StorySortComparatorV7 = Addon_Comparator<IndexEntry>;
|
|
1604
|
-
type Addon_StorySortParameterV7 = Addon_StorySortComparatorV7 | Addon_StorySortObjectParameter;
|
|
1605
|
-
interface Addon_OptionsParameter extends Object {
|
|
1606
|
-
storySort?: Addon_StorySortParameter;
|
|
1607
|
-
theme?: {
|
|
1608
|
-
base: string;
|
|
1609
|
-
brandTitle?: string;
|
|
1610
|
-
};
|
|
1611
|
-
[key: string]: any;
|
|
1612
|
-
}
|
|
1613
|
-
interface Addon_OptionsParameterV7 extends Object {
|
|
1614
|
-
storySort?: Addon_StorySortParameterV7;
|
|
1615
|
-
theme?: {
|
|
1616
|
-
base: string;
|
|
1617
|
-
brandTitle?: string;
|
|
1618
|
-
};
|
|
1619
|
-
[key: string]: any;
|
|
1642
|
+
/**
|
|
1643
|
+
* ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
|
|
1644
|
+
*/
|
|
1645
|
+
type BuilderName = 'webpack5' | '@storybook/builder-webpack5' | string;
|
|
1646
|
+
type RendererName = string;
|
|
1647
|
+
interface ServerChannel {
|
|
1648
|
+
emit(type: string, args?: any): void;
|
|
1620
1649
|
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
storyResult: ReturnType;
|
|
1626
|
-
canvasElement: any;
|
|
1627
|
-
};
|
|
1628
|
-
type Addon_PartialStoryFn<ReturnType = unknown> = PartialStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
1629
|
-
type Addon_LegacyStoryFn<ReturnType = unknown> = LegacyStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
1630
|
-
type Addon_ArgsStoryFn<ReturnType = unknown> = ArgsStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
1631
|
-
type Addon_StoryFn<ReturnType = unknown> = StoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
1632
|
-
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
1633
|
-
type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
|
|
1634
|
-
interface Addon_WrapperSettings {
|
|
1635
|
-
options: object;
|
|
1636
|
-
parameters: {
|
|
1637
|
-
[key: string]: any;
|
|
1650
|
+
interface CoreConfig {
|
|
1651
|
+
builder?: BuilderName | {
|
|
1652
|
+
name: BuilderName;
|
|
1653
|
+
options?: Record<string, any>;
|
|
1638
1654
|
};
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
interface Addon_AddStoryArgs<StoryFnReturnType = unknown> {
|
|
1643
|
-
id: StoryId;
|
|
1644
|
-
kind: StoryKind;
|
|
1645
|
-
name: StoryName;
|
|
1646
|
-
storyFn: Addon_StoryFn<StoryFnReturnType>;
|
|
1647
|
-
parameters: Parameters;
|
|
1648
|
-
}
|
|
1649
|
-
type Addon_ClientApiAddon<StoryFnReturnType = unknown> = Addon_Type & {
|
|
1650
|
-
apply: (a: Addon_StoryApi<StoryFnReturnType>, b: any[]) => any;
|
|
1651
|
-
};
|
|
1652
|
-
interface Addon_ClientApiAddons<StoryFnReturnType> {
|
|
1653
|
-
[key: string]: Addon_ClientApiAddon<StoryFnReturnType>;
|
|
1654
|
-
}
|
|
1655
|
-
type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
|
|
1656
|
-
interface Addon_StoryApi<StoryFnReturnType = unknown> {
|
|
1657
|
-
kind: StoryKind;
|
|
1658
|
-
add: (storyName: StoryName, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
1659
|
-
addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
|
|
1660
|
-
addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
|
|
1661
|
-
addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
1662
|
-
[k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
|
|
1663
|
-
}
|
|
1664
|
-
interface Addon_ClientStoryApi<StoryFnReturnType = unknown> {
|
|
1665
|
-
storiesOf(kind: StoryKind, module: any): Addon_StoryApi<StoryFnReturnType>;
|
|
1666
|
-
}
|
|
1667
|
-
type Addon_LoadFn = () => any;
|
|
1668
|
-
type Addon_RequireContext = any;
|
|
1669
|
-
type Addon_Loadable = Addon_RequireContext | [Addon_RequireContext] | Addon_LoadFn;
|
|
1670
|
-
type Addon_BaseDecorators<StoryFnReturnType> = Array<(story: () => StoryFnReturnType, context: Addon_StoryContext) => StoryFnReturnType>;
|
|
1671
|
-
interface Addon_BaseAnnotations<TArgs, StoryFnReturnType, TRenderer extends Renderer = Renderer> {
|
|
1672
|
-
/**
|
|
1673
|
-
* Dynamic data that are provided (and possibly updated by) Storybook and its addons.
|
|
1674
|
-
* @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
|
|
1675
|
-
*/
|
|
1676
|
-
args?: Partial<TArgs>;
|
|
1655
|
+
renderer?: RendererName;
|
|
1656
|
+
disableWebpackDefaults?: boolean;
|
|
1657
|
+
channelOptions?: Partial<Options$1>;
|
|
1677
1658
|
/**
|
|
1678
|
-
*
|
|
1679
|
-
* @see [Arg types](https://storybook.js.org/docs/react/api/arg-types)
|
|
1659
|
+
* Disables the generation of project.json, a file containing Storybook metadata
|
|
1680
1660
|
*/
|
|
1681
|
-
|
|
1661
|
+
disableProjectJson?: boolean;
|
|
1682
1662
|
/**
|
|
1683
|
-
*
|
|
1684
|
-
* @see
|
|
1663
|
+
* Disables Storybook telemetry
|
|
1664
|
+
* @see https://storybook.js.org/telemetry
|
|
1685
1665
|
*/
|
|
1686
|
-
|
|
1666
|
+
disableTelemetry?: boolean;
|
|
1687
1667
|
/**
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
* Decorators defined in Meta will be applied to every story variation.
|
|
1691
|
-
* @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
|
|
1668
|
+
* Disables notifications for Storybook updates.
|
|
1692
1669
|
*/
|
|
1693
|
-
|
|
1670
|
+
disableWhatsNewNotifications?: boolean;
|
|
1694
1671
|
/**
|
|
1695
|
-
*
|
|
1672
|
+
* Enable crash reports to be sent to Storybook telemetry
|
|
1673
|
+
* @see https://storybook.js.org/telemetry
|
|
1696
1674
|
*/
|
|
1697
|
-
|
|
1675
|
+
enableCrashReports?: boolean;
|
|
1698
1676
|
/**
|
|
1699
|
-
*
|
|
1677
|
+
* enable CORS headings to run document in a "secure context"
|
|
1678
|
+
* see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
|
|
1679
|
+
* This enables these headers in development-mode:
|
|
1680
|
+
* Cross-Origin-Opener-Policy: same-origin
|
|
1681
|
+
* Cross-Origin-Embedder-Policy: require-corp
|
|
1700
1682
|
*/
|
|
1701
|
-
|
|
1683
|
+
crossOriginIsolated?: boolean;
|
|
1702
1684
|
}
|
|
1703
|
-
interface
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
* @example
|
|
1707
|
-
* includeStories: ['SimpleStory', 'ComplexStory']
|
|
1708
|
-
* includeStories: /.*Story$/
|
|
1709
|
-
*
|
|
1710
|
-
* @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
|
|
1711
|
-
*/
|
|
1712
|
-
includeStories?: string[] | RegExp;
|
|
1713
|
-
/**
|
|
1714
|
-
* Used to exclude certain named exports. Useful when you want to have non-story exports such as mock data or ignore a few stories.
|
|
1715
|
-
* @example
|
|
1716
|
-
* excludeStories: ['simpleData', 'complexData']
|
|
1717
|
-
* excludeStories: /.*Data$/
|
|
1718
|
-
*
|
|
1719
|
-
* @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
|
|
1720
|
-
*/
|
|
1721
|
-
excludeStories?: string[] | RegExp;
|
|
1685
|
+
interface DirectoryMapping {
|
|
1686
|
+
from: string;
|
|
1687
|
+
to: string;
|
|
1722
1688
|
}
|
|
1723
|
-
interface
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
* ...
|
|
1734
|
-
* title: 'Design System/Atoms/Button'
|
|
1735
|
-
* }
|
|
1736
|
-
*
|
|
1737
|
-
* @see [Story Hierarchy](https://storybook.js.org/docs/basics/writing-stories/#story-hierarchy)
|
|
1738
|
-
*/
|
|
1739
|
-
title?: string;
|
|
1740
|
-
/**
|
|
1741
|
-
* Manually set the id of a story, which in particular is useful if you want to rename stories without breaking permalinks.
|
|
1742
|
-
*
|
|
1743
|
-
* Storybook will prioritize the id over the title for ID generation, if provided, and will prioritize the story.storyName over the export key for display.
|
|
1744
|
-
*
|
|
1745
|
-
* @see [Sidebar and URLs](https://storybook.js.org/docs/react/configure/sidebar-and-urls#permalinking-to-stories)
|
|
1746
|
-
*/
|
|
1747
|
-
id?: string;
|
|
1748
|
-
/**
|
|
1749
|
-
* The primary component for your story.
|
|
1750
|
-
*
|
|
1751
|
-
* Used by addons for automatic prop table generation and display of other component metadata.
|
|
1752
|
-
*/
|
|
1753
|
-
component?: ComponentType;
|
|
1754
|
-
/**
|
|
1755
|
-
* Auxiliary subcomponents that are part of the stories.
|
|
1756
|
-
*
|
|
1757
|
-
* Used by addons for automatic prop table generation and display of other component metadata.
|
|
1758
|
-
*
|
|
1759
|
-
* @example
|
|
1760
|
-
* import { Button, ButtonGroup } from './components';
|
|
1761
|
-
*
|
|
1762
|
-
* export default {
|
|
1763
|
-
* ...
|
|
1764
|
-
* subcomponents: { Button, ButtonGroup }
|
|
1765
|
-
* }
|
|
1766
|
-
*
|
|
1767
|
-
* By defining them each component will have its tab in the args table.
|
|
1768
|
-
*
|
|
1769
|
-
* @deprecated
|
|
1770
|
-
*/
|
|
1771
|
-
subcomponents?: Record<string, ComponentType>;
|
|
1689
|
+
interface Presets {
|
|
1690
|
+
apply(extension: 'typescript', config: TypescriptOptions, args?: Options): Promise<TypescriptOptions>;
|
|
1691
|
+
apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
|
|
1692
|
+
apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
|
|
1693
|
+
apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
|
|
1694
|
+
apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
|
|
1695
|
+
apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
|
|
1696
|
+
apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
|
|
1697
|
+
apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
|
|
1698
|
+
apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
|
|
1772
1699
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1700
|
+
interface LoadedPreset {
|
|
1701
|
+
name: string;
|
|
1702
|
+
preset: any;
|
|
1703
|
+
options: any;
|
|
1704
|
+
}
|
|
1705
|
+
type PresetConfig = string | {
|
|
1706
|
+
name: string;
|
|
1707
|
+
options?: unknown;
|
|
1778
1708
|
};
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1709
|
+
interface Ref {
|
|
1710
|
+
id: string;
|
|
1711
|
+
url: string;
|
|
1712
|
+
title: string;
|
|
1713
|
+
version: string;
|
|
1714
|
+
type?: string;
|
|
1715
|
+
disable?: boolean;
|
|
1716
|
+
}
|
|
1717
|
+
interface VersionCheck {
|
|
1718
|
+
success: boolean;
|
|
1719
|
+
cached: boolean;
|
|
1720
|
+
data?: any;
|
|
1721
|
+
error?: any;
|
|
1722
|
+
time: number;
|
|
1723
|
+
}
|
|
1724
|
+
interface Stats {
|
|
1725
|
+
toJson: () => any;
|
|
1726
|
+
}
|
|
1727
|
+
interface BuilderResult {
|
|
1728
|
+
totalTime?: ReturnType<typeof process.hrtime>;
|
|
1729
|
+
stats?: Stats;
|
|
1730
|
+
}
|
|
1731
|
+
type PackageJson = PackageJson$1 & Record<string, any>;
|
|
1732
|
+
interface LoadOptions {
|
|
1733
|
+
packageJson: PackageJson;
|
|
1734
|
+
outputDir?: string;
|
|
1735
|
+
configDir?: string;
|
|
1736
|
+
ignorePreview?: boolean;
|
|
1737
|
+
extendServer?: (server: Server) => void;
|
|
1738
|
+
}
|
|
1739
|
+
interface CLIOptions {
|
|
1740
|
+
port?: number;
|
|
1741
|
+
ignorePreview?: boolean;
|
|
1742
|
+
previewUrl?: string;
|
|
1743
|
+
forceBuildPreview?: boolean;
|
|
1744
|
+
disableTelemetry?: boolean;
|
|
1745
|
+
enableCrashReports?: boolean;
|
|
1746
|
+
host?: string;
|
|
1747
|
+
initialPath?: string;
|
|
1785
1748
|
/**
|
|
1786
|
-
* @deprecated
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1749
|
+
* @deprecated Use 'staticDirs' Storybook Configuration option instead
|
|
1750
|
+
*/
|
|
1751
|
+
staticDir?: string[];
|
|
1752
|
+
configDir?: string;
|
|
1753
|
+
https?: boolean;
|
|
1754
|
+
sslCa?: string[];
|
|
1755
|
+
sslCert?: string;
|
|
1756
|
+
sslKey?: string;
|
|
1757
|
+
smokeTest?: boolean;
|
|
1758
|
+
managerCache?: boolean;
|
|
1759
|
+
open?: boolean;
|
|
1760
|
+
ci?: boolean;
|
|
1761
|
+
loglevel?: string;
|
|
1762
|
+
quiet?: boolean;
|
|
1763
|
+
versionUpdates?: boolean;
|
|
1764
|
+
docs?: boolean;
|
|
1765
|
+
debugWebpack?: boolean;
|
|
1766
|
+
webpackStatsJson?: string | boolean;
|
|
1767
|
+
outputDir?: string;
|
|
1768
|
+
}
|
|
1769
|
+
interface BuilderOptions {
|
|
1770
|
+
configType?: 'DEVELOPMENT' | 'PRODUCTION';
|
|
1771
|
+
ignorePreview?: boolean;
|
|
1772
|
+
cache?: FileSystemCache;
|
|
1773
|
+
configDir: string;
|
|
1774
|
+
docsMode?: boolean;
|
|
1775
|
+
features?: StorybookConfig['features'];
|
|
1776
|
+
versionCheck?: VersionCheck;
|
|
1777
|
+
disableWebpackDefaults?: boolean;
|
|
1778
|
+
serverChannelUrl?: string;
|
|
1779
|
+
}
|
|
1780
|
+
interface StorybookConfigOptions {
|
|
1781
|
+
presets: Presets;
|
|
1782
|
+
presetsList?: LoadedPreset[];
|
|
1783
|
+
}
|
|
1784
|
+
type Options = LoadOptions & StorybookConfigOptions & CLIOptions & BuilderOptions;
|
|
1785
|
+
interface Builder<Config, BuilderStats extends Stats = Stats> {
|
|
1786
|
+
getConfig: (options: Options) => Promise<Config>;
|
|
1787
|
+
start: (args: {
|
|
1788
|
+
options: Options;
|
|
1789
|
+
startTime: ReturnType<typeof process.hrtime>;
|
|
1790
|
+
router: Router;
|
|
1791
|
+
server: Server;
|
|
1792
|
+
channel: ServerChannel;
|
|
1793
|
+
}) => Promise<void | {
|
|
1794
|
+
stats?: BuilderStats;
|
|
1795
|
+
totalTime: ReturnType<typeof process.hrtime>;
|
|
1796
|
+
bail: (e?: Error) => Promise<void>;
|
|
1797
|
+
}>;
|
|
1798
|
+
build: (arg: {
|
|
1799
|
+
options: Options;
|
|
1800
|
+
startTime: ReturnType<typeof process.hrtime>;
|
|
1801
|
+
}) => Promise<void | BuilderStats>;
|
|
1802
|
+
bail: (e?: Error) => Promise<void>;
|
|
1803
|
+
corePresets?: string[];
|
|
1804
|
+
overridePresets?: string[];
|
|
1790
1805
|
}
|
|
1791
1806
|
/**
|
|
1792
|
-
*
|
|
1807
|
+
* Options for TypeScript usage within Storybook.
|
|
1793
1808
|
*/
|
|
1794
|
-
|
|
1795
|
-
type: any;
|
|
1796
|
-
props: any;
|
|
1797
|
-
key: any;
|
|
1798
|
-
};
|
|
1799
|
-
type Addon_Type = Addon_BaseType | Addon_PageType | Addon_WrapperType;
|
|
1800
|
-
interface Addon_BaseType {
|
|
1801
|
-
/**
|
|
1802
|
-
* The title of the addon.
|
|
1803
|
-
* This can be a simple string, but it can also be a React.FunctionComponent or a React.ReactElement.
|
|
1804
|
-
*/
|
|
1805
|
-
title: FCWithoutChildren | ReactNode;
|
|
1806
|
-
/**
|
|
1807
|
-
* The type of the addon.
|
|
1808
|
-
* @example Addon_TypesEnum.PANEL
|
|
1809
|
-
*/
|
|
1810
|
-
type: Exclude<Addon_Types, Addon_TypesEnum.PREVIEW>;
|
|
1811
|
-
/**
|
|
1812
|
-
* The unique id of the addon.
|
|
1813
|
-
* @warn This will become non-optional in 8.0
|
|
1814
|
-
*
|
|
1815
|
-
* This needs to be globally unique, so we recommend prefixing it with your org name or npm package name.
|
|
1816
|
-
*
|
|
1817
|
-
* Do not prefix with `storybook`, this is reserved for core storybook feature and core addons.
|
|
1818
|
-
*
|
|
1819
|
-
* @example 'my-org-name/my-addon-name'
|
|
1820
|
-
*/
|
|
1821
|
-
id?: string;
|
|
1809
|
+
interface TypescriptOptions {
|
|
1822
1810
|
/**
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1825
|
-
* With it you can determine if you want your addon to be rendered or not.
|
|
1811
|
+
* Enables type checking within Storybook.
|
|
1826
1812
|
*
|
|
1827
|
-
*
|
|
1828
|
-
*/
|
|
1829
|
-
route?: (routeOptions: RenderData) => string;
|
|
1830
|
-
/**
|
|
1831
|
-
* This will determine the value of `active` prop of your render function.
|
|
1813
|
+
* @default `false`
|
|
1832
1814
|
*/
|
|
1833
|
-
|
|
1815
|
+
check: boolean;
|
|
1834
1816
|
/**
|
|
1835
|
-
*
|
|
1817
|
+
* Disable parsing typescript files through babel.
|
|
1836
1818
|
*
|
|
1837
|
-
*
|
|
1838
|
-
* your function needs to return a JSX.Element within which components are rendered
|
|
1819
|
+
* @default `false`
|
|
1839
1820
|
*/
|
|
1840
|
-
|
|
1821
|
+
skipBabel: boolean;
|
|
1822
|
+
}
|
|
1823
|
+
type Preset = string | {
|
|
1824
|
+
name: string;
|
|
1825
|
+
options?: any;
|
|
1826
|
+
};
|
|
1827
|
+
/**
|
|
1828
|
+
* An additional script that gets injected into the
|
|
1829
|
+
* preview or the manager,
|
|
1830
|
+
*/
|
|
1831
|
+
type Entry = string;
|
|
1832
|
+
type CoreCommon_StorybookRefs = Record<string, {
|
|
1833
|
+
title: string;
|
|
1834
|
+
url: string;
|
|
1835
|
+
} | {
|
|
1836
|
+
disable: boolean;
|
|
1837
|
+
expanded?: boolean;
|
|
1838
|
+
}>;
|
|
1839
|
+
type DocsOptions = {
|
|
1841
1840
|
/**
|
|
1842
|
-
*
|
|
1841
|
+
* What should we call the generated docs entries?
|
|
1843
1842
|
*/
|
|
1844
|
-
|
|
1843
|
+
defaultName?: string;
|
|
1845
1844
|
/**
|
|
1846
|
-
*
|
|
1845
|
+
* Should we generate a docs entry per CSF file?
|
|
1846
|
+
* Set to 'tag' (the default) to generate an entry for every CSF file with the
|
|
1847
|
+
* 'autodocs' tag.
|
|
1847
1848
|
*/
|
|
1848
|
-
|
|
1849
|
+
autodocs?: boolean | 'tag';
|
|
1849
1850
|
/**
|
|
1850
|
-
*
|
|
1851
|
+
* Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
|
|
1851
1852
|
*/
|
|
1852
|
-
|
|
1853
|
-
}
|
|
1853
|
+
docsMode?: boolean;
|
|
1854
|
+
};
|
|
1854
1855
|
/**
|
|
1855
|
-
*
|
|
1856
|
-
* this is correct and more type strict, and future compatible with React.FC in React 18+
|
|
1857
|
-
*
|
|
1858
|
-
* @deprecated This type is deprecated and will be removed in 8.0. (assuming the manager uses React 18 is out by then)
|
|
1856
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
1859
1857
|
*/
|
|
1860
|
-
interface
|
|
1861
|
-
(props: P, context?: any): ReactElement<any, any> | null;
|
|
1862
|
-
propTypes?: WeakValidationMap<P> | undefined;
|
|
1863
|
-
contextTypes?: ValidationMap<any> | undefined;
|
|
1864
|
-
defaultProps?: Partial<P> | undefined;
|
|
1865
|
-
displayName?: string | undefined;
|
|
1866
|
-
}
|
|
1867
|
-
interface Addon_PageType {
|
|
1868
|
-
type: Addon_TypesEnum.experimental_PAGE;
|
|
1869
|
-
/**
|
|
1870
|
-
* The unique id of the page.
|
|
1871
|
-
*/
|
|
1872
|
-
id: string;
|
|
1873
|
-
/**
|
|
1874
|
-
* The URL to navigate to when Storybook needs to navigate to this page.
|
|
1875
|
-
*/
|
|
1876
|
-
url: string;
|
|
1858
|
+
interface StorybookConfig {
|
|
1877
1859
|
/**
|
|
1878
|
-
*
|
|
1860
|
+
* Sets the addons you want to use with Storybook.
|
|
1861
|
+
*
|
|
1862
|
+
* @example `['@storybook/addon-essentials']` or `[{ name: '@storybook/addon-essentials', options: { backgrounds: false } }]`
|
|
1879
1863
|
*/
|
|
1880
|
-
|
|
1864
|
+
addons?: Preset[];
|
|
1865
|
+
core?: CoreConfig;
|
|
1881
1866
|
/**
|
|
1882
|
-
*
|
|
1883
|
-
* Storybook will render your component always.
|
|
1867
|
+
* Sets a list of directories of static files to be loaded by Storybook server
|
|
1884
1868
|
*
|
|
1885
|
-
*
|
|
1886
|
-
|
|
1887
|
-
|
|
1869
|
+
* @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
|
|
1870
|
+
*/
|
|
1871
|
+
staticDirs?: (DirectoryMapping | string)[];
|
|
1872
|
+
logLevel?: string;
|
|
1873
|
+
features?: {
|
|
1874
|
+
/**
|
|
1875
|
+
* Build stories.json automatically on start/build
|
|
1876
|
+
*/
|
|
1877
|
+
buildStoriesJson?: boolean;
|
|
1878
|
+
/**
|
|
1879
|
+
* Activate on demand story store
|
|
1880
|
+
*/
|
|
1881
|
+
storyStoreV7?: boolean;
|
|
1882
|
+
/**
|
|
1883
|
+
* Do not throw errors if using `.mdx` files in SSv7
|
|
1884
|
+
* (for internal use in sandboxes)
|
|
1885
|
+
*/
|
|
1886
|
+
storyStoreV7MdxErrors?: boolean;
|
|
1887
|
+
/**
|
|
1888
|
+
* Filter args with a "target" on the type from the render function (EXPERIMENTAL)
|
|
1889
|
+
*/
|
|
1890
|
+
argTypeTargetsV7?: boolean;
|
|
1891
|
+
/**
|
|
1892
|
+
* Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
|
|
1893
|
+
* Will be removed in 7.0.
|
|
1894
|
+
*/
|
|
1895
|
+
warnOnLegacyHierarchySeparator?: boolean;
|
|
1896
|
+
/**
|
|
1897
|
+
* Use legacy MDX1, to help smooth migration to 7.0
|
|
1898
|
+
*/
|
|
1899
|
+
legacyMdx1?: boolean;
|
|
1900
|
+
/**
|
|
1901
|
+
* Apply decorators from preview.js before decorators from addons or frameworks
|
|
1902
|
+
*/
|
|
1903
|
+
legacyDecoratorFileOrder?: boolean;
|
|
1904
|
+
};
|
|
1905
|
+
/**
|
|
1906
|
+
* Tells Storybook where to find stories.
|
|
1888
1907
|
*
|
|
1889
|
-
*
|
|
1890
|
-
* return (
|
|
1891
|
-
* <Route path="/my-addon">
|
|
1892
|
-
* <MyAddonContent />
|
|
1893
|
-
* </Route>
|
|
1894
|
-
* );
|
|
1895
|
-
* };
|
|
1908
|
+
* @example `['./src/*.stories.@(j|t)sx?']`
|
|
1896
1909
|
*/
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
interface Addon_WrapperType {
|
|
1900
|
-
type: Addon_TypesEnum.PREVIEW;
|
|
1910
|
+
stories: StoriesEntry[];
|
|
1901
1911
|
/**
|
|
1902
|
-
*
|
|
1912
|
+
* Framework, e.g. '@storybook/react-vite', required in v7
|
|
1903
1913
|
*/
|
|
1904
|
-
|
|
1914
|
+
framework?: Preset;
|
|
1905
1915
|
/**
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
* This component must accept a children prop, and render it.
|
|
1916
|
+
* Controls how Storybook handles TypeScript files.
|
|
1909
1917
|
*/
|
|
1910
|
-
|
|
1911
|
-
index: number;
|
|
1912
|
-
children: ReactNode;
|
|
1913
|
-
id: string;
|
|
1914
|
-
storyId: StoryId;
|
|
1915
|
-
active: boolean;
|
|
1916
|
-
}>>;
|
|
1917
|
-
}
|
|
1918
|
-
type Addon_TypeBaseNames = Exclude<Addon_TypesEnum, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE>;
|
|
1919
|
-
interface Addon_TypesMapping extends Record<Addon_TypeBaseNames, Addon_BaseType> {
|
|
1920
|
-
[Addon_TypesEnum.PREVIEW]: Addon_WrapperType;
|
|
1921
|
-
[Addon_TypesEnum.experimental_PAGE]: Addon_PageType;
|
|
1922
|
-
}
|
|
1923
|
-
type Addon_Loader<API> = (api: API) => void;
|
|
1924
|
-
interface Addon_Loaders<API> {
|
|
1925
|
-
[key: string]: Addon_Loader<API>;
|
|
1926
|
-
}
|
|
1927
|
-
interface Addon_Collection<T = Addon_Type> {
|
|
1928
|
-
[key: string]: T;
|
|
1929
|
-
}
|
|
1930
|
-
interface Addon_Elements {
|
|
1931
|
-
[key: string]: Addon_Collection;
|
|
1932
|
-
}
|
|
1933
|
-
interface Addon_ToolbarConfig {
|
|
1934
|
-
hidden?: boolean;
|
|
1935
|
-
}
|
|
1936
|
-
interface Addon_Config {
|
|
1937
|
-
theme?: ThemeVars;
|
|
1938
|
-
toolbar?: {
|
|
1939
|
-
[id: string]: Addon_ToolbarConfig;
|
|
1940
|
-
};
|
|
1941
|
-
[key: string]: any;
|
|
1942
|
-
}
|
|
1943
|
-
declare enum Addon_TypesEnum {
|
|
1918
|
+
typescript?: Partial<TypescriptOptions>;
|
|
1944
1919
|
/**
|
|
1945
|
-
*
|
|
1946
|
-
* @unstable
|
|
1920
|
+
* References external Storybooks
|
|
1947
1921
|
*/
|
|
1948
|
-
|
|
1922
|
+
refs?: PresetValue<CoreCommon_StorybookRefs>;
|
|
1949
1923
|
/**
|
|
1950
|
-
*
|
|
1924
|
+
* Modify or return babel config.
|
|
1951
1925
|
*/
|
|
1952
|
-
|
|
1926
|
+
babel?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
|
|
1953
1927
|
/**
|
|
1954
|
-
*
|
|
1928
|
+
* Modify or return env config.
|
|
1955
1929
|
*/
|
|
1956
|
-
|
|
1930
|
+
env?: PresetValue<Record<string, string>>;
|
|
1957
1931
|
/**
|
|
1958
|
-
*
|
|
1932
|
+
* Modify or return babel config.
|
|
1959
1933
|
*/
|
|
1960
|
-
|
|
1934
|
+
babelDefault?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
|
|
1961
1935
|
/**
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
1936
|
+
* Add additional scripts to run in the preview a la `.storybook/preview.js`
|
|
1937
|
+
*
|
|
1938
|
+
* @deprecated use `previewAnnotations` or `/preview.js` file instead
|
|
1964
1939
|
*/
|
|
1965
|
-
|
|
1940
|
+
config?: PresetValue<Entry[]>;
|
|
1966
1941
|
/**
|
|
1967
|
-
*
|
|
1968
|
-
* @unstable
|
|
1942
|
+
* Add additional scripts to run in the preview a la `.storybook/preview.js`
|
|
1969
1943
|
*/
|
|
1970
|
-
|
|
1944
|
+
previewAnnotations?: PresetValue<Entry[]>;
|
|
1971
1945
|
/**
|
|
1972
|
-
*
|
|
1946
|
+
* Process CSF files for the story index.
|
|
1947
|
+
* @soonDeprecated use {@link experimental_indexers} instead
|
|
1973
1948
|
*/
|
|
1974
|
-
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
type OrString$1<T extends string> = T | (string & {});
|
|
1978
|
-
type ViewMode = OrString$1<ViewMode$1 | 'settings'> | undefined;
|
|
1979
|
-
type Layout = 'centered' | 'fullscreen' | 'padded' | 'none';
|
|
1980
|
-
interface StorybookParameters {
|
|
1981
|
-
options?: Addon_OptionsParameter;
|
|
1949
|
+
storyIndexers?: PresetValue<StoryIndexer[]>;
|
|
1982
1950
|
/**
|
|
1983
|
-
*
|
|
1951
|
+
* Process CSF files for the story index.
|
|
1952
|
+
*/
|
|
1953
|
+
experimental_indexers?: PresetValue<Indexer[]>;
|
|
1954
|
+
/**
|
|
1955
|
+
* Docs related features in index generation
|
|
1956
|
+
*/
|
|
1957
|
+
docs?: DocsOptions;
|
|
1958
|
+
/**
|
|
1959
|
+
* Programmatically modify the preview head/body HTML.
|
|
1960
|
+
* The previewHead and previewBody functions accept a string,
|
|
1961
|
+
* which is the existing head/body, and return a modified string.
|
|
1962
|
+
*/
|
|
1963
|
+
previewHead?: PresetValue<string>;
|
|
1964
|
+
previewBody?: PresetValue<string>;
|
|
1965
|
+
/**
|
|
1966
|
+
* Programmatically override the preview's main page template.
|
|
1967
|
+
* This should return a reference to a file containing an `.ejs` template
|
|
1968
|
+
* that will be interpolated with environment variables.
|
|
1984
1969
|
*
|
|
1985
|
-
*
|
|
1970
|
+
* @example '.storybook/index.ejs'
|
|
1986
1971
|
*/
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1972
|
+
previewMainTemplate?: string;
|
|
1973
|
+
/**
|
|
1974
|
+
* Programmatically modify the preview head/body HTML.
|
|
1975
|
+
* The managerHead function accept a string,
|
|
1976
|
+
* which is the existing head content, and return a modified string.
|
|
1977
|
+
*/
|
|
1978
|
+
managerHead?: PresetValue<string>;
|
|
1992
1979
|
}
|
|
1993
|
-
type
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1980
|
+
type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
|
|
1981
|
+
type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
|
|
1982
|
+
type PresetPropertyFn<K, TStorybookConfig = StorybookConfig, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
|
|
1983
|
+
interface CoreCommon_ResolvedAddonPreset {
|
|
1984
|
+
type: 'presets';
|
|
1985
|
+
name: string;
|
|
1997
1986
|
}
|
|
1998
|
-
type
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
type MaybePromise<T> = Promise<T> | T;
|
|
2002
|
-
type TeardownRenderToCanvas = () => MaybePromise<void>;
|
|
2003
|
-
type RenderToCanvas<TRenderer extends Renderer> = (context: RenderContext<TRenderer>, element: TRenderer['canvasElement']) => MaybePromise<void | TeardownRenderToCanvas>;
|
|
2004
|
-
type ProjectAnnotations<TRenderer extends Renderer> = ProjectAnnotations$1<TRenderer> & {
|
|
2005
|
-
renderToCanvas?: RenderToCanvas<TRenderer>;
|
|
2006
|
-
renderToDOM?: RenderToCanvas<TRenderer>;
|
|
1987
|
+
type PreviewAnnotation = string | {
|
|
1988
|
+
bare: string;
|
|
1989
|
+
absolute: string;
|
|
2007
1990
|
};
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
1991
|
+
interface CoreCommon_ResolvedAddonVirtual {
|
|
1992
|
+
type: 'virtual';
|
|
1993
|
+
name: string;
|
|
1994
|
+
managerEntries?: string[];
|
|
1995
|
+
previewAnnotations?: PreviewAnnotation[];
|
|
1996
|
+
presets?: (string | {
|
|
1997
|
+
name: string;
|
|
1998
|
+
options?: any;
|
|
1999
|
+
})[];
|
|
2000
|
+
}
|
|
2001
|
+
type CoreCommon_OptionsEntry = {
|
|
2002
|
+
name: string;
|
|
2011
2003
|
};
|
|
2012
|
-
type
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2004
|
+
type CoreCommon_AddonEntry = string | CoreCommon_OptionsEntry;
|
|
2005
|
+
type CoreCommon_AddonInfo = {
|
|
2006
|
+
name: string;
|
|
2007
|
+
inEssentials: boolean;
|
|
2016
2008
|
};
|
|
2017
|
-
|
|
2018
|
-
|
|
2009
|
+
interface CoreCommon_StorybookInfo {
|
|
2010
|
+
version: string;
|
|
2011
|
+
framework: string;
|
|
2012
|
+
frameworkPackage: string;
|
|
2013
|
+
renderer: string;
|
|
2014
|
+
rendererPackage: string;
|
|
2015
|
+
configDir?: string;
|
|
2016
|
+
mainConfig?: string;
|
|
2017
|
+
previewConfig?: string;
|
|
2018
|
+
managerConfig?: string;
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
interface API_BaseEntry {
|
|
2019
2022
|
id: StoryId;
|
|
2020
|
-
|
|
2021
|
-
name:
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
moduleExport: ModuleExport;
|
|
2031
|
-
originalStoryFn: StoryFn<TRenderer>;
|
|
2032
|
-
undecoratedStoryFn: LegacyStoryFn<TRenderer>;
|
|
2033
|
-
unboundStoryFn: LegacyStoryFn<TRenderer>;
|
|
2034
|
-
applyLoaders: (context: StoryContextForLoaders<TRenderer>) => Promise<StoryContextForLoaders<TRenderer> & {
|
|
2035
|
-
loaded: StoryContext<TRenderer>['loaded'];
|
|
2036
|
-
}>;
|
|
2037
|
-
playFunction?: (context: StoryContext<TRenderer>) => Promise<void> | void;
|
|
2038
|
-
};
|
|
2039
|
-
type PreparedMeta<TRenderer extends Renderer = Renderer> = Omit<StoryContextForEnhancers<TRenderer>, 'name' | 'story'> & {
|
|
2040
|
-
moduleExport: ModuleExport;
|
|
2041
|
-
};
|
|
2042
|
-
type BoundStory<TRenderer extends Renderer = Renderer> = PreparedStory<TRenderer> & {
|
|
2043
|
-
storyFn: PartialStoryFn<TRenderer>;
|
|
2044
|
-
};
|
|
2045
|
-
declare type RenderContext<TRenderer extends Renderer = Renderer> = StoryIdentifier & {
|
|
2046
|
-
showMain: () => void;
|
|
2047
|
-
showError: (error: {
|
|
2048
|
-
title: string;
|
|
2049
|
-
description: string;
|
|
2050
|
-
}) => void;
|
|
2051
|
-
showException: (err: Error) => void;
|
|
2052
|
-
forceRemount: boolean;
|
|
2053
|
-
storyContext: StoryContext<TRenderer>;
|
|
2054
|
-
storyFn: PartialStoryFn<TRenderer>;
|
|
2055
|
-
unboundStoryFn: LegacyStoryFn<TRenderer>;
|
|
2056
|
-
};
|
|
2057
|
-
|
|
2058
|
-
interface Options$1 {
|
|
2059
|
-
allowRegExp: boolean;
|
|
2060
|
-
allowFunction: boolean;
|
|
2061
|
-
allowSymbol: boolean;
|
|
2062
|
-
allowDate: boolean;
|
|
2063
|
-
allowUndefined: boolean;
|
|
2064
|
-
allowClass: boolean;
|
|
2065
|
-
maxDepth: number;
|
|
2066
|
-
space: number | undefined;
|
|
2067
|
-
lazyEval: boolean;
|
|
2023
|
+
depth: number;
|
|
2024
|
+
name: string;
|
|
2025
|
+
refId?: string;
|
|
2026
|
+
renderLabel?: (item: API_BaseEntry) => any;
|
|
2027
|
+
/** @deprecated */
|
|
2028
|
+
isRoot: boolean;
|
|
2029
|
+
/** @deprecated */
|
|
2030
|
+
isComponent: boolean;
|
|
2031
|
+
/** @deprecated */
|
|
2032
|
+
isLeaf: boolean;
|
|
2068
2033
|
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2034
|
+
interface API_RootEntry extends API_BaseEntry {
|
|
2035
|
+
type: 'root';
|
|
2036
|
+
startCollapsed?: boolean;
|
|
2037
|
+
children: StoryId[];
|
|
2038
|
+
/** @deprecated */
|
|
2039
|
+
isRoot: true;
|
|
2040
|
+
/** @deprecated */
|
|
2041
|
+
isComponent: false;
|
|
2042
|
+
/** @deprecated */
|
|
2043
|
+
isLeaf: false;
|
|
2077
2044
|
}
|
|
2078
|
-
interface
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2045
|
+
interface API_GroupEntry extends API_BaseEntry {
|
|
2046
|
+
type: 'group';
|
|
2047
|
+
parent?: StoryId;
|
|
2048
|
+
children: StoryId[];
|
|
2049
|
+
/** @deprecated */
|
|
2050
|
+
isRoot: false;
|
|
2051
|
+
/** @deprecated */
|
|
2052
|
+
isComponent: false;
|
|
2053
|
+
/** @deprecated */
|
|
2054
|
+
isLeaf: false;
|
|
2055
|
+
}
|
|
2056
|
+
interface API_ComponentEntry extends API_BaseEntry {
|
|
2057
|
+
type: 'component';
|
|
2058
|
+
parent?: StoryId;
|
|
2059
|
+
children: StoryId[];
|
|
2060
|
+
/** @deprecated */
|
|
2061
|
+
isRoot: false;
|
|
2062
|
+
/** @deprecated */
|
|
2063
|
+
isComponent: true;
|
|
2064
|
+
/** @deprecated */
|
|
2065
|
+
isLeaf: false;
|
|
2066
|
+
}
|
|
2067
|
+
interface API_DocsEntry extends API_BaseEntry {
|
|
2068
|
+
type: 'docs';
|
|
2069
|
+
parent: StoryId;
|
|
2070
|
+
title: ComponentTitle;
|
|
2071
|
+
/** @deprecated */
|
|
2072
|
+
kind: ComponentTitle;
|
|
2073
|
+
importPath: Path;
|
|
2074
|
+
tags: Tag[];
|
|
2075
|
+
prepared: boolean;
|
|
2076
|
+
parameters?: {
|
|
2077
|
+
[parameterName: string]: any;
|
|
2082
2078
|
};
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
disableProjectJson?: boolean;
|
|
2090
|
-
/**
|
|
2091
|
-
* Disables Storybook telemetry
|
|
2092
|
-
* @see https://storybook.js.org/telemetry
|
|
2093
|
-
*/
|
|
2094
|
-
disableTelemetry?: boolean;
|
|
2095
|
-
/**
|
|
2096
|
-
* Disables notifications for Storybook updates.
|
|
2097
|
-
*/
|
|
2098
|
-
disableWhatsNewNotifications?: boolean;
|
|
2099
|
-
/**
|
|
2100
|
-
* Enable crash reports to be sent to Storybook telemetry
|
|
2101
|
-
* @see https://storybook.js.org/telemetry
|
|
2102
|
-
*/
|
|
2103
|
-
enableCrashReports?: boolean;
|
|
2104
|
-
/**
|
|
2105
|
-
* enable CORS headings to run document in a "secure context"
|
|
2106
|
-
* see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
|
|
2107
|
-
* This enables these headers in development-mode:
|
|
2108
|
-
* Cross-Origin-Opener-Policy: same-origin
|
|
2109
|
-
* Cross-Origin-Embedder-Policy: require-corp
|
|
2110
|
-
*/
|
|
2111
|
-
crossOriginIsolated?: boolean;
|
|
2079
|
+
/** @deprecated */
|
|
2080
|
+
isRoot: false;
|
|
2081
|
+
/** @deprecated */
|
|
2082
|
+
isComponent: false;
|
|
2083
|
+
/** @deprecated */
|
|
2084
|
+
isLeaf: true;
|
|
2112
2085
|
}
|
|
2113
|
-
interface
|
|
2114
|
-
|
|
2115
|
-
|
|
2086
|
+
interface API_StoryEntry extends API_BaseEntry {
|
|
2087
|
+
type: 'story';
|
|
2088
|
+
parent: StoryId;
|
|
2089
|
+
title: ComponentTitle;
|
|
2090
|
+
/** @deprecated */
|
|
2091
|
+
kind: ComponentTitle;
|
|
2092
|
+
importPath: Path;
|
|
2093
|
+
tags: Tag[];
|
|
2094
|
+
prepared: boolean;
|
|
2095
|
+
parameters?: {
|
|
2096
|
+
[parameterName: string]: any;
|
|
2097
|
+
};
|
|
2098
|
+
args?: Args;
|
|
2099
|
+
argTypes?: ArgTypes;
|
|
2100
|
+
initialArgs?: Args;
|
|
2101
|
+
/** @deprecated */
|
|
2102
|
+
isRoot: false;
|
|
2103
|
+
/** @deprecated */
|
|
2104
|
+
isComponent: false;
|
|
2105
|
+
/** @deprecated */
|
|
2106
|
+
isLeaf: true;
|
|
2116
2107
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2108
|
+
type API_LeafEntry = API_DocsEntry | API_StoryEntry;
|
|
2109
|
+
type API_HashEntry = API_RootEntry | API_GroupEntry | API_ComponentEntry | API_DocsEntry | API_StoryEntry;
|
|
2110
|
+
/** @deprecated */
|
|
2111
|
+
type API_Root = API_RootEntry;
|
|
2112
|
+
/** @deprecated */
|
|
2113
|
+
type API_Group = API_GroupEntry | API_ComponentEntry;
|
|
2114
|
+
/** @deprecated */
|
|
2115
|
+
type API_Story = API_LeafEntry;
|
|
2116
|
+
/**
|
|
2117
|
+
* The `IndexHash` is our manager-side representation of the `StoryIndex`.
|
|
2118
|
+
* We create entries in the hash not only for each story or docs entry, but
|
|
2119
|
+
* also for each "group" of the component (split on '/'), as that's how things
|
|
2120
|
+
* are manipulated in the manager (i.e. in the sidebar)
|
|
2121
|
+
*/
|
|
2122
|
+
interface API_IndexHash {
|
|
2123
|
+
[id: string]: API_HashEntry;
|
|
2127
2124
|
}
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2125
|
+
type API_PreparedIndexEntry = IndexEntry & {
|
|
2126
|
+
parameters?: Parameters;
|
|
2127
|
+
argTypes?: ArgTypes;
|
|
2128
|
+
args?: Args;
|
|
2129
|
+
initialArgs?: Args;
|
|
2130
|
+
};
|
|
2131
|
+
interface API_PreparedStoryIndex {
|
|
2132
|
+
v: number;
|
|
2133
|
+
entries: Record<StoryId, API_PreparedIndexEntry>;
|
|
2132
2134
|
}
|
|
2133
|
-
type
|
|
2134
|
-
|
|
2135
|
-
options?: unknown;
|
|
2135
|
+
type API_OptionsData = {
|
|
2136
|
+
docsOptions: DocsOptions;
|
|
2136
2137
|
};
|
|
2137
|
-
interface
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2138
|
+
interface API_ReleaseNotes {
|
|
2139
|
+
success?: boolean;
|
|
2140
|
+
currentVersion?: string;
|
|
2141
|
+
showOnFirstLaunch?: boolean;
|
|
2142
|
+
}
|
|
2143
|
+
interface API_Settings {
|
|
2144
|
+
lastTrackedStoryId: string;
|
|
2145
|
+
}
|
|
2146
|
+
interface API_Version {
|
|
2141
2147
|
version: string;
|
|
2142
|
-
|
|
2143
|
-
|
|
2148
|
+
info?: {
|
|
2149
|
+
plain: string;
|
|
2150
|
+
};
|
|
2151
|
+
[key: string]: any;
|
|
2144
2152
|
}
|
|
2145
|
-
interface
|
|
2146
|
-
|
|
2147
|
-
|
|
2153
|
+
interface API_UnknownEntries {
|
|
2154
|
+
[key: string]: {
|
|
2155
|
+
[key: string]: any;
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
interface API_Versions$1 {
|
|
2159
|
+
latest?: API_Version;
|
|
2160
|
+
next?: API_Version;
|
|
2161
|
+
current?: API_Version;
|
|
2162
|
+
}
|
|
2163
|
+
type API_StatusValue = 'pending' | 'success' | 'error' | 'warn' | 'unknown';
|
|
2164
|
+
interface API_StatusObject {
|
|
2165
|
+
status: API_StatusValue;
|
|
2166
|
+
title: string;
|
|
2167
|
+
description: string;
|
|
2148
2168
|
data?: any;
|
|
2149
|
-
error?: any;
|
|
2150
|
-
time: number;
|
|
2151
2169
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2170
|
+
type API_StatusState = Record<StoryId, Record<string, API_StatusObject>>;
|
|
2171
|
+
type API_StatusUpdate = Record<StoryId, API_StatusObject>;
|
|
2172
|
+
type API_FilterFunction = (item: API_PreparedIndexEntry & {
|
|
2173
|
+
status: Record<string, API_StatusObject>;
|
|
2174
|
+
}) => boolean;
|
|
2175
|
+
|
|
2176
|
+
interface SetStoriesStory {
|
|
2177
|
+
id: StoryId;
|
|
2178
|
+
name: string;
|
|
2179
|
+
refId?: string;
|
|
2180
|
+
componentId?: ComponentId;
|
|
2181
|
+
kind: StoryKind;
|
|
2182
|
+
parameters: {
|
|
2183
|
+
fileName: string;
|
|
2184
|
+
options: {
|
|
2185
|
+
[optionName: string]: any;
|
|
2186
|
+
};
|
|
2187
|
+
docsOnly?: boolean;
|
|
2188
|
+
viewMode?: API_ViewMode;
|
|
2189
|
+
[parameterName: string]: any;
|
|
2190
|
+
};
|
|
2191
|
+
argTypes?: ArgTypes;
|
|
2192
|
+
args?: Args;
|
|
2193
|
+
initialArgs?: Args;
|
|
2154
2194
|
}
|
|
2155
|
-
interface
|
|
2156
|
-
|
|
2157
|
-
stats?: Stats;
|
|
2195
|
+
interface SetStoriesStoryData {
|
|
2196
|
+
[id: string]: SetStoriesStory;
|
|
2158
2197
|
}
|
|
2159
|
-
type
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2198
|
+
type SetStoriesPayload = {
|
|
2199
|
+
v: 2;
|
|
2200
|
+
error?: Error;
|
|
2201
|
+
globals: Args;
|
|
2202
|
+
globalParameters: Parameters;
|
|
2203
|
+
stories: SetStoriesStoryData;
|
|
2204
|
+
kindParameters: {
|
|
2205
|
+
[kind: string]: Parameters;
|
|
2206
|
+
};
|
|
2207
|
+
} | ({
|
|
2208
|
+
v?: number;
|
|
2209
|
+
stories: SetStoriesStoryData;
|
|
2210
|
+
} & Record<string, never>);
|
|
2211
|
+
interface SetGlobalsPayload {
|
|
2212
|
+
globals: Globals;
|
|
2213
|
+
globalTypes: GlobalTypes;
|
|
2166
2214
|
}
|
|
2167
|
-
interface
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
enableCrashReports?: boolean;
|
|
2174
|
-
host?: string;
|
|
2175
|
-
initialPath?: string;
|
|
2176
|
-
/**
|
|
2177
|
-
* @deprecated Use 'staticDirs' Storybook Configuration option instead
|
|
2178
|
-
*/
|
|
2179
|
-
staticDir?: string[];
|
|
2180
|
-
configDir?: string;
|
|
2181
|
-
https?: boolean;
|
|
2182
|
-
sslCa?: string[];
|
|
2183
|
-
sslCert?: string;
|
|
2184
|
-
sslKey?: string;
|
|
2185
|
-
smokeTest?: boolean;
|
|
2186
|
-
managerCache?: boolean;
|
|
2187
|
-
open?: boolean;
|
|
2188
|
-
ci?: boolean;
|
|
2189
|
-
loglevel?: string;
|
|
2190
|
-
quiet?: boolean;
|
|
2191
|
-
versionUpdates?: boolean;
|
|
2192
|
-
docs?: boolean;
|
|
2193
|
-
debugWebpack?: boolean;
|
|
2194
|
-
webpackStatsJson?: string | boolean;
|
|
2195
|
-
outputDir?: string;
|
|
2215
|
+
interface StoryPreparedPayload {
|
|
2216
|
+
id: StoryId;
|
|
2217
|
+
parameters: Parameters;
|
|
2218
|
+
argTypes: ArgTypes;
|
|
2219
|
+
initialArgs: Args;
|
|
2220
|
+
args: Args;
|
|
2196
2221
|
}
|
|
2197
|
-
interface
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
cache?: FileSystemCache;
|
|
2201
|
-
configDir: string;
|
|
2202
|
-
docsMode?: boolean;
|
|
2203
|
-
features?: StorybookConfig['features'];
|
|
2204
|
-
versionCheck?: VersionCheck;
|
|
2205
|
-
disableWebpackDefaults?: boolean;
|
|
2206
|
-
serverChannelUrl?: string;
|
|
2222
|
+
interface DocsPreparedPayload {
|
|
2223
|
+
id: StoryId;
|
|
2224
|
+
parameters: Parameters;
|
|
2207
2225
|
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2226
|
+
|
|
2227
|
+
type OrString$1<T extends string> = T | (string & {});
|
|
2228
|
+
type API_ViewMode = OrString$1<'story' | 'docs' | 'settings'> | undefined;
|
|
2229
|
+
type API_RenderOptions = Addon_RenderOptions;
|
|
2230
|
+
interface API_RouteOptions {
|
|
2231
|
+
storyId: string;
|
|
2232
|
+
viewMode: API_ViewMode;
|
|
2233
|
+
location: RenderData['location'];
|
|
2234
|
+
path: string;
|
|
2211
2235
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
startTime: ReturnType<typeof process.hrtime>;
|
|
2218
|
-
router: Router;
|
|
2219
|
-
server: Server;
|
|
2220
|
-
channel: ServerChannel;
|
|
2221
|
-
}) => Promise<void | {
|
|
2222
|
-
stats?: BuilderStats;
|
|
2223
|
-
totalTime: ReturnType<typeof process.hrtime>;
|
|
2224
|
-
bail: (e?: Error) => Promise<void>;
|
|
2225
|
-
}>;
|
|
2226
|
-
build: (arg: {
|
|
2227
|
-
options: Options;
|
|
2228
|
-
startTime: ReturnType<typeof process.hrtime>;
|
|
2229
|
-
}) => Promise<void | BuilderStats>;
|
|
2230
|
-
bail: (e?: Error) => Promise<void>;
|
|
2231
|
-
corePresets?: string[];
|
|
2232
|
-
overridePresets?: string[];
|
|
2236
|
+
interface API_MatchOptions {
|
|
2237
|
+
storyId: string;
|
|
2238
|
+
viewMode: API_ViewMode;
|
|
2239
|
+
location: RenderData['location'];
|
|
2240
|
+
path: string;
|
|
2233
2241
|
}
|
|
2234
2242
|
/**
|
|
2235
|
-
*
|
|
2243
|
+
* @deprecated this is synonymous with `Addon_Type`. This interface will be removed in 8.0
|
|
2236
2244
|
*/
|
|
2237
|
-
|
|
2238
|
-
/**
|
|
2239
|
-
* Enables type checking within Storybook.
|
|
2240
|
-
*
|
|
2241
|
-
* @default `false`
|
|
2242
|
-
*/
|
|
2243
|
-
check: boolean;
|
|
2244
|
-
/**
|
|
2245
|
-
* Disable parsing typescript files through babel.
|
|
2246
|
-
*
|
|
2247
|
-
* @default `false`
|
|
2248
|
-
*/
|
|
2249
|
-
skipBabel: boolean;
|
|
2250
|
-
}
|
|
2251
|
-
type Preset = string | {
|
|
2252
|
-
name: string;
|
|
2253
|
-
options?: any;
|
|
2254
|
-
};
|
|
2245
|
+
type API_Addon = Addon_Type;
|
|
2255
2246
|
/**
|
|
2256
|
-
*
|
|
2257
|
-
* preview or the manager,
|
|
2247
|
+
* @deprecated this is synonymous with `Addon_Collection`. This interface will be removed in 8.0
|
|
2258
2248
|
*/
|
|
2259
|
-
type
|
|
2260
|
-
type CoreCommon_StorybookRefs = Record<string, {
|
|
2261
|
-
title: string;
|
|
2262
|
-
url: string;
|
|
2263
|
-
} | {
|
|
2264
|
-
disable: boolean;
|
|
2265
|
-
expanded?: boolean;
|
|
2266
|
-
}>;
|
|
2267
|
-
type DocsOptions = {
|
|
2268
|
-
/**
|
|
2269
|
-
* What should we call the generated docs entries?
|
|
2270
|
-
*/
|
|
2271
|
-
defaultName?: string;
|
|
2272
|
-
/**
|
|
2273
|
-
* Should we generate a docs entry per CSF file?
|
|
2274
|
-
* Set to 'tag' (the default) to generate an entry for every CSF file with the
|
|
2275
|
-
* 'autodocs' tag.
|
|
2276
|
-
*/
|
|
2277
|
-
autodocs?: boolean | 'tag';
|
|
2278
|
-
/**
|
|
2279
|
-
* Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
|
|
2280
|
-
*/
|
|
2281
|
-
docsMode?: boolean;
|
|
2282
|
-
};
|
|
2249
|
+
type API_Collection<T = Addon_Type> = Addon_Collection<T>;
|
|
2283
2250
|
/**
|
|
2284
|
-
*
|
|
2251
|
+
* @deprecated This interface will be removed in 8.0
|
|
2285
2252
|
*/
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
/**
|
|
2295
|
-
* Sets a list of directories of static files to be loaded by Storybook server
|
|
2296
|
-
*
|
|
2297
|
-
* @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
|
|
2298
|
-
*/
|
|
2299
|
-
staticDirs?: (DirectoryMapping | string)[];
|
|
2300
|
-
logLevel?: string;
|
|
2301
|
-
features?: {
|
|
2302
|
-
/**
|
|
2303
|
-
* Build stories.json automatically on start/build
|
|
2304
|
-
*/
|
|
2305
|
-
buildStoriesJson?: boolean;
|
|
2306
|
-
/**
|
|
2307
|
-
* Activate on demand story store
|
|
2308
|
-
*/
|
|
2309
|
-
storyStoreV7?: boolean;
|
|
2310
|
-
/**
|
|
2311
|
-
* Do not throw errors if using `.mdx` files in SSv7
|
|
2312
|
-
* (for internal use in sandboxes)
|
|
2313
|
-
*/
|
|
2314
|
-
storyStoreV7MdxErrors?: boolean;
|
|
2315
|
-
/**
|
|
2316
|
-
* Filter args with a "target" on the type from the render function (EXPERIMENTAL)
|
|
2317
|
-
*/
|
|
2318
|
-
argTypeTargetsV7?: boolean;
|
|
2319
|
-
/**
|
|
2320
|
-
* Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
|
|
2321
|
-
* Will be removed in 7.0.
|
|
2322
|
-
*/
|
|
2323
|
-
warnOnLegacyHierarchySeparator?: boolean;
|
|
2324
|
-
/**
|
|
2325
|
-
* Use legacy MDX1, to help smooth migration to 7.0
|
|
2326
|
-
*/
|
|
2327
|
-
legacyMdx1?: boolean;
|
|
2328
|
-
/**
|
|
2329
|
-
* Apply decorators from preview.js before decorators from addons or frameworks
|
|
2330
|
-
*/
|
|
2331
|
-
legacyDecoratorFileOrder?: boolean;
|
|
2332
|
-
};
|
|
2333
|
-
/**
|
|
2334
|
-
* Tells Storybook where to find stories.
|
|
2335
|
-
*
|
|
2336
|
-
* @example `['./src/*.stories.@(j|t)sx?']`
|
|
2337
|
-
*/
|
|
2338
|
-
stories: StoriesEntry[];
|
|
2253
|
+
type API_Panels = Addon_Collection<Addon_BaseType>;
|
|
2254
|
+
type API_StateMerger<S> = (input: S) => S;
|
|
2255
|
+
interface API_ProviderData<API> {
|
|
2256
|
+
provider: API_Provider<API>;
|
|
2257
|
+
docsOptions: DocsOptions;
|
|
2258
|
+
}
|
|
2259
|
+
interface API_Provider<API> {
|
|
2260
|
+
channel?: Channel;
|
|
2339
2261
|
/**
|
|
2340
|
-
*
|
|
2262
|
+
* @deprecated will be removed in 8.0, please use channel instead
|
|
2341
2263
|
*/
|
|
2342
|
-
|
|
2264
|
+
serverChannel?: Channel;
|
|
2265
|
+
renderPreview?: API_IframeRenderer;
|
|
2266
|
+
handleAPI(api: API): void;
|
|
2267
|
+
getConfig(): {
|
|
2268
|
+
sidebar?: API_SidebarOptions;
|
|
2269
|
+
theme?: ThemeVars;
|
|
2270
|
+
StoryMapper?: API_StoryMapper;
|
|
2271
|
+
[k: string]: any;
|
|
2272
|
+
} & Partial<API_UIOptions>;
|
|
2273
|
+
[key: string]: any;
|
|
2274
|
+
}
|
|
2275
|
+
type API_IframeRenderer = (storyId: string, viewMode: API_ViewMode, id: string, baseUrl: string, scale: number, queryParams: Record<string, any>) => React.ReactElement<any, any> | null;
|
|
2276
|
+
interface API_UIOptions {
|
|
2277
|
+
name?: string;
|
|
2278
|
+
url?: string;
|
|
2279
|
+
goFullScreen: boolean;
|
|
2280
|
+
showStoriesPanel: boolean;
|
|
2281
|
+
showAddonPanel: boolean;
|
|
2282
|
+
addonPanelInRight: boolean;
|
|
2283
|
+
theme?: ThemeVars;
|
|
2284
|
+
selectedPanel?: string;
|
|
2285
|
+
}
|
|
2286
|
+
interface API_Layout {
|
|
2287
|
+
initialActive: API_ActiveTabsType;
|
|
2288
|
+
isFullscreen: boolean;
|
|
2289
|
+
showPanel: boolean;
|
|
2290
|
+
panelPosition: API_PanelPositions;
|
|
2291
|
+
showNav: boolean;
|
|
2292
|
+
showTabs: boolean;
|
|
2293
|
+
showToolbar: boolean;
|
|
2343
2294
|
/**
|
|
2344
|
-
*
|
|
2295
|
+
* @deprecated, will be removed in 8.0 - this API no longer works
|
|
2345
2296
|
*/
|
|
2346
|
-
|
|
2297
|
+
isToolshown?: boolean;
|
|
2298
|
+
}
|
|
2299
|
+
interface API_UI {
|
|
2300
|
+
name?: string;
|
|
2301
|
+
url?: string;
|
|
2302
|
+
enableShortcuts: boolean;
|
|
2303
|
+
}
|
|
2304
|
+
type API_PanelPositions = 'bottom' | 'right';
|
|
2305
|
+
type API_ActiveTabsType = 'sidebar' | 'canvas' | 'addons';
|
|
2306
|
+
interface API_SidebarOptions {
|
|
2307
|
+
showRoots?: boolean;
|
|
2308
|
+
filters?: Record<string, API_FilterFunction>;
|
|
2309
|
+
collapsedRoots?: string[];
|
|
2310
|
+
renderLabel?: (item: API_HashEntry) => any;
|
|
2311
|
+
}
|
|
2312
|
+
interface OnClearOptions {
|
|
2347
2313
|
/**
|
|
2348
|
-
*
|
|
2314
|
+
* True when the user dismissed the notification.
|
|
2349
2315
|
*/
|
|
2350
|
-
|
|
2316
|
+
dismissed: boolean;
|
|
2317
|
+
}
|
|
2318
|
+
interface API_Notification {
|
|
2319
|
+
id: string;
|
|
2320
|
+
link: string;
|
|
2321
|
+
content: {
|
|
2322
|
+
headline: string;
|
|
2323
|
+
subHeadline?: string | any;
|
|
2324
|
+
};
|
|
2325
|
+
icon?: {
|
|
2326
|
+
name: string;
|
|
2327
|
+
color?: string;
|
|
2328
|
+
};
|
|
2329
|
+
onClear?: (options: OnClearOptions) => void;
|
|
2330
|
+
}
|
|
2331
|
+
type API_Versions = Record<string, string>;
|
|
2332
|
+
type API_SetRefData = Partial<API_ComposedRef & {
|
|
2333
|
+
setStoriesData: SetStoriesStoryData;
|
|
2334
|
+
storyIndex: StoryIndex;
|
|
2335
|
+
}>;
|
|
2336
|
+
type API_StoryMapper = (ref: API_ComposedRef, story: SetStoriesStory) => SetStoriesStory;
|
|
2337
|
+
interface API_LoadedRefData {
|
|
2338
|
+
index?: API_IndexHash;
|
|
2339
|
+
indexError?: Error;
|
|
2340
|
+
previewInitialized: boolean;
|
|
2341
|
+
}
|
|
2342
|
+
interface API_ComposedRef extends API_LoadedRefData {
|
|
2343
|
+
id: string;
|
|
2344
|
+
title?: string;
|
|
2345
|
+
url: string;
|
|
2346
|
+
type?: 'auto-inject' | 'unknown' | 'lazy' | 'server-checked';
|
|
2347
|
+
expanded?: boolean;
|
|
2348
|
+
versions?: API_Versions;
|
|
2349
|
+
loginUrl?: string;
|
|
2350
|
+
version?: string;
|
|
2351
|
+
}
|
|
2352
|
+
type API_ComposedRefUpdate = Partial<Pick<API_ComposedRef, 'title' | 'type' | 'expanded' | 'index' | 'versions' | 'loginUrl' | 'version' | 'indexError' | 'previewInitialized'>>;
|
|
2353
|
+
type API_Refs = Record<string, API_ComposedRef>;
|
|
2354
|
+
type API_RefId = string;
|
|
2355
|
+
type API_RefUrl = string;
|
|
2356
|
+
|
|
2357
|
+
type Addon_Types = Exclude<Addon_TypesEnum, Addon_TypesEnum.experimental_PAGE>;
|
|
2358
|
+
interface Addon_ArgType<TArg = unknown> extends InputType {
|
|
2359
|
+
defaultValue?: TArg;
|
|
2360
|
+
}
|
|
2361
|
+
type Addons_ArgTypes<TArgs = Args> = {
|
|
2362
|
+
[key in keyof Partial<TArgs>]: Addon_ArgType<TArgs[key]>;
|
|
2363
|
+
} & {
|
|
2364
|
+
[key in string]: Addon_ArgType<unknown>;
|
|
2365
|
+
};
|
|
2366
|
+
type Addon_Comparator<T> = ((a: T, b: T) => boolean) | ((a: T, b: T) => number);
|
|
2367
|
+
type Addon_StorySortMethod = 'configure' | 'alphabetical';
|
|
2368
|
+
interface Addon_StorySortObjectParameter {
|
|
2369
|
+
method?: Addon_StorySortMethod;
|
|
2370
|
+
order?: any[];
|
|
2371
|
+
locales?: string;
|
|
2372
|
+
includeNames?: boolean;
|
|
2373
|
+
}
|
|
2374
|
+
type IndexEntryLegacy = [StoryId, any, Parameters, Parameters];
|
|
2375
|
+
type Addon_StorySortComparator = Addon_Comparator<IndexEntryLegacy>;
|
|
2376
|
+
type Addon_StorySortParameter = Addon_StorySortComparator | Addon_StorySortObjectParameter;
|
|
2377
|
+
type Addon_StorySortComparatorV7 = Addon_Comparator<IndexEntry>;
|
|
2378
|
+
type Addon_StorySortParameterV7 = Addon_StorySortComparatorV7 | Addon_StorySortObjectParameter;
|
|
2379
|
+
interface Addon_OptionsParameter extends Object {
|
|
2380
|
+
storySort?: Addon_StorySortParameter;
|
|
2381
|
+
theme?: {
|
|
2382
|
+
base: string;
|
|
2383
|
+
brandTitle?: string;
|
|
2384
|
+
};
|
|
2385
|
+
[key: string]: any;
|
|
2386
|
+
}
|
|
2387
|
+
interface Addon_OptionsParameterV7 extends Object {
|
|
2388
|
+
storySort?: Addon_StorySortParameterV7;
|
|
2389
|
+
theme?: {
|
|
2390
|
+
base: string;
|
|
2391
|
+
brandTitle?: string;
|
|
2392
|
+
};
|
|
2393
|
+
[key: string]: any;
|
|
2394
|
+
}
|
|
2395
|
+
type Addon_StoryContext<TRenderer extends Renderer = Renderer> = StoryContext<TRenderer>;
|
|
2396
|
+
type Addon_StoryContextUpdate = Partial<Addon_StoryContext>;
|
|
2397
|
+
type Addon_ReturnTypeFramework<ReturnType> = {
|
|
2398
|
+
component: any;
|
|
2399
|
+
storyResult: ReturnType;
|
|
2400
|
+
canvasElement: any;
|
|
2401
|
+
};
|
|
2402
|
+
type Addon_PartialStoryFn<ReturnType = unknown> = PartialStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
2403
|
+
type Addon_LegacyStoryFn<ReturnType = unknown> = LegacyStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
2404
|
+
type Addon_ArgsStoryFn<ReturnType = unknown> = ArgsStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
2405
|
+
type Addon_StoryFn<ReturnType = unknown> = StoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
2406
|
+
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
2407
|
+
type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
|
|
2408
|
+
interface Addon_WrapperSettings {
|
|
2409
|
+
options: object;
|
|
2410
|
+
parameters: {
|
|
2411
|
+
[key: string]: any;
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
type Addon_StoryWrapper = (storyFn: Addon_LegacyStoryFn, context: Addon_StoryContext, settings: Addon_WrapperSettings) => any;
|
|
2415
|
+
type Addon_MakeDecoratorResult = (...args: any) => any;
|
|
2416
|
+
interface Addon_AddStoryArgs<StoryFnReturnType = unknown> {
|
|
2417
|
+
id: StoryId;
|
|
2418
|
+
kind: StoryKind;
|
|
2419
|
+
name: StoryName;
|
|
2420
|
+
storyFn: Addon_StoryFn<StoryFnReturnType>;
|
|
2421
|
+
parameters: Parameters;
|
|
2422
|
+
}
|
|
2423
|
+
type Addon_ClientApiAddon<StoryFnReturnType = unknown> = Addon_Type & {
|
|
2424
|
+
apply: (a: Addon_StoryApi<StoryFnReturnType>, b: any[]) => any;
|
|
2425
|
+
};
|
|
2426
|
+
interface Addon_ClientApiAddons<StoryFnReturnType> {
|
|
2427
|
+
[key: string]: Addon_ClientApiAddon<StoryFnReturnType>;
|
|
2428
|
+
}
|
|
2429
|
+
type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
|
|
2430
|
+
interface Addon_StoryApi<StoryFnReturnType = unknown> {
|
|
2431
|
+
kind: StoryKind;
|
|
2432
|
+
add: (storyName: StoryName, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
2433
|
+
addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
|
|
2434
|
+
addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
|
|
2435
|
+
addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
2436
|
+
[k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
|
|
2437
|
+
}
|
|
2438
|
+
interface Addon_ClientStoryApi<StoryFnReturnType = unknown> {
|
|
2439
|
+
storiesOf(kind: StoryKind, module: any): Addon_StoryApi<StoryFnReturnType>;
|
|
2440
|
+
}
|
|
2441
|
+
type Addon_LoadFn = () => any;
|
|
2442
|
+
type Addon_RequireContext = any;
|
|
2443
|
+
type Addon_Loadable = Addon_RequireContext | [Addon_RequireContext] | Addon_LoadFn;
|
|
2444
|
+
type Addon_BaseDecorators<StoryFnReturnType> = Array<(story: () => StoryFnReturnType, context: Addon_StoryContext) => StoryFnReturnType>;
|
|
2445
|
+
interface Addon_BaseAnnotations<TArgs, StoryFnReturnType, TRenderer extends Renderer = Renderer> {
|
|
2351
2446
|
/**
|
|
2352
|
-
*
|
|
2447
|
+
* Dynamic data that are provided (and possibly updated by) Storybook and its addons.
|
|
2448
|
+
* @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
|
|
2353
2449
|
*/
|
|
2354
|
-
|
|
2450
|
+
args?: Partial<TArgs>;
|
|
2355
2451
|
/**
|
|
2356
|
-
*
|
|
2452
|
+
* ArgTypes encode basic metadata for args, such as `name`, `description`, `defaultValue` for an arg. These get automatically filled in by Storybook Docs.
|
|
2453
|
+
* @see [Arg types](https://storybook.js.org/docs/react/api/arg-types)
|
|
2357
2454
|
*/
|
|
2358
|
-
|
|
2455
|
+
argTypes?: Addons_ArgTypes<TArgs>;
|
|
2359
2456
|
/**
|
|
2360
|
-
*
|
|
2457
|
+
* Custom metadata for a story.
|
|
2458
|
+
* @see [Parameters](https://storybook.js.org/docs/basics/writing-stories/#parameters)
|
|
2361
2459
|
*/
|
|
2362
|
-
|
|
2460
|
+
parameters?: Parameters;
|
|
2363
2461
|
/**
|
|
2364
|
-
*
|
|
2462
|
+
* Wrapper components or Storybook decorators that wrap a story.
|
|
2365
2463
|
*
|
|
2366
|
-
*
|
|
2464
|
+
* Decorators defined in Meta will be applied to every story variation.
|
|
2465
|
+
* @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
|
|
2367
2466
|
*/
|
|
2368
|
-
|
|
2467
|
+
decorators?: Addon_BaseDecorators<StoryFnReturnType>;
|
|
2369
2468
|
/**
|
|
2370
|
-
*
|
|
2469
|
+
* Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
|
|
2371
2470
|
*/
|
|
2372
|
-
|
|
2471
|
+
render?: (args: TArgs, context: Addon_StoryContext<TRenderer>) => StoryFnReturnType;
|
|
2373
2472
|
/**
|
|
2374
|
-
*
|
|
2375
|
-
* @soonDeprecated use {@link experimental_indexers} instead
|
|
2473
|
+
* Function that is executed after the story is rendered.
|
|
2376
2474
|
*/
|
|
2377
|
-
|
|
2475
|
+
play?: (context: Addon_StoryContext<TRenderer>) => Promise<void> | void;
|
|
2476
|
+
}
|
|
2477
|
+
interface Addon_Annotations<TArgs, StoryFnReturnType> extends Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
|
|
2378
2478
|
/**
|
|
2379
|
-
*
|
|
2479
|
+
* Used to only include certain named exports as stories. Useful when you want to have non-story exports such as mock data or ignore a few stories.
|
|
2480
|
+
* @example
|
|
2481
|
+
* includeStories: ['SimpleStory', 'ComplexStory']
|
|
2482
|
+
* includeStories: /.*Story$/
|
|
2483
|
+
*
|
|
2484
|
+
* @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
|
|
2380
2485
|
*/
|
|
2381
|
-
|
|
2486
|
+
includeStories?: string[] | RegExp;
|
|
2382
2487
|
/**
|
|
2383
|
-
*
|
|
2488
|
+
* Used to exclude certain named exports. Useful when you want to have non-story exports such as mock data or ignore a few stories.
|
|
2489
|
+
* @example
|
|
2490
|
+
* excludeStories: ['simpleData', 'complexData']
|
|
2491
|
+
* excludeStories: /.*Data$/
|
|
2492
|
+
*
|
|
2493
|
+
* @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
|
|
2384
2494
|
*/
|
|
2385
|
-
|
|
2495
|
+
excludeStories?: string[] | RegExp;
|
|
2496
|
+
}
|
|
2497
|
+
interface Addon_BaseMeta<ComponentType> {
|
|
2386
2498
|
/**
|
|
2387
|
-
*
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2499
|
+
* Title of the story which will be presented in the navigation. **Should be unique.**
|
|
2500
|
+
*
|
|
2501
|
+
* Stories can be organized in a nested structure using "/" as a separator.
|
|
2502
|
+
*
|
|
2503
|
+
* Since CSF 3.0 this property is optional.
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* export default {
|
|
2507
|
+
* ...
|
|
2508
|
+
* title: 'Design System/Atoms/Button'
|
|
2509
|
+
* }
|
|
2510
|
+
*
|
|
2511
|
+
* @see [Story Hierarchy](https://storybook.js.org/docs/basics/writing-stories/#story-hierarchy)
|
|
2390
2512
|
*/
|
|
2391
|
-
|
|
2392
|
-
previewBody?: PresetValue<string>;
|
|
2513
|
+
title?: string;
|
|
2393
2514
|
/**
|
|
2394
|
-
*
|
|
2395
|
-
* This should return a reference to a file containing an `.ejs` template
|
|
2396
|
-
* that will be interpolated with environment variables.
|
|
2515
|
+
* Manually set the id of a story, which in particular is useful if you want to rename stories without breaking permalinks.
|
|
2397
2516
|
*
|
|
2398
|
-
*
|
|
2517
|
+
* Storybook will prioritize the id over the title for ID generation, if provided, and will prioritize the story.storyName over the export key for display.
|
|
2518
|
+
*
|
|
2519
|
+
* @see [Sidebar and URLs](https://storybook.js.org/docs/react/configure/sidebar-and-urls#permalinking-to-stories)
|
|
2399
2520
|
*/
|
|
2400
|
-
|
|
2521
|
+
id?: string;
|
|
2401
2522
|
/**
|
|
2402
|
-
*
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
2523
|
+
* The primary component for your story.
|
|
2524
|
+
*
|
|
2525
|
+
* Used by addons for automatic prop table generation and display of other component metadata.
|
|
2405
2526
|
*/
|
|
2406
|
-
|
|
2527
|
+
component?: ComponentType;
|
|
2528
|
+
/**
|
|
2529
|
+
* Auxiliary subcomponents that are part of the stories.
|
|
2530
|
+
*
|
|
2531
|
+
* Used by addons for automatic prop table generation and display of other component metadata.
|
|
2532
|
+
*
|
|
2533
|
+
* @example
|
|
2534
|
+
* import { Button, ButtonGroup } from './components';
|
|
2535
|
+
*
|
|
2536
|
+
* export default {
|
|
2537
|
+
* ...
|
|
2538
|
+
* subcomponents: { Button, ButtonGroup }
|
|
2539
|
+
* }
|
|
2540
|
+
*
|
|
2541
|
+
* By defining them each component will have its tab in the args table.
|
|
2542
|
+
*
|
|
2543
|
+
* @deprecated
|
|
2544
|
+
*/
|
|
2545
|
+
subcomponents?: Record<string, ComponentType>;
|
|
2407
2546
|
}
|
|
2408
|
-
type
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
name: string;
|
|
2414
|
-
}
|
|
2415
|
-
type PreviewAnnotation = string | {
|
|
2416
|
-
bare: string;
|
|
2417
|
-
absolute: string;
|
|
2418
|
-
};
|
|
2419
|
-
interface CoreCommon_ResolvedAddonVirtual {
|
|
2420
|
-
type: 'virtual';
|
|
2421
|
-
name: string;
|
|
2422
|
-
managerEntries?: string[];
|
|
2423
|
-
previewAnnotations?: PreviewAnnotation[];
|
|
2424
|
-
presets?: (string | {
|
|
2425
|
-
name: string;
|
|
2426
|
-
options?: any;
|
|
2427
|
-
})[];
|
|
2428
|
-
}
|
|
2429
|
-
type CoreCommon_OptionsEntry = {
|
|
2430
|
-
name: string;
|
|
2431
|
-
};
|
|
2432
|
-
type CoreCommon_AddonEntry = string | CoreCommon_OptionsEntry;
|
|
2433
|
-
type CoreCommon_AddonInfo = {
|
|
2434
|
-
name: string;
|
|
2435
|
-
inEssentials: boolean;
|
|
2436
|
-
};
|
|
2437
|
-
interface CoreCommon_StorybookInfo {
|
|
2438
|
-
version: string;
|
|
2439
|
-
framework: string;
|
|
2440
|
-
frameworkPackage: string;
|
|
2441
|
-
renderer: string;
|
|
2442
|
-
rendererPackage: string;
|
|
2443
|
-
configDir?: string;
|
|
2444
|
-
mainConfig?: string;
|
|
2445
|
-
previewConfig?: string;
|
|
2446
|
-
managerConfig?: string;
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
interface BuilderStats {
|
|
2450
|
-
toJson: () => any;
|
|
2451
|
-
}
|
|
2452
|
-
type Builder_WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
2453
|
-
[Property in Key]-?: Type[Property];
|
|
2547
|
+
type Addon_BaseStoryObject<TArgs, StoryFnReturnType> = {
|
|
2548
|
+
/**
|
|
2549
|
+
* Override the display name in the UI
|
|
2550
|
+
*/
|
|
2551
|
+
storyName?: string;
|
|
2454
2552
|
};
|
|
2455
|
-
type
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
type
|
|
2459
|
-
interface
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
args: any[];
|
|
2467
|
-
}
|
|
2468
|
-
interface Listener {
|
|
2469
|
-
(...args: any[]): void;
|
|
2470
|
-
}
|
|
2471
|
-
interface ChannelArgsSingle {
|
|
2472
|
-
transport?: ChannelTransport;
|
|
2473
|
-
async?: boolean;
|
|
2474
|
-
}
|
|
2475
|
-
interface ChannelArgsMulti {
|
|
2476
|
-
transports: ChannelTransport[];
|
|
2477
|
-
async?: boolean;
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
declare class Channel {
|
|
2481
|
-
readonly isAsync: boolean;
|
|
2482
|
-
private sender;
|
|
2483
|
-
private events;
|
|
2484
|
-
private data;
|
|
2485
|
-
private readonly transports;
|
|
2486
|
-
constructor(input: ChannelArgsMulti);
|
|
2487
|
-
constructor(input: ChannelArgsSingle);
|
|
2488
|
-
get hasTransport(): boolean;
|
|
2489
|
-
addListener(eventName: string, listener: Listener): void;
|
|
2490
|
-
emit(eventName: string, ...args: any): void;
|
|
2491
|
-
last(eventName: string): any;
|
|
2492
|
-
eventNames(): string[];
|
|
2493
|
-
listenerCount(eventName: string): number;
|
|
2494
|
-
listeners(eventName: string): Listener[] | undefined;
|
|
2495
|
-
once(eventName: string, listener: Listener): void;
|
|
2496
|
-
removeAllListeners(eventName?: string): void;
|
|
2497
|
-
removeListener(eventName: string, listener: Listener): void;
|
|
2498
|
-
on(eventName: string, listener: Listener): void;
|
|
2499
|
-
off(eventName: string, listener: Listener): void;
|
|
2500
|
-
private handleEvent;
|
|
2501
|
-
private onceListener;
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
interface API_BaseEntry {
|
|
2505
|
-
id: StoryId;
|
|
2506
|
-
depth: number;
|
|
2507
|
-
name: string;
|
|
2508
|
-
refId?: string;
|
|
2509
|
-
renderLabel?: (item: API_BaseEntry) => any;
|
|
2510
|
-
/** @deprecated */
|
|
2511
|
-
isRoot: boolean;
|
|
2512
|
-
/** @deprecated */
|
|
2513
|
-
isComponent: boolean;
|
|
2514
|
-
/** @deprecated */
|
|
2515
|
-
isLeaf: boolean;
|
|
2516
|
-
}
|
|
2517
|
-
interface API_RootEntry extends API_BaseEntry {
|
|
2518
|
-
type: 'root';
|
|
2519
|
-
startCollapsed?: boolean;
|
|
2520
|
-
children: StoryId[];
|
|
2521
|
-
/** @deprecated */
|
|
2522
|
-
isRoot: true;
|
|
2523
|
-
/** @deprecated */
|
|
2524
|
-
isComponent: false;
|
|
2525
|
-
/** @deprecated */
|
|
2526
|
-
isLeaf: false;
|
|
2527
|
-
}
|
|
2528
|
-
interface API_GroupEntry extends API_BaseEntry {
|
|
2529
|
-
type: 'group';
|
|
2530
|
-
parent?: StoryId;
|
|
2531
|
-
children: StoryId[];
|
|
2532
|
-
/** @deprecated */
|
|
2533
|
-
isRoot: false;
|
|
2534
|
-
/** @deprecated */
|
|
2535
|
-
isComponent: false;
|
|
2536
|
-
/** @deprecated */
|
|
2537
|
-
isLeaf: false;
|
|
2538
|
-
}
|
|
2539
|
-
interface API_ComponentEntry extends API_BaseEntry {
|
|
2540
|
-
type: 'component';
|
|
2541
|
-
parent?: StoryId;
|
|
2542
|
-
children: StoryId[];
|
|
2543
|
-
/** @deprecated */
|
|
2544
|
-
isRoot: false;
|
|
2545
|
-
/** @deprecated */
|
|
2546
|
-
isComponent: true;
|
|
2547
|
-
/** @deprecated */
|
|
2548
|
-
isLeaf: false;
|
|
2549
|
-
}
|
|
2550
|
-
interface API_DocsEntry extends API_BaseEntry {
|
|
2551
|
-
type: 'docs';
|
|
2552
|
-
parent: StoryId;
|
|
2553
|
-
title: ComponentTitle;
|
|
2554
|
-
/** @deprecated */
|
|
2555
|
-
kind: ComponentTitle;
|
|
2556
|
-
importPath: Path;
|
|
2557
|
-
tags: Tag[];
|
|
2558
|
-
prepared: boolean;
|
|
2559
|
-
parameters?: {
|
|
2560
|
-
[parameterName: string]: any;
|
|
2561
|
-
};
|
|
2562
|
-
/** @deprecated */
|
|
2563
|
-
isRoot: false;
|
|
2564
|
-
/** @deprecated */
|
|
2565
|
-
isComponent: false;
|
|
2566
|
-
/** @deprecated */
|
|
2567
|
-
isLeaf: true;
|
|
2568
|
-
}
|
|
2569
|
-
interface API_StoryEntry extends API_BaseEntry {
|
|
2570
|
-
type: 'story';
|
|
2571
|
-
parent: StoryId;
|
|
2572
|
-
title: ComponentTitle;
|
|
2573
|
-
/** @deprecated */
|
|
2574
|
-
kind: ComponentTitle;
|
|
2575
|
-
importPath: Path;
|
|
2576
|
-
tags: Tag[];
|
|
2577
|
-
prepared: boolean;
|
|
2578
|
-
parameters?: {
|
|
2579
|
-
[parameterName: string]: any;
|
|
2580
|
-
};
|
|
2581
|
-
args?: Args;
|
|
2582
|
-
argTypes?: ArgTypes;
|
|
2583
|
-
initialArgs?: Args;
|
|
2584
|
-
/** @deprecated */
|
|
2585
|
-
isRoot: false;
|
|
2586
|
-
/** @deprecated */
|
|
2587
|
-
isComponent: false;
|
|
2588
|
-
/** @deprecated */
|
|
2589
|
-
isLeaf: true;
|
|
2553
|
+
type Addon_BaseStoryFn<TArgs, StoryFnReturnType> = {
|
|
2554
|
+
(args: TArgs, context: Addon_StoryContext): StoryFnReturnType;
|
|
2555
|
+
} & Addon_BaseStoryObject<TArgs, StoryFnReturnType>;
|
|
2556
|
+
type BaseStory<TArgs, StoryFnReturnType> = Addon_BaseStoryFn<TArgs, StoryFnReturnType> | Addon_BaseStoryObject<TArgs, StoryFnReturnType>;
|
|
2557
|
+
interface Addon_RenderOptions {
|
|
2558
|
+
active: boolean;
|
|
2559
|
+
/**
|
|
2560
|
+
* @deprecated You should not use key anymore as of Storybook 7.2 this render method is invoked as a React component.
|
|
2561
|
+
* This property will be removed in 8.0.
|
|
2562
|
+
* */
|
|
2563
|
+
key?: unknown;
|
|
2590
2564
|
}
|
|
2591
|
-
type API_LeafEntry = API_DocsEntry | API_StoryEntry;
|
|
2592
|
-
type API_HashEntry = API_RootEntry | API_GroupEntry | API_ComponentEntry | API_DocsEntry | API_StoryEntry;
|
|
2593
|
-
/** @deprecated */
|
|
2594
|
-
type API_Root = API_RootEntry;
|
|
2595
|
-
/** @deprecated */
|
|
2596
|
-
type API_Group = API_GroupEntry | API_ComponentEntry;
|
|
2597
|
-
/** @deprecated */
|
|
2598
|
-
type API_Story = API_LeafEntry;
|
|
2599
2565
|
/**
|
|
2600
|
-
*
|
|
2601
|
-
* We create entries in the hash not only for each story or docs entry, but
|
|
2602
|
-
* also for each "group" of the component (split on '/'), as that's how things
|
|
2603
|
-
* are manipulated in the manager (i.e. in the sidebar)
|
|
2566
|
+
* @deprecated This type is deprecated and will be removed in 8.0.
|
|
2604
2567
|
*/
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
parameters?: Parameters;
|
|
2610
|
-
argTypes?: ArgTypes;
|
|
2611
|
-
args?: Args;
|
|
2612
|
-
initialArgs?: Args;
|
|
2613
|
-
};
|
|
2614
|
-
interface API_PreparedStoryIndex {
|
|
2615
|
-
v: number;
|
|
2616
|
-
entries: Record<StoryId, API_PreparedIndexEntry>;
|
|
2617
|
-
}
|
|
2618
|
-
type API_OptionsData = {
|
|
2619
|
-
docsOptions: DocsOptions;
|
|
2568
|
+
type ReactJSXElement = {
|
|
2569
|
+
type: any;
|
|
2570
|
+
props: any;
|
|
2571
|
+
key: any;
|
|
2620
2572
|
};
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2573
|
+
type Addon_Type = Addon_BaseType | Addon_PageType | Addon_WrapperType;
|
|
2574
|
+
interface Addon_BaseType {
|
|
2575
|
+
/**
|
|
2576
|
+
* The title of the addon.
|
|
2577
|
+
* This can be a simple string, but it can also be a React.FunctionComponent or a React.ReactElement.
|
|
2578
|
+
*/
|
|
2579
|
+
title: FCWithoutChildren | ReactNode;
|
|
2580
|
+
/**
|
|
2581
|
+
* The type of the addon.
|
|
2582
|
+
* @example Addon_TypesEnum.PANEL
|
|
2583
|
+
*/
|
|
2584
|
+
type: Exclude<Addon_Types, Addon_TypesEnum.PREVIEW>;
|
|
2585
|
+
/**
|
|
2586
|
+
* The unique id of the addon.
|
|
2587
|
+
* @warn This will become non-optional in 8.0
|
|
2588
|
+
*
|
|
2589
|
+
* This needs to be globally unique, so we recommend prefixing it with your org name or npm package name.
|
|
2590
|
+
*
|
|
2591
|
+
* Do not prefix with `storybook`, this is reserved for core storybook feature and core addons.
|
|
2592
|
+
*
|
|
2593
|
+
* @example 'my-org-name/my-addon-name'
|
|
2594
|
+
*/
|
|
2595
|
+
id?: string;
|
|
2596
|
+
/**
|
|
2597
|
+
* This component will wrap your `render` function.
|
|
2598
|
+
*
|
|
2599
|
+
* With it you can determine if you want your addon to be rendered or not.
|
|
2600
|
+
*
|
|
2601
|
+
* This is to facilitate addons keeping state, and keep listening for events even when they are not currently on screen/rendered.
|
|
2602
|
+
*/
|
|
2603
|
+
route?: (routeOptions: RenderData) => string;
|
|
2604
|
+
/**
|
|
2605
|
+
* This will determine the value of `active` prop of your render function.
|
|
2606
|
+
*/
|
|
2607
|
+
match?: (matchOptions: RenderData) => boolean;
|
|
2608
|
+
/**
|
|
2609
|
+
* The actual contents of your addon.
|
|
2610
|
+
*
|
|
2611
|
+
* This is called as a function, so if you want to use hooks,
|
|
2612
|
+
* your function needs to return a JSX.Element within which components are rendered
|
|
2613
|
+
*/
|
|
2614
|
+
render: (renderOptions: Partial<Addon_RenderOptions>) => ReactElement<any, any> | null;
|
|
2615
|
+
/**
|
|
2616
|
+
* @unstable
|
|
2617
|
+
*/
|
|
2618
|
+
paramKey?: string;
|
|
2619
|
+
/**
|
|
2620
|
+
* @unstable
|
|
2621
|
+
*/
|
|
2622
|
+
disabled?: boolean;
|
|
2623
|
+
/**
|
|
2624
|
+
* @unstable
|
|
2625
|
+
*/
|
|
2626
|
+
hidden?: boolean;
|
|
2674
2627
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2628
|
+
/**
|
|
2629
|
+
* This is a copy of FC from react/index.d.ts, but has the PropsWithChildren type removed
|
|
2630
|
+
* this is correct and more type strict, and future compatible with React.FC in React 18+
|
|
2631
|
+
*
|
|
2632
|
+
* @deprecated This type is deprecated and will be removed in 8.0. (assuming the manager uses React 18 is out by then)
|
|
2633
|
+
*/
|
|
2634
|
+
interface FCWithoutChildren<P = {}> {
|
|
2635
|
+
(props: P, context?: any): ReactElement<any, any> | null;
|
|
2636
|
+
propTypes?: WeakValidationMap<P> | undefined;
|
|
2637
|
+
contextTypes?: ValidationMap<any> | undefined;
|
|
2638
|
+
defaultProps?: Partial<P> | undefined;
|
|
2639
|
+
displayName?: string | undefined;
|
|
2677
2640
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2641
|
+
interface Addon_PageType {
|
|
2642
|
+
type: Addon_TypesEnum.experimental_PAGE;
|
|
2643
|
+
/**
|
|
2644
|
+
* The unique id of the page.
|
|
2645
|
+
*/
|
|
2646
|
+
id: string;
|
|
2647
|
+
/**
|
|
2648
|
+
* The URL to navigate to when Storybook needs to navigate to this page.
|
|
2649
|
+
*/
|
|
2650
|
+
url: string;
|
|
2651
|
+
/**
|
|
2652
|
+
* The title is used in mobile mode to represent the page in the navigation.
|
|
2653
|
+
*/
|
|
2654
|
+
title: FCWithoutChildren | string | ReactElement | ReactNode;
|
|
2655
|
+
/**
|
|
2656
|
+
* The main content of the addon, a function component without any props.
|
|
2657
|
+
* Storybook will render your component always.
|
|
2658
|
+
*
|
|
2659
|
+
* If you want to render your component only when the URL matches, use the `Route` component.
|
|
2660
|
+
* @example
|
|
2661
|
+
* import { Route } from '@storybook/router';
|
|
2662
|
+
*
|
|
2663
|
+
* render: () => {
|
|
2664
|
+
* return (
|
|
2665
|
+
* <Route path="/my-addon">
|
|
2666
|
+
* <MyAddonContent />
|
|
2667
|
+
* </Route>
|
|
2668
|
+
* );
|
|
2669
|
+
* };
|
|
2670
|
+
*/
|
|
2671
|
+
render: FCWithoutChildren;
|
|
2694
2672
|
}
|
|
2695
|
-
interface
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2673
|
+
interface Addon_WrapperType {
|
|
2674
|
+
type: Addon_TypesEnum.PREVIEW;
|
|
2675
|
+
/**
|
|
2676
|
+
* The unique id of the page.
|
|
2677
|
+
*/
|
|
2678
|
+
id: string;
|
|
2679
|
+
/**
|
|
2680
|
+
* A React.FunctionComponent that wraps the story.
|
|
2681
|
+
*
|
|
2682
|
+
* This component must accept a children prop, and render it.
|
|
2683
|
+
*/
|
|
2684
|
+
render: FC<PropsWithChildren<{
|
|
2685
|
+
index: number;
|
|
2686
|
+
children: ReactNode;
|
|
2687
|
+
id: string;
|
|
2688
|
+
storyId: StoryId;
|
|
2689
|
+
active: boolean;
|
|
2690
|
+
}>>;
|
|
2701
2691
|
}
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2692
|
+
type Addon_TypeBaseNames = Exclude<Addon_TypesEnum, Addon_TypesEnum.PREVIEW | Addon_TypesEnum.experimental_PAGE>;
|
|
2693
|
+
interface Addon_TypesMapping extends Record<Addon_TypeBaseNames, Addon_BaseType> {
|
|
2694
|
+
[Addon_TypesEnum.PREVIEW]: Addon_WrapperType;
|
|
2695
|
+
[Addon_TypesEnum.experimental_PAGE]: Addon_PageType;
|
|
2705
2696
|
}
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
type API_RenderOptions = Addon_RenderOptions;
|
|
2710
|
-
interface API_RouteOptions {
|
|
2711
|
-
storyId: string;
|
|
2712
|
-
viewMode: API_ViewMode;
|
|
2713
|
-
location: RenderData['location'];
|
|
2714
|
-
path: string;
|
|
2697
|
+
type Addon_Loader<API> = (api: API) => void;
|
|
2698
|
+
interface Addon_Loaders<API> {
|
|
2699
|
+
[key: string]: Addon_Loader<API>;
|
|
2715
2700
|
}
|
|
2716
|
-
interface
|
|
2717
|
-
|
|
2718
|
-
viewMode: API_ViewMode;
|
|
2719
|
-
location: RenderData['location'];
|
|
2720
|
-
path: string;
|
|
2701
|
+
interface Addon_Collection<T = Addon_Type> {
|
|
2702
|
+
[key: string]: T;
|
|
2721
2703
|
}
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
*/
|
|
2725
|
-
type API_Addon = Addon_Type;
|
|
2726
|
-
/**
|
|
2727
|
-
* @deprecated this is synonymous with `Addon_Collection`. This interface will be removed in 8.0
|
|
2728
|
-
*/
|
|
2729
|
-
type API_Collection<T = Addon_Type> = Addon_Collection<T>;
|
|
2730
|
-
/**
|
|
2731
|
-
* @deprecated This interface will be removed in 8.0
|
|
2732
|
-
*/
|
|
2733
|
-
type API_Panels = Addon_Collection<Addon_BaseType>;
|
|
2734
|
-
type API_StateMerger<S> = (input: S) => S;
|
|
2735
|
-
interface API_ProviderData<API> {
|
|
2736
|
-
provider: API_Provider<API>;
|
|
2737
|
-
docsOptions: DocsOptions;
|
|
2704
|
+
interface Addon_Elements {
|
|
2705
|
+
[key: string]: Addon_Collection;
|
|
2738
2706
|
}
|
|
2739
|
-
interface
|
|
2740
|
-
|
|
2741
|
-
/**
|
|
2742
|
-
* @deprecated will be removed in 8.0, please use channel instead
|
|
2743
|
-
*/
|
|
2744
|
-
serverChannel?: Channel;
|
|
2745
|
-
renderPreview?: API_IframeRenderer;
|
|
2746
|
-
handleAPI(api: API): void;
|
|
2747
|
-
getConfig(): {
|
|
2748
|
-
sidebar?: API_SidebarOptions;
|
|
2749
|
-
theme?: ThemeVars;
|
|
2750
|
-
StoryMapper?: API_StoryMapper;
|
|
2751
|
-
[k: string]: any;
|
|
2752
|
-
} & Partial<API_UIOptions>;
|
|
2753
|
-
[key: string]: any;
|
|
2707
|
+
interface Addon_ToolbarConfig {
|
|
2708
|
+
hidden?: boolean;
|
|
2754
2709
|
}
|
|
2755
|
-
|
|
2756
|
-
interface API_UIOptions {
|
|
2757
|
-
name?: string;
|
|
2758
|
-
url?: string;
|
|
2759
|
-
goFullScreen: boolean;
|
|
2760
|
-
showStoriesPanel: boolean;
|
|
2761
|
-
showAddonPanel: boolean;
|
|
2762
|
-
addonPanelInRight: boolean;
|
|
2710
|
+
interface Addon_Config {
|
|
2763
2711
|
theme?: ThemeVars;
|
|
2764
|
-
|
|
2712
|
+
toolbar?: {
|
|
2713
|
+
[id: string]: Addon_ToolbarConfig;
|
|
2714
|
+
};
|
|
2715
|
+
sidebar?: API_SidebarOptions;
|
|
2716
|
+
[key: string]: any;
|
|
2765
2717
|
}
|
|
2766
|
-
|
|
2767
|
-
initialActive: API_ActiveTabsType;
|
|
2768
|
-
isFullscreen: boolean;
|
|
2769
|
-
showPanel: boolean;
|
|
2770
|
-
panelPosition: API_PanelPositions;
|
|
2771
|
-
showNav: boolean;
|
|
2772
|
-
showTabs: boolean;
|
|
2773
|
-
showToolbar: boolean;
|
|
2718
|
+
declare enum Addon_TypesEnum {
|
|
2774
2719
|
/**
|
|
2775
|
-
*
|
|
2720
|
+
* This API is used to create a tab the toolbar above the canvas, This API might be removed in the future.
|
|
2721
|
+
* @unstable
|
|
2776
2722
|
*/
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2723
|
+
TAB = "tab",
|
|
2724
|
+
/**
|
|
2725
|
+
* This adds panels to the addons side panel.
|
|
2726
|
+
*/
|
|
2727
|
+
PANEL = "panel",
|
|
2728
|
+
/**
|
|
2729
|
+
* This adds items in the toolbar above the canvas - on the left side.
|
|
2730
|
+
*/
|
|
2731
|
+
TOOL = "tool",
|
|
2732
|
+
/**
|
|
2733
|
+
* This adds items in the toolbar above the canvas - on the right side.
|
|
2734
|
+
*/
|
|
2735
|
+
TOOLEXTRA = "toolextra",
|
|
2736
|
+
/**
|
|
2737
|
+
* This adds wrapper components around the canvas/iframe component storybook renders.
|
|
2738
|
+
* @unstable this API is not stable yet, and is likely to change in 8.0.
|
|
2739
|
+
*/
|
|
2740
|
+
PREVIEW = "preview",
|
|
2741
|
+
/**
|
|
2742
|
+
* This adds pages that render instead of the canvas.
|
|
2743
|
+
* @unstable
|
|
2744
|
+
*/
|
|
2745
|
+
experimental_PAGE = "page",
|
|
2746
|
+
/**
|
|
2747
|
+
* @deprecated This property does nothing, and will be removed in Storybook 8.0.
|
|
2748
|
+
*/
|
|
2749
|
+
NOTES_ELEMENT = "notes-element"
|
|
2790
2750
|
}
|
|
2791
|
-
|
|
2751
|
+
|
|
2752
|
+
type OrString<T extends string> = T | (string & {});
|
|
2753
|
+
type ViewMode = OrString<ViewMode$1 | 'settings'> | undefined;
|
|
2754
|
+
type Layout = 'centered' | 'fullscreen' | 'padded' | 'none';
|
|
2755
|
+
interface StorybookParameters {
|
|
2756
|
+
options?: Addon_OptionsParameter;
|
|
2792
2757
|
/**
|
|
2793
|
-
*
|
|
2758
|
+
* The layout property defines basic styles added to the preview body where the story is rendered.
|
|
2759
|
+
*
|
|
2760
|
+
* If you pass `none`, no styles are applied.
|
|
2794
2761
|
*/
|
|
2795
|
-
|
|
2762
|
+
layout?: Layout;
|
|
2796
2763
|
}
|
|
2797
|
-
interface
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
content: {
|
|
2801
|
-
headline: string;
|
|
2802
|
-
subHeadline?: string | any;
|
|
2803
|
-
};
|
|
2804
|
-
icon?: {
|
|
2805
|
-
name: string;
|
|
2806
|
-
color?: string;
|
|
2807
|
-
};
|
|
2808
|
-
onClear?: (options: OnClearOptions) => void;
|
|
2764
|
+
interface StorybookInternalParameters extends StorybookParameters {
|
|
2765
|
+
fileName?: string;
|
|
2766
|
+
docsOnly?: true;
|
|
2809
2767
|
}
|
|
2810
|
-
type
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
}>;
|
|
2815
|
-
type API_StoryMapper = (ref: API_ComposedRef, story: SetStoriesStory) => SetStoriesStory;
|
|
2816
|
-
interface API_LoadedRefData {
|
|
2817
|
-
index?: API_IndexHash;
|
|
2818
|
-
indexError?: Error;
|
|
2819
|
-
previewInitialized: boolean;
|
|
2768
|
+
type Path = string;
|
|
2769
|
+
|
|
2770
|
+
interface WebRenderer extends Renderer {
|
|
2771
|
+
canvasElement: HTMLElement;
|
|
2820
2772
|
}
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2773
|
+
type ModuleExport = any;
|
|
2774
|
+
type ModuleExports = Record<string, ModuleExport>;
|
|
2775
|
+
type ModuleImportFn = (path: Path) => Promise<ModuleExports>;
|
|
2776
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
2777
|
+
type TeardownRenderToCanvas = () => MaybePromise<void>;
|
|
2778
|
+
type RenderToCanvas<TRenderer extends Renderer> = (context: RenderContext<TRenderer>, element: TRenderer['canvasElement']) => MaybePromise<void | TeardownRenderToCanvas>;
|
|
2779
|
+
type ProjectAnnotations<TRenderer extends Renderer> = ProjectAnnotations$1<TRenderer> & {
|
|
2780
|
+
renderToCanvas?: RenderToCanvas<TRenderer>;
|
|
2781
|
+
renderToDOM?: RenderToCanvas<TRenderer>;
|
|
2782
|
+
};
|
|
2783
|
+
type NormalizedProjectAnnotations<TRenderer extends Renderer = Renderer> = ProjectAnnotations<TRenderer> & {
|
|
2784
|
+
argTypes?: StrictArgTypes;
|
|
2785
|
+
globalTypes?: StrictGlobalTypes;
|
|
2786
|
+
};
|
|
2787
|
+
type NormalizedComponentAnnotations<TRenderer extends Renderer = Renderer> = ComponentAnnotations<TRenderer> & {
|
|
2788
|
+
id: ComponentId;
|
|
2789
|
+
title: ComponentTitle;
|
|
2790
|
+
argTypes?: StrictArgTypes;
|
|
2791
|
+
};
|
|
2792
|
+
type NormalizedStoryAnnotations<TRenderer extends Renderer = Renderer> = Omit<StoryAnnotations<TRenderer>, 'storyName' | 'story'> & {
|
|
2793
|
+
moduleExport: ModuleExport;
|
|
2794
|
+
id: StoryId;
|
|
2795
|
+
argTypes?: StrictArgTypes;
|
|
2796
|
+
name: StoryName;
|
|
2797
|
+
userStoryFn?: StoryFn<TRenderer>;
|
|
2798
|
+
};
|
|
2799
|
+
type CSFFile<TRenderer extends Renderer = Renderer> = {
|
|
2800
|
+
meta: NormalizedComponentAnnotations<TRenderer>;
|
|
2801
|
+
stories: Record<StoryId, NormalizedStoryAnnotations<TRenderer>>;
|
|
2802
|
+
moduleExports: ModuleExports;
|
|
2803
|
+
};
|
|
2804
|
+
type PreparedStory<TRenderer extends Renderer = Renderer> = StoryContextForEnhancers<TRenderer> & {
|
|
2805
|
+
moduleExport: ModuleExport;
|
|
2806
|
+
originalStoryFn: StoryFn<TRenderer>;
|
|
2807
|
+
undecoratedStoryFn: LegacyStoryFn<TRenderer>;
|
|
2808
|
+
unboundStoryFn: LegacyStoryFn<TRenderer>;
|
|
2809
|
+
applyLoaders: (context: StoryContextForLoaders<TRenderer>) => Promise<StoryContextForLoaders<TRenderer> & {
|
|
2810
|
+
loaded: StoryContext<TRenderer>['loaded'];
|
|
2811
|
+
}>;
|
|
2812
|
+
playFunction?: (context: StoryContext<TRenderer>) => Promise<void> | void;
|
|
2813
|
+
};
|
|
2814
|
+
type PreparedMeta<TRenderer extends Renderer = Renderer> = Omit<StoryContextForEnhancers<TRenderer>, 'name' | 'story'> & {
|
|
2815
|
+
moduleExport: ModuleExport;
|
|
2816
|
+
};
|
|
2817
|
+
type BoundStory<TRenderer extends Renderer = Renderer> = PreparedStory<TRenderer> & {
|
|
2818
|
+
storyFn: PartialStoryFn<TRenderer>;
|
|
2819
|
+
};
|
|
2820
|
+
declare type RenderContext<TRenderer extends Renderer = Renderer> = StoryIdentifier & {
|
|
2821
|
+
showMain: () => void;
|
|
2822
|
+
showError: (error: {
|
|
2823
|
+
title: string;
|
|
2824
|
+
description: string;
|
|
2825
|
+
}) => void;
|
|
2826
|
+
showException: (err: Error) => void;
|
|
2827
|
+
forceRemount: boolean;
|
|
2828
|
+
storyContext: StoryContext<TRenderer>;
|
|
2829
|
+
storyFn: PartialStoryFn<TRenderer>;
|
|
2830
|
+
unboundStoryFn: LegacyStoryFn<TRenderer>;
|
|
2831
|
+
};
|
|
2832
|
+
|
|
2833
|
+
interface BuilderStats {
|
|
2834
|
+
toJson: () => any;
|
|
2830
2835
|
}
|
|
2831
|
-
type
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
type
|
|
2836
|
+
type Builder_WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
2837
|
+
[Property in Key]-?: Type[Property];
|
|
2838
|
+
};
|
|
2839
|
+
type Builder_Unpromise<T extends Promise<any>> = T extends Promise<infer U> ? U : never;
|
|
2840
|
+
type Builder_EnvsRaw = Record<string, string>;
|
|
2835
2841
|
|
|
2836
2842
|
type RenderContextCallbacks<TRenderer extends Renderer> = Pick<RenderContext<TRenderer>, 'showMain' | 'showError' | 'showException'>;
|
|
2837
2843
|
type StoryRenderOptions = {
|
|
@@ -2957,4 +2963,4 @@ interface ComposeStoryFn<TRenderer extends Renderer = Renderer, TArgs extends Ar
|
|
|
2957
2963
|
(storyAnnotations: AnnotatedStoryFn<TRenderer, TArgs> | StoryAnnotations<TRenderer, TArgs>, componentAnnotations: ComponentAnnotations<TRenderer, TArgs>, projectAnnotations: ProjectAnnotations<TRenderer>, exportsName?: string): ComposedStoryFn;
|
|
2958
2964
|
}
|
|
2959
2965
|
|
|
2960
|
-
export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_StatusObject, API_StatusState, API_StatusUpdate, API_StatusValue, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_BaseType, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PageType, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_TypesMapping, Addon_WrapperSettings, Addon_WrapperType, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseIndexInput, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStoryFn, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DeprecatedIndexer, DocsContextProps, DocsIndexEntry, DocsIndexInput, DocsOptions, DocsPreparedPayload, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexInput, IndexedCSFFile, IndexedStory, Indexer, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialArgsStoryFn, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, ReactJSXElement, Ref, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexInput, StoryIndexV2, StoryIndexV3, StoryIndexer, StoryKind, StoryName, StoryPreparedPayload, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };
|
|
2966
|
+
export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_FilterFunction, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedIndexEntry, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_StatusObject, API_StatusState, API_StatusUpdate, API_StatusValue, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_BaseType, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PageType, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_TypesMapping, Addon_WrapperSettings, Addon_WrapperType, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseIndexInput, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStoryFn, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DeprecatedIndexer, DocsContextProps, DocsIndexEntry, DocsIndexInput, DocsOptions, DocsPreparedPayload, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexInput, IndexedCSFFile, IndexedStory, Indexer, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialArgsStoryFn, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, ReactJSXElement, Ref, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexInput, StoryIndexV2, StoryIndexV3, StoryIndexer, StoryKind, StoryName, StoryPreparedPayload, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };
|