@aerogel/cli 0.0.0-next.926bde19326fe7b6b24b277666936862b64d8295 → 0.0.0-next.a5b6ecb68fdca29d00c8b8906d00aa5bf64a9d7c
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/dist/aerogel-cli.cjs.js +1 -1
- package/dist/aerogel-cli.cjs.js.map +1 -1
- package/dist/aerogel-cli.esm.js +1 -1
- package/dist/aerogel-cli.esm.js.map +1 -1
- package/package.json +12 -5
- package/src/cli.ts +4 -0
- package/src/commands/Command.ts +15 -7
- package/src/commands/create.test.ts +32 -7
- package/src/commands/create.ts +25 -8
- package/src/commands/generate-component.test.ts +70 -6
- package/src/commands/generate-component.ts +165 -23
- package/src/commands/generate-model.test.ts +17 -6
- package/src/commands/generate-model.ts +34 -25
- package/src/commands/generate-service.test.ts +29 -0
- package/src/commands/generate-service.ts +151 -0
- package/src/commands/install.test.ts +49 -0
- package/src/commands/install.ts +33 -0
- package/src/lib/App.ts +65 -3
- package/src/lib/Editor.ts +58 -0
- package/src/lib/File.ts +6 -0
- package/src/lib/Log.mock.ts +2 -1
- package/src/lib/Log.ts +6 -4
- package/src/lib/Shell.mock.ts +1 -1
- package/src/lib/Template.ts +5 -1
- package/src/lib/utils/app.ts +15 -0
- package/src/lib/utils/edit.ts +44 -0
- package/src/lib/utils/paths.ts +34 -0
- package/src/plugins/Histoire.ts +105 -0
- package/src/plugins/Plugin.ts +178 -0
- package/src/plugins/Solid.ts +78 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +36 -6
- package/src/testing/stubs/ProgramStub.ts +35 -0
- package/src/testing/utils.ts +14 -0
- package/templates/app/.github/workflows/ci.yml +14 -2
- package/templates/app/.vscode/launch.json +16 -0
- package/templates/app/.vscode/settings.json +10 -0
- package/templates/app/README.md +3 -0
- package/templates/app/cypress/cypress.config.ts +16 -0
- package/templates/app/index.html +4 -3
- package/templates/app/package.json +33 -9
- package/templates/app/src/App.vue +5 -3
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +6 -2
- package/templates/app/src/types/globals.d.ts +0 -1
- package/templates/app/tailwind.config.js +1 -1
- package/templates/app/tsconfig.json +1 -0
- package/templates/app/vite.config.ts +14 -6
- package/templates/component-button/[component.name].vue +32 -0
- package/templates/component-button-story/[component.name].story.vue +71 -0
- package/templates/component-input/[component.name].vue +16 -0
- package/templates/component-input-story/[component.name].story.vue +63 -0
- package/templates/histoire/histoire.config.ts +7 -0
- package/templates/histoire/patches/histoire+0.17.6.patch +13 -0
- package/templates/histoire/src/main.histoire.ts +8 -0
- package/templates/postcss-pseudo-classes/postcss.config.js +15 -0
- package/templates/service/[service.name].ts +8 -0
- package/.eslintrc.js +0 -7
- package/noeldemartin.config.js +0 -4
- package/src/lib/utils.test.ts +0 -33
- package/src/lib/utils.ts +0 -44
- package/templates/app/cypress.config.ts +0 -8
- /package/bin/{ag → gel} +0 -0
- /package/templates/app/src/assets/{styles.css → css/styles.css} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Plugin from '@/plugins/Plugin';
|
|
2
|
+
import Shell from '@/lib/Shell';
|
|
3
|
+
|
|
4
|
+
export class Soukai extends Plugin {
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
super('soukai');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
protected async installNpmDependencies(): Promise<void> {
|
|
11
|
+
await Shell.run('npm install soukai@next --save-exact');
|
|
12
|
+
await super.installNpmDependencies();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected getBootstrapConfig(): string {
|
|
16
|
+
return 'soukai({ models: import.meta.glob(\'@/models/*\', { eager: true }) })';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
package/src/testing/setup.ts
CHANGED
|
@@ -24,16 +24,46 @@ beforeEach(() => {
|
|
|
24
24
|
Shell.mock();
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
vi.mock('@/lib/utils/app', async () => {
|
|
28
|
+
const original = (await vi.importActual('@/lib/utils/app')) as object;
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...original,
|
|
32
|
+
isLocalApp: () => false,
|
|
33
|
+
isLinkedLocalApp: () => false,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
vi.mock('@/lib/utils/edit', async () => {
|
|
38
|
+
const original = (await vi.importActual('@/lib/utils/edit')) as object;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
...original,
|
|
42
|
+
editFiles: () => false,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
27
46
|
// TODO find out why these need to be mocked
|
|
47
|
+
vi.mock('@/lib/utils/paths', async () => {
|
|
48
|
+
const original = (await vi.importActual('@/lib/utils/paths')) as object;
|
|
49
|
+
|
|
50
|
+
function basePath(path: string = '') {
|
|
51
|
+
return resolve(__dirname, '../../', path);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function packagePath(packageName: string) {
|
|
55
|
+
return basePath(`../${packageName}`);
|
|
56
|
+
}
|
|
28
57
|
|
|
29
|
-
|
|
30
|
-
|
|
58
|
+
function templatePath(name: string = '') {
|
|
59
|
+
return resolve(__dirname, `../../templates/${name}`);
|
|
60
|
+
}
|
|
31
61
|
|
|
32
62
|
return {
|
|
33
|
-
...
|
|
34
|
-
basePath
|
|
35
|
-
|
|
36
|
-
|
|
63
|
+
...original,
|
|
64
|
+
basePath,
|
|
65
|
+
packagePath,
|
|
66
|
+
templatePath,
|
|
37
67
|
};
|
|
38
68
|
});
|
|
39
69
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Command as Program } from 'commander';
|
|
2
|
+
import type { Constructor } from '@noeldemartin/utils';
|
|
3
|
+
|
|
4
|
+
import type Command from '@/commands/Command';
|
|
5
|
+
|
|
6
|
+
export default class ProgramStub<T extends Constructor<Command> = Constructor<Command>> {
|
|
7
|
+
|
|
8
|
+
private runner?: (...args: ConstructorParameters<T>) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
public async run(...args: ConstructorParameters<T>): Promise<void> {
|
|
11
|
+
await this.runner?.(...args);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
public command(): any {
|
|
16
|
+
return { description: () => this };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public argument(): this {
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public option(): this {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public action(runner: Function): this {
|
|
28
|
+
this.runner = runner as (...args: ConstructorParameters<T>) => Promise<void>;
|
|
29
|
+
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default interface ProgramStub extends Program {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Constructor } from '@noeldemartin/utils';
|
|
2
|
+
|
|
3
|
+
import ProgramStub from '@/testing/stubs/ProgramStub';
|
|
4
|
+
import type Command from '@/commands/Command';
|
|
5
|
+
|
|
6
|
+
export type StubCommandRunner<T extends Constructor<Command>> = (...args: ConstructorParameters<T>) => Promise<void>;
|
|
7
|
+
|
|
8
|
+
export function stubCommandRunner<T extends Constructor<Command>>(commandClass: T): StubCommandRunner<T> {
|
|
9
|
+
const program = new ProgramStub();
|
|
10
|
+
|
|
11
|
+
(commandClass as unknown as typeof Command).define(program);
|
|
12
|
+
|
|
13
|
+
return (...args) => program.run(...args);
|
|
14
|
+
}
|
|
@@ -12,6 +12,18 @@ jobs:
|
|
|
12
12
|
node-version-file: '.nvmrc'
|
|
13
13
|
- run: npm ci
|
|
14
14
|
- run: npm run lint
|
|
15
|
-
- run: npm run test:ci
|
|
16
|
-
- run: npm run cy:test
|
|
17
15
|
- run: npm run build
|
|
16
|
+
- run: npm run test:ci
|
|
17
|
+
- run: npm run cy:test-snapshots:ci
|
|
18
|
+
- name: Upload Cypress screenshots
|
|
19
|
+
uses: actions/upload-artifact@v3
|
|
20
|
+
if: ${{ failure() }}
|
|
21
|
+
with:
|
|
22
|
+
name: cypress_screenshots
|
|
23
|
+
path: cypress/screenshots
|
|
24
|
+
- name: Upload Cypress snapshots
|
|
25
|
+
uses: actions/upload-artifact@v3
|
|
26
|
+
if: ${{ failure() }}
|
|
27
|
+
with:
|
|
28
|
+
name: cypress_snapshots
|
|
29
|
+
path: cypress/snapshots
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"type": "node",
|
|
6
|
+
"request": "launch",
|
|
7
|
+
"name": "Debug Current Test File",
|
|
8
|
+
"autoAttachChildProcesses": true,
|
|
9
|
+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
|
10
|
+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
|
|
11
|
+
"args": ["run", "${fileBasenameNoExtension}"],
|
|
12
|
+
"smartStep": true,
|
|
13
|
+
"console": "integratedTerminal"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import install from '@aerogel/cypress/dist/plugin';
|
|
2
|
+
import { defineConfig } from 'cypress';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
e2e: {
|
|
6
|
+
baseUrl: 'http://localhost:5001',
|
|
7
|
+
video: false,
|
|
8
|
+
retries: {
|
|
9
|
+
runMode: 3,
|
|
10
|
+
openMode: 0,
|
|
11
|
+
},
|
|
12
|
+
setupNodeEvents(on) {
|
|
13
|
+
install(on);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
package/templates/app/index.html
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title
|
|
6
|
+
<title>{{ app.name }}</title>
|
|
7
|
+
{{ socialMeta() }}
|
|
7
8
|
</head>
|
|
8
|
-
<body class="h-full w-full">
|
|
9
|
-
<div id="app" class="h-full"></div>
|
|
9
|
+
<body class="h-full w-full text-base font-normal leading-tight text-gray-900 antialiased">
|
|
10
|
+
<div id="app" class="loading h-full"></div>
|
|
10
11
|
<script type="module" src="./src/main.ts"></script>
|
|
11
12
|
</body>
|
|
12
13
|
</html>
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vite build",
|
|
7
7
|
"cy:dev": "concurrently --kill-others \"npm run test:serve-app\" \"npm run cy:open\"",
|
|
8
|
-
"cy:open": "cypress open --e2e --browser chromium",
|
|
9
|
-
"cy:run": "cypress run",
|
|
8
|
+
"cy:open": "cypress open --config-file ./cypress/cypress.config.ts --e2e --browser chromium",
|
|
9
|
+
"cy:run": "cypress run --config-file ./cypress/cypress.config.ts",
|
|
10
10
|
"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",
|
|
11
|
+
"cy:test-snapshots": "docker run -it -u `id -u ${whoami}` -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
|
|
12
|
+
"cy:test-snapshots:ci": "docker run -e CYPRESS_SNAPSHOTS=true -v ./:/app -w /app cypress/base:18.16.0 sh -c \"npx cypress install && npm run cy:test\"",
|
|
11
13
|
"dev": "vite",
|
|
12
14
|
"lint": "noeldemartin-lint src",
|
|
13
15
|
"test": "vitest --run",
|
|
@@ -15,28 +17,50 @@
|
|
|
15
17
|
"test:serve-app": "vite --port 5001"
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@aerogel/core": "
|
|
19
|
-
"@aerogel/plugin-i18n": "
|
|
20
|
+
"@aerogel/core": "<% &dependencies.aerogelCore %>",
|
|
21
|
+
"@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
|
|
22
|
+
"@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
|
|
20
23
|
"@intlify/unplugin-vue-i18n": "^0.12.2",
|
|
24
|
+
"@noeldemartin/utils": "next",
|
|
21
25
|
"@tailwindcss/forms": "^0.5.3",
|
|
22
26
|
"@tailwindcss/typography": "^0.5.9",
|
|
27
|
+
"soukai": "next",
|
|
23
28
|
"tailwindcss": "^3.3.2",
|
|
24
29
|
"vue": "^3.3.0",
|
|
25
30
|
"vue-i18n": "9.3.0-beta.19"
|
|
26
31
|
},
|
|
27
32
|
"devDependencies": {
|
|
28
|
-
"@aerogel/cli": "
|
|
29
|
-
"@aerogel/cypress": "
|
|
30
|
-
"@aerogel/vite": "
|
|
31
|
-
"@
|
|
33
|
+
"@aerogel/cli": "<% &dependencies.aerogelCli %>",
|
|
34
|
+
"@aerogel/cypress": "<% &dependencies.aerogelCypress %>",
|
|
35
|
+
"@aerogel/vite": "<% &dependencies.aerogelVite %>",
|
|
36
|
+
"@iconify/json": "^2.2.134",
|
|
37
|
+
"@noeldemartin/eslint-config-vue": "next",
|
|
38
|
+
"@noeldemartin/scripts": "next",
|
|
32
39
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
33
40
|
"@types/node": "^20.3.1",
|
|
34
41
|
"autoprefixer": "^10.4.14",
|
|
35
42
|
"concurrently": "^8.2.0",
|
|
36
43
|
"cypress": "^12.17.0",
|
|
44
|
+
"eslint": "^8.40.0",
|
|
45
|
+
"prettier": "^2.8.8",
|
|
46
|
+
"prettier-eslint-cli": "^7.1.0",
|
|
47
|
+
"prettier-plugin-tailwindcss": "^0.2.8",
|
|
37
48
|
"start-server-and-test": "^2.0.0",
|
|
49
|
+
"unplugin-icons": "^0.16.3",
|
|
38
50
|
"unplugin-vue-components": "^0.24.1",
|
|
39
51
|
"vite": "^4.3.0",
|
|
40
|
-
"vitest": "^0.33.0"
|
|
52
|
+
"vitest": "^0.33.0",
|
|
53
|
+
"vue-tsc": "^1.8.15"
|
|
54
|
+
},
|
|
55
|
+
"eslintConfig": {
|
|
56
|
+
"extends": [
|
|
57
|
+
"@noeldemartin/eslint-config-vue"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"prettier": {
|
|
61
|
+
"plugins": [
|
|
62
|
+
"prettier-plugin-tailwindcss"
|
|
63
|
+
],
|
|
64
|
+
"printWidth": 120
|
|
41
65
|
}
|
|
42
66
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<AGAppLayout>
|
|
3
|
-
<main class="flex flex-grow flex-col items-center justify-center
|
|
4
|
-
<h1 class="text-4xl font-semibold">
|
|
2
|
+
<AGAppLayout class="bg-blue-50">
|
|
3
|
+
<main class="flex flex-grow flex-col items-center justify-center">
|
|
4
|
+
<h1 class="text-4xl font-semibold">
|
|
5
|
+
{{ $t('home.title') }}
|
|
6
|
+
</h1>
|
|
5
7
|
<a href="https://aerogel.js.org" target="_blank" class="mt-2 underline opacity-75 hover:opacity-100">
|
|
6
8
|
{{ $t('home.getStarted') }}
|
|
7
9
|
</a>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import i18n from '@aerogel/plugin-i18n';
|
|
2
|
+
import soukai from '@aerogel/plugin-soukai';
|
|
2
3
|
import { bootstrapApplication } from '@aerogel/core';
|
|
3
4
|
|
|
4
|
-
import './assets/styles.css';
|
|
5
|
+
import './assets/css/styles.css';
|
|
5
6
|
import App from './App.vue';
|
|
6
7
|
|
|
7
8
|
bootstrapApplication(App, {
|
|
8
|
-
plugins: [
|
|
9
|
+
plugins: [
|
|
10
|
+
i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
|
|
11
|
+
soukai({ models: import.meta.glob('@/models/*', { eager: true }) }),
|
|
12
|
+
],
|
|
9
13
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @type {import('tailwindcss').Config} */
|
|
2
2
|
module.exports = {
|
|
3
|
-
content: ['./index.html', './src/**/*.{vue,ts}', '
|
|
3
|
+
content: ['./index.html', './src/**/*.{vue,ts}', '<% &contentPath %>'],
|
|
4
4
|
plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
|
|
5
5
|
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import Aerogel, { AerogelResolver } from '@aerogel/vite';
|
|
2
2
|
import Components from 'unplugin-vue-components/vite';
|
|
3
3
|
import I18n from '@intlify/unplugin-vue-i18n/vite';
|
|
4
|
+
import Icons from 'unplugin-icons/vite';
|
|
5
|
+
import IconsResolver from 'unplugin-icons/resolver';
|
|
6
|
+
import { defineConfig } from 'vitest/config';
|
|
4
7
|
import { resolve } from 'path';
|
|
5
8
|
|
|
6
|
-
export default {
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
publicDir: resolve(__dirname, './src/assets/public/'),
|
|
7
11
|
plugins: [
|
|
8
|
-
|
|
9
|
-
Aerogel(),
|
|
12
|
+
Aerogel({ name: '<% app.name %>' }),
|
|
10
13
|
Components({
|
|
11
|
-
dirs: ['src/pages'],
|
|
12
14
|
dts: false,
|
|
13
|
-
resolvers: [AerogelResolver()],
|
|
15
|
+
resolvers: [AerogelResolver(), IconsResolver()],
|
|
16
|
+
}),
|
|
17
|
+
I18n({ include: resolve(__dirname, './src/lang/**/*.yaml') }),
|
|
18
|
+
Icons({
|
|
19
|
+
iconCustomizer(_, __, props) {
|
|
20
|
+
props['aria-hidden'] = 'true';
|
|
21
|
+
},
|
|
14
22
|
}),
|
|
15
23
|
],
|
|
16
24
|
resolve: {
|
|
@@ -18,4 +26,4 @@ export default {
|
|
|
18
26
|
'@': resolve(__dirname, './src'),
|
|
19
27
|
},
|
|
20
28
|
},
|
|
21
|
-
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessButton :class="colorClasses">
|
|
3
|
+
<slot />
|
|
4
|
+
</AGHeadlessButton>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { Colors, enumProp } from '@aerogel/core';
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
color: enumProp(Colors, Colors.Primary),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const colorClasses = computed(() => {
|
|
16
|
+
switch (props.color) {
|
|
17
|
+
case Colors.Secondary:
|
|
18
|
+
// Add your custom color classes here.
|
|
19
|
+
return '';
|
|
20
|
+
case Colors.Clear:
|
|
21
|
+
// Add your custom color classes here.
|
|
22
|
+
return '';
|
|
23
|
+
case Colors.Danger:
|
|
24
|
+
// Add your custom color classes here.
|
|
25
|
+
return '';
|
|
26
|
+
case Colors.Primary:
|
|
27
|
+
default:
|
|
28
|
+
// Add your custom color classes here.
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story :layout="{ type: 'grid' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<<% component.name %> :color="color">
|
|
5
|
+
{{ content }}
|
|
6
|
+
</<% component.name %>>
|
|
7
|
+
|
|
8
|
+
<template #controls>
|
|
9
|
+
<HstText v-model="content" title="Content" />
|
|
10
|
+
<HstSelect v-model="color" title="Color" :options="colorOptions" />
|
|
11
|
+
</template>
|
|
12
|
+
</Variant>
|
|
13
|
+
|
|
14
|
+
<Variant title="Default">
|
|
15
|
+
<<% component.name %>>
|
|
16
|
+
Click me!
|
|
17
|
+
</<% component.name %>>
|
|
18
|
+
</Variant>
|
|
19
|
+
|
|
20
|
+
<Variant title="Hover">
|
|
21
|
+
<<% component.name %> class=":hover">
|
|
22
|
+
Click me!
|
|
23
|
+
</<% component.name %>>
|
|
24
|
+
</Variant>
|
|
25
|
+
|
|
26
|
+
<Variant title="Focus">
|
|
27
|
+
<<% component.name %> class=":focus :focus-visible">
|
|
28
|
+
Click me!
|
|
29
|
+
</<% component.name %>>
|
|
30
|
+
</Variant>
|
|
31
|
+
|
|
32
|
+
<Variant title="Colors" :layout="{ width: '300px' }">
|
|
33
|
+
<div class="flex items-center gap-2">
|
|
34
|
+
<<% component.name %> color="primary">
|
|
35
|
+
Primary
|
|
36
|
+
</<% component.name %>>
|
|
37
|
+
<<% component.name %> color="secondary">
|
|
38
|
+
Secondary
|
|
39
|
+
</<% component.name %>>
|
|
40
|
+
<<% component.name %> color="danger">
|
|
41
|
+
Danger
|
|
42
|
+
</<% component.name %>>
|
|
43
|
+
<<% component.name %> color="clear">
|
|
44
|
+
Clear
|
|
45
|
+
</<% component.name %>>
|
|
46
|
+
</div>
|
|
47
|
+
</Variant>
|
|
48
|
+
</Story>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import { Colors } from '@aerogel/core';
|
|
53
|
+
import { invert } from '@noeldemartin/utils';
|
|
54
|
+
import { ref } from 'vue';
|
|
55
|
+
import type { Color } from '@aerogel/core';
|
|
56
|
+
|
|
57
|
+
const content = ref('Click me!');
|
|
58
|
+
const color = ref<Color>(Colors.Primary);
|
|
59
|
+
const colorOptions = invert(Colors);
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
.story-<% component.slug %> {
|
|
64
|
+
grid-template-columns: repeat(3, 200px) !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.story-<% component.slug %> .variant-playground,
|
|
68
|
+
.story-<% component.slug %> .variant-colors{
|
|
69
|
+
grid-column: 1 / -1;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessInput v-bind="props">
|
|
3
|
+
<AGHeadlessInputLabel />
|
|
4
|
+
<AGHeadlessInputInput v-bind="attrs" />
|
|
5
|
+
<AGHeadlessInputError />
|
|
6
|
+
</AGHeadlessInput>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { useInputAttrs, useInputProps } from '@aerogel/core';
|
|
11
|
+
|
|
12
|
+
defineOptions({ inheritAttrs: false });
|
|
13
|
+
|
|
14
|
+
const props = defineProps(useInputProps());
|
|
15
|
+
const [attrs] = useInputAttrs();
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story :layout="{ type: 'grid' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<AGForm :form="form">
|
|
5
|
+
<<% component.name %> name="food" :label="label" :placeholder="placeholder" />
|
|
6
|
+
</AGForm>
|
|
7
|
+
|
|
8
|
+
<template #controls>
|
|
9
|
+
<HstText v-model="label" title="Label" />
|
|
10
|
+
<HstText v-model="placeholder" title="Placeholder" />
|
|
11
|
+
<HstCheckbox v-model="hasErrors" title="Errors" />
|
|
12
|
+
</template>
|
|
13
|
+
</Variant>
|
|
14
|
+
|
|
15
|
+
<Variant title="Default">
|
|
16
|
+
<<% component.name %> label="What's the best food?" placeholder="Ramen" />
|
|
17
|
+
</Variant>
|
|
18
|
+
|
|
19
|
+
<Variant title="Hover">
|
|
20
|
+
<<% component.name %> label="What's the best food?" placeholder="Ramen" input-class=":hover" />
|
|
21
|
+
</Variant>
|
|
22
|
+
|
|
23
|
+
<Variant title="Focus">
|
|
24
|
+
<<% component.name %> label="What's the best food?" placeholder="Ramen" input-class=":focus :focus-visible" />
|
|
25
|
+
</Variant>
|
|
26
|
+
|
|
27
|
+
<Variant title="Error">
|
|
28
|
+
<AGForm :form="errorForm">
|
|
29
|
+
<<% component.name %>
|
|
30
|
+
name="food"
|
|
31
|
+
label="What's the best food?"
|
|
32
|
+
placeholder="Ramen"
|
|
33
|
+
class=":focus :focus-visible"
|
|
34
|
+
/>
|
|
35
|
+
</AGForm>
|
|
36
|
+
</Variant>
|
|
37
|
+
</Story>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { requiredStringInput, useForm } from '@aerogel/core';
|
|
42
|
+
import { ref, watchEffect } from 'vue';
|
|
43
|
+
|
|
44
|
+
const form = useForm({ food: requiredStringInput() });
|
|
45
|
+
const errorForm = useForm({ food: requiredStringInput() });
|
|
46
|
+
const label = ref('What\'s the best food?');
|
|
47
|
+
const placeholder = ref('Ramen');
|
|
48
|
+
const hasErrors = ref(false);
|
|
49
|
+
|
|
50
|
+
errorForm.submit();
|
|
51
|
+
|
|
52
|
+
watchEffect(() => (hasErrors.value ? form.submit() : form.reset()));
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.story-<% component.slug %> {
|
|
57
|
+
grid-template-columns: repeat(2, 300px) !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.story-<% component.slug %> .variant-playground {
|
|
61
|
+
grid-column: 1 / -1;
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/node_modules/histoire/dist/node/collect/index.js b/node_modules/histoire/dist/node/collect/index.js
|
|
2
|
+
index 8ffd507..37be43e 100644
|
|
3
|
+
--- a/node_modules/histoire/dist/node/collect/index.js
|
|
4
|
+
+++ b/node_modules/histoire/dist/node/collect/index.js
|
|
5
|
+
@@ -22,7 +22,7 @@ export function useCollectStories(options, ctx) {
|
|
6
|
+
/vite\w*\/dist\/client\/(client|env).mjs/,
|
|
7
|
+
...ctx.config.viteNodeInlineDeps ?? [],
|
|
8
|
+
],
|
|
9
|
+
- fallbackCJS: true,
|
|
10
|
+
+ fallbackCJS: false,
|
|
11
|
+
},
|
|
12
|
+
transformMode: ctx.config.viteNodeTransformMode,
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const plugins = {
|
|
2
|
+
tailwindcss: {},
|
|
3
|
+
autoprefixer: {},
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
if (process.env.NODE_ENV === 'development') {
|
|
7
|
+
plugins['postcss-pseudo-classes'] = {
|
|
8
|
+
blacklist: [],
|
|
9
|
+
restrictTo: ['hover', 'focus-visible', 'focus'],
|
|
10
|
+
allCombinations: true,
|
|
11
|
+
preserveBeforeAfter: false,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = { plugins };
|
package/.eslintrc.js
DELETED
package/noeldemartin.config.js
DELETED