@litejs/ui 24.11.0 → 25.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/extract-lang.js +56 -0
- package/css/anim.css +20 -0
- package/css/base.css +0 -19
- package/css/grid-1of.css +66 -0
- package/css/grid.css +36 -52
- package/el/Slider.ui +229 -0
- package/el/dialog.ui +10 -10
- package/el/form.ui +12 -12
- package/extract-lang.js +33 -0
- package/package.json +8 -8
- package/shim.js +10 -7
- package/ui.js +103 -84
- package/el/Slider.tpl +0 -269
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//-
|
|
3
|
+
//- Usage
|
|
4
|
+
//- lj-extract-lang [FILE..]
|
|
5
|
+
//-
|
|
6
|
+
//- Options
|
|
7
|
+
//- --pretty, -p Pretty print json output
|
|
8
|
+
//-
|
|
9
|
+
//- Examples
|
|
10
|
+
//- lj-extract-translations translations.json
|
|
11
|
+
//-
|
|
12
|
+
|
|
13
|
+
var fs = require("fs")
|
|
14
|
+
, path = require("path")
|
|
15
|
+
, opts = require("@litejs/cli/opts.js").opts({
|
|
16
|
+
pretty: false,
|
|
17
|
+
version: false
|
|
18
|
+
})
|
|
19
|
+
, extractLang = require("../extract-lang.js").extractLang
|
|
20
|
+
, package = require("../package.json")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if (opts._unknown[0]) {
|
|
24
|
+
console.error("\nError: Unknown option: " + opts._unknown)
|
|
25
|
+
usage(true)
|
|
26
|
+
process.exit(1)
|
|
27
|
+
} else if (opts._[0]) {
|
|
28
|
+
readJson(opts._[0])
|
|
29
|
+
} else {
|
|
30
|
+
usage()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function usage(err) {
|
|
34
|
+
if (!err && opts.version) console.log("%s v%s", package.name, package.version)
|
|
35
|
+
var helpFile = module.filename
|
|
36
|
+
console.log(fs.readFileSync(helpFile, "utf8").match(/^\/\/-.*/gm).join("\n").replace(/^.../gm, ""))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function readJson(file) {
|
|
40
|
+
var lang
|
|
41
|
+
, all = require(path.resolve(file))
|
|
42
|
+
, i = 0
|
|
43
|
+
, locales = Object.keys(all.locales)
|
|
44
|
+
|
|
45
|
+
console.log("Extract translations: " + locales)
|
|
46
|
+
|
|
47
|
+
for (; lang = locales[i++]; ) {
|
|
48
|
+
writeJson(lang + ".json", extractLang(all, lang))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function writeJson(file, data) {
|
|
53
|
+
fs.writeFileSync(path.resolve(file), JSON.stringify(data, null, opts.pretty ? 2 : null) + "\n", "utf8")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
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.
|
|
32
|
-
.w10, .md .md-w10, .lg .md-w10, .lg .lg-w10 { width: 83.
|
|
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.
|
|
35
|
-
.w7 , .md .md-w7 , .lg .md-w7 , .lg .lg-w7 { width: 58.
|
|
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.
|
|
38
|
-
.w4 , .md .md-w4 , .lg .md-w4 , .lg .lg-w4 { width: 33.
|
|
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.
|
|
41
|
-
.w1 , .md .md-w1 , .lg .md-w1 , .lg .lg-w1 { width: 8.
|
|
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.
|
|
45
|
-
.h10, .md .md-h10, .lg .md-h10, .lg .lg-h10 { height: 83.
|
|
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.
|
|
48
|
-
.h7 , .md .md-h7 , .lg .md-h7 , .lg .lg-h7 { height: 58.
|
|
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.
|
|
51
|
-
.h4 , .md .md-h4 , .lg .md-h4 , .lg .lg-h4 { height: 33.
|
|
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.
|
|
54
|
-
.h1 , .md .md-h1 , .lg .md-h1 , .lg .lg-h1 { height: 8.
|
|
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
|
-
.
|
|
58
|
-
.
|
|
59
|
-
.
|
|
60
|
-
.
|
|
61
|
-
.
|
|
62
|
-
.
|
|
63
|
-
.
|
|
64
|
-
.
|
|
65
|
-
.
|
|
66
|
-
.
|
|
67
|
-
.
|
|
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.ui
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
|
|
2
|
+
%css
|
|
3
|
+
.Slider,
|
|
4
|
+
.Toggle {
|
|
5
|
+
background: none;
|
|
6
|
+
height: 32px;
|
|
7
|
+
position: relative;
|
|
8
|
+
touch-action: none;
|
|
9
|
+
width: 200px;
|
|
10
|
+
color: #000;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
line-height: 32px;
|
|
13
|
+
}
|
|
14
|
+
.Slider-fill,
|
|
15
|
+
.Slider:before,
|
|
16
|
+
.Toggle:before {
|
|
17
|
+
background: rgba(0, 0, 0, .5);
|
|
18
|
+
border-radius: 2px;
|
|
19
|
+
height: 4px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 14px;
|
|
22
|
+
transition: inherit;
|
|
23
|
+
}
|
|
24
|
+
.Slider:before,
|
|
25
|
+
.Toggle:before {
|
|
26
|
+
background: #ccc;
|
|
27
|
+
content: "";
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
.Slider-knob,
|
|
32
|
+
.Toggle-knob {
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
box-shadow: 0 0 0 0 rgb(0, 0, 0, .2), 0 1px 4px rgba(0, 0, 0, .2);
|
|
35
|
+
height: 20px;
|
|
36
|
+
position: relative; /* for IE6 overflow:visible bug */
|
|
37
|
+
transition: inherit;
|
|
38
|
+
width: 20px;
|
|
39
|
+
}
|
|
40
|
+
.Slider-knob {
|
|
41
|
+
float: right;
|
|
42
|
+
margin: -8px -10px 0 0;
|
|
43
|
+
outline: none;
|
|
44
|
+
background: #f5f5f5;
|
|
45
|
+
}
|
|
46
|
+
:hover > * > .Slider-knob,
|
|
47
|
+
:focus > * > .Slider-knob {
|
|
48
|
+
box-shadow: 0 0 0 8px rgb(0, 0, 0, .2), 0 1px 4px rgba(0, 0, 0, .3);
|
|
49
|
+
}
|
|
50
|
+
.Slider-knob.is-active {
|
|
51
|
+
box-shadow: 0 0 0 12px rgb(0, 0, 0, .2), 0 1px 5px 5px rgba(0, 0, 0, .3);
|
|
52
|
+
}
|
|
53
|
+
/* value bubble */
|
|
54
|
+
.Slider-knob:before,
|
|
55
|
+
.Slider-knob:after {
|
|
56
|
+
background: inherit;
|
|
57
|
+
border-radius: 16px;
|
|
58
|
+
content: "";
|
|
59
|
+
height: 32px;
|
|
60
|
+
left: -6px;
|
|
61
|
+
min-width: 32px;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 0px;
|
|
66
|
+
transform: rotate(45deg);
|
|
67
|
+
transition: inherit;
|
|
68
|
+
}
|
|
69
|
+
.Slider-knob:after {
|
|
70
|
+
content: attr(data-val);
|
|
71
|
+
left: 10px;
|
|
72
|
+
padding: 0 4px;
|
|
73
|
+
transform: translate(-50%, 0);
|
|
74
|
+
}
|
|
75
|
+
:focus > * > .Slider-knob:before,
|
|
76
|
+
:hover > * > .Slider-knob:before,
|
|
77
|
+
.Slider-knob.is-active:before {
|
|
78
|
+
border-radius: 50% 50% 0 50%;
|
|
79
|
+
box-shadow: 3px 3px 3px 1px rgba(0, 0, 0, .3);
|
|
80
|
+
opacity: 1;
|
|
81
|
+
top: -43px;
|
|
82
|
+
}
|
|
83
|
+
:focus > * > .Slider-knob:after,
|
|
84
|
+
:hover > * > .Slider-knob:after,
|
|
85
|
+
.Slider-knob.is-active:after {
|
|
86
|
+
box-shadow: -4px -3px 3px -2px rgba(0, 0, 0, .15), 4px -3px 3px -2px rgba(0, 0, 0, .15);
|
|
87
|
+
opacity: 1;
|
|
88
|
+
top: -43px;
|
|
89
|
+
}
|
|
90
|
+
input:checked + .Toggle-knob {
|
|
91
|
+
background-color: #00a651;
|
|
92
|
+
left: 16px;
|
|
93
|
+
}
|
|
94
|
+
.Slider.color .Slider-fill {
|
|
95
|
+
background: red;
|
|
96
|
+
}
|
|
97
|
+
.Slider.color .Slider-fill+.Slider-fill {
|
|
98
|
+
background: green;
|
|
99
|
+
}
|
|
100
|
+
.Slider.color .Slider-fill+.Slider-fill+.Slider-fill {
|
|
101
|
+
background: blue;
|
|
102
|
+
}
|
|
103
|
+
.Slider.no-first > .Slider-fill:last-child {
|
|
104
|
+
background: #ccc;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
%js
|
|
108
|
+
var elOn = El.on
|
|
109
|
+
, elOff = El.off
|
|
110
|
+
, elCls = El.cls
|
|
111
|
+
, elGet = El.get
|
|
112
|
+
El.$b.SliderInit = function(el, range) {
|
|
113
|
+
range = (range || elGet(el, "range") || "").split(/[^+\-\d.]/) // min:max:step:margin
|
|
114
|
+
var knobLen, offset, px, drag, min, max, minPx, maxPx, value
|
|
115
|
+
//, vert = El.hasClass(el, "is-vertical")
|
|
116
|
+
, vert = false
|
|
117
|
+
, attr = vert ? "offsetHeight" : "offsetWidth"
|
|
118
|
+
, fill = el.firstChild
|
|
119
|
+
, knob = fill.lastChild
|
|
120
|
+
, emit = El.rate(El.emit.bind(el, el, "change"), 500)
|
|
121
|
+
elOn(window, "blur", stop)
|
|
122
|
+
setTimeout(el.val = set, 10, value||0)
|
|
123
|
+
function load() {
|
|
124
|
+
min = +(range[0] || 0)
|
|
125
|
+
max = +(range[1] || 100)
|
|
126
|
+
knobLen = knob[attr]>>1
|
|
127
|
+
minPx = 0
|
|
128
|
+
maxPx = el[attr] - knobLen - knobLen
|
|
129
|
+
px = maxPx / (max - min)
|
|
130
|
+
}
|
|
131
|
+
elOn(el, "pointerdown", function(e) {
|
|
132
|
+
drag = true
|
|
133
|
+
load()
|
|
134
|
+
var tmp = el.getBoundingClientRect()
|
|
135
|
+
offset = (vert ? tmp.top + maxPx + El.scrollTop() + knobLen : tmp.left + El.scrollLeft()) + knobLen
|
|
136
|
+
tmp = offset - e.clientX + (value-min||0)*px
|
|
137
|
+
if (tmp < knobLen && tmp > -knobLen) offset -= tmp
|
|
138
|
+
if (el.childNodes.length > 1) {
|
|
139
|
+
var next
|
|
140
|
+
, x = maxPx
|
|
141
|
+
, diff = vert ? offset - e.pageY : e.pageX - offset
|
|
142
|
+
for (tmp = fill = el.firstChild; tmp; tmp = tmp.nextSibling) {
|
|
143
|
+
next = diff - tmp[attr] + knobLen
|
|
144
|
+
if (next < 0 ? -next <= x : next < x) {
|
|
145
|
+
fill = tmp
|
|
146
|
+
knob = tmp.firstChild
|
|
147
|
+
x = next < 0 ? -next : next
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (fill.previousSibling) {
|
|
151
|
+
maxPx = fill.previousSibling[attr] - knobLen
|
|
152
|
+
if (range[3]) maxPx -= px * range[3]
|
|
153
|
+
}
|
|
154
|
+
if (fill.nextSibling) {
|
|
155
|
+
minPx = fill.nextSibling[attr] - knobLen
|
|
156
|
+
if (range[3]) minPx += px * range[3]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
move(e)
|
|
160
|
+
listen(elOn)
|
|
161
|
+
})
|
|
162
|
+
function move(e) {
|
|
163
|
+
var diff = vert ? offset - e.pageY : e.pageX - offset
|
|
164
|
+
diff = (diff > maxPx ? maxPx : (diff < minPx ? minPx : diff))
|
|
165
|
+
set((diff / px) + min, e, diff)
|
|
166
|
+
return El.stop(e)
|
|
167
|
+
}
|
|
168
|
+
function stop(e) {
|
|
169
|
+
if (drag) {
|
|
170
|
+
drag = false
|
|
171
|
+
listen(elOff)
|
|
172
|
+
set(value)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function listen(onOff) {
|
|
176
|
+
elCls(el, "anim", !drag)
|
|
177
|
+
elCls(knob, "is-active", drag)
|
|
178
|
+
onOff(document, "pointerup", stop)
|
|
179
|
+
onOff(document, "pointermove", move)
|
|
180
|
+
}
|
|
181
|
+
function set(val, e, pos) {
|
|
182
|
+
load()
|
|
183
|
+
val = El.step(val < min ? min : val > max ? max : val || 0, +(range[2] || 1))
|
|
184
|
+
if (value !== void 0 && (!drag || pos !== void 0)) {
|
|
185
|
+
El.css(fill, vert ? "height" : "width", ((pos || (val-min)*px)+knobLen) + "px", 0)
|
|
186
|
+
}
|
|
187
|
+
if (value !== val) {
|
|
188
|
+
el.value = value = val
|
|
189
|
+
if (drag && e) emit(e)
|
|
190
|
+
var format = elGet(el, "format")
|
|
191
|
+
El.set(knob, "data-val", format ? $d._(format, {val:val}) : val)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
%el Slider
|
|
197
|
+
button.Slider.anim.reset ;SliderInit!
|
|
198
|
+
.Slider-fill
|
|
199
|
+
.Slider-knob[tabindex=0]
|
|
200
|
+
|
|
201
|
+
%el Slider2
|
|
202
|
+
button.Slider.anim.reset ;SliderInit!
|
|
203
|
+
.Slider-fill
|
|
204
|
+
.Slider-knob[tabindex=0]
|
|
205
|
+
.Slider-fill
|
|
206
|
+
.Slider-knob[tabindex=0]
|
|
207
|
+
|
|
208
|
+
%el Slider3
|
|
209
|
+
button.Slider.reset ;SliderInit!
|
|
210
|
+
.Slider-fill
|
|
211
|
+
.Slider-knob[tabindex=0]
|
|
212
|
+
.Slider-fill
|
|
213
|
+
.Slider-knob[tabindex=0]
|
|
214
|
+
.Slider-fill
|
|
215
|
+
.Slider-knob[tabindex=0]
|
|
216
|
+
|
|
217
|
+
%el Toggle
|
|
218
|
+
button.Toggle.reset ;SliderInit! "0:1"
|
|
219
|
+
;css: "width","36px"
|
|
220
|
+
.Slider-fill.anim
|
|
221
|
+
.Slider-knob.anim[tabindex=0]
|
|
222
|
+
|
|
223
|
+
%el Togglea
|
|
224
|
+
label.Toggle.reset[tabindex=0]
|
|
225
|
+
input[type=checkbox].hide
|
|
226
|
+
;readonly! row && !row.write
|
|
227
|
+
;checked! model && (row && row.opts ? row.opts === model.get(row.path) : !!model.get(row.path))
|
|
228
|
+
.Toggle-knob.anim
|
|
229
|
+
|
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
|
|
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
|
|
155
|
+
.group ;each! action in actions
|
|
156
156
|
.btn.js-btn
|
|
157
|
-
;txt!_(action.title)
|
|
158
|
-
;class!"w" + (12/actions.length)
|
|
159
|
-
;nop
|
|
160
|
-
;set
|
|
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
|
|
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
|
|
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
|
|
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
|
|
209
|
+
select.field ;each! "val", $d["enum"]
|
|
210
210
|
option
|
|
211
|
-
;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
|
|
220
|
+
;list api(resourceCollection.format(params, $d)), required ? 0 : [""], value
|
|
221
221
|
option
|
|
222
|
-
;val
|
|
223
|
-
;txt
|
|
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
|
|
239
|
-
;txt
|
|
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
|
|
250
|
-
;txt
|
|
249
|
+
;if! title
|
|
250
|
+
;txt! title
|
|
251
251
|
.grid.b2.js-item
|
|
252
252
|
|
package/extract-lang.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
!function(exports) {
|
|
3
|
+
exports.extractLang = extractLang
|
|
4
|
+
|
|
5
|
+
function extractLang(translations, lang) {
|
|
6
|
+
var missing = []
|
|
7
|
+
, out = extract(translations, "")
|
|
8
|
+
if (missing[0]) {
|
|
9
|
+
console.error("WARNING! Missing '%s' translations: %s [%s]", lang, missing.length, missing+"")
|
|
10
|
+
}
|
|
11
|
+
return out
|
|
12
|
+
|
|
13
|
+
function extract(map, path) {
|
|
14
|
+
var key
|
|
15
|
+
, out = {}
|
|
16
|
+
, translations = map.translations
|
|
17
|
+
if (!translations) return map[lang]
|
|
18
|
+
for (key in translations) {
|
|
19
|
+
out[key] = extract(translations[key], path + key + ".")
|
|
20
|
+
if (
|
|
21
|
+
out[key] === key ||
|
|
22
|
+
out[key] === void 0 && missing.push(path + key) ||
|
|
23
|
+
isObject(out[key]) && Object.keys(out[key]).length < 1
|
|
24
|
+
) delete out[key]
|
|
25
|
+
}
|
|
26
|
+
return out
|
|
27
|
+
}
|
|
28
|
+
function isObject(obj) {
|
|
29
|
+
return obj && obj.constructor === Object
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}(this) // jshint ignore:line
|
|
33
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litejs/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.5.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,21 @@
|
|
|
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",
|
|
18
|
+
"bin",
|
|
19
19
|
"binding",
|
|
20
20
|
"css",
|
|
21
|
-
"el"
|
|
22
|
-
"shim"
|
|
21
|
+
"el"
|
|
23
22
|
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"lj-extract-lang": "./bin/extract-lang.js"
|
|
25
|
+
},
|
|
24
26
|
"scripts": {
|
|
25
|
-
"
|
|
26
|
-
"test": "lj test test/index.js --tz='Europe/Tallinn' --brief --sources=load.js,require.js,index.js"
|
|
27
|
+
"test": "lj t"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@litejs/cli": "
|
|
30
|
-
"@litejs/dom": "24.8.0"
|
|
30
|
+
"@litejs/cli": "25.5.0"
|
|
31
31
|
}
|
|
32
32
|
}
|