@done-coding/forge-core 0.0.0-placeholder.0 → 0.100.0-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/LICENSE +21 -0
- package/README.md +49 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/es/bridge/badge.mjs +37 -0
- package/es/bridge/config-hook.mjs +58 -0
- package/es/bridge/contracts/event.mjs +102 -0
- package/es/bridge/contracts/index.mjs +5 -0
- package/es/bridge/event.mjs +87 -0
- package/es/bridge/index.mjs +331 -0
- package/es/bridge/layout.mjs +100 -0
- package/es/bridge/permission.mjs +91 -0
- package/es/bridge/plugin.mjs +39 -0
- package/es/bridge/route.mjs +78 -0
- package/es/bridge/state.mjs +61 -0
- package/es/bridge/storage.mjs +26 -0
- package/es/bridge/theme/index.mjs +233 -0
- package/es/bridge/theme/persist.mjs +18 -0
- package/es/bridge/theme/system-dark.mjs +18 -0
- package/es/components/basic/AppCollapseToggle.vue.mjs +7 -0
- package/es/components/basic/AppCollapseToggle.vue2.mjs +63 -0
- package/es/components/basic/action-btn/ActionBtn.vue.mjs +200 -0
- package/es/components/basic/action-btn/ActionBtn.vue2.mjs +4 -0
- package/es/components/basic/action-btn/index.mjs +4 -0
- package/es/components/basic/action-btn/use-action-btn-report.mjs +54 -0
- package/es/components/basic/action-btn-group/ActionBtnGroup.vue.mjs +69 -0
- package/es/components/basic/action-btn-group/ActionBtnGroup.vue2.mjs +4 -0
- package/es/components/basic/action-btn-group/index.mjs +4 -0
- package/es/components/basic/action-btn-group/use-action-btn-group-report.mjs +30 -0
- package/es/components/basic/display-contracts/index.mjs +1 -0
- package/es/components/basic/drag-float/DragFloat.vue.mjs +7 -0
- package/es/components/basic/drag-float/DragFloat.vue2.mjs +109 -0
- package/es/components/basic/drag-float/index.mjs +4 -0
- package/es/components/basic/height-provider/HeightProvider.vue.mjs +62 -0
- package/es/components/basic/height-provider/HeightProvider.vue2.mjs +4 -0
- package/es/components/basic/height-provider/index.mjs +4 -0
- package/es/components/basic/index.mjs +4 -0
- package/es/components/basic/shadow-clone/ShadowClone.vue.mjs +32 -0
- package/es/components/basic/shadow-clone/ShadowClone.vue2.mjs +4 -0
- package/es/components/basic/shadow-clone/index.mjs +4 -0
- package/es/components/basic/shadow-clone/use-shadow-target.mjs +76 -0
- package/es/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue.mjs +7 -0
- package/es/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue2.mjs +68 -0
- package/es/components/basic/slot-layout-flow-aside/index.mjs +4 -0
- package/es/components/basic/slot-layout-template/SlotLayoutTemplate.vue.mjs +30 -0
- package/es/components/basic/slot-layout-template/SlotLayoutTemplate.vue2.mjs +4 -0
- package/es/components/basic/slot-layout-template/index.mjs +4 -0
- package/es/components/basic/watch-size/WatchSize.vue.mjs +73 -0
- package/es/components/basic/watch-size/WatchSize.vue2.mjs +4 -0
- package/es/components/basic/watch-size/index.mjs +4 -0
- package/es/components/config/app-theme/AppTheme.vue.mjs +7 -0
- package/es/components/config/app-theme/AppTheme.vue2.mjs +82 -0
- package/es/components/config/app-theme/index.mjs +4 -0
- package/es/components/data/badge-mark/BadgeMark.vue.mjs +7 -0
- package/es/components/data/badge-mark/BadgeMark.vue2.mjs +80 -0
- package/es/components/data/badge-mark/index.mjs +4 -0
- package/es/components/data/badge-mark/use-badge-mask.mjs +82 -0
- package/es/components/data/badge-mark/use-badge.mjs +106 -0
- package/es/components/data/boolean-tag/BooleanTag.vue.mjs +36 -0
- package/es/components/data/boolean-tag/BooleanTag.vue2.mjs +4 -0
- package/es/components/data/boolean-tag/index.mjs +4 -0
- package/es/components/data/image-preview-trigger/ImagePreviewTrigger.vue.mjs +38 -0
- package/es/components/data/image-preview-trigger/ImagePreviewTrigger.vue2.mjs +4 -0
- package/es/components/data/image-preview-trigger/index.mjs +4 -0
- package/es/components/data/modal-image-preview/ModalImagePreview.vue.mjs +52 -0
- package/es/components/data/modal-image-preview/ModalImagePreview.vue2.mjs +4 -0
- package/es/components/data/modal-image-preview/index.mjs +4 -0
- package/es/components/feedback/action-confirm/ActionConfirm.vue.mjs +7 -0
- package/es/components/feedback/action-confirm/ActionConfirm.vue2.mjs +143 -0
- package/es/components/feedback/action-confirm/index.mjs +4 -0
- package/es/components/feedback/modal-confirm/ModalConfirm.vue.mjs +8 -0
- package/es/components/feedback/modal-confirm/ModalConfirm.vue2.mjs +243 -0
- package/es/components/feedback/modal-confirm/index.mjs +4 -0
- package/es/components/feedback/modal-video-preview/ModalVideoPreview.vue.mjs +8 -0
- package/es/components/feedback/modal-video-preview/ModalVideoPreview.vue2.mjs +93 -0
- package/es/components/feedback/modal-video-preview/index.mjs +4 -0
- package/es/components/feedback/preview-keys/index.mjs +7 -0
- package/es/components/feedback/preview-keys/keys.mjs +7 -0
- package/es/components/feedback/shelf-contracts/index.mjs +1 -0
- package/es/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.mjs +7 -0
- package/es/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue2.mjs +133 -0
- package/es/components/feedback/video-preview-trigger/index.mjs +4 -0
- package/es/components/other/TriggerAutoImport.vue.mjs +12 -0
- package/es/components/other/TriggerAutoImport.vue2.mjs +4 -0
- package/es/components/other/auto-refresh/AutoRefresh.vue.mjs +7 -0
- package/es/components/other/auto-refresh/AutoRefresh.vue2.mjs +96 -0
- package/es/components/other/auto-refresh/index.mjs +4 -0
- package/es/components/other/auto-refresh/use-auto-refresh-report.mjs +31 -0
- package/es/components/other/auto-refresh-contracts/index.mjs +1 -0
- package/es/components/other/auto-refresh-group/AutoRefreshGroup.vue.mjs +7 -0
- package/es/components/other/auto-refresh-group/AutoRefreshGroup.vue2.mjs +69 -0
- package/es/components/other/auto-refresh-group/index.mjs +4 -0
- package/es/components/other/auto-refresh-group/use-auto-refresh-group-report.mjs +12 -0
- package/es/components/other/index.mjs +4 -0
- package/es/config/badge-attr.mjs +6 -0
- package/es/config/index.mjs +19 -0
- package/es/config/list-model.mjs +13 -0
- package/es/config/modal-keys.mjs +6 -0
- package/es/config/route.mjs +6 -0
- package/es/config/slot-region.mjs +45 -0
- package/es/helpers/form.mjs +25 -0
- package/es/helpers/index.mjs +10 -0
- package/es/helpers/list-helper.mjs +77 -0
- package/es/hooks/activated.mjs +64 -0
- package/es/hooks/feel-size.mjs +46 -0
- package/es/hooks/index.mjs +31 -0
- package/es/hooks/menus-dispatch.mjs +85 -0
- package/es/hooks/timeout.mjs +36 -0
- package/es/hooks/use-active-record.mjs +104 -0
- package/es/hooks/use-breakpoint.mjs +48 -0
- package/es/hooks/use-bridge-report.mjs +12 -0
- package/es/hooks/use-channel-viewport-height.mjs +43 -0
- package/es/hooks/use-context-defaults.mjs +44 -0
- package/es/hooks/use-custom-breakpoint.mjs +69 -0
- package/es/hooks/use-is-dev.mjs +16 -0
- package/es/hooks/use-observe-size.mjs +43 -0
- package/es/hooks/use-permission.mjs +12 -0
- package/es/hooks/use-surface.mjs +35 -0
- package/es/hooks/use-theme-apply.mjs +496 -0
- package/es/hooks/use-viewport-apply.mjs +52 -0
- package/es/index.mjs +179 -0
- package/es/inject/index.mjs +19 -0
- package/es/inject/key.mjs +70 -0
- package/es/injection-namespace.mjs +4 -0
- package/es/internals/index.mjs +16 -0
- package/es/router/group-redirect.mjs +26 -0
- package/es/router/guard/index.mjs +36 -0
- package/es/router/guard/login.mjs +6 -0
- package/es/router/guard/permission.mjs +6 -0
- package/es/router/index.mjs +10 -0
- package/es/store/app.mjs +306 -0
- package/es/store/index.mjs +8 -0
- package/es/store/router-permission.mjs +94 -0
- package/es/store/user.mjs +128 -0
- package/es/style.css +339 -0
- package/es/types/index.mjs +1 -0
- package/es/utils/dom.mjs +42 -0
- package/es/utils/export.mjs +39 -0
- package/es/utils/gap-scale.mjs +25 -0
- package/es/utils/id.mjs +7 -0
- package/es/utils/index.mjs +37 -0
- package/es/utils/permission.mjs +31 -0
- package/es/utils/router.mjs +42 -0
- package/es/utils/theme-scale.mjs +86 -0
- package/es/utils/time.mjs +24 -0
- package/package.json +232 -1
- package/types/bridge/badge.d.ts +215 -0
- package/types/bridge/config-hook.d.ts +12 -0
- package/types/bridge/contracts/bridge.d.ts +339 -0
- package/types/bridge/contracts/config.d.ts +519 -0
- package/types/bridge/contracts/event.d.ts +546 -0
- package/types/bridge/contracts/index.d.ts +3 -0
- package/types/bridge/event.d.ts +3 -0
- package/types/bridge/index.d.ts +28 -0
- package/types/bridge/layout.d.ts +102 -0
- package/types/bridge/permission.d.ts +31 -0
- package/types/bridge/plugin.d.ts +11 -0
- package/types/bridge/route.d.ts +36 -0
- package/types/bridge/state.d.ts +26 -0
- package/types/bridge/storage.d.ts +10 -0
- 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 +346 -0
- package/types/components/basic/AppCollapseToggle.vue.d.ts +14 -0
- package/types/components/basic/action-btn/ActionBtn.vue.d.ts +19 -0
- package/types/components/basic/action-btn/index.d.ts +1 -0
- package/types/components/basic/action-btn/use-action-btn-report.d.ts +12 -0
- package/types/components/basic/action-btn-group/ActionBtnGroup.vue.d.ts +18 -0
- package/types/components/basic/action-btn-group/index.d.ts +1 -0
- package/types/components/basic/action-btn-group/use-action-btn-group-report.d.ts +6 -0
- package/types/components/basic/display-contracts/index.d.ts +1 -0
- package/types/components/basic/display-contracts/types.d.ts +280 -0
- package/types/components/basic/drag-float/DragFloat.vue.d.ts +35 -0
- package/types/components/basic/drag-float/index.d.ts +1 -0
- package/types/components/basic/height-provider/HeightProvider.vue.d.ts +28 -0
- package/types/components/basic/height-provider/index.d.ts +1 -0
- package/types/components/basic/index.d.ts +1 -0
- package/types/components/basic/shadow-clone/ShadowClone.vue.d.ts +20 -0
- package/types/components/basic/shadow-clone/index.d.ts +1 -0
- package/types/components/basic/shadow-clone/use-shadow-target.d.ts +9 -0
- package/types/components/basic/slot-layout-flow-aside/SlotLayoutFlowAside.vue.d.ts +32 -0
- package/types/components/basic/slot-layout-flow-aside/index.d.ts +2 -0
- package/types/components/basic/slot-layout-flow-aside/types.d.ts +10 -0
- package/types/components/basic/slot-layout-template/SlotLayoutTemplate.vue.d.ts +48 -0
- package/types/components/basic/slot-layout-template/index.d.ts +1 -0
- package/types/components/basic/watch-size/WatchSize.vue.d.ts +45 -0
- package/types/components/basic/watch-size/index.d.ts +1 -0
- package/types/components/config/app-theme/AppTheme.vue.d.ts +2 -0
- package/types/components/config/app-theme/index.d.ts +1 -0
- package/types/components/data/badge-mark/BadgeMark.vue.d.ts +212 -0
- package/types/components/data/badge-mark/index.d.ts +1 -0
- package/types/components/data/badge-mark/use-badge-mask.d.ts +8 -0
- package/types/components/data/badge-mark/use-badge.d.ts +78 -0
- package/types/components/data/boolean-tag/BooleanTag.vue.d.ts +8 -0
- package/types/components/data/boolean-tag/index.d.ts +1 -0
- package/types/components/data/image-preview-trigger/ImagePreviewTrigger.vue.d.ts +41 -0
- package/types/components/data/image-preview-trigger/index.d.ts +1 -0
- package/types/components/data/modal-image-preview/ModalImagePreview.vue.d.ts +31 -0
- package/types/components/data/modal-image-preview/index.d.ts +1 -0
- package/types/components/feedback/action-confirm/ActionConfirm.vue.d.ts +33 -0
- package/types/components/feedback/action-confirm/index.d.ts +1 -0
- package/types/components/feedback/modal-confirm/ModalConfirm.vue.d.ts +120 -0
- package/types/components/feedback/modal-confirm/index.d.ts +2 -0
- package/types/components/feedback/modal-confirm/types.d.ts +4 -0
- package/types/components/feedback/modal-video-preview/ModalVideoPreview.vue.d.ts +40 -0
- package/types/components/feedback/modal-video-preview/index.d.ts +1 -0
- package/types/components/feedback/preview-keys/index.d.ts +2 -0
- package/types/components/feedback/preview-keys/keys.d.ts +14 -0
- package/types/components/feedback/shelf-contracts/index.d.ts +1 -0
- package/types/components/feedback/shelf-contracts/types.d.ts +1 -0
- package/types/components/feedback/video-preview-trigger/VideoPreviewTrigger.vue.d.ts +46 -0
- package/types/components/feedback/video-preview-trigger/index.d.ts +1 -0
- package/types/components/other/TriggerAutoImport.vue.d.ts +17 -0
- package/types/components/other/auto-refresh/AutoRefresh.vue.d.ts +14 -0
- package/types/components/other/auto-refresh/index.d.ts +1 -0
- package/types/components/other/auto-refresh/use-auto-refresh-report.d.ts +1 -0
- package/types/components/other/auto-refresh-contracts/index.d.ts +1 -0
- package/types/components/other/auto-refresh-contracts/types.d.ts +17 -0
- package/types/components/other/auto-refresh-group/AutoRefreshGroup.vue.d.ts +18 -0
- package/types/components/other/auto-refresh-group/index.d.ts +1 -0
- package/types/components/other/auto-refresh-group/use-auto-refresh-group-report.d.ts +3 -0
- package/types/components/other/index.d.ts +1 -0
- package/types/config/badge-attr.d.ts +26 -0
- package/types/config/index.d.ts +5 -0
- package/types/config/list-model.d.ts +49 -0
- package/types/config/modal-keys.d.ts +12 -0
- package/types/config/route.d.ts +4 -0
- package/types/config/slot-region.d.ts +72 -0
- package/types/helpers/form.d.ts +8 -0
- package/types/helpers/index.d.ts +3 -0
- package/types/helpers/list-helper.d.ts +35 -0
- package/types/helpers/types.d.ts +15 -0
- package/types/hooks/activated.d.ts +36 -0
- package/types/hooks/feel-size.d.ts +10 -0
- package/types/hooks/index.d.ts +12 -0
- package/types/hooks/menus-dispatch.d.ts +35 -0
- package/types/hooks/timeout.d.ts +7 -0
- package/types/hooks/use-active-record.d.ts +64 -0
- package/types/hooks/use-breakpoint.d.ts +4 -0
- package/types/hooks/use-bridge-report.d.ts +3 -0
- package/types/hooks/use-channel-viewport-height.d.ts +22 -0
- package/types/hooks/use-context-defaults.d.ts +39 -0
- package/types/hooks/use-custom-breakpoint.d.ts +17 -0
- package/types/hooks/use-is-dev.d.ts +24 -0
- package/types/hooks/use-observe-size.d.ts +36 -0
- package/types/hooks/use-permission.d.ts +14 -0
- package/types/hooks/use-surface.d.ts +45 -0
- package/types/hooks/use-theme-apply.d.ts +34 -0
- package/types/hooks/use-viewport-apply.d.ts +20 -0
- package/types/index.d.ts +33 -0
- package/types/inject/index.d.ts +1 -0
- package/types/inject/key.d.ts +247 -0
- package/types/injection-namespace.d.ts +4 -0
- package/types/internals/index.d.ts +6 -0
- package/types/router/group-redirect.d.ts +14 -0
- package/types/router/guard/index.d.ts +20 -0
- package/types/router/guard/login.d.ts +4 -0
- package/types/router/guard/permission.d.ts +4 -0
- package/types/router/guard/types.d.ts +14 -0
- package/types/router/index.d.ts +2 -0
- package/types/store/app.d.ts +219 -0
- package/types/store/index.d.ts +3 -0
- package/types/store/router-permission.d.ts +79 -0
- package/types/store/user.d.ts +64 -0
- package/types/types/app-layout.d.ts +42 -0
- package/types/types/dc-path.d.ts +2 -0
- package/types/types/dot-path.d.ts +13 -0
- package/types/types/index.d.ts +9 -0
- package/types/types/list-api.d.ts +17 -0
- package/types/types/modal-shelf.d.ts +123 -0
- package/types/types/nest-form.d.ts +8 -0
- package/types/types/permission.d.ts +31 -0
- package/types/types/route.d.ts +141 -0
- package/types/types/utility-types.d.ts +25 -0
- package/types/utils/dom.d.ts +61 -0
- package/types/utils/export.d.ts +35 -0
- package/types/utils/gap-scale.d.ts +46 -0
- package/types/utils/id.d.ts +2 -0
- package/types/utils/index.d.ts +8 -0
- package/types/utils/permission.d.ts +16 -0
- package/types/utils/router.d.ts +18 -0
- package/types/utils/theme-scale.d.ts +78 -0
- package/types/utils/time.d.ts +2 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentPublicInstance } from 'vue';
|
|
2
|
+
import { Breakpoint } from './use-breakpoint';
|
|
3
|
+
/** 容器宽 → 断点 */
|
|
4
|
+
export declare const resolveBreakpointByWidth: (width: number) => Breakpoint;
|
|
5
|
+
/** elRef 可挂载的目标:原生元素 | 组件公共实例 */
|
|
6
|
+
export type CustomBreakpointTarget = HTMLElement | ComponentPublicInstance | null | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* 从 elRef 值解析根 DOM 节点:
|
|
9
|
+
* - HTMLElement → 直接用;
|
|
10
|
+
* - 组件实例(有 $el)→ 取 $el;$el 非 Element(多根组件 / 注释锚点)→ dev warn + null(不猜测)。
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolveRootEl: (target: CustomBreakpointTarget) => HTMLElement | null;
|
|
13
|
+
export declare const useCustomBreakpoint: () => {
|
|
14
|
+
elRef: import('vue').ShallowRef<CustomBreakpointTarget, CustomBreakpointTarget>;
|
|
15
|
+
activeBreakpoint: Readonly<import('vue').Ref<Breakpoint, Breakpoint>>;
|
|
16
|
+
measured: Readonly<import('vue').Ref<boolean, boolean>>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 「现在是不是开发环境」的判据 —— **证明不了是生产环境就报**(fail-loud)。
|
|
3
|
+
*
|
|
4
|
+
* core 是 npm 发布包,**构建期常量在这里一律不可用**。两条已被实测证伪的写法,
|
|
5
|
+
* [MUST NOT] 回头再用:
|
|
6
|
+
*
|
|
7
|
+
* | 写法 | 为什么不行 |
|
|
8
|
+
* | --- | --- |
|
|
9
|
+
* | `import.meta.env.DEV` | **构建期**常量 —— Vite 在 **core 自己 build 时**就把它替换成 `false` 并把整段摇掉,下游永远看不到 |
|
|
10
|
+
* | 单用 `process.env.NODE_ENV !== "production"` | Vite **dev** 下源码侧根本没有 `process` 全局(真浏览器实测 `typeof process === "undefined"`)⇒ 恰好在最该报的 dev 里哑火,与 prod 行为正好反了 |
|
|
11
|
+
*
|
|
12
|
+
* ⇒ 三档依次取:
|
|
13
|
+
*
|
|
14
|
+
* ⓐ **整 bridge 的 `APP_ENV_INFO.isDev`**(精确,常态):由**下游 app 自己**从它的
|
|
15
|
+
* `import.meta.env` 推出来再交给 core,是唯一不受 core 构建期影响的真信号。
|
|
16
|
+
* 要求下游 `app.use(coreBridge)`(本仓标准装法)。
|
|
17
|
+
* ⓑ 无 bridge 时退 `process.env.NODE_ENV`(webpack / Vite **build** 都会替换它)。
|
|
18
|
+
* ⓒ 两者都取不到 ⇒ **当作 dev**。诊断类输出宁可多一条,也 [MUST NOT] 默认静默 ——
|
|
19
|
+
* 「检测静默失效」的症状与「压根没写」一模一样。
|
|
20
|
+
*
|
|
21
|
+
* **[MUST NOT] 出桶导出**(规则 22,`hooks/index.ts` 已锁面):它是 core 内部诊断设施,
|
|
22
|
+
* 不是给下游的 API。[MUST] 在 setup 期调用(内部 `inject`),返回的是 getter。
|
|
23
|
+
*/
|
|
24
|
+
export declare const useIsDev: () => (() => boolean);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** `useObserveSize` 入参。 */
|
|
2
|
+
export interface UseObserveSizeOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 观测目标获取器(响应式)——返回 `null`/`undefined` 时不观测;
|
|
5
|
+
* 支持派生元素(如 `() => contentRef.value?.parentElement`)。目标变化自动重挂。
|
|
6
|
+
*/
|
|
7
|
+
getTarget: () => HTMLElement | null | undefined;
|
|
8
|
+
/** 尺寸变化回调(RO 触发,携当次 entry;消费方按需读 contentRect / 自量 clientRect)。 */
|
|
9
|
+
onResize: (entry: ResizeObserverEntry) => void;
|
|
10
|
+
/** 是否启用(响应式,缺省恒开);返回 `false` 时断开观测。 */
|
|
11
|
+
enabled?: () => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* RO 回调防抖间隔(ms,默认 `100`)。RO 在抽屉开合 / 窗口拖拽 / CSS 过渡期可**每帧回调**,
|
|
14
|
+
* `onResize` 里写响应式态会引发高频下游重算(provide computed 链 / 列表重排)。
|
|
15
|
+
* 默认防抖以 `{ leading: true, trailing: true }` 分发——**首帧即时**(无初始 0 值闪、
|
|
16
|
+
* 立即给出一次尺寸)+ **尾沿取静止后终值**,把中间高频帧洪流合并掉。
|
|
17
|
+
* 传 `0` 关闭防抖、每次 RO 回调同步透传(消费方自管防抖时用,如 `WatchSize` 的
|
|
18
|
+
* debounce 跨 RO / onUpdated / window.resize 三源共享,不宜在此再叠一层)。
|
|
19
|
+
*/
|
|
20
|
+
debounce?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 激活态感知的 ResizeObserver 元素尺寸观测原语(core hooks)。
|
|
24
|
+
*
|
|
25
|
+
* 把「新建 RO / 观测 / 绑解 / 清理」这套过程性机制从组件 setup 收敛进 hook——组件只声明
|
|
26
|
+
* `getTarget` + `onResize`,[MUST NOT] 在 setup 顶级手搓 `new ResizeObserver`/`let ro`(规则 21)。
|
|
27
|
+
*
|
|
28
|
+
* - **观测**:`getTarget()` 元素尺寸变化(含不触发重渲染的 CSS 过渡折叠 / 异步撑开)→ `onResize`。
|
|
29
|
+
* - **防抖**:默认 `100ms`(`debounce` 可调 / 传 0 关)——RO 高频帧合并,`leading` 首帧即时不丢初值。
|
|
30
|
+
* - **激活态感知**:随 `useActivated` 绑解——激活时观测、失活时断开(规则 21①),失活不空耗。
|
|
31
|
+
* - **目标/开关响应**:`getTarget` 或 `enabled` 变化(如抽屉懒渲染节点出现、`observeResize` 切换)
|
|
32
|
+
* 自动重挂观测(`flush: "post"` 确保 DOM 已 patch)。
|
|
33
|
+
* - **降级**:SSR / 无 `ResizeObserver` 环境静默跳过。
|
|
34
|
+
* - **清理**:`onScopeDispose`(hook 内合法,scope-portable、不依赖组件实例;规则 21③)。
|
|
35
|
+
*/
|
|
36
|
+
export declare const useObserveSize: (options: UseObserveSizeOptions) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PermissionCheckTarget } from '../types';
|
|
2
|
+
/** {@link usePermission} 返回 */
|
|
3
|
+
export interface UsePermissionReturn {
|
|
4
|
+
/**
|
|
5
|
+
* 判定是否有权:`K | K[] | { key, check? }`(唯一可传自定义 `check` 的模板入口)。
|
|
6
|
+
* 空 / `undefined` / `null` = 无要求放行;有要求但未 `app.use(bridge)` / user store 未实例化 ⇒ 判无权。响应式跟随权限列表
|
|
7
|
+
*/
|
|
8
|
+
can: (rule: PermissionCheckTarget) => boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 权限判定组合式:包装 bridge 的 `havePermission`,不新增判定逻辑
|
|
12
|
+
* 按钮级显隐优先 `v-permission` 指令;计算属性 / 程序化动作 / 重组件 `v-if` 用本 hook
|
|
13
|
+
*/
|
|
14
|
+
export declare const usePermission: () => UsePermissionReturn;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
/** {@link useSurface} 返回值 */
|
|
3
|
+
export interface UseSurfaceReturn {
|
|
4
|
+
/** 最终是否成面(显式 prop > 上下文推导 > 默认 true) */
|
|
5
|
+
surfaceActive: ComputedRef<boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* 是否**铺面色**(= 成面 且 项自己没成卡)。
|
|
8
|
+
*
|
|
9
|
+
* 🔴 **面与面不叠**(p4wrtn):项自带卡片时容器再铺一层同色面,gap 漏出的就是与卡片
|
|
10
|
+
* **同一个色**,视觉上「一整片白 + 若干 1px 细框」,卡片不成其为卡片(实测两处
|
|
11
|
+
* `backgroundColor` 完全相同)。故项成卡时**只撤色、不撤呼吸** ——
|
|
12
|
+
* 🔴 [MUST NOT] 连 `surfacePad` 一起撤:呼吸计入高度账(与可用高扣减同源),
|
|
13
|
+
* 撤了会连带改 refine 的 reserve、整页溢出。
|
|
14
|
+
*/
|
|
15
|
+
surfaceBgActive: ComputedRef<boolean>;
|
|
16
|
+
/** 卡内呼吸数值(px);关面时 0。样式与高度账**共用此一处** */
|
|
17
|
+
surfacePad: ComputedRef<number>;
|
|
18
|
+
/** 呼吸的 px 串(供 scoped CSS `v-bind`),与 {@link UseSurfaceReturn.surfacePad} 同源 */
|
|
19
|
+
surfacePadCss: ComputedRef<string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 数据区组件的「自持面」——面色 + 内呼吸 + 圆角由组件**自己**持有。
|
|
23
|
+
*
|
|
24
|
+
* 🔴 **存在的理由 = 让样式与高度账在同一个组件内闭环**:内呼吸既用于渲染,
|
|
25
|
+
* 又要从数据区可用高里扣掉。此前 padding 由 `ListLayout` 经 `:deep()` 从外面刷、
|
|
26
|
+
* 可用高在 `TableMain` 里算,两个组件各管一半 ⇒ 每页恒漏一个 padding
|
|
27
|
+
* (甲方 2026-09-15 报障)。**[MUST NOT] 退回「外层刷面、内层算高」。**
|
|
28
|
+
*
|
|
29
|
+
* 用法:消费组件 [MUST] 把 `surfacePad` 计入自己的可用高扣减,
|
|
30
|
+
* 并把 `surfacePadCss` 经 `v-bind` 喂给 padding —— 两者同源,[MUST NOT] 各写各的。
|
|
31
|
+
*
|
|
32
|
+
* 弹窗正文(`SlotRegion.ModalConfirm_Body`)已经是一块面,经既有
|
|
33
|
+
* `useContextDefaults` + `data-dc-slot` 自动关闭,[MUST NOT] 新造 inject key。
|
|
34
|
+
* ⚠️ 只读**直系父** DOM:弹窗正文里隔了容器(如包着 `ListLayout`)就推导不到,
|
|
35
|
+
* 此时由使用方显式传 `surface={false}`。[MUST NOT] 改成向上遍历——那会让
|
|
36
|
+
* 「直系父」这条简单规则失效。
|
|
37
|
+
*
|
|
38
|
+
* 内部件:仅供 table / data-view 族复用,[MUST NOT] 桶导出进公共 API 面。
|
|
39
|
+
*
|
|
40
|
+
* @param getProps 惰性 getter,读 `props` 保持响应式(含可选 `surface`)
|
|
41
|
+
*/
|
|
42
|
+
export declare const useSurface: <P extends {
|
|
43
|
+
surface?: boolean;
|
|
44
|
+
itemCard?: boolean;
|
|
45
|
+
}>(getProps: () => P) => UseSurfaceReturn;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DeepReadonly } from 'vue';
|
|
2
|
+
import { AppThemeConfig, CoreThemeDensity, CoreThemeMotion } from '../bridge';
|
|
3
|
+
/**
|
|
4
|
+
* 构建节奏 `<style>` 文本:单 `:root{}` 块(明暗无关,[MUST NOT] 进 `:root.dark`)
|
|
5
|
+
* + reduced-motion 兜底块(无条件压过三档,design §2.3)。
|
|
6
|
+
*
|
|
7
|
+
* dual-write 规格(design §3):control-height→`--el-component-size`、font-base→
|
|
8
|
+
* `--el-font-size-base`、motion-duration→`--el-transition-duration-fast`、
|
|
9
|
+
* duration-slow→`--el-transition-duration`、easing→两个 EP bezier。spacing 四 token
|
|
10
|
+
* EP 无对应、仅挂 dc-core(EP 内部写死间距由 §3.1 受控桥接样式重映射)。
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildRhythmCss(density: CoreThemeDensity, motion: CoreThemeMotion): string;
|
|
13
|
+
/** `useCoreThemeApply` 入参。 */
|
|
14
|
+
export interface UseCoreThemeApplyOptions {
|
|
15
|
+
/** 当前风格 config 响应式获取器(= `bridge.APP_THEME_CONFIG`,含 light/dark) */
|
|
16
|
+
getThemeConfig: () => AppThemeConfig | DeepReadonly<AppThemeConfig>;
|
|
17
|
+
/** 是否暗色响应式获取器(= `bridge.themeIsDark.value`) */
|
|
18
|
+
getThemeIsDark: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 当前密度档响应式获取器(= `bridge.themeDensity.value`)。
|
|
21
|
+
* 与 {@link getThemeMotion} **同时**提供才注入节奏 `<style>`;缺省 → 不挂节奏(向后兼容)。
|
|
22
|
+
*/
|
|
23
|
+
getThemeDensity?: () => CoreThemeDensity;
|
|
24
|
+
/** 当前动效档响应式获取器(= `bridge.themeMotion.value`);语义同 {@link getThemeDensity}。 */
|
|
25
|
+
getThemeMotion?: () => CoreThemeMotion;
|
|
26
|
+
/** 注入 document(测试 / SSR);缺省 `globalThis.document`,不存在时静默跳过 */
|
|
27
|
+
document?: Document;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 启动 core 主题挂值——watch 风格 config 重写 `<style>`、watch 暗色 toggle `<html>.dark`。
|
|
31
|
+
*
|
|
32
|
+
* 在组件 setup(`AppLayout`)内调用以随组件作用域自动停 watch。返回 void。
|
|
33
|
+
*/
|
|
34
|
+
export declare function useCoreThemeApply(options: UseCoreThemeApplyOptions): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DeepReadonly } from 'vue';
|
|
2
|
+
import { AppLayoutViewportConfig, AppLayoutGapConfig } from '../bridge';
|
|
3
|
+
/** `useCoreViewportApply` 入参。 */
|
|
4
|
+
export interface UseCoreViewportApplyOptions {
|
|
5
|
+
/** viewport 边框配置响应式获取器(= `bridge.APP_LAYOUT_VIEWPORT_CONFIG`) */
|
|
6
|
+
getViewportConfig: () => AppLayoutViewportConfig | DeepReadonly<AppLayoutViewportConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* 模块间距 gap 配置响应式获取器(= `bridge.APP_LAYOUT_GAP_CONFIG`,可选)。
|
|
9
|
+
* 传入则额外注入 `--dc-core-gap`;不传则不注入该 var(向后兼容)。
|
|
10
|
+
*/
|
|
11
|
+
getGapConfig?: () => AppLayoutGapConfig | DeepReadonly<AppLayoutGapConfig>;
|
|
12
|
+
/** 注入 document(测试 / SSR);缺省 `globalThis.document`,不存在时静默跳过 */
|
|
13
|
+
document?: Document;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 启动 viewport CSS var 挂值——watch viewport config 重写 `<style>`。
|
|
17
|
+
*
|
|
18
|
+
* 在组件 setup(`AppLayout`)内调用以随组件作用域自动停 watch。返回 void。
|
|
19
|
+
*/
|
|
20
|
+
export declare function useCoreViewportApply(options: UseCoreViewportApplyOptions): void;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './bridge';
|
|
2
|
+
export * from './config';
|
|
3
|
+
export * from './helpers';
|
|
4
|
+
export * from './hooks';
|
|
5
|
+
export * from './inject';
|
|
6
|
+
export * from './router';
|
|
7
|
+
export * from './store';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * from './utils';
|
|
10
|
+
export * from './components/basic/action-btn';
|
|
11
|
+
export * from './components/basic/action-btn-group';
|
|
12
|
+
export * from './components/basic/display-contracts';
|
|
13
|
+
export * from './components/basic/drag-float';
|
|
14
|
+
export * from './components/basic/height-provider';
|
|
15
|
+
export * from './components/basic';
|
|
16
|
+
export * from './components/basic/shadow-clone';
|
|
17
|
+
export * from './components/basic/slot-layout-flow-aside';
|
|
18
|
+
export * from './components/basic/slot-layout-template';
|
|
19
|
+
export * from './components/basic/watch-size';
|
|
20
|
+
export * from './components/config/app-theme';
|
|
21
|
+
export * from './components/data/badge-mark';
|
|
22
|
+
export * from './components/data/boolean-tag';
|
|
23
|
+
export * from './components/data/image-preview-trigger';
|
|
24
|
+
export * from './components/data/modal-image-preview';
|
|
25
|
+
export * from './components/feedback/action-confirm';
|
|
26
|
+
export * from './components/feedback/modal-confirm';
|
|
27
|
+
export * from './components/feedback/modal-video-preview';
|
|
28
|
+
export * from './components/feedback/preview-keys';
|
|
29
|
+
export * from './components/feedback/video-preview-trigger';
|
|
30
|
+
export * from './components/other/auto-refresh';
|
|
31
|
+
export * from './components/other/auto-refresh-contracts';
|
|
32
|
+
export * from './components/other/auto-refresh-group';
|
|
33
|
+
export * from './components/other';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './key';
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { CoreBridge } from '../bridge/contracts';
|
|
3
|
+
import { AppLayoutAppStoreSlice, AppLayoutBridgeSlice, AppLayoutUserStoreSlice, ModalLevel, NestFormExposeMap, ShelfController } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* body 视口高度
|
|
6
|
+
* ---
|
|
7
|
+
* AppBody(留 app)通过 provide 写入;
|
|
8
|
+
* TableMain / ListLayout / Page1(核内或核外消费方)通过 inject 读取;
|
|
9
|
+
* ---
|
|
10
|
+
* **只读契约**:值类型 `Readonly<Ref<number>>`——几何真相只许 owner(AppBody 量测 /
|
|
11
|
+
* AppPage 扣槽重 provide)写,后代只读(provide 侧 `readonly()`/`computed` 包装,写 = dev warn +
|
|
12
|
+
* no-op)。类型焊在 key 上 → 所有 inject 点自动只读,[MUST NOT] 消费点自带泛型改写成可写 Ref。
|
|
13
|
+
* ---
|
|
14
|
+
* 使用 `Symbol.for` 全局注册表保证跨包 / 跨 chunk / 跨 ESM 实例的 Symbol 唯一性。
|
|
15
|
+
* `Symbol(key)` 每次调用产生新实例;vite chunk split 或多次模块 evaluate 可能
|
|
16
|
+
* 产生多个 Symbol → inject/provide 失配 → 列表精细化高度计算塌陷至 fallback。
|
|
17
|
+
* ---
|
|
18
|
+
* ⚠️ **已被 `SCOPE_VIEWPORT_MAX_HEIGHT` 取代、留作兼容**:core 内部(hook + refine 消费方)
|
|
19
|
+
* 已全部改走新 key;本 key 仅在各 provider(AppBody / AppPage / ConfirmModal)侧**并列保留
|
|
20
|
+
* provide**,供外部/存量直接 inject 的消费方续用(兼容只体现在"老 provide 不撤",
|
|
21
|
+
* [MUST NOT] 在消费 hook 里加老 key 兜底分支)。
|
|
22
|
+
*/
|
|
23
|
+
export declare const BODY_CONTENT_VIEWPORT_HEIGHT: InjectionKey<Readonly<Ref<number>>>;
|
|
24
|
+
/**
|
|
25
|
+
* scope 视口可用最大高载荷——单 key 承载「就近链」+「具名 scope 定向」。
|
|
26
|
+
* ---
|
|
27
|
+
* 取代 `BODY_CONTENT_VIEWPORT_HEIGHT`(一个 key 逐层含义不同、语义混浊)与
|
|
28
|
+
* `Symbol.for(props.channel)` 裸串 channel 机制(per-id 派生 symbol、无命名空间):
|
|
29
|
+
* 每个有界容器 provider(AppBody / AppPage / TabsMain 精细流 / ConfirmModal)provide
|
|
30
|
+
* 一个本对象,`parent` 指向上一层对象形成**祖先链**——
|
|
31
|
+
* - **就近**:消费方(`useChannelViewportHeight`)inject 最近对象取 `.viewportMaxHeight`;
|
|
32
|
+
* - **定向**:消费方带 `parentChannel` → 沿 `.parent` 走链找 `scope === parentChannel` 的那层;
|
|
33
|
+
* - **隔断**:弹层(ConfirmModal)不 inject 上层、自测自体高、`parent: undefined` 断链——
|
|
34
|
+
* 弹层内后代只见弹层 scope,不受身后页面高影响。
|
|
35
|
+
*/
|
|
36
|
+
export interface ScopeViewportMaxHeight {
|
|
37
|
+
/** 本 scope 标识:具名容器(TabsMain 的 channel)取 props.channel;匿名容器(AppBody/AppPage/弹层)为 undefined */
|
|
38
|
+
scope?: string;
|
|
39
|
+
/** 本 scope 的可用最大高(响应式只读,同老 key 只读契约) */
|
|
40
|
+
viewportMaxHeight: Readonly<Ref<number>>;
|
|
41
|
+
/** 祖先链:上一层 scope 对象;隔断层(ConfirmModal)置 undefined 断链 */
|
|
42
|
+
parent?: ScopeViewportMaxHeight;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* scope 视口可用最大高 inject key(对象 + 祖先链,见 {@link ScopeViewportMaxHeight})。
|
|
46
|
+
* ---
|
|
47
|
+
* provider 侧与老 `BODY_CONTENT_VIEWPORT_HEIGHT` **并列 provide**(同一响应式源;
|
|
48
|
+
* ConfirmModal modal 态例外:老 key 透传外层、新 key 自测减预留,两值可不同 by design)。
|
|
49
|
+
* 消费侧(hook + core 内部 refine 全家)只认本 key。
|
|
50
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(同 BODY_CONTENT_VIEWPORT_HEIGHT,规则 8)。
|
|
51
|
+
*/
|
|
52
|
+
export declare const SCOPE_VIEWPORT_MAX_HEIGHT: InjectionKey<ScopeViewportMaxHeight>;
|
|
53
|
+
/**
|
|
54
|
+
* body 内容矩形四边 viewport inset + shim 内边距(AppPage 四向悬浮插槽用)
|
|
55
|
+
* ---
|
|
56
|
+
* AppBody(持 store 几何)算好「内容矩形」= `app-body-shim` 外框相对 viewport 的四边
|
|
57
|
+
* inset(CSS calc 字符串,响应式)+ `shimPadding`(app-body-shim 内边距 px)后 provide;
|
|
58
|
+
* AppPage inject 自取,把四向悬浮插槽(page 级 header/footer/sidebar/aside)以
|
|
59
|
+
* `position: fixed` 纯 calc 定位(视口坐标、scroll 不变、随 chrome 自动跟),并据
|
|
60
|
+
* `shimPadding` 给各插槽 shim 的「朝 chrome 三边」留呼吸。
|
|
61
|
+
* ---
|
|
62
|
+
* 四区贴 app-body-shim 外框(inset 不含 shimPadding);shimPadding 改由各插槽内层 shim
|
|
63
|
+
* 的外侧边消化、内侧边用 AppPage gap。bottom inset 已扣 footer(取 minHeight 算)。
|
|
64
|
+
* inject 缺命中(脱离 AppLayout 单用)时 AppPage 降级量自身盒子兜底(shimPadding=0)。
|
|
65
|
+
* ---
|
|
66
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(同 BODY_CONTENT_VIEWPORT_HEIGHT,规则 8)。
|
|
67
|
+
*/
|
|
68
|
+
export declare const BODY_CONTENT_VIEWPORT_RECT: InjectionKey<ComputedRef<{
|
|
69
|
+
top: string;
|
|
70
|
+
left: string;
|
|
71
|
+
right: string;
|
|
72
|
+
bottom: string;
|
|
73
|
+
shimPadding: number;
|
|
74
|
+
}>>;
|
|
75
|
+
/**
|
|
76
|
+
* body 内容矩形四边 viewport inset 的**已解析 px 数值**(app 级 chrome:header/footer/sidebar/aside + 外框 + gap)。
|
|
77
|
+
* ---
|
|
78
|
+
* 与 `BODY_CONTENT_VIEWPORT_RECT`(calc 字符串,供 CSS fixed 定位)**同源异形**:同一份 store 几何真相,
|
|
79
|
+
* 一个出 calc 串给 CSS、一个出 px 数值给 JS。四边 inset 里 `100vh` 全约掉 → store 纯数值算出(零探针、
|
|
80
|
+
* 零 getBoundingClientRect),响应式随 chrome(header/sidebar 显隐、尺寸/gap 配置、折叠)自动跟。
|
|
81
|
+
* ---
|
|
82
|
+
* 用途:自管滚动的后代(如 TabsMain tile 自然流 window 滚动)算「固定 chrome 顶厚度」作 ElAnchor offset;
|
|
83
|
+
* AppPage 在此基础上叠加自己的四向悬浮插槽 → `APP_PAGE_CONTENT_INSET`。
|
|
84
|
+
* inject 缺命中(脱离 AppLayout 单用)→ 消费方退 `{0,0,0,0}`(standalone 无 app chrome)。
|
|
85
|
+
* ---
|
|
86
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(同 BODY_CONTENT_VIEWPORT_HEIGHT,规则 8)。
|
|
87
|
+
*/
|
|
88
|
+
export declare const BODY_CONTENT_VIEWPORT_INSET: InjectionKey<ComputedRef<{
|
|
89
|
+
top: number;
|
|
90
|
+
bottom: number;
|
|
91
|
+
left: number;
|
|
92
|
+
right: number;
|
|
93
|
+
}>>;
|
|
94
|
+
/**
|
|
95
|
+
* AppPage 对后代暴露的「固定 chrome 四边内衬」——含四向悬浮插槽 + 内容矩形 inset 的**已解析 px** 值。
|
|
96
|
+
* ---
|
|
97
|
+
* `BODY_CONTENT_VIEWPORT_RECT` 只含「header + 主题 viewport + sidebar」inset,**不含 AppPage 自己的
|
|
98
|
+
* 四向悬浮插槽**。自然流(window 滚动)自管滚动的后代(如 TabsMain tile)算「滚动 offset」时须知道
|
|
99
|
+
* 含四槽的**固定 chrome** 厚度,否则内容被顶/底/侧悬浮插槽遮住。故 AppPage(四槽唯一 owner)在
|
|
100
|
+
* `BODY_CONTENT_VIEWPORT_INSET`(app 级 chrome 的 px 数值)基础上叠加自己四槽尺寸(含 gap)后 provide,
|
|
101
|
+
* 后代只消费不自造。**纯数值加法、零探针**(app 级 inset 已是 store 算好的 px)。
|
|
102
|
+
* ---
|
|
103
|
+
* - `top`/`bottom`/`left`/`right`:固定 chrome 在窗口坐标下的 px 厚度(= 内容矩形对应 inset + 对应槽含 gap)。
|
|
104
|
+
* 自然流(window 滚动)的组件用 `top` 作 ElAnchor `offset`(scrollTo 与 scrollspy 同用一值)。
|
|
105
|
+
* ---
|
|
106
|
+
* 注:**有界容器"可用高度"不走此 key**——AppPage 把可用高扣四槽后重 provide
|
|
107
|
+
* `SCOPE_VIEWPORT_MAX_HEIGHT`(+ 老 key 并列,见 AppPage),故 `useChannelViewportHeight`
|
|
108
|
+
* 的所有消费方(ListLayout / TableMain / TabsRefineFlow / TabsTile refine)在 AppPage 内
|
|
109
|
+
* **自动**拿到扣槽后的高,无需逐个改。
|
|
110
|
+
* ---
|
|
111
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(同 BODY_CONTENT_VIEWPORT_HEIGHT,规则 8)。
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* 所在 `AppPage` 是否开了页面级 navbar(`showNavBar`)。
|
|
115
|
+
* ---
|
|
116
|
+
* 用途:页面 chrome 已有 navbar 时,内容容器(`ViewLayout` toolbar)不再铺第二层标题栏式的背景面(c1oj1d ③)。
|
|
117
|
+
* 走 inject(任意层级祖先 `AppPage`,就近),[MUST NOT] 读 DOM。缺命中(脱离 AppPage)= 无 navbar。
|
|
118
|
+
* ---
|
|
119
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8)。
|
|
120
|
+
*/
|
|
121
|
+
export declare const APP_PAGE_NAV_BAR_ACTIVE: InjectionKey<Readonly<Ref<boolean>>>;
|
|
122
|
+
export declare const APP_PAGE_CONTENT_INSET: InjectionKey<Readonly<Ref<Readonly<{
|
|
123
|
+
top: number;
|
|
124
|
+
bottom: number;
|
|
125
|
+
left: number;
|
|
126
|
+
right: number;
|
|
127
|
+
}>>>>;
|
|
128
|
+
/**
|
|
129
|
+
* 弹窗架子 inject key 工厂——按 level 参数化。
|
|
130
|
+
* Symbol.for 全局注册表保证跨包/跨 chunk/跨 ESM 实例唯一(同 BODY_CONTENT_VIEWPORT_HEIGHT)。
|
|
131
|
+
*/
|
|
132
|
+
export declare function getModalShelfInjectionKey(level: ModalLevel): InjectionKey<ShelfController>;
|
|
133
|
+
/**
|
|
134
|
+
* TabsMain 视觉嵌套层级 inject key(独立于 channel payload.level)。
|
|
135
|
+
* ---
|
|
136
|
+
* 与 channel(SCOPE_VIEWPORT_MAX_HEIGHT scope 链,高度预算用)体系完全解耦:
|
|
137
|
+
* 视觉 level = 物理嵌套深度,每层 TabsMain(含 refine=false)+1 → provide 给后代
|
|
138
|
+
* ---
|
|
139
|
+
* 用途:TabsHeader 据此应用层级化样式(L1 卡片 / L2 下划线 / L3 紧凑 / L4+ 仅文字加粗)。
|
|
140
|
+
* setup 期一次性 provide number(不响应式);Symbol.for 跨包/chunk/ESM 实例唯一(同上)。
|
|
141
|
+
*/
|
|
142
|
+
export declare const TABS_MAIN_VISUAL_LEVEL: InjectionKey<number>;
|
|
143
|
+
/**
|
|
144
|
+
* AppLayout 族 app store 窄化消费契约 inject key。
|
|
145
|
+
* ---
|
|
146
|
+
* AppLayout(唯一 `useAppStore()` 调用方)provide;子组件
|
|
147
|
+
* (AppBody / AppHeader / AppSidebar / AppFooter)inject 自取。
|
|
148
|
+
* Symbol.for 保证跨包同一性(同 BODY_CONTENT_VIEWPORT_HEIGHT)。
|
|
149
|
+
*/
|
|
150
|
+
export declare const APP_LAYOUT_APP_STORE_KEY: InjectionKey<AppLayoutAppStoreSlice>;
|
|
151
|
+
/**
|
|
152
|
+
* AppLayout 族 user store 窄化消费契约 inject key。
|
|
153
|
+
* ---
|
|
154
|
+
* AppLayout 集中 provide;AppHeader inject 自取(取 userInfo / isLogin / logout 等)。
|
|
155
|
+
* Symbol.for 保证跨包同一性。
|
|
156
|
+
*/
|
|
157
|
+
export declare const APP_LAYOUT_USER_STORE_KEY: InjectionKey<AppLayoutUserStoreSlice>;
|
|
158
|
+
/**
|
|
159
|
+
* AppLayout 族 bridge 窄化消费契约 inject key(#7.6 期挂载)。
|
|
160
|
+
* ---
|
|
161
|
+
* AppLayout 通过 `props.bridge` 接收注入后 provide;子组件
|
|
162
|
+
* (AppBody/AppHeader/AppSidebar/AppLayout 内菜单派生)inject 自取 12 readonly
|
|
163
|
+
* 配置属性 + getRoutes / generateRouteMetaRawTree 派生方法。
|
|
164
|
+
* Symbol.for 保证跨包同一性(同 APP_LAYOUT_APP_STORE_KEY / APP_LAYOUT_USER_STORE_KEY)。
|
|
165
|
+
*/
|
|
166
|
+
export declare const APP_LAYOUT_BRIDGE_KEY: InjectionKey<AppLayoutBridgeSlice>;
|
|
167
|
+
/**
|
|
168
|
+
* 整 bridge app 级注入 key(#插件系统一期挂载)。
|
|
169
|
+
* ---
|
|
170
|
+
* `bridge.install(app)`(即 `app.use(bridge)`)经 `app.provide(CORE_BRIDGE_KEY, bridge)`
|
|
171
|
+
* 把**整个 bridge 实例**注入应用级 provide 链;任意后代组件经 `inject(CORE_BRIDGE_KEY)`
|
|
172
|
+
* 取整 bridge(含 7 响应式只读配置视图 + `update` + 全部 auth/api/派生方法)。
|
|
173
|
+
* ---
|
|
174
|
+
* **opt-in**:仅当 app 显式 `app.use(bridge)` 时注入;未 use 则 `inject(CORE_BRIDGE_KEY)`
|
|
175
|
+
* 返回 `undefined`(不报错)。
|
|
176
|
+
* ---
|
|
177
|
+
* **区别于 `APP_LAYOUT_BRIDGE_KEY`**:后者是 AppLayout 族**组件级**窄切片(`AppLayoutBridgeSlice`
|
|
178
|
+
* Pick 子集,由 AppLayout 从 `props.bridge` 接收后 provide,供 layout 子组件 inject),
|
|
179
|
+
* 两 KEY 各管各、并存——本 KEY 注入的是 app 级**整 bridge**,非 layout 窄切片。
|
|
180
|
+
* ---
|
|
181
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(同 APP_LAYOUT_BRIDGE_KEY,规则 8)。
|
|
182
|
+
*/
|
|
183
|
+
export declare const CORE_BRIDGE_KEY: InjectionKey<CoreBridge>;
|
|
184
|
+
/**
|
|
185
|
+
* FormMain 本轮校验的**错误字段 key 列表** inject key。
|
|
186
|
+
*
|
|
187
|
+
* 用途:折叠分组(`swiftFormItemGroup`)的标题组件据此判断「错误是否落在本组」,
|
|
188
|
+
* 命中则**自动展开 + 滚动到错误项** —— 折叠 ≠ 隐藏,折叠区照常校验,
|
|
189
|
+
* 但 [MUST NOT] 让使用者面对「看不见错在哪、却提交不了」。
|
|
190
|
+
*
|
|
191
|
+
* 由 `FormMain` provide(每次 `validate()` 结算时写入,成功写空数组)。
|
|
192
|
+
*/
|
|
193
|
+
export declare const FORM_VALIDATE_ERROR_KEYS: InjectionKey<Readonly<Ref<string[]>>>;
|
|
194
|
+
/**
|
|
195
|
+
* 嵌套子 FormMain exposeMap inject key(配置化嵌套联结组件 Nest 三件套挂载)。
|
|
196
|
+
* ---
|
|
197
|
+
* 每个 FormMain `provide` 一份本 key 的空 exposeMap(shallowReactive,按 item key 索引),
|
|
198
|
+
* 供其后代联结组件(FormItemNestForm)`inject` 到**最近祖先** FormMain 的 map 并把子
|
|
199
|
+
* FormMain 的级联 expose 写入(key = 自身 item key);FormMain 的 validate/clearValidate/
|
|
200
|
+
* resetFields 遍历自身 map 级联子表单。
|
|
201
|
+
* ---
|
|
202
|
+
* provide/inject 链天然实现「只挂最近祖先」(inject 向上解析至最近 provide)。
|
|
203
|
+
* 注册由联结组件显式触发(非裸嵌套 FormMain 自动注册)→ 旧用法零回归(additive)。
|
|
204
|
+
* ---
|
|
205
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8,同上)。
|
|
206
|
+
*/
|
|
207
|
+
export declare const FORM_NEST_REGISTRY_KEY: InjectionKey<NestFormExposeMap>;
|
|
208
|
+
/**
|
|
209
|
+
* 嵌套布局 rebase 累乘因子 inject key(P3 嵌套布局 rebase 挂载)。
|
|
210
|
+
* ---
|
|
211
|
+
* 每个 FormMain `provide` 自身 `layoutScale`(缺省 1)的响应式只读引用;
|
|
212
|
+
* 其后代联结组件(FormItemNestForm / FormItemNestFormList)`inject` 到**最近祖先**的 scale,叠本层因子
|
|
213
|
+
* `childScale = parentScale × (24 / parentItemSpan)` 后作 `layoutScale` 传子 FormMain。
|
|
214
|
+
* ---
|
|
215
|
+
* 顶级 FormMain 未嵌套时 provide 1 → 子层缺省行为不变(向后兼容)。
|
|
216
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8,同上)。
|
|
217
|
+
*/
|
|
218
|
+
export declare const NEST_LAYOUT_SCALE_KEY: InjectionKey<Readonly<Ref<number>>>;
|
|
219
|
+
/**
|
|
220
|
+
* 列表 / 详情同页范式上下文 inject key(`AppPageListDetailLayout` 唯一 provide、后代按需 inject)。
|
|
221
|
+
* ---
|
|
222
|
+
* 承载两件事,**刻意合成同一个上下文、[MUST NOT] 另开第二个接缝**:
|
|
223
|
+
* - **序列导航**(`hasPrev` / `hasNext` / `goPrev` / `goNext` / `index` / `total`)——
|
|
224
|
+
* `ViewLayout` 据此**可选探测**是否渲染内置上/下一条按钮:注入到才渲染,
|
|
225
|
+
* 单独使用 `ViewLayout` 时完全不渲染(老用法一行不改)。
|
|
226
|
+
* - **`refreshList`**(REQ-06 单向同步的唯一通路):详情侧判定与列表 item 不同步时触发
|
|
227
|
+
* **列表整体刷新**,由列表接口出新数据;[MUST NOT] 由详情反向回写 `activeData`。
|
|
228
|
+
* ---
|
|
229
|
+
* `index` 为 **1 基**(无当前项 = 0),直接可作 “第 index / total 条” 展示。
|
|
230
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8,同上)。
|
|
231
|
+
*/
|
|
232
|
+
export declare const APP_PAGE_LIST_DETAIL_CONTEXT: InjectionKey<{
|
|
233
|
+
/** 是否有上一条(当前项不在序列内时为 false) */
|
|
234
|
+
hasPrev: Readonly<Ref<boolean>>;
|
|
235
|
+
/** 是否有下一条(当前项不在序列内时为 false) */
|
|
236
|
+
hasNext: Readonly<Ref<boolean>>;
|
|
237
|
+
/** 当前项在序列中的位置(1 基;无当前项 / 不在序列内 = 0) */
|
|
238
|
+
index: Readonly<Ref<number>>;
|
|
239
|
+
/** 当前序列总条数(= 列表当前页数据条数,本期不跨页) */
|
|
240
|
+
total: Readonly<Ref<number>>;
|
|
241
|
+
/** 切到上一条(无上一条时空操作) */
|
|
242
|
+
goPrev: () => void;
|
|
243
|
+
/** 切到下一条(无下一条时空操作) */
|
|
244
|
+
goNext: () => void;
|
|
245
|
+
/** 触发列表整体刷新(REQ-06 唯一通路) */
|
|
246
|
+
refreshList: () => void;
|
|
247
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RouteRecordRaw } from 'vue-router';
|
|
2
|
+
export interface WithGroupRedirectOptions {
|
|
3
|
+
/** 分组父配了 component 时的处置:"warn"(默认)console.warn;"error" throw。 */
|
|
4
|
+
onParentComponent?: "warn" | "error";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 路由分组处理(替代 flatRoutes,纯函数、递归多层):
|
|
8
|
+
* ① 无 component 分组父补 redirect 到 children[0],防直达父路径白屏(权限交守卫再校验);
|
|
9
|
+
* 无 name 子路由的兜底目标用 redirect 函数的 `to.path` 拼接——不依赖静态 basePath,
|
|
10
|
+
* 分组挂在任意 base 下(router root 或外层父路由)均正确。
|
|
11
|
+
* ② 分组父配了 component 时按 onParentComponent 警告/报错(范式:分组父不承接视图,共享父视图走 teleport)。
|
|
12
|
+
* 有显式 redirect / component 的节点原样保留。
|
|
13
|
+
*/
|
|
14
|
+
export declare const withGroupRedirect: (routes: RouteRecordRaw[], options?: WithGroupRedirectOptions) => RouteRecordRaw[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Router } from 'vue-router';
|
|
2
|
+
import { checkLogin } from './login';
|
|
3
|
+
import { checkPermission } from './permission';
|
|
4
|
+
import { CreateGuardOptions } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* 路由守卫工厂——给 router 装登录守卫 + 权限守卫 + document.title 写入。
|
|
7
|
+
*
|
|
8
|
+
* 1:1 镜像原 app `router/guard/index.ts` 行为:
|
|
9
|
+
* - beforeEach: checkLogin → 跳 loginPath;checkPermission → 跳 noPermissionPath
|
|
10
|
+
* - beforeResolve: document.title = to.meta.title
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* createGuard(router, {
|
|
14
|
+
* bridge: appBridge,
|
|
15
|
+
* useRoutePermission,
|
|
16
|
+
* });
|
|
17
|
+
*/
|
|
18
|
+
export declare const createGuard: (router: Router, options: CreateGuardOptions) => void;
|
|
19
|
+
export { checkLogin, checkPermission };
|
|
20
|
+
export type { CreateGuardOptions, GuardBridgeSlice, GuardRoutePermissionStore, } from './types';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RouteLocationNormalized } from 'vue-router';
|
|
2
|
+
import { GuardRoutePermissionStore } from './types';
|
|
3
|
+
/** 登录检测壳子——复用 store.checkNeedGoToLoginPage */
|
|
4
|
+
export declare const checkLogin: (to: RouteLocationNormalized, store: GuardRoutePermissionStore) => Promise<boolean>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RouteLocationNormalized } from 'vue-router';
|
|
2
|
+
import { GuardRoutePermissionStore } from './types';
|
|
3
|
+
/** 权限检测壳子——复用 store.checkNeedGoToAuthPage */
|
|
4
|
+
export declare const checkPermission: (to: RouteLocationNormalized, store: GuardRoutePermissionStore) => Promise<boolean>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RouteLocationNormalized } from 'vue-router';
|
|
2
|
+
import { CoreBridge } from '../../bridge';
|
|
3
|
+
/** guard 仅依赖 bridge 的路径配置切片(Pick 表达 → 必 type alias,无法 interface) */
|
|
4
|
+
export type GuardBridgeSlice = Pick<CoreBridge, "APP_ROUTER_PATHS_CONFIG">;
|
|
5
|
+
/** guard 仅依赖 route-permission store 的 2 个 check 方法 */
|
|
6
|
+
export interface GuardRoutePermissionStore {
|
|
7
|
+
checkNeedGoToLoginPage: (route: RouteLocationNormalized) => boolean;
|
|
8
|
+
checkNeedGoToAuthPage: (route: Pick<RouteLocationNormalized, "path">) => boolean;
|
|
9
|
+
}
|
|
10
|
+
/** createGuard 入参 */
|
|
11
|
+
export interface CreateGuardOptions {
|
|
12
|
+
bridge: GuardBridgeSlice;
|
|
13
|
+
useRoutePermission: () => GuardRoutePermissionStore;
|
|
14
|
+
}
|