@aiquants/resize-panels 1.9.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 (62) hide show
  1. package/README.md +129 -22
  2. package/dist/GlobalDebugOverlay-Cf3GOn2A.cjs +1 -0
  3. package/dist/{GlobalDebugOverlay-Do70T2l6.js → GlobalDebugOverlay-DQtUdNeF.js} +28 -28
  4. package/dist/GlobalDebugOverlay.d.ts +1 -18
  5. package/dist/Panel.d.ts +13 -7
  6. package/dist/PanelDebugInfo.d.ts +6 -10
  7. package/dist/PanelGroup.d.ts +1 -6
  8. package/dist/PanelResizeHandle.d.ts +2 -7
  9. package/dist/allocateLayout.d.ts +12 -0
  10. package/dist/context.d.ts +2 -11
  11. package/dist/debugOverlayStore-D7FT6zPE.js +135 -0
  12. package/dist/debugOverlayStore-DY09saU8.cjs +1 -0
  13. package/dist/debugOverlayStore.d.ts +7 -36
  14. package/dist/hooks.d.ts +12 -24
  15. package/dist/index-DZ0itiBD.js +1299 -0
  16. package/dist/index-DqATP_BA.cjs +2 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +10 -26
  19. package/dist/index.js +25 -13
  20. package/dist/reducer.d.ts +7 -38
  21. package/dist/roundHalfToEven.d.ts +0 -9
  22. package/dist/styles/resize-panels.standalone.css +1 -1
  23. package/dist/types.d.ts +67 -261
  24. package/dist/utils/simple-logger.d.ts +0 -74
  25. package/dist/utils.d.ts +10 -55
  26. package/package.json +2 -3
  27. package/dist/GlobalDebugOverlay-sEQN6exo.cjs +0 -1
  28. package/dist/GlobalDebugOverlay.d.ts.map +0 -1
  29. package/dist/Panel.d.ts.map +0 -1
  30. package/dist/PanelDebugInfo.d.ts.map +0 -1
  31. package/dist/PanelGroup.d.ts.map +0 -1
  32. package/dist/PanelResizeHandle.d.ts.map +0 -1
  33. package/dist/context.d.ts.map +0 -1
  34. package/dist/debugOverlayStore-Cntyxboe.js +0 -141
  35. package/dist/debugOverlayStore-Dkl-fHoa.cjs +0 -1
  36. package/dist/debugOverlayStore.d.ts.map +0 -1
  37. package/dist/hooks.d.ts.map +0 -1
  38. package/dist/index-B6YGX2DH.js +0 -2009
  39. package/dist/index-DssZUxGw.cjs +0 -2
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/reducer.d.ts.map +0 -1
  42. package/dist/roundHalfToEven.d.ts.map +0 -1
  43. package/dist/types.d.ts.map +0 -1
  44. package/dist/utils/simple-logger.d.ts.map +0 -1
  45. package/dist/utils.d.ts.map +0 -1
  46. package/src/GlobalDebugOverlay.tsx +0 -284
  47. package/src/Panel.tsx +0 -635
  48. package/src/PanelDebugInfo.tsx +0 -148
  49. package/src/PanelGroup.tsx +0 -260
  50. package/src/PanelResizeHandle.tsx +0 -797
  51. package/src/context.ts +0 -25
  52. package/src/debugOverlayStore.ts +0 -351
  53. package/src/hooks.ts +0 -968
  54. package/src/index.ts +0 -84
  55. package/src/reducer.ts +0 -1234
  56. package/src/roundHalfToEven.ts +0 -40
  57. package/src/styles/components.entry.css +0 -10
  58. package/src/styles/resize-panels.css +0 -1
  59. package/src/styles/standalone.entry.css +0 -12
  60. package/src/types.ts +0 -419
  61. package/src/utils/simple-logger.ts +0 -186
  62. package/src/utils.ts +0 -279
package/dist/types.d.ts CHANGED
@@ -1,377 +1,183 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- /**
3
- * Pixel threshold used to decide when panels snap closed or open.
4
- * パネルのスナップ判定に利用するピクセル閾値。
5
- */
1
+ import { CSSProperties, HTMLAttributes, ReactNode } from "react";
6
2
  export declare const PANEL_SNAP_THRESHOLD = 12;
7
- /**
8
- * Default thickness in pixels for the resize handle interactive area.
9
- * リサイズハンドルのインタラクティブ領域のデフォルト厚み (px)。
10
- */
3
+ export declare const PANEL_ALLOCATION_EPSILON = 0.000001;
11
4
  export declare const PANEL_HANDLE_THICKNESS = 8;
12
- /**
13
- * Default thickness in pixels for the visual indicator wrapper.
14
- * 視覚インジケーター外枠のデフォルト厚み (px)。
15
- */
16
5
  export declare const PANEL_INDICATOR_THICKNESS = 6;
17
- /**
18
- * Default length in pixels for the visual indicator wrapper in horizontal layout.
19
- * 水平レイアウトにおける視覚インジケーター外枠のデフォルト長さ (px)。
20
- */
21
6
  export declare const PANEL_INDICATOR_LENGTH_HORIZONTAL = 48;
