@aerogel/core 0.0.0-next.926bde19326fe7b6b24b277666936862b64d8295 → 0.0.0-next.980a397d575dcb5ff8c5a0bff769d09f938ea03c
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.cjs.js +1 -1
- package/dist/aerogel-core.cjs.js.map +1 -1
- package/dist/aerogel-core.d.ts +958 -128
- package/dist/aerogel-core.esm.js +1 -1
- package/dist/aerogel-core.esm.js.map +1 -1
- package/histoire.config.ts +7 -0
- package/noeldemartin.config.js +4 -1
- package/package.json +14 -4
- package/postcss.config.js +6 -0
- package/src/assets/histoire.css +3 -0
- package/src/bootstrap/bootstrap.test.ts +1 -0
- package/src/bootstrap/index.ts +14 -2
- package/src/components/AGAppLayout.vue +6 -2
- package/src/components/AGAppModals.vue +15 -0
- package/src/components/AGAppOverlays.vue +5 -7
- package/src/components/AGAppSnackbars.vue +13 -0
- package/src/components/constants.ts +8 -0
- package/src/components/forms/AGButton.vue +33 -10
- package/src/components/forms/AGCheckbox.vue +35 -0
- package/src/components/forms/AGInput.vue +8 -4
- package/src/components/forms/AGSelect.story.vue +28 -0
- package/src/components/forms/AGSelect.vue +53 -0
- package/src/components/forms/index.ts +5 -5
- package/src/components/headless/forms/AGHeadlessButton.vue +7 -7
- package/src/components/headless/forms/AGHeadlessInput.ts +27 -2
- package/src/components/headless/forms/AGHeadlessInput.vue +11 -8
- package/src/components/headless/forms/AGHeadlessInputError.vue +1 -1
- package/src/components/headless/forms/AGHeadlessInputInput.vue +15 -3
- package/src/components/headless/forms/AGHeadlessInputLabel.vue +8 -2
- package/src/components/headless/forms/AGHeadlessSelect.ts +44 -0
- package/src/components/headless/forms/AGHeadlessSelect.vue +76 -0
- package/src/components/headless/forms/AGHeadlessSelectButton.vue +24 -0
- package/src/components/headless/forms/AGHeadlessSelectError.vue +26 -0
- package/src/components/headless/forms/AGHeadlessSelectLabel.vue +24 -0
- package/src/components/headless/forms/AGHeadlessSelectOption.ts +4 -0
- package/src/components/headless/forms/AGHeadlessSelectOption.vue +39 -0
- package/src/components/headless/forms/AGHeadlessSelectOptions.ts +3 -0
- package/src/components/headless/forms/index.ts +9 -1
- package/src/components/headless/index.ts +1 -0
- package/src/components/headless/modals/AGHeadlessModal.ts +9 -0
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +5 -1
- package/src/components/headless/modals/index.ts +4 -6
- package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +10 -0
- package/src/components/headless/snackbars/index.ts +25 -0
- package/src/components/index.ts +3 -1
- package/src/components/lib/AGErrorMessage.vue +16 -0
- package/src/components/lib/AGLink.vue +9 -0
- package/src/components/lib/AGMarkdown.vue +36 -0
- package/src/components/lib/AGStartupCrash.vue +31 -0
- package/src/components/lib/index.ts +4 -0
- package/src/components/modals/AGAlertModal.vue +1 -2
- package/src/components/modals/AGConfirmModal.ts +10 -0
- package/src/components/modals/AGConfirmModal.vue +2 -2
- package/src/components/modals/AGErrorReportModal.ts +20 -0
- package/src/components/modals/AGErrorReportModal.vue +62 -0
- package/src/components/modals/AGErrorReportModalButtons.vue +109 -0
- package/src/components/modals/AGErrorReportModalTitle.vue +25 -0
- package/src/components/modals/AGLoadingModal.ts +9 -0
- package/src/components/modals/AGLoadingModal.vue +19 -0
- package/src/components/modals/AGModal.ts +1 -1
- package/src/components/modals/AGModal.vue +23 -4
- package/src/components/modals/AGModalTitle.vue +9 -0
- package/src/components/modals/index.ts +20 -2
- package/src/components/snackbars/AGSnackbar.vue +42 -0
- package/src/components/snackbars/index.ts +3 -0
- package/src/directives/index.ts +16 -3
- package/src/errors/Errors.state.ts +31 -0
- package/src/errors/Errors.ts +183 -0
- package/src/errors/index.ts +55 -0
- package/src/forms/Form.ts +26 -15
- package/src/forms/utils.ts +17 -0
- package/src/lang/Lang.ts +12 -4
- package/src/lang/index.ts +3 -5
- package/src/lang/utils.ts +4 -0
- package/src/main.histoire.ts +1 -0
- package/src/main.ts +1 -2
- package/src/plugins/Plugin.ts +1 -0
- package/src/plugins/index.ts +19 -0
- package/src/services/App.state.ts +10 -2
- package/src/services/App.ts +24 -2
- package/src/services/Service.ts +136 -45
- package/src/services/index.ts +21 -4
- package/src/services/store.ts +27 -0
- package/src/ui/UI.state.ts +11 -1
- package/src/ui/UI.ts +75 -9
- package/src/ui/index.ts +7 -1
- package/src/utils/composition/forms.ts +11 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/markdown.ts +11 -2
- package/src/utils/vue.ts +5 -3
- package/tailwind.config.js +4 -0
- package/tsconfig.json +1 -0
- package/vite.config.ts +2 -1
- package/.eslintrc.js +0 -3
- package/src/components/basic/AGMarkdown.vue +0 -35
- package/src/components/basic/index.ts +0 -3
- package/src/globals.ts +0 -6
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Listbox
|
|
3
|
+
v-slot="{ value, open, disabled }: ComponentProps"
|
|
4
|
+
:model-value="selectedOption?.value"
|
|
5
|
+
@update:model-value="update($event)"
|
|
6
|
+
>
|
|
7
|
+
<slot :value="value" :open="open" :disabled="disabled" />
|
|
8
|
+
</Listbox>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { computed, inject, provide } from 'vue';
|
|
13
|
+
import { isObject, toString, uuid } from '@noeldemartin/utils';
|
|
14
|
+
import { Listbox } from '@headlessui/vue';
|
|
15
|
+
|
|
16
|
+
import { mixedProp } from '@/utils/vue';
|
|
17
|
+
import { translateWithDefault } from '@/lang/utils';
|
|
18
|
+
import type Form from '@/forms/Form';
|
|
19
|
+
import type { ComponentProps } from '@/utils/vue';
|
|
20
|
+
|
|
21
|
+
import { useSelectProps } from './AGHeadlessSelect';
|
|
22
|
+
import type { IAGHeadlessSelect, IAGSelectOption, IAGSelectOptionValue } from './AGHeadlessSelect';
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits(['update:modelValue']);
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
modelValue: mixedProp<IAGSelectOptionValue>(),
|
|
27
|
+
...useSelectProps(),
|
|
28
|
+
});
|
|
29
|
+
const form = inject<Form | null>('form', null);
|
|
30
|
+
const noSelectionText = computed(() => props.noSelectionText ?? translateWithDefault('select.noSelection', '-'));
|
|
31
|
+
const options = computed(() =>
|
|
32
|
+
props.options.map((value) => {
|
|
33
|
+
const option: IAGSelectOption = {
|
|
34
|
+
value,
|
|
35
|
+
text: toString(isObject(value) && 'text' in value ? value.text : value),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return option;
|
|
39
|
+
}));
|
|
40
|
+
const selectedOption = computed(() => {
|
|
41
|
+
const selectedOptionValue = form && props.name ? form.getFieldValue(props.name) : props.modelValue;
|
|
42
|
+
|
|
43
|
+
return options.value.find((option) => option.value === selectedOptionValue);
|
|
44
|
+
});
|
|
45
|
+
const errors = computed(() => {
|
|
46
|
+
if (!form || !props.name) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return form.errors[props.name] ?? null;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function update(value: IAGSelectOptionValue) {
|
|
54
|
+
if (form && props.name) {
|
|
55
|
+
form.setFieldValue(props.name, value);
|
|
56
|
+
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
emit('update:modelValue', value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const api: IAGHeadlessSelect = {
|
|
64
|
+
id: `select-${uuid()}`,
|
|
65
|
+
options,
|
|
66
|
+
noSelectionText,
|
|
67
|
+
selectedOption,
|
|
68
|
+
errors,
|
|
69
|
+
label: computed(() => props.label),
|
|
70
|
+
buttonText: computed(() => selectedOption.value?.text ?? noSelectionText.value),
|
|
71
|
+
update,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
provide<IAGHeadlessSelect>('select', api);
|
|
75
|
+
defineExpose<IAGHeadlessSelect>(api);
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListboxButton v-slot="{ value, open, disabled }: ComponentProps">
|
|
3
|
+
<slot :value="value" :open="open" :disabled="disabled">
|
|
4
|
+
<span :class="textClass">{{ select?.buttonText }}</span>
|
|
5
|
+
</slot>
|
|
6
|
+
<slot name="icon" />
|
|
7
|
+
</ListboxButton>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { ListboxButton } from '@headlessui/vue';
|
|
12
|
+
|
|
13
|
+
import { injectReactiveOrFail, stringProp } from '@/utils/vue';
|
|
14
|
+
import type { ComponentProps } from '@/utils/vue';
|
|
15
|
+
|
|
16
|
+
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
17
|
+
|
|
18
|
+
defineProps({ textClass: stringProp() });
|
|
19
|
+
|
|
20
|
+
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
21
|
+
'select',
|
|
22
|
+
'<AGHeadlessSelectButton> must be a child of a <AGHeadlessSelect>',
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p v-if="errorMessage" :id="`${select.id}-error`">
|
|
3
|
+
{{ errorMessage }}
|
|
4
|
+
</p>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from 'vue';
|
|
9
|
+
|
|
10
|
+
import { injectReactiveOrFail } from '@/utils/vue';
|
|
11
|
+
import { translateWithDefault } from '@/lang/utils';
|
|
12
|
+
|
|
13
|
+
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
14
|
+
|
|
15
|
+
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
16
|
+
'select',
|
|
17
|
+
'<AGHeadlessSelectError> must be a child of a <AGHeadlessSelect>',
|
|
18
|
+
);
|
|
19
|
+
const errorMessage = computed(() => {
|
|
20
|
+
if (!select.errors) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return translateWithDefault(`errors.${select.errors[0]}`, `Error: ${select.errors[0]}`);
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListboxLabel v-if="show" v-slot="{ open, disabled }: ComponentProps">
|
|
3
|
+
<slot :open="open" :disabled="disabled">
|
|
4
|
+
{{ select.label }}
|
|
5
|
+
</slot>
|
|
6
|
+
</ListboxLabel>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { computed, useSlots } from 'vue';
|
|
11
|
+
import { ListboxLabel } from '@headlessui/vue';
|
|
12
|
+
|
|
13
|
+
import { injectReactiveOrFail } from '@/utils/vue';
|
|
14
|
+
import type { ComponentProps } from '@/utils/vue';
|
|
15
|
+
|
|
16
|
+
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
17
|
+
|
|
18
|
+
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
19
|
+
'select',
|
|
20
|
+
'<AGHeadlessSelectLabel> must be a child of a <AGHeadlessSelect>',
|
|
21
|
+
);
|
|
22
|
+
const slots = useSlots();
|
|
23
|
+
const show = computed(() => !!(select.label || slots.default));
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ListboxOption v-slot="{ active, selected, disabled }: ComponentProps" :value="value" as="template">
|
|
3
|
+
<slot :active="active" :selected="selected" :disabled="disabled">
|
|
4
|
+
<li
|
|
5
|
+
:class="{
|
|
6
|
+
[activeClass ?? 'active']: active,
|
|
7
|
+
[inactiveClass ?? 'inactive']: !active,
|
|
8
|
+
[selectedClass ?? 'selected']: selected,
|
|
9
|
+
[unselectedClass ?? 'unselected']: !selected,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
{{ option?.text }}
|
|
13
|
+
</li>
|
|
14
|
+
</slot>
|
|
15
|
+
</ListboxOption>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { computed } from 'vue';
|
|
20
|
+
import { ListboxOption } from '@headlessui/vue';
|
|
21
|
+
|
|
22
|
+
import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@/utils/vue';
|
|
23
|
+
import type { ComponentProps } from '@/utils/vue';
|
|
24
|
+
|
|
25
|
+
import type { IAGHeadlessSelect, IAGSelectOptionValue } from './AGHeadlessSelect';
|
|
26
|
+
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
value: requiredMixedProp<IAGSelectOptionValue>(),
|
|
29
|
+
selectedClass: stringProp(),
|
|
30
|
+
unselectedClass: stringProp(),
|
|
31
|
+
activeClass: stringProp(),
|
|
32
|
+
inactiveClass: stringProp(),
|
|
33
|
+
});
|
|
34
|
+
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
35
|
+
'select',
|
|
36
|
+
'<AGHeadlessSelectOption> must be a child of a <AGHeadlessSelect>',
|
|
37
|
+
);
|
|
38
|
+
const option = computed(() => select.options.find((selectOption) => selectOption.value === props.value));
|
|
39
|
+
</script>
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './AGHeadlessInput';
|
|
2
|
+
export * from './AGHeadlessSelect';
|
|
3
|
+
export * from './AGHeadlessSelectOption';
|
|
2
4
|
export { default as AGHeadlessButton } from './AGHeadlessButton.vue';
|
|
3
5
|
export { default as AGHeadlessInput } from './AGHeadlessInput.vue';
|
|
4
6
|
export { default as AGHeadlessInputError } from './AGHeadlessInputError.vue';
|
|
5
7
|
export { default as AGHeadlessInputInput } from './AGHeadlessInputInput.vue';
|
|
6
8
|
export { default as AGHeadlessInputLabel } from './AGHeadlessInputLabel.vue';
|
|
9
|
+
export { default as AGHeadlessSelect } from './AGHeadlessSelect.vue';
|
|
10
|
+
export { default as AGHeadlessSelectButton } from './AGHeadlessSelectButton.vue';
|
|
11
|
+
export { default as AGHeadlessSelectError } from './AGHeadlessSelectError.vue';
|
|
12
|
+
export { default as AGHeadlessSelectLabel } from './AGHeadlessSelectLabel.vue';
|
|
13
|
+
export { default as AGHeadlessSelectOption } from './AGHeadlessSelectOption.vue';
|
|
14
|
+
export { default as AGHeadlessSelectOptions } from './AGHeadlessSelectOptions';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { IAGModal } from '@/components/modals/AGModal';
|
|
2
|
+
import { booleanProp } from '@/utils';
|
|
2
3
|
|
|
3
4
|
export interface IAGHeadlessModal extends IAGModal {}
|
|
4
5
|
|
|
5
6
|
export interface IAGHeadlessModalDefaultSlotProps {
|
|
6
7
|
close(result?: unknown): Promise<void>;
|
|
7
8
|
}
|
|
9
|
+
|
|
10
|
+
export const modalProps = {
|
|
11
|
+
cancellable: booleanProp(true),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function useModalProps(): typeof modalProps {
|
|
15
|
+
return modalProps;
|
|
16
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<DialogPanel>
|
|
3
3
|
<slot />
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
<template v-if="childModal">
|
|
6
|
+
<div class="pointer-events-none fixed inset-0 z-50 bg-black/30" />
|
|
7
|
+
<AGModalContext :child-index="modal.childIndex + 1" :modal="childModal" />
|
|
8
|
+
</template>
|
|
5
9
|
</DialogPanel>
|
|
6
10
|
</template>
|
|
7
11
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { AGHeadlessModal, AGHeadlessModalPanel, AGHeadlessModalTitle, IAGHeadlessModal };
|
|
1
|
+
export * from './AGHeadlessModal';
|
|
2
|
+
export { default as AGHeadlessModal } from './AGHeadlessModal.vue';
|
|
3
|
+
export { default as AGHeadlessModalPanel } from './AGHeadlessModalPanel.vue';
|
|
4
|
+
export { default as AGHeadlessModalTitle } from './AGHeadlessModalTitle.vue';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { arrayProp, enumProp, requiredStringProp } from '@/utils/vue';
|
|
2
|
+
import { Colors } from '@/components/constants';
|
|
3
|
+
import { objectWithout } from '@noeldemartin/utils';
|
|
4
|
+
|
|
5
|
+
export { default as AGHeadlessSnackbar } from './AGHeadlessSnackbar.vue';
|
|
6
|
+
|
|
7
|
+
export interface SnackbarAction {
|
|
8
|
+
text: string;
|
|
9
|
+
dismiss?: boolean;
|
|
10
|
+
handler?(): unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type SnackbarColor = (typeof SnackbarColors)[keyof typeof SnackbarColors];
|
|
14
|
+
|
|
15
|
+
export const SnackbarColors = objectWithout(Colors, ['Primary', 'Clear']);
|
|
16
|
+
export const snackbarProps = {
|
|
17
|
+
id: requiredStringProp(),
|
|
18
|
+
message: requiredStringProp(),
|
|
19
|
+
actions: arrayProp<SnackbarAction>(() => []),
|
|
20
|
+
color: enumProp(SnackbarColors, Colors.Secondary),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function useSnackbarProps(): typeof snackbarProps {
|
|
24
|
+
return snackbarProps;
|
|
25
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -3,7 +3,9 @@ import AGAppOverlays from './AGAppOverlays.vue';
|
|
|
3
3
|
|
|
4
4
|
export { AGAppLayout, AGAppOverlays };
|
|
5
5
|
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './constants';
|
|
7
7
|
export * from './forms';
|
|
8
8
|
export * from './headless';
|
|
9
|
+
export * from './lib';
|
|
9
10
|
export * from './modals';
|
|
11
|
+
export * from './snackbars';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGMarkdown :text="message" inline />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from 'vue';
|
|
7
|
+
|
|
8
|
+
import Errors from '@/errors/Errors';
|
|
9
|
+
import { requiredObjectProp } from '@/utils/vue';
|
|
10
|
+
import type { ErrorSource } from '@/errors/Errors.state';
|
|
11
|
+
|
|
12
|
+
import AGMarkdown from './AGMarkdown.vue';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({ error: requiredObjectProp<ErrorSource>() });
|
|
15
|
+
const message = computed(() => Errors.getErrorMessage(props.error));
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<root />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, h } from 'vue';
|
|
7
|
+
|
|
8
|
+
import { renderMarkdown } from '@/utils/markdown';
|
|
9
|
+
import { booleanProp, objectProp, stringProp } from '@/utils/vue';
|
|
10
|
+
import { translate } from '@/lang';
|
|
11
|
+
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
as: stringProp(),
|
|
14
|
+
inline: booleanProp(),
|
|
15
|
+
langKey: stringProp(),
|
|
16
|
+
langParams: objectProp<Record<string, unknown>>(),
|
|
17
|
+
text: stringProp(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const markdown = computed(() => props.text ?? (props.langKey && translate(props.langKey, props.langParams ?? {})));
|
|
21
|
+
const html = computed(() => {
|
|
22
|
+
if (!markdown.value) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let renderedHtml = renderMarkdown(markdown.value);
|
|
27
|
+
|
|
28
|
+
if (props.inline) {
|
|
29
|
+
renderedHtml = renderedHtml.replace('<p>', '<span>').replace('</p>', '</span>');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return renderedHtml;
|
|
33
|
+
});
|
|
34
|
+
const root = () =>
|
|
35
|
+
h(props.as ?? (props.inline ? 'span' : 'div'), { class: props.inline ? '' : 'prose', innerHTML: html.value });
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid flex-grow place-items-center">
|
|
3
|
+
<div class="flex flex-col items-center space-y-6 p-8">
|
|
4
|
+
<h1 class="mt-2 text-center text-4xl font-medium text-red-600">
|
|
5
|
+
{{ $td('startupCrash.title', 'Something went wrong!') }}
|
|
6
|
+
</h1>
|
|
7
|
+
<AGMarkdown
|
|
8
|
+
:text="
|
|
9
|
+
$td(
|
|
10
|
+
'startupCrash.message',
|
|
11
|
+
'Something failed trying to start the application.\n\nHere\'s some things you can do:'
|
|
12
|
+
)
|
|
13
|
+
"
|
|
14
|
+
class="mt-4 text-center"
|
|
15
|
+
/>
|
|
16
|
+
<div class="mt-4 flex flex-col space-y-4">
|
|
17
|
+
<AGButton color="danger" @click="$app.reload()">
|
|
18
|
+
{{ $td('startupCrash.reload', 'Try again') }}
|
|
19
|
+
</AGButton>
|
|
20
|
+
<AGButton color="danger" @click="$errors.inspect($errors.startupErrors)">
|
|
21
|
+
{{ $td('startupCrash.inspect', 'View error details') }}
|
|
22
|
+
</AGButton>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import AGMarkdown from './AGMarkdown.vue';
|
|
30
|
+
import AGButton from '../forms/AGButton.vue';
|
|
31
|
+
</script>
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
:text="title"
|
|
6
6
|
as="h2"
|
|
7
7
|
class="font-semibold"
|
|
8
|
-
raw
|
|
9
8
|
inline
|
|
10
9
|
/>
|
|
11
10
|
<AGMarkdown :text="message" />
|
|
@@ -17,7 +16,7 @@ import { requiredStringProp, stringProp } from '@/utils/vue';
|
|
|
17
16
|
|
|
18
17
|
import AGModal from './AGModal.vue';
|
|
19
18
|
|
|
20
|
-
import AGMarkdown from '../
|
|
19
|
+
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
21
20
|
|
|
22
21
|
defineProps({
|
|
23
22
|
title: stringProp(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { requiredStringProp, stringProp } from '@/utils';
|
|
2
|
+
|
|
3
|
+
export const confirmModalProps = {
|
|
4
|
+
title: stringProp(),
|
|
5
|
+
message: requiredStringProp(),
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function useConfirmModalProps(): typeof confirmModalProps {
|
|
9
|
+
return confirmModalProps;
|
|
10
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<AGButton @click="close(true)">
|
|
8
8
|
{{ $td('ui.ok', 'OK') }}
|
|
9
9
|
</AGButton>
|
|
10
|
-
<AGButton secondary @click="close()">
|
|
10
|
+
<AGButton color="secondary" @click="close()">
|
|
11
11
|
{{ $td('ui.cancel', 'Cancel') }}
|
|
12
12
|
</AGButton>
|
|
13
13
|
</div>
|
|
@@ -21,7 +21,7 @@ import AGModal from './AGModal.vue';
|
|
|
21
21
|
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
22
22
|
|
|
23
23
|
import AGButton from '../forms/AGButton.vue';
|
|
24
|
-
import AGMarkdown from '../
|
|
24
|
+
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
25
25
|
|
|
26
26
|
defineProps({
|
|
27
27
|
title: stringProp(),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
import { requiredArrayProp } from '@/utils/vue';
|
|
4
|
+
import type { ErrorReport } from '@/errors';
|
|
5
|
+
|
|
6
|
+
export interface IAGErrorReportModalButtonsDefaultSlotProps {
|
|
7
|
+
id: string;
|
|
8
|
+
description: string;
|
|
9
|
+
iconComponent: Component;
|
|
10
|
+
url?: string;
|
|
11
|
+
handler?(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const errorReportModalProps = {
|
|
15
|
+
reports: requiredArrayProp<ErrorReport>(),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function useErrorReportModalProps(): typeof errorReportModalProps {
|
|
19
|
+
return errorReportModalProps;
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<AGModal>
|
|
3
|
+
<div>
|
|
4
|
+
<h2 class="flex items-center justify-between text-lg font-medium">
|
|
5
|
+
<div class="flex items-center">
|
|
6
|
+
<AGErrorReportModalTitle
|
|
7
|
+
:report="report"
|
|
8
|
+
:current-report="activeReportIndex + 1"
|
|
9
|
+
:total-reports="reports.length"
|
|
10
|
+
/>
|
|
11
|
+
<template v-if="reports.length > 1">
|
|
12
|
+
<AGButton
|
|
13
|
+
color="clear"
|
|
14
|
+
:disabled="activeReportIndex === 0"
|
|
15
|
+
:title="$td('errors.previousReport', 'Show previous report')"
|
|
16
|
+
:aria-label="$td('errors.previousReport', 'Show previous report')"
|
|
17
|
+
@click="activeReportIndex--"
|
|
18
|
+
>
|
|
19
|
+
<IconCheveronLeft aria-hidden="true" class="h-4 w-4" />
|
|
20
|
+
</AGButton>
|
|
21
|
+
<AGButton
|
|
22
|
+
color="clear"
|
|
23
|
+
:disabled="activeReportIndex === reports.length - 1"
|
|
24
|
+
:title="$td('errors.nextReport', 'Show next report')"
|
|
25
|
+
:aria-label="$td('errors.nextReport', 'Show next report')"
|
|
26
|
+
@click="activeReportIndex++"
|
|
27
|
+
>
|
|
28
|
+
<IconCheveronRight aria-hidden="true" class="h-4 w-4" />
|
|
29
|
+
</AGButton>
|
|
30
|
+
</template>
|
|
31
|
+
</div>
|
|
32
|
+
<AGErrorReportModalButtons :report="report" />
|
|
33
|
+
</h2>
|
|
34
|
+
<AGMarkdown v-if="report.description" :text="report.description" class="mt-2" />
|
|
35
|
+
</div>
|
|
36
|
+
<pre
|
|
37
|
+
class="h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900"
|
|
38
|
+
v-text="report.details ?? $td('errors.detailsEmpty', 'This error is missing a stacktrace.')"
|
|
39
|
+
/>
|
|
40
|
+
</AGModal>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
45
|
+
import IconCheveronLeft from '~icons/zondicons/cheveron-left';
|
|
46
|
+
|
|
47
|
+
import { computed, ref } from 'vue';
|
|
48
|
+
|
|
49
|
+
import type { ErrorReport } from '@/errors';
|
|
50
|
+
|
|
51
|
+
import { useErrorReportModalProps } from './AGErrorReportModal';
|
|
52
|
+
|
|
53
|
+
import AGButton from '../forms/AGButton.vue';
|
|
54
|
+
import AGErrorReportModalButtons from './AGErrorReportModalButtons.vue';
|
|
55
|
+
import AGErrorReportModalTitle from './AGErrorReportModalTitle.vue';
|
|
56
|
+
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
57
|
+
import AGModal from './AGModal.vue';
|
|
58
|
+
|
|
59
|
+
const props = defineProps(useErrorReportModalProps());
|
|
60
|
+
const activeReportIndex = ref(0);
|
|
61
|
+
const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);
|
|
62
|
+
</script>
|