react-resizable-panels 4.14.0 → 4.14.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.
|
@@ -373,7 +373,7 @@ export declare type GridProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
373
373
|
* ℹ️ For layout changes caused by pointer events, this method is not called until the pointer has been released.
|
|
374
374
|
* This method is recommended when saving layouts to some storage api.
|
|
375
375
|
*/
|
|
376
|
-
onLayoutChanged?: ((layout: GridLayout, meta: LayoutChangedMeta) => void) | undefined;
|
|
376
|
+
onLayoutChanged?: ((layout: GridLayout, meta: LayoutChangedMeta<GridLayout>) => void) | undefined;
|
|
377
377
|
/**
|
|
378
378
|
* Minimum size of the resizable hit target area (either a `Gridline` or a `Cell` edge)
|
|
379
379
|
* This threshold ensures targets are large enough to avoid mis-clicks.
|
|
@@ -572,6 +572,8 @@ export declare type GroupProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
572
572
|
* The `isUserInteraction` attribute signals whether the resize was caused by direct user input.
|
|
573
573
|
* It is true for resizes caused by pointer or keyboard input
|
|
574
574
|
* and false for other triggers (e.g. imperative API calls, initial mount, etc.)
|
|
575
|
+
* The `requestedLayout` attribute is the layout before constraints were applied for the current Group size;
|
|
576
|
+
* prefer it when persisting layouts.
|
|
575
577
|
*/
|
|
576
578
|
onLayoutChanged?: (layout: Layout, meta: LayoutChangedMeta) => void;
|
|
577
579
|
/**
|
|
@@ -623,19 +625,27 @@ export declare type Layout = {
|
|
|
623
625
|
};
|
|
624
626
|
|
|
625
627
|
/**
|
|
626
|
-
* Metadata describing a completed layout change, passed as the second argument
|
|
627
|
-
*
|
|
628
|
+
* Metadata describing a completed layout change, passed as the second argument to the `onLayoutChanged` callback.
|
|
629
|
+
* See #716.
|
|
628
630
|
*/
|
|
629
|
-
export declare type LayoutChangedMeta = {
|
|
631
|
+
export declare type LayoutChangedMeta<RequestedLayout = Layout> = {
|
|
630
632
|
/**
|
|
631
|
-
* `true` when the change was caused by the user directly manipulating a
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
* and other imperative API calls, constraint recompute, default-size change,
|
|
635
|
-
* initial mount), because the library cannot attribute the caller's intent
|
|
636
|
-
* there.
|
|
633
|
+
* `true` when the change was caused by the user directly manipulating a separator (keyboard or pointer)
|
|
634
|
+
* `false` for every other source (imperative API calls, constraint recompute, default-size change, initial mount),
|
|
635
|
+
* because the library cannot attribute the caller's intent there.
|
|
637
636
|
*/
|
|
638
637
|
isUserInteraction: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Layout most recently requested by the user or application (e.g. pointer or keyboard input, imperative API, default layout)
|
|
640
|
+
* before constraints were applied for the current size.
|
|
641
|
+
*
|
|
642
|
+
* This will differ from the validated layout when constraints temporarily override the requested layout,
|
|
643
|
+
* e.g. a panel with a pixel-based `minSize` taking up a larger percentage of a small Group.
|
|
644
|
+
* The requested layout is restored if the Group grows back to a size where it satisfies all constraints.
|
|
645
|
+
*
|
|
646
|
+
* ℹ️ When saving layouts to storage, prefer this value to the validated layout.
|
|
647
|
+
*/
|
|
648
|
+
requestedLayout?: RequestedLayout | undefined;
|
|
639
649
|
};
|
|
640
650
|
|
|
641
651
|
export declare type LayoutStorage = Pick<Storage, "getItem" | "setItem">;
|
|
@@ -995,7 +1005,7 @@ export declare function useDefaultGridLayout({ id, onlySaveAfterUserInteractions
|
|
|
995
1005
|
/**
|
|
996
1006
|
* Attach this callback on the `Grid` as the `onLayoutChanged` prop.
|
|
997
1007
|
*/
|
|
998
|
-
onLayoutChanged: (layout: GridLayout, meta: LayoutChangedMeta) => void;
|
|
1008
|
+
onLayoutChanged: (layout: GridLayout, meta: LayoutChangedMeta<GridLayout>) => void;
|
|
999
1009
|
};
|
|
1000
1010
|
|
|
1001
1011
|
/**
|