@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.
Files changed (129) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +10 -0
  3. package/dist/json/api.json +36 -1
  4. package/dist/ui.css +52 -248
  5. package/dist/ui.esm.js +782 -677
  6. package/dist/ui.js +718 -613
  7. package/dist/ui.min.css +1 -1
  8. package/dist/ui.min.js +718 -613
  9. package/dist/ui.scss +74 -34
  10. package/esm/components/QAccordion/QAccordionItem.vue.js +1 -1
  11. package/esm/components/QBadge/QBadge.d.ts.map +1 -1
  12. package/esm/components/QBadge/QBadge.vue.js +20 -24
  13. package/esm/components/QButton/QButton.d.ts.map +1 -1
  14. package/esm/components/QButton/QButton.vue.js +32 -29
  15. package/esm/components/QCheckbox/QCheckbox.vue.js +1 -1
  16. package/esm/components/QDialog/QDialog.d.ts +4 -2
  17. package/esm/components/QDialog/QDialog.d.ts.map +1 -1
  18. package/esm/components/QDialog/QDialog.vue.js +84 -74
  19. package/esm/components/QDialog/QDialogProvider.d.ts.map +1 -1
  20. package/esm/components/QDialog/QDialogProvider.vue.js +21 -12
  21. package/esm/components/QDialog/index.d.ts +72 -3
  22. package/esm/components/QDialog/index.d.ts.map +1 -1
  23. package/esm/components/QDialog/types.d.ts +10 -1
  24. package/esm/components/QDialog/types.d.ts.map +1 -1
  25. package/esm/components/QDismissibleLayer/QDismissibleLayer.d.ts.map +1 -1
  26. package/esm/components/QDismissibleLayer/QDismissibleLayer.vue.js +9 -8
  27. package/esm/components/QDivider/QDivider.d.ts.map +1 -1
  28. package/esm/components/QDivider/QDivider.vue.js +3 -3
  29. package/esm/components/QFileUpload/QFileUpload.vue.js +1 -1
  30. package/esm/components/QGauge/QGauge.vue.js +1 -1
  31. package/esm/components/QList/QListItem.d.ts.map +1 -1
  32. package/esm/components/QList/QListItem.vue.js +5 -2
  33. package/esm/components/QList/QListItemGroup.vue.js +1 -1
  34. package/esm/components/QObfuscation/QObfuscation.vue.js +1 -1
  35. package/esm/components/QPhoneField/QPhoneField.d.ts.map +1 -1
  36. package/esm/components/QPhoneField/QPhoneField.vue.js +1 -1
  37. package/esm/components/QPropertyList/QPropertyListGroup.vue.js +1 -1
  38. package/esm/components/QPropertyList/QPropertyListRow.vue.js +1 -1
  39. package/esm/components/QPropertyList/index.d.ts.map +1 -1
  40. package/esm/components/QRadioGroup/QRadioButton.vue.js +1 -1
  41. package/esm/components/QRadioGroup/QRadioGroup.vue.js +2 -2
  42. package/esm/components/QSelect/QSelect.d.ts.map +1 -1
  43. package/esm/components/QSelect/QSelect.vue.js +1 -1
  44. package/esm/components/QSidebar/QSidebar.d.ts.map +1 -1
  45. package/esm/components/QSidebar/QSidebar.vue.js +19 -10
  46. package/esm/components/QSidebar/QSidebarItem.d.ts.map +1 -1
  47. package/esm/components/QSidebar/QSidebarItem.vue.js +51 -49
  48. package/esm/components/QSidebar/context.d.ts +7 -0
  49. package/esm/components/QSidebar/context.d.ts.map +1 -1
  50. package/esm/components/QSwitch/QSwitch.vue.js +1 -1
  51. package/esm/components/QTabs/QTab.d.ts.map +1 -1
  52. package/esm/components/QTabs/QTab.vue.js +52 -50
  53. package/esm/components/QTabs/QTabs.d.ts.map +1 -1
  54. package/esm/components/QTabs/QTabs.vue.js +37 -12
  55. package/esm/components/QTabs/context.d.ts +7 -0
  56. package/esm/components/QTabs/context.d.ts.map +1 -1
  57. package/esm/components/QTextArea/QTextArea.vue.js +1 -1
  58. package/esm/components/QTextField/QTextField.d.ts.map +1 -1
  59. package/esm/components/QTextField/QTextField.vue.js +1 -1
  60. package/esm/components/QThemeProvider/QThemeProvider.vue.js +1 -1
  61. package/esm/components/QToast/QToast.d.ts +4 -2
  62. package/esm/components/QToast/QToast.d.ts.map +1 -1
  63. package/esm/components/QToast/QToast.vue.js +80 -67
  64. package/esm/components/QToast/QToaster.d.ts.map +1 -1
  65. package/esm/components/QToast/QToaster.vue.js +21 -16
  66. package/esm/components/QToast/index.d.ts +39 -3
  67. package/esm/components/QToast/index.d.ts.map +1 -1
  68. package/esm/components/QToast/types.d.ts +6 -2
  69. package/esm/components/QToast/types.d.ts.map +1 -1
  70. package/esm/components/QToggleGroup/QToggleGroupItem.vue.js +1 -1
  71. package/esm/components/QTooltip/QTooltip.vue.js +1 -1
  72. package/esm/composables/index.d.ts +2 -2
  73. package/esm/composables/index.d.ts.map +1 -1
  74. package/esm/composables/useColor/index.d.ts +46 -17
  75. package/esm/composables/useColor/index.d.ts.map +1 -1
  76. package/esm/composables/useColor/index.js +57 -29
  77. package/esm/composables/useColor/types.d.ts +4 -1
  78. package/esm/composables/useColor/types.d.ts.map +1 -1
  79. package/esm/composables/useDialog/_internal.d.ts +2 -0
  80. package/esm/composables/useDialog/_internal.d.ts.map +1 -0
  81. package/esm/composables/useDialog/_internal.js +65 -0
  82. package/esm/composables/useDialog/index.d.ts +11 -3
  83. package/esm/composables/useDialog/index.d.ts.map +1 -1
  84. package/esm/composables/useDialog/index.js +38 -22
  85. package/esm/composables/useDialog/types.d.ts +25 -11
  86. package/esm/composables/useDialog/types.d.ts.map +1 -1
  87. package/esm/composables/useDismissibleLayerStack/index.d.ts +17 -2
  88. package/esm/composables/useDismissibleLayerStack/index.d.ts.map +1 -1
  89. package/esm/composables/useDismissibleLayerStack/index.js +28 -11
  90. package/esm/composables/useGroup/index.d.ts.map +1 -1
  91. package/esm/composables/useGroup/index.js +12 -1
  92. package/esm/composables/useId/index.d.ts +18 -0
  93. package/esm/composables/useId/index.d.ts.map +1 -0
  94. package/esm/composables/useId/index.js +10 -0
  95. package/esm/composables/useToast/_internal.d.ts +2 -0
  96. package/esm/composables/useToast/_internal.d.ts.map +1 -0
  97. package/esm/composables/useToast/_internal.js +142 -0
  98. package/esm/composables/useToast/index.d.ts +8 -25
  99. package/esm/composables/useToast/index.d.ts.map +1 -1
  100. package/esm/composables/useToast/index.js +29 -26
  101. package/esm/composables/useToast/types.d.ts +31 -17
  102. package/esm/composables/useToast/types.d.ts.map +1 -1
  103. package/esm/framework.d.ts.map +1 -1
  104. package/esm/framework.js +16 -12
  105. package/esm/templates/theme.js +39 -39
  106. package/esm/utils/color/contrast.d.ts +11 -4
  107. package/esm/utils/color/contrast.d.ts.map +1 -1
  108. package/esm/utils/color/contrast.js +16 -3
  109. package/esm/utils/color/index.d.ts +1 -0
  110. package/esm/utils/color/index.d.ts.map +1 -1
  111. package/esm/utils/color/merge.d.ts +9 -0
  112. package/esm/utils/color/merge.d.ts.map +1 -1
  113. package/esm/utils/color/merge.js +21 -22
  114. package/esm/utils/color/parse.d.ts +21 -5
  115. package/esm/utils/color/parse.d.ts.map +1 -1
  116. package/esm/utils/color/parse.js +88 -20
  117. package/esm/utils/color/theme-colors.d.ts +35 -0
  118. package/esm/utils/color/theme-colors.d.ts.map +1 -0
  119. package/esm/utils/color/theme-colors.js +25 -0
  120. package/esm/utils/index.js +50 -42
  121. package/package.json +3 -5
  122. package/esm/composables/uid.d.ts +0 -9
  123. package/esm/composables/uid.d.ts.map +0 -1
  124. package/esm/composables/uid.js +0 -8
  125. package/esm/composables/useToast/types.js +0 -4
  126. package/esm/vendors/uuid/dist/native.js +0 -3
  127. package/esm/vendors/uuid/dist/rng.js +0 -11
  128. package/esm/vendors/uuid/dist/stringify.js +0 -8
  129. package/esm/vendors/uuid/dist/v4.js +0 -20
@@ -1,41 +1,69 @@
1
- import { rgbToHex as e, rgbToHsl as t, rgbToVariableString as n } from "../../utils/color/conversion.js";
2
- import { parseColor as r } from "../../utils/color/parse.js";
3
- import { getContrastingColor as i } from "../../utils/color/contrast.js";
4
- import { darken as a } from "../../utils/color/manipulate.js";
5
- import { useTheme as o } from "../theme.js";
6
- import { computed as s, unref as c } from "vue";
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 l(l) {
9
- let f = s(() => c(l));
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: s(() => f.value ? !d(f.value) : !1),
12
- style: s(() => {
13
- let s = f.value;
14
- if (!s) return;
15
- let c = u(s, o().current.value.scheme), l;
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
- if (l = r(c), !l) return;
18
- } catch (e) {
19
- console.error("Failed to parse color:", e);
49
+ s = n(a);
50
+ } catch {
51
+ u(e);
20
52
  return;
21
53
  }
22
- let d = i(t(l).l), p = a(l, 25), m = e(p);
54
+ let c = r(s), l = f(e, p.value, d.current.value.scheme, s);
23
55
  return {
24
- mainColor: c,
25
- mainColorRgb: n(l),
26
- onMainColor: d,
27
- hoverColor: m,
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 u(e, t) {
35
- return d(e) ? e : t[e] ?? e;
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 { d as isCssColor, u as resolveColor, l as useColor };
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 color.
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;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;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"}
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=_internal.d.ts.map
@@ -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.ts';
1
+ import { UseDialogReturn } from './types';
2
+ export type { DialogItem, UseDialogReturn } from './types';
2
3
  /**
3
- * Manager for dialog models
4
+ * Manages programmatic dialogs for the current app (`createFramework`).
4
5
  *
5
- * @returns Dialog state and functions
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":"AAMA,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,eAAe,CAyD3C"}
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 { useId as e } from "../uid.js";
2
- import { ref as t } from "vue";
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
- var n = t([]);
5
- function r() {
6
- function t(t, r, i, a) {
7
- let o = e(r).value;
8
- return n.value.push({
9
- id: o,
10
- props: {
11
- ...t,
12
- modelValue: !0
13
- },
14
- options: i,
15
- handlers: a
16
- }), a?.onEnter && a.onEnter(), o;
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 r(e) {
19
- let t = n.value.findIndex((t) => t.id === e);
20
- t !== -1 && (n.value[t]?.handlers?.onLeave?.() ?? !0) && n.value.splice(t, 1);
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: n,
24
- addDialog: t,
25
- removeDialog: r
38
+ dialogs: u,
39
+ addDialog: d,
40
+ removeDialog: f,
41
+ cancelDialog: p
26
42
  };
27
43
  }
28
44
  //#endregion
29
- export { r as useDialog };
45
+ export { a as useDialog };
@@ -1,13 +1,16 @@
1
- import { Ref } from 'vue';
2
- import { QDialogProps, QDialogOptions, QDialogHandlers } from '../../components/QDialog/types.ts';
1
+ import { ComputedRef } from 'vue';
2
+ import { QDialogProps, QDialogOptions, QDialogHandlers } from '../../components/QDialog/types';
3
3
  /**
4
- * Represents an instance of a dialog component.
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 DialogInstance = {
9
+ export type DialogItem = {
7
10
  /**
8
- * A unique identifier for the dialog instance.
11
+ * Unique identifier for the dialog instance, set when the dialog registers during setup.
9
12
  */
10
- id: string;
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
- * A Vue Ref containing the list of currently active dialog instances.
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: Ref<DialogInstance[]>;
37
+ dialogs: ComputedRef<DialogItem[]>;
33
38
  /**
34
- * Adds a new dialog to the state with the specified properties and an optional custom ID.
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, id?: string, options?: QDialogOptions, handlers?: QDialogHandlers): string;
44
+ addDialog(props: QDialogProps, options?: QDialogOptions, handlers?: QDialogHandlers): Promise<string>;
37
45
  /**
38
- * Removes a dialog from the state by its unique identifier.
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,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,MAAM,mCAAmC,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;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;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC,CAAA;IAE9B;;OAEG;IACH,SAAS,CACR,KAAK,EAAE,YAAY,EACnB,EAAE,CAAC,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,cAAc,EACxB,QAAQ,CAAC,EAAE,eAAe,GACxB,MAAM,CAAA;IAET;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B,CAAA"}
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
- export declare function useDismissibleLayerStackItem(id: string): {
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,GAAG,EAAE,MAAM,KAAK,CAAA;AAK9B,MAAM,MAAM,qBAAqB,GAAG;IACnC,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,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CAC1B,CAAA;AAED,wBAAgB,wBAAwB,IAAI,qBAAqB,CAmBhE;AAED,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM;;;;EActD"}
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 r() {
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
- isTop: i
27
+ update: i,
28
+ isTop: a
21
29
  };
22
30
  }
23
- function i(n) {
24
- let r = t(e);
25
- if (!r) throw Error("useDismissibleLayerStackItem must be used within a dismissible layer stack context.");
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: () => r.register(n),
28
- unregister: () => r.unregister(n),
29
- isTop: () => r.isTop(n)
44
+ register: l,
45
+ unregister: u,
46
+ isTop: () => o.isTop(r(n))
30
47
  };
31
48
  }
32
49
  //#endregion
33
- export { r as useDismissibleLayerStack, i as useDismissibleLayerStackItem };
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,CAyC/E"}
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=_internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_internal.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/_internal.ts"],"names":[],"mappings":""}