nuance-ui 0.1.57 → 0.1.58
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 -1
- 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/index.d.ts +0 -1
- package/dist/runtime/components/index.js +0 -1
- 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/index.d.ts +0 -1
- package/dist/runtime/composals/index.js +0 -1
- package/dist/runtime/{components/modals → modals}/_confirm-modal/confirm-modal.d.vue.ts +3 -4
- package/dist/runtime/{components/modals → modals}/_confirm-modal/confirm-modal.vue +7 -22
- package/dist/runtime/{components/modals → modals}/_confirm-modal/confirm-modal.vue.d.ts +3 -4
- package/dist/runtime/{components/modals → modals}/_confirm-modal/index.d.ts +1 -1
- package/dist/runtime/{components/modals → modals}/_confirm-modal/index.js +1 -1
- package/dist/runtime/modals/index.d.ts +4 -0
- package/dist/runtime/modals/index.js +4 -0
- package/dist/runtime/{plugins/modals → modals}/modal-manager.d.ts +7 -3
- package/dist/runtime/{plugins/modals → modals}/modal-manager.js +22 -17
- package/dist/runtime/{components/modals → modals}/modals-provider.vue +1 -1
- package/dist/runtime/{composals → modals}/use-modal.js +1 -1
- package/package.json +1 -1
- package/dist/runtime/components/modals/index.d.ts +0 -1
- package/dist/runtime/components/modals/index.js +0 -1
- package/dist/runtime/plugins/modals/index.d.ts +0 -2
- package/dist/runtime/plugins/modals/index.js +0 -3
- /package/dist/runtime/{components/modals → modals}/modals-provider.d.vue.ts +0 -0
- /package/dist/runtime/{components/modals → modals}/modals-provider.vue.d.ts +0 -0
- /package/dist/runtime/{composals → modals}/use-modal.d.ts +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -37,7 +37,7 @@ const module$1 = defineNuxtModule({
|
|
|
37
37
|
nuxt.options.alias["@nui/utils"] = resolve("./runtime/utils");
|
|
38
38
|
nuxt.options.alias["@nui/helpers"] = resolve("./runtime/helpers");
|
|
39
39
|
nuxt.options.alias["@nui/types"] = resolve("./runtime/types");
|
|
40
|
-
nuxt.options.alias["@nui/modals"] = resolve("./runtime/
|
|
40
|
+
nuxt.options.alias["@nui/modals"] = resolve("./runtime/modals");
|
|
41
41
|
nuxt.options.appConfig.nui = defu(nuxt.options.appConfig.nui || {}, defaultConfig);
|
|
42
42
|
nuxt.options.postcss = nuxt.options.postcss || {};
|
|
43
43
|
nuxt.options.postcss.plugins = nuxt.options.postcss.plugins || {};
|
|
@@ -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
|
-
clear: () => any;
|
|
29
28
|
select: (args_0: number) => any;
|
|
29
|
+
clear: () => 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
|
-
onClear?: (() => any) | undefined;
|
|
36
35
|
onSelect?: ((args_0: number) => any) | undefined;
|
|
36
|
+
onClear?: (() => 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
|
-
clear: () => any;
|
|
29
28
|
select: (args_0: number) => any;
|
|
29
|
+
clear: () => 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
|
-
onClear?: (() => any) | undefined;
|
|
36
35
|
onSelect?: ((args_0: number) => any) | undefined;
|
|
36
|
+
onClear?: (() => 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;
|
|
@@ -20,7 +20,6 @@ export * from './input/index.js';
|
|
|
20
20
|
export * from './link/index.js';
|
|
21
21
|
export * from './loader/index.js';
|
|
22
22
|
export * from './modal/index.js';
|
|
23
|
-
export * from './modals/index.js';
|
|
24
23
|
export * from './nav-link/index.js';
|
|
25
24
|
export * from './paper.vue.js';
|
|
26
25
|
export * from './popover/index.js';
|
|
@@ -18,7 +18,6 @@ export * from "./input/index.js";
|
|
|
18
18
|
export * from "./link/index.js";
|
|
19
19
|
export * from "./loader/index.js";
|
|
20
20
|
export * from "./modal/index.js";
|
|
21
|
-
export * from "./modals/index.js";
|
|
22
21
|
export * from "./nav-link/index.js";
|
|
23
22
|
export * from "./paper.vue";
|
|
24
23
|
export * from "./popover/index.js";
|
|
@@ -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
|
-
onClear?: (() => any) | undefined;
|
|
28
27
|
onSelect?: ((args_0: number) => any) | undefined;
|
|
28
|
+
onClear?: (() => 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: "select", args_0: number) => void) & ((evt: "clear") => 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
|
-
onClear?: (() => any) | undefined;
|
|
28
27
|
onSelect?: ((args_0: number) => any) | undefined;
|
|
28
|
+
onClear?: (() => 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: "select", args_0: number) => void) & ((evt: "clear") => 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
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { ModalRootProps } from '../../modal/modal-root.vue.js';
|
|
1
|
+
import type { ButtonProps, ModalRootProps } from '../../components/index.js';
|
|
2
|
+
import type { MaybePromise } from '../../types/index.js';
|
|
4
3
|
type ConfirmLabels = Record<'confirm' | 'cancel', string>;
|
|
5
|
-
export interface ConfirmModalProps extends ModalRootProps {
|
|
4
|
+
export interface ConfirmModalProps extends /* @vue-ignore */ ModalRootProps {
|
|
6
5
|
/** Modal title */
|
|
7
6
|
title: string;
|
|
8
7
|
/** Description text displayed below the title */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useModal } from "@nui/composals";
|
|
3
2
|
import { ref } from "vue";
|
|
4
|
-
import Button from "../../button/button.vue";
|
|
5
|
-
import ModalCloseButton from "../../modal/modal-close-button.vue";
|
|
6
|
-
import ModalHeader from "../../modal/modal-header.vue";
|
|
7
|
-
import ModalRoot from "../../modal/modal-root.vue";
|
|
8
|
-
import Title from "../../title.vue";
|
|
3
|
+
import Button from "../../components/button/button.vue";
|
|
4
|
+
import ModalCloseButton from "../../components/modal/modal-close-button.vue";
|
|
5
|
+
import ModalHeader from "../../components/modal/modal-header.vue";
|
|
6
|
+
import ModalRoot from "../../components/modal/modal-root.vue";
|
|
7
|
+
import Title from "../../components/title.vue";
|
|
8
|
+
import { useModal } from "../use-modal";
|
|
9
9
|
const {
|
|
10
10
|
title,
|
|
11
11
|
description: body,
|
|
@@ -25,22 +25,7 @@ const {
|
|
|
25
25
|
onCancel: { type: Function, required: false },
|
|
26
26
|
onConfirm: { type: Function, required: false },
|
|
27
27
|
cancelProps: { type: Object, required: false },
|
|
28
|
-
confirmProps: { type: Object, required: false }
|
|
29
|
-
centered: { type: Boolean, required: false },
|
|
30
|
-
fullScreen: { type: Boolean, required: false },
|
|
31
|
-
closeOnClickOutside: { type: Boolean, required: false },
|
|
32
|
-
withinPortal: { type: Boolean, required: false },
|
|
33
|
-
withoutOverlay: { type: Boolean, required: false },
|
|
34
|
-
yOffset: { type: void 0, required: false },
|
|
35
|
-
xOffset: { type: void 0, required: false },
|
|
36
|
-
radius: { type: [String, Number], required: false },
|
|
37
|
-
size: { type: String, required: false },
|
|
38
|
-
shadow: { type: String, required: false },
|
|
39
|
-
padding: { type: [String, Number], required: false },
|
|
40
|
-
transition: { type: String, required: false },
|
|
41
|
-
portalTarget: { type: [String, Object, null], required: false },
|
|
42
|
-
is: { type: null, required: false },
|
|
43
|
-
mod: { type: [Object, Array, null], required: false }
|
|
28
|
+
confirmProps: { type: Object, required: false }
|
|
44
29
|
});
|
|
45
30
|
const { opened, resolve: hide } = useModal("confirm");
|
|
46
31
|
const loading = ref(false);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { ModalRootProps } from '../../modal/modal-root.vue.js';
|
|
1
|
+
import type { ButtonProps, ModalRootProps } from '../../components/index.js';
|
|
2
|
+
import type { MaybePromise } from '../../types/index.js';
|
|
4
3
|
type ConfirmLabels = Record<'confirm' | 'cancel', string>;
|
|
5
|
-
export interface ConfirmModalProps extends ModalRootProps {
|
|
4
|
+
export interface ConfirmModalProps extends /* @vue-ignore */ ModalRootProps {
|
|
6
5
|
/** Modal title */
|
|
7
6
|
title: string;
|
|
8
7
|
/** Description text displayed below the title */
|
|
@@ -4,5 +4,5 @@ import type { ConfirmModalProps } from './confirm-modal.vue.js';
|
|
|
4
4
|
*
|
|
5
5
|
* Resolves with `true` if the user confirmed, rejects if cancelled.
|
|
6
6
|
*/
|
|
7
|
-
export declare const openConfirmModal: (props?:
|
|
7
|
+
export declare const openConfirmModal: (props?: any) => Promise<boolean>;
|
|
8
8
|
export type { ConfirmModalProps };
|
|
@@ -29,10 +29,12 @@ export interface ModalState<Props extends object = object, Resolve = unknown, Re
|
|
|
29
29
|
* const result = await open({ foo: 'bar' }) // result: string
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
declare class ModalManager {
|
|
33
33
|
#private;
|
|
34
|
-
/** Reactive map of
|
|
35
|
-
|
|
34
|
+
/** Reactive map of active modals */
|
|
35
|
+
readonly modals: import("vue").Reactive<Map<string, ModalState<object, unknown, unknown>>>;
|
|
36
|
+
private constructor();
|
|
37
|
+
static get instance(): ModalManager;
|
|
36
38
|
/**
|
|
37
39
|
* Registers a modal component and returns a typed function to open it.
|
|
38
40
|
*/
|
|
@@ -76,3 +78,5 @@ export declare class ModalManager {
|
|
|
76
78
|
*/
|
|
77
79
|
state<Props extends object = object, Resolve = unknown, Reject = unknown>(id: string): ModalState<Props, Resolve, Reject>;
|
|
78
80
|
}
|
|
81
|
+
export declare const $modals: import("vue").Raw<ModalManager>;
|
|
82
|
+
export {};
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import { markRaw, reactive } from "vue";
|
|
2
|
-
|
|
2
|
+
class ModalManager {
|
|
3
|
+
static #instance = null;
|
|
3
4
|
/** Reactive map of active modals */
|
|
4
|
-
|
|
5
|
+
modals = reactive(/* @__PURE__ */ new Map());
|
|
5
6
|
/** Eagerly registered components (id → Component) */
|
|
6
7
|
#registered = /* @__PURE__ */ new Map();
|
|
7
8
|
/** Lazily registered loaders (id → loader) */
|
|
8
9
|
#lazy = /* @__PURE__ */ new Map();
|
|
9
|
-
|
|
10
|
-
get modals() {
|
|
11
|
-
return this.#modals;
|
|
10
|
+
constructor() {
|
|
12
11
|
}
|
|
13
12
|
// ── Facade ──
|
|
13
|
+
static get instance() {
|
|
14
|
+
if (!this.#instance)
|
|
15
|
+
this.#instance = new ModalManager();
|
|
16
|
+
return this.#instance;
|
|
17
|
+
}
|
|
14
18
|
/**
|
|
15
19
|
* Registers a modal component and returns a typed function to open it.
|
|
16
20
|
*/
|
|
17
21
|
create(id, component) {
|
|
18
|
-
|
|
19
|
-
return (props) =>
|
|
22
|
+
ModalManager.instance.#registered.set(id, component);
|
|
23
|
+
return (props) => ModalManager.instance.#show(id, props ?? {});
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* Registers a lazy modal — the component is loaded on first open.
|
|
23
27
|
*/
|
|
24
28
|
createLazy(id, loader) {
|
|
25
|
-
|
|
26
|
-
return (props) =>
|
|
29
|
+
ModalManager.instance.#lazy.set(id, loader);
|
|
30
|
+
return (props) => ModalManager.instance.#show(id, props ?? {});
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Opens a previously registered modal by its identifier.
|
|
30
34
|
*/
|
|
31
35
|
async show(id, props = {}) {
|
|
32
|
-
return
|
|
36
|
+
return ModalManager.instance.#show(id, props);
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Closes the modal and resolves its promise with the given result.
|
|
@@ -38,7 +42,7 @@ export class ModalManager {
|
|
|
38
42
|
* @param result — value the promise resolves with
|
|
39
43
|
*/
|
|
40
44
|
resolve(id, result) {
|
|
41
|
-
|
|
45
|
+
ModalManager.instance.#resolve(id, result);
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
44
48
|
* Closes the modal and rejects its promise with the given reason.
|
|
@@ -47,7 +51,7 @@ export class ModalManager {
|
|
|
47
51
|
* @param reason — rejection reason
|
|
48
52
|
*/
|
|
49
53
|
reject(id, reason) {
|
|
50
|
-
|
|
54
|
+
ModalManager.instance.#reject(id, reason);
|
|
51
55
|
}
|
|
52
56
|
/**
|
|
53
57
|
* Returns the reactive state of a specific modal as `ComputedRef<ModalState>`.
|
|
@@ -55,7 +59,7 @@ export class ModalManager {
|
|
|
55
59
|
* Used inside a modal component (via {@link useModal}).
|
|
56
60
|
*/
|
|
57
61
|
state(id) {
|
|
58
|
-
return
|
|
62
|
+
return ModalManager.instance.modals.get(id);
|
|
59
63
|
}
|
|
60
64
|
// ── Private implementation ──
|
|
61
65
|
async #show(id, props = {}) {
|
|
@@ -71,7 +75,7 @@ export class ModalManager {
|
|
|
71
75
|
const component = this.#registered.get(id);
|
|
72
76
|
if (!component)
|
|
73
77
|
return Promise.reject(new Error(`Modal "${id}" is not registered`));
|
|
74
|
-
const existing = this
|
|
78
|
+
const existing = this.modals.get(id);
|
|
75
79
|
return new Promise((resolve, reject) => {
|
|
76
80
|
if (existing) {
|
|
77
81
|
existing.props = props;
|
|
@@ -79,7 +83,7 @@ export class ModalManager {
|
|
|
79
83
|
existing.resolve = resolve;
|
|
80
84
|
existing.reject = reject;
|
|
81
85
|
} else {
|
|
82
|
-
this
|
|
86
|
+
this.modals.set(id, {
|
|
83
87
|
id,
|
|
84
88
|
component: markRaw(component),
|
|
85
89
|
props,
|
|
@@ -91,17 +95,18 @@ export class ModalManager {
|
|
|
91
95
|
});
|
|
92
96
|
}
|
|
93
97
|
#resolve(id, result) {
|
|
94
|
-
const modal = this
|
|
98
|
+
const modal = this.modals.get(id);
|
|
95
99
|
if (!modal)
|
|
96
100
|
return;
|
|
97
101
|
modal.opened = false;
|
|
98
102
|
modal.resolve?.(result);
|
|
99
103
|
}
|
|
100
104
|
#reject(id, reason) {
|
|
101
|
-
const modal = this
|
|
105
|
+
const modal = this.modals.get(id);
|
|
102
106
|
if (!modal)
|
|
103
107
|
return;
|
|
104
108
|
modal.opened = false;
|
|
105
109
|
modal.reject?.(reason);
|
|
106
110
|
}
|
|
107
111
|
}
|
|
112
|
+
export const $modals = markRaw(ModalManager.instance);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './_confirm-modal/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./_confirm-modal/index.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|