@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.
- package/CHANGELOG.md +7 -1
- package/README.md +18 -14
- package/dist/index.js +34 -14
- package/dist/index.js.map +1 -1
- package/dist/preset.js +30 -20
- package/dist/preset.js.map +1 -1
- package/dist/preview/render.d.ts +1 -1
- package/dist/preview/render.js +34 -14
- package/dist/preview/render.js.map +1 -1
- package/dist/preview.js +34 -14
- package/dist/preview.js.map +1 -1
- package/package.json +30 -15
- package/preset.js +2 -1
- package/.github/workflows/ci.yml +0 -61
- package/.github/workflows/publish.yml +0 -82
- package/.github/workflows/storybook-preview.yml +0 -62
- package/__tests__/create-aurelia-app.test.ts +0 -94
- package/__tests__/preset.test.ts +0 -78
- package/__tests__/preview.test.ts +0 -17
- package/__tests__/render.test.ts +0 -176
- package/__tests__/webpack.test.ts +0 -21
- package/apps/hello-world/.storybook/main.ts +0 -49
- package/apps/hello-world/.storybook/preview.ts +0 -1
- package/apps/hello-world/.stylelintrc.json +0 -5
- package/apps/hello-world/README.md +0 -28
- package/apps/hello-world/eslint.config.mjs +0 -25
- package/apps/hello-world/favicon.ico +0 -0
- package/apps/hello-world/index.html +0 -17
- package/apps/hello-world/package-lock.json +0 -9424
- package/apps/hello-world/package.json +0 -55
- package/apps/hello-world/src/components/feedback-form.html +0 -111
- package/apps/hello-world/src/components/feedback-form.ts +0 -45
- package/apps/hello-world/src/components/notification-center.html +0 -119
- package/apps/hello-world/src/components/notification-center.ts +0 -27
- package/apps/hello-world/src/components/stat-card.html +0 -107
- package/apps/hello-world/src/components/stat-card.ts +0 -41
- package/apps/hello-world/src/components/weather-widget.html +0 -89
- package/apps/hello-world/src/components/weather-widget.ts +0 -31
- package/apps/hello-world/src/hello-world.html +0 -48
- package/apps/hello-world/src/hello-world.ts +0 -17
- package/apps/hello-world/src/main.ts +0 -6
- package/apps/hello-world/src/my-app.html +0 -1
- package/apps/hello-world/src/my-app.ts +0 -3
- package/apps/hello-world/src/resource.d.ts +0 -15
- package/apps/hello-world/src/services/weather-service.ts +0 -15
- package/apps/hello-world/src/stories/feedback-form.stories.ts +0 -58
- package/apps/hello-world/src/stories/hello-world.stories.ts +0 -64
- package/apps/hello-world/src/stories/notification-center.stories.ts +0 -88
- package/apps/hello-world/src/stories/stat-card.stories.ts +0 -75
- package/apps/hello-world/src/stories/weather-widget.stories.ts +0 -62
- package/apps/hello-world/test/my-app.spec.ts +0 -15
- package/apps/hello-world/test/setup.ts +0 -29
- package/apps/hello-world/tsconfig.json +0 -19
- package/apps/hello-world/tsconfig.vitest.json +0 -11
- package/apps/hello-world/vite.config.ts +0 -17
- package/apps/hello-world/vitest.config.ts +0 -15
- package/apps/hello-world-rsbuild/.storybook/main.ts +0 -16
- package/apps/hello-world-rsbuild/.storybook/preview.ts +0 -1
- package/apps/hello-world-rsbuild/.stylelintrc.json +0 -5
- package/apps/hello-world-rsbuild/README.md +0 -28
- package/apps/hello-world-rsbuild/eslint.config.mjs +0 -25
- package/apps/hello-world-rsbuild/favicon.ico +0 -0
- package/apps/hello-world-rsbuild/index.html +0 -17
- package/apps/hello-world-rsbuild/package-lock.json +0 -11131
- package/apps/hello-world-rsbuild/package.json +0 -56
- package/apps/hello-world-rsbuild/src/components/feedback-form.html +0 -111
- package/apps/hello-world-rsbuild/src/components/feedback-form.ts +0 -45
- package/apps/hello-world-rsbuild/src/components/notification-center.html +0 -119
- package/apps/hello-world-rsbuild/src/components/notification-center.ts +0 -27
- package/apps/hello-world-rsbuild/src/components/stat-card.html +0 -107
- package/apps/hello-world-rsbuild/src/components/stat-card.ts +0 -41
- package/apps/hello-world-rsbuild/src/components/weather-widget.html +0 -89
- package/apps/hello-world-rsbuild/src/components/weather-widget.ts +0 -31
- package/apps/hello-world-rsbuild/src/hello-world.html +0 -48
- package/apps/hello-world-rsbuild/src/hello-world.ts +0 -17
- package/apps/hello-world-rsbuild/src/main.ts +0 -6
- package/apps/hello-world-rsbuild/src/my-app.html +0 -1
- package/apps/hello-world-rsbuild/src/my-app.ts +0 -3
- package/apps/hello-world-rsbuild/src/resource.d.ts +0 -15
- package/apps/hello-world-rsbuild/src/services/weather-service.ts +0 -15
- package/apps/hello-world-rsbuild/src/stories/feedback-form.stories.ts +0 -58
- package/apps/hello-world-rsbuild/src/stories/hello-world.stories.ts +0 -64
- package/apps/hello-world-rsbuild/src/stories/notification-center.stories.ts +0 -88
- package/apps/hello-world-rsbuild/src/stories/stat-card.stories.ts +0 -75
- package/apps/hello-world-rsbuild/src/stories/weather-widget.stories.ts +0 -62
- package/apps/hello-world-rsbuild/test/my-app.spec.ts +0 -15
- package/apps/hello-world-rsbuild/test/setup.ts +0 -29
- package/apps/hello-world-rsbuild/tsconfig.json +0 -19
- package/apps/hello-world-rsbuild/tsconfig.vitest.json +0 -11
- package/apps/hello-world-rsbuild/vite.config.ts +0 -17
- package/apps/hello-world-rsbuild/vitest.config.ts +0 -15
- package/apps/hello-world-webpack/.env.development +0 -0
- package/apps/hello-world-webpack/.storybook/main.ts +0 -14
- package/apps/hello-world-webpack/.storybook/preview.ts +0 -3
- package/apps/hello-world-webpack/.stylelintrc.json +0 -5
- package/apps/hello-world-webpack/README.md +0 -29
- package/apps/hello-world-webpack/eslint.config.mjs +0 -25
- package/apps/hello-world-webpack/favicon.ico +0 -0
- package/apps/hello-world-webpack/index.html +0 -15
- package/apps/hello-world-webpack/package-lock.json +0 -9828
- package/apps/hello-world-webpack/package.json +0 -52
- package/apps/hello-world-webpack/src/components/feedback-form.html +0 -111
- package/apps/hello-world-webpack/src/components/feedback-form.ts +0 -45
- package/apps/hello-world-webpack/src/components/notification-center.html +0 -119
- package/apps/hello-world-webpack/src/components/notification-center.ts +0 -27
- package/apps/hello-world-webpack/src/components/stat-card.html +0 -107
- package/apps/hello-world-webpack/src/components/stat-card.ts +0 -41
- package/apps/hello-world-webpack/src/components/weather-widget.html +0 -89
- package/apps/hello-world-webpack/src/components/weather-widget.ts +0 -31
- package/apps/hello-world-webpack/src/hello-world.html +0 -48
- package/apps/hello-world-webpack/src/hello-world.ts +0 -17
- package/apps/hello-world-webpack/src/main.ts +0 -6
- package/apps/hello-world-webpack/src/my-app.css +0 -3
- package/apps/hello-world-webpack/src/my-app.html +0 -1
- package/apps/hello-world-webpack/src/my-app.stories.ts +0 -17
- package/apps/hello-world-webpack/src/my-app.ts +0 -3
- package/apps/hello-world-webpack/src/resource.d.ts +0 -13
- package/apps/hello-world-webpack/src/services/weather-service.ts +0 -15
- package/apps/hello-world-webpack/src/stories/feedback-form.stories.ts +0 -58
- package/apps/hello-world-webpack/src/stories/hello-world.stories.ts +0 -64
- package/apps/hello-world-webpack/src/stories/notification-center.stories.ts +0 -88
- package/apps/hello-world-webpack/src/stories/stat-card.stories.ts +0 -75
- package/apps/hello-world-webpack/src/stories/weather-widget.stories.ts +0 -62
- package/apps/hello-world-webpack/tsconfig.json +0 -18
- package/apps/hello-world-webpack/webpack.config.js +0 -111
- package/jest.config.cjs +0 -9
- package/rollup.config.mjs +0 -52
- package/scripts/sync-versions.cjs +0 -55
- package/src/index.ts +0 -42
- package/src/preset.ts +0 -79
- package/src/preview/helpers.ts +0 -7
- package/src/preview/render.ts +0 -243
- package/src/preview/storybook-types-runtime.ts +0 -2
- package/src/preview/storybook-types.ts +0 -34
- package/src/preview/types-runtime.ts +0 -2
- package/src/preview/types.ts +0 -62
- package/src/preview.ts +0 -11
- package/src/webpack.ts +0 -40
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -15
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="message">${message}</div>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { MyApp } from './my-app';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Example/MyApp',
|
|
6
|
-
component: MyApp,
|
|
7
|
-
render: () =>
|
|
8
|
-
defineAureliaStory({
|
|
9
|
-
template: `<my-app></my-app>`,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default meta;
|
|
14
|
-
|
|
15
|
-
export const Default = {
|
|
16
|
-
args: {}
|
|
17
|
-
};
|
|
@@ -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,58 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { fn, userEvent, within } from 'storybook/test';
|
|
3
|
-
import { FeedbackForm } from '../components/feedback-form';
|
|
4
|
-
|
|
5
|
-
type FeedbackFormArgs = {
|
|
6
|
-
topics: string[];
|
|
7
|
-
submitting?: boolean;
|
|
8
|
-
onSubmit?: (payload: unknown) => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const meta = {
|
|
12
|
-
title: 'Dashboard/FeedbackForm',
|
|
13
|
-
component: FeedbackForm,
|
|
14
|
-
parameters: {
|
|
15
|
-
layout: 'centered',
|
|
16
|
-
},
|
|
17
|
-
render: (args: FeedbackFormArgs) =>
|
|
18
|
-
defineAureliaStory({
|
|
19
|
-
template: `<feedback-form topics.bind="topics"
|
|
20
|
-
submitting.bind="submitting"
|
|
21
|
-
on-submit.bind="onSubmit"></feedback-form>`,
|
|
22
|
-
props: args,
|
|
23
|
-
components: [FeedbackForm],
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default meta;
|
|
28
|
-
|
|
29
|
-
export const DefaultForm = {
|
|
30
|
-
args: {
|
|
31
|
-
topics: ['Bug report', 'Feature request', 'General question'],
|
|
32
|
-
onSubmit: fn(),
|
|
33
|
-
submitting: false,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const SubmittingState = {
|
|
38
|
-
args: {
|
|
39
|
-
topics: ['Design review', 'Accessibility', 'Performance'],
|
|
40
|
-
submitting: true,
|
|
41
|
-
onSubmit: fn(),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const FillAndSubmit = {
|
|
46
|
-
args: {
|
|
47
|
-
topics: ['Beta feedback', 'Success story'],
|
|
48
|
-
onSubmit: fn(),
|
|
49
|
-
},
|
|
50
|
-
play: async ({ canvasElement }) => {
|
|
51
|
-
const canvas = within(canvasElement);
|
|
52
|
-
await userEvent.type(canvas.getByLabelText('Name'), 'Jordan');
|
|
53
|
-
await userEvent.type(canvas.getByLabelText('Email'), 'jordan@example.com');
|
|
54
|
-
await userEvent.selectOptions(canvas.getByLabelText('Topic'), 'Success story');
|
|
55
|
-
await userEvent.type(canvas.getByLabelText('Message'), 'The new timeline view is great');
|
|
56
|
-
await userEvent.click(canvas.getByRole('button', { name: /send feedback/i }));
|
|
57
|
-
},
|
|
58
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { HelloWorld } from '../hello-world';
|
|
3
|
-
import { fn, userEvent, within } from 'storybook/test';
|
|
4
|
-
|
|
5
|
-
type HelloWorldArgs = {
|
|
6
|
-
message?: string;
|
|
7
|
-
onIncrement?: () => void;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
title: 'Example/HelloWorld',
|
|
12
|
-
component: HelloWorld,
|
|
13
|
-
render: (args: HelloWorldArgs) =>
|
|
14
|
-
defineAureliaStory({
|
|
15
|
-
template: `<hello-world message.bind="message" on-increment.bind="onIncrement"></hello-world>`,
|
|
16
|
-
props: args,
|
|
17
|
-
}),
|
|
18
|
-
argTypes: {
|
|
19
|
-
message: { control: 'text' },
|
|
20
|
-
onIncrement: { action: 'increment' }
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
|
|
26
|
-
export const DefaultHelloWorld = {
|
|
27
|
-
args: {
|
|
28
|
-
message: 'Hello from Aurelia Storybook',
|
|
29
|
-
onIncrement: fn()
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const InteractiveHelloWorld = {
|
|
34
|
-
args: {
|
|
35
|
-
message: 'Try clicking the button!',
|
|
36
|
-
onIncrement: fn()
|
|
37
|
-
},
|
|
38
|
-
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
39
|
-
const canvas = within(canvasElement);
|
|
40
|
-
const button = canvas.getByRole('button');
|
|
41
|
-
// Simulate three button clicks
|
|
42
|
-
await userEvent.click(button);
|
|
43
|
-
await userEvent.click(button);
|
|
44
|
-
await userEvent.click(button);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const NoArgs = {
|
|
49
|
-
render: () =>
|
|
50
|
-
defineAureliaStory({
|
|
51
|
-
template: `<hello-world></hello-world>`,
|
|
52
|
-
})
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const WithCustomTemplate = {
|
|
56
|
-
render: (args: HelloWorldArgs) =>
|
|
57
|
-
defineAureliaStory({
|
|
58
|
-
template: `<hello-world message.bind="message">Click me!</hello-world>`,
|
|
59
|
-
props: args,
|
|
60
|
-
}),
|
|
61
|
-
args: {
|
|
62
|
-
message: 'This is a custom message'
|
|
63
|
-
}
|
|
64
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { fn, userEvent, within } from 'storybook/test';
|
|
3
|
-
import { NotificationCenter, NotificationItem } from '../components/notification-center';
|
|
4
|
-
|
|
5
|
-
type NotificationCenterArgs = {
|
|
6
|
-
notifications: NotificationItem[];
|
|
7
|
-
maxVisible?: number;
|
|
8
|
-
showTimestamp?: boolean;
|
|
9
|
-
onDismiss?: (item: NotificationItem) => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const baseNotifications: NotificationItem[] = [
|
|
13
|
-
{
|
|
14
|
-
id: 1,
|
|
15
|
-
title: 'Build succeeded',
|
|
16
|
-
message: 'Main pipeline finished in 4m 12s.',
|
|
17
|
-
level: 'success',
|
|
18
|
-
timestamp: 'Today - 09:24',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 2,
|
|
22
|
-
title: 'New comment',
|
|
23
|
-
message: 'Samira replied to your review on PR #512.',
|
|
24
|
-
level: 'info',
|
|
25
|
-
timestamp: 'Today - 08:51',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: 3,
|
|
29
|
-
title: 'Usage warning',
|
|
30
|
-
message: 'API quota is at 85% of the monthly allocation.',
|
|
31
|
-
level: 'warning',
|
|
32
|
-
timestamp: 'Yesterday - 17:05',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 4,
|
|
36
|
-
title: 'Error spike',
|
|
37
|
-
message: 'Synthetic tests detected an uptick in 500s.',
|
|
38
|
-
level: 'error',
|
|
39
|
-
timestamp: 'Yesterday - 15:33',
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
const meta = {
|
|
44
|
-
title: 'Dashboard/NotificationCenter',
|
|
45
|
-
component: NotificationCenter,
|
|
46
|
-
render: (args: NotificationCenterArgs) =>
|
|
47
|
-
defineAureliaStory({
|
|
48
|
-
template: `<notification-center notifications.bind="notifications"
|
|
49
|
-
max-visible.bind="maxVisible"
|
|
50
|
-
on-dismiss.bind="onDismiss"
|
|
51
|
-
show-timestamp.bind="showTimestamp"></notification-center>`,
|
|
52
|
-
props: args,
|
|
53
|
-
components: [NotificationCenter],
|
|
54
|
-
}),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default meta;
|
|
58
|
-
|
|
59
|
-
export const DefaultNotifications = {
|
|
60
|
-
args: {
|
|
61
|
-
notifications: baseNotifications,
|
|
62
|
-
maxVisible: 3,
|
|
63
|
-
showTimestamp: true,
|
|
64
|
-
onDismiss: fn(),
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const CompactList = {
|
|
69
|
-
args: {
|
|
70
|
-
notifications: baseNotifications.slice(0, 2),
|
|
71
|
-
maxVisible: 2,
|
|
72
|
-
onDismiss: fn(),
|
|
73
|
-
showTimestamp: false,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const Interactions = {
|
|
78
|
-
args: {
|
|
79
|
-
notifications: baseNotifications,
|
|
80
|
-
maxVisible: 4,
|
|
81
|
-
onDismiss: fn(),
|
|
82
|
-
},
|
|
83
|
-
play: async ({ canvasElement }) => {
|
|
84
|
-
const canvas = within(canvasElement);
|
|
85
|
-
const dismissButtons = await canvas.findAllByRole('button', { name: /dismiss/i });
|
|
86
|
-
await userEvent.click(dismissButtons[0]);
|
|
87
|
-
},
|
|
88
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { fn, userEvent, within } from 'storybook/test';
|
|
3
|
-
import { StatCard } from '../components/stat-card';
|
|
4
|
-
|
|
5
|
-
type StatCardArgs = {
|
|
6
|
-
title: string;
|
|
7
|
-
value: number | string;
|
|
8
|
-
unit?: string;
|
|
9
|
-
change?: number;
|
|
10
|
-
changeCopy?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
onRefresh?: () => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'Dashboard/StatCard',
|
|
17
|
-
component: StatCard,
|
|
18
|
-
parameters: {
|
|
19
|
-
layout: 'centered',
|
|
20
|
-
},
|
|
21
|
-
render: (args: StatCardArgs) =>
|
|
22
|
-
defineAureliaStory({
|
|
23
|
-
components: [StatCard],
|
|
24
|
-
template: `<stat-card title.bind="title"
|
|
25
|
-
value.bind="value"
|
|
26
|
-
unit.bind="unit"
|
|
27
|
-
change.bind="change"
|
|
28
|
-
change-copy.bind="changeCopy"
|
|
29
|
-
description.bind="description"
|
|
30
|
-
on-refresh.bind="onRefresh"></stat-card>`,
|
|
31
|
-
props: args,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
export const DefaultCard = {
|
|
38
|
-
args: {
|
|
39
|
-
title: 'Active users',
|
|
40
|
-
value: 1284,
|
|
41
|
-
unit: '',
|
|
42
|
-
change: 12.5,
|
|
43
|
-
changeCopy: 'vs last week',
|
|
44
|
-
description: 'Rolling 7-day average of unique user sessions.',
|
|
45
|
-
onRefresh: fn(),
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const NegativeTrend = {
|
|
50
|
-
args: {
|
|
51
|
-
title: 'NPS score',
|
|
52
|
-
value: 42,
|
|
53
|
-
change: -6.3,
|
|
54
|
-
changeCopy: 'vs previous survey',
|
|
55
|
-
description: 'Direct feedback collected from in-app survey responses.',
|
|
56
|
-
onRefresh: fn(),
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ManualRefreshDemo = {
|
|
61
|
-
args: {
|
|
62
|
-
title: 'Deploy success rate',
|
|
63
|
-
value: '99.2',
|
|
64
|
-
unit: '%',
|
|
65
|
-
change: 1.1,
|
|
66
|
-
changeCopy: 'vs last 24h',
|
|
67
|
-
description: 'Completed deploys without rollbacks.',
|
|
68
|
-
onRefresh: fn(),
|
|
69
|
-
},
|
|
70
|
-
play: async ({ canvasElement }) => {
|
|
71
|
-
const canvas = within(canvasElement);
|
|
72
|
-
const refreshButton = await canvas.findByRole('button', { name: /refresh metric/i });
|
|
73
|
-
await userEvent.click(refreshButton);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { defineAureliaStory } from '@aurelia/storybook';
|
|
2
|
-
import { Registration } from 'aurelia';
|
|
3
|
-
import { fn, userEvent, within } from 'storybook/test';
|
|
4
|
-
import { WeatherWidget } from '../components/weather-widget';
|
|
5
|
-
import { IWeatherService, WeatherService, WeatherSummary } from '../services/weather-service';
|
|
6
|
-
|
|
7
|
-
type WeatherWidgetArgs = {
|
|
8
|
-
location: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const mockService: WeatherService = {
|
|
12
|
-
async getWeather(location: string): Promise<WeatherSummary> {
|
|
13
|
-
const safeLocation = location ?? '';
|
|
14
|
-
return {
|
|
15
|
-
location: safeLocation,
|
|
16
|
-
condition: safeLocation.includes('Berlin') ? 'Cloudy' : 'Sunny',
|
|
17
|
-
temperature: safeLocation.includes('Berlin') ? 16 : 24,
|
|
18
|
-
high: safeLocation.includes('Berlin') ? 18 : 27,
|
|
19
|
-
low: safeLocation.includes('Berlin') ? 11 : 19,
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const meta = {
|
|
25
|
-
title: 'Dashboard/WeatherWidget',
|
|
26
|
-
component: WeatherWidget,
|
|
27
|
-
parameters: {
|
|
28
|
-
layout: 'centered',
|
|
29
|
-
},
|
|
30
|
-
render: (args: WeatherWidgetArgs) =>
|
|
31
|
-
defineAureliaStory({
|
|
32
|
-
template: `<weather-widget location.bind="location"></weather-widget>`,
|
|
33
|
-
props: args,
|
|
34
|
-
components: [WeatherWidget],
|
|
35
|
-
items: [Registration.instance(IWeatherService, mockService)],
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default meta;
|
|
40
|
-
|
|
41
|
-
export const DefaultWeather = {
|
|
42
|
-
args: {
|
|
43
|
-
location: 'Seattle, WA',
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const EuropeanCity = {
|
|
48
|
-
args: {
|
|
49
|
-
location: 'Berlin, Germany',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const RefreshInteraction = {
|
|
54
|
-
args: {
|
|
55
|
-
location: 'Lisbon, Portugal',
|
|
56
|
-
},
|
|
57
|
-
play: async ({ canvasElement }) => {
|
|
58
|
-
const canvas = within(canvasElement);
|
|
59
|
-
const refreshButton = await canvas.findByRole('button', { name: /refresh/i });
|
|
60
|
-
await userEvent.click(refreshButton);
|
|
61
|
-
},
|
|
62
|
-
};
|
|
@@ -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
|
-
}
|
package/jest.config.cjs
DELETED
package/rollup.config.mjs
DELETED
|
@@ -1,52 +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
|
-
'@rsbuild/core',
|
|
11
|
-
'aurelia',
|
|
12
|
-
'react',
|
|
13
|
-
'react-dom',
|
|
14
|
-
'storybook/internal/types',
|
|
15
|
-
'storybook/theming'
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
// Get all TypeScript files from src directory
|
|
19
|
-
const srcFiles = glob
|
|
20
|
-
.sync('src/**/*.ts', { ignore: ['src/preview/types.ts', 'src/preview/storybook-types.ts'] })
|
|
21
|
-
.reduce((acc, file) => {
|
|
22
|
-
const key = file.replace(/^src\//, '').replace(/\.ts$/, '');
|
|
23
|
-
acc[key] = file;
|
|
24
|
-
return acc;
|
|
25
|
-
}, {});
|
|
26
|
-
|
|
27
|
-
const createConfig = (input, output) => ({
|
|
28
|
-
input,
|
|
29
|
-
output: {
|
|
30
|
-
file: output,
|
|
31
|
-
format: 'esm',
|
|
32
|
-
sourcemap: true,
|
|
33
|
-
exports: 'named'
|
|
34
|
-
},
|
|
35
|
-
plugins: [
|
|
36
|
-
typescript({
|
|
37
|
-
tsconfig: './tsconfig.json',
|
|
38
|
-
declaration: false,
|
|
39
|
-
outDir: 'dist'
|
|
40
|
-
}),
|
|
41
|
-
resolve(),
|
|
42
|
-
commonjs()
|
|
43
|
-
],
|
|
44
|
-
external
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// Create configs for all source files - ESM only for Storybook v10
|
|
48
|
-
const configs = Object.entries(srcFiles).map(([name, input]) =>
|
|
49
|
-
createConfig(input, `dist/${name}.js`)
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
export default configs;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const checkOnly = process.argv.includes('--check');
|
|
5
|
-
|
|
6
|
-
const rootPath = path.resolve(__dirname, '..');
|
|
7
|
-
const rootPkgPath = path.join(rootPath, 'package.json');
|
|
8
|
-
const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, 'utf8'));
|
|
9
|
-
const version = rootPkg.version;
|
|
10
|
-
|
|
11
|
-
const exampleDirs = [
|
|
12
|
-
'apps/hello-world',
|
|
13
|
-
'apps/hello-world-webpack',
|
|
14
|
-
'apps/hello-world-rsbuild',
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
let failed = false;
|
|
18
|
-
|
|
19
|
-
for (const dir of exampleDirs) {
|
|
20
|
-
const pkgPath = path.join(rootPath, dir, 'package.json');
|
|
21
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
22
|
-
let changed = false;
|
|
23
|
-
|
|
24
|
-
if (pkg.version !== version) {
|
|
25
|
-
if (checkOnly) {
|
|
26
|
-
failed = true;
|
|
27
|
-
} else {
|
|
28
|
-
pkg.version = version;
|
|
29
|
-
changed = true;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const depKey of ['dependencies', 'devDependencies', 'peerDependencies']) {
|
|
34
|
-
if (pkg[depKey] && pkg[depKey]['@aurelia/storybook']) {
|
|
35
|
-
const desired = `^${version}`;
|
|
36
|
-
if (pkg[depKey]['@aurelia/storybook'] !== desired) {
|
|
37
|
-
if (checkOnly) {
|
|
38
|
-
failed = true;
|
|
39
|
-
} else {
|
|
40
|
-
pkg[depKey]['@aurelia/storybook'] = desired;
|
|
41
|
-
changed = true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!checkOnly && changed) {
|
|
48
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (checkOnly && failed) {
|
|
53
|
-
console.error('Example app versions are out of sync with root package.json.');
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|