flow-mindmap 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flow-mindmap.js +695 -750
- package/dist/flow-mindmap.umd.cjs +9 -13
- package/package.json +1 -1
package/dist/flow-mindmap.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as ct, openBlock as C, createElementBlock as E, Fragment as F, createElementVNode as p, createStaticVNode as Ne, createCommentVNode as X, ref as O, reactive as je, onMounted as st, onBeforeUnmount as dt, computed as te, withModifiers as D, normalizeStyle as ve, createVNode as q, toDisplayString as be, watch as Ue, nextTick as ee, unref as N, renderList as Ot, normalizeClass as Ie, withDirectives as Wn, withKeys as Ye, vModelText as $n, createBlock as Rn } from "vue";
|
|
2
|
+
const Bn = ["width", "height", "stroke-width"], Ln = {
|
|
3
3
|
key: 4,
|
|
4
4
|
points: "6 9 12 15 18 9"
|
|
5
|
-
},
|
|
5
|
+
}, An = {
|
|
6
6
|
key: 5,
|
|
7
7
|
points: "9 6 15 12 9 18"
|
|
8
|
-
},
|
|
8
|
+
}, U = /* @__PURE__ */ ct({
|
|
9
9
|
__name: "Icon",
|
|
10
10
|
props: {
|
|
11
11
|
name: {},
|
|
@@ -13,7 +13,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
13
13
|
stroke: {}
|
|
14
14
|
},
|
|
15
15
|
setup(i) {
|
|
16
|
-
return (s, o) => (
|
|
16
|
+
return (s, o) => (C(), E("svg", {
|
|
17
17
|
width: i.size ?? 16,
|
|
18
18
|
height: i.size ?? 16,
|
|
19
19
|
viewBox: "0 0 24 24",
|
|
@@ -24,7 +24,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
24
24
|
"stroke-linejoin": "round",
|
|
25
25
|
"aria-hidden": "true"
|
|
26
26
|
}, [
|
|
27
|
-
i.name === "add" ? (
|
|
27
|
+
i.name === "add" ? (C(), E(F, { key: 0 }, [
|
|
28
28
|
o[0] || (o[0] = p("circle", {
|
|
29
29
|
cx: "12",
|
|
30
30
|
cy: "12",
|
|
@@ -42,7 +42,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
42
42
|
x2: "16",
|
|
43
43
|
y2: "12"
|
|
44
44
|
}, null, -1))
|
|
45
|
-
], 64)) : i.name === "minus" ? (
|
|
45
|
+
], 64)) : i.name === "minus" ? (C(), E(F, { key: 1 }, [
|
|
46
46
|
o[3] || (o[3] = p("circle", {
|
|
47
47
|
cx: "12",
|
|
48
48
|
cy: "12",
|
|
@@ -54,9 +54,9 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
54
54
|
x2: "16",
|
|
55
55
|
y2: "12"
|
|
56
56
|
}, null, -1))
|
|
57
|
-
], 64)) : i.name === "delete" ? (
|
|
58
|
-
o[5] || (o[5] =
|
|
59
|
-
], 64)) : i.name === "edit" ? (
|
|
57
|
+
], 64)) : i.name === "delete" ? (C(), E(F, { key: 2 }, [
|
|
58
|
+
o[5] || (o[5] = Ne('<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>', 5))
|
|
59
|
+
], 64)) : i.name === "edit" ? (C(), E(F, { key: 3 }, [
|
|
60
60
|
o[6] || (o[6] = p("path", { d: "M4 20 l4 -1 11 -11 -3 -3 -11 11 z" }, null, -1)),
|
|
61
61
|
o[7] || (o[7] = p("line", {
|
|
62
62
|
x1: "14",
|
|
@@ -64,7 +64,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
64
64
|
x2: "18",
|
|
65
65
|
y2: "10"
|
|
66
66
|
}, null, -1))
|
|
67
|
-
], 64)) : i.name === "collapse" ? (
|
|
67
|
+
], 64)) : i.name === "collapse" ? (C(), E("polyline", Ln)) : i.name === "expand" ? (C(), E("polyline", An)) : i.name === "zoom-in" ? (C(), E(F, { key: 6 }, [
|
|
68
68
|
o[8] || (o[8] = p("circle", {
|
|
69
69
|
cx: "11",
|
|
70
70
|
cy: "11",
|
|
@@ -88,7 +88,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
88
88
|
x2: "21",
|
|
89
89
|
y2: "21"
|
|
90
90
|
}, null, -1))
|
|
91
|
-
], 64)) : i.name === "zoom-out" ? (
|
|
91
|
+
], 64)) : i.name === "zoom-out" ? (C(), E(F, { key: 7 }, [
|
|
92
92
|
o[12] || (o[12] = p("circle", {
|
|
93
93
|
cx: "11",
|
|
94
94
|
cy: "11",
|
|
@@ -106,7 +106,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
106
106
|
x2: "21",
|
|
107
107
|
y2: "21"
|
|
108
108
|
}, null, -1))
|
|
109
|
-
], 64)) : i.name === "reset" ? (
|
|
109
|
+
], 64)) : i.name === "reset" ? (C(), E(F, { key: 8 }, [
|
|
110
110
|
o[15] || (o[15] = p("circle", {
|
|
111
111
|
cx: "12",
|
|
112
112
|
cy: "12",
|
|
@@ -123,25 +123,25 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
123
123
|
r: "0.8",
|
|
124
124
|
fill: "currentColor"
|
|
125
125
|
}, null, -1))
|
|
126
|
-
], 64)) : i.name === "logo" ? (
|
|
127
|
-
o[18] || (o[18] =
|
|
128
|
-
], 64)) : i.name === "import" ? (
|
|
126
|
+
], 64)) : i.name === "logo" ? (C(), E(F, { key: 9 }, [
|
|
127
|
+
o[18] || (o[18] = Ne('<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>', 9))
|
|
128
|
+
], 64)) : i.name === "import" ? (C(), E(F, { key: 10 }, [
|
|
129
129
|
o[19] || (o[19] = p("path", { d: "M12 4 V15" }, null, -1)),
|
|
130
130
|
o[20] || (o[20] = p("polyline", { points: "7 10 12 15 17 10" }, null, -1)),
|
|
131
131
|
o[21] || (o[21] = p("path", { d: "M4 19 H20" }, null, -1))
|
|
132
|
-
], 64)) : i.name === "export" ? (
|
|
132
|
+
], 64)) : i.name === "export" ? (C(), E(F, { key: 11 }, [
|
|
133
133
|
o[22] || (o[22] = p("path", { d: "M12 15 V4" }, null, -1)),
|
|
134
134
|
o[23] || (o[23] = p("polyline", { points: "7 9 12 4 17 9" }, null, -1)),
|
|
135
135
|
o[24] || (o[24] = p("path", { d: "M4 19 H20" }, null, -1))
|
|
136
|
-
], 64)) : i.name === "balance" ? (
|
|
137
|
-
o[25] || (o[25] =
|
|
138
|
-
], 64)) : i.name === "mindmap" ? (
|
|
139
|
-
o[26] || (o[26] =
|
|
140
|
-
], 64)) : i.name === "tree" ? (
|
|
141
|
-
o[27] || (o[27] =
|
|
142
|
-
], 64)) : i.name === "org" ? (
|
|
143
|
-
o[28] || (o[28] =
|
|
144
|
-
], 64)) : i.name === "image" ? (
|
|
136
|
+
], 64)) : i.name === "balance" ? (C(), E(F, { key: 12 }, [
|
|
137
|
+
o[25] || (o[25] = Ne('<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>', 9))
|
|
138
|
+
], 64)) : i.name === "mindmap" ? (C(), E(F, { key: 13 }, [
|
|
139
|
+
o[26] || (o[26] = Ne('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>', 5))
|
|
140
|
+
], 64)) : i.name === "tree" ? (C(), E(F, { key: 14 }, [
|
|
141
|
+
o[27] || (o[27] = Ne('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>', 7))
|
|
142
|
+
], 64)) : i.name === "org" ? (C(), E(F, { key: 15 }, [
|
|
143
|
+
o[28] || (o[28] = Ne('<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>', 9))
|
|
144
|
+
], 64)) : i.name === "image" ? (C(), E(F, { key: 16 }, [
|
|
145
145
|
o[29] || (o[29] = p("rect", {
|
|
146
146
|
x: "3",
|
|
147
147
|
y: "5",
|
|
@@ -155,7 +155,7 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
155
155
|
r: "1.6"
|
|
156
156
|
}, null, -1)),
|
|
157
157
|
o[31] || (o[31] = p("polyline", { points: "3 17 9 12 13 15 16 13 21 17" }, null, -1))
|
|
158
|
-
], 64)) : i.name === "x" ? (
|
|
158
|
+
], 64)) : i.name === "x" ? (C(), E(F, { key: 17 }, [
|
|
159
159
|
o[32] || (o[32] = p("line", {
|
|
160
160
|
x1: "6",
|
|
161
161
|
y1: "6",
|
|
@@ -168,10 +168,10 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
168
168
|
x2: "6",
|
|
169
169
|
y2: "18"
|
|
170
170
|
}, null, -1))
|
|
171
|
-
], 64)) : i.name === "link" ? (
|
|
171
|
+
], 64)) : i.name === "link" ? (C(), E(F, { key: 18 }, [
|
|
172
172
|
o[34] || (o[34] = p("path", { d: "M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1" }, null, -1)),
|
|
173
173
|
o[35] || (o[35] = p("path", { d: "M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1" }, null, -1))
|
|
174
|
-
], 64)) : i.name === "note" ? (
|
|
174
|
+
], 64)) : i.name === "note" ? (C(), E(F, { key: 19 }, [
|
|
175
175
|
o[36] || (o[36] = p("path", { d: "M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z" }, null, -1)),
|
|
176
176
|
o[37] || (o[37] = p("line", {
|
|
177
177
|
x1: "8",
|
|
@@ -191,79 +191,79 @@ const Dn = ["width", "height", "stroke-width"], Pn = {
|
|
|
191
191
|
x2: "13",
|
|
192
192
|
y2: "16"
|
|
193
193
|
}, null, -1))
|
|
194
|
-
], 64)) :
|
|
195
|
-
], 8,
|
|
194
|
+
], 64)) : X("", !0)
|
|
195
|
+
], 8, Bn));
|
|
196
196
|
}
|
|
197
|
-
}),
|
|
198
|
-
function
|
|
199
|
-
return Math.round(
|
|
197
|
+
}), Hn = "data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e", Dn = "data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e", Ut = [18, 15, 13, 12], Pn = [700, 600, 500, 400], Tn = [52, 40, 32, 28], On = [120, 80, 60, 44], Fn = [0.8, 0.8, 0.8, 0.8], Vn = Ut.length - 1;
|
|
198
|
+
function Xn(i, s) {
|
|
199
|
+
return Math.round(ft(i, s) * Fn[Ze(i)]);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
return Math.min(
|
|
201
|
+
function Ze(i) {
|
|
202
|
+
return Math.min(Vn, Math.max(0, i));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
return Math.round(Ut[
|
|
204
|
+
function ft(i, s = 14) {
|
|
205
|
+
return Math.round(Ut[Ze(i)] * s / 14 * 10) / 10;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return Math.round(
|
|
207
|
+
function qn(i, s = 14) {
|
|
208
|
+
return Math.round(Tn[Ze(i)] * s / 14);
|
|
209
209
|
}
|
|
210
|
-
const
|
|
211
|
-
let
|
|
212
|
-
function
|
|
213
|
-
if (
|
|
210
|
+
const Ke = 60, $e = 14, oe = 24;
|
|
211
|
+
let at = null;
|
|
212
|
+
function Un() {
|
|
213
|
+
if (at) return at;
|
|
214
214
|
const i = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
|
|
215
|
-
return i ? (
|
|
215
|
+
return i ? (at = i, i) : {
|
|
216
216
|
font: "",
|
|
217
217
|
measureText: () => ({ width: 0 })
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
const Ft = /* @__PURE__ */ new Map();
|
|
221
|
-
function
|
|
221
|
+
function Yn(i, s, o) {
|
|
222
222
|
const n = `${o}|${s}|${i}`, r = Ft.get(n);
|
|
223
223
|
if (r !== void 0) return r;
|
|
224
|
-
const c =
|
|
224
|
+
const c = Un();
|
|
225
225
|
c.font = `${o} ${s}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;
|
|
226
226
|
const d = c.measureText(i).width;
|
|
227
227
|
return Ft.set(n, d), d;
|
|
228
228
|
}
|
|
229
|
-
const
|
|
230
|
-
function
|
|
229
|
+
const Kn = 24, jn = 400, Gn = 8, Vt = 16, Jn = 4, Zn = 200;
|
|
230
|
+
function Qn(i, s, o) {
|
|
231
231
|
return Math.min(o, Math.max(s, i));
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
const n =
|
|
233
|
+
function _n(i, s, o) {
|
|
234
|
+
const n = Ze(s), r = ft(s, o), c = Math.min(Yn(i.text || "", r, Pn[n]), Zn), d = Xn(s, o), x = Math.ceil(c + d * 2), f = qn(s, o);
|
|
235
235
|
let v = 0;
|
|
236
236
|
if (i.link && (v += Vt), i.note && (v += Vt), v > 0) {
|
|
237
|
-
const
|
|
238
|
-
v +=
|
|
237
|
+
const Y = (i.link ? 1 : 0) + (i.note ? 1 : 0);
|
|
238
|
+
v += Jn * Y;
|
|
239
239
|
}
|
|
240
|
-
const u = x + v,
|
|
240
|
+
const u = x + v, g = Math.round(On[n] * o / 14), M = 0, w = 0;
|
|
241
241
|
if (!i.image)
|
|
242
|
-
return { w: Math.max(
|
|
243
|
-
const
|
|
244
|
-
return { w: j, h:
|
|
242
|
+
return { w: Math.max(g, u), h: f + w + M };
|
|
243
|
+
const H = Qn(i.image.width, Kn, jn), j = Math.max(g, u, Math.ceil(H + d * 2)), Z = Math.ceil(i.image.height + Gn + f + w + M);
|
|
244
|
+
return { w: j, h: Z };
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function ei(i, s = {}) {
|
|
247
247
|
const o = s.mode ?? "mindmap", n = s.preservePositions === !0, r = s.baseFontSize ?? 14, c = Kt(i, 0, null, 1, "right", r);
|
|
248
|
-
return
|
|
248
|
+
return ni(c), ti(c, o, n), c.x = 0, c.y = 0, ii(c, n);
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function ti(i, s, o = !1) {
|
|
251
251
|
if (s === "mindmap") {
|
|
252
252
|
const n = i.children;
|
|
253
253
|
if (n.length !== 0) if (n.length === 1)
|
|
254
254
|
n[0]._dir = "right", n[0].side = 1, n[0]._dirRight = 1;
|
|
255
255
|
else {
|
|
256
|
-
const x = n.reduce((
|
|
256
|
+
const x = n.reduce((g, M) => g + M._subtreeH, 0);
|
|
257
257
|
let f = 1, v = Math.abs(n[0]._subtreeH - (x - n[0]._subtreeH)), u = 0;
|
|
258
|
-
for (let
|
|
259
|
-
u += n[
|
|
260
|
-
const
|
|
261
|
-
|
|
258
|
+
for (let g = 0; g < n.length - 1; g++) {
|
|
259
|
+
u += n[g]._subtreeH;
|
|
260
|
+
const M = Math.abs(u - (x - u));
|
|
261
|
+
M < v && (v = M, f = g + 1);
|
|
262
262
|
}
|
|
263
|
-
for (let
|
|
264
|
-
n[
|
|
265
|
-
for (let
|
|
266
|
-
n[
|
|
263
|
+
for (let g = 0; g < f; g++)
|
|
264
|
+
n[g]._dir = "right", n[g].side = 1, n[g]._dirRight = 1;
|
|
265
|
+
for (let g = f; g < n.length; g++)
|
|
266
|
+
n[g]._dir = "left", n[g].side = -1, n[g]._dirRight = -1;
|
|
267
267
|
}
|
|
268
268
|
const r = i.children.filter((x) => x.side === 1), c = i.children.filter((x) => x.side === -1), d = (x, f) => {
|
|
269
269
|
const v = f === "right" ? 1 : -1;
|
|
@@ -274,11 +274,11 @@ function li(i, s, o = !1) {
|
|
|
274
274
|
for (const x of c) d(x, "left");
|
|
275
275
|
if (r.length > 0) {
|
|
276
276
|
const x = { ...i, children: r };
|
|
277
|
-
|
|
277
|
+
Ge(x, "right", Ke, !0, o);
|
|
278
278
|
}
|
|
279
279
|
if (c.length > 0) {
|
|
280
280
|
const x = { ...i, children: c };
|
|
281
|
-
|
|
281
|
+
Ge(x, "left", Ke, !0, o);
|
|
282
282
|
}
|
|
283
283
|
} else if (s === "tree") {
|
|
284
284
|
const n = (r) => {
|
|
@@ -286,36 +286,36 @@ function li(i, s, o = !1) {
|
|
|
286
286
|
for (const c of r.children) n(c);
|
|
287
287
|
};
|
|
288
288
|
for (const r of i.children) r._dir = "right";
|
|
289
|
-
|
|
289
|
+
Ge(i, "right", Ke, !0, o), n(i);
|
|
290
290
|
} else {
|
|
291
291
|
for (const n of i.children) n._dir = "down";
|
|
292
|
-
Yt(i,
|
|
292
|
+
Yt(i, Ke, o);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function Ge(i, s, o, n, r = !1) {
|
|
296
296
|
if (i.children.length === 0) return;
|
|
297
297
|
const c = i.children.reduce(
|
|
298
|
-
(v, u,
|
|
298
|
+
(v, u, g) => v + u._subtreeH + (g > 0 ? $e : 0),
|
|
299
299
|
0
|
|
300
300
|
), d = s === "right" ? 1 : -1, x = n ? d : 1;
|
|
301
301
|
let f = i.y - x * c / 2;
|
|
302
302
|
i.children.forEach((v) => {
|
|
303
|
-
r || (v.x = i.x + d * (i.width / 2 + o + v.width / 2), v.y = f + x * v._subtreeH / 2), v._dir = s, f += x * (v._subtreeH +
|
|
303
|
+
r || (v.x = i.x + d * (i.width / 2 + o + v.width / 2), v.y = f + x * v._subtreeH / 2), v._dir = s, f += x * (v._subtreeH + $e), Ge(v, s, o, !1, r);
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
function Yt(i, s, o = !1) {
|
|
307
307
|
if (i.children.length === 0) return;
|
|
308
308
|
const n = i.children.reduce(
|
|
309
|
-
(c, d, x) => c + d._subtreeW + (x > 0 ?
|
|
309
|
+
(c, d, x) => c + d._subtreeW + (x > 0 ? $e * 2 : 0),
|
|
310
310
|
0
|
|
311
311
|
);
|
|
312
312
|
let r = i.x - n / 2;
|
|
313
313
|
i.children.forEach((c) => {
|
|
314
|
-
o || (c.x = r + c._subtreeW / 2, c.y = i.y + i.height / 2 + s + c.height / 2), c._dir = "down", r += c._subtreeW +
|
|
314
|
+
o || (c.x = r + c._subtreeW / 2, c.y = i.y + i.height / 2 + s + c.height / 2), c._dir = "down", r += c._subtreeW + $e * 2, Yt(c, s, o);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
function Kt(i, s, o, n, r, c) {
|
|
318
|
-
const d =
|
|
318
|
+
const d = _n(i, s, c), x = {
|
|
319
319
|
id: i.id,
|
|
320
320
|
text: i.text,
|
|
321
321
|
depth: s,
|
|
@@ -326,7 +326,7 @@ function Kt(i, s, o, n, r, c) {
|
|
|
326
326
|
y: i._y ?? 0,
|
|
327
327
|
width: d.w,
|
|
328
328
|
height: d.h,
|
|
329
|
-
fontSize:
|
|
329
|
+
fontSize: ft(s, c),
|
|
330
330
|
isRoot: s === 0,
|
|
331
331
|
collapsed: i.collapsed,
|
|
332
332
|
side: n,
|
|
@@ -343,12 +343,12 @@ function Kt(i, s, o, n, r, c) {
|
|
|
343
343
|
};
|
|
344
344
|
if (i.collapsed) return x;
|
|
345
345
|
const f = i.children.length, v = Math.ceil(f / 2);
|
|
346
|
-
return x.children = i.children.map((u,
|
|
347
|
-
const
|
|
348
|
-
return Kt(u, s + 1, x,
|
|
346
|
+
return x.children = i.children.map((u, g) => {
|
|
347
|
+
const M = s === 0 ? g < v ? 1 : -1 : n;
|
|
348
|
+
return Kt(u, s + 1, x, M, r, c);
|
|
349
349
|
}), x;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function ni(i) {
|
|
352
352
|
const s = [i];
|
|
353
353
|
for (let o = 0; o < s.length; o++) {
|
|
354
354
|
const n = s[o];
|
|
@@ -363,15 +363,15 @@ function ri(i) {
|
|
|
363
363
|
let r = 0, c = 0;
|
|
364
364
|
for (const d of n.children)
|
|
365
365
|
r += d._subtreeH, c += d._subtreeW;
|
|
366
|
-
n.children.length > 1 && (r +=
|
|
366
|
+
n.children.length > 1 && (r += $e * (n.children.length - 1), c += $e * 2 * (n.children.length - 1)), n._subtreeH = Math.max(n.height, r), n._subtreeW = Math.max(n.width, c);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function ii(i, s = !1) {
|
|
370
370
|
const o = [i];
|
|
371
371
|
let n = 1 / 0, r = -1 / 0, c = 1 / 0, d = -1 / 0;
|
|
372
372
|
for (; o.length; ) {
|
|
373
|
-
const v = o.pop(), u = v.width / 2,
|
|
374
|
-
v.x - u < n && (n = v.x - u), v.x + u > r && (r = v.x + u), v.y -
|
|
373
|
+
const v = o.pop(), u = v.width / 2, g = v.height / 2;
|
|
374
|
+
v.x - u < n && (n = v.x - u), v.x + u > r && (r = v.x + u), v.y - g < c && (c = v.y - g), v.y + g > d && (d = v.y + g), o.push(...v.children);
|
|
375
375
|
}
|
|
376
376
|
if (s)
|
|
377
377
|
return {
|
|
@@ -398,7 +398,7 @@ function ai(i, s = !1) {
|
|
|
398
398
|
vbH: d + oe
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
|
-
const
|
|
401
|
+
const Pe = [
|
|
402
402
|
{
|
|
403
403
|
id: "default",
|
|
404
404
|
name: "默认",
|
|
@@ -470,13 +470,13 @@ const Te = [
|
|
|
470
470
|
]
|
|
471
471
|
}
|
|
472
472
|
];
|
|
473
|
-
function
|
|
474
|
-
return [...
|
|
473
|
+
function oi(i, s = []) {
|
|
474
|
+
return [...Pe, ...s].find((n) => n.id === i) ?? Pe[0];
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function ue() {
|
|
477
477
|
return "n_" + Math.random().toString(36).slice(2, 10) + Date.now().toString(36).slice(-4);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function me(i) {
|
|
480
480
|
return JSON.parse(JSON.stringify(i));
|
|
481
481
|
}
|
|
482
482
|
function A(i, s) {
|
|
@@ -487,10 +487,10 @@ function A(i, s) {
|
|
|
487
487
|
}
|
|
488
488
|
return null;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function ce(i, s, o = null) {
|
|
491
491
|
if (i.id === s) return o;
|
|
492
492
|
for (const n of i.children) {
|
|
493
|
-
const r =
|
|
493
|
+
const r = ce(n, s, i);
|
|
494
494
|
if (r !== null) return r;
|
|
495
495
|
}
|
|
496
496
|
return null;
|
|
@@ -503,20 +503,20 @@ function jt(i, s) {
|
|
|
503
503
|
if (jt(n, s)) return !0;
|
|
504
504
|
return !1;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function li(i, s, o) {
|
|
507
507
|
const n = A(i, s);
|
|
508
508
|
return !n || n.text === o ? !1 : (n.text = o, !0);
|
|
509
509
|
}
|
|
510
|
-
function
|
|
511
|
-
if (!
|
|
512
|
-
const r =
|
|
510
|
+
function ri(i, s, o, n) {
|
|
511
|
+
if (!ce(i, s) || s === o || A(A(i, s), o)) return !1;
|
|
512
|
+
const r = ce(i, s), c = r.children.findIndex((v) => v.id === s);
|
|
513
513
|
if (c < 0) return !1;
|
|
514
514
|
const [d] = r.children.splice(c, 1);
|
|
515
515
|
if (n === "child") {
|
|
516
516
|
const v = A(i, o);
|
|
517
517
|
return v ? (v.children.push(d), !0) : (r.children.splice(c, 0, d), !1);
|
|
518
518
|
}
|
|
519
|
-
const x =
|
|
519
|
+
const x = ce(i, o);
|
|
520
520
|
if (!x)
|
|
521
521
|
return r.children.splice(c, 0, d), !1;
|
|
522
522
|
let f = x.children.findIndex((v) => v.id === o);
|
|
@@ -534,167 +534,167 @@ function Gt(i) {
|
|
|
534
534
|
} else
|
|
535
535
|
n = !0;
|
|
536
536
|
}
|
|
537
|
-
return o === 0 && !n ?
|
|
537
|
+
return o === 0 && !n ? Je : o > 0 ? `新节点 ${o + 1}` : "新节点 2";
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function ai(i, s, o) {
|
|
540
540
|
const n = A(i, s);
|
|
541
541
|
if (!n) return null;
|
|
542
|
-
const r = { id:
|
|
542
|
+
const r = { id: ue(), text: o ?? Gt(n), children: [] };
|
|
543
543
|
return n.children.push(r), r;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
const n =
|
|
545
|
+
function si(i, s, o) {
|
|
546
|
+
const n = ce(i, s);
|
|
547
547
|
if (!n) return null;
|
|
548
548
|
const r = n.children.findIndex((d) => d.id === s);
|
|
549
549
|
if (r < 0) return null;
|
|
550
|
-
const c = { id:
|
|
550
|
+
const c = { id: ue(), text: o ?? Gt(n), children: [] };
|
|
551
551
|
return n.children.splice(r + 1, 0, c), c;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
const n =
|
|
553
|
+
function ui(i, s, o) {
|
|
554
|
+
const n = ce(i, s);
|
|
555
555
|
if (!n) return null;
|
|
556
556
|
const r = n.children.findIndex((d) => d.id === s);
|
|
557
557
|
if (r < 0) return null;
|
|
558
|
-
const c = { id:
|
|
558
|
+
const c = { id: ue(), text: o, children: [] };
|
|
559
559
|
return n.children.splice(r, 0, c), c;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
const o =
|
|
561
|
+
function ci(i, s) {
|
|
562
|
+
const o = ce(i, s);
|
|
563
563
|
if (!o) return null;
|
|
564
564
|
const n = o.children.findIndex((d) => d.id === s);
|
|
565
565
|
if (n < 0) return null;
|
|
566
|
-
const r = o.children[n], c =
|
|
566
|
+
const r = o.children[n], c = me(r);
|
|
567
567
|
return Jt(c), o.children.splice(n + 1, 0, c), c;
|
|
568
568
|
}
|
|
569
569
|
function Jt(i) {
|
|
570
|
-
i.id =
|
|
570
|
+
i.id = ue();
|
|
571
571
|
for (const s of i.children) Jt(s);
|
|
572
572
|
}
|
|
573
|
-
const
|
|
573
|
+
const Je = "新节点";
|
|
574
574
|
function Xt(i, s = "导入的导图") {
|
|
575
|
-
const o = i.split(/\r?\n/), n = { id:
|
|
576
|
-
let
|
|
577
|
-
function
|
|
578
|
-
|
|
575
|
+
const o = i.split(/\r?\n/), n = { id: ue(), text: s, children: [] }, r = [n], c = [-1 / 0], d = [], x = /^(#{1,6})\s+(.+?)\s*#*\s*$/, f = /^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, v = /^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, u = /^(`{3,}|~{3,})\s*(\S+)?\s*$/;
|
|
576
|
+
let g = !1, M = [], w = null;
|
|
577
|
+
function H(b) {
|
|
578
|
+
M.push(b);
|
|
579
579
|
}
|
|
580
580
|
function j() {
|
|
581
|
-
if (
|
|
582
|
-
for (;
|
|
583
|
-
for (;
|
|
584
|
-
const
|
|
581
|
+
if (w && M.length > 0) {
|
|
582
|
+
for (; M.length > 0 && M[0].trim() === ""; ) M.shift();
|
|
583
|
+
for (; M.length > 0 && M[M.length - 1].trim() === ""; ) M.pop();
|
|
584
|
+
const b = M.join(`
|
|
585
585
|
`);
|
|
586
|
-
|
|
586
|
+
b && (w.note = { text: b });
|
|
587
587
|
}
|
|
588
|
-
|
|
588
|
+
g = !1, M = [];
|
|
589
589
|
}
|
|
590
|
-
for (const
|
|
591
|
-
if (
|
|
592
|
-
const V =
|
|
590
|
+
for (const b of o) {
|
|
591
|
+
if (g) {
|
|
592
|
+
const V = b.match(u);
|
|
593
593
|
if (V && V[1][0] === "`") {
|
|
594
594
|
j();
|
|
595
595
|
continue;
|
|
596
596
|
}
|
|
597
|
-
|
|
597
|
+
H(b);
|
|
598
598
|
continue;
|
|
599
599
|
}
|
|
600
|
-
const z =
|
|
600
|
+
const z = b.match(x);
|
|
601
601
|
if (z) {
|
|
602
|
-
const V = z[1].length,
|
|
603
|
-
d.push({ level: V, text:
|
|
602
|
+
const V = z[1].length, se = z[2].trim();
|
|
603
|
+
d.push({ level: V, text: se, body: "" }), w = d[d.length - 1];
|
|
604
604
|
continue;
|
|
605
605
|
}
|
|
606
|
-
const L =
|
|
606
|
+
const L = b.match(u);
|
|
607
607
|
if (L && L[2] === "note") {
|
|
608
|
-
|
|
608
|
+
g = !0, M = [];
|
|
609
609
|
continue;
|
|
610
610
|
}
|
|
611
|
-
const
|
|
612
|
-
if (
|
|
613
|
-
const V =
|
|
614
|
-
|
|
611
|
+
const $ = b.match(f);
|
|
612
|
+
if ($ && w) {
|
|
613
|
+
const V = $[2], se = 160, ge = 120;
|
|
614
|
+
w.image = { src: V, naturalW: se, naturalH: ge, width: se, height: ge };
|
|
615
615
|
continue;
|
|
616
616
|
}
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
619
|
-
|
|
617
|
+
const J = b.match(v);
|
|
618
|
+
if (J && w) {
|
|
619
|
+
w.link = { url: J[2] }, w.text = J[1];
|
|
620
620
|
continue;
|
|
621
621
|
}
|
|
622
|
-
|
|
622
|
+
b.trim().length > 0 && w && (w.body = w.body ? w.body + " " + b.trim() : b.trim());
|
|
623
623
|
}
|
|
624
|
-
|
|
625
|
-
function
|
|
624
|
+
g && j();
|
|
625
|
+
function Z(b) {
|
|
626
626
|
for (; r.length > 1; ) {
|
|
627
|
-
const
|
|
628
|
-
if (V !== void 0 && V <
|
|
627
|
+
const J = r.length - 1, V = c[J];
|
|
628
|
+
if (V !== void 0 && V < b.level) break;
|
|
629
629
|
r.pop(), c.pop();
|
|
630
630
|
}
|
|
631
|
-
const z = r[r.length - 1], L =
|
|
632
|
-
|
|
631
|
+
const z = r[r.length - 1], L = b.text, $ = { id: ue(), text: L, children: [] };
|
|
632
|
+
b.image && ($.image = { ...b.image }), b.link && ($.link = { url: b.link.url }), b.note && ($.note = { text: b.note.text }), b.body && Y(b, d, d.indexOf(b)) && $.children.push({ id: ue(), text: b.body, children: [] }), z.children.push($), r.push($), c.push(b.level);
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
for (let
|
|
636
|
-
if (z[
|
|
637
|
-
if (z[
|
|
634
|
+
function Y(b, z, L) {
|
|
635
|
+
for (let $ = L + 1; $ < z.length; $++) {
|
|
636
|
+
if (z[$].level <= b.level) return !0;
|
|
637
|
+
if (z[$].level > b.level) return !1;
|
|
638
638
|
}
|
|
639
639
|
return !0;
|
|
640
640
|
}
|
|
641
|
-
for (const
|
|
641
|
+
for (const b of d) Z(b);
|
|
642
642
|
if (d.length > 0 && d[0].level === 1) {
|
|
643
|
-
const
|
|
644
|
-
|
|
643
|
+
const b = n.children[0];
|
|
644
|
+
b && (n.text = b.text, n.id = b.id, b.image && (n.image = { ...b.image }), b.link && (n.link = { url: b.link.url }), b.note && (n.note = { text: b.note.text }), n.children = b.children);
|
|
645
645
|
}
|
|
646
646
|
return n;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function ut(i, s = 1) {
|
|
649
649
|
let o = "#".repeat(s) + " " + (i.text || "") + `
|
|
650
650
|
`;
|
|
651
651
|
i.link && (o += `[${i.text || "link"}](${i.link.url})
|
|
652
652
|
`), i.image && (o += `
|
|
653
653
|
`), i.note && (o += "```note\n" + i.note.text + "\n```\n"), i.richContent && (o += i.richContent.raw + `
|
|
654
654
|
`);
|
|
655
|
-
for (const n of i.children) o +=
|
|
655
|
+
for (const n of i.children) o += ut(n, s + 1);
|
|
656
656
|
return o;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function di(i) {
|
|
659
659
|
var v, u;
|
|
660
660
|
const s = i.split(/\r?\n/), o = [];
|
|
661
661
|
let n = 0;
|
|
662
662
|
const r = /^(#{1,6})\s+(.+?)\s*#*\s*$/, c = /^(`{3,}|~{3,})\s*(\S+)?\s*$/, d = /^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/, x = /^(\s*)[-*+]\s+(.*)$/, f = /^(\s*)\d+\.\s+(.*)$/;
|
|
663
663
|
for (; n < s.length; ) {
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
const z =
|
|
664
|
+
const g = s[n], M = g.match(c);
|
|
665
|
+
if (M) {
|
|
666
|
+
const z = M[1][0], L = M[2] || "", $ = [g];
|
|
667
667
|
for (n++; n < s.length; ) {
|
|
668
668
|
const V = s[n].match(c);
|
|
669
669
|
if (V && V[1][0] === z) {
|
|
670
|
-
|
|
670
|
+
$.push(s[n]), n++;
|
|
671
671
|
break;
|
|
672
672
|
}
|
|
673
|
-
|
|
673
|
+
$.push(s[n]), n++;
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const J = $.slice(1, -1).join(`
|
|
676
676
|
`).trim();
|
|
677
677
|
o.push({
|
|
678
678
|
kind: "code",
|
|
679
|
-
text: ((v =
|
|
679
|
+
text: ((v = J.split(`
|
|
680
680
|
`)[0]) == null ? void 0 : v.slice(0, 80)) || "(空代码块)",
|
|
681
|
-
raw:
|
|
681
|
+
raw: $.join(`
|
|
682
682
|
`),
|
|
683
683
|
lang: L
|
|
684
684
|
});
|
|
685
685
|
continue;
|
|
686
686
|
}
|
|
687
|
-
const
|
|
688
|
-
if (
|
|
689
|
-
o.push({ kind: "heading", level:
|
|
687
|
+
const w = g.match(r);
|
|
688
|
+
if (w) {
|
|
689
|
+
o.push({ kind: "heading", level: w[1].length, text: w[2].trim(), raw: g }), n++;
|
|
690
690
|
continue;
|
|
691
691
|
}
|
|
692
|
-
if (/^\s*\|/.test(
|
|
692
|
+
if (/^\s*\|/.test(g)) {
|
|
693
693
|
const z = [];
|
|
694
|
-
let L = n,
|
|
694
|
+
let L = n, $ = !1;
|
|
695
695
|
for (; L < s.length && /^\s*\|/.test(s[L]); )
|
|
696
|
-
z.push(s[L]), d.test(s[L]) && (
|
|
697
|
-
if (
|
|
696
|
+
z.push(s[L]), d.test(s[L]) && ($ = !0), L++;
|
|
697
|
+
if ($ && z.length >= 2) {
|
|
698
698
|
o.push({
|
|
699
699
|
kind: "table",
|
|
700
700
|
text: ((u = z[0].replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|")[0]) == null ? void 0 : u.trim()) || "表格",
|
|
@@ -704,45 +704,45 @@ function mi(i) {
|
|
|
704
704
|
continue;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
707
|
+
const H = g.match(x), j = g.match(f);
|
|
708
|
+
if (H || j) {
|
|
709
709
|
let z = n;
|
|
710
710
|
for (; z < s.length; ) {
|
|
711
|
-
const L = s[z].match(x),
|
|
712
|
-
if (!(L ||
|
|
713
|
-
const
|
|
714
|
-
|
|
711
|
+
const L = s[z].match(x), $ = s[z].match(f);
|
|
712
|
+
if (!(L || $)) break;
|
|
713
|
+
const J = s[z].replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+\.\s+/, "").trim();
|
|
714
|
+
J.length > 0 && o.push({
|
|
715
715
|
kind: "list",
|
|
716
|
-
text:
|
|
716
|
+
text: J.slice(0, 80) || "(列表项)",
|
|
717
717
|
raw: s[z]
|
|
718
718
|
}), z++;
|
|
719
719
|
}
|
|
720
720
|
n = z;
|
|
721
721
|
continue;
|
|
722
722
|
}
|
|
723
|
-
if (
|
|
723
|
+
if (g.trim() === "") {
|
|
724
724
|
n++;
|
|
725
725
|
continue;
|
|
726
726
|
}
|
|
727
|
-
const
|
|
728
|
-
let
|
|
729
|
-
for (;
|
|
730
|
-
const z = s[
|
|
727
|
+
const Z = [g];
|
|
728
|
+
let Y = n + 1;
|
|
729
|
+
for (; Y < s.length; ) {
|
|
730
|
+
const z = s[Y];
|
|
731
731
|
if (z.trim() === "" || r.test(z) || c.test(z) || x.test(z) || f.test(z) || /^\s*\|/.test(z)) break;
|
|
732
|
-
|
|
732
|
+
Z.push(z), Y++;
|
|
733
733
|
}
|
|
734
|
-
const
|
|
734
|
+
const b = Z.join(" ").trim();
|
|
735
735
|
o.push({
|
|
736
736
|
kind: "paragraph",
|
|
737
|
-
text:
|
|
738
|
-
raw:
|
|
737
|
+
text: b.slice(0, 80) || "(空段落)",
|
|
738
|
+
raw: Z.join(`
|
|
739
739
|
`)
|
|
740
|
-
}), n =
|
|
740
|
+
}), n = Y;
|
|
741
741
|
}
|
|
742
742
|
return o;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
const o =
|
|
744
|
+
function Xi(i, s = "导入的导图") {
|
|
745
|
+
const o = di(i || ""), n = { id: ue(), text: s, children: [] }, r = [n], c = [0];
|
|
746
746
|
let d = !1;
|
|
747
747
|
function x(f) {
|
|
748
748
|
if (f.kind === "heading") {
|
|
@@ -753,12 +753,12 @@ function Zi(i, s = "导入的导图") {
|
|
|
753
753
|
d = !0, n.text = f.text, c[0] = 1;
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
756
|
-
const
|
|
757
|
-
r[r.length - 1].children.push(
|
|
756
|
+
const g = { id: ue(), text: f.text, children: [] };
|
|
757
|
+
r[r.length - 1].children.push(g), r.push(g), c.push(u);
|
|
758
758
|
return;
|
|
759
759
|
}
|
|
760
760
|
const v = {
|
|
761
|
-
id:
|
|
761
|
+
id: ue(),
|
|
762
762
|
text: f.text,
|
|
763
763
|
children: [],
|
|
764
764
|
richContent: { kind: f.kind, raw: f.raw, lang: f.lang }
|
|
@@ -768,37 +768,37 @@ function Zi(i, s = "导入的导图") {
|
|
|
768
768
|
for (const f of o) x(f);
|
|
769
769
|
return n;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function qi(i) {
|
|
772
772
|
return i.richContent ? i.richContent.raw + `
|
|
773
773
|
` : "";
|
|
774
774
|
}
|
|
775
|
-
function
|
|
776
|
-
const s = i.minScale ?? 0.2, o = i.maxScale ?? 3, n = i.step ?? 1.2, r =
|
|
775
|
+
function fi(i) {
|
|
776
|
+
const s = i.minScale ?? 0.2, o = i.maxScale ?? 3, n = i.step ?? 1.2, r = O(1), c = O(0), d = O(0), x = O(!1), f = je({
|
|
777
777
|
x: 0,
|
|
778
778
|
y: 0,
|
|
779
779
|
ox: 0,
|
|
780
780
|
oy: 0
|
|
781
|
-
}), v =
|
|
782
|
-
let
|
|
783
|
-
function
|
|
784
|
-
|
|
781
|
+
}), v = O(!1), u = je({ x: 0, y: 0 }), g = je({ x: 0, y: 0, width: 0, height: 0 }), M = O(0);
|
|
782
|
+
let w = null;
|
|
783
|
+
function H(W) {
|
|
784
|
+
w = W;
|
|
785
785
|
}
|
|
786
786
|
function j(W) {
|
|
787
787
|
W.preventDefault();
|
|
788
|
-
const
|
|
789
|
-
if (!
|
|
790
|
-
const
|
|
791
|
-
r.value = ne, c.value = re - Re * ne, d.value =
|
|
788
|
+
const R = i.getContainer();
|
|
789
|
+
if (!R) return;
|
|
790
|
+
const Q = -W.deltaY * 1e-3, ne = Math.min(o, Math.max(s, r.value * (1 + Q))), le = R.getBoundingClientRect(), re = W.clientX - le.left, ke = W.clientY - le.top, Re = (re - c.value) / r.value, Me = (ke - d.value) / r.value;
|
|
791
|
+
r.value = ne, c.value = re - Re * ne, d.value = ke - Me * ne;
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function Z() {
|
|
794
794
|
r.value = Math.min(o, r.value * n);
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function Y() {
|
|
797
797
|
r.value = Math.max(s, r.value / n);
|
|
798
798
|
}
|
|
799
|
-
function
|
|
800
|
-
var
|
|
801
|
-
W.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, f.x = W.clientX, f.y = W.clientY, f.ox = c.value, f.oy = d.value, window.addEventListener("mousemove", z), window.addEventListener("mouseup", L), (
|
|
799
|
+
function b(W) {
|
|
800
|
+
var Q;
|
|
801
|
+
W.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, f.x = W.clientX, f.y = W.clientY, f.ox = c.value, f.oy = d.value, window.addEventListener("mousemove", z), window.addEventListener("mouseup", L), (Q = W.preventDefault) == null || Q.call(W));
|
|
802
802
|
}
|
|
803
803
|
function z(W) {
|
|
804
804
|
x.value && (c.value = f.ox + (W.clientX - f.x), d.value = f.oy + (W.clientY - f.y));
|
|
@@ -806,29 +806,29 @@ function gi(i) {
|
|
|
806
806
|
function L() {
|
|
807
807
|
x.value = !1, window.removeEventListener("mousemove", z), window.removeEventListener("mouseup", L);
|
|
808
808
|
}
|
|
809
|
-
function
|
|
810
|
-
v.value = !0, u.x = W, u.y =
|
|
809
|
+
function $(W, R) {
|
|
810
|
+
v.value = !0, u.x = W, u.y = R, g.x = W, g.y = R, g.width = 0, g.height = 0, M.value++, window.addEventListener("mousemove", se), window.addEventListener("mouseup", V);
|
|
811
811
|
}
|
|
812
|
-
function
|
|
812
|
+
function J(W, R) {
|
|
813
813
|
if (!v.value) return;
|
|
814
|
-
const
|
|
815
|
-
|
|
814
|
+
const Q = Math.min(u.x, W), ne = Math.min(u.y, R), le = Math.max(u.x, W), re = Math.max(u.y, R);
|
|
815
|
+
g.x = Q, g.y = ne, g.width = le - Q, g.height = re - ne, M.value++;
|
|
816
816
|
}
|
|
817
817
|
function V() {
|
|
818
|
-
v.value = !1, window.removeEventListener("mousemove",
|
|
818
|
+
v.value = !1, window.removeEventListener("mousemove", se), window.removeEventListener("mouseup", V), w && w();
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function se(W) {
|
|
821
821
|
if (!v.value) return;
|
|
822
|
-
const
|
|
823
|
-
if (!
|
|
824
|
-
const
|
|
825
|
-
|
|
822
|
+
const R = i.getContainer();
|
|
823
|
+
if (!R) return;
|
|
824
|
+
const Q = R.getBoundingClientRect(), ne = (W.clientX - Q.left - c.value) / r.value, le = (W.clientY - Q.top - d.value) / r.value;
|
|
825
|
+
J(ne, le);
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function ge(W, R, Q, ne = 60) {
|
|
828
828
|
const le = i.getContainer();
|
|
829
829
|
if (!le) return;
|
|
830
|
-
const re = le.getBoundingClientRect(),
|
|
831
|
-
r.value =
|
|
830
|
+
const re = le.getBoundingClientRect(), ke = (re.width - ne * 2) / W, Re = (re.height - ne * 2) / R, Me = Math.min(1, Math.max(0.3, Math.min(ke, Re)));
|
|
831
|
+
r.value = Me, c.value = re.width / 2, d.value = re.height / 2 - Q * Me;
|
|
832
832
|
}
|
|
833
833
|
return {
|
|
834
834
|
scale: r,
|
|
@@ -836,23 +836,23 @@ function gi(i) {
|
|
|
836
836
|
offsetY: d,
|
|
837
837
|
isPanning: x,
|
|
838
838
|
onWheel: j,
|
|
839
|
-
zoomIn:
|
|
840
|
-
zoomOut:
|
|
841
|
-
startPan:
|
|
842
|
-
startMarquee:
|
|
843
|
-
updateMarquee:
|
|
839
|
+
zoomIn: Z,
|
|
840
|
+
zoomOut: Y,
|
|
841
|
+
startPan: b,
|
|
842
|
+
startMarquee: $,
|
|
843
|
+
updateMarquee: J,
|
|
844
844
|
isMarquee: v,
|
|
845
|
-
marquee:
|
|
846
|
-
marqueeVersion:
|
|
847
|
-
setOnMarqueeEnd:
|
|
848
|
-
resetView:
|
|
845
|
+
marquee: g,
|
|
846
|
+
marqueeVersion: M,
|
|
847
|
+
setOnMarqueeEnd: H,
|
|
848
|
+
resetView: ge
|
|
849
849
|
};
|
|
850
850
|
}
|
|
851
|
-
const
|
|
851
|
+
const hi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
852
852
|
function qt(i) {
|
|
853
|
-
return
|
|
853
|
+
return hi ? i.metaKey : i.ctrlKey;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function vi(i) {
|
|
856
856
|
function s() {
|
|
857
857
|
const n = i.getSelectedId();
|
|
858
858
|
return n || (i.defaultTargetId ? i.defaultTargetId() : i.getRootId());
|
|
@@ -887,14 +887,14 @@ function xi(i) {
|
|
|
887
887
|
n.key === "Tab" ? (n.preventDefault(), i.onAddChild(d)) : n.key === "Enter" ? (n.preventDefault(), n.shiftKey ? c && c !== i.getRootId() && i.onAddSiblingBefore(c) : i.onAddSibling(d)) : (n.key === "Delete" || n.key === "Backspace") && c && c !== i.getRootId() ? (n.preventDefault(), i.onRemove(c)) : n.key === "F2" && c ? (n.preventDefault(), i.onStartEdit(c)) : n.key === "Escape" ? (n.preventDefault(), i.onClearSelection()) : n.key === "ArrowDown" ? (n.preventDefault(), i.onNavigate(0, 1)) : n.key === "ArrowUp" ? (n.preventDefault(), i.onNavigate(0, -1)) : n.key === "ArrowRight" ? (n.preventDefault(), i.onNavigate(1, 0)) : n.key === "ArrowLeft" && (n.preventDefault(), i.onNavigate(-1, 0));
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
|
-
|
|
890
|
+
st(() => {
|
|
891
891
|
window.addEventListener("keydown", o);
|
|
892
|
-
}),
|
|
892
|
+
}), dt(() => {
|
|
893
893
|
window.removeEventListener("keydown", o);
|
|
894
894
|
});
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
const s =
|
|
896
|
+
function mi(i = 100) {
|
|
897
|
+
const s = O([]);
|
|
898
898
|
let o = -1;
|
|
899
899
|
function n() {
|
|
900
900
|
return o > 0;
|
|
@@ -925,7 +925,7 @@ function pi(i = 100) {
|
|
|
925
925
|
reset: f
|
|
926
926
|
};
|
|
927
927
|
}
|
|
928
|
-
const
|
|
928
|
+
const gi = ["disabled"], yi = ["disabled"], xi = ["disabled"], pi = ["disabled"], wi = ["disabled"], bi = ["disabled"], ki = /* @__PURE__ */ ct({
|
|
929
929
|
__name: "NodeContextMenu",
|
|
930
930
|
props: {
|
|
931
931
|
x: {},
|
|
@@ -939,125 +939,113 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
939
939
|
emits: ["pickImage", "setLink", "removeLink", "editNote", "removeNote", "removeImage", "close"],
|
|
940
940
|
setup(i, { emit: s }) {
|
|
941
941
|
const o = i, n = s, r = te(() => {
|
|
942
|
-
let
|
|
942
|
+
let M = o.x + 2, w = o.y + 2;
|
|
943
943
|
if (o.container) {
|
|
944
|
-
const
|
|
945
|
-
|
|
944
|
+
const H = o.container.getBoundingClientRect(), j = 180, Z = c.value ? d.value ? 184 : 160 : 136;
|
|
945
|
+
M + j > H.right && (M = Math.max(H.left + 4, o.x - j - 2)), w + Z > H.bottom && (w = Math.max(H.top + 4, o.y - Z - 2)), M < H.left + 2 && (M = H.left + 2), w < H.top + 2 && (w = H.top + 2);
|
|
946
946
|
}
|
|
947
|
-
return { left:
|
|
947
|
+
return { left: M, top: w };
|
|
948
948
|
}), c = te(() => o.hasImage), d = te(() => o.hasLink), x = te(() => o.hasNote);
|
|
949
|
-
function f(
|
|
950
|
-
const
|
|
951
|
-
|
|
949
|
+
function f(M) {
|
|
950
|
+
const w = M.target;
|
|
951
|
+
w && w.closest(".zm-node-menu") || n("close");
|
|
952
952
|
}
|
|
953
|
-
function v(
|
|
954
|
-
|
|
953
|
+
function v(M) {
|
|
954
|
+
M.key === "Escape" && n("close");
|
|
955
955
|
}
|
|
956
956
|
function u() {
|
|
957
957
|
n("close");
|
|
958
958
|
}
|
|
959
|
-
window.addEventListener("mousedown", f, !0), window.addEventListener("keydown", v, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0),
|
|
959
|
+
window.addEventListener("mousedown", f, !0), window.addEventListener("keydown", v, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0), dt(() => {
|
|
960
960
|
window.removeEventListener("mousedown", f, !0), window.removeEventListener("keydown", v, !0), window.removeEventListener("wheel", u, !0), window.removeEventListener("scroll", u, !0);
|
|
961
961
|
});
|
|
962
|
-
function
|
|
963
|
-
o.readonly || (
|
|
962
|
+
function g(M) {
|
|
963
|
+
o.readonly || (M(), n("close"));
|
|
964
964
|
}
|
|
965
|
-
return (
|
|
965
|
+
return (M, w) => (C(), E("div", {
|
|
966
966
|
class: "zm-node-menu",
|
|
967
|
-
style:
|
|
968
|
-
onContextmenu:
|
|
967
|
+
style: ve({ left: r.value.left + "px", top: r.value.top + "px" }),
|
|
968
|
+
onContextmenu: w[6] || (w[6] = D(() => {
|
|
969
969
|
}, ["prevent"]))
|
|
970
970
|
}, [
|
|
971
971
|
p("button", {
|
|
972
972
|
class: "zm-node-menu-item",
|
|
973
973
|
disabled: i.readonly,
|
|
974
|
-
onClick:
|
|
974
|
+
onClick: w[0] || (w[0] = D((H) => g(() => n("pickImage")), ["stop"]))
|
|
975
975
|
}, [
|
|
976
|
-
U
|
|
976
|
+
q(U, {
|
|
977
977
|
name: "image",
|
|
978
978
|
size: 13
|
|
979
979
|
}),
|
|
980
|
-
p("span", null,
|
|
981
|
-
], 8,
|
|
982
|
-
c.value ? (
|
|
980
|
+
p("span", null, be(c.value ? "替换图片" : "添加图片"), 1)
|
|
981
|
+
], 8, gi),
|
|
982
|
+
c.value ? (C(), E("button", {
|
|
983
983
|
key: 0,
|
|
984
984
|
class: "zm-node-menu-item",
|
|
985
985
|
disabled: i.readonly,
|
|
986
|
-
onClick:
|
|
986
|
+
onClick: w[1] || (w[1] = D((H) => g(() => n("removeImage")), ["stop"]))
|
|
987
987
|
}, [
|
|
988
|
-
U
|
|
988
|
+
q(U, {
|
|
989
989
|
name: "x",
|
|
990
990
|
size: 13
|
|
991
991
|
}),
|
|
992
|
-
|
|
993
|
-
], 8,
|
|
992
|
+
w[7] || (w[7] = p("span", null, "移除图片", -1))
|
|
993
|
+
], 8, yi)) : X("", !0),
|
|
994
994
|
p("button", {
|
|
995
995
|
class: "zm-node-menu-item",
|
|
996
996
|
disabled: i.readonly,
|
|
997
|
-
onClick:
|
|
997
|
+
onClick: w[2] || (w[2] = D((H) => g(() => n("setLink")), ["stop"]))
|
|
998
998
|
}, [
|
|
999
|
-
U
|
|
999
|
+
q(U, {
|
|
1000
1000
|
name: "link",
|
|
1001
1001
|
size: 13
|
|
1002
1002
|
}),
|
|
1003
|
-
p("span", null,
|
|
1004
|
-
], 8,
|
|
1005
|
-
d.value ? (
|
|
1003
|
+
p("span", null, be(d.value ? "编辑链接" : "添加链接"), 1)
|
|
1004
|
+
], 8, xi),
|
|
1005
|
+
d.value ? (C(), E("button", {
|
|
1006
1006
|
key: 1,
|
|
1007
1007
|
class: "zm-node-menu-item",
|
|
1008
1008
|
disabled: i.readonly,
|
|
1009
|
-
onClick:
|
|
1009
|
+
onClick: w[3] || (w[3] = D((H) => g(() => n("removeLink")), ["stop"]))
|
|
1010
1010
|
}, [
|
|
1011
|
-
U
|
|
1011
|
+
q(U, {
|
|
1012
1012
|
name: "x",
|
|
1013
1013
|
size: 13
|
|
1014
1014
|
}),
|
|
1015
|
-
|
|
1016
|
-
], 8,
|
|
1015
|
+
w[8] || (w[8] = p("span", null, "移除链接", -1))
|
|
1016
|
+
], 8, pi)) : X("", !0),
|
|
1017
1017
|
p("button", {
|
|
1018
1018
|
class: "zm-node-menu-item",
|
|
1019
1019
|
disabled: i.readonly,
|
|
1020
|
-
onClick:
|
|
1020
|
+
onClick: w[4] || (w[4] = D((H) => g(() => n("editNote")), ["stop"]))
|
|
1021
1021
|
}, [
|
|
1022
|
-
U
|
|
1022
|
+
q(U, {
|
|
1023
1023
|
name: "note",
|
|
1024
1024
|
size: 13
|
|
1025
1025
|
}),
|
|
1026
|
-
p("span", null,
|
|
1027
|
-
], 8,
|
|
1028
|
-
x.value ? (
|
|
1026
|
+
p("span", null, be(x.value ? "编辑笔记" : "添加笔记"), 1)
|
|
1027
|
+
], 8, wi),
|
|
1028
|
+
x.value ? (C(), E("button", {
|
|
1029
1029
|
key: 2,
|
|
1030
1030
|
class: "zm-node-menu-item",
|
|
1031
1031
|
disabled: i.readonly,
|
|
1032
|
-
onClick:
|
|
1032
|
+
onClick: w[5] || (w[5] = D((H) => g(() => n("removeNote")), ["stop"]))
|
|
1033
1033
|
}, [
|
|
1034
|
-
U
|
|
1034
|
+
q(U, {
|
|
1035
1035
|
name: "x",
|
|
1036
1036
|
size: 13
|
|
1037
1037
|
}),
|
|
1038
|
-
|
|
1039
|
-
], 8,
|
|
1038
|
+
w[9] || (w[9] = p("span", null, "移除笔记", -1))
|
|
1039
|
+
], 8, bi)) : X("", !0)
|
|
1040
1040
|
], 36));
|
|
1041
1041
|
}
|
|
1042
|
-
}),
|
|
1042
|
+
}), Mi = ["viewBox", "width", "height"], Ci = { class: "zm-edges" }, Ei = ["d", "fill"], Si = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], zi = ["src", "width", "height", "alt"], Ni = {
|
|
1043
1043
|
key: 1,
|
|
1044
1044
|
class: "zm-text"
|
|
1045
|
-
},
|
|
1046
|
-
key: 0,
|
|
1047
|
-
class: "zm-rich-code"
|
|
1048
|
-
}, Di = {
|
|
1049
|
-
key: 1,
|
|
1050
|
-
class: "zm-rich-list"
|
|
1051
|
-
}, Pi = {
|
|
1052
|
-
key: 2,
|
|
1053
|
-
class: "zm-rich-table"
|
|
1054
|
-
}, Ti = {
|
|
1055
|
-
key: 3,
|
|
1056
|
-
class: "zm-rich-paragraph"
|
|
1057
|
-
}, Oi = ["title"], Fi = ["title", "onClick"], Vi = ["onClick"], Xi = ["onMousedown"], qi = ["onClick"], Ui = {
|
|
1045
|
+
}, Ii = { class: "zm-text-label" }, Wi = ["href", "title"], $i = ["title", "onClick"], Ri = ["title"], Bi = ["title", "onClick"], Li = ["onClick"], Ai = ["onMousedown"], Hi = ["onClick"], Di = {
|
|
1058
1046
|
key: 0,
|
|
1059
1047
|
class: "zm-toolbar"
|
|
1060
|
-
},
|
|
1048
|
+
}, Pi = ["src"], Ti = ["src"], Oi = { class: "zm-tb-tip" }, We = 24, De = 400, we = 160, Fi = /* @__PURE__ */ ct({
|
|
1061
1049
|
__name: "MindMap",
|
|
1062
1050
|
props: {
|
|
1063
1051
|
data: {},
|
|
@@ -1069,135 +1057,135 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1069
1057
|
},
|
|
1070
1058
|
emits: ["change", "select", "edit-note", "markdownChange"],
|
|
1071
1059
|
setup(i, { expose: s, emit: o }) {
|
|
1072
|
-
const n = i, r = o, c =
|
|
1073
|
-
let
|
|
1074
|
-
|
|
1060
|
+
const n = i, r = o, c = O(null), d = O(null), x = O(""), f = O(null), v = O(/* @__PURE__ */ new Set()), u = O(me(n.data)), g = O(n.markdown !== void 0);
|
|
1061
|
+
let M = !1;
|
|
1062
|
+
Ue(
|
|
1075
1063
|
() => n.markdown,
|
|
1076
1064
|
(e) => {
|
|
1077
1065
|
if (e === void 0) {
|
|
1078
|
-
|
|
1066
|
+
g.value = !1;
|
|
1079
1067
|
return;
|
|
1080
1068
|
}
|
|
1081
|
-
|
|
1069
|
+
g.value = !0;
|
|
1082
1070
|
const t = Xt(e || "");
|
|
1083
|
-
|
|
1084
|
-
|
|
1071
|
+
M = !0, u.value = me(t), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), ee(() => {
|
|
1072
|
+
M = !1, de();
|
|
1085
1073
|
});
|
|
1086
1074
|
}
|
|
1087
|
-
),
|
|
1075
|
+
), Ue(
|
|
1088
1076
|
u,
|
|
1089
1077
|
() => {
|
|
1090
|
-
|
|
1078
|
+
g.value && !M && r("markdownChange", ut(u.value));
|
|
1091
1079
|
},
|
|
1092
1080
|
{ deep: !0 }
|
|
1093
1081
|
);
|
|
1094
|
-
const
|
|
1095
|
-
function
|
|
1082
|
+
const w = te(() => k.showOrderBadge === !0), H = O(/* @__PURE__ */ new Map()), j = H.value;
|
|
1083
|
+
function Z(e, t) {
|
|
1096
1084
|
const a = {};
|
|
1097
|
-
t.bg && (a.bg = t.bg), t.textColor && (a.textColor = t.textColor), t.borderColor && (a.borderColor = t.borderColor), t.fontWeight && (a.fontWeight = t.fontWeight), Object.keys(a).length === 0 ? j.delete(e) : j.set(e, a),
|
|
1085
|
+
t.bg && (a.bg = t.bg), t.textColor && (a.textColor = t.textColor), t.borderColor && (a.borderColor = t.borderColor), t.fontWeight && (a.fontWeight = t.fontWeight), Object.keys(a).length === 0 ? j.delete(e) : j.set(e, a), H.value = new Map(j);
|
|
1098
1086
|
}
|
|
1099
|
-
function
|
|
1087
|
+
function Y(e) {
|
|
1100
1088
|
return j.get(e) ?? {};
|
|
1101
1089
|
}
|
|
1102
|
-
function
|
|
1090
|
+
function b(e, t) {
|
|
1103
1091
|
const a = A(u.value, e);
|
|
1104
1092
|
a && (a.image = {
|
|
1105
1093
|
src: t.src,
|
|
1106
1094
|
naturalW: t.naturalW,
|
|
1107
1095
|
naturalH: t.naturalH,
|
|
1108
|
-
width: L(t.width,
|
|
1109
|
-
height: L(t.height,
|
|
1110
|
-
}, G(),
|
|
1096
|
+
width: L(t.width, We, De),
|
|
1097
|
+
height: L(t.height, We, De)
|
|
1098
|
+
}, G(), T(), r("change", u.value));
|
|
1111
1099
|
}
|
|
1112
1100
|
function z(e) {
|
|
1113
1101
|
const t = A(u.value, e);
|
|
1114
|
-
!t || !t.image || (delete t.image, G(),
|
|
1102
|
+
!t || !t.image || (delete t.image, G(), T(), r("change", u.value));
|
|
1115
1103
|
}
|
|
1116
1104
|
function L(e, t, a) {
|
|
1117
1105
|
return Math.min(a, Math.max(t, e));
|
|
1118
1106
|
}
|
|
1119
|
-
function
|
|
1107
|
+
function $(e, t) {
|
|
1120
1108
|
const a = new FileReader();
|
|
1121
1109
|
a.onload = () => {
|
|
1122
1110
|
if (typeof a.result != "string") return;
|
|
1123
1111
|
const m = a.result, h = new window.Image();
|
|
1124
1112
|
h.onload = () => {
|
|
1125
|
-
const l = h.naturalWidth ||
|
|
1126
|
-
t({ src: m, naturalW: l, naturalH:
|
|
1113
|
+
const l = h.naturalWidth || we, y = h.naturalHeight || we, B = L(l, We, we), K = L(Math.round(y * B / l), We, De);
|
|
1114
|
+
t({ src: m, naturalW: l, naturalH: y, width: B, height: K });
|
|
1127
1115
|
}, h.onerror = () => {
|
|
1128
|
-
t({ src: m, naturalW:
|
|
1116
|
+
t({ src: m, naturalW: we, naturalH: we, width: we, height: we });
|
|
1129
1117
|
}, h.src = m;
|
|
1130
1118
|
}, a.readAsDataURL(e);
|
|
1131
1119
|
}
|
|
1132
|
-
function
|
|
1120
|
+
function J(e) {
|
|
1133
1121
|
const t = document.createElement("input");
|
|
1134
1122
|
t.type = "file", t.accept = "image/*", t.style.display = "none", t.onchange = () => {
|
|
1135
1123
|
var m;
|
|
1136
1124
|
const a = (m = t.files) == null ? void 0 : m[0];
|
|
1137
|
-
a && (
|
|
1125
|
+
a && ($(a, (h) => b(e, h)), document.body.removeChild(t));
|
|
1138
1126
|
}, document.body.appendChild(t), t.click();
|
|
1139
1127
|
}
|
|
1140
1128
|
function V(e, t) {
|
|
1141
1129
|
const a = t.trim(), m = A(u.value, e);
|
|
1142
|
-
m && (a ? m.link = { url: a } : delete m.link, G(),
|
|
1130
|
+
m && (a ? m.link = { url: a } : delete m.link, G(), T(), r("change", u.value));
|
|
1143
1131
|
}
|
|
1144
|
-
function
|
|
1132
|
+
function se(e) {
|
|
1145
1133
|
V(e, "");
|
|
1146
1134
|
}
|
|
1147
|
-
function
|
|
1135
|
+
function ge(e, t) {
|
|
1148
1136
|
const a = A(u.value, e);
|
|
1149
|
-
a && (t ? a.note = { text: t } : delete a.note, G(),
|
|
1137
|
+
a && (t ? a.note = { text: t } : delete a.note, G(), T(), r("change", u.value));
|
|
1150
1138
|
}
|
|
1151
1139
|
function W(e) {
|
|
1152
|
-
|
|
1140
|
+
ge(e, "");
|
|
1153
1141
|
}
|
|
1154
|
-
const
|
|
1155
|
-
function
|
|
1156
|
-
n.readonly || (e.preventDefault(), e.stopPropagation(), f.value = t.id, r("select", A(u.value, t.id)),
|
|
1142
|
+
const R = O(null);
|
|
1143
|
+
function Q(e, t) {
|
|
1144
|
+
n.readonly || (e.preventDefault(), e.stopPropagation(), f.value = t.id, r("select", A(u.value, t.id)), R.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
|
|
1157
1145
|
}
|
|
1158
1146
|
function ne() {
|
|
1159
|
-
|
|
1147
|
+
R.value = null;
|
|
1160
1148
|
}
|
|
1161
1149
|
function le() {
|
|
1162
1150
|
var t;
|
|
1163
|
-
const e = (t =
|
|
1164
|
-
e &&
|
|
1151
|
+
const e = (t = R.value) == null ? void 0 : t.nodeId;
|
|
1152
|
+
e && J(e);
|
|
1165
1153
|
}
|
|
1166
1154
|
function re() {
|
|
1167
1155
|
var m, h, l;
|
|
1168
|
-
const e = (m =
|
|
1156
|
+
const e = (m = R.value) == null ? void 0 : m.nodeId;
|
|
1169
1157
|
if (!e) return;
|
|
1170
1158
|
const t = ((l = (h = A(u.value, e)) == null ? void 0 : h.link) == null ? void 0 : l.url) ?? "", a = window.prompt("输入链接 URL(留空取消)", t);
|
|
1171
1159
|
a !== null && V(e, a);
|
|
1172
1160
|
}
|
|
1173
|
-
function
|
|
1161
|
+
function ke() {
|
|
1174
1162
|
var t;
|
|
1175
|
-
const e = (t =
|
|
1176
|
-
e &&
|
|
1163
|
+
const e = (t = R.value) == null ? void 0 : t.nodeId;
|
|
1164
|
+
e && se(e);
|
|
1177
1165
|
}
|
|
1178
1166
|
function Re() {
|
|
1179
1167
|
var t;
|
|
1180
|
-
const e = (t =
|
|
1181
|
-
e &&
|
|
1168
|
+
const e = (t = R.value) == null ? void 0 : t.nodeId;
|
|
1169
|
+
e && ht(e);
|
|
1182
1170
|
}
|
|
1183
|
-
function
|
|
1171
|
+
function Me() {
|
|
1184
1172
|
var t;
|
|
1185
|
-
const e = (t =
|
|
1173
|
+
const e = (t = R.value) == null ? void 0 : t.nodeId;
|
|
1186
1174
|
e && W(e);
|
|
1187
1175
|
}
|
|
1188
1176
|
function Zt() {
|
|
1189
1177
|
var t;
|
|
1190
|
-
const e = (t =
|
|
1178
|
+
const e = (t = R.value) == null ? void 0 : t.nodeId;
|
|
1191
1179
|
e && z(e);
|
|
1192
1180
|
}
|
|
1193
|
-
function
|
|
1181
|
+
function ht(e) {
|
|
1194
1182
|
n.readonly || r("edit-note", e);
|
|
1195
1183
|
}
|
|
1196
1184
|
function Qt(e, t = 60) {
|
|
1197
1185
|
const a = e.replace(/\s+/g, " ").trim();
|
|
1198
1186
|
return a.length <= t ? a || "点击编辑笔记" : a.slice(0, t) + "…";
|
|
1199
1187
|
}
|
|
1200
|
-
function
|
|
1188
|
+
function vt(e) {
|
|
1201
1189
|
var h;
|
|
1202
1190
|
if (n.readonly || d.value) return;
|
|
1203
1191
|
const t = e.target;
|
|
@@ -1208,25 +1196,25 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1208
1196
|
const m = (h = e.clipboardData) == null ? void 0 : h.items;
|
|
1209
1197
|
if (m)
|
|
1210
1198
|
for (let l = 0; l < m.length; l++) {
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
if (
|
|
1199
|
+
const y = m[l];
|
|
1200
|
+
if (y.kind === "file" && y.type.startsWith("image/")) {
|
|
1201
|
+
const B = y.getAsFile();
|
|
1202
|
+
if (!B) continue;
|
|
1215
1203
|
e.preventDefault();
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1204
|
+
const K = A(u.value, a);
|
|
1205
|
+
if (K != null && K.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
|
|
1218
1206
|
return;
|
|
1219
|
-
|
|
1207
|
+
$(B, (_) => b(a, _));
|
|
1220
1208
|
return;
|
|
1221
1209
|
}
|
|
1222
1210
|
}
|
|
1223
1211
|
}
|
|
1224
|
-
|
|
1225
|
-
window.addEventListener("paste",
|
|
1226
|
-
}),
|
|
1227
|
-
window.removeEventListener("paste",
|
|
1212
|
+
st(() => {
|
|
1213
|
+
window.addEventListener("paste", vt);
|
|
1214
|
+
}), dt(() => {
|
|
1215
|
+
window.removeEventListener("paste", vt);
|
|
1228
1216
|
});
|
|
1229
|
-
const Be =
|
|
1217
|
+
const Be = O(null), _t = te(() => {
|
|
1230
1218
|
var e;
|
|
1231
1219
|
return ((e = Be.value) == null ? void 0 : e.nodeId) ?? null;
|
|
1232
1220
|
});
|
|
@@ -1245,52 +1233,52 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1245
1233
|
ratio: h,
|
|
1246
1234
|
pendingW: t.image.width,
|
|
1247
1235
|
pendingH: t.image.height
|
|
1248
|
-
}, window.addEventListener("mousemove",
|
|
1236
|
+
}, window.addEventListener("mousemove", mt), window.addEventListener("mouseup", gt);
|
|
1249
1237
|
}
|
|
1250
|
-
function
|
|
1251
|
-
var
|
|
1238
|
+
function mt(e) {
|
|
1239
|
+
var K, _;
|
|
1252
1240
|
const t = Be.value;
|
|
1253
1241
|
if (!t) return;
|
|
1254
|
-
const a = S.scale.value || 1, m = e.clientX - t.startX, h = L(t.startW + m / a,
|
|
1242
|
+
const a = S.scale.value || 1, m = e.clientX - t.startX, h = L(t.startW + m / a, We, De), l = L(h * t.ratio, We, De);
|
|
1255
1243
|
t.pendingW = h, t.pendingH = l;
|
|
1256
|
-
const
|
|
1244
|
+
const y = (K = c.value) == null ? void 0 : K.querySelector(
|
|
1257
1245
|
`[data-node-id="${t.nodeId}"] .zm-node-img`
|
|
1258
1246
|
);
|
|
1259
|
-
|
|
1260
|
-
const
|
|
1247
|
+
y && (y.style.width = `${h}px`, y.style.height = `${l}px`);
|
|
1248
|
+
const B = (_ = c.value) == null ? void 0 : _.querySelector(
|
|
1261
1249
|
`[data-node-id="${t.nodeId}"]`
|
|
1262
1250
|
);
|
|
1263
|
-
|
|
1251
|
+
B && (B.style.minWidth = `${Math.max(80, Math.ceil(h + 28))}px`, B.style.height = `${Math.ceil(l + 8 + 30)}px`);
|
|
1264
1252
|
}
|
|
1265
|
-
function
|
|
1253
|
+
function gt() {
|
|
1266
1254
|
const e = Be.value;
|
|
1267
|
-
if (window.removeEventListener("mousemove",
|
|
1255
|
+
if (window.removeEventListener("mousemove", mt), window.removeEventListener("mouseup", gt), Be.value = null, !e) return;
|
|
1268
1256
|
const t = A(u.value, e.nodeId);
|
|
1269
|
-
!t || !t.image || (
|
|
1257
|
+
!t || !t.image || (b(e.nodeId, {
|
|
1270
1258
|
src: t.image.src,
|
|
1271
1259
|
naturalW: t.image.naturalW,
|
|
1272
1260
|
naturalH: t.image.naturalH,
|
|
1273
1261
|
width: e.pendingW,
|
|
1274
1262
|
height: e.pendingH
|
|
1275
|
-
}), f.value = e.nodeId, r("select", t),
|
|
1263
|
+
}), f.value = e.nodeId, r("select", t), _e = !0);
|
|
1276
1264
|
}
|
|
1277
|
-
const
|
|
1278
|
-
let
|
|
1265
|
+
const Qe = O(null);
|
|
1266
|
+
let _e = !1;
|
|
1279
1267
|
function tn(e) {
|
|
1280
|
-
|
|
1268
|
+
Qe.value = e;
|
|
1281
1269
|
}
|
|
1282
1270
|
function nn(e) {
|
|
1283
|
-
|
|
1271
|
+
Qe.value === e && (Qe.value = null);
|
|
1284
1272
|
}
|
|
1285
|
-
const
|
|
1273
|
+
const yt = O(0), et = O(!1), he = mi(100);
|
|
1286
1274
|
function G() {
|
|
1287
|
-
|
|
1275
|
+
he.record({ data: u.value });
|
|
1288
1276
|
}
|
|
1289
|
-
function
|
|
1290
|
-
v.value = new Set(v.value),
|
|
1277
|
+
function T() {
|
|
1278
|
+
v.value = new Set(v.value), yt.value++;
|
|
1291
1279
|
}
|
|
1292
1280
|
const ae = te(() => {
|
|
1293
|
-
var e, t, a, m, h, l,
|
|
1281
|
+
var e, t, a, m, h, l, y, B, K, _;
|
|
1294
1282
|
return {
|
|
1295
1283
|
rootBg: ((e = n.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
|
|
1296
1284
|
rootText: ((t = n.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
|
|
@@ -1298,12 +1286,12 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1298
1286
|
branchText: ((m = n.theme) == null ? void 0 : m.branchText) ?? "#1f2937",
|
|
1299
1287
|
lineColor: ((h = n.theme) == null ? void 0 : h.lineColor) ?? "#94a3b8",
|
|
1300
1288
|
bgColor: ((l = n.theme) == null ? void 0 : l.bgColor) ?? "#f8fafc",
|
|
1301
|
-
fontSize: ((
|
|
1302
|
-
lineWidthStart: ((
|
|
1303
|
-
lineWidthEnd: ((
|
|
1304
|
-
rainbowBranch: ((
|
|
1289
|
+
fontSize: ((y = n.theme) == null ? void 0 : y.fontSize) ?? 14,
|
|
1290
|
+
lineWidthStart: ((B = n.theme) == null ? void 0 : B.lineWidthStart) ?? 2.2,
|
|
1291
|
+
lineWidthEnd: ((K = n.theme) == null ? void 0 : K.lineWidthEnd) ?? 0.8,
|
|
1292
|
+
rainbowBranch: ((_ = n.theme) == null ? void 0 : _.rainbowBranch) ?? !1
|
|
1305
1293
|
};
|
|
1306
|
-
}),
|
|
1294
|
+
}), k = je({
|
|
1307
1295
|
autoBalanceOnChange: !0,
|
|
1308
1296
|
lineWidthStart: 12,
|
|
1309
1297
|
lineWidthEnd: 3.6,
|
|
@@ -1315,123 +1303,123 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1315
1303
|
taperedEdge: !0,
|
|
1316
1304
|
showOrderBadge: !1
|
|
1317
1305
|
});
|
|
1318
|
-
function
|
|
1319
|
-
return
|
|
1306
|
+
function xt(e) {
|
|
1307
|
+
return k.taperedEdge ? on(e) : wt(e);
|
|
1320
1308
|
}
|
|
1321
|
-
function
|
|
1322
|
-
return
|
|
1309
|
+
function pt(e) {
|
|
1310
|
+
return k.taperedEdge ? k.lineWidthEnd : wt(e);
|
|
1323
1311
|
}
|
|
1324
1312
|
function on(e) {
|
|
1325
|
-
return e <= 0 ?
|
|
1313
|
+
return e <= 0 ? k.lineWidthStart : e === 1 ? Math.max(1.5, k.lineWidthStart * 0.67) : e === 2 ? Math.max(0.8, k.lineWidthStart * 0.42) : k.lineWidthEnd;
|
|
1326
1314
|
}
|
|
1327
|
-
function
|
|
1328
|
-
if (e <= 0) return
|
|
1329
|
-
if (e >= 3) return
|
|
1315
|
+
function wt(e) {
|
|
1316
|
+
if (e <= 0) return k.lineWidthStart;
|
|
1317
|
+
if (e >= 3) return k.lineWidthEnd;
|
|
1330
1318
|
const t = e / 3;
|
|
1331
|
-
return
|
|
1319
|
+
return k.lineWidthStart + (k.lineWidthEnd - k.lineWidthStart) * t;
|
|
1332
1320
|
}
|
|
1333
1321
|
function ln(e, t, a, m) {
|
|
1334
|
-
const h = 1 - e, l = h * h * h * t.x + 3 * h * h * e * a.x1 + 3 * h * e * e * a.x2 + e * e * e * m.x,
|
|
1335
|
-
return { x: l, y
|
|
1322
|
+
const h = 1 - e, l = h * h * h * t.x + 3 * h * h * e * a.x1 + 3 * h * e * e * a.x2 + e * e * e * m.x, y = h * h * h * t.y + 3 * h * h * e * a.y1 + 3 * h * e * e * a.y2 + e * e * e * m.y;
|
|
1323
|
+
return { x: l, y };
|
|
1336
1324
|
}
|
|
1337
|
-
function rn(e, t, a, m, h = 32, l = "curve",
|
|
1325
|
+
function rn(e, t, a, m, h = 32, l = "curve", y = "right") {
|
|
1338
1326
|
if (l === "curve") {
|
|
1339
|
-
let
|
|
1340
|
-
if (
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1327
|
+
let pe;
|
|
1328
|
+
if (y === "right" || y === "left") {
|
|
1329
|
+
const P = Math.abs(t.x - e.x) * 0.45, fe = y === "right" ? 1 : -1;
|
|
1330
|
+
pe = { x1: e.x + fe * P, y1: e.y, x2: t.x - fe * P, y2: t.y };
|
|
1343
1331
|
} else {
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1332
|
+
const P = Math.abs(t.y - e.y) * 0.45;
|
|
1333
|
+
pe = { x1: e.x, y1: e.y + P, x2: t.x, y2: t.y - P };
|
|
1346
1334
|
}
|
|
1347
|
-
const
|
|
1348
|
-
const
|
|
1349
|
-
return { dx:
|
|
1350
|
-
}, He = [],
|
|
1335
|
+
const In = (I) => {
|
|
1336
|
+
const P = 1 - I, fe = -3 * P * P * e.x + 3 * (P * P - 2 * P * I) * pe.x1 + 3 * (2 * P * I - I * I) * pe.x2 + 3 * I * I * t.x, ze = -3 * P * P * e.y + 3 * (P * P - 2 * P * I) * pe.y1 + 3 * (2 * P * I - I * I) * pe.y2 + 3 * I * I * t.y;
|
|
1337
|
+
return { dx: fe, dy: ze };
|
|
1338
|
+
}, He = [], rt = [];
|
|
1351
1339
|
for (let I = 0; I <= h; I++) {
|
|
1352
|
-
const
|
|
1353
|
-
let
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
He.push({ x:
|
|
1340
|
+
const P = I / h, fe = I === 0 ? e : I === h ? t : ln(P, e, pe, t), ze = In(P);
|
|
1341
|
+
let Xe = Math.hypot(ze.dx, ze.dy);
|
|
1342
|
+
Xe < 1e-6 && (Xe = 1);
|
|
1343
|
+
const Pt = -ze.dy / Xe, Tt = ze.dx / Xe, qe = (a + (m - a) * P) / 2;
|
|
1344
|
+
He.push({ x: fe.x + Pt * qe, y: fe.y + Tt * qe }), rt.push({ x: fe.x - Pt * qe, y: fe.y - Tt * qe });
|
|
1357
1345
|
}
|
|
1358
|
-
let
|
|
1359
|
-
for (let I = 1; I <= h; I++)
|
|
1360
|
-
for (let I = h; I >= 0; I--)
|
|
1361
|
-
return
|
|
1346
|
+
let Ve = `M ${He[0].x.toFixed(2)} ${He[0].y.toFixed(2)}`;
|
|
1347
|
+
for (let I = 1; I <= h; I++) Ve += ` L ${He[I].x.toFixed(2)} ${He[I].y.toFixed(2)}`;
|
|
1348
|
+
for (let I = h; I >= 0; I--) Ve += ` L ${rt[I].x.toFixed(2)} ${rt[I].y.toFixed(2)}`;
|
|
1349
|
+
return Ve += " Z", Ve;
|
|
1362
1350
|
}
|
|
1363
|
-
const
|
|
1364
|
-
let
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
return `M ${
|
|
1368
|
-
}
|
|
1369
|
-
const
|
|
1370
|
-
() =>
|
|
1371
|
-
),
|
|
1351
|
+
const B = t.x - e.x, K = t.y - e.y;
|
|
1352
|
+
let _ = Math.hypot(B, K);
|
|
1353
|
+
_ < 1e-6 && (_ = 1);
|
|
1354
|
+
const xe = -K / _, Ee = B / _, Se = a / 2, Ae = m / 2, Lt = { x: e.x + xe * Se, y: e.y + Ee * Se }, At = { x: e.x - xe * Se, y: e.y - Ee * Se }, Ht = { x: t.x - xe * Ae, y: t.y - Ee * Ae }, Dt = { x: t.x + xe * Ae, y: t.y + Ee * Ae };
|
|
1355
|
+
return `M ${Lt.x.toFixed(2)} ${Lt.y.toFixed(2)} L ${Dt.x.toFixed(2)} ${Dt.y.toFixed(2)} L ${Ht.x.toFixed(2)} ${Ht.y.toFixed(2)} L ${At.x.toFixed(2)} ${At.y.toFixed(2)} Z`;
|
|
1356
|
+
}
|
|
1357
|
+
const Te = te(() => ie.value.root.children), an = Pe[0].colors, bt = te(
|
|
1358
|
+
() => oi(k.branchPaletteId, k.customPalettes)
|
|
1359
|
+
), ye = te(() => {
|
|
1372
1360
|
const e = /* @__PURE__ */ new Map();
|
|
1373
|
-
if (!
|
|
1374
|
-
const t = n.lineColors, a = t && t.length > 0 ? t :
|
|
1375
|
-
for (let h = 0; h <
|
|
1376
|
-
const l =
|
|
1361
|
+
if (!k.rainbowBranch) return e;
|
|
1362
|
+
const t = n.lineColors, a = t && t.length > 0 ? t : bt.value.colors.length > 0 ? bt.value.colors : an;
|
|
1363
|
+
for (let h = 0; h < Te.value.length; h++) {
|
|
1364
|
+
const l = Te.value[h];
|
|
1377
1365
|
e.set(l.id, a[h % a.length]);
|
|
1378
1366
|
}
|
|
1379
1367
|
const m = (h, l) => {
|
|
1380
1368
|
e.set(h.id, l);
|
|
1381
|
-
for (const
|
|
1369
|
+
for (const y of h.children) m(y, l);
|
|
1382
1370
|
};
|
|
1383
|
-
for (let h = 0; h <
|
|
1384
|
-
const l =
|
|
1371
|
+
for (let h = 0; h < Te.value.length; h++) {
|
|
1372
|
+
const l = Te.value[h];
|
|
1385
1373
|
m(l, a[h % a.length]);
|
|
1386
1374
|
}
|
|
1387
1375
|
return e;
|
|
1388
1376
|
});
|
|
1389
1377
|
function sn(e, t) {
|
|
1390
|
-
return
|
|
1378
|
+
return k.rainbowBranch ? ye.value.get(t.id) ?? ae.value.lineColor : ae.value.lineColor;
|
|
1391
1379
|
}
|
|
1392
1380
|
function un(e) {
|
|
1393
|
-
const t =
|
|
1381
|
+
const t = Y(e.id);
|
|
1394
1382
|
if (t.bg) return t.bg;
|
|
1395
1383
|
if (e.isRoot) return ae.value.rootBg;
|
|
1396
|
-
if (
|
|
1397
|
-
const a =
|
|
1384
|
+
if (k.rainbowBranch) {
|
|
1385
|
+
const a = ye.value.get(e.id);
|
|
1398
1386
|
if (a) return hn(a, 0.18);
|
|
1399
1387
|
}
|
|
1400
1388
|
return ae.value.branchBg;
|
|
1401
1389
|
}
|
|
1402
1390
|
function cn(e) {
|
|
1403
|
-
const t =
|
|
1391
|
+
const t = Y(e.id);
|
|
1404
1392
|
if (t.textColor) return t.textColor;
|
|
1405
1393
|
if (e.isRoot) return ae.value.rootText;
|
|
1406
|
-
if (
|
|
1407
|
-
const a =
|
|
1408
|
-
if (a) return
|
|
1394
|
+
if (k.rainbowBranch) {
|
|
1395
|
+
const a = ye.value.get(e.id);
|
|
1396
|
+
if (a) return kt(a, 0.55);
|
|
1409
1397
|
}
|
|
1410
1398
|
return ae.value.branchText;
|
|
1411
1399
|
}
|
|
1412
1400
|
function dn(e) {
|
|
1413
|
-
const t =
|
|
1401
|
+
const t = Y(e.id);
|
|
1414
1402
|
if (t.borderColor) return t.borderColor;
|
|
1415
1403
|
if (e.isRoot) return ae.value.rootBg;
|
|
1416
|
-
if (
|
|
1417
|
-
const a =
|
|
1418
|
-
if (a) return
|
|
1404
|
+
if (k.rainbowBranch) {
|
|
1405
|
+
const a = ye.value.get(e.id);
|
|
1406
|
+
if (a) return kt(a, 0.3);
|
|
1419
1407
|
}
|
|
1420
1408
|
return ae.value.lineColor;
|
|
1421
1409
|
}
|
|
1422
1410
|
function fn(e) {
|
|
1423
|
-
return
|
|
1411
|
+
return Y(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
|
|
1424
1412
|
}
|
|
1425
1413
|
function hn(e, t) {
|
|
1426
|
-
const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((
|
|
1427
|
-
return `rgba(${h}, ${l}, ${
|
|
1414
|
+
const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((B) => B + B).join(""), h = parseInt(m.slice(0, 2), 16), l = parseInt(m.slice(2, 4), 16), y = parseInt(m.slice(4, 6), 16);
|
|
1415
|
+
return `rgba(${h}, ${l}, ${y}, ${t})`;
|
|
1428
1416
|
}
|
|
1429
|
-
function
|
|
1430
|
-
const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((
|
|
1431
|
-
return `rgb(${h}, ${l}, ${
|
|
1417
|
+
function kt(e, t) {
|
|
1418
|
+
const a = e.replace("#", ""), m = a.length === 6 ? a : a.split("").map((B) => B + B).join(""), h = Math.round(parseInt(m.slice(0, 2), 16) * (1 - t)), l = Math.round(parseInt(m.slice(2, 4), 16) * (1 - t)), y = Math.round(parseInt(m.slice(4, 6), 16) * (1 - t));
|
|
1419
|
+
return `rgb(${h}, ${l}, ${y})`;
|
|
1432
1420
|
}
|
|
1433
|
-
const S =
|
|
1434
|
-
S.setOnMarqueeEnd(
|
|
1421
|
+
const S = fi({ getContainer: () => c.value });
|
|
1422
|
+
S.setOnMarqueeEnd(Cn), vi({
|
|
1435
1423
|
isEditing: () => d.value !== null,
|
|
1436
1424
|
isReadonly: () => n.readonly,
|
|
1437
1425
|
getSelectedId: () => f.value,
|
|
@@ -1439,17 +1427,17 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1439
1427
|
// If nothing is selected, default Tab/Enter to the root so the user
|
|
1440
1428
|
// can build a tree from scratch without first clicking somewhere.
|
|
1441
1429
|
defaultTargetId: () => u.value.id,
|
|
1442
|
-
onAddChild:
|
|
1443
|
-
onAddSibling:
|
|
1444
|
-
onAddSiblingBefore:
|
|
1445
|
-
onRemove:
|
|
1430
|
+
onAddChild: Ce,
|
|
1431
|
+
onAddSibling: Fe,
|
|
1432
|
+
onAddSiblingBefore: Et,
|
|
1433
|
+
onRemove: zt,
|
|
1446
1434
|
onStartEdit: Le,
|
|
1447
1435
|
onClearSelection: () => {
|
|
1448
1436
|
f.value = null, r("select", null);
|
|
1449
1437
|
},
|
|
1450
|
-
onDuplicate:
|
|
1451
|
-
onUndo:
|
|
1452
|
-
onRedo:
|
|
1438
|
+
onDuplicate: St,
|
|
1439
|
+
onUndo: nt,
|
|
1440
|
+
onRedo: it,
|
|
1453
1441
|
onNavigate: xn,
|
|
1454
1442
|
onSelectRoot: () => {
|
|
1455
1443
|
f.value = u.value.id;
|
|
@@ -1458,36 +1446,36 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1458
1446
|
}
|
|
1459
1447
|
});
|
|
1460
1448
|
const ie = te(() => {
|
|
1461
|
-
const e =
|
|
1462
|
-
return
|
|
1463
|
-
}),
|
|
1464
|
-
|
|
1449
|
+
const e = me(u.value);
|
|
1450
|
+
return Ct(e), ei(e, { mode: k.layoutMode, baseFontSize: ae.value.fontSize });
|
|
1451
|
+
}), Mt = O([]), tt = te(() => (yt.value, Mt.value));
|
|
1452
|
+
Ue(
|
|
1465
1453
|
ie,
|
|
1466
1454
|
(e) => {
|
|
1467
1455
|
const t = [], a = (m) => {
|
|
1468
1456
|
t.push(m);
|
|
1469
1457
|
for (const h of m.children) a(h);
|
|
1470
1458
|
};
|
|
1471
|
-
a(e.root),
|
|
1459
|
+
a(e.root), Mt.value = t;
|
|
1472
1460
|
},
|
|
1473
1461
|
{ immediate: !0 }
|
|
1474
1462
|
);
|
|
1475
1463
|
const vn = te(() => {
|
|
1476
1464
|
const e = [];
|
|
1477
|
-
for (const t of
|
|
1465
|
+
for (const t of tt.value)
|
|
1478
1466
|
for (const a of t.children)
|
|
1479
1467
|
e.push({ from: t, to: a, key: `${t.id}->${a.id}` });
|
|
1480
1468
|
return e;
|
|
1481
1469
|
}), mn = te(
|
|
1482
1470
|
() => `${ie.value.vbX} ${ie.value.vbY} ${ie.value.vbW} ${ie.value.vbH}`
|
|
1483
1471
|
);
|
|
1484
|
-
function
|
|
1472
|
+
function Ct(e) {
|
|
1485
1473
|
if (v.value.has(e.id)) {
|
|
1486
1474
|
e.children = [], e.collapsed = !0;
|
|
1487
1475
|
return;
|
|
1488
1476
|
}
|
|
1489
1477
|
e.collapsed = !1;
|
|
1490
|
-
for (const t of e.children)
|
|
1478
|
+
for (const t of e.children) Ct(t);
|
|
1491
1479
|
}
|
|
1492
1480
|
function Le(e) {
|
|
1493
1481
|
const t = A(u.value, e);
|
|
@@ -1496,71 +1484,71 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1496
1484
|
a == null || a.focus(), a == null || a.select();
|
|
1497
1485
|
}));
|
|
1498
1486
|
}
|
|
1499
|
-
function
|
|
1487
|
+
function Oe(e = {}) {
|
|
1500
1488
|
if (!d.value) return;
|
|
1501
1489
|
const t = A(u.value, d.value);
|
|
1502
1490
|
t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", G(), r("change", u.value));
|
|
1503
1491
|
const a = d.value;
|
|
1504
|
-
d.value = null, e.addChild ? ee(() =>
|
|
1492
|
+
d.value = null, e.addChild ? ee(() => Ce(a)) : e.addSibling === "after" ? ee(() => Fe(a)) : e.addSibling === "before" && ee(() => Et(a));
|
|
1505
1493
|
}
|
|
1506
1494
|
function gn() {
|
|
1507
1495
|
d.value = null;
|
|
1508
1496
|
}
|
|
1509
1497
|
function yn(e) {
|
|
1510
1498
|
const t = e.metaKey || e.ctrlKey;
|
|
1511
|
-
t && (e.key === "z" || e.key === "Z") && !e.shiftKey ? (e.preventDefault(),
|
|
1499
|
+
t && (e.key === "z" || e.key === "Z") && !e.shiftKey ? (e.preventDefault(), nt()) : (t && e.shiftKey && (e.key === "z" || e.key === "Z") || t && (e.key === "y" || e.key === "Y") && !e.shiftKey) && (e.preventDefault(), it());
|
|
1512
1500
|
}
|
|
1513
|
-
function
|
|
1514
|
-
const t =
|
|
1515
|
-
t && (G(),
|
|
1501
|
+
function Ce(e) {
|
|
1502
|
+
const t = ai(u.value, e, Je);
|
|
1503
|
+
t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
|
|
1516
1504
|
}
|
|
1517
|
-
function
|
|
1505
|
+
function Fe(e) {
|
|
1518
1506
|
if (e === u.value.id) {
|
|
1519
|
-
|
|
1507
|
+
Ce(e);
|
|
1520
1508
|
return;
|
|
1521
1509
|
}
|
|
1522
|
-
const t =
|
|
1523
|
-
t && (G(),
|
|
1510
|
+
const t = si(u.value, e, Je);
|
|
1511
|
+
t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
|
|
1524
1512
|
}
|
|
1525
|
-
function
|
|
1513
|
+
function Et(e) {
|
|
1526
1514
|
if (e === u.value.id) {
|
|
1527
|
-
|
|
1515
|
+
Ce(e);
|
|
1528
1516
|
return;
|
|
1529
1517
|
}
|
|
1530
|
-
const t =
|
|
1531
|
-
t && (G(),
|
|
1518
|
+
const t = ui(u.value, e, Je);
|
|
1519
|
+
t && (G(), T(), r("change", u.value), ee(() => Le(t.id)));
|
|
1532
1520
|
}
|
|
1533
|
-
function
|
|
1521
|
+
function St(e) {
|
|
1534
1522
|
if (e === u.value.id) return;
|
|
1535
|
-
const t =
|
|
1536
|
-
t && (G(), f.value = t.id, r("change", u.value),
|
|
1523
|
+
const t = ci(u.value, e);
|
|
1524
|
+
t && (G(), f.value = t.id, r("change", u.value), T());
|
|
1537
1525
|
}
|
|
1538
|
-
function
|
|
1539
|
-
const e =
|
|
1540
|
-
e && (u.value = e.data, f.value = null, r("select", null),
|
|
1526
|
+
function nt() {
|
|
1527
|
+
const e = he.undo();
|
|
1528
|
+
e && (u.value = e.data, f.value = null, r("select", null), T(), r("change", u.value));
|
|
1541
1529
|
}
|
|
1542
|
-
function
|
|
1543
|
-
const e =
|
|
1544
|
-
e && (u.value = e.data, f.value = null, r("select", null),
|
|
1530
|
+
function it() {
|
|
1531
|
+
const e = he.redo();
|
|
1532
|
+
e && (u.value = e.data, f.value = null, r("select", null), T(), r("change", u.value));
|
|
1545
1533
|
}
|
|
1546
1534
|
function xn(e, t) {
|
|
1547
1535
|
const a = f.value ?? u.value.id, m = A(u.value, a);
|
|
1548
1536
|
if (!m) return;
|
|
1549
1537
|
let h = null;
|
|
1550
1538
|
if (t === 1) {
|
|
1551
|
-
const l =
|
|
1539
|
+
const l = ce(u.value, m.id);
|
|
1552
1540
|
if (l) {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1541
|
+
const y = l.children.findIndex((B) => B.id === m.id);
|
|
1542
|
+
y >= 0 && y < l.children.length - 1 && (h = l.children[y + 1].id);
|
|
1555
1543
|
}
|
|
1556
1544
|
} else if (t === -1) {
|
|
1557
|
-
const l =
|
|
1545
|
+
const l = ce(u.value, m.id);
|
|
1558
1546
|
if (l) {
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1547
|
+
const y = l.children.findIndex((B) => B.id === m.id);
|
|
1548
|
+
y > 0 && (h = l.children[y - 1].id);
|
|
1561
1549
|
}
|
|
1562
1550
|
} else if (e === 1) {
|
|
1563
|
-
const l =
|
|
1551
|
+
const l = ce(u.value, m.id);
|
|
1564
1552
|
l && (h = l.id);
|
|
1565
1553
|
} else e === -1 && m.children.length > 0 && (h = m.children[0].id);
|
|
1566
1554
|
if (h) {
|
|
@@ -1569,43 +1557,24 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1569
1557
|
l && r("select", l);
|
|
1570
1558
|
}
|
|
1571
1559
|
}
|
|
1572
|
-
function
|
|
1573
|
-
|
|
1574
|
-
`);
|
|
1575
|
-
return /^(`{3,}|~{3,})/.test(t[0] ?? "") && t.shift(), /^(`{3,}|~{3,})\s*$/.test(t[t.length - 1] ?? "") && t.pop(), t.join(`
|
|
1576
|
-
`).replace(/\n+$/, "");
|
|
1577
|
-
}
|
|
1578
|
-
function wn(e) {
|
|
1579
|
-
return e.split(`
|
|
1580
|
-
`).map((t) => t.replace(/^\s*[-*+]\s+/, "").replace(/^\s*\d+\.\s+/, "").trim()).filter((t) => t.length > 0);
|
|
1581
|
-
}
|
|
1582
|
-
function bn(e) {
|
|
1583
|
-
return e.split(`
|
|
1584
|
-
`).filter((t) => t.trim().length > 0).filter((t) => !/^\s*\|?\s*(:?-+:?\s*\|\s*)+(:?-+:?)(\s*\|)?\s*$/.test(t)).map(
|
|
1585
|
-
(t) => t.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((a) => a.trim())
|
|
1586
|
-
);
|
|
1587
|
-
}
|
|
1588
|
-
function kn(e) {
|
|
1589
|
-
return e.replace(/\s+/g, " ").trim();
|
|
1560
|
+
function zt(e) {
|
|
1561
|
+
e !== u.value.id && jt(u.value, e) && (G(), f.value === e && (f.value = null), T(), r("change", u.value));
|
|
1590
1562
|
}
|
|
1591
1563
|
function Nt(e) {
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1594
|
-
function $t(e) {
|
|
1595
|
-
v.value.has(e) ? v.value.delete(e) : v.value.add(e), O();
|
|
1564
|
+
v.value.has(e) ? v.value.delete(e) : v.value.add(e), T();
|
|
1596
1565
|
}
|
|
1597
|
-
function
|
|
1598
|
-
|
|
1566
|
+
function pn(e, t) {
|
|
1567
|
+
li(u.value, e, t) && (G(), T(), r("change", u.value));
|
|
1599
1568
|
}
|
|
1600
|
-
function
|
|
1601
|
-
return
|
|
1569
|
+
function wn(e, t, a) {
|
|
1570
|
+
return ri(u.value, e, t, a) ? (G(), T(), r("change", u.value), !0) : !1;
|
|
1602
1571
|
}
|
|
1603
|
-
function
|
|
1572
|
+
function bn(e, t) {
|
|
1604
1573
|
e.stopPropagation(), f.value = t.id;
|
|
1605
1574
|
const a = A(u.value, t.id);
|
|
1606
1575
|
r("select", a);
|
|
1607
1576
|
}
|
|
1608
|
-
function
|
|
1577
|
+
function kn(e) {
|
|
1609
1578
|
const t = e.target;
|
|
1610
1579
|
if (!t || t.closest(".zm-node, .zm-toolbar, button, input, textarea")) return;
|
|
1611
1580
|
if (e.button === 2) {
|
|
@@ -1616,9 +1585,9 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1616
1585
|
const a = c.value.getBoundingClientRect(), m = (e.clientX - a.left - S.offsetX.value) / S.scale.value, h = (e.clientY - a.top - S.offsetY.value) / S.scale.value;
|
|
1617
1586
|
S.startMarquee(m, h);
|
|
1618
1587
|
}
|
|
1619
|
-
function
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1588
|
+
function Mn(e) {
|
|
1589
|
+
if (_e) {
|
|
1590
|
+
_e = !1;
|
|
1622
1591
|
return;
|
|
1623
1592
|
}
|
|
1624
1593
|
const t = e.target;
|
|
@@ -1626,29 +1595,29 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1626
1595
|
const a = S.marquee;
|
|
1627
1596
|
a.width >= 4 || a.height >= 4 || f.value !== null && (f.value = null, r("select", null));
|
|
1628
1597
|
}
|
|
1629
|
-
function
|
|
1598
|
+
function Cn() {
|
|
1630
1599
|
const e = S.marquee;
|
|
1631
1600
|
if (e.width < 4 && e.height < 4)
|
|
1632
1601
|
return;
|
|
1633
1602
|
const t = e.x, a = e.y, m = e.x + e.width, h = e.y + e.height, l = [];
|
|
1634
|
-
for (const
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1603
|
+
for (const y of tt.value) {
|
|
1604
|
+
const B = y.width / 2, K = y.height / 2, _ = y.x - B, xe = y.x + B, Ee = y.y - K, Se = y.y + K;
|
|
1605
|
+
_ <= m && xe >= t && Ee <= h && Se >= a && l.push(y.id);
|
|
1637
1606
|
}
|
|
1638
1607
|
if (l.length > 0) {
|
|
1639
1608
|
f.value = l[0];
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1609
|
+
const y = A(u.value, l[0]);
|
|
1610
|
+
y && r("select", y);
|
|
1642
1611
|
}
|
|
1643
1612
|
}
|
|
1644
1613
|
function It(e) {
|
|
1645
1614
|
return v.value.has(e);
|
|
1646
1615
|
}
|
|
1647
|
-
function
|
|
1616
|
+
function En(e) {
|
|
1648
1617
|
const t = A(u.value, e.id);
|
|
1649
1618
|
return !!t && t.children.length > 0;
|
|
1650
1619
|
}
|
|
1651
|
-
function
|
|
1620
|
+
function ot(e) {
|
|
1652
1621
|
const t = A(u.value, e);
|
|
1653
1622
|
return t ? t.children.length : 0;
|
|
1654
1623
|
}
|
|
@@ -1656,40 +1625,40 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1656
1625
|
if (!A(u.value, e)) return 0;
|
|
1657
1626
|
const m = [u.value];
|
|
1658
1627
|
for (; m.length; ) {
|
|
1659
|
-
const h = m.pop(), l = h.children.findIndex((
|
|
1628
|
+
const h = m.pop(), l = h.children.findIndex((y) => y.id === e);
|
|
1660
1629
|
if (l >= 0) return l;
|
|
1661
|
-
for (const
|
|
1630
|
+
for (const y of h.children) m.push(y);
|
|
1662
1631
|
}
|
|
1663
1632
|
return 0;
|
|
1664
1633
|
}
|
|
1665
|
-
function
|
|
1634
|
+
function $t(e, t, a, m) {
|
|
1666
1635
|
if (((m == null ? void 0 : m._dir) ?? e._dir) === "down")
|
|
1667
1636
|
return t === "out" ? { x: e.x, y: e.y + e.height / 2 } : { x: e.x, y: e.y - e.height / 2 };
|
|
1668
1637
|
let l;
|
|
1669
1638
|
return t === "in" ? l = -e.side : a !== void 0 ? l = a : l = e.side, { x: e.x + l * (e.width / 2), y: e.y };
|
|
1670
1639
|
}
|
|
1671
|
-
function
|
|
1640
|
+
function de() {
|
|
1672
1641
|
const e = ie.value;
|
|
1673
1642
|
S.resetView(e.width, e.height, e.root.y);
|
|
1674
1643
|
}
|
|
1675
|
-
function
|
|
1676
|
-
|
|
1644
|
+
function Sn() {
|
|
1645
|
+
et.value = !0, G(), T(), ee(() => de());
|
|
1677
1646
|
}
|
|
1678
|
-
function
|
|
1679
|
-
|
|
1647
|
+
function lt(e) {
|
|
1648
|
+
k.layoutMode !== e && (k.layoutMode = e, T(), ee(() => de()));
|
|
1680
1649
|
}
|
|
1681
|
-
function
|
|
1650
|
+
function Rt() {
|
|
1682
1651
|
return JSON.stringify(u.value, null, 2);
|
|
1683
1652
|
}
|
|
1684
|
-
function
|
|
1653
|
+
function Bt(e) {
|
|
1685
1654
|
try {
|
|
1686
1655
|
const t = JSON.parse(e);
|
|
1687
|
-
return !t.id || !Array.isArray(t.children) ? !1 : (
|
|
1656
|
+
return !t.id || !Array.isArray(t.children) ? !1 : (he.reset(), u.value = me(t), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), ee(() => de()), r("change", u.value), !0);
|
|
1688
1657
|
} catch {
|
|
1689
1658
|
return !1;
|
|
1690
1659
|
}
|
|
1691
1660
|
}
|
|
1692
|
-
function
|
|
1661
|
+
function zn() {
|
|
1693
1662
|
const e = document.createElement("input");
|
|
1694
1663
|
e.type = "file", e.accept = "application/json", e.onchange = () => {
|
|
1695
1664
|
var m;
|
|
@@ -1697,156 +1666,156 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1697
1666
|
if (!t) return;
|
|
1698
1667
|
const a = new FileReader();
|
|
1699
1668
|
a.onload = () => {
|
|
1700
|
-
typeof a.result == "string" && (
|
|
1669
|
+
typeof a.result == "string" && (Bt(a.result) || alert("导入失败:JSON 格式无效"));
|
|
1701
1670
|
}, a.readAsText(t);
|
|
1702
1671
|
}, e.click();
|
|
1703
1672
|
}
|
|
1704
|
-
function
|
|
1705
|
-
const e = new Blob([
|
|
1673
|
+
function Nn() {
|
|
1674
|
+
const e = new Blob([Rt()], { type: "application/json" }), t = URL.createObjectURL(e), a = document.createElement("a");
|
|
1706
1675
|
a.href = t, a.download = `${u.value.text || "mindmap"}.json`, a.click(), URL.revokeObjectURL(t);
|
|
1707
1676
|
}
|
|
1708
1677
|
return s({
|
|
1709
|
-
addChild: (e) =>
|
|
1710
|
-
addSibling: (e) =>
|
|
1711
|
-
removeNode: (e) =>
|
|
1712
|
-
duplicateNode: (e) =>
|
|
1713
|
-
setNodeText: (e, t) =>
|
|
1714
|
-
moveNode: (e, t, a) =>
|
|
1715
|
-
lineWidthForDepth:
|
|
1716
|
-
endWidthForDepth:
|
|
1678
|
+
addChild: (e) => Ce(e),
|
|
1679
|
+
addSibling: (e) => Fe(e),
|
|
1680
|
+
removeNode: (e) => zt(e),
|
|
1681
|
+
duplicateNode: (e) => St(e),
|
|
1682
|
+
setNodeText: (e, t) => pn(e, t),
|
|
1683
|
+
moveNode: (e, t, a) => wn(e, t, a),
|
|
1684
|
+
lineWidthForDepth: xt,
|
|
1685
|
+
endWidthForDepth: pt,
|
|
1717
1686
|
getData: () => u.value,
|
|
1718
1687
|
setData: (e) => {
|
|
1719
|
-
|
|
1688
|
+
he.reset(), u.value = me(e), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), G(), ee(() => de());
|
|
1720
1689
|
},
|
|
1721
|
-
resetView: () =>
|
|
1722
|
-
exportData:
|
|
1723
|
-
importData:
|
|
1690
|
+
resetView: () => de(),
|
|
1691
|
+
exportData: Rt,
|
|
1692
|
+
importData: Bt,
|
|
1724
1693
|
/** Serialize the current data tree as markdown. Always available
|
|
1725
1694
|
* — the same serializer is used to emit `markdownChange`. */
|
|
1726
|
-
getMarkdown: () =>
|
|
1695
|
+
getMarkdown: () => ut(u.value),
|
|
1727
1696
|
/** Replace the data tree with the result of parsing `md`. The
|
|
1728
1697
|
* flag `emitMarkdownChange` (default true) controls whether the
|
|
1729
1698
|
* change is also echoed via `markdownChange` (use false when
|
|
1730
1699
|
* the host just set the same value back from the prop). */
|
|
1731
1700
|
setMarkdown: (e, t = !0) => {
|
|
1732
1701
|
const a = Xt(e || "");
|
|
1733
|
-
t && (
|
|
1734
|
-
|
|
1702
|
+
t && (g.value = !0), M = !t, he.reset(), u.value = me(a), f.value = null, v.value = /* @__PURE__ */ new Set(), T(), G(), ee(() => {
|
|
1703
|
+
M = !1, de();
|
|
1735
1704
|
}), r("change", u.value);
|
|
1736
1705
|
},
|
|
1737
1706
|
// Make balanced the active layout (sticky). Subsequent data changes
|
|
1738
1707
|
// and additions stay in balanced mode. Pass `false` to revert to the
|
|
1739
1708
|
// default compact layout.
|
|
1740
1709
|
setBalanced: (e) => {
|
|
1741
|
-
|
|
1710
|
+
et.value = e;
|
|
1742
1711
|
},
|
|
1743
|
-
isBalanced: () =>
|
|
1712
|
+
isBalanced: () => et.value,
|
|
1744
1713
|
// Re-balance now: clear all manual drag offsets, re-run the balanced
|
|
1745
1714
|
// layout, and re-center the view. This is the action tied to the
|
|
1746
1715
|
// "balance" toolbar button.
|
|
1747
|
-
balance: () =>
|
|
1748
|
-
applyNodeStyle: (e, t) =>
|
|
1749
|
-
getNodeStyle: (e) =>
|
|
1716
|
+
balance: () => Sn(),
|
|
1717
|
+
applyNodeStyle: (e, t) => Z(e, t),
|
|
1718
|
+
getNodeStyle: (e) => Y(e),
|
|
1750
1719
|
applyNodeLink: (e, t) => V(e, t),
|
|
1751
|
-
removeNodeLink: (e) =>
|
|
1752
|
-
applyNodeNote: (e, t) =>
|
|
1720
|
+
removeNodeLink: (e) => se(e),
|
|
1721
|
+
applyNodeNote: (e, t) => ge(e, t),
|
|
1753
1722
|
removeNodeNote: (e) => W(e),
|
|
1754
|
-
undo: () =>
|
|
1755
|
-
redo: () =>
|
|
1756
|
-
canUndo: () =>
|
|
1757
|
-
canRedo: () =>
|
|
1723
|
+
undo: () => nt(),
|
|
1724
|
+
redo: () => it(),
|
|
1725
|
+
canUndo: () => he.canUndo(),
|
|
1726
|
+
canRedo: () => he.canRedo(),
|
|
1758
1727
|
// Settings panel / external mutation hooks
|
|
1759
1728
|
applySettings: (e) => {
|
|
1760
|
-
e.autoBalanceOnChange !== void 0 && (
|
|
1729
|
+
e.autoBalanceOnChange !== void 0 && (k.autoBalanceOnChange = e.autoBalanceOnChange), e.lineWidthStart !== void 0 && (k.lineWidthStart = Math.max(0.5, Math.min(20, e.lineWidthStart))), e.lineWidthEnd !== void 0 && (k.lineWidthEnd = Math.max(0.3, Math.min(10, e.lineWidthEnd))), e.rainbowBranch !== void 0 && (k.rainbowBranch = e.rainbowBranch), e.branchPaletteId !== void 0 && (k.branchPaletteId = e.branchPaletteId), e.customPalettes !== void 0 && (k.customPalettes = e.customPalettes), e.lineStyle !== void 0 && (k.lineStyle = e.lineStyle), e.taperedEdge !== void 0 && (k.taperedEdge = e.taperedEdge), e.showOrderBadge !== void 0 && (k.showOrderBadge = e.showOrderBadge);
|
|
1761
1730
|
},
|
|
1762
1731
|
getSettings: () => ({
|
|
1763
|
-
autoBalanceOnChange:
|
|
1764
|
-
lineWidthStart:
|
|
1765
|
-
lineWidthEnd:
|
|
1766
|
-
rainbowBranch:
|
|
1767
|
-
branchPaletteId:
|
|
1768
|
-
customPalettes:
|
|
1769
|
-
lineStyle:
|
|
1770
|
-
layoutMode:
|
|
1771
|
-
taperedEdge:
|
|
1772
|
-
showOrderBadge:
|
|
1732
|
+
autoBalanceOnChange: k.autoBalanceOnChange,
|
|
1733
|
+
lineWidthStart: k.lineWidthStart,
|
|
1734
|
+
lineWidthEnd: k.lineWidthEnd,
|
|
1735
|
+
rainbowBranch: k.rainbowBranch,
|
|
1736
|
+
branchPaletteId: k.branchPaletteId,
|
|
1737
|
+
customPalettes: k.customPalettes,
|
|
1738
|
+
lineStyle: k.lineStyle,
|
|
1739
|
+
layoutMode: k.layoutMode,
|
|
1740
|
+
taperedEdge: k.taperedEdge,
|
|
1741
|
+
showOrderBadge: k.showOrderBadge
|
|
1773
1742
|
}),
|
|
1774
1743
|
setBranchPalette: (e) => {
|
|
1775
1744
|
if (!e) return;
|
|
1776
|
-
[...
|
|
1745
|
+
[...Pe, ...k.customPalettes].find((a) => a.id === e) && (k.branchPaletteId = e);
|
|
1777
1746
|
},
|
|
1778
|
-
getBranchPalette: () =>
|
|
1779
|
-
getBranchPalettes: () => [...
|
|
1780
|
-
}),
|
|
1747
|
+
getBranchPalette: () => k.branchPaletteId,
|
|
1748
|
+
getBranchPalettes: () => [...Pe, ...k.customPalettes]
|
|
1749
|
+
}), Ue(
|
|
1781
1750
|
() => n.data,
|
|
1782
1751
|
(e) => {
|
|
1783
|
-
u.value =
|
|
1752
|
+
u.value = me(e), T();
|
|
1784
1753
|
},
|
|
1785
1754
|
{ deep: !1 }
|
|
1786
|
-
),
|
|
1787
|
-
G(), ee(() =>
|
|
1755
|
+
), st(() => {
|
|
1756
|
+
G(), ee(() => de());
|
|
1788
1757
|
}), (e, t) => {
|
|
1789
1758
|
var a, m, h;
|
|
1790
|
-
return
|
|
1759
|
+
return C(), E("div", {
|
|
1791
1760
|
class: "zm-mindmap",
|
|
1792
|
-
style:
|
|
1761
|
+
style: ve({ background: ae.value.bgColor, fontSize: ae.value.fontSize + "px" })
|
|
1793
1762
|
}, [
|
|
1794
1763
|
p("div", {
|
|
1795
1764
|
ref_key: "wrapperRef",
|
|
1796
1765
|
ref: c,
|
|
1797
1766
|
class: "zm-canvas",
|
|
1798
|
-
onMousedown:
|
|
1799
|
-
onContextmenu: t[
|
|
1767
|
+
onMousedown: kn,
|
|
1768
|
+
onContextmenu: t[13] || (t[13] = D(() => {
|
|
1800
1769
|
}, ["prevent"])),
|
|
1801
|
-
onWheel: t[
|
|
1770
|
+
onWheel: t[14] || (t[14] = //@ts-ignore
|
|
1802
1771
|
(...l) => N(S).onWheel && N(S).onWheel(...l)),
|
|
1803
|
-
onClick:
|
|
1772
|
+
onClick: Mn
|
|
1804
1773
|
}, [
|
|
1805
1774
|
p("div", {
|
|
1806
1775
|
class: "zm-svg-layer",
|
|
1807
|
-
style:
|
|
1776
|
+
style: ve({
|
|
1808
1777
|
left: ie.value.vbX * N(S).scale.value + N(S).offsetX.value + "px",
|
|
1809
1778
|
top: ie.value.vbY * N(S).scale.value + N(S).offsetY.value + "px",
|
|
1810
1779
|
width: ie.value.vbW * N(S).scale.value + "px",
|
|
1811
1780
|
height: ie.value.vbH * N(S).scale.value + "px"
|
|
1812
1781
|
})
|
|
1813
1782
|
}, [
|
|
1814
|
-
(
|
|
1783
|
+
(C(), E("svg", {
|
|
1815
1784
|
class: "zm-svg",
|
|
1816
1785
|
viewBox: mn.value,
|
|
1817
1786
|
preserveAspectRatio: "xMinYMin meet",
|
|
1818
1787
|
width: ie.value.vbW * N(S).scale.value,
|
|
1819
1788
|
height: ie.value.vbH * N(S).scale.value
|
|
1820
1789
|
}, [
|
|
1821
|
-
p("g",
|
|
1822
|
-
(
|
|
1790
|
+
p("g", Ci, [
|
|
1791
|
+
(C(!0), E(F, null, Ot(vn.value, (l) => (C(), E("path", {
|
|
1823
1792
|
key: l.key,
|
|
1824
|
-
d: rn(
|
|
1793
|
+
d: rn($t(l.from, "out", l.to.side, l.to), $t(l.to, "in"), xt(l.from.depth), pt(l.to.depth), 32, k.lineStyle, l.to._dir),
|
|
1825
1794
|
fill: sn(l.from, l.to),
|
|
1826
1795
|
stroke: "none"
|
|
1827
|
-
}, null, 8,
|
|
1796
|
+
}, null, 8, Ei))), 128))
|
|
1828
1797
|
])
|
|
1829
|
-
], 8,
|
|
1798
|
+
], 8, Mi))
|
|
1830
1799
|
], 4),
|
|
1831
|
-
N(S).isMarquee.value ? (
|
|
1800
|
+
N(S).isMarquee.value ? (C(), E("div", {
|
|
1832
1801
|
key: 0,
|
|
1833
1802
|
class: "zm-marquee",
|
|
1834
|
-
style:
|
|
1803
|
+
style: ve({
|
|
1835
1804
|
left: N(S).marquee.x * N(S).scale.value + N(S).offsetX.value + "px",
|
|
1836
1805
|
top: N(S).marquee.y * N(S).scale.value + N(S).offsetY.value + "px",
|
|
1837
1806
|
width: N(S).marquee.width * N(S).scale.value + "px",
|
|
1838
1807
|
height: N(S).marquee.height * N(S).scale.value + "px"
|
|
1839
1808
|
})
|
|
1840
|
-
}, null, 4)) :
|
|
1809
|
+
}, null, 4)) : X("", !0),
|
|
1841
1810
|
p("div", {
|
|
1842
1811
|
class: "zm-world",
|
|
1843
|
-
style:
|
|
1812
|
+
style: ve({
|
|
1844
1813
|
transform: `translate(${N(S).offsetX.value}px, ${N(S).offsetY.value}px) scale(${N(S).scale.value})`
|
|
1845
1814
|
})
|
|
1846
1815
|
}, [
|
|
1847
|
-
(
|
|
1816
|
+
(C(!0), E(F, null, Ot(tt.value, (l) => (C(), E("div", {
|
|
1848
1817
|
key: l.id,
|
|
1849
|
-
class:
|
|
1818
|
+
class: Ie(["zm-node", {
|
|
1850
1819
|
"is-root": l.isRoot,
|
|
1851
1820
|
"is-selected": f.value === l.id,
|
|
1852
1821
|
"is-editing": d.value === l.id,
|
|
@@ -1854,7 +1823,7 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1854
1823
|
"is-resizing": _t.value === l.id
|
|
1855
1824
|
}]),
|
|
1856
1825
|
"data-node-id": l.id,
|
|
1857
|
-
style:
|
|
1826
|
+
style: ve({
|
|
1858
1827
|
left: l.x + "px",
|
|
1859
1828
|
top: l.y + "px",
|
|
1860
1829
|
minWidth: l.width + "px",
|
|
@@ -1867,15 +1836,15 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1867
1836
|
// Center the box on (x, y) with translate(-50%, -50%)
|
|
1868
1837
|
transform: "translate(-50%, -50%)"
|
|
1869
1838
|
}),
|
|
1870
|
-
onClick: (
|
|
1871
|
-
onDblclick: (
|
|
1872
|
-
|
|
1839
|
+
onClick: (y) => bn(y, l),
|
|
1840
|
+
onDblclick: (y) => {
|
|
1841
|
+
y.stopPropagation(), i.readonly || Le(l.id);
|
|
1873
1842
|
},
|
|
1874
|
-
onContextmenu: (
|
|
1875
|
-
onMouseenter: (
|
|
1876
|
-
onMouseleave: (
|
|
1843
|
+
onContextmenu: (y) => Q(y, l),
|
|
1844
|
+
onMouseenter: (y) => tn(l.id),
|
|
1845
|
+
onMouseleave: (y) => nn(l.id)
|
|
1877
1846
|
}, [
|
|
1878
|
-
l.image ? (
|
|
1847
|
+
l.image ? (C(), E("img", {
|
|
1879
1848
|
key: 0,
|
|
1880
1849
|
class: "zm-node-img",
|
|
1881
1850
|
src: l.image.src,
|
|
@@ -1883,268 +1852,244 @@ const wi = ["disabled"], bi = ["disabled"], ki = ["disabled"], Mi = ["disabled"]
|
|
|
1883
1852
|
height: l.image.height,
|
|
1884
1853
|
alt: l.text,
|
|
1885
1854
|
draggable: "false"
|
|
1886
|
-
}, null, 8,
|
|
1887
|
-
d.value !== l.id ? (
|
|
1888
|
-
p("span",
|
|
1889
|
-
l.link && !d.value ? (
|
|
1855
|
+
}, null, 8, zi)) : X("", !0),
|
|
1856
|
+
d.value !== l.id ? (C(), E("span", Ni, [
|
|
1857
|
+
p("span", Ii, be(l.text), 1),
|
|
1858
|
+
l.link && !d.value ? (C(), E("a", {
|
|
1890
1859
|
key: 0,
|
|
1891
1860
|
class: "zm-node-link",
|
|
1892
1861
|
href: l.link.url,
|
|
1893
1862
|
target: "_blank",
|
|
1894
1863
|
rel: "noopener noreferrer",
|
|
1895
1864
|
title: `打开链接:${l.link.url}`,
|
|
1896
|
-
onClick: t[0] || (t[0] =
|
|
1865
|
+
onClick: t[0] || (t[0] = D(() => {
|
|
1897
1866
|
}, ["stop"])),
|
|
1898
|
-
onMousedown: t[1] || (t[1] =
|
|
1867
|
+
onMousedown: t[1] || (t[1] = D(() => {
|
|
1899
1868
|
}, ["stop"]))
|
|
1900
1869
|
}, [
|
|
1901
|
-
U
|
|
1870
|
+
q(U, {
|
|
1902
1871
|
name: "link",
|
|
1903
1872
|
size: 11,
|
|
1904
1873
|
stroke: 2
|
|
1905
1874
|
})
|
|
1906
|
-
], 40,
|
|
1907
|
-
l.note && !d.value ? (
|
|
1875
|
+
], 40, Wi)) : X("", !0),
|
|
1876
|
+
l.note && !d.value ? (C(), E("button", {
|
|
1908
1877
|
key: 1,
|
|
1909
1878
|
class: "zm-node-note-btn",
|
|
1910
1879
|
type: "button",
|
|
1911
1880
|
title: Qt(l.note.text),
|
|
1912
|
-
onClick:
|
|
1913
|
-
onMousedown: t[2] || (t[2] =
|
|
1881
|
+
onClick: D((y) => ht(l.id), ["stop"]),
|
|
1882
|
+
onMousedown: t[2] || (t[2] = D(() => {
|
|
1914
1883
|
}, ["stop"]))
|
|
1915
1884
|
}, [
|
|
1916
|
-
U
|
|
1885
|
+
q(U, {
|
|
1917
1886
|
name: "note",
|
|
1918
1887
|
size: 11,
|
|
1919
1888
|
stroke: 2
|
|
1920
1889
|
})
|
|
1921
|
-
], 40,
|
|
1922
|
-
])) :
|
|
1923
|
-
l.richContent && d.value !== l.id ? (w(), b("div", {
|
|
1890
|
+
], 40, $i)) : X("", !0)
|
|
1891
|
+
])) : Wn((C(), E("input", {
|
|
1924
1892
|
key: 2,
|
|
1925
|
-
class: me(["zm-rich", `zm-rich-${l.richContent.kind}`]),
|
|
1926
|
-
onClick: t[3] || (t[3] = H(() => {
|
|
1927
|
-
}, ["stop"])),
|
|
1928
|
-
onDblclick: t[4] || (t[4] = H(() => {
|
|
1929
|
-
}, ["stop"])),
|
|
1930
|
-
onMousedown: t[5] || (t[5] = H(() => {
|
|
1931
|
-
}, ["stop"]))
|
|
1932
|
-
}, [
|
|
1933
|
-
l.richContent.kind === "code" ? (w(), b("pre", Hi, [
|
|
1934
|
-
p("code", {
|
|
1935
|
-
class: me(l.richContent.lang ? `language-${l.richContent.lang}` : "")
|
|
1936
|
-
}, se(pn(l.richContent.raw)), 3)
|
|
1937
|
-
])) : l.richContent.kind === "list" ? (w(), b("ul", Di, [
|
|
1938
|
-
(w(!0), b(P, null, De(wn(l.richContent.raw), (g, $) => (w(), b("li", { key: $ }, se(g), 1))), 128))
|
|
1939
|
-
])) : l.richContent.kind === "table" ? (w(), b("table", Pi, [
|
|
1940
|
-
p("tbody", null, [
|
|
1941
|
-
(w(!0), b(P, null, De(bn(l.richContent.raw), (g, $) => (w(), b("tr", { key: $ }, [
|
|
1942
|
-
(w(!0), b(P, null, De(g, (X, J) => (w(), b("td", { key: J }, se(X), 1))), 128))
|
|
1943
|
-
]))), 128))
|
|
1944
|
-
])
|
|
1945
|
-
])) : (w(), b("div", Ti, se(kn(l.richContent.raw)), 1))
|
|
1946
|
-
], 34)) : Ln((w(), b("input", {
|
|
1947
|
-
key: 3,
|
|
1948
1893
|
class: "zm-input",
|
|
1949
|
-
"onUpdate:modelValue": t[
|
|
1894
|
+
"onUpdate:modelValue": t[3] || (t[3] = (y) => x.value = y),
|
|
1950
1895
|
autofocus: "",
|
|
1951
|
-
onBlur: t[
|
|
1896
|
+
onBlur: t[4] || (t[4] = (y) => Oe()),
|
|
1952
1897
|
onKeydown: [
|
|
1953
|
-
t[
|
|
1954
|
-
t[
|
|
1955
|
-
t[
|
|
1956
|
-
|
|
1898
|
+
t[5] || (t[5] = Ye(D((y) => Oe({ addSibling: "after" }), ["exact"]), ["enter"])),
|
|
1899
|
+
t[6] || (t[6] = Ye(D((y) => Oe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
|
|
1900
|
+
t[7] || (t[7] = Ye(D((y) => Oe({ addChild: !0 }), ["prevent"]), ["tab"])),
|
|
1901
|
+
Ye(gn, ["esc"]),
|
|
1957
1902
|
yn
|
|
1958
1903
|
],
|
|
1959
|
-
onMousedown: t[
|
|
1904
|
+
onMousedown: t[8] || (t[8] = D(() => {
|
|
1960
1905
|
}, ["stop"])),
|
|
1961
|
-
onClick: t[
|
|
1906
|
+
onClick: t[9] || (t[9] = D(() => {
|
|
1962
1907
|
}, ["stop"]))
|
|
1963
1908
|
}, null, 544)), [
|
|
1964
|
-
[
|
|
1909
|
+
[$n, x.value]
|
|
1965
1910
|
]),
|
|
1966
|
-
|
|
1967
|
-
key:
|
|
1911
|
+
w.value ? (C(), E("span", {
|
|
1912
|
+
key: 3,
|
|
1968
1913
|
class: "zm-order-badge",
|
|
1969
1914
|
title: `数据顺序:第 ${Wt(l.id) + 1} 个`
|
|
1970
|
-
},
|
|
1971
|
-
It(l.id) && !l.isRoot &&
|
|
1972
|
-
key:
|
|
1973
|
-
class:
|
|
1974
|
-
style:
|
|
1975
|
-
title: `展开 ${
|
|
1976
|
-
onMousedown: t[
|
|
1915
|
+
}, be(Wt(l.id) + 1), 9, Ri)) : X("", !0),
|
|
1916
|
+
It(l.id) && !l.isRoot && ot(l.id) > 0 ? (C(), E("span", {
|
|
1917
|
+
key: 4,
|
|
1918
|
+
class: Ie(["zm-collapse-badge", { "is-on-left": l.side === -1 }]),
|
|
1919
|
+
style: ve({ background: ye.value.get(l.id) ?? "#64748b" }),
|
|
1920
|
+
title: `展开 ${ot(l.id)} 个子节点`,
|
|
1921
|
+
onMousedown: t[10] || (t[10] = D(() => {
|
|
1977
1922
|
}, ["stop"])),
|
|
1978
|
-
onClick:
|
|
1979
|
-
},
|
|
1980
|
-
!i.readonly && !l.isRoot &&
|
|
1981
|
-
key:
|
|
1982
|
-
class:
|
|
1983
|
-
style:
|
|
1923
|
+
onClick: D((y) => Nt(l.id), ["stop"])
|
|
1924
|
+
}, be(ot(l.id)), 47, Bi)) : X("", !0),
|
|
1925
|
+
!i.readonly && !l.isRoot && En(l) && !It(l.id) ? (C(), E("button", {
|
|
1926
|
+
key: 5,
|
|
1927
|
+
class: Ie(["zm-btn zm-collapse", { "is-on-left": l.side === -1 }]),
|
|
1928
|
+
style: ve({ color: ye.value.get(l.id) ?? "#64748b", borderColor: ye.value.get(l.id) ?? "#64748b" }),
|
|
1984
1929
|
title: "折叠",
|
|
1985
|
-
onMousedown: t[
|
|
1930
|
+
onMousedown: t[11] || (t[11] = D(() => {
|
|
1986
1931
|
}, ["stop"])),
|
|
1987
|
-
onClick:
|
|
1932
|
+
onClick: D((y) => Nt(l.id), ["stop"])
|
|
1988
1933
|
}, [
|
|
1989
|
-
U
|
|
1934
|
+
q(U, {
|
|
1990
1935
|
name: "minus",
|
|
1991
1936
|
size: 10,
|
|
1992
1937
|
stroke: 2.4
|
|
1993
1938
|
})
|
|
1994
|
-
], 46,
|
|
1995
|
-
l.image && f.value === l.id && d.value !== l.id ? (
|
|
1996
|
-
key:
|
|
1939
|
+
], 46, Li)) : X("", !0),
|
|
1940
|
+
l.image && f.value === l.id && d.value !== l.id ? (C(), E("span", {
|
|
1941
|
+
key: 6,
|
|
1997
1942
|
class: "zm-img-resize-handle",
|
|
1998
1943
|
title: "拖动调整图片大小",
|
|
1999
|
-
onMousedown:
|
|
2000
|
-
}, null, 40,
|
|
2001
|
-
l.image && f.value === l.id && d.value !== l.id ? (
|
|
2002
|
-
key:
|
|
1944
|
+
onMousedown: D((y) => en(y, l), ["stop"])
|
|
1945
|
+
}, null, 40, Ai)) : X("", !0),
|
|
1946
|
+
l.image && f.value === l.id && d.value !== l.id ? (C(), E("button", {
|
|
1947
|
+
key: 7,
|
|
2003
1948
|
class: "zm-img-remove-btn",
|
|
2004
1949
|
title: "移除图片",
|
|
2005
|
-
onMousedown: t[
|
|
1950
|
+
onMousedown: t[12] || (t[12] = D(() => {
|
|
2006
1951
|
}, ["stop"])),
|
|
2007
|
-
onClick:
|
|
1952
|
+
onClick: D((y) => z(l.id), ["stop"])
|
|
2008
1953
|
}, [
|
|
2009
|
-
U
|
|
1954
|
+
q(U, {
|
|
2010
1955
|
name: "x",
|
|
2011
1956
|
size: 9,
|
|
2012
1957
|
stroke: 2.2
|
|
2013
1958
|
})
|
|
2014
|
-
], 40,
|
|
2015
|
-
], 46,
|
|
1959
|
+
], 40, Hi)) : X("", !0)
|
|
1960
|
+
], 46, Si))), 128))
|
|
2016
1961
|
], 4),
|
|
2017
|
-
|
|
1962
|
+
R.value ? (C(), Rn(ki, {
|
|
2018
1963
|
key: 1,
|
|
2019
|
-
x:
|
|
2020
|
-
y:
|
|
1964
|
+
x: R.value.x,
|
|
1965
|
+
y: R.value.y,
|
|
2021
1966
|
container: c.value,
|
|
2022
|
-
"has-image": !!((a = N(A)(u.value,
|
|
2023
|
-
"has-link": !!((m = N(A)(u.value,
|
|
2024
|
-
"has-note": !!((h = N(A)(u.value,
|
|
1967
|
+
"has-image": !!((a = N(A)(u.value, R.value.nodeId)) != null && a.image),
|
|
1968
|
+
"has-link": !!((m = N(A)(u.value, R.value.nodeId)) != null && m.link),
|
|
1969
|
+
"has-note": !!((h = N(A)(u.value, R.value.nodeId)) != null && h.note),
|
|
2025
1970
|
readonly: n.readonly,
|
|
2026
1971
|
onPickImage: le,
|
|
2027
1972
|
onRemoveImage: Zt,
|
|
2028
1973
|
onSetLink: re,
|
|
2029
|
-
onRemoveLink:
|
|
1974
|
+
onRemoveLink: ke,
|
|
2030
1975
|
onEditNote: Re,
|
|
2031
|
-
onRemoveNote:
|
|
1976
|
+
onRemoveNote: Me,
|
|
2032
1977
|
onClose: ne
|
|
2033
|
-
}, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) :
|
|
1978
|
+
}, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : X("", !0)
|
|
2034
1979
|
], 544),
|
|
2035
|
-
n.previewMode ?
|
|
1980
|
+
n.previewMode ? X("", !0) : (C(), E("div", Di, [
|
|
2036
1981
|
p("button", {
|
|
2037
1982
|
class: "zm-tb-btn",
|
|
2038
1983
|
title: "放大",
|
|
2039
|
-
onClick: t[
|
|
1984
|
+
onClick: t[15] || (t[15] = //@ts-ignore
|
|
2040
1985
|
(...l) => N(S).zoomIn && N(S).zoomIn(...l))
|
|
2041
1986
|
}, [
|
|
2042
|
-
U
|
|
1987
|
+
q(U, { name: "zoom-in" })
|
|
2043
1988
|
]),
|
|
2044
1989
|
p("button", {
|
|
2045
1990
|
class: "zm-tb-btn",
|
|
2046
1991
|
title: "缩小",
|
|
2047
|
-
onClick: t[
|
|
1992
|
+
onClick: t[16] || (t[16] = //@ts-ignore
|
|
2048
1993
|
(...l) => N(S).zoomOut && N(S).zoomOut(...l))
|
|
2049
1994
|
}, [
|
|
2050
|
-
U
|
|
1995
|
+
q(U, { name: "zoom-out" })
|
|
2051
1996
|
]),
|
|
2052
1997
|
p("button", {
|
|
2053
1998
|
class: "zm-tb-btn",
|
|
2054
1999
|
title: "重置视图",
|
|
2055
|
-
onClick:
|
|
2000
|
+
onClick: de
|
|
2056
2001
|
}, [
|
|
2057
|
-
U
|
|
2002
|
+
q(U, { name: "reset" })
|
|
2058
2003
|
]),
|
|
2059
|
-
t[
|
|
2060
|
-
i.readonly ?
|
|
2004
|
+
t[22] || (t[22] = p("span", { class: "zm-tb-divider" }, null, -1)),
|
|
2005
|
+
i.readonly ? X("", !0) : (C(), E("button", {
|
|
2061
2006
|
key: 0,
|
|
2062
2007
|
class: "zm-tb-btn",
|
|
2063
2008
|
title: "添加子节点 (Tab)",
|
|
2064
|
-
onClick: t[
|
|
2009
|
+
onClick: t[17] || (t[17] = (l) => f.value && Ce(f.value))
|
|
2065
2010
|
}, [
|
|
2066
2011
|
p("img", {
|
|
2067
|
-
src: N(
|
|
2012
|
+
src: N(Dn),
|
|
2068
2013
|
width: "14",
|
|
2069
2014
|
height: "14",
|
|
2070
2015
|
alt: "添加子节点",
|
|
2071
2016
|
draggable: "false"
|
|
2072
|
-
}, null, 8,
|
|
2017
|
+
}, null, 8, Pi)
|
|
2073
2018
|
])),
|
|
2074
|
-
i.readonly ?
|
|
2019
|
+
i.readonly ? X("", !0) : (C(), E("button", {
|
|
2075
2020
|
key: 1,
|
|
2076
2021
|
class: "zm-tb-btn",
|
|
2077
2022
|
title: "添加同级 (Enter)",
|
|
2078
|
-
onClick: t[
|
|
2023
|
+
onClick: t[18] || (t[18] = (l) => f.value && Fe(f.value))
|
|
2079
2024
|
}, [
|
|
2080
2025
|
p("img", {
|
|
2081
|
-
src: N(
|
|
2026
|
+
src: N(Hn),
|
|
2082
2027
|
width: "14",
|
|
2083
2028
|
height: "14",
|
|
2084
2029
|
alt: "添加同级",
|
|
2085
2030
|
draggable: "false"
|
|
2086
|
-
}, null, 8,
|
|
2031
|
+
}, null, 8, Ti)
|
|
2087
2032
|
])),
|
|
2088
|
-
t[
|
|
2033
|
+
t[23] || (t[23] = p("span", { class: "zm-tb-divider" }, null, -1)),
|
|
2089
2034
|
p("button", {
|
|
2090
|
-
class:
|
|
2035
|
+
class: Ie(["zm-tb-btn", { active: k.layoutMode === "mindmap" }]),
|
|
2091
2036
|
title: "思维导图布局 (中心辐射)",
|
|
2092
|
-
onClick: t[
|
|
2037
|
+
onClick: t[19] || (t[19] = (l) => lt("mindmap"))
|
|
2093
2038
|
}, [
|
|
2094
|
-
U
|
|
2039
|
+
q(U, { name: "mindmap" })
|
|
2095
2040
|
], 2),
|
|
2096
2041
|
p("button", {
|
|
2097
|
-
class:
|
|
2042
|
+
class: Ie(["zm-tb-btn", { active: k.layoutMode === "tree" }]),
|
|
2098
2043
|
title: "树形布局 (向右展开)",
|
|
2099
|
-
onClick: t[
|
|
2044
|
+
onClick: t[20] || (t[20] = (l) => lt("tree"))
|
|
2100
2045
|
}, [
|
|
2101
|
-
U
|
|
2046
|
+
q(U, { name: "tree" })
|
|
2102
2047
|
], 2),
|
|
2103
2048
|
p("button", {
|
|
2104
|
-
class:
|
|
2049
|
+
class: Ie(["zm-tb-btn", { active: k.layoutMode === "org" }]),
|
|
2105
2050
|
title: "组织结构布局 (向下展开)",
|
|
2106
|
-
onClick: t[
|
|
2051
|
+
onClick: t[21] || (t[21] = (l) => lt("org"))
|
|
2107
2052
|
}, [
|
|
2108
|
-
U
|
|
2053
|
+
q(U, { name: "org" })
|
|
2109
2054
|
], 2),
|
|
2110
|
-
t[
|
|
2111
|
-
i.readonly ?
|
|
2055
|
+
t[24] || (t[24] = p("span", { class: "zm-tb-divider" }, null, -1)),
|
|
2056
|
+
i.readonly ? X("", !0) : (C(), E("button", {
|
|
2112
2057
|
key: 2,
|
|
2113
2058
|
class: "zm-tb-btn",
|
|
2114
2059
|
title: "导入 JSON",
|
|
2115
|
-
onClick:
|
|
2060
|
+
onClick: zn
|
|
2116
2061
|
}, [
|
|
2117
|
-
U
|
|
2062
|
+
q(U, { name: "import" })
|
|
2118
2063
|
])),
|
|
2119
2064
|
p("button", {
|
|
2120
2065
|
class: "zm-tb-btn",
|
|
2121
2066
|
title: "导出 JSON",
|
|
2122
|
-
onClick:
|
|
2067
|
+
onClick: Nn
|
|
2123
2068
|
}, [
|
|
2124
|
-
U
|
|
2069
|
+
q(U, { name: "export" })
|
|
2125
2070
|
]),
|
|
2126
|
-
p("span",
|
|
2071
|
+
p("span", Oi, be(Math.round(N(S).scale.value * 100)) + "%", 1)
|
|
2127
2072
|
]))
|
|
2128
2073
|
], 4);
|
|
2129
2074
|
};
|
|
2130
2075
|
}
|
|
2131
|
-
}),
|
|
2076
|
+
}), Ui = {
|
|
2132
2077
|
install(i) {
|
|
2133
|
-
i.component("FlowMindMap",
|
|
2078
|
+
i.component("FlowMindMap", Fi);
|
|
2134
2079
|
}
|
|
2135
2080
|
};
|
|
2136
2081
|
export {
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2082
|
+
Fi as MindMap,
|
|
2083
|
+
ai as addChild,
|
|
2084
|
+
si as addSibling,
|
|
2085
|
+
me as clone,
|
|
2086
|
+
Ui as default,
|
|
2142
2087
|
A as findNode,
|
|
2143
|
-
|
|
2088
|
+
ce as findParent,
|
|
2144
2089
|
Xt as markdownToMindMap,
|
|
2145
|
-
|
|
2146
|
-
|
|
2090
|
+
Xi as markdownToRichMindMap,
|
|
2091
|
+
ut as mindMapToMarkdown,
|
|
2147
2092
|
jt as removeNode,
|
|
2148
|
-
|
|
2149
|
-
|
|
2093
|
+
qi as richBlockToMarkdown,
|
|
2094
|
+
ue as uid
|
|
2150
2095
|
};
|