mind-elixir 5.2.0 → 5.3.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/LICENSE +21 -21
- package/dist/LayoutSsr.iife.js +1 -1
- package/dist/LayoutSsr.js +32 -31
- package/dist/MindElixir.css +1 -0
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +911 -954
- package/dist/MindElixirLite.css +1 -0
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +528 -585
- package/dist/example.iife.js +3 -3
- package/dist/example.js +1 -1
- package/dist/types/arrow.d.ts +1 -1
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/index.d.ts +11 -11
- package/dist/types/methods.d.ts +39 -39
- package/dist/types/nodeOperation.d.ts +1 -1
- package/dist/types/plugin/keypress.d.ts +1 -1
- package/dist/types/summary.d.ts +1 -1
- package/dist/types/types/index.d.ts +9 -8
- package/dist/types/utils/index.d.ts +4 -404
- package/dist/types/utils/pubsub.d.ts +3 -2
- package/dist/types/utils/svg.d.ts +1 -1
- package/dist/types/viselect/src/EventEmitter.d.ts +13 -0
- package/dist/types/viselect/src/index.d.ts +112 -0
- package/dist/types/viselect/src/types.d.ts +85 -0
- package/dist/types/viselect/src/utils/arrayify.d.ts +1 -0
- package/dist/types/viselect/src/utils/browser.d.ts +2 -0
- package/dist/types/viselect/src/utils/css.d.ts +10 -0
- package/dist/types/viselect/src/utils/domRect.d.ts +1 -0
- package/dist/types/viselect/src/utils/events.d.ts +29 -0
- package/dist/types/viselect/src/utils/frames.d.ts +7 -0
- package/dist/types/viselect/src/utils/intersects.d.ts +9 -0
- package/dist/types/viselect/src/utils/matchesTrigger.d.ts +16 -0
- package/dist/types/viselect/src/utils/selectAll.d.ts +8 -0
- package/package.json +40 -36
- package/readme.md +430 -432
- package/dist/style.css +0 -1
- package/readme/es.md +0 -430
- package/readme/fr.md +0 -430
- package/readme/ja.md +0 -429
- package/readme/ko.md +0 -430
- package/readme/pt.md +0 -430
- package/readme/ru.md +0 -430
- package/readme/zh.md +0 -430
package/dist/MindElixir.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var gt = (e, t, n) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var X = (e, t, n) => (gt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
const we = {
|
|
1
|
+
const ve = {
|
|
5
2
|
name: "Latte",
|
|
6
3
|
type: "light",
|
|
7
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -27,7 +24,7 @@ const we = {
|
|
|
27
24
|
"--panel-border-color": "#eaeaea",
|
|
28
25
|
"--map-padding": "50px"
|
|
29
26
|
}
|
|
30
|
-
},
|
|
27
|
+
}, be = {
|
|
31
28
|
name: "Dark",
|
|
32
29
|
type: "dark",
|
|
33
30
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -54,67 +51,65 @@ const we = {
|
|
|
54
51
|
"--map-padding": "50px 80px"
|
|
55
52
|
}
|
|
56
53
|
};
|
|
57
|
-
function
|
|
54
|
+
function fe(e) {
|
|
58
55
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """);
|
|
59
56
|
}
|
|
60
|
-
const
|
|
57
|
+
const oe = function(e, t) {
|
|
61
58
|
if (t.id === e)
|
|
62
59
|
return t;
|
|
63
60
|
if (t.children && t.children.length) {
|
|
64
61
|
for (let n = 0; n < t.children.length; n++) {
|
|
65
|
-
const o =
|
|
66
|
-
if (o)
|
|
67
|
-
return o;
|
|
62
|
+
const o = oe(e, t.children[n]);
|
|
63
|
+
if (o) return o;
|
|
68
64
|
}
|
|
69
65
|
return null;
|
|
70
66
|
} else
|
|
71
67
|
return null;
|
|
72
|
-
},
|
|
68
|
+
}, R = (e, t) => {
|
|
73
69
|
if (e.parent = t, e.children)
|
|
74
70
|
for (let n = 0; n < e.children.length; n++)
|
|
75
|
-
|
|
76
|
-
},
|
|
71
|
+
R(e.children[n], e);
|
|
72
|
+
}, q = (e, t, n) => {
|
|
77
73
|
if (e.expanded = t, e.children)
|
|
78
74
|
if (n === void 0 || n > 0) {
|
|
79
75
|
const o = n !== void 0 ? n - 1 : void 0;
|
|
80
76
|
e.children.forEach((s) => {
|
|
81
|
-
|
|
77
|
+
q(s, t, o);
|
|
82
78
|
});
|
|
83
79
|
} else
|
|
84
80
|
e.children.forEach((o) => {
|
|
85
|
-
|
|
81
|
+
q(o, !1);
|
|
86
82
|
});
|
|
87
83
|
};
|
|
88
|
-
function
|
|
89
|
-
if (e.id =
|
|
84
|
+
function we(e) {
|
|
85
|
+
if (e.id = W(), e.children)
|
|
90
86
|
for (let t = 0; t < e.children.length; t++)
|
|
91
|
-
|
|
87
|
+
we(e.children[t]);
|
|
92
88
|
}
|
|
93
|
-
function
|
|
89
|
+
function se(e, t, n, o) {
|
|
94
90
|
const s = o - t, i = e - n;
|
|
95
91
|
let l = Math.atan(Math.abs(s) / Math.abs(i)) / 3.14 * 180;
|
|
96
|
-
if (isNaN(l))
|
|
97
|
-
return;
|
|
92
|
+
if (isNaN(l)) return;
|
|
98
93
|
i < 0 && s > 0 && (l = 180 - l), i < 0 && s < 0 && (l = 180 + l), i > 0 && s < 0 && (l = 360 - l);
|
|
99
|
-
const r = 12, c = 30,
|
|
94
|
+
const r = 12, c = 30, a = l + c, f = l - c;
|
|
100
95
|
return {
|
|
101
|
-
x1: n + Math.cos(Math.PI *
|
|
102
|
-
y1: o - Math.sin(Math.PI *
|
|
96
|
+
x1: n + Math.cos(Math.PI * a / 180) * r,
|
|
97
|
+
y1: o - Math.sin(Math.PI * a / 180) * r,
|
|
103
98
|
x2: n + Math.cos(Math.PI * f / 180) * r,
|
|
104
99
|
y2: o - Math.sin(Math.PI * f / 180) * r
|
|
105
100
|
};
|
|
106
101
|
}
|
|
107
|
-
function
|
|
102
|
+
function W() {
|
|
108
103
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
109
104
|
}
|
|
110
|
-
const
|
|
111
|
-
const e =
|
|
105
|
+
const ht = function() {
|
|
106
|
+
const e = W();
|
|
112
107
|
return {
|
|
113
108
|
topic: this.newTopicName,
|
|
114
109
|
id: e
|
|
115
110
|
};
|
|
116
111
|
};
|
|
117
|
-
function
|
|
112
|
+
function xe(e) {
|
|
118
113
|
return JSON.parse(
|
|
119
114
|
JSON.stringify(e, (n, o) => {
|
|
120
115
|
if (n !== "parent")
|
|
@@ -130,19 +125,18 @@ const O = (e, t) => {
|
|
|
130
125
|
}, k = (e, t) => {
|
|
131
126
|
for (const n in t)
|
|
132
127
|
e.setAttribute(n, t[n]);
|
|
133
|
-
},
|
|
128
|
+
}, ue = (e) => e ? e.tagName === "ME-TPC" : !1, ce = (e) => e.filter((t) => t.nodeObj.parent).filter((t, n, o) => {
|
|
134
129
|
for (let s = 0; s < o.length; s++) {
|
|
135
|
-
if (t === o[s])
|
|
136
|
-
continue;
|
|
130
|
+
if (t === o[s]) continue;
|
|
137
131
|
const { parent: i } = t.nodeObj;
|
|
138
132
|
if (i === o[s].nodeObj)
|
|
139
133
|
return !1;
|
|
140
134
|
}
|
|
141
135
|
return !0;
|
|
142
|
-
}),
|
|
136
|
+
}), Ve = (e) => {
|
|
143
137
|
const t = /translate\(([^,]+),\s*([^)]+)\)/, n = e.match(t);
|
|
144
138
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
145
|
-
},
|
|
139
|
+
}, Ee = function(e) {
|
|
146
140
|
for (let t = 0; t < e.length; t++) {
|
|
147
141
|
const { dom: n, evt: o, func: s } = e[t];
|
|
148
142
|
n.addEventListener(o, s);
|
|
@@ -153,42 +147,40 @@ const O = (e, t) => {
|
|
|
153
147
|
o.removeEventListener(s, i);
|
|
154
148
|
}
|
|
155
149
|
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
}, P = {
|
|
151
|
+
LHS: "lhs",
|
|
152
|
+
RHS: "rhs"
|
|
153
|
+
}, ft = (e) => {
|
|
159
154
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
160
155
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
161
|
-
},
|
|
156
|
+
}, ut = (e) => {
|
|
162
157
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
163
158
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
164
|
-
},
|
|
159
|
+
}, pt = (e) => {
|
|
165
160
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
166
|
-
},
|
|
161
|
+
}, gt = function(e, t) {
|
|
167
162
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
168
163
|
if (n) {
|
|
169
164
|
const o = n.firstChild;
|
|
170
165
|
e.selectNode(o);
|
|
171
166
|
}
|
|
172
|
-
},
|
|
167
|
+
}, mt = function(e, t) {
|
|
173
168
|
const n = t.parentElement.nextSibling;
|
|
174
169
|
if (n && n.firstChild) {
|
|
175
170
|
const o = n.firstChild.firstChild.firstChild;
|
|
176
171
|
e.selectNode(o);
|
|
177
172
|
}
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!n)
|
|
182
|
-
return;
|
|
173
|
+
}, Me = function(e, t) {
|
|
174
|
+
const n = e.currentNode || e.currentNodes?.[0];
|
|
175
|
+
if (!n) return;
|
|
183
176
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
184
|
-
o.parent ? s.className === t ?
|
|
185
|
-
},
|
|
177
|
+
o.parent ? s.className === t ? mt(e, n) : o.parent?.parent ? gt(e, n) : pt(e) : t === P.LHS ? ft(e) : ut(e);
|
|
178
|
+
}, De = function(e, t) {
|
|
186
179
|
const n = e.currentNode;
|
|
187
|
-
if (!n || !n.nodeObj.parent)
|
|
188
|
-
return;
|
|
180
|
+
if (!n || !n.nodeObj.parent) return;
|
|
189
181
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
190
182
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
191
|
-
},
|
|
183
|
+
}, ie = function(e, t, n) {
|
|
192
184
|
const { scaleVal: o, scaleSensitivity: s } = e;
|
|
193
185
|
switch (t) {
|
|
194
186
|
case "in":
|
|
@@ -198,7 +190,7 @@ const vt = (e) => {
|
|
|
198
190
|
e.scale(o - s, n);
|
|
199
191
|
}
|
|
200
192
|
};
|
|
201
|
-
function
|
|
193
|
+
function yt(e, t) {
|
|
202
194
|
t = t === !0 ? {} : t;
|
|
203
195
|
const n = () => {
|
|
204
196
|
e.currentArrow ? e.removeArrow() : e.currentSummary ? e.removeSummary(e.currentSummary.summaryObj.id) : e.currentNodes && e.removeNodes(e.currentNodes);
|
|
@@ -207,14 +199,14 @@ function Ct(e, t) {
|
|
|
207
199
|
const i = (r) => {
|
|
208
200
|
const c = e.nodeData;
|
|
209
201
|
if (r.key === "0")
|
|
210
|
-
for (const
|
|
211
|
-
|
|
202
|
+
for (const a of c.children)
|
|
203
|
+
q(a, !1);
|
|
212
204
|
if (r.key === "=")
|
|
213
|
-
for (const
|
|
214
|
-
|
|
205
|
+
for (const a of c.children)
|
|
206
|
+
q(a, !0);
|
|
215
207
|
if (["1", "2", "3", "4", "5", "6", "7", "8", "9"].includes(r.key))
|
|
216
|
-
for (const
|
|
217
|
-
|
|
208
|
+
for (const a of c.children)
|
|
209
|
+
q(a, !0, Number(r.key) - 1);
|
|
218
210
|
e.refresh(), e.toCenter(), o = !1, s && (clearTimeout(s), s = null, e.container.removeEventListener("keydown", i));
|
|
219
211
|
}, l = {
|
|
220
212
|
Enter: (r) => {
|
|
@@ -235,21 +227,21 @@ function Ct(e, t) {
|
|
|
235
227
|
else {
|
|
236
228
|
if (r.metaKey || r.ctrlKey)
|
|
237
229
|
return e.initSide();
|
|
238
|
-
|
|
230
|
+
De(e, "previous");
|
|
239
231
|
}
|
|
240
232
|
},
|
|
241
233
|
ArrowDown: (r) => {
|
|
242
|
-
r.altKey ? e.moveDownNode() :
|
|
234
|
+
r.altKey ? e.moveDownNode() : De(e, "next");
|
|
243
235
|
},
|
|
244
236
|
ArrowLeft: (r) => {
|
|
245
237
|
if (r.metaKey || r.ctrlKey)
|
|
246
238
|
return e.initLeft();
|
|
247
|
-
|
|
239
|
+
Me(e, P.LHS);
|
|
248
240
|
},
|
|
249
241
|
ArrowRight: (r) => {
|
|
250
242
|
if (r.metaKey || r.ctrlKey)
|
|
251
243
|
return e.initRight();
|
|
252
|
-
|
|
244
|
+
Me(e, P.RHS);
|
|
253
245
|
},
|
|
254
246
|
PageUp: () => e.moveUpNode(),
|
|
255
247
|
PageDown: () => {
|
|
@@ -265,10 +257,10 @@ function Ct(e, t) {
|
|
|
265
257
|
!e.waitCopy || !e.currentNode || (r.metaKey || r.ctrlKey) && (e.waitCopy.length === 1 ? e.copyNode(e.waitCopy[0], e.currentNode) : e.copyNodes(e.waitCopy, e.currentNode));
|
|
266
258
|
},
|
|
267
259
|
"=": (r) => {
|
|
268
|
-
(r.metaKey || r.ctrlKey) &&
|
|
260
|
+
(r.metaKey || r.ctrlKey) && ie(e, "in");
|
|
269
261
|
},
|
|
270
262
|
"-": (r) => {
|
|
271
|
-
(r.metaKey || r.ctrlKey) &&
|
|
263
|
+
(r.metaKey || r.ctrlKey) && ie(e, "out");
|
|
272
264
|
},
|
|
273
265
|
0: (r) => {
|
|
274
266
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -287,25 +279,22 @@ function Ct(e, t) {
|
|
|
287
279
|
...t
|
|
288
280
|
};
|
|
289
281
|
e.container.onkeydown = (r) => {
|
|
290
|
-
if (r.preventDefault(), !e.editable)
|
|
291
|
-
return;
|
|
282
|
+
if (r.preventDefault(), !e.editable) return;
|
|
292
283
|
const c = l[r.key];
|
|
293
284
|
c && c(r);
|
|
294
285
|
};
|
|
295
286
|
}
|
|
296
|
-
function
|
|
287
|
+
function vt(e) {
|
|
297
288
|
const { dragMoveHelper: t } = e;
|
|
298
289
|
let n = 0;
|
|
299
290
|
e.spacePressed = !1;
|
|
300
|
-
const o = (
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
return;
|
|
304
|
-
if ((C = e.helper1) != null && C.moved) {
|
|
291
|
+
const o = (d) => {
|
|
292
|
+
if (d.button !== 0) return;
|
|
293
|
+
if (e.helper1?.moved) {
|
|
305
294
|
e.helper1.clear();
|
|
306
295
|
return;
|
|
307
296
|
}
|
|
308
|
-
if (
|
|
297
|
+
if (e.helper2?.moved) {
|
|
309
298
|
e.helper2.clear();
|
|
310
299
|
return;
|
|
311
300
|
}
|
|
@@ -313,21 +302,21 @@ function Et(e) {
|
|
|
313
302
|
t.clear();
|
|
314
303
|
return;
|
|
315
304
|
}
|
|
316
|
-
const h =
|
|
305
|
+
const h = d.target;
|
|
317
306
|
if (h.tagName === "ME-EPD")
|
|
318
|
-
|
|
307
|
+
d.ctrlKey || d.metaKey ? e.expandNodeAll(h.previousSibling) : e.expandNode(h.previousSibling);
|
|
319
308
|
else if (h.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
320
309
|
e.selectNode(h);
|
|
321
310
|
else if (!e.editable)
|
|
322
311
|
return;
|
|
323
312
|
if (h.classList.contains("svg-label")) {
|
|
324
|
-
const b = h.dataset.svgId,
|
|
325
|
-
if (
|
|
326
|
-
if (
|
|
327
|
-
e.selectArrow(
|
|
313
|
+
const b = h.dataset.svgId, S = h.dataset.type, w = document.getElementById(b);
|
|
314
|
+
if (w) {
|
|
315
|
+
if (S === "arrow") {
|
|
316
|
+
e.selectArrow(w);
|
|
328
317
|
return;
|
|
329
|
-
} else if (
|
|
330
|
-
e.selectSummary(
|
|
318
|
+
} else if (S === "summary") {
|
|
319
|
+
e.selectSummary(w);
|
|
331
320
|
return;
|
|
332
321
|
}
|
|
333
322
|
}
|
|
@@ -346,91 +335,86 @@ function Et(e) {
|
|
|
346
335
|
return;
|
|
347
336
|
}
|
|
348
337
|
}
|
|
349
|
-
}, s = (
|
|
350
|
-
if (!e.editable)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (b) {
|
|
338
|
+
}, s = (d) => {
|
|
339
|
+
if (!e.editable) return;
|
|
340
|
+
const h = d.target;
|
|
341
|
+
if (ue(h) && e.beginEdit(h), h.classList.contains("svg-label")) {
|
|
342
|
+
const b = h.dataset.svgId, S = h.dataset.type, w = document.getElementById(b);
|
|
343
|
+
if (w) {
|
|
356
344
|
if (S === "arrow") {
|
|
357
|
-
e.editArrowLabel(
|
|
345
|
+
e.editArrowLabel(w);
|
|
358
346
|
return;
|
|
359
347
|
} else if (S === "summary") {
|
|
360
|
-
e.editSummary(
|
|
348
|
+
e.editSummary(w);
|
|
361
349
|
return;
|
|
362
350
|
}
|
|
363
351
|
}
|
|
364
352
|
}
|
|
365
353
|
if (h.closest(".topiclinks")) {
|
|
366
|
-
const
|
|
367
|
-
if (
|
|
368
|
-
e.editArrowLabel(
|
|
354
|
+
const b = h.closest("g");
|
|
355
|
+
if (b) {
|
|
356
|
+
e.editArrowLabel(b);
|
|
369
357
|
return;
|
|
370
358
|
}
|
|
371
359
|
}
|
|
372
360
|
if (h.closest(".summary")) {
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
e.editSummary(
|
|
361
|
+
const b = h.closest("g");
|
|
362
|
+
if (b) {
|
|
363
|
+
e.editSummary(b);
|
|
376
364
|
return;
|
|
377
365
|
}
|
|
378
366
|
}
|
|
379
|
-
}, i = (
|
|
380
|
-
if (
|
|
381
|
-
return;
|
|
367
|
+
}, i = (d) => {
|
|
368
|
+
if (d.pointerType === "mouse") return;
|
|
382
369
|
const h = (/* @__PURE__ */ new Date()).getTime(), v = h - n;
|
|
383
|
-
v < 300 && v > 0 && s(
|
|
384
|
-
}, l = (
|
|
385
|
-
|
|
386
|
-
}, r = (
|
|
387
|
-
|
|
388
|
-
}, c = (
|
|
370
|
+
v < 300 && v > 0 && s(d), n = h;
|
|
371
|
+
}, l = (d) => {
|
|
372
|
+
d.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"), d.preventDefault());
|
|
373
|
+
}, r = (d) => {
|
|
374
|
+
d.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
375
|
+
}, c = (d) => {
|
|
389
376
|
t.moved = !1;
|
|
390
|
-
const h = e.spacePressed &&
|
|
391
|
-
if (!h && !
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const h = a.clientX - t.x, v = a.clientY - t.y;
|
|
377
|
+
const h = e.spacePressed && d.button === 0 && d.pointerType === "mouse", v = e.mouseSelectionButton === 0 ? 2 : 0, x = d.button === v && d.pointerType === "mouse";
|
|
378
|
+
if (!h && !x) return;
|
|
379
|
+
t.x = d.clientX, t.y = d.clientY;
|
|
380
|
+
const b = d.target;
|
|
381
|
+
(h || b.className !== "circle" && b.contentEditable !== "plaintext-only") && (t.mousedown = !0, b.setPointerCapture(d.pointerId));
|
|
382
|
+
}, a = (d) => {
|
|
383
|
+
if (d.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
384
|
+
const h = d.clientX - t.x, v = d.clientY - t.y;
|
|
399
385
|
t.onMove(h, v);
|
|
400
386
|
}
|
|
401
|
-
t.x =
|
|
402
|
-
}, f = (
|
|
403
|
-
if (!t.mousedown)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
h.hasPointerCapture && h.hasPointerCapture(a.pointerId) && h.releasePointerCapture(a.pointerId), t.clear();
|
|
387
|
+
t.x = d.clientX, t.y = d.clientY;
|
|
388
|
+
}, f = (d) => {
|
|
389
|
+
if (!t.mousedown) return;
|
|
390
|
+
const h = d.target;
|
|
391
|
+
h.hasPointerCapture && h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), t.clear();
|
|
407
392
|
}, u = () => {
|
|
408
393
|
t.mousedown && t.clear();
|
|
409
|
-
}, g = (
|
|
410
|
-
if (
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", a);
|
|
394
|
+
}, g = (d) => {
|
|
395
|
+
if (d.preventDefault(), d.button !== 2 || !e.editable) return;
|
|
396
|
+
const h = d.target;
|
|
397
|
+
ue(h) && !h.classList.contains("selected") && e.selectNode(h), setTimeout(() => {
|
|
398
|
+
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", d);
|
|
415
399
|
}, 200);
|
|
416
|
-
}, y = (
|
|
417
|
-
|
|
418
|
-
}, { container:
|
|
419
|
-
return
|
|
420
|
-
{ dom:
|
|
421
|
-
{ dom:
|
|
422
|
-
{ dom:
|
|
423
|
-
{ dom:
|
|
424
|
-
{ dom:
|
|
425
|
-
{ dom:
|
|
426
|
-
{ dom:
|
|
427
|
-
{ dom:
|
|
428
|
-
{ dom:
|
|
400
|
+
}, y = (d) => {
|
|
401
|
+
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? ie(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && ie(e, "out", e.dragMoveHelper) : d.shiftKey ? e.move(-d.deltaY, 0) : e.move(-d.deltaX, -d.deltaY);
|
|
402
|
+
}, { container: m } = e;
|
|
403
|
+
return Ee([
|
|
404
|
+
{ dom: m, evt: "pointerdown", func: c },
|
|
405
|
+
{ dom: m, evt: "pointermove", func: a },
|
|
406
|
+
{ dom: m, evt: "pointerup", func: f },
|
|
407
|
+
{ dom: m, evt: "pointerup", func: i },
|
|
408
|
+
{ dom: m, evt: "click", func: o },
|
|
409
|
+
{ dom: m, evt: "dblclick", func: s },
|
|
410
|
+
{ dom: m, evt: "contextmenu", func: g },
|
|
411
|
+
{ dom: m, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : y },
|
|
412
|
+
{ dom: m, evt: "blur", func: u },
|
|
429
413
|
{ dom: document, evt: "keydown", func: l },
|
|
430
414
|
{ dom: document, evt: "keyup", func: r }
|
|
431
415
|
]);
|
|
432
416
|
}
|
|
433
|
-
function
|
|
417
|
+
function bt() {
|
|
434
418
|
return {
|
|
435
419
|
handlers: {},
|
|
436
420
|
addListener: function(e, t) {
|
|
@@ -444,8 +428,7 @@ function St() {
|
|
|
444
428
|
}
|
|
445
429
|
},
|
|
446
430
|
removeListener: function(e, t) {
|
|
447
|
-
if (!this.handlers[e])
|
|
448
|
-
return;
|
|
431
|
+
if (!this.handlers[e]) return;
|
|
449
432
|
const n = this.handlers[e];
|
|
450
433
|
if (!t)
|
|
451
434
|
n.length = 0;
|
|
@@ -455,11 +438,11 @@ function St() {
|
|
|
455
438
|
}
|
|
456
439
|
};
|
|
457
440
|
}
|
|
458
|
-
const
|
|
441
|
+
const re = document, wt = function() {
|
|
459
442
|
this.nodes.innerHTML = "";
|
|
460
443
|
const e = this.createTopic(this.nodeData);
|
|
461
|
-
|
|
462
|
-
const t =
|
|
444
|
+
Ce.call(this, e, this.nodeData), e.draggable = !1;
|
|
445
|
+
const t = re.createElement("me-root");
|
|
463
446
|
t.appendChild(e);
|
|
464
447
|
const n = this.nodeData.children || [];
|
|
465
448
|
if (this.direction === 2) {
|
|
@@ -468,30 +451,29 @@ const ce = document, Nt = function() {
|
|
|
468
451
|
i.direction === 0 ? o += 1 : i.direction === 1 ? s += 1 : o <= s ? (i.direction = 0, o += 1) : (i.direction = 1, s += 1);
|
|
469
452
|
});
|
|
470
453
|
}
|
|
471
|
-
|
|
472
|
-
},
|
|
473
|
-
const o =
|
|
474
|
-
o.className =
|
|
475
|
-
const s =
|
|
476
|
-
s.className =
|
|
454
|
+
xt(this, n, t);
|
|
455
|
+
}, xt = function(e, t, n) {
|
|
456
|
+
const o = re.createElement("me-main");
|
|
457
|
+
o.className = P.LHS;
|
|
458
|
+
const s = re.createElement("me-main");
|
|
459
|
+
s.className = P.RHS;
|
|
477
460
|
for (let i = 0; i < t.length; i++) {
|
|
478
461
|
const l = t[i], { grp: r } = e.createWrapper(l);
|
|
479
462
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(r) : s.appendChild(r) : e.direction === 0 ? o.appendChild(r) : s.appendChild(r);
|
|
480
463
|
}
|
|
481
464
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines), e.nodes.appendChild(e.labelContainer);
|
|
482
|
-
},
|
|
483
|
-
const n =
|
|
465
|
+
}, Et = function(e, t) {
|
|
466
|
+
const n = re.createElement("me-children");
|
|
484
467
|
for (let o = 0; o < t.length; o++) {
|
|
485
468
|
const s = t[o], { grp: i } = e.createWrapper(s);
|
|
486
469
|
n.appendChild(i);
|
|
487
470
|
}
|
|
488
471
|
return n;
|
|
489
|
-
}, _ = document,
|
|
490
|
-
const o = (this
|
|
491
|
-
if (!o)
|
|
492
|
-
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
472
|
+
}, _ = document, Xe = function(e, t) {
|
|
473
|
+
const o = (this?.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
474
|
+
if (!o) throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
493
475
|
return o;
|
|
494
|
-
},
|
|
476
|
+
}, Ce = function(e, t) {
|
|
495
477
|
if (e.innerHTML = "", t.style) {
|
|
496
478
|
const n = t.style;
|
|
497
479
|
for (const o in n)
|
|
@@ -507,8 +489,7 @@ const ce = document, Nt = function() {
|
|
|
507
489
|
const o = _.createElement("img");
|
|
508
490
|
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
509
491
|
}
|
|
510
|
-
} else
|
|
511
|
-
e.image && (e.image = void 0);
|
|
492
|
+
} else e.image && (e.image = void 0);
|
|
512
493
|
{
|
|
513
494
|
const n = _.createElement("span");
|
|
514
495
|
n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
@@ -516,50 +497,46 @@ const ce = document, Nt = function() {
|
|
|
516
497
|
if (t.hyperLink) {
|
|
517
498
|
const n = _.createElement("a");
|
|
518
499
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
519
|
-
} else
|
|
520
|
-
e.link && (e.link = void 0);
|
|
500
|
+
} else e.link && (e.link = void 0);
|
|
521
501
|
if (t.icons && t.icons.length) {
|
|
522
502
|
const n = _.createElement("span");
|
|
523
|
-
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${
|
|
524
|
-
} else
|
|
525
|
-
e.icons && (e.icons = void 0);
|
|
503
|
+
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${fe(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
504
|
+
} else e.icons && (e.icons = void 0);
|
|
526
505
|
if (t.tags && t.tags.length) {
|
|
527
506
|
const n = _.createElement("div");
|
|
528
507
|
n.className = "tags", t.tags.forEach((o) => {
|
|
529
508
|
const s = _.createElement("span");
|
|
530
509
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
531
510
|
}), e.appendChild(n), e.tags = n;
|
|
532
|
-
} else
|
|
533
|
-
|
|
534
|
-
}, Tt = function(e, t) {
|
|
511
|
+
} else e.tags && (e.tags = void 0);
|
|
512
|
+
}, Ct = function(e, t) {
|
|
535
513
|
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
536
514
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
537
|
-
const i =
|
|
515
|
+
const i = Se(e.expanded);
|
|
538
516
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
539
|
-
const l =
|
|
517
|
+
const l = Et(this, e.children);
|
|
540
518
|
n.appendChild(l);
|
|
541
519
|
}
|
|
542
520
|
}
|
|
543
521
|
return { grp: n, top: o, tpc: s };
|
|
544
|
-
},
|
|
522
|
+
}, St = function(e) {
|
|
545
523
|
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
546
|
-
return
|
|
547
|
-
},
|
|
524
|
+
return Ce.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
525
|
+
}, Nt = function(e) {
|
|
548
526
|
const t = _.createElement("me-children");
|
|
549
527
|
return t.append(...e), t;
|
|
550
|
-
},
|
|
528
|
+
}, kt = function(e) {
|
|
551
529
|
const t = _.createElement("me-tpc");
|
|
552
530
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
553
531
|
};
|
|
554
|
-
function
|
|
532
|
+
function Ue(e) {
|
|
555
533
|
const t = _.createRange();
|
|
556
534
|
t.selectNodeContents(e);
|
|
557
535
|
const n = window.getSelection();
|
|
558
536
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
559
537
|
}
|
|
560
|
-
const
|
|
561
|
-
if (!e)
|
|
562
|
-
return;
|
|
538
|
+
const _t = function(e) {
|
|
539
|
+
if (!e) return;
|
|
563
540
|
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = O(this.nodes, e);
|
|
564
541
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
565
542
|
const l = getComputedStyle(e);
|
|
@@ -572,57 +549,54 @@ const Dt = function(e) {
|
|
|
572
549
|
margin:${l.margin};
|
|
573
550
|
background-color:${l.backgroundColor !== "rgba(0, 0, 0, 0)" && l.backgroundColor};
|
|
574
551
|
border: ${l.border};
|
|
575
|
-
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"),
|
|
552
|
+
border-radius:${l.borderRadius}; `, this.direction === 0 && (t.style.right = "0"), Ue(t), this.bus.fire("operation", {
|
|
576
553
|
name: "beginEdit",
|
|
577
554
|
obj: e.nodeObj
|
|
578
555
|
}), t.addEventListener("keydown", (r) => {
|
|
579
556
|
r.stopPropagation();
|
|
580
557
|
const c = r.key;
|
|
581
558
|
if (c === "Enter" || c === "Tab") {
|
|
582
|
-
if (r.shiftKey)
|
|
583
|
-
return;
|
|
559
|
+
if (r.shiftKey) return;
|
|
584
560
|
r.preventDefault(), t.blur(), this.container.focus();
|
|
585
561
|
}
|
|
586
562
|
}), t.addEventListener("blur", () => {
|
|
587
|
-
|
|
588
|
-
if (!t)
|
|
589
|
-
return;
|
|
563
|
+
if (!t) return;
|
|
590
564
|
t.remove();
|
|
591
|
-
const r =
|
|
565
|
+
const r = t.textContent?.trim() || "";
|
|
592
566
|
r === o || r === "" || (n.topic = r, this.markdown ? e.text.innerHTML = this.markdown(n.topic, n) : e.text.textContent = r, this.linkDiv(), this.bus.fire("operation", {
|
|
593
567
|
name: "finishEdit",
|
|
594
568
|
obj: n,
|
|
595
569
|
origin: o
|
|
596
570
|
}));
|
|
597
571
|
});
|
|
598
|
-
},
|
|
572
|
+
}, Se = function(e) {
|
|
599
573
|
const t = _.createElement("me-epd");
|
|
600
574
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
601
|
-
},
|
|
575
|
+
}, z = document, D = "http://www.w3.org/2000/svg", ae = function(e) {
|
|
602
576
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
603
577
|
let r = s;
|
|
604
578
|
l === "middle" ? r = s - t / 2 : l === "end" && (r = s - t), e.style.left = `${r}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
605
|
-
},
|
|
579
|
+
}, pe = function(e, t, n, o) {
|
|
606
580
|
const { anchor: s = "middle", color: i, dataType: l, svgId: r } = o, c = document.createElement("div");
|
|
607
581
|
c.className = "svg-label", c.style.color = i || "#666";
|
|
608
|
-
const
|
|
609
|
-
return c.id =
|
|
610
|
-
},
|
|
611
|
-
const o =
|
|
582
|
+
const a = "label-" + r;
|
|
583
|
+
return c.id = a, c.innerHTML = e, c.dataset.type = l, c.dataset.svgId = r, c.dataset.x = t.toString(), c.dataset.y = n.toString(), c.dataset.anchor = s, c;
|
|
584
|
+
}, Je = function(e, t, n) {
|
|
585
|
+
const o = z.createElementNS(D, "path");
|
|
612
586
|
return k(o, {
|
|
613
587
|
d: e,
|
|
614
588
|
stroke: t || "#666",
|
|
615
589
|
fill: "none",
|
|
616
590
|
"stroke-width": n
|
|
617
591
|
}), o;
|
|
618
|
-
},
|
|
619
|
-
const t =
|
|
592
|
+
}, X = function(e) {
|
|
593
|
+
const t = z.createElementNS(D, "svg");
|
|
620
594
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
621
|
-
},
|
|
622
|
-
const e =
|
|
595
|
+
}, Pe = function() {
|
|
596
|
+
const e = z.createElementNS(D, "line");
|
|
623
597
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
624
|
-
},
|
|
625
|
-
const s =
|
|
598
|
+
}, Tt = function(e, t, n, o) {
|
|
599
|
+
const s = z.createElementNS(D, "g");
|
|
626
600
|
return [
|
|
627
601
|
{
|
|
628
602
|
name: "line",
|
|
@@ -637,44 +611,40 @@ const Dt = function(e) {
|
|
|
637
611
|
d: n
|
|
638
612
|
}
|
|
639
613
|
].forEach((l, r) => {
|
|
640
|
-
const c = l.d,
|
|
614
|
+
const c = l.d, a = z.createElementNS(D, "path"), f = {
|
|
641
615
|
d: c,
|
|
642
|
-
stroke:
|
|
616
|
+
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
643
617
|
fill: "none",
|
|
644
|
-
"stroke-linecap":
|
|
645
|
-
"stroke-width": String(
|
|
618
|
+
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
619
|
+
"stroke-width": String(o?.strokeWidth || "2")
|
|
646
620
|
};
|
|
647
|
-
|
|
648
|
-
const u =
|
|
621
|
+
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), k(a, f), r === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
622
|
+
const u = z.createElementNS(D, "path");
|
|
649
623
|
k(u, {
|
|
650
624
|
d: c,
|
|
651
625
|
stroke: "transparent",
|
|
652
626
|
fill: "none",
|
|
653
627
|
"stroke-width": "15"
|
|
654
|
-
}), s.appendChild(u), s.appendChild(
|
|
628
|
+
}), s.appendChild(u), s.appendChild(a), s[l.name] = a;
|
|
655
629
|
}), s;
|
|
656
|
-
},
|
|
657
|
-
if (!t)
|
|
658
|
-
return;
|
|
630
|
+
}, Ze = function(e, t, n) {
|
|
631
|
+
if (!t) return;
|
|
659
632
|
const o = n.label, s = t.cloneNode(!0);
|
|
660
633
|
e.nodes.appendChild(s), s.id = "input-box", s.textContent = o, s.contentEditable = "plaintext-only", s.spellcheck = !1, s.style.cssText = `
|
|
661
634
|
left:${t.style.left};
|
|
662
635
|
top:${t.style.top};
|
|
663
636
|
max-width: 200px;
|
|
664
|
-
`,
|
|
637
|
+
`, Ue(s), e.scrollIntoView(s), s.addEventListener("keydown", (i) => {
|
|
665
638
|
i.stopPropagation();
|
|
666
639
|
const l = i.key;
|
|
667
640
|
if (l === "Enter" || l === "Tab") {
|
|
668
|
-
if (i.shiftKey)
|
|
669
|
-
return;
|
|
641
|
+
if (i.shiftKey) return;
|
|
670
642
|
i.preventDefault(), s.blur(), e.container.focus();
|
|
671
643
|
}
|
|
672
644
|
}), s.addEventListener("blur", () => {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
const i = ((l = s.textContent) == null ? void 0 : l.trim()) || "";
|
|
677
|
-
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.textContent = n.label, he(t), "parent" in n ? e.bus.fire("operation", {
|
|
645
|
+
if (!s) return;
|
|
646
|
+
const i = s.textContent?.trim() || "";
|
|
647
|
+
i === "" ? n.label = o : n.label = i, s.remove(), i !== o && (t.textContent = n.label, ae(t), "parent" in n ? e.bus.fire("operation", {
|
|
678
648
|
name: "finishEditSummary",
|
|
679
649
|
obj: n
|
|
680
650
|
}) : e.bus.fire("operation", {
|
|
@@ -682,34 +652,32 @@ const Dt = function(e) {
|
|
|
682
652
|
obj: n
|
|
683
653
|
}));
|
|
684
654
|
});
|
|
685
|
-
},
|
|
655
|
+
}, Lt = function(e) {
|
|
686
656
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
687
657
|
this.lines.innerHTML = "";
|
|
688
658
|
for (let r = 0; r < l.length; r++) {
|
|
689
|
-
const c = l[r],
|
|
690
|
-
if (
|
|
659
|
+
const c = l[r], a = c.querySelector("me-tpc"), { offsetLeft: f, offsetTop: u } = O(this.nodes, a), g = a.offsetWidth, y = a.offsetHeight, m = c.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: u, cL: f, cW: g, cH: y, direction: m, containerHeight: this.nodes.offsetHeight }), d = this.theme.palette, h = a.nodeObj.branchColor || d[r % d.length];
|
|
660
|
+
if (a.style.borderColor = h, this.lines.appendChild(Je(p, h, "3")), e && e !== c)
|
|
691
661
|
continue;
|
|
692
|
-
const v =
|
|
693
|
-
|
|
662
|
+
const v = X("subLines"), x = c.lastChild;
|
|
663
|
+
x.tagName === "svg" && x.remove(), c.appendChild(v), Qe(this, v, h, c, m, !0);
|
|
694
664
|
}
|
|
695
665
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
696
|
-
},
|
|
666
|
+
}, Qe = function(e, t, n, o, s, i) {
|
|
697
667
|
const l = o.firstChild, r = o.children[1].children;
|
|
698
|
-
if (r.length === 0)
|
|
699
|
-
|
|
700
|
-
const c = l.offsetTop, d = l.offsetLeft, f = l.offsetWidth, u = l.offsetHeight;
|
|
668
|
+
if (r.length === 0) return;
|
|
669
|
+
const c = l.offsetTop, a = l.offsetLeft, f = l.offsetWidth, u = l.offsetHeight;
|
|
701
670
|
for (let g = 0; g < r.length; g++) {
|
|
702
|
-
const y = r[g],
|
|
703
|
-
t.appendChild(
|
|
704
|
-
const S =
|
|
671
|
+
const y = r[g], m = y.firstChild, p = m.offsetTop, d = m.offsetLeft, h = m.offsetWidth, v = m.offsetHeight, x = m.firstChild.nodeObj.branchColor || n, b = e.generateSubBranch({ pT: c, pL: a, pW: f, pH: u, cT: p, cL: d, cW: h, cH: v, direction: s, isFirst: i });
|
|
672
|
+
t.appendChild(Je(b, x, "2"));
|
|
673
|
+
const S = m.children[1];
|
|
705
674
|
if (S) {
|
|
706
|
-
if (!S.expanded)
|
|
707
|
-
continue;
|
|
675
|
+
if (!S.expanded) continue;
|
|
708
676
|
} else
|
|
709
677
|
continue;
|
|
710
|
-
|
|
678
|
+
Qe(e, t, x, y, s);
|
|
711
679
|
}
|
|
712
|
-
},
|
|
680
|
+
}, $e = {
|
|
713
681
|
addChild: "插入子节点",
|
|
714
682
|
addParent: "插入父节点",
|
|
715
683
|
addSibling: "插入同级节点",
|
|
@@ -722,9 +690,9 @@ const Dt = function(e) {
|
|
|
722
690
|
linkBidirectional: "双向连接",
|
|
723
691
|
clickTips: "请点击目标节点",
|
|
724
692
|
summary: "摘要"
|
|
725
|
-
},
|
|
726
|
-
cn:
|
|
727
|
-
zh_CN:
|
|
693
|
+
}, Oe = {
|
|
694
|
+
cn: $e,
|
|
695
|
+
zh_CN: $e,
|
|
728
696
|
zh_TW: {
|
|
729
697
|
addChild: "插入子節點",
|
|
730
698
|
addParent: "插入父節點",
|
|
@@ -852,105 +820,103 @@ const Dt = function(e) {
|
|
|
852
820
|
summary: "요약"
|
|
853
821
|
}
|
|
854
822
|
};
|
|
855
|
-
function
|
|
823
|
+
function At(e, t) {
|
|
856
824
|
t = t === !0 ? {
|
|
857
825
|
focus: !0,
|
|
858
826
|
link: !0
|
|
859
827
|
} : t;
|
|
860
|
-
const n = (
|
|
861
|
-
const
|
|
862
|
-
return
|
|
863
|
-
}, o = (
|
|
828
|
+
const n = (w) => {
|
|
829
|
+
const E = document.createElement("div");
|
|
830
|
+
return E.innerText = w, E.className = "tips", E;
|
|
831
|
+
}, o = (w, E, C) => {
|
|
864
832
|
const N = document.createElement("li");
|
|
865
|
-
return N.id =
|
|
866
|
-
}, s =
|
|
867
|
-
if (h.className = "menu-list", h.appendChild(l), h.appendChild(r), h.appendChild(c), h.appendChild(
|
|
868
|
-
for (let
|
|
869
|
-
const
|
|
870
|
-
h.appendChild(
|
|
871
|
-
|
|
833
|
+
return N.id = w, N.innerHTML = `<span>${fe(E)}</span><span ${C ? 'class="key"' : ""}>${fe(C)}</span>`, N;
|
|
834
|
+
}, s = Oe[e.locale] ? e.locale : "en", i = Oe[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), a = o("cm-remove_child", i.removeNode, "Delete"), f = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), g = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), m = o("cm-link", i.link, ""), p = o("cm-link-bidirectional", i.linkBidirectional, ""), d = o("cm-summary", i.summary, ""), h = document.createElement("ul");
|
|
835
|
+
if (h.className = "menu-list", h.appendChild(l), h.appendChild(r), h.appendChild(c), h.appendChild(a), t.focus && (h.appendChild(f), h.appendChild(u)), h.appendChild(g), h.appendChild(y), h.appendChild(d), t.link && (h.appendChild(m), h.appendChild(p)), t && t.extend)
|
|
836
|
+
for (let w = 0; w < t.extend.length; w++) {
|
|
837
|
+
const E = t.extend[w], C = o(E.name, E.name, E.key || "");
|
|
838
|
+
h.appendChild(C), C.onclick = (N) => {
|
|
839
|
+
E.onclick(N);
|
|
872
840
|
};
|
|
873
841
|
}
|
|
874
842
|
const v = document.createElement("div");
|
|
875
843
|
v.className = "context-menu", v.appendChild(h), v.hidden = !0, e.container.append(v);
|
|
876
|
-
let
|
|
877
|
-
const
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
N + A > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = A + 15 + "px"), L +
|
|
844
|
+
let x = !0;
|
|
845
|
+
const b = (w) => {
|
|
846
|
+
const E = w.target;
|
|
847
|
+
if (ue(E)) {
|
|
848
|
+
E.parentElement.tagName === "ME-ROOT" ? x = !0 : x = !1, x ? (f.className = "disabled", g.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", a.className = "disabled") : (f.className = "", g.className = "", y.className = "", r.className = "", c.className = "", a.className = ""), v.hidden = !1, h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
849
|
+
const C = h.getBoundingClientRect(), N = h.offsetHeight, L = h.offsetWidth, A = w.clientY - C.top, j = w.clientX - C.left;
|
|
850
|
+
N + A > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = A + 15 + "px"), L + j > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = j + 10 + "px");
|
|
883
851
|
}
|
|
884
852
|
};
|
|
885
|
-
e.bus.addListener("showContextMenu",
|
|
886
|
-
|
|
853
|
+
e.bus.addListener("showContextMenu", b), v.onclick = (w) => {
|
|
854
|
+
w.target === v && (v.hidden = !0);
|
|
887
855
|
}, l.onclick = () => {
|
|
888
856
|
e.addChild(), v.hidden = !0;
|
|
889
857
|
}, r.onclick = () => {
|
|
890
858
|
e.insertParent(), v.hidden = !0;
|
|
891
859
|
}, c.onclick = () => {
|
|
892
|
-
|
|
893
|
-
},
|
|
894
|
-
|
|
860
|
+
x || (e.insertSibling("after"), v.hidden = !0);
|
|
861
|
+
}, a.onclick = () => {
|
|
862
|
+
x || (e.removeNodes(e.currentNodes || []), v.hidden = !0);
|
|
895
863
|
}, f.onclick = () => {
|
|
896
|
-
|
|
864
|
+
x || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
897
865
|
}, u.onclick = () => {
|
|
898
866
|
e.cancelFocus(), v.hidden = !0;
|
|
899
867
|
}, g.onclick = () => {
|
|
900
|
-
|
|
868
|
+
x || (e.moveUpNode(), v.hidden = !0);
|
|
901
869
|
}, y.onclick = () => {
|
|
902
|
-
|
|
870
|
+
x || (e.moveDownNode(), v.hidden = !0);
|
|
903
871
|
};
|
|
904
|
-
const S = (
|
|
872
|
+
const S = (w) => {
|
|
905
873
|
v.hidden = !0;
|
|
906
|
-
const
|
|
907
|
-
e.container.appendChild(
|
|
874
|
+
const E = e.currentNode, C = n(i.clickTips);
|
|
875
|
+
e.container.appendChild(C), e.map.addEventListener(
|
|
908
876
|
"click",
|
|
909
877
|
(N) => {
|
|
910
|
-
N.preventDefault(),
|
|
878
|
+
N.preventDefault(), C.remove();
|
|
911
879
|
const L = N.target;
|
|
912
|
-
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(
|
|
880
|
+
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(E, L, w);
|
|
913
881
|
},
|
|
914
882
|
{
|
|
915
883
|
once: !0
|
|
916
884
|
}
|
|
917
885
|
);
|
|
918
886
|
};
|
|
919
|
-
return
|
|
887
|
+
return m.onclick = () => S(), p.onclick = () => S({ bidirectional: !0 }), d.onclick = () => {
|
|
920
888
|
v.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
921
889
|
}, () => {
|
|
922
|
-
l.onclick = null, r.onclick = null, c.onclick = null,
|
|
890
|
+
l.onclick = null, r.onclick = null, c.onclick = null, a.onclick = null, f.onclick = null, u.onclick = null, g.onclick = null, y.onclick = null, m.onclick = null, d.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
923
891
|
};
|
|
924
892
|
}
|
|
925
|
-
const
|
|
893
|
+
const ge = document, Mt = function(e, t) {
|
|
926
894
|
if (!t)
|
|
927
|
-
return
|
|
895
|
+
return me(e), e;
|
|
928
896
|
let n = e.querySelector(".insert-preview");
|
|
929
897
|
const o = `insert-preview ${t} show`;
|
|
930
|
-
return n || (n =
|
|
931
|
-
},
|
|
932
|
-
if (!e)
|
|
933
|
-
return;
|
|
898
|
+
return n || (n = ge.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
899
|
+
}, me = function(e) {
|
|
900
|
+
if (!e) return;
|
|
934
901
|
const t = e.querySelectorAll(".insert-preview");
|
|
935
902
|
for (const n of t || [])
|
|
936
903
|
n.remove();
|
|
937
|
-
},
|
|
904
|
+
}, je = function(e, t) {
|
|
938
905
|
for (const n of t) {
|
|
939
906
|
const o = n.parentElement.parentElement.contains(e);
|
|
940
|
-
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent))
|
|
941
|
-
return !1;
|
|
907
|
+
if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
|
|
942
908
|
}
|
|
943
909
|
return !0;
|
|
944
|
-
},
|
|
910
|
+
}, Dt = function(e) {
|
|
945
911
|
const t = document.createElement("div");
|
|
946
912
|
return t.className = "mind-elixir-ghost", e.container.appendChild(t), t;
|
|
947
913
|
};
|
|
948
|
-
class
|
|
914
|
+
class Pt {
|
|
915
|
+
mind;
|
|
916
|
+
isMoving = !1;
|
|
917
|
+
interval = null;
|
|
918
|
+
speed = 20;
|
|
949
919
|
constructor(t) {
|
|
950
|
-
X(this, "mind");
|
|
951
|
-
X(this, "isMoving", !1);
|
|
952
|
-
X(this, "interval", null);
|
|
953
|
-
X(this, "speed", 20);
|
|
954
920
|
this.mind = t;
|
|
955
921
|
}
|
|
956
922
|
move(t, n) {
|
|
@@ -962,63 +928,61 @@ class Bt {
|
|
|
962
928
|
this.isMoving = !1, clearInterval(this.interval);
|
|
963
929
|
}
|
|
964
930
|
}
|
|
965
|
-
function
|
|
931
|
+
function $t(e) {
|
|
966
932
|
let t = null, n = null;
|
|
967
|
-
const o =
|
|
933
|
+
const o = Dt(e), s = new Pt(e), i = (a) => {
|
|
968
934
|
if (e.spacePressed) {
|
|
969
|
-
|
|
935
|
+
a.preventDefault();
|
|
970
936
|
return;
|
|
971
937
|
}
|
|
972
938
|
e.selection.cancel();
|
|
973
|
-
const f =
|
|
974
|
-
if (
|
|
975
|
-
|
|
939
|
+
const f = a.target;
|
|
940
|
+
if (f?.tagName !== "ME-TPC") {
|
|
941
|
+
a.preventDefault();
|
|
976
942
|
return;
|
|
977
943
|
}
|
|
978
944
|
let u = e.currentNodes;
|
|
979
|
-
u
|
|
945
|
+
u?.includes(f) || (e.selectNode(f), u = e.currentNodes), e.dragged = u, u.length > 1 ? o.innerHTML = u.length + "" : o.innerHTML = f.innerHTML;
|
|
980
946
|
for (const g of u)
|
|
981
947
|
g.parentElement.parentElement.style.opacity = "0.5";
|
|
982
|
-
|
|
983
|
-
}, l = (
|
|
948
|
+
a.dataTransfer.setDragImage(o, 0, 0), a.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
949
|
+
}, l = (a) => {
|
|
984
950
|
const { dragged: f } = e;
|
|
985
|
-
if (!f)
|
|
986
|
-
return;
|
|
951
|
+
if (!f) return;
|
|
987
952
|
s.stop();
|
|
988
953
|
for (const g of f)
|
|
989
954
|
g.parentElement.parentElement.style.opacity = "1";
|
|
990
|
-
const u =
|
|
991
|
-
u.style.opacity = "", n && (
|
|
992
|
-
}, r = (
|
|
993
|
-
|
|
955
|
+
const u = a.target;
|
|
956
|
+
u.style.opacity = "", n && (me(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null, o.innerHTML = "");
|
|
957
|
+
}, r = (a) => {
|
|
958
|
+
a.preventDefault();
|
|
994
959
|
const f = 12 * e.scaleVal, { dragged: u } = e;
|
|
995
|
-
if (!u)
|
|
996
|
-
return;
|
|
960
|
+
if (!u) return;
|
|
997
961
|
const g = e.container.getBoundingClientRect();
|
|
998
|
-
|
|
999
|
-
const y =
|
|
1000
|
-
if (
|
|
962
|
+
a.clientX < g.x + 50 ? s.move(1, 0) : a.clientX > g.x + g.width - 50 ? s.move(-1, 0) : a.clientY < g.y + 50 ? s.move(0, 1) : a.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(), me(n);
|
|
963
|
+
const y = ge.elementFromPoint(a.clientX, a.clientY - f);
|
|
964
|
+
if (je(y, u)) {
|
|
1001
965
|
n = y;
|
|
1002
|
-
const
|
|
1003
|
-
|
|
966
|
+
const m = y.getBoundingClientRect(), p = m.y;
|
|
967
|
+
a.clientY > p + m.height ? t = "after" : t = "in";
|
|
1004
968
|
} else {
|
|
1005
|
-
const
|
|
1006
|
-
if (
|
|
1007
|
-
n =
|
|
1008
|
-
const
|
|
1009
|
-
|
|
969
|
+
const m = ge.elementFromPoint(a.clientX, a.clientY + f), p = m.getBoundingClientRect();
|
|
970
|
+
if (je(m, u)) {
|
|
971
|
+
n = m;
|
|
972
|
+
const d = p.y;
|
|
973
|
+
a.clientY < d ? t = "before" : t = "in";
|
|
1010
974
|
} else
|
|
1011
975
|
t = n = null;
|
|
1012
976
|
}
|
|
1013
|
-
n &&
|
|
977
|
+
n && Mt(n, t);
|
|
1014
978
|
};
|
|
1015
|
-
return
|
|
979
|
+
return Ee([
|
|
1016
980
|
{ dom: e.map, evt: "dragstart", func: i },
|
|
1017
981
|
{ dom: e.map, evt: "dragend", func: l },
|
|
1018
982
|
{ dom: e.map, evt: "dragover", func: r }
|
|
1019
983
|
]);
|
|
1020
984
|
}
|
|
1021
|
-
const
|
|
985
|
+
const Ot = function(e) {
|
|
1022
986
|
return ["createSummary", "removeSummary", "finishEditSummary"].includes(e.name) ? {
|
|
1023
987
|
type: "summary",
|
|
1024
988
|
value: e.obj.id
|
|
@@ -1033,14 +997,14 @@ const Ft = function(e) {
|
|
|
1033
997
|
value: [e.obj.id]
|
|
1034
998
|
};
|
|
1035
999
|
};
|
|
1036
|
-
function
|
|
1000
|
+
function jt(e) {
|
|
1037
1001
|
let t = [], n = -1, o = e.getData(), s = [];
|
|
1038
1002
|
e.undo = function() {
|
|
1039
1003
|
if (n > -1) {
|
|
1040
1004
|
const c = t[n];
|
|
1041
1005
|
o = c.prev, e.refresh(c.prev);
|
|
1042
1006
|
try {
|
|
1043
|
-
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentTarget.value.map((
|
|
1007
|
+
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentTarget.value.map((a) => this.findEle(a))) : e.selectNodes(c.currentSelected.map((a) => this.findEle(a))));
|
|
1044
1008
|
} catch {
|
|
1045
1009
|
} finally {
|
|
1046
1010
|
n--;
|
|
@@ -1052,23 +1016,22 @@ function It(e) {
|
|
|
1052
1016
|
const c = t[n];
|
|
1053
1017
|
o = c.next, e.refresh(c.next);
|
|
1054
1018
|
try {
|
|
1055
|
-
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentSelected.map((
|
|
1019
|
+
c.currentTarget.type === "nodes" && (c.operation === "removeNodes" ? e.selectNodes(c.currentSelected.map((a) => this.findEle(a))) : e.selectNodes(c.currentTarget.value.map((a) => this.findEle(a))));
|
|
1056
1020
|
} catch {
|
|
1057
1021
|
}
|
|
1058
1022
|
}
|
|
1059
1023
|
};
|
|
1060
1024
|
const i = function(c) {
|
|
1061
|
-
if (c.name === "beginEdit")
|
|
1062
|
-
return;
|
|
1025
|
+
if (c.name === "beginEdit") return;
|
|
1063
1026
|
t = t.slice(0, n + 1);
|
|
1064
|
-
const
|
|
1027
|
+
const a = e.getData(), f = {
|
|
1065
1028
|
prev: o,
|
|
1066
1029
|
operation: c.name,
|
|
1067
1030
|
currentSelected: s.map((u) => u.id),
|
|
1068
|
-
currentTarget:
|
|
1069
|
-
next:
|
|
1031
|
+
currentTarget: Ot(c),
|
|
1032
|
+
next: a
|
|
1070
1033
|
};
|
|
1071
|
-
t.push(f), o =
|
|
1034
|
+
t.push(f), o = a, n = t.length - 1;
|
|
1072
1035
|
}, l = function(c) {
|
|
1073
1036
|
(c.metaKey || c.ctrlKey) && (c.shiftKey && c.key === "Z" || c.key === "y") ? e.redo() : (c.metaKey || c.ctrlKey) && c.key === "z" && e.undo();
|
|
1074
1037
|
}, r = function() {
|
|
@@ -1078,20 +1041,19 @@ function It(e) {
|
|
|
1078
1041
|
e.bus.removeListener("operation", i), e.bus.removeListener("selectNodes", r), e.container.removeEventListener("keydown", l);
|
|
1079
1042
|
};
|
|
1080
1043
|
}
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
zoomout: Vt
|
|
1044
|
+
const Ht = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Bt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Rt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', It = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ft = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', Wt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', Kt = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>', Gt = {
|
|
1045
|
+
side: Ht,
|
|
1046
|
+
left: Bt,
|
|
1047
|
+
right: Rt,
|
|
1048
|
+
full: It,
|
|
1049
|
+
living: Ft,
|
|
1050
|
+
zoomin: Wt,
|
|
1051
|
+
zoomout: Kt
|
|
1090
1052
|
}, F = (e, t) => {
|
|
1091
1053
|
const n = document.createElement("span");
|
|
1092
|
-
return n.id = e, n.innerHTML =
|
|
1054
|
+
return n.id = e, n.innerHTML = Gt[t], n;
|
|
1093
1055
|
};
|
|
1094
|
-
function
|
|
1056
|
+
function Yt(e) {
|
|
1095
1057
|
const t = document.createElement("div"), n = F("fullscreen", "full"), o = F("toCenter", "living"), s = F("zoomout", "zoomout"), i = F("zoomin", "zoomin"), l = document.createElement("span");
|
|
1096
1058
|
return l.innerText = "100%", t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
1097
1059
|
document.fullscreenElement === e.el ? document.exitFullscreen() : e.el.requestFullscreen();
|
|
@@ -1103,7 +1065,7 @@ function Xt(e) {
|
|
|
1103
1065
|
e.scale(e.scaleVal + e.scaleSensitivity);
|
|
1104
1066
|
}, t;
|
|
1105
1067
|
}
|
|
1106
|
-
function
|
|
1068
|
+
function qt(e) {
|
|
1107
1069
|
const t = document.createElement("div"), n = F("tbltl", "left"), o = F("tbltr", "right"), s = F("tblts", "side");
|
|
1108
1070
|
return t.appendChild(n), t.appendChild(o), t.appendChild(s), t.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
1109
1071
|
e.initLeft();
|
|
@@ -1113,21 +1075,17 @@ function Jt(e) {
|
|
|
1113
1075
|
e.initSide();
|
|
1114
1076
|
}, t;
|
|
1115
1077
|
}
|
|
1116
|
-
function
|
|
1117
|
-
e.container.append(
|
|
1078
|
+
function zt(e) {
|
|
1079
|
+
e.container.append(Yt(e)), e.container.append(qt(e));
|
|
1118
1080
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
constructor() {
|
|
1122
|
-
this._listeners = /* @__PURE__ */ new Map(), this.on = this.addEventListener, this.off = this.removeEventListener, this.emit = this.dispatchEvent;
|
|
1123
|
-
}
|
|
1081
|
+
class Vt {
|
|
1082
|
+
_listeners = /* @__PURE__ */ new Map();
|
|
1124
1083
|
addEventListener(t, n) {
|
|
1125
1084
|
const o = this._listeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
1126
1085
|
return this._listeners.set(t, o), o.add(n), this;
|
|
1127
1086
|
}
|
|
1128
1087
|
removeEventListener(t, n) {
|
|
1129
|
-
|
|
1130
|
-
return (o = this._listeners.get(t)) == null || o.delete(n), this;
|
|
1088
|
+
return this._listeners.get(t)?.delete(n), this;
|
|
1131
1089
|
}
|
|
1132
1090
|
dispatchEvent(t, ...n) {
|
|
1133
1091
|
let o = !0;
|
|
@@ -1138,17 +1096,20 @@ class Qt {
|
|
|
1138
1096
|
unbindAllListeners() {
|
|
1139
1097
|
this._listeners.clear();
|
|
1140
1098
|
}
|
|
1099
|
+
// Let's also support on, off and emit like node
|
|
1100
|
+
on = this.addEventListener;
|
|
1101
|
+
off = this.removeEventListener;
|
|
1102
|
+
emit = this.dispatchEvent;
|
|
1141
1103
|
}
|
|
1142
|
-
const
|
|
1104
|
+
const He = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e }, t, n) => {
|
|
1143
1105
|
if (typeof t == "object")
|
|
1144
1106
|
for (const [o, s] of Object.entries(t))
|
|
1145
|
-
s !== void 0 && (e[o] =
|
|
1146
|
-
else
|
|
1147
|
-
|
|
1148
|
-
}, Fe = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1107
|
+
s !== void 0 && (e[o] = He(s));
|
|
1108
|
+
else n !== void 0 && (e[t] = He(n));
|
|
1109
|
+
}, Be = (e = 0, t = 0, n = 0, o = 0) => {
|
|
1149
1110
|
const s = { x: e, y: t, width: n, height: o, top: t, left: e, right: e + n, bottom: t + o };
|
|
1150
1111
|
return { ...s, toJSON: () => JSON.stringify(s) };
|
|
1151
|
-
},
|
|
1112
|
+
}, Xt = (e) => {
|
|
1152
1113
|
let t, n = -1, o = !1;
|
|
1153
1114
|
return {
|
|
1154
1115
|
next: (...s) => {
|
|
@@ -1160,7 +1121,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1160
1121
|
cancelAnimationFrame(n), o = !1;
|
|
1161
1122
|
}
|
|
1162
1123
|
};
|
|
1163
|
-
},
|
|
1124
|
+
}, Re = (e, t, n = "touch") => {
|
|
1164
1125
|
switch (n) {
|
|
1165
1126
|
case "center": {
|
|
1166
1127
|
const o = t.left + t.width / 2, s = t.top + t.height / 2;
|
|
@@ -1171,19 +1132,16 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1171
1132
|
case "touch":
|
|
1172
1133
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1173
1134
|
}
|
|
1174
|
-
},
|
|
1175
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1135
|
+
}, Ut = () => matchMedia("(hover: none), (pointer: coarse)").matches, Jt = () => "safari" in window, ye = (e) => Array.isArray(e) ? e : [e], et = (e) => (t, n, o, s = {}) => {
|
|
1136
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = ye(n), t = ye(t);
|
|
1176
1137
|
for (const i of t)
|
|
1177
1138
|
if (i)
|
|
1178
1139
|
for (const l of n)
|
|
1179
1140
|
i[e](l, o, { capture: !1, ...s });
|
|
1180
|
-
},
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}, W = (e, t = document) => be(e).map(
|
|
1185
|
-
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
|
|
1186
|
-
).flat().filter(Boolean), on = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1141
|
+
}, B = et("addEventListener"), M = et("removeEventListener"), Q = (e) => {
|
|
1142
|
+
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1143
|
+
return { x: t, y: n, target: o };
|
|
1144
|
+
}, K = (e, t = document) => ye(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), Zt = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1187
1145
|
switch (o) {
|
|
1188
1146
|
case "alt":
|
|
1189
1147
|
return e.altKey;
|
|
@@ -1192,15 +1150,43 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1192
1150
|
case "shift":
|
|
1193
1151
|
return e.shiftKey;
|
|
1194
1152
|
}
|
|
1195
|
-
}) : !1), { abs:
|
|
1153
|
+
}) : !1), { abs: I, max: Ie, min: Fe, ceil: We } = Math, Ke = (e = []) => ({
|
|
1196
1154
|
stored: e,
|
|
1197
1155
|
selected: [],
|
|
1198
1156
|
touched: [],
|
|
1199
1157
|
changed: { added: [], removed: [] }
|
|
1200
|
-
})
|
|
1158
|
+
});
|
|
1159
|
+
class Qt extends Vt {
|
|
1160
|
+
static version = "mind-elixir-fork";
|
|
1161
|
+
// Options
|
|
1162
|
+
_options;
|
|
1163
|
+
// Selection store
|
|
1164
|
+
_selection = Ke();
|
|
1165
|
+
// Area element and clipping element
|
|
1166
|
+
_area;
|
|
1167
|
+
_clippingElement;
|
|
1168
|
+
// Target container (element) and boundary (cached)
|
|
1169
|
+
_targetElement;
|
|
1170
|
+
_targetBoundary;
|
|
1171
|
+
_targetBoundaryScrolled = !0;
|
|
1172
|
+
_targetRect;
|
|
1173
|
+
_selectables = [];
|
|
1174
|
+
_latestElement;
|
|
1175
|
+
// Dynamically constructed area rect
|
|
1176
|
+
_areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 };
|
|
1177
|
+
_areaRect = Be();
|
|
1178
|
+
// If a single click is being performed, it's a single-click until the user dragged the mouse
|
|
1179
|
+
_singleClick = !0;
|
|
1180
|
+
_frame;
|
|
1181
|
+
// Required data for scrolling
|
|
1182
|
+
_scrollAvailable = !0;
|
|
1183
|
+
_scrollingActive = !1;
|
|
1184
|
+
_scrollSpeed = { x: 0, y: 0 };
|
|
1185
|
+
_scrollDelta = { x: 0, y: 0 };
|
|
1186
|
+
// Required for keydown scrolling
|
|
1187
|
+
_lastMousePosition = { x: 0, y: 0 };
|
|
1201
1188
|
constructor(t) {
|
|
1202
|
-
|
|
1203
|
-
super(), this._selection = Ye(), this._targetBoundaryScrolled = !0, this._selectables = [], this._areaLocation = { y1: 0, x2: 0, y2: 0, x1: 0 }, this._areaRect = Fe(), this._singleClick = !0, this._scrollAvailable = !0, this._scrollingActive = !1, this._scrollSpeed = { x: 0, y: 0 }, this._scrollDelta = { x: 0, y: 0 }, this._lastMousePosition = { x: 0, y: 0 }, this.enable = this._toggleStartEvents, this.disable = this._toggleStartEvents.bind(this, !1), this._options = {
|
|
1189
|
+
super(), this._options = {
|
|
1204
1190
|
selectionAreaClass: "selection-area",
|
|
1205
1191
|
selectionContainerClass: void 0,
|
|
1206
1192
|
selectables: [],
|
|
@@ -1208,21 +1194,23 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1208
1194
|
startAreas: ["html"],
|
|
1209
1195
|
boundaries: ["html"],
|
|
1210
1196
|
container: "body",
|
|
1197
|
+
mindElixirInstance: void 0,
|
|
1198
|
+
// 添加默认值
|
|
1211
1199
|
...t,
|
|
1212
1200
|
behaviour: {
|
|
1213
1201
|
overlap: "invert",
|
|
1214
1202
|
intersect: "touch",
|
|
1215
1203
|
triggers: [0],
|
|
1216
1204
|
...t.behaviour,
|
|
1217
|
-
startThreshold:
|
|
1205
|
+
startThreshold: t.behaviour?.startThreshold ? typeof t.behaviour.startThreshold == "number" ? t.behaviour.startThreshold : { x: 10, y: 10, ...t.behaviour.startThreshold } : { x: 10, y: 10 },
|
|
1218
1206
|
scrolling: {
|
|
1219
1207
|
speedDivider: 10,
|
|
1220
1208
|
manualSpeed: 750,
|
|
1221
|
-
...
|
|
1209
|
+
...t.behaviour?.scrolling,
|
|
1222
1210
|
startScrollMargins: {
|
|
1223
1211
|
x: 0,
|
|
1224
1212
|
y: 0,
|
|
1225
|
-
...
|
|
1213
|
+
...t.behaviour?.scrolling?.startScrollMargins
|
|
1226
1214
|
}
|
|
1227
1215
|
}
|
|
1228
1216
|
},
|
|
@@ -1234,58 +1222,59 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1234
1222
|
singleTap: {
|
|
1235
1223
|
allow: !0,
|
|
1236
1224
|
intersect: "native",
|
|
1237
|
-
...
|
|
1225
|
+
...t.features?.singleTap
|
|
1238
1226
|
}
|
|
1239
1227
|
}
|
|
1240
1228
|
};
|
|
1241
|
-
for (const
|
|
1242
|
-
typeof this[
|
|
1243
|
-
const { document:
|
|
1244
|
-
this._area =
|
|
1229
|
+
for (const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
|
|
1230
|
+
typeof this[i] == "function" && (this[i] = this[i].bind(this));
|
|
1231
|
+
const { document: n, selectionAreaClass: o, selectionContainerClass: s } = this._options;
|
|
1232
|
+
this._area = n.createElement("div"), this._clippingElement = n.createElement("div"), this._clippingElement.appendChild(this._area), this._area.classList.add(o), s && this._clippingElement.classList.add(s), H(this._area, {
|
|
1245
1233
|
willChange: "top, left, bottom, right, width, height",
|
|
1246
1234
|
top: 0,
|
|
1247
1235
|
left: 0,
|
|
1248
1236
|
position: "fixed"
|
|
1249
|
-
}),
|
|
1237
|
+
}), H(this._clippingElement, {
|
|
1250
1238
|
overflow: "hidden",
|
|
1251
1239
|
position: "fixed",
|
|
1252
1240
|
transform: "translate3d(0, 0, 0)",
|
|
1253
1241
|
// https://stackoverflow.com/a/38268846
|
|
1254
1242
|
pointerEvents: "none",
|
|
1255
1243
|
zIndex: "1"
|
|
1256
|
-
}), this._frame =
|
|
1257
|
-
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move",
|
|
1244
|
+
}), this._frame = Xt((i) => {
|
|
1245
|
+
this._recalculateSelectionAreaRect(), this._updateElementSelection(), this._emitEvent("move", i), this._redrawSelectionArea();
|
|
1258
1246
|
}), this.enable();
|
|
1259
1247
|
}
|
|
1260
1248
|
_toggleStartEvents(t = !0) {
|
|
1261
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1249
|
+
const { document: n, features: o } = this._options, s = t ? B : M;
|
|
1262
1250
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1263
1251
|
}
|
|
1264
1252
|
_onTapStart(t, n = !1) {
|
|
1265
|
-
const { x: o, y: s, target: i } =
|
|
1266
|
-
if (t instanceof MouseEvent && !
|
|
1253
|
+
const { x: o, y: s, target: i } = Q(t), { document: l, startAreas: r, boundaries: c, features: a, behaviour: f } = this._options, u = i.getBoundingClientRect();
|
|
1254
|
+
if (t instanceof MouseEvent && !Zt(t, f.triggers))
|
|
1267
1255
|
return;
|
|
1268
|
-
const g =
|
|
1269
|
-
this._targetElement = y.find(
|
|
1270
|
-
|
|
1271
|
-
)
|
|
1272
|
-
const p = t.composedPath(), m = g.find((h) => p.includes(h));
|
|
1273
|
-
if (this._targetBoundary = y.find((h) => p.includes(h)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1256
|
+
const g = K(r, l), y = K(c, l);
|
|
1257
|
+
this._targetElement = y.find((h) => Re(h.getBoundingClientRect(), u));
|
|
1258
|
+
const m = t.composedPath(), p = g.find((h) => m.includes(h));
|
|
1259
|
+
if (this._targetBoundary = y.find((h) => m.includes(h)), !this._targetElement || !p || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1274
1260
|
return;
|
|
1275
1261
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1276
|
-
const
|
|
1277
|
-
this._scrollDelta = { x:
|
|
1262
|
+
const d = l.scrollingElement ?? l.body;
|
|
1263
|
+
this._scrollDelta = { x: d.scrollLeft, y: d.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), B(l, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), B(l, ["mouseup", "touchcancel", "touchend"], this._onTapStop), B(l, "scroll", this._onScroll), a.deselectOnBlur && (this._targetBoundaryScrolled = !1, B(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1278
1264
|
}
|
|
1279
1265
|
_onSingleTap(t) {
|
|
1280
|
-
const {
|
|
1266
|
+
const {
|
|
1267
|
+
singleTap: { intersect: n },
|
|
1268
|
+
range: o
|
|
1269
|
+
} = this._options.features, s = Q(t);
|
|
1281
1270
|
let i;
|
|
1282
1271
|
if (n === "native")
|
|
1283
1272
|
i = s.target;
|
|
1284
1273
|
else if (n === "touch") {
|
|
1285
1274
|
this.resolveSelectables();
|
|
1286
1275
|
const { x: r, y: c } = s;
|
|
1287
|
-
i = this._selectables.find((
|
|
1288
|
-
const { right: f, left: u, top: g, bottom: y } =
|
|
1276
|
+
i = this._selectables.find((a) => {
|
|
1277
|
+
const { right: f, left: u, top: g, bottom: y } = a.getBoundingClientRect();
|
|
1289
1278
|
return r < f && r > u && c < y && c > g;
|
|
1290
1279
|
});
|
|
1291
1280
|
}
|
|
@@ -1300,71 +1289,85 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1300
1289
|
}
|
|
1301
1290
|
const { stored: l } = this._selection;
|
|
1302
1291
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1303
|
-
const r = this._latestElement, [c,
|
|
1304
|
-
(u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(
|
|
1305
|
-
|
|
1292
|
+
const r = this._latestElement, [c, a] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], f = [
|
|
1293
|
+
...this._selectables.filter((u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(a) & 2),
|
|
1294
|
+
c,
|
|
1295
|
+
a
|
|
1296
|
+
];
|
|
1306
1297
|
this.select(f), this._latestElement = r;
|
|
1307
|
-
} else
|
|
1308
|
-
l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1298
|
+
} else l.includes(i) && (l.length === 1 || t.ctrlKey || l.every((r) => this._selection.stored.includes(r))) ? this.deselect(i) : (this.select(i), this._latestElement = i);
|
|
1309
1299
|
}
|
|
1310
1300
|
_delayedTapMove(t) {
|
|
1311
|
-
const {
|
|
1301
|
+
const {
|
|
1302
|
+
container: n,
|
|
1303
|
+
document: o,
|
|
1304
|
+
behaviour: { startThreshold: s }
|
|
1305
|
+
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: r, y: c } = Q(t);
|
|
1312
1306
|
if (
|
|
1313
1307
|
// Single number for both coordinates
|
|
1314
|
-
typeof s == "number" &&
|
|
1315
|
-
typeof s == "object" &&
|
|
1308
|
+
typeof s == "number" && I(r + c - (i + l)) >= s || // Different x and y threshold
|
|
1309
|
+
typeof s == "object" && I(r - i) >= s.x || I(c - l) >= s.y
|
|
1316
1310
|
) {
|
|
1317
1311
|
if (M(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1318
1312
|
M(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1319
1313
|
return;
|
|
1320
1314
|
}
|
|
1321
|
-
|
|
1315
|
+
B(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), H(this._area, "display", "block"), K(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (B(this._targetElement, "wheel", this._wheelScroll, { passive: !1 }), B(this._options.document, "keydown", this._keyboardScroll, { passive: !1 }), this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1322
1316
|
}
|
|
1323
1317
|
this._handleMoveEvent(t);
|
|
1324
1318
|
}
|
|
1325
1319
|
_setupSelectionArea() {
|
|
1326
1320
|
const { _clippingElement: t, _targetElement: n, _area: o } = this, s = this._targetRect = n.getBoundingClientRect();
|
|
1327
|
-
this._scrollAvailable ? (
|
|
1321
|
+
this._scrollAvailable ? (H(t, {
|
|
1328
1322
|
top: s.top,
|
|
1329
1323
|
left: s.left,
|
|
1330
1324
|
width: s.width,
|
|
1331
1325
|
height: s.height
|
|
1332
|
-
}),
|
|
1326
|
+
}), H(o, {
|
|
1333
1327
|
marginTop: -s.top,
|
|
1334
1328
|
marginLeft: -s.left
|
|
1335
|
-
})) : (
|
|
1329
|
+
})) : (H(t, {
|
|
1336
1330
|
top: 0,
|
|
1337
1331
|
left: 0,
|
|
1338
1332
|
width: "100%",
|
|
1339
1333
|
height: "100%"
|
|
1340
|
-
}),
|
|
1334
|
+
}), H(o, {
|
|
1341
1335
|
marginTop: 0,
|
|
1342
1336
|
marginLeft: 0
|
|
1343
1337
|
}));
|
|
1344
1338
|
}
|
|
1345
1339
|
_onTapMove(t) {
|
|
1346
|
-
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling
|
|
1347
|
-
|
|
1340
|
+
const { _scrollSpeed: n, _areaLocation: o, _options: s, _frame: i } = this, { speedDivider: l } = s.behaviour.scrolling;
|
|
1341
|
+
this._targetElement;
|
|
1342
|
+
const { x: r, y: c } = Q(t);
|
|
1343
|
+
if (o.x2 = r, o.y2 = c, this._lastMousePosition.x = r, this._lastMousePosition.y = c, this._scrollAvailable && !this._scrollingActive && (n.y || n.x)) {
|
|
1348
1344
|
this._scrollingActive = !0;
|
|
1349
|
-
const
|
|
1345
|
+
const a = () => {
|
|
1350
1346
|
if (!n.x && !n.y) {
|
|
1351
1347
|
this._scrollingActive = !1;
|
|
1352
1348
|
return;
|
|
1353
1349
|
}
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1350
|
+
const f = this._options.mindElixirInstance;
|
|
1351
|
+
if (f && f.move) {
|
|
1352
|
+
const u = n.x ? We(n.x / l) : 0, g = n.y ? We(n.y / l) : 0;
|
|
1353
|
+
(u || g) && (f.move(-u, -g), o.x1 -= u, o.y1 -= g);
|
|
1354
|
+
}
|
|
1355
|
+
i.next(t), requestAnimationFrame(a);
|
|
1356
1356
|
};
|
|
1357
|
-
requestAnimationFrame(
|
|
1357
|
+
requestAnimationFrame(a);
|
|
1358
1358
|
} else
|
|
1359
1359
|
i.next(t);
|
|
1360
1360
|
this._handleMoveEvent(t);
|
|
1361
1361
|
}
|
|
1362
1362
|
_handleMoveEvent(t) {
|
|
1363
1363
|
const { features: n } = this._options;
|
|
1364
|
-
(n.touch &&
|
|
1364
|
+
(n.touch && Ut() || this._scrollAvailable && Jt()) && t.preventDefault();
|
|
1365
1365
|
}
|
|
1366
1366
|
_onScroll() {
|
|
1367
|
-
const {
|
|
1367
|
+
const {
|
|
1368
|
+
_scrollDelta: t,
|
|
1369
|
+
_options: { document: n }
|
|
1370
|
+
} = this, { scrollTop: o, scrollLeft: s } = n.scrollingElement ?? n.body;
|
|
1368
1371
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1369
1372
|
}
|
|
1370
1373
|
_onStartAreaScroll() {
|
|
@@ -1384,44 +1387,47 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1384
1387
|
});
|
|
1385
1388
|
}
|
|
1386
1389
|
_recalculateSelectionAreaRect() {
|
|
1387
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this,
|
|
1388
|
-
let { x2:
|
|
1389
|
-
const {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1390
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: r } = n;
|
|
1391
|
+
let { x2: c, y2: a } = n;
|
|
1392
|
+
const {
|
|
1393
|
+
behaviour: {
|
|
1394
|
+
scrolling: { startScrollMargins: f }
|
|
1395
|
+
}
|
|
1396
|
+
} = s;
|
|
1397
|
+
c < i.left + f.x ? (t.x = -I(i.left - c + f.x), c = c < i.left ? i.left : c) : c > i.right - f.x ? (t.x = I(i.left + i.width - c - f.x), c = c > i.right ? i.right : c) : t.x = 0, a < i.top + f.y ? (t.y = -I(i.top - a + f.y), a = a < i.top ? i.top : a) : a > i.bottom - f.y ? (t.y = I(i.top + i.height - a - f.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1398
|
+
const u = Fe(l, c), g = Fe(r, a), y = Ie(l, c), m = Ie(r, a);
|
|
1399
|
+
this._areaRect = Be(u, g, y - u, m - g);
|
|
1393
1400
|
}
|
|
1394
1401
|
_redrawSelectionArea() {
|
|
1395
1402
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
1396
1403
|
i.left = `${t}px`, i.top = `${n}px`, i.width = `${o}px`, i.height = `${s}px`;
|
|
1397
1404
|
}
|
|
1398
1405
|
_onTapStop(t, n) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
M(this._targetElement, "scroll", this._onStartAreaScroll), M(s, ["mousemove", "touchmove"], this._delayedTapMove), M(s, ["touchmove", "mousemove"], this._onTapMove), M(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), M(s, "scroll", this._onScroll), this._keepSelection(), t && l && i.singleTap.allow ? this._onSingleTap(t) : !l && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, M(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), M(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1406
|
+
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1407
|
+
M(this._targetElement, "scroll", this._onStartAreaScroll), M(o, ["mousemove", "touchmove"], this._delayedTapMove), M(o, ["touchmove", "mousemove"], this._onTapMove), M(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop), M(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, M(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), M(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), this._frame?.cancel(), H(this._area, "display", "none");
|
|
1402
1408
|
}
|
|
1403
1409
|
_updateElementSelection() {
|
|
1404
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap:
|
|
1405
|
-
for (let
|
|
1406
|
-
const
|
|
1407
|
-
if (
|
|
1408
|
-
if (l.includes(
|
|
1409
|
-
i.includes(
|
|
1410
|
-
else if (f && i.includes(
|
|
1411
|
-
y.push(
|
|
1410
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: a } = n.behaviour, f = a === "invert", u = [], g = [], y = [];
|
|
1411
|
+
for (let p = 0; p < t.length; p++) {
|
|
1412
|
+
const d = t[p];
|
|
1413
|
+
if (Re(s, d.getBoundingClientRect(), c)) {
|
|
1414
|
+
if (l.includes(d))
|
|
1415
|
+
i.includes(d) && !r.includes(d) && r.push(d);
|
|
1416
|
+
else if (f && i.includes(d)) {
|
|
1417
|
+
y.push(d);
|
|
1412
1418
|
continue;
|
|
1413
1419
|
} else
|
|
1414
|
-
g.push(
|
|
1415
|
-
u.push(
|
|
1420
|
+
g.push(d);
|
|
1421
|
+
u.push(d);
|
|
1416
1422
|
}
|
|
1417
1423
|
}
|
|
1418
|
-
f && g.push(...i.filter((
|
|
1419
|
-
const
|
|
1420
|
-
for (let
|
|
1421
|
-
const
|
|
1422
|
-
!u.includes(
|
|
1424
|
+
f && g.push(...i.filter((p) => !l.includes(p)));
|
|
1425
|
+
const m = a === "keep";
|
|
1426
|
+
for (let p = 0; p < l.length; p++) {
|
|
1427
|
+
const d = l[p];
|
|
1428
|
+
!u.includes(d) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1423
1429
|
// not make them part of the current selection as soon as they're touched.
|
|
1424
|
-
(
|
|
1430
|
+
(m && i.includes(d)) && y.push(d);
|
|
1425
1431
|
}
|
|
1426
1432
|
o.selected = u, o.changed = { added: g, removed: y }, this._latestElement = void 0;
|
|
1427
1433
|
}
|
|
@@ -1474,7 +1480,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1474
1480
|
* Will update everything that can be selected
|
|
1475
1481
|
*/
|
|
1476
1482
|
resolveSelectables() {
|
|
1477
|
-
this._selectables =
|
|
1483
|
+
this._selectables = K(this._options.selectables, this._options.document);
|
|
1478
1484
|
}
|
|
1479
1485
|
/**
|
|
1480
1486
|
* Same as deselecting, but for all elements currently selected
|
|
@@ -1483,10 +1489,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1483
1489
|
*/
|
|
1484
1490
|
clearSelection(t = !0, n = !1) {
|
|
1485
1491
|
const { selected: o, stored: s, changed: i } = this._selection;
|
|
1486
|
-
i.added = [], i.removed.push(
|
|
1487
|
-
...o,
|
|
1488
|
-
...t ? s : []
|
|
1489
|
-
), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ye(t ? [] : s);
|
|
1492
|
+
i.added = [], i.removed.push(...o, ...t ? s : []), n || (this._emitEvent("move", null), this._emitEvent("stop", null)), this._selection = Ke(t ? [] : s);
|
|
1490
1493
|
}
|
|
1491
1494
|
/**
|
|
1492
1495
|
* @returns {Array} Selected elements
|
|
@@ -1532,15 +1535,21 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1532
1535
|
destroy() {
|
|
1533
1536
|
this.cancel(), this.disable(), this._clippingElement.remove(), super.unbindAllListeners();
|
|
1534
1537
|
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Enable selecting elements
|
|
1540
|
+
*/
|
|
1541
|
+
enable = this._toggleStartEvents;
|
|
1542
|
+
/**
|
|
1543
|
+
* Disable selecting elements
|
|
1544
|
+
*/
|
|
1545
|
+
disable = this._toggleStartEvents.bind(this, !1);
|
|
1535
1546
|
/**
|
|
1536
1547
|
* Adds elements to the selection
|
|
1537
1548
|
* @param query CSS Query, can be an array of queries
|
|
1538
1549
|
* @param quiet If this should not trigger the move event
|
|
1539
1550
|
*/
|
|
1540
1551
|
select(t, n = !1) {
|
|
1541
|
-
const { changed: o, selected: s, stored: i } = this._selection, l =
|
|
1542
|
-
(r) => !s.includes(r) && !i.includes(r)
|
|
1543
|
-
);
|
|
1552
|
+
const { changed: o, selected: s, stored: i } = this._selection, l = K(t, this._options.document).filter((r) => !s.includes(r) && !i.includes(r));
|
|
1544
1553
|
return i.push(...l), s.push(...l), o.added.push(...l), o.removed = [], this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null)), l;
|
|
1545
1554
|
}
|
|
1546
1555
|
/**
|
|
@@ -1549,21 +1558,17 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1549
1558
|
* @param quiet If this should not trigger the move event
|
|
1550
1559
|
*/
|
|
1551
1560
|
deselect(t, n = !1) {
|
|
1552
|
-
const { selected: o, stored: s, changed: i } = this._selection, l =
|
|
1553
|
-
|
|
1554
|
-
);
|
|
1555
|
-
this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(
|
|
1556
|
-
...l.filter((r) => !i.removed.includes(r))
|
|
1557
|
-
), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1561
|
+
const { selected: o, stored: s, changed: i } = this._selection, l = K(t, this._options.document).filter((r) => o.includes(r) || s.includes(r));
|
|
1562
|
+
this._selection.stored = s.filter((r) => !l.includes(r)), this._selection.selected = o.filter((r) => !l.includes(r)), this._selection.changed.added = [], this._selection.changed.removed.push(...l.filter((r) => !i.removed.includes(r))), this._latestElement = void 0, n || (this._emitEvent("move", null), this._emitEvent("stop", null));
|
|
1558
1563
|
}
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
function rn(e) {
|
|
1563
|
-
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new sn({
|
|
1564
|
+
}
|
|
1565
|
+
function en(e) {
|
|
1566
|
+
const t = e.mouseSelectionButton === 2 ? [2] : [0], n = new Qt({
|
|
1564
1567
|
selectables: [".map-container me-tpc"],
|
|
1565
1568
|
boundaries: [e.container],
|
|
1566
1569
|
container: e.selectionContainer,
|
|
1570
|
+
mindElixirInstance: e,
|
|
1571
|
+
// 传递 MindElixir 实例
|
|
1567
1572
|
features: {
|
|
1568
1573
|
// deselectOnBlur: true,
|
|
1569
1574
|
touch: !1
|
|
@@ -1575,21 +1580,13 @@ function rn(e) {
|
|
|
1575
1580
|
// On scrollable areas the number on px per frame is devided by this amount.
|
|
1576
1581
|
// Default is 10 to provide a enjoyable scroll experience.
|
|
1577
1582
|
speedDivider: 10,
|
|
1578
|
-
|
|
1579
|
-
// numerator to calculate the mount of px while scrolling manually: manualScrollSpeed / scrollSpeedDivider.
|
|
1580
|
-
manualSpeed: 750,
|
|
1581
|
-
// This property defines the virtual inset margins from the borders of the container
|
|
1582
|
-
// component that, when crossed by the mouse/touch, trigger the scrolling. Useful for
|
|
1583
|
-
// fullscreen containers.
|
|
1584
|
-
startScrollMargins: { x: 10, y: 10 }
|
|
1583
|
+
startScrollMargins: { x: 50, y: 50 }
|
|
1585
1584
|
}
|
|
1586
1585
|
}
|
|
1587
1586
|
}).on("beforestart", ({ event: o }) => {
|
|
1588
|
-
|
|
1589
|
-
if (e.spacePressed)
|
|
1590
|
-
return !1;
|
|
1587
|
+
if (e.spacePressed) return !1;
|
|
1591
1588
|
const s = o.target;
|
|
1592
|
-
if (s.id === "input-box" || s.className === "circle" ||
|
|
1589
|
+
if (s.id === "input-box" || s.className === "circle" || e.container.querySelector(".context-menu")?.contains(s))
|
|
1593
1590
|
return !1;
|
|
1594
1591
|
if (!o.ctrlKey && !o.metaKey) {
|
|
1595
1592
|
if (s.tagName === "ME-TPC" && s.classList.contains("selected"))
|
|
@@ -1616,7 +1613,7 @@ function rn(e) {
|
|
|
1616
1613
|
if (s.length > 0) {
|
|
1617
1614
|
for (const i of s)
|
|
1618
1615
|
i.classList.remove("selected");
|
|
1619
|
-
e.currentNodes = e.currentNodes.filter((i) => !
|
|
1616
|
+
e.currentNodes = e.currentNodes.filter((i) => !s?.includes(i)), e.bus.fire(
|
|
1620
1617
|
"unselectNodes",
|
|
1621
1618
|
s.map((i) => i.nodeObj)
|
|
1622
1619
|
);
|
|
@@ -1625,10 +1622,10 @@ function rn(e) {
|
|
|
1625
1622
|
);
|
|
1626
1623
|
e.selection = n;
|
|
1627
1624
|
}
|
|
1628
|
-
const
|
|
1625
|
+
const tn = function(e, t = !0) {
|
|
1629
1626
|
this.theme = e;
|
|
1630
1627
|
const o = {
|
|
1631
|
-
...(e.type === "dark" ?
|
|
1628
|
+
...(e.type === "dark" ? be : ve).cssVar,
|
|
1632
1629
|
...e.cssVar
|
|
1633
1630
|
}, s = Object.keys(o);
|
|
1634
1631
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -1636,179 +1633,166 @@ const ln = function(e, t = !0) {
|
|
|
1636
1633
|
this.container.style.setProperty(l, o[l]);
|
|
1637
1634
|
}
|
|
1638
1635
|
t && this.refresh();
|
|
1639
|
-
},
|
|
1640
|
-
|
|
1641
|
-
const t = (o = e.parent) == null ? void 0 : o.children, n = (t == null ? void 0 : t.indexOf(e)) ?? 0;
|
|
1636
|
+
}, V = (e) => {
|
|
1637
|
+
const t = e.parent?.children, n = t?.indexOf(e) ?? 0;
|
|
1642
1638
|
return { siblings: t, index: n };
|
|
1643
1639
|
};
|
|
1644
|
-
function
|
|
1645
|
-
const { siblings: t, index: n } =
|
|
1646
|
-
if (t === void 0)
|
|
1647
|
-
return;
|
|
1640
|
+
function nn(e) {
|
|
1641
|
+
const { siblings: t, index: n } = V(e);
|
|
1642
|
+
if (t === void 0) return;
|
|
1648
1643
|
const o = t[n];
|
|
1649
1644
|
n === 0 ? (t[n] = t[t.length - 1], t[t.length - 1] = o) : (t[n] = t[n - 1], t[n - 1] = o);
|
|
1650
1645
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const { siblings: t, index: n } =
|
|
1653
|
-
if (t === void 0)
|
|
1654
|
-
return;
|
|
1646
|
+
function on(e) {
|
|
1647
|
+
const { siblings: t, index: n } = V(e);
|
|
1648
|
+
if (t === void 0) return;
|
|
1655
1649
|
const o = t[n];
|
|
1656
1650
|
n === t.length - 1 ? (t[n] = t[0], t[0] = o) : (t[n] = t[n + 1], t[n + 1] = o);
|
|
1657
1651
|
}
|
|
1658
|
-
function
|
|
1659
|
-
const { siblings: t, index: n } =
|
|
1652
|
+
function tt(e) {
|
|
1653
|
+
const { siblings: t, index: n } = V(e);
|
|
1660
1654
|
return t === void 0 ? 0 : (t.splice(n, 1), t.length);
|
|
1661
1655
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const { siblings: o, index: s } =
|
|
1656
|
+
function sn(e, t, n) {
|
|
1657
|
+
const { siblings: o, index: s } = V(n);
|
|
1664
1658
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
1665
1659
|
}
|
|
1666
|
-
function
|
|
1667
|
-
const { siblings: n, index: o } =
|
|
1660
|
+
function rn(e, t) {
|
|
1661
|
+
const { siblings: n, index: o } = V(e);
|
|
1668
1662
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
1669
1663
|
}
|
|
1670
|
-
function
|
|
1671
|
-
|
|
1672
|
-
if (st(t), (o = n.parent) != null && o.parent || (t.direction = n.direction), e === "in")
|
|
1664
|
+
function nt(e, t, n) {
|
|
1665
|
+
if (tt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
1673
1666
|
n.children ? n.children.push(t) : n.children = [t];
|
|
1674
1667
|
else {
|
|
1675
1668
|
t.direction !== void 0 && (t.direction = n.direction);
|
|
1676
|
-
const { siblings:
|
|
1677
|
-
if (
|
|
1678
|
-
|
|
1679
|
-
e === "before" ? s.splice(i, 0, t) : s.splice(i + 1, 0, t);
|
|
1669
|
+
const { siblings: o, index: s } = V(n);
|
|
1670
|
+
if (o === void 0) return;
|
|
1671
|
+
e === "before" ? o.splice(s, 0, t) : o.splice(s + 1, 0, t);
|
|
1680
1672
|
}
|
|
1681
1673
|
}
|
|
1682
|
-
const
|
|
1683
|
-
var o, s;
|
|
1674
|
+
const ln = function({ map: e, direction: t }, n) {
|
|
1684
1675
|
if (t === 0)
|
|
1685
1676
|
return 0;
|
|
1686
1677
|
if (t === 1)
|
|
1687
1678
|
return 1;
|
|
1688
1679
|
if (t === 2) {
|
|
1689
|
-
const
|
|
1690
|
-
return
|
|
1680
|
+
const o = e.querySelector(".lhs")?.childElementCount || 0, s = e.querySelector(".rhs")?.childElementCount || 0;
|
|
1681
|
+
return o <= s ? (n.direction = 0, 0) : (n.direction = 1, 1);
|
|
1691
1682
|
}
|
|
1692
|
-
},
|
|
1693
|
-
var i, l;
|
|
1683
|
+
}, ot = function(e, t, n) {
|
|
1694
1684
|
const o = n.children[0].children[0], s = t.parentElement;
|
|
1695
1685
|
if (s.tagName === "ME-PARENT") {
|
|
1696
|
-
if (
|
|
1686
|
+
if (U(o), s.children[1])
|
|
1697
1687
|
s.nextSibling.appendChild(n);
|
|
1698
1688
|
else {
|
|
1699
|
-
const
|
|
1700
|
-
s.appendChild(
|
|
1689
|
+
const i = e.createChildren([n]);
|
|
1690
|
+
s.appendChild(Se(!0)), s.insertAdjacentElement("afterend", i);
|
|
1701
1691
|
}
|
|
1702
1692
|
e.linkDiv(n.offsetParent);
|
|
1703
|
-
} else
|
|
1704
|
-
|
|
1705
|
-
}, fn = function(e, t) {
|
|
1693
|
+
} else s.tagName === "ME-ROOT" && (ln(e, o.nodeObj) === 0 ? e.container.querySelector(".lhs")?.appendChild(n) : e.container.querySelector(".rhs")?.appendChild(n), e.linkDiv());
|
|
1694
|
+
}, cn = function(e, t) {
|
|
1706
1695
|
const n = e.parentNode;
|
|
1707
1696
|
if (t === 0) {
|
|
1708
1697
|
const o = n.parentNode.parentNode;
|
|
1709
1698
|
o.tagName !== "ME-MAIN" && (o.previousSibling.children[1].remove(), o.remove());
|
|
1710
1699
|
}
|
|
1711
1700
|
n.parentNode.remove();
|
|
1712
|
-
},
|
|
1701
|
+
}, st = {
|
|
1713
1702
|
before: "beforebegin",
|
|
1714
1703
|
after: "afterend"
|
|
1715
|
-
},
|
|
1704
|
+
}, U = function(e) {
|
|
1716
1705
|
const n = e.parentElement.parentElement.lastElementChild;
|
|
1717
|
-
|
|
1718
|
-
},
|
|
1719
|
-
const n = e.nodeObj, o =
|
|
1706
|
+
n?.tagName === "svg" && n?.remove();
|
|
1707
|
+
}, an = function(e, t) {
|
|
1708
|
+
const n = e.nodeObj, o = xe(n);
|
|
1720
1709
|
o.style && t.style && (t.style = Object.assign(o.style, t.style));
|
|
1721
1710
|
const s = Object.assign(n, t);
|
|
1722
|
-
|
|
1711
|
+
Ce.call(this, e, s), this.linkDiv(), this.bus.fire("operation", {
|
|
1723
1712
|
name: "reshapeNode",
|
|
1724
1713
|
obj: s,
|
|
1725
1714
|
origin: o
|
|
1726
1715
|
});
|
|
1727
|
-
},
|
|
1728
|
-
if (!t)
|
|
1729
|
-
return null;
|
|
1716
|
+
}, Ne = function(e, t, n) {
|
|
1717
|
+
if (!t) return null;
|
|
1730
1718
|
const o = t.nodeObj;
|
|
1731
1719
|
o.expanded === !1 && (e.expandNode(t, !0), t = e.findEle(o.id));
|
|
1732
1720
|
const s = n || e.generateNewObj();
|
|
1733
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
1721
|
+
o.children ? o.children.push(s) : o.children = [s], R(e.nodeData);
|
|
1734
1722
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
1735
|
-
return
|
|
1736
|
-
},
|
|
1737
|
-
var d, f, u, g;
|
|
1723
|
+
return ot(e, t, i), { newTop: l, newNodeObj: s };
|
|
1724
|
+
}, dn = function(e, t, n) {
|
|
1738
1725
|
const o = t || this.currentNode;
|
|
1739
|
-
if (!o)
|
|
1740
|
-
return;
|
|
1726
|
+
if (!o) return;
|
|
1741
1727
|
const s = o.nodeObj;
|
|
1742
1728
|
if (s.parent) {
|
|
1743
|
-
if (!
|
|
1744
|
-
this.
|
|
1745
|
-
|
|
1729
|
+
if (!s.parent?.parent && this.direction === 2) {
|
|
1730
|
+
const a = this.map.querySelector(".lhs")?.childElementCount || 0, f = this.map.querySelector(".rhs")?.childElementCount || 0;
|
|
1731
|
+
if (!a || !f) {
|
|
1732
|
+
this.addChild(this.findEle(s.parent.id), n);
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1746
1735
|
}
|
|
1747
1736
|
} else {
|
|
1748
1737
|
this.addChild();
|
|
1749
1738
|
return;
|
|
1750
1739
|
}
|
|
1751
1740
|
const i = n || this.generateNewObj();
|
|
1752
|
-
if (!
|
|
1753
|
-
const
|
|
1754
|
-
i.direction =
|
|
1741
|
+
if (!s.parent?.parent) {
|
|
1742
|
+
const a = o.closest("me-main").className === P.LHS ? 0 : 1;
|
|
1743
|
+
i.direction = a;
|
|
1755
1744
|
}
|
|
1756
|
-
|
|
1745
|
+
sn(i, e, s), R(this.nodeData);
|
|
1757
1746
|
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
1758
|
-
l.parentElement.insertAdjacentElement(
|
|
1747
|
+
l.parentElement.insertAdjacentElement(st[e], r), this.linkDiv(r.offsetParent), n || this.editTopic(c.firstChild), this.bus.fire("operation", {
|
|
1759
1748
|
name: "insertSibling",
|
|
1760
1749
|
type: e,
|
|
1761
1750
|
obj: i
|
|
1762
1751
|
}), this.selectNode(c.firstChild, !0);
|
|
1763
|
-
},
|
|
1752
|
+
}, hn = function(e, t) {
|
|
1764
1753
|
const n = e || this.currentNode;
|
|
1765
|
-
if (!n)
|
|
1766
|
-
|
|
1767
|
-
Z(n);
|
|
1754
|
+
if (!n) return;
|
|
1755
|
+
U(n);
|
|
1768
1756
|
const o = n.nodeObj;
|
|
1769
1757
|
if (!o.parent)
|
|
1770
1758
|
return;
|
|
1771
1759
|
const s = t || this.generateNewObj();
|
|
1772
|
-
|
|
1760
|
+
rn(o, s), R(this.nodeData);
|
|
1773
1761
|
const i = n.parentElement.parentElement, { grp: l, top: r } = this.createWrapper(s, !0);
|
|
1774
|
-
r.appendChild(
|
|
1762
|
+
r.appendChild(Se(!0)), i.insertAdjacentElement("afterend", l);
|
|
1775
1763
|
const c = this.createChildren([i]);
|
|
1776
1764
|
r.insertAdjacentElement("afterend", c), this.linkDiv(), t || this.editTopic(r.firstChild), this.selectNode(r.firstChild, !0), this.bus.fire("operation", {
|
|
1777
1765
|
name: "insertParent",
|
|
1778
1766
|
obj: s
|
|
1779
1767
|
});
|
|
1780
|
-
},
|
|
1768
|
+
}, fn = function(e, t) {
|
|
1781
1769
|
const n = e || this.currentNode;
|
|
1782
|
-
if (!n)
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
if (!o)
|
|
1786
|
-
return;
|
|
1770
|
+
if (!n) return;
|
|
1771
|
+
const o = Ne(this, n, t);
|
|
1772
|
+
if (!o) return;
|
|
1787
1773
|
const { newTop: s, newNodeObj: i } = o;
|
|
1788
1774
|
this.bus.fire("operation", {
|
|
1789
1775
|
name: "addChild",
|
|
1790
1776
|
obj: i
|
|
1791
1777
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1792
|
-
},
|
|
1793
|
-
const n =
|
|
1794
|
-
|
|
1795
|
-
const o =
|
|
1796
|
-
if (!o)
|
|
1797
|
-
return;
|
|
1778
|
+
}, un = function(e, t) {
|
|
1779
|
+
const n = xe(e.nodeObj);
|
|
1780
|
+
we(n);
|
|
1781
|
+
const o = Ne(this, t, n);
|
|
1782
|
+
if (!o) return;
|
|
1798
1783
|
const { newNodeObj: s } = o;
|
|
1799
1784
|
this.selectNode(this.findEle(s.id)), this.bus.fire("operation", {
|
|
1800
1785
|
name: "copyNode",
|
|
1801
1786
|
obj: s
|
|
1802
1787
|
});
|
|
1803
|
-
},
|
|
1804
|
-
e =
|
|
1788
|
+
}, pn = function(e, t) {
|
|
1789
|
+
e = ce(e);
|
|
1805
1790
|
const n = [];
|
|
1806
1791
|
for (let o = 0; o < e.length; o++) {
|
|
1807
|
-
const s = e[o], i =
|
|
1808
|
-
|
|
1809
|
-
const l =
|
|
1810
|
-
if (!l)
|
|
1811
|
-
return;
|
|
1792
|
+
const s = e[o], i = xe(s.nodeObj);
|
|
1793
|
+
we(i);
|
|
1794
|
+
const l = Ne(this, t, i);
|
|
1795
|
+
if (!l) return;
|
|
1812
1796
|
const { newNodeObj: r } = l;
|
|
1813
1797
|
n.push(r);
|
|
1814
1798
|
}
|
|
@@ -1816,64 +1800,61 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1816
1800
|
name: "copyNodes",
|
|
1817
1801
|
objs: n
|
|
1818
1802
|
});
|
|
1819
|
-
},
|
|
1803
|
+
}, gn = function(e) {
|
|
1820
1804
|
const t = e || this.currentNode;
|
|
1821
|
-
if (!t)
|
|
1822
|
-
return;
|
|
1805
|
+
if (!t) return;
|
|
1823
1806
|
const n = t.nodeObj;
|
|
1824
|
-
|
|
1807
|
+
nn(n);
|
|
1825
1808
|
const o = t.parentNode.parentNode;
|
|
1826
1809
|
o.parentNode.insertBefore(o, o.previousSibling), this.linkDiv(), this.bus.fire("operation", {
|
|
1827
1810
|
name: "moveUpNode",
|
|
1828
1811
|
obj: n
|
|
1829
1812
|
});
|
|
1830
|
-
},
|
|
1813
|
+
}, mn = function(e) {
|
|
1831
1814
|
const t = e || this.currentNode;
|
|
1832
|
-
if (!t)
|
|
1833
|
-
return;
|
|
1815
|
+
if (!t) return;
|
|
1834
1816
|
const n = t.nodeObj;
|
|
1835
|
-
|
|
1817
|
+
on(n);
|
|
1836
1818
|
const o = t.parentNode.parentNode;
|
|
1837
1819
|
o.nextSibling ? o.nextSibling.insertAdjacentElement("afterend", o) : o.parentNode.prepend(o), this.linkDiv(), this.bus.fire("operation", {
|
|
1838
1820
|
name: "moveDownNode",
|
|
1839
1821
|
obj: n
|
|
1840
1822
|
});
|
|
1841
|
-
},
|
|
1842
|
-
if (e.length === 0)
|
|
1843
|
-
|
|
1844
|
-
e = de(e);
|
|
1823
|
+
}, yn = function(e) {
|
|
1824
|
+
if (e.length === 0) return;
|
|
1825
|
+
e = ce(e);
|
|
1845
1826
|
for (const n of e) {
|
|
1846
|
-
const o = n.nodeObj, s =
|
|
1847
|
-
|
|
1827
|
+
const o = n.nodeObj, s = tt(o);
|
|
1828
|
+
cn(n, s);
|
|
1848
1829
|
}
|
|
1849
1830
|
const t = e[e.length - 1];
|
|
1850
1831
|
this.selectNode(this.findEle(t.nodeObj.parent.id)), this.linkDiv(), this.bus.fire("operation", {
|
|
1851
1832
|
name: "removeNodes",
|
|
1852
1833
|
objs: e.map((n) => n.nodeObj)
|
|
1853
1834
|
});
|
|
1854
|
-
},
|
|
1855
|
-
e =
|
|
1835
|
+
}, vn = function(e, t) {
|
|
1836
|
+
e = ce(e);
|
|
1856
1837
|
const n = t.nodeObj;
|
|
1857
1838
|
n.expanded === !1 && (this.expandNode(t, !0), t = this.findEle(n.id));
|
|
1858
1839
|
for (const o of e) {
|
|
1859
1840
|
const s = o.nodeObj;
|
|
1860
|
-
|
|
1841
|
+
nt("in", s, n), R(this.nodeData);
|
|
1861
1842
|
const i = o.parentElement;
|
|
1862
|
-
|
|
1843
|
+
ot(this, t, i.parentElement);
|
|
1863
1844
|
}
|
|
1864
1845
|
this.linkDiv(), this.bus.fire("operation", {
|
|
1865
1846
|
name: "moveNodeIn",
|
|
1866
1847
|
objs: e.map((o) => o.nodeObj),
|
|
1867
1848
|
toObj: n
|
|
1868
1849
|
});
|
|
1869
|
-
},
|
|
1870
|
-
e =
|
|
1850
|
+
}, it = (e, t, n, o) => {
|
|
1851
|
+
e = ce(e), t === "after" && (e = e.reverse());
|
|
1871
1852
|
const s = n.nodeObj, i = [];
|
|
1872
1853
|
for (const l of e) {
|
|
1873
1854
|
const r = l.nodeObj;
|
|
1874
|
-
|
|
1855
|
+
nt(t, r, s), R(o.nodeData), U(l);
|
|
1875
1856
|
const c = l.parentElement.parentNode;
|
|
1876
|
-
i.includes(c.parentElement) || i.push(c.parentElement), n.parentElement.parentNode.insertAdjacentElement(
|
|
1857
|
+
i.includes(c.parentElement) || i.push(c.parentElement), n.parentElement.parentNode.insertAdjacentElement(st[t], c);
|
|
1877
1858
|
}
|
|
1878
1859
|
for (const l of i)
|
|
1879
1860
|
l.childElementCount === 0 && l.tagName !== "ME-MAIN" && (l.previousSibling.children[1].remove(), l.remove());
|
|
@@ -1882,34 +1863,34 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1882
1863
|
objs: e.map((l) => l.nodeObj),
|
|
1883
1864
|
toObj: s
|
|
1884
1865
|
});
|
|
1885
|
-
},
|
|
1886
|
-
|
|
1887
|
-
},
|
|
1888
|
-
|
|
1889
|
-
},
|
|
1866
|
+
}, bn = function(e, t) {
|
|
1867
|
+
it(e, "before", t, this);
|
|
1868
|
+
}, wn = function(e, t) {
|
|
1869
|
+
it(e, "after", t, this);
|
|
1870
|
+
}, xn = function(e) {
|
|
1890
1871
|
const t = e || this.currentNode;
|
|
1891
1872
|
t && (t.nodeObj.dangerouslySetInnerHTML || this.editTopic(t));
|
|
1892
|
-
},
|
|
1873
|
+
}, En = function(e, t) {
|
|
1893
1874
|
e.text.textContent = t, e.nodeObj.topic = t, this.linkDiv();
|
|
1894
|
-
},
|
|
1875
|
+
}, rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1895
1876
|
__proto__: null,
|
|
1896
|
-
addChild:
|
|
1897
|
-
beginEdit:
|
|
1898
|
-
copyNode:
|
|
1899
|
-
copyNodes:
|
|
1900
|
-
insertParent:
|
|
1901
|
-
insertSibling:
|
|
1902
|
-
moveDownNode:
|
|
1903
|
-
moveNodeAfter:
|
|
1904
|
-
moveNodeBefore:
|
|
1905
|
-
moveNodeIn:
|
|
1906
|
-
moveUpNode:
|
|
1907
|
-
removeNodes:
|
|
1908
|
-
reshapeNode:
|
|
1909
|
-
rmSubline:
|
|
1910
|
-
setNodeTopic:
|
|
1877
|
+
addChild: fn,
|
|
1878
|
+
beginEdit: xn,
|
|
1879
|
+
copyNode: un,
|
|
1880
|
+
copyNodes: pn,
|
|
1881
|
+
insertParent: hn,
|
|
1882
|
+
insertSibling: dn,
|
|
1883
|
+
moveDownNode: mn,
|
|
1884
|
+
moveNodeAfter: wn,
|
|
1885
|
+
moveNodeBefore: bn,
|
|
1886
|
+
moveNodeIn: vn,
|
|
1887
|
+
moveUpNode: gn,
|
|
1888
|
+
removeNodes: yn,
|
|
1889
|
+
reshapeNode: an,
|
|
1890
|
+
rmSubline: U,
|
|
1891
|
+
setNodeTopic: En
|
|
1911
1892
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1912
|
-
function
|
|
1893
|
+
function Cn(e) {
|
|
1913
1894
|
return {
|
|
1914
1895
|
nodeData: e.isFocusMode ? e.nodeDataBackup : e.nodeData,
|
|
1915
1896
|
arrows: e.arrows,
|
|
@@ -1918,75 +1899,74 @@ function Tn(e) {
|
|
|
1918
1899
|
theme: e.theme
|
|
1919
1900
|
};
|
|
1920
1901
|
}
|
|
1921
|
-
const
|
|
1902
|
+
const Sn = function(e) {
|
|
1922
1903
|
const t = this.container, n = e.getBoundingClientRect(), o = t.getBoundingClientRect();
|
|
1923
1904
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
1924
|
-
const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2,
|
|
1925
|
-
this.move(-
|
|
1905
|
+
const i = n.left + n.width / 2, l = n.top + n.height / 2, r = o.left + o.width / 2, c = o.top + o.height / 2, a = i - r, f = l - c;
|
|
1906
|
+
this.move(-a, -f, !0);
|
|
1926
1907
|
}
|
|
1927
|
-
},
|
|
1908
|
+
}, Nn = function(e, t, n) {
|
|
1928
1909
|
this.clearSelection(), this.scrollIntoView(e), this.selection.select(e), t && this.bus.fire("selectNewNode", e.nodeObj);
|
|
1929
|
-
},
|
|
1910
|
+
}, kn = function(e) {
|
|
1930
1911
|
this.selection.select(e);
|
|
1931
|
-
},
|
|
1912
|
+
}, _n = function(e) {
|
|
1932
1913
|
this.selection.deselect(e);
|
|
1933
|
-
},
|
|
1914
|
+
}, Tn = function() {
|
|
1934
1915
|
this.unselectNodes(this.currentNodes), this.unselectSummary(), this.unselectArrow();
|
|
1935
|
-
},
|
|
1936
|
-
const e =
|
|
1916
|
+
}, Ln = function() {
|
|
1917
|
+
const e = Cn(this);
|
|
1937
1918
|
return JSON.stringify(e, (t, n) => {
|
|
1938
1919
|
if (!(t === "parent" && typeof n != "string"))
|
|
1939
1920
|
return n;
|
|
1940
1921
|
});
|
|
1941
|
-
},
|
|
1922
|
+
}, An = function() {
|
|
1942
1923
|
return JSON.parse(this.getDataString());
|
|
1943
|
-
},
|
|
1924
|
+
}, Mn = function() {
|
|
1944
1925
|
this.editable = !0;
|
|
1945
|
-
},
|
|
1926
|
+
}, Dn = function() {
|
|
1946
1927
|
this.editable = !1;
|
|
1947
|
-
},
|
|
1948
|
-
if (e < this.scaleMin || e > this.scaleMax)
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
}, Rn = function() {
|
|
1928
|
+
}, Pn = function(e, t = { x: 0, y: 0 }) {
|
|
1929
|
+
if (e < this.scaleMin || e > this.scaleMax) return;
|
|
1930
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = lt(this), r = this.map.style.transform, { x: c, y: a } = Ve(r), f = c - i, u = a - l, g = this.scaleVal, y = (-o + f) * (1 - e / g), m = (-s + u) * (1 - e / g);
|
|
1931
|
+
this.map.style.transform = `translate(${c - y}px, ${a - m}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1932
|
+
}, $n = function() {
|
|
1953
1933
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1954
1934
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
1955
|
-
},
|
|
1935
|
+
}, On = function(e, t, n = !1) {
|
|
1956
1936
|
const { map: o, scaleVal: s, bus: i } = this, l = o.style.transform;
|
|
1957
|
-
let { x: r, y: c } =
|
|
1937
|
+
let { x: r, y: c } = Ve(l);
|
|
1958
1938
|
r += e, c += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
1959
1939
|
o.style.transition = "none";
|
|
1960
1940
|
}, 300)), o.style.transform = `translate(${r}px, ${c}px) scale(${s})`, i.fire("move", { dx: e, dy: t });
|
|
1961
|
-
},
|
|
1941
|
+
}, lt = (e) => {
|
|
1962
1942
|
const { container: t, map: n, nodes: o } = e, s = n.querySelector("me-root"), i = s.offsetTop, l = s.offsetLeft, r = s.offsetWidth, c = s.offsetHeight;
|
|
1963
|
-
let
|
|
1964
|
-
return e.alignment === "root" ? (
|
|
1965
|
-
},
|
|
1966
|
-
const { map: e } = this, { dx: t, dy: n } =
|
|
1943
|
+
let a, f;
|
|
1944
|
+
return e.alignment === "root" ? (a = t.offsetWidth / 2 - l - r / 2, f = t.offsetHeight / 2 - i - c / 2, n.style.transformOrigin = `${l + r / 2}px 50%`) : (a = (t.offsetWidth - o.offsetWidth) / 2, f = (t.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: a, dy: f };
|
|
1945
|
+
}, jn = function() {
|
|
1946
|
+
const { map: e } = this, { dx: t, dy: n } = lt(this);
|
|
1967
1947
|
e.style.transform = `translate(${t}px, ${n}px) scale(${this.scaleVal})`;
|
|
1968
|
-
},
|
|
1948
|
+
}, Hn = function(e) {
|
|
1969
1949
|
e(this);
|
|
1970
|
-
},
|
|
1950
|
+
}, Bn = function(e) {
|
|
1971
1951
|
e.nodeObj.parent && (this.clearSelection(), this.tempDirection === null && (this.tempDirection = this.direction), this.isFocusMode || (this.nodeDataBackup = this.nodeData, this.isFocusMode = !0), this.nodeData = e.nodeObj, this.initRight(), this.toCenter());
|
|
1972
|
-
},
|
|
1952
|
+
}, Rn = function() {
|
|
1973
1953
|
this.isFocusMode = !1, this.tempDirection !== null && (this.nodeData = this.nodeDataBackup, this.direction = this.tempDirection, this.tempDirection = null, this.refresh(), this.toCenter());
|
|
1974
|
-
},
|
|
1975
|
-
this.direction = 0, this.refresh(), this.toCenter();
|
|
1976
|
-
},
|
|
1977
|
-
this.direction = 1, this.refresh(), this.toCenter();
|
|
1978
|
-
},
|
|
1979
|
-
this.direction = 2, this.refresh(), this.toCenter();
|
|
1980
|
-
},
|
|
1954
|
+
}, In = function() {
|
|
1955
|
+
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1956
|
+
}, Fn = function() {
|
|
1957
|
+
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1958
|
+
}, Wn = function() {
|
|
1959
|
+
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
1960
|
+
}, Kn = function(e) {
|
|
1981
1961
|
this.locale = e, this.refresh();
|
|
1982
|
-
},
|
|
1962
|
+
}, Gn = function(e, t) {
|
|
1983
1963
|
const n = e.nodeObj;
|
|
1984
1964
|
typeof t == "boolean" ? n.expanded = t : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
1985
1965
|
const o = e.getBoundingClientRect(), s = {
|
|
1986
1966
|
x: o.left,
|
|
1987
1967
|
y: o.top
|
|
1988
1968
|
}, i = e.parentNode, l = i.children[1];
|
|
1989
|
-
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "",
|
|
1969
|
+
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", U(e), n.expanded) {
|
|
1990
1970
|
const u = this.createChildren(
|
|
1991
1971
|
n.children.map((g) => this.createWrapper(g).grp)
|
|
1992
1972
|
);
|
|
@@ -1997,47 +1977,47 @@ const Ln = function(e) {
|
|
|
1997
1977
|
const r = e.getBoundingClientRect(), c = {
|
|
1998
1978
|
x: r.left,
|
|
1999
1979
|
y: r.top
|
|
2000
|
-
},
|
|
2001
|
-
this.move(
|
|
2002
|
-
},
|
|
1980
|
+
}, a = s.x - c.x, f = s.y - c.y;
|
|
1981
|
+
this.move(a, f), this.bus.fire("expandNode", n);
|
|
1982
|
+
}, Yn = function(e, t) {
|
|
2003
1983
|
const n = e.nodeObj, o = e.getBoundingClientRect(), s = {
|
|
2004
1984
|
x: o.left,
|
|
2005
1985
|
y: o.top
|
|
2006
1986
|
};
|
|
2007
|
-
|
|
1987
|
+
q(n, t ?? !n.expanded), this.refresh();
|
|
2008
1988
|
const i = this.findEle(n.id).getBoundingClientRect(), l = {
|
|
2009
1989
|
x: i.left,
|
|
2010
1990
|
y: i.top
|
|
2011
1991
|
}, r = s.x - l.x, c = s.y - l.y;
|
|
2012
1992
|
this.move(r, c);
|
|
2013
|
-
},
|
|
2014
|
-
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)),
|
|
2015
|
-
},
|
|
1993
|
+
}, qn = function(e) {
|
|
1994
|
+
this.clearSelection(), e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || [], e.theme && this.changeTheme(e.theme)), R(this.nodeData), this.layout(), this.linkDiv();
|
|
1995
|
+
}, zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2016
1996
|
__proto__: null,
|
|
2017
|
-
cancelFocus:
|
|
2018
|
-
clearSelection:
|
|
2019
|
-
disableEdit:
|
|
2020
|
-
enableEdit:
|
|
2021
|
-
expandNode:
|
|
2022
|
-
expandNodeAll:
|
|
2023
|
-
focusNode:
|
|
2024
|
-
getData:
|
|
2025
|
-
getDataString:
|
|
2026
|
-
initLeft:
|
|
2027
|
-
initRight:
|
|
2028
|
-
initSide:
|
|
2029
|
-
install:
|
|
2030
|
-
move:
|
|
2031
|
-
refresh:
|
|
2032
|
-
scale:
|
|
2033
|
-
scaleFit:
|
|
2034
|
-
scrollIntoView:
|
|
2035
|
-
selectNode:
|
|
2036
|
-
selectNodes:
|
|
2037
|
-
setLocale:
|
|
2038
|
-
toCenter:
|
|
2039
|
-
unselectNodes:
|
|
2040
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1997
|
+
cancelFocus: Rn,
|
|
1998
|
+
clearSelection: Tn,
|
|
1999
|
+
disableEdit: Dn,
|
|
2000
|
+
enableEdit: Mn,
|
|
2001
|
+
expandNode: Gn,
|
|
2002
|
+
expandNodeAll: Yn,
|
|
2003
|
+
focusNode: Bn,
|
|
2004
|
+
getData: An,
|
|
2005
|
+
getDataString: Ln,
|
|
2006
|
+
initLeft: In,
|
|
2007
|
+
initRight: Fn,
|
|
2008
|
+
initSide: Wn,
|
|
2009
|
+
install: Hn,
|
|
2010
|
+
move: On,
|
|
2011
|
+
refresh: qn,
|
|
2012
|
+
scale: Pn,
|
|
2013
|
+
scaleFit: $n,
|
|
2014
|
+
scrollIntoView: Sn,
|
|
2015
|
+
selectNode: Nn,
|
|
2016
|
+
selectNodes: kn,
|
|
2017
|
+
setLocale: Kn,
|
|
2018
|
+
toCenter: jn,
|
|
2019
|
+
unselectNodes: _n
|
|
2020
|
+
}, Symbol.toStringTag, { value: "Module" })), Vn = function(e) {
|
|
2041
2021
|
return {
|
|
2042
2022
|
dom: e,
|
|
2043
2023
|
moved: !1,
|
|
@@ -2060,7 +2040,7 @@ const Ln = function(e) {
|
|
|
2060
2040
|
},
|
|
2061
2041
|
cb: null,
|
|
2062
2042
|
init(t, n) {
|
|
2063
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
2043
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = Ee([
|
|
2064
2044
|
{ dom: t, evt: "pointermove", func: this.handlePointerMove },
|
|
2065
2045
|
{ dom: t, evt: "pointerleave", func: this.handleClear },
|
|
2066
2046
|
{ dom: t, evt: "pointerup", func: this.handleClear },
|
|
@@ -2072,19 +2052,19 @@ const Ln = function(e) {
|
|
|
2072
2052
|
this.moved = !1, this.pointerdown = !1;
|
|
2073
2053
|
}
|
|
2074
2054
|
};
|
|
2075
|
-
},
|
|
2076
|
-
create:
|
|
2077
|
-
},
|
|
2078
|
-
function
|
|
2055
|
+
}, Ge = {
|
|
2056
|
+
create: Vn
|
|
2057
|
+
}, Xn = "#4dc4ff";
|
|
2058
|
+
function ct(e, t, n, o, s, i, l, r) {
|
|
2079
2059
|
return {
|
|
2080
2060
|
x: e / 8 + n * 3 / 8 + s * 3 / 8 + l / 8,
|
|
2081
2061
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + r / 8
|
|
2082
2062
|
};
|
|
2083
2063
|
}
|
|
2084
|
-
function
|
|
2085
|
-
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(),
|
|
2064
|
+
function Un(e, t, n) {
|
|
2065
|
+
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), ae(e));
|
|
2086
2066
|
}
|
|
2087
|
-
function
|
|
2067
|
+
function ee(e, t, n, o, s) {
|
|
2088
2068
|
k(e, {
|
|
2089
2069
|
x1: t + "",
|
|
2090
2070
|
y1: n + "",
|
|
@@ -2092,52 +2072,51 @@ function ne(e, t, n, o, s) {
|
|
|
2092
2072
|
y2: s + ""
|
|
2093
2073
|
});
|
|
2094
2074
|
}
|
|
2095
|
-
function
|
|
2096
|
-
var m;
|
|
2075
|
+
function Ye(e, t, n, o, s, i, l, r, c, a) {
|
|
2097
2076
|
const f = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${r} ${c}`;
|
|
2098
|
-
if (e.line.setAttribute("d", f),
|
|
2099
|
-
const
|
|
2100
|
-
|
|
2077
|
+
if (e.line.setAttribute("d", f), a.style) {
|
|
2078
|
+
const p = a.style;
|
|
2079
|
+
p.stroke && e.line.setAttribute("stroke", p.stroke), p.strokeWidth && e.line.setAttribute("stroke-width", String(p.strokeWidth)), p.strokeDasharray && e.line.setAttribute("stroke-dasharray", p.strokeDasharray), p.strokeLinecap && e.line.setAttribute("stroke-linecap", p.strokeLinecap), p.opacity !== void 0 && e.line.setAttribute("opacity", String(p.opacity));
|
|
2101
2080
|
}
|
|
2102
2081
|
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2103
2082
|
u.length > 0 && u[0].setAttribute("d", f);
|
|
2104
|
-
const g =
|
|
2083
|
+
const g = se(i, l, r, c);
|
|
2105
2084
|
if (g) {
|
|
2106
|
-
const
|
|
2107
|
-
if (e.arrow1.setAttribute("d",
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2085
|
+
const p = `M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;
|
|
2086
|
+
if (e.arrow1.setAttribute("d", p), u.length > 1 && u[1].setAttribute("d", p), a.style) {
|
|
2087
|
+
const d = a.style;
|
|
2088
|
+
d.stroke && e.arrow1.setAttribute("stroke", d.stroke), d.strokeWidth && e.arrow1.setAttribute("stroke-width", String(d.strokeWidth)), d.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", d.strokeLinecap), d.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(d.opacity));
|
|
2110
2089
|
}
|
|
2111
2090
|
}
|
|
2112
|
-
if (
|
|
2113
|
-
const
|
|
2114
|
-
if (
|
|
2115
|
-
const
|
|
2116
|
-
if (e.arrow2.setAttribute("d",
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2091
|
+
if (a.bidirectional) {
|
|
2092
|
+
const p = se(o, s, t, n);
|
|
2093
|
+
if (p) {
|
|
2094
|
+
const d = `M ${p.x1} ${p.y1} L ${t} ${n} L ${p.x2} ${p.y2}`;
|
|
2095
|
+
if (e.arrow2.setAttribute("d", d), u.length > 2 && u[2].setAttribute("d", d), a.style) {
|
|
2096
|
+
const h = a.style;
|
|
2097
|
+
h.stroke && e.arrow2.setAttribute("stroke", h.stroke), h.strokeWidth && e.arrow2.setAttribute("stroke-width", String(h.strokeWidth)), h.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", h.strokeLinecap), h.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(h.opacity));
|
|
2119
2098
|
}
|
|
2120
2099
|
}
|
|
2121
2100
|
}
|
|
2122
|
-
const { x: y, y:
|
|
2123
|
-
if (e.labelEl &&
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2101
|
+
const { x: y, y: m } = ct(t, n, o, s, i, l, r, c);
|
|
2102
|
+
if (e.labelEl && Un(e.labelEl, y, m), a.style?.labelColor) {
|
|
2103
|
+
const p = e.labelEl;
|
|
2104
|
+
p && (p.style.color = a.style.labelColor);
|
|
2126
2105
|
}
|
|
2127
|
-
|
|
2106
|
+
so(e);
|
|
2128
2107
|
}
|
|
2129
|
-
function
|
|
2130
|
-
const { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2,
|
|
2108
|
+
function le(e, t, n) {
|
|
2109
|
+
const { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, r = o + i / 2, c = s + l / 2, a = r + n.x, f = c + n.y;
|
|
2131
2110
|
return {
|
|
2132
2111
|
w: i,
|
|
2133
2112
|
h: l,
|
|
2134
2113
|
cx: r,
|
|
2135
2114
|
cy: c,
|
|
2136
|
-
ctrlX:
|
|
2115
|
+
ctrlX: a,
|
|
2137
2116
|
ctrlY: f
|
|
2138
2117
|
};
|
|
2139
2118
|
}
|
|
2140
|
-
function
|
|
2119
|
+
function Y(e) {
|
|
2141
2120
|
let t, n;
|
|
2142
2121
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2143
2122
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2145,33 +2124,30 @@ function G(e) {
|
|
|
2145
2124
|
y: n
|
|
2146
2125
|
};
|
|
2147
2126
|
}
|
|
2148
|
-
const
|
|
2149
|
-
var E;
|
|
2127
|
+
const ke = function(e, t, n, o, s) {
|
|
2150
2128
|
if (!t || !n)
|
|
2151
2129
|
return;
|
|
2152
|
-
const i =
|
|
2153
|
-
if (!
|
|
2154
|
-
|
|
2155
|
-
const a = `M ${m.x1} ${m.y1} L ${y} ${p} L ${m.x2} ${m.y2}`;
|
|
2130
|
+
const i = le(e, t, o.delta1), l = le(e, n, o.delta2), { x: r, y: c } = Y(i), { ctrlX: a, ctrlY: f } = i, { ctrlX: u, ctrlY: g } = l, { x: y, y: m } = Y(l), p = se(u, g, y, m);
|
|
2131
|
+
if (!p) return;
|
|
2132
|
+
const d = `M ${p.x1} ${p.y1} L ${y} ${m} L ${p.x2} ${p.y2}`;
|
|
2156
2133
|
let h = "";
|
|
2157
2134
|
if (o.bidirectional) {
|
|
2158
|
-
const
|
|
2159
|
-
if (!
|
|
2160
|
-
|
|
2161
|
-
h = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
|
|
2135
|
+
const C = se(a, f, r, c);
|
|
2136
|
+
if (!C) return;
|
|
2137
|
+
h = `M ${C.x1} ${C.y1} L ${r} ${c} L ${C.x2} ${C.y2}`;
|
|
2162
2138
|
}
|
|
2163
|
-
const v =
|
|
2164
|
-
v.id =
|
|
2165
|
-
const
|
|
2139
|
+
const v = Tt(`M ${r} ${c} C ${a} ${f} ${u} ${g} ${y} ${m}`, d, h, o.style), { x, y: b } = ct(r, c, a, f, u, g, y, m), S = o.style?.labelColor || "rgb(235, 95, 82)", w = "arrow-" + o.id;
|
|
2140
|
+
v.id = w;
|
|
2141
|
+
const E = pe(o.label, x, b, {
|
|
2166
2142
|
anchor: "middle",
|
|
2167
2143
|
color: S,
|
|
2168
2144
|
dataType: "arrow",
|
|
2169
|
-
svgId:
|
|
2145
|
+
svgId: w
|
|
2170
2146
|
});
|
|
2171
|
-
v.labelEl =
|
|
2172
|
-
},
|
|
2147
|
+
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, e.labelContainer.appendChild(E), e.linkSvgGroup.appendChild(v), ae(E), s || (e.arrows.push(o), e.currentArrow = v, at(e, o, i, l));
|
|
2148
|
+
}, Jn = function(e, t, n = {}) {
|
|
2173
2149
|
const o = {
|
|
2174
|
-
id:
|
|
2150
|
+
id: W(),
|
|
2175
2151
|
label: "Custom Link",
|
|
2176
2152
|
from: e.nodeObj.id,
|
|
2177
2153
|
to: t.nodeObj.id,
|
|
@@ -2185,22 +2161,21 @@ const Te = function(e, t, n, o, s) {
|
|
|
2185
2161
|
},
|
|
2186
2162
|
...n
|
|
2187
2163
|
};
|
|
2188
|
-
|
|
2164
|
+
ke(this, e, t, o), this.bus.fire("operation", {
|
|
2189
2165
|
name: "createArrow",
|
|
2190
2166
|
obj: o
|
|
2191
2167
|
});
|
|
2192
|
-
},
|
|
2193
|
-
|
|
2194
|
-
const t = { ...e, id:
|
|
2195
|
-
|
|
2168
|
+
}, Zn = function(e) {
|
|
2169
|
+
de(this);
|
|
2170
|
+
const t = { ...e, id: W() };
|
|
2171
|
+
ke(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2196
2172
|
name: "createArrow",
|
|
2197
2173
|
obj: t
|
|
2198
2174
|
});
|
|
2199
|
-
},
|
|
2175
|
+
}, Qn = function(e) {
|
|
2200
2176
|
let t;
|
|
2201
|
-
if (e ? t = e : t = this.currentArrow, !t)
|
|
2202
|
-
|
|
2203
|
-
ue(this);
|
|
2177
|
+
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2178
|
+
de(this);
|
|
2204
2179
|
const n = t.arrowObj.id;
|
|
2205
2180
|
this.arrows = this.arrows.filter((o) => o.id !== n), t.remove(), this.bus.fire("operation", {
|
|
2206
2181
|
name: "removeArrow",
|
|
@@ -2208,14 +2183,14 @@ const Te = function(e, t, n, o, s) {
|
|
|
2208
2183
|
id: n
|
|
2209
2184
|
}
|
|
2210
2185
|
});
|
|
2211
|
-
},
|
|
2186
|
+
}, eo = function(e) {
|
|
2212
2187
|
this.currentArrow = e;
|
|
2213
|
-
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s =
|
|
2214
|
-
|
|
2215
|
-
},
|
|
2216
|
-
|
|
2217
|
-
},
|
|
2218
|
-
const n = document.createElementNS(
|
|
2188
|
+
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = le(this, n, t.delta1), i = le(this, o, t.delta2);
|
|
2189
|
+
at(this, t, s, i);
|
|
2190
|
+
}, to = function() {
|
|
2191
|
+
de(this), this.currentArrow = null;
|
|
2192
|
+
}, he = function(e, t) {
|
|
2193
|
+
const n = document.createElementNS(D, "path");
|
|
2219
2194
|
return k(n, {
|
|
2220
2195
|
d: e,
|
|
2221
2196
|
stroke: t,
|
|
@@ -2224,120 +2199,111 @@ const Te = function(e, t, n, o, s) {
|
|
|
2224
2199
|
"stroke-linecap": "round",
|
|
2225
2200
|
"stroke-linejoin": "round"
|
|
2226
2201
|
}), n;
|
|
2227
|
-
},
|
|
2228
|
-
const n = document.createElementNS(
|
|
2202
|
+
}, no = function(e, t) {
|
|
2203
|
+
const n = document.createElementNS(D, "g");
|
|
2229
2204
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2230
|
-
const o =
|
|
2205
|
+
const o = he(e.line.getAttribute("d"), t);
|
|
2231
2206
|
n.appendChild(o);
|
|
2232
|
-
const s =
|
|
2207
|
+
const s = he(e.arrow1.getAttribute("d"), t);
|
|
2233
2208
|
if (n.appendChild(s), e.arrow2.getAttribute("d")) {
|
|
2234
|
-
const i =
|
|
2209
|
+
const i = he(e.arrow2.getAttribute("d"), t);
|
|
2235
2210
|
n.appendChild(i);
|
|
2236
2211
|
}
|
|
2237
2212
|
e.insertBefore(n, e.firstChild);
|
|
2238
|
-
},
|
|
2213
|
+
}, oo = function(e) {
|
|
2239
2214
|
const t = e.querySelector(".arrow-highlight");
|
|
2240
2215
|
t && t.remove();
|
|
2241
|
-
},
|
|
2216
|
+
}, so = function(e) {
|
|
2242
2217
|
const t = e.querySelector(".arrow-highlight");
|
|
2243
|
-
if (!t)
|
|
2244
|
-
return;
|
|
2218
|
+
if (!t) return;
|
|
2245
2219
|
const n = t.querySelectorAll("path");
|
|
2246
2220
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2247
|
-
},
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
const x = G({ ...o, ctrlX: h, ctrlY: v });
|
|
2263
|
-
w = x.x, C = x.y, l.style.top = v + "px", l.style.left = h + "px", ze(u, y, p, m, a, h, v, w, C, t), ne(c, h, v, w, C), t.delta2.x = h - o.cx, t.delta2.y = v - o.cy, g.fire("updateArrowDelta", t);
|
|
2221
|
+
}, de = function(e) {
|
|
2222
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && oo(e.currentArrow);
|
|
2223
|
+
}, at = function(e, t, n, o) {
|
|
2224
|
+
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: a, map: f, currentArrow: u, bus: g } = e;
|
|
2225
|
+
if (!u) return;
|
|
2226
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), no(u, Xn);
|
|
2227
|
+
let { x: y, y: m } = Y(n), { ctrlX: p, ctrlY: d } = n, { ctrlX: h, ctrlY: v } = o, { x, y: b } = Y(o);
|
|
2228
|
+
i.style.cssText = `top:${d}px;left:${p}px;`, l.style.cssText = `top:${v}px;left:${h}px;`, ee(r, y, m, p, d), ee(c, h, v, x, b), e.helper1 = Ge.create(i), e.helper2 = Ge.create(l), e.helper1.init(f, (S, w) => {
|
|
2229
|
+
p = p + S / e.scaleVal, d = d + w / e.scaleVal;
|
|
2230
|
+
const E = Y({ ...n, ctrlX: p, ctrlY: d });
|
|
2231
|
+
y = E.x, m = E.y, i.style.top = d + "px", i.style.left = p + "px", Ye(u, y, m, p, d, h, v, x, b, t), ee(r, y, m, p, d), t.delta1.x = p - n.cx, t.delta1.y = d - n.cy, g.fire("updateArrowDelta", t);
|
|
2232
|
+
}), e.helper2.init(f, (S, w) => {
|
|
2233
|
+
h = h + S / e.scaleVal, v = v + w / e.scaleVal;
|
|
2234
|
+
const E = Y({ ...o, ctrlX: h, ctrlY: v });
|
|
2235
|
+
x = E.x, b = E.y, l.style.top = v + "px", l.style.left = h + "px", Ye(u, y, m, p, d, h, v, x, b, t), ee(c, h, v, x, b), t.delta2.x = h - o.cx, t.delta2.y = v - o.cy, g.fire("updateArrowDelta", t);
|
|
2264
2236
|
});
|
|
2265
2237
|
};
|
|
2266
|
-
function
|
|
2238
|
+
function io() {
|
|
2267
2239
|
this.linkSvgGroup.innerHTML = "";
|
|
2268
2240
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
2269
2241
|
const t = this.arrows[e];
|
|
2270
2242
|
try {
|
|
2271
|
-
|
|
2243
|
+
ke(this, this.findEle(t.from), this.findEle(t.to), t, !0);
|
|
2272
2244
|
} catch {
|
|
2273
2245
|
}
|
|
2274
2246
|
}
|
|
2275
2247
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
2276
2248
|
}
|
|
2277
|
-
function
|
|
2278
|
-
|
|
2249
|
+
function ro(e) {
|
|
2250
|
+
de(this), e && e.labelEl && Ze(this, e.labelEl, e.arrowObj);
|
|
2279
2251
|
}
|
|
2280
|
-
function
|
|
2281
|
-
this.arrows = this.arrows.filter((e) =>
|
|
2252
|
+
function lo() {
|
|
2253
|
+
this.arrows = this.arrows.filter((e) => oe(e.from, this.nodeData) && oe(e.to, this.nodeData));
|
|
2282
2254
|
}
|
|
2283
|
-
const
|
|
2255
|
+
const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2284
2256
|
__proto__: null,
|
|
2285
|
-
createArrow:
|
|
2286
|
-
createArrowFrom:
|
|
2287
|
-
editArrowLabel:
|
|
2288
|
-
removeArrow:
|
|
2289
|
-
renderArrow:
|
|
2290
|
-
selectArrow:
|
|
2291
|
-
tidyArrow:
|
|
2292
|
-
unselectArrow:
|
|
2293
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2294
|
-
|
|
2295
|
-
if (e.length === 0)
|
|
2296
|
-
throw new Error("No selected node.");
|
|
2257
|
+
createArrow: Jn,
|
|
2258
|
+
createArrowFrom: Zn,
|
|
2259
|
+
editArrowLabel: ro,
|
|
2260
|
+
removeArrow: Qn,
|
|
2261
|
+
renderArrow: io,
|
|
2262
|
+
selectArrow: eo,
|
|
2263
|
+
tidyArrow: lo,
|
|
2264
|
+
unselectArrow: to
|
|
2265
|
+
}, Symbol.toStringTag, { value: "Module" })), ao = function(e) {
|
|
2266
|
+
if (e.length === 0) throw new Error("No selected node.");
|
|
2297
2267
|
if (e.length === 1) {
|
|
2298
|
-
const
|
|
2299
|
-
if (!
|
|
2300
|
-
|
|
2301
|
-
const g = u.children.findIndex((y) => f === y);
|
|
2268
|
+
const c = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
2269
|
+
if (!a) throw new Error("Can not select root node.");
|
|
2270
|
+
const f = a.children.findIndex((u) => c === u);
|
|
2302
2271
|
return {
|
|
2303
|
-
parent:
|
|
2304
|
-
start:
|
|
2305
|
-
end:
|
|
2272
|
+
parent: a.id,
|
|
2273
|
+
start: f,
|
|
2274
|
+
end: f
|
|
2306
2275
|
};
|
|
2307
2276
|
}
|
|
2308
2277
|
let t = 0;
|
|
2309
|
-
const n = e.map((
|
|
2310
|
-
let
|
|
2311
|
-
const
|
|
2312
|
-
for (;
|
|
2313
|
-
const
|
|
2314
|
-
|
|
2278
|
+
const n = e.map((c) => {
|
|
2279
|
+
let a = c.nodeObj;
|
|
2280
|
+
const f = [];
|
|
2281
|
+
for (; a.parent; ) {
|
|
2282
|
+
const u = a.parent, y = u.children?.indexOf(a);
|
|
2283
|
+
a = u, f.unshift({ node: a, index: y });
|
|
2315
2284
|
}
|
|
2316
|
-
return
|
|
2285
|
+
return f.length > t && (t = f.length), f;
|
|
2317
2286
|
});
|
|
2318
2287
|
let o = 0;
|
|
2319
|
-
e:
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
const s = n.map((f) => f[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
|
|
2329
|
-
if (!r.parent)
|
|
2330
|
-
throw new Error("Please select nodes in the same main topic.");
|
|
2288
|
+
e: for (; o < t; o++) {
|
|
2289
|
+
const c = n[0][o]?.node;
|
|
2290
|
+
for (let a = 1; a < n.length; a++)
|
|
2291
|
+
if (n[a][o]?.node !== c)
|
|
2292
|
+
break e;
|
|
2293
|
+
}
|
|
2294
|
+
if (!o) throw new Error("Can not select root node.");
|
|
2295
|
+
const s = n.map((c) => c[o - 1].index).sort(), i = s[0] || 0, l = s[s.length - 1] || 0, r = n[0][o - 1].node;
|
|
2296
|
+
if (!r.parent) throw new Error("Please select nodes in the same main topic.");
|
|
2331
2297
|
return {
|
|
2332
2298
|
parent: r.id,
|
|
2333
2299
|
start: i,
|
|
2334
2300
|
end: l
|
|
2335
2301
|
};
|
|
2336
|
-
},
|
|
2337
|
-
const t = document.createElementNS(
|
|
2302
|
+
}, ho = function(e) {
|
|
2303
|
+
const t = document.createElementNS(D, "g");
|
|
2338
2304
|
return t.setAttribute("id", e), t;
|
|
2339
|
-
},
|
|
2340
|
-
const n = document.createElementNS(
|
|
2305
|
+
}, qe = function(e, t) {
|
|
2306
|
+
const n = document.createElementNS(D, "path");
|
|
2341
2307
|
return k(n, {
|
|
2342
2308
|
d: e,
|
|
2343
2309
|
stroke: t || "#666",
|
|
@@ -2345,73 +2311,69 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2345
2311
|
"stroke-linecap": "round",
|
|
2346
2312
|
"stroke-width": "2"
|
|
2347
2313
|
}), n;
|
|
2348
|
-
},
|
|
2314
|
+
}, fo = (e) => e.parentElement.parentElement, uo = function(e, { parent: t, start: n }) {
|
|
2349
2315
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2350
2316
|
let i;
|
|
2351
2317
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2352
|
-
},
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
let
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
if (!Ae)
|
|
2318
|
+
}, _e = function(e, t) {
|
|
2319
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: a, summarySvg: f } = e, g = e.findEle(s).nodeObj, y = uo(e, t);
|
|
2320
|
+
let m = 1 / 0, p = 0, d = 0, h = 0;
|
|
2321
|
+
for (let j = i; j <= l; j++) {
|
|
2322
|
+
const Te = g.children?.[j];
|
|
2323
|
+
if (!Te)
|
|
2359
2324
|
return e.removeSummary(n), null;
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2362
|
-
}
|
|
2363
|
-
let v,
|
|
2364
|
-
const
|
|
2365
|
-
y ===
|
|
2366
|
-
const A =
|
|
2367
|
-
return A.appendChild(v), e.labelContainer.appendChild(
|
|
2368
|
-
},
|
|
2369
|
-
if (!this.currentNodes)
|
|
2370
|
-
|
|
2371
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = go(t), r = { id: I(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = Le(this, r);
|
|
2325
|
+
const J = fo(e.findEle(Te.id)), { offsetLeft: Z, offsetTop: Le } = O(c, J), Ae = i === l ? 10 : 20;
|
|
2326
|
+
j === i && (d = Le + Ae), j === l && (h = Le + J.offsetHeight - Ae), Z < m && (m = Z), J.offsetWidth + Z > p && (p = J.offsetWidth + Z);
|
|
2327
|
+
}
|
|
2328
|
+
let v, x;
|
|
2329
|
+
const b = g.parent ? 10 : 0, S = d + b, w = h + b, E = (S + w) / 2, C = r?.stroke || a.cssVar["--color"], N = r?.labelColor || a.cssVar["--color"], L = "s-" + n;
|
|
2330
|
+
y === P.LHS ? (v = qe(`M ${m + 10} ${S} c -5 0 -10 5 -10 10 L ${m} ${w - 10} c 0 5 5 10 10 10 M ${m} ${E} h -10`, C), x = pe(o, m - 20, E, { anchor: "end", color: N, dataType: "summary", svgId: L })) : (v = qe(`M ${p - 10} ${S} c 5 0 10 5 10 10 L ${p} ${w - 10} c 0 5 -5 10 -10 10 M ${p} ${E} h 10`, C), x = pe(o, p + 20, E, { anchor: "start", color: N, dataType: "summary", svgId: L }));
|
|
2331
|
+
const A = ho(L);
|
|
2332
|
+
return A.appendChild(v), e.labelContainer.appendChild(x), ae(x), A.summaryObj = t, A.labelEl = x, f.appendChild(A), A;
|
|
2333
|
+
}, po = function(e = {}) {
|
|
2334
|
+
if (!this.currentNodes) return;
|
|
2335
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = ao(t), r = { id: W(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = _e(this, r);
|
|
2372
2336
|
n.push(r), this.editSummary(c), o.fire("operation", {
|
|
2373
2337
|
name: "createSummary",
|
|
2374
2338
|
obj: r
|
|
2375
2339
|
});
|
|
2376
|
-
},
|
|
2377
|
-
const t =
|
|
2378
|
-
|
|
2340
|
+
}, go = function(e) {
|
|
2341
|
+
const t = W(), n = { ...e, id: t };
|
|
2342
|
+
_e(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2379
2343
|
name: "createSummary",
|
|
2380
2344
|
obj: n
|
|
2381
2345
|
});
|
|
2382
|
-
},
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
t > -1 && (this.summaries.splice(t, 1), (n = this.nodes.querySelector("#s-" + e)) == null || n.remove(), (o = this.nodes.querySelector("#label-s-" + e)) == null || o.remove()), this.bus.fire("operation", {
|
|
2346
|
+
}, mo = function(e) {
|
|
2347
|
+
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2348
|
+
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2386
2349
|
name: "removeSummary",
|
|
2387
2350
|
obj: { id: e }
|
|
2388
2351
|
});
|
|
2389
|
-
},
|
|
2352
|
+
}, yo = function(e) {
|
|
2390
2353
|
const t = e.labelEl;
|
|
2391
2354
|
t && t.classList.add("selected"), this.currentSummary = e;
|
|
2392
|
-
},
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}, So = function() {
|
|
2355
|
+
}, vo = function() {
|
|
2356
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
2357
|
+
}, bo = function() {
|
|
2396
2358
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2397
2359
|
try {
|
|
2398
|
-
|
|
2360
|
+
_e(this, e);
|
|
2399
2361
|
} catch {
|
|
2400
2362
|
}
|
|
2401
2363
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2402
|
-
},
|
|
2403
|
-
e && e.labelEl &&
|
|
2404
|
-
},
|
|
2364
|
+
}, wo = function(e) {
|
|
2365
|
+
e && e.labelEl && Ze(this, e.labelEl, e.summaryObj);
|
|
2366
|
+
}, xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2405
2367
|
__proto__: null,
|
|
2406
|
-
createSummary:
|
|
2407
|
-
createSummaryFrom:
|
|
2408
|
-
editSummary:
|
|
2409
|
-
removeSummary:
|
|
2410
|
-
renderSummary:
|
|
2411
|
-
selectSummary:
|
|
2412
|
-
unselectSummary:
|
|
2368
|
+
createSummary: po,
|
|
2369
|
+
createSummaryFrom: go,
|
|
2370
|
+
editSummary: wo,
|
|
2371
|
+
removeSummary: mo,
|
|
2372
|
+
renderSummary: bo,
|
|
2373
|
+
selectSummary: yo,
|
|
2374
|
+
unselectSummary: vo
|
|
2413
2375
|
}, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
|
|
2414
|
-
function
|
|
2376
|
+
function Eo(e, t) {
|
|
2415
2377
|
const n = document.createElementNS(T, "svg");
|
|
2416
2378
|
return k(n, {
|
|
2417
2379
|
version: "1.1",
|
|
@@ -2420,30 +2382,29 @@ function _o(e, t) {
|
|
|
2420
2382
|
width: t
|
|
2421
2383
|
}), n;
|
|
2422
2384
|
}
|
|
2423
|
-
function
|
|
2385
|
+
function Co(e, t) {
|
|
2424
2386
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2425
2387
|
}
|
|
2426
|
-
function
|
|
2388
|
+
function So(e, t, n, o) {
|
|
2427
2389
|
const s = document.createElementNS(T, "g");
|
|
2428
2390
|
let i = "";
|
|
2429
2391
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2430
2392
|
`).forEach((r, c) => {
|
|
2431
|
-
const
|
|
2432
|
-
k(
|
|
2393
|
+
const a = document.createElementNS(T, "text");
|
|
2394
|
+
k(a, {
|
|
2433
2395
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2434
|
-
y: o + parseInt(t.paddingTop) +
|
|
2396
|
+
y: o + parseInt(t.paddingTop) + Co(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
2435
2397
|
"text-anchor": "start",
|
|
2436
2398
|
"font-family": t.fontFamily,
|
|
2437
2399
|
"font-size": `${t.fontSize}`,
|
|
2438
2400
|
"font-weight": `${t.fontWeight}`,
|
|
2439
2401
|
fill: `${t.color}`
|
|
2440
|
-
}),
|
|
2402
|
+
}), a.innerHTML = r, s.appendChild(a);
|
|
2441
2403
|
}), s;
|
|
2442
2404
|
}
|
|
2443
|
-
function
|
|
2444
|
-
var r;
|
|
2405
|
+
function No(e, t, n, o) {
|
|
2445
2406
|
let s = "";
|
|
2446
|
-
|
|
2407
|
+
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2447
2408
|
const i = document.createElementNS(T, "foreignObject");
|
|
2448
2409
|
k(i, {
|
|
2449
2410
|
x: n + parseInt(t.paddingLeft) + "",
|
|
@@ -2457,7 +2418,7 @@ function Ao(e, t, n, o) {
|
|
|
2457
2418
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2458
2419
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2459
2420
|
}
|
|
2460
|
-
function
|
|
2421
|
+
function ko(e, t) {
|
|
2461
2422
|
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "rect");
|
|
2462
2423
|
return k(i, {
|
|
2463
2424
|
x: o + "",
|
|
@@ -2471,7 +2432,7 @@ function Mo(e, t) {
|
|
|
2471
2432
|
"stroke-width": n.borderWidth
|
|
2472
2433
|
}), i;
|
|
2473
2434
|
}
|
|
2474
|
-
function
|
|
2435
|
+
function te(e, t, n = !1) {
|
|
2475
2436
|
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), l = document.createElementNS(T, "rect");
|
|
2476
2437
|
k(l, {
|
|
2477
2438
|
x: s + "",
|
|
@@ -2487,9 +2448,9 @@ function oe(e, t, n = !1) {
|
|
|
2487
2448
|
const r = document.createElementNS(T, "g");
|
|
2488
2449
|
r.appendChild(l);
|
|
2489
2450
|
let c;
|
|
2490
|
-
return n ? c =
|
|
2451
|
+
return n ? c = No(t, o, s, i) : c = So(t, o, s, i), r.appendChild(c), r;
|
|
2491
2452
|
}
|
|
2492
|
-
function
|
|
2453
|
+
function _o(e, t) {
|
|
2493
2454
|
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "a"), l = document.createElementNS(T, "text");
|
|
2494
2455
|
return k(l, {
|
|
2495
2456
|
x: o + "",
|
|
@@ -2501,7 +2462,7 @@ function Do(e, t) {
|
|
|
2501
2462
|
fill: `${n.color}`
|
|
2502
2463
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2503
2464
|
}
|
|
2504
|
-
function
|
|
2465
|
+
function To(e, t) {
|
|
2505
2466
|
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "image");
|
|
2506
2467
|
return k(i, {
|
|
2507
2468
|
x: o + "",
|
|
@@ -2511,41 +2472,40 @@ function Po(e, t) {
|
|
|
2511
2472
|
href: t.src
|
|
2512
2473
|
}), i;
|
|
2513
2474
|
}
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2516
|
-
const n = e.nodes, o = n.offsetHeight + se * 2, s = n.offsetWidth + se * 2, i = _o(o + "px", s + "px"), l = document.createElementNS(T, "svg"), r = document.createElementNS(T, "rect");
|
|
2475
|
+
const ne = 100, Lo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', Ao = (e, t = !1) => {
|
|
2476
|
+
const n = e.nodes, o = n.offsetHeight + ne * 2, s = n.offsetWidth + ne * 2, i = Eo(o + "px", s + "px"), l = document.createElementNS(T, "svg"), r = document.createElementNS(T, "rect");
|
|
2517
2477
|
k(r, {
|
|
2518
2478
|
x: "0",
|
|
2519
2479
|
y: "0",
|
|
2520
2480
|
width: `${s}`,
|
|
2521
2481
|
height: `${o}`,
|
|
2522
2482
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2523
|
-
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2483
|
+
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((u) => {
|
|
2484
|
+
const g = u.cloneNode(!0), { offsetLeft: y, offsetTop: m } = O(n, u.parentElement);
|
|
2485
|
+
g.setAttribute("x", `${y}`), g.setAttribute("y", `${m}`), l.appendChild(g);
|
|
2526
2486
|
});
|
|
2527
|
-
const c =
|
|
2487
|
+
const c = n.querySelector(".lines")?.cloneNode(!0);
|
|
2528
2488
|
c && l.appendChild(c);
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2531
|
-
const f =
|
|
2532
|
-
return f && l.appendChild(f), n.querySelectorAll("me-tpc").forEach((
|
|
2533
|
-
|
|
2534
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2535
|
-
l.appendChild(
|
|
2536
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2537
|
-
l.appendChild(
|
|
2538
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2539
|
-
l.appendChild(
|
|
2540
|
-
}), n.querySelectorAll("img").forEach((
|
|
2541
|
-
l.appendChild(
|
|
2489
|
+
const a = n.querySelector(".topiclinks")?.cloneNode(!0);
|
|
2490
|
+
a && l.appendChild(a);
|
|
2491
|
+
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
2492
|
+
return f && l.appendChild(f), n.querySelectorAll("me-tpc").forEach((u) => {
|
|
2493
|
+
u.nodeObj.dangerouslySetInnerHTML ? l.appendChild(te(e, u, !t)) : (l.appendChild(ko(e, u)), l.appendChild(te(e, u.text, !t)));
|
|
2494
|
+
}), n.querySelectorAll(".tags > span").forEach((u) => {
|
|
2495
|
+
l.appendChild(te(e, u));
|
|
2496
|
+
}), n.querySelectorAll(".icons > span").forEach((u) => {
|
|
2497
|
+
l.appendChild(te(e, u));
|
|
2498
|
+
}), n.querySelectorAll(".hyper-link").forEach((u) => {
|
|
2499
|
+
l.appendChild(_o(e, u));
|
|
2500
|
+
}), n.querySelectorAll("img").forEach((u) => {
|
|
2501
|
+
l.appendChild(To(e, u));
|
|
2542
2502
|
}), k(l, {
|
|
2543
|
-
x:
|
|
2544
|
-
y:
|
|
2503
|
+
x: ne + "",
|
|
2504
|
+
y: ne + "",
|
|
2545
2505
|
overflow: "visible"
|
|
2546
2506
|
}), i.appendChild(l), i;
|
|
2547
|
-
},
|
|
2548
|
-
function
|
|
2507
|
+
}, Mo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Lo + e.outerHTML);
|
|
2508
|
+
function Do(e) {
|
|
2549
2509
|
return new Promise((t, n) => {
|
|
2550
2510
|
const o = new FileReader();
|
|
2551
2511
|
o.onload = (s) => {
|
|
@@ -2555,11 +2515,11 @@ function Ho(e) {
|
|
|
2555
2515
|
}, o.readAsDataURL(e);
|
|
2556
2516
|
});
|
|
2557
2517
|
}
|
|
2558
|
-
const
|
|
2559
|
-
const n =
|
|
2518
|
+
const Po = function(e = !1, t) {
|
|
2519
|
+
const n = Ao(this, e), o = Mo(n, t);
|
|
2560
2520
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2561
|
-
},
|
|
2562
|
-
const n = this.exportSvg(e, t), o = await
|
|
2521
|
+
}, $o = async function(e = !1, t) {
|
|
2522
|
+
const n = this.exportSvg(e, t), o = await Do(n);
|
|
2563
2523
|
return new Promise((s, i) => {
|
|
2564
2524
|
const l = new Image();
|
|
2565
2525
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2567,68 +2527,66 @@ const Bo = function(e = !1, t) {
|
|
|
2567
2527
|
r.width = l.width, r.height = l.height, r.getContext("2d").drawImage(l, 0, 0), r.toBlob(s, "image/png", 1);
|
|
2568
2528
|
}, l.src = o, l.onerror = i;
|
|
2569
2529
|
});
|
|
2570
|
-
},
|
|
2530
|
+
}, Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2571
2531
|
__proto__: null,
|
|
2572
|
-
exportPng:
|
|
2573
|
-
exportSvg:
|
|
2532
|
+
exportPng: $o,
|
|
2533
|
+
exportSvg: Po
|
|
2574
2534
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2575
|
-
function
|
|
2535
|
+
function jo(e, t) {
|
|
2576
2536
|
return async function(...n) {
|
|
2577
2537
|
const o = this.before[t];
|
|
2578
2538
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
2579
2539
|
};
|
|
2580
2540
|
}
|
|
2581
|
-
const
|
|
2582
|
-
for (let e = 0; e <
|
|
2583
|
-
const t =
|
|
2584
|
-
|
|
2541
|
+
const ze = Object.keys(rt), dt = {};
|
|
2542
|
+
for (let e = 0; e < ze.length; e++) {
|
|
2543
|
+
const t = ze[e];
|
|
2544
|
+
dt[t] = jo(rt[t], t);
|
|
2585
2545
|
}
|
|
2586
|
-
const
|
|
2587
|
-
getObjById:
|
|
2588
|
-
generateNewObj:
|
|
2589
|
-
layout:
|
|
2590
|
-
linkDiv:
|
|
2591
|
-
editTopic:
|
|
2592
|
-
createWrapper:
|
|
2593
|
-
createParent:
|
|
2594
|
-
createChildren:
|
|
2595
|
-
createTopic:
|
|
2596
|
-
findEle:
|
|
2597
|
-
changeTheme:
|
|
2598
|
-
...
|
|
2599
|
-
...
|
|
2600
|
-
...
|
|
2601
|
-
...
|
|
2602
|
-
...
|
|
2546
|
+
const Ho = {
|
|
2547
|
+
getObjById: oe,
|
|
2548
|
+
generateNewObj: ht,
|
|
2549
|
+
layout: wt,
|
|
2550
|
+
linkDiv: Lt,
|
|
2551
|
+
editTopic: _t,
|
|
2552
|
+
createWrapper: Ct,
|
|
2553
|
+
createParent: St,
|
|
2554
|
+
createChildren: Nt,
|
|
2555
|
+
createTopic: kt,
|
|
2556
|
+
findEle: Xe,
|
|
2557
|
+
changeTheme: tn,
|
|
2558
|
+
...zn,
|
|
2559
|
+
...dt,
|
|
2560
|
+
...co,
|
|
2561
|
+
...xo,
|
|
2562
|
+
...Oo,
|
|
2603
2563
|
init(e) {
|
|
2604
|
-
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData)
|
|
2605
|
-
|
|
2606
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, B(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Zt(this), this.keypress && Ct(this, this.keypress), this.editable && rn(this), this.contextMenu && this.disposable.push(Ot(this, this.contextMenu)), this.draggable && this.disposable.push(Rt(this)), this.allowUndo && this.disposable.push(It(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2564
|
+
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2565
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, R(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && zt(this), this.keypress && yt(this, this.keypress), this.editable && en(this), this.contextMenu && this.disposable.push(At(this, this.contextMenu)), this.draggable && this.disposable.push($t(this)), this.allowUndo && this.disposable.push(jt(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
2607
2566
|
},
|
|
2608
2567
|
destroy() {
|
|
2609
|
-
|
|
2610
|
-
this.disposable.forEach((t) => t()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (e = this.selection) == null || e.destroy(), this.selection = void 0;
|
|
2568
|
+
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, this.selection?.destroy(), this.selection = void 0;
|
|
2611
2569
|
}
|
|
2612
2570
|
};
|
|
2613
|
-
function
|
|
2571
|
+
function Bo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: a }) {
|
|
2614
2572
|
let f = t + n / 2;
|
|
2615
2573
|
const u = e + o / 2;
|
|
2616
2574
|
let g;
|
|
2617
|
-
c ===
|
|
2618
|
-
const y = s + r / 2,
|
|
2619
|
-
return c ===
|
|
2575
|
+
c === P.LHS ? g = i + l : g = i;
|
|
2576
|
+
const y = s + r / 2, p = (1 - Math.abs(y - u) / a) * 0.25 * (n / 2);
|
|
2577
|
+
return c === P.LHS ? f = f - n / 10 - p : f = f + n / 10 + p, `M ${f} ${u} Q ${f} ${y} ${g} ${y}`;
|
|
2620
2578
|
}
|
|
2621
|
-
function
|
|
2579
|
+
function Ro({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: a }) {
|
|
2622
2580
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2623
2581
|
let u = 0, g = 0;
|
|
2624
|
-
|
|
2582
|
+
a ? u = e + o / 2 : u = e + o;
|
|
2625
2583
|
const y = s + r;
|
|
2626
|
-
let
|
|
2584
|
+
let m = 0, p = 0, d = 0;
|
|
2627
2585
|
const h = Math.abs(u - y) / 300 * f;
|
|
2628
|
-
return c ===
|
|
2586
|
+
return c === P.LHS ? (d = t, m = d + f, p = d - f, g = i + f, `M ${m} ${u} C ${d} ${u} ${d + h} ${y} ${p} ${y} H ${g}`) : (d = t + n, m = d - f, p = d + f, g = i + l - f, `M ${m} ${u} C ${d} ${u} ${d - h} ${y} ${p} ${y} H ${g}`);
|
|
2629
2587
|
}
|
|
2630
|
-
const
|
|
2631
|
-
function
|
|
2588
|
+
const Io = "5.3.0";
|
|
2589
|
+
function Fo(e) {
|
|
2632
2590
|
return {
|
|
2633
2591
|
x: 0,
|
|
2634
2592
|
y: 0,
|
|
@@ -2643,7 +2601,7 @@ function qo(e) {
|
|
|
2643
2601
|
}
|
|
2644
2602
|
};
|
|
2645
2603
|
}
|
|
2646
|
-
const
|
|
2604
|
+
const G = document;
|
|
2647
2605
|
function $({
|
|
2648
2606
|
el: e,
|
|
2649
2607
|
direction: t,
|
|
@@ -2654,33 +2612,32 @@ function $({
|
|
|
2654
2612
|
toolBar: l,
|
|
2655
2613
|
keypress: r,
|
|
2656
2614
|
mouseSelectionButton: c,
|
|
2657
|
-
selectionContainer:
|
|
2615
|
+
selectionContainer: a,
|
|
2658
2616
|
before: f,
|
|
2659
2617
|
newTopicName: u,
|
|
2660
2618
|
allowUndo: g,
|
|
2661
2619
|
generateMainBranch: y,
|
|
2662
|
-
generateSubBranch:
|
|
2663
|
-
overflowHidden:
|
|
2664
|
-
theme:
|
|
2620
|
+
generateSubBranch: m,
|
|
2621
|
+
overflowHidden: p,
|
|
2622
|
+
theme: d,
|
|
2665
2623
|
alignment: h,
|
|
2666
2624
|
scaleSensitivity: v,
|
|
2667
|
-
scaleMax:
|
|
2668
|
-
scaleMin:
|
|
2625
|
+
scaleMax: x,
|
|
2626
|
+
scaleMin: b,
|
|
2669
2627
|
handleWheel: S,
|
|
2670
|
-
markdown:
|
|
2671
|
-
imageProxy:
|
|
2628
|
+
markdown: w,
|
|
2629
|
+
imageProxy: E
|
|
2672
2630
|
}) {
|
|
2673
|
-
let
|
|
2631
|
+
let C = null;
|
|
2674
2632
|
const N = Object.prototype.toString.call(e);
|
|
2675
|
-
if (N === "[object HTMLDivElement]" ?
|
|
2676
|
-
|
|
2677
|
-
E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = u || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = v ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = y || Ko, this.generateSubBranch = p || Go, this.overflowHidden = m ?? !1, this.alignment = h ?? "root", this.handleWheel = S ?? !0, this.markdown = b || void 0, this.imageProxy = x || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = qo(this), this.bus = St(), this.container = K.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2633
|
+
if (N === "[object HTMLDivElement]" ? C = e : N === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
2634
|
+
C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = u || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = v ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = b ?? 0.2, this.generateMainBranch = y || Bo, this.generateSubBranch = m || Ro, this.overflowHidden = p ?? !1, this.alignment = h ?? "root", this.handleWheel = S ?? !0, this.markdown = w || void 0, this.imageProxy = E || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Fo(this), this.bus = bt(), this.container = G.createElement("div"), this.selectionContainer = a || this.container, this.container.className = "map-container";
|
|
2678
2635
|
const L = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2679
|
-
this.theme =
|
|
2680
|
-
const A =
|
|
2681
|
-
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes =
|
|
2636
|
+
this.theme = d || (L.matches ? be : ve);
|
|
2637
|
+
const A = G.createElement("div");
|
|
2638
|
+
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = G.createElement("me-nodes"), this.lines = X("lines"), this.summarySvg = X("summary"), this.linkController = X("linkcontroller"), this.P2 = G.createElement("div"), this.P3 = G.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Pe(), this.line2 = Pe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = X("topiclinks"), this.labelContainer = G.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(vt(this));
|
|
2682
2639
|
}
|
|
2683
|
-
$.prototype =
|
|
2640
|
+
$.prototype = Ho;
|
|
2684
2641
|
Object.defineProperty($.prototype, "currentNode", {
|
|
2685
2642
|
get() {
|
|
2686
2643
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -2690,13 +2647,13 @@ Object.defineProperty($.prototype, "currentNode", {
|
|
|
2690
2647
|
$.LEFT = 0;
|
|
2691
2648
|
$.RIGHT = 1;
|
|
2692
2649
|
$.SIDE = 2;
|
|
2693
|
-
$.THEME =
|
|
2694
|
-
$.DARK_THEME =
|
|
2695
|
-
$.version =
|
|
2696
|
-
$.E =
|
|
2650
|
+
$.THEME = ve;
|
|
2651
|
+
$.DARK_THEME = be;
|
|
2652
|
+
$.version = Io;
|
|
2653
|
+
$.E = Xe;
|
|
2697
2654
|
$.new = (e) => ({
|
|
2698
2655
|
nodeData: {
|
|
2699
|
-
id:
|
|
2656
|
+
id: W(),
|
|
2700
2657
|
topic: e || "new topic",
|
|
2701
2658
|
children: []
|
|
2702
2659
|
}
|