@litejs/ui 24.11.0 → 25.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/css/anim.css ADDED
@@ -0,0 +1,20 @@
1
+
2
+ /**
3
+ * 1. Trigger GPU acceleration.
4
+ * Remove first flicker on iphone.
5
+ */
6
+
7
+ .anim,
8
+ .anim:after,
9
+ .anim:before {
10
+ -webkit-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
11
+ -moz-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
12
+ -o-transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
13
+ transition: all .2s cubic-bezier(0, 0, .2, 1) 0s;
14
+
15
+ -webkit-transform: translate3d(0, 0, 0); /* 1 */
16
+ transform: translate3d(0, 0, 0);
17
+ -webkit-perspective: 1000;
18
+ perspective: 1000;
19
+ }
20
+
package/css/base.css CHANGED
@@ -191,25 +191,6 @@ button,
191
191
  white-space: nowrap;
192
192
  }
193
193
 
194
- /**
195
- * 1. Trigger GPU acceleration.
196
- * Remove first flicker on iphone.
197
- */
198
-
199
- .anim,
200
- .anim:after,
201
- .anim:before {
202
- -webkit-transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
203
- -moz-transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
204
- -o-transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
205
- transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
206
-
207
- -webkit-transform: translate3d(0, 0, 0); /* 1 */
208
- transform: translate3d(0, 0, 0);
209
- -webkit-perspective: 1000;
210
- perspective: 1000;
211
- }
212
-
213
194
  .sm .sm-left,
214
195
  .md .md-left,
215
196
  .lg .lg-left,
package/css/grid-1of.css CHANGED
@@ -23,3 +23,69 @@
23
23
  .h4of5, .md .md-h4of5, .lg .md-h4of5, .lg .lg-h4of5 { height: 80%; }
24
24
  /**/
25
25
 
26
+
27
+ .w1-10 { width: 10%; }
28
+ .w1-9 { width: 11.11%; }
29
+ .w1-8 { width: 12.5%; }
30
+ .w1-7 { width: 14.29%; }
31
+ .w1-6 { width: 16.67%; }
32
+ .w1-5 { width: 20%; }
33
+ .w2-9 { width: 22.22%; }
34
+ .w1-4 { width: 25%; }
35
+ .w2-7 { width: 28.57%; }
36
+ .w1-3 { width: 33.33%; }
37
+ .w3-8 { width: 37.5%; }
38
+ .w2-5 { width: 40%; }
39
+ .w3-7 { width: 42.86%; }
40
+ .w4-9 { width: 44.44%; }
41
+ .w1-2 { width: 50%; }
42
+ .w5-9 { width: 55.56%; }
43
+ .w3-5 { width: 60%; }
44
+ .w5-8 { width: 62.5%; }
45
+ .w2-3 { width: 66.67%; }
46
+ .w3-4 { width: 75%; }
47
+ .w7-9 { width: 77.78%; }
48
+ .w4-5 { width: 80%; }
49
+ .w5-6 { width: 83.33%; }
50
+ .w6-7 { width: 85.71%; }
51
+ .w7-8 { width: 87.5%; }
52
+ .w8-9 { width: 88.89%; }
53
+ .w9-10 { width: 90%; }
54
+ .w1-1 { width: 100%; }
55
+
56
+
57
+ /*
58
+ .w90, .md .md-w90, .lg .md-w90, .lg.lg .lg-w90 { width: 90%; }
59
+ .w80, .md .md-w80, .lg .md-w80, .lg.lg .lg-w80 { width: 80%; }
60
+ .w70, .md .md-w70, .lg .md-w70, .lg.lg .lg-w70 { width: 70%; }
61
+ .w60, .md .md-w60, .lg .md-w60, .lg.lg .lg-w60 { width: 60%; }
62
+ .w40, .md .md-w40, .lg .md-w40, .lg.lg .lg-w40 { width: 40%; }
63
+ .w30, .md .md-w30, .lg .md-w30, .lg.lg .lg-w30 { width: 40%; }
64
+ .w20, .md .md-w20, .lg .md-w20, .lg.lg .lg-w20 { width: 20%; }
65
+ .w10, .md .md-w10, .lg .md-w10, .lg.lg .lg-w10 { width: 10%; }
66
+
67
+ .h80, .md .md-h80, .lg .md-h80, .lg.lg .lg-h80 { height: 80%; }
68
+ .h60, .md .md-h60, .lg .md-h60, .lg.lg .lg-h60 { height: 60%; }
69
+ .h40, .md .md-h40, .lg .md-h40, .lg.lg .lg-h40 { height: 40%; }
70
+ .h20, .md .md-h20, .lg .md-h20, .lg.lg .lg-h20 { height: 20%; }
71
+
72
+ .l80, .md .md-l80, .lg .md-l80, .lg.lg .lg-l80 { left: 80%; }
73
+ .l60, .md .md-l60, .lg .md-l60, .lg.lg .lg-l60 { left: 60%; }
74
+ .l40, .md .md-l40, .lg .md-l40, .lg.lg .lg-l40 { left: 40%; }
75
+ .l20, .md .md-l20, .lg .md-l20, .lg.lg .lg-l20 { left: 20%; }
76
+
77
+ .col:first-child:nth-last-child(2), .col:first-child:nth-last-child(2) ~ .col {
78
+ width: 50%;
79
+ }
80
+ .col:first-child:nth-last-child(3), .col:first-child:nth-last-child(3) ~ .col {
81
+ width: 33.333%;
82
+ }
83
+ .col:first-child:nth-last-child(4), .col:first-child:nth-last-child(4) ~ .col {
84
+ width: 25%;
85
+ }
86
+ .col:first-child:nth-last-child(5), .col:first-child:nth-last-child(5) ~ .col {
87
+ width: 20%;
88
+ }
89
+ */
90
+
91
+
package/css/grid.css CHANGED
@@ -27,59 +27,43 @@ Expects box-sizing: border-box;
27
27
  }
