@litejs/ui 25.5.0 → 25.10.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/css/anim.css CHANGED
@@ -1,20 +1,13 @@
1
1
 
2
- /**
3
- * 1. Trigger GPU acceleration.
4
- * Remove first flicker on iphone.
5
- */
6
2
 
7
3
  .anim,
8
4
  .anim:after,
9
5
  .anim:before {
10
- -webkit-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
11
- -moz-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
12
- -o-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
13
- transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
6
+ transition: all .2s;
14
7
 
15
- -webkit-transform: translate3d(0, 0, 0); /* 1 */
16
- transform: translate3d(0, 0, 0);
17
- -webkit-perspective: 1000;
18
- perspective: 1000;
8
+ /* Trigger GPU acceleration. Remove first flicker on iphone. */
9
+ transform: translate3d(0, 0, 0);
10
+
11
+ perspective: 1000;
19
12
  }
20
13
 
package/css/base.css CHANGED
@@ -1,40 +1,21 @@
1
1
 
2
- /**
3
- * 1. Do not adjusts the text size automatically.
4
- * IE Phone note - If the viewport is set using <meta> element,
5
- * the value of the CSS text-size-adjust property is ignored.
6
- * Webkit bug - If -webkit-text-size-adjust is explicitely set to none,
7
- * Webkit-based desktop browsers, like Chrome or Safari,
8
- * instead of ignoring the property, will prevent the user to zoom in or out the Web page.
9
- * See Bug 56543, Bug 163359, and Bug 84186.
10
- * 2. IE for Windows Phone 8.1 supports "-webkit-text-size-adjust" as an alias for "-ms-text-size-adjust".
11
- * 3. Firefox<29, iOS<4, Android<4 need vendor prefixes.
12
- * 4. Disable double-tap gestures to remove 350 millisecond delay before single taps.
13
- * 5. Improve scroll performance by stop the paint on scroll.
14
- * Fix position: fixed in most Android 2.2–2.3 browsers
15
- * http://benfrain.com/easy-css-fix-fixed-positioning-android-2-2-2-3/
16
- */
2
+
17
3
 
18
4
  *, *:before, *:after {
19
5
  color: inherit;
20
- -webkit-box-sizing: inherit; /* 3 */
21
- -moz-box-sizing: inherit;
22
- box-sizing: inherit;
23
- -webkit-backface-visibility: inherit;
24
- backface-visibility: inherit;
6
+ box-sizing: inherit;
7
+ backface-visibility: inherit;
25
8
  }
26
9
 
27
10
  html {
28
- -webkit-text-size-adjust: 100%; /* 1 */
29
- -ms-text-size-adjust: 100%; /* 2 */
30
- -webkit-font-smoothing: antialiased;
31
- -webkit-box-sizing: border-box; /* 3 */
32
- -moz-box-sizing: border-box;
33
- box-sizing: border-box;
34
- touch-action: manipulation; /* 4 */
35
- -webkit-backface-visibility: hidden; /* 5 */
36
- backface-visibility: hidden;
37
- text-rendering: optimizeLegibility;
11
+ /* 62.5% sets 1em = 10px (16px × 0.625) */
12
+ font-size: 62.5%;
13
+
14
+ /* Use IE4 superior box model */
15
+ box-sizing: border-box;
16
+
17
+ /* Improve scroll performance by stop the paint on scroll */
18
+ backface-visibility: hidden;
38
19
  }
39
20
 
40
21
  html,
@@ -64,16 +45,10 @@ label,
64
45
  pointer-events: none;
65
46
  }
66
47
 
67
- button {
68
- /* Fix extra padding issue in IE6/7 */
69
- width: auto;
70
- overflow: visible;
71
- }
72
-
73
48
  b,
74
49
  strong,
75
50
  th {
76
- /* Firefox default {font-weight:bolder} does not render well with some fonts (Helvetica Neue on macs). */
51
+ /* Firefox's default 'bolder' looks bad with some fonts (Helvetica Neue on macs). */
77
52
  font-weight: bold;
78
53
  }
