@stencil/storybook-plugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +86 -0
  3. package/package.json +89 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2025 OutSystems Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # StencilJS Storybook Plugin
2
+
3
+ > This is still early and work in progress, don't use it yet!
4
+
5
+ ## Setup
6
+
7
+ In an existing StencilJS project, run:
8
+
9
+ ```sh
10
+ npx storybook@next init
11
+ ```
12
+
13
+ to setup a new Storybook project. Select any preset available, e.g. Lit and finish the setup process. After, install the StencilJS preset.
14
+
15
+ ```sh
16
+ npm i --save-dev @stencil/storybook
17
+ ```
18
+
19
+ Last, update the `.storybook/main.ts` file as following:
20
+
21
+ ```ts
22
+ const config = {
23
+ stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
24
+ addons: [
25
+ "@storybook/addon-links",
26
+ "@storybook/addon-essentials",
27
+ "@storybook/addon-interactions",
28
+ ],
29
+ framework: {
30
+ name: "@stencil/storybook-plugin"
31
+ }
32
+ };
33
+
34
+ export default config;
35
+ ```
36
+
37
+ See the [Storybook Docs](https://storybook.js.org/docs/7.0/qwik/get-started/introduction) for the best documentation on getting started with Storybook.
38
+
39
+ ## Usage
40
+
41
+ A basic story will look like this:
42
+
43
+ ```tsx
44
+ import type { Meta, StoryObj } from '@stencil/storybook-plugin';
45
+ import { h } from '@stencil/core';
46
+
47
+ import { MyComponent } from './my-component';
48
+
49
+ const meta = {
50
+ title: 'MyComponent',
51
+ component: MyComponent,
52
+ parameters: {
53
+ layout: 'centered',
54
+ },
55
+ argTypes: {
56
+ first: { control: 'text' },
57
+ last: { control: 'text' },
58
+ middle: { control: 'text' },
59
+ },
60
+ args: { first: 'John', last: 'Doe', middle: 'Michael' },
61
+ } satisfies Meta<MyComponent>;
62
+
63
+ export default meta;
64
+ type Story = StoryObj<MyComponent>;
65
+
66
+ export const Primary: Story = {
67
+ args: {
68
+ first: 'John',
69
+ last: 'Doe',
70
+ middle: 'Michael',
71
+ },
72
+ render: (props) => {
73
+ return <my-component {...props} />;
74
+ }
75
+ };
76
+ ```
77
+
78
+ ## Limitations
79
+
80
+ This is early development and we are still seeing some limitations we want to see fixed:
81
+
82
+ - Story is completely reloaded when component is changed (no hot module replacement)
83
+ - There is no automation yet for easily scaffolding storybook in a Stencil project.
84
+ - Stories are run in dev mode - no SSR, or serialization happens
85
+
86
+ Please get involved and support the project with code contributions. Thanks!
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@stencil/storybook-plugin",
3
+ "version": "0.0.1",
4
+ "description": "Storybook plugin for Stencil",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/stenciljs/storybook",
7
+ "bugs": {
8
+ "url": "https://github.com/stenciljs/storybook"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/stenciljs/storybook.git",
13
+ "directory": "packages/plugin"
14
+ },
15
+ "keywords": [
16
+ "storybook",
17
+ "stencil",
18
+ "stenciljs",
19
+ "webcomponents",
20
+ "components",
21
+ "framework"
22
+ ],
23
+ "type": "module",
24
+ "main": "dist/index.js",
25
+ "module": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "//": "not sure why dist/preview is needed, but it is",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js"
35
+ },
36
+ "./preset": {
37
+ "types": "./dist/preset.d.ts",
38
+ "import": "./dist/preset.js",
39
+ "require": "./dist/preset.js"
40
+ },
41
+ "./preview": {
42
+ "types": "./dist/preview.d.ts",
43
+ "import": "./dist/preview.js",
44
+ "require": "./dist/preview.js"
45
+ },
46
+ "./dist/preview.js": {
47
+ "types": "./dist/preview.d.ts",
48
+ "import": "./dist/preview.js",
49
+ "require": "./dist/preview.js"
50
+ },
51
+ "./node": {
52
+ "types": "./dist/node/index.d.ts",
53
+ "import": "./dist/node/index.js"
54
+ },
55
+ "./package.json": "./package.json"
56
+ },
57
+ "scripts": {
58
+ "watch": "tsc --watch --outDir ./dist --listEmittedFiles",
59
+ "build": "tsc --outDir ./dist --listEmittedFiles"
60
+ },
61
+ "dependencies": {
62
+ "@stencil/core": "4.29.2-dev.1745369714.ab62ab3",
63
+ "@storybook/addon-actions": "^8.6.12",
64
+ "@storybook/builder-vite": "^7.6.16 || ^8.0.0",
65
+ "@storybook/core-events": "^8.6.12",
66
+ "@storybook/docs-tools": "^8.6.12",
67
+ "@storybook/global": "^5.0.0",
68
+ "@storybook/html": "^8.6.12",
69
+ "@storybook/preview-api": "^8.6.12",
70
+ "preact-render-to-string": "^6.5.13",
71
+ "react-docgen-typescript": "^2.2.2",
72
+ "unplugin-stencil": "^0.2.2"
73
+ },
74
+ "peerDependencies": {
75
+ "@stencil/core": "4.29.2-dev.1745369714.ab62ab3"
76
+ },
77
+ "devDependencies": {
78
+ "@storybook/types": "^8.4.1",
79
+ "@types/node": "^22.8.7",
80
+ "typescript": "~5.6.3",
81
+ "vite": "^5.4.10"
82
+ },
83
+ "engines": {
84
+ "node": ">=20"
85
+ },
86
+ "publishConfig": {
87
+ "access": "public"
88
+ }
89
+ }