@litejs/ui 24.0.0-rc.4 → 24.5.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.
- package/README.md +8 -11
- package/binding/persist.js +8 -18
- package/binding/sticky.js +2 -4
- package/binding/svg.js +2 -2
- package/binding/topfloat.js +1 -2
- package/css/base.css +11 -15
- package/css/form.css +168 -28
- package/css/grid.css +1 -1
- package/css/hr-label.css +21 -0
- package/css/smooth-scroll.css +8 -0
- package/el/Slider.tpl +19 -17
- package/el/crop.ui +49 -0
- package/el/{confirm.tpl → dialog.ui} +54 -42
- package/el/{form1.tpl → form.ui} +99 -99
- package/el/material.tpl +11 -11
- package/index.js +573 -571
- package/load.js +6 -9
- package/package.json +6 -21
- package/{polyfill → shim}/index.js +17 -17
- package/binding/_default.js +0 -165
- package/binding/list.js +0 -86
- package/css/form2.css +0 -142
- package/polyfill/base64.js +0 -43
- package/polyfill/blob.js +0 -5
- package/polyfill/promise.js +0 -141
- package/polyfill/string.js +0 -98
- package/polyfill/typed.js +0 -31
- package/stat.js +0 -205
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
[
|
|
3
|
-
[
|
|
1
|
+
|
|
2
|
+
[3]: https://badgen.net/packagephobia/install/@litejs/ui
|
|
3
|
+
[4]: https://packagephobia.now.sh/result?p=@litejs/ui
|
|
4
4
|
[5]: https://badgen.net/badge/icon/Buy%20Me%20A%20Tea/orange?icon=kofi&label
|
|
5
5
|
[6]: https://www.buymeacoffee.com/lauriro
|
|
6
|
+
[wiki]: https://github.com/litejs/ui/wiki
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
LiteJS UI – [![
|
|
9
|
+
LiteJS UI – [![Size][3]][4] [![Buy Me A Tea][5]][6]
|
|
9
10
|
=========
|
|
10
11
|
|
|
11
12
|
LiteJS UI is an old-school framework for making high-quality web UIs.
|
|
@@ -17,15 +18,11 @@ LiteJS UI is an old-school framework for making high-quality web UIs.
|
|
|
17
18
|
See [wiki][] for more information.
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
##
|
|
21
|
+
## Licence
|
|
21
22
|
|
|
23
|
+
Copyright (c) 2006-2024 Lauri Rooden <lauri@rooden.ee>
|
|
24
|
+
[MIT License](https://litejs.com/MIT-LICENSE.txt) |
|
|
22
25
|
[GitHub repo](https://github.com/litejs/ui) |
|
|
23
26
|
[npm package](https://npmjs.org/package/@litejs/ui) |
|
|
24
27
|
[Buy Me A Tea][6]
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
## Licence
|
|
28
|
-
|
|
29
|
-
Copyright (c) 2006-2023 Lauri Rooden <lauri@rooden.ee>
|
|
30
|
-
[The MIT License](https://litejs.com/MIT-LICENSE.txt)
|
|
31
|
-
|
package/binding/persist.js
CHANGED
|
@@ -3,22 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
/* global El */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (value) {
|
|
16
|
-
El.val(el, value)
|
|
17
|
-
}
|
|
18
|
-
El.on(el, "keyup change blur", function() {
|
|
19
|
-
window[stor].setItem(key, El.val(el))
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
bindingPersist.once = bindingPersist
|
|
23
|
-
}(El.bindings, window) // jshint ignore:line
|
|
6
|
+
/* global El, window */
|
|
7
|
+
El.$b.persist = function bindingPersist(el, key, surviveReboot) {
|
|
8
|
+
var stor = window[(surviveReboot ? "local" : "session") + "Storage"]
|
|
9
|
+
El.val(el, stor[key = key || el.id || el.name] || "")
|
|
10
|
+
El.on(el, "keyup change blur", function() {
|
|
11
|
+
stor[key] = El.val(el)
|
|
12
|
+
})
|
|
13
|
+
}
|
|
24
14
|
|
package/binding/sticky.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// .sticky { position: sticky; top: -1px; }
|
|
3
3
|
// .sticky.is-stuck { color: red; }
|
|
4
4
|
|
|
5
|
-
/* global El */
|
|
6
|
-
El.
|
|
5
|
+
/* global El, IntersectionObserver */
|
|
6
|
+
El.$b.sticky = function sticky(el) {
|
|
7
7
|
;(sticky._ob || (sticky._ob = new IntersectionObserver(function(entries) {
|
|
8
8
|
entries.forEach(function(entry) {
|
|
9
9
|
El.cls(entry.target, "is-stuck", entry.intersectionRatio < 1)
|
|
@@ -12,6 +12,4 @@ El.bindings.sticky = function sticky(el) {
|
|
|
12
12
|
El.cls(el, "sticky")
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
El.bindings.sticky.once = 1
|
|
16
|
-
|
|
17
15
|
|
package/binding/svg.js
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
bindings.svgToLast = function(el) {
|
|
86
86
|
El.on(el, "mouseover", function() {
|
|
87
87
|
if (!svgToLastActive || el != el.parentNode.lastChild) {
|
|
88
|
-
El.cls(svgToLastActive, "
|
|
88
|
+
El.cls(svgToLastActive, "is-active", 0)
|
|
89
89
|
El.append(el.parentNode, el)
|
|
90
90
|
El.cls(el, "is-active", svgToLastActive = el)
|
|
91
91
|
}
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
}
|
|
94
94
|
bindings.svgToLast.once =
|
|
95
95
|
bindings.initChart.once = 1
|
|
96
|
-
}(this.SVGElement, document, El
|
|
96
|
+
}(this.SVGElement, document, El.$b) // jshint ignore:line
|
|
97
97
|
|
package/binding/topfloat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/* global El, window */
|
|
3
|
-
El.
|
|
3
|
+
El.$b.topFloat = function(el, offset) {
|
|
4
4
|
var h = el.offsetHeight + offset
|
|
5
5
|
, lastAbs = 0
|
|
6
6
|
, lastTop = 0
|
|
@@ -32,6 +32,5 @@ El.bindings.topFloat = function(el, offset) {
|
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
El.bindings.topFloat.once = 1
|
|
36
35
|
|
|
37
36
|
|
package/css/base.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*, *:before, *:after {
|
|
19
19
|
color: inherit;
|
|
20
|
+
text-decoration: inherit;
|
|
20
21
|
-webkit-box-sizing: inherit; /* 3 */
|
|
21
22
|
-moz-box-sizing: inherit;
|
|
22
23
|
box-sizing: inherit;
|
|
@@ -34,6 +35,7 @@ html {
|
|
|
34
35
|
touch-action: manipulation; /* 4 */
|
|
35
36
|
-webkit-backface-visibility: hidden; /* 5 */
|
|
36
37
|
backface-visibility: hidden;
|
|
38
|
+
text-rendering: optimizeLegibility;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
html,
|
|
@@ -50,20 +52,12 @@ img,
|
|
|
50
52
|
outline: 0;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
* 1. Alternate cursor for IE
|
|
55
|
-
* 2. Fixes extra padding issue in IE6/7
|
|
56
|
-
* 3. Firefox default is: b, strong { font-weight: bolder; }
|
|
57
|
-
* and it does not render well with some fonts (Helvetica Neue on macs for example).
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
a,
|
|
55
|
+
a[href],
|
|
61
56
|
button,
|
|
62
57
|
label,
|
|
63
58
|
.btn,
|
|
64
59
|
.hand {
|
|
65
60
|
cursor: pointer;
|
|
66
|
-
*cursor: hand; /* 1 */
|
|
67
61
|
pointer-events: auto;
|
|
68
62
|
}
|
|
69
63
|
|
|
@@ -72,14 +66,16 @@ label,
|
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
button {
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
/* Fix extra padding issue in IE6/7 */
|
|
70
|
+
width: auto;
|
|
71
|
+
overflow: visible;
|
|
77
72
|
}
|
|
78
73
|
|
|
79
74
|
b,
|
|
80
75
|
strong,
|
|
81
76
|
th {
|
|
82
|
-
font-weight:
|
|
77
|
+
/* Firefox default {font-weight:bolder} does not render well with some fonts (Helvetica Neue on macs). */
|
|
78
|
+
font-weight: bold;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
audio,
|
|
@@ -91,7 +87,7 @@ input,
|
|
|
91
87
|
select,
|
|
92
88
|
svg,
|
|
93
89
|
video {
|
|
94
|
-
vertical-align:
|
|
90
|
+
vertical-align: top;
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
/**
|
|
@@ -120,7 +116,7 @@ textarea {
|
|
|
120
116
|
button,
|
|
121
117
|
[draggable=true],
|
|
122
118
|
.btn,
|
|
123
|
-
.
|
|
119
|
+
.no-select {
|
|
124
120
|
-webkit-user-select: none;
|
|
125
121
|
-khtml-user-select: none;
|
|
126
122
|
-moz-user-select: none;
|
|
@@ -190,7 +186,7 @@ button,
|
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
.btn,
|
|
193
|
-
.
|
|
189
|
+
.no-wrap,
|
|
194
190
|
.ellipsis {
|
|
195
191
|
text-overflow: ellipsis;
|
|
196
192
|
white-space: nowrap;
|
package/css/form.css
CHANGED
|
@@ -1,60 +1,203 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
::-moz-focus-inner {
|
|
4
|
+
border: 0;
|
|
5
|
+
padding: 0;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
background: #c4c4c4;
|
|
8
|
+
fieldset {
|
|
9
|
+
position: relative;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
label {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
line-height: 32px;
|
|
14
|
+
text-overflow: ellipsis;
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
input, select, textarea {
|
|
18
|
+
width: 100%;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
.btn, button,
|
|
22
|
+
input,
|
|
23
|
+
select,
|
|
24
|
+
textarea {
|
|
25
|
+
font: inherit;
|
|
26
|
+
line-height: 30px;
|
|
24
27
|
display: block;
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
border: 1px solid;
|
|
30
|
+
padding: 0 8px;
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
select {
|
|
34
|
+
padding: 0 4px;
|
|
35
|
+
}
|
|
36
|
+
select[multiple] {
|
|
37
|
+
height: auto;
|
|
38
|
+
padding: 4px 0;
|
|
39
|
+
}
|
|
40
|
+
option {
|
|
41
|
+
padding: 2px 8px;
|
|
42
|
+
}
|
|
43
|
+
textarea {
|
|
44
|
+
height: 64px;
|
|
45
|
+
padding: 8px;
|
|
46
|
+
line-height: 1.2;
|
|
47
|
+
}
|
|
48
|
+
.btn,
|
|
49
|
+
button,
|
|
50
|
+
input[type=button],
|
|
51
|
+
input[type=submit] {
|
|
52
|
+
-webkit-appearance: none; /* remove ios styling */
|
|
53
|
+
-moz-appearance: none;
|
|
54
|
+
appearance: none;
|
|
25
55
|
position: relative;
|
|
56
|
+
padding: 0px 14px;
|
|
57
|
+
text-align: center;
|
|
58
|
+
text-decoration: none;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
input[type=radio],
|
|
62
|
+
input[type=checkbox] {
|
|
63
|
+
border-radius: 10px;
|
|
64
|
+
width: auto;
|
|
65
|
+
height: auto;
|
|
66
|
+
display: inline;
|
|
67
|
+
margin-top: 6px;
|
|
68
|
+
}
|
|
69
|
+
input[type=file] {
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
::file-selector-button {
|
|
74
|
+
font: inherit;
|
|
75
|
+
border: 0;
|
|
76
|
+
border-right: 1px solid;
|
|
77
|
+
padding: 0 8px;
|
|
78
|
+
margin: 0 8px 0 0;
|
|
79
|
+
background: transparent;
|
|
80
|
+
}
|
|
81
|
+
input[type=time] {
|
|
82
|
+
padding: 0 0 0 8px;
|
|
83
|
+
}
|
|
84
|
+
.btn:disabled,
|
|
85
|
+
input:disabled,
|
|
86
|
+
option:disabled,
|
|
87
|
+
textarea:disabled,
|
|
88
|
+
select:disabled {
|
|
89
|
+
opacity: .6;
|
|
90
|
+
font-style: italic;
|
|
91
|
+
box-shadow: none;
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
input[readonly] {
|
|
95
|
+
opacity: .6;
|
|
96
|
+
font-style: italic;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
input.Toggle {
|
|
26
100
|
-webkit-appearance: none;
|
|
27
101
|
-moz-appearance: none;
|
|
28
102
|
appearance: none;
|
|
103
|
+
position: relative;
|
|
104
|
+
padding: 0;
|
|
105
|
+
outline: 0;
|
|
29
106
|
width: 36px;
|
|
30
107
|
height: 14px;
|
|
31
108
|
margin: 4px 0;
|
|
32
|
-
padding: 0;
|
|
33
109
|
border-radius: 7px;
|
|
34
110
|
}
|
|
35
111
|
input.Toggle:after {
|
|
36
|
-
display: block;
|
|
37
112
|
position: relative;
|
|
38
|
-
content: "";
|
|
39
113
|
width: 20px;
|
|
40
114
|
height: 20px;
|
|
41
115
|
border-radius: 10px;
|
|
116
|
+
}
|
|
117
|
+
input.Toggle:after {
|
|
118
|
+
content: "";
|
|
119
|
+
display: block;
|
|
120
|
+
background-color: #666;
|
|
42
121
|
left: -3px;
|
|
43
122
|
top: -4px;
|
|
44
123
|
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
124
|
+
box-shadow:
|
|
125
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
126
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
127
|
+
}
|
|
128
|
+
input.Toggle:focus:after {
|
|
129
|
+
box-shadow:
|
|
130
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
131
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
132
|
+
0 0 0 12px rgb(255, 255, 255, .2);
|
|
45
133
|
}
|
|
46
134
|
input.Toggle:checked:after {
|
|
47
|
-
|
|
135
|
+
background-color: #00a651;
|
|
136
|
+
left: 17px;
|
|
48
137
|
}
|
|
49
138
|
input.Toggle:active:after {
|
|
50
139
|
width: 30px;
|
|
51
140
|
}
|
|
52
141
|
input.Toggle:checked:active:after {
|
|
53
|
-
left:
|
|
142
|
+
left: 7px;
|
|
54
143
|
}
|
|
55
144
|
|
|
56
145
|
|
|
57
|
-
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
.group {
|
|
152
|
+
padding: 0 1px;
|
|
153
|
+
}
|
|
154
|
+
.group > .btn {
|
|
155
|
+
display: inline-block;
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
margin: 0 -1px;
|
|
158
|
+
}
|
|
159
|
+
.group > .btn:first-child {
|
|
160
|
+
border-top-left-radius: 5px;
|
|
161
|
+
border-bottom-left-radius: 5px;
|
|
162
|
+
}
|
|
163
|
+
.group > .btn:last-child {
|
|
164
|
+
border-top-right-radius: 5px;
|
|
165
|
+
border-bottom-right-radius: 5px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
/*** theme ***/
|
|
170
|
+
|
|
171
|
+
:focus {
|
|
172
|
+
outline: 0;
|
|
173
|
+
box-shadow: 0 0 6px -1px inset, 0 0 6px 1px;
|
|
174
|
+
}
|
|
175
|
+
:focus:not(:focus-visible) {
|
|
176
|
+
box-shadow: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.btn:active,
|
|
180
|
+
button:active,
|
|
181
|
+
select:active,
|
|
182
|
+
textarea:active,
|
|
183
|
+
input:active {
|
|
184
|
+
box-shadow: 0 0 8px 1px inset, 0 0 8px 2px;
|
|
185
|
+
}
|
|
186
|
+
input, textarea, select {
|
|
187
|
+
background: #eee;
|
|
188
|
+
}
|
|
189
|
+
.btn,
|
|
190
|
+
button,
|
|
191
|
+
option:checked,
|
|
192
|
+
input[type=button],
|
|
193
|
+
input[type=submit] {
|
|
194
|
+
background: #aaa;
|
|
195
|
+
}
|
|
196
|
+
::file-selector-button {
|
|
197
|
+
box-shadow: 0 0 26px -5px inset;
|
|
198
|
+
}
|
|
199
|
+
:focus::file-selector-button {
|
|
200
|
+
}
|
|
58
201
|
|
|
59
202
|
input.Toggle:after {
|
|
60
203
|
background-color: #666;
|
|
@@ -66,14 +209,11 @@ input.Toggle:focus:after {
|
|
|
66
209
|
box-shadow:
|
|
67
210
|
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
68
211
|
0 1px 5px rgba(0, 0, 0, 1),
|
|
69
|
-
0 0 0 12px rgb(
|
|
212
|
+
0 0 0 12px rgb(0, 0, 0, .2);
|
|
70
213
|
}
|
|
71
214
|
input.Toggle:checked:after {
|
|
72
215
|
background-color: #00a651;
|
|
73
216
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
217
|
+
/**/
|
|
78
218
|
|
|
79
219
|
|
package/css/grid.css
CHANGED
package/css/hr-label.css
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
<hr label="or continue with">
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
hr {
|
|
7
|
+
border: none;
|
|
8
|
+
border-top: currentColor solid 1px;
|
|
9
|
+
overflow: visible;
|
|
10
|
+
text-align: center;
|
|
11
|
+
height: 1px;
|
|
12
|
+
margin: 1em 0;
|
|
13
|
+
}
|
|
14
|
+
hr[label]:after {
|
|
15
|
+
background-color: inherit;
|
|
16
|
+
content: attr(label);
|
|
17
|
+
padding: 0 1em;
|
|
18
|
+
position: relative;
|
|
19
|
+
top: -12px;
|
|
20
|
+
}
|
|
21
|
+
|
package/el/Slider.tpl
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
width: 4px;
|
|
15
15
|
height: 100%;
|
|
16
16
|
}
|
|
17
|
-
.is-vertical >
|
|
17
|
+
.is-vertical > * > .Slider-fill {
|
|
18
18
|
top: auto;
|
|
19
19
|
bottom: 0;
|
|
20
20
|
width: 4px;
|
|
21
21
|
}
|
|
22
|
-
.is-vertical >
|
|
22
|
+
.is-vertical > * > * > .Slider-knob {
|
|
23
23
|
margin: -10px -8px 0 0;
|
|
24
24
|
}
|
|
25
25
|
.Slider-track {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
height: 4px;
|
|
32
32
|
border-radius: 2px;
|
|
33
33
|
overflow: visible;
|
|
34
|
-
background: #
|
|
34
|
+
background: #999;
|
|
35
35
|
}
|
|
36
36
|
.Slider-fill {
|
|
37
|
-
background: rgba(
|
|
37
|
+
background: rgba(0,0,0,.5);
|
|
38
38
|
}
|
|
39
39
|
.Slider-knob,
|
|
40
40
|
.Toggle-knob {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
height: 20px;
|
|
44
44
|
border-radius: 50%;
|
|
45
45
|
box-shadow:
|
|
46
|
+
0 0 0 0 rgb(0, 0, 0, .2),
|
|
46
47
|
0 1px 4px rgba(0, 0, 0, .2);
|
|
47
48
|
}
|
|
48
49
|
.Slider-knob {
|
|
@@ -52,9 +53,10 @@
|
|
|
52
53
|
background: #f5f5f5;
|
|
53
54
|
background-color: rgb(245, 245, 245);
|
|
54
55
|
}
|
|
55
|
-
.Slider-knob
|
|
56
|
-
.Slider-knob
|
|
57
|
-
:
|
|
56
|
+
:hover > * > * > .Slider-knob,
|
|
57
|
+
:focus > * > * > .Slider-knob,
|
|
58
|
+
:focus > .Toggle-knob,
|
|
59
|
+
:hover > .Toggle-knob {
|
|
58
60
|
box-shadow:
|
|
59
61
|
0 0 0 8px rgb(0, 0, 0, .2),
|
|
60
62
|
0 1px 4px rgba(0, 0, 0, .3);
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
0 0 0 12px rgb(0, 0, 0, .2),
|
|
65
67
|
0 1px 5px 5px rgba(0, 0, 0, .3);
|
|
66
68
|
}
|
|
69
|
+
/* value bubble */
|
|
67
70
|
.Slider-knob.is-active:before,
|
|
68
71
|
.Slider-knob.is-active:after {
|
|
69
72
|
position: absolute;
|
|
@@ -144,8 +147,8 @@
|
|
|
144
147
|
%js
|
|
145
148
|
var on = El.on
|
|
146
149
|
, off = El.off
|
|
147
|
-
El.
|
|
148
|
-
var knobLen, offset, px, drag, min, max, step, minPx, maxPx, value
|
|
150
|
+
El.$b.SliderInit = function(el) {
|
|
151
|
+
var attr, range, knobLen, offset, px, drag, min, max, step, minPx, maxPx, value
|
|
149
152
|
, vert = El.hasClass(el, "is-vertical")
|
|
150
153
|
, track = el.firstChild
|
|
151
154
|
, fill = track.firstChild
|
|
@@ -156,8 +159,8 @@
|
|
|
156
159
|
el.val = set
|
|
157
160
|
setTimeout(function() { set(value||0) }, 10)
|
|
158
161
|
function load() {
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
attr = vert ? "offsetHeight" : "offsetWidth"
|
|
163
|
+
range = (El.get(el, "range") || "").split(/[^+\-\d.]/) // min:max:step:margin
|
|
161
164
|
min = +(range[0] || 0)
|
|
162
165
|
max = +(range[1] || 100)
|
|
163
166
|
step = +(range[2] || 1)
|
|
@@ -227,21 +230,20 @@
|
|
|
227
230
|
if (value !== val) {
|
|
228
231
|
el.value = value = val
|
|
229
232
|
if (drag && e) emit(e)
|
|
230
|
-
var format = El.
|
|
231
|
-
El.
|
|
233
|
+
var format = El.get(el, "format")
|
|
234
|
+
El.set(knob, "data-val", format ? _(format, {val:val}) : val)
|
|
232
235
|
}
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
|
-
El.bindings.SliderInit.once = 1
|
|
236
238
|
|
|
237
239
|
%el Slider
|
|
238
|
-
button.Slider.reset ;SliderInit
|
|
240
|
+
button.Slider.reset ;SliderInit!
|
|
239
241
|
.Slider-track
|
|
240
242
|
.Slider-fill.abs.anim
|
|
241
243
|
.Slider-knob.anim[tabindex=0]
|
|
242
244
|
|
|
243
245
|
/%el Slider2
|
|
244
|
-
/ button.Slider.reset ;SliderInit
|
|
246
|
+
/ button.Slider.reset ;SliderInit!
|
|
245
247
|
/ .Slider-track
|
|
246
248
|
/ .Slider-fill.abs.anim
|
|
247
249
|
/ .Slider-knob.anim[tabindex=0]
|
|
@@ -249,7 +251,7 @@
|
|
|
249
251
|
/ .Slider-knob.anim[tabindex=0]
|
|
250
252
|
/
|
|
251
253
|
/%el Slider3
|
|
252
|
-
/ button.Slider.reset ;SliderInit
|
|
254
|
+
/ button.Slider.reset ;SliderInit!
|
|
253
255
|
/ .Slider-track
|
|
254
256
|
/ .Slider-fill.abs.anim
|
|
255
257
|
/ .Slider-knob.anim[tabindex=0]
|
package/el/crop.ui
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
%css
|
|
3
|
+
.Crop {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 400px;
|
|
6
|
+
height: 300px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
.Crop-img {
|
|
10
|
+
position: absolute;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
}
|
|
13
|
+
.Crop:after {
|
|
14
|
+
position: absolute;
|
|
15
|
+
content: "";
|
|
16
|
+
width: 150px;
|
|
17
|
+
height: 150px;
|
|
18
|
+
top: 75px;
|
|
19
|
+
left: 125px;
|
|
20
|
+
border: 2px solid #fff;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
box-shadow: 0 0 2000px 2000px rgba(0, 0, 0, 0.5);
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
%el Crop
|
|
28
|
+
.Crop
|
|
29
|
+
@pan function(e){}
|
|
30
|
+
@pinch function(zoom){
|
|
31
|
+
var imgWidth = $el.offsetWidth
|
|
32
|
+
scale(0,0)
|
|
33
|
+
El.on($el, "wheel", scale)
|
|
34
|
+
return scale
|
|
35
|
+
function scale(e, delta) {
|
|
36
|
+
console.log("pinch", arguments)
|
|
37
|
+
zoom += delta / 5
|
|
38
|
+
if (zoom < .5) zoom = .5
|
|
39
|
+
else if (zoom > 50) zoom = 50
|
|
40
|
+
El.css($el.firstChild, "width", (imgWidth * zoom) + "px")
|
|
41
|
+
}
|
|
42
|
+
}(1)
|
|
43
|
+
img.Crop-img[src="img/pixabay.com-mountain-8330401_640.jpg"]
|
|
44
|
+
|
|
45
|
+
%view test/crop public
|
|
46
|
+
anim-page
|
|
47
|
+
h2 Crop image
|
|
48
|
+
Crop
|
|
49
|
+
|