@litejs/ui 24.0.0-rc.6 → 24.7.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 +12 -8
- package/binding/persist.js +8 -18
- package/binding/svg.js +2 -2
- package/css/base.css +1 -0
- package/css/form.css +20 -20
- package/el/Slider.tpl +19 -17
- package/el/crop.ui +4 -3
- package/el/dialog.ui +15 -32
- package/el/form.ui +8 -8
- package/el/material.tpl +5 -5
- package/load.js +11 -12
- package/package.json +4 -3
- package/{shim/index.js → shim.js} +33 -33
- package/{index.js → ui.js} +399 -369
- package/binding/_default.js +0 -160
- package/binding/list.js +0 -86
- package/binding/sticky.js +0 -17
- package/binding/topfloat.js +0 -37
- package/shim/base64.js +0 -43
- package/shim/promise.js +0 -141
- package/shim/string.js +0 -98
- package/shim/typed.js +0 -31
package/README.md
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
|
|
2
|
-
[3]: https://
|
|
2
|
+
[3]: https://packagephobia.now.sh/badge?p=@litejs/ui
|
|
3
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
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
LiteJS UI – [![Size][3]][4] [![Buy Me A Tea][5]][6]
|
|
10
9
|
=========
|
|
11
10
|
|
|
12
|
-
LiteJS UI is an old-school framework for
|
|
11
|
+
LiteJS UI is an old-school framework for high-quality web UIs,
|
|
12
|
+
used on heavy-traffic websites since 2006.
|
|
13
13
|
|
|
14
|
-
- Dependency-free, weighs around 20KB (+8KB polyfills
|
|
14
|
+
- Dependency-free, weighs around 20KB (+8KB polyfills for ancient browsers).
|
|
15
15
|
- Written in ES5, compatible with all browsers (including IE5.5).
|
|
16
|
-
- No transpiling/compiling/bundling headache,
|
|
16
|
+
- No transpiling/compiling/bundling headache, just write a working code.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
For usage instructions, see [wiki](https://github.com/litejs/ui/wiki)
|
|
19
|
+
and [Quick-Start](https://github.com/litejs/litejs/wiki/Quick-Start) guide.
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
##
|
|
22
|
+
## Contributing
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
Follow [Coding Style Guide](https://github.com/litejs/litejs/wiki/Style-Guide),
|
|
25
|
+
run tests `npm install; npm test`.
|
|
26
|
+
|
|
27
|
+
> Copyright (c) 2006-2024 Lauri Rooden <lauri@rooden.ee>
|
|
24
28
|
[MIT License](https://litejs.com/MIT-LICENSE.txt) |
|
|
25
29
|
[GitHub repo](https://github.com/litejs/ui) |
|
|
26
30
|
[npm package](https://npmjs.org/package/@litejs/ui) |
|
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/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/css/base.css
CHANGED
package/css/form.css
CHANGED
|
@@ -87,13 +87,13 @@ option:disabled,
|
|
|
87
87
|
textarea:disabled,
|
|
88
88
|
select:disabled {
|
|
89
89
|
opacity: .6;
|
|
90
|
-
|
|
90
|
+
font-style: italic;
|
|
91
91
|
box-shadow: none;
|
|
92
92
|
cursor: not-allowed;
|
|
93
93
|
}
|
|
94
94
|
input[readonly] {
|
|
95
95
|
opacity: .6;
|
|
96
|
-
|
|
96
|
+
font-style: italic;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
input.Toggle {
|
|
@@ -122,14 +122,14 @@ input.Toggle:after {
|
|
|
122
122
|
top: -4px;
|
|
123
123
|
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
124
124
|
box-shadow:
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
126
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
127
127
|
}
|
|
128
128
|
input.Toggle:focus:after {
|
|
129
129
|
box-shadow:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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);
|
|
133
133
|
}
|
|
134
134
|
input.Toggle:checked:after {
|
|
135
135
|
background-color: #00a651;
|
|
@@ -170,10 +170,10 @@ input.Toggle:checked:active:after {
|
|
|
170
170
|
|
|
171
171
|
:focus {
|
|
172
172
|
outline: 0;
|
|
173
|
-
|
|
173
|
+
box-shadow: 0 0 6px -1px inset, 0 0 6px 1px;
|
|
174
174
|
}
|
|
175
175
|
:focus:not(:focus-visible) {
|
|
176
|
-
|
|
176
|
+
box-shadow: 0;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
.btn:active,
|
|
@@ -181,7 +181,7 @@ button:active,
|
|
|
181
181
|
select:active,
|
|
182
182
|
textarea:active,
|
|
183
183
|
input:active {
|
|
184
|
-
|
|
184
|
+
box-shadow: 0 0 8px 1px inset, 0 0 8px 2px;
|
|
185
185
|
}
|
|
186
186
|
input, textarea, select {
|
|
187
187
|
background: #eee;
|
|
@@ -194,25 +194,25 @@ input[type=submit] {
|
|
|
194
194
|
background: #aaa;
|
|
195
195
|
}
|
|
196
196
|
::file-selector-button {
|
|
197
|
-
|
|
197
|
+
box-shadow: 0 0 26px -5px inset;
|
|
198
198
|
}
|
|
199
199
|
:focus::file-selector-button {
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
input.Toggle:after {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
background-color: #666;
|
|
204
|
+
box-shadow:
|
|
205
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
206
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
207
207
|
}
|
|
208
208
|
input.Toggle:focus:after {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
box-shadow:
|
|
210
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
211
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
212
|
+
0 0 0 12px rgb(0, 0, 0, .2);
|
|
213
213
|
}
|
|
214
214
|
input.Toggle:checked:after {
|
|
215
|
-
|
|
215
|
+
background-color: #00a651;
|
|
216
216
|
}
|
|
217
217
|
/**/
|
|
218
218
|
|
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
CHANGED
|
@@ -26,14 +26,15 @@
|
|
|
26
26
|
|
|
27
27
|
%el Crop
|
|
28
28
|
.Crop
|
|
29
|
-
@pan function(e){
|
|
29
|
+
@pan function(e, touchEv, touchEl) {
|
|
30
|
+
El.css(touchEl, "top,left", [touchEv.topPos + "px", touchEv.leftPos + "px"],"img")
|
|
31
|
+
return El.stop(e)
|
|
32
|
+
}
|
|
30
33
|
@pinch function(zoom){
|
|
31
34
|
var imgWidth = $el.offsetWidth
|
|
32
35
|
scale(0,0)
|
|
33
|
-
El.on($el, "wheel", scale)
|
|
34
36
|
return scale
|
|
35
37
|
function scale(e, delta) {
|
|
36
|
-
console.log("pinch", arguments)
|
|
37
38
|
zoom += delta / 5
|
|
38
39
|
if (zoom < .5) zoom = .5
|
|
39
40
|
else if (zoom > 50) zoom = 50
|
package/el/dialog.ui
CHANGED
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
}
|
|
68
68
|
var sound, vibrate
|
|
69
69
|
, code = ""
|
|
70
|
-
, el = El("
|
|
71
|
-
, scope = Object.assign(El.scope(el,
|
|
70
|
+
, el = El("Dialog")
|
|
71
|
+
, scope = Object.assign(El.scope(el, el), opts)
|
|
72
72
|
, kbMap = {}
|
|
73
73
|
, body = document.body
|
|
74
74
|
, blurEl = $(scope.blur) || $ui.root.lastChild
|
|
@@ -81,9 +81,10 @@
|
|
|
81
81
|
if (a.key) kbMap[a.key] = resolve.bind(el, el, a.action)
|
|
82
82
|
}
|
|
83
83
|
El.cls(blurEl, "Modal--blur")
|
|
84
|
-
El
|
|
85
|
-
El.append(
|
|
86
|
-
El.
|
|
84
|
+
var mm = El("Modal")
|
|
85
|
+
El.append(mm, el)
|
|
86
|
+
El.append(body, mm)
|
|
87
|
+
El.render(mm)
|
|
87
88
|
if (scope.code) {
|
|
88
89
|
$$(".js-numpad", el).on("click", numpad)
|
|
89
90
|
kbMap.backspace = kbMap.del = kbMap.num = numpad
|
|
@@ -112,14 +113,14 @@
|
|
|
112
113
|
}
|
|
113
114
|
function resolve(e, key) {
|
|
114
115
|
if (el) {
|
|
115
|
-
var action = key || El.
|
|
116
|
+
var action = key || El.get(this, "data-action")
|
|
116
117
|
, result = {
|
|
117
118
|
code: code,
|
|
118
119
|
input: El.val($(".js-input", el)),
|
|
119
120
|
inputMd: El.val($(".js-inputMd", el)),
|
|
120
121
|
select: El.val($(".js-select", el))
|
|
121
122
|
}
|
|
122
|
-
El.kill(
|
|
123
|
+
El.kill(mm, "transparent")
|
|
123
124
|
El.cls(blurEl, "Modal--blur", el = false)
|
|
124
125
|
if (action && next) {
|
|
125
126
|
if (typeof next === "function") next(action, result)
|
|
@@ -147,7 +148,7 @@
|
|
|
147
148
|
})
|
|
148
149
|
|
|
149
150
|
%el Dialog
|
|
150
|
-
.Dialog.grid.p2.anim
|
|
151
|
+
.Dialog.grid.p2.anim
|
|
151
152
|
.col.ts3 ;txt!_(title, map)
|
|
152
153
|
.col.js-body ;md!_(body, map)
|
|
153
154
|
.col
|
|
@@ -156,31 +157,13 @@
|
|
|
156
157
|
;txt!_(action.title)
|
|
157
158
|
;class!"w" + (12/actions.length)
|
|
158
159
|
;nop: this.focus()
|
|
159
|
-
;
|
|
160
|
+
;set: "data-action", action.action
|
|
160
161
|
;class!"is-" + action.action, action.action
|
|
161
162
|
|
|
162
163
|
%el Modal
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.col>input.field.js-input
|
|
169
|
-
.row
|
|
170
|
-
;if: data.inputMd!=null
|
|
171
|
-
.col
|
|
172
|
-
textarea.field.js-inputMd
|
|
173
|
-
@keyup [this.parentNode.nextSibling.nextSibling], "renderMd"
|
|
174
|
-
;val: inputMd
|
|
175
|
-
.col.ts3 Preview
|
|
176
|
-
.p4
|
|
177
|
-
;md: inputMd
|
|
178
|
-
.row
|
|
179
|
-
;if: select
|
|
180
|
-
.col
|
|
181
|
-
select.field.js-select
|
|
182
|
-
;list: select, [""]
|
|
183
|
-
option
|
|
184
|
-
;val:: item.id
|
|
185
|
-
;txt:: _(item.name)
|
|
164
|
+
.Modal.max.fix.anim
|
|
165
|
+
.Modal-bg.max.abs
|
|
166
|
+
.Modal-content.Modal--blur.grid.p2.anim
|
|
167
|
+
;cls!"Modal--blur",!1,1
|
|
168
|
+
%slot
|
|
186
169
|
|
package/el/form.ui
CHANGED
|
@@ -206,7 +206,7 @@ Form-ro
|
|
|
206
206
|
|
|
207
207
|
%el Form-enum
|
|
208
208
|
Form-row
|
|
209
|
-
select.field ;each:val in
|
|
209
|
+
select.field ;each:val in $d["enum"]
|
|
210
210
|
option
|
|
211
211
|
;val:: val
|
|
212
212
|
= _("" + val)
|
|
@@ -217,7 +217,7 @@ Form-ro
|
|
|
217
217
|
%el Form-list
|
|
218
218
|
Form-row
|
|
219
219
|
select.field
|
|
220
|
-
;list: api(resourceCollection.format(
|
|
220
|
+
;list: api(resourceCollection.format(params, $d)), required ? 0 : [""], value
|
|
221
221
|
option
|
|
222
222
|
;val:: item.id
|
|
223
223
|
;txt:: _(item.name)
|
|
@@ -235,16 +235,16 @@ Form-row>span
|
|
|
235
235
|
= _(description)
|
|
236
236
|
.js-items.cf
|
|
237
237
|
a.btn.right
|
|
238
|
-
;if:
|
|
239
|
-
;txt: _(
|
|
240
|
-
@click:
|
|
238
|
+
;if: !$d.noAdd
|
|
239
|
+
;txt: _($d.name + ".Add")
|
|
240
|
+
@click: $d.add
|
|
241
241
|
|
|
242
242
|
%el Form-array-item
|
|
243
243
|
.input.p3.m2b.cf.js-del
|
|
244
244
|
a.right.Form-del.hand ×
|
|
245
|
-
;if
|
|
246
|
-
;
|
|
247
|
-
@click
|
|
245
|
+
;if !$d.noAdd
|
|
246
|
+
;set "data-tooltip", _("Delete")
|
|
247
|
+
@click $d.del
|
|
248
248
|
b
|
|
249
249
|
;if: title
|
|
250
250
|
;txt: title
|
package/el/material.tpl
CHANGED
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
function onOver(e) {
|
|
249
249
|
var x, y, pos
|
|
250
250
|
, target = e.target
|
|
251
|
-
, text = El.
|
|
251
|
+
, text = El.get(target, "data-tooltip")
|
|
252
252
|
, relTarg = e.relatedTarget || e.fromElement
|
|
253
253
|
// without relTarg is event on click
|
|
254
254
|
if (!relTarg && e.type !== "focusin" || target === tipTarget) return
|
|
@@ -260,19 +260,19 @@
|
|
|
260
260
|
closeTooltip()
|
|
261
261
|
if (!text) return
|
|
262
262
|
tipEl = openVisible("pre.tooltip", tipTarget = target)
|
|
263
|
-
pos = El.
|
|
263
|
+
pos = El.get(target, "data-tooltip-pos") || "top"
|
|
264
264
|
El.txt(tipEl, text)
|
|
265
265
|
if (pos === "left" || pos === "right") {
|
|
266
266
|
x = pos
|
|
267
267
|
} else {
|
|
268
268
|
y = pos
|
|
269
269
|
}
|
|
270
|
-
El.
|
|
270
|
+
El.set(tipEl, "data-pos", pos)
|
|
271
271
|
near(tipEl, target, x, y, 6)
|
|
272
272
|
}
|
|
273
273
|
function openVisible(tag, target) {
|
|
274
274
|
var el = typeof tag == "string" ? El(tag) : tag
|
|
275
|
-
, scope = El.scope(el,
|
|
275
|
+
, scope = El.scope(el, target)
|
|
276
276
|
scope.openTarget = target
|
|
277
277
|
El.render(el)
|
|
278
278
|
El.append(document.body, el)
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
})
|
|
314
314
|
} else {
|
|
315
315
|
El.cls(menuTarget = target, "is-active")
|
|
316
|
-
near(menuEl, target, x, y,
|
|
316
|
+
near(menuEl, target, x, y, margin)
|
|
317
317
|
}
|
|
318
318
|
if (menuEl.style.transform !== void 0) {
|
|
319
319
|
El.cls(menuEl, "no-events")
|
package/load.js
CHANGED
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
//!{loadRewrite}
|
|
25
25
|
}
|
|
26
26
|
// Move setTimeout from window.prototype to window object for future patching in IE9.
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
, setTimeout_ = window.setTimeout = setTimeout
|
|
28
|
+
/*** debug ***/
|
|
29
|
+
// Expose xhr._c for tests.
|
|
29
30
|
, loaded = xhr._c = {}
|
|
30
31
|
/*/
|
|
31
32
|
, loaded = {}
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
/*/
|
|
49
50
|
eval
|
|
50
51
|
/**/
|
|
52
|
+
, nop = Function()
|
|
51
53
|
|
|
52
54
|
/*** reuse ***/
|
|
53
55
|
// XHR memory leak mitigation
|
|
@@ -178,25 +180,23 @@
|
|
|
178
180
|
function load(files, next, raw) {
|
|
179
181
|
files = [].concat(files)
|
|
180
182
|
var file
|
|
181
|
-
, i = 0
|
|
182
183
|
, pos = 0
|
|
183
184
|
, len = files.length
|
|
184
185
|
, res = []
|
|
185
186
|
|
|
186
|
-
for (;
|
|
187
|
-
if (loaded[file])
|
|
187
|
+
for (; pos < len; pos++) if ((file = files[pos])) {
|
|
188
|
+
if (loaded[file] === 2) files[pos] = 0
|
|
189
|
+
else if (loaded[file]) {
|
|
188
190
|
// Same file requested again before responce
|
|
189
|
-
;(loaded[file].x || (loaded[file].x = [])).push(exec, res,
|
|
191
|
+
;(loaded[file].x || (loaded[file].x = [])).push(exec, res, pos)
|
|
190
192
|
} else {
|
|
191
193
|
// FireFox 3 throws on `xhr.send()` without arguments
|
|
192
|
-
xhr("GET", file, loaded[file] = cb,
|
|
194
|
+
xhr("GET", file, loaded[file] = cb, pos).send(null)
|
|
193
195
|
}
|
|
194
|
-
pos++
|
|
195
196
|
}
|
|
196
197
|
exec(pos = 0)
|
|
197
198
|
|
|
198
199
|
function cb(err, str, fileName, filePos) {
|
|
199
|
-
;(xhr._l || (xhr._l = [])).push(fileName)
|
|
200
200
|
loaded[fileName] = 2
|
|
201
201
|
res[filePos] = err ? (onerror(err, fileName), "") : str
|
|
202
202
|
exec()
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
files[pos] = 0
|
|
208
208
|
} else {
|
|
209
209
|
try {
|
|
210
|
-
var execResult = (xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos])
|
|
210
|
+
var execResult = (xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos], files[pos])
|
|
211
211
|
if (execResult && execResult.then) {
|
|
212
212
|
res[pos] = 0
|
|
213
213
|
return execResult.then(function() {
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
else {
|
|
231
231
|
if (next) next(res)
|
|
232
232
|
if ((next = cb.x)) {
|
|
233
|
-
for (
|
|
233
|
+
for (pos = 0; next[pos]; ) next[pos++](next[pos++][next[pos++]] = "")
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -242,6 +242,5 @@
|
|
|
242
242
|
])
|
|
243
243
|
/**/
|
|
244
244
|
|
|
245
|
-
function nop() {}
|
|
246
245
|
}(this, Function) // jshint ignore:line
|
|
247
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litejs/ui",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.7.0",
|
|
4
4
|
"description": "UI engine for LiteJS full-stack framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lauri Rooden <lauri@rooden.ee>",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"homepage": "https://litejs.com",
|
|
14
14
|
"repository": "github:litejs/ui",
|
|
15
15
|
"bugs": "https://github.com/litejs/dev/issues",
|
|
16
|
-
"main": "
|
|
16
|
+
"main": "ui.js",
|
|
17
17
|
"files": [
|
|
18
18
|
"*.js",
|
|
19
19
|
"binding",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"test": "lj test test/index.js --tz='Europe/Tallinn' --brief --sources=load.js,require.js,index.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@litejs/cli": "24.
|
|
29
|
+
"@litejs/cli": "24.6.2",
|
|
30
|
+
"@litejs/dom": "24.7.0"
|
|
30
31
|
}
|
|
31
32
|
}
|