@stencil/storybook-plugin 0.4.2 → 0.5.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.
Files changed (42) hide show
  1. package/dist/docs/index.cjs +1 -1
  2. package/dist/docs/index.d.ts +1 -1
  3. package/dist/docs/index.js +1 -1
  4. package/dist/{docs-DJjy-dqq.cjs → docs-C41e1jpq.cjs} +1 -1
  5. package/dist/{docs-DJjy-dqq.cjs.map → docs-C41e1jpq.cjs.map} +1 -1
  6. package/dist/{docs-C9E8OhSN.js → docs-ObZ8znBB.js} +1 -1
  7. package/dist/{docs-C9E8OhSN.js.map → docs-ObZ8znBB.js.map} +1 -1
  8. package/dist/{entry-preview-B91w5aFH.cjs → entry-preview-C0ipNwpw.cjs} +2 -2
  9. package/dist/{entry-preview-B91w5aFH.cjs.map → entry-preview-C0ipNwpw.cjs.map} +1 -1
  10. package/dist/{entry-preview-DWaghsKM.js → entry-preview-C1JSJAGq.js} +2 -2
  11. package/dist/{entry-preview-DWaghsKM.js.map → entry-preview-C1JSJAGq.js.map} +1 -1
  12. package/dist/entry-preview-argtypes.cjs +134 -0
  13. package/dist/entry-preview-argtypes.cjs.map +1 -0
  14. package/dist/entry-preview-argtypes.d.cts +17 -0
  15. package/dist/entry-preview-argtypes.d.ts +17 -0
  16. package/dist/entry-preview-argtypes.js +133 -0
  17. package/dist/entry-preview-argtypes.js.map +1 -0
  18. package/dist/entry-preview-docs.cjs +1 -1
  19. package/dist/entry-preview-docs.d.ts +1 -1
  20. package/dist/entry-preview-docs.js +1 -1
  21. package/dist/entry-preview.cjs +1 -1
  22. package/dist/entry-preview.d.ts +1 -1
  23. package/dist/entry-preview.js +1 -1
  24. package/dist/index.cjs +8 -31
  25. package/dist/index.d.cts +10 -1
  26. package/dist/index.d.ts +12 -4
  27. package/dist/index.js +4 -31
  28. package/dist/node/index.d.ts +1 -1
  29. package/dist/preset.cjs +1 -1
  30. package/dist/preset.cjs.map +1 -1
  31. package/dist/preset.d.ts +1 -1
  32. package/dist/preset.js +1 -1
  33. package/dist/preset.js.map +1 -1
  34. package/dist/{rollup-parseAst-DXE9IfcK.d.ts → rollup-parseAst-t-4tfMPG.d.ts} +1 -1
  35. package/dist/src-BBcTbcCa.js +55 -0
  36. package/dist/src-BBcTbcCa.js.map +1 -0
  37. package/dist/src-D0dJRYm2.cjs +91 -0
  38. package/dist/src-D0dJRYm2.cjs.map +1 -0
  39. package/dist/{types-C-2oudGU.d.ts → types-DqHtEV5w.d.ts} +1 -1
  40. package/package.json +1 -1
  41. package/dist/index.cjs.map +0 -1
  42. package/dist/index.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_docs = require('../docs-DJjy-dqq.cjs');
1
+ const require_docs = require('../docs-C41e1jpq.cjs');
2
2
 
3
3
  exports.renderHTML = require_docs.renderHTML;
4
4
  exports.sourceDecorator = require_docs.sourceDecorator;
@@ -1,4 +1,4 @@
1
- import { StencilRenderer } from "../types-C-2oudGU.js";
1
+ import { StencilRenderer } from "../types-DqHtEV5w.js";
2
2
  import { VNode } from "@stencil/core";
3
3
  import { DecoratorFunction } from "storybook/internal/types";
4
4
 
@@ -1,3 +1,3 @@
1
- import { renderHTML, sourceDecorator } from "../docs-C9E8OhSN.js";
1
+ import { renderHTML, sourceDecorator } from "../docs-ObZ8znBB.js";
2
2
 
3
3
  export { renderHTML, sourceDecorator };
@@ -54,4 +54,4 @@ Object.defineProperty(exports, 'sourceDecorator', {
54
54
  return sourceDecorator;
55
55
  }
56
56
  });
