@litejs/ui 23.4.0 → 24.0.0-rc.1
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/form.css +79 -0
- package/css/form2.css +142 -0
- package/el/Slider.tpl +1 -1
- package/index.js +112 -128
- package/load.js +15 -43
- package/package.json +2 -2
- package/polyfill/index.js +2 -0
- package/require.js +33 -0
package/css/form.css
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
input[disabled],
|
|
3
|
+
input[readonly] {
|
|
4
|
+
color: #666;
|
|
5
|
+
font-style: italic;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
input, select, textarea {
|
|
9
|
+
color: #0F0D1B;
|
|
10
|
+
background: #c4c4c4;
|
|
11
|
+
}
|
|
12
|
+
body .btn:active, .btn:focus,
|
|
13
|
+
input:active, input:focus,
|
|
14
|
+
select:active, select:focus,
|
|
15
|
+
textarea:active, textarea:focus {
|
|
16
|
+
box-shadow:
|
|
17
|
+
0 2px 5px rgba(0, 0, 0, .5) inset,
|
|
18
|
+
0 0 3px 3px #029FE3;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
input.Toggle {
|
|
24
|
+
display: block;
|
|
25
|
+
position: relative;
|
|
26
|
+
-webkit-appearance: none;
|
|
27
|
+
-moz-appearance: none;
|
|
28
|
+
appearance: none;
|
|
29
|
+
width: 36px;
|
|
30
|
+
height: 14px;
|
|
31
|
+
margin: 4px 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
border-radius: 7px;
|
|
34
|
+
}
|
|
35
|
+
input.Toggle:after {
|
|
36
|
+
display: block;
|
|
37
|
+
position: relative;
|
|
38
|
+
content: "";
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
border-radius: 10px;
|
|
42
|
+
left: -3px;
|
|
43
|
+
top: -4px;
|
|
44
|
+
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
45
|
+
}
|
|
46
|
+
input.Toggle:checked:after {
|
|
47
|
+
left: 18px;
|
|
48
|
+
}
|
|
49
|
+
input.Toggle:active:after {
|
|
50
|
+
width: 30px;
|
|
51
|
+
}
|
|
52
|
+
input.Toggle:checked:active:after {
|
|
53
|
+
left: 8px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/* THEME */
|
|
58
|
+
|
|
59
|
+
input.Toggle:after {
|
|
60
|
+
background-color: #666;
|
|
61
|
+
box-shadow:
|
|
62
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
63
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
64
|
+
}
|
|
65
|
+
input.Toggle:focus:after {
|
|
66
|
+
box-shadow:
|
|
67
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
68
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
69
|
+
0 0 0 12px rgb(255, 255, 255, .2);
|
|
70
|
+
}
|
|
71
|
+
input.Toggle:checked:after {
|
|
72
|
+
background-color: #00a651;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
package/css/form2.css
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
:focus {
|
|
4
|
+
outline: 0;
|
|
5
|
+
box-shadow:
|
|
6
|
+
0 0 0 .2rem #fff,
|
|
7
|
+
0 0 0 .35rem #069;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Remove focus for non-keyboard navigation */
|
|
11
|
+
:focus:not(:focus-visible) {
|
|
12
|
+
box-shadow: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
fieldset {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
label {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
line-height: 32px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
input[type=checkbox].Toggle,
|
|
26
|
+
input[type=submit] {
|
|
27
|
+
-webkit-appearance: none;
|
|
28
|
+
-moz-appearance: none;
|
|
29
|
+
appearance: none;
|
|
30
|
+
position: relative;
|
|
31
|
+
text-align: center;
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
select[disabled],
|
|
36
|
+
input[disabled],
|
|
37
|
+
input[readonly] {
|
|
38
|
+
background: red;
|
|
39
|
+
color: #666;
|
|
40
|
+
font-style: italic;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input, select, textarea {
|
|
44
|
+
color: #0F0D1B;
|
|
45
|
+
background: #c4c4c4;
|
|
46
|
+
}
|
|
47
|
+
body .btn:active, .btn:focus,
|
|
48
|
+
input:active, input:focus,
|
|
49
|
+
select:active, select:focus,
|
|
50
|
+
textarea:active, textarea:focus {
|
|
51
|
+
box-shadow:
|
|
52
|
+
0 2px 5px rgba(0, 0, 0, .5) inset,
|
|
53
|
+
0 0 3px 3px #029FE3;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input {
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
margin: 1em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
input.Toggle {
|
|
63
|
+
-webkit-appearance: none;
|
|
64
|
+
-moz-appearance: none;
|
|
65
|
+
appearance: none;
|
|
66
|
+
position: relative;
|
|
67
|
+
padding: 0;
|
|
68
|
+
outline: 0;
|
|
69
|
+
width: 36px;
|
|
70
|
+
height: 14px;
|
|
71
|
+
margin: 4px 0;
|
|
72
|
+
border-radius: 7px;
|
|
73
|
+
}
|
|
74
|
+
input.Toggle:after {
|
|
75
|
+
position: relative;
|
|
76
|
+
width: 20px;
|
|
77
|
+
height: 20px;
|
|
78
|
+
border-radius: 10px;
|
|
79
|
+
}
|
|
80
|
+
input.Toggle:after {
|
|
81
|
+
content: "";
|
|
82
|
+
display: block;
|
|
83
|
+
background-color: #666;
|
|
84
|
+
left: -3px;
|
|
85
|
+
top: -4px;
|
|
86
|
+
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
87
|
+
box-shadow:
|
|
88
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
89
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
90
|
+
}
|
|
91
|
+
input.Toggle:focus:after {
|
|
92
|
+
box-shadow:
|
|
93
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
94
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
95
|
+
0 0 0 12px rgb(255, 255, 255, .2);
|
|
96
|
+
}
|
|
97
|
+
input.Toggle:checked:after {
|
|
98
|
+
background-color: #00a651;
|
|
99
|
+
left: 17px;
|
|
100
|
+
}
|
|
101
|
+
input.Toggle:active:after {
|
|
102
|
+
width: 30px;
|
|
103
|
+
}
|
|
104
|
+
input.Toggle:checked:active:after {
|
|
105
|
+
left: 7px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
.group {
|
|
111
|
+
overflow: auto;
|
|
112
|
+
}
|
|
113
|
+
.group > .btn {
|
|
114
|
+
border-radius: 0;
|
|
115
|
+
float: left;
|
|
116
|
+
}
|
|
117
|
+
.group > .btn:first-child {
|
|
118
|
+
border-top-left-radius: 4px;
|
|
119
|
+
border-bottom-left-radius: 4px;
|
|
120
|
+
}
|
|
121
|
+
.group > .btn:last-child {
|
|
122
|
+
border-top-right-radius: 4px;
|
|
123
|
+
border-bottom-right-radius: 4px;
|
|
124
|
+
}
|
|
125
|
+
/* THEME */
|
|
126
|
+
|
|
127
|
+
input.Toggle:after {
|
|
128
|
+
background-color: #666;
|
|
129
|
+
box-shadow:
|
|
130
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
131
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
132
|
+
}
|
|
133
|
+
input.Toggle:focus:after {
|
|
134
|
+
box-shadow:
|
|
135
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
136
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
137
|
+
0 0 0 12px rgb(0, 0, 0, .2);
|
|
138
|
+
}
|
|
139
|
+
input.Toggle:checked:after {
|
|
140
|
+
background-color: #00a651;
|
|
141
|
+
}
|
|
142
|
+
|
package/el/Slider.tpl
CHANGED
|
@@ -263,6 +263,6 @@
|
|
|
263
263
|
;fixReadonlyCheckbox
|
|
264
264
|
input[type=checkbox].hide
|
|
265
265
|
;readonly: row && !row.write
|
|
266
|
-
;checked: model && !!model.get(row.path)
|
|
266
|
+
;checked: model && (row && row.opts ? row.opts === model.get(row.path) : !!model.get(row.path))
|
|
267
267
|
.Toggle-knob.anim
|
|
268
268
|
|
package/index.js
CHANGED
|
@@ -103,137 +103,18 @@
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
/* global El, xhr */
|
|
106
107
|
!function(window, document, history, location) {
|
|
107
|
-
var
|
|
108
|
+
var histCb, histBase, histRoute, iframe, iframeTick, iframeUrl
|
|
108
109
|
, cleanRe = /^[#\/\!]+|[\s\/]+$/g
|
|
109
110
|
|
|
110
|
-
//
|
|
111
|
+
// JScript engine in IE8 and below does not recognize vertical tabulation character `\v`.
|
|
111
112
|
// http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
|
|
112
|
-
// oldIE = "\v" == "v"
|
|
113
|
-
//
|
|
114
|
-
// The documentMode is an IE only property, supported in IE8+.
|
|
115
113
|
//
|
|
116
|
-
//
|
|
117
|
-
// and win8_appname_long apps, you cannot identify the browser as Internet Explorer
|
|
118
|
-
// by testing for the equivalence of the vertical tab (\v) and the "v".
|
|
119
|
-
// In earlier versions, the expression "\v" === "v" returns true.
|
|
120
|
-
// In Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
|
|
121
|
-
// and win8_appname_long apps, the expression returns false.
|
|
114
|
+
// The documentMode is an IE only property, supported in IE8 and up.
|
|
122
115
|
, ie67 = !+"\v1" && (document.documentMode | 0) < 8 // jshint ignore:line
|
|
123
116
|
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
/*** PUSH ***/
|
|
127
|
-
base ? location.pathname.slice(base.length) :
|
|
128
|
-
/**/
|
|
129
|
-
// bug in Firefox where location.hash is decoded
|
|
130
|
-
// bug in Safari where location.pathname is decoded
|
|
131
|
-
|
|
132
|
-
// var hash = location.href.split('#')[1] || '';
|
|
133
|
-
// https://bugs.webkit.org/show_bug.cgi?id=30225
|
|
134
|
-
// https://github.com/documentcloud/backbone/pull/967
|
|
135
|
-
(_loc || location).href.split("#")[1] || ""
|
|
136
|
-
).replace(cleanRe, "")
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function setUrl(url, replace) {
|
|
140
|
-
/*** PUSH ***/
|
|
141
|
-
if (base) {
|
|
142
|
-
history[replace ? "replaceState" : "pushState"](null, null, base + url)
|
|
143
|
-
} else {
|
|
144
|
-
/**/
|
|
145
|
-
location[replace ? "replace" : "assign"]("#" + url)
|
|
146
|
-
// Opening and closing the iframe tricks IE7 and earlier
|
|
147
|
-
// to push a history entry on hash-tag change.
|
|
148
|
-
if (iframe && getUrl() !== getUrl(iframe.location) ) {
|
|
149
|
-
iframe.location[replace ? "replace" : iframe.document.open().close(), "assign"]("#" + url)
|
|
150
|
-
}
|
|
151
|
-
/*** PUSH ***/
|
|
152
|
-
}
|
|
153
|
-
/**/
|
|
154
|
-
return checkUrl()
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function checkUrl() {
|
|
158
|
-
if (lastRoute != (lastRoute = getUrl())) {
|
|
159
|
-
if (cb) cb(lastRoute)
|
|
160
|
-
return true
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
history.getUrl = getUrl
|
|
165
|
-
history.setUrl = setUrl
|
|
166
|
-
|
|
167
|
-
history.start = function(_cb) {
|
|
168
|
-
cb = _cb
|
|
169
|
-
/*** PUSH ***/
|
|
170
|
-
// Chrome5, Firefox4, IE10, Safari5, Opera11.50
|
|
171
|
-
var url
|
|
172
|
-
, _base = document.documentElement.getElementsByTagName("base")[0]
|
|
173
|
-
if (_base) _base = _base.href.replace(/.*:\/\/[^/]*|[^\/]*$/g, "")
|
|
174
|
-
if (_base && !history.pushState) {
|
|
175
|
-
url = location.pathname.slice(_base.length)
|
|
176
|
-
if (url) {
|
|
177
|
-
location.replace(_base + "#" + url)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (_base && history.pushState) {
|
|
181
|
-
base = _base
|
|
182
|
-
|
|
183
|
-
url = location.href.split("#")[1]
|
|
184
|
-
if (url && !getUrl()) {
|
|
185
|
-
setUrl(url, 1)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Chrome and Safari emit a popstate event on page load, Firefox doesn't.
|
|
189
|
-
// Firing popstate after onload is as designed.
|
|
190
|
-
//
|
|
191
|
-
// See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
|
|
192
|
-
// https://code.google.com/p/chromium/issues/detail?id=63040
|
|
193
|
-
// and the change to the HTML5 spec that was made:
|
|
194
|
-
// http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
|
|
195
|
-
window.onpopstate = checkUrl
|
|
196
|
-
} else
|
|
197
|
-
/**/
|
|
198
|
-
if ("onhashchange" in window && !ie67) {
|
|
199
|
-
// There are onhashchange in IE7 but its not get emitted
|
|
200
|
-
//
|
|
201
|
-
// Basic support:
|
|
202
|
-
// Chrome 5.0, Firefox 3.6, IE 8, Opera 10.6, Safari 5.0
|
|
203
|
-
window.onhashchange = checkUrl
|
|
204
|
-
} else {
|
|
205
|
-
if (ie67 && !iframe) {
|
|
206
|
-
// IE<9 encounters the Mixed Content warning when the URI javascript: is used.
|
|
207
|
-
// IE5/6 additionally encounters the Mixed Content warning when the URI about:blank is used.
|
|
208
|
-
// src="//:"
|
|
209
|
-
iframe = document.body.appendChild(document.createElement("<iframe tabindex=-1 style=display:none>")).contentWindow
|
|
210
|
-
}
|
|
211
|
-
clearInterval(tick)
|
|
212
|
-
tick = setInterval(function(){
|
|
213
|
-
var cur = getUrl()
|
|
214
|
-
if (iframe && last === cur) cur = getUrl(iframe.location)
|
|
215
|
-
if (last !== cur) {
|
|
216
|
-
last = cur
|
|
217
|
-
if (iframe) setUrl(cur)
|
|
218
|
-
else checkUrl()
|
|
219
|
-
}
|
|
220
|
-
}, 60)
|
|
221
|
-
}
|
|
222
|
-
checkUrl()
|
|
223
|
-
}
|
|
224
|
-
}(this, document, history, location) // jshint ignore:line
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
/* litejs.com/MIT-LICENSE.txt */
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/* global El, xhr */
|
|
235
|
-
!function(exports) {
|
|
236
|
-
var fn, lastView, lastStr, lastUrl, syncResume
|
|
117
|
+
, fn, lastView, lastStr, lastUrl, syncResume
|
|
237
118
|
, body = document.body
|
|
238
119
|
, isArray = Array.isArray
|
|
239
120
|
, capture = 1
|
|
@@ -246,13 +127,13 @@
|
|
|
246
127
|
, escapeRe = /[.*+?^=!:${}()|\[\]\/\\]/g
|
|
247
128
|
, parseRe = /\{([\w%.]+?)\}|.[^{\\]*?/g
|
|
248
129
|
, defaults = {
|
|
249
|
-
base: "
|
|
130
|
+
base: "",
|
|
250
131
|
home: "home",
|
|
251
132
|
root: body
|
|
252
133
|
}
|
|
253
134
|
|
|
254
|
-
|
|
255
|
-
|
|
135
|
+
window.View = View
|
|
136
|
+
window.LiteJS = LiteJS
|
|
256
137
|
|
|
257
138
|
|
|
258
139
|
function LiteJS(opts) {
|
|
@@ -491,7 +372,110 @@
|
|
|
491
372
|
)
|
|
492
373
|
}
|
|
493
374
|
|
|
494
|
-
|
|
375
|
+
function getUrl(_loc) {
|
|
376
|
+
return (
|
|
377
|
+
/*** pushState ***/
|
|
378
|
+
histBase ? location.pathname.slice(histBase.length) :
|
|
379
|
+
/**/
|
|
380
|
+
// bug in Firefox where location.hash is decoded
|
|
381
|
+
// bug in Safari where location.pathname is decoded
|
|
382
|
+
|
|
383
|
+
// var hash = location.href.split('#')[1] || '';
|
|
384
|
+
// https://bugs.webkit.org/show_bug.cgi?id=30225
|
|
385
|
+
// https://github.com/documentcloud/backbone/pull/967
|
|
386
|
+
(_loc || location).href.split("#")[1] || ""
|
|
387
|
+
).replace(cleanRe, "")
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function setUrl(url, replace) {
|
|
391
|
+
/*** pushState ***/
|
|
392
|
+
if (histBase) {
|
|
393
|
+
history[replace ? "replaceState" : "pushState"](null, null, histBase + url)
|
|
394
|
+
} else {
|
|
395
|
+
/**/
|
|
396
|
+
location[replace ? "replace" : "assign"]("#" + url)
|
|
397
|
+
// Opening and closing the iframe tricks IE7 and earlier
|
|
398
|
+
// to push a history entry on hash-tag change.
|
|
399
|
+
if (iframe && getUrl() !== getUrl(iframe.location) ) {
|
|
400
|
+
iframe.location[replace ? "replace" : iframe.document.open().close(), "assign"]("#" + url)
|
|
401
|
+
}
|
|
402
|
+
/*** pushState ***/
|
|
403
|
+
}
|
|
404
|
+
/**/
|
|
405
|
+
return checkUrl()
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function checkUrl() {
|
|
409
|
+
if (histRoute != (histRoute = getUrl())) {
|
|
410
|
+
if (histCb) histCb(histRoute)
|
|
411
|
+
return true
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
history.getUrl = getUrl
|
|
416
|
+
history.setUrl = setUrl
|
|
417
|
+
|
|
418
|
+
LiteJS.start = function(cb) {
|
|
419
|
+
histCb = cb
|
|
420
|
+
/*** pushState ***/
|
|
421
|
+
// Chrome5, Firefox4, IE10, Safari5, Opera11.50
|
|
422
|
+
var url
|
|
423
|
+
, _base = document.documentElement.getElementsByTagName("base")[0]
|
|
424
|
+
if (_base) _base = _base.href.replace(/.*:\/\/[^/]*|[^\/]*$/g, "")
|
|
425
|
+
if (_base && !history.pushState) {
|
|
426
|
+
url = location.pathname.slice(_base.length)
|
|
427
|
+
if (url) {
|
|
428
|
+
location.replace(_base + "#" + url)
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (_base && history.pushState) {
|
|
432
|
+
histBase = _base
|
|
433
|
+
|
|
434
|
+
url = location.href.split("#")[1]
|
|
435
|
+
if (url && !getUrl()) {
|
|
436
|
+
setUrl(url, 1)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Chrome and Safari emit a popstate event on page load, Firefox doesn't.
|
|
440
|
+
// Firing popstate after onload is as designed.
|
|
441
|
+
//
|
|
442
|
+
// See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
|
|
443
|
+
// https://code.google.com/p/chromium/issues/detail?id=63040
|
|
444
|
+
// and the change to the HTML5 spec that was made:
|
|
445
|
+
// http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
|
|
446
|
+
window.onpopstate = checkUrl
|
|
447
|
+
} else
|
|
448
|
+
/**/
|
|
449
|
+
if ("onhashchange" in window && !ie67) {
|
|
450
|
+
// There are onhashchange in IE7 but its not get emitted
|
|
451
|
+
//
|
|
452
|
+
// Basic support:
|
|
453
|
+
// Chrome 5.0, Firefox 3.6, IE 8, Opera 10.6, Safari 5.0
|
|
454
|
+
window.onhashchange = checkUrl
|
|
455
|
+
} else {
|
|
456
|
+
if (ie67 && !iframe) {
|
|
457
|
+
// IE<9 encounters the Mixed Content warning when the URI javascript: is used.
|
|
458
|
+
// IE5/6 additionally encounters the Mixed Content warning when the URI about:blank is used.
|
|
459
|
+
// src="//:"
|
|
460
|
+
iframe = document.body.appendChild(document.createElement("<iframe tabindex=-1 style=display:none>")).contentWindow
|
|
461
|
+
}
|
|
462
|
+
clearInterval(iframeTick)
|
|
463
|
+
iframeTick = setInterval(function(){
|
|
464
|
+
var cur = getUrl()
|
|
465
|
+
if (iframe && iframeUrl === cur) cur = getUrl(iframe.location)
|
|
466
|
+
if (iframeUrl !== cur) {
|
|
467
|
+
iframeUrl = cur
|
|
468
|
+
if (iframe) setUrl(cur)
|
|
469
|
+
else checkUrl()
|
|
470
|
+
}
|
|
471
|
+
}, 60)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
xhr.load(View.$$("script[type='litejs/view']", body).map(function(el) {
|
|
475
|
+
return el.src
|
|
476
|
+
}), checkUrl)
|
|
477
|
+
}
|
|
478
|
+
}(this, document, history, location) // jshint ignore:line
|
|
495
479
|
|
|
496
480
|
|
|
497
481
|
|
package/load.js
CHANGED
|
@@ -30,12 +30,13 @@
|
|
|
30
30
|
|
|
31
31
|
!function(window, Function) {
|
|
32
32
|
xhr._s = new Date()
|
|
33
|
-
var loaded = {}
|
|
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 loaded = xhr._l = {}
|
|
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,6 +45,7 @@
|
|
|
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) ||
|
|
48
50
|
Function("a", "var d=document,b=d.body,s=d.createElement('script');s.text=a;b.removeChild(b.insertBefore(s,b.firstChild))")
|
|
49
51
|
/*/
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
/**/
|
|
52
54
|
|
|
53
55
|
/*** reuse ***/
|
|
56
|
+
// XHR memory leak mitigation
|
|
54
57
|
, xhrs = []
|
|
55
58
|
/**/
|
|
56
59
|
|
|
@@ -66,7 +69,7 @@
|
|
|
66
69
|
, col || (window.event || unsentErrors).errorCharacter || "?"
|
|
67
70
|
, message
|
|
68
71
|
].join(":")
|
|
69
|
-
) &&
|
|
72
|
+
) && 2 > unsentErrors.push(
|
|
70
73
|
[ +new Date()
|
|
71
74
|
, lastError
|
|
72
75
|
, error && (error.stack || error.stacktrace) || "-"
|
|
@@ -132,7 +135,7 @@
|
|
|
132
135
|
//xhr.ontimeout = timeoutRaised
|
|
133
136
|
|
|
134
137
|
if (next !== true) xhr.onreadystatechange = function() {
|
|
135
|
-
if (xhr.readyState
|
|
138
|
+
if (xhr.readyState > 3) {
|
|
136
139
|
// From the XMLHttpRequest spec:
|
|
137
140
|
//
|
|
138
141
|
// > For 304 Not Modified responses
|
|
@@ -183,37 +186,6 @@
|
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
|
|
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
189
|
/*** load ***/
|
|
218
190
|
xhr.load = load
|
|
219
191
|
function load(files, next) {
|
|
@@ -224,10 +196,10 @@
|
|
|
224
196
|
, len = files && files.length
|
|
225
197
|
, res = []
|
|
226
198
|
|
|
227
|
-
for (; i < len; i++) if ((file = files[i]) &&
|
|
199
|
+
for (; i < len; i++) if ((file = files[i]) && typeof loaded[file] != "object") {
|
|
228
200
|
if (loaded[file]) {
|
|
229
201
|
// Same file requested again
|
|
230
|
-
;(loaded[file].x || (loaded[file].x = [])).push(
|
|
202
|
+
;(loaded[file].x || (loaded[file].x = [])).push(exec, res, i)
|
|
231
203
|
} else {
|
|
232
204
|
// FireFox 3 throws on `xhr.send()` without arguments
|
|
233
205
|
xhr("GET", file, loaded[file] = cb, i).send(null)
|
|
@@ -239,14 +211,14 @@
|
|
|
239
211
|
pos = 0
|
|
240
212
|
|
|
241
213
|
function cb(err, str, file, i) {
|
|
242
|
-
loaded[file] =
|
|
243
|
-
res[i] = err ? (onerror(err, file), "") :
|
|
214
|
+
loaded[file] = { h: this.getAllResponseHeaders(), b: str }
|
|
215
|
+
res[i] = err ? (onerror(err, file), "") : loaded[file]
|
|
244
216
|
exec()
|
|
245
217
|
}
|
|
246
218
|
function exec() {
|
|
247
219
|
if (res[pos]) {
|
|
248
220
|
try {
|
|
249
|
-
;(xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos])
|
|
221
|
+
;(xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos].b)
|
|
250
222
|
} catch(e) {
|
|
251
223
|
onerror(e, files[pos])
|
|
252
224
|
}
|
|
@@ -260,8 +232,8 @@
|
|
|
260
232
|
/**/
|
|
261
233
|
else {
|
|
262
234
|
if (next) next()
|
|
263
|
-
if ((
|
|
264
|
-
for (i = 0;
|
|
235
|
+
if ((next = cb.x)) {
|
|
236
|
+
for (i = 0; next[i]; ) next[i++](next[i++][next[i++]] = "")
|
|
265
237
|
}
|
|
266
238
|
}
|
|
267
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litejs/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-rc.1",
|
|
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.4.
|
|
28
|
+
"@litejs/cli": "23.4.3",
|
|
29
29
|
"jshint": "2.13.6"
|
|
30
30
|
},
|
|
31
31
|
"litejs": {
|
package/polyfill/index.js
CHANGED
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
|
+
|