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