@litejs/ui 26.3.0 → 26.8.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 +2 -1
- package/css/anim.css +14 -2
- package/css/global.css +6 -0
- package/el/dialog.ui +41 -32
- package/el/gallery.ui +187 -0
- package/el/menu.ui +5 -4
- package/el/slider.ui +8 -8
- package/el/sortable.ui +85 -0
- package/load.js +1 -1
- package/package.json +2 -2
- package/shim.js +27 -17
- package/ui.js +323 -176
package/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/* litejs.com/MIT-LICENSE.txt */
|
|
3
3
|
|
|
4
|
-
/* global
|
|
4
|
+
/* global xhr */
|
|
5
5
|
|
|
6
6
|
// Conditional compilation via toggle comments (processed by build tool):
|
|
7
7
|
// /*** name ***/ code /**/ - `code` active in source; build can strip it
|
|
@@ -21,6 +21,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
21
21
|
, THIS = this
|
|
22
22
|
, html = document.documentElement
|
|
23
23
|
, body = document.body
|
|
24
|
+
, canTransit = "on" + (canTransit = "transitionend") in body && canTransit
|
|
24
25
|
, splitRe = /[,\s]+/
|
|
25
26
|
, emptyArr = []
|
|
26
27
|
, plugins = {}
|
|
@@ -32,12 +33,11 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
32
33
|
, hasOwn = bind(plugins.hasOwnProperty)
|
|
33
34
|
, isArr = Array.isArray
|
|
34
35
|
, slice = emptyArr.slice
|
|
35
|
-
|
|
36
|
-
,
|
|
37
|
-
,
|
|
38
|
-
,
|
|
39
|
-
,
|
|
40
|
-
, toCamel = replace.bind(NUL, /\-([a-z])/g, Function("a,b", "return b.toUpperCase()"))
|
|
36
|
+
, elReplace = function(el, to, p) { if (el && to && (p = el.parentNode)) p.replaceChild(to, el) }
|
|
37
|
+
, elRm = function(el, p) { if (el && (p = el.parentNode)) p.removeChild(el) }
|
|
38
|
+
, getAttr = function(el, key) { return el && el.getAttribute && el.getAttribute(key) }
|
|
39
|
+
, replace = function(re, to, str) { return str.replace(re, to) }
|
|
40
|
+
, toCamel = function(str) { return str.replace(/\-([a-z])/g, function(_, ch) { return ch.toUpperCase() }) }
|
|
41
41
|
|
|
42
42
|
/*** ie9 ***/
|
|
43
43
|
// JScript engine in IE8 and below does not recognize vertical tabulation character `\v`.
|
|
@@ -57,30 +57,25 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
57
57
|
|
|
58
58
|
, elSeq = 0
|
|
59
59
|
, elCache = {}
|
|
60
|
-
// Parses ";name! args" binding expressions from _b attribute
|
|
61
|
-
, renderRe = /[;\s]*([-.\w$]+)(?:(!?)[ :]*((?:(["'\/])(?:\\.|[^\\])*?\4|[^;])*))?/g
|
|
62
60
|
// Parses CSS selectors: .class #id [attr=val] :pseudo
|
|
63
61
|
, selectorRe = /([.#:[])([-\w]+)(?:([~^$*|]?)=(("|')(?:\\.|[^\\])*?\5|[-\w]+))?]?/g
|
|
64
62
|
, fnCache = {}
|
|
65
63
|
// Matches tokens to exclude from scope variable extraction: strings, keywords, member access, labels
|
|
66
64
|
, fnRe = /('|")(?:\\.|[^\\])*?\1|\/(?:\\.|[^\\])+?\/[gim]*|\$el\b|\$[aorsS]\b|\b(?:false|in|if|new|null|this|true|typeof|void|function|var|else|return)\b|\.\w+|\w+:/g
|
|
67
65
|
, wordRe = /[a-z_$][\w$]*/ig
|
|
66
|
+
, bindingsCls = acceptMany(cls)
|
|
68
67
|
, bindingsCss = acceptMany(function(el, key, val, current) {
|
|
69
68
|
current = el.style[key = toCamel(key)]
|
|
70
69
|
el.style[key] = val
|
|
71
70
|
return current
|
|
72
71
|
})
|
|
73
72
|
, bindingsOn = acceptMany(addEvent, 1)
|
|
73
|
+
, bindingsOff = acceptMany(rmEvent)
|
|
74
74
|
, bindings = {
|
|
75
|
-
cls:
|
|
75
|
+
cls: bindingsCls,
|
|
76
76
|
css: bindingsCss,
|
|
77
77
|
on: bindingsOn,
|
|
78
|
-
one: acceptMany(
|
|
79
|
-
addEvent(el, ev, function remove() {
|
|
80
|
-
rmEvent(el, ev, remove)
|
|
81
|
-
fn.apply(el, arguments)
|
|
82
|
-
})
|
|
83
|
-
}, 1),
|
|
78
|
+
one: acceptMany(onceEvent, 1),
|
|
84
79
|
set: acceptMany(setAttr),
|
|
85
80
|
txt: elTxt,
|
|
86
81
|
/*** form ***/
|
|
@@ -187,10 +182,12 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
187
182
|
, fixFn = Event.fixFn || (Event.fixFn = {})
|
|
188
183
|
|
|
189
184
|
/*** markup ***/
|
|
190
|
-
, blockRe = /^(?:(=+|>|
|
|
185
|
+
, blockRe = /^(?:(=+|>| -| \d+\.) ([\s\S]+))/
|
|
191
186
|
, tags = {
|
|
192
187
|
" -": "ul",
|
|
193
|
-
"
|
|
188
|
+
"\"": "q",
|
|
189
|
+
"%": "small",
|
|
190
|
+
"&": "kbd",
|
|
194
191
|
"*": "b",
|
|
195
192
|
"+": "ins",
|
|
196
193
|
",": "sub",
|
|
@@ -199,33 +196,57 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
199
196
|
":": "mark",
|
|
200
197
|
";": "span",
|
|
201
198
|
">": "blockquote",
|
|
199
|
+
"?": "abbr",
|
|
202
200
|
"@": "time",
|
|
203
201
|
"^": "sup",
|
|
204
202
|
"_": "u",
|
|
205
203
|
"`": "code",
|
|
206
204
|
"~": "s"
|
|
207
205
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
)
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
206
|
+
, abbrs = {}
|
|
207
|
+
, embeds = {}
|
|
208
|
+
function a(name, val) {
|
|
209
|
+
return val ? " " + name + "=\"" + replace(/"/g, """, val) + "\"" : ""
|
|
210
|
+
}
|
|
211
|
+
function renderOp(op, text, extra) {
|
|
212
|
+
var num = parseInt(op, 10)
|
|
213
|
+
, tag = num >= 0 ? (extra += a("start", num != 1 && "" + num), "ol") : tags[op] || "h" + op.length
|
|
214
|
+
return "<" + (extra ? tag + extra : tag) + ">" + (
|
|
215
|
+
op === ">" ? doc(replace(/^> ?/gm, "", text)) :
|
|
216
|
+
tag == "ul" || num >= 0 ? "<li>" + text.split(/\n (?:\d+\.|-) (?=\S)/).map(inline).join("</li>\n<li>") + "</li>" :
|
|
217
|
+
inline(text)
|
|
218
|
+
) + "</" + tag + ">"
|
|
219
|
+
}
|
|
220
|
+
function inline(tag, text, url, op, content, attr) {
|
|
221
|
+
var extra = attr ? a("class", attr.slice(1)) : ""
|
|
222
|
+
if (url && !isArr(url)) {
|
|
223
|
+
return "<a" + a("href", url) + extra + ">" + inline(text || url) + "</a>"
|
|
224
|
+
}
|
|
225
|
+
if (op) {
|
|
226
|
+
if (op == "!") {
|
|
227
|
+
var fn = embeds[content.split(":")[0]]
|
|
228
|
+
return fn ? fn(content, text, extra, a) :
|
|
229
|
+
"<img" + a("src", content) + a("alt", text || replace(/.*\//, "", content)) + extra + ">"
|
|
230
|
+
}
|
|
231
|
+
if (op == "?") {
|
|
232
|
+
if (text) abbrs[content] = text
|
|
233
|
+
else text = abbrs[content]
|
|
234
|
+
}
|
|
235
|
+
extra += op == "@" ? a("datetime", content) : a(op == "\"" ? "cite" : "title", text)
|
|
236
|
+
if (op == "@") {
|
|
237
|
+
content = text || content
|
|
238
|
+
}
|
|
239
|
+
return renderOp(op, content, extra)
|
|
240
|
+
}
|
|
241
|
+
return replace(/\[(?:(.+?) )?(?:<([^>]+)>|([-!"%&*+,/:;?@^_`~])(.+?)\3)(\.[\w.]+)?]/g, inline, tag)
|
|
242
|
+
}
|
|
243
|
+
function block(tag, op, text) {
|
|
244
|
+
return op && !isArr(text) ? renderOp(op, text, "") :
|
|
224
245
|
blockRe.test(tag) ? replace(blockRe, block, tag) :
|
|
225
246
|
tag === "---" ? "<hr>" : "<p>" + inline(tag) + "</p>"
|
|
226
247
|
}
|
|
227
248
|
function doc(txt) {
|
|
228
|
-
return replace(/^ \b/gm, "<br>", txt.trim()).split(/\n\n+/).map(block).join("\n")
|
|
249
|
+
return replace(/^ (?!\d+\. )\b/gm, "<br>", txt.trim()).split(/\n\n+/).map(block).join("\n")
|
|
229
250
|
}
|
|
230
251
|
bindings.t = function(el, text) {
|
|
231
252
|
el.innerHTML = inline(replace(/</g, "<", text))
|
|
@@ -233,6 +254,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
233
254
|
bindings.d = function(el, text) {
|
|
234
255
|
el.innerHTML = doc(replace(/</g, "<", text))
|
|
235
256
|
}
|
|
257
|
+
bindings.d.embed = embeds
|
|
236
258
|
/**/
|
|
237
259
|
|
|
238
260
|
/*** svg ***/
|
|
@@ -305,17 +327,23 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
305
327
|
if (emitter === window) emitter = emptyArr
|
|
306
328
|
var args, i
|
|
307
329
|
, _e = emitter._e
|
|
308
|
-
, arr = _e
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
, arr = _e && _e[type] || emptyArr
|
|
331
|
+
, wild = _e && _e["*"] || emptyArr
|
|
332
|
+
, len = arr.length + wild.length
|
|
333
|
+
if (len) {
|
|
334
|
+
args = slice.call(arguments, 2)
|
|
335
|
+
for (i = arr.length - 1; i > 1; i -= 3) {
|
|
311
336
|
if (arr[i]) arr[i].apply(arr[i - 2] || emitter, args)
|
|
312
337
|
}
|
|
338
|
+
for (i = wild.length - 1; i > 1; i -= 3) {
|
|
339
|
+
if (wild[i]) wild[i].apply(wild[i - 2] || emitter, args)
|
|
340
|
+
}
|
|
313
341
|
}
|
|
314
|
-
return
|
|
342
|
+
return len / 3
|
|
315
343
|
}
|
|
316
344
|
|
|
317
|
-
function addEvent(el, ev, fn, opts) {
|
|
318
|
-
var fn2 = fixFn[ev] && fixFn[ev](el, fn, ev) || fn
|
|
345
|
+
function addEvent(el, ev, fn, opts, fix) {
|
|
346
|
+
var fn2 = fix || fixFn[ev] && fixFn[ev](el, fn, ev) || fn
|
|
319
347
|
, ev2 = fixEv[ev] || ev
|
|
320
348
|
|
|
321
349
|
if (ev2 !== "") {
|
|
@@ -328,7 +356,12 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
328
356
|
|
|
329
357
|
on(el, ev, fn2, el, fn)
|
|
330
358
|
}
|
|
331
|
-
|
|
359
|
+
function onceEvent(el, ev, fn, opts) {
|
|
360
|
+
if (ev) bindingsOn(el, ev, function remove() {
|
|
361
|
+
bindingsOff(el, ev, remove, 0, 0, opts)
|
|
362
|
+
fn.apply(el, arguments)
|
|
363
|
+
}, 0, 0, opts)
|
|
364
|
+
}
|
|
332
365
|
function rmEvent(el, ev, fn, opts) {
|
|
333
366
|
var evs = el._e && el._e[ev]
|
|
334
367
|
, id = evs && evs.indexOf(fn)
|
|
@@ -394,6 +427,10 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
394
427
|
|
|
395
428
|
asEmitter(View)
|
|
396
429
|
asEmitter(View.prototype = {
|
|
430
|
+
show: function(params) {
|
|
431
|
+
lastView = this
|
|
432
|
+
bubbleUp(lastParams = params || {})
|
|
433
|
+
},
|
|
397
434
|
wait: function() {
|
|
398
435
|
var params = lastParams
|
|
399
436
|
params._p = 1 + (params._p | 0) // pending
|
|
@@ -508,8 +545,6 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
508
545
|
viewEmit(view, "pong", params, View)
|
|
509
546
|
}
|
|
510
547
|
viewEmit(lastView, "show", params)
|
|
511
|
-
close = history.state || 0
|
|
512
|
-
scrollTo(close.x|0, close.y|0)
|
|
513
548
|
blur()
|
|
514
549
|
}
|
|
515
550
|
function viewClose(view, open) {
|
|
@@ -728,9 +763,9 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
728
763
|
var expr = getAttr(plugin.e, "_b")
|
|
729
764
|
, view = View(plugin.n, usePluginContent(plugin), plugin.x)
|
|
730
765
|
if (expr) {
|
|
731
|
-
viewEval(
|
|
766
|
+
viewEval(renderEach(expr, function(_, name, op, args) {
|
|
732
767
|
return "($s." + name + (isFn(view[name]) ? "(" + (args || "") + ")" : "=" + args) + "),"
|
|
733
|
-
}
|
|
768
|
+
}) + "1", view)
|
|
734
769
|
}
|
|
735
770
|
}
|
|
736
771
|
}, 1)
|
|
@@ -955,11 +990,11 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
955
990
|
return format(iGet(translations, str, str || ""), data, getExt)
|
|
956
991
|
}
|
|
957
992
|
function getExt(obj, str) {
|
|
958
|
-
var fn = cache[str] || (cache[str] = (replace(
|
|
959
|
-
fn = (_ === name) ? name : "$el." + name + "(" + fn + (args ? "," + args : "") + ")"
|
|
960
|
-
}, replace(/;\s*([#*?@~])(.*)/, function(_, op, arg) {
|
|
993
|
+
var fn = cache[str] || (cache[str] = (renderEach(replace(/;\s*([#*?@~])(.*)/, function(_, op, arg) {
|
|
961
994
|
return ";" + iAlias[op] + " " + quote(arg)
|
|
962
|
-
}, str)
|
|
995
|
+
}, str), function(_, name, op, args) {
|
|
996
|
+
fn = (_ === name) ? name : "$el." + name + "(" + fn + (args ? "," + args : "") + ")"
|
|
997
|
+
}), fn === str ? str : makeFn(fn, fn)))
|
|
963
998
|
return str == "$" ? obj : isStr(fn) ? iGet(obj, str, "") : isFn(fn) ? fn(iExt, obj, translations) : ""
|
|
964
999
|
}
|
|
965
1000
|
})
|
|
@@ -971,22 +1006,20 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
971
1006
|
}
|
|
972
1007
|
})
|
|
973
1008
|
function format(str, data, getter) {
|
|
974
|
-
for (var
|
|
975
|
-
|
|
976
|
-
if (
|
|
977
|
-
inQuote = (!inExpr ||
|
|
1009
|
+
for (var ch, inQuote, inExpr, depth = 0, start = 0, pos = 0, len = str.length, result = ""; pos < len; ) {
|
|
1010
|
+
ch = str.charCodeAt(pos++)
|
|
1011
|
+
if (ch == 39 || ch == 34) { // '"
|
|
1012
|
+
inQuote = (!inExpr || ch === inQuote) ? 0 : ch
|
|
978
1013
|
} else if (inQuote) {
|
|
979
|
-
if (
|
|
980
|
-
} else if (
|
|
1014
|
+
if (ch == 92) pos++
|
|
1015
|
+
} else if (ch == 123 && depth++ < 1) {
|
|
981
1016
|
inExpr = pos
|
|
982
|
-
} else if (
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
pos = inExpr + char.length - 1
|
|
986
|
-
len = str.length
|
|
1017
|
+
} else if (ch == 125 && inExpr > start && --depth < 1) {
|
|
1018
|
+
result += str.slice(start, inExpr - 1) + getter(data, str.slice(inExpr, pos - 1), "")
|
|
1019
|
+
start = pos
|
|
987
1020
|
}
|
|
988
1021
|
}
|
|
989
|
-
return str
|
|
1022
|
+
return result + str.slice(start)
|
|
990
1023
|
}
|
|
991
1024
|
function iGet(obj, path, fallback, tmp) {
|
|
992
1025
|
return isStr(path) ? (
|
|
@@ -1009,53 +1042,34 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1009
1042
|
return View
|
|
1010
1043
|
}
|
|
1011
1044
|
|
|
1012
|
-
function setUrl(url, rep) {
|
|
1013
|
-
/*** pushState ***/
|
|
1014
|
-
if (pushBase) {
|
|
1015
|
-
history[rep ? "replaceState" : (history.replaceState({x: pageXOffset, y: pageYOffset}, NUL, location.href), "pushState")](NUL, NUL, pushBase + url)
|
|
1016
|
-
} else
|
|
1017
|
-
/**/
|
|
1018
|
-
location[rep ? "replace" : "assign"]("#" + url)
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
LiteJS.go = setUrl
|
|
1022
1045
|
LiteJS.start = histStart
|
|
1023
1046
|
function histStart(cb) {
|
|
1024
|
-
|
|
1025
|
-
// Chrome5, Firefox4, IE10, Safari5, Opera11.50
|
|
1047
|
+
LiteJS.go = setUrl
|
|
1026
1048
|
var histLast
|
|
1027
|
-
,
|
|
1028
|
-
,
|
|
1029
|
-
if (
|
|
1030
|
-
pushBase = replace(
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
// Chrome and Safari emit a popstate event on page load, Firefox doesn't.
|
|
1037
|
-
// Firing popstate after onload is as designed.
|
|
1038
|
-
//
|
|
1039
|
-
// See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
|
|
1040
|
-
// https://code.google.com/p/chromium/issues/detail?id=63040
|
|
1041
|
-
// and the change to the HTML5 spec that was made:
|
|
1042
|
-
// http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
|
|
1043
|
-
window.onpopstate = checkUrl
|
|
1044
|
-
} else
|
|
1045
|
-
/**/
|
|
1046
|
-
window.onhashchange = checkUrl
|
|
1047
|
-
readTemplates(checkUrl)
|
|
1049
|
+
, hashFallback = getUrl()
|
|
1050
|
+
, base = find(html, "base")
|
|
1051
|
+
if ((base = base && base.href)) {
|
|
1052
|
+
pushBase = LiteJS.push = replace(/.+?:\/\/[^/]+|[^\/]*$/g, "", base)
|
|
1053
|
+
}
|
|
1054
|
+
// Chrome and Safari emit a popstate event on page load, Firefox doesn't.
|
|
1055
|
+
// Firing popstate after onload is as designed.
|
|
1056
|
+
readTemplates(window.onpopstate = checkUrl)
|
|
1048
1057
|
function checkUrl() {
|
|
1049
|
-
if (cb && histLast != (histLast = getUrl()))
|
|
1058
|
+
if (cb && histLast != (histLast = getUrl() || hashFallback)) {
|
|
1059
|
+
hashFallback = ""
|
|
1060
|
+
cb(histLast)
|
|
1061
|
+
}
|
|
1050
1062
|
}
|
|
1051
1063
|
function getUrl() {
|
|
1052
1064
|
return replace(/^[#\/\!]+|[\s\/]+$/g, "",
|
|
1053
|
-
/*** pushState ***/
|
|
1054
1065
|
pushBase ? location.pathname.slice(pushBase.length) :
|
|
1055
|
-
/**/
|
|
1056
1066
|
// NOTE: in Firefox location.hash is decoded; in Safari location.pathname is decoded
|
|
1057
1067
|
location.href.split("#")[1] || "")
|
|
1058
1068
|
}
|
|
1069
|
+
function setUrl(url, rep) {
|
|
1070
|
+
history[rep ? "replaceState" : "pushState"](NUL, NUL, (pushBase || "#") + url)
|
|
1071
|
+
checkUrl()
|
|
1072
|
+
}
|
|
1059
1073
|
}
|
|
1060
1074
|
|
|
1061
1075
|
function Comm(name, render) {
|
|
@@ -1102,9 +1116,12 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1102
1116
|
assign(El, bindings, {
|
|
1103
1117
|
emit: emit,
|
|
1104
1118
|
empty: elEmpty,
|
|
1119
|
+
flip: elFlip,
|
|
1105
1120
|
kill: elKill,
|
|
1106
|
-
|
|
1121
|
+
morph: elMorph,
|
|
1122
|
+
off: bindingsOff,
|
|
1107
1123
|
render: render,
|
|
1124
|
+
rect: rect,
|
|
1108
1125
|
rm: elRm
|
|
1109
1126
|
})
|
|
1110
1127
|
|
|
@@ -1143,8 +1160,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1143
1160
|
append(comm.parentNode, sub, (pos++ ? nodes[pos - 2] : comm).nextSibling)
|
|
1144
1161
|
elScope(sub, comm)
|
|
1145
1162
|
}
|
|
1146
|
-
for (; i--; ) {
|
|
1147
|
-
sub = nodes[i].$s
|
|
1163
|
+
for (; i--; ) if ((sub = nodes[i].$s)) {
|
|
1148
1164
|
sub[name] = list[sub.$k = keys[sub.$i = i]]
|
|
1149
1165
|
sub.$len = pos
|
|
1150
1166
|
render(nodes[i])
|
|
@@ -1190,7 +1206,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1190
1206
|
})
|
|
1191
1207
|
},
|
|
1192
1208
|
view: function(el, url) {
|
|
1193
|
-
|
|
1209
|
+
el.href = (pushBase || "#") + expand(url || "")
|
|
1194
1210
|
}
|
|
1195
1211
|
}),
|
|
1196
1212
|
$d: globalScope,
|
|
@@ -1206,8 +1222,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1206
1222
|
rate: rate,
|
|
1207
1223
|
replace: elReplace,
|
|
1208
1224
|
scope: elScope,
|
|
1209
|
-
|
|
1210
|
-
scrollTop: bind(scrollPos, NUL, "pageYOffset", "scrollTop"),
|
|
1225
|
+
scroll: elScroll,
|
|
1211
1226
|
step: step,
|
|
1212
1227
|
stop: eventStop
|
|
1213
1228
|
})
|
|
@@ -1293,12 +1308,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1293
1308
|
|
|
1294
1309
|
function hasClass(el, name) {
|
|
1295
1310
|
var current = el.className || ""
|
|
1296
|
-
|
|
1297
|
-
if (!isStr(current)) {
|
|
1298
|
-
current = getAttr(el, "class") || ""
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
return !!current && current.split(splitRe).indexOf(name) > -1
|
|
1311
|
+
return (" " + (isStr(current) ? current : getAttr(el, "class") || "-") + " ").indexOf(" " + name + " ") > -1
|
|
1302
1312
|
}
|
|
1303
1313
|
|
|
1304
1314
|
function cls(el, name, set) {
|
|
@@ -1334,15 +1344,114 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1334
1344
|
function elEmpty(el) {
|
|
1335
1345
|
for (; el.lastChild; elKill(el.lastChild));
|
|
1336
1346
|
}
|
|
1347
|
+
function elFlip(el, sel, fn, opts) {
|
|
1348
|
+
opts = assign({ anim: "flip", enter: "op0", leave: "op0" }, opts)
|
|
1349
|
+
var newPos, c, idx, r1
|
|
1350
|
+
, i = 0
|
|
1351
|
+
, anim = 0
|
|
1352
|
+
, anims = []
|
|
1353
|
+
, parent = rect(el)
|
|
1354
|
+
, oldPos = opts.old || rects()
|
|
1355
|
+
, leave = opts.leave
|
|
1356
|
+
, stagger = opts.stagger|0
|
|
1357
|
+
, transformTransition = "transform,transition"
|
|
1358
|
+
if (!fn) return oldPos
|
|
1359
|
+
fn()
|
|
1360
|
+
newPos = rects(1)
|
|
1361
|
+
for (; (c = oldPos[i]); i += 2) if (c !== opts.skip) {
|
|
1362
|
+
idx = newPos.indexOf(c)
|
|
1363
|
+
r1 = oldPos[i + 1]
|
|
1364
|
+
if (idx > -1) {
|
|
1365
|
+
if (addTransform(c, r1, newPos[idx + 1], opts)) anims[anim++] = c
|
|
1366
|
+
} else if (leave) {
|
|
1367
|
+
bindingsCss(c, {
|
|
1368
|
+
position: "absolute",
|
|
1369
|
+
left: (r1.left - parent.left) + "px",
|
|
1370
|
+
top: (r1.top - parent.top) + "px",
|
|
1371
|
+
width: r1.width + "px",
|
|
1372
|
+
height: r1.height + "px",
|
|
1373
|
+
})
|
|
1374
|
+
c._flip = 1
|
|
1375
|
+
append(el, (anims[anim++] = c))
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
if ((r1 = opts.enter)) for (i = 0; (c = newPos[i]); i += 2) if (oldPos.indexOf(c) < 0) {
|
|
1379
|
+
bindingsCls(c, r1, 1, 0, anim*stagger || 1)
|
|
1380
|
+
anims[anim++] = c
|
|
1381
|
+
}
|
|
1382
|
+
for (el.offsetHeight; anim; ) {
|
|
1383
|
+
c = anims[--anim]
|
|
1384
|
+
bindingsCls(c, opts.anim, 1, 0, -1)
|
|
1385
|
+
if (c._flip) {
|
|
1386
|
+
elKill(c, leave, anim*stagger)
|
|
1387
|
+
} else {
|
|
1388
|
+
bindingsCss(c, transformTransition, "", anim*stagger)
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
return newPos
|
|
1392
|
+
function rects(reset) {
|
|
1393
|
+
var child
|
|
1394
|
+
, j = 0
|
|
1395
|
+
, arr = sel ? findAll(el, sel) : el.children
|
|
1396
|
+
, res = []
|
|
1397
|
+
if (reset) {
|
|
1398
|
+
for (el.offsetHeight; (child = arr[j++]); ) if (!child._flip) {
|
|
1399
|
+
cls(child, opts.anim, 0)
|
|
1400
|
+
bindingsCss(child, transformTransition, "none")
|
|
1401
|
+
}
|
|
1402
|
+
j = 0
|
|
1403
|
+
}
|
|
1404
|
+
for (el.offsetHeight; (child = arr[j++]); ) if (!child._flip) {
|
|
1405
|
+
res.push(child, rect(child))
|
|
1406
|
+
bindingsCss(child, transformTransition, "")
|
|
1407
|
+
}
|
|
1408
|
+
return res
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
function addTransform(el, from, to, opts) {
|
|
1412
|
+
var a = rect(from)
|
|
1413
|
+
, b = rect(to)
|
|
1414
|
+
, dx = a.left - b.left
|
|
1415
|
+
, dy = a.top - b.top
|
|
1416
|
+
, aw = a.width
|
|
1417
|
+
, ah = a.height
|
|
1418
|
+
, bw = b.width
|
|
1419
|
+
, bh = b.height
|
|
1420
|
+
if (canTransit && (dx || dy || (aw - bw) || (ah - bh))) {
|
|
1421
|
+
bindingsCss(el, "transform", "translate(" + dx + "px," + dy + "px)" + (opts.scale ? " scale(" + (aw / bw) + "," + (ah / bh) + ")" : ""))
|
|
1422
|
+
swap("height", ah, bh)
|
|
1423
|
+
swap("width", aw, bw)
|
|
1424
|
+
return el
|
|
1425
|
+
}
|
|
1426
|
+
function swap(key, from, to) {
|
|
1427
|
+
if (opts[key] && (from - to)) {
|
|
1428
|
+
bindingsCss(el, key, to + "px", 1, -2)
|
|
1429
|
+
bindingsCss(el, key, from + "px")
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
function elMorph(from, to, opts) {
|
|
1434
|
+
opts = assign({ anim: "flip" }, opts)
|
|
1435
|
+
if (from && to && addTransform(to, from, to, opts)) {
|
|
1436
|
+
void to.offsetWidth
|
|
1437
|
+
bindingsCls(to, opts.anim, 1, 0, -1)
|
|
1438
|
+
bindingsCss(to, "transform", "")
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
function transit(fn, el, a, b) {
|
|
1442
|
+
if (canTransit && /[1-9]/.test(getComputedStyle(el).transitionDuration)) {
|
|
1443
|
+
onceEvent(el, canTransit, bind(fn, el, el, a, b))
|
|
1444
|
+
return 1
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1337
1447
|
function elKill(el, tr, delay) {
|
|
1338
1448
|
if (el) {
|
|
1339
1449
|
if (delay > 0) return setTimeout(elKill, delay, el, tr)
|
|
1340
|
-
if (tr) {
|
|
1450
|
+
if (tr && canTransit) {
|
|
1341
1451
|
if (isStr(tr)) cls(el, tr)
|
|
1342
1452
|
if (isObj(tr)) bindingsCss(el, tr)
|
|
1343
|
-
tr = "transitionend"
|
|
1344
1453
|
// transitionend fires for each property transitioned
|
|
1345
|
-
if (
|
|
1454
|
+
if (transit(elKill, el)) return
|
|
1346
1455
|
}
|
|
1347
1456
|
if (el._e) {
|
|
1348
1457
|
emit(el, "kill")
|
|
@@ -1350,30 +1459,29 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1350
1459
|
}
|
|
1351
1460
|
elRm(el)
|
|
1352
1461
|
if (el.nodeType < 2) {
|
|
1353
|
-
el.$s = UNDEF
|
|
1354
1462
|
elKill(el._r) // Replacement element like comment from if binding
|
|
1355
1463
|
elEmpty(el)
|
|
1356
|
-
|
|
1357
|
-
el.valObject = UNDEF
|
|
1358
|
-
}
|
|
1464
|
+
el.$s = el.valObject = UNDEF
|
|
1359
1465
|
} else {
|
|
1360
1466
|
if (el.kill) el.kill()
|
|
1361
1467
|
}
|
|
1362
1468
|
}
|
|
1363
1469
|
}
|
|
1364
1470
|
function elScope(el, parent, opts) {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
function closestScope(node) {
|
|
1372
|
-
for (; (node = node.parentNode); ) {
|
|
1373
|
-
if (node.$s) return node.$s
|
|
1471
|
+
if (el.$s) return el.$s
|
|
1472
|
+
if (parent) return (el.$s = assign(create(parent = elScope(parent)), opts, { $up: parent }))
|
|
1473
|
+
for (; (el = el.parentNode); ) {
|
|
1474
|
+
if (el.$s) return el.$s
|
|
1374
1475
|
}
|
|
1375
1476
|
return globalScope
|
|
1376
1477
|
}
|
|
1478
|
+
function elScroll(scrollEl) {
|
|
1479
|
+
scrollEl = document.scrollingElement
|
|
1480
|
+
return {
|
|
1481
|
+
x: window.pageXOffset || scrollEl.scrollLeft,
|
|
1482
|
+
y: window.pageYOffset || scrollEl.scrollTop
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1377
1485
|
|
|
1378
1486
|
function render(node, $s) {
|
|
1379
1487
|
if (!node || node.nodeType != 1) {
|
|
@@ -1382,7 +1490,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1382
1490
|
}
|
|
1383
1491
|
|
|
1384
1492
|
var el, next
|
|
1385
|
-
, scope = node.$s || $s ||
|
|
1493
|
+
, scope = node.$s || $s || elScope(node)
|
|
1386
1494
|
|
|
1387
1495
|
/*** ie9 ***/
|
|
1388
1496
|
if (ie678 && node.tagName === "SELECT") {
|
|
@@ -1391,6 +1499,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1391
1499
|
/**/
|
|
1392
1500
|
|
|
1393
1501
|
if (hydrate(node, "_b", scope)) return
|
|
1502
|
+
scope = node.$s || scope
|
|
1394
1503
|
for (el = node.firstChild; el; el = next) {
|
|
1395
1504
|
next = el.nextSibling
|
|
1396
1505
|
render(el, scope)
|
|
@@ -1411,15 +1520,33 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1411
1520
|
throw e + "\n" + attr + ": " + expr
|
|
1412
1521
|
}
|
|
1413
1522
|
}
|
|
1523
|
+
// Iterates ";name! args" binding expressions, handles ;{}() in args
|
|
1524
|
+
function renderEach(str, fn) {
|
|
1525
|
+
var m, tok, argStart
|
|
1526
|
+
, bindRe = /[;\s]*([-.\w$]+)(!?)[ :]*/g
|
|
1527
|
+
, tokRe = /(["'\/])(?:\\.|[^\\])*?\1|(([{(\[])|[})\]])|;/g
|
|
1528
|
+
, depth = 0
|
|
1529
|
+
, result = ""
|
|
1530
|
+
while ((m = bindRe.exec(str))) {
|
|
1531
|
+
argStart = tokRe.lastIndex = bindRe.lastIndex
|
|
1532
|
+
for (depth = 0; (tok = tokRe.exec(str)); ) {
|
|
1533
|
+
if (tok[0] === ";" && depth < 1) break
|
|
1534
|
+
else if (tok[2]) depth += tok[3] ? 1 : -1
|
|
1535
|
+
}
|
|
1536
|
+
depth = bindRe.lastIndex = tok ? tok.index : str.length
|
|
1537
|
+
result += fn(str.slice(m.index, depth), m[1], m[2], str.slice(argStart, depth))
|
|
1538
|
+
}
|
|
1539
|
+
return result
|
|
1540
|
+
}
|
|
1414
1541
|
// Compiles binding expression string (e.g. ";txt foo;cls 'active',bar") into a Function.
|
|
1415
1542
|
// Extracts free variable names and aliases them from scope ($s.varName).
|
|
1416
1543
|
// raw parameter bypasses the $s guard wrapper (used by i18n getExt).
|
|
1417
1544
|
function makeFn(fn, raw, i) {
|
|
1418
|
-
fn = raw || "$s&&(" +
|
|
1545
|
+
fn = raw || "$s&&(" + renderEach(fn, function(match, name, op, args) {
|
|
1419
1546
|
return (
|
|
1420
1547
|
op ? "($el[$a]=$el[$a].replace($o[" + (i = bindOnce.indexOf(match), i < 0 ? bindOnce.push(match) - 1 : i)+ "],''),0)||" : ""
|
|
1421
1548
|
) + "$b['" + (bindings[name] ? name + "'].call($s" + (name == "$s" ? "=$S($el,$el)": "") + ",$el" : "set']($el,'" + name + "'") + (args ? "," + args : "") + ")||"
|
|
1422
|
-
}
|
|
1549
|
+
}) + "$r)"
|
|
1423
1550
|
var vars = replace(fnRe, "", fn).match(wordRe) || []
|
|
1424
1551
|
for (i = vars.length; i--; ) {
|
|
1425
1552
|
if (window[vars[i]] || vars.indexOf(vars[i]) !== i) vars.splice(i, 1)
|
|
@@ -1481,14 +1608,14 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1481
1608
|
(map = kbMaps[i++]) && !(
|
|
1482
1609
|
fn = !input || map.input ? map[code] || map[chr] || map.num && code > 47 && code < 58 && (chr|=0, map.num) || map.all : fn
|
|
1483
1610
|
) && map.bubble; );
|
|
1484
|
-
if (isStr(fn))
|
|
1611
|
+
if (isStr(fn)) LiteJS.go(fn)
|
|
1485
1612
|
else if (isFn(fn)) fn(e, chr, el)
|
|
1486
1613
|
}
|
|
1487
1614
|
})
|
|
1488
1615
|
/**/
|
|
1489
1616
|
|
|
1490
1617
|
/*** touch ***/
|
|
1491
|
-
var e0, touchDist,
|
|
1618
|
+
var e0, touchAngle, touchDist, touchEl, touchMode, touchTick
|
|
1492
1619
|
, START = "start"
|
|
1493
1620
|
, END = "end"
|
|
1494
1621
|
, touches = []
|
|
@@ -1500,6 +1627,9 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1500
1627
|
fixEv[name] = fixEv[name + START] = fixEv[name + END] = ""
|
|
1501
1628
|
fixFn[name] = fixFn[name + START] = fixFn[name + END] = touchInit
|
|
1502
1629
|
})
|
|
1630
|
+
function haveEv(evs, name, set) {
|
|
1631
|
+
return set && (evs[name] || evs[name + START] || evs[name + END]) && name
|
|
1632
|
+
}
|
|
1503
1633
|
function touchInit(el) {
|
|
1504
1634
|
if (!el._ti) {
|
|
1505
1635
|
addEvent(el, "pointerdown", touchDown)
|
|
@@ -1524,8 +1654,11 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1524
1654
|
if (len === 1) {
|
|
1525
1655
|
if (e) {
|
|
1526
1656
|
e0 = e
|
|
1527
|
-
|
|
1528
|
-
|
|
1657
|
+
e.x0 = e.clientX
|
|
1658
|
+
e.y0 = e.clientY
|
|
1659
|
+
touchEl = el
|
|
1660
|
+
touchPos("x", "left", "offsetWidth")
|
|
1661
|
+
touchPos("y", "top", "offsetHeight")
|
|
1529
1662
|
if (e.button === 2 || matches(el, "INPUT,TEXTAREA,SELECT,.no-drag")) return
|
|
1530
1663
|
touchTick = setTimeout(moveOne, LiteJS.holdDelay || 800, e, 1)
|
|
1531
1664
|
}
|
|
@@ -1536,9 +1669,11 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1536
1669
|
moveTwo(e)
|
|
1537
1670
|
}
|
|
1538
1671
|
;(len === 1 ? addEvent : rmEvent)(document, MOVE, moveOne)
|
|
1672
|
+
// TODO:2026-03-24:lauri:touches are shared, touchDown is per-element closures, move out
|
|
1673
|
+
;(len === 1 ? addEvent : rmEvent)(document, "pointerup", touchUp)
|
|
1539
1674
|
;(len === 2 ? addEvent : rmEvent)(document, MOVE, moveTwo)
|
|
1540
|
-
function touchPos(name, offset) {
|
|
1541
|
-
var val = getAttr(el,
|
|
1675
|
+
function touchPos(coord, name, offset) {
|
|
1676
|
+
var val = getAttr(el, coord) || getComputedStyle(el)[name]
|
|
1542
1677
|
, num = parseInt(val, 10) || 0
|
|
1543
1678
|
e0[name] = val && val.indexOf("%") > -1 ? num * el.parentNode[offset] / 100 : num
|
|
1544
1679
|
}
|
|
@@ -1568,26 +1703,22 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1568
1703
|
if (touches[0].buttons && touches[0].buttons !== (e.buttons || [0, 1, 4, 2][e.which || 0])) {
|
|
1569
1704
|
return touchUp(e)
|
|
1570
1705
|
}
|
|
1571
|
-
e.
|
|
1572
|
-
e.
|
|
1573
|
-
e.
|
|
1574
|
-
e.
|
|
1575
|
-
e.
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
haveEv("pan", e.dx > 10 || e.dx < -10 || e.dy > 10 || e.dy < -10) ||
|
|
1581
|
-
haveEv("hold", fromTimer)
|
|
1582
|
-
)
|
|
1583
|
-
if (!touchMode) return
|
|
1706
|
+
e.el = touchEl
|
|
1707
|
+
e.x0 = e0.x0
|
|
1708
|
+
e.y0 = e0.y0
|
|
1709
|
+
var dx = e.dx = e.clientX - e.x0
|
|
1710
|
+
, dy = e.dy = e.clientY - e.y0
|
|
1711
|
+
if (!touchMode && (touchMode = touchEl._e) && (touchMode = (
|
|
1712
|
+
haveEv(touchMode, "pan", dx > 10 || dx < -10 || dy > 10 || dy < -10) ||
|
|
1713
|
+
haveEv(touchMode, "hold", fromTimer)
|
|
1714
|
+
))) {
|
|
1584
1715
|
clearTimeout(touchTick)
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
emit(el, touchMode, e, el)
|
|
1588
|
-
function haveEv(name, set) {
|
|
1589
|
-
return set && (evs[name] || evs[name + START] || evs[name + END]) && name
|
|
1716
|
+
e0.mode = touchMode
|
|
1717
|
+
emit(el, touchMode + START, e0, el)
|
|
1590
1718
|
}
|
|
1719
|
+
e.ex = dx + e0.left
|
|
1720
|
+
e.ey = dy + e0.top
|
|
1721
|
+
if (touchMode) emit(el, touchMode, e, el)
|
|
1591
1722
|
}
|
|
1592
1723
|
function moveTwo(e) {
|
|
1593
1724
|
touches[ touches[0].pointerId == e.pointerId ? 0 : 1] = e
|
|
@@ -1653,13 +1784,14 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1653
1784
|
function acceptMany(fn, prepareVal) {
|
|
1654
1785
|
return function f(el, name, val, selector, delay, data) {
|
|
1655
1786
|
if (el && name) {
|
|
1656
|
-
if (
|
|
1787
|
+
if (!isStr(selector)) {
|
|
1657
1788
|
data = delay
|
|
1658
1789
|
delay = selector
|
|
1659
|
-
selector =
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1790
|
+
selector = ""
|
|
1791
|
+
}
|
|
1792
|
+
if (!isNum(delay)) {
|
|
1793
|
+
data = delay
|
|
1794
|
+
delay = 0
|
|
1663
1795
|
}
|
|
1664
1796
|
if (delay > 0) {
|
|
1665
1797
|
setTimeout(f, delay, el, name, val, selector, 0, data)
|
|
@@ -1682,11 +1814,17 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1682
1814
|
}
|
|
1683
1815
|
} : val
|
|
1684
1816
|
, els = !prepareVal && selector ? findAll(el, selector) : isArr(el) ? el : [ el ]
|
|
1685
|
-
for (; (node = els[i++]); ) {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
if (
|
|
1817
|
+
for (; (node = els[i++]); ) for (delay = 0; delay < len; delay++) {
|
|
1818
|
+
if ((name = arr[delay])) {
|
|
1819
|
+
result = fn(node, name, isArr(value) ? value[delay] : value && typeof value === "object" && !value.nodeType ? value[result] : value, data)
|
|
1820
|
+
if (prepareVal) {
|
|
1821
|
+
if (fn === addEvent && data) {
|
|
1822
|
+
onceEvent(data.el || node, data.until, bind(rmEvent, node, node, name, value, data))
|
|
1823
|
+
}
|
|
1824
|
+
} else {
|
|
1825
|
+
if (fn === cls || data < -1) result = !val || ""
|
|
1826
|
+
if (data < 0 && !transit(f, node, name, result)) data = 1
|
|
1827
|
+
if (data > 0) f(node, name, result, "", data)
|
|
1690
1828
|
}
|
|
1691
1829
|
}
|
|
1692
1830
|
}
|
|
@@ -1754,22 +1892,31 @@ console.log("LiteJS is in debug mode and that's fine for production")
|
|
|
1754
1892
|
, next = 0
|
|
1755
1893
|
onStart = isFn(onStart) ? onStart : (onStart === tick || onStart) && fn
|
|
1756
1894
|
onEnd = isFn(onEnd) ? onEnd : (onEnd === tick || onEnd) && fn
|
|
1757
|
-
return function() {
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1895
|
+
return function(e) {
|
|
1896
|
+
if (!ms) {
|
|
1897
|
+
next = e
|
|
1898
|
+
if (!tick) tick = requestAnimationFrame(callLast)
|
|
1899
|
+
} else {
|
|
1900
|
+
var now = Date.now()
|
|
1901
|
+
if (now >= next) {
|
|
1902
|
+
if (next < 1) {
|
|
1903
|
+
if (onStart) onStart(e)
|
|
1904
|
+
} else fn(e)
|
|
1905
|
+
next = now + ms
|
|
1906
|
+
}
|
|
1907
|
+
if (onEnd) {
|
|
1908
|
+
clearTimeout(tick)
|
|
1909
|
+
tick = setTimeout(onEnd, next - now, e)
|
|
1910
|
+
}
|
|
1768
1911
|
}
|
|
1769
1912
|
}
|
|
1913
|
+
function callLast() {
|
|
1914
|
+
fn(next)
|
|
1915
|
+
tick = 0
|
|
1916
|
+
}
|
|
1770
1917
|
}
|
|
1771
|
-
function
|
|
1772
|
-
return
|
|
1918
|
+
function rect(el) {
|
|
1919
|
+
return el && el.nodeType ? el.getBoundingClientRect() : el
|
|
1773
1920
|
}
|
|
1774
1921
|
function step(num, factor, mid) {
|
|
1775
1922
|
var x = ("" + factor).split(".")
|