kakidash 0.2.2 → 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.
package/README.ja.md CHANGED
@@ -19,14 +19,17 @@ Kakidashのミッションは、**アウトプット速度の最大化**です
19
19
  - **マインドマップ作成**: ノードの追加、兄弟ノード、子ノードの操作
20
20
  - **レイアウト**: 標準 (Standard/Both)、左揃え (Left)、右揃え (Right)
21
21
  - **スタイリング**:
22
- - フォントサイズ変更
23
- - 太字 (Bold)、斜体 (Italic)
24
- - カラーパレットによる色変更 (Style Editor)
22
+ - フォントサイズの調整
23
+ - 太字 (`Bold`)、斜体 (`Italic`)、取り消し線 (`Strikethrough`)
24
+ - パレットによる文字ごとの色変更 (Style Editor)
25
25
  - **テーマ**: 複数の組み込みテーマ (Default, Simple, Colorful, Dark) の切り替え
26
- - **アイコン設定**: コマンドパレットからのフラットアイコン追加・削除 (`m` key)
26
+ - **アイコン設定**: コマンドパレットからのフラットアイコンおよび数字アイコン (0-9) の追加・削除 (`m` key)
27
27
  - **インタラクション**:
28
- - ドラッグ&ドロップによるノード移動・並び替え
28
+ - ドラッグ&ドロップによるノード移動・並び替え (PCのマウスおよびモバイルのタッチ操作に対応)
29
29
  - キーボードショートカットによる高速操作
30
+ - **ヘルプモーダル**: ツールバーの「?」アイコンからアイコンの意味とショートカットキーの確認が可能
31
+ - **複数選択**: Shift + Click または Shift + 矢印キーによる範囲選択
32
+ - **一括操作**: 削除、コピー、切り取り、貼り付け、スタイル変更は選択された全ノードに適用されます
30
33
  - ズーム、パン (画面移動)
31
34
  - **画像対応**: クリップボードからの画像貼り付け
32
35
  - **Auto Link**: ノード内のURLを自動検出し、クリック可能なリンクに変換
@@ -98,10 +101,12 @@ const container = document.getElementById('mindmap-container');
98
101
  // インスタンス化
99
102
  // インスタンス化 (オプション指定可能)
100
103
  const kakidash = new Kakidash(container, {
104
+ locale: 'ja', // オプション: 'en' | 'ja' (デフォルト: 'en')
101
105
  maxNodeWidth: 200, // オプション: ノードの最大幅
102
106
  customStyles: { // オプション: 初期のカスタムスタイル
103
107
  rootNode: { border: '2px solid red' }
104
- }
108
+ },
109
+ disabledCommandPaletteFeatures: ['import'] // オプション: 特定の機能を無効化
105
110
  });
106
111
 
107
112
  // 必要に応じて初期データをロードしたり、ノードを追加したりします
@@ -197,9 +202,11 @@ kakidash.setTheme('custom');
197
202
  ### Methods
198
203
 
199
204
  - **`new Kakidash(container: HTMLElement, options?: KakidashOptions)`**: インスタンスを生成します。
205
+ - `options.locale`: ヘルプモーダルなどの表示言語 ('en' | 'ja')。
200
206
  - `options.shortcuts`: キーボードショートカットのカスタマイズ。
201
207
  - `options.maxNodeWidth`: テキストノードの最大幅 (ピクセル)。
202
208
  - `options.customStyles`: 初期のカスタムスタイル。
209
+ - `options.disabledCommandPaletteFeatures`: コマンドパレットの特定の機能を無効化 ('search' | 'icon' | 'import' | 'export')。
203
210
  - **`kakidash.addNode(parentId, topic)`**: 指定した親ノードに新しい子ノードを追加します。
204
211
  - **`kakidash.getData()`**: 現在のマインドマップデータをJSONオブジェクトとして取得します。
205
212
  - **`kakidash.loadData(data)`**: JSONデータを読み込み、マインドマップを描画します。
@@ -212,6 +219,11 @@ kakidash.setTheme('custom');
212
219
  - **`kakidash.redo()`**: 元に戻した変更をやり直します。
213
220
  - **`kakidash.toggleFold(nodeId)`**: ノードの折り畳み/展開を切り替えます。
