@aiquants/directory-tree 3.11.0 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/DirectoryTree.d.ts +2 -21
  2. package/dist/DirectoryTreeGrid.d.ts +3 -17
  3. package/dist/TreeLine.d.ts +2 -8
  4. package/dist/cli.server.d.ts +0 -1
  5. package/dist/entryRendering.d.ts +2 -42
  6. package/dist/gridUtils.d.ts +1 -30
  7. package/dist/index.cjs +2 -2
  8. package/dist/index.d.ts +3 -14
  9. package/dist/index.js +101 -101
  10. package/dist/logger.d.ts +0 -63
  11. package/dist/scrollAnchor.d.ts +0 -28
  12. package/dist/styles/directory-tree.standalone.css +1 -1
  13. package/dist/types.d.ts +3 -497
  14. package/dist/useDirectoryTreeState.d.ts +1 -14
  15. package/dist/useEntryInteraction.d.ts +2 -8
  16. package/package.json +6 -7
  17. package/dist/DirectoryTree.d.ts.map +0 -1
  18. package/dist/DirectoryTreeGrid.d.ts.map +0 -1
  19. package/dist/TreeLine.d.ts.map +0 -1
  20. package/dist/cli.server.d.ts.map +0 -1
  21. package/dist/entryRendering.d.ts.map +0 -1
  22. package/dist/gridUtils.d.ts.map +0 -1
  23. package/dist/index.d.ts.map +0 -1
  24. package/dist/logger.d.ts.map +0 -1
  25. package/dist/scrollAnchor.d.ts.map +0 -1
  26. package/dist/types.d.ts.map +0 -1
  27. package/dist/useDirectoryTreeState.d.ts.map +0 -1
  28. package/dist/useEntryInteraction.d.ts.map +0 -1
  29. package/src/DirectoryTree.tsx +0 -1257
  30. package/src/DirectoryTreeGrid.tsx +0 -285
  31. package/src/TreeLine.tsx +0 -300
  32. package/src/cli.server.ts +0 -38
  33. package/src/entryRendering.tsx +0 -299
  34. package/src/gridUtils.ts +0 -88
  35. package/src/index.ts +0 -32
  36. package/src/logger.ts +0 -162
  37. package/src/scrollAnchor.spec.ts +0 -105
  38. package/src/scrollAnchor.ts +0 -86
  39. package/src/styles/components.entry.css +0 -10
  40. package/src/styles/directory-tree.css +0 -87
  41. package/src/styles/standalone.entry.css +0 -12
  42. package/src/types.ts +0 -761
  43. package/src/useDirectoryTreeState.ts +0 -133
  44. package/src/useEntryInteraction.ts +0 -74
  45. package/src/virtualScrollOptionsSeal.spec.ts +0 -43
