storybook-astro 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/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/index.cjs +397 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +88 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +390 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/index.cjs +50 -0
- package/dist/integration/index.cjs.map +1 -0
- package/dist/integration/index.d.cts +26 -0
- package/dist/integration/index.d.ts +26 -0
- package/dist/integration/index.js +44 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/toolbar-app.cjs +91 -0
- package/dist/integration/toolbar-app.cjs.map +1 -0
- package/dist/integration/toolbar-app.d.cts +10 -0
- package/dist/integration/toolbar-app.d.ts +10 -0
- package/dist/integration/toolbar-app.js +89 -0
- package/dist/integration/toolbar-app.js.map +1 -0
- package/dist/preset.cjs +294 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.d.cts +49 -0
- package/dist/preset.d.ts +49 -0
- package/dist/preset.js +285 -0
- package/dist/preset.js.map +1 -0
- package/dist/render-BR-BGSWL.d.cts +36 -0
- package/dist/render-BR-BGSWL.d.ts +36 -0
- package/dist/renderer/entry-preview.cjs +315 -0
- package/dist/renderer/entry-preview.cjs.map +1 -0
- package/dist/renderer/entry-preview.d.cts +26 -0
- package/dist/renderer/entry-preview.d.ts +26 -0
- package/dist/renderer/entry-preview.js +311 -0
- package/dist/renderer/entry-preview.js.map +1 -0
- package/dist/renderer/index.cjs +216 -0
- package/dist/renderer/index.cjs.map +1 -0
- package/dist/renderer/index.d.cts +21 -0
- package/dist/renderer/index.d.ts +21 -0
- package/dist/renderer/index.js +211 -0
- package/dist/renderer/index.js.map +1 -0
- package/dist/sourceTransformer-CsgaPbY9.d.cts +38 -0
- package/dist/sourceTransformer-CsgaPbY9.d.ts +38 -0
- package/package.json +100 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { r as render, a as renderToCanvas } from '../render-BR-BGSWL.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default decorators for Astro Storybook
|
|
5
|
+
*
|
|
6
|
+
* These decorators are automatically applied to all stories.
|
|
7
|
+
*/
|
|
8
|
+
declare const decorators: unknown[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Astro Storybook Renderer
|
|
12
|
+
*
|
|
13
|
+
* This module is the renderer entry point for Storybook.
|
|
14
|
+
* It exports the render functions that Storybook uses to display components.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare const parameters: {
|
|
18
|
+
renderer: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { decorators, parameters };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { simulatePageLoad, simulateDOMContentLoaded } from 'storybook/internal/preview-api';
|
|
2
|
+
|
|
3
|
+
// src/renderer/render.ts
|
|
4
|
+
|
|
5
|
+
// node_modules/ts-dedent/esm/index.js
|
|
6
|
+
function dedent(templ) {
|
|
7
|
+
var values = [];
|
|
8
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
9
|
+
values[_i - 1] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
12
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
13
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
14
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
15
|
+
if (matches) {
|
|
16
|
+
return arr.concat(matches.map(function(match) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
return arr;
|
|
22
|
+
}, []);
|
|
23
|
+
if (indentLengths.length) {
|
|
24
|
+
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
25
|
+
strings = strings.map(function(str) {
|
|
26
|
+
return str.replace(pattern_1, "\n");
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
30
|
+
var string = strings[0];
|
|
31
|
+
values.forEach(function(value, i) {
|
|
32
|
+
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
33
|
+
var endentation = endentations ? endentations[1] : "";
|
|
34
|
+
var indentedValue = value;
|
|
35
|
+
if (typeof value === "string" && value.includes("\n")) {
|
|
36
|
+
indentedValue = String(value).split("\n").map(function(str, i2) {
|
|
37
|
+
return i2 === 0 ? str : "" + endentation + str;
|
|
38
|
+
}).join("\n");
|
|
39
|
+
}
|
|
40
|
+
string += indentedValue + strings[i + 1];
|
|
41
|
+
});
|
|
42
|
+
return string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/renderer/render.ts
|
|
46
|
+
var pendingRequests = /* @__PURE__ */ new Map();
|
|
47
|
+
var isInitialized = false;
|
|
48
|
+
function initialize() {
|
|
49
|
+
if (isInitialized) return;
|
|
50
|
+
isInitialized = true;
|
|
51
|
+
if (import.meta.hot) {
|
|
52
|
+
import.meta.hot.on("astro:render:response", (data) => {
|
|
53
|
+
const pending = pendingRequests.get(data.id);
|
|
54
|
+
if (pending) {
|
|
55
|
+
clearTimeout(pending.timeoutId);
|
|
56
|
+
pendingRequests.delete(data.id);
|
|
57
|
+
pending.resolve(data);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
import.meta.hot.on("astro:component:update", () => {
|
|
61
|
+
window.dispatchEvent(new CustomEvent("storybook-astro:hmr"));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function render(_args, context) {
|
|
66
|
+
const { id, component } = context;
|
|
67
|
+
if (!component) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Unable to render story ${id} as the component annotation is missing from the default export`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (typeof component === "string") {
|
|
73
|
+
return component;
|
|
74
|
+
}
|
|
75
|
+
if (component instanceof HTMLElement) {
|
|
76
|
+
return component.cloneNode(true);
|
|
77
|
+
}
|
|
78
|
+
if (typeof component === "function" && "isAstroComponentFactory" in component) {
|
|
79
|
+
return component;
|
|
80
|
+
}
|
|
81
|
+
if (typeof component === "function") {
|
|
82
|
+
return component;
|
|
83
|
+
}
|
|
84
|
+
console.warn(dedent`
|
|
85
|
+
Storybook Astro renderer received an unexpected component type.
|
|
86
|
+
Received: ${typeof component}
|
|
87
|
+
`);
|
|
88
|
+
return component;
|
|
89
|
+
}
|
|
90
|
+
async function renderToCanvas(ctx, canvasElement) {
|
|
91
|
+
initialize();
|
|
92
|
+
const { storyFn, showMain, showError, forceRemount, storyContext } = ctx;
|
|
93
|
+
const { name, title } = storyContext;
|
|
94
|
+
const element = storyFn();
|
|
95
|
+
showMain();
|
|
96
|
+
if (isAstroComponent(element)) {
|
|
97
|
+
await renderAstroComponent(element, storyContext, canvasElement);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (typeof element === "string") {
|
|
101
|
+
canvasElement.innerHTML = element;
|
|
102
|
+
simulatePageLoad(canvasElement);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (element instanceof Node) {
|
|
106
|
+
if (canvasElement.firstChild === element && !forceRemount) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
canvasElement.innerHTML = "";
|
|
110
|
+
canvasElement.appendChild(element);
|
|
111
|
+
simulateDOMContentLoaded();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
showError({
|
|
115
|
+
title: `Expecting an HTML snippet or DOM node from the story: "${name}" of "${title}".`,
|
|
116
|
+
description: dedent`
|
|
117
|
+
Did you forget to return the HTML snippet from the story?
|
|
118
|
+
Use "() => <your snippet or node>" or when defining the story.
|
|
119
|
+
`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function isAstroComponent(element) {
|
|
123
|
+
return element !== null && typeof element === "function" && "isAstroComponentFactory" in element && element.isAstroComponentFactory === true;
|
|
124
|
+
}
|
|
125
|
+
async function renderAstroComponent(component, storyContext, canvasElement) {
|
|
126
|
+
const { args } = storyContext;
|
|
127
|
+
const moduleId = component.moduleId;
|
|
128
|
+
if (!moduleId) {
|
|
129
|
+
throw new Error("Astro component is missing moduleId. Make sure the component was imported correctly.");
|
|
130
|
+
}
|
|
131
|
+
const { slots = {}, ...props } = args;
|
|
132
|
+
try {
|
|
133
|
+
const response = await sendRenderRequest({
|
|
134
|
+
component: moduleId,
|
|
135
|
+
args: props,
|
|
136
|
+
slots
|
|
137
|
+
});
|
|
138
|
+
canvasElement.innerHTML = response.html;
|
|
139
|
+
executeScripts(canvasElement);
|
|
140
|
+
applyDynamicStyles();
|
|
141
|
+
simulatePageLoad(canvasElement);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
144
|
+
canvasElement.innerHTML = `
|
|
145
|
+
<div style="color: #dc2626; background: #fef2f2; padding: 16px; border-radius: 8px; font-family: system-ui;">
|
|
146
|
+
<strong>Failed to render Astro component</strong>
|
|
147
|
+
<pre style="margin: 8px 0 0; white-space: pre-wrap;">${escapeHtml(message)}</pre>
|
|
148
|
+
</div>
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function sendRenderRequest(data) {
|
|
153
|
+
const id = crypto.randomUUID();
|
|
154
|
+
const timeoutMs = 1e4;
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
const timeoutId = setTimeout(() => {
|
|
157
|
+
pendingRequests.delete(id);
|
|
158
|
+
reject(new Error(`Render request timed out after ${timeoutMs}ms`));
|
|
159
|
+
}, timeoutMs);
|
|
160
|
+
pendingRequests.set(id, { resolve, reject, timeoutId });
|
|
161
|
+
if (import.meta.hot) {
|
|
162
|
+
import.meta.hot.send("astro:render:request", { ...data, id });
|
|
163
|
+
} else {
|
|
164
|
+
clearTimeout(timeoutId);
|
|
165
|
+
pendingRequests.delete(id);
|
|
166
|
+
reject(new Error("HMR not available - cannot communicate with server"));
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function executeScripts(container) {
|
|
171
|
+
const scripts = container.querySelectorAll("script");
|
|
172
|
+
scripts.forEach((oldScript) => {
|
|
173
|
+
const newScript = document.createElement("script");
|
|
174
|
+
Array.from(oldScript.attributes).forEach((attr) => {
|
|
175
|
+
newScript.setAttribute(attr.name, attr.value);
|
|
176
|
+
});
|
|
177
|
+
newScript.textContent = oldScript.textContent;
|
|
178
|
+
oldScript.parentNode?.replaceChild(newScript, oldScript);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function applyDynamicStyles() {
|
|
182
|
+
const styleTags = document.querySelectorAll("style[data-vite-dev-id]");
|
|
183
|
+
styleTags.forEach((style) => {
|
|
184
|
+
const content = style.textContent || "";
|
|
185
|
+
if (content.includes("__vite__updateStyle")) {
|
|
186
|
+
const script = document.createElement("script");
|
|
187
|
+
script.type = "module";
|
|
188
|
+
script.textContent = content.replace(/import\.meta\.hot\.accept\(/g, "import.meta.hot?.accept(").replace(/import\.meta\.hot\.prune\(/g, "import.meta.hot?.prune(");
|
|
189
|
+
document.head.appendChild(script);
|
|
190
|
+
document.head.removeChild(script);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function escapeHtml(text) {
|
|
195
|
+
const div = document.createElement("div");
|
|
196
|
+
div.textContent = text;
|
|
197
|
+
return div.innerHTML;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/renderer/decorators.ts
|
|
201
|
+
var decorators = [];
|
|
202
|
+
var decorators_default = decorators;
|
|
203
|
+
|
|
204
|
+
// src/renderer/index.ts
|
|
205
|
+
var parameters = {
|
|
206
|
+
renderer: "astro"
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export { decorators_default as decorators, parameters, render, renderToCanvas };
|
|
210
|
+
//# sourceMappingURL=index.js.map
|
|
211
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../node_modules/ts-dedent/src/index.ts","../../src/renderer/render.ts","../../src/renderer/decorators.ts","../../src/renderer/index.ts"],"names":["i"],"mappings":";;;;;AAAM,SAAU,OACd,KAAA,EAAoC;AACpC,EAAA,IAAA,SAAA,EAAA;AAAA,EAAA,KAAA,IAAA,EAAA,GAAA,CAAA,EAAA,EAAA,GAAA,SAAA,CAAA,MAAA,EAAA,EAAA,EAAA,EAAoB;AAApB,IAAA,MAAA,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA;;AAEA,EAAA,IAAI,OAAA,GAAU,MAAM,IAAA,CAAK,OAAO,UAAU,QAAA,GAAW,CAAC,KAAK,CAAA,GAAI,KAAK,CAAA;AAGpE,EAAA,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA,GAAI,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA,CAAE,OAAA,CACxD,gBAAA,EACA,EAAE,CAAA;AAIJ,EAAA,IAAM,aAAA,GAAgB,OAAA,CAAQ,MAAA,CAAO,SAAC,KAAK,GAAA,EAAG;AAC5C,IAAA,IAAM,OAAA,GAAU,GAAA,CAAI,KAAA,CAAM,qBAAqB,CAAA;AAC/C,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,OAAO,GAAA,CAAI,MAAA,CACT,OAAA,CAAQ,GAAA,CAAI,SAAC,KAAA,EAAK;AAAA,QAAA,IAAA,EAAA,EAAA,EAAA;AAAK,QAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAM,KAAA,CAAM,QAAQ,CAAA,MAAC,IAAA,IAAA,EAAA,KAAA,MAAA,GAA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EAAM,IAAA,CAAK,KAAK,CAAA;AAAA,IAC9C,CAAC,CAAA;AAGD,IAAA,SAAA,CAAU,cAAc,SAAA,CAAU,WAAA;AAGlC,IAAA,SAAA,CAAU,UAAA,EAAY,YAAA,CAAa,SAAA,EAAW,SAAS,CAAA;AAAA,EACzD,CAAC,CAAA;AACH;AAKA,SAAS,kBAAA,GAA2B;AAElC,EAAA,MAAM,SAAA,GAAY,QAAA,CAAS,gBAAA,CAAiB,yBAAyB,CAAA;AAErE,EAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC3B,IAAA,MAAM,OAAA,GAAU,MAAM,WAAA,IAAe,EAAA;AAGrC,IAAA,IAAI,OAAA,CAAQ,QAAA,CAAS,qBAAqB,CAAA,EAAG;AAC3C,MAAA,MAAM,MAAA,GAAS,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC9C,MAAA,MAAA,CAAO,IAAA,GAAO,QAAA;AACd,MAAA,MAAA,CAAO,WAAA,GAAc,QAClB,OAAA,CAAQ,8BAAA,EAAgC,0BAA0B,CAAA,CAClE,OAAA,CAAQ,+BAA+B,yBAAyB,CAAA;AAEnE,MAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAChC,MAAA,QAAA,CAAS,IAAA,CAAK,YAAY,MAAM,CAAA;AAAA,IAClC;AAAA,EACF,CAAC,CAAA;AACH;AAKA,SAAS,WAAW,IAAA,EAAsB;AACxC,EAAA,MAAM,GAAA,GAAM,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACxC,EAAA,GAAA,CAAI,WAAA,GAAc,IAAA;AAClB,EAAA,OAAO,GAAA,CAAI,SAAA;AACb;;;ACxSA,IAAM,aAAwB,EAAC;AAE/B,IAAO,kBAAA,GAAQ;;;ACER,IAAM,UAAA,GAAa;AAAA,EACxB,QAAA,EAAU;AACZ","file":"index.js","sourcesContent":["export function dedent(\n templ: TemplateStringsArray | string,\n ...values: unknown[]\n): string {\n let strings = Array.from(typeof templ === 'string' ? [templ] : templ);\n\n // 1. Remove trailing whitespace.\n strings[strings.length - 1] = strings[strings.length - 1].replace(\n /\\r?\\n([\\t ]*)$/,\n '',\n );\n\n // 2. Find all line breaks to determine the highest common indentation level.\n const indentLengths = strings.reduce((arr, str) => {\n const matches = str.match(/\\n([\\t ]+|(?!\\s).)/g);\n if (matches) {\n return arr.concat(\n matches.map((match) => match.match(/[\\t ]/g)?.length ?? 0),\n );\n }\n return arr;\n }, <number[]>[]);\n\n // 3. Remove the common indentation from all strings.\n if (indentLengths.length) {\n const pattern = new RegExp(`\\n[\\t ]{${Math.min(...indentLengths)}}`, 'g');\n\n strings = strings.map((str) => str.replace(pattern, '\\n'));\n }\n\n // 4. Remove leading whitespace.\n strings[0] = strings[0].replace(/^\\r?\\n/, '');\n\n // 5. Perform interpolation.\n let string = strings[0];\n\n values.forEach((value, i) => {\n // 5.1 Read current indentation level\n const endentations = string.match(/(?:^|\\n)( *)$/)\n const endentation = endentations ? endentations[1] : ''\n let indentedValue = value\n // 5.2 Add indentation to values with multiline strings\n if (typeof value === 'string' && value.includes('\\n')) {\n indentedValue = String(value)\n .split('\\n')\n .map((str, i) => {\n return i === 0 ? str : `${endentation}${str}`\n })\n .join('\\n');\n }\n\n string += indentedValue + strings[i + 1];\n });\n\n return string;\n}\n\nexport default dedent;\n","/**\n * Astro Component Renderer for Storybook\n * \n * This module handles rendering Astro components in the Storybook canvas.\n * It communicates with the server via WebSocket to use the Container API.\n */\n\nimport { simulateDOMContentLoaded, simulatePageLoad } from 'storybook/internal/preview-api';\nimport { dedent } from 'ts-dedent';\nimport type { RenderResponseMessage, RenderPromise } from '../types/index.js';\n\n// Map of pending render requests\nconst pendingRequests = new Map<string, RenderPromise>();\n\n// Flag to track if we've initialized the WebSocket listeners\nlet isInitialized = false;\n\n/**\n * Initialize WebSocket listeners for render responses\n */\nfunction initialize() {\n if (isInitialized) return;\n isInitialized = true;\n \n // Listen for render responses from the server\n if (import.meta.hot) {\n import.meta.hot.on('astro:render:response', (data: RenderResponseMessage['data']) => {\n const pending = pendingRequests.get(data.id);\n if (pending) {\n clearTimeout(pending.timeoutId);\n pendingRequests.delete(data.id);\n pending.resolve(data);\n }\n });\n \n // Listen for component updates (HMR)\n import.meta.hot.on('astro:component:update', () => {\n // Trigger re-render by sending a custom event\n window.dispatchEvent(new CustomEvent('storybook-astro:hmr'));\n });\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyArgs = Record<string, any>;\n\ninterface StoryContext {\n id: string;\n name: string;\n title: string;\n component?: unknown;\n args: AnyArgs;\n}\n\ninterface RenderContextLike {\n storyFn: () => unknown;\n showMain: () => void;\n showError: (error: { title: string; description: string }) => void;\n forceRemount: boolean;\n storyContext: StoryContext;\n}\n\n/**\n * Main render function - creates the story element\n * This is called by Storybook to get the renderable content\n */\nexport function render(_args: AnyArgs, context: StoryContext): unknown {\n const { id, component } = context;\n \n if (!component) {\n throw new Error(\n `Unable to render story ${id} as the component annotation is missing from the default export`\n );\n }\n \n // If component is a string (raw HTML), return it directly\n if (typeof component === 'string') {\n return component;\n }\n \n // If component is already an HTML element, clone it\n if (component instanceof HTMLElement) {\n return component.cloneNode(true) as HTMLElement;\n }\n \n // Check if this is an Astro component (has the factory marker)\n if (typeof component === 'function' && 'isAstroComponentFactory' in component) {\n return component;\n }\n \n // For other function components, try to render them\n if (typeof component === 'function') {\n return component;\n }\n \n console.warn(dedent`\n Storybook Astro renderer received an unexpected component type.\n Received: ${typeof component}\n `);\n \n return component;\n}\n\n/**\n * Render story to the canvas element\n * This is the main entry point called by Storybook\n */\nexport async function renderToCanvas(\n ctx: RenderContextLike,\n canvasElement: HTMLElement\n): Promise<void> {\n initialize();\n \n const { storyFn, showMain, showError, forceRemount, storyContext } = ctx;\n const { name, title } = storyContext;\n \n const element = storyFn();\n \n showMain();\n \n // Check if this is an Astro component\n if (isAstroComponent(element)) {\n await renderAstroComponent(element, storyContext, canvasElement);\n return;\n }\n \n // Handle string content\n if (typeof element === 'string') {\n canvasElement.innerHTML = element;\n simulatePageLoad(canvasElement);\n return;\n }\n \n // Handle DOM nodes\n if (element instanceof Node) {\n if (canvasElement.firstChild === element && !forceRemount) {\n return;\n }\n \n canvasElement.innerHTML = '';\n canvasElement.appendChild(element);\n simulateDOMContentLoaded();\n return;\n }\n \n // Unknown element type\n showError({\n title: `Expecting an HTML snippet or DOM node from the story: \"${name}\" of \"${title}\".`,\n description: dedent`\n Did you forget to return the HTML snippet from the story?\n Use \"() => <your snippet or node>\" or when defining the story.\n `,\n });\n}\n\n/**\n * Check if an element is an Astro component factory\n */\nfunction isAstroComponent(element: unknown): element is AstroComponentLike {\n return (\n element !== null &&\n typeof element === 'function' &&\n 'isAstroComponentFactory' in element &&\n (element as AstroComponentLike).isAstroComponentFactory === true\n );\n}\n\ninterface AstroComponentLike {\n isAstroComponentFactory: true;\n moduleId?: string;\n}\n\n/**\n * Render an Astro component by sending a request to the server\n */\nasync function renderAstroComponent(\n component: AstroComponentLike,\n storyContext: StoryContext,\n canvasElement: HTMLElement\n): Promise<void> {\n const { args } = storyContext;\n \n // Get module ID from component\n const moduleId = component.moduleId;\n if (!moduleId) {\n throw new Error('Astro component is missing moduleId. Make sure the component was imported correctly.');\n }\n \n // Separate slots from regular args\n const { slots = {}, ...props } = args as { slots?: Record<string, string>; [key: string]: unknown };\n \n try {\n // Request render from server\n const response = await sendRenderRequest({\n component: moduleId,\n args: props,\n slots,\n });\n \n // Update canvas with rendered HTML\n canvasElement.innerHTML = response.html;\n \n // Execute any inline scripts\n executeScripts(canvasElement);\n \n // Apply styles that may have been injected\n applyDynamicStyles();\n \n // Simulate page load for any scripts that depend on it\n simulatePageLoad(canvasElement);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n canvasElement.innerHTML = `\n <div style=\"color: #dc2626; background: #fef2f2; padding: 16px; border-radius: 8px; font-family: system-ui;\">\n <strong>Failed to render Astro component</strong>\n <pre style=\"margin: 8px 0 0; white-space: pre-wrap;\">${escapeHtml(message)}</pre>\n </div>\n `;\n }\n}\n\n/**\n * Send a render request to the server via WebSocket\n */\nasync function sendRenderRequest(data: {\n component: string;\n args?: Record<string, unknown>;\n slots?: Record<string, string>;\n}): Promise<RenderResponseMessage['data']> {\n const id = crypto.randomUUID();\n const timeoutMs = 10000;\n \n return new Promise((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n pendingRequests.delete(id);\n reject(new Error(`Render request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n \n pendingRequests.set(id, { resolve, reject, timeoutId });\n \n if (import.meta.hot) {\n import.meta.hot.send('astro:render:request', { ...data, id });\n } else {\n clearTimeout(timeoutId);\n pendingRequests.delete(id);\n reject(new Error('HMR not available - cannot communicate with server'));\n }\n });\n}\n\n/**\n * Execute script tags that were rendered in the component\n */\nfunction executeScripts(container: HTMLElement): void {\n const scripts = container.querySelectorAll('script');\n \n scripts.forEach((oldScript) => {\n const newScript = document.createElement('script');\n \n // Copy attributes\n Array.from(oldScript.attributes).forEach((attr) => {\n newScript.setAttribute(attr.name, attr.value);\n });\n \n // Copy content\n newScript.textContent = oldScript.textContent;\n \n // Replace in DOM to execute\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n });\n}\n\n/**\n * Apply any dynamic styles that were added via Vite\n */\nfunction applyDynamicStyles(): void {\n // Find style tags that need to be processed\n const styleTags = document.querySelectorAll('style[data-vite-dev-id]');\n \n styleTags.forEach((style) => {\n const content = style.textContent || '';\n \n // Check if this style needs to be executed as a module\n if (content.includes('__vite__updateStyle')) {\n const script = document.createElement('script');\n script.type = 'module';\n script.textContent = content\n .replace(/import\\.meta\\.hot\\.accept\\(/g, 'import.meta.hot?.accept(')\n .replace(/import\\.meta\\.hot\\.prune\\(/g, 'import.meta.hot?.prune(');\n \n document.head.appendChild(script);\n document.head.removeChild(script);\n }\n });\n}\n\n/**\n * Escape HTML special characters\n */\nfunction escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n}\n","/**\n * Default decorators for Astro Storybook\n * \n * These decorators are automatically applied to all stories.\n */\n\n// Default decorators array (empty for now, can be extended)\nconst decorators: unknown[] = [];\n\nexport default decorators;\n","/**\n * Astro Storybook Renderer\n * \n * This module is the renderer entry point for Storybook.\n * It exports the render functions that Storybook uses to display components.\n */\n\n// Export render functions - required by Storybook\nexport { render, renderToCanvas } from './render.js';\n\n// Export parameters\nexport const parameters = {\n renderer: 'astro',\n};\n\n// Export decorators\nexport { default as decorators } from './decorators.js';\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source code transformer for Astro components in Storybook docs
|
|
3
|
+
*
|
|
4
|
+
* Transforms story args into proper Astro component syntax for display
|
|
5
|
+
* in the "Show code" panel.
|
|
6
|
+
*/
|
|
7
|
+
interface StoryContext {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
title: string;
|
|
11
|
+
component?: {
|
|
12
|
+
displayName?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
__docgenInfo?: {
|
|
15
|
+
displayName?: string;
|
|
16
|
+
};
|
|
17
|
+
} & ((...args: unknown[]) => unknown);
|
|
18
|
+
args: Record<string, unknown>;
|
|
19
|
+
parameters?: {
|
|
20
|
+
docs?: {
|
|
21
|
+
source?: {
|
|
22
|
+
code?: string;
|
|
23
|
+
language?: string;
|
|
24
|
+
excludeDecorators?: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Transform story source code to Astro syntax
|
|
31
|
+
*
|
|
32
|
+
* @param code - The original source code (usually just args object)
|
|
33
|
+
* @param context - The story context with component and args info
|
|
34
|
+
* @returns Formatted Astro component code
|
|
35
|
+
*/
|
|
36
|
+
declare function transformSource(code: string, context: StoryContext): string;
|
|
37
|
+
|
|
38
|
+
export { transformSource as t };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source code transformer for Astro components in Storybook docs
|
|
3
|
+
*
|
|
4
|
+
* Transforms story args into proper Astro component syntax for display
|
|
5
|
+
* in the "Show code" panel.
|
|
6
|
+
*/
|
|
7
|
+
interface StoryContext {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
title: string;
|
|
11
|
+
component?: {
|
|
12
|
+
displayName?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
__docgenInfo?: {
|
|
15
|
+
displayName?: string;
|
|
16
|
+
};
|
|
17
|
+
} & ((...args: unknown[]) => unknown);
|
|
18
|
+
args: Record<string, unknown>;
|
|
19
|
+
parameters?: {
|
|
20
|
+
docs?: {
|
|
21
|
+
source?: {
|
|
22
|
+
code?: string;
|
|
23
|
+
language?: string;
|
|
24
|
+
excludeDecorators?: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Transform story source code to Astro syntax
|
|
31
|
+
*
|
|
32
|
+
* @param code - The original source code (usually just args object)
|
|
33
|
+
* @param context - The story context with component and args info
|
|
34
|
+
* @returns Formatted Astro component code
|
|
35
|
+
*/
|
|
36
|
+
declare function transformSource(code: string, context: StoryContext): string;
|
|
37
|
+
|
|
38
|
+
export { transformSource as t };
|
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "storybook-astro",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Storybook framework for Astro components - render .astro files directly in Storybook",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"storybook",
|
|
7
|
+
"astro",
|
|
8
|
+
"astro-integration",
|
|
9
|
+
"storybook-framework",
|
|
10
|
+
"component-library",
|
|
11
|
+
"design-system"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Ryan Hughes",
|
|
16
|
+
"email": "ryan@heyoodle.com"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/thinkoodle/storybook-astro"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/thinkoodle/storybook-astro#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/thinkoodle/storybook-astro/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./preset": {
|
|
34
|
+
"types": "./dist/preset.d.ts",
|
|
35
|
+
"import": "./dist/preset.js",
|
|
36
|
+
"require": "./dist/preset.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./renderer": {
|
|
39
|
+
"types": "./dist/renderer/index.d.ts",
|
|
40
|
+
"import": "./dist/renderer/index.js",
|
|
41
|
+
"require": "./dist/renderer/index.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./renderer/entry-preview": {
|
|
44
|
+
"types": "./dist/renderer/entry-preview.d.ts",
|
|
45
|
+
"import": "./dist/renderer/entry-preview.js",
|
|
46
|
+
"require": "./dist/renderer/entry-preview.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./renderer/entry-preview.mjs": {
|
|
49
|
+
"types": "./dist/renderer/entry-preview.d.ts",
|
|
50
|
+
"import": "./dist/renderer/entry-preview.js"
|
|
51
|
+
},
|
|
52
|
+
"./package.json": "./package.json"
|
|
53
|
+
},
|
|
54
|
+
"main": "./dist/index.cjs",
|
|
55
|
+
"module": "./dist/index.js",
|
|
56
|
+
"types": "./dist/index.d.ts",
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsup --watch",
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"prepublishOnly": "npm run build"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@storybook/builder-vite": "^8.4.0 || ^10.0.0",
|
|
69
|
+
"ts-dedent": "^2.2.0"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@types/node": "^20.10.0",
|
|
73
|
+
"astro": "^5.0.0",
|
|
74
|
+
"storybook": "^10.0.0",
|
|
75
|
+
"tsup": "^8.0.0",
|
|
76
|
+
"typescript": "^5.3.0",
|
|
77
|
+
"vite": "^6.0.0"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"astro": "^4.0.0 || ^5.0.0",
|
|
81
|
+
"storybook": "^8.0.0 || ^10.0.0",
|
|
82
|
+
"vite": "^5.0.0 || ^6.0.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependenciesMeta": {
|
|
85
|
+
"astro": {
|
|
86
|
+
"optional": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=18.0.0"
|
|
91
|
+
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"registry": "https://registry.npmjs.org/"
|
|
94
|
+
},
|
|
95
|
+
"storybook": {
|
|
96
|
+
"displayName": "Astro",
|
|
97
|
+
"icon": "https://raw.githubusercontent.com/withastro/astro/main/assets/brand/logo.svg",
|
|
98
|
+
"unsupportedFrameworks": []
|
|
99
|
+
}
|
|
100
|
+
}
|