@storybook/addon-docs 7.0.0-alpha.2 → 7.0.0-alpha.20

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.
Files changed (103) hide show
  1. package/README.md +12 -13
  2. package/blocks.js +1 -1
  3. package/dist/cjs/DocsRenderer.js +52 -0
  4. package/dist/cjs/blocks/index.js +4 -352
  5. package/dist/cjs/index.js +13 -1
  6. package/dist/cjs/preset.js +19 -4
  7. package/dist/cjs/preview.js +6 -2
  8. package/dist/esm/DocsRenderer.js +34 -0
  9. package/dist/esm/blocks/index.js +1 -24
  10. package/dist/esm/index.js +2 -1
  11. package/dist/esm/preset.js +14 -2
  12. package/dist/esm/preview.js +6 -2
  13. package/dist/types/DocsRenderer.d.ts +8 -0
  14. package/dist/types/blocks/index.d.ts +1 -24
  15. package/dist/types/index.d.ts +1 -0
  16. package/dist/types/preset.d.ts +8 -2
  17. package/dist/types/preview.d.ts +1 -6
  18. package/package.json +25 -23
  19. package/web-components/README.md +1 -0
  20. package/LICENSE +0 -21
  21. package/dist/cjs/blocks/Anchor.js +0 -23
  22. package/dist/cjs/blocks/ArgsTable.js +0 -329
  23. package/dist/cjs/blocks/Canvas.js +0 -109
  24. package/dist/cjs/blocks/Description.js +0 -126
  25. package/dist/cjs/blocks/DocsContainer.js +0 -127
  26. package/dist/cjs/blocks/DocsContext.js +0 -25
  27. package/dist/cjs/blocks/DocsPage.js +0 -30
  28. package/dist/cjs/blocks/DocsStory.js +0 -68
  29. package/dist/cjs/blocks/Heading.js +0 -31
  30. package/dist/cjs/blocks/Meta.js +0 -50
  31. package/dist/cjs/blocks/Preview.js +0 -23
  32. package/dist/cjs/blocks/Primary.js +0 -39
  33. package/dist/cjs/blocks/Props.js +0 -29
  34. package/dist/cjs/blocks/Source.js +0 -179
  35. package/dist/cjs/blocks/SourceContainer.js +0 -67
  36. package/dist/cjs/blocks/Stories.js +0 -51
  37. package/dist/cjs/blocks/Story.js +0 -143
  38. package/dist/cjs/blocks/Subheading.js +0 -31
  39. package/dist/cjs/blocks/Subtitle.js +0 -39
  40. package/dist/cjs/blocks/Title.js +0 -44
  41. package/dist/cjs/blocks/Wrapper.js +0 -20
  42. package/dist/cjs/blocks/enhanceSource.js +0 -92
  43. package/dist/cjs/blocks/mdx.js +0 -234
  44. package/dist/cjs/blocks/types.js +0 -10
  45. package/dist/cjs/blocks/useStory.js +0 -37
  46. package/dist/cjs/blocks/utils.js +0 -40
  47. package/dist/cjs/manager.js +0 -20
  48. package/dist/esm/blocks/Anchor.js +0 -8
  49. package/dist/esm/blocks/ArgsTable.js +0 -292
  50. package/dist/esm/blocks/Canvas.js +0 -83
  51. package/dist/esm/blocks/Description.js +0 -107
  52. package/dist/esm/blocks/DocsContainer.js +0 -98
  53. package/dist/esm/blocks/DocsContext.js +0 -16
  54. package/dist/esm/blocks/DocsPage.js +0 -11
  55. package/dist/esm/blocks/DocsStory.js +0 -46
  56. package/dist/esm/blocks/Heading.js +0 -17
  57. package/dist/esm/blocks/Meta.js +0 -31
  58. package/dist/esm/blocks/Preview.js +0 -9
  59. package/dist/esm/blocks/Primary.js +0 -23
  60. package/dist/esm/blocks/Props.js +0 -14
  61. package/dist/esm/blocks/Source.js +0 -144
  62. package/dist/esm/blocks/SourceContainer.js +0 -44
  63. package/dist/esm/blocks/Stories.js +0 -30
  64. package/dist/esm/blocks/Story.js +0 -114
  65. package/dist/esm/blocks/Subheading.js +0 -17
  66. package/dist/esm/blocks/Subtitle.js +0 -23
  67. package/dist/esm/blocks/Title.js +0 -24
  68. package/dist/esm/blocks/Wrapper.js +0 -8
  69. package/dist/esm/blocks/enhanceSource.js +0 -87
  70. package/dist/esm/blocks/mdx.js +0 -203
  71. package/dist/esm/blocks/types.js +0 -2
  72. package/dist/esm/blocks/useStory.js +0 -27
  73. package/dist/esm/blocks/utils.js +0 -29
  74. package/dist/esm/manager.js +0 -16
  75. package/dist/types/blocks/Anchor.d.ts +0 -6
  76. package/dist/types/blocks/ArgsTable.d.ts +0 -33
  77. package/dist/types/blocks/Canvas.d.ts +0 -9
  78. package/dist/types/blocks/Description.d.ts +0 -20
  79. package/dist/types/blocks/DocsContainer.d.ts +0 -7
  80. package/dist/types/blocks/DocsContext.d.ts +0 -5
  81. package/dist/types/blocks/DocsPage.d.ts +0 -2
  82. package/dist/types/blocks/DocsStory.d.ts +0 -3
  83. package/dist/types/blocks/Heading.d.ts +0 -6
  84. package/dist/types/blocks/Meta.d.ts +0 -9
  85. package/dist/types/blocks/Preview.d.ts +0 -3
  86. package/dist/types/blocks/Primary.d.ts +0 -6
  87. package/dist/types/blocks/Props.d.ts +0 -3
  88. package/dist/types/blocks/Source.d.ts +0 -38
  89. package/dist/types/blocks/SourceContainer.d.ts +0 -14
  90. package/dist/types/blocks/Stories.d.ts +0 -7
  91. package/dist/types/blocks/Story.d.ts +0 -28
  92. package/dist/types/blocks/Subheading.d.ts +0 -3
  93. package/dist/types/blocks/Subtitle.d.ts +0 -6
  94. package/dist/types/blocks/Title.d.ts +0 -8
  95. package/dist/types/blocks/Wrapper.d.ts +0 -2
  96. package/dist/types/blocks/enhanceSource.d.ts +0 -3
  97. package/dist/types/blocks/mdx.d.ts +0 -20
  98. package/dist/types/blocks/types.d.ts +0 -13
  99. package/dist/types/blocks/useStory.d.ts +0 -5
  100. package/dist/types/blocks/utils.d.ts +0 -3
  101. package/dist/types/manager.d.ts +0 -1
  102. package/manager.js +0 -1
  103. package/register.js +0 -6
