@aerogel/core 0.0.0-next.bde642c4a8096c5fc3d5e676c2115da23f4bf1d8 → 0.0.0-next.c2e6acc000e97a1020c2e232678563c53884dd0e
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 +1396 -1645
- package/dist/aerogel-core.js +2968 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +27 -37
- package/src/bootstrap/bootstrap.test.ts +4 -7
- package/src/bootstrap/index.ts +25 -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/composition.ts +1 -1
- 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/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +6 -7
- package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
- package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +11 -19
- package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
- package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +7 -9
- 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 +2 -2
- package/src/components/headless/forms/index.ts +2 -12
- package/src/components/headless/index.ts +12 -1
- package/src/components/headless/snackbars/index.ts +3 -3
- package/src/components/index.ts +5 -5
- package/src/components/lib/AGErrorMessage.vue +5 -5
- package/src/components/lib/AGMeasured.vue +3 -2
- package/src/components/lib/AGStartupCrash.vue +8 -8
- package/src/components/lib/index.ts +0 -2
- package/src/components/snackbars/AGSnackbar.vue +10 -8
- 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/{forms/AGForm.vue → ui/Form.vue} +4 -5
- 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/Markdown.vue +62 -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 +16 -0
- package/src/components/utils.ts +106 -9
- package/src/directives/index.ts +9 -5
- package/src/directives/measure.ts +25 -6
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +14 -14
- package/src/errors/JobCancelledError.ts +3 -0
- package/src/errors/index.ts +9 -6
- package/src/errors/utils.ts +17 -1
- package/src/forms/{Form.test.ts → FormController.test.ts} +33 -4
- package/src/forms/{Form.ts → FormController.ts} +46 -25
- package/src/forms/composition.ts +4 -4
- package/src/forms/index.ts +3 -2
- package/src/forms/utils.ts +22 -6
- package/src/forms/validation.ts +19 -0
- package/src/index.css +8 -0
- package/src/jobs/Job.ts +144 -2
- package/src/jobs/index.ts +4 -1
- package/src/jobs/listeners.ts +3 -0
- package/src/jobs/status.ts +4 -0
- package/src/lang/DefaultLangProvider.ts +7 -4
- package/src/lang/Lang.state.ts +1 -1
- package/src/lang/Lang.ts +5 -1
- 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 +13 -4
- package/src/services/App.ts +8 -3
- package/src/services/Cache.ts +1 -1
- package/src/services/Events.ts +15 -5
- package/src/services/Service.ts +116 -53
- package/src/services/Storage.ts +20 -0
- package/src/services/index.ts +11 -5
- package/src/services/utils.ts +18 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/setup.ts +5 -13
- package/src/ui/UI.state.ts +17 -5
- package/src/ui/UI.ts +168 -62
- 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/vdom.ts +31 -0
- package/src/utils/vue.ts +18 -13
- 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/AGInput.vue +0 -40
- package/src/components/headless/forms/AGHeadlessButton.ts +0 -3
- package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
- package/src/components/headless/forms/AGHeadlessInput.ts +0 -33
- package/src/components/headless/forms/AGHeadlessInput.vue +0 -63
- 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/interfaces.ts +0 -24
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/lib/AGMarkdown.vue +0 -41
- package/src/components/modals/AGAlertModal.ts +0 -15
- package/src/components/modals/AGAlertModal.vue +0 -14
- package/src/components/modals/AGConfirmModal.ts +0 -33
- 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 -36
- 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 -17
- /package/src/components/{AGAppSnackbars.vue → AppSnackbars.vue} +0 -0
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AGHeadlessSnackbar class="flex flex-row items-center justify-center gap-3 p-4" :class="styleClasses">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
3
|
+
<Markdown :text="message" inline />
|
|
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
|
-
import
|
|
24
|
+
import Markdown from '../ui/Markdown.vue';
|
|
24
25
|
|
|
25
26
|
const props = defineProps(useSnackbarProps());
|
|
26
27
|
const { activate } = useSnackbar(props);
|
|
@@ -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
|
+
<Markdown :text="message" />
|
|
4
|
+
</Modal>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import Modal from '@aerogel/core/components/ui/Modal.vue';
|
|
9
|
+
import Markdown from '@aerogel/core/components/ui/Markdown.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
|
+
<Markdown :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 Markdown from '@aerogel/core/components/ui/Markdown.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
|
+
<Markdown 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 Markdown from '@aerogel/core/components/ui/Markdown.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
|
+
<Markdown :text="text" inline />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from 'vue';
|
|
7
|
+
|
|
8
|
+
import Markdown from '@aerogel/core/components/ui/Markdown.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>
|
|
@@ -7,19 +7,18 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { provide, watchEffect } from 'vue';
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import type Form from '@/forms/Form';
|
|
10
|
+
import type FormController from '@aerogel/core/forms/FormController';
|
|
12
11
|
|
|
13
12
|
let offSubmit: (() => void) | undefined;
|
|
14
|
-
const
|
|
13
|
+
const { form } = defineProps<{ form?: FormController }>();
|
|
15
14
|
const emit = defineEmits<{ submit: [] }>();
|
|
16
15
|
|
|
17
16
|
watchEffect((onCleanup) => {
|
|
18
17
|
offSubmit?.();
|
|
19
|
-
offSubmit =
|
|
18
|
+
offSubmit = form?.on('submit', () => emit('submit'));
|
|
20
19
|
|
|
21
20
|
onCleanup(() => offSubmit?.());
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
provide('form',
|
|
23
|
+
provide('form', form);
|
|
25
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
|
+
<Markdown :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 Markdown from '@aerogel/core/components/ui/Markdown.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>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<root />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, h, useAttrs } from 'vue';
|
|
7
|
+
import { isInstanceOf } from '@noeldemartin/utils';
|
|
8
|
+
import type { VNode } from 'vue';
|
|
9
|
+
|
|
10
|
+
import { renderMarkdown } from '@aerogel/core/utils/markdown';
|
|
11
|
+
import { translate } from '@aerogel/core/lang';
|
|
12
|
+
import { renderNode } from '@aerogel/core/utils/vdom';
|
|
13
|
+
|
|
14
|
+
const { as, inline, langKey, langParams, text, actions } = defineProps<{
|
|
15
|
+
as?: string;
|
|
16
|
+
inline?: boolean;
|
|
17
|
+
langKey?: string;
|
|
18
|
+
langParams?: number | Record<string, unknown>;
|
|
19
|
+
text?: string;
|
|
20
|
+
actions?: Record<string, () => unknown>;
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
const attrs = useAttrs();
|
|
24
|
+
const slots = defineSlots<{ default?(): VNode[] }>();
|
|
25
|
+
const markdown = computed(() => {
|
|
26
|
+
if (slots.default) {
|
|
27
|
+
return slots.default().map(renderNode).join('');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return text ?? (langKey && translate(langKey, langParams ?? {}));
|
|
31
|
+
});
|
|
32
|
+
const html = computed(() => {
|
|
33
|
+
if (!markdown.value) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let renderedHtml = renderMarkdown(markdown.value);
|
|
38
|
+
|
|
39
|
+
if (inline) {
|
|
40
|
+
renderedHtml = renderedHtml.replace('<p>', '<span>').replace('</p>', '</span>');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return renderedHtml;
|
|
44
|
+
});
|
|
45
|
+
const root = () =>
|
|
46
|
+
h(as ?? (inline ? 'span' : 'div'), {
|
|
47
|
+
innerHTML: html.value,
|
|
48
|
+
onClick,
|
|
49
|
+
...attrs,
|
|
50
|
+
class: `${attrs.class ?? ''} ${inline ? '' : 'prose'}`,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
async function onClick(event: Event) {
|
|
54
|
+
const { target } = event;
|
|
55
|
+
|
|
56
|
+
if (isInstanceOf(target, HTMLElement) && target.dataset.markdownAction) {
|
|
57
|
+
actions?.[target.dataset.markdownAction]?.();
|
|
58
|
+
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HeadlessModal v-slot="{ close }" :persistent="persistent" v-bind="props">
|
|
3
|
+
<HeadlessModalOverlay class="fixed inset-0 bg-gray-500/75" />
|
|
4
|
+
|
|
5
|
+
<HeadlessModalContent :class="renderedWrapperClass">
|
|
6
|
+
<div v-if="!persistent" class="absolute top-0 right-0 hidden pt-1.5 pr-1.5 sm:block">
|
|
7
|
+
<Button variant="ghost" size="icon" @click="close()">
|
|
8
|
+
<span class="sr-only">{{ $td('ui.close', 'Close') }}</span>
|
|
9
|
+
<IconClose class="size-3 text-gray-400" />
|
|
10
|
+
</Button>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<HeadlessModalTitle v-if="title" class="text-base font-semibold text-gray-900">
|
|
14
|
+
<Markdown :text="title" inline />
|
|
15
|
+
</HeadlessModalTitle>
|
|
16
|
+
|
|
17
|
+
<div :class="renderedContentClass">
|
|
18
|
+
<slot :close="close" />
|
|
19
|
+
</div>
|
|
20
|
+
</HeadlessModalContent>
|
|
21
|
+
</HeadlessModal>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import IconClose from '~icons/zondicons/close';
|
|
26
|
+
|
|
27
|
+
import { computed } from 'vue';
|
|
28
|
+
import type { HTMLAttributes } from 'vue';
|
|
29
|
+
|
|
30
|
+
import Markdown from '@aerogel/core/components/ui/Markdown.vue';
|
|
31
|
+
import HeadlessModal from '@aerogel/core/components/headless/HeadlessModal.vue';
|
|
32
|
+
import HeadlessModalContent from '@aerogel/core/components/headless/HeadlessModalContent.vue';
|
|
33
|
+
import HeadlessModalOverlay from '@aerogel/core/components/headless/HeadlessModalOverlay.vue';
|
|
34
|
+
import HeadlessModalTitle from '@aerogel/core/components/headless/HeadlessModalTitle.vue';
|
|
35
|
+
import { classes } from '@aerogel/core/components/utils';
|
|
36
|
+
import type { ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
class: contentClass = '',
|
|
40
|
+
wrapperClass = '',
|
|
41
|
+
title,
|
|
42
|
+
persistent,
|
|
43
|
+
...props
|
|
44
|
+
} = defineProps<ModalProps & { wrapperClass?: HTMLAttributes['class']; class?: HTMLAttributes['class'] }>();
|
|
45
|
+
|
|
46
|
+
defineSlots<ModalSlots>();
|
|
47
|
+
|
|
48
|
+
const renderedContentClass = computed(() => classes({ 'mt-2': title }, contentClass));
|
|
49
|
+
const renderedWrapperClass = computed(() =>
|
|
50
|
+
classes(
|
|
51
|
+
// eslint-disable-next-line vue/max-len
|
|
52
|
+
'fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl sm:max-w-lg',
|
|
53
|
+
wrapperClass,
|
|
54
|
+
));
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="modal.component" v-bind="modalProperties" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, provide, toRef, unref } from 'vue';
|
|
7
|
+
|
|
8
|
+
import type { UIModal, UIModalContext } from '@aerogel/core/ui/UI.state';
|
|
9
|
+
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
modal: UIModal;
|
|
13
|
+
childIndex?: number;
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const modalProperties = computed(() => {
|
|
17
|
+
const properties = {} as typeof props.modal.properties;
|
|
18
|
+
|
|
19
|
+
for (const property in props.modal.properties) {
|
|
20
|
+
properties[property] = unref(props.modal.properties[property]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return properties;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
provide<AcceptRefs<UIModalContext>>('modal', {
|
|
27
|
+
modal: toRef(props, 'modal'),
|
|
28
|
+
childIndex: toRef(props, 'childIndex'),
|
|
29
|
+
});
|
|
30
|
+
</script>
|