@duxweb/dvha-core 0.1.18 → 0.1.20
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/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/json/index.cjs +1 -0
- package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -0
- package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -0
- package/dist/cjs/hooks/json/vFor.cjs +1 -0
- package/dist/cjs/hooks/json/vIf.cjs +1 -0
- package/dist/cjs/hooks/json/vModel.cjs +1 -0
- package/dist/cjs/hooks/json/vOn.cjs +1 -0
- package/dist/cjs/hooks/json/vShow.cjs +1 -0
- package/dist/cjs/hooks/json/vText.cjs +1 -0
- package/dist/cjs/hooks/json.cjs +1 -0
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +2 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/node_modules/jsep/dist/jsep.cjs +2 -0
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/utils/theme.cjs +1 -1
- package/dist/esm/components/auth/can.js +6 -5
- package/dist/esm/components/overlay/overlay.js +31 -22
- package/dist/esm/directive/permission.js +3 -2
- package/dist/esm/hooks/data.js +96 -96
- package/dist/esm/hooks/json/index.js +23 -0
- package/dist/esm/hooks/json/utils/contextManager.js +31 -0
- package/dist/esm/hooks/json/utils/expressionParser.js +134 -0
- package/dist/esm/hooks/json/vFor.js +57 -0
- package/dist/esm/hooks/json/vIf.js +17 -0
- package/dist/esm/hooks/json/vModel.js +78 -0
- package/dist/esm/hooks/json/vOn.js +32 -0
- package/dist/esm/hooks/json/vShow.js +24 -0
- package/dist/esm/hooks/json/vText.js +54 -0
- package/dist/esm/hooks/json.js +80 -0
- package/dist/esm/hooks/overlay.js +3 -2
- package/dist/esm/hooks/theme.js +62 -62
- package/dist/esm/index.js +107 -91
- package/dist/esm/node_modules/jsep/dist/jsep.js +737 -0
- package/dist/esm/preset/i18nProvider.js +18 -9
- package/dist/esm/provider/app.js +3 -2
- package/dist/esm/utils/theme.js +1 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/json/index.d.ts +10 -0
- package/dist/types/hooks/json/types.d.ts +29 -0
- package/dist/types/hooks/json/utils/contextManager.d.ts +34 -0
- package/dist/types/hooks/json/utils/expressionParser.d.ts +10 -0
- package/dist/types/hooks/json/vFor.d.ts +2 -0
- package/dist/types/hooks/json/vIf.d.ts +2 -0
- package/dist/types/hooks/json/vModel.d.ts +2 -0
- package/dist/types/hooks/json/vOn.d.ts +2 -0
- package/dist/types/hooks/json/vShow.d.ts +2 -0
- package/dist/types/hooks/json/vText.d.ts +2 -0
- package/dist/types/hooks/json.d.ts +14 -0
- package/dist/types/hooks/overlay.d.ts +4 -0
- package/dist/types/types/data.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { extractContext as x, injectContext as u, cleanProps as d } from "./utils/contextManager.js";
|
|
2
|
+
import { parseVForExpression as v } from "./utils/expressionParser.js";
|
|
3
|
+
const A = {
|
|
4
|
+
name: "v-for",
|
|
5
|
+
priority: 90,
|
|
6
|
+
process(r, n) {
|
|
7
|
+
var a, m;
|
|
8
|
+
const e = ((a = r.attrs) == null ? void 0 : a["v-for"]) || ((m = r.attrs) == null ? void 0 : m.vFor);
|
|
9
|
+
if (!e)
|
|
10
|
+
return null;
|
|
11
|
+
const o = { ...r.attrs };
|
|
12
|
+
delete o["v-for"], delete o.vFor;
|
|
13
|
+
const i = x(n);
|
|
14
|
+
let t;
|
|
15
|
+
try {
|
|
16
|
+
if (Array.isArray(e))
|
|
17
|
+
t = {
|
|
18
|
+
items: e,
|
|
19
|
+
itemName: "item",
|
|
20
|
+
indexName: "index"
|
|
21
|
+
};
|
|
22
|
+
else if (typeof e == "object" && e.list)
|
|
23
|
+
t = {
|
|
24
|
+
items: Array.isArray(e.list) ? e.list : [],
|
|
25
|
+
itemName: e.item || "item",
|
|
26
|
+
indexName: e.index || "index"
|
|
27
|
+
};
|
|
28
|
+
else if (typeof e == "string")
|
|
29
|
+
t = v(e, i);
|
|
30
|
+
else
|
|
31
|
+
return console.warn("Unsupported v-for format:", e), null;
|
|
32
|
+
} catch (s) {
|
|
33
|
+
return console.warn("v-for parsing failed:", s), null;
|
|
34
|
+
}
|
|
35
|
+
const p = t.items.map((s, l) => {
|
|
36
|
+
const c = {
|
|
37
|
+
[t.itemName]: s,
|
|
38
|
+
[t.indexName]: l
|
|
39
|
+
}, f = { ...i, ...c };
|
|
40
|
+
return {
|
|
41
|
+
...r,
|
|
42
|
+
attrs: {
|
|
43
|
+
...o,
|
|
44
|
+
key: `${t.itemName}_${l}`,
|
|
45
|
+
...u({}, f)
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
props: d(n),
|
|
51
|
+
nodes: p
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
A as vForAdaptor
|
|
57
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { extractContext as n, evaluateCondition as r, createAdaptorResult as f } from "./utils/contextManager.js";
|
|
2
|
+
import { evaluateExpression as s } from "./utils/expressionParser.js";
|
|
3
|
+
const c = {
|
|
4
|
+
name: "v-if",
|
|
5
|
+
priority: 100,
|
|
6
|
+
process(v, i) {
|
|
7
|
+
const e = v.attrs || {}, o = n(i);
|
|
8
|
+
let t;
|
|
9
|
+
return e["v-if"] !== void 0 ? t = r(e["v-if"], o, s) : e["v-else-if"] !== void 0 ? t = r(e["v-else-if"], o, s) : e["v-else"] !== void 0 && (t = !0), t === void 0 ? null : f(i, {
|
|
10
|
+
skip: !t,
|
|
11
|
+
cleanKeys: ["v-if", "v-else-if", "v-else"]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
c as vIfAdaptor
|
|
17
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { toRef as p } from "vue";
|
|
2
|
+
const b = {
|
|
3
|
+
name: "v-model",
|
|
4
|
+
priority: 70,
|
|
5
|
+
process(e, s) {
|
|
6
|
+
const t = {}, r = {};
|
|
7
|
+
let o = !1;
|
|
8
|
+
return Object.entries(s).forEach(([n, i]) => {
|
|
9
|
+
if (n.startsWith("v-model") || n.startsWith("vModel")) {
|
|
10
|
+
o = !0;
|
|
11
|
+
const [d, ...u] = n.split(".");
|
|
12
|
+
let l;
|
|
13
|
+
d === "v-model" || d === "vModel" ? l = "modelValue" : d.startsWith("v-model:") ? l = d.slice(8) : d.startsWith("vModel:") ? l = d.slice(7) : l = "modelValue";
|
|
14
|
+
try {
|
|
15
|
+
const { modelValue: a, updateFn: m } = f(i, u);
|
|
16
|
+
t[l] = a, t[`onUpdate:${l}`] = m;
|
|
17
|
+
} catch (a) {
|
|
18
|
+
console.error(`v-model binding error (${l}):`, a);
|
|
19
|
+
}
|
|
20
|
+
} else
|
|
21
|
+
r[n] = i;
|
|
22
|
+
}), o ? { props: { ...r, ...t } } : null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function f(e, s) {
|
|
26
|
+
if (Array.isArray(e) && e.length === 2 && typeof e[0] == "function" && typeof e[1] == "function") {
|
|
27
|
+
const [r, o] = e;
|
|
28
|
+
return {
|
|
29
|
+
modelValue: r(),
|
|
30
|
+
updateFn: (n) => {
|
|
31
|
+
o(c(n, s));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(e) && e.length === 2) {
|
|
36
|
+
const [r, o] = e;
|
|
37
|
+
if (!r || typeof o != "string")
|
|
38
|
+
throw new Error("Invalid v-model binding format: [obj, prop] expected");
|
|
39
|
+
const n = p(r, o);
|
|
40
|
+
return {
|
|
41
|
+
modelValue: n.value,
|
|
42
|
+
updateFn: (i) => {
|
|
43
|
+
n.value = c(i, s);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const t = p(e);
|
|
48
|
+
return t === e && typeof e != "object" ? {
|
|
49
|
+
modelValue: e,
|
|
50
|
+
updateFn: () => {
|
|
51
|
+
console.warn("v-model: Cannot update non-reactive value. Please use ref, [obj, prop], or [getter, setter] format.");
|
|
52
|
+
}
|
|
53
|
+
} : {
|
|
54
|
+
modelValue: t.value,
|
|
55
|
+
updateFn: (r) => {
|
|
56
|
+
t.value = c(r, s);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function c(e, s) {
|
|
61
|
+
return s.reduce((t, r) => {
|
|
62
|
+
switch (r) {
|
|
63
|
+
case "trim":
|
|
64
|
+
return typeof t == "string" ? t.trim() : t;
|
|
65
|
+
case "number": {
|
|
66
|
+
const o = Number(t);
|
|
67
|
+
return Number.isNaN(o) ? t : o;
|
|
68
|
+
}
|
|
69
|
+
case "lazy":
|
|
70
|
+
return t;
|
|
71
|
+
default:
|
|
72
|
+
return console.warn(`Unknown v-model modifier: ${r}`), t;
|
|
73
|
+
}
|
|
74
|
+
}, e);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
b as vModelAdaptor
|
|
78
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const P = {
|
|
2
|
+
name: "v-on",
|
|
3
|
+
priority: 60,
|
|
4
|
+
process($, p) {
|
|
5
|
+
const n = {}, e = {};
|
|
6
|
+
let i = !1;
|
|
7
|
+
return Object.entries(p).forEach(([r, o]) => {
|
|
8
|
+
if (r.startsWith("@") || r.startsWith("v-on:")) {
|
|
9
|
+
i = !0;
|
|
10
|
+
const f = r.startsWith("@") ? r.slice(1) : r.slice(5), [s, ...a] = f.split(".");
|
|
11
|
+
if (!s) {
|
|
12
|
+
console.warn(`Invalid event name: ${r}`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const d = `on${s.charAt(0).toUpperCase()}${s.slice(1)}`, h = (t, ...u) => {
|
|
16
|
+
var c, l;
|
|
17
|
+
a.includes("prevent") && ((c = t.preventDefault) == null || c.call(t)), a.includes("stop") && ((l = t.stopPropagation) == null || l.call(t));
|
|
18
|
+
try {
|
|
19
|
+
typeof o == "function" ? o(t, ...u) : console.warn(`Invalid event handler type: ${typeof o}`);
|
|
20
|
+
} catch (m) {
|
|
21
|
+
console.error(`Event handler execution error (${s}):`, m);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
n[d] = h;
|
|
25
|
+
} else
|
|
26
|
+
e[r] = o;
|
|
27
|
+
}), i ? { props: { ...e, ...n } } : null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
P as vOnAdaptor
|
|
32
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { extractContext as a, evaluateCondition as p } from "./utils/contextManager.js";
|
|
2
|
+
import { evaluateExpression as v } from "./utils/expressionParser.js";
|
|
3
|
+
const u = {
|
|
4
|
+
name: "v-show",
|
|
5
|
+
priority: 95,
|
|
6
|
+
process(c, t) {
|
|
7
|
+
var r;
|
|
8
|
+
const e = (r = c.attrs) == null ? void 0 : r["v-show"];
|
|
9
|
+
if (e === void 0)
|
|
10
|
+
return null;
|
|
11
|
+
const i = a(t), n = p(e, i, v), o = { ...t };
|
|
12
|
+
delete o["v-show"];
|
|
13
|
+
const s = o.style || {}, l = typeof s == "object" ? { ...s, display: n ? void 0 : "none" } : { display: n ? void 0 : "none" };
|
|
14
|
+
return {
|
|
15
|
+
props: {
|
|
16
|
+
...o,
|
|
17
|
+
style: l
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
u as vShowAdaptor
|
|
24
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { evaluateExpression as h } from "./utils/expressionParser.js";
|
|
2
|
+
function l(r) {
|
|
3
|
+
return typeof r == "string" && /\{\{.+?\}\}/.test(r);
|
|
4
|
+
}
|
|
5
|
+
function f(r, o) {
|
|
6
|
+
return l(r) ? r.replace(/\{\{([^}]+)\}\}/g, (c, e) => {
|
|
7
|
+
try {
|
|
8
|
+
const n = h(e.trim(), o);
|
|
9
|
+
return String(n ?? "");
|
|
10
|
+
} catch (n) {
|
|
11
|
+
return console.warn(`Interpolation expression evaluation failed: ${e}`, n), c;
|
|
12
|
+
}
|
|
13
|
+
}) : r;
|
|
14
|
+
}
|
|
15
|
+
const d = {
|
|
16
|
+
name: "v-text",
|
|
17
|
+
priority: 50,
|
|
18
|
+
process(r, o) {
|
|
19
|
+
const c = o._context || {};
|
|
20
|
+
let e = !1, n = !1;
|
|
21
|
+
const i = {};
|
|
22
|
+
Object.entries(o).forEach(([t, s]) => {
|
|
23
|
+
if (typeof s == "string" && l(s)) {
|
|
24
|
+
const a = f(s, c);
|
|
25
|
+
a !== s ? (i[t] = a, e = !0) : i[t] = s;
|
|
26
|
+
} else
|
|
27
|
+
i[t] = s;
|
|
28
|
+
});
|
|
29
|
+
let p = r.children;
|
|
30
|
+
if (typeof r.children == "string" && l(r.children)) {
|
|
31
|
+
const t = f(r.children, c);
|
|
32
|
+
t !== r.children && (p = t, e = !0, n = !0);
|
|
33
|
+
}
|
|
34
|
+
if (!e)
|
|
35
|
+
return null;
|
|
36
|
+
if (n) {
|
|
37
|
+
const t = {
|
|
38
|
+
...r,
|
|
39
|
+
attrs: r.attrs,
|
|
40
|
+
children: p
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
props: i,
|
|
44
|
+
nodes: [t]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
props: i
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
d as vTextAdaptor
|
|
54
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { computed as J, isRef as y, defineComponent as R, h as A, unref as _ } from "vue";
|
|
2
|
+
import { defaultAdaptors as F } from "./json/index.js";
|
|
3
|
+
import { injectContext as G } from "./json/utils/contextManager.js";
|
|
4
|
+
function w(o) {
|
|
5
|
+
const v = o.adaptors || F, b = o.components || {}, O = J(() => y(o.data) ? o.data.value : o.data);
|
|
6
|
+
function P() {
|
|
7
|
+
return (y(o.context) ? o.context.value : o.context) || {};
|
|
8
|
+
}
|
|
9
|
+
function V(r) {
|
|
10
|
+
const t = {};
|
|
11
|
+
return Object.entries(r).forEach(([e, n]) => {
|
|
12
|
+
if (e === "_context") return;
|
|
13
|
+
const m = e === "modelValue" || e.startsWith("modelValue") || e !== "value" && (e.includes("model") || e.includes("Model"));
|
|
14
|
+
t[e] = m && y(n) ? _(n) : n;
|
|
15
|
+
}), t;
|
|
16
|
+
}
|
|
17
|
+
function p(r, t, e) {
|
|
18
|
+
return typeof r == "string" ? r : typeof r == "function" ? p(r(t), t, e) : Array.isArray(r) ? r.flatMap((n) => p(n, t, e)).filter(Boolean) : r != null && r.tag ? s(r, !0, e) : r;
|
|
19
|
+
}
|
|
20
|
+
function h(r, t, e) {
|
|
21
|
+
if (r)
|
|
22
|
+
return typeof r == "string" ? r : Array.isArray(r) ? r.flatMap((n) => typeof n == "string" ? n : s(n, t, e)).filter(Boolean) : s(r, t, e);
|
|
23
|
+
}
|
|
24
|
+
function s(r, t = !1, e = {}) {
|
|
25
|
+
const {
|
|
26
|
+
tag: n,
|
|
27
|
+
attrs: m = {},
|
|
28
|
+
children: E,
|
|
29
|
+
slots: j
|
|
30
|
+
} = r, u = {
|
|
31
|
+
...P(),
|
|
32
|
+
...e
|
|
33
|
+
};
|
|
34
|
+
let a = {
|
|
35
|
+
...m
|
|
36
|
+
};
|
|
37
|
+
Object.keys(u).length > 0 && (a = {
|
|
38
|
+
...a,
|
|
39
|
+
...G({}, u)
|
|
40
|
+
});
|
|
41
|
+
for (const i of v) {
|
|
42
|
+
const f = i.process(r, a);
|
|
43
|
+
if (f) {
|
|
44
|
+
if (a = f.props, f.skip) return null;
|
|
45
|
+
if (f.nodes)
|
|
46
|
+
return f.nodes.map((d) => {
|
|
47
|
+
var M;
|
|
48
|
+
const x = ((M = d.attrs) == null ? void 0 : M._context) || {};
|
|
49
|
+
return s(d, t, {
|
|
50
|
+
...u,
|
|
51
|
+
...x
|
|
52
|
+
});
|
|
53
|
+
}).filter(Boolean);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const c = typeof n == "string" && b[n] ? b[n] : n, B = typeof c != "string", l = V(a);
|
|
57
|
+
if (j && B && !t) {
|
|
58
|
+
const i = {};
|
|
59
|
+
return Object.entries(j).forEach(([f, d]) => {
|
|
60
|
+
i[f] = (x = {}) => p(d, x, u);
|
|
61
|
+
}), A(c, l, i);
|
|
62
|
+
}
|
|
63
|
+
const g = h(E, t, u);
|
|
64
|
+
return B && g !== void 0 ? A(c, l, {
|
|
65
|
+
default: () => g
|
|
66
|
+
}) : A(c, l, g);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
render: /* @__PURE__ */ R({
|
|
70
|
+
name: "JsonSchemaRenderer",
|
|
71
|
+
render() {
|
|
72
|
+
var r;
|
|
73
|
+
return (r = O.value) == null ? void 0 : r.map((t) => s(t)).filter(Boolean);
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
w as useJsonSchema
|
|
80
|
+
};
|
|
@@ -8,14 +8,15 @@ import "lodash-es";
|
|
|
8
8
|
import "@tanstack/vue-query";
|
|
9
9
|
import "json-2-csv";
|
|
10
10
|
import "@vueuse/core";
|
|
11
|
+
import "./json/index.js";
|
|
11
12
|
import "colorizr";
|
|
12
13
|
import "axios";
|
|
13
|
-
function
|
|
14
|
+
function w() {
|
|
14
15
|
const r = t(m);
|
|
15
16
|
return {
|
|
16
17
|
show: (o) => r(o)
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
w as useOverlay
|
|
21
22
|
};
|
package/dist/esm/hooks/theme.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useColorMode as Q, useCycleList as W } from "@vueuse/core";
|
|
2
2
|
import { hex2rgb as X } from "colorizr";
|
|
3
3
|
import { storeToRefs as Y } from "pinia";
|
|
4
|
-
import { watchEffect as Z, computed as
|
|
4
|
+
import { watchEffect as Z, computed as g, watch as _, readonly as I } from "vue";
|
|
5
5
|
import "lodash-es";
|
|
6
6
|
import { useThemeStore as N } from "../stores/theme.js";
|
|
7
7
|
import { useManage as ee } from "./manage.js";
|
|
@@ -28,17 +28,17 @@ function de() {
|
|
|
28
28
|
p(0);
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
|
-
}, b =
|
|
31
|
+
}, b = g(() => {
|
|
32
32
|
const { system: t, store: e } = C;
|
|
33
33
|
return e.value === "auto" ? t.value === "dark" : e.value === "dark";
|
|
34
|
-
}), z =
|
|
35
|
-
var t, e,
|
|
34
|
+
}), z = g(() => {
|
|
35
|
+
var t, e, o, c, i, l, r, s;
|
|
36
36
|
return b.value ? {
|
|
37
37
|
logo: (e = (t = h.config) == null ? void 0 : t.theme) == null ? void 0 : e.darkLogo,
|
|
38
|
-
banner: (c = (
|
|
38
|
+
banner: (c = (o = h.config) == null ? void 0 : o.theme) == null ? void 0 : c.darkBanner
|
|
39
39
|
} : {
|
|
40
40
|
logo: (l = (i = h.config) == null ? void 0 : i.theme) == null ? void 0 : l.logo,
|
|
41
|
-
banner: (s = (
|
|
41
|
+
banner: (s = (r = h.config) == null ? void 0 : r.theme) == null ? void 0 : s.banner
|
|
42
42
|
};
|
|
43
43
|
}), n = { ...{
|
|
44
44
|
colors: te,
|
|
@@ -63,34 +63,34 @@ function de() {
|
|
|
63
63
|
border: { base: "200", muted: "200", accented: "300", inverted: "900" }
|
|
64
64
|
},
|
|
65
65
|
dark: {
|
|
66
|
-
text: { dimmed: "600", muted: "
|
|
66
|
+
text: { dimmed: "600", muted: "400", toned: "300", base: "500", highlighted: "100", inverted: "black" },
|
|
67
67
|
bg: { base: "950", muted: "900", elevated: "800", accented: "700", inverted: "100" },
|
|
68
68
|
border: { base: "900", muted: "800", accented: "700", inverted: "100" }
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
colorBase: { white: "#ffffff", black: "#000000" }
|
|
72
|
-
}, ...(M = (V = h.config) == null ? void 0 : V.theme) == null ? void 0 : M.config }, { colorShades: k, colorTypes: w } = n,
|
|
72
|
+
}, ...(M = (V = h.config) == null ? void 0 : V.theme) == null ? void 0 : M.config }, { colorShades: k, colorTypes: w } = n, m = g(() => f.theme), v = g(() => Object.keys(n.colors)), T = ["default", "hover", "pressed", "focus", "disabled"];
|
|
73
73
|
function y() {
|
|
74
74
|
return b.value ? n.colorScenes.dark : n.colorScenes.light;
|
|
75
75
|
}
|
|
76
76
|
function E(t, e) {
|
|
77
77
|
var i;
|
|
78
|
-
const
|
|
79
|
-
if ((i =
|
|
80
|
-
const l =
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
78
|
+
const o = y(), c = o.default;
|
|
79
|
+
if ((i = o.overrides) != null && i[t]) {
|
|
80
|
+
const l = o.overrides[t], r = l == null ? void 0 : l[e];
|
|
81
|
+
if (r)
|
|
82
|
+
return r;
|
|
83
83
|
}
|
|
84
84
|
return c[e] || "500";
|
|
85
85
|
}
|
|
86
86
|
function j(t, e) {
|
|
87
87
|
var c;
|
|
88
|
-
const
|
|
89
|
-
return ((c = n.colors[
|
|
88
|
+
const o = m.value[t];
|
|
89
|
+
return ((c = n.colors[o]) == null ? void 0 : c[e]) || "";
|
|
90
90
|
}
|
|
91
|
-
function a(t, e,
|
|
91
|
+
function a(t, e, o) {
|
|
92
92
|
const i = (b.value ? n.colorSemantic.dark : n.colorSemantic.light)[t][e];
|
|
93
|
-
return i === "white" || i === "black" ? `var(--ui-color-${i})` : `var(--base-color-${
|
|
93
|
+
return i === "white" || i === "black" ? `var(--ui-color-${i})` : `var(--base-color-${o}-${i})`;
|
|
94
94
|
}
|
|
95
95
|
const S = (t) => {
|
|
96
96
|
const e = X(t);
|
|
@@ -99,43 +99,43 @@ function de() {
|
|
|
99
99
|
function D() {
|
|
100
100
|
var i, l;
|
|
101
101
|
const t = [];
|
|
102
|
-
Object.entries(n.colors).forEach(([
|
|
102
|
+
Object.entries(n.colors).forEach(([r, s]) => {
|
|
103
103
|
typeof s == "object" && Object.entries(s).forEach(([u, d]) => {
|
|
104
104
|
try {
|
|
105
|
-
t.push(`--base-color-${
|
|
105
|
+
t.push(`--base-color-${r}-${u}: ${S(d)};`);
|
|
106
106
|
} catch {
|
|
107
|
-
t.push(`--base-color-${
|
|
107
|
+
t.push(`--base-color-${r}-${u}: ${d};`);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
111
|
const e = [];
|
|
112
|
-
w.forEach((
|
|
113
|
-
const s =
|
|
112
|
+
w.forEach((r) => {
|
|
113
|
+
const s = m.value[r];
|
|
114
114
|
k.forEach((u) => {
|
|
115
|
-
e.push(`--ui-color-${
|
|
115
|
+
e.push(`--ui-color-${r}-${u}: var(--base-color-${s}-${u});`);
|
|
116
116
|
}), T.forEach((u) => {
|
|
117
|
-
const d = E(
|
|
118
|
-
u === "default" ? e.push(`--ui-color-${
|
|
117
|
+
const d = E(r, u);
|
|
118
|
+
u === "default" ? e.push(`--ui-color-${r}: var(--base-color-${s}-${d});`) : e.push(`--ui-color-${r}-${u}: var(--base-color-${s}-${d});`);
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
-
const
|
|
121
|
+
const o = m.value.gray, c = [
|
|
122
122
|
`--ui-color-white: ${S(((i = n.colorBase) == null ? void 0 : i.white) || "#ffffff")};`,
|
|
123
123
|
`--ui-color-black: ${S(((l = n.colorBase) == null ? void 0 : l.black) || "#000000")};`,
|
|
124
|
-
`--ui-text-dimmed: ${a("text", "dimmed",
|
|
125
|
-
`--ui-text-muted: ${a("text", "muted",
|
|
126
|
-
`--ui-text-toned: ${a("text", "toned",
|
|
127
|
-
`--ui-text: ${a("text", "base",
|
|
128
|
-
`--ui-text-highlighted: ${a("text", "highlighted",
|
|
129
|
-
`--ui-text-inverted: ${a("text", "inverted",
|
|
130
|
-
`--ui-bg: ${a("bg", "base",
|
|
131
|
-
`--ui-bg-muted: ${a("bg", "muted",
|
|
132
|
-
`--ui-bg-elevated: ${a("bg", "elevated",
|
|
133
|
-
`--ui-bg-accented: ${a("bg", "accented",
|
|
134
|
-
`--ui-bg-inverted: ${a("bg", "inverted",
|
|
135
|
-
`--ui-border: ${a("border", "base",
|
|
136
|
-
`--ui-border-muted: ${a("border", "muted",
|
|
137
|
-
`--ui-border-accented: ${a("border", "accented",
|
|
138
|
-
`--ui-border-inverted: ${a("border", "inverted",
|
|
124
|
+
`--ui-text-dimmed: ${a("text", "dimmed", o)};`,
|
|
125
|
+
`--ui-text-muted: ${a("text", "muted", o)};`,
|
|
126
|
+
`--ui-text-toned: ${a("text", "toned", o)};`,
|
|
127
|
+
`--ui-text: ${a("text", "base", o)};`,
|
|
128
|
+
`--ui-text-highlighted: ${a("text", "highlighted", o)};`,
|
|
129
|
+
`--ui-text-inverted: ${a("text", "inverted", o)};`,
|
|
130
|
+
`--ui-bg: ${a("bg", "base", o)};`,
|
|
131
|
+
`--ui-bg-muted: ${a("bg", "muted", o)};`,
|
|
132
|
+
`--ui-bg-elevated: ${a("bg", "elevated", o)};`,
|
|
133
|
+
`--ui-bg-accented: ${a("bg", "accented", o)};`,
|
|
134
|
+
`--ui-bg-inverted: ${a("bg", "inverted", o)};`,
|
|
135
|
+
`--ui-border: ${a("border", "base", o)};`,
|
|
136
|
+
`--ui-border-muted: ${a("border", "muted", o)};`,
|
|
137
|
+
`--ui-border-accented: ${a("border", "accented", o)};`,
|
|
138
|
+
`--ui-border-inverted: ${a("border", "inverted", o)};`
|
|
139
139
|
];
|
|
140
140
|
return `:root {
|
|
141
141
|
${t.join(`
|
|
@@ -146,19 +146,19 @@ function de() {
|
|
|
146
146
|
`)}
|
|
147
147
|
}`;
|
|
148
148
|
}
|
|
149
|
-
let
|
|
149
|
+
let $ = null;
|
|
150
150
|
function B() {
|
|
151
151
|
const t = D();
|
|
152
|
-
|
|
152
|
+
$ || ($ = document.createElement("style"), $.id = "dvha-variables", document.head.appendChild($)), $.textContent = t;
|
|
153
153
|
}
|
|
154
154
|
function G() {
|
|
155
155
|
f.cssInit || (f.setCssInit(), B());
|
|
156
156
|
}
|
|
157
|
-
_([
|
|
157
|
+
_([m, b], () => {
|
|
158
158
|
f.cssInit && B();
|
|
159
159
|
}, { deep: !0, immediate: !1 });
|
|
160
160
|
function U(t, e) {
|
|
161
|
-
|
|
161
|
+
v.value.includes(e) ? f.setThemeColor(t, e) : console.warn(`Color "${e}" is not available`);
|
|
162
162
|
}
|
|
163
163
|
function q(t) {
|
|
164
164
|
f.setThemeColors(t);
|
|
@@ -166,18 +166,18 @@ function de() {
|
|
|
166
166
|
function A() {
|
|
167
167
|
f.resetTheme();
|
|
168
168
|
}
|
|
169
|
-
function F(t, e,
|
|
170
|
-
return
|
|
169
|
+
function F(t, e, o = !1) {
|
|
170
|
+
return o ? `--ui-color-${t}-${e}` : j(t, e);
|
|
171
171
|
}
|
|
172
|
-
function H(t, e,
|
|
173
|
-
if (e || (e = "default"),
|
|
174
|
-
return e === "default" ?
|
|
172
|
+
function H(t, e, o = !1) {
|
|
173
|
+
if (e || (e = "default"), o)
|
|
174
|
+
return e === "default" ? `--ui-color-${t})` : `--ui-color-${t}-${e})`;
|
|
175
175
|
const c = E(t, e);
|
|
176
176
|
return j(t, c);
|
|
177
177
|
}
|
|
178
|
-
function J(t, e,
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
178
|
+
function J(t, e, o = !1) {
|
|
179
|
+
var r, s, u;
|
|
180
|
+
if (o) {
|
|
181
181
|
let d;
|
|
182
182
|
switch (t) {
|
|
183
183
|
case "text":
|
|
@@ -192,17 +192,17 @@ function de() {
|
|
|
192
192
|
default:
|
|
193
193
|
d = `--ui-${t}-${e}`;
|
|
194
194
|
}
|
|
195
|
-
return
|
|
195
|
+
return `${d}`;
|
|
196
196
|
}
|
|
197
|
-
const c =
|
|
198
|
-
return l === "white" ? ((
|
|
197
|
+
const c = m.value.gray, l = (b.value ? n.colorSemantic.dark : n.colorSemantic.light)[t][e];
|
|
198
|
+
return l === "white" ? ((r = n.colorBase) == null ? void 0 : r.white) || "#ffffff" : l === "black" ? ((s = n.colorBase) == null ? void 0 : s.black) || "#000000" : ((u = n.colors[c]) == null ? void 0 : u[l]) || "";
|
|
199
199
|
}
|
|
200
|
-
const K =
|
|
200
|
+
const K = g(() => {
|
|
201
201
|
var t;
|
|
202
|
-
return (t =
|
|
203
|
-
}), P =
|
|
202
|
+
return (t = v.value) == null ? void 0 : t.filter((e) => ["slate", "gray", "zinc", "neutral", "stone"].includes(e));
|
|
203
|
+
}), P = g(() => {
|
|
204
204
|
var t;
|
|
205
|
-
return (t =
|
|
205
|
+
return (t = v.value) == null ? void 0 : t.filter((e) => !["slate", "gray", "zinc", "neutral", "stone"].includes(e));
|
|
206
206
|
});
|
|
207
207
|
return {
|
|
208
208
|
toggle: O,
|
|
@@ -211,8 +211,8 @@ function de() {
|
|
|
211
211
|
isDark: b,
|
|
212
212
|
resources: z,
|
|
213
213
|
config: I(n),
|
|
214
|
-
colorMapping: I(
|
|
215
|
-
colors:
|
|
214
|
+
colorMapping: I(m),
|
|
215
|
+
colors: v,
|
|
216
216
|
neutralColors: K,
|
|
217
217
|
primaryColors: P,
|
|
218
218
|
colorShades: k,
|