@aerogel/core 0.0.0-next.9a02fcd3bcf698211dd7a71d4c48257c96dd7832 → 0.0.0-next.9e0c0bbdcff5db68a1087ef53cbdc0f53299f6bb
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 +2529 -1597
- package/dist/aerogel-core.js +3265 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +30 -37
- package/src/bootstrap/bootstrap.test.ts +4 -8
- 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 -10
- package/src/components/AppToasts.vue +16 -0
- package/src/components/contracts/AlertModal.ts +4 -0
- package/src/components/contracts/Button.ts +16 -0
- package/src/components/contracts/ConfirmModal.ts +41 -0
- package/src/components/contracts/DropdownMenu.ts +20 -0
- package/src/components/contracts/ErrorReportModal.ts +29 -0
- package/src/components/contracts/Input.ts +26 -0
- package/src/components/contracts/LoadingModal.ts +22 -0
- package/src/components/contracts/Modal.ts +21 -0
- package/src/components/contracts/PromptModal.ts +30 -0
- package/src/components/contracts/Select.ts +44 -0
- package/src/components/contracts/Toast.ts +13 -0
- package/src/components/contracts/index.ts +11 -0
- package/src/components/headless/HeadlessButton.vue +51 -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/HeadlessModal.vue +92 -0
- package/src/components/headless/HeadlessModalContent.vue +30 -0
- package/src/components/headless/HeadlessModalDescription.vue +12 -0
- package/src/components/headless/HeadlessModalOverlay.vue +12 -0
- package/src/components/headless/HeadlessModalTitle.vue +12 -0
- package/src/components/headless/HeadlessSelect.vue +113 -0
- package/src/components/headless/{forms/AGHeadlessSelectError.vue → HeadlessSelectError.vue} +5 -6
- package/src/components/headless/HeadlessSelectLabel.vue +25 -0
- package/src/components/headless/HeadlessSelectOption.vue +34 -0
- package/src/components/headless/HeadlessSelectOptions.vue +37 -0
- package/src/components/headless/HeadlessSelectTrigger.vue +22 -0
- package/src/components/headless/HeadlessSelectValue.vue +18 -0
- package/src/components/headless/HeadlessToast.vue +18 -0
- package/src/components/headless/HeadlessToastAction.vue +13 -0
- package/src/components/headless/index.ts +19 -3
- package/src/components/index.ts +6 -9
- package/src/components/ui/AdvancedOptions.vue +18 -0
- package/src/components/ui/AlertModal.vue +13 -0
- package/src/components/ui/Button.vue +98 -0
- package/src/components/ui/Checkbox.vue +56 -0
- package/src/components/ui/ConfirmModal.vue +42 -0
- package/src/components/ui/DropdownMenu.vue +32 -0
- package/src/components/ui/DropdownMenuOption.vue +14 -0
- package/src/components/ui/DropdownMenuOptions.vue +27 -0
- package/src/components/ui/EditableContent.vue +82 -0
- package/src/components/ui/ErrorMessage.vue +15 -0
- package/src/components/ui/ErrorReportModal.vue +62 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +34 -27
- package/src/components/ui/ErrorReportModalTitle.vue +24 -0
- package/src/components/ui/Form.vue +24 -0
- package/src/components/ui/Input.vue +56 -0
- package/src/components/ui/Link.vue +12 -0
- package/src/components/ui/LoadingModal.vue +32 -0
- package/src/components/ui/Markdown.vue +69 -0
- package/src/components/ui/Modal.vue +91 -0
- package/src/components/ui/ModalContext.vue +30 -0
- package/src/components/ui/ProgressBar.vue +51 -0
- package/src/components/ui/PromptModal.vue +35 -0
- package/src/components/ui/Select.vue +25 -0
- package/src/components/ui/SelectLabel.vue +17 -0
- package/src/components/ui/SelectOption.vue +29 -0
- package/src/components/ui/SelectOptions.vue +30 -0
- package/src/components/ui/SelectTrigger.vue +29 -0
- package/src/components/ui/SettingsModal.vue +15 -0
- package/src/components/{lib/AGStartupCrash.vue → ui/StartupCrash.vue} +8 -8
- package/src/components/ui/Toast.vue +42 -0
- package/src/components/ui/index.ts +30 -0
- 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 +17 -18
- 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} +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 +54 -0
- package/src/{main.ts → index.ts} +1 -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 +46 -0
- package/src/lang/Lang.state.ts +11 -0
- package/src/lang/Lang.ts +48 -21
- package/src/lang/index.ts +12 -6
- package/src/lang/settings/Language.vue +48 -0
- package/src/lang/settings/index.ts +10 -0
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/index.ts +10 -7
- package/src/services/App.state.ts +36 -3
- package/src/services/App.ts +19 -3
- package/src/services/Cache.ts +43 -0
- package/src/services/Events.ts +15 -5
- package/src/services/Service.ts +125 -54
- package/src/services/Storage.ts +20 -0
- package/src/services/index.ts +16 -5
- package/src/services/utils.ts +18 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/setup.ts +11 -0
- package/src/ui/UI.state.ts +19 -7
- package/src/ui/UI.ts +188 -77
- package/src/ui/index.ts +19 -18
- package/src/ui/utils.ts +16 -0
- package/src/utils/classes.ts +49 -0
- package/src/utils/composition/events.ts +2 -2
- package/src/utils/composition/forms.ts +14 -4
- 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 +33 -0
- package/src/utils/index.ts +5 -1
- package/src/utils/markdown.test.ts +50 -0
- package/src/utils/markdown.ts +19 -6
- package/src/utils/types.ts +3 -0
- package/src/utils/vue.ts +28 -127
- 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/AGAppSnackbars.vue +0 -13
- package/src/components/constants.ts +0 -8
- 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/forms/AGSelect.story.vue +0 -46
- package/src/components/forms/AGSelect.vue +0 -60
- package/src/components/forms/index.ts +0 -5
- 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 -47
- package/src/components/headless/forms/AGHeadlessSelect.ts +0 -42
- package/src/components/headless/forms/AGHeadlessSelect.vue +0 -77
- package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectOption.ts +0 -4
- package/src/components/headless/forms/AGHeadlessSelectOption.vue +0 -39
- package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
- package/src/components/headless/forms/index.ts +0 -14
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -34
- package/src/components/headless/modals/AGHeadlessModal.vue +0 -86
- 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/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
- package/src/components/headless/snackbars/index.ts +0 -40
- package/src/components/lib/AGErrorMessage.vue +0 -16
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/lib/AGMarkdown.vue +0 -36
- package/src/components/lib/AGMeasured.vue +0 -15
- package/src/components/lib/index.ts +0 -5
- 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/components/snackbars/AGSnackbar.vue +0 -36
- package/src/components/snackbars/index.ts +0 -3
- package/src/components/utils.ts +0 -10
- package/src/directives/initial-focus.ts +0 -11
- package/src/main.histoire.ts +0 -1
- package/src/utils/tailwindcss.test.ts +0 -26
- package/src/utils/tailwindcss.ts +0 -7
- package/tailwind.config.js +0 -4
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
|
@@ -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,40 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
3
|
-
|
|
4
|
-
import UI from '@/ui/UI';
|
|
5
|
-
import { arrayProp, enumProp, requiredStringProp } from '@/utils/vue';
|
|
6
|
-
import { Colors } from '@/components/constants';
|
|
7
|
-
import { objectWithout } from '@noeldemartin/utils';
|
|
8
|
-
|
|
9
|
-
export { default as AGHeadlessSnackbar } from './AGHeadlessSnackbar.vue';
|
|
10
|
-
|
|
11
|
-
export const SnackbarColors = objectWithout(Colors, ['Primary', 'Clear']);
|
|
12
|
-
export const snackbarProps = {
|
|
13
|
-
id: requiredStringProp(),
|
|
14
|
-
message: requiredStringProp(),
|
|
15
|
-
actions: arrayProp<SnackbarAction>(() => []),
|
|
16
|
-
color: enumProp(SnackbarColors, Colors.Secondary),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export interface SnackbarAction {
|
|
20
|
-
text: string;
|
|
21
|
-
dismiss?: boolean;
|
|
22
|
-
handler?(): unknown;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type SnackbarColor = (typeof SnackbarColors)[keyof typeof SnackbarColors];
|
|
26
|
-
export type AGSnackbarProps = ObjectWithoutEmpty<ExtractPropTypes<typeof snackbarProps>>;
|
|
27
|
-
|
|
28
|
-
export function useSnackbarProps(): typeof snackbarProps {
|
|
29
|
-
return snackbarProps;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
33
|
-
export function useSnackbar(props: ExtractPropTypes<typeof snackbarProps>) {
|
|
34
|
-
function activate(action: SnackbarAction): void {
|
|
35
|
-
action.handler?.();
|
|
36
|
-
action.dismiss && UI.hideSnackbar(props.id);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return { activate };
|
|
40
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGMarkdown :text="message" inline />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import { computed } from 'vue';
|
|
7
|
-
|
|
8
|
-
import { requiredObjectProp } from '@/utils/vue';
|
|
9
|
-
import { getErrorMessage } from '@/errors/utils';
|
|
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(() => getErrorMessage(props.error));
|
|
16
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
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>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="as" v-measure="() => (measured = true)" :class="{ '!invisible !absolute !w-auto': !measured }">
|
|
3
|
-
<slot />
|
|
4
|
-
</component>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { ref } from 'vue';
|
|
9
|
-
|
|
10
|
-
import { stringProp } from '@/utils/vue';
|
|
11
|
-
|
|
12
|
-
defineProps({ as: stringProp('span') });
|
|
13
|
-
|
|
14
|
-
const measured = ref(false);
|
|
15
|
-
</script>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default as AGErrorMessage } from './AGErrorMessage.vue';
|
|
2
|
-
export { default as AGLink } from './AGLink.vue';
|
|
3
|
-
export { default as AGMarkdown } from './AGMarkdown.vue';
|
|
4
|
-
export { default as AGMeasured } from './AGMeasured.vue';
|
|
5
|
-
export { default as AGStartupCrash } from './AGStartupCrash.vue';
|
|
@@ -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
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false" :title="title">
|
|
3
|
-
<AGMarkdown :text="message" />
|
|
4
|
-
|
|
5
|
-
<AGForm :form="form" @submit="close(form.draft)">
|
|
6
|
-
<AGInput name="draft" :placeholder="placeholder" :label="label" />
|
|
7
|
-
|
|
8
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
9
|
-
<AGButton submit>
|
|
10
|
-
{{ renderedAcceptText }}
|
|
11
|
-
</AGButton>
|
|
12
|
-
<AGButton color="secondary" @click="close()">
|
|
13
|
-
{{ renderedCancelText }}
|
|
14
|
-
</AGButton>
|
|
15
|
-
</div>
|
|
16
|
-
</AGForm>
|
|
17
|
-
</AGModal>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import AGModal from './AGModal.vue';
|
|
22
|
-
import { usePromptModal, usePromptModalProps } from './AGPromptModal';
|
|
23
|
-
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
24
|
-
|
|
25
|
-
import AGButton from '../forms/AGButton.vue';
|
|
26
|
-
import AGForm from '../forms/AGForm.vue';
|
|
27
|
-
import AGInput from '../forms/AGInput.vue';
|
|
28
|
-
import AGMarkdown from '../lib/AGMarkdown.vue';
|
|
29
|
-
import { requiredStringInput, useForm } from '../../forms';
|
|
30
|
-
|
|
31
|
-
const props = defineProps(usePromptModalProps());
|
|
32
|
-
const form = useForm({ draft: requiredStringInput(props.defaultValue ?? '') });
|
|
33
|
-
const { renderedAcceptText, renderedCancelText } = usePromptModal(props);
|
|
34
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './AGAlertModal';
|
|
2
|
-
export * from './AGConfirmModal';
|
|
3
|
-
export * from './AGErrorReportModal';
|
|
4
|
-
export * from './AGLoadingModal';
|
|
5
|
-
export * from './AGModal';
|
|
6
|
-
export * from './AGModalContext';
|
|
7
|
-
export * from './AGPromptModal';
|
|
8
|
-
|
|
9
|
-
export { default as AGAlertModal } from './AGAlertModal.vue';
|
|
10
|
-
export { default as AGConfirmModal } from './AGConfirmModal.vue';
|
|
11
|
-
export { default as AGErrorReportModalButtons } from './AGErrorReportModalButtons.vue';
|
|
12
|
-
export { default as AGErrorReportModalTitle } from './AGErrorReportModalTitle.vue';
|
|
13
|
-
export { default as AGLoadingModal } from './AGLoadingModal.vue';
|
|
14
|
-
export { default as AGModal } from './AGModal.vue';
|
|
15
|
-
export { default as AGModalContext } from './AGModalContext.vue';
|
|
16
|
-
export { default as AGModalTitle } from './AGModalTitle.vue';
|
|
17
|
-
export { default as AGPromptModal } from './AGPromptModal.vue';
|