@aerogel/core 0.0.0-next.bde642c4a8096c5fc3d5e676c2115da23f4bf1d8 → 0.0.0-next.c2e6acc000e97a1020c2e232678563c53884dd0e

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.
Files changed (166) hide show
  1. package/dist/aerogel-core.d.ts +1396 -1645
  2. package/dist/aerogel-core.js +2968 -0
  3. package/dist/aerogel-core.js.map +1 -0
  4. package/package.json +27 -37
  5. package/src/bootstrap/bootstrap.test.ts +4 -7
  6. package/src/bootstrap/index.ts +25 -16
  7. package/src/bootstrap/options.ts +1 -1
  8. package/src/components/{AGAppLayout.vue → AppLayout.vue} +4 -4
  9. package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
  10. package/src/components/{AGAppOverlays.vue → AppOverlays.vue} +5 -5
  11. package/src/components/composition.ts +1 -1
  12. package/src/components/contracts/AlertModal.ts +4 -0
  13. package/src/components/contracts/Button.ts +15 -0
  14. package/src/components/contracts/ConfirmModal.ts +41 -0
  15. package/src/components/contracts/ErrorReportModal.ts +29 -0
  16. package/src/components/contracts/Input.ts +26 -0
  17. package/src/components/contracts/LoadingModal.ts +18 -0
  18. package/src/components/contracts/Modal.ts +9 -0
  19. package/src/components/contracts/PromptModal.ts +28 -0
  20. package/src/components/contracts/index.ts +7 -0
  21. package/src/components/contracts/shared.ts +9 -0
  22. package/src/components/forms/AGSelect.vue +11 -17
  23. package/src/components/forms/index.ts +0 -4
  24. package/src/components/headless/HeadlessButton.vue +45 -0
  25. package/src/components/headless/HeadlessInput.vue +59 -0
  26. package/src/components/headless/{forms/AGHeadlessInputDescription.vue → HeadlessInputDescription.vue} +6 -7
  27. package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
  28. package/src/components/headless/{forms/AGHeadlessInputInput.vue → HeadlessInputInput.vue} +11 -19
  29. package/src/components/headless/{forms/AGHeadlessInputLabel.vue → HeadlessInputLabel.vue} +3 -7
  30. package/src/components/headless/{forms/AGHeadlessInputTextArea.vue → HeadlessInputTextArea.vue} +7 -9
  31. package/src/components/headless/{modals/AGHeadlessModal.vue → HeadlessModal.vue} +16 -18
  32. package/src/components/headless/HeadlessModalContent.vue +24 -0
  33. package/src/components/headless/HeadlessModalOverlay.vue +12 -0
  34. package/src/components/headless/HeadlessModalTitle.vue +12 -0
  35. package/src/components/headless/forms/AGHeadlessSelect.ts +3 -3
  36. package/src/components/headless/forms/AGHeadlessSelect.vue +16 -16
  37. package/src/components/headless/forms/AGHeadlessSelectError.vue +2 -2
  38. package/src/components/headless/forms/AGHeadlessSelectOption.vue +10 -18
  39. package/src/components/headless/forms/AGHeadlessSelectOptions.vue +19 -0
  40. package/src/components/headless/forms/AGHeadlessSelectTrigger.vue +25 -0
  41. package/src/components/headless/forms/composition.ts +2 -2
  42. package/src/components/headless/forms/index.ts +2 -12
  43. package/src/components/headless/index.ts +12 -1
  44. package/src/components/headless/snackbars/index.ts +3 -3
  45. package/src/components/index.ts +5 -5
  46. package/src/components/lib/AGErrorMessage.vue +5 -5
  47. package/src/components/lib/AGMeasured.vue +3 -2
  48. package/src/components/lib/AGStartupCrash.vue +8 -8
  49. package/src/components/lib/index.ts +0 -2
  50. package/src/components/snackbars/AGSnackbar.vue +10 -8
  51. package/src/components/ui/AlertModal.vue +13 -0
  52. package/src/components/ui/Button.vue +58 -0
  53. package/src/components/ui/Checkbox.vue +49 -0
  54. package/src/components/ui/ConfirmModal.vue +42 -0
  55. package/src/components/ui/ErrorReportModal.vue +62 -0
  56. package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +29 -20
  57. package/src/components/ui/ErrorReportModalTitle.vue +24 -0
  58. package/src/components/{forms/AGForm.vue → ui/Form.vue} +4 -5
  59. package/src/components/ui/Input.vue +52 -0
  60. package/src/components/ui/Link.vue +12 -0
  61. package/src/components/ui/LoadingModal.vue +32 -0
  62. package/src/components/ui/Markdown.vue +62 -0
  63. package/src/components/ui/Modal.vue +55 -0
  64. package/src/components/ui/ModalContext.vue +30 -0
  65. package/src/components/ui/ProgressBar.vue +50 -0
  66. package/src/components/ui/PromptModal.vue +35 -0
  67. package/src/components/ui/index.ts +16 -0
  68. package/src/components/utils.ts +106 -9
  69. package/src/directives/index.ts +9 -5
  70. package/src/directives/measure.ts +25 -6
  71. package/src/errors/Errors.state.ts +1 -1
  72. package/src/errors/Errors.ts +14 -14
  73. package/src/errors/JobCancelledError.ts +3 -0
  74. package/src/errors/index.ts +9 -6
  75. package/src/errors/utils.ts +17 -1
  76. package/src/forms/{Form.test.ts → FormController.test.ts} +33 -4
  77. package/src/forms/{Form.ts → FormController.ts} +46 -25
  78. package/src/forms/composition.ts +4 -4
  79. package/src/forms/index.ts +3 -2
  80. package/src/forms/utils.ts +22 -6
  81. package/src/forms/validation.ts +19 -0
  82. package/src/index.css +8 -0
  83. package/src/jobs/Job.ts +144 -2
  84. package/src/jobs/index.ts +4 -1
  85. package/src/jobs/listeners.ts +3 -0
  86. package/src/jobs/status.ts +4 -0
  87. package/src/lang/DefaultLangProvider.ts +7 -4
  88. package/src/lang/Lang.state.ts +1 -1
  89. package/src/lang/Lang.ts +5 -1
  90. package/src/lang/index.ts +8 -6
  91. package/src/plugins/Plugin.ts +1 -1
  92. package/src/plugins/index.ts +10 -7
  93. package/src/services/App.state.ts +13 -4
  94. package/src/services/App.ts +8 -3
  95. package/src/services/Cache.ts +1 -1
  96. package/src/services/Events.ts +15 -5
  97. package/src/services/Service.ts +116 -53
  98. package/src/services/Storage.ts +20 -0
  99. package/src/services/index.ts +11 -5
  100. package/src/services/utils.ts +18 -0
  101. package/src/testing/index.ts +4 -3
  102. package/src/testing/setup.ts +5 -13
  103. package/src/ui/UI.state.ts +17 -5
  104. package/src/ui/UI.ts +168 -62
  105. package/src/ui/index.ts +17 -16
  106. package/src/ui/utils.ts +16 -0
  107. package/src/utils/composition/events.ts +2 -2
  108. package/src/utils/composition/forms.ts +4 -3
  109. package/src/utils/composition/persistent.test.ts +33 -0
  110. package/src/utils/composition/persistent.ts +11 -0
  111. package/src/utils/composition/state.test.ts +47 -0
  112. package/src/utils/composition/state.ts +24 -0
  113. package/src/utils/index.ts +2 -0
  114. package/src/utils/markdown.test.ts +50 -0
  115. package/src/utils/markdown.ts +19 -6
  116. package/src/utils/vdom.ts +31 -0
  117. package/src/utils/vue.ts +18 -13
  118. package/dist/aerogel-core.cjs.js +0 -2
  119. package/dist/aerogel-core.cjs.js.map +0 -1
  120. package/dist/aerogel-core.esm.js +0 -2
  121. package/dist/aerogel-core.esm.js.map +0 -1
  122. package/histoire.config.ts +0 -7
  123. package/noeldemartin.config.js +0 -5
  124. package/postcss.config.js +0 -6
  125. package/src/assets/histoire.css +0 -3
  126. package/src/components/forms/AGButton.vue +0 -44
  127. package/src/components/forms/AGCheckbox.vue +0 -41
  128. package/src/components/forms/AGInput.vue +0 -40
  129. package/src/components/headless/forms/AGHeadlessButton.ts +0 -3
  130. package/src/components/headless/forms/AGHeadlessButton.vue +0 -62
  131. package/src/components/headless/forms/AGHeadlessInput.ts +0 -33
  132. package/src/components/headless/forms/AGHeadlessInput.vue +0 -63
  133. package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
  134. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
  135. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
  136. package/src/components/headless/modals/AGHeadlessModal.ts +0 -34
  137. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
  138. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
  139. package/src/components/headless/modals/index.ts +0 -4
  140. package/src/components/interfaces.ts +0 -24
  141. package/src/components/lib/AGLink.vue +0 -9
  142. package/src/components/lib/AGMarkdown.vue +0 -41
  143. package/src/components/modals/AGAlertModal.ts +0 -15
  144. package/src/components/modals/AGAlertModal.vue +0 -14
  145. package/src/components/modals/AGConfirmModal.ts +0 -33
  146. package/src/components/modals/AGConfirmModal.vue +0 -26
  147. package/src/components/modals/AGErrorReportModal.ts +0 -46
  148. package/src/components/modals/AGErrorReportModal.vue +0 -54
  149. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  150. package/src/components/modals/AGLoadingModal.ts +0 -23
  151. package/src/components/modals/AGLoadingModal.vue +0 -15
  152. package/src/components/modals/AGModal.ts +0 -10
  153. package/src/components/modals/AGModal.vue +0 -39
  154. package/src/components/modals/AGModalContext.ts +0 -8
  155. package/src/components/modals/AGModalContext.vue +0 -22
  156. package/src/components/modals/AGModalTitle.vue +0 -9
  157. package/src/components/modals/AGPromptModal.ts +0 -36
  158. package/src/components/modals/AGPromptModal.vue +0 -34
  159. package/src/components/modals/index.ts +0 -17
  160. package/src/directives/initial-focus.ts +0 -11
  161. package/src/main.histoire.ts +0 -1
  162. package/tailwind.config.js +0 -4
  163. package/tsconfig.json +0 -11
  164. package/vite.config.ts +0 -17
  165. /package/src/components/{AGAppSnackbars.vue → AppSnackbars.vue} +0 -0
  166. /package/src/{main.ts → index.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <slot :id="`${input.id}-description`">
3
- <AGMarkdown
3
+ <Markdown
4
4
  v-if="show"
5
5
  v-bind="$attrs"
6
6
  :id="`${input.id}-description`"
@@ -12,16 +12,15 @@
12
12
  <script setup lang="ts">
13
13
  import { computed } from 'vue';
14
14
 
15
- import { injectReactiveOrFail } from '@/utils/vue';
16
-
17
- import AGMarkdown from '../../lib/AGMarkdown.vue';
18
- import type { IAGHeadlessInput } from './AGHeadlessInput';
15
+ import Markdown from '@aerogel/core/components/ui/Markdown.vue';
16
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
17
+ import type { InputExpose } from '@aerogel/core/components/contracts/Input';
19
18
 
20
19
  defineOptions({ inheritAttrs: false });
21
20
 
22
- const input = injectReactiveOrFail<IAGHeadlessInput>(
21
+ const input = injectReactiveOrFail<InputExpose>(
23
22
  'input',
24
- '<AGHeadlessInputDescription> must be a child of a <AGHeadlessInput>',
23
+ '<HeadlessInputDescription> must be a child of a <HeadlessInput>',
25
24
  );
26
25
  const text = computed(() => (typeof input.description === 'string' ? input.description : ''));
27
26
  const show = computed(() => !!input.description);
@@ -7,15 +7,11 @@
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue';
9
9
 
10
- import { injectReactiveOrFail } from '@/utils/vue';
11
- import { translateWithDefault } from '@/lang/utils';
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
- import type { IAGHeadlessInput } from './AGHeadlessInput';
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;
@@ -4,6 +4,7 @@
4
4
  ref="$input"
5
5
  :name="name"
6
6
  :type="type"
7
+ :required="input.required ?? undefined"
7
8
  :aria-invalid="input.errors ? 'true' : 'false'"
8
9
  :aria-describedby="
9
10
  input.errors ? `${input.id}-error` : input.description ? `${input.id}-description` : undefined
@@ -16,26 +17,18 @@
16
17
  <script setup lang="ts">
17
18
  import { computed, ref, watchEffect } from 'vue';
18
19
 
19
- import { injectReactiveOrFail, stringProp } from '@/utils/vue';
20
- import type { __SetsElement } from '@/components/interfaces';
21
- import type { FormFieldValue } from '@/forms/Form';
22
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
23
-
24
- import { onFormFocus } from './composition';
25
-
26
- const props = defineProps({
27
- type: stringProp('text'),
28
- });
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';
29
24
 
25
+ const { type = 'text' } = defineProps<{ type?: string }>();
30
26
  const $input = ref<HTMLInputElement>();
31
- const input = injectReactiveOrFail<IAGHeadlessInput>(
32
- 'input',
33
- '<AGHeadlessInputInput> must be a child of a <AGHeadlessInput>',
34
- );
27
+ const input = injectReactiveOrFail<InputExpose>('input', '<HeadlessInputInput> must be a child of a <HeadlessInput>');
35
28
  const name = computed(() => input.name ?? undefined);
36
29
  const value = computed(() => input.value);
37
30
  const checked = computed(() => {
38
- if (props.type !== 'checkbox') {
31
+ if (type !== 'checkbox') {
39
32
  return;
40
33
  }
41
34
 
@@ -55,7 +48,7 @@ function getValue(): FormFieldValue | null {
55
48
  return null;
56
49
  }
57
50
 
58
- switch (props.type) {
51
+ switch (type) {
59
52
  case 'checkbox':
60
53
  return $input.value.checked;
61
54
  case 'date':
@@ -66,18 +59,17 @@ function getValue(): FormFieldValue | null {
66
59
  }
67
60
 
68
61
  onFormFocus(input, () => $input.value?.focus());
69
- watchEffect(() => (input as unknown as __SetsElement).__setElement($input.value));
70
62
  watchEffect(() => {
71
63
  if (!$input.value) {
72
64
  return;
73
65
  }
74
66
 
75
- if (props.type === 'date') {
67
+ if (type === 'date') {
76
68
  $input.value.valueAsDate = value.value as Date;
77
69
 
78
70
  return;
79
71
  }
80
72
 
81
- $input.value.value = value.value as string;
73
+ $input.value.value = (value.value as string) ?? null;
82
74
  });
83
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 '@/utils/vue';
12
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
13
+ import type { InputExpose } from '@aerogel/core/components/contracts/Input';
13
14
 
14
- import type { IAGHeadlessInput } from './AGHeadlessInput';
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>
@@ -3,6 +3,7 @@
3
3
  :id="input.id"
4
4
  ref="$textArea"
5
5
  :name="name"
6
+ :required="input.required ?? undefined"
6
7
  :value="value"
7
8
  :aria-invalid="input.errors ? 'true' : 'false'"
8
9
  :aria-describedby="
@@ -13,18 +14,16 @@
13
14
  </template>
14
15
 
15
16
  <script setup lang="ts">
16
- import { computed, ref, watchEffect } from 'vue';
17
+ import { computed, ref } from 'vue';
17
18
 
18
- import { injectReactiveOrFail } from '@/utils/vue';
19
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
20
- import type { __SetsElement } from '@/components/interfaces';
21
-
22
- 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';
23
22
 
24
23
  const $textArea = ref<HTMLTextAreaElement>();
25
- const input = injectReactiveOrFail<IAGHeadlessInput>(
24
+ const input = injectReactiveOrFail<InputExpose>(
26
25
  'input',
27
- '<AGHeadlessInputTextArea> must be a child of a <AGHeadlessInput>',
26
+ '<HeadlessInputTextArea> must be a child of a <HeadlessInput>',
28
27
  );
29
28
  const name = computed(() => input.name ?? undefined);
30
29
  const value = computed(() => input.value as string);
@@ -37,6 +36,5 @@ function update() {
37
36
  input.update($textArea.value.value);
38
37
  }
39
38
 
40
- watchEffect(() => (input as unknown as __SetsElement).__setElement($textArea.value));
41
39
  onFormFocus(input, () => $textArea.value?.focus());
42
40
  </script>
@@ -1,29 +1,30 @@
1
1
  <template>
2
- <Dialog ref="$root" :open="true" @close="cancellable && close()">
3
- <slot :close="close" />
4
- </Dialog>
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, toRef } from 'vue';
9
- import { Dialog } from '@headlessui/vue';
10
- import type { VNode } from 'vue';
10
+ import { ref } from 'vue';
11
+ import { DialogPortal, DialogRoot } from 'reka-ui';
11
12
 
12
- import Events from '@/services/Events';
13
- import { useEvent } from '@/utils/composition/events';
14
- import { injectReactiveOrFail } from '@/utils/vue';
15
- import type { IAGModalContext } from '@/components/modals/AGModalContext';
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
- import { useModalProps } from './AGHeadlessModal';
18
- import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from './AGHeadlessModal';
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<IAGModalContext>(
25
+ const { modal } = injectReactiveOrFail<UIModalContext>(
25
26
  'modal',
26
- 'could not obtain modal reference from <AGHeadlessModal>, ' +
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 '@/utils/vue';
5
- import { extractComponentProps } from '@/components/utils';
6
- import type { FormFieldValue } from '@/forms/Form';
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
- <Listbox
3
- v-slot="{ value, open, disabled }: ComponentProps"
4
- :model-value="selectedOption"
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 { Listbox } from '@headlessui/vue';
10
+ import { SelectRoot } from 'reka-ui';
11
+ import type { AcceptableValue } from 'reka-ui';
15
12
 
16
- import { mixedProp } from '@/utils/vue';
17
- import { translateWithDefault } from '@/lang/utils';
18
- import type Form from '@/forms/Form';
19
- import type { FormFieldValue } from '@/forms/Form';
20
- import type { ComponentProps } from '@/utils/vue';
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<Form | null>('form', null);
38
+ const form = inject<FormController | null>('form', null);
42
39
  const noSelectionText = computed(() => props.noSelectionText ?? translateWithDefault('select.noSelection', '-'));
43
- const selectedOption = computed(() => (form && props.name ? form.getFieldValue(props.name) : props.modelValue));
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
- function update(value: FormFieldValue) {
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 '@/utils/vue';
11
- import { translateWithDefault } from '@/lang/utils';
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
- <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
- >
2
+ <SelectItem :value="value" as="template">
3
+ <SelectItemText>
4
+ <slot>
12
5
  {{ select.renderText(value) }}
13
- </li>
14
- </slot>
15
- </ListboxOption>
6
+ </slot>
7
+ </SelectItemText>
8
+ </SelectItem>
16
9
  </template>
17
10
 
18
11
  <script setup lang="ts">
19
- import { ListboxOption } from '@headlessui/vue';
12
+ import { SelectItem, SelectItemText } from 'reka-ui';
20
13
 
21
- import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@/utils/vue';
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
- value: requiredMixedProp<FormFieldValue>(),
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 Form from '@/forms/Form';
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<Form | null>('form', null);
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 AGHeadlessSelectButton } from './AGHeadlessSelectButton.vue';
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 '@/ui/UI';
5
- import { arrayProp, enumProp, requiredStringProp } from '@/utils/vue';
6
- import { Colors } from '@/components/constants';
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';
@@ -1,13 +1,13 @@
1
- import AGAppLayout from './AGAppLayout.vue';
2
- import AGAppOverlays from './AGAppOverlays.vue';
1
+ import AppLayout from './AppLayout.vue';
2
+ import AppOverlays from './AppOverlays.vue';
3
3
 
4
- export { AGAppLayout, AGAppOverlays };
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';
@@ -1,15 +1,15 @@
1
1
  <template>
2
- <AGMarkdown :text="message" inline />
2
+ <Markdown :text="message" inline />
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
6
  import { computed } from 'vue';
7
7
 
8
- import { requiredObjectProp } from '@/utils/vue';
9
- import { getErrorMessage } from '@/errors/utils';
10
- import type { ErrorSource } from '@/errors/Errors.state';
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
- import AGMarkdown from './AGMarkdown.vue';
12
+ import Markdown from '@aerogel/core/components/ui/Markdown.vue';
13
13
 
14
14
  const props = defineProps({ error: requiredObjectProp<ErrorSource>() });
15
15
  const message = computed(() => getErrorMessage(props.error));
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component :is="as" v-measure="() => (measured = true)" :class="{ '!invisible !absolute !w-auto': !measured }">
2
+ <component :is="as" v-measure="() => (measured = true)" :class="{ 'invisible! absolute! w-auto!': !measured }">
3
3
  <slot />
4
4
  </component>
5
5
  </template>
@@ -7,9 +7,10 @@
7
7
  <script setup lang="ts">
8
8
  import { ref } from 'vue';
9
9
 
10
- import { stringProp } from '@/utils/vue';
10
+ import { stringProp } from '@aerogel/core/utils/vue';
11
11
 
12
12
  defineProps({ as: stringProp('span') });
13
13
 
14
+ // TODO use v-measure.css
14
15
  const measured = ref(false);
15
16
  </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="grid flex-grow place-items-center">
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!') }}
6
6
  </h1>
7
- <AGMarkdown
7
+ <Markdown
8
8
  :text="
9
9
  $td(
10
10
  'startupCrash.message',
@@ -14,18 +14,18 @@
14
14
  class="mt-4 text-center"
15
15
  />
16
16
  <div class="mt-4 flex flex-col space-y-4">
17
- <AGButton color="danger" @click="$app.reload()">
17
+ <Button variant="danger" @click="$app.reload()">
18
18
  {{ $td('startupCrash.reload', 'Try again') }}
19
- </AGButton>
20
- <AGButton color="danger" @click="$errors.inspect($errors.startupErrors)">
19
+ </Button>
20
+ <Button variant="danger" @click="$errors.inspect($errors.startupErrors)">
21
21
  {{ $td('startupCrash.inspect', 'View error details') }}
22
- </AGButton>
22
+ </Button>
23
23
  </div>
24
24
  </div>
25
25
  </div>
26
26
  </template>
27
27
 
28
28
  <script setup lang="ts">
29
- import AGMarkdown from './AGMarkdown.vue';
30
- import AGButton from '../forms/AGButton.vue';
29
+ import Markdown from '@aerogel/core/components/ui/Markdown.vue';
30
+ import Button from '@aerogel/core/components/ui/Button.vue';
31
31
  </script>
@@ -1,5 +1,3 @@
1
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
2
  export { default as AGMeasured } from './AGMeasured.vue';
5
3
  export { default as AGStartupCrash } from './AGStartupCrash.vue';