@done-coding/forge-core 0.104.0 → 0.104.1-alpha.1

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 (49) hide show
  1. package/README.md +1 -1
  2. package/es/bridge/index.mjs +1 -1
  3. package/es/bridge/theme/index.mjs +45 -21
  4. package/es/components/feedback/modal-confirm/ModalConfirm.vue.mjs +1 -1
  5. package/es/components/feedback/modal-confirm/ModalConfirm.vue2.mjs +1 -6
  6. package/es/components/feedback/preview-keys/index.mjs +6 -2
  7. package/es/components/feedback/preview-keys/keys.mjs +41 -1
  8. package/es/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.mjs +1 -1
  9. package/es/components/other/index.mjs +1 -4
  10. package/es/hooks/activated.mjs +2 -34
  11. package/es/hooks/index.mjs +1 -3
  12. package/es/hooks/use-legacy-copy-check.mjs +18 -0
  13. package/es/hooks/use-theme-apply.mjs +11 -7
  14. package/es/index.mjs +10 -9
  15. package/es/inject/index.mjs +4 -3
  16. package/es/inject/key.mjs +9 -11
  17. package/es/inject/viewport-channel.mjs +4 -0
  18. package/es/injection-namespace.mjs +1 -1
  19. package/es/internals/index.mjs +2 -0
  20. package/es/router/group-redirect.mjs +1 -1
  21. package/es/store/app.mjs +3 -18
  22. package/es/store/router-permission.mjs +11 -3
  23. package/es/style.css +18 -18
  24. package/package.json +2 -2
  25. package/types/bridge/contracts/bridge.d.ts +4 -4
  26. package/types/bridge/contracts/config.d.ts +170 -218
  27. package/types/bridge/index.d.ts +1 -1
  28. package/types/bridge/theme/types.d.ts +12 -1
  29. package/types/components/basic/display-contracts/types.d.ts +5 -4
  30. package/types/components/feedback/preview-keys/index.d.ts +1 -1
  31. package/types/components/feedback/preview-keys/keys.d.ts +46 -5
  32. package/types/components/feedback/shelf-contracts/types.d.ts +1 -1
  33. package/types/components/other/index.d.ts +1 -1
  34. package/types/hooks/activated.d.ts +0 -10
  35. package/types/hooks/use-channel-viewport-height.d.ts +3 -3
  36. package/types/hooks/use-legacy-copy-check.d.ts +7 -0
  37. package/types/inject/index.d.ts +1 -0
  38. package/types/inject/key.d.ts +22 -44
  39. package/types/inject/viewport-channel.d.ts +16 -0
  40. package/types/injection-namespace.d.ts +1 -1
  41. package/types/internals/index.d.ts +1 -0
  42. package/types/router/guard/types.d.ts +1 -1
  43. package/types/store/app.d.ts +3 -69
  44. package/types/store/router-permission.d.ts +3 -3
  45. package/types/types/modal-shelf.d.ts +59 -11
  46. package/types/types/route.d.ts +0 -1
  47. package/es/components/other/TriggerAutoImport.vue.mjs +0 -12
  48. package/es/components/other/TriggerAutoImport.vue2.mjs +0 -4
  49. package/types/components/other/TriggerAutoImport.vue.d.ts +0 -17
package/README.md CHANGED
@@ -19,7 +19,7 @@ import "@done-coding/forge/style.css";
19
19
 
20
20
  ## 消费边界
21
21
 
22
- `ModalShelfMap` 由 forge-core 定义,应用通过 `declare module "@done-coding/forge" { interface ModalShelfMap { /* 业务键 */ } }` 增广,约束 ModalPorter 与 ModalShelf。共享注入键沿用历史 `@done-coding/admin-core` namespace,保持 Symbol.for 身份。
22
+ `ModalShelfMap` 由 forge-core 定义,应用通过 `declare module "@done-coding/forge" { interface ModalShelfMap { /* 业务键 */ } }` 增广,约束 ModalPorter 与 ModalShelf。注入键按定义它的包取包名作命名空间(如 `@done-coding/forge-core:CORE_BRIDGE_KEY`);provide / inject 一律 import 键变量,不按字符串复写。家族须同版安装,混装 0.x 副本时 `AppLayout` 开发期报错。
23
23
 
24
24
  本包不依赖上层组件;`internals` 为包间实现契约,应用聚合不转出。需要 Pinia 2;本包不使用或注册 persistedstate,应用自定义持久化 store 时自行选择兼容插件。
25
25
 
@@ -278,7 +278,7 @@ function createCoreBridge(options) {
278
278
  /** 当前密度档 / 动效档(节奏真相源;useCoreThemeApply 消费,明暗无关) */
279
279
  themeDensity: themeHook.themeDensity,
280
280
  themeMotion: themeHook.themeMotion,
281
- /** 当前生效 JS 主题色(输出 B;MenuTree/布局直读、appStore.theme 转发) */
281
+ /** 当前生效 JS 主题色(输出 B;MenuTree/布局直读) */
282
282
  themeColors,
283
283
  /** 是否显示内置风格切换下拉(AppTheme ElSelect);init 静态值,缺省 true(亮暗恒显) */
284
284
  showThemeStyleSwitcher: options.showThemeStyleSwitcher ?? true,
@@ -1,6 +1,16 @@
1
1
  import { ref, computed, readonly, markRaw } from "vue";
2
2
  import { DEFAULT_STORAGE_KEY, readPersist } from "./persist.mjs";
3
3
  import { readSystemPrefersDark, watchSystemPrefersDark } from "./system-dark.mjs";
4
+ const LAYOUT_GROUP_NAMES = [
5
+ "header",
6
+ "footer",
7
+ "sidebar",
8
+ "aside",
9
+ "breadcrumb",
10
+ "body",
11
+ "viewport",
12
+ "gap"
13
+ ];
4
14
  const DEFAULT_STYLE = "default";
5
15
  const DEFAULT_MODE = "light";
6
16
  const DEFAULT_LABEL = "默认";
@@ -29,8 +39,10 @@ function createBridgeThemeHook(init) {
29
39
  });
