lone-format 0.15.0 → 0.16.1
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/_chunks/{index-Deb34Mk7.js → index-Bc-10qZH.js} +247 -196
- package/dist/_chunks/index-C958jkzh.js +853 -0
- package/dist/_chunks/{index-BAEkF-Fh.js → index-Du4VL__q.js} +527 -470
- package/dist/components/JsonFormat/index.js +1 -1
- package/dist/components/JsonFormat/protectedNumber.d.ts +10 -0
- package/dist/components/JsonFormat/themes.d.ts +4 -0
- package/dist/components/JsonFormat/types.d.ts +1 -1
- package/dist/components/SqlFormat/index.js +1 -1
- package/dist/components/SqlFormat/themes.d.ts +5 -1
- package/dist/components/SqlFormat/types.d.ts +1 -1
- package/dist/components/XmlFormat/index.js +17 -16
- package/dist/components/XmlFormat/themes.d.ts +5 -1
- package/dist/components/XmlFormat/types.d.ts +1 -1
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +3 -3
- package/dist/lone-format.umd.cjs +48 -48
- package/package.json +1 -1
- package/dist/_chunks/index-AlOFzpXl.js +0 -795
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as Ce, useCssVars as $e, ref as I, computed as L, resolveComponent as De, createElementBlock as w, openBlock as $, normalizeStyle as c, createCommentVNode as pe, createElementVNode as
|
|
1
|
+
import { defineComponent as Ce, useCssVars as $e, ref as I, computed as L, resolveComponent as De, createElementBlock as w, openBlock as $, normalizeStyle as c, createCommentVNode as pe, createElementVNode as o, toDisplayString as D, withKeys as A, withModifiers as q, Fragment as re, renderList as ie, createBlock as Be, nextTick as ae, watch as Ee, normalizeClass as Ve } from "vue";
|
|
2
2
|
import We from "xpath";
|
|
3
3
|
import { DOMParser as Ke, XMLSerializer as Xe } from "@xmldom/xmldom";
|
|
4
4
|
import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
-
import { XMLValidator as
|
|
5
|
+
import { XMLValidator as Pe, XMLParser as Oe, XMLBuilder as Ne } from "fast-xml-parser";
|
|
6
6
|
const Re = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "xml-node__comment"
|
|
9
|
-
},
|
|
9
|
+
}, qe = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "xml-node__cdata"
|
|
12
|
-
},
|
|
12
|
+
}, je = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "xml-node__element"
|
|
15
15
|
}, Ie = {
|
|
@@ -24,13 +24,13 @@ const Re = {
|
|
|
24
24
|
}, Ge = ["contenteditable", "onKeydown"], Ye = ["contenteditable", "onDblclick", "onKeydown"], et = ["contenteditable", "onDblclick", "onKeydown"], tt = {
|
|
25
25
|
key: 3,
|
|
26
26
|
class: "xml-node__line"
|
|
27
|
-
}, lt = ["contenteditable", "onKeydown"], at = ["contenteditable", "onDblclick", "onKeydown"],
|
|
27
|
+
}, lt = ["contenteditable", "onKeydown"], at = ["contenteditable", "onDblclick", "onKeydown"], ot = ["contenteditable", "onDblclick", "onKeydown"], nt = { key: 4 }, rt = {
|
|
28
28
|
key: 0,
|
|
29
29
|
class: "xml-node__line"
|
|
30
|
-
},
|
|
30
|
+
}, st = ["contenteditable", "onKeydown"], ct = ["contenteditable", "onDblclick", "onKeydown"], it = ["contenteditable", "onDblclick", "onKeydown"], ut = ["title"], dt = { class: "xml-node__line" }, mt = ["title"], ft = ["contenteditable", "onKeydown"], vt = { key: 1 }, pt = ["contenteditable", "onKeydown"], yt = ["contenteditable", "onDblclick", "onKeydown"], bt = ["contenteditable", "onDblclick", "onKeydown"], ht = ["title"], xt = {
|
|
31
31
|
key: 0,
|
|
32
32
|
class: "xml-node__children"
|
|
33
|
-
},
|
|
33
|
+
}, _t = {
|
|
34
34
|
key: 0,
|
|
35
35
|
class: "xml-node__text"
|
|
36
36
|
}, gt = ["contenteditable", "onKeydown"], kt = {
|
|
@@ -48,103 +48,103 @@ const Re = {
|
|
|
48
48
|
selfClosingTags: { default: () => /* @__PURE__ */ new Set() }
|
|
49
49
|
},
|
|
50
50
|
emits: ["toggle-expand", "copy", "update:tagName", "update:attributeName", "update:attributeValue", "update:textContent", "update:cdataContent"],
|
|
51
|
-
setup(
|
|
51
|
+
setup(r, { emit: m }) {
|
|
52
52
|
$e((e) => ({
|
|
53
53
|
"451d9899": e.theme.colors.collapsedText,
|
|
54
54
|
"6296679a": e.theme.colors.collapsedBackground,
|
|
55
55
|
cd71bc7c: e.theme.colors.collapsedBackgroundHover,
|
|
56
56
|
"30a02a6b": e.theme.colors.indentLine
|
|
57
57
|
}));
|
|
58
|
-
const i =
|
|
59
|
-
const e = i.node[":@"] || {},
|
|
58
|
+
const i = r, p = m, y = I(!1), n = I(null), b = I(null), E = I(!1), B = I(!1), _ = I(""), h = I(""), X = I(""), P = I(""), S = I(""), O = I(null), z = I(null), Q = I(null), U = I(null), Y = I(null), K = L(() => Object.keys(i.node).find((s) => !s.startsWith(":") && !s.startsWith("#")) || ""), J = L(() => K.value ? i.parentPath ? `${i.parentPath}.${K.value}[${i.index}]` : `${K.value}[${i.index}]` : ""), ee = L(() => i.expanded.has(J.value)), T = L(() => i.node["#comment"] ? "comment" : i.node.__cdata ? "cdata" : K.value ? "element" : "unknown"), R = L(() => {
|
|
59
|
+
const e = i.node[":@"] || {}, s = {};
|
|
60
60
|
return Object.keys(e).forEach((M) => {
|
|
61
|
-
M.startsWith("@_") && (
|
|
62
|
-
}),
|
|
61
|
+
M.startsWith("@_") && (s[M.substring(2)] = e[M]);
|
|
62
|
+
}), s;
|
|
63
63
|
}), G = L(() => {
|
|
64
64
|
if (T.value !== "element" || !K.value) return [];
|
|
65
65
|
const e = i.node[K.value];
|
|
66
66
|
return Array.isArray(e) ? e : [];
|
|
67
67
|
}), ue = L(() => G.value.some((e) => e.__cdata)), de = L(() => {
|
|
68
68
|
if (!ue.value) return "";
|
|
69
|
-
const e = G.value.find((
|
|
69
|
+
const e = G.value.find((s) => s.__cdata);
|
|
70
70
|
if (e && Array.isArray(e.__cdata)) {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
71
|
+
const s = e.__cdata;
|
|
72
|
+
if (s.length > 0 && s[0]["#text"])
|
|
73
|
+
return s[0]["#text"];
|
|
74
74
|
}
|
|
75
75
|
return "";
|
|
76
76
|
}), te = L(() => {
|
|
77
77
|
if (T.value !== "element" || !K.value || ue.value) return "";
|
|
78
78
|
const e = i.node[K.value];
|
|
79
79
|
if (!Array.isArray(e)) return "";
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
}),
|
|
80
|
+
const s = e.find((M) => M["#text"]);
|
|
81
|
+
return s ? s["#text"] : "";
|
|
82
|
+
}), be = L(() => {
|
|
83
83
|
if (T.value !== "comment") return "";
|
|
84
84
|
const e = i.node["#comment"];
|
|
85
85
|
return Array.isArray(e) && e.length > 0 && e[0]["#text"] || "";
|
|
86
|
-
}), Z = L(() => G.value.some((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":")))), me = L(() => Z.value ? G.value.filter((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":"))).length : 0),
|
|
86
|
+
}), Z = L(() => G.value.some((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":")))), me = L(() => Z.value ? G.value.filter((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":"))).length : 0), he = L(() => T.value === "element" && !Z.value && te.value !== ""), fe = L(() => T.value === "element" && !Z.value && te.value === ""), ye = L(() => fe.value ? i.node[":selfClosing"] === !0 : !1), oe = () => {
|
|
87
87
|
Z.value && p("toggle-expand", J.value);
|
|
88
|
-
},
|
|
89
|
-
y.value = !0,
|
|
90
|
-
if (
|
|
91
|
-
|
|
88
|
+
}, xe = (e, s) => `${J.value}-child-${s}`, _e = () => `${J.value}.${K.value}`, le = () => {
|
|
89
|
+
y.value = !0, _.value = K.value, ae(() => {
|
|
90
|
+
if (O.value) {
|
|
91
|
+
O.value.focus();
|
|
92
92
|
const e = document.createRange();
|
|
93
|
-
e.selectNodeContents(
|
|
94
|
-
const
|
|
95
|
-
|
|
93
|
+
e.selectNodeContents(O.value);
|
|
94
|
+
const s = window.getSelection();
|
|
95
|
+
s?.removeAllRanges(), s?.addRange(e);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
}, ce = (e) => {
|
|
99
|
-
|
|
99
|
+
n.value = e, h.value = e, ae(() => {
|
|
100
100
|
if (z.value) {
|
|
101
101
|
z.value.focus();
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const s = document.createRange();
|
|
103
|
+
s.selectNodeContents(z.value);
|
|
104
104
|
const M = window.getSelection();
|
|
105
|
-
M?.removeAllRanges(), M?.addRange(
|
|
105
|
+
M?.removeAllRanges(), M?.addRange(s);
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}, t = (e) => {
|
|
109
|
-
|
|
109
|
+
b.value = e, X.value = R.value[e] || "", ae(() => {
|
|
110
110
|
if (Q.value) {
|
|
111
111
|
Q.value.focus();
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
const s = document.createRange();
|
|
113
|
+
s.selectNodeContents(Q.value);
|
|
114
114
|
const M = window.getSelection();
|
|
115
|
-
M?.removeAllRanges(), M?.addRange(
|
|
115
|
+
M?.removeAllRanges(), M?.addRange(s);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}, d = () => {
|
|
119
|
-
E.value = !0,
|
|
119
|
+
E.value = !0, P.value = te.value, ae(() => {
|
|
120
120
|
if (U.value) {
|
|
121
121
|
U.value.focus();
|
|
122
122
|
const e = document.createRange();
|
|
123
123
|
e.selectNodeContents(U.value);
|
|
124
|
-
const
|
|
125
|
-
|
|
124
|
+
const s = window.getSelection();
|
|
125
|
+
s?.removeAllRanges(), s?.addRange(e);
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}, f = () => {
|
|
129
129
|
if (!y.value) return;
|
|
130
|
-
const e =
|
|
130
|
+
const e = O.value?.innerText.trim() || "";
|
|
131
131
|
if (!e || e === K.value) {
|
|
132
132
|
y.value = !1;
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
y.value = !1, p("update:tagName", J.value, K.value, e);
|
|
136
136
|
}, l = () => {
|
|
137
|
-
if (!
|
|
138
|
-
const e =
|
|
139
|
-
if (!
|
|
140
|
-
|
|
137
|
+
if (!n.value) return;
|
|
138
|
+
const e = n.value, s = z.value?.innerText.trim() || "";
|
|
139
|
+
if (!s || s === e) {
|
|
140
|
+
n.value = null;
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
n.value = null, p("update:attributeName", J.value, e, s);
|
|
144
144
|
}, a = () => {
|
|
145
|
-
if (!
|
|
146
|
-
const e =
|
|
147
|
-
|
|
145
|
+
if (!b.value) return;
|
|
146
|
+
const e = b.value, s = Q.value?.innerText.trim() || "";
|
|
147
|
+
b.value = null, p("update:attributeValue", J.value, e, s);
|
|
148
148
|
}, g = () => {
|
|
149
149
|
if (!E.value) return;
|
|
150
150
|
const e = U.value?.innerText || "";
|
|
@@ -154,24 +154,24 @@ const Re = {
|
|
|
154
154
|
}
|
|
155
155
|
E.value = !1, p("update:textContent", J.value, e);
|
|
156
156
|
}, v = () => {
|
|
157
|
-
y.value = !1,
|
|
157
|
+
y.value = !1, _.value = K.value;
|
|
158
158
|
}, C = () => {
|
|
159
|
-
|
|
159
|
+
n.value && (h.value = n.value, n.value = null);
|
|
160
160
|
}, k = () => {
|
|
161
|
-
|
|
161
|
+
b.value && (X.value = R.value[b.value] || "", b.value = null);
|
|
162
162
|
}, N = () => {
|
|
163
|
-
E.value = !1,
|
|
163
|
+
E.value = !1, P.value = te.value;
|
|
164
164
|
}, W = () => {
|
|
165
165
|
B.value = !0, S.value = de.value, ae(() => {
|
|
166
166
|
if (Y.value) {
|
|
167
167
|
Y.value.focus();
|
|
168
168
|
const e = document.createRange();
|
|
169
169
|
e.selectNodeContents(Y.value);
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
const s = window.getSelection();
|
|
171
|
+
s?.removeAllRanges(), s?.addRange(e);
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
-
},
|
|
174
|
+
}, j = () => {
|
|
175
175
|
if (!B.value) return;
|
|
176
176
|
const e = Y.value?.innerText || "";
|
|
177
177
|
if (e === de.value) {
|
|
@@ -184,582 +184,582 @@ const Re = {
|
|
|
184
184
|
}, H = (e) => {
|
|
185
185
|
Z.value && (e.preventDefault(), le());
|
|
186
186
|
};
|
|
187
|
-
return (e,
|
|
187
|
+
return (e, s) => {
|
|
188
188
|
const M = De("XmlNode", !0);
|
|
189
189
|
return $(), w("div", {
|
|
190
190
|
class: "xml-node",
|
|
191
191
|
style: c({ paddingLeft: e.level > 0 ? "16px" : "0" })
|
|
192
192
|
}, [
|
|
193
193
|
T.value === "comment" ? ($(), w("div", Re, [
|
|
194
|
-
|
|
194
|
+
o("span", {
|
|
195
195
|
style: c({ color: e.theme.colors.xmlComment })
|
|
196
|
-
}, " <!-- " + D(
|
|
197
|
-
])) : T.value === "cdata" ? ($(), w("div",
|
|
198
|
-
|
|
196
|
+
}, " <!-- " + D(be.value) + " --> ", 5)
|
|
197
|
+
])) : T.value === "cdata" ? ($(), w("div", qe, [
|
|
198
|
+
o("span", {
|
|
199
199
|
style: c({ color: e.theme.colors.xmlCdata })
|
|
200
200
|
}, " <![CDATA[" + D(e.node.__cdata) + "]]> ", 5)
|
|
201
|
-
])) : T.value === "element" ? ($(), w("div",
|
|
201
|
+
])) : T.value === "element" ? ($(), w("div", je, [
|
|
202
202
|
ue.value ? ($(), w("div", Ie, [
|
|
203
|
-
|
|
203
|
+
o("span", {
|
|
204
204
|
class: "xml-node__bracket",
|
|
205
205
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
206
206
|
}, "<", 4),
|
|
207
|
-
|
|
207
|
+
o("span", {
|
|
208
208
|
class: "xml-node__tag xml-node__tag--editable",
|
|
209
209
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
210
210
|
contenteditable: y.value,
|
|
211
211
|
onDblclick: le,
|
|
212
212
|
onContextmenu: H,
|
|
213
213
|
onKeydown: [
|
|
214
|
-
A(
|
|
214
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
215
215
|
A(v, ["escape"])
|
|
216
216
|
],
|
|
217
217
|
onBlur: f,
|
|
218
218
|
ref_key: "tagNameRef",
|
|
219
|
-
ref:
|
|
219
|
+
ref: O,
|
|
220
220
|
title: "Double-click to edit tag name"
|
|
221
|
-
}, D(y.value ?
|
|
222
|
-
($(!0), w(
|
|
221
|
+
}, D(y.value ? _.value : K.value), 45, Le),
|
|
222
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
223
223
|
key: u,
|
|
224
224
|
class: "xml-node__attribute"
|
|
225
225
|
}, [
|
|
226
|
-
|
|
226
|
+
o("span", {
|
|
227
227
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
228
228
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
229
|
-
contenteditable:
|
|
230
|
-
onDblclick: (
|
|
229
|
+
contenteditable: n.value === u,
|
|
230
|
+
onDblclick: (x) => ce(u),
|
|
231
231
|
onKeydown: [
|
|
232
|
-
A(
|
|
232
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
233
233
|
A(C, ["escape"])
|
|
234
234
|
],
|
|
235
235
|
onBlur: l,
|
|
236
236
|
ref_for: !0,
|
|
237
|
-
ref: (
|
|
238
|
-
|
|
237
|
+
ref: (x) => {
|
|
238
|
+
n.value === u && (z.value = x);
|
|
239
239
|
},
|
|
240
240
|
title: "Double-click to edit attribute name"
|
|
241
|
-
}, D(
|
|
242
|
-
|
|
241
|
+
}, D(n.value === u ? h.value : u), 45, Ue),
|
|
242
|
+
o("span", {
|
|
243
243
|
class: "xml-node__equals",
|
|
244
244
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
245
245
|
}, "=", 4),
|
|
246
|
-
|
|
246
|
+
o("span", {
|
|
247
247
|
class: "xml-node__quote",
|
|
248
248
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
249
249
|
}, '"', 4),
|
|
250
|
-
|
|
250
|
+
o("span", {
|
|
251
251
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
252
252
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
253
|
-
contenteditable:
|
|
254
|
-
onDblclick: (
|
|
253
|
+
contenteditable: b.value === u,
|
|
254
|
+
onDblclick: (x) => t(u),
|
|
255
255
|
onKeydown: [
|
|
256
|
-
A(
|
|
256
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
257
257
|
A(k, ["escape"])
|
|
258
258
|
],
|
|
259
259
|
onBlur: a,
|
|
260
260
|
ref_for: !0,
|
|
261
|
-
ref: (
|
|
262
|
-
|
|
261
|
+
ref: (x) => {
|
|
262
|
+
b.value === u && (Q.value = x);
|
|
263
263
|
},
|
|
264
264
|
title: "Double-click to edit attribute value"
|
|
265
|
-
}, D(
|
|
266
|
-
|
|
265
|
+
}, D(b.value === u ? X.value : F), 45, Fe),
|
|
266
|
+
o("span", {
|
|
267
267
|
class: "xml-node__quote",
|
|
268
268
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
269
269
|
}, '"', 4)
|
|
270
270
|
]))), 128)),
|
|
271
|
-
|
|
271
|
+
o("span", {
|
|
272
272
|
class: "xml-node__bracket",
|
|
273
273
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
274
274
|
}, ">", 4),
|
|
275
|
-
|
|
275
|
+
o("span", {
|
|
276
276
|
class: "xml-node__cdata",
|
|
277
277
|
style: c({ color: e.theme.colors.xmlCdata })
|
|
278
278
|
}, "<![CDATA[", 4),
|
|
279
|
-
|
|
279
|
+
o("span", {
|
|
280
280
|
class: "xml-node__cdata-content xml-node__cdata-content--editable",
|
|
281
281
|
style: c({ color: e.theme.colors.xmlCdata }),
|
|
282
282
|
contenteditable: B.value,
|
|
283
283
|
onDblclick: W,
|
|
284
284
|
onKeydown: [
|
|
285
|
-
A(j
|
|
285
|
+
A(q(j, ["prevent"]), ["enter"]),
|
|
286
286
|
A(V, ["escape"])
|
|
287
287
|
],
|
|
288
|
-
onBlur:
|
|
288
|
+
onBlur: j,
|
|
289
289
|
ref_key: "cdataContentRef",
|
|
290
290
|
ref: Y,
|
|
291
291
|
title: "Double-click to edit CDATA content"
|
|
292
292
|
}, D(B.value ? S.value : de.value), 45, Me),
|
|
293
|
-
|
|
293
|
+
o("span", {
|
|
294
294
|
class: "xml-node__cdata",
|
|
295
295
|
style: c({ color: e.theme.colors.xmlCdata })
|
|
296
296
|
}, "]]>", 4),
|
|
297
|
-
|
|
297
|
+
o("span", {
|
|
298
298
|
class: "xml-node__bracket",
|
|
299
299
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
300
300
|
}, "</", 4),
|
|
301
|
-
|
|
301
|
+
o("span", {
|
|
302
302
|
class: "xml-node__tag",
|
|
303
303
|
style: c({ color: e.theme.colors.xmlTag })
|
|
304
|
-
}, D(y.value ?
|
|
305
|
-
|
|
304
|
+
}, D(y.value ? _.value : K.value), 5),
|
|
305
|
+
o("span", {
|
|
306
306
|
class: "xml-node__bracket",
|
|
307
307
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
308
308
|
}, ">", 4)
|
|
309
|
-
])) :
|
|
310
|
-
|
|
309
|
+
])) : he.value ? ($(), w("div", Se, [
|
|
310
|
+
o("span", {
|
|
311
311
|
class: "xml-node__bracket",
|
|
312
312
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
313
313
|
}, "<", 4),
|
|
314
|
-
|
|
314
|
+
o("span", {
|
|
315
315
|
class: "xml-node__tag xml-node__tag--editable",
|
|
316
316
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
317
317
|
contenteditable: y.value,
|
|
318
318
|
onDblclick: le,
|
|
319
319
|
onContextmenu: H,
|
|
320
320
|
onKeydown: [
|
|
321
|
-
A(
|
|
321
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
322
322
|
A(v, ["escape"])
|
|
323
323
|
],
|
|
324
324
|
onBlur: f,
|
|
325
325
|
ref_key: "tagNameRef",
|
|
326
|
-
ref:
|
|
326
|
+
ref: O,
|
|
327
327
|
title: "Double-click to edit tag name"
|
|
328
|
-
}, D(y.value ?
|
|
329
|
-
($(!0), w(
|
|
328
|
+
}, D(y.value ? _.value : K.value), 45, Qe),
|
|
329
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
330
330
|
key: u,
|
|
331
331
|
class: "xml-node__attribute"
|
|
332
332
|
}, [
|
|
333
|
-
|
|
333
|
+
o("span", {
|
|
334
334
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
335
335
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
336
|
-
contenteditable:
|
|
337
|
-
onDblclick: (
|
|
336
|
+
contenteditable: n.value === u,
|
|
337
|
+
onDblclick: (x) => ce(u),
|
|
338
338
|
onKeydown: [
|
|
339
|
-
A(
|
|
339
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
340
340
|
A(C, ["escape"])
|
|
341
341
|
],
|
|
342
342
|
onBlur: l,
|
|
343
343
|
ref_for: !0,
|
|
344
|
-
ref: (
|
|
345
|
-
|
|
344
|
+
ref: (x) => {
|
|
345
|
+
n.value === u && (z.value = x);
|
|
346
346
|
},
|
|
347
347
|
title: "Double-click to edit attribute name"
|
|
348
|
-
}, D(
|
|
349
|
-
|
|
348
|
+
}, D(n.value === u ? h.value : u), 45, He),
|
|
349
|
+
o("span", {
|
|
350
350
|
class: "xml-node__equals",
|
|
351
351
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
352
352
|
}, "=", 4),
|
|
353
|
-
|
|
353
|
+
o("span", {
|
|
354
354
|
class: "xml-node__quote",
|
|
355
355
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
356
356
|
}, '"', 4),
|
|
357
|
-
|
|
357
|
+
o("span", {
|
|
358
358
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
359
359
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
360
|
-
contenteditable:
|
|
361
|
-
onDblclick: (
|
|
360
|
+
contenteditable: b.value === u,
|
|
361
|
+
onDblclick: (x) => t(u),
|
|
362
362
|
onKeydown: [
|
|
363
|
-
A(
|
|
363
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
364
364
|
A(k, ["escape"])
|
|
365
365
|
],
|
|
366
366
|
onBlur: a,
|
|
367
367
|
ref_for: !0,
|
|
368
|
-
ref: (
|
|
369
|
-
|
|
368
|
+
ref: (x) => {
|
|
369
|
+
b.value === u && (Q.value = x);
|
|
370
370
|
},
|
|
371
371
|
title: "Double-click to edit attribute value"
|
|
372
|
-
}, D(
|
|
373
|
-
|
|
372
|
+
}, D(b.value === u ? X.value : F), 45, ze),
|
|
373
|
+
o("span", {
|
|
374
374
|
class: "xml-node__quote",
|
|
375
375
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
376
376
|
}, '"', 4)
|
|
377
377
|
]))), 128)),
|
|
378
|
-
|
|
378
|
+
o("span", {
|
|
379
379
|
class: "xml-node__bracket",
|
|
380
380
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
381
381
|
}, ">", 4),
|
|
382
|
-
|
|
382
|
+
o("span", {
|
|
383
383
|
class: "xml-node__text-content xml-node__text-content--editable",
|
|
384
384
|
style: c({ color: e.theme.colors.xmlText }),
|
|
385
385
|
contenteditable: E.value,
|
|
386
386
|
onDblclick: d,
|
|
387
387
|
onKeydown: [
|
|
388
|
-
A(
|
|
388
|
+
A(q(g, ["prevent"]), ["enter"]),
|
|
389
389
|
A(N, ["escape"])
|
|
390
390
|
],
|
|
391
391
|
onBlur: g,
|
|
392
392
|
ref_key: "textContentRef",
|
|
393
393
|
ref: U,
|
|
394
394
|
title: "Double-click to edit text content"
|
|
395
|
-
}, D(E.value ?
|
|
396
|
-
|
|
395
|
+
}, D(E.value ? P.value : te.value), 45, Ze),
|
|
396
|
+
o("span", {
|
|
397
397
|
class: "xml-node__bracket",
|
|
398
398
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
399
399
|
}, "</", 4),
|
|
400
|
-
|
|
400
|
+
o("span", {
|
|
401
401
|
class: "xml-node__tag",
|
|
402
402
|
style: c({ color: e.theme.colors.xmlTag })
|
|
403
|
-
}, D(y.value ?
|
|
404
|
-
|
|
403
|
+
}, D(y.value ? _.value : K.value), 5),
|
|
404
|
+
o("span", {
|
|
405
405
|
class: "xml-node__bracket",
|
|
406
406
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
407
407
|
}, ">", 4)
|
|
408
408
|
])) : fe.value && ye.value ? ($(), w("div", Je, [
|
|
409
|
-
|
|
409
|
+
o("span", {
|
|
410
410
|
class: "xml-node__bracket",
|
|
411
411
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
412
412
|
}, "<", 4),
|
|
413
|
-
|
|
413
|
+
o("span", {
|
|
414
414
|
class: "xml-node__tag xml-node__tag--editable",
|
|
415
415
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
416
416
|
contenteditable: y.value,
|
|
417
417
|
onDblclick: le,
|
|
418
418
|
onContextmenu: H,
|
|
419
419
|
onKeydown: [
|
|
420
|
-
A(
|
|
420
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
421
421
|
A(v, ["escape"])
|
|
422
422
|
],
|
|
423
423
|
onBlur: f,
|
|
424
424
|
ref_key: "tagNameRef",
|
|
425
|
-
ref:
|
|
425
|
+
ref: O,
|
|
426
426
|
title: "Double-click to edit tag name"
|
|
427
|
-
}, D(y.value ?
|
|
428
|
-
($(!0), w(
|
|
427
|
+
}, D(y.value ? _.value : K.value), 45, Ge),
|
|
428
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
429
429
|
key: u,
|
|
430
430
|
class: "xml-node__attribute"
|
|
431
431
|
}, [
|
|
432
|
-
|
|
432
|
+
o("span", {
|
|
433
433
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
434
434
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
435
|
-
contenteditable:
|
|
436
|
-
onDblclick: (
|
|
435
|
+
contenteditable: n.value === u,
|
|
436
|
+
onDblclick: (x) => ce(u),
|
|
437
437
|
onKeydown: [
|
|
438
|
-
A(
|
|
438
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
439
439
|
A(C, ["escape"])
|
|
440
440
|
],
|
|
441
441
|
onBlur: l,
|
|
442
442
|
ref_for: !0,
|
|
443
|
-
ref: (
|
|
444
|
-
|
|
443
|
+
ref: (x) => {
|
|
444
|
+
n.value === u && (z.value = x);
|
|
445
445
|
},
|
|
446
446
|
title: "Double-click to edit attribute name"
|
|
447
|
-
}, D(
|
|
448
|
-
|
|
447
|
+
}, D(n.value === u ? h.value : u), 45, Ye),
|
|
448
|
+
o("span", {
|
|
449
449
|
class: "xml-node__equals",
|
|
450
450
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
451
451
|
}, "=", 4),
|
|
452
|
-
|
|
452
|
+
o("span", {
|
|
453
453
|
class: "xml-node__quote",
|
|
454
454
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
455
455
|
}, '"', 4),
|
|
456
|
-
|
|
456
|
+
o("span", {
|
|
457
457
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
458
458
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
459
|
-
contenteditable:
|
|
460
|
-
onDblclick: (
|
|
459
|
+
contenteditable: b.value === u,
|
|
460
|
+
onDblclick: (x) => t(u),
|
|
461
461
|
onKeydown: [
|
|
462
|
-
A(
|
|
462
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
463
463
|
A(k, ["escape"])
|
|
464
464
|
],
|
|
465
465
|
onBlur: a,
|
|
466
466
|
ref_for: !0,
|
|
467
|
-
ref: (
|
|
468
|
-
|
|
467
|
+
ref: (x) => {
|
|
468
|
+
b.value === u && (Q.value = x);
|
|
469
469
|
},
|
|
470
470
|
title: "Double-click to edit attribute value"
|
|
471
|
-
}, D(
|
|
472
|
-
|
|
471
|
+
}, D(b.value === u ? X.value : F), 45, et),
|
|
472
|
+
o("span", {
|
|
473
473
|
class: "xml-node__quote",
|
|
474
474
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
475
475
|
}, '"', 4)
|
|
476
476
|
]))), 128)),
|
|
477
|
-
|
|
477
|
+
o("span", {
|
|
478
478
|
class: "xml-node__bracket",
|
|
479
479
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
480
480
|
}, " />", 4)
|
|
481
481
|
])) : fe.value ? ($(), w("div", tt, [
|
|
482
|
-
|
|
482
|
+
o("span", {
|
|
483
483
|
class: "xml-node__bracket",
|
|
484
484
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
485
485
|
}, "<", 4),
|
|
486
|
-
|
|
486
|
+
o("span", {
|
|
487
487
|
class: "xml-node__tag xml-node__tag--editable",
|
|
488
488
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
489
489
|
contenteditable: y.value,
|
|
490
490
|
onDblclick: le,
|
|
491
491
|
onContextmenu: H,
|
|
492
492
|
onKeydown: [
|
|
493
|
-
A(
|
|
493
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
494
494
|
A(v, ["escape"])
|
|
495
495
|
],
|
|
496
496
|
onBlur: f,
|
|
497
497
|
ref_key: "tagNameRef",
|
|
498
|
-
ref:
|
|
498
|
+
ref: O,
|
|
499
499
|
title: "Double-click to edit tag name"
|
|
500
|
-
}, D(y.value ?
|
|
501
|
-
($(!0), w(
|
|
500
|
+
}, D(y.value ? _.value : K.value), 45, lt),
|
|
501
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
502
502
|
key: u,
|
|
503
503
|
class: "xml-node__attribute"
|
|
504
504
|
}, [
|
|
505
|
-
|
|
505
|
+
o("span", {
|
|
506
506
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
507
507
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
508
|
-
contenteditable:
|
|
509
|
-
onDblclick: (
|
|
508
|
+
contenteditable: n.value === u,
|
|
509
|
+
onDblclick: (x) => ce(u),
|
|
510
510
|
onKeydown: [
|
|
511
|
-
A(
|
|
511
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
512
512
|
A(C, ["escape"])
|
|
513
513
|
],
|
|
514
514
|
onBlur: l,
|
|
515
515
|
ref_for: !0,
|
|
516
|
-
ref: (
|
|
517
|
-
|
|
516
|
+
ref: (x) => {
|
|
517
|
+
n.value === u && (z.value = x);
|
|
518
518
|
},
|
|
519
519
|
title: "Double-click to edit attribute name"
|
|
520
|
-
}, D(
|
|
521
|
-
|
|
520
|
+
}, D(n.value === u ? h.value : u), 45, at),
|
|
521
|
+
o("span", {
|
|
522
522
|
class: "xml-node__equals",
|
|
523
523
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
524
524
|
}, "=", 4),
|
|
525
|
-
|
|
525
|
+
o("span", {
|
|
526
526
|
class: "xml-node__quote",
|
|
527
527
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
528
528
|
}, '"', 4),
|
|
529
|
-
|
|
529
|
+
o("span", {
|
|
530
530
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
531
531
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
532
|
-
contenteditable:
|
|
533
|
-
onDblclick: (
|
|
532
|
+
contenteditable: b.value === u,
|
|
533
|
+
onDblclick: (x) => t(u),
|
|
534
534
|
onKeydown: [
|
|
535
|
-
A(
|
|
535
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
536
536
|
A(k, ["escape"])
|
|
537
537
|
],
|
|
538
538
|
onBlur: a,
|
|
539
539
|
ref_for: !0,
|
|
540
|
-
ref: (
|
|
541
|
-
|
|
540
|
+
ref: (x) => {
|
|
541
|
+
b.value === u && (Q.value = x);
|
|
542
542
|
},
|
|
543
543
|
title: "Double-click to edit attribute value"
|
|
544
|
-
}, D(
|
|
545
|
-
|
|
544
|
+
}, D(b.value === u ? X.value : F), 45, ot),
|
|
545
|
+
o("span", {
|
|
546
546
|
class: "xml-node__quote",
|
|
547
547
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
548
548
|
}, '"', 4)
|
|
549
549
|
]))), 128)),
|
|
550
|
-
|
|
550
|
+
o("span", {
|
|
551
551
|
class: "xml-node__bracket",
|
|
552
552
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
553
553
|
}, "></", 4),
|
|
554
|
-
|
|
554
|
+
o("span", {
|
|
555
555
|
class: "xml-node__tag",
|
|
556
556
|
style: c({ color: e.theme.colors.xmlTag })
|
|
557
|
-
}, D(y.value ?
|
|
558
|
-
|
|
557
|
+
}, D(y.value ? _.value : K.value), 5),
|
|
558
|
+
o("span", {
|
|
559
559
|
class: "xml-node__bracket",
|
|
560
560
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
561
561
|
}, ">", 4)
|
|
562
|
-
])) : ($(), w("div",
|
|
563
|
-
!ee.value && Z.value ? ($(), w("div",
|
|
564
|
-
|
|
562
|
+
])) : ($(), w("div", nt, [
|
|
563
|
+
!ee.value && Z.value ? ($(), w("div", rt, [
|
|
564
|
+
o("span", {
|
|
565
565
|
class: "xml-node__clickable-part",
|
|
566
|
-
onClick:
|
|
566
|
+
onClick: s[0] || (s[0] = (F) => oe()),
|
|
567
567
|
title: "Click to expand"
|
|
568
568
|
}, [
|
|
569
|
-
|
|
569
|
+
o("span", {
|
|
570
570
|
class: "xml-node__bracket",
|
|
571
571
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
572
572
|
}, "<", 4),
|
|
573
|
-
|
|
573
|
+
o("span", {
|
|
574
574
|
class: "xml-node__tag xml-node__tag--editable",
|
|
575
575
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
576
576
|
contenteditable: y.value,
|
|
577
|
-
onDblclick:
|
|
577
|
+
onDblclick: q(le, ["stop"]),
|
|
578
578
|
onContextmenu: H,
|
|
579
579
|
onKeydown: [
|
|
580
|
-
A(
|
|
580
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
581
581
|
A(v, ["escape"])
|
|
582
582
|
],
|
|
583
583
|
onBlur: f,
|
|
584
584
|
ref_key: "tagNameRef",
|
|
585
|
-
ref:
|
|
585
|
+
ref: O,
|
|
586
586
|
title: "Double-click or right-click to edit tag name"
|
|
587
|
-
}, D(y.value ?
|
|
587
|
+
}, D(y.value ? _.value : K.value), 45, st)
|
|
588
588
|
]),
|
|
589
|
-
($(!0), w(
|
|
589
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
590
590
|
key: u,
|
|
591
591
|
class: "xml-node__attribute"
|
|
592
592
|
}, [
|
|
593
|
-
|
|
593
|
+
o("span", {
|
|
594
594
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
595
595
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
596
|
-
contenteditable:
|
|
597
|
-
onDblclick: (
|
|
596
|
+
contenteditable: n.value === u,
|
|
597
|
+
onDblclick: (x) => ce(u),
|
|
598
598
|
onKeydown: [
|
|
599
|
-
A(
|
|
599
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
600
600
|
A(C, ["escape"])
|
|
601
601
|
],
|
|
602
602
|
onBlur: l,
|
|
603
603
|
ref_for: !0,
|
|
604
|
-
ref: (
|
|
605
|
-
|
|
604
|
+
ref: (x) => {
|
|
605
|
+
n.value === u && (z.value = x);
|
|
606
606
|
},
|
|
607
607
|
title: "Double-click to edit attribute name"
|
|
608
|
-
}, D(
|
|
609
|
-
|
|
608
|
+
}, D(n.value === u ? h.value : u), 45, ct),
|
|
609
|
+
o("span", {
|
|
610
610
|
class: "xml-node__equals",
|
|
611
611
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
612
612
|
}, "=", 4),
|
|
613
|
-
|
|
613
|
+
o("span", {
|
|
614
614
|
class: "xml-node__quote",
|
|
615
615
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
616
616
|
}, '"', 4),
|
|
617
|
-
|
|
617
|
+
o("span", {
|
|
618
618
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
619
619
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
620
|
-
contenteditable:
|
|
621
|
-
onDblclick: (
|
|
620
|
+
contenteditable: b.value === u,
|
|
621
|
+
onDblclick: (x) => t(u),
|
|
622
622
|
onKeydown: [
|
|
623
|
-
A(
|
|
623
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
624
624
|
A(k, ["escape"])
|
|
625
625
|
],
|
|
626
626
|
onBlur: a,
|
|
627
627
|
ref_for: !0,
|
|
628
|
-
ref: (
|
|
629
|
-
|
|
628
|
+
ref: (x) => {
|
|
629
|
+
b.value === u && (Q.value = x);
|
|
630
630
|
},
|
|
631
631
|
title: "Double-click to edit attribute value"
|
|
632
|
-
}, D(
|
|
633
|
-
|
|
632
|
+
}, D(b.value === u ? X.value : F), 45, it),
|
|
633
|
+
o("span", {
|
|
634
634
|
class: "xml-node__quote",
|
|
635
635
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
636
636
|
}, '"', 4)
|
|
637
637
|
]))), 128)),
|
|
638
|
-
|
|
638
|
+
o("span", {
|
|
639
639
|
class: "xml-node__clickable-part",
|
|
640
|
-
onClick:
|
|
640
|
+
onClick: s[1] || (s[1] = (F) => oe()),
|
|
641
641
|
title: "Click to expand"
|
|
642
642
|
}, [
|
|
643
|
-
|
|
643
|
+
o("span", {
|
|
644
644
|
class: "xml-node__bracket",
|
|
645
645
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
646
646
|
}, ">", 4)
|
|
647
647
|
]),
|
|
648
|
-
|
|
648
|
+
o("span", {
|
|
649
649
|
class: "xml-node__collapsed-badge",
|
|
650
|
-
onClick:
|
|
650
|
+
onClick: s[2] || (s[2] = (F) => oe()),
|
|
651
651
|
title: `Click to expand ${me.value} tag${me.value > 1 ? "s" : ""}`
|
|
652
652
|
}, D(me.value) + " tag" + D(me.value > 1 ? "s" : ""), 9, ut),
|
|
653
|
-
|
|
653
|
+
o("span", {
|
|
654
654
|
class: "xml-node__clickable-part",
|
|
655
|
-
onClick:
|
|
655
|
+
onClick: s[3] || (s[3] = (F) => oe()),
|
|
656
656
|
title: "Click to expand"
|
|
657
657
|
}, [
|
|
658
|
-
|
|
658
|
+
o("span", {
|
|
659
659
|
class: "xml-node__bracket",
|
|
660
660
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
661
661
|
}, "</", 4),
|
|
662
|
-
|
|
662
|
+
o("span", {
|
|
663
663
|
class: "xml-node__tag",
|
|
664
664
|
style: c({ color: e.theme.colors.xmlTag })
|
|
665
|
-
}, D(y.value ?
|
|
666
|
-
|
|
665
|
+
}, D(y.value ? _.value : K.value), 5),
|
|
666
|
+
o("span", {
|
|
667
667
|
class: "xml-node__bracket",
|
|
668
668
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
669
669
|
}, ">", 4)
|
|
670
670
|
])
|
|
671
|
-
])) : ($(), w(
|
|
672
|
-
|
|
671
|
+
])) : ($(), w(re, { key: 1 }, [
|
|
672
|
+
o("div", dt, [
|
|
673
673
|
Z.value ? ($(), w("span", {
|
|
674
674
|
key: 0,
|
|
675
675
|
class: "xml-node__clickable-part",
|
|
676
|
-
onClick:
|
|
676
|
+
onClick: s[4] || (s[4] = (F) => oe()),
|
|
677
677
|
title: ee.value ? "Click to collapse" : "Click to expand"
|
|
678
678
|
}, [
|
|
679
|
-
|
|
679
|
+
o("span", {
|
|
680
680
|
class: "xml-node__bracket",
|
|
681
681
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
682
682
|
}, "<", 4),
|
|
683
|
-
|
|
683
|
+
o("span", {
|
|
684
684
|
class: "xml-node__tag xml-node__tag--editable",
|
|
685
685
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
686
686
|
contenteditable: y.value,
|
|
687
|
-
onDblclick:
|
|
687
|
+
onDblclick: q(le, ["stop"]),
|
|
688
688
|
onContextmenu: H,
|
|
689
689
|
onKeydown: [
|
|
690
|
-
A(
|
|
690
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
691
691
|
A(v, ["escape"])
|
|
692
692
|
],
|
|
693
693
|
onBlur: f,
|
|
694
694
|
ref_key: "tagNameRef",
|
|
695
|
-
ref:
|
|
695
|
+
ref: O,
|
|
696
696
|
title: "Double-click or right-click to edit tag name"
|
|
697
|
-
}, D(y.value ?
|
|
697
|
+
}, D(y.value ? _.value : K.value), 45, ft)
|
|
698
698
|
], 8, mt)) : ($(), w("span", vt, [
|
|
699
|
-
|
|
699
|
+
o("span", {
|
|
700
700
|
class: "xml-node__bracket",
|
|
701
701
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
702
702
|
}, "<", 4),
|
|
703
|
-
|
|
703
|
+
o("span", {
|
|
704
704
|
class: "xml-node__tag xml-node__tag--editable",
|
|
705
705
|
style: c({ color: e.theme.colors.xmlTag }),
|
|
706
706
|
contenteditable: y.value,
|
|
707
707
|
onDblclick: le,
|
|
708
708
|
onKeydown: [
|
|
709
|
-
A(
|
|
709
|
+
A(q(f, ["prevent"]), ["enter"]),
|
|
710
710
|
A(v, ["escape"])
|
|
711
711
|
],
|
|
712
712
|
onBlur: f,
|
|
713
713
|
ref_key: "tagNameRef",
|
|
714
|
-
ref:
|
|
714
|
+
ref: O,
|
|
715
715
|
title: "Double-click to edit tag name"
|
|
716
|
-
}, D(y.value ?
|
|
716
|
+
}, D(y.value ? _.value : K.value), 45, pt)
|
|
717
717
|
])),
|
|
718
|
-
($(!0), w(
|
|
718
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
719
719
|
key: u,
|
|
720
720
|
class: "xml-node__attribute"
|
|
721
721
|
}, [
|
|
722
|
-
|
|
722
|
+
o("span", {
|
|
723
723
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
724
724
|
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
725
|
-
contenteditable:
|
|
726
|
-
onDblclick: (
|
|
725
|
+
contenteditable: n.value === u,
|
|
726
|
+
onDblclick: (x) => ce(u),
|
|
727
727
|
onKeydown: [
|
|
728
|
-
A(
|
|
728
|
+
A(q(l, ["prevent"]), ["enter"]),
|
|
729
729
|
A(C, ["escape"])
|
|
730
730
|
],
|
|
731
731
|
onBlur: l,
|
|
732
732
|
ref_for: !0,
|
|
733
|
-
ref: (
|
|
734
|
-
|
|
733
|
+
ref: (x) => {
|
|
734
|
+
n.value === u && (z.value = x);
|
|
735
735
|
},
|
|
736
736
|
title: "Double-click to edit attribute name"
|
|
737
|
-
}, D(
|
|
738
|
-
|
|
737
|
+
}, D(n.value === u ? h.value : u), 45, yt),
|
|
738
|
+
o("span", {
|
|
739
739
|
class: "xml-node__equals",
|
|
740
740
|
style: c({ color: e.theme.colors.xmlEquals })
|
|
741
741
|
}, "=", 4),
|
|
742
|
-
|
|
742
|
+
o("span", {
|
|
743
743
|
class: "xml-node__quote",
|
|
744
744
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
745
745
|
}, '"', 4),
|
|
746
|
-
|
|
746
|
+
o("span", {
|
|
747
747
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
748
748
|
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
749
|
-
contenteditable:
|
|
750
|
-
onDblclick: (
|
|
749
|
+
contenteditable: b.value === u,
|
|
750
|
+
onDblclick: (x) => t(u),
|
|
751
751
|
onKeydown: [
|
|
752
|
-
A(
|
|
752
|
+
A(q(a, ["prevent"]), ["enter"]),
|
|
753
753
|
A(k, ["escape"])
|
|
754
754
|
],
|
|
755
755
|
onBlur: a,
|
|
756
756
|
ref_for: !0,
|
|
757
|
-
ref: (
|
|
758
|
-
|
|
757
|
+
ref: (x) => {
|
|
758
|
+
b.value === u && (Q.value = x);
|
|
759
759
|
},
|
|
760
760
|
title: "Double-click to edit attribute value"
|
|
761
|
-
}, D(
|
|
762
|
-
|
|
761
|
+
}, D(b.value === u ? X.value : F), 45, bt),
|
|
762
|
+
o("span", {
|
|
763
763
|
class: "xml-node__quote",
|
|
764
764
|
style: c({ color: e.theme.colors.xmlQuote })
|
|
765
765
|
}, '"', 4)
|
|
@@ -767,69 +767,69 @@ const Re = {
|
|
|
767
767
|
Z.value ? ($(), w("span", {
|
|
768
768
|
key: 2,
|
|
769
769
|
class: "xml-node__clickable-part",
|
|
770
|
-
onClick:
|
|
770
|
+
onClick: s[5] || (s[5] = (F) => oe()),
|
|
771
771
|
title: ee.value ? "Click to collapse" : "Click to expand"
|
|
772
772
|
}, [
|
|
773
|
-
|
|
773
|
+
o("span", {
|
|
774
774
|
class: "xml-node__bracket",
|
|
775
775
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
776
776
|
}, ">", 4)
|
|
777
|
-
], 8,
|
|
777
|
+
], 8, ht)) : ($(), w("span", {
|
|
778
778
|
key: 3,
|
|
779
779
|
class: "xml-node__bracket",
|
|
780
780
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
781
781
|
}, D(Z.value ? ">" : "/>"), 5))
|
|
782
782
|
]),
|
|
783
|
-
ee.value && Z.value ? ($(), w("div",
|
|
784
|
-
G.value.length === 0 && te.value.trim() ? ($(), w("div",
|
|
785
|
-
|
|
783
|
+
ee.value && Z.value ? ($(), w("div", xt, [
|
|
784
|
+
G.value.length === 0 && te.value.trim() ? ($(), w("div", _t, [
|
|
785
|
+
o("span", {
|
|
786
786
|
class: "xml-node__text-content xml-node__text-content--editable",
|
|
787
787
|
style: c({ color: e.theme.colors.xmlText }),
|
|
788
788
|
contenteditable: E.value,
|
|
789
789
|
onDblclick: d,
|
|
790
790
|
onKeydown: [
|
|
791
|
-
A(
|
|
791
|
+
A(q(g, ["prevent"]), ["enter"]),
|
|
792
792
|
A(N, ["escape"])
|
|
793
793
|
],
|
|
794
794
|
onBlur: g,
|
|
795
795
|
ref_key: "textContentRef",
|
|
796
796
|
ref: U,
|
|
797
797
|
title: "Double-click to edit text content"
|
|
798
|
-
}, D(E.value ?
|
|
798
|
+
}, D(E.value ? P.value : te.value), 45, gt)
|
|
799
799
|
])) : pe("", !0),
|
|
800
|
-
($(!0), w(
|
|
801
|
-
key:
|
|
800
|
+
($(!0), w(re, null, ie(G.value, (F, u) => ($(), Be(M, {
|
|
801
|
+
key: xe(F, u),
|
|
802
802
|
node: F,
|
|
803
803
|
index: u,
|
|
804
804
|
level: e.level + 1,
|
|
805
|
-
"parent-path":
|
|
805
|
+
"parent-path": _e(),
|
|
806
806
|
expanded: e.expanded,
|
|
807
807
|
theme: e.theme,
|
|
808
808
|
selfClosingTags: e.selfClosingTags,
|
|
809
|
-
onToggleExpand:
|
|
810
|
-
onCopy:
|
|
811
|
-
"onUpdate:tagName":
|
|
812
|
-
"onUpdate:attributeName":
|
|
813
|
-
"onUpdate:attributeValue":
|
|
814
|
-
"onUpdate:textContent":
|
|
815
|
-
"onUpdate:cdataContent":
|
|
809
|
+
onToggleExpand: s[6] || (s[6] = (x) => e.$emit("toggle-expand", x)),
|
|
810
|
+
onCopy: s[7] || (s[7] = (x) => e.$emit("copy", x)),
|
|
811
|
+
"onUpdate:tagName": s[8] || (s[8] = (x, ne, ve) => e.$emit("update:tagName", x, ne, ve)),
|
|
812
|
+
"onUpdate:attributeName": s[9] || (s[9] = (x, ne, ve) => e.$emit("update:attributeName", x, ne, ve)),
|
|
813
|
+
"onUpdate:attributeValue": s[10] || (s[10] = (x, ne, ve) => e.$emit("update:attributeValue", x, ne, ve)),
|
|
814
|
+
"onUpdate:textContent": s[11] || (s[11] = (x, ne) => e.$emit("update:textContent", x, ne)),
|
|
815
|
+
"onUpdate:cdataContent": s[12] || (s[12] = (x, ne) => e.$emit("update:cdataContent", x, ne))
|
|
816
816
|
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme", "selfClosingTags"]))), 128))
|
|
817
817
|
])) : pe("", !0),
|
|
818
818
|
ee.value && Z.value ? ($(), w("div", kt, [
|
|
819
|
-
|
|
819
|
+
o("span", {
|
|
820
820
|
class: "xml-node__clickable-part",
|
|
821
|
-
onClick:
|
|
821
|
+
onClick: s[13] || (s[13] = (F) => oe()),
|
|
822
822
|
title: "Click to collapse"
|
|
823
823
|
}, [
|
|
824
|
-
|
|
824
|
+
o("span", {
|
|
825
825
|
class: "xml-node__bracket",
|
|
826
826
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
827
827
|
}, "</", 4),
|
|
828
|
-
|
|
828
|
+
o("span", {
|
|
829
829
|
class: "xml-node__tag",
|
|
830
830
|
style: c({ color: e.theme.colors.xmlTag })
|
|
831
|
-
}, D(y.value ?
|
|
832
|
-
|
|
831
|
+
}, D(y.value ? _.value : K.value), 5),
|
|
832
|
+
o("span", {
|
|
833
833
|
class: "xml-node__bracket",
|
|
834
834
|
style: c({ color: e.theme.colors.xmlBracket })
|
|
835
835
|
}, ">", 4)
|
|
@@ -1007,6 +1007,61 @@ const Re = {
|
|
|
1007
1007
|
// 对齐线 - 灰色
|
|
1008
1008
|
}
|
|
1009
1009
|
}, Tt = {
|
|
1010
|
+
name: "min-dark",
|
|
1011
|
+
colors: {
|
|
1012
|
+
// 背景色
|
|
1013
|
+
background: "#111111",
|
|
1014
|
+
surfaceBackground: "#1a1a1a",
|
|
1015
|
+
// 边框色
|
|
1016
|
+
border: "#2a2a2a",
|
|
1017
|
+
// 文本色
|
|
1018
|
+
text: "#e5e5e5",
|
|
1019
|
+
textSecondary: "#a3a3a3",
|
|
1020
|
+
// 按钮样式
|
|
1021
|
+
buttonBackground: "#1f1f1f",
|
|
1022
|
+
buttonBackgroundHover: "#2a2a2a",
|
|
1023
|
+
buttonBorder: "#333333",
|
|
1024
|
+
buttonText: "#e5e5e5",
|
|
1025
|
+
buttonPrimary: "#3b82f6",
|
|
1026
|
+
buttonPrimaryHover: "#2563eb",
|
|
1027
|
+
// 状态指示
|
|
1028
|
+
success: "#22c55e",
|
|
1029
|
+
successBackground: "#052e16",
|
|
1030
|
+
error: "#f87171",
|
|
1031
|
+
errorBackground: "#450a0a",
|
|
1032
|
+
// XML 语法高亮
|
|
1033
|
+
xmlTag: "#4ade80",
|
|
1034
|
+
// 标签名 - 绿色
|
|
1035
|
+
xmlAttribute: "#60a5fa",
|
|
1036
|
+
// 属性名 - 蓝色
|
|
1037
|
+
xmlAttributeValue: "#93c5fd",
|
|
1038
|
+
// 属性值 - 浅蓝色
|
|
1039
|
+
xmlText: "#e5e5e5",
|
|
1040
|
+
// 文本内容 - 浅灰
|
|
1041
|
+
xmlComment: "#9ca3af",
|
|
1042
|
+
// 注释 - 灰色
|
|
1043
|
+
xmlCdata: "#c084fc",
|
|
1044
|
+
// CDATA - 紫色
|
|
1045
|
+
xmlDeclaration: "#f59e0b",
|
|
1046
|
+
// 声明 - 橙色
|
|
1047
|
+
xmlBracket: "#9ca3af",
|
|
1048
|
+
// 括号 - 灰色
|
|
1049
|
+
xmlEquals: "#9ca3af",
|
|
1050
|
+
// 等号 - 灰色
|
|
1051
|
+
xmlQuote: "#60a5fa",
|
|
1052
|
+
// 引号 - 蓝色
|
|
1053
|
+
// 折叠效果
|
|
1054
|
+
collapsedBackground: "#1e293b",
|
|
1055
|
+
// 折叠信息背景色 - 深蓝灰
|
|
1056
|
+
collapsedBackgroundHover: "#334155",
|
|
1057
|
+
// 折叠信息悬停背景色 - 稍浅
|
|
1058
|
+
collapsedText: "#60a5fa",
|
|
1059
|
+
// 折叠信息文本色 - 蓝色
|
|
1060
|
+
// 缩进指示线
|
|
1061
|
+
indentLine: "#374151"
|
|
1062
|
+
// 对齐线 - 深灰
|
|
1063
|
+
}
|
|
1064
|
+
}, Dt = {
|
|
1010
1065
|
name: "slack-ochin",
|
|
1011
1066
|
colors: {
|
|
1012
1067
|
// 背景色
|
|
@@ -1065,8 +1120,9 @@ const Re = {
|
|
|
1065
1120
|
"github-light": $t,
|
|
1066
1121
|
"github-dark": Bt,
|
|
1067
1122
|
"min-light": wt,
|
|
1068
|
-
"
|
|
1069
|
-
|
|
1123
|
+
"min-dark": Tt,
|
|
1124
|
+
"slack-ochin": Dt
|
|
1125
|
+
}, Et = (r) => Ae[r] || Ae["github-light"], Vt = {
|
|
1070
1126
|
ignoreAttributes: !1,
|
|
1071
1127
|
// 保留属性
|
|
1072
1128
|
attributeNamePrefix: "@_",
|
|
@@ -1101,7 +1157,7 @@ const Re = {
|
|
|
1101
1157
|
// 停止解析的节点
|
|
1102
1158
|
alwaysCreateTextNode: !1
|
|
1103
1159
|
// 仅在有文本时创建文本节点
|
|
1104
|
-
},
|
|
1160
|
+
}, Wt = {
|
|
1105
1161
|
ignoreAttributes: !1,
|
|
1106
1162
|
attributeNamePrefix: "@_",
|
|
1107
1163
|
textNodeName: "#text",
|
|
@@ -1113,47 +1169,47 @@ const Re = {
|
|
|
1113
1169
|
// 不抑制空节点
|
|
1114
1170
|
suppressBooleanAttributes: !1,
|
|
1115
1171
|
suppressUnpairedNode: !1
|
|
1116
|
-
},
|
|
1172
|
+
}, Kt = (r) => {
|
|
1117
1173
|
const m = /<!\[CDATA\[([\s\S]*?)\]\]>/g, i = [];
|
|
1118
1174
|
let p;
|
|
1119
|
-
for (; (p = m.exec(
|
|
1175
|
+
for (; (p = m.exec(r)) !== null; )
|
|
1120
1176
|
i.push({
|
|
1121
1177
|
start: p.index,
|
|
1122
1178
|
end: p.index + p[0].length
|
|
1123
1179
|
});
|
|
1124
|
-
const y = (
|
|
1125
|
-
let E, B = 1,
|
|
1126
|
-
for (; (E =
|
|
1127
|
-
const
|
|
1180
|
+
const y = (h) => i.some((X) => h >= X.start && h < X.end), n = /&([a-zA-Z0-9#]+);/g, b = ["lt", "gt", "amp", "quot", "apos"];
|
|
1181
|
+
let E, B = 1, _ = 0;
|
|
1182
|
+
for (; (E = n.exec(r)) !== null; ) {
|
|
1183
|
+
const h = E[1], X = E.index;
|
|
1128
1184
|
if (y(X))
|
|
1129
1185
|
continue;
|
|
1130
|
-
const
|
|
1131
|
-
if (B += (
|
|
1132
|
-
const S =
|
|
1186
|
+
const P = r.substring(_, X);
|
|
1187
|
+
if (B += (P.match(/\n/g) || []).length, _ = X, h.startsWith("#")) {
|
|
1188
|
+
const S = h.substring(1);
|
|
1133
1189
|
if (S.startsWith("x") || S.startsWith("X")) {
|
|
1134
|
-
const
|
|
1135
|
-
if (!/^[0-9a-fA-F]+$/.test(
|
|
1190
|
+
const O = S.substring(1);
|
|
1191
|
+
if (!/^[0-9a-fA-F]+$/.test(O))
|
|
1136
1192
|
return {
|
|
1137
1193
|
valid: !1,
|
|
1138
|
-
error: `Line ${B}: Invalid hexadecimal character reference '&${
|
|
1194
|
+
error: `Line ${B}: Invalid hexadecimal character reference '&${h};'`
|
|
1139
1195
|
};
|
|
1140
1196
|
} else if (!/^[0-9]+$/.test(S))
|
|
1141
1197
|
return {
|
|
1142
1198
|
valid: !1,
|
|
1143
|
-
error: `Line ${B}: Invalid numeric character reference '&${
|
|
1199
|
+
error: `Line ${B}: Invalid numeric character reference '&${h};'`
|
|
1144
1200
|
};
|
|
1145
1201
|
continue;
|
|
1146
1202
|
}
|
|
1147
|
-
if (!
|
|
1203
|
+
if (!b.includes(h))
|
|
1148
1204
|
return {
|
|
1149
1205
|
valid: !1,
|
|
1150
|
-
error: `Line ${B}: Invalid entity reference '&${
|
|
1206
|
+
error: `Line ${B}: Invalid entity reference '&${h};'. Valid predefined entities are: < > & " '`
|
|
1151
1207
|
};
|
|
1152
1208
|
}
|
|
1153
1209
|
return { valid: !0 };
|
|
1154
|
-
},
|
|
1210
|
+
}, Xt = (r) => {
|
|
1155
1211
|
try {
|
|
1156
|
-
const m =
|
|
1212
|
+
const m = Pe.validate(r, {
|
|
1157
1213
|
allowBooleanAttributes: !0
|
|
1158
1214
|
});
|
|
1159
1215
|
if (m !== !0)
|
|
@@ -1161,7 +1217,7 @@ const Re = {
|
|
|
1161
1217
|
valid: !1,
|
|
1162
1218
|
error: `Line ${m.err.line}: ${m.err.msg}`
|
|
1163
1219
|
};
|
|
1164
|
-
const i =
|
|
1220
|
+
const i = Kt(r);
|
|
1165
1221
|
return i.valid ? { valid: !0 } : i;
|
|
1166
1222
|
} catch (m) {
|
|
1167
1223
|
return {
|
|
@@ -1169,24 +1225,24 @@ const Re = {
|
|
|
1169
1225
|
error: m instanceof Error ? m.message : "Unknown validation error"
|
|
1170
1226
|
};
|
|
1171
1227
|
}
|
|
1172
|
-
}, ge = (
|
|
1228
|
+
}, ge = (r, m) => {
|
|
1173
1229
|
try {
|
|
1174
|
-
return new
|
|
1175
|
-
...
|
|
1230
|
+
return new Oe({
|
|
1231
|
+
...Vt,
|
|
1176
1232
|
...m
|
|
1177
|
-
}).parse(
|
|
1233
|
+
}).parse(r);
|
|
1178
1234
|
} catch (i) {
|
|
1179
1235
|
throw new Error(
|
|
1180
1236
|
`XML 解析失败: ${i instanceof Error ? i.message : "Unknown error"}`
|
|
1181
1237
|
);
|
|
1182
1238
|
}
|
|
1183
|
-
}, ke = (
|
|
1239
|
+
}, ke = (r, m) => {
|
|
1184
1240
|
try {
|
|
1185
1241
|
let p = new Ne({
|
|
1186
|
-
...
|
|
1242
|
+
...Wt,
|
|
1187
1243
|
format: m?.format ?? !0,
|
|
1188
1244
|
indentBy: m?.indentBy ?? " "
|
|
1189
|
-
}).build(
|
|
1245
|
+
}).build(r);
|
|
1190
1246
|
return m?.showDeclaration !== !1 && !p.startsWith("<?xml") && (p = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1191
1247
|
` + p), p;
|
|
1192
1248
|
} catch (i) {
|
|
@@ -1194,158 +1250,158 @@ const Re = {
|
|
|
1194
1250
|
`XML 构建失败: ${i instanceof Error ? i.message : "Unknown error"}`
|
|
1195
1251
|
);
|
|
1196
1252
|
}
|
|
1197
|
-
},
|
|
1198
|
-
const i = ge(
|
|
1199
|
-
return Array.isArray(i) ?
|
|
1253
|
+
}, Pt = (r, m) => Array.isArray(r) ? se(r, { format: !1, originalXml: m }) : ke(r, { format: !1, showDeclaration: !1 }), Ot = (r, m) => {
|
|
1254
|
+
const i = ge(r);
|
|
1255
|
+
return Array.isArray(i) ? se(i, {
|
|
1200
1256
|
indent: m?.indentBy || " ",
|
|
1201
|
-
originalXml:
|
|
1257
|
+
originalXml: r
|
|
1202
1258
|
}) : ke(i, m);
|
|
1203
|
-
},
|
|
1204
|
-
const m =
|
|
1259
|
+
}, zt = (r) => {
|
|
1260
|
+
const m = r.match(/<([a-zA-Z0-9_-]+)[\s>]/);
|
|
1205
1261
|
return m ? m[1] : null;
|
|
1206
|
-
},
|
|
1262
|
+
}, Zt = (r) => {
|
|
1207
1263
|
let m = 0;
|
|
1208
1264
|
const i = (p) => {
|
|
1209
1265
|
p === null || typeof p != "object" || (m++, Array.isArray(p) ? p.forEach(i) : Object.values(p).forEach(i));
|
|
1210
1266
|
};
|
|
1211
|
-
return i(
|
|
1212
|
-
},
|
|
1213
|
-
if (!
|
|
1267
|
+
return i(r), m;
|
|
1268
|
+
}, Jt = (r) => !r || typeof r != "object" ? !1 : Object.keys(r).some((m) => m.startsWith("@_")), Gt = (r) => {
|
|
1269
|
+
if (!r || typeof r != "object") return {};
|
|
1214
1270
|
const m = {};
|
|
1215
|
-
return Object.keys(
|
|
1271
|
+
return Object.keys(r).forEach((i) => {
|
|
1216
1272
|
if (i.startsWith("@_")) {
|
|
1217
1273
|
const p = i.substring(2);
|
|
1218
|
-
m[p] =
|
|
1274
|
+
m[p] = r[i];
|
|
1219
1275
|
}
|
|
1220
1276
|
}), m;
|
|
1221
|
-
},
|
|
1222
|
-
if (
|
|
1223
|
-
if (typeof
|
|
1224
|
-
const m = Object.keys(
|
|
1277
|
+
}, Yt = (r) => !r || typeof r != "object" ? typeof r == "string" ? r : null : r["#text"] || null, el = (r) => {
|
|
1278
|
+
if (r == null) return !0;
|
|
1279
|
+
if (typeof r != "object") return !1;
|
|
1280
|
+
const m = Object.keys(r);
|
|
1225
1281
|
return m.length === 0 || m.length === 1 && m[0].startsWith("@_");
|
|
1226
|
-
},
|
|
1227
|
-
const i = Te(m), p = /* @__PURE__ */ new Map(), y = (
|
|
1228
|
-
for (const
|
|
1229
|
-
const E = Object.keys(
|
|
1230
|
-
(
|
|
1282
|
+
}, Nt = (r, m) => {
|
|
1283
|
+
const i = Te(m), p = /* @__PURE__ */ new Map(), y = (n) => {
|
|
1284
|
+
for (const b of n) {
|
|
1285
|
+
const E = Object.keys(b).find(
|
|
1286
|
+
(h) => !h.startsWith(":") && !h.startsWith("#") && !h.startsWith("__") && !h.startsWith("?")
|
|
1231
1287
|
);
|
|
1232
1288
|
if (!E) continue;
|
|
1233
1289
|
const B = p.get(E) ?? 0;
|
|
1234
|
-
p.set(E, B + 1),
|
|
1235
|
-
const
|
|
1236
|
-
Array.isArray(
|
|
1290
|
+
p.set(E, B + 1), b[":selfClosing"] = i.get(E)?.[B] ?? !1;
|
|
1291
|
+
const _ = b[E];
|
|
1292
|
+
Array.isArray(_) && _.length > 0 && y(_);
|
|
1237
1293
|
}
|
|
1238
1294
|
};
|
|
1239
|
-
y(
|
|
1240
|
-
},
|
|
1295
|
+
y(r);
|
|
1296
|
+
}, Rt = (r) => {
|
|
1241
1297
|
const m = /* @__PURE__ */ new Set(), i = /<([a-zA-Z0-9_-]+)(?:\s[^>]*)?\s*\/>/g;
|
|
1242
1298
|
let p;
|
|
1243
|
-
for (; (p = i.exec(
|
|
1299
|
+
for (; (p = i.exec(r)) !== null; )
|
|
1244
1300
|
m.add(p[1]);
|
|
1245
1301
|
return m;
|
|
1246
|
-
}, Te = (
|
|
1302
|
+
}, Te = (r) => {
|
|
1247
1303
|
const m = /* @__PURE__ */ new Map();
|
|
1248
1304
|
let i = 0;
|
|
1249
|
-
for (; i <
|
|
1250
|
-
if (
|
|
1251
|
-
const p =
|
|
1252
|
-
i = p !== -1 ? p + 3 :
|
|
1305
|
+
for (; i < r.length; ) {
|
|
1306
|
+
if (r.startsWith("<!--", i)) {
|
|
1307
|
+
const p = r.indexOf("-->", i);
|
|
1308
|
+
i = p !== -1 ? p + 3 : r.length;
|
|
1253
1309
|
continue;
|
|
1254
1310
|
}
|
|
1255
|
-
if (
|
|
1256
|
-
const p =
|
|
1257
|
-
i = p !== -1 ? p + 3 :
|
|
1311
|
+
if (r.startsWith("<![CDATA[", i)) {
|
|
1312
|
+
const p = r.indexOf("]]>", i);
|
|
1313
|
+
i = p !== -1 ? p + 3 : r.length;
|
|
1258
1314
|
continue;
|
|
1259
1315
|
}
|
|
1260
|
-
if (
|
|
1261
|
-
const p =
|
|
1262
|
-
i = p !== -1 ? p + 2 :
|
|
1316
|
+
if (r.startsWith("<?", i)) {
|
|
1317
|
+
const p = r.indexOf("?>", i);
|
|
1318
|
+
i = p !== -1 ? p + 2 : r.length;
|
|
1263
1319
|
continue;
|
|
1264
1320
|
}
|
|
1265
|
-
if (
|
|
1266
|
-
const p =
|
|
1267
|
-
i = p !== -1 ? p + 1 :
|
|
1321
|
+
if (r.startsWith("</", i)) {
|
|
1322
|
+
const p = r.indexOf(">", i);
|
|
1323
|
+
i = p !== -1 ? p + 1 : r.length;
|
|
1268
1324
|
continue;
|
|
1269
1325
|
}
|
|
1270
|
-
if (
|
|
1271
|
-
const p =
|
|
1326
|
+
if (r[i] === "<") {
|
|
1327
|
+
const p = r.slice(i + 1).match(/^([a-zA-Z_][a-zA-Z0-9_:.-]*)/);
|
|
1272
1328
|
if (p) {
|
|
1273
1329
|
const y = p[1];
|
|
1274
|
-
let
|
|
1275
|
-
for (;
|
|
1276
|
-
const B =
|
|
1277
|
-
if (
|
|
1278
|
-
B === E && (
|
|
1330
|
+
let n = i + 1 + y.length, b = !1, E = "";
|
|
1331
|
+
for (; n < r.length; ) {
|
|
1332
|
+
const B = r[n];
|
|
1333
|
+
if (b)
|
|
1334
|
+
B === E && (b = !1);
|
|
1279
1335
|
else if (B === '"' || B === "'")
|
|
1280
|
-
|
|
1336
|
+
b = !0, E = B;
|
|
1281
1337
|
else if (B === ">") {
|
|
1282
|
-
let
|
|
1283
|
-
for (;
|
|
1284
|
-
` ||
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1287
|
-
m.has(y) || m.set(y, []), m.get(y).push(
|
|
1338
|
+
let _ = n - 1;
|
|
1339
|
+
for (; _ > i && (r[_] === " " || r[_] === " " || r[_] === `
|
|
1340
|
+
` || r[_] === "\r"); )
|
|
1341
|
+
_--;
|
|
1342
|
+
const h = r[_] === "/";
|
|
1343
|
+
m.has(y) || m.set(y, []), m.get(y).push(h), i = n + 1;
|
|
1288
1344
|
break;
|
|
1289
1345
|
}
|
|
1290
|
-
|
|
1346
|
+
n++;
|
|
1291
1347
|
}
|
|
1292
|
-
if (
|
|
1348
|
+
if (n >= r.length) break;
|
|
1293
1349
|
continue;
|
|
1294
1350
|
}
|
|
1295
1351
|
}
|
|
1296
1352
|
i++;
|
|
1297
1353
|
}
|
|
1298
1354
|
return m;
|
|
1299
|
-
},
|
|
1300
|
-
const i = m.indent !== void 0 ? m.indent : " ", p = m.level || 0, y = m.format !== !1,
|
|
1355
|
+
}, se = (r, m = {}) => {
|
|
1356
|
+
const i = m.indent !== void 0 ? m.indent : " ", p = m.level || 0, y = m.format !== !1, n = y ? i.repeat(p) : "", b = y ? `
|
|
1301
1357
|
` : "";
|
|
1302
|
-
let E = m.selfClosingTags, B = m.selfClosingOccurrences,
|
|
1303
|
-
p === 0 && m.originalXml && (B = Te(m.originalXml),
|
|
1304
|
-
let
|
|
1305
|
-
for (const X of
|
|
1358
|
+
let E = m.selfClosingTags, B = m.selfClosingOccurrences, _ = m.selfClosingCounters;
|
|
1359
|
+
p === 0 && m.originalXml && (B = Te(m.originalXml), _ = /* @__PURE__ */ new Map());
|
|
1360
|
+
let h = "";
|
|
1361
|
+
for (const X of r) {
|
|
1306
1362
|
if (X["?xml"]) {
|
|
1307
1363
|
const T = X[":@"] || {}, R = Object.entries(T).map(([G, ue]) => `${G.startsWith("@_") ? G.substring(2) : G}="${ue}"`).join(" ");
|
|
1308
|
-
|
|
1364
|
+
h += `<?xml ${R}?>${b}`;
|
|
1309
1365
|
continue;
|
|
1310
1366
|
}
|
|
1311
1367
|
if (X["#comment"]) {
|
|
1312
1368
|
const T = X["#comment"];
|
|
1313
1369
|
if (Array.isArray(T) && T.length > 0) {
|
|
1314
1370
|
const R = T[0]["#text"] || T[0];
|
|
1315
|
-
|
|
1371
|
+
h += `${n}<!--${R}-->${b}`;
|
|
1316
1372
|
}
|
|
1317
1373
|
continue;
|
|
1318
1374
|
}
|
|
1319
|
-
const
|
|
1320
|
-
if (!
|
|
1375
|
+
const P = Object.keys(X).find((T) => !T.startsWith(":") && !T.startsWith("#") && !T.startsWith("__"));
|
|
1376
|
+
if (!P) continue;
|
|
1321
1377
|
let S = 0;
|
|
1322
|
-
B &&
|
|
1323
|
-
const
|
|
1324
|
-
if (!Array.isArray(
|
|
1378
|
+
B && _ && (S = _.get(P) ?? 0, _.set(P, S + 1));
|
|
1379
|
+
const O = X[P], z = X[":@"] || {}, Q = Object.entries(z).map(([T, R]) => `${T.startsWith("@_") ? T.substring(2) : T}="${R}"`).join(" "), U = Q ? " " + Q : "";
|
|
1380
|
+
if (!Array.isArray(O) || O.length === 0) {
|
|
1325
1381
|
let T;
|
|
1326
|
-
B ? T = B.get(
|
|
1382
|
+
B ? T = B.get(P)?.[S] ?? !1 : T = !!(E && E.has(P)), T ? h += `${n}<${P}${U}/>${b}` : h += `${n}<${P}${U}></${P}>${b}`;
|
|
1327
1383
|
continue;
|
|
1328
1384
|
}
|
|
1329
|
-
const Y =
|
|
1385
|
+
const Y = O.length === 1 && O[0]["#text"] !== void 0, K = Y ? O[0]["#text"] : "", J = O.some((T) => T.__cdata), ee = Y && K === "";
|
|
1330
1386
|
if (J) {
|
|
1331
|
-
const T =
|
|
1387
|
+
const T = O.find((R) => R.__cdata);
|
|
1332
1388
|
if (T) {
|
|
1333
1389
|
const R = T.__cdata[0]["#text"] || "";
|
|
1334
|
-
|
|
1390
|
+
h += `${n}<${P}${U}><![CDATA[${R}]]></${P}>${b}`;
|
|
1335
1391
|
}
|
|
1336
|
-
} else ee ?
|
|
1392
|
+
} else ee ? h += `${n}<${P}${U}></${P}>${b}` : Y ? h += `${n}<${P}${U}>${K}</${P}>${b}` : (h += `${n}<${P}${U}>${b}`, h += se(O, { indent: i, level: p + 1, format: y, selfClosingTags: E, selfClosingOccurrences: B, selfClosingCounters: _ }), h += `${n}</${P}>${b}`);
|
|
1337
1393
|
}
|
|
1338
|
-
return
|
|
1339
|
-
},
|
|
1394
|
+
return h;
|
|
1395
|
+
}, qt = { class: "xml-format__content" }, jt = {
|
|
1340
1396
|
key: 0,
|
|
1341
1397
|
class: "xml-format__error"
|
|
1342
|
-
},
|
|
1398
|
+
}, It = {
|
|
1343
1399
|
key: 1,
|
|
1344
1400
|
class: "xml-format__error"
|
|
1345
|
-
},
|
|
1401
|
+
}, Lt = {
|
|
1346
1402
|
key: 2,
|
|
1347
1403
|
class: "xml-format__viewer"
|
|
1348
|
-
},
|
|
1404
|
+
}, Ut = /* @__PURE__ */ Ce({
|
|
1349
1405
|
__name: "index",
|
|
1350
1406
|
props: {
|
|
1351
1407
|
modelValue: { default: "" },
|
|
@@ -1357,34 +1413,34 @@ const Re = {
|
|
|
1357
1413
|
preserveWhitespace: { type: Boolean, default: !1 }
|
|
1358
1414
|
},
|
|
1359
1415
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
1360
|
-
setup(
|
|
1416
|
+
setup(r, { expose: m, emit: i }) {
|
|
1361
1417
|
$e((t) => ({
|
|
1362
1418
|
"56635be8": U.value.colors.background,
|
|
1363
1419
|
"106ac08b": U.value.colors.text,
|
|
1364
1420
|
"07c07b2c": U.value.colors.error,
|
|
1365
1421
|
"821d1190": U.value.colors.errorBackground
|
|
1366
1422
|
}));
|
|
1367
|
-
const p =
|
|
1423
|
+
const p = r, y = i, n = I(null), b = I(""), E = I(/* @__PURE__ */ new Set()), B = I(null), _ = I(""), h = I(""), X = I(/* @__PURE__ */ new Set()), P = I(!1), S = L(() => b.value === ""), O = (t) => {
|
|
1368
1424
|
if (!t || typeof t != "object")
|
|
1369
1425
|
return t;
|
|
1370
1426
|
if (Array.isArray(t)) {
|
|
1371
|
-
const l = t.map((k) =>
|
|
1427
|
+
const l = t.map((k) => O(k)), a = [], g = [];
|
|
1372
1428
|
l.forEach((k, N) => {
|
|
1373
1429
|
if (!k || typeof k != "object") {
|
|
1374
1430
|
g.push({ item: k, originalIndex: N });
|
|
1375
1431
|
return;
|
|
1376
1432
|
}
|
|
1377
|
-
const W = Object.keys(k),
|
|
1378
|
-
|
|
1433
|
+
const W = Object.keys(k), j = W.find((V) => !V.startsWith("?") && !V.startsWith(":") && !V.startsWith("#") && !V.startsWith("__")) || W[0] || "";
|
|
1434
|
+
j.startsWith("#") || j.startsWith("__") ? g.push({ item: k, originalIndex: N }) : j.startsWith("?") ? g.push({ item: k, originalIndex: N }) : a.push({ item: k, originalIndex: N });
|
|
1379
1435
|
}), a.sort((k, N) => {
|
|
1380
1436
|
const W = (H) => {
|
|
1381
1437
|
const e = Object.keys(H);
|
|
1382
|
-
for (const
|
|
1383
|
-
if (!
|
|
1384
|
-
return
|
|
1438
|
+
for (const s of e)
|
|
1439
|
+
if (!s.startsWith("?") && !s.startsWith(":") && !s.startsWith("#") && !s.startsWith("__"))
|
|
1440
|
+
return s;
|
|
1385
1441
|
return e[0] || "";
|
|
1386
|
-
},
|
|
1387
|
-
return
|
|
1442
|
+
}, j = W(k.item), V = W(N.item);
|
|
1443
|
+
return j.localeCompare(V);
|
|
1388
1444
|
});
|
|
1389
1445
|
const v = [];
|
|
1390
1446
|
let C = 0;
|
|
@@ -1416,13 +1472,13 @@ const Re = {
|
|
|
1416
1472
|
g[C] = a[C];
|
|
1417
1473
|
d[l] = g;
|
|
1418
1474
|
} else
|
|
1419
|
-
d[l] =
|
|
1475
|
+
d[l] = O(a);
|
|
1420
1476
|
}
|
|
1421
1477
|
return d;
|
|
1422
1478
|
}, z = L(() => {
|
|
1423
|
-
const t = B.value !== null ? B.value :
|
|
1424
|
-
return !t || !
|
|
1425
|
-
}), Q = L(() =>
|
|
1479
|
+
const t = B.value !== null ? B.value : n.value;
|
|
1480
|
+
return !t || !P.value ? t : O(t);
|
|
1481
|
+
}), Q = L(() => _.value ? null : z.value), U = L(() => Et(p.theme)), Y = L(() => {
|
|
1426
1482
|
const t = Q.value;
|
|
1427
1483
|
return !t || !Array.isArray(t) ? [] : t.map((d, f) => ({ node: d, originalIndex: f })).filter((d) => !d.node["?xml"]);
|
|
1428
1484
|
}), K = L(() => {
|
|
@@ -1434,20 +1490,20 @@ const Re = {
|
|
|
1434
1490
|
return f["@_version"] && l.push(`version="${f["@_version"]}"`), f["@_encoding"] && l.push(`encoding="${f["@_encoding"]}"`), f["@_standalone"] && l.push(`standalone="${f["@_standalone"]}"`), l.length > 0 ? `<?xml ${l.join(" ")}?>` : null;
|
|
1435
1491
|
}), J = L(() => Y.value), ee = (t) => {
|
|
1436
1492
|
if (!t || !t.trim()) {
|
|
1437
|
-
|
|
1493
|
+
b.value = "", n.value = null, h.value = "", B.value = null, _.value = "";
|
|
1438
1494
|
return;
|
|
1439
1495
|
}
|
|
1440
1496
|
try {
|
|
1441
|
-
const d =
|
|
1497
|
+
const d = Xt(t);
|
|
1442
1498
|
if (!d.valid) {
|
|
1443
|
-
|
|
1499
|
+
b.value = d.error || "Invalid XML", n.value = null, h.value = "", X.value = /* @__PURE__ */ new Set();
|
|
1444
1500
|
return;
|
|
1445
1501
|
}
|
|
1446
|
-
|
|
1502
|
+
h.value = t, X.value = Rt(t), n.value = ge(t), Array.isArray(n.value) && Nt(n.value, t), b.value = "", B.value = null, _.value = "", ae(() => {
|
|
1447
1503
|
R();
|
|
1448
1504
|
});
|
|
1449
1505
|
} catch (d) {
|
|
1450
|
-
|
|
1506
|
+
b.value = d instanceof Error ? d.message : "Unknown parse error", n.value = null, h.value = "", B.value = null, _.value = "";
|
|
1451
1507
|
}
|
|
1452
1508
|
}, T = (t) => {
|
|
1453
1509
|
E.value.has(t) ? E.value.delete(t) : E.value.add(t);
|
|
@@ -1476,18 +1532,18 @@ const Re = {
|
|
|
1476
1532
|
}, ue = async () => {
|
|
1477
1533
|
if (S.value)
|
|
1478
1534
|
try {
|
|
1479
|
-
const t = Q.value ||
|
|
1535
|
+
const t = Q.value || n.value;
|
|
1480
1536
|
if (!t) return;
|
|
1481
|
-
const d = Array.isArray(t) ?
|
|
1537
|
+
const d = Array.isArray(t) ? se(t, { indent: " ", originalXml: h.value || void 0 }) : ke(t, { format: !0, indentBy: " " });
|
|
1482
1538
|
await navigator.clipboard.writeText(d), y("copy-success", d);
|
|
1483
1539
|
} catch (t) {
|
|
1484
1540
|
const d = t instanceof Error ? t : new Error("Copy failed");
|
|
1485
1541
|
y("copy-error", d), console.error("Failed to copy XML:", t);
|
|
1486
1542
|
}
|
|
1487
1543
|
}, de = () => {
|
|
1488
|
-
if (!(!S.value || !
|
|
1544
|
+
if (!(!S.value || !n.value))
|
|
1489
1545
|
try {
|
|
1490
|
-
const t =
|
|
1546
|
+
const t = Pt(n.value, p.modelValue);
|
|
1491
1547
|
y("update:modelValue", t), y("compress", t);
|
|
1492
1548
|
} catch (t) {
|
|
1493
1549
|
console.error("Failed to compress XML:", t);
|
|
@@ -1503,19 +1559,19 @@ const Re = {
|
|
|
1503
1559
|
} catch (t) {
|
|
1504
1560
|
console.error("Failed to format XML:", t);
|
|
1505
1561
|
}
|
|
1506
|
-
},
|
|
1562
|
+
}, be = (t) => {
|
|
1507
1563
|
if (!t || !t.expression.trim()) {
|
|
1508
1564
|
Z();
|
|
1509
1565
|
return;
|
|
1510
1566
|
}
|
|
1511
|
-
if (!
|
|
1512
|
-
|
|
1567
|
+
if (!n.value || !h.value) {
|
|
1568
|
+
_.value = "No valid XML data to filter";
|
|
1513
1569
|
return;
|
|
1514
1570
|
}
|
|
1515
1571
|
try {
|
|
1516
|
-
const f = new Ke().parseFromString(
|
|
1572
|
+
const f = new Ke().parseFromString(h.value, "text/xml"), l = We.select(t.expression, f);
|
|
1517
1573
|
if (!l || Array.isArray(l) && l.length === 0) {
|
|
1518
|
-
B.value = [],
|
|
1574
|
+
B.value = [], _.value = "";
|
|
1519
1575
|
return;
|
|
1520
1576
|
}
|
|
1521
1577
|
const a = new Xe();
|
|
@@ -1526,22 +1582,22 @@ const Re = {
|
|
|
1526
1582
|
` : v.nodeType === 2 ? g += ` <attribute name="${v.name}" value="${v.value}"/>
|
|
1527
1583
|
` : v.nodeType === 3 && (g += ` <text>${v.nodeValue}</text>
|
|
1528
1584
|
`);
|
|
1529
|
-
}), g += "</result>") : g = a.serializeToString(l), B.value = ge(g),
|
|
1585
|
+
}), g += "</result>") : g = a.serializeToString(l), B.value = ge(g), _.value = "", ae(() => {
|
|
1530
1586
|
R();
|
|
1531
1587
|
});
|
|
1532
1588
|
} catch (d) {
|
|
1533
|
-
|
|
1589
|
+
_.value = d instanceof Error ? d.message : "Filter execution error", B.value = null;
|
|
1534
1590
|
}
|
|
1535
1591
|
}, Z = () => {
|
|
1536
|
-
B.value = null,
|
|
1592
|
+
B.value = null, _.value = "", ae(() => {
|
|
1537
1593
|
R();
|
|
1538
1594
|
});
|
|
1539
1595
|
}, me = () => {
|
|
1540
|
-
|
|
1596
|
+
P.value = !0, ae(() => {
|
|
1541
1597
|
R();
|
|
1542
1598
|
});
|
|
1543
|
-
},
|
|
1544
|
-
|
|
1599
|
+
}, he = () => {
|
|
1600
|
+
P.value = !1, ae(() => {
|
|
1545
1601
|
R();
|
|
1546
1602
|
});
|
|
1547
1603
|
}, fe = (t) => typeof t == "string" ? t : JSON.stringify(t, null, 2) ?? "undefined", ye = async (t) => {
|
|
@@ -1552,21 +1608,21 @@ const Re = {
|
|
|
1552
1608
|
const f = d instanceof Error ? d : new Error("Copy failed");
|
|
1553
1609
|
y("copy-error", f), console.error("Failed to copy value:", d);
|
|
1554
1610
|
}
|
|
1555
|
-
},
|
|
1556
|
-
if (!(!
|
|
1611
|
+
}, oe = (t, d, f) => {
|
|
1612
|
+
if (!(!n.value || !Array.isArray(n.value)))
|
|
1557
1613
|
try {
|
|
1558
1614
|
const l = t.split(/\./).filter(Boolean);
|
|
1559
|
-
let a =
|
|
1615
|
+
let a = n.value;
|
|
1560
1616
|
for (let v = 0; v < l.length; v++) {
|
|
1561
1617
|
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1562
1618
|
if (k) {
|
|
1563
1619
|
const N = k[1], W = parseInt(k[2]);
|
|
1564
1620
|
if (v === l.length - 1) {
|
|
1565
1621
|
if (Array.isArray(a) && a[W]) {
|
|
1566
|
-
const
|
|
1567
|
-
if (
|
|
1568
|
-
const V =
|
|
1569
|
-
delete
|
|
1622
|
+
const j = a[W];
|
|
1623
|
+
if (j[d]) {
|
|
1624
|
+
const V = j[d];
|
|
1625
|
+
delete j[d], j[f] = V, X.value.has(d) && (X.value.delete(d), X.value.add(f));
|
|
1570
1626
|
}
|
|
1571
1627
|
}
|
|
1572
1628
|
} else
|
|
@@ -1574,19 +1630,19 @@ const Re = {
|
|
|
1574
1630
|
} else
|
|
1575
1631
|
a[C] && (a = a[C]);
|
|
1576
1632
|
}
|
|
1577
|
-
const g =
|
|
1633
|
+
const g = se(n.value, {
|
|
1578
1634
|
indent: " ",
|
|
1579
|
-
originalXml:
|
|
1635
|
+
originalXml: h.value || void 0
|
|
1580
1636
|
});
|
|
1581
1637
|
y("update:modelValue", g);
|
|
1582
1638
|
} catch (l) {
|
|
1583
1639
|
console.error("Failed to update tag name:", l);
|
|
1584
1640
|
}
|
|
1585
|
-
},
|
|
1586
|
-
if (!(!
|
|
1641
|
+
}, xe = (t, d, f) => {
|
|
1642
|
+
if (!(!n.value || !Array.isArray(n.value)))
|
|
1587
1643
|
try {
|
|
1588
1644
|
const l = t.split(/\./).filter(Boolean);
|
|
1589
|
-
let a =
|
|
1645
|
+
let a = n.value;
|
|
1590
1646
|
for (let v = 0; v < l.length; v++) {
|
|
1591
1647
|
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1592
1648
|
if (k) {
|
|
@@ -1604,16 +1660,16 @@ const Re = {
|
|
|
1604
1660
|
} else
|
|
1605
1661
|
a[C] && (a = a[C]);
|
|
1606
1662
|
}
|
|
1607
|
-
const g =
|
|
1663
|
+
const g = se(n.value, { indent: " ", originalXml: h.value || void 0 });
|
|
1608
1664
|
y("update:modelValue", g);
|
|
1609
1665
|
} catch (l) {
|
|
1610
1666
|
console.error("Failed to update attribute name:", l);
|
|
1611
1667
|
}
|
|
1612
|
-
},
|
|
1613
|
-
if (!(!
|
|
1668
|
+
}, _e = (t, d, f) => {
|
|
1669
|
+
if (!(!n.value || !Array.isArray(n.value)))
|
|
1614
1670
|
try {
|
|
1615
1671
|
const l = t.split(/\./).filter(Boolean);
|
|
1616
|
-
let a =
|
|
1672
|
+
let a = n.value;
|
|
1617
1673
|
for (let v = 0; v < l.length; v++) {
|
|
1618
1674
|
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1619
1675
|
if (k) {
|
|
@@ -1628,25 +1684,25 @@ const Re = {
|
|
|
1628
1684
|
} else
|
|
1629
1685
|
a[C] && (a = a[C]);
|
|
1630
1686
|
}
|
|
1631
|
-
const g =
|
|
1687
|
+
const g = se(n.value, { indent: " ", originalXml: h.value || void 0 });
|
|
1632
1688
|
y("update:modelValue", g);
|
|
1633
1689
|
} catch (l) {
|
|
1634
1690
|
console.error("Failed to update attribute value:", l);
|
|
1635
1691
|
}
|
|
1636
1692
|
}, le = (t, d) => {
|
|
1637
|
-
if (!(!
|
|
1693
|
+
if (!(!n.value || !Array.isArray(n.value)))
|
|
1638
1694
|
try {
|
|
1639
1695
|
const f = t.split(/\./).filter(Boolean);
|
|
1640
|
-
let l =
|
|
1696
|
+
let l = n.value, a = "";
|
|
1641
1697
|
for (let v = 0; v < f.length; v++) {
|
|
1642
1698
|
const C = f[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1643
1699
|
if (k) {
|
|
1644
1700
|
const N = k[1], W = parseInt(k[2]);
|
|
1645
1701
|
if (v === f.length - 1) {
|
|
1646
1702
|
if (Array.isArray(l) && l[W]) {
|
|
1647
|
-
const
|
|
1648
|
-
if (a = Object.keys(
|
|
1649
|
-
const V =
|
|
1703
|
+
const j = l[W];
|
|
1704
|
+
if (a = Object.keys(j).find((V) => !V.startsWith(":") && !V.startsWith("#")) || "", a && Array.isArray(j[a])) {
|
|
1705
|
+
const V = j[a], H = V.findIndex((e) => e["#text"] !== void 0);
|
|
1650
1706
|
H !== -1 ? V[H]["#text"] = d : V.push({ "#text": d });
|
|
1651
1707
|
}
|
|
1652
1708
|
}
|
|
@@ -1655,25 +1711,25 @@ const Re = {
|
|
|
1655
1711
|
} else
|
|
1656
1712
|
l[C] && (l = l[C]);
|
|
1657
1713
|
}
|
|
1658
|
-
const g =
|
|
1714
|
+
const g = se(n.value, { indent: " ", originalXml: h.value || void 0 });
|
|
1659
1715
|
y("update:modelValue", g);
|
|
1660
1716
|
} catch (f) {
|
|
1661
1717
|
console.error("Failed to update text content:", f);
|
|
1662
1718
|
}
|
|
1663
1719
|
}, ce = (t, d) => {
|
|
1664
|
-
if (!(!
|
|
1720
|
+
if (!(!n.value || !Array.isArray(n.value)))
|
|
1665
1721
|
try {
|
|
1666
1722
|
const f = t.split(/\./).filter(Boolean);
|
|
1667
|
-
let l =
|
|
1723
|
+
let l = n.value;
|
|
1668
1724
|
for (let g = 0; g < f.length; g++) {
|
|
1669
1725
|
const v = f[g], C = v.match(/^(.+?)\[(\d+)\]$/);
|
|
1670
1726
|
if (C) {
|
|
1671
1727
|
const k = C[1], N = parseInt(C[2]);
|
|
1672
1728
|
if (g === f.length - 1) {
|
|
1673
1729
|
if (Array.isArray(l) && l[N]) {
|
|
1674
|
-
const W = l[N],
|
|
1675
|
-
if (
|
|
1676
|
-
const V = W[
|
|
1730
|
+
const W = l[N], j = Object.keys(W).find((V) => !V.startsWith(":") && !V.startsWith("#"));
|
|
1731
|
+
if (j && Array.isArray(W[j])) {
|
|
1732
|
+
const V = W[j], H = V.findIndex((e) => e.__cdata !== void 0);
|
|
1677
1733
|
if (H !== -1) {
|
|
1678
1734
|
const e = V[H];
|
|
1679
1735
|
Array.isArray(e.__cdata) && e.__cdata[0] && (e.__cdata[0]["#text"] = d);
|
|
@@ -1688,7 +1744,7 @@ const Re = {
|
|
|
1688
1744
|
} else
|
|
1689
1745
|
l[v] && (l = l[v]);
|
|
1690
1746
|
}
|
|
1691
|
-
const a =
|
|
1747
|
+
const a = se(n.value, { indent: " ", originalXml: h.value || void 0 });
|
|
1692
1748
|
y("update:modelValue", a);
|
|
1693
1749
|
} catch (f) {
|
|
1694
1750
|
console.error("Failed to update CDATA content:", f);
|
|
@@ -1705,19 +1761,19 @@ const Re = {
|
|
|
1705
1761
|
collapseAll: G,
|
|
1706
1762
|
toggleExpand: T,
|
|
1707
1763
|
// 过滤相关方法
|
|
1708
|
-
filter:
|
|
1764
|
+
filter: be,
|
|
1709
1765
|
clearFilter: Z,
|
|
1710
1766
|
// 排序相关方法
|
|
1711
1767
|
sort: me,
|
|
1712
|
-
clearSort:
|
|
1713
|
-
isSorted: () =>
|
|
1768
|
+
clearSort: he,
|
|
1769
|
+
isSorted: () => P.value,
|
|
1714
1770
|
// 状态访问方法
|
|
1715
1771
|
isValidXml: () => S.value,
|
|
1716
|
-
getParsedXml: () =>
|
|
1772
|
+
getParsedXml: () => n.value,
|
|
1717
1773
|
getFilteredXml: () => B.value,
|
|
1718
1774
|
getExpandedNodes: () => E.value,
|
|
1719
|
-
getParseError: () =>
|
|
1720
|
-
getFilterError: () =>
|
|
1775
|
+
getParseError: () => b.value,
|
|
1776
|
+
getFilterError: () => _.value,
|
|
1721
1777
|
// 工具方法
|
|
1722
1778
|
parseXmlString: (t) => ee(t),
|
|
1723
1779
|
copyValue: (t) => ye(t),
|
|
@@ -1725,17 +1781,17 @@ const Re = {
|
|
|
1725
1781
|
}), (t, d) => ($(), w("div", {
|
|
1726
1782
|
class: Ve(["xml-format", `xml-format--${U.value.name}`])
|
|
1727
1783
|
}, [
|
|
1728
|
-
|
|
1729
|
-
S.value ?
|
|
1730
|
-
d[1] || (d[1] =
|
|
1731
|
-
|
|
1732
|
-
])) : ($(), w("div",
|
|
1784
|
+
o("div", qt, [
|
|
1785
|
+
S.value ? _.value ? ($(), w("div", It, [
|
|
1786
|
+
d[1] || (d[1] = o("h4", null, "Filter Error:", -1)),
|
|
1787
|
+
o("pre", null, D(_.value), 1)
|
|
1788
|
+
])) : ($(), w("div", Lt, [
|
|
1733
1789
|
K.value ? ($(), w("div", {
|
|
1734
1790
|
key: 0,
|
|
1735
1791
|
class: "xml-declaration",
|
|
1736
1792
|
style: c({ color: U.value.colors.xmlDeclaration })
|
|
1737
1793
|
}, D(K.value), 5)) : pe("", !0),
|
|
1738
|
-
($(!0), w(
|
|
1794
|
+
($(!0), w(re, null, ie(J.value, (f, l) => ($(), Be(Ct, {
|
|
1739
1795
|
key: l,
|
|
1740
1796
|
node: f.node,
|
|
1741
1797
|
index: f.originalIndex,
|
|
@@ -1745,41 +1801,42 @@ const Re = {
|
|
|
1745
1801
|
selfClosingTags: X.value,
|
|
1746
1802
|
onToggleExpand: T,
|
|
1747
1803
|
onCopy: ye,
|
|
1748
|
-
"onUpdate:tagName":
|
|
1749
|
-
"onUpdate:attributeName":
|
|
1750
|
-
"onUpdate:attributeValue":
|
|
1804
|
+
"onUpdate:tagName": oe,
|
|
1805
|
+
"onUpdate:attributeName": xe,
|
|
1806
|
+
"onUpdate:attributeValue": _e,
|
|
1751
1807
|
"onUpdate:textContent": le,
|
|
1752
1808
|
"onUpdate:cdataContent": ce
|
|
1753
1809
|
}, null, 8, ["node", "index", "expanded", "theme", "selfClosingTags"]))), 128))
|
|
1754
1810
|
])) : ($(), w("div", jt, [
|
|
1755
|
-
d[0] || (d[0] =
|
|
1756
|
-
|
|
1811
|
+
d[0] || (d[0] = o("h4", null, "XML Parse Error:", -1)),
|
|
1812
|
+
o("pre", null, D(b.value), 1)
|
|
1757
1813
|
]))
|
|
1758
1814
|
])
|
|
1759
1815
|
], 2));
|
|
1760
1816
|
}
|
|
1761
|
-
}),
|
|
1817
|
+
}), tl = /* @__PURE__ */ we(Ut, [["__scopeId", "data-v-afd6c257"]]);
|
|
1762
1818
|
export {
|
|
1763
|
-
|
|
1819
|
+
tl as X,
|
|
1764
1820
|
Ct as a,
|
|
1765
1821
|
$t as b,
|
|
1766
1822
|
Bt as c,
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1823
|
+
Tt as d,
|
|
1824
|
+
ke as e,
|
|
1825
|
+
Pt as f,
|
|
1826
|
+
Et as g,
|
|
1827
|
+
Ot as h,
|
|
1772
1828
|
zt as i,
|
|
1773
1829
|
Zt as j,
|
|
1774
1830
|
Jt as k,
|
|
1775
1831
|
Gt as l,
|
|
1776
1832
|
wt as m,
|
|
1777
1833
|
Yt as n,
|
|
1778
|
-
|
|
1834
|
+
el as o,
|
|
1779
1835
|
ge as p,
|
|
1780
1836
|
Nt as q,
|
|
1781
|
-
|
|
1782
|
-
|
|
1837
|
+
Rt as r,
|
|
1838
|
+
Dt as s,
|
|
1783
1839
|
Ae as t,
|
|
1784
|
-
|
|
1840
|
+
se as u,
|
|
1841
|
+
Xt as v
|
|
1785
1842
|
};
|