79
54
 
@@ -89,142 +64,31 @@ video {
89
64
  vertical-align: top;
90
65
  }
91
66
 
92
- /**
93
- * 1. tables still need cellspacing="0" in the markup
94
- * 2. Restores the normal text size
95
- * @see http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/
96
- */
97
67
 
98
68
  table {
69
+ /* tables still need cellspacing="0" in the markup */
99
70
  border-collapse: collapse;
100
- border-spacing: 0; /* 1 */
71
+ border-spacing: 0;
101
72
  }
102
73
 
103
74
  code,
104
75
  kbd,
105
76
  pre,
106
77
  samp {
107
- font-family: monospace, monospace; /* 2 */
78
+ /* Fix monospace bug in browsers that may ignore first one */
79
+ font-family: monospace, monospace;
108
80
  font-size: 1em;
109
81
  }
110
82
 
111
83
  textarea {
112
- resize: vertical;
84
+ resize: both;
113
85
  }
114
86
 
115
87
  button,
116
- [draggable=true],
117
88
  .btn,
118
- .no-select {
119
- -webkit-user-select: none;
120
- -khtml-user-select: none;
121
- -moz-user-select: none;
122
- -ms-user-select: none;
123
- -o-user-select: none;
124
- user-select: none;
125
- }
126
-
89
+ .no-select,
127
90
  [draggable=true] {
128
- -webkit-user-drag: element;
129
- -khtml-user-drag: element;
130
- user-drag: element;
131
- }
132
-
133
-
134
- /**
135
- * Global Classes
136
- * --------------
137
- */
138
-
139
- .max-height {
140
- height: auto !important;
141
- height: 100%;
142
- min-height: 100%;
143
- }
144
-
145
- .sm .sm-hide,
146
- .md .md-hide,
147
- .lg .lg-hide,
148
- .hide-empty:empty,
149
- .hide {
150
- display: none !important;
151
- visibility: hidden;
152
- }
153
- .transparent {
154
- opacity: 0 !important;
155
- filter: alpha(opacity=0) !important;
156
- }
157
- .abs {
158
- position: absolute;
159
- }
160
- .absr {
161
- position: absolute;
162
- top: 0px;
163
- right: 0px;
164
- }
165
- .fix {
166
- position: absolute;
167
- position: fixed;
168
- }
169
- .rel {
170
- position: relative;
171
- height: 100%;
172
- }
173
- .max {
174
- top: 0px;
175
- left: 0px;
176
- width: 100%;
177
- height: 100%;
178
- overflow: hidden;
179
- }
180
-
181
-
182
- /* establishes a new block formatting context */
183
- .block {
184
- overflow: hidden;
185
- }
186
-
187
- .btn,
188
- .no-wrap,
189
- .ellipsis {
190
- text-overflow: ellipsis;
191
- white-space: nowrap;
192
- }
193
-
194
- .sm .sm-left,
195
- .md .md-left,
196
- .lg .lg-left,
197
- .left {
198
- float: left;
199
- }
200
-
201
- .sm .sm-right,
202
- .md .md-right,
203
- .lg .lg-right,
204
- .right {
205
- float: right !important;
206
- }
207
-
208
- .sm .sm-t-left,
209
- .md .md-t-left,
210
- .lg .md-t-left,
211
- .lg .lg-t-left,
212
- .t-left {
213
- text-align: left;
214
- }
215
- .sm .sm-t-center,
216
- .md .md-t-center,
217
- .lg .md-t-center,
218
- .lg .lg-t-center,
219
- .t-center {
220
- text-align: center;
221
- }
222
- .sm .sm-t-right,
223
- .md .md-t-right,
224
- .lg .md-t-right,
225
- .lg .lg-t-right,
226
- .t-right {
227
- text-align: right;
91
+ user-select: none;
228
92
  }
229
93
 
230
94
 
