Skip to content

Commit

Permalink
feat(theme): support css variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Mar 15, 2024
1 parent f3b3325 commit 29d7cac
Show file tree
Hide file tree
Showing 53 changed files with 138 additions and 90 deletions.
2 changes: 1 addition & 1 deletion packages/abc/avatar-list/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@avatar-list-prefix: ~'.avatar-list';

@{avatar-list-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/cell/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@cell-prefix: ~'.cell';

@{cell-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/down-file/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@down-file-prefix: ~'.down-file';

@{down-file-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/ellipsis/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@ellipsis-prefix: ~'.ellipsis';

ellipsis {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/error-collect/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@error-collect-prefix: ~'.error-collect';

@{error-collect-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/exception/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@exception-prefix: ~'.exception';

@{exception-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/footer-toolbar/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@footer-toolbar-prefix: ~'.footer-toolbar';

@{footer-toolbar-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/full-content/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@full-content-prefix: ~'.full-content';

@{full-content-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/global-footer/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@global-footer-prefix: ~'.global-footer';

@{global-footer-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/loading/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@loading-prefix: ~'.loading';

@{loading-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/notice-icon/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@notice-icon-prefix: ~'.notice-icon';

@{notice-icon-prefix} {
Expand Down
4 changes: 1 addition & 3 deletions packages/abc/onboarding/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@onboarding-prefix: ~'.onboarding';

@{onboarding-prefix} {
Expand All @@ -10,7 +10,6 @@
position: fixed;
z-index: @onboarding-zindex - 1;
inset: 0;
opacity: @onboarding-mask-opacity;
background-color: @onboarding-mask-background-color;
}

Expand All @@ -26,7 +25,6 @@
animation: @onboarding-light-ant;

&-el {
// position: relative;
z-index: @onboarding-zindex + 1 !important;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/abc/page-header/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@page-header-prefix: ~'.page-header';

@{page-header-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/pdf/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@pdf-prefix: ~'.pdf';

@{pdf-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/quick-menu/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@quick-menu-prefix: ~'.quick-menu';

@{quick-menu-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/result/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@result-prefix: ~'.result';

@{result-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/reuse-tab/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@reuse-tab-prefix: ~'.reuse-tab';

@{reuse-tab-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/se/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@se-prefix: ~'.se';

@{se-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/st/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@st-prefix: ~'.st';

@{st-prefix} {
Expand Down
7 changes: 3 additions & 4 deletions packages/abc/sv/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@sv-prefix: ~'.sv';

@{sv-prefix} {
Expand Down Expand Up @@ -51,7 +51,6 @@

&__label {
display: table-cell;
// margin-right: 8px;
padding-bottom: @sv-bottom;
line-height: 22px;
color: @sv-label-color;
Expand Down Expand Up @@ -81,7 +80,7 @@
}

&__detail {
// contents 对 ie, edge 不支持,但对于子组件的支持会更友好
/** contents 对 ie, edge 不支持,但对于子组件的支持会更友好 */
display: table-cell;
width: 100%;
padding-bottom: @sv-bottom;
Expand Down Expand Up @@ -158,7 +157,7 @@
}

&-text {
// font-weight: 700;
// font-weight: 700;font-weight
font-size: @sv-value-default-value-font-size;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/abc/tag-select/style/index.less
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion packages/abc/theme-dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
19 changes: 9 additions & 10 deletions packages/abc/theme-default.less
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// 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;
@st-no-column-height: 100px;

// 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;
Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/abc/theme-variable.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './theme-default.less';
2 changes: 1 addition & 1 deletion packages/chart/card/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@g2-card-prefix: ~'.g2-card';

@{g2-card-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/mini-progress/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@g2-mini-progress-prefix: ~'.g2-mini-progress';

@{g2-mini-progress-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/number-info/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@number-info-prefix: ~'.number-info';

@{number-info-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/pie/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@g2-pie-prefix: ~'.g2-pie';

@{g2-pie-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/radar/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@g2-radar-prefix: ~'.g2-radar';

@{g2-radar-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/trend/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@trend-prefix: ~'.trend';

@{trend-prefix} {
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/water-wave/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../theme/theme-default.less';
@import '../../../theme/index.less';
@g2-water-wave-prefix: ~'.g2-water-wave';

@{g2-water-wave-prefix} {
Expand Down
3 changes: 2 additions & 1 deletion packages/theme/index.less
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import './theme-default.less';
// @import './theme-default.less';
@import './theme-@{root-entry-name}.less';
2 changes: 1 addition & 1 deletion packages/theme/layout-blank/style/index.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import './theme-default.less';
@import './theme-@{root-entry-name}.less';
@import './_layout.less';
@import './fix/index.less';
7 changes: 5 additions & 2 deletions packages/theme/layout-blank/style/theme-default.less
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions packages/theme/layout-blank/style/theme-variable.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './theme-default.less';
2 changes: 1 addition & 1 deletion packages/theme/layout-default/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import './theme-default.less';
@import './theme-@{root-entry-name}.less';
// Layout
@import './_layout.less';
@import './_header.less';
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/layout-default/style/theme-dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -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})';
13 changes: 7 additions & 6 deletions packages/theme/layout-default/style/theme-default.less
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
1 change: 1 addition & 0 deletions packages/theme/layout-default/style/theme-variable.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './theme-default.less';
2 changes: 0 additions & 2 deletions packages/theme/system/entry.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import './theme-default.less';

// Angular
@import './ng/index.less';

Expand Down
8 changes: 5 additions & 3 deletions packages/theme/system/index.less
Original file line number Diff line number Diff line change
@@ -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';
Loading

0 comments on commit 29d7cac

Please sign in to comment.