57
- //# sourceMappingURL=docs-DJjy-dqq.cjs.map
57
+ //# sourceMappingURL=docs-C41e1jpq.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs-DJjy-dqq.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 const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'boolean') {\n return value ? ` ${key}` : '';\n }\n return ` ${key}=\"${value}\"`;\n })\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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AA4B,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"}
1
+ {"version":3,"file":"docs-C41e1jpq.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 const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'boolean') {\n return value ? ` ${key}` : '';\n }\n return ` ${key}=\"${value}\"`;\n })\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;CACjB,MAAM,QAAQ,KAAK,UACf,OAAO,QAAQ,KAAK,QAAQ,CACzB,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,iBAAoB,CAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;AACrB,aAAW,UAAU,UACnB,QAAO,SAAS,GAAG,IAAI,IAAI;AAE7B,UAAQ,GAAG,IAAI,IAAI,MAAM;CAC1B,EAAC,CACD,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;;;;AC/BD,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"}
@@ -42,4 +42,4 @@ const sourceDecorator = (storyFn, context) => {
42
42
 
43
43
  //#endregion
44
44
  export { renderHTML, sourceDecorator };
45
- //# sourceMappingURL=docs-C9E8OhSN.js.map
45
+ //# sourceMappingURL=docs-ObZ8znBB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"docs-C9E8OhSN.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 const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'boolean') {\n return value ? ` ${key}` : '';\n }\n return ` ${key}=\"${value}\"`;\n })\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;CACjB,MAAM,QAAQ,KAAK,UACf,OAAO,Q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ratorFunction<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 const attrs = node.$attrs$\n ? Object.entries(node.$attrs$)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'boolean') {\n return value ? ` ${key}` : '';\n }\n return ` ${key}=\"${value}\"`;\n })\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;CACjB,MAAM,QAAQ,KAAK,UACf,OAAO,QAAQ,KAAK,QAAQ,CACzB,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,iBAAoB,CAC3C,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;AACrB,aAAW,UAAU,UACnB,QAAO,SAAS,GAAG,IAAI,IAAI;AAE7B,UAAQ,GAAG,IAAI,IAAI,MAAM;CAC1B,EAAC,CACD,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;;;;AC/BD,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,7 +1,7 @@
1
1
  const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
2
  const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
3
- const __stencil_core = require_chunk.__toESM(require("@stencil/core"));
4
3
  const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
4
+ const __stencil_core = require_chunk.__toESM(require("@stencil/core"));
5
5
 
6
6
  //#region src/render.ts
7
7
  const render = (args, context) => {
@@ -82,4 +82,4 @@ Object.defineProperty(exports, 'renderToCanvas', {
82
82
  return renderToCanvas;
83
83
  }
84
84
  });
85
- //# sourceMappingURL=entry-preview-B91w5aFH.cjs.map
85
+ //# sourceMappingURL=entry-preview-C0ipNwpw.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-preview-B91w5aFH.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 ...value.$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, Parameters } from 'storybook/internal/types';\n\nexport const parameters: Parameters = { renderer: 'stencil' };\n\nexport { render, renderToCanvas } from './render';\n\nexport const argTypesEnhancers: ArgTypesEnhancer[] = [enhanceArgTypes];\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oBAAwC,CAACC,6CAAgB"}
1
+ {"version":3,"file":"entry-preview-C0ipNwpw.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 ...value.$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, Parameters } from 'storybook/internal/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;IACP,GAAG,MAAM;IACT;GACD;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;;;;;;;;;;;ACjED,MAAaC,aAAyB,EAAE,UAAU,UAAW;AAI7D,MAAaC,oBAAwC,CAACC,6CAAgB"}
@@ -1,6 +1,6 @@
1
1
  import { enhanceArgTypes } from "storybook/internal/docs-tools";
2
- import { h, render } from "@stencil/core";
3
2
  import { simulatePageLoad } from "storybook/preview-api";
3
+ import { h, render } from "@stencil/core";
4
4
 
5
5
  //#region rolldown:runtime
6
6
  var __defProp = Object.defineProperty;
@@ -62,4 +62,4 @@ const argTypesEnhancers = [enhanceArgTypes];
62
62
 
63
63
  //#endregion
64
64
  export { argTypesEnhancers, entry_preview_exports, parameters, render$1 as render, renderToCanvas };
65
- //# sourceMappingURL=entry-preview-DWaghsKM.js.map
65
+ //# sourceMappingURL=entry-preview-C1JSJAGq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-preview-DWaghsKM.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 ...value.$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, Parameters } from 'storybook/internal/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;IACP,GAAG,MAAM;IACT;GACD;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;;;;;;;;;;;ACjED,MAAaC,aAAyB,EAAE,UAAU,UAAW;AAI7D,MAAaC,oBAAwC,CAAC,eAAgB"}
1
+ {"version":3,"file":"entry-preview-C1JSJAGq.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 ...value.$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, Parameters } from 'storybook/internal/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;IACP,GAAG,MAAM;IACT;GACD;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;;;;;;;;;;;ACjED,MAAaC,aAAyB,EAAE,UAAU,UAAW;AAI7D,MAAaC,oBAAwC,CAAC,eAAgB"}
@@ -0,0 +1,134 @@
1
+ const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
+ const require_src = require('./src-D0dJRYm2.cjs');
3
+ require('./entry-preview-C0ipNwpw.cjs');
4
+ const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
5
+ const storybook_internal_client_logger = require_chunk.__toESM(require("storybook/internal/client-logger"));
6
+
7
+ //#region src/docs/infer-type.ts
8
+ const inferSBType = (prop) => {
9
+ const scalarTypes = [
10
+ "string",
11
+ "number",
12
+ "boolean",
13
+ "symbol"
14
+ ];
15
+ if (prop.type.toLowerCase() in scalarTypes) return {
16
+ name: prop.type.toLowerCase(),
17
+ raw: prop.type,
18
+ required: prop.required
19
+ };
20
+ if (/^\(.*\)\s*=>\s*.*$/.test(prop.type)) return {
21
+ name: "function",
22
+ raw: prop.type,
23
+ required: prop.required
24
+ };
25
+ return {
26
+ name: "other",
27
+ value: prop.type,
28
+ raw: prop.type,
29
+ required: prop.required
30
+ };
31
+ };
32
+ const inferControlType = (prop) => {
33
+ switch (prop.type) {
34
+ case "string": return { type: "text" };
35
+ case "number": return { type: "number" };
36
+ case "boolean": return { type: "boolean" };
37
+ case "Date": return { type: "date" };
38
+ default: return { type: "object" };
39
+ }
40
+ };
41
+
42
+ //#endregion
43
+ //#region src/docs/custom-elements.ts
44
+ const mapData = (data, category) => data.reduce((acc, item) => {
45
+ acc[item.name] = {
46
+ name: item.name,
47
+ description: item.docs,
48
+ control: false,
49
+ table: { category }
50
+ };
51
+ return acc;
52
+ }, {});
53
+ const mapMethods = (methods) => methods.reduce((acc, method) => {
54
+ acc[method.name] = {
55
+ name: method.name,
56
+ description: method.docs,
57
+ control: null,
58
+ type: { name: "function" },
59
+ table: {
60
+ category: "methods",
61
+ type: { summary: method.signature }
62
+ }
63
+ };
64
+ return acc;
65
+ }, {});
66
+ const mapEvent = (events) => events.reduce((acc, event) => {
67
+ let name = event.event.replace(/(-|_|:|\.|\s)+(.)?/g, (_match, _separator, chr) => {
68
+ return chr ? chr.toUpperCase() : "";
69
+ }).replace(/^([A-Z])/, (match) => match.toLowerCase());
70
+ name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;
71
+ acc[name] = {
72
+ name,
73
+ description: event.docs,
74
+ control: null,
75
+ table: {
76
+ category: "events",
77
+ type: { summary: event.detail }
78
+ },
79
+ type: { name: "function" }
80
+ };
81
+ return acc;
82
+ }, {});
83
+ const mapProps = (props) => props.reduce((acc, prop) => {
84
+ acc[prop.name] = {
85
+ name: prop.attr || prop.name,
86
+ description: prop.docs,
87
+ control: inferControlType(prop),
88
+ table: {
89
+ category: "properties",
90
+ type: { summary: prop.complexType?.original },
91
+ defaultValue: { summary: prop.default }
92
+ },
93
+ type: inferSBType(prop)
94
+ };
95
+ return acc;
96
+ }, {});
97
+ const getMetaData = (tagName, manifest) => {
98
+ if (!require_src.isValidComponent(tagName) || !require_src.isValidMetaData(manifest)) return null;
99
+ const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());
100
+ if (!metaData) storybook_internal_client_logger.logger.warn(`Component not found in custom-elements.json: ${tagName}`);
101
+ return metaData;
102
+ };
103
+ const extractArgTypesFromElements = (tagName, customElements) => {
104
+ const metaData = getMetaData(tagName, customElements);
105
+ return metaData && {
106
+ ...mapProps(metaData.props),
107
+ ...mapEvent(metaData.events),
108
+ ...mapMethods(metaData.methods),
109
+ ...mapData(metaData.slots, "slots"),
110
+ ...mapData(metaData.parts, "parts"),
111
+ ...mapData(metaData.styles, "styles")
112
+ };
113
+ };
114
+ const extractArgTypes = (component) => {
115
+ const cem = require_src.getCustomElements();
116
+ return extractArgTypesFromElements(component.is, cem);
117
+ };
118
+ const extractComponentDescription = (component) => {
119
+ const metaData = getMetaData(component.is, require_src.getCustomElements());
120
+ return metaData && metaData.docs;
121
+ };
122
+
123
+ //#endregion
124
+ //#region src/entry-preview-argtypes.ts
125
+ const parameters = { docs: {
126
+ extractArgTypes,
127
+ extractComponentDescription
128
+ } };
129
+ const argTypesEnhancers = [storybook_internal_docs_tools.enhanceArgTypes];
130
+
131
+ //#endregion
132
+ exports.argTypesEnhancers = argTypesEnhancers;
133
+ exports.parameters = parameters;
134
+ //# sourceMappingURL=entry-preview-argtypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-preview-argtypes.cjs","names":["prop: JsonDocsProp","scalarTypes: SBScalarType['name'][]","data: T[]","category: string","methods: JsonDocsMethod[]","events: JsonDocsEvent[]","chr: string","props: JsonDocsProp[]","tagName: string","manifest: JsonDocs","customElements: JsonDocs","component: any","argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[]","enhanceArgTypes"],"sources":["../src/docs/infer-type.ts","../src/docs/custom-elements.ts","../src/entry-preview-argtypes.ts"],"sourcesContent":["import type { JsonDocsProp } from '@stencil/core/internal';\nimport type { SBType, SBScalarType, InputType } from 'storybook/internal/types';\n\nexport const inferSBType = (prop: JsonDocsProp): SBType => {\n const scalarTypes: SBScalarType['name'][] = ['string', 'number', 'boolean', 'symbol'];\n if (prop.type.toLowerCase() in scalarTypes) {\n return { name: prop.type.toLowerCase(), raw: prop.type, required: prop.required } as SBScalarType;\n }\n\n if (/^\\(.*\\)\\s*=>\\s*.*$/.test(prop.type)) {\n return { name: 'function', raw: prop.type, required: prop.required };\n }\n\n return { name: 'other', value: prop.type, raw: prop.type, required: prop.required };\n};\n\nexport const inferControlType = (prop: JsonDocsProp): InputType['control'] => {\n switch (prop.type) {\n case 'string':\n return { type: 'text' };\n case 'number':\n return { type: 'number' };\n case 'boolean':\n return { type: 'boolean' };\n case 'Date':\n return { type: 'date' };\n default:\n return { type: 'object' };\n }\n};\n","import { logger } from 'storybook/internal/client-logger';\nimport type { ArgTypes } from 'storybook/internal/types';\nimport type {\n JsonDocs,\n JsonDocsProp,\n JsonDocsEvent,\n JsonDocsSlot,\n JsonDocsMethod,\n JsonDocsStyle,\n JsonDocsPart,\n} from '@stencil/core/internal';\n\nimport { inferSBType, inferControlType } from './infer-type';\nimport { getCustomElements, isValidComponent, isValidMetaData } from '..';\n\nconst mapData = <T extends JsonDocsPart>(data: T[], category: string): ArgTypes =>\n data.reduce<ArgTypes>((acc, item) => {\n acc[item.name] = {\n name: item.name,\n description: item.docs,\n control: false,\n table: {\n category,\n },\n };\n return acc;\n }, {});\n\nconst mapMethods = (methods: JsonDocsMethod[]): ArgTypes =>\n methods.reduce<ArgTypes>((acc, method) => {\n acc[method.name] = {\n name: method.name,\n description: method.docs,\n control: null,\n type: { name: 'function' },\n table: {\n category: 'methods',\n type: { summary: method.signature },\n },\n };\n return acc;\n }, {});\n\nconst mapEvent = (events: JsonDocsEvent[]): ArgTypes =>\n events.reduce<ArgTypes>((acc, event) => {\n let name = event.event\n .replace(/(-|_|:|\\.|\\s)+(.)?/g, (_match, _separator, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n })\n .replace(/^([A-Z])/, (match) => match.toLowerCase());\n\n name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;\n\n acc[name] = {\n name,\n description: event.docs,\n control: null,\n table: {\n category: 'events',\n type: { summary: event.detail },\n },\n type: { name: 'function' },\n };\n\n return acc;\n }, {});\n\nconst mapProps = (props: JsonDocsProp[]): ArgTypes =>\n props.reduce<ArgTypes>((acc, prop) => {\n acc[prop.name] = {\n name: prop.attr || prop.name,\n description: prop.docs,\n control: inferControlType(prop),\n table: {\n category: 'properties',\n type: { summary: prop.complexType?.original },\n defaultValue: { summary: prop.default },\n },\n type: inferSBType(prop),\n };\n\n return acc;\n }, {});\n\nconst getMetaData = (tagName: string, manifest: JsonDocs) => {\n if (!isValidComponent(tagName) || !isValidMetaData(manifest)) {\n return null;\n }\n const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());\n if (!metaData) {\n logger.warn(`Component not found in custom-elements.json: ${tagName}`);\n }\n return metaData;\n};\n\nexport const extractArgTypesFromElements = (tagName: string, customElements: JsonDocs) => {\n const metaData = getMetaData(tagName, customElements);\n return (\n metaData && {\n ...mapProps(metaData.props),\n ...mapEvent(metaData.events),\n ...mapMethods(metaData.methods),\n ...mapData<JsonDocsSlot>(metaData.slots, 'slots'),\n ...mapData<JsonDocsPart>(metaData.parts, 'parts'),\n ...mapData<JsonDocsStyle>(metaData.styles, 'styles'),\n }\n );\n};\n\nexport const extractArgTypes = (component: any) => {\n const cem = getCustomElements();\n return extractArgTypesFromElements(component.is, cem);\n};\n\nexport const extractComponentDescription = (component: any) => {\n const metaData = getMetaData(component.is, getCustomElements());\n return metaData && metaData.docs;\n};\n","import { enhanceArgTypes } from 'storybook/internal/docs-tools';\nimport type { ArgTypesEnhancer } from 'storybook/internal/types';\n\nimport { extractArgTypes, extractComponentDescription } from './docs/custom-elements';\nimport type { StencilRenderer } from './types';\n\nexport const parameters = {\n docs: {\n extractArgTypes,\n extractComponentDescription,\n },\n};\n\nexport const argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[] = [enhanceArgTypes];"],"mappings":";;;;;;;AAGA,MAAa,cAAc,CAACA,SAA+B;CACzD,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jD,GAAG,QAAuB,SAAS,QAAQ,SAAS;CACrD;AAEJ;AAED,MAAa,kBAAkB,CAACC,cAAmB;CACjD,MAAM,MAAM,+BAAmB;AAC/B,QAAO,4BAA4B,UAAU,IAAI,IAAI;AACtD;AAED,MAAa,8BAA8B,CAACA,cAAmB;CAC7D,MAAM,WAAW,YAAY,UAAU,IAAI,+BAAmB,CAAC;AAC/D,QAAO,YAAY,SAAS;AAC7B;;;;AC/GD,MAAa,aAAa,EACxB,MAAM;CACJ;CACA;AACD,EACF;AAED,MAAaC,oBAAkE,CAACC,6CAAgB"}
@@ -0,0 +1,17 @@
1
+ import { StencilRenderer } from "./types-BZP9npQ9.cjs";
2
+ import { ArgTypesEnhancer } from "storybook/internal/types";
3
+ import * as storybook_internal_csf0 from "storybook/internal/csf";
4
+
5
+ //#region src/entry-preview-argtypes.d.ts
6
+ declare const parameters: {
7
+ docs: {
8
+ extractArgTypes: (component: any) => {
9
+ [x: string]: storybook_internal_csf0.InputType;
10
+ };
11
+ extractComponentDescription: (component: any) => string;
12
+ };
13
+ };
14
+ declare const argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[];
15
+ //#endregion
16
+ export { argTypesEnhancers, parameters };
17
+ //# sourceMappingURL=entry-preview-argtypes.d.cts.map
@@ -0,0 +1,17 @@
1
+ import { StencilRenderer } from "./types-DqHtEV5w.js";
2
+ import { ArgTypesEnhancer } from "storybook/internal/types";
3
+ import * as storybook_internal_csf0 from "storybook/internal/csf";
4
+
5
+ //#region src/entry-preview-argtypes.d.ts
6
+ declare const parameters: {
7
+ docs: {
8
+ extractArgTypes: (component: any) => {
9
+ [x: string]: storybook_internal_csf0.InputType;
10
+ };
11
+ extractComponentDescription: (component: any) => string;
12
+ };
13
+ };
14
+ declare const argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[];
15
+ //#endregion
16
+ export { argTypesEnhancers, parameters };
17
+ //# sourceMappingURL=entry-preview-argtypes.d.ts.map
@@ -0,0 +1,133 @@
1
+ import "./entry-preview-C1JSJAGq.js";
2
+ import "./rollup-parseAst-t-4tfMPG.d.ts";
3
+ import { getCustomElements, isValidComponent, isValidMetaData } from "./src-BBcTbcCa.js";
4
+ import { enhanceArgTypes } from "storybook/internal/docs-tools";
5
+ import { logger } from "storybook/internal/client-logger";
6
+
7
+ //#region src/docs/infer-type.ts
8
+ const inferSBType = (prop) => {
9
+ const scalarTypes = [
10
+ "string",
11
+ "number",
12
+ "boolean",
13
+ "symbol"
14
+ ];
15
+ if (prop.type.toLowerCase() in scalarTypes) return {
16
+ name: prop.type.toLowerCase(),
17
+ raw: prop.type,
18
+ required: prop.required
19
+ };
20
+ if (/^\(.*\)\s*=>\s*.*$/.test(prop.type)) return {
21
+ name: "function",
22
+ raw: prop.type,
23
+ required: prop.required
24
+ };
25
+ return {
26
+ name: "other",
27
+ value: prop.type,
28
+ raw: prop.type,
29
+ required: prop.required
30
+ };
31
+ };
32
+ const inferControlType = (prop) => {
33
+ switch (prop.type) {
34
+ case "string": return { type: "text" };
35
+ case "number": return { type: "number" };
36
+ case "boolean": return { type: "boolean" };
37
+ case "Date": return { type: "date" };
38
+ default: return { type: "object" };
39
+ }
40
+ };
41
+
42
+ //#endregion
43
+ //#region src/docs/custom-elements.ts
44
+ const mapData = (data, category) => data.reduce((acc, item) => {
45
+ acc[item.name] = {
46
+ name: item.name,
47
+ description: item.docs,
48
+ control: false,
49
+ table: { category }
50
+ };
51
+ return acc;
52
+ }, {});
53
+ const mapMethods = (methods) => methods.reduce((acc, method) => {
54
+ acc[method.name] = {
55
+ name: method.name,
56
+ description: method.docs,
57
+ control: null,
58
+ type: { name: "function" },
59
+ table: {
60
+ category: "methods",
61
+ type: { summary: method.signature }
62
+ }
63
+ };
64
+ return acc;
65
+ }, {});
66
+ const mapEvent = (events) => events.reduce((acc, event) => {
67
+ let name = event.event.replace(/(-|_|:|\.|\s)+(.)?/g, (_match, _separator, chr) => {
68
+ return chr ? chr.toUpperCase() : "";
69
+ }).replace(/^([A-Z])/, (match) => match.toLowerCase());
70
+ name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;
71
+ acc[name] = {
72
+ name,
73
+ description: event.docs,
74
+ control: null,
75
+ table: {
76
+ category: "events",
77
+ type: { summary: event.detail }
78
+ },
79
+ type: { name: "function" }
80
+ };
81
+ return acc;
82
+ }, {});
83
+ const mapProps = (props) => props.reduce((acc, prop) => {
84
+ acc[prop.name] = {
85
+ name: prop.attr || prop.name,
86
+ description: prop.docs,
87
+ control: inferControlType(prop),
88
+ table: {
89
+ category: "properties",
90
+ type: { summary: prop.complexType?.original },
91
+ defaultValue: { summary: prop.default }
92
+ },
93
+ type: inferSBType(prop)
94
+ };
95
+ return acc;
96
+ }, {});
97
+ const getMetaData = (tagName, manifest) => {
98
+ if (!isValidComponent(tagName) || !isValidMetaData(manifest)) return null;
99
+ const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());
100
+ if (!metaData) logger.warn(`Component not found in custom-elements.json: ${tagName}`);
101
+ return metaData;
102
+ };
103
+ const extractArgTypesFromElements = (tagName, customElements) => {
104
+ const metaData = getMetaData(tagName, customElements);
105
+ return metaData && {
106
+ ...mapProps(metaData.props),
107
+ ...mapEvent(metaData.events),
108
+ ...mapMethods(metaData.methods),
109
+ ...mapData(metaData.slots, "slots"),
110
+ ...mapData(metaData.parts, "parts"),
111
+ ...mapData(metaData.styles, "styles")
112
+ };
113
+ };
114
+ const extractArgTypes = (component) => {
115
+ const cem = getCustomElements();
116
+ return extractArgTypesFromElements(component.is, cem);
117
+ };
118
+ const extractComponentDescription = (component) => {
119
+ const metaData = getMetaData(component.is, getCustomElements());
120
+ return metaData && metaData.docs;
121
+ };
122
+
123
+ //#endregion
124
+ //#region src/entry-preview-argtypes.ts
125
+ const parameters = { docs: {
126
+ extractArgTypes,
127
+ extractComponentDescription
128
+ } };
129
+ const argTypesEnhancers = [enhanceArgTypes];
130
+
131
+ //#endregion
132
+ export { argTypesEnhancers, parameters };
133
+ //# sourceMappingURL=entry-preview-argtypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-preview-argtypes.js","names":["prop: JsonDocsProp","scalarTypes: SBScalarType['name'][]","data: T[]","category: string","methods: JsonDocsMethod[]","events: JsonDocsEvent[]","chr: string","props: JsonDocsProp[]","tagName: string","manifest: JsonDocs","customElements: JsonDocs","component: any","argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[]"],"sources":["../src/docs/infer-type.ts","../src/docs/custom-elements.ts","../src/entry-preview-argtypes.ts"],"sourcesContent":["import type { JsonDocsProp } from '@stencil/core/internal';\nimport type { SBType, SBScalarType, InputType } from 'storybook/internal/types';\n\nexport const inferSBType = (prop: JsonDocsProp): SBType => {\n const scalarTypes: SBScalarType['name'][] = ['string', 'number', 'boolean', 'symbol'];\n if (prop.type.toLowerCase() in scalarTypes) {\n return { name: prop.type.toLowerCase(), raw: prop.type, required: prop.required } as SBScalarType;\n }\n\n if (/^\\(.*\\)\\s*=>\\s*.*$/.test(prop.type)) {\n return { name: 'function', raw: prop.type, required: prop.required };\n }\n\n return { name: 'other', value: prop.type, raw: prop.type, required: prop.required };\n};\n\nexport const inferControlType = (prop: JsonDocsProp): InputType['control'] => {\n switch (prop.type) {\n case 'string':\n return { type: 'text' };\n case 'number':\n return { type: 'number' };\n case 'boolean':\n return { type: 'boolean' };\n case 'Date':\n return { type: 'date' };\n default:\n return { type: 'object' };\n }\n};\n","import { logger } from 'storybook/internal/client-logger';\nimport type { ArgTypes } from 'storybook/internal/types';\nimport type {\n JsonDocs,\n JsonDocsProp,\n JsonDocsEvent,\n JsonDocsSlot,\n JsonDocsMethod,\n JsonDocsStyle,\n JsonDocsPart,\n} from '@stencil/core/internal';\n\nimport { inferSBType, inferControlType } from './infer-type';\nimport { getCustomElements, isValidComponent, isValidMetaData } from '..';\n\nconst mapData = <T extends JsonDocsPart>(data: T[], category: string): ArgTypes =>\n data.reduce<ArgTypes>((acc, item) => {\n acc[item.name] = {\n name: item.name,\n description: item.docs,\n control: false,\n table: {\n category,\n },\n };\n return acc;\n }, {});\n\nconst mapMethods = (methods: JsonDocsMethod[]): ArgTypes =>\n methods.reduce<ArgTypes>((acc, method) => {\n acc[method.name] = {\n name: method.name,\n description: method.docs,\n control: null,\n type: { name: 'function' },\n table: {\n category: 'methods',\n type: { summary: method.signature },\n },\n };\n return acc;\n }, {});\n\nconst mapEvent = (events: JsonDocsEvent[]): ArgTypes =>\n events.reduce<ArgTypes>((acc, event) => {\n let name = event.event\n .replace(/(-|_|:|\\.|\\s)+(.)?/g, (_match, _separator, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n })\n .replace(/^([A-Z])/, (match) => match.toLowerCase());\n\n name = `on${name.charAt(0).toUpperCase() + name.slice(1)}`;\n\n acc[name] = {\n name,\n description: event.docs,\n control: null,\n table: {\n category: 'events',\n type: { summary: event.detail },\n },\n type: { name: 'function' },\n };\n\n return acc;\n }, {});\n\nconst mapProps = (props: JsonDocsProp[]): ArgTypes =>\n props.reduce<ArgTypes>((acc, prop) => {\n acc[prop.name] = {\n name: prop.attr || prop.name,\n description: prop.docs,\n control: inferControlType(prop),\n table: {\n category: 'properties',\n type: { summary: prop.complexType?.original },\n defaultValue: { summary: prop.default },\n },\n type: inferSBType(prop),\n };\n\n return acc;\n }, {});\n\nconst getMetaData = (tagName: string, manifest: JsonDocs) => {\n if (!isValidComponent(tagName) || !isValidMetaData(manifest)) {\n return null;\n }\n const metaData = manifest.components.find((component) => component.tag.toUpperCase() === tagName.toUpperCase());\n if (!metaData) {\n logger.warn(`Component not found in custom-elements.json: ${tagName}`);\n }\n return metaData;\n};\n\nexport const extractArgTypesFromElements = (tagName: string, customElements: JsonDocs) => {\n const metaData = getMetaData(tagName, customElements);\n return (\n metaData && {\n ...mapProps(metaData.props),\n ...mapEvent(metaData.events),\n ...mapMethods(metaData.methods),\n ...mapData<JsonDocsSlot>(metaData.slots, 'slots'),\n ...mapData<JsonDocsPart>(metaData.parts, 'parts'),\n ...mapData<JsonDocsStyle>(metaData.styles, 'styles'),\n }\n );\n};\n\nexport const extractArgTypes = (component: any) => {\n const cem = getCustomElements();\n return extractArgTypesFromElements(component.is, cem);\n};\n\nexport const extractComponentDescription = (component: any) => {\n const metaData = getMetaData(component.is, getCustomElements());\n return metaData && metaData.docs;\n};\n","import { enhanceArgTypes } from 'storybook/internal/docs-tools';\nimport type { ArgTypesEnhancer } from 'storybook/internal/types';\n\nimport { extractArgTypes, extractComponentDescription } from './docs/custom-elements';\nimport type { StencilRenderer } from './types';\n\nexport const parameters = {\n docs: {\n extractArgTypes,\n extractComponentDescription,\n },\n};\n\nexport const argTypesEnhancers: ArgTypesEnhancer<StencilRenderer<unknown>>[] = [enhanceArgTypes];"],"mappings":";;;;;;;AAGA,MAAa,cAAc,CAACA,SAA+B;CACzD,MAAMC,cAAsC;EAAC;EAAU;EAAU;EAAW;CAAS;AACrF,KAAI,KAAK,KAAK,aAAa,IAAI,YAC7B,QAAO;EAAE,MAAM,KAAK,KAAK,aAAa;EAAE,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AAGnF,KAAI,qBAAqB,KAAK,KAAK,KAAK,CACtC,QAAO;EAAE,MAAM;EAAY,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AAGtE,QAAO;EAAE,MAAM;EAAS,OAAO,KAAK;EAAM,KAAK,KAAK;EAAM,UAAU,KAAK;CAAU;AACpF;AAED,MAAa,mBAAmB,CAACD,SAA6C;AAC5E,SAAQ,KAAK,MAAb;EACE,KAAK,SACH,QAAO,EAAE,MAAM,OAAQ;EACzB,KAAK,SACH,QAAO,EAAE,MAAM,SAAU;EAC3B,KAAK,UACH,QAAO,EAAE,MAAM,UAAW;EAC5B,KAAK,OACH,QAAO,EAAE,MAAM,OAAQ;EACzB,QACE,QAAO,EAAE,MAAM,SAAU;CAC5B;AACF;;;;ACdD,MAAM,UAAU,CAAyBE,MAAWC,aAClD,KAAK,OAAiB,CAAC,KAAK,SAAS;AACnC,KAAI,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C,SAAiBC,aAAuB;AAC3D,MAAK,iBAAiB,QAAQ,KAAK,gBAAgB,SAAS,CAC1D,QAAO;CAET,MAAM,WAAW,SAAS,WAAW,KAAK,CAAC,cAAc,UAAU,IAAI,aAAa,KAAK,QAAQ,aAAa,CAAC;AAC/G,MAAK,SACH,QAAO,MAAM,+CAA+C,QAAQ,EAAE;AAExE,QAAO;AACR;AAED,MAAa,8BAA8B,CAACD,SAAiBE,mBAA6B;CACxF,MAAM,WAAW,YAAY,SAAS,eAAe;AACrD,QACE,YAAY;EACV,GAAG,SAAS,SAAS,MAAM;EAC3B,GAAG,SAAS,SAAS,OAAO;EAC5B,GAAG,WAAW,SAAS,QAAQ;EAC/B,GAAG,QAAsB,SAAS,OAAO,QAAQ;EACjD,GAAG,QAAsB,SAAS,OAAO,QAAQ;EACjD,GAAG,QAAuB,SAAS,QAAQ,SAAS;CACrD;AAEJ;AAED,MAAa,kBAAkB,CAACC,cAAmB;CACjD,MAAM,MAAM,mBAAmB;AAC/B,QAAO,4BAA4B,UAAU,IAAI,IAAI;AACtD;AAED,MAAa,8BAA8B,CAACA,cAAmB;CAC7D,MAAM,WAAW,YAAY,UAAU,IAAI,mBAAmB,CAAC;AAC/D,QAAO,YAAY,SAAS;AAC7B;;;;AC/GD,MAAa,aAAa,EACxB,MAAM;CACJ;CACA;AACD,EACF;AAED,MAAaC,oBAAkE,CAAC,eAAgB"}
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_docs = require('./docs-DJjy-dqq.cjs');
2
+ const require_docs = require('./docs-C41e1jpq.cjs');
3
3
  const storybook_internal_docs_tools = require_chunk.__toESM(require("storybook/internal/docs-tools"));
