@litejs/ui 26.4.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/el/dialog.ui CHANGED
@@ -71,7 +71,7 @@
71
71
  tab: setFocus,
72
72
  }
73
73
  , body = doc.body
74
- , scrollEl = doc.scrollingElement || doc.documentElement
74
+ , scrollEl = doc.scrollingElement
75
75
  , vibrate = scope.vibrate && navigator.vibrate
76
76
  , sound = scope.sound && window.Audio && new Audio(scope.sound)
77
77
  scope.title = title
package/el/menu.ui CHANGED
@@ -93,9 +93,10 @@
93
93
  , html = document.documentElement
94
94
  El.near = near
95
95
  function near(source, target, x, y, margin) {
96
- var rect = target.getBoundingClientRect()
97
- , top = rect.top + El.scrollTop()
98
- , left = rect.left + El.scrollLeft()
96
+ var rect = El.rect(target)
97
+ , scroll = El.scroll()
98
+ , top = rect.top + scroll.y
99
+ , left = rect.left + scroll.x
99
100
  // svg elements dont have offsetWidth, IE8 does not have rect.width
100
101
  , width = rect.width || target.offsetWidth || 0
101
102
  , height = rect.height || target.offsetHeight || 0
@@ -122,7 +123,7 @@
122
123
  top += height + margin
123
124
  y = " -50%"
124
125
  setTimeout(function() {
125
- var overflow = top + source.offsetHeight - El.scrollTop() - html.offsetHeight
126
+ var overflow = top + source.offsetHeight - scroll.y - html.offsetHeight
126
127
  if (overflow > 0) scrollBy({ top: overflow, left: 0, behavior: "smooth" })
127
128
  }, 400)
128
129
  } else {
package/el/slider.ui CHANGED
@@ -161,7 +161,7 @@
161
161
  drag = true
162
162
  load()
163
163
  var tmp = El.rect(el)
164
- offset = tmp.left + El.scrollLeft() + knobLen
164
+ offset = tmp.left + El.scroll().x + knobLen
165
165
  var next, i = 0
166
166
  , x = maxPx
167
167
  , diff = e.pageX - offset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/ui",
3
- "version": "26.4.0",
3
+ "version": "26.8.0",
4
4
  "description": "UI engine for LiteJS full-stack framework",
5
5
  "license": "MIT",
6
6
  "author": "Lauri Rooden <lauri@rooden.ee>",
@@ -27,6 +27,6 @@
27
27
  "test": "lj t test/index.js"
28
28
  },
29
29
  "devDependencies": {
30
- "@litejs/cli": "26.4.0"
30
+ "@litejs/cli": "26.6.0"
31
31
  }
32
32
  }
package/shim.js CHANGED
@@ -35,6 +35,7 @@
35
35
  /*** debug ***/
36
36
  , IS_NODE = !window.document
37
37
  , document = patch("document", {body:{},documentElement:{}})
38
+ , history = patch("history", {})
38
39
  , location = patch("location", {href:""})
39
40
  , navigator = patch("navigator", {})
40
41
  /*/
@@ -42,7 +43,6 @@
42
43
  , IS_NODE = false
43
44
  /**/
44
45
  , html = document.documentElement
45
- , body = document.body
46
46
  // JScript engine in IE<9 does not recognize vertical tabulation character
47
47
  // The documentMode is an IE only property, supported from IE8
48
48
  , a = document.documentMode | 0
@@ -52,7 +52,6 @@
52
52
  /* node:coverage ignore next 19 */
53
53
  , ie678 = !+"\v1" && a < 9 // jshint ignore:line
54
54
  , ie6789 = ie678 || a == 9
55
- , ie67 = ie678 && a < 8
56
55
  , EV = "Event"
57
56
  , Event = patch(
58
57
  EV,
@@ -103,8 +102,8 @@
103
102
  c: "touchcancel"
104
103
  }
105
104
 
106
- , lastHash
107
- , onhashchange = "onhashchange"
105
+ , lastHref
106
+ , onpopstate = "onpopstate"
108
107
 
109
108
 
110
109
  // Patch parameters support for setTimeout callback
@@ -120,13 +119,13 @@
120
119
  // window.msRequestAnimationFrame || // IE 10 PP2+
