@litejs/ui 22.8.0 → 23.3.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/binding/_default.js +17 -17
- package/binding/list.js +1 -0
- package/binding/persist.js +2 -1
- package/binding/sticky.js +1 -0
- package/binding/topfloat.js +2 -1
- package/css/accessible.css +25 -0
- package/css/grid.css +0 -1
- package/css/prefers.css +19 -0
- package/css/print.css +33 -0
- package/css/striped.css +10 -0
- package/el/Segment7.tpl.js +1 -0
- package/el/Slider.tpl +2 -2
- package/el/confirm.tpl.js +1 -0
- package/el/form1.tpl.js +1 -0
- package/el/material.tpl +0 -2
- package/framekiller.js +1 -0
- package/index.js +143 -649
- package/load.js +8 -14
- package/package.json +15 -13
- package/pointer.js +2 -1
- package/polyfill/base64.js +5 -4
- package/polyfill/index.js +42 -21
- package/polyfill/promise.js +5 -5
- package/polyfill/string.js +1 -1
- package/polyfill/typed.js +2 -2
- package/svg.js +2 -2
- package/hello.js +0 -136
- package/json-schema-to-form.js +0 -312
- package/polyfill/nexttick.js +0 -28
- package/schema-apply.js +0 -110
- package/worker-push.js +0 -29
- package/xhr-getschema.js +0 -92
package/index.js
CHANGED
|
@@ -1,569 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* @version 22.8.0
|
|
3
|
-
* @author Lauri Rooden <lauri@rooden.ee>
|
|
4
|
-
* @license MIT License
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
!function(Date, proto) {
|
|
10
|
-
var Date$prototype = Date[proto]
|
|
11
|
-
, String$prototype = String[proto]
|
|
12
|
-
, Number$prototype = Number[proto]
|
|
13
|
-
, maskRe = /(\[)((?:\\?.)*?)\]|([YMD])\3\3\3?|([YMDHhmsWSZ])(\4?)|[uUASwoQ]|(["\\\n\r\u2028\u2029])/g
|
|
14
|
-
, dateRe = /(\d+)[-.\/](\d+)[-.\/](\d+)/
|
|
15
|
-
, timeRe = /(\d+):(\d+)(?::(\d+))?(\.\d+)?(?:\s*(?:(a)|(p))\.?m\.?)?(\s*(?:Z|GMT|UTC)?(?:([-+]\d\d):?(\d\d)?)?)?/i
|
|
16
|
-
, fns = Object.create(null)
|
|
17
|
-
, aliases = {
|
|
18
|
-
sec: "s",
|
|
19
|
-
second: "s",
|
|
20
|
-
seconds: "s",
|
|
21
|
-
min: "m",
|
|
22
|
-
minute: "m",
|
|
23
|
-
minutes: "m",
|
|
24
|
-
hr: "h",
|
|
25
|
-
hour: "h",
|
|
26
|
-
hours: "h",
|
|
27
|
-
day: "D",
|
|
28
|
-
days: "D",
|
|
29
|
-
week: "W",
|
|
30
|
-
weeks: "W",
|
|
31
|
-
month: "M",
|
|
32
|
-
months: "M",
|
|
33
|
-
year: "Y",
|
|
34
|
-
years: "Y"
|
|
35
|
-
}
|
|
36
|
-
, units = {
|
|
37
|
-
S: 1,
|
|
38
|
-
s: 1000,
|
|
39
|
-
m: 60000,
|
|
40
|
-
h: 3600000,
|
|
41
|
-
D: 86400000,
|
|
42
|
-
W: 604800000
|
|
43
|
-
}
|
|
44
|
-
, tmp1 = new Date()
|
|
45
|
-
, tmp2 = new Date()
|
|
46
|
-
, sinceFrom = new Date()
|
|
47
|
-
, map = Date.fnMap = {
|
|
48
|
-
w: "Day()||7",
|
|
49
|
-
Y: "FullYear()%100",
|
|
50
|
-
M: "Month()+1",
|
|
51
|
-
D: "Date()",
|
|
52
|
-
h: "Hours()",
|
|
53
|
-
H: "Hours()%12||12",
|
|
54
|
-
m: "Minutes()",
|
|
55
|
-
s: "Seconds()",
|
|
56
|
-
S: "Milliseconds()"
|
|
57
|
-
}
|
|
58
|
-
, locales = Date.locales = {
|
|
59
|
-
en: {
|
|
60
|
-
am: "AM",
|
|
61
|
-
pm: "PM",
|
|
62
|
-
names: "JanFebMarAprMayJunJulAugSepOctNovDecJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecemberSunMonTueWedThuFriSatSundayMondayTuesdayWednesdayThursdayFridaySaturday".match(/.[a-z]+/g),
|
|
63
|
-
masks: {
|
|
64
|
-
LT: "hh:mm",
|
|
65
|
-
LTS: "hh:mm:ss",
|
|
66
|
-
L: "DD/MM/YYYY",
|
|
67
|
-
LL: "D MMMM YYYY",
|
|
68
|
-
LLL: "D MMMM YYYY hh:mm",
|
|
69
|
-
LLLL: "DDDD, D MMMM YYYY hh:mm"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
, masks = Date.masks = {
|
|
74
|
-
"iso": "UTC:YYYY-MM-DD[T]hh:mm:ss[Z]"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Date.makeStr = makeStr
|
|
79
|
-
function makeStr(mask, utc) {
|
|
80
|
-
var get = "d.get" + (utc ? "UTC" : "")
|
|
81
|
-
, setA = "a.setTime(+d+((4-(" + get + map.w + "))*864e5))"
|
|
82
|
-
return (utc ? mask.slice(4) : mask).replace(maskRe, function(match, quote, text, MD, single, pad, esc) {
|
|
83
|
-
var str = (
|
|
84
|
-
esc ? escape(esc).replace(/%u/g, "\\u").replace(/%/g, "\\x") :
|
|
85
|
-
quote ? text :
|
|
86
|
-
MD == "Y" ? get + "FullYear()" :
|
|
87
|
-
MD ? "l.names[" + get + (MD == "M" ? "Month" : "Day" ) + "()+" + (match == "DDD" ? 24 : MD == "D" ? 31 : match == "MMM" ? 0 : 12) + "]" :
|
|
88
|
-
match == "u" ? "(d/1000)>>>0" :
|
|
89
|
-
match == "U" ? "+d" :
|
|
90
|
-
match == "Q" ? "((" + get + "Month()/3)|0)+1" :
|
|
91
|
-
match == "A" ? "l[" + get + map.h + ">11?'pm':'am']" :
|
|
92
|
-
match == "o" ? setA + ",a" + get.slice(1) + "FullYear()" :
|
|
93
|
-
single == "Z" ? "(t=o)?(t<0?((t=-t),'-'):'+')+(t<600?'0':'')+(0|(t/60))" + (pad ? "" : "+':'") + "+((t%=60)>9?t:'0'+t):'Z'" :
|
|
94
|
-
single == "W" ? "Math.ceil(((" + setA + "-a.s" + get.slice(3) + "Month(0,1))/864e5+1)/7)" :
|
|
95
|
-
get + map[single || match]
|
|
96
|
-
)
|
|
97
|
-
return quote || esc ? str : '"+(' + (
|
|
98
|
-
match == "SS" ? "(t=" + str + ")>9?t>99?t:'0'+t:'00'+t" :
|
|
99
|
-
pad && single != "Z" ? "(t=" + str + ")>9?t:'0'+t" :
|
|
100
|
-
str
|
|
101
|
-
) + ')+"'
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
Date$prototype.date = function(_mask, _zone) {
|
|
106
|
-
var offset, undef
|
|
107
|
-
, date = this
|
|
108
|
-
, locale = locales[date._locale || Date._locale || "en"] || locales.en
|
|
109
|
-
, mask = locale.masks && locale.masks[_mask] || masks[_mask] || _mask || masks.iso
|
|
110
|
-
, zone = _zone != undef ? _zone : date._tz != undef ? date._tz : Date._tz != undef ? Date._tz : undef
|
|
111
|
-
, utc = mask.slice(0, 4) == "UTC:"
|
|
112
|
-
if (zone != undef && !utc) {
|
|
113
|
-
offset = 60 * zone
|
|
114
|
-
tmp1.setTime(+date + offset * 6e4)
|
|
115
|
-
utc = mask = "UTC:" + mask
|
|
116
|
-
} else {
|
|
117
|
-
offset = utc ? 0 : -date.getTimezoneOffset()
|
|
118
|
-
tmp1.setTime(+date)
|
|
119
|
-
}
|
|
120
|
-
return isNaN(+date) ? "" + date : (
|
|
121
|
-
fns[mask] || (fns[mask] = Function("d,a,o,l", 'var t;return "' + makeStr(mask, utc) + '"')))(
|
|
122
|
-
tmp1,
|
|
123
|
-
tmp2,
|
|
124
|
-
offset,
|
|
125
|
-
locale
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
addFn("add", function(amount, _unit, mask) {
|
|
130
|
-
var date = this
|
|
131
|
-
, unit = aliases[_unit] || _unit
|
|
132
|
-
if (unit == "M" || unit == "Y" && (amount *= 12)) {
|
|
133
|
-
unit = date.getUTCDate()
|
|
134
|
-
date.setUTCMonth(date.getUTCMonth() + amount)
|
|
135
|
-
if (unit > (unit = date.getUTCDate())) {
|
|
136
|
-
date.add(-unit, "D")
|
|
137
|
-
}
|
|
138
|
-
} else if (amount) {
|
|
139
|
-
date.setTime(date.getTime() + (amount * (units[unit] || 1)))
|
|
140
|
-
}
|
|
141
|
-
return mask ? date.date(mask) : date
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
addFn("startOf", function(_unit, mask) {
|
|
145
|
-
var ms
|
|
146
|
-
, date = this
|
|
147
|
-
, unit = aliases[_unit] || _unit
|
|
148
|
-
, zone = date._tz != ms ? date._tz : Date._tz != ms ? Date._tz : ms
|
|
149
|
-
if (unit == "Y") {
|
|
150
|
-
if (zone === 0) date.setUTCMonth(0, 1)
|
|
151
|
-
else date.setMonth(0, 1)
|
|
152
|
-
unit = "D"
|
|
153
|
-
} else if (unit == "M") {
|
|
154
|
-
if (zone === 0) date.setUTCDate(1)
|
|
155
|
-
else date.setDate(1)
|
|
156
|
-
unit = "D"
|
|
157
|
-
} else if (unit == "W") {
|
|
158
|
-
ms = date.getDay()
|
|
159
|
-
if (ms != 1) date.setHours(-24 * (ms ? ms - 1 : 6))
|
|
160
|
-
unit = "D"
|
|
161
|
-
}
|
|
162
|
-
zone = zone < 36 ? 3600000 * zone : -date.getTimezoneOffset() * 60000
|
|
163
|
-
ms = date.getTime() + zone
|
|
164
|
-
date.setTime(
|
|
165
|
-
ms -
|
|
166
|
-
(ms % (units[unit] || 1)) -
|
|
167
|
-
zone
|
|
168
|
-
)
|
|
169
|
-
return mask ? date.date(mask) : date
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
addFn("endOf", function(unit, mask) {
|
|
173
|
-
return this.add(1, unit).startOf(unit).add(-1, "S", mask)
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
addFn("since", function(from, _unit) {
|
|
177
|
-
var diff
|
|
178
|
-
, date = this
|
|
179
|
-
, unit = aliases[_unit] || _unit
|
|
180
|
-
if (typeof from == "string") {
|
|
181
|
-
from = aliases[from] ? (sinceFrom.setTime(+date), sinceFrom.tz(date._tz).startOf(from)) : from.date()
|
|
182
|
-
}
|
|
183
|
-
if (units[unit]) {
|
|
184
|
-
diff = (date - from) / units[unit]
|
|
185
|
-
} else {
|
|
186
|
-
diff = date.since("month", "S") - from.since("month", "S")
|
|
187
|
-
if (diff) {
|
|
188
|
-
tmp1.setTime(+date)
|
|
189
|
-
diff /= units.D * tmp1.endOf("M").getUTCDate()
|
|
190
|
-
}
|
|
191
|
-
diff += 12 * (date.getUTCFullYear() - from.getUTCFullYear()) + date.getUTCMonth() - from.getUTCMonth()
|
|
192
|
-
if (unit == "Y") {
|
|
193
|
-
diff /= 12
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return diff
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
//*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
/*
|
|
204
|
-
* // In Chrome Date.parse("01.02.2001") is Jan
|
|
205
|
-
* num = +date || Date.parse(date) || ""+date;
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
String$prototype.date = function(mask, zoneOut, zoneIn) {
|
|
209
|
-
var undef, date, match, year, month
|
|
210
|
-
, str = this
|
|
211
|
-
if (isNaN(+str)) {
|
|
212
|
-
if (match = str.match(dateRe)) {
|
|
213
|
-
// Big endian date, starting with the year, eg. 2011-01-31
|
|
214
|
-
// Middle endian date, starting with the month, eg. 01/31/2011
|
|
215
|
-
// Little endian date, starting with the day, eg. 31.01.2011
|
|
216
|
-
year = match[1] > 99 ? 1 : 3
|
|
217
|
-
month = Date.middleEndian ? 4 - year : 2
|
|
218
|
-
date = new Date(match[year], match[month] - 1, match[6 - month - year])
|
|
219
|
-
} else {
|
|
220
|
-
date = new Date()
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Time
|
|
224
|
-
match = str.match(timeRe) || [0, 0, 0]
|
|
225
|
-
date.setHours(
|
|
226
|
-
match[6] && match[1] < 12 ? +match[1] + 12 :
|
|
227
|
-
match[5] && match[1] == 12 ? 0 : match[1],
|
|
228
|
-
match[2], match[3]|0, (1000 * match[4])|0
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
// Timezone
|
|
232
|
-
if (match[7]) {
|
|
233
|
-
zoneIn = (match[8]|0) + ((match[9]|0)/(match[8]<0?-60:60))
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (zoneIn != undef) {
|
|
237
|
-
date.tz(zoneIn)
|
|
238
|
-
date.setTime(date - (60 * zoneIn + date.getTimezoneOffset()) * 60000)
|
|
239
|
-
}
|
|
240
|
-
return mask ? date.date(mask, zoneOut) : date
|
|
241
|
-
}
|
|
242
|
-
return (+str).date(mask, zoneOut, zoneIn)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
Number$prototype.date = function(mask, zoneOut, zoneIn) {
|
|
246
|
-
var date
|
|
247
|
-
, num = this
|
|
248
|
-
if (num < 4294967296) num *= 1000
|
|
249
|
-
date = new Date(
|
|
250
|
-
zoneIn != date ?
|
|
251
|
-
tmp1.setTime(num) - (60 * zoneIn + tmp1.getTimezoneOffset()) * 60000 :
|
|
252
|
-
num
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
return mask ? date.date(mask, zoneOut) : date
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function addFn(method, fn) {
|
|
259
|
-
Date$prototype[method] = fn
|
|
260
|
-
String$prototype[method] = Number$prototype[method] = function(a, b, c) {
|
|
261
|
-
return this.date()[method](a, b, c)
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function makeSetter(method) {
|
|
266
|
-
Date[method] = Date$prototype[method] = function(value, mask) {
|
|
267
|
-
var date = this
|
|
268
|
-
date["_" + method] = value
|
|
269
|
-
return mask ? date.date(mask) : date
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
makeSetter("tz")
|
|
274
|
-
makeSetter("locale")
|
|
275
|
-
}(Date, "prototype")
|
|
276
|
-
!function(F, undef) {
|
|
277
|
-
// Time to live - Run *onTimeout* if Function not called on time
|
|
278
|
-
F.ttl = function(ms, onTimeout, scope) {
|
|
279
|
-
var fn = this
|
|
280
|
-
, tick = setTimeout(function() {
|
|
281
|
-
ms = 0
|
|
282
|
-
if (onTimeout) onTimeout.call(scope)
|
|
283
|
-
}, ms)
|
|
1
|
+
/*! litejs.com/MIT-LICENSE.txt */
|
|
284
2
|
|
|
285
|
-
return function() {
|
|
286
|
-
clearTimeout(tick)
|
|
287
|
-
if (ms) fn.apply(scope === undef ? this : scope, arguments)
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Run Function one time after last call
|
|
292
|
-
F.once = function(ms, scope) {
|
|
293
|
-
var tick, args
|
|
294
|
-
, fn = this
|
|
295
|
-
return function() {
|
|
296
|
-
if (scope === undef) scope = this
|
|
297
|
-
clearTimeout(tick)
|
|
298
|
-
args = arguments
|
|
299
|
-
tick = setTimeout(function() {
|
|
300
|
-
fn.apply(scope, args)
|
|
301
|
-
}, ms)
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Maximum call rate for Function
|
|
306
|
-
// leading edge, trailing edge
|
|
307
|
-
F.rate = function(ms, last_call, scope) {
|
|
308
|
-
var tick, args
|
|
309
|
-
, fn = this
|
|
310
|
-
, next = 0
|
|
311
|
-
if (last_call && typeof last_call !== "function") last_call = fn
|
|
312
|
-
return function() {
|
|
313
|
-
if (scope === undef) scope = this
|
|
314
|
-
var now = Date.now()
|
|
315
|
-
clearTimeout(tick)
|
|
316
|
-
if (now >= next) {
|
|
317
|
-
next = now + ms
|
|
318
|
-
fn.apply(scope, arguments)
|
|
319
|
-
} else if (last_call) {
|
|
320
|
-
args = arguments
|
|
321
|
-
tick = setTimeout(function() {
|
|
322
|
-
last_call.apply(scope, args)
|
|
323
|
-
}, next - now)
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}(Function.prototype)
|
|
328
|
-
!function(exports, Object) {
|
|
329
|
-
var undef
|
|
330
|
-
, P = "prototype"
|
|
331
|
-
, A = Array[P]
|
|
332
|
-
, F = Function[P]
|
|
333
|
-
, S = String[P]
|
|
334
|
-
, N = Number[P]
|
|
335
|
-
, slice = F.call.bind(A.slice)
|
|
336
|
-
, fns = {}
|
|
337
|
-
, hasOwn = fns.hasOwnProperty
|
|
338
|
-
, fnRe = /('|")(?:\\?.)*?\1|\/(?:\\?.)+?\/[gim]*|\b(?:false|in|new|null|this|true|typeof|void|function|var|if|else|return)\b|\.\w+|\w+:/g
|
|
339
|
-
, formatRe = /{(?!\\)((?:("|')(?:\\?.)*?\2|\\}|[^}])*)}/g
|
|
340
|
-
, numbersRe = /-?\d+\.?\d*/g
|
|
341
|
-
, wordRe = /\b[a-z_$][\w$]*/ig
|
|
342
|
-
, unescapeRe = /{\\/g
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
exports.Fn = Fn
|
|
346
|
-
Fn.hold = hold
|
|
347
|
-
Fn.wait = wait
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
// Non-standard
|
|
351
|
-
Object.each = function(obj, fn, scope, key) {
|
|
352
|
-
if (obj) for (key in obj) {
|
|
353
|
-
hasOwn.call(obj, key) && fn.call(scope, obj[key], key, obj)
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Non-standard
|
|
358
|
-
// IE<9 bug: [1,2].splice(0).join("") == "" but should be "12"
|
|
359
|
-
A.remove = arrayRemove
|
|
360
|
-
function arrayRemove() {
|
|
361
|
-
var arr = this
|
|
362
|
-
, len = arr.length
|
|
363
|
-
, o = slice(arguments)
|
|
364
|
-
, lastId = -1
|
|
365
|
-
|
|
366
|
-
for (; len--; ) if (~o.indexOf(arr[len])) {
|
|
367
|
-
arr.splice(lastId = len, 1)
|
|
368
|
-
}
|
|
369
|
-
return lastId
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
A.each = A.forEach
|
|
373
|
-
// uniq
|
|
374
|
-
// first item preserved
|
|
375
|
-
A.uniq = function() {
|
|
376
|
-
for (var a = this, i = a.length; i--; ) {
|
|
377
|
-
if (a.indexOf(a[i]) !== i) a.splice(i, 1)
|
|
378
|
-
}
|
|
379
|
-
return a
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
A.pushUniq = function(item) {
|
|
383
|
-
return this.indexOf(item) < 0 && this.push(item)
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// THANKS: Oliver Steele - Functional Javascript [http://www.osteele.com/sources/javascript/functional/]
|
|
387
|
-
function Fn(expr /*, scope, mask1, ..maskN */) {
|
|
388
|
-
var args = []
|
|
389
|
-
, arr = expr.match(/[^"']+?->|[\s\S]+$/g)
|
|
390
|
-
, scope = slice(arguments, 1)
|
|
391
|
-
, key = scope.length + ":" + expr
|
|
392
|
-
, fn = fns[key]
|
|
393
|
-
|
|
394
|
-
if (!fn) {
|
|
395
|
-
fn = expr.replace(fnRe, "").match(wordRe) || []
|
|
396
|
-
for (; arr.length > 1; ) {
|
|
397
|
-
expr = arr.pop()
|
|
398
|
-
args = arr.pop().match(/\w+/g) || []
|
|
399
|
-
arrayRemove.apply(fn, args)
|
|
400
|
-
if (arr.length) {
|
|
401
|
-
arr.push("function(" + args + "){return(" + expr + ")}" + (scope[0] ? ".bind(this)" : ""))
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
expr = "return(" + expr + ")"
|
|
405
|
-
|
|
406
|
-
if (scope[0]) {
|
|
407
|
-
arr = Object.keys(scope).map(Fn("a->'__'+a"))
|
|
408
|
-
arr[0] = "this"
|
|
409
|
-
expr = (
|
|
410
|
-
fn[0] ?
|
|
411
|
-
"var " + fn.uniq().join("='',") + "='';" :
|
|
412
|
-
""
|
|
413
|
-
) + "with(" + arr.join(")with(") + "){" + expr + "}"
|
|
414
|
-
args = arr.slice(1).concat(args)
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
fn = fns[key] = Function(args, expr)
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return scope.length ? fn.bind.apply(fn, scope) : fn
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
S.format = function() {
|
|
424
|
-
var args = A.slice.call(arguments)
|
|
425
|
-
args.unshift(0)
|
|
426
|
-
return this.replace(formatRe, function(_, arg) {
|
|
427
|
-
args[0] = arg.replace(/\\}/g, "}")
|
|
428
|
-
return Fn.apply(null, args)()
|
|
429
|
-
}).replace(unescapeRe, "{")
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
N.format = function(data) {
|
|
433
|
-
return "" + this
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
S.safe = function() {
|
|
437
|
-
return this
|
|
438
|
-
.replace(/&/g, "&")
|
|
439
|
-
.replace(/</g, "<")
|
|
440
|
-
.replace(/>/g, ">")
|
|
441
|
-
.replace(/\"/g, """)
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
S.capitalize = function() {
|
|
445
|
-
return this.charAt(0).toUpperCase() + this.slice(1)
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
S.lower = S.toLowerCase
|
|
449
|
-
S.upper = S.toUpperCase
|
|
450
|
-
|
|
451
|
-
N.step = function(a, add) {
|
|
452
|
-
var x = ("" + a).split(".")
|
|
453
|
-
, steps = this / a
|
|
454
|
-
, n = ~~(steps + ((steps < 0 ? -1 : 1) * (add == undef ? .5 : add === 1 && steps == (steps|0) ? 0 : +add))) * a
|
|
455
|
-
return "" + (1 in x ? n.toFixed(x[1].length) : n)
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
S.step = function(a, add) {
|
|
459
|
-
return this.replace(numbersRe, function(num) {
|
|
460
|
-
return (+num).step(a, add)
|
|
461
|
-
})
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
N.scale = words([1000, 1000, 1000], ["","k","M","G"], {"default": "{n}{u}"})
|
|
465
|
-
|
|
466
|
-
S.scale = function() {
|
|
467
|
-
return this.replace(numbersRe, function(num) {
|
|
468
|
-
return (+num).scale()
|
|
469
|
-
})
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
S.pick = N.pick = function() {
|
|
473
|
-
var val = this + "="
|
|
474
|
-
for (var s, a = arguments, i = 0, len = a.length; i < len;) {
|
|
475
|
-
s = a[i++]
|
|
476
|
-
if (s.indexOf(val) == 0) {
|
|
477
|
-
s = s.slice(val.length)
|
|
478
|
-
i = len
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return s.replace("#", this)
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
S.plural = N.plural = function() {
|
|
485
|
-
// Plural-Forms: nplurals=2; plural=n != 1;
|
|
486
|
-
// http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#Plural-forms
|
|
487
|
-
return arguments[ +Fn("n->" + (String.plural || "n!=1"))( parseFloat(this) ) ].replace("#", this)
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
A.pluck = function(name) {
|
|
491
|
-
for (var arr = this, i = arr.length, out = []; i--; ) {
|
|
492
|
-
out[i] = arr[i][name]
|
|
493
|
-
}
|
|
494
|
-
return out
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
function words(steps, units, strings, overflow) {
|
|
498
|
-
return function(input) {
|
|
499
|
-
var n = +(arguments.length ? input : this)
|
|
500
|
-
, i = 0
|
|
501
|
-
, s = strings || {"default": "{n} {u}{s}"}
|
|
502
|
-
|
|
503
|
-
for (; n>=steps[i]; ) {
|
|
504
|
-
n /= steps[i++]
|
|
505
|
-
}
|
|
506
|
-
if (i == steps.length && overflow) {
|
|
507
|
-
return overflow(this)
|
|
508
|
-
}
|
|
509
|
-
i = units[i]
|
|
510
|
-
return (s[n < 2 ? i : i + "s"] || s["default"]).format({n: n, u: i, s: n < 2 ? "" : "s"})
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
Fn.words = words
|
|
514
|
-
|
|
515
|
-
function wait(fn) {
|
|
516
|
-
var pending = 1
|
|
517
|
-
function resume() {
|
|
518
|
-
if (!--pending && fn) fn.call(this)
|
|
519
|
-
}
|
|
520
|
-
resume.wait = function() {
|
|
521
|
-
pending++
|
|
522
|
-
return resume
|
|
523
|
-
}
|
|
524
|
-
return resume
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function hold(ignore) {
|
|
528
|
-
var k
|
|
529
|
-
, obj = this
|
|
530
|
-
, hooks = []
|
|
531
|
-
, hooked = []
|
|
532
|
-
, _resume = wait(resume)
|
|
533
|
-
ignore = ignore || obj.syncMethods || []
|
|
534
|
-
|
|
535
|
-
for (k in obj) if (typeof obj[k] == "function" && ignore.indexOf(k) < 0) !function(k) {
|
|
536
|
-
hooked.push(k, hasOwn.call(obj, k) && obj[k])
|
|
537
|
-
obj[k] = function() {
|
|
538
|
-
if (hooks === null) obj[k].apply(this, arguments)
|
|
539
|
-
else hooks.push(k, arguments)
|
|
540
|
-
return obj
|
|
541
|
-
}
|
|
542
|
-
}(k)
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* `wait` is already in hooked array,
|
|
546
|
-
* so override hooked method
|
|
547
|
-
* that will be cleared on resume.
|
|
548
|
-
*/
|
|
549
|
-
obj.wait = _resume.wait
|
|
550
|
-
|
|
551
|
-
return _resume
|
|
552
|
-
|
|
553
|
-
function resume() {
|
|
554
|
-
for (var v, scope = obj, i = hooked.length; i--; i--) {
|
|
555
|
-
if (hooked[i]) obj[hooked[i-1]] = hooked[i]
|
|
556
|
-
else delete obj[hooked[i-1]]
|
|
557
|
-
}
|
|
558
|
-
// i == -1 from previous loop
|
|
559
|
-
for (; v = hooks[++i]; ) {
|
|
560
|
-
scope = scope[v].apply(scope, hooks[++i]) || scope
|
|
561
|
-
}
|
|
562
|
-
hooks = hooked = null
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
}(this, Object)
|
|
567
3
|
!function(exports) {
|
|
568
4
|
var empty = []
|
|
569
5
|
, Event = exports.Event || exports
|
|
@@ -631,7 +67,7 @@
|
|
|
631
67
|
, arr = _e ? (_e[type] || empty).concat(_e["*"] || empty) : empty
|
|
632
68
|
if ((_e = arr.length)) {
|
|
633
69
|
for (i = _e - 1, args = arr.slice.call(arguments, 1); i > 1; i -= 3) {
|
|
634
|
-
arr[i]
|
|
70
|
+
if (arr[i]) arr[i].apply(arr[i - 2] || emitter, args)
|
|
635
71
|
}
|
|
636
72
|
}
|
|
637
73
|
return _e / 3
|
|
@@ -660,6 +96,10 @@
|
|
|
660
96
|
|
|
661
97
|
// `this` refers to the `window` in browser and to the `exports` in Node.js.
|
|
662
98
|
}(this) // jshint ignore:line
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/*! litejs.com/MIT-LICENSE.txt */
|
|
102
|
+
|
|
663
103
|
/* litejs.com/MIT-LICENSE.txt */
|
|
664
104
|
|
|
665
105
|
|
|
@@ -680,7 +120,7 @@
|
|
|
680
120
|
// In earlier versions, the expression "\v" === "v" returns true.
|
|
681
121
|
// In Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
|
|
682
122
|
// and win8_appname_long apps, the expression returns false.
|
|
683
|
-
,
|
|
123
|
+
, ie67 = !+"\v1" && (document.documentMode | 0) < 8 // jshint ignore:line
|
|
684
124
|
|
|
685
125
|
function getUrl(_loc) {
|
|
686
126
|
return (
|
|
@@ -756,18 +196,18 @@
|
|
|
756
196
|
window.onpopstate = checkUrl
|
|
757
197
|
} else
|
|
758
198
|
/**/
|
|
759
|
-
if ("onhashchange" in window && !
|
|
199
|
+
if ("onhashchange" in window && !ie67) {
|
|
760
200
|
// There are onhashchange in IE7 but its not get emitted
|
|
761
201
|
//
|
|
762
202
|
// Basic support:
|
|
763
203
|
// Chrome 5.0, Firefox 3.6, IE 8, Opera 10.6, Safari 5.0
|
|
764
204
|
window.onhashchange = checkUrl
|
|
765
205
|
} else {
|
|
766
|
-
if (
|
|
206
|
+
if (ie67 && !iframe) {
|
|
767
207
|
// IE<9 encounters the Mixed Content warning when the URI javascript: is used.
|
|
768
208
|
// IE5/6 additionally encounters the Mixed Content warning when the URI about:blank is used.
|
|
769
209
|
// src="//:"
|
|
770
|
-
iframe = document.body.appendChild(document.createElement(
|
|
210
|
+
iframe = document.body.appendChild(document.createElement("<iframe tabindex=-1 style=display:none>")).contentWindow
|
|
771
211
|
}
|
|
772
212
|
clearInterval(tick)
|
|
773
213
|
tick = setInterval(function(){
|
|
@@ -775,17 +215,25 @@
|
|
|
775
215
|
if (iframe && last === cur) cur = getUrl(iframe.location)
|
|
776
216
|
if (last !== cur) {
|
|
777
217
|
last = cur
|
|
778
|
-
iframe
|
|
218
|
+
if (iframe) setUrl(cur)
|
|
219
|
+
else checkUrl()
|
|
779
220
|
}
|
|
780
221
|
}, 60)
|
|
781
222
|
}
|
|
782
223
|
checkUrl()
|
|
783
224
|
}
|
|
784
|
-
}(this, document, history, location)
|
|
225
|
+
}(this, document, history, location) // jshint ignore:line
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
/*! litejs.com/MIT-LICENSE.txt */
|
|
231
|
+
|
|
785
232
|
/* litejs.com/MIT-LICENSE.txt */
|
|
786
233
|
|
|
787
234
|
|
|
788
235
|
|
|
236
|
+
/* global El, xhr */
|
|
789
237
|
!function(exports) {
|
|
790
238
|
var fn, lastView, lastStr, lastUrl, syncResume
|
|
791
239
|
, isArray = Array.isArray
|
|
@@ -856,8 +304,8 @@
|
|
|
856
304
|
View.prototype = {
|
|
857
305
|
show: function(_params) {
|
|
858
306
|
var parent
|
|
859
|
-
, params = lastParams = _params || {}
|
|
860
|
-
, view = lastView = this
|
|
307
|
+
, params = lastParams = _params || {} // jshint ignore:line
|
|
308
|
+
, view = lastView = this // jshint ignore:line
|
|
861
309
|
, tmp = params._v || view
|
|
862
310
|
, close = view.isOpen && view
|
|
863
311
|
|
|
@@ -868,7 +316,7 @@
|
|
|
868
316
|
emit(syncResume = params._v = tmp, "ping", params, View)
|
|
869
317
|
syncResume = null
|
|
870
318
|
if (lastParams !== params) return
|
|
871
|
-
if (parent = tmp.parent) {
|
|
319
|
+
if ((parent = tmp.parent)) {
|
|
872
320
|
if (parent.child && parent.child !== tmp) {
|
|
873
321
|
close = parent.child
|
|
874
322
|
}
|
|
@@ -896,7 +344,7 @@
|
|
|
896
344
|
if (view !== close) emit(view, "change", close)
|
|
897
345
|
|
|
898
346
|
for (tmp in params) if (tmp.charAt(0) !== "_") {
|
|
899
|
-
if (syncResume = hasOwn.call(paramCb, tmp) && paramCb[tmp] || paramCb["*"]) {
|
|
347
|
+
if ((syncResume = hasOwn.call(paramCb, tmp)) && paramCb[tmp] || paramCb["*"]) {
|
|
900
348
|
syncResume.call(view, params[tmp], tmp, params)
|
|
901
349
|
syncResume = null
|
|
902
350
|
}
|
|
@@ -938,10 +386,10 @@
|
|
|
938
386
|
if (view.kb) El.addKb(view.kb)
|
|
939
387
|
close = null
|
|
940
388
|
}
|
|
941
|
-
if (params._d = params._v = view.child) {
|
|
389
|
+
if ((params._d = params._v = view.child)) {
|
|
942
390
|
bubbleDown(params, close)
|
|
943
391
|
}
|
|
944
|
-
if (lastView === view) {
|
|
392
|
+
if ((lastView === view)) {
|
|
945
393
|
emit(view, "show", params)
|
|
946
394
|
blur()
|
|
947
395
|
}
|
|
@@ -995,20 +443,21 @@
|
|
|
995
443
|
}
|
|
996
444
|
}
|
|
997
445
|
|
|
998
|
-
View.param = function(name, cb
|
|
446
|
+
View.param = function(name, cb) {
|
|
999
447
|
;(isArray(name) ? name : name.split(/\s+/)).forEach(function(n) {
|
|
1000
448
|
paramCb[n] = cb
|
|
1001
449
|
})
|
|
1002
450
|
}
|
|
1003
451
|
|
|
1004
452
|
View.def = function(str) {
|
|
1005
|
-
for (var match, re = /(\S+) (\S+)/g; match = re.exec(str);) {
|
|
1006
|
-
match[1].split(",").map(
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
453
|
+
for (var match, re = /(\S+) (\S+)/g; (match = re.exec(str)); ) {
|
|
454
|
+
match[1].split(",").map(def)
|
|
455
|
+
}
|
|
456
|
+
function def(view) {
|
|
457
|
+
view = View(expand(view, lastStr))
|
|
458
|
+
view.file = (view.file ? view.file + "," : "") +
|
|
459
|
+
match[2].split(",").map(function(file) {
|
|
460
|
+
return views[file] ? views[file].file : expand(file, lastStr)
|
|
1012
461
|
})
|
|
1013
462
|
}
|
|
1014
463
|
}
|
|
@@ -1036,10 +485,15 @@
|
|
|
1036
485
|
)
|
|
1037
486
|
}
|
|
1038
487
|
|
|
1039
|
-
}(this)
|
|
488
|
+
}(this) // jshint ignore:line
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
/*! litejs.com/MIT-LICENSE.txt */
|
|
492
|
+
|
|
1040
493
|
/* litejs.com/MIT-LICENSE.txt */
|
|
1041
494
|
|
|
1042
495
|
|
|
496
|
+
/* global View, xhr */
|
|
1043
497
|
!function(window, document, Object, Event, P) {
|
|
1044
498
|
var UNDEF, styleNode
|
|
1045
499
|
, BIND_ATTR = "data-bind"
|
|
@@ -1052,9 +506,9 @@
|
|
|
1052
506
|
, body = document.body
|
|
1053
507
|
, root = document.documentElement
|
|
1054
508
|
, txtAttr = El.T = "textContent" in body ? "textContent" : "innerText"
|
|
1055
|
-
, templateRe = /([ \t]*)(%?)((?:("|')(
|
|
1056
|
-
, renderRe = /[;\s]*(\w+)(?:(::?| )((?:(["'\/])(
|
|
1057
|
-
, selectorRe = /([.#:[])([-\w]+)(?:\((
|
|
509
|
+
, templateRe = /([ \t]*)(%?)((?:("|')(?:\\\4|.)*?\4|[-\w:.#[\]]=?)*)[ \t]*([>^;@|\\\/]|!?=|)(([\])}]?).*?([[({]?))(?=\x1f|\n|$)+/g
|
|
510
|
+
, renderRe = /[;\s]*(\w+)(?:(::?| )((?:(["'\/])(?:\\\3|.)*?\3|[^;])*))?/g
|
|
511
|
+
, selectorRe = /([.#:[])([-\w]+)(?:\(((?:[^()]|\([^)]+\))+?)\)|([~^$*|]?)=(("|')(?:\\.|[^\\])*?\6|[-\w]+))?]?/g
|
|
1058
512
|
, splitRe = /[,\s]+/
|
|
1059
513
|
, camelRe = /\-([a-z])/g
|
|
1060
514
|
, bindings = El.bindings = {
|
|
@@ -1114,7 +568,7 @@
|
|
|
1114
568
|
/*** ie8 ***/
|
|
1115
569
|
|
|
1116
570
|
// JScript engine in IE<9 does not recognize vertical tabulation character
|
|
1117
|
-
, ie678 = !+"\v1"
|
|
571
|
+
, ie678 = !+"\v1" // jshint ignore:line
|
|
1118
572
|
, ie67 = ie678 && (document.documentMode | 0) < 8
|
|
1119
573
|
|
|
1120
574
|
El.matches = function(el, sel) {
|
|
@@ -1139,14 +593,10 @@
|
|
|
1139
593
|
* <input id="12" class="nice class" type="checkbox" checked="checked" disabled="disabled" data-lang="en">
|
|
1140
594
|
*/
|
|
1141
595
|
|
|
1142
|
-
function isObject(obj) {
|
|
1143
|
-
return obj && obj.constructor === Object
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
596
|
window.El = El
|
|
1147
597
|
|
|
1148
598
|
function El(name) {
|
|
1149
|
-
if (
|
|
599
|
+
if (!isString(name)) {
|
|
1150
600
|
return new ElWrap(name)
|
|
1151
601
|
}
|
|
1152
602
|
var el, pres
|
|
@@ -1244,7 +694,7 @@
|
|
|
1244
694
|
/*** ie8 ***/
|
|
1245
695
|
// istanbul ignore next: IE fix
|
|
1246
696
|
if (ie67 && (key === "id" || key === "name" || key === "checked")) {
|
|
1247
|
-
el.mergeAttributes(document.createElement(
|
|
697
|
+
el.mergeAttributes(document.createElement("<INPUT " + key + "='" + val + "'>"), false)
|
|
1248
698
|
} else
|
|
1249
699
|
/**/
|
|
1250
700
|
if (key === "class") {
|
|
@@ -1267,8 +717,6 @@
|
|
|
1267
717
|
, checkbox = type === "checkbox" || type === "radio"
|
|
1268
718
|
|
|
1269
719
|
if (el.tagName === "FORM") {
|
|
1270
|
-
opts = {}
|
|
1271
|
-
|
|
1272
720
|
// Disabled controls do not receive focus,
|
|
1273
721
|
// are skipped in tabbing navigation, cannot be successfully posted.
|
|
1274
722
|
//
|
|
@@ -1277,15 +725,11 @@
|
|
|
1277
725
|
//
|
|
1278
726
|
// Read-only checkboxes can be changed by the user
|
|
1279
727
|
|
|
1280
|
-
for (; input = el.elements[i++]; ) if (!input.disabled && (key = input.name || input.id)) {
|
|
728
|
+
for (opts = {}; (input = el.elements[i++]); ) if (!input.disabled && (key = input.name || input.id)) {
|
|
1281
729
|
value = valFn(input)
|
|
1282
730
|
if (value !== UNDEF) {
|
|
1283
731
|
step = opts
|
|
1284
|
-
key.replace(/\[(.*?)\]/g,
|
|
1285
|
-
if (step == opts) key = key.slice(0, offset)
|
|
1286
|
-
step = step[key] || (step[key] = step[key] === null || _key && +_key != _key ? {} : [])
|
|
1287
|
-
key = _key
|
|
1288
|
-
})
|
|
732
|
+
key.replace(/\[(.*?)\]/g, replacer)
|
|
1289
733
|
step[key || step.length] = value
|
|
1290
734
|
}
|
|
1291
735
|
}
|
|
@@ -1296,20 +740,22 @@
|
|
|
1296
740
|
if (arguments.length > 1) {
|
|
1297
741
|
if (opts) {
|
|
1298
742
|
value = (isArray(val) ? val : [ val ]).map(String)
|
|
1299
|
-
for (; input = opts[i++]; ) {
|
|
743
|
+
for (; (input = opts[i++]); ) {
|
|
1300
744
|
input.selected = value.indexOf(input.value) > -1
|
|
1301
745
|
}
|
|
1302
746
|
} else if (el.val) {
|
|
1303
747
|
el.val(val)
|
|
748
|
+
} else if (checkbox) {
|
|
749
|
+
el.checked = !!val
|
|
1304
750
|
} else {
|
|
1305
|
-
|
|
751
|
+
el.value = val
|
|
1306
752
|
}
|
|
1307
753
|
return
|
|
1308
754
|
}
|
|
1309
755
|
|
|
1310
756
|
if (opts) {
|
|
1311
757
|
if (type === "select-multiple") {
|
|
1312
|
-
for (val = []; input = opts[i++]; ) {
|
|
758
|
+
for (val = []; (input = opts[i++]); ) {
|
|
1313
759
|
if (input.selected && !input.disabled) {
|
|
1314
760
|
val.push(input.valObject || input.value)
|
|
1315
761
|
}
|
|
@@ -1324,17 +770,22 @@
|
|
|
1324
770
|
return checkbox && !el.checked ?
|
|
1325
771
|
(type === "radio" ? UNDEF : null) :
|
|
1326
772
|
el.valObject !== UNDEF ? el.valObject : el.value
|
|
773
|
+
|
|
774
|
+
function replacer(_, _key, offset) {
|
|
775
|
+
if (step == opts) key = key.slice(0, offset)
|
|
776
|
+
step = step[key] || (step[key] = step[key] === null || _key && +_key != _key ? {} : [])
|
|
777
|
+
key = _key
|
|
778
|
+
}
|
|
1327
779
|
}
|
|
1328
780
|
|
|
1329
781
|
function append(el, child, before) {
|
|
1330
782
|
if (!el.nodeType) {
|
|
1331
783
|
return el.append ? el.append(child, before) : el
|
|
1332
784
|
}
|
|
1333
|
-
var fragment
|
|
785
|
+
var fragment, tmp
|
|
1334
786
|
, i = 0
|
|
1335
|
-
, tmp = typeof child
|
|
1336
787
|
if (child) {
|
|
1337
|
-
if (
|
|
788
|
+
if (isString(child) || isNumber(child)) child = document.createTextNode(child)
|
|
1338
789
|
else if ( !("nodeType" in child) && "length" in child ) {
|
|
1339
790
|
// document.createDocumentFragment is unsupported in IE5.5
|
|
1340
791
|
// fragment = "createDocumentFragment" in document ? document.createDocumentFragment() : El("div")
|
|
@@ -1347,7 +798,7 @@
|
|
|
1347
798
|
|
|
1348
799
|
if (child.nodeType) {
|
|
1349
800
|
tmp = el.insertBefore ? el : el[el.length - 1]
|
|
1350
|
-
if (i = getAttr(tmp, "data-child")) {
|
|
801
|
+
if ((i = getAttr(tmp, "data-child"))) {
|
|
1351
802
|
before = findCom(tmp, i) || tmp
|
|
1352
803
|
tmp = before.parentNode
|
|
1353
804
|
// TODO:2016-07-05:lauri:handle numeric befores
|
|
@@ -1359,7 +810,7 @@
|
|
|
1359
810
|
/**/
|
|
1360
811
|
tmp.insertBefore(child,
|
|
1361
812
|
(before === true ? tmp.firstChild :
|
|
1362
|
-
|
|
813
|
+
isNumber(before) ? tmp.childNodes[
|
|
1363
814
|
before < 0 ? tmp.childNodes.length - before - 2 : before
|
|
1364
815
|
] : before) || null
|
|
1365
816
|
)
|
|
@@ -1387,6 +838,7 @@
|
|
|
1387
838
|
})
|
|
1388
839
|
return
|
|
1389
840
|
}
|
|
841
|
+
var i
|
|
1390
842
|
if (isObject(name)) {
|
|
1391
843
|
for (i in name) {
|
|
1392
844
|
if (hasOwn.call(name, i)) f(el, i, name[i], val)
|
|
@@ -1394,8 +846,8 @@
|
|
|
1394
846
|
return
|
|
1395
847
|
}
|
|
1396
848
|
var names = isArray(name) ? name : name.split(splitRe)
|
|
1397
|
-
, i = 0
|
|
1398
849
|
, len = names.length
|
|
850
|
+
i = 0
|
|
1399
851
|
|
|
1400
852
|
if (arguments.length < 3) {
|
|
1401
853
|
if (getter) return getter(el, name)
|
|
@@ -1424,7 +876,7 @@
|
|
|
1424
876
|
function hasClass(el, name) {
|
|
1425
877
|
var current = el.className || ""
|
|
1426
878
|
|
|
1427
|
-
if (
|
|
879
|
+
if (!isString(current)) {
|
|
1428
880
|
current = el.getAttribute("class") || ""
|
|
1429
881
|
}
|
|
1430
882
|
|
|
@@ -1433,7 +885,7 @@
|
|
|
1433
885
|
|
|
1434
886
|
function cls(el, name, set) {
|
|
1435
887
|
var current = el.className || ""
|
|
1436
|
-
, useAttr =
|
|
888
|
+
, useAttr = !isString(current)
|
|
1437
889
|
|
|
1438
890
|
if (useAttr) {
|
|
1439
891
|
current = el.getAttribute("class") || ""
|
|
@@ -1465,7 +917,7 @@
|
|
|
1465
917
|
, prefix = window[addEv] ? "" : (addEv = "attachEvent", remEv = "detachEvent", "on")
|
|
1466
918
|
, fixEv = Event.fixEv || (Event.fixEv = {})
|
|
1467
919
|
, fixFn = Event.fixFn || (Event.fixFn = {})
|
|
1468
|
-
, emitter = new Event.Emitter
|
|
920
|
+
, emitter = new Event.Emitter()
|
|
1469
921
|
|
|
1470
922
|
if (iOS) {
|
|
1471
923
|
// iOS doesn't support beforeunload, use pagehide instead
|
|
@@ -1512,14 +964,14 @@
|
|
|
1512
964
|
|
|
1513
965
|
function bindingOn(el, events, selector, data, handler, delay) {
|
|
1514
966
|
var argi = arguments.length
|
|
1515
|
-
if (argi == 3 || argi == 4 &&
|
|
967
|
+
if (argi == 3 || argi == 4 && isNumber(data)) {
|
|
1516
968
|
delay = data
|
|
1517
969
|
handler = selector
|
|
1518
970
|
selector = data = null
|
|
1519
|
-
} else if (argi == 4 || argi == 5 &&
|
|
971
|
+
} else if (argi == 4 || argi == 5 && isNumber(handler)) {
|
|
1520
972
|
delay = handler
|
|
1521
973
|
handler = data
|
|
1522
|
-
if (
|
|
974
|
+
if (isString(selector)) {
|
|
1523
975
|
data = null
|
|
1524
976
|
} else {
|
|
1525
977
|
data = selector
|
|
@@ -1531,7 +983,7 @@
|
|
|
1531
983
|
return
|
|
1532
984
|
}
|
|
1533
985
|
var fn = (
|
|
1534
|
-
|
|
986
|
+
isString(handler) ? function(e) {
|
|
1535
987
|
var target = selector ? El.closest(e.target, selector) : el
|
|
1536
988
|
if (target) View.emit.apply(View, [handler, e, target].concat(data))
|
|
1537
989
|
} :
|
|
@@ -1562,12 +1014,12 @@
|
|
|
1562
1014
|
return el
|
|
1563
1015
|
}
|
|
1564
1016
|
|
|
1565
|
-
El.emit = function(el
|
|
1017
|
+
El.emit = function(el) {
|
|
1566
1018
|
emitter.emit.apply(el, slice.call(arguments, 1))
|
|
1567
1019
|
}
|
|
1568
1020
|
|
|
1569
1021
|
function empty(el) {
|
|
1570
|
-
for (var node; node = el.firstChild; kill(node));
|
|
1022
|
+
for (var node; (node = el.firstChild); kill(node));
|
|
1571
1023
|
return el
|
|
1572
1024
|
}
|
|
1573
1025
|
|
|
@@ -1610,7 +1062,7 @@
|
|
|
1610
1062
|
}
|
|
1611
1063
|
|
|
1612
1064
|
function closestScope(node) {
|
|
1613
|
-
for (; node = node.parentNode; ) {
|
|
1065
|
+
for (; (node = node.parentNode); ) {
|
|
1614
1066
|
if (node._scope) return elScope[node._scope]
|
|
1615
1067
|
}
|
|
1616
1068
|
}
|
|
@@ -1622,33 +1074,33 @@
|
|
|
1622
1074
|
, i = 0
|
|
1623
1075
|
|
|
1624
1076
|
if (node.nodeType != 1) {
|
|
1625
|
-
node.render
|
|
1077
|
+
if (node.render) node.render(scope)
|
|
1626
1078
|
return
|
|
1627
1079
|
}
|
|
1628
1080
|
|
|
1629
|
-
if (bind = getAttr(node, BIND_ATTR)) {
|
|
1081
|
+
if ((bind = getAttr(node, BIND_ATTR))) {
|
|
1630
1082
|
scope._m = bindMatch
|
|
1631
1083
|
scope._t = bind
|
|
1632
1084
|
// i18n(bind, lang).format(scope)
|
|
1633
1085
|
// document.documentElement.lang
|
|
1634
1086
|
// document.getElementsByTagName('html')[0].getAttribute('lang')
|
|
1635
1087
|
|
|
1636
|
-
fn = "data
|
|
1088
|
+
fn = "data&&(" + bind.replace(renderRe, function(match, name, op, args) {
|
|
1637
1089
|
scope._m[i] = match
|
|
1638
1090
|
match = bindings[name]
|
|
1639
1091
|
return (
|
|
1640
1092
|
(op === "::" || match && hasOwn.call(match, "once")) ?
|
|
1641
|
-
"s(
|
|
1093
|
+
"s(n,B,data._t=data._t.replace(data._m[" + (i++)+ "],''))||" :
|
|
1642
1094
|
""
|
|
1643
1095
|
) + (
|
|
1644
1096
|
match ?
|
|
1645
|
-
"b['" + name + "'].call(data,
|
|
1646
|
-
"s(
|
|
1097
|
+
"b['" + name + "'].call(data,n" + (match.raw ? ",'" + args + "'" : args ? "," + args : "") :
|
|
1098
|
+
"s(n,'" + name + "'," + args
|
|
1647
1099
|
) + ")||"
|
|
1648
1100
|
}) + "r)"
|
|
1649
1101
|
|
|
1650
1102
|
try {
|
|
1651
|
-
if (
|
|
1103
|
+
if (Function("n,data,b,s,B,r", "with(data||{})return " + fn).call(node, node, scope, bindings, setAttr, BIND_ATTR)) {
|
|
1652
1104
|
return
|
|
1653
1105
|
}
|
|
1654
1106
|
} catch (e) {
|
|
@@ -1677,7 +1129,9 @@
|
|
|
1677
1129
|
El.kill = kill
|
|
1678
1130
|
El.render = render
|
|
1679
1131
|
|
|
1680
|
-
for (var key in El)
|
|
1132
|
+
for (var key in El) wrap(key)
|
|
1133
|
+
|
|
1134
|
+
function wrap(key) {
|
|
1681
1135
|
wrapProto[key] = function wrap() {
|
|
1682
1136
|
var i = 0
|
|
1683
1137
|
, self = this
|
|
@@ -1690,7 +1144,7 @@
|
|
|
1690
1144
|
}
|
|
1691
1145
|
return self
|
|
1692
1146
|
}
|
|
1693
|
-
}
|
|
1147
|
+
}
|
|
1694
1148
|
|
|
1695
1149
|
wrapProto.append = function(el) {
|
|
1696
1150
|
var elWrap = this
|
|
@@ -1724,6 +1178,7 @@
|
|
|
1724
1178
|
|
|
1725
1179
|
for (q = indent.length; q <= stack[0]; ) {
|
|
1726
1180
|
if (parent.plugin) {
|
|
1181
|
+
if (parent.plugin.content && !parent.plugin.el.childNodes[0]) break
|
|
1727
1182
|
parent.plugin.done()
|
|
1728
1183
|
}
|
|
1729
1184
|
parent = parentStack.pop()
|
|
@@ -1758,8 +1213,8 @@
|
|
|
1758
1213
|
text = text.replace(/(\w+):?/, "on:'$1',")
|
|
1759
1214
|
} else if (op != ";" && op != "^") {
|
|
1760
1215
|
text = (parent.tagName === "INPUT" ? "val" : "txt") + (
|
|
1761
|
-
op === "=" ? ":" + text.replace(
|
|
1762
|
-
":_('" + text.replace(
|
|
1216
|
+
op === "=" ? ":" + text.replace(/\\|'/g, "\\$&") :
|
|
1217
|
+
":_('" + text.replace(/\\|'/g, "\\$&") + "',data)"
|
|
1763
1218
|
)
|
|
1764
1219
|
}
|
|
1765
1220
|
appendBind(parent, text, ";", op)
|
|
@@ -1821,7 +1276,7 @@
|
|
|
1821
1276
|
t.a = attr1
|
|
1822
1277
|
}
|
|
1823
1278
|
|
|
1824
|
-
js[P].done =
|
|
1279
|
+
js[P].done = Function("Function(this.txt)()")
|
|
1825
1280
|
|
|
1826
1281
|
El.plugins = {
|
|
1827
1282
|
binding: extend(js, {
|
|
@@ -1839,10 +1294,10 @@
|
|
|
1839
1294
|
}
|
|
1840
1295
|
}),
|
|
1841
1296
|
css: extend(js, {
|
|
1842
|
-
done:
|
|
1297
|
+
done: Function("xhr.css(this.txt)")
|
|
1843
1298
|
}),
|
|
1844
1299
|
def: extend(js, {
|
|
1845
|
-
done:
|
|
1300
|
+
done: Function("View.def(this.params||this.txt)")
|
|
1846
1301
|
}),
|
|
1847
1302
|
each: extend(js, {
|
|
1848
1303
|
done: function() {
|
|
@@ -1854,7 +1309,9 @@
|
|
|
1854
1309
|
})
|
|
1855
1310
|
}
|
|
1856
1311
|
}),
|
|
1857
|
-
el: plugin,
|
|
1312
|
+
el: extend(plugin, {
|
|
1313
|
+
content: 1,
|
|
1314
|
+
}),
|
|
1858
1315
|
js: js,
|
|
1859
1316
|
map: extend(js, {
|
|
1860
1317
|
done: function() {
|
|
@@ -1867,8 +1324,8 @@
|
|
|
1867
1324
|
)
|
|
1868
1325
|
}
|
|
1869
1326
|
}),
|
|
1870
|
-
|
|
1871
|
-
|
|
1327
|
+
view: extend(plugin, {
|
|
1328
|
+
content: 1,
|
|
1872
1329
|
done: function() {
|
|
1873
1330
|
var fn
|
|
1874
1331
|
, t = this
|
|
@@ -1883,7 +1340,7 @@
|
|
|
1883
1340
|
"=" + args
|
|
1884
1341
|
) + "),"
|
|
1885
1342
|
}) + "1"
|
|
1886
|
-
|
|
1343
|
+
Function(fn).call(view)
|
|
1887
1344
|
}
|
|
1888
1345
|
}
|
|
1889
1346
|
}),
|
|
@@ -1947,7 +1404,8 @@
|
|
|
1947
1404
|
map.bubble
|
|
1948
1405
|
););
|
|
1949
1406
|
if (fn) {
|
|
1950
|
-
|
|
1407
|
+
if (isString(fn)) View.emit(fn, e, chr, el)
|
|
1408
|
+
else fn(e, chr, el)
|
|
1951
1409
|
}
|
|
1952
1410
|
}
|
|
1953
1411
|
|
|
@@ -2001,15 +1459,13 @@
|
|
|
2001
1459
|
md: 601,
|
|
2002
1460
|
lg: 1025
|
|
2003
1461
|
}
|
|
2004
|
-
, setBreakpointsRated =
|
|
2005
|
-
setBreakpoints()
|
|
2006
|
-
}.rate(100, true)
|
|
1462
|
+
, setBreakpointsRated = rate(setBreakpoints, 100)
|
|
2007
1463
|
|
|
2008
1464
|
function setBreakpoints(_breakpoints) {
|
|
2009
1465
|
// document.documentElement.clientWidth is 0 in IE5
|
|
2010
1466
|
var key, next
|
|
2011
1467
|
, width = root.offsetWidth
|
|
2012
|
-
, map = breakpoints = _breakpoints || breakpoints
|
|
1468
|
+
, map = breakpoints = _breakpoints || breakpoints // jshint ignore:line
|
|
2013
1469
|
|
|
2014
1470
|
for (key in map) {
|
|
2015
1471
|
if (map[key] > width) break
|
|
@@ -2028,7 +1484,7 @@
|
|
|
2028
1484
|
cls(root, lastOrient = next)
|
|
2029
1485
|
}
|
|
2030
1486
|
|
|
2031
|
-
if (next = window.View) next.emit("resize")
|
|
1487
|
+
if ((next = window.View)) next.emit("resize")
|
|
2032
1488
|
}
|
|
2033
1489
|
El.setBreakpoints = setBreakpoints
|
|
2034
1490
|
|
|
@@ -2048,4 +1504,42 @@
|
|
|
2048
1504
|
wrapper[P].constructor = wrapper
|
|
2049
1505
|
return wrapper
|
|
2050
1506
|
}
|
|
2051
|
-
|
|
1507
|
+
|
|
1508
|
+
El.rate = rate
|
|
1509
|
+
// Maximum call rate for Function
|
|
1510
|
+
// leading edge, trailing edge
|
|
1511
|
+
function rate(fn, ms) {
|
|
1512
|
+
var tick
|
|
1513
|
+
, next = 0
|
|
1514
|
+
return function() {
|
|
1515
|
+
var now = Date.now()
|
|
1516
|
+
clearTimeout(tick)
|
|
1517
|
+
if (now >= next) {
|
|
1518
|
+
next = now + ms
|
|
1519
|
+
fn()
|
|
1520
|
+
} else {
|
|
1521
|
+
tick = setTimeout(fn, next - now)
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
El.step = step
|
|
1526
|
+
function step(num, factor, mid) {
|
|
1527
|
+
var x = ("" + factor).split(".")
|
|
1528
|
+
, steps = num / factor
|
|
1529
|
+
, n = ~~(steps + ((steps < 0 ? -1 : 1) * (mid == UNDEF ? 0.5 : mid === 1 && steps == (steps|0) ? 0 : +mid))) * factor
|
|
1530
|
+
return "" + (1 in x ? n.toFixed(x[1].length) : n)
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
function isNumber(num) {
|
|
1534
|
+
return typeof num === "number"
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
function isObject(obj) {
|
|
1538
|
+
return !!obj && obj.constructor === Object
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
function isString(str) {
|
|
1542
|
+
return typeof str === "string"
|
|
1543
|
+
}
|
|
1544
|
+
}(window, document, Object, Event, "prototype") // jshint ignore:line
|
|
1545
|
+
|