@duxweb/dvha-core 0.1.16 → 0.1.17

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,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@vueuse/core"),f=require("vue"),J=require("./manage.cjs"),K=require("pinia");require("lodash-es");const Q=require("../stores/theme.cjs"),U=require("./themeColor.cjs"),E=require("colorizr");function W(){var q,V;const d=Q.useThemeStore(),{mode:M}=K.storeToRefs(d),v=S.useColorMode({storageRef:M}),m=J.useManage(),{state:C,next:I}=S.useCycleList(["dark","light","auto"],{initialValue:v.store.value});f.watchEffect(()=>{v.value=C.value});const g=f.computed(()=>{const{system:o,store:t}=v;return t.value==="auto"?o.value==="dark":t.value==="dark"}),L=f.computed(()=>{var o,t,e,u,r,i,n,s;return g.value?{logo:(t=(o=m.config)==null?void 0:o.theme)==null?void 0:t.darkLogo,banner:(u=(e=m.config)==null?void 0:e.theme)==null?void 0:u.darkBanner}:{logo:(i=(r=m.config)==null?void 0:r.theme)==null?void 0:i.logo,banner:(s=(n=m.config)==null?void 0:n.theme)==null?void 0:s.banner}}),c={...{colors:U.themeColor,colorTypes:["primary","info","success","warning","error","gray"],colorShades:["50","100","200","300","400","500","600","700","800","900","950"],colorScenes:{light:{default:{default:"500",hover:"600",pressed:"700",focus:"500",disabled:"300"}},dark:{default:{default:"500",hover:"400",pressed:"300",focus:"500",disabled:"600"}}},colorSemantic:{light:{text:{dimmed:"400",muted:"500",toned:"600",base:"700",highlighted:"900",inverted:"white"},bg:{base:"white",muted:"50",elevated:"100",accented:"200",inverted:"900"},border:{base:"200",muted:"200",accented:"300",inverted:"900"}},dark:{text:{dimmed:"600",muted:"500",toned:"400",base:"300",highlighted:"100",inverted:"black"},bg:{base:"950",muted:"900",elevated:"800",accented:"700",inverted:"100"},border:{base:"800",muted:"800",accented:"700",inverted:"100"}}},colorBase:{white:"#ffffff",black:"#000000"}},...(V=(q=m.config)==null?void 0:q.theme)==null?void 0:V.config},{colorShades:p,colorTypes:k}=c,b=f.computed(()=>d.theme),x=f.computed(()=>Object.keys(c.colors)),w=["default","hover","pressed","focus","disabled"];function O(){return g.value?c.colorScenes.dark:c.colorScenes.light}function T(o,t){var r;const e=O(),u=e.default;if((r=e.overrides)!=null&&r[o]){const i=e.overrides[o],n=i==null?void 0:i[t];if(n)return n}return u[t]||"500"}function y(o,t){var u;const e=b.value[o];return((u=c.colors[e])==null?void 0:u[t])||""}function a(o,t,e){const r=(g.value?c.colorSemantic.dark:c.colorSemantic.light)[o][t];return r==="white"||r==="black"?`var(--color-${r})`:`var(--base-color-${e}-${r})`}function $(){var r,i;const o=[];Object.entries(c.colors).forEach(([n,s])=>{typeof s=="object"&&Object.entries(s).forEach(([l,h])=>{try{const B=E.hex2rgb(h),H=E.formatCSS(B,{format:"rgb"});o.push(`--base-color-${n}-${l}: ${H};`)}catch{o.push(`--base-color-${n}-${l}: ${h};`)}})});const t=[];k.forEach(n=>{const s=b.value[n];p.forEach(l=>{t.push(`--ui-color-${n}-${l}: var(--base-color-${s}-${l});`)}),w.forEach(l=>{const h=T(n,l);l==="default"?t.push(`--ui-color-${n}: var(--base-color-${s}-${h});`):t.push(`--ui-color-${n}-${l}: var(--base-color-${s}-${h});`)})});const e=b.value.gray,u=[`--color-white: ${((r=c.colorBase)==null?void 0:r.white)||"#ffffff"};`,`--color-black: ${((i=c.colorBase)==null?void 0:i.black)||"#000000"};`,`--ui-text-dimmed: ${a("text","dimmed",e)};`,`--ui-text-muted: ${a("text","muted",e)};`,`--ui-text-toned: ${a("text","toned",e)};`,`--ui-text: ${a("text","base",e)};`,`--ui-text-highlighted: ${a("text","highlighted",e)};`,`--ui-text-inverted: ${a("text","inverted",e)};`,`--ui-bg: ${a("bg","base",e)};`,`--ui-bg-muted: ${a("bg","muted",e)};`,`--ui-bg-elevated: ${a("bg","elevated",e)};`,`--ui-bg-accented: ${a("bg","accented",e)};`,`--ui-bg-inverted: ${a("bg","inverted",e)};`,`--ui-border: ${a("border","base",e)};`,`--ui-border-muted: ${a("border","muted",e)};`,`--ui-border-accented: ${a("border","accented",e)};`,`--ui-border-inverted: ${a("border","inverted",e)};`];return`:root {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vueuse/core"),F=require("colorizr"),H=require("pinia"),f=require("vue");require("lodash-es");const J=require("../stores/theme.cjs"),K=require("./manage.cjs"),Q=require("./themeColor.cjs");function U(){var V,B;const d=J.useThemeStore(),{mode:E}=H.storeToRefs(d),v=C.useColorMode({storageRef:E}),m=K.useManage(),{state:p,next:M}=C.useCycleList(["dark","light","auto"],{initialValue:v.store.value});f.watchEffect(()=>{v.value=p.value});const g=f.computed(()=>{const{system:o,store:e}=v;return e.value==="auto"?o.value==="dark":e.value==="dark"}),I=f.computed(()=>{var o,e,t,s,r,i,n,u;return g.value?{logo:(e=(o=m.config)==null?void 0:o.theme)==null?void 0:e.darkLogo,banner:(s=(t=m.config)==null?void 0:t.theme)==null?void 0:s.darkBanner}:{logo:(i=(r=m.config)==null?void 0:r.theme)==null?void 0:i.logo,banner:(u=(n=m.config)==null?void 0:n.theme)==null?void 0:u.banner}}),c={...{colors:Q.themeColor,colorTypes:["primary","info","success","warning","error","gray"],colorShades:["50","100","200","300","400","500","600","700","800","900","950"],colorScenes:{light:{default:{default:"500",hover:"600",pressed:"700",focus:"500",disabled:"300"}},dark:{default:{default:"500",hover:"400",pressed:"300",focus:"500",disabled:"600"}}},colorSemantic:{light:{text:{dimmed:"400",muted:"500",toned:"600",base:"700",highlighted:"900",inverted:"white"},bg:{base:"white",muted:"50",elevated:"100",accented:"200",inverted:"900"},border:{base:"200",muted:"200",accented:"300",inverted:"900"}},dark:{text:{dimmed:"600",muted:"500",toned:"400",base:"300",highlighted:"100",inverted:"black"},bg:{base:"950",muted:"900",elevated:"800",accented:"700",inverted:"100"},border:{base:"800",muted:"800",accented:"700",inverted:"100"}}},colorBase:{white:"#ffffff",black:"#000000"}},...(B=(V=m.config)==null?void 0:V.theme)==null?void 0:B.config},{colorShades:k,colorTypes:x}=c,b=f.computed(()=>d.theme),T=f.computed(()=>Object.keys(c.colors)),w=["default","hover","pressed","focus","disabled"];function L(){return g.value?c.colorScenes.dark:c.colorScenes.light}function y(o,e){var r;const t=L(),s=t.default;if((r=t.overrides)!=null&&r[o]){const i=t.overrides[o],n=i==null?void 0:i[e];if(n)return n}return s[e]||"500"}function j(o,e){var s;const t=b.value[o];return((s=c.colors[t])==null?void 0:s[e])||""}function a(o,e,t){const r=(g.value?c.colorSemantic.dark:c.colorSemantic.light)[o][e];return r==="white"||r==="black"?`var(--color-${r})`:`var(--base-color-${t}-${r})`}const $=o=>{const e=F.hex2rgb(o);return`${e.r} ${e.g} ${e.b}`};function S(){var r,i;const o=[];Object.entries(c.colors).forEach(([n,u])=>{typeof u=="object"&&Object.entries(u).forEach(([l,h])=>{try{o.push(`--base-color-${n}-${l}: ${$(h)};`)}catch{o.push(`--base-color-${n}-${l}: ${h};`)}})});const e=[];x.forEach(n=>{const u=b.value[n];k.forEach(l=>{e.push(`--ui-color-${n}-${l}: var(--base-color-${u}-${l});`)}),w.forEach(l=>{const h=y(n,l);l==="default"?e.push(`--ui-color-${n}: var(--base-color-${u}-${h});`):e.push(`--ui-color-${n}-${l}: var(--base-color-${u}-${h});`)})});const t=b.value.gray,s=[`--color-white: ${$(((r=c.colorBase)==null?void 0:r.white)||"#ffffff")};`,`--color-black: ${$(((i=c.colorBase)==null?void 0:i.black)||"#000000")};`,`--ui-text-dimmed: ${a("text","dimmed",t)};`,`--ui-text-muted: ${a("text","muted",t)};`,`--ui-text-toned: ${a("text","toned",t)};`,`--ui-text: ${a("text","base",t)};`,`--ui-text-highlighted: ${a("text","highlighted",t)};`,`--ui-text-inverted: ${a("text","inverted",t)};`,`--ui-bg: ${a("bg","base",t)};`,`--ui-bg-muted: ${a("bg","muted",t)};`,`--ui-bg-elevated: ${a("bg","elevated",t)};`,`--ui-bg-accented: ${a("bg","accented",t)};`,`--ui-bg-inverted: ${a("bg","inverted",t)};`,`--ui-border: ${a("border","base",t)};`,`--ui-border-muted: ${a("border","muted",t)};`,`--ui-border-accented: ${a("border","accented",t)};`,`--ui-border-inverted: ${a("border","inverted",t)};`];return`:root {
2
2
  ${o.join(`
3
3
  `)}
