@aerogel/cli 0.0.0-next.47ed8ee3c048720794026e45140e9b700cb428b9 → 0.0.0-next.4b4da752b2ea1e9ee76a4d33a1e616bf87478f69
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/bin/gel +4 -0
- package/dist/aerogel-cli.d.ts +2 -2
- package/dist/aerogel-cli.js +833 -0
- package/dist/aerogel-cli.js.map +1 -0
- package/package.json +27 -33
- package/src/cli.ts +30 -6
- package/src/commands/Command.ts +14 -9
- package/src/commands/create.test.ts +24 -7
- package/src/commands/create.ts +38 -20
- package/src/commands/generate-component.test.ts +62 -4
- package/src/commands/generate-component.ts +181 -28
- package/src/commands/generate-model.test.ts +8 -5
- package/src/commands/generate-model.ts +41 -24
- 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 +15 -0
- package/src/commands/install.test.ts +27 -0
- package/src/commands/install.ts +32 -0
- package/src/lib/App.ts +71 -6
- package/src/lib/Editor.ts +57 -0
- package/src/lib/File.mock.ts +7 -11
- package/src/lib/File.ts +9 -3
- package/src/lib/Log.mock.ts +11 -6
- package/src/lib/Log.test.ts +22 -6
- package/src/lib/Log.ts +43 -27
- package/src/lib/Shell.mock.ts +3 -3
- package/src/lib/Shell.ts +2 -2
- package/src/lib/Template.ts +24 -17
- package/src/lib/utils/app.ts +15 -0
- package/src/lib/utils/edit.ts +44 -0
- package/src/lib/utils/paths.ts +42 -0
- package/src/plugins/Plugin.ts +159 -0
- package/src/plugins/Solid.ts +71 -0
- package/src/plugins/Soukai.ts +19 -0
- package/src/testing/setup.ts +56 -25
- package/templates/app/.github/workflows/ci.yml +16 -4
- package/templates/app/.nvmrc +1 -1
- package/templates/app/.vscode/launch.json +17 -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 +7 -8
- package/templates/app/index.html +5 -4
- package/templates/app/package.json +44 -21
- package/templates/app/src/App.vue +5 -3
- package/templates/app/src/assets/css/main.css +4 -0
- package/templates/app/src/assets/public/robots.txt +2 -0
- package/templates/app/src/main.ts +8 -4
- package/templates/app/src/types/globals.d.ts +0 -1
- package/templates/app/tsconfig.json +3 -9
- package/templates/app/vite.config.ts +18 -8
- 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/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/service/[service.name].ts +8 -0
- package/.eslintrc.js +0 -7
- package/bin/ag +0 -4
- package/dist/aerogel-cli.cjs.js +0 -2
- package/dist/aerogel-cli.cjs.js.map +0 -1
- package/dist/aerogel-cli.esm.js +0 -2
- package/dist/aerogel-cli.esm.js.map +0 -1
- 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/templates/app/postcss.config.js +0 -6
- package/templates/app/src/assets/styles.css +0 -3
- package/templates/app/tailwind.config.js +0 -5
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"jsx": "preserve",
|
|
8
|
-
"noUncheckedIndexedAccess": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"lib": ["esnext", "dom"],
|
|
12
4
|
"baseUrl": ".",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
13
7
|
"paths": {
|
|
14
8
|
"@/*": ["./src/*"]
|
|
15
9
|
}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
+
import { URL, fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
1
3
|
import Aerogel, { AerogelResolver } from '@aerogel/vite';
|
|
2
4
|
import Components from 'unplugin-vue-components/vite';
|
|
3
5
|
import I18n from '@intlify/unplugin-vue-i18n/vite';
|
|
4
|
-
import
|
|
6
|
+
import Icons from 'unplugin-icons/vite';
|
|
7
|
+
import IconsResolver from 'unplugin-icons/resolver';
|
|
8
|
+
import { defineConfig } from 'vitest/config';
|
|
5
9
|
|
|
6
|
-
export default {
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
build: { sourcemap: true },
|
|
12
|
+
publicDir: fileURLToPath(new URL('./src/assets/public/', import.meta.url)),
|
|
7
13
|
plugins: [
|
|
8
|
-
|
|
9
|
-
Aerogel(),
|
|
14
|
+
Aerogel({ name: '<% app.name %>' }),
|
|
10
15
|
Components({
|
|
11
|
-
dirs: ['src/pages'],
|
|
12
16
|
dts: false,
|
|
13
|
-
resolvers: [AerogelResolver()],
|
|
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
|
+
},
|
|
14
24
|
}),
|
|
15
25
|
],
|
|
16
26
|
resolve: {
|
|
17
27
|
alias: {
|
|
18
|
-
'@':
|
|
28
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
19
29
|
},
|
|
20
30
|
},
|
|
21
|
-
};
|
|
31
|
+
});
|
|
@@ -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>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story group="base" :layout="{ type: 'grid' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<AGForm :form="form" class="m-1">
|
|
5
|
+
<<% component.name %> name="accept" :form="form">
|
|
6
|
+
{{ label }}
|
|
7
|
+
</<% component.name %>>
|
|
8
|
+
</AGForm>
|
|
9
|
+
|
|
10
|
+
<template #controls>
|
|
11
|
+
<HstText v-model="label" title="Label" />
|
|
12
|
+
</template>
|
|
13
|
+
</Variant>
|
|
14
|
+
|
|
15
|
+
<Variant title="Default">
|
|
16
|
+
<<% component.name %> class="m-1">
|
|
17
|
+
Accept Terms & Conditions
|
|
18
|
+
</<% component.name %>>
|
|
19
|
+
</Variant>
|
|
20
|
+
|
|
21
|
+
<Variant title="Hover">
|
|
22
|
+
<<% component.name %> class="m-1" input-class=":hover">
|
|
23
|
+
Accept Terms & Conditions
|
|
24
|
+
</<% component.name %>>
|
|
25
|
+
</Variant>
|
|
26
|
+
|
|
27
|
+
<Variant title="Focus">
|
|
28
|
+
<<% component.name %> class="m-1" input-class=":focus :focus-visible">
|
|
29
|
+
Accept Terms & Conditions
|
|
30
|
+
</<% component.name %>>
|
|
31
|
+
</Variant>
|
|
32
|
+
|
|
33
|
+
<Variant title="Error">
|
|
34
|
+
<AGForm :form="errorForm" class="m-1">
|
|
35
|
+
<<% component.name %> name="accept">
|
|
36
|
+
Accept Terms & Conditions
|
|
37
|
+
</<% component.name %>>
|
|
38
|
+
</AGForm>
|
|
39
|
+
</Variant>
|
|
40
|
+
</Story>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { requiredBooleanInput, useForm } from '@aerogel/core';
|
|
45
|
+
import { ref } from 'vue';
|
|
46
|
+
|
|
47
|
+
const form = useForm({ accept: requiredBooleanInput(true) });
|
|
48
|
+
const errorForm = useForm({ accept: requiredBooleanInput() });
|
|
49
|
+
const label = ref('Accept Terms & Conditions');
|
|
50
|
+
|
|
51
|
+
form.submit();
|
|
52
|
+
errorForm.submit();
|
|
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,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessInput v-bind="props">
|
|
3
|
+
<AGHeadlessInputLabel />
|
|
4
|
+
<AGHeadlessInputInput v-bind="attrs" />
|
|
5
|
+
<AGHeadlessInputDescription />
|
|
6
|
+
<AGHeadlessInputError />
|
|
7
|
+
</AGHeadlessInput>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { useInputAttrs, useInputProps } from '@aerogel/core';
|
|
12
|
+
|
|
13
|
+
defineOptions({ inheritAttrs: false });
|
|
14
|
+
|
|
15
|
+
const props = defineProps(useInputProps());
|
|
16
|
+
const [attrs] = useInputAttrs();
|
|
17
|
+
</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,15 @@
|
|
|
1
|
+
import { UIComponents } from '@aerogel/core';
|
|
2
|
+
|
|
3
|
+
import AlertModal from './overrides/AlertModal.vue';
|
|
4
|
+
import ConfirmModal from './overrides/ConfirmModal.vue';
|
|
5
|
+
import ErrorReportModal from './overrides/ErrorReportModal.vue';
|
|
6
|
+
import LoadingModal from './overrides/LoadingModal.vue';
|
|
7
|
+
import SnackbarNotification from './overrides/SnackbarNotification.vue';
|
|
8
|
+
|
|
9
|
+
export const components = {
|
|
10
|
+
[UIComponents.AlertModal]: AlertModal,
|
|
11
|
+
[UIComponents.ConfirmModal]: ConfirmModal,
|
|
12
|
+
[UIComponents.ErrorReportModal]: ErrorReportModal,
|
|
13
|
+
[UIComponents.LoadingModal]: LoadingModal,
|
|
14
|
+
[UIComponents.Snackbar]: SnackbarNotification,
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalWrapper v-slot="{ close }" :title="title" :cancellable="false">
|
|
3
|
+
<AGMarkdown :text="message" :actions="actions" />
|
|
4
|
+
<div class="mt-4 flex flex-row-reverse">
|
|
5
|
+
<AGButton :color="acceptColor" @click="close(true)">
|
|
6
|
+
{{ renderedAcceptText }}
|
|
7
|
+
</AGButton>
|
|
8
|
+
<AGButton v-if="!required" :color="cancelColor" class="mr-2" @click="close(false)">
|
|
9
|
+
{{ renderedCancelText }}
|
|
10
|
+
</AGButton>
|
|
11
|
+
</div>
|
|
12
|
+
</ModalWrapper>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { useConfirmModal, useConfirmModalProps } from '@aerogel/core';
|
|
17
|
+
|
|
18
|
+
const props = defineProps(useConfirmModalProps());
|
|
19
|
+
const { renderedAcceptText, renderedCancelText } = useConfirmModal(props);
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalWrapper>
|
|
3
|
+
<AGErrorReportModalTitle
|
|
4
|
+
:report="report"
|
|
5
|
+
:current-report="activeReportIndex + 1"
|
|
6
|
+
:total-reports="reports.length"
|
|
7
|
+
/>
|
|
8
|
+
<AGButton color="clear" :disabled="activeReportIndex === 0" @click="activeReportIndex--">
|
|
9
|
+
{{ previousReportText }}
|
|
10
|
+
</AGButton>
|
|
11
|
+
<AGButton color="clear" :disabled="activeReportIndex === reports.length - 1" @click="activeReportIndex++">
|
|
12
|
+
{{ nextReportText }}
|
|
13
|
+
</AGButton>
|
|
14
|
+
<AGErrorReportModalButtons :report="report">
|
|
15
|
+
<template
|
|
16
|
+
#default="{ url, handler, iconComponent, description }: IAGErrorReportModalButtonsDefaultSlotProps"
|
|
17
|
+
>
|
|
18
|
+
<AGButton :url="url" :aria-label="description" @click="handler">
|
|
19
|
+
<component :is="iconComponent" />
|
|
20
|
+
{{ description }}
|
|
21
|
+
</AGButton>
|
|
22
|
+
</template>
|
|
23
|
+
</AGErrorReportModalButtons>
|
|
24
|
+
<AGMarkdown v-if="report.description" :text="report.description" />
|
|
25
|
+
<pre v-text="details" />
|
|
26
|
+
</ModalWrapper>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { useErrorReportModal, useErrorReportModalProps } from '@aerogel/core';
|
|
31
|
+
import type { IAGErrorReportModalButtonsDefaultSlotProps } from '@aerogel/core';
|
|
32
|
+
|
|
33
|
+
const props = defineProps(useErrorReportModalProps());
|
|
34
|
+
const { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ModalWrapper :cancellable="false">
|
|
3
|
+
<AGMarkdown :text="renderedMessage" />
|
|
4
|
+
</ModalWrapper>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { useLoadingModal, useLoadingModalProps } from '@aerogel/core';
|
|
9
|
+
|
|
10
|
+
const props = defineProps(useLoadingModalProps());
|
|
11
|
+
const { renderedMessage } = useLoadingModal(props);
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessModal ref="$modal" v-slot="{ close }" v-bind="props">
|
|
3
|
+
<AGHeadlessModalPanel>
|
|
4
|
+
<AGHeadlessModalTitle v-if="title">
|
|
5
|
+
<AGMarkdown :text="title" inline />
|
|
6
|
+
</AGHeadlessModalTitle>
|
|
7
|
+
<slot :close="close" />
|
|
8
|
+
</AGHeadlessModalPanel>
|
|
9
|
+
</AGHeadlessModal>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { ref } from 'vue';
|
|
14
|
+
import { useModalExpose, useModalProps } from '@aerogel/core';
|
|
15
|
+
import type { IAGHeadlessModal, IAGModal } from '@aerogel/core';
|
|
16
|
+
|
|
17
|
+
const props = defineProps(useModalProps());
|
|
18
|
+
const $modal = ref<IAGHeadlessModal>();
|
|
19
|
+
|
|
20
|
+
defineOptions({ inheritAttrs: false });
|
|
21
|
+
defineExpose<IAGModal>(useModalExpose($modal));
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGHeadlessSnackbar :class="colorClasses">
|
|
3
|
+
<AGMarkdown :text="message" inline />
|
|
4
|
+
|
|
5
|
+
<AGButton
|
|
6
|
+
v-for="(action, i) of actions"
|
|
7
|
+
:key="i"
|
|
8
|
+
:color="color"
|
|
9
|
+
@click="activate(action)"
|
|
10
|
+
>
|
|
11
|
+
{{ action.text }}
|
|
12
|
+
</AGButton>
|
|
13
|
+
</AGHeadlessSnackbar>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { computed } from 'vue';
|
|
18
|
+
import { Colors, useSnackbar, useSnackbarProps } from '@aerogel/core';
|
|
19
|
+
|
|
20
|
+
const props = defineProps(useSnackbarProps());
|
|
21
|
+
const { activate } = useSnackbar(props);
|
|
22
|
+
|
|
23
|
+
const colorClasses = computed(() => {
|
|
24
|
+
switch (props.color) {
|
|
25
|
+
case Colors.Danger:
|
|
26
|
+
// Add your custom color classes here.
|
|
27
|
+
return '';
|
|
28
|
+
case Colors.Secondary:
|
|
29
|
+
default:
|
|
30
|
+
// Add your custom color classes here.
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Story :layout="{ type: 'grid', width: '90%' }">
|
|
3
|
+
<Variant title="Playground">
|
|
4
|
+
<div class="flex space-x-3">
|
|
5
|
+
<AGButton @click="$ui.alert(alertTitle, alertMessage)">
|
|
6
|
+
Alert
|
|
7
|
+
</AGButton>
|
|
8
|
+
<AGButton @click="$ui.confirm(confirmTitle, confirmMessage)">
|
|
9
|
+
Confirm
|
|
10
|
+
</AGButton>
|
|
11
|
+
<AGButton @click="$ui.loading(loadingMessage, after({ seconds: loadingDuration }))">
|
|
12
|
+
Loading
|
|
13
|
+
</AGButton>
|
|
14
|
+
<AGButton @click="$ui.showSnackbar(snackbarMessage, snackbarOptions)">
|
|
15
|
+
Snackbar
|
|
16
|
+
</AGButton>
|
|
17
|
+
<AGButton @click="$errors.inspect(errorReports)">
|
|
18
|
+
Error Report
|
|
19
|
+
</AGButton>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<AGAppOverlays />
|
|
23
|
+
|
|
24
|
+
<template #controls>
|
|
25
|
+
<HstText v-model="alertTitle" title="Alert Title" />
|
|
26
|
+
<HstText v-model="alertMessage" title="Alert Message" />
|
|
27
|
+
<HstText v-model="confirmTitle" title="Confirm Title" />
|
|
28
|
+
<HstText v-model="confirmMessage" title="Confirm Message" />
|
|
29
|
+
<HstText v-model="loadingMessage" title="Loading Message" />
|
|
30
|
+
<HstNumber v-model="loadingDuration" title="Loading Duration" />
|
|
31
|
+
<HstText v-model="snackbarMessage" title="Snackbar Message" />
|
|
32
|
+
<HstSelect v-model="snackbarColor" title="Snackbar Color" :options="snackbarColors" />
|
|
33
|
+
<HstText v-model="snackbarAction" title="Snackbar Action" />
|
|
34
|
+
<HstText v-model="errorReportTitle" title="Error Report Title" />
|
|
35
|
+
<HstText v-model="errorReportDescription" title="Error Report Description" />
|
|
36
|
+
</template>
|
|
37
|
+
</Variant>
|
|
38
|
+
</Story>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { computed, ref } from 'vue';
|
|
43
|
+
import { after, invert } from '@noeldemartin/utils';
|
|
44
|
+
import { Colors, SnackbarColors } from '@aerogel/core';
|
|
45
|
+
import type { ErrorReport, ShowSnackbarOptions } from '@aerogel/core';
|
|
46
|
+
|
|
47
|
+
const alertTitle = ref('Something important happened');
|
|
48
|
+
const alertMessage = ref('And here you can read the details...');
|
|
49
|
+
const confirmTitle = ref('Confirmation');
|
|
50
|
+
const confirmMessage = ref('Are you sure?');
|
|
51
|
+
const loadingMessage = ref('Loading...');
|
|
52
|
+
const loadingDuration = ref(3);
|
|
53
|
+
const snackbarMessage = ref('Something happened');
|
|
54
|
+
const snackbarColor = ref(Colors.Secondary);
|
|
55
|
+
const snackbarColors = invert(SnackbarColors);
|
|
56
|
+
const snackbarAction = ref('Ok');
|
|
57
|
+
const snackbarOptions = computed((): ShowSnackbarOptions => {
|
|
58
|
+
if (!snackbarAction.value) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
color: snackbarColor.value,
|
|
64
|
+
actions: [
|
|
65
|
+
{
|
|
66
|
+
text: snackbarAction.value,
|
|
67
|
+
dismiss: true,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
const errorReportTitle = ref('Error');
|
|
73
|
+
const errorReportDescription = ref('Something went wrong!');
|
|
74
|
+
const errorReports = computed((): ErrorReport[] => [
|
|
75
|
+
{
|
|
76
|
+
title: errorReportTitle.value,
|
|
77
|
+
description: errorReportDescription.value,
|
|
78
|
+
details: new Error().stack,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: errorReportTitle.value,
|
|
82
|
+
description: errorReportDescription.value,
|
|
83
|
+
details: new Error().stack,
|
|
84
|
+
},
|
|
85
|
+
]);
|
|
86
|
+
</script>
|
package/.eslintrc.js
DELETED
package/bin/ag
DELETED
package/dist/aerogel-cli.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("commander"),t=require("@babel/runtime/helpers/defineProperty"),s=require("@noeldemartin/utils"),n=require("fs"),i=require("path");require("core-js/modules/esnext.async-iterator.for-each.js"),require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.for-each.js");var r=require("chalk"),a=require("readline");require("core-js/modules/esnext.async-iterator.reduce.js"),require("core-js/modules/esnext.iterator.reduce.js");var o=require("mustache"),c=require("child_process");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js");var d=l(t);var u=s.facade(new class{contains(e,t){return!!this.read(e)?.includes(t)}exists(e){return n.existsSync(e)}read(e){return this.isFile(e)?n.readFileSync(e).toString():null}getFiles(e){const t=n.readdirSync(e,{withFileTypes:!0}),s=[];for(const n of t){const t=i.resolve(e,n.name);n.isDirectory()?s.push(...this.getFiles(t)):s.push(t)}return s}isDirectory(e){return this.exists(e)&&n.lstatSync(e).isDirectory()}isFile(e){return this.exists(e)&&n.lstatSync(e).isFile()}isEmptyDirectory(e){return!!this.isDirectory(e)&&0===this.getFiles(e).length}makeDirectory(e){n.mkdirSync(e,{recursive:!0})}write(e,t){n.existsSync(i.dirname(e))||n.mkdirSync(i.dirname(e),{recursive:!0}),n.writeFileSync(e,t)}});var p=s.facade(new class{constructor(){d.default(this,"renderInfo",r.hex("#00ffff")),d.default(this,"renderSuccess",r.hex("#00ff00")),d.default(this,"renderError",r.hex("#ff0000"))}async animate(e,t){var s=this;const n=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const n=s.renderInfo(s.renderMarkdown(e)+".".repeat(i%4))+t;s.stdout(n)};let i=0;n();const r=setInterval((()=>(i++,n())),1e3),a=await t();return clearInterval(r),n("\n"),a}info(e){s.arrayFrom(e).forEach((e=>{this.log(this.renderInfo(this.renderMarkdown(e)))}))}error(e){s.arrayFrom(e).forEach((e=>{this.log(this.renderError(this.renderMarkdown(e)))}))}fail(e){this.error(e),process.exit(1)}success(e){s.arrayFrom(e).forEach((e=>{this.log(this.renderSuccess(this.renderMarkdown(e)))}))}renderMarkdown(e){const t=s.stringMatchAll(e,/\*\*(.*)\*\*/g);for(const s of t)e=e.replace(s[0],r.bold(s[1]));return e}log(e){s.arrayFrom(e).forEach((e=>console.log(e)))}stdout(e){a.cursorTo(process.stdout,0),a.clearLine(process.stdout,0),process.stdout.write(e)}});class m{static instantiate(e,t,s){return new m(e).instantiate(t,s)}constructor(e){d.default(this,"path",void 0),this.path=e}instantiate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=this.getFilenameReplacements(t),i=[];e=`${e}/`.replace(/\/\//,"/");for(const r of u.getFiles(this.path)){const a=Object.entries(s).reduce(((e,t)=>{let[s,n]=t;return e.replaceAll(s,n)}),r.substring(this.path.length+1)),c=n.readFileSync(r).toString(),l=e+(a.endsWith(".template")?a.slice(0,-9):a);u.write(l,o.render(c,t,void 0,["<%","%>"])),i.push(l)}return i}getFilenameReplacements(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.entries(e).reduce(((e,n)=>{let[i,r]=n;return"object"==typeof r?Object.assign(e,this.getFilenameReplacements(r,`${i}.`)):e[`[${t}${i}]`]=s.toString(r),e}),{})}}function h(e){return i.resolve(__dirname,"../",e)}class f{constructor(e){d.default(this,"name",void 0),this.name=e}create(e){!u.exists(e)||u.isDirectory(e)&&u.isEmptyDirectory(e)||p.fail(`Folder at '${e}' already exists!`),m.instantiate(h("templates/app"),e,{app:{name:this.name,slug:s.stringToSlug(this.name)}})}}class g{static define(e){var t=this;e=e.command(this.command).description(this.description);for(const[t,s]of this.parameters)e=e.argument(`<${t}>`,s);for(const[t,s]of Object.entries(this.options)){const n="string"==typeof s?s:s.description,i="string"==typeof s?"string":s.type??"string";e=e.option("boolean"===i?`--${t}`:`--${t} <${i}>`,n)}e=e.action((function(){for(var e=arguments.length,s=new Array(e),n=0;n<e;n++)s[n]=arguments[n];return t.run.call(t,...s)}))}static async run(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];const n=new this(...t);await n.run()}async run(){}assertAerogelOrDirectory(e){const t=u.read("package.json");if(t?.includes("@aerogel/core"))return;if(e&&u.isDirectory(e))return;const s=e?`${e} folder does not exist.`:"package.json does not contain @aerogel/core.";p.fail(`${s} Are you sure this is an Aerogel app?`)}}d.default(g,"command",""),d.default(g,"description",""),d.default(g,"parameters",[]),d.default(g,"options",{});var y=s.facade(new class{constructor(){d.default(this,"cwd",null)}setWorkingDirectory(e){this.cwd=e}async run(e){await new Promise(((t,s)=>{c.exec(e,{cwd:this.cwd??void 0},(e=>{e?s(e):t()}))}))}});class w extends g{constructor(e,t){super(),d.default(this,"path",void 0),d.default(this,"options",void 0),this.path=e,this.options=t}async run(){const e=this.path,t=this.options.name??"Aerogel App";y.setWorkingDirectory(e),await this.createApp(t,e),await this.installDependencies(),await this.initializeGit(),p.success(["",`That's it! You can start working on **${t}** doing the following:`,` cd ${e}`," npm run dev","","Have fun!"])}async createApp(e,t){p.info(`Creating **${e}**...`),new f(e).create(t)}async installDependencies(){await p.animate("Installing dependencies",(async()=>{await y.run("npm install")}))}async initializeGit(){await p.animate("Initializing git",(async()=>{await y.run("git init"),await y.run("git add ."),await y.run('git commit -m "Start"')}))}}d.default(w,"command","create"),d.default(w,"description","Create AerogelJS app"),d.default(w,"parameters",[["path","Application path"]]),d.default(w,"options",{name:"Application name"});class v extends g{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),d.default(this,"name",void 0),d.default(this,"options",void 0),this.name=e,this.options=t}async run(){this.assertAerogelOrDirectory("src/components"),this.options.story&&this.assertHistoireInstalled(),u.exists(`src/components/${this.name}.vue`)&&p.fail(`${this.name} component already exists!`);const e=m.instantiate(h("templates/component"),"src/components",{component:{name:this.name}});if(this.options.story){const t=m.instantiate(h("templates/component-story"),"src/components",{component:{name:this.name}});e.push(...t)}const t=e.map((e=>`- ${e}`)).join("\n");p.info(`${this.name} component created successfully! The following files were created:\n\n${t}`)}assertHistoireInstalled(){u.exists("src/main.histoire.ts")||p.fail("Histoire is not installed yet!")}}d.default(v,"command","generate:component"),d.default(v,"description","Generate an AerogelJS component"),d.default(v,"parameters",[["name","Component name"]]),d.default(v,"options",{story:{description:"Create component story using Histoire",type:"boolean"}});class x extends g{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),d.default(this,"name",void 0),d.default(this,"options",void 0),this.name=e,this.options=t}async run(){this.assertAerogelOrDirectory("src/models"),u.exists(`src/models/${this.name}.ts`)&&p.fail(`${this.name} model already exists!`),this.assertSoukaiInstalled();const e=m.instantiate(h("templates/model"),"src/models",{model:{name:this.name,fieldsDefinition:this.getFieldsDefinition()},soukaiImports:this.options.fields?"FieldType, defineModelSchema":"defineModelSchema"}).map((e=>`- ${e}`)).join("\n");p.info(`${this.name} model created successfully! The following files were created:\n\n${e}`)}getFieldsDefinition(){if(!this.options.fields)return" //";return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=e.split("\n"),n=t.indent??0;let i=0,r="";for(const e of s){const t=e.trim(),s=0===t.length;if(0===r.length){if(s)continue;i=e.indexOf(t[0]??""),r+=`${" ".repeat(n)}${t}\n`;continue}if(s){r+="\n";continue}const a=e.indexOf(t[0]??"");r+=`${" ".repeat(n+a-i)}${t}\n`}return r.trimEnd()}(this.options.fields.split(",").map((e=>{const[t,n]=e.split(":");return{name:t,type:s.stringToStudlyCase(n??"string")}})).reduce(((e,t)=>e+`\n${t.name}: FieldType.${t.type},`),""),{indent:8})}assertSoukaiInstalled(){u.contains("package.json",'"soukai"')||p.fail("Soukai is not installed yet!")}}d.default(x,"command","generate:model"),d.default(x,"description","Generate an AerogelJS model"),d.default(x,"parameters",[["name","Model name"]]),d.default(x,"options",{fields:"Create model with the given fields"});var $=s.facade(new class{run(t){const s=new e.Command;s.name("ag").description("AerogelJS CLI").version("0.0.0"),w.define(s),v.define(s),x.define(s),s.parse(t)}});exports.CLI=$;
|
|
2
|
-
//# sourceMappingURL=aerogel-cli.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aerogel-cli.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|