@stencil/storybook-plugin 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-CsX-DzYB.cjs +42 -0
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +52 -0
- package/dist/index.d.ts +27 -5
- package/dist/index.js +31 -6
- package/dist/index.js.map +1 -0
- package/dist/node/index.cjs +9 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +7 -0
- package/dist/node/index.d.ts +7 -2
- package/dist/node/index.js +7 -2
- package/dist/node/index.js.map +1 -0
- package/dist/preset.cjs +37 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.d.cts +9 -0
- package/dist/preset.d.ts +9 -4
- package/dist/preset.js +29 -30
- package/dist/preset.js.map +1 -0
- package/dist/preview-B75wzZrU.js +49 -0
- package/dist/preview-B75wzZrU.js.map +1 -0
- package/dist/preview-Nz-UTIbe.cjs +63 -0
- package/dist/preview-Nz-UTIbe.cjs.map +1 -0
- package/dist/preview.cjs +5 -0
- package/dist/preview.d.cts +18 -0
- package/dist/preview.d.ts +17 -3
- package/dist/preview.js +3 -2
- package/dist/rollup-parseAst-t-4tfMPG.d.ts +24 -0
- package/dist/types-BC4h6q-i.d.cts +71 -0
- package/dist/types-CrBVXXLO.d.ts +71 -0
- package/package.json +12 -9
- package/dist/addArgsHelpers.d.ts +0 -10
- package/dist/addArgsHelpers.js +0 -37
- package/dist/component-to-jsx.d.ts +0 -2
- package/dist/component-to-jsx.js +0 -5
- package/dist/portable-stories.d.ts +0 -22
- package/dist/portable-stories.js +0 -25
- package/dist/render.d.ts +0 -4
- package/dist/render.js +0 -31
- package/dist/types.d.ts +0 -69
- package/dist/types.js +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
+
key = keys[i];
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(exports, '__export', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return __export;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, '__toESM', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return __toESM;
|
|
41
|
+
}
|
|
42
|
+
});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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"));
|
|
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
|
+
(0, __storybook_preview_api.setDefaultProjectAnnotations)(require_preview.preview_exports);
|
|
27
|
+
return (0, __storybook_preview_api.setProjectAnnotations)(projectAnnotations);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.setProjectAnnotations = setProjectAnnotations;
|
|
32
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
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";
|
|
3
|
+
|
|
4
|
+
//#region @types/rollup-parseAst.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extra type definitions for rollup/parseAst in cases the Rollup version between
|
|
8
|
+
* `@stencil/storybook-plugin` and `unplugin-stencil` is different. This may cause
|
|
9
|
+
* the following type error:
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* [ ERROR ] TypeScript: node_modules/vite/dist/node/index.d.ts:5:41
|
|
13
|
+
* Cannot find module 'rollup/parseAst' or its corresponding type
|
|
14
|
+
* declarations.
|
|
15
|
+
*
|
|
16
|
+
* L4: export { rollup as Rollup };
|
|
17
|
+
* L5: export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
18
|
+
* L6: import * as http from 'node:http';
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* This file is a workaround to make sure the type definitions are available when
|
|
22
|
+
* importing `rollup/parseAst` in `unplugin-stencil`.
|
|
23
|
+
*/
|
|
24
|
+
declare module 'rollup/parseAst' {
|
|
25
|
+
export function parseAst(code: string, options?: any): any;
|
|
26
|
+
export function parseAstAsync(code: string, options?: any): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/portable-stories.d.ts
|
|
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
|
+
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs, setProjectAnnotations };
|
|
52
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
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";
|
|
4
|
+
|
|
5
|
+
//#region src/portable-stories.d.ts
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
8
|
+
* Function that sets the globalConfig of your storybook. The global config is the preview module of
|
|
9
|
+
* your .storybook folder.
|
|
10
|
+
*
|
|
11
|
+
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
|
12
|
+
* stories when using `composeStories` or `composeStory`.
|
|
13
|
+
*
|
|
14
|
+
* Example:
|
|
15
|
+
*
|
|
16
|
+
* ```jsx
|
|
17
|
+
* // setup-file.js
|
|
18
|
+
* import { setProjectAnnotations } from '@storybook/web-components';
|
|
19
|
+
* import projectAnnotations from './.storybook/preview';
|
|
20
|
+
*
|
|
21
|
+
* setProjectAnnotations(projectAnnotations);
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
|
4
25
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
26
|
+
declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ArgTypes, Args, Decorator, Loader, Meta, Parameters, Preview, StencilRenderer, StoryContext, StoryFn, StoryObj, StorybookConfig, StrictArgs, setProjectAnnotations };
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
|
+
import { preview_exports } from "./preview-B75wzZrU.js";
|
|
2
|
+
import "./rollup-parseAst-t-4tfMPG.d.ts";
|
|
3
|
+
import { setDefaultProjectAnnotations, setProjectAnnotations as setProjectAnnotations$1 } from "@storybook/preview-api";
|
|
4
|
+
|
|
5
|
+
//#region src/portable-stories.tsx
|
|
1
6
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(preview_exports);
|
|
27
|
+
return setProjectAnnotations$1(projectAnnotations);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { setProjectAnnotations };
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { StorybookConfig } from "../types-CrBVXXLO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/node/index.d.ts
|
|
4
|
+
declare function defineMain(config: StorybookConfig): StorybookConfig;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { defineMain };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.js
CHANGED
|
@@ -0,0 +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"}
|
package/dist/preset.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
+
const path = require_chunk.__toESM(require("path"));
|
|
3
|
+
const module$1 = require_chunk.__toESM(require("module"));
|
|
4
|
+
const url = require_chunk.__toESM(require("url"));
|
|
5
|
+
const vite = require_chunk.__toESM(require("vite"));
|
|
6
|
+
const unplugin_stencil_vite = require_chunk.__toESM(require("unplugin-stencil/vite"));
|
|
7
|
+
|
|
8
|
+
//#region src/preset.ts
|
|
9
|
+
const require$1 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
10
|
+
const getAbsolutePath = (input) => (0, path.dirname)(require$1.resolve((0, path.join)(input, "package.json")));
|
|
11
|
+
const __dirname$1 = (0, path.dirname)((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
12
|
+
const renderer = (0, path.join)(__dirname$1, "preview.js");
|
|
13
|
+
const core = {
|
|
14
|
+
builder: getAbsolutePath("@storybook/builder-vite"),
|
|
15
|
+
renderer
|
|
16
|
+
};
|
|
17
|
+
const viteFinal = async (defaultConfig) => {
|
|
18
|
+
const config = (0, vite.mergeConfig)(defaultConfig, {
|
|
19
|
+
build: {
|
|
20
|
+
target: "es2020",
|
|
21
|
+
rollupOptions: { external: ["@stencil/core"] }
|
|
22
|
+
},
|
|
23
|
+
plugins: [(0, unplugin_stencil_vite.default)({ rootPath: defaultConfig.root })]
|
|
24
|
+
});
|
|
25
|
+
return config;
|
|
26
|
+
};
|
|
27
|
+
const previewAnnotations = async (input = [], options) => {
|
|
28
|
+
const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
29
|
+
const result = [];
|
|
30
|
+
return result.concat(input).concat([renderer]).concat(docsEnabled ? [(0, path.resolve)(getAbsolutePath("@storybook/html"), "dist", "entry-preview-docs.mjs")] : []);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.core = core;
|
|
35
|
+
exports.previewAnnotations = previewAnnotations;
|
|
36
|
+
exports.viteFinal = viteFinal;
|
|
37
|
+
//# sourceMappingURL=preset.cjs.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StorybookConfig } from "./types-BC4h6q-i.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/preset.d.ts
|
|
4
|
+
declare const core: StorybookConfig['core'];
|
|
5
|
+
declare const viteFinal: StorybookConfig["viteFinal"];
|
|
6
|
+
declare const previewAnnotations: StorybookConfig["previewAnnotations"];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { core, previewAnnotations, viteFinal };
|
|
9
|
+
//# sourceMappingURL=preset.d.cts.map
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { StorybookConfig } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { StorybookConfig } from "./types-CrBVXXLO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/preset.d.ts
|
|
4
|
+
declare const core: StorybookConfig['core'];
|
|
5
|
+
declare const viteFinal: StorybookConfig["viteFinal"];
|
|
6
|
+
declare const previewAnnotations: StorybookConfig["previewAnnotations"];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { core, previewAnnotations, viteFinal };
|
|
9
|
+
//# sourceMappingURL=preset.d.ts.map
|
package/dist/preset.js
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { dirname, join, resolve } from "
|
|
2
|
-
import { createRequire } from "
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import { mergeConfig } from
|
|
5
|
-
import stencil from
|
|
1
|
+
import { dirname, join, resolve } from "path";
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { mergeConfig } from "vite";
|
|
5
|
+
import stencil from "unplugin-stencil/vite";
|
|
6
|
+
|
|
7
|
+
//#region src/preset.ts
|
|
6
8
|
const require = createRequire(import.meta.url);
|
|
7
|
-
const getAbsolutePath = (input) => dirname(require.resolve(join(input,
|
|
9
|
+
const getAbsolutePath = (input) => dirname(require.resolve(join(input, "package.json")));
|
|
8
10
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const renderer = join(__dirname,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const renderer = join(__dirname, "preview.js");
|
|
12
|
+
const core = {
|
|
13
|
+
builder: getAbsolutePath("@storybook/builder-vite"),
|
|
14
|
+
renderer
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rootPath: defaultConfig.root,
|
|
24
|
-
})],
|
|
25
|
-
});
|
|
26
|
-
return config;
|
|
16
|
+
const viteFinal = async (defaultConfig) => {
|
|
17
|
+
const config = mergeConfig(defaultConfig, {
|
|
18
|
+
build: {
|
|
19
|
+
target: "es2020",
|
|
20
|
+
rollupOptions: { external: ["@stencil/core"] }
|
|
21
|
+
},
|
|
22
|
+
plugins: [stencil({ rootPath: defaultConfig.root })]
|
|
23
|
+
});
|
|
24
|
+
return config;
|
|
27
25
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.concat(input)
|
|
33
|
-
.concat([renderer])
|
|
34
|
-
.concat(docsEnabled ? [resolve(getAbsolutePath('@storybook/html'), 'dist', 'entry-preview-docs.mjs')] : []);
|
|
26
|
+
const previewAnnotations = async (input = [], options) => {
|
|
27
|
+
const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
28
|
+
const result = [];
|
|
29
|
+
return result.concat(input).concat([renderer]).concat(docsEnabled ? [resolve(getAbsolutePath("@storybook/html"), "dist", "entry-preview-docs.mjs")] : []);
|
|
35
30
|
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { core, previewAnnotations, viteFinal };
|
|
34
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { simulatePageLoad } from "@storybook/preview-api";
|
|
2
|
+
import { h, render } from "@stencil/core";
|
|
3
|
+
|
|
4
|
+
//#region rolldown:runtime
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/render.ts
|
|
15
|
+
const render$1 = (args, context) => {
|
|
16
|
+
const { component } = context;
|
|
17
|
+
if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
|
|
18
|
+
const cmpName = customElements.getName(component);
|
|
19
|
+
if (!cmpName) throw new Error("Component is not registered!");
|
|
20
|
+
const Component = `${cmpName}`;
|
|
21
|
+
return h(Component, { ...args });
|
|
22
|
+
};
|
|
23
|
+
function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
|
|
24
|
+
const vdom = storyFn();
|
|
25
|
+
showMain();
|
|
26
|
+
/**
|
|
27
|
+
* If the component is not automatically registered after import, register it here
|
|
28
|
+
*/
|
|
29
|
+
if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) customElements.define(storyContext.component.is, storyContext.component);
|
|
30
|
+
if (canvasElement.firstChild) canvasElement.removeChild(canvasElement.firstChild);
|
|
31
|
+
const element = document.createElement("div");
|
|
32
|
+
canvasElement.appendChild(element);
|
|
33
|
+
render(vdom, element);
|
|
34
|
+
simulatePageLoad(element);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/preview.ts
|
|
39
|
+
var preview_exports = {};
|
|
40
|
+
__export(preview_exports, {
|
|
41
|
+
parameters: () => parameters,
|
|
42
|
+
render: () => render$1,
|
|
43
|
+
renderToCanvas: () => renderToCanvas
|
|
44
|
+
});
|
|
45
|
+
const parameters = { renderer: "stencil" };
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { parameters, preview_exports, render$1 as render, renderToCanvas };
|
|
49
|
+
//# sourceMappingURL=preview-B75wzZrU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CsX-DzYB.cjs');
|
|
2
|
+
const __storybook_preview_api = require_chunk.__toESM(require("@storybook/preview-api"));
|
|
3
|
+
const __stencil_core = require_chunk.__toESM(require("@stencil/core"));
|
|
4
|
+
|
|
5
|
+
//#region src/render.ts
|
|
6
|
+
const render = (args, context) => {
|
|
7
|
+
const { component } = context;
|
|
8
|
+
if (Array.isArray(component)) throw new Error("If your story does not contain a render function, you must provide a component property!");
|
|
9
|
+
const cmpName = customElements.getName(component);
|
|
10
|
+
if (!cmpName) throw new Error("Component is not registered!");
|
|
11
|
+
const Component = `${cmpName}`;
|
|
12
|
+
return (0, __stencil_core.h)(Component, { ...args });
|
|
13
|
+
};
|
|
14
|
+
function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
|
|
15
|
+
const vdom = storyFn();
|
|
16
|
+
showMain();
|
|
17
|
+
/**
|
|
18
|
+
* If the component is not automatically registered after import, register it here
|
|
19
|
+
*/
|
|
20
|
+
if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) customElements.define(storyContext.component.is, storyContext.component);
|
|
21
|
+
if (canvasElement.firstChild) canvasElement.removeChild(canvasElement.firstChild);
|
|
22
|
+
const element = document.createElement("div");
|
|
23
|
+
canvasElement.appendChild(element);
|
|
24
|
+
(0, __stencil_core.render)(vdom, element);
|
|
25
|
+
(0, __storybook_preview_api.simulatePageLoad)(element);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/preview.ts
|
|
30
|
+
var preview_exports = {};
|
|
31
|
+
require_chunk.__export(preview_exports, {
|
|
32
|
+
parameters: () => parameters,
|
|
33
|
+
render: () => render,
|
|
34
|
+
renderToCanvas: () => renderToCanvas
|
|
35
|
+
});
|
|
36
|
+
const parameters = { renderer: "stencil" };
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
Object.defineProperty(exports, 'parameters', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return parameters;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, 'preview_exports', {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return preview_exports;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, 'render', {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return render;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, 'renderToCanvas', {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () {
|
|
60
|
+
return renderToCanvas;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=preview-Nz-UTIbe.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/preview.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StencilRenderer } from "./types-BC4h6q-i.cjs";
|
|
2
|
+
import { ArgsStoryFn, RenderContext } from "@storybook/types";
|
|
3
|
+
|
|
4
|
+
//#region src/render.d.ts
|
|
5
|
+
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
+
declare function renderToCanvas({
|
|
7
|
+
storyFn,
|
|
8
|
+
showMain,
|
|
9
|
+
storyContext
|
|
10
|
+
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/preview.d.ts
|
|
13
|
+
declare const parameters: {
|
|
14
|
+
renderer: 'stencil';
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { parameters, render, renderToCanvas };
|
|
18
|
+
//# sourceMappingURL=preview.d.cts.map
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { StencilRenderer } from "./types-CrBVXXLO.js";
|
|
2
|
+
import { ArgsStoryFn, RenderContext } from "@storybook/types";
|
|
3
|
+
|
|
4
|
+
//#region src/render.d.ts
|
|
5
|
+
declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
6
|
+
declare function renderToCanvas({
|
|
7
|
+
storyFn,
|
|
8
|
+
showMain,
|
|
9
|
+
storyContext
|
|
10
|
+
}: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/preview.d.ts
|
|
13
|
+
declare const parameters: {
|
|
14
|
+
renderer: 'stencil';
|
|
3
15
|
};
|
|
4
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
export { parameters, render, renderToCanvas };
|
|
18
|
+
//# sourceMappingURL=preview.d.ts.map
|
package/dist/preview.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { parameters, render, renderToCanvas } from "./preview-B75wzZrU.js";
|
|
2
|
+
|
|
3
|
+
export { parameters, render, renderToCanvas };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region @types/rollup-parseAst.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Extra type definitions for rollup/parseAst in cases the Rollup version between
|
|
4
|
+
* `@stencil/storybook-plugin` and `unplugin-stencil` is different. This may cause
|
|
5
|
+
* the following type error:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* [ ERROR ] TypeScript: node_modules/vite/dist/node/index.d.ts:5:41
|
|
9
|
+
* Cannot find module 'rollup/parseAst' or its corresponding type
|
|
10
|
+
* declarations.
|
|
11
|
+
*
|
|
12
|
+
* L4: export { rollup as Rollup };
|
|
13
|
+
* L5: export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
14
|
+
* L6: import * as http from 'node:http';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* This file is a workaround to make sure the type definitions are available when
|
|
18
|
+
* importing `rollup/parseAst` in `unplugin-stencil`.
|
|
19
|
+
*/
|
|
20
|
+
declare module 'rollup/parseAst' {
|
|
21
|
+
export function parseAst(code: string, options?: any): any;
|
|
22
|
+
export function parseAstAsync(code: string, options?: any): Promise<any>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rollup-parseAst-t-4tfMPG.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { JSX, VNode } from "@stencil/core";
|
|
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";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
interface DevJSX {
|
|
7
|
+
fileName: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
columnNumber: number;
|
|
10
|
+
stack?: string;
|
|
11
|
+
}
|
|
12
|
+
type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | VNode;
|
|
13
|
+
type ComponentChildren<PROPS> = PROPS extends {
|
|
14
|
+
children: any;
|
|
15
|
+
} ? never : {
|
|
16
|
+
children?: JSXChildren;
|
|
17
|
+
};
|
|
18
|
+
type PublicProps<PROPS> = (PROPS extends Record<any, any> ? Omit<PROPS, `${string}$`> : unknown extends PROPS ? {} : PROPS) & ComponentChildren<PROPS>;
|
|
19
|
+
type FunctionComponent<P = unknown> = {
|
|
20
|
+
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): VNode;
|
|
21
|
+
}['renderFn'];
|
|
22
|
+
type Component<PROPS = unknown> = FunctionComponent<PublicProps<PROPS>>;
|
|
23
|
+
interface StencilRenderer<T> extends WebRenderer {
|
|
24
|
+
component: Component<T> | any;
|
|
25
|
+
storyResult: ReturnType<Component<T>>;
|
|
26
|
+
args: T;
|
|
27
|
+
}
|
|
28
|
+
type Preview = ProjectAnnotations<StencilRenderer<unknown>>;
|
|
29
|
+
/**
|
|
30
|
+
* Metadata to configure the stories for a component.
|
|
31
|
+
*
|
|
32
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
33
|
+
*/
|
|
34
|
+
type Meta<TArgs = Args> = ComponentAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
35
|
+
/**
|
|
36
|
+
* Story function that represents a CSFv2 component example.
|
|
37
|
+
*
|
|
38
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
39
|
+
*/
|
|
40
|
+
type StoryFn<TArgs = Args> = AnnotatedStoryFn<StencilRenderer<TArgs>, TArgs>;
|
|
41
|
+
/**
|
|
42
|
+
* Story function that represents a CSFv3 component example.
|
|
43
|
+
*
|
|
44
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
45
|
+
*/
|
|
46
|
+
type StoryObj<TArgs = Args> = StoryAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
47
|
+
type Decorator<TArgs = StrictArgs> = DecoratorFunction<StencilRenderer<TArgs>, TArgs>;
|
|
48
|
+
type Loader<TArgs = StrictArgs> = LoaderFunction<StencilRenderer<TArgs>, TArgs>;
|
|
49
|
+
type StoryContext$1<TArgs = StrictArgs> = StoryContext<StencilRenderer<TArgs>, TArgs>;
|
|
50
|
+
type StorybookConfig$1 = Omit<StorybookConfig, 'framework'> & {
|
|
51
|
+
framework: '@stencil/storybook-plugin' | {
|
|
52
|
+
name: '@stencil/storybook-plugin';
|
|
53
|
+
};
|
|
54
|
+
} & StorybookConfigVite;
|
|
55
|
+
/**
|
|
56
|
+
* Extend the JSX namespace to include StencilJSX.IntrinsicElements, StencilJSX.Element, and StencilJSX.ElementClass.
|
|
57
|
+
* This is necessary to allow the use of Stencil components in Storybook.
|
|
58
|
+
* Without we get are getting type errors.
|
|
59
|
+
*/
|
|
60
|
+
type StencilIntrinsic = JSX.IntrinsicElements;
|
|
61
|
+
type StencilElement = JSX.Element;
|
|
62
|
+
declare global {
|
|
63
|
+
namespace JSX {
|
|
64
|
+
interface IntrinsicElements extends StencilIntrinsic {}
|
|
65
|
+
interface Element extends StencilElement {}
|
|
66
|
+
interface ElementClass {}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
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
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { JSX, VNode } from "@stencil/core";
|
|
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";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
interface DevJSX {
|
|
7
|
+
fileName: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
columnNumber: number;
|
|
10
|
+
stack?: string;
|
|
11
|
+
}
|
|
12
|
+
type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | VNode;
|
|
13
|
+
type ComponentChildren<PROPS> = PROPS extends {
|
|
14
|
+
children: any;
|
|
15
|
+
} ? never : {
|
|
16
|
+
children?: JSXChildren;
|
|
17
|
+
};
|
|
18
|
+
type PublicProps<PROPS> = (PROPS extends Record<any, any> ? Omit<PROPS, `${string}$`> : unknown extends PROPS ? {} : PROPS) & ComponentChildren<PROPS>;
|
|
19
|
+
type FunctionComponent<P = unknown> = {
|
|
20
|
+
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): VNode;
|
|
21
|
+
}['renderFn'];
|
|
22
|
+
type Component<PROPS = unknown> = FunctionComponent<PublicProps<PROPS>>;
|
|
23
|
+
interface StencilRenderer<T> extends WebRenderer {
|
|
24
|
+
component: Component<T> | any;
|
|
25
|
+
storyResult: ReturnType<Component<T>>;
|
|
26
|
+
args: T;
|
|
27
|
+
}
|
|
28
|
+
type Preview = ProjectAnnotations<StencilRenderer<unknown>>;
|
|
29
|
+
/**
|
|
30
|
+
* Metadata to configure the stories for a component.
|
|
31
|
+
*
|
|
32
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
33
|
+
*/
|
|
34
|
+
type Meta<TArgs = Args> = ComponentAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
35
|
+
/**
|
|
36
|
+
* Story function that represents a CSFv2 component example.
|
|
37
|
+
*
|
|
38
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
39
|
+
*/
|
|
40
|
+
type StoryFn<TArgs = Args> = AnnotatedStoryFn<StencilRenderer<TArgs>, TArgs>;
|
|
41
|
+
/**
|
|
42
|
+
* Story function that represents a CSFv3 component example.
|
|
43
|
+
*
|
|
44
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
45
|
+
*/
|
|
46
|
+
type StoryObj<TArgs = Args> = StoryAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
47
|
+
type Decorator<TArgs = StrictArgs> = DecoratorFunction<StencilRenderer<TArgs>, TArgs>;
|
|
48
|
+
type Loader<TArgs = StrictArgs> = LoaderFunction<StencilRenderer<TArgs>, TArgs>;
|
|
49
|
+
type StoryContext$1<TArgs = StrictArgs> = StoryContext<StencilRenderer<TArgs>, TArgs>;
|
|
50
|
+
type StorybookConfig$1 = Omit<StorybookConfig, 'framework'> & {
|
|
51
|
+
framework: '@stencil/storybook-plugin' | {
|
|
52
|
+
name: '@stencil/storybook-plugin';
|
|
53
|
+
};
|
|
54
|
+
} & StorybookConfigVite;
|
|
55
|
+
/**
|
|
56
|
+
* Extend the JSX namespace to include StencilJSX.IntrinsicElements, StencilJSX.Element, and StencilJSX.ElementClass.
|
|
57
|
+
* This is necessary to allow the use of Stencil components in Storybook.
|
|
58
|
+
* Without we get are getting type errors.
|
|
59
|
+
*/
|
|
60
|
+
type StencilIntrinsic = JSX.IntrinsicElements;
|
|
61
|
+
type StencilElement = JSX.Element;
|
|
62
|
+
declare global {
|
|
63
|
+
namespace JSX {
|
|
64
|
+
interface IntrinsicElements extends StencilIntrinsic {}
|
|
65
|
+
interface Element extends StencilElement {}
|
|
66
|
+
interface ElementClass {}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/storybook-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Storybook plugin for Stencil",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/stenciljs/storybook",
|
|
@@ -34,32 +34,34 @@
|
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
|
-
"import": "./dist/index.js"
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
38
39
|
},
|
|
39
40
|
"./preset": {
|
|
40
41
|
"types": "./dist/preset.d.ts",
|
|
41
42
|
"import": "./dist/preset.js",
|
|
42
|
-
"require": "./dist/preset.
|
|
43
|
+
"require": "./dist/preset.cjs"
|
|
43
44
|
},
|
|
44
45
|
"./preview": {
|
|
45
46
|
"types": "./dist/preview.d.ts",
|
|
46
47
|
"import": "./dist/preview.js",
|
|
47
|
-
"require": "./dist/preview.
|
|
48
|
+
"require": "./dist/preview.cjs"
|
|
48
49
|
},
|
|
49
50
|
"./dist/preview.js": {
|
|
50
51
|
"types": "./dist/preview.d.ts",
|
|
51
52
|
"import": "./dist/preview.js",
|
|
52
|
-
"require": "./dist/preview.
|
|
53
|
+
"require": "./dist/preview.cjs"
|
|
53
54
|
},
|
|
54
55
|
"./node": {
|
|
55
56
|
"types": "./dist/node/index.d.ts",
|
|
56
|
-
"import": "./dist/node/index.js"
|
|
57
|
+
"import": "./dist/node/index.js",
|
|
58
|
+
"require": "./dist/node/index.cjs"
|
|
57
59
|
},
|
|
58
60
|
"./package.json": "./package.json"
|
|
59
61
|
},
|
|
60
62
|
"scripts": {
|
|
61
|
-
"watch": "
|
|
62
|
-
"build": "
|
|
63
|
+
"watch": "tsdown --watch",
|
|
64
|
+
"build": "tsdown"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
67
|
"@storybook/addon-actions": "^8.6.12",
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"@storybook/types": "^8.6.12",
|
|
73
75
|
"preact-render-to-string": "^6.5.13",
|
|
74
76
|
"react-docgen-typescript": "^2.2.2",
|
|
75
|
-
"unplugin-stencil": "^0.2
|
|
77
|
+
"unplugin-stencil": "^0.3.2"
|
|
76
78
|
},
|
|
77
79
|
"peerDependencies": {
|
|
78
80
|
"@stencil/core": "^4.30.0"
|
|
@@ -81,6 +83,7 @@
|
|
|
81
83
|
"@stencil/core": "4.30.0",
|
|
82
84
|
"@storybook/types": "^8.6.12",
|
|
83
85
|
"@types/node": "^22.15.3",
|
|
86
|
+
"tsdown": "^0.12.4",
|
|
84
87
|
"typescript": "~5.8.3",
|
|
85
88
|
"vite": "^6.3.3"
|
|
86
89
|
},
|
package/dist/addArgsHelpers.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Renderer, ArgsEnhancer } from "@storybook/types";
|
|
2
|
-
/**
|
|
3
|
-
* Automatically add action args for argTypes whose name
|
|
4
|
-
* matches a regex, such as `^on.*` for react-style `onClick` etc.
|
|
5
|
-
*/
|
|
6
|
-
export declare const inferActionsFromArgTypesRegex: ArgsEnhancer<Renderer>;
|
|
7
|
-
/**
|
|
8
|
-
* Add action args for list of strings.
|
|
9
|
-
*/
|
|
10
|
-
export declare const addActionsFromArgTypes: ArgsEnhancer<Renderer>;
|
package/dist/addArgsHelpers.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// This file is entirely copied from @storybook/addon-actions (changing the action import)
|
|
2
|
-
import { action } from "@storybook/addon-actions";
|
|
3
|
-
const isInInitialArgs = (name, initialArgs) => typeof initialArgs[name] === "undefined" && !(name in initialArgs);
|
|
4
|
-
/**
|
|
5
|
-
* Automatically add action args for argTypes whose name
|
|
6
|
-
* matches a regex, such as `^on.*` for react-style `onClick` etc.
|
|
7
|
-
*/
|
|
8
|
-
export const inferActionsFromArgTypesRegex = (context) => {
|
|
9
|
-
const { initialArgs, argTypes, parameters: { actions }, } = context;
|
|
10
|
-
if (!actions || actions.disable || !actions.argTypesRegex || !argTypes) {
|
|
11
|
-
return {};
|
|
12
|
-
}
|
|
13
|
-
const argTypesRegex = new RegExp(actions.argTypesRegex);
|
|
14
|
-
const argTypesMatchingRegex = Object.entries(argTypes).filter(([name]) => !!argTypesRegex.test(name));
|
|
15
|
-
return argTypesMatchingRegex.reduce((acc, [name, argType]) => {
|
|
16
|
-
if (isInInitialArgs(name, initialArgs)) {
|
|
17
|
-
acc[name] = action(name);
|
|
18
|
-
}
|
|
19
|
-
return acc;
|
|
20
|
-
}, {});
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Add action args for list of strings.
|
|
24
|
-
*/
|
|
25
|
-
export const addActionsFromArgTypes = (context) => {
|
|
26
|
-
const { initialArgs, argTypes, parameters: { actions }, } = context;
|
|
27
|
-
if (actions?.disable || !argTypes) {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
const argTypesWithAction = Object.entries(argTypes).filter(([name, argType]) => !!argType["action"]);
|
|
31
|
-
return argTypesWithAction.reduce((acc, [name, argType]) => {
|
|
32
|
-
if (isInInitialArgs(name, initialArgs)) {
|
|
33
|
-
acc[name] = action(typeof argType["action"] === "string" ? argType["action"] : name);
|
|
34
|
-
}
|
|
35
|
-
return acc;
|
|
36
|
-
}, {});
|
|
37
|
-
};
|
package/dist/component-to-jsx.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from '@storybook/types';
|
|
2
|
-
import type { StencilRenderer } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Function that sets the globalConfig of your storybook. The global config is the preview module of
|
|
5
|
-
* your .storybook folder.
|
|
6
|
-
*
|
|
7
|
-
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
|
8
|
-
* stories when using `composeStories` or `composeStory`.
|
|
9
|
-
*
|
|
10
|
-
* Example:
|
|
11
|
-
*
|
|
12
|
-
* ```jsx
|
|
13
|
-
* // setup-file.js
|
|
14
|
-
* import { setProjectAnnotations } from '@storybook/web-components';
|
|
15
|
-
* import projectAnnotations from './.storybook/preview';
|
|
16
|
-
*
|
|
17
|
-
* setProjectAnnotations(projectAnnotations);
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
|
21
|
-
*/
|
|
22
|
-
export declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<StencilRenderer<unknown>>;
|
package/dist/portable-stories.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { setProjectAnnotations as originalSetProjectAnnotations, setDefaultProjectAnnotations, } from '@storybook/preview-api';
|
|
2
|
-
import * as stencilAnnotations from './preview';
|
|
3
|
-
/**
|
|
4
|
-
* Function that sets the globalConfig of your storybook. The global config is the preview module of
|
|
5
|
-
* your .storybook folder.
|
|
6
|
-
*
|
|
7
|
-
* It should be run a single time, so that your global config (e.g. decorators) is applied to your
|
|
8
|
-
* stories when using `composeStories` or `composeStory`.
|
|
9
|
-
*
|
|
10
|
-
* Example:
|
|
11
|
-
*
|
|
12
|
-
* ```jsx
|
|
13
|
-
* // setup-file.js
|
|
14
|
-
* import { setProjectAnnotations } from '@storybook/web-components';
|
|
15
|
-
* import projectAnnotations from './.storybook/preview';
|
|
16
|
-
*
|
|
17
|
-
* setProjectAnnotations(projectAnnotations);
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
|
|
21
|
-
*/
|
|
22
|
-
export function setProjectAnnotations(projectAnnotations) {
|
|
23
|
-
setDefaultProjectAnnotations(stencilAnnotations);
|
|
24
|
-
return originalSetProjectAnnotations(projectAnnotations);
|
|
25
|
-
}
|
package/dist/render.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ArgsStoryFn, RenderContext } from '@storybook/types';
|
|
2
|
-
import type { StencilRenderer } from './types';
|
|
3
|
-
export declare const render: ArgsStoryFn<StencilRenderer<unknown>>;
|
|
4
|
-
export declare function renderToCanvas({ storyFn, showMain, storyContext }: RenderContext<StencilRenderer<unknown>>, canvasElement: StencilRenderer<unknown>['canvasElement']): void;
|
package/dist/render.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { simulatePageLoad } from '@storybook/preview-api';
|
|
2
|
-
import { render as renderStencil } from '@stencil/core';
|
|
3
|
-
import { componentToJSX } from './component-to-jsx.js';
|
|
4
|
-
export const render = (args, context) => {
|
|
5
|
-
const { component } = context;
|
|
6
|
-
if (Array.isArray(component)) {
|
|
7
|
-
throw new Error('If your story does not contain a render function, you must provide a component property!');
|
|
8
|
-
}
|
|
9
|
-
const cmpName = customElements.getName(component);
|
|
10
|
-
if (!cmpName) {
|
|
11
|
-
throw new Error('Component is not registered!');
|
|
12
|
-
}
|
|
13
|
-
return componentToJSX(cmpName, args);
|
|
14
|
-
};
|
|
15
|
-
export function renderToCanvas({ storyFn, showMain, storyContext }, canvasElement) {
|
|
16
|
-
const vdom = storyFn();
|
|
17
|
-
showMain();
|
|
18
|
-
/**
|
|
19
|
-
* If the component is not automatically registered after import, register it here
|
|
20
|
-
*/
|
|
21
|
-
if (storyContext.component && storyContext.component.is && !customElements.get(storyContext.component.is)) {
|
|
22
|
-
customElements.define(storyContext.component.is, storyContext.component);
|
|
23
|
-
}
|
|
24
|
-
if (canvasElement.firstChild) {
|
|
25
|
-
canvasElement.removeChild(canvasElement.firstChild);
|
|
26
|
-
}
|
|
27
|
-
const element = document.createElement('div');
|
|
28
|
-
canvasElement.appendChild(element);
|
|
29
|
-
renderStencil(vdom, element);
|
|
30
|
-
simulatePageLoad(element);
|
|
31
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { VNode, JSX as StencilJSX } from '@stencil/core';
|
|
2
|
-
import { StorybookConfigVite } from '@storybook/builder-vite';
|
|
3
|
-
import { WebRenderer } from '@storybook/types';
|
|
4
|
-
export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
|
|
5
|
-
import type { AnnotatedStoryFn, Args, ComponentAnnotations, StoryAnnotations, DecoratorFunction, LoaderFunction, StoryContext as GenericStoryContext, StrictArgs, ProjectAnnotations, StorybookConfig as StorybookConfigBase } from '@storybook/types';
|
|
6
|
-
interface DevJSX {
|
|
7
|
-
fileName: string;
|
|
8
|
-
lineNumber: number;
|
|
9
|
-
columnNumber: number;
|
|
10
|
-
stack?: string;
|
|
11
|
-
}
|
|
12
|
-
type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | VNode;
|
|
13
|
-
type ComponentChildren<PROPS> = PROPS extends {
|
|
14
|
-
children: any;
|
|
15
|
-
} ? never : {
|
|
16
|
-
children?: JSXChildren;
|
|
17
|
-
};
|
|
18
|
-
type PublicProps<PROPS> = (PROPS extends Record<any, any> ? Omit<PROPS, `${string}$`> : unknown extends PROPS ? {} : PROPS) & ComponentChildren<PROPS>;
|
|
19
|
-
type FunctionComponent<P = unknown> = {
|
|
20
|
-
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): VNode;
|
|
21
|
-
}['renderFn'];
|
|
22
|
-
type Component<PROPS = unknown> = FunctionComponent<PublicProps<PROPS>>;
|
|
23
|
-
export interface StencilRenderer<T> extends WebRenderer {
|
|
24
|
-
component: Component<T> | any;
|
|
25
|
-
storyResult: ReturnType<Component<T>>;
|
|
26
|
-
args: T;
|
|
27
|
-
}
|
|
28
|
-
export type Preview = ProjectAnnotations<StencilRenderer<unknown>>;
|
|
29
|
-
/**
|
|
30
|
-
* Metadata to configure the stories for a component.
|
|
31
|
-
*
|
|
32
|
-
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
33
|
-
*/
|
|
34
|
-
export type Meta<TArgs = Args> = ComponentAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
35
|
-
/**
|
|
36
|
-
* Story function that represents a CSFv2 component example.
|
|
37
|
-
*
|
|
38
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
39
|
-
*/
|
|
40
|
-
export type StoryFn<TArgs = Args> = AnnotatedStoryFn<StencilRenderer<TArgs>, TArgs>;
|
|
41
|
-
/**
|
|
42
|
-
* Story function that represents a CSFv3 component example.
|
|
43
|
-
*
|
|
44
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
45
|
-
*/
|
|
46
|
-
export type StoryObj<TArgs = Args> = StoryAnnotations<StencilRenderer<TArgs>, TArgs>;
|
|
47
|
-
export type Decorator<TArgs = StrictArgs> = DecoratorFunction<StencilRenderer<TArgs>, TArgs>;
|
|
48
|
-
export type Loader<TArgs = StrictArgs> = LoaderFunction<StencilRenderer<TArgs>, TArgs>;
|
|
49
|
-
export type StoryContext<TArgs = StrictArgs> = GenericStoryContext<StencilRenderer<TArgs>, TArgs>;
|
|
50
|
-
export type StorybookConfig = Omit<StorybookConfigBase, 'framework'> & {
|
|
51
|
-
framework: '@stencil/storybook-plugin' | {
|
|
52
|
-
name: '@stencil/storybook-plugin';
|
|
53
|
-
};
|
|
54
|
-
} & StorybookConfigVite;
|
|
55
|
-
/**
|
|
56
|
-
* Extend the JSX namespace to include StencilJSX.IntrinsicElements, StencilJSX.Element, and StencilJSX.ElementClass.
|
|
57
|
-
* This is necessary to allow the use of Stencil components in Storybook.
|
|
58
|
-
* Without we get are getting type errors.
|
|
59
|
-
*/
|
|
60
|
-
declare global {
|
|
61
|
-
namespace JSX {
|
|
62
|
-
interface IntrinsicElements extends StencilJSX.IntrinsicElements {
|
|
63
|
-
}
|
|
64
|
-
interface Element extends StencilJSX.Element {
|
|
65
|
-
}
|
|
66
|
-
interface ElementClass {
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|