nuance-ui 0.1.55 → 0.1.57
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/module.json +1 -1
- package/dist/module.mjs +1 -5
- package/dist/runtime/components/combobox/combobox-root.d.vue.ts +2 -2
- package/dist/runtime/components/combobox/combobox-root.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-close-button.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-close-button.vue +11 -9
- package/dist/runtime/components/dialog/ui/dialog-close-button.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-header.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-header.vue +5 -3
- package/dist/runtime/components/dialog/ui/dialog-header.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-root.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-root.vue +22 -26
- package/dist/runtime/components/dialog/ui/dialog-root.vue.d.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-title.d.vue.ts +2 -2
- package/dist/runtime/components/dialog/ui/dialog-title.vue +5 -3
- package/dist/runtime/components/dialog/ui/dialog-title.vue.d.ts +2 -2
- package/dist/runtime/components/modals/modals-provider.vue +10 -8
- package/dist/runtime/components/select/select.d.vue.ts +2 -2
- package/dist/runtime/components/select/select.vue.d.ts +2 -2
- package/dist/runtime/composals/use-modal.d.ts +3 -3
- package/dist/runtime/composals/use-modal.js +5 -6
- package/dist/runtime/plugins/modals/index.d.ts +2 -1
- package/dist/runtime/plugins/modals/index.js +3 -1
- package/package.json +1 -1
- package/dist/runtime/plugins/modals/plugin.client.d.ts +0 -8
- package/dist/runtime/plugins/modals/plugin.client.js +0 -10
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
|
|
4
4
|
const defaultConfig = {
|
|
@@ -70,10 +70,6 @@ const module$1 = defineNuxtModule({
|
|
|
70
70
|
addImportsDir(resolve("./runtime/composals"));
|
|
71
71
|
addImportsDir(resolve("./runtime/helpers"));
|
|
72
72
|
}
|
|
73
|
-
addPlugin({
|
|
74
|
-
src: resolve("./runtime/plugins/modals/plugin.client"),
|
|
75
|
-
mode: "client"
|
|
76
|
-
});
|
|
77
73
|
nuxt.options.css.push(resolve("./runtime/styles/global.css"));
|
|
78
74
|
}
|
|
79
75
|
});
|
|
@@ -25,15 +25,15 @@ type __VLS_Slots = {} & {
|
|
|
25
25
|
default?: (props: typeof __VLS_8) => any;
|
|
26
26
|
};
|
|
27
27
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
select: (args_0: number) => any;
|
|
29
28
|
clear: () => any;
|
|
29
|
+
select: (args_0: number) => any;
|
|
30
30
|
close: (args_0: import("./types/index.js").ComboboxDropdownEventSource) => any;
|
|
31
31
|
submit: (args_0: string, args_1: import("./types/index.js").ComboboxItem) => any;
|
|
32
32
|
open: (args_0: import("./types/index.js").ComboboxDropdownEventSource) => any;
|
|
33
33
|
"update:open": (value: boolean) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
|
-
onSelect?: ((args_0: number) => any) | undefined;
|
|
36
35
|
onClear?: (() => any) | undefined;
|
|
36
|
+
onSelect?: ((args_0: number) => any) | undefined;
|
|
37
37
|
onClose?: ((args_0: import("./types/index.js").ComboboxDropdownEventSource) => any) | undefined;
|
|
38
38
|
onSubmit?: ((args_0: string, args_1: import("./types/index.js").ComboboxItem) => any) | undefined;
|
|
39
39
|
onOpen?: ((args_0: import("./types/index.js").ComboboxDropdownEventSource) => any) | undefined;
|
|
@@ -25,15 +25,15 @@ type __VLS_Slots = {} & {
|
|
|
25
25
|
default?: (props: typeof __VLS_8) => any;
|
|
26
26
|
};
|
|
27
27
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
select: (args_0: number) => any;
|
|
29
28
|
clear: () => any;
|
|
29
|
+
select: (args_0: number) => any;
|
|
30
30
|
close: (args_0: import("./types/index.js").ComboboxDropdownEventSource) => any;
|
|
31
31
|
submit: (args_0: string, args_1: import("./types/index.js").ComboboxItem) => any;
|
|
32
32
|
open: (args_0: import("./types/index.js").ComboboxDropdownEventSource) => any;
|
|
33
33
|
"update:open": (value: boolean) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
|
-
onSelect?: ((args_0: number) => any) | undefined;
|
|
36
35
|
onClear?: (() => any) | undefined;
|
|
36
|
+
onSelect?: ((args_0: number) => any) | undefined;
|
|
37
37
|
onClose?: ((args_0: import("./types/index.js").ComboboxDropdownEventSource) => any) | undefined;
|
|
38
38
|
onSubmit?: ((args_0: string, args_1: import("./types/index.js").ComboboxItem) => any) | undefined;
|
|
39
39
|
onOpen?: ((args_0: import("./types/index.js").ComboboxDropdownEventSource) => any) | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActionIconProps } from '../../action-icon/index.js';
|
|
2
|
-
declare var
|
|
2
|
+
declare var __VLS_16: {};
|
|
3
3
|
type __VLS_Slots = {} & {
|
|
4
|
-
default?: (props: typeof
|
|
4
|
+
default?: (props: typeof __VLS_16) => any;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<ActionIconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionIconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -17,13 +17,15 @@ const close = useDialogState();
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<template>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
<ClientOnly>
|
|
21
|
+
<ActionIcon
|
|
22
|
+
:icon
|
|
23
|
+
:variant
|
|
24
|
+
tabindex='0'
|
|
25
|
+
v-bind='props'
|
|
26
|
+
@click='close'
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</ActionIcon>
|
|
30
|
+
</ClientOnly>
|
|
29
31
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActionIconProps } from '../../action-icon/index.js';
|
|
2
|
-
declare var
|
|
2
|
+
declare var __VLS_16: {};
|
|
3
3
|
type __VLS_Slots = {} & {
|
|
4
|
-
default?: (props: typeof
|
|
4
|
+
default?: (props: typeof __VLS_16) => any;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<ActionIconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionIconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
7
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BoxProps } from '../../box.vue.js';
|
|
2
2
|
export interface DialogHeaderProps extends BoxProps {
|
|
3
3
|
}
|
|
4
|
-
declare var
|
|
4
|
+
declare var __VLS_14: {};
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
|
-
default?: (props: typeof
|
|
6
|
+
default?: (props: typeof __VLS_14) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<DialogHeaderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DialogHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BoxProps } from '../../box.vue.js';
|
|
2
2
|
export interface DialogHeaderProps extends BoxProps {
|
|
3
3
|
}
|
|
4
|
-
declare var
|
|
4
|
+
declare var __VLS_14: {};
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
|
-
default?: (props: typeof
|
|
6
|
+
default?: (props: typeof __VLS_14) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<DialogHeaderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DialogHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -33,9 +33,9 @@ type __VLS_ModelProps = {
|
|
|
33
33
|
'open'?: DialogModel['open'];
|
|
34
34
|
};
|
|
35
35
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
36
|
-
declare var
|
|
36
|
+
declare var __VLS_38: {};
|
|
37
37
|
type __VLS_Slots = {} & {
|
|
38
|
-
default?: (props: typeof
|
|
38
|
+
default?: (props: typeof __VLS_38) => any;
|
|
39
39
|
};
|
|
40
40
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
41
|
close: () => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getRadius, getShadow, getSize, getSpacing, rem } from "@nui/utils";
|
|
3
3
|
import { onClickOutside, unrefElement } from "@vueuse/core";
|
|
4
|
-
import { computed,
|
|
4
|
+
import { computed, shallowRef, watch } from "vue";
|
|
5
5
|
import Box from "../../box.vue";
|
|
6
6
|
import NTransition from "../../transition/transition.vue";
|
|
7
7
|
import { useProvideDialogState } from "../lib";
|
|
@@ -55,8 +55,7 @@ const dialogRef = shallowRef(null);
|
|
|
55
55
|
if (closeOnClickOutside) {
|
|
56
56
|
onClickOutside(dialogRef, () => opened.value = false);
|
|
57
57
|
}
|
|
58
|
-
watch(opened, (isOpen) => {
|
|
59
|
-
const dialog = unrefElement(dialogRef);
|
|
58
|
+
watch([opened, () => unrefElement(dialogRef)], ([isOpen, dialog]) => {
|
|
60
59
|
if (!dialog)
|
|
61
60
|
return;
|
|
62
61
|
if (isOpen)
|
|
@@ -64,11 +63,6 @@ watch(opened, (isOpen) => {
|
|
|
64
63
|
else
|
|
65
64
|
dialog.close();
|
|
66
65
|
}, { flush: "post" });
|
|
67
|
-
onMounted(() => {
|
|
68
|
-
if (!opened.value)
|
|
69
|
-
return;
|
|
70
|
-
open(unrefElement(dialogRef));
|
|
71
|
-
});
|
|
72
66
|
const style = computed(() => ({
|
|
73
67
|
"--dialog-size": getSize(size, "dialog-size"),
|
|
74
68
|
"--dialog-radius": radius ? getRadius(radius) : void 0,
|
|
@@ -80,22 +74,24 @@ const style = computed(() => ({
|
|
|
80
74
|
</script>
|
|
81
75
|
|
|
82
76
|
<template>
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
77
|
+
<ClientOnly>
|
|
78
|
+
<Teleport :disabled='!withinPortal' :to='portalTarget'>
|
|
79
|
+
<Box
|
|
80
|
+
is='dialog'
|
|
81
|
+
ref='dialogRef'
|
|
82
|
+
:class='[css.root, rootClass]'
|
|
83
|
+
:mod='[{ "without-overlay": withoutOverlay }, mod]'
|
|
84
|
+
:style
|
|
85
|
+
@click='overlayClick'
|
|
86
|
+
@close='$emit("close")'
|
|
87
|
+
@cancel.prevent='opened = false'
|
|
88
|
+
>
|
|
89
|
+
<NTransition :name='transition'>
|
|
90
|
+
<Box is='section' v-if='opened' :class='css.content' v-bind='$attrs'>
|
|
91
|
+
<slot />
|
|
92
|
+
</Box>
|
|
93
|
+
</NTransition>
|
|
94
|
+
</Box>
|
|
95
|
+
</Teleport>
|
|
96
|
+
</ClientOnly>
|
|
101
97
|
</template>
|
|
@@ -33,9 +33,9 @@ type __VLS_ModelProps = {
|
|
|
33
33
|
'open'?: DialogModel['open'];
|
|
34
34
|
};
|
|
35
35
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
36
|
-
declare var
|
|
36
|
+
declare var __VLS_38: {};
|
|
37
37
|
type __VLS_Slots = {} & {
|
|
38
|
-
default?: (props: typeof
|
|
38
|
+
default?: (props: typeof __VLS_38) => any;
|
|
39
39
|
};
|
|
40
40
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
41
|
close: () => any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TitleProps } from '../../title.vue.js';
|
|
2
2
|
export interface DialogTitleProps extends TitleProps {
|
|
3
3
|
}
|
|
4
|
-
declare var
|
|
4
|
+
declare var __VLS_14: {};
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
|
-
default?: (props: typeof
|
|
6
|
+
default?: (props: typeof __VLS_14) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<DialogTitleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DialogTitleProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -20,7 +20,9 @@ const { size = "md", lh = "1", ...props } = defineProps({
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
23
|
+
<ClientOnly>
|
|
24
|
+
<Title :class='css.title' :lh :size v-bind='props'>
|
|
25
|
+
<slot />
|
|
26
|
+
</Title>
|
|
27
|
+
</ClientOnly>
|
|
26
28
|
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TitleProps } from '../../title.vue.js';
|
|
2
2
|
export interface DialogTitleProps extends TitleProps {
|
|
3
3
|
}
|
|
4
|
-
declare var
|
|
4
|
+
declare var __VLS_14: {};
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
|
-
default?: (props: typeof
|
|
6
|
+
default?: (props: typeof __VLS_14) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<DialogTitleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DialogTitleProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -3,12 +3,14 @@ import { $modals } from "../../plugins/modals";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<template>
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
<ClientOnly>
|
|
7
|
+
<div id='nui-modals-root'>
|
|
8
|
+
<component
|
|
9
|
+
:is='entry.component'
|
|
10
|
+
v-for='[id, entry] in $modals.modals'
|
|
11
|
+
:key='id'
|
|
12
|
+
v-bind='entry.props'
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</ClientOnly>
|
|
14
16
|
</template>
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
24
24
|
modelValue?: ComboboxItem<Value, Ext> | null;
|
|
25
25
|
search?: string;
|
|
26
26
|
}) & {
|
|
27
|
-
onSelect?: ((args_0: number) => any) | undefined;
|
|
28
27
|
onClear?: (() => any) | undefined;
|
|
28
|
+
onSelect?: ((args_0: number) => any) | undefined;
|
|
29
29
|
onClose?: ((args_0: import("..").ComboboxDropdownEventSource) => any) | undefined;
|
|
30
30
|
onSubmit?: ((args_0: string, args_1: ComboboxItem) => any) | undefined;
|
|
31
31
|
"onUpdate:modelValue"?: ((value: ComboboxItem<Value, Ext> | null) => any) | undefined;
|
|
@@ -48,7 +48,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
48
48
|
} & {
|
|
49
49
|
rightSection?: (props: {}) => any;
|
|
50
50
|
};
|
|
51
|
-
emit: (((evt: "
|
|
51
|
+
emit: (((evt: "clear") => void) & ((evt: "select", args_0: number) => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void)) & (((event: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((event: "update:search", value: string) => void) & ((event: "update:open", value: boolean) => void));
|
|
52
52
|
}>) => import("vue").VNode & {
|
|
53
53
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
54
54
|
};
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
24
24
|
modelValue?: ComboboxItem<Value, Ext> | null;
|
|
25
25
|
search?: string;
|
|
26
26
|
}) & {
|
|
27
|
-
onSelect?: ((args_0: number) => any) | undefined;
|
|
28
27
|
onClear?: (() => any) | undefined;
|
|
28
|
+
onSelect?: ((args_0: number) => any) | undefined;
|
|
29
29
|
onClose?: ((args_0: import("..").ComboboxDropdownEventSource) => any) | undefined;
|
|
30
30
|
onSubmit?: ((args_0: string, args_1: ComboboxItem) => any) | undefined;
|
|
31
31
|
"onUpdate:modelValue"?: ((value: ComboboxItem<Value, Ext> | null) => any) | undefined;
|
|
@@ -48,7 +48,7 @@ declare const __VLS_export: <Value extends string = string, Ext extends Combobox
|
|
|
48
48
|
} & {
|
|
49
49
|
rightSection?: (props: {}) => any;
|
|
50
50
|
};
|
|
51
|
-
emit: (((evt: "
|
|
51
|
+
emit: (((evt: "clear") => void) & ((evt: "select", args_0: number) => void) & ((evt: "close", args_0: import("..").ComboboxDropdownEventSource) => void) & ((evt: "submit", args_0: string, args_1: ComboboxItem) => void) & ((evt: "open", args_0: import("..").ComboboxDropdownEventSource) => void)) & (((event: "update:modelValue", value: ComboboxItem<Value, Ext> | null) => void) & ((event: "update:search", value: string) => void) & ((event: "update:open", value: boolean) => void));
|
|
52
52
|
}>) => import("vue").VNode & {
|
|
53
53
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
54
54
|
};
|
|
@@ -21,8 +21,8 @@ id: string): {
|
|
|
21
21
|
*
|
|
22
22
|
* Setting to `true` reopens the modal, setting to `false` calls `reject`
|
|
23
23
|
*/
|
|
24
|
-
opened: import("vue").WritableComputedRef<
|
|
24
|
+
opened: import("vue").WritableComputedRef<boolean, boolean>;
|
|
25
25
|
/** closes the modal and resolves the promise */
|
|
26
|
-
resolve: (reason: Resolve) =>
|
|
27
|
-
reject: () =>
|
|
26
|
+
resolve: (reason: Resolve) => void;
|
|
27
|
+
reject: () => void;
|
|
28
28
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { useNuxtApp } from "#app";
|
|
2
1
|
import { computed } from "vue";
|
|
2
|
+
import { $modals } from "../plugins/modals/index.js";
|
|
3
3
|
export function useModal(id) {
|
|
4
|
-
const
|
|
5
|
-
const state = computed(() => manager.state(id));
|
|
4
|
+
const state = computed(() => $modals.state(id));
|
|
6
5
|
const opened = computed({
|
|
7
6
|
get: () => state.value?.opened,
|
|
8
|
-
set: (opened2) => opened2 ?
|
|
7
|
+
set: (opened2) => opened2 ? $modals.show(id, state.value.props) : $modals.reject(id, "cancel")
|
|
9
8
|
});
|
|
10
9
|
if (!state)
|
|
11
10
|
throw new Error(`Modal ${id} is not exist`);
|
|
@@ -17,7 +16,7 @@ export function useModal(id) {
|
|
|
17
16
|
*/
|
|
18
17
|
opened,
|
|
19
18
|
/** closes the modal and resolves the promise */
|
|
20
|
-
resolve: (reason) =>
|
|
21
|
-
reject: () =>
|
|
19
|
+
resolve: (reason) => $modals.resolve(id, reason),
|
|
20
|
+
reject: () => $modals.reject(id)
|
|
22
21
|
};
|
|
23
22
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ModalManager } from './modal-manager.js';
|
|
2
|
+
export declare const $modals: import("vue").Raw<ModalManager>;
|
package/package.json
CHANGED