@quidgest/ui 0.20.1 → 0.21.1
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/CHANGELOG.md +28 -0
- package/README.md +10 -0
- package/dist/json/api.json +219 -3
- package/dist/manifest/components.json +1 -0
- package/dist/ui.css +239 -248
- package/dist/ui.esm.js +1306 -1139
- package/dist/ui.js +788 -621
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +788 -621
- package/dist/ui.scss +291 -34
- package/esm/components/QAccordion/QAccordionItem.vue.js +1 -1
- package/esm/components/QBadge/QBadge.d.ts.map +1 -1
- package/esm/components/QBadge/QBadge.vue.js +20 -24
- package/esm/components/QButton/QButton.d.ts.map +1 -1
- package/esm/components/QButton/QButton.vue.js +32 -29
- package/esm/components/QCheckbox/QCheckbox.vue.js +1 -1
- package/esm/components/QDialog/QDialog.d.ts +4 -2
- package/esm/components/QDialog/QDialog.d.ts.map +1 -1
- package/esm/components/QDialog/QDialog.vue.js +84 -74
- package/esm/components/QDialog/QDialogProvider.d.ts.map +1 -1
- package/esm/components/QDialog/QDialogProvider.vue.js +21 -12
- package/esm/components/QDialog/index.d.ts +72 -3
- package/esm/components/QDialog/index.d.ts.map +1 -1
- package/esm/components/QDialog/types.d.ts +10 -1
- package/esm/components/QDialog/types.d.ts.map +1 -1
- package/esm/components/QDismissibleLayer/QDismissibleLayer.d.ts.map +1 -1
- package/esm/components/QDismissibleLayer/QDismissibleLayer.vue.js +9 -8
- package/esm/components/QDivider/QDivider.d.ts.map +1 -1
- package/esm/components/QDivider/QDivider.vue.js +3 -3
- package/esm/components/QFileUpload/QFileUpload.vue.js +1 -1
- package/esm/components/QGauge/QGauge.vue.js +1 -1
- package/esm/components/QList/QListItem.d.ts.map +1 -1
- package/esm/components/QList/QListItem.vue.js +5 -2
- package/esm/components/QList/QListItemGroup.vue.js +1 -1
- package/esm/components/QObfuscation/QObfuscation.d.ts +1 -1
- package/esm/components/QObfuscation/QObfuscation.d.ts.map +1 -1
- package/esm/components/QObfuscation/QObfuscation.vue.js +53 -56
- package/esm/components/QObfuscation/index.d.ts +6 -6
- package/esm/components/QObfuscation/types.d.ts +1 -1
- package/esm/components/QObfuscation/types.d.ts.map +1 -1
- package/esm/components/QOverflow/QOverflow.d.ts +43 -0
- package/esm/components/QOverflow/QOverflow.d.ts.map +1 -0
- package/esm/components/QOverflow/QOverflow.vue.js +281 -0
- package/esm/components/QOverflow/QOverflow2.vue.js +5 -0
- package/esm/components/QOverflow/constants.d.ts +30 -0
- package/esm/components/QOverflow/constants.d.ts.map +1 -0
- package/esm/components/QOverflow/constants.js +12 -0
- package/esm/components/QOverflow/index.d.ts +58 -0
- package/esm/components/QOverflow/index.d.ts.map +1 -0
- package/esm/components/QOverflow/index.js +6 -0
- package/esm/components/QOverflow/types.d.ts +119 -0
- package/esm/components/QOverflow/types.d.ts.map +1 -0
- package/esm/components/QPhoneField/QPhoneField.d.ts.map +1 -1
- package/esm/components/QPhoneField/QPhoneField.vue.js +1 -1
- package/esm/components/QPropertyList/QPropertyListGroup.vue.js +1 -1
- package/esm/components/QPropertyList/QPropertyListRow.vue.js +1 -1
- package/esm/components/QPropertyList/index.d.ts.map +1 -1
- package/esm/components/QRadioGroup/QRadioButton.vue.js +1 -1
- package/esm/components/QRadioGroup/QRadioGroup.vue.js +2 -2
- package/esm/components/QSelect/QSelect.d.ts.map +1 -1
- package/esm/components/QSelect/QSelect.vue.js +1 -1
- package/esm/components/QSidebar/QSidebar.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebar.vue.js +19 -10
- package/esm/components/QSidebar/QSidebarItem.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebarItem.vue.js +51 -49
- package/esm/components/QSidebar/context.d.ts +7 -0
- package/esm/components/QSidebar/context.d.ts.map +1 -1
- package/esm/components/QSwitch/QSwitch.vue.js +1 -1
- package/esm/components/QTabs/QTab.d.ts.map +1 -1
- package/esm/components/QTabs/QTab.vue.js +52 -50
- package/esm/components/QTabs/QTabs.d.ts.map +1 -1
- package/esm/components/QTabs/QTabs.vue.js +37 -12
- package/esm/components/QTabs/context.d.ts +7 -0
- package/esm/components/QTabs/context.d.ts.map +1 -1
- package/esm/components/QTextArea/QTextArea.vue.js +1 -1
- package/esm/components/QTextField/QTextField.d.ts.map +1 -1
- package/esm/components/QTextField/QTextField.vue.js +1 -1
- package/esm/components/QThemeProvider/QThemeProvider.vue.js +1 -1
- package/esm/components/QToast/QToast.d.ts +4 -2
- package/esm/components/QToast/QToast.d.ts.map +1 -1
- package/esm/components/QToast/QToast.vue.js +80 -67
- package/esm/components/QToast/QToaster.d.ts.map +1 -1
- package/esm/components/QToast/QToaster.vue.js +21 -16
- package/esm/components/QToast/index.d.ts +39 -3
- package/esm/components/QToast/index.d.ts.map +1 -1
- package/esm/components/QToast/types.d.ts +6 -2
- package/esm/components/QToast/types.d.ts.map +1 -1
- package/esm/components/QToggleGroup/QToggleGroupItem.vue.js +1 -1
- package/esm/components/QTooltip/QTooltip.vue.js +1 -1
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.d.ts.map +1 -1
- package/esm/components/index.js +58 -56
- package/esm/composables/index.d.ts +2 -2
- package/esm/composables/index.d.ts.map +1 -1
- package/esm/composables/useColor/index.d.ts +46 -17
- package/esm/composables/useColor/index.d.ts.map +1 -1
- package/esm/composables/useColor/index.js +57 -29
- package/esm/composables/useColor/types.d.ts +4 -1
- package/esm/composables/useColor/types.d.ts.map +1 -1
- package/esm/composables/useDialog/_internal.d.ts +2 -0
- package/esm/composables/useDialog/_internal.d.ts.map +1 -0
- package/esm/composables/useDialog/_internal.js +65 -0
- package/esm/composables/useDialog/index.d.ts +11 -3
- package/esm/composables/useDialog/index.d.ts.map +1 -1
- package/esm/composables/useDialog/index.js +38 -22
- package/esm/composables/useDialog/types.d.ts +25 -11
- package/esm/composables/useDialog/types.d.ts.map +1 -1
- package/esm/composables/useDismissibleLayerStack/index.d.ts +17 -2
- package/esm/composables/useDismissibleLayerStack/index.d.ts.map +1 -1
- package/esm/composables/useDismissibleLayerStack/index.js +28 -11
- package/esm/composables/useGroup/index.d.ts.map +1 -1
- package/esm/composables/useGroup/index.js +12 -1
- package/esm/composables/useId/index.d.ts +18 -0
- package/esm/composables/useId/index.d.ts.map +1 -0
- package/esm/composables/useId/index.js +10 -0
- package/esm/composables/useToast/_internal.d.ts +2 -0
- package/esm/composables/useToast/_internal.d.ts.map +1 -0
- package/esm/composables/useToast/_internal.js +142 -0
- package/esm/composables/useToast/index.d.ts +8 -25
- package/esm/composables/useToast/index.d.ts.map +1 -1
- package/esm/composables/useToast/index.js +29 -26
- package/esm/composables/useToast/types.d.ts +31 -17
- package/esm/composables/useToast/types.d.ts.map +1 -1
- package/esm/framework.d.ts.map +1 -1
- package/esm/framework.js +16 -12
- package/esm/index.d.ts +1 -0
- package/esm/templates/theme.js +39 -39
- package/esm/utils/color/contrast.d.ts +11 -4
- package/esm/utils/color/contrast.d.ts.map +1 -1
- package/esm/utils/color/contrast.js +16 -3
- package/esm/utils/color/index.d.ts +1 -0
- package/esm/utils/color/index.d.ts.map +1 -1
- package/esm/utils/color/merge.d.ts +9 -0
- package/esm/utils/color/merge.d.ts.map +1 -1
- package/esm/utils/color/merge.js +21 -22
- package/esm/utils/color/parse.d.ts +21 -5
- package/esm/utils/color/parse.d.ts.map +1 -1
- package/esm/utils/color/parse.js +88 -20
- package/esm/utils/color/theme-colors.d.ts +35 -0
- package/esm/utils/color/theme-colors.d.ts.map +1 -0
- package/esm/utils/color/theme-colors.js +25 -0
- package/esm/utils/index.js +50 -42
- package/package.json +3 -5
- package/esm/composables/uid.d.ts +0 -9
- package/esm/composables/uid.d.ts.map +0 -1
- package/esm/composables/uid.js +0 -8
- package/esm/composables/useToast/types.js +0 -4
- package/esm/vendors/uuid/dist/native.js +0 -3
- package/esm/vendors/uuid/dist/rng.js +0 -11
- package/esm/vendors/uuid/dist/stringify.js +0 -8
- package/esm/vendors/uuid/dist/v4.js +0 -20
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { UseDialogReturn } from './types
|
|
1
|
+
import { UseDialogReturn } from './types';
|
|
2
|
+
export type { DialogItem, UseDialogReturn } from './types';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Manages programmatic dialogs for the current app (`createFramework`).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* Mount exactly one `QDialogProvider` in the app (typically next to the
|
|
7
|
+
* root layout). Every provider renders the same shared list.
|
|
8
|
+
*
|
|
9
|
+
* @returns An object containing:
|
|
10
|
+
* - dialogs: The array of currently active QDialog instances.
|
|
11
|
+
* - addDialog: A function that adds a QDialog instance according to the given props.
|
|
12
|
+
* - removeDialog: A function to remove a QDialog instance.
|
|
13
|
+
* - cancelDialog: A function to cancel a not-yet-registered dialog by `props.id`.
|
|
6
14
|
*/
|
|
7
15
|
export declare function useDialog(): UseDialogReturn;
|
|
8
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAW9C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,IAAI,eAAe,CA6F3C"}
|
|
@@ -1,29 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { cancelDialogByPropsId as e, hasDialogWithId as t, injectDialogInstance as n, removeDialogEntry as r } from "./_internal.js";
|
|
2
|
+
import { computed as i } from "vue";
|
|
3
3
|
//#region src/composables/useDialog/index.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
function a() {
|
|
5
|
+
let a = n(), { dialogs: o, nextEntryKey: s, pendingByKey: c, hasProvider: l } = a, u = i(() => o.value.map(({ id: e, props: t, options: n, handlers: r }) => ({
|
|
6
|
+
id: e,
|
|
7
|
+
props: t,
|
|
8
|
+
options: n,
|
|
9
|
+
handlers: r
|
|
10
|
+
})));
|
|
11
|
+
function d(e, n, r) {
|
|
12
|
+
return l() ? e.id !== void 0 && t(a, e.id) ? Promise.reject(/* @__PURE__ */ Error(`addDialog(): a dialog with id "${e.id}" already exists.`)) : new Promise((t, i) => {
|
|
13
|
+
let a = s();
|
|
14
|
+
c.set(a, {
|
|
15
|
+
resolve: t,
|
|
16
|
+
reject: i,
|
|
17
|
+
settled: !1
|
|
18
|
+
}), o.value.push({
|
|
19
|
+
entryKey: a,
|
|
20
|
+
props: {
|
|
21
|
+
...e,
|
|
22
|
+
modelValue: !0
|
|
23
|
+
},
|
|
24
|
+
options: n,
|
|
25
|
+
handlers: r
|
|
26
|
+
});
|
|
27
|
+
}) : Promise.reject(/* @__PURE__ */ Error("addDialog() requires a mounted QDialogProvider before it can be called."));
|
|
17
28
|
}
|
|
18
|
-
function
|
|
19
|
-
let t =
|
|
20
|
-
t
|
|
29
|
+
function f(e) {
|
|
30
|
+
let t = o.value.findIndex((t) => t.id === e);
|
|
31
|
+
if (t === -1) throw Error(`removeDialog(): no mounted dialog found with id "${e}".`);
|
|
32
|
+
r(a, t);
|
|
33
|
+
}
|
|
34
|
+
function p(t) {
|
|
35
|
+
e(a, t);
|
|
21
36
|
}
|
|
22
37
|
return {
|
|
23
|
-
dialogs:
|
|
24
|
-
addDialog:
|
|
25
|
-
removeDialog:
|
|
38
|
+
dialogs: u,
|
|
39
|
+
addDialog: d,
|
|
40
|
+
removeDialog: f,
|
|
41
|
+
cancelDialog: p
|
|
26
42
|
};
|
|
27
43
|
}
|
|
28
44
|
//#endregion
|
|
29
|
-
export {
|
|
45
|
+
export { a as useDialog };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { QDialogProps, QDialogOptions, QDialogHandlers } from '../../components/QDialog/types
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { QDialogProps, QDialogOptions, QDialogHandlers } from '../../components/QDialog/types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Public view of a dialog managed by {@link useDialog}.
|
|
5
|
+
*
|
|
6
|
+
* `id` is set when the dialog registers during setup. Prefer `await addDialog(...)` to
|
|
7
|
+
* obtain the id rather than reading it from this list before the promise resolves.
|
|
5
8
|
*/
|
|
6
|
-
export type
|
|
9
|
+
export type DialogItem = {
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
11
|
+
* Unique identifier for the dialog instance, set when the dialog registers during setup.
|
|
9
12
|
*/
|
|
10
|
-
id
|
|
13
|
+
id?: string;
|
|
11
14
|
/**
|
|
12
15
|
* The properties applied to the dialog, conforming to `QDialogProps`.
|
|
13
16
|
*/
|
|
@@ -27,16 +30,27 @@ export type DialogInstance = {
|
|
|
27
30
|
*/
|
|
28
31
|
export type UseDialogReturn = {
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
33
|
+
* Currently active dialogs (public fields only: `id`, `props`, `options`, `handlers`).
|
|
34
|
+
* Read-only: mutating this array does not change the dialog store — use `removeDialog`.
|
|
35
|
+
* `id` is undefined until the dialog registers during setup; use the `addDialog` promise for the id.
|
|
31
36
|
*/
|
|
32
|
-
dialogs:
|
|
37
|
+
dialogs: ComputedRef<DialogItem[]>;
|
|
33
38
|
/**
|
|
34
|
-
* Adds a new dialog to the state with the specified properties
|
|
39
|
+
* Adds a new dialog to the state with the specified properties.
|
|
40
|
+
* Requires a mounted QDialogProvider (exactly one per app); rejects immediately when none is present.
|
|
41
|
+
* Rejects when `props.id` is already used by an active dialog.
|
|
42
|
+
* Resolves with the dialog id once the component registers it during setup.
|
|
35
43
|
*/
|
|
36
|
-
addDialog(props: QDialogProps,
|
|
44
|
+
addDialog(props: QDialogProps, options?: QDialogOptions, handlers?: QDialogHandlers): Promise<string>;
|
|
37
45
|
/**
|
|
38
|
-
* Removes a dialog
|
|
46
|
+
* Removes a mounted dialog by id.
|
|
47
|
+
* Throws when no mounted dialog with that id exists.
|
|
39
48
|
*/
|
|
40
49
|
removeDialog(id: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Cancels a dialog that has not registered yet.
|
|
52
|
+
* Matches `props.id` from `addDialog`. No-op when no matching entry exists.
|
|
53
|
+
*/
|
|
54
|
+
cancelDialog(id: string): void;
|
|
41
55
|
};
|
|
42
56
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAO,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AA+EnG;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,KAAK,EAAE,YAAY,CAAA;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC1B,CAAA;AAeD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;OAIG;IACH,OAAO,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC,CAAA;IAElC;;;;;OAKG;IACH,SAAS,CACR,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,cAAc,EACxB,QAAQ,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAAA;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,CAAA"}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
2
|
export type DismissibleLayerStack = {
|
|
3
|
+
/** Registered layer ids, from bottom (first) to top (last). */
|
|
3
4
|
layers: Ref<string[]>;
|
|
4
5
|
register(id: string): void;
|
|
5
6
|
unregister(id: string): void;
|
|
7
|
+
update(oldId: string, newId: string): void;
|
|
6
8
|
isTop(id: string): boolean;
|
|
7
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* App-wide stack of dismissible layers (overlays, popovers, and similar).
|
|
12
|
+
*
|
|
13
|
+
* The last registered id is the top layer. Escape and outside-interact
|
|
14
|
+
* handling should only run for that layer.
|
|
15
|
+
*
|
|
16
|
+
* @returns The reactive layer list and helpers to register, unregister, and update ids.
|
|
17
|
+
*/
|
|
8
18
|
export declare function useDismissibleLayerStack(): DismissibleLayerStack;
|
|
9
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Stack item helpers that keep the registered id in sync when the override changes.
|
|
21
|
+
*
|
|
22
|
+
* @param id - Layer id (plain string, ref, or getter).
|
|
23
|
+
*/
|
|
24
|
+
export declare function useDismissibleLayerStackItem(id: MaybeRefOrGetter<string>): {
|
|
10
25
|
register: () => void;
|
|
11
26
|
unregister: () => void;
|
|
12
27
|
isTop: () => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useDismissibleLayerStack/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useDismissibleLayerStack/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAmB,MAAM,KAAK,CAAA;AAKjE,MAAM,MAAM,qBAAqB,GAAG;IACnC,+DAA+D;IAC/D,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CAsDhE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;EA0CxE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DismissibleLayerKey as e } from "../../symbols/dismissibleLayer.js";
|
|
2
|
-
import { inject as t, ref as n } from "vue";
|
|
2
|
+
import { inject as t, ref as n, toValue as r, watch as i } from "vue";
|
|
3
3
|
//#region src/composables/useDismissibleLayerStack/index.ts
|
|
4
|
-
function
|
|
4
|
+
function a() {
|
|
5
5
|
let e = n([]);
|
|
6
6
|
function t(t) {
|
|
7
7
|
e.value.push(t);
|
|
@@ -10,24 +10,41 @@ function r() {
|
|
|
10
10
|
let n = e.value.indexOf(t);
|
|
11
11
|
n !== -1 && e.value.splice(n, 1);
|
|
12
12
|
}
|
|
13
|
-
function i(t) {
|
|
13
|
+
function i(t, n) {
|
|
14
|
+
if (t === n) return;
|
|
15
|
+
let r = e.value.indexOf(t);
|
|
16
|
+
if (r === -1) return;
|
|
17
|
+
let i = [...e.value];
|
|
18
|
+
i[r] = n, e.value = i;
|
|
19
|
+
}
|
|
20
|
+
function a(t) {
|
|
14
21
|
return e.value[e.value.length - 1] === t;
|
|
15
22
|
}
|
|
16
23
|
return {
|
|
17
24
|
layers: e,
|
|
18
25
|
register: t,
|
|
19
26
|
unregister: r,
|
|
20
|
-
|
|
27
|
+
update: i,
|
|
28
|
+
isTop: a
|
|
21
29
|
};
|
|
22
30
|
}
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
if (!
|
|
31
|
+
function o(n) {
|
|
32
|
+
let a = t(e);
|
|
33
|
+
if (!a) throw Error("useDismissibleLayerStackItem must be used within a dismissible layer stack context.");
|
|
34
|
+
let o = a, s, c;
|
|
35
|
+
function l() {
|
|
36
|
+
s = r(n), o.register(s), c?.(), c = i(() => r(n), (e, t) => {
|
|
37
|
+
!t || e === t || (o.update(t, e), s = e);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function u() {
|
|
41
|
+
c?.(), c = void 0, s !== void 0 && (o.unregister(s), s = void 0);
|
|
42
|
+
}
|
|
26
43
|
return {
|
|
27
|
-
register:
|
|
28
|
-
unregister:
|
|
29
|
-
isTop: () =>
|
|
44
|
+
register: l,
|
|
45
|
+
unregister: u,
|
|
46
|
+
isTop: () => o.isTop(r(n))
|
|
30
47
|
};
|
|
31
48
|
}
|
|
32
49
|
//#endregion
|
|
33
|
-
export {
|
|
50
|
+
export { a as useDismissibleLayerStack, o as useDismissibleLayerStackItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useGroup/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAKnE,qDAAqD;AACrD,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAyB,CAAA;AAE9E,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAA;AAEpC;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACvB;;;;OAIG;IACH,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAEtB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAA;IAElB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CA2C5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useGroup/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAKnE,qDAAqD;AACrD,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAyB,CAAA;AAE9E,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAA;AAEpC;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACvB;;;;OAIG;IACH,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAEtB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAA;IAElB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CA2C5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,YAAY,GAAG,SAAS,CA+D/E"}
|
|
@@ -20,7 +20,18 @@ function l(n) {
|
|
|
20
20
|
let e = a(n);
|
|
21
21
|
return Array.isArray(r.active.value) ? r.active.value?.includes(e) : r.active.value === e;
|
|
22
22
|
});
|
|
23
|
-
return {
|
|
23
|
+
return o(() => a(n), (e, t) => {
|
|
24
|
+
if (!(t === void 0 || e === t)) {
|
|
25
|
+
if (Array.isArray(r.active.value)) {
|
|
26
|
+
let n = r.active.value.indexOf(t);
|
|
27
|
+
if (n === -1) return;
|
|
28
|
+
let i = [...r.active.value];
|
|
29
|
+
i[n] = e, r.active.value = i;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
r.active.value === t && (r.active.value = e);
|
|
33
|
+
}
|
|
34
|
+
}), {
|
|
24
35
|
isActive: i,
|
|
25
36
|
toggle: () => {
|
|
26
37
|
let e = a(n);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a unique ID for the current component instance, with optional override.
|
|
4
|
+
*
|
|
5
|
+
* Must be called synchronously during `setup`. The returned ID tracks changes to the
|
|
6
|
+
* optional override (for example a reactive `props.id`).
|
|
7
|
+
*
|
|
8
|
+
* Vue's `useId()` prefixes with `app.config.idPrefix` (default `v`) plus `-`.
|
|
9
|
+
* The Vue prefix is rewritten to `q-` by default (`q-0`). When the host sets a custom
|
|
10
|
+
* `idPrefix` (for example `my-app`), it is kept after `q-` (`q-my-app-0`) so nested
|
|
11
|
+
* apps on the same page do not collide.
|
|
12
|
+
*
|
|
13
|
+
* @param [componentId] - Optional component-specific ID.
|
|
14
|
+
* @returns A computed ref containing the resolved ID.
|
|
15
|
+
* @throws When called outside component setup.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useId(componentId?: MaybeRefOrGetter<string | undefined>): ComputedRef<string>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useId/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAKxD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAgB7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { computed as e, getCurrentInstance as t, toValue as n, useId as r } from "vue";
|
|
2
|
+
//#region src/composables/useId/index.ts
|
|
3
|
+
function i(i) {
|
|
4
|
+
let a = r();
|
|
5
|
+
if (!a) throw Error("useId() must be called synchronously during component setup.");
|
|
6
|
+
let o = t()?.appContext.config.idPrefix || "v", s = `${o}-`, c = a.startsWith(s) ? a.slice(s.length) : a, l = o === "v" ? `q-${c}` : `q-${o}-${c}`;
|
|
7
|
+
return e(() => n(i) ?? l);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as useId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/_internal.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { inject as e, ref as t } from "vue";
|
|
2
|
+
//#region src/composables/useToast/_internal.ts
|
|
3
|
+
var n = Symbol.for("q-toast");
|
|
4
|
+
function r(e, t, n) {
|
|
5
|
+
let r = e.get(t);
|
|
6
|
+
if (!r || r.settled) {
|
|
7
|
+
e.delete(t);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
r.reject(n), e.delete(t);
|
|
11
|
+
}
|
|
12
|
+
function i(e, t) {
|
|
13
|
+
for (let [, n] of e) n.settled || n.reject(t);
|
|
14
|
+
e.clear();
|
|
15
|
+
}
|
|
16
|
+
function a(e, t) {
|
|
17
|
+
let n = e.toasts.value[t];
|
|
18
|
+
n && (r(e.pendingByKey, n.entryKey, /* @__PURE__ */ Error("Toast removed before it was ready")), e.toasts.value.splice(t, 1), e.flushQueue());
|
|
19
|
+
}
|
|
20
|
+
function o(e, t) {
|
|
21
|
+
let n = e.toasts.value.findIndex((e) => e.id === t);
|
|
22
|
+
if (n !== -1) {
|
|
23
|
+
a(e, n);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let i = e.queue.value.findIndex((e) => e.id === t);
|
|
27
|
+
if (i === -1) throw Error(`removeToast(): no toast found with id "${t}".`);
|
|
28
|
+
let o = e.queue.value[i];
|
|
29
|
+
r(e.pendingByKey, o.entryKey, /* @__PURE__ */ Error("Toast removed before it was ready")), e.queue.value.splice(i, 1);
|
|
30
|
+
}
|
|
31
|
+
function s(e, t) {
|
|
32
|
+
let n = e.toasts.value.findIndex((e) => e.entryKey === t);
|
|
33
|
+
if (n !== -1) {
|
|
34
|
+
a(e, n);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let i = e.queue.value.findIndex((e) => e.entryKey === t);
|
|
38
|
+
i !== -1 && (r(e.pendingByKey, t, /* @__PURE__ */ Error("Toast removed before it was ready")), e.queue.value.splice(i, 1));
|
|
39
|
+
}
|
|
40
|
+
function c(e, t) {
|
|
41
|
+
let n = (e) => e.id === t || e.props.id === t;
|
|
42
|
+
return e.toasts.value.some(n) || e.queue.value.some(n);
|
|
43
|
+
}
|
|
44
|
+
function l(e, t) {
|
|
45
|
+
let n = e.queue.value.findIndex((e) => e.props.id === t);
|
|
46
|
+
if (n !== -1) {
|
|
47
|
+
let t = e.queue.value[n];
|
|
48
|
+
r(e.pendingByKey, t.entryKey, /* @__PURE__ */ Error("Toast canceled")), e.queue.value.splice(n, 1);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let i = e.toasts.value.findIndex((e) => e.props.id === t && e.id === void 0);
|
|
52
|
+
if (i === -1) return;
|
|
53
|
+
let a = e.toasts.value[i];
|
|
54
|
+
r(e.pendingByKey, a.entryKey, /* @__PURE__ */ Error("Toast canceled")), e.toasts.value.splice(i, 1), e.flushQueue();
|
|
55
|
+
}
|
|
56
|
+
function u() {
|
|
57
|
+
let e = t([]), n = t([]), r = /* @__PURE__ */ new Map(), a, o = 0, s = 0;
|
|
58
|
+
function c() {
|
|
59
|
+
return a === void 0 || e.value.length < a;
|
|
60
|
+
}
|
|
61
|
+
function l() {
|
|
62
|
+
for (; n.value.length > 0 && c();) {
|
|
63
|
+
let t = n.value.shift();
|
|
64
|
+
t && e.value.push(t);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function u(t) {
|
|
68
|
+
if (a = t, typeof t == "number") for (; e.value.length > t;) {
|
|
69
|
+
let t = e.value.pop();
|
|
70
|
+
if (!t) break;
|
|
71
|
+
t.id && t.props.id !== t.id && (t.props = {
|
|
72
|
+
...t.props,
|
|
73
|
+
id: t.id
|
|
74
|
+
}), n.value.unshift(t);
|
|
75
|
+
}
|
|
76
|
+
l();
|
|
77
|
+
}
|
|
78
|
+
function d(t) {
|
|
79
|
+
if (c()) {
|
|
80
|
+
e.value.push(t);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
n.value.push(t);
|
|
84
|
+
}
|
|
85
|
+
function f(t, n) {
|
|
86
|
+
let i = e.value.find((e) => e.entryKey === t);
|
|
87
|
+
if (!i) return;
|
|
88
|
+
i.id = n;
|
|
89
|
+
let a = r.get(t);
|
|
90
|
+
!a || a.settled || (a.settled = !0, a.resolve(n), r.delete(t));
|
|
91
|
+
}
|
|
92
|
+
function p(t, n) {
|
|
93
|
+
let r = e.value.find((e) => e.entryKey === t);
|
|
94
|
+
!r || r.id === n || (r.id = n);
|
|
95
|
+
}
|
|
96
|
+
function m(t, r) {
|
|
97
|
+
let i = e.value.find((e) => e.entryKey === t) ?? n.value.find((e) => e.entryKey === t);
|
|
98
|
+
i && (i.remainingTimeout = r);
|
|
99
|
+
}
|
|
100
|
+
function h(t) {
|
|
101
|
+
let r = e.value.find((e) => e.entryKey === t) ?? n.value.find((e) => e.entryKey === t);
|
|
102
|
+
if (!r || r.remainingTimeout === void 0) return;
|
|
103
|
+
let i = r.remainingTimeout;
|
|
104
|
+
return delete r.remainingTimeout, i;
|
|
105
|
+
}
|
|
106
|
+
function g() {
|
|
107
|
+
return `toast-${++o}`;
|
|
108
|
+
}
|
|
109
|
+
function _() {
|
|
110
|
+
return s > 0;
|
|
111
|
+
}
|
|
112
|
+
function v() {
|
|
113
|
+
if (s > 0) throw Error("Only one QToaster may be mounted per app.");
|
|
114
|
+
s++;
|
|
115
|
+
}
|
|
116
|
+
function y() {
|
|
117
|
+
s = Math.max(0, s - 1), !(s > 0) && (i(r, /* @__PURE__ */ Error("QToaster unmounted before the toast was ready")), e.value = [], n.value = []);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
toasts: e,
|
|
121
|
+
queue: n,
|
|
122
|
+
pendingByKey: r,
|
|
123
|
+
setMaxToasts: u,
|
|
124
|
+
enqueue: d,
|
|
125
|
+
flushQueue: l,
|
|
126
|
+
registerToastEntry: f,
|
|
127
|
+
updateToastEntryId: p,
|
|
128
|
+
setRemainingTimeout: m,
|
|
129
|
+
consumeRemainingTimeout: h,
|
|
130
|
+
nextEntryKey: g,
|
|
131
|
+
hasToaster: _,
|
|
132
|
+
registerToaster: v,
|
|
133
|
+
unregisterToaster: y
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function d() {
|
|
137
|
+
let t = e(n);
|
|
138
|
+
if (!t) throw Error("useToast() requires a provided toast instance (e.g. via createFramework)");
|
|
139
|
+
return t;
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { n as ToastSymbol, l as cancelToastByPropsId, u as createToastInstance, c as hasToastWithId, d as injectToastInstance, s as removeToastByEntryKey, o as removeToastById, a as removeToastEntry };
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UseToastReturn } from './types';
|
|
2
|
+
export type { ToastItem, UseToastReturn } from './types';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Manages programmatic toasts for the current app (`createFramework`).
|
|
5
|
+
*
|
|
6
|
+
* Mount exactly one `QToaster` in the app (typically next to the root
|
|
7
|
+
* layout). Every toaster renders the same shared list.
|
|
4
8
|
*
|
|
5
9
|
* @returns An object containing:
|
|
6
|
-
* - toasts: The array of currently
|
|
10
|
+
* - toasts: The array of currently mounted QToast instances.
|
|
7
11
|
* - addToast: A function that adds a QToast instance to the DOM, according to the given QToastProps.
|
|
8
12
|
* - removeToast: A function to remove a QToast instance from the DOM.
|
|
13
|
+
* - cancelToast: A function to cancel a queued or not-yet-registered toast by `props.id`.
|
|
9
14
|
*/
|
|
10
15
|
export declare function useToast(): UseToastReturn;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new toast instance for managing toast notifications.
|
|
13
|
-
*
|
|
14
|
-
* @returns An object containing a reactive array of toast items.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createToastInstance(): ToastInstance;
|
|
17
|
-
/**
|
|
18
|
-
* Provides a toast notification instance to the current Vue component context.
|
|
19
|
-
*
|
|
20
|
-
* @returns The provided toast instance for managing toast notifications.
|
|
21
|
-
*
|
|
22
|
-
* @see createToastInstance
|
|
23
|
-
* @see ToastSymbol
|
|
24
|
-
*/
|
|
25
|
-
export declare function provideToast(): ToastInstance;
|
|
26
|
-
/**
|
|
27
|
-
* Injects the ToastInstance provided by the ToastSymbol.
|
|
28
|
-
*
|
|
29
|
-
* @throws If the ToastInstance has not been provided via provideToast.
|
|
30
|
-
* @returns The injected ToastInstance.
|
|
31
|
-
*/
|
|
32
|
-
export declare function injectToastInstance(): ToastInstance;
|
|
33
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAW7C,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAsFzC"}
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { inject as n, ref as r } from "vue";
|
|
1
|
+
import { cancelToastByPropsId as e, hasToastWithId as t, injectToastInstance as n, removeToastById as r } from "./_internal.js";
|
|
2
|
+
import { computed as i } from "vue";
|
|
4
3
|
//#region src/composables/useToast/index.ts
|
|
5
|
-
function
|
|
6
|
-
let { toasts:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
function a() {
|
|
5
|
+
let a = n(), { toasts: o, nextEntryKey: s, enqueue: c, pendingByKey: l, hasToaster: u } = a, d = i(() => o.value.map(({ id: e, props: t }) => ({
|
|
6
|
+
id: e,
|
|
7
|
+
props: t
|
|
8
|
+
})));
|
|
9
|
+
function f(e) {
|
|
10
|
+
return u() ? e.id !== void 0 && t(a, e.id) ? Promise.reject(/* @__PURE__ */ Error(`addToast(): a toast with id "${e.id}" already exists.`)) : new Promise((t, n) => {
|
|
11
|
+
let r = s();
|
|
12
|
+
l.set(r, {
|
|
13
|
+
resolve: t,
|
|
14
|
+
reject: n,
|
|
15
|
+
settled: !1
|
|
16
|
+
}), c({
|
|
17
|
+
entryKey: r,
|
|
18
|
+
props: e
|
|
19
|
+
});
|
|
20
|
+
}) : Promise.reject(/* @__PURE__ */ Error("addToast() requires a mounted QToaster before it can be called."));
|
|
21
|
+
}
|
|
22
|
+
function p(e) {
|
|
23
|
+
r(a, e);
|
|
13
24
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
n !== -1 && t.value.splice(n, 1);
|
|
25
|
+
function m(t) {
|
|
26
|
+
e(a, t);
|
|
17
27
|
}
|
|
18
28
|
return {
|
|
19
|
-
toasts:
|
|
20
|
-
addToast:
|
|
21
|
-
removeToast:
|
|
29
|
+
toasts: d,
|
|
30
|
+
addToast: f,
|
|
31
|
+
removeToast: p,
|
|
32
|
+
cancelToast: m
|
|
22
33
|
};
|
|
23
34
|
}
|
|
24
|
-
function a() {
|
|
25
|
-
return { toasts: r([]) };
|
|
26
|
-
}
|
|
27
|
-
function o() {
|
|
28
|
-
let e = n(t);
|
|
29
|
-
if (!e) throw Error("useInjectedToast must be used after provideToast");
|
|
30
|
-
return e;
|
|
31
|
-
}
|
|
32
35
|
//#endregion
|
|
33
|
-
export { a as
|
|
36
|
+
export { a as useToast };
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
2
|
import { QToastProps } from '../../components/QToast';
|
|
3
|
-
export declare const ToastSymbol: InjectionKey<ToastInstance>;
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A Vue Ref containing the list of active toast notifications.
|
|
10
|
-
*/
|
|
11
|
-
toasts: Ref<ToastItem[]>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Represents a single toast item managed in the toasts state array.
|
|
4
|
+
* Public view of a mounted toast.
|
|
5
|
+
*
|
|
6
|
+
* `id` is set when the toast registers during setup. Prefer `await addToast(...)` to obtain the id.
|
|
15
7
|
*/
|
|
16
8
|
export type ToastItem = {
|
|
17
9
|
/**
|
|
18
|
-
*
|
|
10
|
+
* Unique identifier for the toast item, set when the toast registers during setup.
|
|
19
11
|
*/
|
|
20
|
-
id
|
|
12
|
+
id?: string;
|
|
21
13
|
/**
|
|
22
14
|
* The properties applied to the toast item, conforming to `QToastProps`.
|
|
23
15
|
*/
|
|
@@ -27,14 +19,36 @@ export type ToastItem = {
|
|
|
27
19
|
* Represents the return type of the `useToast` composable, providing methods and state
|
|
28
20
|
* for managing toast notifications.
|
|
29
21
|
*/
|
|
30
|
-
export type UseToastReturn =
|
|
22
|
+
export type UseToastReturn = {
|
|
23
|
+
/**
|
|
24
|
+
* Currently mounted toasts (public fields only: `id`, `props`).
|
|
25
|
+
* Read-only: mutating this array does not change the toast store — use `removeToast`.
|
|
26
|
+
* `id` is undefined until the toast registers during setup; use the `addToast` promise for the id.
|
|
27
|
+
*/
|
|
28
|
+
toasts: ComputedRef<ToastItem[]>;
|
|
31
29
|
/**
|
|
32
30
|
* A function to add a toast item to the DOM.
|
|
31
|
+
* Requires a mounted QToaster (exactly one per app); rejects immediately when none is present.
|
|
32
|
+
* Rejects when `props.id` is already used by a mounted or queued toast.
|
|
33
|
+
* Resolves with the toast id once the component registers it during setup.
|
|
34
|
+
* When `maxToasts` is set and the stack is full, the toast waits in a queue and the
|
|
35
|
+
* promise stays pending until a slot opens and the toast registers during setup.
|
|
33
36
|
*/
|
|
34
|
-
addToast(props: QToastProps
|
|
37
|
+
addToast(props: QToastProps): Promise<string>;
|
|
35
38
|
/**
|
|
36
|
-
*
|
|
39
|
+
* Removes a toast that has already registered its public id — mounted or demoted
|
|
40
|
+
* into the queue. Throws when no toast with that registered id exists.
|
|
41
|
+
* For never-mounted queue entries or not-yet-registered mounts, use `cancelToast`
|
|
42
|
+
* with `props.id`. Demoted toasts accept either API.
|
|
37
43
|
*/
|
|
38
44
|
removeToast(id: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Cancels a never-mounted queue entry, a demoted queue entry, or a mount that has
|
|
47
|
+
* not registered yet. Matches `props.id` from `addToast` (demotion copies the
|
|
48
|
+
* registered id onto `props.id`). No-op when no matching entry exists.
|
|
49
|
+
* For registered mounted toasts, use `removeToast`. Rejects an unsettled
|
|
50
|
+
* `addToast` promise with "Toast canceled".
|
|
51
|
+
*/
|
|
52
|
+
cancelToast(id: string): void;
|
|
39
53
|
};
|
|
40
54
|
//# sourceMappingURL=types.d.ts.map
|