@litejs/ui 24.5.0 → 24.7.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/README.md +12 -8
- package/el/crop.ui +4 -3
- package/el/dialog.ui +12 -29
- package/load.js +5 -4
- package/package.json +4 -4
- package/{shim/index.js → shim.js} +30 -30
- package/{index.js → ui.js} +273 -288
- package/binding/sticky.js +0 -15
- package/binding/topfloat.js +0 -36
package/README.md
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
|
|
2
|
-
[3]: https://
|
|
2
|
+
[3]: https://packagephobia.now.sh/badge?p=@litejs/ui
|
|
3
3
|
[4]: https://packagephobia.now.sh/result?p=@litejs/ui
|
|
4
4
|
[5]: https://badgen.net/badge/icon/Buy%20Me%20A%20Tea/orange?icon=kofi&label
|
|
5
5
|
[6]: https://www.buymeacoffee.com/lauriro
|
|
6
|
-
[wiki]: https://github.com/litejs/ui/wiki
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
LiteJS UI – [![Size][3]][4] [![Buy Me A Tea][5]][6]
|
|
10
9
|
=========
|
|
11
10
|
|
|
12
|
-
LiteJS UI is an old-school framework for
|
|
11
|
+
LiteJS UI is an old-school framework for high-quality web UIs,
|
|
12
|
+
used on heavy-traffic websites since 2006.
|
|
13
13
|
|
|
14
|
-
- Dependency-free, weighs around 20KB (+8KB polyfills
|
|
14
|
+
- Dependency-free, weighs around 20KB (+8KB polyfills for ancient browsers).
|
|
15
15
|
- Written in ES5, compatible with all browsers (including IE5.5).
|
|
16
|
-
- No transpiling/compiling/bundling headache,
|
|
16
|
+
- No transpiling/compiling/bundling headache, just write a working code.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
For usage instructions, see [wiki](https://github.com/litejs/ui/wiki)
|
|
19
|
+
and [Quick-Start](https://github.com/litejs/litejs/wiki/Quick-Start) guide.
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
##
|
|
22
|
+
## Contributing
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
Follow [Coding Style Guide](https://github.com/litejs/litejs/wiki/Style-Guide),
|
|
25
|
+
run tests `npm install; npm test`.
|
|
26
|
+
|
|
27
|
+
> Copyright (c) 2006-2024 Lauri Rooden <lauri@rooden.ee>
|
|
24
28
|
[MIT License](https://litejs.com/MIT-LICENSE.txt) |
|
|
25
29
|
[GitHub repo](https://github.com/litejs/ui) |
|
|
26
30
|
[npm package](https://npmjs.org/package/@litejs/ui) |
|
package/el/crop.ui
CHANGED
|
@@ -26,14 +26,15 @@
|
|
|
26
26
|
|
|
27
27
|
%el Crop
|
|
28
28
|
.Crop
|
|
29
|
-
@pan function(e){
|
|
29
|
+
@pan function(e, touchEv, touchEl) {
|
|
30
|
+
El.css(touchEl, "top,left", [touchEv.topPos + "px", touchEv.leftPos + "px"],"img")
|
|
31
|
+
return El.stop(e)
|
|
32
|
+
}
|
|
30
33
|
@pinch function(zoom){
|
|
31
34
|
var imgWidth = $el.offsetWidth
|
|
32
35
|
scale(0,0)
|
|
33
|
-
El.on($el, "wheel", scale)
|
|
34
36
|
return scale
|
|
35
37
|
function scale(e, delta) {
|
|
36
|
-
console.log("pinch", arguments)
|
|
37
38
|
zoom += delta / 5
|
|
38
39
|
if (zoom < .5) zoom = .5
|
|
39
40
|
else if (zoom > 50) zoom = 50
|
package/el/dialog.ui
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
var sound, vibrate
|
|
69
69
|
, code = ""
|
|
70
|
-
, el = El("
|
|
70
|
+
, el = El("Dialog")
|
|
71
71
|
, scope = Object.assign(El.scope(el, el), opts)
|
|
72
72
|
, kbMap = {}
|
|
73
73
|
, body = document.body
|
|
@@ -81,9 +81,10 @@
|
|
|
81
81
|
if (a.key) kbMap[a.key] = resolve.bind(el, el, a.action)
|
|
82
82
|
}
|
|
83
83
|
El.cls(blurEl, "Modal--blur")
|
|
84
|
-
El
|
|
85
|
-
El.append(
|
|
86
|
-
El.
|
|
84
|
+
var mm = El("Modal")
|
|
85
|
+
El.append(mm, el)
|
|
86
|
+
El.append(body, mm)
|
|
87
|
+
El.render(mm)
|
|
87
88
|
if (scope.code) {
|
|
88
89
|
$$(".js-numpad", el).on("click", numpad)
|
|
89
90
|
kbMap.backspace = kbMap.del = kbMap.num = numpad
|
|
@@ -119,7 +120,7 @@
|
|
|
119
120
|
inputMd: El.val($(".js-inputMd", el)),
|
|
120
121
|
select: El.val($(".js-select", el))
|
|
121
122
|
}
|
|
122
|
-
El.kill(
|
|
123
|
+
El.kill(mm, "transparent")
|
|
123
124
|
El.cls(blurEl, "Modal--blur", el = false)
|
|
124
125
|
if (action && next) {
|
|
125
126
|
if (typeof next === "function") next(action, result)
|
|
@@ -147,7 +148,7 @@
|
|
|
147
148
|
})
|
|
148
149
|
|
|
149
150
|
%el Dialog
|
|
150
|
-
.Dialog.grid.p2.anim
|
|
151
|
+
.Dialog.grid.p2.anim
|
|
151
152
|
.col.ts3 ;txt!_(title, map)
|
|
152
153
|
.col.js-body ;md!_(body, map)
|
|
153
154
|
.col
|
|
@@ -160,27 +161,9 @@
|
|
|
160
161
|
;class!"is-" + action.action, action.action
|
|
161
162
|
|
|
162
163
|
%el Modal
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.col>input.field.js-input
|
|
169
|
-
.row
|
|
170
|
-
;if: $d.inputMd!=null
|
|
171
|
-
.col
|
|
172
|
-
textarea.field.js-inputMd
|
|
173
|
-
@keyup [this.parentNode.nextSibling.nextSibling], "renderMd"
|
|
174
|
-
;val: inputMd
|
|
175
|
-
.col.ts3 Preview
|
|
176
|
-
.p4
|
|
177
|
-
;md: inputMd
|
|
178
|
-
.row
|
|
179
|
-
;if: select
|
|
180
|
-
.col
|
|
181
|
-
select.field.js-select
|
|
182
|
-
;list: select, [""]
|
|
183
|
-
option
|
|
184
|
-
;val:: item.id
|
|
185
|
-
;txt:: _(item.name)
|
|
164
|
+
.Modal.max.fix.anim
|
|
165
|
+
.Modal-bg.max.abs
|
|
166
|
+
.Modal-content.Modal--blur.grid.p2.anim
|
|
167
|
+
;cls!"Modal--blur",!1,1
|
|
168
|
+
%slot
|
|
186
169
|
|
package/load.js
CHANGED
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
//!{loadRewrite}
|
|
25
25
|
}
|
|
26
26
|
// Move setTimeout from window.prototype to window object for future patching in IE9.
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
, setTimeout_ = window.setTimeout = setTimeout
|
|
28
|
+
/*** debug ***/
|
|
29
|
+
// Expose xhr._c for tests.
|
|
29
30
|
, loaded = xhr._c = {}
|
|
30
31
|
/*/
|
|
31
32
|
, loaded = {}
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
/*/
|
|
49
50
|
eval
|
|
50
51
|
/**/
|
|
52
|
+
, nop = Function()
|
|
51
53
|
|
|
52
54
|
/*** reuse ***/
|
|
53
55
|
// XHR memory leak mitigation
|
|
@@ -205,7 +207,7 @@
|
|
|
205
207
|
files[pos] = 0
|
|
206
208
|
} else {
|
|
207
209
|
try {
|
|
208
|
-
var execResult = (xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos])
|
|
210
|
+
var execResult = (xhr[files[pos].replace(/[^?]+\.|\?.*/g, "")] || execScript)(res[pos], files[pos])
|
|
209
211
|
if (execResult && execResult.then) {
|
|
210
212
|
res[pos] = 0
|
|
211
213
|
return execResult.then(function() {
|
|
@@ -240,6 +242,5 @@
|
|
|
240
242
|
])
|
|
241
243
|
/**/
|
|
242
244
|
|
|
243
|
-
function nop() {}
|
|
244
245
|
}(this, Function) // jshint ignore:line
|
|
245
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litejs/ui",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.7.0",
|
|
4
4
|
"description": "UI engine for LiteJS full-stack framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lauri Rooden <lauri@rooden.ee>",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"homepage": "https://litejs.com",
|
|
14
14
|
"repository": "github:litejs/ui",
|
|
15
15
|
"bugs": "https://github.com/litejs/dev/issues",
|
|
16
|
-
"main": "
|
|
16
|
+
"main": "ui.js",
|
|
17
17
|
"files": [
|
|
18
18
|
"*.js",
|
|
19
19
|
"binding",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "lj test test/index.js --tz='Europe/Tallinn' --brief --sources=load.js,require.js,index.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@litejs/cli": "24.
|
|
30
|
-
"@litejs/dom": "
|
|
29
|
+
"@litejs/cli": "24.6.2",
|
|
30
|
+
"@litejs/dom": "24.7.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -38,8 +38,6 @@
|
|
|
38
38
|
, navigator = patch("navigator")
|
|
39
39
|
/*/
|
|
40
40
|
, document = window.document
|
|
41
|
-
, location = window.location
|
|
42
|
-
, navigator = window.navigator
|
|
43
41
|
, IS_NODE = false
|
|
44
42
|
/**/
|
|
45
43
|
, html = document.documentElement
|
|
@@ -68,6 +66,7 @@
|
|
|
68
66
|
"DOMMouseScroll" // older Firefox
|
|
69
67
|
)
|
|
70
68
|
, fixEv = Event.fixEv = {
|
|
69
|
+
pagehide: "onpagehide" in window ? UNDEF : "beforeunload",
|
|
71
70
|
wheel: wheelEv
|
|
72
71
|
}
|
|
73
72
|
, fixFn = Event.fixFn = {
|
|
@@ -121,8 +120,7 @@
|
|
|
121
120
|
if (!IS_NODE && !(onhashchange in window) || ie67) {
|
|
122
121
|
patch(onhashchange, null)
|
|
123
122
|
setInterval(function() {
|
|
124
|
-
|
|
125
|
-
if (lastHash !== cur && isFn(window[onhashchange])) {
|
|
123
|
+
if (lastHash !== (lastHash = location.href.split("#")[1]) && isFn(window[onhashchange])) {
|
|
126
124
|
window[onhashchange]()
|
|
127
125
|
}
|
|
128
126
|
}, 60)
|
|
@@ -202,33 +200,33 @@
|
|
|
202
200
|
try {
|
|
203
201
|
// FF4-beta with dom.storage.enabled=false throws for accessing windows.localStorage
|
|
204
202
|
// iOS5 private browsing throws for localStorage.setItem()
|
|
205
|
-
|
|
203
|
+
window[name += "Storage"].setItem(name, name)
|
|
204
|
+
return window[name].removeItem(name)
|
|
206
205
|
} catch(e){}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
/**/
|
|
206
|
+
|
|
207
|
+
// # IE5 128KB per document
|
|
208
|
+
//
|
|
209
|
+
// The `saveHistory` behavior persists data only for the current session,
|
|
210
|
+
// using one in-memory UserData store for the entire document.
|
|
211
|
+
// If two elements write the same attribute, the first is overwritten.
|
|
212
|
+
//
|
|
213
|
+
// The `userData` behavior persists data across sessions,
|
|
214
|
+
// using one UserData store for each object, saved in the cache.
|
|
215
|
+
// Saved UserData can be reloaded even if the document has been closed and reopened.
|
|
216
|
+
//
|
|
217
|
+
// An ID is required for userData and saveSnapshot behaviors
|
|
218
|
+
// and recommended for saveHistory and saveFavorite behaviors.
|
|
219
|
+
//
|
|
220
|
+
// https://msdn.microsoft.com/en-us/library/ms531348(v=vs.85).aspx
|
|
221
|
+
// if (el.addBehavior) {
|
|
222
|
+
// el.style.behavior = surviveReboot ? "url('#default#userData')" : "url('#default#saveHistory')"
|
|
223
|
+
// el.addBehavior("#default#" + (surviveReboot ? "userData" : "saveHistory"))
|
|
224
|
+
// if (surviveReboot) el.load("persist")
|
|
225
|
+
// value = el.getAttribute(key)
|
|
226
|
+
// save = function() {
|
|
227
|
+
// el.setAttribute(key, El.val(el))
|
|
228
|
+
// if (surviveReboot) el.save("persist")
|
|
229
|
+
// }
|
|
232
230
|
var data = {
|
|
233
231
|
setItem: function(id, val) {
|
|
234
232
|
return (data[id] = "" + val)
|
|
@@ -252,6 +250,8 @@
|
|
|
252
250
|
// IE8 has console, however, the console object does not exist if the console is not opened.
|
|
253
251
|
patch("console", {log: nop, error: nop})
|
|
254
252
|
|
|
253
|
+
patch("getComputedStyle", "return a.currentStyle")
|
|
254
|
+
|
|
255
255
|
/*** ie9 ***/
|
|
256
256
|
patch("matchMedia", "b=a||'all';return{media:b,matches:X?X.matchMedium(b):!1,addListener:Y}", 0, window.styleMedia || window.media, nop)
|
|
257
257
|
/**/
|