@aerogel/core 0.1.1-next.97f5cf5c97f16ab8a0ef63b82aaab049a0f9e15b → 0.1.1-next.9bd06e629f34098543a54bdb87e8996767876d42
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 +2 -12
- package/dist/aerogel-core.js +604 -611
- package/dist/aerogel-core.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AppOverlays.vue +1 -1
- package/src/components/headless/HeadlessModal.vue +12 -3
- package/src/components/headless/HeadlessModalContent.vue +1 -1
- package/src/components/ui/Modal.vue +2 -2
- package/src/ui/UI.ts +2 -2
- package/src/ui/index.ts +11 -1
- package/src/ui/modals.ts +0 -36
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<DialogRoot :ref="forwardRef" open @update:open="persistent ||
|
|
2
|
+
<DialogRoot :ref="forwardRef" open @update:open="persistent || close()">
|
|
3
3
|
<DialogPortal>
|
|
4
4
|
<slot :close />
|
|
5
5
|
</DialogPortal>
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script setup lang="ts" generic="T = void">
|
|
10
|
+
import { after } from '@noeldemartin/utils';
|
|
10
11
|
import { DialogPortal, DialogRoot, useForwardExpose } from 'reka-ui';
|
|
11
12
|
import { provide, ref } from 'vue';
|
|
13
|
+
import { useModal } from '@noeldemartin/vue-modals';
|
|
12
14
|
import type { DialogContent } from 'reka-ui';
|
|
13
15
|
import type { Nullable } from '@noeldemartin/utils';
|
|
14
16
|
|
|
15
|
-
import { useModal } from '@aerogel/core/ui/modals';
|
|
16
17
|
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
17
18
|
import type { ModalExpose, ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
18
19
|
|
|
19
20
|
const $content = ref<Nullable<InstanceType<typeof DialogContent>>>(null);
|
|
20
|
-
const
|
|
21
|
+
const modal = useModal<T>({ removeOnClose: false });
|
|
21
22
|
|
|
22
23
|
defineProps<ModalProps>();
|
|
23
24
|
defineSlots<ModalSlots<T>>();
|
|
@@ -26,4 +27,12 @@ defineExpose<AcceptRefs<ModalExpose>>({ $content });
|
|
|
26
27
|
const { forwardRef } = useForwardExpose();
|
|
27
28
|
|
|
28
29
|
provide('$modalContentRef', $content);
|
|
30
|
+
|
|
31
|
+
async function close(result?: T) {
|
|
32
|
+
modal.close(result);
|
|
33
|
+
|
|
34
|
+
await after(1000);
|
|
35
|
+
|
|
36
|
+
modal.remove();
|
|
37
|
+
}
|
|
29
38
|
</script>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { useTemplateRef, watchEffect } from 'vue';
|
|
11
11
|
import { DialogContent } from 'reka-ui';
|
|
12
|
+
import { ModalComponent, useModal } from '@noeldemartin/vue-modals';
|
|
12
13
|
import type { Ref } from 'vue';
|
|
13
14
|
|
|
14
|
-
import { ModalComponent, useModal } from '@aerogel/core/ui/modals';
|
|
15
15
|
import { injectOrFail } from '@aerogel/core/utils/vue';
|
|
16
16
|
import type { ModalContentInstance } from '@aerogel/core/components/contracts/Modal';
|
|
17
17
|
|
|
@@ -58,6 +58,8 @@ import IconClose from '~icons/zondicons/close';
|
|
|
58
58
|
|
|
59
59
|
import { useForwardExpose } from 'reka-ui';
|
|
60
60
|
import { computed, onMounted } from 'vue';
|
|
61
|
+
import { injectModal, modals, useModal } from '@noeldemartin/vue-modals';
|
|
62
|
+
import type { ModalController } from '@noeldemartin/vue-modals';
|
|
61
63
|
import type { ComponentPublicInstance, HTMLAttributes, Ref } from 'vue';
|
|
62
64
|
import { type Nullable, after } from '@noeldemartin/utils';
|
|
63
65
|
|
|
@@ -69,8 +71,6 @@ import HeadlessModalOverlay from '@aerogel/core/components/headless/HeadlessModa
|
|
|
69
71
|
import HeadlessModalTitle from '@aerogel/core/components/headless/HeadlessModalTitle.vue';
|
|
70
72
|
import { classes } from '@aerogel/core/utils/classes';
|
|
71
73
|
import { reactiveSet } from '@aerogel/core/utils';
|
|
72
|
-
import { injectModal, modals, useModal } from '@aerogel/core/ui/modals';
|
|
73
|
-
import type { ModalController } from '@aerogel/core/ui/modals';
|
|
74
74
|
import type { AcceptRefs } from '@aerogel/core/utils/vue';
|
|
75
75
|
import type { ModalExpose, ModalProps, ModalSlots } from '@aerogel/core/components/contracts/Modal';
|
|
76
76
|
|
package/src/ui/UI.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { after, facade, fail, isDevelopment, uuid } from '@noeldemartin/utils';
|
|
2
2
|
import { markRaw, unref } from 'vue';
|
|
3
|
+
import { closeModal, createModal, modals, showModal } from '@noeldemartin/vue-modals';
|
|
3
4
|
import type { Constructor } from '@noeldemartin/utils';
|
|
4
5
|
import type { Component, ComputedOptions, MethodOptions } from 'vue';
|
|
6
|
+
import type { GetModalProps, GetModalResponse } from '@noeldemartin/vue-modals';
|
|
5
7
|
|
|
6
8
|
import Events from '@aerogel/core/services/Events';
|
|
7
|
-
import { closeModal, createModal, modals, showModal } from '@aerogel/core/ui/modals';
|
|
8
|
-
import type { GetModalProps, GetModalResponse } from '@aerogel/core/ui/modals';
|
|
9
9
|
import type { AcceptRefs } from '@aerogel/core/utils';
|
|
10
10
|
import type { AlertModalExpose, AlertModalProps } from '@aerogel/core/components/contracts/AlertModal';
|
|
11
11
|
import type { ButtonVariant } from '@aerogel/core/components/contracts/Button';
|
package/src/ui/index.ts
CHANGED
|
@@ -14,10 +14,20 @@ import type { Component } from 'vue';
|
|
|
14
14
|
|
|
15
15
|
const services = { $ui: UI };
|
|
16
16
|
|
|
17
|
-
export * from './modals';
|
|
18
17
|
export * from './UI';
|
|
19
18
|
export * from './utils';
|
|
20
19
|
export { default as UI } from './UI';
|
|
20
|
+
export {
|
|
21
|
+
useModal,
|
|
22
|
+
createModal,
|
|
23
|
+
showModal,
|
|
24
|
+
closeModal,
|
|
25
|
+
modals,
|
|
26
|
+
ModalComponent,
|
|
27
|
+
ModalsPortal,
|
|
28
|
+
type GetModalProps,
|
|
29
|
+
type GetModalResponse,
|
|
30
|
+
} from '@noeldemartin/vue-modals';
|
|
21
31
|
|
|
22
32
|
export type UIServices = typeof services;
|
|
23
33
|
|
package/src/ui/modals.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { after } from '@noeldemartin/utils';
|
|
2
|
-
import { injectModal, useModal as useModalBase } from '@noeldemartin/vue-modals';
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
createModal,
|
|
6
|
-
showModal,
|
|
7
|
-
injectModal,
|
|
8
|
-
closeModal,
|
|
9
|
-
modals,
|
|
10
|
-
ModalComponent,
|
|
11
|
-
ModalsPortal,
|
|
12
|
-
type GetModalProps,
|
|
13
|
-
type GetModalResponse,
|
|
14
|
-
type ModalController,
|
|
15
|
-
} from '@noeldemartin/vue-modals';
|
|
16
|
-
|
|
17
|
-
const instances = new WeakSet();
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
20
|
-
export function useModal<T = never>() {
|
|
21
|
-
const instance = injectModal<T>();
|
|
22
|
-
const { close, remove, ...modal } = useModalBase<T>(instances.has(instance) ? {} : { removeOnClose: false });
|
|
23
|
-
|
|
24
|
-
instances.add(instance);
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
...modal,
|
|
28
|
-
async close(result?: T) {
|
|
29
|
-
close(result);
|
|
30
|
-
|
|
31
|
-
await after(1000);
|
|
32
|
-
|
|
33
|
-
remove();
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|