@done-coding/admin-core 0.17.1-alpha.0 → 0.18.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +7 -6
- package/es/bridge/config-hook.mjs +49 -37
- package/es/bridge/index.mjs +152 -109
- package/es/bridge/layout.mjs +45 -31
- package/es/bridge/plugin.mjs +22 -12
- package/es/bridge/route.mjs +59 -50
- package/es/bridge/state.mjs +54 -39
- package/es/bridge/storage.mjs +18 -8
- package/es/bridge/theme/index.mjs +200 -97
- package/es/bridge/theme/persist.mjs +11 -7
- package/es/bridge/theme/system-dark.mjs +13 -6
- package/es/components/app-layout/AppAside.vue.mjs +4 -4
- package/es/components/app-layout/AppAside.vue2.mjs +37 -30
- package/es/components/app-layout/AppBody.vue.mjs +4 -4
- package/es/components/app-layout/AppBody.vue2.mjs +97 -60
- package/es/components/app-layout/AppBreadcrumb.vue.mjs +4 -4
- package/es/components/app-layout/AppBreadcrumb.vue2.mjs +59 -38
- package/es/components/app-layout/AppCollapseToggle.vue.mjs +4 -4
- package/es/components/app-layout/AppCollapseToggle.vue2.mjs +51 -42
- package/es/components/app-layout/AppFooter.vue.mjs +4 -4
- package/es/components/app-layout/AppFooter.vue2.mjs +15 -12
- package/es/components/app-layout/AppHeader.vue.mjs +4 -4
- package/es/components/app-layout/AppHeader.vue2.mjs +81 -58
- package/es/components/app-layout/AppLayout.vue.mjs +4 -4
- package/es/components/app-layout/AppLayout.vue2.mjs +148 -112
- package/es/components/app-layout/AppPage.vue.mjs +4 -4
- package/es/components/app-layout/AppPage.vue2.mjs +254 -197
- package/es/components/app-layout/AppShell.vue.mjs +44 -42
- package/es/components/app-layout/AppShell.vue2.mjs +2 -2
- package/es/components/app-layout/AppSidebar.vue.mjs +4 -4
- package/es/components/app-layout/AppSidebar.vue2.mjs +76 -59
- package/es/components/app-layout/AppTheme.vue.mjs +4 -4
- package/es/components/app-layout/AppTheme.vue2.mjs +69 -57
- package/es/components/app-layout/app-page-geometry.mjs +44 -42
- package/es/components/app-layout/keep-alive.mjs +27 -19
- package/es/components/app-layout/viewport.mjs +4 -3
- package/es/components/data-view/DataListView.vue.mjs +4 -4
- package/es/components/data-view/DataListView.vue2.mjs +133 -93
- package/es/components/data-view/DataListViewItem.vue.mjs +4 -4
- package/es/components/data-view/DataListViewItem.vue2.mjs +11 -9
- package/es/components/data-view/utils.mjs +36 -34
- package/es/components/display/ActionBtn.vue.mjs +94 -71
- package/es/components/display/ActionBtn.vue2.mjs +2 -2
- package/es/components/display/ActionBtnGroup.vue.mjs +54 -48
- package/es/components/display/ActionBtnGroup.vue2.mjs +2 -2
- package/es/components/display/ActionConfirm.vue.mjs +4 -4
- package/es/components/display/ActionConfirm.vue2.mjs +116 -92
- package/es/components/display/BooleanTag.vue.mjs +24 -18
- package/es/components/display/BooleanTag.vue2.mjs +2 -2
- package/es/components/display/HeightProvider.vue.mjs +37 -27
- package/es/components/display/HeightProvider.vue2.mjs +2 -2
- package/es/components/display/TabsHeader.vue.mjs +4 -4
- package/es/components/display/TabsHeader.vue2.mjs +86 -57
- package/es/components/display/TabsMain.vue.mjs +156 -125
- package/es/components/display/TabsMain.vue2.mjs +2 -2
- package/es/components/display/TabsNaturalFlow.vue.mjs +15 -11
- package/es/components/display/TabsNaturalFlow.vue2.mjs +2 -2
- package/es/components/display/TabsRefineFlow.vue.mjs +55 -42
- package/es/components/display/TabsRefineFlow.vue2.mjs +2 -2
- package/es/components/display/TabsTile.vue.mjs +4 -4
- package/es/components/display/TabsTile.vue2.mjs +204 -146
- package/es/components/display/WatchSize.vue.mjs +50 -30
- package/es/components/display/WatchSize.vue2.mjs +2 -2
- package/es/components/display/use-tabs-query-sync.mjs +21 -17
- package/es/components/form/FormItem.vue.mjs +4 -4
- package/es/components/form/FormItem.vue2.mjs +183 -121
- package/es/components/form/FormItemNestForm.vue.mjs +4 -4
- package/es/components/form/FormItemNestForm.vue2.mjs +38 -34
- package/es/components/form/FormItemNestFormList.vue.mjs +4 -4
- package/es/components/form/FormItemNestFormList.vue2.mjs +135 -106
- package/es/components/form/FormMain.vue.mjs +4 -4
- package/es/components/form/FormMain.vue2.mjs +226 -139
- package/es/components/form/FormRadioGroup.vue.mjs +67 -52
- package/es/components/form/FormRadioGroup.vue2.mjs +2 -2
- package/es/components/form/FormSearch.vue.mjs +4 -4
- package/es/components/form/FormSearch.vue2.mjs +194 -156
- package/es/components/form/FormSelect.vue.mjs +69 -42
- package/es/components/form/FormSelect.vue2.mjs +2 -2
- package/es/components/form/FormSubmitBtn.vue.mjs +30 -25
- package/es/components/form/FormSubmitBtn.vue2.mjs +2 -2
- package/es/components/form/FormSubmitPanel.vue.mjs +4 -4
- package/es/components/form/FormSubmitPanel.vue2.mjs +129 -96
- package/es/components/form/FormTree.vue.mjs +19 -16
- package/es/components/form/FormTree.vue2.mjs +2 -2
- package/es/components/form/FormVerifyCode.vue.mjs +58 -41
- package/es/components/form/FormVerifyCode.vue2.mjs +2 -2
- package/es/components/form/FormVerifyImage.vue.mjs +4 -4
- package/es/components/form/FormVerifyImage.vue2.mjs +62 -40
- package/es/components/form/form-search-utils.mjs +83 -52
- package/es/components/form/nest-form-item-list.mjs +63 -55
- package/es/components/form/nest-form-item.mjs +30 -30
- package/es/components/form/nest-registry.mjs +4 -4
- package/es/components/form/use-form-submit.mjs +18 -15
- package/es/components/form/use-layout-by-container.mjs +23 -15
- package/es/components/form/use-nest-form-list.mjs +19 -16
- package/es/components/form/use-nest-form.mjs +37 -28
- package/es/components/form/use-nest-layout-scale.mjs +11 -10
- package/es/components/form/utils.mjs +233 -145
- package/es/components/list-page/ListPage.vue.mjs +4 -4
- package/es/components/list-page/ListPage.vue2.mjs +313 -207
- package/es/components/list-page/use-sticky.mjs +45 -33
- package/es/components/menu/MenuItemSub.vue.mjs +47 -43
- package/es/components/menu/MenuItemSub.vue2.mjs +2 -2
- package/es/components/menu/MenuTree.vue.mjs +84 -61
- package/es/components/menu/MenuTree.vue2.mjs +2 -2
- package/es/components/misc/AutoRefresh.vue.mjs +4 -4
- package/es/components/misc/AutoRefresh.vue2.mjs +78 -53
- package/es/components/misc/AutoRefreshGroup.vue.mjs +4 -4
- package/es/components/misc/AutoRefreshGroup.vue2.mjs +54 -51
- package/es/components/misc/SelectModule.vue.mjs +54 -45
- package/es/components/misc/SelectModule.vue2.mjs +2 -2
- package/es/components/misc/TriggerAutoImport.vue.mjs +7 -5
- package/es/components/misc/TriggerAutoImport.vue2.mjs +2 -2
- package/es/components/modal/ModalConfirm.vue.mjs +4 -4
- package/es/components/modal/ModalConfirm.vue2.mjs +160 -125
- package/es/components/modal/ModalDetail.vue.mjs +50 -39
- package/es/components/modal/ModalDetail.vue2.mjs +2 -2
- package/es/components/modal/ModalForm.vue.mjs +63 -52
- package/es/components/modal/ModalForm.vue2.mjs +2 -2
- package/es/components/modal/ModalPorter.vue.mjs +51 -36
- package/es/components/modal/ModalPorter.vue2.mjs +2 -2
- package/es/components/modal/ModalShelf.vue.mjs +38 -28
- package/es/components/modal/ModalShelf.vue2.mjs +2 -2
- package/es/components/modal/modal-shelf-core.mjs +52 -36
- package/es/components/modal/modal-shelf-hierarchy.mjs +11 -9
- package/es/components/panel/PanelEditSwitch.vue.mjs +4 -4
- package/es/components/panel/PanelEditSwitch.vue2.mjs +88 -66
- package/es/components/panel/PanelItem.vue.mjs +4 -4
- package/es/components/panel/PanelItem.vue2.mjs +103 -77
- package/es/components/panel/PanelItemNestForm.vue.mjs +4 -4
- package/es/components/panel/PanelItemNestForm.vue2.mjs +61 -52
- package/es/components/panel/PanelItemNestPanel.vue.mjs +22 -20
- package/es/components/panel/PanelItemNestPanel.vue2.mjs +2 -2
- package/es/components/panel/PanelMain.vue.mjs +4 -4
- package/es/components/panel/PanelMain.vue2.mjs +92 -74
- package/es/components/panel/nest-panel-form.mjs +44 -38
- package/es/components/panel/nest-panel-item.mjs +18 -17
- package/es/components/slot-layout/SlotLayoutFlowAside.vue.mjs +4 -4
- package/es/components/slot-layout/SlotLayoutFlowAside.vue2.mjs +55 -42
- package/es/components/slot-layout/SlotLayoutTemplate.vue.mjs +11 -9
- package/es/components/slot-layout/SlotLayoutTemplate.vue2.mjs +2 -2
- package/es/components/table/TableMain.vue.mjs +4 -4
- package/es/components/table/TableMain.vue2.mjs +378 -275
- package/es/components/table/TableSkeleton.vue.mjs +4 -4
- package/es/components/table/TableSkeleton.vue2.mjs +95 -74
- package/es/components/table/TableToolbar.vue.mjs +4 -4
- package/es/components/table/TableToolbar.vue2.mjs +170 -154
- package/es/components/table/ToolbarButtons.vue.mjs +12 -10
- package/es/components/table/ToolbarButtons.vue2.mjs +2 -2
- package/es/components/table/constants.mjs +4 -3
- package/es/components/table/use-fill-height.mjs +12 -10
- package/es/components/table/use-table-skeleton.mjs +19 -15
- package/es/config/list-model.mjs +2 -2
- package/es/config/route.mjs +4 -3
- package/es/helpers/form.mjs +35 -25
- package/es/helpers/list-helper.mjs +59 -44
- package/es/hooks/activated.mjs +49 -33
- package/es/hooks/feel-size.mjs +39 -23
- package/es/hooks/menus-dispatch.mjs +68 -35
- package/es/hooks/timeout.mjs +29 -14
- package/es/hooks/use-breakpoint.mjs +35 -23
- package/es/hooks/use-channel-viewport-height.mjs +30 -20
- package/es/hooks/use-custom-breakpoint.mjs +48 -31
- package/es/hooks/use-observe-size.mjs +37 -20
- package/es/hooks/use-theme-apply.mjs +175 -124
- package/es/hooks/use-viewport-apply.mjs +39 -27
- package/es/index.mjs +239 -239
- package/es/inject/key.mjs +52 -41
- package/es/injectInfo.json.mjs +2 -2
- package/es/router/group-redirect.mjs +22 -16
- package/es/router/guard/index.mjs +26 -21
- package/es/router/guard/login.mjs +4 -2
- package/es/router/guard/permission.mjs +4 -2
- package/es/store/app.mjs +163 -123
- package/es/store/router-permission.mjs +75 -46
- package/es/store/user.mjs +100 -71
- package/es/style.css +769 -1
- package/es/utils/dom.mjs +20 -16
- package/es/utils/export.mjs +34 -18
- package/es/utils/id.mjs +5 -3
- package/es/utils/router.mjs +21 -14
- package/es/utils/theme-scale.mjs +50 -35
- package/es/utils/time.mjs +20 -14
- package/package.json +4 -3
- package/src/bridge/README.md +5 -0
- package/src/bridge/docs/README.md +72 -0
- package/src/components/README.md +84 -0
- package/src/components/app-layout/README.md +46 -0
- package/src/components/app-layout/docs/README-AppAside.md +69 -0
- package/src/components/app-layout/docs/README-AppBody.md +81 -0
- package/src/components/app-layout/docs/README-AppBreadcrumb.md +71 -0
- package/src/components/app-layout/docs/README-AppFooter.md +41 -0
- package/src/components/app-layout/docs/README-AppHeader.md +73 -0
- package/src/components/app-layout/docs/README-AppLayout.md +83 -0
- package/src/components/app-layout/docs/README-AppPage.md +80 -0
- package/src/components/app-layout/docs/README-AppSidebar.md +70 -0
- package/src/components/app-layout/docs/README-AppTheme.md +66 -0
- package/src/components/data-view/README.md +19 -0
- package/src/components/data-view/docs/README-DataListView.md +114 -0
- package/src/components/display/README.md +23 -0
- package/src/components/display/docs/README-ActionBtn.md +84 -0
- package/src/components/display/docs/README-ActionBtnGroup.md +96 -0
- package/src/components/display/docs/README-ActionConfirm.md +77 -0
- package/src/components/display/docs/README-BooleanTag.md +76 -0
- package/src/components/display/docs/README-HeightProvider.md +74 -0
- package/src/components/display/docs/README-TabsMain.md +99 -0
- package/src/components/display/docs/README-WatchSize.md +70 -0
- package/src/components/form/README.md +24 -0
- package/src/components/form/docs/README-FormItemNestForm.md +86 -0
- package/src/components/form/docs/README-FormItemNestFormList.md +93 -0
- package/src/components/form/docs/README-FormMain.md +101 -0
- package/src/components/form/docs/README-FormSearch.md +89 -0
- package/src/components/form/docs/README-FormSubmitBtn.md +72 -0
- package/src/components/form/docs/README-FormSubmitPanel.md +97 -0
- package/src/components/list-page/README.md +16 -0
- package/src/components/list-page/docs/README-ListPage.md +136 -0
- package/src/components/menu/README.md +19 -0
- package/src/components/menu/docs/README-MenuItemSub.md +53 -0
- package/src/components/menu/docs/README-MenuTree.md +76 -0
- package/src/components/misc/README.md +21 -0
- package/src/components/misc/docs/README-AutoRefresh.md +74 -0
- package/src/components/misc/docs/README-AutoRefreshGroup.md +74 -0
- package/src/components/misc/docs/README-SelectModule.md +72 -0
- package/src/components/modal/README.md +21 -0
- package/src/components/modal/docs/README-ModalConfirm.md +105 -0
- package/src/components/modal/docs/README-ModalDetail.md +103 -0
- package/src/components/modal/docs/README-ModalForm.md +97 -0
- package/src/components/modal/docs/README-ModalPorter.md +92 -0
- package/src/components/modal/docs/README-ModalShelf.md +115 -0
- package/src/components/panel/README.md +19 -0
- package/src/components/panel/docs/README-PanelMain.md +149 -0
- package/src/components/slot-layout/README.md +17 -0
- package/src/components/slot-layout/docs/README-SlotLayoutFlowAside.md +83 -0
- package/src/components/slot-layout/docs/README-SlotLayoutTemplate.md +73 -0
- package/src/components/table/README.md +17 -0
- package/src/components/table/docs/README-TableMain.md +140 -0
- package/src/hooks/README.md +5 -0
- package/src/hooks/docs/README.md +49 -0
- package/types/bridge/config-hook.d.ts +68 -0
- package/types/bridge/index.d.ts +411 -0
- package/types/bridge/layout.d.ts +40 -0
- package/types/bridge/plugin.d.ts +18 -0
- package/types/bridge/route.d.ts +20 -1
- package/types/bridge/state.d.ts +14 -0
- package/types/bridge/storage.d.ts +9 -0
- package/types/bridge/theme/index.d.ts +7 -0
- package/types/bridge/theme/persist.d.ts +12 -0
- package/types/bridge/theme/system-dark.d.ts +12 -0
- package/types/bridge/theme/types.d.ts +238 -0
- package/types/components/app-layout/AppAside.vue.d.ts +1 -0
- package/types/components/app-layout/AppCollapseToggle.vue.d.ts +3 -0
- package/types/components/app-layout/AppHeader.vue.d.ts +3 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +12 -0
- package/types/components/app-layout/AppPage.vue.d.ts +17 -0
- package/types/components/app-layout/AppSidebar.vue.d.ts +2 -0
- package/types/components/app-layout/app-page-geometry.d.ts +48 -0
- package/types/components/app-layout/keep-alive.d.ts +17 -0
- package/types/components/app-layout/types.d.ts +125 -0
- package/types/components/app-layout/viewport.d.ts +28 -0
- package/types/components/data-view/DataListViewItem.vue.d.ts +8 -0
- package/types/components/data-view/index.d.ts +4 -0
- package/types/components/data-view/types.d.ts +42 -0
- package/types/components/data-view/utils.d.ts +3 -0
- package/types/components/display/TabsHeader.vue.d.ts +2 -0
- package/types/components/display/TabsMain.vue.d.ts +2 -0
- package/types/components/display/TabsRefineFlow.vue.d.ts +1 -0
- package/types/components/display/TabsTile.vue.d.ts +247 -12
- package/types/components/display/WatchSize.vue.d.ts +9 -0
- package/types/components/display/index.d.ts +37 -1
- package/types/components/display/types.d.ts +163 -0
- package/types/components/display/use-tabs-query-sync.d.ts +29 -0
- package/types/components/form/FormItemNestForm.vue.d.ts +5 -0
- package/types/components/form/FormItemNestFormList.vue.d.ts +17 -0
- package/types/components/form/FormVerifyCode.vue.d.ts +9 -0
- package/types/components/form/FormVerifyImage.vue.d.ts +1 -0
- package/types/components/form/form-search-utils.d.ts +34 -0
- package/types/components/form/nest-form-item-list.d.ts +28 -0
- package/types/components/form/nest-form-item.d.ts +21 -0
- package/types/components/form/nest-registry.d.ts +14 -0
- package/types/components/form/types.d.ts +208 -8
- package/types/components/form/use-form-submit.d.ts +13 -0
- package/types/components/form/use-layout-by-container.d.ts +23 -0
- package/types/components/form/use-nest-form-list.d.ts +13 -0
- package/types/components/form/use-nest-form.d.ts +15 -0
- package/types/components/form/use-nest-layout-scale.d.ts +12 -0
- package/types/components/form/utils.d.ts +56 -1
- package/types/components/list-page/ListPage.vue.d.ts +6 -0
- package/types/components/list-page/types.d.ts +50 -2
- package/types/components/list-page/use-sticky.d.ts +23 -0
- package/types/components/misc/index.d.ts +6 -1
- package/types/components/misc/types.d.ts +7 -0
- package/types/components/modal/ModalConfirm.vue.d.ts +29 -0
- package/types/components/modal/index.d.ts +7 -1
- package/types/components/modal/modal-shelf-core.d.ts +3 -0
- package/types/components/modal/modal-shelf-hierarchy.d.ts +4 -0
- package/types/components/modal/modal-shelf-types.d.ts +34 -0
- package/types/components/modal/types.d.ts +63 -2
- package/types/components/panel/PanelItemNestForm.vue.d.ts +6 -0
- package/types/components/panel/PanelItemNestPanel.vue.d.ts +5 -0
- package/types/components/panel/nest-panel-form.d.ts +21 -0
- package/types/components/panel/nest-panel-item.d.ts +14 -0
- package/types/components/panel/types.d.ts +52 -1
- package/types/components/slot-layout/SlotLayoutTemplate.vue.d.ts +21 -0
- package/types/components/slot-layout/types.d.ts +4 -0
- package/types/components/table/constants.d.ts +8 -0
- package/types/components/table/types.d.ts +140 -9
- package/types/components/table/use-fill-height.d.ts +14 -0
- package/types/components/table/use-table-skeleton.d.ts +16 -0
- package/types/config/list-model.d.ts +29 -0
- package/types/config/route.d.ts +2 -0
- package/types/helpers/form.d.ts +5 -0
- package/types/helpers/list-helper.d.ts +26 -0
- package/types/helpers/types.d.ts +11 -0
- package/types/hooks/activated.d.ts +23 -0
- package/types/hooks/feel-size.d.ts +2 -0
- package/types/hooks/menus-dispatch.d.ts +4 -0
- package/types/hooks/timeout.d.ts +4 -0
- package/types/hooks/use-channel-viewport-height.d.ts +8 -0
- package/types/hooks/use-custom-breakpoint.d.ts +19 -0
- package/types/hooks/use-observe-size.d.ts +29 -0
- package/types/hooks/use-theme-apply.d.ts +23 -0
- package/types/hooks/use-viewport-apply.d.ts +12 -0
- package/types/inject/key.d.ts +163 -0
- package/types/injectInfo.json.d.ts +1 -1
- package/types/router/group-redirect.d.ts +9 -0
- package/types/router/guard/index.d.ts +13 -0
- package/types/router/guard/login.d.ts +1 -0
- package/types/router/guard/permission.d.ts +1 -0
- package/types/router/guard/types.d.ts +3 -0
- package/types/store/app.d.ts +27 -0
- package/types/store/router-permission.d.ts +53 -0
- package/types/store/user.d.ts +24 -0
- package/types/types/dot-path.d.ts +8 -0
- package/types/types/route.d.ts +45 -0
- package/types/types/utility-types.d.ts +7 -0
- package/types/utils/dom.d.ts +22 -0
- package/types/utils/export.d.ts +16 -1
- package/types/utils/id.d.ts +1 -0
- package/types/utils/router.d.ts +2 -0
- package/types/utils/theme-scale.d.ts +31 -0
- package/types/utils/time.d.ts +1 -0
package/types/bridge/layout.d.ts
CHANGED
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
import { Ref, DeepReadonly } from 'vue';
|
|
2
2
|
import { StorageLike } from './index';
|
|
3
|
+
/**
|
|
4
|
+
* bridge 布局折叠 hook(按耦合度从 index.ts 拆出,规则 12)。
|
|
5
|
+
*
|
|
6
|
+
* 折叠态真相源在 bridge——对称主题架构反转(store 退役本地 ref、仅转发):
|
|
7
|
+
* sidebar / aside 的折叠开关态由本 hook 持有,对外 `bridge.layout.{setSidebarCollapse,
|
|
8
|
+
* toggleSidebar,setAsideCollapse,toggleAside}` 切换 + `sidebarCollapsed / asideCollapsed`
|
|
9
|
+
* 响应式只读真相源。appStore 转发(`changeSidebarCollapseStatus` → `setSidebarCollapse`、
|
|
10
|
+
* `sidebarIsCollapse` → 读 `sidebarCollapsed`),AppSidebar / AppAside 经 store 转发驱动。
|
|
11
|
+
*
|
|
12
|
+
* 真相落 bridge 的收益:① 折叠态可持久化(复用注入 storage,同 theme 持久化范式);
|
|
13
|
+
* ② 可被 agent / 主题经 bridge 公开面驱动(aside = AI 副驾,副驾自行收起 / 展开)。
|
|
14
|
+
* 每次 `createCoreBridge` 各自闭包内构造(零模块级单例,守实例隔离,规则 8)。
|
|
15
|
+
*/
|
|
16
|
+
/** core 折叠态持久化的命名空间 key(命名空间前缀已由 storage 加);缺省值。 */
|
|
3
17
|
export declare const DEFAULT_LAYOUT_STORAGE_KEY = "dc-core-layout";
|
|
18
|
+
/** 折叠态持久化载荷。 */
|
|
4
19
|
export interface LayoutCollapsePersistShape {
|
|
20
|
+
/** sidebar 是否折叠 */
|
|
5
21
|
sidebarCollapsed: boolean;
|
|
22
|
+
/** aside 是否折叠 */
|
|
6
23
|
asideCollapsed: boolean;
|
|
7
24
|
}
|
|
25
|
+
/** bridge 布局折叠 hook 工厂入参。 */
|
|
8
26
|
export interface BridgeLayoutInit {
|
|
27
|
+
/** 注入的命名空间 storage(折叠态持久化读写) */
|
|
9
28
|
storage: StorageLike;
|
|
29
|
+
/** 持久化 key,缺省 {@link DEFAULT_LAYOUT_STORAGE_KEY} */
|
|
10
30
|
storageKey?: string;
|
|
31
|
+
/** sidebar 折叠初值(业务侧无缓存默认);缺省 false */
|
|
11
32
|
defaultSidebarCollapsed?: boolean;
|
|
33
|
+
/** aside 折叠初值(业务侧无缓存默认);缺省 false */
|
|
12
34
|
defaultAsideCollapsed?: boolean;
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* 布局折叠模块(bridge 公开面 `bridge.layout`)。
|
|
38
|
+
*
|
|
39
|
+
* 状态(响应式只读真相源)+ 切换方法聚于一个内聚命名空间——agent / 主题 / store
|
|
40
|
+
* 经此读 / 驱折叠(aside = AI 副驾自收起)。[MUST NOT] 解构/快照折叠态(⚠️ 切换后定格)。
|
|
41
|
+
*/
|
|
14
42
|
export interface CoreLayoutModule {
|
|
43
|
+
/** sidebar 是否折叠(响应式只读真相源) */
|
|
15
44
|
readonly sidebarCollapsed: DeepReadonly<Ref<boolean>>;
|
|
45
|
+
/** aside 是否折叠(响应式只读真相源) */
|
|
16
46
|
readonly asideCollapsed: DeepReadonly<Ref<boolean>>;
|
|
47
|
+
/** 设 sidebar 折叠态(持久化随写) */
|
|
17
48
|
setSidebarCollapse: (collapsed: boolean) => void;
|
|
49
|
+
/** 反转 sidebar 折叠态 */
|
|
18
50
|
toggleSidebar: () => void;
|
|
51
|
+
/** 设 aside 折叠态(持久化随写) */
|
|
19
52
|
setAsideCollapse: (collapsed: boolean) => void;
|
|
53
|
+
/** 反转 aside 折叠态 */
|
|
20
54
|
toggleAside: () => void;
|
|
21
55
|
}
|
|
56
|
+
/** bridge 布局折叠 hook 工厂返回(聚合到 `bridge.layout`)。 */
|
|
22
57
|
export interface BridgeLayoutHook {
|
|
23
58
|
layout: CoreLayoutModule;
|
|
24
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* bridge 布局折叠 hook 工厂。
|
|
62
|
+
*
|
|
63
|
+
* init:读持久化恢复 sidebar / aside 折叠态(无持久化值 → 回落初值)。
|
|
64
|
+
*/
|
|
25
65
|
export declare function createBridgeLayoutHook(init: BridgeLayoutInit): BridgeLayoutHook;
|
package/types/bridge/plugin.d.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import { CoreBridge } from './index';
|
|
2
2
|
import { UpdatableConfigKey, UpdatableConfigMap } from './config-hook';
|
|
3
|
+
/**
|
|
4
|
+
* 插件可访问的 bridge 视图。
|
|
5
|
+
*
|
|
6
|
+
* 屏蔽运行时编排入口、auth facade 与业务 API;需要业务动作时由插件 options 承接。
|
|
7
|
+
*/
|
|
3
8
|
export type CoreBridgePluginBridgeSlice<UserInfo = unknown, LoginParams = unknown> = Omit<CoreBridge<UserInfo, LoginParams>, "init" | "register" | "getToken" | "goToLogin" | "refreshToken" | "refreshAuth" | "loginApi" | "logoutApi" | "getUserInfoApi" | "refreshTokenApi" | "use" | "install">;
|
|
9
|
+
/**
|
|
10
|
+
* bridge 插件安装上下文。
|
|
11
|
+
*
|
|
12
|
+
* 插件只通过公开 bridge 实例与受控 action 工作,不访问 bridge 内部闭包状态。
|
|
13
|
+
*/
|
|
4
14
|
export interface CoreBridgePluginContext<UserInfo = unknown, LoginParams = unknown> {
|
|
15
|
+
/** 当前安装插件的 bridge 可用能力 */
|
|
5
16
|
bridge: CoreBridgePluginBridgeSlice<UserInfo, LoginParams>;
|
|
17
|
+
/** 配置更新 action 的便捷引用 */
|
|
6
18
|
update: <K extends UpdatableConfigKey>(key: K, partial: Partial<UpdatableConfigMap[K]>) => void;
|
|
7
19
|
}
|
|
20
|
+
/** bridge 插件安装函数。 */
|
|
8
21
|
export type CoreBridgePluginInstall<UserInfo = unknown, LoginParams = unknown, Options = unknown> = (ctx: CoreBridgePluginContext<UserInfo, LoginParams>, options?: Options) => void;
|
|
22
|
+
/** bridge 对象插件。 */
|
|
9
23
|
export interface CoreBridgePlugin<UserInfo = unknown, LoginParams = unknown, Options = unknown> {
|
|
24
|
+
/** 插件名;存在时用于跨对象实例的幂等安装 */
|
|
10
25
|
name?: string;
|
|
26
|
+
/** 插件安装函数 */
|
|
11
27
|
install: CoreBridgePluginInstall<UserInfo, LoginParams, Options>;
|
|
12
28
|
}
|
|
29
|
+
/** bridge 支持函数插件与对象插件两种形态。 */
|
|
13
30
|
export type CoreBridgePluginLike<UserInfo = unknown, LoginParams = unknown, Options = unknown> = CoreBridgePlugin<UserInfo, LoginParams, Options> | CoreBridgePluginInstall<UserInfo, LoginParams, Options>;
|
|
31
|
+
/** 创建单个 bridge 实例专属的插件安装宿主。 */
|
|
14
32
|
export declare function createBridgePluginHost<UserInfo = unknown, LoginParams = unknown>(): {
|
|
15
33
|
use: <Options = unknown>(payload: {
|
|
16
34
|
bridge: CoreBridge<UserInfo, LoginParams>;
|
package/types/bridge/route.d.ts
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import { RouteRecordRaw } from 'vue-router';
|
|
2
2
|
import { RouteMetaResolveRaw } from '../types';
|
|
3
|
+
/** 路由元信息默认配置(工厂参数最小 shape) */
|
|
3
4
|
export interface RouteMetaDefaultConfig {
|
|
5
|
+
/** 各路由[未配置情况下]默认是否展示在菜单 */
|
|
4
6
|
menuShow: boolean;
|
|
7
|
+
/** 各路由[未配置情况下]默认是否需要登录 */
|
|
5
8
|
needLogin: boolean;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* 创建路由元信息解析 raw 树生成器
|
|
12
|
+
* ---
|
|
13
|
+
* 工厂模式:app 层传入 metaDefault 配置(含 menuShow / needLogin 默认值)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const generateRouteMetaRawTree = createGenerateRouteMetaRawTree(APP_ROUTER_META_DEFAULT_CONFIG);
|
|
17
|
+
* const tree = generateRouteMetaRawTree(routes, { ... });
|
|
18
|
+
*/
|
|
7
19
|
export declare const createGenerateRouteMetaRawTree: (metaDefault: RouteMetaDefaultConfig) => <T extends {
|
|
8
20
|
children: T[];
|
|
9
21
|
} = RouteMetaResolveRaw>(routesList: RouteRecordRaw[], { parentPath, parentPathList, routeLevel, sortFn, mapFn, filterFn, }?: Partial<Pick<RouteMetaResolveRaw, "parentPath" | "parentPathList" | "routeLevel"> & {
|
|
22
|
+
/** 排序函数 */
|
|
10
23
|
sortFn?: (a: T, b: T) => number;
|
|
24
|
+
/** 映射函数 */
|
|
11
25
|
mapFn: (route: Omit<RouteMetaResolveRaw, "children"> & {
|
|
12
26
|
children: T[];
|
|
13
27
|
}) => T;
|
|
28
|
+
/** 过滤函数 */
|
|
14
29
|
filterFn: (raw: Omit<RouteMetaResolveRaw, "children"> & {
|
|
15
30
|
children: T[];
|
|
16
|
-
},
|
|
31
|
+
},
|
|
32
|
+
/** 是否有符合过滤条件的子路由 */
|
|
33
|
+
haveChildren: boolean,
|
|
34
|
+
/** [原始配置]是否有子路由 */
|
|
35
|
+
haveChildrenRaw: boolean) => boolean;
|
|
17
36
|
}>) => T[];
|
package/types/bridge/state.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
export interface UseStateOptions {
|
|
2
|
+
/** 是否调试 */
|
|
2
3
|
debug: boolean;
|
|
4
|
+
/** 模块命名空间 */
|
|
3
5
|
moduleKey: string;
|
|
6
|
+
/** 缓存 */
|
|
4
7
|
cache?: boolean;
|
|
8
|
+
/** 缓存实现 */
|
|
5
9
|
storage?: Storage;
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* 创建 useState 工厂
|
|
13
|
+
* ---
|
|
14
|
+
* 工厂模式:app 层传入命名空间,core 不感知具体值
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const useState = createUseState("myapp");
|
|
18
|
+
* const moduleState = useState({ count: 0 }, { debug: true, moduleKey: "counter" });
|
|
19
|
+
* // cacheKey 形如 "myapp/useState/counter"
|
|
20
|
+
*/
|
|
7
21
|
export declare const createUseState: (factoryNamespace: string) => <S extends Record<string, any> = Record<string, any>>(initState: S | (() => S), { debug, moduleKey, cache, storage }?: UseStateOptions) => {
|
|
8
22
|
state: any;
|
|
9
23
|
getStateInit: () => S;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建带命名空间的 localStorage 实例
|
|
3
|
+
* ---
|
|
4
|
+
* 工厂模式:app 层传入命名空间,core 不感知具体值
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const myStorage = createStorageWithNamespace("myapp");
|
|
8
|
+
* myStorage.setItem("token", "xxx"); // 实际写入 localStorage 的 key 为 "myapp/token"
|
|
9
|
+
*/
|
|
1
10
|
export declare const createStorageWithNamespace: (namespace: string) => Storage;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { BridgeThemeHook, BridgeThemeInit } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* bridge 主题 hook 工厂。
|
|
4
|
+
*
|
|
5
|
+
* 每次 `createCoreBridge` 调用各自闭包内构造一份(零模块级单例,守实例隔离)。
|
|
6
|
+
* init:自动 `add('default', initConfig)`;读持久化恢复 `themeMode` 即时生效、
|
|
7
|
+
* `themeStyle` 走「desiredStyle 命中再 apply」时序(插件后注册风格亦能恢复)。
|
|
8
|
+
*/
|
|
2
9
|
export declare function createBridgeThemeHook(init: BridgeThemeInit): BridgeThemeHook;
|
|
3
10
|
export type { CoreThemePresetLayout, CoreConfigDescription, CoreThemeLifecycleContext, CoreThemeLifecycleHooks, CoreThemeEntry, CoreThemeMode, CoreThemeModule, CoreThemeDensity, CoreThemeMotion, ElSize, CoreThemeComponentDefaults, BridgeThemeLayoutState, BridgeThemeHook, BridgeThemeLayoutBaseline, BridgeThemeInit, } from './types';
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { StorageLike } from '../index';
|
|
2
2
|
import { CoreThemeMode } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* bridge 主题模块**持久化**子模块(升级目录拆出)。
|
|
5
|
+
*
|
|
6
|
+
* 负责 localStorage 形态的读取 / 兼容迁移:v2 存 `{themeStyle,themeMode}`,读时兼容
|
|
7
|
+
* 旧 v1 `themeIsDark` 布尔。写入(`persist()`)在工厂内闭包,复用本文件的 shape 类型。
|
|
8
|
+
*/
|
|
9
|
+
/** core 主题持久化的命名空间 key(命名空间前缀已由 storage 加);缺省值。 */
|
|
3
10
|
export declare const DEFAULT_STORAGE_KEY = "dc-core-theme";
|
|
11
|
+
/** 持久化载荷(v2:明暗存 mode 三态,取代旧 themeIsDark 布尔)。 */
|
|
4
12
|
export interface ThemePersistShape {
|
|
13
|
+
/** 当前风格名 */
|
|
5
14
|
themeStyle: string;
|
|
15
|
+
/** 明暗模式三态(亮/暗/跟随系统) */
|
|
6
16
|
themeMode: CoreThemeMode;
|
|
7
17
|
}
|
|
18
|
+
/** 读持久化的兼容形态:除 v2 字段外,兼容旧 v1 `themeIsDark` 布尔(迁移用)。 */
|
|
8
19
|
export type ThemePersistRead = Partial<ThemePersistShape & {
|
|
9
20
|
themeIsDark: boolean;
|
|
10
21
|
}>;
|
|
22
|
+
/** 读持久化(JSON.parse 容错;非法/缺失返 null)。返回兼容形态(含旧 themeIsDark)。 */
|
|
11
23
|
export declare const readPersist: (storage: StorageLike, key: string) => ThemePersistRead | null;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bridge 主题模块**系统明暗探测**子模块(升级目录拆出)。
|
|
3
|
+
*
|
|
4
|
+
* `prefers-color-scheme: dark` 的一次性读取 + 变更监听;无 matchMedia(SSR / 老环境)
|
|
5
|
+
* 安全降级。`system` 明暗态下 `themeIsDark` 经此派生。
|
|
6
|
+
*/
|
|
7
|
+
/** 读系统是否偏暗(`prefers-color-scheme: dark`);无 matchMedia(SSR / 老环境)→ false。 */
|
|
1
8
|
export declare const readSystemPrefersDark: () => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 监听系统明暗变化,变更时回调最新值;返回清理函数。
|
|
11
|
+
* bridge 为 app 单例无 teardown,当前不主动清理(listener 随 app 常驻,可接受);
|
|
12
|
+
* 返回清理函数留作未来 dispose / 测试用。无 matchMedia → noop。
|
|
13
|
+
*/
|
|
2
14
|
export declare const watchSystemPrefersDark: (cb: (isDark: boolean) => void) => (() => void);
|
|
@@ -1,98 +1,336 @@
|
|
|
1
1
|
import { Component, DeepReadonly, Ref } from 'vue';
|
|
2
2
|
import { AppThemeConfig, AppLayoutHeaderConfig, AppLayoutFooterConfig, AppLayoutSidebarConfig, AppLayoutAsideConfig, AppLayoutBreadcrumbConfig, AppLayoutBodyConfig, AppLayoutViewportConfig, AppLayoutGapConfig, StorageLike } from '../index';
|
|
3
3
|
import { UpdatableConfigKey, UpdatableConfigMap } from '../config-hook';
|
|
4
|
+
/**
|
|
5
|
+
* bridge 主题模块**类型面**(从 `bridge/theme.ts` 升级目录拆出,CLAUDE.md 规则 12)。
|
|
6
|
+
*
|
|
7
|
+
* 纯类型 / 接口定义,无运行时逻辑——工厂在 `./index.ts`、持久化在 `./persist.ts`、
|
|
8
|
+
* 系统明暗探测在 `./system-dark.ts`。本文件显式 `import type { Component, DeepReadonly,
|
|
9
|
+
* Ref } from "vue"`(规则 9.0:lib build 下 vite-plugin-dts 不靠 auto-import)。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 主题 preset 的 layout 维度(焊缝契约 ④,P1 冻结,跨域共享)。
|
|
13
|
+
*
|
|
14
|
+
* layout 归属为 theme preset 的一个维度(一个 preset = 一个人格 = 色 + 局一体),
|
|
15
|
+
* 单入口 `setStyle` 切换。本结构纯数据可 JSON(除 `shell` 为运行时组件引用)。
|
|
16
|
+
*
|
|
17
|
+
* **灌值语义 = 基线复位 + 叠加**:bridge init 时快照六组布局 config 为基线;每次
|
|
18
|
+
* `setStyle` 先把六组 config 复位到基线、再叠加当前 preset 的 layout partial
|
|
19
|
+
* (`bridge.update` 单字段一级浅合并)。无跨 preset 残留、幂等。不带 layout 的老
|
|
20
|
+
* preset → 仅复位到 init 基线,零改动可用。
|
|
21
|
+
*/
|
|
4
22
|
export interface CoreThemePresetLayout {
|
|
23
|
+
/** header 配置 partial(如 `{height}`),叠加到基线 `APP_LAYOUT_HEADER_CONFIG` */
|
|
5
24
|
header?: Partial<AppLayoutHeaderConfig>;
|
|
25
|
+
/** footer 配置 partial(如 `{height}`) */
|
|
6
26
|
footer?: Partial<AppLayoutFooterConfig>;
|
|
27
|
+
/** sidebar 配置 partial(如 `{width, collapseWidth}`) */
|
|
7
28
|
sidebar?: Partial<AppLayoutSidebarConfig>;
|
|
29
|
+
/** aside 右侧补充区配置 partial(如 `{width}`;P1' additive,带布局变更 preset 可配) */
|
|
8
30
|
aside?: Partial<AppLayoutAsideConfig>;
|
|
31
|
+
/** breadcrumb 配置 partial(如 `{height}`) */
|
|
9
32
|
breadcrumb?: Partial<AppLayoutBreadcrumbConfig>;
|
|
33
|
+
/** body 配置 partial(如 `{shimPadding}`) */
|
|
10
34
|
body?: Partial<AppLayoutBodyConfig>;
|
|
35
|
+
/** viewport 边框配置 partial(四边 padding;套框 / 拆框) */
|
|
11
36
|
viewport?: Partial<AppLayoutViewportConfig>;
|
|
37
|
+
/** 模块间距配置 partial(内缝 gap;分离式人格设 `{ size }` 让模块间露底色条带) */
|
|
12
38
|
gap?: Partial<AppLayoutGapConfig>;
|
|
39
|
+
/**
|
|
40
|
+
* 编排组件(布局形态)。缺省 → AppLayout 回退内置默认 AppShell(经典布局)。
|
|
41
|
+
* 运行时引用(不持久化);setStyle 切走 / 老 preset 无 shell → 回退内置。
|
|
42
|
+
* [MUST] markRaw(theme hook add 时自动 markRaw 兜底,防 reactive proxy 化)。
|
|
43
|
+
*/
|
|
13
44
|
shell?: Component;
|
|
45
|
+
/**
|
|
46
|
+
* 数据分流意图(AppLayout 读取执行):提取 1 级路由模块到 header。
|
|
47
|
+
* 缺省 / undefined → 复位到 init 默认(false)。
|
|
48
|
+
*/
|
|
14
49
|
extractLevel1ToHeader?: boolean;
|
|
15
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* 配置化通用描述(**跨配置块对齐标准**:theme preset / form / table / panel 等配置项复用)。
|
|
53
|
+
*
|
|
54
|
+
* 一个描述对象,含正反两面——供人 + web agent 选型:
|
|
55
|
+
* - `suitable`(正向):什么场景**宜选**。
|
|
56
|
+
* - `unsuitable`(反向):什么场景**不宜选**——对 agent,知道何时不该选与该选同等重要。
|
|
57
|
+
*
|
|
58
|
+
* 定位:高配置化体系 ≈ 运行期 schema(类 zod),本描述是 agent 选型 + 排除入口;结构化
|
|
59
|
+
* traits(如 `layout.extractLevel1ToHeader`)机器可读、本符补散文语义。两面均可选。
|
|
60
|
+
* 注:展示名 `label` 是 entry 各自的独立字段,不并入本描述对象。
|
|
61
|
+
*/
|
|
16
62
|
export interface CoreConfigDescription {
|
|
63
|
+
/** 正向:什么应用 / 场景宜选(如「沉浸式工作台、需上下文面板的应用」)。 */
|
|
17
64
|
suitable?: string;
|
|
65
|
+
/** 反向:什么场景不宜选(agent 排除用,如「表单密集型后台、窄屏移动端」)。 */
|
|
18
66
|
unsuitable?: string;
|
|
19
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* 主题生命周期钩子上下文(core 注入,仅一个纯值 `id`)。
|
|
70
|
+
*
|
|
71
|
+
* 只携带 `id`(本钩子针对哪套主题)——供「被多个 preset 复用的同一钩子函数」区分自己
|
|
72
|
+
* 正服务于哪套主题(如打 `<style data-dc-theme="<id>">` 标签)。
|
|
73
|
+
*
|
|
74
|
+
* [MUST NOT] 挂 `document` / DOM 引用(钩子要操作 DOM 直接用全局 `document`,代传 element
|
|
75
|
+
* 易致内存泄漏)。**亦不传 `isDark`**:主题的 `<style>` [SHOULD] 一次注入含 `:root{}`(亮)
|
|
76
|
+
* + `:root.dark{}`(暗) 双态、明暗由 `<html>.dark` 类名切换自适配(同 core `useCoreThemeApply`
|
|
77
|
+
* 范式)——无需按明暗"细化按需加载",`setMode` 也因此不触发钩子(传 isDark 反诱导单态注入 →
|
|
78
|
+
* 切明暗即坏,与"setMode 不触发"自相矛盾)。
|
|
79
|
+
*/
|
|
20
80
|
export interface CoreThemeLifecycleContext {
|
|
81
|
+
/** 本钩子针对的主题 id(风格 name)。 */
|
|
21
82
|
id: string;
|
|
22
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* 主题生命周期钩子(挂 {@link CoreThemeEntry};plugin `CoreThemePreset` 超集透传)。
|
|
86
|
+
*
|
|
87
|
+
* core 在 `setStyle` 切换时 **try-catch** 调用,让每套主题自管 DOM 副作用——典型:
|
|
88
|
+
* 激活时往 `document.head` 注入本主题专属 `<style data-dc-theme="<id>">`、切走前移除,
|
|
89
|
+
* 既支持复杂样式(@keyframes / 伪元素 / media)又守资产隔离(只当前主题 style 在 head)。
|
|
90
|
+
*
|
|
91
|
+
* 触发规则:仅 `setStyle`(风格切换)触发,`setMode`(明暗切换)**不触发**——主题注入的
|
|
92
|
+
* style [SHOULD] 含 `:root.dark` 双态由 `.dark` 自适配。钩子抛错仅 warn 吞掉,[MUST NOT]
|
|
93
|
+
* 阻断切换、[MUST NOT] 殃及他主题(守资产隔离)。
|
|
94
|
+
*/
|
|
23
95
|
export interface CoreThemeLifecycleHooks {
|
|
96
|
+
/**
|
|
97
|
+
* 主题**激活后**调用(config / layout 已应用、`themeStyle` 已置新值)。
|
|
98
|
+
* 典型:往全局 `document.head` 注入本主题专属 `<style data-dc-theme="<id>">`。
|
|
99
|
+
*/
|
|
24
100
|
onActivate?: (ctx: CoreThemeLifecycleContext) => void;
|
|
101
|
+
/**
|
|
102
|
+
* 主题**切走前**调用(即将切到别的风格 / 移除当前主题时回退 default 之前)。
|
|
103
|
+
* 典型:移除 onActivate 注入的 `<style data-dc-theme="<id>">`,归还干净 head。
|
|
104
|
+
*
|
|
105
|
+
* 钩子 [SHOULD] **幂等**:移除前先检测目标 `<style>` 是否仍在(`querySelector` 命中再
|
|
106
|
+
* removeChild),多次 / 重复清理才稳。core 侧已只在「切走 / 移除**当前**主题」时触发一次
|
|
107
|
+
* (非当前主题移除不重复触发),但作者自身幂等是更稳的兜底。
|
|
108
|
+
*/
|
|
25
109
|
onDeactivate?: (ctx: CoreThemeLifecycleContext) => void;
|
|
26
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* 主题注册项(`bridge.theme.add` 第 2 参)——core 侧主题「preset」结构。
|
|
113
|
+
*
|
|
114
|
+
* core 不依赖 plugin,故自定义此最小注册形;plugin-theme 的 `CoreThemePreset`
|
|
115
|
+
* (含 id/label/description/config)是其结构超集,可整坨直接透传:
|
|
116
|
+
* `bridge.theme.add(preset.id, preset)`(多出的 id 作 excess 字段被忽略,label/description 纳入)。
|
|
117
|
+
*
|
|
118
|
+
* 继承 {@link CoreThemeLifecycleHooks}:可选 `onActivate` / `onDeactivate` 生命周期钩子。
|
|
119
|
+
*/
|
|
27
120
|
export interface CoreThemeEntry extends CoreThemeLifecycleHooks {
|
|
121
|
+
/**
|
|
122
|
+
* 风格色值(light/dark 两套 `AppThemeColor`)。
|
|
123
|
+
*
|
|
124
|
+
* 内部做浅快照(`{light:{...},dark:{...}}`)——与调用方对象解耦,且与 bridge
|
|
125
|
+
* 响应式 APP_THEME_CONFIG 的 proxy target 解耦(避免切走后反写注册值)。
|
|
126
|
+
*/
|
|
28
127
|
config: AppThemeConfig;
|
|
128
|
+
/** 展示名(供 `AppTheme.vue` 下拉显示,如中文「柔光悬浮」);缺省回退注册 name 自身。 */
|
|
29
129
|
label?: string;
|
|
130
|
+
/**
|
|
131
|
+
* 描述(自然语言,供人 / web agent 理解选型):分「适合 / 不适合」两面。
|
|
132
|
+
*
|
|
133
|
+
* 定位:高配置化体系 ≈ 运行期 schema(类 zod),`description` 是 agent「选型 + 排除」
|
|
134
|
+
* 的语义入口;结构化 traits(`layout.extractLevel1ToHeader` 等)机器可读、本字段补散文语义。
|
|
135
|
+
* 缺省 undefined。见 {@link CoreConfigDescription}。
|
|
136
|
+
*/
|
|
30
137
|
description?: CoreConfigDescription;
|
|
138
|
+
/**
|
|
139
|
+
* 布局维度(焊缝契约 ④);缺省 → 切到该 preset 仅复位布局基线(不套框、内置 shell、经典分流)。
|
|
140
|
+
* 见 {@link CoreThemePresetLayout}。
|
|
141
|
+
*/
|
|
31
142
|
layout?: CoreThemePresetLayout;
|
|
143
|
+
/**
|
|
144
|
+
* 密度档(节奏维度);缺省 → 切到该 preset 复位为 `'cozy'`。
|
|
145
|
+
* 见 {@link CoreThemeDensity}。setStyle 时复位 + 应用(同 layout「基线复位 + 叠加」语义)。
|
|
146
|
+
*/
|
|
32
147
|
density?: CoreThemeDensity;
|
|
148
|
+
/**
|
|
149
|
+
* 动效档(节奏维度);缺省 → 切到该 preset 复位为 `'standard'`。
|
|
150
|
+
* 见 {@link CoreThemeMotion}。
|
|
151
|
+
*/
|
|
33
152
|
motion?: CoreThemeMotion;
|
|
153
|
+
/**
|
|
154
|
+
* 逐族 EP size 覆盖(**期二消费**,本期仅冻结数据形为焊缝);缺省不覆盖、走 density 档默认。
|
|
155
|
+
* 仅声明式 size/border/stripe,[MUST NOT] 收行为(design §9 表现 vs 行为边界)。
|
|
156
|
+
* 见 {@link CoreThemeComponentDefaults}。
|
|
157
|
+
*/
|
|
34
158
|
componentDefaults?: CoreThemeComponentDefaults;
|
|
35
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* element-plus 组件尺寸档(透传给一等公民 size prop)。
|
|
162
|
+
*/
|
|
36
163
|
export type ElSize = "large" | "default" | "small";
|
|
164
|
+
/**
|
|
165
|
+
* 密度档(persona 节奏维度):紧凑 / 适中 / 舒展。
|
|
166
|
+
* 整体平移全局留白 + 控件高 + 字号(取值见 design §2.1)。明暗无关。
|
|
167
|
+
*/
|
|
37
168
|
export type CoreThemeDensity = "compact" | "cozy" | "comfortable";
|
|
169
|
+
/**
|
|
170
|
+
* 动效档(persona 节奏维度):急促 / 标准 / 舒缓。
|
|
171
|
+
* 整体换挡全局过渡时长 + 缓动(取值见 design §2.2)。reduced-motion 无条件压过。
|
|
172
|
+
*/
|
|
38
173
|
export type CoreThemeMotion = "snappy" | "standard" | "calm";
|
|
174
|
+
/**
|
|
175
|
+
* 逐族 EP size 覆盖(componentDefaults,**期二真例外补丁**;本期仅冻结类型为焊缝)。
|
|
176
|
+
*
|
|
177
|
+
* 仅声明式 size 枚举 + table 的 border/stripe,[MUST NOT] 收任何行为 / handler /
|
|
178
|
+
* validator / 数据流(design §9 表现 vs 行为边界判据:persona 永不拥有行为)。
|
|
179
|
+
*/
|
|
39
180
|
export interface CoreThemeComponentDefaults {
|
|
181
|
+
/** 表格族默认(size / 是否边框 / 是否斑马纹) */
|
|
40
182
|
table?: {
|
|
41
183
|
size?: ElSize;
|
|
42
184
|
border?: boolean;
|
|
43
185
|
stripe?: boolean;
|
|
44
186
|
};
|
|
187
|
+
/** 表单族默认(size;labelPosition 任务驱动、[MUST NOT] 入此) */
|
|
45
188
|
form?: {
|
|
46
189
|
size?: ElSize;
|
|
47
190
|
};
|
|
191
|
+
/** 弹窗族默认(size 档→ width 由组件内映射) */
|
|
48
192
|
modal?: {
|
|
49
193
|
size?: ElSize;
|
|
50
194
|
};
|
|
195
|
+
/** 操作按钮族默认(size) */
|
|
51
196
|
actionBtn?: {
|
|
52
197
|
size?: ElSize;
|
|
53
198
|
};
|
|
54
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* 主题明暗模式三态:亮 / 暗 / 跟随系统。
|
|
202
|
+
* - `light` / `dark`:固定明暗。
|
|
203
|
+
* - `system`:跟随 `prefers-color-scheme`(系统切换实时响应)。
|
|
204
|
+
* 派生 `themeIsDark` = `mode==='system' ? 系统偏暗 : mode==='dark'`。
|
|
205
|
+
*/
|
|
55
206
|
export type CoreThemeMode = "light" | "dark" | "system";
|
|
207
|
+
/** 主题模块对外能力。 */
|
|
56
208
|
export interface CoreThemeModule {
|
|
209
|
+
/**
|
|
210
|
+
* 注册/覆盖一个风格(插件 install 经 `bridge.theme.add` 调;同名覆盖)。
|
|
211
|
+
*
|
|
212
|
+
* 第 2 参收 {@link CoreThemeEntry}(`{config,label?}`);config 内部浅快照解耦。
|
|
213
|
+
* 若新注册 name 命中持久化恢复的目标风格(init 时尚未注册),自动 `setStyle(name)`。
|
|
214
|
+
*/
|
|
57
215
|
add: (name: string, preset: CoreThemeEntry) => void;
|
|
216
|
+
/** 注销一个风格(`'default'` 不可注销;注销当前风格则回退 `'default'`)。 */
|
|
58
217
|
remove: (name: string) => void;
|
|
218
|
+
/** 切换风格(未注册回退 `'default'`):同步 APP_THEME_CONFIG + 持久化。 */
|
|
59
219
|
setStyle: (name: string) => void;
|
|
220
|
+
/**
|
|
221
|
+
* 切换明暗模式三态(亮/暗/跟随系统)+ 持久化。`system` 态下 `themeIsDark` 跟随系统偏好。
|
|
222
|
+
*/
|
|
60
223
|
setMode: (mode: CoreThemeMode) => void;
|
|
224
|
+
/**
|
|
225
|
+
* 切换暗色(向后兼容二态 API):`true`→`setMode('dark')`、`false`→`setMode('light')`。
|
|
226
|
+
* 新代码 [SHOULD] 用 {@link CoreThemeModule.setMode}(支持 `system` 第三态)。
|
|
227
|
+
*/
|
|
61
228
|
setDark: (isDark: boolean) => void;
|
|
229
|
+
/**
|
|
230
|
+
* 直接设密度档(独立于风格切换;供 UI 偏好 / demo 切换器)。
|
|
231
|
+
* 注:`setStyle` 会按目标 preset 的 density 复位,故风格切换后手设的密度会被覆盖(同 layout 语义)。
|
|
232
|
+
*/
|
|
62
233
|
setDensity: (density: CoreThemeDensity) => void;
|
|
234
|
+
/** 直接设动效档(独立于风格切换;语义同 {@link setDensity})。 */
|
|
63
235
|
setMotion: (motion: CoreThemeMotion) => void;
|
|
236
|
+
/** 响应式风格名列表(只读,供 `AppTheme.vue` 下拉;`length>1` 才显示选择)。 */
|
|
64
237
|
list: DeepReadonly<Ref<string[]>>;
|
|
238
|
+
/** 取风格展示名(`add` 注册的 label;缺省回退 name 自身)。 */
|
|
65
239
|
labelOf: (name: string) => string;
|
|
240
|
+
/** 取风格描述(`add` 注册的 description,含 suitable/unsuitable 两面;未设回退 undefined)。 */
|
|
66
241
|
descriptionOf: (name: string) => CoreConfigDescription | undefined;
|
|
67
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* 当前生效 preset 的 layout 运行时维度(AppLayout 直读,响应式)。
|
|
245
|
+
*
|
|
246
|
+
* 尺寸 / 套框等纯数据维度经 setStyle 灌进 bridge 响应式 config(基线复位 + 叠加),
|
|
247
|
+
* 故不在本结构重复——本结构仅暴露**非 config 的运行时维度**:编排组件 + 分流意图。
|
|
248
|
+
*/
|
|
68
249
|
export interface BridgeThemeLayoutState {
|
|
250
|
+
/**
|
|
251
|
+
* 当前 preset 的编排组件(缺省 undefined → AppLayout 回退内置默认 AppShell)。
|
|
252
|
+
* markRaw 后存储(防 proxy 化)。
|
|
253
|
+
*/
|
|
69
254
|
shell?: Component;
|
|
255
|
+
/** 当前 preset 的分流意图(提取 1 级路由到 header);缺省复位 false。 */
|
|
70
256
|
extractLevel1ToHeader: boolean;
|
|
71
257
|
}
|
|
258
|
+
/** 主题 hook 对外契约:模块 + 顶层响应式只读真相源。 */
|
|
72
259
|
export interface BridgeThemeHook {
|
|
260
|
+
/** 主题模块(add/remove/setStyle/setDark/list) */
|
|
73
261
|
theme: CoreThemeModule;
|
|
262
|
+
/** 当前风格名(响应式只读;切换真相源,appStore / AppTheme.vue 读此) */
|
|
74
263
|
themeStyle: DeepReadonly<Ref<string>>;
|
|
264
|
+
/**
|
|
265
|
+
* 明暗模式三态真相源(响应式只读;亮/暗/跟随系统)。`themeIsDark` 由本 mode + 系统偏好派生。
|
|
266
|
+
*/
|
|
75
267
|
themeMode: DeepReadonly<Ref<CoreThemeMode>>;
|
|
268
|
+
/** 是否暗色(响应式只读 **派生**;= mode==='system'?系统偏暗:mode==='dark'。挂值 composable toggle .dark 读此) */
|
|
76
269
|
themeIsDark: DeepReadonly<Ref<boolean>>;
|
|
270
|
+
/**
|
|
271
|
+
* 当前 preset 的 layout 运行时维度(响应式只读;AppLayout 直读 shell + 分流意图)。
|
|
272
|
+
* 尺寸 / 套框纯数据维度经 setStyle 灌 bridge config,不在此重复。
|
|
273
|
+
*/
|
|
77
274
|
themeLayout: DeepReadonly<Ref<BridgeThemeLayoutState>>;
|
|
275
|
+
/**
|
|
276
|
+
* 当前密度档(响应式只读真相源);`useCoreThemeApply` watch 此重写节奏 `<style>`。
|
|
277
|
+
* setStyle 按 preset.density 复位(缺省 `'cozy'`),或 `setDensity` 直接改。
|
|
278
|
+
*/
|
|
78
279
|
themeDensity: DeepReadonly<Ref<CoreThemeDensity>>;
|
|
280
|
+
/** 当前动效档(响应式只读真相源);语义同 {@link themeDensity}(缺省 `'standard'`)。 */
|
|
79
281
|
themeMotion: DeepReadonly<Ref<CoreThemeMotion>>;
|
|
80
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* 六组布局 config 的 init 基线快照(`setStyle` 复位 + 叠加用)。
|
|
285
|
+
*
|
|
286
|
+
* = bridge init 传入的六组布局 config 浅快照(不含 theme)。setStyle 切到任一 preset
|
|
287
|
+
* 前先把六组 config 复位到本基线、再叠加 preset.layout partial(幂等、无残留)。
|
|
288
|
+
*/
|
|
81
289
|
export interface BridgeThemeLayoutBaseline {
|
|
290
|
+
/** header 配置基线 */
|
|
82
291
|
header: AppLayoutHeaderConfig;
|
|
292
|
+
/** footer 配置基线 */
|
|
83
293
|
footer: AppLayoutFooterConfig;
|
|
294
|
+
/** sidebar 配置基线 */
|
|
84
295
|
sidebar: AppLayoutSidebarConfig;
|
|
296
|
+
/** aside 右侧补充区配置基线(P1' additive) */
|
|
85
297
|
aside: AppLayoutAsideConfig;
|
|
298
|
+
/** breadcrumb 配置基线 */
|
|
86
299
|
breadcrumb: AppLayoutBreadcrumbConfig;
|
|
300
|
+
/** body 配置基线 */
|
|
87
301
|
body: AppLayoutBodyConfig;
|
|
302
|
+
/** viewport 边框配置基线(已合并核内默认四边 0) */
|
|
88
303
|
viewport: AppLayoutViewportConfig;
|
|
304
|
+
/** 模块间距配置基线(内缝 gap;已合并核内默认 size 0) */
|
|
89
305
|
gap: AppLayoutGapConfig;
|
|
90
306
|
}
|
|
307
|
+
/** `createBridgeThemeHook` 入参。 */
|
|
91
308
|
export interface BridgeThemeInit {
|
|
309
|
+
/** init 默认风格 config(= bridge init 传入的 APP_THEME_CONFIG);core 自动 add 为 `'default'` */
|
|
92
310
|
initConfig: AppThemeConfig;
|
|
311
|
+
/**
|
|
312
|
+
* 注入的 config 更新器(= configHook.update 全量 key)。
|
|
313
|
+
*
|
|
314
|
+
* setStyle 经此把当前风格 config 灌进 APP_THEME_CONFIG(整体替换 light/dark),
|
|
315
|
+
* 并把六组布局 config 基线复位 + 叠加 preset.layout partial。复用既有 update
|
|
316
|
+
* 通道,[MUST NOT] 另持一份主题 / 布局响应式。
|
|
317
|
+
*/
|
|
93
318
|
update: <K extends UpdatableConfigKey>(key: K, partial: Partial<UpdatableConfigMap[K]>) => void;
|
|
319
|
+
/**
|
|
320
|
+
* 六组布局 config init 基线(setStyle 复位 + 叠加用)。
|
|
321
|
+
* 缺省(向后兼容 / 测试)→ 不做布局复位,setStyle 仅切色 + 应用 preset.layout partial。
|
|
322
|
+
*/
|
|
94
323
|
layoutBaseline?: BridgeThemeLayoutBaseline;
|
|
324
|
+
/** 注入的命名空间 storage(= bridge.getStorage());持久化 `{themeStyle,themeIsDark}` */
|
|
95
325
|
storage: StorageLike;
|
|
326
|
+
/** 持久化 key(命名空间已由 storage 加前缀);缺省 `"dc-core-theme"` */
|
|
96
327
|
storageKey?: string;
|
|
328
|
+
/**
|
|
329
|
+
* 明暗模式默认值(**仅无缓存时生效**);缺省 `"light"`。
|
|
330
|
+
*
|
|
331
|
+
* 读持久化命中 `themeMode` → 缓存优先覆盖本值(缓存语义不变);无缓存才回落到此。
|
|
332
|
+
* 业务侧经 `createCoreBridge({ defaultThemeMode })` 注入,如设 `"dark"` =
|
|
333
|
+
* 「首次进入(无缓存)默认暗色」、`"system"` =「默认跟随系统」。
|
|
334
|
+
*/
|
|
97
335
|
defaultMode?: CoreThemeMode;
|
|
98
336
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
+
/** 悬挂哪侧:sidebar=悬父右外缘、aside=悬父左外缘 */
|
|
2
3
|
side: "sidebar" | "aside";
|
|
4
|
+
/** 当前是否折叠(驱动箭头朝向 + tooltip 文案) */
|
|
3
5
|
collapse: boolean;
|
|
6
|
+
/** 显隐(父传,= showSidebar / showAside);false 不渲染 */
|
|
4
7
|
show: boolean;
|
|
5
8
|
};
|
|
6
9
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { RouteMetaResolveRaw } from '../../types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
+
/** 整体不用管 AppLayout控制 用在定位出去的子元素的显隐 */
|
|
3
4
|
show: boolean;
|
|
4
5
|
menus: RouteMetaResolveRaw[];
|
|
6
|
+
/** 聚焦的路由菜单 */
|
|
5
7
|
activeMenu?: RouteMetaResolveRaw;
|
|
8
|
+
/** 聚焦的模块菜单 */
|
|
6
9
|
activeModuleMenu?: RouteMetaResolveRaw;
|
|
7
10
|
menuFlatList: RouteMetaResolveRaw[];
|
|
8
11
|
};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { AppShellContentAnchor, AppLayoutAppStoreSlice, AppLayoutUserStoreSlice, AppLayoutBridgeSlice } from './types';
|
|
2
2
|
import { WatermarkProps } from 'element-plus';
|
|
3
3
|
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* bridge 实例(#7.6 期新增必填)。
|
|
6
|
+
* AppLayout 经 `props.bridge` 注入后 provide 给子 layout 组件
|
|
7
|
+
* (AppBody / AppSidebar 自取 12 readonly 配置 + getRoutes / generateRouteMetaRawTree)。
|
|
8
|
+
* 业务侧 App.vue 模板:`<AppLayout :bridge="appBridge" ...>`。
|
|
9
|
+
*/
|
|
4
10
|
bridge: AppLayoutBridgeSlice;
|
|
5
11
|
appStore: AppLayoutAppStoreSlice;
|
|
6
12
|
userStore: AppLayoutUserStoreSlice;
|
|
13
|
+
/** 水印内容(空数组/空串/undefined 不展示 = 关闭水印);layout 不耦合 UserInfo shape,由业务侧派生 */
|
|
7
14
|
watermarkContent?: WatermarkProps["content"];
|
|
15
|
+
/**
|
|
16
|
+
* sidebar 层级是否高于 header(#7.5 期新增,默认 false)。
|
|
17
|
+
* true 时 AppSidebar z-index 调高于 AppHeader——适合 sidebar 顶部悬挂内容
|
|
18
|
+
* 需要覆盖 header 区域的场景(如悬浮 logo/搜索框)。
|
|
19
|
+
*/
|
|
8
20
|
sidebarAboveHeader?: boolean;
|
|
9
21
|
};
|
|
10
22
|
declare function __VLS_template(): {
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
+
/** 充满视口 */
|
|
2
3
|
fullViewport?: boolean;
|
|
3
4
|
fullMode?: "min-height" | "height";
|
|
5
|
+
/** 下个viewport高度 */
|
|
4
6
|
nextViewportMaxHeight?: string;
|
|
5
7
|
background?: string;
|
|
8
|
+
/** 四向悬浮插槽与内容主体 / 插槽间的间隔(px),默认 8 */
|
|
6
9
|
gap?: number;
|
|
10
|
+
/** top 插槽 shim 容器背景 */
|
|
7
11
|
topBg?: string;
|
|
12
|
+
/** bottom 插槽 shim 容器背景 */
|
|
8
13
|
bottomBg?: string;
|
|
14
|
+
/** left 插槽 shim 容器背景 */
|
|
9
15
|
leftBg?: string;
|
|
16
|
+
/** right 插槽 shim 容器背景 */
|
|
10
17
|
rightBg?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 各向插槽尺寸量测是否启用 ResizeObserver(逐槽透传对应 WatchSize 的
|
|
20
|
+
* observeResize,均默认 false)。默认时机(激活首测 + window resize + onUpdated)
|
|
21
|
+
* 已覆盖重渲染驱动的槽尺寸变化;某槽内容有 **CSS 过渡折叠 / 异步撑开 / 后代自更新**
|
|
22
|
+
* 等不触发重渲染的尺寸变化(如右槽宽度过渡动画收起,inset 需实时回流)时按槽显式开启。
|
|
23
|
+
*/
|
|
24
|
+
/** top 插槽 RO 观测开关 */
|
|
11
25
|
topObserveResize?: boolean;
|
|
26
|
+
/** bottom 插槽 RO 观测开关 */
|
|
12
27
|
bottomObserveResize?: boolean;
|
|
28
|
+
/** left 插槽 RO 观测开关 */
|
|
13
29
|
leftObserveResize?: boolean;
|
|
30
|
+
/** right 插槽 RO 观测开关 */
|
|
14
31
|
rightObserveResize?: boolean;
|
|
15
32
|
};
|
|
16
33
|
declare function __VLS_template(): {
|