kakidash 0.0.11 → 0.1.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.ja.md CHANGED
@@ -36,7 +36,7 @@ Kakidashのミッションは、**アウトプット速度の最大化**です
36
36
  ## Installation
37
37
 
38
38
  ```bash
39
- npm install kakidash
39
+ pnpm add kakidash
40
40
  ```
41
41
 
42
42
  ## Usage
@@ -77,7 +77,7 @@ npm install kakidash
77
77
  #### A. NPM プロジェクト (Vite / Webpack など)
78
78
 
79
79
  ```bash
80
- npm install kakidash
80
+ pnpm add kakidash
81
81
  ```
82
82
 
83
83
  ```typescript
@@ -344,36 +344,55 @@ const kakidash = new Kakidash(container, {
344
344
  | `-` | フォントサイズ縮小 |
345
345
  | `1` - `7` | ノードの色を変更 (パレット順) |
346
346
 
347
+ ## アーキテクチャ
348
+
349
+ ソフトウェアアーキテクチャの詳細や内部モジュールの依存関係については、以下を参照してください:
350
+ - [ソフトウェアアーキテクチャ設計書](./docs/SOFTWARE_ARCHITECTURE_ja.md)
351
+
347
352
  ## Development
348
353
 
349
354
  ### Setup
350
355
 
351
356
  ```bash
352
- npm install
357
+ pnpm install
353
358
  ```
354
359
 
355
360
  ### Dev Server
356
361
 
357
362
  ```bash
358
- npm run dev
363
+ pnpm dev
364
+ ```
365
+
366
+ ### Type Check
367
+
368
+ ```bash
369
+ pnpm typecheck
370
+ # or with turbo
371
+ pnpm turbo typecheck
359
372
  ```
360
373
 
361
374
  ### Build
362
375
 
363
376
  ```bash
364
- npm run build
377
+ pnpm build
378
+ # or with turbo
379
+ pnpm turbo build
365
380
  ```
366
381
 
367
382
  ### Test
368
383
 
369
384
  ```bash
370
- npm test
385
+ pnpm test
386
+ # or with turbo
387
+ pnpm turbo test
371
388
  ```
372
389
 
373
390
  ### Lint
374
391
 
375
392
  ```bash
376
- npm run lint
393
+ pnpm lint
394
+ # or with turbo
395
+ pnpm turbo lint
377
396
  ```
378
397
 
379
398
  ### Documentation
@@ -381,7 +400,15 @@ npm run lint
381
400
  TypeDocを使用してAPIドキュメントを生成します:
382
401
 
383
402
  ```bash
384
- npm run docs
403
+ pnpm docs
385
404
  ```
386
405
 
387
406
  `docs/` ディレクトリにドキュメントが生成されます。
407
+
408
+ ### すべてのチェックを実行
409
+
410
+ 型チェック、ビルド、テスト、Lint、ドキュメント生成を並列実行します:
411
+
412
+ ```bash
413
+ pnpm turbo:ci
414
+ ```
package/README.md CHANGED
@@ -34,7 +34,7 @@ Master the shortcuts and expand your mind map at the speed of thought.
34
34
  ## Installation
35
35
 
36
36
  ```bash
37
- npm install kakidash
37
+ pnpm add kakidash
38
38
  ```
39
39
 
40
40
  ## Usage
@@ -74,7 +74,7 @@ Prepare a container element (e.g., `div`) to display `kakidash`.
74
74
  #### A. NPM Project (Vite / Webpack etc.)
75
75
 
76
76
  ```bash
77
- npm install kakidash
77
+ pnpm add kakidash
78
78
  ```
79
79
 
80
80
  ```typescript
@@ -338,36 +338,55 @@ Here is the complete default configuration. You can partially override these key
338
338
  | `-` | Decrease font size |
339
339
  | `1` - `7` | Change node color (Palette order) |
340
340
 
341
+ ## Architecture
342
+
343
+ For details on the software architecture and internal module dependencies, please refer to:
344
+ - [Software Architecture Design](./docs/SOFTWARE_ARCHITECTURE.md)
345
+
341
346
  ## Development
342
347
 
343
348
  ### Setup
344
349
 
