storybook-addon-dependency-previews 0.1.0
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/README.md +192 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/addon/index.cjs +12 -0
- package/dist/addon/index.cjs.map +1 -0
- package/dist/addon/index.d.cts +5 -0
- package/dist/addon/index.d.mts +5 -0
- package/dist/addon/index.mjs +11 -0
- package/dist/addon/index.mjs.map +1 -0
- package/dist/addon/preset.cjs +8 -0
- package/dist/addon/preset.cjs.map +1 -0
- package/dist/addon/preset.d.cts +5 -0
- package/dist/addon/preset.d.mts +5 -0
- package/dist/addon/preset.mjs +6 -0
- package/dist/addon/preset.mjs.map +1 -0
- package/dist/addon/vitePlugin.cjs +26 -0
- package/dist/addon/vitePlugin.cjs.map +1 -0
- package/dist/addon/vitePlugin.d.cts +9 -0
- package/dist/addon/vitePlugin.d.mts +9 -0
- package/dist/addon/vitePlugin.mjs +24 -0
- package/dist/addon/vitePlugin.mjs.map +1 -0
- package/dist/blocks/DependencyPreviews.cjs +102 -0
- package/dist/blocks/DependencyPreviews.cjs.map +1 -0
- package/dist/blocks/DependencyPreviews.d.cts +7 -0
- package/dist/blocks/DependencyPreviews.d.mts +7 -0
- package/dist/blocks/DependencyPreviews.mjs +100 -0
- package/dist/blocks/DependencyPreviews.mjs.map +1 -0
- package/dist/blocks/DependencyPreviews.module.css +14 -0
- package/dist/blocks/index.cjs +1 -0
- package/dist/blocks/index.d.cts +1 -0
- package/dist/blocks/index.d.mts +1 -0
- package/dist/blocks/index.mjs +1 -0
- package/dist/cli/sb-deps.cjs +321 -0
- package/dist/cli/sb-deps.cjs.map +1 -0
- package/dist/cli/sb-deps.d.cts +1 -0
- package/dist/cli/sb-deps.d.mts +1 -0
- package/dist/cli/sb-deps.mjs +319 -0
- package/dist/cli/sb-deps.mjs.map +1 -0
- package/dist/cli/scripts/depcruise.config.cjs +38 -0
- package/dist/cli/scripts/depcruise.config.cjs.map +1 -0
- package/dist/cli/scripts/depcruise.config.d.cts +6 -0
- package/dist/cli/scripts/depcruise.config.d.mts +7 -0
- package/dist/cli/scripts/depcruise.config.mjs +37 -0
- package/dist/cli/scripts/depcruise.config.mjs.map +1 -0
- package/dist/cli/scripts/postprocess.cjs +106 -0
- package/dist/cli/scripts/postprocess.cjs.map +1 -0
- package/dist/cli/scripts/postprocess.d.cts +1 -0
- package/dist/cli/scripts/postprocess.d.mts +1 -0
- package/dist/cli/scripts/postprocess.mjs +106 -0
- package/dist/cli/scripts/postprocess.mjs.map +1 -0
- package/dist/components/ComponentSourceLink.cjs +42 -0
- package/dist/components/ComponentSourceLink.cjs.map +1 -0
- package/dist/components/ComponentSourceLink.mjs +40 -0
- package/dist/components/ComponentSourceLink.mjs.map +1 -0
- package/dist/components/ComponentSourceLink.module.css +5 -0
- package/dist/components/CopyButton.cjs +112 -0
- package/dist/components/CopyButton.cjs.map +1 -0
- package/dist/components/CopyButton.mjs +110 -0
- package/dist/components/CopyButton.mjs.map +1 -0
- package/dist/components/CopyButton.module.css +76 -0
- package/dist/components/Expandable.cjs +51 -0
- package/dist/components/Expandable.cjs.map +1 -0
- package/dist/components/Expandable.mjs +49 -0
- package/dist/components/Expandable.mjs.map +1 -0
- package/dist/components/Expandable.module.css +110 -0
- package/dist/components/FullParityStory.cjs +47 -0
- package/dist/components/FullParityStory.cjs.map +1 -0
- package/dist/components/FullParityStory.mjs +44 -0
- package/dist/components/FullParityStory.mjs.map +1 -0
- package/dist/components/PathCopyMolecule.cjs +28 -0
- package/dist/components/PathCopyMolecule.cjs.map +1 -0
- package/dist/components/PathCopyMolecule.mjs +26 -0
- package/dist/components/PathCopyMolecule.mjs.map +1 -0
- package/dist/components/PathCopyMolecule.module.css +14 -0
- package/dist/components/PrimaryPreview.cjs +35 -0
- package/dist/components/PrimaryPreview.cjs.map +1 -0
- package/dist/components/PrimaryPreview.mjs +34 -0
- package/dist/components/PrimaryPreview.mjs.map +1 -0
- package/dist/components/SbHeading.cjs +18 -0
- package/dist/components/SbHeading.cjs.map +1 -0
- package/dist/components/SbHeading.mjs +16 -0
- package/dist/components/SbHeading.mjs.map +1 -0
- package/dist/components/SbHeading.module.css +23 -0
- package/dist/components/StoryLink.cjs +45 -0
- package/dist/components/StoryLink.cjs.map +1 -0
- package/dist/components/StoryLink.mjs +43 -0
- package/dist/components/StoryLink.mjs.map +1 -0
- package/dist/components/StoryLink.module.css +13 -0
- package/dist/components/TooltipTrigger.cjs +100 -0
- package/dist/components/TooltipTrigger.cjs.map +1 -0
- package/dist/components/TooltipTrigger.mjs +98 -0
- package/dist/components/TooltipTrigger.mjs.map +1 -0
- package/dist/components/TooltipTrigger.module.css +62 -0
- package/dist/components/icons/ArrowToRectangleIcon.cjs +19 -0
- package/dist/components/icons/ArrowToRectangleIcon.cjs.map +1 -0
- package/dist/components/icons/ArrowToRectangleIcon.mjs +18 -0
- package/dist/components/icons/ArrowToRectangleIcon.mjs.map +1 -0
- package/dist/components/icons/BuildIcon.cjs +19 -0
- package/dist/components/icons/BuildIcon.cjs.map +1 -0
- package/dist/components/icons/BuildIcon.mjs +18 -0
- package/dist/components/icons/BuildIcon.mjs.map +1 -0
- package/dist/components/icons/CopyIcon.cjs +19 -0
- package/dist/components/icons/CopyIcon.cjs.map +1 -0
- package/dist/components/icons/CopyIcon.mjs +18 -0
- package/dist/components/icons/CopyIcon.mjs.map +1 -0
- package/dist/components/icons/CubeIcon.cjs +19 -0
- package/dist/components/icons/CubeIcon.cjs.map +1 -0
- package/dist/components/icons/CubeIcon.mjs +18 -0
- package/dist/components/icons/CubeIcon.mjs.map +1 -0
- package/dist/components/icons/DoubleChevronDown.cjs +19 -0
- package/dist/components/icons/DoubleChevronDown.cjs.map +1 -0
- package/dist/components/icons/DoubleChevronDown.mjs +18 -0
- package/dist/components/icons/DoubleChevronDown.mjs.map +1 -0
- package/dist/components/icons/ExternalLinkIcon.cjs +19 -0
- package/dist/components/icons/ExternalLinkIcon.cjs.map +1 -0
- package/dist/components/icons/ExternalLinkIcon.mjs +18 -0
- package/dist/components/icons/ExternalLinkIcon.mjs.map +1 -0
- package/dist/components/icons/EyeOpen.cjs +23 -0
- package/dist/components/icons/EyeOpen.cjs.map +1 -0
- package/dist/components/icons/EyeOpen.mjs +22 -0
- package/dist/components/icons/EyeOpen.mjs.map +1 -0
- package/dist/components/icons/LoadingRipples.cjs +79 -0
- package/dist/components/icons/LoadingRipples.cjs.map +1 -0
- package/dist/components/icons/LoadingRipples.mjs +78 -0
- package/dist/components/icons/LoadingRipples.mjs.map +1 -0
- package/dist/components/icons/SquaresPlus.cjs +19 -0
- package/dist/components/icons/SquaresPlus.cjs.map +1 -0
- package/dist/components/icons/SquaresPlus.mjs +18 -0
- package/dist/components/icons/SquaresPlus.mjs.map +1 -0
- package/dist/components/icons/Svg.cjs +37 -0
- package/dist/components/icons/Svg.cjs.map +1 -0
- package/dist/components/icons/Svg.mjs +36 -0
- package/dist/components/icons/Svg.mjs.map +1 -0
- package/dist/components/icons/X.cjs +19 -0
- package/dist/components/icons/X.cjs.map +1 -0
- package/dist/components/icons/X.mjs +18 -0
- package/dist/components/icons/X.mjs.map +1 -0
- package/dist/constants.cjs +9 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.mjs +7 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/hooks/useDependencyGraph.cjs +63 -0
- package/dist/hooks/useDependencyGraph.cjs.map +1 -0
- package/dist/hooks/useDependencyGraph.mjs +60 -0
- package/dist/hooks/useDependencyGraph.mjs.map +1 -0
- package/dist/hooks/useDynamicStory.cjs +83 -0
- package/dist/hooks/useDynamicStory.cjs.map +1 -0
- package/dist/hooks/useDynamicStory.mjs +82 -0
- package/dist/hooks/useDynamicStory.mjs.map +1 -0
- package/dist/hooks/useStoryParams.cjs +17 -0
- package/dist/hooks/useStoryParams.cjs.map +1 -0
- package/dist/hooks/useStoryParams.mjs +16 -0
- package/dist/hooks/useStoryParams.mjs.map +1 -0
- package/dist/index.cjs +15 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +9 -0
- package/dist/manager.cjs +22 -0
- package/dist/manager.cjs.map +1 -0
- package/dist/manager.d.cts +1 -0
- package/dist/manager.d.mts +1 -0
- package/dist/manager.mjs +21 -0
- package/dist/manager.mjs.map +1 -0
- package/dist/panels/DefaultAutoDocsLayout.cjs +24 -0
- package/dist/panels/DefaultAutoDocsLayout.cjs.map +1 -0
- package/dist/panels/DefaultAutoDocsLayout.d.cts +10 -0
- package/dist/panels/DefaultAutoDocsLayout.d.mts +10 -0
- package/dist/panels/DefaultAutoDocsLayout.mjs +22 -0
- package/dist/panels/DefaultAutoDocsLayout.mjs.map +1 -0
- package/dist/panels/GraphView.cjs +78 -0
- package/dist/panels/GraphView.cjs.map +1 -0
- package/dist/panels/GraphView.d.cts +7 -0
- package/dist/panels/GraphView.d.mts +7 -0
- package/dist/panels/GraphView.mjs +77 -0
- package/dist/panels/GraphView.mjs.map +1 -0
- package/dist/panels/index.cjs +3 -0
- package/dist/panels/index.d.cts +3 -0
- package/dist/panels/index.d.mts +3 -0
- package/dist/panels/index.mjs +3 -0
- package/dist/preview.cjs +23 -0
- package/dist/preview.cjs.map +1 -0
- package/dist/preview.d.cts +9 -0
- package/dist/preview.d.mts +10 -0
- package/dist/preview.mjs +21 -0
- package/dist/preview.mjs.map +1 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +104 -0
- package/dist/types.d.mts +104 -0
- package/dist/types.mjs +0 -0
- package/package.json +94 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useStoryParams } from "./useStoryParams.mjs";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/useDynamicStory.ts
|
|
5
|
+
function findStoryImporter(storiesGlob, storyFilePath) {
|
|
6
|
+
if (!storyFilePath) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const norm = (p) => "/" + p.replace(/^[./]+/, "").replace(/\\/g, "/");
|
|
10
|
+
const wanted = norm(storyFilePath);
|
|
11
|
+
return storiesGlob[wanted] || Object.entries(storiesGlob).find(([k]) => k.endsWith(wanted))?.[1];
|
|
12
|
+
}
|
|
13
|
+
function useDynamicStory(storyInfo) {
|
|
14
|
+
const { dependencyPreviews } = useStoryParams();
|
|
15
|
+
const modules = dependencyPreviews.storyModules;
|
|
16
|
+
const importer = useMemo(() => findStoryImporter(modules, storyInfo.storyFilePath), [modules, storyInfo.storyFilePath]);
|
|
17
|
+
const [csfModule, setCsfModule] = useState(null);
|
|
18
|
+
const [err, setErr] = useState(null);
|
|
19
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
let alive = true;
|
|
22
|
+
setIsLoading(true);
|
|
23
|
+
(async () => {
|
|
24
|
+
try {
|
|
25
|
+
if (!importer) throw new Error(`No story module found at this path: ${storyInfo.storyFilePath}`);
|
|
26
|
+
const mod = await importer();
|
|
27
|
+
if (alive) setCsfModule(mod);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
if (alive) setErr(e?.message || String(e));
|
|
30
|
+
} finally {
|
|
31
|
+
setIsLoading(false);
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
34
|
+
return () => {
|
|
35
|
+
alive = false;
|
|
36
|
+
};
|
|
37
|
+
}, [importer, storyInfo.componentPath]);
|
|
38
|
+
const primaryExport = getPrimaryStoryExport(csfModule, storyInfo);
|
|
39
|
+
const Component = csfModule?.default?.component;
|
|
40
|
+
const primaryId = storyInfo.storyId?.replace(/--docs$/, getPrimaryId(csfModule));
|
|
41
|
+
return {
|
|
42
|
+
isLoading,
|
|
43
|
+
primaryExport,
|
|
44
|
+
primaryId,
|
|
45
|
+
csfModule,
|
|
46
|
+
Component,
|
|
47
|
+
error: err
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getPrimaryId(csfModule) {
|
|
51
|
+
if (!csfModule) return "--default";
|
|
52
|
+
if ("Default" in csfModule) return "--default";
|
|
53
|
+
if ("Primary" in csfModule) return "--primary";
|
|
54
|
+
return "--" + slugifyExportName(csfModule?.__namedExportsOrder?.[0] || "default");
|
|
55
|
+
}
|
|
56
|
+
function slugifyExportName(name) {
|
|
57
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/[_\s]+/g, "-").replace(/[^a-zA-Z0-9-]/g, "-").toLowerCase().replace(/--+/g, "-").replace(/^-+|-+$/g, "");
|
|
58
|
+
}
|
|
59
|
+
/** Choose a sensible story:
|
|
60
|
+
* 1) If the module has `Primary`, use it.
|
|
61
|
+
* 2) If we have a docs/primary id, try to match the export name in the id.
|
|
62
|
+
* 3) Else fall back to the first named export.
|
|
63
|
+
*/
|
|
64
|
+
function getPrimaryStoryExport(mod, info) {
|
|
65
|
+
if (!mod) return null;
|
|
66
|
+
if ("Default" in mod) return mod.Default;
|
|
67
|
+
if ("Primary" in mod) return mod.Primary;
|
|
68
|
+
if (info?.storyId && !info.storyId.endsWith("--docs")) {
|
|
69
|
+
const exportName = info.storyId.split("--").pop();
|
|
70
|
+
const match = Object.keys(mod).find((k) => k !== "default" && k.toLowerCase() === exportName);
|
|
71
|
+
if (match) return mod[match];
|
|
72
|
+
}
|
|
73
|
+
const order = mod.__namedExportsOrder || [];
|
|
74
|
+
const first = order.find((k) => k !== "default");
|
|
75
|
+
if (first && first in mod) return mod[first];
|
|
76
|
+
const anyKey = Object.keys(mod).find((k) => k !== "default" && typeof mod[k] === "function");
|
|
77
|
+
return anyKey ? mod[anyKey] : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { useDynamicStory };
|
|
82
|
+
//# sourceMappingURL=useDynamicStory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDynamicStory.mjs","names":[],"sources":["../../src/hooks/useDynamicStory.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport type { CsfModule, StoryInfo, StoryModules } from '../types'\nimport { useStoryParams } from './useStoryParams'\n\n// grab all stories; Vite will code-split them\n\nfunction findStoryImporter(\n\tstoriesGlob: StoryModules,\n\tstoryFilePath: string | undefined | null,\n) {\n\tif (!storyFilePath) {\n\t\treturn null\n\t}\n\t// normalize to Vite’s absolute-style keys\n\tconst norm = (p: string) =>\n\t\t'/' + p.replace(/^[./]+/, '').replace(/\\\\/g, '/')\n\tconst wanted = norm(storyFilePath)\n\t// exact match first, else suffix match as a fallback\n\treturn (\n\t\tstoriesGlob[wanted] ||\n\t\tObject.entries(storiesGlob).find(([k]) => k.endsWith(wanted))?.[1]\n\t)\n}\n\nexport function useDynamicStory(storyInfo: StoryInfo) {\n\tconst { dependencyPreviews } = useStoryParams()\n\tconst modules = dependencyPreviews.storyModules\n\tconst importer = useMemo(\n\t\t() => findStoryImporter(modules, storyInfo.storyFilePath),\n\t\t[modules, storyInfo.storyFilePath],\n\t)\n\tconst [csfModule, setCsfModule] = useState<CsfModule | null>(null)\n\tconst [err, setErr] = useState<string | null>(null)\n\tconst [isLoading, setIsLoading] = useState(true)\n\n\tuseEffect(() => {\n\t\tlet alive = true\n\t\tsetIsLoading(true)\n\t\t;(async () => {\n\t\t\ttry {\n\t\t\t\tif (!importer)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`No story module found at this path: ${storyInfo.storyFilePath}`,\n\t\t\t\t\t)\n\t\t\t\tconst mod = await importer()\n\t\t\t\tif (alive) setCsfModule(mod as CsfModule)\n\t\t\t} catch (e: any) {\n\t\t\t\tif (alive) setErr(e?.message || String(e))\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false)\n\t\t\t}\n\t\t})()\n\t\treturn () => {\n\t\t\talive = false\n\t\t}\n\t}, [importer, storyInfo.componentPath])\n\n\tconst primaryExport = getPrimaryStoryExport(csfModule, storyInfo)\n\tconst Component = csfModule?.default?.component\n\tconst primaryId = storyInfo.storyId?.replace(\n\t\t/--docs$/,\n\t\tgetPrimaryId(csfModule),\n\t)\n\n\treturn {\n\t\tisLoading,\n\t\tprimaryExport,\n\t\tprimaryId,\n\t\tcsfModule,\n\t\tComponent,\n\t\terror: err,\n\t}\n}\n\nfunction getPrimaryId(csfModule: CsfModule | undefined | null) {\n\tif (!csfModule) return '--default'\n\tif ('Default' in csfModule) return '--default'\n\tif ('Primary' in csfModule) return '--primary'\n\treturn (\n\t\t'--' +\n\t\tslugifyExportName(csfModule?.__namedExportsOrder?.[0] || 'default')\n\t)\n}\n\n// Kebab-case like Storybook: \"ErrorStrings\" -> \"error-strings\"\nfunction slugifyExportName(name: string) {\n\treturn (\n\t\tname\n\t\t\t// split camelCase / PascalCase boundaries\n\t\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n\t\t\t.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2') // ABCDef -> ABC-Def\n\t\t\t// underscores/spaces -> dashes\n\t\t\t.replace(/[_\\s]+/g, '-')\n\t\t\t// strip anything not alnum or dash\n\t\t\t.replace(/[^a-zA-Z0-9-]/g, '-')\n\t\t\t// lowercase + collapse/trim dashes\n\t\t\t.toLowerCase()\n\t\t\t.replace(/--+/g, '-')\n\t\t\t.replace(/^-+|-+$/g, '')\n\t)\n}\n\n/** Choose a sensible story:\n * 1) If the module has `Primary`, use it.\n * 2) If we have a docs/primary id, try to match the export name in the id.\n * 3) Else fall back to the first named export.\n */\nfunction getPrimaryStoryExport(mod: any, info?: StoryInfo) {\n\tif (!mod) return null\n\n\t// 1) Prefer \"Default\" or \"Primary\" if present\n\tif ('Default' in mod) return mod.Default\n\tif ('Primary' in mod) return mod.Primary\n\n\t// 2) If we have a storyId like \"…--errorstrings\", try to match export name\n\tif (info?.storyId && !info.storyId.endsWith('--docs')) {\n\t\tconst exportName = info.storyId.split('--').pop() // e.g. \"errorstrings\"\n\t\tconst match = Object.keys(mod).find(\n\t\t\t(k) => k !== 'default' && k.toLowerCase() === exportName,\n\t\t)\n\t\tif (match) return (mod as any)[match]\n\t}\n\n\t// 3) Fall back to first named export\n\tconst order: string[] = mod.__namedExportsOrder || []\n\tconst first = order.find((k) => k !== 'default')\n\tif (first && first in mod) return (mod as any)[first]\n\n\t// Last resort: any non-default function export\n\tconst anyKey = Object.keys(mod).find(\n\t\t(k) => k !== 'default' && typeof mod[k] === 'function',\n\t)\n\treturn anyKey ? (mod as any)[anyKey] : null\n}\n"],"mappings":";;;;AAMA,SAAS,kBACR,aACA,eACC;AACD,KAAI,CAAC,eAAe;AACnB,SAAO;;CAGR,MAAM,QAAQ,MACb,MAAM,EAAE,QAAQ,UAAU,GAAG,CAAC,QAAQ,OAAO,IAAI;CAClD,MAAM,SAAS,KAAK,cAAc;AAElC,QACC,YAAY,WACZ,OAAO,QAAQ,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,OAAO,CAAC,GAAG;;AAIlE,SAAgB,gBAAgB,WAAsB;CACrD,MAAM,EAAE,uBAAuB,gBAAgB;CAC/C,MAAM,UAAU,mBAAmB;CACnC,MAAM,WAAW,cACV,kBAAkB,SAAS,UAAU,cAAc,EACzD,CAAC,SAAS,UAAU,cAAc,CAClC;CACD,MAAM,CAAC,WAAW,gBAAgB,SAA2B,KAAK;CAClE,MAAM,CAAC,KAAK,UAAU,SAAwB,KAAK;CACnD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;AAEhD,iBAAgB;EACf,IAAI,QAAQ;AACZ,eAAa,KAAK;AACjB,GAAC,YAAY;AACb,OAAI;AACH,QAAI,CAAC,SACJ,OAAM,IAAI,MACT,uCAAuC,UAAU,gBACjD;IACF,MAAM,MAAM,MAAM,UAAU;AAC5B,QAAI,MAAO,cAAa,IAAiB;YACjC,GAAQ;AAChB,QAAI,MAAO,QAAO,GAAG,WAAW,OAAO,EAAE,CAAC;aACjC;AACT,iBAAa,MAAM;;MAEjB;AACJ,eAAa;AACZ,WAAQ;;IAEP,CAAC,UAAU,UAAU,cAAc,CAAC;CAEvC,MAAM,gBAAgB,sBAAsB,WAAW,UAAU;CACjE,MAAM,YAAY,WAAW,SAAS;CACtC,MAAM,YAAY,UAAU,SAAS,QACpC,WACA,aAAa,UAAU,CACvB;AAED,QAAO;EACN;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;;AAGF,SAAS,aAAa,WAAyC;AAC9D,KAAI,CAAC,UAAW,QAAO;AACvB,KAAI,aAAa,UAAW,QAAO;AACnC,KAAI,aAAa,UAAW,QAAO;AACnC,QACC,OACA,kBAAkB,WAAW,sBAAsB,MAAM,UAAU;;AAKrE,SAAS,kBAAkB,MAAc;AACxC,QACC,KAEE,QAAQ,sBAAsB,QAAQ,CACtC,QAAQ,yBAAyB,QAAQ,CAEzC,QAAQ,WAAW,IAAI,CAEvB,QAAQ,kBAAkB,IAAI,CAE9B,aAAa,CACb,QAAQ,QAAQ,IAAI,CACpB,QAAQ,YAAY,GAAG;;;;;;;AAS3B,SAAS,sBAAsB,KAAU,MAAkB;AAC1D,KAAI,CAAC,IAAK,QAAO;AAGjB,KAAI,aAAa,IAAK,QAAO,IAAI;AACjC,KAAI,aAAa,IAAK,QAAO,IAAI;AAGjC,KAAI,MAAM,WAAW,CAAC,KAAK,QAAQ,SAAS,SAAS,EAAE;EACtD,MAAM,aAAa,KAAK,QAAQ,MAAM,KAAK,CAAC,KAAK;EACjD,MAAM,QAAQ,OAAO,KAAK,IAAI,CAAC,MAC7B,MAAM,MAAM,aAAa,EAAE,aAAa,KAAK,WAC9C;AACD,MAAI,MAAO,QAAQ,IAAY;;CAIhC,MAAM,QAAkB,IAAI,uBAAuB,EAAE;CACrD,MAAM,QAAQ,MAAM,MAAM,MAAM,MAAM,UAAU;AAChD,KAAI,SAAS,SAAS,IAAK,QAAQ,IAAY;CAG/C,MAAM,SAAS,OAAO,KAAK,IAAI,CAAC,MAC9B,MAAM,MAAM,aAAa,OAAO,IAAI,OAAO,WAC5C;AACD,QAAO,SAAU,IAAY,UAAU"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _storybook_addon_docs_blocks = require("@storybook/addon-docs/blocks");
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/useStoryParams.ts
|
|
5
|
+
function useStoryParams() {
|
|
6
|
+
const resolved = (0, _storybook_addon_docs_blocks.useOf)("story");
|
|
7
|
+
const story = resolved?.story;
|
|
8
|
+
const storyId = story?.id;
|
|
9
|
+
return {
|
|
10
|
+
...story?.parameters,
|
|
11
|
+
_storyId: storyId
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.useStoryParams = useStoryParams;
|
|
17
|
+
//# sourceMappingURL=useStoryParams.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoryParams.cjs","names":[],"sources":["../../src/hooks/useStoryParams.ts"],"sourcesContent":["import { useOf } from '@storybook/addon-docs/blocks'\nimport type { DependencyPreviewStorybookParameters } from '../types'\n\nexport function useStoryParams(): DependencyPreviewStorybookParameters & {\n\t_storyId?: string\n} {\n\tconst resolved = useOf<'story'>('story')\n\tconst story = resolved?.story\n\t// Get the story ID - this is the most reliable identifier available at runtime\n\t// It matches the storyId field in the dependency graph JSON\n\tconst storyId = story?.id\n\n\treturn {\n\t\t...(story?.parameters as DependencyPreviewStorybookParameters),\n\t\t_storyId: storyId,\n\t}\n}\n"],"mappings":";;;;AAGA,SAAgB,iBAEd;CACD,MAAM,mDAA0B,QAAQ;CACxC,MAAM,QAAQ,UAAU;CAGxB,MAAM,UAAU,OAAO;AAEvB,QAAO;EACN,GAAI,OAAO;EACX,UAAU;EACV"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useOf } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/useStoryParams.ts
|
|
4
|
+
function useStoryParams() {
|
|
5
|
+
const resolved = useOf("story");
|
|
6
|
+
const story = resolved?.story;
|
|
7
|
+
const storyId = story?.id;
|
|
8
|
+
return {
|
|
9
|
+
...story?.parameters,
|
|
10
|
+
_storyId: storyId
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useStoryParams };
|
|
16
|
+
//# sourceMappingURL=useStoryParams.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoryParams.mjs","names":[],"sources":["../../src/hooks/useStoryParams.ts"],"sourcesContent":["import { useOf } from '@storybook/addon-docs/blocks'\nimport type { DependencyPreviewStorybookParameters } from '../types'\n\nexport function useStoryParams(): DependencyPreviewStorybookParameters & {\n\t_storyId?: string\n} {\n\tconst resolved = useOf<'story'>('story')\n\tconst story = resolved?.story\n\t// Get the story ID - this is the most reliable identifier available at runtime\n\t// It matches the storyId field in the dependency graph JSON\n\tconst storyId = story?.id\n\n\treturn {\n\t\t...(story?.parameters as DependencyPreviewStorybookParameters),\n\t\t_storyId: storyId,\n\t}\n}\n"],"mappings":";;;AAGA,SAAgB,iBAEd;CACD,MAAM,WAAW,MAAe,QAAQ;CACxC,MAAM,QAAQ,UAAU;CAGxB,MAAM,UAAU,OAAO;AAEvB,QAAO;EACN,GAAI,OAAO;EACX,UAAU;EACV"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_DependencyPreviews = require('./blocks/DependencyPreviews.cjs');
|
|
3
|
+
require('./blocks/index.cjs');
|
|
4
|
+
const require_DefaultAutoDocsLayout = require('./panels/DefaultAutoDocsLayout.cjs');
|
|
5
|
+
const require_GraphView = require('./panels/GraphView.cjs');
|
|
6
|
+
require('./panels/index.cjs');
|
|
7
|
+
require('./types.cjs');
|
|
8
|
+
const require_preview = require('./preview.cjs');
|
|
9
|
+
|
|
10
|
+
exports.DefaultAutoDocsLayout = require_DefaultAutoDocsLayout.DefaultAutoDocsLayout;
|
|
11
|
+
exports.DependencyPreviews = require_DependencyPreviews.DependencyPreviews;
|
|
12
|
+
exports.GraphView = require_GraphView.GraphView;
|
|
13
|
+
exports.decorators = require_preview.decorators;
|
|
14
|
+
exports.defaultPreviewParameters = require_DefaultAutoDocsLayout.defaultPreviewParameters;
|
|
15
|
+
exports.dependencyPreviewDecorators = require_preview.dependencyPreviewDecorators;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DependencyPreviews } from "./blocks/DependencyPreviews.cjs";
|
|
2
|
+
import { AnyObj, CsfModule, DecoratorFn, DependencyPreviewStorybookParameters, Deps, Graph, StoryExport, StoryInfo, StoryModules, StoryParameters, StorybookParameters, StorybookPreviewConfig } from "./types.cjs";
|
|
3
|
+
import { DefaultAutoDocsLayout, defaultPreviewParameters } from "./panels/DefaultAutoDocsLayout.cjs";
|
|
4
|
+
import { GraphView } from "./panels/GraphView.cjs";
|
|
5
|
+
import { decorators, dependencyPreviewDecorators } from "./preview.cjs";
|
|
6
|
+
export { AnyObj, CsfModule, DecoratorFn, DefaultAutoDocsLayout, DependencyPreviewStorybookParameters, DependencyPreviews, Deps, Graph, GraphView, StoryExport, StoryInfo, StoryModules, StoryParameters, StorybookParameters, StorybookPreviewConfig, decorators, defaultPreviewParameters, dependencyPreviewDecorators };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DependencyPreviews } from "./blocks/DependencyPreviews.mjs";
|
|
2
|
+
import { AnyObj, CsfModule, DecoratorFn, DependencyPreviewStorybookParameters, Deps, Graph, StoryExport, StoryInfo, StoryModules, StoryParameters, StorybookParameters, StorybookPreviewConfig } from "./types.mjs";
|
|
3
|
+
import { DefaultAutoDocsLayout, defaultPreviewParameters } from "./panels/DefaultAutoDocsLayout.mjs";
|
|
4
|
+
import { GraphView } from "./panels/GraphView.mjs";
|
|
5
|
+
import { decorators, dependencyPreviewDecorators } from "./preview.mjs";
|
|
6
|
+
export { AnyObj, CsfModule, DecoratorFn, DefaultAutoDocsLayout, DependencyPreviewStorybookParameters, DependencyPreviews, Deps, Graph, GraphView, StoryExport, StoryInfo, StoryModules, StoryParameters, StorybookParameters, StorybookPreviewConfig, decorators, defaultPreviewParameters, dependencyPreviewDecorators };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DependencyPreviews } from "./blocks/DependencyPreviews.mjs";
|
|
2
|
+
import "./blocks/index.mjs";
|
|
3
|
+
import { DefaultAutoDocsLayout, defaultPreviewParameters } from "./panels/DefaultAutoDocsLayout.mjs";
|
|
4
|
+
import { GraphView } from "./panels/GraphView.mjs";
|
|
5
|
+
import "./panels/index.mjs";
|
|
6
|
+
import "./types.mjs";
|
|
7
|
+
import { decorators, dependencyPreviewDecorators } from "./preview.mjs";
|
|
8
|
+
|
|
9
|
+
export { DefaultAutoDocsLayout, DependencyPreviews, GraphView, decorators, defaultPreviewParameters, dependencyPreviewDecorators };
|
package/dist/manager.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_GraphView = require('./panels/GraphView.cjs');
|
|
3
|
+
const require_constants = require('./constants.cjs');
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let storybook_manager_api = require("storybook/manager-api");
|
|
6
|
+
let storybook_internal_components = require("storybook/internal/components");
|
|
7
|
+
|
|
8
|
+
//#region src/manager.tsx
|
|
9
|
+
storybook_manager_api.addons.register(require_constants.ADDON_ID, () => {
|
|
10
|
+
storybook_manager_api.addons.add(require_constants.PANEL_ID, {
|
|
11
|
+
title: "Dependency Previews",
|
|
12
|
+
type: storybook_manager_api.types.PANEL,
|
|
13
|
+
match: ({ viewMode }) => viewMode === "story" || viewMode === "docs",
|
|
14
|
+
render: ({ active }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(storybook_internal_components.AddonPanel, {
|
|
15
|
+
active,
|
|
16
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_GraphView.GraphView, {})
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//# sourceMappingURL=manager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.cjs","names":["addons","ADDON_ID","PANEL_ID","types","AddonPanel","GraphView"],"sources":["../src/manager.tsx"],"sourcesContent":["import { addons, types } from 'storybook/manager-api'\nimport { AddonPanel } from 'storybook/internal/components'\nimport { ADDON_ID, PANEL_ID } from './constants'\nimport { GraphView } from './panels/GraphView'\n\naddons.register(ADDON_ID, () => {\n\taddons.add(PANEL_ID, {\n\t\ttitle: 'Dependency Previews',\n\t\ttype: types.PANEL,\n\t\tmatch: ({ viewMode }) => viewMode === 'story' || viewMode === 'docs',\n\t\trender: ({ active }) => (\n\t\t\t<AddonPanel active={active!}>\n\t\t\t\t<GraphView />\n\t\t\t</AddonPanel>\n\t\t),\n\t})\n})\n"],"mappings":";;;;;;;;AAKAA,6BAAO,SAASC,kCAAgB;AAC/B,8BAAO,IAAIC,4BAAU;EACpB,OAAO;EACP,MAAMC,4BAAM;EACZ,QAAQ,EAAE,eAAe,aAAa,WAAW,aAAa;EAC9D,SAAS,EAAE,aACV,2CAACC;GAAmB;aACnB,2CAACC,gCAAY;IACD;EAEd,CAAC;EACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/manager.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GraphView } from "./panels/GraphView.mjs";
|
|
2
|
+
import { ADDON_ID, PANEL_ID } from "./constants.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { addons, types } from "storybook/manager-api";
|
|
5
|
+
import { AddonPanel } from "storybook/internal/components";
|
|
6
|
+
|
|
7
|
+
//#region src/manager.tsx
|
|
8
|
+
addons.register(ADDON_ID, () => {
|
|
9
|
+
addons.add(PANEL_ID, {
|
|
10
|
+
title: "Dependency Previews",
|
|
11
|
+
type: types.PANEL,
|
|
12
|
+
match: ({ viewMode }) => viewMode === "story" || viewMode === "docs",
|
|
13
|
+
render: ({ active }) => /* @__PURE__ */ jsx(AddonPanel, {
|
|
14
|
+
active,
|
|
15
|
+
children: /* @__PURE__ */ jsx(GraphView, {})
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//# sourceMappingURL=manager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.mjs","names":[],"sources":["../src/manager.tsx"],"sourcesContent":["import { addons, types } from 'storybook/manager-api'\nimport { AddonPanel } from 'storybook/internal/components'\nimport { ADDON_ID, PANEL_ID } from './constants'\nimport { GraphView } from './panels/GraphView'\n\naddons.register(ADDON_ID, () => {\n\taddons.add(PANEL_ID, {\n\t\ttitle: 'Dependency Previews',\n\t\ttype: types.PANEL,\n\t\tmatch: ({ viewMode }) => viewMode === 'story' || viewMode === 'docs',\n\t\trender: ({ active }) => (\n\t\t\t<AddonPanel active={active!}>\n\t\t\t\t<GraphView />\n\t\t\t</AddonPanel>\n\t\t),\n\t})\n})\n"],"mappings":";;;;;;;AAKA,OAAO,SAAS,gBAAgB;AAC/B,QAAO,IAAI,UAAU;EACpB,OAAO;EACP,MAAM,MAAM;EACZ,QAAQ,EAAE,eAAe,aAAa,WAAW,aAAa;EAC9D,SAAS,EAAE,aACV,oBAAC;GAAmB;aACnB,oBAAC,cAAY;IACD;EAEd,CAAC;EACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_DependencyPreviews = require('../blocks/DependencyPreviews.cjs');
|
|
3
|
+
require('../blocks/index.cjs');
|
|
4
|
+
let _storybook_addon_docs_blocks = require("@storybook/addon-docs/blocks");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
//#region src/panels/DefaultAutoDocsLayout.tsx
|
|
8
|
+
function DefaultAutoDocsLayout() {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Title, {}),
|
|
11
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Subtitle, {}),
|
|
12
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Description, {}),
|
|
13
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Primary, {}),
|
|
14
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Controls, {}),
|
|
15
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DependencyPreviews.DependencyPreviews, {}),
|
|
16
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Stories, {})
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
const defaultPreviewParameters = { docs: { page: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultAutoDocsLayout, {}) } };
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.DefaultAutoDocsLayout = DefaultAutoDocsLayout;
|
|
23
|
+
exports.defaultPreviewParameters = defaultPreviewParameters;
|
|
24
|
+
//# sourceMappingURL=DefaultAutoDocsLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultAutoDocsLayout.cjs","names":["Title","Subtitle","Description","Primary","Controls","DependencyPreviews","Stories"],"sources":["../../src/panels/DefaultAutoDocsLayout.tsx"],"sourcesContent":["import {\n\tControls,\n\tDescription,\n\tPrimary,\n\tStories,\n\tSubtitle,\n\tTitle,\n} from '@storybook/addon-docs/blocks'\nimport { DependencyPreviews } from '../blocks'\nimport type { StorybookParameters } from '../types'\n\nexport { DependencyPreviews }\n\nexport function DefaultAutoDocsLayout() {\n\treturn (\n\t\t<>\n\t\t\t<Title />\n\t\t\t<Subtitle />\n\t\t\t<Description />\n\t\t\t<Primary />\n\t\t\t<Controls />\n\t\t\t<DependencyPreviews />\n\t\t\t<Stories />\n\t\t</>\n\t)\n}\n\nexport const defaultPreviewParameters: StorybookParameters = {\n\tdocs: {\n\t\tpage: () => <DefaultAutoDocsLayout />,\n\t},\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,wBAAwB;AACvC,QACC;EACC,2CAACA,uCAAQ;EACT,2CAACC,0CAAW;EACZ,2CAACC,6CAAc;EACf,2CAACC,yCAAU;EACX,2CAACC,0CAAW;EACZ,2CAACC,kDAAqB;EACtB,2CAACC,yCAAU;KACT;;AAIL,MAAa,2BAAgD,EAC5D,MAAM,EACL,YAAY,2CAAC,0BAAwB,EACrC,EACD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DependencyPreviews } from "../blocks/DependencyPreviews.cjs";
|
|
2
|
+
import { StorybookParameters } from "../types.cjs";
|
|
3
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/panels/DefaultAutoDocsLayout.d.ts
|
|
6
|
+
declare function DefaultAutoDocsLayout(): react_jsx_runtime3.JSX.Element;
|
|
7
|
+
declare const defaultPreviewParameters: StorybookParameters;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DefaultAutoDocsLayout, defaultPreviewParameters };
|
|
10
|
+
//# sourceMappingURL=DefaultAutoDocsLayout.d.cts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DependencyPreviews } from "../blocks/DependencyPreviews.mjs";
|
|
2
|
+
import { StorybookParameters } from "../types.mjs";
|
|
3
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/panels/DefaultAutoDocsLayout.d.ts
|
|
6
|
+
declare function DefaultAutoDocsLayout(): react_jsx_runtime2.JSX.Element;
|
|
7
|
+
declare const defaultPreviewParameters: StorybookParameters;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DefaultAutoDocsLayout, defaultPreviewParameters };
|
|
10
|
+
//# sourceMappingURL=DefaultAutoDocsLayout.d.mts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DependencyPreviews } from "../blocks/DependencyPreviews.mjs";
|
|
2
|
+
import "../blocks/index.mjs";
|
|
3
|
+
import { Controls, Description, Primary, Stories, Subtitle, Title } from "@storybook/addon-docs/blocks";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/panels/DefaultAutoDocsLayout.tsx
|
|
7
|
+
function DefaultAutoDocsLayout() {
|
|
8
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9
|
+
/* @__PURE__ */ jsx(Title, {}),
|
|
10
|
+
/* @__PURE__ */ jsx(Subtitle, {}),
|
|
11
|
+
/* @__PURE__ */ jsx(Description, {}),
|
|
12
|
+
/* @__PURE__ */ jsx(Primary, {}),
|
|
13
|
+
/* @__PURE__ */ jsx(Controls, {}),
|
|
14
|
+
/* @__PURE__ */ jsx(DependencyPreviews, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(Stories, {})
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
const defaultPreviewParameters = { docs: { page: () => /* @__PURE__ */ jsx(DefaultAutoDocsLayout, {}) } };
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DefaultAutoDocsLayout, defaultPreviewParameters };
|
|
22
|
+
//# sourceMappingURL=DefaultAutoDocsLayout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultAutoDocsLayout.mjs","names":[],"sources":["../../src/panels/DefaultAutoDocsLayout.tsx"],"sourcesContent":["import {\n\tControls,\n\tDescription,\n\tPrimary,\n\tStories,\n\tSubtitle,\n\tTitle,\n} from '@storybook/addon-docs/blocks'\nimport { DependencyPreviews } from '../blocks'\nimport type { StorybookParameters } from '../types'\n\nexport { DependencyPreviews }\n\nexport function DefaultAutoDocsLayout() {\n\treturn (\n\t\t<>\n\t\t\t<Title />\n\t\t\t<Subtitle />\n\t\t\t<Description />\n\t\t\t<Primary />\n\t\t\t<Controls />\n\t\t\t<DependencyPreviews />\n\t\t\t<Stories />\n\t\t</>\n\t)\n}\n\nexport const defaultPreviewParameters: StorybookParameters = {\n\tdocs: {\n\t\tpage: () => <DefaultAutoDocsLayout />,\n\t},\n}\n"],"mappings":";;;;;;AAaA,SAAgB,wBAAwB;AACvC,QACC;EACC,oBAAC,UAAQ;EACT,oBAAC,aAAW;EACZ,oBAAC,gBAAc;EACf,oBAAC,YAAU;EACX,oBAAC,aAAW;EACZ,oBAAC,uBAAqB;EACtB,oBAAC,YAAU;KACT;;AAIL,MAAa,2BAAgD,EAC5D,MAAM,EACL,YAAY,oBAAC,0BAAwB,EACrC,EACD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
|
|
5
|
+
//#region src/panels/GraphView.tsx
|
|
6
|
+
const DEFAULT_URL = "/dependency-previews.json";
|
|
7
|
+
function GraphView() {
|
|
8
|
+
const [graph, setGraph] = (0, react.useState)(null);
|
|
9
|
+
const [q, setQ] = (0, react.useState)("");
|
|
10
|
+
const [err, setErr] = (0, react.useState)(null);
|
|
11
|
+
(0, react.useEffect)(() => {
|
|
12
|
+
let alive = true;
|
|
13
|
+
(async () => {
|
|
14
|
+
try {
|
|
15
|
+
const res = await fetch(DEFAULT_URL);
|
|
16
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
17
|
+
const json = await res.json();
|
|
18
|
+
if (alive) setGraph(json);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (alive) setErr(e?.message || String(e));
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
return () => {
|
|
24
|
+
alive = false;
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
if (err) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: ["Failed to load dependency previews: ", err] });
|
|
28
|
+
if (!graph) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: "Loading dependency graph…" });
|
|
29
|
+
const entries = Object.entries(graph).filter(([k]) => k.toLowerCase().includes(q.toLowerCase())).sort(([a], [b]) => a.localeCompare(b));
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
31
|
+
style: {
|
|
32
|
+
padding: 12,
|
|
33
|
+
display: "grid",
|
|
34
|
+
gap: 12
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
38
|
+
placeholder: "Filter by file path",
|
|
39
|
+
value: q,
|
|
40
|
+
onChange: (e) => setQ(e.target.value),
|
|
41
|
+
style: {
|
|
42
|
+
padding: 6,
|
|
43
|
+
font: "inherit"
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
47
|
+
style: {
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
opacity: .7
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
entries.length,
|
|
53
|
+
" of ",
|
|
54
|
+
Object.keys(graph).length,
|
|
55
|
+
" components"
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
59
|
+
style: {
|
|
60
|
+
display: "grid",
|
|
61
|
+
gap: 10
|
|
62
|
+
},
|
|
63
|
+
children: entries.map(([file, node]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: file }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
64
|
+
style: {
|
|
65
|
+
display: "grid",
|
|
66
|
+
gap: 6,
|
|
67
|
+
padding: "6px 0 0"
|
|
68
|
+
},
|
|
69
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Built with" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: node.builtWith.map((f) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: f.componentPath }) }, f.componentPath)) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Used in" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: node.usedIn.map((f) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: f.componentPath }) }, f.componentPath)) })] })]
|
|
70
|
+
})] }, file))
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
exports.GraphView = GraphView;
|
|
78
|
+
//# sourceMappingURL=GraphView.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphView.cjs","names":[],"sources":["../../src/panels/GraphView.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { Graph } from '../types'\n\nconst DEFAULT_URL = '/dependency-previews.json'\n\nexport function GraphView() {\n\tconst [graph, setGraph] = useState<Graph | null>(null)\n\tconst [q, setQ] = useState('')\n\tconst [err, setErr] = useState<string | null>(null)\n\n\tuseEffect(() => {\n\t\tlet alive = true\n\t\t;(async () => {\n\t\t\ttry {\n\t\t\t\tconst res = await fetch(DEFAULT_URL)\n\t\t\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`)\n\t\t\t\tconst json = (await res.json()) as Graph\n\t\t\t\tif (alive) setGraph(json)\n\t\t\t} catch (e: any) {\n\t\t\t\tif (alive) setErr(e?.message || String(e))\n\t\t\t}\n\t\t})()\n\t\treturn () => {\n\t\t\talive = false\n\t\t}\n\t}, [])\n\n\tif (err) return <p>Failed to load dependency previews: {err}</p>\n\tif (!graph) return <p>Loading dependency graph…</p>\n\n\tconst entries = Object.entries(graph)\n\t\t.filter(([k]) => k.toLowerCase().includes(q.toLowerCase()))\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\n\treturn (\n\t\t<div style={{ padding: 12, display: 'grid', gap: 12 }}>\n\t\t\t<input\n\t\t\t\tplaceholder=\"Filter by file path\"\n\t\t\t\tvalue={q}\n\t\t\t\tonChange={(e) => setQ(e.target.value)}\n\t\t\t\tstyle={{ padding: 6, font: 'inherit' }}\n\t\t\t/>\n\t\t\t<div style={{ fontSize: 12, opacity: 0.7 }}>\n\t\t\t\t{entries.length} of {Object.keys(graph).length} components\n\t\t\t</div>\n\t\t\t<div style={{ display: 'grid', gap: 10 }}>\n\t\t\t\t{entries.map(([file, node]) => (\n\t\t\t\t\t<details key={file}>\n\t\t\t\t\t\t<summary>\n\t\t\t\t\t\t\t<code>{file}</code>\n\t\t\t\t\t\t</summary>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'grid',\n\t\t\t\t\t\t\t\tgap: 6,\n\t\t\t\t\t\t\t\tpadding: '6px 0 0',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<strong>Built with</strong>\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t{node.builtWith.map((f) => (\n\t\t\t\t\t\t\t\t\t\t<li key={f.componentPath}>\n\t\t\t\t\t\t\t\t\t\t\t<code>{f.componentPath}</code>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<strong>Used in</strong>\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t{node.usedIn.map((f) => (\n\t\t\t\t\t\t\t\t\t\t<li key={f.componentPath}>\n\t\t\t\t\t\t\t\t\t\t\t<code>{f.componentPath}</code>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</details>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;AAGA,MAAM,cAAc;AAEpB,SAAgB,YAAY;CAC3B,MAAM,CAAC,OAAO,gCAAmC,KAAK;CACtD,MAAM,CAAC,GAAG,4BAAiB,GAAG;CAC9B,MAAM,CAAC,KAAK,8BAAkC,KAAK;AAEnD,4BAAgB;EACf,IAAI,QAAQ;AACX,GAAC,YAAY;AACb,OAAI;IACH,MAAM,MAAM,MAAM,MAAM,YAAY;AACpC,QAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,QAAQ,IAAI,SAAS;IAClD,MAAM,OAAQ,MAAM,IAAI,MAAM;AAC9B,QAAI,MAAO,UAAS,KAAK;YACjB,GAAQ;AAChB,QAAI,MAAO,QAAO,GAAG,WAAW,OAAO,EAAE,CAAC;;MAExC;AACJ,eAAa;AACZ,WAAQ;;IAEP,EAAE,CAAC;AAEN,KAAI,IAAK,QAAO,4CAAC,kBAAE,wCAAqC,OAAQ;AAChE,KAAI,CAAC,MAAO,QAAO,2CAAC,iBAAE,8BAA6B;CAEnD,MAAM,UAAU,OAAO,QAAQ,MAAM,CACnC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAC1D,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;AAExC,QACC,4CAAC;EAAI,OAAO;GAAE,SAAS;GAAI,SAAS;GAAQ,KAAK;GAAI;;GACpD,2CAAC;IACA,aAAY;IACZ,OAAO;IACP,WAAW,MAAM,KAAK,EAAE,OAAO,MAAM;IACrC,OAAO;KAAE,SAAS;KAAG,MAAM;KAAW;KACrC;GACF,4CAAC;IAAI,OAAO;KAAE,UAAU;KAAI,SAAS;KAAK;;KACxC,QAAQ;KAAO;KAAK,OAAO,KAAK,MAAM,CAAC;KAAO;;KAC1C;GACN,2CAAC;IAAI,OAAO;KAAE,SAAS;KAAQ,KAAK;KAAI;cACtC,QAAQ,KAAK,CAAC,MAAM,UACpB,4CAAC,wBACA,2CAAC,uBACA,2CAAC,oBAAM,OAAY,GACV,EACV,4CAAC;KACA,OAAO;MACN,SAAS;MACT,KAAK;MACL,SAAS;MACT;gBAED,4CAAC,oBACA,2CAAC,sBAAO,eAAmB,EAC3B,2CAAC,kBACC,KAAK,UAAU,KAAK,MACpB,2CAAC,kBACA,2CAAC,oBAAM,EAAE,gBAAqB,IADtB,EAAE,cAEN,CACJ,GACE,IACA,EACN,4CAAC,oBACA,2CAAC,sBAAO,YAAgB,EACxB,2CAAC,kBACC,KAAK,OAAO,KAAK,MACjB,2CAAC,kBACA,2CAAC,oBAAM,EAAE,gBAAqB,IADtB,EAAE,cAEN,CACJ,GACE,IACA;MACD,KA/BO,KAgCJ,CACT;KACG;;GACD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/panels/GraphView.tsx
|
|
5
|
+
const DEFAULT_URL = "/dependency-previews.json";
|
|
6
|
+
function GraphView() {
|
|
7
|
+
const [graph, setGraph] = useState(null);
|
|
8
|
+
const [q, setQ] = useState("");
|
|
9
|
+
const [err, setErr] = useState(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
let alive = true;
|
|
12
|
+
(async () => {
|
|
13
|
+
try {
|
|
14
|
+
const res = await fetch(DEFAULT_URL);
|
|
15
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
16
|
+
const json = await res.json();
|
|
17
|
+
if (alive) setGraph(json);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
if (alive) setErr(e?.message || String(e));
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
return () => {
|
|
23
|
+
alive = false;
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
if (err) return /* @__PURE__ */ jsxs("p", { children: ["Failed to load dependency previews: ", err] });
|
|
27
|
+
if (!graph) return /* @__PURE__ */ jsx("p", { children: "Loading dependency graph…" });
|
|
28
|
+
const entries = Object.entries(graph).filter(([k]) => k.toLowerCase().includes(q.toLowerCase())).sort(([a], [b]) => a.localeCompare(b));
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
style: {
|
|
31
|
+
padding: 12,
|
|
32
|
+
display: "grid",
|
|
33
|
+
gap: 12
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("input", {
|
|
37
|
+
placeholder: "Filter by file path",
|
|
38
|
+
value: q,
|
|
39
|
+
onChange: (e) => setQ(e.target.value),
|
|
40
|
+
style: {
|
|
41
|
+
padding: 6,
|
|
42
|
+
font: "inherit"
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", {
|
|
46
|
+
style: {
|
|
47
|
+
fontSize: 12,
|
|
48
|
+
opacity: .7
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
entries.length,
|
|
52
|
+
" of ",
|
|
53
|
+
Object.keys(graph).length,
|
|
54
|
+
" components"
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("div", {
|
|
58
|
+
style: {
|
|
59
|
+
display: "grid",
|
|
60
|
+
gap: 10
|
|
61
|
+
},
|
|
62
|
+
children: entries.map(([file, node]) => /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", { children: /* @__PURE__ */ jsx("code", { children: file }) }), /* @__PURE__ */ jsxs("div", {
|
|
63
|
+
style: {
|
|
64
|
+
display: "grid",
|
|
65
|
+
gap: 6,
|
|
66
|
+
padding: "6px 0 0"
|
|
67
|
+
},
|
|
68
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: "Built with" }), /* @__PURE__ */ jsx("ul", { children: node.builtWith.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("code", { children: f.componentPath }) }, f.componentPath)) })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: "Used in" }), /* @__PURE__ */ jsx("ul", { children: node.usedIn.map((f) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("code", { children: f.componentPath }) }, f.componentPath)) })] })]
|
|
69
|
+
})] }, file))
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { GraphView };
|
|
77
|
+
//# sourceMappingURL=GraphView.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphView.mjs","names":[],"sources":["../../src/panels/GraphView.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { Graph } from '../types'\n\nconst DEFAULT_URL = '/dependency-previews.json'\n\nexport function GraphView() {\n\tconst [graph, setGraph] = useState<Graph | null>(null)\n\tconst [q, setQ] = useState('')\n\tconst [err, setErr] = useState<string | null>(null)\n\n\tuseEffect(() => {\n\t\tlet alive = true\n\t\t;(async () => {\n\t\t\ttry {\n\t\t\t\tconst res = await fetch(DEFAULT_URL)\n\t\t\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`)\n\t\t\t\tconst json = (await res.json()) as Graph\n\t\t\t\tif (alive) setGraph(json)\n\t\t\t} catch (e: any) {\n\t\t\t\tif (alive) setErr(e?.message || String(e))\n\t\t\t}\n\t\t})()\n\t\treturn () => {\n\t\t\talive = false\n\t\t}\n\t}, [])\n\n\tif (err) return <p>Failed to load dependency previews: {err}</p>\n\tif (!graph) return <p>Loading dependency graph…</p>\n\n\tconst entries = Object.entries(graph)\n\t\t.filter(([k]) => k.toLowerCase().includes(q.toLowerCase()))\n\t\t.sort(([a], [b]) => a.localeCompare(b))\n\n\treturn (\n\t\t<div style={{ padding: 12, display: 'grid', gap: 12 }}>\n\t\t\t<input\n\t\t\t\tplaceholder=\"Filter by file path\"\n\t\t\t\tvalue={q}\n\t\t\t\tonChange={(e) => setQ(e.target.value)}\n\t\t\t\tstyle={{ padding: 6, font: 'inherit' }}\n\t\t\t/>\n\t\t\t<div style={{ fontSize: 12, opacity: 0.7 }}>\n\t\t\t\t{entries.length} of {Object.keys(graph).length} components\n\t\t\t</div>\n\t\t\t<div style={{ display: 'grid', gap: 10 }}>\n\t\t\t\t{entries.map(([file, node]) => (\n\t\t\t\t\t<details key={file}>\n\t\t\t\t\t\t<summary>\n\t\t\t\t\t\t\t<code>{file}</code>\n\t\t\t\t\t\t</summary>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'grid',\n\t\t\t\t\t\t\t\tgap: 6,\n\t\t\t\t\t\t\t\tpadding: '6px 0 0',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<strong>Built with</strong>\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t{node.builtWith.map((f) => (\n\t\t\t\t\t\t\t\t\t\t<li key={f.componentPath}>\n\t\t\t\t\t\t\t\t\t\t\t<code>{f.componentPath}</code>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<strong>Used in</strong>\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t{node.usedIn.map((f) => (\n\t\t\t\t\t\t\t\t\t\t<li key={f.componentPath}>\n\t\t\t\t\t\t\t\t\t\t\t<code>{f.componentPath}</code>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</details>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;AAGA,MAAM,cAAc;AAEpB,SAAgB,YAAY;CAC3B,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,GAAG,QAAQ,SAAS,GAAG;CAC9B,MAAM,CAAC,KAAK,UAAU,SAAwB,KAAK;AAEnD,iBAAgB;EACf,IAAI,QAAQ;AACX,GAAC,YAAY;AACb,OAAI;IACH,MAAM,MAAM,MAAM,MAAM,YAAY;AACpC,QAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,QAAQ,IAAI,SAAS;IAClD,MAAM,OAAQ,MAAM,IAAI,MAAM;AAC9B,QAAI,MAAO,UAAS,KAAK;YACjB,GAAQ;AAChB,QAAI,MAAO,QAAO,GAAG,WAAW,OAAO,EAAE,CAAC;;MAExC;AACJ,eAAa;AACZ,WAAQ;;IAEP,EAAE,CAAC;AAEN,KAAI,IAAK,QAAO,qBAAC,kBAAE,wCAAqC,OAAQ;AAChE,KAAI,CAAC,MAAO,QAAO,oBAAC,iBAAE,8BAA6B;CAEnD,MAAM,UAAU,OAAO,QAAQ,MAAM,CACnC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAC1D,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;AAExC,QACC,qBAAC;EAAI,OAAO;GAAE,SAAS;GAAI,SAAS;GAAQ,KAAK;GAAI;;GACpD,oBAAC;IACA,aAAY;IACZ,OAAO;IACP,WAAW,MAAM,KAAK,EAAE,OAAO,MAAM;IACrC,OAAO;KAAE,SAAS;KAAG,MAAM;KAAW;KACrC;GACF,qBAAC;IAAI,OAAO;KAAE,UAAU;KAAI,SAAS;KAAK;;KACxC,QAAQ;KAAO;KAAK,OAAO,KAAK,MAAM,CAAC;KAAO;;KAC1C;GACN,oBAAC;IAAI,OAAO;KAAE,SAAS;KAAQ,KAAK;KAAI;cACtC,QAAQ,KAAK,CAAC,MAAM,UACpB,qBAAC,wBACA,oBAAC,uBACA,oBAAC,oBAAM,OAAY,GACV,EACV,qBAAC;KACA,OAAO;MACN,SAAS;MACT,KAAK;MACL,SAAS;MACT;gBAED,qBAAC,oBACA,oBAAC,sBAAO,eAAmB,EAC3B,oBAAC,kBACC,KAAK,UAAU,KAAK,MACpB,oBAAC,kBACA,oBAAC,oBAAM,EAAE,gBAAqB,IADtB,EAAE,cAEN,CACJ,GACE,IACA,EACN,qBAAC,oBACA,oBAAC,sBAAO,YAAgB,EACxB,oBAAC,kBACC,KAAK,OAAO,KAAK,MACjB,oBAAC,kBACA,oBAAC,oBAAM,EAAE,gBAAqB,IADtB,EAAE,cAEN,CACJ,GACE,IACA;MACD,KA/BO,KAgCJ,CACT;KACG;;GACD"}
|
package/dist/preview.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
require("@iframe-resizer/child");
|
|
5
|
+
|
|
6
|
+
//#region src/preview.tsx
|
|
7
|
+
const decorators = [(Story) => {
|
|
8
|
+
const ref = (0, react.useRef)(null);
|
|
9
|
+
(0, react.useEffect)(() => {
|
|
10
|
+
ref.current?.parentElement?.setAttribute("data-iframe-size", "true");
|
|
11
|
+
}, []);
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
13
|
+
className: "iframe-size-child",
|
|
14
|
+
ref,
|
|
15
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Story, {})
|
|
16
|
+
});
|
|
17
|
+
}];
|
|
18
|
+
const dependencyPreviewDecorators = decorators;
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.decorators = decorators;
|
|
22
|
+
exports.dependencyPreviewDecorators = dependencyPreviewDecorators;
|
|
23
|
+
//# sourceMappingURL=preview.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.cjs","names":[],"sources":["../src/preview.tsx"],"sourcesContent":["// This runs in the Storybook preview (the iframe)\nimport '@iframe-resizer/child'\nimport { useEffect, useRef } from 'react'\nimport type { PartialStoryFn } from 'storybook/internal/csf'\n\nexport const decorators = [\n\t(Story: PartialStoryFn) => {\n\t\tconst ref = useRef<HTMLDivElement>(null)\n\n\t\tuseEffect(() => {\n\t\t\tref.current?.parentElement?.setAttribute('data-iframe-size', 'true')\n\t\t}, [])\n\n\t\treturn (\n\t\t\t<div className=\"iframe-size-child\" ref={ref}>\n\t\t\t\t<Story />\n\t\t\t</div>\n\t\t)\n\t},\n]\n\nexport const dependencyPreviewDecorators = decorators\n"],"mappings":";;;;;;AAKA,MAAa,aAAa,EACxB,UAA0B;CAC1B,MAAM,wBAA6B,KAAK;AAExC,4BAAgB;AACf,MAAI,SAAS,eAAe,aAAa,oBAAoB,OAAO;IAClE,EAAE,CAAC;AAEN,QACC,2CAAC;EAAI,WAAU;EAAyB;YACvC,2CAAC,UAAQ;GACJ;EAGR;AAED,MAAa,8BAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { PartialStoryFn } from "storybook/internal/csf";
|
|
3
|
+
|
|
4
|
+
//#region src/preview.d.ts
|
|
5
|
+
declare const decorators: ((Story: PartialStoryFn) => react_jsx_runtime0.JSX.Element)[];
|
|
6
|
+
declare const dependencyPreviewDecorators: ((Story: PartialStoryFn) => react_jsx_runtime0.JSX.Element)[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { decorators, dependencyPreviewDecorators };
|
|
9
|
+
//# sourceMappingURL=preview.d.cts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import "@iframe-resizer/child";
|
|
3
|
+
import { PartialStoryFn } from "storybook/internal/csf";
|
|
4
|
+
|
|
5
|
+
//#region src/preview.d.ts
|
|
6
|
+
declare const decorators: ((Story: PartialStoryFn) => react_jsx_runtime0.JSX.Element)[];
|
|
7
|
+
declare const dependencyPreviewDecorators: ((Story: PartialStoryFn) => react_jsx_runtime0.JSX.Element)[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { decorators, dependencyPreviewDecorators };
|
|
10
|
+
//# sourceMappingURL=preview.d.mts.map
|
package/dist/preview.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "@iframe-resizer/child";
|
|
4
|
+
|
|
5
|
+
//#region src/preview.tsx
|
|
6
|
+
const decorators = [(Story) => {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
ref.current?.parentElement?.setAttribute("data-iframe-size", "true");
|
|
10
|
+
}, []);
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: "iframe-size-child",
|
|
13
|
+
ref,
|
|
14
|
+
children: /* @__PURE__ */ jsx(Story, {})
|
|
15
|
+
});
|
|
16
|
+
}];
|
|
17
|
+
const dependencyPreviewDecorators = decorators;
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { decorators, dependencyPreviewDecorators };
|
|
21
|
+
//# sourceMappingURL=preview.mjs.map
|