-
Notifications
You must be signed in to change notification settings - Fork 0
/
_txt.scss
executable file
·171 lines (166 loc) · 5.02 KB
/
_txt.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@mixin txt($txt){
$keys:(
i:text-indent,a:text-align,h:line-height,v:vertical-align,
f:font-family,p:font-size,
t:letter-spacing,ls:letter-spacing,c:color,
w:font-weight,fw:font-weight,fs:font-style,
tds:text-decoration-style,tdl:text-decoration-line,
tdc:text-decoration-color,tdt:text-decoration-thickness,
to:text-orientation,
ts:(-webkit-text-stroke,text-stroke),
o:text-overflow,
uo:text-underline-offset,
l:list-style,
whs:white-space,wds:word-spacing,wb:word-break,b:word-break,ffs:font-feature-settings
);
$avals:(l:left,r:right,c:center,j:justify,n:nowrap,wc:-webkit-center);
$akeys:(l:a,r:a,c:a,j:a,n:whs,wc:a);
$bvals:(k:keep-all,b:break-all,n:normal);
$vvals:(t:top,m:middle,b:bottom,l:baseline);
$svals:(r:normal,b:bold,l:lighter,i:italic,n:none,u:underline,o:overline,s:line-through);
$skeys:(r:fw,b:fw,l:fw,i:fs,n:td,u:td,o:td,s:td);
$lvals:(n:none,ds:disc,cr:circle,sq:square,alp:upper-alpha,dec:decimal,rom:upper-roman,hira:hiragana);
$mvals:(h:horizontal-tb,vr:vertical-rl,vl:vertical-lr);
$tovals:(m:mixed,s:sideway,u:upright);
$ovals:(c:clip,e:ellipsis);
$whsvals:(n:normal,nw:nowrap,p:pre,pw:pre-wrap,pl:pre-line,bs:break-space);
$ffsvals:(p:"palt",t:"trad",n:"nalt");
@each $key,$val in $txt{
@if $key == p or $key == h or $key == uo{$val:cp_get_size_value($val);}
@if $key == c{$val:cp_get_color($val);}
@if $key == f{$val:cp_get_font($val);}
@if $key == b{$val:replace_values($val,$bvals);}
@if $key == a{$key:replace_values($val,$akeys);$val:replace_values($val,$avals);}
@if $key == v{$val:replace_values($val,$vvals);}
@if $key == s{$key:replace_values($val,$skeys);$val:replace_values($val,$svals);}
@if $key == l{$val:replace_values($val,$lvals);}
@if $key == w{$val:wt($val);}
@if $key == m{@include writing-mode(replace_values($val,$mvals));}
@if $key == t{$val:cp_get_size_value($val);}
@if $key == to{$val:replace_values($val,$tovals);}
@if $key == td{@include text_decoration($val);}
@if $key == te{@include text_emphasis($val);}
@if $key == o{$val:replace_values($val,$ovals);}
@if $key == whs{$val:replace_values($val,$whsvals);}
@if $key == ffs{$val:replace_values($val,$ffsvals);}
@if map-has-key($keys,$key){
@if type-of(map-get($keys,$key)) == 'list'{
@each $sel in map-get($keys,$key){
#{$sel}:$val;
}
}
@else{
#{map-get($keys,$key)}:$val;
}
}
}
}
@mixin plh($txt){
&:placeholder{
@include txt($txt);
}
&::-webkit-input-placeholder{
@include txt($txt);
}
&:-ms-input-placeholder{
@include txt($txt);
}
&::-moz-placeholder{
@include txt($txt);
}
}
@mixin link-colors($args...){
&:normal{color:nth($args,1);}
&:hover{color:nth($args,2);}
&:active{color:nth($args,3);}
&:visited{color:nth($args,4);}
&:focus{color:nth($args,5);}
}
@mixin writing-mode($mode){
-webkit-writing-mode:$mode;
-moz-writing-mode:$mode;
-ms-writing-mode:$mode;
-o-writing-mode:$mode;
writing-mode:$mode;
}
@mixin text_decoration($vals){
$tvals:(n:none);
$lvals:(u:underline,o:overline,t:line-through);
$svals:(s:solid,d:dotted,ds:dashed,w:double,r:ridge,g:groove,i:inset,o:outset);
$countNumberValue:0;
@each $val in $vals{
@if map-has-key($tvals,$val){
text-decoration:map-get($tvals,$val);
}
@else if index(map-values($tvals),$val) != null{
text-decoration:$val;
}
@else if map-has-key($lvals,$val){
text-decoration-line:map-get($lvals,$val);
}
@else if index(map-values($lvals),$val) != null{
text-decoration-line:$val;
}
@else if map-has-key($svals,$val){
text-decoration-style:map-get($svals,$val);
}
@else if index(map-values($svals),$val) != null{
text-decoration-style:$val;
}
@else if type-of($val) == 'number'{
@if $countNumberValue == 0{
text-decoration-thickness:sz($val);
}
@else if $countNumberValue == 1 {
text-underline-offset:sz($val);
}
$countNumberValue:$countNumberValue + 1;
}
@else{
text-decoration-color:clr($val);
}
}
}
@mixin text_emphasis($vals){
$tvals:(n:none);
$s1vals:(f:filled,o:open);
$s2vals:(d:dot,c:circle,dc:double-circle,t:triangle,s:sesami);
$s1:false;
$s2:false;
$s:();
@each $val in $vals{
@if(is_quoted($val)){
$s1:true;
$s2:true;
$s:append($s,$val);
}
@else if ($s1 == false and map-has-key($s1vals,$val)){
$s1:true;
$s:append($s,map-get($s1vals,$val));
}
@else if ($s1 == false and index(map-values($s1vals),$val) != null){
$s1:true;
$s:append($s,$val);
}
@else if ($s2 == false and map-has-key($s2vals,$val)){
$s2:true;
$s:append($s,map-get($s2vals,$val));
}
@else if ($s2 == false and index(map-values($s2vals),$val) != null){
$s2:true;
$s:append($s,$val);
}
@else{
text-emphasis-color:clr($val);
}
}
text-emphasis-style:$s;
}
@mixin text_style($size:12px,$color:#888,$weight:normal,$font:inherit,$style:inherit,$decoration:inherit){
font-size:$size;color:$color;font-weight:$weight;font-style:$style;text-decoration:$decoration;font-family:$font;
}
@mixin text_combine(){
-webkit-text-combine: horizontal;
-ms-text-combine-horizontal: all;
text-combine-upright: all;
}