345
350
  ```bash
346
- npm install
351
+ pnpm install
347
352
  ```
348
353
 
349
354
  ### Dev Server
350
355
 
351
356
  ```bash
352
- npm run dev
357
+ pnpm dev
358
+ ```
359
+
360
+ ### Type Check
361
+
362
+ ```bash
363
+ pnpm typecheck
364
+ # or with turbo
365
+ pnpm turbo typecheck
353
366
  ```
354
367
 
355
368
  ### Build
356
369
 
357
370
  ```bash
358
- npm run build
371
+ pnpm build
372
+ # or with turbo
373
+ pnpm turbo build
359
374
  ```
360
375
 
361
376
  ### Test
362
377
 
363
378
  ```bash
364
- npm test
379
+ pnpm test
380
+ # or with turbo
381
+ pnpm turbo test
365
382
  ```
366
383
 
367
384
  ### Lint
368
385
 
369
386
  ```bash
370
- npm run lint
387
+ pnpm lint
388
+ # or with turbo
389
+ pnpm turbo lint
371
390
  ```
372
391
 
373
392
  ### Documentation
@@ -375,7 +394,15 @@ npm run lint
375
394
  Generate API documentation using TypeDoc:
376
395
 
377
396
  ```bash
378
- npm run docs
397
+ pnpm docs
379
398
  ```
380
399
 
381
400
  The documentation will be generated in `docs/` directory.
401
+
402
+ ### Run All Checks
403
+
404
+ Run type checking, build, tests, linting, and documentation generation in parallel:
405
+
406
+ ```bash
407
+ pnpm turbo:ci
408
+ ```
package/dist/index.d.ts CHANGED
@@ -6,127 +6,27 @@ declare type Direction = 'Up' | 'Down' | 'Left' | 'Right';
6
6
  */
7
7
  export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
8
8
  private mindMap;
9
- private service;
10
- private renderer;
11
- private interactionHandler;
12
- private styleEditor;
13
- private layoutSwitcher;
14
- private layoutMode;
15
- private selectedNodeId;
16
- /**
17
- * Flag to track if we just created a node via UI interaction and are waiting for edit completion
18
- * to emit the final model:change event.
19
- */
20
- private pendingNodeCreation;
21
- private panX;
22
- private panY;
23
- private targetPanX;
24
- private targetPanY;
25
- private scale;
26
- private isBatching;
27
- private animationFrameId;
28
- private maxWidth;
29
- private savedCustomStyles;
30
- /**
31
- * Creates a new Kakidash instance.
32
- *
33
- * @param container - The HTML element to mount the mind map into. Must have defined width and height.
34
- * @param options - Optional configuration options.
35
- */
9
+ private controller;
36
10
  constructor(container: HTMLElement, options?: KakidashOptions);
37
- /**
38
- * Adds a new child node to the specified parent.
39
- * This is a pure data operation and does not trigger UI actions like auto-focus or scroll.
40
- *
41
- * @param parentId - The ID of the parent node.
42
- * @param topic - The content of the new node.
43
- * @param layoutSide - For 'Both' layout mode, which side to place the node (root children only).
44
- * @param options - Options for the operation.
45
- * @returns The newly created Node object, or null if failed.
46
- */
47
11
  addNode(parentId: string, topic?: string, layoutSide?: 'left' | 'right', options?: {
48
12
  emitChange?: boolean;
49
13
  }): Node_2 | null;
50
- /**
51
- * Adds a sibling node relative to the reference node.
52
- * This is a pure data operation.
53
- */
54
14
  addSibling(referenceId: string, position?: 'before' | 'after', topic?: string, options?: {
55
15
  emitChange?: boolean;
56
16
  }): Node_2 | null;
57
- /**
58
- * Inserts a parent node above the specified node.
59
- * This is a pure data operation.
60
- */
61
17
  insertParent(targetId: string, topic?: string, options?: {
62
18
  emitChange?: boolean;
63
19
  }): Node_2 | null;
64
- /**
65
- * Removes a node.
66
- * This is a pure data operation.
67
- * (Previously removeNode, keeping alias or usage consistent)
68
- */
69
20
  deleteNode(nodeId: string): void;
