@aiquants/resize-panels 2.0.0 → 2.0.1

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 (64) hide show
  1. package/dist/GlobalDebugOverlay.d.ts +4 -0
  2. package/dist/Panel.d.ts +13 -0
  3. package/dist/{src/PanelDebugInfo.d.ts → PanelDebugInfo.d.ts} +2 -14
  4. package/dist/PanelGroup.d.ts +2 -0
  5. package/dist/PanelResizeHandle.d.ts +2 -0
  6. package/dist/allocateLayout.d.ts +12 -0
  7. package/dist/context.d.ts +3 -0
  8. package/dist/debugOverlayStore.d.ts +32 -0
  9. package/dist/{src/hooks.d.ts → hooks.d.ts} +8 -23
  10. package/dist/index.d.ts +13 -2
  11. package/dist/reducer.d.ts +8 -0
  12. package/dist/roundHalfToEven.d.ts +1 -0
  13. package/dist/types.d.ts +183 -0
  14. package/dist/utils/simple-logger.d.ts +37 -0
  15. package/dist/utils.d.ts +16 -0
  16. package/package.json +2 -3
  17. package/dist/src/GlobalDebugOverlay.d.ts +0 -21
  18. package/dist/src/GlobalDebugOverlay.d.ts.map +0 -1
  19. package/dist/src/Panel.d.ts +0 -46
  20. package/dist/src/Panel.d.ts.map +0 -1
  21. package/dist/src/PanelDebugInfo.d.ts.map +0 -1
  22. package/dist/src/PanelGroup.d.ts +0 -7
  23. package/dist/src/PanelGroup.d.ts.map +0 -1
  24. package/dist/src/PanelResizeHandle.d.ts +0 -7
  25. package/dist/src/PanelResizeHandle.d.ts.map +0 -1
  26. package/dist/src/allocateLayout.d.ts +0 -60
  27. package/dist/src/allocateLayout.d.ts.map +0 -1
  28. package/dist/src/context.d.ts +0 -12
  29. package/dist/src/context.d.ts.map +0 -1
  30. package/dist/src/debugOverlayStore.d.ts +0 -69
  31. package/dist/src/debugOverlayStore.d.ts.map +0 -1
  32. package/dist/src/hooks.d.ts.map +0 -1
  33. package/dist/src/index.d.ts +0 -32
  34. package/dist/src/index.d.ts.map +0 -1
  35. package/dist/src/reducer.d.ts +0 -49
  36. package/dist/src/reducer.d.ts.map +0 -1
  37. package/dist/src/roundHalfToEven.d.ts +0 -10
  38. package/dist/src/roundHalfToEven.d.ts.map +0 -1
  39. package/dist/src/types.d.ts +0 -481
  40. package/dist/src/types.d.ts.map +0 -1
  41. package/dist/src/utils/simple-logger.d.ts +0 -111
  42. package/dist/src/utils/simple-logger.d.ts.map +0 -1
  43. package/dist/src/utils.d.ts +0 -164
  44. package/dist/src/utils.d.ts.map +0 -1
  45. package/dist/tests/support/dom-harness.d.ts +0 -89
  46. package/dist/tests/support/dom-harness.d.ts.map +0 -1
  47. package/src/GlobalDebugOverlay.tsx +0 -284
  48. package/src/Panel.tsx +0 -297
  49. package/src/PanelDebugInfo.tsx +0 -94
  50. package/src/PanelGroup.tsx +0 -245
  51. package/src/PanelResizeHandle.tsx +0 -758
  52. package/src/allocateLayout.ts +0 -412
  53. package/src/context.ts +0 -25
  54. package/src/debugOverlayStore.ts +0 -355
  55. package/src/hooks.ts +0 -376
  56. package/src/index.ts +0 -93
  57. package/src/reducer.ts +0 -472
  58. package/src/roundHalfToEven.ts +0 -40
  59. package/src/styles/components.entry.css +0 -10
  60. package/src/styles/resize-panels.css +0 -1
  61. package/src/styles/standalone.entry.css +0 -12
  62. package/src/types.ts +0 -505
  63. package/src/utils/simple-logger.ts +0 -186
  64. package/src/utils.ts +0 -320
