@quidgest/ui 0.16.33 → 0.16.35

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 (40) hide show
  1. package/dist/json/api.json +1 -1
  2. package/dist/ui.esm.js +3049 -2945
  3. package/dist/ui.js +19 -19
  4. package/dist/ui.min.js +1074 -1061
  5. package/dist/ui.scss +1 -1
  6. package/esm/components/QColorPicker/QColorPicker.vue.js +1 -1
  7. package/esm/components/QToast/QToast.vue.js +44 -42
  8. package/esm/composables/useColor/index.js +23 -20
  9. package/esm/index.d.ts +2 -1
  10. package/esm/index.d.ts.map +1 -1
  11. package/esm/index.js +8 -6
  12. package/esm/templates/theme.d.ts.map +1 -1
  13. package/esm/templates/theme.js +44 -10
  14. package/esm/utils/color/contrast.d.ts +18 -0
  15. package/esm/utils/color/contrast.d.ts.map +1 -0
  16. package/esm/utils/color/contrast.js +13 -0
  17. package/esm/utils/color/conversion.d.ts +41 -0
  18. package/esm/utils/color/conversion.d.ts.map +1 -0
  19. package/esm/utils/color/conversion.js +59 -0
  20. package/esm/utils/color/index.d.ts +7 -0
  21. package/esm/utils/color/index.d.ts.map +1 -0
  22. package/esm/utils/color/manipulate.d.ts +18 -0
  23. package/esm/utils/color/manipulate.d.ts.map +1 -0
  24. package/esm/utils/color/manipulate.js +21 -0
  25. package/esm/utils/color/merge.d.ts +19 -0
  26. package/esm/utils/color/merge.d.ts.map +1 -0
  27. package/esm/utils/color/merge.js +49 -0
  28. package/esm/utils/color/parse.d.ts +24 -0
  29. package/esm/utils/color/parse.d.ts.map +1 -0
  30. package/esm/utils/color/parse.js +26 -0
  31. package/esm/utils/color/types.d.ts +51 -0
  32. package/esm/utils/color/types.d.ts.map +1 -0
  33. package/esm/utils/index.d.ts +2 -0
  34. package/esm/utils/index.d.ts.map +1 -0
  35. package/esm/utils/index.js +20 -0
  36. package/esm/utils/theme.js +1 -1
  37. package/package.json +3 -1
  38. package/esm/utils/color.d.ts +0 -123
  39. package/esm/utils/color.d.ts.map +0 -1
  40. package/esm/utils/color.js +0 -97
