@aerogel/core 0.0.0-next.b18f4e0acd39431045c2f444c711303890143193 → 0.0.0-next.b3caf219a503ce9b8c65ef1463132c9507f56c0a
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-core.d.ts +1516 -1471
- package/dist/aerogel-core.js +2960 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +27 -37
- package/src/bootstrap/bootstrap.test.ts +4 -8
- package/src/bootstrap/index.ts +26 -16
- package/src/bootstrap/options.ts +1 -1
- package/src/components/{AGAppLayout.vue → AppLayout.vue} +4 -4
- package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
- package/src/components/{AGAppOverlays.vue → AppOverlays.vue} +5 -5
- package/src/components/{AGAppSnackbars.vue → AppSnackbars.vue} +1 -1
- package/src/components/composition.ts +23 -0
- package/src/components/contracts/AlertModal.ts +4 -0
- package/src/components/contracts/Button.ts +15 -0
- package/src/components/contracts/ConfirmModal.ts +41 -0
- package/src/components/contracts/ErrorReportModal.ts +29 -0
- package/src/components/contracts/Input.ts +26 -0
- package/src/components/contracts/LoadingModal.ts +18 -0
- package/src/components/contracts/Modal.ts +9 -0
- package/src/components/contracts/PromptModal.ts +28 -0
- package/src/components/contracts/index.ts +7 -0
- package/src/components/contracts/shared.ts +9 -0
- package/src/components/forms/AGSelect.vue +11 -17
- package/src/components/forms/index.ts +0 -4
- package/src/components/headless/HeadlessButton.vue +45 -0
- package/src/components/headless/HeadlessInput.vue +59 -0
- package/src/components/headless/HeadlessInputDescription.vue +27 -0
- package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
- package/src/components/headless/HeadlessInputInput.vue +75 -0
- package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
- package/src/components/headless/HeadlessInputTextArea.vue +40 -0
- package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +16 -18
- package/src/components/headless/HeadlessModalContent.vue +24 -0
- package/src/components/headless/HeadlessModalOverlay.vue +12 -0
- package/src/components/headless/HeadlessModalTitle.vue +12 -0
- package/src/components/headless/forms/AGHeadlessSelect.ts +3 -3
- package/src/components/headless/forms/AGHeadlessSelect.vue +16 -16
- package/src/components/headless/forms/AGHeadlessSelectError.vue +2 -2
- package/src/components/headless/forms/AGHeadlessSelectOption.vue +10 -18
- package/src/components/headless/forms/AGHeadlessSelectOptions.vue +19 -0
- package/src/components/headless/forms/AGHeadlessSelectTrigger.vue +25 -0
- package/src/components/headless/forms/composition.ts +10 -0
- package/src/components/headless/forms/index.ts +3 -9
- package/src/components/headless/index.ts +12 -1
- package/src/components/headless/snackbars/index.ts +3 -3
- package/src/components/index.ts +6 -4
- package/src/components/lib/AGErrorMessage.vue +4 -4
- package/src/components/lib/AGMarkdown.vue +24 -6
- package/src/components/lib/AGMeasured.vue +3 -2
- package/src/components/lib/AGStartupCrash.vue +6 -6
- package/src/components/lib/index.ts +0 -1
- package/src/components/snackbars/AGSnackbar.vue +8 -6
- package/src/components/ui/AlertModal.vue +13 -0
- package/src/components/ui/Button.vue +58 -0
- package/src/components/ui/Checkbox.vue +49 -0
- package/src/components/ui/ConfirmModal.vue +42 -0
- package/src/components/ui/ErrorReportModal.vue +62 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +29 -20
- package/src/components/ui/ErrorReportModalTitle.vue +24 -0
- package/src/components/ui/Form.vue +24 -0
- package/src/components/ui/Input.vue +52 -0
- package/src/components/ui/Link.vue +12 -0
- package/src/components/ui/LoadingModal.vue +32 -0
- package/src/components/ui/Modal.vue +55 -0
- package/src/components/ui/ModalContext.vue +30 -0
- package/src/components/ui/ProgressBar.vue +50 -0
- package/src/components/ui/PromptModal.vue +35 -0
- package/src/components/ui/index.ts +15 -0
- package/src/components/utils.ts +106 -9
- package/src/directives/index.ts +11 -5
- package/src/directives/measure.ts +34 -6
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +25 -28
- package/src/errors/JobCancelledError.ts +3 -0
- package/src/errors/index.ts +10 -16
- package/src/errors/utils.ts +35 -0
- package/src/forms/{Form.test.ts → FormController.test.ts} +33 -4
- package/src/forms/{Form.ts → FormController.ts} +85 -25
- package/src/forms/composition.ts +4 -4
- package/src/forms/index.ts +3 -1
- package/src/forms/utils.ts +36 -5
- package/src/forms/validation.ts +19 -0
- package/src/index.css +8 -0
- package/src/{main.ts → index.ts} +3 -0
- package/src/jobs/Job.ts +147 -0
- package/src/jobs/index.ts +10 -0
- package/src/jobs/listeners.ts +3 -0
- package/src/jobs/status.ts +4 -0
- package/src/lang/DefaultLangProvider.ts +46 -0
- package/src/lang/Lang.state.ts +11 -0
- package/src/lang/Lang.ts +44 -29
- package/src/lang/index.ts +8 -6
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/index.ts +10 -7
- package/src/services/App.state.ts +27 -4
- package/src/services/App.ts +12 -4
- package/src/services/Cache.ts +43 -0
- package/src/services/Events.test.ts +39 -0
- package/src/services/Events.ts +112 -32
- package/src/services/Service.ts +150 -55
- package/src/services/Storage.ts +20 -0
- package/src/services/index.ts +14 -5
- package/src/services/store.ts +8 -5
- package/src/services/utils.ts +18 -0
- package/src/testing/index.ts +26 -0
- package/src/testing/setup.ts +11 -0
- package/src/ui/UI.state.ts +17 -5
- package/src/ui/UI.ts +176 -60
- package/src/ui/index.ts +17 -16
- package/src/ui/utils.ts +16 -0
- package/src/utils/composition/events.ts +2 -2
- package/src/utils/composition/forms.ts +4 -3
- package/src/utils/composition/persistent.test.ts +33 -0
- package/src/utils/composition/persistent.ts +11 -0
- package/src/utils/composition/state.test.ts +47 -0
- package/src/utils/composition/state.ts +24 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/markdown.test.ts +50 -0
- package/src/utils/markdown.ts +19 -6
- package/src/utils/vue.ts +22 -15
- package/dist/aerogel-core.cjs.js +0 -2
- package/dist/aerogel-core.cjs.js.map +0 -1
- package/dist/aerogel-core.esm.js +0 -2
- package/dist/aerogel-core.esm.js.map +0 -1
- package/histoire.config.ts +0 -7
- package/noeldemartin.config.js +0 -5
- package/postcss.config.js +0 -6
- package/src/assets/histoire.css +0 -3
- package/src/components/forms/AGButton.vue +0 -44
- package/src/components/forms/AGCheckbox.vue +0 -41
- package/src/components/forms/AGForm.vue +0 -26
- package/src/components/forms/AGInput.vue +0 -38
- package/src/components/headless/forms/AGHeadlessButton.vue +0 -51
- package/src/components/headless/forms/AGHeadlessInput.ts +0 -28
- package/src/components/headless/forms/AGHeadlessInput.vue +0 -57
- package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -45
- package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -34
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
- package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
- package/src/components/headless/modals/index.ts +0 -4
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/modals/AGAlertModal.ts +0 -15
- package/src/components/modals/AGAlertModal.vue +0 -14
- package/src/components/modals/AGConfirmModal.ts +0 -27
- package/src/components/modals/AGConfirmModal.vue +0 -26
- package/src/components/modals/AGErrorReportModal.ts +0 -46
- package/src/components/modals/AGErrorReportModal.vue +0 -54
- package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
- package/src/components/modals/AGLoadingModal.ts +0 -23
- package/src/components/modals/AGLoadingModal.vue +0 -15
- package/src/components/modals/AGModal.ts +0 -10
- package/src/components/modals/AGModal.vue +0 -39
- package/src/components/modals/AGModalContext.ts +0 -8
- package/src/components/modals/AGModalContext.vue +0 -22
- package/src/components/modals/AGModalTitle.vue +0 -9
- package/src/components/modals/AGPromptModal.ts +0 -30
- package/src/components/modals/AGPromptModal.vue +0 -34
- package/src/components/modals/index.ts +0 -17
- package/src/directives/initial-focus.ts +0 -11
- package/src/main.histoire.ts +0 -1
- package/tailwind.config.js +0 -4
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
|
-
import { computed, h } from 'vue';
|
|
6
|
+
import { computed, h, useAttrs } from 'vue';
|
|
7
|
+
import { isInstanceOf } from '@noeldemartin/utils';
|
|
7
8
|
|
|
8
|
-
import { renderMarkdown } from '
|
|
9
|
-
import { booleanProp, objectProp, stringProp } from '
|
|
10
|
-
import { translate } from '
|
|
9
|
+
import { renderMarkdown } from '@aerogel/core/utils/markdown';
|
|
10
|
+
import { booleanProp, mixedProp, objectProp, stringProp } from '@aerogel/core/utils/vue';
|
|
11
|
+
import { translate } from '@aerogel/core/lang';
|
|
11
12
|
|
|
12
13
|
const props = defineProps({
|
|
13
14
|
as: stringProp(),
|
|
14
15
|
inline: booleanProp(),
|
|
15
16
|
langKey: stringProp(),
|
|
16
|
-
langParams:
|
|
17
|
+
langParams: mixedProp<number | Record<string, unknown>>(),
|
|
17
18
|
text: stringProp(),
|
|
19
|
+
actions: objectProp<Record<string, () => unknown>>(),
|
|
18
20
|
});
|
|
19
21
|
|
|
22
|
+
const attrs = useAttrs();
|
|
20
23
|
const markdown = computed(() => props.text ?? (props.langKey && translate(props.langKey, props.langParams ?? {})));
|
|
21
24
|
const html = computed(() => {
|
|
22
25
|
if (!markdown.value) {
|
|
@@ -32,5 +35,20 @@ const html = computed(() => {
|
|
|
32
35
|
return renderedHtml;
|
|
33
36
|
});
|
|
34
37
|
const root = () =>
|
|
35
|
-
h(props.as ?? (props.inline ? 'span' : 'div'), {
|
|
38
|
+
h(props.as ?? (props.inline ? 'span' : 'div'), {
|
|
39
|
+
innerHTML: html.value,
|
|
40
|
+
onClick,
|
|
41
|
+
...attrs,
|
|
42
|
+
class: `${attrs.class ?? ''} ${props.inline ? '' : 'prose'}`,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
async function onClick(event: Event) {
|
|
46
|
+
const { target } = event;
|
|
47
|
+
|
|
48
|
+
if (isInstanceOf(target, HTMLElement) && target.dataset.markdownAction) {
|
|
49
|
+
props.actions?.[target.dataset.markdownAction]?.();
|
|
50
|
+
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
36
54
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="as" v-measure="() => (measured = true)" :class="{ '!
|
|
2
|
+
<component :is="as" v-measure="() => (measured = true)" :class="{ 'invisible! absolute! w-auto!': !measured }">
|
|
3
3
|
<slot />
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { ref } from 'vue';
|
|
9
9
|
|
|
10
|
-
import { stringProp } from '
|
|
10
|
+
import { stringProp } from '@aerogel/core/utils/vue';
|
|
11
11
|
|
|
12
12
|
defineProps({ as: stringProp('span') });
|
|
13
13
|
|
|
14
|
+
// TODO use v-measure.css
|
|
14
15
|
const measured = ref(false);
|
|
15
16
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="grid
|
|
2
|
+
<div class="grid grow place-items-center">
|
|
3
3
|
<div class="flex flex-col items-center space-y-6 p-8">
|
|
4
4
|
<h1 class="mt-2 text-center text-4xl font-medium text-red-600">
|
|
5
5
|
{{ $td('startupCrash.title', 'Something went wrong!') }}
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
class="mt-4 text-center"
|
|
15
15
|
/>
|
|
16
16
|
<div class="mt-4 flex flex-col space-y-4">
|
|
17
|
-
<
|
|
17
|
+
<Button variant="danger" @click="$app.reload()">
|
|
18
18
|
{{ $td('startupCrash.reload', 'Try again') }}
|
|
19
|
-
</
|
|
20
|
-
<
|
|
19
|
+
</Button>
|
|
20
|
+
<Button variant="danger" @click="$errors.inspect($errors.startupErrors)">
|
|
21
21
|
{{ $td('startupCrash.inspect', 'View error details') }}
|
|
22
|
-
</
|
|
22
|
+
</Button>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
29
|
import AGMarkdown from './AGMarkdown.vue';
|
|
30
|
-
import
|
|
30
|
+
import Button from '../ui/Button.vue';
|
|
31
31
|
</script>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as AGErrorMessage } from './AGErrorMessage.vue';
|
|
2
|
-
export { default as AGLink } from './AGLink.vue';
|
|
3
2
|
export { default as AGMarkdown } from './AGMarkdown.vue';
|
|
4
3
|
export { default as AGMeasured } from './AGMeasured.vue';
|
|
5
4
|
export { default as AGStartupCrash } from './AGStartupCrash.vue';
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AGHeadlessSnackbar class="flex flex-row items-center justify-center gap-3 p-4" :class="styleClasses">
|
|
3
3
|
<AGMarkdown :text="message" inline />
|
|
4
|
-
<
|
|
4
|
+
<Button
|
|
5
5
|
v-for="(action, i) of actions"
|
|
6
6
|
:key="i"
|
|
7
|
-
:
|
|
7
|
+
:variant="colorVariant"
|
|
8
8
|
@click="activate(action)"
|
|
9
9
|
>
|
|
10
10
|
{{ action.text }}
|
|
11
|
-
</
|
|
11
|
+
</Button>
|
|
12
12
|
</AGHeadlessSnackbar>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import { computed } from 'vue';
|
|
17
17
|
|
|
18
|
-
import { Colors } from '
|
|
19
|
-
import { useSnackbar, useSnackbarProps } from '
|
|
18
|
+
import { Colors } from '@aerogel/core/components/constants';
|
|
19
|
+
import { useSnackbar, useSnackbarProps } from '@aerogel/core/components/headless/snackbars';
|
|
20
|
+
import type { ButtonVariant } from '@aerogel/core/components/contracts/Button';
|
|
20
21
|
|
|
21
|
-
import
|
|
22
|
+
import Button from '../ui/Button.vue';
|
|
22
23
|
import AGHeadlessSnackbar from '../headless/snackbars/AGHeadlessSnackbar.vue';
|
|
23
24
|
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
24
25
|
|
|
@@ -33,4 +34,5 @@ const styleClasses = computed(() => {
|
|
|
33
34
|
return 'bg-gray-900 text-white';
|
|
34
35
|
}
|
|
35
36
|
});
|
|
37
|
+
const colorVariant = computed(() => props.color as ButtonVariant);
|
|
36
38
|
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :title="title">
|
|
3
|
+
<AGMarkdown :text="message" />
|
|
4
|
+
</Modal>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
9
|
+
import AGMarkdown from '@aerogel/core/components/lib/AGMarkdown.vue';
|
|
10
|
+
import type { AlertModalProps } from '@aerogel/core/components/contracts/AlertModal';
|
|
11
|
+
|
|
12
|
+
defineProps<AlertModalProps>();
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessButton :class="renderedClasses" v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</HeadlessButton>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import HeadlessButton from '@aerogel/core/components/headless/HeadlessButton.vue';
|
|
9
|
+
import { computedVariantClasses } from '@aerogel/core/components/utils';
|
|
10
|
+
import type { ButtonProps } from '@aerogel/core/components/contracts/Button';
|
|
11
|
+
import type { Variants } from '@aerogel/core/components/utils';
|
|
12
|
+
|
|
13
|
+
const { class: baseClasses, size, variant, ...props } = defineProps<ButtonProps>();
|
|
14
|
+
|
|
15
|
+
/* eslint-disable vue/max-len */
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
const renderedClasses = computedVariantClasses<Variants<Pick<ButtonProps, 'size' | 'variant'>>>(
|
|
18
|
+
{ baseClasses, variant, size },
|
|
19
|
+
{
|
|
20
|
+
baseClasses: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2',
|
|
21
|
+
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
default: 'bg-primary text-white hover:bg-primary/90 focus-visible:outline-primary',
|
|
24
|
+
secondary: 'bg-background text-gray-900 ring-gray-300 hover:bg-accent',
|
|
25
|
+
danger: 'bg-danger text-white hover:bg-danger/80 focus-visible:outline-danger',
|
|
26
|
+
ghost: 'bg-background hover:bg-accent',
|
|
27
|
+
outline: 'bg-background text-primary ring-primary hover:bg-accent',
|
|
28
|
+
link: 'text-primary hover:underline',
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
small: 'rounded px-2 py-1 text-xs',
|
|
32
|
+
default: 'rounded-md px-2.5 py-1.5 text-sm',
|
|
33
|
+
large: 'rounded-md px-3 py-2 text-base',
|
|
34
|
+
icon: 'rounded-full p-2.5',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{
|
|
39
|
+
variant: ['default', 'secondary', 'danger', 'ghost', 'outline'],
|
|
40
|
+
class: 'font-medium',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
variant: ['default', 'danger'],
|
|
44
|
+
class: 'shadow-sm',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
variant: ['secondary', 'outline'],
|
|
48
|
+
class: 'ring-1 ring-inset',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: 'default',
|
|
53
|
+
size: 'default',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
/* eslint-enable vue/max-len */
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessInput
|
|
3
|
+
ref="$input"
|
|
4
|
+
:class="renderedClasses"
|
|
5
|
+
v-bind="props"
|
|
6
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
7
|
+
>
|
|
8
|
+
<div class="flex h-6 items-center">
|
|
9
|
+
<HeadlessInputInput v-bind="inputAttrs" type="checkbox" :class="renderedInputClasses" />
|
|
10
|
+
</div>
|
|
11
|
+
<div v-if="$slots.default" class="ml-2 text-sm leading-6">
|
|
12
|
+
<HeadlessInputLabel class="text-gray-900">
|
|
13
|
+
<slot />
|
|
14
|
+
</HeadlessInputLabel>
|
|
15
|
+
<HeadlessInputError class="text-sm text-red-600" />
|
|
16
|
+
</div>
|
|
17
|
+
<div v-else-if="label" class="ml-2 text-sm leading-6">
|
|
18
|
+
<HeadlessInputLabel />
|
|
19
|
+
<HeadlessInputError class="text-sm text-red-600" />
|
|
20
|
+
</div>
|
|
21
|
+
</HeadlessInput>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { computed } from 'vue';
|
|
26
|
+
import type { HTMLAttributes } from 'vue';
|
|
27
|
+
|
|
28
|
+
import { classes } from '@aerogel/core/components/utils';
|
|
29
|
+
import { useInputAttrs } from '@aerogel/core/utils/composition/forms';
|
|
30
|
+
import { componentRef } from '@aerogel/core/utils/vue';
|
|
31
|
+
import type { InputEmits, InputExpose, InputProps } from '@aerogel/core/components/contracts/Input';
|
|
32
|
+
|
|
33
|
+
defineOptions({ inheritAttrs: false });
|
|
34
|
+
defineEmits<InputEmits>();
|
|
35
|
+
const { inputClass, ...props } = defineProps<InputProps & { inputClass?: HTMLAttributes['class'] }>();
|
|
36
|
+
|
|
37
|
+
const $input = componentRef<InputExpose>();
|
|
38
|
+
const [inputAttrs, rootClasses] = useInputAttrs();
|
|
39
|
+
const renderedClasses = computed(() => classes('relative flex items-start', rootClasses.value));
|
|
40
|
+
const renderedInputClasses = computed(() =>
|
|
41
|
+
classes(
|
|
42
|
+
'size-4 rounded text-primary hover:bg-gray-200 checked:hover:bg-primary/80 checked:border-0',
|
|
43
|
+
{
|
|
44
|
+
'border-gray-300 focus:ring-primary': !$input.value?.errors,
|
|
45
|
+
'border-red-400 border-2 focus:ring-red-600': $input.value?.errors,
|
|
46
|
+
},
|
|
47
|
+
inputClass,
|
|
48
|
+
));
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal v-slot="{ close }" :title="title" persistent>
|
|
3
|
+
<Form :form="form" @submit="close([true, form.data()])">
|
|
4
|
+
<AGMarkdown :text="message" :actions="actions" />
|
|
5
|
+
|
|
6
|
+
<ul v-if="checkboxes" class="mt-4 flex flex-col text-sm text-gray-600">
|
|
7
|
+
<li v-for="(checkbox, name) of checkboxes" :key="name">
|
|
8
|
+
<label class="flex items-center">
|
|
9
|
+
<input
|
|
10
|
+
v-model="form[name]"
|
|
11
|
+
type="checkbox"
|
|
12
|
+
:required="checkbox.required"
|
|
13
|
+
class="border-primary text-primary hover:bg-primary/10 hover:checked:bg-primary/80 focus:ring-primary focus-visible:ring-primary rounded border-2"
|
|
14
|
+
>
|
|
15
|
+
<span class="ml-1.5">{{ checkbox.label }}</span>
|
|
16
|
+
</label>
|
|
17
|
+
</li>
|
|
18
|
+
</ul>
|
|
19
|
+
|
|
20
|
+
<div class="mt-4 flex flex-row-reverse gap-2">
|
|
21
|
+
<Button :variant="acceptVariant" submit>
|
|
22
|
+
{{ renderedAcceptText }}
|
|
23
|
+
</Button>
|
|
24
|
+
<Button v-if="!required" :variant="cancelVariant" @click="close(false)">
|
|
25
|
+
{{ renderedCancelText }}
|
|
26
|
+
</Button>
|
|
27
|
+
</div>
|
|
28
|
+
</Form>
|
|
29
|
+
</Modal>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import Form from '@aerogel/core/components/ui/Form.vue';
|
|
34
|
+
import AGMarkdown from '@aerogel/core/components/lib/AGMarkdown.vue';
|
|
35
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
36
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
37
|
+
import { useConfirmModal } from '@aerogel/core/components/contracts/ConfirmModal';
|
|
38
|
+
import type { ConfirmModalProps } from '@aerogel/core/components/contracts/ConfirmModal';
|
|
39
|
+
|
|
40
|
+
const { cancelVariant = 'secondary', ...props } = defineProps<ConfirmModalProps>();
|
|
41
|
+
const { form, renderedAcceptText, renderedCancelText } = useConfirmModal(props);
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal wrapper-class="p-0 sm:w-auto sm:min-w-lg sm:max-w-[80vw]">
|
|
3
|
+
<div class="px-4 pt-5 pb-4">
|
|
4
|
+
<h2 class="flex justify-between gap-4">
|
|
5
|
+
<div class="flex items-center gap-2">
|
|
6
|
+
<IconExclamationSolid class="size-5 text-red-600" />
|
|
7
|
+
<ErrorReportModalTitle
|
|
8
|
+
class="text-lg leading-6 font-semibold text-gray-900"
|
|
9
|
+
:report="report"
|
|
10
|
+
:current-report="activeReportIndex + 1"
|
|
11
|
+
:total-reports="reports.length"
|
|
12
|
+
/>
|
|
13
|
+
<span v-if="reports.length > 1" class="flex gap-0.5">
|
|
14
|
+
<Button
|
|
15
|
+
size="icon"
|
|
16
|
+
variant="ghost"
|
|
17
|
+
:disabled="activeReportIndex === 0"
|
|
18
|
+
:aria-label="previousReportText"
|
|
19
|
+
:title="previousReportText"
|
|
20
|
+
@click="activeReportIndex--"
|
|
21
|
+
>
|
|
22
|
+
<IconCheveronLeft class="size-4" />
|
|
23
|
+
</Button>
|
|
24
|
+
<Button
|
|
25
|
+
size="icon"
|
|
26
|
+
variant="ghost"
|
|
27
|
+
:disabled="activeReportIndex === reports.length - 1"
|
|
28
|
+
:aria-label="nextReportText"
|
|
29
|
+
:title="nextReportText"
|
|
30
|
+
@click="activeReportIndex++"
|
|
31
|
+
>
|
|
32
|
+
<IconCheveronRight class="size-4" />
|
|
33
|
+
</Button>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
<ErrorReportModalButtons :report="report" class="gap-0.5" />
|
|
37
|
+
</h2>
|
|
38
|
+
<AGMarkdown v-if="report.description" :text="report.description" class="text-gray-600" />
|
|
39
|
+
</div>
|
|
40
|
+
<div class="-mt-2 max-h-[80vh] overflow-auto bg-red-800/10">
|
|
41
|
+
<pre class="p-4 text-xs text-red-800" v-text="details" />
|
|
42
|
+
</div>
|
|
43
|
+
</Modal>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import IconCheveronLeft from '~icons/zondicons/cheveron-left';
|
|
48
|
+
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
49
|
+
import IconExclamationSolid from '~icons/zondicons/exclamation-solid';
|
|
50
|
+
|
|
51
|
+
import AGMarkdown from '@aerogel/core/components/lib/AGMarkdown.vue';
|
|
52
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
53
|
+
import ErrorReportModalButtons from '@aerogel/core/components/ui/ErrorReportModalButtons.vue';
|
|
54
|
+
import ErrorReportModalTitle from '@aerogel/core/components/ui/ErrorReportModalTitle.vue';
|
|
55
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
56
|
+
import { useErrorReportModal } from '@aerogel/core/components/contracts/ErrorReportModal';
|
|
57
|
+
import type { ErrorReportModalProps } from '@aerogel/core/components/contracts/ErrorReportModal';
|
|
58
|
+
|
|
59
|
+
const props = defineProps<ErrorReportModalProps>();
|
|
60
|
+
|
|
61
|
+
const { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);
|
|
62
|
+
</script>
|
package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue}
RENAMED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex">
|
|
3
|
-
<slot v-for="
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<slot v-for="button of buttons" v-bind="button">
|
|
4
|
+
<Button
|
|
5
|
+
size="icon"
|
|
6
|
+
variant="ghost"
|
|
7
|
+
class="group whitespace-nowrap"
|
|
8
|
+
:href="button.url"
|
|
7
9
|
:title="$td(`errors.report_${button.id}`, button.description)"
|
|
8
|
-
:aria-label="$td(`errors.report_${button.id}`, button.description)"
|
|
9
10
|
@click="button.handler"
|
|
10
11
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
12
|
+
<span class="sr-only">{{ $td(`errors.report_${button.id}`, button.description) }}</span>
|
|
13
|
+
<component :is="button.iconComponent" class="size-4" aria-hidden="true" />
|
|
14
|
+
</Button>
|
|
13
15
|
</slot>
|
|
14
16
|
</div>
|
|
15
17
|
</template>
|
|
@@ -21,20 +23,27 @@ import IconGitHub from '~icons/mdi/github';
|
|
|
21
23
|
|
|
22
24
|
import { computed } from 'vue';
|
|
23
25
|
import { stringExcerpt, tap } from '@noeldemartin/utils';
|
|
26
|
+
import type { Component } from 'vue';
|
|
24
27
|
|
|
25
|
-
import App from '
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import { translateWithDefault } from '
|
|
29
|
-
import type {
|
|
30
|
-
import type { ErrorReport } from '@/errors';
|
|
28
|
+
import App from '@aerogel/core/services/App';
|
|
29
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
30
|
+
import UI from '@aerogel/core/ui/UI';
|
|
31
|
+
import { translateWithDefault } from '@aerogel/core/lang/utils';
|
|
32
|
+
import type { ErrorReport } from '@aerogel/core/errors';
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
interface ErrorReportModalButtonsDefaultSlotProps {
|
|
35
|
+
id: string;
|
|
36
|
+
description: string;
|
|
37
|
+
iconComponent: Component;
|
|
38
|
+
url?: string;
|
|
39
|
+
handler?(): void;
|
|
40
|
+
}
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
42
|
+
defineSlots<{
|
|
43
|
+
default(props: ErrorReportModalButtonsDefaultSlotProps): unknown;
|
|
44
|
+
}>();
|
|
45
|
+
|
|
46
|
+
const props = defineProps<{ report: ErrorReport }>();
|
|
38
47
|
const summary = computed(() =>
|
|
39
48
|
props.report.description ? `${props.report.title}: ${props.report.description}` : props.report.title);
|
|
40
49
|
const githubReportUrl = computed(() => {
|
|
@@ -94,8 +103,8 @@ const buttons = computed(() =>
|
|
|
94
103
|
);
|
|
95
104
|
},
|
|
96
105
|
},
|
|
97
|
-
],
|
|
98
|
-
(reportButtons
|
|
106
|
+
] as ErrorReportModalButtonsDefaultSlotProps[],
|
|
107
|
+
(reportButtons) => {
|
|
99
108
|
if (!githubReportUrl.value) {
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGMarkdown :text="text" inline />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from 'vue';
|
|
7
|
+
|
|
8
|
+
import AGMarkdown from '@aerogel/core/components/lib/AGMarkdown.vue';
|
|
9
|
+
import type { ErrorReport } from '@aerogel/core/errors';
|
|
10
|
+
|
|
11
|
+
const { totalReports, currentReport, report } = defineProps<{
|
|
12
|
+
report: ErrorReport;
|
|
13
|
+
currentReport?: number;
|
|
14
|
+
totalReports?: number;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const text = computed(() => {
|
|
18
|
+
if (!totalReports || totalReports <= 1) {
|
|
19
|
+
return report.title;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return `${report.title} (${currentReport}/${totalReports})`;
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form @submit.prevent="form?.submit()">
|
|
3
|
+
<slot />
|
|
4
|
+
</form>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { provide, watchEffect } from 'vue';
|
|
9
|
+
|
|
10
|
+
import type FormController from '@aerogel/core/forms/FormController';
|
|
11
|
+
|
|
12
|
+
let offSubmit: (() => void) | undefined;
|
|
13
|
+
const { form } = defineProps<{ form?: FormController }>();
|
|
14
|
+
const emit = defineEmits<{ submit: [] }>();
|
|
15
|
+
|
|
16
|
+
watchEffect((onCleanup) => {
|
|
17
|
+
offSubmit?.();
|
|
18
|
+
offSubmit = form?.on('submit', () => emit('submit'));
|
|
19
|
+
|
|
20
|
+
onCleanup(() => offSubmit?.());
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
provide('form', form);
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessInput
|
|
3
|
+
ref="$input"
|
|
4
|
+
:label="label"
|
|
5
|
+
:class="rootClasses"
|
|
6
|
+
v-bind="props"
|
|
7
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
8
|
+
>
|
|
9
|
+
<HeadlessInputLabel class="block text-sm leading-6 font-medium text-gray-900" />
|
|
10
|
+
<div :class="renderedWrapperClasses">
|
|
11
|
+
<HeadlessInputInput v-bind="inputAttrs" :class="renderedInputClasses" />
|
|
12
|
+
<div v-if="$input?.errors" class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
|
|
13
|
+
<IconExclamationSolid class="size-5 text-red-500" />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<HeadlessInputDescription class="mt-2 text-sm text-gray-600" />
|
|
17
|
+
<HeadlessInputError class="mt-2 text-sm text-red-600" />
|
|
18
|
+
</HeadlessInput>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import IconExclamationSolid from '~icons/zondicons/exclamation-solid';
|
|
23
|
+
|
|
24
|
+
import { computed } from 'vue';
|
|
25
|
+
import type { HTMLAttributes } from 'vue';
|
|
26
|
+
|
|
27
|
+
import { classes } from '@aerogel/core/components/utils';
|
|
28
|
+
import { useInputAttrs } from '@aerogel/core/utils/composition/forms';
|
|
29
|
+
import { componentRef } from '@aerogel/core/utils/vue';
|
|
30
|
+
import type { InputEmits, InputExpose, InputProps } from '@aerogel/core/components/contracts/Input';
|
|
31
|
+
|
|
32
|
+
defineOptions({ inheritAttrs: false });
|
|
33
|
+
defineEmits<InputEmits>();
|
|
34
|
+
const { label, inputClass, wrapperClass, ...props } = defineProps<
|
|
35
|
+
InputProps & { inputClass?: HTMLAttributes['class']; wrapperClass?: HTMLAttributes['class'] }
|
|
36
|
+
>();
|
|
37
|
+
const $input = componentRef<InputExpose>();
|
|
38
|
+
const [inputAttrs, rootClasses] = useInputAttrs();
|
|
39
|
+
const renderedWrapperClasses = computed(() =>
|
|
40
|
+
classes('relative rounded-md shadow-2xs', { 'mt-1': label }, wrapperClass));
|
|
41
|
+
const renderedInputClasses = computed(() =>
|
|
42
|
+
classes(
|
|
43
|
+
// eslint-disable-next-line vue/max-len
|
|
44
|
+
'block w-full rounded-md border-0 py-1.5 ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6',
|
|
45
|
+
{
|
|
46
|
+
'text-gray-900 shadow-2xs ring-gray-300 placeholder:text-gray-400': !$input.value?.errors,
|
|
47
|
+
'hover:ring-1 hover:ring-primary/80 hover:ring-inset focus:ring-primary': !$input.value?.errors,
|
|
48
|
+
'pr-10 text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500': $input.value?.errors,
|
|
49
|
+
},
|
|
50
|
+
inputClass,
|
|
51
|
+
));
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Button variant="link" v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</Button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import Button from '@aerogel/core/components/ui/Button.vue';
|
|
9
|
+
import type { ButtonProps } from '@aerogel/core/components/contracts/Button';
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Omit<ButtonProps, 'variant'>>();
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal
|
|
3
|
+
persistent
|
|
4
|
+
class="flex"
|
|
5
|
+
wrapper-class="w-auto"
|
|
6
|
+
:title="title"
|
|
7
|
+
:class="{ 'flex-col-reverse': showProgress, 'items-center justify-center gap-2': !showProgress }"
|
|
8
|
+
>
|
|
9
|
+
<ProgressBar
|
|
10
|
+
v-if="showProgress"
|
|
11
|
+
:progress="progress"
|
|
12
|
+
:job="job"
|
|
13
|
+
class="min-w-[min(400px,80vw)]"
|
|
14
|
+
/>
|
|
15
|
+
<IconSpinner v-else class="text-primary mr-1 size-6" />
|
|
16
|
+
<AGMarkdown :text="renderedMessage" />
|
|
17
|
+
</Modal>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import IconSpinner from '~icons/svg-spinners/90-ring-with-bg';
|
|
22
|
+
|
|
23
|
+
import AGMarkdown from '@aerogel/core/components/lib/AGMarkdown.vue';
|
|
24
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
25
|
+
import ProgressBar from '@aerogel/core/components/ui/ProgressBar.vue';
|
|
26
|
+
import { useLoadingModal } from '@aerogel/core/components/contracts/LoadingModal';
|
|
27
|
+
import type { LoadingModalProps } from '@aerogel/core/components/contracts/LoadingModal';
|
|
28
|
+
|
|
29
|
+
const props = defineProps<LoadingModalProps>();
|
|
30
|
+
|
|
31
|
+
const { renderedMessage, showProgress } = useLoadingModal(props);
|
|
32
|
+
</script>
|