@aerogel/core 0.0.0-next.c4825c5cbe0fe3257e478c2a7ec8df27d5a72305 → 0.0.0-next.d197d66a9d339318d752a1d8a96b2919faba3003
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 +1873 -1949
- package/dist/aerogel-core.js +3268 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +31 -37
- package/src/bootstrap/bootstrap.test.ts +4 -7
- package/src/bootstrap/index.ts +14 -15
- package/src/bootstrap/options.ts +1 -1
- package/src/components/AppLayout.vue +14 -0
- package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
- package/src/components/AppOverlays.vue +9 -0
- package/src/components/AppToasts.vue +16 -0
- package/src/components/contracts/AlertModal.ts +8 -0
- package/src/components/contracts/Button.ts +16 -0
- package/src/components/contracts/ConfirmModal.ts +46 -0
- package/src/components/contracts/DropdownMenu.ts +20 -0
- package/src/components/contracts/ErrorReportModal.ts +32 -0
- package/src/components/contracts/Input.ts +26 -0
- package/src/components/contracts/LoadingModal.ts +26 -0
- package/src/components/contracts/Modal.ts +21 -0
- package/src/components/contracts/PromptModal.ts +34 -0
- package/src/components/contracts/Select.ts +45 -0
- package/src/components/contracts/Toast.ts +15 -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/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +7 -8
- package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
- package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +16 -25
- package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
- package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +10 -13
- package/src/components/headless/HeadlessModal.vue +57 -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 +120 -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 +42 -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 -11
- package/src/components/ui/AdvancedOptions.vue +18 -0
- package/src/components/ui/AlertModal.vue +14 -0
- package/src/components/ui/Button.vue +98 -0
- package/src/components/ui/Checkbox.vue +56 -0
- package/src/components/ui/ConfirmModal.vue +45 -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 +67 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +34 -27
- 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 +56 -0
- package/src/components/ui/Link.vue +12 -0
- package/src/components/ui/LoadingModal.vue +34 -0
- package/src/components/ui/Markdown.vue +69 -0
- package/src/components/ui/Modal.vue +122 -0
- package/src/components/{modals/AGModalContext.vue → ui/ModalContext.vue} +8 -9
- package/src/components/ui/ProgressBar.vue +51 -0
- package/src/components/ui/PromptModal.vue +38 -0
- package/src/components/ui/Select.vue +27 -0
- package/src/components/ui/SelectLabel.vue +17 -0
- package/src/components/ui/SelectOption.vue +29 -0
- package/src/components/ui/SelectOptions.vue +35 -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 +44 -0
- package/src/components/ui/index.ts +30 -0
- package/src/directives/index.ts +9 -5
- package/src/directives/measure.ts +1 -1
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +14 -23
- package/src/errors/index.ts +9 -6
- package/src/errors/utils.ts +1 -1
- package/src/forms/{Form.test.ts → FormController.test.ts} +32 -8
- package/src/forms/{Form.ts → FormController.ts} +42 -38
- package/src/forms/index.ts +2 -3
- package/src/forms/utils.ts +35 -35
- package/src/index.css +72 -0
- package/src/jobs/Job.ts +2 -2
- package/src/jobs/listeners.ts +1 -1
- package/src/lang/DefaultLangProvider.ts +7 -4
- package/src/lang/Lang.state.ts +1 -1
- package/src/lang/Lang.ts +1 -1
- 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 +15 -4
- package/src/services/App.ts +12 -4
- package/src/services/Cache.ts +1 -1
- package/src/services/Events.test.ts +8 -8
- package/src/services/Events.ts +4 -10
- package/src/services/Service.ts +21 -21
- package/src/services/Storage.ts +3 -3
- package/src/services/index.ts +8 -4
- package/src/services/utils.ts +2 -2
- package/src/testing/index.ts +4 -3
- package/src/testing/setup.ts +3 -19
- package/src/ui/UI.state.ts +8 -13
- package/src/ui/UI.ts +124 -111
- package/src/ui/index.ts +27 -28
- package/src/utils/classes.ts +49 -0
- package/src/utils/composition/events.ts +4 -6
- package/src/utils/composition/forms.ts +20 -4
- package/src/utils/composition/state.ts +11 -2
- package/src/utils/index.ts +4 -1
- package/src/utils/markdown.ts +3 -5
- package/src/utils/types.ts +3 -0
- package/src/utils/vue.ts +25 -136
- 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/AGAppLayout.vue +0 -16
- package/src/components/AGAppOverlays.vue +0 -41
- package/src/components/AGAppSnackbars.vue +0 -13
- package/src/components/composition.ts +0 -23
- 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/AGInput.vue +0 -40
- 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.ts +0 -3
- package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
- package/src/components/headless/forms/AGHeadlessInput.ts +0 -34
- package/src/components/headless/forms/AGHeadlessInput.vue +0 -70
- 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/composition.ts +0 -10
- package/src/components/headless/forms/index.ts +0 -18
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -36
- package/src/components/headless/modals/AGHeadlessModal.vue +0 -92
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -32
- package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -23
- 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/interfaces.ts +0 -24
- package/src/components/lib/AGErrorMessage.vue +0 -16
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/lib/AGMarkdown.vue +0 -54
- package/src/components/lib/AGMeasured.vue +0 -16
- package/src/components/lib/AGProgressBar.vue +0 -30
- package/src/components/lib/index.ts +0 -6
- package/src/components/modals/AGAlertModal.ts +0 -18
- package/src/components/modals/AGAlertModal.vue +0 -14
- package/src/components/modals/AGConfirmModal.ts +0 -42
- package/src/components/modals/AGConfirmModal.vue +0 -26
- package/src/components/modals/AGErrorReportModal.ts +0 -49
- package/src/components/modals/AGErrorReportModal.vue +0 -54
- package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
- package/src/components/modals/AGLoadingModal.ts +0 -29
- package/src/components/modals/AGLoadingModal.vue +0 -15
- package/src/components/modals/AGModal.ts +0 -11
- package/src/components/modals/AGModal.vue +0 -39
- package/src/components/modals/AGModalContext.ts +0 -8
- package/src/components/modals/AGModalTitle.vue +0 -9
- package/src/components/modals/AGPromptModal.ts +0 -41
- 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/forms/composition.ts +0 -6
- 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 -17
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
{{ select.renderText(value) }}
|
|
13
|
-
</li>
|
|
14
|
-
</slot>
|
|
15
|
-
</ListboxOption>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script setup lang="ts">
|
|
19
|
-
import { ListboxOption } from '@headlessui/vue';
|
|
20
|
-
|
|
21
|
-
import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@/utils/vue';
|
|
22
|
-
import type { ComponentProps } from '@/utils/vue';
|
|
23
|
-
import type { FormFieldValue } from '@/forms/Form';
|
|
24
|
-
|
|
25
|
-
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
26
|
-
|
|
27
|
-
defineProps({
|
|
28
|
-
value: requiredMixedProp<FormFieldValue>(),
|
|
29
|
-
selectedClass: stringProp(),
|
|
30
|
-
unselectedClass: stringProp(),
|
|
31
|
-
activeClass: stringProp(),
|
|
32
|
-
inactiveClass: stringProp(),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
36
|
-
'select',
|
|
37
|
-
'<AGHeadlessSelectOption> must be a child of a <AGHeadlessSelect>',
|
|
38
|
-
);
|
|
39
|
-
</script>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { inject, onUnmounted } from 'vue';
|
|
2
|
-
|
|
3
|
-
import type Form from '@/forms/Form';
|
|
4
|
-
|
|
5
|
-
export function onFormFocus(input: { name: string | null }, listener: () => unknown): void {
|
|
6
|
-
const form = inject<Form | null>('form', null);
|
|
7
|
-
const stop = form?.on('focus', (name) => input.name === name && listener());
|
|
8
|
-
|
|
9
|
-
onUnmounted(() => stop?.());
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from './composition';
|
|
2
|
-
export * from './AGHeadlessButton';
|
|
3
|
-
export * from './AGHeadlessInput';
|
|
4
|
-
export * from './AGHeadlessSelect';
|
|
5
|
-
export * from './AGHeadlessSelectOption';
|
|
6
|
-
export { default as AGHeadlessButton } from './AGHeadlessButton.vue';
|
|
7
|
-
export { default as AGHeadlessInput } from './AGHeadlessInput.vue';
|
|
8
|
-
export { default as AGHeadlessInputDescription } from './AGHeadlessInputDescription.vue';
|
|
9
|
-
export { default as AGHeadlessInputError } from './AGHeadlessInputError.vue';
|
|
10
|
-
export { default as AGHeadlessInputInput } from './AGHeadlessInputInput.vue';
|
|
11
|
-
export { default as AGHeadlessInputLabel } from './AGHeadlessInputLabel.vue';
|
|
12
|
-
export { default as AGHeadlessInputTextArea } from './AGHeadlessInputTextArea.vue';
|
|
13
|
-
export { default as AGHeadlessSelect } from './AGHeadlessSelect.vue';
|
|
14
|
-
export { default as AGHeadlessSelectButton } from './AGHeadlessSelectButton.vue';
|
|
15
|
-
export { default as AGHeadlessSelectError } from './AGHeadlessSelectError.vue';
|
|
16
|
-
export { default as AGHeadlessSelectLabel } from './AGHeadlessSelectLabel.vue';
|
|
17
|
-
export { default as AGHeadlessSelectOption } from './AGHeadlessSelectOption.vue';
|
|
18
|
-
export { default as AGHeadlessSelectOptions } from './AGHeadlessSelectOptions';
|
|
@@ -1,36 +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
|
-
inline: booleanProp(),
|
|
17
|
-
title: stringProp(),
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function useModalProps(): typeof modalProps {
|
|
21
|
-
return modalProps;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function extractModalProps<T extends ExtractPropTypes<typeof modalProps>>(
|
|
25
|
-
props: T,
|
|
26
|
-
): Pick<T, keyof typeof modalProps> {
|
|
27
|
-
return extractComponentProps(props, modalProps);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function useModalExpose($modal: Ref<IAGHeadlessModal | undefined>): IAGModal {
|
|
31
|
-
return {
|
|
32
|
-
inline: computed(() => !!$modal.value?.inline),
|
|
33
|
-
cancellable: computed(() => !!$modal.value?.cancellable),
|
|
34
|
-
close: async () => $modal.value?.close(),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="rootComponent"
|
|
4
|
-
ref="$root"
|
|
5
|
-
:open="true"
|
|
6
|
-
@close="cancellable && close()"
|
|
7
|
-
>
|
|
8
|
-
<slot :close="close" />
|
|
9
|
-
</component>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import { computed, ref, toRef } from 'vue';
|
|
14
|
-
import { Dialog } from '@headlessui/vue';
|
|
15
|
-
import type { VNode } from 'vue';
|
|
16
|
-
|
|
17
|
-
import Events from '@/services/Events';
|
|
18
|
-
import { useEvent } from '@/utils/composition/events';
|
|
19
|
-
import { injectReactiveOrFail } from '@/utils/vue';
|
|
20
|
-
import type { IAGModalContext } from '@/components/modals/AGModalContext';
|
|
21
|
-
|
|
22
|
-
import { useModalProps } from './AGHeadlessModal';
|
|
23
|
-
import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from './AGHeadlessModal';
|
|
24
|
-
|
|
25
|
-
const props = defineProps(useModalProps());
|
|
26
|
-
const $root = ref<{ $el?: HTMLElement } | null>(null);
|
|
27
|
-
const hidden = ref(true);
|
|
28
|
-
const closed = ref(false);
|
|
29
|
-
const { modal } = injectReactiveOrFail<IAGModalContext>(
|
|
30
|
-
'modal',
|
|
31
|
-
'could not obtain modal reference from <AGHeadlessModal>, ' +
|
|
32
|
-
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
33
|
-
);
|
|
34
|
-
const rootComponent = computed(() => (modal.properties.inline ? 'div' : Dialog));
|
|
35
|
-
|
|
36
|
-
async function hide(): Promise<void> {
|
|
37
|
-
if (!$root.value?.$el) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
hidden.value = true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async function show(): Promise<void> {
|
|
45
|
-
if (!$root.value?.$el) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
hidden.value = false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function close(result?: unknown) {
|
|
53
|
-
if (closed.value) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Events.emit('modal-will-close', { modal, result });
|
|
58
|
-
|
|
59
|
-
await hide();
|
|
60
|
-
|
|
61
|
-
closed.value = true;
|
|
62
|
-
|
|
63
|
-
Events.emit('modal-closed', { modal, result });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
useEvent('close-modal', async ({ id, result }) => {
|
|
67
|
-
if (id !== modal.id) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
await close(result);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
useEvent('hide-modal', async ({ id }) => {
|
|
75
|
-
if (id !== modal.id) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
await hide();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
useEvent('show-modal', async ({ id }) => {
|
|
83
|
-
if (id !== modal.id) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
await show();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
defineSlots<{ default(props: IAGHeadlessModalDefaultSlotProps): VNode[] }>();
|
|
91
|
-
defineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable'), inline: toRef(props, 'inline') });
|
|
92
|
-
</script>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="rootComponent">
|
|
3
|
-
<slot />
|
|
4
|
-
|
|
5
|
-
<template v-if="childModal">
|
|
6
|
-
<div
|
|
7
|
-
class="pointer-events-none inset-0 z-50 bg-black/30"
|
|
8
|
-
:class="childModal.properties.inline ? 'absolute' : 'fixed'"
|
|
9
|
-
/>
|
|
10
|
-
<AGModalContext :child-index="childIndex + 1" :modal="childModal" />
|
|
11
|
-
</template>
|
|
12
|
-
</component>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import { computed } from 'vue';
|
|
17
|
-
import { DialogPanel } from '@headlessui/vue';
|
|
18
|
-
|
|
19
|
-
import UI from '@/ui/UI';
|
|
20
|
-
import { injectReactiveOrFail } from '@/utils/vue';
|
|
21
|
-
import type { IAGModalContext } from '@/components/modals/AGModalContext';
|
|
22
|
-
|
|
23
|
-
import AGModalContext from '../../modals/AGModalContext.vue';
|
|
24
|
-
|
|
25
|
-
const { modal, childIndex } = injectReactiveOrFail<IAGModalContext>(
|
|
26
|
-
'modal',
|
|
27
|
-
'could not obtain modal reference from <AGHeadlessModalPanel>, ' +
|
|
28
|
-
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
29
|
-
);
|
|
30
|
-
const rootComponent = computed(() => (modal.properties.inline ? 'div' : DialogPanel));
|
|
31
|
-
const childModal = computed(() => UI.modals[childIndex] ?? null);
|
|
32
|
-
</script>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="rootComponent" v-bind="rootProps">
|
|
3
|
-
<slot />
|
|
4
|
-
</component>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from 'vue';
|
|
9
|
-
import { DialogTitle } from '@headlessui/vue';
|
|
10
|
-
|
|
11
|
-
import { injectReactiveOrFail, stringProp } from '@/utils/vue';
|
|
12
|
-
import type { IAGModalContext } from '@/components/modals/AGModalContext';
|
|
13
|
-
|
|
14
|
-
const props = defineProps({ as: stringProp('h2') });
|
|
15
|
-
|
|
16
|
-
const { modal } = injectReactiveOrFail<IAGModalContext>(
|
|
17
|
-
'modal',
|
|
18
|
-
'could not obtain modal reference from <AGHeadlessModalPanel>, ' +
|
|
19
|
-
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
20
|
-
);
|
|
21
|
-
const rootComponent = computed(() => (modal.properties.inline ? 'div' : DialogTitle));
|
|
22
|
-
const rootProps = computed(() => (modal.properties.inline ? {} : { as: props.as }));
|
|
23
|
-
</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,24 +0,0 @@
|
|
|
1
|
-
import { isObject } from '@noeldemartin/utils';
|
|
2
|
-
import type { Ref, UnwrapNestedRefs } from 'vue';
|
|
3
|
-
|
|
4
|
-
export function getElement(value: unknown): HTMLElement | undefined {
|
|
5
|
-
if (value instanceof HTMLElement) {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
if (hasElement(value)) {
|
|
10
|
-
return value.$el;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function hasElement(value: unknown): value is UnwrapNestedRefs<HasElement> {
|
|
15
|
-
return isObject(value) && '$el' in value;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface __SetsElement {
|
|
19
|
-
__setElement(element?: HTMLElement): void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface HasElement {
|
|
23
|
-
$el: Readonly<Ref<HTMLElement | undefined>>;
|
|
24
|
-
}
|
|
@@ -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,54 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
import { renderMarkdown } from '@/utils/markdown';
|
|
10
|
-
import { booleanProp, mixedProp, objectProp, stringProp } from '@/utils/vue';
|
|
11
|
-
import { translate } from '@/lang';
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
as: stringProp(),
|
|
15
|
-
inline: booleanProp(),
|
|
16
|
-
langKey: stringProp(),
|
|
17
|
-
langParams: mixedProp<number | Record<string, unknown>>(),
|
|
18
|
-
text: stringProp(),
|
|
19
|
-
actions: objectProp<Record<string, () => unknown>>(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const attrs = useAttrs();
|
|
23
|
-
const markdown = computed(() => props.text ?? (props.langKey && translate(props.langKey, props.langParams ?? {})));
|
|
24
|
-
const html = computed(() => {
|
|
25
|
-
if (!markdown.value) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let renderedHtml = renderMarkdown(markdown.value);
|
|
30
|
-
|
|
31
|
-
if (props.inline) {
|
|
32
|
-
renderedHtml = renderedHtml.replace('<p>', '<span>').replace('</p>', '</span>');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return renderedHtml;
|
|
36
|
-
});
|
|
37
|
-
const root = () =>
|
|
38
|
-
h(props.as ?? (props.inline ? 'span' : 'div'), {
|
|
39
|
-
innerHTML: html.value,
|
|
40
|
-
onClick,
|
|
41
|
-
...attrs,
|
|
42
|
-
class: `${attrs.class ?? ''} ${props.inline ? '' : 'prose'}`,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
async function onClick(event: Event) {
|
|
46
|
-
const { target } = event;
|
|
47
|
-
|
|
48
|
-
if (isInstanceOf(target, HTMLElement) && target.dataset.markdownAction) {
|
|
49
|
-
props.actions?.[target.dataset.markdownAction]?.();
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
@@ -1,16 +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
|
-
// TODO use v-measure.css
|
|
15
|
-
const measured = ref(false);
|
|
16
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="mt-1 h-2 w-full min-w-[min(400px,80vw)] overflow-hidden rounded-full bg-gray-200">
|
|
3
|
-
<div :class="barClasses" :style="`transform:translateX(-${(1 - progress) * 100}%)`" />
|
|
4
|
-
<span class="sr-only">
|
|
5
|
-
{{
|
|
6
|
-
$td('ui.progress', '{progress}% complete', {
|
|
7
|
-
progress: progress * 100,
|
|
8
|
-
})
|
|
9
|
-
}}
|
|
10
|
-
</span>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { computed } from 'vue';
|
|
16
|
-
|
|
17
|
-
import { requiredNumberProp, stringProp } from '@/utils/vue';
|
|
18
|
-
|
|
19
|
-
const props = defineProps({
|
|
20
|
-
progress: requiredNumberProp(),
|
|
21
|
-
barClass: stringProp(''),
|
|
22
|
-
});
|
|
23
|
-
const barClasses = computed(() => {
|
|
24
|
-
const classes = props.barClass ?? '';
|
|
25
|
-
|
|
26
|
-
return `h-full w-full transition-transform duration-500 ease-linear ${
|
|
27
|
-
classes.includes('bg-') ? classes : `${classes} bg-gray-700`
|
|
28
|
-
}`;
|
|
29
|
-
});
|
|
30
|
-
</script>
|
|
@@ -1,6 +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 AGProgressBar } from './AGProgressBar.vue';
|
|
6
|
-
export { default as AGStartupCrash } from './AGStartupCrash.vue';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { ObjectWithout, Pretty } from '@noeldemartin/utils';
|
|
3
|
-
|
|
4
|
-
import { requiredStringProp, stringProp } from '@/utils';
|
|
5
|
-
import type { AcceptRefs } from '@/utils';
|
|
6
|
-
|
|
7
|
-
export const alertModalProps = {
|
|
8
|
-
title: stringProp(),
|
|
9
|
-
message: requiredStringProp(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type AGAlertModalProps = Pretty<
|
|
13
|
-
AcceptRefs<ObjectWithout<ExtractPropTypes<typeof alertModalProps>, null | undefined>>
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
export function useAlertModalProps(): typeof alertModalProps {
|
|
17
|
-
return alertModalProps;
|
|
18
|
-
}
|
|
@@ -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,42 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import type { ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout, Pretty, SubPartial } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { Colors } from '@/components/constants';
|
|
6
|
-
import { booleanProp, enumProp, objectProp, requiredStringProp, stringProp } from '@/utils';
|
|
7
|
-
import { translateWithDefault } from '@/lang';
|
|
8
|
-
import type { AcceptRefs } from '@/utils';
|
|
9
|
-
import type { ConfirmCheckboxes } from '@/ui';
|
|
10
|
-
|
|
11
|
-
export const confirmModalProps = {
|
|
12
|
-
title: stringProp(),
|
|
13
|
-
message: requiredStringProp(),
|
|
14
|
-
acceptText: stringProp(),
|
|
15
|
-
acceptColor: enumProp(Colors, Colors.Primary),
|
|
16
|
-
cancelText: stringProp(),
|
|
17
|
-
cancelColor: enumProp(Colors, Colors.Clear),
|
|
18
|
-
checkboxes: objectProp<ConfirmCheckboxes>(),
|
|
19
|
-
actions: objectProp<Record<string, () => unknown>>(),
|
|
20
|
-
required: booleanProp(false),
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type AGConfirmModalProps = Pretty<
|
|
24
|
-
AcceptRefs<
|
|
25
|
-
SubPartial<
|
|
26
|
-
ObjectWithout<ExtractPropTypes<typeof confirmModalProps>, null | undefined>,
|
|
27
|
-
'acceptColor' | 'cancelColor'
|
|
28
|
-
>
|
|
29
|
-
>
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
export function useConfirmModalProps(): typeof confirmModalProps {
|
|
33
|
-
return confirmModalProps;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
37
|
-
export function useConfirmModal(props: ExtractPropTypes<typeof confirmModalProps>) {
|
|
38
|
-
const renderedAcceptText = computed(() => props.acceptText ?? translateWithDefault('ui.accept', 'Ok'));
|
|
39
|
-
const renderedCancelText = computed(() => props.cancelText ?? translateWithDefault('ui.cancel', 'Cancel'));
|
|
40
|
-
|
|
41
|
-
return { renderedAcceptText, renderedCancelText };
|
|
42
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false" :title="title">
|
|
3
|
-
<AGMarkdown :text="message" :actions="actions" />
|
|
4
|
-
|
|
5
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
6
|
-
<AGButton :color="acceptColor" @click="close(true)">
|
|
7
|
-
{{ renderedAcceptText }}
|
|
8
|
-
</AGButton>
|
|
9
|
-
<AGButton v-if="!required" :color="cancelColor" @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,49 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue';
|
|
2
|
-
import type { Component, ExtractPropTypes } from 'vue';
|
|
3
|
-
import type { ObjectWithout, Pretty } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
import { requiredArrayProp } from '@/utils/vue';
|
|
6
|
-
import { translateWithDefault } from '@/lang';
|
|
7
|
-
import type { AcceptRefs } from '@/utils/vue';
|
|
8
|
-
import type { ErrorReport } from '@/errors';
|
|
9
|
-
|
|
10
|
-
export interface IAGErrorReportModalButtonsDefaultSlotProps {
|
|
11
|
-
id: string;
|
|
12
|
-
description: string;
|
|
13
|
-
iconComponent: Component;
|
|
14
|
-
url?: string;
|
|
15
|
-
handler?(): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const errorReportModalProps = {
|
|
19
|
-
reports: requiredArrayProp<ErrorReport>(),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type AGErrorReportModalProps = Pretty<
|
|
23
|
-
AcceptRefs<ObjectWithout<ExtractPropTypes<typeof errorReportModalProps>, null | undefined>>
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
|
-
export function useErrorReportModalProps(): typeof errorReportModalProps {
|
|
27
|
-
return errorReportModalProps;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
31
|
-
export function useErrorReportModal(props: ExtractPropTypes<typeof errorReportModalProps>) {
|
|
32
|
-
const activeReportIndex = ref(0);
|
|
33
|
-
const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);
|
|
34
|
-
const details = computed(
|
|
35
|
-
() =>
|
|
36
|
-
report.value.details?.trim() ||
|
|
37
|
-
translateWithDefault('errors.detailsEmpty', 'This error is missing a stacktrace.'),
|
|
38
|
-
);
|
|
39
|
-
const previousReportText = translateWithDefault('errors.previousReport', 'Show previous report');
|
|
40
|
-
const nextReportText = translateWithDefault('errors.nextReport', 'Show next report');
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
activeReportIndex,
|
|
44
|
-
details,
|
|
45
|
-
nextReportText,
|
|
46
|
-
previousReportText,
|
|
47
|
-
report,
|
|
48
|
-
};
|
|
49
|
-
}
|