@@ -0,0 +1,49 @@
1
+ import { getComplementaryColor as y, getContrastingColor as C } from "./contrast.js";
2
+ import { rgbToHex as p, rgbToHsl as d } from "./conversion.js";
3
+ import { lighten as K, darken as $ } from "./manipulate.js";
4
+ import { parseColor as f } from "./parse.js";
5
+ function U(m, o) {
6
+ const n = { ...m }, l = (t, r) => {
7
+ const i = f(t), a = p(K(i, 85)), c = p($(i, 25)), e = r.toString().replace(/(Light|Dark)$/, "");
8
+ return {
9
+ [e]: t,
10
+ [`${e}Light`]: a,
11
+ [`${e}Dark`]: c
12
+ };
13
+ }, s = (t) => {
14
+ const r = f(t), i = d(r);
15
+ return C(i.l);
16
+ }, k = [
17
+ "primary",
18
+ "secondary",
19
+ "highlight",
20
+ "info",
21
+ "success",
22
+ "warning",
23
+ "danger",
24
+ "neutral"
25
+ ];
26
+ for (const t of k) {
27
+ const r = t, i = `${t}Light`, a = `${t}Dark`, c = `on${t.charAt(0).toUpperCase() + t.slice(1)}`, e = `on${t.charAt(0).toUpperCase() + t.slice(1)}Light`, g = `on${t.charAt(0).toUpperCase() + t.slice(1)}Dark`;
28
+ if (o[r]) {
29
+ const h = l(o[r], r);
30
+ Object.assign(n, h), n[c] = s(o[r]), n[e] = s(h[i]), n[g] = s(h[a]);
31
+ }
32
+ o[r] || (o[i] && (n[i] = o[i], o[e] || (n[e] = s(o[i]))), o[a] && (n[a] = o[a], o[g] || (n[g] = s(o[a])))), o[c] && (n[c] = o[c]), o[e] && (n[e] = o[e]), o[g] && (n[g] = o[g]);
33
+ }
34
+ if (o.primary && !o.highlight) {
35
+ const t = y(o.primary), r = l(t, "highlight");
36
+ Object.assign(n, r), n.onHighlight = s(t), n.onHighlightLight = s(r.highlightLight), n.onHighlightDark = s(r.highlightDark);
37
+ }
38
+ const u = ["background", "container"];
39
+ for (const t of u)
40
+ if (o[t]) {
41
+ n[t] = o[t];
42
+ const r = `on${t.charAt(0).toUpperCase() + t.slice(1)}`;
43
+ o[r] || (n[r] = s(o[t]));
44
+ }
45
+ return o.onBackground && (n.onBackground = o.onBackground), o.onContainer && (n.onContainer = o.onContainer), n;
46
+ }
47
+ export {
48
+ U as mergeColorSchemes
49
+ };
@@ -0,0 +1,24 @@
1
+ import { RGB } from './types';
2
+ /**
3
+ * Checks if the given string represents a valid hexadecimal color code.
4
+ *
5
+ * @param hexColorCode - The color code to validate.
6
+ * @param enforceSixChars - Whether to enforce only the 6-character format (default is false).
7
+ * @returns True if the color code is valid, false otherwise.
8
+ */
9
+ export declare function isValidHex(hexColorCode: string, enforceSixChars?: boolean): boolean;
10
+ /**
11
+ * Tries to parse a string in the format 'rgb(r, g, b)' to an RGB object.
12
+ *
13
+ * @param tr The input string to parse, expected in the format 'rgb(r, g, b)'.
14
+ * @returns An object containing parsed RGB values if the input string is valid, otherwise undefined.
15
+ */
16
+ export declare function tryParseRgb(str: string): RGB | undefined;
17
+ /**
18
+ * Parses a color from a hex string.
19
+ *
20
+ * @param color A hex string representing the color, e.g., "#aabbcc".
21
+ * @returns A `RGB` object representing the parsed color.
22
+ */
23
+ export declare function parseColor(color: string): RGB;
24
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/utils/color/parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,GAAE,OAAe,GAAG,OAAO,CAQ1F;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CASxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAkB7C"}
@@ -0,0 +1,26 @@
1
+ function a(t, n = !1) {
2
+ return n ? /^#[a-fA-F0-9]{6}$/.test(t) : /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(t);
3
+ }
4
+ function i(t) {
5
+ const n = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
6
+ if (n) {
7
+ const e = parseInt(n[1], 10), s = parseInt(n[2], 10), r = parseInt(n[3], 10);
8
+ return { r: e, g: s, b: r };
9
+ }
10
+ }
11
+ function f(t) {
12
+ if (a(t)) {
13
+ t.length === 4 && (t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
14
+ const n = parseInt(t.slice(1, 3), 16), e = parseInt(t.slice(3, 5), 16), s = parseInt(t.slice(5, 7), 16);
15
+ return { r: n, g: e, b: s };
16
+ } else {
17
+ const n = i(t);
18
+ if (n) return n;
19
+ }
20
+ throw new Error("Invalid color format");
21
+ }
22
+ export {
23
+ a as isValidHex,
24
+ f as parseColor,
25
+ i as tryParseRgb
26
+ };
@@ -0,0 +1,51 @@
1
+ export type BaseColorScheme = {
2
+ primary: string;
3
+ primaryLight: string;
4
+ primaryDark: string;
5
+ secondary: string;
6
+ secondaryLight: string;
7
+ secondaryDark: string;
8
+ highlight: string;
9
+ highlightLight: string;
10
+ highlightDark: string;
11
+ info: string;
12
+ infoLight: string;
13
+ infoDark: string;
14
+ success: string;
15
+ successLight: string;
16
+ successDark: string;
17
+ warning: string;
18
+ warningLight: string;
19
+ warningDark: string;
20
+ danger: string;
21
+ dangerLight: string;
22
+ dangerDark: string;
23
+ background: string;
24
+ container: string;
25
+ neutral: string;
26
+ neutralLight: string;
27
+ neutralDark: string;
28
+ };
29
+ type Capitalize<S extends string> = S extends `${infer F}${infer R}` ? `${Uppercase<F>}${R}` : S;
30
+ type OnVariants<T> = {
31
+ [K in keyof T as `on${Capitalize<string & K>}`]: string;
32
+ };
33
+ export type ColorScheme = BaseColorScheme & OnVariants<BaseColorScheme>;
34
+ /**
35
+ * Represents a color in RGB space.
36
+ */
37
+ export type RGB = {
38
+ r: number;
39
+ g: number;
40
+ b: number;
41
+ };
42
+ /**
43
+ * Represents a color in HSL space.
44
+ */
45
+ export type HSL = {
46
+ h: number;
47
+ s: number;
48
+ l: number;
49
+ };
50
+ export {};
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/color/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG;IAE7B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IAEnB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IAErB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IAGrB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAEhB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IAEnB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IAEnB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAGlB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IAGjB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACnB,CAAA;AAGD,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;AAGhG,KAAK,UAAU,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM;CACvD,CAAA;AAGD,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACT,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACT,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './color';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { getComplementaryColor as e, getContrastingColor as t } from "./color/contrast.js";
2
+ import { hslToRgb as l, hueToRgb as m, rgbToHex as a, rgbToHsl as b, rgbToVariableString as p } from "./color/conversion.js";
3
+ import { darken as x, lighten as i } from "./color/manipulate.js";
4
+ import { mergeColorSchemes as C } from "./color/merge.js";
5
+ import { isValidHex as T, parseColor as h, tryParseRgb as H } from "./color/parse.js";
6
+ export {
7
+ x as darken,
8
+ e as getComplementaryColor,
9
+ t as getContrastingColor,
10
+ l as hslToRgb,
11
+ m as hueToRgb,
12
+ T as isValidHex,
13
+ i as lighten,
14
+ C as mergeColorSchemes,
15
+ h as parseColor,
16
+ a as rgbToHex,
17
+ b as rgbToHsl,
18
+ p as rgbToVariableString,
19
+ H as tryParseRgb
20
+ };
@@ -1,6 +1,6 @@
1
1
  import { computed as c } from "vue";
2
- import { parseColor as d } from "./color.js";
3
2
  import { toKebabCase as a } from "./string.js";
3
+ import { parseColor as d } from "./color/parse.js";
4
4
  const m = "q-theme";
5
5
  function h() {
6
6
  let e = document.getElementById(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quidgest/ui",
3
3
  "description": "Quidgest's UI framework",
4
- "version": "0.16.33",
4
+ "version": "0.16.35",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "author": "Quidgest",
@@ -39,6 +39,8 @@
39
39
  "./templates/*": "./esm/templates/*.js",
40
40
  "./components": "./esm/components/index.js",
41
41
  "./components/*": "./esm/components/*/index.js",
42
+ "./utils": "./esm/utils/index.js",
43
+ "./utils/*": "./esm/utils/*/index.js",
42
44
  "./*": "./*"
43
45
  },
44
46
  "devDependencies": {
@@ -1,123 +0,0 @@
1
- export type ColorScheme = {
2
- primary: string;
3
- primaryLight: string;
4
- primaryDark: string;
5
- onPrimary: string;
6
- secondary: string;
7
- secondaryLight: string;
8
- secondaryDark: string;
9
- onSecondary: string;
10
- highlight: string;
11
- highlightLight: string;
12
- highlightDark: string;
13
- onHighlight: string;
14
- info: string;
15
- infoLight: string;
16
- infoDark: string;
17
- onInfo: string;
18
- success: string;
19
- successLight: string;
20
- successDark: string;
21
- onSuccess: string;
22
- warning: string;
23
- warningLight: string;
24
- warningDark: string;
25
- onWarning: string;
26
- danger: string;
27
- dangerLight: string;
28
- dangerDark: string;
29
- onDanger: string;
30
- background: string;
31
- onBackground: string;
32
- container: string;
33
- neutral: string;
34
- neutralLight: string;
35
- neutralDark: string;
36
- onNeutral: string;
37
- };
38
- /**
39
- * Represents a color in RGB space.
40
- */
41
- export type RGB = {
42
- r: number;
43
- g: number;
44
- b: number;
45
- };
46
- /**
47
- * Represents a color in HSL space.
48
- */
49
- export type HSL = {
50
- h: number;
51
- s: number;
52
- l: number;
53
- };
54
- /**
55
- * Checks if the given string represents a valid hexadecimal color code.
56
- * @param hexColorCode - The color code to validate.
57
- * @param enforceSixChars - Whether to enforce only the 6-character format (default is false).
58
- * @returns True if the color code is valid, false otherwise.
59
- */
60
- export declare function isValidHex(hexColorCode: string, enforceSixChars?: boolean): boolean;
61
- /**
62
- * Tries to parse a string in the format 'rgb(r, g, b)' to an RGB object.
63
- * @param tr The input string to parse, expected in the format 'rgb(r, g, b)'.
64
- * @returns An object containing parsed RGB values if the input string is valid, otherwise undefined.
65
- */
66
- export declare function tryParseRgb(str: string): RGB | undefined;
67
- /**
68
- * Parses a color from a hex string.
69
- * @param color A hex string representing the color, e.g., "#aabbcc".
70
- * @returns A `RGB` object representing the parsed color.
71
- */
72
- export declare function parseColor(color: string): RGB;
73
- /**
74
- * Lightens a color by a specified amount.
75
- * @param rgb The color to lighten.
76
- * @param amount The amount to lighten the color by, in the range [0, 100].
77
- * @returns The lightened color.
78
- */
79
- export declare function lighten(rgb: RGB, amount: number): RGB;
80
- /**
81
- * Darkens a color by a specified amount.
82
- * @param rgb The color to darken.
83
- * @param amount The amount to darken the color by, in the range [0, 100].
84
- * @returns The darkened color.
85
- */
86
- export declare function darken(rgb: RGB, amount: number): RGB;
87
- /**
88
- * Converts a `Color` object to a hex string.
89
- * @param rgb The color to convert.
90
- * @returns A hex string representing the color.
91
- */
92
- export declare function colorToHex(rgb: RGB): string;
93
- /**
94
- * Converts an RGB object to a string in the format 'r g b'.
95
- * @param rgb The RGB object to convert.
96
- * @returns A string representing the color in 'r g b' format.
97
- */
98
- export declare function rgbToVariableString(rgb: RGB): string;
99
- /**
100
- * Converts a color from RGB to HSL space.
101
- * @param color The color to convert.
102
- * @returns An object representing the color in HSL space.
103
- */
104
- export declare function rgbToHsl(rgb: RGB): HSL;
105
- /**
106
- * Converts a color from HSL to RGB space.
107
- * @param h The hue component of the color, in the range [0, 1].
108
- * @param s The saturation component of the color, in the range [0, 1].
109
- * @param l The lightness component of the color, in the range [0, 1].
110
- * @returns A `RGB` object representing the color in RGB space.
111
- */
112
- export declare function hslToRgb(hsl: HSL): RGB;
113
- /**
114
- * Helper function to convert a hue value to a corresponding RGB value.
115
- * @param p The first RGB component.
116
- * @param q The second RGB component.
117
- * @param t The hue value.
118
- * @returns The corresponding RGB value.
119
- */
120
- export declare function hueToRgb(p: number, q: number, t: number): number;
121
- export declare function getContrastingColor(luminance: number): "#000" | "#fff";
122
- export declare function getComplementaryColor(color: string): string;
123
- //# sourceMappingURL=color.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"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"}
@@ -1,97 +0,0 @@
1
- function d(t, r = !1) {
2
- return r ? /^#[a-fA-F0-9]{6}$/.test(t) : /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(t);
3
- }
4
- function g(t) {
5
- const r = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
6
- if (r) {
7
- const n = parseInt(r[1], 10), s = parseInt(r[2], 10), e = parseInt(r[3], 10);
8
- return { r: n, g: s, b: e };
9
- }
10
- }
11
- function b(t) {
12
- if (d(t)) {
13
- t.length === 4 && (t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
14
- const r = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), s = parseInt(t.slice(5, 7), 16);
15
- return { r, g: n, b: s };
16
- } else {
17
- const r = g(t);
18
- if (r) return r;
19
- }
20
- throw new Error("Invalid color format");
21
- }
22
- function $(t, r) {
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;
28
- return n.l = n.l - s * n.l, l(n);
29
- }
30
- function M(t) {
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");
32
- return `#${r}${n}${s}`;
33
- }
34
- function m(t) {
35
- return `${t.r} ${t.g} ${t.b}`;
36
- }
37
- function h(t) {
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);
39
- let a = 0, c;
40
- const i = (e + o) / 2;
41
- if (e === o)
42
- a = c = 0;
43
- else {
44
- const u = e - o;
45
- switch (c = i > 0.5 ? u / (2 - e - o) : u / (e + o), e) {
46
- case r:
47
- a = (n - s) / u + (n < s ? 6 : 0);
48
- break;
49
- case n:
50
- a = (s - r) / u + 2;
51
- break;
52
- case s:
53
- a = (r - n) / u + 4;
54
- break;
55
- }
56
- a /= 6;
57
- }
58
- return {
59
- h: Math.round(a * 360),
60
- s: Math.round(c * 100),
61
- l: Math.round(i * 100)
62
- };
63
- }
64
- function l(t) {
65
- const r = t.h / 360, n = t.s / 100, s = t.l / 100;
66
- let e, o, a;
67
- if (n === 0)
68
- e = o = a = s;
69
- else {
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);
72
- }
73
- return {
74
- r: Math.round(e * 255),
75
- g: Math.round(o * 255),
76
- b: Math.round(a * 255)
77
- };
78
- }
79
- function f(t, r, n) {
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;
81
- }
82
- function I(t) {
83
- return t > 50 ? "#000" : "#fff";
84
- }
85
- export {
86
- M as colorToHex,
87
- p as darken,
88
- I as getContrastingColor,
89
- l as hslToRgb,
90
- f as hueToRgb,
91
- d as isValidHex,
92
- $ as lighten,
93
- b as parseColor,
94
- h as rgbToHsl,
95
- m as rgbToVariableString,
96
- g as tryParseRgb
97
- };