@done-coding/admin-core 0.12.2-alpha.0 → 0.12.3-alpha.0
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/es/bridge/index.mjs +28 -28
- package/es/bridge/plugin.mjs +4 -4
- package/es/components/app-layout/AppBody.vue.mjs +2 -2
- package/es/components/app-layout/AppBody.vue2.mjs +26 -33
- package/es/components/app-layout/AppLayout.vue.mjs +2 -2
- package/es/components/app-layout/AppLayout.vue2.mjs +53 -56
- package/es/components/app-layout/AppSidebar.vue.mjs +3 -3
- package/es/components/app-layout/AppSidebar.vue2.mjs +8 -8
- package/es/components/display/ActionBtn.vue.mjs +37 -36
- package/es/components/display/ActionConfirm.vue.mjs +1 -1
- package/es/components/display/ActionConfirm.vue2.mjs +50 -50
- package/es/components/form/FormSubmitBtn.vue.mjs +18 -13
- package/es/components/form/use-form-submit.mjs +8 -8
- package/es/components/table/constants.mjs +5 -0
- package/es/hooks/activated.mjs +1 -1
- package/es/hooks/use-theme-apply.mjs +80 -79
- package/es/hooks/use-viewport-apply.mjs +17 -16
- package/es/index.mjs +131 -128
- package/es/inject/key.mjs +27 -24
- package/es/injectInfo.json.mjs +6 -0
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/components/app-layout/AppLayout.vue.d.ts +1 -1
- package/types/components/display/ActionConfirm.vue.d.ts +2 -0
- package/types/components/form/types.d.ts +1 -0
- package/types/components/form/use-form-submit.d.ts +1 -0
- package/types/components/table/constants.d.ts +2 -0
- package/types/components/table/index.d.ts +1 -0
- package/types/hooks/use-theme-apply.d.ts +2 -2
- package/types/hooks/use-viewport-apply.d.ts +2 -2
- package/types/injectInfo.json.d.ts +7 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
import { themeScaleDerive as
|
|
3
|
-
const
|
|
1
|
+
import { watch as m, onScopeDispose as C } from "vue";
|
|
2
|
+
import { themeScaleDerive as y, themeScaleParseHex as S, themeScaleMix as b, themeScaleToRgba as $ } from "../utils/theme-scale.mjs";
|
|
3
|
+
const L = "dc-core-theme", A = () => Math.random().toString(36).slice(2, 9), T = [
|
|
4
4
|
["primaryColor", { scale: !0, el: "--el-color-primary" }],
|
|
5
5
|
["successColor", { scale: !0, el: "--el-color-success" }],
|
|
6
6
|
["warningColor", { scale: !0, el: "--el-color-warning" }],
|
|
@@ -25,69 +25,69 @@ const m = "dc-core-theme", y = [
|
|
|
25
25
|
"light-8",
|
|
26
26
|
"light-9",
|
|
27
27
|
"dark-2"
|
|
28
|
-
],
|
|
28
|
+
], v = (o) => o.replace(/([A-Z])/g, "-$1").toLowerCase(), g = (o, t) => {
|
|
29
29
|
const e = [];
|
|
30
|
-
for (const [c,
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
e.push(`${
|
|
37
|
-
for (const
|
|
38
|
-
e.push(`${
|
|
39
|
-
for (const
|
|
40
|
-
e.push(`${
|
|
41
|
-
for (const
|
|
42
|
-
e.push(`${
|
|
30
|
+
for (const [c, l] of T) {
|
|
31
|
+
const n = o[c];
|
|
32
|
+
if (n === void 0 || n === "") continue;
|
|
33
|
+
const i = `--dc-core-${v(c)}`, d = l.el === void 0 ? [] : Array.isArray(l.el) ? l.el : [l.el];
|
|
34
|
+
if (l.scale) {
|
|
35
|
+
const s = y(n, t);
|
|
36
|
+
e.push(`${i}: ${n};`);
|
|
37
|
+
for (const r of p)
|
|
38
|
+
e.push(`${i}-${r}: ${s[r]};`);
|
|
39
|
+
for (const r of d) {
|
|
40
|
+
e.push(`${r}: ${n};`);
|
|
41
|
+
for (const a of p)
|
|
42
|
+
e.push(`${r}-${a}: ${s[a]};`);
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
|
-
e.push(`${
|
|
46
|
-
for (const
|
|
45
|
+
e.push(`${i}: ${n};`);
|
|
46
|
+
for (const s of d) e.push(`${s}: ${n};`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return e.join(`
|
|
50
50
|
`);
|
|
51
|
-
},
|
|
51
|
+
}, D = 0.4, P = 10, k = {
|
|
52
52
|
light: 0.5,
|
|
53
53
|
dark: 0.72
|
|
54
|
-
}, f = (
|
|
55
|
-
if (!
|
|
56
|
-
const e = S(
|
|
54
|
+
}, f = (o, t) => {
|
|
55
|
+
if (!o) return "";
|
|
56
|
+
const e = S(o);
|
|
57
57
|
if (!e) return "";
|
|
58
|
-
const c = Math.max(...e),
|
|
59
|
-
return `--el-overlay-color-lighter: ${
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const c = Math.max(...e), l = c === 0 ? 0 : Math.min(D, P / c), n = b(o, "#000000", l);
|
|
59
|
+
return `--el-overlay-color-lighter: ${$(
|
|
60
|
+
n,
|
|
61
|
+
k[t]
|
|
62
62
|
)};`;
|
|
63
|
-
}, I = { light: 0.9, dark: 0.8 }, h = (
|
|
64
|
-
if (!
|
|
65
|
-
const e =
|
|
66
|
-
return e ===
|
|
67
|
-
},
|
|
68
|
-
const t =
|
|
63
|
+
}, I = { light: 0.9, dark: 0.8 }, h = (o, t) => {
|
|
64
|
+
if (!o) return "";
|
|
65
|
+
const e = $(o, I[t]);
|
|
66
|
+
return e === o ? "" : `--el-mask-color: ${e};`;
|
|
67
|
+
}, w = 0.88, B = (o, t) => !o || !S(o) ? "" : `--dc-core-dialog-surface: ${b(o, "#ffffff", w)};`, R = (o) => {
|
|
68
|
+
const t = o.light, e = o.dark, c = g(t, "light"), l = g(e, "dark"), i = [
|
|
69
69
|
c,
|
|
70
70
|
"color: var(--dc-core-base-color);",
|
|
71
71
|
f(t.bodyColor, "light"),
|
|
72
72
|
h(t.bodyColor, "light")
|
|
73
|
-
].filter(Boolean),
|
|
74
|
-
|
|
73
|
+
].filter(Boolean), d = [
|
|
74
|
+
l,
|
|
75
75
|
f(e.bodyColor, "dark"),
|
|
76
76
|
h(e.bodyColor, "dark"),
|
|
77
|
-
|
|
77
|
+
B(e.bodyColor)
|
|
78
78
|
].filter(Boolean);
|
|
79
79
|
return `:root {
|
|
80
|
-
${
|
|
80
|
+
${i.join(
|
|
81
81
|
`
|
|
82
82
|
`
|
|
83
83
|
)}
|
|
84
84
|
}
|
|
85
85
|
:root.dark {
|
|
86
|
-
${
|
|
86
|
+
${d.join(`
|
|
87
87
|
`)}
|
|
88
88
|
}
|
|
89
89
|
`;
|
|
90
|
-
},
|
|
90
|
+
}, H = "dc-core-rhythm", E = "dc-core-ep-bridge", x = "dc-core-ep-structural", M = [
|
|
91
91
|
".el-dialog,",
|
|
92
92
|
".el-message-box {",
|
|
93
93
|
// elevation:暗色下用提亮过的面板底(--dc-core-dialog-surface,仅 :root.dark 派生),
|
|
@@ -96,7 +96,7 @@ const m = "dc-core-theme", y = [
|
|
|
96
96
|
" border: 1px solid var(--dc-core-border-color, var(--el-border-color));",
|
|
97
97
|
"}"
|
|
98
98
|
].join(`
|
|
99
|
-
`),
|
|
99
|
+
`), Y = [
|
|
100
100
|
// T1 必纳:表格行密度(垂直经 td padding,水平经 .cell padding)
|
|
101
101
|
".el-table .el-table__cell {",
|
|
102
102
|
" padding-top: var(--dc-core-cell-padding-y, 8px);",
|
|
@@ -113,7 +113,7 @@ const m = "dc-core-theme", y = [
|
|
|
113
113
|
// 注:dialog/card 内距撤到期二——其 EP 原生值(dialog 16 / card 20)与单一
|
|
114
114
|
// content-gap 无法同时对齐,本期纳入会破"默认档零漂移";期二用专属 var 补。
|
|
115
115
|
].join(`
|
|
116
|
-
`),
|
|
116
|
+
`), z = {
|
|
117
117
|
compact: {
|
|
118
118
|
spaceUnit: "4px",
|
|
119
119
|
gap: "8px",
|
|
@@ -146,7 +146,7 @@ const m = "dc-core-theme", y = [
|
|
|
146
146
|
fontSizeBase: "15px",
|
|
147
147
|
fontScale: "1.25"
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, U = {
|
|
150
150
|
snappy: {
|
|
151
151
|
duration: "120ms",
|
|
152
152
|
durationSlow: "180ms",
|
|
@@ -165,8 +165,8 @@ const m = "dc-core-theme", y = [
|
|
|
165
165
|
easing: "cubic-bezier(0.22, 0.61, 0.36, 1)"
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
function
|
|
169
|
-
const e =
|
|
168
|
+
function O(o, t) {
|
|
169
|
+
const e = z[o], c = U[t], l = [
|
|
170
170
|
`--dc-core-space-unit: ${e.spaceUnit};`,
|
|
171
171
|
`--dc-core-content-gap: ${e.gap};`,
|
|
172
172
|
`--dc-core-control-height: ${e.controlHeight};`,
|
|
@@ -184,19 +184,19 @@ function Y(r, t) {
|
|
|
184
184
|
// easing 仅挂 dc-core,[MUST NOT] dual-write 覆盖 EP 两条 bezier——
|
|
185
185
|
// EP ease-in-out / fast 曲线各异,覆盖会让默认档动画曲线漂移;motion 档对 EP 只经 duration 生效。
|
|
186
186
|
`--dc-core-motion-easing: ${c.easing};`
|
|
187
|
-
],
|
|
187
|
+
], n = [
|
|
188
188
|
"--dc-core-motion-duration: 0.01ms;",
|
|
189
189
|
"--dc-core-motion-duration-slow: 0.01ms;",
|
|
190
190
|
"--el-transition-duration: 0.01ms;",
|
|
191
191
|
"--el-transition-duration-fast: 0.01ms;"
|
|
192
192
|
];
|
|
193
193
|
return `:root {
|
|
194
|
-
${
|
|
194
|
+
${l.join(`
|
|
195
195
|
`)}
|
|
196
196
|
}
|
|
197
197
|
@media (prefers-reduced-motion: reduce) {
|
|
198
198
|
:root {
|
|
199
|
-
${
|
|
199
|
+
${n.join(
|
|
200
200
|
`
|
|
201
201
|
`
|
|
202
202
|
)}
|
|
@@ -204,52 +204,53 @@ function Y(r, t) {
|
|
|
204
204
|
}
|
|
205
205
|
`;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
const t =
|
|
207
|
+
function V(o) {
|
|
208
|
+
const t = o.document ?? (typeof document < "u" ? document : void 0);
|
|
209
209
|
if (!t) return;
|
|
210
|
-
const e = () => {
|
|
211
|
-
|
|
212
|
-
return
|
|
210
|
+
const e = A(), c = [], l = (r) => {
|
|
211
|
+
const a = t.createElement("style");
|
|
212
|
+
return a.id = `${r}-${e}`, t.head.appendChild(a), c.push(a), a;
|
|
213
213
|
};
|
|
214
|
+
let n = null;
|
|
215
|
+
const i = () => (n || (n = l(L)), n);
|
|
214
216
|
if (!t.getElementById(x)) {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
+
const r = t.createElement("style");
|
|
218
|
+
r.id = x, r.textContent = M, t.head.appendChild(r);
|
|
217
219
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
(
|
|
221
|
-
|
|
220
|
+
m(
|
|
221
|
+
o.getThemeConfig,
|
|
222
|
+
(r) => {
|
|
223
|
+
i().textContent = R(r);
|
|
222
224
|
},
|
|
223
225
|
{ deep: !0, immediate: !0 }
|
|
224
|
-
),
|
|
225
|
-
|
|
226
|
-
(
|
|
227
|
-
t.documentElement.classList.toggle("dark",
|
|
226
|
+
), m(
|
|
227
|
+
o.getThemeIsDark,
|
|
228
|
+
(r) => {
|
|
229
|
+
t.documentElement.classList.toggle("dark", r);
|
|
228
230
|
},
|
|
229
231
|
{ immediate: !0 }
|
|
230
232
|
);
|
|
231
|
-
const { getThemeDensity:
|
|
232
|
-
if (
|
|
233
|
-
if (!t.getElementById(
|
|
234
|
-
const
|
|
235
|
-
|
|
233
|
+
const { getThemeDensity: d, getThemeMotion: s } = o;
|
|
234
|
+
if (d && s) {
|
|
235
|
+
if (!t.getElementById(E)) {
|
|
236
|
+
const u = t.createElement("style");
|
|
237
|
+
u.id = E, u.textContent = Y, t.head.appendChild(u);
|
|
236
238
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
s(
|
|
244
|
-
() => [c(), n()],
|
|
245
|
-
([l, a]) => {
|
|
246
|
-
o().textContent = Y(l, a);
|
|
239
|
+
let r = null;
|
|
240
|
+
const a = () => (r || (r = l(H)), r);
|
|
241
|
+
m(
|
|
242
|
+
() => [d(), s()],
|
|
243
|
+
([u, _]) => {
|
|
244
|
+
a().textContent = O(u, _);
|
|
247
245
|
},
|
|
248
246
|
{ immediate: !0 }
|
|
249
247
|
);
|
|
250
248
|
}
|
|
249
|
+
C(() => {
|
|
250
|
+
c.forEach((r) => r.remove()), c.length = 0;
|
|
251
|
+
});
|
|
251
252
|
}
|
|
252
253
|
export {
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
O as buildRhythmCss,
|
|
255
|
+
V as useCoreThemeApply
|
|
255
256
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
import { watch as c, onScopeDispose as n } from "vue";
|
|
2
|
+
const a = "dc-core-viewport", l = () => Math.random().toString(36).slice(2, 9), u = (e, d) => {
|
|
3
|
+
const r = e.paddingLeft + e.paddingRight, t = e.paddingTop + e.paddingBottom;
|
|
4
4
|
return `:root {
|
|
5
|
-
--dc-core-viewport-width: calc(100vw - ${
|
|
5
|
+
--dc-core-viewport-width: calc(100vw - ${r}px);
|
|
6
6
|
--dc-core-viewport-height: calc(100vh - ${t}px);
|
|
7
7
|
--dc-core-viewport-padding-top: ${e.paddingTop}px;
|
|
8
8
|
--dc-core-viewport-padding-right: ${e.paddingRight}px;
|
|
@@ -13,27 +13,28 @@ const r = "dc-core-viewport", c = (e, d) => {
|
|
|
13
13
|
` : "") + `}
|
|
14
14
|
`;
|
|
15
15
|
};
|
|
16
|
-
function
|
|
16
|
+
function m(e) {
|
|
17
17
|
const d = e.document ?? (typeof document < "u" ? document : void 0);
|
|
18
18
|
if (!d) return;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
i(
|
|
19
|
+
const r = `${a}-${l()}`;
|
|
20
|
+
let t = null;
|
|
21
|
+
const p = () => (t || (t = d.createElement("style"), t.id = r, d.head.appendChild(t)), t);
|
|
22
|
+
c(
|
|
24
23
|
() => {
|
|
25
|
-
var
|
|
24
|
+
var o;
|
|
26
25
|
return {
|
|
27
26
|
viewport: e.getViewportConfig(),
|
|
28
|
-
gap: (
|
|
27
|
+
gap: (o = e.getGapConfig) == null ? void 0 : o.call(e)
|
|
29
28
|
};
|
|
30
29
|
},
|
|
31
|
-
({ viewport:
|
|
32
|
-
p().textContent =
|
|
30
|
+
({ viewport: o, gap: i }) => {
|
|
31
|
+
p().textContent = u(o, i);
|
|
33
32
|
},
|
|
34
33
|
{ deep: !0, immediate: !0 }
|
|
35
|
-
)
|
|
34
|
+
), n(() => {
|
|
35
|
+
t == null || t.remove(), t = null;
|
|
36
|
+
});
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
m as useCoreViewportApply
|
|
39
40
|
};
|