@aurelia/storybook 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +195 -12
  3. package/dist/index.d.ts +25 -0
  4. package/dist/index.js +101 -27
  5. package/dist/index.js.map +1 -1
  6. package/dist/preset.d.ts +21 -0
  7. package/dist/preset.js +74 -20
  8. package/dist/preset.js.map +1 -1
  9. package/dist/preview/helpers.d.ts +2 -0
  10. package/dist/preview/helpers.js +6 -0
  11. package/dist/preview/helpers.js.map +1 -0
  12. package/dist/preview/render.d.ts +7 -0
  13. package/dist/preview/render.js +99 -28
  14. package/dist/preview/render.js.map +1 -1
  15. package/dist/preview/storybook-types-runtime.d.ts +1 -0
  16. package/dist/preview/storybook-types-runtime.js +5 -0
  17. package/dist/preview/storybook-types-runtime.js.map +1 -0
  18. package/dist/preview/storybook-types.d.ts +27 -0
  19. package/dist/preview/types-runtime.d.ts +1 -0
  20. package/dist/preview/types-runtime.js +5 -0
  21. package/dist/preview/types-runtime.js.map +1 -0
  22. package/dist/preview/types.d.ts +44 -0
  23. package/dist/preview.d.ts +3 -0
  24. package/dist/preview.js +104 -29
  25. package/dist/preview.js.map +1 -1
  26. package/dist/webpack.d.ts +10 -0
  27. package/dist/webpack.js +19 -1
  28. package/dist/webpack.js.map +1 -1
  29. package/package.json +75 -15
  30. package/preset.js +2 -1
  31. package/CONTINUITY.md +0 -22
  32. package/__tests__/preset.test.ts +0 -49
  33. package/__tests__/preview.test.ts +0 -139
  34. package/__tests__/render.test.ts +0 -187
  35. package/__tests__/webpack.test.ts +0 -21
  36. package/apps/hello-world/.storybook/main.ts +0 -49
  37. package/apps/hello-world/.storybook/preview.ts +0 -1
  38. package/apps/hello-world/.stylelintrc.json +0 -5
  39. package/apps/hello-world/README.md +0 -28
  40. package/apps/hello-world/eslint.config.mjs +0 -25
  41. package/apps/hello-world/favicon.ico +0 -0
  42. package/apps/hello-world/index.html +0 -17
  43. package/apps/hello-world/package-lock.json +0 -9307
  44. package/apps/hello-world/package.json +0 -55
  45. package/apps/hello-world/src/components/feedback-form.html +0 -111
  46. package/apps/hello-world/src/components/feedback-form.ts +0 -45
  47. package/apps/hello-world/src/components/notification-center.html +0 -119
  48. package/apps/hello-world/src/components/notification-center.ts +0 -27
  49. package/apps/hello-world/src/components/stat-card.html +0 -107
  50. package/apps/hello-world/src/components/stat-card.ts +0 -33
  51. package/apps/hello-world/src/components/weather-widget.html +0 -89
  52. package/apps/hello-world/src/components/weather-widget.ts +0 -30
  53. package/apps/hello-world/src/hello-world.html +0 -48
  54. package/apps/hello-world/src/hello-world.ts +0 -17
  55. package/apps/hello-world/src/main.ts +0 -6
  56. package/apps/hello-world/src/my-app.html +0 -1
  57. package/apps/hello-world/src/my-app.ts +0 -3
  58. package/apps/hello-world/src/resource.d.ts +0 -15
  59. package/apps/hello-world/src/services/weather-service.ts +0 -15
  60. package/apps/hello-world/src/stories/feedback-form.stories.ts +0 -52
  61. package/apps/hello-world/src/stories/hello-world.stories.ts +0 -53
  62. package/apps/hello-world/src/stories/notification-center.stories.ts +0 -81
  63. package/apps/hello-world/src/stories/stat-card.stories.ts +0 -65
  64. package/apps/hello-world/src/stories/weather-widget.stories.ts +0 -57
  65. package/apps/hello-world/test/my-app.spec.ts +0 -15
  66. package/apps/hello-world/test/setup.ts +0 -29
  67. package/apps/hello-world/tsconfig.json +0 -19
  68. package/apps/hello-world/tsconfig.vitest.json +0 -11
  69. package/apps/hello-world/vite.config.ts +0 -17
  70. package/apps/hello-world/vitest.config.ts +0 -15
  71. package/apps/hello-world-webpack/.env.development +0 -0
  72. package/apps/hello-world-webpack/.storybook/main.ts +0 -14
  73. package/apps/hello-world-webpack/.storybook/preview.ts +0 -3
  74. package/apps/hello-world-webpack/.stylelintrc.json +0 -5
  75. package/apps/hello-world-webpack/README.md +0 -29
  76. package/apps/hello-world-webpack/eslint.config.mjs +0 -25
  77. package/apps/hello-world-webpack/favicon.ico +0 -0
  78. package/apps/hello-world-webpack/index.html +0 -15
  79. package/apps/hello-world-webpack/package-lock.json +0 -9853
  80. package/apps/hello-world-webpack/package.json +0 -51
  81. package/apps/hello-world-webpack/src/components/feedback-form.html +0 -111
  82. package/apps/hello-world-webpack/src/components/feedback-form.ts +0 -45
  83. package/apps/hello-world-webpack/src/components/notification-center.html +0 -119
  84. package/apps/hello-world-webpack/src/components/notification-center.ts +0 -27
  85. package/apps/hello-world-webpack/src/components/stat-card.html +0 -107
  86. package/apps/hello-world-webpack/src/components/stat-card.ts +0 -33
  87. package/apps/hello-world-webpack/src/components/weather-widget.html +0 -89
  88. package/apps/hello-world-webpack/src/components/weather-widget.ts +0 -30
  89. package/apps/hello-world-webpack/src/hello-world.html +0 -48
  90. package/apps/hello-world-webpack/src/hello-world.ts +0 -17
  91. package/apps/hello-world-webpack/src/main.ts +0 -6
  92. package/apps/hello-world-webpack/src/my-app.css +0 -3
  93. package/apps/hello-world-webpack/src/my-app.html +0 -1
  94. package/apps/hello-world-webpack/src/my-app.stories.ts +0 -15
  95. package/apps/hello-world-webpack/src/my-app.ts +0 -3
  96. package/apps/hello-world-webpack/src/resource.d.ts +0 -13
  97. package/apps/hello-world-webpack/src/services/weather-service.ts +0 -15
  98. package/apps/hello-world-webpack/src/stories/feedback-form.stories.ts +0 -52
  99. package/apps/hello-world-webpack/src/stories/hello-world.stories.ts +0 -53
  100. package/apps/hello-world-webpack/src/stories/notification-center.stories.ts +0 -81
  101. package/apps/hello-world-webpack/src/stories/stat-card.stories.ts +0 -65
  102. package/apps/hello-world-webpack/src/stories/weather-widget.stories.ts +0 -57
  103. package/apps/hello-world-webpack/tsconfig.json +0 -18
  104. package/apps/hello-world-webpack/webpack.config.js +0 -111
  105. package/dist/preview/types.js +0 -2
  106. package/dist/preview/types.js.map +0 -1
  107. package/jest.config.js +0 -9
  108. package/rollup.config.mjs +0 -50
  109. package/src/index.ts +0 -32
  110. package/src/preset.ts +0 -49
  111. package/src/preview/render.ts +0 -175
  112. package/src/preview/types.ts +0 -7
  113. package/src/preview.ts +0 -1
  114. package/src/webpack.ts +0 -21
  115. package/tsconfig.build.json +0 -5
  116. package/tsconfig.json +0 -15
@@ -1,15 +0,0 @@
1
- import { MyApp } from './my-app';
2
-
3
- const meta = {
4
- title: 'Example/MyApp',
5
- component: MyApp,
6
- render: () => ({
7
- template: `<my-app></my-app>`,
8
- }),
9
- };
10
-
11
- export default meta;
12
-
13
- export const Default = {
14
- args: {}
15
- };
@@ -1,3 +0,0 @@
1
- export class MyApp {
2
- public message = 'Hello World!';
3
- }
@@ -1,13 +0,0 @@
1
- declare module '*.html' {
2
- import { IContainer, PartialBindableDefinition } from 'aurelia';
3
- export const name: string;
4
- export const template: string;
5
- export default template;
6
- export const dependencies: string[];
7
- export const containerless: boolean | undefined;
8
- export const bindables: Record<string, PartialBindableDefinition>;
9
- export const shadowOptions: { mode: 'open' | 'closed' } | undefined;
10
- export function register(container: IContainer): void;
11
- }
12
-
13
- declare module '*.css';
@@ -1,15 +0,0 @@
1
- import { DI } from 'aurelia';
2
-
3
- export interface WeatherSummary {
4
- location: string;
5
- condition: string;
6
- temperature: number;
7
- high: number;
8
- low: number;
9
- }
10
-
11
- export interface WeatherService {
12
- getWeather(location: string): Promise<WeatherSummary>;
13
- }
14
-
15
- export const IWeatherService = DI.createInterface<WeatherService>('IWeatherService');
@@ -1,52 +0,0 @@
1
- import { fn, userEvent, within } from 'storybook/test';
2
- import { FeedbackForm } from '../components/feedback-form';
3
-
4
- const meta = {
5
- title: 'Dashboard/FeedbackForm',
6
- component: FeedbackForm,
7
- parameters: {
8
- layout: 'centered',
9
- },
10
- render: (args) => ({
11
- template: `<feedback-form topics.bind="topics"
12
- submitting.bind="submitting"
13
- on-submit.bind="onSubmit"></feedback-form>`,
14
- props: args,
15
- components: [FeedbackForm],
16
- }),
17
- };
18
-
19
- export default meta;
20
-
21
- type Story = typeof meta;
22
-
23
- export const DefaultForm = {
24
- args: {
25
- topics: ['Bug report', 'Feature request', 'General question'],
26
- onSubmit: fn(),
27
- submitting: false,
28
- },
29
- };
30
-
31
- export const SubmittingState = {
32
- args: {
33
- topics: ['Design review', 'Accessibility', 'Performance'],
34
- submitting: true,
35
- onSubmit: fn(),
36
- },
37
- };
38
-
39
- export const FillAndSubmit = {
40
- args: {
41
- topics: ['Beta feedback', 'Success story'],
42
- onSubmit: fn(),
43
- },
44
- play: async ({ canvasElement }) => {
45
- const canvas = within(canvasElement);
46
- await userEvent.type(canvas.getByLabelText('Name'), 'Jordan');
47
- await userEvent.type(canvas.getByLabelText('Email'), 'jordan@example.com');
48
- await userEvent.selectOptions(canvas.getByLabelText('Topic'), 'Success story');
49
- await userEvent.type(canvas.getByLabelText('Message'), 'The new timeline view is great');
50
- await userEvent.click(canvas.getByRole('button', { name: /send feedback/i }));
51
- },
52
- };
@@ -1,53 +0,0 @@
1
- import { HelloWorld } from '../hello-world';
2
- import { fn, userEvent, within } from 'storybook/test';
3
-
4
- const meta = {
5
- title: 'Example/HelloWorld',
6
- component: HelloWorld,
7
- render: () => ({
8
- template: `<hello-world message.bind="message" on-increment.bind="onIncrement"></hello-world>`,
9
- }),
10
- argTypes: {
11
- message: { control: 'text' },
12
- onIncrement: { action: 'increment' }
13
- }
14
- };
15
-
16
- export default meta;
17
-
18
- export const DefaultHelloWorld = {
19
- args: {
20
- message: 'Hello from Aurelia Storybook',
21
- onIncrement: fn()
22
- }
23
- };
24
-
25
- export const InteractiveHelloWorld = {
26
- args: {
27
- message: 'Try clicking the button!',
28
- onIncrement: fn()
29
- },
30
- play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
31
- const canvas = within(canvasElement);
32
- const button = canvas.getByRole('button');
33
- // Simulate three button clicks
34
- await userEvent.click(button);
35
- await userEvent.click(button);
36
- await userEvent.click(button);
37
- }
38
- };
39
-
40
- export const NoArgs = {
41
- render: () => ({
42
- template: `<hello-world></hello-world>`
43
- })
44
- };
45
-
46
- export const WithCustomTemplate = {
47
- render: () => ({
48
- template: `<hello-world message.bind="message">Click me!</hello-world>`
49
- }),
50
- args: {
51
- message: 'This is a custom message'
52
- }
53
- };
@@ -1,81 +0,0 @@
1
- import { fn, userEvent, within } from 'storybook/test';
2
- import { NotificationCenter, NotificationItem } from '../components/notification-center';
3
-
4
- const baseNotifications: NotificationItem[] = [
5
- {
6
- id: 1,
7
- title: 'Build succeeded',
8
- message: 'Main pipeline finished in 4m 12s.',
9
- level: 'success',
10
- timestamp: 'Today - 09:24',
11
- },
12
- {
13
- id: 2,
14
- title: 'New comment',
15
- message: 'Samira replied to your review on PR #512.',
16
- level: 'info',
17
- timestamp: 'Today - 08:51',
18
- },
19
- {
20
- id: 3,
21
- title: 'Usage warning',
22
- message: 'API quota is at 85% of the monthly allocation.',
23
- level: 'warning',
24
- timestamp: 'Yesterday - 17:05',
25
- },
26
- {
27
- id: 4,
28
- title: 'Error spike',
29
- message: 'Synthetic tests detected an uptick in 500s.',
30
- level: 'error',
31
- timestamp: 'Yesterday - 15:33',
32
- },
33
- ];
34
-
35
- const meta = {
36
- title: 'Dashboard/NotificationCenter',
37
- component: NotificationCenter,
38
- render: (args) => ({
39
- template: `<notification-center notifications.bind="notifications"
40
- max-visible.bind="maxVisible"
41
- on-dismiss.bind="onDismiss"
42
- show-timestamp.bind="showTimestamp"></notification-center>`,
43
- props: args,
44
- components: [NotificationCenter],
45
- }),
46
- };
47
-
48
- export default meta;
49
-
50
- type Story = typeof meta;
51
-
52
- export const DefaultNotifications = {
53
- args: {
54
- notifications: baseNotifications,
55
- maxVisible: 3,
56
- showTimestamp: true,
57
- onDismiss: fn(),
58
- },
59
- };
60
-
61
- export const CompactList = {
62
- args: {
63
- notifications: baseNotifications.slice(0, 2),
64
- maxVisible: 2,
65
- onDismiss: fn(),
66
- showTimestamp: false,
67
- },
68
- };
69
-
70
- export const Interactions = {
71
- args: {
72
- notifications: baseNotifications,
73
- maxVisible: 4,
74
- onDismiss: fn(),
75
- },
76
- play: async ({ canvasElement }) => {
77
- const canvas = within(canvasElement);
78
- const dismissButtons = await canvas.findAllByRole('button', { name: /dismiss/i });
79
- await userEvent.click(dismissButtons[0]);
80
- },
81
- };
@@ -1,65 +0,0 @@
1
- import { fn, userEvent, within } from 'storybook/test';
2
- import { StatCard } from '../components/stat-card';
3
-
4
- const meta = {
5
- title: 'Dashboard/StatCard',
6
- component: StatCard,
7
- parameters: {
8
- layout: 'centered',
9
- },
10
- render: (args) => ({
11
- components: [StatCard],
12
- template: `<stat-card title.bind="title"
13
- value.bind="value"
14
- unit.bind="unit"
15
- change.bind="change"
16
- change-copy.bind="changeCopy"
17
- description.bind="description"
18
- on-refresh.bind="onRefresh"></stat-card>`,
19
- props: args,
20
- }),
21
- };
22
-
23
- export default meta;
24
-
25
- type Story = typeof meta;
26
-
27
- export const DefaultCard = {
28
- args: {
29
- title: 'Active users',
30
- value: 1284,
31
- unit: '',
32
- change: 12.5,
33
- changeCopy: 'vs last week',
34
- description: 'Rolling 7-day average of unique user sessions.',
35
- onRefresh: fn(),
36
- },
37
- };
38
-
39
- export const NegativeTrend = {
40
- args: {
41
- title: 'NPS score',
42
- value: 42,
43
- change: -6.3,
44
- changeCopy: 'vs previous survey',
45
- description: 'Direct feedback collected from in-app survey responses.',
46
- onRefresh: fn(),
47
- },
48
- };
49
-
50
- export const ManualRefreshDemo = {
51
- args: {
52
- title: 'Deploy success rate',
53
- value: '99.2',
54
- unit: '%',
55
- change: 1.1,
56
- changeCopy: 'vs last 24h',
57
- description: 'Completed deploys without rollbacks.',
58
- onRefresh: fn(),
59
- },
60
- play: async ({ canvasElement }) => {
61
- const canvas = within(canvasElement);
62
- const refreshButton = await canvas.findByRole('button', { name: /refresh metric/i });
63
- await userEvent.click(refreshButton);
64
- },
65
- };
@@ -1,57 +0,0 @@
1
- import { Registration } from 'aurelia';
2
- import { fn, userEvent, within } from 'storybook/test';
3
- import { WeatherWidget } from '../components/weather-widget';
4
- import { IWeatherService, WeatherService, WeatherSummary } from '../services/weather-service';
5
-
6
- const mockService: WeatherService = {
7
- async getWeather(location: string): Promise<WeatherSummary> {
8
- return {
9
- location,
10
- condition: location.includes('Berlin') ? 'Cloudy' : 'Sunny',
11
- temperature: location.includes('Berlin') ? 16 : 24,
12
- high: location.includes('Berlin') ? 18 : 27,
13
- low: location.includes('Berlin') ? 11 : 19,
14
- };
15
- },
16
- };
17
-
18
- const meta = {
19
- title: 'Dashboard/WeatherWidget',
20
- component: WeatherWidget,
21
- parameters: {
22
- layout: 'centered',
23
- },
24
- render: (args) => ({
25
- template: `<weather-widget location.bind="location"></weather-widget>`,
26
- props: args,
27
- components: [WeatherWidget],
28
- items: [Registration.instance(IWeatherService, mockService)],
29
- }),
30
- };
31
-
32
- export default meta;
33
-
34
- type Story = typeof meta;
35
-
36
- export const DefaultWeather = {
37
- args: {
38
- location: 'Seattle, WA',
39
- },
40
- };
41
-
42
- export const EuropeanCity = {
43
- args: {
44
- location: 'Berlin, Germany',
45
- },
46
- };
47
-
48
- export const RefreshInteraction = {
49
- args: {
50
- location: 'Lisbon, Portugal',
51
- },
52
- play: async ({ canvasElement }) => {
53
- const canvas = within(canvasElement);
54
- const refreshButton = await canvas.findByRole('button', { name: /refresh/i });
55
- await userEvent.click(refreshButton);
56
- },
57
- };
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "esnext",
4
- "moduleResolution": "bundler",
5
- "skipLibCheck": true,
6
- "target": "ES2017",
7
- "esModuleInterop": true,
8
- "resolveJsonModule": true,
9
- "importHelpers": true,
10
- "sourceMap": true
11
- },
12
- "include": [
13
- "src"
14
- ],
15
- "files": [
16
- "src/resource.d.ts"
17
- ]
18
- }
@@ -1,111 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- const path = require('path');
3
- const HtmlWebpackPlugin = require('html-webpack-plugin');
4
- const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
5
- const Dotenv = require('dotenv-webpack');
6
- const TerserPlugin = require('terser-webpack-plugin');
7
-
8
-
9
- const cssLoader = {
10
- loader: 'css-loader'
11
- };
12
-
13
- const postcssLoader = {
14
- loader: 'postcss-loader',
15
- options: {
16
- postcssOptions: {
17
- plugins: ['autoprefixer']
18
- }
19
- }
20
- };
21
-
22
- module.exports = function(env, { analyze }) {
23
- const production = env.production || process.env.NODE_ENV === 'production';
24
- return {
25
- target: 'web',
26
- mode: production ? 'production' : 'development',
27
- devtool: production ? undefined : 'eval-source-map',
28
- optimization: {
29
- minimizer: [
30
- new TerserPlugin({
31
- terserOptions: {
32
- // Terser fast minify mode
33
- // https://github.com/terser-js/terser#terser-fast-minify-mode
34
- // It's a good balance on size and speed to turn off compress.
35
- // Also bypass some terser bug.
36
- compress: false
37
- },
38
- }),
39
- ],
40
- },
41
- entry: {
42
- entry: './src/main.ts',
43
- },
44
- output: {
45
- clean: true,
46
- path: path.resolve(__dirname, 'dist'),
47
- filename: production ? '[name].[contenthash].bundle.js' : '[name].bundle.js',
48
- },
49
- resolve: {
50
- extensions: ['.ts', '.js'],
51
- modules: [path.resolve(__dirname, 'src'), 'node_modules'],
52
- alias: production ? {
53
- // add your production aliases here
54
- } : {
55
- ...getAureliaDevAliases()
56
- // add your development aliases here
57
- }
58
- },
59
- devServer: {
60
- historyApiFallback: true,
61
- open: !process.env.CI,
62
- port: 9000
63
- },
64
- module: {
65
- rules: [
66
- { test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset' },
67
- { test: /\.(woff|woff2|ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/i, type: 'asset' },
68
- { test: /\.css$/i, use: [ 'style-loader', cssLoader, postcssLoader ] },
69
- { test: /\.ts$/i, use: ['ts-loader', '@aurelia/webpack-loader'], exclude: /node_modules/ },
70
- {
71
- test: /[/\\]src[/\\].+\.html$/i,
72
- use: '@aurelia/webpack-loader',
73
- exclude: /node_modules/
74
- }
75
- ]
76
- },
77
- plugins: [
78
- new HtmlWebpackPlugin({ template: 'index.html', favicon: 'favicon.ico' }),
79
- new Dotenv({
80
- path: `./.env${production ? '' : '.' + (process.env.NODE_ENV || 'development')}`,
81
- }),
82
- analyze && new BundleAnalyzerPlugin()
83
- ].filter(p => p)
84
- }
85
- }
86
-
87
- function getAureliaDevAliases() {
88
- return [
89
- 'aurelia',
90
- 'fetch-client',
91
- 'kernel',
92
- 'metadata',
93
- 'platform',
94
- 'platform-browser',
95
- 'route-recognizer',
96
- 'router',
97
- 'router-lite',
98
- 'runtime',
99
- 'runtime-html',
100
- 'testing',
101
- 'state',
102
- 'ui-virtualization'
103
- ].reduce((map, pkg) => {
104
- const name = pkg === 'aurelia' ? pkg : `@aurelia/${pkg}`;
105
- try {
106
- const packageLocation = require.resolve(name);
107
- map[name] = path.resolve(packageLocation, `../../esm/index.dev.mjs`);
108
- } catch {/**/}
109
- return map;
110
- }, {});
111
- }
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/jest.config.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- preset: "ts-jest",
3
- testEnvironment: "jsdom",
4
- moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
5
- transform: {
6
- "^.+\\.tsx?$": ["ts-jest"],
7
- },
8
- testMatch: ["**/__tests__/**/*.test.ts?(x)"]
9
- };
package/rollup.config.mjs DELETED
@@ -1,50 +0,0 @@
1
- import typescript from '@rollup/plugin-typescript';
2
- import resolve from '@rollup/plugin-node-resolve';
3
- import commonjs from '@rollup/plugin-commonjs';
4
- import { glob } from 'glob';
5
-
6
- const external = [
7
- '@aurelia/runtime-html',
8
- '@aurelia/vite-plugin',
9
- '@storybook/builder-vite',
10
- 'aurelia',
11
- 'react',
12
- 'react-dom',
13
- 'storybook/internal/core-events',
14
- 'storybook/internal/types',
15
- 'storybook/theming'
16
- ];
17
-
18
- // Get all TypeScript files from src directory
19
- const srcFiles = glob.sync('src/**/*.ts').reduce((acc, file) => {
20
- const key = file.replace(/^src\//, '').replace(/\.ts$/, '');
21
- acc[key] = file;
22
- return acc;
23
- }, {});
24
-
25
- const createConfig = (input, output) => ({
26
- input,
27
- output: {
28
- file: output,
29
- format: 'esm',
30
- sourcemap: true,
31
- exports: 'named'
32
- },
33
- plugins: [
34
- typescript({
35
- tsconfig: './tsconfig.json',
36
- declaration: false,
37
- outDir: 'dist'
38
- }),
39
- resolve(),
40
- commonjs()
41
- ],
42
- external
43
- });
44
-
45
- // Create configs for all source files - ESM only for Storybook v10
46
- const configs = Object.entries(srcFiles).map(([name, input]) =>
47
- createConfig(input, `dist/${name}.js`)
48
- );
49
-
50
- export default configs;
package/src/index.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { StorybookConfig } from 'storybook/internal/types';
2
- import { renderToCanvas } from './preview/render';
3
-
4
- export { renderToCanvas };
5
- export const render = renderToCanvas;
6
-
7
- // Define the framework
8
- export const framework = {
9
- name: '@aurelia/storybook',
10
- options: {}
11
- };
12
-
13
- // Framework configuration for Storybook
14
- export const frameworkOptions = {
15
- builder: {
16
- name: '@storybook/builder-vite',
17
- options: {}
18
- }
19
- };
20
-
21
- // Export a complete framework configuration
22
- export const aureliaFramework = {
23
- name: '@aurelia/storybook',
24
- options: {},
25
- builder: '@storybook/builder-vite'
26
- };
27
-
28
- // Provide external dependencies configuration
29
- export const externals = {
30
- 'react': 'React',
31
- 'react-dom': 'ReactDOM'
32
- };
package/src/preset.ts DELETED
@@ -1,49 +0,0 @@
1
- // src/preset.ts
2
- // Minimal preset for Storybook-Aurelia2
3
-
4
- import { getRules } from './webpack';
5
-
6
- /**
7
- * Optionally adjust the Vite configuration.
8
- */
9
- export async function viteFinal(config: any): Promise<any> {
10
- // Configure Vite to properly handle dependencies
11
- config.define = config.define || {};
12
- config.define['process.env.NODE_ENV'] = JSON.stringify(process.env.NODE_ENV || 'development');
13
-
14
- // Configure optimization deps
15
- config.optimizeDeps = config.optimizeDeps || {};
16
- config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
17
-
18
- // Only exclude Aurelia-specific dependencies that cause issues
19
- const excludeList = [
20
- '@aurelia/runtime-html'
21
- ];
22
-
23
- excludeList.forEach(dep => {
24
- if (!config.optimizeDeps.exclude.includes(dep)) {
25
- config.optimizeDeps.exclude.push(dep);
26
- }
27
- });
28
-
29
- return config;
30
- }
31
-
32
- /**
33
- * A function to configure webpack.
34
- * @param config
35
- * @returns
36
- */
37
- export async function webpackFinal(config: any): Promise<any> {
38
- const rules = config.module?.rules;
39
- if (rules) {
40
- rules.push(...getRules());
41
- }
42
-
43
- return config;
44
- }
45
-
46
- // Export a default for compatibility.
47
- export default { viteFinal, webpackFinal };
48
-
49
- export const previewAnnotations = ['./preview.js'];