@aerogel/core 0.0.0-next.d824b40e5d06757cd9f47c9f771d916185df4f05 → 0.0.0-next.e4c0d5bd2801fbe93545477ea515af53df69b522
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.css +1 -0
- package/dist/aerogel-core.d.ts +2226 -912
- package/dist/aerogel-core.js +3432 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +37 -34
- package/src/bootstrap/bootstrap.test.ts +7 -10
- package/src/bootstrap/index.ts +43 -15
- package/src/bootstrap/options.ts +4 -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 +19 -0
- package/src/components/contracts/Button.ts +16 -0
- package/src/components/contracts/ConfirmModal.ts +48 -0
- package/src/components/contracts/DropdownMenu.ts +25 -0
- package/src/components/contracts/ErrorReportModal.ts +33 -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/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/HeadlessInputLabel.vue +18 -0
- package/src/components/headless/HeadlessInputTextArea.vue +40 -0
- 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/HeadlessSelectError.vue +25 -0
- 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 -9
- package/src/components/ui/AdvancedOptions.vue +18 -0
- package/src/components/ui/AlertModal.vue +17 -0
- package/src/components/ui/Button.vue +100 -0
- package/src/components/ui/Checkbox.vue +56 -0
- package/src/components/ui/ConfirmModal.vue +50 -0
- package/src/components/ui/DropdownMenu.vue +32 -0
- package/src/components/ui/DropdownMenuOption.vue +22 -0
- package/src/components/ui/DropdownMenuOptions.vue +44 -0
- package/src/components/ui/EditableContent.vue +82 -0
- package/src/components/ui/ErrorLogs.vue +19 -0
- package/src/components/ui/ErrorLogsModal.vue +48 -0
- package/src/components/ui/ErrorMessage.vue +15 -0
- package/src/components/ui/ErrorReportModal.vue +73 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +38 -29
- 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 +34 -0
- package/src/components/ui/Markdown.vue +97 -0
- package/src/components/ui/Modal.vue +123 -0
- package/src/components/ui/ModalContext.vue +31 -0
- 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/ui/StartupCrash.vue +31 -0
- package/src/components/ui/Toast.vue +46 -0
- package/src/components/ui/index.ts +32 -0
- package/src/directives/index.ts +13 -5
- package/src/directives/measure.ts +46 -0
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +41 -37
- package/src/errors/JobCancelledError.ts +3 -0
- package/src/errors/index.ts +19 -29
- package/src/errors/utils.ts +35 -0
- package/src/forms/FormController.test.ts +110 -0
- package/src/forms/FormController.ts +246 -0
- package/src/forms/index.ts +3 -2
- package/src/forms/utils.ts +51 -20
- package/src/forms/validation.ts +19 -0
- package/src/index.css +73 -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 +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 +39 -7
- package/src/services/App.ts +49 -6
- package/src/services/Cache.ts +43 -0
- package/src/services/Events.test.ts +39 -0
- package/src/services/Events.ts +110 -36
- package/src/services/Service.ts +154 -49
- package/src/services/Storage.ts +20 -0
- package/src/services/index.ts +18 -6
- 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 +14 -12
- package/src/ui/UI.ts +314 -95
- package/src/ui/index.ts +32 -27
- package/src/ui/utils.ts +16 -0
- package/src/utils/classes.ts +41 -0
- package/src/utils/composition/events.ts +4 -5
- package/src/utils/composition/forms.ts +20 -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 -0
- package/src/utils/markdown.test.ts +50 -0
- package/src/utils/markdown.ts +53 -6
- package/src/utils/types.ts +3 -0
- package/src/utils/vue.ts +38 -123
- package/.eslintrc.js +0 -3
- 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/dist/virtual.d.ts +0 -11
- package/noeldemartin.config.js +0 -5
- package/src/components/AGAppLayout.vue +0 -11
- package/src/components/AGAppOverlays.vue +0 -37
- package/src/components/AGAppSnackbars.vue +0 -13
- package/src/components/basic/AGErrorMessage.vue +0 -16
- package/src/components/basic/AGLink.vue +0 -9
- package/src/components/basic/AGMarkdown.vue +0 -36
- package/src/components/basic/index.ts +0 -5
- package/src/components/constants.ts +0 -8
- package/src/components/forms/AGButton.vue +0 -44
- package/src/components/forms/AGCheckbox.vue +0 -35
- package/src/components/forms/AGForm.vue +0 -26
- package/src/components/forms/AGInput.vue +0 -36
- package/src/components/forms/index.ts +0 -6
- package/src/components/headless/forms/AGHeadlessButton.vue +0 -51
- package/src/components/headless/forms/AGHeadlessInput.ts +0 -8
- package/src/components/headless/forms/AGHeadlessInput.vue +0 -54
- package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -45
- package/src/components/headless/forms/AGHeadlessInputLabel.vue +0 -16
- package/src/components/headless/forms/index.ts +0 -6
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -7
- package/src/components/headless/modals/AGHeadlessModal.vue +0 -88
- 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 -6
- package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
- package/src/components/headless/snackbars/index.ts +0 -25
- package/src/components/modals/AGAlertModal.vue +0 -25
- package/src/components/modals/AGConfirmModal.vue +0 -30
- package/src/components/modals/AGErrorReportModal.ts +0 -20
- package/src/components/modals/AGErrorReportModal.vue +0 -62
- package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
- package/src/components/modals/AGLoadingModal.vue +0 -19
- package/src/components/modals/AGModal.ts +0 -10
- package/src/components/modals/AGModal.vue +0 -37
- 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/index.ts +0 -23
- package/src/components/snackbars/AGSnackbar.vue +0 -42
- package/src/components/snackbars/index.ts +0 -3
- package/src/directives/initial-focus.ts +0 -11
- package/src/forms/Form.test.ts +0 -58
- package/src/forms/Form.ts +0 -176
- package/src/forms/composition.ts +0 -6
- package/src/types/virtual.d.ts +0 -11
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -14
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="component.tag" v-bind="component.props">
|
|
3
|
-
<slot />
|
|
4
|
-
</component>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from 'vue';
|
|
9
|
-
import { objectWithoutEmpty } from '@noeldemartin/utils';
|
|
10
|
-
|
|
11
|
-
import { booleanProp, objectProp, stringProp } from '@/utils/vue';
|
|
12
|
-
|
|
13
|
-
const { href, url, route, routeParams, routeQuery, submit } = defineProps({
|
|
14
|
-
href: stringProp(),
|
|
15
|
-
url: stringProp(),
|
|
16
|
-
route: stringProp(),
|
|
17
|
-
routeParams: objectProp(() => ({})),
|
|
18
|
-
routeQuery: objectProp(() => ({})),
|
|
19
|
-
submit: booleanProp(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const component = computed(() => {
|
|
23
|
-
if (route) {
|
|
24
|
-
return {
|
|
25
|
-
tag: 'router-link',
|
|
26
|
-
props: {
|
|
27
|
-
to: objectWithoutEmpty({
|
|
28
|
-
name: route,
|
|
29
|
-
params: routeParams,
|
|
30
|
-
query: routeQuery,
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (href || url) {
|
|
37
|
-
return {
|
|
38
|
-
tag: 'a',
|
|
39
|
-
props: {
|
|
40
|
-
target: '_blank',
|
|
41
|
-
href: href || url,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
tag: 'button',
|
|
48
|
-
props: { type: submit ? 'submit' : 'button' },
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
</script>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ComputedRef, DeepReadonly, Ref } from 'vue';
|
|
2
|
-
|
|
3
|
-
export interface IAGHeadlessInput {
|
|
4
|
-
id: string;
|
|
5
|
-
value: ComputedRef<string | number | boolean | null>;
|
|
6
|
-
errors: DeepReadonly<Ref<string[] | null>>;
|
|
7
|
-
update(value: string | number | boolean | null): void;
|
|
8
|
-
}
|
|
@@ -1,54 +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 type { IAGHeadlessInput } from './AGHeadlessInput';
|
|
16
|
-
|
|
17
|
-
const emit = defineEmits(['update:modelValue']);
|
|
18
|
-
const props = defineProps({
|
|
19
|
-
as: stringProp('div'),
|
|
20
|
-
name: stringProp(),
|
|
21
|
-
modelValue: mixedProp<string | number | boolean>([String, Number, Boolean]),
|
|
22
|
-
});
|
|
23
|
-
const errors = computed(() => {
|
|
24
|
-
if (!form || !props.name) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return form.errors[props.name] ?? null;
|
|
29
|
-
});
|
|
30
|
-
const form = inject<Form | null>('form', null);
|
|
31
|
-
const publicApi: IAGHeadlessInput = {
|
|
32
|
-
id: `input-${uuid()}`,
|
|
33
|
-
value: computed(() => {
|
|
34
|
-
if (form && props.name) {
|
|
35
|
-
return form.getFieldValue(props.name);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return props.modelValue;
|
|
39
|
-
}),
|
|
40
|
-
errors: readonly(errors),
|
|
41
|
-
update(value) {
|
|
42
|
-
if (form && props.name) {
|
|
43
|
-
form.setFieldValue(props.name, value);
|
|
44
|
-
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
emit('update:modelValue', value);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
provide<IAGHeadlessInput>('input', publicApi);
|
|
53
|
-
defineExpose<IAGHeadlessInput>(publicApi);
|
|
54
|
-
</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,16 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label :for="input.id">
|
|
3
|
-
<slot />
|
|
4
|
-
</label>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { injectReactiveOrFail } from '@/utils/vue';
|
|
9
|
-
|
|
10
|
-
import type { IAGHeadlessInput } from './AGHeadlessInput';
|
|
11
|
-
|
|
12
|
-
const input = injectReactiveOrFail<IAGHeadlessInput>(
|
|
13
|
-
'input',
|
|
14
|
-
'<AGHeadlessInputLabel> must be a child of a <AGHeadlessInput>',
|
|
15
|
-
);
|
|
16
|
-
</script>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { IAGHeadlessInput } from './AGHeadlessInput';
|
|
2
|
-
export { default as AGHeadlessButton } from './AGHeadlessButton.vue';
|
|
3
|
-
export { default as AGHeadlessInput } from './AGHeadlessInput.vue';
|
|
4
|
-
export { default as AGHeadlessInputError } from './AGHeadlessInputError.vue';
|
|
5
|
-
export { default as AGHeadlessInputInput } from './AGHeadlessInputInput.vue';
|
|
6
|
-
export { default as AGHeadlessInputLabel } from './AGHeadlessInputLabel.vue';
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Dialog ref="$root" :open="true" @close="cancellable && close()">
|
|
3
|
-
<slot :close="close" />
|
|
4
|
-
</Dialog>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { ref, toRef } from 'vue';
|
|
9
|
-
import { Dialog } from '@headlessui/vue';
|
|
10
|
-
import type { VNode } from 'vue';
|
|
11
|
-
|
|
12
|
-
import Events from '@/services/Events';
|
|
13
|
-
import { useEvent } from '@/utils/composition/events';
|
|
14
|
-
import { booleanProp, injectReactiveOrFail } from '@/utils/vue';
|
|
15
|
-
import type { IAGModalContext } from '@/components/modals/AGModalContext';
|
|
16
|
-
|
|
17
|
-
import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from './AGHeadlessModal';
|
|
18
|
-
|
|
19
|
-
const props = defineProps({
|
|
20
|
-
cancellable: booleanProp(true),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const $root = ref<{ $el?: HTMLElement } | null>(null);
|
|
24
|
-
const hidden = ref(true);
|
|
25
|
-
const closed = ref(false);
|
|
26
|
-
const { modal } = injectReactiveOrFail<IAGModalContext>(
|
|
27
|
-
'modal',
|
|
28
|
-
'could not obtain modal reference from <AGHeadlessModal>, ' +
|
|
29
|
-
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
async function hide(): Promise<void> {
|
|
33
|
-
if (!$root.value?.$el) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
hidden.value = true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function show(): Promise<void> {
|
|
41
|
-
if (!$root.value?.$el) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
hidden.value = false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function close(result?: unknown) {
|
|
49
|
-
if (closed.value) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
Events.emit('modal-will-close', { modal, result });
|
|
54
|
-
|
|
55
|
-
await hide();
|
|
56
|
-
|
|
57
|
-
closed.value = true;
|
|
58
|
-
|
|
59
|
-
Events.emit('modal-closed', { modal, result });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
useEvent('close-modal', async ({ id, result }) => {
|
|
63
|
-
if (id !== modal.id) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
await close(result);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
useEvent('hide-modal', async ({ id }) => {
|
|
71
|
-
if (id !== modal.id) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
await hide();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
useEvent('show-modal', async ({ id }) => {
|
|
79
|
-
if (id !== modal.id) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
await show();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
defineSlots<{ default(props: IAGHeadlessModalDefaultSlotProps): VNode[] }>();
|
|
87
|
-
defineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable') });
|
|
88
|
-
</script>
|
|
@@ -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,6 +0,0 @@
|
|
|
1
|
-
import AGHeadlessModal from './AGHeadlessModal.vue';
|
|
2
|
-
import AGHeadlessModalPanel from './AGHeadlessModalPanel.vue';
|
|
3
|
-
import AGHeadlessModalTitle from './AGHeadlessModalTitle.vue';
|
|
4
|
-
import type { IAGHeadlessModal } from './AGHeadlessModal';
|
|
5
|
-
|
|
6
|
-
export { AGHeadlessModal, AGHeadlessModalPanel, AGHeadlessModalTitle, IAGHeadlessModal };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { arrayProp, enumProp, requiredStringProp } from '@/utils/vue';
|
|
2
|
-
import { Colors } from '@/components/constants';
|
|
3
|
-
import { objectWithout } from '@noeldemartin/utils';
|
|
4
|
-
|
|
5
|
-
export { default as AGHeadlessSnackbar } from './AGHeadlessSnackbar.vue';
|
|
6
|
-
|
|
7
|
-
export interface SnackbarAction {
|
|
8
|
-
text: string;
|
|
9
|
-
dismiss?: boolean;
|
|
10
|
-
handler?(): unknown;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type SnackbarColor = (typeof SnackbarColors)[keyof typeof SnackbarColors];
|
|
14
|
-
|
|
15
|
-
export const SnackbarColors = objectWithout(Colors, ['Primary', 'Clear']);
|
|
16
|
-
export const snackbarProps = {
|
|
17
|
-
id: requiredStringProp(),
|
|
18
|
-
message: requiredStringProp(),
|
|
19
|
-
actions: arrayProp<SnackbarAction>(() => []),
|
|
20
|
-
color: enumProp(SnackbarColors, Colors.Secondary),
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function useSnackbarProps(): typeof snackbarProps {
|
|
24
|
-
return snackbarProps;
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal>
|
|
3
|
-
<AGMarkdown
|
|
4
|
-
v-if="title"
|
|
5
|
-
:text="title"
|
|
6
|
-
as="h2"
|
|
7
|
-
class="font-semibold"
|
|
8
|
-
inline
|
|
9
|
-
/>
|
|
10
|
-
<AGMarkdown :text="message" />
|
|
11
|
-
</AGModal>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { requiredStringProp, stringProp } from '@/utils/vue';
|
|
16
|
-
|
|
17
|
-
import AGModal from './AGModal.vue';
|
|
18
|
-
|
|
19
|
-
import AGMarkdown from '../basic/AGMarkdown.vue';
|
|
20
|
-
|
|
21
|
-
defineProps({
|
|
22
|
-
title: stringProp(),
|
|
23
|
-
message: requiredStringProp(),
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal v-slot="{ close }: IAGModalDefaultSlotProps" :cancellable="false">
|
|
3
|
-
<AGMarkdown v-if="title" :text="title" as="h1" />
|
|
4
|
-
<AGMarkdown :text="message" />
|
|
5
|
-
|
|
6
|
-
<div class="mt-2 flex flex-row-reverse gap-2">
|
|
7
|
-
<AGButton @click="close(true)">
|
|
8
|
-
{{ $td('ui.ok', 'OK') }}
|
|
9
|
-
</AGButton>
|
|
10
|
-
<AGButton color="secondary" @click="close()">
|
|
11
|
-
{{ $td('ui.cancel', 'Cancel') }}
|
|
12
|
-
</AGButton>
|
|
13
|
-
</div>
|
|
14
|
-
</AGModal>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import { requiredStringProp, stringProp } from '@/utils/vue';
|
|
19
|
-
|
|
20
|
-
import AGModal from './AGModal.vue';
|
|
21
|
-
import type { IAGModalDefaultSlotProps } from './AGModal';
|
|
22
|
-
|
|
23
|
-
import AGButton from '../forms/AGButton.vue';
|
|
24
|
-
import AGMarkdown from '../basic/AGMarkdown.vue';
|
|
25
|
-
|
|
26
|
-
defineProps({
|
|
27
|
-
title: stringProp(),
|
|
28
|
-
message: requiredStringProp(),
|
|
29
|
-
});
|
|
30
|
-
</script>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Component } from 'vue';
|
|
2
|
-
|
|
3
|
-
import { requiredArrayProp } from '@/utils/vue';
|
|
4
|
-
import type { ErrorReport } from '@/errors';
|
|
5
|
-
|
|
6
|
-
export interface IAGErrorReportModalButtonsDefaultSlotProps {
|
|
7
|
-
id: string;
|
|
8
|
-
description: string;
|
|
9
|
-
iconComponent: Component;
|
|
10
|
-
url?: string;
|
|
11
|
-
handler?(): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const errorReportModalProps = {
|
|
15
|
-
reports: requiredArrayProp<ErrorReport>(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function useErrorReportModalProps(): typeof errorReportModalProps {
|
|
19
|
-
return errorReportModalProps;
|
|
20
|
-
}
|
|
@@ -1,62 +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="$td('errors.previousReport', 'Show previous report')"
|
|
16
|
-
:aria-label="$td('errors.previousReport', 'Show previous report')"
|
|
17
|
-
@click="activeReportIndex--"
|
|
18
|
-
>
|
|
19
|
-
<IconCheveronLeft aria-hidden="true" class="h-4 w-4" />
|
|
20
|
-
</AGButton>
|
|
21
|
-
<AGButton
|
|
22
|
-
color="clear"
|
|
23
|
-
:disabled="activeReportIndex === reports.length - 1"
|
|
24
|
-
:title="$td('errors.nextReport', 'Show next report')"
|
|
25
|
-
:aria-label="$td('errors.nextReport', 'Show next report')"
|
|
26
|
-
@click="activeReportIndex++"
|
|
27
|
-
>
|
|
28
|
-
<IconCheveronRight aria-hidden="true" class="h-4 w-4" />
|
|
29
|
-
</AGButton>
|
|
30
|
-
</template>
|
|
31
|
-
</div>
|
|
32
|
-
<AGErrorReportModalButtons :report="report" />
|
|
33
|
-
</h2>
|
|
34
|
-
<AGMarkdown v-if="report.description" :text="report.description" class="mt-2" />
|
|
35
|
-
</div>
|
|
36
|
-
<pre
|
|
37
|
-
class="h-full overflow-auto bg-gray-200 p-4 text-xs text-red-900"
|
|
38
|
-
v-text="report.details ?? $td('errors.detailsEmpty', 'This error is missing a stacktrace.')"
|
|
39
|
-
/>
|
|
40
|
-
</AGModal>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script setup lang="ts">
|
|
44
|
-
import IconCheveronRight from '~icons/zondicons/cheveron-right';
|
|
45
|
-
import IconCheveronLeft from '~icons/zondicons/cheveron-left';
|
|
46
|
-
|
|
47
|
-
import { computed, ref } from 'vue';
|
|
48
|
-
|
|
49
|
-
import type { ErrorReport } from '@/errors';
|
|
50
|
-
|
|
51
|
-
import { useErrorReportModalProps } from './AGErrorReportModal';
|
|
52
|
-
|
|
53
|
-
import AGButton from '../forms/AGButton.vue';
|
|
54
|
-
import AGErrorReportModalButtons from './AGErrorReportModalButtons.vue';
|
|
55
|
-
import AGErrorReportModalTitle from './AGErrorReportModalTitle.vue';
|
|
56
|
-
import AGMarkdown from '../basic/AGMarkdown.vue';
|
|
57
|
-
import AGModal from './AGModal.vue';
|
|
58
|
-
|
|
59
|
-
const props = defineProps(useErrorReportModalProps());
|
|
60
|
-
const activeReportIndex = ref(0);
|
|
61
|
-
const report = computed(() => props.reports[activeReportIndex.value] as ErrorReport);
|
|
62
|
-
</script>
|
|
@@ -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 '../basic/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,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGModal :cancellable="false">
|
|
3
|
-
<AGMarkdown :text="renderedMessage" />
|
|
4
|
-
</AGModal>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from 'vue';
|
|
9
|
-
|
|
10
|
-
import { stringProp } from '@/utils/vue';
|
|
11
|
-
import { translateWithDefault } from '@/lang/utils';
|
|
12
|
-
|
|
13
|
-
import AGModal from './AGModal.vue';
|
|
14
|
-
|
|
15
|
-
import AGMarkdown from '../basic/AGMarkdown.vue';
|
|
16
|
-
|
|
17
|
-
const props = defineProps({ message: stringProp() });
|
|
18
|
-
const renderedMessage = computed(() => props.message ?? translateWithDefault('ui.loading', 'Loading...'));
|
|
19
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AGHeadlessModal
|
|
3
|
-
ref="$headlessModal"
|
|
4
|
-
v-slot="{ close }: IAGHeadlessModalDefaultSlotProps"
|
|
5
|
-
:cancellable="cancellable"
|
|
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">
|
|
10
|
-
<div class="flex max-h-full flex-col overflow-auto p-4" v-bind="$attrs">
|
|
11
|
-
<slot :close="close" />
|
|
12
|
-
</div>
|
|
13
|
-
</AGHeadlessModalPanel>
|
|
14
|
-
</div>
|
|
15
|
-
</AGHeadlessModal>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script setup lang="ts">
|
|
19
|
-
import { computed, ref } from 'vue';
|
|
20
|
-
|
|
21
|
-
import { booleanProp } from '@/utils';
|
|
22
|
-
import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from '@/components/headless/modals/AGHeadlessModal';
|
|
23
|
-
|
|
24
|
-
import type { IAGModal } from './AGModal';
|
|
25
|
-
|
|
26
|
-
import AGHeadlessModal from '../headless/modals/AGHeadlessModal.vue';
|
|
27
|
-
import AGHeadlessModalPanel from '../headless/modals/AGHeadlessModalPanel.vue';
|
|
28
|
-
|
|
29
|
-
const $headlessModal = ref<IAGHeadlessModal>();
|
|
30
|
-
|
|
31
|
-
defineOptions({ inheritAttrs: false });
|
|
32
|
-
defineProps({ cancellable: booleanProp(true) });
|
|
33
|
-
defineExpose<IAGModal>({
|
|
34
|
-
close: async () => $headlessModal.value?.close(),
|
|
35
|
-
cancellable: computed(() => !!$headlessModal.value?.cancellable),
|
|
36
|
-
});
|
|
37
|
-
</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>
|