@aerogel/core 0.0.0-next.d7394c3aa6aac799b0971e63819a8713d05a5123 → 0.0.0-next.eed7a057cf5b844cd9f7fc6bda2d8df49fcd6736

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 (116) hide show
  1. package/dist/aerogel-core.d.ts +2317 -667
  2. package/dist/aerogel-core.js +2789 -0
  3. package/dist/aerogel-core.js.map +1 -0
  4. package/package.json +19 -34
  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 +1 -1
  9. package/src/components/AGAppModals.vue +1 -1
  10. package/src/components/AGAppOverlays.vue +1 -1
  11. package/src/components/composition.ts +1 -1
  12. package/src/components/forms/AGButton.vue +2 -2
  13. package/src/components/forms/AGCheckbox.vue +4 -3
  14. package/src/components/forms/AGForm.vue +2 -2
  15. package/src/components/forms/AGInput.vue +6 -4
  16. package/src/components/forms/AGSelect.vue +3 -3
  17. package/src/components/headless/forms/AGHeadlessButton.ts +1 -1
  18. package/src/components/headless/forms/AGHeadlessButton.vue +2 -2
  19. package/src/components/headless/forms/AGHeadlessInput.ts +11 -4
  20. package/src/components/headless/forms/AGHeadlessInput.vue +3 -3
  21. package/src/components/headless/forms/AGHeadlessInputDescription.vue +1 -1
  22. package/src/components/headless/forms/AGHeadlessInputError.vue +2 -2
  23. package/src/components/headless/forms/AGHeadlessInputInput.vue +4 -4
  24. package/src/components/headless/forms/AGHeadlessInputLabel.vue +1 -1
  25. package/src/components/headless/forms/AGHeadlessInputTextArea.vue +3 -3
  26. package/src/components/headless/forms/AGHeadlessSelect.ts +3 -3
  27. package/src/components/headless/forms/AGHeadlessSelect.vue +5 -5
  28. package/src/components/headless/forms/AGHeadlessSelectButton.vue +2 -2
  29. package/src/components/headless/forms/AGHeadlessSelectError.vue +2 -2
  30. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +2 -2
  31. package/src/components/headless/forms/AGHeadlessSelectOption.vue +3 -3
  32. package/src/components/headless/forms/composition.ts +1 -1
  33. package/src/components/headless/modals/AGHeadlessModal.ts +6 -4
  34. package/src/components/headless/modals/AGHeadlessModal.vue +14 -8
  35. package/src/components/headless/modals/AGHeadlessModalPanel.vue +13 -9
  36. package/src/components/headless/modals/AGHeadlessModalTitle.vue +14 -4
  37. package/src/components/headless/snackbars/index.ts +3 -3
  38. package/src/components/lib/AGErrorMessage.vue +3 -3
  39. package/src/components/lib/AGMarkdown.vue +16 -3
  40. package/src/components/lib/AGMeasured.vue +1 -1
  41. package/src/components/lib/AGProgressBar.vue +55 -0
  42. package/src/components/lib/index.ts +1 -0
  43. package/src/components/modals/AGAlertModal.ts +6 -3
  44. package/src/components/modals/AGConfirmModal.ts +16 -7
  45. package/src/components/modals/AGConfirmModal.vue +2 -2
  46. package/src/components/modals/AGErrorReportModal.ts +8 -5
  47. package/src/components/modals/AGErrorReportModalButtons.vue +9 -9
  48. package/src/components/modals/AGErrorReportModalTitle.vue +2 -2
  49. package/src/components/modals/AGLoadingModal.ts +11 -5
  50. package/src/components/modals/AGModal.ts +1 -0
  51. package/src/components/modals/AGModal.vue +5 -2
  52. package/src/components/modals/AGModalContext.ts +1 -1
  53. package/src/components/modals/AGModalContext.vue +15 -5
  54. package/src/components/modals/AGPromptModal.ts +12 -7
  55. package/src/components/snackbars/AGSnackbar.vue +2 -2
  56. package/src/components/utils.ts +7 -4
  57. package/src/directives/index.ts +3 -5
  58. package/src/directives/measure.ts +1 -1
  59. package/src/errors/Errors.state.ts +1 -1
  60. package/src/errors/Errors.ts +12 -12
  61. package/src/errors/JobCancelledError.ts +3 -0
  62. package/src/errors/index.ts +9 -6
  63. package/src/errors/utils.ts +17 -1
  64. package/src/forms/Form.test.ts +4 -3
  65. package/src/forms/Form.ts +27 -17
  66. package/src/forms/composition.ts +2 -2
  67. package/src/forms/index.ts +2 -1
  68. package/src/forms/utils.ts +20 -4
  69. package/src/forms/validation.ts +19 -0
  70. package/src/jobs/Job.ts +144 -2
  71. package/src/jobs/index.ts +4 -1
  72. package/src/jobs/listeners.ts +3 -0
  73. package/src/jobs/status.ts +4 -0
  74. package/src/lang/DefaultLangProvider.ts +7 -4
  75. package/src/lang/Lang.state.ts +1 -1
  76. package/src/lang/Lang.ts +5 -1
  77. package/src/lang/index.ts +7 -5
  78. package/src/plugins/Plugin.ts +1 -1
  79. package/src/plugins/index.ts +10 -7
  80. package/src/services/App.state.ts +13 -4
  81. package/src/services/App.ts +8 -3
  82. package/src/services/Cache.ts +1 -1
  83. package/src/services/Events.ts +15 -5
  84. package/src/services/Service.ts +116 -53
  85. package/src/services/Storage.ts +20 -0
  86. package/src/services/index.ts +10 -4
  87. package/src/services/utils.ts +18 -0
  88. package/src/testing/index.ts +4 -3
  89. package/src/testing/setup.ts +5 -19
  90. package/src/ui/UI.state.ts +2 -2
  91. package/src/ui/UI.ts +139 -54
  92. package/src/ui/index.ts +4 -4
  93. package/src/ui/utils.ts +1 -1
  94. package/src/utils/composition/events.ts +2 -2
  95. package/src/utils/composition/persistent.test.ts +33 -0
  96. package/src/utils/composition/persistent.ts +11 -0
  97. package/src/utils/composition/state.test.ts +47 -0
  98. package/src/utils/composition/state.ts +24 -0
  99. package/src/utils/index.ts +2 -0
  100. package/src/utils/markdown.test.ts +50 -0
  101. package/src/utils/markdown.ts +19 -6
  102. package/src/utils/vue.ts +14 -4
  103. package/dist/aerogel-core.cjs.js +0 -2
  104. package/dist/aerogel-core.cjs.js.map +0 -1
  105. package/dist/aerogel-core.esm.js +0 -2
  106. package/dist/aerogel-core.esm.js.map +0 -1
  107. package/histoire.config.ts +0 -7
  108. package/noeldemartin.config.js +0 -5
  109. package/postcss.config.js +0 -6
  110. package/src/assets/histoire.css +0 -3
  111. package/src/directives/initial-focus.ts +0 -11
  112. package/src/main.histoire.ts +0 -1
  113. package/tailwind.config.js +0 -4
  114. package/tsconfig.json +0 -11
  115. package/vite.config.ts +0 -17
  116. /package/src/{main.ts → index.ts} +0 -0
package/package.json CHANGED
@@ -1,51 +1,36 @@
1
1
  {
2
2
  "name": "@aerogel/core",
3
- "description": "The Lightest Solid",
4
- "version": "0.0.0-next.d7394c3aa6aac799b0971e63819a8713d05a5123",
5
- "main": "dist/aerogel-core.cjs.js",
6
- "module": "dist/aerogel-core.esm.js",
7
- "types": "dist/aerogel-core.d.ts",
3
+ "version": "0.0.0-next.eed7a057cf5b844cd9f7fc6bda2d8df49fcd6736",
4
+ "type": "module",
8
5
  "sideEffects": false,
9
- "scripts": {
10
- "build": "rm dist -rf && npm run build:js && npm run build:types",
11
- "build:js": "noeldemartin-build-javascript",
12
- "build:types": "noeldemartin-build-types",
13
- "histoire": "histoire dev",
14
- "lint": "noeldemartin-lint src",
15
- "publish-next": "noeldemartin-publish-next",
16
- "test": "vitest --run",
17
- "test:ci": "vitest --run --reporter verbose"
18
- },
19
- "engines": {
20
- "node": ">=18.x"
21
- },
22
- "repository": {
23
- "type": "git",
24
- "url": "https://github.com/NoelDeMartin/aerogeljs.git"
6
+ "exports": {
7
+ "types": "./dist/aerogel-core.d.ts",
8
+ "default": "./dist/aerogel-core.js"
25
9
  },
26
- "keywords": [
27
- "javascript",
28
- "framework",
29
- "solid"
10
+ "files": [
11
+ "src",
12
+ "dist"
30
13
  ],
31
- "author": "Noel De Martin",
32
14
  "license": "MIT",
33
- "bugs": {
34
- "url": "https://github.com/NoelDeMartin/aerogeljs/issues"
15
+ "author": "Noel De Martin",
16
+ "repository": "github:NoelDeMartin/aerogel",
17
+ "scripts": {
18
+ "build": "vite build && ./scripts/fix-types.sh",
19
+ "lint": "noeldemartin-lint src",
20
+ "test": "vitest --run",
21
+ "test:ci": "vitest --run --reporter verbose",
22
+ "verify": "noeldemartin-verify"
35
23
  },
36
24
  "dependencies": {
37
25
  "@headlessui/vue": "^1.7.14",
38
- "@noeldemartin/utils": "0.5.1-next.4fd89de2cbde6c7e1cfa4d5f9bdac234e9cd3d98",
39
- "dompurify": "^3.0.3",
40
- "marked": "^5.0.4",
26
+ "@noeldemartin/utils": "0.7.0-next.febf11f10be81ab8b5562e4fe2cddbd1929ac9ca",
27
+ "dompurify": "^3.2.4",
28
+ "marked": "^15.0.7",
41
29
  "pinia": "^2.1.6",
42
30
  "vue": "^3.3.0"
43
31
  },
44
32
  "devDependencies": {
45
33
  "@aerogel/vite": "*",
46
- "@histoire/plugin-vue": "^0.17.6",
47
- "@types/dompurify": "^3.0.2",
48
- "@types/marked": "^5.0.0",
49
34
  "tailwindcss": "^3.3.5"
50
35
  },
51
36
  "eslintConfig": {
@@ -1,10 +1,10 @@
1
1
  import { beforeEach, describe, expect, it, vi } from 'vitest';
2
2
  import { createApp } from 'vue';
3
- import { mock } from '@noeldemartin/utils';
3
+ import { mock } from '@noeldemartin/testing';
4
4
  import type { Component } from 'vue';
5
5
 
6
- import Events from '@/services/Events';
7
- import initialFocus from '@/directives/initial-focus';
6
+ import Events from '@aerogel/core/services/Events';
7
+ import measure from '@aerogel/core/directives/measure';
8
8
 
9
9
  import { bootstrap } from './index';
10
10
 
@@ -48,10 +48,7 @@ describe('Aerogel', () => {
48
48
  await bootstrap(rootComponent);
49
49
 
50
50
  // Assert
51
- expect(vi.mocked(createApp).mock.results[0]?.value.directive).toHaveBeenCalledWith(
52
- 'initial-focus',
53
- initialFocus,
54
- );
51
+ expect(vi.mocked(createApp).mock.results[0]?.value.directive).toHaveBeenCalledWith('measure', measure);
55
52
  });
56
53
 
57
54
  });
@@ -1,21 +1,25 @@
1
1
  import { createApp } from 'vue';
2
- import type { App, Component } from 'vue';
3
-
4
- import directives from '@/directives';
5
- import errors from '@/errors';
6
- import Events from '@/services/Events';
7
- import lang from '@/lang';
8
- import services from '@/services';
9
- import testing from '@/testing';
10
- import ui from '@/ui';
11
- import { installPlugins } from '@/plugins';
12
- import type { AerogelOptions } from '@/bootstrap/options';
13
-
14
- export { AerogelOptions };
15
-
16
- export async function bootstrapApplication(app: App, options: AerogelOptions = {}): Promise<void> {
2
+ import { isDevelopment } from '@noeldemartin/utils';
3
+ import type { App as AppInstance, Component } from 'vue';
4
+
5
+ import App from '@aerogel/core/services/App';
6
+ import directives from '@aerogel/core/directives';
7
+ import errors from '@aerogel/core/errors';
8
+ import Events from '@aerogel/core/services/Events';
9
+ import lang from '@aerogel/core/lang';
10
+ import services from '@aerogel/core/services';
11
+ import testing from '@aerogel/core/testing';
12
+ import ui from '@aerogel/core/ui';
13
+ import { installPlugins } from '@aerogel/core/plugins';
14
+ import type { AerogelOptions } from '@aerogel/core/bootstrap/options';
15
+
16
+ export type { AerogelOptions };
17
+
18
+ export async function bootstrapApplication(app: AppInstance, options: AerogelOptions = {}): Promise<void> {
17
19
  const plugins = [testing, directives, errors, lang, services, ui, ...(options.plugins ?? [])];
18
20
 
21
+ App.instance = app;
22
+
19
23
  await installPlugins(plugins, app, options);
20
24
  await options.install?.(app);
21
25
  await Events.emit('application-ready');
@@ -24,6 +28,11 @@ export async function bootstrapApplication(app: App, options: AerogelOptions = {
24
28
  export async function bootstrap(rootComponent: Component, options: AerogelOptions = {}): Promise<void> {
25
29
  const app = createApp(rootComponent);
26
30
 
31
+ if (isDevelopment()) {
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ (window as any).$aerogel = app;
34
+ }
35
+
27
36
  await bootstrapApplication(app, options);
28
37
 
29
38
  app.mount('#app');
@@ -32,7 +41,7 @@ export async function bootstrap(rootComponent: Component, options: AerogelOption
32
41
  await Events.emit('application-mounted');
33
42
  }
34
43
 
35
- declare module '@/services/Events' {
44
+ declare module '@aerogel/core/services/Events' {
36
45
  export interface EventsPayload {
37
46
  'application-ready': void;
38
47
  'application-mounted': void;
@@ -1,6 +1,6 @@
1
1
  import type { App } from 'vue';
2
2
 
3
- import type { Plugin } from '@/plugins';
3
+ import type { Plugin } from '@aerogel/core/plugins';
4
4
 
5
5
  export interface AerogelOptions {
6
6
  plugins?: Plugin[];
@@ -10,7 +10,7 @@
10
10
  </template>
11
11
 
12
12
  <script setup lang="ts">
13
- import { UIComponents } from '@/ui/UI';
13
+ import { UIComponents } from '@aerogel/core/ui/UI';
14
14
 
15
15
  import AGAppOverlays from './AGAppOverlays.vue';
16
16
  </script>
@@ -7,7 +7,7 @@
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue';
9
9
 
10
- import UI from '@/ui/UI';
10
+ import UI from '@aerogel/core/ui/UI';
11
11
 
12
12
  import AGModalContext from './modals/AGModalContext.vue';
13
13
 
@@ -11,7 +11,7 @@
11
11
  <script setup lang="ts">
12
12
  import { ref } from 'vue';
13
13
 
14
- import { useEvent } from '@/utils/composition/events';
14
+ import { useEvent } from '@aerogel/core/utils/composition/events';
15
15
 
16
16
  import AGAppModals from './AGAppModals.vue';
17
17
  import AGAppSnackbars from './AGAppSnackbars.vue';
@@ -1,7 +1,7 @@
1
1
  import { customRef } from 'vue';
2
2
  import type { Ref } from 'vue';
3
3
 
4
- import { getElement } from '@/components/interfaces';
4
+ import { getElement } from '@aerogel/core/components/interfaces';
5
5
 
6
6
  export function elementRef(): Ref<HTMLElement | undefined> {
7
7
  return customRef((track, trigger) => {
@@ -7,8 +7,8 @@
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue';
9
9
 
10
- import { enumProp } from '@/utils/vue';
11
- import { Colors } from '@/components/constants';
10
+ import { enumProp } from '@aerogel/core/utils/vue';
11
+ import { Colors } from '@aerogel/core/components/constants';
12
12
 
13
13
  import AGHeadlessButton from '../headless/forms/AGHeadlessButton.vue';
14
14
 
@@ -24,9 +24,10 @@
24
24
  </template>
25
25
 
26
26
  <script setup lang="ts">
27
- import { componentRef, stringProp } from '@/utils/vue';
27
+ import { componentRef, stringProp } from '@aerogel/core/utils/vue';
28
28
 
29
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
29
+ import { useInputEmits } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
30
+ import type { IAGHeadlessInput } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
30
31
 
31
32
  import AGHeadlessInput from '../headless/forms/AGHeadlessInput.vue';
32
33
  import AGHeadlessInputError from '../headless/forms/AGHeadlessInputError.vue';
@@ -35,7 +36,7 @@ import AGHeadlessInputLabel from '../headless/forms/AGHeadlessInputLabel.vue';
35
36
 
36
37
  defineProps({ name: stringProp() });
37
38
  defineOptions({ inheritAttrs: false });
38
- defineEmits(['update:modelValue']);
39
+ defineEmits(useInputEmits());
39
40
 
40
41
  const $input = componentRef<IAGHeadlessInput>();
41
42
  </script>
@@ -7,8 +7,8 @@
7
7
  <script setup lang="ts">
8
8
  import { provide, watchEffect } from 'vue';
9
9
 
10
- import { objectProp } from '@/utils/vue';
11
- import type Form from '@/forms/Form';
10
+ import { objectProp } from '@aerogel/core/utils/vue';
11
+ import type Form from '@aerogel/core/forms/Form';
12
12
 
13
13
  let offSubmit: (() => void) | undefined;
14
14
  const props = defineProps({ form: objectProp<Form>() });
@@ -4,6 +4,7 @@
4
4
  class="relative flex flex-col items-center"
5
5
  :class="className"
6
6
  v-bind="props"
7
+ @update:model-value="$emit('update:modelValue', $event)"
7
8
  >
8
9
  <AGHeadlessInputLabel class="sr-only" />
9
10
  <AGHeadlessInputInput
@@ -21,10 +22,10 @@
21
22
  </template>
22
23
 
23
24
  <script setup lang="ts">
24
- import { componentRef } from '@/utils/vue';
25
- import { useInputAttrs } from '@/utils/composition/forms';
26
- import { useInputProps } from '@/components/headless/forms/AGHeadlessInput';
27
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
25
+ import { componentRef } from '@aerogel/core/utils/vue';
26
+ import { useInputAttrs } from '@aerogel/core/utils/composition/forms';
27
+ import { useInputEmits, useInputProps } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
28
+ import type { IAGHeadlessInput } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
28
29
 
29
30
  import AGHeadlessInput from '../headless/forms/AGHeadlessInput.vue';
30
31
  import AGHeadlessInputDescription from '../headless/forms/AGHeadlessInputDescription.vue';
@@ -33,6 +34,7 @@ import AGHeadlessInputInput from '../headless/forms/AGHeadlessInputInput.vue';
33
34
  import AGHeadlessInputLabel from '../headless/forms/AGHeadlessInputLabel.vue';
34
35
 
35
36
  defineOptions({ inheritAttrs: false });
37
+ defineEmits(useInputEmits());
36
38
 
37
39
  const props = defineProps(useInputProps());
38
40
  const $input = componentRef<IAGHeadlessInput>();
@@ -42,9 +42,9 @@
42
42
  <script setup lang="ts">
43
43
  import IconCheveronDown from '~icons/zondicons/cheveron-down';
44
44
 
45
- import { componentRef } from '@/utils/vue';
46
- import { useSelectEmits, useSelectProps } from '@/components/headless/forms/AGHeadlessSelect';
47
- import type { IAGHeadlessSelect } from '@/components/headless/forms/AGHeadlessSelect';
45
+ import { componentRef } from '@aerogel/core/utils/vue';
46
+ import { useSelectEmits, useSelectProps } from '@aerogel/core/components/headless/forms/AGHeadlessSelect';
47
+ import type { IAGHeadlessSelect } from '@aerogel/core/components/headless/forms/AGHeadlessSelect';
48
48
 
49
49
  import AGHeadlessSelect from '../headless/forms/AGHeadlessSelect.vue';
50
50
  import AGHeadlessSelectButton from '../headless/forms/AGHeadlessSelectButton.vue';
@@ -1,3 +1,3 @@
1
- import type { HasElement } from '@/components/interfaces';
1
+ import type { HasElement } from '@aerogel/core/components/interfaces';
2
2
 
3
3
  export interface IAGHeadlessButton extends HasElement {}
@@ -8,8 +8,8 @@
8
8
  import { computed } from 'vue';
9
9
  import { objectWithoutEmpty } from '@noeldemartin/utils';
10
10
 
11
- import { booleanProp, objectProp, stringProp } from '@/utils/vue';
12
- import { elementRef } from '@/components/composition';
11
+ import { booleanProp, objectProp, stringProp } from '@aerogel/core/utils/vue';
12
+ import { elementRef } from '@aerogel/core/components/composition';
13
13
 
14
14
  import type { IAGHeadlessButton } from './AGHeadlessButton';
15
15
 
@@ -1,9 +1,10 @@
1
1
  import type { ComputedRef, DeepReadonly, ExtractPropTypes, Ref } from 'vue';
2
+ import type { Writable } from '@noeldemartin/utils';
2
3
 
3
- import { mixedProp, stringProp } from '@/utils';
4
- import { extractComponentProps } from '@/components/utils';
5
- import type { FormFieldValue } from '@/forms/Form';
6
- import type { HasElement } from '@/components/interfaces';
4
+ import { mixedProp, stringProp } from '@aerogel/core/utils';
5
+ import { extractComponentProps } from '@aerogel/core/components/utils';
6
+ import type { FormFieldValue } from '@aerogel/core/forms/Form';
7
+ import type { HasElement } from '@aerogel/core/components/interfaces';
7
8
 
8
9
  export interface IAGHeadlessInput extends HasElement {
9
10
  id: string;
@@ -23,6 +24,12 @@ export const inputProps = {
23
24
  modelValue: mixedProp<FormFieldValue>([String, Number, Boolean]),
24
25
  };
25
26
 
27
+ export const inputEmits = ['update:modelValue'] as const;
28
+
29
+ export function useInputEmits(): Writable<typeof inputEmits> {
30
+ return [...inputEmits];
31
+ }
32
+
26
33
  export function useInputProps(): typeof inputProps {
27
34
  return inputProps;
28
35
  }
@@ -9,9 +9,9 @@
9
9
  import { computed, inject, provide, readonly, ref } from 'vue';
10
10
  import { uuid } from '@noeldemartin/utils';
11
11
 
12
- import { stringProp } from '@/utils/vue';
13
- import type Form from '@/forms/Form';
14
- import type { __SetsElement } from '@/components/interfaces';
12
+ import { stringProp } from '@aerogel/core/utils/vue';
13
+ import type Form from '@aerogel/core/forms/Form';
14
+ import type { __SetsElement } from '@aerogel/core/components/interfaces';
15
15
 
16
16
  import { useInputProps } from './AGHeadlessInput';
17
17
  import type { IAGHeadlessInput } from './AGHeadlessInput';
@@ -12,7 +12,7 @@
12
12
  <script setup lang="ts">
13
13
  import { computed } from 'vue';
14
14
 
15
- import { injectReactiveOrFail } from '@/utils/vue';
15
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
16
16
 
17
17
  import AGMarkdown from '../../lib/AGMarkdown.vue';
18
18
  import type { IAGHeadlessInput } from './AGHeadlessInput';
@@ -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 { IAGHeadlessInput } from './AGHeadlessInput';
14
14
 
@@ -17,10 +17,10 @@
17
17
  <script setup lang="ts">
18
18
  import { computed, ref, watchEffect } from 'vue';
19
19
 
20
- import { injectReactiveOrFail, stringProp } from '@/utils/vue';
21
- import type { __SetsElement } from '@/components/interfaces';
22
- import type { FormFieldValue } from '@/forms/Form';
23
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
20
+ import { injectReactiveOrFail, stringProp } from '@aerogel/core/utils/vue';
21
+ import type { __SetsElement } from '@aerogel/core/components/interfaces';
22
+ import type { FormFieldValue } from '@aerogel/core/forms/Form';
23
+ import type { IAGHeadlessInput } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
24
24
 
25
25
  import { onFormFocus } from './composition';
26
26
 
@@ -9,7 +9,7 @@
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
13
 
14
14
  import type { IAGHeadlessInput } from './AGHeadlessInput';
15
15
 
@@ -16,9 +16,9 @@
16
16
  <script setup lang="ts">
17
17
  import { computed, ref, watchEffect } from 'vue';
18
18
 
19
- import { injectReactiveOrFail } from '@/utils/vue';
20
- import type { IAGHeadlessInput } from '@/components/headless/forms/AGHeadlessInput';
21
- import type { __SetsElement } from '@/components/interfaces';
19
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
20
+ import type { IAGHeadlessInput } from '@aerogel/core/components/headless/forms/AGHeadlessInput';
21
+ import type { __SetsElement } from '@aerogel/core/components/interfaces';
22
22
 
23
23
  import { onFormFocus } from './composition';
24
24
 
@@ -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/Form';
7
7
 
8
8
  export interface IAGHeadlessSelect {
9
9
  id: string;
@@ -13,11 +13,11 @@ import { computed, inject, provide } from 'vue';
13
13
  import { toString, uuid } from '@noeldemartin/utils';
14
14
  import { Listbox } from '@headlessui/vue';
15
15
 
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';
16
+ import { mixedProp } from '@aerogel/core/utils/vue';
17
+ import { translateWithDefault } from '@aerogel/core/lang/utils';
18
+ import type Form from '@aerogel/core/forms/Form';
19
+ import type { FormFieldValue } from '@aerogel/core/forms/Form';
20
+ import type { ComponentProps } from '@aerogel/core/utils/vue';
21
21
 
22
22
  import { useSelectEmits, useSelectProps } from './AGHeadlessSelect';
23
23
  import type { IAGHeadlessSelect } from './AGHeadlessSelect';
@@ -10,8 +10,8 @@
10
10
  <script setup lang="ts">
11
11
  import { ListboxButton } from '@headlessui/vue';
12
12
 
13
- import { injectReactiveOrFail, stringProp } from '@/utils/vue';
14
- import type { ComponentProps } from '@/utils/vue';
13
+ import { injectReactiveOrFail, stringProp } from '@aerogel/core/utils/vue';
14
+ import type { ComponentProps } from '@aerogel/core/utils/vue';
15
15
 
16
16
  import type { IAGHeadlessSelect } from './AGHeadlessSelect';
17
17
 
@@ -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
 
@@ -10,8 +10,8 @@
10
10
  import { computed, useSlots } from 'vue';
11
11
  import { ListboxLabel } from '@headlessui/vue';
12
12
 
13
- import { injectReactiveOrFail } from '@/utils/vue';
14
- import type { ComponentProps } from '@/utils/vue';
13
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
14
+ import type { ComponentProps } from '@aerogel/core/utils/vue';
15
15
 
16
16
  import type { IAGHeadlessSelect } from './AGHeadlessSelect';
17
17
 
@@ -18,9 +18,9 @@
18
18
  <script setup lang="ts">
19
19
  import { ListboxOption } from '@headlessui/vue';
20
20
 
21
- import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@/utils/vue';
22
- import type { ComponentProps } from '@/utils/vue';
23
- import type { FormFieldValue } from '@/forms/Form';
21
+ import { injectReactiveOrFail, requiredMixedProp, stringProp } from '@aerogel/core/utils/vue';
22
+ import type { ComponentProps } from '@aerogel/core/utils/vue';
23
+ import type { FormFieldValue } from '@aerogel/core/forms/Form';
24
24
 
25
25
  import type { IAGHeadlessSelect } from './AGHeadlessSelect';
26
26
 
@@ -1,6 +1,6 @@
1
1
  import { inject, onUnmounted } from 'vue';
2
2
 
3
- import type Form from '@/forms/Form';
3
+ import type Form from '@aerogel/core/forms/Form';
4
4
 
5
5
  export function onFormFocus(input: { name: string | null }, listener: () => unknown): void {
6
6
  const form = inject<Form | null>('form', null);
@@ -1,9 +1,9 @@
1
1
  import { computed } from 'vue';
2
2
  import type { ExtractPropTypes, Ref } from 'vue';
3
3
 
4
- import { booleanProp, stringProp } from '@/utils';
5
- import { extractComponentProps } from '@/components/utils';
6
- import type { IAGModal } from '@/components/modals/AGModal';
4
+ import { booleanProp, stringProp } from '@aerogel/core/utils';
5
+ import { extractComponentProps } from '@aerogel/core/components/utils';
6
+ import type { IAGModal } from '@aerogel/core/components/modals/AGModal';
7
7
 
8
8
  export interface IAGHeadlessModal extends IAGModal {}
9
9
 
@@ -13,6 +13,7 @@ export interface IAGHeadlessModalDefaultSlotProps {
13
13
 
14
14
  export const modalProps = {
15
15
  cancellable: booleanProp(true),
16
+ inline: booleanProp(),
16
17
  title: stringProp(),
17
18
  };
18
19
 
@@ -28,7 +29,8 @@ export function extractModalProps<T extends ExtractPropTypes<typeof modalProps>>
28
29
 
29
30
  export function useModalExpose($modal: Ref<IAGHeadlessModal | undefined>): IAGModal {
30
31
  return {
31
- close: async () => $modal.value?.close(),
32
+ inline: computed(() => !!$modal.value?.inline),
32
33
  cancellable: computed(() => !!$modal.value?.cancellable),
34
+ close: async () => $modal.value?.close(),
33
35
  };
34
36
  }
@@ -1,18 +1,23 @@
1
1
  <template>
2
- <Dialog ref="$root" :open="true" @close="cancellable && close()">
2
+ <component
3
+ :is="rootComponent"
4
+ ref="$root"
5
+ :open="true"
6
+ @close="cancellable && close()"
7
+ >
3
8
  <slot :close="close" />
4
- </Dialog>
9
+ </component>
5
10
  </template>
6
11
 
7
12
  <script setup lang="ts">
8
- import { ref, toRef } from 'vue';
13
+ import { computed, ref, toRef } from 'vue';
9
14
  import { Dialog } from '@headlessui/vue';
10
15
  import type { VNode } from 'vue';
11
16
 
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';
17
+ import Events from '@aerogel/core/services/Events';
18
+ import { useEvent } from '@aerogel/core/utils/composition/events';
19
+ import { injectReactiveOrFail } from '@aerogel/core/utils/vue';
20
+ import type { IAGModalContext } from '@aerogel/core/components/modals/AGModalContext';
16
21
 
17
22
  import { useModalProps } from './AGHeadlessModal';
18
23
  import type { IAGHeadlessModal, IAGHeadlessModalDefaultSlotProps } from './AGHeadlessModal';
@@ -26,6 +31,7 @@ const { modal } = injectReactiveOrFail<IAGModalContext>(
26
31
  'could not obtain modal reference from <AGHeadlessModal>, ' +
27
32
  'did you render this component manually? Show it using $ui.openModal() instead',
28
33
  );
34
+ const rootComponent = computed(() => (modal.properties.inline ? 'div' : Dialog));
29
35
 
30
36
  async function hide(): Promise<void> {
31
37
  if (!$root.value?.$el) {
@@ -82,5 +88,5 @@ useEvent('show-modal', async ({ id }) => {
82
88
  });
83
89
 
84
90
  defineSlots<{ default(props: IAGHeadlessModalDefaultSlotProps): VNode[] }>();
85
- defineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable') });
91
+ defineExpose<IAGHeadlessModal>({ close, cancellable: toRef(props, 'cancellable'), inline: toRef(props, 'inline') });
86
92
  </script>