package/dist/types.d.ts CHANGED
@@ -1,17 +1,5 @@
1
- import { VirtualScroll } from '@aiquants/virtualscroll';
2
- import { ComponentProps, CSSProperties, ReactNode } from 'react';
3
- /**
4
- * @type DirectoryEntry
5
- * @description Represents an entry in the directory tree, which can be a file or a directory.
6
- * ディレクトリツリー内のエントリを表す。ファイルまたはディレクトリの場合がある。
7
- * @property {string} name - Name of the entry. エントリ名。
8
- * @property {ReactNode} [label] - Optional label to render instead of name. 名前のかわりに描画する任意のラベル。
9
- * @property {"file" | "directory"} type - Type of the entry. エントリの種別。
10
- * @property {string} absolutePath - Absolute path of the entry. エントリの絶対パス。
11
- * @property {string} relativePath - Relative path of the entry. エントリの相対パス。
12
- * @property {DirectoryEntry[]} [children] - Child entries if it's a directory. ディレクトリの場合の子エントリ。
13
- * @property {DirectoryTreeIconRenderer} [icon] - Optional icon renderer for the entry. エントリ用の任意のアイコン描画設定。
14
- */
1
+ import { VirtualScroll } from "@aiquants/virtualscroll";
2
+ import { ComponentProps, CSSProperties, ReactNode } from "react";
15
3
  export type DirectoryEntry = {
16
4
  name: string;
17
5
  label?: ReactNode;
@@ -21,68 +9,12 @@ export type DirectoryEntry = {
21
9
  mimeType?: string;
22
10
  children?: DirectoryEntry[];
23
11
  icon?: DirectoryTreeIconRenderer;
24
- /**
25
- * Optional CSS class name for the entry.
26
- * エントリ用のオプション CSS クラス名。
27
- */
28
12
  className?: string;
29
- /**
30
- * Optional inline styles for the entry.
31
- * エントリ用のオプションのインラインスタイル。
32
- */
33
13
  style?: CSSProperties;
34
- /**
35
- * Extra `data-*` attributes rendered on this entry's row. Keys are given **without** the
36
- * `data-` prefix (`{ open: true }` renders `data-open="true"`); values are stringified.
37
- * camelCase keys are converted to kebab-case exactly as the DOM `dataset` API does
38
- * (`{ panelCount: 2 }` renders `data-panel-count="2"`).
39
- *
40
- * この行へ付与する追加の `data-*` 属性。キーは `data-` を**含めずに**渡し
41
- * (`{ open: true }` は `data-open="true"` になる)、値は文字列化される。
42
- * camelCase のキーは DOM の `dataset` と同じ規約で kebab-case へ変換される
43
- * (`{ panelCount: 2 }` は `data-panel-count="2"`)。
44
- *
45
- * @remarks 用途は、状態を CSS クラスではなく属性として公開し、テストやスタイルが
46
- * クラス名に依存しないようにすること。クラス名は整形や prefix 変更で無言に壊れる。
47
- * このコンポーネント自身が出力する `data-entry-*` は上書きできない (常に後勝ち)。
48
- */
49
14
  data?: Record<string, string | number | boolean>;
50
15
  };
51
- /**
52
- * Comparator applied to a sibling group before the tree is flattened into rows.
53
- * Receives two entries that share the same parent and returns the usual
54
- * `Array.prototype.sort` ordering number.
55
- *
56
- * ツリーを行へフラット化する前に、同一の親を持つ兄弟グループへ適用する比較関数。
57
- * 戻り値は `Array.prototype.sort` と同じ順序数値。
58
- */
59
16
  export type DirectoryEntryComparator = (a: DirectoryEntry, b: DirectoryEntry) => number;
60
- /**
61
- * Row height for directory tree entries.
62
- * Either a fixed pixel value applied to every row, or a function computing the
63
- * height per entry (for variable-height rows). When a function is supplied it
64
- * receives the entry and its flattened (visible) index.
65
- *
66
- * ディレクトリツリー各行の高さ。
67
- * 全行に適用する固定ピクセル値、またはエントリごとに高さを算出する関数(可変高さ行)。
68
- * 関数を渡す場合は、エントリとフラット化後(表示上)のインデックスが渡される。
69
- *
70
- * @remarks
71
- * 関数を渡す場合は参照を安定させること(例: `useCallback`)。identity が毎レンダー
72
- * 変わると仮想スクロールの高さモデルが都度再計算され、パフォーマンスが劣化する。
73
- *
74
- * 不正値(`NaN` / `Infinity` / `0` / 負値)を返した行は既定 20px にフォールバックする。
75
- *
76
- * 高さを実行時に変更する場合、可視外アイテムのスクロールバー総高は一時的に旧値のまま
77
- * となり、スクロールに伴い自己修復される(表示中の行と接続線は即座に正確)。変更直後から
78
- * 総高を厳密にしたい場合は `virtualScroll.behaviorOptions.resetOnGetItemHeightChange` を
79
- * 有効化する。
80
- */
81
17
  export type ItemHeight = number | ((entry: DirectoryEntry, index: number) => number);
82
- /**
83
- * Context object passed to icon renderer functions.
84
- * アイコン描画関数に渡されるコンテキストオブジェクト。
85
- */
86
18
  export type DirectoryTreeIconRenderContext = {
87
19
  entry: DirectoryEntry;
88
20
  isDirectory: boolean;
@@ -92,530 +24,130 @@ export type DirectoryTreeIconRenderContext = {
92
24
  extension?: string;
93
25
  mimeType?: string;
94
26
  };
95
- /**
96
- * Type definition for icon renderer.
97
- * アイコン描画ロジックの定義。
98
- */
99
27
  export type DirectoryTreeIconRenderer = ReactNode | ((context: DirectoryTreeIconRenderContext) => ReactNode);
100
- /**
101
- * Icon override options for directory tree entries.
102
- * ディレクトリツリーエントリのアイコン差し替えオプション。
103
- */
104
28
  export type DirectoryTreeIconOverrides = {
105
29
  directory?: DirectoryTreeIconRenderer;
106
30
  directoryExpanded?: DirectoryTreeIconRenderer;
107
31
  file?: DirectoryTreeIconRenderer;
108
32
  fileByExtension?: Record<string, DirectoryTreeIconRenderer>;
109
33
  };
110
- /**
111
- * Highlight styles configuration for hover and selection states.
112
- * ホバー時および選択時のハイライトスタイルの設定。
113
- */
114
34
  export type HighlightStyles = {
115
- /** CSS class name for hover state. / ホバー時の CSS クラス名。 */
116
35
  hoverClassName?: string;
117
- /** Inline style for hover state. / ホバー時のインラインスタイル。 */
118
36
  hoverStyle?: CSSProperties;
119
- /** CSS class name for selected directory. / ディレクトリ選択時の CSS クラス名。 */
120
37
  directorySelectedClassName?: string;
121
- /** Inline style for selected directory. / ディレクトリ選択時のインラインスタイル。 */
122
38
  directorySelectedStyle?: CSSProperties;
123
- /** CSS class name for selected item (file). / アイテム(ファイル)選択時の CSS クラス名。 */
124
39
  itemSelectedClassName?: string;
125
- /** Inline style for selected item (file). / アイテム(ファイル)選択時のインラインスタイル。 */
126
40
  itemSelectedStyle?: CSSProperties;
127
41
  };
128
- /**
129
- * Event object passed to the onEntryClick callback.
130
- * onEntryClick コールバックに渡されるイベントオブジェクト。
131
- */
132
42
  export type DirectoryTreeClickEvent = {
133
- /** The entry that was clicked. / クリックされたエントリ。 */
134
43
  entry: DirectoryEntry;
135
- /** Whether the entry is a directory. / エントリがディレクトリかどうか。 */
136
44
  isDirectory: boolean;
137
- /** Whether the directory is currently expanded (always false for files). / ディレクトリが展開中か (ファイルは常に false)。 */
138
45
  isExpanded: boolean;
139
- /**
140
- * Call to prevent the default behavior.
141
- * For directories, this prevents the expand/collapse toggle.
142
- * For files, this is a no-op (there is no default behavior to prevent).
143
- *
144
- * デフォルト動作を抑制する。
145
- * ディレクトリの場合、展開/折りたたみのトグルを抑制する。
146
- * ファイルの場合、抑制するデフォルト動作がないため何もしない。
147
- */
148
46
  preventDefault: () => void;
149
47
  };
150
- /**
151
- * Options for configuring virtual scroll behavior.
152
- * 仮想スクロールの挙動を設定するためのオプション。
153
- *
154
- * ❗ **横軸のシームは丸ごと封じる。** DirectoryTree は横スクロールを自前で所有する
155
- * (`onWheelHorizontal` を内部結線する) ため、`onWheelHorizontal` に加えて、同じシームに属する
156
- * `horizontalKeyInputs` / `horizontalKeyStep` (virtualscroll 2.5.0 でトップレベルに追加) も
157
- * 除外する。これらが素通りすると、封じたはずの横軸へキーボード経由で到達でき、`"arrow"` 指定は
158
- * ツリー自身の ArrowLeft / ArrowRight (折りたたみ / 展開) ナビゲーションと競合する。
159
- */
160
48
  export type DirectoryTreeVirtualScrollOptions = Omit<ComponentProps<typeof VirtualScroll>, "itemCount" | "getItem" | "getItemHeight" | "children" | "viewportSize" | "onWheelHorizontal" | "horizontalKeyInputs" | "horizontalKeyStep" | "ref"> & {
161
- /** Override for viewport height. / 内部計測をスキップするための任意の固定ビューポート高さ。 */
162
49
  viewportHeightOverride?: number;
163
- /**
164
- * Keeps the first visible row visually stationary when the row list mutates
165
- * (e.g. streaming insertions above the viewport). Applies only while scrolled
166
- * away from the top; at the top the list stays top-anchored as usual.
167
- *
168
- * 行リストの変異時 (ストリーミング追記など) に先頭可視行を画面上で静止させる。
169
- * 最上部 (scroll 0) では通常どおり先頭アンカーのままとし、スクロール中のみ作用する。
170
- */
171
50
  preserveScrollAnchor?: boolean;
172
51
  };
173
- /**
174
- * Compile-time constraint: the type parameter must be `never`.
175
- * コンパイル時制約: 型引数が `never` であることを強制する補助型。
176
- */
177
52
  type MustBeNever<T extends never> = T;
178
- /**
179
- * Compile-time seal guard for the horizontal-axis seam of
180
- * {@link DirectoryTreeVirtualScrollOptions}. If any sealed prop ever leaks back into the
181
- * type (i.e. someone drops it from the `Omit<>` list), `Extract` yields that key instead
182
- * of `never` and this line becomes a TS2344 compile error naming the leaked prop. A RENAME
183
- * on the `@aiquants/virtualscroll` side is NOT caught (the leak then re-grows under the
184
- * new name, which this list cannot know) — that case is owned by the pass-through review
185
- * that accompanies every virtualscroll version bump.
186
- *
187
- * {@link DirectoryTreeVirtualScrollOptions} の横軸シーム封印のコンパイル時ガード。封じた
188
- * props が型へ漏れ戻ると (`Omit<>` リストからの脱落)、`Extract` が `never` でなく漏れた
189
- * キーを返し、この行が漏れた prop 名入りの TS2344 コンパイルエラーになる仕組み。
190
- * virtualscroll 側の**リネーム**は捕まらない (新名で漏れ戻るため本リストでは知り得ない) —
191
- * その系は virtualscroll 版上げ時の pass-through 見直しが受け持つ。
192
- *
193
- * 消費者視点の対 (封印 3 props の代入拒否 + 封じていない props が通る陽性コントロール) は
194
- * `virtualScrollOptionsSeal.spec.ts` が持つ。テスト側の `@ts-expect-error` が機能するのは
195
- * `tsconfig.json` が spec / test ファイルを型検査対象に含めているからであり (3.10.0 で
196
- * exclude を撤去)、除外へ戻すとテスト側ガードは誰にも検査されない空砲に戻る
197
- * (旧構成で変異検証により実証済み)。本ガードは定義の隣で `Omit<>` リスト自体を固定する。
198
- */
199
53
  export type HorizontalSeamSealGuard = MustBeNever<Extract<keyof DirectoryTreeVirtualScrollOptions, "onWheelHorizontal" | "horizontalKeyInputs" | "horizontalKeyStep" | "ref">>;
200
- /**
201
- * A single column definition for the TreeGrid (columns) mode.
202
- * `columns[0]` is always the name / tree column (indent + expand glyph + type icon live here).
203
- *
204
- * TreeGrid(列)モードの列定義。`columns[0]` は常に名前(ツリー)列。
205
- *
206
- * @remarks
207
- * `render` / `footer` の関数は参照を安定させること(`useMemo` / `useCallback`)。
208
- * identity が毎レンダー変わると行のメモ化が無効化され、可視行が毎回再描画されて
209
- * 仮想スクロールの利点が失われる(`ItemHeight` と同じ制約)。
210
- */
211
54
  export type DirectoryTreeColumn = {
212
- /** Unique column key (duplicates are flagged in dev). / 一意なキー(dev で重複検証)。 */
213
55
  key: string;
214
- /** Column header content. / 列ヘッダ内容。 */
215
56
  header?: ReactNode;
216
- /**
217
- * Footer content. The function form receives **every node of the `entries` prop
218
- * (including collapsed subtrees)**, not just the visible rows.
219
- * フッタ内容。関数形は entries prop の全ノード(折り畳み subtree 含む)を受け取る。
220
- */
221
57
  footer?: ReactNode | ((allEntries: DirectoryEntry[]) => ReactNode);
222
- /**
223
- * Column width in px. The name column (`columns[0]`) uses this as its frozen width;
224
- * numeric columns use it as the grid track width.
225
- * 列幅(px)。名前列は凍結幅、数値列は grid track 幅として使用。
226
- * 既定: 名前列 240、数値列 96。
227
- */
228
58
  width?: number;
229
- /** Cell text alignment. Default `left` (numeric columns should use `right`). / セル寄せ。既定 left。 */
230
59
  align?: "left" | "right" | "center";
231
- /** Extra class name for cells in this column. / この列のセルに付与する追加クラス。 */
232
60
  className?: string;
233
- /**
234
- * Cell content renderer. In the name column the indent / expand glyph / type icon are
235
- * drawn by the library, and this render output is placed as the label content
236
- * (falls back to `entry.name` when omitted).
237
- * セル内容レンダラ。名前列では indent/glyph/icon はライブラリが描画し、本 render の
238
- * 戻り値がラベル内容として配置される(省略時は `entry.name`)。
239
- */
240
61
  render?: (entry: DirectoryEntry, ctx: {
241
62
  indentLevel: number;
242
63
  isDirectory: boolean;
243
64
  isExpanded: boolean;
244
65
  }) => ReactNode;
245
66
  };
246
- /**
247
- * TreeGrid (columns) mode configuration. When provided, the name column is frozen on the
248
- * left (indent + connector lines confined there) and the remaining columns render as an
249
- * aligned grid with an aligned header/footer and a horizontally scrollable numeric region.
250
- * When omitted, the classic label-based tree rendering is used.
251
- *
252
- * TreeGrid(列)モード設定。指定時は名前列を凍結し数値列を整列グリッドで描画、整列ヘッダ/フッタと
253
- * 数値領域の横スクロールを提供する。省略時は従来のラベルツリー描画。
254
- *
255
- * @remarks `columns` と各 `render` / `footer` は参照安定必須。
256
- */
257
67
  export type DirectoryTreeGrid = {
258
- /** Column definitions (**stable reference required**). `columns[0]` is the name/tree column. / 列定義(参照安定必須)。 */
259
68
  columns: DirectoryTreeColumn[];
260
- /** Render the header row. Default true. / ヘッダ行表示。既定 true。 */
261
69
  showHeader?: boolean;
262
- /** Render the footer row. Default false. / フッタ行表示。既定 false。 */
263
70
  showFooter?: boolean;
264
- /** Extra class for the header row. / ヘッダ行の追加クラス。 */
265
71
  headerClassName?: string;
266
- /** Extra class for the footer row. / フッタ行の追加クラス。 */
267
72
  footerClassName?: string;
268
- /** Extra class (or per-entry factory) for body rows. / 行の追加クラス(またはエントリ別ファクトリ)。 */
269
73
  rowClassName?: string | ((entry: DirectoryEntry) => string);
270
- /**
271
- * Vertical scrollbar width, used to keep the header/footer numeric viewport aligned with
272
- * the body (whose width is reduced by the vertical scrollbar). Default 12.
273
- * 縦スクロールバー幅。ヘッダ/フッタの数値ビューポート幅を本体と一致させるために使用。既定 12。
274
- */
275
74
  scrollBarWidth?: number;
276
75
  };
277
- /**
278
- * Represents the state and actions for a directory tree.
279
- * ディレクトリツリーの状態とアクションを表します。
280
- */
281
76
  export type DirectoryTreeState = {
282
- /**
283
- * A set of strings representing the paths of the expanded directories.
284
- * 展開されているディレクトリのパスを表す文字列のセット。
285
- */
286
77
  expanded: Set<string>;
287
- /**
288
- * Toggles the expansion state of a directory.
289
- * ディレクトリの展開状態を切り替えます。
290
- * @param path - The path of the directory to toggle.
291
- */
292
78
  toggle: (path: string) => void;
293
- /**
294
- * Expands a directory.
295
- * ディレクトリを展開します。
296
- * @param path - The path of the directory to expand.
297
- */
298
79
  expand: (path: string) => void;
299
- /**
300
- * Collapses a directory.
301
- * ディレクトリを折りたたみます。
302
- * @param path - The path of the directory to collapse.
303
- */
304
80
  collapse: (path: string) => void;
305
- /**
306
- * Collapses multiple specified directories.
307
- * 指定された複数のディレクトリを折りたたみます。
308
- * @param paths - An array of directory paths to collapse.
309
- */
310
81
  collapseMultiple: (paths: string[]) => void;
311
- /**
312
- * Expands multiple specified directories.
313
- * 指定された複数のディレクトリを展開します。
314
- * @param paths - An array of directory paths to expand.
315
- */
316
82
  expandMultiple: (paths: string[]) => void;
317
- /**
318
- * Collapses all directories.
319
- * すべてのディレクトリを折りたたみます。
320
- */
321
83
  collapseAll: () => void;
322
- /**
323
- * Checks if a directory is expanded.
324
- * ディレクトリが展開されているかどうかを確認します。
325
- * @param path - The path of the directory to check.
326
- * @returns True if the directory is expanded, false otherwise.
327
- */
328
84
  isExpanded: (path: string) => boolean;
329
- /**
330
- * A boolean that is true if a transition is pending.
331
- * トランジションが保留中の場合に true となる真偽値。
332
- */
333
85
  isPending: boolean;
334
86
  };
335
- /**
336
- * @type DirectoryTreeProps
337
- * @description Props for the DirectoryTree component.
338
- * DirectoryTree コンポーネントの Props。
339
- */
340
87
  export type DirectoryTreeProps = {
341
- /**
342
- * The directory entries to display.
343
- * 表示するディレクトリエンティティの配列。
344
- */
345
88
  entries: DirectoryEntry[];
346
- /**
347
- * Configuration for tree expansion state and behavior.
348
- * ツリーの展開状態と動作の設定。
349
- */
350
89
  expansion: {
351
- /**
352
- * Function to toggle the expansion state of a directory.
353
- * ディレクトリの展開状態を切り替える関数。
354
- */
355
90
  toggle: (path: string) => void;
356
- /**
357
- * Function to check if a directory is expanded.
358
- * ディレクトリが展開されているか確認する関数。
359
- */
360
91
  isExpanded: (path: string) => boolean;
361
- /**
362
- * Function to expand multiple specified directories.
363
- * 指定された複数のディレクトリを展開する関数。
364
- */
365
92
  expandMultiple: (paths: string[]) => void;
366
- /**
367
- * Function to collapse all specified directories.
368
- * 指定されたすべてのディレクトリを折りたたむ関数。
369
- */
370
93
  collapseMultiple: (paths: string[]) => void;
371
- /**
372
- * Flag to indicate if the tree is in a pending state.
373
- * ツリーが保留状態かどうかを示すフラグ。
374
- */
375
94
  isPending?: boolean;
376
- /**
377
- * If true, all directories are always expanded.
378
- * true の場合、すべてのディレクトリが常に展開されます。
379
- */
380
95
  alwaysExpanded?: boolean;
381
- /**
382
- * The action to perform on double-clicking a directory.
383
- * ディレクトリをダブルクリックしたときのアクション。
384
- */
385
96
  doubleClickAction?: "toggle" | "recursive";
386
97
  };
387
- /**
388
- * Configuration for item selection.
389
- * アイテム選択の設定。
390
- */
391
98
  selection: {
392
- /**
393
- * Selection mode for items.
394
- * アイテムの選択モード。
395
- */
396
99
  mode?: "none" | "single" | "multiple";
397
- /**
398
- * The currently selected path.
399
- * 現在選択されているパス。
400
- */
401
100
  selectedPath?: string | null;
402
- /**
403
- * Set of paths for currently selected items.
404
- * 現在選択されているアイテムのパスのセット。
405
- */
406
101
  selectedItems?: Set<string>;
407
- /**
408
- * Callback when an entry (file or directory) is clicked.
409
- * エントリ(ファイルまたはディレクトリ)がクリックされたときのコールバック。
410
- *
411
- * For files: called immediately on click.
412
- * For directories: called immediately on click, then expand/collapse follows
413
- * unless preventDefault() is called on the event.
414
- *
415
- * ファイルの場合: クリック時に即座に呼ばれる。
416
- * ディレクトリの場合: クリック時に即座に呼ばれ、イベントで preventDefault() が
417
- * 呼ばれない限り展開/折りたたみが続行される。
418
- */
419
102
  onEntryClick: (event: DirectoryTreeClickEvent) => void;
420
- /**
421
- * Callback when item selection changes.
422
- * アイテム選択状態変更時のコールバック。
423
- */
424
103
  onSelectionChange?: (entry: DirectoryEntry, isSelected: boolean) => void;
425
104
  };
426
- /**
427
- * Visual customization options.
428
- * 表示のカスタマイズオプション。
429
- */
430
105
  visual?: {
431
- /**
432
- * Optional CSS class name for the container.
433
- * コンテナ用のオプション CSS クラス名。
434
- */
435
106
  className?: string;
436
- /**
437
- * Optional inline styles for the container.
438
- * コンテナ用のオプションのインラインスタイル。
439
- */
440
107
  style?: CSSProperties;
441
- /**
442
- * Accessible name for the tree as a whole (`aria-label` on the tree/treegrid element).
443
- * ツリー全体のアクセシブル名 (tree/treegrid 要素の `aria-label`)。
444
- *
445
- * 支援技術にとって、ページ内に複数のツリーがある場合これが唯一の識別手段になる。
446
- * 可視の見出しがある場合は `ariaLabelledBy` の方が望ましい。
447
- */
448
108
  ariaLabel?: string;
449
- /**
450
- * `id` of a visible element naming the tree (`aria-labelledby`). Takes precedence over `ariaLabel`.
451
- * ツリーを説明する可視要素の `id` (`aria-labelledby`)。`ariaLabel` より優先。
452
- */
453
109
  ariaLabelledBy?: string;
454
- /**
455
- * Line color for tree connections.
456
- * ツリーラインの色。
457
- */
458
110
  lineColor?: string;
459
- /**
460
- * Flag indicating whether to render tree connector lines.
461
- * ツリーのコネクタラインをレンダリングするかどうかのフラグ。
462
- */
463
111
  showTreeLines?: boolean;
464
- /**
465
- * Flag indicating whether to render directory expand icons.
466
- * ディレクトリの展開アイコンを描画するかどうかのフラグ。
467
- */
468
112
  showExpandIcons?: boolean;
469
- /**
470
- * Flag indicating whether to render directory type icons.
471
- * ディレクトリアイコンを描画するかどうかのフラグ。
472
- */
473
113
  showDirectoryIcons?: boolean;
474
- /**
475
- * Flag indicating whether to render file type icons.
476
- * ファイルアイコンを描画するかどうかのフラグ。
477
- */
478
114
  showFileIcons?: boolean;
479
- /**
480
- * Icon overrides applied globally.
481
- * グローバルに適用するアイコン差し替え設定。
482
- */
483
115
  iconOverrides?: DirectoryTreeIconOverrides;
484
- /**
485
- * Size of the expand icon in px.
486
- * 展開アイコンのサイズ (px)。
487
- */
488
116
  expandIconSize?: number;
489
- /**
490
- * Size of the file/directory type icon in px.
491
- * ファイル/ディレクトリアイコンのサイズ (px)。
492
- */
493
117
  typeIconSize?: number;
494
- /**
495
- * Font size of entry labels in px or CSS string (e.g. 12 or "0.75rem").
496
- * ラベル文字のフォントサイズ (px または CSS 文字列)。
497
- */
498
118
  fontSize?: number | string;
499
- /**
500
- * Indentation width per depth level in px.
501
- * 1 階層あたりのインデント幅 (px)。
502
- */
503
119
  indentSize?: number;
504
- /**
505
- * Row height in px, or a function computing the height per entry. Default 20 (or 18 in compact mode).
506
- * When a function is supplied, rows may have different heights and the tree
507
- * connector lines follow each row's cumulative offset.
508
- *
509
- * 各行の高さ (px)、またはエントリごとに高さを算出する関数。既定 20 (コンパクトモード時 18)。
510
- * 関数を渡すと行ごとに高さを変えられ、ツリー接続線は各行の累積オフセットに追従する。
511
- */
512
120
  itemHeight?: ItemHeight;
513
- /**
514
- * If true, removes the indentation and connector lines for root-level items.
515
- * true の場合、ルートレベルのアイテムのインデントとコネクタラインを削除します。
516
- */
517
121
  removeRootIndent?: boolean;
518
- /**
519
- * Highlight styles configuration for hover and selection states.
520
- * ホバー時および選択時のハイライトスタイルの設定。
521
- */
522
122
  highlightStyles?: HighlightStyles;
523
- /** CSS class name for each entry. / 各エントリ(行)に適用する追加の CSS クラス名。 */
524
123
  entryClassName?: string;
525
- /** Inline styles for each entry. / 各エントリ(行)に適用する追加のインラインスタイル。 */
526
124
  entryStyle?: CSSProperties;
527
- /** CSS class name for the name (label) part. / 名前(ラベル)部分に適用する追加の CSS クラス名。 */
528
125
  nameClassName?: string;
529
- /** Inline styles for the name (label) part. / 名前(ラベル)部分に適用する追加のインラインスタイル。 */
530
126
  nameStyle?: CSSProperties;
531
- /** CSS class name specifically for directory names. / ディレクトリ名特有の追加の CSS クラス名。 */
532
127
  directoryNameClassName?: string;
533
- /** Inline styles specifically for directory names. / ディレクトリ名特有の追加のインラインスタイル。 */
534
128
  directoryNameStyle?: CSSProperties;
535
- /** CSS class name specifically for file names. / ファイル名特有の追加の CSS クラス名。 */
536
129
  fileNameClassName?: string;
537
- /** Inline styles specifically for file names. / ファイル名特有の追加のインラインスタイル。 */
538
130
  fileNameStyle?: CSSProperties;
539
131
  };
540
- /**
541
- * Additional options for VirtualScroll integration.
542
- * VirtualScroll の設定を上書きするオプション。
543
- */
544
132
  virtualScroll?: DirectoryTreeVirtualScrollOptions;
545
- /**
546
- * TreeGrid (columns) mode. When provided, the name column is frozen on the left and the
547
- * remaining columns render as an aligned grid with header/footer and a horizontally
548
- * scrollable numeric region. When omitted, the classic label-based tree is rendered.
549
- *
550
- * TreeGrid(列)モード。指定時は名前列を凍結し数値列を整列グリッドで描画する。省略時は従来のツリー。
551
- *
552
- * `grid.columns` と各 `render` / `footer` は参照安定必須(`itemHeight` と同じ制約)。
553
- */
554
133
  grid?: DirectoryTreeGrid;
555
- /**
556
- * Optional comparator applied to every sibling group before the tree is flattened
557
- * into rows. Only a shallow copy of each sibling array is sorted, so every
558
- * `DirectoryEntry` object and every `children` array keeps its identity and
559
- * consumer-side memoization (row memo, reference-preserving decorators, hydration
560
- * caches) continues to work. Omit it to render the entries in their given order.
561
- *
562
- * 各兄弟グループへフラット化前に適用する任意の比較関数。並べ替えは兄弟配列の浅いコピーに
563
- * 対してのみ行うため、`DirectoryEntry` と `children` 配列の identity は保持され、利用側の
564
- * メモ化 (行メモ・参照保持デコレータ・ハイドレーションキャッシュ) はそのまま機能する。
565
- * 省略時は与えられた順序のまま描画。
566
- *
567
- * @remarks 参照を安定させること (`useMemo` / `useCallback`)。identity が毎レンダー変わると
568
- * ツリー走査が都度再計算され、パフォーマンスが劣化する (`itemHeight` と同じ制約)。
569
- */
570
134
  sort?: DirectoryEntryComparator;
571
135
  };
572
- /**
573
- * Props for the useDirectoryTreeState hook.
574
- * useDirectoryTreeState フックのプロパティ。
575
- */
576
136
  export type UseDirectoryTreeStateProps = {
577
- /**
578
- * An optional set of initially expanded directory paths.
579
- * 初期状態で展開されているディレクトリパスのオプションのセット。
580
- */
581
137
  initialExpanded?: Set<string>;
582
- /**
583
- * An optional key to store the expanded state in localStorage.
584
- * 展開状態を localStorage に保存するためのオプションのキー。
585
- */
586
138
  storageKey?: string;
587
139
  };
588
- /**
589
- * @type DirectoryEntryItemProps
590
- * @description Props for the DirectoryEntryItem component.
591
- * DirectoryEntryItem コンポーネントの Props。
592
- */
593
140
  export type DirectoryEntryItemProps = {
594
141
  entry: DirectoryEntry;
595
142
  indentLevel: number;
596
- /**
597
- * Logical depth from the roots, 0-based, independent of the visual indent.
598
- * ルートからの論理的な深さ (0 始まり)。視覚的インデントとは独立。
599
- *
600
- * `visual.removeRootIndent` は `indentLevel` を負方向へずらすため、`aria-level` の算出には
601
- * こちらを用いる (支援技術へ伝えるのは見た目のずれではなく実際の階層)。
602
- */
603
143
  depth: number;
604
- /** True when this row is part of the item-selection set (`aria-selected`). / 選択集合に含まれるか。 */
605
144
  isSelectedForAria: boolean;
606
- /** Index of this row in the flattened (visible) list. / フラット化後 (可視) リスト内の位置。 */
607
145
  flatIndex: number;
608
- /** True when this row is the single tab stop of the tree (roving tabindex). / ツリー内で唯一のタブ停止点か。 */
609
146
  isActive: boolean;
610
- /** Registers the row element so the tree can move focus to it. / フォーカス移動のために行要素を登録する。 */
611
147
  registerRowRef: (index: number, node: HTMLDivElement | null) => void;
612
- /** Handles tree-level navigation keys. / ツリー全体のナビゲーションキーを処理する。 */
613
- onNavigationKeyDown: (event: import('react').KeyboardEvent<HTMLDivElement>, index: number) => void;
614
- /** 1-based position among its siblings (`aria-posinset`). / 兄弟内の位置 (1 始まり)。 */
148
+ onNavigationKeyDown: (event: import("react").KeyboardEvent<HTMLDivElement>, index: number) => void;
615
149
  positionInSet: number;
616
- /** Number of siblings in the same group (`aria-setsize`). / 同一グループの兄弟数。 */
617
150
  setSize: number;
618
- /** Resolved height of this row in px. / この行の解決済み高さ (px)。 */
619
151
  rowHeight: number;
620
152
  isDirOpen: (path: string) => boolean;
621
153
  expansion: {
@@ -653,11 +185,6 @@ export type DirectoryEntryItemProps = {
653
185
  parentIsLast: boolean[];
654
186
  renderChildren?: boolean;
655
187
  };
656
- /**
657
- * Information for a single item in the tree line.
658
- *
659
- * ツリーラインの単一アイテムの情報。
660
- */
661
188
  export type TreeLineItemInfo = {
662
189
  id: string;
663
190
  absolutePath: string;
@@ -670,11 +197,6 @@ export type TreeLineItemInfo = {
670
197
  isExpanded: boolean;
671
198
  hideLines?: boolean;
672
199
  };
673
- /**
674
- * Segment data for TreeLine rendering.
675
- *
676
- * TreeLine 描画用のセグメントデータ。
677
- */
678
200
  export type TreeLineSegment = {
679
201
  key: string;
680
202
  x1: number;
@@ -683,11 +205,6 @@ export type TreeLineSegment = {
683
205
  y2: number;
684
206
  itemIndex: number;
685
207
  };
686
- /**
687
- * Glyph data for expand icons rendered on the tree line canvas.
688
- *
689
- * ツリーラインキャンバスに描画する展開アイコンのグリフ情報。
690
- */
691
208
  export type TreeLineGlyph = {
692
209
  key: string;
693
210
  itemIndex: number;
@@ -696,20 +213,10 @@ export type TreeLineGlyph = {
696
213
  size: number;
697
214
  isExpanded: boolean;
698
215
  };
699
- /**
700
- * Geometric data for tree line rendering.
701
- *
702
- * ツリーライン描画用のジオメトリデータ。
703
- */
704
216
  export type TreeLineGeometry = {
705
217
  segmentsByItem: TreeLineSegment[][];
706
218
  glyphsByItem: TreeLineGlyph[][];
707
219
  };
708
- /**
709
- * Props for the TreeLine component.
710
- *
711
- * TreeLine コンポーネントの Props。
712
- */
713
220
  export type TreeLineProps = {
714
221
  segmentsByItem: TreeLineSegment[][];
715
222
  glyphsByItem: TreeLineGlyph[][];
@@ -727,4 +234,3 @@ export type TreeLineProps = {
727
234
  expandGlyphSize?: number;
728
235
  };
729
236
  export {};
730
- //# sourceMappingURL=types.d.ts.map