121
120
  patch("cancel" + a, "clearTimeout(a)")
122
121
 
123
-
124
122
  /* node:coverage ignore next 8 */
125
- if (!IS_NODE && !(onhashchange in window) || ie67) {
126
- patch(onhashchange, NULL)
123
+ if (!IS_NODE && !(onpopstate in window)) {
124
+ patch(onpopstate, NULL)
127
125
  setInterval(function() {
128
- if (lastHash !== (lastHash = location.href.split("#")[1]) && isFn(window[onhashchange])) {
129
- window[onhashchange]()
126
+ if (isFn(window[onpopstate]) && lastHref !== (lastHref = "" + location)) {
127
+ window[onpopstate]()
128
+ scroll(0, 0)
130
129
  }
131
130
  }, 60)
132
131
  }
@@ -335,8 +334,16 @@
335
334
  // Chrome7, FF4, IE9, Opera 11.60, Safari 5.1.4
336
335
  patch("bind", "b=S.call(A,1);c=function(){return t.apply(this instanceof c?this:a,b.concat(S.call(arguments)))};if(t[P])c[P]=t[P];return c")
337
336
 
337
+ O = history
338
+ a = "replace"
339
+ b = "State"
340
+ c = "location[X](c)"
341
+ patch(a + b, c, 0, a)
342
+ a = "assign"
343
+ patch("push" + b, c, 0, a)
344
+
338
345
  O = Object
339
- patch("assign", "for(var k,i=1,l=A.length;i<l;)if(t=A[i++])for(k in t)if(o.call(t,k))a[k]=t[k];return a")
346
+ patch(a, "for(var k,i=1,l=A.length;i<l;)if(t=A[i++])for(k in t)if(o.call(t,k))a[k]=t[k];return a")
340
347
  patch("create", "X[P]=a||Y;return new X", 0, nop, {
341
348
  // oKeys is undefined at this point
342
349
  constructor: oKeys,
@@ -424,6 +431,9 @@
424
431
  return false
425
432
  })
426
433
 
434
+ O = document
435
+ var scrollEl = patch("scrollingElement", (document.compatMode === "CSS1Compat" ? html : document.body))
436
+
427
437
  // The HTML5 document.head DOM tree accessor
428
438
  // patch("head", document.getElementsByTagName("head")[0])
429
439
  // HTMLElement (IE9) -> Element (IE8)
@@ -433,12 +443,12 @@
433
443
  , selectorLastRe = /([\s>+~]*)(?:("|')(?:\\.|[^\\])*?\2|\((?:[^()]|\([^()]+\))+?\)|~=|[^'"()\s>+~])+$/
434
444
  , selectorSplitRe = /\s*,\s*(?=(?:[^'"()]|"(?:\\.|[^\\"])*?"|'(?:\\.|[^\\'])*?'|\((?:[^()]|\([^()]+\))+?\))+$)/
435
445
  , selectorMap = {
436
- "empty": "!_.lastChild",
437
- "enabled": "!m(_,':disabled')",
446
+ empty: "!_.lastChild",
447
+ enabled: "!m(_,':disabled')",
438
448
  "first-child": "(a=_.parentNode)&&a.firstChild==_",
439
- "lang": "m(c(_,'[lang]'),'[lang|='+v+']')",
449
+ lang: "m(c(_,'[lang]'),'[lang|='+v+']')",
440
450
  "last-child": "(a=_.parentNode)&&a.lastChild==_",
441
- "link": "m(_,'a[href]')",
451
+ link: "m(_,'a[href]')",
442
452
  "only-child": "(a=_.parentNode)&&a.firstChild==a.lastChild",
443
453
  ".": "~_.className.split(/\\s+/).indexOf(a)",
444
454
  "#": "_.id==a",
@@ -455,11 +465,11 @@
455
465
  , matches = patch("matches", "return!!X(a)(t)", 0, selectorFn)
456
466
 
457
467
  /* node:coverage ignore next 13 */
468
+ b = "removeEventListener"
458
469
  try {
459
470
  O[a = "addEventListener"]("t", NULL, Object.defineProperties({}, {
460
471
  capture: { get: function() { canCapture = 1 } }
461
472
  }))
462
- b = "removeEventListener"
463
473
  c = "O.call(t,a,b,X(c)?!!c.capture:!!c)"
464
474
  if (!canCapture) {
465
475
  patch("c:" + a, c, 1, isObj)
@@ -474,8 +484,8 @@
474
484
  return function() {
475
485
  var e = new Event(ev)
476
486
  if (e.clientX !== UNDEF) {
477
- e.pageX = e.clientX + (window.pageXOffset || html.scrollLeft || body.scrollLeft || 0)
478
- e.pageY = e.clientY + (window.pageYOffset || html.scrollTop || body.scrollTop || 0)
487
+ e.pageX = e.clientX + (window.pageXOffset || scrollEl.scrollLeft)
488
+ e.pageY = e.clientY + (window.pageYOffset || scrollEl.scrollTop)
479
489
  }
480
490
  fn.call(el, e)
481
491
  }
package/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /* litejs.com/MIT-LICENSE.txt */
3
3
 
4
- /* global escape, getComputedStyle, navigator, pageXOffset, pageYOffset, scrollTo, xhr */
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
@@ -57,8 +57,6 @@ 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 = {}
@@ -72,6 +70,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
72
70
  return current
73
71
  })
74
72
  , bindingsOn = acceptMany(addEvent, 1)
73
+ , bindingsOff = acceptMany(rmEvent)
75
74
  , bindings = {
76
75
  cls: bindingsCls,
77
76
  css: bindingsCss,
@@ -358,10 +357,10 @@ console.log("LiteJS is in debug mode and that's fine for production")
358
357
  on(el, ev, fn2, el, fn)
359
358
  }
360
359
  function onceEvent(el, ev, fn, opts) {
361
- addEvent(el, ev, fn, opts, function remove() {
362
- rmEvent(el, ev, fn, opts)
360
+ if (ev) bindingsOn(el, ev, function remove() {
361
+ bindingsOff(el, ev, remove, 0, 0, opts)
363
362
  fn.apply(el, arguments)
364
- })
363
+ }, 0, 0, opts)
365
364
  }
366
365
  function rmEvent(el, ev, fn, opts) {
367
366
  var evs = el._e && el._e[ev]
@@ -428,6 +427,10 @@ console.log("LiteJS is in debug mode and that's fine for production")
428
427
 
429
428
  asEmitter(View)
430
429
  asEmitter(View.prototype = {
430
+ show: function(params) {
431
+ lastView = this
432
+ bubbleUp(lastParams = params || {})
433
+ },
431
434
  wait: function() {
432
435
  var params = lastParams
433
436
  params._p = 1 + (params._p | 0) // pending
@@ -542,8 +545,6 @@ console.log("LiteJS is in debug mode and that's fine for production")
542
545
  viewEmit(view, "pong", params, View)
543
546
  }
544
547
  viewEmit(lastView, "show", params)
545
- close = history.state || 0
546
- scrollTo(close.x|0, close.y|0)
547
548
  blur()
548
549
  }
549
550
  function viewClose(view, open) {
@@ -762,9 +763,9 @@ console.log("LiteJS is in debug mode and that's fine for production")
762
763
  var expr = getAttr(plugin.e, "_b")
763
764
  , view = View(plugin.n, usePluginContent(plugin), plugin.x)
764
765
  if (expr) {
765
- viewEval(replace(renderRe, function(_, name, op, args) {
766
+ viewEval(renderEach(expr, function(_, name, op, args) {
766
767
  return "($s." + name + (isFn(view[name]) ? "(" + (args || "") + ")" : "=" + args) + "),"
767
- }, expr) + "1", view)
768
+ }) + "1", view)
768
769
  }
769
770
  }
770
771
  }, 1)
@@ -989,11 +990,11 @@ console.log("LiteJS is in debug mode and that's fine for production")
989
990
  return format(iGet(translations, str, str || ""), data, getExt)
990
991
  }
991
992
  function getExt(obj, str) {
992
- var fn = cache[str] || (cache[str] = (replace(renderRe, function(_, name, op, args) {
993
- fn = (_ === name) ? name : "$el." + name + "(" + fn + (args ? "," + args : "") + ")"
994
- }, replace(/;\s*([#*?@~])(.*)/, function(_, op, arg) {
993
+ var fn = cache[str] || (cache[str] = (renderEach(replace(/;\s*([#*?@~])(.*)/, function(_, op, arg) {
995
994
  return ";" + iAlias[op] + " " + quote(arg)
996
- }, str)), fn === str ? str : makeFn(fn, fn)))
995
+ }, str), function(_, name, op, args) {
996
+ fn = (_ === name) ? name : "$el." + name + "(" + fn + (args ? "," + args : "") + ")"
997
+ }), fn === str ? str : makeFn(fn, fn)))
997
998
  return str == "$" ? obj : isStr(fn) ? iGet(obj, str, "") : isFn(fn) ? fn(iExt, obj, translations) : ""
998
999
  }
999
1000
  })
@@ -1005,22 +1006,20 @@ console.log("LiteJS is in debug mode and that's fine for production")
1005
1006
  }
1006
1007
  })
1007
1008
  function format(str, data, getter) {
1008
- for (var char, inQuote, inExpr, depth = 0, pos = 0, len = str.length; pos < len; ) {
1009
- char = str.charAt(pos++)
1010
- if (char == "'" || char == "\"") { // '"
1011
- inQuote = (!inExpr || char === inQuote) ? "" : char
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
1012
1013
  } else if (inQuote) {
1013
- if (char == "\\") pos++
1014
- } else if (char == "{" && depth++ < 1) {
1014
+ if (ch == 92) pos++
1015
+ } else if (ch == 123 && depth++ < 1) {
1015
1016
  inExpr = pos
1016
- } else if (char == "}" && inExpr && --depth < 1) {
1017
- char = getter(data, str.slice(inExpr, pos - 1), "")
1018
- str = str.slice(0, inExpr - 1) + char + str.slice(pos)
1019
- pos = inExpr + char.length - 1
1020
- 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
1021
1020
  }
1022
1021
  }
1023
- return str
1022
+ return result + str.slice(start)
1024
1023
  }
1025
1024
  function iGet(obj, path, fallback, tmp) {
1026
1025
  return isStr(path) ? (
@@ -1043,53 +1042,34 @@ console.log("LiteJS is in debug mode and that's fine for production")
1043
1042
  return View
1044
1043
  }
1045
1044
 
1046
- function setUrl(url, rep) {
1047
- /*** pushState ***/
1048
- if (pushBase) {
1049
- history[rep ? "replaceState" : (history.replaceState({x: pageXOffset, y: pageYOffset}, NUL, location.href), "pushState")](NUL, NUL, pushBase + url)
1050
- } else
1051
- /**/
1052
- location[rep ? "replace" : "assign"]("#" + url)
1053
- }
1054
-
1055
- LiteJS.go = setUrl
1056
1045
  LiteJS.start = histStart
1057
1046
  function histStart(cb) {
1058
- /*** pushState ***/
1059
- // Chrome5, Firefox4, IE10, Safari5, Opera11.50
1047
+ LiteJS.go = setUrl
1060
1048
  var histLast
1061
- , baseEl = find(html, "base")
1062
- , url = getUrl()
1063
- if (baseEl && history.pushState) {
1064
- pushBase = replace(/.*:\/\/[^/]*|[^\/]*$/g, "", baseEl.href)
1065
-
1066
- if (url && !getUrl()) {
1067
- setUrl(url, 1)
1068
- }
1069
-
1070
- // Chrome and Safari emit a popstate event on page load, Firefox doesn't.
1071
- // Firing popstate after onload is as designed.
1072
- //
1073
- // See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
1074
- // https://code.google.com/p/chromium/issues/detail?id=63040
1075
- // and the change to the HTML5 spec that was made:
1076
- // http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
1077
- window.onpopstate = checkUrl
1078
- } else
1079
- /**/
1080
- window.onhashchange = checkUrl
1081
- 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)
1082
1057
  function checkUrl() {
1083
- if (cb && histLast != (histLast = getUrl())) cb(histLast)
1058
+ if (cb && histLast != (histLast = getUrl() || hashFallback)) {
1059
+ hashFallback = ""
1060
+ cb(histLast)
1061
+ }
1084
1062
  }
1085
1063
  function getUrl() {
1086
1064
  return replace(/^[#\/\!]+|[\s\/]+$/g, "",
1087
- /*** pushState ***/
1088
1065
  pushBase ? location.pathname.slice(pushBase.length) :
1089
- /**/
1090
1066
  // NOTE: in Firefox location.hash is decoded; in Safari location.pathname is decoded
1091
1067
  location.href.split("#")[1] || "")
1092
1068
  }
1069
+ function setUrl(url, rep) {
1070
+ history[rep ? "replaceState" : "pushState"](NUL, NUL, (pushBase || "#") + url)
1071
+ checkUrl()
1072
+ }
1093
1073
  }
1094
1074
 
1095
1075
  function Comm(name, render) {
@@ -1139,7 +1119,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1139
1119
  flip: elFlip,
1140
1120
  kill: elKill,
1141
1121
  morph: elMorph,
1142
- off: acceptMany(rmEvent),
1122
+ off: bindingsOff,
1143
1123
  render: render,
1144
1124
  rect: rect,
1145
1125
  rm: elRm
@@ -1180,8 +1160,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1180
1160
  append(comm.parentNode, sub, (pos++ ? nodes[pos - 2] : comm).nextSibling)
1181
1161
  elScope(sub, comm)
1182
1162
  }
1183
- for (; i--; ) {
1184
- sub = nodes[i].$s
1163
+ for (; i--; ) if ((sub = nodes[i].$s)) {
1185
1164
  sub[name] = list[sub.$k = keys[sub.$i = i]]
1186
1165
  sub.$len = pos
1187
1166
  render(nodes[i])
@@ -1227,7 +1206,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1227
1206
  })
1228
1207
  },
1229
1208
  view: function(el, url) {
1230
- setAttr(el, "href", (pushBase || "#") + expand(url || ""))
1209
+ el.href = (pushBase || "#") + expand(url || "")
1231
1210
  }
1232
1211
  }),
