@litejs/ui 24.0.0-rc.2 → 24.0.0-rc.3
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/README.md +13 -21
- package/binding/_default.js +0 -30
- package/{svg.js → binding/svg.js} +1 -23
- package/binding/topfloat.js +1 -1
- package/css/base.css +7 -9
- package/css/form.css +79 -0
- package/css/form2.css +142 -0
- package/el/Pie.tpl +4 -4
- package/el/Slider.tpl +0 -1
- package/el/confirm.tpl +2 -2
- package/el/form1.tpl +1 -1
- package/index.js +477 -457
- package/load.js +66 -78
- package/package.json +3 -3
- package/polyfill/blob.js +5 -0
- package/polyfill/index.js +94 -48
- package/require.js +1 -1
- package/css/smooth-scroll.css +0 -8
- package/el/crop.view +0 -54
- package/framekiller.js +0 -9
- package/pointer.js +0 -173
- package/polyfill/crypto.js +0 -30
package/README.md
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
[LiteJS]: https://github.com/litejs/litejs
|
|
2
|
-
[UI]: https://github.com/litejs/ui
|
|
3
|
-
[CLI]: https://github.com/litejs/cli
|
|
4
|
-
[Quick-Start]: https://github.com/litejs/litejs/wiki/Quick-Start
|
|
5
|
-
|
|
6
1
|
[size]: https://packagephobia.now.sh/badge?p=@litejs/ui
|
|
7
2
|
[size-src]: https://packagephobia.now.sh/result?p=@litejs/ui
|
|
8
3
|
[wiki]: https://github.com/litejs/ui/wiki
|
|
4
|
+
[5]: https://badgen.net/badge/icon/Buy%20Me%20A%20Tea/orange?icon=kofi&label
|
|
5
|
+
[6]: https://www.buymeacoffee.com/lauriro
|
|
9
6
|
|
|
10
7
|
|
|
11
|
-
[
|
|
12
|
-
|
|
13
|
-
- **[litejs][LiteJS]** - Server and core libraries installed as `dependencies`
|
|
14
|
-
- **[@litejs/ui][UI]** - UI engine installed as `devDependencies` and bundled into your app
|
|
15
|
-
- **[@litejs/cli][CLI]** - Command line tool installed as global package (or as `devDependencies`)
|
|
16
|
-
|
|
17
|
-
> Build your first [LiteJS][] app with in 5 minute [Quick Start Guide][Quick-Start].
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
LiteJS UI – [![size][size]][size-src]
|
|
8
|
+
LiteJS UI – [![size][]][size-src] [![Buy Me A Tea][5]][6]
|
|
21
9
|
=========
|
|
22
10
|
|
|
23
|
-
UI
|
|
11
|
+
LiteJS UI is an old-school framework for making high-quality web UIs.
|
|
12
|
+
|
|
13
|
+
- Dependency-free, weighs around 20KB (+8KB polyfills if needed).
|
|
14
|
+
- Written in ES5, compatible with all browsers (including IE5.5).
|
|
15
|
+
- No transpiling/compiling/bundling headache, simply write a working code.
|
|
24
16
|
|
|
25
|
-
|
|
17
|
+
See [wiki][] for more information.
|
|
26
18
|
|
|
27
19
|
|
|
28
20
|
## External links
|
|
29
21
|
|
|
30
22
|
[GitHub repo](https://github.com/litejs/ui) |
|
|
31
|
-
[npm package](https://npmjs.org/package/@litejs/ui)
|
|
23
|
+
[npm package](https://npmjs.org/package/@litejs/ui) |
|
|
24
|
+
[Buy Me A Tea][6]
|
|
32
25
|
|
|
33
26
|
|
|
34
27
|
## Licence
|
|
35
28
|
|
|
36
|
-
Copyright (c)
|
|
37
|
-
[The MIT License](
|
|
38
|
-
|
|
29
|
+
Copyright (c) 2006-2023 Lauri Rooden <lauri@rooden.ee>
|
|
30
|
+
[The MIT License](https://litejs.com/MIT-LICENSE.txt)
|
|
39
31
|
|
package/binding/_default.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
var hasOwn = Object.prototype.hasOwnProperty
|
|
8
8
|
, slice = Array.prototype.slice
|
|
9
9
|
|
|
10
|
-
fixReadonlyCheckbox.once =
|
|
11
10
|
bindingEvery.once =
|
|
12
11
|
emitForm.once =
|
|
13
12
|
bindingFn.once =
|
|
@@ -81,40 +80,11 @@
|
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
bindings.fixReadonlyCheckbox = fixReadonlyCheckbox
|
|
85
|
-
function fixReadonlyCheckbox(el) {
|
|
86
|
-
El.on(el, "click pointerdown", function(e) {
|
|
87
|
-
if ((this.firstChild || this).readOnly) {
|
|
88
|
-
return Event.stop(e)
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
83
|
bindings.fn = bindingFn
|
|
94
84
|
function bindingFn(el, fn) {
|
|
95
85
|
return fn.apply(el, slice.call(arguments, 3))
|
|
96
86
|
}
|
|
97
87
|
|
|
98
|
-
bindings["if"] = bindingsIf
|
|
99
|
-
function bindingsIf(el, enabled) {
|
|
100
|
-
var parent = el.parentNode
|
|
101
|
-
, scope = this
|
|
102
|
-
if (enabled) {
|
|
103
|
-
if (!parent && el._ifComm) el._ifComm.parentNode.replaceChild(el, el._ifComm)
|
|
104
|
-
} else {
|
|
105
|
-
if (parent) {
|
|
106
|
-
if (!el._ifComm) {
|
|
107
|
-
El.on(el, "kill", El.kill.bind(el, el._ifComm = document.createComment("if")))
|
|
108
|
-
el._ifComm.render = function() {
|
|
109
|
-
El.render(el, scope)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
parent.replaceChild(el._ifComm, el)
|
|
113
|
-
}
|
|
114
|
-
return true
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
88
|
bindings.is = function bindingIs(node, model, path, list, state, prefix) {
|
|
119
89
|
var match
|
|
120
90
|
, scope = this
|
|
@@ -4,20 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
/* global El */
|
|
6
6
|
!function(SVGElement, document, bindings) {
|
|
7
|
-
var ns = "http://www.w3.org/2000/svg"
|
|
8
|
-
, xlinkNs = "http://www.w3.org/1999/xlink"
|
|
9
|
-
, svg = document.createElementNS && document.createElementNS(ns, "svg").createSVGRect
|
|
10
|
-
, proto = SVGElement && SVGElement.prototype // From IE9
|
|
11
|
-
|
|
12
|
-
if (!svg || !proto) {
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
;(
|
|
17
|
-
"svg defs pattern g symbol use clipPath textPath marker mask stop linearGradient radialGradient " +
|
|
18
|
-
"circle ellipse image line mesh path polygon polyline rect text tspan " +
|
|
19
|
-
"filter feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDropShadow feFlood eFuncA feFuncB feFuncG feFuncR eGaussianBlur feImage feMerge feMergeNode feMorphology feOffset feSpecularLighting feTile feTurbulence"
|
|
20
|
-
).replace(/\w+/g, populateSvgElements)
|
|
21
7
|
|
|
22
8
|
//http://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle
|
|
23
9
|
function polarToCartesian(centerX, centerY, radius, angle/*InDegrees*/) {
|
|
@@ -30,7 +16,7 @@
|
|
|
30
16
|
function describeArc(x, y, radius, startAngle, endAngle) {
|
|
31
17
|
var start = polarToCartesian(x, y, radius, endAngle)
|
|
32
18
|
, end = polarToCartesian(x, y, radius, startAngle)
|
|
33
|
-
, arcSweep = endAngle - startAngle <= 180 ?
|
|
19
|
+
, arcSweep = endAngle - startAngle <= 180 ? 0 : 1
|
|
34
20
|
, d = [
|
|
35
21
|
"M", start.x, start.y,
|
|
36
22
|
"A", radius, radius, 0, arcSweep, 0, end.x, end.y
|
|
@@ -48,11 +34,6 @@
|
|
|
48
34
|
3.6 * endAngle
|
|
49
35
|
))
|
|
50
36
|
}
|
|
51
|
-
bindings.xlink = function(el, href) {
|
|
52
|
-
// https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2
|
|
53
|
-
el.setAttributeNS(xlinkNs, "xlink:href", href)
|
|
54
|
-
}
|
|
55
|
-
bindings.xlink.once=1
|
|
56
37
|
|
|
57
38
|
function drawLine(node) {
|
|
58
39
|
var length = node.getTotalLength()
|
|
@@ -112,8 +93,5 @@
|
|
|
112
93
|
}
|
|
113
94
|
bindings.svgToLast.once =
|
|
114
95
|
bindings.initChart.once = 1
|
|
115
|
-
function populateSvgElements(name) {
|
|
116
|
-
El.cache[name] = document.createElementNS(ns, name)
|
|
117
|
-
}
|
|
118
96
|
}(this.SVGElement, document, El.bindings) // jshint ignore:line
|
|
119
97
|
|
package/binding/topfloat.js
CHANGED
package/css/base.css
CHANGED
|
@@ -159,17 +159,8 @@ button,
|
|
|
159
159
|
opacity: 0 !important;
|
|
160
160
|
filter: alpha(opacity=0) !important;
|
|
161
161
|
}
|
|
162
|
-
.max {
|
|
163
|
-
top: 0px;
|
|
164
|
-
left: 0px;
|
|
165
|
-
width: 100%;
|
|
166
|
-
height: 100%;
|
|
167
|
-
overflow: hidden;
|
|
168
|
-
}
|
|
169
162
|
.abs {
|
|
170
163
|
position: absolute;
|
|
171
|
-
top: 0px;
|
|
172
|
-
left: 0px;
|
|
173
164
|
}
|
|
174
165
|
.absr {
|
|
175
166
|
position: absolute;
|
|
@@ -184,6 +175,13 @@ button,
|
|
|
184
175
|
position: relative;
|
|
185
176
|
height: 100%;
|
|
186
177
|
}
|
|
178
|
+
.max {
|
|
179
|
+
top: 0px;
|
|
180
|
+
left: 0px;
|
|
181
|
+
width: 100%;
|
|
182
|
+
height: 100%;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
}
|
|
187
185
|
|
|
188
186
|
|
|
189
187
|
/* establishes a new block formatting context */
|
package/css/form.css
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
input[disabled],
|
|
3
|
+
input[readonly] {
|
|
4
|
+
color: #666;
|
|
5
|
+
font-style: italic;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
input, select, textarea {
|
|
9
|
+
color: #0F0D1B;
|
|
10
|
+
background: #c4c4c4;
|
|
11
|
+
}
|
|
12
|
+
body .btn:active, .btn:focus,
|
|
13
|
+
input:active, input:focus,
|
|
14
|
+
select:active, select:focus,
|
|
15
|
+
textarea:active, textarea:focus {
|
|
16
|
+
box-shadow:
|
|
17
|
+
0 2px 5px rgba(0, 0, 0, .5) inset,
|
|
18
|
+
0 0 3px 3px #029FE3;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
input.Toggle {
|
|
24
|
+
display: block;
|
|
25
|
+
position: relative;
|
|
26
|
+
-webkit-appearance: none;
|
|
27
|
+
-moz-appearance: none;
|
|
28
|
+
appearance: none;
|
|
29
|
+
width: 36px;
|
|
30
|
+
height: 14px;
|
|
31
|
+
margin: 4px 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
border-radius: 7px;
|
|
34
|
+
}
|
|
35
|
+
input.Toggle:after {
|
|
36
|
+
display: block;
|
|
37
|
+
position: relative;
|
|
38
|
+
content: "";
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
border-radius: 10px;
|
|
42
|
+
left: -3px;
|
|
43
|
+
top: -4px;
|
|
44
|
+
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
45
|
+
}
|
|
46
|
+
input.Toggle:checked:after {
|
|
47
|
+
left: 18px;
|
|
48
|
+
}
|
|
49
|
+
input.Toggle:active:after {
|
|
50
|
+
width: 30px;
|
|
51
|
+
}
|
|
52
|
+
input.Toggle:checked:active:after {
|
|
53
|
+
left: 8px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/* THEME */
|
|
58
|
+
|
|
59
|
+
input.Toggle:after {
|
|
60
|
+
background-color: #666;
|
|
61
|
+
box-shadow:
|
|
62
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
63
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
64
|
+
}
|
|
65
|
+
input.Toggle:focus:after {
|
|
66
|
+
box-shadow:
|
|
67
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
68
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
69
|
+
0 0 0 12px rgb(255, 255, 255, .2);
|
|
70
|
+
}
|
|
71
|
+
input.Toggle:checked:after {
|
|
72
|
+
background-color: #00a651;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
package/css/form2.css
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
:focus {
|
|
4
|
+
outline: 0;
|
|
5
|
+
box-shadow:
|
|
6
|
+
0 0 0 .2rem #fff,
|
|
7
|
+
0 0 0 .35rem #069;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Remove focus for non-keyboard navigation */
|
|
11
|
+
:focus:not(:focus-visible) {
|
|
12
|
+
box-shadow: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
fieldset {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
label {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
line-height: 32px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
input[type=checkbox].Toggle,
|
|
26
|
+
input[type=submit] {
|
|
27
|
+
-webkit-appearance: none;
|
|
28
|
+
-moz-appearance: none;
|
|
29
|
+
appearance: none;
|
|
30
|
+
position: relative;
|
|
31
|
+
text-align: center;
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
select[disabled],
|
|
36
|
+
input[disabled],
|
|
37
|
+
input[readonly] {
|
|
38
|
+
background: red;
|
|
39
|
+
color: #666;
|
|
40
|
+
font-style: italic;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input, select, textarea {
|
|
44
|
+
color: #0F0D1B;
|
|
45
|
+
background: #c4c4c4;
|
|
46
|
+
}
|
|
47
|
+
body .btn:active, .btn:focus,
|
|
48
|
+
input:active, input:focus,
|
|
49
|
+
select:active, select:focus,
|
|
50
|
+
textarea:active, textarea:focus {
|
|
51
|
+
box-shadow:
|
|
52
|
+
0 2px 5px rgba(0, 0, 0, .5) inset,
|
|
53
|
+
0 0 3px 3px #029FE3;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input {
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
margin: 1em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
input.Toggle {
|
|
63
|
+
-webkit-appearance: none;
|
|
64
|
+
-moz-appearance: none;
|
|
65
|
+
appearance: none;
|
|
66
|
+
position: relative;
|
|
67
|
+
padding: 0;
|
|
68
|
+
outline: 0;
|
|
69
|
+
width: 36px;
|
|
70
|
+
height: 14px;
|
|
71
|
+
margin: 4px 0;
|
|
72
|
+
border-radius: 7px;
|
|
73
|
+
}
|
|
74
|
+
input.Toggle:after {
|
|
75
|
+
position: relative;
|
|
76
|
+
width: 20px;
|
|
77
|
+
height: 20px;
|
|
78
|
+
border-radius: 10px;
|
|
79
|
+
}
|
|
80
|
+
input.Toggle:after {
|
|
81
|
+
content: "";
|
|
82
|
+
display: block;
|
|
83
|
+
background-color: #666;
|
|
84
|
+
left: -3px;
|
|
85
|
+
top: -4px;
|
|
86
|
+
transition: all .25s cubic-bezier(0, 0, .2, 1) 0s;
|
|
87
|
+
box-shadow:
|
|
88
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
89
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
90
|
+
}
|
|
91
|
+
input.Toggle:focus:after {
|
|
92
|
+
box-shadow:
|
|
93
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
94
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
95
|
+
0 0 0 12px rgb(255, 255, 255, .2);
|
|
96
|
+
}
|
|
97
|
+
input.Toggle:checked:after {
|
|
98
|
+
background-color: #00a651;
|
|
99
|
+
left: 17px;
|
|
100
|
+
}
|
|
101
|
+
input.Toggle:active:after {
|
|
102
|
+
width: 30px;
|
|
103
|
+
}
|
|
104
|
+
input.Toggle:checked:active:after {
|
|
105
|
+
left: 7px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
.group {
|
|
111
|
+
overflow: auto;
|
|
112
|
+
}
|
|
113
|
+
.group > .btn {
|
|
114
|
+
border-radius: 0;
|
|
115
|
+
float: left;
|
|
116
|
+
}
|
|
117
|
+
.group > .btn:first-child {
|
|
118
|
+
border-top-left-radius: 4px;
|
|
119
|
+
border-bottom-left-radius: 4px;
|
|
120
|
+
}
|
|
121
|
+
.group > .btn:last-child {
|
|
122
|
+
border-top-right-radius: 4px;
|
|
123
|
+
border-bottom-right-radius: 4px;
|
|
124
|
+
}
|
|
125
|
+
/* THEME */
|
|
126
|
+
|
|
127
|
+
input.Toggle:after {
|
|
128
|
+
background-color: #666;
|
|
129
|
+
box-shadow:
|
|
130
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
131
|
+
0 1px 5px rgba(0, 0, 0, 1);
|
|
132
|
+
}
|
|
133
|
+
input.Toggle:focus:after {
|
|
134
|
+
box-shadow:
|
|
135
|
+
2px 2px 8px rgba(255, 255, 255, .3) inset,
|
|
136
|
+
0 1px 5px rgba(0, 0, 0, 1),
|
|
137
|
+
0 0 0 12px rgb(0, 0, 0, .2);
|
|
138
|
+
}
|
|
139
|
+
input.Toggle:checked:after {
|
|
140
|
+
background-color: #00a651;
|
|
141
|
+
}
|
|
142
|
+
|
package/el/Pie.tpl
CHANGED
|
@@ -58,21 +58,21 @@
|
|
|
58
58
|
stroke-width: 1;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
%
|
|
61
|
+
%svg Pie
|
|
62
62
|
svg.Pie[viewBox="0 0 60 60"]
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
%
|
|
66
|
+
%svg Chart
|
|
67
67
|
svg.Chart[viewBox="0 0 600 300"][preserveAspectRatio="xMinYMid meet"]
|
|
68
68
|
;initChart
|
|
69
69
|
|
|
70
|
-
%
|
|
70
|
+
%svg Chart-line
|
|
71
71
|
g.Chart-line
|
|
72
72
|
;svgToLast
|
|
73
73
|
path ;svgLine: points, {radius: radius}
|
|
74
74
|
|
|
75
|
-
%
|
|
75
|
+
%svg Chart-axes
|
|
76
76
|
g.labels.x-labels
|
|
77
77
|
text[x="100"][y="400"] 2008
|
|
78
78
|
text[x="246"][y="400"] 2009
|
package/el/Slider.tpl
CHANGED
package/el/confirm.tpl
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
z-index: 9;
|
|
5
5
|
}
|
|
6
6
|
.Confirm-bg {
|
|
7
|
-
backdrop-filter: blur(5px);
|
|
8
7
|
background-color: rgba(0, 0, 0, .6);
|
|
9
8
|
}
|
|
10
9
|
.Confirm-content {
|
|
@@ -21,6 +20,7 @@
|
|
|
21
20
|
width: 94%;
|
|
22
21
|
}
|
|
23
22
|
.Confirm--blur {
|
|
23
|
+
filter: blur(5px);
|
|
24
24
|
transform: scale(.85);
|
|
25
25
|
transform-origin: 50% 100vh;
|
|
26
26
|
}
|
|
@@ -169,6 +169,6 @@
|
|
|
169
169
|
;txt:: _(action.title)
|
|
170
170
|
;class:: "w" + (12/actions.length)
|
|
171
171
|
;nop: this.focus()
|
|
172
|
-
;
|
|
172
|
+
;attr: "data-action", action.action
|
|
173
173
|
;class:: "is-" + action.action, action.action
|
|
174
174
|
|