@aerogel/cli 0.0.0-next.0d1cf82f9dfbe1d3e7ec5644f85f97a43c8c2334 → 0.0.0-next.0e2d8a67669c6e544c855fc0bbdb8c845fdfb340

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 (63) hide show
  1. package/dist/aerogel-cli.js +292 -349
  2. package/dist/aerogel-cli.js.map +1 -1
  3. package/package.json +3 -2
  4. package/src/cli.ts +0 -2
  5. package/src/commands/create.test.ts +0 -23
  6. package/src/commands/create.ts +4 -8
  7. package/src/commands/generate-component.test.ts +0 -60
  8. package/src/commands/generate-component.ts +3 -79
  9. package/src/commands/install.test.ts +69 -6
  10. package/src/commands/install.ts +21 -6
  11. package/src/lib/App.ts +40 -41
  12. package/src/lib/Editor.ts +0 -1
  13. package/src/lib/File.mock.ts +6 -0
  14. package/src/lib/File.ts +32 -2
  15. package/src/lib/Shell.mock.ts +4 -0
  16. package/src/lib/utils/paths.ts +4 -0
  17. package/src/plugins/LocalFirst.ts +9 -0
  18. package/src/plugins/Plugin.ts +30 -32
  19. package/src/plugins/Solid.ts +8 -15
  20. package/src/plugins/Soukai.ts +6 -5
  21. package/src/testing/setup.ts +6 -0
  22. package/src/utils/package.ts +23 -0
  23. package/src/commands/generate-overrides.ts +0 -85
  24. package/templates/app/.github/workflows/ci.yml +0 -29
  25. package/templates/app/.gitignore.template +0 -2
  26. package/templates/app/.nvmrc +0 -1
  27. package/templates/app/.vscode/launch.json +0 -17
  28. package/templates/app/.vscode/settings.json +0 -10
  29. package/templates/app/cypress/cypress.config.ts +0 -14
  30. package/templates/app/cypress/e2e/app.cy.ts +0 -9
  31. package/templates/app/cypress/support/e2e.ts +0 -1
  32. package/templates/app/cypress/tsconfig.json +0 -11
  33. package/templates/app/index.html +0 -13
  34. package/templates/app/package.json +0 -66
  35. package/templates/app/postcss.config.js +0 -6
  36. package/templates/app/src/App.vue +0 -12
  37. package/templates/app/src/assets/css/main.css +0 -3
  38. package/templates/app/src/assets/public/robots.txt +0 -2
  39. package/templates/app/src/lang/en.yaml +0 -3
  40. package/templates/app/src/main.test.ts +0 -9
  41. package/templates/app/src/main.ts +0 -13
  42. package/templates/app/src/types/globals.d.ts +0 -2
  43. package/templates/app/src/types/shims.d.ts +0 -7
  44. package/templates/app/src/types/ts-reset.d.ts +0 -1
  45. package/templates/app/tailwind.config.js +0 -5
  46. package/templates/app/tsconfig.json +0 -12
  47. package/templates/app/vite.config.ts +0 -31
  48. package/templates/component-button/[component.name].vue +0 -42
  49. package/templates/component-button-story/[component.name].story.vue +0 -77
  50. package/templates/component-checkbox/[component.name].vue +0 -34
  51. package/templates/component-checkbox-story/[component.name].story.vue +0 -63
  52. package/templates/component-input/[component.name].vue +0 -17
  53. package/templates/component-input-story/[component.name].story.vue +0 -63
  54. package/templates/component-story/[component.name].story.vue +0 -7
  55. package/templates/overrides/components/index.ts +0 -15
  56. package/templates/overrides/components/overrides/AlertModal.vue +0 -11
  57. package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
  58. package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
  59. package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
  60. package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
  61. package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
  62. package/templates/overrides-story/Overrides.story.vue +0 -86
  63. package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
@@ -1,34 +1,27 @@
1
1
  import File from '@aerogel/cli/lib/File';
2
2
  import Log from '@aerogel/cli/lib/Log';
3
3
  import Plugin from '@aerogel/cli/plugins/Plugin';
4
- import Shell from '@aerogel/cli/lib/Shell';
5
- import { isLinkedLocalApp } from '@aerogel/cli/lib/utils/app';
6
- import { packagePath } from '@aerogel/cli/lib/utils/paths';
4
+ import { addNpmDependency } from '@aerogel/cli/utils/package';
7
5
  import type { Editor } from '@aerogel/cli/lib/Editor';
8
6
 
