@storybook/blocks 8.0.0-alpha.0 → 8.0.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.
- package/dist/index.d.ts +7 -77
- package/dist/index.js +4 -47
- package/dist/index.mjs +7 -50
- package/package.json +14 -13
- package/jest.config.js +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Conditional, DocsContextProps, PreparedStory, ModuleExports, ModuleExport, Parameters as Parameters$1, StrictArgTypes, Renderer as Renderer$1, Args as Args$1, StoryId, StoryContextForLoaders,
|
|
1
|
+
import { Conditional, DocsContextProps, PreparedStory, ModuleExports, ModuleExport, Parameters as Parameters$1, StrictArgTypes, Renderer as Renderer$1, Args as Args$1, StoryId, StoryContextForLoaders, ResolvedModuleExportType, ResolvedModuleExportFromType, ProjectAnnotations, BaseAnnotations, ComponentTitle } from '@storybook/types';
|
|
2
2
|
export { DocsContextProps } from '@storybook/types';
|
|
3
3
|
import React, { ComponentProps, FunctionComponent, ReactNode, FC, PropsWithChildren, Context, ReactElement } from 'react';
|
|
4
4
|
import { Renderer } from '@storybook/csf';
|
|
5
5
|
import { PropDescriptor } from '@storybook/preview-api';
|
|
6
|
-
import { SyntaxHighlighter, ActionItem, SyntaxHighlighterFormatTypes } from '@storybook/components';
|
|
6
|
+
import { SupportedLanguage, SyntaxHighlighter, ActionItem, SyntaxHighlighterFormatTypes } from '@storybook/components';
|
|
7
7
|
import { SourceType } from '@storybook/docs-tools';
|
|
8
8
|
import { Channel } from '@storybook/channels';
|
|
9
9
|
import { ThemeVars } from '@storybook/theming';
|
|
@@ -17,7 +17,7 @@ interface SourceCodeProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* The language the syntax highlighter uses for your story’s code
|
|
19
19
|
*/
|
|
20
|
-
language?:
|
|
20
|
+
language?: SupportedLanguage;
|
|
21
21
|
/**
|
|
22
22
|
* Use this to override the content of the source block.
|
|
23
23
|
*/
|
|
@@ -250,22 +250,11 @@ declare const SourceContainer: FC<PropsWithChildren<{
|
|
|
250
250
|
channel: Channel;
|
|
251
251
|
}>>;
|
|
252
252
|
|
|
253
|
-
declare enum SourceState {
|
|
254
|
-
OPEN = "open",
|
|
255
|
-
CLOSED = "closed",
|
|
256
|
-
NONE = "none"
|
|
257
|
-
}
|
|
258
253
|
type SourceParameters = SourceCodeProps & {
|
|
259
254
|
/**
|
|
260
255
|
* Where to read the source code from, see `SourceType`
|
|
261
256
|
*/
|
|
262
257
|
type?: SourceType;
|
|
263
|
-
/**
|
|
264
|
-
* Transform the detected source for display
|
|
265
|
-
*
|
|
266
|
-
* @deprecated use `transform` prop instead
|
|
267
|
-
*/
|
|
268
|
-
transformSource?: (code: string, storyContext: StoryContextForLoaders) => string;
|
|
269
258
|
/**
|
|
270
259
|
* Transform the detected source for display
|
|
271
260
|
*/
|
|
@@ -287,20 +276,13 @@ type SourceProps = SourceParameters & {
|
|
|
287
276
|
* ```
|
|
288
277
|
*/
|
|
289
278
|
of?: ModuleExport;
|
|
290
|
-
/** @deprecated use of={storyExport} instead */
|
|
291
|
-
id?: string;
|
|
292
|
-
/** @deprecated use of={storyExport} instead */
|
|
293
|
-
ids?: string[];
|
|
294
279
|
/**
|
|
295
280
|
* Internal prop to control if a story re-renders on args updates
|
|
296
281
|
*/
|
|
297
282
|
__forceInitialArgs?: boolean;
|
|
298
283
|
};
|
|
299
|
-
type SourceStateProps = {
|
|
300
|
-
state: SourceState;
|
|
301
|
-
};
|
|
302
284
|
type PureSourceProps = ComponentProps<typeof Source$1>;
|
|
303
|
-
declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps
|
|
285
|
+
declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps;
|
|
304
286
|
/**
|
|
305
287
|
* Story source doc block renders source code if provided,
|
|
306
288
|
* or the source for a story if `storyId` is provided, or
|
|
@@ -309,24 +291,10 @@ declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps
|
|
|
309
291
|
declare const Source: FC<SourceProps>;
|
|
310
292
|
|
|
311
293
|
type PureStoryProps = ComponentProps<typeof Story$1>;
|
|
312
|
-
/**
|
|
313
|
-
* Props to define a story
|
|
314
|
-
*
|
|
315
|
-
* @deprecated Define stories in CSF files
|
|
316
|
-
*/
|
|
317
|
-
type StoryDefProps = StoryAnnotations;
|
|
318
294
|
/**
|
|
319
295
|
* Props to reference another story
|
|
320
296
|
*/
|
|
321
297
|
type StoryRefProps = {
|
|
322
|
-
/**
|
|
323
|
-
* @deprecated Use of={storyExport} instead
|
|
324
|
-
*/
|
|
325
|
-
id?: string;
|
|
326
|
-
/**
|
|
327
|
-
* @deprecated Use of={storyExport} and define the story in the CSF file
|
|
328
|
-
*/
|
|
329
|
-
story?: StoryAnnotations;
|
|
330
298
|
/**
|
|
331
299
|
* Pass the export defining a story to render that story
|
|
332
300
|
*
|
|
@@ -373,33 +341,11 @@ type StoryParameters = {
|
|
|
373
341
|
*/
|
|
374
342
|
__primary?: boolean;
|
|
375
343
|
};
|
|
376
|
-
type StoryProps =
|
|
344
|
+
type StoryProps = StoryRefProps & StoryParameters;
|
|
377
345
|
declare const getStoryId: (props: StoryProps, context: DocsContextProps) => StoryId;
|
|
378
346
|
declare const getStoryProps: <TFramework extends Renderer$1>(props: StoryParameters, story: PreparedStory<TFramework>, context: DocsContextProps<TFramework>) => PureStoryProps;
|
|
379
347
|
declare const Story: FC<StoryProps>;
|
|
380
348
|
|
|
381
|
-
type DeprecatedCanvasProps = {
|
|
382
|
-
/**
|
|
383
|
-
* @deprecated multiple stories are not supported
|
|
384
|
-
*/
|
|
385
|
-
isColumn?: boolean;
|
|
386
|
-
/**
|
|
387
|
-
* @deprecated multiple stories are not supported
|
|
388
|
-
*/
|
|
389
|
-
columns?: number;
|
|
390
|
-
/**
|
|
391
|
-
* @deprecated use `sourceState` instead
|
|
392
|
-
*/
|
|
393
|
-
withSource?: SourceState;
|
|
394
|
-
/**
|
|
395
|
-
* @deprecated use `source.code` instead
|
|
396
|
-
*/
|
|
397
|
-
mdxSource?: string;
|
|
398
|
-
/**
|
|
399
|
-
* @deprecated reference stories with the `of` prop instead
|
|
400
|
-
*/
|
|
401
|
-
children?: ReactNode;
|
|
402
|
-
};
|
|
403
349
|
type CanvasProps = Pick<PreviewProps, 'withToolbar' | 'additionalActions' | 'className'> & {
|
|
404
350
|
/**
|
|
405
351
|
* Pass the export defining a story to render that story
|
|
@@ -449,7 +395,7 @@ type CanvasProps = Pick<PreviewProps, 'withToolbar' | 'additionalActions' | 'cla
|
|
|
449
395
|
*/
|
|
450
396
|
story?: Pick<StoryProps, 'inline' | 'height' | 'autoplay' | '__forceInitialArgs' | '__primary'>;
|
|
451
397
|
};
|
|
452
|
-
declare const Canvas: FC<CanvasProps
|
|
398
|
+
declare const Canvas: FC<CanvasProps>;
|
|
453
399
|
|
|
454
400
|
type ControlsParameters = {
|
|
455
401
|
include?: PropDescriptor;
|
|
@@ -482,18 +428,6 @@ interface DescriptionProps {
|
|
|
482
428
|
* If not specified, the description will be extracted from the meta of the attached CSF file.
|
|
483
429
|
*/
|
|
484
430
|
of?: Of;
|
|
485
|
-
/**
|
|
486
|
-
* @deprecated Manually specifying description type is deprecated. See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#description-block-parametersnotes-and-parametersinfo
|
|
487
|
-
*/
|
|
488
|
-
type?: DescriptionType;
|
|
489
|
-
/**
|
|
490
|
-
* @deprecated The 'markdown' prop on the Description block is deprecated. See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#description-block-parametersnotes-and-parametersinfo
|
|
491
|
-
*/
|
|
492
|
-
markdown?: string;
|
|
493
|
-
/**
|
|
494
|
-
* @deprecated The 'children' prop on the Description block is deprecated. See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#description-block-parametersnotes-and-parametersinfo
|
|
495
|
-
*/
|
|
496
|
-
children?: string;
|
|
497
431
|
}
|
|
498
432
|
declare const DescriptionContainer: FC<DescriptionProps>;
|
|
499
433
|
|
|
@@ -541,10 +475,6 @@ type MetaProps = BaseAnnotations & {
|
|
|
541
475
|
declare const Meta: FC<MetaProps>;
|
|
542
476
|
|
|
543
477
|
interface PrimaryProps {
|
|
544
|
-
/**
|
|
545
|
-
* @deprecated Primary block should only be used to render the primary story, which is automatically found.
|
|
546
|
-
*/
|
|
547
|
-
name?: string;
|
|
548
478
|
/**
|
|
549
479
|
* Specify where to get the primary story from.
|
|
550
480
|
*/
|
|
@@ -715,4 +645,4 @@ type ColorProps = ColorControlProps;
|
|
|
715
645
|
declare const LazyColorControl: React.LazyExoticComponent<React.FC<ColorControlProps>>;
|
|
716
646
|
declare const ColorControl: (props: ComponentProps<typeof LazyColorControl>) => React.JSX.Element;
|
|
717
647
|
|
|
718
|
-
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, ArgsTable, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, ComponentsTable, 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$1 as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceProps,
|
|
648
|
+
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, ArgsTable, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, ComponentsTable, 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$1 as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceProps, Stories, Story, StoryProps, StorySources, StoryTable, Subheading, Subtitle, TextConfig, TextControl, TextProps, TextValue, Title, Typeset, UNKNOWN_ARGS_HASH, Unstyled, Wrapper, anchorBlockIdFromId, argsHash, assertIsFn, extractComponentArgTypes, extractTitle, format, formatDate, formatTime, getComponent, getStoryId, getStoryProps, parse, parseDate, parseTime, useOf, useSourceProps };
|