4
4
 
5
5
  //#region src/entry-preview-docs.ts
@@ -1,4 +1,4 @@
1
- import { StencilRenderer } from "./types-C-2oudGU.js";
1
+ import { StencilRenderer } from "./types-DqHtEV5w.js";
2
2
  import { DecoratorFunction, Parameters } from "storybook/internal/types";
3
3
 
4
4
  //#region src/entry-preview-docs.d.ts
@@ -1,4 +1,4 @@
1
- import { sourceDecorator } from "./docs-C9E8OhSN.js";
1
+ import { sourceDecorator } from "./docs-ObZ8znBB.js";
2
2
  import { SourceType } from "storybook/internal/docs-tools";
3
3
 
4
4
  //#region src/entry-preview-docs.ts
@@ -1,4 +1,4 @@
1
- const require_entry_preview = require('./entry-preview-B91w5aFH.cjs');
1
+ const require_entry_preview = require('./entry-preview-C0ipNwpw.cjs');
2
2
 
3
3
  exports.argTypesEnhancers = require_entry_preview.argTypesEnhancers;
4
4
  exports.parameters = require_entry_preview.parameters;
@@ -1,4 +1,4 @@
1
- import { StencilRenderer } from "./types-C-2oudGU.js";
1
+ import { StencilRenderer } from "./types-DqHtEV5w.js";
2
2
  import { ArgTypesEnhancer, ArgsStoryFn, Parameters, RenderContext } from "storybook/internal/types";