package/css/global.css ADDED
@@ -0,0 +1,99 @@
1
+
2
+
3
+ /**
4
+ * Global Classes
5
+ * --------------
6
+ */
7
+
8
+ .max-height {
9
+ height: auto !important;
10
+ height: 100%;
11
+ min-height: 100%;
12
+ }
13
+
14
+ .sm .sm-hide,
15
+ .md .md-hide,
16
+ .lg .lg-hide,
17
+ .hide-empty:empty,
18
+ .hide {
19
+ display: none !important;
20
+ visibility: hidden;
21
+ }
22
+ .transparent {
23
+ opacity: 0 !important;
24
+ filter: alpha(opacity=0) !important;
25
+ }
26
+ .abs {
27
+ position: absolute;
28
+ }
29
+ .absr {
30
+ position: absolute;
31
+ top: 0px;
32
+ right: 0px;
33
+ }
34
+ .fix {
35
+ position: absolute;
36
+ position: fixed;
37
+ }
38
+ .rel {
39
+ position: relative;
40
+ height: 100%;
41
+ }
42
+ .max {
43
+ top: 0px;
44
+ left: 0px;
45
+ width: 100%;
46
+ height: 100%;
47
+ overflow: hidden;
48
+ }
49
+
50
+
51
+ /* establishes a new block formatting context */
52
+ .block {
53
+ overflow: hidden;
54
+ }
55
+
56
+ .btn,
57
+ .no-wrap,
58
+ .ellipsis {
59
+ text-overflow: ellipsis;
60
+ white-space: nowrap;
61
+ }
62
+
63
+ .sm .sm-left,
64
+ .md .md-left,
65
+ .lg .lg-left,
66
+ .left {
67
+ float: left;
68
+ }
69
+
70
+ .sm .sm-right,
71
+ .md .md-right,
72
+ .lg .lg-right,
73
+ .right {
74
+ float: right !important;
75
+ }
76
+
77
+ .sm .sm-t-left,
78
+ .md .md-t-left,
79
+ .lg .md-t-left,
80
+ .lg .lg-t-left,
81
+ .t-left {
82
+ text-align: left;
83
+ }
84
+ .sm .sm-t-center,
85
+ .md .md-t-center,
86
+ .lg .md-t-center,
87
+ .lg .lg-t-center,
88
+ .t-center {
89
+ text-align: center;
90
+ }
91
+ .sm .sm-t-right,
92
+ .md .md-t-right,
93
+ .lg .md-t-right,
94
+ .lg .lg-t-right,
95
+ .t-right {
96
+ text-align: right;
97
+ }
98
+
99
+
package/load.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /*! litejs.com/MIT-LICENSE.txt */
3
3
 
4
- /* global location */
4
+ /* global document, location */
5
5
 
6
6
  // With initial congestion window set to 2 and 1452 bytes of data in a segment.
7
7
  // - 1 round trip to get 2904 bytes, Initial Window (IW) = 2
@@ -18,46 +18,43 @@
18
18
  // xhr("PUT", url).send(null) Works in all major browsers
19
19
 
20
20
 
