@flourish/ui-styles 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
show_if: border_styles_advanced
|
|
28
28
|
- property: border_color
|
|
29
29
|
name: Color
|
|
30
|
+
type: color
|
|
31
|
+
width: quarter
|
|
32
|
+
min: 0
|
|
33
|
+
show_if: border_styles_advanced
|
|
34
|
+
- property: border_transparency
|
|
35
|
+
name: Transparency
|
|
30
36
|
type: number
|
|
31
37
|
width: quarter
|
|
32
38
|
min: 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flourish/ui-styles",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Flourish module for styling UI elements",
|
|
5
5
|
"main": "ui-styles.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"author": "Kiln Enterprises Ltd",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@flourish/pocket-knife": "^0.5.0",
|
|
17
18
|
"d3-selection": "^1.4.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hexToRgba } from "@flourish/pocket-knife";
|
|
1
2
|
import Stylesheet from "../lib/js2css";
|
|
2
3
|
|
|
3
4
|
var DEFAULTS = Object.freeze({
|
|
@@ -8,7 +9,8 @@ var DEFAULTS = Object.freeze({
|
|
|
8
9
|
font_color_selected: "#ffffff",
|
|
9
10
|
|
|
10
11
|
border_width: 1,
|
|
11
|
-
|
|
12
|
+
border_transparency: 0.25,
|
|
13
|
+
border_color: "#000000",
|
|
12
14
|
border_radius: 3
|
|
13
15
|
});
|
|
14
16
|
|
|
@@ -31,6 +33,8 @@ ButtonStyle.prototype._createStylesheet = function() {
|
|
|
31
33
|
ButtonStyle.prototype.update = function() {
|
|
32
34
|
this._styles.clear();
|
|
33
35
|
|
|
36
|
+
var border_color = hexToRgba(this._state.border_color, this._state.border_transparency);
|
|
37
|
+
|
|
34
38
|
this._styles.select(this._selector + ".hidden")
|
|
35
39
|
.style("display", "none");
|
|
36
40
|
|
|
@@ -44,7 +48,7 @@ ButtonStyle.prototype.update = function() {
|
|
|
44
48
|
.style("margin", "0 2px 0 0")
|
|
45
49
|
.style("background-color", this._state.background)
|
|
46
50
|
.style("color", this._state.font_color)
|
|
47
|
-
.style("border", this._state.border_width + "px solid
|
|
51
|
+
.style("border", this._state.border_width + "px solid " + border_color)
|
|
48
52
|
.style("border-radius", this._state.border_radius + "px");
|
|
49
53
|
|
|
50
54
|
this._styles.select(this._selector + " .button.selected")
|
|
@@ -61,7 +65,7 @@ ButtonStyle.prototype.update = function() {
|
|
|
61
65
|
|
|
62
66
|
this._styles.select(this._selector + ".grouped .button:last-child")
|
|
63
67
|
.style("border-radius", "0 " + this._state.border_radius + "px " + this._state.border_radius + "px 0")
|
|
64
|
-
.style("border-right", this._state.border_width + "px solid
|
|
68
|
+
.style("border-right", this._state.border_width + "px solid " + border_color);
|
|
65
69
|
|
|
66
70
|
this._styles.select(this._selector + ".grouped.fixed-width:not(.hidden)")
|
|
67
71
|
.style("display", "table")
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { hexToRgba } from "@flourish/pocket-knife";
|
|
1
2
|
import Stylesheet from "../lib/js2css";
|
|
2
3
|
|
|
3
4
|
var DEFAULTS = Object.freeze({
|
|
4
5
|
background: "#ffffff",
|
|
5
6
|
font_color: "#333333",
|
|
6
7
|
|
|
7
|
-
border_style: "
|
|
8
|
+
border_style: "bottom",
|
|
8
9
|
border_width: 1,
|
|
9
|
-
border_color: "
|
|
10
|
+
border_color: "#000000",
|
|
11
|
+
border_transparency: 0.25,
|
|
10
12
|
border_radius: 3
|
|
11
13
|
});
|
|
12
14
|
|
|
@@ -29,6 +31,8 @@ DropdownStyle.prototype._createStylesheet = function() {
|
|
|
29
31
|
DropdownStyle.prototype.update = function() {
|
|
30
32
|
this._styles.clear();
|
|
31
33
|
|
|
34
|
+
var border_color = hexToRgba(this._state.border_color, this._state.border_transparency);
|
|
35
|
+
|
|
32
36
|
this._styles.select(this._selector + " .heading")
|
|
33
37
|
.style("margin-bottom", "0.4em");
|
|
34
38
|
|
|
@@ -40,25 +44,29 @@ DropdownStyle.prototype.update = function() {
|
|
|
40
44
|
.style("cursor", "pointer")
|
|
41
45
|
.style("overflow", "hidden")
|
|
42
46
|
.style("white-space", "nowrap")
|
|
47
|
+
.style("position", "relative")
|
|
43
48
|
.style("background-color", this._state.background)
|
|
44
49
|
.style("color", this._state.font_color)
|
|
45
|
-
.style("border", this._state.border_style == "bottom" ? null : this._state.border_width + "px solid
|
|
46
|
-
.style("border-bottom", this._state.border_style == "bottom" ? this._state.border_width + "px solid
|
|
50
|
+
.style("border", this._state.border_style == "bottom" ? null : this._state.border_width + "px solid " + border_color)
|
|
51
|
+
.style("border-bottom", this._state.border_style == "bottom" ? this._state.border_width + "px solid " + border_color : null)
|
|
47
52
|
.style("border-radius", this._state.border_style == "bottom" ? null : this._state.border_radius + "px");
|
|
48
53
|
|
|
49
|
-
this._styles.select(this._selector + " .main .symbol
|
|
54
|
+
this._styles.select(this._selector + " .main .symbol")
|
|
55
|
+
.style("float", "right")
|
|
56
|
+
.select("div")
|
|
50
57
|
.style("border-top-color", this._state.font_color + " !important");
|
|
51
58
|
|
|
52
59
|
this._styles.select(this._selector + " .main .current")
|
|
53
60
|
.style("line-height", "1em")
|
|
54
61
|
.style("height", "100%")
|
|
55
|
-
.style("width", "
|
|
62
|
+
.style("max-width", "88%")
|
|
56
63
|
.style("display", "inline-block")
|
|
64
|
+
.style("overflow", "hidden")
|
|
57
65
|
.style("padding", "0.2em 0 0")
|
|
58
66
|
.style("vertical-align", "top");
|
|
59
67
|
|
|
60
68
|
this._styles.select(this._selector + " .list")
|
|
61
|
-
.style("border", this._state.border_width + "px solid
|
|
69
|
+
.style("border", this._state.border_width + "px solid " + border_color)
|
|
62
70
|
.style("background-color", this._state.background)
|
|
63
71
|
.style("position", "absolute")
|
|
64
72
|
.style("top", "2px")
|
|
@@ -72,6 +80,7 @@ DropdownStyle.prototype.update = function() {
|
|
|
72
80
|
.select(".list-item")
|
|
73
81
|
.style("line-height", "1em")
|
|
74
82
|
.style("cursor", "pointer")
|
|
83
|
+
.style("font-weight", "normal")
|
|
75
84
|
.style("color", this._state.font_color);
|
|
76
85
|
|
|
77
86
|
this._styles.select(this._selector + ".open .list")
|
|
@@ -86,6 +95,12 @@ DropdownStyle.prototype.update = function() {
|
|
|
86
95
|
.style("opacity", "1")
|
|
87
96
|
.style("cursor", "default");
|
|
88
97
|
|
|
98
|
+
if (this._state.border_style == "bottom") {
|
|
99
|
+
this._styles.select(this._selector + " .main")
|
|
100
|
+
.style("padding-left", 0)
|
|
101
|
+
.style("padding-right", "0.1rem");
|
|
102
|
+
}
|
|
103
|
+
|
|
89
104
|
|
|
90
105
|
this._stylesheet.innerHTML = this._styles.print();
|
|
91
106
|
};
|
|
@@ -37,10 +37,10 @@ GeneralControlsStyle.prototype.update = function() {
|
|
|
37
37
|
.style("padding", this._state.padding + "rem");
|
|
38
38
|
|
|
39
39
|
this._styles.select(this._selector + " .list-item")
|
|
40
|
-
.style("padding", this._state.padding + "rem");
|
|
40
|
+
.style("padding", Math.max(this._state.padding, 0.5) + "rem");
|
|
41
41
|
|
|
42
42
|
this._styles.select(this._selector + "-dropdown .main")
|
|
43
|
-
.style("padding", this._state.padding + "rem");
|
|
43
|
+
.style("padding", this._state.padding + "rem " + (this._state.padding * 1.5) + "rem");
|
|
44
44
|
|
|
45
45
|
// Some additional styling for slider controls
|
|
46
46
|
// TODO: should move this somewhere else at some point
|
package/ui-styles.js
CHANGED
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
.style("padding", this._state.padding + "rem");
|
|
94
94
|
|
|
95
95
|
this._styles.select(this._selector + " .list-item")
|
|
96
|
-
.style("padding", this._state.padding + "rem");
|
|
96
|
+
.style("padding", Math.max(this._state.padding, 0.5) + "rem");
|
|
97
97
|
|
|
98
98
|
this._styles.select(this._selector + "-dropdown .main")
|
|
99
|
-
.style("padding", this._state.padding + "rem");
|
|
99
|
+
.style("padding", this._state.padding + "rem " + (this._state.padding * 1.5) + "rem");
|
|
100
100
|
|
|
101
101
|
// Some additional styling for slider controls
|
|
102
102
|
// TODO: should move this somewhere else at some point
|
|
@@ -104,6 +104,582 @@
|
|
|
104
104
|
this._stylesheet.innerHTML = this._styles.print();
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
function define(constructor, factory, prototype) {
|
|
108
|
+
constructor.prototype = factory.prototype = prototype;
|
|
109
|
+
prototype.constructor = constructor;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function extend(parent, definition) {
|
|
113
|
+
var prototype = Object.create(parent.prototype);
|
|
114
|
+
for (var key in definition) prototype[key] = definition[key];
|
|
115
|
+
return prototype;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function Color() {}
|
|
119
|
+
|
|
120
|
+
var darker = 0.7;
|
|
121
|
+
var brighter = 1 / darker;
|
|
122
|
+
|
|
123
|
+
var reI = "\\s*([+-]?\\d+)\\s*",
|
|
124
|
+
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
|
125
|
+
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
|
126
|
+
reHex = /^#([0-9a-f]{3,8})$/,
|
|
127
|
+
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
|
|
128
|
+
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
|
|
129
|
+
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
|
|
130
|
+
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
|
|
131
|
+
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
|
|
132
|
+
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
|
|
133
|
+
|
|
134
|
+
var named = {
|
|
135
|
+
aliceblue: 0xf0f8ff,
|
|
136
|
+
antiquewhite: 0xfaebd7,
|
|
137
|
+
aqua: 0x00ffff,
|
|
138
|
+
aquamarine: 0x7fffd4,
|
|
139
|
+
azure: 0xf0ffff,
|
|
140
|
+
beige: 0xf5f5dc,
|
|
141
|
+
bisque: 0xffe4c4,
|
|
142
|
+
black: 0x000000,
|
|
143
|
+
blanchedalmond: 0xffebcd,
|
|
144
|
+
blue: 0x0000ff,
|
|
145
|
+
blueviolet: 0x8a2be2,
|
|
146
|
+
brown: 0xa52a2a,
|
|
147
|
+
burlywood: 0xdeb887,
|
|
148
|
+
cadetblue: 0x5f9ea0,
|
|
149
|
+
chartreuse: 0x7fff00,
|
|
150
|
+
chocolate: 0xd2691e,
|
|
151
|
+
coral: 0xff7f50,
|
|
152
|
+
cornflowerblue: 0x6495ed,
|
|
153
|
+
cornsilk: 0xfff8dc,
|
|
154
|
+
crimson: 0xdc143c,
|
|
155
|
+
cyan: 0x00ffff,
|
|
156
|
+
darkblue: 0x00008b,
|
|
157
|
+
darkcyan: 0x008b8b,
|
|
158
|
+
darkgoldenrod: 0xb8860b,
|
|
159
|
+
darkgray: 0xa9a9a9,
|
|
160
|
+
darkgreen: 0x006400,
|
|
161
|
+
darkgrey: 0xa9a9a9,
|
|
162
|
+
darkkhaki: 0xbdb76b,
|
|
163
|
+
darkmagenta: 0x8b008b,
|
|
164
|
+
darkolivegreen: 0x556b2f,
|
|
165
|
+
darkorange: 0xff8c00,
|
|
166
|
+
darkorchid: 0x9932cc,
|
|
167
|
+
darkred: 0x8b0000,
|
|
168
|
+
darksalmon: 0xe9967a,
|
|
169
|
+
darkseagreen: 0x8fbc8f,
|
|
170
|
+
darkslateblue: 0x483d8b,
|
|
171
|
+
darkslategray: 0x2f4f4f,
|
|
172
|
+
darkslategrey: 0x2f4f4f,
|
|
173
|
+
darkturquoise: 0x00ced1,
|
|
174
|
+
darkviolet: 0x9400d3,
|
|
175
|
+
deeppink: 0xff1493,
|
|
176
|
+
deepskyblue: 0x00bfff,
|
|
177
|
+
dimgray: 0x696969,
|
|
178
|
+
dimgrey: 0x696969,
|
|
179
|
+
dodgerblue: 0x1e90ff,
|
|
180
|
+
firebrick: 0xb22222,
|
|
181
|
+
floralwhite: 0xfffaf0,
|
|
182
|
+
forestgreen: 0x228b22,
|
|
183
|
+
fuchsia: 0xff00ff,
|
|
184
|
+
gainsboro: 0xdcdcdc,
|
|
185
|
+
ghostwhite: 0xf8f8ff,
|
|
186
|
+
gold: 0xffd700,
|
|
187
|
+
goldenrod: 0xdaa520,
|
|
188
|
+
gray: 0x808080,
|
|
189
|
+
green: 0x008000,
|
|
190
|
+
greenyellow: 0xadff2f,
|
|
191
|
+
grey: 0x808080,
|
|
192
|
+
honeydew: 0xf0fff0,
|
|
193
|
+
hotpink: 0xff69b4,
|
|
194
|
+
indianred: 0xcd5c5c,
|
|
195
|
+
indigo: 0x4b0082,
|
|
196
|
+
ivory: 0xfffff0,
|
|
197
|
+
khaki: 0xf0e68c,
|
|
198
|
+
lavender: 0xe6e6fa,
|
|
199
|
+
lavenderblush: 0xfff0f5,
|
|
200
|
+
lawngreen: 0x7cfc00,
|
|
201
|
+
lemonchiffon: 0xfffacd,
|
|
202
|
+
lightblue: 0xadd8e6,
|
|
203
|
+
lightcoral: 0xf08080,
|
|
204
|
+
lightcyan: 0xe0ffff,
|
|
205
|
+
lightgoldenrodyellow: 0xfafad2,
|
|
206
|
+
lightgray: 0xd3d3d3,
|
|
207
|
+
lightgreen: 0x90ee90,
|
|
208
|
+
lightgrey: 0xd3d3d3,
|
|
209
|
+
lightpink: 0xffb6c1,
|
|
210
|
+
lightsalmon: 0xffa07a,
|
|
211
|
+
lightseagreen: 0x20b2aa,
|
|
212
|
+
lightskyblue: 0x87cefa,
|
|
213
|
+
lightslategray: 0x778899,
|
|
214
|
+
lightslategrey: 0x778899,
|
|
215
|
+
lightsteelblue: 0xb0c4de,
|
|
216
|
+
lightyellow: 0xffffe0,
|
|
217
|
+
lime: 0x00ff00,
|
|
218
|
+
limegreen: 0x32cd32,
|
|
219
|
+
linen: 0xfaf0e6,
|
|
220
|
+
magenta: 0xff00ff,
|
|
221
|
+
maroon: 0x800000,
|
|
222
|
+
mediumaquamarine: 0x66cdaa,
|
|
223
|
+
mediumblue: 0x0000cd,
|
|
224
|
+
mediumorchid: 0xba55d3,
|
|
225
|
+
mediumpurple: 0x9370db,
|
|
226
|
+
mediumseagreen: 0x3cb371,
|
|
227
|
+
mediumslateblue: 0x7b68ee,
|
|
228
|
+
mediumspringgreen: 0x00fa9a,
|
|
229
|
+
mediumturquoise: 0x48d1cc,
|
|
230
|
+
mediumvioletred: 0xc71585,
|
|
231
|
+
midnightblue: 0x191970,
|
|
232
|
+
mintcream: 0xf5fffa,
|
|
233
|
+
mistyrose: 0xffe4e1,
|
|
234
|
+
moccasin: 0xffe4b5,
|
|
235
|
+
navajowhite: 0xffdead,
|
|
236
|
+
navy: 0x000080,
|
|
237
|
+
oldlace: 0xfdf5e6,
|
|
238
|
+
olive: 0x808000,
|
|
239
|
+
olivedrab: 0x6b8e23,
|
|
240
|
+
orange: 0xffa500,
|
|
241
|
+
orangered: 0xff4500,
|
|
242
|
+
orchid: 0xda70d6,
|
|
243
|
+
palegoldenrod: 0xeee8aa,
|
|
244
|
+
palegreen: 0x98fb98,
|
|
245
|
+
paleturquoise: 0xafeeee,
|
|
246
|
+
palevioletred: 0xdb7093,
|
|
247
|
+
papayawhip: 0xffefd5,
|
|
248
|
+
peachpuff: 0xffdab9,
|
|
249
|
+
peru: 0xcd853f,
|
|
250
|
+
pink: 0xffc0cb,
|
|
251
|
+
plum: 0xdda0dd,
|
|
252
|
+
powderblue: 0xb0e0e6,
|
|
253
|
+
purple: 0x800080,
|
|
254
|
+
rebeccapurple: 0x663399,
|
|
255
|
+
red: 0xff0000,
|
|
256
|
+
rosybrown: 0xbc8f8f,
|
|
257
|
+
royalblue: 0x4169e1,
|
|
258
|
+
saddlebrown: 0x8b4513,
|
|
259
|
+
salmon: 0xfa8072,
|
|
260
|
+
sandybrown: 0xf4a460,
|
|
261
|
+
seagreen: 0x2e8b57,
|
|
262
|
+
seashell: 0xfff5ee,
|
|
263
|
+
sienna: 0xa0522d,
|
|
264
|
+
silver: 0xc0c0c0,
|
|
265
|
+
skyblue: 0x87ceeb,
|
|
266
|
+
slateblue: 0x6a5acd,
|
|
267
|
+
slategray: 0x708090,
|
|
268
|
+
slategrey: 0x708090,
|
|
269
|
+
snow: 0xfffafa,
|
|
270
|
+
springgreen: 0x00ff7f,
|
|
271
|
+
steelblue: 0x4682b4,
|
|
272
|
+
tan: 0xd2b48c,
|
|
273
|
+
teal: 0x008080,
|
|
274
|
+
thistle: 0xd8bfd8,
|
|
275
|
+
tomato: 0xff6347,
|
|
276
|
+
turquoise: 0x40e0d0,
|
|
277
|
+
violet: 0xee82ee,
|
|
278
|
+
wheat: 0xf5deb3,
|
|
279
|
+
white: 0xffffff,
|
|
280
|
+
whitesmoke: 0xf5f5f5,
|
|
281
|
+
yellow: 0xffff00,
|
|
282
|
+
yellowgreen: 0x9acd32
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
define(Color, color, {
|
|
286
|
+
copy: function(channels) {
|
|
287
|
+
return Object.assign(new this.constructor, this, channels);
|
|
288
|
+
},
|
|
289
|
+
displayable: function() {
|
|
290
|
+
return this.rgb().displayable();
|
|
291
|
+
},
|
|
292
|
+
hex: color_formatHex, // Deprecated! Use color.formatHex.
|
|
293
|
+
formatHex: color_formatHex,
|
|
294
|
+
formatHsl: color_formatHsl,
|
|
295
|
+
formatRgb: color_formatRgb,
|
|
296
|
+
toString: color_formatRgb
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
function color_formatHex() {
|
|
300
|
+
return this.rgb().formatHex();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function color_formatHsl() {
|
|
304
|
+
return hslConvert(this).formatHsl();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function color_formatRgb() {
|
|
308
|
+
return this.rgb().formatRgb();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function color(format) {
|
|
312
|
+
var m, l;
|
|
313
|
+
format = (format + "").trim().toLowerCase();
|
|
314
|
+
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
|
|
315
|
+
: l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
|
|
316
|
+
: l === 8 ? new Rgb(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
|
|
317
|
+
: l === 4 ? new Rgb((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
|
|
318
|
+
: null) // invalid hex
|
|
319
|
+
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
|
|
320
|
+
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
|
|
321
|
+
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
|
|
322
|
+
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
|
|
323
|
+
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
|
|
324
|
+
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
|
|
325
|
+
: named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
|
|
326
|
+
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
|
327
|
+
: null;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function rgbn(n) {
|
|
331
|
+
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function rgba(r, g, b, a) {
|
|
335
|
+
if (a <= 0) r = g = b = NaN;
|
|
336
|
+
return new Rgb(r, g, b, a);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function rgbConvert(o) {
|
|
340
|
+
if (!(o instanceof Color)) o = color(o);
|
|
341
|
+
if (!o) return new Rgb;
|
|
342
|
+
o = o.rgb();
|
|
343
|
+
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function rgb(r, g, b, opacity) {
|
|
347
|
+
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function Rgb(r, g, b, opacity) {
|
|
351
|
+
this.r = +r;
|
|
352
|
+
this.g = +g;
|
|
353
|
+
this.b = +b;
|
|
354
|
+
this.opacity = +opacity;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
define(Rgb, rgb, extend(Color, {
|
|
358
|
+
brighter: function(k) {
|
|
359
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
360
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
361
|
+
},
|
|
362
|
+
darker: function(k) {
|
|
363
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
364
|
+
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
365
|
+
},
|
|
366
|
+
rgb: function() {
|
|
367
|
+
return this;
|
|
368
|
+
},
|
|
369
|
+
displayable: function() {
|
|
370
|
+
return (-0.5 <= this.r && this.r < 255.5)
|
|
371
|
+
&& (-0.5 <= this.g && this.g < 255.5)
|
|
372
|
+
&& (-0.5 <= this.b && this.b < 255.5)
|
|
373
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
374
|
+
},
|
|
375
|
+
hex: rgb_formatHex, // Deprecated! Use color.formatHex.
|
|
376
|
+
formatHex: rgb_formatHex,
|
|
377
|
+
formatRgb: rgb_formatRgb,
|
|
378
|
+
toString: rgb_formatRgb
|
|
379
|
+
}));
|
|
380
|
+
|
|
381
|
+
function rgb_formatHex() {
|
|
382
|
+
return "#" + hex(this.r) + hex(this.g) + hex(this.b);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function rgb_formatRgb() {
|
|
386
|
+
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
|
387
|
+
return (a === 1 ? "rgb(" : "rgba(")
|
|
388
|
+
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
|
|
389
|
+
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
|
|
390
|
+
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
|
|
391
|
+
+ (a === 1 ? ")" : ", " + a + ")");
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function hex(value) {
|
|
395
|
+
value = Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
396
|
+
return (value < 16 ? "0" : "") + value.toString(16);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function hsla(h, s, l, a) {
|
|
400
|
+
if (a <= 0) h = s = l = NaN;
|
|
401
|
+
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
402
|
+
else if (s <= 0) h = NaN;
|
|
403
|
+
return new Hsl(h, s, l, a);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function hslConvert(o) {
|
|
407
|
+
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
408
|
+
if (!(o instanceof Color)) o = color(o);
|
|
409
|
+
if (!o) return new Hsl;
|
|
410
|
+
if (o instanceof Hsl) return o;
|
|
411
|
+
o = o.rgb();
|
|
412
|
+
var r = o.r / 255,
|
|
413
|
+
g = o.g / 255,
|
|
414
|
+
b = o.b / 255,
|
|
415
|
+
min = Math.min(r, g, b),
|
|
416
|
+
max = Math.max(r, g, b),
|
|
417
|
+
h = NaN,
|
|
418
|
+
s = max - min,
|
|
419
|
+
l = (max + min) / 2;
|
|
420
|
+
if (s) {
|
|
421
|
+
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
422
|
+
else if (g === max) h = (b - r) / s + 2;
|
|
423
|
+
else h = (r - g) / s + 4;
|
|
424
|
+
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
425
|
+
h *= 60;
|
|
426
|
+
} else {
|
|
427
|
+
s = l > 0 && l < 1 ? 0 : h;
|
|
428
|
+
}
|
|
429
|
+
return new Hsl(h, s, l, o.opacity);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function hsl(h, s, l, opacity) {
|
|
433
|
+
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function Hsl(h, s, l, opacity) {
|
|
437
|
+
this.h = +h;
|
|
438
|
+
this.s = +s;
|
|
439
|
+
this.l = +l;
|
|
440
|
+
this.opacity = +opacity;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
define(Hsl, hsl, extend(Color, {
|
|
444
|
+
brighter: function(k) {
|
|
445
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
446
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
447
|
+
},
|
|
448
|
+
darker: function(k) {
|
|
449
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
450
|
+
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
451
|
+
},
|
|
452
|
+
rgb: function() {
|
|
453
|
+
var h = this.h % 360 + (this.h < 0) * 360,
|
|
454
|
+
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
455
|
+
l = this.l,
|
|
456
|
+
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
|
457
|
+
m1 = 2 * l - m2;
|
|
458
|
+
return new Rgb(
|
|
459
|
+
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
460
|
+
hsl2rgb(h, m1, m2),
|
|
461
|
+
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
462
|
+
this.opacity
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
displayable: function() {
|
|
466
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
467
|
+
&& (0 <= this.l && this.l <= 1)
|
|
468
|
+
&& (0 <= this.opacity && this.opacity <= 1);
|
|
469
|
+
},
|
|
470
|
+
formatHsl: function() {
|
|
471
|
+
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
|
472
|
+
return (a === 1 ? "hsl(" : "hsla(")
|
|
473
|
+
+ (this.h || 0) + ", "
|
|
474
|
+
+ (this.s || 0) * 100 + "%, "
|
|
475
|
+
+ (this.l || 0) * 100 + "%"
|
|
476
|
+
+ (a === 1 ? ")" : ", " + a + ")");
|
|
477
|
+
}
|
|
478
|
+
}));
|
|
479
|
+
|
|
480
|
+
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
481
|
+
function hsl2rgb(h, m1, m2) {
|
|
482
|
+
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
483
|
+
: h < 180 ? m2
|
|
484
|
+
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
|
485
|
+
: m1) * 255;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
var deg2rad = Math.PI / 180;
|
|
489
|
+
var rad2deg = 180 / Math.PI;
|
|
490
|
+
|
|
491
|
+
// https://observablehq.com/@mbostock/lab-and-rgb
|
|
492
|
+
var K = 18,
|
|
493
|
+
Xn = 0.96422,
|
|
494
|
+
Yn = 1,
|
|
495
|
+
Zn = 0.82521,
|
|
496
|
+
t0 = 4 / 29,
|
|
497
|
+
t1 = 6 / 29,
|
|
498
|
+
t2 = 3 * t1 * t1,
|
|
499
|
+
t3 = t1 * t1 * t1;
|
|
500
|
+
|
|
501
|
+
function labConvert(o) {
|
|
502
|
+
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
|
|
503
|
+
if (o instanceof Hcl) return hcl2lab(o);
|
|
504
|
+
if (!(o instanceof Rgb)) o = rgbConvert(o);
|
|
505
|
+
var r = rgb2lrgb(o.r),
|
|
506
|
+
g = rgb2lrgb(o.g),
|
|
507
|
+
b = rgb2lrgb(o.b),
|
|
508
|
+
y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
|
|
509
|
+
if (r === g && g === b) x = z = y; else {
|
|
510
|
+
x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
|
|
511
|
+
z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
|
|
512
|
+
}
|
|
513
|
+
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function lab(l, a, b, opacity) {
|
|
517
|
+
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function Lab(l, a, b, opacity) {
|
|
521
|
+
this.l = +l;
|
|
522
|
+
this.a = +a;
|
|
523
|
+
this.b = +b;
|
|
524
|
+
this.opacity = +opacity;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
define(Lab, lab, extend(Color, {
|
|
528
|
+
brighter: function(k) {
|
|
529
|
+
return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
|
530
|
+
},
|
|
531
|
+
darker: function(k) {
|
|
532
|
+
return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
|
533
|
+
},
|
|
534
|
+
rgb: function() {
|
|
535
|
+
var y = (this.l + 16) / 116,
|
|
536
|
+
x = isNaN(this.a) ? y : y + this.a / 500,
|
|
537
|
+
z = isNaN(this.b) ? y : y - this.b / 200;
|
|
538
|
+
x = Xn * lab2xyz(x);
|
|
539
|
+
y = Yn * lab2xyz(y);
|
|
540
|
+
z = Zn * lab2xyz(z);
|
|
541
|
+
return new Rgb(
|
|
542
|
+
lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
|
|
543
|
+
lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
|
|
544
|
+
lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
|
|
545
|
+
this.opacity
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
}));
|
|
549
|
+
|
|
550
|
+
function xyz2lab(t) {
|
|
551
|
+
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function lab2xyz(t) {
|
|
555
|
+
return t > t1 ? t * t * t : t2 * (t - t0);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function lrgb2rgb(x) {
|
|
559
|
+
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function rgb2lrgb(x) {
|
|
563
|
+
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function hclConvert(o) {
|
|
567
|
+
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
|
|
568
|
+
if (!(o instanceof Lab)) o = labConvert(o);
|
|
569
|
+
if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
|
|
570
|
+
var h = Math.atan2(o.b, o.a) * rad2deg;
|
|
571
|
+
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function hcl(h, c, l, opacity) {
|
|
575
|
+
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function Hcl(h, c, l, opacity) {
|
|
579
|
+
this.h = +h;
|
|
580
|
+
this.c = +c;
|
|
581
|
+
this.l = +l;
|
|
582
|
+
this.opacity = +opacity;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function hcl2lab(o) {
|
|
586
|
+
if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
|
|
587
|
+
var h = o.h * deg2rad;
|
|
588
|
+
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
define(Hcl, hcl, extend(Color, {
|
|
592
|
+
brighter: function(k) {
|
|
593
|
+
return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
|
|
594
|
+
},
|
|
595
|
+
darker: function(k) {
|
|
596
|
+
return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
|
|
597
|
+
},
|
|
598
|
+
rgb: function() {
|
|
599
|
+
return hcl2lab(this).rgb();
|
|
600
|
+
}
|
|
601
|
+
}));
|
|
602
|
+
|
|
603
|
+
var A = -0.14861,
|
|
604
|
+
B = +1.78277,
|
|
605
|
+
C = -0.29227,
|
|
606
|
+
D = -0.90649,
|
|
607
|
+
E = +1.97294,
|
|
608
|
+
ED = E * D,
|
|
609
|
+
EB = E * B,
|
|
610
|
+
BC_DA = B * C - D * A;
|
|
611
|
+
|
|
612
|
+
function cubehelixConvert(o) {
|
|
613
|
+
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
|
614
|
+
if (!(o instanceof Rgb)) o = rgbConvert(o);
|
|
615
|
+
var r = o.r / 255,
|
|
616
|
+
g = o.g / 255,
|
|
617
|
+
b = o.b / 255,
|
|
618
|
+
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
|
619
|
+
bl = b - l,
|
|
620
|
+
k = (E * (g - l) - C * bl) / D,
|
|
621
|
+
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
|
|
622
|
+
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
|
|
623
|
+
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function cubehelix(h, s, l, opacity) {
|
|
627
|
+
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function Cubehelix(h, s, l, opacity) {
|
|
631
|
+
this.h = +h;
|
|
632
|
+
this.s = +s;
|
|
633
|
+
this.l = +l;
|
|
634
|
+
this.opacity = +opacity;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
define(Cubehelix, cubehelix, extend(Color, {
|
|
638
|
+
brighter: function(k) {
|
|
639
|
+
k = k == null ? brighter : Math.pow(brighter, k);
|
|
640
|
+
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
|
641
|
+
},
|
|
642
|
+
darker: function(k) {
|
|
643
|
+
k = k == null ? darker : Math.pow(darker, k);
|
|
644
|
+
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
|
645
|
+
},
|
|
646
|
+
rgb: function() {
|
|
647
|
+
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
|
|
648
|
+
l = +this.l,
|
|
649
|
+
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
|
650
|
+
cosh = Math.cos(h),
|
|
651
|
+
sinh = Math.sin(h);
|
|
652
|
+
return new Rgb(
|
|
653
|
+
255 * (l + a * (A * cosh + B * sinh)),
|
|
654
|
+
255 * (l + a * (C * cosh + D * sinh)),
|
|
655
|
+
255 * (l + a * (E * cosh)),
|
|
656
|
+
this.opacity
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
}));
|
|
660
|
+
|
|
661
|
+
var getTextWidth = (function() {
|
|
662
|
+
var context = document.createElement("canvas").getContext("2d");
|
|
663
|
+
return function(text, font) {
|
|
664
|
+
context.font = font || "10px sans-serif";
|
|
665
|
+
var metrics = context.measureText(text);
|
|
666
|
+
return metrics.width;
|
|
667
|
+
};
|
|
668
|
+
})();
|
|
669
|
+
|
|
670
|
+
function hexToColor(hex_string, opacity) {
|
|
671
|
+
if (typeof hex_string != "string") return false;
|
|
672
|
+
var c = color(hex_string);
|
|
673
|
+
c.opacity = opacity !== undefined ? opacity : 1;
|
|
674
|
+
return c;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function hexToRgba(hex_string, opacity) {
|
|
678
|
+
var c = hexToColor(hex_string, opacity);
|
|
679
|
+
|
|
680
|
+
return c ? c.toString() : false;
|
|
681
|
+
}
|
|
682
|
+
|
|
107
683
|
var DEFAULTS$1 = Object.freeze({
|
|
108
684
|
background: "#ffffff",
|
|
109
685
|
background_selected: "#ff0033",
|
|
@@ -112,7 +688,8 @@
|
|
|
112
688
|
font_color_selected: "#ffffff",
|
|
113
689
|
|
|
114
690
|
border_width: 1,
|
|
115
|
-
|
|
691
|
+
border_transparency: 0.25,
|
|
692
|
+
border_color: "#000000",
|
|
116
693
|
border_radius: 3
|
|
117
694
|
});
|
|
118
695
|
|
|
@@ -135,6 +712,8 @@
|
|
|
135
712
|
ButtonStyle.prototype.update = function() {
|
|
136
713
|
this._styles.clear();
|
|
137
714
|
|
|
715
|
+
var border_color = hexToRgba(this._state.border_color, this._state.border_transparency);
|
|
716
|
+
|
|
138
717
|
this._styles.select(this._selector + ".hidden")
|
|
139
718
|
.style("display", "none");
|
|
140
719
|
|
|
@@ -148,7 +727,7 @@
|
|
|
148
727
|
.style("margin", "0 2px 0 0")
|
|
149
728
|
.style("background-color", this._state.background)
|
|
150
729
|
.style("color", this._state.font_color)
|
|
151
|
-
.style("border", this._state.border_width + "px solid
|
|
730
|
+
.style("border", this._state.border_width + "px solid " + border_color)
|
|
152
731
|
.style("border-radius", this._state.border_radius + "px");
|
|
153
732
|
|
|
154
733
|
this._styles.select(this._selector + " .button.selected")
|
|
@@ -165,7 +744,7 @@
|
|
|
165
744
|
|
|
166
745
|
this._styles.select(this._selector + ".grouped .button:last-child")
|
|
167
746
|
.style("border-radius", "0 " + this._state.border_radius + "px " + this._state.border_radius + "px 0")
|
|
168
|
-
.style("border-right", this._state.border_width + "px solid
|
|
747
|
+
.style("border-right", this._state.border_width + "px solid " + border_color);
|
|
169
748
|
|
|
170
749
|
this._styles.select(this._selector + ".grouped.fixed-width:not(.hidden)")
|
|
171
750
|
.style("display", "table")
|
|
@@ -181,9 +760,10 @@
|
|
|
181
760
|
background: "#ffffff",
|
|
182
761
|
font_color: "#333333",
|
|
183
762
|
|
|
184
|
-
border_style: "
|
|
763
|
+
border_style: "bottom",
|
|
185
764
|
border_width: 1,
|
|
186
|
-
border_color: "
|
|
765
|
+
border_color: "#000000",
|
|
766
|
+
border_transparency: 0.25,
|
|
187
767
|
border_radius: 3
|
|
188
768
|
});
|
|
189
769
|
|
|
@@ -206,6 +786,8 @@
|
|
|
206
786
|
DropdownStyle.prototype.update = function() {
|
|
207
787
|
this._styles.clear();
|
|
208
788
|
|
|
789
|
+
var border_color = hexToRgba(this._state.border_color, this._state.border_transparency);
|
|
790
|
+
|
|
209
791
|
this._styles.select(this._selector + " .heading")
|
|
210
792
|
.style("margin-bottom", "0.4em");
|
|
211
793
|
|
|
@@ -217,25 +799,29 @@
|
|
|
217
799
|
.style("cursor", "pointer")
|
|
218
800
|
.style("overflow", "hidden")
|
|
219
801
|
.style("white-space", "nowrap")
|
|
802
|
+
.style("position", "relative")
|
|
220
803
|
.style("background-color", this._state.background)
|
|
221
804
|
.style("color", this._state.font_color)
|
|
222
|
-
.style("border", this._state.border_style == "bottom" ? null : this._state.border_width + "px solid
|
|
223
|
-
.style("border-bottom", this._state.border_style == "bottom" ? this._state.border_width + "px solid
|
|
805
|
+
.style("border", this._state.border_style == "bottom" ? null : this._state.border_width + "px solid " + border_color)
|
|
806
|
+
.style("border-bottom", this._state.border_style == "bottom" ? this._state.border_width + "px solid " + border_color : null)
|
|
224
807
|
.style("border-radius", this._state.border_style == "bottom" ? null : this._state.border_radius + "px");
|
|
225
808
|
|
|
226
|
-
this._styles.select(this._selector + " .main .symbol
|
|
809
|
+
this._styles.select(this._selector + " .main .symbol")
|
|
810
|
+
.style("float", "right")
|
|
811
|
+
.select("div")
|
|
227
812
|
.style("border-top-color", this._state.font_color + " !important");
|
|
228
813
|
|
|
229
814
|
this._styles.select(this._selector + " .main .current")
|
|
230
815
|
.style("line-height", "1em")
|
|
231
816
|
.style("height", "100%")
|
|
232
|
-
.style("width", "
|
|
817
|
+
.style("max-width", "88%")
|
|
233
818
|
.style("display", "inline-block")
|
|
819
|
+
.style("overflow", "hidden")
|
|
234
820
|
.style("padding", "0.2em 0 0")
|
|
235
821
|
.style("vertical-align", "top");
|
|
236
822
|
|
|
237
823
|
this._styles.select(this._selector + " .list")
|
|
238
|
-
.style("border", this._state.border_width + "px solid
|
|
824
|
+
.style("border", this._state.border_width + "px solid " + border_color)
|
|
239
825
|
.style("background-color", this._state.background)
|
|
240
826
|
.style("position", "absolute")
|
|
241
827
|
.style("top", "2px")
|
|
@@ -249,6 +835,7 @@
|
|
|
249
835
|
.select(".list-item")
|
|
250
836
|
.style("line-height", "1em")
|
|
251
837
|
.style("cursor", "pointer")
|
|
838
|
+
.style("font-weight", "normal")
|
|
252
839
|
.style("color", this._state.font_color);
|
|
253
840
|
|
|
254
841
|
this._styles.select(this._selector + ".open .list")
|
|
@@ -263,6 +850,12 @@
|
|
|
263
850
|
.style("opacity", "1")
|
|
264
851
|
.style("cursor", "default");
|
|
265
852
|
|
|
853
|
+
if (this._state.border_style == "bottom") {
|
|
854
|
+
this._styles.select(this._selector + " .main")
|
|
855
|
+
.style("padding-left", 0)
|
|
856
|
+
.style("padding-right", "0.1rem");
|
|
857
|
+
}
|
|
858
|
+
|
|
266
859
|
|
|
267
860
|
this._stylesheet.innerHTML = this._styles.print();
|
|
268
861
|
};
|