@aurelia/storybook 0.1.1 → 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/LICENSE +1 -1
- package/README.md +47 -22
- package/__tests__/preset.test.ts +49 -0
- package/__tests__/preview.test.ts +139 -0
- package/__tests__/render.test.ts +1 -2
- package/__tests__/webpack.test.ts +21 -0
- package/apps/hello-world/.storybook/main.ts +28 -0
- package/apps/hello-world/.storybook/preview.ts +1 -0
- package/apps/hello-world/.stylelintrc.json +5 -0
- package/apps/hello-world/.yarnrc.yml +2 -0
- package/apps/hello-world/README.md +28 -0
- package/apps/hello-world/eslint.config.mjs +25 -0
- package/apps/hello-world/favicon.ico +0 -0
- package/apps/hello-world/index.html +17 -0
- package/apps/hello-world/package-lock.json +10141 -0
- package/apps/hello-world/package.json +61 -0
- package/apps/hello-world/src/hello-world.html +6 -0
- package/apps/hello-world/src/hello-world.ts +17 -0
- package/apps/hello-world/src/main.ts +6 -0
- package/apps/hello-world/src/my-app.html +1 -0
- package/apps/hello-world/src/my-app.ts +3 -0
- package/apps/hello-world/src/resource.d.ts +15 -0
- package/apps/hello-world/src/stories/hello-world.stories.ts +54 -0
- package/apps/hello-world/test/my-app.spec.ts +15 -0
- package/apps/hello-world/test/setup.ts +29 -0
- package/apps/hello-world/tsconfig.json +18 -0
- package/apps/hello-world/tsconfig.vitest.json +11 -0
- package/apps/hello-world/vite.config.ts +19 -0
- package/apps/hello-world/vitest.config.ts +15 -0
- package/apps/hello-world-webpack/.env.development +0 -0
- package/apps/hello-world-webpack/.storybook/main.ts +16 -0
- package/apps/hello-world-webpack/.storybook/preview.ts +3 -0
- package/apps/hello-world-webpack/.stylelintrc.json +5 -0
- package/apps/hello-world-webpack/.yarnrc.yml +2 -0
- package/apps/hello-world-webpack/README.md +29 -0
- package/apps/hello-world-webpack/eslint.config.mjs +25 -0
- package/apps/hello-world-webpack/favicon.ico +0 -0
- package/apps/hello-world-webpack/index.html +15 -0
- package/apps/hello-world-webpack/package-lock.json +8856 -0
- package/apps/hello-world-webpack/package.json +53 -0
- package/apps/hello-world-webpack/src/main.ts +6 -0
- package/apps/hello-world-webpack/src/my-app.css +3 -0
- package/apps/hello-world-webpack/src/my-app.html +1 -0
- package/apps/hello-world-webpack/src/my-app.stories.ts +12 -0
- package/apps/hello-world-webpack/src/my-app.ts +3 -0
- package/apps/hello-world-webpack/src/resource.d.ts +13 -0
- package/apps/hello-world-webpack/tsconfig.json +18 -0
- package/apps/hello-world-webpack/webpack.config.js +111 -0
- 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/preset.js +35 -1
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +34 -2
- package/dist/preset.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 +74 -0
- package/dist/preview.js.map +1 -0
- package/dist/preview.mjs +72 -0
- package/dist/preview.mjs.map +1 -0
- package/dist/webpack.js +23 -0
- package/dist/webpack.js.map +1 -0
- package/dist/webpack.mjs +21 -0
- package/dist/webpack.mjs.map +1 -0
- package/jest.config.js +1 -1
- package/package.json +23 -24
- package/rollup.config.mjs +0 -3
- package/src/preset.ts +22 -5
- package/src/preview/render.ts +2 -2
- package/src/preview/types.ts +1 -1
- package/src/preview.ts +50 -0
- package/src/webpack.ts +21 -0
- package/__tests__/render.test.d.ts +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/preset.d.ts +0 -8
- package/dist/preview/render.d.ts +0 -17
- package/dist/preview/types.d.ts +0 -5
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "apptasks-video",
|
|
3
|
+
"description": "An Aurelia 2 client application.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "???"
|
|
8
|
+
},
|
|
9
|
+
"license": "UNLICENSED",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@aurelia/router": "^2.0.0-beta.24",
|
|
12
|
+
"@aurelia/validation": "^2.0.0-beta.24",
|
|
13
|
+
"@aurelia/validation-html": "^2.0.0-beta.24",
|
|
14
|
+
"aurelia": "^2.0.0-beta.24"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@aurelia/storybook": "file:../..",
|
|
18
|
+
"@aurelia/testing": "^2.0.0-beta.24",
|
|
19
|
+
"@aurelia/vite-plugin": "^2.0.0-beta.24",
|
|
20
|
+
"@storybook/addon-actions": "^9.0.0",
|
|
21
|
+
"@storybook/addon-links": "^9.0.0",
|
|
22
|
+
"@storybook/builder-vite": "^9.0.0",
|
|
23
|
+
"@storybook/test": "^9.0.0-alpha.2",
|
|
24
|
+
"storybook": "^9.0.0",
|
|
25
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
26
|
+
"@types/node": "^22.10.2",
|
|
27
|
+
"eslint": "^9.17.0",
|
|
28
|
+
"globals": "^15.14.0",
|
|
29
|
+
"jsdom": "^25.0.1",
|
|
30
|
+
"node-html-parser": "^7.0.1",
|
|
31
|
+
"sass": "^1.83.4",
|
|
32
|
+
"stylelint": "^16.12.0",
|
|
33
|
+
"stylelint-config-standard": "^36.0.1",
|
|
34
|
+
"stylus": "^0.64.0",
|
|
35
|
+
"tailwindcss": "^4.0.0",
|
|
36
|
+
"tslib": "^2.8.1",
|
|
37
|
+
"typescript": "^5.7.2",
|
|
38
|
+
"typescript-eslint": "^8.18.1",
|
|
39
|
+
"vite": "^6.0.3",
|
|
40
|
+
"vite-plugin-node-polyfills": "^0.22.0",
|
|
41
|
+
"vitest": "^2.1.8"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"lint:js": "eslint src test",
|
|
45
|
+
"lint:css": "stylelint \"src/**/*.css\"",
|
|
46
|
+
"lint": "npm run lint:js && npm run lint:css",
|
|
47
|
+
"pretest": "npm run lint",
|
|
48
|
+
"start": "vite",
|
|
49
|
+
"build": "vite build",
|
|
50
|
+
"test": "vitest",
|
|
51
|
+
"storybook": "storybook dev -p 6006",
|
|
52
|
+
"build-storybook": "storybook build"
|
|
53
|
+
},
|
|
54
|
+
"type": "module",
|
|
55
|
+
"overrides": {
|
|
56
|
+
"vite-plugin-node-polyfills": {
|
|
57
|
+
"vite": "^6.0.0"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
61
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { bindable } from 'aurelia';
|
|
2
|
+
|
|
3
|
+
export class HelloWorld {
|
|
4
|
+
@bindable() message = 'Hello from Aurelia!';
|
|
5
|
+
// New reactive counter property to track number of clicks
|
|
6
|
+
counter = 0;
|
|
7
|
+
// New bindable event callback for the increment action
|
|
8
|
+
@bindable() onIncrement;
|
|
9
|
+
|
|
10
|
+
// Method to increment the counter and fire the onIncrement callback if provided.
|
|
11
|
+
increment() {
|
|
12
|
+
this.counter++;
|
|
13
|
+
if (this.onIncrement) {
|
|
14
|
+
this.onIncrement(this.counter);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Hello World</h1>
|
|
@@ -0,0 +1,15 @@
|
|
|
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';
|
|
14
|
+
|
|
15
|
+
declare module '*.au';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { HelloWorld } from '../hello-world';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import { userEvent, within } from '@storybook/test';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Example/HelloWorld',
|
|
7
|
+
component: HelloWorld,
|
|
8
|
+
render: () => ({
|
|
9
|
+
template: `<hello-world message.bind="message" on-increment.bind="onIncrement"></hello-world>`,
|
|
10
|
+
}),
|
|
11
|
+
argTypes: {
|
|
12
|
+
message: { control: 'text' },
|
|
13
|
+
onIncrement: { action: 'increment' }
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
export const DefaultHelloWorld = {
|
|
20
|
+
args: {
|
|
21
|
+
message: "Hello from Storybook!",
|
|
22
|
+
onIncrement: action('increment')
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const InteractiveHelloWorld = {
|
|
27
|
+
args: {
|
|
28
|
+
message: "Try clicking the button!",
|
|
29
|
+
onIncrement: action('increment')
|
|
30
|
+
},
|
|
31
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
32
|
+
const canvas = within(canvasElement);
|
|
33
|
+
const button = canvas.getByRole('button');
|
|
34
|
+
// Simulate three button clicks
|
|
35
|
+
await userEvent.click(button);
|
|
36
|
+
await userEvent.click(button);
|
|
37
|
+
await userEvent.click(button);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const NoArgs = {
|
|
42
|
+
render: () => ({
|
|
43
|
+
template: `<hello-world></hello-world>`
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithCustomTemplate = {
|
|
48
|
+
render: () => ({
|
|
49
|
+
template: `<hello-world message.bind="message">Click me!</hello-world>`
|
|
50
|
+
}),
|
|
51
|
+
args: {
|
|
52
|
+
message: "This is a custom message"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, it } from 'vitest';
|
|
2
|
+
import { MyApp } from '../src/my-app';
|
|
3
|
+
import { createFixture } from '@aurelia/testing';
|
|
4
|
+
|
|
5
|
+
describe('my-app', () => {
|
|
6
|
+
it('should render message', async () => {
|
|
7
|
+
const { assertText } = await createFixture(
|
|
8
|
+
'<my-app></my-app>',
|
|
9
|
+
{},
|
|
10
|
+
[MyApp],
|
|
11
|
+
).started;
|
|
12
|
+
|
|
13
|
+
assertText('Hello World!', { compact: true });
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BrowserPlatform } from '@aurelia/platform-browser';
|
|
2
|
+
import { setPlatform, onFixtureCreated, type IFixture } from '@aurelia/testing';
|
|
3
|
+
import { beforeAll, afterEach } from 'vitest';
|
|
4
|
+
|
|
5
|
+
// Sets up the Aurelia environment for testing
|
|
6
|
+
function bootstrapTextEnv() {
|
|
7
|
+
const platform = new BrowserPlatform(window);
|
|
8
|
+
setPlatform(platform);
|
|
9
|
+
BrowserPlatform.set(globalThis, platform);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const fixtures: IFixture<object>[] = [];
|
|
13
|
+
beforeAll(() => {
|
|
14
|
+
bootstrapTextEnv();
|
|
15
|
+
onFixtureCreated(fixture => {
|
|
16
|
+
fixtures.push(fixture);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
fixtures.forEach(async f => {
|
|
22
|
+
try {
|
|
23
|
+
await f.stop(true);
|
|
24
|
+
} catch {
|
|
25
|
+
// ignore
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
fixtures.length = 0;
|
|
29
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"target": "ES2017",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"importHelpers": true,
|
|
10
|
+
"sourceMap": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"src"
|
|
14
|
+
, "aurelia-sfc-plugin.js" ],
|
|
15
|
+
"files": [
|
|
16
|
+
"src/resource.d.ts"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
|
3
|
+
import aurelia from '@aurelia/vite-plugin';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
server: {
|
|
7
|
+
open: !process.env.CI,
|
|
8
|
+
port: 9000,
|
|
9
|
+
},
|
|
10
|
+
esbuild: {
|
|
11
|
+
target: 'es2022'
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
aurelia({
|
|
15
|
+
useDev: true,
|
|
16
|
+
}),
|
|
17
|
+
nodePolyfills(),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { mergeConfig, defineConfig } from "vitest/config";
|
|
3
|
+
import viteConfig from "./vite.config";
|
|
4
|
+
|
|
5
|
+
export default mergeConfig(
|
|
6
|
+
viteConfig,
|
|
7
|
+
defineConfig({
|
|
8
|
+
test: {
|
|
9
|
+
environment: "jsdom",
|
|
10
|
+
watch: false,
|
|
11
|
+
root: fileURLToPath(new URL("./", import.meta.url)),
|
|
12
|
+
setupFiles: ["./test/setup.ts"]
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
3
|
+
addons: [
|
|
4
|
+
"@storybook/addon-webpack5-compiler-swc",
|
|
5
|
+
"@storybook/addon-links"
|
|
6
|
+
],
|
|
7
|
+
framework: {
|
|
8
|
+
name: '@aurelia/storybook',
|
|
9
|
+
options: {},
|
|
10
|
+
},
|
|
11
|
+
core: {
|
|
12
|
+
builder: '@storybook/builder-webpack5',
|
|
13
|
+
},
|
|
14
|
+
docs: {},
|
|
15
|
+
};
|
|
16
|
+
export default config;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# examples
|
|
2
|
+
|
|
3
|
+
This project is bootstrapped by [aurelia/new](https://github.com/aurelia/new).
|
|
4
|
+
|
|
5
|
+
## Start dev web server
|
|
6
|
+
|
|
7
|
+
npm start
|
|
8
|
+
|
|
9
|
+
## Build the app in production mode
|
|
10
|
+
|
|
11
|
+
npm run build
|
|
12
|
+
|
|
13
|
+
It builds all files to dist folder. To deploy to production server, copy all the `dist/*` files to production root folder.
|
|
14
|
+
|
|
15
|
+
For example
|
|
16
|
+
```
|
|
17
|
+
dist/index.html
|
|
18
|
+
dist/foo.12345.js
|
|
19
|
+
```
|
|
20
|
+
Copy to production root folder
|
|
21
|
+
```
|
|
22
|
+
root_folder/index.html
|
|
23
|
+
root_folder/foo.12345.js
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Analyze webpack bundle
|
|
28
|
+
|
|
29
|
+
npm run analyze
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import tsParser from "@typescript-eslint/parser";
|
|
4
|
+
import globals from "globals";
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
...tseslint.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts"],
|
|
11
|
+
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.builtin,
|
|
15
|
+
...globals.nodeBuiltin,
|
|
16
|
+
...globals.browser,
|
|
17
|
+
...globals.node,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
parser: tsParser,
|
|
21
|
+
ecmaVersion: 2019,
|
|
22
|
+
sourceType: "module",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
];
|
|
Binary file
|