@aurelia/storybook 2.2.1 → 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 (140) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +18 -14
  3. package/dist/index.js +34 -14
  4. package/dist/index.js.map +1 -1
  5. package/dist/preset.js +30 -20
  6. package/dist/preset.js.map +1 -1
  7. package/dist/preview/render.d.ts +1 -1
  8. package/dist/preview/render.js +34 -14
  9. package/dist/preview/render.js.map +1 -1
  10. package/dist/preview.js +34 -14
  11. package/dist/preview.js.map +1 -1
  12. package/package.json +30 -15
  13. package/preset.js +2 -1
  14. package/.github/workflows/ci.yml +0 -61
  15. package/.github/workflows/publish.yml +0 -82
  16. package/.github/workflows/storybook-preview.yml +0 -62
  17. package/__tests__/create-aurelia-app.test.ts +0 -94
  18. package/__tests__/preset.test.ts +0 -78
  19. package/__tests__/preview.test.ts +0 -17
  20. package/__tests__/render.test.ts +0 -176
  21. package/__tests__/webpack.test.ts +0 -21
  22. package/apps/hello-world/.storybook/main.ts +0 -49
  23. package/apps/hello-world/.storybook/preview.ts +0 -1
  24. package/apps/hello-world/.stylelintrc.json +0 -5
  25. package/apps/hello-world/README.md +0 -28
  26. package/apps/hello-world/eslint.config.mjs +0 -25
  27. package/apps/hello-world/favicon.ico +0 -0
  28. package/apps/hello-world/index.html +0 -17
  29. package/apps/hello-world/package-lock.json +0 -9424
  30. package/apps/hello-world/package.json +0 -55
  31. package/apps/hello-world/src/components/feedback-form.html +0 -111
  32. package/apps/hello-world/src/components/feedback-form.ts +0 -45
  33. package/apps/hello-world/src/components/notification-center.html +0 -119
  34. package/apps/hello-world/src/components/notification-center.ts +0 -27
  35. package/apps/hello-world/src/components/stat-card.html +0 -107
  36. package/apps/hello-world/src/components/stat-card.ts +0 -41
  37. package/apps/hello-world/src/components/weather-widget.html +0 -89
  38. package/apps/hello-world/src/components/weather-widget.ts +0 -31
  39. package/apps/hello-world/src/hello-world.html +0 -48
  40. package/apps/hello-world/src/hello-world.ts +0 -17
  41. package/apps/hello-world/src/main.ts +0 -6
  42. package/apps/hello-world/src/my-app.html +0 -1
  43. package/apps/hello-world/src/my-app.ts +0 -3
  44. package/apps/hello-world/src/resource.d.ts +0 -15
  45. package/apps/hello-world/src/services/weather-service.ts +0 -15
  46. package/apps/hello-world/src/stories/feedback-form.stories.ts +0 -58
  47. package/apps/hello-world/src/stories/hello-world.stories.ts +0 -64
  48. package/apps/hello-world/src/stories/notification-center.stories.ts +0 -88
  49. package/apps/hello-world/src/stories/stat-card.stories.ts +0 -75
  50. package/apps/hello-world/src/stories/weather-widget.stories.ts +0 -62
  51. package/apps/hello-world/test/my-app.spec.ts +0 -15
  52. package/apps/hello-world/test/setup.ts +0 -29
  53. package/apps/hello-world/tsconfig.json +0 -19
  54. package/apps/hello-world/tsconfig.vitest.json +0 -11
  55. package/apps/hello-world/vite.config.ts +0 -17
  56. package/apps/hello-world/vitest.config.ts +0 -15
  57. package/apps/hello-world-rsbuild/.storybook/main.ts +0 -16
  58. package/apps/hello-world-rsbuild/.storybook/preview.ts +0 -1
  59. package/apps/hello-world-rsbuild/.stylelintrc.json +0 -5
  60. package/apps/hello-world-rsbuild/README.md +0 -28
  61. package/apps/hello-world-rsbuild/eslint.config.mjs +0 -25
  62. package/apps/hello-world-rsbuild/favicon.ico +0 -0
  63. package/apps/hello-world-rsbuild/index.html +0 -17
  64. package/apps/hello-world-rsbuild/package-lock.json +0 -11131
  65. package/apps/hello-world-rsbuild/package.json +0 -56
  66. package/apps/hello-world-rsbuild/src/components/feedback-form.html +0 -111
  67. package/apps/hello-world-rsbuild/src/components/feedback-form.ts +0 -45
  68. package/apps/hello-world-rsbuild/src/components/notification-center.html +0 -119
  69. package/apps/hello-world-rsbuild/src/components/notification-center.ts +0 -27
  70. package/apps/hello-world-rsbuild/src/components/stat-card.html +0 -107
  71. package/apps/hello-world-rsbuild/src/components/stat-card.ts +0 -41
  72. package/apps/hello-world-rsbuild/src/components/weather-widget.html +0 -89
  73. package/apps/hello-world-rsbuild/src/components/weather-widget.ts +0 -31
  74. package/apps/hello-world-rsbuild/src/hello-world.html +0 -48
  75. package/apps/hello-world-rsbuild/src/hello-world.ts +0 -17
  76. package/apps/hello-world-rsbuild/src/main.ts +0 -6
  77. package/apps/hello-world-rsbuild/src/my-app.html +0 -1
  78. package/apps/hello-world-rsbuild/src/my-app.ts +0 -3
  79. package/apps/hello-world-rsbuild/src/resource.d.ts +0 -15
  80. package/apps/hello-world-rsbuild/src/services/weather-service.ts +0 -15
  81. package/apps/hello-world-rsbuild/src/stories/feedback-form.stories.ts +0 -58
  82. package/apps/hello-world-rsbuild/src/stories/hello-world.stories.ts +0 -64
  83. package/apps/hello-world-rsbuild/src/stories/notification-center.stories.ts +0 -88
  84. package/apps/hello-world-rsbuild/src/stories/stat-card.stories.ts +0 -75
  85. package/apps/hello-world-rsbuild/src/stories/weather-widget.stories.ts +0 -62
  86. package/apps/hello-world-rsbuild/test/my-app.spec.ts +0 -15
  87. package/apps/hello-world-rsbuild/test/setup.ts +0 -29
  88. package/apps/hello-world-rsbuild/tsconfig.json +0 -19
  89. package/apps/hello-world-rsbuild/tsconfig.vitest.json +0 -11
  90. package/apps/hello-world-rsbuild/vite.config.ts +0 -17
  91. package/apps/hello-world-rsbuild/vitest.config.ts +0 -15
  92. package/apps/hello-world-webpack/.env.development +0 -0
  93. package/apps/hello-world-webpack/.storybook/main.ts +0 -14
  94. package/apps/hello-world-webpack/.storybook/preview.ts +0 -3
  95. package/apps/hello-world-webpack/.stylelintrc.json +0 -5
  96. package/apps/hello-world-webpack/README.md +0 -29
  97. package/apps/hello-world-webpack/eslint.config.mjs +0 -25
  98. package/apps/hello-world-webpack/favicon.ico +0 -0
  99. package/apps/hello-world-webpack/index.html +0 -15
  100. package/apps/hello-world-webpack/package-lock.json +0 -9828
  101. package/apps/hello-world-webpack/package.json +0 -52
  102. package/apps/hello-world-webpack/src/components/feedback-form.html +0 -111
  103. package/apps/hello-world-webpack/src/components/feedback-form.ts +0 -45
  104. package/apps/hello-world-webpack/src/components/notification-center.html +0 -119
  105. package/apps/hello-world-webpack/src/components/notification-center.ts +0 -27
  106. package/apps/hello-world-webpack/src/components/stat-card.html +0 -107
  107. package/apps/hello-world-webpack/src/components/stat-card.ts +0 -41
  108. package/apps/hello-world-webpack/src/components/weather-widget.html +0 -89
  109. package/apps/hello-world-webpack/src/components/weather-widget.ts +0 -31
  110. package/apps/hello-world-webpack/src/hello-world.html +0 -48
  111. package/apps/hello-world-webpack/src/hello-world.ts +0 -17
  112. package/apps/hello-world-webpack/src/main.ts +0 -6
  113. package/apps/hello-world-webpack/src/my-app.css +0 -3
  114. package/apps/hello-world-webpack/src/my-app.html +0 -1
  115. package/apps/hello-world-webpack/src/my-app.stories.ts +0 -17
  116. package/apps/hello-world-webpack/src/my-app.ts +0 -3
  117. package/apps/hello-world-webpack/src/resource.d.ts +0 -13
  118. package/apps/hello-world-webpack/src/services/weather-service.ts +0 -15
  119. package/apps/hello-world-webpack/src/stories/feedback-form.stories.ts +0 -58
  120. package/apps/hello-world-webpack/src/stories/hello-world.stories.ts +0 -64
  121. package/apps/hello-world-webpack/src/stories/notification-center.stories.ts +0 -88
  122. package/apps/hello-world-webpack/src/stories/stat-card.stories.ts +0 -75
  123. package/apps/hello-world-webpack/src/stories/weather-widget.stories.ts +0 -62
  124. package/apps/hello-world-webpack/tsconfig.json +0 -18
  125. package/apps/hello-world-webpack/webpack.config.js +0 -111
  126. package/jest.config.cjs +0 -9
  127. package/rollup.config.mjs +0 -52
  128. package/scripts/sync-versions.cjs +0 -55
  129. package/src/index.ts +0 -42
  130. package/src/preset.ts +0 -79
  131. package/src/preview/helpers.ts +0 -7
  132. package/src/preview/render.ts +0 -243
  133. package/src/preview/storybook-types-runtime.ts +0 -2
  134. package/src/preview/storybook-types.ts +0 -34
  135. package/src/preview/types-runtime.ts +0 -2
  136. package/src/preview/types.ts +0 -62
  137. package/src/preview.ts +0 -11
  138. package/src/webpack.ts +0 -40
  139. package/tsconfig.build.json +0 -5
  140. package/tsconfig.json +0 -15