214
221
  - **`kakidash.getSelectedNodeId()`**: 現在選択されているノードのIDを取得します。
222
+ - **`kakidash.setSelectedNodeId(nodeId)`**: 指定したIDのノードを選択状態にします。
223
+ - **`kakidash.registerCommand(command)`**: コマンドパレットにカスタムコマンドを登録します。
224
+ - `command.id`: コマンドの一意なID。
225
+ - `command.topic`: パレットに表示される名前。
226
+ - `command.execute`: 実行時に呼ばれるコールバック `(selectedNodeId: string | null) => void`。
215
227
  - **`kakidash.updateNode(nodeId, { topic?, style?, icon? })`**: ノードを更新します。`icon` にはアイコンID ('check', 'star' など) を指定します。
216
228
  - **`kakidash.on(event, listener)`**: イベントリスナーを登録します。
217
229
  - **`kakidash.off(event, listener)`**: イベントリスナーを削除します。
@@ -317,6 +329,7 @@ const kakidash = new Kakidash(container, {
317
329
  | ----------------------------------- | --------------------------------------- |
318
330
  | `m` | コマンドパレット (検索 / アイコン) |
319
331
  | `Arrow Keys` | ノード間の移動 |
332
+ | `Shift + Arrow Keys` | ノードの範囲選択 |
320
333
  | `h` / `j` / `k` / `l` | ノード間の移動 (Vim風) |
321
334
  | `F2` / `DblClick` / `Space` / `i` | ノードの編集を開始 (画像の場合はズーム) |
322
335
  | `Enter` | 兄弟ノードを追加 (下) |
@@ -352,11 +365,32 @@ const kakidash = new Kakidash(container, {
352
365
  | --------------------------- | ----------------------------- |
353
366
  | `Shift + b` | 太字 (Bold) 切り替え |
354
367
  | `Shift + i` | 斜体 (Italic) 切り替え |
368
+ | `Shift + x` | 取り消し線 (Strikethrough) 切り替え |
355
369
  | `Shift + . (>)` / `.` | フォントサイズ拡大 |
356
370
  | `Shift + , (<)` / `,` | フォントサイズ縮小 |
357
- | `Shift + ArrowLeft / Right` | ノード幅の変更 |
371
+ | `Shift + Alt + ArrowLeft / Right` | ノード幅の変更 |
358
372
  | `1` - `7` | ノードの色を変更 (パレット順) |
359
373
 
374
+ ## カスタムコマンドの登録
375
+
376
+ `registerCommand` を使用して、自身の関数をコマンドパレットに追加できます。
377
+
378
+ ```typescript
379
+ board.registerCommand({
380
+ id: 'rocket-launch',
381
+ topic: '🚀 Rocket Launch',
382
+ execute: (selectedNodeId) => {
383
+ console.log('選択中のノード:', selectedNodeId);
384
+ // ここに独自のロジックを記述します
385
+ if (selectedNodeId) {
386
+ board.updateNodeTopic(selectedNodeId, '🚀 LAUNCHED!');
387
+ }
388
+ }
389
+ });
390
+ ```
391
+
392
+ 登録されたコマンドはコマンドパレット(デフォルト:`m` キー)の一覧に表示されます。項目をクリックするか Enter キーを押すことで実行されます。
393
+
360
394
  ## アーキテクチャ
361
395
 
362
396
  ソフトウェアアーキテクチャの詳細や内部モジュールの依存関係については、以下を参照してください:
package/README.md CHANGED
@@ -18,13 +18,16 @@ Master the shortcuts and expand your mind map at the speed of thought.
18
18
  - **Layouts**: Standard (Standard/Both), Left aligned (Left), Right aligned (Right).
19
19
  - **Styling**:
20
20
  - Font size adjustment.
21
- - Bold (`Bold`), Italic (`Italic`).
21
+ - Bold (`Bold`), Italic (`Italic`), Strikethrough (`Strikethrough`).
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
- - Drag and drop for node movement and reordering.
26
+ - Drag and drop for node movement and reordering (Supports Mouse & Touch on Mobile).
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.
@@ -96,10 +99,12 @@ const container = document.getElementById('mindmap-container');
96
99
  // Instantiate
97
100
  // Instantiate with optional configuration
98
101
  const kakidash = new Kakidash(container, {
102
+ locale: 'en', // Optional: 'en' | 'ja' (Default: 'en')
99
103
  maxNodeWidth: 200, // Optional: Maximum width for nodes
100
104
  customStyles: { // Optional: Initial custom styles
101
105
  rootNode: { border: '2px solid red' }
102
- }
106
+ },
107
+ disabledCommandPaletteFeatures: ['import'] // Optional: Disable specific features
103
108
  });
104
109
 
105
110
  // Add initial data or nodes if needed
@@ -192,9 +197,11 @@ All values accept standard CSS strings.
192
197
  ### Methods
193
198
 
194
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').
195
201
  - `options.shortcuts`: Custom keyboard shortcuts.
196
202
  - `options.maxNodeWidth`: Maximum width for text nodes (pixels).
197
203
  - `options.customStyles`: Initial custom styles.
204
+ - `options.disabledCommandPaletteFeatures`: Features to disable in the command palette ('search' | 'icon' | 'import' | 'export').
198
205
  - **`kakidash.addNode(parentId, topic)`**: Adds a new child node to the specified parent node.
199
206
  - **`kakidash.getData()`**: Retrieves current mindmap data as a JSON object.
200
207
  - **`kakidash.loadData(data)`**: Loads JSON data and renders the mindmap.
@@ -207,6 +214,11 @@ All values accept standard CSS strings.
207
214
  - **`kakidash.redo()`**: Redo the last undone change.
208
215
  - **`kakidash.toggleFold(nodeId)`**: Toggle fold state of a node.
209
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`.
210
222
  - **`kakidash.updateNode(nodeId, { topic?, style?, icon? })`**: Updates a node property. `icon` accepts an icon ID (e.g., 'check').
211
223
  - **`kakidash.on(event, listener)`**: Register an event listener.
212
224
  - **`kakidash.off(event, listener)`**: Remove an event listener.
@@ -312,6 +324,7 @@ Here is the complete default configuration. You can partially override these key
312
324
  | ----------------------------------- | ------------------------------------------------- |
313
325
  | `m` | Command Palette (Search / Icons) |
314
326
  | `Arrow Keys` | Navigate between nodes |
327
+ | `Shift + Arrow Keys` | Select range of nodes |
315
328
  | `h` / `j` / `k` / `l` | Navigate between nodes (Vim-style) |
316
329
  | `F2` / `DblClick` / `Space` / `i` | Start editing node (Space triggers zoom if image) |
317
330
  | `Enter` | Add sibling node (below) |
@@ -347,11 +360,32 @@ Here is the complete default configuration. You can partially override these key
347
360
  | --------------------------- | --------------------------------- |
348
361
  | `Shift + b` | Toggle Bold |
349
362
  | `Shift + i` | Toggle Italic |
363
+ | `Shift + x` | Toggle Strikethrough |
350
364
  | `Shift + . (>)` / `.` | Increase font size |
351
365
  | `Shift + , (<)` / `,` | Decrease font size |
352
- | `Shift + ArrowLeft / Right` | Adjust node width |
366
+ | `Shift + Alt + ArrowLeft / Right` | Adjust node width |
353
367
  | `1` - `7` | Change node color (Palette order) |
354
368
 
369
+ ## Custom Commands
370
+
371
+ You can extend the command palette with your own functions using `registerCommand`.
372
+
373
+ ```typescript
374
+ board.registerCommand({
375
+ id: 'rocket-launch',
376
+ topic: '🚀 Rocket Launch',
377
+ execute: (selectedNodeId) => {
378
+ console.log('Action on node:', selectedNodeId);
379
+ // Your logic here
380
+ if (selectedNodeId) {
381
+ board.updateNodeTopic(selectedNodeId, '🚀 LAUNCHED!');
382
+ }
383
+ }
384
+ });
385
+ ```
386
+
387
+ Registered commands will appear in the Command Palette (default key: `m`). Clicking or pressing Enter on the item will execute the handler.
388
+
355
389
  ## Architecture
356
390
 
357
391
  For details on the software architecture and internal module dependencies, please refer to: