New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@litejs/ui

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@litejs/ui - npm Package Compare versions

Comparing version 24.7.0 to 24.11.0

35

load.js

@@ -22,4 +22,4 @@

!function(window, Function) {
xhr._s = new Date()
var rewrite = {
var initTime = xhr._t = +new Date()
, rewrite = {
//!{loadRewrite}

@@ -30,3 +30,3 @@ }

/*** debug ***/
// Expose xhr._c for tests.
// Expose xhr._c for testing.
, loaded = xhr._c = {}

@@ -61,5 +61,5 @@ /*/

, unsentLog = xhr._l = []
/*** onerror ***/
, lastError
, unsentErrors = xhr._e = []
, onerror = window.onerror = function(message, file, line, col, error) {

@@ -71,21 +71,7 @@ // Do not send multiple copies of the same error.

, line
, col || (window.event || unsentErrors).errorCharacter || "?"
, col || (window.event || unsentLog).errorCharacter || "?"
, message
].join(":")
) && 2 > unsentErrors.push(
[ +new Date()
, lastError
, error && (error.stack || error.stacktrace) || "-"
, "" + location
]
)) setTimeout_(sendErrors, 307)
)) log("e", lastError, (error && (error.stack || error.stacktrace) || "-") + "\n" + location)
}
function sendErrors() {
if (xhr.err) {
xhr.err(unsentErrors)
} else {
setTimeout_(sendErrors, 1307)
}
}
/*/

@@ -95,2 +81,11 @@ , onerror = nop

xhr.log = log
function log(type, msg, extra) {
if (unsentLog.push([ new Date() - initTime, type, msg, extra ]) < 2) sendLog()
}
function sendLog() {
setTimeout_(xhr.sendLog || sendLog, 1307)
}
// next === true is for sync call

@@ -97,0 +92,0 @@

{
"name": "@litejs/ui",
"version": "24.7.0",
"version": "24.11.0",
"description": "UI engine for LiteJS full-stack framework",

@@ -29,5 +29,5 @@ "license": "MIT",

"devDependencies": {
"@litejs/cli": "24.6.2",
"@litejs/dom": "24.7.0"
"@litejs/cli": "24.10.0",
"@litejs/dom": "24.8.0"
}
}

@@ -14,8 +14,8 @@

- Dependency-free, weighs around 20KB (+8KB polyfills for ancient browsers).
- Dependency-free, weighs around 25kB (+8kB polyfills for old browsers).
- Written in ES5, compatible with all browsers (including IE5.5).
- No transpiling/compiling/bundling headache, just write a working code.
For usage instructions, see [wiki](https://github.com/litejs/ui/wiki)
and [Quick-Start](https://github.com/litejs/litejs/wiki/Quick-Start) guide.
For usage instructions, see [Quick-Start](https://github.com/litejs/litejs/wiki/Quick-Start) guide
and [wiki](https://github.com/litejs/ui/wiki).

@@ -22,0 +22,0 @@

@@ -380,2 +380,3 @@

patch("filter", b + "o.push(t[i])" + c)
patch("find", b + "return t[i]")
patch("some", b + "return!0;return!1")

@@ -382,0 +383,0 @@

/* litejs.com/MIT-LICENSE.txt */
/* global xhr, navigator */
/* global escape, navigator, xhr */

@@ -15,2 +15,3 @@ /*** debug ***/

var UNDEF, lastExp, parser, pushBase, styleNode
, NUL = null
, html = document.documentElement

@@ -20,9 +21,13 @@ , body = document.body

, emptyArr = []
, plugins = {}
, sources = []
, assign = Object.assign
, bind = El.bind.bind(El.call)
, create = Object.create
, hasOwn = bind(plugins.hasOwnProperty)
, isArr = Array.isArray
, slice = emptyArr.slice
, elReplace = Function("a,b,c", "(c=a&&b&&a.parentNode)&&c.replaceChild(b,a)")
, elRm = Function("e,k", "(k=e&&e.parentNode)&&k.removeChild(e)")
, getAttr = Function("e,k", "return e&&e.getAttribute&&e.getAttribute(k)")
, elReplace = Function("a,b,c", "a&&b&&(c=a.parentNode)&&c.replaceChild(b,a)")
, elRm = Function("a,b", "a&&(b=a.parentNode)&&b.removeChild(a)")
, getAttr = Function("a,b", "return a&&a.getAttribute&&a.getAttribute(b)")
, replace = Function("a,b,c", "return a.replace(b,c)")

@@ -37,4 +42,4 @@

