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 @@
|
|
|
1
|
+
{"version":3,"file":"Expandable.mjs","names":[],"sources":["../../src/components/Expandable.tsx"],"sourcesContent":["import { useState, type ReactNode } from 'react'\nimport s from './Expandable.module.css'\nimport { DoubleChevronDown } from './icons/DoubleChevronDown'\nimport { X } from './icons/X'\nimport type { IconComponent } from './icons/iconTypes'\n\ninterface PropsForExpandable {\n\tHeader: ReactNode\n\tchildren: ReactNode\n\tIcon: IconComponent\n\tonToggle?: (toggleState: boolean) => void\n}\nexport function Expandable({\n\tonToggle,\n\tHeader,\n\tchildren,\n\tIcon,\n}: PropsForExpandable) {\n\tconst [isOpen, setIsOpen] = useState(false)\n\n\treturn (\n\t\t<details\n\t\t\tclassName={s.container}\n\t\t\tonToggle={(e) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst isTogglingToOpen = e.currentTarget.open\n\t\t\t\tconst isAnimationSupported =\n\t\t\t\t\tCSS.supports('interpolate-size', 'allow-keywords') &&\n\t\t\t\t\tCSS.supports('transition-behavior', 'allow-discrete')\n\t\t\t\tonToggle?.(isTogglingToOpen)\n\n\t\t\t\t// since we unmount on close we need to delay the unmount when the accordion is closing\n\t\t\t\tif (isAnimationSupported) {\n\t\t\t\t\tif (isTogglingToOpen) {\n\t\t\t\t\t\tsetIsOpen(isTogglingToOpen)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tsetIsOpen(isTogglingToOpen)\n\t\t\t\t\t\t}, 0.3 * 1000)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsetIsOpen(isTogglingToOpen)\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<summary className={s.header}>\n\t\t\t\t{/* Need to handle show/hide of icons with CSS since isOpen has a delay on close */}\n\t\t\t\t<Icon className={`${s.icon}`} />\n\t\t\t\t<div className={s.headContent}>{Header}</div>\n\t\t\t\t<DoubleChevronDown className={`${s.icon} ${s.OpenIcon}`} />\n\t\t\t\t<X className={`${s.icon} ${s.CloseIcon}`} />\n\t\t\t</summary>\n\t\t\t{isOpen && <div className={s.body}>{children}</div>}\n\t\t</details>\n\t)\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,WAAW,EAC1B,UACA,QACA,UACA,QACsB;CACtB,MAAM,CAAC,QAAQ,aAAa,SAAS,MAAM;AAE3C,QACC,qBAAC;EACA,WAAW,EAAE;EACb,WAAW,MAAM;AAChB,KAAE,iBAAiB;GACnB,MAAM,mBAAmB,EAAE,cAAc;GACzC,MAAM,uBACL,IAAI,SAAS,oBAAoB,iBAAiB,IAClD,IAAI,SAAS,uBAAuB,iBAAiB;AACtD,cAAW,iBAAiB;AAG5B,OAAI,sBAAsB;AACzB,QAAI,kBAAkB;AACrB,eAAU,iBAAiB;WACrB;AACN,sBAAiB;AAChB,gBAAU,iBAAiB;QACzB,KAAM,IAAK;;UAET;AACN,cAAU,iBAAiB;;;aAI7B,qBAAC;GAAQ,WAAW,EAAE;;IAErB,oBAAC,QAAK,WAAW,GAAG,EAAE,SAAU;IAChC,oBAAC;KAAI,WAAW,EAAE;eAAc;MAAa;IAC7C,oBAAC,qBAAkB,WAAW,GAAG,EAAE,KAAK,GAAG,EAAE,aAAc;IAC3D,oBAAC,KAAE,WAAW,GAAG,EAAE,KAAK,GAAG,EAAE,cAAe;;IACnC,EACT,UAAU,oBAAC;GAAI,WAAW,EAAE;GAAO;IAAe;GAC1C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
border: 1px solid var(--sb-outline-color, rgba(0, 0, 0, 0.1));
|
|
3
|
+
border-radius: 6px;
|
|
4
|
+
background: var(--sb-bg1, #fff);
|
|
5
|
+
margin: 0.5rem 0;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
&:first-child {
|
|
9
|
+
margin-top: 0;
|
|
10
|
+
}
|
|
11
|
+
&:last-child {
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&::details-content {
|
|
16
|
+
@supports (interpolate-size: allow-keywords) and
|
|
17
|
+
(transition-behavior: allow-discrete) {
|
|
18
|
+
block-size: 0;
|
|
19
|
+
transition:
|
|
20
|
+
block-size 0.3s,
|
|
21
|
+
content-visibility 0.3s;
|
|
22
|
+
transition-behavior: allow-discrete;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&[open] {
|
|
27
|
+
background: var(--sb-bg2, #f8f9fa);
|
|
28
|
+
|
|
29
|
+
& > .header > .icon {
|
|
30
|
+
&.XIcon {
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&::details-content {
|
|
36
|
+
@supports (interpolate-size: allow-keywords) and
|
|
37
|
+
(transition-behavior: allow-discrete) {
|
|
38
|
+
block-size: auto;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.container > .header > .icon {
|
|
45
|
+
&.OpenIcon,
|
|
46
|
+
&.CloseIcon {
|
|
47
|
+
display: none;
|
|
48
|
+
margin-left: auto;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.container:not([open]) {
|
|
52
|
+
& > .header > .icon {
|
|
53
|
+
&.OpenIcon {
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
.container[open] {
|
|
59
|
+
& > .header > .icon {
|
|
60
|
+
&.CloseIcon {
|
|
61
|
+
display: block;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.header {
|
|
67
|
+
list-style: none;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
padding: 0.5rem 0.75rem;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
font-size: 0.9rem;
|
|
72
|
+
color: var(--sb-text-color, #333);
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 0.5em;
|
|
76
|
+
|
|
77
|
+
&:hover,
|
|
78
|
+
&:focus-visible {
|
|
79
|
+
background: var(--sb-bg3, #edeff0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
& h2 {
|
|
83
|
+
border: 0;
|
|
84
|
+
padding: 0;
|
|
85
|
+
margin: 0;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&::-webkit-details-marker {
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.icon {
|
|
95
|
+
height: 1.5em;
|
|
96
|
+
width: 1.5em;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.body {
|
|
100
|
+
padding: 1em;
|
|
101
|
+
background-color: var(--sb-bg1, #fff);
|
|
102
|
+
border-top: 1px solid var(--sb-outline-color, rgba(0, 0, 0, 0.1));
|
|
103
|
+
|
|
104
|
+
& > ul,
|
|
105
|
+
& > div > ul {
|
|
106
|
+
list-style: none;
|
|
107
|
+
padding: 0;
|
|
108
|
+
margin: 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_runtime.__toESM(react);
|
|
4
|
+
let _iframe_resizer_react = require("@iframe-resizer/react");
|
|
5
|
+
_iframe_resizer_react = require_runtime.__toESM(_iframe_resizer_react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/FullParityStory.tsx
|
|
9
|
+
const toCanvasId = (id) => id.endsWith("--docs") ? id.replace(/--docs$/, "--primary") : id;
|
|
10
|
+
const enc = (obj) => obj && Object.keys(obj).length ? encodeURIComponent(JSON.stringify(obj)) : "";
|
|
11
|
+
function FullParityStory({ storyId, args, globals, className, onLoad }) {
|
|
12
|
+
const canvasId = react.useMemo(() => toCanvasId(storyId), [storyId]);
|
|
13
|
+
const src = react.useMemo(() => {
|
|
14
|
+
const a = enc(args);
|
|
15
|
+
const g = enc(globals);
|
|
16
|
+
const qs = [
|
|
17
|
+
`id=${canvasId}`,
|
|
18
|
+
"viewMode=story",
|
|
19
|
+
a && `args=${a}`,
|
|
20
|
+
g && `globals=${g}`
|
|
21
|
+
].filter(Boolean).join("&");
|
|
22
|
+
return `iframe.html?${qs}`;
|
|
23
|
+
}, [
|
|
24
|
+
canvasId,
|
|
25
|
+
args,
|
|
26
|
+
globals
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_iframe_resizer_react.default, {
|
|
29
|
+
title: canvasId,
|
|
30
|
+
license: "GPLv3",
|
|
31
|
+
log: "collapsed",
|
|
32
|
+
src,
|
|
33
|
+
loading: "lazy",
|
|
34
|
+
className,
|
|
35
|
+
onLoad,
|
|
36
|
+
style: {
|
|
37
|
+
width: "100%",
|
|
38
|
+
border: "1px solid var(--sb-border-color, #e5e7eb)",
|
|
39
|
+
borderRadius: 8,
|
|
40
|
+
background: "transparent"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.FullParityStory = FullParityStory;
|
|
47
|
+
//# sourceMappingURL=FullParityStory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullParityStory.cjs","names":["React","IframeResizer"],"sources":["../../src/components/FullParityStory.tsx"],"sourcesContent":["// FullParityStory.tsx — preview-only, no Storybook UI\nimport IframeResizer from '@iframe-resizer/react'\nimport * as React from 'react'\n\ntype Props = {\n\t/** docs id like \"...--docs\" or a canvas id like \"...--primary\" */\n\tstoryId: string\n\targs?: Record<string, unknown>\n\tglobals?: Record<string, unknown>\n\tclassName?: string\n\tonLoad?: () => void\n}\n\nconst toCanvasId = (id: string) =>\n\tid.endsWith('--docs') ? id.replace(/--docs$/, '--primary') : id\n\nconst enc = (obj?: Record<string, unknown>) =>\n\tobj && Object.keys(obj).length\n\t\t? encodeURIComponent(JSON.stringify(obj))\n\t\t: ''\n\nexport function FullParityStory({\n\tstoryId,\n\targs,\n\tglobals,\n\tclassName,\n\tonLoad,\n}: Props) {\n\tconst canvasId = React.useMemo(() => toCanvasId(storyId), [storyId])\n\n\tconst src = React.useMemo(() => {\n\t\t// ⚠️ This is the preview-only route, no manager UI\n\t\tconst a = enc(args)\n\t\tconst g = enc(globals)\n\t\tconst qs = [\n\t\t\t`id=${canvasId}`,\n\t\t\t'viewMode=story',\n\t\t\ta && `args=${a}`,\n\t\t\tg && `globals=${g}`,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('&')\n\t\treturn `iframe.html?${qs}`\n\t}, [canvasId, args, globals])\n\n\treturn (\n\t\t<IframeResizer\n\t\t\ttitle={canvasId}\n\t\t\tlicense=\"GPLv3\"\n\t\t\tlog=\"collapsed\"\n\t\t\tsrc={src}\n\t\t\tloading=\"lazy\"\n\t\t\tclassName={className}\n\t\t\tonLoad={onLoad}\n\t\t\tstyle={{\n\t\t\t\twidth: '100%',\n\t\t\t\tborder: '1px solid var(--sb-border-color, #e5e7eb)',\n\t\t\t\tborderRadius: 8,\n\t\t\t\tbackground: 'transparent',\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,cAAc,OACnB,GAAG,SAAS,SAAS,GAAG,GAAG,QAAQ,WAAW,YAAY,GAAG;AAE9D,MAAM,OAAO,QACZ,OAAO,OAAO,KAAK,IAAI,CAAC,SACrB,mBAAmB,KAAK,UAAU,IAAI,CAAC,GACvC;AAEJ,SAAgB,gBAAgB,EAC/B,SACA,MACA,SACA,WACA,UACS;CACT,MAAM,WAAWA,MAAM,cAAc,WAAW,QAAQ,EAAE,CAAC,QAAQ,CAAC;CAEpE,MAAM,MAAMA,MAAM,cAAc;EAE/B,MAAM,IAAI,IAAI,KAAK;EACnB,MAAM,IAAI,IAAI,QAAQ;EACtB,MAAM,KAAK;GACV,MAAM;GACN;GACA,KAAK,QAAQ;GACb,KAAK,WAAW;GAChB,CACC,OAAO,QAAQ,CACf,KAAK,IAAI;AACX,SAAO,eAAe;IACpB;EAAC;EAAU;EAAM;EAAQ,CAAC;AAE7B,QACC,2CAACC;EACA,OAAO;EACP,SAAQ;EACR,KAAI;EACC;EACL,SAAQ;EACG;EACH;EACR,OAAO;GACN,OAAO;GACP,QAAQ;GACR,cAAc;GACd,YAAY;GACZ;GACA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import IframeResizer from "@iframe-resizer/react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/FullParityStory.tsx
|
|
6
|
+
const toCanvasId = (id) => id.endsWith("--docs") ? id.replace(/--docs$/, "--primary") : id;
|
|
7
|
+
const enc = (obj) => obj && Object.keys(obj).length ? encodeURIComponent(JSON.stringify(obj)) : "";
|
|
8
|
+
function FullParityStory({ storyId, args, globals, className, onLoad }) {
|
|
9
|
+
const canvasId = React.useMemo(() => toCanvasId(storyId), [storyId]);
|
|
10
|
+
const src = React.useMemo(() => {
|
|
11
|
+
const a = enc(args);
|
|
12
|
+
const g = enc(globals);
|
|
13
|
+
const qs = [
|
|
14
|
+
`id=${canvasId}`,
|
|
15
|
+
"viewMode=story",
|
|
16
|
+
a && `args=${a}`,
|
|
17
|
+
g && `globals=${g}`
|
|
18
|
+
].filter(Boolean).join("&");
|
|
19
|
+
return `iframe.html?${qs}`;
|
|
20
|
+
}, [
|
|
21
|
+
canvasId,
|
|
22
|
+
args,
|
|
23
|
+
globals
|
|
24
|
+
]);
|
|
25
|
+
return /* @__PURE__ */ jsx(IframeResizer, {
|
|
26
|
+
title: canvasId,
|
|
27
|
+
license: "GPLv3",
|
|
28
|
+
log: "collapsed",
|
|
29
|
+
src,
|
|
30
|
+
loading: "lazy",
|
|
31
|
+
className,
|
|
32
|
+
onLoad,
|
|
33
|
+
style: {
|
|
34
|
+
width: "100%",
|
|
35
|
+
border: "1px solid var(--sb-border-color, #e5e7eb)",
|
|
36
|
+
borderRadius: 8,
|
|
37
|
+
background: "transparent"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FullParityStory };
|
|
44
|
+
//# sourceMappingURL=FullParityStory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullParityStory.mjs","names":[],"sources":["../../src/components/FullParityStory.tsx"],"sourcesContent":["// FullParityStory.tsx — preview-only, no Storybook UI\nimport IframeResizer from '@iframe-resizer/react'\nimport * as React from 'react'\n\ntype Props = {\n\t/** docs id like \"...--docs\" or a canvas id like \"...--primary\" */\n\tstoryId: string\n\targs?: Record<string, unknown>\n\tglobals?: Record<string, unknown>\n\tclassName?: string\n\tonLoad?: () => void\n}\n\nconst toCanvasId = (id: string) =>\n\tid.endsWith('--docs') ? id.replace(/--docs$/, '--primary') : id\n\nconst enc = (obj?: Record<string, unknown>) =>\n\tobj && Object.keys(obj).length\n\t\t? encodeURIComponent(JSON.stringify(obj))\n\t\t: ''\n\nexport function FullParityStory({\n\tstoryId,\n\targs,\n\tglobals,\n\tclassName,\n\tonLoad,\n}: Props) {\n\tconst canvasId = React.useMemo(() => toCanvasId(storyId), [storyId])\n\n\tconst src = React.useMemo(() => {\n\t\t// ⚠️ This is the preview-only route, no manager UI\n\t\tconst a = enc(args)\n\t\tconst g = enc(globals)\n\t\tconst qs = [\n\t\t\t`id=${canvasId}`,\n\t\t\t'viewMode=story',\n\t\t\ta && `args=${a}`,\n\t\t\tg && `globals=${g}`,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('&')\n\t\treturn `iframe.html?${qs}`\n\t}, [canvasId, args, globals])\n\n\treturn (\n\t\t<IframeResizer\n\t\t\ttitle={canvasId}\n\t\t\tlicense=\"GPLv3\"\n\t\t\tlog=\"collapsed\"\n\t\t\tsrc={src}\n\t\t\tloading=\"lazy\"\n\t\t\tclassName={className}\n\t\t\tonLoad={onLoad}\n\t\t\tstyle={{\n\t\t\t\twidth: '100%',\n\t\t\t\tborder: '1px solid var(--sb-border-color, #e5e7eb)',\n\t\t\t\tborderRadius: 8,\n\t\t\t\tbackground: 'transparent',\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;AAaA,MAAM,cAAc,OACnB,GAAG,SAAS,SAAS,GAAG,GAAG,QAAQ,WAAW,YAAY,GAAG;AAE9D,MAAM,OAAO,QACZ,OAAO,OAAO,KAAK,IAAI,CAAC,SACrB,mBAAmB,KAAK,UAAU,IAAI,CAAC,GACvC;AAEJ,SAAgB,gBAAgB,EAC/B,SACA,MACA,SACA,WACA,UACS;CACT,MAAM,WAAW,MAAM,cAAc,WAAW,QAAQ,EAAE,CAAC,QAAQ,CAAC;CAEpE,MAAM,MAAM,MAAM,cAAc;EAE/B,MAAM,IAAI,IAAI,KAAK;EACnB,MAAM,IAAI,IAAI,QAAQ;EACtB,MAAM,KAAK;GACV,MAAM;GACN;GACA,KAAK,QAAQ;GACb,KAAK,WAAW;GAChB,CACC,OAAO,QAAQ,CACf,KAAK,IAAI;AACX,SAAO,eAAe;IACpB;EAAC;EAAU;EAAM;EAAQ,CAAC;AAE7B,QACC,oBAAC;EACA,OAAO;EACP,SAAQ;EACR,KAAI;EACC;EACL,SAAQ;EACG;EACH;EACR,OAAO;GACN,OAAO;GACP,QAAQ;GACR,cAAc;GACd,YAAY;GACZ;GACA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_CopyButton = require('./CopyButton.cjs');
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let src_components_PathCopyMolecule_module_css = require("./PathCopyMolecule.module.css");
|
|
5
|
+
src_components_PathCopyMolecule_module_css = require_runtime.__toESM(src_components_PathCopyMolecule_module_css);
|
|
6
|
+
|
|
7
|
+
//#region src/components/PathCopyMolecule.tsx
|
|
8
|
+
function PathCopyMolecule({ label, copyLabel = `Copy ${label} to clipboard`, copyMessage = `Copied ${label}!`, copyContent, children }) {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
10
|
+
className: src_components_PathCopyMolecule_module_css.default.pathDataItem,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("strong", { children: [label, ": "] }),
|
|
13
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
|
|
14
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
15
|
+
className: src_components_PathCopyMolecule_module_css.default.pathLinkWrapper,
|
|
16
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CopyButton.CopyButton, {
|
|
17
|
+
label: copyLabel,
|
|
18
|
+
copyMessage,
|
|
19
|
+
copyContent
|
|
20
|
+
}), children]
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.PathCopyMolecule = PathCopyMolecule;
|
|
28
|
+
//# sourceMappingURL=PathCopyMolecule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PathCopyMolecule.cjs","names":["s","CopyButton"],"sources":["../../src/components/PathCopyMolecule.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { CopyButton } from './CopyButton'\nimport s from './PathCopyMolecule.module.css'\n\ninterface Props {\n\tlabel: string\n\tcopyContent: string\n\tchildren: ReactNode\n\tcopyLabel?: string\n\tcopyMessage?: string\n}\n\nexport function PathCopyMolecule({\n\tlabel,\n\tcopyLabel = `Copy ${label} to clipboard`,\n\tcopyMessage = `Copied ${label}!`,\n\tcopyContent,\n\tchildren,\n}: Props) {\n\treturn (\n\t\t<p className={s.pathDataItem}>\n\t\t\t<strong>{label}: </strong>\n\t\t\t<br />\n\t\t\t<span className={s.pathLinkWrapper}>\n\t\t\t\t<CopyButton\n\t\t\t\t\tlabel={copyLabel}\n\t\t\t\t\tcopyMessage={copyMessage}\n\t\t\t\t\tcopyContent={copyContent}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t</p>\n\t)\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,iBAAiB,EAChC,OACA,YAAY,QAAQ,MAAM,gBAC1B,cAAc,UAAU,MAAM,IAC9B,aACA,YACS;AACT,QACC,4CAAC;EAAE,WAAWA,mDAAE;;GACf,4CAAC,uBAAQ,OAAM,QAAW;GAC1B,2CAAC,SAAK;GACN,4CAAC;IAAK,WAAWA,mDAAE;eAClB,2CAACC;KACA,OAAO;KACM;KACA;MACZ,EACD;KACK;;GACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CopyButton } from "./CopyButton.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import s from "./PathCopyMolecule.module.css";
|
|
4
|
+
|
|
5
|
+
//#region src/components/PathCopyMolecule.tsx
|
|
6
|
+
function PathCopyMolecule({ label, copyLabel = `Copy ${label} to clipboard`, copyMessage = `Copied ${label}!`, copyContent, children }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
8
|
+
className: s.pathDataItem,
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("strong", { children: [label, ": "] }),
|
|
11
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
12
|
+
/* @__PURE__ */ jsxs("span", {
|
|
13
|
+
className: s.pathLinkWrapper,
|
|
14
|
+
children: [/* @__PURE__ */ jsx(CopyButton, {
|
|
15
|
+
label: copyLabel,
|
|
16
|
+
copyMessage,
|
|
17
|
+
copyContent
|
|
18
|
+
}), children]
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { PathCopyMolecule };
|
|
26
|
+
//# sourceMappingURL=PathCopyMolecule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PathCopyMolecule.mjs","names":[],"sources":["../../src/components/PathCopyMolecule.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { CopyButton } from './CopyButton'\nimport s from './PathCopyMolecule.module.css'\n\ninterface Props {\n\tlabel: string\n\tcopyContent: string\n\tchildren: ReactNode\n\tcopyLabel?: string\n\tcopyMessage?: string\n}\n\nexport function PathCopyMolecule({\n\tlabel,\n\tcopyLabel = `Copy ${label} to clipboard`,\n\tcopyMessage = `Copied ${label}!`,\n\tcopyContent,\n\tchildren,\n}: Props) {\n\treturn (\n\t\t<p className={s.pathDataItem}>\n\t\t\t<strong>{label}: </strong>\n\t\t\t<br />\n\t\t\t<span className={s.pathLinkWrapper}>\n\t\t\t\t<CopyButton\n\t\t\t\t\tlabel={copyLabel}\n\t\t\t\t\tcopyMessage={copyMessage}\n\t\t\t\t\tcopyContent={copyContent}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t</p>\n\t)\n}\n"],"mappings":";;;;;AAYA,SAAgB,iBAAiB,EAChC,OACA,YAAY,QAAQ,MAAM,gBAC1B,cAAc,UAAU,MAAM,IAC9B,aACA,YACS;AACT,QACC,qBAAC;EAAE,WAAW,EAAE;;GACf,qBAAC,uBAAQ,OAAM,QAAW;GAC1B,oBAAC,SAAK;GACN,qBAAC;IAAK,WAAW,EAAE;eAClB,oBAAC;KACA,OAAO;KACM;KACA;MACZ,EACD;KACK;;GACJ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_useDynamicStory = require('../hooks/useDynamicStory.cjs');
|
|
3
|
+
const require_FullParityStory = require('./FullParityStory.cjs');
|
|
4
|
+
const require_LoadingRipples = require('./icons/LoadingRipples.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/PrimaryPreview.tsx
|
|
9
|
+
function PrimaryPreview({ storyInfo }) {
|
|
10
|
+
const [hasLoaded, setHasLoaded] = (0, react.useState)(false);
|
|
11
|
+
const { csfModule, primaryExport, primaryId, error, isLoading } = require_useDynamicStory.useDynamicStory(storyInfo);
|
|
12
|
+
const message = error || isLoading && "Loading preview…" || !csfModule && "Module could not be loaded." || !primaryExport && "No story export found.";
|
|
13
|
+
if (message) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14
|
+
style: { opacity: .7 },
|
|
15
|
+
children: message
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18
|
+
className: "grid grid-cols-1 grid-rows-1",
|
|
19
|
+
children: [!hasLoaded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20
|
+
className: "col-start-1 row-start-1 grid place-items-center",
|
|
21
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_LoadingRipples.LoadingRipples, {})
|
|
22
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: "col-start-1 row-start-1",
|
|
24
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FullParityStory.FullParityStory, {
|
|
25
|
+
storyId: primaryId,
|
|
26
|
+
args: primaryExport.args,
|
|
27
|
+
onLoad: () => setHasLoaded(true)
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.PrimaryPreview = PrimaryPreview;
|
|
35
|
+
//# sourceMappingURL=PrimaryPreview.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimaryPreview.cjs","names":["useDynamicStory","LoadingRipples","FullParityStory"],"sources":["../../src/components/PrimaryPreview.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useDynamicStory } from '../hooks/useDynamicStory'\nimport type { StoryInfo } from '../types'\nimport { FullParityStory } from './FullParityStory'\nimport { LoadingRipples } from './icons/LoadingRipples'\n\ninterface PropsForPrimaryPreview {\n\tstoryInfo: StoryInfo\n}\n\nexport function PrimaryPreview({ storyInfo }: PropsForPrimaryPreview) {\n\tconst [hasLoaded, setHasLoaded] = useState(false)\n\tconst { csfModule, primaryExport, primaryId, error, isLoading } =\n\t\tuseDynamicStory(storyInfo)\n\tconst message =\n\t\terror ||\n\t\t(isLoading && 'Loading preview…') ||\n\t\t(!csfModule && 'Module could not be loaded.') ||\n\t\t(!primaryExport && 'No story export found.')\n\n\tif (message) return <p style={{ opacity: 0.7 }}>{message}</p>\n\n\treturn (\n\t\t<div className=\"grid grid-cols-1 grid-rows-1\">\n\t\t\t{!hasLoaded && (\n\t\t\t\t<div className=\"col-start-1 row-start-1 grid place-items-center\">\n\t\t\t\t\t<LoadingRipples />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"col-start-1 row-start-1\">\n\t\t\t\t<FullParityStory\n\t\t\t\t\tstoryId={primaryId!}\n\t\t\t\t\targs={primaryExport.args}\n\t\t\t\t\tonLoad={() => setHasLoaded(true)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,eAAe,EAAE,aAAqC;CACrE,MAAM,CAAC,WAAW,oCAAyB,MAAM;CACjD,MAAM,EAAE,WAAW,eAAe,WAAW,OAAO,cACnDA,wCAAgB,UAAU;CAC3B,MAAM,UACL,SACC,aAAa,sBACb,CAAC,aAAa,iCACd,CAAC,iBAAiB;AAEpB,KAAI,QAAS,QAAO,2CAAC;EAAE,OAAO,EAAE,SAAS,IAAK;YAAG;GAAY;AAE7D,QACC,4CAAC;EAAI,WAAU;aACb,CAAC,aACD,2CAAC;GAAI,WAAU;aACd,2CAACC,0CAAiB;IACb,EAEP,2CAAC;GAAI,WAAU;aACd,2CAACC;IACA,SAAS;IACT,MAAM,cAAc;IACpB,cAAc,aAAa,KAAK;KAC/B;IACG;GACD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useDynamicStory } from "../hooks/useDynamicStory.mjs";
|
|
2
|
+
import { FullParityStory } from "./FullParityStory.mjs";
|
|
3
|
+
import { LoadingRipples } from "./icons/LoadingRipples.mjs";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/PrimaryPreview.tsx
|
|
8
|
+
function PrimaryPreview({ storyInfo }) {
|
|
9
|
+
const [hasLoaded, setHasLoaded] = useState(false);
|
|
10
|
+
const { csfModule, primaryExport, primaryId, error, isLoading } = useDynamicStory(storyInfo);
|
|
11
|
+
const message = error || isLoading && "Loading preview…" || !csfModule && "Module could not be loaded." || !primaryExport && "No story export found.";
|
|
12
|
+
if (message) return /* @__PURE__ */ jsx("p", {
|
|
13
|
+
style: { opacity: .7 },
|
|
14
|
+
children: message
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "grid grid-cols-1 grid-rows-1",
|
|
18
|
+
children: [!hasLoaded && /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "col-start-1 row-start-1 grid place-items-center",
|
|
20
|
+
children: /* @__PURE__ */ jsx(LoadingRipples, {})
|
|
21
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "col-start-1 row-start-1",
|
|
23
|
+
children: /* @__PURE__ */ jsx(FullParityStory, {
|
|
24
|
+
storyId: primaryId,
|
|
25
|
+
args: primaryExport.args,
|
|
26
|
+
onLoad: () => setHasLoaded(true)
|
|
27
|
+
})
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { PrimaryPreview };
|
|
34
|
+
//# sourceMappingURL=PrimaryPreview.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimaryPreview.mjs","names":[],"sources":["../../src/components/PrimaryPreview.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useDynamicStory } from '../hooks/useDynamicStory'\nimport type { StoryInfo } from '../types'\nimport { FullParityStory } from './FullParityStory'\nimport { LoadingRipples } from './icons/LoadingRipples'\n\ninterface PropsForPrimaryPreview {\n\tstoryInfo: StoryInfo\n}\n\nexport function PrimaryPreview({ storyInfo }: PropsForPrimaryPreview) {\n\tconst [hasLoaded, setHasLoaded] = useState(false)\n\tconst { csfModule, primaryExport, primaryId, error, isLoading } =\n\t\tuseDynamicStory(storyInfo)\n\tconst message =\n\t\terror ||\n\t\t(isLoading && 'Loading preview…') ||\n\t\t(!csfModule && 'Module could not be loaded.') ||\n\t\t(!primaryExport && 'No story export found.')\n\n\tif (message) return <p style={{ opacity: 0.7 }}>{message}</p>\n\n\treturn (\n\t\t<div className=\"grid grid-cols-1 grid-rows-1\">\n\t\t\t{!hasLoaded && (\n\t\t\t\t<div className=\"col-start-1 row-start-1 grid place-items-center\">\n\t\t\t\t\t<LoadingRipples />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"col-start-1 row-start-1\">\n\t\t\t\t<FullParityStory\n\t\t\t\t\tstoryId={primaryId!}\n\t\t\t\t\targs={primaryExport.args}\n\t\t\t\t\tonLoad={() => setHasLoaded(true)}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,eAAe,EAAE,aAAqC;CACrE,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,EAAE,WAAW,eAAe,WAAW,OAAO,cACnD,gBAAgB,UAAU;CAC3B,MAAM,UACL,SACC,aAAa,sBACb,CAAC,aAAa,iCACd,CAAC,iBAAiB;AAEpB,KAAI,QAAS,QAAO,oBAAC;EAAE,OAAO,EAAE,SAAS,IAAK;YAAG;GAAY;AAE7D,QACC,qBAAC;EAAI,WAAU;aACb,CAAC,aACD,oBAAC;GAAI,WAAU;aACd,oBAAC,mBAAiB;IACb,EAEP,oBAAC;GAAI,WAAU;aACd,oBAAC;IACA,SAAS;IACT,MAAM,cAAc;IACpB,cAAc,aAAa,KAAK;KAC/B;IACG;GACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _storybook_addon_docs_blocks = require("@storybook/addon-docs/blocks");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let src_components_SbHeading_module_css = require("./SbHeading.module.css");
|
|
5
|
+
src_components_SbHeading_module_css = require_runtime.__toESM(src_components_SbHeading_module_css);
|
|
6
|
+
|
|
7
|
+
//#region src/components/SbHeading.tsx
|
|
8
|
+
function SbHeading({ children, className }) {
|
|
9
|
+
const classes = [src_components_SbHeading_module_css.default.SbHeading, className].filter(Boolean).join(" ").trim();
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11
|
+
className: classes,
|
|
12
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_addon_docs_blocks.Heading, { children })
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.SbHeading = SbHeading;
|
|
18
|
+
//# sourceMappingURL=SbHeading.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SbHeading.cjs","names":["s","Heading"],"sources":["../../src/components/SbHeading.tsx"],"sourcesContent":["import { Heading } from '@storybook/addon-docs/blocks'\nimport s from './SbHeading.module.css'\nimport type { ReactNode } from 'react'\n\ninterface PropsForSbHeading {\n\tclassName?: string\n\tchildren?: ReactNode\n}\n\nexport function SbHeading({ children, className }: PropsForSbHeading) {\n\tconst classes = [s.SbHeading, className].filter(Boolean).join(' ').trim()\n\treturn (\n\t\t<div className={classes}>\n\t\t\t<Heading>{children}</Heading>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;AASA,SAAgB,UAAU,EAAE,UAAU,aAAgC;CACrE,MAAM,UAAU,CAACA,4CAAE,WAAW,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,CAAC,MAAM;AACzE,QACC,2CAAC;EAAI,WAAW;YACf,2CAACC,wCAAS,WAAmB;GACxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Heading } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import s from "./SbHeading.module.css";
|
|
4
|
+
|
|
5
|
+
//#region src/components/SbHeading.tsx
|
|
6
|
+
function SbHeading({ children, className }) {
|
|
7
|
+
const classes = [s.SbHeading, className].filter(Boolean).join(" ").trim();
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
className: classes,
|
|
10
|
+
children: /* @__PURE__ */ jsx(Heading, { children })
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SbHeading };
|
|
16
|
+
//# sourceMappingURL=SbHeading.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SbHeading.mjs","names":[],"sources":["../../src/components/SbHeading.tsx"],"sourcesContent":["import { Heading } from '@storybook/addon-docs/blocks'\nimport s from './SbHeading.module.css'\nimport type { ReactNode } from 'react'\n\ninterface PropsForSbHeading {\n\tclassName?: string\n\tchildren?: ReactNode\n}\n\nexport function SbHeading({ children, className }: PropsForSbHeading) {\n\tconst classes = [s.SbHeading, className].filter(Boolean).join(' ').trim()\n\treturn (\n\t\t<div className={classes}>\n\t\t\t<Heading>{children}</Heading>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;AASA,SAAgB,UAAU,EAAE,UAAU,aAAgC;CACrE,MAAM,UAAU,CAAC,EAAE,WAAW,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,CAAC,MAAM;AACzE,QACC,oBAAC;EAAI,WAAW;YACf,oBAAC,WAAS,WAAmB;GACxB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** need double classes to override storybook specificity */
|
|
2
|
+
.SbHeading.SbHeading {
|
|
3
|
+
h2 {
|
|
4
|
+
border: none;
|
|
5
|
+
font-size: 0.8rem;
|
|
6
|
+
font-weight: 700;
|
|
7
|
+
letter-spacing: 0.35em;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
color: var(--sb-color-text-secondary, #5c6870);
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin-top: 56px;
|
|
12
|
+
margin-bottom: 0.7rem;
|
|
13
|
+
|
|
14
|
+
div:has(table) + div &,
|
|
15
|
+
:global(.sb-anchor) + div & {
|
|
16
|
+
margin-top: 16px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
& + div table {
|
|
21
|
+
margin-top: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_TooltipTrigger = require('./TooltipTrigger.cjs');
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let _storybook_addon_links = require("@storybook/addon-links");
|
|
5
|
+
let src_components_StoryLink_module_css = require("./StoryLink.module.css");
|
|
6
|
+
src_components_StoryLink_module_css = require_runtime.__toESM(src_components_StoryLink_module_css);
|
|
7
|
+
|
|
8
|
+
//#region src/components/StoryLink.tsx
|
|
9
|
+
function StoryLink({ info, children, tooltipPosition = "top" }) {
|
|
10
|
+
if (!info.storyId) {
|
|
11
|
+
return info.componentPath;
|
|
12
|
+
}
|
|
13
|
+
const currentStoryId = /id=(.+?)&globals/.exec(window.location.href)?.[1];
|
|
14
|
+
const linkPath = `/?path=/docs/${info.storyId}`;
|
|
15
|
+
const storyTitle = info.storyTitle;
|
|
16
|
+
if (info.storyId === currentStoryId) {
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
18
|
+
className: src_components_StoryLink_module_css.default.currentStory,
|
|
19
|
+
children: [
|
|
20
|
+
children ?? storyTitle,
|
|
21
|
+
" ",
|
|
22
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
23
|
+
className: src_components_StoryLink_module_css.default.currentStoryMark,
|
|
24
|
+
children: "(Current Story Page)"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TooltipTrigger.TooltipTrigger, {
|
|
30
|
+
TriggerElem: "a",
|
|
31
|
+
tooltipText: "View story",
|
|
32
|
+
className: src_components_StoryLink_module_css.default.storyLink,
|
|
33
|
+
href: linkPath,
|
|
34
|
+
tooltipPosition,
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
(0, _storybook_addon_links.linkTo)(info.storyId)(e);
|
|
38
|
+
},
|
|
39
|
+
children: children ?? storyTitle
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.StoryLink = StoryLink;
|
|
45
|
+
//# sourceMappingURL=StoryLink.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryLink.cjs","names":["s","TooltipTrigger"],"sources":["../../src/components/StoryLink.tsx"],"sourcesContent":["import type { StoryInfo } from '../types'\nimport { linkTo } from '@storybook/addon-links'\n\nimport s from './StoryLink.module.css'\nimport type { ReactNode } from 'react'\nimport { TooltipTrigger, type TooltipPosition } from './TooltipTrigger'\n\ninterface StoryLinkProps {\n\tinfo: StoryInfo\n\tchildren?: ReactNode\n\ttooltipPosition?: TooltipPosition\n}\n\nexport function StoryLink({\n\tinfo,\n\tchildren,\n\ttooltipPosition = 'top',\n}: StoryLinkProps) {\n\tif (!info.storyId) {\n\t\treturn info.componentPath\n\t}\n\tconst currentStoryId = /id=(.+?)&globals/.exec(window.location.href)?.[1]\n\tconst linkPath = `/?path=/docs/${info.storyId}`\n\tconst storyTitle = info.storyTitle\n\n\tif (info.storyId === currentStoryId) {\n\t\treturn (\n\t\t\t<span className={s.currentStory}>\n\t\t\t\t{children ?? storyTitle}{' '}\n\t\t\t\t<strong className={s.currentStoryMark}>\n\t\t\t\t\t(Current Story Page)\n\t\t\t\t</strong>\n\t\t\t</span>\n\t\t)\n\t}\n\n\treturn (\n\t\t<TooltipTrigger\n\t\t\tTriggerElem=\"a\"\n\t\t\ttooltipText=\"View story\"\n\t\t\tclassName={s.storyLink}\n\t\t\thref={linkPath}\n\t\t\ttooltipPosition={tooltipPosition}\n\t\t\tonClick={(e) => {\n\t\t\t\te.preventDefault()\n\t\t\t\tlinkTo(info.storyId!)(e)\n\t\t\t}}\n\t\t>\n\t\t\t{children ?? storyTitle}\n\t\t</TooltipTrigger>\n\t)\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,UAAU,EACzB,MACA,UACA,kBAAkB,SACA;AAClB,KAAI,CAAC,KAAK,SAAS;AAClB,SAAO,KAAK;;CAEb,MAAM,iBAAiB,mBAAmB,KAAK,OAAO,SAAS,KAAK,GAAG;CACvE,MAAM,WAAW,gBAAgB,KAAK;CACtC,MAAM,aAAa,KAAK;AAExB,KAAI,KAAK,YAAY,gBAAgB;AACpC,SACC,4CAAC;GAAK,WAAWA,4CAAE;;IACjB,YAAY;IAAY;IACzB,2CAAC;KAAO,WAAWA,4CAAE;eAAkB;MAE9B;;IACH;;AAIT,QACC,2CAACC;EACA,aAAY;EACZ,aAAY;EACZ,WAAWD,4CAAE;EACb,MAAM;EACW;EACjB,UAAU,MAAM;AACf,KAAE,gBAAgB;AAClB,sCAAO,KAAK,QAAS,CAAC,EAAE;;YAGxB,YAAY;GACG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TooltipTrigger } from "./TooltipTrigger.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { linkTo } from "@storybook/addon-links";
|
|
4
|
+
import s from "./StoryLink.module.css";
|
|
5
|
+
|
|
6
|
+
//#region src/components/StoryLink.tsx
|
|
7
|
+
function StoryLink({ info, children, tooltipPosition = "top" }) {
|
|
8
|
+
if (!info.storyId) {
|
|
9
|
+
return info.componentPath;
|
|
10
|
+
}
|
|
11
|
+
const currentStoryId = /id=(.+?)&globals/.exec(window.location.href)?.[1];
|
|
12
|
+
const linkPath = `/?path=/docs/${info.storyId}`;
|
|
13
|
+
const storyTitle = info.storyTitle;
|
|
14
|
+
if (info.storyId === currentStoryId) {
|
|
15
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
16
|
+
className: s.currentStory,
|
|
17
|
+
children: [
|
|
18
|
+
children ?? storyTitle,
|
|
19
|
+
" ",
|
|
20
|
+
/* @__PURE__ */ jsx("strong", {
|
|
21
|
+
className: s.currentStoryMark,
|
|
22
|
+
children: "(Current Story Page)"
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
28
|
+
TriggerElem: "a",
|
|
29
|
+
tooltipText: "View story",
|
|
30
|
+
className: s.storyLink,
|
|
31
|
+
href: linkPath,
|
|
32
|
+
tooltipPosition,
|
|
33
|
+
onClick: (e) => {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
linkTo(info.storyId)(e);
|
|
36
|
+
},
|
|
37
|
+
children: children ?? storyTitle
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { StoryLink };
|
|
43
|
+
//# sourceMappingURL=StoryLink.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryLink.mjs","names":[],"sources":["../../src/components/StoryLink.tsx"],"sourcesContent":["import type { StoryInfo } from '../types'\nimport { linkTo } from '@storybook/addon-links'\n\nimport s from './StoryLink.module.css'\nimport type { ReactNode } from 'react'\nimport { TooltipTrigger, type TooltipPosition } from './TooltipTrigger'\n\ninterface StoryLinkProps {\n\tinfo: StoryInfo\n\tchildren?: ReactNode\n\ttooltipPosition?: TooltipPosition\n}\n\nexport function StoryLink({\n\tinfo,\n\tchildren,\n\ttooltipPosition = 'top',\n}: StoryLinkProps) {\n\tif (!info.storyId) {\n\t\treturn info.componentPath\n\t}\n\tconst currentStoryId = /id=(.+?)&globals/.exec(window.location.href)?.[1]\n\tconst linkPath = `/?path=/docs/${info.storyId}`\n\tconst storyTitle = info.storyTitle\n\n\tif (info.storyId === currentStoryId) {\n\t\treturn (\n\t\t\t<span className={s.currentStory}>\n\t\t\t\t{children ?? storyTitle}{' '}\n\t\t\t\t<strong className={s.currentStoryMark}>\n\t\t\t\t\t(Current Story Page)\n\t\t\t\t</strong>\n\t\t\t</span>\n\t\t)\n\t}\n\n\treturn (\n\t\t<TooltipTrigger\n\t\t\tTriggerElem=\"a\"\n\t\t\ttooltipText=\"View story\"\n\t\t\tclassName={s.storyLink}\n\t\t\thref={linkPath}\n\t\t\ttooltipPosition={tooltipPosition}\n\t\t\tonClick={(e) => {\n\t\t\t\te.preventDefault()\n\t\t\t\tlinkTo(info.storyId!)(e)\n\t\t\t}}\n\t\t>\n\t\t\t{children ?? storyTitle}\n\t\t</TooltipTrigger>\n\t)\n}\n"],"mappings":";;;;;;AAaA,SAAgB,UAAU,EACzB,MACA,UACA,kBAAkB,SACA;AAClB,KAAI,CAAC,KAAK,SAAS;AAClB,SAAO,KAAK;;CAEb,MAAM,iBAAiB,mBAAmB,KAAK,OAAO,SAAS,KAAK,GAAG;CACvE,MAAM,WAAW,gBAAgB,KAAK;CACtC,MAAM,aAAa,KAAK;AAExB,KAAI,KAAK,YAAY,gBAAgB;AACpC,SACC,qBAAC;GAAK,WAAW,EAAE;;IACjB,YAAY;IAAY;IACzB,oBAAC;KAAO,WAAW,EAAE;eAAkB;MAE9B;;IACH;;AAIT,QACC,oBAAC;EACA,aAAY;EACZ,aAAY;EACZ,WAAW,EAAE;EACb,MAAM;EACW;EACjB,UAAU,MAAM;AACf,KAAE,gBAAgB;AAClB,UAAO,KAAK,QAAS,CAAC,EAAE;;YAGxB,YAAY;GACG"}
|