21
- !function(window, Function) {
22
- var initTime = xhr._t = +new Date()
23
- , rewrite = {
21
+ !function(window) {
22
+ var rewrite = {
24
23
  //!{loadRewrite}
25
24
  }
26
- // Move setTimeout from window.prototype to window object for future patching in IE9.
27
- , setTimeout_ = window.setTimeout = setTimeout
28
- /*** debug ***/
29
- // Expose xhr._c for testing.
30
- , loaded = xhr._c = {}
31
- /*/
32
- , loaded = {}
33
- /**/
34
-
35
- /*** activex ***/
36
- // XMLHttpRequest in IE7-8 do not accept PATCH, use ActiveX.
37
- // IE disallows adding custom properties to ActiveX objects and read/write readystatechange after send().
38
- , XMLHttpRequest = +"\v1" && window.XMLHttpRequest || Function("return new ActiveXObject('Microsoft.XMLHTTP')")
25
+ /*** log ***/
26
+ , initTime = xhr._t = +new Date()
39
27
  /**/
28
+ // Expose xhr._c for testing.
29
+ , loaded = /*** debug ***/ xhr._c = /**/ {}
40
30
 
31
+ /*** ie9 ***/
32
+ , Fn = Function
33
+ , nop = Fn()
41
34
  , execScript =
42
35
  // IE5-10, Chrome1-12
43
36
  window.execScript ||
44
- /*** inject ***/
45
37
  // THANKS: Juriy Zaytsev - Global eval [http://perfectionkills.com/global-eval-what-are-the-options/]
46
38
  // In case of local execution `e('eval')` returns undefined
47
- Function("e,eval", "try{return e('eval')}catch(e){}")(eval) ||
48
- Function("a", "var d=document,b=d.body,s=d.createElement('script');s.text=a;b.removeChild(b.insertBefore(s,b.firstChild))")
49
- /*/
50
- eval
51
- /**/
52
- , nop = Function()
39
+ Fn("e,eval", "try{return e('eval')}catch(e){}")(eval) ||
40
+ Fn("a", "var d=document,b=d.body,s=d.createElement('script');s.text=a;b.appendChild(s)")
41
+
42
+ // Move setTimeout from window.prototype to window object for future patching in IE9.
43
+ , setTimeout_ = window.setTimeout = setTimeout
53
44
 
54
- /*** reuse ***/
55
45
  // XHR memory leak mitigation
56
46
  , xhrs = []
47
+
48
+ // XMLHttpRequest in IE7-8 do not accept PATCH, use ActiveX.
49
+ // IE disallows adding custom properties to ActiveX objects and read/write readystatechange after send().
50
+ , XMLHttpRequest = +"\v1" && window.XMLHttpRequest || Fn("return new ActiveXObject('Microsoft.XMLHTTP')")
51
+ /*/
52
+ , execScript = eval
53
+ , setTimeout_ = setTimeout
57
54
  /**/
58
55
 
56
+ /*** log ***/
59
57
  , unsentLog = xhr._l = []
60
- /*** onerror ***/
61
58
  , lastError
62
59
  , onerror = window.onerror = function(message, file, line, col, error) {
63
60
  // Do not send multiple copies of the same error.
@@ -68,26 +65,33 @@
68
65
  , col || (window.event || unsentLog).errorCharacter || "?"
69
66
  , message
70
67
  ].join(":")
71
- )) log("e", lastError, (error && (error.stack || error.stacktrace) || "-") + "\n" + location)
68
+ )) log("e", lastError, [error && (error.stack || error.stacktrace) || "-", "" + location])
69
+ }
70
+ , log = xhr.log = function(type, msg, extra) {
71
+ if (unsentLog.push([new Date() - initTime, type].concat(msg, extra || [])) < 2) sendLog()
72
+ function sendLog() {
73
+ setTimeout_(xhr.sendLog || sendLog, 1307)
74
+ }
72
75
  }
73
- /*/
74
- , onerror = nop
75
76
  /**/
76
77
 
77
- xhr.log = log
78
- function log(type, msg, extra) {
79
- if (unsentLog.push([ new Date() - initTime, type, msg, extra ]) < 2) sendLog()
80
- }
81
78
 
82
- function sendLog() {
83
- setTimeout_(xhr.sendLog || sendLog, 1307)
79
+ /*** theme ***/
80
+ , ALT_THEME = "dark"
81
+ , matchMedia = window.matchMedia
82
+ , localStorage = window.localStorage
83
+ if (ALT_THEME == (
84
+ localStorage && localStorage.theme ||
85
+ matchMedia && matchMedia("(prefers-color-scheme:dark)").matches && ALT_THEME
86
+ )) {
87
+ document.documentElement.className = "is-" + ALT_THEME
84
88
  }
85
-
86
- // next === true is for sync call
89
+ /**/
87
90
 
88
91
  window.xhr = xhr
92
+ // next === true is for sync call
89
93
  function xhr(method, url, next, attr1, attr2) {
90
- var req = /*** reuse ***/ xhrs.pop() || /**/ new XMLHttpRequest()
94
+ var req = /*** ie9 ***/ xhrs.pop() || /**/ new XMLHttpRequest()
91
95
 
92
96
  // To be able to reuse the XHR object properly,
93
97
  // use the open method first and set onreadystatechange later.
@@ -160,9 +164,12 @@
160
164
  attr1,
161
165
  attr2
162
166
  )
167
+ /*** ie9 ***/
168
+ // ActiveXObject does not accept `null` for onreadystatechange
163
169
  req.onreadystatechange = next = nop
164
- /*** reuse ***/
165
170
  xhrs.push(req)
171
+ /*/
172
+ req.onreadystatechange = next = null
166
173
  /**/
167
174
  }
