@stencil/storybook-plugin 0.0.16 → 0.2.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.
@@ -17,6 +17,6 @@
17
17
  * importing `rollup/parseAst` in `unplugin-stencil`.
18
18
  */
19
19
  declare module 'rollup/parseAst' {
20
- export function parseAst(code: string, options?: any): any
21
- export function parseAstAsync(code: string, options?: any): Promise<any>
20
+ export function parseAst(code: string, options?: any): any;
21
+ export function parseAstAsync(code: string, options?: any): Promise<any>;
22
22
  }
package/README.md CHANGED
@@ -75,6 +75,36 @@ export const Primary: Story = {
75
75
  };
76
76
  ```
77
77
 
78
+ If you are using slots in your component, pass them as parameters to the story object like this:
79
+
80
+ ```tsx
81
+ import type { Meta, StoryObj } from '@stencil/storybook-plugin';
82
+ import { h } from '@stencil/core';
83
+
84
+ import { MySlotted } from './my-slotted';
85
+
86
+ const meta = {
87
+ title: 'MySlotted',
88
+ component: MySlotted,
89
+ parameters: {
90
+ layout: 'centered',
91
+ },
92
+ } satisfies Meta<MySlotted>;
93
+
94
+ export default meta;
95
+ type Story = StoryObj<MySlotted>;
96
+
97
+ export const Primary: Story = {
98
+ args: {},
99
+ parameters: {
100
+ slots: {
101
+ default: 'Hello World',
102
+ another: <div>another</div>
103
+ },
104
+ }
105
+ };
106
+ ```
107
+
78
108
  ## Limitations
79
109
 
80
110
  This is early development and we are still seeing some limitations we want to see fixed:
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_preview = require('./preview-Nz-UTIbe.cjs');
3
- const __storybook_preview_api = require_chunk.__toESM(require("@storybook/preview-api"));
2
+ const require_preview = require('./preview-D_4Gl5tg.cjs');
3
+ const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
4
4
 
5
5
  //#region src/portable-stories.tsx
6
6
  /**
@@ -23,8 +23,8 @@ const __storybook_preview_api = require_chunk.__toESM(require("@storybook/previe
23
23
  * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
24
24
  */
25
25
  function setProjectAnnotations(projectAnnotations) {
26
- (0, __storybook_preview_api.setDefaultProjectAnnotations)(require_preview.preview_exports);
27
- return (0, __storybook_preview_api.setProjectAnnotations)(projectAnnotations);
26
+ (0, storybook_preview_api.setDefaultProjectAnnotations)(require_preview.preview_exports);
27
+ return (0, storybook_preview_api.setProjectAnnotations)(projectAnnotations);
28
28
  }
29
29
 
30
30
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["projectAnnotations:\n | NamedOrDefaultProjectAnnotations<any>\n | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations,\n} from '@storybook/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from '@storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<any>\n | NamedOrDefaultProjectAnnotations<any>[]\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(\n projectAnnotations\n ) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,sBACZA,oBAGsD;AACtD,2DAA6BC,gCAAmB;AAChD,QAAO,mDACH,mBACH;AACJ"}
1
+ {"version":3,"file":"index.cjs","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,yDAA6BC,gCAAmB;AAChD,QAAO,iDAA8B,mBAAmB;AACzD"}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-BC4h6q-i.cjs";
2
- import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "@storybook/types";
1
+ import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-CR2AtVj_.cjs";
2
+ import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
3
3
 
4
4
  //#region @types/rollup-parseAst.d.ts
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./rollup-parseAst-t-4tfMPG.js";
2
- import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-CrBVXXLO.js";
3
- import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "@storybook/types";
2
+ import { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs } from "./types-DoLyzAU3.js";
3
+ import { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from "storybook/internal/types";
4
4
 
5
5
  //#region src/portable-stories.d.ts
6
6
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { preview_exports } from "./preview-B75wzZrU.js";
1
+ import { preview_exports } from "./preview-Dn8QZb01.js";
2
2
  import "./rollup-parseAst-t-4tfMPG.d.ts";
3
- import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnotations$1 } from "@storybook/preview-api";
3
+ import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnotations$1 } from "storybook/preview-api";
4
4
 
5
5
  //#region src/portable-stories.tsx
6
6
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["projectAnnotations:\n | NamedOrDefaultProjectAnnotations<any>\n | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations,\n} from '@storybook/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from '@storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<any>\n | NamedOrDefaultProjectAnnotations<any>[]\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(\n projectAnnotations\n ) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,sBACZA,oBAGsD;AACtD,8BAA6BC,gBAAmB;AAChD,QAAO,wBACH,mBACH;AACJ"}
1
+ {"version":3,"file":"index.js","names":["projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]","stencilAnnotations"],"sources":["../src/portable-stories.tsx"],"sourcesContent":["import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';\n\nimport {\n setProjectAnnotations as originalSetProjectAnnotations,\n setDefaultProjectAnnotations,\n} from 'storybook/preview-api';\n\nimport * as stencilAnnotations from './preview';\nimport type { StencilRenderer } from './types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/web-components';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[],\n): NormalizedProjectAnnotations<StencilRenderer<unknown>> {\n setDefaultProjectAnnotations(stencilAnnotations);\n return originalSetProjectAnnotations(projectAnnotations) as NormalizedProjectAnnotations<StencilRenderer<unknown>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,sBACdA,oBACwD;AACxD,8BAA6BC,gBAAmB;AAChD,QAAO,wBAA8B,mBAAmB;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}"],"mappings":";;AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
1
+ {"version":3,"file":"index.cjs","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}\n"],"mappings":";;AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
@@ -1,4 +1,4 @@
1
- import { StorybookConfig } from "../types-BC4h6q-i.cjs";
1
+ import { StorybookConfig } from "../types-CR2AtVj_.cjs";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  declare function defineMain(config: StorybookConfig): StorybookConfig;
@@ -1,4 +1,4 @@
1
- import { StorybookConfig } from "../types-CrBVXXLO.js";
1
+ import { StorybookConfig } from "../types-DoLyzAU3.js";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  declare function defineMain(config: StorybookConfig): StorybookConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}"],"mappings":";AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
1
+ {"version":3,"file":"index.js","names":["config: StorybookConfig"],"sources":["../../src/node/index.ts"],"sourcesContent":["import type { StorybookConfig } from '../types';\n\nexport function defineMain(config: StorybookConfig) {\n return config;\n}\n"],"mappings":";AAEA,SAAgB,WAAWA,QAAyB;AAClD,QAAO;AACR"}
@@ -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 { dirname, join, resolve } from \"path\";\nimport { createRequire } from \"module\";\nimport { fileURLToPath } from 'url';\n\nimport { mergeConfig } from 'vite'\nimport stencil from 'unplugin-stencil/vite'\n\nimport { StorybookConfig } from './types.js'\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I =>\n dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'preview.js')\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig[\"viteFinal\"] = async (\n defaultConfig,\n) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: \"es2020\",\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [stencil({\n rootPath: defaultConfig.root,\n })],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig[\"previewAnnotations\"] = async (\n input = [],\n options\n) => {\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 ? [resolve(getAbsolutePath('@storybook/html'), 'dist', 'entry-preview-docs.mjs')] : []);\n};\n"],"mappings":";;;;;;;;AAaA,MAAMA,YAAU,0EAA8B;AAC9C,MAAM,kBAAkB,CAAmBC,UACzC,kBAAQ,UAAQ,QAAQ,eAAK,OAAO,eAAe,CAAC,CAAC;AAEvD,MAAMC,cAAY,kBAAQ,qEAA8B,CAAC;AAEzD,MAAM,WAAW,eAAKA,aAAW,aAAa;AAE9C,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OACrD,kBACG;CACH,MAAM,SAAS,sBAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CAAC,mCAAQ,EAChB,UAAU,cAAc,KACzB,EAAC,AAAC;CACJ,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OACvE,QAAQ,CAAE,GACV,YACG;CACH,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,kBAAQ,gBAAgB,kBAAkB,EAAE,QAAQ,yBAAyB,AAAC,IAAG,CAAE,EAAC;AAC9G"}
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 { dirname, join, resolve } from 'path';\nimport { createRequire } from 'module';\nimport { fileURLToPath } from 'url';\n\nimport { mergeConfig } from 'vite';\nimport stencil from 'unplugin-stencil/vite';\n\nimport { StorybookConfig } from './types.js';\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'preview.js');\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig['viteFinal'] = async (defaultConfig) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig['previewAnnotations'] = async (input = [], options) => {\n const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;\n const result: string[] = [];\n\n return result\n .concat(input)\n .concat([renderer])\n .concat(docsEnabled ? [resolve(getAbsolutePath('@storybook/html'), 'dist', 'entry-preview-docs.mjs')] : []);\n};\n"],"mappings":";;;;;;;;AAaA,MAAMA,YAAU,0EAA8B;AAC9C,MAAM,kBAAkB,CAAmBC,UAAgB,kBAAQ,UAAQ,QAAQ,eAAK,OAAO,eAAe,CAAC,CAAC;AAEhH,MAAMC,cAAY,kBAAQ,qEAA8B,CAAC;AAEzD,MAAM,WAAW,eAAKA,aAAW,aAAa;AAE9C,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OAAO,kBAAkB;CAC9E,MAAM,SAAS,sBAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CACP,mCAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OAAO,QAAQ,CAAE,GAAE,YAAY;CACtG,MAAM,cAAc,OAAO,KAAK,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAE,GAAE,QAAQ,CAAC,CAAC,SAAS;CAC3F,MAAMC,SAAmB,CAAE;AAE3B,QAAO,OACJ,OAAO,MAAM,CACb,OAAO,CAAC,QAAS,EAAC,CAClB,OAAO,cAAc,CAAC,kBAAQ,gBAAgB,kBAAkB,EAAE,QAAQ,yBAAyB,AAAC,IAAG,CAAE,EAAC;AAC9G"}
package/dist/preset.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { StorybookConfig } from "./types-BC4h6q-i.cjs";
1
+ import { StorybookConfig } from "./types-CR2AtVj_.cjs";
2
2
 
3
3
  //#region src/preset.d.ts
4
4
  declare const core: StorybookConfig['core'];
5
- declare const viteFinal: StorybookConfig["viteFinal"];
6
- declare const previewAnnotations: StorybookConfig["previewAnnotations"];
5
+ declare const viteFinal: StorybookConfig['viteFinal'];
6
+ declare const previewAnnotations: StorybookConfig['previewAnnotations'];
7
7
  //#endregion
8
8
  export { core, previewAnnotations, viteFinal };
9
9
  //# sourceMappingURL=preset.d.cts.map
package/dist/preset.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { StorybookConfig } from "./types-CrBVXXLO.js";
1
+ import { StorybookConfig } from "./types-DoLyzAU3.js";
2
2
 
3
3
  //#region src/preset.d.ts
4
4
  declare const core: StorybookConfig['core'];
5
- declare const viteFinal: StorybookConfig["viteFinal"];
6
- declare const previewAnnotations: StorybookConfig["previewAnnotations"];
5
+ declare const viteFinal: StorybookConfig['viteFinal'];
6
+ declare const previewAnnotations: StorybookConfig['previewAnnotations'];
7
7
  //#endregion
8
8
  export { core, previewAnnotations, viteFinal };
9
9
  //# sourceMappingURL=preset.d.ts.map
@@ -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 { dirname, join, resolve } from \"path\";\nimport { createRequire } from \"module\";\nimport { fileURLToPath } from 'url';\n\nimport { mergeConfig } from 'vite'\nimport stencil from 'unplugin-stencil/vite'\n\nimport { StorybookConfig } from './types.js'\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I =>\n dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'preview.js')\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig[\"viteFinal\"] = async (\n defaultConfig,\n) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: \"es2020\",\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [stencil({\n rootPath: defaultConfig.root,\n })],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig[\"previewAnnotations\"] = async (\n input = [],\n options\n) => {\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 ? [resolve(getAbsolutePath('@storybook/html'), 'dist', 'entry-preview-docs.mjs')] : []);\n};\n"],"mappings":";;;;;;;AAaA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,kBAAkB,CAAmBA,UACzC,QAAQ,QAAQ,QAAQ,KAAK,OAAO,eAAe,CAAC,CAAC;AAEvD,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAM,WAAW,KAAK,WAAW,aAAa;AAE9C,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OACrD,kBACG;CACH,MAAM,SAAS,YAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CAAC,QAAQ,EAChB,UAAU,cAAc,KACzB,EAAC,AAAC;CACJ,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OACvE,QAAQ,CAAE,GACV,YACG;CACH,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,QAAQ,gBAAgB,kBAAkB,EAAE,QAAQ,yBAAyB,AAAC,IAAG,CAAE,EAAC;AAC9G"}
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 { dirname, join, resolve } from 'path';\nimport { createRequire } from 'module';\nimport { fileURLToPath } from 'url';\n\nimport { mergeConfig } from 'vite';\nimport stencil from 'unplugin-stencil/vite';\n\nimport { StorybookConfig } from './types.js';\n\nconst require = createRequire(import.meta.url);\nconst getAbsolutePath = <I extends string>(input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any;\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst renderer = join(__dirname, 'preview.js');\n\nexport const core: StorybookConfig['core'] = {\n builder: getAbsolutePath('@storybook/builder-vite'),\n renderer,\n};\n\nexport const viteFinal: StorybookConfig['viteFinal'] = async (defaultConfig) => {\n const config = mergeConfig(defaultConfig, {\n build: {\n target: 'es2020',\n rollupOptions: {\n external: ['@stencil/core'],\n },\n },\n plugins: [\n stencil({\n rootPath: defaultConfig.root,\n }),\n ],\n });\n\n return config;\n};\n\nexport const previewAnnotations: StorybookConfig['previewAnnotations'] = async (input = [], options) => {\n const docsEnabled = Object.keys(await options.presets.apply('docs', {}, options)).length > 0;\n const result: string[] = [];\n\n return result\n .concat(input)\n .concat([renderer])\n .concat(docsEnabled ? [resolve(getAbsolutePath('@storybook/html'), 'dist', 'entry-preview-docs.mjs')] : []);\n};\n"],"mappings":";;;;;;;AAaA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,kBAAkB,CAAmBA,UAAgB,QAAQ,QAAQ,QAAQ,KAAK,OAAO,eAAe,CAAC,CAAC;AAEhH,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAM,WAAW,KAAK,WAAW,aAAa;AAE9C,MAAaC,OAAgC;CAC3C,SAAS,gBAAgB,0BAA0B;CACnD;AACD;AAED,MAAaC,YAA0C,OAAO,kBAAkB;CAC9E,MAAM,SAAS,YAAY,eAAe;EACxC,OAAO;GACL,QAAQ;GACR,eAAe,EACb,UAAU,CAAC,eAAgB,EAC5B;EACF;EACD,SAAS,CACP,QAAQ,EACN,UAAU,cAAc,KACzB,EAAC,AACH;CACF,EAAC;AAEF,QAAO;AACR;AAED,MAAaC,qBAA4D,OAAO,QAAQ,CAAE,GAAE,YAAY;CACtG,MAAM,cAAc,OAAO,KAAK,MAAM,QAAQ,QAAQ,MAAM,QAAQ,CAAE,GAAE,QAAQ,CAAC,CAAC,SAAS;CAC3F,MAAMC,SAAmB,CAAE;AAE3B,QAAO,OACJ,OAAO,MAAM,CACb,OAAO,CAAC,QAAS,EAAC,CAClB,OAAO,cAAc,CAAC,QAAQ,gBAAgB,kBAAkB,EAAE,QAAQ,yBAAyB,AAAC,IAAG,CAAE,EAAC;AAC9G"}
@@ -1,15 +1,24 @@
1
1
  const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const __storybook_preview_api = require_chunk.__toESM(require("@storybook/preview-api"));
2
+ const storybook_preview_api = require_chunk.__toESM(require("storybook/preview-api"));
3
3
  const __stencil_core = require_chunk.__toESM(require("@stencil/core"));
4
4
 
5
5
  //#region src/render.ts
6
6
  const render = (args, context) => {
7
- const { component } = context;
7
+ const { component, parameters: parameters$1 } = context;
8
8
  if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
9
9
  const cmpName = customElements.getName(component);
10
10
  if (!cmpName) throw new Error("Component is not registered!");
11
+ const children = Object.entries(parameters$1.slots || []).map(([key, value]) => {
12
+ const slot = key === "default" ? void 0 : key;
13
+ const child = typeof value === "string" ? (0, __stencil_core.h)(void 0, { slot }, value) : {
14
+ ...value,
15
+ $attrs$: { slot }
16
+ };
17
+ child.$tag$ = child.$tag$ || (slot ? "span" : null);
18
+ return child.$tag$ ? child : child.$children$;
19
+ });
11
20
  const Component = `${cmpName}`;
12
- return (0, __stencil_core.h)(Component, { ...args });
21
+ return (0, __stencil_core.h)(Component, { ...args }, children);
13
22
  };
14
23
  function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
15
24
  const vdom = storyFn();
@@ -22,7 +31,7 @@ function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
22
31
  const element = document.createElement("div");
23
32
  canvasElement.appendChild(element);
24
33
  (0, __stencil_core.render)(vdom, element);
25
- (0, __storybook_preview_api.simulatePageLoad)(element);
34
+ (0, storybook_preview_api.simulatePageLoad)(element);
26
35
  }
27
36
 
28
37
  //#endregion
@@ -60,4 +69,4 @@ Object.defineProperty(exports, 'renderToCanvas', {
60
69
  return renderToCanvas;
61
70
  }
62
71
  });
63
- //# sourceMappingURL=preview-Nz-UTIbe.cjs.map
72
+ //# sourceMappingURL=preview-D_4Gl5tg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-D_4Gl5tg.cjs","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\nimport { render as renderStencil, h, VNode, Fragment } from '@stencil/core';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n\n const cmpName = customElements.getName(component);\n if (!cmpName) {\n throw new Error('Component is not registered!');\n }\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;AAMA,MAAaA,SAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;CAGlB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACH,OAAM,IAAI,MAAM;CAGlB,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,8BAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,sBAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,4BAAc,MAAM,QAAQ;AAC5B,6CAAiB,QAAQ;AAC1B;;;;;;;;;;AC9DD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}
@@ -1,4 +1,4 @@
1
- import { simulatePageLoad } from "@storybook/preview-api";
1
+ import { simulatePageLoad } from "storybook/preview-api";
2
2
  import { h, render } from "@stencil/core";
3
3
 
4
4
  //#region rolldown:runtime
@@ -13,12 +13,21 @@ var __export = (target, all) => {
13
13
  //#endregion
14
14
  //#region src/render.ts
15
15
  const render$1 = (args, context) => {
16
- const { component } = context;
16
+ const { component, parameters: parameters$1 } = context;
17
17
  if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
18
18
  const cmpName = customElements.getName(component);
19
19
  if (!cmpName) throw new Error("Component is not registered!");
20
+ const children = Object.entries(parameters$1.slots || []).map(([key, value]) => {
21
+ const slot = key === "default" ? void 0 : key;
22
+ const child = typeof value === "string" ? h(void 0, { slot }, value) : {
23
+ ...value,
24
+ $attrs$: { slot }
25
+ };
26
+ child.$tag$ = child.$tag$ || (slot ? "span" : null);
27
+ return child.$tag$ ? child : child.$children$;
28
+ });
20
29
  const Component = `${cmpName}`;
21
- return h(Component, { ...args });
30
+ return h(Component, { ...args }, children);
22
31
  };
23
32
  function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
24
33
  const vdom = storyFn();
@@ -46,4 +55,4 @@ const parameters = { renderer: "stencil" };
46
55
 
47
56
  //#endregion
48
57
  export { parameters, preview_exports, render$1 as render, renderToCanvas };
49
- //# sourceMappingURL=preview-B75wzZrU.js.map
58
+ //# sourceMappingURL=preview-Dn8QZb01.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-Dn8QZb01.js","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","children: any[]","parameters","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\nimport { simulatePageLoad } from 'storybook/preview-api';\nimport { render as renderStencil, h, VNode, Fragment } from '@stencil/core';\n\nimport type { StencilRenderer } from './types';\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component, parameters } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!');\n }\n\n const cmpName = customElements.getName(component);\n if (!cmpName) {\n throw new Error('Component is not registered!');\n }\n\n const children: any[] = Object.entries<VNode>(parameters.slots || []).map(([key, value]) => {\n // if the parameter key is 'default' don't give it a slot name so it renders just as a child\n const slot = key === 'default' ? undefined : key;\n // if the value it s a string, create a vnode with the string as the children\n const child =\n typeof value === 'string'\n ? h(undefined, { slot }, value)\n : {\n ...value,\n $attrs$: {\n slot,\n },\n };\n // if the value is a fragment and it is a named slot, create a span element with the slot name\n child.$tag$ = child.$tag$ || (slot ? 'span' : null);\n return child.$tag$ ? child : child.$children$;\n });\n\n const Component = `${cmpName}`;\n return h(Component, { ...args }, children);\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement'],\n) {\n const vdom = storyFn();\n showMain();\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild);\n }\n\n const element = document.createElement('div');\n canvasElement.appendChild(element);\n renderStencil(vdom, element);\n simulatePageLoad(element);\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;;;;;;;;;;AAMA,MAAaA,WAAgD,CAAC,MAAM,YAAY;CAC9E,MAAM,EAAE,WAAW,0BAAY,GAAG;AAElC,KAAI,MAAM,QAAQ,UAAU,CAC1B,OAAM,IAAI,MAAM;CAGlB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACH,OAAM,IAAI,MAAM;CAGlB,MAAMC,WAAkB,OAAO,QAAeC,aAAW,SAAS,CAAE,EAAC,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EAE1F,MAAM,OAAO,QAAQ,qBAAwB;EAE7C,MAAM,eACG,UAAU,WACb,UAAa,EAAE,KAAM,GAAE,MAAM,GAC7B;GACE,GAAG;GACH,SAAS,EACP,KACD;EACF;AAEP,QAAM,QAAQ,MAAM,UAAU,OAAO,SAAS;AAC9C,SAAO,MAAM,QAAQ,QAAQ,MAAM;CACpC,EAAC;CAEF,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,EAAE,WAAW,EAAE,GAAG,KAAM,GAAE,SAAS;AAC3C;AAED,SAAgB,eACd,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACA;CACA,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACvG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG1E,KAAI,cAAc,WAChB,eAAc,YAAY,cAAc,WAAW;CAGrD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,QAAc,MAAM,QAAQ;AAC5B,kBAAiB,QAAQ;AAC1B;;;;;;;;;;AC9DD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}
package/dist/preview.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_preview = require('./preview-Nz-UTIbe.cjs');
1
+ const require_preview = require('./preview-D_4Gl5tg.cjs');
2
2
 
3
3
  exports.parameters = require_preview.parameters;
4
4
  exports.render = require_preview.render;
@@ -1,5 +1,5 @@
1
- import { StencilRenderer } from "./types-BC4h6q-i.cjs";
2
- import { ArgsStoryFn, RenderContext } from "@storybook/types";
1
+ import { StencilRenderer } from "./types-CR2AtVj_.cjs";
2
+ import { ArgsStoryFn, RenderContext } from "storybook/internal/types";
3
3
 
4
4
  //#region src/render.d.ts
5
5
  declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
package/dist/preview.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { StencilRenderer } from "./types-CrBVXXLO.js";
2
- import { ArgsStoryFn, RenderContext } from "@storybook/types";
1
+ import { StencilRenderer } from "./types-DoLyzAU3.js";
2
+ import { ArgsStoryFn, RenderContext } from "storybook/internal/types";
3
3
 
4
4
  //#region src/render.d.ts
5
5
  declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
package/dist/preview.js CHANGED
@@ -1,3 +1,3 @@
1
- import { parameters, render, renderToCanvas } from "./preview-B75wzZrU.js";
1
+ import { parameters, render, renderToCanvas } from "./preview-Dn8QZb01.js";
2
2
 
3
3
  export { parameters, render, renderToCanvas };
@@ -1,6 +1,6 @@
1
1
  import { JSX, VNode } from "@stencil/core";
2
2
  import { StorybookConfigVite } from "@storybook/builder-vite";
3
- import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "@storybook/types";
3
+ import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
4
4
 
5
5
  //#region src/types.d.ts
6
6
  interface DevJSX {
@@ -68,4 +68,4 @@ declare global {
68
68
  }
69
69
  //#endregion
70
70
  export { ArgTypes, Args$1 as Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext$1 as StoryContext, StoryFn, StoryObj, StorybookConfig$1 as StorybookConfig, StrictArgs$1 as StrictArgs };
71
- //# sourceMappingURL=types-CrBVXXLO.d.ts.map
71
+ //# sourceMappingURL=types-CR2AtVj_.d.cts.map
@@ -1,6 +1,6 @@
1
1
  import { JSX, VNode } from "@stencil/core";
2
2
  import { StorybookConfigVite } from "@storybook/builder-vite";
3
- import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "@storybook/types";
3
+ import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters, ProjectAnnotations, StoryAnnotations, StoryContext, StorybookConfig, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
4
4
 
5
5
  //#region src/types.d.ts
6
6
  interface DevJSX {
@@ -68,4 +68,4 @@ declare global {
68
68
  }
69
69
  //#endregion
70
70
  export { ArgTypes, Args$1 as Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext$1 as StoryContext, StoryFn, StoryObj, StorybookConfig$1 as StorybookConfig, StrictArgs$1 as StrictArgs };
71
- //# sourceMappingURL=types-BC4h6q-i.d.cts.map
71
+ //# sourceMappingURL=types-DoLyzAU3.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/storybook-plugin",
3
- "version": "0.0.16",
3
+ "version": "0.2.0",
4
4
  "description": "Storybook plugin for Stencil",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/stenciljs/storybook",
@@ -64,24 +64,20 @@
64
64
  "build": "tsdown"
65
65
  },
66
66
  "dependencies": {
67
- "@storybook/addon-actions": "^8.6.12",
68
- "@storybook/builder-vite": "^8.6.12",
69
- "@storybook/core-events": "^8.6.12",
70
- "@storybook/docs-tools": "^8.6.12",
67
+ "@storybook/addon-actions": "^9.0.5",
68
+ "@storybook/builder-vite": "^9.0.5",
71
69
  "@storybook/global": "^5.0.0",
72
- "@storybook/html": "^8.6.12",
73
- "@storybook/preview-api": "^8.6.12",
74
- "@storybook/types": "^8.6.12",
70
+ "@storybook/html": "^9.0.5",
75
71
  "preact-render-to-string": "^6.5.13",
76
72
  "react-docgen-typescript": "^2.2.2",
77
73
  "unplugin-stencil": "^0.3.2"
78
74
  },
79
75
  "peerDependencies": {
80
- "@stencil/core": "^4.30.0"
76
+ "@stencil/core": "^4.30.0",
77
+ "storybook": "^9.0.5"
81
78
  },
82
79
  "devDependencies": {
83
- "@stencil/core": "4.30.0",
84
- "@storybook/types": "^8.6.12",
80
+ "@stencil/core": "^4.30.0",
85
81
  "@types/node": "^22.15.3",
86
82
  "tsdown": "^0.12.4",
87
83
  "typescript": "~5.8.3",
package/preset.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file seems to only be necessary for Windows
2
- module.exports = require("./dist/preset.js");
2
+ module.exports = require('./dist/preset.js');
@@ -24,5 +24,5 @@ export const Primary: Story = {
24
24
  first: 'John',
25
25
  last: 'Doe',
26
26
  middle: 'Michael',
27
- }
27
+ },
28
28
  };
@@ -32,4 +32,4 @@ export class MyComponent {
32
32
 
33
33
  function format(first?: string, middle?: string, last?: string): string {
34
34
  return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
35
- }
35
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"preview-B75wzZrU.js","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from '@storybook/types'\nimport { simulatePageLoad } from '@storybook/preview-api'\nimport { render as renderStencil, h } from '@stencil/core'\n\nimport type { StencilRenderer } from './types'\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!')\n }\n\n const cmpName = customElements.getName(component)\n if (!cmpName) {\n throw new Error('Component is not registered!')\n }\n\n const Component = `${cmpName}`;\n return h(Component, { ...args })\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement']\n) {\n const vdom = storyFn()\n showMain()\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild)\n }\n\n const element = document.createElement('div')\n canvasElement.appendChild(element)\n renderStencil(vdom, element);\n simulatePageLoad(element)\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;;;;;;;;;;AAMA,MAAaA,WAAgD,CAAC,MAAM,YAAY;CAC5E,MAAM,EAAE,WAAW,GAAG;AAEtB,KAAI,MAAM,QAAQ,UAAU,CACxB,OAAM,IAAI,MAAM;CAGpB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACD,OAAM,IAAI,MAAM;CAGpB,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,EAAE,WAAW,EAAE,GAAG,KAAM,EAAC;AACnC;AAED,SAAgB,eACZ,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACF;CACE,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACrG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG5E,KAAI,cAAc,WACd,eAAc,YAAY,cAAc,WAAW;CAGvD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,QAAc,MAAM,QAAQ;AAC5B,kBAAiB,QAAQ;AAC5B;;;;;;;;;;AC5CD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"preview-Nz-UTIbe.cjs","names":["render: ArgsStoryFn<StencilRenderer<unknown>>","canvasElement: StencilRenderer<unknown>['canvasElement']","parameters: { renderer: 'stencil' }"],"sources":["../src/render.ts","../src/preview.ts"],"sourcesContent":["import { ArgsStoryFn, RenderContext } from '@storybook/types'\nimport { simulatePageLoad } from '@storybook/preview-api'\nimport { render as renderStencil, h } from '@stencil/core'\n\nimport type { StencilRenderer } from './types'\n\nexport const render: ArgsStoryFn<StencilRenderer<unknown>> = (args, context) => {\n const { component } = context;\n\n if (Array.isArray(component)) {\n throw new Error('If your story does not contain a render function, you must provide a component property!')\n }\n\n const cmpName = customElements.getName(component)\n if (!cmpName) {\n throw new Error('Component is not registered!')\n }\n\n const Component = `${cmpName}`;\n return h(Component, { ...args })\n};\n\nexport function renderToCanvas(\n { storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>,\n canvasElement: StencilRenderer<unknown>['canvasElement']\n) {\n const vdom = storyFn()\n showMain()\n\n /**\n * If the component is not automatically registered after import, register it here\n */\n if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {\n customElements.define(storyContext.component.is, storyContext.component);\n }\n\n if (canvasElement.firstChild) {\n canvasElement.removeChild(canvasElement.firstChild)\n }\n\n const element = document.createElement('div')\n canvasElement.appendChild(element)\n renderStencil(vdom, element);\n simulatePageLoad(element)\n}\n","export const parameters: { renderer: 'stencil' } = { renderer: 'stencil' };\nexport { render, renderToCanvas } from './render.js';\n"],"mappings":";;;;;AAMA,MAAaA,SAAgD,CAAC,MAAM,YAAY;CAC5E,MAAM,EAAE,WAAW,GAAG;AAEtB,KAAI,MAAM,QAAQ,UAAU,CACxB,OAAM,IAAI,MAAM;CAGpB,MAAM,UAAU,eAAe,QAAQ,UAAU;AACjD,MAAK,QACD,OAAM,IAAI,MAAM;CAGpB,MAAM,aAAa,EAAE,QAAQ;AAC7B,QAAO,sBAAE,WAAW,EAAE,GAAG,KAAM,EAAC;AACnC;AAED,SAAgB,eACZ,EAAE,SAAS,UAAU,cAAuD,EAC5EC,eACF;CACE,MAAM,OAAO,SAAS;AACtB,WAAU;;;;AAKV,KAAI,aAAa,aAAa,aAAa,UAAU,OAAO,eAAe,IAAI,aAAa,UAAU,GAAG,CACrG,gBAAe,OAAO,aAAa,UAAU,IAAI,aAAa,UAAU;AAG5E,KAAI,cAAc,WACd,eAAc,YAAY,cAAc,WAAW;CAGvD,MAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,eAAc,YAAY,QAAQ;AAClC,4BAAc,MAAM,QAAQ;AAC5B,+CAAiB,QAAQ;AAC5B;;;;;;;;;;AC5CD,MAAaC,aAAsC,EAAE,UAAU,UAAW"}