@done-coding/admin-core 0.12.1 → 0.12.2-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 (128) hide show
  1. package/README.md +1 -48
  2. package/es/bridge/index.mjs +75 -72
  3. package/es/bridge/layout.mjs +51 -0
  4. package/es/bridge/theme/index.mjs +1 -1
  5. package/es/bridge/theme/persist.mjs +1 -1
  6. package/es/components/app-layout/AppAside.vue.mjs +2 -2
  7. package/es/components/app-layout/AppAside.vue2.mjs +27 -10
  8. package/es/components/app-layout/AppCollapseToggle.vue.mjs +7 -0
  9. package/es/components/app-layout/AppCollapseToggle.vue2.mjs +54 -0
  10. package/es/components/app-layout/AppFooter.vue.mjs +1 -1
  11. package/es/components/app-layout/AppHeader.vue.mjs +3 -3
  12. package/es/components/app-layout/AppHeader.vue2.mjs +1 -1
  13. package/es/components/app-layout/AppLayout.vue.mjs +2 -2
  14. package/es/components/app-layout/AppLayout.vue2.mjs +3 -3
  15. package/es/components/app-layout/AppSidebar.vue.mjs +2 -2
  16. package/es/components/app-layout/AppSidebar.vue2.mjs +41 -61
  17. package/es/components/app-layout/AppTheme.vue.mjs +3 -3
  18. package/es/components/app-layout/viewport.mjs +3 -3
  19. package/es/components/display/TabsHeader.vue.mjs +4 -4
  20. package/es/components/form/FormItemNestForm.vue.mjs +2 -2
  21. package/es/components/form/FormItemNestFormList.vue.mjs +2 -2
  22. package/es/components/form/FormSubmitPanel.vue.mjs +1 -1
  23. package/es/components/form/FormVerifyImage.vue.mjs +1 -1
  24. package/es/components/table/TableToolbar.vue.mjs +3 -3
  25. package/es/hooks/{use-admin-theme-apply.mjs → use-theme-apply.mjs} +62 -62
  26. package/es/hooks/use-viewport-apply.mjs +39 -0
  27. package/es/index.mjs +88 -88
  28. package/es/inject/key.mjs +13 -13
  29. package/es/store/app.mjs +69 -62
  30. package/es/style.css +1 -1
  31. package/package.json +6 -8
  32. package/types/bridge/config-hook.d.ts +0 -68
  33. package/types/bridge/index.d.ts +18 -417
  34. package/types/bridge/layout.d.ts +25 -0
  35. package/types/bridge/plugin.d.ts +12 -30
  36. package/types/bridge/route.d.ts +1 -20
  37. package/types/bridge/state.d.ts +0 -14
  38. package/types/bridge/storage.d.ts +0 -9
  39. package/types/bridge/theme/index.d.ts +1 -8
  40. package/types/bridge/theme/persist.d.ts +3 -15
  41. package/types/bridge/theme/system-dark.d.ts +0 -12
  42. package/types/bridge/theme/types.d.ts +27 -265
  43. package/types/components/app-layout/AppAside.vue.d.ts +0 -1
  44. package/types/components/app-layout/AppCollapseToggle.vue.d.ts +11 -0
  45. package/types/components/app-layout/AppHeader.vue.d.ts +0 -3
  46. package/types/components/app-layout/AppLayout.vue.d.ts +0 -12
  47. package/types/components/app-layout/AppPage.vue.d.ts +0 -2
  48. package/types/components/app-layout/AppSidebar.vue.d.ts +0 -2
  49. package/types/components/app-layout/types.d.ts +2 -127
  50. package/types/components/app-layout/viewport.d.ts +2 -30
  51. package/types/components/data-view/DataListViewItem.vue.d.ts +0 -8
  52. package/types/components/data-view/index.d.ts +0 -4
  53. package/types/components/data-view/types.d.ts +0 -41
  54. package/types/components/data-view/utils.d.ts +0 -3
  55. package/types/components/display/TabsHeader.vue.d.ts +0 -2
  56. package/types/components/display/TabsMain.vue.d.ts +0 -2
  57. package/types/components/display/TabsRefineFlow.vue.d.ts +0 -1
  58. package/types/components/display/index.d.ts +1 -37
  59. package/types/components/display/types.d.ts +0 -131
  60. package/types/components/form/FormItemNestForm.vue.d.ts +0 -5
  61. package/types/components/form/FormItemNestFormList.vue.d.ts +0 -17
  62. package/types/components/form/FormVerifyCode.vue.d.ts +0 -9
  63. package/types/components/form/FormVerifyImage.vue.d.ts +0 -1
  64. package/types/components/form/form-search-utils.d.ts +0 -14
  65. package/types/components/form/nest-form-item-list.d.ts +0 -28
  66. package/types/components/form/nest-form-item.d.ts +0 -21
  67. package/types/components/form/nest-registry.d.ts +0 -14
  68. package/types/components/form/types.d.ts +8 -185
  69. package/types/components/form/use-form-submit.d.ts +0 -12
  70. package/types/components/form/use-nest-form-list.d.ts +0 -13
  71. package/types/components/form/use-nest-form.d.ts +0 -15
  72. package/types/components/form/use-nest-layout-scale.d.ts +0 -12
  73. package/types/components/form/utils.d.ts +1 -56
  74. package/types/components/list-page/ListPage.vue.d.ts +0 -6
  75. package/types/components/list-page/types.d.ts +2 -19
  76. package/types/components/misc/index.d.ts +1 -6
  77. package/types/components/misc/types.d.ts +0 -6
  78. package/types/components/modal/ConfirmModal.vue.d.ts +0 -10
  79. package/types/components/modal/modal-shelf-core.d.ts +0 -3
  80. package/types/components/modal/modal-shelf-hierarchy.d.ts +0 -4
  81. package/types/components/modal/modal-shelf-types.d.ts +0 -34
  82. package/types/components/modal/types.d.ts +1 -20
  83. package/types/components/panel/PanelItemNestForm.vue.d.ts +0 -6
  84. package/types/components/panel/PanelItemNestPanel.vue.d.ts +0 -5
  85. package/types/components/panel/nest-panel-form.d.ts +0 -21
  86. package/types/components/panel/nest-panel-item.d.ts +0 -14
  87. package/types/components/panel/types.d.ts +1 -49
  88. package/types/components/table/types.d.ts +9 -124
  89. package/types/config/list-model.d.ts +0 -29
  90. package/types/config/route.d.ts +0 -2
  91. package/types/helpers/form.d.ts +0 -5
  92. package/types/helpers/list-helper.d.ts +0 -26
  93. package/types/helpers/types.d.ts +0 -11
  94. package/types/hooks/activated.d.ts +0 -10
  95. package/types/hooks/feel-size.d.ts +0 -2
  96. package/types/hooks/index.d.ts +2 -2
  97. package/types/hooks/menus-dispatch.d.ts +0 -4
  98. package/types/hooks/timeout.d.ts +0 -4
  99. package/types/hooks/use-channel-viewport-height.d.ts +0 -14
  100. package/types/hooks/use-theme-apply.d.ts +11 -0
  101. package/types/hooks/use-viewport-apply.d.ts +8 -0
  102. package/types/inject/key.d.ts +2 -87
  103. package/types/router/guard/index.d.ts +0 -13
  104. package/types/router/guard/login.d.ts +0 -1
  105. package/types/router/guard/permission.d.ts +0 -1
  106. package/types/router/guard/types.d.ts +2 -5
  107. package/types/store/app.d.ts +10 -31
  108. package/types/store/router-permission.d.ts +2 -55
  109. package/types/store/user.d.ts +2 -26
  110. package/types/types/dot-path.d.ts +0 -8
  111. package/types/types/route.d.ts +0 -45
  112. package/types/types/utility-types.d.ts +0 -7
  113. package/types/utils/export.d.ts +1 -16
  114. package/types/utils/id.d.ts +0 -1
  115. package/types/utils/router.d.ts +0 -2
  116. package/types/utils/theme-scale.d.ts +0 -31
  117. package/types/utils/time.d.ts +0 -1
  118. package/docs/TECH_SNAPSHOT.md +0 -146
  119. package/docs/nested-config-paradigm.md +0 -80
  120. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/RETROSPECTIVE.md +0 -63
  121. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/design.md +0 -575
  122. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/landing-authorizations/2026-05-09-080900-/346/234/2371-/345/205/245/345/256/236/346/226/275/346/216/210/346/235/203.md +0 -107
  123. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/project-orchestration.md +0 -58
  124. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/requirements.md +0 -238
  125. package/docs/specs/2026-05-09-055250-moderate-/345/210/227/350/241/250key/351/205/215/347/275/256/347/202/271/350/267/257/345/276/204/346/224/257/346/214/201/tasks.md +0 -290
  126. package/es/hooks/use-admin-viewport-apply.mjs +0 -39
  127. package/types/hooks/use-admin-theme-apply.d.ts +0 -34
  128. package/types/hooks/use-admin-viewport-apply.d.ts +0 -20