28
28
 
29
29
  .col,
30
- .w12, .md .md-w12, .lg .md-w12, .lg .lg-w12 { width: 100%; }
31
- .w11, .md .md-w11, .lg .md-w11, .lg .lg-w11 { width: 91.6667%; }
32
- .w10, .md .md-w10, .lg .md-w10, .lg .lg-w10 { width: 83.3333%; }
33
- .w9 , .md .md-w9 , .lg .md-w9 , .lg .lg-w9 { width: 75%; }
34
- .w8 , .md .md-w8 , .lg .md-w8 , .lg .lg-w8 { width: 66.6667%; }
35
- .w7 , .md .md-w7 , .lg .md-w7 , .lg .lg-w7 { width: 58.3333%; }
36
- .w6 , .md .md-w6 , .lg .md-w6 , .lg .lg-w6 { width: 50%; }
37
- .w5 , .md .md-w5 , .lg .md-w5 , .lg .lg-w5 { width: 41.6667%; }
38
- .w4 , .md .md-w4 , .lg .md-w4 , .lg .lg-w4 { width: 33.3333%; }
39
- .w3 , .md .md-w3 , .lg .md-w3 , .lg .lg-w3 { width: 25%; }
40
- .w2 , .md .md-w2 , .lg .md-w2 , .lg .lg-w2 { width: 16.6667%; }
41
- .w1 , .md .md-w1 , .lg .md-w1 , .lg .lg-w1 { width: 8.3333%; }
30
+ .w12, .md .md-w12, .lg .md-w12, .lg.lg .lg-w12 { width: 100%; }
31
+ .w11, .md .md-w11, .lg .md-w11, .lg.lg .lg-w11 { width: 91.667%; }
32
+ .w10, .md .md-w10, .lg .md-w10, .lg.lg .lg-w10 { width: 83.333%; }
33
+ .w9 , .md .md-w9 , .lg .md-w9 , .lg.lg .lg-w9 { width: 75%; }
34
+ .w8 , .md .md-w8 , .lg .md-w8 , .lg.lg .lg-w8 { width: 66.667%; }
35
+ .w7 , .md .md-w7 , .lg .md-w7 , .lg.lg .lg-w7 { width: 58.333%; }
36
+ .w6 , .md .md-w6 , .lg .md-w6 , .lg.lg .lg-w6 { width: 50%; }
37
+ .w5 , .md .md-w5 , .lg .md-w5 , .lg.lg .lg-w5 { width: 41.667%; }
38
+ .w4 , .md .md-w4 , .lg .md-w4 , .lg.lg .lg-w4 { width: 33.333%; }
39
+ .w3 , .md .md-w3 , .lg .md-w3 , .lg.lg .lg-w3 { width: 25%; }
40
+ .w2 , .md .md-w2 , .lg .md-w2 , .lg.lg .lg-w2 { width: 16.667%; }
41
+ .w1 , .md .md-w1 , .lg .md-w1 , .lg.lg .lg-w1 { width: 8.333%; }
42
42
 
43
- .h12, .md .md-h12, .lg .md-h12, .lg .lg-h12 { height: 100%; }
44
- .h11, .md .md-h11, .lg .md-h11, .lg .lg-h11 { height: 91.6667%; }
45
- .h10, .md .md-h10, .lg .md-h10, .lg .lg-h10 { height: 83.3333%; }
46
- .h9 , .md .md-h9 , .lg .md-h9 , .lg .lg-h9 { height: 75%; }
47
- .h8 , .md .md-h8 , .lg .md-h8 , .lg .lg-h8 { height: 66.6667%; }
48
- .h7 , .md .md-h7 , .lg .md-h7 , .lg .lg-h7 { height: 58.3333%; }
49
- .h6 , .md .md-h6 , .lg .md-h6 , .lg .lg-h6 { height: 50%; }
50
- .h5 , .md .md-h5 , .lg .md-h5 , .lg .lg-h5 { height: 41.6667%; }
51
- .h4 , .md .md-h4 , .lg .md-h4 , .lg .lg-h4 { height: 33.3333%; }
52
- .h3 , .md .md-h3 , .lg .md-h3 , .lg .lg-h3 { height: 25%; }
53
- .h2 , .md .md-h2 , .lg .md-h2 , .lg .lg-h2 { height: 16.6667%; }
54
- .h1 , .md .md-h1 , .lg .md-h1 , .lg .lg-h1 { height: 8.3333%; }
43
+ .h12, .md .md-h12, .lg .md-h12, .lg.lg .lg-h12 { height: 100%; }
44
+ .h11, .md .md-h11, .lg .md-h11, .lg.lg .lg-h11 { height: 91.667%; }
45
+ .h10, .md .md-h10, .lg .md-h10, .lg.lg .lg-h10 { height: 83.333%; }
46
+ .h9 , .md .md-h9 , .lg .md-h9 , .lg.lg .lg-h9 { height: 75%; }
47
+ .h8 , .md .md-h8 , .lg .md-h8 , .lg.lg .lg-h8 { height: 66.667%; }
48
+ .h7 , .md .md-h7 , .lg .md-h7 , .lg.lg .lg-h7 { height: 58.333%; }
49
+ .h6 , .md .md-h6 , .lg .md-h6 , .lg.lg .lg-h6 { height: 50%; }
50
+ .h5 , .md .md-h5 , .lg .md-h5 , .lg.lg .lg-h5 { height: 41.667%; }
51
+ .h4 , .md .md-h4 , .lg .md-h4 , .lg.lg .lg-h4 { height: 33.333%; }
52
+ .h3 , .md .md-h3 , .lg .md-h3 , .lg.lg .lg-h3 { height: 25%; }
53
+ .h2 , .md .md-h2 , .lg .md-h2 , .lg.lg .lg-h2 { height: 16.667%; }
54
+ .h1 , .md .md-h1 , .lg .md-h1 , .lg.lg .lg-h1 { height: 8.333%; }
55
55
 
56
-
57
- .l12, .md .md-l12, .lg .md-l12, .lg .lg-l12 { left: 100%; }
58
- .l11, .md .md-l11, .lg .md-l11, .lg .lg-l11 { left: 91.6667%; }
59
- .l10, .md .md-l10, .lg .md-l10, .lg .lg-l10 { left: 83.3333%; }
60
- .l9, .md .md-l9, .lg .md-l9, .lg .lg-l9 { left: 75%; }
61
- .l8, .md .md-l8, .lg .md-l8, .lg .lg-l8 { left: 66.6667%; }
62
- .l7, .md .md-l7, .lg .md-l7, .lg .lg-l7 { left: 58.3333%; }
63
- .l6, .md .md-l6, .lg .md-l6, .lg .lg-l6 { left: 50%; }
64
- .l5, .md .md-l5, .lg .md-l5, .lg .lg-l5 { left: 41.6667%; }
65
- .l4, .md .md-l4, .lg .md-l4, .lg .lg-l4 { left: 33.3333%; }
66
- .l3, .md .md-l3, .lg .md-l3, .lg .lg-l3 { left: 25%; }
67
- .l2, .md .md-l2, .lg .md-l2, .lg .lg-l2 { left: 16.6667%; }
68
- .l1, .md .md-l1, .lg .md-l1, .lg .lg-l1 { left: 8.3333%; }
69
-
70
- /*
71
- .col:first-child:nth-last-child(2), .col:first-child:nth-last-child(2) ~ .col {
72
- width: 50%;
73
- }
74
- .col:first-child:nth-last-child(3), .col:first-child:nth-last-child(3) ~ .col {
75
- width: 33.333%;
76
- }
77
- .col:first-child:nth-last-child(4), .col:first-child:nth-last-child(4) ~ .col {
78
- width: 25%;
79
- }
80
- .col:first-child:nth-last-child(5), .col:first-child:nth-last-child(5) ~ .col {
81
- width: 20%;
82
- }
83
- */
56
+ .l12, .md .md-l12, .lg .md-l12, .lg.lg .lg-l12 { left: 100%; }
57
+ .l11, .md .md-l11, .lg .md-l11, .lg.lg .lg-l11 { left: 91.667%; }
58
+ .l10, .md .md-l10, .lg .md-l10, .lg.lg .lg-l10 { left: 83.333%; }
59
+ .l9, .md .md-l9, .lg .md-l9, .lg.lg .lg-l9 { left: 75%; }
60
+ .l8, .md .md-l8, .lg .md-l8, .lg.lg .lg-l8 { left: 66.667%; }
61
+ .l7, .md .md-l7, .lg .md-l7, .lg.lg .lg-l7 { left: 58.333%; }
62
+ .l6, .md .md-l6, .lg .md-l6, .lg.lg .lg-l6 { left: 50%; }
63
+ .l5, .md .md-l5, .lg .md-l5, .lg.lg .lg-l5 { left: 41.667%; }
64
+ .l4, .md .md-l4, .lg .md-l4, .lg.lg .lg-l4 { left: 33.333%; }
65
+ .l3, .md .md-l3, .lg .md-l3, .lg.lg .lg-l3 { left: 25%; }
66
+ .l2, .md .md-l2, .lg .md-l2, .lg.lg .lg-l2 { left: 16.667%; }
67
+ .l1, .md .md-l1, .lg .md-l1, .lg.lg .lg-l1 { left: 8.333%; }
84
68
 
85
69
 
package/el/Slider.tpl CHANGED
@@ -263,7 +263,7 @@
263
263
  %el Toggle
264
264
  label.Toggle.reset[tabindex=0]
265
265
  input[type=checkbox].hide
266
- ;readonly: row && !row.write
267
- ;checked: model && (row && row.opts ? row.opts === model.get(row.path) : !!model.get(row.path))
266
+ ;readonly! row && !row.write
267
+ ;checked! model && (row && row.opts ? row.opts === model.get(row.path) : !!model.get(row.path))
268
268
  .Toggle-knob.anim
269
269
 
package/el/dialog.ui CHANGED
@@ -138,7 +138,7 @@
138
138
  %el Dialog-numpad
139
139
  .row.js-numpad
140
140
  @click ".btn", function(){}
141
- ;each: num in [1,2,3,4,5,6,7,8,9,"CLEAR",0]
141
+ ;each! "num",[1,2,3,4,5,6,7,8,9,"CLEAR",0]
142
142
  .col.w4>.btn {num}
143
143
 
144
144
  %js
@@ -149,21 +149,21 @@
149
149
 
150
150
  %el Dialog
151
151
  .Dialog.grid.p2.anim
152
- .col.ts3 ;txt!_(title, map)
153
- .col.js-body ;md!_(body, map)
152
+ .col.ts3 ;txt! _(title, map)
153
+ .col.js-body ;md! _(body, map)
154
154
  .col
155
- .group ;each: action in actions
155
+ .group ;each! action in actions
156
156
  .btn.js-btn
157
- ;txt!_(action.title)
158
- ;class!"w" + (12/actions.length)
159
- ;nop: this.focus()
160
- ;set: "data-action", action.action
161
- ;class!"is-" + action.action, action.action
157
+ ;txt! _(action.title)
158
+ ;class! "w" + (12/actions.length)
159
+ ;nop! this.focus()
160
+ ;set! "data-action", action.action
161
+ ;class! "is-" + action.action, action.action
162
162
 
163
163
  %el Modal
164
164
  .Modal.max.fix.anim
165
165
  .Modal-bg.max.abs
166
166
  .Modal-content.Modal--blur.grid.p2.anim
167
- ;cls!"Modal--blur",!1,1
167
+ ;cls! "Modal--blur",!1,1
168
168
  %slot
169
169
 
package/el/form.ui CHANGED
@@ -160,7 +160,7 @@ label.row
160
160
  %child
161
161
  .input__hint
162
162
  = _(description)
