@storybook/addon-docs 10.5.0-alpha.6 → 10.5.0-alpha.8
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-MQE2NRD4.js → Color-AVMI7ZZZ.js} +3 -3
- 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-SL3VIQZ3.js → chunk-UAWMPV5J.js} +5 -1
- package/dist/_node-chunks/{chunk-EVYDPJBT.js → chunk-NDIMOQRQ.js} +6 -6
- package/dist/_node-chunks/{chunk-HPMS3VGC.js → chunk-Q33Y654V.js} +198 -198
- package/dist/_node-chunks/{chunk-7GHLECTU.js → chunk-RDCEJST6.js} +6 -6
- package/dist/_node-chunks/{chunk-5KAVE6JH.js → chunk-X327Z4QW.js} +18 -9
- package/dist/_node-chunks/{mdx-plugin-SQGKMDRV.js → mdx-plugin-XDOSSZCW.js} +11 -11
- package/dist/_node-chunks/{rehype-external-links-55SSEHL7.js → rehype-external-links-2RDYL6C3.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-2JQMJ6CC.js → rehype-slug-D2I7KZ4I.js} +8 -8
- package/dist/angular/index.js +1 -1
- package/dist/blocks.d.ts +1 -1
- package/dist/blocks.js +428 -143
- package/dist/ember/index.js +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.js +2 -2
- package/dist/manager.js +33 -25
- package/dist/mdx-loader.js +10 -10
- package/dist/preset.js +456 -31
- package/dist/preview.js +2 -2
- package/package.json +4 -4
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;
|
|
@@ -218,11 +224,17 @@ interface DocsParameters {
|
|
|
218
224
|
*/
|
|
219
225
|
source?: Partial<SourceBlockParameters>;
|
|
220
226
|
/**
|
|
221
|
-
* Story configuration
|
|
227
|
+
* Story block configuration
|
|
222
228
|
*
|
|
223
229
|
* @see https://storybook.js.org/docs/api/doc-blocks/doc-block-story
|
|
224
230
|
*/
|
|
225
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>;
|
|
226
238
|
/**
|
|
227
239
|
* The subtitle displayed when shown in docs page
|
|
228
240
|
*
|
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_3yfiy933z03 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_3yfiy933z03 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_3yfiy933z03 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_3yfiy933z03.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_3yfiy933z03.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_3yfiy933z03.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-Q33Y654V.js";
|
|
15
|
+
import "./_node-chunks/chunk-NDIMOQRQ.js";
|
|
16
|
+
import "./_node-chunks/chunk-RDCEJST6.js";
|
|
17
|
+
import "./_node-chunks/chunk-X327Z4QW.js";
|
|
18
18
|
|
|
19
19
|
// src/mdx-loader.ts
|
|
20
20
|
var DEFAULT_RENDERER = `
|