kakidash 0.2.1 → 0.2.3
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.ja.md +137 -125
- package/README.md +138 -125
- package/dist/index.d.ts +89 -3
- package/dist/kakidash.cjs +7 -6
- package/dist/kakidash.es.js +2574 -2045
- package/dist/kakidash.umd.js +7 -6
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -21,10 +21,13 @@ Master the shortcuts and expand your mind map at the speed of thought.
|
|
|
21
21
|
- Bold (`Bold`), Italic (`Italic`).
|
|
22
22
|
- Color changes via palette (Style Editor).
|
|
23
23
|
- **Themes**: Switch between multiple built-in themes (Default, Simple, Colorful, Dark).
|
|
24
|
-
- **Icon Settings**: Add/Remove flat icons via Command Palette (`m` key).
|
|
24
|
+
- **Icon Settings**: Add/Remove flat icons and numeric icons (0-9) via Command Palette (`m` key).
|
|
25
25
|
- **Interaction**:
|
|
26
26
|
- Drag and drop for node movement and reordering.
|
|
27
27
|
- Keyboard shortcuts for rapid operation.
|
|
28
|
+
- **Help Modal**: Accessible via the "?" icon in the toolbar, allowing you to check icon meanings and shortcuts.
|
|
29
|
+
- **Multi-selection**: Shift + Click or Shift + Arrow Keys to select multiple nodes.
|
|
30
|
+
- **Bulk Operations**: Delete, Copy, Cut, Paste, and Styling apply to all selected nodes.
|
|
28
31
|
- Zoom, Pan (Screen navigation).
|
|
29
32
|
- **Image Support**: Paste images from the clipboard.
|
|
30
33
|
- **Auto Link**: Automatically detects URLs in node text and converts them to clickable links.
|
|
@@ -45,6 +48,7 @@ pnpm add kakidash
|
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
## Usage
|
|
51
|
+
|
|
48
52
|
### 1. HTML Preparation
|
|
49
53
|
|
|
50
54
|
Prepare a container element (e.g., `div`) to display `kakidash`.
|
|
@@ -53,26 +57,28 @@ Prepare a container element (e.g., `div`) to display `kakidash`.
|
|
|
53
57
|
```html
|
|
54
58
|
<!DOCTYPE html>
|
|
55
59
|
<html lang="en">
|
|
56
|
-
<head>
|
|
57
|
-
<meta charset="UTF-8"
|
|
60
|
+
<head>
|
|
61
|
+
<meta charset="UTF-8" />
|
|
58
62
|
<title>Kakidash Demo</title>
|
|
59
63
|
<style>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
/* Container size is required */
|
|
65
|
+
#mindmap-container {
|
|
66
|
+
width: 100vw;
|
|
67
|
+
height: 100vh;
|
|
68
|
+
border: 1px solid #ccc;
|
|
69
|
+
margin: 0;
|
|
70
|
+
padding: 0;
|
|
71
|
+
overflow: hidden; /* Prevent scrolling within container */
|
|
72
|
+
}
|
|
73
|
+
body {
|
|
74
|
+
margin: 0;
|
|
75
|
+
}
|
|
70
76
|
</style>
|
|
71
|
-
</head>
|
|
72
|
-
<body>
|
|
77
|
+
</head>
|
|
78
|
+
<body>
|
|
73
79
|
<div id="mindmap-container"></div>
|
|
74
80
|
<!-- Script Injection Here -->
|
|
75
|
-
</body>
|
|
81
|
+
</body>
|
|
76
82
|
</html>
|
|
77
83
|
```
|
|
78
84
|
|
|
@@ -84,7 +90,7 @@ Prepare a container element (e.g., `div`) to display `kakidash`.
|
|
|
84
90
|
pnpm add kakidash
|
|
85
91
|
```
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
````typescript
|
|
88
94
|
import { Kakidash } from 'kakidash';
|
|
89
95
|
|
|
90
96
|
// Get container
|
|
@@ -93,10 +99,12 @@ const container = document.getElementById('mindmap-container');
|
|
|
93
99
|
// Instantiate
|
|
94
100
|
// Instantiate with optional configuration
|
|
95
101
|
const kakidash = new Kakidash(container, {
|
|
102
|
+
locale: 'en', // Optional: 'en' | 'ja' (Default: 'en')
|
|
96
103
|
maxNodeWidth: 200, // Optional: Maximum width for nodes
|
|
97
104
|
customStyles: { // Optional: Initial custom styles
|
|
98
105
|
rootNode: { border: '2px solid red' }
|
|
99
|
-
}
|
|
106
|
+
},
|
|
107
|
+
disabledCommandPaletteFeatures: ['import'] // Optional: Disable specific features
|
|
100
108
|
});
|
|
101
109
|
|
|
102
110
|
// Add initial data or nodes if needed
|
|
@@ -108,8 +116,9 @@ You can switch themes dynamically:
|
|
|
108
116
|
|
|
109
117
|
```typescript
|
|
110
118
|
kakidash.setTheme('dark'); // 'default', 'simple', 'colorful', 'dark'
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
````
|
|
120
|
+
|
|
121
|
+
````
|
|
113
122
|
|
|
114
123
|
#### B. Browser Direct Import (Script Tag / CDN)
|
|
115
124
|
|
|
@@ -129,10 +138,10 @@ Use the built `umd` file. The library will be exposed under the global variable
|
|
|
129
138
|
// Initialize
|
|
130
139
|
const container = document.getElementById('mindmap-container');
|
|
131
140
|
const kakidash = new Kakidash(container);
|
|
132
|
-
|
|
141
|
+
|
|
133
142
|
console.log('Kakidash initialized:', kakidash);
|
|
134
143
|
</script>
|
|
135
|
-
|
|
144
|
+
````
|
|
136
145
|
|
|
137
146
|
## Custom Styling
|
|
138
147
|
|
|
@@ -143,28 +152,28 @@ You can define custom styles using `updateGlobalStyles`. These settings are pers
|
|
|
143
152
|
// These settings are saved internally.
|
|
144
153
|
kakidash.updateGlobalStyles({
|
|
145
154
|
// Root node style
|
|
146
|
-
rootNode: {
|
|
155
|
+
rootNode: {
|
|
147
156
|
border: '4px solid gold',
|
|
148
157
|
background: '#ffeeee',
|
|
149
|
-
color: '#333' // Font color
|
|
158
|
+
color: '#333', // Font color
|
|
150
159
|
},
|
|
151
|
-
|
|
160
|
+
|
|
152
161
|
// Child nodes style
|
|
153
|
-
childNode: {
|
|
154
|
-
border: '2px dashed blue',
|
|
162
|
+
childNode: {
|
|
163
|
+
border: '2px dashed blue',
|
|
155
164
|
background: 'white',
|
|
156
|
-
color: '#555' // Font color
|
|
165
|
+
color: '#555', // Font color
|
|
157
166
|
},
|
|
158
|
-
|
|
167
|
+
|
|
159
168
|
// Connection line color
|
|
160
|
-
connection: {
|
|
161
|
-
color: 'orange'
|
|
169
|
+
connection: {
|
|
170
|
+
color: 'orange',
|
|
162
171
|
},
|
|
163
|
-
|
|
172
|
+
|
|
164
173
|
// Entire canvas background
|
|
165
174
|
canvas: {
|
|
166
|
-
background: '#fafafa' // Use 'transparent' for transparency
|
|
167
|
-
}
|
|
175
|
+
background: '#fafafa', // Use 'transparent' for transparency
|
|
176
|
+
},
|
|
168
177
|
});
|
|
169
178
|
|
|
170
179
|
// 2. Activate the custom theme to see your changes
|
|
@@ -175,22 +184,24 @@ kakidash.setTheme('custom');
|
|
|
175
184
|
|
|
176
185
|
All values accept standard CSS strings.
|
|
177
186
|
|
|
178
|
-
| Object
|
|
179
|
-
|
|
|
180
|
-
| `rootNode`, `childNode` | `border`
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
| `connection`
|
|
184
|
-
| `canvas`
|
|
187
|
+
| Object | Property | Description | Example |
|
|
188
|
+
| ----------------------- | ------------ | --------------------- | ------------------------------------------------- |
|
|
189
|
+
| `rootNode`, `childNode` | `border` | Node border | `'2px solid red'`, `'none'` |
|
|
190
|
+
| | `background` | Node background | `'#ffffff'`, `'rgba(0,0,0,0.5)'`, `'transparent'` |
|
|
191
|
+
| | `color` | Text color | `'#333'`, `'black'` |
|
|
192
|
+
| `connection` | `color` | Connection line color | `'#ccc'`, `'orange'` |
|
|
193
|
+
| `canvas` | `background` | Canvas background | `'#f0f0f0'`, `'transparent'` |
|
|
185
194
|
|
|
186
195
|
## API Reference
|
|
187
196
|
|
|
188
197
|
### Methods
|
|
189
198
|
|
|
190
199
|
- **`new Kakidash(container: HTMLElement, options?: KakidashOptions)`**: Creates a new instance.
|
|
200
|
+
- `options.locale`: Language for the help modal and other UI elements ('en' | 'ja').
|
|
191
201
|
- `options.shortcuts`: Custom keyboard shortcuts.
|
|
192
202
|
- `options.maxNodeWidth`: Maximum width for text nodes (pixels).
|
|
193
203
|
- `options.customStyles`: Initial custom styles.
|
|
204
|
+
- `options.disabledCommandPaletteFeatures`: Features to disable in the command palette ('search' | 'icon' | 'import' | 'export').
|
|
194
205
|
- **`kakidash.addNode(parentId, topic)`**: Adds a new child node to the specified parent node.
|
|
195
206
|
- **`kakidash.getData()`**: Retrieves current mindmap data as a JSON object.
|
|
196
207
|
- **`kakidash.loadData(data)`**: Loads JSON data and renders the mindmap.
|
|
@@ -203,21 +214,26 @@ All values accept standard CSS strings.
|
|
|
203
214
|
- **`kakidash.redo()`**: Redo the last undone change.
|
|
204
215
|
- **`kakidash.toggleFold(nodeId)`**: Toggle fold state of a node.
|
|
205
216
|
- **`kakidash.getSelectedNodeId()`**: Get the ID of the currently selected node.
|
|
217
|
+
- **`kakidash.setSelectedNodeId(nodeId)`**: Selects a node by its ID.
|
|
218
|
+
- **`kakidash.registerCommand(command)`**: Registers a custom command to the command palette.
|
|
219
|
+
- `command.id`: Unique ID for the command.
|
|
220
|
+
- `command.topic`: Display name in the palette.
|
|
221
|
+
- `command.execute`: Callback function `(selectedNodeId: string | null) => void`.
|
|
206
222
|
- **`kakidash.updateNode(nodeId, { topic?, style?, icon? })`**: Updates a node property. `icon` accepts an icon ID (e.g., 'check').
|
|
207
223
|
- **`kakidash.on(event, listener)`**: Register an event listener.
|
|
208
224
|
- **`kakidash.off(event, listener)`**: Remove an event listener.
|
|
209
225
|
|
|
210
226
|
### Events
|
|
211
227
|
|
|
212
|
-
| Event Name
|
|
213
|
-
|
|
|
214
|
-
| `node:select`
|
|
215
|
-
| `node:add`
|
|
216
|
-
| `node:remove`
|
|
217
|
-
| `node:update`
|
|
218
|
-
| `node:move`
|
|
219
|
-
| `model:load`
|
|
220
|
-
| `model:change` | `void`
|
|
228
|
+
| Event Name | Payload | Description |
|
|
229
|
+
| -------------- | ------------------------------------------------------------ | ---------------------------------- |
|
|
230
|
+
| `node:select` | `string \| null` | Fired when a node is selected. |
|
|
231
|
+
| `node:add` | `{ id: string; topic: string }` | Fired when a new node is added. |
|
|
232
|
+
| `node:remove` | `string` | Fired when a node is removed. |
|
|
233
|
+
| `node:update` | `{ id: string; topic?: string; icon?: string }` | Fired when a node is updated. |
|
|
234
|
+
| `node:move` | `{ nodeId: string; newParentId: string; position?: string }` | Fired when a node is moved. |
|
|
235
|
+
| `model:load` | `MindMapData` | Fired when data is loaded. |
|
|
236
|
+
| `model:change` | `void` | Fired when the data model changes. |
|
|
221
237
|
|
|
222
238
|
```typescript
|
|
223
239
|
kakidash.on('node:select', (nodeId) => {
|
|
@@ -236,7 +252,7 @@ const kakidash = new Kakidash(container, {
|
|
|
236
252
|
shortcuts: {
|
|
237
253
|
// Override 'addChild' to Ctrl+N
|
|
238
254
|
addChild: [{ key: 'n', ctrlKey: true }],
|
|
239
|
-
}
|
|
255
|
+
},
|
|
240
256
|
});
|
|
241
257
|
```
|
|
242
258
|
|
|
@@ -246,41 +262,19 @@ Here is the complete default configuration. You can partially override these key
|
|
|
246
262
|
|
|
247
263
|
```json
|
|
248
264
|
{
|
|
249
|
-
"navUp": [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
],
|
|
253
|
-
"
|
|
254
|
-
{ "key": "ArrowDown" },
|
|
255
|
-
{ "key": "j" }
|
|
256
|
-
],
|
|
257
|
-
"navLeft": [
|
|
258
|
-
{ "key": "ArrowLeft" },
|
|
259
|
-
{ "key": "h" }
|
|
260
|
-
],
|
|
261
|
-
"navRight": [
|
|
262
|
-
{ "key": "ArrowRight" },
|
|
263
|
-
{ "key": "l" }
|
|
264
|
-
],
|
|
265
|
-
"addChild": [
|
|
266
|
-
{ "key": "Tab" },
|
|
267
|
-
{ "key": "a" }
|
|
268
|
-
],
|
|
265
|
+
"navUp": [{ "key": "ArrowUp" }, { "key": "k" }],
|
|
266
|
+
"navDown": [{ "key": "ArrowDown" }, { "key": "j" }],
|
|
267
|
+
"navLeft": [{ "key": "ArrowLeft" }, { "key": "h" }],
|
|
268
|
+
"navRight": [{ "key": "ArrowRight" }, { "key": "l" }],
|
|
269
|
+
"addChild": [{ "key": "Tab" }, { "key": "a" }],
|
|
269
270
|
"insertParent": [
|
|
270
271
|
{ "key": "Tab", "shiftKey": true },
|
|
271
272
|
{ "key": "a", "shiftKey": true }
|
|
272
273
|
],
|
|
273
274
|
"addSibling": [{ "key": "Enter" }],
|
|
274
275
|
"addSiblingBefore": [{ "key": "Enter", "shiftKey": true }],
|
|
275
|
-
"deleteNode": [
|
|
276
|
-
|
|
277
|
-
{ "key": "Backspace" }
|
|
278
|
-
],
|
|
279
|
-
"beginEdit": [
|
|
280
|
-
{ "key": "i" },
|
|
281
|
-
{ "key": " " },
|
|
282
|
-
{ "key": "F2" }
|
|
283
|
-
],
|
|
276
|
+
"deleteNode": [{ "key": "Delete" }, { "key": "Backspace" }],
|
|
277
|
+
"beginEdit": [{ "key": "i" }, { "key": " " }, { "key": "F2" }],
|
|
284
278
|
"copy": [
|
|
285
279
|
{ "key": "c", "ctrlKey": true },
|
|
286
280
|
{ "key": "c", "metaKey": true }
|
|
@@ -305,14 +299,8 @@ Here is the complete default configuration. You can partially override these key
|
|
|
305
299
|
],
|
|
306
300
|
"bold": [{ "key": "b", "shiftKey": true }],
|
|
307
301
|
"italic": [{ "key": "i", "shiftKey": true }],
|
|
308
|
-
"increaseFontSize": [
|
|
309
|
-
|
|
310
|
-
{ "key": "." }
|
|
311
|
-
],
|
|
312
|
-
"decreaseFontSize": [
|
|
313
|
-
{ "key": "<", "shiftKey": true },
|
|
314
|
-
{ "key": "," }
|
|
315
|
-
],
|
|
302
|
+
"increaseFontSize": [{ "key": ">", "shiftKey": true }, { "key": "." }],
|
|
303
|
+
"decreaseFontSize": [{ "key": "<", "shiftKey": true }, { "key": "," }],
|
|
316
304
|
"zoomIn": [{ "key": "[" }],
|
|
317
305
|
"zoomOut": [{ "key": "]" }],
|
|
318
306
|
"resetZoom": [{ "key": ":" }],
|
|
@@ -331,51 +319,76 @@ Here is the complete default configuration. You can partially override these key
|
|
|
331
319
|
## Shortcuts
|
|
332
320
|
|
|
333
321
|
### General
|
|
334
|
-
|
|
335
|
-
|
|
|
336
|
-
|
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `Shift +
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `Ctrl/Cmd +
|
|
348
|
-
| `Ctrl/Cmd +
|
|
349
|
-
| `Ctrl/Cmd +
|
|
350
|
-
| `
|
|
351
|
-
| `
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
354
|
-
| `
|
|
355
|
-
| `
|
|
356
|
-
|
|
|
357
|
-
|
|
|
322
|
+
|
|
323
|
+
| Key | Description |
|
|
324
|
+
| ----------------------------------- | ------------------------------------------------- |
|
|
325
|
+
| `m` | Command Palette (Search / Icons) |
|
|
326
|
+
| `Arrow Keys` | Navigate between nodes |
|
|
327
|
+
| `Shift + Arrow Keys` | Select range of nodes |
|
|
328
|
+
| `h` / `j` / `k` / `l` | Navigate between nodes (Vim-style) |
|
|
329
|
+
| `F2` / `DblClick` / `Space` / `i` | Start editing node (Space triggers zoom if image) |
|
|
330
|
+
| `Enter` | Add sibling node (below) |
|
|
331
|
+
| `Shift + Enter` | Add sibling node (above) |
|
|
332
|
+
| `Tab` / `a` | Add child node |
|
|
333
|
+
| `Shift + Tab` / `Shift + a` | Insert parent node |
|
|
334
|
+
| `Delete` / `Backspace` | Delete node |
|
|
335
|
+
| `Ctrl/Cmd + z` | Undo |
|
|
336
|
+
| `Ctrl/Cmd + Shift + z` / `Ctrl + y` | Redo |
|
|
337
|
+
| `Ctrl/Cmd + C` | Copy |
|
|
338
|
+
| `Ctrl/Cmd + X` | Cut |
|
|
339
|
+
| `Ctrl/Cmd + V` | Paste (Images supported) |
|
|
340
|
+
| `Drag` (Canvas) | Pan screen |
|
|
341
|
+
| `Wheel` | Vertical scroll (Pan) |
|
|
342
|
+
| `Shift + Wheel` | Horizontal scroll (Pan) |
|
|
343
|
+
| `Ctrl/Cmd + Wheel` | Zoom in/out |
|
|
344
|
+
| `[` | Canvas Zoom In |
|
|
345
|
+
| `]` | Canvas Zoom Out |
|
|
346
|
+
| `:` | Reset Zoom |
|
|
347
|
+
| Click `+/-` / `f` | Toggle node folding |
|
|
358
348
|
|
|
359
349
|
### Editing (Text Input)
|
|
360
|
-
|
|
361
|
-
|
|
|
362
|
-
|
|
|
363
|
-
| `
|
|
364
|
-
| `
|
|
350
|
+
|
|
351
|
+
| Key | Description |
|
|
352
|
+
| --------------- | ------------ |
|
|
353
|
+
| `Enter` | Confirm edit |
|
|
354
|
+
| `Shift + Enter` | New line |
|
|
355
|
+
| `Esc` | Cancel edit |
|
|
365
356
|
|
|
366
357
|
### Styling (Since selection)
|
|
367
|
-
|
|
368
|
-
|
|
|
369
|
-
|
|
|
370
|
-
| `Shift +
|
|
371
|
-
| `Shift +
|
|
372
|
-
| `Shift +
|
|
373
|
-
| `Shift +
|
|
374
|
-
| `
|
|
358
|
+
|
|
359
|
+
| Key | Description |
|
|
360
|
+
| --------------------------- | --------------------------------- |
|
|
361
|
+
| `Shift + b` | Toggle Bold |
|
|
362
|
+
| `Shift + i` | Toggle Italic |
|
|
363
|
+
| `Shift + . (>)` / `.` | Increase font size |
|
|
364
|
+
| `Shift + , (<)` / `,` | Decrease font size |
|
|
365
|
+
| `Shift + Alt + ArrowLeft / Right` | Adjust node width |
|
|
366
|
+
| `1` - `7` | Change node color (Palette order) |
|
|
367
|
+
|
|
368
|
+
## Custom Commands
|
|
369
|
+
|
|
370
|
+
You can extend the command palette with your own functions using `registerCommand`.
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
board.registerCommand({
|
|
374
|
+
id: 'rocket-launch',
|
|
375
|
+
topic: '🚀 Rocket Launch',
|
|
376
|
+
execute: (selectedNodeId) => {
|
|
377
|
+
console.log('Action on node:', selectedNodeId);
|
|
378
|
+
// Your logic here
|
|
379
|
+
if (selectedNodeId) {
|
|
380
|
+
board.updateNodeTopic(selectedNodeId, '🚀 LAUNCHED!');
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Registered commands will appear in the Command Palette (default key: `m`). Clicking or pressing Enter on the item will execute the handler.
|
|
375
387
|
|
|
376
388
|
## Architecture
|
|
377
389
|
|
|
378
390
|
For details on the software architecture and internal module dependencies, please refer to:
|
|
391
|
+
|
|
379
392
|
- [Software Architecture Design](./docs/SOFTWARE_ARCHITECTURE.md)
|
|
380
393
|
|
|
381
394
|
## Development
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
export declare interface CustomCommand {
|
|
2
|
+
id: string;
|
|
3
|
+
topic: string;
|
|
4
|
+
execute: (selectedNodeId: string | null) => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
export declare type Direction = 'Up' | 'Down' | 'Left' | 'Right';
|
|
2
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Interface for handling file Import/Export operations.
|
|
11
|
+
* Allows external systems (like VS Code Extension) to override default browser behaviors.
|
|
12
|
+
*/
|
|
13
|
+
export declare interface FileHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Request to import a file.
|
|
16
|
+
* @param format The expected file format (e.g., 'xmind').
|
|
17
|
+
* @returns The file content as ArrayBuffer (binary) or string (text), or null if cancelled.
|
|
18
|
+
*/
|
|
19
|
+
onImportFile(format: string): Promise<ArrayBuffer | string | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Request to export a file.
|
|
22
|
+
* @param data The data to export (Blob or string).
|
|
23
|
+
* @param filename The suggested filename.
|
|
24
|
+
* @param format The file format (e.g., 'png', 'svg', 'markdown').
|
|
25
|
+
*/
|
|
26
|
+
onExportFile(data: Blob | string, filename: string, format: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
|
|
3
29
|
/**
|
|
4
30
|
* The main class for the Kakidash mind map library.
|
|
5
31
|
* It manages the mind map data, interaction, and rendering.
|
|
@@ -30,6 +56,11 @@ export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
|
|
|
30
56
|
* Toggles the visibility of the command palette.
|
|
31
57
|
*/
|
|
32
58
|
toggleCommandPalette(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Registers a custom command to be displayed in the command palette.
|
|
61
|
+
* @param command The custom command definition.
|
|
62
|
+
*/
|
|
63
|
+
registerCommand(command: CustomCommand): void;
|
|
33
64
|
/**
|
|
34
65
|
* Opens the command palette (alias for toggleCommandPalette).
|
|
35
66
|
*/
|
|
@@ -77,8 +108,14 @@ export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
|
|
|
77
108
|
getRootId(): string;
|
|
78
109
|
}
|
|
79
110
|
|
|
111
|
+
declare type KakidashCommandArgs = {
|
|
112
|
+
name: string;
|
|
113
|
+
args?: unknown;
|
|
114
|
+
};
|
|
115
|
+
|
|
80
116
|
export declare type KakidashEventMap = {
|
|
81
117
|
'node:select': string | null;
|
|
118
|
+
'selection:change': string[];
|
|
82
119
|
'node:add': {
|
|
83
120
|
id: string;
|
|
84
121
|
topic: string;
|
|
@@ -95,6 +132,7 @@ export declare type KakidashEventMap = {
|
|
|
95
132
|
};
|
|
96
133
|
'model:load': MindMapData;
|
|
97
134
|
'model:change': void;
|
|
135
|
+
command: KakidashCommandArgs;
|
|
98
136
|
};
|
|
99
137
|
|
|
100
138
|
export declare interface KakidashOptions {
|
|
@@ -108,6 +146,20 @@ export declare interface KakidashOptions {
|
|
|
108
146
|
* Custom styles to apply to the mind map initially.
|
|
109
147
|
*/
|
|
110
148
|
customStyles?: MindMapStyles;
|
|
149
|
+
/**
|
|
150
|
+
* Optional handler for file I/O operations.
|
|
151
|
+
* If provided, this handler will be used instead of default browser DOM APIs
|
|
152
|
+
* for importing and exporting files.
|
|
153
|
+
*/
|
|
154
|
+
fileHandler?: FileHandler;
|
|
155
|
+
/**
|
|
156
|
+
* Locale for UI text (help modal, etc.). Defaults to 'en'.
|
|
157
|
+
*/
|
|
158
|
+
locale?: 'en' | 'ja';
|
|
159
|
+
/**
|
|
160
|
+
* Features to disable in the command palette.
|
|
161
|
+
*/
|
|
162
|
+
disabledCommandPaletteFeatures?: ('search' | 'icon' | 'import' | 'export')[];
|
|
111
163
|
}
|
|
112
164
|
|
|
113
165
|
export declare interface KeyBinding {
|
|
@@ -120,12 +172,29 @@ export declare interface KeyBinding {
|
|
|
120
172
|
|
|
121
173
|
export declare type LayoutMode = 'Right' | 'Left' | 'Both';
|
|
122
174
|
|
|
123
|
-
|
|
175
|
+
declare class MindMap {
|
|
124
176
|
root: Node_2;
|
|
125
177
|
theme: Theme;
|
|
178
|
+
private nodeIndex;
|
|
126
179
|
constructor(rootNode: Node_2);
|
|
180
|
+
/**
|
|
181
|
+
* Rebuild the entire node index from the current root tree.
|
|
182
|
+
* Should be called after root replacement (e.g., importData).
|
|
183
|
+
*/
|
|
184
|
+
rebuildIndex(): void;
|
|
185
|
+
private indexSubtree;
|
|
186
|
+
/**
|
|
187
|
+
* Register a node and its entire subtree into the index.
|
|
188
|
+
* Call after adding a node (or subtree) to the tree.
|
|
189
|
+
*/
|
|
190
|
+
registerNode(node: Node_2): void;
|
|
191
|
+
/**
|
|
192
|
+
* Unregister a node and its entire subtree from the index.
|
|
193
|
+
* Call after removing a node (or subtree) from the tree.
|
|
194
|
+
*/
|
|
195
|
+
unregisterNode(node: Node_2): void;
|
|
196
|
+
private removeFromIndex;
|
|
127
197
|
findNode(id: string): Node_2 | null;
|
|
128
|
-
private findNodeRecursive;
|
|
129
198
|
moveNode(nodeId: string, newParentId: string): boolean;
|
|
130
199
|
addSibling(referenceId: string, newNode: Node_2, position: 'before' | 'after'): boolean;
|
|
131
200
|
insertParent(targetId: string, newParentNode: Node_2): boolean;
|
|
@@ -138,6 +207,7 @@ export declare interface MindMapData {
|
|
|
138
207
|
theme?: Theme;
|
|
139
208
|
direction?: number;
|
|
140
209
|
selectedId?: string;
|
|
210
|
+
selectedIds?: string[];
|
|
141
211
|
}
|
|
142
212
|
|
|
143
213
|
export declare interface MindMapNodeData {
|
|
@@ -222,9 +292,18 @@ export declare type ShortcutAction = 'navUp' | 'navDown' | 'navLeft' | 'navRight
|
|
|
222
292
|
|
|
223
293
|
export declare type ShortcutConfig = Partial<Record<ShortcutAction, KeyBinding[]>>;
|
|
224
294
|
|
|
295
|
+
export declare class SvgGenerator {
|
|
296
|
+
/**
|
|
297
|
+
* Generates an SVG string representation of the mind map content within the given container.
|
|
298
|
+
* @param container The element containing the mind map layers.
|
|
299
|
+
* @returns A string containing the serialized SVG.
|
|
300
|
+
*/
|
|
301
|
+
generate(container: HTMLElement): string;
|
|
302
|
+
}
|
|
303
|
+
|
|
225
304
|
export declare type Theme = 'default' | 'simple' | 'colorful' | 'custom';
|
|
226
305
|
|
|
227
|
-
declare class TypedEventEmitter<EventMap extends Record<string, any>> {
|
|
306
|
+
export declare class TypedEventEmitter<EventMap extends Record<string, any>> {
|
|
228
307
|
private listeners;
|
|
229
308
|
on<K extends keyof EventMap>(event: K, listener: (payload: EventMap[K]) => void): void;
|
|
230
309
|
addListener<K extends keyof EventMap>(event: K, listener: (payload: EventMap[K]) => void): void;
|
|
@@ -233,4 +312,11 @@ declare class TypedEventEmitter<EventMap extends Record<string, any>> {
|
|
|
233
312
|
protected emit<K extends keyof EventMap>(event: K, payload: EventMap[K]): void;
|
|
234
313
|
}
|
|
235
314
|
|
|
315
|
+
export declare class XMindImporter {
|
|
316
|
+
private idGenerator;
|
|
317
|
+
constructor();
|
|
318
|
+
extractMindMapData(data: ArrayBuffer | Blob | Uint8Array | string): Promise<MindMapData>;
|
|
319
|
+
private transformTopic;
|
|
320
|
+
}
|
|
321
|
+
|
|
236
322
|
export { }
|