4
- ${t.join(`
4
+ ${e.join(`
5
5
  `)}
6
- ${u.join(`
6
+ ${s.join(`
7
7
  `)}
8
- }`}const{css:j}=S.useStyleTag($(),{id:"theme-variables"});function R(){d.cssInit||(d.setCssInit(),j.value=$())}f.watch([b,g],()=>{d.cssInit&&(j.value=$())},{deep:!0,immediate:!1});function z(o,t){x.value.includes(t)?d.setThemeColor(o,t):console.warn(`Color "${t}" is not available`)}function D(o){d.setThemeColors(o)}function G(){d.resetTheme()}function P(o,t){return y(o,t)}function A(o,t){t||(t="default");const e=T(o,t);return y(o,e)}function F(o,t){var i,n,s;const e=b.value.gray,r=(g.value?c.colorSemantic.dark:c.colorSemantic.light)[o][t];return r==="white"?((i=c.colorBase)==null?void 0:i.white)||"#ffffff":r==="black"?((n=c.colorBase)==null?void 0:n.black)||"#000000":((s=c.colors[e])==null?void 0:s[r])||""}return{toggle:I,mode:C,isDark:g,resources:L,config:f.readonly(c),colorMapping:f.readonly(b),colors:x,colorShades:p,colorTypes:k,colorScenes:w,cssInit:R,cssReset:G,setColor:z,setColors:D,getSceneColor:A,getShadeColor:P,getSemanticColor:F}}exports.useTheme=W;
8
+ }`}const{css:q}=C.useStyleTag(S(),{id:"theme-variables"});function O(){d.cssInit||(d.setCssInit(),q.value=S())}f.watch([b,g],()=>{d.cssInit&&(q.value=S())},{deep:!0,immediate:!1});function R(o,e){T.value.includes(e)?d.setThemeColor(o,e):console.warn(`Color "${e}" is not available`)}function z(o){d.setThemeColors(o)}function D(){d.resetTheme()}function G(o,e){return j(o,e)}function P(o,e){e||(e="default");const t=y(o,e);return j(o,t)}function A(o,e){var i,n;const t=b.value.gray,r=(g.value?c.colorSemantic.dark:c.colorSemantic.light)[o][e];return r==="white"?"#ffffff":r==="black"?((i=c.colorBase)==null?void 0:i.black)||"#000000":((n=c.colors[t])==null?void 0:n[r])||""}return{toggle:M,mode:p,isDark:g,resources:I,config:f.readonly(c),colorMapping:f.readonly(b),colors:T,colorShades:k,colorTypes:x,colorScenes:w,cssInit:O,cssReset:D,setColor:R,setColors:z,getSceneColor:P,getShadeColor:G,getSemanticColor:A}}exports.useTheme=U;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=i=>{const o={},c=["50","100","200","300","400","500","600","700","800","900","950"],u=["primary","info","success","warning","error","gray"],b=["hover","pressed","focus","disabled"];o.white={DEFAULT:"var(--color-white)"},o.black={DEFAULT:"var(--color-black)"},Object.keys(i).forEach(r=>{o[r]={},c.forEach(e=>{o[r][e]=`var(--base-color-${r}-${e})`})}),u.forEach(r=>{o[r]={},o[r].DEFAULT=`var(--ui-color-${r})`,c.forEach(e=>{o[r][e]=`var(--ui-color-${r}-${e})`}),b.forEach(e=>{o[r][e]=`var(--ui-color-${r}-${e})`})});const t={text:{color:"var(--ui-text)"},"text-dimmed":{color:"var(--ui-text-dimmed)"},"text-muted":{color:"var(--ui-text-muted)"},"text-toned":{color:"var(--ui-text-toned)"},"text-highlighted":{color:"var(--ui-text-highlighted)"},"text-inverted":{color:"var(--ui-text-inverted)"},bg:{"background-color":"var(--ui-bg)"},"bg-muted":{"background-color":"var(--ui-bg-muted)"},"bg-elevated":{"background-color":"var(--ui-bg-elevated)"},"bg-accented":{"background-color":"var(--ui-bg-accented)"},"bg-inverted":{"background-color":"var(--ui-bg-inverted)"},border:{"border-color":"var(--ui-border)"},"border-muted":{"border-color":"var(--ui-border-muted)"},"border-accented":{"border-color":"var(--ui-border-accented)"},"border-inverted":{"border-color":"var(--ui-border-inverted)"}},a={};Object.entries(t).forEach(([r,e])=>{a[`.${r}`]=e});const d=[];return Object.entries(t).forEach(([r,e])=>{d.push([r,e])}),{colors:o,classes:t,rules:d,utilities:a}};exports.themePreset=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(c){return`rgb(var(${c}))`}function s(c){const t={},i=["50","100","200","300","400","500","600","700","800","900","950"],n=["primary","info","success","warning","error","gray"],l=["hover","pressed","focus","disabled"];t.white={DEFAULT:e("--color-white")},t.black={DEFAULT:e("--color-black")},Object.keys(c).forEach(r=>{t[r]={},i.forEach(o=>{t[r][o]=e(`--base-color-${r}-${o}`)})}),n.forEach(r=>{t[r]={},t[r].DEFAULT=e(`--ui-color-${r}`),i.forEach(o=>{t[r][o]=e(`--ui-color-${r}-${o}`)}),l.forEach(o=>{t[r][o]=e(`--ui-color-${r}-${o}`)})});const d={text:{color:e("--ui-text")},"text-dimmed":{color:e("--ui-text-dimmed")},"text-muted":{color:e("--ui-text-muted")},"text-toned":{color:e("--ui-text-toned")},"text-highlighted":{color:e("--ui-text-highlighted")},"text-inverted":{color:e("--ui-text-inverted")},bg:{"background-color":e("--ui-bg")},"bg-muted":{"background-color":e("--ui-bg-muted")},"bg-elevated":{"background-color":e("--ui-bg-elevated")},"bg-accented":{"background-color":e("--ui-bg-accented")},"bg-inverted":{"background-color":e("--ui-bg-inverted")},border:{"border-color":e("--ui-border")},"border-muted":{"border-color":e("--ui-border-muted")},"border-accented":{"border-color":e("--ui-border-accented")},"border-inverted":{"border-color":e("--ui-border-inverted")}},u={};Object.entries(d).forEach(([r,o])=>{u[`.${r}`]=o});const b=[];return Object.entries(d).forEach(([r,o])=>{b.push([r,o])}),{colors:t,classes:d,rules:b,utilities:u}}exports.themePreset=s;
@@ -1,32 +1,32 @@
1
- import { useColorMode as J, useCycleList as K, useStyleTag as P } from "@vueuse/core";
2
- import { watchEffect as Q, computed as h, watch as U, readonly as E } from "vue";
3
- import { useManage as W } from "./manage.js";
4
- import { storeToRefs as X } from "pinia";
1
+ import { useColorMode as H, useCycleList as J, useStyleTag as K } from "@vueuse/core";
2
+ import { hex2rgb as P } from "colorizr";
3
+ import { storeToRefs as Q } from "pinia";
4
+ import { watchEffect as U, computed as h, watch as W, readonly as E } from "vue";
5
5
  import "lodash-es";
