mvframe 1.0.10 → 1.0.11

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/Config.js ADDED
@@ -0,0 +1,201 @@
1
+ import { reactive as B, onMounted as j, computed as k, resolveComponent as i, openBlock as u, createBlock as b, mergeProps as O, unref as s, withCtx as d, createElementVNode as n, toDisplayString as a, createVNode as p, createTextVNode as U, createElementBlock as V, Fragment as G, renderList as z, createCommentVNode as J, nextTick as C } from "vue";
2
+ import { MVFRAME_STORAGE_PRIMARY as M, persistMvframeTheme as f, applyMvframeTheme as g, MVFRAME_STORAGE_LANG as w } from "./composition.js";
3
+ /* empty css */
4
+ import { _ as K } from "./vendor.js";
5
+ const Y = { class: "configBody flexMode flexV g24 p24" }, q = { class: "section flexMode flexV g12" }, H = { class: "sectionTitle fs14 fw700 txt-h2" }, Q = { class: "flexMode vc g16 vl" }, W = { class: "section flexMode flexV g12" }, X = { class: "sectionTitle fs14 fw700 txt-h2" }, Z = { class: "flexMode vc hb g8 wp100" }, ee = { class: "txt-p fs14" }, te = { class: "section flexMode flexV g12" }, oe = { class: "sectionTitle fs14 fw700 txt-h2" }, ne = {
6
+ key: 0,
7
+ class: "langPrefix flexMode vc g4 noShrink"
8
+ }, le = { class: "langTag fs12 txt-tip" }, se = { class: "flexMode vc g8 vl" }, ae = { class: "langTag fs12 txt-tip noShrink" }, re = { class: "txt-p" }, ie = /* @__PURE__ */ Object.assign({
9
+ name: "FrameConfig",
10
+ inheritAttrs: !1
11
+ }, {
12
+ __name: "Config",
13
+ emits: ["mounted"],
14
+ setup(ce, { emit: T }) {
15
+ const D = T, t = B({
16
+ loading: !1,
17
+ primary: "#007bff",
18
+ isDark: !1,
19
+ lang: "en_us"
20
+ });
21
+ j(() => {
22
+ S(), D("mounted");
23
+ });
24
+ const _ = () => {
25
+ const e = getComputedStyle(document.documentElement).getPropertyValue("--color-primary").trim();
26
+ t.primary = e || "#007bff";
27
+ }, S = () => {
28
+ var m;
29
+ const e = localStorage.getItem(M);
30
+ e ? t.primary = e : _(), t.isDark = document.documentElement.classList.contains("dark");
31
+ const o = ((m = globalThis.$getLang) == null ? void 0 : m.call(globalThis)) || "en_us", r = y.filter((c) => c.use !== !1).map((c) => c.value);
32
+ t.lang = r.includes(o) ? o : "en_us";
33
+ }, h = () => {
34
+ f({
35
+ primary: t.primary,
36
+ mode: t.isDark ? "dark" : "light"
37
+ });
38
+ }, $ = () => {
39
+ const e = t.isDark ? "dark" : "light";
40
+ if (!t.primary) {
41
+ f({ primary: null }), g({ primary: null, mode: e }), C(() => _());
42
+ return;
43
+ }
44
+ g({ primary: t.primary, mode: e }), h();
45
+ }, A = () => {
46
+ const e = t.isDark ? "dark" : "light", o = localStorage.getItem(M);
47
+ g({
48
+ primary: o != null && o !== "" ? o : null,
49
+ mode: e
50
+ }), f({ mode: e });
51
+ }, E = () => {
52
+ f({ primary: null }), g({
53
+ primary: null,
54
+ mode: t.isDark ? "dark" : "light"
55
+ }), C(() => _());
56
+ }, L = (e) => {
57
+ var r;
58
+ const o = localStorage.getItem(w) || ((r = globalThis.$config) == null ? void 0 : r.lang) || "en_us";
59
+ e == null || e === o || (localStorage.setItem(w, e), window.location.reload());
60
+ }, F = async () => {
61
+ h();
62
+ }, v = k(() => y.filter((e) => e.use !== !1)), x = k(() => v.value.find((e) => e.value === t.lang) ?? null), y = [
63
+ {
64
+ label: "English",
65
+ icon: "us",
66
+ txt: "EN",
67
+ value: "en_us",
68
+ use: !0
69
+ },
70
+ {
71
+ label: "Simplified Chinese",
72
+ icon: "cn",
73
+ txt: "简",
74
+ value: "zh_cn",
75
+ use: !0
76
+ },
77
+ {
78
+ label: "Traditional Chinese",
79
+ icon: "hk",
80
+ txt: "繁",
81
+ value: "zh_tw",
82
+ use: !0
83
+ },
84
+ {
85
+ label: "Japanese",
86
+ icon: "jp",
87
+ txt: "言",
88
+ value: "ja_jp",
89
+ use: !0
90
+ },
91
+ {
92
+ label: "Korean",
93
+ icon: "kr",
94
+ txt: "언",
95
+ value: "ko_kr",
96
+ use: !0
97
+ },
98
+ {
99
+ label: "Vietnamese",
100
+ icon: "vn",
101
+ txt: "ế",
102
+ value: "vi_vn",
103
+ use: !0
104
+ }
105
+ ], I = [
106
+ "#007bff",
107
+ "#409eff",
108
+ "#16b1ff",
109
+ "#28a745",
110
+ "#6f42c1",
111
+ "#e83e8c",
112
+ "#dc3545",
113
+ "#fd7e14"
114
+ ];
115
+ return (e, o) => {
116
+ const r = i("el-color-picker"), m = i("el-button"), c = i("el-switch"), P = i("el-option"), R = i("el-select"), N = i("DrawerArea");
117
+ return u(), b(N, O({
118
+ loading: s(t).loading,
119
+ onSubmit: F
120
+ }, e.$attrs, { class: "MvcFrameConfig" }), {
121
+ default: d(() => [
122
+ n("div", Y, [
123
+ n("section", q, [
124
+ n("h3", H, a(e.$l("Theme color")), 1),
125
+ n("div", Q, [
126
+ p(r, {
127
+ modelValue: s(t).primary,
128
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => s(t).primary = l),
129
+ "color-format": "hex",
130
+ predefine: I,
131
+ onChange: $
132
+ }, null, 8, ["modelValue"]),
133
+ p(m, {
134
+ text: "",
135
+ type: "primary",
136
+ class: "resetBtn",
137
+ onClick: E
138
+ }, {
139
+ default: d(() => [
140
+ U(a(e.$l("Restore default")), 1)
141
+ ]),
142
+ _: 1
143
+ })
144
+ ])
145
+ ]),
146
+ n("section", W, [
147
+ n("h3", X, a(e.$l("Appearance")), 1),
148
+ n("div", Z, [
149
+ n("span", ee, a(e.$l("Light / dark mode")), 1),
150
+ p(c, {
151
+ modelValue: s(t).isDark,
152
+ "onUpdate:modelValue": o[1] || (o[1] = (l) => s(t).isDark = l),
153
+ "inline-prompt": "",
154
+ "active-text": e.$l("Dark"),
155
+ "inactive-text": e.$l("Light"),
156
+ onChange: A
157
+ }, null, 8, ["modelValue", "active-text", "inactive-text"])
158
+ ])
159
+ ]),
160
+ n("section", te, [
161
+ n("h3", oe, a(e.$l("Language")), 1),
162
+ p(R, {
163
+ modelValue: s(t).lang,
164
+ "onUpdate:modelValue": o[2] || (o[2] = (l) => s(t).lang = l),
165
+ class: "langSelect w160",
166
+ teleported: !0,
167
+ onChange: L
168
+ }, {
169
+ prefix: d(() => [
170
+ s(x) ? (u(), V("div", ne, [
171
+ n("span", le, a(s(x).txt), 1)
172
+ ])) : J("", !0)
173
+ ]),
174
+ default: d(() => [
175
+ (u(!0), V(G, null, z(s(v), (l) => (u(), b(P, {
176
+ key: l.value,
177
+ label: e.$l(l.label),
178
+ value: l.value
179
+ }, {
180
+ default: d(() => [
181
+ n("div", se, [
182
+ n("span", ae, a(l.txt), 1),
183
+ n("span", re, a(e.$l(l.label)), 1)
184
+ ])
185
+ ]),
186
+ _: 2
187
+ }, 1032, ["label", "value"]))), 128))
188
+ ]),
189
+ _: 1
190
+ }, 8, ["modelValue"])
191
+ ])
192
+ ])
193
+ ]),
194
+ _: 1
195
+ }, 16, ["loading"]);
196
+ };
197
+ }
198
+ }), fe = /* @__PURE__ */ K(ie, [["__scopeId", "data-v-011d0a99"]]);
199
+ export {
200
+ fe as default
201
+ };
@@ -1,203 +1,337 @@
1
- const C = (n, e) => {
2
- if (!n || !e) return !1;
3
- const t = n.getBoundingClientRect(), r = e.getBoundingClientRect(), o = r.right > t.left && r.left < t.right, s = r.bottom > t.top && r.top < t.bottom;
1
+ import { g as L } from "./vendor.js";
2
+ const x = "lang", J = (t) => {
3
+ var o, s;
4
+ const e = typeof window < "u", r = () => {
5
+ if (!e)
6
+ return { innerWidth: 1920, innerHeight: 1080 };
7
+ const i = window, l = typeof navigator < "u" ? i.navigator : {}, a = i.screen || {}, c = i.visualViewport, u = {
8
+ innerWidth: i.innerWidth,
9
+ innerHeight: i.innerHeight,
10
+ outerWidth: i.outerWidth,
11
+ outerHeight: i.outerHeight,
12
+ screenWidth: a.width ?? i.innerWidth,
13
+ screenHeight: a.height ?? i.innerHeight,
14
+ availWidth: a.availWidth ?? i.innerWidth,
15
+ availHeight: a.availHeight ?? i.innerHeight,
16
+ devicePixelRatio: i.devicePixelRatio || 1
17
+ };
18
+ c && (u.visualViewportWidth = c.width, u.visualViewportHeight = c.height, u.visualViewportScale = c.scale);
19
+ const g = l.userAgent || "";
20
+ return u.env = {
21
+ userAgent: g,
22
+ language: l.language || "",
23
+ languages: l.languages ? [...l.languages] : [],
24
+ platform: l.platform || "",
25
+ cookieEnabled: !!l.cookieEnabled,
26
+ onLine: l.onLine !== !1,
27
+ maxTouchPoints: l.maxTouchPoints || 0,
28
+ isTouch: "ontouchstart" in i || (l.maxTouchPoints || 0) > 0,
29
+ isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(
30
+ g
31
+ )
32
+ }, u;
33
+ }, n = () => {
34
+ var l;
35
+ const i = r();
36
+ globalThis.$config = globalThis.$config || {}, globalThis.$config.options = {
37
+ ...globalThis.$config.options || {},
38
+ ...i
39
+ }, (l = t == null ? void 0 : t.config) != null && l.globalProperties && (t.config.globalProperties.$config = globalThis.$config);
40
+ };
41
+ n(), e && (window.addEventListener("resize", n, { passive: !0 }), (s = (o = window.visualViewport) == null ? void 0 : o.addEventListener) == null || s.call(o, "resize", n, {
42
+ passive: !0
43
+ }));
44
+ }, K = (t, e) => {
45
+ var l, a;
46
+ const r = e || {}, o = (typeof localStorage < "u" ? localStorage.getItem(x) : null) || ((l = globalThis.$config) == null ? void 0 : l.lang) || "en_us", s = Object.assign(
47
+ {},
48
+ L(o),
49
+ ((a = globalThis.$config) == null ? void 0 : a.langMaps) || {},
50
+ r.langMaps || {}
51
+ ), i = (c, u) => {
52
+ if (c)
53
+ if (u && globalThis.$getType(u) === "Object") {
54
+ let g = s[c] || c;
55
+ return Object.keys(u).forEach((y) => {
56
+ g[`{${y}}`] = u[y];
57
+ }), g;
58
+ } else
59
+ return s[c] || c;
60
+ else
61
+ return c;
62
+ };
63
+ globalThis.$patchLangMaps = (c) => {
64
+ c && globalThis.$getType(c) === "Object" && Object.assign(s, c);
65
+ }, globalThis.$l = i, t.config.globalProperties.$l = i, t.config.globalProperties.$patchLangMaps = globalThis.$patchLangMaps, String.prototype.$l = i;
66
+ }, D = (t) => {
67
+ if (!t)
68
+ return maps;
69
+ const e = t.split(".");
70
+ if (e.length > 1) {
71
+ let r = maps;
72
+ for (let n = 0; n < e.length; n++)
73
+ r[e[n]] ? r = r[e[n]] : console.error(`No Map node at ${e[n]} in ${t}`);
74
+ return r;
75
+ } else
76
+ return maps[t];
77
+ }, X = (t, e) => {
78
+ if (!t || !e) return !1;
79
+ const r = t.getBoundingClientRect(), n = e.getBoundingClientRect(), o = n.right > r.left && n.left < r.right, s = n.bottom > r.top && n.top < r.bottom;
4
80
  return o && s;
5
- }, _ = (n, e) => {
6
- if (n === e) return !0;
7
- if (n == null || e == null || typeof n != "object" || typeof e != "object")
8
- return JSON.stringify(n) === JSON.stringify(e);
9
- const t = Object.keys(n), r = Object.keys(e);
10
- if (t.length !== r.length) return !1;
11
- for (const o of t)
12
- if (!r.includes(o) || !_(n[o], e[o])) return !1;
81
+ }, _ = (t, e) => {
82
+ if (t === e) return !0;
83
+ if (t == null || e == null || typeof t != "object" || typeof e != "object")
84
+ return JSON.stringify(t) === JSON.stringify(e);
85
+ const r = Object.keys(t), n = Object.keys(e);
86
+ if (r.length !== n.length) return !1;
87
+ for (const o of r)
88
+ if (!n.includes(o) || !_(t[o], e[o])) return !1;
13
89
  return !0;
14
- }, g = "download";
15
- const O = (n, e = g) => {
16
- const t = e || g, r = String(n ?? "").trim();
17
- if (!r) return t;
18
- const s = r.replace(/[/\\?%*:|"<>]/g, "_").replace(/\.\./g, "_").split(/[/\\]/).pop() || t, c = 200;
19
- return s.length > c ? s.slice(0, c) : s;
20
- }, R = (n) => {
21
- const e = ((n == null ? void 0 : n.type) || "").toLowerCase();
90
+ }, v = "download", O = 150, A = (t, e = v) => {
91
+ const r = e || v, n = String(t ?? "").trim();
92
+ if (!n) return r;
93
+ const s = n.replace(/[/\\?%*:|"<>]/g, "_").replace(/\.\./g, "_").split(/[/\\]/).pop() || r, i = 200;
94
+ return s.length > i ? s.slice(0, i) : s;
95
+ }, B = (t) => {
96
+ const e = ((t == null ? void 0 : t.type) || "").toLowerCase();
22
97
  return e ? e.includes("spreadsheet") || e.includes("ms-excel") || e.includes("excel") && e.includes("application") : !1;
23
- }, h = (n, e) => {
24
- const t = URL.createObjectURL(n), r = O(e), o = document.createElement("a");
25
- o.href = t, o.download = r, o.style.display = "none", document.body.appendChild(o);
98
+ }, S = (t, e) => {
99
+ const r = URL.createObjectURL(t), n = A(e), o = document.createElement("a");
100
+ o.href = r, o.download = n, o.style.display = "none", document.body.appendChild(o);
26
101
  try {
27
102
  o.click();
28
103
  } finally {
29
- document.body.removeChild(o), setTimeout(() => URL.revokeObjectURL(t), 150);
104
+ document.body.removeChild(o), setTimeout(() => URL.revokeObjectURL(r), O);
30
105
  }
31
- }, k = (n) => {
32
- if (!n || n.source !== void 0 || n.type === void 0)
33
- return n;
34
- const { type: e, data: t, url: r, headers: o, name: s, filename: c, init: i, ...f } = n, a = c ?? s;
106
+ }, I = (t) => {
107
+ if (!t || t.source !== void 0 || t.type === void 0)
108
+ return t;
109
+ const { type: e, data: r, url: n, headers: o, name: s, filename: i, init: l, ...a } = t, c = i ?? s;
35
110
  return e === "csv" ? {
36
- ...f,
111
+ ...a,
37
112
  source: "inline",
38
- content: t,
39
- filename: a,
40
- bom: n.bom
113
+ content: r,
114
+ filename: c,
115
+ bom: t.bom
41
116
  } : e === "excel" ? {
42
- ...f,
117
+ ...a,
43
118
  source: "fetch",
44
- url: r,
45
- init: { ...i || {}, headers: o ?? (i == null ? void 0 : i.headers) },
119
+ url: n,
120
+ init: { ...l || {}, headers: o ?? (l == null ? void 0 : l.headers) },
46
121
  response: "blob",
47
122
  expectExcel: !0,
48
- filename: a
49
- } : n;
50
- }, U = async (n = {}) => {
51
- const e = k(n), {
52
- source: t = "inline",
53
- content: r,
123
+ filename: c
124
+ } : t;
125
+ }, Q = async (t = {}) => {
126
+ const e = I(t), {
127
+ source: r = "inline",
128
+ content: n,
54
129
  blob: o,
55
130
  bom: s = !0,
56
- mime: c,
57
- url: i,
58
- init: f,
59
- response: a = "blob",
60
- openIn: b = "self",
61
- expectExcel: E,
62
- filename: m,
63
- name: x,
64
- error: u = () => {
131
+ mime: i,
132
+ url: l,
133
+ init: a,
134
+ response: c = "blob",
135
+ openIn: u = "self",
136
+ expectExcel: g,
137
+ filename: y,
138
+ name: $,
139
+ error: p = () => {
65
140
  },
66
141
  // 避免 legacy 字段渗入后续逻辑
67
- type: L,
68
- data: $,
69
- headers: T,
70
- ...j
71
- } = e, p = m ?? x;
142
+ type: F,
143
+ data: z,
144
+ headers: q,
145
+ ...G
146
+ } = e, b = y ?? $;
72
147
  try {
73
- if (t === "inline") {
148
+ if (r === "inline") {
74
149
  if (o instanceof Blob) {
75
- h(o, p);
150
+ S(o, b);
76
151
  return;
77
152
  }
78
- if (r == null) {
79
- u(new Error("content or blob is required for inline"));
153
+ if (n == null) {
154
+ p(new Error("content or blob is required for inline"));
80
155
  return;
81
156
  }
82
- const l = typeof r == "string" ? r : String(r), d = s ? "\uFEFF" + l : l, y = c || (s ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
83
- h(new Blob([d], { type: y }), p);
157
+ const f = typeof n == "string" ? n : String(n), E = s ? "\uFEFF" + f : f, w = i || (s ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
158
+ S(new Blob([E], { type: w }), b);
84
159
  return;
85
160
  }
86
- if (t === "fetch") {
87
- if (!i) {
88
- u(new Error("url is required for fetch"));
161
+ if (r === "fetch") {
162
+ if (!l) {
163
+ p(new Error("url is required for fetch"));
89
164
  return;
90
165
  }
91
- const l = await fetch(i, f);
92
- if (!l.ok) {
93
- u(new Error(`fetch failed: ${l.status}`));
166
+ const f = await fetch(l, a);
167
+ if (!f.ok) {
168
+ p(new Error(`fetch failed: ${f.status}`));
94
169
  return;
95
170
  }
96
- if (a === "text") {
97
- const y = await l.text(), w = s ? "\uFEFF" + y : y, S = c || (s ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
98
- h(new Blob([w], { type: S }), p);
171
+ if (c === "text") {
172
+ const w = await f.text(), k = s ? "\uFEFF" + w : w, P = i || (s ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
173
+ S(new Blob([k], { type: P }), b);
99
174
  return;
100
175
  }
101
- const d = await l.blob();
102
- if (E && !R(d)) {
103
- u(new Error("excel does not exist"));
176
+ const E = await f.blob();
177
+ if (g && !B(E)) {
178
+ p(new Error("excel does not exist"));
104
179
  return;
105
180
  }
106
- h(d, p);
181
+ S(E, b);
107
182
  return;
108
183
  }
109
- if (t === "open") {
110
- if (!i) {
111
- u(new Error("url is required for open"));
184
+ if (r === "open") {
185
+ if (!l) {
186
+ p(new Error("url is required for open"));
112
187
  return;
113
188
  }
114
- b === "blank" ? window.open(i, "_blank", "noopener,noreferrer") : window.location.href = i;
189
+ u === "blank" ? window.open(l, "_blank", "noopener,noreferrer") : window.location.href = l;
115
190
  return;
116
191
  }
117
- u(new Error(`unknown source: ${t}`));
118
- } catch (l) {
119
- u(l instanceof Error ? l : new Error(String(l)));
192
+ p(new Error(`unknown source: ${r}`));
193
+ } catch (f) {
194
+ p(f instanceof Error ? f : new Error(String(f)));
120
195
  }
121
196
  };
122
- function B(n, e, t) {
197
+ function j(t, e, r) {
123
198
  if (e === "" || e === void 0 || e === null)
124
199
  return "";
125
- const r = globalThis.$fa, o = globalThis.$fu, s = (t == null ? void 0 : t.precision) ?? 2, c = t == null ? void 0 : t.unit;
126
- if ((c === "currency" || c === "%") && o) {
127
- const i = {
128
- [n]: {
129
- unit: c === "currency" ? "currency" : "%",
200
+ const n = globalThis.$fa, o = globalThis.$fu, s = (r == null ? void 0 : r.precision) ?? 2, i = r == null ? void 0 : r.unit;
201
+ if ((i === "currency" || i === "%") && o) {
202
+ const l = {
203
+ [t]: {
204
+ unit: i === "currency" ? "currency" : "%",
130
205
  precision: s
131
206
  }
132
207
  };
133
208
  try {
134
209
  return o({
135
- prop: n,
136
- currency: t == null ? void 0 : t.currency,
210
+ prop: t,
211
+ currency: r == null ? void 0 : r.currency,
137
212
  value: e,
138
- obj: i
213
+ obj: l
139
214
  });
140
215
  } catch {
141
216
  }
142
217
  }
143
- if (r)
218
+ if (n)
144
219
  try {
145
- return r(e, s);
220
+ return n(e, s);
146
221
  } catch {
147
222
  return String(e);
148
223
  }
149
224
  return String(e);
150
225
  }
151
- function N(n, e, t = {}) {
152
- const { columns: r = [] } = n || {}, { resolveMetric: o } = t;
153
- return !r.length || !e || typeof e != "object" ? [] : r.map((s) => {
154
- const c = s.property ?? s.prop ?? "";
155
- if (!c)
226
+ function Z(t, e, r = {}) {
227
+ const { columns: n = [] } = t || {}, { resolveMetric: o } = r;
228
+ return !n.length || !e || typeof e != "object" ? [] : n.map((s) => {
229
+ const i = s.property ?? s.prop ?? "";
230
+ if (!i)
156
231
  return "";
157
- let i = e[c];
158
- if (i === void 0 && (i = ""), i === "")
232
+ let l = e[i];
233
+ if (l === void 0 && (l = ""), l === "")
159
234
  return "";
160
- const f = typeof o == "function" ? o(c) : void 0;
235
+ const a = typeof o == "function" ? o(i) : void 0;
161
236
  try {
162
- return B(c, i, f);
237
+ return j(i, l, a);
163
238
  } catch {
164
- return String(i);
239
+ return String(l);
165
240
  }
166
241
  });
167
242
  }
168
- const M = (n = {}) => {
169
- const e = (t, r) => {
170
- if (t)
171
- if (r && globalThis.$getType(r) === "Object") {
172
- let o = n[t] || t;
173
- return Object.keys(r).forEach((s) => {
174
- o[`{${s}}`] = r[s];
175
- }), o;
176
- } else
177
- return n[t] || t;
178
- else
179
- return t;
243
+ const T = "mvframe_primary", M = "mvframe_theme", m = { r: 255, g: 255, b: 255 }, H = { r: 0, g: 0, b: 0 }, W = [
244
+ "--el-color-primary-light-3",
245
+ "--el-color-primary-light-5",
246
+ "--el-color-primary-light-7",
247
+ "--el-color-primary-light-8",
248
+ "--el-color-primary-light-9",
249
+ "--el-color-primary-dark-2"
250
+ ];
251
+ function R(t) {
252
+ let e = String(t).trim().replace(/^#/, "");
253
+ if (e.length === 3 && (e = e.split("").map((n) => n + n).join("")), e.length >= 8 && (e = e.slice(0, 6)), e.length !== 6 || Number.isNaN(parseInt(e, 16)))
254
+ return null;
255
+ const r = parseInt(e, 16);
256
+ return {
257
+ r: r >> 16 & 255,
258
+ g: r >> 8 & 255,
259
+ b: r & 255
180
260
  };
181
- globalThis.$l = e, String.prototype.$l = e;
182
- }, V = (n) => {
183
- if (!n)
184
- return maps;
185
- const e = n.split(".");
186
- if (e.length > 1) {
187
- let t = maps;
188
- for (let r = 0; r < e.length; r++)
189
- t[e[r]] ? t = t[e[r]] : console.error(`No Map node at ${e[r]} in ${n}`);
190
- return t;
191
- } else
192
- return maps[n];
193
- };
261
+ }
262
+ function d(t, e, r) {
263
+ const n = (o) => Math.max(0, Math.min(255, Math.round(o)));
264
+ return `#${[n(t), n(e), n(r)].map((o) => o.toString(16).padStart(2, "0")).join("")}`;
265
+ }
266
+ function h(t, e, r) {
267
+ const n = r / 100, o = 1 - n;
268
+ return {
269
+ r: t.r * n + e.r * o,
270
+ g: t.g * n + e.g * o,
271
+ b: t.b * n + e.b * o
272
+ };
273
+ }
274
+ function V(t) {
275
+ const e = R(t);
276
+ if (!e)
277
+ return null;
278
+ const r = h(m, e, 30), n = h(m, e, 50), o = h(m, e, 70), s = h(m, e, 80), i = h(m, e, 90), l = h(H, e, 20);
279
+ return {
280
+ "--el-color-primary-light-3": d(r.r, r.g, r.b),
281
+ "--el-color-primary-light-5": d(n.r, n.g, n.b),
282
+ "--el-color-primary-light-7": d(o.r, o.g, o.b),
283
+ "--el-color-primary-light-8": d(s.r, s.g, s.b),
284
+ "--el-color-primary-light-9": d(i.r, i.g, i.b),
285
+ "--el-color-primary-dark-2": d(l.r, l.g, l.b)
286
+ };
287
+ }
288
+ function C(t) {
289
+ t.style.removeProperty("--el-color-primary");
290
+ for (const e of W)
291
+ t.style.removeProperty(e);
292
+ }
293
+ function N(t, e) {
294
+ const r = R(e.startsWith("#") ? e : `#${e}`);
295
+ if (!r)
296
+ return !1;
297
+ const n = d(r.r, r.g, r.b);
298
+ t.style.setProperty("--color-primary", n), t.style.setProperty("--el-color-primary", n);
299
+ const o = V(n);
300
+ return o && Object.entries(o).forEach(([s, i]) => t.style.setProperty(s, i)), !0;
301
+ }
302
+ function U(t = {}) {
303
+ const e = document.documentElement;
304
+ if (t.primary != null && t.primary !== "") {
305
+ const n = String(t.primary).trim();
306
+ N(e, n) || (e.style.setProperty("--color-primary", n), e.style.setProperty("--el-color-primary", n));
307
+ } else (t.primary === null || t.primary === "") && (e.style.removeProperty("--color-primary"), C(e));
308
+ const r = t.mode ?? (e.classList.contains("dark") ? "dark" : "light");
309
+ e.classList.toggle("dark", r === "dark");
310
+ }
311
+ function ee(t) {
312
+ t.primary !== void 0 && (t.primary == null || t.primary === "" ? localStorage.removeItem(T) : localStorage.setItem(T, String(t.primary))), t.mode !== void 0 && localStorage.setItem(M, t.mode);
313
+ }
314
+ function te() {
315
+ const t = localStorage.getItem(T), r = localStorage.getItem(M) === "dark" ? "dark" : "light";
316
+ U({
317
+ primary: t != null && t !== "" ? t : null,
318
+ mode: r
319
+ });
320
+ }
194
321
  export {
322
+ x as MVFRAME_STORAGE_LANG,
323
+ T as MVFRAME_STORAGE_PRIMARY,
324
+ M as MVFRAME_STORAGE_THEME,
325
+ U as applyMvframeTheme,
195
326
  _ as deepEqual,
196
- U as download,
197
- B as formatSummaryCell,
198
- C as isInView,
199
- O as sanitizeDownloadFileName,
200
- M as useLang,
201
- V as useMap,
202
- N as useRemoteSummary
327
+ Q as download,
328
+ j as formatSummaryCell,
329
+ X as isInView,
330
+ te as loadMvframeTheme,
331
+ ee as persistMvframeTheme,
332
+ A as sanitizeDownloadFileName,
333
+ K as useLang,
334
+ D as useMap,
335
+ J as useOptions,
336
+ Z as useRemoteSummary
203
337
  };