, elCache = {}
, formatRe = /{((?:("|')(?:\\\2|[\s\S])*?\2|[^"'{}])+?)}/g
, renderRe = /[;\s]*([-\w$]+)(?:([ :!])((?:(["'\/])(?:\\.|[^\\])*?\4|[^;])*))?/g
, formatRe = /{((?:("|')(?:\\.|[^\\])*?\2|.)+?)}/g
, renderRe = /[;\s]*([-.\w$]+)(?:([ :!])((?:(["'\/])(?:\\.|[^\\])*?\4|[^;])*))?/g
, selectorRe = /([.#:[])([-\w]+)(?:([~^$*|]?)=(("|')(?:\\.|[^\\])*?\5|[-\w]+))?]?/g

@@ -48,3 +53,3 @@ , templateRe = /([ \t]*)(%?)((?:("|')(?:\\.|[^\\])*?\4|[-\w:.#[\]~^$*|]=?)*) ?([\/>+=@^;]|)(([\])}]?).*?([[({]?))(?=\x1f|\n|$)+/g

// Safari 2.x innerText results an empty string when style.display=="none" or Node is not in DOM
, txtAttr = "textContent" in html ? "textContent" : "innerText"
, txtAttr = "textContent" in html ? "textContent" /* c8 ignore next */ : "innerText"
, bindingsCss = acceptMany(function(el, key, val) {

@@ -56,3 +61,3 @@ el.style[replace(key, camelRe, camelFn)] = val

var target = selector ? closest(e.target, selector) : el
if (target) emit.apply(elScope(el).$ui, [val, e, target].concat(data))
if (target) emit.apply(target, [elScope(el).$ui, val, e, target].concat(data))
} :

@@ -77,4 +82,2 @@ selector ? function(e, a1, a2) {

El: El,
_: format,
_f: format,
$b: bindings

@@ -98,5 +101,2 @@ }

}
, plugins = {}
, sources = []
, hasOwn = plugins.hasOwnProperty

@@ -107,2 +107,51 @@ , Event = window.Event || window

/*** markup ***/
, blockRe = /^(?:(=+|>| -) ([\s\S]+)|\[! *(\S*) *!] ?(.*))/
, tags = {
" -": "ul",
"!": "a",
"*": "b",
"+": "ins",
",": "sub",
"-": "del",
"/": "i",
":": "mark",
";": "span",
">": "blockquote",
"@": "time",
"^": "sup",
"_": "u",
"`": "code",
"~": "s"
}
function inline(tag, op, text, name, link, attr) {
return op && !isArr(text) ? "<" +
(tag = tags[op] || "h" + op.length) +
(tag == "a" ? " href=\"" + (link || text) + "\"" : op == "@" ? " datetime=\"" + name + "\"" : "") +
(attr ? " class=\"" + attr.slice(1) + "\">" : ">") +
(
op === ">" ? doc(replace(text, /^> ?/gm, "")) :
tag == "ul" ? "<li>" + text.split(/\n - (?=\S)/).map(inline).join("</li>\n<li>") + "</li>" :
inline(tag == "a" ? replace(name, /^\w+:\/{0,2}/, "") : text)
) +
"</" + tag + ">" :
replace(tag, /\[([-!*+,/:;@^_`~])((.+?)(?: (\S+?))?)\1(\.[.\w]+)?]/g, inline)
}
function block(tag, op, text, media, alt) {
return op && !isArr(text) ? inline(tag, op, text) :
media ? "<img src=\"" + media + "\" alt=\"" + alt + "\">" :
blockRe.test(tag) ? replace(tag, blockRe, block) :
tag === "---" ? "<hr>" : "<p>" + inline(tag) + "</p>"
}
function doc(txt) {
return replace(txt.trim(), /^ \b/gm, "<br>").split(/\n\n+/).map(block).join("\n")
}
bindings.t = function(el, text) {
el.innerHTML = inline(replace(text, /</g, "&lt;"))
}
bindings.d = function(el, text) {
el.innerHTML = doc(replace(text, /</g, "&lt;"))
}
/**/
/*** svg ***/

@@ -121,7 +170,6 @@ bindings.xlink = function(el, href) {

Event.asEmitter = asEmitter
Event.stop = eventStop
xhr.css = injectCss
xhr.ui = sources.push.bind(sources)
xhr.ui = function(src) {
sources.push(src)
}

@@ -132,4 +180,9 @@ function asEmitter(obj) {

obj.one = one
obj.emit = emit
obj.emit = wrap(emit)
// emitNext, emitLate
function wrap(fn) {
return function(a, b, c, d, e) {
return fn(this, a, b, c, d, e)
}
}
}

@@ -139,6 +192,5 @@

var emitter = this === window ? emptyArr : this
, events = emitter._e || (emitter._e = create(null))
, events = emitter._e || (emitter._e = create(NUL))
if (type && fn) {
if (isStr(fn)) fn = emit.bind(emitter, fn)
emit.call(emitter, "newListener", type, fn, scope, _origin)
emit(emitter, "newListener", type, fn, scope, _origin)
;(events[type] || (events[type] = [])).unshift(scope, _origin, fn)

@@ -157,3 +209,3 @@ }

args = events.splice(i - 1, 3)
emit.call(emitter, "removeListener", type, args[2], args[0], args[1])
emit(emitter, "removeListener", type, args[2], args[0], args[1])
if (fn) break

@@ -177,9 +229,9 @@ }

function emit(type) {
function emit(emitter, type) {
if (emitter === window) emitter = emptyArr
var args, i
, emitter = this === window ? emptyArr : this
, _e = emitter._e
, arr = _e ? (_e[type] || emptyArr).concat(_e["*"] || emptyArr) : emptyArr
if ((_e = arr.length)) {
for (i = _e - 1, args = slice.call(arguments, 1); i > 1; i -= 3) {
for (i = _e - 1, args = slice.call(arguments, 2); i > 1; i -= 3) {
if (arr[i]) arr[i].apply(arr[i - 2] || emitter, args)

@@ -230,3 +282,2 @@ }

opts = assign({
path: "",
/*** breakpoints ***/

@@ -272,41 +323,2 @@ breakpoints: {

asEmitter(View.prototype = {
show: function(_params) {
var parent
, params = lastParams = _params || {} // jshint ignore:line
, view = lastView = this // jshint ignore:line
, tmp = params._v || view // Continue bubbleUp from _v
params._c = view.o ? view : params._c
for (View.route = view.r; tmp; tmp = parent) {
viewEmit(syncResume = params._v = tmp, "ping", params, View)
syncResume = UNDEF
if (lastParams !== params) return
if ((parent = tmp.p)) {
if (parent.c && parent.c !== tmp) {
params._c = parent.c
}
parent.c = tmp
}
if (tmp.f) {
return xhr.load(
replace(tmp.f, /^|,/g, "$&" + View.path).split(","),
readTemplates.bind(view, view.wait(tmp.f = ""))
)
} else if (!tmp.e) {
if (tmp.r === "404") {
viewParse("%view 404 #\nh2 Not found")
}
return View("404").show({origin:params})
}
}
for (tmp in params) {
if (tmp.charAt(0) !== "_" && (syncResume = hasOwn.call(paramCb, tmp) && paramCb[tmp] || paramCb["*"])) {
syncResume(params[tmp], tmp, view, params)
syncResume = UNDEF
}
}
viewEmit(view, "nav")
bubbleDown(params)
},
wait: function() {

@@ -320,3 +332,3 @@ var params = lastParams

} else if (params._v) {
lastView.show(params)
viewPing(lastView, params)
}

@@ -327,4 +339,3 @@ }

var root = opts.root
, viewFn, lastView, lastUrl, syncResume
var viewFn, lastView, lastUrl, syncResume
, fnStr = ""

@@ -339,7 +350,8 @@ , reStr = ""

, lastParams = paramCb
, $d = elScope(View("#", root).e, root)
, root = View("#", opts.root).e
, $d = elScope(root, root)
$d.$ui = assign(View, {
$: find.bind(View, root),
$$: findAll.bind(View, root),
$: bind(find, View, root),
$$: bind(findAll, View, root),
$d: $d,

@@ -370,10 +382,2 @@ def: viewDef,

function appendBind(el, val, sep, q) {
var current = getAttr(el, BIND_ATTR)
setAttr(el, BIND_ATTR, (current ? (
q === "^" ?
val + sep + current :
current + sep + val
) : val))
}
function bubbleDown(params) {

@@ -426,5 +430,5 @@ var view = params._v

function viewEmit(view, event, a, b) {
view.emit(event, a, b)
View.emit(event, view, a, b)
LiteJS.emit(event, view, a, b)
emit(view, event, a, b)
emit(View, event, view, a, b)
emit(LiteJS, event, view, a, b)
}

@@ -435,3 +439,3 @@ function viewEval(str, scope) {

} catch(e) {
logErr(e, "viewEval: " + str)
throw e + "\nviewEval: " + str
}

@@ -492,3 +496,3 @@ }

if (op === "") {
text = "txt _('" + replace(text, /'/g, "\\'") + "',$s)"
text = "txt _(" + quote(text) + ",$s)"
}

@@ -513,3 +517,41 @@ appendBind(parent, text, ";", op)

}
function viewShow(url, _params) {
function viewPing(view, params) {
var parent
, tmp = params._v || view // Continue bubbleUp from _v
lastParams = params
lastView = view
params._c = view.o ? view : params._c
for (View.route = view.r; tmp; tmp = parent) {
viewEmit(syncResume = params._v = tmp, "ping", params, View)
syncResume = UNDEF
if (lastParams !== params) return
if ((parent = tmp.p)) {
if (parent.c && parent.c !== tmp) {
params._c = parent.c
}
parent.c = tmp
}
if (tmp.f) {
return xhr.load(
replace(tmp.f, /^|,/g, "$&" + (View.path || "")).split(","),
bind(readTemplates, view, view.wait(tmp.f = ""))
)
} else if (!tmp.e) {
if (tmp.r === "404") {
viewParse("%view 404 #\nh2 Not found")
}
return viewShow("404")
}
}
for (tmp in params) {
if (tmp.charAt(0) !== "_" && (syncResume = hasOwn(paramCb, tmp) && paramCb[tmp] || paramCb["*"])) {
syncResume(params[tmp], tmp, view, params)
syncResume = UNDEF
}
}
viewEmit(view, "nav")
bubbleDown(params)
}
function viewShow(url) {
if (url === true) {

@@ -520,7 +562,7 @@ if (lastParams._p > 0) return

}
var params = _params || {}
var params = $d.params = { _t: Date.now() }
, view = viewGet(url, params)
if (!view.o || lastUrl !== url) {
$d.url = lastExp = lastUrl = url
view.show($d.params = params)
viewPing(view, params)
}

@@ -550,3 +592,3 @@ }

}
if (proto.r) proto.d = Function("p", "p.r(p.o||p.t)")
if (proto.r) proto.d = Function("p", "p.r(p.o+p.t)")
assign(Plugin.prototype, proto)

@@ -590,5 +632,5 @@ }

addPlugin("each", {
r: function(params) {
r: function() {
var txt = this.t
each(params, function(param) {
each(this.o, function(param) {
viewParse(replace(txt, /{key}/g, param))

@@ -600,7 +642,5 @@ })

c: 1,
d: function(plugin) {
var parent = plugin.u
, el = usePluginContent(plugin)
d: function(plugin, el) {
el = usePluginContent(plugin)
elCache[plugin.n] = el
return parent
}

@@ -610,5 +650,4 @@ })

addPlugin("map", {
r: function() {
r: function(txt) {
var plugin = this
, txt = plugin.o + plugin.t
appendBind(plugin.u, plugin.s ? txt.slice(1) : txt, plugin.s)

@@ -620,9 +659,8 @@ }

d: function(plugin) {
var bind = getAttr(plugin.e, BIND_ATTR)
var expr = getAttr(plugin.e, BIND_ATTR)
, view = View(plugin.n, usePluginContent(plugin), plugin.x)
if (bind) {
bind = replace(bind, renderRe, function(_, name, op, args) {
if (expr) {
viewEval(replace(expr, renderRe, function(_, name, op, args) {
return "($s." + name + (isFn(view[name]) ? "(" + (args || "") + ")" : "=" + args) + "),"
}) + "1"
viewEval(bind, view)
}) + "1", view)
}

@@ -657,3 +695,3 @@ }

View.emit("resize")
emit(View, "resize")
}, 99)

@@ -668,22 +706,240 @@

/*** i18n ***/
var iData = {}
, iFormat = create(null)
, iGlobals = assignDeep(create(null), opts.locales)
each(iGlobals, function(translations, iKey) {
translations = iData[iKey] = assignDeep(create(iGlobals), opts[iKey])
iFormat[iKey] = function(str, data) {
return format(get(translations, str, str || ""), data)
globalScope._ = format
var iFormat = create(NUL)
each(opts.locales || { en: "en" }, function(translations, lang, locales) {
translations = formatGet.t = assignDeep(assignDeep(create(opts.globals || NUL), locales), opts[lang])
formatGet.g = getExt
iFormat[lang] = formatGet
var iAlias = {
"#": "num", "num": "#",
"*": "plural", "plural": "*",
"?": "pick", "pick": "?",
"@": "date", "date": "@",
"~": "pattern", "pattern": "~"
}
, cache = create(NUL)
, dateRe = /([Md])\1\1\1?|([YMDdHhmswSZ])(\2?)|[uUaSoQ]|'((?:''|[^'])*)'|(["\\\n\r\u2028\u2029])/g
, date1 = new Date()
, date2 = new Date()
, iExt = formatGet.ext = {
date: function(input, _mask, _zone) {
var undef
, offset = 4294967295
, d = input * (input > offset || input < -offset ? 1 : 1000) || Date.parse(input)
, t = translations["@"] || {}
, mask = t[_mask] || _mask || "UTC:Y-MM-DD'T'HH:mm:ss'Z'"
, zone = _zone != undef ? _zone : Date._tz != undef ? Date._tz : undef
, utc = mask.slice(0, 4) == "UTC:"
if (zone != undef && !utc) {
offset = 60 * zone
date1.setTime(d + offset * 6e4)
utc = mask = "UTC:" + mask
} else {
date1.setTime(d)
offset = utc ? 0 : -date1.getTimezoneOffset()
}
return isNaN(d) ? "" + date1 : (
cache[mask] || (cache[mask] = Function("d,a,o,l", "var t;return \"" + dateStr(mask, utc) + "\"")))(
date1,
date2,
offset,
t
)
},
lo: function(str) {
return isStr(str) ? str.toLowerCase() : ""
},
map: function(input, str, sep, lastSep) {
var arr = []
each(input, function(val) {
arr.push(formatGet(str, val))
})
lastSep = lastSep && arr.length > 1 ? lastSep + arr.pop() : ""
return arr.join(sep || ", ") + lastSep
},
num: function(input, format) {
var t = translations["#"] || {}
return (
cache[format = t[format] || "#" + format] || (cache[format] = Function("d", "var N=d<0&&(d=-d),n,r,o;return " + numStr(format, t)))
)(input)
},
pattern: function(str, re) {
var values = []
, t = translations["~"] || {}
, key = replace(str, RegExp(re || t[""] || "[\\d.]+", "g"), function(a) {
values.push(a)
return "#"
})
return str != key && t[key] ? replace(t[key], /#/g, bind(values.shift, values)) : str
},
pick: function(val, word) {
for (var t = translations["?"] || {}, arr = replace((t[word] || word), /([^;=,]+?)\?/g, "$1=$1;").split(/[;=,]/), i = 1|arr.length; i > 0; ) {
if ((i-=2) < 0 || arr[i] && (arr[i] == "" + val || +arr[i] <= val)) {
return arr[i + 1] ? replace(arr[i + 1], "#", val) : ""
}
}
},
plural: function(n, word, expr) {
var t = translations["*"] || {}
return (
cache[expr = t[""] || "n!=1"] || (cache[expr] = Function("a,n", "return (a[+(" + expr + ")]||a[0]).replace('#',n)"))
)((t[word] || "# " + word).split(";"), n)
},
up: function(str) {
return isStr(str) ? str.toUpperCase() : ""
}
}
function dateStr(mask, utc) {
var get = "d.get" + (utc ? "UTC" : "")
, dateMap = {
d: "Day()||7",
M: "Month()+1",
D: "Date()",
H: "Hours()",
h: "Hours()%12||12",
m: "Minutes()",
s: "Seconds()",
S: "Milliseconds()"
}
, setA = "a.setTime(+d+((4-(" + get + dateMap.d + "))*864e5))"
return replace((utc ? mask.slice(4) : mask), dateRe, function(match, MD, single, pad, text, esc) {
mask = (
esc ? replace(replace(escape(esc), /%u/g, "\\u"), /%/g, "\\x") :
text !== UNDEF ? replace(text, /''/g, "'") :
MD || match == "dd" ? "l[''][" + get + (MD == "M" ? "Month()+" + (match == "MMM" ? 14 : 26) : "Day()" + (pad ? (pad = "") : "+7")) + "]" :
match == "u" ? "(d/1000)>>>0" :
match == "U" ? "+d" :
match == "Q" ? "((" + get + "Month()/3)|0)+1" :
match == "a" ? "l[" + get + dateMap.H + ">11?'pm':'am']" :
match == "o" ? setA + ",a" + get.slice(1) + "FullYear()" :
single == "Y" ? get + "FullYear()" + (pad == "Y" ? "%100" : "") :
single == "Z" ? "(t=o)?(t<0?((t=-t),'-'):'+')+(t<600?'0':'')+(0|(t/60))" + (pad ? (pad = "") : "+':'") + "+((t%=60)>9?t:'0'+t):'Z'" :
single == "w" ? "Math.ceil(((" + setA + "-a.s" + get.slice(3) + "Month(0,1))/864e5+1)/7)" :
get + dateMap[single || match]
)
return text !== UNDEF || esc ? mask : "\"+(" + (
match == "SS" ? "(t=" + mask + ")>9?t>99?t:'0'+t:'00'+t" :
pad ? "(t=" + mask + ")>9?t:'0'+t" :
mask
) + ")+\""
})
}
function numStr(format, t) {
// format;NaN;negFormat;0;Infinity;-Infinity;roundPoint
// 🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹
var conf = format.split(";")
, nan_value = conf[1] || "-"
, o = (t.ordinal||"").split(";")
, pre = {
a: "(o+=d<1e3?'':d<1e6?(d/=1e3,'k'):d<1e9?(d/=1e6,'M'):d<1e12?(d/=1e9,'G'):d<1e15?(d/=1e12,'T'):d<1e18?(d/=1e15,'P'):(d/=1e18,'E')),"
}
, post = {
o: "r+(o=" + JSON.stringify(o.slice(0,-1)) + "," + o.pop() + ")"
}
, m2 = /([^\d#]*)([\d# .,_·']*\/?\d+)(?:(\s*)([a-z%]+)(\d*))?(.*)/.exec(conf[0])
, m3 = /([.,\/])(\d*)$/.exec(m2[2])
, decimals = m3 && m3[2].length || 0
, full = m3 ? m2[2].slice(0, m3.index) : m2[2]
, num = replace(full, /\D+/g, "")
, sLen = num.length
, step = decimals ? +(m3[1] === "/" ? 1 / m3[2] : num + "." + m3[2]) : num
, decSep = m3 && m3[1]
, fn = "d===Infinity?(N?" + quote(conf[5]||nan_value) + ":" + quote(conf[4]||nan_value) + "):d>0||d===0?(o=" + quote(m2[3]) + "," + (pre[m2[4]] || "") + "n=" + (
// Use exponential notation to fix float rounding
// Math.round(1.005*100)/100 = 1 instead of 1.01
decimals ?
"d>1e-" + (decimals + 1) + "?(n=(d+'e" + decimals + "')/" + (step + "e" + decimals) + "":
"d>"+num+"e-1?(n=d/" + num
) + ",Math.floor(n" + (
conf[6] == 1 ? "%1?n+1:n" : "+" + (conf[6] || 0.5)
) + ")*" + step + "):0,r=" + (
m2[5] ? "(''+(+n.toPrecision(" + (m2[5]) + ")))" :
decimals ? "n.toFixed(" + decimals + ")" :
"n+''"
)
if (decimals) {
if (decSep == "/") {
fn += ".replace(/\\.\\d+/,'" + (
m3[2] == 5 ?
"⅕⅖⅗⅘'.charAt(5" :
"⅛¼⅜½⅝¾⅞'.charAt(8"
) + "*(n%1)-1))"
} else if (decSep != ".") {
fn += ".replace('.','" + decSep + "')"
}
if (sLen === 0) {
fn += ",n<1&&(r=r.slice(1)||'0')"
}
}
if (sLen > 1) {
if (decimals) sLen += decimals + 1
fn += ",r=(r.length<" + sLen + "?(1e15+r).slice(-" + sLen + "):r)"
}
if ((num = full.match(/[^\d#][\d#]+/g))) {
fn += ",r=" + numJunk(num.length - 1, 0, decimals ? decimals + 1 : 0)
}
fn += (
(m2[4] ? ",r=" + (post[m2[4]] || "r+o") : "") +
// negative format
",N&&n>0?" + replace(quote(conf[2] || "-#"), "#", "'+r+'") + ":" +
(conf[3] ? "n===0?" + quote(conf[3]) + ":" : "") +
(m2[1] ? quote(m2[1]) + "+r" : "r") +
(m2[6] ? "+" + quote(m2[6]) : "")
)
return fn + "):" + quote(nan_value)
function numJunk(i, lastLen, dec) {
var len = lastLen + num[i].length - 1
return "(n<1e" + len + (
lastLen ? "?r.slice(0,-" + (lastLen + dec) + "):" : "?r:"
) + (
len < 16 ? numJunk(i?i-1:i, len, dec) : "r.slice(0,-" + (lastLen + dec) + ")"
) + "+" + quote(num[i].charAt(0)) + "+r.slice(-" + (len + dec) + (
lastLen ? ",-" + (lastLen + dec) : ""
) + "))"
}
}
function formatGet(str, data) {
return format(iGet(translations, str, str || ""), data, getExt)
}
function getExt(obj, str) {
var fn = cache[str] || (cache[str] = (replace(replace(str, /;\s*([#*?@~])(.*)/, function(_, op, arg) {
return ";" + iAlias[op] + " " + quote(arg)
}), renderRe, function(_, name, op, args) {
fn = (_ === name) ? name : "$el." + name + "(" + fn + (args ? "," + args : "") + ")"
}), fn === str ? str : makeFn(fn, fn)))
return str == "$" ? obj : isStr(fn) ? iGet(obj, str, "") : isFn(fn) ? fn(iExt, obj, translations) : ""
}
})
assignDeep(iGlobals, opts.globals)
iSet([localStorage.lang, navigator.language, navigator.userLanguage].concat(navigator.languages, opts.lang).find(iResolve))
$d.locales = Object.keys(iFormat)
View.lang = iSet
function iResolve(lang) {
return lang && (iFormat[lang = ("" + lang).toLowerCase()] || iFormat[lang = lang.split("-")[0]]) && lang
;[localStorage.lang, opts.lang, navigator.language].concat(navigator.languages, html.lang, $d.locales = Object.keys(iFormat))
.find(View.lang = function(lang, translations) {
if (lang && (iFormat[lang = ("" + lang).toLowerCase()] || iFormat[lang = lang.split("-")[0]])) {
assignDeep(iFormat[html.lang = $d.lang = localStorage.lang = lang].t, translations)
return ($d._ = iFormat[lang])
}
})
function format(str, data, getter) {
return replace(str, formatRe, function(all, path) {
return getter(data, path, "")
})
}
function iSet(lang, translations) {
assignDeep(iData[lang = html.lang = $d.lang = localStorage.lang = iResolve(lang) || $d.lang || opts.lang], translations)
return ($d._ = iFormat[lang] || format)
function iGet(obj, path, fallback) {
return isStr(path) ? (
isStr(obj[path]) ? obj[path] :
(path = path.split("."))[1] && isObj(obj = obj[path[0]]) && isStr(obj[path[1]]) ? obj[path[1]] :
fallback
) :
isArr(path) ? iGet(obj, path[0]) || iGet(obj, path[1]) || iGet(obj, path[2], fallback) :
fallback
}
/*/
globalScope._ = String
/**/

@@ -697,3 +953,3 @@

if (pushBase) {
history[rep ? "replaceState" : "pushState"](null, null, pushBase + url)
history[rep ? "replaceState" : "pushState"](NUL, NUL, pushBase + url)
} else {

@@ -713,16 +969,8 @@ /**/

// Chrome5, Firefox4, IE10, Safari5, Opera11.50
var histLast, url
, base = find(html, "base")
LiteJS.base = replace((base || location).href, /[^\/]*(#.*)?$/, "")
if (base) base = replace(base.href, /.*:\/\/[^/]*|[^\/]*$/g, "")
if (base && !history.pushState) {
url = location.pathname.slice(base.length)
if (url) {
location.replace(base + "#" + url)
}
}
if (base && history.pushState) {
pushBase = base
var histLast
, baseEl = find(html, "base")
, url = getUrl()
if (baseEl && history.pushState) {
pushBase = replace(baseEl.href, /.*:\/\/[^/]*|[^\/]*$/g, "")
url = location.href.split("#")[1]
if (url && !getUrl()) {

@@ -752,4 +1000,3 @@ setUrl(url, 1)

/**/
// bug in Firefox where location.hash is decoded
// bug in Safari where location.pathname is decoded
// NOTE: in Firefox location.hash is decoded; in Safari location.pathname is decoded
location.href.split("#")[1] || "", /^[#\/\!]+|[\s\/]+$/g, "")

@@ -801,3 +1048,3 @@ }

assign(El, bindings, {
emit: elEmit,
emit: emit,
empty: elEmpty,

@@ -834,12 +1081,16 @@ kill: elKill,

assign(El, {
append: append,
$b: assign(bindings, {
each: function(el, name, list) {
/*** debug ***/
if (el._li) throw "Binding each must be type of once: each!" + name
/**/
var comm = Comm("each " + name, up)
, pos = 0
, nodes = []
comm.$s = this
elReplace(el, comm)
up()
return { a: add, r: remove, u: up }
each(list, add)
return { a: add, u: up }

@@ -849,2 +1100,3 @@ function add(item) {

, subScope = elScope(clone, comm)
append(comm.parentNode, clone, (pos ? nodes[pos - 1] : comm).nextSibling)
subScope.$i = pos++

@@ -854,23 +1106,26 @@ subScope.$len = list.length

clone[BIND_ATTR] = el[BIND_ATTR]
append(comm.parentNode, clone, comm)
/*** debug ***/
clone._li = up
/**/
render(clone)
}
function remove(i) {
elKill(nodes.splice(i, 1)[0])
}
function up() {
for (; pos; ) remove(--pos)
each(list, add)
for (var i = list.length; pos > i; ) elKill(nodes[--pos])
for (nodes.length = i; pos < i; ) add(list[pos])
for (; i--; ) nodes[i].$s[name] = list[i]
}
},
el: function(el, tag, fallback) {
var child = El(elCache[tag] ? tag : fallback)
, tmp = getAttr(el, BIND_ATTR)
, tmp2 = getAttr(child, BIND_ATTR)
if (tmp) setAttr(child, BIND_ATTR, tmp2 ? tmp + ";" + tmp2 : tmp)
if ((tmp = el.className)) cls(child, tmp)
child.$s = el.$s
elReplace(el, child)
render(child)
return child
tag = elCache[tag] ? tag : fallback
if (el._el !== tag) {
var child = El(tag)
, tmp = child._elb = el._el ? el._elb : el[BIND_ATTR]
if (tmp) appendBind(child, tmp, ";", "^")
child.$s = el.$s
child._el = tag
elReplace(el, child)
if ((tmp = child._elc = el._el ? (elKill(el), el._elc) : el.className)) cls(child, tmp)
render(child)
return true
}
},

@@ -881,3 +1136,3 @@ "if": function(el, enabled) {

} else {
elReplace(el, el._if || (el._if = Comm("if", render.bind(el, el))))
elReplace(el, el._if || (el._if = Comm("if", bind(render, el, el, this))))
return true

@@ -888,3 +1143,3 @@ }

if (!prefix) prefix = "is-"
var match = format(val, opts)
var match = elScope(el)._.ext.pick(val, opts)
cls(el, el[prefix + opts], 0)

@@ -906,11 +1161,14 @@ cls(el, el[prefix + opts] = match && prefix + match)

}),
$d: globalScope,
append: append,
asEmitter: asEmitter,
blur: blur,
cache: elCache,
closest: closest,
$d: globalScope,
get: getAttr,
hasClass: hasClass,
matches: matches,
next: walk.bind(El, "nextSibling"),
prev: walk.bind(El, "previousSibling"),
nearest: nearest,
next: bind(walk, El, "nextSibling"),
prev: bind(walk, El, "previousSibling"),
rate: rate,

@@ -929,3 +1187,3 @@ replace: elReplace,

/*** ie8 ***/
// Bug: IE5-7 doesn't set styles and removes events when you try to set them.
// NOTE: IE5-7 doesn't set styles and removes events when you try to set them.
// IE6 label with a for attribute will re-select the first option of SELECT list instead of just giving focus.

@@ -986,3 +1244,3 @@ // http://webbugtrack.blogspot.com/2007/09/bug-116-for-attribute-woes-in-ie6.html

before
) || null)
) || NUL)
/*** debug ***/

@@ -997,2 +1255,11 @@ if (el.namespaceURI && child.namespaceURI && el.namespaceURI !== child.namespaceURI && el.tagName !== "foreignObject" && child.tagName !== "svg") {

function appendBind(el, val, sep, q) {
var current = getAttr(el, BIND_ATTR)
setAttr(el, BIND_ATTR, (current ? (
q === "^" ?
val + sep + current :
current + sep + val
) : val))
}
function hasClass(el, name) {

@@ -1037,5 +1304,2 @@ var current = el.className || ""

function elEmit(el) {
emit.apply(el, slice.call(arguments, 1))
}
function elEmpty(el) {

@@ -1052,11 +1316,11 @@ for (; el.lastChild; elKill(el.lastChild));

// transitionend fires for each property transitioned
if ("on" + tr in el) return addEvent(el, tr, elKill.bind(el, el, el = UNDEF))
if ("on" + tr in el) return addEvent(el, tr, bind(elKill, el, el, el = UNDEF))
}
if (el._e) {
emit.call(el, "kill")
emit(el, "kill")
el._e = UNDEF
}
elRm(el)
el.$s = UNDEF
if (el.nodeType < 2) {
el.$s = UNDEF
elEmpty(el)

@@ -1138,3 +1402,3 @@ if (el.valObject !== UNDEF) {

return checkbox && !el.checked ?
(type === "radio" ? UNDEF : null) :
(type === "radio" ? UNDEF : NUL) :
el.valObject !== UNDEF ? el.valObject : el.value

@@ -1144,3 +1408,3 @@

if (step == opts) key = key.slice(0, offset)
step = step[key] || (step[key] = step[key] === null || _key && +_key != _key ? {} : [])
step = step[key] || (step[key] = step[key] === NUL || _key && +_key != _key ? {} : [])
key = _key

@@ -1163,3 +1427,3 @@ }

var bind, next
var el, next
, scope = node.$s || $s || closestScope(node)

@@ -1174,5 +1438,5 @@

if (hydrate(node, BIND_ATTR, scope)) return
for (bind = node.firstChild; bind; bind = next) {
next = bind.nextSibling
render(bind, scope)
for (el = node.firstChild; el; el = next) {
next = el.nextSibling
render(el, scope)
}

@@ -1184,14 +1448,14 @@ hydrate(node, "data-out", scope)

var fn
, bind = node[attr] || (node[attr] = setAttr(node, attr, "") || true)
if (bind !== true) try {
fn = fnCache[bind] || (fnCache[bind] = makeFn(bind))
, expr = node[attr] || (node[attr] = setAttr(node, attr, "") || true)
if (expr !== true) try {
fn = fnCache[expr] || (fnCache[expr] = makeFn(expr))
return fn(node, scope, attr, fn.o)
} catch (e) {
logErr(e, attr + ": " + bind, node)
throw e + "\n" + attr + ": " + expr
}
}
function makeFn(fn) {
function makeFn(fn, raw) {
var i = 0
, bindOnce = []
fn = "$s&&(" + replace(fn, renderRe, function(match, name, op, args) {
fn = raw || "$s&&(" + replace(fn, renderRe, function(match, name, op, args) {
return (

@@ -1208,3 +1472,3 @@ (op === "!" && (bindOnce[i] = match)) ?

}
fn = Function("$el,$s,$a,$o,$r", "var " + vars + ";return " + fn)
fn = Function("$el,$s,$a,$o,$r", (vars[0] ? "var " + vars : "") + ";return " + fn)
fn.o = bindOnce

@@ -1225,3 +1489,3 @@ return fn

if (killEl) {
addEvent(killEl, "kill", rmKb.bind(map, map))
addEvent(killEl, "kill", bind(rmKb, map, map))
}

@@ -1234,16 +1498,3 @@ }

}
function runKb(e, code, chr) {
var fn, map
, i = 0
, el = e.target
, input = /INPUT|TEXTAREA|SELECT/i.test((el.nodeType < 2 ? el : el.parentNode).tagName)
for (; (map = kbMaps[i++]) && (
!(fn = !input || map.input ? map[code] || map[chr] || map.num && code > 47 && code < 58 && (chr|=0, map.num) || map.all : fn) &&
map.bubble
););
if (isStr(fn)) setUrl(fn)
if (isFn(fn)) fn(e, chr, el)
}
addEvent(document, "keydown", function(e) {

@@ -1260,4 +1511,4 @@ if (kbMaps[0]) {

}
runKb(e, code, key)
if (e.shiftKey && code != 16) runKb(e, code, "shift+" + key)
runKb(key)
if (e.shiftKey && code != 16) runKb("shift+" + key)
// people in Poland use Right-Alt+S to type in Ś.

@@ -1267,8 +1518,20 @@ // Right-Alt+S is mapped internally to Ctrl+Alt+S.

if (e.altKey) {
if (code != 18) runKb(e, code, "alt+" + key)
if (code != 18) runKb("alt+" + key)
} else if (code != 17) {
if (e.ctrlKey) runKb(e, code, "ctrl+" + key)
if (e[kbMod] && code != 91) runKb(e, code, "mod+" + key)
if (e.ctrlKey) runKb("ctrl+" + key)
if (e[kbMod] && code != 91) runKb("mod+" + key)
}
}
function runKb(chr) {
for (
var fn, map
, i = 0
, el = e.target
, input = /INPUT|TEXTAREA|SELECT/i.test((el.nodeType < 2 ? el : el.parentNode).tagName);
(map = kbMaps[i++]) && !(
fn = !input || map.input ? map[code] || map[chr] || map.num && code > 47 && code < 58 && (chr|=0, map.num) || map.all : fn
) && map.bubble; );
if (isStr(fn)) setUrl(fn)
if (isFn(fn)) fn(e, chr, el)
}
})

@@ -1302,3 +1565,3 @@ /**/

if (touchMode || len < 1) {
elEmit(touchEl, touchMode ? touchMode + END : "tap", e2, touchEv, touchEl)
emit(touchEl, touchMode ? touchMode + END : "tap", e2, touchEv, touchEl)
touchMode = UNDEF

@@ -1330,3 +1593,3 @@ }

touchEl.getBBox ?
touchEl.getAttributeNS(null, name == "top" ? "y":"x") :
touchEl.getAttributeNS(NUL, name == "top" ? "y":"x") :
touchEl.style[name]

@@ -1354,3 +1617,3 @@ )

var ev = e.ctrlKey ? "pinch" : e.altKey ? "rotate" : UNDEF
if (ev && emit.call(e.currentTarget || e.target, ev, e, e.deltaY/20, 0)) {
if (ev && emit(e.currentTarget || e.target, ev, e, e.deltaY/20, 0)) {
return eventStop(e)

@@ -1377,5 +1640,5 @@ }

clearTimeout(touchTick)
elEmit(touchEl, touchMode + START, e, touchEv, touchEl)
emit(touchEl, touchMode + START, e, touchEv, touchEl)
}
elEmit(touchEl, touchMode, e, touchEv, touchEl)
emit(touchEl, touchMode, e, touchEv, touchEl)
function haveEv(name, set) {

@@ -1395,3 +1658,3 @@ return set && (evs[name] || evs[name + START] || evs[name + END]) && name

diff = dist - touchDist
if (diff) elEmit(touchEl, "pinch", e, diff, angle)
if (diff) emit(touchEl, "pinch", e, diff, angle)
// GestureEvent onGestureChange: function(e) {

@@ -1401,3 +1664,3 @@ // e.target.style.transform =

diff = angle - touchAngle
if (diff) elEmit(touchEl, "rotate", e, diff * (180/Math.PI))
if (diff) emit(touchEl, "rotate", e, diff * (180/Math.PI))
}

@@ -1410,2 +1673,5 @@ touchDist = dist

function closest(el, sel) {
return el && html.closest.call(el.nodeType < 2 ? el : el.parentNode, sel)
}
function find(root, sel, startNode) {

@@ -1420,4 +1686,4 @@ return html.querySelector.call(startNode || root, sel)

}
function closest(el, sel) {
return el && html.closest.call(el.nodeType < 2 ? el : el.parentNode, sel)
function nearest(el, sel) {
return el ? find(el, sel) || nearest(el.parentNode, sel) : NUL
}

@@ -1432,6 +1698,11 @@ function walk(attr, el, sel) {

var i = arguments.length
if (i > 3 && i < 6 && isNum(selector)) {
data = delay
delay = selector
selector = UNDEF
if (i > 3 && i < 6) {
if (isArr(selector)) {
data = selector
delay = selector = UNDEF
} else if (isNum(selector)) {
data = delay
delay = selector
selector = UNDEF
}
}

@@ -1443,3 +1714,3 @@ if (delay > 0) {

if (isObj(name)) {
for (delay in name) if (hasOwn.call(name, delay)) {
for (delay in name) if (hasOwn(name, delay)) {
f(el, delay, name[delay], selector, 0, data)

@@ -1461,4 +1732,5 @@ }

function assignDeep(target, map) {
if (map) for (var k in map) if (hasOwn.call(map, k)) {
target[k] = isObj(map[k]) && isObj(target[k]) ? assignDeep(target[k], map[k]) : map[k]
if (map) for (var k in map) if (hasOwn(map, k)) {
if (isObj(map[k]) && isObj(target[k]) && hasOwn(target, k)) assignDeep(target[k], map[k])
else target[k] = map[k]
}

@@ -1482,3 +1754,3 @@ return target

if (isArr(arr)) arr.forEach(fn, scope)
else for (key in arr) if (hasOwn.call(arr, key)) fn.call(scope, arr[key], key, arr)
else for (key in arr) if (hasOwn(arr, key)) fn.call(scope, arr[key], key, arr)
}

@@ -1495,24 +1767,2 @@ }

}
function format(str, data) {
return replace(str, formatRe, function(all, path) {
return get(data, path, "")
})
}
function get(obj, path, fallback) {
return isStr(path) ? (
obj[path] !== UNDEF ? obj[path] :
(path = path.split("."))[1] && isObj(obj = obj[path[0]]) && obj[path[1]] !== UNDEF ? obj[path[1]] : fallback
) :
isArr(path) ? get(obj, path[0]) || get(obj, path[1]) || get(obj, path[2], fallback) :
fallback
}
function logErr(e, source, node) {
/*** debug ***/
console.error(e)
console.error(source, node)
/**/
if (window.onerror) {
window.onerror(e.message, e.fileName, e.lineNumber)
}
}
function injectCss(cssText) {

@@ -1540,2 +1790,5 @@ if (!styleNode) {

}
function quote(str) {
return "'" + replace(replace(str || "", /'/g, "\\'"), /\n/g, "\\n") + "'"
}
// Maximum call rate for Function with optional leading edge and trailing edge

@@ -1581,3 +1834,3 @@ function rate(fn, ms, onStart, onEnd) {

}), function(res) {
res = res.concat(sources, (next || res).innerHTML).filter(Boolean)
res = res.concat(sources, next && next.src && next.innerHTML).filter(Boolean)
if (res[sources.length = 0]) {

@@ -1584,0 +1837,0 @@ if (!parser) LiteJS.ui = LiteJS()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc