@aiquants/resize-panels 1.8.1 → 2.0.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.md +213 -108
- package/dist/GlobalDebugOverlay-Cf3GOn2A.cjs +1 -0
- package/dist/{GlobalDebugOverlay-DYCR0FIu.js → GlobalDebugOverlay-DQtUdNeF.js} +28 -28
- package/dist/debugOverlayStore-D7FT6zPE.js +135 -0
- package/dist/debugOverlayStore-DY09saU8.cjs +1 -0
- package/dist/index-DZ0itiBD.js +1299 -0
- package/dist/index-DqATP_BA.cjs +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -29
- package/dist/index.js +25 -13
- package/dist/src/GlobalDebugOverlay.d.ts.map +1 -0
- package/dist/src/Panel.d.ts +46 -0
- package/dist/src/Panel.d.ts.map +1 -0
- package/dist/src/PanelDebugInfo.d.ts +34 -0
- package/dist/src/PanelDebugInfo.d.ts.map +1 -0
- package/dist/src/PanelGroup.d.ts.map +1 -0
- package/dist/{PanelResizeHandle.d.ts → src/PanelResizeHandle.d.ts} +1 -1
- package/dist/src/PanelResizeHandle.d.ts.map +1 -0
- package/dist/src/allocateLayout.d.ts +60 -0
- package/dist/src/allocateLayout.d.ts.map +1 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/{debugOverlayStore.d.ts → src/debugOverlayStore.d.ts} +10 -2
- package/dist/src/debugOverlayStore.d.ts.map +1 -0
- package/dist/src/hooks.d.ts +48 -0
- package/dist/src/hooks.d.ts.map +1 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/reducer.d.ts +49 -0
- package/dist/src/reducer.d.ts.map +1 -0
- package/dist/src/roundHalfToEven.d.ts.map +1 -0
- package/dist/src/types.d.ts +481 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/simple-logger.d.ts.map +1 -0
- package/dist/src/utils.d.ts +164 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/styles/resize-panels.standalone.css +1 -1
- package/dist/tests/support/dom-harness.d.ts +89 -0
- package/dist/tests/support/dom-harness.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/GlobalDebugOverlay.tsx +3 -3
- package/src/Panel.tsx +203 -541
- package/src/PanelDebugInfo.tsx +52 -106
- package/src/PanelGroup.tsx +27 -42
- package/src/PanelResizeHandle.tsx +544 -504
- package/src/allocateLayout.ts +412 -0
- package/src/debugOverlayStore.ts +19 -15
- package/src/hooks.ts +187 -779
- package/src/index.ts +37 -6
- package/src/reducer.ts +364 -1126
- package/src/types.ts +282 -65
- package/src/utils.ts +205 -164
- package/dist/GlobalDebugOverlay-afs0vF-Q.cjs +0 -1
- package/dist/GlobalDebugOverlay.d.ts.map +0 -1
- package/dist/Panel.d.ts +0 -7
- package/dist/Panel.d.ts.map +0 -1
- package/dist/PanelDebugInfo.d.ts +0 -26
- package/dist/PanelDebugInfo.d.ts.map +0 -1
- package/dist/PanelGroup.d.ts.map +0 -1
- package/dist/PanelResizeHandle.d.ts.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/debugOverlayStore-Cntyxboe.js +0 -141
- package/dist/debugOverlayStore-Dkl-fHoa.cjs +0 -1
- package/dist/debugOverlayStore.d.ts.map +0 -1
- package/dist/hooks.d.ts +0 -45
- package/dist/hooks.d.ts.map +0 -1
- package/dist/index-BzgId8aQ.js +0 -1972
- package/dist/index-xTV-c0PN.cjs +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/reducer.d.ts +0 -39
- package/dist/reducer.d.ts.map +0 -1
- package/dist/roundHalfToEven.d.ts.map +0 -1
- package/dist/types.d.ts +0 -253
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/simple-logger.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -61
- package/dist/utils.d.ts.map +0 -1
- /package/dist/{GlobalDebugOverlay.d.ts → src/GlobalDebugOverlay.d.ts} +0 -0
- /package/dist/{PanelGroup.d.ts → src/PanelGroup.d.ts} +0 -0
- /package/dist/{context.d.ts → src/context.d.ts} +0 -0
- /package/dist/{roundHalfToEven.d.ts → src/roundHalfToEven.d.ts} +0 -0
- /package/dist/{utils → src/utils}/simple-logger.d.ts +0 -0
package/src/types.ts
CHANGED
|
@@ -3,14 +3,24 @@
|
|
|
3
3
|
* リサイザブルパネルコンポーネントの型定義
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { CSSProperties, ReactNode } from "react"
|
|
6
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from "react"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Pixel threshold
|
|
10
|
-
*
|
|
9
|
+
* Pixel threshold under which a panel is treated as visually closed.
|
|
10
|
+
* パネルが見た目上閉じていると扱われるピクセル閾値。
|
|
11
11
|
*/
|
|
12
12
|
export const PANEL_SNAP_THRESHOLD = 12
|
|
13
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
|
+
|
|
14
24
|
/**
|
|
15
25
|
* Default thickness in pixels for the resize handle interactive area.
|
|
16
26
|
* リサイズハンドルのインタラクティブ領域のデフォルト厚み (px)。
|
|
@@ -18,8 +28,44 @@ export const PANEL_SNAP_THRESHOLD = 12
|
|
|
18
28
|
export const PANEL_HANDLE_THICKNESS = 8
|
|
19
29
|
|
|
20
30
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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
|
+
* 境界を共有するハンドルの視覚インジケーター同士のピクセル間隔。
|
|
23
69
|
*/
|
|
24
70
|
export const PANEL_VISIBLE_INDICATOR_SPACING = 8
|
|
25
71
|
|
|
@@ -65,24 +111,6 @@ export const PANEL_EXPAND_THRESHOLD_MAX = 20
|
|
|
65
111
|
*/
|
|
66
112
|
export const PANEL_HANDLE_VISIBILITY_THRESHOLD = 0.05
|
|
67
113
|
|
|
68
|
-
/**
|
|
69
|
-
* Retry intervals in milliseconds when awaiting layout stabilization.
|
|
70
|
-
* レイアウトの安定化を待機するときに使用するミリ秒単位の再試行間隔。
|
|
71
|
-
*/
|
|
72
|
-
export const PANEL_RESIZE_RETRY_INTERVALS = [10, 50, 100, 200, 300, 500, 800] as const
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Tolerance used to decide whether pixel-based panel adjustments are significant.
|
|
76
|
-
* ピクセル基準パネルの補正を有効とみなすための誤差許容値。
|
|
77
|
-
*/
|
|
78
|
-
export const PANEL_PIXEL_MUTATION_TOLERANCE = 0.0
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Minimum pixel threshold used when clamping snap calculations.
|
|
82
|
-
* スナップ計算を補正する際に用いる最小ピクセル閾値。
|
|
83
|
-
*/
|
|
84
|
-
export const PANEL_MIN_SNAP_THRESHOLD = 0.0
|
|
85
|
-
|
|
86
114
|
/**
|
|
87
115
|
* Layout direction of panels
|
|
88
116
|
* パネルのレイアウト方向
|
|
@@ -140,76 +168,160 @@ export type CollapsibleConfig = {
|
|
|
140
168
|
}
|
|
141
169
|
|
|
142
170
|
/**
|
|
143
|
-
* Axis-aligned container measurement
|
|
144
|
-
*
|
|
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` は同じ軸のパディング・枠線を含む外形で、要素の外寸が必要な場合にのみ使う。
|
|
145
179
|
*/
|
|
146
180
|
export type ContainerAxisMeasurement = {
|
|
147
|
-
|
|
148
|
-
|
|
181
|
+
content: number
|
|
182
|
+
border: number
|
|
149
183
|
}
|
|
150
184
|
|
|
151
185
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
186
|
+
* Reason code for layout constraint violations.
|
|
187
|
+
* レイアウト制約違反の理由コード。
|
|
154
188
|
*/
|
|
155
189
|
export type LayoutConstraintViolationReason = "minimum-exceeded" | "maximum-insufficient"
|
|
156
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Snapshot describing when panel constraints conflict with the container size.
|
|
193
|
+
* パネル制約とコンテナサイズが矛盾した際のスナップショット。
|
|
194
|
+
*/
|
|
157
195
|
export type LayoutConstraintViolation = {
|
|
158
196
|
reason: LayoutConstraintViolationReason
|
|
159
|
-
totalMinimumSize: number
|
|
160
|
-
totalMaximumSize: number
|
|
197
|
+
totalMinimumSize: number
|
|
198
|
+
totalMaximumSize: number
|
|
161
199
|
availableContainerSize: number
|
|
162
200
|
}
|
|
163
201
|
|
|
164
202
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
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・ハンドル位置・デバッグ表示の割合は、すべてここから導出される。
|
|
167
214
|
*/
|
|
168
215
|
export interface PanelLayoutData {
|
|
169
216
|
id: string
|
|
170
|
-
|
|
171
|
-
percentageSize?: number
|
|
172
|
-
preferredPercentageSize?: number
|
|
173
|
-
preferredPixelSize?: number
|
|
217
|
+
/** Which preference field drives this panel. どちらの希望値でサイズが決まるか。 */
|
|
174
218
|
sizeUnit: SizeUnit
|
|
175
|
-
|
|
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
|
|
176
233
|
minSize?: FlexibleSize
|
|
177
234
|
maxSize?: FlexibleSize
|
|
178
|
-
autoMinSize?: FlexibleSize
|
|
179
235
|
collapseFromStart: boolean
|
|
180
236
|
collapseFromEnd: boolean
|
|
181
|
-
|
|
237
|
+
collapsed: boolean
|
|
238
|
+
collapsedByDirection: PanelCollapseDirection | null
|
|
239
|
+
/**
|
|
240
|
+
* Preference captured when the panel collapsed, restored verbatim on expand.
|
|
241
|
+
* 折りたたみ時に退避し、展開時にそのまま復元する希望値。
|
|
242
|
+
*/
|
|
243
|
+
preferenceBeforeCollapse: number
|
|
182
244
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
245
|
+
* Preference the component last authored through its props, used to tell a prop change from a re-registration.
|
|
246
|
+
* コンポーネントが props で最後に宣言した希望値。prop 変更と単なる再登録を区別するために保持。
|
|
185
247
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
sizeBeforeCollapse?: number
|
|
189
|
-
percentageSizeBeforeCollapse?: number
|
|
190
|
-
preferredPercentageSizeBeforeCollapse?: number
|
|
191
|
-
preferredPixelSizeBeforeCollapse?: number
|
|
248
|
+
authoredPreference: number
|
|
249
|
+
/** Serving order among pixel panels, higher first. ピクセルパネル間の充当順位 (大きいほど先)。 */
|
|
192
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
|
+
*/
|
|
193
260
|
flexAdjustPriority?: number
|
|
194
|
-
measuredPixelSize?: number
|
|
195
|
-
measuredPercentageSize?: number
|
|
196
|
-
measuredPixelSizeBeforeCollapse?: number
|
|
197
261
|
}
|
|
198
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
|
+
|
|
199
307
|
/**
|
|
200
308
|
* Props for the Panel component
|
|
201
309
|
* Panel コンポーネントのプロパティ
|
|
202
310
|
*/
|
|
203
|
-
|
|
311
|
+
// aria-hidden は折りたたみ状態から決まるため、利用者の指定は黙って捨てられる
|
|
312
|
+
export interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style" | "aria-hidden"> {
|
|
204
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
|
+
*/
|
|
205
319
|
defaultSize?: FlexibleSize
|
|
206
320
|
minSize?: FlexibleSize
|
|
207
321
|
maxSize?: FlexibleSize
|
|
208
|
-
autoMinSize?: FlexibleSize
|
|
209
322
|
className?: string
|
|
210
323
|
style?: CSSProperties
|
|
211
324
|
children?: ReactNode
|
|
212
|
-
order?: number
|
|
213
325
|
collapsible?: CollapsibleConfig
|
|
214
326
|
defaultCollapsed?: boolean
|
|
215
327
|
pixelAdjustPriority?: number
|
|
@@ -221,12 +333,11 @@ export interface PanelProps {
|
|
|
221
333
|
* Props for the PanelGroup component
|
|
222
334
|
* PanelGroup コンポーネントのプロパティ
|
|
223
335
|
*/
|
|
224
|
-
export interface PanelGroupProps {
|
|
336
|
+
export interface PanelGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "id" | "children" | "className" | "style"> {
|
|
225
337
|
id?: string
|
|
226
338
|
direction: PanelDirection
|
|
227
|
-
storageKey?: string
|
|
228
339
|
className?: string
|
|
229
|
-
style?:
|
|
340
|
+
style?: CSSProperties
|
|
230
341
|
children?: ReactNode
|
|
231
342
|
showDebugInfo?: boolean
|
|
232
343
|
onLayout?: (panelSizes: number[]) => void
|
|
@@ -239,16 +350,25 @@ export interface PanelGroupProps {
|
|
|
239
350
|
*/
|
|
240
351
|
export interface PanelGroupContextValue {
|
|
241
352
|
direction: PanelDirection
|
|
242
|
-
registerPanel: (panel:
|
|
353
|
+
registerPanel: (panel: PanelRegistration) => void
|
|
243
354
|
unregisterPanel: (id: string) => void
|
|
244
355
|
getPanel: (id: string) => PanelLayoutData | undefined
|
|
245
356
|
panels: PanelLayoutData[]
|
|
246
|
-
|
|
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
|
|
247
368
|
showDebugInfo: boolean
|
|
248
|
-
resizePanels: (
|
|
369
|
+
resizePanels: (startId: string, endId: string, startSize: number) => void
|
|
249
370
|
collapsePanel: (id: string, from: PanelCollapseDirection) => void
|
|
250
371
|
expandPanel: (id: string, from: PanelCollapseDirection, targetSize?: number) => void
|
|
251
|
-
containerSize: ContainerSize
|
|
252
372
|
reportPanelMeasurement: (id: string, measurement: PanelMeasurement | null) => void
|
|
253
373
|
panelMeasurements: Record<string, PanelMeasurement>
|
|
254
374
|
reportHandleMeasurement: (id: string, measurement: ResizeHandleLayoutData | null) => void
|
|
@@ -256,19 +376,116 @@ export interface PanelGroupContextValue {
|
|
|
256
376
|
layoutConstraintViolation: LayoutConstraintViolation | null
|
|
257
377
|
}
|
|
258
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
|
+
|
|
259
428
|
/**
|
|
260
429
|
* Props for the PanelResizeHandle component
|
|
261
430
|
* PanelResizeHandle コンポーネントのプロパティ
|
|
262
431
|
*/
|
|
263
|
-
|
|
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> {
|
|
264
439
|
id?: string
|
|
265
440
|
disabled?: boolean
|
|
266
441
|
onDragging?: (isDragging: boolean) => void
|
|
267
442
|
className?: string
|
|
268
|
-
style?:
|
|
443
|
+
style?: CSSProperties
|
|
269
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
|
|
270
483
|
}
|
|
271
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Observed pixel and percentage measurements for a registered panel.
|
|
487
|
+
* 登録済みパネルの実測ピクセル寸法およびパーセンテージ寸法。
|
|
488
|
+
*/
|
|
272
489
|
export interface PanelMeasurement {
|
|
273
490
|
pixelSize: number
|
|
274
491
|
percentageSize: number
|
|
@@ -283,6 +500,6 @@ export interface ResizeHandleLayoutData {
|
|
|
283
500
|
thickness: number
|
|
284
501
|
direction: PanelDirection
|
|
285
502
|
visible: boolean
|
|
286
|
-
startPanelId
|
|
287
|
-
endPanelId
|
|
503
|
+
startPanelId: string | null
|
|
504
|
+
endPanelId: string | null
|
|
288
505
|
}
|