@@ -3,631 +3,232 @@ import { RouteRecordRaw } from 'vue-router';
3
3
  import { createUseState } from './state';
4
4
  import { createGenerateRouteMetaRawTree } from './route';
5
5
  import { UpdatableConfigKey, UpdatableConfigMap } from './config-hook';
6
- import { AdminBridgePluginLike } from './plugin';
7
- import { AdminThemeModule, AdminThemeMode, AdminThemeDensity, AdminThemeMotion, BridgeThemeLayoutState } from './theme';
6
+ import { CoreBridgePluginLike } from './plugin';
7
+ import { CoreThemeModule, CoreThemeMode, CoreThemeDensity, CoreThemeMotion, BridgeThemeLayoutState } from './theme';
8
+ import { CoreLayoutModule } from './layout';
8
9
  export { createUseState, type UseStateOptions } from './state';
9
10
  export { createGenerateRouteMetaRawTree, type RouteMetaDefaultConfig, } from './route';
10
11
  export { createStorageWithNamespace } from './storage';
11
- export type { AdminThemeEntry, AdminThemeLifecycleContext, AdminThemeLifecycleHooks, AdminConfigDescription, AdminThemeModule, AdminThemeMode, AdminThemeDensity, AdminThemeMotion, ElSize, AdminThemeComponentDefaults, AdminThemePresetLayout, BridgeThemeLayoutState, BridgeThemeLayoutBaseline, BridgeThemeHook, } from './theme';
12
- /**
13
- * 认证桥接无状态纯工厂。
14
- *
15
- * core 模块级零状态——每次调用 `createAdminBridge({...})` 在函数作用域内新建一组
16
- * 闭包变量,传入 init 参数立即初始化,返回可直接使用的实例。core [MUST NOT] 持
17
- * 已实例化单例(避免 dist/src 双 module instance 分裂,规避机制见 design §2.3,
18
- * 结构上不持单例,[MUST NOT] 用 Symbol.for / globalThis 兜底)。
19
- */
20
- /**
21
- * register 入参类型,全字段 optional + 「有值才更新」增量合并。
22
- *
23
- * #4e 增 4 个增量可选业务 api(loginApi/logoutApi/getUserInfoApi/refreshTokenApi),
24
- * 由 `createUserStore` 薄壳侧 register 注入;getToken/refreshToken/refreshAuth 由
25
- * `createUserStore` core 工厂 setup 内自 register(裁决 2/3)。
26
- */
27
- export interface AdminBridgeRegisterOptions<UserInfo = unknown, LoginParams = unknown> {
28
- /** 取 token(v3 终锁 BR-1 ③ 终裁:零参 facade——core 对 UserInfo 不透明 + 拦截器无 info 源,泛型 `<UserInfo>` 纯透传不沾 getToken 签名) */
12
+ export type { CoreThemeEntry, CoreThemeLifecycleContext, CoreThemeLifecycleHooks, CoreConfigDescription, CoreThemeModule, CoreThemeMode, CoreThemeDensity, CoreThemeMotion, ElSize, CoreThemeComponentDefaults, CoreThemePresetLayout, BridgeThemeLayoutState, BridgeThemeLayoutBaseline, BridgeThemeHook, } from './theme';
13
+ export type { CoreLayoutModule, BridgeLayoutHook, BridgeLayoutInit, LayoutCollapsePersistShape, } from './layout';
14
+ export interface CoreBridgeRegisterOptions<UserInfo = unknown, LoginParams = unknown> {
29
15
  getToken?: () => string | undefined;
30
- /** 跳转登录 */
31
16
  goToLogin?: () => void;
32
- /** 刷新 token */
33
17
  refreshToken?: () => Promise<unknown>;
34
- /** 刷新鉴权(重新拉取用户信息) */
35
18
  refreshAuth?: () => Promise<unknown>;
36
- /** 登录 api(对应 app accountLogin;#2.7 期 axios `{data}` wrapper 业务层 wrap 剥离,core 直读 UserInfo),增量可选 */
37
19
  loginApi?: (params: LoginParams) => Promise<Partial<UserInfo>>;
38
- /** 退出登录 api(对应 app accountLogout),增量可选 */
39
20
  logoutApi?: () => Promise<unknown>;
40
- /** 取用户信息 api(对应 app getLoginAccountInfo;#2.7 期 axios `{data}` wrapper 业务层 wrap 剥离;{user_info} 连壳历史语义在业务层 wrap 决定是否保留 D2),增量可选 */
41
21
  getUserInfoApi?: () => Promise<Partial<UserInfo>>;
42
- /** 刷新 token api(#C 期签名最简化:core 不感知业务 shape,直传 refreshToken string;业务方 wrap 内自打包业务约定的入参 shape,如 `{Authorization: rt}`),增量可选 */
43
22
  refreshTokenApi?: (refreshToken: string) => Promise<string>;
44
23
  }
45
- export type { AdminBridgePlugin, AdminBridgePluginBridgeSlice, AdminBridgePluginContext, AdminBridgePluginInstall, AdminBridgePluginLike, } from './plugin';
46
- /**
47
- * pinia persist storage 适配器最小接口。
48
- *
49
- * 仅约束 `store/app.ts` persist 适配器实际依赖的三方法,是浏览器 `Storage`
50
- * 的结构子集——`createStorageWithNamespace()` 返回的命名空间 Storage 可直接赋值兼容。
51
- */
24
+ export type { CoreBridgePlugin, CoreBridgePluginBridgeSlice, CoreBridgePluginContext, CoreBridgePluginInstall, CoreBridgePluginLike, } from './plugin';
52
25
  export interface StorageLike {
53
- /** 读取键值,未命中返回 null */
54
26
  getItem: (key: string) => string | null;
55
- /** 写入键值 */
56
27
  setItem: (key: string, value: string) => void;
57
- /** 删除键值 */
58
28
  removeItem: (key: string) => void;
59
29
  }
60
- /**
61
- * 应用主题颜色类型。
62
- *
63
- * 镜像 app 端 `@/config` `AppThemeColor` 全字段——store/app 的 `theme`
64
- * computed 透出后由 app-layout 消费点访问 `primaryColor` 等全字段,故 [MUST]
65
- * 完整镜像,[MUST NOT] 收窄到 store/app 体内直接读的子集(否则消费点 TS2339)。
66
- */
67
30
  export interface AppThemeColor {
68
- /** 背景色 */
69
31
  bodyColor: string;
70
- /** 基础色 */
71
32
  baseColor: string;
72
- /** 主色调 */
73
33
  primaryColor: string;
74
- /** 成功色 */
75
34
  successColor: string;
76
- /** 警告色 */
77
35
  warningColor: string;
78
- /** 危险色 */
79
36
  dangerColor: string;
80
- /** 错误色 */
81
37
  errorColor: string;
82
- /** 信息色 */
83
38
  infoColor: string;
84
- /** 圆角(风格可选;core 挂 --admin-core-radius + --el-border-radius-base) */
85
39
  radius?: string;
86
- /** 边框色(风格可选;core 挂 --admin-core-border-color + --el-border-color) */
87
40
  borderColor?: string;
88
- /** 阴影(风格可选;core 挂 --admin-core-shadow + --el-box-shadow) */
89
41
  shadow?: string;
90
- /** 边框宽(风格可选;core 挂 --admin-core-border-width + --el-border-width) */
91
42
  borderWidth?: string;
92
- /** 强调色(风格可选;core 仅挂 --admin-core-accent,EP 无对应) */
93
43
  accent?: string;
94
- /** 辉光(风格可选;core 仅挂 --admin-core-glow,EP 无对应) */
95
44
  glow?: string;
96
- /** 模糊(风格可选;core 仅挂 --admin-core-blur,EP 无对应) */
97
45
  blur?: string;
98
- /** 聚焦环(风格可选;core 仅挂 --admin-core-focus-ring,EP 无对应) */
99
46
  focusRing?: string;
100
- /** 表面色(风格可选;core 仅挂 --admin-core-surface,EP 无对应) */
101
47
  surface?: string;
102
48
  }
103
- /**
104
- * 布局模块 `style` 逃生舱排除的「引擎托管键」联合(甲方终锁键集)。
105
- *
106
- * 这些 CSS 属性由布局引擎(store/app 几何 calc + 主题色兜底 + fixed 定位 + sidebar/aside
107
- * 让位)独占计算,消费方 `style` [MUST NOT] 染指——否则破布局。分类:
108
- * - 尺寸:width / height(几何算)
109
- * - 定位:position / top / right / bottom / left / inset(fixed 锚点)
110
- * - 显示 / 盒外:display(破布局流)/ margin 家族(破 fixed 定位)
111
- * - 盒内:padding 家族(sidebar/aside 用 paddingTop 让位 header,整族锁防破让位)
112
- * - 颜色:color / background / backgroundColor(走 config.color|background + --admin-core-* 兜底,规则 14)
113
- */
114
49
  type AppLayoutManagedStyleKey = "width" | "height" | "position" | "top" | "right" | "bottom" | "left" | "inset" | "display" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "color" | "background" | "backgroundColor";
115
- /**
116
- * 布局模块(Header/Footer/Sidebar/Aside)`style` 逃生舱类型。
117
- *
118
- * = `Omit<CSSProperties, 托管键>`——消费方显式自定义装饰(borderRadius / boxShadow /
119
- * border / backdropFilter / opacity / transition 等),走规则 14「组件 prop 显式自定义值
120
- * → 内联 :style 直值」例外条款。托管键经类型 `Omit` 编译期拦截 + store 合并运行时压过(双保险)。
121
- */
122
50
  export type AppLayoutModuleStyle = Omit<CSSProperties, AppLayoutManagedStyleKey>;
123
- /**
124
- * `store/app.ts` 实际消费的 app config 子集结构。
125
- *
126
- * 字段名与层级镜像 app 端 `@/config` 原结构([MUST NOT] 重命名);覆盖
127
- * store/app 现消费字段(含 `theme` 透出后消费点所需全字段),[MUST NOT] 扩面
128
- * 到全量 app config。core 不能 import app,故在此显式定义等价 interface。
129
- */
130
51
  export interface AppConfig {
131
- /** 应用基础信息(store/app 仅取 name) */
132
52
  APP_BASE_INFO: {
133
- /** 应用名称 */
134
53
  name: string;
135
54
  };
136
- /** 应用布局-header 配置 */
137
55
  APP_LAYOUT_HEADER_CONFIG: {
138
- /** header 高度(px) */
139
56
  height: number;
140
- /** 字体色;缺省 → 不写 color、CSS 继承 :root 全局 color(= baseColor);[MUST NOT] 写死字面量 */
141
57
  color?: string;
142
- /** 背景(color / image / gradient 等 CSS background);缺省 → bodyColor(经 --admin-core-* var);[MUST NOT] 写死字面量 */
143
58
  background?: string;
144
- /** 装饰逃生舱(borderRadius/boxShadow/... ;排除引擎托管键,见 {@link AppLayoutModuleStyle}) */
145
59
  style?: AppLayoutModuleStyle;
146
60
  };
147
- /** 应用布局-footer 配置 */
148
61
  APP_LAYOUT_FOOTER_CONFIG: {
149
- /** footer 高度(px) */
150
62
  height: number;
151
- /** 字体色;缺省 → 继承 :root color(baseColor) */
152
63
  color?: string;
153
- /** 背景(color / image / gradient 等 CSS background);缺省 → bodyColor */
154
64
  background?: string;
155
- /** 装饰逃生舱(见 {@link AppLayoutModuleStyle}) */
156
65
  style?: AppLayoutModuleStyle;
157
66
  };
158
- /** 应用布局-sidebar 配置(store/app 取 collapseWidth / width) */
159
67
  APP_LAYOUT_SIDEBAR_CONFIG: {
160
- /** [展开的]宽度(px) */
161
68
  width: number;
162
- /** 折叠起来的宽度(px) */
163
69
  collapseWidth: number;
164
- /** 字体色;缺省 → 继承 :root color(baseColor) */
165
70
  color?: string;
166
- /** 背景(color / image / gradient 等 CSS background);缺省 → bodyColor */
167
71
  background?: string;
168
- /** 装饰逃生舱(见 {@link AppLayoutModuleStyle}) */
169
72
  style?: AppLayoutModuleStyle;
170
73
  };
171
- /**
172
- * 应用布局-aside 右侧补充区配置(P1' 新增 additive,对称 sidebar)。
173
- * 仅自定义 shell 渲染右侧区时生效;不配则 aside 不存在(经典布局零影响)。
174
- */
175
74
  APP_LAYOUT_ASIDE_CONFIG: {
176
- /** aside 宽度(px) */
177
75
  width: number;
178
- /** 字体色;缺省 → 继承 :root color(baseColor) */
179
76
  color?: string;
180
- /** 背景(color / image / gradient 等 CSS background);缺省 → bodyColor */
181
77
  background?: string;
182
- /** 装饰逃生舱(见 {@link AppLayoutModuleStyle}) */
183
78
  style?: AppLayoutModuleStyle;
184
79
  };
185
- /** 应用布局-页面主体配置(store/app 仅取 shimPadding) */
186
80
  APP_LAYOUT_BODY_CONFIG: {
187
- /** 页面主体 padding - 默认值(px) */
188
81
  shimPadding: number;
189
82
  };
190
- /**
191
- * 应用布局-模块间距配置(内缝;模块间露 size px 底色条带,漏出 .app-body 的 bodyColor)。
192
- *
193
- * 与 viewport 边框(整体外框)正交:gap 是模块**之间**的缝。默认 `{ size: 0 }` = 模块贴合、
194
- * 现状不变;`size>0` 时 store 几何 calc 在相邻模块间叠加该间距(缺位侧不留悬空缝)。
195
- * 分离观感需模块 `background` 为 surface 色(≠ bodyColor),由 preset/消费方设。
196
- * 布局插件经 `bridge.update("APP_LAYOUT_GAP_CONFIG", { size })` 设值。
197
- */
198
83
  APP_LAYOUT_GAP_CONFIG: {
199
- /** 模块间距(px);缺省 0 = 贴合 */
200
84
  size: number;
201
85
  };
202
- /**
203
- * 应用布局-视口边框配置(整个 app-shell 相对浏览器视口四边内缩,套"边框"留白观感)。
204
- *
205
- * Header/Sidebar 的 fixed 锚点由 `0` 改贴四边 padding 值;AppBody 在原扣 header 高 /
206
- * sidebar 宽基础上经 calc 再叠加对应 viewport 边距。app 端可整体不传(核内默认四边 0
207
- * = 不套框,现状不变);布局插件经 `bridge.update("APP_LAYOUT_VIEWPORT_CONFIG", ...)` 设值。
208
- */
209
86
  APP_LAYOUT_VIEWPORT_CONFIG: {
210
- /** 视口上内边距(px) */
211
87
  paddingTop: number;
212
- /** 视口右内边距(px) */
213
88
  paddingRight: number;
214
- /** 视口下内边距(px) */
215
89
  paddingBottom: number;
216
- /** 视口左内边距(px) */
217
90
  paddingLeft: number;
218
91
  };
219
- /** 应用主题配置(store/app 取 dark / light,各为完整 AppThemeColor) */
220
92
  APP_THEME_CONFIG: {
221
- /** 亮色主题 */
222
93
  light: AppThemeColor;
223
- /** 暗色主题 */
224
94
  dark: AppThemeColor;
225
95
  };
226
- /** 应用路由元信息默认配置(store/app 取 show* 四项;createUserStore 经此取 menuShow/needLogin 默认) */
227
96
  APP_ROUTER_META_DEFAULT_CONFIG: {
228
- /** 各路由[未配置情况下]默认是否展示 header */
229
97
  showHeader: boolean;
230
- /** 各路由[未配置情况下]默认是否展示 footer */
231
98
  showFooter: boolean;
232
- /** 各路由[未配置情况下]默认是否展示 sidebar */
233
99
  showSidebar: boolean;
234
- /** 各路由[未配置情况下]默认是否展示右侧 aside(additive 可选;缺省 false,store `?? false` 兜底) */
235
100
  showAside?: boolean;
236
- /** 默认是否展示 breadcrumb */
237
101
  showBreadcrumb: boolean;
238
- /** 各路由[未配置情况下]默认是否展示在菜单 */
239
102
  menuShow: boolean;
240
- /** 各路由[未配置情况下]默认是否需要登录 */
241
103
  needLogin: boolean;
242
104
  };
243
- /** 应用缓存配置(#4e additive 第 8 项;createUserStore 经 namespace 实例化 useState) */
244
105
  APP_CACHE_CONFIG: {
245
- /** 缓存命名空间 */
246
106
  namespace: string;
247
107
  };
248
108
  }
249
- /**
250
- * 应用环境信息(#2.5 期新增,per ADR-6)。
251
- *
252
- * 镜像 app 端 `@/config` `APP_ENV_INFO` 字面量推导结构。`mode` 取自
253
- * `import.meta.env.MODE`,`isProd` / `isDev` 派生自 mode 比较;本类型对外
254
- * 显式声明便于下游业务项目直接 import 使用。
255
- */
256
109
  export interface AppEnvInfo {
257
- /** 环境模式(如 "production" / "development") */
258
110
  mode: string;
259
- /** 是生产环境 */
260
111
  isProd: boolean;
261
- /** 是开发环境 */
262
112
  isDev: boolean;
263
113
  }
264
- /**
265
- * 应用布局-面包屑配置(#2.5 期新增,per ADR-6)。
266
- */
267
114
  export interface AppLayoutBreadcrumbConfig {
268
- /** 面包屑高度(px) */
269
115
  height: number;
270
116
  }
271
- /**
272
- * 应用布局聚合配置(#2.5 期新增,per ADR-3 候选 b bridge 内部派生)。
273
- *
274
- * 由 `createAdminBridge` 内部从 5 子布局配置(HEADER/FOOTER/SIDEBAR/BREADCRUMB/BODY)
275
- * Object.freeze 聚合派生,挂载到 `bridge.APP_LAYOUT_CONFIG` readonly 属性。
276
- */
277
117
  export interface AppLayoutConfig {
278
- /** header 配置 */
279
118
  header: AppConfig["APP_LAYOUT_HEADER_CONFIG"];
280
- /** footer 配置 */
281
119
  footer: AppConfig["APP_LAYOUT_FOOTER_CONFIG"];
282
- /** sidebar 配置 */
283
120
  sidebar: AppConfig["APP_LAYOUT_SIDEBAR_CONFIG"];
284
- /** aside 右侧补充区配置(P1' additive) */
285
121
  aside: AppConfig["APP_LAYOUT_ASIDE_CONFIG"];
286
- /** 面包屑配置 */
287
122
  breadcrumb: AppLayoutBreadcrumbConfig;
288
- /** 页面主体配置 */
289
123
  body: AppConfig["APP_LAYOUT_BODY_CONFIG"];
290
- /** 视口边框配置 */
291
124
  viewport: AppConfig["APP_LAYOUT_VIEWPORT_CONFIG"];
292
- /** 模块间距配置(内缝 gap) */
293
125
  gap: AppConfig["APP_LAYOUT_GAP_CONFIG"];
294
126
  }
295
- /**
296
- * 应用路由配置(#2.5 期新增,per ADR-6)。
297
- *
298
- * 镜像 app 端 `@/config/router.ts` `APP_ROUTER_CONFIG` 字面量结构。
299
- */
300
127
  export interface AppRouterConfig {
301
- /** 是否使用 hash 路由 */
302
128
  isHash: boolean;
303
- /** 路由根路径(同一域名不同 pathname 对应不同应用) */
304
129
  basePath: string;
305
- /** 相同层级路由缓存最大数量 */
306
130
  keepAliveMaxCount: number;
307
- /** 路由 meta 默认值(复用 AppConfig 字段类型) */
308
131
  metaDefault: AppConfig["APP_ROUTER_META_DEFAULT_CONFIG"];
309
132
  }
310
- /**
311
- * 应用路由路径配置——8 path 聚合(#7.3 期新增)。
312
- *
313
- * 镜像 app 端 `@/config/router.ts` `APP_ROUTER_PATHS_CONFIG` 聚合结构;供
314
- * layout 族下沉 core 时通过 `appAdminBridge.APP_ROUTER_PATHS_CONFIG.homePath`
315
- * 等读取路径常量,避免直 import 业务侧 `@/config` 路径符号。
316
- *
317
- * `loginNoCheckPath` / `authNoCheckPath` 标 `readonly string[]` 表只读语义;
318
- * 业务侧 `string[]` 协变兼容 `readonly string[]`(赋值方向单向)。
319
- */
320
133
  export interface AppRouterPathsConfig {
321
- /** 根路径[!!!必设重定向] */
322
134
  rootPath: string;
323
- /** 首页路径 */
324
135
  homePath: string;
325
- /** 登录路径 */
326
136
  loginPath: string;
327
- /** 注册路径 */
328
137
  registerPath: string;
329
- /** 404 路径 */
330
138
  noFoundPath: string;
331
- /** 无权限路径 */
332
139
  noPermissionPath: string;
333
- /** 登录免检路径 */
334
140
  loginNoCheckPath: readonly string[];
335
- /** 权限免检路径 */
336
141
  authNoCheckPath: readonly string[];
337
142
  }
338
- /** 应用基础信息 type 别名(#2.5 期 type 别名复用,per ADR-6) */
339
143
  export type AppBaseInfo = AppConfig["APP_BASE_INFO"];
340
- /** 应用布局-header 配置 type 别名 */
341
144
  export type AppLayoutHeaderConfig = AppConfig["APP_LAYOUT_HEADER_CONFIG"];
342
- /** 应用布局-footer 配置 type 别名 */
343
145
  export type AppLayoutFooterConfig = AppConfig["APP_LAYOUT_FOOTER_CONFIG"];
344
- /** 应用布局-sidebar 配置 type 别名 */
345
146
  export type AppLayoutSidebarConfig = AppConfig["APP_LAYOUT_SIDEBAR_CONFIG"];
346
- /** 应用布局-aside 右侧补充区配置 type 别名(P1' additive) */
347
147
  export type AppLayoutAsideConfig = AppConfig["APP_LAYOUT_ASIDE_CONFIG"];
348
- /** 应用布局-页面主体配置 type 别名 */
349
148
  export type AppLayoutBodyConfig = AppConfig["APP_LAYOUT_BODY_CONFIG"];
350
- /** 应用布局-视口边框配置 type 别名 */
351
149
  export type AppLayoutViewportConfig = AppConfig["APP_LAYOUT_VIEWPORT_CONFIG"];
352
- /** 应用布局-模块间距配置 type 别名(内缝 gap) */
353
150
  export type AppLayoutGapConfig = AppConfig["APP_LAYOUT_GAP_CONFIG"];
354
- /** 应用主题配置 type 别名 */
355
151
  export type AppThemeConfig = AppConfig["APP_THEME_CONFIG"];
356
- /** 应用路由元信息默认配置 type 别名 */
357
152
  export type AppRouterMetaDefaultConfig = AppConfig["APP_ROUTER_META_DEFAULT_CONFIG"];
358
- /** 应用缓存配置 type 别名 */
359
153
  export type AppCacheConfig = AppConfig["APP_CACHE_CONFIG"];
360
- /**
361
- * token / refreshToken 字段访问器(含 get + set)。
362
- *
363
- * 第一宪法:core 对业务 `UserInfo` shape 完全不透明——业务自存自取,经本 adapter
364
- * 注入读写两字段的纯函数,core [MUST NOT] 硬编字面字段名/路径耦合业务字段位置。
365
- * `set` [MUST] 产新对象([MUST NOT] 原地 mutate,破响应式 + 破不可变)。
366
- */
367
154
  export interface UserInfoFieldAccessor<UserInfo = unknown> {
368
- /** 读字段值;[MUST] 返回 string——业务经 getUserInfoInitFn 把该字段初值置 `""`,保证空态为 `""` 而非 undefined(类型恒定,免下游满屏 `token!`) */
369
155
  get: (info: Partial<UserInfo>) => string;
370
- /**
371
- * 写入字段值,返回**保留 info 其余全部字段**的新对象。
372
- *
373
- * [MUST] 含 info 全字段(如 `{ ...info, <业务字段>: value }`)——createUserStore
374
- * getInfo 顺势更新全部用户信息时以 data 为基,依赖本契约把 token/refreshToken
375
- * 贴回而不丢失 data 其余字段;[MUST NOT] 只返回单字段对象,[MUST NOT] 原地 mutate info。
376
- */
377
156
  set: (info: Partial<UserInfo>, value: string) => Partial<UserInfo>;
378
157
  }
379
- /**
380
- * permission 字段访问器(仅 get)。
381
- *
382
- * 权限由服务端下发只读,core 不写——仅 get 无 set;返回权限 key 列表(业务侧保底 `[]`)。
383
- */
384
158
  export interface UserInfoPermissionAccessor<UserInfo = unknown> {
385
- /** 从用户信息读取权限列表 */
386
159
  get: (info: Partial<UserInfo>) => (string | number)[];
387
160
  }
388
- /**
389
- * 用户信息字段访问器集(token / refreshToken / permission 三字段注入)。
390
- *
391
- * createUserStore 经 `bridge.userInfoAccess.<字段>.get/set` 读写业务 UserInfo,
392
- * core 零字段名耦合(第一宪法)。业务 shape 完全自由(嵌套 / 组合 / 任意命名),
393
- * core 只认 adapter 契约不认数据结构。
394
- */
395
161
  export interface UserInfoAccess<UserInfo = unknown> {
396
- /** token 字段访问器 */
397
162
  token: UserInfoFieldAccessor<UserInfo>;
398
- /** refreshToken 字段访问器 */
399
163
  refreshToken: UserInfoFieldAccessor<UserInfo>;
400
- /** permission 字段访问器(仅 get) */
401
164
  permission: UserInfoPermissionAccessor<UserInfo>;
402
165
  }
403
- /**
404
- * `createAdminBridge` 入参类型(#2.5 期 schema 扩张到 14 顶层字段,per ADR-3 / ADR-6)。
405
- *
406
- * #2.5 期完全显式入参化:原 `appConfig: AppConfig` 嵌套字段拆解为 11 个顶层字段平铺
407
- * + 新增 `APP_ENV_INFO` / `APP_LAYOUT_BREADCRUMB_CONFIG` / `APP_ROUTER_CONFIG` 3 字段
408
- * + 注:`APP_LAYOUT_CONFIG` 由 bridge 内部从 5 子布局配置聚合派生(候选 b,不在 initOptions 中)。
409
- *
410
- * `routes`(#4e additive)为 app 嵌套路由树(带 children),createUserStore 经此算权限树;
411
- * `getUserInfoInitFn` 为 createUserStore 用户信息空保底注入面(core 对 UserInfo 不透明,
412
- * 业务 shape 不下沉,规则 8)。`userInfoAccess` 为 token / refreshToken / permission
413
- * 三字段的业务注入访问器(第一宪法:core 经纯函数 get/set 读写,零字面字段名耦合,
414
- * 业务 UserInfo shape 完全自由)。
415
- */
416
- export interface AdminBridgeInitOptions<UserInfo = unknown> {
417
- /** 应用基础信息(store/app 仅取 name) */
166
+ export interface CoreBridgeInitOptions<UserInfo = unknown> {
418
167
  APP_BASE_INFO: AppBaseInfo;
419
- /** 应用环境信息(mode / isProd / isDev,env 派生) */
420
168
  APP_ENV_INFO: AppEnvInfo;
421
- /** 应用缓存配置(bridge 内部 storage / useState 派生 namespace) */
422
169
  APP_CACHE_CONFIG: AppCacheConfig;
423
- /** 应用布局-header 配置 */
424
170
  APP_LAYOUT_HEADER_CONFIG: AppLayoutHeaderConfig;
425
- /** 应用布局-footer 配置 */
426
171
  APP_LAYOUT_FOOTER_CONFIG: AppLayoutFooterConfig;
427
- /** 应用布局-sidebar 配置 */
428
172
  APP_LAYOUT_SIDEBAR_CONFIG: AppLayoutSidebarConfig;
429
- /**
430
- * 应用布局-aside 右侧补充区配置(P1' 新增 additive,可选;app 不传时核内默认 width 0)。
431
- * 默认 shell 也渲染 AppAside(宽 0 不可见);app/preset 加宽即启用,经典布局零影响。
432
- */
433
173
  APP_LAYOUT_ASIDE_CONFIG?: Partial<AppLayoutAsideConfig>;
434
- /** 应用布局-面包屑配置(#2.5 期新增字段) */
435
174
  APP_LAYOUT_BREADCRUMB_CONFIG: AppLayoutBreadcrumbConfig;
436
- /** 应用布局-页面主体配置 */
437
175
  APP_LAYOUT_BODY_CONFIG: AppLayoutBodyConfig;
438
- /**
439
- * 应用布局-视口边框配置(可选;app 整体不传时核内默认四边 0 = 不套框,现状不变)。
440
- * 传部分字段时与默认四边 0 浅合并(见 createAdminBridge 内 DEFAULT 合并)。
441
- */
442
176
  APP_LAYOUT_VIEWPORT_CONFIG?: Partial<AppLayoutViewportConfig>;
443
- /**
444
- * 应用布局-模块间距配置(可选;app 不传时核内默认 `{ size: 0 }` = 模块贴合、现状不变)。
445
- * 布局插件经 preset.layout.gap 或 `bridge.update` 设值。
446
- */
447
177
  APP_LAYOUT_GAP_CONFIG?: Partial<AppLayoutGapConfig>;
448
- /** 应用路由元信息默认配置(bridge 内部 generateRouteMetaRawTree 派生) */
449
178
  APP_ROUTER_META_DEFAULT_CONFIG: AppRouterMetaDefaultConfig;
450
- /** 应用路由配置(#2.5 期新增字段) */
451
179
  APP_ROUTER_CONFIG: AppRouterConfig;
452
- /** 应用路由路径配置(#7.3 期新增字段;8 path 聚合供 layout 族通过 bridge 取业务路径) */
453
180
  APP_ROUTER_PATHS_CONFIG: AppRouterPathsConfig;
454
- /** 应用主题配置(light / dark 双主题) */
455
181
  APP_THEME_CONFIG: AppThemeConfig;
456
- /**
457
- * 明暗模式默认值(**仅无缓存时生效**,可选);缺省 `"light"`。
458
- *
459
- * 读持久化命中 themeMode → 缓存优先;无缓存才回落本值。设 `"dark"` =「首次进入默认暗色」、
460
- * `"system"` =「默认跟随系统」。透传给 theme cache hook 的 `defaultMode`。
461
- */
462
- defaultThemeMode?: AdminThemeMode;
463
- /**
464
- * 是否显示内置「风格切换下拉」(AppTheme 的 ElSelect);缺省 `true`。
465
- *
466
- * false 时仅隐藏风格下拉,**亮/暗/跟随系统三态切换恒显、不受此控**。风格下拉本就
467
- * 仅在注册多风格(list.length>1)时出现,此开关用于「多风格已注册但不想让用户切风格」。
468
- * 经 `bridge.showThemeStyleSwitcher` readonly 暴露,AppTheme 直读 `v-if` 自控。
469
- */
182
+ defaultThemeMode?: CoreThemeMode;
470
183
  showThemeStyleSwitcher?: boolean;
471
- /** app 嵌套路由树(必传,#4e additive;createUserStore 权限树依赖 children 嵌套,[MUST NOT] 传扁平化数据) */
472
184
  routes: RouteRecordRaw[];
473
- /** 用户信息空保底工厂(v3 终锁 Δ0b;恒返非空业务字段默认值对象,createUserStore useState 经此取初值,core 不锁业务 shape) */
474
185
  getUserInfoInitFn: () => UserInfo;
475
- /** 用户信息字段访问器集(第一宪法:core 经业务注入 get/set 读写 token/refreshToken/permission,零字段名耦合,业务 shape 自由) */
476
186
  userInfoAccess: UserInfoAccess<UserInfo>;
477
187
  }
478
- /**
479
- * 认证桥接实例类型。
480
- *
481
- * 调用侧 4 auth 方法签名与原 app `@/config` facade 完全一致。
482
- * 工厂 `createAdminBridge(options)` 接收 init 参数,内部立即初始化,
483
- * 返回即用的实例——消除 create-then-init 两步时序耦合。
484
- */
485
- export interface AdminBridge<UserInfo = unknown, LoginParams = unknown> {
486
- /** 注册 auth fn + 业务 api(增量合并,多次调用就近增量,后注册覆盖前注册) */
487
- register: (options: AdminBridgeRegisterOptions<UserInfo, LoginParams>) => void;
488
- /** 取 token(v3 终锁 BR-1 ③ 终裁零参;现有无参调用 `bridge.getToken()` 继续合法,泛型 `<UserInfo>` 纯透传不沾本签名) */
188
+ export interface CoreBridge<UserInfo = unknown, LoginParams = unknown> {
189
+ register: (options: CoreBridgeRegisterOptions<UserInfo, LoginParams>) => void;
489
190
  getToken: () => string | undefined;
490
- /** 跳转登录 */
491
191
  goToLogin: () => void;
492
- /** 刷新 token */
493
192
  refreshToken: () => Promise<void>;
494
- /** 刷新鉴权 */
495
193
  refreshAuth: () => Promise<void>;
496
- /** 返回 bridge 内部派生的 storage 实例(per REQ-1 入参内化;保持 StorageLike 可变方法可调用) */
497
194
  getStorage: () => StorageLike;
498
- /** 返回 `init` 注册的 routes 引用(routes 例外保持可变,破循环依赖时序,per REQ-4 + audit §3.4) */
499
195
  getRoutes: () => RouteRecordRaw[];
500
- /** 返回 `init` 注册的 getUserInfoInitFn 引用(v3 终锁 Δ0d,镜像 getRoutes 范式) */
501
196
  getUserInfoInitFn: () => () => UserInfo;
502
- /** bridge 内部派生 useState 实例方法(per REQ-2;ns 已绑定,调用方零 ns 参;cacheKey 形如 `${ns}/useState/${moduleKey}`) */
503
197
  useState: ReturnType<typeof createUseState>;
504
- /** bridge 内部派生 generateRouteMetaRawTree 实例方法(per REQ-3;metaDefault 已绑定 APP_ROUTER_META_DEFAULT_CONFIG,调用方零 metaDefault 参) */
505
198
  generateRouteMetaRawTree: ReturnType<typeof createGenerateRouteMetaRawTree>;
506
- /** 登录 api(createUserStore login 内调;#2.7 期 axios `{data}` wrapper 业务层 wrap 剥离;未注册被调 reject 原生 Error) */
507
199
  loginApi: (params: LoginParams) => Promise<Partial<UserInfo>>;
508
- /** 退出登录 api(createUserStore logout 内调;未注册被调 reject 原生 Error) */
509
200
  logoutApi: () => Promise<unknown>;
510
- /** 取用户信息 api(createUserStore getInfo 内调;#2.7 期 axios `{data}` wrapper 业务层 wrap 剥离;连壳 {user_info} 见 design D2 由业务层决定;未注册被调 reject 原生 Error) */
511
201
  getUserInfoApi: () => Promise<Partial<UserInfo>>;
512
- /** 刷新 token api(createUserStore refreshTokenFn 内调;#C 期签名最简化:core 直传 refreshToken string,业务 wrap 内自打包业务 shape;未注册被调 reject 原生 Error) */
513
202
  refreshTokenApi: (refreshToken: string) => Promise<string>;
514
- /** 应用基础信息(per #2.5 期 REQ-1 直接挂载形态) */
515
203
  readonly APP_BASE_INFO: DeepReadonly<AppBaseInfo>;
516
- /** 应用环境信息(per #2.5 期 REQ-1) */
517
204
  readonly APP_ENV_INFO: AppEnvInfo;
518
- /** 应用缓存配置(per #2.5 期 REQ-1) */
519
205
  readonly APP_CACHE_CONFIG: AppCacheConfig;
520
- /** 应用布局-header 配置(per #2.5 期 REQ-1) */
521
206
  readonly APP_LAYOUT_HEADER_CONFIG: DeepReadonly<AppLayoutHeaderConfig>;
522
- /** 应用布局-footer 配置(per #2.5 期 REQ-1) */
523
207
  readonly APP_LAYOUT_FOOTER_CONFIG: DeepReadonly<AppLayoutFooterConfig>;
524
- /** 应用布局-sidebar 配置(per #2.5 期 REQ-1) */
525
208
  readonly APP_LAYOUT_SIDEBAR_CONFIG: DeepReadonly<AppLayoutSidebarConfig>;
526
- /** 应用布局-aside 右侧补充区配置(P1' additive,响应式只读视图) */
527
209
  readonly APP_LAYOUT_ASIDE_CONFIG: DeepReadonly<AppLayoutAsideConfig>;
528
- /** 应用布局-面包屑配置(per #2.5 期 REQ-1) */
529
210
  readonly APP_LAYOUT_BREADCRUMB_CONFIG: DeepReadonly<AppLayoutBreadcrumbConfig>;
530
- /** 应用布局-页面主体配置(per #2.5 期 REQ-1) */
531
211
  readonly APP_LAYOUT_BODY_CONFIG: DeepReadonly<AppLayoutBodyConfig>;
532
- /** 应用布局-视口边框配置(响应式只读视图,经 bridge.update 跟随) */
533
212
  readonly APP_LAYOUT_VIEWPORT_CONFIG: DeepReadonly<AppLayoutViewportConfig>;
534
- /** 应用布局-模块间距配置(内缝 gap;响应式只读视图,经 bridge.update 跟随) */
535
213
  readonly APP_LAYOUT_GAP_CONFIG: DeepReadonly<AppLayoutGapConfig>;
536
- /** 应用布局聚合配置(per #2.5 期 ADR-3 bridge 内部聚合派生) */
537
214
  readonly APP_LAYOUT_CONFIG: DeepReadonly<AppLayoutConfig>;
538
- /** 应用路由元信息默认配置(per #2.5 期 REQ-1) */
539
215
  readonly APP_ROUTER_META_DEFAULT_CONFIG: AppRouterMetaDefaultConfig;
540
- /** 应用路由配置(per #2.5 期 REQ-1) */
541
216
  readonly APP_ROUTER_CONFIG: AppRouterConfig;
542
- /** 应用路由路径配置(per #7.3 期;8 path 聚合 readonly 挂载) */
543
217
  readonly APP_ROUTER_PATHS_CONFIG: AppRouterPathsConfig;
544
- /** 应用主题配置(per #2.5 期 REQ-1) */
545
218
  readonly APP_THEME_CONFIG: DeepReadonly<AppThemeConfig>;
546
- /**
547
- * 主题模块(架构反转:core/bridge 主导主题切换)。
548
- *
549
- * `theme.{add,remove,setStyle,setDark,list,labelOf}`——风格 map 注册/注销 + 切换 + 展示名。
550
- * 插件 install 经 `bridge.theme.add(name, preset)` 注册风格(preset = {config,label?});切换真相在
551
- * bridge,appStore / AppTheme.vue 转发 `setStyle` / `setDark`([MUST NOT] bridge 反向监测 store)。
552
- */
553
- readonly theme: AdminThemeModule;
554
- /** 当前风格名(响应式只读真相源;[MUST NOT] 解构/快照取值,⚠️ 切换后定格) */
219
+ readonly theme: CoreThemeModule;
555
220
  readonly themeStyle: DeepReadonly<Ref<string>>;
556
- /** 明暗模式三态真相源(响应式只读;亮/暗/跟随系统)。`theme.setMode` 切换;themeIsDark 由本 mode 派生。 */
557
- readonly themeMode: DeepReadonly<Ref<AdminThemeMode>>;
558
- /** 是否暗色(响应式只读 **派生**;= mode==='system'?系统偏暗:mode==='dark'。appStore.isDarkTheme / 挂值 composable 读此) */
221
+ readonly themeMode: DeepReadonly<Ref<CoreThemeMode>>;
559
222
  readonly themeIsDark: DeepReadonly<Ref<boolean>>;
560
- /**
561
- * 当前 preset 的 layout 运行时维度(响应式只读真相源)。
562
- *
563
- * = `{ shell?, extractLevel1ToHeader }`——AppLayout 直读:`shell` 缺省回退内置默认
564
- * AppShell(经典布局);`extractLevel1ToHeader` 驱动菜单分流。尺寸 / 套框纯数据维度
565
- * 经 `theme.setStyle` 灌进 bridge 响应式布局 config(基线复位 + 叠加),不在此重复。
566
- * [MUST NOT] 解构/快照(⚠️ 切换 preset 后定格)。
567
- */
568
223
  readonly themeLayout: DeepReadonly<Ref<BridgeThemeLayoutState>>;
569
- /**
570
- * 当前密度档 / 动效档(响应式只读真相源;明暗无关)。
571
- * `useAdminThemeApply` watch 此重写节奏 `<style>`;`theme.setStyle` 按 preset 复位、
572
- * `theme.setDensity`/`setMotion` 直接改。[MUST NOT] 解构/快照。
573
- */
574
- readonly themeDensity: DeepReadonly<Ref<AdminThemeDensity>>;
575
- readonly themeMotion: DeepReadonly<Ref<AdminThemeMotion>>;
576
- /**
577
- * 当前生效的 JS 主题色(输出 B:JS 色值直给,与挂值 composable 的 cssvar 输出 A 对称)。
578
- *
579
- * = `themeIsDark ? APP_THEME_CONFIG.dark : APP_THEME_CONFIG.light`——明暗 + 风格的
580
- * 选择逻辑落在 bridge 这个真相源(store **不再自选**,仅 `appStore.theme` 转发本字段)。
581
- * 给「需对颜色做运算、吃不了 CSS var」的消费方直读真实色值
582
- * (MenuTree → ElMenu hover 派生 TinyColor parse / 任意 JS 内联样式)。
583
- * 纯 CSS 消费方走挂值 composable 写的 `--admin-core-*` cascade(输出 A)。
584
- * [MUST NOT] 解构/快照(⚠️ 切换风格/明暗后定格)。
585
- */
224
+ readonly themeDensity: DeepReadonly<Ref<CoreThemeDensity>>;
225
+ readonly themeMotion: DeepReadonly<Ref<CoreThemeMotion>>;
586
226
  readonly themeColors: DeepReadonly<Ref<AppThemeColor>>;
587
- /** 是否显示内置「风格切换下拉」(AppTheme ElSelect);init 静态值,缺省 true。亮暗切换恒显、不受此控。 */
588
227
  readonly showThemeStyleSwitcher: boolean;
589
- /** 用户信息字段访问器集(业务注入;createUserStore 经 bridge.userInfoAccess.<字段>.get/set 读写,第一宪法 core 零字段耦合) */
228
+ readonly layout: CoreLayoutModule;
590
229
  readonly userInfoAccess: UserInfoAccess<UserInfo>;
591
- /**
592
- * 更新本期 7 个响应式配置字段(插件系统一期,REQ-1)。
593
- *
594
- * 两参单字段 + **一级浅合并**(`Object.assign` 把 partial 第一层属性覆盖到对应
595
- * reactive 子配置,未传字段保留)。`theme` 的 `light`/`dark` 作为第一层属性整体
596
- * 替换(`update("APP_THEME_CONFIG", {light: newLight})` 整体替换 `light`、保留
597
- * `dark`)。[MUST NOT] 期望深合并——非 lodash merge / structuredClone 语义。
598
- * update 后对应 `bridge.APP_XXX` readonly 视图自动跟随。
599
- */
600
230
  update: <K extends UpdatableConfigKey>(key: K, partial: Partial<UpdatableConfigMap[K]>) => void;
601
- /**
602
- * 安装 admin bridge 插件。
603
- *
604
- * 插件状态按 bridge 实例隔离;同一插件引用或同名插件重复安装时会跳过。
605
- * `app.use(bridge)` 只负责 Vue provide,完整插件扩展走本方法。
606
- */
607
- use: <Options = unknown>(plugin: AdminBridgePluginLike<UserInfo, LoginParams, Options>, options?: Options) => AdminBridge<UserInfo, LoginParams>;
608
- /**
609
- * Vue 插件 install(插件系统一期,REQ-9)。
610
- *
611
- * `app.use(bridge)` 经 `app.provide(ADMIN_BRIDGE_KEY, bridge)` 全局注入整个 bridge
612
- * 实例;业务子组件 `inject(ADMIN_BRIDGE_KEY)` 拿到整 bridge → 读只读响应式配置 +
613
- * 调 `bridge.update`。**opt-in**:不 `app.use(bridge)` 则 inject 返回 undefined。
614
- * 区别于组件级 `APP_LAYOUT_BRIDGE_KEY`(layout 域窄切片)——本通道是 app 级全局整实例。
615
- */
231
+ use: <Options = unknown>(plugin: CoreBridgePluginLike<UserInfo, LoginParams, Options>, options?: Options) => CoreBridge<UserInfo, LoginParams>;
616
232
  install: (app: App) => App;
617
233
  }
618
- /**
619
- * 认证桥接无状态纯工厂:接收 init 参数,内部立即初始化,返回可直接使用的
620
- * `AdminBridge` 实例。实例状态(appConfig / storage / routes / fn 引用)仅存在于
621
- * 本次调用的闭包内,工厂自身零状态。
622
- *
623
- * @example
624
- * const appAdminBridge = createAdminBridge<LoginAccountInfo, AccountLoginParams>({
625
- * APP_BASE_INFO, APP_ENV_INFO, APP_CACHE_CONFIG,
626
- * APP_LAYOUT_HEADER_CONFIG, APP_LAYOUT_FOOTER_CONFIG, APP_LAYOUT_SIDEBAR_CONFIG,
627
- * APP_LAYOUT_BREADCRUMB_CONFIG, APP_LAYOUT_BODY_CONFIG,
628
- * APP_ROUTER_META_DEFAULT_CONFIG, APP_ROUTER_CONFIG, APP_THEME_CONFIG,
629
- * routes,
630
- * getUserInfoInitFn: getUserInfoInit,
631
- * });
632
- */
633
- export declare function createAdminBridge<UserInfo = unknown, LoginParams = unknown>(options: AdminBridgeInitOptions<UserInfo>): AdminBridge<UserInfo, LoginParams>;
234
+ export declare function createCoreBridge<UserInfo = unknown, LoginParams = unknown>(options: CoreBridgeInitOptions<UserInfo>): CoreBridge<UserInfo, LoginParams>;