30
40
  const themeLayout = ref({
31
41
  shell: void 0,
32
- extractLevel1ToHeader: false
42
+ extractLevel1ToHeader: false,
43
+ sidebarCollapsed: void 0
33
44
  });
45
+ let appliedLayoutKeys = {};
34
46
  const themeDensity = ref(DEFAULT_DENSITY);
35
47
  const themeMotion = ref(DEFAULT_MOTION);
36
48
  const themeList = ref([]);
@@ -63,18 +75,37 @@ function createBridgeThemeHook(init) {
63
75
  const applyConfig = (config) => {
64
76
  init.update("APP_THEME_CONFIG", { light: config.light, dark: config.dark });
65
77
  };
66
- const applyLayout = (layout, presetId = "") => {
78
+ const applyLayout = (layout) => {
67
79
  const baseline = init.layoutBaseline;
68
80
  if (baseline) {
69
- init.update("APP_LAYOUT_HEADER_CONFIG", { ...baseline.header });
70
- init.update("APP_LAYOUT_FOOTER_CONFIG", { ...baseline.footer });
71
- init.update("APP_LAYOUT_SIDEBAR_CONFIG", { ...baseline.sidebar });
72
- init.update("APP_LAYOUT_ASIDE_CONFIG", { ...baseline.aside });
73
- init.update("APP_LAYOUT_BREADCRUMB_CONFIG", { ...baseline.breadcrumb });
74
- init.update("APP_LAYOUT_BODY_CONFIG", { ...baseline.body });
75
- init.update("APP_LAYOUT_VIEWPORT_CONFIG", { ...baseline.viewport });
76
- init.update("APP_LAYOUT_GAP_CONFIG", { ...baseline.gap });
81
+ const resetGroup = (key, group, base) => {
82
+ const stale = (appliedLayoutKeys[group] ?? []).filter(
83
+ (field) => !(field in base)
84
+ );
85
+ init.update(key, {
86
+ ...Object.fromEntries(stale.map((field) => [field, void 0])),
87
+ ...base
88
+ });
89
+ };
90
+ resetGroup("APP_LAYOUT_HEADER_CONFIG", "header", baseline.header);
91
+ resetGroup("APP_LAYOUT_FOOTER_CONFIG", "footer", baseline.footer);
92
+ resetGroup("APP_LAYOUT_SIDEBAR_CONFIG", "sidebar", baseline.sidebar);
93
+ resetGroup("APP_LAYOUT_ASIDE_CONFIG", "aside", baseline.aside);
94
+ resetGroup(
95
+ "APP_LAYOUT_BREADCRUMB_CONFIG",
96
+ "breadcrumb",
97
+ baseline.breadcrumb
98
+ );
99
+ resetGroup("APP_LAYOUT_BODY_CONFIG", "body", baseline.body);
100
+ resetGroup("APP_LAYOUT_VIEWPORT_CONFIG", "viewport", baseline.viewport);
101
+ resetGroup("APP_LAYOUT_GAP_CONFIG", "gap", baseline.gap);
77
102
  }
103
+ appliedLayoutKeys = Object.fromEntries(
104
+ LAYOUT_GROUP_NAMES.map((group) => [
105
+ group,
106
+ Object.keys((layout == null ? void 0 : layout[group]) ?? {})
107
+ ])
108
+ );
78
109
  if (layout) {
79
110
  if (layout.header) init.update("APP_LAYOUT_HEADER_CONFIG", layout.header);
80
111
  if (layout.footer) init.update("APP_LAYOUT_FOOTER_CONFIG", layout.footer);
@@ -83,22 +114,15 @@ function createBridgeThemeHook(init) {
83
114
  if (layout.aside) init.update("APP_LAYOUT_ASIDE_CONFIG", layout.aside);
84
115
  if (layout.breadcrumb)
85
116
  init.update("APP_LAYOUT_BREADCRUMB_CONFIG", layout.breadcrumb);
86
- if (layout.body) {
87
- const { shimPadding, ...bodyRest } = layout.body;
88
- if (shimPadding) {
89
- console.warn(
90
- `[dc-layout] 主题预设「${presetId}」的 layout.body.shimPadding(${shimPadding})已废弃且**不再影响任何渲染**,已忽略。内容四周留白改由间距阶梯的外圈档(gap × 2)给出 —— 预设要调留白请改自己的 layout.gap.size。本字段将在下一个版本移除。`
91
- );
92
- }
93
- init.update("APP_LAYOUT_BODY_CONFIG", bodyRest);
94
- }
117
+ if (layout.body) init.update("APP_LAYOUT_BODY_CONFIG", layout.body);
95
118
  if (layout.viewport)
96
119
  init.update("APP_LAYOUT_VIEWPORT_CONFIG", layout.viewport);
97
120
  if (layout.gap) init.update("APP_LAYOUT_GAP_CONFIG", layout.gap);
98
121
  }
99
122
  themeLayout.value = {
100
123
  shell: (layout == null ? void 0 : layout.shell) ? markRaw(layout.shell) : void 0,
101
- extractLevel1ToHeader: (layout == null ? void 0 : layout.extractLevel1ToHeader) ?? false
124
+ extractLevel1ToHeader: (layout == null ? void 0 : layout.extractLevel1ToHeader) ?? false,
125
+ sidebarCollapsed: layout == null ? void 0 : layout.sidebarCollapsed
102
126
  };
103
127
  };
104
128
  const fireHook = (fn, id) => {
@@ -119,7 +143,7 @@ function createBridgeThemeHook(init) {
119
143
  if (prev === target) return;
120
144
  fireHook((_a2 = hookMap.get(prev)) == null ? void 0 : _a2.onDeactivate, prev);
121
145
  applyConfig(targetConfig);
122
- applyLayout(layoutMap.get(target), target);
146
+ applyLayout(layoutMap.get(target));
123
147
  const rhythm = rhythmMap.get(target);
124
148
  themeDensity.value = (rhythm == null ? void 0 : rhythm.density) ?? DEFAULT_DENSITY;
125
149
  themeMotion.value = (rhythm == null ? void 0 : rhythm.motion) ?? DEFAULT_MOTION;
@@ -2,7 +2,7 @@ import _sfc_main from "./ModalConfirm.vue2.mjs";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const ModalConfirm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5833c7fa"]]);
5
+ const ModalConfirm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2c2e31dd"]]);
6
6
  export {
7
7
  ModalConfirm as default
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, shallowRef, ref, inject, provide, openBlock, createBlock, resolveDynamicComponent, mergeProps, createSlots, withCtx, createElementVNode, normalizeClass, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, unref, createCommentVNode, createVNode } from "vue";
2
2
  import { ElDrawer, ElDialog, ElButton } from "element-plus";
3
- import { APP_LAYOUT_BRIDGE_KEY, BODY_CONTENT_VIEWPORT_HEIGHT, SCOPE_VIEWPORT_MAX_HEIGHT } from "../../../inject/key.mjs";
3
+ import { APP_LAYOUT_BRIDGE_KEY, SCOPE_VIEWPORT_MAX_HEIGHT } from "../../../inject/key.mjs";
4
4
  import { useActivated } from "../../../hooks/activated.mjs";
5
5
  import { useObserveSize } from "../../../hooks/use-observe-size.mjs";
6
6
  import { SlotRegion } from "../../../config/slot-region.mjs";
@@ -68,11 +68,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
68
68
  )}px`
69
69
  };
70
70
  });
71
- const outerViewportHeight = inject(BODY_CONTENT_VIEWPORT_HEIGHT, void 0);
72
- const providedViewportHeight = computed(
73
- () => isDrawer.value ? drawerBodyHeight.value : (outerViewportHeight == null ? void 0 : outerViewportHeight.value) ?? 0
74
- );
75
- provide(BODY_CONTENT_VIEWPORT_HEIGHT, providedViewportHeight);
76
71
  const windowInnerHeight = ref(
77
72
  typeof window === "undefined" ? 0 : window.innerHeight
78
73
  );
@@ -1,7 +1,11 @@
1
- import { GLOBAL_MODAL_REMOTE_KEY } from "./keys.mjs";
1
+ import { GLOBAL_MODAL_REMOTE_KEY, definePageModal, useGlobalModalOpen, useGlobalModalRemote, usePageModalRemote } from "./keys.mjs";
2
2
  import { APP_GLOBAL_IMAGE_PREVIEW_KEY, APP_GLOBAL_VIDEO_PREVIEW_KEY } from "../../../config/modal-keys.mjs";
3
3
  export {
4
4
  APP_GLOBAL_IMAGE_PREVIEW_KEY,
5
5
  APP_GLOBAL_VIDEO_PREVIEW_KEY,
6
- GLOBAL_MODAL_REMOTE_KEY
6
+ GLOBAL_MODAL_REMOTE_KEY,
7
+ definePageModal,
8
+ useGlobalModalOpen,
9
+ useGlobalModalRemote,
10
+ usePageModalRemote
7
11
  };
@@ -1,7 +1,47 @@
1
+ import { inject, shallowRef } from "vue";
2
+ import { useIsDev } from "../../../hooks/use-is-dev.mjs";
1
3
  import injectInfo from "../../../injection-namespace.mjs";
2
4
  const GLOBAL_MODAL_REMOTE_KEY = Symbol.for(
3
5
  `${injectInfo.name}:GLOBAL_MODAL_REMOTE`
4
6
  );
7
+ const useGlobalModalRemote = () => inject(GLOBAL_MODAL_REMOTE_KEY, void 0);
8
+ const useGlobalModalOpen = () => {
9
+ const remote = useGlobalModalRemote();
10
+ const isDev = useIsDev();
11
+ return (key, ...args) => {
12
+ if (!(remote == null ? void 0 : remote.value)) {
13
+ if (isDev())
14
+ console.warn(
15
+ `[forge] 全局弹窗「${key}」没拉起:取不到全局弹窗遥控器(不在 AppLayout 之内)。`
16
+ );
17
+ return;
18
+ }
19
+ remote.value.open(key, ...args);
20
+ };
21
+ };
22
+ const usePageModalRemote = () => {
23
+ const remote = shallowRef();
24
+ const isDev = useIsDev();
25
+ const open = (key, ...args) => {
26
+ if (!remote.value) {
27
+ if (isDev())
28
+ console.warn(
29
+ `[forge] 页面私有弹窗「${key}」没拉起:遥控器为空——页面容器上没绑 v-model:modalRemote,或在页面容器挂载前调用。`
30
+ );
31
+ return;
32
+ }
33
+ remote.value.open(
34
+ key,
35
+ args[0]
36
+ );
37
+ };
38
+ return { remote, open };
39
+ };
40
+ const definePageModal = () => (entry) => entry;
5
41
  export {
6
- GLOBAL_MODAL_REMOTE_KEY
42
+ GLOBAL_MODAL_REMOTE_KEY,
43
+ definePageModal,
44
+ useGlobalModalOpen,
45
+ useGlobalModalRemote,
46
+ usePageModalRemote
7
47
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./VideoPreviewTrigger.vue2.mjs";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const VideoPreviewTrigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0ea80546"]]);
4
+ const VideoPreviewTrigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d4215094"]]);
5
5
  export {
6
6
  VideoPreviewTrigger as default
7
7
  };
@@ -1,4 +1 @@
1
- import { default as default2 } from "./TriggerAutoImport.vue.mjs";
2
- export {
3
- default2 as TriggerAutoImport
4
- };
1
+
@@ -1,4 +1,4 @@
1
- import { ref, computed, readonly, onMounted, onActivated, onDeactivated, onBeforeUnmount, watch } from "vue";
1
+ import { ref, computed, readonly, onMounted, onActivated, onDeactivated, onBeforeUnmount } from "vue";
2
2
  const useActivated = (watchFn) => {
3
3
  const activatedInfo = ref({
4
4
  isActivated: false,
@@ -27,38 +27,6 @@ const useActivated = (watchFn) => {
27
27
  activatedInfo: activatedInfoReadonly
28
28
  };
29
29
  };
30
- const useActivatedExec = (callback) => {
31
- const { activatedInfo } = useActivated();
32
- watch(
33
- activatedInfo,
34
- (info) => {
35
- if (info.isActivated) {
36
- callback(info);
37
- }
38
- },
39
- {
40
- immediate: true
41
- }
42
- );
43
- };
44
- const useActivatedEvent = (bind, unbind) => {
45
- const { activatedInfo } = useActivated();
46
- watch(
47
- activatedInfo,
48
- (info) => {
49
- if (info.isActivated) {
50
- bind(info);
51
- } else {
52
- unbind(info);
53
- }
54
- },
55
- {
56
- immediate: true
57
- }
58
- );
59
- };
60
30
  export {
61
- useActivated,
62
- useActivatedEvent,
63
- useActivatedExec
31
+ useActivated
64
32
  };
@@ -1,6 +1,6 @@
1
1
  import { useBreakpoint } from "./use-breakpoint.mjs";
2
2
  import { resolveBreakpointByWidth, resolveRootEl, useCustomBreakpoint } from "./use-custom-breakpoint.mjs";
3
- import { useActivated, useActivatedEvent, useActivatedExec } from "./activated.mjs";
3
+ import { useActivated } from "./activated.mjs";
4
4
  import { useFeelSize } from "./feel-size.mjs";
5
5
  import { useMenusDataDispatch } from "./menus-dispatch.mjs";
6
6
  import { useTimeout } from "./timeout.mjs";
@@ -16,8 +16,6 @@ export {
16
16
  resolveBreakpointByWidth,
17
17
  resolveRootEl,
18
18
  useActivated,
19
- useActivatedEvent,
20
- useActivatedExec,
21
19
  useBehaviorPort,
22
20
  useBreakpoint,
23
21
  useBridgeReport,
@@ -0,0 +1,18 @@
1
+ import { inject } from "vue";
2
+ import { CORE_BRIDGE_KEY } from "../inject/key.mjs";
3
+ import { useIsDev } from "./use-is-dev.mjs";
4
+ const LEGACY_COPY_CORE_BRIDGE_KEY = Symbol.for(
5
+ "@done-coding/admin-core:CORE_BRIDGE_KEY"
6
+ );
7
+ const useLegacyCopyCheck = () => {
8
+ const isDev = useIsDev();
9
+ if (!isDev()) return;
10
+ if (inject(CORE_BRIDGE_KEY, void 0)) return;
11
+ if (inject(LEGACY_COPY_CORE_BRIDGE_KEY, void 0) === void 0) return;
12
+ console.error(
13
+ "[forge] 应用里还有 0.104 及更早版本的 forge 副本:bridge 由旧版本注入,0.105 组件取不到。请把 @done-coding/forge 家族统一到同一版本,并检查 lockfile 里是否有重复副本。"
14
+ );
15
+ };
16
+ export {
17
+ useLegacyCopyCheck
18
+ };
@@ -210,16 +210,20 @@ const EP_STRUCTURAL_CSS = [
210
210
  ".el-dropdown__popper.el-popper .el-popper__arrow::before {",
211
211
  " border-color: var(--dc-core-border-color, var(--el-border-color-light));",
212
212
  "}",
213
- // ── 表格斑马纹加深(r4jsl6 ②)──
213
+ // ── 表格斑马纹加深(r4jsl6 ②;u2ql91 改取文字色)──
214
214
  // EP 原值 `--el-fill-color-lighter`:亮 `#fafafa` 对面 `#ffffff` 通道差仅 **5/5/5**、
215
215
  // 暗 `#1d1d1d` 对 `#141414` 仅 **9/9/9** —— 斑马纹的意义就是「长行易对齐」,Δ5 等于没做。
216
- // 取「主题边框色按比例混进面色」而非 EP 的固定灰档:边框色**随主题自动反转**
217
- // (亮色偏黑向 / 暗色偏白向),一份声明亮暗都成立,且换主题时跟着走
218
- // (EP 的 `--el-fill-color*` 是固定灰,彩色主题下会显脏)。
219
- // 40% 是实测取的:亮 Δ14/13/10、暗 Δ22/23/24 —— 暗色需要更大的差才读得出来,
220
- // 这个比例恰好让两边观感相当。[MUST NOT] 再往上调:超过 50% 斑马纹会读成「选中行」。
216
+ // 取「主文字色按小比例混进面色」:文字色在任何主题下都与面色反差最大、且随亮暗自动反转,
217
+ // 混进 6%(亮)/ 10%(暗)只让面色朝文字色轻移一档,单元格文字对它的对比度几乎不掉。
218
+ // 🔴 [MUST NOT] 改回「边框色混入」:极致对比、粗野混凝土这类主题的边框本就近黑,
219
+ // 按 40% 混进去隔行成了 60% 灰,常规文字对比只剩 2.15:1(u2ql91 全量实测,需求池 2s95wc 第 35 条)。
220
+ // 比例实测:亮 Δ约 12、暗 Δ约 21(暗色需要更大的差才读得出来);全部内置风格亮暗下
221
+ // 常规文字对隔行底色均 ≥ 4.5:1。[MUST NOT] 把比例调到 15% 以上:会读成「选中行」。
221
222
  ".el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {",
222
- " background: color-mix(in srgb, var(--dc-core-border-color, var(--el-border-color)) 40%, var(--el-bg-color));",
223
+ " background: color-mix(in srgb, var(--el-text-color-primary) 6%, var(--el-bg-color));",
224
+ "}",
225
+ ":root.dark .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {",
226
+ " background: color-mix(in srgb, var(--el-text-color-primary) 10%, var(--el-bg-color));",
223
227
  "}",
224
228
  // ── 占位符对比(r4jsl6 ③)——**只修亮色**(工单的暗色数据已实测更正)──
225
229
  // 实测:亮色 `#a8abb2` 对 `#fff` 仅 **2.30:1**,低于 WCAG AA 的 4.5:1;
package/es/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { FORM_CONFIG_SELECT_ALL_VALUE, getConfirmPasswordRule, passwordRule } fr
8
8
  import { countAll, createListApi, createListOnceApi, fetchListAll } from "./helpers/list-helper.mjs";
9
9
  import { useBreakpoint } from "./hooks/use-breakpoint.mjs";
10
10
  import { resolveBreakpointByWidth, resolveRootEl, useCustomBreakpoint } from "./hooks/use-custom-breakpoint.mjs";
11
- import { useActivated, useActivatedEvent, useActivatedExec } from "./hooks/activated.mjs";
11
+ import { useActivated } from "./hooks/activated.mjs";
12
12
  import { useFeelSize } from "./hooks/feel-size.mjs";
13
13
  import { useMenusDataDispatch } from "./hooks/menus-dispatch.mjs";
14
14
  import { useTimeout } from "./hooks/timeout.mjs";
@@ -19,7 +19,8 @@ import { buildRhythmCss, useCoreThemeApply } from "./hooks/use-theme-apply.mjs";
19
19
  import { useCoreViewportApply } from "./hooks/use-viewport-apply.mjs";
20
20
  import { useBridgeReport } from "./hooks/use-bridge-report.mjs";
21
21
  import { useBehaviorPort } from "./hooks/use-behavior-port.mjs";
22
- import { APP_LAYOUT_APP_STORE_KEY, APP_LAYOUT_BRIDGE_KEY, APP_LAYOUT_USER_STORE_KEY, APP_PAGE_CONTENT_INSET, APP_PAGE_LIST_DETAIL_CONTEXT, APP_PAGE_NAV_BAR_ACTIVE, BODY_CONTENT_VIEWPORT_HEIGHT, BODY_CONTENT_VIEWPORT_INSET, BODY_CONTENT_VIEWPORT_RECT, CORE_BRIDGE_KEY, FORM_NEST_REGISTRY_KEY, FORM_VALIDATE_ERROR_KEYS, NEST_LAYOUT_SCALE_KEY, SCOPE_VIEWPORT_MAX_HEIGHT, TABS_MAIN_VISUAL_LEVEL, getModalShelfInjectionKey } from "./inject/key.mjs";
22
+ import { APP_LAYOUT_APP_STORE_KEY, APP_LAYOUT_BRIDGE_KEY, APP_LAYOUT_USER_STORE_KEY, APP_PAGE_CONTENT_INSET, APP_PAGE_LIST_DETAIL_CONTEXT, APP_PAGE_NAV_BAR_ACTIVE, BODY_CONTENT_VIEWPORT_INSET, BODY_CONTENT_VIEWPORT_RECT, CORE_BRIDGE_KEY, FORM_NEST_REGISTRY_KEY, FORM_VALIDATE_ERROR_KEYS, MODAL_SHELF_INJECTION_KEYS, NEST_LAYOUT_SCALE_KEY, SCOPE_VIEWPORT_MAX_HEIGHT, TABS_MAIN_VISUAL_LEVEL } from "./inject/key.mjs";
23
+ import { createViewportChannel } from "./inject/viewport-channel.mjs";
23
24
  import { createGuard } from "./router/guard/index.mjs";
24
25
  import { withGroupRedirect } from "./router/group-redirect.mjs";
25
26
  import { createUserStore } from "./store/user.mjs";
@@ -50,11 +51,10 @@ import { default as default15 } from "./components/data/modal-image-preview/Moda
50
51
  import { default as default16 } from "./components/feedback/action-confirm/ActionConfirm.vue.mjs";
51
52
  import { default as default17 } from "./components/feedback/modal-confirm/ModalConfirm.vue.mjs";
52
53
  import { default as default18 } from "./components/feedback/modal-video-preview/ModalVideoPreview.vue.mjs";
53
- import { GLOBAL_MODAL_REMOTE_KEY } from "./components/feedback/preview-keys/keys.mjs";
54
+ import { GLOBAL_MODAL_REMOTE_KEY, definePageModal, useGlobalModalOpen, useGlobalModalRemote, usePageModalRemote } from "./components/feedback/preview-keys/keys.mjs";
54
55
  import { default as default19 } from "./components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.mjs";
55
56
  import { default as default20 } from "./components/other/auto-refresh/AutoRefresh.vue.mjs";
56
57
  import { default as default21 } from "./components/other/auto-refresh-group/AutoRefreshGroup.vue.mjs";
57
- import { default as default22 } from "./components/other/TriggerAutoImport.vue.mjs";
58
58
  import { BADGE_MASK_KINDS } from "./bridge/badge.mjs";
59
59
  import { BEHAVIOR_DEFAULT_EVENTS, createBehaviorPort } from "./bridge/behavior.mjs";
60
60
  import { BridgeEventName, KNOWN_BRIDGE_EVENTS } from "./bridge/contracts/event.mjs";
@@ -85,7 +85,6 @@ export {
85
85
  BADGE_KEY_ATTR,
86
86
  BADGE_MASK_KINDS,
87
87
  BEHAVIOR_DEFAULT_EVENTS,
88
- BODY_CONTENT_VIEWPORT_HEIGHT,
89
88
  BODY_CONTENT_VIEWPORT_INSET,
90
89
  BODY_CONTENT_VIEWPORT_RECT,
91
90
  default12 as BadgeMark,
@@ -103,6 +102,7 @@ export {
103
102
  default5 as HeightProvider,
104
103
  default14 as ImagePreviewTrigger,
105
104
  KNOWN_BRIDGE_EVENTS,
105
+ MODAL_SHELF_INJECTION_KEYS,
106
106
  default17 as ModalConfirm,
107
107
  default15 as ModalImagePreview,
108
108
  default18 as ModalVideoPreview,
@@ -116,7 +116,6 @@ export {
116
116
  SlotRegion,
117
117
  TABS_MAIN_VISUAL_LEVEL,
118
118
  TabsMainReplaceQueryKey,
119
- default22 as TriggerAutoImport,
120
119
  default19 as VideoPreviewTrigger,
121
120
  default10 as WatchSize,
122
121
  buildRhythmCss,
@@ -135,6 +134,8 @@ export {
135
134
  createStorageWithNamespace,
136
135
  createUseState,
137
136
  createUserStore,
137
+ createViewportChannel,
138
+ definePageModal,
138
139
  domClosestScrollableAncestor,
139
140
  domClosestStickyScrollport,
140
141
  domScrollIntoViewport,
@@ -145,7 +146,6 @@ export {
145
146
  gapScaleValue,
146
147
  getConfirmPasswordRule,
147
148
  getId,
148
- getModalShelfInjectionKey,
149
149
  getRoutePermissionKey,
150
150
  getRoutePermissionRequirement,
151
151
  parseSlotRegion,
@@ -167,8 +167,6 @@ export {
167
167
  themeScaleToRgba,
168
168
  timeCountDown,
169
169
  useActivated,
170
- useActivatedEvent,
171
- useActivatedExec,
172
170
  useBehaviorPort,
173
171
  useBreakpoint,
174
172
  useBridgeReport,
@@ -177,8 +175,11 @@ export {
177
175
  useCoreViewportApply,
178
176
  useCustomBreakpoint,
179
177
  useFeelSize,
178
+ useGlobalModalOpen,
179
+ useGlobalModalRemote,
180
180
  useMenusDataDispatch,
181
181
  useObserveSize,
182
+ usePageModalRemote,
182
183
  usePermission,
183
184
  useTimeout,
184
185
  withGroupRedirect
@@ -1,4 +1,5 @@
1
- import { APP_LAYOUT_APP_STORE_KEY, APP_LAYOUT_BRIDGE_KEY, APP_LAYOUT_USER_STORE_KEY, APP_PAGE_CONTENT_INSET, APP_PAGE_LIST_DETAIL_CONTEXT, APP_PAGE_NAV_BAR_ACTIVE, BODY_CONTENT_VIEWPORT_HEIGHT, BODY_CONTENT_VIEWPORT_INSET, BODY_CONTENT_VIEWPORT_RECT, CORE_BRIDGE_KEY, FORM_NEST_REGISTRY_KEY, FORM_VALIDATE_ERROR_KEYS, NEST_LAYOUT_SCALE_KEY, SCOPE_VIEWPORT_MAX_HEIGHT, TABS_MAIN_VISUAL_LEVEL, getModalShelfInjectionKey } from "./key.mjs";
1
+ import { APP_LAYOUT_APP_STORE_KEY, APP_LAYOUT_BRIDGE_KEY, APP_LAYOUT_USER_STORE_KEY, APP_PAGE_CONTENT_INSET, APP_PAGE_LIST_DETAIL_CONTEXT, APP_PAGE_NAV_BAR_ACTIVE, BODY_CONTENT_VIEWPORT_INSET, BODY_CONTENT_VIEWPORT_RECT, CORE_BRIDGE_KEY, FORM_NEST_REGISTRY_KEY, FORM_VALIDATE_ERROR_KEYS, MODAL_SHELF_INJECTION_KEYS, NEST_LAYOUT_SCALE_KEY, SCOPE_VIEWPORT_MAX_HEIGHT, TABS_MAIN_VISUAL_LEVEL } from "./key.mjs";
2
+ import { createViewportChannel } from "./viewport-channel.mjs";
2
3
  export {
3
4
  APP_LAYOUT_APP_STORE_KEY,
4
5
  APP_LAYOUT_BRIDGE_KEY,
@@ -6,14 +7,14 @@ export {
6
7
  APP_PAGE_CONTENT_INSET,
7
8
  APP_PAGE_LIST_DETAIL_CONTEXT,
8
9
  APP_PAGE_NAV_BAR_ACTIVE,
9
- BODY_CONTENT_VIEWPORT_HEIGHT,
10
10
  BODY_CONTENT_VIEWPORT_INSET,
11
11
  BODY_CONTENT_VIEWPORT_RECT,
12
12
  CORE_BRIDGE_KEY,
13
13
  FORM_NEST_REGISTRY_KEY,
14
14
  FORM_VALIDATE_ERROR_KEYS,
15
+ MODAL_SHELF_INJECTION_KEYS,
15
16
  NEST_LAYOUT_SCALE_KEY,
16
17
  SCOPE_VIEWPORT_MAX_HEIGHT,
17
18
  TABS_MAIN_VISUAL_LEVEL,
18
- getModalShelfInjectionKey
19
+ createViewportChannel
19
20
  };
package/es/inject/key.mjs CHANGED
@@ -1,8 +1,5 @@
1
1
  import injectInfo from "../injection-namespace.mjs";
2
2
  const nsKey = (key) => `${injectInfo.name}:${key}`;
3
- const BODY_CONTENT_VIEWPORT_HEIGHT = Symbol.for(
4
- nsKey("BODY_CONTENT_VIEWPORT_HEIGHT")
5
- );
6
3
  const SCOPE_VIEWPORT_MAX_HEIGHT = Symbol.for(
7
4
  nsKey("SCOPE_VIEWPORT_MAX_HEIGHT")
8
5
  );
@@ -18,11 +15,13 @@ const APP_PAGE_NAV_BAR_ACTIVE = Symbol.for(
18
15
  const APP_PAGE_CONTENT_INSET = Symbol.for(
19
16
  nsKey("APP_PAGE_CONTENT_INSET")
20
17
  );
21
- function getModalShelfInjectionKey(level) {
22
- return Symbol.for(
23
- nsKey(`MODAL_SHELF_${level}`)
24
- );
25
- }
18
+ const MODAL_SHELF_INJECTION_KEYS = Object.freeze({
19
+ app: Symbol.for(nsKey("MODAL_SHELF_app")),
20
+ page: Symbol.for(nsKey("MODAL_SHELF_page")),
21
+ custom: Symbol.for(
22
+ nsKey("MODAL_SHELF_custom")
23
+ )
24
+ });
26
25
  const TABS_MAIN_VISUAL_LEVEL = Symbol.for(
27
26
  nsKey("TABS_MAIN_VISUAL_LEVEL")
28
27
  );
@@ -57,14 +56,13 @@ export {
57
56
  APP_PAGE_CONTENT_INSET,
58
57
  APP_PAGE_LIST_DETAIL_CONTEXT,
59
58
  APP_PAGE_NAV_BAR_ACTIVE,
60
- BODY_CONTENT_VIEWPORT_HEIGHT,
61
59
  BODY_CONTENT_VIEWPORT_INSET,
62
60
  BODY_CONTENT_VIEWPORT_RECT,
63
61
  CORE_BRIDGE_KEY,
64
62
  FORM_NEST_REGISTRY_KEY,
65
63
  FORM_VALIDATE_ERROR_KEYS,
64
+ MODAL_SHELF_INJECTION_KEYS,
66
65
  NEST_LAYOUT_SCALE_KEY,
67
66
  SCOPE_VIEWPORT_MAX_HEIGHT,
68
- TABS_MAIN_VISUAL_LEVEL,
69
- getModalShelfInjectionKey
67
+ TABS_MAIN_VISUAL_LEVEL
70
68
  };
@@ -0,0 +1,4 @@
1
+ const createViewportChannel = (name = "viewport-channel") => Symbol(name);
2
+ export {
3
+ createViewportChannel
4
+ };
@@ -1,4 +1,4 @@
1
- const injectInfo = { name: "@done-coding/admin-core" };
1
+ const injectInfo = { name: "@done-coding/forge-core" };
2
2
  export {
3
3
  injectInfo as default
4
4
  };
@@ -3,6 +3,7 @@ import { createBridgeEventHook } from "../bridge/event.mjs";
3
3
  import { activeRecordValueOf, useActiveRecord } from "../hooks/use-active-record.mjs";
4
4
  import { useContextDefaults } from "../hooks/use-context-defaults.mjs";
5
5
  import { useIsDev } from "../hooks/use-is-dev.mjs";
6
+ import { useLegacyCopyCheck } from "../hooks/use-legacy-copy-check.mjs";
6
7
  import { useSurface } from "../hooks/use-surface.mjs";
7
8
  export {
8
9
  BADGE_MASK_KINDS,
@@ -12,5 +13,6 @@ export {
12
13
  useActiveRecord,
13
14
  useContextDefaults,
14
15
  useIsDev,
16
+ useLegacyCopyCheck,
15
17
  useSurface
16
18
  };
@@ -8,7 +8,7 @@ const buildGroupRoutes = (routes, onParentComponent) => routes.map((route) => {
8
8
  const hasComponent = !!(node.component || node.components);
9
9
  const hasChildren = !!((_b = node.children) == null ? void 0 : _b.length);
10
10
  if (hasChildren && hasComponent) {
11
- const message = `[admin-core] withGroupRedirect: 路由 "${node.path}" 同时含 children 与 component/components——当前范式不建议父路由承接视图(组壳会被 KeepAlive 误缓存、且需内层 router-view)。建议父路由不配 component(叶子经 vue-router 原生渲染到 AppBody 出口);如需与子路由共享父视图,请改用 teleport 方案。`;
11
+ const message = `[forge] withGroupRedirect: 路由 "${node.path}" 同时含 children 与 component/components——当前范式不建议父路由承接视图(组壳会被 KeepAlive 误缓存、且需内层 router-view)。建议父路由不配 component(叶子经 vue-router 原生渲染到 AppBody 出口);如需与子路由共享父视图,请改用 teleport 方案。`;
12
12
  if (onParentComponent === "error") {
13
13
  throw new Error(message);
14
14
  }
package/es/store/app.mjs CHANGED
@@ -12,7 +12,7 @@ function createAppStore(deps) {
12
12
  const sidebarHasMenus = ref(false);
13
13
  const sidebarCollapsedEffective = computed(() => {
14
14
  if (bridge.APP_LAYOUT_SIDEBAR_CONFIG.menuGroupMode) return false;
15
- return bridge.layout.sidebarCollapsed.value;
15
+ return bridge.themeLayout.value.sidebarCollapsed ?? bridge.layout.sidebarCollapsed.value;
16
16
  });
17
17
  const sidebarWidth = computed(() => {
18
18
  return sidebarCollapsedEffective.value ? bridge.APP_LAYOUT_SIDEBAR_CONFIG.collapseWidth : bridge.APP_LAYOUT_SIDEBAR_CONFIG.width;
@@ -31,7 +31,7 @@ function createAppStore(deps) {
31
31
  const showFooter = computed(
32
32
  () => {
33
33
  var _a;
34
- return ((_a = pageLayout.value) == null ? void 0 : _a.footer) ?? bridge.APP_ROUTER_META_DEFAULT_CONFIG.showFooter;
34
+ return ((_a = pageLayout.value) == null ? void 0 : _a.footer) ?? bridge.APP_LAYOUT_FOOTER_CONFIG.defaultShow ?? bridge.APP_ROUTER_META_DEFAULT_CONFIG.showFooter;
35
35
  }
36
36
  );
37
37
  const hasHeader = computed(
@@ -58,12 +58,6 @@ function createAppStore(deps) {
58
58
  return ((_a = pageLayout.value) == null ? void 0 : _a.breadcrumb) ?? bridge.APP_ROUTER_META_DEFAULT_CONFIG.showBreadcrumb;
59
59
  }
60
60
  );
61
- const bodyShimPadding = computed(
62
- () => {
63
- var _a;
64
- return ((_a = pageLayout.value) == null ? void 0 : _a.bodyShimPadding) ?? bridge.APP_LAYOUT_BODY_CONFIG.shimPadding ?? 0;
65
- }
66
- );
67
61
  const viewportConfigEffective = computed(
68
62
  () => {
69
63
  var _a;
@@ -205,8 +199,6 @@ function createAppStore(deps) {
205
199
  // **内容接替的是 chrome 的角色(最外层元素)**,就该拿 chrome 那一档。
206
200
  // ⚠️ 底边(`paddingBottom`)暂未改:它是**无条件**的(footer 在流内),
207
201
  // 动它全仓每页都变,[MUST] 由甲方拍板 —— 见回池条目。
208
- // 它同时**接替了已废弃的 shimPadding** —— 此前这段留白由
209
- // `gap + shimPadding` 两处各给一半,同一段空白两个来源正是要消除的冗余。
210
202
  // 内容左让位:外框左 + 外圈;有 sidebar 再加 sidebar 宽(sidebar 自身左边已让模块档)。
211
203
  paddingLeft: showSidebar.value ? `calc(${viewportPadding.value.left} + ${gpx.value} + ${sidebarStyle.value.width} + ${bodyEdgeGapPx(true)})` : (
212
204
  // 无 sidebar ⇒ 内容就是最外层,取模块档(同 contentTop 的注释,r8kvnd)
@@ -252,7 +244,6 @@ function createAppStore(deps) {
252
244
  minHeight: `calc(100vh - ${viewportPadding.value.top} - ${viewportPadding.value.bottom} - ${topSub} - ${outerPx.value}${headerSub}${footerSub})`
253
245
  // 🔴 **不铺 padding**(huhyx7 A 条):四周留白已由 bodyStyle 的外圈档给过,
254
246
  // 这里再铺一层就是同一段空白两个来源 —— 那正是本批要消除的冗余。
255
- // 原 `shimPadding` 已废弃(见 APP_LAYOUT_BODY_CONFIG.shimPadding 的 @deprecated)。
256
247
  };
257
248
  });
258
249
  const changeSidebarCollapseStatus = (status) => {
@@ -264,13 +255,9 @@ function createAppStore(deps) {
264
255
  const changeSidebarHasMenusStatus = (status) => {
265
256
  sidebarHasMenus.value = status;
266
257
  };
267
- const changeIsDarkTheme = (status) => {
268
- bridge.theme.setDark(status);
269
- };
270
258
  return {
271
259
  name,
272
260
  isDarkTheme: computed(() => bridge.themeIsDark.value),
273
- theme,
274
261
  showHeader,
275
262
  showFooter,
276
263
  showSidebar,
@@ -283,7 +270,6 @@ function createAppStore(deps) {
283
270
  asideStyle,
284
271
  bodyStyle,
285
272
  contentViewportInset,
286
- bodyShimPadding,
287
273
  bodyShimStyle,
288
274
  viewportPadding,
289
275
  viewportConfigEffective,
@@ -295,8 +281,7 @@ function createAppStore(deps) {
295
281
  asideIsCollapse: computed(() => bridge.layout.asideCollapsed.value),
296
282
  changeSidebarCollapseStatus,
297
283
  changeAsideCollapseStatus,
298
- changeSidebarHasMenusStatus,
299
- changeIsDarkTheme
284
+ changeSidebarHasMenusStatus
300
285
  };
301
286
  };
302
287
  return defineStore("APP", storeSetup);