22
- /**
23
- * Default length in pixels for the visual indicator wrapper in vertical layout.
24
- * 垂直レイアウトにおける視覚インジケーター外枠のデフォルト長さ (px)。
25
- */
26
7
  export declare const PANEL_INDICATOR_LENGTH_VERTICAL = 80;
27
- /**
28
- * Default thickness in pixels for the inner bar inside the visual indicator.
29
- * 視覚インジケーター内部バーのデフォルト厚み (px)。
30
- */
31
8
  export declare const PANEL_INDICATOR_BAR_THICKNESS = 2;
32
- /**
33
- * Default length in pixels for the inner bar inside the visual indicator in horizontal layout.
34
- * 水平レイアウトにおける視覚インジケーター内部バーのデフォルト長さ (px)。
35
- */
36
9
  export declare const PANEL_INDICATOR_BAR_LENGTH_HORIZONTAL = 32;
37
- /**
38
- * Default length in pixels for the inner bar inside the visual indicator in vertical layout.
39
- * 垂直レイアウトにおける視覚インジケーター内部バーのデフォルト長さ (px)。
40
- */
41
10
  export declare const PANEL_INDICATOR_BAR_LENGTH_VERTICAL = 64;
42
- /**
43
- * Spacing in pixels between visual indicator dots in the handle.
44
- * ハンドル内の視覚インジケーター点同士のピクセル間隔。
45
- */
46
11
  export declare const PANEL_VISIBLE_INDICATOR_SPACING = 8;
47
- /**
48
- * Pointer move throttling interval in milliseconds during dragging.
49
- * ドラッグ中のポインタ移動を間引くミリ秒単位の間隔。
50
- */
51
12
  export declare const PANEL_HANDLE_DRAG_THROTTLE_MS = 8;
52
- /**
53
- * Pixel step applied per arrow-key press when resizing with the keyboard.
54
- * キーボード (矢印キー) リサイズで 1 押下ごとに適用するピクセル量。
55
- */
56
13
  export declare const PANEL_KEYBOARD_RESIZE_STEP = 10;
57
- /**
58
- * Ratio of container size used when determining collapse thresholds.
59
- * 折りたたみ閾値を決定する際に使用するコンテナサイズ比率。
60
- */
61
14
  export declare const PANEL_COLLAPSE_THRESHOLD_RATIO = 0.05;
62
- /**
63
- * Maximum pixel value considered when collapsing panels.
64
- * パネルを折りたたむ際に考慮するピクセル上限値。
65
- */
66
15
  export declare const PANEL_COLLAPSE_THRESHOLD_MAX = 10;
67
- /**
68
- * Ratio of container size required to expand a collapsed panel.
69
- * 折りたたまれたパネルを展開するために必要なコンテナサイズ比率。
70
- */
71
16
  export declare const PANEL_EXPAND_THRESHOLD_RATIO = 0.05;
72
- /**
73
- * Maximum pixel threshold used when expanding panels.
74
- * パネルを展開する際に用いるピクセル閾値の上限。
75
- */
76
17
  export declare const PANEL_EXPAND_THRESHOLD_MAX = 20;
77
- /**
78
- * Minimum thickness required for a handle to be treated as visible.
79
- * ハンドルが可視と判断されるために必要な最小厚み。
80
- */
81
18
  export declare const PANEL_HANDLE_VISIBILITY_THRESHOLD = 0.05;
82
- /**
83
- * Retry intervals in milliseconds when awaiting layout stabilization.
84
- * レイアウトの安定化を待機するときに使用するミリ秒単位の再試行間隔。
85
- */
86
- export declare const PANEL_RESIZE_RETRY_INTERVALS: readonly [10, 50, 100, 200, 300, 500, 800];
87
- /**
88
- * Tolerance used to decide whether pixel-based panel adjustments are significant.
89
- * ピクセル基準パネルの補正を有効とみなすための誤差許容値。
90
- */
91
- export declare const PANEL_PIXEL_MUTATION_TOLERANCE = 0;
92
- /**
93
- * Minimum pixel threshold used when clamping snap calculations.
94
- * スナップ計算を補正する際に用いる最小ピクセル閾値。
95
- */
96
- export declare const PANEL_MIN_SNAP_THRESHOLD = 0;
97
- /**
98
- * Layout direction of panels
99
- * パネルのレイアウト方向
100
- */
101
19
  export type PanelDirection = "horizontal" | "vertical";
102
- /**
103
- * Size unit types for panels
104
- * パネルのサイズ単位タイプ
105
- */
106
20
  export type SizeUnit = "percentage" | "pixels";
107
- /**
108
- * Size configuration with value and unit
109
- * 値と単位を持つサイズ設定
110
- */
111
21
  export type SizeConfig = {
112
22
  value: number;
113
23
  unit: SizeUnit;
114
24
  };
115
- /**
116
- * Flexible size that can be defined in pixels or as a percentage
117
- * ピクセルまたはパーセンテージで定義できる柔軟なサイズ
118
- */
119
25
  export type FlexibleSize = SizeConfig | number;
120
- /**
121
- * Container size dimensions
122
- * コンテナサイズの寸法
123
- */
124
26
  export type ContainerSize = {
125
27
  width: number;
126
28
  height: number;
127
29
  };