3
3
 
4
4
  //#region src/render.d.ts
@@ -1,3 +1,3 @@
1
- import { argTypesEnhancers, parameters, render, renderToCanvas } from "./entry-preview-DWaghsKM.js";
1
+ import { argTypesEnhancers, parameters, render, renderToCanvas } from "./entry-preview-C1JSJAGq.js";
2
2
 
3
3
  export { argTypesEnhancers, parameters, render, renderToCanvas };
package/dist/index.cjs CHANGED
@@ -1,32 +1,9 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_entry_preview = require('./entry-preview-B91w5aFH.cjs');
3
- const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
1
+ const require_src = require('./src-D0dJRYm2.cjs');
2
+ require('./entry-preview-C0ipNwpw.cjs');
4
3
 
5
- //#region src/portable-stories.tsx
6
- /**
7
- * Function that sets the globalConfig of your storybook. The global config is the preview module of
8
- * your .storybook folder.
9
- *
10
- * It should be run a single time, so that your global config (e.g. decorators) is applied to your
11
- * stories when using `composeStories` or `composeStory`.
12
- *
13
- * Example:
14
- *
15
- * ```jsx
16
- * // setup-file.js
17
- * import { setProjectAnnotations } from '@storybook/web-components';
18
- * import projectAnnotations from './.storybook/preview';
19
- *
20
- * setProjectAnnotations(projectAnnotations);
21
- * ```
22
- *
23
- * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
24
- */
25
- function setProjectAnnotations(projectAnnotations) {
26
- (0, storybook_preview_api.setDefaultProjectAnnotations)(require_entry_preview.entry_preview_exports);
27
- return (0, storybook_preview_api.setProjectAnnotations)(projectAnnotations);
28
- }
29
-
30
- //#endregion
31
- exports.setProjectAnnotations = setProjectAnnotations;
32
- //# sourceMappingURL=index.cjs.map
4
+ exports.getCustomElements = require_src.getCustomElements;
5
+ exports.isValidComponent = require_src.isValidComponent;
6
+ exports.isValidMetaData = require_src.isValidMetaData;
7
+ exports.setCustomElements = require_src.setCustomElements;
8
+ exports.setCustomElementsManifest = require_src.setCustomElementsManifest;
9
+ exports.setProjectAnnotations = require_src.setProjectAnnotations;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig } from "./types-BZP9npQ9.cjs";
2
2
  import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
3
+ import { JsonDocs } from "@stencil/core/internal";
3
4
 
4
5
  //#region @types/rollup-parseAst.d.ts
5
6
 
@@ -26,6 +27,14 @@ declare module 'rollup/parseAst' {
26
27
  export function parseAstAsync(code: string, options?: any): Promise<any>;
27
28
  }
28
29
  //#endregion
30
+ //#region src/framework-api.d.ts
31
+ declare function isValidComponent(tagName: string): boolean;
32
+ declare function isValidMetaData(customElements: JsonDocs): boolean;
33
+ /** @param customElements `any` for now as spec is not super stable yet */
34
+ declare function setCustomElements(customElements: any): void;
35
+ declare function setCustomElementsManifest(customElements: any): void;
36
+ declare function getCustomElements(): any;
37
+ //#endregion
29
38
  //#region src/portable-stories.d.ts
30
39
  /**
31
40
  * Function that sets the globalConfig of your storybook. The global config is the preview module of
@@ -48,5 +57,5 @@ declare module 'rollup/parseAst' {
48
57
  */
49
58
  declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
50
59
  //#endregion
51
- export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, setProjectAnnotations };
60
+ export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
52
61
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,9 +1,17 @@
1
- import "./rollup-parseAst-DXE9IfcK.js";
2
- import { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig } from "./types-C-2oudGU.js";
1
+ import "./rollup-parseAst-t-4tfMPG.js";
2
+ import { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig } from "./types-DqHtEV5w.js";
3
3
  import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
4
+ import { JsonDocs } from "@stencil/core/internal";
4
5
 
6
+ //#region src/framework-api.d.ts
7
+ declare function isValidComponent(tagName: string): boolean;
8
+ declare function isValidMetaData(customElements: JsonDocs): boolean;
9
+ /** @param customElements `any` for now as spec is not super stable yet */
10
+ declare function setCustomElements(customElements: any): void;
11
+ declare function setCustomElementsManifest(customElements: any): void;
12
+ declare function getCustomElements(): any;
13
+ //#endregion
5
14
  //#region src/portable-stories.d.ts
6
-
7
15
  /**
8
16
  * Function that sets the globalConfig of your storybook. The global config is the preview module of
9
17
  * your .storybook folder.
@@ -25,5 +33,5 @@ import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "
25
33
  */
26
34
  declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
27
35
  //#endregion
28
- export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, setProjectAnnotations };
36
+ export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
29
37
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,32 +1,5 @@
1
- import { entry_preview_exports } from "./entry-preview-DWaghsKM.js";
2
- import "./rollup-parseAst-DXE9IfcK.d.ts";
3
- import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnotations$1 } from "storybook/preview-api";
1
+ import "./entry-preview-C1JSJAGq.js";
2
+ import "./rollup-parseAst-t-4tfMPG.d.ts";
3
+ import { getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations } from "./src-BBcTbcCa.js";
4
4
 
