@xiangfa/mindmap 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +534 -0
  2. package/README.zh-CN.md +534 -0
  3. package/dist/MindMap.d.ts +3 -0
  4. package/dist/components/MindMapContextMenu.d.ts +20 -0
  5. package/dist/components/MindMapControls.d.ts +16 -0
  6. package/dist/components/MindMapNode.d.ts +32 -0
  7. package/dist/components/icons.d.ts +8 -0
  8. package/dist/esm/MindMap2.js +713 -0
  9. package/dist/esm/components/MindMapContextMenu.js +123 -0
  10. package/dist/esm/components/MindMapControls.js +114 -0
  11. package/dist/esm/components/MindMapNode.js +588 -0
  12. package/dist/esm/components/icons.js +45 -0
  13. package/dist/esm/hooks/useDrag.js +346 -0
  14. package/dist/esm/hooks/useNewNodeAnimation.js +20 -0
  15. package/dist/esm/hooks/useNodeEdit.js +57 -0
  16. package/dist/esm/hooks/usePanZoom.js +85 -0
  17. package/dist/esm/hooks/useTheme.js +16 -0
  18. package/dist/esm/index.js +14 -0
  19. package/dist/esm/logo.svg +9 -0
  20. package/dist/esm/plugins/cross-link.js +65 -0
  21. package/dist/esm/plugins/dotted-line.js +23 -0
  22. package/dist/esm/plugins/folding.js +20 -0
  23. package/dist/esm/plugins/front-matter.js +19 -0
  24. package/dist/esm/plugins/index.js +19 -0
  25. package/dist/esm/plugins/latex.js +132 -0
  26. package/dist/esm/plugins/multi-line.js +39 -0
  27. package/dist/esm/plugins/runner.js +128 -0
  28. package/dist/esm/plugins/tags.js +55 -0
  29. package/dist/esm/style.css +2 -0
  30. package/dist/esm/utils/export.js +50 -0
  31. package/dist/esm/utils/i18n.js +61 -0
  32. package/dist/esm/utils/inline-markdown.js +189 -0
  33. package/dist/esm/utils/layout.js +208 -0
  34. package/dist/esm/utils/markdown.js +288 -0
  35. package/dist/esm/utils/theme.js +119 -0
  36. package/dist/esm/utils/tree-ops.js +136 -0
  37. package/dist/hooks/useDrag.d.ts +40 -0
  38. package/dist/hooks/useNewNodeAnimation.d.ts +2 -0
  39. package/dist/hooks/useNodeEdit.d.ts +17 -0
  40. package/dist/hooks/usePanZoom.d.ts +26 -0
  41. package/dist/hooks/useTheme.d.ts +3 -0
  42. package/dist/index.d.ts +16 -0
  43. package/dist/logo.svg +9 -0
  44. package/dist/mindmap.umd.cjs +24 -0
  45. package/dist/plugins/cross-link.d.ts +2 -0
  46. package/dist/plugins/dotted-line.d.ts +2 -0
  47. package/dist/plugins/folding.d.ts +2 -0
  48. package/dist/plugins/front-matter.d.ts +2 -0
  49. package/dist/plugins/index.d.ts +11 -0
  50. package/dist/plugins/latex.d.ts +20 -0
  51. package/dist/plugins/multi-line.d.ts +2 -0
  52. package/dist/plugins/runner.d.ts +30 -0
  53. package/dist/plugins/tags.d.ts +2 -0
  54. package/dist/plugins/types.d.ts +78 -0
  55. package/dist/style.css +2 -0
  56. package/dist/types.d.ts +105 -0
  57. package/dist/utils/export.d.ts +18 -0
  58. package/dist/utils/i18n.d.ts +22 -0
  59. package/dist/utils/inline-markdown.d.ts +66 -0
  60. package/dist/utils/layout.d.ts +14 -0
  61. package/dist/utils/markdown.d.ts +20 -0
  62. package/dist/utils/theme.d.ts +62 -0
  63. package/dist/utils/tree-ops.d.ts +36 -0
  64. package/package.json +65 -0