1233
1212
  $d: globalScope,
@@ -1243,8 +1222,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1243
1222
  rate: rate,
1244
1223
  replace: elReplace,
1245
1224
  scope: elScope,
1246
- scrollLeft: bind(scrollPos, NUL, "pageXOffset", "scrollLeft"),
1247
- scrollTop: bind(scrollPos, NUL, "pageYOffset", "scrollTop"),
1225
+ scroll: elScroll,
1248
1226
  step: step,
1249
1227
  stop: eventStop
1250
1228
  })
@@ -1460,6 +1438,12 @@ console.log("LiteJS is in debug mode and that's fine for production")
1460
1438
  bindingsCss(to, "transform", "")
1461
1439
  }
1462
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
+ }
1463
1447
  function elKill(el, tr, delay) {
1464
1448
  if (el) {
1465
1449
  if (delay > 0) return setTimeout(elKill, delay, el, tr)
@@ -1467,7 +1451,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1467
1451
  if (isStr(tr)) cls(el, tr)
1468
1452
  if (isObj(tr)) bindingsCss(el, tr)
1469
1453
  // transitionend fires for each property transitioned
1470
- return onceEvent(el, canTransit, bind(elKill, el, el, UNDEF))
1454
+ if (transit(elKill, el)) return
1471
1455
  }
1472
1456
  if (el._e) {
1473
1457
  emit(el, "kill")
@@ -1491,6 +1475,13 @@ console.log("LiteJS is in debug mode and that's fine for production")
1491
1475
  }
1492
1476
  return globalScope
1493
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
+ }
1494
1485
 
