mvframe 1.0.67 → 1.0.69
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/README.cn.md +1 -1
- package/README.md +1 -1
- package/dist/composition.js +175 -175
- package/dist/vendor.js +1 -1
- package/package.json +1 -1
- package/scripts/build-host.js +0 -0
- package/scripts/scaffold-app.js +29 -12
package/README.cn.md
CHANGED
|
@@ -163,7 +163,7 @@ yarn build
|
|
|
163
163
|
|
|
164
164
|
## 命令行:项目目录雏形(推荐)
|
|
165
165
|
|
|
166
|
-
在**空目录或已有 Vite 工程根目录**执行,生成 `src/views`、`src/component`、`src/api`、`src/assets/img`、`src/assets/style`、`src/router`、`src/pinia/chip`、`src/config` 及示例 `main.js` / `App.vue`(已 `app.use(mvframe, …)` 挂好路由、Pinia `storeChips`、config),并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `dependencies` / `devDependencies`(与 Vite
|
|
166
|
+
在**空目录或已有 Vite 工程根目录**执行,生成 `src/views`、`src/component`、`src/api`、`src/assets/img`、`src/assets/style`、`src/router`、`src/pinia/chip`、`src/config` 及示例 `main.js` / `App.vue`(已 `app.use(mvframe, …)` 挂好路由、Pinia `storeChips`、config),并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `scripts` / `dependencies` / `devDependencies`(与 Vite 模板一致;**同名脚本和包保留你原有值**),并自动执行 **`yarn install`**,最后请执行 **`yarn dev`**;加 `--no-package-json` 可不改动 `package.json` 且跳过安装。
|
|
167
167
|
|
|
168
168
|
```bash
|
|
169
169
|
cd /path/to/your-app
|
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ Production uses **library mode** with entry `src/index.js` and obfuscation-relat
|
|
|
163
163
|
|
|
164
164
|
## CLI: project skeleton
|
|
165
165
|
|
|
166
|
-
From an **empty folder or existing Vite root**, generates `src/views`, `src/component`, `src/api`, `src/assets/img`, `src/assets/style`, `src/router`, `src/pinia/chip`, `src/config`, plus starter `main.js` / `App.vue` with `app.use(mvframe, …)` (routes, Pinia `storeChips`, config), and copies **`/.cursor/rules/*.mdc`** from the package (same as this repo’s Cursor rules). Adds `index.html` and `vite.config.js` only if missing (use `--force` to overwrite). **Merges** `dependencies` / `devDependencies` into `package.json` (existing
|
|
166
|
+
From an **empty folder or existing Vite root**, generates `src/views`, `src/component`, `src/api`, `src/assets/img`, `src/assets/style`, `src/router`, `src/pinia/chip`, `src/config`, plus starter `main.js` / `App.vue` with `app.use(mvframe, …)` (routes, Pinia `storeChips`, config), and copies **`/.cursor/rules/*.mdc`** from the package (same as this repo’s Cursor rules). Adds `index.html` and `vite.config.js` only if missing (use `--force` to overwrite). **Merges** `scripts` / `dependencies` / `devDependencies` into `package.json` (existing values win for shared keys), then runs **`yarn install`**; use `--no-package-json` to skip package changes and install. Then run **`yarn dev`**.
|
|
167
167
|
|
|
168
168
|
```bash
|
|
169
169
|
cd /path/to/your-app
|
package/dist/composition.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { M as B, g as U, s as V } from "./vendor.js";
|
|
2
|
-
import { a as Se, m as $e, b as Pe, c as
|
|
3
|
-
import
|
|
2
|
+
import { a as Se, m as $e, b as Pe, c as Le, p as Me, u as Ae } from "./vendor.js";
|
|
3
|
+
import k from "axios";
|
|
4
4
|
const W = "lang", fe = (e, t) => {
|
|
5
|
-
var i,
|
|
6
|
-
const
|
|
5
|
+
var i, a;
|
|
6
|
+
const r = typeof window < "u", n = () => {
|
|
7
7
|
var m;
|
|
8
|
-
if (!
|
|
8
|
+
if (!r)
|
|
9
9
|
return { innerWidth: 1920, innerHeight: 1080 };
|
|
10
|
-
const s = window,
|
|
10
|
+
const s = window, l = typeof navigator < "u" ? s.navigator : {}, u = s.screen || {}, f = s.visualViewport, c = {
|
|
11
11
|
innerWidth: s.innerWidth,
|
|
12
12
|
innerHeight: s.innerHeight,
|
|
13
13
|
outerWidth: s.outerWidth,
|
|
@@ -23,102 +23,102 @@ const W = "lang", fe = (e, t) => {
|
|
|
23
23
|
pageWidth: s.innerWidth
|
|
24
24
|
};
|
|
25
25
|
f && (c.visualViewportWidth = f.width, c.visualViewportHeight = f.height, c.visualViewportScale = f.scale);
|
|
26
|
-
const g =
|
|
26
|
+
const g = l.userAgent || "";
|
|
27
27
|
return c.env = {
|
|
28
28
|
userAgent: g,
|
|
29
|
-
language:
|
|
30
|
-
languages:
|
|
31
|
-
platform:
|
|
32
|
-
cookieEnabled: !!
|
|
33
|
-
onLine:
|
|
34
|
-
maxTouchPoints:
|
|
35
|
-
isTouch: "ontouchstart" in s || (
|
|
29
|
+
language: l.language || "",
|
|
30
|
+
languages: l.languages ? [...l.languages] : [],
|
|
31
|
+
platform: l.platform || "",
|
|
32
|
+
cookieEnabled: !!l.cookieEnabled,
|
|
33
|
+
onLine: l.onLine !== !1,
|
|
34
|
+
maxTouchPoints: l.maxTouchPoints || 0,
|
|
35
|
+
isTouch: "ontouchstart" in s || (l.maxTouchPoints || 0) > 0,
|
|
36
36
|
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(
|
|
37
37
|
g
|
|
38
38
|
)
|
|
39
39
|
}, console.info(c), c;
|
|
40
40
|
}, o = () => {
|
|
41
|
-
var
|
|
42
|
-
const s =
|
|
41
|
+
var l;
|
|
42
|
+
const s = n();
|
|
43
43
|
globalThis.$config = globalThis.$config || {}, globalThis.$config.options = {
|
|
44
44
|
...globalThis.$config.options || {},
|
|
45
45
|
...s
|
|
46
|
-
}, (
|
|
46
|
+
}, (l = e == null ? void 0 : e.config) != null && l.globalProperties && (e.config.globalProperties.$config = globalThis.$config);
|
|
47
47
|
};
|
|
48
|
-
o(),
|
|
48
|
+
o(), r && (window.addEventListener("resize", o, { passive: !0 }), (a = (i = window.visualViewport) == null ? void 0 : i.addEventListener) == null || a.call(i, "resize", o, {
|
|
49
49
|
passive: !0
|
|
50
50
|
}));
|
|
51
51
|
}, ge = (e, t) => {
|
|
52
|
-
var
|
|
53
|
-
const
|
|
54
|
-
globalThis.$config = globalThis.$config || {}, globalThis.$config.langUse =
|
|
52
|
+
var l, u, f;
|
|
53
|
+
const r = t || {}, n = Array.isArray(r.use) && r.use.length > 0 ? r.use : B;
|
|
54
|
+
globalThis.$config = globalThis.$config || {}, globalThis.$config.langUse = n.filter(
|
|
55
55
|
(c) => c && c.use !== !1 && c.value
|
|
56
|
-
), (
|
|
57
|
-
const i = (typeof localStorage < "u" ? localStorage.getItem(W) : null) || ((u = globalThis.$config) == null ? void 0 : u.lang) || "en_us",
|
|
56
|
+
), (l = e == null ? void 0 : e.config) != null && l.globalProperties && (e.config.globalProperties.$config = globalThis.$config);
|
|
57
|
+
const i = (typeof localStorage < "u" ? localStorage.getItem(W) : null) || ((u = globalThis.$config) == null ? void 0 : u.lang) || "en_us", a = Object.assign(
|
|
58
58
|
{},
|
|
59
59
|
U(i),
|
|
60
60
|
((f = globalThis.$config) == null ? void 0 : f.langMaps) || {},
|
|
61
|
-
|
|
61
|
+
r.langMaps || {}
|
|
62
62
|
), s = (c, g) => {
|
|
63
63
|
if (c)
|
|
64
64
|
if (g && globalThis.$getType(g) === "Object") {
|
|
65
|
-
let m =
|
|
65
|
+
let m = a[c] || c;
|
|
66
66
|
return Object.keys(g).forEach((p) => {
|
|
67
67
|
m[`{${p}}`] = g[p];
|
|
68
68
|
}), m;
|
|
69
69
|
} else
|
|
70
|
-
return
|
|
70
|
+
return a[c] || c;
|
|
71
71
|
else
|
|
72
72
|
return c ?? "";
|
|
73
73
|
};
|
|
74
74
|
globalThis.$patchLangMaps = (c) => {
|
|
75
|
-
c && globalThis.$getType(c) === "Object" && Object.assign(
|
|
75
|
+
c && globalThis.$getType(c) === "Object" && Object.assign(a, c);
|
|
76
76
|
}, globalThis.$l = s, e.config.globalProperties.$l = s, e.config.globalProperties.$patchLangMaps = globalThis.$patchLangMaps, String.prototype.$l = function() {
|
|
77
77
|
return $l(this);
|
|
78
78
|
};
|
|
79
79
|
}, he = (e, t) => {
|
|
80
80
|
if (!e || !t) return !1;
|
|
81
|
-
const
|
|
81
|
+
const r = e.getBoundingClientRect(), n = t.getBoundingClientRect(), o = n.right > r.left && n.left < r.right, i = n.bottom > r.top && n.top < r.bottom;
|
|
82
82
|
return o && i;
|
|
83
83
|
}, N = (e, t) => {
|
|
84
84
|
if (e === t) return !0;
|
|
85
85
|
if (e == null || t == null || typeof e != "object" || typeof t != "object")
|
|
86
86
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
for (const o of
|
|
90
|
-
if (!
|
|
87
|
+
const r = Object.keys(e), n = Object.keys(t);
|
|
88
|
+
if (r.length !== n.length) return !1;
|
|
89
|
+
for (const o of r)
|
|
90
|
+
if (!n.includes(o) || !N(e[o], t[o])) return !1;
|
|
91
91
|
return !0;
|
|
92
92
|
}, x = "download", q = 150, F = (e, t = x) => {
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
95
|
-
const i =
|
|
96
|
-
return i.length >
|
|
93
|
+
const r = t || x, n = String(e ?? "").trim();
|
|
94
|
+
if (!n) return r;
|
|
95
|
+
const i = n.replace(/[/\\?%*:|"<>]/g, "_").replace(/\.\./g, "_").split(/[/\\]/).pop() || r, a = 200;
|
|
96
|
+
return i.length > a ? i.slice(0, a) : i;
|
|
97
97
|
}, D = (e) => {
|
|
98
98
|
const t = ((e == null ? void 0 : e.type) || "").toLowerCase();
|
|
99
99
|
return t ? t.includes("spreadsheet") || t.includes("ms-excel") || t.includes("excel") && t.includes("application") : !1;
|
|
100
100
|
}, $ = (e, t) => {
|
|
101
|
-
const
|
|
102
|
-
o.href =
|
|
101
|
+
const r = URL.createObjectURL(e), n = F(t), o = document.createElement("a");
|
|
102
|
+
o.href = r, o.download = n, o.style.display = "none", document.body.appendChild(o);
|
|
103
103
|
try {
|
|
104
104
|
o.click();
|
|
105
105
|
} finally {
|
|
106
|
-
document.body.removeChild(o), setTimeout(() => URL.revokeObjectURL(
|
|
106
|
+
document.body.removeChild(o), setTimeout(() => URL.revokeObjectURL(r), q);
|
|
107
107
|
}
|
|
108
108
|
}, z = (e) => {
|
|
109
109
|
if (!e || e.source !== void 0 || e.type === void 0)
|
|
110
110
|
return e;
|
|
111
|
-
const { type: t, data:
|
|
111
|
+
const { type: t, data: r, url: n, headers: o, name: i, filename: a, init: s, ...l } = e, u = a ?? i;
|
|
112
112
|
return t === "csv" ? {
|
|
113
|
-
...
|
|
113
|
+
...l,
|
|
114
114
|
source: "inline",
|
|
115
|
-
content:
|
|
115
|
+
content: r,
|
|
116
116
|
filename: u,
|
|
117
117
|
bom: e.bom
|
|
118
118
|
} : t === "excel" ? {
|
|
119
|
-
...
|
|
119
|
+
...l,
|
|
120
120
|
source: "fetch",
|
|
121
|
-
url:
|
|
121
|
+
url: n,
|
|
122
122
|
init: { ...s || {}, headers: o ?? (s == null ? void 0 : s.headers) },
|
|
123
123
|
response: "blob",
|
|
124
124
|
expectExcel: !0,
|
|
@@ -126,13 +126,13 @@ const W = "lang", fe = (e, t) => {
|
|
|
126
126
|
} : e;
|
|
127
127
|
}, me = async (e = {}) => {
|
|
128
128
|
const t = z(e), {
|
|
129
|
-
source:
|
|
130
|
-
content:
|
|
129
|
+
source: r = "inline",
|
|
130
|
+
content: n,
|
|
131
131
|
blob: o,
|
|
132
132
|
bom: i = !0,
|
|
133
|
-
mime:
|
|
133
|
+
mime: a,
|
|
134
134
|
url: s,
|
|
135
|
-
init:
|
|
135
|
+
init: l,
|
|
136
136
|
response: u = "blob",
|
|
137
137
|
openIn: f = "self",
|
|
138
138
|
expectExcel: c,
|
|
@@ -141,37 +141,37 @@ const W = "lang", fe = (e, t) => {
|
|
|
141
141
|
error: p = () => {
|
|
142
142
|
},
|
|
143
143
|
// 避免 legacy 字段渗入后续逻辑
|
|
144
|
-
type:
|
|
145
|
-
data:
|
|
144
|
+
type: ae,
|
|
145
|
+
data: le,
|
|
146
146
|
headers: ce,
|
|
147
147
|
...ue
|
|
148
148
|
} = t, v = g ?? m;
|
|
149
149
|
try {
|
|
150
|
-
if (
|
|
150
|
+
if (r === "inline") {
|
|
151
151
|
if (o instanceof Blob) {
|
|
152
152
|
$(o, v);
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
155
|
+
if (n == null) {
|
|
156
156
|
p(new Error("content or blob is required for inline"));
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
const d = typeof
|
|
159
|
+
const d = typeof n == "string" ? n : String(n), R = i ? "\uFEFF" + d : d, S = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
|
|
160
160
|
$(new Blob([R], { type: S }), v);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
if (
|
|
163
|
+
if (r === "fetch") {
|
|
164
164
|
if (!s) {
|
|
165
165
|
p(new Error("url is required for fetch"));
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
const d = await fetch(s,
|
|
168
|
+
const d = await fetch(s, l);
|
|
169
169
|
if (!d.ok) {
|
|
170
170
|
p(new Error(`fetch failed: ${d.status}`));
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
if (u === "text") {
|
|
174
|
-
const S = await d.text(), H = i ? "\uFEFF" + S : S, j =
|
|
174
|
+
const S = await d.text(), H = i ? "\uFEFF" + S : S, j = a || (i ? "text/csv;charset=utf-8" : "text/plain;charset=utf-8");
|
|
175
175
|
$(new Blob([H], { type: j }), v);
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
@@ -183,7 +183,7 @@ const W = "lang", fe = (e, t) => {
|
|
|
183
183
|
$(R, v);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
if (
|
|
186
|
+
if (r === "open") {
|
|
187
187
|
if (!s) {
|
|
188
188
|
p(new Error("url is required for open"));
|
|
189
189
|
return;
|
|
@@ -191,58 +191,58 @@ const W = "lang", fe = (e, t) => {
|
|
|
191
191
|
f === "blank" ? window.open(s, "_blank", "noopener,noreferrer") : window.location.href = s;
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
|
-
p(new Error(`unknown source: ${
|
|
194
|
+
p(new Error(`unknown source: ${r}`));
|
|
195
195
|
} catch (d) {
|
|
196
196
|
p(d instanceof Error ? d : new Error(String(d)));
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
function G(e, t,
|
|
199
|
+
function G(e, t, r) {
|
|
200
200
|
if (t === "" || t === void 0 || t === null)
|
|
201
201
|
return "";
|
|
202
|
-
const
|
|
203
|
-
if ((
|
|
202
|
+
const n = globalThis.$fa, o = globalThis.$fu, i = (r == null ? void 0 : r.precision) ?? 2, a = r == null ? void 0 : r.unit;
|
|
203
|
+
if ((a === "currency" || a === "%") && o) {
|
|
204
204
|
const s = {
|
|
205
205
|
[e]: {
|
|
206
|
-
unit:
|
|
206
|
+
unit: a === "currency" ? "currency" : "%",
|
|
207
207
|
precision: i
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
try {
|
|
211
211
|
return o({
|
|
212
212
|
prop: e,
|
|
213
|
-
currency:
|
|
213
|
+
currency: r == null ? void 0 : r.currency,
|
|
214
214
|
value: t,
|
|
215
215
|
obj: s
|
|
216
216
|
});
|
|
217
217
|
} catch {
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
if (
|
|
220
|
+
if (n)
|
|
221
221
|
try {
|
|
222
|
-
return
|
|
222
|
+
return n(t, i);
|
|
223
223
|
} catch {
|
|
224
224
|
return String(t);
|
|
225
225
|
}
|
|
226
226
|
return String(t);
|
|
227
227
|
}
|
|
228
|
-
function ye(e, t,
|
|
229
|
-
const { columns:
|
|
230
|
-
return !
|
|
231
|
-
const
|
|
232
|
-
if (!
|
|
228
|
+
function ye(e, t, r = {}) {
|
|
229
|
+
const { columns: n = [] } = e || {}, { resolveMetric: o } = r;
|
|
230
|
+
return !n.length || !t || typeof t != "object" ? [] : n.map((i) => {
|
|
231
|
+
const a = i.property ?? i.prop ?? "";
|
|
232
|
+
if (!a)
|
|
233
233
|
return "";
|
|
234
|
-
let s = t[
|
|
234
|
+
let s = t[a];
|
|
235
235
|
if (s === void 0 && (s = ""), s === "")
|
|
236
236
|
return "";
|
|
237
|
-
const
|
|
237
|
+
const l = typeof o == "function" ? o(a) : void 0;
|
|
238
238
|
try {
|
|
239
|
-
return G(
|
|
239
|
+
return G(a, s, l);
|
|
240
240
|
} catch {
|
|
241
241
|
return String(s);
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const L = "mvframe_primary", I = "mvframe_theme", w = { r: 255, g: 255, b: 255 }, Y = { r: 0, g: 0, b: 0 }, J = [
|
|
246
246
|
"--el-color-primary-light-3",
|
|
247
247
|
"--el-color-primary-light-5",
|
|
248
248
|
"--el-color-primary-light-7",
|
|
@@ -252,45 +252,45 @@ const M = "mvframe_primary", I = "mvframe_theme", T = { r: 255, g: 255, b: 255 }
|
|
|
252
252
|
];
|
|
253
253
|
function A(e) {
|
|
254
254
|
let t = String(e).trim().replace(/^#/, "");
|
|
255
|
-
if (t.length === 3 && (t = t.split("").map((
|
|
255
|
+
if (t.length === 3 && (t = t.split("").map((n) => n + n).join("")), t.length >= 8 && (t = t.slice(0, 6)), t.length !== 6 || Number.isNaN(parseInt(t, 16)))
|
|
256
256
|
return null;
|
|
257
|
-
const
|
|
257
|
+
const r = parseInt(t, 16);
|
|
258
258
|
return {
|
|
259
|
-
r:
|
|
260
|
-
g:
|
|
261
|
-
b:
|
|
259
|
+
r: r >> 16 & 255,
|
|
260
|
+
g: r >> 8 & 255,
|
|
261
|
+
b: r & 255
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
function y(e, t,
|
|
265
|
-
const
|
|
266
|
-
return `#${[
|
|
264
|
+
function y(e, t, r) {
|
|
265
|
+
const n = (o) => Math.max(0, Math.min(255, Math.round(o)));
|
|
266
|
+
return `#${[n(e), n(t), n(r)].map((o) => o.toString(16).padStart(2, "0")).join("")}`;
|
|
267
267
|
}
|
|
268
268
|
function K(e) {
|
|
269
|
-
const t = [e.r, e.g, e.b].map((
|
|
269
|
+
const t = [e.r, e.g, e.b].map((r) => (r /= 255, r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4));
|
|
270
270
|
return 0.2126 * t[0] + 0.7152 * t[1] + 0.0722 * t[2];
|
|
271
271
|
}
|
|
272
272
|
function O(e) {
|
|
273
273
|
return K(e) > 0.5 ? "#1a1a1a" : "#ffffff";
|
|
274
274
|
}
|
|
275
|
-
function b(e, t,
|
|
276
|
-
const
|
|
275
|
+
function b(e, t, r) {
|
|
276
|
+
const n = r / 100, o = 1 - n;
|
|
277
277
|
return {
|
|
278
|
-
r: e.r *
|
|
279
|
-
g: e.g *
|
|
280
|
-
b: e.b *
|
|
278
|
+
r: e.r * n + t.r * o,
|
|
279
|
+
g: e.g * n + t.g * o,
|
|
280
|
+
b: e.b * n + t.b * o
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
function X(e) {
|
|
284
284
|
const t = A(e);
|
|
285
285
|
if (!t)
|
|
286
286
|
return null;
|
|
287
|
-
const
|
|
287
|
+
const r = b(w, t, 30), n = b(w, t, 50), o = b(w, t, 70), i = b(w, t, 80), a = b(w, t, 90), s = b(Y, t, 20);
|
|
288
288
|
return {
|
|
289
|
-
"--el-color-primary-light-3": y(
|
|
290
|
-
"--el-color-primary-light-5": y(
|
|
289
|
+
"--el-color-primary-light-3": y(r.r, r.g, r.b),
|
|
290
|
+
"--el-color-primary-light-5": y(n.r, n.g, n.b),
|
|
291
291
|
"--el-color-primary-light-7": y(o.r, o.g, o.b),
|
|
292
292
|
"--el-color-primary-light-8": y(i.r, i.g, i.b),
|
|
293
|
-
"--el-color-primary-light-9": y(
|
|
293
|
+
"--el-color-primary-light-9": y(a.r, a.g, a.b),
|
|
294
294
|
"--el-color-primary-dark-2": y(s.r, s.g, s.b)
|
|
295
295
|
};
|
|
296
296
|
}
|
|
@@ -300,80 +300,80 @@ function Q(e) {
|
|
|
300
300
|
e.style.removeProperty(t);
|
|
301
301
|
}
|
|
302
302
|
function Z(e, t) {
|
|
303
|
-
const
|
|
304
|
-
if (!
|
|
303
|
+
const r = A(t.startsWith("#") ? t : `#${t}`);
|
|
304
|
+
if (!r)
|
|
305
305
|
return !1;
|
|
306
|
-
const
|
|
307
|
-
e.style.setProperty("--color-primary",
|
|
308
|
-
const o = X(
|
|
309
|
-
return o && Object.entries(o).forEach(([i,
|
|
306
|
+
const n = y(r.r, r.g, r.b);
|
|
307
|
+
e.style.setProperty("--color-primary", n), e.style.setProperty("--el-color-primary", n), e.style.setProperty("--color-on-primary-text", O(r));
|
|
308
|
+
const o = X(n);
|
|
309
|
+
return o && Object.entries(o).forEach(([i, a]) => e.style.setProperty(i, a)), !0;
|
|
310
310
|
}
|
|
311
311
|
function ee(e = {}) {
|
|
312
312
|
const t = document.documentElement;
|
|
313
313
|
if (e.primary != null && e.primary !== "") {
|
|
314
|
-
const
|
|
315
|
-
if (!Z(t,
|
|
316
|
-
t.style.setProperty("--color-primary",
|
|
317
|
-
const o = A(
|
|
314
|
+
const n = String(e.primary).trim();
|
|
315
|
+
if (!Z(t, n)) {
|
|
316
|
+
t.style.setProperty("--color-primary", n), t.style.setProperty("--el-color-primary", n);
|
|
317
|
+
const o = A(n.startsWith("#") ? n : `#${n}`);
|
|
318
318
|
o && t.style.setProperty("--color-on-primary-text", O(o));
|
|
319
319
|
}
|
|
320
320
|
} else (e.primary === null || e.primary === "") && (t.style.removeProperty("--color-primary"), Q(t));
|
|
321
|
-
const
|
|
322
|
-
t.classList.toggle("dark",
|
|
321
|
+
const r = e.mode ?? (t.classList.contains("dark") ? "dark" : "light");
|
|
322
|
+
t.classList.toggle("dark", r === "dark");
|
|
323
323
|
}
|
|
324
324
|
function be(e) {
|
|
325
|
-
e.primary !== void 0 && (e.primary == null || e.primary === "" ? localStorage.removeItem(
|
|
325
|
+
e.primary !== void 0 && (e.primary == null || e.primary === "" ? localStorage.removeItem(L) : localStorage.setItem(L, String(e.primary))), e.mode !== void 0 && localStorage.setItem(I, e.mode);
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
const e = localStorage.getItem(
|
|
327
|
+
function _e() {
|
|
328
|
+
const e = localStorage.getItem(L), r = localStorage.getItem(I) === "dark" ? "dark" : "light";
|
|
329
329
|
ee({
|
|
330
330
|
primary: e != null && e !== "" ? e : null,
|
|
331
|
-
mode:
|
|
331
|
+
mode: r
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
334
|
const te = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
335
|
-
let
|
|
336
|
-
function
|
|
335
|
+
let T = null;
|
|
336
|
+
function C(e) {
|
|
337
337
|
V("error", e);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
|
|
339
|
+
function Ee(e) {
|
|
340
|
+
T = e && typeof e == "object" ? e : null;
|
|
341
341
|
}
|
|
342
342
|
function P(e) {
|
|
343
|
-
if (
|
|
344
|
-
return String(
|
|
343
|
+
if (T && T[e] != null && T[e] !== "")
|
|
344
|
+
return String(T[e]);
|
|
345
345
|
const t = typeof globalThis < "u" ? globalThis.__MVFRAME_ENV__ : null;
|
|
346
346
|
if (t && t[e] != null && t[e] !== "")
|
|
347
347
|
return String(t[e]);
|
|
348
|
-
const
|
|
349
|
-
return
|
|
348
|
+
const r = typeof import.meta < "u" ? te : null;
|
|
349
|
+
return r && r[e] != null && r[e] !== "" ? String(r[e]) : "";
|
|
350
350
|
}
|
|
351
|
-
const
|
|
351
|
+
const E = k.create({
|
|
352
352
|
timeout: 0,
|
|
353
353
|
withCredentials: !1
|
|
354
354
|
});
|
|
355
355
|
let h = [];
|
|
356
|
-
const
|
|
357
|
-
const t = e.url + "_" + e.headers["Content-HI"] + "_" + e.ex,
|
|
356
|
+
const re = k.CancelToken, ne = (e) => {
|
|
357
|
+
const t = e.url + "_" + e.headers["Content-HI"] + "_" + e.ex, r = [];
|
|
358
358
|
if (h.length)
|
|
359
|
-
for (let
|
|
360
|
-
h[
|
|
361
|
-
|
|
362
|
-
},
|
|
359
|
+
for (let n in h)
|
|
360
|
+
h[n].v === t && r.push(n);
|
|
361
|
+
r.length > 0 && (h[r[0]].cb(), h.splice(r[0], 1));
|
|
362
|
+
}, _ = (e) => {
|
|
363
363
|
if (e != null && e.url) {
|
|
364
364
|
const t = e.url + "_" + e.headers["Content-HI"] + "_" + e.ex;
|
|
365
|
-
for (let
|
|
366
|
-
if (h[
|
|
367
|
-
h.splice(
|
|
365
|
+
for (let r in h)
|
|
366
|
+
if (h[r].v === t) {
|
|
367
|
+
h.splice(r, 1);
|
|
368
368
|
break;
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
|
-
|
|
372
|
+
E.interceptors.request.use(
|
|
373
373
|
(e) => {
|
|
374
374
|
e.headers = e.headers || {};
|
|
375
|
-
const { login: t, accountInfo:
|
|
376
|
-
return
|
|
375
|
+
const { login: t, accountInfo: r = {} } = window.$store.launch(), { access_token: n } = t.info;
|
|
376
|
+
return n && e.headers["Content-HI"] && (e.headers.Authorization = `Bearer ${n}`), r.partner_org_id && (e.data ? e.method.toLowerCase() === "get" ? e.params.partner_org_id = r.partner_org_id : e.data.partner_org_id = r.partner_org_id : e.method.toLowerCase() === "get" ? e.params = { partner_org_id: r.partner_org_id } : e.data = { partner_org_id: r.partner_org_id }), ne(e), e.cancelToken = new re((o) => {
|
|
377
377
|
h.push({
|
|
378
378
|
v: e.url + "_" + e.headers["Content-HI"] + "_" + e.ex,
|
|
379
379
|
cb: o
|
|
@@ -382,30 +382,30 @@ _.interceptors.request.use(
|
|
|
382
382
|
},
|
|
383
383
|
(e) => Promise.reject(e)
|
|
384
384
|
);
|
|
385
|
-
|
|
385
|
+
E.interceptors.response.use(
|
|
386
386
|
({ data: e, config: t }) => {
|
|
387
387
|
var i;
|
|
388
388
|
if (e == null || typeof e != "object" || Array.isArray(e))
|
|
389
|
-
return
|
|
390
|
-
let { code:
|
|
391
|
-
if (o = o ||
|
|
392
|
-
|
|
393
|
-
else if (
|
|
389
|
+
return _(t), e;
|
|
390
|
+
let { code: r, message: n, msg: o } = e;
|
|
391
|
+
if (o = o || n, r === 200)
|
|
392
|
+
_(t);
|
|
393
|
+
else if (r === 500) {
|
|
394
394
|
if (t.showMsg !== !1) {
|
|
395
|
-
const
|
|
396
|
-
|
|
395
|
+
const a = (i = t == null ? void 0 : t.headers) != null && i.CONTACT_CUSTOMER_SERVICE ? window.$l("CONTACT_CUSTOMER_SERVICE") : "";
|
|
396
|
+
C({
|
|
397
397
|
grouping: !0,
|
|
398
398
|
showClose: !0,
|
|
399
399
|
duration: 0,
|
|
400
|
-
message: [o,
|
|
400
|
+
message: [o, a].filter(Boolean).join(" ")
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
|
|
404
|
-
} else
|
|
403
|
+
_(t);
|
|
404
|
+
} else r === 403 && window.location.replace("/"), _(t);
|
|
405
405
|
return e;
|
|
406
406
|
},
|
|
407
407
|
(e) => {
|
|
408
|
-
var
|
|
408
|
+
var r, n, o, i, a;
|
|
409
409
|
let t = !1;
|
|
410
410
|
if (e && e.response)
|
|
411
411
|
switch (e.response.status) {
|
|
@@ -425,86 +425,86 @@ _.interceptors.response.use(
|
|
|
425
425
|
e.message = `Connection Error-${e.response.status}`;
|
|
426
426
|
}
|
|
427
427
|
else
|
|
428
|
-
(
|
|
429
|
-
return t || ((
|
|
428
|
+
(r = e.stack) != null && r.includes("timeout") ? e.message = window.$l("Timeout, Please Refresh") : (e.message = window.$l("Connect Failed"), t = !0);
|
|
429
|
+
return t || ((n = e == null ? void 0 : e.response) == null ? void 0 : n.status) !== 403 && C({
|
|
430
430
|
grouping: !0,
|
|
431
431
|
message: `${e.message} ${(i = (o = e.config) == null ? void 0 : o.headers) == null ? void 0 : i["Content-HI"]}`
|
|
432
|
-
}),
|
|
433
|
-
code: (
|
|
432
|
+
}), _(e.config), e.code === "ERR_CANCELED" ? Promise.resolve({ code: e.code, msg: e.message }) : Promise.resolve({
|
|
433
|
+
code: (a = e.response) == null ? void 0 : a.status,
|
|
434
434
|
msg: e.message
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
437
|
);
|
|
438
438
|
function oe(e) {
|
|
439
|
-
return e.baseURL = P("VITE_APP_BASEURL"), e.method = "get", e.headers = { "Content-Type": "application/x-www-form-urlencoded" }, e.data && (e.params = e.data),
|
|
439
|
+
return e.baseURL = P("VITE_APP_BASEURL"), e.method = "get", e.headers = { "Content-Type": "application/x-www-form-urlencoded" }, e.data && (e.params = e.data), E(e);
|
|
440
440
|
}
|
|
441
441
|
function se(e) {
|
|
442
442
|
return e.baseURL = P("VITE_APP_BASEURL"), e.method = "get", e.headers = {
|
|
443
443
|
...e.headers,
|
|
444
444
|
"Content-HI": e.url
|
|
445
|
-
}, e.url = e.ver ? `api/${e.ver}/ads` : "api/v3/ads", e.data && (e.params = e.data),
|
|
445
|
+
}, e.url = e.ver ? `api/${e.ver}/ads` : "api/v3/ads", e.data && (e.params = e.data), E(e);
|
|
446
446
|
}
|
|
447
447
|
function ie(e) {
|
|
448
448
|
if (e.baseURL = P("VITE_APP_BASEURL"), e.method = "post", e.headers = {
|
|
449
449
|
...e.headers,
|
|
450
450
|
"Content-HI": e.url
|
|
451
451
|
}, e.data && window.$getType(e.data) === "Object") {
|
|
452
|
-
const
|
|
453
|
-
Object.keys(e.data).forEach((
|
|
454
|
-
const o = e.data[
|
|
455
|
-
[null, "", void 0].includes(o) || (n
|
|
456
|
-
}), e.data =
|
|
452
|
+
const r = {};
|
|
453
|
+
Object.keys(e.data).forEach((n) => {
|
|
454
|
+
const o = e.data[n];
|
|
455
|
+
[null, "", void 0].includes(o) || (r[n] = o);
|
|
456
|
+
}), e.data = r;
|
|
457
457
|
}
|
|
458
|
-
return e.url = e.ver ? `api/${e.ver}/ads` : "api/
|
|
458
|
+
return e.url = e.ver ? `api/${e.ver}/ads` : "api/v3/ads", E(e);
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function M({
|
|
461
461
|
data: e,
|
|
462
462
|
url: t,
|
|
463
|
-
ex:
|
|
464
|
-
method:
|
|
463
|
+
ex: r,
|
|
464
|
+
method: n = "post",
|
|
465
465
|
emptyString: o = !1
|
|
466
466
|
}) {
|
|
467
|
-
const i = {},
|
|
468
|
-
o === !1 &&
|
|
467
|
+
const i = {}, a = [void 0, null];
|
|
468
|
+
o === !1 && a.push("");
|
|
469
469
|
for (let u in e)
|
|
470
|
-
|
|
471
|
-
const { login: s } = window.$store.launch(), { access_token:
|
|
472
|
-
return
|
|
470
|
+
a.indexOf(e[u]) === -1 && (i[u] = e[u]);
|
|
471
|
+
const { login: s } = window.$store.launch(), { access_token: l } = s.info || {};
|
|
472
|
+
return E({
|
|
473
473
|
headers: {
|
|
474
474
|
"Content-Type": "application/json",
|
|
475
|
-
token:
|
|
475
|
+
token: l != null ? String(l) : ""
|
|
476
476
|
},
|
|
477
477
|
baseURL: P("VITE_APP_AIURL"),
|
|
478
478
|
url: t,
|
|
479
|
-
method:
|
|
479
|
+
method: n,
|
|
480
480
|
data: i,
|
|
481
|
-
ex:
|
|
481
|
+
ex: r
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
|
-
const
|
|
485
|
-
function
|
|
486
|
-
globalThis.$login = oe, globalThis.$get = se, globalThis.$post = ie, globalThis.$form =
|
|
484
|
+
const we = M;
|
|
485
|
+
function Te(e) {
|
|
486
|
+
globalThis.$login = oe, globalThis.$get = se, globalThis.$post = ie, globalThis.$form = M, globalThis.$xform = M;
|
|
487
487
|
}
|
|
488
488
|
export {
|
|
489
489
|
W as MVFRAME_STORAGE_LANG,
|
|
490
|
-
|
|
490
|
+
L as MVFRAME_STORAGE_PRIMARY,
|
|
491
491
|
I as MVFRAME_STORAGE_THEME,
|
|
492
492
|
ee as applyMvframeTheme,
|
|
493
493
|
N as deepEqual,
|
|
494
494
|
me as download,
|
|
495
495
|
G as formatSummaryCell,
|
|
496
496
|
Se as getMaps,
|
|
497
|
-
|
|
497
|
+
Te as installRq,
|
|
498
498
|
he as isInView,
|
|
499
|
-
|
|
499
|
+
_e as loadMvframeTheme,
|
|
500
500
|
$e as mapLang,
|
|
501
501
|
Pe as mapLangPath,
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
Le as mergeMaps,
|
|
503
|
+
Me as patchMaps,
|
|
504
504
|
be as persistMvframeTheme,
|
|
505
505
|
F as sanitizeDownloadFileName,
|
|
506
|
-
|
|
507
|
-
|
|
506
|
+
Ee as setMvframeRqEnv,
|
|
507
|
+
M as useForm,
|
|
508
508
|
se as useGet,
|
|
509
509
|
ge as useLang,
|
|
510
510
|
oe as useLogin,
|
|
@@ -512,5 +512,5 @@ export {
|
|
|
512
512
|
fe as useOptions,
|
|
513
513
|
ie as usePost,
|
|
514
514
|
ye as useRemoteSummary,
|
|
515
|
-
|
|
515
|
+
we as useXform
|
|
516
516
|
};
|
package/dist/vendor.js
CHANGED
|
@@ -9320,7 +9320,7 @@ const gi = {
|
|
|
9320
9320
|
}, Ai = {
|
|
9321
9321
|
name: "Matt Avias Frame",
|
|
9322
9322
|
copyright: "©2026",
|
|
9323
|
-
version: "1.0.
|
|
9323
|
+
version: "1.0.69",
|
|
9324
9324
|
author: "Matt Avias",
|
|
9325
9325
|
date: "2026-02-26",
|
|
9326
9326
|
/** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
|
package/package.json
CHANGED
package/scripts/build-host.js
CHANGED
|
File without changes
|
package/scripts/scaffold-app.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const path = require("path");
|
|
16
|
+
const { execFileSync } = require("child_process");
|
|
16
17
|
|
|
17
18
|
const FORCE = process.argv.includes("--force");
|
|
18
19
|
const NO_PKG = process.argv.includes("--no-package-json");
|
|
@@ -75,9 +76,16 @@ const SCAFFOLD_DEV_DEPENDENCIES = {
|
|
|
75
76
|
"unplugin-auto-import": "^0.18.2",
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
const SCAFFOLD_SCRIPTS = {
|
|
80
|
+
dev: "vite",
|
|
81
|
+
build: "vite build",
|
|
82
|
+
preview: "vite preview",
|
|
83
|
+
};
|
|
84
|
+
|
|
78
85
|
/**
|
|
79
|
-
* 合并 package.json
|
|
86
|
+
* 合并 package.json:保留原有字段与其它依赖;仅补足脚手架所需包与启动脚本。
|
|
80
87
|
* 同名依赖以目标项目已有版本为准({ ...建议, ...已有 })。
|
|
88
|
+
* 同名 scripts 也以目标项目已有命令为准,避免覆盖自定义 dev/build。
|
|
81
89
|
*/
|
|
82
90
|
function mergePackageJson(projectRoot) {
|
|
83
91
|
const pkgPath = path.join(projectRoot, "package.json");
|
|
@@ -96,15 +104,15 @@ function mergePackageJson(projectRoot) {
|
|
|
96
104
|
version: "0.1.0",
|
|
97
105
|
private: true,
|
|
98
106
|
type: "module",
|
|
99
|
-
scripts: {
|
|
100
|
-
dev: "vite",
|
|
101
|
-
build: "vite build",
|
|
102
|
-
preview: "vite preview",
|
|
103
|
-
},
|
|
107
|
+
scripts: { ...SCAFFOLD_SCRIPTS },
|
|
104
108
|
};
|
|
105
109
|
console.log("[mvframe-init] 新建 package.json");
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
pkg.scripts = {
|
|
113
|
+
...SCAFFOLD_SCRIPTS,
|
|
114
|
+
...(pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {}),
|
|
115
|
+
};
|
|
108
116
|
pkg.dependencies = {
|
|
109
117
|
...SCAFFOLD_DEPENDENCIES,
|
|
110
118
|
...(pkg.dependencies && typeof pkg.dependencies === "object" ? pkg.dependencies : {}),
|
|
@@ -117,7 +125,17 @@ function mergePackageJson(projectRoot) {
|
|
|
117
125
|
};
|
|
118
126
|
|
|
119
127
|
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
120
|
-
console.log(
|
|
128
|
+
console.log(
|
|
129
|
+
"[mvframe-init] 已合并 package.json 的 scripts / dependencies / devDependencies(已有值优先)",
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function installDependencies(projectRoot) {
|
|
134
|
+
console.log("[mvframe-init] 执行 yarn install");
|
|
135
|
+
execFileSync("yarn", ["install"], {
|
|
136
|
+
cwd: projectRoot,
|
|
137
|
+
stdio: "inherit",
|
|
138
|
+
});
|
|
121
139
|
}
|
|
122
140
|
|
|
123
141
|
function main() {
|
|
@@ -718,10 +736,10 @@ export default defineConfig({
|
|
|
718
736
|
|
|
719
737
|
## 依赖
|
|
720
738
|
|
|
721
|
-
初始化脚本会**合并**(不整文件覆盖)\`package.json\` 的 \`dependencies\` / \`devDependencies
|
|
739
|
+
初始化脚本会**合并**(不整文件覆盖)\`package.json\` 的 \`scripts\` / \`dependencies\` / \`devDependencies\`:**已声明的脚本和包保留你的原值**,仅补上缺失项,并自动执行 \`yarn install\`。然后执行:
|
|
722
740
|
|
|
723
741
|
\`\`\`bash
|
|
724
|
-
yarn
|
|
742
|
+
yarn dev
|
|
725
743
|
\`\`\`
|
|
726
744
|
|
|
727
745
|
若需跳过对 \`package.json\` 的修改:\`node scripts/scaffold-app.js --no-package-json\`。
|
|
@@ -793,11 +811,10 @@ yarn exec mvframe-install-cursor-skill
|
|
|
793
811
|
|
|
794
812
|
if (!NO_PKG) {
|
|
795
813
|
mergePackageJson(target);
|
|
814
|
+
installDependencies(target);
|
|
796
815
|
}
|
|
797
816
|
|
|
798
|
-
console.log(
|
|
799
|
-
"[mvframe-init] 完成。请阅读 MVFRAME-SCAFFOLD.md 并在项目根执行 yarn install(或 npm install)。",
|
|
800
|
-
);
|
|
817
|
+
console.log("[mvframe-init] 完成。请阅读 MVFRAME-SCAFFOLD.md 并在项目根执行 yarn dev。");
|
|
801
818
|
}
|
|
802
819
|
|
|
803
820
|
main();
|