lone-format 0.13.0 → 0.14.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/_chunks/{index-DfjCsqDT.js → index-5wbkWClK.js} +350 -349
- package/dist/_chunks/{index-13rwh2MK.js → index-AlOFzpXl.js} +203 -196
- package/dist/_chunks/{index-DvNM7Tl4.js → index-BAEkF-Fh.js} +633 -632
- package/dist/components/JsonFormat/index.js +1 -1
- package/dist/components/JsonFormat/index.vue.d.ts +1 -0
- package/dist/components/JsonFormat/types.d.ts +1 -0
- package/dist/components/SqlFormat/index.js +1 -1
- package/dist/components/SqlFormat/index.vue.d.ts +1 -0
- package/dist/components/SqlFormat/types.d.ts +1 -0
- package/dist/components/XmlFormat/index.js +2 -2
- package/dist/components/XmlFormat/index.vue.d.ts +1 -0
- package/dist/components/XmlFormat/types.d.ts +1 -0
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +3 -3
- package/dist/lone-format.umd.cjs +50 -50
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Ce, useCssVars as $e, ref 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 n, toDisplayString as D, withKeys as A, withModifiers as j, Fragment as se, 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";
|
|
@@ -55,749 +55,749 @@ const Re = {
|
|
|
55
55
|
cd71bc7c: e.theme.colors.collapsedBackgroundHover,
|
|
56
56
|
"30a02a6b": e.theme.colors.indentLine
|
|
57
57
|
}));
|
|
58
|
-
const
|
|
59
|
-
const e =
|
|
58
|
+
const i = s, p = m, y = I(!1), o = I(null), h = I(null), E = I(!1), B = I(!1), x = I(""), b = I(""), X = I(""), O = I(""), S = I(""), P = I(null), z = I(null), Q = I(null), U = I(null), Y = I(null), K = L(() => Object.keys(i.node).find((r) => !r.startsWith(":") && !r.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[":@"] || {}, r = {};
|
|
60
60
|
return Object.keys(e).forEach((M) => {
|
|
61
|
-
M.startsWith("@_") && (
|
|
62
|
-
}),
|
|
61
|
+
M.startsWith("@_") && (r[M.substring(2)] = e[M]);
|
|
62
|
+
}), r;
|
|
63
63
|
}), G = L(() => {
|
|
64
64
|
if (T.value !== "element" || !K.value) return [];
|
|
65
|
-
const e =
|
|
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((r) => r.__cdata);
|
|
70
70
|
if (e && Array.isArray(e.__cdata)) {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
return
|
|
71
|
+
const r = e.__cdata;
|
|
72
|
+
if (r.length > 0 && r[0]["#text"])
|
|
73
|
+
return r[0]["#text"];
|
|
74
74
|
}
|
|
75
75
|
return "";
|
|
76
|
-
}),
|
|
76
|
+
}), te = L(() => {
|
|
77
77
|
if (T.value !== "element" || !K.value || ue.value) return "";
|
|
78
|
-
const e =
|
|
78
|
+
const e = i.node[K.value];
|
|
79
79
|
if (!Array.isArray(e)) return "";
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
}),
|
|
80
|
+
const r = e.find((M) => M["#text"]);
|
|
81
|
+
return r ? r["#text"] : "";
|
|
82
|
+
}), he = L(() => {
|
|
83
83
|
if (T.value !== "comment") return "";
|
|
84
|
-
const e =
|
|
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),
|
|
87
|
-
Z.value &&
|
|
88
|
-
}, _e = (e,
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
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), be = 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), ne = () => {
|
|
87
|
+
Z.value && p("toggle-expand", J.value);
|
|
88
|
+
}, _e = (e, r) => `${J.value}-child-${r}`, xe = () => `${J.value}.${K.value}`, le = () => {
|
|
89
|
+
y.value = !0, x.value = K.value, ae(() => {
|
|
90
|
+
if (P.value) {
|
|
91
|
+
P.value.focus();
|
|
92
92
|
const e = document.createRange();
|
|
93
|
-
e.selectNodeContents(
|
|
94
|
-
const
|
|
95
|
-
|
|
93
|
+
e.selectNodeContents(P.value);
|
|
94
|
+
const r = window.getSelection();
|
|
95
|
+
r?.removeAllRanges(), r?.addRange(e);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
},
|
|
99
|
-
o.value = e, b.value = e,
|
|
98
|
+
}, ce = (e) => {
|
|
99
|
+
o.value = e, b.value = e, ae(() => {
|
|
100
100
|
if (z.value) {
|
|
101
101
|
z.value.focus();
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const r = document.createRange();
|
|
103
|
+
r.selectNodeContents(z.value);
|
|
104
104
|
const M = window.getSelection();
|
|
105
|
-
M?.removeAllRanges(), M?.addRange(
|
|
105
|
+
M?.removeAllRanges(), M?.addRange(r);
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
},
|
|
109
|
-
|
|
108
|
+
}, t = (e) => {
|
|
109
|
+
h.value = e, X.value = R.value[e] || "", ae(() => {
|
|
110
110
|
if (Q.value) {
|
|
111
111
|
Q.value.focus();
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
const r = document.createRange();
|
|
113
|
+
r.selectNodeContents(Q.value);
|
|
114
114
|
const M = window.getSelection();
|
|
115
|
-
M?.removeAllRanges(), M?.addRange(
|
|
115
|
+
M?.removeAllRanges(), M?.addRange(r);
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
|
-
},
|
|
119
|
-
|
|
118
|
+
}, d = () => {
|
|
119
|
+
E.value = !0, O.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 r = window.getSelection();
|
|
125
|
+
r?.removeAllRanges(), r?.addRange(e);
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
},
|
|
129
|
-
if (!
|
|
130
|
-
const e =
|
|
128
|
+
}, f = () => {
|
|
129
|
+
if (!y.value) return;
|
|
130
|
+
const e = P.value?.innerText.trim() || "";
|
|
131
131
|
if (!e || e === K.value) {
|
|
132
|
-
|
|
132
|
+
y.value = !1;
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
},
|
|
135
|
+
y.value = !1, p("update:tagName", J.value, K.value, e);
|
|
136
|
+
}, l = () => {
|
|
137
137
|
if (!o.value) return;
|
|
138
|
-
const e = o.value,
|
|
139
|
-
if (!
|
|
138
|
+
const e = o.value, r = z.value?.innerText.trim() || "";
|
|
139
|
+
if (!r || r === e) {
|
|
140
140
|
o.value = null;
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
o.value = null,
|
|
144
|
-
},
|
|
145
|
-
if (!
|
|
146
|
-
const e =
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
if (!
|
|
143
|
+
o.value = null, p("update:attributeName", J.value, e, r);
|
|
144
|
+
}, a = () => {
|
|
145
|
+
if (!h.value) return;
|
|
146
|
+
const e = h.value, r = Q.value?.innerText.trim() || "";
|
|
147
|
+
h.value = null, p("update:attributeValue", J.value, e, r);
|
|
148
|
+
}, g = () => {
|
|
149
|
+
if (!E.value) return;
|
|
150
150
|
const e = U.value?.innerText || "";
|
|
151
|
-
if (e ===
|
|
152
|
-
|
|
151
|
+
if (e === te.value) {
|
|
152
|
+
E.value = !1;
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
E.value = !1, p("update:textContent", J.value, e);
|
|
156
|
+
}, v = () => {
|
|
157
|
+
y.value = !1, x.value = K.value;
|
|
156
158
|
}, C = () => {
|
|
157
|
-
v.value = !1, x.value = K.value;
|
|
158
|
-
}, k = () => {
|
|
159
159
|
o.value && (b.value = o.value, o.value = null);
|
|
160
|
-
},
|
|
161
|
-
|
|
160
|
+
}, k = () => {
|
|
161
|
+
h.value && (X.value = R.value[h.value] || "", h.value = null);
|
|
162
|
+
}, N = () => {
|
|
163
|
+
E.value = !1, O.value = te.value;
|
|
162
164
|
}, W = () => {
|
|
163
|
-
|
|
164
|
-
}, I = () => {
|
|
165
|
-
B.value = !0, S.value = de.value, ne(() => {
|
|
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 r = window.getSelection();
|
|
171
|
+
r?.removeAllRanges(), r?.addRange(e);
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
-
},
|
|
174
|
+
}, q = () => {
|
|
175
175
|
if (!B.value) return;
|
|
176
176
|
const e = Y.value?.innerText || "";
|
|
177
177
|
if (e === de.value) {
|
|
178
178
|
B.value = !1;
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
B.value = !1,
|
|
182
|
-
},
|
|
181
|
+
B.value = !1, p("update:cdataContent", J.value, e);
|
|
182
|
+
}, V = () => {
|
|
183
183
|
B.value = !1, S.value = de.value;
|
|
184
184
|
}, H = (e) => {
|
|
185
|
-
Z.value && (e.preventDefault(),
|
|
185
|
+
Z.value && (e.preventDefault(), le());
|
|
186
186
|
};
|
|
187
|
-
return (e,
|
|
187
|
+
return (e, r) => {
|
|
188
188
|
const M = De("XmlNode", !0);
|
|
189
189
|
return $(), w("div", {
|
|
190
190
|
class: "xml-node",
|
|
191
|
-
style:
|
|
191
|
+
style: c({ paddingLeft: e.level > 0 ? "16px" : "0" })
|
|
192
192
|
}, [
|
|
193
193
|
T.value === "comment" ? ($(), w("div", Re, [
|
|
194
194
|
n("span", {
|
|
195
|
-
style:
|
|
196
|
-
}, " <!-- " +
|
|
195
|
+
style: c({ color: e.theme.colors.xmlComment })
|
|
196
|
+
}, " <!-- " + D(he.value) + " --> ", 5)
|
|
197
197
|
])) : T.value === "cdata" ? ($(), w("div", je, [
|
|
198
198
|
n("span", {
|
|
199
|
-
style:
|
|
200
|
-
}, " <![CDATA[" +
|
|
199
|
+
style: c({ color: e.theme.colors.xmlCdata })
|
|
200
|
+
}, " <![CDATA[" + D(e.node.__cdata) + "]]> ", 5)
|
|
201
201
|
])) : T.value === "element" ? ($(), w("div", qe, [
|
|
202
202
|
ue.value ? ($(), w("div", Ie, [
|
|
203
203
|
n("span", {
|
|
204
204
|
class: "xml-node__bracket",
|
|
205
|
-
style:
|
|
205
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
206
206
|
}, "<", 4),
|
|
207
207
|
n("span", {
|
|
208
208
|
class: "xml-node__tag xml-node__tag--editable",
|
|
209
|
-
style:
|
|
210
|
-
contenteditable:
|
|
211
|
-
onDblclick:
|
|
209
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
210
|
+
contenteditable: y.value,
|
|
211
|
+
onDblclick: le,
|
|
212
212
|
onContextmenu: H,
|
|
213
213
|
onKeydown: [
|
|
214
|
-
A(j(
|
|
215
|
-
A(
|
|
214
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
215
|
+
A(v, ["escape"])
|
|
216
216
|
],
|
|
217
|
-
onBlur:
|
|
217
|
+
onBlur: f,
|
|
218
218
|
ref_key: "tagNameRef",
|
|
219
|
-
ref:
|
|
219
|
+
ref: P,
|
|
220
220
|
title: "Double-click to edit tag name"
|
|
221
|
-
},
|
|
222
|
-
($(!0), w(
|
|
221
|
+
}, D(y.value ? x.value : K.value), 45, Le),
|
|
222
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
223
223
|
key: u,
|
|
224
224
|
class: "xml-node__attribute"
|
|
225
225
|
}, [
|
|
226
226
|
n("span", {
|
|
227
227
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
228
|
-
style:
|
|
228
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
229
229
|
contenteditable: o.value === u,
|
|
230
|
-
onDblclick: (_) =>
|
|
230
|
+
onDblclick: (_) => ce(u),
|
|
231
231
|
onKeydown: [
|
|
232
|
-
A(j(
|
|
233
|
-
A(
|
|
232
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
233
|
+
A(C, ["escape"])
|
|
234
234
|
],
|
|
235
|
-
onBlur:
|
|
235
|
+
onBlur: l,
|
|
236
236
|
ref_for: !0,
|
|
237
237
|
ref: (_) => {
|
|
238
238
|
o.value === u && (z.value = _);
|
|
239
239
|
},
|
|
240
240
|
title: "Double-click to edit attribute name"
|
|
241
|
-
},
|
|
241
|
+
}, D(o.value === u ? b.value : u), 45, Ue),
|
|
242
242
|
n("span", {
|
|
243
243
|
class: "xml-node__equals",
|
|
244
|
-
style:
|
|
244
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
245
245
|
}, "=", 4),
|
|
246
246
|
n("span", {
|
|
247
247
|
class: "xml-node__quote",
|
|
248
|
-
style:
|
|
248
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
249
249
|
}, '"', 4),
|
|
250
250
|
n("span", {
|
|
251
251
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
252
|
-
style:
|
|
253
|
-
contenteditable:
|
|
254
|
-
onDblclick: (_) =>
|
|
252
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
253
|
+
contenteditable: h.value === u,
|
|
254
|
+
onDblclick: (_) => t(u),
|
|
255
255
|
onKeydown: [
|
|
256
|
-
A(j(
|
|
257
|
-
A(
|
|
256
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
257
|
+
A(k, ["escape"])
|
|
258
258
|
],
|
|
259
|
-
onBlur:
|
|
259
|
+
onBlur: a,
|
|
260
260
|
ref_for: !0,
|
|
261
261
|
ref: (_) => {
|
|
262
|
-
|
|
262
|
+
h.value === u && (Q.value = _);
|
|
263
263
|
},
|
|
264
264
|
title: "Double-click to edit attribute value"
|
|
265
|
-
},
|
|
265
|
+
}, D(h.value === u ? X.value : F), 45, Fe),
|
|
266
266
|
n("span", {
|
|
267
267
|
class: "xml-node__quote",
|
|
268
|
-
style:
|
|
268
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
269
269
|
}, '"', 4)
|
|
270
270
|
]))), 128)),
|
|
271
271
|
n("span", {
|
|
272
272
|
class: "xml-node__bracket",
|
|
273
|
-
style:
|
|
273
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
274
274
|
}, ">", 4),
|
|
275
275
|
n("span", {
|
|
276
276
|
class: "xml-node__cdata",
|
|
277
|
-
style:
|
|
277
|
+
style: c({ color: e.theme.colors.xmlCdata })
|
|
278
278
|
}, "<![CDATA[", 4),
|
|
279
279
|
n("span", {
|
|
280
280
|
class: "xml-node__cdata-content xml-node__cdata-content--editable",
|
|
281
|
-
style:
|
|
281
|
+
style: c({ color: e.theme.colors.xmlCdata }),
|
|
282
282
|
contenteditable: B.value,
|
|
283
|
-
onDblclick:
|
|
283
|
+
onDblclick: W,
|
|
284
284
|
onKeydown: [
|
|
285
|
-
A(j(
|
|
286
|
-
A(
|
|
285
|
+
A(j(q, ["prevent"]), ["enter"]),
|
|
286
|
+
A(V, ["escape"])
|
|
287
287
|
],
|
|
288
|
-
onBlur:
|
|
288
|
+
onBlur: q,
|
|
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
|
n("span", {
|
|
294
294
|
class: "xml-node__cdata",
|
|
295
|
-
style:
|
|
295
|
+
style: c({ color: e.theme.colors.xmlCdata })
|
|
296
296
|
}, "]]>", 4),
|
|
297
297
|
n("span", {
|
|
298
298
|
class: "xml-node__bracket",
|
|
299
|
-
style:
|
|
299
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
300
300
|
}, "</", 4),
|
|
301
301
|
n("span", {
|
|
302
302
|
class: "xml-node__tag",
|
|
303
|
-
style:
|
|
304
|
-
},
|
|
303
|
+
style: c({ color: e.theme.colors.xmlTag })
|
|
304
|
+
}, D(y.value ? x.value : K.value), 5),
|
|
305
305
|
n("span", {
|
|
306
306
|
class: "xml-node__bracket",
|
|
307
|
-
style:
|
|
307
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
308
308
|
}, ">", 4)
|
|
309
|
-
])) :
|
|
309
|
+
])) : be.value ? ($(), w("div", Se, [
|
|
310
310
|
n("span", {
|
|
311
311
|
class: "xml-node__bracket",
|
|
312
|
-
style:
|
|
312
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
313
313
|
}, "<", 4),
|
|
314
314
|
n("span", {
|
|
315
315
|
class: "xml-node__tag xml-node__tag--editable",
|
|
316
|
-
style:
|
|
317
|
-
contenteditable:
|
|
318
|
-
onDblclick:
|
|
316
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
317
|
+
contenteditable: y.value,
|
|
318
|
+
onDblclick: le,
|
|
319
319
|
onContextmenu: H,
|
|
320
320
|
onKeydown: [
|
|
321
|
-
A(j(
|
|
322
|
-
A(
|
|
321
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
322
|
+
A(v, ["escape"])
|
|
323
323
|
],
|
|
324
|
-
onBlur:
|
|
324
|
+
onBlur: f,
|
|
325
325
|
ref_key: "tagNameRef",
|
|
326
|
-
ref:
|
|
326
|
+
ref: P,
|
|
327
327
|
title: "Double-click to edit tag name"
|
|
328
|
-
},
|
|
329
|
-
($(!0), w(
|
|
328
|
+
}, D(y.value ? x.value : K.value), 45, Qe),
|
|
329
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
330
330
|
key: u,
|
|
331
331
|
class: "xml-node__attribute"
|
|
332
332
|
}, [
|
|
333
333
|
n("span", {
|
|
334
334
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
335
|
-
style:
|
|
335
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
336
336
|
contenteditable: o.value === u,
|
|
337
|
-
onDblclick: (_) =>
|
|
337
|
+
onDblclick: (_) => ce(u),
|
|
338
338
|
onKeydown: [
|
|
339
|
-
A(j(
|
|
340
|
-
A(
|
|
339
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
340
|
+
A(C, ["escape"])
|
|
341
341
|
],
|
|
342
|
-
onBlur:
|
|
342
|
+
onBlur: l,
|
|
343
343
|
ref_for: !0,
|
|
344
344
|
ref: (_) => {
|
|
345
345
|
o.value === u && (z.value = _);
|
|
346
346
|
},
|
|
347
347
|
title: "Double-click to edit attribute name"
|
|
348
|
-
},
|
|
348
|
+
}, D(o.value === u ? b.value : u), 45, He),
|
|
349
349
|
n("span", {
|
|
350
350
|
class: "xml-node__equals",
|
|
351
|
-
style:
|
|
351
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
352
352
|
}, "=", 4),
|
|
353
353
|
n("span", {
|
|
354
354
|
class: "xml-node__quote",
|
|
355
|
-
style:
|
|
355
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
356
356
|
}, '"', 4),
|
|
357
357
|
n("span", {
|
|
358
358
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
359
|
-
style:
|
|
360
|
-
contenteditable:
|
|
361
|
-
onDblclick: (_) =>
|
|
359
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
360
|
+
contenteditable: h.value === u,
|
|
361
|
+
onDblclick: (_) => t(u),
|
|
362
362
|
onKeydown: [
|
|
363
|
-
A(j(
|
|
364
|
-
A(
|
|
363
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
364
|
+
A(k, ["escape"])
|
|
365
365
|
],
|
|
366
|
-
onBlur:
|
|
366
|
+
onBlur: a,
|
|
367
367
|
ref_for: !0,
|
|
368
368
|
ref: (_) => {
|
|
369
|
-
|
|
369
|
+
h.value === u && (Q.value = _);
|
|
370
370
|
},
|
|
371
371
|
title: "Double-click to edit attribute value"
|
|
372
|
-
},
|
|
372
|
+
}, D(h.value === u ? X.value : F), 45, ze),
|
|
373
373
|
n("span", {
|
|
374
374
|
class: "xml-node__quote",
|
|
375
|
-
style:
|
|
375
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
376
376
|
}, '"', 4)
|
|
377
377
|
]))), 128)),
|
|
378
378
|
n("span", {
|
|
379
379
|
class: "xml-node__bracket",
|
|
380
|
-
style:
|
|
380
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
381
381
|
}, ">", 4),
|
|
382
382
|
n("span", {
|
|
383
383
|
class: "xml-node__text-content xml-node__text-content--editable",
|
|
384
|
-
style:
|
|
385
|
-
contenteditable:
|
|
386
|
-
onDblclick:
|
|
384
|
+
style: c({ color: e.theme.colors.xmlText }),
|
|
385
|
+
contenteditable: E.value,
|
|
386
|
+
onDblclick: d,
|
|
387
387
|
onKeydown: [
|
|
388
|
-
A(j(
|
|
389
|
-
A(
|
|
388
|
+
A(j(g, ["prevent"]), ["enter"]),
|
|
389
|
+
A(N, ["escape"])
|
|
390
390
|
],
|
|
391
|
-
onBlur:
|
|
391
|
+
onBlur: g,
|
|
392
392
|
ref_key: "textContentRef",
|
|
393
393
|
ref: U,
|
|
394
394
|
title: "Double-click to edit text content"
|
|
395
|
-
}, E
|
|
395
|
+
}, D(E.value ? O.value : te.value), 45, Ze),
|
|
396
396
|
n("span", {
|
|
397
397
|
class: "xml-node__bracket",
|
|
398
|
-
style:
|
|
398
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
399
399
|
}, "</", 4),
|
|
400
400
|
n("span", {
|
|
401
401
|
class: "xml-node__tag",
|
|
402
|
-
style:
|
|
403
|
-
},
|
|
402
|
+
style: c({ color: e.theme.colors.xmlTag })
|
|
403
|
+
}, D(y.value ? x.value : K.value), 5),
|
|
404
404
|
n("span", {
|
|
405
405
|
class: "xml-node__bracket",
|
|
406
|
-
style:
|
|
406
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
407
407
|
}, ">", 4)
|
|
408
|
-
])) : fe.value &&
|
|
408
|
+
])) : fe.value && ye.value ? ($(), w("div", Je, [
|
|
409
409
|
n("span", {
|
|
410
410
|
class: "xml-node__bracket",
|
|
411
|
-
style:
|
|
411
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
412
412
|
}, "<", 4),
|
|
413
413
|
n("span", {
|
|
414
414
|
class: "xml-node__tag xml-node__tag--editable",
|
|
415
|
-
style:
|
|
416
|
-
contenteditable:
|
|
417
|
-
onDblclick:
|
|
415
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
416
|
+
contenteditable: y.value,
|
|
417
|
+
onDblclick: le,
|
|
418
418
|
onContextmenu: H,
|
|
419
419
|
onKeydown: [
|
|
420
|
-
A(j(
|
|
421
|
-
A(
|
|
420
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
421
|
+
A(v, ["escape"])
|
|
422
422
|
],
|
|
423
|
-
onBlur:
|
|
423
|
+
onBlur: f,
|
|
424
424
|
ref_key: "tagNameRef",
|
|
425
|
-
ref:
|
|
425
|
+
ref: P,
|
|
426
426
|
title: "Double-click to edit tag name"
|
|
427
|
-
},
|
|
428
|
-
($(!0), w(
|
|
427
|
+
}, D(y.value ? x.value : K.value), 45, Ge),
|
|
428
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
429
429
|
key: u,
|
|
430
430
|
class: "xml-node__attribute"
|
|
431
431
|
}, [
|
|
432
432
|
n("span", {
|
|
433
433
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
434
|
-
style:
|
|
434
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
435
435
|
contenteditable: o.value === u,
|
|
436
|
-
onDblclick: (_) =>
|
|
436
|
+
onDblclick: (_) => ce(u),
|
|
437
437
|
onKeydown: [
|
|
438
|
-
A(j(
|
|
439
|
-
A(
|
|
438
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
439
|
+
A(C, ["escape"])
|
|
440
440
|
],
|
|
441
|
-
onBlur:
|
|
441
|
+
onBlur: l,
|
|
442
442
|
ref_for: !0,
|
|
443
443
|
ref: (_) => {
|
|
444
444
|
o.value === u && (z.value = _);
|
|
445
445
|
},
|
|
446
446
|
title: "Double-click to edit attribute name"
|
|
447
|
-
},
|
|
447
|
+
}, D(o.value === u ? b.value : u), 45, Ye),
|
|
448
448
|
n("span", {
|
|
449
449
|
class: "xml-node__equals",
|
|
450
|
-
style:
|
|
450
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
451
451
|
}, "=", 4),
|
|
452
452
|
n("span", {
|
|
453
453
|
class: "xml-node__quote",
|
|
454
|
-
style:
|
|
454
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
455
455
|
}, '"', 4),
|
|
456
456
|
n("span", {
|
|
457
457
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
458
|
-
style:
|
|
459
|
-
contenteditable:
|
|
460
|
-
onDblclick: (_) =>
|
|
458
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
459
|
+
contenteditable: h.value === u,
|
|
460
|
+
onDblclick: (_) => t(u),
|
|
461
461
|
onKeydown: [
|
|
462
|
-
A(j(
|
|
463
|
-
A(
|
|
462
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
463
|
+
A(k, ["escape"])
|
|
464
464
|
],
|
|
465
|
-
onBlur:
|
|
465
|
+
onBlur: a,
|
|
466
466
|
ref_for: !0,
|
|
467
467
|
ref: (_) => {
|
|
468
|
-
|
|
468
|
+
h.value === u && (Q.value = _);
|
|
469
469
|
},
|
|
470
470
|
title: "Double-click to edit attribute value"
|
|
471
|
-
},
|
|
471
|
+
}, D(h.value === u ? X.value : F), 45, et),
|
|
472
472
|
n("span", {
|
|
473
473
|
class: "xml-node__quote",
|
|
474
|
-
style:
|
|
474
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
475
475
|
}, '"', 4)
|
|
476
476
|
]))), 128)),
|
|
477
477
|
n("span", {
|
|
478
478
|
class: "xml-node__bracket",
|
|
479
|
-
style:
|
|
479
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
480
480
|
}, " />", 4)
|
|
481
481
|
])) : fe.value ? ($(), w("div", tt, [
|
|
482
482
|
n("span", {
|
|
483
483
|
class: "xml-node__bracket",
|
|
484
|
-
style:
|
|
484
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
485
485
|
}, "<", 4),
|
|
486
486
|
n("span", {
|
|
487
487
|
class: "xml-node__tag xml-node__tag--editable",
|
|
488
|
-
style:
|
|
489
|
-
contenteditable:
|
|
490
|
-
onDblclick:
|
|
488
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
489
|
+
contenteditable: y.value,
|
|
490
|
+
onDblclick: le,
|
|
491
491
|
onContextmenu: H,
|
|
492
492
|
onKeydown: [
|
|
493
|
-
A(j(
|
|
494
|
-
A(
|
|
493
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
494
|
+
A(v, ["escape"])
|
|
495
495
|
],
|
|
496
|
-
onBlur:
|
|
496
|
+
onBlur: f,
|
|
497
497
|
ref_key: "tagNameRef",
|
|
498
|
-
ref:
|
|
498
|
+
ref: P,
|
|
499
499
|
title: "Double-click to edit tag name"
|
|
500
|
-
},
|
|
501
|
-
($(!0), w(
|
|
500
|
+
}, D(y.value ? x.value : K.value), 45, lt),
|
|
501
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
502
502
|
key: u,
|
|
503
503
|
class: "xml-node__attribute"
|
|
504
504
|
}, [
|
|
505
505
|
n("span", {
|
|
506
506
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
507
|
-
style:
|
|
507
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
508
508
|
contenteditable: o.value === u,
|
|
509
|
-
onDblclick: (_) =>
|
|
509
|
+
onDblclick: (_) => ce(u),
|
|
510
510
|
onKeydown: [
|
|
511
|
-
A(j(
|
|
512
|
-
A(
|
|
511
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
512
|
+
A(C, ["escape"])
|
|
513
513
|
],
|
|
514
|
-
onBlur:
|
|
514
|
+
onBlur: l,
|
|
515
515
|
ref_for: !0,
|
|
516
516
|
ref: (_) => {
|
|
517
517
|
o.value === u && (z.value = _);
|
|
518
518
|
},
|
|
519
519
|
title: "Double-click to edit attribute name"
|
|
520
|
-
},
|
|
520
|
+
}, D(o.value === u ? b.value : u), 45, at),
|
|
521
521
|
n("span", {
|
|
522
522
|
class: "xml-node__equals",
|
|
523
|
-
style:
|
|
523
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
524
524
|
}, "=", 4),
|
|
525
525
|
n("span", {
|
|
526
526
|
class: "xml-node__quote",
|
|
527
|
-
style:
|
|
527
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
528
528
|
}, '"', 4),
|
|
529
529
|
n("span", {
|
|
530
530
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
531
|
-
style:
|
|
532
|
-
contenteditable:
|
|
533
|
-
onDblclick: (_) =>
|
|
531
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
532
|
+
contenteditable: h.value === u,
|
|
533
|
+
onDblclick: (_) => t(u),
|
|
534
534
|
onKeydown: [
|
|
535
|
-
A(j(
|
|
536
|
-
A(
|
|
535
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
536
|
+
A(k, ["escape"])
|
|
537
537
|
],
|
|
538
|
-
onBlur:
|
|
538
|
+
onBlur: a,
|
|
539
539
|
ref_for: !0,
|
|
540
540
|
ref: (_) => {
|
|
541
|
-
|
|
541
|
+
h.value === u && (Q.value = _);
|
|
542
542
|
},
|
|
543
543
|
title: "Double-click to edit attribute value"
|
|
544
|
-
},
|
|
544
|
+
}, D(h.value === u ? X.value : F), 45, nt),
|
|
545
545
|
n("span", {
|
|
546
546
|
class: "xml-node__quote",
|
|
547
|
-
style:
|
|
547
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
548
548
|
}, '"', 4)
|
|
549
549
|
]))), 128)),
|
|
550
550
|
n("span", {
|
|
551
551
|
class: "xml-node__bracket",
|
|
552
|
-
style:
|
|
552
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
553
553
|
}, "></", 4),
|
|
554
554
|
n("span", {
|
|
555
555
|
class: "xml-node__tag",
|
|
556
|
-
style:
|
|
557
|
-
},
|
|
556
|
+
style: c({ color: e.theme.colors.xmlTag })
|
|
557
|
+
}, D(y.value ? x.value : K.value), 5),
|
|
558
558
|
n("span", {
|
|
559
559
|
class: "xml-node__bracket",
|
|
560
|
-
style:
|
|
560
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
561
561
|
}, ">", 4)
|
|
562
562
|
])) : ($(), w("div", ot, [
|
|
563
|
-
!
|
|
563
|
+
!ee.value && Z.value ? ($(), w("div", st, [
|
|
564
564
|
n("span", {
|
|
565
565
|
class: "xml-node__clickable-part",
|
|
566
|
-
onClick:
|
|
566
|
+
onClick: r[0] || (r[0] = (F) => ne()),
|
|
567
567
|
title: "Click to expand"
|
|
568
568
|
}, [
|
|
569
569
|
n("span", {
|
|
570
570
|
class: "xml-node__bracket",
|
|
571
|
-
style:
|
|
571
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
572
572
|
}, "<", 4),
|
|
573
573
|
n("span", {
|
|
574
574
|
class: "xml-node__tag xml-node__tag--editable",
|
|
575
|
-
style:
|
|
576
|
-
contenteditable:
|
|
577
|
-
onDblclick: j(
|
|
575
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
576
|
+
contenteditable: y.value,
|
|
577
|
+
onDblclick: j(le, ["stop"]),
|
|
578
578
|
onContextmenu: H,
|
|
579
579
|
onKeydown: [
|
|
580
|
-
A(j(
|
|
581
|
-
A(
|
|
580
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
581
|
+
A(v, ["escape"])
|
|
582
582
|
],
|
|
583
|
-
onBlur:
|
|
583
|
+
onBlur: f,
|
|
584
584
|
ref_key: "tagNameRef",
|
|
585
|
-
ref:
|
|
585
|
+
ref: P,
|
|
586
586
|
title: "Double-click or right-click to edit tag name"
|
|
587
|
-
},
|
|
587
|
+
}, D(y.value ? x.value : K.value), 45, rt)
|
|
588
588
|
]),
|
|
589
|
-
($(!0), w(
|
|
589
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
590
590
|
key: u,
|
|
591
591
|
class: "xml-node__attribute"
|
|
592
592
|
}, [
|
|
593
593
|
n("span", {
|
|
594
594
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
595
|
-
style:
|
|
595
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
596
596
|
contenteditable: o.value === u,
|
|
597
|
-
onDblclick: (_) =>
|
|
597
|
+
onDblclick: (_) => ce(u),
|
|
598
598
|
onKeydown: [
|
|
599
|
-
A(j(
|
|
600
|
-
A(
|
|
599
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
600
|
+
A(C, ["escape"])
|
|
601
601
|
],
|
|
602
|
-
onBlur:
|
|
602
|
+
onBlur: l,
|
|
603
603
|
ref_for: !0,
|
|
604
604
|
ref: (_) => {
|
|
605
605
|
o.value === u && (z.value = _);
|
|
606
606
|
},
|
|
607
607
|
title: "Double-click to edit attribute name"
|
|
608
|
-
},
|
|
608
|
+
}, D(o.value === u ? b.value : u), 45, ct),
|
|
609
609
|
n("span", {
|
|
610
610
|
class: "xml-node__equals",
|
|
611
|
-
style:
|
|
611
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
612
612
|
}, "=", 4),
|
|
613
613
|
n("span", {
|
|
614
614
|
class: "xml-node__quote",
|
|
615
|
-
style:
|
|
615
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
616
616
|
}, '"', 4),
|
|
617
617
|
n("span", {
|
|
618
618
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
619
|
-
style:
|
|
620
|
-
contenteditable:
|
|
621
|
-
onDblclick: (_) =>
|
|
619
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
620
|
+
contenteditable: h.value === u,
|
|
621
|
+
onDblclick: (_) => t(u),
|
|
622
622
|
onKeydown: [
|
|
623
|
-
A(j(
|
|
624
|
-
A(
|
|
623
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
624
|
+
A(k, ["escape"])
|
|
625
625
|
],
|
|
626
|
-
onBlur:
|
|
626
|
+
onBlur: a,
|
|
627
627
|
ref_for: !0,
|
|
628
628
|
ref: (_) => {
|
|
629
|
-
|
|
629
|
+
h.value === u && (Q.value = _);
|
|
630
630
|
},
|
|
631
631
|
title: "Double-click to edit attribute value"
|
|
632
|
-
},
|
|
632
|
+
}, D(h.value === u ? X.value : F), 45, it),
|
|
633
633
|
n("span", {
|
|
634
634
|
class: "xml-node__quote",
|
|
635
|
-
style:
|
|
635
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
636
636
|
}, '"', 4)
|
|
637
637
|
]))), 128)),
|
|
638
638
|
n("span", {
|
|
639
639
|
class: "xml-node__clickable-part",
|
|
640
|
-
onClick:
|
|
640
|
+
onClick: r[1] || (r[1] = (F) => ne()),
|
|
641
641
|
title: "Click to expand"
|
|
642
642
|
}, [
|
|
643
643
|
n("span", {
|
|
644
644
|
class: "xml-node__bracket",
|
|
645
|
-
style:
|
|
645
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
646
646
|
}, ">", 4)
|
|
647
647
|
]),
|
|
648
648
|
n("span", {
|
|
649
649
|
class: "xml-node__collapsed-badge",
|
|
650
|
-
onClick:
|
|
650
|
+
onClick: r[2] || (r[2] = (F) => ne()),
|
|
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
|
n("span", {
|
|
654
654
|
class: "xml-node__clickable-part",
|
|
655
|
-
onClick:
|
|
655
|
+
onClick: r[3] || (r[3] = (F) => ne()),
|
|
656
656
|
title: "Click to expand"
|
|
657
657
|
}, [
|
|
658
658
|
n("span", {
|
|
659
659
|
class: "xml-node__bracket",
|
|
660
|
-
style:
|
|
660
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
661
661
|
}, "</", 4),
|
|
662
662
|
n("span", {
|
|
663
663
|
class: "xml-node__tag",
|
|
664
|
-
style:
|
|
665
|
-
},
|
|
664
|
+
style: c({ color: e.theme.colors.xmlTag })
|
|
665
|
+
}, D(y.value ? x.value : K.value), 5),
|
|
666
666
|
n("span", {
|
|
667
667
|
class: "xml-node__bracket",
|
|
668
|
-
style:
|
|
668
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
669
669
|
}, ">", 4)
|
|
670
670
|
])
|
|
671
|
-
])) : ($(), w(
|
|
671
|
+
])) : ($(), w(se, { key: 1 }, [
|
|
672
672
|
n("div", dt, [
|
|
673
673
|
Z.value ? ($(), w("span", {
|
|
674
674
|
key: 0,
|
|
675
675
|
class: "xml-node__clickable-part",
|
|
676
|
-
onClick:
|
|
677
|
-
title:
|
|
676
|
+
onClick: r[4] || (r[4] = (F) => ne()),
|
|
677
|
+
title: ee.value ? "Click to collapse" : "Click to expand"
|
|
678
678
|
}, [
|
|
679
679
|
n("span", {
|
|
680
680
|
class: "xml-node__bracket",
|
|
681
|
-
style:
|
|
681
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
682
682
|
}, "<", 4),
|
|
683
683
|
n("span", {
|
|
684
684
|
class: "xml-node__tag xml-node__tag--editable",
|
|
685
|
-
style:
|
|
686
|
-
contenteditable:
|
|
687
|
-
onDblclick: j(
|
|
685
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
686
|
+
contenteditable: y.value,
|
|
687
|
+
onDblclick: j(le, ["stop"]),
|
|
688
688
|
onContextmenu: H,
|
|
689
689
|
onKeydown: [
|
|
690
|
-
A(j(
|
|
691
|
-
A(
|
|
690
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
691
|
+
A(v, ["escape"])
|
|
692
692
|
],
|
|
693
|
-
onBlur:
|
|
693
|
+
onBlur: f,
|
|
694
694
|
ref_key: "tagNameRef",
|
|
695
|
-
ref:
|
|
695
|
+
ref: P,
|
|
696
696
|
title: "Double-click or right-click to edit tag name"
|
|
697
|
-
},
|
|
697
|
+
}, D(y.value ? x.value : K.value), 45, ft)
|
|
698
698
|
], 8, mt)) : ($(), w("span", vt, [
|
|
699
699
|
n("span", {
|
|
700
700
|
class: "xml-node__bracket",
|
|
701
|
-
style:
|
|
701
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
702
702
|
}, "<", 4),
|
|
703
703
|
n("span", {
|
|
704
704
|
class: "xml-node__tag xml-node__tag--editable",
|
|
705
|
-
style:
|
|
706
|
-
contenteditable:
|
|
707
|
-
onDblclick:
|
|
705
|
+
style: c({ color: e.theme.colors.xmlTag }),
|
|
706
|
+
contenteditable: y.value,
|
|
707
|
+
onDblclick: le,
|
|
708
708
|
onKeydown: [
|
|
709
|
-
A(j(
|
|
710
|
-
A(
|
|
709
|
+
A(j(f, ["prevent"]), ["enter"]),
|
|
710
|
+
A(v, ["escape"])
|
|
711
711
|
],
|
|
712
|
-
onBlur:
|
|
712
|
+
onBlur: f,
|
|
713
713
|
ref_key: "tagNameRef",
|
|
714
|
-
ref:
|
|
714
|
+
ref: P,
|
|
715
715
|
title: "Double-click to edit tag name"
|
|
716
|
-
},
|
|
716
|
+
}, D(y.value ? x.value : K.value), 45, pt)
|
|
717
717
|
])),
|
|
718
|
-
($(!0), w(
|
|
718
|
+
($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
719
719
|
key: u,
|
|
720
720
|
class: "xml-node__attribute"
|
|
721
721
|
}, [
|
|
722
722
|
n("span", {
|
|
723
723
|
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
724
|
-
style:
|
|
724
|
+
style: c({ color: e.theme.colors.xmlAttribute }),
|
|
725
725
|
contenteditable: o.value === u,
|
|
726
|
-
onDblclick: (_) =>
|
|
726
|
+
onDblclick: (_) => ce(u),
|
|
727
727
|
onKeydown: [
|
|
728
|
-
A(j(
|
|
729
|
-
A(
|
|
728
|
+
A(j(l, ["prevent"]), ["enter"]),
|
|
729
|
+
A(C, ["escape"])
|
|
730
730
|
],
|
|
731
|
-
onBlur:
|
|
731
|
+
onBlur: l,
|
|
732
732
|
ref_for: !0,
|
|
733
733
|
ref: (_) => {
|
|
734
734
|
o.value === u && (z.value = _);
|
|
735
735
|
},
|
|
736
736
|
title: "Double-click to edit attribute name"
|
|
737
|
-
},
|
|
737
|
+
}, D(o.value === u ? b.value : u), 45, yt),
|
|
738
738
|
n("span", {
|
|
739
739
|
class: "xml-node__equals",
|
|
740
|
-
style:
|
|
740
|
+
style: c({ color: e.theme.colors.xmlEquals })
|
|
741
741
|
}, "=", 4),
|
|
742
742
|
n("span", {
|
|
743
743
|
class: "xml-node__quote",
|
|
744
|
-
style:
|
|
744
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
745
745
|
}, '"', 4),
|
|
746
746
|
n("span", {
|
|
747
747
|
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
748
|
-
style:
|
|
749
|
-
contenteditable:
|
|
750
|
-
onDblclick: (_) =>
|
|
748
|
+
style: c({ color: e.theme.colors.xmlAttributeValue }),
|
|
749
|
+
contenteditable: h.value === u,
|
|
750
|
+
onDblclick: (_) => t(u),
|
|
751
751
|
onKeydown: [
|
|
752
|
-
A(j(
|
|
753
|
-
A(
|
|
752
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
753
|
+
A(k, ["escape"])
|
|
754
754
|
],
|
|
755
|
-
onBlur:
|
|
755
|
+
onBlur: a,
|
|
756
756
|
ref_for: !0,
|
|
757
757
|
ref: (_) => {
|
|
758
|
-
|
|
758
|
+
h.value === u && (Q.value = _);
|
|
759
759
|
},
|
|
760
760
|
title: "Double-click to edit attribute value"
|
|
761
|
-
},
|
|
761
|
+
}, D(h.value === u ? X.value : F), 45, ht),
|
|
762
762
|
n("span", {
|
|
763
763
|
class: "xml-node__quote",
|
|
764
|
-
style:
|
|
764
|
+
style: c({ color: e.theme.colors.xmlQuote })
|
|
765
765
|
}, '"', 4)
|
|
766
766
|
]))), 128)),
|
|
767
767
|
Z.value ? ($(), w("span", {
|
|
768
768
|
key: 2,
|
|
769
769
|
class: "xml-node__clickable-part",
|
|
770
|
-
onClick:
|
|
771
|
-
title:
|
|
770
|
+
onClick: r[5] || (r[5] = (F) => ne()),
|
|
771
|
+
title: ee.value ? "Click to collapse" : "Click to expand"
|
|
772
772
|
}, [
|
|
773
773
|
n("span", {
|
|
774
774
|
class: "xml-node__bracket",
|
|
775
|
-
style:
|
|
775
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
776
776
|
}, ">", 4)
|
|
777
777
|
], 8, bt)) : ($(), w("span", {
|
|
778
778
|
key: 3,
|
|
779
779
|
class: "xml-node__bracket",
|
|
780
|
-
style:
|
|
781
|
-
},
|
|
780
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
781
|
+
}, D(Z.value ? ">" : "/>"), 5))
|
|
782
782
|
]),
|
|
783
|
-
|
|
784
|
-
G.value.length === 0 &&
|
|
783
|
+
ee.value && Z.value ? ($(), w("div", _t, [
|
|
784
|
+
G.value.length === 0 && te.value.trim() ? ($(), w("div", xt, [
|
|
785
785
|
n("span", {
|
|
786
786
|
class: "xml-node__text-content xml-node__text-content--editable",
|
|
787
|
-
style:
|
|
788
|
-
contenteditable:
|
|
789
|
-
onDblclick:
|
|
787
|
+
style: c({ color: e.theme.colors.xmlText }),
|
|
788
|
+
contenteditable: E.value,
|
|
789
|
+
onDblclick: d,
|
|
790
790
|
onKeydown: [
|
|
791
|
-
A(j(
|
|
792
|
-
A(
|
|
791
|
+
A(j(g, ["prevent"]), ["enter"]),
|
|
792
|
+
A(N, ["escape"])
|
|
793
793
|
],
|
|
794
|
-
onBlur:
|
|
794
|
+
onBlur: g,
|
|
795
795
|
ref_key: "textContentRef",
|
|
796
796
|
ref: U,
|
|
797
797
|
title: "Double-click to edit text content"
|
|
798
|
-
}, E
|
|
798
|
+
}, D(E.value ? O.value : te.value), 45, gt)
|
|
799
799
|
])) : pe("", !0),
|
|
800
|
-
($(!0), w(
|
|
800
|
+
($(!0), w(se, null, ie(G.value, (F, u) => ($(), Be(M, {
|
|
801
801
|
key: _e(F, u),
|
|
802
802
|
node: F,
|
|
803
803
|
index: u,
|
|
@@ -806,32 +806,32 @@ const Re = {
|
|
|
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: r[6] || (r[6] = (_) => e.$emit("toggle-expand", _)),
|
|
810
|
+
onCopy: r[7] || (r[7] = (_) => e.$emit("copy", _)),
|
|
811
|
+
"onUpdate:tagName": r[8] || (r[8] = (_, oe, ve) => e.$emit("update:tagName", _, oe, ve)),
|
|
812
|
+
"onUpdate:attributeName": r[9] || (r[9] = (_, oe, ve) => e.$emit("update:attributeName", _, oe, ve)),
|
|
813
|
+
"onUpdate:attributeValue": r[10] || (r[10] = (_, oe, ve) => e.$emit("update:attributeValue", _, oe, ve)),
|
|
814
|
+
"onUpdate:textContent": r[11] || (r[11] = (_, oe) => e.$emit("update:textContent", _, oe)),
|
|
815
|
+
"onUpdate:cdataContent": r[12] || (r[12] = (_, oe) => e.$emit("update:cdataContent", _, oe))
|
|
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
|
n("span", {
|
|
820
820
|
class: "xml-node__clickable-part",
|
|
821
|
-
onClick:
|
|
821
|
+
onClick: r[13] || (r[13] = (F) => ne()),
|
|
822
822
|
title: "Click to collapse"
|
|
823
823
|
}, [
|
|
824
824
|
n("span", {
|
|
825
825
|
class: "xml-node__bracket",
|
|
826
|
-
style:
|
|
826
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
827
827
|
}, "</", 4),
|
|
828
828
|
n("span", {
|
|
829
829
|
class: "xml-node__tag",
|
|
830
|
-
style:
|
|
831
|
-
},
|
|
830
|
+
style: c({ color: e.theme.colors.xmlTag })
|
|
831
|
+
}, D(y.value ? x.value : K.value), 5),
|
|
832
832
|
n("span", {
|
|
833
833
|
class: "xml-node__bracket",
|
|
834
|
-
style:
|
|
834
|
+
style: c({ color: e.theme.colors.xmlBracket })
|
|
835
835
|
}, ">", 4)
|
|
836
836
|
])
|
|
837
837
|
])) : pe("", !0)
|
|
@@ -1114,25 +1114,25 @@ const Re = {
|
|
|
1114
1114
|
suppressBooleanAttributes: !1,
|
|
1115
1115
|
suppressUnpairedNode: !1
|
|
1116
1116
|
}, Wt = (s) => {
|
|
1117
|
-
const m = /<!\[CDATA\[([\s\S]*?)\]\]>/g,
|
|
1118
|
-
let
|
|
1119
|
-
for (; (
|
|
1120
|
-
|
|
1121
|
-
start:
|
|
1122
|
-
end:
|
|
1117
|
+
const m = /<!\[CDATA\[([\s\S]*?)\]\]>/g, i = [];
|
|
1118
|
+
let p;
|
|
1119
|
+
for (; (p = m.exec(s)) !== null; )
|
|
1120
|
+
i.push({
|
|
1121
|
+
start: p.index,
|
|
1122
|
+
end: p.index + p[0].length
|
|
1123
1123
|
});
|
|
1124
|
-
const
|
|
1125
|
-
let
|
|
1126
|
-
for (; (
|
|
1127
|
-
const b =
|
|
1128
|
-
if (
|
|
1124
|
+
const y = (b) => i.some((X) => b >= X.start && b < X.end), o = /&([a-zA-Z0-9#]+);/g, h = ["lt", "gt", "amp", "quot", "apos"];
|
|
1125
|
+
let E, B = 1, x = 0;
|
|
1126
|
+
for (; (E = o.exec(s)) !== null; ) {
|
|
1127
|
+
const b = E[1], X = E.index;
|
|
1128
|
+
if (y(X))
|
|
1129
1129
|
continue;
|
|
1130
|
-
const
|
|
1131
|
-
if (B += (
|
|
1130
|
+
const O = s.substring(x, X);
|
|
1131
|
+
if (B += (O.match(/\n/g) || []).length, x = X, b.startsWith("#")) {
|
|
1132
1132
|
const S = b.substring(1);
|
|
1133
1133
|
if (S.startsWith("x") || S.startsWith("X")) {
|
|
1134
|
-
const
|
|
1135
|
-
if (!/^[0-9a-fA-F]+$/.test(
|
|
1134
|
+
const P = S.substring(1);
|
|
1135
|
+
if (!/^[0-9a-fA-F]+$/.test(P))
|
|
1136
1136
|
return {
|
|
1137
1137
|
valid: !1,
|
|
1138
1138
|
error: `Line ${B}: Invalid hexadecimal character reference '&${b};'`
|
|
@@ -1144,7 +1144,7 @@ const Re = {
|
|
|
1144
1144
|
};
|
|
1145
1145
|
continue;
|
|
1146
1146
|
}
|
|
1147
|
-
if (!
|
|
1147
|
+
if (!h.includes(b))
|
|
1148
1148
|
return {
|
|
1149
1149
|
valid: !1,
|
|
1150
1150
|
error: `Line ${B}: Invalid entity reference '&${b};'. Valid predefined entities are: < > & " '`
|
|
@@ -1161,8 +1161,8 @@ const Re = {
|
|
|
1161
1161
|
valid: !1,
|
|
1162
1162
|
error: `Line ${m.err.line}: ${m.err.msg}`
|
|
1163
1163
|
};
|
|
1164
|
-
const
|
|
1165
|
-
return
|
|
1164
|
+
const i = Wt(s);
|
|
1165
|
+
return i.valid ? { valid: !0 } : i;
|
|
1166
1166
|
} catch (m) {
|
|
1167
1167
|
return {
|
|
1168
1168
|
valid: !1,
|
|
@@ -1175,47 +1175,47 @@ const Re = {
|
|
|
1175
1175
|
...Et,
|
|
1176
1176
|
...m
|
|
1177
1177
|
}).parse(s);
|
|
1178
|
-
} catch (
|
|
1178
|
+
} catch (i) {
|
|
1179
1179
|
throw new Error(
|
|
1180
|
-
`XML 解析失败: ${
|
|
1180
|
+
`XML 解析失败: ${i instanceof Error ? i.message : "Unknown error"}`
|
|
1181
1181
|
);
|
|
1182
1182
|
}
|
|
1183
1183
|
}, ke = (s, m) => {
|
|
1184
1184
|
try {
|
|
1185
|
-
let
|
|
1185
|
+
let p = new Ne({
|
|
1186
1186
|
...Vt,
|
|
1187
1187
|
format: m?.format ?? !0,
|
|
1188
1188
|
indentBy: m?.indentBy ?? " "
|
|
1189
1189
|
}).build(s);
|
|
1190
|
-
return m?.showDeclaration !== !1 && !
|
|
1191
|
-
` +
|
|
1192
|
-
} catch (
|
|
1190
|
+
return m?.showDeclaration !== !1 && !p.startsWith("<?xml") && (p = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1191
|
+
` + p), p;
|
|
1192
|
+
} catch (i) {
|
|
1193
1193
|
throw new Error(
|
|
1194
|
-
`XML 构建失败: ${
|
|
1194
|
+
`XML 构建失败: ${i instanceof Error ? i.message : "Unknown error"}`
|
|
1195
1195
|
);
|
|
1196
1196
|
}
|
|
1197
|
-
}, Xt = (s, m) => Array.isArray(s) ?
|
|
1198
|
-
const
|
|
1199
|
-
return Array.isArray(
|
|
1197
|
+
}, Xt = (s, m) => Array.isArray(s) ? re(s, { format: !1, originalXml: m }) : ke(s, { format: !1, showDeclaration: !1 }), Ot = (s, m) => {
|
|
1198
|
+
const i = ge(s);
|
|
1199
|
+
return Array.isArray(i) ? re(i, {
|
|
1200
1200
|
indent: m?.indentBy || " ",
|
|
1201
1201
|
originalXml: s
|
|
1202
|
-
}) : ke(
|
|
1202
|
+
}) : ke(i, m);
|
|
1203
1203
|
}, Ht = (s) => {
|
|
1204
1204
|
const m = s.match(/<([a-zA-Z0-9_-]+)[\s>]/);
|
|
1205
1205
|
return m ? m[1] : null;
|
|
1206
1206
|
}, zt = (s) => {
|
|
1207
1207
|
let m = 0;
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1208
|
+
const i = (p) => {
|
|
1209
|
+
p === null || typeof p != "object" || (m++, Array.isArray(p) ? p.forEach(i) : Object.values(p).forEach(i));
|
|
1210
1210
|
};
|
|
1211
|
-
return
|
|
1211
|
+
return i(s), m;
|
|
1212
1212
|
}, Zt = (s) => !s || typeof s != "object" ? !1 : Object.keys(s).some((m) => m.startsWith("@_")), Jt = (s) => {
|
|
1213
1213
|
if (!s || typeof s != "object") return {};
|
|
1214
1214
|
const m = {};
|
|
1215
|
-
return Object.keys(s).forEach((
|
|
1216
|
-
if (
|
|
1217
|
-
const
|
|
1218
|
-
m[
|
|
1215
|
+
return Object.keys(s).forEach((i) => {
|
|
1216
|
+
if (i.startsWith("@_")) {
|
|
1217
|
+
const p = i.substring(2);
|
|
1218
|
+
m[p] = s[i];
|
|
1219
1219
|
}
|
|
1220
1220
|
}), m;
|
|
1221
1221
|
}, Gt = (s) => !s || typeof s != "object" ? typeof s == "string" ? s : null : s["#text"] || null, Yt = (s) => {
|
|
@@ -1224,67 +1224,67 @@ const Re = {
|
|
|
1224
1224
|
const m = Object.keys(s);
|
|
1225
1225
|
return m.length === 0 || m.length === 1 && m[0].startsWith("@_");
|
|
1226
1226
|
}, Pt = (s, m) => {
|
|
1227
|
-
const
|
|
1228
|
-
for (const
|
|
1229
|
-
const
|
|
1227
|
+
const i = Te(m), p = /* @__PURE__ */ new Map(), y = (o) => {
|
|
1228
|
+
for (const h of o) {
|
|
1229
|
+
const E = Object.keys(h).find(
|
|
1230
1230
|
(b) => !b.startsWith(":") && !b.startsWith("#") && !b.startsWith("__") && !b.startsWith("?")
|
|
1231
1231
|
);
|
|
1232
|
-
if (!
|
|
1233
|
-
const B =
|
|
1234
|
-
|
|
1235
|
-
const x =
|
|
1236
|
-
Array.isArray(x) && x.length > 0 &&
|
|
1232
|
+
if (!E) continue;
|
|
1233
|
+
const B = p.get(E) ?? 0;
|
|
1234
|
+
p.set(E, B + 1), h[":selfClosing"] = i.get(E)?.[B] ?? !1;
|
|
1235
|
+
const x = h[E];
|
|
1236
|
+
Array.isArray(x) && x.length > 0 && y(x);
|
|
1237
1237
|
}
|
|
1238
1238
|
};
|
|
1239
|
-
|
|
1239
|
+
y(s);
|
|
1240
1240
|
}, Nt = (s) => {
|
|
1241
|
-
const m = /* @__PURE__ */ new Set(),
|
|
1242
|
-
let
|
|
1243
|
-
for (; (
|
|
1244
|
-
m.add(
|
|
1241
|
+
const m = /* @__PURE__ */ new Set(), i = /<([a-zA-Z0-9_-]+)(?:\s[^>]*)?\s*\/>/g;
|
|
1242
|
+
let p;
|
|
1243
|
+
for (; (p = i.exec(s)) !== null; )
|
|
1244
|
+
m.add(p[1]);
|
|
1245
1245
|
return m;
|
|
1246
1246
|
}, Te = (s) => {
|
|
1247
1247
|
const m = /* @__PURE__ */ new Map();
|
|
1248
|
-
let
|
|
1249
|
-
for (;
|
|
1250
|
-
if (s.startsWith("<!--",
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1248
|
+
let i = 0;
|
|
1249
|
+
for (; i < s.length; ) {
|
|
1250
|
+
if (s.startsWith("<!--", i)) {
|
|
1251
|
+
const p = s.indexOf("-->", i);
|
|
1252
|
+
i = p !== -1 ? p + 3 : s.length;
|
|
1253
1253
|
continue;
|
|
1254
1254
|
}
|
|
1255
|
-
if (s.startsWith("<![CDATA[",
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1255
|
+
if (s.startsWith("<![CDATA[", i)) {
|
|
1256
|
+
const p = s.indexOf("]]>", i);
|
|
1257
|
+
i = p !== -1 ? p + 3 : s.length;
|
|
1258
1258
|
continue;
|
|
1259
1259
|
}
|
|
1260
|
-
if (s.startsWith("<?",
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1260
|
+
if (s.startsWith("<?", i)) {
|
|
1261
|
+
const p = s.indexOf("?>", i);
|
|
1262
|
+
i = p !== -1 ? p + 2 : s.length;
|
|
1263
1263
|
continue;
|
|
1264
1264
|
}
|
|
1265
|
-
if (s.startsWith("</",
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1265
|
+
if (s.startsWith("</", i)) {
|
|
1266
|
+
const p = s.indexOf(">", i);
|
|
1267
|
+
i = p !== -1 ? p + 1 : s.length;
|
|
1268
1268
|
continue;
|
|
1269
1269
|
}
|
|
1270
|
-
if (s[
|
|
1271
|
-
const
|
|
1272
|
-
if (
|
|
1273
|
-
const
|
|
1274
|
-
let o =
|
|
1270
|
+
if (s[i] === "<") {
|
|
1271
|
+
const p = s.slice(i + 1).match(/^([a-zA-Z_][a-zA-Z0-9_:.-]*)/);
|
|
1272
|
+
if (p) {
|
|
1273
|
+
const y = p[1];
|
|
1274
|
+
let o = i + 1 + y.length, h = !1, E = "";
|
|
1275
1275
|
for (; o < s.length; ) {
|
|
1276
1276
|
const B = s[o];
|
|
1277
|
-
if (
|
|
1278
|
-
B ===
|
|
1277
|
+
if (h)
|
|
1278
|
+
B === E && (h = !1);
|
|
1279
1279
|
else if (B === '"' || B === "'")
|
|
1280
|
-
|
|
1280
|
+
h = !0, E = B;
|
|
1281
1281
|
else if (B === ">") {
|
|
1282
1282
|
let x = o - 1;
|
|
1283
|
-
for (; x >
|
|
1283
|
+
for (; x > i && (s[x] === " " || s[x] === " " || s[x] === `
|
|
1284
1284
|
` || s[x] === "\r"); )
|
|
1285
1285
|
x--;
|
|
1286
1286
|
const b = s[x] === "/";
|
|
1287
|
-
m.has(
|
|
1287
|
+
m.has(y) || m.set(y, []), m.get(y).push(b), i = o + 1;
|
|
1288
1288
|
break;
|
|
1289
1289
|
}
|
|
1290
1290
|
o++;
|
|
@@ -1293,47 +1293,47 @@ const Re = {
|
|
|
1293
1293
|
continue;
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
|
-
|
|
1296
|
+
i++;
|
|
1297
1297
|
}
|
|
1298
1298
|
return m;
|
|
1299
|
-
},
|
|
1300
|
-
const
|
|
1299
|
+
}, re = (s, m = {}) => {
|
|
1300
|
+
const i = m.indent !== void 0 ? m.indent : " ", p = m.level || 0, y = m.format !== !1, o = y ? i.repeat(p) : "", h = y ? `
|
|
1301
1301
|
` : "";
|
|
1302
|
-
let
|
|
1303
|
-
|
|
1302
|
+
let E = m.selfClosingTags, B = m.selfClosingOccurrences, x = m.selfClosingCounters;
|
|
1303
|
+
p === 0 && m.originalXml && (B = Te(m.originalXml), x = /* @__PURE__ */ new Map());
|
|
1304
1304
|
let b = "";
|
|
1305
1305
|
for (const X of s) {
|
|
1306
1306
|
if (X["?xml"]) {
|
|
1307
1307
|
const T = X[":@"] || {}, R = Object.entries(T).map(([G, ue]) => `${G.startsWith("@_") ? G.substring(2) : G}="${ue}"`).join(" ");
|
|
1308
|
-
b += `<?xml ${R}?>${
|
|
1308
|
+
b += `<?xml ${R}?>${h}`;
|
|
1309
1309
|
continue;
|
|
1310
1310
|
}
|
|
1311
1311
|
if (X["#comment"]) {
|
|
1312
1312
|
const T = X["#comment"];
|
|
1313
1313
|
if (Array.isArray(T) && T.length > 0) {
|
|
1314
1314
|
const R = T[0]["#text"] || T[0];
|
|
1315
|
-
b += `${o}<!--${R}-->${
|
|
1315
|
+
b += `${o}<!--${R}-->${h}`;
|
|
1316
1316
|
}
|
|
1317
1317
|
continue;
|
|
1318
1318
|
}
|
|
1319
|
-
const
|
|
1320
|
-
if (!
|
|
1319
|
+
const O = Object.keys(X).find((T) => !T.startsWith(":") && !T.startsWith("#") && !T.startsWith("__"));
|
|
1320
|
+
if (!O) continue;
|
|
1321
1321
|
let S = 0;
|
|
1322
|
-
B && x && (S = x.get(
|
|
1323
|
-
const
|
|
1324
|
-
if (!Array.isArray(
|
|
1322
|
+
B && x && (S = x.get(O) ?? 0, x.set(O, S + 1));
|
|
1323
|
+
const P = X[O], z = X[":@"] || {}, Q = Object.entries(z).map(([T, R]) => `${T.startsWith("@_") ? T.substring(2) : T}="${R}"`).join(" "), U = Q ? " " + Q : "";
|
|
1324
|
+
if (!Array.isArray(P) || P.length === 0) {
|
|
1325
1325
|
let T;
|
|
1326
|
-
B ? T = B.get(
|
|
1326
|
+
B ? T = B.get(O)?.[S] ?? !1 : T = !!(E && E.has(O)), T ? b += `${o}<${O}${U}/>${h}` : b += `${o}<${O}${U}></${O}>${h}`;
|
|
1327
1327
|
continue;
|
|
1328
1328
|
}
|
|
1329
|
-
const Y =
|
|
1329
|
+
const Y = P.length === 1 && P[0]["#text"] !== void 0, K = Y ? P[0]["#text"] : "", J = P.some((T) => T.__cdata), ee = Y && K === "";
|
|
1330
1330
|
if (J) {
|
|
1331
|
-
const T =
|
|
1331
|
+
const T = P.find((R) => R.__cdata);
|
|
1332
1332
|
if (T) {
|
|
1333
1333
|
const R = T.__cdata[0]["#text"] || "";
|
|
1334
|
-
b += `${o}<${
|
|
1334
|
+
b += `${o}<${O}${U}><![CDATA[${R}]]></${O}>${h}`;
|
|
1335
1335
|
}
|
|
1336
|
-
} else
|
|
1336
|
+
} else ee ? b += `${o}<${O}${U}></${O}>${h}` : Y ? b += `${o}<${O}${U}>${K}</${O}>${h}` : (b += `${o}<${O}${U}>${h}`, b += re(P, { indent: i, level: p + 1, format: y, selfClosingTags: E, selfClosingOccurrences: B, selfClosingCounters: x }), b += `${o}</${O}>${h}`);
|
|
1337
1337
|
}
|
|
1338
1338
|
return b;
|
|
1339
1339
|
}, Rt = { class: "xml-format__content" }, jt = {
|
|
@@ -1357,45 +1357,45 @@ const Re = {
|
|
|
1357
1357
|
preserveWhitespace: { type: Boolean, default: !1 }
|
|
1358
1358
|
},
|
|
1359
1359
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
1360
|
-
setup(s, { expose: m, emit:
|
|
1361
|
-
$e((
|
|
1362
|
-
"
|
|
1363
|
-
"
|
|
1364
|
-
"
|
|
1365
|
-
"
|
|
1360
|
+
setup(s, { expose: m, emit: i }) {
|
|
1361
|
+
$e((t) => ({
|
|
1362
|
+
"56635be8": U.value.colors.background,
|
|
1363
|
+
"106ac08b": U.value.colors.text,
|
|
1364
|
+
"07c07b2c": U.value.colors.error,
|
|
1365
|
+
"821d1190": U.value.colors.errorBackground
|
|
1366
1366
|
}));
|
|
1367
|
-
const
|
|
1368
|
-
if (!
|
|
1369
|
-
return
|
|
1370
|
-
if (Array.isArray(
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1367
|
+
const p = s, y = i, o = I(null), h = I(""), E = I(/* @__PURE__ */ new Set()), B = I(null), x = I(""), b = I(""), X = I(/* @__PURE__ */ new Set()), O = I(!1), S = L(() => h.value === ""), P = (t) => {
|
|
1368
|
+
if (!t || typeof t != "object")
|
|
1369
|
+
return t;
|
|
1370
|
+
if (Array.isArray(t)) {
|
|
1371
|
+
const l = t.map((k) => P(k)), a = [], g = [];
|
|
1372
|
+
l.forEach((k, N) => {
|
|
1373
1373
|
if (!k || typeof k != "object") {
|
|
1374
|
-
|
|
1374
|
+
g.push({ item: k, originalIndex: N });
|
|
1375
1375
|
return;
|
|
1376
1376
|
}
|
|
1377
|
-
const W = Object.keys(k),
|
|
1378
|
-
|
|
1379
|
-
}), a.sort((k,
|
|
1380
|
-
const W = (
|
|
1381
|
-
const
|
|
1382
|
-
for (const
|
|
1383
|
-
if (!
|
|
1384
|
-
return
|
|
1385
|
-
return
|
|
1386
|
-
},
|
|
1387
|
-
return
|
|
1377
|
+
const W = Object.keys(k), q = W.find((V) => !V.startsWith("?") && !V.startsWith(":") && !V.startsWith("#") && !V.startsWith("__")) || W[0] || "";
|
|
1378
|
+
q.startsWith("#") || q.startsWith("__") ? g.push({ item: k, originalIndex: N }) : q.startsWith("?") ? g.push({ item: k, originalIndex: N }) : a.push({ item: k, originalIndex: N });
|
|
1379
|
+
}), a.sort((k, N) => {
|
|
1380
|
+
const W = (H) => {
|
|
1381
|
+
const e = Object.keys(H);
|
|
1382
|
+
for (const r of e)
|
|
1383
|
+
if (!r.startsWith("?") && !r.startsWith(":") && !r.startsWith("#") && !r.startsWith("__"))
|
|
1384
|
+
return r;
|
|
1385
|
+
return e[0] || "";
|
|
1386
|
+
}, q = W(k.item), V = W(N.item);
|
|
1387
|
+
return q.localeCompare(V);
|
|
1388
1388
|
});
|
|
1389
|
-
const
|
|
1389
|
+
const v = [];
|
|
1390
1390
|
let C = 0;
|
|
1391
|
-
for (let k = 0; k <
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1391
|
+
for (let k = 0; k < l.length; k++) {
|
|
1392
|
+
const N = g.find((W) => W.originalIndex === k);
|
|
1393
|
+
N ? v.push(N.item) : C < a.length && (v.push(a[C].item), C++);
|
|
1394
1394
|
}
|
|
1395
|
-
return
|
|
1395
|
+
return v;
|
|
1396
1396
|
}
|
|
1397
|
-
const d = {},
|
|
1398
|
-
const
|
|
1397
|
+
const d = {}, f = Object.keys(t).sort((l, a) => {
|
|
1398
|
+
const g = l.startsWith("?") || l.startsWith(":") || l.startsWith("#") || l.startsWith("__"), v = a.startsWith("?") || a.startsWith(":") || a.startsWith("#") || a.startsWith("__"), C = {
|
|
1399
1399
|
"?xml": 0,
|
|
1400
1400
|
":@": 1,
|
|
1401
1401
|
"#text": 2,
|
|
@@ -1403,108 +1403,108 @@ const Re = {
|
|
|
1403
1403
|
"#cdata": 3,
|
|
1404
1404
|
"#comment": 4
|
|
1405
1405
|
};
|
|
1406
|
-
if (
|
|
1407
|
-
const k = C[
|
|
1408
|
-
return k -
|
|
1409
|
-
} else return
|
|
1406
|
+
if (g && v) {
|
|
1407
|
+
const k = C[l] ?? 99, N = C[a] ?? 99;
|
|
1408
|
+
return k - N;
|
|
1409
|
+
} else return g ? -1 : v ? 1 : l.localeCompare(a);
|
|
1410
1410
|
});
|
|
1411
|
-
for (const
|
|
1412
|
-
const a = l
|
|
1413
|
-
if (
|
|
1414
|
-
const
|
|
1415
|
-
for (const C of
|
|
1416
|
-
|
|
1417
|
-
d[
|
|
1411
|
+
for (const l of f) {
|
|
1412
|
+
const a = t[l];
|
|
1413
|
+
if (l === ":@" && a && typeof a == "object" && !Array.isArray(a)) {
|
|
1414
|
+
const g = {}, v = Object.keys(a).sort();
|
|
1415
|
+
for (const C of v)
|
|
1416
|
+
g[C] = a[C];
|
|
1417
|
+
d[l] = g;
|
|
1418
1418
|
} else
|
|
1419
|
-
d[
|
|
1419
|
+
d[l] = P(a);
|
|
1420
1420
|
}
|
|
1421
1421
|
return d;
|
|
1422
1422
|
}, z = L(() => {
|
|
1423
|
-
const
|
|
1424
|
-
return !
|
|
1425
|
-
}), Q = L(() => x.value ? null : z.value), U = L(() => Dt(
|
|
1426
|
-
const
|
|
1427
|
-
return !
|
|
1423
|
+
const t = B.value !== null ? B.value : o.value;
|
|
1424
|
+
return !t || !O.value ? t : P(t);
|
|
1425
|
+
}), Q = L(() => x.value ? null : z.value), U = L(() => Dt(p.theme)), Y = L(() => {
|
|
1426
|
+
const t = Q.value;
|
|
1427
|
+
return !t || !Array.isArray(t) ? [] : t.map((d, f) => ({ node: d, originalIndex: f })).filter((d) => !d.node["?xml"]);
|
|
1428
1428
|
}), K = L(() => {
|
|
1429
|
-
const
|
|
1430
|
-
if (!
|
|
1431
|
-
const d =
|
|
1429
|
+
const t = Q.value;
|
|
1430
|
+
if (!t || !Array.isArray(t)) return null;
|
|
1431
|
+
const d = t.find((a) => a["?xml"]);
|
|
1432
1432
|
if (!d || !d[":@"]) return null;
|
|
1433
|
-
const
|
|
1434
|
-
return
|
|
1435
|
-
}), J = L(() => Y.value),
|
|
1436
|
-
if (!
|
|
1437
|
-
|
|
1433
|
+
const f = d[":@"], l = [];
|
|
1434
|
+
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
|
+
}), J = L(() => Y.value), ee = (t) => {
|
|
1436
|
+
if (!t || !t.trim()) {
|
|
1437
|
+
h.value = "", o.value = null, b.value = "", B.value = null, x.value = "";
|
|
1438
1438
|
return;
|
|
1439
1439
|
}
|
|
1440
1440
|
try {
|
|
1441
|
-
const d = Kt(
|
|
1441
|
+
const d = Kt(t);
|
|
1442
1442
|
if (!d.valid) {
|
|
1443
|
-
|
|
1443
|
+
h.value = d.error || "Invalid XML", o.value = null, b.value = "", X.value = /* @__PURE__ */ new Set();
|
|
1444
1444
|
return;
|
|
1445
1445
|
}
|
|
1446
|
-
b.value =
|
|
1446
|
+
b.value = t, X.value = Nt(t), o.value = ge(t), Array.isArray(o.value) && Pt(o.value, t), h.value = "", B.value = null, x.value = "", ae(() => {
|
|
1447
1447
|
R();
|
|
1448
1448
|
});
|
|
1449
1449
|
} catch (d) {
|
|
1450
|
-
|
|
1450
|
+
h.value = d instanceof Error ? d.message : "Unknown parse error", o.value = null, b.value = "", B.value = null, x.value = "";
|
|
1451
1451
|
}
|
|
1452
|
-
}, T = (
|
|
1453
|
-
|
|
1452
|
+
}, T = (t) => {
|
|
1453
|
+
E.value.has(t) ? E.value.delete(t) : E.value.add(t);
|
|
1454
1454
|
}, R = () => {
|
|
1455
|
-
const
|
|
1456
|
-
Array.isArray(
|
|
1457
|
-
const
|
|
1458
|
-
if (!
|
|
1459
|
-
const C =
|
|
1460
|
-
|
|
1461
|
-
const k = a[
|
|
1462
|
-
Array.isArray(k) && d(k, C + "." +
|
|
1455
|
+
const t = /* @__PURE__ */ new Set(), d = (f, l = "") => {
|
|
1456
|
+
Array.isArray(f) && f.forEach((a, g) => {
|
|
1457
|
+
const v = Object.keys(a).find((N) => !N.startsWith(":") && !N.startsWith("#"));
|
|
1458
|
+
if (!v) return;
|
|
1459
|
+
const C = l ? `${l}.${v}[${g}]` : `${v}[${g}]`;
|
|
1460
|
+
t.add(C);
|
|
1461
|
+
const k = a[v];
|
|
1462
|
+
Array.isArray(k) && d(k, C + "." + v);
|
|
1463
1463
|
});
|
|
1464
1464
|
};
|
|
1465
|
-
Y.value.forEach(({ node:
|
|
1466
|
-
const a = Object.keys(
|
|
1465
|
+
Y.value.forEach(({ node: f, originalIndex: l }) => {
|
|
1466
|
+
const a = Object.keys(f).find((g) => !g.startsWith(":") && !g.startsWith("#"));
|
|
1467
1467
|
if (a) {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
const
|
|
1471
|
-
Array.isArray(
|
|
1468
|
+
const g = `${a}[${l}]`;
|
|
1469
|
+
t.add(g);
|
|
1470
|
+
const v = f[a];
|
|
1471
|
+
Array.isArray(v) && d(v, g + "." + a);
|
|
1472
1472
|
}
|
|
1473
|
-
}),
|
|
1473
|
+
}), E.value = t, y("expand-all");
|
|
1474
1474
|
}, G = () => {
|
|
1475
|
-
|
|
1475
|
+
E.value.clear(), y("collapse-all");
|
|
1476
1476
|
}, ue = async () => {
|
|
1477
1477
|
if (S.value)
|
|
1478
1478
|
try {
|
|
1479
|
-
const
|
|
1480
|
-
if (!
|
|
1481
|
-
const d = Array.isArray(
|
|
1482
|
-
await navigator.clipboard.writeText(d),
|
|
1483
|
-
} catch (
|
|
1484
|
-
const d =
|
|
1485
|
-
|
|
1479
|
+
const t = Q.value || o.value;
|
|
1480
|
+
if (!t) return;
|
|
1481
|
+
const d = Array.isArray(t) ? re(t, { indent: " ", originalXml: b.value || void 0 }) : ke(t, { format: !0, indentBy: " " });
|
|
1482
|
+
await navigator.clipboard.writeText(d), y("copy-success", d);
|
|
1483
|
+
} catch (t) {
|
|
1484
|
+
const d = t instanceof Error ? t : new Error("Copy failed");
|
|
1485
|
+
y("copy-error", d), console.error("Failed to copy XML:", t);
|
|
1486
1486
|
}
|
|
1487
1487
|
}, de = () => {
|
|
1488
1488
|
if (!(!S.value || !o.value))
|
|
1489
1489
|
try {
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
} catch (
|
|
1493
|
-
console.error("Failed to compress XML:",
|
|
1490
|
+
const t = Xt(o.value, p.modelValue);
|
|
1491
|
+
y("update:modelValue", t), y("compress", t);
|
|
1492
|
+
} catch (t) {
|
|
1493
|
+
console.error("Failed to compress XML:", t);
|
|
1494
1494
|
}
|
|
1495
|
-
},
|
|
1495
|
+
}, te = () => {
|
|
1496
1496
|
if (S.value)
|
|
1497
1497
|
try {
|
|
1498
|
-
const
|
|
1498
|
+
const t = Ot(p.modelValue, {
|
|
1499
1499
|
format: !0,
|
|
1500
1500
|
indentBy: " "
|
|
1501
1501
|
});
|
|
1502
|
-
|
|
1503
|
-
} catch (
|
|
1504
|
-
console.error("Failed to format XML:",
|
|
1502
|
+
y("update:modelValue", t), y("format", t);
|
|
1503
|
+
} catch (t) {
|
|
1504
|
+
console.error("Failed to format XML:", t);
|
|
1505
1505
|
}
|
|
1506
|
-
},
|
|
1507
|
-
if (!
|
|
1506
|
+
}, he = (t) => {
|
|
1507
|
+
if (!t || !t.expression.trim()) {
|
|
1508
1508
|
Z();
|
|
1509
1509
|
return;
|
|
1510
1510
|
}
|
|
@@ -1513,60 +1513,60 @@ const Re = {
|
|
|
1513
1513
|
return;
|
|
1514
1514
|
}
|
|
1515
1515
|
try {
|
|
1516
|
-
const
|
|
1517
|
-
if (!
|
|
1516
|
+
const f = new Ke().parseFromString(b.value, "text/xml"), l = We.select(t.expression, f);
|
|
1517
|
+
if (!l || Array.isArray(l) && l.length === 0) {
|
|
1518
1518
|
B.value = [], x.value = "";
|
|
1519
1519
|
return;
|
|
1520
1520
|
}
|
|
1521
1521
|
const a = new Xe();
|
|
1522
|
-
let
|
|
1523
|
-
Array.isArray(
|
|
1524
|
-
`,
|
|
1525
|
-
|
|
1526
|
-
` :
|
|
1527
|
-
` :
|
|
1522
|
+
let g = "";
|
|
1523
|
+
Array.isArray(l) ? (g = `<result>
|
|
1524
|
+
`, l.forEach((v) => {
|
|
1525
|
+
v.nodeType === 1 ? g += " " + a.serializeToString(v) + `
|
|
1526
|
+
` : v.nodeType === 2 ? g += ` <attribute name="${v.name}" value="${v.value}"/>
|
|
1527
|
+
` : v.nodeType === 3 && (g += ` <text>${v.nodeValue}</text>
|
|
1528
1528
|
`);
|
|
1529
|
-
}),
|
|
1529
|
+
}), g += "</result>") : g = a.serializeToString(l), B.value = ge(g), x.value = "", ae(() => {
|
|
1530
1530
|
R();
|
|
1531
1531
|
});
|
|
1532
1532
|
} catch (d) {
|
|
1533
1533
|
x.value = d instanceof Error ? d.message : "Filter execution error", B.value = null;
|
|
1534
1534
|
}
|
|
1535
1535
|
}, Z = () => {
|
|
1536
|
-
B.value = null, x.value = "",
|
|
1536
|
+
B.value = null, x.value = "", ae(() => {
|
|
1537
1537
|
R();
|
|
1538
1538
|
});
|
|
1539
1539
|
}, me = () => {
|
|
1540
|
-
|
|
1540
|
+
O.value = !0, ae(() => {
|
|
1541
1541
|
R();
|
|
1542
1542
|
});
|
|
1543
|
-
},
|
|
1544
|
-
|
|
1543
|
+
}, be = () => {
|
|
1544
|
+
O.value = !1, ae(() => {
|
|
1545
1545
|
R();
|
|
1546
1546
|
});
|
|
1547
|
-
}, fe = async (
|
|
1547
|
+
}, fe = (t) => typeof t == "string" ? t : JSON.stringify(t, null, 2) ?? "undefined", ye = async (t) => {
|
|
1548
1548
|
try {
|
|
1549
|
-
const d =
|
|
1550
|
-
await navigator.clipboard.writeText(d),
|
|
1549
|
+
const d = fe(t);
|
|
1550
|
+
await navigator.clipboard.writeText(d), y("copy-success", d);
|
|
1551
1551
|
} catch (d) {
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1552
|
+
const f = d instanceof Error ? d : new Error("Copy failed");
|
|
1553
|
+
y("copy-error", f), console.error("Failed to copy value:", d);
|
|
1554
1554
|
}
|
|
1555
|
-
},
|
|
1555
|
+
}, ne = (t, d, f) => {
|
|
1556
1556
|
if (!(!o.value || !Array.isArray(o.value)))
|
|
1557
1557
|
try {
|
|
1558
|
-
const
|
|
1558
|
+
const l = t.split(/\./).filter(Boolean);
|
|
1559
1559
|
let a = o.value;
|
|
1560
|
-
for (let
|
|
1561
|
-
const C =
|
|
1560
|
+
for (let v = 0; v < l.length; v++) {
|
|
1561
|
+
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1562
1562
|
if (k) {
|
|
1563
|
-
const
|
|
1564
|
-
if (
|
|
1563
|
+
const N = k[1], W = parseInt(k[2]);
|
|
1564
|
+
if (v === l.length - 1) {
|
|
1565
1565
|
if (Array.isArray(a) && a[W]) {
|
|
1566
|
-
const
|
|
1567
|
-
if (
|
|
1568
|
-
const
|
|
1569
|
-
delete
|
|
1566
|
+
const q = a[W];
|
|
1567
|
+
if (q[d]) {
|
|
1568
|
+
const V = q[d];
|
|
1569
|
+
delete q[d], q[f] = V, X.value.has(d) && (X.value.delete(d), X.value.add(f));
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
1572
|
} else
|
|
@@ -1574,29 +1574,29 @@ const Re = {
|
|
|
1574
1574
|
} else
|
|
1575
1575
|
a[C] && (a = a[C]);
|
|
1576
1576
|
}
|
|
1577
|
-
const
|
|
1577
|
+
const g = re(o.value, {
|
|
1578
1578
|
indent: " ",
|
|
1579
1579
|
originalXml: b.value || void 0
|
|
1580
1580
|
});
|
|
1581
|
-
|
|
1582
|
-
} catch (
|
|
1583
|
-
console.error("Failed to update tag name:",
|
|
1581
|
+
y("update:modelValue", g);
|
|
1582
|
+
} catch (l) {
|
|
1583
|
+
console.error("Failed to update tag name:", l);
|
|
1584
1584
|
}
|
|
1585
|
-
},
|
|
1585
|
+
}, _e = (t, d, f) => {
|
|
1586
1586
|
if (!(!o.value || !Array.isArray(o.value)))
|
|
1587
1587
|
try {
|
|
1588
|
-
const
|
|
1588
|
+
const l = t.split(/\./).filter(Boolean);
|
|
1589
1589
|
let a = o.value;
|
|
1590
|
-
for (let
|
|
1591
|
-
const C =
|
|
1590
|
+
for (let v = 0; v < l.length; v++) {
|
|
1591
|
+
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1592
1592
|
if (k) {
|
|
1593
|
-
const
|
|
1594
|
-
if (
|
|
1593
|
+
const N = k[1], W = parseInt(k[2]);
|
|
1594
|
+
if (v === l.length - 1) {
|
|
1595
1595
|
if (Array.isArray(a) && a[W]) {
|
|
1596
|
-
const
|
|
1597
|
-
if (
|
|
1598
|
-
const
|
|
1599
|
-
delete
|
|
1596
|
+
const V = a[W][":@"];
|
|
1597
|
+
if (V && V[`@_${d}`] !== void 0) {
|
|
1598
|
+
const H = V[`@_${d}`];
|
|
1599
|
+
delete V[`@_${d}`], V[`@_${f}`] = H;
|
|
1600
1600
|
}
|
|
1601
1601
|
}
|
|
1602
1602
|
} else
|
|
@@ -1604,160 +1604,161 @@ const Re = {
|
|
|
1604
1604
|
} else
|
|
1605
1605
|
a[C] && (a = a[C]);
|
|
1606
1606
|
}
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1609
|
-
} catch (
|
|
1610
|
-
console.error("Failed to update attribute name:",
|
|
1607
|
+
const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1608
|
+
y("update:modelValue", g);
|
|
1609
|
+
} catch (l) {
|
|
1610
|
+
console.error("Failed to update attribute name:", l);
|
|
1611
1611
|
}
|
|
1612
|
-
},
|
|
1612
|
+
}, xe = (t, d, f) => {
|
|
1613
1613
|
if (!(!o.value || !Array.isArray(o.value)))
|
|
1614
1614
|
try {
|
|
1615
|
-
const
|
|
1615
|
+
const l = t.split(/\./).filter(Boolean);
|
|
1616
1616
|
let a = o.value;
|
|
1617
|
-
for (let
|
|
1618
|
-
const C =
|
|
1617
|
+
for (let v = 0; v < l.length; v++) {
|
|
1618
|
+
const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1619
1619
|
if (k) {
|
|
1620
|
-
const
|
|
1621
|
-
if (
|
|
1620
|
+
const N = k[1], W = parseInt(k[2]);
|
|
1621
|
+
if (v === l.length - 1) {
|
|
1622
1622
|
if (Array.isArray(a) && a[W]) {
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1623
|
+
const V = a[W][":@"];
|
|
1624
|
+
V && V[`@_${d}`] !== void 0 && (V[`@_${d}`] = f);
|
|
1625
1625
|
}
|
|
1626
1626
|
} else
|
|
1627
1627
|
Array.isArray(a) && a[W] && (a = a[W]);
|
|
1628
1628
|
} else
|
|
1629
1629
|
a[C] && (a = a[C]);
|
|
1630
1630
|
}
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1633
|
-
} catch (
|
|
1634
|
-
console.error("Failed to update attribute value:",
|
|
1631
|
+
const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1632
|
+
y("update:modelValue", g);
|
|
1633
|
+
} catch (l) {
|
|
1634
|
+
console.error("Failed to update attribute value:", l);
|
|
1635
1635
|
}
|
|
1636
|
-
},
|
|
1636
|
+
}, le = (t, d) => {
|
|
1637
1637
|
if (!(!o.value || !Array.isArray(o.value)))
|
|
1638
1638
|
try {
|
|
1639
|
-
const
|
|
1640
|
-
let
|
|
1641
|
-
for (let
|
|
1642
|
-
const C =
|
|
1639
|
+
const f = t.split(/\./).filter(Boolean);
|
|
1640
|
+
let l = o.value, a = "";
|
|
1641
|
+
for (let v = 0; v < f.length; v++) {
|
|
1642
|
+
const C = f[v], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1643
1643
|
if (k) {
|
|
1644
|
-
const
|
|
1645
|
-
if (
|
|
1646
|
-
if (Array.isArray(
|
|
1647
|
-
const
|
|
1648
|
-
if (a = Object.keys(
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1644
|
+
const N = k[1], W = parseInt(k[2]);
|
|
1645
|
+
if (v === f.length - 1) {
|
|
1646
|
+
if (Array.isArray(l) && l[W]) {
|
|
1647
|
+
const q = l[W];
|
|
1648
|
+
if (a = Object.keys(q).find((V) => !V.startsWith(":") && !V.startsWith("#")) || "", a && Array.isArray(q[a])) {
|
|
1649
|
+
const V = q[a], H = V.findIndex((e) => e["#text"] !== void 0);
|
|
1650
|
+
H !== -1 ? V[H]["#text"] = d : V.push({ "#text": d });
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
1653
|
} else
|
|
1654
|
-
Array.isArray(
|
|
1654
|
+
Array.isArray(l) && l[W] && (l = l[W]);
|
|
1655
1655
|
} else
|
|
1656
|
-
|
|
1656
|
+
l[C] && (l = l[C]);
|
|
1657
1657
|
}
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1660
|
-
} catch (
|
|
1661
|
-
console.error("Failed to update text content:",
|
|
1658
|
+
const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1659
|
+
y("update:modelValue", g);
|
|
1660
|
+
} catch (f) {
|
|
1661
|
+
console.error("Failed to update text content:", f);
|
|
1662
1662
|
}
|
|
1663
|
-
},
|
|
1663
|
+
}, ce = (t, d) => {
|
|
1664
1664
|
if (!(!o.value || !Array.isArray(o.value)))
|
|
1665
1665
|
try {
|
|
1666
|
-
const
|
|
1667
|
-
let
|
|
1668
|
-
for (let
|
|
1669
|
-
const
|
|
1666
|
+
const f = t.split(/\./).filter(Boolean);
|
|
1667
|
+
let l = o.value;
|
|
1668
|
+
for (let g = 0; g < f.length; g++) {
|
|
1669
|
+
const v = f[g], C = v.match(/^(.+?)\[(\d+)\]$/);
|
|
1670
1670
|
if (C) {
|
|
1671
|
-
const k = C[1],
|
|
1672
|
-
if (
|
|
1673
|
-
if (Array.isArray(
|
|
1674
|
-
const W =
|
|
1675
|
-
if (
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
const
|
|
1679
|
-
Array.isArray(
|
|
1671
|
+
const k = C[1], N = parseInt(C[2]);
|
|
1672
|
+
if (g === f.length - 1) {
|
|
1673
|
+
if (Array.isArray(l) && l[N]) {
|
|
1674
|
+
const W = l[N], q = Object.keys(W).find((V) => !V.startsWith(":") && !V.startsWith("#"));
|
|
1675
|
+
if (q && Array.isArray(W[q])) {
|
|
1676
|
+
const V = W[q], H = V.findIndex((e) => e.__cdata !== void 0);
|
|
1677
|
+
if (H !== -1) {
|
|
1678
|
+
const e = V[H];
|
|
1679
|
+
Array.isArray(e.__cdata) && e.__cdata[0] && (e.__cdata[0]["#text"] = d);
|
|
1680
1680
|
} else
|
|
1681
|
-
|
|
1681
|
+
V.push({
|
|
1682
1682
|
__cdata: [{ "#text": d }]
|
|
1683
1683
|
});
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
1686
|
} else
|
|
1687
|
-
Array.isArray(
|
|
1687
|
+
Array.isArray(l) && l[N] && (l = l[N]);
|
|
1688
1688
|
} else
|
|
1689
|
-
|
|
1689
|
+
l[v] && (l = l[v]);
|
|
1690
1690
|
}
|
|
1691
|
-
const a =
|
|
1692
|
-
|
|
1693
|
-
} catch (
|
|
1694
|
-
console.error("Failed to update CDATA content:",
|
|
1691
|
+
const a = re(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1692
|
+
y("update:modelValue", a);
|
|
1693
|
+
} catch (f) {
|
|
1694
|
+
console.error("Failed to update CDATA content:", f);
|
|
1695
1695
|
}
|
|
1696
1696
|
};
|
|
1697
|
-
return Ee(() =>
|
|
1698
|
-
|
|
1697
|
+
return Ee(() => p.modelValue, (t) => {
|
|
1698
|
+
ee(t);
|
|
1699
1699
|
}, { immediate: !0 }), m({
|
|
1700
1700
|
// 核心操作方法
|
|
1701
1701
|
copyXml: ue,
|
|
1702
1702
|
compressSource: de,
|
|
1703
|
-
formatSource:
|
|
1703
|
+
formatSource: te,
|
|
1704
1704
|
expandAll: R,
|
|
1705
1705
|
collapseAll: G,
|
|
1706
1706
|
toggleExpand: T,
|
|
1707
1707
|
// 过滤相关方法
|
|
1708
|
-
filter:
|
|
1708
|
+
filter: he,
|
|
1709
1709
|
clearFilter: Z,
|
|
1710
1710
|
// 排序相关方法
|
|
1711
1711
|
sort: me,
|
|
1712
|
-
clearSort:
|
|
1713
|
-
isSorted: () =>
|
|
1712
|
+
clearSort: be,
|
|
1713
|
+
isSorted: () => O.value,
|
|
1714
1714
|
// 状态访问方法
|
|
1715
1715
|
isValidXml: () => S.value,
|
|
1716
1716
|
getParsedXml: () => o.value,
|
|
1717
1717
|
getFilteredXml: () => B.value,
|
|
1718
|
-
getExpandedNodes: () =>
|
|
1719
|
-
getParseError: () =>
|
|
1718
|
+
getExpandedNodes: () => E.value,
|
|
1719
|
+
getParseError: () => h.value,
|
|
1720
1720
|
getFilterError: () => x.value,
|
|
1721
1721
|
// 工具方法
|
|
1722
|
-
parseXmlString: (
|
|
1723
|
-
copyValue: (
|
|
1724
|
-
|
|
1722
|
+
parseXmlString: (t) => ee(t),
|
|
1723
|
+
copyValue: (t) => ye(t),
|
|
1724
|
+
getValue: (t) => fe(t)
|
|
1725
|
+
}), (t, d) => ($(), w("div", {
|
|
1725
1726
|
class: Ve(["xml-format", `xml-format--${U.value.name}`])
|
|
1726
1727
|
}, [
|
|
1727
1728
|
n("div", Rt, [
|
|
1728
1729
|
S.value ? x.value ? ($(), w("div", qt, [
|
|
1729
1730
|
d[1] || (d[1] = n("h4", null, "Filter Error:", -1)),
|
|
1730
|
-
n("pre", null,
|
|
1731
|
+
n("pre", null, D(x.value), 1)
|
|
1731
1732
|
])) : ($(), w("div", It, [
|
|
1732
1733
|
K.value ? ($(), w("div", {
|
|
1733
1734
|
key: 0,
|
|
1734
1735
|
class: "xml-declaration",
|
|
1735
|
-
style:
|
|
1736
|
-
},
|
|
1737
|
-
($(!0), w(
|
|
1738
|
-
key:
|
|
1739
|
-
node:
|
|
1740
|
-
index:
|
|
1736
|
+
style: c({ color: U.value.colors.xmlDeclaration })
|
|
1737
|
+
}, D(K.value), 5)) : pe("", !0),
|
|
1738
|
+
($(!0), w(se, null, ie(J.value, (f, l) => ($(), Be(Ct, {
|
|
1739
|
+
key: l,
|
|
1740
|
+
node: f.node,
|
|
1741
|
+
index: f.originalIndex,
|
|
1741
1742
|
level: 0,
|
|
1742
|
-
expanded:
|
|
1743
|
+
expanded: E.value,
|
|
1743
1744
|
theme: U.value,
|
|
1744
1745
|
selfClosingTags: X.value,
|
|
1745
1746
|
onToggleExpand: T,
|
|
1746
|
-
onCopy:
|
|
1747
|
-
"onUpdate:tagName":
|
|
1748
|
-
"onUpdate:attributeName":
|
|
1749
|
-
"onUpdate:attributeValue":
|
|
1750
|
-
"onUpdate:textContent":
|
|
1751
|
-
"onUpdate:cdataContent":
|
|
1747
|
+
onCopy: ye,
|
|
1748
|
+
"onUpdate:tagName": ne,
|
|
1749
|
+
"onUpdate:attributeName": _e,
|
|
1750
|
+
"onUpdate:attributeValue": xe,
|
|
1751
|
+
"onUpdate:textContent": le,
|
|
1752
|
+
"onUpdate:cdataContent": ce
|
|
1752
1753
|
}, null, 8, ["node", "index", "expanded", "theme", "selfClosingTags"]))), 128))
|
|
1753
1754
|
])) : ($(), w("div", jt, [
|
|
1754
1755
|
d[0] || (d[0] = n("h4", null, "XML Parse Error:", -1)),
|
|
1755
|
-
n("pre", null,
|
|
1756
|
+
n("pre", null, D(h.value), 1)
|
|
1756
1757
|
]))
|
|
1757
1758
|
])
|
|
1758
1759
|
], 2));
|
|
1759
1760
|
}
|
|
1760
|
-
}), el = /* @__PURE__ */ we(Lt, [["__scopeId", "data-v-
|
|
1761
|
+
}), el = /* @__PURE__ */ we(Lt, [["__scopeId", "data-v-afd6c257"]]);
|
|
1761
1762
|
export {
|
|
1762
1763
|
el as X,
|
|
1763
1764
|
Ct as a,
|
|
@@ -1777,7 +1778,7 @@ export {
|
|
|
1777
1778
|
Pt as o,
|
|
1778
1779
|
ge as p,
|
|
1779
1780
|
Nt as q,
|
|
1780
|
-
|
|
1781
|
+
re as r,
|
|
1781
1782
|
Tt as s,
|
|
1782
1783
|
Ae as t,
|
|
1783
1784
|
Kt as v
|