@quidgest/ui 0.16.30 → 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.
@@ -1,4 +1,4 @@
1
- import { DeepReadonly, MaybeRefOrGetter } from 'vue';
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 for a given theme name.
36
+ * Creates a reactive theme instance bound to a given theme name and list of theme definitions.
37
37
  *
38
- * This provides reactive access to the currently active theme and
39
- * computed properties for applying its CSS class and CSS variables.
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 - The name of the theme to activate, or a getter/ref returning a string.
42
- * @param themes - A readonly array of available theme definitions.
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 containing:
45
- * - `name`: a reactive `Ref<string>` of the active theme name.
46
- * - `current`: a computed `Ref<ThemeDefinition>` of the active theme.
47
- * - `themes`: the array of all available theme definitions.
48
- * - `class`: a computed CSS class string for the active theme.
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 Will throw an error if no theme with the specified name exists in `themes`.
51
+ * @throws {Error} If no theme matching the active `name` exists in `themes`.
52
52
  */
53
- export declare function createThemeInstance(name: MaybeRefOrGetter<string>, themes: DeepReadonly<ThemeDefinition[]>): ThemeInstance;
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
  *
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AACzD,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,gBAAgB,CAAC,MAAM,CAAC,EAC9B,MAAM,EAAE,YAAY,CAAC,eAAe,EAAE,CAAC,GACrC,aAAa,CAqBf;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,UAEzC"}
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"}
@@ -1,63 +1,63 @@
1
- import { ref as d, toValue as p, computed as c } from "vue";
2
- import { parseColor as $ } from "./color.js";
3
- import { toKebabCase as l } from "./string.js";
4
- const a = "q-theme";
5
- function g() {
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
- a
7
+ m
8
8
  );
9
- return e || (e = document.createElement("style"), e.id = a, document.head.appendChild(e)), e;
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 = `.${f(e.name)} {
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 r = n[o];
18
- if (r) {
19
- t += ` ${u(o)}: ${r};
17
+ const s = n[o];
18
+ if (s) {
19
+ t += ` ${u(o)}: ${s};
20
20
  `;
21
- const s = $(r);
22
- t += ` ${u(o)}-rgb: ${s.r} ${s.g} ${s.b};
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 b(e) {
29
+ function C(e) {
30
30
  const t = e.map(i).join(`
31
- `), n = g();
31
+ `), n = h();
32
32
  n.textContent = t;
33
33
  }
34
34
  function u(e) {
35
- return e ? `--q-theme-${l(e)}` : "";
35
+ return e ? `--q-theme-${a(e)}` : "";
36
36
  }
37
- function v(e, t) {
38
- const n = d(p(e)), o = c(() => {
39
- const m = t.find((h) => h.name === n.value);
40
- if (!m)
41
- throw new Error(`Theme "${n.value}" not found`);
42
- return m;
43
- }), r = c(() => f(o.value.name)), s = c(() => i(o.value));
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: n,
46
- current: o,
45
+ name: e,
46
+ current: n,
47
47
  themes: t,
48
- class: r,
48
+ class: o,
49
49
  css: s
50
50
  };
51
51
  }
52
- function f(e) {
53
- return `q-theme--${l(e)}`;
52
+ function l(e) {
53
+ return `q-theme--${a(e)}`;
54
54
  }
55
55
  export {
56
- a as THEME_NODE_ID,
57
- v as createThemeInstance,
58
- b as generateRootStyle,
56
+ m as THEME_NODE_ID,
57
+ T as createThemeInstance,
58
+ C as generateRootStyle,
59
59
  i as generateThemeCss,
60
- f as getThemeClass,
61
- g as getThemeNode,
60
+ l as getThemeClass,
61
+ h as getThemeNode,
62
62
  u as toProperty
63
63
  };
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.30",
4
+ "version": "0.16.32",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "author": "Quidgest",