@litejs/ui 24.0.0-rc.4 → 24.5.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.
@@ -1,141 +0,0 @@
1
-
2
- /* litejs.com/MIT-LICENSE.txt */
3
-
4
-
5
-
6
- !function (exports) {
7
- var resolver
8
- , nativePromise = exports.Promise
9
- // setImmediate is IE10 only
10
- , setImmediate = exports.setImmediate || function (fn) { setTimeout(fn, 1) }
11
-
12
- // Older version of the spec had a resolver object
13
- // as the arg rather than a function
14
- exports.Promise = nativePromise &&
15
- new nativePromise(function (r) { resolver = r }) &&
16
- isFn(resolver) ? nativePromise : Promise
17
-
18
-
19
- function Promise(fn) {
20
- var promise = this
21
- if (!(promise instanceof Promise && isFn(fn)))
22
- throw Error("Use: new Promise(fn)")
23
-
24
- promise._d = []
25
- resolve(promise, fn)
26
- }
27
-
28
- Promise.prototype = {
29
- _s: null,
30
- then: function (onFulfilled, onRejected) {
31
- var promise = this
32
- return new Promise(function (resolve, reject) {
33
- handle(promise, [onRejected, onFulfilled, reject, resolve])
34
- })
35
- },
36
- "catch": function (onRejected) {
37
- return this.then(null, onRejected)
38
- }
39
- }
40
-
41
- function resolve(promise, fn, done, state) {
42
- function end(val) {
43
- if (!done) {
44
- promise._s = state || false
45
- promise._v = val
46
- for (done = 0; (val = promise._d[done++]); ) {
47
- handle(promise, val)
48
- }
49
- }
50
- }
51
- try {
52
- fn(function (val) {
53
- if (val === promise)
54
- end(TypeError("A promise resolved with itself"))
55
- if (!done) try {
56
- if ((done = getThen(val))) {
57
- resolve(promise, done)
58
- } else {
59
- end(val, state = true)
60
- }
61
- } catch (e) {
62
- end(e)
63
- }
64
- }, end)
65
- } catch (e) {
66
- end(e)
67
- }
68
- }
69
-
70
- function handle(promise, fns) {
71
- if (promise._s === null) {
72
- promise._d.push(fns)
73
- } else setImmediate(function(cb) {
74
- cb = fns[+promise._s]
75
- if (isFn(cb)) try {
76
- fns[3](cb(promise._v))
77
- } catch (e) {
78
- fns[2](e)
79
- } else fns[+promise._s + 2](promise._v)
80
- })
81
- }
82
-
83
- function getThen(val, then) {
84
- return val && (typeof val == "object" || isFn(val)) &&
85
- isFn(then = val.then) && then.bind(val)
86
- }
87
-
88
- function isFn(fn) {
89
- return typeof fn == "function"
90
- }
91
-
92
- Promise.all = function (arr) {
93
- return new Promise(function (resolve, reject) {
94
- var i = 0
95
- , len = arr.length
96
- , remaining = len
97
- if (!len) resolve([])
98
- else for (arr = arr.slice(); i < len;) {
99
- resolveThen(i++)
100
- }
101
- function resolveThen(i, then) {
102
- try {
103
- if ((then = getThen(arr[i])))
104
- then(function (val) {
105
- arr[i] = val
106
- resolveThen(i)
107
- }, reject)
108
- else if (!--remaining) resolve(arr)
109
- } catch (e) {
110
- reject(e)
111
- }
112
- }
113
- })
114
- }
115
-
116
- Promise.resolve = function (val) {
117
- if (val instanceof Promise) {
118
- return val
119
- }
120
-
121
- return new Promise(function (resolve) {
122
- resolve(val)
123
- })
124
- }
125
-
126
- Promise.reject = function (val) {
127
- return new Promise(function (resolve, reject) {
128
- reject(val)
129
- })
130
- }
131
-
132
- Promise.race = function (values) {
133
- return new Promise(function (resolve, reject, val, i) {
134
- for (i = 0; (val = values[i++]); ) {
135
- val.then(resolve, reject)
136
- }
137
- })
138
- }
139
- }(this) /* jshint -W030 */
140
-
141
-
@@ -1,98 +0,0 @@
1
-
2
- /* litejs.com/MIT-LICENSE.txt */
3
-
4
-
5
-
6
- !function(exports) {
7
- var Str = exports.String || exports
8
- , Str$ = Str.prototype || exports
9
- , fromCharCode = String.fromCharCode
10
-
11
- if (!Str$.startsWith) Str$.startsWith = function(str) {
12
- return this.lastIndexOf(str, 0) === 0
13
- }
14
-
15
- if (!Str$.endsWith) Str$.endsWith = function(str) {
16
- return this.indexOf(str, this.length - str.length) > -1
17
- }
18
-
19
- if (!Str$.codePointAt) Str$.codePointAt = function(pos) {
20
- var str = this
21
- , code = str.charCodeAt(pos)
22
-
23
- return code >= 0xD800 && code <= 0xDBFF &&
24
- (str = str.charCodeAt(pos + 1)) >= 0xDC00 && str <= 0xDFFF ?
25
- (code - 0xD800) * 0x400 + str - 0xDC00 + 0x10000 :
26
- code === code ? code :
27
- void 0
28
- }
29
-
30
- // function fromCodePoint(i) { return unescape("%u"+i.toString(16)) }
31
- // function fromCodePoint(i) { return unescape("%u"+ (i>0xFFFF?(0xD800+((i-65536)>>10)).toString(16)+"%u"+((i&0x3ff)+0xDC00).toString(16):i.toString(16))) }
32
-
33
- if (!Str.fromCodePoint) Str.fromCodePoint = function() {
34
- var code
35
- , arr = arguments
36
- , len = arr.length
37
- , pos = 0
38
- , out = []
39
- , str = ""
40
-
41
- for (; pos < len; ) {
42
- code = arr[pos++]
43
- if (code <= 0xFFFF) {
44
- out.push(code)
45
- } else {
46
- code -= 0x10000
47
- out.push(
48
- (code >> 10) + 0xD800,
49
- (code % 0x400) + 0xDC00
50
- )
51
- }
52
- if (len === pos || out.length > 8191) {
53
- str += fromCharCode.apply(null, out)
54
- out.length = 0
55
- }
56
- }
57
-
58
- return str
59
- }
60
-
61
- if (!exports.TextEncoder) {
62
- exports.TextEncoder = exports.TextDecoder = TextEncoder
63
- }
64
-
65
- // Only utf-8 TextEncoder is supported by spec
66
- function TextEncoder(encoding) {
67
- this.encoding = encoding || "utf-8"
68
- }
69
- TextEncoder.prototype = {
70
- encode: function(str) {
71
- var s = unescape(encodeURIComponent(str))
72
- , len = s.length
73
- , arr = new Uint8Array(len)
74
- for (; len--; ) {
75
- arr[len] = s.charCodeAt(len)
76
- }
77
- return arr
78
- },
79
- decode: function(arr) {
80
- var i, out
81
- , map = TextEncoder[this.encoding]
82
- if (map) {
83
- // Single-byte codec
84
- out = []
85
- for (i = arr.length; i--; ) {
86
- out[i] = (
87
- arr[i] > 127 ?
88
- map.charCodeAt(arr[i] - 128) :
89
- arr[i]
90
- )
91
- }
92
- return fromCharCode.apply(null, out)
93
- }
94
- return decodeURIComponent(escape(fromCharCode.apply(null, arr)))
95
- }
96
- }
97
- }(this) /* jshint -W030 */
98
-
package/polyfill/typed.js DELETED
@@ -1,31 +0,0 @@
1
-
2
- /* litejs.com/MIT-LICENSE.txt */
3
-
4
-
5
-
6
- !function(exports, Array) {
7
- var k, t
8
- , typed = [
9
- "Int8Array", "Uint8Array",
10
- "Int16Array", "Uint16Array",
11
- "Int32Array", "Uint32Array",
12
- "Float32Array", "Float64Array"
13
- ]
14
- , i = typed.length
15
- , proto = Array.prototype
16
-
17
- for (; i--; ) {
18
- if ((t = exports[typed[i]])) {
19
- for (k in Array) if (!t[k]) {
20
- t[k] = Array[k]
21
- }
22
- t = t.prototype
23
- for (k in proto) if (!t[k]) {
24
- t[k] = proto[k]
25
- }
26
- } else {
27
- exports[typed[i]] = Array
28
- }
29
- }
30
- }(this, Array) /* jshint -W030 */
31
-
package/stat.js DELETED
@@ -1,205 +0,0 @@
1
- /* litejs.com/MIT-LICENSE.txt */
2
-
3
-
4
-
5
- var versions = [
6
- "ver,width,height,aWidth,aHeight,oWidth,oHeight,iWidth,iHeight,pRatio,oAngle,oType,qy,mode,ie,brave,nStandalone,touchPoints,webdriver,mem,cpus,mStandalone"
7
- ]
8
- , layouts = {
9
- "'f":"dvorak", "b!":"bepo", ay:"azerty", qj:"colemak", qy:"qwerty", qz:"qwertz"
10
- }
11
- function decode(str, ua) {
12
- var arr = str.split(",")
13
- , keys = ("" + versions[arr[0]]).split(",")
14
- , out = {}
15
- , i = keys.length
16
- if (arr.length !== i) return { err: str }
17
- for (; i--; ) {
18
- out[keys[i]] = arr[i] > -1 ? +arr[i] : unescape(arr[i])
19
- }
20
- out.kb = layouts[out.qy]
21
- return out
22
- }
23
-
24
-
25
- !function(window, document, navigator, screen) {
26
- // Server-Timing: cache;desc="Cache Read";dur=23.2,db;dur=53,app;dur=47.2
27
- // Timing-Allow-Origin: *
28
- var qy, baseHref
29
- , empty = []
30
- , orientation = screen.orientation || empty
31
- , performance = window.performance || empty
32
- , timingKeys = "fetch,redirect,domainLookup,connect,request,response".split(",")
33
- , endName = { fetch: "responseEnd", request: "responseStart" }
34
- , statPending = 2
35
-
36
- LiteJS.one("show", statCb)
37
-
38
- try {
39
- navigator.keyboard.getLayoutMap().then(function(k) {
40
- statCb(qy = k.get("KeyQ") + k.get("KeyY"))
41
- })
42
- } catch(e) { statCb() }
43
-
44
- function statCb() {
45
- if (--statPending < 1) {
46
- baseHref = LiteJS.base
47
- var entries = performance.getEntries ? performance.getEntries() : [ performance.timing || empty ]
48
- , stat = {
49
- d: [
50
- 0,
51
- screen.width, screen.height, screen.availWidth, screen.availHeight,
52
- window.outerWidth, window.outerHeight, window.innerWidth, window.innerHeight,
53
- window.devicePixelRatio,
54
- orientation.angle, orientation.type,
55
- qy,
56
- document.documentMode,
57
- !+"\v1",
58
- !!navigator.brave,
59
- navigator.standalone, navigator.maxTouchPoints, navigator.webdriver, navigator.deviceMemory, navigator.hardwareConcurrency
60
- ].map(statVal) + "," + [
61
- "(display-mode:standalone)"
62
- //"(prefers-color-scheme:dark)",
63
- //"(prefers-contrast:more)",
64
- //"(prefers-reduced-motion:reduce),(update:slow)"
65
- ].map(statMedia),
66
- r: [
67
- entries[0].type,
68
- Date.now() - (performance.timeOrigin || xhr._s),
69
- document.referrer,
70
- baseHref
71
- ].concat(entries.flatMap(statResource)),
72
- u: navigator.userAgent
73
- }
74
-
75
- console.log("DEV", stat, decode(stat.d, navigator.userAgent))
76
- }
77
- }
78
- function statMedia(query) {
79
- return statVal(matchMedia(query).matches)
80
- }
81
- function statResource(entry) {
82
- var type = entry.entryType
83
- return !type || type === "navigation" || type === "resource" ? [
84
- (entry.name || "").replace(baseHref, ""),
85
- entry.responseStatus,
86
- entry.encodedBodySize,
87
- entry.transferSize,
88
- entry.decodedBodySize
89
- ].map(statVal) + "," + timingKeys.map(statDiff, entry) : []
90
- }
91
- function statVal(x) {
92
- return x > -9 ? +x : typeof x === "string" ? x.replace(/,|;/g, escape) : "-"
93
- }
94
- function statDiff(name) {
95
- return statVal(this[endName[name] || name + "End"] - this[name + "Start"])
96
- }
97
- }(this, document, navigator, screen) // jshint ignore:line
98
-
99
-
100
-
101
- /* global View
102
-
103
- try {
104
- , canvas = document.createElement("canvas")
105
- var context = canvas.getContext("webgl") || canvas.getContext("experimental-webgl")
106
- , info = context.getExtension("WEBGL_debug_renderer_info")
107
- renderer = context.getParameter(info.UNMASKED_RENDERER_WEBGL)
108
- } catch(e) {}
109
-
110
- View.one("show", function() {
111
- // window.outerWidth - Chrome1, Firefox1, IE9, Opera9, Safari3
112
- var stat = {
113
- start: started,
114
- end: new Date(),
115
- qy: qy,
116
- screen: screen.width + "x" + screen.height,
117
- content: (window.innerWidth || body.offsetWidth) +
118
- "x" + (window.innerHeight || body.offsetHeight),
119
- colors: screen.colorDepth,
120
- timing: (window.performance || {}).timing
121
- }
122
-
123
- console.log("Stat", stat)
124
- })
125
- var events = []
126
- , stat = {}
127
- , keys = {}
128
- , key = 0
129
- , last
130
-
131
- function now() {
132
- return new Date() - started
133
- }
134
- function push(e) {
135
- var x = "" + [e.x>>5, e.y>>5]
136
- if (last === x && e.type === "mousemove") return
137
- if (!stat[e.type]) {
138
- stat[e.type] = 0
139
- }
140
- stat[e.type]++
141
- last = x
142
- // e.ctrlKey
143
- events.push(
144
- now(),
145
- keys[e.type] || (keys[e.type] = ++key),
146
- last,
147
- (
148
- e.type === "click" ? getPath(e) : 0
149
- )
150
- )
151
- }
152
-
153
- setInterval(function() {
154
- if (events.length > 0) {
155
- console.log(stat, JSON.stringify(events).length, ""+events)
156
- events = []
157
- }
158
- }, 2000)
159
-
160
- document.addEventListener("click", push, true)
161
- document.addEventListener("mousemove", push, true)
162
-
163
- function getPath(e) {
164
- for (var i, c, nth, t, path = [], el = e.target; el && el.tagName; el = el.parentNode) {
165
- nth = el.parentNode && el.parentNode.childNodes || ""
166
- if (nth && nth[0] !== el) {
167
- for (i = c = 0; (t = nth[i++]);) if (t.tagName === el.tagName) {
168
- c++
169
- if (t === el) break
170
- }
171
- }
172
- path.unshift(
173
- el.tagName +
174
- (el.id ? "#" + el.id : "") +
175
- (c > 1 ? "(" + c + ")" : "") +
176
- (el.className ? "." + el.className.replace(/\s+/g, ".") : "") +
177
- (path.length === 0 && !el.firstElementChild ? "[" + el.textContent+ "]" : "") +
178
- (el._e && el._e[e.type] && el._e[e.type].length ? "@" + (el._e.click.length/3) : "")
179
- )
180
- }
181
- path = path.join(">")
182
- return keys[path] || (keys[path] = ++key)
183
- }
184
- }(this, document, navigator, screen) // jshint ignore:line
185
- */
186
-
187
- /*
188
- UA
189
-
190
- iPad: Mobile/8F190
191
- iPad 2: Mobile/8F191
192
- iPad 3: Mobile/9B176 (
193
- I can see Mobile/8J2 on iPad2 and Mobile/9A405 on iPad1.
194
- looks like the iPad 2 can have the same Mobile/9B176 code than the New iPad. Maybe it's because of an update of iOS?
195
-
196
- // iPhone X if ((window.screen.height / window.screen.width == 812 / 375) && (window.devicePixelRatio == 3)) { return "iPhone X"; } // iPhone 6+/6s+/7+ and 8+ else if ((window.screen.height / window.screen.width == 736 / 414) && (window.devicePixelRatio == 3)) { return "iPhone 6 Plus, 6s Plus, 7 Plus or 8 Plus"; } // iPhone 6+/6s+/7+ and 8+ in zoom mode else if ((window.screen.height / window.screen.width == 667 / 375) && (window.devicePixelRatio == 3)) { return "iPhone 6 Plus, 6s Plus, 7 Plus or 8 Plus (display zoom)"; } // iPhone 6/6s/7 and 8 else if ((window.screen.height / window.screen.width == 667 / 375) && (window.devicePixelRatio == 2)) { return "iPhone 6, 6s, 7 or 8"; } // iPhone 5/5C/5s/SE or 6/6s/7 and 8 in zoom mode else if ((window.screen.height / window.screen.width == 1.775) && (window.devicePixelRatio == 2)) { return "iPhone 5, 5C, 5S, SE or 6, 6s, 7 and 8 (display zoom)"; } // iPhone 4/4s else if ((window.screen.height / window.screen.width == 1.5) && (window.devicePixelRatio == 2)) { return "iPhone 4 or 4s"; } // iPhone 1/3G/3GS else if ((window.screen.height / window.screen.width == 1.5) && (window.devicePixelRatio == 1)) { return "iPhone 1, 3G or 3GS"; } else { return "Not an iPhone"; }
197
-
198
-
199
- // It seems that those values are set on tab creation and are not adjusted on device rotation.
200
- iPad 2 screen.availWidth = 768 screen.availHeight = 1004
201
- iPad Mini screen.availWidth = 748 screen.availHeight = 1024
202
-
203
- */
204
-
205
-