@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,141 @@
|
|
|
1
|
+
import { RouteRecordRaw } from 'vue-router';
|
|
2
|
+
import { DefineComponent } from 'vue';
|
|
3
|
+
import { PermissionCheck, PermissionKey, PermissionRequirement } from './permission';
|
|
4
|
+
/** 路由权限配置 */
|
|
5
|
+
export type RoutePermission = Partial<{
|
|
6
|
+
/** 是否需要登录 */
|
|
7
|
+
login: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 权限码:单码或数组(复合页:一页承载多个权限区域,页面内各区块再按各自的码显隐)。
|
|
10
|
+
* 空数组 / 不配 = 没有权限要求。单码期望非 0 / 非空串
|
|
11
|
+
*/
|
|
12
|
+
key: PermissionKey | PermissionKey[];
|
|
13
|
+
/** 多码裁决,缺省 `permissionCheckAny`(任一即可);[MUST] 为纯函数,抛错判无权 */
|
|
14
|
+
check: PermissionCheck;
|
|
15
|
+
/** 权限key使用路径 */
|
|
16
|
+
keyUsePath: boolean;
|
|
17
|
+
/** 权限编辑时是否展示 默认配置权限key就会展示 */
|
|
18
|
+
editShow: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* 路由 meta 扩展形状(与 app 端 vue-router declaration merging 对齐)
|
|
22
|
+
* ---
|
|
23
|
+
* core 不做全局 declaration merging,仅作 core 内部类型自洽用;
|
|
24
|
+
* app 端仍通过自身 router-meta.d.ts 做 vue-router declaration merging,获得 vue-router RouteMeta 的扩展类型
|
|
25
|
+
*/
|
|
26
|
+
export interface AppRouteMeta {
|
|
27
|
+
/** 页面名称 */
|
|
28
|
+
title: string;
|
|
29
|
+
/** 是否缓存 */
|
|
30
|
+
keepAlive?: boolean;
|
|
31
|
+
/** 是否重定向到第一个有权限的子路由 */
|
|
32
|
+
redirectToFirstChildRoute?: boolean;
|
|
33
|
+
/** 页面布局 */
|
|
34
|
+
layout?: Partial<{
|
|
35
|
+
header: boolean;
|
|
36
|
+
sidebar: boolean;
|
|
37
|
+
/** 右侧 aside 补充区显隐(additive;默认 false,仅自定义 shell 渲染) */
|
|
38
|
+
aside: boolean;
|
|
39
|
+
footer: boolean;
|
|
40
|
+
breadcrumb: boolean;
|
|
41
|
+
bodyShimPadding: number;
|
|
42
|
+
/**
|
|
43
|
+
* 全屏展示:viewport 四边套框留白归零(默认 false = 跟随全局配置)。
|
|
44
|
+
* ----
|
|
45
|
+
* 归零覆盖**两条链**:① core 自身的 header/sidebar/aside/footer/body 几何锚点;
|
|
46
|
+
* ② 对外 `--dc-core-viewport-*` CSS var(浮层 / 主题 decor / 业务页 CSS 消费)。
|
|
47
|
+
* 二者同源于 `viewportConfigEffective`,[MUST NOT] 只改一边——否则「全屏」是半吊子:
|
|
48
|
+
* 内容区贴边了,读 CSS var 的浮层仍按套框内缘定位。
|
|
49
|
+
*
|
|
50
|
+
* **只管最外圈套框留白**,不影响模块间距 gap(`APP_LAYOUT_GAP_CONFIG`)——
|
|
51
|
+
* 该页若仍开着 header/sidebar,模块之间的内缝照旧。
|
|
52
|
+
*/
|
|
53
|
+
noViewportPadding: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 内容区贴边:本路由 `AppBody` 左 / 右 / 上的 gap 档归零(默认 false)。底边照旧。
|
|
56
|
+
* ----
|
|
57
|
+
* 与 {@link noViewportPadding} 正交(那个只管最外圈套框,管不到 gap 这一截),常一起开。
|
|
58
|
+
* 贴视口边去模块档、贴 header / sidebar / aside 去外圈档;chrome 自身留白不动。
|
|
59
|
+
* `bodyStyle` / `contentViewportInset` / `bodyShimStyle.minHeight` 三处同源归零。
|
|
60
|
+
*/
|
|
61
|
+
noBodyPadding: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 进入本路由不做布局过渡动画(默认 false = 有动画)。
|
|
64
|
+
* ----
|
|
65
|
+
* 用于「进入即定格」的页面(登录页、全屏展示页):布局各模块尺寸从上一页
|
|
66
|
+
* 变到本页时不再做 300ms 补间,避免视觉上「先看到上一页的骨架再飞过来」。
|
|
67
|
+
* 与既有的「未登录即关动画」(`app-layout_noLogin`)并列生效,互不替代。
|
|
68
|
+
*/
|
|
69
|
+
noAnimation: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
/** 菜单 */
|
|
72
|
+
menu?: Partial<{
|
|
73
|
+
show: boolean;
|
|
74
|
+
sort: number;
|
|
75
|
+
/** 图标 (element-plus 等图标实例的 DefineComponent 签名差异较大,这里用 any 兼容) */
|
|
76
|
+
icon: any;
|
|
77
|
+
/**
|
|
78
|
+
* 点击菜单项(顶栏模块条 / 侧栏菜单)的打开方式,缺省 `"_self"`(当前页跳转,老行为)。
|
|
79
|
+
* `"_blank"` = 新标签页打开本路由,当前页路由与激活高亮**不变**(独立展示页 / 文档页入口)。
|
|
80
|
+
* 只作用于菜单点击;地址栏直达、分享链接等其它导航不受影响。
|
|
81
|
+
*/
|
|
82
|
+
target: "_self" | "_blank";
|
|
83
|
+
}>;
|
|
84
|
+
/** 权限 */
|
|
85
|
+
permission?: RoutePermission;
|
|
86
|
+
}
|
|
87
|
+
/** 获取路由权限key入参 */
|
|
88
|
+
export interface GetRoutePermissionParams {
|
|
89
|
+
/** 路由路径 */
|
|
90
|
+
path: string;
|
|
91
|
+
/** 权限配置 */
|
|
92
|
+
permission: RoutePermission | undefined;
|
|
93
|
+
}
|
|
94
|
+
/** 路由元信息解析raw */
|
|
95
|
+
export interface RouteMetaResolveRaw {
|
|
96
|
+
/** 路由地址 */
|
|
97
|
+
path: string;
|
|
98
|
+
/**
|
|
99
|
+
* 路由 `name`(vue-router 里是可选的,且允许 symbol —— 解析期只留 string,其余为 `undefined`)。
|
|
100
|
+
*
|
|
101
|
+
* 用途:跨层引用路由的**逻辑标识**。典型消费方是徽标注册表——服务端下发的动态标
|
|
102
|
+
* (待办数 / 未开通)不该知道前端的 URL 结构,`path` 一改(加前缀 / 挪模块 / 路径国际化)
|
|
103
|
+
* 那张 key 表就**静默失效**(标不显示而已,不报错)。
|
|
104
|
+
*/
|
|
105
|
+
name?: string;
|
|
106
|
+
/** 页面名称 */
|
|
107
|
+
title: string;
|
|
108
|
+
/** 路由级别 */
|
|
109
|
+
routeLevel: number;
|
|
110
|
+
/**
|
|
111
|
+
* 是否重定向到第一个有权限的子路由
|
|
112
|
+
* 详见 RouteMeta.redirectToFirstChildRoute
|
|
113
|
+
*/
|
|
114
|
+
redirectToFirstChildRoute: boolean;
|
|
115
|
+
/** 是否在菜单展示 */
|
|
116
|
+
menuShow: boolean;
|
|
117
|
+
/** 菜单icon */
|
|
118
|
+
menuIcon?: DefineComponent;
|
|
119
|
+
/** 菜单排序 */
|
|
120
|
+
menuSort: number;
|
|
121
|
+
/** 菜单点击打开方式(`meta.menu.target`,缺省 `"_self"`) */
|
|
122
|
+
menuTarget: "_self" | "_blank";
|
|
123
|
+
/** 子路由原始配置 */
|
|
124
|
+
childrenRaw: RouteRecordRaw[];
|
|
125
|
+
/** 子路由元信息解析raw */
|
|
126
|
+
children: RouteMetaResolveRaw[];
|
|
127
|
+
/** 父路由地址 */
|
|
128
|
+
parentPath: string;
|
|
129
|
+
/** 父路由地址列表 */
|
|
130
|
+
parentPathList: string[];
|
|
131
|
+
/** 权限key:**仅 `key` 写成标量时给值**(数组含单元素数组一律 `undefined`,读 `permissionRequirement`) */
|
|
132
|
+
permissionKey?: string | number;
|
|
133
|
+
/** 归一后的权限要求(`{ key: K[], check }`);无要求为 `undefined`。判定一律读它 */
|
|
134
|
+
permissionRequirement?: PermissionRequirement;
|
|
135
|
+
/** 是否检测权限 */
|
|
136
|
+
checkPermission: boolean;
|
|
137
|
+
/** (配置权限的前提下)权限编辑时是否展示 */
|
|
138
|
+
permissionEditShow: boolean;
|
|
139
|
+
/** 是否需要登录 */
|
|
140
|
+
needLogin: boolean;
|
|
141
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 联合类型转交叉类型
|
|
3
|
+
* ---
|
|
4
|
+
* 用于多个 DotToObject 结果合并:
|
|
5
|
+
* { page: { page: number } } | { page: { pageSize: number } }
|
|
6
|
+
* -> { page: { page: number; pageSize: number } }
|
|
7
|
+
*/
|
|
8
|
+
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
9
|
+
/**
|
|
10
|
+
* 阻断类型推断(等价 TS 5.4 内置的 `NoInfer<T>`,自带一份不依赖下游 TS 版本)。
|
|
11
|
+
* ---
|
|
12
|
+
* 用于「同一个泛型参数被多处标注、但只应由其中一处决定」的场景:把不该参与推断的那处
|
|
13
|
+
* 包上本类型,该位置便只做校验、不产候选。
|
|
14
|
+
*
|
|
15
|
+
* ⚠️ [MUST NOT] 直接用 TS 内置 `NoInfer<T>`:core 是发布包,它会原样落进 `.d.ts`,
|
|
16
|
+
* 下游 TS < 5.4 编译时报 `Cannot find name 'NoInfer'`(本包 devDep 声明的还是 `^5.2.2`)。
|
|
17
|
+
*
|
|
18
|
+
* 实现:`[T]` 包一层再按 `T extends any` 取下标——延迟解析使该位置成为非推断位。
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // R 只由 api 的返回类型定;title 回调的标注不参与推断
|
|
22
|
+
* api: () => Promise<R>;
|
|
23
|
+
* title?: (data: NoInferType<R>) => string;
|
|
24
|
+
*/
|
|
25
|
+
export type NoInferType<T> = [T][T extends any ? 0 : never];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 向上查找最近的「可滚祖先」:computed `overflow-y` 为 auto/scroll/overlay **且**
|
|
3
|
+
* 当前真实溢出(scrollHeight > clientHeight)。到 body / documentElement 为止;
|
|
4
|
+
* 无命中 → `undefined`(调用方按 window 滚动处理)。
|
|
5
|
+
*
|
|
6
|
+
* 双条件缺一不可:只看 overflow 会误吸「auto 但不限高、从不产生滚动」的装饰容器
|
|
7
|
+
* (真滚动在 window,对它 scrollTop 无效);只看溢出会把 `overflow: hidden` 的
|
|
8
|
+
* 裁剪容器当滚动容器。SSR / 无 DOM 环境传 null 返回 undefined。
|
|
9
|
+
*/
|
|
10
|
+
export declare function domClosestScrollableAncestor(el: HTMLElement | null | undefined): HTMLElement | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* 向上查找 CSS `position: sticky` 的「滚动口祖先」:computed `overflow-y` 为
|
|
13
|
+
* auto/scroll/overlay/hidden 的最近祖先(hidden 也是滚动容器,可编程滚动;clip 不是)。
|
|
14
|
+
* 与 CSS 粘性语义同构——sticky 以最近非 visible/clip 溢出祖先为 scrollport,
|
|
15
|
+
* **不看当下是否真溢出**(内容后到才溢出时 scrollport 归属不变)。
|
|
16
|
+
* 到 body / documentElement 为止;无命中 → `undefined`(scrollport = 视口,
|
|
17
|
+
* 调用方按 window 滚动处理)。SSR / 无 DOM 环境传 null 返回 undefined。
|
|
18
|
+
*
|
|
19
|
+
* 与 `domClosestScrollableAncestor` 的分工:后者服务「现在就要滚过去」
|
|
20
|
+
* (scrollTo / scrollspy),必须真溢出;本函数服务 sticky offset 的坐标系归属,
|
|
21
|
+
* 判据必须与 CSS 一致——若沿用真溢出条件,容器尚未溢出时会误判 window 滚,
|
|
22
|
+
* 而 CSS 仍以该容器为 scrollport → 粘住顶距错位(弹窗内实测踩坑)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function domClosestStickyScrollport(el: HTMLElement | null | undefined): HTMLElement | undefined;
|
|
25
|
+
/** {@link domScrollIntoViewport} 选项 */
|
|
26
|
+
export interface DomScrollIntoViewportOptions {
|
|
27
|
+
/**
|
|
28
|
+
* 滚动行为。**默认 `"smooth"`(平滑)**,甲方 2026-09-16 定 ——
|
|
29
|
+
* 突然跳位会让人丢失「我在哪」,平滑滚动把位移变成可跟随的过程。
|
|
30
|
+
*
|
|
31
|
+
* 🔴 **系统开了「减少动态效果」时自动降级为 `"auto"`**
|
|
32
|
+
* (`prefers-reduced-motion: reduce`,无障碍惯例);显式传值恒优先。
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ 历史注记:本默认值曾是 `"auto"`,理由是 `TabsTile` 的 **自研** smooth 滚动被
|
|
35
|
+
* v-model 回流重渲染打断(watcher 里异步读 y 恒 0,真机复现)。那条教训的适用边界是
|
|
36
|
+
* **自研滚动 + 滚动期间宿主重渲染**,与本函数(原生 `scrollIntoView` 薄封装)不同。
|
|
37
|
+
* 若将来某个调用点确实在滚动期间重渲染目标,[MUST] 在**该调用点**显式传 `"auto"`,
|
|
38
|
+
* [MUST NOT] 因个别场景把全局默认改回去。
|
|
39
|
+
*/
|
|
40
|
+
behavior?: ScrollBehavior;
|
|
41
|
+
/** 纵向对齐,默认 `"nearest"`(见函数注释) */
|
|
42
|
+
block?: ScrollLogicalPosition;
|
|
43
|
+
/** 横向对齐,默认 `"nearest"` */
|
|
44
|
+
inline?: ScrollLogicalPosition;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 把目标元素滚进**最近的滚动视口**(薄封装 `Element.scrollIntoView`)。
|
|
48
|
+
*
|
|
49
|
+
* 🔴 **默认 `block/inline: "nearest"`**,这是本函数存在的理由:
|
|
50
|
+
* - 原生默认 `"start"` 会「**越级滚动**」—— 子元素调用却把整个 `body` 滚了
|
|
51
|
+
* (本仓 `AppHeader` 曾是裸 `scrollIntoView({behavior:"smooth"})`,即此写法);
|
|
52
|
+
* - `"nearest"` 同时意味着**已在视口内则零动作**,天生具备
|
|
53
|
+
* `scrollIntoViewIfNeeded`(非标准 API)的语义,无需引库。
|
|
54
|
+
*
|
|
55
|
+
* `target` 允许 `null | undefined`(调用方常从 ref / `querySelector` 取),静默返回。
|
|
56
|
+
* SSR / 无 DOM 环境同样静默。
|
|
57
|
+
*
|
|
58
|
+
* [MUST NOT] 为此引 `scroll-into-view-if-needed`(~3KB):它的价值在多层嵌套容器 +
|
|
59
|
+
* 自定义边距,当前用不到;本函数 API 形状与之对齐,真需要时可平替。
|
|
60
|
+
*/
|
|
61
|
+
export declare function domScrollIntoViewport(target: Element | null | undefined, options?: DomScrollIntoViewportOptions): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ElTableColumn } from 'element-plus';
|
|
2
|
+
import { ExtractPropTypes } from 'vue';
|
|
3
|
+
/** 操作列标记 prop。消费方以此值标记操作列,导出时自动过滤 */
|
|
4
|
+
export declare const OPERATE_COLUMN_PROP = "OPERATE";
|
|
5
|
+
/** 前端导出最大行数 */
|
|
6
|
+
export declare const EXPORT_MAX_LIMIT = 10000;
|
|
7
|
+
/** 通用导出列协议:保留表格列的 prop/label/type 形态,不依赖组件实现。 */
|
|
8
|
+
export type ExportColumn<T extends Record<string, any>,
|
|
9
|
+
/** 保留旧的第二泛型参数;导出只读取列字段,不消费插槽 scope。 */
|
|
10
|
+
_F extends Record<string, any> = {}> = Pick<ExtractPropTypes<typeof ElTableColumn>, "label"> & Partial<{
|
|
11
|
+
prop: Exclude<Extract<keyof T, string>, "custom-view-item" | "item"> | `${Uppercase<string>}`;
|
|
12
|
+
type: "default" | "selection" | "index" | "expand";
|
|
13
|
+
}>;
|
|
14
|
+
/** 导出列配置:支持 valueMap 自定义取值 */
|
|
15
|
+
export interface ExportColumnConfig<T extends Record<string, any>> {
|
|
16
|
+
prop: keyof T;
|
|
17
|
+
label: string;
|
|
18
|
+
/** 自定义取值,不传则取 row[prop] */
|
|
19
|
+
valueMap?: (row: Record<keyof T, any>) => unknown;
|
|
20
|
+
}
|
|
21
|
+
/** 导出参数 */
|
|
22
|
+
export interface ExportOptions<T extends Record<string, any>> {
|
|
23
|
+
columns: ExportColumnConfig<T>[];
|
|
24
|
+
list: T[];
|
|
25
|
+
filename?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 从表格列配置中提取可导出列
|
|
29
|
+
* ---
|
|
30
|
+
* 过滤规则:排除 type 为 selection / index / expand 的列(除 default 外均排除),
|
|
31
|
+
* 排除 prop 为 OPERATE_COLUMN_PROP 的列,排除无 prop 的列
|
|
32
|
+
*/
|
|
33
|
+
export declare const pickExportColumns: <T extends Record<string, any>, F extends Record<string, any>>(columns: (Partial<ExportColumn<T, F>> & Record<string, unknown>)[]) => ExportColumn<T, F>[];
|
|
34
|
+
/** 导出 CSV 文件 */
|
|
35
|
+
export declare const exportCSV: <T extends Record<string, any>>({ columns, list, filename, }: ExportOptions<T>) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CoreThemeDensity } from '../bridge';
|
|
2
|
+
/**
|
|
3
|
+
* 间距阶梯:**一个基数派生四档**(huhyx7)。
|
|
4
|
+
*
|
|
5
|
+
* 基数 = `bridge.APP_LAYOUT_GAP_CONFIG.size`(默认 8)。四档按**语义**取倍率,
|
|
6
|
+
* [MUST NOT] 处处取同值 —— 全等会让「页面级分隔」与「卡内分段」一样重、层级读不出来。
|
|
7
|
+
*
|
|
8
|
+
* ```
|
|
9
|
+
* 外圈 ×2 内容 ↔ chrome / viewport 边 / 悬浮插槽 ↔ 默认内容
|
|
10
|
+
* 呼吸 ×1.5 卡片内边距
|
|
11
|
+
* 模块 ×1 chrome 模块彼此、卡 ↔ 卡
|
|
12
|
+
* 分段 ×0.5 同一张卡内的段与段
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* 🔴 **倍率是实现细节不是配置项**:[MUST NOT] 为此新开 `innerGap` / `outerGap` 之类的
|
|
16
|
+
* bridge 字段 —— 那会退回多旋钮,而单旋钮正是本阶梯的全部价值。
|
|
17
|
+
*
|
|
18
|
+
* 基数取 8 的依据:4px 基准网格 ×2 —— Material 8dp grid / AntD 8 的倍数 /
|
|
19
|
+
* Tailwind `spacing-2` 同档,且**它已在用**,基线不动。
|
|
20
|
+
*/
|
|
21
|
+
export declare const GAP_SCALE_RUNG: {
|
|
22
|
+
/** 外圈:内容 ↔ chrome、内容 ↔ viewport 边、悬浮插槽 ↔ 默认内容 */
|
|
23
|
+
readonly outer: 2;
|
|
24
|
+
/** 卡片内边距(呼吸) */
|
|
25
|
+
readonly breath: 1.5;
|
|
26
|
+
/** 模块 / 卡之间 */
|
|
27
|
+
readonly module: 1;
|
|
28
|
+
/** 同一张卡内的分段 */
|
|
29
|
+
readonly section: 0.5;
|
|
30
|
+
};
|
|
31
|
+
/** 间距档位名 */
|
|
32
|
+
export type GapScaleRung = keyof typeof GAP_SCALE_RUNG;
|
|
33
|
+
/**
|
|
34
|
+
* 按密度档缩放间距基数(四舍五入到整 px —— 半像素会让相邻块出现 1px 缝隙差)。
|
|
35
|
+
*
|
|
36
|
+
* 默认 `cozy` ⇒ 原样返回。非法 / 缺省密度档退 `cozy`(不崩、不静默变形)。
|
|
37
|
+
*/
|
|
38
|
+
export declare const gapScaleBase: (size: number, density?: CoreThemeDensity) => number;
|
|
39
|
+
/**
|
|
40
|
+
* 取某一档的间距值(px 数值)。
|
|
41
|
+
*
|
|
42
|
+
* @param size 基数(`APP_LAYOUT_GAP_CONFIG.size`)
|
|
43
|
+
* @param rung 档位
|
|
44
|
+
* @param density 密度档(缺省 `cozy`)
|
|
45
|
+
*/
|
|
46
|
+
export declare const gapScaleValue: (size: number, rung: GapScaleRung, density?: CoreThemeDensity) => number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PermissionCheck, PermissionCheckTarget, PermissionKey, PermissionRequirement } from '../types';
|
|
2
|
+
/** 预设:任一持有即通过(默认) */
|
|
3
|
+
export declare const permissionCheckAny: PermissionCheck;
|
|
4
|
+
/** 预设:须全部持有 */
|
|
5
|
+
export declare const permissionCheckAll: PermissionCheck;
|
|
6
|
+
/**
|
|
7
|
+
* 判定入参归一为权限要求:码统一为数组、`check` 缺省 `permissionCheckAny`。
|
|
8
|
+
* 空数组 / `undefined` / `null` ⇒ `undefined`(= 没有权限要求)
|
|
9
|
+
*/
|
|
10
|
+
export declare const resolvePermissionRule: (target: PermissionCheckTarget) => PermissionRequirement | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* 按权限列表判定(纯函数,唯一判定口)
|
|
13
|
+
* - 没有权限要求 ⇒ 放行,`check` **不调用**(放行来自「无要求」,不来自 `[].every`)
|
|
14
|
+
* - `check` 抛错 ⇒ 判无权(fail-closed,业务函数不必自守)
|
|
15
|
+
*/
|
|
16
|
+
export declare const checkPermissionRule: (target: PermissionCheckTarget, permissionList: readonly PermissionKey[]) => boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Router } from 'vue-router';
|
|
2
|
+
import { GetRoutePermissionParams, PermissionRequirement } from '../types';
|
|
3
|
+
/** 获取路由权限key */
|
|
4
|
+
export declare const getRoutePermissionKey: ({ path, permission: permissionConfig, }: GetRoutePermissionParams) => import('../types').PermissionKey | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* 获取路由权限要求(归一形态 `{ key: K[], check }`):`key` 为单码或数组,空 / 不配且未开 `keyUsePath` ⇒ `undefined`(无要求)。
|
|
7
|
+
* 单码沿用 `getRoutePermissionKey` 的口径(假值视为未配、`keyUsePath` 回落路径)
|
|
8
|
+
*/
|
|
9
|
+
export declare const getRoutePermissionRequirement: (params: GetRoutePermissionParams) => PermissionRequirement | undefined;
|
|
10
|
+
/** 扁平化路由元信息解析raw */
|
|
11
|
+
export declare const flatRouteMetaResolveRaw: <T extends {
|
|
12
|
+
children: T[];
|
|
13
|
+
}>(list: T[], arr?: T[]) => T[];
|
|
14
|
+
/**
|
|
15
|
+
* 新标签页打开站内路由(菜单 `meta.menu.target: "_blank"`):按 router 解析出完整 href
|
|
16
|
+
* (含 base / hash 模式前缀),[MUST NOT] 直接拿 path 拼 —— hash 模式下会打开错地址。
|
|
17
|
+
*/
|
|
18
|
+
export declare const routerOpenInNewTab: (router: Router, path: string) => void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题色阶派生(模式感知,复刻 Element Plus 的 SCSS `mix` 算法)。
|
|
3
|
+
*
|
|
4
|
+
* core 挂值时对 6 个语义色(primary/success/warning/danger/info + error)
|
|
5
|
+
* 由基色派生 EP 7 档(base 自身 + light-3/5/7/8/9 + dark-2),亮/暗模式各用
|
|
6
|
+
* 不同的混入色,使派生结果与 EP 原生色阶一致。
|
|
7
|
+
*/
|
|
8
|
+
/** 主题明暗模式(决定色阶向哪一端混合) */
|
|
9
|
+
export type ThemeScaleMode = "light" | "dark";
|
|
10
|
+
/** 一个语义色的 EP 7 档色阶(key 与 `--el-color-*-light-#` / `-dark-2` 对齐) */
|
|
11
|
+
export interface ThemeColorScale {
|
|
12
|
+
/** 基色自身 */
|
|
13
|
+
base: string;
|
|
14
|
+
"light-3": string;
|
|
15
|
+
"light-5": string;
|
|
16
|
+
"light-7": string;
|
|
17
|
+
"light-8": string;
|
|
18
|
+
"light-9": string;
|
|
19
|
+
"dark-2": string;
|
|
20
|
+
}
|
|
21
|
+
/** `#rgb` / `#rrggbb` → [r,g,b];非法格式返回 null */
|
|
22
|
+
export declare const themeScaleParseHex: (hex: string) => [number, number, number] | null;
|
|
23
|
+
/**
|
|
24
|
+
* 混色:`c1` 占 `w1`、`c2` 占 `1-w1`,各通道线性混合后四舍五入
|
|
25
|
+
* (复刻 EP/SCSS `mix(c1, c2, w1)` 语义,w1 为 c1 的权重 [0,1])。
|
|
26
|
+
* 任一入参非 hex(如 `var(...)` / `rgba(...)`)→ 返回 `c2` 兜底,不崩。
|
|
27
|
+
*/
|
|
28
|
+
export declare const themeScaleMix: (c1: string, c2: string, w1: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* `#rgb` / `#rrggbb` + alpha → `rgba(r, g, b, a)`。
|
|
31
|
+
*
|
|
32
|
+
* 供吃不了 CSS `var()` 的 JS / canvas 消费方(如 ElWatermark `font.color`)按主题
|
|
33
|
+
* 真实色值 + 透明度生成可绘制色串。`alpha` 自动裁剪到 [0,1]。
|
|
34
|
+
* 非 hex 入参(`var(...)` / `rgba(...)`)→ 原样返回(不崩、不强转)。
|
|
35
|
+
*/
|
|
36
|
+
export declare const themeScaleToRgba: (hex: string, alpha: number) => string;
|
|
37
|
+
/**
|
|
38
|
+
* 布局底(page 档)派生:bodyColor(面)向黑压一步,混黑权重
|
|
39
|
+
* `k = min(0.5, 18/maxCh)`——最亮通道恒降 ≈18(暗色 `#141414` 命中 REL 上限 0.5
|
|
40
|
+
* 恰为 EP 暗 page `#0a0a0a`;亮色 `#fff` 得 `#ededed`,比 EP/AntD 的 `#f5f5f5` 深一档,
|
|
41
|
+
* 见 {@link PAGE_STEP_CH} 的取值理由)。
|
|
42
|
+
* 公式与明暗无关(对当前模式的 bodyColor 直接适用)。
|
|
43
|
+
* 非 hex(var/rgba/渐变)→ 原样返回(调用方按原值直用,行为不变)。
|
|
44
|
+
*
|
|
45
|
+
* ⚠️ **两个已知退化点**(实际色差 `Δ = min(0.5×maxCh, 18)`):
|
|
46
|
+
* - `maxCh` 太小(近黑)→ Δ 塌向 0(`#000` 得 Δ=0、底 = 面)⇒ 由 {@link themeScaleIsNearBlack}
|
|
47
|
+
* 判出后翻转基准兜底(见 use-theme-apply `buildElevationDecls`);
|
|
48
|
+
* - 非 hex → 原样返回、底 = 面。
|
|
49
|
+
*
|
|
50
|
+
* 两者的**正解都是显式给 `AppThemeColor.ground`**,翻转只是没给时的兜底。
|
|
51
|
+
*/
|
|
52
|
+
export declare const themeScalePageColor: (bodyColor: string) => string;
|
|
53
|
+
/**
|
|
54
|
+
* 抬升面(overlay 档)派生:暗色 = bodyColor(面)向白提一步,混白权重
|
|
55
|
+
* `k = min(0.5, 10/(255-maxCh))`——最亮通道恒升 ≈10(`#141414→#1e1e1e`,
|
|
56
|
+
* ≈ EP 暗 overlay `#1d1e1f`);亮色 = bodyColor 原值(EP 亮 overlay 即 `#fff`=面,
|
|
57
|
+
* 亮色层级靠投影/蒙层表达,不再提亮)。非 hex → 原样返回。
|
|
58
|
+
*/
|
|
59
|
+
export declare const themeScaleSurfaceColor: (bodyColor: string, mode: ThemeScaleMode) => string;
|
|
60
|
+
/**
|
|
61
|
+
* 按 EP 算法 + 模式感知派生一个语义色的 7 档色阶。
|
|
62
|
+
*
|
|
63
|
+
* - light:`light-i = mix(#fff, base, i*10%)`,`dark-2 = mix(#000, base, 20%)`
|
|
64
|
+
* - dark: `light-i = mix(#141414, base, i*10%)`,`dark-2 = mix(#fff, base, 20%)`
|
|
65
|
+
*
|
|
66
|
+
* `base` 非 hex 时各档兜底返回 `base` 原值(保持可挂载、不崩)。
|
|
67
|
+
*/
|
|
68
|
+
export declare const themeScaleDerive: (base: string, mode: ThemeScaleMode) => ThemeColorScale;
|
|
69
|
+
/**
|
|
70
|
+
* 近黑判定:`bodyColor` 是否已暗到「压不动」,需要翻转基准(底取原值、面向白提)。
|
|
71
|
+
*
|
|
72
|
+
* 🔴 **判据用「余量」不用「亮 / 暗」**:后者要外部告知 `isDark`(本 util 拿不到、
|
|
73
|
+
* 强行传参会把一个纯函数变成要看模式的函数),且会在「深灰但不算暗色」的主题上判错
|
|
74
|
+
* ——余量是从色值本身就能算出来的,不依赖任何外部状态。
|
|
75
|
+
*
|
|
76
|
+
* 非 hex → `false`(判不了就不翻;那种情况的正解是显式给 `ground`)。
|
|
77
|
+
*/
|
|
78
|
+
export declare const themeScaleIsNearBlack: (bodyColor: string) => boolean;
|