ozdenui 0.1.0
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.
- checksums.yaml +7 -0
- data/LICENSE +14 -0
- data/NOTICE +5 -0
- data/README.md +242 -0
- data/exe/ozdenui +17 -0
- data/lib/ozdenui/AGENTS.md +210 -0
- data/lib/ozdenui/COMPONENTS.md +3017 -0
- data/lib/ozdenui/app.rb +749 -0
- data/lib/ozdenui/command.rb +107 -0
- data/lib/ozdenui/components.rb +368 -0
- data/lib/ozdenui/dialogs.rb +212 -0
- data/lib/ozdenui/files.rb +124 -0
- data/lib/ozdenui/icon.png +0 -0
- data/lib/ozdenui/kit.json +1 -0
- data/lib/ozdenui/kit.rb +115 -0
- data/lib/ozdenui/look.rb +229 -0
- data/lib/ozdenui/objects.rb +652 -0
- data/lib/ozdenui/server.rb +270 -0
- data/lib/ozdenui/values.rb +273 -0
- data/lib/ozdenui/version.rb +15 -0
- data/lib/ozdenui/web/basic/LICENSE +14 -0
- data/lib/ozdenui/web/basic/basic.min.css +1 -0
- data/lib/ozdenui/web/basic/basic.min.js +78 -0
- data/lib/ozdenui/web/basic/font/open-sans/LICENSE.txt +206 -0
- data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- data/lib/ozdenui/web/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- data/lib/ozdenui/web/basic/scroll-bar.min.js +3 -0
- data/lib/ozdenui/web/bridge.js +584 -0
- data/lib/ozdenui/web/comp/accordion.js +659 -0
- data/lib/ozdenui/web/comp/action-button/add.png +0 -0
- data/lib/ozdenui/web/comp/action-button.js +521 -0
- data/lib/ozdenui/web/comp/action-tab-bar.js +383 -0
- data/lib/ozdenui/web/comp/app-bar.js +237 -0
- data/lib/ozdenui/web/comp/badge.js +292 -0
- data/lib/ozdenui/web/comp/bottom-bar.js +555 -0
- data/lib/ozdenui/web/comp/breadcrumbs.js +524 -0
- data/lib/ozdenui/web/comp/canvas.js +652 -0
- data/lib/ozdenui/web/comp/chat-view.js +827 -0
- data/lib/ozdenui/web/comp/check-box.js +490 -0
- data/lib/ozdenui/web/comp/code-editor.js +965 -0
- data/lib/ozdenui/web/comp/color-picker.js +636 -0
- data/lib/ozdenui/web/comp/context-menu.js +951 -0
- data/lib/ozdenui/web/comp/currency-field.js +209 -0
- data/lib/ozdenui/web/comp/data-table/arrow.svg +2 -0
- data/lib/ozdenui/web/comp/data-table.js +937 -0
- data/lib/ozdenui/web/comp/date-picker.js +1055 -0
- data/lib/ozdenui/web/comp/dialog.js +992 -0
- data/lib/ozdenui/web/comp/email-field.js +65 -0
- data/lib/ozdenui/web/comp/file-picker.js +920 -0
- data/lib/ozdenui/web/comp/filters.js +807 -0
- data/lib/ozdenui/web/comp/form.js +602 -0
- data/lib/ozdenui/web/comp/full-screen-select/arrow.svg +2 -0
- data/lib/ozdenui/web/comp/full-screen-select/cancel.svg +2 -0
- data/lib/ozdenui/web/comp/full-screen-select.js +614 -0
- data/lib/ozdenui/web/comp/gauge.js +439 -0
- data/lib/ozdenui/web/comp/graph-box.js +3911 -0
- data/lib/ozdenui/web/comp/grid-group.js +185 -0
- data/lib/ozdenui/web/comp/hold-to-confirm-button/trash-red.png +0 -0
- data/lib/ozdenui/web/comp/hold-to-confirm-button/trash.png +0 -0
- data/lib/ozdenui/web/comp/hold-to-confirm-button.js +289 -0
- data/lib/ozdenui/web/comp/image-view.js +598 -0
- data/lib/ozdenui/web/comp/item-list.js +1740 -0
- data/lib/ozdenui/web/comp/json-editor.js +3221 -0
- data/lib/ozdenui/web/comp/json-view.js +597 -0
- data/lib/ozdenui/web/comp/label-editor.js +1140 -0
- data/lib/ozdenui/web/comp/left-menu/data-table.png +0 -0
- data/lib/ozdenui/web/comp/left-menu/home.png +0 -0
- data/lib/ozdenui/web/comp/left-menu/reports.png +0 -0
- data/lib/ozdenui/web/comp/left-menu/setting.png +0 -0
- data/lib/ozdenui/web/comp/left-menu.js +548 -0
- data/lib/ozdenui/web/comp/line-progress-bar.js +343 -0
- data/lib/ozdenui/web/comp/loading-screen.js +413 -0
- data/lib/ozdenui/web/comp/log-view.js +530 -0
- data/lib/ozdenui/web/comp/login-page.js +685 -0
- data/lib/ozdenui/web/comp/markdown-view.js +1045 -0
- data/lib/ozdenui/web/comp/menu-bar.js +624 -0
- data/lib/ozdenui/web/comp/mini-graph-box.js +492 -0
- data/lib/ozdenui/web/comp/minimal-accent.js +208 -0
- data/lib/ozdenui/web/comp/notice.js +229 -0
- data/lib/ozdenui/web/comp/number-field.js +128 -0
- data/lib/ozdenui/web/comp/numeric-keyboard.js +298 -0
- data/lib/ozdenui/web/comp/page-control.js +762 -0
- data/lib/ozdenui/web/comp/page-header.js +191 -0
- data/lib/ozdenui/web/comp/password-field/hide-btn.png +0 -0
- data/lib/ozdenui/web/comp/password-field/hide-btn2.png +0 -0
- data/lib/ozdenui/web/comp/password-field/show-btn.png +0 -0
- data/lib/ozdenui/web/comp/password-field/show-btn2.png +0 -0
- data/lib/ozdenui/web/comp/password-field.js +192 -0
- data/lib/ozdenui/web/comp/period-bar.js +436 -0
- data/lib/ozdenui/web/comp/phone-field.js +322 -0
- data/lib/ozdenui/web/comp/progress-bar.js +992 -0
- data/lib/ozdenui/web/comp/property-panel.js +3639 -0
- data/lib/ozdenui/web/comp/radio-button.js +527 -0
- data/lib/ozdenui/web/comp/range-slider.js +569 -0
- data/lib/ozdenui/web/comp/rich-text-editor.js +1064 -0
- data/lib/ozdenui/web/comp/scroll-area.js +308 -0
- data/lib/ozdenui/web/comp/scrolling-text.js +297 -0
- data/lib/ozdenui/web/comp/search-input/clear-round.svg +1 -0
- data/lib/ozdenui/web/comp/search-input/clear.svg +1 -0
- data/lib/ozdenui/web/comp/search-input/filter.png +0 -0
- data/lib/ozdenui/web/comp/search-input/filter.svg +1 -0
- data/lib/ozdenui/web/comp/search-input/search.svg +1 -0
- data/lib/ozdenui/web/comp/search-input.js +725 -0
- data/lib/ozdenui/web/comp/search-results.js +596 -0
- data/lib/ozdenui/web/comp/select-box.js +1862 -0
- data/lib/ozdenui/web/comp/settings-row.js +299 -0
- data/lib/ozdenui/web/comp/side-panel.js +616 -0
- data/lib/ozdenui/web/comp/slider-field.js +952 -0
- data/lib/ozdenui/web/comp/slider.js +838 -0
- data/lib/ozdenui/web/comp/smart-button/alert-black.png +0 -0
- data/lib/ozdenui/web/comp/smart-button/clock.png +0 -0
- data/lib/ozdenui/web/comp/smart-button.js +981 -0
- data/lib/ozdenui/web/comp/smart-table/clock.png +0 -0
- data/lib/ozdenui/web/comp/smart-table/down.png +0 -0
- data/lib/ozdenui/web/comp/smart-table/scroll.png +0 -0
- data/lib/ozdenui/web/comp/smart-table/sort.png +0 -0
- data/lib/ozdenui/web/comp/smart-table/up.png +0 -0
- data/lib/ozdenui/web/comp/smart-table.js +1883 -0
- data/lib/ozdenui/web/comp/sortable-list.js +1181 -0
- data/lib/ozdenui/web/comp/spark-line-box.js +738 -0
- data/lib/ozdenui/web/comp/splitter.js +411 -0
- data/lib/ozdenui/web/comp/status-bar.js +408 -0
- data/lib/ozdenui/web/comp/step-bar.js +345 -0
- data/lib/ozdenui/web/comp/stepper.js +753 -0
- data/lib/ozdenui/web/comp/tabs.js +1366 -0
- data/lib/ozdenui/web/comp/tag-input.js +1107 -0
- data/lib/ozdenui/web/comp/tap-effect.js +170 -0
- data/lib/ozdenui/web/comp/text-area-field.js +233 -0
- data/lib/ozdenui/web/comp/text-field.js +1006 -0
- data/lib/ozdenui/web/comp/time-line.js +398 -0
- data/lib/ozdenui/web/comp/time-picker.js +1032 -0
- data/lib/ozdenui/web/comp/tiny-select/arrow.svg +1 -0
- data/lib/ozdenui/web/comp/tiny-select.js +322 -0
- data/lib/ozdenui/web/comp/tiny-table.js +283 -0
- data/lib/ozdenui/web/comp/toast.js +891 -0
- data/lib/ozdenui/web/comp/toggle.js +757 -0
- data/lib/ozdenui/web/comp/tool-bar.js +760 -0
- data/lib/ozdenui/web/comp/tooltip.js +534 -0
- data/lib/ozdenui/web/comp/tree-view.js +1179 -0
- data/lib/ozdenui/web/comp/ui-effects.js +1097 -0
- data/lib/ozdenui/web/comp/ui-standards.js +403 -0
- data/lib/ozdenui/web/comp/url-field.js +190 -0
- data/lib/ozdenui/web/comp/web-view.js +588 -0
- data/lib/ozdenui/web/components.js +123 -0
- data/lib/ozdenui/web/index.html +39 -0
- data/lib/ozdenui/window.rb +188 -0
- data/lib/ozdenui/window_cocoa.rb +221 -0
- data/lib/ozdenui.rb +32 -0
- metadata +200 -0
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
/* Bismillah */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
SliderField - v26.11
|
|
6
|
+
|
|
7
|
+
UI COMPONENT TEMPLATE
|
|
8
|
+
- A slider in the shape of a field: [ Width | · · · · · 3 ]
|
|
9
|
+
The label is at the left, the value at the right, the filled part ends with a small handle,
|
|
10
|
+
and the dots in the empty part show the steps. (Like the property sliders of design tools.)
|
|
11
|
+
- Drag anywhere on the field, or click a point to jump there. A click on the value opens the typing (editable: 1).
|
|
12
|
+
- minValue, maxValue, step and precision (decimals, "auto": from the step). Unit text after the value ("px", "%")
|
|
13
|
+
and a valueFormat() for your own text.
|
|
14
|
+
- Keyboard: ArrowRight / ArrowUp one step, ArrowLeft / ArrowDown one step back, PageUp / PageDown ten steps,
|
|
15
|
+
Home / End min / max, Enter (or a digit) starts the typing, Escape cancels it.
|
|
16
|
+
- Step dots: one dot for each step, up to maxTicks and as many as there is room for (tick.minSpace; then fewer dots
|
|
17
|
+
that divide the range evenly). Dots under the fill, the label or the value are hidden. showTicks: 0 hides them all.
|
|
18
|
+
- Width can be a percent ("100%"): the view is updated with box.onResize (basic.js removes it with the box).
|
|
19
|
+
- onChange is called while dragging (every new value), onChangeEnd when the change is finished
|
|
20
|
+
(the drag is released, a key step, a typed value). Neither is called at create time or with silent: 1.
|
|
21
|
+
- Everything is drawn with code (no image files needed). Accessibility: role="slider", aria-valuenow...
|
|
22
|
+
- Style packages: "light" (default; the old name "classic" works too) and "dark" (the light and dark look of the kit:
|
|
23
|
+
a quiet gray field, a fill in a tint of the accent, the handle and the focus in the accent: _designs/slider-field.htm),
|
|
24
|
+
"modern", "ozden", "minimal", "minimalDark".
|
|
25
|
+
Select with styleName. (SliderField.styles)
|
|
26
|
+
"ozden" (a more usable look for general use), in the colors of SmartButton: a cyan fill with
|
|
27
|
+
an edge and a white knob, a focus ring. Its sample: 02-comp-examples/slider-field-ozden.htm.
|
|
28
|
+
- The handle never crosses a text (style.fill.aroundLabel and beforeValue, 1 by default): at min the fill holds the
|
|
29
|
+
label (and the handle stands 6 px after it), at max it ends before the value; the handle is always seen. 0: the
|
|
30
|
+
handle can go under them (it hides there).
|
|
31
|
+
- Not the same as comp/slider.js (Slider: a track with a round thumb). THE SLIDER OF NEW PAGES is Slider "round";
|
|
32
|
+
SliderField is the parallel design, for a page that asks for its shape.
|
|
33
|
+
|
|
34
|
+
USAGE:
|
|
35
|
+
const sfWidth = SliderField({ labelText: "Width", value: 3, minValue: 0, maxValue: 10, onChange: (self) => println(self.value) });
|
|
36
|
+
sfWidth.setValue(5); // onChange and onChangeEnd are called
|
|
37
|
+
sfWidth.setValue(5, 1); // silent
|
|
38
|
+
SliderField({ labelText: "Opacity", value: 80, minValue: 0, maxValue: 100, step: 5, unitText: "%" });
|
|
39
|
+
SliderField({ labelText: "Scale", value: 1.5, minValue: 0.5, maxValue: 3, step: 0.1 }); // precision "auto" -> 1 decimal
|
|
40
|
+
SliderField({ labelText: "Blur", width: "100%", valueFormat: (value) => (value === 0) ? "Off" : value + " px" });
|
|
41
|
+
SliderField({ styleName: "ozden", labelText: "Volume", value: 60, minValue: 0, maxValue: 100, unitText: "%" });
|
|
42
|
+
SliderField({ styleName: "ozden", labelText: "Speed", style: { fill: { color: "#7BC362", hoverColor: "#70B756", activeColor: "#67AD4D" } } }); // the green of SmartButton
|
|
43
|
+
|
|
44
|
+
Started Date: September 2026
|
|
45
|
+
Webpage: https://bug7a.github.io/js-components/
|
|
46
|
+
|
|
47
|
+
Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
|
|
48
|
+
Licensed under the Apache License, Version 2.0
|
|
49
|
+
SPDX-License-Identifier: Apache-2.0
|
|
50
|
+
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
"use strict";
|
|
54
|
+
|
|
55
|
+
// Default values:
|
|
56
|
+
const SliderFieldDefaults = {
|
|
57
|
+
key: "0",
|
|
58
|
+
width: 320,
|
|
59
|
+
height: 44,
|
|
60
|
+
labelText: "", // Text at the left. Ex: "Width"
|
|
61
|
+
value: 0,
|
|
62
|
+
minValue: 0,
|
|
63
|
+
maxValue: 10,
|
|
64
|
+
step: 1,
|
|
65
|
+
precision: "auto", // Decimals shown and used for rounding. "auto": the decimals of the step (0.25 -> 2)
|
|
66
|
+
unitText: "", // After the value. Ex: "px", " kg" (with the space)
|
|
67
|
+
editable: 1, // 1: A click on the value opens the typing.
|
|
68
|
+
showTicks: 1, // 1: Dots for the steps in the empty part.
|
|
69
|
+
maxTicks: 30, // More steps than this -> fewer dots
|
|
70
|
+
enabled: 1,
|
|
71
|
+
ariaLabel: "Value", // Used when labelText is empty
|
|
72
|
+
valueFormat: function (value, self) { return self.formatNumber(value) + self.unitText; }, // Text of the value
|
|
73
|
+
onChange: function (self) { }, // self.value (also while dragging)
|
|
74
|
+
onChangeEnd: function (self) { }, // After a drag, a key step or a typed value
|
|
75
|
+
styleName: "light", // "light" ("classic": its old name), "dark", "modern", "ozden", "minimal", "minimalDark" or a name added to SliderField.styles
|
|
76
|
+
style: { // The base of every package (a light gray field with a gray fill): a package changes only some keys
|
|
77
|
+
box: {
|
|
78
|
+
color: "#F2F2F4",
|
|
79
|
+
hoverColor: "", // Under the mouse. "": the same color
|
|
80
|
+
border: 1,
|
|
81
|
+
borderColor: "#E8E8EB",
|
|
82
|
+
round: 12,
|
|
83
|
+
boxShadow: "none",
|
|
84
|
+
},
|
|
85
|
+
boxFocus: { // Keyboard focus
|
|
86
|
+
borderColor: "#9A9AA0",
|
|
87
|
+
ringColor: "", // A ring inside the edge, over the fill. "": no ring
|
|
88
|
+
ringWidth: 2,
|
|
89
|
+
},
|
|
90
|
+
fill: {
|
|
91
|
+
color: "#E1E1E4",
|
|
92
|
+
hoverColor: "#DCDCE0",
|
|
93
|
+
activeColor: "#D5D5DA", // While dragging
|
|
94
|
+
minWidth: 26, // Fill width at min (the handle stays visible)
|
|
95
|
+
round: 11,
|
|
96
|
+
innerRound: "", // The right corners while the fill ends inside the field. "": the same as round, 0: straight
|
|
97
|
+
aroundLabel: 1, // 1: at min the fill holds the label (labelSpace after it): the handle never crosses the label. 0: it can go under it
|
|
98
|
+
labelSpace: 16,
|
|
99
|
+
beforeValue: 1, // 1: at max the fill ends before the value (valueSpace before it): the handle never crosses the value. 0: it can go under it
|
|
100
|
+
valueSpace: 16,
|
|
101
|
+
border: 0,
|
|
102
|
+
borderColor: "transparent",
|
|
103
|
+
boxShadow: "none", // Ex: a line at its bottom: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)"
|
|
104
|
+
},
|
|
105
|
+
handle: {
|
|
106
|
+
width: 3,
|
|
107
|
+
height: 16,
|
|
108
|
+
inset: 11, // Space between the handle and the right side of the fill
|
|
109
|
+
color: "#A9A9AE",
|
|
110
|
+
hoverColor: "#86868C",
|
|
111
|
+
activeColor: "#5E5E64",
|
|
112
|
+
round: 2,
|
|
113
|
+
border: 0,
|
|
114
|
+
borderColor: "transparent",
|
|
115
|
+
boxShadow: "none",
|
|
116
|
+
},
|
|
117
|
+
tick: {
|
|
118
|
+
size: 3,
|
|
119
|
+
color: "#BDBDC2",
|
|
120
|
+
minSpace: 9, // Dots closer than this are not shown
|
|
121
|
+
},
|
|
122
|
+
label: {
|
|
123
|
+
fontSize: 15,
|
|
124
|
+
textColor: "#8A8A8F",
|
|
125
|
+
fontFamily: "", // "": Default. Ex: "opensans-bold"
|
|
126
|
+
padding: 14, // Space at the left
|
|
127
|
+
},
|
|
128
|
+
value: {
|
|
129
|
+
fontSize: 15,
|
|
130
|
+
textColor: "#2C2C2E",
|
|
131
|
+
fontFamily: "",
|
|
132
|
+
padding: 16, // Space at the right
|
|
133
|
+
},
|
|
134
|
+
input: { // While typing
|
|
135
|
+
color: White(1),
|
|
136
|
+
textColor: "#2C2C2E",
|
|
137
|
+
round: 6,
|
|
138
|
+
},
|
|
139
|
+
disabled: {
|
|
140
|
+
opacity: 0.5,
|
|
141
|
+
filter: "none", // Ex: "grayscale(1)": a colored fill turns gray
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const SliderField = function (params = {}) {
|
|
147
|
+
|
|
148
|
+
// Merge style package: params.style > SliderField.styles[styleName] > SliderFieldDefaults.style (the base)
|
|
149
|
+
basic.applyStylePackage(params, SliderField.styles, SliderFieldDefaults);
|
|
150
|
+
|
|
151
|
+
// Merge params:
|
|
152
|
+
mergeIntoIfMissing(params, SliderFieldDefaults);
|
|
153
|
+
|
|
154
|
+
// Edit params, if needed:
|
|
155
|
+
const _bs = params.style.box;
|
|
156
|
+
params.color = _bs.color;
|
|
157
|
+
params.border = _bs.border;
|
|
158
|
+
params.borderColor = _bs.borderColor;
|
|
159
|
+
params.round = _bs.round;
|
|
160
|
+
const startValue = params.value;
|
|
161
|
+
|
|
162
|
+
// BOX: Component container
|
|
163
|
+
let box = startObject(params);
|
|
164
|
+
|
|
165
|
+
// *** PRIVATE VARIABLES:
|
|
166
|
+
const _s = box.style;
|
|
167
|
+
let ticks = []; // Dot boxes
|
|
168
|
+
let tickCount = 0; // Number of spaces between the dots (dots = tickCount + 1)
|
|
169
|
+
let isEditing = 0;
|
|
170
|
+
let isHover = 0;
|
|
171
|
+
let isFocused = 0;
|
|
172
|
+
let isKeyboardFocus = 0; // WHY: The focus border is only for the keyboard, not after a click.
|
|
173
|
+
let isPointerFocusing = 0;
|
|
174
|
+
let drag = null; // { pointerId, startX, isMoving, startValue }
|
|
175
|
+
const SLIDE_TIME = "0.12s"; // The fill and the handle move to a new value (0s while dragging)
|
|
176
|
+
const FADE_TIME = "0.15s"; // Colors, the border, the dots
|
|
177
|
+
const DRAG_START_DISTANCE = 4; // px: a smaller move is still a click
|
|
178
|
+
const PAGE_STEPS = 10; // PageUp / PageDown
|
|
179
|
+
const LABEL_DOT_SPACE = 8; // px: no dots this close to the label
|
|
180
|
+
const VALUE_DOT_SPACE = 10; // px: no dots this close to the value text
|
|
181
|
+
const TEXT_OVERLAP = 4; // px: the handle may touch a text this much before it is hidden (aroundLabel / beforeValue 0)
|
|
182
|
+
const HANDLE_LABEL_SPACE = 6; // px between the label and the handle at min (aroundLabel)
|
|
183
|
+
const FILL_DOT_SPACE = 4; // px: no dots this close to the end of the fill
|
|
184
|
+
const HANDLE_DOT_SPACE = 8; // px: no dots this close to the right side of the handle
|
|
185
|
+
const VALUE_CLICK_SPACE = 6; // px: a click this close to the value text starts the typing
|
|
186
|
+
const INPUT_MIN_WIDTH = 64;
|
|
187
|
+
const INPUT_EXTRA_WIDTH = 28; // The input is wider than the value text
|
|
188
|
+
const INPUT_SPACE = 6; // px: between the input and the sides of the box
|
|
189
|
+
|
|
190
|
+
// *** PUBLIC VARIABLES:
|
|
191
|
+
// NOTE: Default values are also public variables. (box.value, box.minValue, box.maxValue, box.step)
|
|
192
|
+
|
|
193
|
+
// *** PRIVATE FUNCTIONS:
|
|
194
|
+
|
|
195
|
+
const getPrecision = function () {
|
|
196
|
+
if (box.precision !== "auto") return Math.max(0, Number(box.precision) || 0);
|
|
197
|
+
const text = String(box.step);
|
|
198
|
+
return (text.indexOf(".") > -1) ? text.split(".")[1].length : 0;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const roundValue = function (value) {
|
|
202
|
+
const factor = Math.pow(10, getPrecision());
|
|
203
|
+
return Math.round(value * factor) / factor;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Snaps to the steps (from min) and keeps the value in [min, max].
|
|
207
|
+
const clampValue = function (value) {
|
|
208
|
+
value = Number(value);
|
|
209
|
+
if (isNaN(value)) value = box.minValue;
|
|
210
|
+
value = Math.min(Math.max(value, box.minValue), box.maxValue);
|
|
211
|
+
value = box.minValue + Math.round((value - box.minValue) / box.step) * box.step;
|
|
212
|
+
return roundValue(Math.min(Math.max(value, box.minValue), box.maxValue));
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const getRatio = function () {
|
|
216
|
+
const range = box.maxValue - box.minValue;
|
|
217
|
+
return (range > 0) ? (box.value - box.minValue) / range : 0;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Inner width (without the border)
|
|
221
|
+
const getWidth = function () {
|
|
222
|
+
const w = box.elem.clientWidth;
|
|
223
|
+
return (w > 0) ? w : (Number(box.width) || 0);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// The widest value text of min, max and the value: the end of the track does not move while the text changes.
|
|
227
|
+
const getWidestValueWidth = function () {
|
|
228
|
+
const texts = [box.valueFormat(box.minValue, box), box.valueFormat(box.maxValue, box), box.valueFormat(box.value, box)];
|
|
229
|
+
const widths = texts.map(function (text) { return SliderField.measureText(text, box.lblValue.elem); });
|
|
230
|
+
return Math.max.apply(null, widths);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// Where the end of the fill moves: { start, end } (the fill width at min and at max).
|
|
234
|
+
// fill.aroundLabel: at min the fill holds the label, so the label is always on the fill.
|
|
235
|
+
// fill.beforeValue: at max the fill ends before the value, so the value is never on the fill.
|
|
236
|
+
// WHY: the end of a colored fill that crossed a text cut its letters in two colors.
|
|
237
|
+
const getTrack = function () {
|
|
238
|
+
const width = getWidth();
|
|
239
|
+
let start = _s.fill.minWidth;
|
|
240
|
+
let end = width;
|
|
241
|
+
if (_s.fill.aroundLabel == 1 && box.labelText) {
|
|
242
|
+
// WHY the room of the handle: a thin handle inside the end of the fill stood on the label at min (hidden)
|
|
243
|
+
const handleRoom = _s.handle.inset + _s.handle.width + HANDLE_LABEL_SPACE;
|
|
244
|
+
start = Math.max(start, _s.label.padding + box.lblLabel.elem.offsetWidth + Math.max(_s.fill.labelSpace, handleRoom));
|
|
245
|
+
}
|
|
246
|
+
if (_s.fill.beforeValue == 1) {
|
|
247
|
+
end = width - _s.value.padding - getWidestValueWidth() - _s.fill.valueSpace;
|
|
248
|
+
}
|
|
249
|
+
return { start: start, end: Math.max(start, end) };
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// Fill width for a ratio (0-1)
|
|
253
|
+
const getFillWidth = function (ratio, track) {
|
|
254
|
+
return track.start + ratio * (track.end - track.start);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// Value for an x position inside the box (the handle follows the pointer).
|
|
258
|
+
const getValueAt = function (x) {
|
|
259
|
+
const track = getTrack();
|
|
260
|
+
const space = Math.max(1, track.end - track.start);
|
|
261
|
+
const fillWidth = x + _s.handle.inset + _s.handle.width / 2; // the fill that puts the middle of the handle at x
|
|
262
|
+
const ratio = Math.min(1, Math.max(0, (fillWidth - track.start) / space));
|
|
263
|
+
return clampValue(box.minValue + ratio * (box.maxValue - box.minValue));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// WHY: with fill.aroundLabel a click on the label is not a click on the track (it gave min).
|
|
267
|
+
const isOnLabelOfFill = function (x) {
|
|
268
|
+
return (_s.fill.aroundLabel == 1 && box.labelText && x < getTrack().start);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// The x of the pointer in the px of the box. WHY the scale: in a scaled parent (page.fit, a transform,
|
|
272
|
+
// the layer of a game UI) the rect is in screen px and the width in the own px of the box: a drag to 80 % gave
|
|
273
|
+
// 60 % (the game Fishing Company Tycoon fixed it in its copy).
|
|
274
|
+
const getPointerX = function (event) {
|
|
275
|
+
const rect = box.elem.getBoundingClientRect();
|
|
276
|
+
const scale = (box.elem.offsetWidth > 0) ? rect.width / box.elem.offsetWidth : 1;
|
|
277
|
+
return (event.clientX - rect.left) / (scale || 1) - box.elem.clientLeft;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// Number of dot spaces: every step, or a divisor of the steps, up to maxTicks and as many as the track has room for
|
|
281
|
+
// (tick.minSpace). WHY the room: dots that were too close were all hidden, a short track showed none.
|
|
282
|
+
const getTickCount = function (trackLength) {
|
|
283
|
+
if (box.showTicks != 1) return 0;
|
|
284
|
+
const steps = Math.round((box.maxValue - box.minValue) / box.step);
|
|
285
|
+
if (steps < 1) return 0;
|
|
286
|
+
const maxCount = Math.min(box.maxTicks, Math.floor(trackLength / _s.tick.minSpace));
|
|
287
|
+
if (steps <= maxCount) return steps;
|
|
288
|
+
for (let count = maxCount; count >= 2; count--) {
|
|
289
|
+
if (steps % count === 0) return count;
|
|
290
|
+
}
|
|
291
|
+
return 0;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// Creates the dots again when the count changes.
|
|
295
|
+
const buildTicks = function (trackLength) {
|
|
296
|
+
const count = getTickCount(trackLength);
|
|
297
|
+
if (count === tickCount && ticks.length === ((count > 0) ? count + 1 : 0)) return;
|
|
298
|
+
ticks.forEach(function (tick) { tick.remove(); });
|
|
299
|
+
ticks = [];
|
|
300
|
+
tickCount = count;
|
|
301
|
+
if (count === 0) return;
|
|
302
|
+
createIn(box.tickLayer, function () {
|
|
303
|
+
for (let i = 0; i <= count; i++) {
|
|
304
|
+
const tick = Box({
|
|
305
|
+
left: 0,
|
|
306
|
+
top: 0,
|
|
307
|
+
width: _s.tick.size,
|
|
308
|
+
height: _s.tick.size,
|
|
309
|
+
color: _s.tick.color,
|
|
310
|
+
round: _s.tick.size,
|
|
311
|
+
});
|
|
312
|
+
tick.css = {
|
|
313
|
+
top: "calc(50% - " + (_s.tick.size / 2) + "px)",
|
|
314
|
+
transition: "opacity " + FADE_TIME,
|
|
315
|
+
opacity: "0", // WHY: a new dot under the label faded out from 1 (the dots are made again when the field is resized)
|
|
316
|
+
};
|
|
317
|
+
ticks.push(tick);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// WHY: at the right end of the field the fill is as round as the field, or the round corner cuts its edge
|
|
323
|
+
const setFillCorners = function (fillWidth, width) {
|
|
324
|
+
const round = _s.fill.round;
|
|
325
|
+
const isInside = (fillWidth < width - 0.5);
|
|
326
|
+
const endRound = (isInside && _s.fill.innerRound !== "") ? _s.fill.innerRound : round;
|
|
327
|
+
box.fill.css.borderRadius = round + "px " + endRound + "px " + endRound + "px " + round + "px";
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// Positions: fill, handle, value text, dots.
|
|
331
|
+
const refreshLayout = function () {
|
|
332
|
+
|
|
333
|
+
const width = getWidth();
|
|
334
|
+
const track = getTrack();
|
|
335
|
+
const fillWidth = getFillWidth(getRatio(), track);
|
|
336
|
+
const handleLeft = fillWidth - _s.handle.inset - _s.handle.width;
|
|
337
|
+
|
|
338
|
+
box.fill.width = fillWidth;
|
|
339
|
+
setFillCorners(fillWidth, width);
|
|
340
|
+
box.handle.left = handleLeft;
|
|
341
|
+
buildTicks(track.end - track.start);
|
|
342
|
+
|
|
343
|
+
// Areas that hide the dots
|
|
344
|
+
const labelRight = (box.labelText) ? _s.label.padding + box.lblLabel.elem.offsetWidth + LABEL_DOT_SPACE : 0;
|
|
345
|
+
const valueLeft = width - _s.value.padding - box.lblValue.elem.offsetWidth - VALUE_DOT_SPACE;
|
|
346
|
+
|
|
347
|
+
// WHY: At the ends the handle would be drawn on the label or the value text. Only without aroundLabel /
|
|
348
|
+
// beforeValue: with them the handle stays beside the texts and is always seen.
|
|
349
|
+
const handleRight = handleLeft + _s.handle.width;
|
|
350
|
+
const isOnLabel = (_s.fill.aroundLabel != 1 && box.labelText && handleRight > _s.label.padding - TEXT_OVERLAP && handleLeft < labelRight - TEXT_OVERLAP);
|
|
351
|
+
const isOnValue = (_s.fill.beforeValue != 1 && handleRight > valueLeft + TEXT_OVERLAP);
|
|
352
|
+
box.handle.css.opacity = (isOnLabel || isOnValue) ? "0" : "1";
|
|
353
|
+
|
|
354
|
+
if (tickCount > 0) {
|
|
355
|
+
// WHY the handle: a knob is wider than the end of the fill (ozden)
|
|
356
|
+
const dotsLeft = Math.max(fillWidth + FILL_DOT_SPACE, handleRight + HANDLE_DOT_SPACE);
|
|
357
|
+
for (let i = 0; i <= tickCount; i++) {
|
|
358
|
+
const x = getFillWidth(i / tickCount, track) - _s.handle.inset - _s.handle.width / 2;
|
|
359
|
+
const tick = ticks[i];
|
|
360
|
+
tick.left = x - _s.tick.size / 2;
|
|
361
|
+
const isVisible = x > dotsLeft && x > labelRight && x < valueLeft;
|
|
362
|
+
tick.css.opacity = (isVisible) ? "1" : "0";
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// partStyle: _s.fill or _s.handle (color, hoverColor, activeColor)
|
|
369
|
+
const getStateColor = function (partStyle) {
|
|
370
|
+
if (drag && drag.isMoving) return partStyle.activeColor;
|
|
371
|
+
if (isHover && box.enabled == 1) return partStyle.hoverColor;
|
|
372
|
+
return partStyle.color;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const paintState = function () {
|
|
376
|
+
const isHoverColor = (isHover && box.enabled == 1 && _s.box.hoverColor);
|
|
377
|
+
box.color = (isHoverColor) ? _s.box.hoverColor : _s.box.color;
|
|
378
|
+
box.fill.color = getStateColor(_s.fill);
|
|
379
|
+
box.handle.color = getStateColor(_s.handle);
|
|
380
|
+
const isFocusLook = ((isFocused && isKeyboardFocus) || isEditing);
|
|
381
|
+
box.borderColor = (isFocusLook) ? _s.boxFocus.borderColor : _s.box.borderColor;
|
|
382
|
+
box.focusRing.visible = (isFocusLook && _s.boxFocus.ringColor) ? 1 : 0;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
const updateView = function () {
|
|
386
|
+
const text = box.valueFormat(box.value, box);
|
|
387
|
+
box.lblValue.plainText = text;
|
|
388
|
+
box.aria = {
|
|
389
|
+
valuenow: String(box.value),
|
|
390
|
+
valuemin: String(box.minValue),
|
|
391
|
+
valuemax: String(box.maxValue),
|
|
392
|
+
valuetext: text,
|
|
393
|
+
};
|
|
394
|
+
refreshLayout();
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// Motion is off while dragging, so the fill follows the pointer.
|
|
398
|
+
const setSlideMotion = function (isOn) {
|
|
399
|
+
const slideTime = (isOn) ? SLIDE_TIME : "0s";
|
|
400
|
+
box.fill.css.transition = "width " + slideTime + ", background-color " + FADE_TIME;
|
|
401
|
+
box.handle.css.transition = "left " + slideTime + ", background-color " + FADE_TIME + ", opacity " + FADE_TIME;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// Changes the value; onChange if it changed. Returns 1 when the value changed.
|
|
405
|
+
const changeValue = function (value, isEnd) {
|
|
406
|
+
const oldValue = box.value;
|
|
407
|
+
box.setValue(value, 1);
|
|
408
|
+
const changed = (box.value !== oldValue);
|
|
409
|
+
if (changed) box.onChange(box);
|
|
410
|
+
if (changed && isEnd) box.onChangeEnd(box);
|
|
411
|
+
return changed ? 1 : 0;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const stepValue = function (steps) {
|
|
415
|
+
if (box.enabled != 1) return 0;
|
|
416
|
+
return changeValue(box.value + steps * box.step, 1);
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
// *** EDIT (type the value):
|
|
420
|
+
|
|
421
|
+
const startEdit = function (firstText) {
|
|
422
|
+
if (box.editable != 1 || box.enabled != 1 || isEditing) return;
|
|
423
|
+
isEditing = 1;
|
|
424
|
+
const inputWidth = Math.max(INPUT_MIN_WIDTH, box.lblValue.elem.offsetWidth + INPUT_EXTRA_WIDTH);
|
|
425
|
+
box.input.width = inputWidth;
|
|
426
|
+
box.input.left = getWidth() - inputWidth - INPUT_SPACE;
|
|
427
|
+
box.input.text = (firstText !== undefined) ? firstText : box.formatNumber(box.value);
|
|
428
|
+
box.lblValue.visible = 0;
|
|
429
|
+
box.input.visible = 1;
|
|
430
|
+
box.input.inputElement.focus({ preventScroll: true });
|
|
431
|
+
if (firstText === undefined) box.input.inputElement.select();
|
|
432
|
+
paintState();
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// apply: 1 -> The typed value is used. 0 -> Cancel.
|
|
436
|
+
const endEdit = function (apply) {
|
|
437
|
+
// WHY: Chrome fires blur when a focused field is removed: a half typed value went to onChange of a field that
|
|
438
|
+
// was removed (a panel built again while the user typed)
|
|
439
|
+
if (!isEditing || box.isRemoved) return;
|
|
440
|
+
isEditing = 0;
|
|
441
|
+
box.input.visible = 0;
|
|
442
|
+
box.lblValue.visible = 1;
|
|
443
|
+
if (apply) {
|
|
444
|
+
const text = String(box.input.text).trim().replace(",", ".");
|
|
445
|
+
const value = parseFloat(text);
|
|
446
|
+
if (!isNaN(value)) changeValue(value, 1);
|
|
447
|
+
}
|
|
448
|
+
paintState();
|
|
449
|
+
updateView();
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// While typing: Enter applies, Escape cancels.
|
|
453
|
+
const onEditKeyDown = function (event) {
|
|
454
|
+
const isEnter = (event.key === "Enter");
|
|
455
|
+
if (!isEnter && event.key !== "Escape") return;
|
|
456
|
+
event.preventDefault();
|
|
457
|
+
endEdit(isEnter ? 1 : 0);
|
|
458
|
+
box.focus();
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// The keys that change the value.
|
|
462
|
+
const valueKeyActions = {
|
|
463
|
+
ArrowUp: function () { stepValue(1); },
|
|
464
|
+
ArrowRight: function () { stepValue(1); },
|
|
465
|
+
ArrowDown: function () { stepValue(-1); },
|
|
466
|
+
ArrowLeft: function () { stepValue(-1); },
|
|
467
|
+
PageUp: function () { stepValue(PAGE_STEPS); },
|
|
468
|
+
PageDown: function () { stepValue(-PAGE_STEPS); },
|
|
469
|
+
Home: function () { changeValue(box.minValue, 1); },
|
|
470
|
+
End: function () { changeValue(box.maxValue, 1); },
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const isTypingKey = function (key) {
|
|
474
|
+
return key.length === 1 && /[\d\-.,]/.test(key);
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const onKeyDown = function (event) {
|
|
478
|
+
|
|
479
|
+
if (box.enabled != 1) return;
|
|
480
|
+
|
|
481
|
+
if (isEditing) {
|
|
482
|
+
onEditKeyDown(event);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
isKeyboardFocus = 1;
|
|
487
|
+
paintState();
|
|
488
|
+
|
|
489
|
+
const key = event.key;
|
|
490
|
+
if (Object.prototype.hasOwnProperty.call(valueKeyActions, key)) {
|
|
491
|
+
event.preventDefault();
|
|
492
|
+
valueKeyActions[key]();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (box.editable != 1) return;
|
|
497
|
+
|
|
498
|
+
if (key === "Enter") {
|
|
499
|
+
event.preventDefault();
|
|
500
|
+
startEdit();
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// A digit starts the typing with that digit.
|
|
505
|
+
if (isTypingKey(key)) {
|
|
506
|
+
event.preventDefault();
|
|
507
|
+
startEdit(key);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
// *** POINTER (drag or click):
|
|
513
|
+
|
|
514
|
+
const onPointerDown = function (self, event) {
|
|
515
|
+
// WHY: a click on a disabled field took the focus (and drew the focus of the keyboard on it)
|
|
516
|
+
if (box.enabled != 1) {
|
|
517
|
+
event.preventDefault();
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (isEditing || event.button !== 0) return;
|
|
521
|
+
if (event.target === box.input.inputElement) return;
|
|
522
|
+
event.preventDefault(); // WHY: No text selection, the focus is given below.
|
|
523
|
+
isKeyboardFocus = 0;
|
|
524
|
+
isPointerFocusing = 1;
|
|
525
|
+
box.focus();
|
|
526
|
+
isPointerFocusing = 0;
|
|
527
|
+
drag = { pointerId: event.pointerId, startX: getPointerX(event), isMoving: 0 };
|
|
528
|
+
try { box.elem.setPointerCapture(event.pointerId); } catch (e) { }
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
const onPointerMove = function (self, event) {
|
|
532
|
+
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
533
|
+
const x = getPointerX(event);
|
|
534
|
+
if (!drag.isMoving) {
|
|
535
|
+
if (Math.abs(x - drag.startX) < DRAG_START_DISTANCE) return; // WHY: A small move is still a click.
|
|
536
|
+
drag.isMoving = 1;
|
|
537
|
+
drag.startValue = box.value;
|
|
538
|
+
setSlideMotion(0);
|
|
539
|
+
paintState();
|
|
540
|
+
}
|
|
541
|
+
changeValue(getValueAt(x), 0);
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
const onPointerUp = function (self, event) {
|
|
545
|
+
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
546
|
+
const wasMoving = drag.isMoving;
|
|
547
|
+
const startValueOfDrag = drag.startValue;
|
|
548
|
+
const x = getPointerX(event);
|
|
549
|
+
drag = null;
|
|
550
|
+
try { box.elem.releasePointerCapture(event.pointerId); } catch (e) { }
|
|
551
|
+
setSlideMotion(1);
|
|
552
|
+
paintState();
|
|
553
|
+
if (wasMoving) {
|
|
554
|
+
if (box.value !== startValueOfDrag) box.onChangeEnd(box);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
// A click: on the value text -> typing, on the label of a fill around it -> only the focus, anywhere else -> jump there.
|
|
558
|
+
const valueLeft = getWidth() - _s.value.padding - box.lblValue.elem.offsetWidth - VALUE_CLICK_SPACE;
|
|
559
|
+
if (box.editable == 1 && x >= valueLeft) {
|
|
560
|
+
startEdit();
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (isOnLabelOfFill(x)) return;
|
|
564
|
+
changeValue(getValueAt(x), 1);
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const onPointerCancel = function (self, event) {
|
|
568
|
+
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
569
|
+
const wasMoving = drag.isMoving;
|
|
570
|
+
const startValueOfDrag = drag.startValue;
|
|
571
|
+
drag = null;
|
|
572
|
+
setSlideMotion(1);
|
|
573
|
+
paintState();
|
|
574
|
+
if (wasMoving && box.value !== startValueOfDrag) box.onChangeEnd(box);
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
// *** PUBLIC FUNCTIONS:
|
|
578
|
+
|
|
579
|
+
// silent: 1 -> onChange and onChangeEnd are not called.
|
|
580
|
+
box.setValue = function (value, silent = 0) {
|
|
581
|
+
const next = clampValue(value);
|
|
582
|
+
const changed = (next !== box.value);
|
|
583
|
+
box.value = next;
|
|
584
|
+
updateView();
|
|
585
|
+
if (changed && !silent) {
|
|
586
|
+
box.onChange(box);
|
|
587
|
+
box.onChangeEnd(box);
|
|
588
|
+
}
|
|
589
|
+
return box.value;
|
|
590
|
+
};
|
|
591
|
+
// USAGE: get: slider.value, set: slider.setValue(5) // Snapped to the steps and clamped.
|
|
592
|
+
|
|
593
|
+
box.getValue = function () {
|
|
594
|
+
return box.value;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
box.increase = function (steps = 1) {
|
|
598
|
+
return stepValue(steps);
|
|
599
|
+
};
|
|
600
|
+
// USAGE: slider.increase() or slider.increase(5)
|
|
601
|
+
|
|
602
|
+
box.decrease = function (steps = 1) {
|
|
603
|
+
return stepValue(-steps);
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
box.setRange = function (min, max) {
|
|
607
|
+
box.minValue = Number(min) || 0;
|
|
608
|
+
box.maxValue = Math.max(box.minValue, Number(max) || 0);
|
|
609
|
+
box.setValue(box.value, 1); // (the dots are made again in refreshLayout)
|
|
610
|
+
};
|
|
611
|
+
// USAGE: slider.setRange(0, 100)
|
|
612
|
+
|
|
613
|
+
box.setMinValue = function (min) {
|
|
614
|
+
box.setRange(min, Math.max(Number(min) || 0, box.maxValue));
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
box.setMaxValue = function (max) {
|
|
618
|
+
box.setRange(Math.min(box.minValue, Number(max) || 0), max);
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
box.setStep = function (step) {
|
|
622
|
+
box.step = Math.abs(Number(step)) || 1;
|
|
623
|
+
box.setValue(box.value, 1);
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
box.setPrecision = function (precision) {
|
|
627
|
+
box.precision = (precision === "auto") ? "auto" : Math.max(0, Number(precision) || 0);
|
|
628
|
+
box.setValue(box.value, 1);
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
box.setLabelText = function (text) {
|
|
632
|
+
box.labelText = text || "";
|
|
633
|
+
box.lblLabel.plainText = box.labelText;
|
|
634
|
+
box.aria = { label: box.labelText || box.ariaLabel };
|
|
635
|
+
refreshLayout();
|
|
636
|
+
};
|
|
637
|
+
// USAGE: slider.setLabelText("Height")
|
|
638
|
+
|
|
639
|
+
box.setUnitText = function (text) {
|
|
640
|
+
box.unitText = text || "";
|
|
641
|
+
updateView();
|
|
642
|
+
};
|
|
643
|
+
// USAGE: slider.setUnitText("px")
|
|
644
|
+
|
|
645
|
+
box.setShowTicks = function (showTicks) {
|
|
646
|
+
box.showTicks = basic.isOn(showTicks) ? 1 : 0;
|
|
647
|
+
refreshLayout();
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
box.setEnabled = function (enabled) {
|
|
651
|
+
box.enabled = basic.isOn(enabled) ? 1 : 0;
|
|
652
|
+
const isEnabled = (box.enabled == 1);
|
|
653
|
+
if (!isEnabled) {
|
|
654
|
+
endEdit(0);
|
|
655
|
+
drag = null;
|
|
656
|
+
setSlideMotion(1);
|
|
657
|
+
}
|
|
658
|
+
box.css.opacity = (isEnabled) ? "1" : String(_s.disabled.opacity);
|
|
659
|
+
box.css.filter = (isEnabled) ? "none" : _s.disabled.filter;
|
|
660
|
+
box.cursor = (isEnabled) ? "pointer" : "default";
|
|
661
|
+
box.tabIndex = (isEnabled) ? 0 : -1;
|
|
662
|
+
box.aria = { disabled: (isEnabled) ? "false" : "true" };
|
|
663
|
+
paintState();
|
|
664
|
+
};
|
|
665
|
+
// USAGE: get: slider.enabled, set: slider.setEnabled(0)
|
|
666
|
+
|
|
667
|
+
// Number text with the precision: 2.5 -> "2.5", 3 -> "3" (precision 0), 3 -> "3.0" (precision 1)
|
|
668
|
+
box.formatNumber = function (value) {
|
|
669
|
+
return Number(value).toFixed(getPrecision());
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
box.focus = function () {
|
|
673
|
+
box.elem.focus({ preventScroll: true });
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// Call it when the size changed in a way the ResizeObserver can not see (Ex: a font loaded later).
|
|
677
|
+
box.refresh = function () {
|
|
678
|
+
updateView();
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
// *** OBJECT VIEW:
|
|
683
|
+
|
|
684
|
+
box.role = "slider";
|
|
685
|
+
box.aria = { label: box.labelText || box.ariaLabel };
|
|
686
|
+
box.css = {
|
|
687
|
+
outline: "none",
|
|
688
|
+
boxSizing: "border-box",
|
|
689
|
+
transition: "border-color " + FADE_TIME + ", background-color " + FADE_TIME,
|
|
690
|
+
touchAction: "pan-y", // WHY: A horizontal drag moves the slider, a vertical one still scrolls the page.
|
|
691
|
+
userSelect: "none",
|
|
692
|
+
};
|
|
693
|
+
box.boxShadow = _bs.boxShadow;
|
|
694
|
+
box.clipContent = 1;
|
|
695
|
+
|
|
696
|
+
// BOX: Filled part
|
|
697
|
+
box.fill = Box({
|
|
698
|
+
left: 0,
|
|
699
|
+
top: 0,
|
|
700
|
+
width: _s.fill.minWidth,
|
|
701
|
+
height: "100%",
|
|
702
|
+
color: _s.fill.color,
|
|
703
|
+
round: _s.fill.round,
|
|
704
|
+
border: _s.fill.border,
|
|
705
|
+
borderColor: _s.fill.borderColor,
|
|
706
|
+
boxShadow: _s.fill.boxShadow,
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
// BOX: Layer of the step dots
|
|
710
|
+
box.tickLayer = Box({ left: 0, top: 0, width: "100%", height: "100%", color: "transparent" });
|
|
711
|
+
|
|
712
|
+
// BOX: Handle (the small line at the end of the fill)
|
|
713
|
+
box.handle = Box({
|
|
714
|
+
left: 0,
|
|
715
|
+
top: 0,
|
|
716
|
+
width: _s.handle.width,
|
|
717
|
+
height: _s.handle.height,
|
|
718
|
+
color: _s.handle.color,
|
|
719
|
+
round: _s.handle.round,
|
|
720
|
+
border: _s.handle.border,
|
|
721
|
+
borderColor: _s.handle.borderColor,
|
|
722
|
+
boxShadow: _s.handle.boxShadow,
|
|
723
|
+
});
|
|
724
|
+
box.handle.css.top = "calc(50% - " + (_s.handle.height / 2) + "px)";
|
|
725
|
+
|
|
726
|
+
// LABEL: Name at the left
|
|
727
|
+
box.lblLabel = Label({
|
|
728
|
+
left: _s.label.padding,
|
|
729
|
+
top: 0,
|
|
730
|
+
height: "100%",
|
|
731
|
+
text: SliderField.escapeHtml(box.labelText),
|
|
732
|
+
fontSize: _s.label.fontSize,
|
|
733
|
+
textColor: _s.label.textColor,
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
// LABEL: Value at the right
|
|
737
|
+
box.lblValue = Label({
|
|
738
|
+
top: 0,
|
|
739
|
+
height: "100%",
|
|
740
|
+
fontSize: _s.value.fontSize,
|
|
741
|
+
textColor: _s.value.textColor,
|
|
742
|
+
});
|
|
743
|
+
box.lblValue.css = { left: "auto", right: _s.value.padding + "px" };
|
|
744
|
+
|
|
745
|
+
// One line, centered vertically. (fontFamily with css: the fontFamily setter of basic.js also sets fontWeight)
|
|
746
|
+
const styleTextLabel = function (lbl, textStyle) {
|
|
747
|
+
lbl.clickable = 0;
|
|
748
|
+
lbl.elem.style.display = "flex";
|
|
749
|
+
lbl.css = { alignItems: "center", whiteSpace: "nowrap" };
|
|
750
|
+
if (textStyle.fontFamily) lbl.css.fontFamily = textStyle.fontFamily;
|
|
751
|
+
};
|
|
752
|
+
styleTextLabel(box.lblLabel, _s.label);
|
|
753
|
+
styleTextLabel(box.lblValue, _s.value);
|
|
754
|
+
|
|
755
|
+
// BOX: Ring of the keyboard focus (boxFocus.ringColor). WHY a box: an outline of the field is drawn under the fill
|
|
756
|
+
box.focusRing = Box({
|
|
757
|
+
left: 0,
|
|
758
|
+
top: 0,
|
|
759
|
+
width: "100%",
|
|
760
|
+
height: "100%",
|
|
761
|
+
color: "transparent",
|
|
762
|
+
border: _s.boxFocus.ringWidth,
|
|
763
|
+
borderColor: _s.boxFocus.ringColor,
|
|
764
|
+
round: Math.max(0, _s.box.round - _s.box.border),
|
|
765
|
+
});
|
|
766
|
+
box.focusRing.visible = 0;
|
|
767
|
+
|
|
768
|
+
// INPUT: Typing the value (hidden until the edit starts)
|
|
769
|
+
box.input = Input({
|
|
770
|
+
left: 0,
|
|
771
|
+
top: INPUT_SPACE,
|
|
772
|
+
width: INPUT_MIN_WIDTH,
|
|
773
|
+
height: "calc(100% - " + (INPUT_SPACE * 2) + "px)",
|
|
774
|
+
minimal: 1,
|
|
775
|
+
color: _s.input.color,
|
|
776
|
+
fontSize: _s.value.fontSize,
|
|
777
|
+
textColor: _s.input.textColor,
|
|
778
|
+
textAlign: "right",
|
|
779
|
+
round: _s.input.round,
|
|
780
|
+
});
|
|
781
|
+
box.input.inputElement.style.padding = "0px 10px";
|
|
782
|
+
box.input.inputElement.style.width = "100%";
|
|
783
|
+
box.input.inputElement.style.height = "100%";
|
|
784
|
+
box.input.inputElement.style.boxSizing = "border-box";
|
|
785
|
+
box.input.inputElement.style.borderRadius = _s.input.round + "px";
|
|
786
|
+
box.input.inputElement.style.backgroundColor = _s.input.color;
|
|
787
|
+
box.input.inputElement.setAttribute("inputmode", "decimal");
|
|
788
|
+
box.input.inputElement.setAttribute("aria-label", box.labelText || box.ariaLabel);
|
|
789
|
+
if (_s.value.fontFamily) box.input.inputElement.style.fontFamily = _s.value.fontFamily;
|
|
790
|
+
box.input.visible = 0;
|
|
791
|
+
|
|
792
|
+
// WHY: Only the box gets the pointer events, so event.target is always the box (or the input).
|
|
793
|
+
[box.fill, box.tickLayer, box.handle, box.focusRing].forEach(function (obj) { obj.clickable = 0; });
|
|
794
|
+
|
|
795
|
+
// *** OBJECT INIT CODE:
|
|
796
|
+
|
|
797
|
+
box.on("pointerdown", onPointerDown);
|
|
798
|
+
box.on("pointermove", onPointerMove);
|
|
799
|
+
box.on("pointerup", onPointerUp);
|
|
800
|
+
box.on("pointercancel", onPointerCancel);
|
|
801
|
+
box.on("lostpointercapture", onPointerCancel);
|
|
802
|
+
box.on("mouseenter", function () {
|
|
803
|
+
isHover = 1;
|
|
804
|
+
paintState();
|
|
805
|
+
});
|
|
806
|
+
box.on("mouseleave", function () {
|
|
807
|
+
isHover = 0;
|
|
808
|
+
paintState();
|
|
809
|
+
});
|
|
810
|
+
box.on("keydown", function (self, event) {
|
|
811
|
+
if (event.target === box.input.inputElement) return; // WHY: The input has its own keydown (below).
|
|
812
|
+
onKeyDown(event);
|
|
813
|
+
});
|
|
814
|
+
box.on("focus", function () {
|
|
815
|
+
isFocused = 1;
|
|
816
|
+
if (!isPointerFocusing) isKeyboardFocus = 1;
|
|
817
|
+
paintState();
|
|
818
|
+
});
|
|
819
|
+
box.on("blur", function () {
|
|
820
|
+
isFocused = 0;
|
|
821
|
+
isKeyboardFocus = 0;
|
|
822
|
+
paintState();
|
|
823
|
+
});
|
|
824
|
+
box.input.inputElement.addEventListener("blur", function () { endEdit(1); });
|
|
825
|
+
box.input.inputElement.addEventListener("keydown", onKeyDown);
|
|
826
|
+
|
|
827
|
+
box.onResize(function () { refreshLayout(); });
|
|
828
|
+
// WHY: the label and the value are measured; a font that is loaded later changes their widths.
|
|
829
|
+
if (document.fonts) document.fonts.ready.then(function () { if (!box.isRemoved) refreshLayout(); });
|
|
830
|
+
|
|
831
|
+
box.minValue = Number(box.minValue) || 0;
|
|
832
|
+
box.maxValue = Number(box.maxValue);
|
|
833
|
+
if (isNaN(box.maxValue)) box.maxValue = box.minValue;
|
|
834
|
+
if (box.maxValue < box.minValue) box.maxValue = box.minValue;
|
|
835
|
+
box.step = Math.abs(Number(box.step)) || 1;
|
|
836
|
+
box.maxTicks = Math.max(2, Number(box.maxTicks) || SliderFieldDefaults.maxTicks);
|
|
837
|
+
box.value = clampValue(startValue);
|
|
838
|
+
setSlideMotion(1);
|
|
839
|
+
box.setEnabled(box.enabled);
|
|
840
|
+
updateView();
|
|
841
|
+
|
|
842
|
+
return endObject(box);
|
|
843
|
+
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
// *** STATIC FUNCTIONS:
|
|
847
|
+
|
|
848
|
+
// WHY: Label.text uses innerHTML. Texts must not be read as HTML.
|
|
849
|
+
SliderField.escapeHtml = basic.escapeHtml; // (the name is kept: other code may use it)
|
|
850
|
+
|
|
851
|
+
// The width of a text in the font of an element, measured on a canvas (nothing changes in the page).
|
|
852
|
+
SliderField.measureText = function (text, elem) {
|
|
853
|
+
if (!SliderField.textCanvas) SliderField.textCanvas = document.createElement("canvas").getContext("2d");
|
|
854
|
+
const css = getComputedStyle(elem);
|
|
855
|
+
SliderField.textCanvas.font = css.fontStyle + " " + css.fontWeight + " " + css.fontSize + " " + css.fontFamily;
|
|
856
|
+
return SliderField.textCanvas.measureText(String(text)).width;
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
// *** STYLE PACKAGES:
|
|
860
|
+
// USAGE: SliderField({ styleName: "modern" })
|
|
861
|
+
// USAGE: SliderField({ styleName: "dark", style: { fill: { color: "#3D7A6B" } } }) // Change only some keys.
|
|
862
|
+
// USAGE: SliderField({ style: SliderField.styles.dark }) // The same as styleName: "dark". (The package is copied, never changed.)
|
|
863
|
+
// NOTE: A new package needs only the keys that differ from SliderFieldDefaults.style (the base of every package).
|
|
864
|
+
// USAGE: SliderField.styles.myStyle = { fill: { color: "gold" } };
|
|
865
|
+
SliderField.styles = {
|
|
866
|
+
|
|
867
|
+
// The light look of the kit (_designs/slider-field.htm), the default: a quiet gray field with round 6 corners, a
|
|
868
|
+
// fill in a tint of the accent that ends with a handle in the accent, a bold value, dots for the steps; the keyboard
|
|
869
|
+
// focus is the accent edge with a soft ring inside.
|
|
870
|
+
light: {
|
|
871
|
+
box: { color: "#F2F3F0", hoverColor: "", border: 1, borderColor: Black(0.08), round: 6, boxShadow: "none" },
|
|
872
|
+
boxFocus: { borderColor: "#3D7A6B", ringColor: "rgba(61, 122, 107, 0.5)", ringWidth: 2 },
|
|
873
|
+
fill: { color: "#D8E8E2", hoverColor: "#CCE1DA", activeColor: "#BFD9D0", minWidth: 26, round: 6 }, // the accent on the field at 22 %, 30 %, 38 %
|
|
874
|
+
handle: { width: 4, height: 18, inset: 11, color: "#3D7A6B", hoverColor: "#356C5E", activeColor: "#2E5F53", round: 2 },
|
|
875
|
+
tick: { size: 3, color: Black(0.15), minSpace: 9 },
|
|
876
|
+
label: { fontSize: 15, textColor: Black(0.55), fontFamily: "", padding: 14 },
|
|
877
|
+
value: { fontSize: 15, textColor: Black(0.88), fontFamily: "opensans-bold", padding: 14 },
|
|
878
|
+
input: { color: "#FFFFFF", textColor: Black(0.88), round: 6 },
|
|
879
|
+
disabled: { opacity: 0.45, filter: "none" },
|
|
880
|
+
},
|
|
881
|
+
|
|
882
|
+
// The dark look of the kit: the same shapes on the dark surface.
|
|
883
|
+
dark: {
|
|
884
|
+
box: { color: "#232322", hoverColor: "", border: 1, borderColor: White(0.08), round: 6, boxShadow: "none" },
|
|
885
|
+
boxFocus: { borderColor: "#65A293", ringColor: "rgba(101, 162, 147, 0.55)", ringWidth: 2 },
|
|
886
|
+
fill: { color: "rgba(101, 162, 147, 0.22)", hoverColor: "rgba(101, 162, 147, 0.28)", activeColor: "rgba(101, 162, 147, 0.34)", minWidth: 26, round: 6 },
|
|
887
|
+
handle: { width: 4, height: 18, inset: 11, color: "#65A293", hoverColor: "#74B0A2", activeColor: "#8CC2B5", round: 2 },
|
|
888
|
+
tick: { size: 3, color: White(0.2), minSpace: 9 },
|
|
889
|
+
label: { fontSize: 15, textColor: White(0.55), fontFamily: "", padding: 14 },
|
|
890
|
+
value: { fontSize: 15, textColor: White(0.9), fontFamily: "opensans-bold", padding: 14 },
|
|
891
|
+
input: { color: White(0.08), textColor: White(0.9), round: 6 },
|
|
892
|
+
disabled: { opacity: 0.4, filter: "none" },
|
|
893
|
+
},
|
|
894
|
+
|
|
895
|
+
// For general use: the colors of SmartButton and of ProgressBar
|
|
896
|
+
// ozden. The fill is a cyan SmartButton ozden (an edge and a line at its bottom) that ends with a white knob,
|
|
897
|
+
// straight inside the field. The label is always on the fill (aroundLabel) and the value never (beforeValue): the
|
|
898
|
+
// end of the fill cuts no text. A ring for the keyboard focus, a gray fill when it is off.
|
|
899
|
+
// Another tone: style: { fill: { color, hoverColor, activeColor } }.
|
|
900
|
+
// handle.inset -6: the middle of the knob is at the end of the fill. WHY a dark focus ring: the focus color of the
|
|
901
|
+
// kit (cadetblue) did not show on the cyan fill; black 50 % has a contrast of 3 on the fill and on the field.
|
|
902
|
+
ozden: {
|
|
903
|
+
box: { color: "#F2F2F2", hoverColor: "#EDEDED", border: 1, borderColor: "rgba(0, 0, 0, 0.12)", round: 8, boxShadow: "none" },
|
|
904
|
+
boxFocus: { borderColor: "rgba(0, 0, 0, 0.5)", ringColor: "rgba(0, 0, 0, 0.5)", ringWidth: 2 },
|
|
905
|
+
fill: { color: "#5BBAC1", hoverColor: "#50AEB5", activeColor: "#4AA5AC", minWidth: 28, round: 7, innerRound: 0, aroundLabel: 1, labelSpace: 16, beforeValue: 1, valueSpace: 16, border: 1, borderColor: "rgba(0, 0, 0, 0.35)", boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)" },
|
|
906
|
+
handle: { width: 12, height: 30, inset: -6, color: "#FFFFFF", hoverColor: "#FFFFFF", activeColor: "#F2F2F2", round: 4, border: 1, borderColor: "rgba(0, 0, 0, 0.35)", boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)" },
|
|
907
|
+
tick: { size: 4, color: "rgba(0, 0, 0, 0.2)", minSpace: 10 },
|
|
908
|
+
label: { fontSize: 16, textColor: "rgba(0, 0, 0, 0.7)", fontFamily: "", padding: 14 },
|
|
909
|
+
value: { fontSize: 16, textColor: "rgba(0, 0, 0, 0.8)", fontFamily: "opensans-bold", padding: 14 },
|
|
910
|
+
input: { color: "#FFFFFF", textColor: "rgba(0, 0, 0, 0.8)", round: 6 },
|
|
911
|
+
disabled: { opacity: 0.55, filter: "grayscale(1)" },
|
|
912
|
+
},
|
|
913
|
+
|
|
914
|
+
// Cadetblue fill. Same colors as the modern CheckBox, RadioButton, ProgressBar, Tabs and Stepper.
|
|
915
|
+
modern: {
|
|
916
|
+
box: { color: "#F1F6F6", border: 1, borderColor: "#DCE8E8", round: 100 },
|
|
917
|
+
boxFocus: { borderColor: "cadetblue" },
|
|
918
|
+
fill: { color: "#CFE2E2", hoverColor: "#C4DCDC", activeColor: "#B5D3D3", minWidth: 30, round: 100 },
|
|
919
|
+
handle: { width: 3, height: 16, inset: 13, color: "#6FA3A5", hoverColor: "#4F8A8C", activeColor: "#2F5F61", round: 2 },
|
|
920
|
+
tick: { size: 4, color: "#B9D2D3", minSpace: 10 },
|
|
921
|
+
label: { fontSize: 15, textColor: "#5E8F91", fontFamily: "", padding: 18 },
|
|
922
|
+
value: { fontSize: 15, textColor: "#2F5F61", fontFamily: "opensans-bold", padding: 18 },
|
|
923
|
+
input: { color: White(1), textColor: "#2F5F61", round: 100 },
|
|
924
|
+
disabled: { opacity: 0.5 },
|
|
925
|
+
},
|
|
926
|
+
|
|
927
|
+
};
|
|
928
|
+
SliderField.styles.classic = SliderField.styles.light; // the old name of light
|
|
929
|
+
|
|
930
|
+
// The minimal theme (_designs/minimal-theme.htm): a 28 px field with no fill and an edge of 3:1 at least (it is a
|
|
931
|
+
// control), a faint gray fill for the value, a thin handle that darkens under the mouse and is ink while it is dragged,
|
|
932
|
+
// a 12 px label and a 13 px value. WHY aroundLabel and beforeValue: the thin handle never crosses a text. The keyboard focus: a blue edge of 2 px. minimalDark: the same on a dark window.
|
|
933
|
+
SliderField.createMinimalStyle = function (colors) {
|
|
934
|
+
return {
|
|
935
|
+
height: 28,
|
|
936
|
+
style: {
|
|
937
|
+
box: { color: "transparent", hoverColor: "", border: 1, borderColor: colors.edge, round: 4, boxShadow: "none" },
|
|
938
|
+
boxFocus: { borderColor: colors.focus, ringColor: colors.focus, ringWidth: 1 },
|
|
939
|
+
fill: { color: colors.fill, hoverColor: colors.fillHover, activeColor: colors.fillActive, minWidth: 20, round: 3, innerRound: 0, aroundLabel: 1, labelSpace: 16, beforeValue: 1, valueSpace: 6, border: 0, borderColor: "transparent", boxShadow: "none" },
|
|
940
|
+
handle: { width: 2, height: 12, inset: 6, color: colors.edge, hoverColor: colors.edgeHover, activeColor: colors.ink, round: 1, border: 0, borderColor: "transparent", boxShadow: "none" },
|
|
941
|
+
tick: { size: 2, color: colors.line, minSpace: 8 },
|
|
942
|
+
label: { fontSize: 12, textColor: colors.softText, fontFamily: "", padding: 10 },
|
|
943
|
+
value: { fontSize: 13, textColor: colors.text, fontFamily: "", padding: 10 },
|
|
944
|
+
input: { color: colors.ground, textColor: colors.text, round: 3 },
|
|
945
|
+
disabled: { opacity: 0.4, filter: "none" },
|
|
946
|
+
},
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
SliderField.MINIMAL_COLORS = { ground: "#FFFFFF", text: Black(0.85), softText: Black(0.55), line: Black(0.2), edge: Black(0.45), edgeHover: Black(0.65), ink: "#1F1F1F", fill: Black(0.06), fillHover: Black(0.08), fillActive: Black(0.11), focus: "#3D8BD9" };
|
|
950
|
+
SliderField.styles.minimal = SliderField.createMinimalStyle(SliderField.MINIMAL_COLORS);
|
|
951
|
+
SliderField.MINIMAL_DARK_COLORS = { ground: "#1A1A19", text: White(0.88), softText: White(0.55), line: White(0.18), edge: White(0.42), edgeHover: White(0.62), ink: "#EDEDEB", fill: White(0.08), fillHover: White(0.11), fillActive: White(0.14), focus: "#7FB6DE" };
|
|
952
|
+
SliderField.styles.minimalDark = SliderField.createMinimalStyle(SliderField.MINIMAL_DARK_COLORS);
|