@aerogel/core 0.0.0-next.b243de4e2590f02709edeebd8c13b74087592c04 → 0.0.0-next.b3caf219a503ce9b8c65ef1463132c9507f56c0a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aerogel-core.d.ts +1346 -1647
- package/dist/aerogel-core.js +2960 -0
- package/dist/aerogel-core.js.map +1 -0
- package/package.json +27 -37
- package/src/bootstrap/bootstrap.test.ts +4 -7
- 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 -5
- package/src/components/composition.ts +1 -1
- package/src/components/contracts/AlertModal.ts +4 -0
- package/src/components/contracts/Button.ts +15 -0
- package/src/components/contracts/ConfirmModal.ts +41 -0
- package/src/components/contracts/ErrorReportModal.ts +29 -0
- package/src/components/contracts/Input.ts +26 -0
- package/src/components/contracts/LoadingModal.ts +18 -0
- package/src/components/contracts/Modal.ts +9 -0
- package/src/components/contracts/PromptModal.ts +28 -0
- package/src/components/contracts/index.ts +7 -0
- package/src/components/contracts/shared.ts +9 -0
- package/src/components/forms/AGSelect.vue +11 -17
- package/src/components/forms/index.ts +0 -4
- package/src/components/headless/HeadlessButton.vue +45 -0
- package/src/components/headless/HeadlessInput.vue +59 -0
- package/src/components/headless/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +5 -6
- package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
- package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +10 -19
- package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
- package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +6 -9
- package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +16 -18
- package/src/components/headless/HeadlessModalContent.vue +24 -0
- package/src/components/headless/HeadlessModalOverlay.vue +12 -0
- package/src/components/headless/HeadlessModalTitle.vue +12 -0
- package/src/components/headless/forms/AGHeadlessSelect.ts +3 -3
- package/src/components/headless/forms/AGHeadlessSelect.vue +16 -16
- package/src/components/headless/forms/AGHeadlessSelectError.vue +2 -2
- package/src/components/headless/forms/AGHeadlessSelectOption.vue +10 -18
- package/src/components/headless/forms/AGHeadlessSelectOptions.vue +19 -0
- package/src/components/headless/forms/AGHeadlessSelectTrigger.vue +25 -0
- package/src/components/headless/forms/composition.ts +2 -2
- package/src/components/headless/forms/index.ts +2 -12
- package/src/components/headless/index.ts +12 -1
- package/src/components/headless/snackbars/index.ts +3 -3
- package/src/components/index.ts +5 -5
- package/src/components/lib/AGErrorMessage.vue +3 -3
- package/src/components/lib/AGMarkdown.vue +16 -3
- package/src/components/lib/AGMeasured.vue +2 -2
- package/src/components/lib/AGStartupCrash.vue +6 -6
- package/src/components/lib/index.ts +0 -1
- package/src/components/snackbars/AGSnackbar.vue +8 -6
- package/src/components/ui/AlertModal.vue +13 -0
- package/src/components/ui/Button.vue +58 -0
- package/src/components/ui/Checkbox.vue +49 -0
- package/src/components/ui/ConfirmModal.vue +42 -0
- package/src/components/ui/ErrorReportModal.vue +62 -0
- package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +29 -20
- package/src/components/ui/ErrorReportModalTitle.vue +24 -0
- package/src/components/{forms/AGForm.vue → ui/Form.vue} +4 -5
- package/src/components/ui/Input.vue +52 -0
- package/src/components/ui/Link.vue +12 -0
- package/src/components/ui/LoadingModal.vue +32 -0
- package/src/components/ui/Modal.vue +55 -0
- package/src/components/ui/ModalContext.vue +30 -0
- package/src/components/ui/ProgressBar.vue +50 -0
- package/src/components/ui/PromptModal.vue +35 -0
- package/src/components/ui/index.ts +15 -0
- package/src/components/utils.ts +106 -9
- package/src/directives/index.ts +9 -5
- package/src/directives/measure.ts +1 -1
- package/src/errors/Errors.state.ts +1 -1
- package/src/errors/Errors.ts +14 -14
- 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} +5 -4
- package/src/forms/{Form.ts → FormController.ts} +22 -19
- package/src/forms/composition.ts +4 -4
- package/src/forms/index.ts +2 -2
- package/src/forms/utils.ts +2 -2
- package/src/index.css +8 -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 +7 -4
- package/src/lang/Lang.state.ts +1 -1
- package/src/lang/Lang.ts +1 -1
- package/src/lang/index.ts +8 -6
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/index.ts +10 -7
- package/src/services/App.state.ts +13 -4
- package/src/services/App.ts +8 -3
- package/src/services/Cache.ts +1 -1
- package/src/services/Events.ts +15 -5
- package/src/services/Service.ts +116 -53
- package/src/services/Storage.ts +20 -0
- package/src/services/index.ts +11 -5
- package/src/services/utils.ts +18 -0
- package/src/testing/index.ts +4 -3
- package/src/testing/setup.ts +5 -13
- package/src/ui/UI.state.ts +10 -5
- package/src/ui/UI.ts +145 -59
- package/src/ui/index.ts +16 -16
- package/src/utils/composition/events.ts +2 -2
- package/src/utils/composition/forms.ts +4 -3
- package/src/utils/composition/persistent.test.ts +33 -0
- package/src/utils/composition/persistent.ts +11 -0
- package/src/utils/composition/state.test.ts +47 -0
- package/src/utils/composition/state.ts +24 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/markdown.test.ts +50 -0
- package/src/utils/markdown.ts +19 -6
- package/src/utils/vue.ts +11 -13
- package/dist/aerogel-core.cjs.js +0 -2
- package/dist/aerogel-core.cjs.js.map +0 -1
- package/dist/aerogel-core.esm.js +0 -2
- package/dist/aerogel-core.esm.js.map +0 -1
- package/histoire.config.ts +0 -7
- package/noeldemartin.config.js +0 -5
- package/postcss.config.js +0 -6
- package/src/assets/histoire.css +0 -3
- package/src/components/forms/AGButton.vue +0 -44
- package/src/components/forms/AGCheckbox.vue +0 -41
- package/src/components/forms/AGInput.vue +0 -40
- 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/AGHeadlessSelectButton.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
- package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
- package/src/components/headless/modals/AGHeadlessModal.ts +0 -34
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
- package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
- package/src/components/headless/modals/index.ts +0 -4
- package/src/components/interfaces.ts +0 -24
- package/src/components/lib/AGLink.vue +0 -9
- package/src/components/modals/AGAlertModal.ts +0 -15
- package/src/components/modals/AGAlertModal.vue +0 -14
- package/src/components/modals/AGConfirmModal.ts +0 -33
- 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 -36
- package/src/components/modals/AGPromptModal.vue +0 -34
- package/src/components/modals/index.ts +0 -17
- package/src/directives/initial-focus.ts +0 -11
- package/src/main.histoire.ts +0 -1
- package/tailwind.config.js +0 -4
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -17
- /package/src/components/{AGAppSnackbars.vue → AppSnackbars.vue} +0 -0
- /package/src/{main.ts → index.ts} +0 -0
|
@@ -7,15 +7,11 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { computed } from 'vue';
|
|
9
9
|
|
|
10
|
-
import { injectReactiveOrFail } from '
|
|
11
|
-
import { translateWithDefault } from '
|
|
10
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
11
|
+
import { translateWithDefault } from '@aerogel/core/lang/utils';
|
|
12
|
+
import type { InputExpose } from '@aerogel/core/components/contracts/Input';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const input = injectReactiveOrFail<IAGHeadlessInput>(
|
|
16
|
-
'input',
|
|
17
|
-
'<AGHeadlessInputError> must be a child of a <AGHeadlessInput>',
|
|
18
|
-
);
|
|
14
|
+
const input = injectReactiveOrFail<InputExpose>('input', '<HeadlessInputError> must be a child of a <HeadlessInput>');
|
|
19
15
|
const errorMessage = computed(() => {
|
|
20
16
|
if (!input.errors) {
|
|
21
17
|
return null;
|
|
@@ -17,26 +17,18 @@
|
|
|
17
17
|
<script setup lang="ts">
|
|
18
18
|
import { computed, ref, watchEffect } from 'vue';
|
|
19
19
|
|
|
20
|
-
import { injectReactiveOrFail
|
|
21
|
-
import
|
|
22
|
-
import type { FormFieldValue } from '
|
|
23
|
-
import type {
|
|
24
|
-
|
|
25
|
-
import { onFormFocus } from './composition';
|
|
26
|
-
|
|
27
|
-
const props = defineProps({
|
|
28
|
-
type: stringProp('text'),
|
|
29
|
-
});
|
|
20
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
21
|
+
import { onFormFocus } from '@aerogel/core/components/utils';
|
|
22
|
+
import type { FormFieldValue } from '@aerogel/core/forms/FormController';
|
|
23
|
+
import type { InputExpose } from '@aerogel/core/components/contracts/Input';
|
|
30
24
|
|
|
25
|
+
const { type = 'text' } = defineProps<{ type?: string }>();
|
|
31
26
|
const $input = ref<HTMLInputElement>();
|
|
32
|
-
const input = injectReactiveOrFail<
|
|
33
|
-
'input',
|
|
34
|
-
'<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>',
|
|
35
|
-
);
|
|
27
|
+
const input = injectReactiveOrFail<InputExpose>('input', '<HeadlessInputInput> must be a child of a <HeadlessInput>');
|
|
36
28
|
const name = computed(() => input.name ?? undefined);
|
|
37
29
|
const value = computed(() => input.value);
|
|
38
30
|
const checked = computed(() => {
|
|
39
|
-
if (
|
|
31
|
+
if (type !== 'checkbox') {
|
|
40
32
|
return;
|
|
41
33
|
}
|
|
42
34
|
|
|
@@ -56,7 +48,7 @@ function getValue(): FormFieldValue | null {
|
|
|
56
48
|
return null;
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
switch (
|
|
51
|
+
switch (type) {
|
|
60
52
|
case 'checkbox':
|
|
61
53
|
return $input.value.checked;
|
|
62
54
|
case 'date':
|
|
@@ -67,18 +59,17 @@ function getValue(): FormFieldValue | null {
|
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
onFormFocus(input, () => $input.value?.focus());
|
|
70
|
-
watchEffect(() => (input as unknown as __SetsElement).__setElement($input.value));
|
|
71
62
|
watchEffect(() => {
|
|
72
63
|
if (!$input.value) {
|
|
73
64
|
return;
|
|
74
65
|
}
|
|
75
66
|
|
|
76
|
-
if (
|
|
67
|
+
if (type === 'date') {
|
|
77
68
|
$input.value.valueAsDate = value.value as Date;
|
|
78
69
|
|
|
79
70
|
return;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
|
-
$input.value.value = value.value as string;
|
|
73
|
+
$input.value.value = (value.value as string) ?? null;
|
|
83
74
|
});
|
|
84
75
|
</script>
|
|
@@ -9,14 +9,10 @@
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { computed, useSlots } from 'vue';
|
|
11
11
|
|
|
12
|
-
import { injectReactiveOrFail } from '
|
|
12
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
13
|
+
import type { InputExpose } from '@aerogel/core/components/contracts/Input';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const input = injectReactiveOrFail<IAGHeadlessInput>(
|
|
17
|
-
'input',
|
|
18
|
-
'<AGHeadlessInputLabel> must be a child of a <AGHeadlessInput>',
|
|
19
|
-
);
|
|
15
|
+
const input = injectReactiveOrFail<InputExpose>('input', '<HeadlessInputLabel> must be a child of a <HeadlessInput>');
|
|
20
16
|
const slots = useSlots();
|
|
21
17
|
const show = computed(() => !!(input.label || slots.default));
|
|
22
18
|
</script>
|
package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue}
RENAMED
|
@@ -14,18 +14,16 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
|
-
import { computed, ref
|
|
17
|
+
import { computed, ref } from 'vue';
|
|
18
18
|
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import type {
|
|
22
|
-
|
|
23
|
-
import { onFormFocus } from './composition';
|
|
19
|
+
import { onFormFocus } from '@aerogel/core/components/utils';
|
|
20
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
21
|
+
import type { InputExpose } from '@aerogel/core/components/contracts/Input';
|
|
24
22
|
|
|
25
23
|
const $textArea = ref<HTMLTextAreaElement>();
|
|
26
|
-
const input = injectReactiveOrFail<
|
|
24
|
+
const input = injectReactiveOrFail<InputExpose>(
|
|
27
25
|
'input',
|
|
28
|
-
'<
|
|
26
|
+
'<HeadlessInputTextArea> must be a child of a <HeadlessInput>',
|
|
29
27
|
);
|
|
30
28
|
const name = computed(() => input.name ?? undefined);
|
|
31
29
|
const value = computed(() => input.value as string);
|
|
@@ -38,6 +36,5 @@ function update() {
|
|
|
38
36
|
input.update($textArea.value.value);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
watchEffect(() => (input as unknown as __SetsElement).__setElement($textArea.value));
|
|
42
39
|
onFormFocus(input, () => $textArea.value?.focus());
|
|
43
40
|
</script>
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
2
|
+
<DialogRoot ref="$root" :open="true" @update:open="persistent || close()">
|
|
3
|
+
<DialogPortal>
|
|
4
|
+
<slot :close="close" />
|
|
5
|
+
</DialogPortal>
|
|
6
|
+
</DialogRoot>
|
|
5
7
|
</template>
|
|
6
8
|
|
|
7
9
|
<script setup lang="ts">
|
|
8
|
-
import { ref
|
|
9
|
-
import {
|
|
10
|
-
import type { VNode } from 'vue';
|
|
10
|
+
import { ref } from 'vue';
|
|
11
|
+
import { DialogPortal, DialogRoot } from 'reka-ui';
|
|
11
12
|
|
|
12
|
-
import Events from '
|
|
13
|
-
import { useEvent } from '
|
|
14
|
-
import { injectReactiveOrFail } from '
|
|
15
|
-
import type {
|
|
13
|
+
import Events from '@aerogel/core/services/Events';
|
|
14
|
+
import { useEvent } from '@aerogel/core/utils/composition/events';
|
|
15
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
16
|
+
import type { UIModalContext } from '@aerogel/core/ui/UI.state';
|
|
17
|
+
import type { ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
defineProps<ModalProps>();
|
|
20
|
+
defineSlots<ModalSlots>();
|
|
19
21
|
|
|
20
|
-
const props = defineProps(useModalProps());
|
|
21
22
|
const $root = ref<{ $el?: HTMLElement } | null>(null);
|
|
22
23
|
const hidden = ref(true);
|
|
23
24
|
const closed = ref(false);
|
|
24
|
-
const { modal } = injectReactiveOrFail<
|
|
25
|
+
const { modal } = injectReactiveOrFail<UIModalContext>(
|
|
25
26
|
'modal',
|
|
26
|
-
'could not obtain modal reference from <
|
|
27
|
+
'could not obtain modal reference from <HeadlessModal>, ' +
|
|
27
28
|
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
28
29
|
);
|
|
29
30
|
|
|
@@ -80,7 +81,4 @@ useEvent('show-modal', async ({ id }) => {
|
|
|
80
81
|
|
|
81
82
|
await show();
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
-
defineSlots<{ default(props: IAGHeadlessModalDefaultSlotProps): VNode[] }>();
|
|
85
|
-
defineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable') });
|
|
86
84
|
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DialogContent>
|
|
3
|
+
<slot />
|
|
4
|
+
|
|
5
|
+
<ModalContext v-if="childModal" :child-index="childIndex + 1" :modal="childModal" />
|
|
6
|
+
</DialogContent>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { computed } from 'vue';
|
|
11
|
+
import { DialogContent } from 'reka-ui';
|
|
12
|
+
|
|
13
|
+
import ModalContext from '@aerogel/core/components/ui/ModalContext.vue';
|
|
14
|
+
import UI from '@aerogel/core/ui/UI';
|
|
15
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
16
|
+
import type { UIModalContext } from '@aerogel/core/ui/UI.state';
|
|
17
|
+
|
|
18
|
+
const { childIndex = 0 } = injectReactiveOrFail<UIModalContext>(
|
|
19
|
+
'modal',
|
|
20
|
+
'could not obtain modal reference from <HeadlessModalContent>, ' +
|
|
21
|
+
'did you render this component manually? Show it using $ui.openModal() instead',
|
|
22
|
+
);
|
|
23
|
+
const childModal = computed(() => UI.modals[childIndex] ?? null);
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DialogOverlay v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</DialogOverlay>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { DialogOverlay } from 'reka-ui';
|
|
9
|
+
import type { DialogOverlayProps } from 'reka-ui';
|
|
10
|
+
|
|
11
|
+
const props = defineProps<DialogOverlayProps>();
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DialogTitle v-bind="props">
|
|
3
|
+
<slot />
|
|
4
|
+
</DialogTitle>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { DialogTitle } from 'reka-ui';
|
|
9
|
+
import type { DialogTitleProps } from 'reka-ui';
|
|
10
|
+
|
|
11
|
+
const props = defineProps<DialogTitleProps>();
|
|
12
|
+
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ComputedRef, DeepReadonly, ExtractPropTypes, Ref } from 'vue';
|
|
2
2
|
import type { Writable } from '@noeldemartin/utils';
|
|
3
3
|
|
|
4
|
-
import { mixedProp, requiredArrayProp, stringProp } from '
|
|
5
|
-
import { extractComponentProps } from '
|
|
6
|
-
import type { FormFieldValue } from '
|
|
4
|
+
import { mixedProp, requiredArrayProp, stringProp } from '@aerogel/core/utils/vue';
|
|
5
|
+
import { extractComponentProps } from '@aerogel/core/components/utils';
|
|
6
|
+
import type { FormFieldValue } from '@aerogel/core/forms/FormController';
|
|
7
7
|
|
|
8
8
|
export interface IAGHeadlessSelect {
|
|
9
9
|
id: string;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@update:model-value="update($event)"
|
|
6
|
-
>
|
|
7
|
-
<slot :value="value" :open="open" :disabled="disabled" />
|
|
8
|
-
</Listbox>
|
|
2
|
+
<SelectRoot v-slot="{ open }: ComponentProps" :model-value="selectedOption" @update:model-value="update($event)">
|
|
3
|
+
<slot :model-value="modelValue" :open="open" />
|
|
4
|
+
</SelectRoot>
|
|
9
5
|
</template>
|
|
10
6
|
|
|
11
7
|
<script setup lang="ts">
|
|
12
8
|
import { computed, inject, provide } from 'vue';
|
|
13
9
|
import { toString, uuid } from '@noeldemartin/utils';
|
|
14
|
-
import {
|
|
10
|
+
import { SelectRoot } from 'reka-ui';
|
|
11
|
+
import type { AcceptableValue } from 'reka-ui';
|
|
15
12
|
|
|
16
|
-
import { mixedProp } from '
|
|
17
|
-
import { translateWithDefault } from '
|
|
18
|
-
import type
|
|
19
|
-
import type { FormFieldValue } from '
|
|
20
|
-
import type { ComponentProps } from '
|
|
13
|
+
import { mixedProp } from '@aerogel/core/utils/vue';
|
|
14
|
+
import { translateWithDefault } from '@aerogel/core/lang/utils';
|
|
15
|
+
import type FormController from '@aerogel/core/forms/FormController';
|
|
16
|
+
import type { FormFieldValue } from '@aerogel/core/forms/FormController';
|
|
17
|
+
import type { ComponentProps } from '@aerogel/core/utils/vue';
|
|
21
18
|
|
|
22
19
|
import { useSelectEmits, useSelectProps } from './AGHeadlessSelect';
|
|
23
20
|
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
@@ -38,9 +35,11 @@ const renderText = computed(() => {
|
|
|
38
35
|
|
|
39
36
|
return (option: FormFieldValue) => toString(option);
|
|
40
37
|
});
|
|
41
|
-
const form = inject<
|
|
38
|
+
const form = inject<FormController | null>('form', null);
|
|
42
39
|
const noSelectionText = computed(() => props.noSelectionText ?? translateWithDefault('select.noSelection', '-'));
|
|
43
|
-
const selectedOption = computed(
|
|
40
|
+
const selectedOption = computed(
|
|
41
|
+
() => (form && props.name ? form.getFieldValue(props.name) : props.modelValue) as AcceptableValue,
|
|
42
|
+
);
|
|
44
43
|
const errors = computed(() => {
|
|
45
44
|
if (!form || !props.name) {
|
|
46
45
|
return null;
|
|
@@ -49,7 +48,8 @@ const errors = computed(() => {
|
|
|
49
48
|
return form.errors[props.name] ?? null;
|
|
50
49
|
});
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
function update(value: any) {
|
|
53
53
|
if (form && props.name) {
|
|
54
54
|
form.setFieldValue(props.name, value);
|
|
55
55
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { computed } from 'vue';
|
|
9
9
|
|
|
10
|
-
import { injectReactiveOrFail } from '
|
|
11
|
-
import { translateWithDefault } from '
|
|
10
|
+
import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
|
|
11
|
+
import { translateWithDefault } from '@aerogel/core/lang/utils';
|
|
12
12
|
|
|
13
13
|
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
14
14
|
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
:class="{
|
|
6
|
-
[activeClass ?? 'active']: active,
|
|
7
|
-
[inactiveClass ?? 'inactive']: !active,
|
|
8
|
-
[selectedClass ?? 'selected']: selected,
|
|
9
|
-
[unselectedClass ?? 'unselected']: !selected,
|
|
10
|
-
}"
|
|
11
|
-
>
|
|
2
|
+
<SelectItem :value="value" as="template">
|
|
3
|
+
<SelectItemText>
|
|
4
|
+
<slot>
|
|
12
5
|
{{ select.renderText(value) }}
|
|
13
|
-
</
|
|
14
|
-
</
|
|
15
|
-
</
|
|
6
|
+
</slot>
|
|
7
|
+
</SelectItemText>
|
|
8
|
+
</SelectItem>
|
|
16
9
|
</template>
|
|
17
10
|
|
|
18
11
|
<script setup lang="ts">
|
|
19
|
-
import {
|
|
12
|
+
import { SelectItem, SelectItemText } from 'reka-ui';
|
|
20
13
|
|
|
21
|
-
import { injectReactiveOrFail, requiredMixedProp, stringProp } from '
|
|
22
|
-
import type { ComponentProps } from '@/utils/vue';
|
|
23
|
-
import type { FormFieldValue } from '@/forms/Form';
|
|
14
|
+
import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@aerogel/core/utils/vue';
|
|
24
15
|
|
|
25
16
|
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
26
17
|
|
|
27
18
|
defineProps({
|
|
28
|
-
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
value: requiredMixedProp<any>(),
|
|
29
21
|
selectedClass: stringProp(),
|
|
30
22
|
unselectedClass: stringProp(),
|
|
31
23
|
activeClass: stringProp(),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SelectPortal>
|
|
3
|
+
<SelectContent :class="classes">
|
|
4
|
+
<SelectViewport>
|
|
5
|
+
<slot />
|
|
6
|
+
</SelectViewport>
|
|
7
|
+
</SelectContent>
|
|
8
|
+
</SelectPortal>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { computed } from 'vue';
|
|
13
|
+
import { SelectContent, SelectPortal, SelectViewport } from 'reka-ui';
|
|
14
|
+
|
|
15
|
+
import { stringProp } from '@aerogel/core/utils/vue';
|
|
16
|
+
|
|
17
|
+
const props = defineProps({ class: stringProp('') });
|
|
18
|
+
const classes = computed(() => props.class);
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SelectTrigger>
|
|
3
|
+
<SelectValue>
|
|
4
|
+
<slot>
|
|
5
|
+
<span :class="textClass">{{ select?.buttonText }}</span>
|
|
6
|
+
</slot>
|
|
7
|
+
<slot name="icon" />
|
|
8
|
+
</SelectValue>
|
|
9
|
+
</SelectTrigger>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { SelectTrigger, SelectValue } from 'reka-ui';
|
|
14
|
+
|
|
15
|
+
import { injectReactiveOrFail, stringProp } from '@aerogel/core/utils/vue';
|
|
16
|
+
|
|
17
|
+
import type { IAGHeadlessSelect } from './AGHeadlessSelect';
|
|
18
|
+
|
|
19
|
+
defineProps({ textClass: stringProp() });
|
|
20
|
+
|
|
21
|
+
const select = injectReactiveOrFail<IAGHeadlessSelect>(
|
|
22
|
+
'select',
|
|
23
|
+
'<AGHeadlessSelectTrigger> must be a child of a <AGHeadlessSelect>',
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { inject, onUnmounted } from 'vue';
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import type FormController from '@aerogel/core/forms/FormController';
|
|
4
4
|
|
|
5
5
|
export function onFormFocus(input: { name: string | null }, listener: () => unknown): void {
|
|
6
|
-
const form = inject<
|
|
6
|
+
const form = inject<FormController | null>('form', null);
|
|
7
7
|
const stop = form?.on('focus', (name) => input.name === name && listener());
|
|
8
8
|
|
|
9
9
|
onUnmounted(() => stop?.());
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
export * from './composition';
|
|
2
|
-
export * from './AGHeadlessButton';
|
|
3
|
-
export * from './AGHeadlessInput';
|
|
4
2
|
export * from './AGHeadlessSelect';
|
|
5
3
|
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
4
|
export { default as AGHeadlessSelect } from './AGHeadlessSelect.vue';
|
|
14
|
-
export { default as
|
|
5
|
+
export { default as AGHeadlessSelectTrigger } from './AGHeadlessSelectTrigger.vue';
|
|
15
6
|
export { default as AGHeadlessSelectError } from './AGHeadlessSelectError.vue';
|
|
16
|
-
export { default as AGHeadlessSelectLabel } from './AGHeadlessSelectLabel.vue';
|
|
17
7
|
export { default as AGHeadlessSelectOption } from './AGHeadlessSelectOption.vue';
|
|
18
|
-
export { default as AGHeadlessSelectOptions } from './AGHeadlessSelectOptions';
|
|
8
|
+
export { default as AGHeadlessSelectOptions } from './AGHeadlessSelectOptions.vue';
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export * from './forms';
|
|
2
|
-
export * from './modals';
|
|
3
2
|
export * from './snackbars';
|
|
3
|
+
|
|
4
|
+
export { default as HeadlessButton } from './HeadlessButton.vue';
|
|
5
|
+
export { default as HeadlessInput } from './HeadlessInput.vue';
|
|
6
|
+
export { default as HeadlessInputDescription } from './HeadlessInputDescription.vue';
|
|
7
|
+
export { default as HeadlessInputError } from './HeadlessInputError.vue';
|
|
8
|
+
export { default as HeadlessInputInput } from './HeadlessInputInput.vue';
|
|
9
|
+
export { default as HeadlessInputLabel } from './HeadlessInputLabel.vue';
|
|
10
|
+
export { default as HeadlessInputTextArea } from './HeadlessInputTextArea.vue';
|
|
11
|
+
export { default as HeadlessModal } from './HeadlessModal.vue';
|
|
12
|
+
export { default as HeadlessModalContent } from './HeadlessModalContent.vue';
|
|
13
|
+
export { default as HeadlessModalOverlay } from './HeadlessModalOverlay.vue';
|
|
14
|
+
export { default as HeadlessModalTitle } from './HeadlessModalTitle.vue';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue';
|
|
2
2
|
import type { ObjectWithoutEmpty } from '@noeldemartin/utils';
|
|
3
3
|
|
|
4
|
-
import UI from '
|
|
5
|
-
import { arrayProp, enumProp, requiredStringProp } from '
|
|
6
|
-
import { Colors } from '
|
|
4
|
+
import UI from '@aerogel/core/ui/UI';
|
|
5
|
+
import { arrayProp, enumProp, requiredStringProp } from '@aerogel/core/utils/vue';
|
|
6
|
+
import { Colors } from '@aerogel/core/components/constants';
|
|
7
7
|
import { objectWithout } from '@noeldemartin/utils';
|
|
8
8
|
|
|
9
9
|
export { default as AGHeadlessSnackbar } from './AGHeadlessSnackbar.vue';
|
package/src/components/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import AppLayout from './AppLayout.vue';
|
|
2
|
+
import AppOverlays from './AppOverlays.vue';
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { AppLayout, AppOverlays };
|
|
5
5
|
|
|
6
6
|
export * from './composition';
|
|
7
7
|
export * from './constants';
|
|
8
|
+
export * from './contracts';
|
|
8
9
|
export * from './forms';
|
|
9
10
|
export * from './headless';
|
|
10
|
-
export * from './interfaces';
|
|
11
11
|
export * from './lib';
|
|
12
|
-
export * from './modals';
|
|
13
12
|
export * from './snackbars';
|
|
13
|
+
export * from './ui';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import { computed } from 'vue';
|
|
7
7
|
|
|
8
|
-
import { requiredObjectProp } from '
|
|
9
|
-
import { getErrorMessage } from '
|
|
10
|
-
import type { ErrorSource } from '
|
|
8
|
+
import { requiredObjectProp } from '@aerogel/core/utils/vue';
|
|
9
|
+
import { getErrorMessage } from '@aerogel/core/errors/utils';
|
|
10
|
+
import type { ErrorSource } from '@aerogel/core/errors/Errors.state';
|
|
11
11
|
|
|
12
12
|
import AGMarkdown from './AGMarkdown.vue';
|
|
13
13
|
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import { computed, h, useAttrs } from 'vue';
|
|
7
|
+
import { isInstanceOf } from '@noeldemartin/utils';
|
|
7
8
|
|
|
8
|
-
import { renderMarkdown } from '
|
|
9
|
-
import { booleanProp, mixedProp, stringProp } from '
|
|
10
|
-
import { translate } from '
|
|
9
|
+
import { renderMarkdown } from '@aerogel/core/utils/markdown';
|
|
10
|
+
import { booleanProp, mixedProp, objectProp, stringProp } from '@aerogel/core/utils/vue';
|
|
11
|
+
import { translate } from '@aerogel/core/lang';
|
|
11
12
|
|
|
12
13
|
const props = defineProps({
|
|
13
14
|
as: stringProp(),
|
|
@@ -15,6 +16,7 @@ const props = defineProps({
|
|
|
15
16
|
langKey: stringProp(),
|
|
16
17
|
langParams: mixedProp<number | Record<string, unknown>>(),
|
|
17
18
|
text: stringProp(),
|
|
19
|
+
actions: objectProp<Record<string, () => unknown>>(),
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
const attrs = useAttrs();
|
|
@@ -35,7 +37,18 @@ const html = computed(() => {
|
|
|
35
37
|
const root = () =>
|
|
36
38
|
h(props.as ?? (props.inline ? 'span' : 'div'), {
|
|
37
39
|
innerHTML: html.value,
|
|
40
|
+
onClick,
|
|
38
41
|
...attrs,
|
|
39
42
|
class: `${attrs.class ?? ''} ${props.inline ? '' : 'prose'}`,
|
|
40
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
|
+
}
|
|
41
54
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="as" v-measure="() => (measured = true)" :class="{ '!
|
|
2
|
+
<component :is="as" v-measure="() => (measured = true)" :class="{ 'invisible! absolute! w-auto!': !measured }">
|
|
3
3
|
<slot />
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { ref } from 'vue';
|
|
9
9
|
|
|
10
|
-
import { stringProp } from '
|
|
10
|
+
import { stringProp } from '@aerogel/core/utils/vue';
|
|
11
11
|
|
|
12
12
|
defineProps({ as: stringProp('span') });
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="grid
|
|
2
|
+
<div class="grid grow place-items-center">
|
|
3
3
|
<div class="flex flex-col items-center space-y-6 p-8">
|
|
4
4
|
<h1 class="mt-2 text-center text-4xl font-medium text-red-600">
|
|
5
5
|
{{ $td('startupCrash.title', 'Something went wrong!') }}
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
class="mt-4 text-center"
|
|
15
15
|
/>
|
|
16
16
|
<div class="mt-4 flex flex-col space-y-4">
|
|
17
|
-
<
|
|
17
|
+
<Button variant="danger" @click="$app.reload()">
|
|
18
18
|
{{ $td('startupCrash.reload', 'Try again') }}
|
|
19
|
-
</
|
|
20
|
-
<
|
|
19
|
+
</Button>
|
|
20
|
+
<Button variant="danger" @click="$errors.inspect($errors.startupErrors)">
|
|
21
21
|
{{ $td('startupCrash.inspect', 'View error details') }}
|
|
22
|
-
</
|
|
22
|
+
</Button>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
29
|
import AGMarkdown from './AGMarkdown.vue';
|
|
30
|
-
import
|
|
30
|
+
import Button from '../ui/Button.vue';
|
|
31
31
|
</script>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as AGErrorMessage } from './AGErrorMessage.vue';
|
|
2
|
-
export { default as AGLink } from './AGLink.vue';
|
|
3
2
|
export { default as AGMarkdown } from './AGMarkdown.vue';
|
|
4
3
|
export { default as AGMeasured } from './AGMeasured.vue';
|
|
5
4
|
export { default as AGStartupCrash } from './AGStartupCrash.vue';
|