@done-coding/admin-core 0.9.1-alpha.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.
Files changed (46) hide show
  1. package/es/bridge/config-hook.mjs +32 -26
  2. package/es/bridge/index.mjs +129 -83
  3. package/es/bridge/theme/index.mjs +103 -0
  4. package/es/bridge/theme/persist.mjs +14 -0
  5. package/es/bridge/theme/system-dark.mjs +11 -0
  6. package/es/components/app-layout/AppAside.vue.mjs +7 -0
  7. package/es/components/app-layout/AppAside.vue2.mjs +22 -0
  8. package/es/components/app-layout/AppFooter.vue.mjs +2 -2
  9. package/es/components/app-layout/AppHeader.vue.mjs +2 -2
  10. package/es/components/app-layout/AppHeader.vue2.mjs +35 -41
  11. package/es/components/app-layout/AppLayout.vue.mjs +2 -2
  12. package/es/components/app-layout/AppLayout.vue2.mjs +106 -88
  13. package/es/components/app-layout/AppShell.vue.mjs +60 -0
  14. package/es/components/app-layout/AppShell.vue2.mjs +4 -0
  15. package/es/components/app-layout/AppSidebar.vue.mjs +2 -2
  16. package/es/components/app-layout/AppSidebar.vue2.mjs +44 -47
  17. package/es/components/app-layout/AppTheme.vue.mjs +2 -2
  18. package/es/components/app-layout/AppTheme.vue2.mjs +55 -25
  19. package/es/components/app-layout/viewport.mjs +5 -0
  20. package/es/components/form/FormItemNestForm.vue.mjs +1 -1
  21. package/es/components/form/FormItemNestFormList.vue.mjs +1 -1
  22. package/es/components/form/FormSearch.vue.mjs +2 -2
  23. package/es/components/form/FormSearch.vue2.mjs +1 -1
  24. package/es/hooks/use-admin-theme-apply.mjs +16 -15
  25. package/es/hooks/use-admin-viewport-apply.mjs +29 -17
  26. package/es/index.mjs +182 -175
  27. package/es/store/app.mjs +133 -77
  28. package/es/style.css +1 -1
  29. package/package.json +2 -2
  30. package/types/bridge/config-hook.d.ts +10 -2
  31. package/types/bridge/index.d.ts +105 -5
  32. package/types/bridge/theme/index.d.ts +10 -0
  33. package/types/bridge/theme/persist.d.ts +23 -0
  34. package/types/bridge/theme/system-dark.d.ts +14 -0
  35. package/types/bridge/theme/types.d.ts +258 -0
  36. package/types/components/app-layout/AppAside.vue.d.ts +21 -0
  37. package/types/components/app-layout/AppLayout.vue.d.ts +2 -7
  38. package/types/components/app-layout/AppShell.vue.d.ts +27 -0
  39. package/types/components/app-layout/index.d.ts +4 -1
  40. package/types/components/app-layout/types.d.ts +117 -1
  41. package/types/components/app-layout/viewport.d.ts +30 -0
  42. package/types/hooks/use-admin-viewport-apply.d.ts +6 -1
  43. package/types/store/app.d.ts +24 -83
  44. package/types/types/route.d.ts +2 -0
  45. package/es/bridge/theme.mjs +0 -65
  46. package/types/bridge/theme.d.ts +0 -85