9
- export class Solid extends Plugin {
7
+ export default class Solid extends Plugin {
10
8
 
11
9
  constructor() {
12
10
  super('solid');
13
11
  }
14
12
 
15
13
  protected override 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
14
  await this.updateNpmScripts(editor);
23
15
  await this.updateGitIgnore();
24
16
  await super.updateFiles(editor);
25
17
  }
26
18
 
27
- protected override 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.1.6 --save-dev -E');
31
- await super.installNpmDependencies();
19
+ protected override addNpmDependencies(): void {
20
+ addNpmDependency('soukai-solid', 'next');
21
+ addNpmDependency('@noeldemartin/solid-utils', 'next');
22
+ addNpmDependency('@solid/community-server', '7.1.6', true);
23
+
24
+ super.addNpmDependencies();
32
25
  }
33
26
 
34
27
  protected async updateNpmScripts(editor: Editor): Promise<void> {
@@ -1,15 +1,16 @@
1
1
  import Plugin from '@aerogel/cli/plugins/Plugin';
2
- import Shell from '@aerogel/cli/lib/Shell';
2
+ import { addNpmDependency } from '@aerogel/cli/utils/package';
3
3
 
4
- export class Soukai extends Plugin {
4
+ export default class Soukai extends Plugin {
5
5
 
6
6
  constructor() {
7
7
  super('soukai');
8
8
  }
9
9
 
10
- protected override async installNpmDependencies(): Promise<void> {
11
- await Shell.run('npm install soukai@next --save-exact');
12
- await super.installNpmDependencies();
10
+ protected override addNpmDependencies(): void {
11
+ addNpmDependency('soukai', 'next');
12
+
13
+ super.addNpmDependencies();
13
14
  }
14
15
 
15
16
  protected override getBootstrapConfig(): string {
@@ -48,6 +48,12 @@ vi.mock('@aerogel/cli/lib/utils/edit', async () => {
48
48
  };
49
49
  });
50
50
 
51
+ vi.mock('simple-git', () => ({
52
+ simpleGit: () => ({
53
+ clone: () => Promise.resolve(),
54
+ }),
55
+ }));
56
+
51
57
  // TODO find out why these need to be mocked
52
58
  vi.mock('@aerogel/cli/lib/utils/paths', async () => {
53
59
  const original = (await vi.importActual('@aerogel/cli/lib/utils/paths')) as object;
@@ -0,0 +1,23 @@
1
+ import { arraySorted } from '@noeldemartin/utils';
2
+
3
+ import File from '@aerogel/cli/lib/File';
4
+
5
+ export function addNpmDependency(name: string, version: string, development: boolean = false): void {
6
+ const packageJson = (JSON.parse(File.read('package.json') ?? '{}') ?? {}) as {
7
+ dependencies?: Record<string, string>;
8
+ devDependencies?: Record<string, string>;
9
+ };
10
+ const dependencies = (development ? packageJson?.devDependencies : packageJson?.dependencies) ?? {};
11
+ const dependencyNames = arraySorted(Object.keys(dependencies).concat(name));
12
+ const index = dependencyNames.indexOf(name);
13
+ const previousDependency = dependencyNames[index - 1] ?? '';
14
+
15
+ File.replace(
16
+ 'package.json',
17
+ `"${previousDependency}": "${dependencies[previousDependency]}",`,
18
+ `
19
+ "${previousDependency}": "${dependencies[previousDependency]}",
20
+ "${name}": "${version}",
21
+ `,
22
+ );
23
+ }
@@ -1,85 +0,0 @@
1
- import { arrayFrom } from '@noeldemartin/utils';
2
-
3
- import Command from '@aerogel/cli/commands/Command';
4
- import File from '@aerogel/cli/lib/File';
5
- import Log from '@aerogel/cli/lib/Log';
6
- import Template from '@aerogel/cli/lib/Template';
7
- import { templatePath } from '@aerogel/cli/lib/utils/paths';
8
- import type { CommandOptions } from '@aerogel/cli/commands/Command';
9
-
10
- export interface Options {
11
- story?: boolean;
12
- }
13
-
14
- export class GenerateOverridesCommand extends Command {
15
-
16
- protected static override command: string = 'generate:overrides';
17
- protected static override description: string = 'Generate AerogelJS component overrides';
18
-
19
- protected static override options: CommandOptions = {
20
- story: {
21
- description: 'Create overrides story using Histoire',
22
- type: 'boolean',
23
- },
24
- };
25
-
26
- private options: Options;
27
-
28
- constructor(options: Options = {}) {
29
- super();
30
-
31
- this.options = options;
32
- }
33
-
34
- protected override async run(): Promise<void> {
35
- this.assertAerogelOrDirectory('src/components');
36
- this.assertHistoireInstalled();
37
-
38
- const files = new Set<string>();
39
-
40
- await this.createComponents(files);
41
- await this.createStory(files);
42
-
43
- const filesList = arrayFrom(files)
44
- .map((file) => `- ${file}`)
45
- .join('\n');
46
-
47
- Log.info(`Overrides created successfully! The following files were created:\n\n${filesList}`);
48
- Log.info('\nRemember to declare your components in main.ts and main.histoire.ts!');
49
- }
50
-
51
- protected assertHistoireInstalled(): void {
52
- if (!this.options.story) {
53
- return;
54
- }
55
-
56
- if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
57
- Log.fail(`
58
- Histoire is not installed yet! You can install it running:
59
- npx gel install histoire
60
- `);
61
- }
62
- }
63
-
64
- protected async createComponents(files: Set<string>): Promise<void> {
65
- await Log.animate('Creating components', async () => {
66
- if (File.exists('src/components/ModalWrapper.vue')) {
67
- Log.fail('ModalWrapper component already exists!');
68
- }
69
-
70
- Template.instantiate(templatePath('overrides'), 'src').forEach((file) => files.add(file));
71
- });
72
- }
73
-
74
- protected async createStory(files: Set<string>): Promise<void> {
75
- if (!this.options.story) {
76
- return;
77
- }
78
-
79
- await Log.animate('Creating story', async () => {
80
- Template.instantiate(templatePath('overrides-story'), 'src/components/overrides/').forEach((file) =>
81
- files.add(file));
82
- });
83
- }
84
-
85
- }
@@ -1,29 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- ci:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v4
10
- - uses: actions/setup-node@v4
11
- with:
12
- node-version-file: '.nvmrc'
13
- - run: npm ci
14
- - run: npm run lint
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
@@ -1,2 +0,0 @@
1
- /dist
2
- /node_modules
@@ -1 +0,0 @@
1
- v22.9.0
@@ -1,17 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "runtimeVersion": "22.14.0",
7
- "request": "launch",
8
- "name": "Debug Current Test File",
9
- "autoAttachChildProcesses": true,
10
- "skipFiles": ["<node_internals>/**", "**/node_modules/**"],
11
- "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
12
- "args": ["run", "${fileBasenameNoExtension}"],
13
- "smartStep": true,
14
- "console": "integratedTerminal"
15
- }
16
- ]
17
- }
@@ -1,10 +0,0 @@
1
- {
2
- "emeraldwalk.runonsave": {
3
- "commands": [
4
- {
5
- "match": ".*",
6
- "cmd": "npx prettier-eslint ${file} --write"
7
- }
8
- ]
9
- }
10
- }
@@ -1,14 +0,0 @@
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
- });
@@ -1,9 +0,0 @@
1
- describe('App', () => {
2
-
3
- beforeEach(() => cy.visit('/'));
4
-
5
- it('Shows get started link', () => {
6
- cy.see('Get started');
7
- });
8
-
9
- });
@@ -1 +0,0 @@
1
- import '@aerogel/cypress/support';
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node22/tsconfig.json",
3
- "include": ["**/*.ts"],
4
- "compilerOptions": {
5
- "baseUrl": ".",
6
- "module": "ESNext",
7
- "moduleResolution": "Bundler",
8
- "lib": ["DOM"],
9
- "types": ["node", "cypress"]
10
- }
11
- }
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" class="h-full w-full">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{ app.name }}</title>
7
- {{ socialMeta() }}
8
- </head>
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>
11
- <script type="module" src="./src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,66 +0,0 @@
1
- {
2
- "name": "<% app.slug %>",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "build": "vite build",
8
- "cy:dev": "concurrently --kill-others \"npm run test:serve-app\" \"npm run cy:open\"",
9
- "cy:open": "cypress open --config-file ./cypress/cypress.config.ts --e2e --browser chromium",
10
- "cy:run": "cypress run --config-file ./cypress/cypress.config.ts",
11
- "cy:test": "start-server-and-test test:serve-app http-get://localhost:5001 cy:run",
12
- "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\"",
13
- "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\"",
14
- "dev": "vite",
15
- "lint": "noeldemartin-lint src cypress",
16
- "test": "vitest --run",
17
- "test:ci": "vitest --run --reporter verbose",
18
- "test:serve-app": "vite --port 5001 --mode testing"
19
- },
20
- "dependencies": {
21
- "@aerogel/core": "<% &dependencies.aerogelCore %>",
22
- "@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
23
- "@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
24
- "@intlify/unplugin-vue-i18n": "^0.12.2",
25
- "@noeldemartin/utils": "next",
26
- "@tailwindcss/forms": "^0.5.3",
27
- "@tailwindcss/typography": "^0.5.9",
28
- "soukai": "next",
29
- "tailwindcss": "^3.3.2",
30
- "vue": "^3.3.0",
31
- "vue-i18n": "9.3.0-beta.19"
32
- },
33
- "devDependencies": {
34
- "@aerogel/cli": "<% &dependencies.aerogelCli %>",
35
- "@aerogel/cypress": "<% &dependencies.aerogelCypress %>",
36
- "@aerogel/vite": "<% &dependencies.aerogelVite %>",
37
- "@iconify/json": "^2.2.134",
38
- "@noeldemartin/eslint-config-vue": "next",
39
- "@noeldemartin/scripts": "next",
40
- "@total-typescript/ts-reset": "^0.4.2",
41
- "@tsconfig/node22": "^22.0.1",
42
- "@types/node": "^20.3.1",
43
- "@vue/tsconfig": "^0.7.0",
44
- "autoprefixer": "^10.4.14",
45
- "concurrently": "^8.2.0",
46
- "cypress": "^14.2.0",
47
- "start-server-and-test": "^2.0.0",
48
- "typescript": "^5.8.2",
49
- "unplugin-icons": "^0.16.3",
50
- "unplugin-vue-components": "^0.24.1",
51
- "vite": "^6.2.2",
52
- "vitest": "^3.0.9",
53
- "vue-tsc": "^2.2.8"
54
- },
55
- "eslintConfig": {
56
- "extends": [
57
- "@noeldemartin/eslint-config-vue"
58
- ]
59
- },
60
- "prettier": {
61
- "printWidth": 120,
62
- "plugins": [
63
- "prettier-plugin-tailwindcss"
64
- ]
65
- }
66
- }
@@ -1,6 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,12 +0,0 @@
1
- <template>
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>
7
- <a href="https://aerogel.js.org" target="_blank" class="mt-2 underline opacity-75 hover:opacity-100">
8
- {{ $t('home.getStarted') }}
9
- </a>
10
- </main>
11
- </AGAppLayout>
12
- </template>
@@ -1,3 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
@@ -1,2 +0,0 @@
1
- User-agent: *
2
- Disallow:
@@ -1,3 +0,0 @@
1
- home:
2
- title: Aerogel
3
- getStarted: Get started
@@ -1,9 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- describe('App', () => {
4
-
5
- it('works', () => {
6
- expect(true).toBe(true);
7
- });
8
-
9
- });
@@ -1,13 +0,0 @@
1
- import i18n from '@aerogel/plugin-i18n';
2
- import soukai from '@aerogel/plugin-soukai';
3
- import { bootstrap } from '@aerogel/core';
4
-
5
- import './assets/css/main.css';
6
- import App from './App.vue';
7
-
8
- bootstrap(App, {
9
- plugins: [
10
- i18n({ messages: import.meta.glob('@/lang/*.yaml') }),
11
- soukai({ models: import.meta.glob(['@/models/*', '!**/*.test.ts'], { eager: true }) }),
12
- ],
13
- });
@@ -1,2 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vue-i18n" />
@@ -1,7 +0,0 @@
1
- declare module '*.vue' {
2
- import type { ComponentOptions } from 'vue';
3
-
4
- const component: ComponentOptions;
5
-
6
- export default component;
7
- }
@@ -1 +0,0 @@
1
- /// <reference types="@total-typescript/ts-reset" />
@@ -1,5 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: ['./index.html', './src/**/*.{vue,ts}', '<% &contentPath %>'],
4
- plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
5
- };
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "module": "ESNext",
6
- "moduleResolution": "Bundler",
7
- "paths": {
8
- "@/*": ["./src/*"]
9
- }
10
- },
11
- "include": ["src/**/*.ts", "src/**/*.vue"]
12
- }
@@ -1,31 +0,0 @@
1
- import { URL, fileURLToPath } from 'node:url';
2
-
3
- import Aerogel, { AerogelResolver } from '@aerogel/vite';
4
- import Components from 'unplugin-vue-components/vite';
5
- import I18n from '@intlify/unplugin-vue-i18n/vite';
6
- import Icons from 'unplugin-icons/vite';
7
- import IconsResolver from 'unplugin-icons/resolver';
8
- import { defineConfig } from 'vitest/config';
9
-
10
- export default defineConfig({
11
- build: { sourcemap: true },
12
- publicDir: fileURLToPath(new URL('./src/assets/public/', import.meta.url)),
13
- plugins: [
14
- Aerogel({ name: '<% app.name %>' }),
15
- Components({
16
- dts: false,
17
- resolvers: [AerogelResolver(), IconsResolver()],
18
- }),
19
- I18n({ include: fileURLToPath(new URL('./src/lang/**/*.yaml', import.meta.url)) }),
20
- Icons({
21
- iconCustomizer(_, __, props) {
22
- props['aria-hidden'] = 'true';
23
- },
24
- }),
25
- ],
26
- resolve: {
27
- alias: {
28
- '@': fileURLToPath(new URL('./src', import.meta.url)),
29
- },
30
- },
31
- });
@@ -1,42 +0,0 @@
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>
@@ -1,77 +0,0 @@
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>