lone-format 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +118 -137
- package/dist/lone-format.umd.cjs +7 -7
- package/package.json +1 -1
package/dist/lone-format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as ye, useCssVars as Oe, ref as z, computed as V, resolveComponent as Ue, createElementBlock as
|
|
1
|
+
import { defineComponent as ye, useCssVars as Oe, ref as z, computed as V, resolveComponent as Ue, createElementBlock as A, openBlock as x, createElementVNode as v, createCommentVNode as F, withDirectives as _e, toDisplayString as R, withKeys as ue, vModelText as xe, createTextVNode as Se, Fragment as de, renderList as fe, createVNode as Fe, normalizeClass as Te, nextTick as he, watch as Xe, normalizeStyle as P, createBlock as He } from "vue";
|
|
2
2
|
class Je {
|
|
3
3
|
/**
|
|
4
4
|
* @callback HookCallback
|
|
@@ -964,7 +964,7 @@ class ut {
|
|
|
964
964
|
function re(r, e) {
|
|
965
965
|
return r = r.slice(), r.push(e), r;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function ke(r, e) {
|
|
968
968
|
return e = e.slice(), e.unshift(r), e;
|
|
969
969
|
}
|
|
970
970
|
class ct extends Error {
|
|
@@ -1107,7 +1107,7 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1107
1107
|
} else if (l[0] === "(") {
|
|
1108
1108
|
if (this.currEval === !1)
|
|
1109
1109
|
throw new Error("Eval [(expr)] prevented in JSONPath expression.");
|
|
1110
|
-
b(this._trace(
|
|
1110
|
+
b(this._trace(ke(this._eval(l, e, t.at(-1), t.slice(0, -1), s, n), h), e, t, s, n, o, i));
|
|
1111
1111
|
} else if (l[0] === "@") {
|
|
1112
1112
|
let m = !1;
|
|
1113
1113
|
const w = l.slice(1, -2);
|
|
@@ -1159,7 +1159,7 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1159
1159
|
} else if (l.includes(",")) {
|
|
1160
1160
|
const m = l.split(",");
|
|
1161
1161
|
for (const w of m)
|
|
1162
|
-
b(this._trace(
|
|
1162
|
+
b(this._trace(ke(w, h), e, t, s, n, o, !0));
|
|
1163
1163
|
} else !u && e && Object.hasOwn(e, l) && b(this._trace(h, e[l], re(t, l), e, l, o, i, !0));
|
|
1164
1164
|
}
|
|
1165
1165
|
if (this._hasParentSelector)
|
|
@@ -1195,7 +1195,7 @@ B.prototype._slice = function(r, e, t, s, n, o, i) {
|
|
|
1195
1195
|
h = h < 0 ? Math.max(0, h + u) : Math.min(u, h), f = f < 0 ? Math.max(0, f + u) : Math.min(u, f);
|
|
1196
1196
|
const b = [];
|
|
1197
1197
|
for (let m = h; m < f; m += l)
|
|
1198
|
-
this._trace(
|
|
1198
|
+
this._trace(ke(m, e), t, s, n, o, i, !0).forEach((S) => {
|
|
1199
1199
|
b.push(S);
|
|
1200
1200
|
});
|
|
1201
1201
|
return b;
|
|
@@ -1315,10 +1315,10 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1315
1315
|
}, Et = {
|
|
1316
1316
|
key: 0,
|
|
1317
1317
|
class: "json-node__children"
|
|
1318
|
-
}, _t = { class: "json-node__children-content" }, xt = { class: "json-node__line json-node__closing-bracket" }, Nt = { class: "json-node__bracket" },
|
|
1318
|
+
}, _t = { class: "json-node__children-content" }, xt = { class: "json-node__line json-node__closing-bracket" }, Nt = { class: "json-node__bracket" }, At = {
|
|
1319
1319
|
key: 0,
|
|
1320
1320
|
class: "json-node__comma"
|
|
1321
|
-
},
|
|
1321
|
+
}, kt = {
|
|
1322
1322
|
key: 1,
|
|
1323
1323
|
class: "json-node__primitive"
|
|
1324
1324
|
}, wt = {
|
|
@@ -1412,18 +1412,18 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1412
1412
|
};
|
|
1413
1413
|
return (y, d) => {
|
|
1414
1414
|
const g = Ue("JsonNode", !0);
|
|
1415
|
-
return x(),
|
|
1416
|
-
h.value ? (x(),
|
|
1415
|
+
return x(), A("div", ht, [
|
|
1416
|
+
h.value ? (x(), A("div", pt, [
|
|
1417
1417
|
v("div", gt, [
|
|
1418
|
-
y.keyName && !n.value ? (x(),
|
|
1418
|
+
y.keyName && !n.value ? (x(), A("span", {
|
|
1419
1419
|
key: 0,
|
|
1420
1420
|
class: "json-node__key",
|
|
1421
1421
|
onClick: X,
|
|
1422
1422
|
title: "Click to edit key"
|
|
1423
1423
|
}, ' "' + R(w.value) + '" ', 1)) : F("", !0),
|
|
1424
|
-
y.keyName && n.value ? _e((x(),
|
|
1424
|
+
y.keyName && n.value ? _e((x(), A("input", {
|
|
1425
1425
|
key: 1,
|
|
1426
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
1426
|
+
"onUpdate:modelValue": d[0] || (d[0] = (k) => i.value = k),
|
|
1427
1427
|
onKeyup: [
|
|
1428
1428
|
ue(Y, ["enter"]),
|
|
1429
1429
|
ue(ee, ["escape"])
|
|
@@ -1433,29 +1433,29 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1433
1433
|
}, null, 544)), [
|
|
1434
1434
|
[xe, i.value]
|
|
1435
1435
|
]) : F("", !0),
|
|
1436
|
-
y.keyName ? (x(),
|
|
1436
|
+
y.keyName ? (x(), A("span", mt, ": ")) : F("", !0),
|
|
1437
1437
|
v("span", {
|
|
1438
1438
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1439
1439
|
onClick: I,
|
|
1440
1440
|
title: m.value ? "Click to collapse" : "Click to expand"
|
|
1441
1441
|
}, R(S.value), 9, yt),
|
|
1442
|
-
m.value ? F("", !0) : (x(),
|
|
1442
|
+
m.value ? F("", !0) : (x(), A("span", bt, [
|
|
1443
1443
|
Se(R(j.value) + " ", 1),
|
|
1444
1444
|
v("span", {
|
|
1445
1445
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1446
1446
|
onClick: I
|
|
1447
1447
|
}, R(_.value), 1)
|
|
1448
1448
|
])),
|
|
1449
|
-
!m.value && !y.isLast ? (x(),
|
|
1449
|
+
!m.value && !y.isLast ? (x(), A("span", vt, ",")) : F("", !0)
|
|
1450
1450
|
]),
|
|
1451
|
-
m.value ? (x(),
|
|
1451
|
+
m.value ? (x(), A("div", Et, [
|
|
1452
1452
|
v("div", _t, [
|
|
1453
|
-
(x(!0),
|
|
1453
|
+
(x(!0), A(de, null, fe(y.value, (k, N) => (x(), A("div", {
|
|
1454
1454
|
key: N,
|
|
1455
1455
|
class: "json-node__child"
|
|
1456
1456
|
}, [
|
|
1457
1457
|
Fe(g, {
|
|
1458
|
-
value:
|
|
1458
|
+
value: k,
|
|
1459
1459
|
"key-name": f.value ? "" : String(N),
|
|
1460
1460
|
level: y.level + 1,
|
|
1461
1461
|
path: E(String(N)),
|
|
@@ -1471,19 +1471,19 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1471
1471
|
]),
|
|
1472
1472
|
v("div", xt, [
|
|
1473
1473
|
v("span", Nt, R(_.value), 1),
|
|
1474
|
-
y.isLast ? F("", !0) : (x(),
|
|
1474
|
+
y.isLast ? F("", !0) : (x(), A("span", At, ","))
|
|
1475
1475
|
])
|
|
1476
1476
|
])) : F("", !0)
|
|
1477
|
-
])) : (x(),
|
|
1478
|
-
y.keyName && !n.value ? (x(),
|
|
1477
|
+
])) : (x(), A("div", kt, [
|
|
1478
|
+
y.keyName && !n.value ? (x(), A("span", {
|
|
1479
1479
|
key: 0,
|
|
1480
1480
|
class: "json-node__key",
|
|
1481
1481
|
onClick: X,
|
|
1482
1482
|
title: "Click to edit key"
|
|
1483
1483
|
}, ' "' + R(w.value) + '" ', 1)) : F("", !0),
|
|
1484
|
-
y.keyName && n.value ? _e((x(),
|
|
1484
|
+
y.keyName && n.value ? _e((x(), A("input", {
|
|
1485
1485
|
key: 1,
|
|
1486
|
-
"onUpdate:modelValue": d[5] || (d[5] = (
|
|
1486
|
+
"onUpdate:modelValue": d[5] || (d[5] = (k) => i.value = k),
|
|
1487
1487
|
onKeyup: [
|
|
1488
1488
|
ue(Y, ["enter"]),
|
|
1489
1489
|
ue(ee, ["escape"])
|
|
@@ -1493,20 +1493,20 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1493
1493
|
}, null, 544)), [
|
|
1494
1494
|
[xe, i.value]
|
|
1495
1495
|
]) : F("", !0),
|
|
1496
|
-
y.keyName ? (x(),
|
|
1497
|
-
o.value ? F("", !0) : (x(),
|
|
1496
|
+
y.keyName ? (x(), A("span", wt, ": ")) : F("", !0),
|
|
1497
|
+
o.value ? F("", !0) : (x(), A("span", {
|
|
1498
1498
|
key: 3,
|
|
1499
1499
|
class: Te(["json-node__value", H.value]),
|
|
1500
1500
|
onClick: Z,
|
|
1501
|
-
onDblclick: d[6] || (d[6] = (
|
|
1501
|
+
onDblclick: d[6] || (d[6] = (k) => y.$emit("copy", y.value)),
|
|
1502
1502
|
title: $.value
|
|
1503
1503
|
}, [
|
|
1504
1504
|
Se(R(p.value), 1),
|
|
1505
|
-
y.isLast ? F("", !0) : (x(),
|
|
1505
|
+
y.isLast ? F("", !0) : (x(), A("span", Ot, ","))
|
|
1506
1506
|
], 42, Ct)),
|
|
1507
|
-
o.value ? _e((x(),
|
|
1507
|
+
o.value ? _e((x(), A("input", {
|
|
1508
1508
|
key: 4,
|
|
1509
|
-
"onUpdate:modelValue": d[7] || (d[7] = (
|
|
1509
|
+
"onUpdate:modelValue": d[7] || (d[7] = (k) => u.value = k),
|
|
1510
1510
|
onKeyup: [
|
|
1511
1511
|
ue(Q, ["enter"]),
|
|
1512
1512
|
ue(ae, ["escape"])
|
|
@@ -1555,10 +1555,6 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1555
1555
|
syntaxNull: "#656d76",
|
|
1556
1556
|
syntaxKey: "#0969da",
|
|
1557
1557
|
syntaxBracket: "#24292f",
|
|
1558
|
-
// 滚动条
|
|
1559
|
-
scrollbarTrack: "#f6f8fa",
|
|
1560
|
-
scrollbarThumb: "#d0d7de",
|
|
1561
|
-
scrollbarThumbHover: "#afb8c1",
|
|
1562
1558
|
// 悬停效果
|
|
1563
1559
|
hoverBackground: "#f6f8fa",
|
|
1564
1560
|
// 缩进线
|
|
@@ -1594,10 +1590,6 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1594
1590
|
syntaxNull: "#7d8590",
|
|
1595
1591
|
syntaxKey: "#79c0ff",
|
|
1596
1592
|
syntaxBracket: "#e6edf3",
|
|
1597
|
-
// 滚动条
|
|
1598
|
-
scrollbarTrack: "#161b22",
|
|
1599
|
-
scrollbarThumb: "#30363d",
|
|
1600
|
-
scrollbarThumbHover: "#6e7681",
|
|
1601
1593
|
// 悬停效果
|
|
1602
1594
|
hoverBackground: "#161b22",
|
|
1603
1595
|
// 缩进线
|
|
@@ -1633,10 +1625,6 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1633
1625
|
syntaxNull: "#6b7280",
|
|
1634
1626
|
syntaxKey: "#1f2937",
|
|
1635
1627
|
syntaxBracket: "#374151",
|
|
1636
|
-
// 滚动条 - 极简
|
|
1637
|
-
scrollbarTrack: "#f5f5f5",
|
|
1638
|
-
scrollbarThumb: "#d1d5db",
|
|
1639
|
-
scrollbarThumbHover: "#9ca3af",
|
|
1640
1628
|
// 悬停效果
|
|
1641
1629
|
hoverBackground: "#f9f9f9",
|
|
1642
1630
|
// 缩进线
|
|
@@ -1672,10 +1660,6 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1672
1660
|
syntaxNull: "#8b7355",
|
|
1673
1661
|
syntaxKey: "#4a3b2a",
|
|
1674
1662
|
syntaxBracket: "#6b5444",
|
|
1675
|
-
// 滚动条 - 暖色调
|
|
1676
|
-
scrollbarTrack: "#f4ede4",
|
|
1677
|
-
scrollbarThumb: "#e8d5b7",
|
|
1678
|
-
scrollbarThumbHover: "#d4c4a8",
|
|
1679
1663
|
// 悬停效果
|
|
1680
1664
|
hoverBackground: "#f8f2eb",
|
|
1681
1665
|
// 缩进线
|
|
@@ -1721,23 +1705,20 @@ const Lt = {
|
|
|
1721
1705
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
|
|
1722
1706
|
setup(r, { expose: e, emit: t }) {
|
|
1723
1707
|
Oe((d) => ({
|
|
1724
|
-
"
|
|
1725
|
-
"
|
|
1726
|
-
"
|
|
1727
|
-
"
|
|
1728
|
-
"
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
"
|
|
1734
|
-
"
|
|
1735
|
-
|
|
1736
|
-
"
|
|
1737
|
-
"
|
|
1738
|
-
"2c13c5fa": f.value.colors.scrollbarTrack,
|
|
1739
|
-
"2c1c44e4": f.value.colors.scrollbarThumb,
|
|
1740
|
-
"8ba97764": f.value.colors.scrollbarThumbHover
|
|
1708
|
+
"325d5f6b": f.value.colors.border,
|
|
1709
|
+
"407388ed": f.value.colors.background,
|
|
1710
|
+
"1276f42c": f.value.colors.text,
|
|
1711
|
+
"34805dc8": f.value.colors.surfaceBackground,
|
|
1712
|
+
"212f19fd": f.value.colors.buttonBorder,
|
|
1713
|
+
b83cab02: f.value.colors.buttonBackground,
|
|
1714
|
+
b58ba984: f.value.colors.buttonText,
|
|
1715
|
+
d50a3406: f.value.colors.buttonBackgroundHover,
|
|
1716
|
+
"2421bb5e": f.value.colors.buttonPrimary,
|
|
1717
|
+
"0299816b": f.value.colors.buttonPrimaryHover,
|
|
1718
|
+
"55f370f2": f.value.colors.successBackground,
|
|
1719
|
+
b3fc86b8: f.value.colors.success,
|
|
1720
|
+
"781064f7": f.value.colors.errorBackground,
|
|
1721
|
+
"3b9a02e9": f.value.colors.error
|
|
1741
1722
|
}));
|
|
1742
1723
|
const s = r, n = t, o = z(null), i = z(""), u = z(/* @__PURE__ */ new Set()), a = z(null), l = z(""), h = V(() => i.value === ""), f = V(() => Vt(s.theme)), b = V(() => l.value ? null : a.value !== null ? a.value : o.value), m = (d) => {
|
|
1743
1724
|
if (!d.trim()) {
|
|
@@ -1746,8 +1727,8 @@ const Lt = {
|
|
|
1746
1727
|
}
|
|
1747
1728
|
try {
|
|
1748
1729
|
let g = d;
|
|
1749
|
-
const
|
|
1750
|
-
if (!
|
|
1730
|
+
const k = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(g), N = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(g);
|
|
1731
|
+
if (!k && !N)
|
|
1751
1732
|
try {
|
|
1752
1733
|
o.value = JSON.parse(g), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1753
1734
|
b.value !== null && $();
|
|
@@ -1819,7 +1800,7 @@ const Lt = {
|
|
|
1819
1800
|
Xe(() => s.modelValue, (d) => {
|
|
1820
1801
|
m(d);
|
|
1821
1802
|
}, { immediate: !0 });
|
|
1822
|
-
const _ = (d, g,
|
|
1803
|
+
const _ = (d, g, k) => {
|
|
1823
1804
|
const N = (L) => {
|
|
1824
1805
|
if (L === null || typeof L != "object")
|
|
1825
1806
|
return L;
|
|
@@ -1832,17 +1813,17 @@ const Lt = {
|
|
|
1832
1813
|
K[q] = N(J);
|
|
1833
1814
|
return K;
|
|
1834
1815
|
}, C = N(d);
|
|
1835
|
-
return JSON.stringify(C, g,
|
|
1816
|
+
return JSON.stringify(C, g, k).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
|
|
1836
1817
|
}, j = (d, g) => {
|
|
1837
1818
|
if (!s.readonly)
|
|
1838
1819
|
try {
|
|
1839
|
-
const
|
|
1820
|
+
const k = H(o.value, d, g), N = _(k, null, 2);
|
|
1840
1821
|
n("update:modelValue", N);
|
|
1841
|
-
} catch (
|
|
1842
|
-
console.error("Failed to update JSON:",
|
|
1822
|
+
} catch (k) {
|
|
1823
|
+
console.error("Failed to update JSON:", k);
|
|
1843
1824
|
}
|
|
1844
|
-
}, H = (d, g,
|
|
1845
|
-
if (!g || g === "root") return
|
|
1825
|
+
}, H = (d, g, k) => {
|
|
1826
|
+
if (!g || g === "root") return k;
|
|
1846
1827
|
const N = g.split("."), C = Q(d, N.slice(0, -1));
|
|
1847
1828
|
let T = C;
|
|
1848
1829
|
for (let K = 0; K < N.length - 1; K++) {
|
|
@@ -1850,17 +1831,17 @@ const Lt = {
|
|
|
1850
1831
|
q !== "root" && (Array.isArray(T) ? T = T[parseInt(q)] : T = T[q]);
|
|
1851
1832
|
}
|
|
1852
1833
|
const L = N[N.length - 1];
|
|
1853
|
-
return L === "root" ?
|
|
1834
|
+
return L === "root" ? k : (Array.isArray(T) ? T[parseInt(L)] = k : T[L] = k, C);
|
|
1854
1835
|
}, p = (d) => {
|
|
1855
1836
|
u.value.has(d) ? u.value.delete(d) : u.value.add(d);
|
|
1856
1837
|
}, $ = () => {
|
|
1857
|
-
const d = /* @__PURE__ */ new Set(), g = (
|
|
1858
|
-
|
|
1838
|
+
const d = /* @__PURE__ */ new Set(), g = (k, N = "") => {
|
|
1839
|
+
k !== null && typeof k == "object" && (d.add(N || "root"), Array.isArray(k) ? k.forEach((C, T) => {
|
|
1859
1840
|
const L = N ? `${N}.${T}` : `${T}`;
|
|
1860
1841
|
g(C, L);
|
|
1861
|
-
}) : Object.keys(
|
|
1842
|
+
}) : Object.keys(k).forEach((C) => {
|
|
1862
1843
|
const T = N ? `${N}.${C}` : C;
|
|
1863
|
-
g(
|
|
1844
|
+
g(k[C], T);
|
|
1864
1845
|
}));
|
|
1865
1846
|
};
|
|
1866
1847
|
g(b.value), u.value = d, n("expand-all");
|
|
@@ -1892,17 +1873,17 @@ const Lt = {
|
|
|
1892
1873
|
}, Z = (d, g) => {
|
|
1893
1874
|
if (!s.readonly)
|
|
1894
1875
|
try {
|
|
1895
|
-
const
|
|
1876
|
+
const k = Y(o.value, d, g), N = _(k, null, 2);
|
|
1896
1877
|
n("update:modelValue", N), y(d, g);
|
|
1897
|
-
} catch (
|
|
1898
|
-
console.error("Failed to rename key:",
|
|
1878
|
+
} catch (k) {
|
|
1879
|
+
console.error("Failed to rename key:", k);
|
|
1899
1880
|
}
|
|
1900
|
-
}, Y = (d, g,
|
|
1881
|
+
}, Y = (d, g, k) => {
|
|
1901
1882
|
if (!g || g === "root") return d;
|
|
1902
1883
|
const N = g.split("."), C = Q(d, N.slice(0, -1));
|
|
1903
1884
|
if (N.length === 1) {
|
|
1904
1885
|
const K = N[0];
|
|
1905
|
-
return C && typeof C == "object" && !Array.isArray(C) ? ee(C, K,
|
|
1886
|
+
return C && typeof C == "object" && !Array.isArray(C) ? ee(C, K, k) : C;
|
|
1906
1887
|
}
|
|
1907
1888
|
let T = C;
|
|
1908
1889
|
for (let K = 0; K < N.length - 1; K++) {
|
|
@@ -1911,49 +1892,49 @@ const Lt = {
|
|
|
1911
1892
|
}
|
|
1912
1893
|
const L = N[N.length - 1];
|
|
1913
1894
|
if (!Array.isArray(T) && T && typeof T == "object") {
|
|
1914
|
-
const K = ee(T, L,
|
|
1895
|
+
const K = ee(T, L, k), q = N.slice(0, -1);
|
|
1915
1896
|
q.length > 0 && ae(C, q, K);
|
|
1916
1897
|
}
|
|
1917
1898
|
return C;
|
|
1918
1899
|
}, Q = (d, g) => {
|
|
1919
1900
|
if (g.length === 0) return d;
|
|
1920
1901
|
if (Array.isArray(d)) {
|
|
1921
|
-
const
|
|
1922
|
-
return g.length === 1 || (
|
|
1902
|
+
const k = [...d], N = g[0], C = parseInt(N);
|
|
1903
|
+
return g.length === 1 || (k[C] = Q(d[C], g.slice(1))), k;
|
|
1923
1904
|
} else if (d && typeof d == "object") {
|
|
1924
|
-
const
|
|
1925
|
-
return g.length === 1 || (
|
|
1905
|
+
const k = { ...d }, N = g[0];
|
|
1906
|
+
return g.length === 1 || (k[N] = Q(d[N], g.slice(1))), k;
|
|
1926
1907
|
}
|
|
1927
1908
|
return d;
|
|
1928
|
-
}, ee = (d, g,
|
|
1909
|
+
}, ee = (d, g, k) => {
|
|
1929
1910
|
if (!d || typeof d != "object" || Array.isArray(d))
|
|
1930
1911
|
return d;
|
|
1931
1912
|
const N = Object.keys(d), C = {};
|
|
1932
1913
|
for (const T of N)
|
|
1933
|
-
T === g ? C[
|
|
1914
|
+
T === g ? C[k] = d[T] : C[T] = d[T];
|
|
1934
1915
|
return C;
|
|
1935
|
-
}, ae = (d, g,
|
|
1916
|
+
}, ae = (d, g, k) => {
|
|
1936
1917
|
let N = d;
|
|
1937
1918
|
for (let T = 0; T < g.length - 1; T++) {
|
|
1938
1919
|
const L = g[T];
|
|
1939
1920
|
Array.isArray(N) ? N = N[parseInt(L)] : N = N[L];
|
|
1940
1921
|
}
|
|
1941
1922
|
const C = g[g.length - 1];
|
|
1942
|
-
Array.isArray(N) ? N[parseInt(C)] =
|
|
1923
|
+
Array.isArray(N) ? N[parseInt(C)] = k : N[C] = k;
|
|
1943
1924
|
}, y = (d, g) => {
|
|
1944
|
-
const
|
|
1925
|
+
const k = /* @__PURE__ */ new Set();
|
|
1945
1926
|
u.value.forEach((N) => {
|
|
1946
1927
|
if (N === d) {
|
|
1947
1928
|
const C = d.split(".");
|
|
1948
|
-
C[C.length - 1] = g,
|
|
1929
|
+
C[C.length - 1] = g, k.add(C.join("."));
|
|
1949
1930
|
} else if (N.startsWith(d + ".")) {
|
|
1950
1931
|
const C = d.split(".");
|
|
1951
1932
|
C[C.length - 1] = g;
|
|
1952
1933
|
const T = C.join("."), L = N.substring(d.length);
|
|
1953
|
-
|
|
1934
|
+
k.add(T + L);
|
|
1954
1935
|
} else
|
|
1955
|
-
|
|
1956
|
-
}), u.value =
|
|
1936
|
+
k.add(N);
|
|
1937
|
+
}), u.value = k;
|
|
1957
1938
|
};
|
|
1958
1939
|
return e({
|
|
1959
1940
|
// 核心操作方法
|
|
@@ -1977,10 +1958,10 @@ const Lt = {
|
|
|
1977
1958
|
// 工具方法
|
|
1978
1959
|
parseJson: (d) => m(d),
|
|
1979
1960
|
copyValue: (d) => X(d)
|
|
1980
|
-
}), (d, g) => (x(),
|
|
1961
|
+
}), (d, g) => (x(), A("div", {
|
|
1981
1962
|
class: Te(["json-format", `json-format--${f.value.name}`])
|
|
1982
1963
|
}, [
|
|
1983
|
-
d.showToolbar ? (x(),
|
|
1964
|
+
d.showToolbar ? (x(), A("div", Lt, [
|
|
1984
1965
|
v("div", Rt, [
|
|
1985
1966
|
v("button", {
|
|
1986
1967
|
class: "json-format__btn json-format__btn--primary",
|
|
@@ -2008,14 +1989,14 @@ const Lt = {
|
|
|
2008
1989
|
}, " 📦 Compress ", 8, Ft)
|
|
2009
1990
|
]),
|
|
2010
1991
|
v("div", Xt, [
|
|
2011
|
-
h.value ? (x(),
|
|
1992
|
+
h.value ? (x(), A("span", Ht, " ✅ Valid JSON ")) : (x(), A("span", Kt, " ❌ Invalid JSON "))
|
|
2012
1993
|
])
|
|
2013
1994
|
])) : F("", !0),
|
|
2014
1995
|
v("div", qt, [
|
|
2015
|
-
h.value ? l.value ? (x(),
|
|
1996
|
+
h.value ? l.value ? (x(), A("div", Qt, [
|
|
2016
1997
|
g[1] || (g[1] = v("h4", null, "Filter Error:", -1)),
|
|
2017
1998
|
v("pre", null, R(l.value), 1)
|
|
2018
|
-
])) : (x(),
|
|
1999
|
+
])) : (x(), A("div", Wt, [
|
|
2019
2000
|
Fe(Pt, {
|
|
2020
2001
|
value: b.value,
|
|
2021
2002
|
"key-name": "",
|
|
@@ -2028,14 +2009,14 @@ const Lt = {
|
|
|
2028
2009
|
onCopy: X,
|
|
2029
2010
|
"onUpdate:key": Z
|
|
2030
2011
|
}, null, 8, ["value", "expanded", "theme"])
|
|
2031
|
-
])) : (x(),
|
|
2012
|
+
])) : (x(), A("div", Yt, [
|
|
2032
2013
|
g[0] || (g[0] = v("h4", null, "JSON Parse Error:", -1)),
|
|
2033
2014
|
v("pre", null, R(i.value), 1)
|
|
2034
2015
|
]))
|
|
2035
2016
|
])
|
|
2036
2017
|
], 2));
|
|
2037
2018
|
}
|
|
2038
|
-
}), Zt = /* @__PURE__ */ be(Gt, [["__scopeId", "data-v-
|
|
2019
|
+
}), Zt = /* @__PURE__ */ be(Gt, [["__scopeId", "data-v-b956002c"]]), zt = {
|
|
2039
2020
|
key: 0,
|
|
2040
2021
|
class: "xml-node__comment"
|
|
2041
2022
|
}, Dt = {
|
|
@@ -2104,20 +2085,20 @@ const Lt = {
|
|
|
2104
2085
|
}, j = (p, $) => `${o.value}-child-${$}`, H = () => `${o.value}.${n.value}`;
|
|
2105
2086
|
return (p, $) => {
|
|
2106
2087
|
const E = Ue("XmlNode", !0);
|
|
2107
|
-
return x(),
|
|
2088
|
+
return x(), A("div", {
|
|
2108
2089
|
class: "xml-node",
|
|
2109
2090
|
style: P({ paddingLeft: p.level > 0 ? "16px" : "0" })
|
|
2110
2091
|
}, [
|
|
2111
|
-
u.value === "comment" ? (x(),
|
|
2092
|
+
u.value === "comment" ? (x(), A("div", zt, [
|
|
2112
2093
|
v("span", {
|
|
2113
2094
|
style: P({ color: p.theme.colors.xmlComment })
|
|
2114
2095
|
}, " <!-- " + R(m.value) + " --> ", 5)
|
|
2115
|
-
])) : u.value === "cdata" ? (x(),
|
|
2096
|
+
])) : u.value === "cdata" ? (x(), A("div", Dt, [
|
|
2116
2097
|
v("span", {
|
|
2117
2098
|
style: P({ color: p.theme.colors.xmlCdata })
|
|
2118
2099
|
}, " <![CDATA[" + R(p.node.__cdata) + "]]> ", 5)
|
|
2119
|
-
])) : u.value === "element" ? (x(),
|
|
2120
|
-
h.value ? (x(),
|
|
2100
|
+
])) : u.value === "element" ? (x(), A("div", Jt, [
|
|
2101
|
+
h.value ? (x(), A("div", er, [
|
|
2121
2102
|
v("span", {
|
|
2122
2103
|
class: "xml-node__bracket",
|
|
2123
2104
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
@@ -2126,7 +2107,7 @@ const Lt = {
|
|
|
2126
2107
|
class: "xml-node__tag",
|
|
2127
2108
|
style: P({ color: p.theme.colors.xmlTag })
|
|
2128
2109
|
}, R(n.value), 5),
|
|
2129
|
-
(x(!0),
|
|
2110
|
+
(x(!0), A(de, null, fe(a.value, (O, I) => (x(), A("span", {
|
|
2130
2111
|
key: I,
|
|
2131
2112
|
class: "xml-node__attribute"
|
|
2132
2113
|
}, [
|
|
@@ -2171,7 +2152,7 @@ const Lt = {
|
|
|
2171
2152
|
class: "xml-node__bracket",
|
|
2172
2153
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
2173
2154
|
}, ">", 4)
|
|
2174
|
-
])) : S.value ? (x(),
|
|
2155
|
+
])) : S.value ? (x(), A("div", tr, [
|
|
2175
2156
|
v("span", {
|
|
2176
2157
|
class: "xml-node__bracket",
|
|
2177
2158
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
@@ -2180,7 +2161,7 @@ const Lt = {
|
|
|
2180
2161
|
class: "xml-node__tag",
|
|
2181
2162
|
style: P({ color: p.theme.colors.xmlTag })
|
|
2182
2163
|
}, R(n.value), 5),
|
|
2183
|
-
(x(!0),
|
|
2164
|
+
(x(!0), A(de, null, fe(a.value, (O, I) => (x(), A("span", {
|
|
2184
2165
|
key: I,
|
|
2185
2166
|
class: "xml-node__attribute"
|
|
2186
2167
|
}, [
|
|
@@ -2225,9 +2206,9 @@ const Lt = {
|
|
|
2225
2206
|
class: "xml-node__bracket",
|
|
2226
2207
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
2227
2208
|
}, ">", 4)
|
|
2228
|
-
])) : (x(),
|
|
2209
|
+
])) : (x(), A("div", rr, [
|
|
2229
2210
|
v("div", nr, [
|
|
2230
|
-
w.value ? (x(),
|
|
2211
|
+
w.value ? (x(), A("span", {
|
|
2231
2212
|
key: 0,
|
|
2232
2213
|
class: "xml-node__clickable-part",
|
|
2233
2214
|
onClick: $[0] || ($[0] = (O) => _()),
|
|
@@ -2241,7 +2222,7 @@ const Lt = {
|
|
|
2241
2222
|
class: "xml-node__tag",
|
|
2242
2223
|
style: P({ color: p.theme.colors.xmlTag })
|
|
2243
2224
|
}, R(n.value), 5)
|
|
2244
|
-
], 8, sr)) : (x(),
|
|
2225
|
+
], 8, sr)) : (x(), A("span", or, [
|
|
2245
2226
|
v("span", {
|
|
2246
2227
|
class: "xml-node__bracket",
|
|
2247
2228
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
@@ -2251,7 +2232,7 @@ const Lt = {
|
|
|
2251
2232
|
style: P({ color: p.theme.colors.xmlTag })
|
|
2252
2233
|
}, R(n.value), 5)
|
|
2253
2234
|
])),
|
|
2254
|
-
(x(!0),
|
|
2235
|
+
(x(!0), A(de, null, fe(a.value, (O, I) => (x(), A("span", {
|
|
2255
2236
|
key: I,
|
|
2256
2237
|
class: "xml-node__attribute"
|
|
2257
2238
|
}, [
|
|
@@ -2276,7 +2257,7 @@ const Lt = {
|
|
|
2276
2257
|
style: P({ color: p.theme.colors.xmlQuote })
|
|
2277
2258
|
}, '"', 4)
|
|
2278
2259
|
]))), 128)),
|
|
2279
|
-
w.value ? (x(),
|
|
2260
|
+
w.value ? (x(), A("span", {
|
|
2280
2261
|
key: 2,
|
|
2281
2262
|
class: "xml-node__clickable-part",
|
|
2282
2263
|
onClick: $[1] || ($[1] = (O) => _()),
|
|
@@ -2286,12 +2267,12 @@ const Lt = {
|
|
|
2286
2267
|
class: "xml-node__bracket",
|
|
2287
2268
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
2288
2269
|
}, ">", 4)
|
|
2289
|
-
], 8, ir)) : (x(),
|
|
2270
|
+
], 8, ir)) : (x(), A("span", {
|
|
2290
2271
|
key: 3,
|
|
2291
2272
|
class: "xml-node__bracket",
|
|
2292
2273
|
style: P({ color: p.theme.colors.xmlBracket })
|
|
2293
2274
|
}, R(w.value ? ">" : "/>"), 5)),
|
|
2294
|
-
!i.value && w.value ? (x(),
|
|
2275
|
+
!i.value && w.value ? (x(), A("span", {
|
|
2295
2276
|
key: 4,
|
|
2296
2277
|
class: "xml-node__collapsed xml-node__collapsed--clickable",
|
|
2297
2278
|
style: P({ color: p.theme.colors.textSecondary }),
|
|
@@ -2299,14 +2280,14 @@ const Lt = {
|
|
|
2299
2280
|
title: "Click to expand"
|
|
2300
2281
|
}, "...", 4)) : F("", !0)
|
|
2301
2282
|
]),
|
|
2302
|
-
i.value && w.value ? (x(),
|
|
2303
|
-
l.value.length === 0 && b.value.trim() ? (x(),
|
|
2283
|
+
i.value && w.value ? (x(), A("div", ar, [
|
|
2284
|
+
l.value.length === 0 && b.value.trim() ? (x(), A("div", lr, [
|
|
2304
2285
|
v("span", {
|
|
2305
2286
|
class: "xml-node__text-content",
|
|
2306
2287
|
style: P({ color: p.theme.colors.xmlText })
|
|
2307
2288
|
}, R(b.value), 5)
|
|
2308
2289
|
])) : F("", !0),
|
|
2309
|
-
(x(!0),
|
|
2290
|
+
(x(!0), A(de, null, fe(l.value, (O, I) => (x(), He(E, {
|
|
2310
2291
|
key: j(O, I),
|
|
2311
2292
|
node: O,
|
|
2312
2293
|
index: I,
|
|
@@ -2318,7 +2299,7 @@ const Lt = {
|
|
|
2318
2299
|
onCopy: $[4] || ($[4] = (X) => p.$emit("copy", X))
|
|
2319
2300
|
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2320
2301
|
])) : F("", !0),
|
|
2321
|
-
i.value && w.value ? (x(),
|
|
2302
|
+
i.value && w.value ? (x(), A("div", ur, [
|
|
2322
2303
|
v("span", {
|
|
2323
2304
|
class: "xml-node__clickable-part",
|
|
2324
2305
|
onClick: $[5] || ($[5] = (O) => _()),
|
|
@@ -2578,7 +2559,7 @@ function Qe(r, e) {
|
|
|
2578
2559
|
let f;
|
|
2579
2560
|
return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", U("InvalidTag", f, W(r, o));
|
|
2580
2561
|
}
|
|
2581
|
-
const l =
|
|
2562
|
+
const l = Ar(r, o);
|
|
2582
2563
|
if (l === !1)
|
|
2583
2564
|
return U("InvalidAttr", "Attributes for '" + a + "' have open quote.", W(r, o));
|
|
2584
2565
|
let h = l.value;
|
|
@@ -2691,7 +2672,7 @@ function Re(r, e) {
|
|
|
2691
2672
|
return e;
|
|
2692
2673
|
}
|
|
2693
2674
|
const xr = '"', Nr = "'";
|
|
2694
|
-
function
|
|
2675
|
+
function Ar(r, e) {
|
|
2695
2676
|
let t = "", s = "", n = !1;
|
|
2696
2677
|
for (; e < r.length; e++) {
|
|
2697
2678
|
if (r[e] === xr || r[e] === Nr)
|
|
@@ -2708,9 +2689,9 @@ function kr(r, e) {
|
|
|
2708
2689
|
tagClosed: n
|
|
2709
2690
|
};
|
|
2710
2691
|
}
|
|
2711
|
-
const
|
|
2692
|
+
const kr = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
2712
2693
|
function je(r, e) {
|
|
2713
|
-
const t = Ye(r,
|
|
2694
|
+
const t = Ye(r, kr), s = {};
|
|
2714
2695
|
for (let n = 0; n < t.length; n++) {
|
|
2715
2696
|
if (t[n][1].length === 0)
|
|
2716
2697
|
return U("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", pe(t[n]));
|
|
@@ -3369,7 +3350,7 @@ function Ce(r, e, t) {
|
|
|
3369
3350
|
} else
|
|
3370
3351
|
return Er(r) ? r : "";
|
|
3371
3352
|
}
|
|
3372
|
-
const
|
|
3353
|
+
const Ae = oe.getMetaDataSymbol();
|
|
3373
3354
|
function en(r, e) {
|
|
3374
3355
|
return Ge(r, e);
|
|
3375
3356
|
}
|
|
@@ -3387,7 +3368,7 @@ function Ge(r, e, t) {
|
|
|
3387
3368
|
if (i[u]) {
|
|
3388
3369
|
let l = Ge(i[u], e, a);
|
|
3389
3370
|
const h = nn(l, e);
|
|
3390
|
-
i[
|
|
3371
|
+
i[Ae] !== void 0 && (l[Ae] = i[Ae]), i[":@"] ? rn(l, i[":@"], a, e) : Object.keys(l).length === 1 && l[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? l = l[e.textNodeName] : Object.keys(l).length === 0 && (e.alwaysCreateTextNode ? l[e.textNodeName] = "" : l = ""), n[u] !== void 0 && n.hasOwnProperty(u) ? (Array.isArray(n[u]) || (n[u] = [n[u]]), n[u].push(l)) : e.isArray(u, a, h) ? n[u] = [l] : n[u] = l;
|
|
3391
3372
|
}
|
|
3392
3373
|
}
|
|
3393
3374
|
}
|
|
@@ -3812,7 +3793,7 @@ const pn = {
|
|
|
3812
3793
|
}, En = {
|
|
3813
3794
|
key: 0,
|
|
3814
3795
|
class: "xml-format__toolbar"
|
|
3815
|
-
}, _n = { class: "xml-format__actions" }, xn = ["disabled"], Nn = ["disabled"],
|
|
3796
|
+
}, _n = { class: "xml-format__actions" }, xn = ["disabled"], Nn = ["disabled"], An = ["disabled"], kn = ["disabled"], wn = ["disabled"], Cn = { class: "xml-format__info" }, On = {
|
|
3816
3797
|
key: 0,
|
|
3817
3798
|
class: "xml-format__status xml-format__status--success"
|
|
3818
3799
|
}, Tn = {
|
|
@@ -3956,10 +3937,10 @@ const pn = {
|
|
|
3956
3937
|
// 工具方法
|
|
3957
3938
|
parseXmlString: (E) => m(E),
|
|
3958
3939
|
copyValue: (E) => $(E)
|
|
3959
|
-
}), (E, O) => (x(),
|
|
3940
|
+
}), (E, O) => (x(), A("div", {
|
|
3960
3941
|
class: Te(["xml-format", `xml-format--${l.value.name}`])
|
|
3961
3942
|
}, [
|
|
3962
|
-
E.showToolbar ? (x(),
|
|
3943
|
+
E.showToolbar ? (x(), A("div", En, [
|
|
3963
3944
|
v("div", _n, [
|
|
3964
3945
|
v("button", {
|
|
3965
3946
|
class: "xml-format__btn xml-format__btn--primary",
|
|
@@ -3978,13 +3959,13 @@ const pn = {
|
|
|
3978
3959
|
onClick: _,
|
|
3979
3960
|
disabled: !a.value,
|
|
3980
3961
|
title: "Collapse All"
|
|
3981
|
-
}, " ➡️ Collapse All ", 8,
|
|
3962
|
+
}, " ➡️ Collapse All ", 8, An),
|
|
3982
3963
|
v("button", {
|
|
3983
3964
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3984
3965
|
onClick: H,
|
|
3985
3966
|
disabled: !a.value,
|
|
3986
3967
|
title: "Compress XML"
|
|
3987
|
-
}, " 📦 Compress ", 8,
|
|
3968
|
+
}, " 📦 Compress ", 8, kn),
|
|
3988
3969
|
v("button", {
|
|
3989
3970
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3990
3971
|
onClick: p,
|
|
@@ -3993,17 +3974,17 @@ const pn = {
|
|
|
3993
3974
|
}, " ✨ Format ", 8, wn)
|
|
3994
3975
|
]),
|
|
3995
3976
|
v("div", Cn, [
|
|
3996
|
-
a.value ? (x(),
|
|
3977
|
+
a.value ? (x(), A("span", On, " ✅ Valid XML ")) : (x(), A("span", Tn, " ❌ Invalid XML "))
|
|
3997
3978
|
])
|
|
3998
3979
|
])) : F("", !0),
|
|
3999
3980
|
v("div", Pn, [
|
|
4000
|
-
a.value ? (x(),
|
|
4001
|
-
f.value ? (x(),
|
|
3981
|
+
a.value ? (x(), A("div", Sn, [
|
|
3982
|
+
f.value ? (x(), A("div", {
|
|
4002
3983
|
key: 0,
|
|
4003
3984
|
class: "xml-declaration",
|
|
4004
3985
|
style: P({ color: l.value.colors.xmlDeclaration })
|
|
4005
3986
|
}, R(f.value), 5)) : F("", !0),
|
|
4006
|
-
(x(!0),
|
|
3987
|
+
(x(!0), A(de, null, fe(b.value, (I, X) => (x(), He(dr, {
|
|
4007
3988
|
key: X,
|
|
4008
3989
|
node: I,
|
|
4009
3990
|
index: X,
|
|
@@ -4013,7 +3994,7 @@ const pn = {
|
|
|
4013
3994
|
onToggleExpand: w,
|
|
4014
3995
|
onCopy: $
|
|
4015
3996
|
}, null, 8, ["node", "index", "expanded", "theme"]))), 128))
|
|
4016
|
-
])) : (x(),
|
|
3997
|
+
])) : (x(), A("div", $n, [
|
|
4017
3998
|
O[0] || (O[0] = v("h4", null, "XML Parse Error:", -1)),
|
|
4018
3999
|
v("pre", null, R(i.value), 1)
|
|
4019
4000
|
]))
|