128
- /**
129
- * Direction from which collapsible panels may close.
130
- * パネルを折りたためる方向を表す列挙値。
131
- */
132
30
  export type PanelCollapseDirection = "start" | "end";
133
- /**
134
- * Directional options accepted by the collapsible configuration.
135
- * 折りたたみ設定が受け付ける方向指定値。
136
- */
137
31
  export type CollapsibleDirection = PanelCollapseDirection | "both";
138
- /**
139
- * Configuration object describing how a panel collapses.
140
- * パネルの折りたたみ方を表す設定オブジェクト。
141
- */
142
32
  export type CollapsibleConfig = {
143
33
  from: CollapsibleDirection;
144
34
  };
145
- /**
146
- * Axis-aligned container measurement including inner (borderless) and outer dimensions.
147
- * 枠線控除後と控除前の両方の寸法を含む軸方向コンテナ計測値。
148
- */
149
35
  export type ContainerAxisMeasurement = {
150
- inner: number;
151
- outer: number;
36
+ content: number;
37
+ border: number;
152
38
  };
153
- /**
154
- * Reason code for layout constraint violations.
155
- * レイアウト制約違反の理由コード。
156
- */
157
39
  export type LayoutConstraintViolationReason = "minimum-exceeded" | "maximum-insufficient";
158
- /**
159
- * Snapshot describing when panel constraints conflict with the container size.
160
- * パネル制約とコンテナサイズが矛盾した際のスナップショット。
161
- */
162
40
  export type LayoutConstraintViolation = {
163
41
  reason: LayoutConstraintViolationReason;
164
- totalMinimumSize: number | null;
165
- totalMaximumSize: number | null;
42
+ totalMinimumSize: number;
43
+ totalMaximumSize: number;
166
44
  availableContainerSize: number;
167
45
  };
168
- /**
169
- * Layout data for a single panel
170
- * 単一パネルのレイアウトデータ
171
- */
172
46
  export interface PanelLayoutData {
173
47
  id: string;
174
- size: number;
175
- percentageSize?: number;
176
- preferredPercentageSize?: number;
177
- preferredPixelSize?: number;
178
48
  sizeUnit: SizeUnit;
179
- originalPixelSize?: number;
49
+ size: number;
50
+ preferredPercentageSize: number;
51
+ preferredPixelSize: number;
180
52
  minSize?: FlexibleSize;
181
53
  maxSize?: FlexibleSize;
182
- autoMinSize?: FlexibleSize;
183
54
  collapseFromStart: boolean;
184
55
  collapseFromEnd: boolean;
185
- collapsedByDirection?: PanelCollapseDirection | null;
186
- /**
187
- * Skip automatic growth for flexible panels that were manually reduced to a zero footprint.
188
- * 手動でゼロ相当まで縮めた柔軟パネルを自動拡張対象から外すフラグ。
189
- */
190
- excludeFromAutoGrowth?: boolean;
191
- collapsed?: boolean;
192
- sizeBeforeCollapse?: number;
193
- percentageSizeBeforeCollapse?: number;
194
- preferredPercentageSizeBeforeCollapse?: number;
195
- preferredPixelSizeBeforeCollapse?: number;
56
+ collapsed: boolean;
57
+ collapsedByDirection: PanelCollapseDirection | null;
58
+ preferenceBeforeCollapse: number;
59
+ authoredPreference: number;
196
60
  pixelAdjustPriority?: number;
197
61
  flexAdjustPriority?: number;
198
- measuredPixelSize?: number;
199
- measuredPercentageSize?: number;
200
- measuredPixelSizeBeforeCollapse?: number;
201
62
  }
202
- /**
203
- * Props for the Panel component
204
- * Panel コンポーネントのプロパティ
205
- */
206
- export interface PanelProps {
63
+ export interface PanelGroupLayoutState {
64
+ containerSize: number;
65
+ panels: PanelLayoutData[];
66
+ violation: LayoutConstraintViolation | null;
67
+ }
68
+ export type PanelRegistration = Omit<PanelLayoutData, "size" | "collapsedByDirection" | "preferenceBeforeCollapse" | "authoredPreference">;
69
+ export type PersistedPanelSize = {
70
+ id: string;
71
+ size: number;
72
+ collapsed: boolean;
73
+ };
74
+ export type PanelAction = {
75
+ type: "SET_CONTAINER_SIZE";
76
+ containerSize: number;
77
+ } | {
78
+ type: "REGISTER_PANEL";
79
+ panel: PanelRegistration;
80
+ } | {
81
+ type: "UNREGISTER_PANEL";
82
+ id: string;
83
+ } | {
84
+ type: "REORDER_PANELS";
85
+ ids: string[];
86
+ } | {
87
+ type: "RESIZE_PANELS";
88
+ startId: string;
89
+ endId: string;
90
+ startSize: number;
91
+ } | {
92
+ type: "COLLAPSE_PANEL";
93
+ id: string;
94
+ from: PanelCollapseDirection;
95
+ } | {
96
+ type: "EXPAND_PANEL";
97
+ id: string;
98
+ from: PanelCollapseDirection;
99
+ targetSize?: number;
100
+ } | {
101
+ type: "RESTORE_LAYOUT";
102
+ entries: PersistedPanelSize[];
103
+ };
104
+ export interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style" | "aria-hidden"> {
207
105
  id?: string;
208
106
  defaultSize?: FlexibleSize;
209
107
  minSize?: FlexibleSize;
210
108
  maxSize?: FlexibleSize;
211
- autoMinSize?: FlexibleSize;
212
109
  className?: string;
213
110
  style?: CSSProperties;
214
111
  children?: ReactNode;
215
- order?: number;
216
112
  collapsible?: CollapsibleConfig;
217
113
  defaultCollapsed?: boolean;
218
114
  pixelAdjustPriority?: number;
219
115
  flexAdjustPriority?: number;
220
116
  contentOverflow?: CSSProperties["overflow"];
221
117
  }