70
- /**
71
- * Updates a node's topic or style.
72
- * This is a pure data operation.
73
- *
74
- * @param nodeId - The ID of the node to update.
75
- * @param updates - Object containing the fields to update.
76
- *
77
- * @example
78
- * **Rename and style a node:**
79
- * ```typescript
80
- * kakidash.updateNode('node-1', {
81
- * topic: 'Important Idea',
82
- * style: { background: '#ffff00', color: 'black' }
83
- * });
84
- * ```
85
- */
86
21
  updateNode(nodeId: string, updates: {
87
22
  topic?: string;
88
23
  style?: Partial<NodeStyle>;
89
24
  }): void;
90
- /**
91
- * Undo the last change.
92
- */
93
25
  undo(): void;
94
- /**
95
- * Redo the last undone change.
96
- */
97
26
  redo(): void;
98
- /**
99
- * Toggle fold state of a node.
100
- */
101
27
  toggleFold(nodeId: string): void;
102
- /**
103
- * Get the ID of the currently selected node.
104
- */
105
28
  getSelectedNodeId(): string | null;
106
- /**
107
- * Updates the style of a specific node.
108
- * This applies styles directly to the node instance, overriding global themes.
109
- *
110
- * @param nodeId - The ID of the node to update.
111
- * @param style - Partial style object. Properties set to `undefined` or empty strings might reset to default depending on implementation.
112
- *
113
- * @example
114
- * **Highlight a node:**
115
- * ```typescript
116
- * kakidash.updateNodeStyle('node-id-123', {
117
- * color: 'red',
118
- * fontWeight: 'bold',
119
- * fontSize: '20px'
120
- * });
121
- * ```
122
- */
123
29
  updateNodeStyle(nodeId: string, style: Partial<NodeStyle>): void;
124
- /**
125
- * Sets the theme of the mind map.
126
- *
127
- * @param theme - The theme name ('default' | 'simple' | 'colorful' | 'custom').
128
- * If 'custom' is selected, previously saved custom styles (via updateGlobalStyles) are applied.
129
- */
130
30
  setTheme(theme: Theme): void;
131
31
  getMindMap(): MindMap;
132
32
  getNode(nodeId: string): Node_2 | undefined;
@@ -134,65 +34,14 @@ export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
134
34
  findNodes(predicate: (node: Node_2) => boolean): Node_2[];
135
35
  setMaxNodeWidth(width: number): void;
136
36
  getMaxNodeWidth(): number;
137
- /**
138
- * Updates global styles for the mind map using CSS variables.
139
- * This allows batch updating of visual appearance without deep re-renders.
140
- * Styles are persisted in `savedCustomStyles` and applied immediately if the current theme is 'custom'.
141
- *
142
- * @param styles - Object containing style definitions for various elements.
143
- *
144
- * @example
145
- * **Apply a dark theme style:**
146
- * ```typescript
147
- * kakidash.updateGlobalStyles({
148
- * rootNode: {
149
- * border: '2px solid #555',
150
- * background: '#333',
151
- * color: '#fff'
152
- * },
153
- * childNode: {
154
- * border: '1px solid #444',
155
- * background: '#222',
156
- * color: '#eee'
157
- * },
158
- * connection: {
159
- * color: '#666'
160
- * },
161
- * canvas: {
162
- * background: '#1a1a1a'
163
- * }
164
- * });
165
- * ```
166
- *
167
- * @example
168
- * **Reset specific local styles (by passing empty string):**
169
- * ```typescript
170
- * // Reverts root node border to default
171
- * kakidash.updateGlobalStyles({
172
- * rootNode: { border: '' }
173
- * });
174
- * ```
175
- */
176
37
  updateGlobalStyles(styles: MindMapStyles): void;
177
- /**
178
- * Helper to apply a set of styles to the DOM via CSS variables.
179
- */
180
- private applyCustomStylesToDOM;
181
38
  setReadOnly(readOnly: boolean): void;
182
39
  destroy(): void;
183
40
  batch(callback: () => void): void;
184
41
  addChildNode(parentId: string): void;
185
42
  addSiblingNode(nodeId: string, position?: 'before' | 'after'): void;
186
43
  insertParentNode(nodeId: string): void;
187
- /**
188
- * Wrapper for deleteNode that handles selection update (Interaction concern).
189
- */
190
44
  removeNode(nodeId: string): void;
191
- /**
192
- * Helper to ensure sides are locked when modifying Root children in Both mode.
193
- * (Kept as private helper for internal use)
194
- */
195
- private ensureExplicitLayoutSides;
196
45
  moveNode(nodeId: string, targetId: string, position: 'top' | 'bottom' | 'left' | 'right'): void;
197
46
  updateNodeTopic(nodeId: string, topic: string): void;
198
47
  selectNode(nodeId: string | null): void;
@@ -203,7 +52,6 @@ export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
203
52
  pasteNode(parentId: string): void;
204
53
  pasteImage(parentId: string, imageData: string): void;
205
54
  cutNode(nodeId: string): void;
206
- private render;
207
55
  updateLayout(mode: 'Standard' | 'Left' | 'Right'): void;
208
56
  setLayoutMode(mode: LayoutMode): void;
209
57
  getLayoutMode(): LayoutMode;
@@ -211,10 +59,6 @@ export declare class Kakidash extends TypedEventEmitter<KakidashEventMap> {
211
59
  getData(): MindMapData;
212
60
  loadData(data: MindMapData): void;
213
61
  getRootId(): string;
214
- private getNodeDirection;
215
- private startAnimationLoop;
216
- private ensureNodeVisible;
217
- private showShortcutModal;
218
62
  }
219
63
 
220
64
  export declare type KakidashEventMap = {
@@ -297,31 +141,24 @@ declare interface MindMapNodeData {
297
141
  layoutSide?: 'left' | 'right';
298
142
  }
299
143
 
300
- /**
301
- * Configuration for global mind map styles.
302
- * All properties accept standard CSS value strings (e.g., "blue", "1px solid red", "#ff0000").
303
- */
304
- export declare interface MindMapStyles {
305
- /** Styles for the root node. */
144
+ declare interface MindMapStyles {
306
145
  rootNode?: {
307
146
  border?: string;
308
147
  background?: string;
309
148
  color?: string;
310
149
  };
311
- /** Styles for all child nodes (non-root). */
312
150
  childNode?: {
313
151
  border?: string;
314
152
  background?: string;
315
153
  color?: string;
316
154
  };
317
- /** Styles for connection lines. */
318
155
  connection?: {
319
156
  color?: string;
320
157
  };
321
- /** Styles for the canvas/background. */
322
158
  canvas?: {
323
159
  background?: string;
324
160
  };
161
+ [key: string]: any;
325
162
  }
326
163
 
327
164
  declare class Node_2 {
@@ -349,7 +186,7 @@ declare interface NodeStyle {
349
186
  fontStyle?: string;
350
187
  }
351
188
 
352
- declare type ShortcutAction = 'navUp' | 'navDown' | 'navLeft' | 'navRight' | 'addChild' | 'insertParent' | 'addSibling' | 'addSiblingBefore' | 'deleteNode' | 'beginEdit' | 'copy' | 'paste' | 'cut' | 'undo' | 'redo' | 'bold' | 'italic' | 'zoomIn' | 'zoomOut' | 'toggleFold' | 'centerMap' | 'selectColor1' | 'selectColor2' | 'selectColor3' | 'selectColor4' | 'selectColor5' | 'selectColor6' | 'selectColor7';
189
+ declare type ShortcutAction = 'navUp' | 'navDown' | 'navLeft' | 'navRight' | 'addChild' | 'insertParent' | 'addSibling' | 'addSiblingBefore' | 'deleteNode' | 'beginEdit' | 'copy' | 'paste' | 'cut' | 'undo' | 'redo' | 'bold' | 'italic' | 'zoomIn' | 'zoomOut' | 'scaleUp' | 'scaleDown' | 'resetZoom' | 'toggleFold' | 'centerMap' | 'selectColor1' | 'selectColor2' | 'selectColor3' | 'selectColor4' | 'selectColor5' | 'selectColor6' | 'selectColor7';
353
190
 
354
191
  export declare type ShortcutConfig = Partial<Record<ShortcutAction, KeyBinding[]>>;
355
192