@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
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAO,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AA+H1D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,KAAK,EAAE,WAAW,CAAA;CAClB,CAAA;AAoBD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC,CAAA;IAEhC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE7C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA"}
|
package/esm/framework.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAA;AAMrE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC,gFAAgF;IAChF,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAA;AAMrE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC,gFAAgF;IAChF,MAAM,CAAC,EAAE,SAAS,CAAA;IAElB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,eAAoB,GAAG,MAAM,CA2BpE"}
|
package/esm/framework.js
CHANGED
|
@@ -4,21 +4,21 @@ import { createThemeInstance as r, generateRootStyle as i } from "./utils/theme.
|
|
|
4
4
|
import { ThemeSymbol as a } from "./composables/theme.js";
|
|
5
5
|
import { DismissibleLayerKey as o } from "./symbols/dismissibleLayer.js";
|
|
6
6
|
import { useDismissibleLayerStack as s } from "./composables/useDismissibleLayerStack/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import { createToastInstance as
|
|
9
|
-
import { ref as
|
|
7
|
+
import { DialogSymbol as c, createDialogInstance as l } from "./composables/useDialog/_internal.js";
|
|
8
|
+
import { ToastSymbol as u, createToastInstance as d } from "./composables/useToast/_internal.js";
|
|
9
|
+
import { ref as f, watch as p } from "vue";
|
|
10
10
|
//#region src/framework.ts
|
|
11
|
-
function
|
|
11
|
+
function m(e = {}) {
|
|
12
12
|
return { install: (t) => {
|
|
13
13
|
let r = e.components || {};
|
|
14
14
|
for (let e in r) t.component(e, r[e]);
|
|
15
15
|
let i = e.defaults || {};
|
|
16
|
-
t.provide(n,
|
|
16
|
+
t.provide(n, f(i)), h(t, e.themes);
|
|
17
17
|
let a = s();
|
|
18
|
-
t.provide(o, a),
|
|
18
|
+
t.provide(o, a), g(t), _(t);
|
|
19
19
|
} };
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function h(n, o) {
|
|
22
22
|
let s = [], c;
|
|
23
23
|
if (o) for (let n of o.themes) {
|
|
24
24
|
let r = {
|
|
@@ -44,17 +44,21 @@ function p(n, o) {
|
|
|
44
44
|
s.push(...n), c = "light";
|
|
45
45
|
}
|
|
46
46
|
if (c) {
|
|
47
|
-
let e = r(
|
|
48
|
-
i(s),
|
|
47
|
+
let e = r(f(c), f(s));
|
|
48
|
+
i(s), p(e.class, v, { immediate: !0 }), n.provide(a, e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function g(e) {
|
|
52
|
+
let t = d();
|
|
53
|
+
e.provide(u, t);
|
|
54
|
+
}
|
|
55
|
+
function _(e) {
|
|
52
56
|
let t = l();
|
|
53
57
|
e.provide(c, t);
|
|
54
58
|
}
|
|
55
|
-
function
|
|
59
|
+
function v(e) {
|
|
56
60
|
let t = document.documentElement;
|
|
57
61
|
t.className = Array.from(t.classList).filter((e) => !e.startsWith("q-theme")).join(" "), t.classList.add(e);
|
|
58
62
|
}
|
|
59
63
|
//#endregion
|
|
60
|
-
export {
|
|
64
|
+
export { m as createFramework };
|
package/esm/templates/theme.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
//#region src/templates/theme.ts
|
|
2
2
|
var e = {
|
|
3
3
|
primary: "#008ad2",
|
|
4
|
-
primaryLight: "#
|
|
5
|
-
primaryDark: "#
|
|
4
|
+
primaryLight: "#b4e5ff",
|
|
5
|
+
primaryDark: "#00669d",
|
|
6
6
|
secondary: "#001d31",
|
|
7
7
|
secondaryLight: "#e6eef3",
|
|
8
8
|
secondaryDark: "#001425",
|
|
9
9
|
highlight: "#ff8241",
|
|
10
|
-
highlightLight: "#
|
|
11
|
-
highlightDark: "#
|
|
10
|
+
highlightLight: "#ffe0d0",
|
|
11
|
+
highlightDark: "#f15400",
|
|
12
12
|
info: "#17a2b8",
|
|
13
13
|
infoLight: "#bceff7",
|
|
14
|
-
infoDark: "#
|
|
14
|
+
infoDark: "#117b8c",
|
|
15
15
|
success: "#28a745",
|
|
16
16
|
successLight: "#c2f0cd",
|
|
17
|
-
successDark: "#
|
|
17
|
+
successDark: "#1f7e35",
|
|
18
18
|
warning: "#ffa900",
|
|
19
19
|
warningLight: "#ffeabf",
|
|
20
|
-
warningDark: "#
|
|
20
|
+
warningDark: "#bf8000",
|
|
21
21
|
danger: "#b71c1c",
|
|
22
|
-
dangerLight: "#
|
|
23
|
-
dangerDark: "#
|
|
22
|
+
dangerLight: "#f5bebe",
|
|
23
|
+
dangerDark: "#881515",
|
|
24
24
|
background: "#fff",
|
|
25
25
|
container: "#fff",
|
|
26
|
-
neutral: "#
|
|
27
|
-
neutralLight: "#
|
|
28
|
-
neutralDark: "#
|
|
29
|
-
onPrimary: "#
|
|
30
|
-
onPrimaryLight: "#
|
|
26
|
+
neutral: "#6d767f",
|
|
27
|
+
neutralLight: "#dadddf",
|
|
28
|
+
neutralDark: "#51585f",
|
|
29
|
+
onPrimary: "#000",
|
|
30
|
+
onPrimaryLight: "#000",
|
|
31
31
|
onPrimaryDark: "#fff",
|
|
32
32
|
onSecondary: "#fff",
|
|
33
|
-
onSecondaryLight: "#
|
|
33
|
+
onSecondaryLight: "#000",
|
|
34
34
|
onSecondaryDark: "#fff",
|
|
35
|
-
onHighlight: "#
|
|
36
|
-
onHighlightLight: "#
|
|
37
|
-
onHighlightDark: "#
|
|
38
|
-
onInfo: "#
|
|
39
|
-
onInfoLight: "#
|
|
35
|
+
onHighlight: "#000",
|
|
36
|
+
onHighlightLight: "#000",
|
|
37
|
+
onHighlightDark: "#000",
|
|
38
|
+
onInfo: "#000",
|
|
39
|
+
onInfoLight: "#000",
|
|
40
40
|
onInfoDark: "#fff",
|
|
41
|
-
onSuccess: "#
|
|
42
|
-
onSuccessLight: "#
|
|
41
|
+
onSuccess: "#000",
|
|
42
|
+
onSuccessLight: "#000",
|
|
43
43
|
onSuccessDark: "#fff",
|
|
44
|
-
onWarning: "#
|
|
45
|
-
onWarningLight: "#
|
|
46
|
-
onWarningDark: "#
|
|
44
|
+
onWarning: "#000",
|
|
45
|
+
onWarningLight: "#000",
|
|
46
|
+
onWarningDark: "#000",
|
|
47
47
|
onDanger: "#fff",
|
|
48
|
-
onDangerLight: "#
|
|
48
|
+
onDangerLight: "#000",
|
|
49
49
|
onDangerDark: "#fff",
|
|
50
|
-
onBackground: "#
|
|
51
|
-
onContainer: "#
|
|
50
|
+
onBackground: "#000",
|
|
51
|
+
onContainer: "#000",
|
|
52
52
|
onNeutral: "#fff",
|
|
53
|
-
onNeutralLight: "#
|
|
53
|
+
onNeutralLight: "#000",
|
|
54
54
|
onNeutralDark: "#fff"
|
|
55
55
|
}, t = {
|
|
56
56
|
primary: "#4da6e0",
|
|
@@ -80,30 +80,30 @@ var e = {
|
|
|
80
80
|
neutralLight: "#2a2d31",
|
|
81
81
|
neutralDark: "#c8ced6",
|
|
82
82
|
onPrimary: "#000",
|
|
83
|
-
onPrimaryLight: "#
|
|
83
|
+
onPrimaryLight: "#fff",
|
|
84
84
|
onPrimaryDark: "#000",
|
|
85
85
|
onSecondary: "#000",
|
|
86
|
-
onSecondaryLight: "#
|
|
86
|
+
onSecondaryLight: "#fff",
|
|
87
87
|
onSecondaryDark: "#000",
|
|
88
88
|
onHighlight: "#000",
|
|
89
|
-
onHighlightLight: "#
|
|
89
|
+
onHighlightLight: "#fff",
|
|
90
90
|
onHighlightDark: "#000",
|
|
91
91
|
onInfo: "#000",
|
|
92
|
-
onInfoLight: "#
|
|
92
|
+
onInfoLight: "#fff",
|
|
93
93
|
onInfoDark: "#000",
|
|
94
94
|
onSuccess: "#000",
|
|
95
|
-
onSuccessLight: "#
|
|
95
|
+
onSuccessLight: "#fff",
|
|
96
96
|
onSuccessDark: "#000",
|
|
97
97
|
onWarning: "#000",
|
|
98
|
-
onWarningLight: "#
|
|
98
|
+
onWarningLight: "#fff",
|
|
99
99
|
onWarningDark: "#000",
|
|
100
100
|
onDanger: "#000",
|
|
101
|
-
onDangerLight: "#
|
|
101
|
+
onDangerLight: "#fff",
|
|
102
102
|
onDangerDark: "#000",
|
|
103
|
-
onBackground: "#
|
|
104
|
-
onContainer: "#
|
|
103
|
+
onBackground: "#fff",
|
|
104
|
+
onContainer: "#fff",
|
|
105
105
|
onNeutral: "#000",
|
|
106
|
-
onNeutralLight: "#
|
|
106
|
+
onNeutralLight: "#fff",
|
|
107
107
|
onNeutralDark: "#000"
|
|
108
108
|
};
|
|
109
109
|
//#endregion
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { RGB } from './types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Useful for ensuring text readability against a background color with the given luminance.
|
|
3
|
+
* Calculates the WCAG 2.x relative luminance for an sRGB color.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param rgb - The color in RGB space.
|
|
6
|
+
* @returns Relative luminance between 0 and 1.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getRelativeLuminance(rgb: RGB): number;
|
|
9
|
+
/**
|
|
10
|
+
* Determines a contrasting color (black or white) based on WCAG relative luminance.
|
|
11
|
+
*
|
|
12
|
+
* @param rgb - The background color in RGB space.
|
|
6
13
|
* @returns A hex string representing either black ('#000') or white ('#fff').
|
|
7
14
|
*/
|
|
8
|
-
export declare function getContrastingColor(
|
|
15
|
+
export declare function getContrastingColor(rgb: RGB): '#000' | '#fff';
|
|
9
16
|
/**
|
|
10
17
|
* Calculates the complementary color for a given color string.
|
|
11
18
|
* The complementary color is the color directly opposite on the color wheel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../../src/utils/color/contrast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../../src/utils/color/contrast.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAiBlC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAMrD;AAgBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAM7D;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ3D"}
|
|
@@ -2,11 +2,24 @@ import { rgbToHex as e } from "./conversion.js";
|
|
|
2
2
|
import { parseColor as t } from "./parse.js";
|
|
3
3
|
//#region src/utils/color/contrast.ts
|
|
4
4
|
function n(e) {
|
|
5
|
-
|
|
5
|
+
let t = e / 255;
|
|
6
|
+
return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
6
7
|
}
|
|
7
|
-
function r(
|
|
8
|
+
function r(e) {
|
|
9
|
+
let t = n(e.r), r = n(e.g), i = n(e.b);
|
|
10
|
+
return .2126 * t + .7152 * r + .0722 * i;
|
|
11
|
+
}
|
|
12
|
+
function i(e, t) {
|
|
13
|
+
let n = Math.max(e, t), r = Math.min(e, t);
|
|
14
|
+
return (n + .05) / (r + .05);
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
let t = r(e), n = i(t, 0);
|
|
18
|
+
return i(t, 1) >= n ? "#fff" : "#000";
|
|
19
|
+
}
|
|
20
|
+
function o(n) {
|
|
8
21
|
let r = t(n);
|
|
9
22
|
return r.r = 255 - r.r, r.g = 255 - r.g, r.b = 255 - r.b, e(r);
|
|
10
23
|
}
|
|
11
24
|
//#endregion
|
|
12
|
-
export {
|
|
25
|
+
export { o as getComplementaryColor, a as getContrastingColor, r as getRelativeLuminance };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { ColorScheme } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Amount passed to {@link lighten} when auto-generating scheme `*Light` variants.
|
|
4
|
+
*/
|
|
5
|
+
export declare const COLOR_SCHEME_LIGHTEN_AMOUNT = 75;
|
|
6
|
+
/**
|
|
7
|
+
* Amount passed to {@link darken} when auto-generating scheme `*Dark` variants
|
|
8
|
+
* (and `useColor` hover fallback when no scheme `*Dark` token applies).
|
|
9
|
+
*/
|
|
10
|
+
export declare const COLOR_SCHEME_DARKEN_AMOUNT = 25;
|
|
2
11
|
/**
|
|
3
12
|
* Merges two color schemes, generating color variants and contrasting text colors as needed.
|
|
4
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/utils/color/merge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/utils/color/merge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ3D;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAiGtF"}
|