@storybook/addon-docs 10.5.0-alpha.1 → 10.5.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/_browser-chunks/{Color-23OOGO2C.js → Color-6AOWCN3U.js} +9 -6
- package/dist/_browser-chunks/{DocsRenderer-LL677BLK.js → DocsRenderer-JROSPFPF.js} +1 -1
- package/dist/_browser-chunks/{chunk-S4QKU6I5.js → chunk-6Z2O5XYJ.js} +2 -2
- package/dist/_browser-chunks/chunk-QQBDHPVZ.js +13 -0
- package/dist/_browser-chunks/{chunk-SL3VIQZ3.js → chunk-UAWMPV5J.js} +5 -1
- package/dist/_node-chunks/{chunk-2P7DRLLN.js → chunk-4PS7XBET.js} +198 -198
- package/dist/_node-chunks/{chunk-CHBEJILX.js → chunk-DVPTS3HN.js} +6 -6
- package/dist/_node-chunks/{chunk-QT5SF4ZG.js → chunk-KLL5RTY5.js} +18 -9
- package/dist/_node-chunks/{chunk-ER2HZR2B.js → chunk-NOY765A3.js} +6 -6
- package/dist/_node-chunks/{mdx-plugin-EVGRZT7I.js → mdx-plugin-PNWQJL3O.js} +17 -12
- package/dist/_node-chunks/{rehype-external-links-5FK5D2OH.js → rehype-external-links-VWGGYBH3.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-LVCBRYZT.js → rehype-slug-5IVSCV7M.js} +8 -8
- package/dist/angular/index.js +1 -1
- package/dist/blocks.d.ts +20 -2
- package/dist/blocks.js +786 -325
- package/dist/ember/index.js +1 -1
- package/dist/index.d.ts +25 -2
- package/dist/index.js +2 -2
- package/dist/manager.js +33 -25
- package/dist/mdx-loader.js +10 -10
- package/dist/preset.js +459 -32
- package/dist/preview.js +2 -2
- package/package.json +4 -4
- package/dist/_browser-chunks/chunk-S2IHWCOG.js +0 -13
package/dist/ember/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as storybook_internal_csf from 'storybook/internal/csf';
|
|
2
2
|
import React$1, { ReactElement, ComponentType } from 'react';
|
|
3
|
-
import { Renderer, DocsContextProps, ModuleExport, ModuleExports, DocsRenderFunction } from 'storybook/internal/types';
|
|
3
|
+
import { Renderer, DocsContextProps, ModuleExport, ModuleExports, Args, PreparedStory, DocsRenderFunction } from 'storybook/internal/types';
|
|
4
4
|
import { ThemeVars } from 'storybook/theming';
|
|
5
5
|
|
|
6
6
|
interface TocbotOptions {
|
|
@@ -65,6 +65,12 @@ type StoryBlockParameters = {
|
|
|
65
65
|
*/
|
|
66
66
|
of: ModuleExport;
|
|
67
67
|
};
|
|
68
|
+
type StoriesBlockParameters = {
|
|
69
|
+
/**
|
|
70
|
+
* Custom filter function for determining which stories to include in a <Stories> block
|
|
71
|
+
*/
|
|
72
|
+
filter?: <TRenderer extends Renderer = Renderer, TArgs = Args>(Story: PreparedStory<TRenderer>, Context: ReturnType<DocsContextProps['getStoryContext']>) => boolean;
|
|
73
|
+
};
|
|
68
74
|
type ControlsBlockParameters = {
|
|
69
75
|
/** Exclude specific properties from the Controls panel */
|
|
70
76
|
exclude?: string[] | RegExp;
|
|
@@ -96,6 +102,7 @@ type CanvasBlockParameters = {
|
|
|
96
102
|
* buttons that do anything you specify in the onClick function.
|
|
97
103
|
*/
|
|
98
104
|
additionalActions?: {
|
|
105
|
+
ariaLabel?: string;
|
|
99
106
|
className?: string;
|
|
100
107
|
disabled?: boolean;
|
|
101
108
|
onClick: () => void;
|
|
@@ -217,17 +224,33 @@ interface DocsParameters {
|
|
|
217
224
|
*/
|
|
218
225
|
source?: Partial<SourceBlockParameters>;
|
|
219
226
|
/**
|
|
220
|
-
* Story configuration
|
|
227
|
+
* Story block configuration
|
|
221
228
|
*
|
|
222
229
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-story
|
|
223
230
|
*/
|
|
224
231
|
story?: Partial<StoryBlockParameters>;
|
|
232
|
+
/**
|
|
233
|
+
* Stories block configuration
|
|
234
|
+
*
|
|
235
|
+
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-stories
|
|
236
|
+
*/
|
|
237
|
+
stories?: Partial<StoriesBlockParameters>;
|
|
225
238
|
/**
|
|
226
239
|
* The subtitle displayed when shown in docs page
|
|
227
240
|
*
|
|
228
241
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-subtitle
|
|
229
242
|
*/
|
|
230
243
|
subtitle?: string;
|
|
244
|
+
/**
|
|
245
|
+
* The BCP-47 language tag applied to Storybook-rendered docs prose (descriptions, titles,
|
|
246
|
+
* ArgTypes description cells, free MDX prose).
|
|
247
|
+
*
|
|
248
|
+
* Storybook's own chrome stays English regardless. Inherited project → meta (page-level) or
|
|
249
|
+
* project → meta → story (per-story prose).
|
|
250
|
+
*
|
|
251
|
+
* @default 'en'
|
|
252
|
+
*/
|
|
253
|
+
lang?: string;
|
|
231
254
|
/**
|
|
232
255
|
* Override the default theme
|
|
233
256
|
*
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "./_browser-chunks/chunk-OATZR77O.js";
|
|
4
4
|
import {
|
|
5
5
|
preview_exports
|
|
6
|
-
} from "./_browser-chunks/chunk-
|
|
7
|
-
import "./_browser-chunks/chunk-
|
|
6
|
+
} from "./_browser-chunks/chunk-6Z2O5XYJ.js";
|
|
7
|
+
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
import { definePreviewAddon } from "storybook/internal/csf";
|
package/dist/manager.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Source
|
|
3
3
|
} from "./_browser-chunks/chunk-SPXYZZB5.js";
|
|
4
|
-
import "./_browser-chunks/chunk-
|
|
4
|
+
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
5
5
|
|
|
6
6
|
// src/manager.tsx
|
|
7
7
|
import React, { useEffect, useState } from "react";
|
|
8
8
|
import { AddonPanel } from "storybook/internal/components";
|
|
9
9
|
import { addons, types, useChannel, useParameter } from "storybook/manager-api";
|
|
10
10
|
import { ignoreSsrWarning, styled, useTheme } from "storybook/theming";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
import {
|
|
12
|
+
ADDON_ID,
|
|
13
|
+
PANEL_ID,
|
|
14
|
+
PARAM_KEY,
|
|
15
|
+
shouldWaitForServiceSnippet,
|
|
16
|
+
SNIPPET_RENDERED
|
|
17
|
+
} from "storybook/internal/docs-tools";
|
|
16
18
|
var CodePanel = ({
|
|
17
19
|
active,
|
|
18
20
|
lastEvent,
|
|
19
|
-
currentStoryId
|
|
21
|
+
currentStoryId,
|
|
22
|
+
storyParameters,
|
|
23
|
+
storyPrepared
|
|
20
24
|
}) => {
|
|
21
|
-
let [codeSnippet, setSourceCode] = useState({
|
|
22
|
-
source: lastEvent?.source,
|
|
23
|
-
format: lastEvent?.format ?? void 0
|
|
25
|
+
let lastEventMatchesCurrentStory = lastEvent?.id === currentStoryId, [codeSnippet, setSourceCode] = useState({
|
|
26
|
+
source: lastEventMatchesCurrentStory ? lastEvent?.source : void 0,
|
|
27
|
+
format: lastEventMatchesCurrentStory ? lastEvent?.format ?? void 0 : void 0
|
|
24
28
|
}), parameter = useParameter(PARAM_KEY, {
|
|
25
29
|
source: { code: "" },
|
|
26
30
|
theme: "dark"
|
|
@@ -30,21 +34,16 @@ var CodePanel = ({
|
|
|
30
34
|
source: void 0,
|
|
31
35
|
format: void 0
|
|
32
36
|
});
|
|
33
|
-
}, [currentStoryId]), useChannel(
|
|
34
|
-
[SNIPPET_RENDERED]: ({ source, format }) => {
|
|
35
|
-
setSourceCode({ source, format });
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
let isDark = useTheme().base !== "light";
|
|
39
|
-
return React.createElement(AddonPanel, { active: !!active }, React.createElement(SourceStyles, null, React.createElement(
|
|
40
|
-
Source,
|
|
37
|
+
}, [currentStoryId]), useChannel(
|
|
41
38
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
39
|
+
[SNIPPET_RENDERED]: ({ id, source, format }) => {
|
|
40
|
+
id !== void 0 && id !== currentStoryId || setSourceCode({ source, format });
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[currentStoryId]
|
|
44
|
+
);
|
|
45
|
+
let isDark = useTheme().base !== "light", awaitingServiceSnippet = shouldWaitForServiceSnippet(storyParameters, storyPrepared), code = parameter.source?.code || codeSnippet.source || (awaitingServiceSnippet ? "" : parameter.source?.originalSource);
|
|
46
|
+
return React.createElement(AddonPanel, { active: !!active }, React.createElement(SourceStyles, null, React.createElement(Source, { ...parameter.source, code, format: codeSnippet.format, dark: isDark })));
|
|
48
47
|
};
|
|
49
48
|
addons.register(ADDON_ID, (api) => {
|
|
50
49
|
addons.add(PANEL_ID, {
|
|
@@ -68,7 +67,16 @@ addons.register(ADDON_ID, (api) => {
|
|
|
68
67
|
match: ({ viewMode }) => viewMode === "story",
|
|
69
68
|
render: ({ active }) => {
|
|
70
69
|
let channel = api.getChannel(), currentStory = api.getCurrentStoryData(), lastEvent = channel?.last(SNIPPET_RENDERED)?.[0];
|
|
71
|
-
return React.createElement(
|
|
70
|
+
return React.createElement(
|
|
71
|
+
CodePanel,
|
|
72
|
+
{
|
|
73
|
+
currentStoryId: currentStory?.id,
|
|
74
|
+
storyParameters: currentStory?.parameters,
|
|
75
|
+
storyPrepared: currentStory?.prepared,
|
|
76
|
+
lastEvent,
|
|
77
|
+
active
|
|
78
|
+
}
|
|
79
|
+
);
|
|
72
80
|
}
|
|
73
81
|
});
|
|
74
82
|
});
|
package/dist/mdx-loader.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_73jg7cechs from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_73jg7cechs from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_73jg7cechs from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_73jg7cechs.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_73jg7cechs.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_73jg7cechs.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
compile
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
15
|
-
import "./_node-chunks/chunk-
|
|
16
|
-
import "./_node-chunks/chunk-
|
|
17
|
-
import "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-4PS7XBET.js";
|
|
15
|
+
import "./_node-chunks/chunk-DVPTS3HN.js";
|
|
16
|
+
import "./_node-chunks/chunk-NOY765A3.js";
|
|
17
|
+
import "./_node-chunks/chunk-KLL5RTY5.js";
|
|
18
18
|
|
|
19
19
|
// src/mdx-loader.ts
|
|
20
20
|
var DEFAULT_RENDERER = `
|