@aerogel/cli 0.0.0-next.59bf5f7cc06e728d0cf6c00de28f1da48d7d6b8e → 0.0.0-next.6c02970f90d4e979a72530f1fa0c650785d6538f
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/.prettierignore +1 -0
- package/dist/aerogel-cli.cjs.js +1 -1
- package/dist/aerogel-cli.cjs.js.map +1 -1
- package/dist/aerogel-cli.d.ts +2 -2
- 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 +27 -3
- package/src/commands/Command.ts +11 -6
- package/src/commands/create.test.ts +12 -4
- package/src/commands/create.ts +20 -9
- package/src/commands/generate-component.test.ts +50 -3
- package/src/commands/generate-component.ts +162 -21
- package/src/commands/generate-model.test.ts +2 -2
- package/src/commands/generate-model.ts +19 -22
- package/src/commands/generate-overrides.ts +85 -0
- package/src/commands/generate-service.test.ts +21 -0
- package/src/commands/generate-service.ts +151 -0
- package/src/commands/info.ts +14 -0
- package/src/commands/install.test.ts +41 -0
- package/src/commands/install.ts +33 -0
- package/src/lib/App.ts +60 -5
- package/src/lib/Editor.ts +58 -0
- package/src/lib/File.mock.ts +1 -5
- package/src/lib/File.ts +7 -1
- package/src/lib/Log.mock.ts +3 -6
- package/src/lib/Log.ts +7 -5
- package/src/lib/Shell.mock.ts +2 -2
- package/src/lib/Shell.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 +113 -0
- package/src/plugins/Plugin.ts +178 -0
- package/src/plugins/Solid.ts +79 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +39 -12
- package/templates/app/.github/workflows/ci.yml +16 -4
- 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 +14 -0
- package/templates/app/cypress/support/e2e.ts +1 -3
- package/templates/app/cypress/tsconfig.json +3 -1
- package/templates/app/index.html +4 -3
- package/templates/app/package.json +34 -11
- package/templates/app/src/App.vue +5 -3
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +4 -4
- 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 +10 -5
- package/templates/component-button/[component.name].vue +42 -0
- package/templates/component-button-story/[component.name].story.vue +77 -0
- package/templates/component-checkbox/[component.name].vue +34 -0
- package/templates/component-checkbox-story/[component.name].story.vue +63 -0
- package/templates/component-input/[component.name].vue +17 -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/overrides/components/index.ts +15 -0
- package/templates/overrides/components/overrides/AlertModal.vue +11 -0
- package/templates/overrides/components/overrides/ConfirmModal.vue +20 -0
- package/templates/overrides/components/overrides/ErrorReportModal.vue +35 -0
- package/templates/overrides/components/overrides/LoadingModal.vue +12 -0
- package/templates/overrides/components/overrides/ModalWrapper.vue +22 -0
- package/templates/overrides/components/overrides/SnackbarNotification.vue +34 -0
- package/templates/overrides-story/Overrides.story.vue +86 -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,79 @@
|
|
|
1
|
+
import File from '@/lib/File';
|
|
2
|
+
import Log from '@/lib/Log';
|
|
3
|
+
import Plugin from '@/plugins/Plugin';
|
|
4
|
+
import Shell from '@/lib/Shell';
|
|
5
|
+
import { isLinkedLocalApp } from '@/lib/utils/app';
|
|
6
|
+
import { packagePath } from '@/lib/utils/paths';
|
|
7
|
+
import type { Editor } from '@/lib/Editor';
|
|
8
|
+
|
|
9
|
+
export class Solid extends Plugin {
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super('solid');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected async updateFiles(editor: Editor): Promise<void> {
|
|
16
|
+
await this.updateTailwindConfig(editor, {
|
|
17
|
+
content: isLinkedLocalApp()
|
|
18
|
+
? `'${packagePath('plugin-solid')}/dist/**/*.js'`
|
|
19
|
+
: '\'./node_modules/@aerogel/plugin-solid/dist/**/*.js\'',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
await this.updateNpmScripts(editor);
|
|
23
|
+
await this.updateGitIgnore();
|
|
24
|
+
await super.updateFiles(editor);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected async installNpmDependencies(): Promise<void> {
|
|
28
|
+
await Shell.run('npm install soukai-solid@next --save-exact');
|
|
29
|
+
await Shell.run('npm install @noeldemartin/solid-utils@next --save-exact');
|
|
30
|
+
await Shell.run('npm install @solid/community-server@7 --save');
|
|
31
|
+
await super.installNpmDependencies();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
protected async updateNpmScripts(editor: Editor): Promise<void> {
|
|
35
|
+
Log.info('Updating npm scripts...');
|
|
36
|
+
|
|
37
|
+
const packageJson = File.read('package.json');
|
|
38
|
+
|
|
39
|
+
if (!packageJson) {
|
|
40
|
+
return Log.fail('Could not find package.json file');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
File.write(
|
|
44
|
+
'package.json',
|
|
45
|
+
packageJson
|
|
46
|
+
.replace(
|
|
47
|
+
'"cy:dev": "concurrently --kill-others \\"npm run test:serve-app\\" \\"npm run cy:open\\"",',
|
|
48
|
+
'"cy:dev": "concurrently --kill-others ' +
|
|
49
|
+
'\\"npm run test:serve-app\\" \\"npm run test:serve-pod\\" \\"npm run cy:open\\"",',
|
|
50
|
+
)
|
|
51
|
+
.replace(
|
|
52
|
+
'"cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",',
|
|
53
|
+
'"cy:test": "start-server-and-test ' +
|
|
54
|
+
'test:serve-app http-get://localhost:5001 test:serve-pod http-get://localhost:3000 cy:run",',
|
|
55
|
+
)
|
|
56
|
+
.replace(
|
|
57
|
+
'"dev": "vite",',
|
|
58
|
+
'"dev": "vite",\n' +
|
|
59
|
+
'"dev:serve-pod": "community-solid-server -c @css:config/file.json -f ./solid-data",',
|
|
60
|
+
)
|
|
61
|
+
.replace(
|
|
62
|
+
'"test:serve-app": "vite --port 5001 --mode testing"',
|
|
63
|
+
'"test:serve-app": "vite --port 5001 --mode testing",\n' +
|
|
64
|
+
'"test:serve-pod": "community-solid-server -l warn"',
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
editor.addModifiedFile('package.json');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected async updateGitIgnore(): Promise<void> {
|
|
72
|
+
Log.info('Updating .gitignore');
|
|
73
|
+
|
|
74
|
+
const gitignore = File.read('.gitignore') ?? '';
|
|
75
|
+
|
|
76
|
+
File.write('.gitignore', `${gitignore}/solid-data\n`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
@@ -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
|
@@ -11,29 +11,56 @@ import ShellMock from '@/lib/Shell.mock';
|
|
|
11
11
|
|
|
12
12
|
setTestingNamespace(vi);
|
|
13
13
|
|
|
14
|
-
File.
|
|
15
|
-
Log.
|
|
16
|
-
Shell.
|
|
14
|
+
File.setMockFacade(FileMock);
|
|
15
|
+
Log.setMockFacade(LogMock);
|
|
16
|
+
Shell.setMockFacade(ShellMock);
|
|
17
17
|
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
FileMock.reset();
|
|
20
|
-
LogMock.reset();
|
|
21
|
-
|
|
22
19
|
File.mock();
|
|
23
20
|
Log.mock();
|
|
24
21
|
Shell.mock();
|
|
25
22
|
});
|
|
26
23
|
|
|
24
|
+
vi.mock('@/lib/utils/app', async () => {
|
|
25
|
+
const original = (await vi.importActual('@/lib/utils/app')) as object;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
...original,
|
|
29
|
+
isLocalApp: () => false,
|
|
30
|
+
isLinkedLocalApp: () => false,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
vi.mock('@/lib/utils/edit', async () => {
|
|
35
|
+
const original = (await vi.importActual('@/lib/utils/edit')) as object;
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...original,
|
|
39
|
+
editFiles: () => false,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
27
43
|
// TODO find out why these need to be mocked
|
|
44
|
+
vi.mock('@/lib/utils/paths', async () => {
|
|
45
|
+
const original = (await vi.importActual('@/lib/utils/paths')) as object;
|
|
46
|
+
|
|
47
|
+
function basePath(path: string = '') {
|
|
48
|
+
return resolve(__dirname, '../../', path);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function packagePath(packageName: string) {
|
|
52
|
+
return basePath(`../${packageName}`);
|
|
53
|
+
}
|
|
28
54
|
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
function templatePath(name: string = '') {
|
|
56
|
+
return resolve(__dirname, `../../templates/${name}`);
|
|
57
|
+
}
|
|
31
58
|
|
|
32
59
|
return {
|
|
33
|
-
...
|
|
34
|
-
basePath
|
|
35
|
-
|
|
36
|
-
|
|
60
|
+
...original,
|
|
61
|
+
basePath,
|
|
62
|
+
packagePath,
|
|
63
|
+
templatePath,
|
|
37
64
|
};
|
|
38
65
|
});
|
|
39
66
|
|
|
@@ -6,12 +6,24 @@ jobs:
|
|
|
6
6
|
ci:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
|
-
- uses: actions/checkout@
|
|
10
|
-
- uses: actions/setup-node@
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
- uses: actions/setup-node@v4
|
|
11
11
|
with:
|
|
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@v4
|
|
20
|
+
if: ${{ failure() }}
|
|
21
|
+
with:
|
|
22
|
+
name: cypress_screenshots
|
|
23
|
+
path: cypress/screenshots
|
|
24
|
+
- name: Upload Cypress snapshots
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
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,14 @@
|
|
|
1
|
+
import { setupAerogelNodeEvents } from '@aerogel/cypress/config';
|
|
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: setupAerogelNodeEvents,
|
|
13
|
+
},
|
|
14
|
+
});
|
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,40 +5,63 @@
|
|
|
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
|
-
"lint": "noeldemartin-lint src",
|
|
14
|
+
"lint": "noeldemartin-lint src cypress",
|
|
13
15
|
"test": "vitest --run",
|
|
14
16
|
"test:ci": "vitest --run --reporter verbose",
|
|
15
|
-
"test:serve-app": "vite --port 5001"
|
|
17
|
+
"test:serve-app": "vite --port 5001 --mode testing"
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@aerogel/core": "<%
|
|
19
|
-
"@aerogel/plugin-i18n": "<%
|
|
20
|
-
"@aerogel/plugin-soukai": "<%
|
|
20
|
+
"@aerogel/core": "<% &dependencies.aerogelCore %>",
|
|
21
|
+
"@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
|
|
22
|
+
"@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
|
|
21
23
|
"@intlify/unplugin-vue-i18n": "^0.12.2",
|
|
22
24
|
"@noeldemartin/utils": "next",
|
|
23
25
|
"@tailwindcss/forms": "^0.5.3",
|
|
24
26
|
"@tailwindcss/typography": "^0.5.9",
|
|
27
|
+
"soukai": "next",
|
|
25
28
|
"tailwindcss": "^3.3.2",
|
|
26
29
|
"vue": "^3.3.0",
|
|
27
30
|
"vue-i18n": "9.3.0-beta.19"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@aerogel/cli": "<%
|
|
31
|
-
"@aerogel/cypress": "<%
|
|
32
|
-
"@aerogel/vite": "<%
|
|
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",
|
|
33
39
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
34
40
|
"@types/node": "^20.3.1",
|
|
35
41
|
"autoprefixer": "^10.4.14",
|
|
36
42
|
"concurrently": "^8.2.0",
|
|
37
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",
|
|
38
48
|
"start-server-and-test": "^2.0.0",
|
|
49
|
+
"typescript": "~5.4",
|
|
39
50
|
"unplugin-icons": "^0.16.3",
|
|
40
51
|
"unplugin-vue-components": "^0.24.1",
|
|
41
52
|
"vite": "^4.3.0",
|
|
42
|
-
"vitest": "^0.33.0"
|
|
53
|
+
"vitest": "^0.33.0",
|
|
54
|
+
"vue-tsc": "^1.8.15"
|
|
55
|
+
},
|
|
56
|
+
"eslintConfig": {
|
|
57
|
+
"extends": [
|
|
58
|
+
"@noeldemartin/eslint-config-vue"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"prettier": {
|
|
62
|
+
"plugins": [
|
|
63
|
+
"prettier-plugin-tailwindcss"
|
|
64
|
+
],
|
|
65
|
+
"printWidth": 120
|
|
43
66
|
}
|
|
44
67
|
}
|
|
@@ -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,13 +1,13 @@
|
|
|
1
1
|
import i18n from '@aerogel/plugin-i18n';
|
|
2
2
|
import soukai from '@aerogel/plugin-soukai';
|
|
3
|
-
import {
|
|
3
|
+
import { bootstrap } from '@aerogel/core';
|
|
4
4
|
|
|
5
|
-
import './assets/styles.css';
|
|
5
|
+
import './assets/css/styles.css';
|
|
6
6
|
import App from './App.vue';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
bootstrap(App, {
|
|
9
9
|
plugins: [
|
|
10
10
|
i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
|
|
11
|
-
soukai({ models: import.meta.glob('@/models/*', { eager: true }) }),
|
|
11
|
+
soukai({ models: import.meta.glob(['@/models/*', '!**/*.test.ts'], { eager: true }) }),
|
|
12
12
|
],
|
|
13
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
|
};
|
|
@@ -3,22 +3,27 @@ import Components from 'unplugin-vue-components/vite';
|
|
|
3
3
|
import I18n from '@intlify/unplugin-vue-i18n/vite';
|
|
4
4
|
import Icons from 'unplugin-icons/vite';
|
|
5
5
|
import IconsResolver from 'unplugin-icons/resolver';
|
|
6
|
+
import { defineConfig } from 'vitest/config';
|
|
6
7
|
import { resolve } from 'path';
|
|
7
8
|
|
|
8
|
-
export default {
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
publicDir: resolve(__dirname, './src/assets/public/'),
|
|
9
11
|
plugins: [
|
|
10
|
-
Aerogel(),
|
|
12
|
+
Aerogel({ name: '<% app.name %>' }),
|
|
11
13
|
Components({
|
|
12
|
-
dirs: ['src/pages'],
|
|
13
14
|
dts: false,
|
|
14
15
|
resolvers: [AerogelResolver(), IconsResolver()],
|
|
15
16
|
}),
|
|
16
17
|
I18n({ include: resolve(__dirname, './src/lang/**/*.yaml') }),
|
|
17
|
-
Icons(
|
|
18
|
+
Icons({
|
|
19
|
+
iconCustomizer(_, __, props) {
|
|
20
|
+
props['aria-hidden'] = 'true';
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
18
23
|
],
|
|
19
24
|
resolve: {
|
|
20
25
|
alias: {
|
|
21
26
|
'@': resolve(__dirname, './src'),
|
|
22
27
|
},
|
|
23
28
|
},
|
|
24
|
-
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessButton :class="variantClasses" :disabled="disabled">
|
|
3
|
+
<slot />
|
|
4
|
+
</AGHeadlessButton>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { Colors, booleanProp, enumProp, removeInteractiveClasses } from '@aerogel/core';
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
color: enumProp(Colors, Colors.Primary),
|
|
13
|
+
disabled: booleanProp(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const colorClasses = computed(() => {
|
|
17
|
+
switch (props.color) {
|
|
18
|
+
case Colors.Secondary:
|
|
19
|
+
// Add your custom color classes here.
|
|
20
|
+
return '';
|
|
21
|
+
case Colors.Clear:
|
|
22
|
+
// Add your custom color classes here.
|
|
23
|
+
return '';
|
|
24
|
+
case Colors.Danger:
|
|
25
|
+
// Add your custom color classes here.
|
|
26
|
+
return '';
|
|
27
|
+
case Colors.Primary:
|
|
28
|
+
default:
|
|
29
|
+
// Add your custom color classes here.
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const variantClasses = computed(() => {
|
|
35
|
+
if (props.disabled) {
|
|
36
|
+
// Add additional classes for disabled state here.
|
|
37
|
+
return removeInteractiveClasses(colorClasses.value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return colorClasses.value;
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
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="Disabled">
|
|
33
|
+
<<% component.name %> disabled>
|
|
34
|
+
You can't click me
|
|
35
|
+
</<% component.name %>>
|
|
36
|
+
</Variant>
|
|
37
|
+
|
|
38
|
+
<Variant title="Colors" :layout="{ width: '300px' }">
|
|
39
|
+
<div class="flex items-center gap-2">
|
|
40
|
+
<<% component.name %> color="primary">
|
|
41
|
+
Primary
|
|
42
|
+
</<% component.name %>>
|
|
43
|
+
<<% component.name %> color="secondary">
|
|
44
|
+
Secondary
|
|
45
|
+
</<% component.name %>>
|
|
46
|
+
<<% component.name %> color="danger">
|
|
47
|
+
Danger
|
|
48
|
+
</<% component.name %>>
|
|
49
|
+
<<% component.name %> color="clear">
|
|
50
|
+
Clear
|
|
51
|
+
</<% component.name %>>
|
|
52
|
+
</div>
|
|
53
|
+
</Variant>
|
|
54
|
+
</Story>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { Colors } from '@aerogel/core';
|
|
59
|
+
import { invert } from '@noeldemartin/utils';
|
|
60
|
+
import { ref } from 'vue';
|
|
61
|
+
import type { Color } from '@aerogel/core';
|
|
62
|
+
|
|
63
|
+
const content = ref('Click me!');
|
|
64
|
+
const color = ref<Color>(Colors.Primary);
|
|
65
|
+
const colorOptions = invert(Colors);
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.story-<% component.slug %> {
|
|
70
|
+
grid-template-columns: repeat(2, 300px) !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.story-<% component.slug %> .variant-playground,
|
|
74
|
+
.story-<% component.slug %> .variant-colors{
|
|
75
|
+
grid-column: 1 / -1;
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessInput
|
|
3
|
+
ref="$input"
|
|
4
|
+
:name="name"
|
|
5
|
+
:class="className"
|
|
6
|
+
:label="label"
|
|
7
|
+
>
|
|
8
|
+
<AGHeadlessInputInput
|
|
9
|
+
v-bind="attrs"
|
|
10
|
+
type="checkbox"
|
|
11
|
+
/>
|
|
12
|
+
<div v-if="$slots.default">
|
|
13
|
+
<AGHeadlessInputLabel>
|
|
14
|
+
<slot />
|
|
15
|
+
</AGHeadlessInputLabel>
|
|
16
|
+
<AGHeadlessInputError />
|
|
17
|
+
</div>
|
|
18
|
+
</AGHeadlessInput>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { AGHeadlessInputLabel, componentRef, stringProp, useInputAttrs } from '@aerogel/core';
|
|
23
|
+
import type { IAGHeadlessInput } from '@aerogel/core';
|
|
24
|
+
|
|
25
|
+
defineOptions({ inheritAttrs: false });
|
|
26
|
+
defineProps({
|
|
27
|
+
name: stringProp(),
|
|
28
|
+
label: stringProp(),
|
|
29
|
+
inputClass: stringProp(''),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const $input = componentRef<IAGHeadlessInput>();
|
|
33
|
+
const [attrs, className] = useInputAttrs();
|
|
34
|
+
</script>
|