@@ -1,6 +0,0 @@
1
- import { FC } from 'react';
2
- interface PrimaryProps {
3
- name?: string;
4
- }
5
- export declare const Primary: FC<PrimaryProps>;
6
- export {};
@@ -1,3 +0,0 @@
1
- import { ComponentProps } from 'react';
2
- import { ArgsTable } from './ArgsTable';
3
- export declare const Props: (props: ComponentProps<typeof ArgsTable>) => JSX.Element;
@@ -1,38 +0,0 @@
1
- import { ComponentProps, FC } from 'react';
2
- import { Source as PureSource } from '@storybook/components';
3
- import { DocsContextProps } from './DocsContext';
4
- import { SourceContextProps } from './SourceContainer';
5
- export declare enum SourceState {
6
- OPEN = "open",
7
- CLOSED = "closed",
8
- NONE = "none"
9
- }
10
- interface CommonProps {
11
- language?: string;
12
- dark?: boolean;
13
- format?: PureSourceProps['format'];
14
- code?: string;
15
- }
16
- declare type SingleSourceProps = {
17
- id: string;
18
- } & CommonProps;
19
- declare type MultiSourceProps = {
20
- ids: string[];
21
- } & CommonProps;
22
- declare type CodeProps = {
23
- code: string;
24
- } & CommonProps;
25
- declare type NoneProps = CommonProps;
26
- declare type SourceProps = SingleSourceProps | MultiSourceProps | CodeProps | NoneProps;
27
- declare type SourceStateProps = {
28
- state: SourceState;
29
- };
30
- declare type PureSourceProps = ComponentProps<typeof PureSource>;
31
- export declare const getSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps & SourceStateProps;
32
- /**
33
- * Story source doc block renders source code if provided,
34
- * or the source for a story if `storyId` is provided, or
35
- * the source for the current story if nothing is provided.
36
- */
37
- export declare const Source: FC<PureSourceProps>;
38
- export {};
@@ -1,14 +0,0 @@
1
- import { FC, Context } from 'react';
2
- import type { SyntaxHighlighterFormatTypes } from '@storybook/components';
3
- import type { StoryId } from '@storybook/api';
4
- export interface SourceItem {
5
- code: string;
6
- format: SyntaxHighlighterFormatTypes;
7
- }
8
- export declare type StorySources = Record<StoryId, SourceItem>;
9
- export interface SourceContextProps {
10
- sources: StorySources;
11
- setSource?: (id: StoryId, item: SourceItem) => void;
12
- }
13
- export declare const SourceContext: Context<SourceContextProps>;
14
- export declare const SourceContainer: FC<{}>;
@@ -1,7 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- interface StoriesProps {
3
- title?: JSX.Element | string;
4
- includePrimary?: boolean;
5
- }
6
- export declare const Stories: FunctionComponent<StoriesProps>;
7
- export {};
@@ -1,28 +0,0 @@
1
- import { FunctionComponent, ReactNode, ElementType, ComponentProps } from 'react';
2
- import { Story as PureStory } from '@storybook/components';
3
- import { StoryId, StoryAnnotations, AnyFramework } from '@storybook/csf';
4
- import type { Story as StoryType } from '@storybook/store';
5
- import { DocsContextProps } from './DocsContext';
6
- export declare const storyBlockIdFromId: (storyId: string) => string;
7
- declare type PureStoryProps = ComponentProps<typeof PureStory>;
8
- declare type CommonProps = StoryAnnotations & {
9
- height?: string;
10
- inline?: boolean;
11
- };
12
- declare type StoryDefProps = {
13
- name: string;
14
- children: ReactNode;
15
- };
16
- declare type StoryRefProps = {
17
- id?: string;
18
- };
19
- declare type StoryImportProps = {
20
- name: string;
21
- story: ElementType;
22
- };
23
- export declare type StoryProps = (StoryDefProps | StoryRefProps | StoryImportProps) & CommonProps;
24
- export declare const lookupStoryId: (storyName: string, { mdxStoryNameToKey, mdxComponentAnnotations }: DocsContextProps) => string;
25
- export declare const getStoryId: (props: StoryProps, context: DocsContextProps) => StoryId;
26
- export declare const getStoryProps: <TFramework extends AnyFramework>({ height, inline }: StoryProps, story: StoryType<TFramework>) => PureStoryProps;
27
- declare const Story: FunctionComponent<StoryProps>;
28
- export { Story };
@@ -1,3 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { HeadingProps } from './Heading';
3
- export declare const Subheading: FunctionComponent<HeadingProps>;
@@ -1,6 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- interface SubtitleProps {
3
- children?: JSX.Element | string;
4
- }
5
- export declare const Subtitle: FunctionComponent<SubtitleProps>;
6
- export {};
@@ -1,8 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { DocsContextProps } from './DocsContext';
3
- interface TitleProps {
4
- children?: JSX.Element | string;
5
- }
6
- export declare const extractTitle: ({ title }: DocsContextProps) => string;
7
- export declare const Title: FunctionComponent<TitleProps>;
8
- export {};
@@ -1,2 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- export declare const Wrapper: FunctionComponent;
@@ -1,3 +0,0 @@
1
- import type { Parameters } from '@storybook/addons';
2
- import type { Story } from '@storybook/store';
3
- export declare const enhanceSource: (story: Story<any>) => Parameters;
@@ -1,20 +0,0 @@
1
- import { FC } from 'react';
2
- import { DocsContextProps } from './DocsContext';
3
- export declare const assertIsFn: (val: any) => any;
4
- export declare const AddContext: FC<DocsContextProps>;
5
- interface CodeOrSourceMdxProps {
6
- className?: string;
7
- }
8
- export declare const CodeOrSourceMdx: FC<CodeOrSourceMdxProps>;
9
- interface AnchorMdxProps {
10
- href: string;
11
- target: string;
12
- }
13
- export declare const AnchorMdx: FC<AnchorMdxProps>;
14
- interface HeaderMdxProps {
15
- as: string;
16
- id: string;
17
- }
18
- export declare const HeaderMdx: FC<HeaderMdxProps>;
19
- export declare const HeadersMdx: {};
20
- export {};
@@ -1,13 +0,0 @@
1
- export declare const CURRENT_SELECTION = ".";
2
- export declare const PRIMARY_STORY = "^";
3
- export declare type Component = any;
4
- export interface StoryData {
5
- id?: string;
6
- kind?: string;
7
- name?: string;
8
- parameters?: any;
9
- }
10
- export declare type DocsStoryProps = StoryData & {
11
- expanded?: boolean;
12
- withToolbar?: boolean;
13
- };
@@ -1,5 +0,0 @@
1
- import type { StoryId, AnyFramework } from '@storybook/csf';
2
- import type { Story } from '@storybook/store';
3
- import { DocsContextProps } from './DocsContext';
4
- export declare function useStory<TFramework extends AnyFramework = AnyFramework>(storyId: StoryId, context: DocsContextProps<TFramework>): Story<TFramework> | void;
5
- export declare function useStories<TFramework extends AnyFramework = AnyFramework>(storyIds: StoryId[], context: DocsContextProps<TFramework>): (Story<TFramework> | void)[];
@@ -1,3 +0,0 @@
1
- import { Component } from './types';
2
- export declare const getComponentName: (component: Component) => string;
3
- export declare function scrollToElement(element: any, block?: string): void;
@@ -1 +0,0 @@
1
- export {};
package/manager.js DELETED
@@ -1 +0,0 @@
1
- import './dist/esm/manager';
package/register.js DELETED
@@ -1,6 +0,0 @@
1
- import { once } from '@storybook/client-logger';
2
- import './manager';
3
-
4
- once.warn(
5
- 'register.js is deprecated see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-registerjs'
6
- );