@quidgest/ui 0.16.31 → 0.16.32
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/json/api.json +1 -1
- package/dist/ui.esm.js +812 -812
- package/dist/ui.js +9 -9
- package/dist/ui.min.js +9 -13
- package/dist/ui.scss +1 -1
- package/esm/composables/theme.d.ts +14 -15
- package/esm/composables/theme.d.ts.map +1 -1
- package/esm/composables/theme.js +13 -13
- package/esm/framework.js +14 -14
- package/esm/templates/theme.js +35 -35
- package/esm/utils/theme.d.ts +14 -14
- package/esm/utils/theme.d.ts.map +1 -1
- package/esm/utils/theme.js +33 -33
- package/package.json +1 -1
package/dist/ui.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
!function(e,t){"object"==typeof exports&&typeof module<"u"?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=typeof globalThis<"u"?globalThis:e||self)["Quidgest UI"]={},e.Vue)}(this,(function(e,t){"use strict"
|
|
2
2
|
var a=Object.defineProperty,n=(e,t,n)=>((e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n)
|
|
3
3
|
/*!
|
|
4
|
-
* Quidgest UI v0.16.
|
|
4
|
+
* Quidgest UI v0.16.32
|
|
5
5
|
* (c) 2025 Quidgest - Consultores de Gestão, S.A.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
const o={primary:"#008ad2",primaryLight:"#cde5ff",primaryDark:"#006398",secondary:"#001d31",secondaryLight:"#e6eef3",secondaryDark:"#001425",highlight:"#ff8241",highlightLight:"#ffe4d6",highlightDark:"#cc4700",info:"#17a2b8",infoLight:"#bceff7",infoDark:"#11798a",success:"#28a745",successLight:"#c2f0cd",successDark:"#1e7d34",warning:"#ffa900",warningLight:"#ffeabf",warningDark:"#bf7f00",danger:"#b71c1c",dangerLight:"#f7cccc",dangerDark:"#891515",background:"#fff",container:"#fff",neutral:"#7c858d",neutralLight:"#c4c5ca",neutralDark:"#40474f",onBackground:"#202428",onPrimary:"#fff",onSecondary:"#fff",onHighlight:"#fff",onSuccess:"#fff",onWarning:"#fff",onDanger:"#fff",onInfo:"#fff",onNeutral:"#fff"},l={primary:"#4da6e0",primaryLight:"#
|
|
8
|
+
const o={primary:"#008ad2",primaryLight:"#cde5ff",primaryDark:"#006398",secondary:"#001d31",secondaryLight:"#e6eef3",secondaryDark:"#001425",highlight:"#ff8241",highlightLight:"#ffe4d6",highlightDark:"#cc4700",info:"#17a2b8",infoLight:"#bceff7",infoDark:"#11798a",success:"#28a745",successLight:"#c2f0cd",successDark:"#1e7d34",warning:"#ffa900",warningLight:"#ffeabf",warningDark:"#bf7f00",danger:"#b71c1c",dangerLight:"#f7cccc",dangerDark:"#891515",background:"#fff",container:"#fff",neutral:"#7c858d",neutralLight:"#c4c5ca",neutralDark:"#40474f",onBackground:"#202428",onPrimary:"#fff",onSecondary:"#fff",onHighlight:"#fff",onSuccess:"#fff",onWarning:"#fff",onDanger:"#fff",onInfo:"#fff",onNeutral:"#fff"},l={primary:"#4da6e0",primaryLight:"#1a2832",primaryDark:"#87c5f0",secondary:"#b8d4e6",secondaryLight:"#1a2832",secondaryDark:"#e6f2ff",highlight:"#ff9966",highlightLight:"#2d1a0f",highlightDark:"#ffb899",info:"#4cb8d1",infoLight:"#1f2a2d",infoDark:"#7dcce0",success:"#5cb85c",successLight:"#1e2a20",successDark:"#85d085",warning:"#ffcc4d",warningLight:"#332a1a",warningDark:"#ffd966",danger:"#e74c3c",dangerLight:"#2d1a1a",dangerDark:"#f17066",background:"#121212",container:"#1e1e1e",neutral:"#9ca3ab",neutralLight:"#2a2d31",neutralDark:"#c8ced6",onBackground:"#e0e0e0",onPrimary:"#000",onSecondary:"#000",onHighlight:"#000",onSuccess:"#000",onWarning:"#000",onDanger:"#000",onInfo:"#000",onNeutral:"#000"},r=Object.freeze(Object.defineProperty({__proto__:null,defaultDarkColorScheme:l,defaultLightColorScheme:o},Symbol.toStringTag,{value:"Module"}))
|
|
9
9
|
function i(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}function s(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function u(e={},t={}){const a={},n=new Set([...Object.keys(e),...Object.keys(t)])
|
|
10
10
|
for(const o of n){if("__proto__"===o||"constructor"===o||"prototype"===o)continue
|
|
11
11
|
const n=e[o],l=t[o]
|
|
@@ -71,18 +71,14 @@ if(e){t+=` ${A(n)}: ${e};\n`
|
|
|
71
71
|
const a=M(e)
|
|
72
72
|
t+=` ${A(n)}-rgb: ${a.r} ${a.g} ${a.b};\n`}}return t+="}\n",t}function q(e){const t=e.map(P).join("\n"),a=function(){let e=document.getElementById(T)
|
|
73
73
|
return e||(e=document.createElement("style"),e.id=T,document.head.appendChild(e)),e}()
|
|
74
|
-
a.textContent=t}function A(e){return e?`--q-theme-${x(e)}`:""}function R(e,a){const n=t.
|
|
75
|
-
if(!
|
|
76
|
-
return
|
|
77
|
-
return{name:
|
|
74
|
+
a.textContent=t}function A(e){return e?`--q-theme-${x(e)}`:""}function R(e,a){const n=t.computed((()=>{const t=a.value.find((t=>t.name===e.value))
|
|
75
|
+
if(!t)throw new Error(`[Quidgest UI] Theme "${e.value}" not found`)
|
|
76
|
+
return t})),o=t.computed((()=>z(n.value.name))),l=t.computed((()=>P(n.value)))
|
|
77
|
+
return{name:e,current:n,themes:a,class:o,css:l}}function z(e){return`q-theme--${x(e)}`}const L=Symbol.for("q-theme")
|
|
78
78
|
function O(){const e=t.inject(L)
|
|
79
79
|
if(!e)throw new Error("[Quidgest UI] Could not find theme instance")
|
|
80
|
-
return e}function I(e){const
|
|
81
|
-
|
|
82
|
-
const l=t.toValue(e)
|
|
83
|
-
"string"!=typeof l?(o=[...o,l],n=l.name):n=l
|
|
84
|
-
const r=R(n,o)
|
|
85
|
-
return t.provide(L,r),r}function F(e){const a=t.computed((()=>t.unref(e))),n=t.computed((()=>!!a.value&&!function(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}(a.value))),o=t.computed((()=>{const e=a.value
|
|
80
|
+
return e}function I(e){const{themes:a}=O(),n=t.computed((()=>t.toValue(e))),o=t.computed((()=>"string"!=typeof n.value)),l=R(t.computed((()=>o.value?n.value.name:n.value)),t.computed((()=>o.value?[...a.value,n.value]:a.value)))
|
|
81
|
+
return t.provide(L,l),l}function F(e){const a=t.computed((()=>t.unref(e))),n=t.computed((()=>!!a.value&&!function(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}(a.value))),o=t.computed((()=>{const e=a.value
|
|
86
82
|
if(!e)return
|
|
87
83
|
let t=e
|
|
88
84
|
const o=O()
|
|
@@ -1559,7 +1555,7 @@ a.provide(d,t.ref(r)),function(e,a){const n=[]
|
|
|
1559
1555
|
let r
|
|
1560
1556
|
if(a)for(const e of a.themes){const t={..."light"===e.mode?o:l,...e.colors}
|
|
1561
1557
|
n.push({name:e.name,mode:e.mode,scheme:t}),e.name===a.defaultTheme&&(r=e.name)}else{const e=[{name:"light",mode:"light",scheme:o},{name:"dark",mode:"dark",scheme:l}]
|
|
1562
|
-
n.push(...e),r="light"}if(r){const a=R(t.ref(r),n)
|
|
1558
|
+
n.push(...e),r="light"}if(r){const a=R(t.ref(r),t.ref(n))
|
|
1563
1559
|
q(n),t.watch(a.class,Np,{immediate:!0}),e.provide(L,a)}}(a,e.themes)
|
|
1564
1560
|
const i=function(){const e=t.ref([])
|
|
1565
1561
|
return{layers:e,register:function(t){e.value.push(t)},unregister:function(t){const a=e.value.indexOf(t);-1!==a&&e.value.splice(a,1)},isTop:function(t){return e.value[e.value.length-1]===t}}}()
|
package/dist/ui.scss
CHANGED
|
@@ -43,7 +43,7 @@ export type ThemeInstance = {
|
|
|
43
43
|
/** A computed reference to the current theme definition. */
|
|
44
44
|
readonly current: DeepReadonly<ComputedRef<ThemeDefinition>>;
|
|
45
45
|
/** An array of available theme definitions. */
|
|
46
|
-
readonly themes: DeepReadonly<ThemeDefinition[]
|
|
46
|
+
readonly themes: DeepReadonly<Ref<ThemeDefinition[]>>;
|
|
47
47
|
/** The theme class name. */
|
|
48
48
|
readonly class: ComputedRef<string>;
|
|
49
49
|
/** The theme CSS definition. */
|
|
@@ -56,23 +56,22 @@ export type ThemeInstance = {
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function useTheme(): ThemeInstance;
|
|
58
58
|
/**
|
|
59
|
-
* Provides and manages a reactive theme instance within
|
|
59
|
+
* Provides and manages a reactive theme instance within Vue’s dependency injection system.
|
|
60
60
|
*
|
|
61
|
-
* This function
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* to
|
|
61
|
+
* This function:
|
|
62
|
+
* - Retrieves the current list of available themes from the existing theme context.
|
|
63
|
+
* - Resolves the input (`nameOrDef`) to either a theme name or a full `ThemeDefinition`.
|
|
64
|
+
* - If a `ThemeDefinition` is provided, it is appended to the existing list of themes.
|
|
65
|
+
* - Creates a new reactive `ThemeInstance` bound to the resolved name and theme list.
|
|
66
|
+
* - Provides the new `ThemeInstance` under `ThemeSymbol`, making it available to descendants via `useTheme()`.
|
|
65
67
|
*
|
|
66
|
-
* @param nameOrDef -
|
|
67
|
-
* - A string
|
|
68
|
-
* - A `ThemeDefinition
|
|
68
|
+
* @param nameOrDef - The theme to activate, given as either:
|
|
69
|
+
* - A theme name (`string`), or a reactive source (`Ref<string>`/getter).
|
|
70
|
+
* - A `ThemeDefinition`, or a reactive source (`Ref<ThemeDefinition>`/getter).
|
|
69
71
|
*
|
|
70
|
-
* @returns The newly created and provided `ThemeInstance
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* - `themes`: array of all available themes,
|
|
74
|
-
* - `class`: computed CSS class string for the theme,
|
|
75
|
-
* - `css`: computed CSS variables string for the theme.
|
|
72
|
+
* @returns The newly created and provided `ThemeInstance`.
|
|
73
|
+
*
|
|
74
|
+
* @throws {Error} If the resolved theme name does not exist in the available themes.
|
|
76
75
|
*/
|
|
77
76
|
export declare function provideTheme(nameOrDef: MaybeRefOrGetter<string | ThemeDefinition>): ThemeInstance;
|
|
78
77
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/composables/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAAyB,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAExC;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAA;IAEpB,mEAAmE;IACnE,MAAM,EAAE,KAAK,CAAC;QACb,6BAA6B;QAC7B,IAAI,EAAE,MAAM,CAAA;QAEZ,mDAAmD;QACnD,IAAI,EAAE,SAAS,CAAA;QAEf,qEAAqE;QACrE,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;KAC7B,CAAC,CAAA;CACF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IAEZ,mDAAmD;IACnD,IAAI,EAAE,SAAS,CAAA;IAEf,kDAAkD;IAClD,MAAM,EAAE,WAAW,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAE1B,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAA;IAE5D,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,eAAe,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/composables/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAAyB,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAExC;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAA;IAEpB,mEAAmE;IACnE,MAAM,EAAE,KAAK,CAAC;QACb,6BAA6B;QAC7B,IAAI,EAAE,MAAM,CAAA;QAEZ,mDAAmD;QACnD,IAAI,EAAE,SAAS,CAAA;QAEf,qEAAqE;QACrE,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;KAC7B,CAAC,CAAA;CACF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IAEZ,mDAAmD;IACnD,IAAI,EAAE,SAAS,CAAA;IAEf,kDAAkD;IAClD,MAAM,EAAE,WAAW,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAE1B,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAA;IAE5D,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAA;IAErD,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAEnC,gCAAgC;IAChC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC7C,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,aAAa,CAQxC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,GAAG,eAAe,CAAC,GAAG,aAAa,CA2CjG"}
|
package/esm/composables/theme.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { toValue as c, provide as
|
|
2
|
-
import { createThemeInstance as
|
|
1
|
+
import { computed as n, toValue as c, provide as a, inject as l } from "vue";
|
|
2
|
+
import { createThemeInstance as h } from "../utils/theme.js";
|
|
3
3
|
const m = Symbol.for("q-theme");
|
|
4
|
-
function
|
|
5
|
-
const e =
|
|
4
|
+
function v() {
|
|
5
|
+
const e = l(m);
|
|
6
6
|
if (!e)
|
|
7
7
|
throw new Error("[Quidgest UI] Could not find theme instance");
|
|
8
8
|
return e;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const s =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
10
|
+
function p(e) {
|
|
11
|
+
const { themes: o } = v(), t = n(() => c(e)), s = n(() => typeof t.value != "string"), r = n(
|
|
12
|
+
() => s.value ? t.value.name : t.value
|
|
13
|
+
), u = n(
|
|
14
|
+
() => s.value ? [...o.value, t.value] : o.value
|
|
15
|
+
), i = h(r, u);
|
|
16
|
+
return a(m, i), i;
|
|
17
17
|
}
|
|
18
18
|
export {
|
|
19
19
|
m as ThemeSymbol,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
p as provideTheme,
|
|
21
|
+
v as useTheme
|
|
22
22
|
};
|
package/esm/framework.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { DEFAULTS_SYMBOL as
|
|
1
|
+
import { DEFAULTS_SYMBOL as c } from "./composables/defaults.js";
|
|
2
2
|
import { ThemeSymbol as h } from "./composables/theme.js";
|
|
3
3
|
import { DismissibleLayerKey as f } from "./symbols/dismissibleLayer.js";
|
|
4
4
|
import { ToastSymbol as d } from "./composables/useToast/types.js";
|
|
5
5
|
import { useDismissibleLayerStack as u } from "./composables/useDismissibleLayerStack/index.js";
|
|
6
6
|
import { createToastInstance as p } from "./composables/useToast/index.js";
|
|
7
|
-
import { defaultLightColorScheme as
|
|
8
|
-
import { ref as
|
|
7
|
+
import { defaultLightColorScheme as l, defaultDarkColorScheme as i } from "./templates/theme.js";
|
|
8
|
+
import { ref as n, watch as S } from "vue";
|
|
9
9
|
import { createThemeInstance as T, generateRootStyle as L } from "./utils/theme.js";
|
|
10
10
|
function N(o = {}) {
|
|
11
11
|
return { install: (t) => {
|
|
12
12
|
const m = o.components || {};
|
|
13
|
-
for (const
|
|
14
|
-
t.component(
|
|
13
|
+
for (const a in m)
|
|
14
|
+
t.component(a, m[a]);
|
|
15
15
|
const e = o.defaults || {};
|
|
16
|
-
t.provide(
|
|
17
|
-
const
|
|
18
|
-
t.provide(f,
|
|
16
|
+
t.provide(c, n(e)), y(t, o.themes);
|
|
17
|
+
const r = u();
|
|
18
|
+
t.provide(f, r), b(t);
|
|
19
19
|
} };
|
|
20
20
|
}
|
|
21
21
|
function y(o, s) {
|
|
@@ -23,11 +23,11 @@ function y(o, s) {
|
|
|
23
23
|
let m;
|
|
24
24
|
if (s)
|
|
25
25
|
for (const e of s.themes) {
|
|
26
|
-
const
|
|
26
|
+
const a = { ...e.mode === "light" ? l : i, ...e.colors };
|
|
27
27
|
t.push({
|
|
28
28
|
name: e.name,
|
|
29
29
|
mode: e.mode,
|
|
30
|
-
scheme:
|
|
30
|
+
scheme: a
|
|
31
31
|
}), e.name === s.defaultTheme && (m = e.name);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
@@ -35,19 +35,19 @@ function y(o, s) {
|
|
|
35
35
|
{
|
|
36
36
|
name: "light",
|
|
37
37
|
mode: "light",
|
|
38
|
-
scheme:
|
|
38
|
+
scheme: l
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
name: "dark",
|
|
42
42
|
mode: "dark",
|
|
43
|
-
scheme:
|
|
43
|
+
scheme: i
|
|
44
44
|
}
|
|
45
45
|
];
|
|
46
46
|
t.push(...e), m = "light";
|
|
47
47
|
}
|
|
48
48
|
if (m) {
|
|
49
|
-
const e =
|
|
50
|
-
L(t), S(
|
|
49
|
+
const e = T(n(m), n(t));
|
|
50
|
+
L(t), S(e.class, k, { immediate: !0 }), o.provide(h, e);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function b(o) {
|
package/esm/templates/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = {
|
|
2
2
|
primary: "#008ad2",
|
|
3
3
|
primaryLight: "#cde5ff",
|
|
4
4
|
primaryDark: "#006398",
|
|
@@ -34,44 +34,44 @@ const f = {
|
|
|
34
34
|
onDanger: "#fff",
|
|
35
35
|
onInfo: "#fff",
|
|
36
36
|
onNeutral: "#fff"
|
|
37
|
-
},
|
|
37
|
+
}, f = {
|
|
38
38
|
primary: "#4da6e0",
|
|
39
|
-
primaryLight: "#
|
|
40
|
-
primaryDark: "#
|
|
41
|
-
secondary: "#
|
|
42
|
-
secondaryLight: "#
|
|
43
|
-
secondaryDark: "#
|
|
39
|
+
primaryLight: "#1a2832",
|
|
40
|
+
primaryDark: "#87c5f0",
|
|
41
|
+
secondary: "#b8d4e6",
|
|
42
|
+
secondaryLight: "#1a2832",
|
|
43
|
+
secondaryDark: "#e6f2ff",
|
|
44
44
|
highlight: "#ff9966",
|
|
45
|
-
highlightLight: "#
|
|
46
|
-
highlightDark: "#
|
|
47
|
-
info: "#
|
|
48
|
-
infoLight: "#
|
|
49
|
-
infoDark: "#
|
|
50
|
-
success: "#
|
|
51
|
-
successLight: "#
|
|
52
|
-
successDark: "#
|
|
53
|
-
warning: "#
|
|
54
|
-
warningLight: "#
|
|
55
|
-
warningDark: "#
|
|
56
|
-
danger: "#
|
|
57
|
-
dangerLight: "#
|
|
58
|
-
dangerDark: "#
|
|
45
|
+
highlightLight: "#2d1a0f",
|
|
46
|
+
highlightDark: "#ffb899",
|
|
47
|
+
info: "#4cb8d1",
|
|
48
|
+
infoLight: "#1f2a2d",
|
|
49
|
+
infoDark: "#7dcce0",
|
|
50
|
+
success: "#5cb85c",
|
|
51
|
+
successLight: "#1e2a20",
|
|
52
|
+
successDark: "#85d085",
|
|
53
|
+
warning: "#ffcc4d",
|
|
54
|
+
warningLight: "#332a1a",
|
|
55
|
+
warningDark: "#ffd966",
|
|
56
|
+
danger: "#e74c3c",
|
|
57
|
+
dangerLight: "#2d1a1a",
|
|
58
|
+
dangerDark: "#f17066",
|
|
59
59
|
background: "#121212",
|
|
60
60
|
container: "#1e1e1e",
|
|
61
|
-
neutral: "#
|
|
62
|
-
neutralLight: "#
|
|
63
|
-
neutralDark: "#
|
|
64
|
-
onBackground: "#
|
|
65
|
-
onPrimary: "#
|
|
66
|
-
onSecondary: "#
|
|
67
|
-
onHighlight: "#
|
|
68
|
-
onSuccess: "#
|
|
69
|
-
onWarning: "#
|
|
70
|
-
onDanger: "#
|
|
71
|
-
onInfo: "#
|
|
72
|
-
onNeutral: "#
|
|
61
|
+
neutral: "#9ca3ab",
|
|
62
|
+
neutralLight: "#2a2d31",
|
|
63
|
+
neutralDark: "#c8ced6",
|
|
64
|
+
onBackground: "#e0e0e0",
|
|
65
|
+
onPrimary: "#000",
|
|
66
|
+
onSecondary: "#000",
|
|
67
|
+
onHighlight: "#000",
|
|
68
|
+
onSuccess: "#000",
|
|
69
|
+
onWarning: "#000",
|
|
70
|
+
onDanger: "#000",
|
|
71
|
+
onInfo: "#000",
|
|
72
|
+
onNeutral: "#000"
|
|
73
73
|
};
|
|
74
74
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
f as defaultDarkColorScheme,
|
|
76
|
+
a as defaultLightColorScheme
|
|
77
77
|
};
|
package/esm/utils/theme.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeepReadonly,
|
|
1
|
+
import { DeepReadonly, Ref } from 'vue';
|
|
2
2
|
import { ThemeDefinition, ThemeInstance } from '../composables/theme';
|
|
3
3
|
export declare const THEME_NODE_ID = "q-theme";
|
|
4
4
|
/**
|
|
@@ -33,24 +33,24 @@ export declare function generateRootStyle(themes: ThemeDefinition[]): void;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function toProperty(color: string): string;
|
|
35
35
|
/**
|
|
36
|
-
* Creates a reactive theme instance
|
|
36
|
+
* Creates a reactive theme instance bound to a given theme name and list of theme definitions.
|
|
37
37
|
*
|
|
38
|
-
* This
|
|
39
|
-
* computed properties for
|
|
38
|
+
* This function ensures the active theme is always kept in sync with the provided `name` ref,
|
|
39
|
+
* and exposes reactive/computed properties for convenient use in templates and styling.
|
|
40
40
|
*
|
|
41
|
-
* @param name -
|
|
42
|
-
* @param themes - A
|
|
41
|
+
* @param name - A reactive `Ref<string>` representing the active theme name.
|
|
42
|
+
* @param themes - A reactive `Ref<ThemeDefinition[]>` containing all available themes.
|
|
43
43
|
*
|
|
44
|
-
* @returns A `ThemeInstance` object
|
|
45
|
-
* - `name`:
|
|
46
|
-
* - `current`: a computed `Ref<ThemeDefinition>` of the active theme.
|
|
47
|
-
* - `themes`: the
|
|
48
|
-
* - `class`: a computed CSS class
|
|
49
|
-
* - `css`: a computed string of CSS variables for the active theme.
|
|
44
|
+
* @returns A `ThemeInstance` object with the following reactive properties:
|
|
45
|
+
* - `name`: the reactive `Ref<string>` of the active theme name.
|
|
46
|
+
* - `current`: a computed `Ref<ThemeDefinition>` of the active theme definition.
|
|
47
|
+
* - `themes`: the reactive `Ref<ThemeDefinition[]>` of all available themes.
|
|
48
|
+
* - `class`: a computed `Ref<string>` of the CSS class for the active theme.
|
|
49
|
+
* - `css`: a computed `Ref<string>` of the CSS variables for the active theme.
|
|
50
50
|
*
|
|
51
|
-
* @throws
|
|
51
|
+
* @throws {Error} If no theme matching the active `name` exists in `themes`.
|
|
52
52
|
*/
|
|
53
|
-
export declare function createThemeInstance(name:
|
|
53
|
+
export declare function createThemeInstance(name: Ref<string>, themes: DeepReadonly<Ref<ThemeDefinition[]>>): ThemeInstance;
|
|
54
54
|
/**
|
|
55
55
|
* Generates a CSS class name for a given theme.
|
|
56
56
|
*
|
package/esm/utils/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAQ1E,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,CAY/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,UAoBtD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,QAM1D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,UAOvC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,GAC1C,aAAa,CAmBf;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,UAEzC"}
|
package/esm/utils/theme.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { parseColor as
|
|
3
|
-
import { toKebabCase as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { computed as c } from "vue";
|
|
2
|
+
import { parseColor as d } from "./color.js";
|
|
3
|
+
import { toKebabCase as a } from "./string.js";
|
|
4
|
+
const m = "q-theme";
|
|
5
|
+
function h() {
|
|
6
6
|
let e = document.getElementById(
|
|
7
|
-
|
|
7
|
+
m
|
|
8
8
|
);
|
|
9
|
-
return e || (e = document.createElement("style"), e.id =
|
|
9
|
+
return e || (e = document.createElement("style"), e.id = m, document.head.appendChild(e)), e;
|
|
10
10
|
}
|
|
11
11
|
function i(e) {
|
|
12
|
-
let t = `.${
|
|
12
|
+
let t = `.${l(e.name)} {
|
|
13
13
|
`;
|
|
14
14
|
const n = e.scheme;
|
|
15
15
|
let o;
|
|
16
16
|
for (o in n) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
t += ` ${u(o)}: ${
|
|
17
|
+
const s = n[o];
|
|
18
|
+
if (s) {
|
|
19
|
+
t += ` ${u(o)}: ${s};
|
|
20
20
|
`;
|
|
21
|
-
const
|
|
22
|
-
t += ` ${u(o)}-rgb: ${
|
|
21
|
+
const r = d(s);
|
|
22
|
+
t += ` ${u(o)}-rgb: ${r.r} ${r.g} ${r.b};
|
|
23
23
|
`;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
return t += `}
|
|
27
27
|
`, t;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function C(e) {
|
|
30
30
|
const t = e.map(i).join(`
|
|
31
|
-
`), n =
|
|
31
|
+
`), n = h();
|
|
32
32
|
n.textContent = t;
|
|
33
33
|
}
|
|
34
34
|
function u(e) {
|
|
35
|
-
return e ? `--q-theme-${
|
|
35
|
+
return e ? `--q-theme-${a(e)}` : "";
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const n =
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
throw new Error(`Theme "${
|
|
42
|
-
return
|
|
43
|
-
}),
|
|
37
|
+
function T(e, t) {
|
|
38
|
+
const n = c(() => {
|
|
39
|
+
const r = t.value.find((f) => f.name === e.value);
|
|
40
|
+
if (!r)
|
|
41
|
+
throw new Error(`[Quidgest UI] Theme "${e.value}" not found`);
|
|
42
|
+
return r;
|
|
43
|
+
}), o = c(() => l(n.value.name)), s = c(() => i(n.value));
|
|
44
44
|
return {
|
|
45
|
-
name:
|
|
46
|
-
current:
|
|
45
|
+
name: e,
|
|
46
|
+
current: n,
|
|
47
47
|
themes: t,
|
|
48
|
-
class:
|
|
48
|
+
class: o,
|
|
49
49
|
css: s
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return `q-theme--${
|
|
52
|
+
function l(e) {
|
|
53
|
+
return `q-theme--${a(e)}`;
|
|
54
54
|
}
|
|
55
55
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
m as THEME_NODE_ID,
|
|
57
|
+
T as createThemeInstance,
|
|
58
|
+
C as generateRootStyle,
|
|
59
59
|
i as generateThemeCss,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
l as getThemeClass,
|
|
61
|
+
h as getThemeNode,
|
|
62
62
|
u as toProperty
|
|
63
63
|
};
|