168
175
  }
@@ -193,7 +200,7 @@
193
200
 
194
201
  function cb(err, str, fileName, filePos) {
195
202
  loaded[fileName] = 2
196
- res[filePos] = err ? (onerror(err, fileName), "") : str
203
+ res[filePos] = err ? (/*** log ***/ onerror(err, fileName),/**/ "") : str
197
204
  exec()
198
205
  }
199
206
  function exec() {
@@ -211,14 +218,16 @@
211
218
  })
212
219
  }
213
220
  } catch(e) {
221
+ /*** log ***/
214
222
  onerror(e, files[pos])
223
+ /**/
215
224
  }
216
225
  res[pos] = ""
217
226
  }
218
227
  }
219
228
  if (res[pos] === "" || !files[pos]) {
220
229
  if (++pos < len) exec()
221
- /*** inject ***/
230
+ /*** ie9 ***/
222
231
  // inject can be async
223
232
  else if (pos === len && execScript !== eval) setTimeout_(exec, 1)
224
233
  /**/
@@ -237,5 +246,5 @@
237
246
  ])
238
247
  /**/
239
248
 
240
- }(this, Function) // jshint ignore:line
249
+ }(this) // jshint ignore:line
241
250
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/ui",
3
- "version": "25.5.0",
3
+ "version": "25.10.0",
4
4
  "description": "UI engine for LiteJS full-stack framework",
5
5
  "license": "MIT",
6
6
  "author": "Lauri Rooden <lauri@rooden.ee>",
package/shim.js CHANGED
@@ -24,7 +24,7 @@
24
24
  // queueMicrotask - Chrome71, Firefox69, Safari12.1
25
25
  // "".at(), [].at() - Chrome92, Firefox90, Safari15.4
26
26
 
27
- var UNDEF, isArray, oKeys
27
+ var UNDEF, canCapture, isArray, oKeys
28
28
  , O = window
29
29
  , patched = (window.xhr || window)._p = []
30
30
  , jsonRe = /[\x00-\x1f\x22\x5c]/g
@@ -111,7 +111,8 @@
111
111
  patch(b, a, ie6789, isFn)
112
112
 
113
113
  // 20 fps is good enough
114
- patch("request" + (a = "AnimationFrame"), "return setTimeout(a,50)")
114
+ a = "AnimationFrame"
115
+ patch("request" + a, "return setTimeout(a,50)")
115
116
  // window.mozRequestAnimationFrame || // Firefox 4-23
116
117
  // window.webkitRequestAnimationFrame || // Chrome 10-24
117
118
  // window.msRequestAnimationFrame || // IE 10 PP2+
@@ -246,7 +247,7 @@
246
247
  }
247
248
 
248
249
  createStorage("session") // Chrome5, FF2, IE8, Safari4
249
- createStorage("local") // Chrome5, FF3.5, IE8, Safari4
250
+ createStorage("local") // Chrome5, FF3.5, IE8, Safari4, IE8
250
251
 
251
252
  // IE8 has console, however, the console object does not exist if the console is not opened.
252
253
  patch("console", {log: nop, error: nop})
@@ -286,15 +287,21 @@
286
287
  // https://bugzilla.mozilla.org/show_bug.cgi?id=666448
287
288
  patch("escape", "return X(a)", esc("a", 0) != "a", esc)
288
289
 
