调整规范

master
yutent 2023-08-03 15:47:02 +08:00
parent 1915f69485
commit 1e9264c452
25 changed files with 72 additions and 40 deletions

View File

@ -84,7 +84,7 @@ class Avatar extends Component {
width: map.get($v, 'h'); width: map.get($v, 'h');
height: map.get($v, 'h'); height: map.get($v, 'h');
font-size: map.get($v, 'f'); font-size: map.get($v, 'f');
--size: #{map.get($v, 'h') - 8px}; --wc-icon-size: #{map.get($v, 'h') - 8px};
} }
} }
` `

View File

@ -80,7 +80,7 @@ class Code extends Component {
} }
.act { .act {
--size: 18px; --wc-icon-size: 18px;
margin: 0 6px; margin: 0 6px;
color: var(--color-grey-2); color: var(--color-grey-2);
cursor: pointer; cursor: pointer;

View File

@ -95,7 +95,7 @@ class CollapseItem extends Component {
wc-icon { wc-icon {
margin: 0 8px; margin: 0 8px;
--size: 12px; --wc-icon-size: 12px;
color: #636465; color: #636465;
transform: rotate(0); transform: rotate(0);
transition: transform 0.2s ease-in-out; transition: transform 0.2s ease-in-out;

View File

@ -84,7 +84,7 @@ class Drawer extends Component {
user-select: none; user-select: none;
wc-icon { wc-icon {
--size: 16px; --wc-icon-size: 16px;
margin-right: 8px; margin-right: 8px;
color: var(--color-grey-3); color: var(--color-grey-3);
cursor: pointer; cursor: pointer;

View File

@ -38,7 +38,7 @@ class Dropdown extends Component {
padding: 0 8px; padding: 0 8px;
.arrow { .arrow {
--size: 12px; --wc-icon-size: 12px;
margin-left: 6px; margin-left: 6px;
transform: rotate(-90deg); transform: rotate(-90deg);
} }

View File

@ -51,7 +51,7 @@ class Button extends Component {
width: 100%; width: 100%;
min-width: 1px; min-width: 1px;
height: inherit; height: inherit;
padding: var(--button-padding, 0 4px); padding: var(--wc-button-padding, 0 4px);
line-height: 1; line-height: 1;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: inherit; border-radius: inherit;
@ -71,7 +71,7 @@ class Button extends Component {
.icon { .icon {
margin-right: 4px; margin-right: 4px;
--size: var(--icon-size, 14px); --wc-icon-size: var(--wc-button-icon-size, 14px);
} }
} }
:host(:focus-within) { :host(:focus-within) {
@ -121,7 +121,7 @@ class Button extends Component {
font-size: map.get($v, 'f'); font-size: map.get($v, 'f');
.icon { .icon {
--size: var(--icon-size, #{map.get($v, 'f')}); --wc-icon-size: var(--wc-button-icon-size, #{map.get($v, 'f')});
} }
} }
:host([size='#{$s}'][circle]) { :host([size='#{$s}'][circle]) {

View File

@ -105,7 +105,7 @@ class Input extends Component {
} }
/* ----- */ /* ----- */
.close { .close {
--size: 18px; --wc-icon-size: 18px;
margin: 0 8px 0 4px; margin: 0 8px 0 4px;
padding: 4px; padding: 4px;
border-radius: 50%; border-radius: 50%;
@ -118,7 +118,7 @@ class Input extends Component {
} }
} }
.icon { .icon {
--size: 16px; --wc-icon-size: 16px;
margin: 0 8px 0 4px; margin: 0 8px 0 4px;
color: var(--color-grey-2); color: var(--color-grey-2);
} }
@ -192,7 +192,7 @@ class Input extends Component {
} }
.icon { .icon {
--size: 24px; --wc-icon-size: 24px;
margin: 0 20px 0 4px; margin: 0 20px 0 4px;
} }
} }
@ -231,7 +231,7 @@ class Input extends Component {
font-size: 12px; font-size: 12px;
} }
.icon { .icon {
--size: 14px; --wc-icon-size: 14px;
} }
.prepend, .prepend,
.append { .append {
@ -311,11 +311,11 @@ class Input extends Component {
font-size: map.get($v, 'f'); font-size: map.get($v, 'f');
} }
.icon { .icon {
--size: #{map.get($v, 'f')}; --wc-icon-size: #{map.get($v, 'f')};
} }
@if $s == 'xxxl' { @if $s == 'xxxl' {
.icon { .icon {
--size: 22px; --wc-icon-size: 22px;
margin: 0 12px 0 4px; margin: 0 12px 0 4px;
} }
} }

View File

@ -141,7 +141,7 @@ class WcNumber extends Component {
font-size: map.get($v, 'f'); font-size: map.get($v, 'f');
.icon { .icon {
--size: #{map.get($v, 'f')}; --wc-icon-size: #{map.get($v, 'f')};
} }
} }
:host([size='#{$s}'][circle]) { :host([size='#{$s}'][circle]) {

View File

@ -78,7 +78,7 @@ class Passwd extends Component {
css` css`
.label { .label {
.icon { .icon {
--size: 16px; --wc-icon-size: 16px;
margin: 0 8px 0 4px; margin: 0 8px 0 4px;
color: var(--color-grey-2); color: var(--color-grey-2);
cursor: pointer; cursor: pointer;
@ -120,7 +120,7 @@ class Passwd extends Component {
@if $s == 'xxl' { @if $s == 'xxl' {
.icon { .icon {
--size: 18px; --wc-icon-size: 18px;
} }
} }
@ -129,7 +129,7 @@ class Passwd extends Component {
padding: 0 6px 0 10px; padding: 0 6px 0 10px;
} }
.icon { .icon {
--size: 22px; --wc-icon-size: 22px;
margin: 0 12px 0 4px; margin: 0 12px 0 4px;
} }
} }

View File

@ -25,7 +25,7 @@ class Select extends Component {
static styles = css` static styles = css`
.icon { .icon {
margin-right: 10px; margin-right: 10px;
--size: 14px; --wc-icon-size: 14px;
line-height: 100%; line-height: 100%;
transform: rotate(90deg); transform: rotate(90deg);
transition: transform 0.2s ease-in-out; transition: transform 0.2s ease-in-out;

View File

@ -22,7 +22,7 @@ class Star extends Component {
:host { :host {
display: flex; display: flex;
font-size: 14px; font-size: 14px;
--size: 32px; --wc-icon-size: 32px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
@ -83,7 +83,7 @@ class Star extends Component {
@loop $s, $v in $sizes { @loop $s, $v in $sizes {
:host([size='#{$s}']) { :host([size='#{$s}']) {
--size: #{map.get($v, 'h')}; --wc-icon-size: #{map.get($v, 'h')};
font-size: map.get($v, 'f'); font-size: map.get($v, 'f');
} }
} }

View File

@ -29,8 +29,8 @@ class Icon extends Component {
static styles = css` static styles = css`
:host { :host {
display: inline-flex; display: inline-flex;
width: var(--size, 32px); width: var(--wc-icon-size, 32px);
height: var(--size, 32px); height: var(--wc-icon-size, 32px);
} }
:host(:not([name])) { :host(:not([name])) {
display: none; display: none;

View File

@ -66,7 +66,7 @@ class ImagePreview extends Component {
background-color: #606266; background-color: #606266;
border-color: #fff; border-color: #fff;
border-radius: 50%; border-radius: 50%;
--size: 22px; --wc-icon-size: 22px;
} }
.left, .left,
.right { .right {
@ -98,7 +98,7 @@ class ImagePreview extends Component {
color: #e5e5e5; color: #e5e5e5;
border-radius: 22px; border-radius: 22px;
transform: translateX(-50%); transform: translateX(-50%);
--size: 22px; --wc-icon-size: 22px;
wc-icon { wc-icon {
cursor: pointer; cursor: pointer;
} }

View File

@ -106,7 +106,7 @@ class Layer extends Component {
color: var(--color-dark-2); color: var(--color-dark-2);
wc-icon { wc-icon {
--size: 14px; --wc-icon-size: 14px;
&:hover { &:hover {
color: var(--color-red-1); color: var(--color-red-1);
@ -139,7 +139,7 @@ class Layer extends Component {
border-radius: 3px; border-radius: 3px;
font-weight: normal; font-weight: normal;
text-indent: 8px; text-indent: 8px;
--size: 16px; --wc-icon-size: 16px;
color: var(--color-dark-1); color: var(--color-dark-1);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
} }

View File

@ -108,7 +108,7 @@ class Notify extends Component {
line-height: 2; line-height: 2;
wc-icon { wc-icon {
--size: 14px; --wc-icon-size: 14px;
cursor: pointer; cursor: pointer;
} }
} }

View File

@ -64,7 +64,7 @@ class OptionGroup extends Component {
color: var(--color-grey-2); color: var(--color-grey-2);
.ico { .ico {
--size: 12px; --wc-icon-size: 12px;
} }
} }
@ -133,7 +133,7 @@ class Option extends Component {
color: var(--color-dark-1); color: var(--color-dark-1);
.ico { .ico {
--size: 12px; --wc-icon-size: 12px;
color: var(--color-grey-2); color: var(--color-grey-2);
} }
.name { .name {

View File

@ -99,7 +99,7 @@ class Popconfirm extends Component {
white-space: nowrap; white-space: nowrap;
wc-icon { wc-icon {
margin-right: 5px; margin-right: 5px;
--size: 14px; --wc-icon-size: 14px;
} }
} }

View File

@ -39,7 +39,7 @@ class Result extends Component {
} }
} }
:host([type='error']) .icon { :host([type='error']) .icon {
--size: 24px; --wc-icon-size: 24px;
background: #f56c6c; background: #f56c6c;
} }
:host([type='info']) .icon { :host([type='info']) .icon {

View File

@ -70,7 +70,7 @@ class Sandbox extends Component {
border-right: 1px solid var(--color-plain-3); border-right: 1px solid var(--color-plain-3);
border-bottom: 1px solid var(--color-plain-3); border-bottom: 1px solid var(--color-plain-3);
background: var(--color-plain-1); background: var(--color-plain-1);
--size: 16px; --wc-icon-size: 16px;
cursor: pointer; cursor: pointer;
&:hover:not([disabled]), &:hover:not([disabled]),

View File

@ -122,11 +122,11 @@ class Step extends Component {
height: 26px; height: 26px;
border: 1px solid var(--color-grey-1); border: 1px solid var(--color-grey-1);
border-radius: 50%; border-radius: 50%;
--size: 14px; --wc-icon-size: 14px;
&.custom { &.custom {
border: 0; border: 0;
--size: 26px; --wc-icon-size: 26px;
} }
} }
.group { .group {

View File

@ -131,7 +131,7 @@ class Swipe extends Component {
background-color: #606266; background-color: #606266;
border-color: #fff; border-color: #fff;
border-radius: 50%; border-radius: 50%;
--size: 12px; --wc-icon-size: 12px;
transition: opacity ease-in-out 0.2s; transition: opacity ease-in-out 0.2s;
&:hover { &:hover {
opacity: 1 !important; opacity: 1 !important;

View File

@ -65,7 +65,7 @@ class Tabs extends Component {
max-width: 120px; max-width: 120px;
margin: 0 16px; margin: 0 16px;
padding: 0 6px; padding: 0 6px;
--size: 16px; --wc-icon-size: 16px;
cursor: pointer; cursor: pointer;
[slot='label'] { [slot='label'] {

View File

@ -100,7 +100,7 @@ class Tag extends Component {
line-height: calc(map.get($v, 'h') - 2px); line-height: calc(map.get($v, 'h') - 2px);
} }
.close-btn { .close-btn {
--size: 10px; --wc-icon-size: 10px;
transform: scale(map.get($v, 's')); transform: scale(map.get($v, 's'));
} }
} }

View File

@ -109,7 +109,7 @@ class Item extends Component {
border-radius: 50%; border-radius: 50%;
background: var(--color-grey-1); background: var(--color-grey-1);
color: #fff; color: #fff;
--size: 14px; --wc-icon-size: 14px;
} }
.group { .group {
flex: 1; flex: 1;

View File

@ -23,3 +23,35 @@
4. 自带点击事件的组件, 统一增加"节流/防抖"逻辑 4. 自带点击事件的组件, 统一增加"节流/防抖"逻辑
> 统一为增加 `lazy="1000"` 属性实现 > 统一为增加 `lazy="1000"` 属性实现
5. 暗色主题
各组件, 需要适配暗色主题。
```css
@media (prefers-color-scheme: dark) {
// ...
}
```
6. 组件的额外自定义样式, 尽量使用css变量来做穿透
各组件的穿透样式变量名, 需要带命名空间
```css
// 外部定义
...
--wc-button-border-color: #f30;
...
// 内部实现
button {
...
border: 1px solid var(--wc-button-border-color, var(--color-plain-1));
// or
border: 1px solid var(--wc-button-border-color, #f2f5fc);
...
}
```