@storybook/addon-docs 9.0.0-beta.8 → 9.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/blocks.d.ts CHANGED
@@ -1,47 +1,14 @@
1
+ import * as React from 'react';
2
+ import React__default, { FC, ComponentProps, FunctionComponent, PropsWithChildren, ReactElement, Context, ReactNode } from 'react';
1
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';
2
4
  export { DocsContextProps } from 'storybook/internal/types';
3
- import * as React from 'react';
4
- import React__default, { ComponentProps, FunctionComponent, PropsWithChildren, FC, Context, ReactElement, ReactNode } from 'react';
5
+ import { Channel } from 'storybook/internal/channels';
5
6
  import { Renderer } from 'storybook/internal/csf';
6
7
  import { PropDescriptor } from 'storybook/preview-api';
7
8
  import { SupportedLanguage, SyntaxHighlighter, ActionItem, SyntaxHighlighterFormatTypes } from 'storybook/internal/components';
8
9
  import { SourceType } from 'storybook/internal/docs-tools';
9
10
  import { ThemeVars } from 'storybook/theming';
10
11
 
11
- declare enum SourceError {
12
- NO_STORY = "There\u2019s no story here.",
13
- SOURCE_UNAVAILABLE = "Oh no! The source is not available."
14
- }
15
- interface SourceCodeProps {
16
- /** The language the syntax highlighter uses for your story’s code */
17
- language?: SupportedLanguage;
18
- /** Use this to override the content of the source block. */
19
- code?: string;
20
- /** The formatter the syntax highlighter uses for your story’s code. */
21
- format?: ComponentProps<typeof SyntaxHighlighter>['format'];
22
- /** Display the source snippet in a dark mode. */
23
- dark?: boolean;
24
- }
25
- interface SourceProps$1 extends SourceCodeProps {
26
- isLoading?: boolean;
27
- error?: SourceError;
28
- }
29
- /** Syntax-highlighted source code for a component (or anything!) */
30
- declare const Source$1: FunctionComponent<SourceProps$1>;
31
-
32
- type PreviewProps = PropsWithChildren<{
33
- isLoading?: true;
34
- layout?: Layout;
35
- isColumn?: boolean;
36
- columns?: number;
37
- withSource?: SourceProps$1;
38
- isExpanded?: boolean;
39
- withToolbar?: boolean;
40
- className?: string;
41
- additionalActions?: ActionItem[];
42
- }>;
43
- type Layout = 'padded' | 'fullscreen' | 'centered';
44
-
45
12
  interface ArgType {
46
13
  name?: string;
47
14
  description?: string;
@@ -107,6 +74,41 @@ type ArgsTableProps = ArgsTableOptionProps & (ArgsTableDataProps | ArgsTableErro
107
74
  */
108
75
  declare const ArgsTable: FC<ArgsTableProps>;
109
76
 
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
+
110
112
  interface CommonProps {
111
113
  story: PreparedStory;
112
114
  inline: boolean;
@@ -172,6 +174,45 @@ interface IconGalleryProps {
172
174
  /** Show a grid of icons, as specified by `IconItem`. */
173
175
  declare const IconGallery: FunctionComponent<IconGalleryProps>;
174
176
 
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
+
175
216
  declare const anchorBlockIdFromId: (storyId: string) => string;
176
217
  interface AnchorProps {
177
218
  storyId: string;
@@ -1028,4 +1069,4 @@ type ColorProps = ColorControlProps;
1028
1069
  declare const LazyColorControl: React__default.LazyExoticComponent<React__default.FC<ColorControlProps>>;
1029
1070
  declare const ColorControl: (props: ComponentProps<typeof LazyColorControl>) => React__default.JSX.Element;
1030
1071
 
1031
- 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, DocsContainer, DocsContainerProps, 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 };
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, DocsContainer, DocsContainerProps, 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, TableOfContents, 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 };