@xiangfa/mindmap 0.4.0 → 0.5.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/README.md +32 -0
- package/README.zh-CN.md +32 -0
- package/dist/components/MindMapContextMenu.d.ts +1 -1
- package/dist/components/MindMapControls.d.ts +1 -1
- package/dist/esm/MindMap2.js +321 -333
- package/dist/esm/components/MindMapAIInput.js +2 -12
- package/dist/esm/components/MindMapContextMenu.js +28 -57
- package/dist/esm/components/MindMapControls.js +14 -27
- package/dist/esm/components/MindMapNode.js +8 -27
- package/dist/esm/style.css +1 -1
- package/dist/esm/utils/export.js +25 -25
- package/dist/esm/utils/layout.js +26 -18
- package/dist/esm/utils/theme.js +44 -1
- package/dist/mindmap.umd.cjs +22 -25
- package/dist/style.css +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils/export.d.ts +2 -1
- package/dist/utils/theme.d.ts +10 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { IconClose as e, IconLightning as t, IconLoaderCircle as n, IconPapercli
|
|
|
2
2
|
import { useCallback as a, useRef as o, useState as s } from "react";
|
|
3
3
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/MindMap/components/MindMapAIInput.tsx
|
|
5
|
-
var d = "#Role\nYou are a professional Mind Map Generator specializing in hierarchical information architecture. Your objective is to deconstruct complex topics into a robust, visual Markdown outline.\n\n#Logic and Structure\n- Primary Branches: Use the MECE (Mutually Exclusive, Collectively Exhaustive) principle to ensure no overlap and complete coverage of the topic.\n- Branching Density: Aim for 3-5 primary branches. For narrow topics that do not naturally yield five branches, provide at least 3 branches and prioritize hierarchical depth over breadth.\n- Hierarchical Depth: The structure must not exceed a maximum depth of the Root + 3 levels.\n- Logical Flow: Organize the sequence of branches and sub-nodes based on priority, moving from foundational concepts to advanced applications.\n
|
|
5
|
+
var d = "#Role\nYou are a professional Mind Map Generator specializing in hierarchical information architecture. Your objective is to deconstruct complex topics into a robust, visual Markdown outline.\n\n#Logic and Structure\n- Primary Branches: Use the MECE (Mutually Exclusive, Collectively Exhaustive) principle to ensure no overlap and complete coverage of the topic.\n- Branching Density: Aim for 3-5 primary branches. For narrow topics that do not naturally yield five branches, provide at least 3 branches and prioritize hierarchical depth over breadth.\n- Hierarchical Depth: The structure must not exceed a maximum depth of the Root + 3 levels.\n- Logical Flow: Organize the sequence of branches and sub-nodes based on priority, moving from foundational concepts to advanced applications.\n\n#Formatting Standards\n- Root Node: Place the root node on the first line of the response with no prefix (no hyphen, bullet, or number).\n- Indentation: Use exactly two spaces per level of hierarchy to define the structure.\n- Child Node Prefix: Every child node must start with a hyphen followed by a space (\"- \").\n- Text Constraints: Each node must contain between 2 and 6 visible words. Markdown formatting characters (e.g., **, ==, `) do not count toward this 2-6 word limit.\n- Remarks: Insert contextual notes or brief explanations immediately after relevant nodes using the \"> \" prefix.\n- Inline Styling: Use Obsidian-compatible Markdown for emphasis: **bold**, *italic*, `code`, ~~strikethrough~~, and ==highlighting==.\n\n#Extended Syntax (Optional)\nUse these features only when they naturally enhance the mind map's clarity or structure. Do not force them into every response.\n- Dotted Lines: Use \"-.\" instead of \"-\" for weak, optional, or tentative relationships. Example: \"-. Optional Step\"\n- Multi-line Content: Use \"|\" prefix lines to append additional display lines to a node. Example:\n - Main Point\n | Supporting detail line 1\n | Supporting detail line 2\n- Tags: Add \"#tag\" at the end of node text for categorization. Example: \"- React #frontend #framework\"\n- Cross-links: Define anchors with \"{#id}\" and link with \"-> {#id}\" to connect nodes across branches. Example:\n - Node A {#a}\n - Node B\n -> {#a} \"references\"\n- Folding: Use \"+\" instead of \"-\" to mark a node as initially collapsed (children hidden by default). Example: \"+ Collapsed Section\"\n- LaTeX: Use \"$...$\" for inline math and \"$$...$$\" for display math. Example: \"- Energy: $E = mc^2$\"\n- Frontmatter: Use a \"---\" block at the very top to set layout direction or theme:\n ---\n direction: right\n theme: dark\n ---\n\n#Example Output\nProject Management\n- **Foundational Concepts** #core\n - Project Life Cycle\n > Initiation through closing phases\n | Planning, executing, monitoring\n - Stakeholder Identification\n- *Execution Frameworks*\n - ==Agile Methodologies==\n -. Hybrid Approaches\n- Advanced Optimization\n - Resource Load Balancing\n > Optimizing team allocation\n - Portfolio Risk Mitigation\n\n#Constraints\n- Provide the raw Markdown output only.\n- Do not include any introductory text, conversational fillers, or explanations.\n- Do not include any concluding remarks or summaries.\n- Use extended syntax features (dotted lines, tags, multi-line, cross-links, etc.) only when they genuinely improve the mind map's clarity or structure. Default to basic syntax.\n- FINAL NEGATIVE CONSTRAINT: Do not wrap the output in markdown code fences. Provide the response as raw, plain text.";
|
|
6
6
|
function f(e) {
|
|
7
7
|
if (!e || e.length === 0) return "";
|
|
8
8
|
let t = [];
|
|
@@ -129,24 +129,17 @@ function g({ config: g, theme: _, messages: v, currentMarkdown: y, onMarkdownStr
|
|
|
129
129
|
}, []);
|
|
130
130
|
return /* @__PURE__ */ u("div", {
|
|
131
131
|
className: "mindmap-ai-input",
|
|
132
|
-
style: {
|
|
133
|
-
background: _.controls.bgColor,
|
|
134
|
-
color: _.controls.textColor,
|
|
135
|
-
borderColor: _.contextMenu.borderColor
|
|
136
|
-
},
|
|
137
132
|
children: [
|
|
138
133
|
D.length > 0 && /* @__PURE__ */ l("div", {
|
|
139
134
|
className: "mindmap-ai-file-previews",
|
|
140
135
|
children: D.map((t, n) => /* @__PURE__ */ u("span", {
|
|
141
136
|
className: "mindmap-ai-file-chip",
|
|
142
|
-
style: { background: _.controls.hoverBg },
|
|
143
137
|
children: [/* @__PURE__ */ l("span", {
|
|
144
138
|
className: "mindmap-ai-file-name",
|
|
145
139
|
children: t.name
|
|
146
140
|
}), /* @__PURE__ */ l("button", {
|
|
147
141
|
className: "mindmap-ai-file-remove",
|
|
148
142
|
onClick: () => z(n),
|
|
149
|
-
style: { color: _.controls.textColor },
|
|
150
143
|
children: /* @__PURE__ */ l(e, { size: 12 })
|
|
151
144
|
})]
|
|
152
145
|
}, n))
|
|
@@ -159,7 +152,6 @@ function g({ config: g, theme: _, messages: v, currentMarkdown: y, onMarkdownStr
|
|
|
159
152
|
onClick: () => M.current?.click(),
|
|
160
153
|
disabled: T,
|
|
161
154
|
title: v.aiPlaceholder,
|
|
162
|
-
style: { color: _.controls.textColor },
|
|
163
155
|
children: /* @__PURE__ */ l(r, { size: 18 })
|
|
164
156
|
}), /* @__PURE__ */ l("input", {
|
|
165
157
|
ref: M,
|
|
@@ -176,8 +168,7 @@ function g({ config: g, theme: _, messages: v, currentMarkdown: y, onMarkdownStr
|
|
|
176
168
|
onChange: (e) => w(e.target.value),
|
|
177
169
|
onKeyDown: L,
|
|
178
170
|
placeholder: T ? v.aiGenerating : v.aiPlaceholder,
|
|
179
|
-
disabled: T
|
|
180
|
-
style: { color: _.controls.textColor }
|
|
171
|
+
disabled: T
|
|
181
172
|
}),
|
|
182
173
|
/* @__PURE__ */ l("button", {
|
|
183
174
|
className: `mindmap-ai-send-btn${T ? " mindmap-ai-send-btn--loading" : ""}`,
|
|
@@ -199,7 +190,6 @@ function g({ config: g, theme: _, messages: v, currentMarkdown: y, onMarkdownStr
|
|
|
199
190
|
}),
|
|
200
191
|
k && /* @__PURE__ */ l("div", {
|
|
201
192
|
className: "mindmap-ai-error",
|
|
202
|
-
style: { color: "#ef4444" },
|
|
203
193
|
children: k
|
|
204
194
|
})
|
|
205
195
|
]
|
|
@@ -1,116 +1,87 @@
|
|
|
1
1
|
import { useState as e } from "react";
|
|
2
2
|
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/MindMap/components/MindMapContextMenu.tsx
|
|
4
|
-
function i({ position: i,
|
|
5
|
-
let [
|
|
4
|
+
function i({ position: i, messages: a, readonly: o, onNewRootNode: s, onExportSVG: c, onExportPNG: l, onExportMarkdown: u, onDirectionChange: d, onClose: f }) {
|
|
5
|
+
let [p, m] = e(!1), [h, g] = e(!1);
|
|
6
6
|
return /* @__PURE__ */ r("div", {
|
|
7
7
|
className: "mindmap-context-menu",
|
|
8
8
|
style: {
|
|
9
9
|
left: i.x,
|
|
10
|
-
top: i.y
|
|
11
|
-
background: a.contextMenu.bgColor,
|
|
12
|
-
color: a.contextMenu.textColor,
|
|
13
|
-
boxShadow: `0 4px 16px ${a.contextMenu.shadowColor}`,
|
|
14
|
-
borderColor: a.contextMenu.borderColor
|
|
10
|
+
top: i.y
|
|
15
11
|
},
|
|
16
12
|
onClick: (e) => e.stopPropagation(),
|
|
17
13
|
children: [
|
|
18
|
-
!
|
|
14
|
+
!o && /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ n("div", {
|
|
19
15
|
className: "mindmap-ctx-item mindmap-ctx-new-root",
|
|
20
|
-
onClick:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}), /* @__PURE__ */ n("div", {
|
|
24
|
-
className: "mindmap-ctx-divider",
|
|
25
|
-
style: { borderColor: a.contextMenu.borderColor }
|
|
26
|
-
})] }),
|
|
16
|
+
onClick: s,
|
|
17
|
+
children: a.newRootNode
|
|
18
|
+
}), /* @__PURE__ */ n("div", { className: "mindmap-ctx-divider" })] }),
|
|
27
19
|
/* @__PURE__ */ r("div", {
|
|
28
20
|
className: "mindmap-ctx-item mindmap-ctx-has-sub mindmap-ctx-layout",
|
|
29
|
-
onMouseEnter: () =>
|
|
30
|
-
onMouseLeave: () =>
|
|
31
|
-
style: { color: a.contextMenu.textColor },
|
|
21
|
+
onMouseEnter: () => g(!0),
|
|
22
|
+
onMouseLeave: () => g(!1),
|
|
32
23
|
children: [
|
|
33
|
-
|
|
24
|
+
a.layout,
|
|
34
25
|
/* @__PURE__ */ n("span", {
|
|
35
26
|
className: "mindmap-ctx-arrow",
|
|
36
27
|
children: "▶"
|
|
37
28
|
}),
|
|
38
|
-
|
|
29
|
+
h && /* @__PURE__ */ r("div", {
|
|
39
30
|
className: "mindmap-ctx-submenu",
|
|
40
|
-
style: {
|
|
41
|
-
background: a.contextMenu.bgColor,
|
|
42
|
-
boxShadow: `0 4px 16px ${a.contextMenu.shadowColor}`,
|
|
43
|
-
borderColor: a.contextMenu.borderColor
|
|
44
|
-
},
|
|
45
31
|
children: [
|
|
46
32
|
/* @__PURE__ */ n("div", {
|
|
47
33
|
className: "mindmap-ctx-item mindmap-ctx-layout-left",
|
|
48
34
|
onClick: () => {
|
|
49
|
-
|
|
35
|
+
d("left"), f();
|
|
50
36
|
},
|
|
51
|
-
|
|
52
|
-
children: o.layoutLeft
|
|
37
|
+
children: a.layoutLeft
|
|
53
38
|
}),
|
|
54
39
|
/* @__PURE__ */ n("div", {
|
|
55
40
|
className: "mindmap-ctx-item mindmap-ctx-layout-both",
|
|
56
41
|
onClick: () => {
|
|
57
|
-
|
|
42
|
+
d("both"), f();
|
|
58
43
|
},
|
|
59
|
-
|
|
60
|
-
children: o.layoutBoth
|
|
44
|
+
children: a.layoutBoth
|
|
61
45
|
}),
|
|
62
46
|
/* @__PURE__ */ n("div", {
|
|
63
47
|
className: "mindmap-ctx-item mindmap-ctx-layout-right",
|
|
64
48
|
onClick: () => {
|
|
65
|
-
|
|
49
|
+
d("right"), f();
|
|
66
50
|
},
|
|
67
|
-
|
|
68
|
-
children: o.layoutRight
|
|
51
|
+
children: a.layoutRight
|
|
69
52
|
})
|
|
70
53
|
]
|
|
71
54
|
})
|
|
72
55
|
]
|
|
73
56
|
}),
|
|
74
|
-
/* @__PURE__ */ n("div", {
|
|
75
|
-
className: "mindmap-ctx-divider",
|
|
76
|
-
style: { borderColor: a.contextMenu.borderColor }
|
|
77
|
-
}),
|
|
57
|
+
/* @__PURE__ */ n("div", { className: "mindmap-ctx-divider" }),
|
|
78
58
|
/* @__PURE__ */ r("div", {
|
|
79
59
|
className: "mindmap-ctx-item mindmap-ctx-has-sub mindmap-ctx-export",
|
|
80
|
-
onMouseEnter: () =>
|
|
81
|
-
onMouseLeave: () =>
|
|
82
|
-
style: { color: a.contextMenu.textColor },
|
|
60
|
+
onMouseEnter: () => m(!0),
|
|
61
|
+
onMouseLeave: () => m(!1),
|
|
83
62
|
children: [
|
|
84
|
-
|
|
63
|
+
a.export,
|
|
85
64
|
/* @__PURE__ */ n("span", {
|
|
86
65
|
className: "mindmap-ctx-arrow",
|
|
87
66
|
children: "▶"
|
|
88
67
|
}),
|
|
89
|
-
|
|
68
|
+
p && /* @__PURE__ */ r("div", {
|
|
90
69
|
className: "mindmap-ctx-submenu",
|
|
91
|
-
style: {
|
|
92
|
-
background: a.contextMenu.bgColor,
|
|
93
|
-
boxShadow: `0 4px 16px ${a.contextMenu.shadowColor}`,
|
|
94
|
-
borderColor: a.contextMenu.borderColor
|
|
95
|
-
},
|
|
96
70
|
children: [
|
|
97
71
|
/* @__PURE__ */ n("div", {
|
|
98
72
|
className: "mindmap-ctx-item mindmap-ctx-export-svg",
|
|
99
|
-
onClick:
|
|
100
|
-
|
|
101
|
-
children: o.exportSVG
|
|
73
|
+
onClick: c,
|
|
74
|
+
children: a.exportSVG
|
|
102
75
|
}),
|
|
103
76
|
/* @__PURE__ */ n("div", {
|
|
104
77
|
className: "mindmap-ctx-item mindmap-ctx-export-png",
|
|
105
|
-
onClick:
|
|
106
|
-
|
|
107
|
-
children: o.exportPNG
|
|
78
|
+
onClick: l,
|
|
79
|
+
children: a.exportPNG
|
|
108
80
|
}),
|
|
109
81
|
/* @__PURE__ */ n("div", {
|
|
110
82
|
className: "mindmap-ctx-item mindmap-ctx-export-md",
|
|
111
|
-
onClick:
|
|
112
|
-
|
|
113
|
-
children: o.exportMarkdown
|
|
83
|
+
onClick: u,
|
|
84
|
+
children: a.exportMarkdown
|
|
114
85
|
})
|
|
115
86
|
]
|
|
116
87
|
})
|
|
@@ -1,48 +1,36 @@
|
|
|
1
1
|
import { IconMinus as e, IconPlus as t } from "./icons.js";
|
|
2
2
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/MindMap/components/MindMapControls.tsx
|
|
4
|
-
function a({ zoom: a,
|
|
5
|
-
return /* @__PURE__ */ i(n, { children: [
|
|
4
|
+
function a({ zoom: a, messages: o, showZoom: s = !0, mode: c, isFullscreen: l, onZoomIn: u, onZoomOut: d, onAutoFit: f, onModeToggle: p, onFullscreenToggle: m }) {
|
|
5
|
+
return /* @__PURE__ */ i(n, { children: [s && /* @__PURE__ */ i("div", {
|
|
6
6
|
className: "mindmap-zoom-controls",
|
|
7
|
-
style: {
|
|
8
|
-
background: o.controls.bgColor,
|
|
9
|
-
color: o.controls.textColor
|
|
10
|
-
},
|
|
11
7
|
children: [
|
|
12
8
|
/* @__PURE__ */ r("button", {
|
|
13
9
|
className: "mindmap-ctrl-btn mindmap-ctrl-zoom-out",
|
|
14
|
-
onClick:
|
|
15
|
-
title:
|
|
16
|
-
style: { color: o.controls.textColor },
|
|
10
|
+
onClick: d,
|
|
11
|
+
title: o.zoomOut,
|
|
17
12
|
children: /* @__PURE__ */ r(e, { size: 16 })
|
|
18
13
|
}),
|
|
19
14
|
/* @__PURE__ */ i("button", {
|
|
20
15
|
className: "mindmap-ctrl-pct",
|
|
21
|
-
onClick:
|
|
22
|
-
title:
|
|
23
|
-
style: { color: o.controls.textColor },
|
|
16
|
+
onClick: f,
|
|
17
|
+
title: o.resetView,
|
|
24
18
|
children: [Math.round(a * 100), "%"]
|
|
25
19
|
}),
|
|
26
20
|
/* @__PURE__ */ r("button", {
|
|
27
21
|
className: "mindmap-ctrl-btn mindmap-ctrl-zoom-in",
|
|
28
|
-
onClick:
|
|
29
|
-
title:
|
|
30
|
-
style: { color: o.controls.textColor },
|
|
22
|
+
onClick: u,
|
|
23
|
+
title: o.zoomIn,
|
|
31
24
|
children: /* @__PURE__ */ r(t, { size: 16 })
|
|
32
25
|
})
|
|
33
26
|
]
|
|
34
27
|
}), /* @__PURE__ */ i("div", {
|
|
35
28
|
className: "mindmap-extra-controls",
|
|
36
|
-
style: {
|
|
37
|
-
background: o.controls.bgColor,
|
|
38
|
-
color: o.controls.textColor
|
|
39
|
-
},
|
|
40
29
|
children: [/* @__PURE__ */ r("button", {
|
|
41
30
|
className: "mindmap-ctrl-btn mindmap-ctrl-mode",
|
|
42
|
-
onClick:
|
|
43
|
-
title:
|
|
44
|
-
|
|
45
|
-
children: l === "view" ? /* @__PURE__ */ i("svg", {
|
|
31
|
+
onClick: p,
|
|
32
|
+
title: c === "view" ? o.textMode : o.viewMode,
|
|
33
|
+
children: c === "view" ? /* @__PURE__ */ i("svg", {
|
|
46
34
|
width: 16,
|
|
47
35
|
height: 16,
|
|
48
36
|
viewBox: "0 0 24 24",
|
|
@@ -73,10 +61,9 @@ function a({ zoom: a, theme: o, messages: s, showZoom: c = !0, mode: l, isFullsc
|
|
|
73
61
|
})
|
|
74
62
|
}), /* @__PURE__ */ r("button", {
|
|
75
63
|
className: "mindmap-ctrl-btn mindmap-ctrl-fullscreen",
|
|
76
|
-
onClick:
|
|
77
|
-
title:
|
|
78
|
-
|
|
79
|
-
children: u ? /* @__PURE__ */ i("svg", {
|
|
64
|
+
onClick: m,
|
|
65
|
+
title: l ? o.exitFullscreen : o.fullscreen,
|
|
66
|
+
children: l ? /* @__PURE__ */ i("svg", {
|
|
80
67
|
width: 16,
|
|
81
68
|
height: 16,
|
|
82
69
|
viewBox: "0 0 24 24",
|
|
@@ -193,17 +193,12 @@ function _({ node: n, fontSize: r, fontWeight: d, fontFamily: m, textColor: _, o
|
|
|
193
193
|
y: -l / 2,
|
|
194
194
|
width: c,
|
|
195
195
|
height: l,
|
|
196
|
-
style: {
|
|
197
|
-
overflow: "visible",
|
|
198
|
-
pointerEvents: "none"
|
|
199
|
-
},
|
|
200
196
|
children: /* @__PURE__ */ f("div", {
|
|
197
|
+
className: "mindmap-latex-content",
|
|
201
198
|
style: {
|
|
202
199
|
fontSize: r * .75,
|
|
203
200
|
lineHeight: `${l}px`,
|
|
204
|
-
color: _
|
|
205
|
-
whiteSpace: "nowrap",
|
|
206
|
-
textAlign: "center"
|
|
201
|
+
color: _
|
|
207
202
|
},
|
|
208
203
|
dangerouslySetInnerHTML: { __html: i }
|
|
209
204
|
})
|
|
@@ -257,17 +252,12 @@ function _({ node: n, fontSize: r, fontWeight: d, fontFamily: m, textColor: _, o
|
|
|
257
252
|
y: u - p / 2,
|
|
258
253
|
width: d,
|
|
259
254
|
height: p,
|
|
260
|
-
style: {
|
|
261
|
-
overflow: "visible",
|
|
262
|
-
pointerEvents: "none"
|
|
263
|
-
},
|
|
264
255
|
children: /* @__PURE__ */ f("div", {
|
|
256
|
+
className: "mindmap-latex-content",
|
|
265
257
|
style: {
|
|
266
258
|
fontSize: o * .75,
|
|
267
259
|
lineHeight: `${p}px`,
|
|
268
260
|
color: _,
|
|
269
|
-
whiteSpace: "nowrap",
|
|
270
|
-
textAlign: "center",
|
|
271
261
|
opacity: .8
|
|
272
262
|
},
|
|
273
263
|
dangerouslySetInnerHTML: { __html: r }
|
|
@@ -322,7 +312,6 @@ function _({ node: n, fontSize: r, fontWeight: d, fontFamily: m, textColor: _, o
|
|
|
322
312
|
dominantBaseline: "central",
|
|
323
313
|
fontSize: N,
|
|
324
314
|
opacity: .5,
|
|
325
|
-
style: { cursor: "help" },
|
|
326
315
|
onMouseEnter: () => v?.(n.id),
|
|
327
316
|
onMouseLeave: () => v?.(null),
|
|
328
317
|
children: [/* @__PURE__ */ f("title", { children: n.remark }), "💬"]
|
|
@@ -336,15 +325,12 @@ function v({ node: e, offset: t, isEditing: n, isPendingEdit: i, isSelected: a,
|
|
|
336
325
|
let t = u.root.bgColor;
|
|
337
326
|
return /* @__PURE__ */ p("g", {
|
|
338
327
|
transform: `translate(${O}, ${k})`,
|
|
339
|
-
className: `mindmap-node-g mindmap-node-root ${c} ${M} ${N}`,
|
|
328
|
+
className: `mindmap-node-g mindmap-node-root ${c} ${M} ${N}${s ? " mindmap-node-ghost" : ""}`,
|
|
329
|
+
"data-branch-index": e.branchIndex,
|
|
340
330
|
onMouseDown: (t) => v(t, e.id),
|
|
341
331
|
onClick: (t) => y(t, e.id),
|
|
342
332
|
onDoubleClick: (t) => b(t, e.id, F),
|
|
343
|
-
style:
|
|
344
|
-
cursor: "pointer",
|
|
345
|
-
opacity: s ? .3 : 1,
|
|
346
|
-
...P
|
|
347
|
-
},
|
|
333
|
+
style: P,
|
|
348
334
|
children: [
|
|
349
335
|
/* @__PURE__ */ f("rect", {
|
|
350
336
|
className: "mindmap-node-bg",
|
|
@@ -454,7 +440,6 @@ function v({ node: e, offset: t, isEditing: n, isPendingEdit: i, isSelected: a,
|
|
|
454
440
|
}),
|
|
455
441
|
e.collapsed !== void 0 && h && E && /* @__PURE__ */ f("g", {
|
|
456
442
|
className: "mindmap-fold-btn",
|
|
457
|
-
style: { cursor: "pointer" },
|
|
458
443
|
onMouseDown: (e) => e.stopPropagation(),
|
|
459
444
|
onClick: (t) => {
|
|
460
445
|
t.stopPropagation(), E(e.id);
|
|
@@ -472,14 +457,11 @@ function v({ node: e, offset: t, isEditing: n, isPendingEdit: i, isSelected: a,
|
|
|
472
457
|
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
458
|
return /* @__PURE__ */ p("g", {
|
|
474
459
|
transform: `translate(${O}, ${k})`,
|
|
475
|
-
className: `mindmap-node-g mindmap-node-child ${c} ${M}`,
|
|
460
|
+
className: `mindmap-node-g mindmap-node-child ${c} ${M}${s ? " mindmap-node-ghost" : ""}`,
|
|
461
|
+
"data-branch-index": e.branchIndex,
|
|
476
462
|
onMouseDown: (t) => v(t, e.id),
|
|
477
463
|
onClick: (t) => y(t, e.id),
|
|
478
464
|
onDoubleClick: (t) => b(t, e.id, F),
|
|
479
|
-
style: {
|
|
480
|
-
cursor: "pointer",
|
|
481
|
-
opacity: s ? .3 : 1
|
|
482
|
-
},
|
|
483
465
|
children: [
|
|
484
466
|
/* @__PURE__ */ f("rect", {
|
|
485
467
|
className: "mindmap-node-bg",
|
|
@@ -569,7 +551,6 @@ function v({ node: e, offset: t, isEditing: n, isPendingEdit: i, isSelected: a,
|
|
|
569
551
|
}),
|
|
570
552
|
e.collapsed !== void 0 && h && E && /* @__PURE__ */ f("g", {
|
|
571
553
|
className: "mindmap-fold-btn",
|
|
572
|
-
style: { cursor: "pointer" },
|
|
573
554
|
onMouseDown: (e) => e.stopPropagation(),
|
|
574
555
|
onClick: (t) => {
|
|
575
556
|
t.stopPropagation(), E(e.id);
|
package/dist/esm/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.mindmap-container{width:100%;height:100%;position:relative;overflow:hidden}.mindmap-svg{cursor:grab;-webkit-user-select:none;user-select:none;touch-action:none;width:100%;height:100%;display:block}.mindmap-svg:focus{outline:none}.mindmap-svg.dragging-canvas,.mindmap-svg.dragging-node{cursor:grabbing}.mindmap-node-animated{transition:transform .3s ease-out}.mindmap-edge-animated{transition:d .3s ease-out}@keyframes mindmap-node-appear{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}.mindmap-node-new{animation:.3s ease-out mindmap-node-appear}@keyframes mindmap-expand-appear{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.mindmap-node-expanding{animation:.3s ease-out both mindmap-expand-appear}@keyframes mindmap-edge-draw{0%{stroke-dashoffset:300px}to{stroke-dashoffset:0}}.mindmap-edge-expanding{stroke-dasharray:300;animation:.3s ease-out both mindmap-edge-draw}.mindmap-edit-input{text-align:center;box-sizing:border-box;background:0 0;border:none;outline:none;width:100%;height:100%;margin:0;padding:0}.mindmap-edit-root{color:#fff;background:0 0}.mindmap-edit-child{color:inherit;background:0 0;border-radius:4px}.mindmap-zoom-controls{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border-radius:8px;align-items:center;gap:2px;padding:4px;display:flex;position:absolute;bottom:16px;left:16px;box-shadow:0 2px 8px #0000001a}.mindmap-ctrl-btn{cursor:pointer;width:32px;height:32px;color:inherit;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;transition:background .15s,color .15s;display:flex}.mindmap-ctrl-btn:hover{background:#80808033}.mindmap-ctrl-pct{cursor:pointer;min-width:48px;height:32px;color:inherit;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;font-family:system-ui,sans-serif;font-size:13px;font-weight:500;transition:background .15s;display:flex}.mindmap-ctrl-pct:hover{background:#80808033}.mindmap-extra-controls{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);z-index:20;border-radius:8px;align-items:center;gap:2px;padding:4px;display:flex;position:absolute;bottom:16px;right:16px;box-shadow:0 2px 8px #0000001a}.mindmap-text-editor{resize:none;box-sizing:border-box;z-index:10;border:none;outline:none;width:100%;height:100%;padding:24px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:15px;line-height:1.7;position:absolute;inset:0}.mindmap-add-btn{opacity:0;cursor:pointer;transition:opacity .2s}.mindmap-node-g:hover .mindmap-add-btn{opacity:1}.mindmap-context-menu{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:1000;border:1px solid;border-radius:8px;min-width:150px;padding:4px 0;font-family:system-ui,-apple-system,sans-serif;position:absolute}.mindmap-ctx-item{cursor:pointer;white-space:nowrap;justify-content:space-between;align-items:center;padding:8px 16px;font-size:14px;display:flex;position:relative}.mindmap-ctx-item:hover{filter:brightness(.92);background:#8080801a}.mindmap-ctx-arrow{opacity:.5;margin-left:12px;font-size:8px}.mindmap-ctx-divider{opacity:.3;border-top:1px solid;height:0;margin:4px 8px}.mindmap-ctx-submenu{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid;border-radius:8px;min-width:140px;padding:4px 0;position:absolute;top:-4px;left:100%}.mindmap-ctx-has-sub{position:relative}.mindmap-dialog-backdrop{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);z-index:2000;background:#0003;justify-content:center;align-items:center;font-family:system-ui,-apple-system,sans-serif;animation:.15s ease-out mindmap-fade-in;display:flex;position:absolute;inset:0}@keyframes mindmap-fade-in{0%{opacity:0}to{opacity:1}}.mindmap-dialog-modal{border:1px solid;border-radius:12px;width:calc(100% - 32px);max-width:480px;max-height:80%;padding:24px;animation:.2s ease-out mindmap-dialog-enter;position:relative;overflow-y:auto;box-shadow:0 8px 32px #0003}@keyframes mindmap-dialog-enter{0%{opacity:0;transform:scale(.95)translateY(8px)}to{opacity:1;transform:scale(1)translateY(0)}}.mindmap-dialog-header{justify-content:space-between;align-items:center;margin-bottom:16px;display:flex}.mindmap-dialog-title{margin:0;font-size:16px;font-weight:600}.mindmap-dialog-close{cursor:pointer;width:28px;height:28px;color:inherit;opacity:.5;background:0 0;border:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,background .15s;display:flex}.mindmap-dialog-close:hover{opacity:1;background:#80808033}@media (width<=500px){.mindmap-dialog-modal{max-height:90%;padding:16px}}@media (width<=768px){.mindmap-ctrl-btn{width:28px;height:28px}.mindmap-ctrl-btn svg{width:14px;height:14px}.mindmap-ctrl-pct{min-width:40px;height:28px;font-size:12px}.mindmap-zoom-controls,.mindmap-extra-controls{gap:1px;padding:3px;bottom:12px}.mindmap-zoom-controls{left:12px}.mindmap-extra-controls{right:12px}}.mindmap-node-content{white-space:nowrap;box-sizing:border-box;justify-content:center;align-items:center;gap:4px;line-height:1;display:flex;overflow:hidden}.mindmap-node-root-content{line-height:1}.mindmap-node-content strong{font-weight:700}.mindmap-node-content em{font-style:italic}.mindmap-node-content del{opacity:.6;text-decoration:line-through}.mindmap-node-content .mindmap-inline-code{background:#8080801f;border-radius:3px;padding:1px 4px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:.88em}.mindmap-node-content .mindmap-highlight{color:#fac800;background:#fcd34d33;border-radius:2px;padding:1px 2px}.mindmap-node-content .mindmap-link{color:#2563eb;cursor:pointer;text-decoration:none}.mindmap-node-content .mindmap-link:hover{text-decoration:underline}.mindmap-node-content .mindmap-inline-image{vertical-align:middle;border-radius:2px;max-width:80px;max-height:1.2em}.mindmap-node-root-content .mindmap-inline-code{background:#ffffff26}.mindmap-node-root-content .mindmap-highlight{color:#fcd34d;background:#fbbf2433}.mindmap-node-root-content .mindmap-link{color:#93c5fd}.mindmap-task-icon{vertical-align:middle;flex-shrink:0}.mindmap-remark-indicator{opacity:.5;cursor:help;flex-shrink:0;font-size:.7em;line-height:1;transition:opacity .15s}.mindmap-remark-indicator:hover{opacity:1}.mindmap-remark-tooltip{white-space:pre-wrap;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:1000;pointer-events:none;border-radius:8px;max-width:280px;padding:8px 12px;font-family:system-ui,-apple-system,sans-serif;font-size:13px;line-height:1.5;animation:.15s ease-out mindmap-fade-in;position:absolute;box-shadow:0 4px 16px #00000026}.mindmap-ai-input{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:30;border:1px solid;border-radius:26px;outline:none;width:calc(100% - 32px);max-width:600px;font-family:system-ui,-apple-system,sans-serif;animation:.15s ease-out mindmap-fade-in;position:absolute;bottom:56px;left:50%;transform:translate(-50%)}.mindmap-ai-input-row{align-items:center;gap:4px;padding:6px 6px 6px 16px;display:flex}.mindmap-ai-input-field{color:inherit;background:0 0;border:none;outline:none;flex:1;min-width:0;font-family:inherit;font-size:14px;line-height:1.5}.mindmap-ai-input-field:focus{box-shadow:none}.mindmap-ai-input-field::placeholder{opacity:.5}.mindmap-ai-input-field:disabled{opacity:.5;cursor:not-allowed}.mindmap-ai-send-btn{cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:36px;height:36px;transition:background .15s,opacity .15s,transform .1s;display:flex;position:relative}.mindmap-ai-send-btn:hover:not(:disabled){opacity:.85;transform:scale(1.05)}.mindmap-ai-send-btn:disabled{cursor:not-allowed;opacity:.4}.mindmap-ai-send-btn--loading{cursor:pointer}@keyframes mindmap-ai-spin{to{transform:rotate(360deg)}}.mindmap-ai-spinner{justify-content:center;align-items:center;transition:opacity .2s;animation:.8s linear infinite mindmap-ai-spin;display:flex}.mindmap-ai-stop-icon{opacity:0;color:#ef4444;justify-content:center;align-items:center;transition:opacity .2s,transform .2s;display:flex;position:absolute;transform:scale(.5)}.mindmap-ai-send-btn--loading:hover .mindmap-ai-spinner{opacity:0}.mindmap-ai-send-btn--loading:hover .mindmap-ai-stop-icon{opacity:1;transform:scale(1)}.mindmap-ai-send-btn--loading:hover{background:#ef44441a!important}.mindmap-ai-attach-btn{cursor:pointer;opacity:.5;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;transition:opacity .15s,background .15s;display:flex}.mindmap-ai-attach-btn:hover:not(:disabled){opacity:1;background:#80808026}.mindmap-ai-attach-btn:disabled{cursor:not-allowed;opacity:.3}.mindmap-ai-file-previews{flex-wrap:wrap;gap:6px;padding:8px 12px 0;display:flex}.mindmap-ai-file-chip{border-radius:12px;align-items:center;gap:4px;max-width:160px;padding:3px 8px;font-size:12px;display:inline-flex}.mindmap-ai-file-name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mindmap-ai-file-remove{cursor:pointer;opacity:.5;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;padding:0;transition:opacity .15s;display:flex}.mindmap-ai-file-remove:hover{opacity:1}.mindmap-ai-error{padding:0 16px 8px;font-size:12px;animation:.15s ease-out mindmap-fade-in}@media (width<=768px){.mindmap-ai-input{border-radius:20px;max-width:calc(100% - 24px);bottom:48px}.mindmap-ai-input-row{padding:4px 4px 4px 12px}.mindmap-ai-send-btn{width:32px;height:32px}}
|
|
1
|
+
.mindmap-container{width:100%;height:100%;position:relative;overflow:hidden}.mindmap-svg{cursor:grab;-webkit-user-select:none;user-select:none;touch-action:none;background:var(--mindmap-canvas-bg);width:100%;height:100%;display:block}.mindmap-svg:focus{outline:none}.mindmap-svg.dragging-canvas,.mindmap-svg.dragging-node{cursor:grabbing}.mindmap-node-g{cursor:pointer}.mindmap-node-ghost{opacity:.3}.mindmap-canvas-ready{transition:opacity .4s ease-out}.mindmap-floating,.mindmap-floating-edge,.mindmap-edge-label{pointer-events:none}.mindmap-fold-btn{cursor:pointer}.mindmap-latex{pointer-events:none;overflow:visible}.mindmap-latex-content{white-space:nowrap;text-align:center}.mindmap-node-animated{transition:transform .3s ease-out}.mindmap-edge-animated{transition:d .3s ease-out}@keyframes mindmap-node-appear{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}.mindmap-node-new{animation:.3s ease-out mindmap-node-appear}@keyframes mindmap-expand-appear{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.mindmap-node-expanding{animation:.3s ease-out both mindmap-expand-appear}@keyframes mindmap-edge-draw{0%{stroke-dashoffset:300px}to{stroke-dashoffset:0}}.mindmap-edge-expanding{stroke-dasharray:300;animation:.3s ease-out both mindmap-edge-draw}.mindmap-edit-input{text-align:center;box-sizing:border-box;background:0 0;border:none;outline:none;width:100%;height:100%;margin:0;padding:0}.mindmap-edit-root{color:#fff;background:0 0}.mindmap-edit-child{color:inherit;background:0 0;border-radius:4px}.mindmap-zoom-controls{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);background:var(--mindmap-controls-bg);color:var(--mindmap-controls-text);border-radius:8px;align-items:center;gap:2px;padding:4px;display:flex;position:absolute;bottom:16px;left:16px;box-shadow:0 2px 8px #0000001a}.mindmap-ctrl-btn{cursor:pointer;width:32px;height:32px;color:inherit;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;transition:background .15s,color .15s;display:flex}.mindmap-ctrl-btn:hover{background:#80808033}.mindmap-ctrl-pct{cursor:pointer;min-width:48px;height:32px;color:inherit;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;font-family:system-ui,sans-serif;font-size:13px;font-weight:500;transition:background .15s;display:flex}.mindmap-ctrl-pct:hover{background:#80808033}.mindmap-extra-controls{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);z-index:20;background:var(--mindmap-controls-bg);color:var(--mindmap-controls-text);border-radius:8px;align-items:center;gap:2px;padding:4px;display:flex;position:absolute;bottom:16px;right:16px;box-shadow:0 2px 8px #0000001a}.mindmap-text-editor{resize:none;box-sizing:border-box;z-index:10;background:var(--mindmap-canvas-bg);width:100%;height:100%;color:var(--mindmap-node-text);border:none;outline:none;padding:24px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:15px;line-height:1.7;position:absolute;inset:0}.mindmap-add-btn{opacity:0;cursor:pointer;transition:opacity .2s}.mindmap-node-g:hover .mindmap-add-btn{opacity:1}.mindmap-context-menu{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:1000;background:var(--mindmap-ctx-bg);min-width:150px;color:var(--mindmap-ctx-text);border:1px solid;border-color:var(--mindmap-ctx-border);box-shadow:0 4px 16px var(--mindmap-ctx-shadow);border-radius:8px;padding:4px 0;font-family:system-ui,-apple-system,sans-serif;position:absolute}.mindmap-ctx-item{cursor:pointer;white-space:nowrap;justify-content:space-between;align-items:center;padding:8px 16px;font-size:14px;display:flex;position:relative}.mindmap-ctx-item:hover{filter:brightness(.92);background:#8080801a}.mindmap-ctx-arrow{opacity:.5;margin-left:12px;font-size:8px}.mindmap-ctx-divider{opacity:.3;border-top:1px solid;height:0;margin:4px 8px}.mindmap-ctx-submenu{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:var(--mindmap-ctx-bg);border:1px solid;border-color:var(--mindmap-ctx-border);min-width:140px;box-shadow:0 4px 16px var(--mindmap-ctx-shadow);border-radius:8px;padding:4px 0;position:absolute;top:-4px;left:100%}.mindmap-ctx-has-sub{position:relative}.mindmap-dialog-backdrop{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);z-index:2000;background:#0003;justify-content:center;align-items:center;font-family:system-ui,-apple-system,sans-serif;animation:.15s ease-out mindmap-fade-in;display:flex;position:absolute;inset:0}@keyframes mindmap-fade-in{0%{opacity:0}to{opacity:1}}.mindmap-dialog-modal{border:1px solid;border-radius:12px;width:calc(100% - 32px);max-width:480px;max-height:80%;padding:24px;animation:.2s ease-out mindmap-dialog-enter;position:relative;overflow-y:auto;box-shadow:0 8px 32px #0003}@keyframes mindmap-dialog-enter{0%{opacity:0;transform:scale(.95)translateY(8px)}to{opacity:1;transform:scale(1)translateY(0)}}.mindmap-dialog-header{justify-content:space-between;align-items:center;margin-bottom:16px;display:flex}.mindmap-dialog-title{margin:0;font-size:16px;font-weight:600}.mindmap-dialog-close{cursor:pointer;width:28px;height:28px;color:inherit;opacity:.5;background:0 0;border:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;transition:opacity .15s,background .15s;display:flex}.mindmap-dialog-close:hover{opacity:1;background:#80808033}@media (width<=500px){.mindmap-dialog-modal{max-height:90%;padding:16px}}@media (width<=768px){.mindmap-ctrl-btn{width:28px;height:28px}.mindmap-ctrl-btn svg{width:14px;height:14px}.mindmap-ctrl-pct{min-width:40px;height:28px;font-size:12px}.mindmap-zoom-controls,.mindmap-extra-controls{gap:1px;padding:3px;bottom:12px}.mindmap-zoom-controls{left:12px}.mindmap-extra-controls{right:12px}}.mindmap-node-content{white-space:nowrap;box-sizing:border-box;justify-content:center;align-items:center;gap:4px;line-height:1;display:flex;overflow:hidden}.mindmap-node-root-content{line-height:1}.mindmap-node-content strong{font-weight:700}.mindmap-node-content em{font-style:italic}.mindmap-node-content del{opacity:.6;text-decoration:line-through}.mindmap-node-content .mindmap-inline-code{background:#8080801f;border-radius:3px;padding:1px 4px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:.88em}.mindmap-node-content .mindmap-highlight{color:#fac800;background:#fcd34d33;border-radius:2px;padding:1px 2px}.mindmap-node-content .mindmap-link{color:#2563eb;cursor:pointer;text-decoration:none}.mindmap-node-content .mindmap-link:hover{text-decoration:underline}.mindmap-node-content .mindmap-inline-image{vertical-align:middle;border-radius:2px;max-width:80px;max-height:1.2em}.mindmap-node-root-content .mindmap-inline-code{background:#ffffff26}.mindmap-node-root-content .mindmap-highlight{color:#fcd34d;background:#fbbf2433}.mindmap-node-root-content .mindmap-link{color:#93c5fd}.mindmap-task-icon{vertical-align:middle;flex-shrink:0}.mindmap-remark-indicator{opacity:.5;cursor:help;flex-shrink:0;font-size:.7em;line-height:1;transition:opacity .15s}.mindmap-remark-indicator:hover{opacity:1}.mindmap-remark-tooltip{white-space:pre-wrap;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:1000;pointer-events:none;background:var(--mindmap-ctx-bg);max-width:280px;color:var(--mindmap-ctx-text);border:1px solid var(--mindmap-ctx-border);border-radius:8px;padding:8px 12px;font-family:system-ui,-apple-system,sans-serif;font-size:13px;line-height:1.5;animation:.15s ease-out mindmap-fade-in;position:absolute;box-shadow:0 4px 16px #00000026}.mindmap-ai-input{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);z-index:30;background:var(--mindmap-controls-bg);width:calc(100% - 32px);max-width:600px;color:var(--mindmap-controls-text);border:1px solid;border-color:var(--mindmap-ctx-border);border-radius:26px;outline:none;font-family:system-ui,-apple-system,sans-serif;animation:.15s ease-out mindmap-fade-in;position:absolute;bottom:56px;left:50%;transform:translate(-50%)}.mindmap-ai-input-row{align-items:center;gap:4px;padding:6px 6px 6px 16px;display:flex}.mindmap-ai-input-field{color:inherit;background:0 0;border:none;outline:none;flex:1;min-width:0;font-family:inherit;font-size:14px;line-height:1.5}.mindmap-ai-input-field:focus{box-shadow:none}.mindmap-ai-input-field::placeholder{opacity:.5}.mindmap-ai-input-field:disabled{opacity:.5;cursor:not-allowed}.mindmap-ai-send-btn{cursor:pointer;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:36px;height:36px;transition:background .15s,opacity .15s,transform .1s;display:flex;position:relative}.mindmap-ai-send-btn:hover:not(:disabled){opacity:.85;transform:scale(1.05)}.mindmap-ai-send-btn:disabled{cursor:not-allowed;opacity:.4}.mindmap-ai-send-btn--loading{cursor:pointer}@keyframes mindmap-ai-spin{to{transform:rotate(360deg)}}.mindmap-ai-spinner{justify-content:center;align-items:center;transition:opacity .2s;animation:.8s linear infinite mindmap-ai-spin;display:flex}.mindmap-ai-stop-icon{opacity:0;color:#ef4444;justify-content:center;align-items:center;transition:opacity .2s,transform .2s;display:flex;position:absolute;transform:scale(.5)}.mindmap-ai-send-btn--loading:hover .mindmap-ai-spinner{opacity:0}.mindmap-ai-send-btn--loading:hover .mindmap-ai-stop-icon{opacity:1;transform:scale(1)}.mindmap-ai-send-btn--loading:hover{background:#ef44441a!important}.mindmap-ai-attach-btn{cursor:pointer;opacity:.5;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;transition:opacity .15s,background .15s;display:flex}.mindmap-ai-attach-btn:hover:not(:disabled){opacity:1;background:#80808026}.mindmap-ai-attach-btn:disabled{cursor:not-allowed;opacity:.3}.mindmap-ai-file-previews{flex-wrap:wrap;gap:6px;padding:8px 12px 0;display:flex}.mindmap-ai-file-chip{background:var(--mindmap-controls-hover);border-radius:12px;align-items:center;gap:4px;max-width:160px;padding:3px 8px;font-size:12px;display:inline-flex}.mindmap-ai-file-name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mindmap-ai-file-remove{cursor:pointer;opacity:.5;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;padding:0;transition:opacity .15s;display:flex}.mindmap-ai-file-remove:hover{opacity:1}.mindmap-ai-error{color:#ef4444;padding:0 16px 8px;font-size:12px;animation:.15s ease-out mindmap-fade-in}@media (width<=768px){.mindmap-ai-input{border-radius:20px;max-width:calc(100% - 24px);bottom:48px}.mindmap-ai-input-row{padding:4px 4px 4px 12px}.mindmap-ai-send-btn{width:32px;height:32px}}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/esm/utils/export.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { THEME as e } from "./theme.js";
|
|
2
|
-
import { buildSvgNodeTextString as
|
|
3
|
-
import { runExportNodeDecoration as
|
|
1
|
+
import { THEME as e, generateExportStyles as t } from "./theme.js";
|
|
2
|
+
import { buildSvgNodeTextString as n } from "./inline-markdown.js";
|
|
3
|
+
import { runExportNodeDecoration as r, runExportOverlay as i } from "../plugins/runner.js";
|
|
4
4
|
//#region src/components/MindMap/utils/export.ts
|
|
5
|
-
function
|
|
6
|
-
let { padding:
|
|
7
|
-
for (let e of
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
for (let e of
|
|
11
|
-
let t = `
|
|
12
|
-
if (e.strokeDasharray && (
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let r = (
|
|
16
|
-
|
|
5
|
+
function a(a, o, s = {}, c = e, l) {
|
|
6
|
+
let { padding: u = 40, background: d = c.canvas.bgColor, pngSafe: f = !1 } = s, p = Infinity, m = -Infinity, h = Infinity, g = -Infinity;
|
|
7
|
+
for (let e of a) p = Math.min(p, e.x - e.width / 2), m = Math.max(m, e.x + e.width / 2), h = Math.min(h, e.y - e.height / 2), g = Math.max(g, e.y + e.height / 2);
|
|
8
|
+
let _ = m - p + u * 2, v = g - h + u * 2, y = -p + u, b = -h + u, x = [];
|
|
9
|
+
x.push(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${_}" height="${v}" viewBox="0 0 ${_} ${v}">`), x.push("<defs>"), x.push(" <style>"), x.push(` ${t(c)}`), x.push(" </style>"), o.some((e) => e.isCrossLink) && (x.push("<marker id=\"arrowhead\" markerWidth=\"8\" markerHeight=\"6\" refX=\"8\" refY=\"3\" orient=\"auto\">"), x.push("<path d=\"M0,0 L8,3 L0,6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/>"), x.push("</marker>")), x.push("</defs>"), x.push(`<rect width="100%" height="100%" fill="${d}"/>`), x.push(`<g transform="translate(${y}, ${b})">`);
|
|
10
|
+
for (let e of o) {
|
|
11
|
+
let t = a.find((t) => t.id === e.toId), n = t?.branchIndex === void 0 ? "" : ` data-branch-index="${t.branchIndex}"`, r = `class="mindmap-edge" d="${e.path}" stroke="${e.color}"${n}`;
|
|
12
|
+
if (e.strokeDasharray && (r += ` stroke-dasharray="${e.strokeDasharray}"`), e.isCrossLink && (r += " marker-end=\"url(#arrowhead)\" opacity=\"0.7\""), x.push(`<path ${r}/>`), e.label) {
|
|
13
|
+
let n = a.find((t) => t.id === e.fromId);
|
|
14
|
+
if (n && t) {
|
|
15
|
+
let r = (n.x + t.x) / 2, i = (n.y + t.y) / 2;
|
|
16
|
+
x.push(`<text class="mindmap-edge-label" x="${r}" y="${i - 6}" text-anchor="middle" font-size="11" fill="${e.color}" opacity="0.8">${e.label}</text>`);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
for (let e of
|
|
21
|
-
let
|
|
20
|
+
for (let e of a) {
|
|
21
|
+
let t = e.x, i = e.y, a = e.branchIndex === void 0 ? "" : ` data-branch-index="${e.branchIndex}"`;
|
|
22
22
|
if (e.depth === 0) {
|
|
23
|
-
let { fontSize:
|
|
24
|
-
|
|
23
|
+
let { fontSize: o, fontWeight: s, fontFamily: u, textColor: d } = c.root, p = c.root.bgColor;
|
|
24
|
+
x.push(`<g class="mindmap-node-g mindmap-node-root" transform="translate(${t}, ${i})"${a}>`), x.push(`<rect class="mindmap-node-bg" x="${-e.width / 2}" y="${-e.height / 2}" width="${e.width}" height="${e.height}" rx="${e.height / 2}" ry="${e.height / 2}" fill="${p}"/>`), x.push(n(e.text, o, s, u, d, e.taskStatus, e.remark, l, c.highlight.textColor, c.highlight.bgColor, f)), l && l.length > 0 && x.push(r(l, e, c, l, f)), x.push("</g>");
|
|
25
25
|
} else {
|
|
26
|
-
let
|
|
27
|
-
|
|
26
|
+
let o = e.depth === 1 ? c.level1.fontSize : c.node.fontSize, s = e.depth === 1 ? c.level1.fontWeight : c.node.fontWeight, u = e.width - c.node.paddingH * 2, d = o / 2 + 4;
|
|
27
|
+
x.push(`<g class="mindmap-node-g mindmap-node-child" transform="translate(${t}, ${i})"${a}>`), x.push(n(e.text, o, s, c.node.fontFamily, c.node.textColor, e.taskStatus, e.remark, l, c.highlight.textColor, c.highlight.bgColor, f)), x.push(`<line class="mindmap-node-underline" x1="${-u / 2}" y1="${d}" x2="${u / 2}" y2="${d}" stroke="${e.color}"/>`), l && l.length > 0 && x.push(r(l, e, c, l, f)), x.push("</g>");
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return l && l.length > 0 && x.push(i(l, a, o, c)), x.push("</g>"), x.push("</svg>"), x.join("\n");
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
32
|
+
var o = a;
|
|
33
|
+
function s(e, t = {}) {
|
|
34
34
|
let n = typeof window < "u" ? Math.max(window.devicePixelRatio ?? 1, 2) : 2, { scale: r = n } = t;
|
|
35
35
|
return new Promise((t, n) => {
|
|
36
36
|
let i = new DOMParser().parseFromString(e, "image/svg+xml").documentElement, a = parseFloat(i.getAttribute("width") || "800"), o = parseFloat(i.getAttribute("height") || "600"), s = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), c = URL.createObjectURL(s), l = new Image();
|
|
@@ -47,4 +47,4 @@ function o(e, t = {}) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
|
-
export {
|
|
50
|
+
export { a as buildExportSVG, o as buildExportSVGForPNG, s as exportToPNG };
|
package/dist/esm/utils/layout.js
CHANGED
|
@@ -15,49 +15,50 @@ function p(e, t, r, i, a) {
|
|
|
15
15
|
let o = u(n(e), t, r);
|
|
16
16
|
return i && (o += t * .9 + d), a && (o += f), o;
|
|
17
17
|
}
|
|
18
|
-
function m(n, a, o, c, l, u, d) {
|
|
19
|
-
let
|
|
18
|
+
function m(n, a, o, c, l, u, d, f) {
|
|
19
|
+
let h = a === 0, g = a === 1, _ = h ? t.root.fontSize : g ? t.level1.fontSize : t.node.fontSize, v = h ? t.root.fontWeight : g ? t.level1.fontWeight : t.node.fontWeight, y = h ? t.root.paddingH : t.node.paddingH, b = h ? t.root.paddingV : t.node.paddingV, x = p(n.text, _, v, n.taskStatus, !!n.remark) + y * 2, S = _ + b * 2;
|
|
20
20
|
if (u && u.length > 0) {
|
|
21
|
-
let e = r(u, n,
|
|
22
|
-
|
|
21
|
+
let e = r(u, n, x, S, _);
|
|
22
|
+
x = e.width, S = e.height;
|
|
23
23
|
}
|
|
24
|
-
let
|
|
25
|
-
u && u.length > 0 && d && (
|
|
26
|
-
let
|
|
24
|
+
let C = n.children || [];
|
|
25
|
+
u && u.length > 0 && d && (C = i(u, n, C, d));
|
|
26
|
+
let w = c;
|
|
27
27
|
if (u && u.length > 0) {
|
|
28
28
|
let e = s(u, {
|
|
29
29
|
id: n.id,
|
|
30
30
|
text: n.text,
|
|
31
31
|
x: 0,
|
|
32
32
|
y: 0,
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
33
|
+
width: x,
|
|
34
|
+
height: S,
|
|
35
35
|
color: c,
|
|
36
36
|
depth: a,
|
|
37
37
|
side: o,
|
|
38
38
|
parentId: l
|
|
39
39
|
}, n, c);
|
|
40
|
-
e.color && (
|
|
40
|
+
e.color && (w = e.color);
|
|
41
41
|
}
|
|
42
|
-
let
|
|
43
|
-
let i =
|
|
44
|
-
return m(t, a + 1, o, i, n.id, u, d);
|
|
42
|
+
let T = C.map((t, r) => {
|
|
43
|
+
let i = h ? e[r % e.length] : w, s = h ? r % e.length : f;
|
|
44
|
+
return m(t, a + 1, o, i, n.id, u, d, s);
|
|
45
45
|
});
|
|
46
46
|
return {
|
|
47
47
|
id: n.id,
|
|
48
48
|
text: n.text,
|
|
49
|
-
children:
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
49
|
+
children: T,
|
|
50
|
+
width: x,
|
|
51
|
+
height: S,
|
|
52
52
|
depth: a,
|
|
53
53
|
side: o,
|
|
54
|
-
color:
|
|
54
|
+
color: w,
|
|
55
55
|
x: 0,
|
|
56
56
|
y: 0,
|
|
57
57
|
subtreeHeight: 0,
|
|
58
58
|
parentId: l,
|
|
59
59
|
remark: n.remark,
|
|
60
60
|
taskStatus: n.taskStatus,
|
|
61
|
+
branchIndex: f,
|
|
61
62
|
dottedLine: n.dottedLine,
|
|
62
63
|
multiLineContent: n.multiLineContent,
|
|
63
64
|
tags: n.tags,
|
|
@@ -93,6 +94,7 @@ function _(e, t) {
|
|
|
93
94
|
parentId: e.parentId,
|
|
94
95
|
remark: e.remark,
|
|
95
96
|
taskStatus: e.taskStatus,
|
|
97
|
+
branchIndex: e.branchIndex,
|
|
96
98
|
dottedLine: e.dottedLine,
|
|
97
99
|
multiLineContent: e.multiLineContent,
|
|
98
100
|
tags: e.tags,
|
|
@@ -133,7 +135,13 @@ function b(n, r = "both", i, o, s, c, l) {
|
|
|
133
135
|
let b = m({
|
|
134
136
|
...n,
|
|
135
137
|
children: []
|
|
136
|
-
}, 0, "root", t.root.bgColor, void 0, s, u), x = f.map((t, r) =>
|
|
138
|
+
}, 0, "root", t.root.bgColor, void 0, s, u), x = f.map((t, r) => {
|
|
139
|
+
let a = r % e.length;
|
|
140
|
+
return m(t, 1, "right", i?.[t.id] ?? e[a], n.id, s, u, a);
|
|
141
|
+
}), S = p.map((t, a) => {
|
|
142
|
+
let o = ((r === "left" ? 0 : v) + a) % e.length;
|
|
143
|
+
return m(t, 1, "left", i?.[t.id] ?? e[o], n.id, s, u, o);
|
|
144
|
+
});
|
|
137
145
|
b.children = [...x, ...S];
|
|
138
146
|
for (let e of b.children) h(e);
|
|
139
147
|
b.x = 0, b.y = 0;
|