package/src/types.ts DELETED
@@ -1,505 +0,0 @@
1
- /**
2
- * @file Type definitions for the resizable panels components
3
- * リサイザブルパネルコンポーネントの型定義
4
- */
5
-
6
- import type { CSSProperties, HTMLAttributes, ReactNode } from "react"
7
-
8
- /**
9
- * Pixel threshold under which a panel is treated as visually closed.
10
- * パネルが見た目上閉じていると扱われるピクセル閾値。
11
- */
12
- export const PANEL_SNAP_THRESHOLD = 12
13
-
14
- /**
15
- * Numeric tolerance for layout arithmetic, in pixels.
16
- * レイアウト演算の許容誤差 (px)。
17
- *
18
- * Sizes are IEEE-754 doubles produced by divisions, so exact comparisons would freeze drags on a 1 ulp
19
- * difference. Everything below this tolerance is treated as equality.
20
- * サイズは除算由来の倍精度値であり、厳密比較では 1 ulp の差でドラッグが凍結する。この許容値未満は同値とみなす。
21
- */
22
- export const PANEL_ALLOCATION_EPSILON = 1e-6
23
-
24
- /**
25
- * Default thickness in pixels for the resize handle interactive area.
26
- * リサイズハンドルのインタラクティブ領域のデフォルト厚み (px)。
27
- */
28
- export const PANEL_HANDLE_THICKNESS = 8
29
-
30
- /**
31
- * Default thickness in pixels for the visual indicator wrapper.
32
- * 視覚インジケーター外枠のデフォルト厚み (px)。
33
- */
34
- export const PANEL_INDICATOR_THICKNESS = 6
35
-
36
- /**
37
- * Default length in pixels for the visual indicator wrapper in horizontal layout.
38
- * 水平レイアウトにおける視覚インジケーター外枠のデフォルト長さ (px)。
39
- */
40
- export const PANEL_INDICATOR_LENGTH_HORIZONTAL = 48
41
-
42
- /**
43
- * Default length in pixels for the visual indicator wrapper in vertical layout.
44
- * 垂直レイアウトにおける視覚インジケーター外枠のデフォルト長さ (px)。
45
- */
46
- export const PANEL_INDICATOR_LENGTH_VERTICAL = 80
47
-
48
- /**
49
- * Default thickness in pixels for the inner bar inside the visual indicator.
50
- * 視覚インジケーター内部バーのデフォルト厚み (px)。
51
- */
52
- export const PANEL_INDICATOR_BAR_THICKNESS = 2
53
-
54
- /**
55
- * Default length in pixels for the inner bar inside the visual indicator in horizontal layout.
56
- * 水平レイアウトにおける視覚インジケーター内部バーのデフォルト長さ (px)。
57
- */
58
- export const PANEL_INDICATOR_BAR_LENGTH_HORIZONTAL = 32
59
-
60
- /**
61
- * Default length in pixels for the inner bar inside the visual indicator in vertical layout.
62
- * 垂直レイアウトにおける視覚インジケーター内部バーのデフォルト長さ (px)。
63
- */
64
- export const PANEL_INDICATOR_BAR_LENGTH_VERTICAL = 64
65
-
66
- /**
67
- * Spacing in pixels between visual indicators of handles that share a boundary.
68
- * 境界を共有するハンドルの視覚インジケーター同士のピクセル間隔。
69
- */
70
- export const PANEL_VISIBLE_INDICATOR_SPACING = 8
71
-
72
- /**
73
- * Pointer move throttling interval in milliseconds during dragging.
74
- * ドラッグ中のポインタ移動を間引くミリ秒単位の間隔。
75
- */
76
- export const PANEL_HANDLE_DRAG_THROTTLE_MS = 8
77
-
78
- /**
79
- * Pixel step applied per arrow-key press when resizing with the keyboard.
80
- * キーボード (矢印キー) リサイズで 1 押下ごとに適用するピクセル量。
81
- */
82
- export const PANEL_KEYBOARD_RESIZE_STEP = 10
83
-
84
- /**
85
- * Ratio of container size used when determining collapse thresholds.
86
- * 折りたたみ閾値を決定する際に使用するコンテナサイズ比率。
87
- */
88
- export const PANEL_COLLAPSE_THRESHOLD_RATIO = 0.05
89
-
90
- /**
91
- * Maximum pixel value considered when collapsing panels.
92
- * パネルを折りたたむ際に考慮するピクセル上限値。
93
- */
94
- export const PANEL_COLLAPSE_THRESHOLD_MAX = 10
95
-
96
- /**
97
- * Ratio of container size required to expand a collapsed panel.
98
- * 折りたたまれたパネルを展開するために必要なコンテナサイズ比率。
99
- */
100
- export const PANEL_EXPAND_THRESHOLD_RATIO = 0.05
101
-
102
- /**
103
- * Maximum pixel threshold used when expanding panels.
104
- * パネルを展開する際に用いるピクセル閾値の上限。
105
- */
106
- export const PANEL_EXPAND_THRESHOLD_MAX = 20
107
-
108
- /**
109
- * Minimum thickness required for a handle to be treated as visible.
110
- * ハンドルが可視と判断されるために必要な最小厚み。
111
- */
112
- export const PANEL_HANDLE_VISIBILITY_THRESHOLD = 0.05
113
-
114
- /**
115
- * Layout direction of panels
116
- * パネルのレイアウト方向
117
- */
118
- export type PanelDirection = "horizontal" | "vertical"
119
-
120
- /**
121
- * Size unit types for panels
122
- * パネルのサイズ単位タイプ
123
- */
124
- export type SizeUnit = "percentage" | "pixels"
125
-
126
- /**
127
- * Size configuration with value and unit
128
- * 値と単位を持つサイズ設定
129
- */
130
- export type SizeConfig = {
131
- value: number
132
- unit: SizeUnit
133
- }
134
-
135
- /**
136
- * Flexible size that can be defined in pixels or as a percentage
137
- * ピクセルまたはパーセンテージで定義できる柔軟なサイズ
138
- */
139
- export type FlexibleSize = SizeConfig | number
140
-
141
- /**
142
- * Container size dimensions
143
- * コンテナサイズの寸法
144
- */
145
- export type ContainerSize = {
146
- width: number
147
- height: number
148
- }
149
-
150
- /**
151
- * Direction from which collapsible panels may close.
152
- * パネルを折りたためる方向を表す列挙値。
153
- */
154
- export type PanelCollapseDirection = "start" | "end"
155
-
156
- /**
157
- * Directional options accepted by the collapsible configuration.
158
- * 折りたたみ設定が受け付ける方向指定値。
159
- */
160
- export type CollapsibleDirection = PanelCollapseDirection | "both"
161
-
162
- /**
163
- * Configuration object describing how a panel collapses.
164
- * パネルの折りたたみ方を表す設定オブジェクト。
165
- */
166
- export type CollapsibleConfig = {
167
- from: CollapsibleDirection
168
- }
169
-
170
- /**
171
- * Axis-aligned container measurement.
172
- * 軸方向のコンテナ計測値。
173
- *
174
- * `content` is what every layout number is relative to: percentage sizes resolve against it and the
175
- * allocator fills exactly this length. `border` is the same box plus padding and borders, used only when a
176
- * caller needs the element's outer footprint.
177
- * すべてのレイアウト数値の基準は `content`: パーセンテージ指定はこの長さに解決され、配分器はこの長さを満たす。
178
- * `border` は同じ軸のパディング・枠線を含む外形で、要素の外寸が必要な場合にのみ使う。
179
- */
180
- export type ContainerAxisMeasurement = {
181
- content: number
182
- border: number
183
- }
184
-
185
- /**
186
- * Reason code for layout constraint violations.
187
- * レイアウト制約違反の理由コード。
188
- */
189
- export type LayoutConstraintViolationReason = "minimum-exceeded" | "maximum-insufficient"
190
-
191
- /**
192
- * Snapshot describing when panel constraints conflict with the container size.
193
- * パネル制約とコンテナサイズが矛盾した際のスナップショット。
194
- */
195
- export type LayoutConstraintViolation = {
196
- reason: LayoutConstraintViolationReason
197
- totalMinimumSize: number
198
- totalMaximumSize: number
199
- availableContainerSize: number
200
- }
201
-
202
- /**
203
- * Canonical layout state of a single panel.
204
- * 単一パネルの正準レイアウト状態。
205
- *
206
- * The state separates three roles and never stores the same quantity twice: configuration comes from the
207
- * component's props, the preference is what the user asked for (a share of the container for flexible
208
- * panels, an absolute length for pixel panels), and `size` is the allocator's answer for the current
209
- * container. Everything else — the rendered flex basis, the handle position, the percentage shown in the
210
- * debug overlay — is derived from those.
211
- * 状態は 3 つの役割に分かれ、同じ量を二重に持たない: 構成はコンポーネントの props 由来、希望値は利用者の要求
212
- * (柔軟パネルはコンテナ比、ピクセルパネルは絶対長)、`size` は現在のコンテナに対する配分器の答え。描画される
213
- * flex basis・ハンドル位置・デバッグ表示の割合は、すべてここから導出される。
214
- */
215
- export interface PanelLayoutData {
216
- id: string
217
- /** Which preference field drives this panel. どちらの希望値でサイズが決まるか。 */
218
- sizeUnit: SizeUnit
219
- /** Allocated length in pixels for the current container. 現在のコンテナに対する配分結果 (px)。 */
220
- size: number
221
- /**
222
- * Ratio weight of a flexible panel, expressed as a share of the container in percent.
223
- * 柔軟パネルの重み (コンテナ比 %)。
224
- *
225
- * Only the ratio between panels matters — unless the panel declares `flexAdjustPriority`, which turns the
226
- * same number into an absolute claim on that share of the container.
227
- * 意味を持つのはパネル間の比だけ。ただし `flexAdjustPriority` を宣言したパネルでは、同じ数値が
228
- * 「コンテナのその割合」という絶対的な要求になる。
229
- */
230
- preferredPercentageSize: number
231
- /** Requested absolute length of a pixel panel. ピクセルパネルの希望絶対長 (px)。 */
232
- preferredPixelSize: number
233
- minSize?: FlexibleSize
234
- maxSize?: FlexibleSize
235
- collapseFromStart: boolean
236
- collapseFromEnd: boolean
237
- collapsed: boolean
238
- collapsedByDirection: PanelCollapseDirection | null
239
- /**
240
- * Preference captured when the panel collapsed, restored verbatim on expand.
241
- * 折りたたみ時に退避し、展開時にそのまま復元する希望値。
242
- */
243
- preferenceBeforeCollapse: number
244
- /**
245
- * Preference the component last authored through its props, used to tell a prop change from a re-registration.
246
- * コンポーネントが props で最後に宣言した希望値。prop 変更と単なる再登録を区別するために保持。
247
- */
248
- authoredPreference: number
249
- /** Serving order among pixel panels, higher first. ピクセルパネル間の充当順位 (大きいほど先)。 */
250
- pixelAdjustPriority?: number
251
- /**
252
- * Serving order among flexible panels, higher first; absent means pure ratio sharing.
253
- * 柔軟パネル間の充当順位 (大きいほど先)。未指定なら純粋な比例配分。
254
- *
255
- * Declaring it changes how `preferredPercentageSize` is read: the panel claims that share of the container
256
- * before the ratio panels divide what is left.
257
- * 宣言すると `preferredPercentageSize` の読み方が変わり、比例配分のパネルが残りを分ける前に
258
- * コンテナのその割合を確保する。
259
- */
260
- flexAdjustPriority?: number
261
- }
262
-
263
- /**
264
- * Layout state of one panel group: the container it was measured against, its panels in DOM order, and
265
- * whether the panels' constraints can be satisfied at that size.
266
- * パネルグループのレイアウト状態: 計測対象のコンテナ長・DOM 順のパネル一覧・制約充足可否。
267
- */
268
- export interface PanelGroupLayoutState {
269
- /** Content-box length of the group along its axis; 0 until the first measurement. 軸方向の内容領域長 (未計測は 0)。 */
270
- containerSize: number
271
- panels: PanelLayoutData[]
272
- violation: LayoutConstraintViolation | null
273
- }
274
-
275
- /**
276
- * Configuration and preference a panel publishes when it registers with its group.
277
- * パネルがグループへ登録する際に公開する構成と希望値。
278
- */
279
- export type PanelRegistration = Omit<PanelLayoutData, "size" | "collapsedByDirection" | "preferenceBeforeCollapse" | "authoredPreference">
280
-
281
- /**
282
- * One panel's persisted length, kept with its identifier so a stored layout can never be applied to a
283
- * different set of panels.
284
- * 保存されたパネル 1 枚分の長さ。別構成のパネルへ誤って適用されないよう識別子を伴う。
285
- */
286
- export type PersistedPanelSize = {
287
- id: string
288
- size: number
289
- /** Whether the panel was collapsed when the layout was written. 保存時に折りたたまれていたか。 */
290
- collapsed: boolean
291
- }
292
-
293
- /**
294
- * Actions accepted by the panel group reducer.
295
- * パネルグループのリデューサーが受け付けるアクション。
296
- */
297
- export type PanelAction =
298
- | { type: "SET_CONTAINER_SIZE"; containerSize: number }
299
- | { type: "REGISTER_PANEL"; panel: PanelRegistration }
300
- | { type: "UNREGISTER_PANEL"; id: string }
301
- | { type: "REORDER_PANELS"; ids: string[] }
302
- | { type: "RESIZE_PANELS"; startId: string; endId: string; startSize: number }
303
- | { type: "COLLAPSE_PANEL"; id: string; from: PanelCollapseDirection }
304
- | { type: "EXPAND_PANEL"; id: string; from: PanelCollapseDirection; targetSize?: number }
305
- | { type: "RESTORE_LAYOUT"; entries: PersistedPanelSize[] }
306
-
307
- /**
308
- * Props for the Panel component
309
- * Panel コンポーネントのプロパティ
310
- */
311
- // aria-hidden は折りたたみ状態から決まるため、利用者の指定は黙って捨てられる
312
- export interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style" | "aria-hidden"> {
313
- id?: string
314
- /**
315
- * Initial size. A percentage (or bare number) makes the panel flexible, pixels make it fixed.
316
- * 初期サイズ。パーセンテージ (数値のみの指定を含む) なら柔軟パネル、ピクセルなら固定パネル。
317
- * @default { value: 50, unit: "percentage" }
318
- */
319
- defaultSize?: FlexibleSize
320
- minSize?: FlexibleSize
321
- maxSize?: FlexibleSize
322
- className?: string
323
- style?: CSSProperties
324
- children?: ReactNode
325
- collapsible?: CollapsibleConfig
326
- defaultCollapsed?: boolean
327
- pixelAdjustPriority?: number
328
- flexAdjustPriority?: number
329
- contentOverflow?: CSSProperties["overflow"]
330
- }
331
-
332
- /**
333
- * Props for the PanelGroup component
334
- * PanelGroup コンポーネントのプロパティ
335
- */
336
- export interface PanelGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style"> {
337
- id?: string
338
- direction: PanelDirection
339
- className?: string
340
- style?: CSSProperties
341
- children?: ReactNode
342
- showDebugInfo?: boolean
343
- onLayout?: (panelSizes: number[]) => void
344
- autoSaveId?: string
345
- }
346
-
347
- /**
348
- * Value provided by the PanelGroupContext
349
- * PanelGroupContext によって提供される値
350
- */
351
- export interface PanelGroupContextValue {
352
- direction: PanelDirection
353
- registerPanel: (panel: PanelRegistration) => void
354
- unregisterPanel: (id: string) => void
355
- getPanel: (id: string) => PanelLayoutData | undefined
356
- panels: PanelLayoutData[]
357
- /** Content-box length of the group along its axis. グループ軸方向の内容領域長。 */
358
- containerSize: number
359
- /**
360
- * Key that changes whenever the document order of the group's panels and handle anchors changes.
361
- * グループのパネルとハンドルのアンカーの文書順が変わるたびに変化する鍵。
362
- *
363
- * A handle that moves to another boundary leaves the panel id sequence untouched, so the panels alone
364
- * cannot tell a handle that its neighbours changed.
365
- * ハンドルが別の境界へ移ってもパネルの id 列は変わらないため、パネルだけではハンドルへ隣の変化を伝えられない。
366
- */
367
- layoutOrderKey: string
368
- showDebugInfo: boolean
369
- resizePanels: (startId: string, endId: string, startSize: number) => void
370
- collapsePanel: (id: string, from: PanelCollapseDirection) => void
371
- expandPanel: (id: string, from: PanelCollapseDirection, targetSize?: number) => void
372
- reportPanelMeasurement: (id: string, measurement: PanelMeasurement | null) => void
373
- panelMeasurements: Record<string, PanelMeasurement>
374
- reportHandleMeasurement: (id: string, measurement: ResizeHandleLayoutData | null) => void
375
- handleMeasurements: Record<string, ResizeHandleLayoutData>
376
- layoutConstraintViolation: LayoutConstraintViolation | null
377
- }
378
-
379
- /**
380
- * Visual indicator configuration options for PanelResizeHandle.
381
- * PanelResizeHandle の視覚インジケーターに関する設定オプション。
382
- */
383
- export interface PanelResizeHandleIndicatorConfig {
384
- /**
385
- * Primary axis thickness of the indicator pill in pixels.
386
- * (Horizontal: width, Vertical: height)
387
- * インジケーター外枠の主軸方向の厚み (px)。(水平: 幅, 垂直: 高さ)
388
- * @default 6
389
- */
390
- thickness?: number
391
- /**
392
- * Cross axis length of the indicator pill in pixels.
393
- * (Horizontal: height, Vertical: width)
394
- * インジケーター外枠の交差軸方向の長さ (px)。(水平: 高さ, 垂直: 幅)
395
- * @default horizontal ? 48 : 80
396
- */
397
- length?: number
398
- /**
399
- * Primary axis thickness of the inner bar in pixels.
400
- * インジケーター内部バーの主軸方向の厚み (px)。
401
- * @default 2
402
- */
403
- barThickness?: number
404
- /**
405
- * Cross axis length of the inner bar in pixels.
406
- * インジケーター内部バーの交差軸方向の長さ (px)。
407
- * @default horizontal ? 32 : 64
408
- */
409
- barLength?: number
410
- /**
411
- * Whether the indicator is visible.
412
- * インジケーターを表示するかどうかの指定。
413
- * @default true
414
- */
415
- visible?: boolean
416
- /**
417
- * Additional CSS class name for the indicator wrapper.
418
- * インジケーター外枠に付与する追加 CSS クラス名。
419
- */
420
- className?: string
421
- /**
422
- * Additional CSS class name for the inner bar.
423
- * インジケーター内部バーに付与する追加 CSS クラス名。
424
- */
425
- barClassName?: string
426
- }
427
-
428
- /**
429
- * Props for the PanelResizeHandle component
430
- * PanelResizeHandle コンポーネントのプロパティ
431
- */
432
- /**
433
- * ARIA attributes the handle computes from the layout; a consumer value would be silently discarded.
434
- * ハンドルがレイアウトから算出する ARIA 属性 (利用者の指定は黙って捨てられるため受け付けない)。
435
- */
436
- type OwnedSeparatorAria = "role" | "aria-orientation" | "aria-valuenow" | "aria-valuemin" | "aria-valuemax" | "aria-disabled" | "aria-hidden"
437
-
438
- export interface PanelResizeHandleProps extends Omit<HTMLAttributes<HTMLButtonElement>, "id" | "children" | "className" | "style" | "title" | OwnedSeparatorAria> {
439
- id?: string
440
- disabled?: boolean
441
- onDragging?: (isDragging: boolean) => void
442
- className?: string
443
- style?: CSSProperties
444
- children?: ReactNode
445
- /**
446
- * Primary axis thickness of the handle's interactive area in pixels.
447
- * (Horizontal: width, Vertical: height)
448
- * リサイズハンドルの操作領域 (ヒットエリア) の厚み (px)。(水平: 幅, 垂直: 高さ)
449
- * @default PANEL_HANDLE_THICKNESS (8)
450
- */
451
- thickness?: number
452
- /**
453
- * Configuration for the visual indicator, or boolean to toggle visibility.
454
- * 視覚インジケーターの設定オブジェクト、または表示/非表示の真偽値。
455
- * @default true
456
- */
457
- indicator?: boolean | PanelResizeHandleIndicatorConfig
458
- /**
459
- * Shorthand for indicator wrapper thickness in pixels.
460
- * インジケーター外枠厚み (px) のショートハンド。
461
- */
462
- indicatorThickness?: number
463
- /**
464
- * Shorthand for indicator wrapper length in pixels.
465
- * インジケーター外枠長さ (px) のショートハンド。
466
- */
467
- indicatorLength?: number
468
- /**
469
- * Shorthand for indicator inner bar thickness in pixels.
470
- * インジケーター内部バー厚み (px) のショートハンド。
471
- */
472
- indicatorBarThickness?: number
473
- /**
474
- * Shorthand for indicator inner bar length in pixels.
475
- * インジケーター内部バー長さ (px) のショートハンド。
476
- */
477
- indicatorBarLength?: number
478
- /**
479
- * Custom tooltip text for the handle element.
480
- * ハンドル要素のカスタムツールチップテキスト。
481
- */
482
- title?: string
483
- }
484
-
485
- /**
486
- * Observed pixel and percentage measurements for a registered panel.
487
- * 登録済みパネルの実測ピクセル寸法およびパーセンテージ寸法。
488
- */
489
- export interface PanelMeasurement {
490
- pixelSize: number
491
- percentageSize: number
492
- }
493
-
494
- /**
495
- * Layout data for a resize handle (divider) within a panel group.
496
- * パネルグループ内のリサイズハンドル(ディバイダー)に関するレイアウトデータ。
497
- */
498
- export interface ResizeHandleLayoutData {
499
- id: string
500
- thickness: number
501
- direction: PanelDirection
502
- visible: boolean
503
- startPanelId: string | null
504
- endPanelId: string | null
505
- }
@@ -1,186 +0,0 @@
1
- /**
2
- * @module utils/logger
3
- * @description Logger utility for consistent log management across the application.
4
- * @description アプリケーション全体で一貫したログ管理を行うためのロガーユーティリティ。
5
- */
6
-
7
- /**
8
- * @enum LogLevel
9
- * @description Log levels for filtering output.
10
- * @description 出力をフィルタリングするためのログレベル。
11
- */
12
- export enum LogLevel {
13
- DEBUG = 0,
14
- INFO = 1,
15
- WARN = 2,
16
- ERROR = 3,
17
- NONE = 4,
18
- }
19
-
20
- /**
21
- * @interface ILogger
22
- * @description Interface for a logger object compatible with Console.
23
- * @description Console と互換性のあるロガーオブジェクトのインターフェース。
24
- */
25
- export interface ILogger {
26
- debug(message?: unknown, ...optionalParams: unknown[]): void
27
- info(message?: unknown, ...optionalParams: unknown[]): void
28
- warn(message?: unknown, ...optionalParams: unknown[]): void
29
- error(message?: unknown, ...optionalParams: unknown[]): void
30
- }
31
-
32
- /**
33
- * @class Logger
34
- * @description A wrapper class for handling logging with levels and prefixes.
35
- * @description レベルとプレフィックスを使用したログ記録を処理するためのラッパークラス。
36
- */
37
- export class Logger implements ILogger {
38
- private level: LogLevel
39
- private prefix: string
40
- private impl: ILogger
41
-
42
- /**
43
- * Registry of all constructed loggers so the static configuration API can reach them.
44
- * static 設定 API が全ロガーへ到達できるようにするための生成済みインスタンスの登録簿。
45
- */
46
- private static readonly instances = new Set<Logger>()
47
-
48
- /**
49
- * @constructor
50
- * @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
51
- * @param {string} [prefix="[resize-panels]"] - The prefix to add to all log messages.
52
- * @param {ILogger} [impl=console] - The implementation to use for logging.
53
- */
54
- constructor(level: LogLevel = LogLevel.WARN, prefix: string = "[resize-panels]", impl: ILogger = console) {
55
- this.level = level
56
- this.prefix = prefix
57
- this.impl = impl
58
- Logger.instances.add(this)
59
- }
60
-
61
- private static instance: Logger = new Logger(LogLevel.WARN, "[resize-panels]")
62
-
63
- /**
64
- * @method setLevel
65
- * @description Updates the log level for every constructed logger (module-level loggers included).
66
- * @description 生成済みのすべてのロガー (モジュールレベルのロガーを含む) のログレベルを更新します。
67
- * @param {LogLevel} level - The new log level.
68
- */
69
- static setLevel(level: LogLevel): void {
70
- for (const instance of Logger.instances) {
71
- instance.setLevel(level)
72
- }
73
- }
74
-
75
- /**
76
- * @method setLevel
77
- * @description Updates the current log level.
78
- * @description 現在のログレベルを更新します。
79
- * @param {LogLevel} level - The new log level.
80
- */
81
- setLevel(level: LogLevel): void {
82
- this.level = level
83
- }
84
-
85
- /**
86
- * @method setImplementation
87
- * @description Updates the logger implementation for every constructed logger.
88
- * @description 生成済みのすべてのロガーの実装を更新します。
89
- * @param {ILogger} impl - The new logger implementation.
90
- */
91
- static setImplementation(impl: ILogger): void {
92
- for (const instance of Logger.instances) {
93
- instance.setImplementation(impl)
94
- }
95
- }
96
-
97
- /**
98
- * @method setImplementation
99
- * @description Updates the logger implementation.
100
- * @description ロガーの実装を更新します。
101
- * @param {ILogger} impl - The new logger implementation.
102
- */
103
- setImplementation(impl: ILogger): void {
104
- this.impl = impl
105
- }
106
-
107
- /**
108
- * @method setPrefix
109
- * @description Updates the log prefix for every constructed logger.
110
- * @description 生成済みのすべてのロガーのログのプレフィックスを更新します。
111
- * @param {string} prefix - The new prefix.
112
- */
113
- static setPrefix(prefix: string): void {
114
- for (const instance of Logger.instances) {
115
- instance.setPrefix(prefix)
116
- }
117
- }
118
-
119
- /**
120
- * @method setPrefix
121
- * @description Updates the log prefix.
122
- * @description ログのプレフィックスを更新します。
123
- * @param {string} prefix - The new prefix.
124
- */
125
- setPrefix(prefix: string): void {
126
- this.prefix = prefix
127
- }
128
-
129
- /**
130
- * @method enabledFor
131
- * @description Returns whether messages at the given level would be emitted.
132
- * @description 指定レベルのメッセージが出力対象かどうかを返します。
133
- * 高コストなログ引数 (スナップショット等) の組み立てを抑制中に省略するために使用します。
134
- * @param {LogLevel} level - The message level to test.
135
- */
136
- enabledFor(level: LogLevel): boolean {
137
- return this.level <= level
138
- }
139
-
140
- private formatMessage(message: unknown): unknown[] {
141
- if (typeof message === "string") {
142
- return [`${this.prefix} ${message}`]
143
- }
144
- return [this.prefix, message]
145
- }
146
-
147
- static debug(message?: unknown, ...optionalParams: unknown[]): void {
148
- Logger.instance.debug(message, ...optionalParams)
149
- }
150
-
151
- debug(message?: unknown, ...optionalParams: unknown[]): void {
152
- if (this.level <= LogLevel.DEBUG) {
153
- this.impl.debug(...this.formatMessage(message), ...optionalParams)
154
- }
155
- }
156
-
157
- static info(message?: unknown, ...optionalParams: unknown[]): void {
158
- Logger.instance.info(message, ...optionalParams)
159
- }
160
-
161
- info(message?: unknown, ...optionalParams: unknown[]): void {
162
- if (this.level <= LogLevel.INFO) {
163
- this.impl.info(...this.formatMessage(message), ...optionalParams)
164
- }
165
- }
166
-
167
- static warn(message?: unknown, ...optionalParams: unknown[]): void {
168
- Logger.instance.warn(message, ...optionalParams)
169
- }
170
-
171
- warn(message?: unknown, ...optionalParams: unknown[]): void {
172
- if (this.level <= LogLevel.WARN) {
173
- this.impl.warn(...this.formatMessage(message), ...optionalParams)
174
- }
175
- }
176
-
177
- static error(message?: unknown, ...optionalParams: unknown[]): void {
178
- Logger.instance.error(message, ...optionalParams)
179
- }
180
-
181
- error(message?: unknown, ...optionalParams: unknown[]): void {
182
- if (this.level <= LogLevel.ERROR) {
183
- this.impl.error(...this.formatMessage(message), ...optionalParams)
184
- }
185
- }
186
- }