@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
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ComputedRef, DeepReadonly, ExtractPropTypes, Ref } from 'vue';
|
|
2
|
-
|
|
3
|
-
import { stringProp } from '@/utils';
|
|
4
|
-
import { extractComponentProps } from '@/components/utils';
|
|
5
|
-
|
|
6
|
-
export interface IAGHeadlessInput {
|
|
7
|
-
id: string;
|
|
8
|
-
name: ComputedRef<string | null>;
|
|
9
|
-
label: ComputedRef<string | null>;
|
|
10
|
-
value: ComputedRef<string | number | boolean | null>;
|
|
11
|
-
errors: DeepReadonly<Ref<string[] | null>>;
|
|
12
|
-
update(value: string | number | boolean | null): void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const inputProps = {
|
|
16
|
-
name: stringProp(),
|
|
17
|
-
label: stringProp(),
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function useInputProps(): typeof inputProps {
|
|
21
|
-
return inputProps;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function extractInputProps<T extends ExtractPropTypes<typeof inputProps>>(
|
|
25
|
-
props: T,
|
|
26
|
-
): Pick<T, keyof typeof inputProps> {
|
|
27
|
-
return extractComponentProps(props, inputProps);
|
|
28
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="as" v-if="as">
|
|
3
|
-
<slot />
|
|
4
|
-
</component>
|
|
5
|
-
<slot v-else />
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import { computed, inject, provide, readonly } from 'vue';
|
|
10
|
-
import { uuid } from '@noeldemartin/utils';
|
|
11
|
-
|
|
12
|
-
import { mixedProp, stringProp } from '@/utils/vue';
|
|
13
|
-
import type Form from '@/forms/Form';
|
|
14
|
-
|
|
15
|
-
import { useInputProps } from './AGHeadlessInput';
|
|
16
|
-
import type { IAGHeadlessInput } from './AGHeadlessInput';
|
|
17
|
-
|
|
18
|
-
const emit = defineEmits(['update:modelValue']);
|
|
19
|
-
const props = defineProps({
|
|
20
|
-
as: stringProp('div'),
|
|
21
|
-
modelValue: mixedProp<string | number | boolean>([String, Number, Boolean]),
|
|
22
|
-
...useInputProps(),
|
|
23
|
-
});
|
|
24
|
-
const errors = computed(() => {
|
|
25
|
-
if (!form || !props.name) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return form.errors[props.name] ?? null;
|
|
30
|
-
});
|
|
31
|
-
const form = inject<Form | null>('form', null);
|
|
32
|
-
const api: IAGHeadlessInput = {
|
|
33
|
-
id: `input-${uuid()}`,
|
|
34
|
-
name: computed(() => props.name),
|
|
35
|
-
label: computed(() => props.label),
|
|
36
|
-
value: computed(() => {
|
|
37
|
-
if (form && props.name) {
|
|
38
|
-
return form.getFieldValue(props.name) as string | number | boolean | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return props.modelValue;
|
|
42
|
-
}),
|
|
43
|
-
errors: readonly(errors),
|
|
44
|
-
update(value) {
|
|
45
|
-
if (form && props.name) {
|
|
46
|
-
form.setFieldValue(props.name, value);
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
emit('update:modelValue', value);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
provide<IAGHeadlessInput>('input', api);
|
|
56
|
-
defineExpose<IAGHeadlessInput>(api);
|
|
57
|
-
</script>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<input
|
|
3
|
-
:id="input.id"
|
|
4
|
-
ref="$input"
|
|
5
|
-
:type="type"
|
|
6
|
-
:value="value"
|
|
7
|
-
:aria-invalid="input.errors ? 'true' : 'false'"
|
|
8
|
-
:aria-describedby="input.errors ? `${input.id}-error` : undefined"
|
|
9
|
-
:checked="checked"
|
|
10
|
-
@input="update"
|
|
11
|
-
>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { computed, ref } from 'vue';
|
|
16
|
-
|
|
17
|
-
import { injectReactiveOrFail, stringProp } from '@/utils';
|
|
18
|
-
import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
|
|
19
|
-
|
|
20
|
-
const props = defineProps({
|
|
21
|
-
type: stringProp('text'),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const $input = ref<HTMLInputElement>();
|
|
25
|
-
const input = injectReactiveOrFail<IAGHeadlessInput>(
|
|
26
|
-
'input',
|
|
27
|
-
'<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>',
|
|
28
|
-
);
|
|
29
|
-
const value = computed(() => input.value);
|
|
30
|
-
const checked = computed(() => {
|
|
31
|
-
if (props.type !== 'checkbox') {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return !!value.value;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
function update() {
|
|
39
|
-
if (!$input.value) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
input.update(props.type === 'checkbox' ? $input.value.checked : $input.value.value);
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
@@ -1,24 +0,0 @@
|
|
|
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>
|
|
@@ -1,24 +0,0 @@
|
|
|
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>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes, Ref } from 'vue';
|
|
3
|
-
|
|
4
|
-
import { booleanProp, stringProp } from '@/utils';
|
|
5
|
-
import { extractComponentProps } from '@/components/utils';
|
|
6
|
-
import type { IAGModal } from '@/components/modals/AGModal';
|
|
7
|
-
|
|
8
|
-
export interface IAGHeadlessModal extends IAGModal {}
|
|
9
|
-
|
|
10
|
-
export interface IAGHeadlessModalDefaultSlotProps {
|
|
11
|
-
close(result?: unknown): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const modalProps = {
|
|
15
|
-
cancellable: booleanProp(true),
|
|
16
|
-
title: stringProp(),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function useModalProps(): typeof modalProps {
|
|
20
|
-
return modalProps;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function extractModalProps<T extends ExtractPropTypes<typeof modalProps>>(
|
|
24
|
-
props: T,
|
|
25
|
-
): Pick<T, keyof typeof modalProps> {
|
|
26
|
-
return extractComponentProps(props, modalProps);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function useModalExpose($modal: Ref<IAGHeadlessModal | undefined>): IAGModal {
|
|
30
|
-
return {
|
|
31
|
-
close: async () => $modal.value?.close(),
|
|
32
|
-
cancellable: computed(() => !!$modal.value?.cancellable),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<DialogPanel>
|
|
3
|
-
<slot />
|
|
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>
|
|
9
|
-
</DialogPanel>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import { computed } from 'vue';
|
|
14
|
-
import { DialogPanel } from '@headlessui/vue';
|
|
15
|
-
|
|
16
|
-
import UI from '@/ui/UI';
|
|
17
|
-
import { injectReactiveOrFail } from '@/utils/vue';
|
|
18
|
-
import type { IAGModalContext } from '@/components/modals/AGModalContext';
|
|
19
|
-
|
|
20
|
-
import AGModalContext from '../../modals/AGModalContext.vue';
|
|
21
|
-
|
|
22
|
-
const modal = injectReactiveOrFail<IAGModalContext>(
|
|
23
|
-
'modal',
|
|
24
|
-
'could not obtain modal reference from <AGHeadlessModalPanel>, ' +
|
|
25
|
-
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
26
|
-
);
|
|
27
|
-
const childModal = computed(() => UI.modals[modal.childIndex] ?? null);
|
|
28
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<DialogTitle :as="as">
|
|
3
|
-
<slot />
|
|
4
|
-
</DialogTitle>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { DialogTitle } from '@headlessui/vue';
|
|
9
|
-
|
|
10
|
-
import { stringProp } from '@/utils/vue';
|
|
11
|
-
|
|
12
|
-
defineProps({ as: stringProp('h2') });
|
|
13
|
-
</script>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
3
|
-
|
|
4
|
-
import { requiredStringProp, stringProp } from '@/utils';
|
|
5
|
-
|
|
6
|
-
export const alertModalProps = {
|
|
7
|
-
title: stringProp(),
|
|
8
|
-
message: requiredStringProp(),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type AGAlertModalProps = ObjectWithoutEmpty<ExtractPropTypes<typeof alertModalProps>>;
|
|
12
|
-
|
|
13
|
-
export function useAlertModalProps(): typeof alertModalProps {
|
|
14
|
-
return alertModalProps;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal :title="title">
|
|
3
|
-
<AGMarkdown :text="message" />
|
|
4
|
-
</AGModal>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import AGModal from './AGModal.vue';
|
|
9
|
-
import { useAlertModalProps } from './AGAlertModal';
|
|
10
|
-
|
|
11
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
12
|
-
|
|
13
|
-
defineProps(useAlertModalProps());
|
|
14
|
-
</script>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { requiredStringProp, stringProp } from '@/utils';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
|
|
8
|
-
export const confirmModalProps = {
|
|
9
|
-
title: stringProp(),
|
|
10
|
-
message: requiredStringProp(),
|
|
11
|
-
acceptText: stringProp(),
|
|
12
|
-
cancelText: stringProp(),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type AGConfirmModalProps = ObjectWithoutEmpty<ExtractPropTypes<typeof confirmModalProps>>;
|
|
16
|
-
|
|
17
|
-
export function useConfirmModalProps(): typeof confirmModalProps {
|
|
18
|
-
return confirmModalProps;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
22
|
-
export function useConfirmModal(props: ExtractPropTypes<typeof confirmModalProps>) {
|
|
23
|
-
const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));
|
|
24
|
-
const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));
|
|
25
|
-
|
|
26
|
-
return { renderedAcceptText, renderedCancelText };
|
|
27
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false" :title="title">
|
|
3
|
-
<AGMarkdown :text="message" />
|
|
4
|
-
|
|
5
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
6
|
-
<AGButton @click="close(true)">
|
|
7
|
-
{{ renderedAcceptText }}
|
|
8
|
-
</AGButton>
|
|
9
|
-
<AGButton color="secondary" @click="close()">
|
|
10
|
-
{{ renderedCancelText }}
|
|
11
|
-
</AGButton>
|
|
12
|
-
</div>
|
|
13
|
-
</AGModal>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import AGModal from './AGModal.vue';
|
|
18
|
-
import { useConfirmModal, useConfirmModalProps } from './AGConfirmModal';
|
|
19
|
-
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
20
|
-
|
|
21
|
-
import AGButton from '../forms/AGButton.vue';
|
|
22
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
23
|
-
|
|
24
|
-
const props = defineProps(useConfirmModalProps());
|
|
25
|
-
const { renderedAcceptText, renderedCancelText } = useConfirmModal(props);
|
|
26
|
-
</script>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue';
|
|
2
|
-
import type { Component, ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { requiredArrayProp } from '@/utils/vue';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
import type { ErrorReport } from '@/errors';
|
|
8
|
-
|
|
9
|
-
export interface IAGErrorReportModalButtonsDefaultSlotProps {
|
|
10
|
-
id: string;
|
|
11
|
-
description: string;
|
|
12
|
-
iconComponent: Component;
|
|
13
|
-
url?: string;
|
|
14
|
-
handler?(): void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const errorReportModalProps = {
|
|
18
|
-
reports: requiredArrayProp<ErrorReport>(),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type AGErrorReportModalProps = ObjectWithoutEmpty<ExtractPropTypes<typeof errorReportModalProps>>;
|
|
22
|
-
|
|
23
|
-
export function useErrorReportModalProps(): typeof errorReportModalProps {
|
|
24
|
-
return errorReportModalProps;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
28
|
-
export function useErrorReportModal(props: ExtractPropTypes<typeof errorReportModalProps>) {
|
|
29
|
-
const activeReportIndex = ref(0);
|
|
30
|
-
const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);
|
|
31
|
-
const details = computed(
|
|
32
|
-
() =>
|
|
33
|
-
report.value.details?.trim() ||
|
|
34
|
-
translateWithDefault('errors.detailsEmpty', 'This error is missing a stacktrace.'),
|
|
35
|
-
);
|
|
36
|
-
const previousReportText = translateWithDefault('errors.previousReport', 'Show previous report');
|
|
37
|
-
const nextReportText = translateWithDefault('errors.nextReport', 'Show next report');
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
activeReportIndex,
|
|
41
|
-
details,
|
|
42
|
-
nextReportText,
|
|
43
|
-
previousReportText,
|
|
44
|
-
report,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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="previousReportText"
|
|
16
|
-
:aria-label="previousReportText"
|
|
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="nextReportText"
|
|
25
|
-
:aria-label="nextReportText"
|
|
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 class="h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900" v-text="details" />
|
|
37
|
-
</AGModal>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<script setup lang="ts">
|
|
41
|
-
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
42
|
-
import IconCheveronLeft from '~icons/zondicons/cheveron-left';
|
|
43
|
-
|
|
44
|
-
import { useErrorReportModal, useErrorReportModalProps } from './AGErrorReportModal';
|
|
45
|
-
|
|
46
|
-
import AGButton from '../forms/AGButton.vue';
|
|
47
|
-
import AGErrorReportModalButtons from './AGErrorReportModalButtons.vue';
|
|
48
|
-
import AGErrorReportModalTitle from './AGErrorReportModalTitle.vue';
|
|
49
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
50
|
-
import AGModal from './AGModal.vue';
|
|
51
|
-
|
|
52
|
-
const props = defineProps(useErrorReportModalProps());
|
|
53
|
-
const { activeReportIndex, details, nextReportText, previousReportText, report } = useErrorReportModal(props);
|
|
54
|
-
</script>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGMarkdown :text="text" inline />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import { computed } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { numberProp, requiredObjectProp } from '@/utils/vue';
|
|
9
|
-
import type { ErrorReport } from '@/errors';
|
|
10
|
-
|
|
11
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
report: requiredObjectProp<ErrorReport>(),
|
|
15
|
-
currentReport: numberProp(),
|
|
16
|
-
totalReports: numberProp(),
|
|
17
|
-
});
|
|
18
|
-
const text = computed(() => {
|
|
19
|
-
if (!props.totalReports || props.totalReports <= 1) {
|
|
20
|
-
return props.report.title;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return `${props.report.title} (${props.currentReport}/${props.totalReports})`;
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { stringProp } from '@/utils';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
|
|
8
|
-
export const loadingModalProps = {
|
|
9
|
-
message: stringProp(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type AGLoadingModalProps = ObjectWithoutEmpty<ExtractPropTypes<typeof loadingModalProps>>;
|
|
13
|
-
|
|
14
|
-
export function useLoadingModalProps(): typeof loadingModalProps {
|
|
15
|
-
return loadingModalProps;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
19
|
-
export function useLoadingModal(props: ExtractPropTypes<typeof loadingModalProps>) {
|
|
20
|
-
const renderedMessage = computed(() => props.message ?? translateWithDefault('ui.loading', 'Loading...'));
|
|
21
|
-
|
|
22
|
-
return { renderedMessage };
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal :cancellable="false">
|
|
3
|
-
<AGMarkdown :text="renderedMessage" />
|
|
4
|
-
</AGModal>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import AGModal from './AGModal.vue';
|
|
9
|
-
import { useLoadingModal, useLoadingModalProps } from './AGLoadingModal';
|
|
10
|
-
|
|
11
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
12
|
-
|
|
13
|
-
const props = defineProps(useLoadingModalProps());
|
|
14
|
-
const { renderedMessage } = useLoadingModal(props);
|
|
15
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGHeadlessModal
|
|
3
|
-
ref="$modal"
|
|
4
|
-
v-slot="{ close }: IAGHeadlessModalDefaultSlotProps"
|
|
5
|
-
v-bind="props"
|
|
6
|
-
class="relative z-50"
|
|
7
|
-
>
|
|
8
|
-
<div class="fixed inset-0 flex items-center justify-center p-8">
|
|
9
|
-
<AGHeadlessModalPanel class="flex max-h-full max-w-full flex-col overflow-hidden bg-white p-4">
|
|
10
|
-
<AGHeadlessModalTitle v-if="title" class="mb-2 text-lg font-semibold">
|
|
11
|
-
<AGMarkdown :text="title" inline />
|
|
12
|
-
</AGHeadlessModalTitle>
|
|
13
|
-
<div class="flex max-h-full flex-col overflow-auto" v-bind="$attrs">
|
|
14
|
-
<slot :close="close" />
|
|
15
|
-
</div>
|
|
16
|
-
</AGHeadlessModalPanel>
|
|
17
|
-
</div>
|
|
18
|
-
</AGHeadlessModal>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { ref } from 'vue';
|
|
23
|
-
|
|
24
|
-
import { useModalExpose, useModalProps } from '@/components/headless/modals/AGHeadlessModal';
|
|
25
|
-
import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from '@/components/headless/modals/AGHeadlessModal';
|
|
26
|
-
|
|
27
|
-
import type { IAGModal } from './AGModal';
|
|
28
|
-
|
|
29
|
-
import AGHeadlessModal from '../headless/modals/AGHeadlessModal.vue';
|
|
30
|
-
import AGHeadlessModalPanel from '../headless/modals/AGHeadlessModalPanel.vue';
|
|
31
|
-
import AGHeadlessModalTitle from '../headless/modals/AGHeadlessModalTitle.vue';
|
|
32
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
33
|
-
|
|
34
|
-
const props = defineProps(useModalProps());
|
|
35
|
-
const $modal = ref<IAGHeadlessModal>();
|
|
36
|
-
|
|
37
|
-
defineOptions({ inheritAttrs: false });
|
|
38
|
-
defineExpose<IAGModal>(useModalExpose($modal));
|
|
39
|
-
</script>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="modal.component" v-bind="modal.properties" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import { provide, toRef } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { requiredNumberProp, requiredObjectProp } from '@/utils/vue';
|
|
9
|
-
import type { Modal } from '@/ui/UI.state';
|
|
10
|
-
|
|
11
|
-
import type { IAGModalContext } from './AGModalContext';
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
modal: requiredObjectProp<Modal>(),
|
|
15
|
-
childIndex: requiredNumberProp(),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
provide<IAGModalContext>('modal', {
|
|
19
|
-
modal: toRef(props, 'modal'),
|
|
20
|
-
childIndex: toRef(props, 'childIndex'),
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { requiredStringProp, stringProp } from '@/utils';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
|
|
8
|
-
export const promptModalProps = {
|
|
9
|
-
title: stringProp(),
|
|
10
|
-
message: requiredStringProp(),
|
|
11
|
-
label: stringProp(),
|
|
12
|
-
defaultValue: stringProp(),
|
|
13
|
-
placeholder: stringProp(),
|
|
14
|
-
acceptText: stringProp(),
|
|
15
|
-
cancelText: stringProp(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type AGPromptModalProps = ObjectWithoutEmpty<ExtractPropTypes<typeof promptModalProps>>;
|
|
19
|
-
|
|
20
|
-
export function usePromptModalProps(): typeof promptModalProps {
|
|
21
|
-
return promptModalProps;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
25
|
-
export function usePromptModal(props: ExtractPropTypes<typeof promptModalProps>) {
|
|
26
|
-
const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));
|
|
27
|
-
const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));
|
|
28
|
-
|
|
29
|
-
return { renderedAcceptText, renderedCancelText };
|
|
30
|
-
}
|