@litejs/ui 23.4.1 → 24.0.0-rc.2
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/smooth-scroll.css +8 -0
- package/el/confirm.tpl +7 -7
- package/el/crop.view +54 -0
- package/index.js +569 -636
- package/load.js +26 -45
- package/package.json +2 -2
- package/polyfill/crypto.js +30 -0
- package/polyfill/index.js +33 -22
- package/require.js +33 -0
package/load.js
CHANGED
|
@@ -30,12 +30,13 @@
|
|
|
30
30
|
|
|
31
31
|
!function(window, Function) {
|
|
32
32
|
xhr._s = new Date()
|
|
33
|
-
var
|
|
34
|
-
// IE9, move setTimeout from window.prototype to window object cache, so you can override it later
|
|
35
|
-
, setTimeout_ = (window.setTimeout = window.setTimeout) || setTimeout
|
|
33
|
+
var pending = xhr._p = {}
|
|
36
34
|
, rewrite = {
|
|
37
35
|
//!{loadRewrite}
|
|
38
36
|
}
|
|
37
|
+
// IE9, move setTimeout from window.prototype to window object, so you can patch it later
|
|
38
|
+
// `|| setTimeout` is for testing
|
|
39
|
+
, setTimeout_ = (window.setTimeout = window.setTimeout) || setTimeout
|
|
39
40
|
/*** activex ***/
|
|
40
41
|
, XMLHttpRequest = +"\v1" && window.XMLHttpRequest || Function("return new ActiveXObject('Microsoft.XMLHTTP')")
|
|
41
42
|
/**/
|
|
@@ -44,13 +45,16 @@
|
|
|
44
45
|
window.execScript ||
|
|
45
46
|
/*** inject ***/
|
|
46
47
|
// THANKS: Juriy Zaytsev - Global eval [http://perfectionkills.com/global-eval-what-are-the-options/]
|
|
48
|
+
// In case of local execution `e('eval')` returns undefined
|
|
47
49
|
Function("e,eval", "try{return e('eval')}catch(e){}")(eval) ||
|
|
50
|
+
/* ignore next */
|
|
48
51
|
Function("a", "var d=document,b=d.body,s=d.createElement('script');s.text=a;b.removeChild(b.insertBefore(s,b.firstChild))")
|
|
49
52
|
/*/
|
|
50
53
|
eval
|
|
51
54
|
/**/
|
|
52
55
|
|
|
53
56
|
/*** reuse ***/
|
|
57
|
+
// XHR memory leak mitigation
|
|
54
58
|
, xhrs = []
|
|
55
59
|
/**/
|
|
56
60
|
|
|
@@ -66,7 +70,7 @@
|
|
|
66
70
|
, col || (window.event || unsentErrors).errorCharacter || "?"
|
|
67
71
|
, message
|
|
68
72
|
].join(":")
|
|
69
|
-
) &&
|
|
73
|
+
) && 2 > unsentErrors.push(
|
|
70
74
|
[ +new Date()
|
|
71
75
|
, lastError
|
|
72
76
|
, error && (error.stack || error.stacktrace) || "-"
|
|
@@ -132,7 +136,7 @@
|
|
|
132
136
|
//xhr.ontimeout = timeoutRaised
|
|
133
137
|
|
|
134
138
|
if (next !== true) xhr.onreadystatechange = function() {
|
|
135
|
-
if (xhr.readyState
|
|
139
|
+
if (xhr.readyState > 3) {
|
|
136
140
|
// From the XMLHttpRequest spec:
|
|
137
141
|
//
|
|
138
142
|
// > For 304 Not Modified responses
|
|
@@ -183,37 +187,6 @@
|
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
|
|
186
|
-
/*** require ***/
|
|
187
|
-
var modules = {}
|
|
188
|
-
, process = window.process = {
|
|
189
|
-
env: {}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
//process.memoryUsage = function() {
|
|
193
|
-
// return (window.performance || {}).memory || {}
|
|
194
|
-
//}
|
|
195
|
-
|
|
196
|
-
window.require = require
|
|
197
|
-
function require(name) {
|
|
198
|
-
var mod = modules[name]
|
|
199
|
-
if (!mod) throw Error("Module not found: " + name)
|
|
200
|
-
if (typeof mod == "string") {
|
|
201
|
-
var exports = modules[name] = {}
|
|
202
|
-
, module = { id: name, filename: name, exports: exports }
|
|
203
|
-
Function("exports,require,module,process,global", mod).call(
|
|
204
|
-
exports, exports, require, module, process, window
|
|
205
|
-
)
|
|
206
|
-
mod = modules[name] = module.exports
|
|
207
|
-
}
|
|
208
|
-
return mod
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
require.def = function(map, key) {
|
|
212
|
-
for (key in map) modules[key] = map[key]
|
|
213
|
-
}
|
|
214
|
-
/**/
|
|
215
|
-
|
|
216
|
-
|
|
217
190
|
/*** load ***/
|
|
218
191
|
xhr.load = load
|
|
219
192
|
function load(files, next) {
|
|
@@ -224,13 +197,13 @@
|
|
|
224
197
|
, len = files && files.length
|
|
225
198
|
, res = []
|
|
226
199
|
|
|
227
|
-
for (; i < len; i++) if ((file = files[i]) &&
|
|
228
|
-
if (
|
|
229
|
-
// Same file requested again
|
|
230
|
-
;(
|
|
200
|
+
for (; i < len; i++) if ((file = files[i]) && pending[file] !== 2) {
|
|
201
|
+
if (pending[file]) {
|
|
202
|
+
// Same file requested again before responce
|
|
203
|
+
;(pending[file].x || (pending[file].x = [])).push(exec, res, i)
|
|
231
204
|
} else {
|
|
232
205
|
// FireFox 3 throws on `xhr.send()` without arguments
|
|
233
|
-
xhr("GET", file,
|
|
206
|
+
xhr("GET", file, pending[file] = cb, i).send(null)
|
|
234
207
|
}
|
|
235
208
|
pos++
|
|
236
209
|
}
|
|
@@ -239,14 +212,22 @@
|
|
|
239
212
|
pos = 0
|
|
240
213
|
|
|
241
214
|
function cb(err, str, file, i) {
|
|
242
|
-
|
|
215
|
+
;(xhr._l || (xhr._l = [])).push(file)
|
|
216
|
+
pending[file] = 2
|
|
243
217
|
res[i] = err ? (onerror(err, file), "") : str
|
|
244
218
|
exec()
|
|
245
219
|
}
|
|
246
220
|
function exec() {
|
|
247
221
|
if (res[pos]) {
|
|
248
222
|
try {
|
|
249
|
-
|
|
223
|
+
var execResult = (xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos])
|
|
224
|
+
if (execResult && execResult.then) {
|
|
225
|
+
res[pos] = 0
|
|
226
|
+
return execResult.then(function() {
|
|
227
|
+
res[pos] = ""
|
|
228
|
+
exec()
|
|
229
|
+
})
|
|
230
|
+
}
|
|
250
231
|
} catch(e) {
|
|
251
232
|
onerror(e, files[pos])
|
|
252
233
|
}
|
|
@@ -260,8 +241,8 @@
|
|
|
260
241
|
/**/
|
|
261
242
|
else {
|
|
262
243
|
if (next) next()
|
|
263
|
-
if ((
|
|
264
|
-
for (i = 0;
|
|
244
|
+
if ((next = cb.x)) {
|
|
245
|
+
for (i = 0; next[i]; ) next[i++](next[i++][next[i++]] = "")
|
|
265
246
|
}
|
|
266
247
|
}
|
|
267
248
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litejs/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-rc.2",
|
|
4
4
|
"description": "UI engine for LiteJS full-stack framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lauri Rooden <lauri@rooden.ee>",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "TZ='Europe/Tallinn' lj test test/index.js --brief --coverage && jshint --verbose *.js src/*.js binding/*.js polyfill/*.js"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@litejs/cli": "23.
|
|
28
|
+
"@litejs/cli": "23.6.2",
|
|
29
29
|
"jshint": "2.13.6"
|
|
30
30
|
},
|
|
31
31
|
"litejs": {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
//let uuid = crypto.randomUUID()
|
|
3
|
+
|
|
4
|
+
var crypto = require("crypto")
|
|
5
|
+
function uuidv4() {
|
|
6
|
+
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
|
7
|
+
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
8
|
+
)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function uuidv4_() {
|
|
12
|
+
var rand = crypto.getRandomValues(new Uint8Array(36))
|
|
13
|
+
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c,p) {
|
|
14
|
+
return (c ^ rand[p] & 15 >> c / 4).toString(16)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function uuidv4__() {
|
|
19
|
+
var rand = crypto.getRandomValues(new Uint16Array(8))
|
|
20
|
+
rand[3] = rand[3] &0x0fff|0x4000
|
|
21
|
+
rand[4] = rand[4] &0x3fff|0x8000
|
|
22
|
+
return Array.from(rand).map(function(c,p){
|
|
23
|
+
return (p>1&&p<6?'-':'') + (0x10000 + c).toString(16).slice(-4)
|
|
24
|
+
}).join("")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
console.log(uuidv4())
|
|
28
|
+
console.log(uuidv4_())
|
|
29
|
+
console.log(uuidv4__())
|
|
30
|
+
|
package/polyfill/index.js
CHANGED
|
@@ -9,19 +9,13 @@
|
|
|
9
9
|
// - RegExp lookahead /(?=a)/ and non-greedy modifiers /a+?/
|
|
10
10
|
// - if ("key" in map) and hasOwnProperty
|
|
11
11
|
|
|
12
|
-
// IE5.5-IE7
|
|
13
|
-
// Event,
|
|
14
|
-
// IE8 Patched: 38
|
|
15
|
-
// Event, pointer, setTimeout, setInterval, requestAnimationFrame, cancelAnimationFrame, console, matchMedia, performance, p:now, timing, d:now, toJSON, toISOString, bind, assign, create, entries, keys, values, toString, isArray, from, indexOf, lastIndexOf, reduce, reduceRight, every, forEach, map, filter, some, trim, sendBeacon, matches, closest, querySelector, querySelectorAll
|
|
16
|
-
// IE10 Patched: 9
|
|
17
|
-
// Event, pointer:MS, assign, entries, values, from, sendBeacon, matches, closest
|
|
18
|
-
// IE11 Patched: 8
|
|
19
|
-
// Event, assign, entries, values, from, sendBeacon, matches, closest
|
|
12
|
+
// IE5.5-IE7 patched 56
|
|
13
|
+
// "Event","pointer","sessionStorage","localStorage","requestAnimationFrame","cancelAnimationFrame","console","matchMedia","JSON","setTimeout","setInterval","g:parseInt","performance","p:now","timing","parseInt","parseFloat","isNaN","isFinite","isInteger","MAX_SAFE_INTEGER","isSafeInteger","d:now","toJSON","toISOString","bind","assign","create","entries","hasOwn","keys","values","toString","isArray","from","of","includes","indexOf","lastIndexOf","reduce","reduceRight","splice","every","forEach","map","filter","some","flat","flatMap","endsWith","startsWith","trim","sendBeacon","matches","querySelector","querySelectorAll"
|
|
20
14
|
|
|
21
15
|
|
|
22
16
|
/* global El, xhr */
|
|
23
17
|
/* c8 ignore start */
|
|
24
|
-
!function(window, Function, Infinity, P) {
|
|
18
|
+
!function(window, Date, Function, Infinity, P) {
|
|
25
19
|
|
|
26
20
|
// Array#flat() - Chrome69, Edge79, Firefox62, Safari12
|
|
27
21
|
// window.PointerEvent - Chrome55, Edge12, Firefox59, Safari13, IE11
|
|
@@ -36,6 +30,7 @@
|
|
|
36
30
|
, JSONmap = {"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\"":"\\\"","\\":"\\\\"}
|
|
37
31
|
, hasOwn = JSONmap.hasOwnProperty
|
|
38
32
|
, esc = escape
|
|
33
|
+
, _parseInt = parseInt
|
|
39
34
|
, document = patch("document", {body:{}})
|
|
40
35
|
, navigator = patch("navigator")
|
|
41
36
|
// JScript engine in IE<9 does not recognize vertical tabulation character
|
|
@@ -160,14 +155,6 @@
|
|
|
160
155
|
}
|
|
161
156
|
}
|
|
162
157
|
|
|
163
|
-
// Ignore FF3 escape second non-standard argument
|
|
164
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=666448
|
|
165
|
-
patch("escape", "return X(a)", esc("a", 0) != "a", esc)
|
|
166
|
-
|
|
167
|
-
// Patch parameters support for setTimeout callback
|
|
168
|
-
patch("setTimeout", (a = "return O(X(a)&&A.length>2?a.apply.bind(a,null,S.call(A,2)):a,b)"), ie6789, isFn)
|
|
169
|
-
patch("setInterval", a, ie6789, isFn)
|
|
170
|
-
|
|
171
158
|
function createStorage(name) {
|
|
172
159
|
try {
|
|
173
160
|
// FF4-beta with dom.storage.enabled=false throws for accessing windows.localStorage
|
|
@@ -259,22 +246,46 @@
|
|
|
259
246
|
}
|
|
260
247
|
})
|
|
261
248
|
|
|
249
|
+
// Patch parameters support for setTimeout callback
|
|
250
|
+
patch("setTimeout", (a = "return O(X(a)&&A.length>2?a.apply.bind(a,null,S.call(A,2)):a,b)"), ie6789, isFn)
|
|
251
|
+
patch("setInterval", a, ie6789, isFn)
|
|
252
|
+
|
|
253
|
+
// Ignore FF3 escape second non-standard argument
|
|
254
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=666448
|
|
255
|
+
patch("escape", "return X(a)", esc("a", 0) != "a", esc)
|
|
256
|
+
|
|
257
|
+
// From Chrome23/Firefox21 parseInt parses leading-zero strings as decimal, not octal
|
|
258
|
+
b = patch("g:parseInt", "return X(a,(b>>>0)||(Y.test(''+a)?16:10))", _parseInt("08") !== 8, _parseInt, /^\s*[-+]?0[xX]/)
|
|
259
|
+
|
|
260
|
+
|
|
262
261
|
O = patch("performance")
|
|
263
262
|
patch("p:now", (a = "return+new Date") + "-X", 0, new Date())
|
|
264
263
|
patch("timing")
|
|
265
264
|
|
|
265
|
+
O = Number
|
|
266
|
+
patch("parseInt", b)
|
|
267
|
+
patch("parseFloat", parseFloat)
|
|
268
|
+
patch("isNaN", "return a!==a")
|
|
269
|
+
patch("isInteger", "return X(a)&&Math.floor(a)===a", 0, patch("isFinite", "return typeof a==='number'&&isFinite(a)"))
|
|
270
|
+
patch("isSafeInteger", "return a<=X", 0, patch("MAX_SAFE_INTEGER", 9007199254740991))
|
|
271
|
+
|
|
266
272
|
O = Date
|
|
267
273
|
patch("d:now", a)
|
|
268
274
|
|
|
269
275
|
/*** toISOString ***/
|
|
270
276
|
O = O[P]
|
|
271
277
|
// IE8 toJSON does not return milliseconds
|
|
272
|
-
//
|
|
273
|
-
|
|
274
|
-
patch(
|
|
278
|
+
// FF37 returns invalid extended ISO-8601, `29349-01-26T00:00:00.000Z` instead of `+029349-01-26T00:00:00.000Z`
|
|
279
|
+
b = O[a = "toISOString"] && new Date(8e14)[a]().length < 27 || ie678
|
|
280
|
+
patch(a, patch("toJSON", [
|
|
275
281
|
"a=t.getUTCFullYear();if(a!==a)throw RangeError('Invalid time');return(b=a<0?'-':a>9999?'+':'')+X(a<0?-a:a,'-',b?6:4", "Month()+1,'-'", "Date(),'T'",
|
|
276
282
|
"Hours(),':'", "Minutes(),':'", "Seconds(),'.'", "Milliseconds(),'Z',3)"
|
|
277
|
-
].join(")+X(t.getUTC"),
|
|
283
|
+
].join(")+X(t.getUTC"),
|
|
284
|
+
b,
|
|
285
|
+
function(a, b, c) {
|
|
286
|
+
return ("00000" + a).slice(-c || -2) + b
|
|
287
|
+
}
|
|
288
|
+
), b)
|
|
278
289
|
/**/
|
|
279
290
|
|
|
280
291
|
O = Function[P]
|
|
@@ -473,7 +484,7 @@
|
|
|
473
484
|
src || {}
|
|
474
485
|
))
|
|
475
486
|
}
|
|
476
|
-
}(this, Function, Infinity, "prototype") // jshint ignore:line
|
|
487
|
+
}(this, Date, Function, Infinity, "prototype") // jshint ignore:line
|
|
477
488
|
/* c8 ignore stop */
|
|
478
489
|
|
|
479
490
|
|
package/require.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
!function(window) {
|
|
4
|
+
var modules = {}
|
|
5
|
+
, process = window.process = {
|
|
6
|
+
env: {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//process.memoryUsage = function() {
|
|
10
|
+
// return (window.performance || {}).memory || {}
|
|
11
|
+
//}
|
|
12
|
+
|
|
13
|
+
window.require = require
|
|
14
|
+
function require(name) {
|
|
15
|
+
var mod = modules[name]
|
|
16
|
+
if (!mod) throw Error("Module not found: " + name)
|
|
17
|
+
if (typeof mod == "string") {
|
|
18
|
+
var exports = modules[name] = {}
|
|
19
|
+
, module = { id: name, filename: name, exports: exports }
|
|
20
|
+
Function("exports,require,module,process,global", mod).call(
|
|
21
|
+
exports, exports, require, module, process, window
|
|
22
|
+
)
|
|
23
|
+
mod = modules[name] = module.exports
|
|
24
|
+
}
|
|
25
|
+
return mod
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
require.def = function(map, key) {
|
|
29
|
+
for (key in map) modules[key] = map[key]
|
|
30
|
+
}
|
|
31
|
+
}(this)
|
|
32
|
+
|
|
33
|
+
|