package/src/index.ts DELETED
@@ -1,42 +0,0 @@
1
- import { renderToCanvas } from './preview/render';
2
- import { defineAureliaStory } from './preview/helpers';
3
-
4
- export { renderToCanvas };
5
- export const render = renderToCanvas;
6
- export { defineAureliaStory };
7
- export type {
8
- AureliaRenderer,
9
- AureliaStoryResult,
10
- AureliaArgsStoryFn,
11
- AureliaRenderContext,
12
- AureliaStoryContext,
13
- AureliaParameters,
14
- AureliaStoryParameters
15
- } from './preview/types';
16
-
17
- // Define the framework
18
- export const framework = {
19
- name: '@aurelia/storybook',
20
- options: {}
21
- };
22
-
23
- // Framework configuration for Storybook
24
- export const frameworkOptions = {
25
- builder: {
26
- name: '@storybook/builder-vite',
27
- options: {}
28
- }
29
- };
30
-
31
- // Export a complete framework configuration
32
- export const aureliaFramework = {
33
- name: '@aurelia/storybook',
34
- options: {},
35
- builder: '@storybook/builder-vite'
36
- };
37
-
38
- // Provide external dependencies configuration
39
- export const externals = {
40
- 'react': 'React',
41
- 'react-dom': 'ReactDOM'
42
- };
package/src/preset.ts DELETED
@@ -1,79 +0,0 @@
1
- // src/preset.ts
2
- // Minimal preset for Storybook-Aurelia2
3
-
4
- import { getRules, getRsbuildRules } 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
- async function loadMergeRsbuildConfig() {
33
- try {
34
- const { mergeRsbuildConfig } = await import('@rsbuild/core');
35
- return mergeRsbuildConfig;
36
- } catch (error: any) {
37
- const message = error instanceof Error ? error.message : String(error);
38
- throw new Error(
39
- `@aurelia/storybook: rsbuild support requires @rsbuild/core to be installed. Original error: ${message}`
40
- );
41
- }
42
- }
43
-
44
- /**
45
- * Optionally adjust the Rsbuild configuration (Rspack-based).
46
- */
47
- export async function rsbuildFinal(config: any): Promise<any> {
48
- const mergeRsbuildConfig = await loadMergeRsbuildConfig();
49
-
50
- return mergeRsbuildConfig(config, {
51
- tools: {
52
- rspack: (rspackConfig: any) => {
53
- const moduleConfig = rspackConfig.module ?? (rspackConfig.module = {});
54
- const rules = moduleConfig.rules ?? (moduleConfig.rules = []);
55
- rules.push(...getRsbuildRules());
56
- return rspackConfig;
57
- }
58
- }
59
- });
60
- }
61
-
62
- /**
63
- * A function to configure webpack.
64
- * @param config
65
- * @returns
66
- */
67
- export async function webpackFinal(config: any): Promise<any> {
68
- const rules = config.module?.rules;
69
- if (rules) {
70
- rules.push(...getRules());
71
- }
72
-
73
- return config;
74
- }
75
-
76
- // Export a default for compatibility.
77
- export default { viteFinal, rsbuildFinal, webpackFinal };
78
-
79
- export const previewAnnotations = ['./preview.js'];
@@ -1,7 +0,0 @@
1
- import type { AureliaStoryResult } from './types';
2
-
3
- export function defineAureliaStory<TArgs = Record<string, unknown>>(
4
- story: AureliaStoryResult<TArgs>
5
- ): AureliaStoryResult<TArgs> {
6
- return story;
7
- }
@@ -1,243 +0,0 @@
1
- import type { RenderContext, ArgsStoryFn } from './storybook-types';
2
- import type {
3
- AureliaRenderer,
4
- AureliaStoryResult,
5
- AureliaParameters,
6
- AureliaStoryContext,
7
- } from './types';
8
- import Aurelia, { Constructable, CustomElement } from 'aurelia';
9
-
10
- // Track Aurelia apps for cleanup
11
- const appMap = new Map<HTMLElement, any>();
12
-
13
- function mergeStoryProps(
14
- parameters: { args?: Record<string, any> } | undefined,
15
- storyArgs: Record<string, any> | undefined,
16
- storyProps: Record<string, any> | undefined
17
- ) {
18
- return { ...parameters?.args, ...storyArgs, ...storyProps };
19
- }
20
-
21
- function getAureliaParameters(
22
- storyContext?: AureliaStoryContext
23
- ): AureliaParameters | undefined {
24
- const parameters = storyContext?.parameters?.aurelia;
25
- if (!parameters || typeof parameters !== 'object') {
26
- return undefined;
27
- }
28
- return parameters as AureliaParameters;
29
- }
30
-
31
- function normalizeRegistrations(
32
- parameters: AureliaParameters | undefined
33
- ): unknown[] {
34
- if (!parameters) {
35
- return [];
36
- }
37
-
38
- const register = Array.isArray(parameters.register) ? parameters.register : [];
39
- const components = Array.isArray(parameters.components) ? parameters.components : [];
40
- const items = Array.isArray(parameters.items) ? parameters.items : [];
41
-
42
- return [...register, ...components, ...items].filter(Boolean);
43
- }
44
-
45
- async function teardown(element: HTMLElement) {
46
- if (appMap.has(element)) {
47
- const app = appMap.get(element);
48
- if (app) {
49
- await app.stop();
50
- appMap.delete(element);
51
- }
52
- }
53
- }
54
-
55
- export const render: ArgsStoryFn<AureliaRenderer> = (args, context) => {
56
- const { id, component: Component } = context;
57
-
58
- if (!Component) {
59
- const label = context.title && context.name ? `${context.title} / ${context.name}` : id;
60
- throw new Error(
61
- `Unable to render story ${label} as the component annotation is missing from the default export`
62
- );
63
- }
64
- return { Component, props: args };
65
- };
66
-
67
- export async function renderToCanvas(
68
- {
69
- storyFn,
70
- title,
71
- name,
72
- showMain,
73
- showError,
74
- storyContext,
75
- forceRemount,
76
- }: RenderContext<AureliaRenderer>,
77
- canvasElement: HTMLElement,
78
- bootstrapAppFn?: typeof createAureliaApp
79
- ) {
80
- // Store reference to the original storybook root element
81
- const rootElement = canvasElement;
82
-
83
- // Ensure we have (or create) a single container inside the root where the Aurelia app actually renders
84
- let hostElement: HTMLElement;
85
- if (rootElement.id === 'storybook-root') {
86
- hostElement = rootElement.querySelector('.aurelia-story-container') as HTMLElement;
87
- if (!hostElement) {
88
- hostElement = document.createElement('div');
89
- hostElement.className = 'aurelia-story-container';
90
- hostElement.style.height = '100%';
91
- rootElement.appendChild(hostElement);
92
- }
93
- } else {
94
- hostElement = rootElement;
95
- }
96
-
97
- // All app instances are now tracked by the *root* element, ensuring we only ever have one per story iframe
98
- const appBootstrapFn = bootstrapAppFn ?? createAureliaApp;
99
- const { parameters, component, args } = storyContext;
100
-
101
- let app = appMap.get(rootElement);
102
- const story = storyFn() as AureliaStoryResult;
103
-
104
- if (!story) {
105
- showError({
106
- title: `Expecting an Aurelia component from the story: "${name}" of "${title}".`,
107
- description: `
108
- Did you forget to return the Aurelia component from the story?
109
- Use "() => ({ template: '<custom-component></custom-component>' })" when defining the story.
110
- `,
111
- });
112
- return () => {};
113
- }
114
-
115
- showMain();
116
-
117
- if (!app || forceRemount) {
118
- if (forceRemount && app) {
119
- await teardown(rootElement);
120
- app = undefined;
121
- }
122
- // Clear container before mounting new app
123
- hostElement.innerHTML = '';
124
-
125
- const mergedProps = mergeStoryProps(parameters, args, story.props);
126
-
127
- const aureliaApp = appBootstrapFn(
128
- story,
129
- mergedProps,
130
- hostElement,
131
- component as Constructable,
132
- storyContext
133
- );
134
- await aureliaApp.start();
135
- appMap.set(rootElement, aureliaApp);
136
- app = aureliaApp;
137
- } else {
138
- // update existing app props
139
- const mergedProps = mergeStoryProps(parameters, args, story.props);
140
- if (app?.root?.controller?.viewModel) {
141
- Object.assign(app.root.controller.viewModel, mergedProps);
142
- }
143
- }
144
-
145
- // Return cleanup fn
146
- return async () => {
147
- await teardown(rootElement);
148
- };
149
- }
150
-
151
- export function createAureliaApp(
152
- story: AureliaStoryResult,
153
- args: Record<string, any>,
154
- domElement: HTMLElement,
155
- component?: Constructable,
156
- storyContext?: AureliaStoryContext
157
- ) {
158
- const aurelia = new Aurelia(story.container);
159
- const { container } = aurelia;
160
- const aureliaParameters = getAureliaParameters(storyContext);
161
-
162
- const registerIfNeeded = (resource: unknown) => {
163
- if (!resource) {
164
- return;
165
- }
166
-
167
- if (CustomElement.isType(resource)) {
168
- const definition = CustomElement.getDefinition(resource);
169
- if (container.has(definition.key, false)) {
170
- return;
171
- }
172
- }
173
-
174
- aurelia.register(resource);
175
- };
176
-
177
- const registerAll = (resources?: unknown[]) => {
178
- if (!resources?.length) {
179
- return;
180
- }
181
-
182
- for (const resource of resources) {
183
- registerIfNeeded(resource);
184
- }
185
- };
186
-
187
- if (aureliaParameters?.configureContainer && storyContext) {
188
- aureliaParameters.configureContainer(container, storyContext);
189
- }
190
-
191
- registerAll(normalizeRegistrations(aureliaParameters));
192
- registerAll(story.items);
193
-
194
- const storyComponents = (story.components ?? []).filter(Boolean);
195
- const dedupedComponents = component
196
- ? storyComponents.filter((entry) => entry !== component)
197
- : storyComponents;
198
-
199
- for (const entry of dedupedComponents) {
200
- registerIfNeeded(entry);
201
- }
202
-
203
- let { template } = story;
204
-
205
- if (component) {
206
- template = template ?? createComponentTemplate(component, story.innerHtml);
207
- registerIfNeeded(component);
208
- }
209
-
210
- const App = CustomElement.define(
211
- {
212
- name: 'sb-app',
213
- template,
214
- containerless: true,
215
- },
216
- class {}
217
- );
218
-
219
- const app = Object.assign(new App(), args);
220
-
221
- if (aureliaParameters?.configure && storyContext) {
222
- aureliaParameters.configure(aurelia, storyContext);
223
- }
224
-
225
- return aurelia.app({
226
- host: domElement,
227
- component: app,
228
- });
229
- }
230
-
231
- export function createComponentTemplate(
232
- component: Constructable,
233
- innerHtml?: string
234
- ): string {
235
- const def = CustomElement.getDefinition(component);
236
-
237
- const bindings = Object.values(def.bindables)
238
- .map((bindable) => `${bindable.attribute}.bind="${bindable.name}"`)
239
- .join(' ');
240
- const bindingAttributes = bindings ? ` ${bindings}` : '';
241
-
242
- return `<${def.name}${bindingAttributes}>${innerHtml ?? ''}</${def.name}>`;
243
- }
@@ -1,2 +0,0 @@
1
- // Runtime stub so the export map has a JS target for type-only entries.
2
- export const __AURELIA_STORYBOOK_STORYBOOK_TYPES__ = true;
@@ -1,34 +0,0 @@
1
- export interface Renderer {
2
- component?: unknown;
3
- storyResult?: unknown;
4
- canvasElement?: HTMLElement;
5
- }
6
-
7
- export interface StoryContext<
8
- TRenderer = Renderer,
9
- TArgs = Record<string, unknown>
10
- > {
11
- id?: string;
12
- component?: unknown;
13
- args: TArgs;
14
- parameters?: { args?: Record<string, unknown> } & Record<string, unknown>;
15
- [key: string]: unknown;
16
- }
17
-
18
- export type ArgsStoryFn<
19
- TRenderer = Renderer,
20
- TArgs = Record<string, unknown>
21
- > = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => unknown;
22
-
23
- export interface RenderContext<
24
- TRenderer = Renderer,
25
- TArgs = Record<string, unknown>
26
- > {
27
- storyFn: () => unknown;
28
- title: string;
29
- name: string;
30
- showMain: () => void;
31
- showError: (error: { title: string; description?: string }) => void;
32
- storyContext: StoryContext<TRenderer, TArgs>;
33
- forceRemount?: boolean;
34
- }
@@ -1,2 +0,0 @@
1
- // Runtime stub so the export map has a JS target for type-only entries.
2
- export const __AURELIA_STORYBOOK_TYPES__ = true;
@@ -1,62 +0,0 @@
1
- import type { IContainer } from 'aurelia';
2
- import type Aurelia from 'aurelia';
3
- import type { Renderer, StoryContext, RenderContext, ArgsStoryFn } from './storybook-types';
4
-
5
- export interface AureliaRenderer extends Renderer {
6
- /** The DOM element in which the story is rendered */
7
- canvasElement: HTMLElement;
8
- }
9
-
10
- export interface AureliaStoryResult<TArgs = Record<string, unknown>> {
11
- template?: string;
12
- components?: unknown[];
13
- Component?: unknown;
14
- container?: IContainer;
15
- items?: unknown[];
16
- innerHtml?: string;
17
- props?: Partial<TArgs>;
18
- }
19
-
20
- export type AureliaStoryContext<TArgs = Record<string, unknown>> = StoryContext<
21
- AureliaRenderer,
22
- TArgs
23
- >;
24
- export type AureliaRenderContext<TArgs = Record<string, unknown>> = RenderContext<
25
- AureliaRenderer,
26
- TArgs
27
- >;
28
- export type AureliaArgsStoryFn<TArgs = Record<string, unknown>> = ArgsStoryFn<
29
- AureliaRenderer,
30
- TArgs
31
- >;
32
-
33
- export interface AureliaParameters<TArgs = Record<string, unknown>> {
34
- /**
35
- * Global resources/plugins to register with Aurelia (merged across preview + story parameters).
36
- */
37
- register?: unknown[];
38
- /**
39
- * Alias for register: match the story result `components` contract.
40
- */
41
- components?: unknown[];
42
- /**
43
- * Alias for register: match the story result `items` contract.
44
- */
45
- items?: unknown[];
46
- /**
47
- * Configure the container before the Aurelia app starts.
48
- */
49
- configureContainer?: (
50
- container: IContainer,
51
- context: AureliaStoryContext<TArgs>
52
- ) => void;
53
- /**
54
- * Configure the Aurelia instance before the app starts.
55
- */
56
- configure?: (aurelia: Aurelia, context: AureliaStoryContext<TArgs>) => void;
57
- }
58
-
59
- export interface AureliaStoryParameters<TArgs = Record<string, unknown>> {
60
- aurelia?: AureliaParameters<TArgs>;
61
- }
62
-
package/src/preview.ts DELETED
@@ -1,11 +0,0 @@
1
- export { renderToCanvas, render } from './preview/render';
2
- export { defineAureliaStory } from './preview/helpers';
3
- export type {
4
- AureliaArgsStoryFn,
5
- AureliaParameters,
6
- AureliaRenderContext,
7
- AureliaRenderer,
8
- AureliaStoryParameters,
9
- AureliaStoryContext,
10
- AureliaStoryResult
11
- } from './preview/types';
package/src/webpack.ts DELETED
@@ -1,40 +0,0 @@
1
- // src/webpack.ts
2
- import type { RuleSetRule } from 'webpack';
3
-
4
- /**
5
- * A set of rules to be added to the webpack configuration.
6
- * @returns
7
- */
8
- export function getRules(): RuleSetRule[] {
9
- return [
10
- {
11
- test: /\.ts$/i,
12
- use: ['ts-loader', '@aurelia/webpack-loader'],
13
- exclude: /node_modules/,
14
- },
15
- {
16
- test: /\.html$/i,
17
- use: '@aurelia/webpack-loader',
18
- exclude: /node_modules/,
19
- },
20
- ];
21
- }
22
-
23
- /**
24
- * Rsbuild/Rspack rules (avoid ts-loader; Rsbuild handles TS transpilation).
25
- */
26
- export function getRsbuildRules(): RuleSetRule[] {
27
- return [
28
- {
29
- test: /\.ts$/i,
30
- enforce: 'pre',
31
- use: ['@aurelia/webpack-loader'],
32
- exclude: /node_modules/,
33
- },
34
- {
35
- test: /\.html$/i,
36
- use: '@aurelia/webpack-loader',
37
- exclude: /node_modules/,
38
- },
39
- ];
40
- }
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["src"],
4
- "exclude": ["__tests__"]
5
- }
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
5
- "declaration": true,
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "moduleResolution": "bundler",
10
- "esModuleInterop": true,
11
- "skipLibCheck": true
12
- },
13
- "include": ["src", "__tests__"]
14
- }
15
-