@stencil/storybook-plugin 0.2.0 → 0.4.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 +8 -0
- package/dist/docs/index.cjs +4 -0
- package/dist/docs/index.d.cts +12 -0
- package/dist/docs/index.d.ts +12 -0
- package/dist/docs/index.js +3 -0
- package/dist/docs-0uSy55NI.cjs +54 -0
- package/dist/docs-0uSy55NI.cjs.map +1 -0
- package/dist/docs-BTql9Bpv.js +42 -0
- package/dist/docs-BTql9Bpv.js.map +1 -0
- package/dist/{preview-Dn8QZb01.js → entry-preview-CajE0iDc.js} +12 -8
- package/dist/entry-preview-CajE0iDc.js.map +1 -0
- package/dist/{preview-D_4Gl5tg.cjs → entry-preview-DIDFrQZ9.cjs} +21 -11
- package/dist/entry-preview-DIDFrQZ9.cjs.map +1 -0
- package/dist/entry-preview-docs.cjs +18 -0
- package/dist/entry-preview-docs.cjs.map +1 -0
- package/dist/entry-preview-docs.d.cts +20 -0
- package/dist/entry-preview-docs.d.ts +20 -0
- package/dist/entry-preview-docs.js +16 -0
- package/dist/entry-preview-docs.js.map +1 -0
- package/dist/entry-preview.cjs +6 -0
- package/dist/entry-preview.d.cts +17 -0
- package/dist/entry-preview.d.ts +17 -0
- package/dist/entry-preview.js +3 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/preset.cjs +4 -4
- package/dist/preset.cjs.map +1 -1
- package/dist/preset.d.cts +1 -1
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +4 -4
- package/dist/preset.js.map +1 -1
- package/dist/{rollup-parseAst-t-4tfMPG.d.ts → rollup-parseAst-DXE9IfcK.d.ts} +1 -1
- package/dist/{types-CR2AtVj_.d.cts → types-BjBqnnWi.d.cts} +2 -2
- package/dist/{types-DoLyzAU3.d.ts → types-Dzw-ZY4t.d.ts} +2 -2
- package/package.json +9 -9
- package/preset.js +1 -1
- package/dist/preview-D_4Gl5tg.cjs.map +0 -1
- package/dist/preview-Dn8QZb01.js.map +0 -1
- package/dist/preview.cjs +0 -5
- package/dist/preview.d.cts +0 -18
- package/dist/preview.d.ts +0 -18
- package/dist/preview.js +0 -3
package/README.md
CHANGED
|
@@ -105,6 +105,14 @@ export const Primary: Story = {
|
|
|
105
105
|
};
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
+
### Troubleshooting
|
|
109
|
+
|
|
110
|
+
If you encounter any issues with the story rendering, please check the following:
|
|
111
|
+
|
|
112
|
+
- If your `customElementsExportBehavior` is set to a value that lazy loads components, ensure that you are using `defineCustomElements()` in `preview.ts`. You should also define your component as a string in your story file: `component: 'my-component'` as it does not yet exist in the custom element registry.
|
|
113
|
+
- If your `customElementsExportBehavior` is set to a value like `auto-define-custom-elements` or `default`, do not include `defineCustomElements()` in `preview.ts` and use the constructor as the component value in your story file: `component: MyComponent`.
|
|
114
|
+
- Check the console for any error messages.
|
|
115
|
+
|
|
108
116
|
## Limitations
|
|
109
117
|
|
|
110
118
|
This is early development and we are still seeing some limitations we want to see fixed:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StencilRenderer } from "../types-BjBqnnWi.cjs";
|
|
2
|
+
import { VNode } from "@stencil/core";
|
|
3
|
+
import { DecoratorFunction } from "storybook/internal/types";
|
|
4
|
+
|
|
5
|
+
//#region src/docs/render-html.d.ts
|
|
6
|
+
declare const renderHTML: (vnode: VNode) => string;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/docs/source-decorator.d.ts
|
|
9
|
+
declare const sourceDecorator: DecoratorFunction<StencilRenderer<unknown>>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { renderHTML, sourceDecorator };
|
|
12
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StencilRenderer } from "../types-Dzw-ZY4t.js";
|
|
2
|
+
import { VNode } from "@stencil/core";
|
|
3
|
+
import { DecoratorFunction } from "storybook/internal/types";
|
|
4
|
+
|
|
5
|
+
//#region src/docs/render-html.d.ts
|
|
6
|
+
declare const renderHTML: (vnode: VNode) => string;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/docs/source-decorator.d.ts
|
|
9
|
+
declare const sourceDecorator: DecoratorFunction<StencilRenderer<unknown>>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { renderHTML, sourceDecorator };
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
+
const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
|
|
3
|
+
const storybook_internal_preview_api = require_chunk.__toESM(require("storybook/internal/preview-api"));
|
|
4
|
+
|
|
5
|
+
//#region src/docs/render-html.ts
|
|
6
|
+
function vnodeToHtml(node, indentLevel = 0) {
|
|
7
|
+
const indent = " ".repeat(indentLevel);
|
|
8
|
+
if (node.$text$ !== null) return indent + node.$text$;
|
|
9
|
+
if (node.$tag$ === null) return "";
|
|
10
|
+
const tag = node.$tag$;
|
|
11
|
+
const attrs = node.$attrs$ ? Object.entries(node.$attrs$).filter(([_, value]) => value !== void 0).map(([key, value]) => ` ${key}="${value}"`).join("") : "";
|
|
12
|
+
const children = node.$children$ ?? [];
|
|
13
|
+
if (children.length === 0) return `${indent}<${tag}${attrs}></${tag}>`;
|
|
14
|
+
const childrenHtml = children.map((child) => vnodeToHtml(child, indentLevel + 1)).join("\n");
|
|
15
|
+
return `${indent}<${tag}${attrs}>\n${childrenHtml}\n${indent}</${tag}>`;
|
|
16
|
+
}
|
|
17
|
+
const renderHTML = (vnode) => {
|
|
18
|
+
return vnodeToHtml(vnode);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/docs/source-decorator.ts
|
|
23
|
+
const skip = (context) => {
|
|
24
|
+
const sourceParams = context?.parameters.docs?.source;
|
|
25
|
+
const isArgsStory = context?.parameters.__isArgsStory;
|
|
26
|
+
if (sourceParams.type === storybook_internal_docs_tools.SourceType.DYNAMIC) return false;
|
|
27
|
+
return !isArgsStory || sourceParams?.code || sourceParams?.type === storybook_internal_docs_tools.SourceType.CODE;
|
|
28
|
+
};
|
|
29
|
+
const sourceDecorator = (storyFn, context) => {
|
|
30
|
+
const story = storyFn();
|
|
31
|
+
(0, storybook_internal_preview_api.useEffect)(() => {
|
|
32
|
+
const renderedForSource = context?.parameters.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context) : story;
|
|
33
|
+
if (skip(context)) return;
|
|
34
|
+
switch (context.parameters.docs.source.language) {
|
|
35
|
+
case "html": (0, storybook_internal_preview_api.emitTransformCode)(renderHTML(renderedForSource), context);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return story;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
Object.defineProperty(exports, 'renderHTML', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return renderHTML;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, 'sourceDecorator', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return sourceDecorator;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=docs-0uSy55NI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-0uSy55NI.cjs","names":["node: VNode","vnode: VNode","context: Parameters<DecoratorFunction<StencilRenderer<unknown>>>[1]","SourceType","sourceDecorator: DecoratorFunction<StencilRenderer<unknown>>"],"sources":["../src/docs/render-html.ts","../src/docs/source-decorator.ts"],"sourcesContent":["import { type VNode } from '@stencil/core';\n\nfunction vnodeToHtml(node: VNode, indentLevel = 0): string {\n const indent = ' '.repeat(indentLevel);\n\n if (node.$text$ !== null) {\n return indent + node.$text$;\n }\n\n if (node.$tag$ === null) {\n return '';\n }\n\n const tag = node.$tag$;\n\n const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => ` ${key}=\"${value}\"`)\n .join('')\n : '';\n\n const children = node.$children$ ?? [];\n\n if (children.length === 0) {\n return `${indent}<${tag}${attrs}></${tag}>`;\n }\n\n const childrenHtml = children.map((child) => vnodeToHtml(child, indentLevel + 1)).join('\\n');\n\n return `${indent}<${tag}${attrs}>\\n${childrenHtml}\\n${indent}</${tag}>`;\n}\n\nexport const renderHTML = (vnode: VNode) => {\n return vnodeToHtml(vnode);\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect } from 'storybook/internal/preview-api';\nimport type { AnnotatedStoryFn, Args, DecoratorFunction } from 'storybook/internal/types';\nimport type { StencilRenderer } from '../types';\nimport { renderHTML } from './render-html';\n\ntype StoryFn<TArgs = Args> = AnnotatedStoryFn<StencilRenderer<unknown>, TArgs>;\n\nconst skip = (context: Parameters<DecoratorFunction<StencilRenderer<unknown>>>[1]) => {\n const sourceParams = context?.parameters.docs?.source;\n const isArgsStory = context?.parameters.__isArgsStory;\n\n if (sourceParams.type === SourceType.DYNAMIC) return false;\n\n return !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;\n};\n\nexport const sourceDecorator: DecoratorFunction<StencilRenderer<unknown>> = (storyFn, context) => {\n const story = storyFn();\n\n useEffect(() => {\n const renderedForSource = context?.parameters.docs?.source?.excludeDecorators\n ? (context.originalStoryFn as StoryFn)(context.args, context)\n : story;\n\n if (skip(context)) return;\n\n switch (context.parameters.docs.source.language) {\n case 'html': {\n emitTransformCode(renderHTML(renderedForSource), context);\n }\n }\n });\n\n return story;\n};\n"],"mappings":";;;;;AAEA,SAAS,YAAYA,MAAa,cAAc,GAAW;CACzD,MAAM,SAAS,KAAK,OAAO,YAAY;AAEvC,KAAI,KAAK,WAAW,KAClB,QAAO,SAAS,KAAK;AAGvB,KAAI,KAAK,UAAU,KACjB,QAAO;CAGT,MAAM,MAAM,KAAK;CAEjB,MAAM,QAAQ,KAAK,UACf,OAAO,QAAQ,KAAK,QAAQ,CACzB,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,iBAAoB,CAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM,GAAG,IAAI,IAAI,MAAM,GAAG,CAC3C,KAAK,GAAG,GACX;CAEJ,MAAM,WAAW,KAAK,cAAc,CAAE;AAEtC,KAAI,SAAS,WAAW,EACtB,SAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,KAAK,IAAI;CAG3C,MAAM,eAAe,SAAS,IAAI,CAAC,UAAU,YAAY,OAAO,cAAc,EAAE,CAAC,CAAC,KAAK,KAAK;AAE5F,SAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,KAAK,aAAa,IAAI,OAAO,IAAI,IAAI;AACtE;AAED,MAAa,aAAa,CAACC,UAAiB;AAC1C,QAAO,YAAY,MAAM;AAC1B;;;;AC3BD,MAAM,OAAO,CAACC,YAAwE;CACpF,MAAM,eAAe,SAAS,WAAW,MAAM;CAC/C,MAAM,cAAc,SAAS,WAAW;AAExC,KAAI,aAAa,SAASC,yCAAW,QAAS,QAAO;AAErD,SAAQ,eAAe,cAAc,QAAQ,cAAc,SAASA,yCAAW;AAChF;AAED,MAAaC,kBAA+D,CAAC,SAAS,YAAY;CAChG,MAAM,QAAQ,SAAS;AAEvB,+CAAU,MAAM;EACd,MAAM,oBAAoB,SAAS,WAAW,MAAM,QAAQ,oBACxD,AAAC,QAAQ,gBAA4B,QAAQ,MAAM,QAAQ,GAC3D;AAEJ,MAAI,KAAK,QAAQ,CAAE;AAEnB,UAAQ,QAAQ,WAAW,KAAK,OAAO,UAAvC;GACE,KAAK,OACH,uDAAkB,WAAW,kBAAkB,EAAE,QAAQ;EAE5D;CACF,EAAC;AAEF,QAAO;AACR"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SourceType } from "storybook/internal/docs-tools";
|
|
2
|
+
import { emitTransformCode, useEffect } from "storybook/internal/preview-api";
|
|
3
|
+
|
|
4
|
+
//#region src/docs/render-html.ts
|
|
5
|
+
function vnodeToHtml(node, indentLevel = 0) {
|
|
6
|
+
const indent = " ".repeat(indentLevel);
|
|
7
|
+
if (node.$text$ !== null) return indent + node.$text$;
|
|
8
|
+
if (node.$tag$ === null) return "";
|
|
9
|
+
const tag = node.$tag$;
|
|
10
|
+
const attrs = node.$attrs$ ? Object.entries(node.$attrs$).filter(([_, value]) => value !== void 0).map(([key, value]) => ` ${key}="${value}"`).join("") : "";
|
|
11
|
+
const children = node.$children$ ?? [];
|
|
12
|
+
if (children.length === 0) return `${indent}<${tag}${attrs}></${tag}>`;
|
|
13
|
+
const childrenHtml = children.map((child) => vnodeToHtml(child, indentLevel + 1)).join("\n");
|
|
14
|
+
return `${indent}<${tag}${attrs}>\n${childrenHtml}\n${indent}</${tag}>`;
|
|
15
|
+
}
|
|
16
|
+
const renderHTML = (vnode) => {
|
|
17
|
+
return vnodeToHtml(vnode);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/docs/source-decorator.ts
|
|
22
|
+
const skip = (context) => {
|
|
23
|
+
const sourceParams = context?.parameters.docs?.source;
|
|
24
|
+
const isArgsStory = context?.parameters.__isArgsStory;
|
|
25
|
+
if (sourceParams.type === SourceType.DYNAMIC) return false;
|
|
26
|
+
return !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;
|
|
27
|
+
};
|
|
28
|
+
const sourceDecorator = (storyFn, context) => {
|
|
29
|
+
const story = storyFn();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const renderedForSource = context?.parameters.docs?.source?.excludeDecorators ? context.originalStoryFn(context.args, context) : story;
|
|
32
|
+
if (skip(context)) return;
|
|
33
|
+
switch (context.parameters.docs.source.language) {
|
|
34
|
+
case "html": emitTransformCode(renderHTML(renderedForSource), context);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return story;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { renderHTML, sourceDecorator };
|
|
42
|
+
//# sourceMappingURL=docs-BTql9Bpv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-BTql9Bpv.js","names":["node: VNode","vnode: VNode","context: Parameters<DecoratorFunction<StencilRenderer<unknown>>>[1]","sourceDecorator: DecoratorFunction<StencilRenderer<unknown>>"],"sources":["../src/docs/render-html.ts","../src/docs/source-decorator.ts"],"sourcesContent":["import { type VNode } from '@stencil/core';\n\nfunction vnodeToHtml(node: VNode, indentLevel = 0): string {\n const indent = ' '.repeat(indentLevel);\n\n if (node.$text$ !== null) {\n return indent + node.$text$;\n }\n\n if (node.$tag$ === null) {\n return '';\n }\n\n const tag = node.$tag$;\n\n const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => ` ${key}=\"${value}\"`)\n .join('')\n : '';\n\n const children = node.$children$ ?? [];\n\n if (children.length === 0) {\n return `${indent}<${tag}${attrs}></${tag}>`;\n }\n\n const childrenHtml = children.map((child) => vnodeToHtml(child, indentLevel + 1)).join('\\n');\n\n return `${indent}<${tag}${attrs}>\\n${childrenHtml}\\n${indent}</${tag}>`;\n}\n\nexport const renderHTML = (vnode: VNode) => {\n return vnodeToHtml(vnode);\n};\n","import { SourceType } from 'storybook/internal/docs-tools';\nimport { emitTransformCode, useEffect } from 'storybook/internal/preview-api';\nimport type { AnnotatedStoryFn, Args, DecoratorFunction } from 'storybook/internal/types';\nimport type { StencilRenderer } from '../types';\nimport { renderHTML } from './render-html';\n\ntype StoryFn<TArgs = Args> = AnnotatedStoryFn<StencilRenderer<unknown>, TArgs>;\n\nconst skip = (context: Parameters<DecoratorFunction<StencilRenderer<unknown>>>[1]) => {\n const sourceParams = context?.parameters.docs?.source;\n const isArgsStory = context?.parameters.__isArgsStory;\n\n if (sourceParams.type === SourceType.DYNAMIC) return false;\n\n return !isArgsStory || sourceParams?.code || sourceParams?.type === SourceType.CODE;\n};\n\nexport const sourceDecorator: DecoratorFunction<StencilRenderer<unknown>> = (storyFn, context) => {\n const story = storyFn();\n\n useEffect(() => {\n const renderedForSource = context?.parameters.docs?.source?.excludeDecorators\n ? (context.originalStoryFn as StoryFn)(context.args, context)\n : story;\n\n if (skip(context)) return;\n\n switch (context.parameters.docs.source.language) {\n case 'html': {\n emitTransformCode(renderHTML(renderedForSource), context);\n }\n }\n });\n\n return story;\n};\n"],"mappings":";;;;AAEA,SAAS,YAAYA,MAAa,cAAc,GAAW;CACzD,MAAM,SAAS,KAAK,OAAO,YAAY;AAEvC,KAAI,KAAK,WAAW,KAClB,QAAO,SAAS,KAAK;AAGvB,KAAI,KAAK,UAAU,KACjB,QAAO;CAGT,MAAM,MAAM,KAAK;CAEjB,MAAM,QAAQ,KAAK,UACf,OAAO,QAAQ,KAAK,QAAQ,CACzB,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,iBAAoB,CAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM,GAAG,IAAI,IAAI,MAAM,GAAG,CAC3C,KAAK,GAAG,GACX;CAEJ,MAAM,WAAW,KAAK,cAAc,CAAE;AAEtC,KAAI,SAAS,WAAW,EACtB,SAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,KAAK,IAAI;CAG3C,MAAM,eAAe,SAAS,IAAI,CAAC,UAAU,YAAY,OAAO,cAAc,EAAE,CAAC,CAAC,KAAK,KAAK;AAE5F,SAAQ,EAAE,OAAO,GAAG,IAAI,EAAE,MAAM,KAAK,aAAa,IAAI,OAAO,IAAI,IAAI;AACtE;AAED,MAAa,aAAa,CAACC,UAAiB;AAC1C,QAAO,YAAY,MAAM;AAC1B;;;;AC3BD,MAAM,OAAO,CAACC,YAAwE;CACpF,MAAM,eAAe,SAAS,WAAW,MAAM;CAC/C,MAAM,cAAc,SAAS,WAAW;AAExC,KAAI,aAAa,SAAS,WAAW,QAAS,QAAO;AAErD,SAAQ,eAAe,cAAc,QAAQ,cAAc,SAAS,WAAW;AAChF;AAED,MAAaC,kBAA+D,CAAC,SAAS,YAAY;CAChG,MAAM,QAAQ,SAAS;AAEvB,WAAU,MAAM;EACd,MAAM,oBAAoB,SAAS,WAAW,MAAM,QAAQ,oBACxD,AAAC,QAAQ,gBAA4B,QAAQ,MAAM,QAAQ,GAC3D;AAEJ,MAAI,KAAK,QAAQ,CAAE;AAEnB,UAAQ,QAAQ,WAAW,KAAK,OAAO,UAAvC;GACE,KAAK,OACH,mBAAkB,WAAW,kBAAkB,EAAE,QAAQ;EAE5D;CACF,EAAC;AAEF,QAAO;AACR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { enhanceArgTypes } from "storybook/internal/docs-tools";
|
|
2
2
|
import { h, render } from "@stencil/core";
|
|
3
|
+
import { simulatePageLoad } from "storybook/preview-api";
|
|
3
4
|
|
|
4
5
|
//#region rolldown:runtime
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
@@ -15,8 +16,9 @@ var __export = (target, all) => {
|
|
|
15
16
|
const render$1 = (args, context) => {
|
|
16
17
|
const { component, parameters: parameters$1 } = context;
|
|
17
18
|
if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
|
|
18
|
-
|
|
19
|
-
if (!
|
|
19
|
+
if (typeof component === "string" && !customElements.get(component)) throw new Error(`Stencil component not found. If you are not lazy loading your components with \`defineCustomElements()\` in preview.ts, pass a constructor value for component in your story \`component: MyComponent\``);
|
|
20
|
+
else if (typeof component !== "string" && !customElements.getName(component)) throw new Error(`Stencil component not found. If you are lazy loading your components with \`defineCustomElements()\` in preview.ts, pass a string value for component in your story \`component: 'my-component'\``);
|
|
21
|
+
const cmpName = typeof component === "string" ? component : customElements.getName(component);
|
|
20
22
|
const children = Object.entries(parameters$1.slots || []).map(([key, value]) => {
|
|
21
23
|
const slot = key === "default" ? void 0 : key;
|
|
22
24
|
const child = typeof value === "string" ? h(void 0, { slot }, value) : {
|
|
@@ -44,15 +46,17 @@ function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
//#endregion
|
|
47
|
-
//#region src/preview.ts
|
|
48
|
-
var
|
|
49
|
-
__export(
|
|
49
|
+
//#region src/entry-preview.ts
|
|
50
|
+
var entry_preview_exports = {};
|
|
51
|
+
__export(entry_preview_exports, {
|
|
52
|
+
argTypesEnhancers: () => argTypesEnhancers,
|
|
50
53
|
parameters: () => parameters,
|
|
51
54
|
render: () => render$1,
|
|
52
55
|
renderToCanvas: () => renderToCanvas
|
|
53
56
|
});
|
|
54
57
|
const parameters = { renderer: "stencil" };
|
|
58
|
+
const argTypesEnhancers = [enhanceArgTypes];
|
|
55
59
|
|
|
56
60
|
//#endregion
|
|
57
|
-
export {
|
|
58
|
-
//# sourceMappingURL=preview-
|
|
61
|
+
export { argTypesEnhancers, entry_preview_exports, parameters, render$1 as render, renderToCanvas };
|
|
62
|
+
//# sourceMappingURL=entry-preview-CajE0iDc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-preview-CajE0iDc.js","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: Parameters","argTypesEnhancers: ArgTypesEnhancer[]"],"sources":["../src/render.ts","../src/entry-preview.ts"],"sourcesContent":["import { h, render as renderStencil, VNode } from '@stencil/core';\nimport { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n if (typeof component === 'string' && !customElements.get(component)) {\n throw new Error(\n `Stencil component not found. If you are not lazy loading your components with \\`defineCustomElements()\\` in preview.ts, pass a constructor value for component in your story \\`component: MyComponent\\``,\n );\n } else if (typeof component !== 'string' && !customElements.getName(component)) {\n throw new Error(\n `Stencil component not found. If you are lazy loading your components with \\`defineCustomElements()\\` in preview.ts, pass a string value for component in your story \\`component: 'my-component'\\``,\n );\n }\n const cmpName = typeof component === 'string' ? component : customElements.getName(component);\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","import { enhanceArgTypes } from 'storybook/internal/docs-tools';\nimport type { ArgTypesEnhancer } from 'storybook/internal/types';\nimport type { Parameters } from './types';\n\nexport const parameters: Parameters = { renderer: 'stencil' };\n\nexport { render, renderToCanvas } from './render';\n\nexport const argTypesEnhancers: ArgTypesEnhancer[] = [enhanceArgTypes];\n"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAaA,WAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;AAElB,YAAW,cAAc,aAAa,eAAe,IAAI,UAAU,CACjE,OAAM,IAAI,OACP;iBAEa,cAAc,aAAa,eAAe,QAAQ,UAAU,CAC5E,OAAM,IAAI,OACP;CAGL,MAAM,iBAAiB,cAAc,WAAW,YAAY,eAAe,QAAQ,UAAU;CAE7F,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,UAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,EAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,QAAc,MAAM,QAAQ;AAC5B,kBAAiB,QAAQ;AAC1B;;;;;;;;;;;AC/DD,MAAaC,aAAyB,EAAE,UAAU,UAAW;AAI7D,MAAaC,oBAAwC,CAAC,eAAgB"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
-
const
|
|
2
|
+
const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
|
|
3
3
|
const __stencil_core = require_chunk.__toESM(require("@stencil/core"));
|
|
4
|
+
const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
|
|
4
5
|
|
|
5
6
|
//#region src/render.ts
|
|
6
7
|
const render = (args, context) => {
|
|
7
8
|
const { component, parameters: parameters$1 } = context;
|
|
8
9
|
if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
|
|
9
|
-
|
|
10
|
-
if (!
|
|
10
|
+
if (typeof component === "string" && !customElements.get(component)) throw new Error(`Stencil component not found. If you are not lazy loading your components with \`defineCustomElements()\` in preview.ts, pass a constructor value for component in your story \`component: MyComponent\``);
|
|
11
|
+
else if (typeof component !== "string" && !customElements.getName(component)) throw new Error(`Stencil component not found. If you are lazy loading your components with \`defineCustomElements()\` in preview.ts, pass a string value for component in your story \`component: 'my-component'\``);
|
|
12
|
+
const cmpName = typeof component === "string" ? component : customElements.getName(component);
|
|
11
13
|
const children = Object.entries(parameters$1.slots || []).map(([key, value]) => {
|
|
12
14
|
const slot = key === "default" ? void 0 : key;
|
|
13
15
|
const child = typeof value === "string" ? (0, __stencil_core.h)(void 0, { slot }, value) : {
|
|
@@ -35,26 +37,34 @@ function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
//#endregion
|
|
38
|
-
//#region src/preview.ts
|
|
39
|
-
var
|
|
40
|
-
require_chunk.__export(
|
|
40
|
+
//#region src/entry-preview.ts
|
|
41
|
+
var entry_preview_exports = {};
|
|
42
|
+
require_chunk.__export(entry_preview_exports, {
|
|
43
|
+
argTypesEnhancers: () => argTypesEnhancers,
|
|
41
44
|
parameters: () => parameters,
|
|
42
45
|
render: () => render,
|
|
43
46
|
renderToCanvas: () => renderToCanvas
|
|
44
47
|
});
|
|
45
48
|
const parameters = { renderer: "stencil" };
|
|
49
|
+
const argTypesEnhancers = [storybook_internal_docs_tools.enhanceArgTypes];
|
|
46
50
|
|
|
47
51
|
//#endregion
|
|
48
|
-
Object.defineProperty(exports, '
|
|
52
|
+
Object.defineProperty(exports, 'argTypesEnhancers', {
|
|
49
53
|
enumerable: true,
|
|
50
54
|
get: function () {
|
|
51
|
-
return
|
|
55
|
+
return argTypesEnhancers;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, 'entry_preview_exports', {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return entry_preview_exports;
|
|
52
62
|
}
|
|
53
63
|
});
|
|
54
|
-
Object.defineProperty(exports, '
|
|
64
|
+
Object.defineProperty(exports, 'parameters', {
|
|
55
65
|
enumerable: true,
|
|
56
66
|
get: function () {
|
|
57
|
-
return
|
|
67
|
+
return parameters;
|
|
58
68
|
}
|
|
59
69
|
});
|
|
60
70
|
Object.defineProperty(exports, 'render', {
|
|
@@ -69,4 +79,4 @@ Object.defineProperty(exports, 'renderToCanvas', {
|
|
|
69
79
|
return renderToCanvas;
|
|
70
80
|
}
|
|
71
81
|
});
|
|
72
|
-
//# sourceMappingURL=preview-
|
|
82
|
+
//# sourceMappingURL=entry-preview-DIDFrQZ9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-preview-DIDFrQZ9.cjs","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: Parameters","argTypesEnhancers: ArgTypesEnhancer[]","enhanceArgTypes"],"sources":["../src/render.ts","../src/entry-preview.ts"],"sourcesContent":["import { h, render as renderStencil, VNode } from '@stencil/core';\nimport { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n if (typeof component === 'string' && !customElements.get(component)) {\n throw new Error(\n `Stencil component not found. If you are not lazy loading your components with \\`defineCustomElements()\\` in preview.ts, pass a constructor value for component in your story \\`component: MyComponent\\``,\n );\n } else if (typeof component !== 'string' && !customElements.getName(component)) {\n throw new Error(\n `Stencil component not found. If you are lazy loading your components with \\`defineCustomElements()\\` in preview.ts, pass a string value for component in your story \\`component: 'my-component'\\``,\n );\n }\n const cmpName = typeof component === 'string' ? component : customElements.getName(component);\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","import { enhanceArgTypes } from 'storybook/internal/docs-tools';\nimport type { ArgTypesEnhancer } from 'storybook/internal/types';\nimport type { Parameters } from './types';\n\nexport const parameters: Parameters = { renderer: 'stencil' };\n\nexport { render, renderToCanvas } from './render';\n\nexport const argTypesEnhancers: ArgTypesEnhancer[] = [enhanceArgTypes];\n"],"mappings":";;;;;;AAMA,MAAaA,SAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;AAElB,YAAW,cAAc,aAAa,eAAe,IAAI,UAAU,CACjE,OAAM,IAAI,OACP;iBAEa,cAAc,aAAa,eAAe,QAAQ,UAAU,CAC5E,OAAM,IAAI,OACP;CAGL,MAAM,iBAAiB,cAAc,WAAW,YAAY,eAAe,QAAQ,UAAU;CAE7F,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,8BAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,sBAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,4BAAc,MAAM,QAAQ;AAC5B,6CAAiB,QAAQ;AAC1B;;;;;;;;;;;AC/DD,MAAaC,aAAyB,EAAE,UAAU,UAAW;AAI7D,MAAaC,oBAAwC,CAACC,6CAAgB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
+
const require_docs = require('./docs-0uSy55NI.cjs');
|
|
3
|
+
const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
|
|
4
|
+
|
|
5
|
+
//#region src/entry-preview-docs.ts
|
|
6
|
+
const decorators = [require_docs.sourceDecorator];
|
|
7
|
+
const parameters = { docs: {
|
|
8
|
+
story: { inline: true },
|
|
9
|
+
source: {
|
|
10
|
+
type: storybook_internal_docs_tools.SourceType.DYNAMIC,
|
|
11
|
+
language: "html"
|
|
12
|
+
}
|
|
13
|
+
} };
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.decorators = decorators;
|
|
17
|
+
exports.parameters = parameters;
|
|
18
|
+
//# sourceMappingURL=entry-preview-docs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-preview-docs.cjs","names":["decorators: DecoratorFunction<StencilRenderer<unknown>>[]","sourceDecorator","SourceType"],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":["import { SourceType } from 'storybook/internal/docs-tools';\nimport type { DecoratorFunction } from 'storybook/internal/types';\n\nimport { sourceDecorator } from './docs';\nimport type { StencilRenderer } from './types';\n\nexport const decorators: DecoratorFunction<StencilRenderer<unknown>>[] = [sourceDecorator];\n\nexport const parameters = {\n docs: {\n story: { inline: true },\n source: {\n type: SourceType.DYNAMIC,\n language: 'html',\n },\n },\n};\n"],"mappings":";;;;;AAMA,MAAaA,aAA4D,CAACC,4BAAgB;AAE1F,MAAa,aAAa,EACxB,MAAM;CACJ,OAAO,EAAE,QAAQ,KAAM;CACvB,QAAQ;EACN,MAAMC,yCAAW;EACjB,UAAU;CACX;AACF,EACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StencilRenderer } from "./types-BjBqnnWi.cjs";
|
|
2
|
+
import { DecoratorFunction } from "storybook/internal/types";
|
|
3
|
+
import { SourceType } from "storybook/internal/docs-tools";
|
|
4
|
+
|
|
5
|
+
//#region src/entry-preview-docs.d.ts
|
|
6
|
+
declare const decorators: DecoratorFunction<StencilRenderer<unknown>>[];
|
|
7
|
+
declare const parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
story: {
|
|
10
|
+
inline: boolean;
|
|
11
|
+
};
|
|
12
|
+
source: {
|
|
13
|
+
type: SourceType;
|
|
14
|
+
language: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { decorators, parameters };
|
|
20
|
+
//# sourceMappingURL=entry-preview-docs.d.cts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StencilRenderer } from "./types-Dzw-ZY4t.js";
|
|
2
|
+
import { SourceType } from "storybook/internal/docs-tools";
|
|
3
|
+
import { DecoratorFunction } from "storybook/internal/types";
|
|
4
|
+
|
|
5
|
+
//#region src/entry-preview-docs.d.ts
|
|
6
|
+
declare const decorators: DecoratorFunction<StencilRenderer<unknown>>[];
|
|
7
|
+
declare const parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
story: {
|
|
10
|
+
inline: boolean;
|
|
11
|
+
};
|
|
12
|
+
source: {
|
|
13
|
+
type: SourceType;
|
|
14
|
+
language: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { decorators, parameters };
|
|
20
|
+
//# sourceMappingURL=entry-preview-docs.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { sourceDecorator } from "./docs-BTql9Bpv.js";
|
|
2
|
+
import { SourceType } from "storybook/internal/docs-tools";
|
|
3
|
+
|
|
4
|
+
//#region src/entry-preview-docs.ts
|
|
5
|
+
const decorators = [sourceDecorator];
|
|
6
|
+
const parameters = { docs: {
|
|
7
|
+
story: { inline: true },
|
|
8
|
+
source: {
|
|
9
|
+
type: SourceType.DYNAMIC,
|
|
10
|
+
language: "html"
|
|
11
|
+
}
|
|
12
|
+
} };
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { decorators, parameters };
|
|
16
|
+
//# sourceMappingURL=entry-preview-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-preview-docs.js","names":["decorators: DecoratorFunction<StencilRenderer<unknown>>[]"],"sources":["../src/entry-preview-docs.ts"],"sourcesContent":["import { SourceType } from 'storybook/internal/docs-tools';\nimport type { DecoratorFunction } from 'storybook/internal/types';\n\nimport { sourceDecorator } from './docs';\nimport type { StencilRenderer } from './types';\n\nexport const decorators: DecoratorFunction<StencilRenderer<unknown>>[] = [sourceDecorator];\n\nexport const parameters = {\n docs: {\n story: { inline: true },\n source: {\n type: SourceType.DYNAMIC,\n language: 'html',\n },\n },\n};\n"],"mappings":";;;;AAMA,MAAaA,aAA4D,CAAC,eAAgB;AAE1F,MAAa,aAAa,EACxB,MAAM;CACJ,OAAO,EAAE,QAAQ,KAAM;CACvB,QAAQ;EACN,MAAM,WAAW;EACjB,UAAU;CACX;AACF,EACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const require_entry_preview = require('./entry-preview-DIDFrQZ9.cjs');
|
|
2
|
+
|
|
3
|
+
exports.argTypesEnhancers = require_entry_preview.argTypesEnhancers;
|
|
4
|
+
exports.parameters = require_entry_preview.parameters;
|
|
5
|
+
exports.render = require_entry_preview.render;
|
|
6
|
+
exports.renderToCanvas = require_entry_preview.renderToCanvas;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Parameters, StencilRenderer } from "./types-BjBqnnWi.cjs";
|
|
2
|
+
import { ArgTypesEnhancer, ArgsStoryFn, RenderContext } from "storybook/internal/types";
|
|
3
|
+
|
|
4
|
+
//#region src/render.d.ts
|
|
5
|
+
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
+
declare function renderToCanvas({
|
|
7
|
+
storyFn,
|
|
8
|
+
showMain,
|
|
9
|
+
storyContext
|
|
10
|
+
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/entry-preview.d.ts
|
|
13
|
+
declare const parameters: Parameters;
|
|
14
|
+
declare const argTypesEnhancers: ArgTypesEnhancer[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { argTypesEnhancers, parameters, render, renderToCanvas };
|
|
17
|
+
//# sourceMappingURL=entry-preview.d.cts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Parameters, StencilRenderer } from "./types-Dzw-ZY4t.js";
|
|
2
|
+
import { ArgTypesEnhancer, ArgsStoryFn, RenderContext } from "storybook/internal/types";
|
|
3
|
+
|
|
4
|
+
//#region src/render.d.ts
|
|
5
|
+
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
+
declare function renderToCanvas({
|
|
7
|
+
storyFn,
|
|
8
|
+
showMain,
|
|
9
|
+
storyContext
|
|
10
|
+
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/entry-preview.d.ts
|
|
13
|
+
declare const parameters: Parameters;
|
|
14
|
+
declare const argTypesEnhancers: ArgTypesEnhancer[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { argTypesEnhancers, parameters, render, renderToCanvas };
|
|
17
|
+
//# sourceMappingURL=entry-preview.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_entry_preview = require('./entry-preview-DIDFrQZ9.cjs');
|
|
3
3
|
const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
|
|
4
4
|
|
|
5
5
|
//#region src/portable-stories.tsx
|
|
@@ -23,7 +23,7 @@ const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-a
|
|
|
23
23
|
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
|
24
24
|
*/
|
|
25
25
|
function setProjectAnnotations(projectAnnotations) {
|
|
26
|
-
(0, storybook_preview_api.setDefaultProjectAnnotations)(
|
|
26
|
+
(0, storybook_preview_api.setDefaultProjectAnnotations)(require_entry_preview.entry_preview_exports);
|
|
27
27
|
return (0, storybook_preview_api.setProjectAnnotations)(projectAnnotations);
|
|
28
28
|
}
|
|
29
29
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,yDAA6BC,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './entry-preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,yDAA6BC,4CAAmB;AAChD,QAAO,iDAA8B,mBAAmB;AACzD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-
|
|
1
|
+
import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-BjBqnnWi.cjs";
|
|
2
2
|
import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
|
|
3
3
|
|
|
4
4
|
//#region @types/rollup-parseAst.d.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./rollup-parseAst-
|
|
2
|
-
import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-
|
|
1
|
+
import "./rollup-parseAst-DXE9IfcK.js";
|
|
2
|
+
import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-Dzw-ZY4t.js";
|
|
3
3
|
import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
|
|
4
4
|
|
|
5
5
|
//#region src/portable-stories.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./rollup-parseAst-
|
|
1
|
+
import { entry_preview_exports } from "./entry-preview-CajE0iDc.js";
|
|
2
|
+
import "./rollup-parseAst-DXE9IfcK.d.ts";
|
|
3
3
|
import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnotations$1 } from "storybook/preview-api";
|
|
4
4
|
|
|
5
5
|
//#region src/portable-stories.tsx
|
|
@@ -23,7 +23,7 @@ import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnota
|
|
|
23
23
|
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
|
24
24
|
*/
|
|
25
25
|
function setProjectAnnotations(projectAnnotations) {
|
|
26
|
-
setDefaultProjectAnnotations(
|
|
26
|
+
setDefaultProjectAnnotations(entry_preview_exports);
|
|
27
27
|
return setProjectAnnotations$1(projectAnnotations);
|
|
28
28
|
}
|
|
29
29
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,8BAA6BC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './entry-preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,8BAA6BC,sBAAmB;AAChD,QAAO,wBAA8B,mBAAmB;AACzD"}
|
package/dist/node/index.d.cts
CHANGED
package/dist/node/index.d.ts
CHANGED
package/dist/preset.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
-
const path = require_chunk.__toESM(require("path"));
|
|
3
2
|
const module$1 = require_chunk.__toESM(require("module"));
|
|
3
|
+
const path = require_chunk.__toESM(require("path"));
|
|
4
4
|
const url = require_chunk.__toESM(require("url"));
|
|
5
|
-
const vite = require_chunk.__toESM(require("vite"));
|
|
6
5
|
const unplugin_stencil_vite = require_chunk.__toESM(require("unplugin-stencil/vite"));
|
|
6
|
+
const vite = require_chunk.__toESM(require("vite"));
|
|
7
7
|
|
|
8
8
|
//#region src/preset.ts
|
|
9
9
|
const require$1 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
10
10
|
const getAbsolutePath = (input) => (0, path.dirname)(require$1.resolve((0, path.join)(input, "package.json")));
|
|
11
11
|
const __dirname$1 = (0, path.dirname)((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
12
|
-
const renderer = (0, path.join)(__dirname$1, "preview.js");
|
|
12
|
+
const renderer = (0, path.join)(__dirname$1, "entry-preview.js");
|
|
13
13
|
const core = {
|
|
14
14
|
builder: getAbsolutePath("@storybook/builder-vite"),
|
|
15
15
|
renderer
|
|
@@ -27,7 +27,7 @@ const viteFinal = async (defaultConfig) => {
|
|
|
27
27
|
const previewAnnotations = async (input = [], options) => {
|
|
28
28
|
const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
29
29
|
const result = [];
|
|
30
|
-
return result.concat(input).concat([renderer]).concat(docsEnabled ? [(0, path.
|
|
30
|
+
return result.concat(input).concat([renderer]).concat(docsEnabled ? [(0, path.join)(__dirname$1, "entry-preview-docs.js")] : []);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
//#endregion
|
package/dist/preset.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.cjs","names":["require","input: I","__dirname","core: StorybookConfig['core']","viteFinal: StorybookConfig['viteFinal']","previewAnnotations: StorybookConfig['previewAnnotations']","result: string[]"],"sources":["../src/preset.ts"],"sourcesContent":["/**\n * we can't prefix the Node.js imports with `node:` because it will break\n * within Storybook due to its Vite setup.\n */\nimport {
|
|
1
|
+
{"version":3,"file":"preset.cjs","names":["require","input: I","__dirname","core: StorybookConfig['core']","viteFinal: StorybookConfig['viteFinal']","previewAnnotations: StorybookConfig['previewAnnotations']","result: string[]"],"sources":["../src/preset.ts"],"sourcesContent":["/**\n * we can't prefix the Node.js imports with `node:` because it will break\n * within Storybook due to its Vite setup.\n */\nimport { createRequire } from 'module';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\n\nimport stencil from 'unplugin-stencil/vite';\nimport { mergeConfig } from 'vite';\n\nimport { StorybookConfig } from './types.js';\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'entry-preview.js');\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig['viteFinal'] = async (defaultConfig) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig['previewAnnotations'] = async (input = [], options) => {\n const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;\n const result: string[] = [];\n\n return result\n .concat(input)\n .concat([renderer])\n .concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.js')] : []);\n};\n"],"mappings":";;;;;;;;AAaA,MAAMA,YAAU,0EAA8B;AAC9C,MAAM,kBAAkB,CAAmBC,UAAgB,kBAAQ,UAAQ,QAAQ,eAAK,OAAO,eAAe,CAAC,CAAC;AAEhH,MAAMC,cAAY,kBAAQ,qEAA8B,CAAC;AAEzD,MAAM,WAAW,eAAKA,aAAW,mBAAmB;AAEpD,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OAAO,kBAAkB;CAC9E,MAAM,SAAS,sBAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CACP,mCAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OAAO,QAAQ,CAAE,GAAE,YAAY;CACtG,MAAM,cAAc,OAAO,KAAK,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAE,GAAE,QAAQ,CAAC,CAAC,SAAS;CAC3F,MAAMC,SAAmB,CAAE;AAE3B,QAAO,OACJ,OAAO,MAAM,CACb,OAAO,CAAC,QAAS,EAAC,CAClB,OAAO,cAAc,CAAC,eAAKJ,aAAW,wBAAwB,AAAC,IAAG,CAAE,EAAC;AACzE"}
|
package/dist/preset.d.cts
CHANGED
package/dist/preset.d.ts
CHANGED
package/dist/preset.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { dirname, join, resolve } from "path";
|
|
2
1
|
import { createRequire } from "module";
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
-
import { mergeConfig } from "vite";
|
|
5
4
|
import stencil from "unplugin-stencil/vite";
|
|
5
|
+
import { mergeConfig } from "vite";
|
|
6
6
|
|
|
7
7
|
//#region src/preset.ts
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
9
9
|
const getAbsolutePath = (input) => dirname(require.resolve(join(input, "package.json")));
|
|
10
10
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const renderer = join(__dirname, "preview.js");
|
|
11
|
+
const renderer = join(__dirname, "entry-preview.js");
|
|
12
12
|
const core = {
|
|
13
13
|
builder: getAbsolutePath("@storybook/builder-vite"),
|
|
14
14
|
renderer
|
|
@@ -26,7 +26,7 @@ const viteFinal = async (defaultConfig) => {
|
|
|
26
26
|
const previewAnnotations = async (input = [], options) => {
|
|
27
27
|
const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
28
28
|
const result = [];
|
|
29
|
-
return result.concat(input).concat([renderer]).concat(docsEnabled ? [
|
|
29
|
+
return result.concat(input).concat([renderer]).concat(docsEnabled ? [join(__dirname, "entry-preview-docs.js")] : []);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
//#endregion
|
package/dist/preset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","names":["input: I","core: StorybookConfig['core']","viteFinal: StorybookConfig['viteFinal']","previewAnnotations: StorybookConfig['previewAnnotations']","result: string[]"],"sources":["../src/preset.ts"],"sourcesContent":["/**\n * we can't prefix the Node.js imports with `node:` because it will break\n * within Storybook due to its Vite setup.\n */\nimport {
|
|
1
|
+
{"version":3,"file":"preset.js","names":["input: I","core: StorybookConfig['core']","viteFinal: StorybookConfig['viteFinal']","previewAnnotations: StorybookConfig['previewAnnotations']","result: string[]"],"sources":["../src/preset.ts"],"sourcesContent":["/**\n * we can't prefix the Node.js imports with `node:` because it will break\n * within Storybook due to its Vite setup.\n */\nimport { createRequire } from 'module';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'url';\n\nimport stencil from 'unplugin-stencil/vite';\nimport { mergeConfig } from 'vite';\n\nimport { StorybookConfig } from './types.js';\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'entry-preview.js');\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig['viteFinal'] = async (defaultConfig) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig['previewAnnotations'] = async (input = [], options) => {\n const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;\n const result: string[] = [];\n\n return result\n .concat(input)\n .concat([renderer])\n .concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.js')] : []);\n};\n"],"mappings":";;;;;;;AAaA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,kBAAkB,CAAmBA,UAAgB,QAAQ,QAAQ,QAAQ,KAAK,OAAO,eAAe,CAAC,CAAC;AAEhH,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAM,WAAW,KAAK,WAAW,mBAAmB;AAEpD,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OAAO,kBAAkB;CAC9E,MAAM,SAAS,YAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CACP,QAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OAAO,QAAQ,CAAE,GAAE,YAAY;CACtG,MAAM,cAAc,OAAO,KAAK,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAE,GAAE,QAAQ,CAAC,CAAC,SAAS;CAC3F,MAAMC,SAAmB,CAAE;AAE3B,QAAO,OACJ,OAAO,MAAM,CACb,OAAO,CAAC,QAAS,EAAC,CAClB,OAAO,cAAc,CAAC,KAAK,WAAW,wBAAwB,AAAC,IAAG,CAAE,EAAC;AACzE"}
|
|
@@ -21,4 +21,4 @@ declare module 'rollup/parseAst' {
|
|
|
21
21
|
export function parseAst(code: string, options?: any): any;
|
|
22
22
|
export function parseAstAsync(code: string, options?: any): Promise<any>;
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=rollup-parseAst-
|
|
24
|
+
//# sourceMappingURL=rollup-parseAst-DXE9IfcK.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX, VNode } from "@stencil/core";
|
|
2
|
-
import { StorybookConfigVite } from "@storybook/builder-vite";
|
|
3
2
|
import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
|
|
3
|
+
import { StorybookConfigVite } from "@storybook/builder-vite";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
interface DevJSX {
|
|
@@ -68,4 +68,4 @@ declare global {
|
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
export { ArgTypes, Args$1 as Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext$1 as StoryContext, StoryFn, StoryObj, StorybookConfig$1 as StorybookConfig, StrictArgs$1 as StrictArgs };
|
|
71
|
-
//# sourceMappingURL=types-
|
|
71
|
+
//# sourceMappingURL=types-BjBqnnWi.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX, VNode } from "@stencil/core";
|
|
2
|
-
import { StorybookConfigVite } from "@storybook/builder-vite";
|
|
3
2
|
import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
|
|
3
|
+
import { StorybookConfigVite } from "@storybook/builder-vite";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
interface DevJSX {
|
|
@@ -68,4 +68,4 @@ declare global {
|
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
export { ArgTypes, Args$1 as Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext$1 as StoryContext, StoryFn, StoryObj, StorybookConfig$1 as StorybookConfig, StrictArgs$1 as StrictArgs };
|
|
71
|
-
//# sourceMappingURL=types-
|
|
71
|
+
//# sourceMappingURL=types-Dzw-ZY4t.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/storybook-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Storybook plugin for Stencil",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/stenciljs/storybook",
|
|
@@ -64,24 +64,24 @@
|
|
|
64
64
|
"build": "tsdown"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@storybook/addon-actions": "^9.0.
|
|
68
|
-
"@storybook/builder-vite": "^9.0.
|
|
67
|
+
"@storybook/addon-actions": "^9.0.8",
|
|
68
|
+
"@storybook/builder-vite": "^9.0.8",
|
|
69
69
|
"@storybook/global": "^5.0.0",
|
|
70
|
-
"@storybook/html": "^9.0.
|
|
70
|
+
"@storybook/html": "^9.0.8",
|
|
71
71
|
"preact-render-to-string": "^6.5.13",
|
|
72
|
-
"react-docgen-typescript": "^2.
|
|
73
|
-
"unplugin-stencil": "^0.3.
|
|
72
|
+
"react-docgen-typescript": "^2.4.0",
|
|
73
|
+
"unplugin-stencil": "^0.3.4"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@stencil/core": "^4.30.0",
|
|
77
77
|
"storybook": "^9.0.5"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@stencil/core": "^4.
|
|
80
|
+
"@stencil/core": "^4.33.1",
|
|
81
81
|
"@types/node": "^22.15.3",
|
|
82
|
-
"tsdown": "^0.12.
|
|
82
|
+
"tsdown": "^0.12.7",
|
|
83
83
|
"typescript": "~5.8.3",
|
|
84
|
-
"vite": "^6.3.
|
|
84
|
+
"vite": "^6.3.5"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=20"
|
package/preset.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file seems to only be necessary for Windows
|
|
2
|
-
|
|
2
|
+
export * from "./dist/preset.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preview-D_4Gl5tg.cjs","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\nimport { render as renderStencil, h, VNode, Fragment } from '@stencil/core';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n\n const cmpName = customElements.getName(component);\n if (!cmpName) {\n throw new Error('Component is not registered!');\n }\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;AAMA,MAAaA,SAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;CAGlB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACH,OAAM,IAAI,MAAM;CAGlB,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,8BAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,sBAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,4BAAc,MAAM,QAAQ;AAC5B,6CAAiB,QAAQ;AAC1B;;;;;;;;;;AC9DD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preview-Dn8QZb01.js","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\nimport { render as renderStencil, h, VNode, Fragment } from '@stencil/core';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n\n const cmpName = customElements.getName(component);\n if (!cmpName) {\n throw new Error('Component is not registered!');\n }\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;;;;;;;;;;AAMA,MAAaA,WAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;CAGlB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACH,OAAM,IAAI,MAAM;CAGlB,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,UAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,EAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,QAAc,MAAM,QAAQ;AAC5B,kBAAiB,QAAQ;AAC1B;;;;;;;;;;AC9DD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}
|
package/dist/preview.cjs
DELETED
package/dist/preview.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StencilRenderer } from "./types-CR2AtVj_.cjs";
|
|
2
|
-
import { ArgsStoryFn, RenderContext } from "storybook/internal/types";
|
|
3
|
-
|
|
4
|
-
//#region src/render.d.ts
|
|
5
|
-
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
-
declare function renderToCanvas({
|
|
7
|
-
storyFn,
|
|
8
|
-
showMain,
|
|
9
|
-
storyContext
|
|
10
|
-
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/preview.d.ts
|
|
13
|
-
declare const parameters: {
|
|
14
|
-
renderer: 'stencil';
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { parameters, render, renderToCanvas };
|
|
18
|
-
//# sourceMappingURL=preview.d.cts.map
|
package/dist/preview.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StencilRenderer } from "./types-DoLyzAU3.js";
|
|
2
|
-
import { ArgsStoryFn, RenderContext } from "storybook/internal/types";
|
|
3
|
-
|
|
4
|
-
//#region src/render.d.ts
|
|
5
|
-
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
-
declare function renderToCanvas({
|
|
7
|
-
storyFn,
|
|
8
|
-
showMain,
|
|
9
|
-
storyContext
|
|
10
|
-
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/preview.d.ts
|
|
13
|
-
declare const parameters: {
|
|
14
|
-
renderer: 'stencil';
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { parameters, render, renderToCanvas };
|
|
18
|
-
//# sourceMappingURL=preview.d.ts.map
|
package/dist/preview.js
DELETED