222
- /**
223
- * Props for the PanelGroup component
224
- * PanelGroup コンポーネントのプロパティ
225
- */
226
- export interface PanelGroupProps {
118
+ export interface PanelGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style"> {
227
119
  id?: string;
228
120
  direction: PanelDirection;
229
- storageKey?: string;
230
121
  className?: string;
231
- style?: React.CSSProperties;
122
+ style?: CSSProperties;
232
123
  children?: ReactNode;
233
124
  showDebugInfo?: boolean;
234
125
  onLayout?: (panelSizes: number[]) => void;
235
126
  autoSaveId?: string;
236
127
  }
237
- /**
238
- * Value provided by the PanelGroupContext
239
- * PanelGroupContext によって提供される値
240
- */
241
128
  export interface PanelGroupContextValue {
242
129
  direction: PanelDirection;
243
- registerPanel: (panel: PanelLayoutData) => void;
130
+ registerPanel: (panel: PanelRegistration) => void;
244
131
  unregisterPanel: (id: string) => void;
245
132
  getPanel: (id: string) => PanelLayoutData | undefined;
246
133
  panels: PanelLayoutData[];
247
- isContainerReady: boolean;
134
+ containerSize: number;
135
+ layoutOrderKey: string;
248
136
  showDebugInfo: boolean;
249
- resizePanels: (leftId: string, rightId: string, leftSize: number, rightSize: number) => void;
137
+ resizePanels: (startId: string, endId: string, startSize: number) => void;
250
138
  collapsePanel: (id: string, from: PanelCollapseDirection) => void;
251
139
  expandPanel: (id: string, from: PanelCollapseDirection, targetSize?: number) => void;
252
- containerSize: ContainerSize;
253
140
  reportPanelMeasurement: (id: string, measurement: PanelMeasurement | null) => void;
254
141
  panelMeasurements: Record<string, PanelMeasurement>;
255
142
  reportHandleMeasurement: (id: string, measurement: ResizeHandleLayoutData | null) => void;
256
143
  handleMeasurements: Record<string, ResizeHandleLayoutData>;
257
144
  layoutConstraintViolation: LayoutConstraintViolation | null;
258
145
  }
259
- /**
260
- * Visual indicator configuration options for PanelResizeHandle.
261
- * PanelResizeHandle の視覚インジケーターに関する設定オプション。
262
- */
263
146
  export interface PanelResizeHandleIndicatorConfig {
264
- /**
265
- * Primary axis thickness of the indicator pill in pixels.
266
- * (Horizontal: width, Vertical: height)
267
- * インジケーター外枠の主軸方向の厚み (px)。(水平: 幅, 垂直: 高さ)
268
- * @default 6
269
- */
270
147
  thickness?: number;
271
- /**
272
- * Cross axis length of the indicator pill in pixels.
273
- * (Horizontal: height, Vertical: width)
274
- * インジケーター外枠の交差軸方向の長さ (px)。(水平: 高さ, 垂直: 幅)
275
- * @default horizontal ? 48 : 80
276
- */
277
148
  length?: number;
278
- /**
279
- * Primary axis thickness of the inner bar in pixels.
280
- * インジケーター内部バーの主軸方向の厚み (px)。
281
- * @default 2
282
- */
283
149
  barThickness?: number;
284
- /**
285
- * Cross axis length of the inner bar in pixels.
286
- * インジケーター内部バーの交差軸方向の長さ (px)。
287
- * @default horizontal ? 32 : 64
288
- */
289
150
  barLength?: number;
290
- /**
291
- * Whether the indicator is visible.
292
- * インジケーターを表示するかどうかの指定。
293
- * @default true
294
- */
295
151
  visible?: boolean;
296
- /**
297
- * Additional CSS class name for the indicator wrapper.
298
- * インジケーター外枠に付与する追加 CSS クラス名。
299
- */
300
152
  className?: string;
301
- /**
302
- * Additional CSS class name for the inner bar.
303
- * インジケーター内部バーに付与する追加 CSS クラス名。
304
- */
305
153
  barClassName?: string;
306
154
  }
307
- /**
308
- * Props for the PanelResizeHandle component
309
- * PanelResizeHandle コンポーネントのプロパティ
310
- */
311
- export interface PanelResizeHandleProps {
155
+ type OwnedSeparatorAria = "role" | "aria-orientation" | "aria-valuenow" | "aria-valuemin" | "aria-valuemax" | "aria-disabled" | "aria-hidden";
156
+ export interface PanelResizeHandleProps extends Omit<HTMLAttributes<HTMLButtonElement>, "id" | "children" | "className" | "style" | "title" | OwnedSeparatorAria> {
312
157
  id?: string;
313
158
  disabled?: boolean;
314
159
  onDragging?: (isDragging: boolean) => void;
315
160
  className?: string;
316
- style?: React.CSSProperties;
161
+ style?: CSSProperties;
317
162
  children?: ReactNode;
318
- /**
319
- * Primary axis thickness of the handle's interactive area in pixels.
320
- * (Horizontal: width, Vertical: height)
321
- * リサイズハンドルの操作領域 (ヒットエリア) の厚み (px)。(水平: 幅, 垂直: 高さ)
322
- * @default PANEL_HANDLE_THICKNESS (8)
323
- */
324
163
  thickness?: number;
325
- /**
326
- * Configuration for the visual indicator, or boolean to toggle visibility.
327
- * 視覚インジケーターの設定オブジェクト、または表示/非表示の真偽値。
328
- * @default true
329
- */
330
164
  indicator?: boolean | PanelResizeHandleIndicatorConfig;
331
- /**
332
- * Shorthand for indicator wrapper thickness in pixels.
333
- * インジケーター外枠厚み (px) のショートハンド。
334
- */
335
165
  indicatorThickness?: number;
336
- /**
337
- * Shorthand for indicator wrapper length in pixels.
338
- * インジケーター外枠長さ (px) のショートハンド。
339
- */
340
166
  indicatorLength?: number;
341
- /**
342
- * Shorthand for indicator inner bar thickness in pixels.
343
- * インジケーター内部バー厚み (px) のショートハンド。
344
- */
345
167
  indicatorBarThickness?: number;
346
- /**
347
- * Shorthand for indicator inner bar length in pixels.
348
- * インジケーター内部バー長さ (px) のショートハンド。
349
- */
350
168
  indicatorBarLength?: number;
351
- /**
352
- * Custom tooltip text for the handle element.
353
- * ハンドル要素のカスタムツールチップテキスト。
354
- */
355
169
  title?: string;
356
170
  }
357
- /**
358
- * Observed pixel and percentage measurements for a registered panel.
359
- * 登録済みパネルの実測ピクセル寸法およびパーセンテージ寸法。
360
- */
361
171
  export interface PanelMeasurement {
362
172
  pixelSize: number;
363
173
  percentageSize: number;
364
174
  }
365
- /**
366
- * Layout data for a resize handle (divider) within a panel group.
367
- * パネルグループ内のリサイズハンドル(ディバイダー)に関するレイアウトデータ。
368
- */
369
175
  export interface ResizeHandleLayoutData {
370
176
  id: string;
371
177
  thickness: number;
372
178
  direction: PanelDirection;
373
179
  visible: boolean;
374
- startPanelId?: string | null;
375
- endPanelId?: string | null;
180
+ startPanelId: string | null;
181
+ endPanelId: string | null;
376
182
  }
377
- //# sourceMappingURL=types.d.ts.map
183
+ export {};
@@ -1,13 +1,3 @@
1
- /**
2
- * @module utils/logger
3
- * @description Logger utility for consistent log management across the application.
4
- * @description アプリケーション全体で一貫したログ管理を行うためのロガーユーティリティ。
5
- */
6
- /**
7
- * @enum LogLevel
8
- * @description Log levels for filtering output.
9
- * @description 出力をフィルタリングするためのログレベル。
10
- */
11
1
  export declare enum LogLevel {
12
2
  DEBUG = 0,
13
3
  INFO = 1,
@@ -15,88 +5,25 @@ export declare enum LogLevel {
15
5
  ERROR = 3,
16
6
  NONE = 4
17
7
  }
18
- /**
19
- * @interface ILogger
20
- * @description Interface for a logger object compatible with Console.
21
- * @description Console と互換性のあるロガーオブジェクトのインターフェース。
22
- */
23
8
  export interface ILogger {
24
9
  debug(message?: unknown, ...optionalParams: unknown[]): void;
25
10
  info(message?: unknown, ...optionalParams: unknown[]): void;
26
11
  warn(message?: unknown, ...optionalParams: unknown[]): void;
27
12
  error(message?: unknown, ...optionalParams: unknown[]): void;
28
13
  }
29
- /**
30
- * @class Logger
31
- * @description A wrapper class for handling logging with levels and prefixes.
32
- * @description レベルとプレフィックスを使用したログ記録を処理するためのラッパークラス。
33
- */
34
14
  export declare class Logger implements ILogger {
35
15
  private level;
36
16
  private prefix;
37
17
  private impl;
38
- /**
39
- * Registry of all constructed loggers so the static configuration API can reach them.
40
- * static 設定 API が全ロガーへ到達できるようにするための生成済みインスタンスの登録簿。
41
- */
42
18
  private static readonly instances;
43
- /**
44
- * @constructor
45
- * @param {LogLevel} [level=LogLevel.WARN] - The minimum log level to output.
46
- * @param {string} [prefix="[resize-panels]"] - The prefix to add to all log messages.
47
- * @param {ILogger} [impl=console] - The implementation to use for logging.
48
- */
49
19
  constructor(level?: LogLevel, prefix?: string, impl?: ILogger);
50
20
  private static instance;
51
- /**
52
- * @method setLevel
53
- * @description Updates the log level for every constructed logger (module-level loggers included).
54
- * @description 生成済みのすべてのロガー (モジュールレベルのロガーを含む) のログレベルを更新します。
55
- * @param {LogLevel} level - The new log level.
56
- */
57
21
  static setLevel(level: LogLevel): void;
58
- /**
59
- * @method setLevel
60
- * @description Updates the current log level.
61
- * @description 現在のログレベルを更新します。
62
- * @param {LogLevel} level - The new log level.
63
- */
64
22
  setLevel(level: LogLevel): void;
65
- /**
66
- * @method setImplementation
67
- * @description Updates the logger implementation for every constructed logger.
68
- * @description 生成済みのすべてのロガーの実装を更新します。
69
- * @param {ILogger} impl - The new logger implementation.
70
- */
71
23
  static setImplementation(impl: ILogger): void;
72
- /**
73
- * @method setImplementation
74
- * @description Updates the logger implementation.
75
- * @description ロガーの実装を更新します。
76
- * @param {ILogger} impl - The new logger implementation.
77
- */
78
24
  setImplementation(impl: ILogger): void;
79
- /**
80
- * @method setPrefix
81
- * @description Updates the log prefix for every constructed logger.
82
- * @description 生成済みのすべてのロガーのログのプレフィックスを更新します。
83
- * @param {string} prefix - The new prefix.
84
- */
85
25
  static setPrefix(prefix: string): void;
86
- /**
87
- * @method setPrefix
88
- * @description Updates the log prefix.
89
- * @description ログのプレフィックスを更新します。
90
- * @param {string} prefix - The new prefix.
91
- */
92
26
  setPrefix(prefix: string): void;
93
- /**
94
- * @method enabledFor
95
- * @description Returns whether messages at the given level would be emitted.
96
- * @description 指定レベルのメッセージが出力対象かどうかを返します。
97
- * 高コストなログ引数 (スナップショット等) の組み立てを抑制中に省略するために使用します。
98
- * @param {LogLevel} level - The message level to test.
99
- */
100
27
  enabledFor(level: LogLevel): boolean;
101
28
  private formatMessage;
102
29
  static debug(message?: unknown, ...optionalParams: unknown[]): void;
@@ -108,4 +35,3 @@ export declare class Logger implements ILogger {
108
35
  static error(message?: unknown, ...optionalParams: unknown[]): void;
109
36
  error(message?: unknown, ...optionalParams: unknown[]): void;
110
37
  }
111
- //# sourceMappingURL=simple-logger.d.ts.map
package/dist/utils.d.ts CHANGED
@@ -1,61 +1,16 @@
1
- import { ContainerAxisMeasurement, FlexibleSize, PanelDirection, PanelLayoutData, SizeConfig, SizeUnit } from './types';
2
- /**
3
- * Number of significant fractional digits to preserve when rounding percentage-based sizes.
4
- * パーセンテージサイズの丸めで保持する有効小数桁数。
5
- */
1
+ import { ContainerAxisMeasurement, FlexibleSize, PanelDirection, PersistedPanelSize, SizeConfig, SizeUnit } from "./types";
6
2
  export declare const PERCENTAGE_DIGITS = 6;
7
- /**
8
- * Convert a pixel measurement to a percentage of the container using banker’s rounding.
9
- * ピクセル寸法をバンカーズラウンディングでコンテナ比率のパーセンテージへ変換する。
10
- */
11
3
  export declare const toRoundedPercentage: (size: number, base: number) => number;
12
- /**
13
- * Translate a percentage-based size back into pixels relative to the container.
14
- * パーセンテージ指定のサイズをコンテナ基準のピクセル値へ変換する。
15
- */
16
- export declare const percentageToPixels: (percentage: number | undefined, base: number) => number;
17
- /**
18
- * Normalize a flexible size into a size configuration object.
19
- * 柔軟なサイズ指定をサイズ設定オブジェクトへ正規化する。
20
- */
4
+ export declare const percentageToPixels: (percentage: number, base: number) => number;
21
5
  export declare const normalizeSizeConfig: (size: FlexibleSize | undefined, defaultUnit?: SizeUnit) => SizeConfig | undefined;
22
- /**
23
- * Convert flexible size constraints into pixel values based on container size.
24
- * 柔軟サイズ制約をコンテナサイズ基準のピクセル値へ変換する。
25
- */
26
6
  export declare const getConstraintInPixels: (size: FlexibleSize | undefined, defaultValue: number, containerSize: number) => number;
27
- /**
28
- * Clamp a numeric value between the provided bounds.
29
- * 数値を指定した範囲に収めるためのクリッピング処理。
30
- */
31
7
  export declare const clamp: (value: number, min: number, max: number) => number;
32
- /**
33
- * Derive a snap-to-zero threshold from the container axis length using shared heuristics.
34
- * 共通ヒューリスティクスに基づきコンテナ軸長からゼロスナップ閾値を算出する。
35
- */
36
8
  export declare const calculateSnapThreshold: (axisSize: number) => number;
37
- /**
38
- * Adjust pixel-based panels in priority order to absorb remaining space.
39
- * 残余スペースを吸収するためにピクセル基準パネルを優先度順に調整する。
40
- */
41
- type AdjustPixelOptions = {
42
- enforceAutoMinSize?: boolean;
43
- };
44
- export declare const adjustPixelPanelsByPriority: (panels: PanelLayoutData[], sizeDiff: number, containerSize: number, options?: AdjustPixelOptions) => number;
45
- /**
46
- * Measure container size in a given direction, returning inner (borderless) and outer dimensions.
47
- * 指定方向で枠線控除後と控除前の両方の寸法を測定して返す。
48
- */
49
- export declare const getContainerSize: (element: HTMLElement, direction: PanelDirection) => ContainerAxisMeasurement;
50
- /**
51
- * Persist panel layout sizes to local storage.
52
- * パネルレイアウトのサイズをローカルストレージへ保存する。
53
- */
54
- export declare const saveLayout: (id: string, sizes: number[]) => void;
55
- /**
56
- * Restore panel layout sizes from local storage.
57
- * パネルレイアウトのサイズをローカルストレージから復元する。
58
- */
59
- export declare const loadLayout: (id: string) => number[] | null;
60
- export {};
61
- //# sourceMappingURL=utils.d.ts.map
9
+ export declare const getContainerSize: (element: HTMLElement, direction: PanelDirection, entry?: ResizeObserverEntry) => ContainerAxisMeasurement;
10
+ export declare const LAYOUT_ELEMENT_SELECTOR = "[data-panel-id], [data-resize-handle-anchor]";
11
+ export declare const findOwningGroup: (element: HTMLElement | null | undefined) => HTMLElement | null;
12
+ export declare const getGroupLayoutElements: (group: HTMLElement) => HTMLElement[];
13
+ export declare const touchesLayoutElements: (records: ReadonlyArray<MutationRecord>) => boolean;
14
+ export declare const getVisualScale: (element: HTMLElement, direction: PanelDirection) => number;
15
+ export declare const saveLayout: (id: string, entries: PersistedPanelSize[]) => void;
16
+ export declare const loadLayout: (id: string) => PersistedPanelSize[] | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiquants/resize-panels",
3
- "version": "1.9.0",
3
+ "version": "2.0.1",
4
4
  "description": "Reusable resizable panel components and utilities for React",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -34,7 +34,6 @@
34
34
  },
35
35
  "files": [
36
36
  "dist",
37
- "src",
38
37
  "README.md",
39
38
  "LICENSE"
40
39
  ],
@@ -69,7 +68,7 @@
69
68
  "access": "public"
70
69
  },
71
70
  "scripts": {
72
- "build": "pnpm run clean && vite build && pnpm run build:css",
71
+ "build": "pnpm run clean && vite build && pnpm run build:css && node ../../.config/scripts/strip-dts-comments.mjs dist",
73
72
  "build:css": "tailwindcss -i src/styles/components.entry.css -o dist/styles/resize-panels.css --minify && tailwindcss -i src/styles/standalone.entry.css -o dist/styles/resize-panels.standalone.css --minify",
74
73
  "dev": "vite build --watch",
75
74
  "watch": "vite build --watch",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("react"),R=require("react-dom"),x=require("./debugOverlayStore-Dkl-fHoa.cjs"),P=require("./index-DssZUxGw.cjs"),o=(n,r)=>typeof n!="number"||!Number.isFinite(n)?"—":`${(n<0?0:n).toFixed(8)}${r}`,T={position:"fixed",left:"50%",bottom:"20px",transform:"translate(-50%, 0)",zIndex:100,maxWidth:"min(90vw, 1120px)",width:"100%",borderRadius:"14px",backgroundColor:"rgba(15, 23, 42, 0.72)",color:"#e2e8f0",fontFamily:"monospace",fontSize:"11px",lineHeight:1.6,boxShadow:"0 22px 45px rgba(15,23,42,0.45)",border:"1px solid rgba(148, 163, 184, 0.22)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",pointerEvents:"auto",overflow:"auto"},Y={display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"12px"},w={display:"flex",flexDirection:"column",gap:"4px"},D={padding:"6px 10px",borderRadius:"9999px",border:"1px solid rgba(148, 163, 184, 0.35)",color:"#e2e8f0",fontWeight:600,fontSize:"10px",letterSpacing:"0.03em",textTransform:"uppercase",cursor:"pointer",transition:"background-color 0.18s ease, border-color 0.18s ease"},C={padding:"10px 12px",borderRadius:"10px",backgroundColor:"rgba(30, 41, 59, 0.55)",border:"1px solid rgba(148, 163, 184, 0.18)",display:"flex",flexDirection:"column",gap:"10px"},N={padding:"8px 10px",borderRadius:"8px",backgroundColor:"rgba(15, 23, 42, 0.55)",border:"1px solid rgba(148, 163, 184, 0.16)",display:"flex",flexDirection:"column",gap:"4px"},p={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"6px"},k={display:"grid",gridTemplateColumns:"auto 1fr",gap:"2px 10px",color:"#e2e8f0"},G={padding:"2px 6px",borderRadius:"9999px",fontSize:"10px",textTransform:"uppercase"},I=({groupId:n})=>x.useDebugOverlayOwnerId()!==n?null:e.jsx(u,{}),u=()=>{const r=x.useDebugOverlaySnapshot().groups,[t,g]=A.useState(!0);if(r.length===0||typeof document>"u")return null;const b=r.reduce((i,a)=>i+a.panels.length,0),h=r.reduce((i,a)=>i+(a.handles?.length??0),0),m=()=>g(i=>!i),f=e.jsxs("div",{style:{...T,padding:t?"10px 18px":"14px 18px",maxHeight:t?"52px":"min(65vh, 520px)",transition:"max-height 0.24s ease, padding 0.24s ease"},children:[e.jsxs("div",{style:{...Y,marginBottom:t?0:"12px"},children:[e.jsxs("div",{style:w,children:[e.jsx("span",{style:{fontWeight:700,fontSize:"12px",letterSpacing:"0.03em"},children:"Panel Overview"}),e.jsxs("span",{style:{color:"#cbd5f5"},children:["groups: ",r.length," / panels: ",b," / resizers: ",h]})]}),e.jsx("button",{type:"button",onClick:m,style:{...D,backgroundColor:t?"rgba(59, 130, 246, 0.2)":"rgba(71, 85, 105, 0.45)"},title:t?"Panel Overview を開く":"Panel Overview を閉じる",children:t?"開く":"閉じる"})]}),!t&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"45vh",overflowY:"auto",paddingRight:"6px"},children:r.map((i,a)=>{const l=i.direction==="horizontal"?i.containerSize.width:i.containerSize.height;return e.jsxs("div",{style:C,children:[e.jsxs("div",{style:{...p,flexWrap:"wrap",gap:"10px",color:"#dbeafe"},children:[e.jsxs("span",{style:{fontWeight:600,fontSize:"11px",letterSpacing:"0.02em",textTransform:"uppercase"},children:["group ",a+1,": ",i.displayName]}),e.jsxs("span",{children:["direction: ",i.direction," / container: ",o(i.containerSize.width,"px")," × ",o(i.containerSize.height,"px")]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:"10px"},children:i.panels.map((s,y)=>{const d=s.measuredPixelSize??s.size,S=s.size,j=o(S,"px"),v=s.percentageSize??(l>0?s.size/l*100:void 0),O=s.measuredPercentageSize!==void 0?s.measuredPercentageSize:l>0?d/l*100:void 0,c=s.collapsed||d<=P.PANEL_SNAP_THRESHOLD,E=s.collapsed?"collapsed":c?"hidden":"visible",z=o(v,"%"),L=o(O,"%"),_=o(d,"px");return e.jsxs("div",{style:N,children:[e.jsxs("div",{style:p,children:[e.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:s.id}),e.jsx("span",{style:{...G,backgroundColor:s.collapsed?"rgba(251, 113, 133, 0.25)":c?"rgba(250, 204, 21, 0.25)":"rgba(74, 222, 128, 0.25)",color:s.collapsed?"#fecdd3":c?"#fef08a":"#bbf7d0"},children:E})]}),e.jsxs("div",{style:k,children:[e.jsx("span",{children:"size (state):"}),e.jsx("span",{children:j}),e.jsx("span",{children:"size (measured):"}),e.jsx("span",{children:_}),e.jsx("span",{children:"percentage (state):"}),e.jsx("span",{children:z}),e.jsx("span",{children:"percentage (measured):"}),e.jsx("span",{children:L}),e.jsx("span",{children:"unit:"}),e.jsx("span",{children:s.sizeUnit}),e.jsx("span",{children:"min:"}),e.jsx("span",{children:s.minSize!==void 0?JSON.stringify(s.minSize):"—"}),e.jsx("span",{children:"auto min:"}),e.jsx("span",{children:s.autoMinSize!==void 0?JSON.stringify(s.autoMinSize):"—"}),e.jsx("span",{children:"max:"}),e.jsx("span",{children:s.maxSize!==void 0?JSON.stringify(s.maxSize):"—"}),e.jsx("span",{children:"priority:"}),e.jsx("span",{children:s.pixelAdjustPriority??"—"}),e.jsx("span",{children:"flex priority:"}),e.jsx("span",{children:s.flexAdjustPriority??"—"})]})]},s.id||y)})})]},i.groupId)})})]});return R.createPortal(f,document.body)};exports.GlobalDebugOverlay=u;exports.GlobalDebugOverlayGate=I;
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlobalDebugOverlay.d.ts","sourceRoot":"","sources":["../src/GlobalDebugOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyGH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,uCAMtE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,0CA2J9B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../src/Panel.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAA6C,UAAU,EAAE,MAAM,SAAS,CAAA;AA6FpF;;;GAGG;AACH,eAAO,MAAM,KAAK,mOACwO,UAAU,iCA+gBnQ,CAAA"}