@storybook/addon-docs 9.1.0-alpha.1 → 9.1.0-alpha.10

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.
@@ -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, { FC, ComponentProps, FunctionComponent, PropsWithChildren, ReactElement, Context, ReactNode } from 'react';
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
- import { Channel } from 'storybook/internal/channels';
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 { ThemeVars } from 'storybook/theming';
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, 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 };
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 };