1495
1486
  function render(node, $s) {
1496
1487
  if (!node || node.nodeType != 1) {
@@ -1529,15 +1520,33 @@ console.log("LiteJS is in debug mode and that's fine for production")
1529
1520
  throw e + "\n" + attr + ": " + expr
1530
1521
  }
1531
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
+ }
1532
1541
  // Compiles binding expression string (e.g. ";txt foo;cls 'active',bar") into a Function.
1533
1542
  // Extracts free variable names and aliases them from scope ($s.varName).
1534
1543
  // raw parameter bypasses the $s guard wrapper (used by i18n getExt).
1535
1544
  function makeFn(fn, raw, i) {
1536
- fn = raw || "$s&&(" + replace(renderRe, function(match, name, op, args) {
1545
+ fn = raw || "$s&&(" + renderEach(fn, function(match, name, op, args) {
1537
1546
  return (
1538
1547
  op ? "($el[$a]=$el[$a].replace($o[" + (i = bindOnce.indexOf(match), i < 0 ? bindOnce.push(match) - 1 : i)+ "],''),0)||" : ""
1539
1548
  ) + "$b['" + (bindings[name] ? name + "'].call($s" + (name == "$s" ? "=$S($el,$el)": "") + ",$el" : "set']($el,'" + name + "'") + (args ? "," + args : "") + ")||"
1540
- }, fn) + "$r)"
1549
+ }) + "$r)"
1541
1550
  var vars = replace(fnRe, "", fn).match(wordRe) || []
1542
1551
  for (i = vars.length; i--; ) {
1543
1552
  if (window[vars[i]] || vars.indexOf(vars[i]) !== i) vars.splice(i, 1)
@@ -1599,7 +1608,7 @@ console.log("LiteJS is in debug mode and that's fine for production")
1599
1608
  (map = kbMaps[i++]) && !(
1600
1609
  fn = !input || map.input ? map[code] || map[chr] || map.num && code > 47 && code < 58 && (chr|=0, map.num) || map.all : fn
1601
1610
  ) && map.bubble; );
1602
- if (isStr(fn)) setUrl(fn)
1611
+ if (isStr(fn)) LiteJS.go(fn)
1603
1612
  else if (isFn(fn)) fn(e, chr, el)
1604
1613
  }