5
- //#region src/portable-stories.tsx
6
- /**
7
- * Function that sets the globalConfig of your storybook. The global config is the preview module of
8
- * your .storybook folder.
9
- *
10
- * It should be run a single time, so that your global config (e.g. decorators) is applied to your
11
- * stories when using `composeStories` or `composeStory`.
12
- *
13
- * Example:
14
- *
15
- * ```jsx
16
- * // setup-file.js
17
- * import { setProjectAnnotations } from '@storybook/web-components';
18
- * import projectAnnotations from './.storybook/preview';
19
- *
20
- * setProjectAnnotations(projectAnnotations);
21
- * ```
22
- *
23
- * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
24
- */
25
- function setProjectAnnotations(projectAnnotations) {
26
- setDefaultProjectAnnotations(entry_preview_exports);
27
- return setProjectAnnotations$1(projectAnnotations);
28
- }
29
-
30
- //#endregion
31
- export { setProjectAnnotations };
32
- //# sourceMappingURL=index.js.map
5
+ export { getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };
@@ -1,4 +1,4 @@
1
- import { StorybookConfig } from "../types-C-2oudGU.js";
1
+ import { StorybookConfig } from "../types-DqHtEV5w.js";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  declare function defineMain(config: StorybookConfig): StorybookConfig;
package/dist/preset.cjs CHANGED
@@ -25,7 +25,7 @@ const viteFinal = async (defaultConfig, { configType }) => {
25
25
  const previewAnnotations = async (input = [], options) => {
26
26
  const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
27
27
  const result = [];
28
- return result.concat(input).concat([renderer]).concat(docsEnabled ? [(0, path.join)(__dirname$1, "entry-preview-docs.js")] : []);
28
+ return result.concat(input).concat([renderer, (0, path.join)(__dirname$1, "entry-preview-argtypes.js")]).concat(docsEnabled ? [(0, path.join)(__dirname$1, "entry-preview-docs.js")] : []);
29
29
  };
30
30
 
31
31
  //#endregion
@@ -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 { createRequire } from 'module';\nimport { dirname, join } from 'path';\nimport stencil from 'unplugin-stencil/vite';\nimport { fileURLToPath } from 'url';\nimport { mergeConfig } from 'vite';\nimport { StorybookConfig } from './types';\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, { configType }) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n if (configType === 'DEVELOPMENT') {\n return mergeConfig(config, {\n build: {\n rollupOptions: {\n external: ['@stencil/core'],\n },\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":";;;;;;;;AAWA,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,eAAe,EAAE,YAAY,KAAK;CAC9F,MAAM,SAAS,sBAAY,eAAe;EACxC,OAAO,EACL,QAAQ,SACT;EACD,SAAS,CACP,mCAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AACF,KAAI,eAAe,cACjB,QAAO,sBAAY,QAAQ,EACzB,OAAO,EACL,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B,EACF,EACF,EAAC;AAGJ,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"}
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 stencil from 'unplugin-stencil/vite';\nimport { fileURLToPath } from 'url';\nimport { mergeConfig } from 'vite';\nimport { StorybookConfig } from './types';\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, { configType }) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n if (configType === 'DEVELOPMENT') {\n return mergeConfig(config, {\n build: {\n rollupOptions: {\n external: ['@stencil/core'],\n },\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, join(__dirname, 'entry-preview-argtypes.js')])\n .concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.js')] : []);\n};\n"],"mappings":";;;;;;;;AAWA,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,eAAe,EAAE,YAAY,KAAK;CAC9F,MAAM,SAAS,sBAAY,eAAe;EACxC,OAAO,EACL,QAAQ,SACT;EACD,SAAS,CACP,mCAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AACF,KAAI,eAAe,cACjB,QAAO,sBAAY,QAAQ,EACzB,OAAO,EACL,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B,EACF,EACF,EAAC;AAGJ,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,UAAU,eAAKJ,aAAW,4BAA4B,AAAC,EAAC,CAChE,OAAO,cAAc,CAAC,eAAKA,aAAW,wBAAwB,AAAC,IAAG,CAAE,EAAC;AACzE"}
package/dist/preset.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StorybookConfig } from "./types-C-2oudGU.js";
1
+ import { StorybookConfig } from "./types-DqHtEV5w.js";
2
2
 
3
3
  //#region src/preset.d.ts
4
4
  declare const core: StorybookConfig['core'];
package/dist/preset.js CHANGED
@@ -24,7 +24,7 @@ const viteFinal = async (defaultConfig, { configType }) => {
24
24
  const previewAnnotations = async (input = [], options) => {
25
25
  const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
26
26
  const result = [];
27
- return result.concat(input).concat([renderer]).concat(docsEnabled ? [join(__dirname, "entry-preview-docs.js")] : []);
27
+ return result.concat(input).concat([renderer, join(__dirname, "entry-preview-argtypes.js")]).concat(docsEnabled ? [join(__dirname, "entry-preview-docs.js")] : []);
28
28
  };
29
29
 
30
30
  //#endregion
@@ -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 { createRequire } from 'module';\nimport { dirname, join } from 'path';\nimport stencil from 'unplugin-stencil/vite';\nimport { fileURLToPath } from 'url';\nimport { mergeConfig } from 'vite';\nimport { StorybookConfig } from './types';\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, { configType }) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n if (configType === 'DEVELOPMENT') {\n return mergeConfig(config, {\n build: {\n rollupOptions: {\n external: ['@stencil/core'],\n },\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":";;;;;;;AAWA,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,eAAe,EAAE,YAAY,KAAK;CAC9F,MAAM,SAAS,YAAY,eAAe;EACxC,OAAO,EACL,QAAQ,SACT;EACD,SAAS,CACP,QAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AACF,KAAI,eAAe,cACjB,QAAO,YAAY,QAAQ,EACzB,OAAO,EACL,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B,EACF,EACF,EAAC;AAGJ,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"}
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 stencil from 'unplugin-stencil/vite';\nimport { fileURLToPath } from 'url';\nimport { mergeConfig } from 'vite';\nimport { StorybookConfig } from './types';\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, { configType }) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n if (configType === 'DEVELOPMENT') {\n return mergeConfig(config, {\n build: {\n rollupOptions: {\n external: ['@stencil/core'],\n },\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, join(__dirname, 'entry-preview-argtypes.js')])\n .concat(docsEnabled ? [join(__dirname, 'entry-preview-docs.js')] : []);\n};\n"],"mappings":";;;;;;;AAWA,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,eAAe,EAAE,YAAY,KAAK;CAC9F,MAAM,SAAS,YAAY,eAAe;EACxC,OAAO,EACL,QAAQ,SACT;EACD,SAAS,CACP,QAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AACF,KAAI,eAAe,cACjB,QAAO,YAAY,QAAQ,EACzB,OAAO,EACL,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B,EACF,EACF,EAAC;AAGJ,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,UAAU,KAAK,WAAW,4BAA4B,AAAC,EAAC,CAChE,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-DXE9IfcK.d.ts.map
24
+ //# sourceMappingURL=rollup-parseAst-t-4tfMPG.d.ts.map
@@ -0,0 +1,55 @@
1
+ import { entry_preview_exports } from "./entry-preview-C1JSJAGq.js";
2
+ import { global } from "@storybook/global";
3
+ import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
4
+
5
+ //#region src/framework-api.ts
6
+ function isValidComponent(tagName) {
7
+ if (!tagName) return false;
8
+ if (typeof tagName === "string") return true;
9
+ throw new Error("Provided component needs to be a string. e.g. component: \"my-element\"");
10
+ }
11
+ function isValidMetaData(customElements) {
12
+ if (!customElements) return false;
13
+ if (customElements.components && Array.isArray(customElements.components)) return true;
14
+ throw new Error(`You need to setup valid meta data in your stencil.config.js via docs-json output target.`);
15
+ }
16
+ /** @param customElements `any` for now as spec is not super stable yet */
17
+ function setCustomElements(customElements) {
18
+ global.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;
19
+ }
20
+ function setCustomElementsManifest(customElements) {
21
+ global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ = customElements;
22
+ }
23
+ function getCustomElements() {
24
+ return global.__STORYBOOK_CUSTOM_ELEMENTS__ || global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__;
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/portable-stories.tsx
29
+ /**
30
+ * Function that sets the globalConfig of your storybook. The global config is the preview module of
31
+ * your .storybook folder.
32
+ *
33
+ * It should be run a single time, so that your global config (e.g. decorators) is applied to your
34
+ * stories when using `composeStories` or `composeStory`.
35
+ *
36
+ * Example:
37
+ *
38
+ * ```jsx
39
+ * // setup-file.js
40
+ * import { setProjectAnnotations } from '@storybook/web-components';
41
+ * import projectAnnotations from './.storybook/preview';
42
+ *
43
+ * setProjectAnnotations(projectAnnotations);
44
+ * ```
45
+ *
46
+ * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
47
+ */
48
+ function setProjectAnnotations$1(projectAnnotations) {
49
+ setDefaultProjectAnnotations(entry_preview_exports);
50
+ return setProjectAnnotations(projectAnnotations);
51
+ }
52
+
53
+ //#endregion
54
+ export { getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations$1 as setProjectAnnotations };
55
+ //# sourceMappingURL=src-BBcTbcCa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-BBcTbcCa.js","names":["tagName: string","customElements: JsonDocs","customElements: any","setProjectAnnotations","projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/framework-api.ts","../src/portable-stories.tsx"],"sourcesContent":["import { global } from '@storybook/global';\nimport type { JsonDocs } from '@stencil/core/internal';\n\nexport function isValidComponent(tagName: string) {\n if (!tagName) {\n return false;\n }\n if (typeof tagName === 'string') {\n return true;\n }\n throw new Error('Provided component needs to be a string. e.g. component: \"my-element\"');\n}\n\nexport function isValidMetaData(customElements: JsonDocs) {\n if (!customElements) {\n return false;\n }\n\n if (customElements.components && Array.isArray(customElements.components)) {\n return true;\n }\n \n throw new Error(`You need to setup valid meta data in your stencil.config.js via docs-json output target.`);\n}\n\n/** @param customElements `any` for now as spec is not super stable yet */\nexport function setCustomElements(customElements: any) {\n global.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;\n}\n\nexport function setCustomElementsManifest(customElements: any) {\n global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ = customElements;\n}\n\nexport function getCustomElements() {\n return global.__STORYBOOK_CUSTOM_ELEMENTS__ || global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__;\n}\n","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":";;;;;AAGA,SAAgB,iBAAiBA,SAAiB;AAChD,MAAK,QACH,QAAO;AAET,YAAW,YAAY,SACrB,QAAO;AAET,OAAM,IAAI,MAAM;AACjB;AAED,SAAgB,gBAAgBC,gBAA0B;AACxD,MAAK,eACH,QAAO;AAGT,KAAI,eAAe,cAAc,MAAM,QAAQ,eAAe,WAAW,CACvE,QAAO;AAGT,OAAM,IAAI,OAAO;AAClB;;AAGD,SAAgB,kBAAkBC,gBAAqB;AACrD,QAAO,gCAAgC;AACxC;AAED,SAAgB,0BAA0BA,gBAAqB;AAC7D,QAAO,yCAAyC;AACjD;AAED,SAAgB,oBAAoB;AAClC,QAAO,OAAO,iCAAiC,OAAO;AACvD;;;;;;;;;;;;;;;;;;;;;;;ACPD,SAAgBC,wBACdC,oBACwD;AACxD,8BAA6BC,sBAAmB;AAChD,QAAO,sBAA8B,mBAAmB;AACzD"}
@@ -0,0 +1,91 @@
1
+ const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
+ const require_entry_preview = require('./entry-preview-C0ipNwpw.cjs');
3
+ const __storybook_global = require_chunk.__toESM(require("@storybook/global"));
4
+ const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
5
+
6
+ //#region src/framework-api.ts
7
+ function isValidComponent(tagName) {
8
+ if (!tagName) return false;
9
+ if (typeof tagName === "string") return true;
10
+ throw new Error("Provided component needs to be a string. e.g. component: \"my-element\"");
11
+ }
12
+ function isValidMetaData(customElements) {
13
+ if (!customElements) return false;
14
+ if (customElements.components && Array.isArray(customElements.components)) return true;
15
+ throw new Error(`You need to setup valid meta data in your stencil.config.js via docs-json output target.`);
16
+ }
17
+ /** @param customElements `any` for now as spec is not super stable yet */
18
+ function setCustomElements(customElements) {
19
+ __storybook_global.global.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;
20
+ }
21
+ function setCustomElementsManifest(customElements) {
22
+ __storybook_global.global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ = customElements;
23
+ }
24
+ function getCustomElements() {
25
+ return __storybook_global.global.__STORYBOOK_CUSTOM_ELEMENTS__ || __storybook_global.global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__;
26
+ }
27
+
28
+ //#endregion
29
+ //#region src/portable-stories.tsx
30
+ /**
31
+ * Function that sets the globalConfig of your storybook. The global config is the preview module of
32
+ * your .storybook folder.
33
+ *
34
+ * It should be run a single time, so that your global config (e.g. decorators) is applied to your
35
+ * stories when using `composeStories` or `composeStory`.
36
+ *
37
+ * Example:
38
+ *
39
+ * ```jsx
40
+ * // setup-file.js
41
+ * import { setProjectAnnotations } from '@storybook/web-components';
42
+ * import projectAnnotations from './.storybook/preview';
43
+ *
44
+ * setProjectAnnotations(projectAnnotations);
45
+ * ```
46
+ *
47
+ * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
48
+ */
49
+ function setProjectAnnotations(projectAnnotations) {
50
+ (0, storybook_preview_api.setDefaultProjectAnnotations)(require_entry_preview.entry_preview_exports);
51
+ return (0, storybook_preview_api.setProjectAnnotations)(projectAnnotations);
52
+ }
53
+
54
+ //#endregion
55
+ Object.defineProperty(exports, 'getCustomElements', {
56
+ enumerable: true,
57
+ get: function () {
58
+ return getCustomElements;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, 'isValidComponent', {
62
+ enumerable: true,
63
+ get: function () {
64
+ return isValidComponent;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, 'isValidMetaData', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return isValidMetaData;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, 'setCustomElements', {
74
+ enumerable: true,
75
+ get: function () {
76
+ return setCustomElements;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, 'setCustomElementsManifest', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return setCustomElementsManifest;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'setProjectAnnotations', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return setProjectAnnotations;
89
+ }
90
+ });
91
+ //# sourceMappingURL=src-D0dJRYm2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-D0dJRYm2.cjs","names":["tagName: string","customElements: JsonDocs","customElements: any","global","projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/framework-api.ts","../src/portable-stories.tsx"],"sourcesContent":["import { global } from '@storybook/global';\nimport type { JsonDocs } from '@stencil/core/internal';\n\nexport function isValidComponent(tagName: string) {\n if (!tagName) {\n return false;\n }\n if (typeof tagName === 'string') {\n return true;\n }\n throw new Error('Provided component needs to be a string. e.g. component: \"my-element\"');\n}\n\nexport function isValidMetaData(customElements: JsonDocs) {\n if (!customElements) {\n return false;\n }\n\n if (customElements.components && Array.isArray(customElements.components)) {\n return true;\n }\n \n throw new Error(`You need to setup valid meta data in your stencil.config.js via docs-json output target.`);\n}\n\n/** @param customElements `any` for now as spec is not super stable yet */\nexport function setCustomElements(customElements: any) {\n global.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;\n}\n\nexport function setCustomElementsManifest(customElements: any) {\n global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__ = customElements;\n}\n\nexport function getCustomElements() {\n return global.__STORYBOOK_CUSTOM_ELEMENTS__ || global.__STORYBOOK_CUSTOM_ELEMENTS_MANIFEST__;\n}\n","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":";;;;;;AAGA,SAAgB,iBAAiBA,SAAiB;AAChD,MAAK,QACH,QAAO;AAET,YAAW,YAAY,SACrB,QAAO;AAET,OAAM,IAAI,MAAM;AACjB;AAED,SAAgB,gBAAgBC,gBAA0B;AACxD,MAAK,eACH,QAAO;AAGT,KAAI,eAAe,cAAc,MAAM,QAAQ,eAAe,WAAW,CACvE,QAAO;AAGT,OAAM,IAAI,OAAO;AAClB;;AAGD,SAAgB,kBAAkBC,gBAAqB;AACrD,2BAAO,gCAAgC;AACxC;AAED,SAAgB,0BAA0BA,gBAAqB;AAC7D,2BAAO,yCAAyC;AACjD;AAED,SAAgB,oBAAoB;AAClC,QAAOC,0BAAO,iCAAiCA,0BAAO;AACvD;;;;;;;;;;;;;;;;;;;;;;;ACPD,SAAgB,sBACdC,oBACwD;AACxD,yDAA6BC,4CAAmB;AAChD,QAAO,iDAA8B,mBAAmB;AACzD"}
@@ -68,4 +68,4 @@ declare global {
68
68
  }
69
69
  //#endregion
70
70
  export { Decorator, Loader, Meta, Preview, StencilRenderer, StoryContext$1 as StoryContext, StoryFn, StoryObj, StorybookConfig$1 as StorybookConfig };
71
- //# sourceMappingURL=types-C-2oudGU.d.ts.map
71
+ //# sourceMappingURL=types-DqHtEV5w.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/storybook-plugin",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Storybook plugin for Stencil",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/stenciljs/storybook",
@@ -1 +0,0 @@
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.js.map DELETED
@@ -1 +0,0 @@
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"}