289
- // From Chrome23/Firefox21 parseInt parses leading-zero strings as decimal, not octal
290
+ // Since Chrome23/Firefox21 parseInt parses leading-zero strings as decimal, not octal
290
291
  b = patch("g:parseInt", "return X(a,(b>>>0)||(Y.test(''+a)?16:10))", _parseInt("08") !== 8, _parseInt, /^\s*[-+]?0[xX]/)
291
292
 
292
293
  O = Number
293
294
  patch("parseInt", b)
294
295
  patch("parseFloat", parseFloat)
295
296
  patch("isNaN", "return a!==a")
296
- patch("isInteger", "return X(a)&&Math.floor(a)===a", 0, patch("isFinite", "return typeof a==='number'&&isFinite(a)"))
297
- patch("isSafeInteger", "return a<=X", 0, patch("MAX_SAFE_INTEGER", 9007199254740991))
297
+ a = Math.pow
298
+ c = "_SAFE_INTEGER"
299
+ patch("EPSILON", a(2, -52))
300
+ patch(
301
+ "isSafeInteger", "return Y(a)&&a>=X&&a<=-X", 0,
302
+ patch("MIN" + c, -patch("MAX" + c, a(2, 53)-1)),
303
+ patch("isInteger", "return X(a)&&a%1===0", 0, patch("isFinite", "return typeof a==='number'&&isFinite(a)"))
304
+ )
298
305
 
299
306
  O = Date
300
307
  patch("now", "return+new Date")
@@ -389,7 +396,7 @@
389
396
  patch("at", a + "[a]")
390
397
 
391
398
  O = String[P]
392
- patch("at", a + ".charAt(a)")
399
+ patch("s:at", a + ".charAt(a)")
393
400
  patch("endsWith", "return(a+='')===t.slice(-a.length)")
394
401
  patch("startsWith", "return t.lastIndexOf(a,0)===0")
395
402
  patch("trim", "return t.replace(/^\\s+|\\s+$/g,'')")
@@ -434,10 +441,21 @@
434
441
  , closest = patch("closest", walk.bind(window, "parentNode", 1))
435
442
  , matches = patch("matches", "return!!X(a)(t)", 0, selectorFn)
436
443
 
444
+ try {
445
+ O[a = "addEventListener"]("t", null, Object.defineProperties({}, {
446
+ capture: { get: function() { canCapture = 1 } }
447
+ }))
448
+ b = "removeEventListener"
449
+ c = "O.call(t,a,b,X(c)?!!c.capture:!!c)"
450
+ if (!canCapture) {
451
+ patch("c:" + a, c, 1, isObj)
452
+ patch("c:" + b, c, 1, isObj)
453
+ }
454
+ } catch(e){}
437
455
  // The addEventListener is supported in Internet Explorer from version 9.
438
456
  // https://developer.mozilla.org/en-US/docs/Web/Reference/Events/wheel
439
457
  // - IE8 always prevents the default of the mousewheel event.
440
- patch("addEventListener", "return(t.attachEvent('on'+a,b=X(t,a,b)),b)", 0, function(el, ev, fn) {
458
+ patch(a, "return(t.attachEvent('on'+a,b=X(t,a,b)),b)", 0, function(el, ev, fn) {
441
459
  return function() {
442
460
  var e = new Event(ev)
443
461
  if (e.clientX !== UNDEF) {
@@ -447,7 +465,8 @@
447
465
  fn.call(el, e)
448
466
  }
449
467
  })
450
- patch("removeEventListener", "t.detachEvent('on'+a,b)")
468
+ patch(b, "t.detachEvent('on'+a,b)")
469
+
451
470
 
452
471
  // Note: querySelector in IE8 supports only CSS 2.1 selectors
453
472
  patch((a = "querySelector"), (b = "return X(t,a,Y)"), ie678, find, 1)
@@ -519,6 +538,9 @@
519
538
  function isStr(value) {
520
539
  return typeof value === "string"
521
540
  }
541
+ function isObj(obj) {
542
+ return !!obj && obj.constructor === Object
543
+ }
522
544
  function nop() {}
523
545
 
524
546
  function patch(key_, src, force, arg1, arg2) {