6
- import { useThemeStore as Y } from "../stores/theme.js";
6
+ import { useThemeStore as X } from "../stores/theme.js";
7
+ import { useManage as Y } from "./manage.js";
7
8
  import { themeColor as Z } from "./themeColor.js";
8
- import { hex2rgb as _, formatCSS as N } from "colorizr";
9
- function le() {
10
- var V, j;
11
- const d = Y(), { mode: M } = X(d), v = J({
9
+ function ie() {
10
+ var V, B;
11
+ const d = X(), { mode: M } = Q(d), v = H({
12
12
  storageRef: M
13
- }), g = W(), { state: S, next: I } = K(["dark", "light", "auto"], {
13
+ }), g = Y(), { state: C, next: I } = J(["dark", "light", "auto"], {
14
14
  initialValue: v.store.value
15
15
  });
16
- Q(() => {
17
- v.value = S.value;
16
+ U(() => {
17
+ v.value = C.value;
18
18
  });
19
19
  const f = h(() => {
20
- const { system: t, store: o } = v;
21
- return o.value === "auto" ? t.value === "dark" : o.value === "dark";
20
+ const { system: t, store: e } = v;
21
+ return e.value === "auto" ? t.value === "dark" : e.value === "dark";
22
22
  }), L = h(() => {
23
- var t, o, e, l, r, i, n, s;
23
+ var t, e, o, s, r, i, n, l;
24
24
  return f.value ? {
25
- logo: (o = (t = g.config) == null ? void 0 : t.theme) == null ? void 0 : o.darkLogo,
26
- banner: (l = (e = g.config) == null ? void 0 : e.theme) == null ? void 0 : l.darkBanner
25
+ logo: (e = (t = g.config) == null ? void 0 : t.theme) == null ? void 0 : e.darkLogo,
26
+ banner: (s = (o = g.config) == null ? void 0 : o.theme) == null ? void 0 : s.darkBanner
27
27
  } : {
28
28
  logo: (i = (r = g.config) == null ? void 0 : r.theme) == null ? void 0 : i.logo,
29
- banner: (s = (n = g.config) == null ? void 0 : n.theme) == null ? void 0 : s.banner
29
+ banner: (l = (n = g.config) == null ? void 0 : n.theme) == null ? void 0 : l.banner
30
30
  };
31
31
  }), c = { ...{
32
32
  colors: Z,
@@ -57,89 +57,92 @@ function le() {
57
57
  }
58
58
  },
59
59
  colorBase: { white: "#ffffff", black: "#000000" }
60
- }, ...(j = (V = g.config) == null ? void 0 : V.theme) == null ? void 0 : j.config }, { colorShades: C, colorTypes: p } = c, m = h(() => d.theme), k = h(() => Object.keys(c.colors)), x = ["default", "hover", "pressed", "focus", "disabled"];
60
+ }, ...(B = (V = g.config) == null ? void 0 : V.theme) == null ? void 0 : B.config }, { colorShades: S, colorTypes: k } = c, m = h(() => d.theme), x = h(() => Object.keys(c.colors)), w = ["default", "hover", "pressed", "focus", "disabled"];
61
61
  function O() {
62
62
  return f.value ? c.colorScenes.dark : c.colorScenes.light;
63
63
  }
64
- function w(t, o) {
64
+ function T(t, e) {
65
65
  var r;
66
- const e = O(), l = e.default;
67
- if ((r = e.overrides) != null && r[t]) {
68
- const i = e.overrides[t], n = i == null ? void 0 : i[o];
66
+ const o = O(), s = o.default;
67
+ if ((r = o.overrides) != null && r[t]) {
68
+ const i = o.overrides[t], n = i == null ? void 0 : i[e];
69
69
  if (n)
70
70
  return n;
71
71
  }
72
- return l[o] || "500";
72
+ return s[e] || "500";
73
73
  }
74
- function T(t, o) {
75
- var l;
76
- const e = m.value[t];
77
- return ((l = c.colors[e]) == null ? void 0 : l[o]) || "";
74
+ function y(t, e) {
75
+ var s;
76
+ const o = m.value[t];
77
+ return ((s = c.colors[o]) == null ? void 0 : s[e]) || "";
78
78
  }
79
- function a(t, o, e) {
80
- const r = (f.value ? c.colorSemantic.dark : c.colorSemantic.light)[t][o];
81
- return r === "white" || r === "black" ? `var(--color-${r})` : `var(--base-color-${e}-${r})`;
79
+ function a(t, e, o) {
80
+ const r = (f.value ? c.colorSemantic.dark : c.colorSemantic.light)[t][e];
81
+ return r === "white" || r === "black" ? `var(--color-${r})` : `var(--base-color-${o}-${r})`;
82
82
  }
83
- function $() {
83
+ const $ = (t) => {
84
+ const e = P(t);
85
+ return `${e.r} ${e.g} ${e.b}`;
86
+ };
87
+ function p() {
84
88
  var r, i;
85
89
  const t = [];
86
- Object.entries(c.colors).forEach(([n, s]) => {
87
- typeof s == "object" && Object.entries(s).forEach(([u, b]) => {
90
+ Object.entries(c.colors).forEach(([n, l]) => {
91
+ typeof l == "object" && Object.entries(l).forEach(([u, b]) => {
88
92
  try {
89
- const B = _(b), H = N(B, { format: "rgb" });
90
- t.push(`--base-color-${n}-${u}: ${H};`);
93
+ t.push(`--base-color-${n}-${u}: ${$(b)};`);
91
94
  } catch {
92
95
  t.push(`--base-color-${n}-${u}: ${b};`);
93
96
  }
94
97
  });
95
98
  });
96
- const o = [];
97
- p.forEach((n) => {
98
- const s = m.value[n];
99
- C.forEach((u) => {
100
- o.push(`--ui-color-${n}-${u}: var(--base-color-${s}-${u});`);
101
- }), x.forEach((u) => {
102
- const b = w(n, u);
103
- u === "default" ? o.push(`--ui-color-${n}: var(--base-color-${s}-${b});`) : o.push(`--ui-color-${n}-${u}: var(--base-color-${s}-${b});`);
99
+ const e = [];
100
+ k.forEach((n) => {
101
+ const l = m.value[n];
102
+ S.forEach((u) => {
103
+ e.push(`--ui-color-${n}-${u}: var(--base-color-${l}-${u});`);
104
+ }), w.forEach((u) => {
105
+ const b = T(n, u);
106
+ u === "default" ? e.push(`--ui-color-${n}: var(--base-color-${l}-${b});`) : e.push(`--ui-color-${n}-${u}: var(--base-color-${l}-${b});`);
104
107
  });
105
108
  });
106
- const e = m.value.gray, l = [
107
- `--color-white: ${((r = c.colorBase) == null ? void 0 : r.white) || "#ffffff"};`,
108
- `--color-black: ${((i = c.colorBase) == null ? void 0 : i.black) || "#000000"};`,
109
- `--ui-text-dimmed: ${a("text", "dimmed", e)};`,
110
- `--ui-text-muted: ${a("text", "muted", e)};`,
111
- `--ui-text-toned: ${a("text", "toned", e)};`,
112
- `--ui-text: ${a("text", "base", e)};`,
113
- `--ui-text-highlighted: ${a("text", "highlighted", e)};`,
114
- `--ui-text-inverted: ${a("text", "inverted", e)};`,
115
- `--ui-bg: ${a("bg", "base", e)};`,
116
- `--ui-bg-muted: ${a("bg", "muted", e)};`,
117
- `--ui-bg-elevated: ${a("bg", "elevated", e)};`,
118
- `--ui-bg-accented: ${a("bg", "accented", e)};`,
119
- `--ui-bg-inverted: ${a("bg", "inverted", e)};`,
120
- `--ui-border: ${a("border", "base", e)};`,
121
- `--ui-border-muted: ${a("border", "muted", e)};`,
122
- `--ui-border-accented: ${a("border", "accented", e)};`,
123
- `--ui-border-inverted: ${a("border", "inverted", e)};`
109
+ const o = m.value.gray, s = [
110
+ `--color-white: ${$(((r = c.colorBase) == null ? void 0 : r.white) || "#ffffff")};`,
111
+ `--color-black: ${$(((i = c.colorBase) == null ? void 0 : i.black) || "#000000")};`,
112
+ `--ui-text-dimmed: ${a("text", "dimmed", o)};`,
113
+ `--ui-text-muted: ${a("text", "muted", o)};`,
114
+ `--ui-text-toned: ${a("text", "toned", o)};`,
115
+ `--ui-text: ${a("text", "base", o)};`,
116
+ `--ui-text-highlighted: ${a("text", "highlighted", o)};`,
117
+ `--ui-text-inverted: ${a("text", "inverted", o)};`,
118
+ `--ui-bg: ${a("bg", "base", o)};`,
119
+ `--ui-bg-muted: ${a("bg", "muted", o)};`,
120
+ `--ui-bg-elevated: ${a("bg", "elevated", o)};`,
121
+ `--ui-bg-accented: ${a("bg", "accented", o)};`,
122
+ `--ui-bg-inverted: ${a("bg", "inverted", o)};`,
123
+ `--ui-border: ${a("border", "base", o)};`,
124
+ `--ui-border-muted: ${a("border", "muted", o)};`,
125
+ `--ui-border-accented: ${a("border", "accented", o)};`,
126
+ `--ui-border-inverted: ${a("border", "inverted", o)};`
124
127
  ];
125
128
  return `:root {
126
129
  ${t.join(`
127
130
  `)}
128
- ${o.join(`
131
+ ${e.join(`
129
132
  `)}
130
- ${l.join(`
133
+ ${s.join(`
131
134
  `)}
132
135
  }`;
133
136
  }
134
- const { css: y } = P($(), { id: "theme-variables" });
137
+ const { css: j } = K(p(), { id: "theme-variables" });
135
138
  function R() {
136
- d.cssInit || (d.setCssInit(), y.value = $());
139
+ d.cssInit || (d.setCssInit(), j.value = p());
137
140
  }
138
- U([m, f], () => {
139
- d.cssInit && (y.value = $());
141
+ W([m, f], () => {
142
+ d.cssInit && (j.value = p());
140
143
  }, { deep: !0, immediate: !1 });
141
- function D(t, o) {
142
- k.value.includes(o) ? d.setThemeColor(t, o) : console.warn(`Color "${o}" is not available`);
144
+ function D(t, e) {
145
+ x.value.includes(e) ? d.setThemeColor(t, e) : console.warn(`Color "${e}" is not available`);
143
146
  }
144
147
  function G(t) {
145
148
  d.setThemeColors(t);
@@ -147,30 +150,30 @@ function le() {
147
150
  function q() {
148
151
  d.resetTheme();
149
152
  }
150
- function z(t, o) {
151
- return T(t, o);
153
+ function z(t, e) {
154
+ return y(t, e);
152
155
  }
153
- function A(t, o) {
154
- o || (o = "default");
155
- const e = w(t, o);
156
- return T(t, e);
156
+ function A(t, e) {
157
+ e || (e = "default");
158
+ const o = T(t, e);
159
+ return y(t, o);
157
160
  }
158
- function F(t, o) {
159
- var i, n, s;
160
- const e = m.value.gray, r = (f.value ? c.colorSemantic.dark : c.colorSemantic.light)[t][o];
161
- return r === "white" ? ((i = c.colorBase) == null ? void 0 : i.white) || "#ffffff" : r === "black" ? ((n = c.colorBase) == null ? void 0 : n.black) || "#000000" : ((s = c.colors[e]) == null ? void 0 : s[r]) || "";
161
+ function F(t, e) {
162
+ var i, n;
163
+ const o = m.value.gray, r = (f.value ? c.colorSemantic.dark : c.colorSemantic.light)[t][e];
164
+ return r === "white" ? "#ffffff" : r === "black" ? ((i = c.colorBase) == null ? void 0 : i.black) || "#000000" : ((n = c.colors[o]) == null ? void 0 : n[r]) || "";
162
165
  }
163
166
  return {
164
167
  toggle: I,
165
- mode: S,
168
+ mode: C,
166
169
  isDark: f,
167
170
  resources: L,
168
171
  config: E(c),
169
172
  colorMapping: E(m),
170
- colors: k,
171
- colorShades: C,
172
- colorTypes: p,
173
- colorScenes: x,
173
+ colors: x,
174
+ colorShades: S,
175
+ colorTypes: k,
176
+ colorScenes: w,
174
177
  cssInit: R,
175
178
  cssReset: q,
176
179
  setColor: D,
@@ -181,5 +184,5 @@ function le() {
181
184
  };
182
185
  }
183
186
  export {
184
- le as useTheme
187
+ ie as useTheme
185
188
  };
@@ -1,82 +1,85 @@
1
- const l = (i) => {
2
- const e = {}, c = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"], u = ["primary", "info", "success", "warning", "error", "gray"], b = ["hover", "pressed", "focus", "disabled"];
3
- e.white = { DEFAULT: "var(--color-white)" }, e.black = { DEFAULT: "var(--color-black)" }, Object.keys(i).forEach((r) => {
4
- e[r] = {}, c.forEach((o) => {
5
- e[r][o] = `var(--base-color-${r}-${o})`;
1
+ function r(c) {
2
+ return `rgb(var(${c}))`;
3
+ }
4
+ function s(c) {
5
+ const t = {}, i = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"], n = ["primary", "info", "success", "warning", "error", "gray"], l = ["hover", "pressed", "focus", "disabled"];
6
+ t.white = { DEFAULT: r("--color-white") }, t.black = { DEFAULT: r("--color-black") }, Object.keys(c).forEach((o) => {
7
+ t[o] = {}, i.forEach((e) => {
8
+ t[o][e] = r(`--base-color-${o}-${e}`);
6
9
  });
7
- }), u.forEach((r) => {
8
- e[r] = {}, e[r].DEFAULT = `var(--ui-color-${r})`, c.forEach((o) => {
9
- e[r][o] = `var(--ui-color-${r}-${o})`;
10
- }), b.forEach((o) => {
11
- e[r][o] = `var(--ui-color-${r}-${o})`;
10
+ }), n.forEach((o) => {
11
+ t[o] = {}, t[o].DEFAULT = r(`--ui-color-${o}`), i.forEach((e) => {
12
+ t[o][e] = r(`--ui-color-${o}-${e}`);
13
+ }), l.forEach((e) => {
14
+ t[o][e] = r(`--ui-color-${o}-${e}`);
12
15
  });
13
16
  });
14
- const t = {
17
+ const d = {
15
18
  // 文字颜色
16
19
  text: {
17
- color: "var(--ui-text)"
20
+ color: r("--ui-text")
18
21
  },
19
22
  "text-dimmed": {
20
- color: "var(--ui-text-dimmed)"
23
+ color: r("--ui-text-dimmed")
21
24
  },
22
25
  "text-muted": {
23
- color: "var(--ui-text-muted)"
26
+ color: r("--ui-text-muted")
24
27
  },
25
28
  "text-toned": {
26
- color: "var(--ui-text-toned)"
29
+ color: r("--ui-text-toned")
27
30
  },
28
31
  "text-highlighted": {
29
- color: "var(--ui-text-highlighted)"
32
+ color: r("--ui-text-highlighted")
30
33
  },
31
34
  "text-inverted": {
32
- color: "var(--ui-text-inverted)"
35
+ color: r("--ui-text-inverted")
33
36
  },
34
37
  // 背景颜色
35
38
  bg: {
36
- "background-color": "var(--ui-bg)"
39
+ "background-color": r("--ui-bg")
37
40
  },
38
41
  "bg-muted": {
39
- "background-color": "var(--ui-bg-muted)"
42
+ "background-color": r("--ui-bg-muted")
40
43
  },
41
44
  "bg-elevated": {
42
- "background-color": "var(--ui-bg-elevated)"
45
+ "background-color": r("--ui-bg-elevated")
43
46
  },
44
47
  "bg-accented": {
45
- "background-color": "var(--ui-bg-accented)"
48
+ "background-color": r("--ui-bg-accented")
46
49
  },
47
50
  "bg-inverted": {
48
- "background-color": "var(--ui-bg-inverted)"
51
+ "background-color": r("--ui-bg-inverted")
49
52
  },
50
53
  // 边框颜色
51
54
  border: {
52
- "border-color": "var(--ui-border)"
55
+ "border-color": r("--ui-border")
53
56
  },
54
57
  "border-muted": {
55
- "border-color": "var(--ui-border-muted)"
58
+ "border-color": r("--ui-border-muted")
56
59
  },
57
60
  "border-accented": {
58
- "border-color": "var(--ui-border-accented)"
61
+ "border-color": r("--ui-border-accented")
59
62
  },
60
63
  "border-inverted": {
61
- "border-color": "var(--ui-border-inverted)"
64
+ "border-color": r("--ui-border-inverted")
62
65
  }
63
- }, a = {};
64
- Object.entries(t).forEach(([r, o]) => {
65
- a[`.${r}`] = o;
66
+ }, u = {};
67
+ Object.entries(d).forEach(([o, e]) => {
68
+ u[`.${o}`] = e;
66
69
  });
67
- const d = [];
68
- return Object.entries(t).forEach(([r, o]) => {
69
- d.push([
70
- r,
71
- o
70
+ const b = [];
71
+ return Object.entries(d).forEach(([o, e]) => {
72
+ b.push([
73
+ o,
74
+ e
72
75
  ]);
73
76
  }), {
74
- colors: e,
75
- classes: t,
76
- rules: d,
77
- utilities: a
77
+ colors: t,
78
+ classes: d,
79
+ rules: b,
80
+ utilities: u
78
81
  };
79
- };
82
+ }
80
83
  export {
81
- l as themePreset
84
+ s as themePreset
82
85
  };
@@ -1,5 +1,5 @@
1
- export declare const themePreset: (themeColor: Record<string, any>) => {
2
- colors: Record<string, Record<string, string>>;
1
+ export declare function themePreset(themeColor: Record<string, any>): {
2
+ colors: Record<string, Record<string, any>>;
3
3
  classes: {
4
4
  text: {
5
5
  color: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "0.1.16",
4
+ "version": "0.1.17",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {