@quidgest/ui 0.16.13 → 0.16.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest/components.json +2 -0
- package/dist/ui.css +242 -0
- package/dist/ui.esm.js +4932 -4638
- package/dist/ui.js +18 -18
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +1044 -1022
- package/dist/ui.scss +169 -1
- package/esm/components/QCombobox/QCombobox.d.ts +40 -0
- package/esm/components/QCombobox/QCombobox.d.ts.map +1 -1
- package/esm/components/QCombobox/QCombobox.vue.js +126 -117
- package/esm/components/QCombobox/index.d.ts +20 -0
- package/esm/components/QCombobox/index.d.ts.map +1 -1
- package/esm/components/QDialog/QDialog.d.ts +3 -1
- package/esm/components/QDialog/QDialog.d.ts.map +1 -1
- package/esm/components/QDialog/QDialog.vue.js +151 -108
- package/esm/components/QDialog/QDialogProvider.d.ts +6 -1
- package/esm/components/QDialog/QDialogProvider.d.ts.map +1 -1
- package/esm/components/QDialog/QDialogProvider.vue.js +22 -14
- package/esm/components/QDialog/index.d.ts +11 -2
- package/esm/components/QDialog/index.d.ts.map +1 -1
- package/esm/components/QDialog/types.d.ts +31 -1
- package/esm/components/QDialog/types.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebarPanel.d.ts +2 -2
- package/esm/components/QSidebar/QSidebarPanel.vue.js +24 -25
- package/esm/components/QToast/QToast.d.ts +33 -0
- package/esm/components/QToast/QToast.d.ts.map +1 -0
- package/esm/components/QToast/QToast.vue.js +212 -0
- package/esm/components/QToast/QToast.vue2.js +4 -0
- package/esm/components/QToast/QToaster.d.ts +6 -0
- package/esm/components/QToast/QToaster.d.ts.map +1 -0
- package/esm/components/QToast/QToaster.vue.js +48 -0
- package/esm/components/QToast/QToaster.vue2.js +4 -0
- package/esm/components/QToast/index.d.ts +56 -0
- package/esm/components/QToast/index.d.ts.map +1 -0
- package/esm/components/QToast/index.js +8 -0
- package/esm/components/QToast/types.d.ts +69 -0
- package/esm/components/QToast/types.d.ts.map +1 -0
- package/esm/components/QToast/types.js +8 -0
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.d.ts.map +1 -1
- package/esm/components/index.js +15 -12
- package/esm/composables/index.d.ts +1 -0
- package/esm/composables/index.d.ts.map +1 -1
- package/esm/composables/useDialog/index.d.ts +15 -3
- package/esm/composables/useDialog/index.d.ts.map +1 -1
- package/esm/composables/useDialog/index.js +14 -14
- package/esm/composables/useDialog/types.d.ts +7 -4
- package/esm/composables/useDialog/types.d.ts.map +1 -1
- package/esm/composables/useToast/index.d.ts +33 -0
- package/esm/composables/useToast/index.d.ts.map +1 -0
- package/esm/composables/useToast/index.js +35 -0
- package/esm/composables/useToast/types.d.ts +40 -0
- package/esm/composables/useToast/types.d.ts.map +1 -0
- package/esm/composables/useToast/types.js +4 -0
- package/esm/framework.d.ts.map +1 -1
- package/esm/framework.js +25 -19
- package/esm/index.d.ts +2 -0
- package/esm/index.js +7 -5
- package/esm/utils/color.js +29 -24
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QDialogProps } from '../../components/QDialog/types.ts';
|
|
1
|
+
import { QDialogProps, QDialogOptions } from '../../components/QDialog/types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Represents an instance of a dialog component.
|
|
4
4
|
*/
|
|
5
|
-
type DialogInstance = {
|
|
5
|
+
export type DialogInstance = {
|
|
6
6
|
/**
|
|
7
7
|
* A unique identifier for the dialog instance.
|
|
8
8
|
*/
|
|
@@ -11,15 +11,18 @@ type DialogInstance = {
|
|
|
11
11
|
* The properties applied to the dialog, conforming to `QDialogProps`.
|
|
12
12
|
*/
|
|
13
13
|
props: QDialogProps;
|
|
14
|
+
/**
|
|
15
|
+
* The options applied to the dialog, conforming to `QDialogOptions`.
|
|
16
|
+
*/
|
|
17
|
+
options?: QDialogOptions;
|
|
14
18
|
};
|
|
15
19
|
/**
|
|
16
20
|
* Represents the state for dialog management.
|
|
17
21
|
*/
|
|
18
|
-
export type
|
|
22
|
+
export type DialogState = {
|
|
19
23
|
/**
|
|
20
24
|
* An array containing the currently active dialog instances.
|
|
21
25
|
*/
|
|
22
26
|
dialogs: DialogInstance[];
|
|
23
27
|
};
|
|
24
|
-
export {};
|
|
25
28
|
//# 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,YAAY,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useDialog/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF;;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;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE,cAAc,EAAE,CAAA;CACzB,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ToastInstance, UseToastReturn } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A composable function that manages existing QToast instances.
|
|
4
|
+
*
|
|
5
|
+
* @returns An object containing:
|
|
6
|
+
* - toasts: The array of currently active QToast instances.
|
|
7
|
+
* - addToast: A function that adds a QToast instance to the DOM, according to the given QToastProps.
|
|
8
|
+
* - removeToast: A function to remove a QToast instance from the DOM.
|
|
9
|
+
*/
|
|
10
|
+
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
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,aAAa,EAAkB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAMjG;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAoCzC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAInD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,aAAa,CAI5C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAMnD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ToastSymbol as a } from "./types.js";
|
|
2
|
+
import { inject as i, ref as u } from "vue";
|
|
3
|
+
import { useId as c } from "../uid.js";
|
|
4
|
+
function p() {
|
|
5
|
+
const { toasts: t } = f();
|
|
6
|
+
function s(n, o) {
|
|
7
|
+
const e = c(o);
|
|
8
|
+
return t.value.push({ id: e, props: n }), e;
|
|
9
|
+
}
|
|
10
|
+
function r(n) {
|
|
11
|
+
const o = t.value.findIndex((e) => e.id === n);
|
|
12
|
+
o !== -1 && t.value.splice(o, 1);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
toasts: t,
|
|
16
|
+
addToast: s,
|
|
17
|
+
removeToast: r
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function I() {
|
|
21
|
+
return {
|
|
22
|
+
toasts: u([])
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function f() {
|
|
26
|
+
const t = i(a);
|
|
27
|
+
if (!t)
|
|
28
|
+
throw new Error("useInjectedToast must be used after provideToast");
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
I as createToastInstance,
|
|
33
|
+
f as injectToastInstance,
|
|
34
|
+
p as useToast
|
|
35
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { QToastProps } from '../../components/QToast';
|
|
3
|
+
export declare const ToastSymbol: InjectionKey<ToastInstance>;
|
|
4
|
+
/**
|
|
5
|
+
* Represents an instance of the toast notification system.
|
|
6
|
+
*/
|
|
7
|
+
export type ToastInstance = {
|
|
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.
|
|
15
|
+
*/
|
|
16
|
+
export type ToastItem = {
|
|
17
|
+
/**
|
|
18
|
+
* A unique identifier for the toast item.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The properties applied to the toast item, conforming to `QToastProps`.
|
|
23
|
+
*/
|
|
24
|
+
props: QToastProps;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Represents the return type of the `useToast` composable, providing methods and state
|
|
28
|
+
* for managing toast notifications.
|
|
29
|
+
*/
|
|
30
|
+
export type UseToastReturn = ToastInstance & {
|
|
31
|
+
/**
|
|
32
|
+
* A function to add a toast item to the DOM.
|
|
33
|
+
*/
|
|
34
|
+
addToast(props: QToastProps, id?: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* A function to remove a toast item from the DOM.
|
|
37
|
+
*/
|
|
38
|
+
removeToast(id: string): void;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/composables/useToast/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAAyB,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,KAAK,EAAE,WAAW,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC5C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEjD;;OAEG;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":"
|
|
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,CAwBpE"}
|
package/esm/framework.js
CHANGED
|
@@ -1,48 +1,54 @@
|
|
|
1
1
|
import { DEFAULTS_SYMBOL as i } from "./composables/defaults.js";
|
|
2
2
|
import { ThemeSymbol as c } from "./composables/theme.js";
|
|
3
|
-
import { DismissibleLayerKey as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
3
|
+
import { DismissibleLayerKey as f } from "./symbols/dismissibleLayer.js";
|
|
4
|
+
import { ToastSymbol as h } from "./composables/useToast/types.js";
|
|
5
|
+
import { useDismissibleLayerStack as d } from "./composables/useDismissibleLayerStack/index.js";
|
|
6
|
+
import { createToastInstance as u } from "./composables/useToast/index.js";
|
|
7
|
+
import { defaultLightColorScheme as r, defaultDarkColorScheme as p } from "./templates/theme.js";
|
|
8
|
+
import { ref as l, watch as S } from "vue";
|
|
9
|
+
import { createThemeInstance as L, generateRootStyle as T } from "./utils/theme.js";
|
|
10
|
+
function N(m = {}) {
|
|
9
11
|
return { install: (t) => {
|
|
10
12
|
const s = m.components || {};
|
|
11
|
-
for (const
|
|
12
|
-
t.component(
|
|
13
|
+
for (const a in s)
|
|
14
|
+
t.component(a, s[a]);
|
|
13
15
|
const e = m.defaults || {};
|
|
14
|
-
t.provide(i,
|
|
15
|
-
const
|
|
16
|
-
t.provide(
|
|
16
|
+
t.provide(i, l(e)), y(t, m.themes);
|
|
17
|
+
const n = d();
|
|
18
|
+
t.provide(f, n), b(t);
|
|
17
19
|
} };
|
|
18
20
|
}
|
|
19
|
-
function
|
|
21
|
+
function y(m, o) {
|
|
20
22
|
const t = [];
|
|
21
23
|
let s;
|
|
22
24
|
if (!o)
|
|
23
25
|
s = "default", t.push({
|
|
24
26
|
name: s,
|
|
25
27
|
mode: "light",
|
|
26
|
-
scheme:
|
|
28
|
+
scheme: r
|
|
27
29
|
});
|
|
28
30
|
else
|
|
29
31
|
for (const e of o.themes) {
|
|
30
|
-
const
|
|
32
|
+
const a = { ...e.mode === "light" ? r : p, ...e.colors };
|
|
31
33
|
t.push({
|
|
32
34
|
name: e.name,
|
|
33
35
|
mode: e.mode,
|
|
34
|
-
scheme:
|
|
36
|
+
scheme: a
|
|
35
37
|
}), e.name === o.defaultTheme && (s = e.name);
|
|
36
38
|
}
|
|
37
39
|
if (s) {
|
|
38
|
-
const e =
|
|
39
|
-
|
|
40
|
+
const e = l(s), n = L(e, t);
|
|
41
|
+
T(t), S(n.name, C, { immediate: !0 }), m.provide(c, n);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
function
|
|
44
|
+
function b(m) {
|
|
45
|
+
const o = u();
|
|
46
|
+
m.provide(h, o);
|
|
47
|
+
}
|
|
48
|
+
function C(m) {
|
|
43
49
|
const o = document.documentElement, s = Array.from(o.classList).filter((e) => !e.startsWith("q-theme"));
|
|
44
50
|
o.className = s.join(" "), o.classList.add(`q-theme--${m}`);
|
|
45
51
|
}
|
|
46
52
|
export {
|
|
47
|
-
|
|
53
|
+
N as createFramework
|
|
48
54
|
};
|
package/esm/index.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ declare module '@vue/runtime-core' {
|
|
|
59
59
|
QTextArea: typeof import('@quidgest/ui/components')['QTextArea']
|
|
60
60
|
QTextField: typeof import('@quidgest/ui/components')['QTextField']
|
|
61
61
|
QThemeProvider: typeof import('@quidgest/ui/components')['QThemeProvider']
|
|
62
|
+
QToast: typeof import('@quidgest/ui/components')['QToast']
|
|
63
|
+
QToaster: typeof import('@quidgest/ui/components')['QToaster']
|
|
62
64
|
QToggle: typeof import('@quidgest/ui/components')['QToggle']
|
|
63
65
|
QToggleGroup: typeof import('@quidgest/ui/components')['QToggleGroup']
|
|
64
66
|
QToggleGroupItem: typeof import('@quidgest/ui/components')['QToggleGroupItem']
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as t from "./templates/index.js";
|
|
2
2
|
import * as r from "./components/index.js";
|
|
3
3
|
import { createFramework as o } from "./framework.js";
|
|
4
4
|
import { provideTheme as n, useTheme as i } from "./composables/theme.js";
|
|
5
|
-
import { useDialog as
|
|
5
|
+
import { useDialog as c } from "./composables/useDialog/index.js";
|
|
6
|
+
import { useToast as u } from "./composables/useToast/index.js";
|
|
6
7
|
const a = (e = {}) => o({ components: r, ...e });
|
|
7
8
|
export {
|
|
8
9
|
r as components,
|
|
9
10
|
a as createFramework,
|
|
10
11
|
n as provideTheme,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
i as useTheme
|
|
12
|
+
t as templates,
|
|
13
|
+
c as useDialog,
|
|
14
|
+
i as useTheme,
|
|
15
|
+
u as useToast
|
|
14
16
|
};
|
package/esm/utils/color.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function d(t, r = !1) {
|
|
2
2
|
return r ? /^#[a-fA-F0-9]{6}$/.test(t) : /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(t);
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function g(t) {
|
|
5
5
|
const r = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
6
6
|
if (r) {
|
|
7
7
|
const n = parseInt(r[1], 10), s = parseInt(r[2], 10), e = parseInt(r[3], 10);
|
|
@@ -9,36 +9,40 @@ function d(t) {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function b(t) {
|
|
12
|
-
if (
|
|
12
|
+
if (d(t)) {
|
|
13
13
|
t.length === 4 && (t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
|
|
14
14
|
const r = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), s = parseInt(t.slice(5, 7), 16);
|
|
15
15
|
return { r, g: n, b: s };
|
|
16
16
|
} else {
|
|
17
|
-
const r =
|
|
17
|
+
const r = g(t);
|
|
18
18
|
if (r) return r;
|
|
19
19
|
}
|
|
20
20
|
throw new Error("Invalid color format");
|
|
21
21
|
}
|
|
22
22
|
function $(t, r) {
|
|
23
|
-
const n =
|
|
23
|
+
const n = h(t), s = r / 100;
|
|
24
|
+
return n.l = n.l + s * (100 - n.l), l(n);
|
|
25
|
+
}
|
|
26
|
+
function p(t, r) {
|
|
27
|
+
const n = h(t), s = r / 100;
|
|
24
28
|
return n.l = n.l - s * n.l, l(n);
|
|
25
29
|
}
|
|
26
|
-
function
|
|
30
|
+
function M(t) {
|
|
27
31
|
const r = t.r.toString(16).padStart(2, "0"), n = t.g.toString(16).padStart(2, "0"), s = t.b.toString(16).padStart(2, "0");
|
|
28
32
|
return `#${r}${n}${s}`;
|
|
29
33
|
}
|
|
30
|
-
function
|
|
34
|
+
function m(t) {
|
|
31
35
|
return `${t.r} ${t.g} ${t.b}`;
|
|
32
36
|
}
|
|
33
|
-
function
|
|
37
|
+
function h(t) {
|
|
34
38
|
const r = t.r / 255, n = t.g / 255, s = t.b / 255, e = Math.max(r, n, s), o = Math.min(r, n, s);
|
|
35
|
-
let a = 0,
|
|
36
|
-
const
|
|
39
|
+
let a = 0, c;
|
|
40
|
+
const i = (e + o) / 2;
|
|
37
41
|
if (e === o)
|
|
38
|
-
a =
|
|
42
|
+
a = c = 0;
|
|
39
43
|
else {
|
|
40
44
|
const u = e - o;
|
|
41
|
-
switch (
|
|
45
|
+
switch (c = i > 0.5 ? u / (2 - e - o) : u / (e + o), e) {
|
|
42
46
|
case r:
|
|
43
47
|
a = (n - s) / u + (n < s ? 6 : 0);
|
|
44
48
|
break;
|
|
@@ -53,8 +57,8 @@ function g(t) {
|
|
|
53
57
|
}
|
|
54
58
|
return {
|
|
55
59
|
h: Math.round(a * 360),
|
|
56
|
-
s: Math.round(
|
|
57
|
-
l: Math.round(
|
|
60
|
+
s: Math.round(c * 100),
|
|
61
|
+
l: Math.round(i * 100)
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
64
|
function l(t) {
|
|
@@ -63,8 +67,8 @@ function l(t) {
|
|
|
63
67
|
if (n === 0)
|
|
64
68
|
e = o = a = s;
|
|
65
69
|
else {
|
|
66
|
-
const
|
|
67
|
-
e = f(
|
|
70
|
+
const c = s < 0.5 ? s * (1 + n) : s + n - s * n, i = 2 * s - c;
|
|
71
|
+
e = f(i, c, r + 1 / 3), o = f(i, c, r), a = f(i, c, r - 1 / 3);
|
|
68
72
|
}
|
|
69
73
|
return {
|
|
70
74
|
r: Math.round(e * 255),
|
|
@@ -75,18 +79,19 @@ function l(t) {
|
|
|
75
79
|
function f(t, r, n) {
|
|
76
80
|
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (r - t) * 6 * n : n < 1 / 2 ? r : n < 2 / 3 ? t + (r - t) * (2 / 3 - n) * 6 : t;
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function I(t) {
|
|
79
83
|
return t > 50 ? "#000" : "#fff";
|
|
80
84
|
}
|
|
81
85
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
M as colorToHex,
|
|
87
|
+
p as darken,
|
|
88
|
+
I as getContrastingColor,
|
|
85
89
|
l as hslToRgb,
|
|
86
90
|
f as hueToRgb,
|
|
87
|
-
|
|
91
|
+
d as isValidHex,
|
|
92
|
+
$ as lighten,
|
|
88
93
|
b as parseColor,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
h as rgbToHsl,
|
|
95
|
+
m as rgbToVariableString,
|
|
96
|
+
g as tryParseRgb
|
|
92
97
|
};
|