@quidgest/ui 0.20.1 → 0.21.0
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 +17 -0
- package/README.md +10 -0
- package/dist/json/api.json +36 -1
- package/dist/ui.css +52 -248
- package/dist/ui.esm.js +782 -677
- package/dist/ui.js +718 -613
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +718 -613
- package/dist/ui.scss +74 -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.vue.js +1 -1
- 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/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/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,41 +1,69 @@
|
|
|
1
|
-
import { rgbToHex as e,
|
|
2
|
-
import { parseColor as
|
|
3
|
-
import { getContrastingColor as
|
|
4
|
-
import { darken as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { rgbToHex as e, rgbToVariableString as t } from "../../utils/color/conversion.js";
|
|
2
|
+
import { parseColor as n } from "../../utils/color/parse.js";
|
|
3
|
+
import { getContrastingColor as r } from "../../utils/color/contrast.js";
|
|
4
|
+
import { darken as i } from "../../utils/color/manipulate.js";
|
|
5
|
+
import { isThemeColor as a, isUnsupportedColor as o } from "../../utils/color/theme-colors.js";
|
|
6
|
+
import { useTheme as s } from "../theme.js";
|
|
7
|
+
import { computed as c, unref as l } from "vue";
|
|
7
8
|
//#region src/composables/useColor/index.ts
|
|
8
|
-
function
|
|
9
|
-
|
|
9
|
+
function u(e) {
|
|
10
|
+
typeof process < "u" && process.env.NODE_ENV === "production" || console.warn(`[Quidgest UI] useColor: unable to resolve color "${e}"`);
|
|
11
|
+
}
|
|
12
|
+
function d(n) {
|
|
13
|
+
let a = i(n, 25);
|
|
14
|
+
return {
|
|
15
|
+
hoverColor: e(a),
|
|
16
|
+
hoverColorRgb: t(a),
|
|
17
|
+
onHoverColor: r(a)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function f(e, i, a, o) {
|
|
21
|
+
if (i) {
|
|
22
|
+
let i = e, o = a[`${i}Dark`];
|
|
23
|
+
if (typeof o == "string") try {
|
|
24
|
+
let e = n(o), s = a[`on${i.charAt(0).toUpperCase()}${i.slice(1)}Dark`];
|
|
25
|
+
return {
|
|
26
|
+
hoverColor: o,
|
|
27
|
+
hoverColorRgb: t(e),
|
|
28
|
+
onHoverColor: typeof s == "string" ? s : r(e)
|
|
29
|
+
};
|
|
30
|
+
} catch {
|
|
31
|
+
u(o);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return d(o);
|
|
35
|
+
}
|
|
36
|
+
function p(e) {
|
|
37
|
+
let i = c(() => l(e)), d = s(), p = c(() => i.value ? a(i.value) : !1);
|
|
10
38
|
return {
|
|
11
|
-
isUtilityColor:
|
|
12
|
-
style:
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
15
|
-
|
|
39
|
+
isUtilityColor: p,
|
|
40
|
+
style: c(() => {
|
|
41
|
+
let e = i.value;
|
|
42
|
+
if (!e) return;
|
|
43
|
+
if (!p.value && o(e)) {
|
|
44
|
+
u(e);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let a = m(e, d.current.value.scheme), s;
|
|
16
48
|
try {
|
|
17
|
-
|
|
18
|
-
} catch
|
|
19
|
-
|
|
49
|
+
s = n(a);
|
|
50
|
+
} catch {
|
|
51
|
+
u(e);
|
|
20
52
|
return;
|
|
21
53
|
}
|
|
22
|
-
let
|
|
54
|
+
let c = r(s), l = f(e, p.value, d.current.value.scheme, s);
|
|
23
55
|
return {
|
|
24
|
-
mainColor:
|
|
25
|
-
mainColorRgb:
|
|
26
|
-
onMainColor:
|
|
27
|
-
|
|
28
|
-
hoverColorRgb: n(p),
|
|
29
|
-
onHoverColor: d
|
|
56
|
+
mainColor: a,
|
|
57
|
+
mainColorRgb: t(s),
|
|
58
|
+
onMainColor: c,
|
|
59
|
+
...l
|
|
30
60
|
};
|
|
31
61
|
})
|
|
32
62
|
};
|
|
33
63
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function d(e) {
|
|
38
|
-
return e.startsWith("#") || e.startsWith("rgb") || e.startsWith("hsl");
|
|
64
|
+
function m(e, t) {
|
|
65
|
+
let n = e.trim();
|
|
66
|
+
return Object.prototype.hasOwnProperty.call(t, n) ? t[n] ?? e : e;
|
|
39
67
|
}
|
|
40
68
|
//#endregion
|
|
41
|
-
export {
|
|
69
|
+
export { m as resolveColor, f as resolveHoverStyle, p as useColor };
|
|
@@ -13,10 +13,12 @@ export interface ColorStyle {
|
|
|
13
13
|
mainColorRgb: string;
|
|
14
14
|
/**
|
|
15
15
|
* The color to be used for content on top of the main color.
|
|
16
|
+
* Computed using WCAG relative luminance.
|
|
16
17
|
*/
|
|
17
18
|
onMainColor: string;
|
|
18
19
|
/**
|
|
19
20
|
* Optional color to be used when the component is in hover state.
|
|
21
|
+
* Scheme `*Dark` for theme utilities when present; otherwise `darken(main, COLOR_SCHEME_DARKEN_AMOUNT)`.
|
|
20
22
|
*/
|
|
21
23
|
hoverColor?: string;
|
|
22
24
|
/**
|
|
@@ -25,6 +27,7 @@ export interface ColorStyle {
|
|
|
25
27
|
hoverColorRgb?: string;
|
|
26
28
|
/**
|
|
27
29
|
* Optional color to be used for content when the component is in hover state.
|
|
30
|
+
* Scheme `on*Dark` for theme utilities when present; otherwise WCAG against the hover background.
|
|
28
31
|
*/
|
|
29
32
|
onHoverColor?: string;
|
|
30
33
|
}
|
|
@@ -33,7 +36,7 @@ export interface ColorStyle {
|
|
|
33
36
|
*/
|
|
34
37
|
export interface UseColorReturn {
|
|
35
38
|
/**
|
|
36
|
-
* A computed reference indicating whether the color is a utility
|
|
39
|
+
* A computed reference indicating whether the color is a theme utility key.
|
|
37
40
|
*/
|
|
38
41
|
isUtilityColor: ComputedRef<boolean>;
|
|
39
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useColor/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useColor/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAEpC;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/_internal.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { inject as e, ref as t } from "vue";
|
|
2
|
+
//#region src/composables/useDialog/_internal.ts
|
|
3
|
+
var n = Symbol.for("q-dialog");
|
|
4
|
+
function r(e, t) {
|
|
5
|
+
let n = e.dialogs.value[t];
|
|
6
|
+
if (!n) return;
|
|
7
|
+
let r = e.pendingByKey.get(n.entryKey);
|
|
8
|
+
r && !r.settled && (r.reject(/* @__PURE__ */ Error("Dialog removed before it was ready")), e.pendingByKey.delete(n.entryKey)), (n.handlers?.onLeave?.() ?? !0) && e.dialogs.value.splice(t, 1);
|
|
9
|
+
}
|
|
10
|
+
function i(e, t) {
|
|
11
|
+
return e.dialogs.value.some((e) => e.id === t || e.props.id === t);
|
|
12
|
+
}
|
|
13
|
+
function a(e, t) {
|
|
14
|
+
let n = e.dialogs.value.findIndex((e) => e.props.id === t && e.id === void 0);
|
|
15
|
+
if (n === -1) return;
|
|
16
|
+
let r = e.dialogs.value[n], i = e.pendingByKey.get(r.entryKey);
|
|
17
|
+
i && !i.settled && (i.reject(/* @__PURE__ */ Error("Dialog canceled")), e.pendingByKey.delete(r.entryKey)), e.dialogs.value.splice(n, 1);
|
|
18
|
+
}
|
|
19
|
+
function o() {
|
|
20
|
+
let e = t([]), n = /* @__PURE__ */ new Map(), r = 0, i = 0;
|
|
21
|
+
function a(t, r) {
|
|
22
|
+
let i = e.value.find((e) => e.entryKey === t);
|
|
23
|
+
if (!i) return;
|
|
24
|
+
i.id = r;
|
|
25
|
+
let a = n.get(t);
|
|
26
|
+
!a || a.settled || (a.settled = !0, a.resolve(r), n.delete(t), i.handlers?.onEnter?.());
|
|
27
|
+
}
|
|
28
|
+
function o(t, n) {
|
|
29
|
+
let r = e.value.find((e) => e.entryKey === t);
|
|
30
|
+
!r || r.id === n || (r.id = n);
|
|
31
|
+
}
|
|
32
|
+
function s() {
|
|
33
|
+
return `dialog-${++r}`;
|
|
34
|
+
}
|
|
35
|
+
function c() {
|
|
36
|
+
return i > 0;
|
|
37
|
+
}
|
|
38
|
+
function l() {
|
|
39
|
+
if (i > 0) throw Error("Only one QDialogProvider may be mounted per app.");
|
|
40
|
+
i++;
|
|
41
|
+
}
|
|
42
|
+
function u() {
|
|
43
|
+
if (i = Math.max(0, i - 1), !(i > 0)) {
|
|
44
|
+
for (let [, e] of n) e.settled || e.reject(/* @__PURE__ */ Error("Dialog provider unmounted before the dialog was ready"));
|
|
45
|
+
n.clear(), e.value = [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
dialogs: e,
|
|
50
|
+
pendingByKey: n,
|
|
51
|
+
registerDialogEntry: a,
|
|
52
|
+
updateDialogEntryId: o,
|
|
53
|
+
nextEntryKey: s,
|
|
54
|
+
hasProvider: c,
|
|
55
|
+
registerProvider: l,
|
|
56
|
+
unregisterProvider: u
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function s() {
|
|
60
|
+
let t = e(n);
|
|
61
|
+
if (!t) throw Error("useDialog() requires a provided dialog instance (e.g. via createFramework)");
|
|
62
|
+
return t;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { n as DialogSymbol, a as cancelDialogByPropsId, o as createDialogInstance, i as hasDialogWithId, s as injectDialogInstance, r as removeDialogEntry };
|
|
@@ -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":""}
|