@@ -1,38 +1,68 @@
1
- import { defineComponent as u, inject as p, computed as n, openBlock as a, createElementBlock as m, createBlock as r, unref as e, withCtx as v, Fragment as d, renderList as h, createCommentVNode as _, createVNode as f } from "vue";
2
- import { ElSelect as k, ElOption as y, ElSwitch as E } from "element-plus";
3
- import { Sunny as S, Moon as B } from "@element-plus/icons-vue";
4
- import { APP_LAYOUT_BRIDGE_KEY as b } from "../../inject/key.mjs";
5
- const g = { class: "app-theme" }, O = /* @__PURE__ */ u({
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(C) {
8
- const l = p(b), c = n(() => l.themeIsDark.value), s = n(() => l.themeStyle.value), i = n(() => l.theme.list.value);
9
- return (D, o) => (a(), m("div", g, [
10
- i.value.length > 1 ? (a(), r(e(k), {
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": s.value,
16
+ "model-value": v.value,
13
17
  class: "app-theme__style-select",
14
18
  size: "small",
15
- onChange: o[0] || (o[0] = (t) => e(l).theme.setStyle(t))
19
+ onChange: n[0] || (n[0] = (e) => l(t).theme.setStyle(e))
16
20
  }, {
17
- default: v(() => [
18
- (a(!0), m(d, null, h(i.value, (t) => (a(), r(e(y), {
19
- key: t,
20
- label: e(l).theme.labelOf(t),
21
- value: t
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"])) : _("", !0),
26
- f(e(E), {
27
- "model-value": c.value,
28
- class: "app-theme__dark-switch",
29
- "active-action-icon": e(B),
30
- "inactive-action-icon": e(S),
31
- "onUpdate:modelValue": o[1] || (o[1] = (t) => e(l).theme.setDark(!!t))
32
- }, null, 8, ["model-value", "active-action-icon", "inactive-action-icon"])
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
- O as default
67
+ V as default
38
68
  };
@@ -0,0 +1,5 @@
1
+ const E = 800, _ = 1e4;
2
+ export {
3
+ _ as ADMIN_CORE_VIEWPORT_DECOR_ZINDEX_ABOVE,
4
+ E as ADMIN_CORE_VIEWPORT_DECOR_ZINDEX_BELOW
5
+ };
@@ -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-9c251e76"]]);
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-f424fc36"]]);
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 m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-9a9f48af"]]);
4
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4d4d2642"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -24,7 +24,7 @@ const ue = { class: "btn-box" }, ge = /* @__PURE__ */ z({
24
24
  lg: 8,
25
25
  xl: 6
26
26
  }) },
27
- rowGutter: {},
27
+ rowGutter: { default: 14 },
28
28
  layoutScale: {}
29
29
  },
30
30
  emits: ["search", "heightChange", "visibleChange"],
@@ -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 h = "admin-core-theme", p = [
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
- ], m = [
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, s] of p) {
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 = s.el === void 0 ? [] : Array.isArray(s.el) ? s.el : [s.el];
34
- if (s.scale) {
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 c of m)
38
- o.push(`${a}-${c}: ${n[c]};`);
39
- for (const c of i) {
40
- o.push(`${c}: ${t};`);
41
- for (const d of m)
42
- o.push(`${c}-${d}: ${n[d]};`);
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
- }, b = (r) => {
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(h);
66
- return e || (e = l.createElement("style"), e.id = h, l.head.appendChild(e)), e;
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 = b(e);
72
+ o().textContent = C(e);
72
73
  },
73
74
  { deep: !0, immediate: !0 }
74
75
  ), u(
@@ -1,27 +1,39 @@
1
- import { watch as i } from "vue";
2
- const n = "admin-core-viewport", r = (e) => {
3
- const o = e.paddingLeft + e.paddingRight, d = e.paddingTop + e.paddingBottom;
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 - ${o}px);
6
- --admin-core-viewport-height: calc(100vh - ${d}px);
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 c(e) {
11
- const o = e.document ?? (typeof document < "u" ? document : void 0);
12
- if (!o) return;
13
- const d = () => {
14
- let t = o.getElementById(n);
15
- return t || (t = o.createElement("style"), t.id = n, o.head.appendChild(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
- i(
18
- e.getViewportConfig,
19
- (t) => {
20
- d().textContent = r(t);
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
- c as useAdminViewportApply
38
+ m as useAdminViewportApply
27
39
  };