@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
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { watch
|
|
2
|
-
import { themeScaleDerive
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
["
|
|
7
|
-
["
|
|
8
|
-
["
|
|
9
|
-
["
|
|
1
|
+
import { watch, onScopeDispose } from "vue";
|
|
2
|
+
import { themeScaleDerive, themeScaleParseHex, themeScaleMix, themeScaleToRgba } from "../utils/theme-scale.mjs";
|
|
3
|
+
const STYLE_EL_ID = "dc-core-theme";
|
|
4
|
+
const randomStyleSuffix = () => Math.random().toString(36).slice(2, 9);
|
|
5
|
+
const THEME_FIELD_SPECS = [
|
|
6
|
+
["primaryColor", { scale: true, el: "--el-color-primary" }],
|
|
7
|
+
["successColor", { scale: true, el: "--el-color-success" }],
|
|
8
|
+
["warningColor", { scale: true, el: "--el-color-warning" }],
|
|
9
|
+
["dangerColor", { scale: true, el: "--el-color-danger" }],
|
|
10
|
+
["errorColor", { scale: true, el: "--el-color-error" }],
|
|
11
|
+
["infoColor", { scale: true, el: "--el-color-info" }],
|
|
10
12
|
["bodyColor", { el: ["--el-bg-color-page", "--el-bg-color"] }],
|
|
11
13
|
["baseColor", { el: "--el-text-color-primary" }],
|
|
12
14
|
["radius", { el: "--el-border-radius-base" }],
|
|
@@ -18,76 +20,106 @@ const v = "dc-core-theme", L = () => Math.random().toString(36).slice(2, 9), A =
|
|
|
18
20
|
["blur", {}],
|
|
19
21
|
["focusRing", {}],
|
|
20
22
|
["surface", {}]
|
|
21
|
-
]
|
|
23
|
+
];
|
|
24
|
+
const THEME_SCALE_SUFFIXES = [
|
|
22
25
|
"light-3",
|
|
23
26
|
"light-5",
|
|
24
27
|
"light-7",
|
|
25
28
|
"light-8",
|
|
26
29
|
"light-9",
|
|
27
30
|
"dark-2"
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
];
|
|
32
|
+
const themeKebab = (s) => s.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
33
|
+
const buildThemeBlockBody = (color, mode) => {
|
|
34
|
+
const lines = [];
|
|
35
|
+
for (const [key, spec] of THEME_FIELD_SPECS) {
|
|
36
|
+
const value = color[key];
|
|
37
|
+
if (value === void 0 || value === "") continue;
|
|
38
|
+
const corePrefix = `--dc-core-${themeKebab(key)}`;
|
|
39
|
+
const elVars = spec.el === void 0 ? [] : Array.isArray(spec.el) ? spec.el : [spec.el];
|
|
40
|
+
if (spec.scale) {
|
|
41
|
+
const scale = themeScaleDerive(value, mode);
|
|
42
|
+
lines.push(`${corePrefix}: ${value};`);
|
|
43
|
+
for (const suf of THEME_SCALE_SUFFIXES) {
|
|
44
|
+
lines.push(`${corePrefix}-${suf}: ${scale[suf]};`);
|
|
45
|
+
}
|
|
46
|
+
for (const el of elVars) {
|
|
47
|
+
lines.push(`${el}: ${value};`);
|
|
48
|
+
for (const suf of THEME_SCALE_SUFFIXES) {
|
|
49
|
+
lines.push(`${el}-${suf}: ${scale[suf]};`);
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
52
|
} else {
|
|
45
|
-
|
|
46
|
-
for (const
|
|
53
|
+
lines.push(`${corePrefix}: ${value};`);
|
|
54
|
+
for (const el of elVars) lines.push(`${el}: ${value};`);
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
return lines.join("\n ");
|
|
58
|
+
};
|
|
59
|
+
const OVERLAY_DARKEN_REL = 0.4;
|
|
60
|
+
const OVERLAY_CAP_MAX_CH = 10;
|
|
61
|
+
const OVERLAY_ALPHA = {
|
|
52
62
|
light: 0.5,
|
|
53
63
|
dark: 0.72
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
};
|
|
65
|
+
const buildOverlayDecl = (bodyColor, mode) => {
|
|
66
|
+
if (!bodyColor) return "";
|
|
67
|
+
const rgb = themeScaleParseHex(bodyColor);
|
|
68
|
+
if (!rgb) return "";
|
|
69
|
+
const maxCh = Math.max(...rgb);
|
|
70
|
+
const k = maxCh === 0 ? 0 : Math.min(OVERLAY_DARKEN_REL, OVERLAY_CAP_MAX_CH / maxCh);
|
|
71
|
+
const scrim = themeScaleMix(bodyColor, "#000000", k);
|
|
72
|
+
return `--el-overlay-color-lighter: ${themeScaleToRgba(
|
|
73
|
+
scrim,
|
|
74
|
+
OVERLAY_ALPHA[mode]
|
|
62
75
|
)};`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
};
|
|
77
|
+
const MASK_ALPHA = { light: 0.9, dark: 0.8 };
|
|
78
|
+
const buildMaskDecl = (bodyColor, mode) => {
|
|
79
|
+
if (!bodyColor) return "";
|
|
80
|
+
const veil = themeScaleToRgba(bodyColor, MASK_ALPHA[mode]);
|
|
81
|
+
if (veil === bodyColor) return "";
|
|
82
|
+
return `--el-mask-color: ${veil};`;
|
|
83
|
+
};
|
|
84
|
+
const ELEVATE_BODY_WEIGHT = 0.88;
|
|
85
|
+
const buildDialogSurfaceDecl = (bodyColor, mode) => {
|
|
86
|
+
if (!bodyColor) return "";
|
|
87
|
+
if (!themeScaleParseHex(bodyColor)) return "";
|
|
88
|
+
const elevated = themeScaleMix(bodyColor, "#ffffff", ELEVATE_BODY_WEIGHT);
|
|
89
|
+
return `--dc-core-dialog-surface: ${elevated};`;
|
|
90
|
+
};
|
|
91
|
+
const buildThemeCss = (config) => {
|
|
92
|
+
const lightColor = config.light;
|
|
93
|
+
const darkColor = config.dark;
|
|
94
|
+
const lightBody = buildThemeBlockBody(lightColor, "light");
|
|
95
|
+
const darkBody = buildThemeBlockBody(darkColor, "dark");
|
|
96
|
+
const rootColorDecl = "color: var(--dc-core-base-color);";
|
|
97
|
+
const lightLines = [
|
|
98
|
+
lightBody,
|
|
99
|
+
rootColorDecl,
|
|
100
|
+
buildOverlayDecl(lightColor.bodyColor, "light"),
|
|
101
|
+
buildMaskDecl(lightColor.bodyColor, "light")
|
|
102
|
+
].filter(Boolean);
|
|
103
|
+
const darkLines = [
|
|
104
|
+
darkBody,
|
|
105
|
+
buildOverlayDecl(darkColor.bodyColor, "dark"),
|
|
106
|
+
buildMaskDecl(darkColor.bodyColor, "dark"),
|
|
107
|
+
buildDialogSurfaceDecl(darkColor.bodyColor)
|
|
78
108
|
].filter(Boolean);
|
|
79
109
|
return `:root {
|
|
80
|
-
${
|
|
81
|
-
|
|
82
|
-
`
|
|
110
|
+
${lightLines.join(
|
|
111
|
+
"\n "
|
|
83
112
|
)}
|
|
84
113
|
}
|
|
85
114
|
:root.dark {
|
|
86
|
-
${
|
|
87
|
-
`)}
|
|
115
|
+
${darkLines.join("\n ")}
|
|
88
116
|
}
|
|
89
117
|
`;
|
|
90
|
-
}
|
|
118
|
+
};
|
|
119
|
+
const RHYTHM_STYLE_EL_ID = "dc-core-rhythm";
|
|
120
|
+
const EP_BRIDGE_STYLE_EL_ID = "dc-core-ep-bridge";
|
|
121
|
+
const EP_STRUCTURAL_STYLE_EL_ID = "dc-core-ep-structural";
|
|
122
|
+
const EP_STRUCTURAL_CSS = [
|
|
91
123
|
// 居中浮层(Dialog / MessageBox)+ 抽屉(Drawer,含 ConfirmModal drawer 形态 + 消费方直接
|
|
92
124
|
// 用的 ElDrawer):暗色下面板底 ≈ 页面底 + EP 黑投影不可见 → 边界糊。统一两手保底:
|
|
93
125
|
// ① elevation 提亮面(--dc-core-dialog-surface,仅暗色派生;亮色退 --el-bg-color 零改动);
|
|
@@ -106,8 +138,8 @@ const v = "dc-core-theme", L = () => Math.random().toString(36).slice(2, 9), A =
|
|
|
106
138
|
" --el-table-fixed-left-column: inset 10px 0 10px -10px var(--dc-core-border-color, var(--el-border-color));",
|
|
107
139
|
" --el-table-fixed-right-column: inset -10px 0 10px -10px var(--dc-core-border-color, var(--el-border-color));",
|
|
108
140
|
"}"
|
|
109
|
-
].join(
|
|
110
|
-
|
|
141
|
+
].join("\n");
|
|
142
|
+
const EP_BRIDGE_CSS = [
|
|
111
143
|
// T1 必纳:表格行密度(垂直经 td padding,水平经 .cell padding)
|
|
112
144
|
".el-table .el-table__cell {",
|
|
113
145
|
" padding-top: var(--dc-core-cell-padding-y, 8px);",
|
|
@@ -123,8 +155,8 @@ const v = "dc-core-theme", L = () => Math.random().toString(36).slice(2, 9), A =
|
|
|
123
155
|
"}"
|
|
124
156
|
// 注:dialog/card 内距撤到期二——其 EP 原生值(dialog 16 / card 20)与单一
|
|
125
157
|
// content-gap 无法同时对齐,本期纳入会破"默认档零漂移";期二用专属 var 补。
|
|
126
|
-
].join(
|
|
127
|
-
|
|
158
|
+
].join("\n");
|
|
159
|
+
const DENSITY_VALUE_MAP = {
|
|
128
160
|
compact: {
|
|
129
161
|
spaceUnit: "4px",
|
|
130
162
|
gap: "8px",
|
|
@@ -157,7 +189,8 @@ const v = "dc-core-theme", L = () => Math.random().toString(36).slice(2, 9), A =
|
|
|
157
189
|
fontSizeBase: "15px",
|
|
158
190
|
fontScale: "1.25"
|
|
159
191
|
}
|
|
160
|
-
}
|
|
192
|
+
};
|
|
193
|
+
const MOTION_VALUE_MAP = {
|
|
161
194
|
snappy: {
|
|
162
195
|
duration: "120ms",
|
|
163
196
|
durationSlow: "180ms",
|
|
@@ -176,92 +209,110 @@ const v = "dc-core-theme", L = () => Math.random().toString(36).slice(2, 9), A =
|
|
|
176
209
|
easing: "cubic-bezier(0.22, 0.61, 0.36, 1)"
|
|
177
210
|
}
|
|
178
211
|
};
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`--dc-core-
|
|
184
|
-
`--
|
|
185
|
-
`--dc-core-
|
|
186
|
-
`--
|
|
187
|
-
`--dc-core-
|
|
188
|
-
`--dc-core-
|
|
189
|
-
`--
|
|
190
|
-
`--dc-core-font-
|
|
191
|
-
`--
|
|
192
|
-
`--
|
|
193
|
-
`--dc-core-motion-duration
|
|
194
|
-
`--el-transition-duration: ${
|
|
212
|
+
function buildRhythmCss(density, motion) {
|
|
213
|
+
const d = DENSITY_VALUE_MAP[density];
|
|
214
|
+
const m = MOTION_VALUE_MAP[motion];
|
|
215
|
+
const lines = [
|
|
216
|
+
`--dc-core-space-unit: ${d.spaceUnit};`,
|
|
217
|
+
`--dc-core-content-gap: ${d.gap};`,
|
|
218
|
+
`--dc-core-control-height: ${d.controlHeight};`,
|
|
219
|
+
`--el-component-size: ${d.controlHeight};`,
|
|
220
|
+
`--dc-core-cell-padding-y: ${d.cellPaddingY};`,
|
|
221
|
+
`--dc-core-cell-padding-x: ${d.cellPaddingX};`,
|
|
222
|
+
`--dc-core-form-item-gap: ${d.formItemGap};`,
|
|
223
|
+
`--dc-core-font-size-base: ${d.fontSizeBase};`,
|
|
224
|
+
`--el-font-size-base: ${d.fontSizeBase};`,
|
|
225
|
+
`--dc-core-font-scale: ${d.fontScale};`,
|
|
226
|
+
`--dc-core-motion-duration: ${m.duration};`,
|
|
227
|
+
`--el-transition-duration-fast: ${m.duration};`,
|
|
228
|
+
`--dc-core-motion-duration-slow: ${m.durationSlow};`,
|
|
229
|
+
`--el-transition-duration: ${m.durationSlow};`,
|
|
195
230
|
// easing 仅挂 dc-core,[MUST NOT] dual-write 覆盖 EP 两条 bezier——
|
|
196
231
|
// EP ease-in-out / fast 曲线各异,覆盖会让默认档动画曲线漂移;motion 档对 EP 只经 duration 生效。
|
|
197
|
-
`--dc-core-motion-easing: ${
|
|
198
|
-
]
|
|
232
|
+
`--dc-core-motion-easing: ${m.easing};`
|
|
233
|
+
];
|
|
234
|
+
const reduced = [
|
|
199
235
|
"--dc-core-motion-duration: 0.01ms;",
|
|
200
236
|
"--dc-core-motion-duration-slow: 0.01ms;",
|
|
201
237
|
"--el-transition-duration: 0.01ms;",
|
|
202
238
|
"--el-transition-duration-fast: 0.01ms;"
|
|
203
239
|
];
|
|
204
240
|
return `:root {
|
|
205
|
-
${
|
|
206
|
-
`)}
|
|
241
|
+
${lines.join("\n ")}
|
|
207
242
|
}
|
|
208
243
|
@media (prefers-reduced-motion: reduce) {
|
|
209
244
|
:root {
|
|
210
|
-
${
|
|
211
|
-
|
|
212
|
-
`
|
|
245
|
+
${reduced.join(
|
|
246
|
+
"\n "
|
|
213
247
|
)}
|
|
214
248
|
}
|
|
215
249
|
}
|
|
216
250
|
`;
|
|
217
251
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
220
|
-
if (!
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
252
|
+
function useCoreThemeApply(options) {
|
|
253
|
+
const doc = options.document ?? (typeof document !== "undefined" ? document : void 0);
|
|
254
|
+
if (!doc) return;
|
|
255
|
+
const idSuffix = randomStyleSuffix();
|
|
256
|
+
const ownedEls = [];
|
|
257
|
+
const createOwnedStyle = (baseId) => {
|
|
258
|
+
const el = doc.createElement("style");
|
|
259
|
+
el.id = `${baseId}-${idSuffix}`;
|
|
260
|
+
doc.head.appendChild(el);
|
|
261
|
+
ownedEls.push(el);
|
|
262
|
+
return el;
|
|
263
|
+
};
|
|
264
|
+
let themeEl = null;
|
|
265
|
+
const ensureStyleEl = () => {
|
|
266
|
+
if (!themeEl) themeEl = createOwnedStyle(STYLE_EL_ID);
|
|
267
|
+
return themeEl;
|
|
224
268
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
269
|
+
if (!doc.getElementById(EP_STRUCTURAL_STYLE_EL_ID)) {
|
|
270
|
+
const structEl = doc.createElement("style");
|
|
271
|
+
structEl.id = EP_STRUCTURAL_STYLE_EL_ID;
|
|
272
|
+
structEl.textContent = EP_STRUCTURAL_CSS;
|
|
273
|
+
doc.head.appendChild(structEl);
|
|
230
274
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
(
|
|
234
|
-
|
|
275
|
+
watch(
|
|
276
|
+
options.getThemeConfig,
|
|
277
|
+
(config) => {
|
|
278
|
+
ensureStyleEl().textContent = buildThemeCss(config);
|
|
235
279
|
},
|
|
236
|
-
{ deep:
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
280
|
+
{ deep: true, immediate: true }
|
|
281
|
+
);
|
|
282
|
+
watch(
|
|
283
|
+
options.getThemeIsDark,
|
|
284
|
+
(isDark) => {
|
|
285
|
+
doc.documentElement.classList.toggle("dark", isDark);
|
|
241
286
|
},
|
|
242
|
-
{ immediate:
|
|
287
|
+
{ immediate: true }
|
|
243
288
|
);
|
|
244
|
-
const { getThemeDensity
|
|
245
|
-
if (
|
|
246
|
-
if (!
|
|
247
|
-
const
|
|
248
|
-
|
|
289
|
+
const { getThemeDensity, getThemeMotion } = options;
|
|
290
|
+
if (getThemeDensity && getThemeMotion) {
|
|
291
|
+
if (!doc.getElementById(EP_BRIDGE_STYLE_EL_ID)) {
|
|
292
|
+
const epEl = doc.createElement("style");
|
|
293
|
+
epEl.id = EP_BRIDGE_STYLE_EL_ID;
|
|
294
|
+
epEl.textContent = EP_BRIDGE_CSS;
|
|
295
|
+
doc.head.appendChild(epEl);
|
|
249
296
|
}
|
|
250
|
-
let
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
297
|
+
let rhythmEl = null;
|
|
298
|
+
const ensureRhythmStyleEl = () => {
|
|
299
|
+
if (!rhythmEl) rhythmEl = createOwnedStyle(RHYTHM_STYLE_EL_ID);
|
|
300
|
+
return rhythmEl;
|
|
301
|
+
};
|
|
302
|
+
watch(
|
|
303
|
+
() => [getThemeDensity(), getThemeMotion()],
|
|
304
|
+
([density, motion]) => {
|
|
305
|
+
ensureRhythmStyleEl().textContent = buildRhythmCss(density, motion);
|
|
256
306
|
},
|
|
257
|
-
{ immediate:
|
|
307
|
+
{ immediate: true }
|
|
258
308
|
);
|
|
259
309
|
}
|
|
260
|
-
|
|
261
|
-
|
|
310
|
+
onScopeDispose(() => {
|
|
311
|
+
ownedEls.forEach((el) => el.remove());
|
|
312
|
+
ownedEls.length = 0;
|
|
262
313
|
});
|
|
263
314
|
}
|
|
264
315
|
export {
|
|
265
|
-
|
|
266
|
-
|
|
316
|
+
buildRhythmCss,
|
|
317
|
+
useCoreThemeApply
|
|
267
318
|
};
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
import { watch
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
import { watch, onScopeDispose } from "vue";
|
|
2
|
+
const STYLE_EL_ID = "dc-core-viewport";
|
|
3
|
+
const randomStyleSuffix = () => Math.random().toString(36).slice(2, 9);
|
|
4
|
+
const buildViewportCss = (config, gap) => {
|
|
5
|
+
const horizontal = config.paddingLeft + config.paddingRight;
|
|
6
|
+
const vertical = config.paddingTop + config.paddingBottom;
|
|
4
7
|
return `:root {
|
|
5
|
-
--dc-core-viewport-width: calc(100vw - ${
|
|
6
|
-
--dc-core-viewport-height: calc(100vh - ${
|
|
7
|
-
--dc-core-viewport-padding-top: ${
|
|
8
|
-
--dc-core-viewport-padding-right: ${
|
|
9
|
-
--dc-core-viewport-padding-bottom: ${
|
|
10
|
-
--dc-core-viewport-padding-left: ${
|
|
8
|
+
--dc-core-viewport-width: calc(100vw - ${horizontal}px);
|
|
9
|
+
--dc-core-viewport-height: calc(100vh - ${vertical}px);
|
|
10
|
+
--dc-core-viewport-padding-top: ${config.paddingTop}px;
|
|
11
|
+
--dc-core-viewport-padding-right: ${config.paddingRight}px;
|
|
12
|
+
--dc-core-viewport-padding-bottom: ${config.paddingBottom}px;
|
|
13
|
+
--dc-core-viewport-padding-left: ${config.paddingLeft}px;
|
|
11
14
|
` + // gap 内缝 var:仅当提供 getGapConfig 时注入(纯对外暴露,core 不读)。
|
|
12
|
-
(
|
|
13
|
-
` :
|
|
15
|
+
(gap ? ` --dc-core-gap: ${gap.size}px;
|
|
16
|
+
` : ``) + `}
|
|
14
17
|
`;
|
|
15
18
|
};
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
const
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
function useCoreViewportApply(options) {
|
|
20
|
+
const doc = options.document ?? (typeof document !== "undefined" ? document : void 0);
|
|
21
|
+
if (!doc) return;
|
|
22
|
+
const styleId = `${STYLE_EL_ID}-${randomStyleSuffix()}`;
|
|
23
|
+
let el = null;
|
|
24
|
+
const ensureStyleEl = () => {
|
|
25
|
+
if (!el) {
|
|
26
|
+
el = doc.createElement("style");
|
|
27
|
+
el.id = styleId;
|
|
28
|
+
doc.head.appendChild(el);
|
|
29
|
+
}
|
|
30
|
+
return el;
|
|
31
|
+
};
|
|
32
|
+
watch(
|
|
23
33
|
() => {
|
|
24
|
-
var
|
|
34
|
+
var _a;
|
|
25
35
|
return {
|
|
26
|
-
viewport:
|
|
27
|
-
gap: (
|
|
36
|
+
viewport: options.getViewportConfig(),
|
|
37
|
+
gap: (_a = options.getGapConfig) == null ? void 0 : _a.call(options)
|
|
28
38
|
};
|
|
29
39
|
},
|
|
30
|
-
({ viewport
|
|
31
|
-
|
|
40
|
+
({ viewport, gap }) => {
|
|
41
|
+
ensureStyleEl().textContent = buildViewportCss(viewport, gap);
|
|
32
42
|
},
|
|
33
|
-
{ deep:
|
|
34
|
-
)
|
|
35
|
-
|
|
43
|
+
{ deep: true, immediate: true }
|
|
44
|
+
);
|
|
45
|
+
onScopeDispose(() => {
|
|
46
|
+
el == null ? void 0 : el.remove();
|
|
47
|
+
el = null;
|
|
36
48
|
});
|
|
37
49
|
}
|
|
38
50
|
export {
|
|
39
|
-
|
|
51
|
+
useCoreViewportApply
|
|
40
52
|
};
|