From 29d7cacbf9806701cc5452b985cc3a59807eed5b Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 15 Mar 2024 16:26:24 +0800 Subject: [PATCH 1/6] feat(theme): support css variable --- packages/abc/avatar-list/style/index.less | 2 +- packages/abc/cell/style/index.less | 2 +- packages/abc/down-file/style/index.less | 2 +- packages/abc/ellipsis/style/index.less | 2 +- packages/abc/error-collect/style/index.less | 2 +- packages/abc/exception/style/index.less | 2 +- packages/abc/footer-toolbar/style/index.less | 2 +- packages/abc/full-content/style/index.less | 2 +- packages/abc/global-footer/style/index.less | 2 +- packages/abc/loading/style/index.less | 2 +- packages/abc/notice-icon/style/index.less | 2 +- packages/abc/onboarding/style/index.less | 4 +-- packages/abc/page-header/style/index.less | 2 +- packages/abc/pdf/style/index.less | 2 +- packages/abc/quick-menu/style/index.less | 2 +- packages/abc/result/style/index.less | 2 +- packages/abc/reuse-tab/style/index.less | 2 +- packages/abc/se/style/index.less | 2 +- packages/abc/st/style/index.less | 2 +- packages/abc/sv/style/index.less | 7 ++-- packages/abc/tag-select/style/index.less | 2 +- packages/abc/theme-dark.less | 1 - packages/abc/theme-default.less | 19 +++++----- packages/abc/theme-variable.less | 1 + packages/chart/card/style/index.less | 2 +- packages/chart/mini-progress/style/index.less | 2 +- packages/chart/number-info/style/index.less | 2 +- packages/chart/pie/style/index.less | 2 +- packages/chart/radar/style/index.less | 2 +- packages/chart/trend/style/index.less | 2 +- packages/chart/water-wave/style/index.less | 2 +- packages/theme/index.less | 3 +- packages/theme/layout-blank/style/index.less | 2 +- .../layout-blank/style/theme-default.less | 7 ++-- .../layout-blank/style/theme-variable.less | 1 + .../theme/layout-default/style/index.less | 2 +- .../layout-default/style/theme-dark.less | 2 +- .../layout-default/style/theme-default.less | 13 +++---- .../layout-default/style/theme-variable.less | 1 + packages/theme/system/entry.less | 2 -- packages/theme/system/index.less | 8 +++-- packages/theme/system/theme-default.less | 35 ++++++++----------- packages/theme/system/theme-variable.less | 32 +++++++++++++++++ packages/theme/theme-compact.less | 2 ++ packages/theme/theme-dark.less | 2 ++ packages/theme/theme-default.less | 2 ++ packages/theme/theme-variable.less | 7 ++++ packages/theme/variable.less | 6 ++++ scripts/site/route-paths.txt | 2 ++ src/app/app.config.ts | 5 +-- src/styles.less | 6 ++-- src/styles/index.less | 1 - src/styles/theme.less | 3 +- 53 files changed, 138 insertions(+), 90 deletions(-) create mode 100644 packages/abc/theme-variable.less create mode 100644 packages/theme/layout-blank/style/theme-variable.less create mode 100644 packages/theme/layout-default/style/theme-variable.less create mode 100644 packages/theme/system/theme-variable.less create mode 100644 packages/theme/theme-variable.less create mode 100644 packages/theme/variable.less diff --git a/packages/abc/avatar-list/style/index.less b/packages/abc/avatar-list/style/index.less index 7a93c5890..cab0c0547 100644 --- a/packages/abc/avatar-list/style/index.less +++ b/packages/abc/avatar-list/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @avatar-list-prefix: ~'.avatar-list'; @{avatar-list-prefix} { diff --git a/packages/abc/cell/style/index.less b/packages/abc/cell/style/index.less index 96f7c4aa0..c2e350222 100644 --- a/packages/abc/cell/style/index.less +++ b/packages/abc/cell/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @cell-prefix: ~'.cell'; @{cell-prefix} { diff --git a/packages/abc/down-file/style/index.less b/packages/abc/down-file/style/index.less index bd93ad92e..15599ee5c 100644 --- a/packages/abc/down-file/style/index.less +++ b/packages/abc/down-file/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @down-file-prefix: ~'.down-file'; @{down-file-prefix} { diff --git a/packages/abc/ellipsis/style/index.less b/packages/abc/ellipsis/style/index.less index c0da5482d..d4465392b 100644 --- a/packages/abc/ellipsis/style/index.less +++ b/packages/abc/ellipsis/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @ellipsis-prefix: ~'.ellipsis'; ellipsis { diff --git a/packages/abc/error-collect/style/index.less b/packages/abc/error-collect/style/index.less index 4d0733964..acd7ab243 100644 --- a/packages/abc/error-collect/style/index.less +++ b/packages/abc/error-collect/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @error-collect-prefix: ~'.error-collect'; @{error-collect-prefix} { diff --git a/packages/abc/exception/style/index.less b/packages/abc/exception/style/index.less index e93535054..693435ae2 100644 --- a/packages/abc/exception/style/index.less +++ b/packages/abc/exception/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @exception-prefix: ~'.exception'; @{exception-prefix} { diff --git a/packages/abc/footer-toolbar/style/index.less b/packages/abc/footer-toolbar/style/index.less index 021064b99..bad754a6b 100644 --- a/packages/abc/footer-toolbar/style/index.less +++ b/packages/abc/footer-toolbar/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @footer-toolbar-prefix: ~'.footer-toolbar'; @{footer-toolbar-prefix} { diff --git a/packages/abc/full-content/style/index.less b/packages/abc/full-content/style/index.less index 358b7245d..97327c502 100644 --- a/packages/abc/full-content/style/index.less +++ b/packages/abc/full-content/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @full-content-prefix: ~'.full-content'; @{full-content-prefix} { diff --git a/packages/abc/global-footer/style/index.less b/packages/abc/global-footer/style/index.less index 5b6b07706..50135979f 100644 --- a/packages/abc/global-footer/style/index.less +++ b/packages/abc/global-footer/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @global-footer-prefix: ~'.global-footer'; @{global-footer-prefix} { diff --git a/packages/abc/loading/style/index.less b/packages/abc/loading/style/index.less index c41759623..ae005510d 100644 --- a/packages/abc/loading/style/index.less +++ b/packages/abc/loading/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @loading-prefix: ~'.loading'; @{loading-prefix} { diff --git a/packages/abc/notice-icon/style/index.less b/packages/abc/notice-icon/style/index.less index 09669758c..4d8c28401 100644 --- a/packages/abc/notice-icon/style/index.less +++ b/packages/abc/notice-icon/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @notice-icon-prefix: ~'.notice-icon'; @{notice-icon-prefix} { diff --git a/packages/abc/onboarding/style/index.less b/packages/abc/onboarding/style/index.less index 5f368e8e2..d83ead4bb 100644 --- a/packages/abc/onboarding/style/index.less +++ b/packages/abc/onboarding/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @onboarding-prefix: ~'.onboarding'; @{onboarding-prefix} { @@ -10,7 +10,6 @@ position: fixed; z-index: @onboarding-zindex - 1; inset: 0; - opacity: @onboarding-mask-opacity; background-color: @onboarding-mask-background-color; } @@ -26,7 +25,6 @@ animation: @onboarding-light-ant; &-el { - // position: relative; z-index: @onboarding-zindex + 1 !important; } diff --git a/packages/abc/page-header/style/index.less b/packages/abc/page-header/style/index.less index cfab65057..ca91ed2f8 100644 --- a/packages/abc/page-header/style/index.less +++ b/packages/abc/page-header/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @page-header-prefix: ~'.page-header'; @{page-header-prefix} { diff --git a/packages/abc/pdf/style/index.less b/packages/abc/pdf/style/index.less index 9c5795599..380e2c6e2 100644 --- a/packages/abc/pdf/style/index.less +++ b/packages/abc/pdf/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @pdf-prefix: ~'.pdf'; @{pdf-prefix} { diff --git a/packages/abc/quick-menu/style/index.less b/packages/abc/quick-menu/style/index.less index 6c26a3402..76acd7cef 100644 --- a/packages/abc/quick-menu/style/index.less +++ b/packages/abc/quick-menu/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @quick-menu-prefix: ~'.quick-menu'; @{quick-menu-prefix} { diff --git a/packages/abc/result/style/index.less b/packages/abc/result/style/index.less index 6a5907beb..6ce93e8a0 100644 --- a/packages/abc/result/style/index.less +++ b/packages/abc/result/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @result-prefix: ~'.result'; @{result-prefix} { diff --git a/packages/abc/reuse-tab/style/index.less b/packages/abc/reuse-tab/style/index.less index 0aa157070..9d40dbe46 100644 --- a/packages/abc/reuse-tab/style/index.less +++ b/packages/abc/reuse-tab/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @reuse-tab-prefix: ~'.reuse-tab'; @{reuse-tab-prefix} { diff --git a/packages/abc/se/style/index.less b/packages/abc/se/style/index.less index 70d050789..55b2112a8 100644 --- a/packages/abc/se/style/index.less +++ b/packages/abc/se/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @se-prefix: ~'.se'; @{se-prefix} { diff --git a/packages/abc/st/style/index.less b/packages/abc/st/style/index.less index 8a7e58041..10190e43b 100644 --- a/packages/abc/st/style/index.less +++ b/packages/abc/st/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @st-prefix: ~'.st'; @{st-prefix} { diff --git a/packages/abc/sv/style/index.less b/packages/abc/sv/style/index.less index 0b7ad7bf9..6657868b6 100644 --- a/packages/abc/sv/style/index.less +++ b/packages/abc/sv/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @sv-prefix: ~'.sv'; @{sv-prefix} { @@ -51,7 +51,6 @@ &__label { display: table-cell; - // margin-right: 8px; padding-bottom: @sv-bottom; line-height: 22px; color: @sv-label-color; @@ -81,7 +80,7 @@ } &__detail { - // contents 对 ie, edge 不支持,但对于子组件的支持会更友好 + /** contents 对 ie, edge 不支持,但对于子组件的支持会更友好 */ display: table-cell; width: 100%; padding-bottom: @sv-bottom; @@ -158,7 +157,7 @@ } &-text { - // font-weight: 700; + // font-weight: 700;font-weight font-size: @sv-value-default-value-font-size; } diff --git a/packages/abc/tag-select/style/index.less b/packages/abc/tag-select/style/index.less index 1bb35a5ca..886c13b99 100644 --- a/packages/abc/tag-select/style/index.less +++ b/packages/abc/tag-select/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @tag-select-prefix: ~'.tag-select'; @tag-select-height: @tag-line-height + 2px; // 2px is top & bottom border width diff --git a/packages/abc/theme-dark.less b/packages/abc/theme-dark.less index 4d404f4ff..1d1140f27 100644 --- a/packages/abc/theme-dark.less +++ b/packages/abc/theme-dark.less @@ -39,6 +39,5 @@ // onboarding // -- -@onboarding-mask-opacity: 0.5; @onboarding-light-background-color: rgba(0, 0, 0, 0.1); @onboarding-light-ant-color: @component-background; diff --git a/packages/abc/theme-default.less b/packages/abc/theme-default.less index 2cf19fb2b..0fee9fd49 100644 --- a/packages/abc/theme-default.less +++ b/packages/abc/theme-default.less @@ -1,7 +1,7 @@ // st // -- -@st-btn-disabled-color: rgba(0, 0, 0, 0.25); -@st-title-optional-color: rgba(0, 0, 0, 0.35); +@st-btn-disabled-color: fade(@black, 25%); +@st-title-optional-color: fade(@black, 35%); @st-resizable-handle-width: 1px; @st-resizable-handle-height: 60%; @st-resizable-handle-color: @border-color-base; @@ -9,8 +9,8 @@ // sv // -- -@sv-label-color: rgba(0, 0, 0, 0.5); -@sv-label-optional-color: rgba(0, 0, 0, 0.35); +@sv-label-color: fade(@black, 50%); +@sv-label-optional-color: fade(@black, 35%); @sv-detail-color: @text-color; @sv-type-primary-color: @primary-color; @sv-type-success-color: @success-color; @@ -32,7 +32,7 @@ // se // -- -@se-label-optional-color: rgba(0, 0, 0, 0.35); +@se-label-optional-color: fade(@black, 35%); @se-compact-bottom: @layout-gutter; @se-optional-margin: 2px; @@ -47,7 +47,7 @@ // footer-toolbar // -- @footer-toolbar-height: 56px; -@footer-toolbar-box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03); +@footer-toolbar-box-shadow: 0 -1px 2px fade(@black, 3%); @footer-toolbar-bg: #fff; @footer-toolbar-border-top: 1px solid @border-color-split; @footer-toolbar-padding: 0 24px; @@ -86,15 +86,14 @@ // loading // -- @loading-zindex: 9999; -@loading-backdrop-bg: rgba(0, 0, 0, 0.15); +@loading-backdrop-bg: fade(@black, 15%); @loading-icon-color: @primary-color; @loading-text-color: @primary-color; // onboarding // -- -@onboarding-mask-opacity: 0.5; -@onboarding-mask-background-color: #000; -@onboarding-light-background-color: rgba(255, 255, 255, 0.9); +@onboarding-mask-background-color: fade(@black, 50%); +@onboarding-light-background-color: fade(@white, 90%); @onboarding-light-ant: 2500ms cubic-bezier(0.55, 0.05, 0.6, 0.2) 0s infinite normal none running onboardingAnt; @onboarding-light-ant-color: rgb(255, 255, 255); @onboarding-changing-ant: all 0.3s ease-out; diff --git a/packages/abc/theme-variable.less b/packages/abc/theme-variable.less new file mode 100644 index 000000000..f8a7cd7a3 --- /dev/null +++ b/packages/abc/theme-variable.less @@ -0,0 +1 @@ +@import './theme-default.less'; diff --git a/packages/chart/card/style/index.less b/packages/chart/card/style/index.less index 1234f2cda..9c58ed8dd 100644 --- a/packages/chart/card/style/index.less +++ b/packages/chart/card/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @g2-card-prefix: ~'.g2-card'; @{g2-card-prefix} { diff --git a/packages/chart/mini-progress/style/index.less b/packages/chart/mini-progress/style/index.less index 5c3bed171..55a3f217a 100644 --- a/packages/chart/mini-progress/style/index.less +++ b/packages/chart/mini-progress/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @g2-mini-progress-prefix: ~'.g2-mini-progress'; @{g2-mini-progress-prefix} { diff --git a/packages/chart/number-info/style/index.less b/packages/chart/number-info/style/index.less index 16fd91ffa..793ad186f 100644 --- a/packages/chart/number-info/style/index.less +++ b/packages/chart/number-info/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @number-info-prefix: ~'.number-info'; @{number-info-prefix} { diff --git a/packages/chart/pie/style/index.less b/packages/chart/pie/style/index.less index 7d26205c4..2df059ac0 100644 --- a/packages/chart/pie/style/index.less +++ b/packages/chart/pie/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @g2-pie-prefix: ~'.g2-pie'; @{g2-pie-prefix} { diff --git a/packages/chart/radar/style/index.less b/packages/chart/radar/style/index.less index 49ec30edd..de6d99097 100644 --- a/packages/chart/radar/style/index.less +++ b/packages/chart/radar/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @g2-radar-prefix: ~'.g2-radar'; @{g2-radar-prefix} { diff --git a/packages/chart/trend/style/index.less b/packages/chart/trend/style/index.less index 36a528cbf..32eeb4bcd 100644 --- a/packages/chart/trend/style/index.less +++ b/packages/chart/trend/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @trend-prefix: ~'.trend'; @{trend-prefix} { diff --git a/packages/chart/water-wave/style/index.less b/packages/chart/water-wave/style/index.less index 2e2a3e598..072e5eaa5 100644 --- a/packages/chart/water-wave/style/index.less +++ b/packages/chart/water-wave/style/index.less @@ -1,4 +1,4 @@ -@import '../../../theme/theme-default.less'; +@import '../../../theme/index.less'; @g2-water-wave-prefix: ~'.g2-water-wave'; @{g2-water-wave-prefix} { diff --git a/packages/theme/index.less b/packages/theme/index.less index f8a7cd7a3..a3d2c1102 100644 --- a/packages/theme/index.less +++ b/packages/theme/index.less @@ -1 +1,2 @@ -@import './theme-default.less'; +// @import './theme-default.less'; +@import './theme-@{root-entry-name}.less'; diff --git a/packages/theme/layout-blank/style/index.less b/packages/theme/layout-blank/style/index.less index 04b2e2408..634cb25df 100644 --- a/packages/theme/layout-blank/style/index.less +++ b/packages/theme/layout-blank/style/index.less @@ -1,3 +1,3 @@ -@import './theme-default.less'; +@import './theme-@{root-entry-name}.less'; @import './_layout.less'; @import './fix/index.less'; diff --git a/packages/theme/layout-blank/style/theme-default.less b/packages/theme/layout-blank/style/theme-default.less index e165e220c..a828bd8e0 100644 --- a/packages/theme/layout-blank/style/theme-default.less +++ b/packages/theme/layout-blank/style/theme-default.less @@ -1,6 +1,9 @@ -@alain-blank-prefix: ~'.alain-blank'; -@alain-blank-zindex: @zindex-base; +@alain-blank-name: 'alain-blank'; +@alain-blank-prefix: ~'.@{alain-blank-name}'; +@alain-blank-zindex: @zindex-base; @alain-blank-bg: #f5f7fa; +// @alain-blank-bg: ~'var(--@{alain-blank-name}-bg, #f5f7fa)'; + @alain-blank-content-padding-vertical: 0; @alain-blank-content-padding-horizontal: @layout-gutter * 2; diff --git a/packages/theme/layout-blank/style/theme-variable.less b/packages/theme/layout-blank/style/theme-variable.less new file mode 100644 index 000000000..f8a7cd7a3 --- /dev/null +++ b/packages/theme/layout-blank/style/theme-variable.less @@ -0,0 +1 @@ +@import './theme-default.less'; diff --git a/packages/theme/layout-default/style/index.less b/packages/theme/layout-default/style/index.less index bb6d629a9..f41e781e8 100644 --- a/packages/theme/layout-default/style/index.less +++ b/packages/theme/layout-default/style/index.less @@ -1,4 +1,4 @@ -@import './theme-default.less'; +@import './theme-@{root-entry-name}.less'; // Layout @import './_layout.less'; @import './_header.less'; diff --git a/packages/theme/layout-default/style/theme-dark.less b/packages/theme/layout-default/style/theme-dark.less index 50abf647b..7054c90af 100644 --- a/packages/theme/layout-default/style/theme-dark.less +++ b/packages/theme/layout-default/style/theme-dark.less @@ -7,4 +7,4 @@ @alain-default-aside-nav-selected-bg: @component-background; @alain-default-content-heading-bg: @component-background; @alain-default-content-heading-border: @border-color-split; -@alain-default-content-bg: @body-background; +@alain-default-content-bg: ~'var(--@{alain-default-name}-content-bg, @{body-background})'; diff --git a/packages/theme/layout-default/style/theme-default.less b/packages/theme/layout-default/style/theme-default.less index 3da8b5c65..5ca6e0d60 100644 --- a/packages/theme/layout-default/style/theme-default.less +++ b/packages/theme/layout-default/style/theme-default.less @@ -1,4 +1,5 @@ -@alain-default-prefix: ~'.alain-default'; +@alain-default-name: 'alain-default'; +@alain-default-prefix: ~'.@{alain-default-name}'; @alain-default-zindex: @zindex-base; @alain-default-ease: cubic-bezier(0.25, 0, 0.15, 1); @alain-default-header-hg: 64px; @@ -13,7 +14,7 @@ @alain-default-header-top-menu-item-padding: 0 16px; @alain-default-aside-wd: 200px; -@alain-default-aside-bg: #fff; +@alain-default-aside-bg: ~'var(--@{alain-default-name}-aside-bg, #fff)'; @alain-default-aside-scrollbar-width: 0; @alain-default-aside-scrollbar-height: 0; @alain-default-aside-scrollbar-track-color: transparent; @@ -28,7 +29,7 @@ @alain-default-aside-nav-text-hover-color: @primary-color; @alain-default-aside-nav-group-text-color: @text-color-secondary; @alain-default-aside-nav-selected-text-color: @primary-color; -@alain-default-aside-nav-selected-bg: #fcfcfc; +@alain-default-aside-nav-selected-bg: ~'var(--@{alain-default-name}-aside-nav-selected-bg, #fcfcfc)'; @alain-default-aside-nav-depth1-padding-left: @layout-gutter * 3; @alain-default-aside-nav-depth2-padding-left: @layout-gutter * 4; @alain-default-aside-nav-depth3-padding-left: @layout-gutter * 5; @@ -40,10 +41,10 @@ @alain-default-aside-collapsed-nav-img-wh: 24px; @alain-default-aside-collapsed-padding: (@layout-gutter * 2) 0; -@alain-default-content-heading-bg: #fafbfc; -@alain-default-content-heading-border: #efe3e5; +@alain-default-content-heading-bg: ~'var(--@{alain-default-name}-heading-bg, #fafbfc)'; +@alain-default-content-heading-border: ~'var(--@{alain-default-name}-heading-border, #efe3e5)'; @alain-default-content-padding: @layout-gutter * 3; -@alain-default-content-bg: #f5f7fa; +@alain-default-content-bg: ~'var(--@{alain-default-name}-content-bg, #f5f7fa)'; @alain-default-widget-app-icons-enabled: true; @alain-default-aside-user-enabled: true; diff --git a/packages/theme/layout-default/style/theme-variable.less b/packages/theme/layout-default/style/theme-variable.less new file mode 100644 index 000000000..f8a7cd7a3 --- /dev/null +++ b/packages/theme/layout-default/style/theme-variable.less @@ -0,0 +1 @@ +@import './theme-default.less'; diff --git a/packages/theme/system/entry.less b/packages/theme/system/entry.less index 872594edd..0b085d802 100644 --- a/packages/theme/system/entry.less +++ b/packages/theme/system/entry.less @@ -1,5 +1,3 @@ -@import './theme-default.less'; - // Angular @import './ng/index.less'; diff --git a/packages/theme/system/index.less b/packages/theme/system/index.less index 82e94d57b..adc6c2523 100644 --- a/packages/theme/system/index.less +++ b/packages/theme/system/index.less @@ -1,6 +1,8 @@ -// antd: base +/** antd: base */ @import 'ng-zorro-antd/style/entry.less'; -// antd: all components + +/** antd: all components */ @import 'ng-zorro-antd/components.less'; -// system + +/** system */ @import './entry.less'; diff --git a/packages/theme/system/theme-default.less b/packages/theme/system/theme-default.less index f25b00397..8fe309fc4 100644 --- a/packages/theme/system/theme-default.less +++ b/packages/theme/system/theme-default.less @@ -1,22 +1,20 @@ @import 'ng-zorro-antd/src/style/mixins/index.less'; @import './mixins/index.less'; -@root-entry-name: default; - -@white: #fff; -@black: #000; - // grey @grey-1: #ffffff; @grey-2: #fafafa; @grey-3: #f5f5f5; -@grey-4: #e8e8e8; +@grey-4: #f0f0f0; @grey-5: #d9d9d9; @grey-6: #bfbfbf; @grey-7: #8c8c8c; @grey-8: #595959; -@grey-9: #262626; -@grey-10: #000000; +@grey-9: #434343; +@grey-10: #262626; +@grey-11: #1f1f1f; +@grey-12: #141414; +@grey-13: #000000; @color-light-index: 5; @color-basic-index: 6; @@ -137,23 +135,18 @@ @muted-color: @grey-7; -// Colors -@white: #fff; -@black: #000; - // scrollbar @scrollbar-enabled: true; @scrollbar-width: 6px; @scrollbar-height: 6px; -@scrollbar-track-color: rgba(0, 0, 0, 0.3); +@scrollbar-track-color: fade(@black, 30%); @scrollbar-thumb-color: transparent; @scrollbar-table-enabled: false; // type // ========== -// font-size -// https://ant.design/docs/spec/font-cn#字号 +/** font-size https://ant.design/docs/spec/font-cn#字号 */ @font-size-large: @font-size-base + 8; // 20px @font-size-small: @font-size-base; // 12px @@ -167,8 +160,8 @@ @enable-all-colors: false; // Code -@code-border-color: #eee; -@code-bg: #f7f7f7; +@code-border-color: @border-color-base; +@code-bg: @tag-default-bg; @drawer-xl: 1200px; @drawer-lg: 900px; @@ -208,22 +201,22 @@ @nz-table-rep-max-width: @mobile-max; @nz-table-rep-min-width: @nz-table-rep-max-width + 1; @nz-table-rep-header-background: @border-color-split; -@nz-table-rep-even-background: #f9f9f9; +@nz-table-rep-even-background: @item-hover-bg; @nz-table-rep-padding-vertical: (@table-padding-vertical / 2); @nz-table-rep-padding-horizontal: (@table-padding-horizontal / 2); @nz-table-rep-column-name-width: 100px; @nz-table-rep-column-name-text-align: right; @nz-table-rep-column-name-padding-right: 8px; -@nz-table-rep-column-name-color: rgba(0, 0, 0, 0.5); +@nz-table-rep-column-name-color: fade(@black, 50%); // Forced to turn off Modal animation @forced-turn-off-nz-modal-animation-enabled: false; @sf-title-text-align: left; -@sf-optional-color: rgba(0, 0, 0, 0.35); +@sf-optional-color: fade(@black, 35%); @sf-optional-margin: 2px; @sf-inline-ant-select-min-width: 100px; -@sf-widget-array-type-card-remove-bg: rgba(0, 0, 0, 0.26); +@sf-widget-array-type-card-remove-bg: fade(@black, 26%); @yn-yes-color: @blue-6; @yn-no-color: @grey-7; diff --git a/packages/theme/system/theme-variable.less b/packages/theme/system/theme-variable.less new file mode 100644 index 000000000..98a9abce3 --- /dev/null +++ b/packages/theme/system/theme-variable.less @@ -0,0 +1,32 @@ +@import './theme-default.less'; + +@{html-selector} { + --grey-1: #fff; + --grey-2: #fafafa; + --grey-3: #f5f5f5; + --grey-4: #f0f0f0; + --grey-5: #d9d9d9; + --grey-6: #bfbfbf; + --grey-7: #8c8c8c; + --grey-8: #595959; + --grey-9: #434343; + --grey-10: #262626; + --grey-11: #1f1f1f; + --grey-12: #141414; + --grey-13: #000; +} + +// grey +@grey-1: var(--grey-1); +@grey-2: var(--grey-2); +@grey-3: var(--grey-3); +@grey-4: var(--grey-4); +@grey-5: var(--grey-5); +@grey-6: var(--grey-6); +@grey-7: var(--grey-7); +@grey-8: var(--grey-8); +@grey-9: var(--grey-9); +@grey-10: var(--grey-10); +@grey-11: var(--grey-11); +@grey-12: var(--grey-12); +@grey-13: var(--grey-13); diff --git a/packages/theme/theme-compact.less b/packages/theme/theme-compact.less index 1aec0a9ce..adeadcda7 100644 --- a/packages/theme/theme-compact.less +++ b/packages/theme/theme-compact.less @@ -1,3 +1,5 @@ +@root-entry-name: compact; + @import 'ng-zorro-antd/src/style/themes/compact.less'; @import './system/theme-compact.less'; @import './layout-default/style/theme-compact.less'; diff --git a/packages/theme/theme-dark.less b/packages/theme/theme-dark.less index 92a175d1b..75006c2fb 100644 --- a/packages/theme/theme-dark.less +++ b/packages/theme/theme-dark.less @@ -1,3 +1,5 @@ +@root-entry-name: dark; + @import 'ng-zorro-antd/src/style/themes/dark.less'; @import './system/theme-dark.less'; @import './layout-default/style/theme-dark.less'; diff --git a/packages/theme/theme-default.less b/packages/theme/theme-default.less index bd4d44ac3..6f1b505f3 100644 --- a/packages/theme/theme-default.less +++ b/packages/theme/theme-default.less @@ -1,3 +1,5 @@ +@root-entry-name: default; + @import 'ng-zorro-antd/src/style/themes/default.less'; @import './system/theme-default.less'; @import './layout-default/style/theme-default.less'; diff --git a/packages/theme/theme-variable.less b/packages/theme/theme-variable.less new file mode 100644 index 000000000..52d7b7bbf --- /dev/null +++ b/packages/theme/theme-variable.less @@ -0,0 +1,7 @@ +@root-entry-name: variable; + +@import 'ng-zorro-antd/src/style/themes/variable.less'; +@import './system/theme-variable.less'; +@import './layout-default/style/theme-variable.less'; +@import './layout-blank/style/theme-variable.less'; +@import '../abc/theme-variable.less'; diff --git a/packages/theme/variable.less b/packages/theme/variable.less new file mode 100644 index 000000000..04f73b921 --- /dev/null +++ b/packages/theme/variable.less @@ -0,0 +1,6 @@ +@import './theme-variable.less'; +@import './system/index.less'; +@import './layout-default/style/index.less'; +@import './layout-blank/style/index.less'; +@import '../abc/index.less'; +@import '../chart/index.less'; diff --git a/scripts/site/route-paths.txt b/scripts/site/route-paths.txt index c69046187..b0c53db26 100644 --- a/scripts/site/route-paths.txt +++ b/scripts/site/route-paths.txt @@ -21,6 +21,8 @@ /auth/set/zh /cache/getting-started/en /cache/getting-started/zh +/cache/interceptor/en +/cache/interceptor/zh /cache/service/en /cache/service/zh /chart/bar/en diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 293c2554f..445411c81 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -10,6 +10,7 @@ import { zhCN as dateLang } from 'date-fns/locale'; import { provideTinymce } from 'ngx-tinymce'; import { provideCellWidgets } from '@delon/abc/cell'; +import { ReuseTabMatchMode, provideReuseTabConfig } from '@delon/abc/reuse-tab'; import { provideSTWidgets } from '@delon/abc/st'; import { provideSFConfig } from '@delon/form'; import { withAutoCompleteWidget } from '@delon/form/widgets/autocomplete'; @@ -136,7 +137,7 @@ export const appConfig: ApplicationConfig = { { provide: ErrorHandler, useClass: CustomErrorHandler }, // Elements importProvidersFrom(ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })), - provideElements() - // provideReuseTabConfig({ max: 2 }) + provideElements(), + provideReuseTabConfig({ max: 2, mode: ReuseTabMatchMode.MenuForce }) ] }; diff --git a/src/styles.less b/src/styles.less index 94eeac144..70ada3438 100644 --- a/src/styles.less +++ b/src/styles.less @@ -1,3 +1,5 @@ +@import './styles/theme.less'; + // 全部引入 @import '../packages/theme/system/index.less'; @import '../packages/abc/index.less'; @@ -7,9 +9,5 @@ // docs @import 'ng-zorro-antd/resizable/style/entry.less'; @import './styles/index.less'; -@import './styles/theme.less'; .scrollbar-mixin(~'.ant-affix'); - -// 可以替换 dark, compact -// @import '../packages/theme/theme-dark.less'; diff --git a/src/styles/index.less b/src/styles/index.less index e054e4a96..2e03d6d53 100644 --- a/src/styles/index.less +++ b/src/styles/index.less @@ -1,4 +1,3 @@ -@import './theme.less'; @import './_colors.less'; @import './_reset.less'; @import './_common.less'; diff --git a/src/styles/theme.less b/src/styles/theme.less index 2b2a1d960..39c8e82de 100644 --- a/src/styles/theme.less +++ b/src/styles/theme.less @@ -1,4 +1,5 @@ -@import '../../packages/theme/theme-default.less'; +// 可以替换 dark, compact, variable +@import '../../packages/theme/theme-variable.less'; @site-heading-color: @heading-color; @site-text-color: @heading-color; From 118e63c1cd76e61fefb3e2e913442361da7474e6 Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 15 Mar 2024 16:57:44 +0800 Subject: [PATCH 2/6] ci: add variable css --- scripts/build/generate-css.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/generate-css.js b/scripts/build/generate-css.js index e7b0e11ea..af69a5438 100755 --- a/scripts/build/generate-css.js +++ b/scripts/build/generate-css.js @@ -33,7 +33,7 @@ async function genCss(name, min) { } function runCss(min) { - ['default', 'dark', 'compact'].forEach(async name => { + ['default', 'dark', 'compact', 'variable'].forEach(async name => { console.log(`开始生成 ${name} ${min ? 'min' : ''}版本`); await genCss(name, min); }); From 138d77e6f06d65ff56cc4fbabb41c6b2675f483d Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 15 Mar 2024 17:01:55 +0800 Subject: [PATCH 3/6] ci: fix --- scripts/build/copy-less.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build/copy-less.js b/scripts/build/copy-less.js index e221d7c93..e0ee6ff5a 100755 --- a/scripts/build/copy-less.js +++ b/scripts/build/copy-less.js @@ -10,7 +10,7 @@ function copyLess(name) { let sourcePath = path.join(root, `packages/${name}`); let targetPath = path.join(root, `dist/@delon/${name}`); // index.less - [`index.less`, `theme-default.less`, `theme-dark.less`, `theme-compact.less`] + [`index.less`, `theme-default.less`, `theme-dark.less`, `theme-compact.less`, `theme-variable.less`] .filter(fileName => fse.existsSync(`${sourcePath}/${fileName}`)) .forEach(fileName => { fse.copySync(`${sourcePath}/${fileName}`, `${targetPath}/${fileName}`); @@ -31,9 +31,11 @@ function copyTheme() { 'default.less', 'dark.less', 'compact.less', + 'variable.less', `theme-default.less`, `theme-dark.less`, `theme-compact.less`, + `theme-variable.less`, ].forEach(fileName => { fse.copySync(path.join(root, `packages/theme/${fileName}`), path.join(root, `dist/@delon/theme/${fileName}`)); }); From 5616ff65298a19303adda2a820c4fa56cab81e8f Mon Sep 17 00:00:00 2001 From: cipchk Date: Fri, 15 Mar 2024 17:55:25 +0800 Subject: [PATCH 4/6] ci: fix --- packages/abc/avatar-list/style/index.less | 1 - packages/abc/cell/style/index.less | 1 - packages/abc/down-file/style/index.less | 1 - packages/abc/ellipsis/style/index.less | 1 - packages/abc/error-collect/style/index.less | 1 - packages/abc/exception/style/index.less | 1 - packages/abc/footer-toolbar/style/index.less | 1 - packages/abc/full-content/style/index.less | 1 - packages/abc/global-footer/style/index.less | 1 - packages/abc/loading/style/index.less | 1 - packages/abc/notice-icon/style/index.less | 1 - packages/abc/onboarding/style/index.less | 1 - packages/abc/page-header/style/index.less | 1 - packages/abc/pdf/style/index.less | 1 - packages/abc/quick-menu/style/index.less | 1 - packages/abc/result/style/index.less | 1 - packages/abc/reuse-tab/style/index.less | 1 - packages/abc/se/style/index.less | 1 - packages/abc/st/style/index.less | 1 - packages/abc/sv/style/index.less | 6 ++---- packages/abc/tag-select/style/index.less | 1 - packages/chart/card/style/index.less | 1 - packages/chart/mini-progress/style/index.less | 1 - packages/chart/number-info/style/index.less | 1 - packages/chart/pie/style/index.less | 1 - packages/chart/radar/style/index.less | 1 - packages/chart/trend/style/index.less | 1 - packages/chart/water-wave/style/index.less | 1 - packages/theme/index.less | 3 +-- packages/theme/layout-blank/style/index.less | 1 - packages/theme/layout-default/style/index.less | 1 - packages/theme/mixins.less | 2 ++ packages/theme/system/index.less | 1 + packages/theme/system/theme-default.less | 3 +-- packages/theme/system/theme-variable.less | 2 ++ packages/theme/theme-compact.less | 3 +-- packages/theme/theme-dark.less | 3 +-- packages/theme/theme-default.less | 3 +-- packages/theme/theme-variable.less | 3 +-- scripts/build/copy-less.js | 1 + scripts/ci/build-artifacts.sh | 5 +++-- 41 files changed, 17 insertions(+), 47 deletions(-) create mode 100644 packages/theme/mixins.less diff --git a/packages/abc/avatar-list/style/index.less b/packages/abc/avatar-list/style/index.less index cab0c0547..b9fc6f35a 100644 --- a/packages/abc/avatar-list/style/index.less +++ b/packages/abc/avatar-list/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @avatar-list-prefix: ~'.avatar-list'; @{avatar-list-prefix} { diff --git a/packages/abc/cell/style/index.less b/packages/abc/cell/style/index.less index c2e350222..2d24748f2 100644 --- a/packages/abc/cell/style/index.less +++ b/packages/abc/cell/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @cell-prefix: ~'.cell'; @{cell-prefix} { diff --git a/packages/abc/down-file/style/index.less b/packages/abc/down-file/style/index.less index 15599ee5c..82cd17a82 100644 --- a/packages/abc/down-file/style/index.less +++ b/packages/abc/down-file/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @down-file-prefix: ~'.down-file'; @{down-file-prefix} { diff --git a/packages/abc/ellipsis/style/index.less b/packages/abc/ellipsis/style/index.less index d4465392b..5cdda6722 100644 --- a/packages/abc/ellipsis/style/index.less +++ b/packages/abc/ellipsis/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @ellipsis-prefix: ~'.ellipsis'; ellipsis { diff --git a/packages/abc/error-collect/style/index.less b/packages/abc/error-collect/style/index.less index acd7ab243..b9076ada7 100644 --- a/packages/abc/error-collect/style/index.less +++ b/packages/abc/error-collect/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @error-collect-prefix: ~'.error-collect'; @{error-collect-prefix} { diff --git a/packages/abc/exception/style/index.less b/packages/abc/exception/style/index.less index 693435ae2..2b16709c9 100644 --- a/packages/abc/exception/style/index.less +++ b/packages/abc/exception/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @exception-prefix: ~'.exception'; @{exception-prefix} { diff --git a/packages/abc/footer-toolbar/style/index.less b/packages/abc/footer-toolbar/style/index.less index bad754a6b..d85ed6427 100644 --- a/packages/abc/footer-toolbar/style/index.less +++ b/packages/abc/footer-toolbar/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @footer-toolbar-prefix: ~'.footer-toolbar'; @{footer-toolbar-prefix} { diff --git a/packages/abc/full-content/style/index.less b/packages/abc/full-content/style/index.less index 97327c502..992087d85 100644 --- a/packages/abc/full-content/style/index.less +++ b/packages/abc/full-content/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @full-content-prefix: ~'.full-content'; @{full-content-prefix} { diff --git a/packages/abc/global-footer/style/index.less b/packages/abc/global-footer/style/index.less index 50135979f..a74d9d85f 100644 --- a/packages/abc/global-footer/style/index.less +++ b/packages/abc/global-footer/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @global-footer-prefix: ~'.global-footer'; @{global-footer-prefix} { diff --git a/packages/abc/loading/style/index.less b/packages/abc/loading/style/index.less index ae005510d..ee322c5cc 100644 --- a/packages/abc/loading/style/index.less +++ b/packages/abc/loading/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @loading-prefix: ~'.loading'; @{loading-prefix} { diff --git a/packages/abc/notice-icon/style/index.less b/packages/abc/notice-icon/style/index.less index 4d8c28401..465ce9bda 100644 --- a/packages/abc/notice-icon/style/index.less +++ b/packages/abc/notice-icon/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @notice-icon-prefix: ~'.notice-icon'; @{notice-icon-prefix} { diff --git a/packages/abc/onboarding/style/index.less b/packages/abc/onboarding/style/index.less index d83ead4bb..7bcc4bef8 100644 --- a/packages/abc/onboarding/style/index.less +++ b/packages/abc/onboarding/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @onboarding-prefix: ~'.onboarding'; @{onboarding-prefix} { diff --git a/packages/abc/page-header/style/index.less b/packages/abc/page-header/style/index.less index ca91ed2f8..d2a6e4e28 100644 --- a/packages/abc/page-header/style/index.less +++ b/packages/abc/page-header/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @page-header-prefix: ~'.page-header'; @{page-header-prefix} { diff --git a/packages/abc/pdf/style/index.less b/packages/abc/pdf/style/index.less index 380e2c6e2..f328ad193 100644 --- a/packages/abc/pdf/style/index.less +++ b/packages/abc/pdf/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @pdf-prefix: ~'.pdf'; @{pdf-prefix} { diff --git a/packages/abc/quick-menu/style/index.less b/packages/abc/quick-menu/style/index.less index 76acd7cef..55af9701b 100644 --- a/packages/abc/quick-menu/style/index.less +++ b/packages/abc/quick-menu/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @quick-menu-prefix: ~'.quick-menu'; @{quick-menu-prefix} { diff --git a/packages/abc/result/style/index.less b/packages/abc/result/style/index.less index 6ce93e8a0..f313b4472 100644 --- a/packages/abc/result/style/index.less +++ b/packages/abc/result/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @result-prefix: ~'.result'; @{result-prefix} { diff --git a/packages/abc/reuse-tab/style/index.less b/packages/abc/reuse-tab/style/index.less index 9d40dbe46..aed523fb3 100644 --- a/packages/abc/reuse-tab/style/index.less +++ b/packages/abc/reuse-tab/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @reuse-tab-prefix: ~'.reuse-tab'; @{reuse-tab-prefix} { diff --git a/packages/abc/se/style/index.less b/packages/abc/se/style/index.less index 55b2112a8..63f8a0e23 100644 --- a/packages/abc/se/style/index.less +++ b/packages/abc/se/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @se-prefix: ~'.se'; @{se-prefix} { diff --git a/packages/abc/st/style/index.less b/packages/abc/st/style/index.less index 10190e43b..2006ae4ca 100644 --- a/packages/abc/st/style/index.less +++ b/packages/abc/st/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @st-prefix: ~'.st'; @{st-prefix} { diff --git a/packages/abc/sv/style/index.less b/packages/abc/sv/style/index.less index 6657868b6..4d9360d24 100644 --- a/packages/abc/sv/style/index.less +++ b/packages/abc/sv/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @sv-prefix: ~'.sv'; @{sv-prefix} { @@ -11,7 +10,7 @@ &__container { display: block; - // offset the padding-bottom of last row + /** offset the padding-bottom of last row */ .@{ant-prefix}-row { overflow: hidden; margin-bottom: -@sv-bottom; @@ -125,7 +124,7 @@ } &__small { - // offset the padding-bottom of last row + /** offset the padding-bottom of last row */ .@{ant-prefix}-row { margin-bottom: -8px; } @@ -157,7 +156,6 @@ } &-text { - // font-weight: 700;font-weight font-size: @sv-value-default-value-font-size; } diff --git a/packages/abc/tag-select/style/index.less b/packages/abc/tag-select/style/index.less index 886c13b99..e540a4172 100644 --- a/packages/abc/tag-select/style/index.less +++ b/packages/abc/tag-select/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @tag-select-prefix: ~'.tag-select'; @tag-select-height: @tag-line-height + 2px; // 2px is top & bottom border width diff --git a/packages/chart/card/style/index.less b/packages/chart/card/style/index.less index 9c58ed8dd..d038cf13c 100644 --- a/packages/chart/card/style/index.less +++ b/packages/chart/card/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @g2-card-prefix: ~'.g2-card'; @{g2-card-prefix} { diff --git a/packages/chart/mini-progress/style/index.less b/packages/chart/mini-progress/style/index.less index 55a3f217a..12fce5c44 100644 --- a/packages/chart/mini-progress/style/index.less +++ b/packages/chart/mini-progress/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @g2-mini-progress-prefix: ~'.g2-mini-progress'; @{g2-mini-progress-prefix} { diff --git a/packages/chart/number-info/style/index.less b/packages/chart/number-info/style/index.less index 793ad186f..5ab3a07eb 100644 --- a/packages/chart/number-info/style/index.less +++ b/packages/chart/number-info/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @number-info-prefix: ~'.number-info'; @{number-info-prefix} { diff --git a/packages/chart/pie/style/index.less b/packages/chart/pie/style/index.less index 2df059ac0..1a7de1684 100644 --- a/packages/chart/pie/style/index.less +++ b/packages/chart/pie/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @g2-pie-prefix: ~'.g2-pie'; @{g2-pie-prefix} { diff --git a/packages/chart/radar/style/index.less b/packages/chart/radar/style/index.less index de6d99097..abc0bc277 100644 --- a/packages/chart/radar/style/index.less +++ b/packages/chart/radar/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @g2-radar-prefix: ~'.g2-radar'; @{g2-radar-prefix} { diff --git a/packages/chart/trend/style/index.less b/packages/chart/trend/style/index.less index 32eeb4bcd..4c6bf7545 100644 --- a/packages/chart/trend/style/index.less +++ b/packages/chart/trend/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @trend-prefix: ~'.trend'; @{trend-prefix} { diff --git a/packages/chart/water-wave/style/index.less b/packages/chart/water-wave/style/index.less index 072e5eaa5..3f6fb0822 100644 --- a/packages/chart/water-wave/style/index.less +++ b/packages/chart/water-wave/style/index.less @@ -1,4 +1,3 @@ -@import '../../../theme/index.less'; @g2-water-wave-prefix: ~'.g2-water-wave'; @{g2-water-wave-prefix} { diff --git a/packages/theme/index.less b/packages/theme/index.less index a3d2c1102..f8a7cd7a3 100644 --- a/packages/theme/index.less +++ b/packages/theme/index.less @@ -1,2 +1 @@ -// @import './theme-default.less'; -@import './theme-@{root-entry-name}.less'; +@import './theme-default.less'; diff --git a/packages/theme/layout-blank/style/index.less b/packages/theme/layout-blank/style/index.less index 634cb25df..81b7e08bb 100644 --- a/packages/theme/layout-blank/style/index.less +++ b/packages/theme/layout-blank/style/index.less @@ -1,3 +1,2 @@ -@import './theme-@{root-entry-name}.less'; @import './_layout.less'; @import './fix/index.less'; diff --git a/packages/theme/layout-default/style/index.less b/packages/theme/layout-default/style/index.less index f41e781e8..2146f0b7c 100644 --- a/packages/theme/layout-default/style/index.less +++ b/packages/theme/layout-default/style/index.less @@ -1,4 +1,3 @@ -@import './theme-@{root-entry-name}.less'; // Layout @import './_layout.less'; @import './_header.less'; diff --git a/packages/theme/mixins.less b/packages/theme/mixins.less new file mode 100644 index 000000000..046e54cf1 --- /dev/null +++ b/packages/theme/mixins.less @@ -0,0 +1,2 @@ +@import 'ng-zorro-antd/src/style/mixins/index.less'; +@import './system/mixins/index.less'; diff --git a/packages/theme/system/index.less b/packages/theme/system/index.less index adc6c2523..239cfc156 100644 --- a/packages/theme/system/index.less +++ b/packages/theme/system/index.less @@ -5,4 +5,5 @@ @import 'ng-zorro-antd/components.less'; /** system */ +@import './mixins/index.less'; @import './entry.less'; diff --git a/packages/theme/system/theme-default.less b/packages/theme/system/theme-default.less index 8fe309fc4..7d09a9e20 100644 --- a/packages/theme/system/theme-default.less +++ b/packages/theme/system/theme-default.less @@ -1,5 +1,4 @@ -@import 'ng-zorro-antd/src/style/mixins/index.less'; -@import './mixins/index.less'; +@root-entry-name: default; // grey @grey-1: #ffffff; diff --git a/packages/theme/system/theme-variable.less b/packages/theme/system/theme-variable.less index 98a9abce3..ed473a3d4 100644 --- a/packages/theme/system/theme-variable.less +++ b/packages/theme/system/theme-variable.less @@ -1,5 +1,7 @@ @import './theme-default.less'; +@root-entry-name: variable; + @{html-selector} { --grey-1: #fff; --grey-2: #fafafa; diff --git a/packages/theme/theme-compact.less b/packages/theme/theme-compact.less index adeadcda7..3d86714bb 100644 --- a/packages/theme/theme-compact.less +++ b/packages/theme/theme-compact.less @@ -1,5 +1,4 @@ -@root-entry-name: compact; - +@import './mixins.less'; @import 'ng-zorro-antd/src/style/themes/compact.less'; @import './system/theme-compact.less'; @import './layout-default/style/theme-compact.less'; diff --git a/packages/theme/theme-dark.less b/packages/theme/theme-dark.less index 75006c2fb..f02d9dad0 100644 --- a/packages/theme/theme-dark.less +++ b/packages/theme/theme-dark.less @@ -1,5 +1,4 @@ -@root-entry-name: dark; - +@import './mixins.less'; @import 'ng-zorro-antd/src/style/themes/dark.less'; @import './system/theme-dark.less'; @import './layout-default/style/theme-dark.less'; diff --git a/packages/theme/theme-default.less b/packages/theme/theme-default.less index 6f1b505f3..627284fe4 100644 --- a/packages/theme/theme-default.less +++ b/packages/theme/theme-default.less @@ -1,5 +1,4 @@ -@root-entry-name: default; - +@import './mixins.less'; @import 'ng-zorro-antd/src/style/themes/default.less'; @import './system/theme-default.less'; @import './layout-default/style/theme-default.less'; diff --git a/packages/theme/theme-variable.less b/packages/theme/theme-variable.less index 52d7b7bbf..760bbd0c0 100644 --- a/packages/theme/theme-variable.less +++ b/packages/theme/theme-variable.less @@ -1,5 +1,4 @@ -@root-entry-name: variable; - +@import './mixins.less'; @import 'ng-zorro-antd/src/style/themes/variable.less'; @import './system/theme-variable.less'; @import './layout-default/style/theme-variable.less'; diff --git a/scripts/build/copy-less.js b/scripts/build/copy-less.js index e0ee6ff5a..8ac4df0b0 100755 --- a/scripts/build/copy-less.js +++ b/scripts/build/copy-less.js @@ -27,6 +27,7 @@ function copyLess(name) { function copyTheme() { [ 'system', + 'mixins.less', 'index.less', 'default.less', 'dark.less', diff --git a/scripts/ci/build-artifacts.sh b/scripts/ci/build-artifacts.sh index fa15ba763..a25c34026 100755 --- a/scripts/ci/build-artifacts.sh +++ b/scripts/ci/build-artifacts.sh @@ -92,8 +92,9 @@ echo "https://${ACCESS_TOKEN}:@github.com" > .git/credentials if [[ $(git ls-remote origin "refs/tags/${buildTagName}") ]]; then echo "removed tag because tag is already published" - # git push origin :refs/tags/${buildTagName} git push --delete origin ${buildTagName} + git push origin :refs/tags/${buildTagName} + sleep 5 fi echo "Git configuration has been updated to match the last commit author. Publishing now.." @@ -101,7 +102,7 @@ echo "Git configuration has been updated to match the last commit author. Publis git add -A git commit --allow-empty -m "${buildCommitMessage}" git tag "${buildTagName}" -git push origin ${branchName} --tags +git push origin ${branchName} --tags -f echo "Published package artifacts for ${packageName}#${buildVersionName} into ${branchName}" From 2388114bfb6dc49eeec438436d25ae6f01078907 Mon Sep 17 00:00:00 2001 From: cipchk Date: Tue, 2 Jul 2024 00:07:11 +0800 Subject: [PATCH 5/6] chore: fix site --- package.json | 2 +- .../components/footer/footer.component.ts | 69 +++---------------- 2 files changed, 11 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index c8b3d5abe..6767642fc 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "build_artifacts": "bash scripts/ci/build-artifacts.sh", "analyze": "npm run ng-high-memory build -- --source-map", "analyze:view": "source-map-explorer src/dist/browser/*.js", - "site:gen": "node scripts/site/main init && ng-alain-plugin-theme -t=themeCss && ng-alain-plugin-theme -t=colorLess", + "site:gen": "node scripts/site/main init && ng-alain-plugin-theme -t=themeCss", "site:build": "npm run site:gen && ng b site && npm run site:ngsw && npm run site:minify && npm run site:sitemap && npm run site:helper", "site:helper": "bash scripts/ci/helper.sh", "site:minify": "node scripts/build/minify.js", diff --git a/src/app/shared/components/footer/footer.component.ts b/src/app/shared/components/footer/footer.component.ts index 9abec10f1..9a7f55aa0 100644 --- a/src/app/shared/components/footer/footer.component.ts +++ b/src/app/shared/components/footer/footer.component.ts @@ -1,4 +1,3 @@ -import { Platform } from '@angular/cdk/platform'; import { NgStyle } from '@angular/common'; import { ChangeDetectionStrategy, @@ -6,18 +5,14 @@ import { Component, Input, NgZone, - OnInit, booleanAttribute, inject } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { LoadingService } from '@delon/abc/loading'; import { ALAIN_I18N_TOKEN, I18nPipe } from '@delon/theme'; import { copy } from '@delon/util/browser'; -import { LazyService } from '@delon/util/other'; import { NzColor, NzColorPickerModule } from 'ng-zorro-antd/color-picker'; -import type { NzSafeAny } from 'ng-zorro-antd/core/types'; import { NzGridModule } from 'ng-zorro-antd/grid'; import { NzIconService } from 'ng-zorro-antd/icon'; import { NzMessageService } from 'ng-zorro-antd/message'; @@ -34,15 +29,12 @@ import { NzMessageService } from 'ng-zorro-antd/message'; standalone: true, imports: [NzGridModule, NzColorPickerModule, NgStyle, I18nPipe, RouterLink] }) -export class FooterComponent implements OnInit { +export class FooterComponent { readonly i18n = inject(ALAIN_I18N_TOKEN); private readonly msg = inject(NzMessageService); - private readonly loading = inject(LoadingService); - private readonly lazy = inject(LazyService); private readonly iconSrv = inject(NzIconService); private readonly ngZone = inject(NgZone); private readonly cdr = inject(ChangeDetectorRef); - private readonly platform = inject(Platform); color = `#1890ff`; lessLoaded = false; @@ -53,56 +45,15 @@ export class FooterComponent implements OnInit { copy(value).then(() => this.msg.success(this.i18n.fanyi('app.demo.copied'))); } - ngOnInit(): void { - if (!this.platform.isBrowser) { - return; - } - this.initColor(); - } - - // region: color - initColor(): void { - const node = document.createElement('link'); - node.rel = 'stylesheet/less'; - node.type = 'text/css'; - node.href = '/assets/color.less'; - document.getElementsByTagName('head')[0].appendChild(node); - } - changeColor(res: { color: NzColor; format: string }): void { - const changeColor = (): void => { - this.ngZone.runOutsideAngular(() => { - const hex = res.color.toHexString(); - (window as NzSafeAny).less - .modifyVars({ - '@primary-color': hex - }) - .then(() => { - window.scrollTo(0, 0); - this.ngZone.run(() => { - this.color = hex; - this.iconSrv.twoToneColor.primaryColor = this.color; - this.msg.success(this.i18n.fanyi('app.footer.primary-color-changed')); - this.cdr.detectChanges(); - }); - this.loading.close(); - }); - }); - }; - - const lessUrl = 'https://cdnjs.cloudflare.com/ajax/libs/less.js/3.9.0/less.min.js'; - - this.loading.open({ text: 'Compiling....' }); - if (this.lessLoaded) { - changeColor(); - } else { - this.lazy.loadScript(lessUrl).then(() => { - this.lessLoaded = true; - (window as NzSafeAny).less.options.javascriptEnabled = true; - changeColor(); - }); - } + const hex = res.color.toHexString(); + window.scrollTo(0, 0); + document.documentElement.style.setProperty('--ant-primary-color', hex); + this.ngZone.run(() => { + this.color = hex; + this.iconSrv.twoToneColor.primaryColor = this.color; + this.msg.success(this.i18n.fanyi('app.footer.primary-color-changed')); + this.cdr.detectChanges(); + }); } - - // endregion } From 424418202040084d7399b5ed37f3e5f02f1c4678 Mon Sep 17 00:00:00 2001 From: cipchk Date: Tue, 2 Jul 2024 17:17:23 +0800 Subject: [PATCH 6/6] chore: fix --- packages/theme/layout-default/style/theme-default.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/theme/layout-default/style/theme-default.less b/packages/theme/layout-default/style/theme-default.less index 5ca6e0d60..f9db4029e 100644 --- a/packages/theme/layout-default/style/theme-default.less +++ b/packages/theme/layout-default/style/theme-default.less @@ -2,7 +2,7 @@ @alain-default-prefix: ~'.@{alain-default-name}'; @alain-default-zindex: @zindex-base; @alain-default-ease: cubic-bezier(0.25, 0, 0.15, 1); -@alain-default-header-hg: 64px; +@alain-default-header-hg: ~'var(--@{alain-default-name}-header-hg, 64px)'; @alain-default-header-bg: @primary-color; @alain-default-header-padding: @layout-gutter * 2; @alain-default-header-search-enabled: true;