@done-coding/admin-core 0.10.0 → 0.10.1-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/config-hook.mjs +32 -26
- package/es/bridge/index.mjs +129 -83
- package/es/bridge/theme/index.mjs +103 -0
- package/es/bridge/theme/persist.mjs +14 -0
- package/es/bridge/theme/system-dark.mjs +11 -0
- package/es/components/app-layout/AppAside.vue.mjs +7 -0
- package/es/components/app-layout/AppAside.vue2.mjs +22 -0
- package/es/components/app-layout/AppFooter.vue.mjs +2 -2
- package/es/components/app-layout/AppHeader.vue.mjs +2 -2
- package/es/components/app-layout/AppHeader.vue2.mjs +35 -41
- package/es/components/app-layout/AppLayout.vue.mjs +2 -2
- package/es/components/app-layout/AppLayout.vue2.mjs +106 -88
- package/es/components/app-layout/AppShell.vue.mjs +60 -0
- package/es/components/app-layout/AppShell.vue2.mjs +4 -0
- package/es/components/app-layout/AppSidebar.vue.mjs +2 -2
- package/es/components/app-layout/AppSidebar.vue2.mjs +44 -47
- package/es/components/app-layout/AppTheme.vue.mjs +2 -2
- package/es/components/app-layout/AppTheme.vue2.mjs +55 -25
- package/es/components/app-layout/viewport.mjs +5 -0
- package/es/components/form/FormItemNestForm.vue.mjs +1 -1
- package/es/components/form/FormItemNestFormList.vue.mjs +1 -1
- package/es/components/form/FormSearch.vue.mjs +2 -2
- package/es/components/form/FormSearch.vue2.mjs +1 -1
- package/es/hooks/use-admin-theme-apply.mjs +16 -15
- package/es/hooks/use-admin-viewport-apply.mjs +29 -17
- package/es/index.mjs +182 -175
- package/es/store/app.mjs +133 -77
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/bridge/config-hook.d.ts +10 -2
- package/types/bridge/index.d.ts +105 -5
- package/types/bridge/theme/index.d.ts +10 -0
- package/types/bridge/theme/persist.d.ts +23 -0
- package/types/bridge/theme/system-dark.d.ts +14 -0
- package/types/bridge/theme/types.d.ts +258 -0
- package/types/components/app-layout/AppAside.vue.d.ts +21 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +2 -7
- package/types/components/app-layout/AppShell.vue.d.ts +27 -0
- package/types/components/app-layout/index.d.ts +4 -1
- package/types/components/app-layout/types.d.ts +117 -1
- package/types/components/app-layout/viewport.d.ts +30 -0
- package/types/hooks/use-admin-viewport-apply.d.ts +6 -1
- package/types/store/app.d.ts +24 -83
- package/types/types/route.d.ts +2 -0
- package/es/bridge/theme.mjs +0 -65
- package/types/bridge/theme.d.ts +0 -85
|
@@ -1,38 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElSelect as
|
|
3
|
-
import { Sunny as
|
|
4
|
-
import { APP_LAYOUT_BRIDGE_KEY as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as f, inject as h, computed as m, openBlock as o, createElementBlock as r, createBlock as s, unref as l, withCtx as a, Fragment as i, renderList as c, createCommentVNode as y, createVNode as u, resolveDynamicComponent as E } from "vue";
|
|
2
|
+
import { ElSelect as b, ElOption as k, ElRadioGroup as g, ElRadioButton as M, ElTooltip as O, ElIcon as S } from "element-plus";
|
|
3
|
+
import { Sunny as B, Moon as C, Monitor as T } from "@element-plus/icons-vue";
|
|
4
|
+
import { APP_LAYOUT_BRIDGE_KEY as x } from "../../inject/key.mjs";
|
|
5
|
+
const A = { class: "app-theme" }, V = /* @__PURE__ */ f({
|
|
6
6
|
__name: "AppTheme",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
setup(D) {
|
|
8
|
+
const t = h(x), p = m(() => t.themeMode.value), v = m(() => t.themeStyle.value), d = m(() => t.theme.list.value), _ = [
|
|
9
|
+
{ value: "light", label: "亮色", icon: B },
|
|
10
|
+
{ value: "dark", label: "暗色", icon: C },
|
|
11
|
+
{ value: "system", label: "跟随系统", icon: T }
|
|
12
|
+
];
|
|
13
|
+
return (I, n) => (o(), r("div", A, [
|
|
14
|
+
d.value.length > 1 ? (o(), s(l(b), {
|
|
11
15
|
key: 0,
|
|
12
|
-
"model-value":
|
|
16
|
+
"model-value": v.value,
|
|
13
17
|
class: "app-theme__style-select",
|
|
14
18
|
size: "small",
|
|
15
|
-
onChange:
|
|
19
|
+
onChange: n[0] || (n[0] = (e) => l(t).theme.setStyle(e))
|
|
16
20
|
}, {
|
|
17
|
-
default:
|
|
18
|
-
(
|
|
19
|
-
key:
|
|
20
|
-
label:
|
|
21
|
-
value:
|
|
21
|
+
default: a(() => [
|
|
22
|
+
(o(!0), r(i, null, c(d.value, (e) => (o(), s(l(k), {
|
|
23
|
+
key: e,
|
|
24
|
+
label: l(t).theme.labelOf(e),
|
|
25
|
+
value: e
|
|
22
26
|
}, null, 8, ["label", "value"]))), 128))
|
|
23
27
|
]),
|
|
24
28
|
_: 1
|
|
25
|
-
}, 8, ["model-value"])) :
|
|
26
|
-
|
|
27
|
-
"model-value":
|
|
28
|
-
class: "app-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
}, 8, ["model-value"])) : y("", !0),
|
|
30
|
+
u(l(g), {
|
|
31
|
+
"model-value": p.value,
|
|
32
|
+
class: "app-theme__mode-group",
|
|
33
|
+
size: "small",
|
|
34
|
+
"onUpdate:modelValue": n[1] || (n[1] = (e) => l(t).theme.setMode(e))
|
|
35
|
+
}, {
|
|
36
|
+
default: a(() => [
|
|
37
|
+
(o(), r(i, null, c(_, (e) => u(l(M), {
|
|
38
|
+
key: e.value,
|
|
39
|
+
value: e.value
|
|
40
|
+
}, {
|
|
41
|
+
default: a(() => [
|
|
42
|
+
u(l(O), {
|
|
43
|
+
content: e.label,
|
|
44
|
+
"show-after": 200,
|
|
45
|
+
placement: "bottom"
|
|
46
|
+
}, {
|
|
47
|
+
default: a(() => [
|
|
48
|
+
u(l(S), null, {
|
|
49
|
+
default: a(() => [
|
|
50
|
+
(o(), s(E(e.icon)))
|
|
51
|
+
]),
|
|
52
|
+
_: 2
|
|
53
|
+
}, 1024)
|
|
54
|
+
]),
|
|
55
|
+
_: 2
|
|
56
|
+
}, 1032, ["content"])
|
|
57
|
+
]),
|
|
58
|
+
_: 2
|
|
59
|
+
}, 1032, ["value"])), 64))
|
|
60
|
+
]),
|
|
61
|
+
_: 1
|
|
62
|
+
}, 8, ["model-value"])
|
|
33
63
|
]));
|
|
34
64
|
}
|
|
35
65
|
});
|
|
36
66
|
export {
|
|
37
|
-
|
|
67
|
+
V as default
|
|
38
68
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FormItemNestForm.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-12b77b02"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FormItemNestFormList.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9fa02cbe"]]);
|
|
5
5
|
export {
|
|
6
6
|
s as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FormSearch.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4d4d2642"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { watch as u } from "vue";
|
|
2
2
|
import { themeScaleDerive as g } from "../utils/theme-scale.mjs";
|
|
3
|
-
const
|
|
3
|
+
const m = "admin-core-theme", p = [
|
|
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" }],
|
|
@@ -18,7 +18,7 @@ const h = "admin-core-theme", p = [
|
|
|
18
18
|
["blur", {}],
|
|
19
19
|
["focusRing", {}],
|
|
20
20
|
["surface", {}]
|
|
21
|
-
],
|
|
21
|
+
], h = [
|
|
22
22
|
"light-3",
|
|
23
23
|
"light-5",
|
|
24
24
|
"light-7",
|
|
@@ -27,19 +27,19 @@ const h = "admin-core-theme", p = [
|
|
|
27
27
|
"dark-2"
|
|
28
28
|
], $ = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), f = (r, l) => {
|
|
29
29
|
const o = [];
|
|
30
|
-
for (const [e,
|
|
30
|
+
for (const [e, c] of p) {
|
|
31
31
|
const t = r[e];
|
|
32
32
|
if (t === void 0 || t === "") continue;
|
|
33
|
-
const a = `--admin-core-${$(e)}`, i =
|
|
34
|
-
if (
|
|
33
|
+
const a = `--admin-core-${$(e)}`, i = c.el === void 0 ? [] : Array.isArray(c.el) ? c.el : [c.el];
|
|
34
|
+
if (c.scale) {
|
|
35
35
|
const n = g(t, l);
|
|
36
36
|
o.push(`${a}: ${t};`);
|
|
37
|
-
for (const
|
|
38
|
-
o.push(`${a}-${
|
|
39
|
-
for (const
|
|
40
|
-
o.push(`${
|
|
41
|
-
for (const d of
|
|
42
|
-
o.push(`${
|
|
37
|
+
for (const s of h)
|
|
38
|
+
o.push(`${a}-${s}: ${n[s]};`);
|
|
39
|
+
for (const s of i) {
|
|
40
|
+
o.push(`${s}: ${t};`);
|
|
41
|
+
for (const d of h)
|
|
42
|
+
o.push(`${s}-${d}: ${n[d]};`);
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
45
|
o.push(`${a}: ${t};`);
|
|
@@ -48,10 +48,11 @@ const h = "admin-core-theme", p = [
|
|
|
48
48
|
}
|
|
49
49
|
return o.join(`
|
|
50
50
|
`);
|
|
51
|
-
},
|
|
51
|
+
}, C = (r) => {
|
|
52
52
|
const l = f(r.light, "light"), o = f(r.dark, "dark");
|
|
53
53
|
return `:root {
|
|
54
54
|
${l}
|
|
55
|
+
color: var(--admin-core-base-color);
|
|
55
56
|
}
|
|
56
57
|
:root.dark {
|
|
57
58
|
${o}
|
|
@@ -62,13 +63,13 @@ function E(r) {
|
|
|
62
63
|
const l = r.document ?? (typeof document < "u" ? document : void 0);
|
|
63
64
|
if (!l) return;
|
|
64
65
|
const o = () => {
|
|
65
|
-
let e = l.getElementById(
|
|
66
|
-
return e || (e = l.createElement("style"), e.id =
|
|
66
|
+
let e = l.getElementById(m);
|
|
67
|
+
return e || (e = l.createElement("style"), e.id = m, l.head.appendChild(e)), e;
|
|
67
68
|
};
|
|
68
69
|
u(
|
|
69
70
|
r.getThemeConfig,
|
|
70
71
|
(e) => {
|
|
71
|
-
o().textContent =
|
|
72
|
+
o().textContent = C(e);
|
|
72
73
|
},
|
|
73
74
|
{ deep: !0, immediate: !0 }
|
|
74
75
|
), u(
|
|
@@ -1,27 +1,39 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
import { watch as n } from "vue";
|
|
2
|
+
const p = "admin-core-viewport", o = (e, d) => {
|
|
3
|
+
const i = e.paddingLeft + e.paddingRight, t = e.paddingTop + e.paddingBottom;
|
|
4
4
|
return `:root {
|
|
5
|
-
--admin-core-viewport-width: calc(100vw - ${
|
|
6
|
-
--admin-core-viewport-height: calc(100vh - ${
|
|
7
|
-
}
|
|
5
|
+
--admin-core-viewport-width: calc(100vw - ${i}px);
|
|
6
|
+
--admin-core-viewport-height: calc(100vh - ${t}px);
|
|
7
|
+
--admin-core-viewport-padding-top: ${e.paddingTop}px;
|
|
8
|
+
--admin-core-viewport-padding-right: ${e.paddingRight}px;
|
|
9
|
+
--admin-core-viewport-padding-bottom: ${e.paddingBottom}px;
|
|
10
|
+
--admin-core-viewport-padding-left: ${e.paddingLeft}px;
|
|
11
|
+
` + // gap 内缝 var:仅当提供 getGapConfig 时注入(纯对外暴露,core 不读)。
|
|
12
|
+
(d ? ` --admin-core-gap: ${d.size}px;
|
|
13
|
+
` : "") + `}
|
|
8
14
|
`;
|
|
9
15
|
};
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
const
|
|
14
|
-
let t =
|
|
15
|
-
return t || (t =
|
|
16
|
+
function m(e) {
|
|
17
|
+
const d = e.document ?? (typeof document < "u" ? document : void 0);
|
|
18
|
+
if (!d) return;
|
|
19
|
+
const i = () => {
|
|
20
|
+
let t = d.getElementById(p);
|
|
21
|
+
return t || (t = d.createElement("style"), t.id = p, d.head.appendChild(t)), t;
|
|
16
22
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
n(
|
|
24
|
+
() => {
|
|
25
|
+
var t;
|
|
26
|
+
return {
|
|
27
|
+
viewport: e.getViewportConfig(),
|
|
28
|
+
gap: (t = e.getGapConfig) == null ? void 0 : t.call(e)
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
({ viewport: t, gap: r }) => {
|
|
32
|
+
i().textContent = o(t, r);
|
|
21
33
|
},
|
|
22
34
|
{ deep: !0, immediate: !0 }
|
|
23
35
|
);
|
|
24
36
|
}
|
|
25
37
|
export {
|
|
26
|
-
|
|
38
|
+
m as useAdminViewportApply
|
|
27
39
|
};
|