163
- ;if: description
163
+ ;if! description
164
164
 
165
165
  %el Form-subheader
166
166
  .col
@@ -176,14 +176,14 @@ Form-row
176
176
  input.field
177
177
 
178
178
  %el Form-ro
179
- Form-row>span ;txt: value
179
+ Form-row>span ;txt! value
180
180
 
181
181
  %el Form-hidden
182
182
  div>input.field[type=hidden]
183
183
 
184
184
  %el Form-boolean
185
185
  Form-row
186
- input.field[type=checkbox] ;value: value
186
+ input.field[type=checkbox] ;value! value
187
187
 
188
188
  %el Form-boolean-ro
189
189
  Form-row>span
@@ -206,9 +206,9 @@ Form-ro
206
206
 
207
207
  %el Form-enum
208
208
  Form-row
209
- select.field ;each:val in $d["enum"]
209
+ select.field ;each! "val", $d["enum"]
210
210
  option
211
- ;val:: val
211
+ ;val! val
212
212
  = _("" + val)
213
213
 
214
214
  %el Form-enum-ro
@@ -217,10 +217,10 @@ Form-ro
217
217
  %el Form-list
218
218
  Form-row
219
219
  select.field
220
- ;list: api(resourceCollection.format(params, $d)), required ? 0 : [""], value
220
+ ;list api(resourceCollection.format(params, $d)), required ? 0 : [""], value
221
221
  option
222
- ;val:: item.id
223
- ;txt:: _(item.name)
222
+ ;val! item.id
223
+ ;txt! _(item.name)
224
224
 
225
225
  %el Form-list-ro
226
226
  Form-row>span
@@ -235,8 +235,8 @@ Form-row>span
235
235
  = _(description)
236
236
  .js-items.cf
237
237
  a.btn.right
238
- ;if: !$d.noAdd
239
- ;txt: _($d.name + ".Add")
238
+ ;if! !$d.noAdd
239
+ ;txt! _($d.name + ".Add")
240
240
  @click: $d.add
241
241
 
242
242
  %el Form-array-item
@@ -246,7 +246,7 @@ Form-row>span
246
246
  ;set "data-tooltip", _("Delete")
247
247
  @click $d.del
248
248
  b
249
- ;if: title
250
- ;txt: title
249
+ ;if! title
250
+ ;txt! title
251
251
  .grid.b2.js-item
252
252
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/ui",
3
- "version": "24.11.0",
3
+ "version": "25.1.0",
4
4
  "description": "UI engine for LiteJS full-stack framework",
5
5
  "license": "MIT",
6
6
  "author": "Lauri Rooden <lauri@rooden.ee>",
@@ -12,21 +12,18 @@
12
12
  ],
13
13
  "homepage": "https://litejs.com",
14
14
  "repository": "github:litejs/ui",
15
- "bugs": "https://github.com/litejs/dev/issues",
16
15
  "main": "ui.js",
17
16
  "files": [
18
17
  "*.js",
19
18
  "binding",
20
19
  "css",
21
- "el",
22
- "shim"
20
+ "el"
23
21
  ],
24
22
  "scripts": {
25
- "lint": "jshint --config=.github/jshint.json *.js",
26
- "test": "lj test test/index.js --tz='Europe/Tallinn' --brief --sources=load.js,require.js,index.js"
23
+ "test": "lj t"
27
24
  },
28
25
  "devDependencies": {
29
- "@litejs/cli": "24.10.0",
30
- "@litejs/dom": "24.8.0"
26
+ "@litejs/cli": "25.1.1",
27
+ "@litejs/dom": "25.1.0"
31
28
  }
32
29
  }
package/ui.js CHANGED
@@ -11,7 +11,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
11
11
  window.El = El
12
12
  asEmitter(window.LiteJS = LiteJS)
13
13
 
14
- var UNDEF, lastExp, parser, pushBase, styleNode
14
+ var UNDEF, parser, pushBase, styleNode
15
15
  , NUL = null
16
16
  , html = document.documentElement
17
17
  , body = document.body
@@ -37,10 +37,8 @@ console.log("LiteJS is in debug mode, but it's fine for production")
37
37
  , BIND_ATTR = "data-bind"
38
38
  , elSeq = 0
39
39
  , elCache = {}