1605
1614
  })
@@ -1806,14 +1815,15 @@ console.log("LiteJS is in debug mode and that's fine for production")
1806
1815
  } : val
1807
1816
  , els = !prepareVal && selector ? findAll(el, selector) : isArr(el) ? el : [ el ]
1808
1817
  for (; (node = els[i++]); ) for (delay = 0; delay < len; delay++) {
1809
- if ((result = arr[delay])) {
1810
- result = fn(node, result, isArr(value) ? value[delay] : value && typeof value === "object" && !value.nodeType ? value[result] : value, data)
1811
- if (!prepareVal) {
1812
- if (fn === cls || data < -1) result = !val || ""
1813
- if (data < 0) {
1814
- if (canTransit) onceEvent(node, canTransit, bind(f, node, node, name, result))
1815
- else data = 1
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))
1816
1823
  }
1824
+ } else {
1825
+ if (fn === cls || data < -1) result = !val || ""
1826
+ if (data < 0 && !transit(f, node, name, result)) data = 1
1817
1827
  if (data > 0) f(node, name, result, "", data)
1818
1828
  }
1819
1829
  }
@@ -1882,26 +1892,32 @@ console.log("LiteJS is in debug mode and that's fine for production")
1882
1892
  , next = 0
1883
1893
  onStart = isFn(onStart) ? onStart : (onStart === tick || onStart) && fn
1884
1894
  onEnd = isFn(onEnd) ? onEnd : (onEnd === tick || onEnd) && fn
1885
- return function() {
1886
- var now = Date.now()
1887
- clearTimeout(tick)
1888
- if (now >= next) {
1889
- if (next < 1) {
1890
- if (onStart) onStart()
1891
- } else fn()
1892
- next = now + ms
1893
- }
1894
- if (onEnd) {
1895
- tick = setTimeout(onEnd, next - now)
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
+ }
1896
1911
  }
1897
1912
  }
1913
+ function callLast() {
1914
+ fn(next)
1915
+ tick = 0
1916
+ }
1898
1917
  }
1899
1918
  function rect(el) {
1900
1919
  return el && el.nodeType ? el.getBoundingClientRect() : el
1901
1920
  }
1902
- function scrollPos(page, key) {
1903
- return window[page] || html[key] || body[key] || 0
1904
- }
1905
1921
  function step(num, factor, mid) {
1906
1922
  var x = ("" + factor).split(".")
1907
1923
  , steps = num / factor