@aurelia/storybook 1.0.0 → 1.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.
- package/README.md +20 -23
- package/__tests__/render.test.ts +1 -1
- package/apps/hello-world/.storybook/main.ts +5 -7
- package/apps/hello-world/package-lock.json +10141 -0
- package/apps/hello-world/package.json +6 -10
- package/apps/hello-world/src/stories/hello-world.stories.ts +5 -4
- package/apps/hello-world-webpack/.storybook/main.ts +1 -3
- package/apps/hello-world-webpack/package-lock.json +77 -1399
- package/apps/hello-world-webpack/package.json +3 -5
- package/dist/index.js +79 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -3
- package/dist/index.mjs.map +1 -1
- package/dist/preview/render.js +79 -3
- package/dist/preview/render.js.map +1 -1
- package/dist/preview/render.mjs +79 -3
- package/dist/preview/render.mjs.map +1 -1
- package/dist/preview.js +0 -1
- package/dist/preview.js.map +1 -1
- package/dist/preview.mjs +0 -1
- package/dist/preview.mjs.map +1 -1
- package/package.json +6 -10
- package/rollup.config.mjs +0 -3
- package/src/preview/render.ts +2 -2
- package/src/preview/types.ts +1 -1
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> **Note:** Storybook support is currently in an early stage, and there may be bugs, issues, or unsupported features in this plugin. The intention is to make this plugin more production-ready when Aurelia 2 reaches stable release.
|
|
4
4
|
|
|
5
|
-
This package provides an integration between Aurelia 2 and Storybook
|
|
5
|
+
This package provides an integration between Aurelia 2 and Storybook 9 using Vite or Webpack. It lets you write and render Aurelia 2 components as Storybook stories with full support for Storybook controls, actions, and interactive testing.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- **Vite & Webpack Support**: Works with both Vite (via `@storybook/builder-vite`) and Webpack 5 (via `@storybook/builder-webpack5`).
|
|
10
10
|
- **Aurelia Enhancement**: Renders Aurelia 2 components using Aurelia's `enhance()` API.
|
|
11
|
-
- **Storybook
|
|
11
|
+
- **Storybook 9 Compatibility**: Fully compatible with Storybook 9's new rendering API.
|
|
12
12
|
- **Arg & Action Support**: Use story args and actions as you would with any Storybook story.
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -22,7 +22,13 @@ npm install --save-dev @aurelia/storybook
|
|
|
22
22
|
Also, make sure to have the required dependencies installed in your project:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install --save-dev
|
|
25
|
+
npm install --save-dev storybook @storybook/builder-vite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For testing functionality, you may also want to install:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save-dev @storybook/test @storybook/addon-actions
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
> **Tip:** Check your existing Aurelia 2 app for already installed versions. The peer dependencies are expected to be compatible with Aurelia 2 beta releases (see `package.json` for version details).
|
|
@@ -43,16 +49,14 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
43
49
|
Create or update your `.storybook/main.ts` file with the following contents:
|
|
44
50
|
|
|
45
51
|
```typescript
|
|
46
|
-
import type { StorybookConfig } from '
|
|
47
|
-
import { mergeConfig } from 'vite';
|
|
52
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
53
|
+
import { mergeConfig, type InlineConfig } from 'vite';
|
|
48
54
|
|
|
49
|
-
const config: StorybookConfig & { viteFinal?: (config:
|
|
55
|
+
const config: StorybookConfig & { viteFinal?: (config: InlineConfig, options: { configType: string }) => InlineConfig | Promise<InlineConfig> } = {
|
|
50
56
|
stories: ['../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
51
57
|
addons: [
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
// '@storybook/addon-essentials',
|
|
55
|
-
// '@storybook/addon-interactions'
|
|
58
|
+
// Additional addons (essentials are now built into Storybook 9 core):
|
|
59
|
+
'@storybook/addon-links'
|
|
56
60
|
],
|
|
57
61
|
framework: {
|
|
58
62
|
name: '@aurelia/storybook',
|
|
@@ -73,7 +77,7 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
73
77
|
},
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
export default config
|
|
80
|
+
export default config;
|
|
77
81
|
```
|
|
78
82
|
|
|
79
83
|
- **.storybook/preview.ts**
|
|
@@ -85,21 +89,20 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
85
89
|
export { render, renderToCanvas } from '@aurelia/storybook';
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
> **Note:**
|
|
92
|
+
> **Note:** Essential features like actions, controls, backgrounds, and viewport are now built into Storybook 9 core and don't need to be installed separately. However, if you need to use the `action()` function in your stories (for programmatic actions), you may still need to install `@storybook/addon-actions`. Additional addons like `@storybook/addon-links` can be installed and added to the `addons` array in your configuration.
|
|
89
93
|
|
|
90
94
|
### Using with Webpack
|
|
91
95
|
|
|
92
96
|
If you prefer to use Webpack instead of Vite, update your `.storybook/main.ts` configuration:
|
|
93
97
|
|
|
94
98
|
```typescript
|
|
95
|
-
import type { StorybookConfig } from '
|
|
99
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
96
100
|
|
|
97
101
|
const config: StorybookConfig = {
|
|
98
102
|
stories: ['../src/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
99
103
|
addons: [
|
|
100
104
|
'@storybook/addon-webpack5-compiler-swc',
|
|
101
|
-
'@storybook/addon-links'
|
|
102
|
-
'@storybook/addon-essentials'
|
|
105
|
+
'@storybook/addon-links'
|
|
103
106
|
],
|
|
104
107
|
framework: {
|
|
105
108
|
name: '@aurelia/storybook',
|
|
@@ -133,7 +136,7 @@ Aurelia 2 stories are written similarly to standard Storybook stories, with a fe
|
|
|
133
136
|
```typescript
|
|
134
137
|
import { HelloWorld } from '../hello-world';
|
|
135
138
|
import { action } from '@storybook/addon-actions';
|
|
136
|
-
import { userEvent, within } from '@storybook/
|
|
139
|
+
import { userEvent, within } from '@storybook/test';
|
|
137
140
|
|
|
138
141
|
const meta = {
|
|
139
142
|
title: 'Example/HelloWorld',
|
|
@@ -214,13 +217,7 @@ If you wish to contribute or modify the integration:
|
|
|
214
217
|
npm run watch
|
|
215
218
|
```
|
|
216
219
|
|
|
217
|
-
3. **
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm link @aurelia/storybook
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
4. **Run Storybook** in your local Aurelia application to see the integration in action.
|
|
220
|
+
3. **Run Storybook** in your local application to see the integration in action.
|
|
224
221
|
|
|
225
222
|
## Contributing
|
|
226
223
|
|
package/__tests__/render.test.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { StorybookConfig } from '
|
|
2
|
-
import { mergeConfig } from 'vite';
|
|
1
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
2
|
+
import { mergeConfig, type InlineConfig } from 'vite';
|
|
3
3
|
|
|
4
|
-
const config: StorybookConfig & { viteFinal?: (config:
|
|
4
|
+
const config: StorybookConfig & { viteFinal?: (config: InlineConfig, options: { configType: string }) => InlineConfig | Promise<InlineConfig> } = {
|
|
5
5
|
stories: ['../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
6
6
|
addons: [
|
|
7
|
-
'@storybook/addon-links'
|
|
8
|
-
'@storybook/addon-essentials',
|
|
9
|
-
'@storybook/addon-interactions'
|
|
7
|
+
'@storybook/addon-links'
|
|
10
8
|
],
|
|
11
9
|
framework: {
|
|
12
10
|
name: '@aurelia/storybook',
|
|
@@ -27,4 +25,4 @@ const config: StorybookConfig & { viteFinal?: (config: any, options: any) => any
|
|
|
27
25
|
},
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
export default config
|
|
28
|
+
export default config;
|