@@ -0,0 +1,588 @@
1
+ import { computeTokenLayouts as e, parseInlineMarkdown as t } from "../utils/inline-markdown.js";
2
+ import { runRenderInlineToken as n, runRenderNodeDecoration as r } from "../plugins/runner.js";
3
+ import { getKatexSync as i, loadKatexStyle as a, onKatexReady as o, renderLatexToHtml as s } from "../plugins/latex.js";
4
+ import { useEffect as c, useMemo as l, useState as u } from "react";
5
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ //#region src/components/MindMap/components/MindMapNode.tsx
7
+ var m = "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace";
8
+ function h(e, t, r, i) {
9
+ let { token: a } = e;
10
+ if (a.type !== "text" && a.type !== "bold" && a.type !== "italic" && a.type !== "strikethrough" && a.type !== "code" && a.type !== "highlight" && a.type !== "link" && a.type !== "image" && r && r.length > 0) {
11
+ let i = n(r, e, t);
12
+ if (i) return i;
13
+ }
14
+ switch (a.type) {
15
+ case "bold": return /* @__PURE__ */ f("tspan", {
16
+ className: "mindmap-text-bold",
17
+ fontWeight: 700,
18
+ children: a.content
19
+ }, t);
20
+ case "italic": return /* @__PURE__ */ f("tspan", {
21
+ className: "mindmap-text-italic",
22
+ fontStyle: "italic",
23
+ children: a.content
24
+ }, t);
25
+ case "strikethrough": return /* @__PURE__ */ f("tspan", {
26
+ className: "mindmap-text-strikethrough",
27
+ textDecoration: "line-through",
28
+ opacity: .6,
29
+ children: a.content
30
+ }, t);
31
+ case "code": return /* @__PURE__ */ f("tspan", {
32
+ className: "mindmap-text-code",
33
+ fontFamily: m,
34
+ fontSize: "0.88em",
35
+ children: a.content
36
+ }, t);
37
+ case "highlight": return /* @__PURE__ */ f("tspan", {
38
+ className: "mindmap-text-highlight",
39
+ fill: i || "#FFEB3B",
40
+ children: a.content
41
+ }, t);
42
+ case "link": return /* @__PURE__ */ f("a", {
43
+ className: "mindmap-text-link",
44
+ href: a.url,
45
+ target: "_blank",
46
+ rel: "noopener noreferrer",
47
+ onClick: (e) => e.stopPropagation(),
48
+ onMouseDown: (e) => e.stopPropagation(),
49
+ children: /* @__PURE__ */ f("tspan", {
50
+ fill: "#2563EB",
51
+ textDecoration: "underline",
52
+ children: a.text
53
+ })
54
+ }, t);
55
+ case "image": return /* @__PURE__ */ p("tspan", {
56
+ className: "mindmap-text-image",
57
+ fontStyle: "italic",
58
+ children: [
59
+ "[",
60
+ a.alt || "image",
61
+ "]"
62
+ ]
63
+ }, t);
64
+ case "latex-inline":
65
+ case "latex-block": return /* @__PURE__ */ f("tspan", {
66
+ className: "mindmap-text-latex",
67
+ fontFamily: m,
68
+ fontStyle: "italic",
69
+ fontSize: "0.9em",
70
+ children: a.content
71
+ }, t);
72
+ default: return /* @__PURE__ */ f("tspan", {
73
+ className: "mindmap-text-plain",
74
+ children: a.content
75
+ }, t);
76
+ }
77
+ }
78
+ function g({ status: e, size: t }) {
79
+ return e === "done" ? /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("rect", {
80
+ x: 0,
81
+ y: 0,
82
+ width: t,
83
+ height: t,
84
+ rx: t * .2,
85
+ fill: "#22C55E"
86
+ }), /* @__PURE__ */ f("path", {
87
+ d: `M${t * .28} ${t * .5}L${t * .44} ${t * .66}L${t * .72} ${t * .34}`,
88
+ stroke: "white",
89
+ strokeWidth: t * .13,
90
+ strokeLinecap: "round",
91
+ strokeLinejoin: "round",
92
+ fill: "none"
93
+ })] }) : e === "doing" ? /* @__PURE__ */ p("g", { children: [/* @__PURE__ */ f("rect", {
94
+ x: 0,
95
+ y: 0,
96
+ width: t,
97
+ height: t,
98
+ rx: t * .2,
99
+ fill: "none",
100
+ stroke: "#FBBF24",
101
+ strokeWidth: t * .1
102
+ }), /* @__PURE__ */ f("rect", {
103
+ x: t * .25,
104
+ y: t * .25,
105
+ width: t * .5,
106
+ height: t * .5,
107
+ rx: t * .1,
108
+ fill: "#FBBF24",
109
+ opacity: .6
110
+ })] }) : /* @__PURE__ */ f("rect", {
111
+ x: 0,
112
+ y: 0,
113
+ width: t,
114
+ height: t,
115
+ rx: t * .2,
116
+ fill: "none",
117
+ stroke: "#999",
118
+ strokeWidth: t * .1,
119
+ opacity: .4
120
+ });
121
+ }
122
+ function _({ node: n, fontSize: r, fontWeight: d, fontFamily: m, textColor: _, onRemarkHover: v, plugins: y, highlightTextColor: b, highlightBgColor: x }) {
123
+ let [S, C] = u(() => !!i());
124
+ c(() => {
125
+ S || o(() => C(!0));
126
+ }, [S]);
127
+ let { layouts: w, textContentWidth: T, taskIconWidth: E, totalWidth: D } = l(() => {
128
+ let i = e(t(n.text, y), r, d, m), a = i.length > 0 ? i[i.length - 1].x + i[i.length - 1].width : 0, o = r * .85, s = n.taskStatus ? 4 : 0, c = n.taskStatus ? o + s : 0, l = r * .7, u = n.remark ? 4 : 0, f = n.remark ? l + u : 0;
129
+ return {
130
+ layouts: i,
131
+ textContentWidth: a,
132
+ taskIconWidth: c,
133
+ totalWidth: c + a + f
134
+ };
135
+ }, [
136
+ n.text,
137
+ n.taskStatus,
138
+ n.remark,
139
+ r,
140
+ d,
141
+ m,
142
+ y
143
+ ]), O = -D / 2, k = O + E, A = r * .85, j = -r / 2 - 2, M = r + 4, N = r * .7, P = n.multiLineContent, F = r * 1.4, I = r / 2 + 8;
144
+ return /* @__PURE__ */ p("g", {
145
+ className: "mindmap-node-content",
146
+ children: [
147
+ n.taskStatus && /* @__PURE__ */ f("g", {
148
+ className: `mindmap-task-icon mindmap-task-${n.taskStatus}`,
149
+ transform: `translate(${O}, ${-A / 2})`,
150
+ children: /* @__PURE__ */ f(g, {
151
+ status: n.taskStatus,
152
+ size: A
153
+ })
154
+ }),
155
+ w.map((e, t) => e.token.type === "code" ? /* @__PURE__ */ f("rect", {
156
+ className: "mindmap-code-bg",
157
+ x: k + e.x - 2,
158
+ y: j,
159
+ width: e.width + 4,
160
+ height: M,
161
+ rx: 3,
162
+ fill: "rgba(128,128,128,0.12)"
163
+ }, `bg-${t}`) : e.token.type === "highlight" ? /* @__PURE__ */ f("rect", {
164
+ className: "mindmap-highlight-bg",
165
+ x: k + e.x - 1,
166
+ y: j,
167
+ width: e.width + 2,
168
+ height: M,
169
+ rx: 2,
170
+ fill: x || "rgba(255,213,79,0.3)"
171
+ }, `bg-${t}`) : null),
172
+ /* @__PURE__ */ f("text", {
173
+ className: "mindmap-node-text",
174
+ textAnchor: "start",
175
+ dominantBaseline: "central",
176
+ x: k,
177
+ fill: _,
178
+ fontSize: r,
179
+ fontWeight: d,
180
+ fontFamily: m,
181
+ children: w.map((e, t) => h(e, t, y, b))
182
+ }),
183
+ S && w.map((e, t) => {
184
+ let { token: n } = e;
185
+ if (n.type !== "latex-inline" && n.type !== "latex-block") return null;
186
+ let i = s(n.content, n.type === "latex-block");
187
+ if (!i) return null;
188
+ a();
189
+ let o = k + e.x + e.width / 2, c = Math.max(e.width * 2.5, 120), l = r * 2;
190
+ return /* @__PURE__ */ f("foreignObject", {
191
+ className: "mindmap-latex",
192
+ x: o - c / 2,
193
+ y: -l / 2,
194
+ width: c,
195
+ height: l,
196
+ style: {
197
+ overflow: "visible",
198
+ pointerEvents: "none"
199
+ },
200
+ children: /* @__PURE__ */ f("div", {
201
+ style: {
202
+ fontSize: r * .75,
203
+ lineHeight: `${l}px`,
204
+ color: _,
205
+ whiteSpace: "nowrap",
206
+ textAlign: "center"
207
+ },
208
+ dangerouslySetInnerHTML: { __html: i }
209
+ })
210
+ }, `latex-fo-${t}`);
211
+ }),
212
+ P && P.length > 0 && P.map((n, i) => {
213
+ let o = r * .85, c = e(t(n, y), o, 400, m), l = -(c.length > 0 ? c[c.length - 1].x + c[c.length - 1].width : 0) / 2, u = I + i * F, d = u - o / 2 - 2, g = o + 4;
214
+ return /* @__PURE__ */ p("g", {
215
+ className: "mindmap-multiline",
216
+ children: [
217
+ c.map((e, t) => e.token.type === "code" ? /* @__PURE__ */ f("rect", {
218
+ className: "mindmap-code-bg",
219
+ x: l + e.x - 2,
220
+ y: d,
221
+ width: e.width + 4,
222
+ height: g,
223
+ rx: 3,
224
+ fill: "rgba(128,128,128,0.12)"
225
+ }, `ml-bg-${t}`) : e.token.type === "highlight" ? /* @__PURE__ */ f("rect", {
226
+ className: "mindmap-highlight-bg",
227
+ x: l + e.x - 1,
228
+ y: d,
229
+ width: e.width + 2,
230
+ height: g,
231
+ rx: 2,
232
+ fill: x || "rgba(255,213,79,0.3)"
233
+ }, `ml-bg-${t}`) : null),
234
+ /* @__PURE__ */ f("text", {
235
+ className: "mindmap-multiline-text",
236
+ x: l,
237
+ y: u,
238
+ textAnchor: "start",
239
+ dominantBaseline: "central",
240
+ fill: _,
241
+ fontSize: o,
242
+ fontWeight: 400,
243
+ fontFamily: m,
244
+ opacity: .8,
245
+ children: c.map((e, t) => h(e, t, y, b))
246
+ }),
247
+ S && c.map((e, t) => {
248
+ let { token: n } = e;
249
+ if (n.type !== "latex-inline" && n.type !== "latex-block") return null;
250
+ let r = s(n.content, n.type === "latex-block");
251
+ if (!r) return null;
252
+ a();
253
+ let c = l + e.x + e.width / 2, d = Math.max(e.width * 2.5, 120), p = o * 2;
254
+ return /* @__PURE__ */ f("foreignObject", {
255
+ className: "mindmap-latex",
256
+ x: c - d / 2,
257
+ y: u - p / 2,
258
+ width: d,
259
+ height: p,
260
+ style: {
261
+ overflow: "visible",
262
+ pointerEvents: "none"
263
+ },
264
+ children: /* @__PURE__ */ f("div", {
265
+ style: {
266
+ fontSize: o * .75,
267
+ lineHeight: `${p}px`,
268
+ color: _,
269
+ whiteSpace: "nowrap",
270
+ textAlign: "center",
271
+ opacity: .8
272
+ },
273
+ dangerouslySetInnerHTML: { __html: r }
274
+ })
275
+ }, `ml-latex-fo-${i}-${t}`);
276
+ })
277
+ ]
278
+ }, `ml-${i}`);
279
+ }),
280
+ n.tags && n.tags.length > 0 && (() => {
281
+ let e = r * .65, t = r / 2 + 6 + (P ? P.length * F : 0), i = -D / 2;
282
+ return n.tags.map((n, r) => {
283
+ let a = n.length * e * .65 + 10, o = i;
284
+ i += a + 4;
285
+ let s = [
286
+ "#3B82F6",
287
+ "#8B5CF6",
288
+ "#EC4899",
289
+ "#F59E0B",
290
+ "#10B981",
291
+ "#6366F1"
292
+ ], c = s[r % s.length];
293
+ return /* @__PURE__ */ p("g", {
294
+ className: "mindmap-tag",
295
+ children: [/* @__PURE__ */ f("rect", {
296
+ className: "mindmap-tag-bg",
297
+ x: o,
298
+ y: t,
299
+ width: a,
300
+ height: e + 6,
301
+ rx: 3,
302
+ fill: c,
303
+ opacity: .15
304
+ }), /* @__PURE__ */ f("text", {
305
+ className: "mindmap-tag-text",
306
+ x: o + a / 2,
307
+ y: t + (e + 6) / 2,
308
+ textAnchor: "middle",
309
+ dominantBaseline: "central",
310
+ fontSize: e,
311
+ fill: c,
312
+ fontFamily: m,
313
+ children: n
314
+ })]
315
+ }, `tag-${r}`);
316
+ });
317
+ })(),
318
+ n.remark && /* @__PURE__ */ p("text", {
319
+ className: "mindmap-remark-indicator",
320
+ x: k + T + 4,
321
+ textAnchor: "start",
322
+ dominantBaseline: "central",
323
+ fontSize: N,
324
+ opacity: .5,
325
+ style: { cursor: "help" },
326
+ onMouseEnter: () => v?.(n.id),
327
+ onMouseLeave: () => v?.(null),
328
+ children: [/* @__PURE__ */ f("title", { children: n.remark }), "💬"]
329
+ })
330
+ ]
331
+ });
332
+ }
333
+ function v({ node: e, offset: t, isEditing: n, isPendingEdit: i, isSelected: a, isNew: o, isGhost: s, animClass: c, editText: l, theme: u, direction: m, readonly: h, plugins: g, onMouseDown: v, onClick: y, onDoubleClick: b, onEditChange: x, onEditCommit: S, onEditCancel: C, onAddChild: w, onRemarkHover: T, onFoldToggle: E, expandDelay: D }) {
334
+ let O = e.x + (t?.x ?? 0), k = e.y + (t?.y ?? 0), A = n || i, j = i && !n ? "" : l, M = o ? "mindmap-node-new" : "", N = D === void 0 ? "" : "mindmap-node-expanding", P = D === void 0 ? void 0 : { animationDelay: `${D}ms` }, F = (e.taskStatus === "done" ? "[x] " : e.taskStatus === "doing" ? "[-] " : e.taskStatus === "todo" ? "[ ] " : "") + e.text, I = g && g.length > 0 ? r(g, e, u) : null;
335
+ if (e.depth === 0) {
336
+ let t = u.root.bgColor;
337
+ return /* @__PURE__ */ p("g", {
338
+ transform: `translate(${O}, ${k})`,
339
+ className: `mindmap-node-g mindmap-node-root ${c} ${M} ${N}`,
340
+ onMouseDown: (t) => v(t, e.id),
341
+ onClick: (t) => y(t, e.id),
342
+ onDoubleClick: (t) => b(t, e.id, F),
343
+ style: {
344
+ cursor: "pointer",
345
+ opacity: s ? .3 : 1,
346
+ ...P
347
+ },
348
+ children: [
349
+ /* @__PURE__ */ f("rect", {
350
+ className: "mindmap-node-bg",
351
+ x: -e.width / 2,
352
+ y: -e.height / 2,
353
+ width: e.width,
354
+ height: e.height,
355
+ rx: e.height / 2,
356
+ ry: e.height / 2,
357
+ fill: t,
358
+ stroke: a ? u.selection.strokeColor : "none",
359
+ strokeWidth: a ? 2.5 : 0
360
+ }),
361
+ A ? /* @__PURE__ */ f("foreignObject", {
362
+ x: -e.width / 2,
363
+ y: -e.height / 2,
364
+ width: e.width,
365
+ height: e.height,
366
+ children: /* @__PURE__ */ f("input", {
367
+ className: "mindmap-edit-input mindmap-edit-root",
368
+ value: j,
369
+ onChange: (e) => x(e.target.value),
370
+ onKeyDown: (e) => {
371
+ e.key === "Enter" && S();
372
+ },
373
+ onBlur: S,
374
+ autoFocus: !0,
375
+ style: {
376
+ fontSize: u.root.fontSize,
377
+ fontWeight: u.root.fontWeight,
378
+ fontFamily: u.root.fontFamily
379
+ }
380
+ })
381
+ }) : /* @__PURE__ */ f(_, {
382
+ node: e,
383
+ fontSize: u.root.fontSize,
384
+ fontWeight: u.root.fontWeight,
385
+ fontFamily: u.root.fontFamily,
386
+ textColor: u.root.textColor,
387
+ onRemarkHover: T,
388
+ plugins: g,
389
+ highlightTextColor: u.highlight.textColor,
390
+ highlightBgColor: u.highlight.bgColor
391
+ }),
392
+ I,
393
+ !h && !s && (m === "right" || m === "both") && /* @__PURE__ */ p("g", {
394
+ className: "mindmap-add-btn",
395
+ onMouseDown: (e) => e.stopPropagation(),
396
+ onClick: (t) => w(t, e.id, "right"),
397
+ children: [
398
+ /* @__PURE__ */ f("circle", {
399
+ cx: e.width / 2 + 18,
400
+ cy: 0,
401
+ r: 11,
402
+ fill: u.addBtn.fill
403
+ }),
404
+ /* @__PURE__ */ f("line", {
405
+ x1: e.width / 2 + 14,
406
+ y1: 0,
407
+ x2: e.width / 2 + 22,
408
+ y2: 0,
409
+ stroke: u.addBtn.iconColor,
410
+ strokeWidth: 2,
411
+ strokeLinecap: "round"
412
+ }),
413
+ /* @__PURE__ */ f("line", {
414
+ x1: e.width / 2 + 18,
415
+ y1: -4,
416
+ x2: e.width / 2 + 18,
417
+ y2: 4,
418
+ stroke: u.addBtn.iconColor,
419
+ strokeWidth: 2,
420
+ strokeLinecap: "round"
421
+ })
422
+ ]
423
+ }),
424
+ !h && !s && (m === "left" || m === "both") && /* @__PURE__ */ p("g", {
425
+ className: "mindmap-add-btn",
426
+ onMouseDown: (e) => e.stopPropagation(),
427
+ onClick: (t) => w(t, e.id, "left"),
428
+ children: [
429
+ /* @__PURE__ */ f("circle", {
430
+ cx: -(e.width / 2 + 18),
431
+ cy: 0,
432
+ r: 11,
433
+ fill: u.addBtn.fill
434
+ }),
435
+ /* @__PURE__ */ f("line", {
436
+ x1: -(e.width / 2 + 22),
437
+ y1: 0,
438
+ x2: -(e.width / 2 + 14),
439
+ y2: 0,
440
+ stroke: u.addBtn.iconColor,
441
+ strokeWidth: 2,
442
+ strokeLinecap: "round"
443
+ }),
444
+ /* @__PURE__ */ f("line", {
445
+ x1: -(e.width / 2 + 18),
446
+ y1: -4,
447
+ x2: -(e.width / 2 + 18),
448
+ y2: 4,
449
+ stroke: u.addBtn.iconColor,
450
+ strokeWidth: 2,
451
+ strokeLinecap: "round"
452
+ })
453
+ ]
454
+ }),
455
+ e.collapsed !== void 0 && h && E && /* @__PURE__ */ f("g", {
456
+ className: "mindmap-fold-btn",
457
+ style: { cursor: "pointer" },
458
+ onMouseDown: (e) => e.stopPropagation(),
459
+ onClick: (t) => {
460
+ t.stopPropagation(), E(e.id);
461
+ },
462
+ children: /* @__PURE__ */ f("circle", {
463
+ cx: e.width / 2 + 14,
464
+ cy: 0,
465
+ r: 6,
466
+ fill: e.color
467
+ })
468
+ })
469
+ ]
470
+ }, e.id);
471
+ }
472
+ let L = e.depth === 1 ? u.level1.fontSize : u.node.fontSize, R = e.depth === 1 ? u.level1.fontWeight : u.node.fontWeight, z = e.width - u.node.paddingH * 2, B = L / 2 + 4, V = e.side === "left" ? -e.width / 2 - 18 : e.width / 2 + 18;
473
+ return /* @__PURE__ */ p("g", {
474
+ transform: `translate(${O}, ${k})`,
475
+ className: `mindmap-node-g mindmap-node-child ${c} ${M}`,
476
+ onMouseDown: (t) => v(t, e.id),
477
+ onClick: (t) => y(t, e.id),
478
+ onDoubleClick: (t) => b(t, e.id, F),
479
+ style: {
480
+ cursor: "pointer",
481
+ opacity: s ? .3 : 1
482
+ },
483
+ children: [
484
+ /* @__PURE__ */ f("rect", {
485
+ className: "mindmap-node-bg",
486
+ x: -e.width / 2,
487
+ y: -e.height / 2,
488
+ width: e.width,
489
+ height: e.height,
490
+ fill: a ? u.selection.fillColor : "transparent",
491
+ stroke: a ? u.selection.strokeColor : "none",
492
+ strokeWidth: a ? 1.5 : 0,
493
+ rx: 4
494
+ }),
495
+ A ? /* @__PURE__ */ f("foreignObject", {
496
+ x: -Math.max(e.width, 80) / 2,
497
+ y: -e.height / 2,
498
+ width: Math.max(e.width, 80),
499
+ height: e.height,
500
+ children: /* @__PURE__ */ f("input", {
501
+ className: "mindmap-edit-input mindmap-edit-child",
502
+ value: j,
503
+ onChange: (e) => x(e.target.value),
504
+ onKeyDown: (e) => {
505
+ e.key === "Enter" && S(), e.key === "Escape" && C();
506
+ },
507
+ onBlur: S,
508
+ autoFocus: !0,
509
+ style: {
510
+ fontSize: L,
511
+ fontWeight: R,
512
+ fontFamily: u.node.fontFamily,
513
+ color: u.node.textColor,
514
+ textAlign: "center",
515
+ borderBottom: `2.5px solid ${e.color}`
516
+ }
517
+ })
518
+ }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(_, {
519
+ node: e,
520
+ fontSize: L,
521
+ fontWeight: R,
522
+ fontFamily: u.node.fontFamily,
523
+ textColor: u.node.textColor,
524
+ onRemarkHover: T,
525
+ plugins: g,
526
+ highlightTextColor: u.highlight.textColor,
527
+ highlightBgColor: u.highlight.bgColor
528
+ }), /* @__PURE__ */ f("line", {
529
+ className: "mindmap-node-underline",
530
+ x1: -z / 2,
531
+ y1: B,
532
+ x2: z / 2,
533
+ y2: B,
534
+ stroke: e.color,
535
+ strokeWidth: 2.5,
536
+ strokeLinecap: "round"
537
+ })] }),
538
+ I,
539
+ !h && !s && /* @__PURE__ */ p("g", {
540
+ className: "mindmap-add-btn",
541
+ onMouseDown: (e) => e.stopPropagation(),
542
+ onClick: (t) => w(t, e.id),
543
+ children: [
544
+ /* @__PURE__ */ f("circle", {
545
+ cx: V,
546
+ cy: 0,
547
+ r: 11,
548
+ fill: u.addBtn.fill
549
+ }),
550
+ /* @__PURE__ */ f("line", {
551
+ x1: V - 4,
552
+ y1: 0,
553
+ x2: V + 4,
554
+ y2: 0,
555
+ stroke: u.addBtn.iconColor,
556
+ strokeWidth: 2,
557
+ strokeLinecap: "round"
558
+ }),
559
+ /* @__PURE__ */ f("line", {
560
+ x1: V,
561
+ y1: -4,
562
+ x2: V,
563
+ y2: 4,
564
+ stroke: u.addBtn.iconColor,
565
+ strokeWidth: 2,
566
+ strokeLinecap: "round"
567
+ })
568
+ ]
569
+ }),
570
+ e.collapsed !== void 0 && h && E && /* @__PURE__ */ f("g", {
571
+ className: "mindmap-fold-btn",
572
+ style: { cursor: "pointer" },
573
+ onMouseDown: (e) => e.stopPropagation(),
574
+ onClick: (t) => {
575
+ t.stopPropagation(), E(e.id);
576
+ },
577
+ children: /* @__PURE__ */ f("circle", {
578
+ cx: V,
579
+ cy: 0,
580
+ r: 6,
581
+ fill: e.color
582
+ })
583
+ })
584
+ ]
585
+ }, e.id);
586
+ }
587
+ //#endregion
588
+ export { v as MindMapNode };
@@ -0,0 +1,45 @@
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ //#region src/components/MindMap/components/icons.tsx
3
+ function n({ size: n = 24, className: r }) {
4
+ return /* @__PURE__ */ t("svg", {
5
+ width: n,
6
+ height: n,
7
+ viewBox: "0 0 24 24",
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeWidth: 2,
11
+ strokeLinecap: "round",
12
+ className: r,
13
+ children: [/* @__PURE__ */ e("line", {
14
+ x1: "12",
15
+ y1: "5",
16
+ x2: "12",
17
+ y2: "19"
18
+ }), /* @__PURE__ */ e("line", {
19
+ x1: "5",
20
+ y1: "12",
21
+ x2: "19",
22
+ y2: "12"
23
+ })]
24
+ });
25
+ }
26
+ function r({ size: t = 24, className: n }) {
27
+ return /* @__PURE__ */ e("svg", {
28
+ width: t,
29
+ height: t,
30
+ viewBox: "0 0 24 24",
31
+ fill: "none",
32
+ stroke: "currentColor",
33
+ strokeWidth: 2,
34
+ strokeLinecap: "round",
35
+ className: n,
36
+ children: /* @__PURE__ */ e("line", {
37
+ x1: "5",
38
+ y1: "12",
39
+ x2: "19",
40
+ y2: "12"
41
+ })
42
+ });
43
+ }
44
+ //#endregion
45
+ export { r as IconMinus, n as IconPlus };