Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magic-json-tree

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-json-tree - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

985

dist/magic-json-tree.js

@@ -1,28 +0,28 @@

function A() {
function p() {
}
function ee(e) {
function ae(e) {
return e();
}
function U() {
function $() {
return /* @__PURE__ */ Object.create(null);
}
function F(e) {
e.forEach(ee);
function M(e) {
e.forEach(ae);
}
function te(e) {
function Y(e) {
return typeof e == "function";
}
function ne(e, t) {
function q(e, t) {
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
}
function oe(e) {
function de(e) {
return Object.keys(e).length === 0;
}
function p(e, t) {
function F(e, t) {
e.appendChild(t);
}
function K(e, t, l) {
function d(e, t, l) {
e.insertBefore(t, l || null);
}
function w(e) {
function h(e) {
e.parentNode && e.parentNode.removeChild(e);

@@ -34,90 +34,90 @@ }

}
function V(e) {
function v(e) {
return document.createElement(e);
}
function j(e) {
function b(e) {
return document.createTextNode(e);
}
function le() {
return j(" ");
function oe() {
return b(" ");
}
function re() {
return j("");
function se() {
return b("");
}
function se(e, t, l, n) {
function ge(e, t, l, n) {
return e.addEventListener(t, l, n), () => e.removeEventListener(t, l, n);
}
function y(e, t, l) {
function g(e, t, l) {
l == null ? e.removeAttribute(t) : e.getAttribute(t) !== l && e.setAttribute(t, l);
}
function ce(e) {
function ke(e) {
return Array.from(e.childNodes);
}
function T(e, t) {
function E(e, t) {
t = "" + t, e.wholeText !== t && (e.data = t);
}
function W(e, t, l) {
function Q(e, t, l) {
e.classList[l ? "add" : "remove"](t);
}
let H;
function C(e) {
H = e;
let Z;
function B(e) {
Z = e;
}
const N = [], X = [], D = [], Y = [], _e = Promise.resolve();
let z = !1;
function me() {
z || (z = !0, _e.then(ae));
const O = [], x = [], H = [], ee = [], ve = Promise.resolve();
let W = !1;
function be() {
W || (W = !0, ve.then(me));
}
function G(e) {
D.push(e);
function X(e) {
H.push(e);
}
const q = /* @__PURE__ */ new Set();
let M = 0;
function ae() {
const e = H;
const U = /* @__PURE__ */ new Set();
let G = 0;
function me() {
const e = Z;
do {
for (; M < N.length; ) {
const t = N[M];
M++, C(t), de(t.$$);
for (; G < O.length; ) {
const t = O[G];
G++, B(t), pe(t.$$);
}
for (C(null), N.length = 0, M = 0; X.length; )
X.pop()();
for (let t = 0; t < D.length; t += 1) {
const l = D[t];
q.has(l) || (q.add(l), l());
for (B(null), O.length = 0, G = 0; x.length; )
x.pop()();
for (let t = 0; t < H.length; t += 1) {
const l = H[t];
U.has(l) || (U.add(l), l());
}
D.length = 0;
} while (N.length);
for (; Y.length; )
Y.pop()();
z = !1, q.clear(), C(e);
H.length = 0;
} while (O.length);
for (; ee.length; )
ee.pop()();
W = !1, U.clear(), B(e);
}
function de(e) {
function pe(e) {
if (e.fragment !== null) {
e.update(), F(e.before_update);
e.update(), M(e.before_update);
const t = e.dirty;
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(G);
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(X);
}
}
const I = /* @__PURE__ */ new Set();
let O;
function L() {
O = {
const J = /* @__PURE__ */ new Set();
let w;
function C() {
w = {
r: 0,
c: [],
p: O
p: w
};
}
function B() {
O.r || F(O.c), O = O.p;
function T() {
w.r || M(w.c), w = w.p;
}
function v(e, t) {
e && e.i && (I.delete(e), e.i(t));
function _(e, t) {
e && e.i && (J.delete(e), e.i(t));
}
function b(e, t, l, n) {
function y(e, t, l, n) {
if (e && e.o) {
if (I.has(e))
if (J.has(e))
return;
I.add(e), O.c.push(() => {
I.delete(e), n && (l && e.d(1), n());
J.add(e), w.c.push(() => {
J.delete(e), n && (l && e.d(1), n());
}), e.o(t);

@@ -127,29 +127,29 @@ } else

}
function J(e) {
function j(e) {
e && e.c();
}
function P(e, t, l, n) {
const { fragment: r, after_update: o } = e.$$;
r && r.m(t, l), n || G(() => {
const f = e.$$.on_mount.map(ee).filter(te);
e.$$.on_destroy ? e.$$.on_destroy.push(...f) : F(f), e.$$.on_mount = [];
}), o.forEach(G);
function S(e, t, l, n) {
const { fragment: r, after_update: a } = e.$$;
r && r.m(t, l), n || X(() => {
const f = e.$$.on_mount.map(ae).filter(Y);
e.$$.on_destroy ? e.$$.on_destroy.push(...f) : M(f), e.$$.on_mount = [];
}), a.forEach(X);
}
function R(e, t) {
function A(e, t) {
const l = e.$$;
l.fragment !== null && (F(l.on_destroy), l.fragment && l.fragment.d(t), l.on_destroy = l.fragment = null, l.ctx = []);
l.fragment !== null && (M(l.on_destroy), l.fragment && l.fragment.d(t), l.on_destroy = l.fragment = null, l.ctx = []);
}
function he(e, t) {
e.$$.dirty[0] === -1 && (N.push(e), me(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
function Se(e, t) {
e.$$.dirty[0] === -1 && (O.push(e), be(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
}
function fe(e, t, l, n, r, o, f, i = [-1]) {
const a = H;
C(e);
const u = e.$$ = {
function P(e, t, l, n, r, a, f, i = [-1]) {
const u = Z;
B(e);
const o = e.$$ = {
fragment: null,
ctx: [],
props: o,
update: A,
props: a,
update: p,
not_equal: r,
bound: U(),
bound: $(),
on_mount: [],

@@ -160,30 +160,30 @@ on_destroy: [],

after_update: [],
context: new Map(t.context || (a ? a.$$.context : [])),
callbacks: U(),
context: new Map(t.context || (u ? u.$$.context : [])),
callbacks: $(),
dirty: i,
skip_bound: !1,
root: t.target || a.$$.root
root: t.target || u.$$.root
};
f && f(u.root);
let h = !1;
if (u.ctx = l ? l(e, t.props || {}, (_, k, ...d) => {
const m = d.length ? d[0] : k;
return u.ctx && r(u.ctx[_], u.ctx[_] = m) && (!u.skip_bound && u.bound[_] && u.bound[_](m), h && he(e, _)), k;
}) : [], u.update(), h = !0, F(u.before_update), u.fragment = n ? n(u.ctx) : !1, t.target) {
f && f(o.root);
let s = !1;
if (o.ctx = l ? l(e, t.props || {}, (c, k, ...K) => {
const V = K.length ? K[0] : k;
return o.ctx && r(o.ctx[c], o.ctx[c] = V) && (!o.skip_bound && o.bound[c] && o.bound[c](V), s && Se(e, c)), k;
}) : [], o.update(), s = !0, M(o.before_update), o.fragment = n ? n(o.ctx) : !1, t.target) {
if (t.hydrate) {
const _ = ce(t.target);
u.fragment && u.fragment.l(_), _.forEach(w);
const c = ke(t.target);
o.fragment && o.fragment.l(c), c.forEach(h);
} else
u.fragment && u.fragment.c();
t.intro && v(e.$$.fragment), P(e, t.target, t.anchor, t.customElement), ae();
o.fragment && o.fragment.c();
t.intro && _(e.$$.fragment), S(e, t.target, t.anchor, t.customElement), me();
}
C(a);
B(u);
}
class ue {
class z {
$destroy() {
R(this, 1), this.$destroy = A;
A(this, 1), this.$destroy = p;
}
$on(t, l) {
if (!te(l))
return A;
if (!Y(l))
return p;
const n = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);

@@ -196,424 +196,695 @@ return n.push(l), () => {

$set(t) {
this.$$set && !oe(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
this.$$set && !de(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
}
}
function E(e) {
function Ae(e) {
let t, l = (e[3] ? e[3]([e[0], e[1]], e[2]) : String(e[0])) + "", n;
return {
c() {
t = v("div"), n = b(l), g(t, "class", "magic-json-tree-key svelte-8rygun");
},
m(r, a) {
d(r, t, a), F(t, n);
},
p(r, [a]) {
a & 15 && l !== (l = (r[3] ? r[3]([r[0], r[1]], r[2]) : String(r[0])) + "") && E(n, l);
},
i: p,
o: p,
d(r) {
r && h(t);
}
};
}
function je(e, t, l) {
let { key: n = null } = t, { value: r } = t, { path: a = [] } = t, { format: f = null } = t;
return e.$$set = (i) => {
"key" in i && l(0, n = i.key), "value" in i && l(1, r = i.value), "path" in i && l(2, a = i.path), "format" in i && l(3, f = i.format);
}, [n, r, a, f];
}
class we extends z {
constructor(t) {
super(), P(this, t, je, Ae, q, { key: 0, value: 1, path: 2, format: 3 });
}
}
const ce = we;
function L(e) {
return e === null ? "null" : Array.isArray(e) ? "array" : e instanceof Map ? "map" : e instanceof Set ? "set" : typeof e;
}
function Z(e, t, l) {
const n = e.slice();
return n[11] = t[l][0], n[12] = t[l][1], n;
function D(e) {
return Array.isArray(e) ? Object.keys(e).map((t) => [t, e[t]]) : "entries" in e && typeof e.entries == "function" ? [...e.entries()] : Object.entries(e);
}
function $(e) {
let t, l, n = e[7], r = [];
for (let f = 0; f < n.length; f += 1)
r[f] = x(Z(e, n, f));
const o = (f) => b(r[f], 1, 1, () => {
r[f] = null;
});
function R(e) {
const t = L(e);
return t === "string" ? `${t}[v.length]` : t === "array" || t === "map" || t === "set" || t === "object" ? `${t}[${D(e).length}]` : t;
}
function Ke(e) {
let t = String(e[0]) + "", l;
return {
c() {
for (let f = 0; f < r.length; f += 1)
r[f].c();
t = re();
l = b(t);
},
m(f, i) {
for (let a = 0; a < r.length; a += 1)
r[a].m(f, i);
K(f, t, i), l = !0;
m(n, r) {
d(n, l, r);
},
p(f, i) {
if (i & 1726) {
n = f[7];
let a;
for (a = 0; a < n.length; a += 1) {
const u = Z(f, n, a);
r[a] ? (r[a].p(u, i), v(r[a], 1)) : (r[a] = x(u), r[a].c(), v(r[a], 1), r[a].m(t.parentNode, t));
}
for (L(), a = n.length; a < r.length; a += 1)
o(a);
B();
}
p(n, r) {
r & 1 && t !== (t = String(n[0]) + "") && E(l, t);
},
i(f) {
if (!l) {
for (let i = 0; i < n.length; i += 1)
v(r[i]);
l = !0;
}
},
o(f) {
r = r.filter(Boolean);
for (let i = 0; i < r.length; i += 1)
b(r[i]);
l = !1;
},
d(f) {
ie(r, f), f && w(t);
d(n) {
n && h(l);
}
};
}
function ge(e) {
let t = String(e[12]) + "", l;
function Ve(e) {
let t = String(e[3]([e[1], e[0]], e[2])) + "", l;
return {
c() {
l = j(t);
l = b(t);
},
m(n, r) {
K(n, l, r);
d(n, l, r);
},
p(n, r) {
r & 128 && t !== (t = String(n[12]) + "") && T(l, t);
r & 15 && t !== (t = String(n[3]([n[1], n[0]], n[2])) + "") && E(l, t);
},
i: A,
o: A,
d(n) {
n && w(l);
n && h(l);
}
};
}
function ve(e) {
let t = String(e[4]([e[11], e[12]], [...e[5], e[11]])) + "", l;
function Ee(e) {
let t = (e[3] ? e[3]([e[1], e[0]], e[2]) : `"${e[0]}"`) + "", l;
return {
c() {
l = j(t);
l = b(t);
},
m(n, r) {
K(n, l, r);
d(n, l, r);
},
p(n, r) {
r & 176 && t !== (t = String(n[4]([n[11], n[12]], [...n[5], n[11]])) + "") && T(l, t);
r & 15 && t !== (t = (n[3] ? n[3]([n[1], n[0]], n[2]) : `"${n[0]}"`) + "") && E(l, t);
},
i: A,
o: A,
d(n) {
n && w(l);
n && h(l);
}
};
}
function pe(e) {
let t, l, n, r;
const o = [ke, be], f = [];
function i(a, u) {
return a[4] ? 0 : 1;
function Ce(e) {
let t, l;
function n(f, i) {
return typeof f[0] == "string" ? Ee : f[3] ? Ve : Ke;
}
return t = i(e), l = f[t] = o[t](e), {
let r = n(e), a = r(e);
return {
c() {
l.c(), n = re();
t = v("div"), a.c(), g(t, "class", l = "magic-json-tree-value magic-json-tree-value-" + L(e[0]) + " svelte-jtmsic");
},
m(a, u) {
f[t].m(a, u), K(a, n, u), r = !0;
m(f, i) {
d(f, t, i), a.m(t, null);
},
p(a, u) {
let h = t;
t = i(a), t === h ? f[t].p(a, u) : (L(), b(f[h], 1, 1, () => {
f[h] = null;
}), B(), l = f[t], l ? l.p(a, u) : (l = f[t] = o[t](a), l.c()), v(l, 1), l.m(n.parentNode, n));
p(f, [i]) {
r === (r = n(f)) && a ? a.p(f, i) : (a.d(1), a = r(f), a && (a.c(), a.m(t, null))), i & 1 && l !== (l = "magic-json-tree-value magic-json-tree-value-" + L(f[0]) + " svelte-jtmsic") && g(t, "class", l);
},
i(a) {
r || (v(l), r = !0);
},
o(a) {
b(l), r = !1;
},
d(a) {
f[t].d(a), a && w(n);
i: p,
o: p,
d(f) {
f && h(t), a.d();
}
};
}
function ye(e) {
let t = (e[4] ? e[4]([e[11], e[12]], [...e[5], e[11]]) : `"${e[12]}"`) + "", l;
function Te(e, t, l) {
let { value: n } = t, { key: r = null } = t, { path: a = [] } = t, { format: f = null } = t;
return e.$$set = (i) => {
"value" in i && l(0, n = i.value), "key" in i && l(1, r = i.key), "path" in i && l(2, a = i.path), "format" in i && l(3, f = i.format);
}, [n, r, a, f];
}
class Ne extends z {
constructor(t) {
super(), P(this, t, Te, Ce, q, { value: 0, key: 1, path: 2, format: 3 });
}
}
const _e = Ne;
function Ie(e) {
let t = R(e[0]) + "", l;
return {
c() {
l = j(t);
l = b(t);
},
m(n, r) {
K(n, l, r);
d(n, l, r);
},
p(n, r) {
r & 176 && t !== (t = (n[4] ? n[4]([n[11], n[12]], [...n[5], n[11]]) : `"${n[12]}"`) + "") && T(l, t);
r & 1 && t !== (t = R(n[0]) + "") && E(l, t);
},
i: A,
o: A,
d(n) {
n && w(l);
n && h(l);
}
};
}
function be(e) {
let t, l;
return t = new Q({
function Oe(e) {
var n;
let t = ((n = e[2]([e[3], e[0]], e[4])) != null ? n : R(e[0])) + "", l;
return {
c() {
l = b(t);
},
m(r, a) {
d(r, l, a);
},
p(r, a) {
var f;
a & 29 && t !== (t = ((f = r[2]([r[3], r[0]], r[4])) != null ? f : R(r[0])) + "") && E(l, t);
},
d(r) {
r && h(l);
}
};
}
function Be(e) {
let t, l, n, r, a;
function f(o, s) {
return o[2] ? Oe : Ie;
}
let i = f(e), u = i(e);
return {
c() {
t = v("a"), l = v("span"), l.textContent = "\u2023", n = v("span"), u.c(), g(l, "class", "arrow"), g(n, "class", "summary-content svelte-1yur81u"), g(t, "class", "magic-json-tree-summary svelte-1yur81u"), g(t, "href", "#");
},
m(o, s) {
d(o, t, s), F(t, l), F(t, n), u.m(n, null), r || (a = ge(t, "click", function() {
Y(e[1]) && e[1].apply(this, arguments);
}), r = !0);
},
p(o, [s]) {
e = o, i === (i = f(e)) && u ? u.p(e, s) : (u.d(1), u = i(e), u && (u.c(), u.m(n, null)));
},
i: p,
o: p,
d(o) {
o && h(t), u.d(), r = !1, a();
}
};
}
function Fe(e, t, l) {
let { value: n } = t, { onClick: r } = t, { format: a = null } = t, { key: f = null } = t, { path: i = [] } = t;
return e.$$set = (u) => {
"value" in u && l(0, n = u.value), "onClick" in u && l(1, r = u.onClick), "format" in u && l(2, a = u.format), "key" in u && l(3, f = u.key), "path" in u && l(4, i = u.path);
}, [n, r, a, f, i];
}
class Le extends z {
constructor(t) {
super(), P(this, t, Fe, Be, q, {
value: 0,
onClick: 1,
format: 2,
key: 3,
path: 4
});
}
}
const ye = Le;
function te(e, t, l) {
const n = e.slice();
return n[12] = t[l][0], n[13] = t[l][1], n;
}
function De(e) {
let t, l, n, r, a;
return l = new ce({
props: {
value: e[12],
level: e[2] + 1,
formatKey: e[3],
formatValue: e[4],
path: [...e[5], e[11]],
expand: Array.isArray(e[1]) ? e[9] === e[11] ? e[10] : 0 : e[1]
key: e[0],
value: e[1],
path: e[2],
format: e[3]
}
}), r = new _e({
props: {
key: e[0],
value: e[1],
path: e[2],
format: e[4]
}
}), {
c() {
J(t.$$.fragment);
t = v("div"), j(l.$$.fragment), n = b(":"), j(r.$$.fragment), g(t, "class", "key-line svelte-o8j8yy");
},
m(n, r) {
P(t, n, r), l = !0;
m(f, i) {
d(f, t, i), S(l, t, null), F(t, n), S(r, t, null), a = !0;
},
p(n, r) {
p(f, i) {
const u = {};
i & 1 && (u.key = f[0]), i & 2 && (u.value = f[1]), i & 4 && (u.path = f[2]), i & 8 && (u.format = f[3]), l.$set(u);
const o = {};
r & 128 && (o.value = n[12]), r & 4 && (o.level = n[2] + 1), r & 8 && (o.formatKey = n[3]), r & 16 && (o.formatValue = n[4]), r & 160 && (o.path = [...n[5], n[11]]), r & 130 && (o.expand = Array.isArray(n[1]) ? n[9] === n[11] ? n[10] : 0 : n[1]), t.$set(o);
i & 1 && (o.key = f[0]), i & 2 && (o.value = f[1]), i & 4 && (o.path = f[2]), i & 16 && (o.format = f[4]), r.$set(o);
},
i(n) {
l || (v(t.$$.fragment, n), l = !0);
i(f) {
a || (_(l.$$.fragment, f), _(r.$$.fragment, f), a = !0);
},
o(n) {
b(t.$$.fragment, n), l = !1;
o(f) {
y(l.$$.fragment, f), y(r.$$.fragment, f), a = !1;
},
d(n) {
R(t, n);
d(f) {
f && h(t), A(l), A(r);
}
};
}
function ke(e) {
function Me(e) {
let t, l, n, r, a, f, i;
l = new ce({
props: {
key: e[0],
value: e[1],
path: e[2],
format: e[3]
}
}), r = new ye({
props: {
value: e[1],
key: e[0],
path: e[2],
format: e[5],
onClick: e[9]
}
});
let u = e[8] && ne(e);
return {
c() {
t = v("div"), j(l.$$.fragment), n = b(":"), j(r.$$.fragment), a = oe(), u && u.c(), f = se(), g(t, "class", "key-line svelte-o8j8yy");
},
m(o, s) {
d(o, t, s), S(l, t, null), F(t, n), S(r, t, null), d(o, a, s), u && u.m(o, s), d(o, f, s), i = !0;
},
p(o, s) {
const c = {};
s & 1 && (c.key = o[0]), s & 2 && (c.value = o[1]), s & 4 && (c.path = o[2]), s & 8 && (c.format = o[3]), l.$set(c);
const k = {};
s & 2 && (k.value = o[1]), s & 1 && (k.key = o[0]), s & 4 && (k.path = o[2]), s & 32 && (k.format = o[5]), r.$set(k), o[8] ? u ? (u.p(o, s), s & 256 && _(u, 1)) : (u = ne(o), u.c(), _(u, 1), u.m(f.parentNode, f)) : u && (C(), y(u, 1, 1, () => {
u = null;
}), T());
},
i(o) {
i || (_(l.$$.fragment, o), _(r.$$.fragment, o), _(u), i = !0);
},
o(o) {
y(l.$$.fragment, o), y(r.$$.fragment, o), y(u), i = !1;
},
d(o) {
o && h(t), A(l), A(r), o && h(a), u && u.d(o), o && h(f);
}
};
}
function ne(e) {
let t, l, n = D(e[1]), r = [];
for (let f = 0; f < n.length; f += 1)
r[f] = le(te(e, n, f));
const a = (f) => y(r[f], 1, 1, () => {
r[f] = null;
});
return {
c() {
t = v("div");
for (let f = 0; f < r.length; f += 1)
r[f].c();
g(t, "class", "magic-json-tree-object-items");
},
m(f, i) {
d(f, t, i);
for (let u = 0; u < r.length; u += 1)
r[u].m(t, null);
l = !0;
},
p(f, i) {
if (i & 3326) {
n = D(f[1]);
let u;
for (u = 0; u < n.length; u += 1) {
const o = te(f, n, u);
r[u] ? (r[u].p(o, i), _(r[u], 1)) : (r[u] = le(o), r[u].c(), _(r[u], 1), r[u].m(t, null));
}
for (C(), u = n.length; u < r.length; u += 1)
a(u);
T();
}
},
i(f) {
if (!l) {
for (let i = 0; i < n.length; i += 1)
_(r[i]);
l = !0;
}
},
o(f) {
r = r.filter(Boolean);
for (let i = 0; i < r.length; i += 1)
y(r[i]);
l = !1;
},
d(f) {
f && h(t), ie(r, f);
}
};
}
function le(e) {
let t, l;
return t = new Q({
return t = new he({
props: {
value: e[4]([e[11], e[12]], [...e[5], e[11]]),
level: e[2] + 1,
key: e[12],
value: e[13],
level: e[6] + 1,
path: [...e[2], e[12]],
formatKey: e[3],
formatValue: e[4],
path: [...e[5], e[11]],
expand: Array.isArray(e[1]) ? e[9] === e[11] ? e[10] : 0 : e[1]
formatSummary: e[5],
expand: Array.isArray(e[7]) ? e[10] === e[12] ? e[11] : 0 : e[7]
}
}), {
c() {
J(t.$$.fragment);
j(t.$$.fragment);
},
m(n, r) {
P(t, n, r), l = !0;
S(t, n, r), l = !0;
},
p(n, r) {
const o = {};
r & 176 && (o.value = n[4]([n[11], n[12]], [...n[5], n[11]])), r & 4 && (o.level = n[2] + 1), r & 8 && (o.formatKey = n[3]), r & 16 && (o.formatValue = n[4]), r & 160 && (o.path = [...n[5], n[11]]), r & 130 && (o.expand = Array.isArray(n[1]) ? n[9] === n[11] ? n[10] : 0 : n[1]), t.$set(o);
const a = {};
r & 2 && (a.key = n[12]), r & 2 && (a.value = n[13]), r & 64 && (a.level = n[6] + 1), r & 6 && (a.path = [...n[2], n[12]]), r & 8 && (a.formatKey = n[3]), r & 16 && (a.formatValue = n[4]), r & 32 && (a.formatSummary = n[5]), r & 130 && (a.expand = Array.isArray(n[7]) ? n[10] === n[12] ? n[11] : 0 : n[7]), t.$set(a);
},
i(n) {
l || (v(t.$$.fragment, n), l = !0);
l || (_(t.$$.fragment, n), l = !0);
},
o(n) {
b(t.$$.fragment, n), l = !1;
y(t.$$.fragment, n), l = !1;
},
d(n) {
R(t, n);
A(t, n);
}
};
}
function x(e) {
let t, l, n = (e[3] ? e[3]([e[11], e[12]], e[5]) : e[11]) + "", r, o, f, i, a, u, h, _;
const k = [ye, pe, ve, ge], d = [];
function m(c, s) {
return typeof c[12] == "string" ? 0 : typeof c[12] == "object" && c[12] != null ? 1 : c[4] ? 2 : 3;
function qe(e) {
let t, l, n, r, a;
const f = [Me, De], i = [];
function u(o, s) {
return typeof o[1] == "object" && o[1] !== null ? 0 : 1;
}
return i = m(e), a = d[i] = k[i](e), {
return l = u(e), n = i[l] = f[l](e), {
c() {
t = V("div"), l = V("div"), r = j(n), o = j(`
:
`), f = V("div"), a.c(), h = le(), y(l, "class", "magic-json-tree-key"), y(f, "class", u = "magic-json-tree-value magic-json-tree-value-" + E(e[12]) + " svelte-12av7lt"), y(t, "class", "magic-json-tree-item svelte-12av7lt");
t = v("div"), n.c(), g(t, "class", r = "magic-json-tree-item magic-json-tree-item-" + L(e[1]) + " svelte-o8j8yy"), Q(t, "expanded", e[8]);
},
m(c, s) {
K(c, t, s), p(t, l), p(l, r), p(t, o), p(t, f), d[i].m(f, null), p(t, h), _ = !0;
m(o, s) {
d(o, t, s), i[l].m(t, null), a = !0;
},
p(c, s) {
(!_ || s & 168) && n !== (n = (c[3] ? c[3]([c[11], c[12]], c[5]) : c[11]) + "") && T(r, n);
let g = i;
i = m(c), i === g ? d[i].p(c, s) : (L(), b(d[g], 1, 1, () => {
d[g] = null;
}), B(), a = d[i], a ? a.p(c, s) : (a = d[i] = k[i](c), a.c()), v(a, 1), a.m(f, null)), (!_ || s & 128 && u !== (u = "magic-json-tree-value magic-json-tree-value-" + E(c[12]) + " svelte-12av7lt")) && y(f, "class", u);
p(o, [s]) {
let c = l;
l = u(o), l === c ? i[l].p(o, s) : (C(), y(i[c], 1, 1, () => {
i[c] = null;
}), T(), n = i[l], n ? n.p(o, s) : (n = i[l] = f[l](o), n.c()), _(n, 1), n.m(t, null)), (!a || s & 2 && r !== (r = "magic-json-tree-item magic-json-tree-item-" + L(o[1]) + " svelte-o8j8yy")) && g(t, "class", r), (!a || s & 258) && Q(t, "expanded", o[8]);
},
i(c) {
_ || (v(a), _ = !0);
i(o) {
a || (_(n), a = !0);
},
o(c) {
b(a), _ = !1;
o(o) {
y(n), a = !1;
},
d(c) {
c && w(t), d[i].d();
d(o) {
o && h(t), i[l].d();
}
};
}
function je(e) {
let t, l, n, r, o = E(e[0]) + "", f, i, a = e[7].length + "", u, h, _, k, d, m, c, s = e[6] && $(e);
return {
c() {
t = V("div"), l = V("a"), n = V("span"), n.textContent = "\u2023", r = V("span"), f = j(o), i = j("["), u = j(a), h = j("]"), _ = le(), s && s.c(), y(n, "class", "arrow svelte-12av7lt"), y(r, "class", "type-name svelte-12av7lt"), y(l, "class", "magic-json-tree-summary svelte-12av7lt"), y(l, "href", "#"), y(t, "class", k = "magic-json-tree-value magic-json-tree-value-" + E(e[0]) + " svelte-12av7lt"), W(t, "expanded", e[6]);
},
m(g, S) {
K(g, t, S), p(t, l), p(l, n), p(l, r), p(r, f), p(r, i), p(r, u), p(r, h), p(t, _), s && s.m(t, null), d = !0, m || (c = se(l, "click", e[8]), m = !0);
},
p(g, [S]) {
(!d || S & 1) && o !== (o = E(g[0]) + "") && T(f, o), (!d || S & 128) && a !== (a = g[7].length + "") && T(u, a), g[6] ? s ? (s.p(g, S), S & 64 && v(s, 1)) : (s = $(g), s.c(), v(s, 1), s.m(t, null)) : s && (L(), b(s, 1, 1, () => {
s = null;
}), B()), (!d || S & 1 && k !== (k = "magic-json-tree-value magic-json-tree-value-" + E(g[0]) + " svelte-12av7lt")) && y(t, "class", k), (!d || S & 65) && W(t, "expanded", g[6]);
},
i(g) {
d || (v(s), d = !0);
},
o(g) {
b(s), d = !1;
},
d(g) {
g && w(t), s && s.d(), m = !1, c();
}
};
}
function Ae(e, t, l) {
let { value: n } = t, { expand: r = 0 } = t, { level: o = 0 } = t, { formatKey: f = null } = t, { formatValue: i = null } = t, { path: a = [] } = t, u = Array.isArray(r) ? !0 : typeof r == "number" ? o <= r : !1;
function h(m) {
l(6, u = !u), m.preventDefault();
function Pe(e, t, l) {
let { key: n } = t, { value: r } = t, { path: a = [] } = t, { formatKey: f = null } = t, { formatValue: i = null } = t, { formatSummary: u = null } = t, { level: o = 2 } = t, { expand: s } = t, c = Array.isArray(s) ? !0 : s >= o;
function k(m) {
l(8, c = !c), m.preventDefault();
}
const [_, ...k] = Array.isArray(r) ? r : [];
let d = typeof n.entries == "function" ? [...n.entries()] : Object.entries(n);
const [K, ...V] = Array.isArray(s) ? s : [];
return e.$$set = (m) => {
"value" in m && l(0, n = m.value), "expand" in m && l(1, r = m.expand), "level" in m && l(2, o = m.level), "formatKey" in m && l(3, f = m.formatKey), "formatValue" in m && l(4, i = m.formatValue), "path" in m && l(5, a = m.path);
}, e.$$.update = () => {
e.$$.dirty & 1 && l(7, d = typeof n.entries == "function" ? [...n.entries()] : Object.entries(n));
"key" in m && l(0, n = m.key), "value" in m && l(1, r = m.value), "path" in m && l(2, a = m.path), "formatKey" in m && l(3, f = m.formatKey), "formatValue" in m && l(4, i = m.formatValue), "formatSummary" in m && l(5, u = m.formatSummary), "level" in m && l(6, o = m.level), "expand" in m && l(7, s = m.expand);
}, [
n,
r,
o,
a,
f,
i,
a,
u,
d,
h,
_,
k
o,
s,
c,
k,
K,
V
];
}
class Q extends ue {
class he extends z {
constructor(t) {
super(), fe(this, t, Ae, je, ne, {
value: 0,
expand: 1,
level: 2,
super(), P(this, t, Pe, qe, q, {
key: 0,
value: 1,
path: 2,
formatKey: 3,
formatValue: 4,
path: 5
formatSummary: 5,
level: 6,
expand: 7
});
}
}
const we = Q;
function Ve(e) {
const ze = he;
function re(e, t, l) {
const n = e.slice();
return n[12] = t[l][0], n[13] = t[l][1], n;
}
function Ge(e) {
let t, l;
return t = new we({
return t = new _e({
props: {
value: e[0],
level: 1,
expand: e[1],
formatValue: e[3],
formatKey: e[2]
format: e[3]
}
}), {
c() {
J(t.$$.fragment);
j(t.$$.fragment);
},
m(n, r) {
P(t, n, r), l = !0;
S(t, n, r), l = !0;
},
p(n, r) {
const o = {};
r & 1 && (o.value = n[0]), r & 2 && (o.expand = n[1]), r & 8 && (o.formatValue = n[3]), r & 4 && (o.formatKey = n[2]), t.$set(o);
const a = {};
r & 1 && (a.value = n[0]), r & 8 && (a.format = n[3]), t.$set(a);
},
i(n) {
l || (v(t.$$.fragment, n), l = !0);
l || (_(t.$$.fragment, n), l = !0);
},
o(n) {
b(t.$$.fragment, n), l = !1;
y(t.$$.fragment, n), l = !1;
},
d(n) {
R(t, n);
A(t, n);
}
};
}
function Ke(e) {
let t, l = String(e[0]) + "", n, r;
function He(e) {
let t, l, n, r;
t = new ye({
props: {
value: e[0],
onClick: e[6],
format: e[4]
}
});
let a = e[5] && fe(e);
return {
c() {
t = V("div"), n = j(l), y(t, "class", r = "magic-json-tree-value magic-json-tree-value-" + E(e[0]) + " svelte-1hha4u0");
j(t.$$.fragment), l = oe(), a && a.c(), n = se();
},
m(o, f) {
K(o, t, f), p(t, n);
m(f, i) {
S(t, f, i), d(f, l, i), a && a.m(f, i), d(f, n, i), r = !0;
},
p(o, f) {
f & 1 && l !== (l = String(o[0]) + "") && T(n, l), f & 1 && r !== (r = "magic-json-tree-value magic-json-tree-value-" + E(o[0]) + " svelte-1hha4u0") && y(t, "class", r);
p(f, i) {
const u = {};
i & 1 && (u.value = f[0]), i & 16 && (u.format = f[4]), t.$set(u), f[5] ? a ? (a.p(f, i), i & 32 && _(a, 1)) : (a = fe(f), a.c(), _(a, 1), a.m(n.parentNode, n)) : a && (C(), y(a, 1, 1, () => {
a = null;
}), T());
},
i: A,
o: A,
d(o) {
o && w(t);
i(f) {
r || (_(t.$$.fragment, f), _(a), r = !0);
},
o(f) {
y(t.$$.fragment, f), y(a), r = !1;
},
d(f) {
A(t, f), f && h(l), a && a.d(f), f && h(n);
}
};
}
function Se(e) {
function fe(e) {
let t, l, n = D(e[0]), r = [];
for (let f = 0; f < n.length; f += 1)
r[f] = ue(re(e, n, f));
const a = (f) => y(r[f], 1, 1, () => {
r[f] = null;
});
return {
c() {
t = v("div");
for (let f = 0; f < r.length; f += 1)
r[f].c();
g(t, "class", "magic-json-tree-object-items");
},
m(f, i) {
d(f, t, i);
for (let u = 0; u < r.length; u += 1)
r[u].m(t, null);
l = !0;
},
p(f, i) {
if (i & 415) {
n = D(f[0]);
let u;
for (u = 0; u < n.length; u += 1) {
const o = re(f, n, u);
r[u] ? (r[u].p(o, i), _(r[u], 1)) : (r[u] = ue(o), r[u].c(), _(r[u], 1), r[u].m(t, null));
}
for (C(), u = n.length; u < r.length; u += 1)
a(u);
T();
}
},
i(f) {
if (!l) {
for (let i = 0; i < n.length; i += 1)
_(r[i]);
l = !0;
}
},
o(f) {
r = r.filter(Boolean);
for (let i = 0; i < r.length; i += 1)
y(r[i]);
l = !1;
},
d(f) {
f && h(t), ie(r, f);
}
};
}
function ue(e) {
let t, l;
return t = new ze({
props: {
key: e[12],
value: e[13],
path: [e[12]],
formatKey: e[2],
formatValue: e[3],
formatSummary: e[4],
level: 2,
expand: Array.isArray(e[1]) ? e[7] === e[12] ? e[8] : 0 : e[1]
}
}), {
c() {
j(t.$$.fragment);
},
m(n, r) {
S(t, n, r), l = !0;
},
p(n, r) {
const a = {};
r & 1 && (a.key = n[12]), r & 1 && (a.value = n[13]), r & 1 && (a.path = [n[12]]), r & 4 && (a.formatKey = n[2]), r & 8 && (a.formatValue = n[3]), r & 16 && (a.formatSummary = n[4]), r & 3 && (a.expand = Array.isArray(n[1]) ? n[7] === n[12] ? n[8] : 0 : n[1]), t.$set(a);
},
i(n) {
l || (_(t.$$.fragment, n), l = !0);
},
o(n) {
y(t.$$.fragment, n), l = !1;
},
d(n) {
A(t, n);
}
};
}
function Je(e) {
let t, l, n, r;
const o = [Ke, Ve], f = [];
function i(a, u) {
return typeof a[0] != "object" ? 0 : 1;
const a = [He, Ge], f = [];
function i(u, o) {
return typeof u[0] == "object" && u[0] !== null ? 0 : 1;
}
return l = i(e), n = f[l] = o[l](e), {
return l = i(e), n = f[l] = a[l](e), {
c() {
t = V("div"), n.c(), y(t, "class", "magic-json-tree-root svelte-1hha4u0");
t = v("div"), n.c(), g(t, "class", "magic-json-tree-root svelte-1slccqa"), Q(t, "expanded", e[5]);
},
m(a, u) {
K(a, t, u), f[l].m(t, null), r = !0;
m(u, o) {
d(u, t, o), f[l].m(t, null), r = !0;
},
p(a, [u]) {
let h = l;
l = i(a), l === h ? f[l].p(a, u) : (L(), b(f[h], 1, 1, () => {
f[h] = null;
}), B(), n = f[l], n ? n.p(a, u) : (n = f[l] = o[l](a), n.c()), v(n, 1), n.m(t, null));
p(u, [o]) {
let s = l;
l = i(u), l === s ? f[l].p(u, o) : (C(), y(f[s], 1, 1, () => {
f[s] = null;
}), T(), n = f[l], n ? n.p(u, o) : (n = f[l] = a[l](u), n.c()), _(n, 1), n.m(t, null)), (!r || o & 32) && Q(t, "expanded", u[5]);
},
i(a) {
r || (v(n), r = !0);
i(u) {
r || (_(n), r = !0);
},
o(a) {
b(n), r = !1;
o(u) {
y(n), r = !1;
},
d(a) {
a && w(t), f[l].d();
d(u) {
u && h(t), f[l].d();
}
};
}
function Ee(e, t, l) {
let { value: n } = t, { expand: r = 0 } = t, { formatKey: o = null } = t, { formatValue: f = null } = t, i = null, a = null;
return e.$$set = (u) => {
"value" in u && l(0, n = u.value), "expand" in u && l(1, r = u.expand), "formatKey" in u && l(4, o = u.formatKey), "formatValue" in u && l(5, f = u.formatValue);
function Qe(e, t, l) {
let { value: n } = t, { expand: r = 0 } = t, { formatKey: a = null } = t, { formatValue: f = null } = t, { formatSummary: i = null } = t, u = null, o = null, s = null, c = Array.isArray(r) ? !0 : r >= 1;
function k(m) {
l(5, c = !c), m.preventDefault();
}
const [K, ...V] = Array.isArray(r) ? r : [];
return e.$$set = (m) => {
"value" in m && l(0, n = m.value), "expand" in m && l(1, r = m.expand), "formatKey" in m && l(9, a = m.formatKey), "formatValue" in m && l(10, f = m.formatValue), "formatSummary" in m && l(11, i = m.formatSummary);
}, e.$$.update = () => {
e.$$.dirty & 16 && l(2, i = o ? (u, h) => {
e.$$.dirty & 512 && l(2, u = a ? (m, N) => {
try {
return o(u, h);
} catch (_) {
return console.error("The passed `formatKey` function threw an error. An unformatted key will be rendered.\n", _), u[0];
return a(m, N);
} catch (I) {
return console.error("The passed `formatKey` function threw an error. An unformatted key will be rendered.\n", I), m[0];
}
} : null), e.$$.dirty & 32 && l(3, a = f ? (u, h) => {
} : null), e.$$.dirty & 1024 && l(3, o = f ? (m, N) => {
try {
return f(u, h);
} catch (_) {
return console.error("The passed `formatValue` function threw an error. An unformatted value will be rendered.\n", _), u[1];
return f(m, N);
} catch (I) {
return console.error("The passed `formatValue` function threw an error. An unformatted value will be rendered.\n", I), m[1];
}
} : null), e.$$.dirty & 2048 && l(4, s = i ? (m, N) => {
try {
return i(m, N);
} catch (I) {
return console.error("The passed `formatSummary` function threw an error. A default summary will be rendered.\n", I), m[1];
}
} : null);
}, [n, r, i, a, o, f];
}, [
n,
r,
u,
o,
s,
c,
k,
K,
V,
a,
f,
i
];
}
class Oe extends ue {
class Re extends z {
constructor(t) {
super(), fe(this, t, Ee, Se, ne, {
super(), P(this, t, Qe, Je, q, {
value: 0,
expand: 1,
formatKey: 4,
formatValue: 5
formatKey: 9,
formatValue: 10,
formatSummary: 11
});
}
}
const Te = Oe;
const Ue = Re;
export {
Te as default
Ue as default,
R as getTypeSummary
};
{
"name": "magic-json-tree",
"version": "1.0.0",
"version": "1.1.0",
"author": "Richard Laffers",

@@ -5,0 +5,0 @@ "license": "ISC",

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