40
- , formatRe = /{((?:("|')(?:\\.|[^\\])*?\2|.)+?)}/g
41
- , renderRe = /[;\s]*([-.\w$]+)(?:([ :!])((?:(["'\/])(?:\\.|[^\\])*?\4|[^;])*))?/g
40
+ , renderRe = /[;\s]*([-.\w$]+)(?:(!?)[ :]*((?:(["'\/])(?:\\.|[^\\])*?\4|[^;])*))?/g
42
41
  , selectorRe = /([.#:[])([-\w]+)(?:([~^$*|]?)=(("|')(?:\\.|[^\\])*?\5|[-\w]+))?]?/g
43
- , templateRe = /([ \t]*)(%?)((?:("|')(?:\\.|[^\\])*?\4|[-\w:.#[\]~^$*|]=?)*) ?([\/>+=@^;]|)(([\])}]?).*?([[({]?))(?=\x1f|\n|$)+/g
44
42
  , fnCache = {}
45
43
  , fnRe = /('|")(?:\\.|[^\\])*?\1|\/(?:\\.|[^\\])+?\/[gim]*|\$el\b|\$[aos]\b|\b(?:false|in|if|new|null|this|true|typeof|void|function|var|else|return)\b|\.\w+|\w+:/g
46
44
  , wordRe = /[a-z_$][\w$]*/ig
@@ -68,10 +66,8 @@ console.log("LiteJS is in debug mode, but it's fine for production")
68
66
  set: acceptMany(setAttr),
69
67
  txt: elTxt,
70
68
  val: elVal,
71
- view: function(el, url) {
72
- setAttr(el, "href", (pushBase || "#") + expand(url || ""))
73
- }
74
69
  }
70
+ , bindOnce = []
75
71
  , globalScope = {
76
72
  El: El,
77
73
  $b: bindings
@@ -152,7 +148,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
152
148
  el.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", href)
153
149
  }
154
150
  if (window.SVGElement) {
155
- each("animate animateMotion animateTransform circle clipPath defs desc ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter foreignObject g image line linearGradient marker mask metadata mpath path pattern polygon polyline radialGradient rect script set stop svg switch symbol text textPath tspan use view", function(name) {
151
+ each("animate animateMotion animateTransform circle clipPath defs ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence g image line linearGradient marker mask mpath path pattern polygon polyline radialGradient rect set stop svg text textPath tspan use", function(name) {
156
152
  elCache[name] = document.createElementNS("http://www.w3.org/2000/svg", name)
157
153
  })
158
154
  // a style title
@@ -205,6 +201,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
205
201
 
206
202
  function one(type, fn, scope) {
207
203
  var emitter = this === window ? emptyArr : this
204
+
208
205
  function remove() {
209
206
  off.call(emitter, type, fn, scope)
210
207
  off.call(emitter, type, remove, scope)
@@ -374,7 +371,9 @@ console.log("LiteJS is in debug mode, but it's fine for production")
374
371
  render(view.o)
375
372
  viewEmit(parent, "openChild", view, close)
376
373
  viewEmit(view, "open", params)
374
+ /*** kb ***/
377
375
  addKb(view.kb)
376
+ /**/
378
377
  params._c = UNDEF
379
378
  }
380
379
  if ((params._d = params._v = view.c)) {
@@ -392,7 +391,9 @@ console.log("LiteJS is in debug mode, but it's fine for production")
392
391
  viewClose(view.c)
393
392
  elKill(view.o)
394
393
  view.o = UNDEF
394
+ /*** kb ***/
395
395
  rmKb(view.kb)
396
+ /**/
396
397
  viewEmit(view, "close")
397
398
  }
398
399
  }
@@ -432,6 +433,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
432
433
  var parent = El("div")
433
434
  , stack = [-1]
434
435
  , parentStack = []
436
+ , templateRe = /([ \t]*)(%?)((?:("|')(?:\\.|[^\\])*?\4|[-\w:.#[\]~^$*|]=?)*) ?([\/>=@^;]|)(([\])}]?).*?([[({]?))(?=\x1f|$)/gm
435
437
 
436
438
  function work(all, indent, plugin, sel, q, op, text, mapEnd, mapStart, offset) {
437
439
  if (offset && all === indent) return
@@ -466,8 +468,8 @@ console.log("LiteJS is in debug mode, but it's fine for production")
466
468
  append(parent, parent = El(sel))
467
469
  }
468
470
  if (text && op != "/") {
469
- if (op === ">" || op === "+") {
470
- replace(indent + (op === "+" ? text : " " + text), templateRe, work)
471
+ if (op === ">") {
472
+ replace(indent + " " + text, templateRe, work)
471
473
  } else if (op === "=") {
472
474
  append(parent, text) // + "\n")
473
475
  } else {
@@ -539,7 +541,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
539
541
  var params = $d.params = { _t: Date.now() }
540
542
  , view = viewGet(url, params)
541
543
  if (!view.o || lastUrl !== url) {
542
- $d.url = lastExp = lastUrl = url
544
+ $d.url = lastUrl = expand(url)
543
545
  viewPing(view, params)
544
546
  }
545
547
  }
@@ -896,9 +898,22 @@ console.log("LiteJS is in debug mode, but it's fine for production")
896
898
  }
897
899
  })
898
900
  function format(str, data, getter) {
899
- return replace(str, formatRe, function(all, path) {
900
- return getter(data, path, "")
901
- })
901
+ for (var char, inQuote, inExpr, depth = 0, pos = 0, len = str.length; pos < len; ) {
902
+ char = str.charAt(pos++)
903
+ if (char == "'" || char == "\"") { // '"
904
+ inQuote = (!inExpr || char === inQuote) ? "" : char
905
+ } else if (inQuote) {
906
+ if (char == "\\") pos++
907
+ } else if (char == "{" && depth++ < 1) {
908
+ inExpr = pos
909
+ } else if (char == "}" && inExpr && --depth < 1) {
910
+ char = getter(data, str.slice(inExpr, pos - 1), "")
911
+ str = str.slice(0, inExpr - 1) + char + str.slice(pos)
912
+ pos = inExpr + char.length - 1
913
+ len = str.length
914
+ }
915
+ }
916
+ return str
902
917
  }
903
918
  function iGet(obj, path, fallback) {
904
919
  return isStr(path) ? (
@@ -1093,9 +1108,9 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1093
1108
  },
1094
1109
  "if": function(el, enabled) {
1095
1110
  if (enabled) {
1096
- elReplace(el._if, el)
1111
+ elReplace(el._r, el)
1097
1112
  } else {
1098
- elReplace(el, el._if || (el._if = Comm("if", bind(render, el, el, this))))
1113
+ elReplace(el, el._r || (el._r = Comm("if", bind(render, el, el, this))))
1099
1114
  return true
1100
1115
  }
1101
1116
  },
@@ -1105,17 +1120,23 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1105
1120
  cls(el, el[prefix + opts], 0)
1106
1121
  cls(el, el[prefix + opts] = match && prefix + match)
1107
1122
  },
1123
+ name: function(el, name) {
1124
+ setAttr(el, "name", expand(name, 1))
1125
+ },
1108
1126
  ref: function(el, name) {
1109
1127
  this[name] = el
1110
1128
  },
1111
1129
  $s: function(el) {
1112
- var scope = elScope(el, el)
1130
+ var scope = this
1113
1131
  each(slice.call(arguments, 1), function(args) {
1114
1132
  each(args, function(arg, i) {
1115
1133
  if (isStr(i)) scope[i] = arg
1116
1134
  else scope[arg] = setAttr(el, arg, "")
1117
1135
  })
1118
1136
  })
1137
+ },
1138
+ view: function(el, url) {
1139
+ setAttr(el, "href", (pushBase || "#") + expand(url || ""))
1119
1140
  }
1120
1141
  }),
1121
1142
  $d: globalScope,
@@ -1128,8 +1149,6 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1128
1149
  hasClass: hasClass,
1129
1150
  matches: matches,
1130
1151
  nearest: nearest,
1131
- next: bind(walk, El, "nextSibling"),
1132
- prev: bind(walk, El, "previousSibling"),
1133
1152
  rate: rate,
1134
1153
  replace: elReplace,
1135
1154
  scope: elScope,
@@ -1277,6 +1296,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1277
1296
  elRm(el)
1278
1297
  if (el.nodeType < 2) {
1279
1298
  el.$s = UNDEF
1299
+ elKill(el._r) // Replacement element like comment from if binding
1280
1300
  elEmpty(el)
1281
1301
  if (el.valObject !== UNDEF) {
1282
1302
  el.valObject = UNDEF
@@ -1398,20 +1418,16 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1398
1418
  , expr = node[attr] || (node[attr] = setAttr(node, attr, "") || true)
1399
1419
  if (expr !== true) try {
1400
1420
  fn = fnCache[expr] || (fnCache[expr] = makeFn(expr))
1401
- return fn(node, scope, attr, fn.o)
1421
+ return fn(node, scope, attr, bindOnce)
1402
1422
  } catch (e) {
1403
1423
  throw e + "\n" + attr + ": " + expr
1404
1424
  }
1405
1425
  }
1406
- function makeFn(fn, raw) {
1407
- var i = 0
1408
- , bindOnce = []
1426
+ function makeFn(fn, raw, i) {
1409
1427
  fn = raw || "$s&&(" + replace(fn, renderRe, function(match, name, op, args) {
1410
1428
  return (
1411
- (op === "!" && (bindOnce[i] = match)) ?
1412
- "($el[$a]=$el[$a].replace($o[" + (i++)+ "],''),0)||" :
1413
- ""
1414
- ) + "$b['" + (bindings[name] ? name + "'].call($s,$el" : "set']($el,'" + name + "'") + (args ? "," + replace(args, /^\s*(\w+) in /,"'$1',") : "") + ")||"
1429
+ op ? "($el[$a]=$el[$a].replace($o[" + (i = bindOnce.indexOf(match), i < 0 ? bindOnce.push(match) - 1 : i)+ "],''),0)||" : ""
1430
+ ) + "$b['" + (bindings[name] ? name + "'].call($s" + (name == "$s" ? "=El.scope($el,$el)": "") + ",$el" : "set']($el,'" + name + "'") + (args ? "," + args : "") + ")||"
1415
1431
  }) + "$r)"
1416
1432
  var vars = replace(fn, fnRe, "").match(wordRe) || []
1417
1433
  for (i = vars.length; i--; ) {
@@ -1419,7 +1435,6 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1419
1435
  else vars[i] += "=$s." + vars[i]
1420
1436
  }
1421
1437
  fn = Function("$el,$s,$a,$o,$r", (vars[0] ? "var " + vars : "") + ";return " + fn)
1422
- fn.o = bindOnce
1423
1438
  return fn
1424
1439
  }
1425
1440
 
@@ -1554,8 +1569,9 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1554
1569
  function touchWheel(e) {
1555
1570
  // IE10 enabled pinch-to-zoom gestures from multi-touch trackpad’s as mousewheel event with ctrlKey.
1556
1571
  // Chrome M35 and Firefox 55 followed up.
1572
+ // alt+wheel may be OS level zoom, use shiftKey as alternative
1557
1573
  if (!touches[0]) {
1558
- var ev = e.ctrlKey ? "pinch" : e.altKey ? "rotate" : UNDEF
1574
+ var ev = e.ctrlKey ? "pinch" : e.altKey || e.shiftKey ? "rotate" : UNDEF
1559
1575
  if (ev && emit(e.currentTarget || e.target, ev, e, e.deltaY/20, 0)) {
1560
1576
  return eventStop(e)
1561
1577
  }
@@ -1623,10 +1639,6 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1623
1639
  function nearest(el, sel) {
1624
1640
  return el ? find(el, sel) || nearest(el.parentNode, sel) : NUL
1625
1641
  }
1626
- function walk(attr, el, sel) {
1627
- for (; el && !matches(el = el[attr], sel); );
1628
- return el
1629
- }
1630
1642
  function acceptMany(fn, prepareVal) {
1631
1643
  return function f(el, name, val, selector, delay, data) {
1632
1644
  if (el && name) {
@@ -1672,9 +1684,7 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1672
1684
  function blur() {
1673
1685
  // IE8 can throw on accessing document.activeElement.
1674
1686
  try {
1675
- var el = document.activeElement
1676
- , tag = el.tagName
1677
- if (tag === "A" || tag === "BUTTON") el.blur()
1687
+ document.activeElement.blur()
1678
1688
  } catch(e) {}
1679
1689
  }
1680
1690
  function camelFn(_, a) {
@@ -1687,13 +1697,14 @@ console.log("LiteJS is in debug mode, but it's fine for production")
1687
1697
  else for (key in arr) if (hasOwn(arr, key)) fn.call(scope, arr[key], key, arr)
1688
1698
  }
1689
1699
  }
1690
- function expand(str) {
1700
+ function expand(str, ns) {
1691
1701
  var first = str.charAt(0)
1692
1702
  , rest = str.slice(1)
1703
+ , lastExp = expand[ns]
1693
1704
  return (
1694
1705
  first === "+" ? lastExp + rest :
1695
1706
  first === "%" ? ((first = lastExp.lastIndexOf(rest.charAt(0))), (first > 0 ? lastExp.slice(0, first) : lastExp)) + rest :
1696
- (lastExp = str)
1707
+ (expand[ns] = str)
1697
1708
  )
1698
1709
  }
1699
1710
  function injectCss(cssText) {