Skip to content

Commit 334efea

Browse files
committed
Separate less variables
1 parent cc9ea77 commit 334efea

File tree

3 files changed

+95
-44
lines changed

3 files changed

+95
-44
lines changed

src/assets/less/checkbox.less

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,61 @@
1-
.vjs-checkbox {
1+
@import "./var.less";
2+
3+
.@{css-prefix}-checkbox {
4+
position: absolute;
5+
left: -@selectabl-span;
26
color: #1f2d3d;
37
user-select: none;
4-
.vjs-checkbox__input {
5-
outline: 0;
6-
line-height: 1;
7-
vertical-align: middle;
8-
cursor: pointer;
9-
display: inline-block;
10-
position: relative;
11-
white-space: nowrap;
12-
&.is-checked .vjs-checkbox__inner {
13-
background-color: #20a0ff;
14-
border-color: #0190fe;
15-
&:after {
16-
transform: rotate(45deg) scaleY(1);
17-
}
8+
9+
&.is-checked .@{css-prefix}-checkbox__inner {
10+
background-color: @color-primary;
11+
border-color: darken(@color-primary, 10%);
12+
13+
&:after {
14+
transform: rotate(45deg) scaleY(1);
1815
}
1916
}
20-
.vjs-checkbox__inner {
17+
18+
.@{css-prefix}-checkbox__inner {
2119
display: inline-block;
2220
position: relative;
23-
border: 1px solid #bfcbd9;
24-
border-radius: 4px;
21+
border: 1px solid @border-color;
22+
border-radius: 2px;
23+
vertical-align: middle;
2524
box-sizing: border-box;
26-
width: 18px;
27-
height: 18px;
25+
width: 16px;
26+
height: 16px;
2827
background-color: #fff;
2928
z-index: 1;
30-
transition: border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);
29+
cursor: pointer;
30+
transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46),
31+
background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
32+
3133
&:after {
3234
box-sizing: content-box;
3335
content: "";
3436
border: 2px solid #fff;
3537
border-left: 0;
3638
border-top: 0;
3739
height: 8px;
38-
left: 5px;
40+
left: 4px;
3941
position: absolute;
4042
top: 1px;
4143
transform: rotate(45deg) scaleY(0);
4244
width: 4px;
43-
transition: transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;
45+
transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;
4446
transform-origin: center;
4547
}
4648
}
47-
.vjs-checkbox__original {
49+
50+
.@{css-prefix}-checkbox__original {
4851
opacity: 0;
49-
outline: 0;
52+
outline: none;
5053
position: absolute;
54+
z-index: -1;
55+
top: 0;
56+
left: 0;
57+
right: 0;
58+
bottom: 0;
5159
margin: 0;
52-
width: 0;
53-
height: 0;
54-
left: -999px;
5560
}
5661
}

src/assets/less/tree.less

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,53 @@
1-
@content-padding: 1em; /* 树内容区域缩进2个英文字符, 此处1em为1个中文字符=2个英文字符 */
1+
@import "./var.less";
22

3-
.vjs__tree {
3+
/* 树内容区域缩进2个英文字符, 此处1em为1个中文字符=2个英文字符 */
4+
@content-padding: 1em;
5+
6+
.mixin-value-style(@color) {
7+
color: @color;
8+
}
9+
10+
.@{css-prefix}-tree {
411
font-family: "Monaco", "Menlo", "Consolas", "Bitstream Vera Sans Mono", monospace;
512
font-size: 14px;
6-
.vjs__tree__content {
13+
14+
&.is-root {
15+
position: relative;
16+
17+
&.has-selectable-control {
18+
margin-left: @selectabl-span;
19+
}
20+
}
21+
22+
&.is-mouseover {
23+
background-color: @highlight-bg-color;
24+
}
25+
26+
.@{css-prefix}-tree__content {
727
padding-left: @content-padding;
8-
border-left: 1px dotted #ccc;
28+
border-left: 1px dotted @border-color;
929
}
10-
.vjs__tree__node {
30+
31+
.@{css-prefix}-tree__brackets {
1132
cursor: pointer;
1233
&:hover {
13-
color: #20a0ff;
34+
color: @color-primary;
1435
}
1536
}
16-
.vjs-checkbox {
17-
position: absolute;
18-
left: -30px;
37+
38+
.@{css-prefix}-value__null {
39+
.mixin-value-style(@color-null);
1940
}
20-
.vjs__value__null {
21-
color: #ff4949;
41+
42+
.@{css-prefix}-value__number {
43+
.mixin-value-style(@color-number);
2244
}
23-
.vjs__value__number,
24-
.vjs__value__boolean {
25-
color: #1d8ce0;
45+
46+
.@{css-prefix}-value__boolean {
47+
.mixin-value-style(@color-boolean);
2648
}
27-
.vjs__value__string {
28-
color: #13ce66;
49+
50+
.@{css-prefix}-value__string {
51+
.mixin-value-style(@color-string);
2952
}
3053
}

src/assets/less/var.less

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* css scope */
2+
@css-prefix: vjs;
3+
4+
/* theme color */
5+
@color-primary: #20a0ff;
6+
@color-info: #1d8ce0;
7+
@color-error: #ff4949;
8+
@color-success: #13ce66;
9+
10+
/* field values color */
11+
@color-string: @color-success;
12+
@color-number: @color-info;
13+
@color-boolean: @color-info;
14+
@color-null: @color-error;
15+
16+
/* highlight */
17+
@highlight-bg-color: #eee;
18+
19+
/* common border-color */
20+
@border-color: #bfcbd9;
21+
22+
/* 左侧可选区域占用空间 */
23+
@selectabl-span: 30px;

0 commit comments

Comments
 (0)