@storybook/addon-docs 9.1.0-alpha.5 → 9.1.0-alpha.6
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/DocsContainer-fccc2203.d.ts +51 -0
- package/dist/blocks.d.ts +40 -84
- package/dist/index.d.ts +30 -2
- package/package.json +4 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React__default, { ReactElement, FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { Channel } from 'storybook/internal/channels';
|
|
3
|
+
import { Renderer, DocsContextProps } from 'storybook/internal/types';
|
|
4
|
+
import { ThemeVars } from 'storybook/theming';
|
|
5
|
+
|
|
6
|
+
interface TocbotOptions {
|
|
7
|
+
tocSelector: string;
|
|
8
|
+
contentSelector: string;
|
|
9
|
+
headingSelector: string;
|
|
10
|
+
ignoreSelector?: string;
|
|
11
|
+
headingsOffset?: number;
|
|
12
|
+
scrollSmoothOffset?: number;
|
|
13
|
+
orderedList?: boolean;
|
|
14
|
+
onClick?: (e: MouseEvent) => void;
|
|
15
|
+
scrollEndCallback?: () => void;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
interface TocParameters {
|
|
19
|
+
/** CSS selector for the container to search for headings. */
|
|
20
|
+
contentsSelector?: string;
|
|
21
|
+
/**
|
|
22
|
+
* When true, hide the TOC. We still show the empty container (as opposed to showing nothing at
|
|
23
|
+
* all) because it affects the page layout and we want to preserve the layout across pages.
|
|
24
|
+
*/
|
|
25
|
+
disable?: boolean;
|
|
26
|
+
/** CSS selector to match headings to list in the TOC. */
|
|
27
|
+
headingSelector?: string;
|
|
28
|
+
/** Headings that match the ignoreSelector will be skipped. */
|
|
29
|
+
ignoreSelector?: string;
|
|
30
|
+
/** Custom title ReactElement or string to display above the TOC. */
|
|
31
|
+
title?: ReactElement | string | null;
|
|
32
|
+
/**
|
|
33
|
+
* TocBot options, not guaranteed to be available in future versions.
|
|
34
|
+
*
|
|
35
|
+
* @see tocbot docs {@link https://tscanlin.github.io/tocbot/#usage}
|
|
36
|
+
*/
|
|
37
|
+
unsafeTocbotOptions?: Omit<TocbotOptions, 'onClick' | 'scrollEndCallback'>;
|
|
38
|
+
}
|
|
39
|
+
type TableOfContentsProps = React__default.PropsWithChildren<TocParameters & {
|
|
40
|
+
className?: string;
|
|
41
|
+
channel: Channel;
|
|
42
|
+
}>;
|
|
43
|
+
declare const TableOfContents: ({ title, disable, headingSelector, contentsSelector, ignoreSelector, unsafeTocbotOptions, channel, className, }: TableOfContentsProps) => React__default.JSX.Element;
|
|
44
|
+
|
|
45
|
+
interface DocsContainerProps<TFramework extends Renderer = Renderer> {
|
|
46
|
+
context: DocsContextProps<TFramework>;
|
|
47
|
+
theme?: ThemeVars;
|
|
48
|
+
}
|
|
49
|
+
declare const DocsContainer: FC<PropsWithChildren<DocsContainerProps>>;
|
|
50
|
+
|
|
51
|
+
export { DocsContainerProps as D, TocParameters as T, TableOfContents as a, DocsContainer as b };
|
package/dist/blocks.d.ts
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, {
|
|
2
|
+
import React__default, { ComponentProps, FunctionComponent, PropsWithChildren, FC, Context, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import { Conditional, DocsContextProps, PreparedStory, ModuleExports, Renderer as Renderer$1, Args as Args$1, StoryId, ModuleExport, ResolvedModuleExportType, ResolvedModuleExportFromType, Parameters as Parameters$1, ProjectAnnotations, BaseAnnotations, ComponentTitle } from 'storybook/internal/types';
|
|
4
4
|
export { DocsContextProps } from 'storybook/internal/types';
|
|
5
|
-
|
|
5
|
+
export { b as DocsContainer, D as DocsContainerProps, a as TableOfContents } from './DocsContainer-fccc2203.js';
|
|
6
6
|
import { Renderer } from 'storybook/internal/csf';
|
|
7
7
|
import { PropDescriptor } from 'storybook/preview-api';
|
|
8
8
|
import { SupportedLanguage, SyntaxHighlighter, ActionItem, SyntaxHighlighterFormatTypes } from 'storybook/internal/components';
|
|
9
9
|
import { SourceType } from 'storybook/internal/docs-tools';
|
|
10
|
-
import
|
|
10
|
+
import 'storybook/internal/channels';
|
|
11
|
+
import 'storybook/theming';
|
|
12
|
+
|
|
13
|
+
declare enum SourceError {
|
|
14
|
+
NO_STORY = "There\u2019s no story here.",
|
|
15
|
+
SOURCE_UNAVAILABLE = "Oh no! The source is not available."
|
|
16
|
+
}
|
|
17
|
+
interface SourceCodeProps {
|
|
18
|
+
/** The language the syntax highlighter uses for your story’s code */
|
|
19
|
+
language?: SupportedLanguage;
|
|
20
|
+
/** Use this to override the content of the source block. */
|
|
21
|
+
code?: string;
|
|
22
|
+
/** The formatter the syntax highlighter uses for your story’s code. */
|
|
23
|
+
format?: ComponentProps<typeof SyntaxHighlighter>['format'];
|
|
24
|
+
/** Display the source snippet in a dark mode. */
|
|
25
|
+
dark?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface SourceProps$1 extends SourceCodeProps {
|
|
28
|
+
isLoading?: boolean;
|
|
29
|
+
error?: SourceError;
|
|
30
|
+
}
|
|
31
|
+
/** Syntax-highlighted source code for a component (or anything!) */
|
|
32
|
+
declare const Source$1: FunctionComponent<SourceProps$1>;
|
|
33
|
+
|
|
34
|
+
type PreviewProps = PropsWithChildren<{
|
|
35
|
+
isLoading?: true;
|
|
36
|
+
layout?: Layout;
|
|
37
|
+
inline?: boolean;
|
|
38
|
+
isColumn?: boolean;
|
|
39
|
+
columns?: number;
|
|
40
|
+
withSource?: SourceProps$1;
|
|
41
|
+
isExpanded?: boolean;
|
|
42
|
+
withToolbar?: boolean;
|
|
43
|
+
className?: string;
|
|
44
|
+
additionalActions?: ActionItem[];
|
|
45
|
+
}>;
|
|
46
|
+
type Layout = 'padded' | 'fullscreen' | 'centered';
|
|
11
47
|
|
|
12
48
|
interface ArgType {
|
|
13
49
|
name?: string;
|
|
@@ -74,41 +110,6 @@ type ArgsTableProps = ArgsTableOptionProps & (ArgsTableDataProps | ArgsTableErro
|
|
|
74
110
|
*/
|
|
75
111
|
declare const ArgsTable: FC<ArgsTableProps>;
|
|
76
112
|
|
|
77
|
-
declare enum SourceError {
|
|
78
|
-
NO_STORY = "There\u2019s no story here.",
|
|
79
|
-
SOURCE_UNAVAILABLE = "Oh no! The source is not available."
|
|
80
|
-
}
|
|
81
|
-
interface SourceCodeProps {
|
|
82
|
-
/** The language the syntax highlighter uses for your story’s code */
|
|
83
|
-
language?: SupportedLanguage;
|
|
84
|
-
/** Use this to override the content of the source block. */
|
|
85
|
-
code?: string;
|
|
86
|
-
/** The formatter the syntax highlighter uses for your story’s code. */
|
|
87
|
-
format?: ComponentProps<typeof SyntaxHighlighter>['format'];
|
|
88
|
-
/** Display the source snippet in a dark mode. */
|
|
89
|
-
dark?: boolean;
|
|
90
|
-
}
|
|
91
|
-
interface SourceProps$1 extends SourceCodeProps {
|
|
92
|
-
isLoading?: boolean;
|
|
93
|
-
error?: SourceError;
|
|
94
|
-
}
|
|
95
|
-
/** Syntax-highlighted source code for a component (or anything!) */
|
|
96
|
-
declare const Source$1: FunctionComponent<SourceProps$1>;
|
|
97
|
-
|
|
98
|
-
type PreviewProps = PropsWithChildren<{
|
|
99
|
-
isLoading?: true;
|
|
100
|
-
layout?: Layout;
|
|
101
|
-
inline?: boolean;
|
|
102
|
-
isColumn?: boolean;
|
|
103
|
-
columns?: number;
|
|
104
|
-
withSource?: SourceProps$1;
|
|
105
|
-
isExpanded?: boolean;
|
|
106
|
-
withToolbar?: boolean;
|
|
107
|
-
className?: string;
|
|
108
|
-
additionalActions?: ActionItem[];
|
|
109
|
-
}>;
|
|
110
|
-
type Layout = 'padded' | 'fullscreen' | 'centered';
|
|
111
|
-
|
|
112
113
|
interface CommonProps {
|
|
113
114
|
story: PreparedStory;
|
|
114
115
|
inline: boolean;
|
|
@@ -174,45 +175,6 @@ interface IconGalleryProps {
|
|
|
174
175
|
/** Show a grid of icons, as specified by `IconItem`. */
|
|
175
176
|
declare const IconGallery: FunctionComponent<IconGalleryProps>;
|
|
176
177
|
|
|
177
|
-
interface TocbotOptions {
|
|
178
|
-
tocSelector: string;
|
|
179
|
-
contentSelector: string;
|
|
180
|
-
headingSelector: string;
|
|
181
|
-
ignoreSelector?: string;
|
|
182
|
-
headingsOffset?: number;
|
|
183
|
-
scrollSmoothOffset?: number;
|
|
184
|
-
orderedList?: boolean;
|
|
185
|
-
onClick?: (e: MouseEvent) => void;
|
|
186
|
-
scrollEndCallback?: () => void;
|
|
187
|
-
[key: string]: unknown;
|
|
188
|
-
}
|
|
189
|
-
interface TocParameters {
|
|
190
|
-
/** CSS selector for the container to search for headings. */
|
|
191
|
-
contentsSelector?: string;
|
|
192
|
-
/**
|
|
193
|
-
* When true, hide the TOC. We still show the empty container (as opposed to showing nothing at
|
|
194
|
-
* all) because it affects the page layout and we want to preserve the layout across pages.
|
|
195
|
-
*/
|
|
196
|
-
disable?: boolean;
|
|
197
|
-
/** CSS selector to match headings to list in the TOC. */
|
|
198
|
-
headingSelector?: string;
|
|
199
|
-
/** Headings that match the ignoreSelector will be skipped. */
|
|
200
|
-
ignoreSelector?: string;
|
|
201
|
-
/** Custom title ReactElement or string to display above the TOC. */
|
|
202
|
-
title?: ReactElement | string | null;
|
|
203
|
-
/**
|
|
204
|
-
* TocBot options, not guaranteed to be available in future versions.
|
|
205
|
-
*
|
|
206
|
-
* @see tocbot docs {@link https://tscanlin.github.io/tocbot/#usage}
|
|
207
|
-
*/
|
|
208
|
-
unsafeTocbotOptions?: Omit<TocbotOptions, 'onClick' | 'scrollEndCallback'>;
|
|
209
|
-
}
|
|
210
|
-
type TableOfContentsProps = React__default.PropsWithChildren<TocParameters & {
|
|
211
|
-
className?: string;
|
|
212
|
-
channel: Channel;
|
|
213
|
-
}>;
|
|
214
|
-
declare const TableOfContents: ({ title, disable, headingSelector, contentsSelector, ignoreSelector, unsafeTocbotOptions, channel, className, }: TableOfContentsProps) => React__default.JSX.Element;
|
|
215
|
-
|
|
216
178
|
declare const anchorBlockIdFromId: (storyId: string) => string;
|
|
217
179
|
interface AnchorProps {
|
|
218
180
|
storyId: string;
|
|
@@ -411,12 +373,6 @@ declare function Docs<TRenderer extends Renderer$1 = Renderer$1>({ context, docs
|
|
|
411
373
|
|
|
412
374
|
declare const DocsPage: FC;
|
|
413
375
|
|
|
414
|
-
interface DocsContainerProps<TFramework extends Renderer$1 = Renderer$1> {
|
|
415
|
-
context: DocsContextProps<TFramework>;
|
|
416
|
-
theme?: ThemeVars;
|
|
417
|
-
}
|
|
418
|
-
declare const DocsContainer: FC<PropsWithChildren<DocsContainerProps>>;
|
|
419
|
-
|
|
420
376
|
declare const PRIMARY_STORY = "^";
|
|
421
377
|
type Component = any;
|
|
422
378
|
type DocsStoryProps = {
|
|
@@ -1069,4 +1025,4 @@ type ColorProps = ColorControlProps;
|
|
|
1069
1025
|
declare const LazyColorControl: React__default.LazyExoticComponent<React__default.FC<ColorControlProps>>;
|
|
1070
1026
|
declare const ColorControl: (props: ComponentProps<typeof LazyColorControl>) => React__default.JSX.Element;
|
|
1071
1027
|
|
|
1072
|
-
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, Control, ControlProps, ControlType, Controls, DateConfig, DateControl, DateProps, DateValue, DescriptionContainer as Description, DescriptionType, Docs,
|
|
1028
|
+
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, Control, ControlProps, ControlType, Controls, DateConfig, DateControl, DateProps, DateValue, DescriptionContainer as Description, DescriptionType, Docs, DocsContext, DocsPage, DocsProps, DocsStory, DocsStoryProps, ExternalDocs, ExternalDocsContainer, ExternalDocsProps, FilesControl, FilesControlProps, HeaderMdx, HeadersMdx, Heading, HeadingProps, IconGallery, IconItem, Markdown, Meta, NormalizedOptionsConfig, NumberConfig, NumberControl, NumberValue, ObjectConfig, ObjectControl, ObjectProps, ObjectValue, Of, Options, OptionsArray, OptionsConfig, OptionsControl, OptionsControlType, OptionsMultiSelection, OptionsObject, OptionsProps, OptionsSelection, OptionsSingleSelection, PRIMARY_STORY, PresetColor, Primary, ArgsTable as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceParameters, SourceProps, Stories, Story, StoryProps, StorySources, Subheading, Subtitle, TextConfig, TextControl, TextProps, TextValue, Title, Typeset, UNKNOWN_ARGS_HASH, Unstyled, Wrapper, anchorBlockIdFromId, argsHash, assertIsFn, extractTitle, format, formatDate, formatTime, getStoryId, getStoryProps, parse, parseDate, parseTime, slugs, useOf, useSourceProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as storybook_internal_csf from 'storybook/internal/csf';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
import { ModuleExports, ModuleExport, Renderer, DocsRenderFunction } from 'storybook/internal/types';
|
|
4
|
+
import { ThemeVars } from 'storybook/theming';
|
|
5
|
+
import { D as DocsContainerProps, T as TocParameters } from './DocsContainer-fccc2203.js';
|
|
6
|
+
import 'storybook/internal/channels';
|
|
3
7
|
|
|
4
8
|
type StoryBlockParameters = {
|
|
5
9
|
/** Whether a story's play function runs when shown in docs page */
|
|
@@ -111,7 +115,7 @@ type SourceBlockParameters = {
|
|
|
111
115
|
*/
|
|
112
116
|
of: ModuleExport;
|
|
113
117
|
/** Source code transformations */
|
|
114
|
-
transform?: (code: string, storyContext: any) => string
|
|
118
|
+
transform?: (code: string, storyContext: any) => string | Promise<string>;
|
|
115
119
|
/**
|
|
116
120
|
* Specifies how the source code is rendered.
|
|
117
121
|
*
|
|
@@ -139,12 +143,24 @@ interface DocsParameters {
|
|
|
139
143
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-canvas
|
|
140
144
|
*/
|
|
141
145
|
canvas?: Partial<CanvasBlockParameters>;
|
|
146
|
+
/**
|
|
147
|
+
* Enable the Code panel.
|
|
148
|
+
*
|
|
149
|
+
* @see https://storybook.js.org/docs/writing-docs/code-panel
|
|
150
|
+
*/
|
|
151
|
+
codePanel?: boolean;
|
|
142
152
|
/**
|
|
143
153
|
* Controls block configuration
|
|
144
154
|
*
|
|
145
155
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-controls
|
|
146
156
|
*/
|
|
147
157
|
controls?: ControlsBlockParameters;
|
|
158
|
+
/**
|
|
159
|
+
* Customize the Docs Container
|
|
160
|
+
*
|
|
161
|
+
* @see https://storybook.js.org/docs/writing-docs/autodocs#customize-the-docs-container
|
|
162
|
+
*/
|
|
163
|
+
container?: ComponentType<DocsContainerProps>;
|
|
148
164
|
/**
|
|
149
165
|
* Component/story description when shown in docs page
|
|
150
166
|
*
|
|
@@ -158,7 +174,7 @@ interface DocsParameters {
|
|
|
158
174
|
*
|
|
159
175
|
* @see https://storybook.js.org/docs/writing-docs/autodocs#write-a-custom-template
|
|
160
176
|
*/
|
|
161
|
-
page?:
|
|
177
|
+
page?: ComponentType;
|
|
162
178
|
/**
|
|
163
179
|
* Source code configuration when shown in docs page
|
|
164
180
|
*
|
|
@@ -177,12 +193,24 @@ interface DocsParameters {
|
|
|
177
193
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-subtitle
|
|
178
194
|
*/
|
|
179
195
|
subtitle?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Override the default theme
|
|
198
|
+
*
|
|
199
|
+
* @see https://storybook.js.org/docs/writing-docs/autodocs#override-the-default-theme
|
|
200
|
+
*/
|
|
201
|
+
theme?: ThemeVars;
|
|
180
202
|
/**
|
|
181
203
|
* The title displayed when shown in docs page
|
|
182
204
|
*
|
|
183
205
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-title
|
|
184
206
|
*/
|
|
185
207
|
title?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Configure the table of contents
|
|
210
|
+
*
|
|
211
|
+
* @see https://storybook.js.org/docs/writing-docs/autodocs#configure-the-table-of-contents
|
|
212
|
+
*/
|
|
213
|
+
toc?: true | TocParameters;
|
|
186
214
|
};
|
|
187
215
|
}
|
|
188
216
|
interface DocsTypes {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-docs",
|
|
3
|
-
"version": "9.1.0-alpha.
|
|
3
|
+
"version": "9.1.0-alpha.6",
|
|
4
4
|
"description": "Document component usage and properties in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -111,9 +111,9 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@mdx-js/react": "^3.0.0",
|
|
114
|
-
"@storybook/csf-plugin": "9.1.0-alpha.
|
|
114
|
+
"@storybook/csf-plugin": "9.1.0-alpha.6",
|
|
115
115
|
"@storybook/icons": "^1.2.12",
|
|
116
|
-
"@storybook/react-dom-shim": "9.1.0-alpha.
|
|
116
|
+
"@storybook/react-dom-shim": "9.1.0-alpha.6",
|
|
117
117
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
118
118
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
119
119
|
"ts-dedent": "^2.0.0"
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"vite": "^6.2.5"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
|
-
"storybook": "^9.1.0-alpha.
|
|
143
|
+
"storybook": "^9.1.0-alpha.6"
|
|
144
144
|
},
|
|
145
145
|
"publishConfig": {
|
|
146
146
|
"access": "public"
|