react-native-layout-dnd 0.1.0-alpha.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/LICENSE +20 -0
- package/README.md +262 -0
- package/lib/module/adapters/coordinates.js +135 -0
- package/lib/module/adapters/coordinates.js.map +1 -0
- package/lib/module/adapters/scroll.js +81 -0
- package/lib/module/adapters/scroll.js.map +1 -0
- package/lib/module/adapters/virtualizedList.js +69 -0
- package/lib/module/adapters/virtualizedList.js.map +1 -0
- package/lib/module/components/DndProvider.js +1144 -0
- package/lib/module/components/DndProvider.js.map +1 -0
- package/lib/module/components/DragHandle.js +65 -0
- package/lib/module/components/DragHandle.js.map +1 -0
- package/lib/module/components/GridController.js +151 -0
- package/lib/module/components/GridController.js.map +1 -0
- package/lib/module/components/GridDragHandle.js +15 -0
- package/lib/module/components/GridDragHandle.js.map +1 -0
- package/lib/module/components/GridZoneView.js +59 -0
- package/lib/module/components/GridZoneView.js.map +1 -0
- package/lib/module/components/SortableGrid.js +305 -0
- package/lib/module/components/SortableGrid.js.map +1 -0
- package/lib/module/components/SortableList.js +714 -0
- package/lib/module/components/SortableList.js.map +1 -0
- package/lib/module/components/dndTypes.js +4 -0
- package/lib/module/components/dndTypes.js.map +1 -0
- package/lib/module/components/gridTypes.js +4 -0
- package/lib/module/components/gridTypes.js.map +1 -0
- package/lib/module/components/handleViewProps.js +13 -0
- package/lib/module/components/handleViewProps.js.map +1 -0
- package/lib/module/contracts.js +4 -0
- package/lib/module/contracts.js.map +1 -0
- package/lib/module/controller/approval.js +98 -0
- package/lib/module/controller/approval.js.map +1 -0
- package/lib/module/controller/coordinatorBase.js +93 -0
- package/lib/module/controller/coordinatorBase.js.map +1 -0
- package/lib/module/controller/dndSession.js +621 -0
- package/lib/module/controller/dndSession.js.map +1 -0
- package/lib/module/controller/dndState.js +103 -0
- package/lib/module/controller/dndState.js.map +1 -0
- package/lib/module/controller/gridAdapter.js +191 -0
- package/lib/module/controller/gridAdapter.js.map +1 -0
- package/lib/module/controller/gridState.js +101 -0
- package/lib/module/controller/gridState.js.map +1 -0
- package/lib/module/controller/locations.js +48 -0
- package/lib/module/controller/locations.js.map +1 -0
- package/lib/module/controller/previewPath.js +73 -0
- package/lib/module/controller/previewPath.js.map +1 -0
- package/lib/module/controller/sessionCore.js +222 -0
- package/lib/module/controller/sessionCore.js.map +1 -0
- package/lib/module/controller/useDndState.js +9 -0
- package/lib/module/controller/useDndState.js.map +1 -0
- package/lib/module/controller/useGridState.js +9 -0
- package/lib/module/controller/useGridState.js.map +1 -0
- package/lib/module/controller/useStoreState.js +15 -0
- package/lib/module/controller/useStoreState.js.map +1 -0
- package/lib/module/defaults.js +7 -0
- package/lib/module/defaults.js.map +1 -0
- package/lib/module/diagnostics.js +16 -0
- package/lib/module/diagnostics.js.map +1 -0
- package/lib/module/engine/gridPlacements.js +54 -0
- package/lib/module/engine/gridPlacements.js.map +1 -0
- package/lib/module/engine/index.js +19 -0
- package/lib/module/engine/index.js.map +1 -0
- package/lib/module/engine/layout.js +36 -0
- package/lib/module/engine/layout.js.map +1 -0
- package/lib/module/engine/layoutMove.js +326 -0
- package/lib/module/engine/layoutMove.js.map +1 -0
- package/lib/module/engine/layoutState.js +344 -0
- package/lib/module/engine/layoutState.js.map +1 -0
- package/lib/module/engine/list.js +172 -0
- package/lib/module/engine/list.js.map +1 -0
- package/lib/module/engine/listIndex.js +125 -0
- package/lib/module/engine/listIndex.js.map +1 -0
- package/lib/module/engine/move.js +216 -0
- package/lib/module/engine/move.js.map +1 -0
- package/lib/module/engine/movementPolicy.js +77 -0
- package/lib/module/engine/movementPolicy.js.map +1 -0
- package/lib/module/engine/orderedTarget.js +71 -0
- package/lib/module/engine/orderedTarget.js.map +1 -0
- package/lib/module/engine/pack.js +30 -0
- package/lib/module/engine/pack.js.map +1 -0
- package/lib/module/engine/rectangles.js +12 -0
- package/lib/module/engine/rectangles.js.map +1 -0
- package/lib/module/engine/sameLayout.js +29 -0
- package/lib/module/engine/sameLayout.js.map +1 -0
- package/lib/module/engine/search.js +159 -0
- package/lib/module/engine/search.js.map +1 -0
- package/lib/module/engine/spatial.js +27 -0
- package/lib/module/engine/spatial.js.map +1 -0
- package/lib/module/engine/spatialAppRotation.js +39 -0
- package/lib/module/engine/spatialAppRotation.js.map +1 -0
- package/lib/module/engine/spatialExchange.js +164 -0
- package/lib/module/engine/spatialExchange.js.map +1 -0
- package/lib/module/engine/spatialInsertion.js +135 -0
- package/lib/module/engine/spatialInsertion.js.map +1 -0
- package/lib/module/engine/spatialPolicy.js +41 -0
- package/lib/module/engine/spatialPolicy.js.map +1 -0
- package/lib/module/engine/spatialRotation.js +48 -0
- package/lib/module/engine/spatialRotation.js.map +1 -0
- package/lib/module/engine/validation.js +205 -0
- package/lib/module/engine/validation.js.map +1 -0
- package/lib/module/gesture/DndGestureGroup.js +268 -0
- package/lib/module/gesture/DndGestureGroup.js.map +1 -0
- package/lib/module/gesture/DndGestureHost.js +32 -0
- package/lib/module/gesture/DndGestureHost.js.map +1 -0
- package/lib/module/gesture/gestureConfig.js +81 -0
- package/lib/module/gesture/gestureConfig.js.map +1 -0
- package/lib/module/gesture/gestureGrouping.js +122 -0
- package/lib/module/gesture/gestureGrouping.js.map +1 -0
- package/lib/module/gesture/gestureHost.js +106 -0
- package/lib/module/gesture/gestureHost.js.map +1 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/pointer/dndTarget.js +101 -0
- package/lib/module/pointer/dndTarget.js.map +1 -0
- package/lib/module/pointer/geometry.js +363 -0
- package/lib/module/pointer/geometry.js.map +1 -0
- package/lib/module/pointer/layoutTarget.js +307 -0
- package/lib/module/pointer/layoutTarget.js.map +1 -0
- package/lib/module/pointer/listCellMotion.js +99 -0
- package/lib/module/pointer/listCellMotion.js.map +1 -0
- package/lib/module/pointer/listTarget.js +42 -0
- package/lib/module/pointer/listTarget.js.map +1 -0
- package/lib/module/pointer/motion.js +37 -0
- package/lib/module/pointer/motion.js.map +1 -0
- package/lib/module/runtime/dndPresentation.js +81 -0
- package/lib/module/runtime/dndPresentation.js.map +1 -0
- package/lib/module/runtime/dndRenderStore.js +129 -0
- package/lib/module/runtime/dndRenderStore.js.map +1 -0
- package/lib/module/runtime/dndRuntime.js +135 -0
- package/lib/module/runtime/dndRuntime.js.map +1 -0
- package/lib/module/runtime/dndSettlement.js +77 -0
- package/lib/module/runtime/dndSettlement.js.map +1 -0
- package/lib/module/runtime/gridRuntime.js +37 -0
- package/lib/module/runtime/gridRuntime.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/adapters/coordinates.d.ts +9 -0
- package/lib/typescript/src/adapters/coordinates.d.ts.map +1 -0
- package/lib/typescript/src/adapters/scroll.d.ts +49 -0
- package/lib/typescript/src/adapters/scroll.d.ts.map +1 -0
- package/lib/typescript/src/adapters/virtualizedList.d.ts +22 -0
- package/lib/typescript/src/adapters/virtualizedList.d.ts.map +1 -0
- package/lib/typescript/src/components/DndProvider.d.ts +4 -0
- package/lib/typescript/src/components/DndProvider.d.ts.map +1 -0
- package/lib/typescript/src/components/DragHandle.d.ts +4 -0
- package/lib/typescript/src/components/DragHandle.d.ts.map +1 -0
- package/lib/typescript/src/components/GridController.d.ts +21 -0
- package/lib/typescript/src/components/GridController.d.ts.map +1 -0
- package/lib/typescript/src/components/GridDragHandle.d.ts +8 -0
- package/lib/typescript/src/components/GridDragHandle.d.ts.map +1 -0
- package/lib/typescript/src/components/GridZoneView.d.ts +8 -0
- package/lib/typescript/src/components/GridZoneView.d.ts.map +1 -0
- package/lib/typescript/src/components/SortableGrid.d.ts +4 -0
- package/lib/typescript/src/components/SortableGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/SortableList.d.ts +4 -0
- package/lib/typescript/src/components/SortableList.d.ts.map +1 -0
- package/lib/typescript/src/components/dndTypes.d.ts +94 -0
- package/lib/typescript/src/components/dndTypes.d.ts.map +1 -0
- package/lib/typescript/src/components/gridTypes.d.ts +84 -0
- package/lib/typescript/src/components/gridTypes.d.ts.map +1 -0
- package/lib/typescript/src/components/handleViewProps.d.ts +6 -0
- package/lib/typescript/src/components/handleViewProps.d.ts.map +1 -0
- package/lib/typescript/src/contracts.d.ts +145 -0
- package/lib/typescript/src/contracts.d.ts.map +1 -0
- package/lib/typescript/src/controller/approval.d.ts +66 -0
- package/lib/typescript/src/controller/approval.d.ts.map +1 -0
- package/lib/typescript/src/controller/coordinatorBase.d.ts +37 -0
- package/lib/typescript/src/controller/coordinatorBase.d.ts.map +1 -0
- package/lib/typescript/src/controller/dndSession.d.ts +152 -0
- package/lib/typescript/src/controller/dndSession.d.ts.map +1 -0
- package/lib/typescript/src/controller/dndState.d.ts +27 -0
- package/lib/typescript/src/controller/dndState.d.ts.map +1 -0
- package/lib/typescript/src/controller/gridAdapter.d.ts +44 -0
- package/lib/typescript/src/controller/gridAdapter.d.ts.map +1 -0
- package/lib/typescript/src/controller/gridState.d.ts +18 -0
- package/lib/typescript/src/controller/gridState.d.ts.map +1 -0
- package/lib/typescript/src/controller/locations.d.ts +9 -0
- package/lib/typescript/src/controller/locations.d.ts.map +1 -0
- package/lib/typescript/src/controller/previewPath.d.ts +49 -0
- package/lib/typescript/src/controller/previewPath.d.ts.map +1 -0
- package/lib/typescript/src/controller/sessionCore.d.ts +106 -0
- package/lib/typescript/src/controller/sessionCore.d.ts.map +1 -0
- package/lib/typescript/src/controller/useDndState.d.ts +8 -0
- package/lib/typescript/src/controller/useDndState.d.ts.map +1 -0
- package/lib/typescript/src/controller/useGridState.d.ts +8 -0
- package/lib/typescript/src/controller/useGridState.d.ts.map +1 -0
- package/lib/typescript/src/controller/useStoreState.d.ts +16 -0
- package/lib/typescript/src/controller/useStoreState.d.ts.map +1 -0
- package/lib/typescript/src/defaults.d.ts +5 -0
- package/lib/typescript/src/defaults.d.ts.map +1 -0
- package/lib/typescript/src/diagnostics.d.ts +9 -0
- package/lib/typescript/src/diagnostics.d.ts.map +1 -0
- package/lib/typescript/src/engine/gridPlacements.d.ts +22 -0
- package/lib/typescript/src/engine/gridPlacements.d.ts.map +1 -0
- package/lib/typescript/src/engine/index.d.ts +28 -0
- package/lib/typescript/src/engine/index.d.ts.map +1 -0
- package/lib/typescript/src/engine/layout.d.ts +4 -0
- package/lib/typescript/src/engine/layout.d.ts.map +1 -0
- package/lib/typescript/src/engine/layoutMove.d.ts +46 -0
- package/lib/typescript/src/engine/layoutMove.d.ts.map +1 -0
- package/lib/typescript/src/engine/layoutState.d.ts +22 -0
- package/lib/typescript/src/engine/layoutState.d.ts.map +1 -0
- package/lib/typescript/src/engine/list.d.ts +68 -0
- package/lib/typescript/src/engine/list.d.ts.map +1 -0
- package/lib/typescript/src/engine/listIndex.d.ts +32 -0
- package/lib/typescript/src/engine/listIndex.d.ts.map +1 -0
- package/lib/typescript/src/engine/move.d.ts +10 -0
- package/lib/typescript/src/engine/move.d.ts.map +1 -0
- package/lib/typescript/src/engine/movementPolicy.d.ts +34 -0
- package/lib/typescript/src/engine/movementPolicy.d.ts.map +1 -0
- package/lib/typescript/src/engine/orderedTarget.d.ts +32 -0
- package/lib/typescript/src/engine/orderedTarget.d.ts.map +1 -0
- package/lib/typescript/src/engine/pack.d.ts +3 -0
- package/lib/typescript/src/engine/pack.d.ts.map +1 -0
- package/lib/typescript/src/engine/rectangles.d.ts +9 -0
- package/lib/typescript/src/engine/rectangles.d.ts.map +1 -0
- package/lib/typescript/src/engine/sameLayout.d.ts +4 -0
- package/lib/typescript/src/engine/sameLayout.d.ts.map +1 -0
- package/lib/typescript/src/engine/search.d.ts +28 -0
- package/lib/typescript/src/engine/search.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatial.d.ts +16 -0
- package/lib/typescript/src/engine/spatial.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatialAppRotation.d.ts +4 -0
- package/lib/typescript/src/engine/spatialAppRotation.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatialExchange.d.ts +5 -0
- package/lib/typescript/src/engine/spatialExchange.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatialInsertion.d.ts +5 -0
- package/lib/typescript/src/engine/spatialInsertion.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatialPolicy.d.ts +9 -0
- package/lib/typescript/src/engine/spatialPolicy.d.ts.map +1 -0
- package/lib/typescript/src/engine/spatialRotation.d.ts +8 -0
- package/lib/typescript/src/engine/spatialRotation.d.ts.map +1 -0
- package/lib/typescript/src/engine/validation.d.ts +9 -0
- package/lib/typescript/src/engine/validation.d.ts.map +1 -0
- package/lib/typescript/src/gesture/DndGestureGroup.d.ts +33 -0
- package/lib/typescript/src/gesture/DndGestureGroup.d.ts.map +1 -0
- package/lib/typescript/src/gesture/DndGestureHost.d.ts +12 -0
- package/lib/typescript/src/gesture/DndGestureHost.d.ts.map +1 -0
- package/lib/typescript/src/gesture/gestureConfig.d.ts +15 -0
- package/lib/typescript/src/gesture/gestureConfig.d.ts.map +1 -0
- package/lib/typescript/src/gesture/gestureGrouping.d.ts +66 -0
- package/lib/typescript/src/gesture/gestureGrouping.d.ts.map +1 -0
- package/lib/typescript/src/gesture/gestureHost.d.ts +23 -0
- package/lib/typescript/src/gesture/gestureHost.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +38 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/pointer/dndTarget.d.ts +14 -0
- package/lib/typescript/src/pointer/dndTarget.d.ts.map +1 -0
- package/lib/typescript/src/pointer/geometry.d.ts +28 -0
- package/lib/typescript/src/pointer/geometry.d.ts.map +1 -0
- package/lib/typescript/src/pointer/layoutTarget.d.ts +43 -0
- package/lib/typescript/src/pointer/layoutTarget.d.ts.map +1 -0
- package/lib/typescript/src/pointer/listCellMotion.d.ts +43 -0
- package/lib/typescript/src/pointer/listCellMotion.d.ts.map +1 -0
- package/lib/typescript/src/pointer/listTarget.d.ts +7 -0
- package/lib/typescript/src/pointer/listTarget.d.ts.map +1 -0
- package/lib/typescript/src/pointer/motion.d.ts +20 -0
- package/lib/typescript/src/pointer/motion.d.ts.map +1 -0
- package/lib/typescript/src/runtime/dndPresentation.d.ts +37 -0
- package/lib/typescript/src/runtime/dndPresentation.d.ts.map +1 -0
- package/lib/typescript/src/runtime/dndRenderStore.d.ts +46 -0
- package/lib/typescript/src/runtime/dndRenderStore.d.ts.map +1 -0
- package/lib/typescript/src/runtime/dndRuntime.d.ts +138 -0
- package/lib/typescript/src/runtime/dndRuntime.d.ts.map +1 -0
- package/lib/typescript/src/runtime/dndSettlement.d.ts +18 -0
- package/lib/typescript/src/runtime/dndSettlement.d.ts.map +1 -0
- package/lib/typescript/src/runtime/gridRuntime.d.ts +54 -0
- package/lib/typescript/src/runtime/gridRuntime.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +180 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +136 -0
- package/src/adapters/coordinates.ts +181 -0
- package/src/adapters/scroll.ts +147 -0
- package/src/adapters/virtualizedList.ts +112 -0
- package/src/components/DndProvider.tsx +1836 -0
- package/src/components/DragHandle.tsx +89 -0
- package/src/components/GridController.tsx +213 -0
- package/src/components/GridDragHandle.tsx +11 -0
- package/src/components/GridZoneView.tsx +57 -0
- package/src/components/SortableGrid.tsx +449 -0
- package/src/components/SortableList.tsx +1028 -0
- package/src/components/dndTypes.ts +102 -0
- package/src/components/gridTypes.ts +90 -0
- package/src/components/handleViewProps.ts +35 -0
- package/src/contracts.ts +149 -0
- package/src/controller/approval.ts +179 -0
- package/src/controller/coordinatorBase.ts +118 -0
- package/src/controller/dndSession.ts +1058 -0
- package/src/controller/dndState.ts +198 -0
- package/src/controller/gridAdapter.ts +268 -0
- package/src/controller/gridState.ts +187 -0
- package/src/controller/locations.ts +67 -0
- package/src/controller/previewPath.ts +90 -0
- package/src/controller/sessionCore.ts +390 -0
- package/src/controller/useDndState.ts +26 -0
- package/src/controller/useGridState.ts +22 -0
- package/src/controller/useStoreState.ts +27 -0
- package/src/defaults.ts +4 -0
- package/src/diagnostics.ts +23 -0
- package/src/engine/gridPlacements.ts +85 -0
- package/src/engine/index.ts +99 -0
- package/src/engine/layout.ts +29 -0
- package/src/engine/layoutMove.ts +401 -0
- package/src/engine/layoutState.ts +490 -0
- package/src/engine/list.ts +307 -0
- package/src/engine/listIndex.ts +174 -0
- package/src/engine/move.ts +274 -0
- package/src/engine/movementPolicy.ts +151 -0
- package/src/engine/orderedTarget.ts +131 -0
- package/src/engine/pack.ts +24 -0
- package/src/engine/rectangles.ts +18 -0
- package/src/engine/sameLayout.ts +50 -0
- package/src/engine/search.ts +174 -0
- package/src/engine/spatial.ts +36 -0
- package/src/engine/spatialAppRotation.ts +53 -0
- package/src/engine/spatialExchange.ts +212 -0
- package/src/engine/spatialInsertion.ts +157 -0
- package/src/engine/spatialPolicy.ts +48 -0
- package/src/engine/spatialRotation.ts +56 -0
- package/src/engine/validation.ts +358 -0
- package/src/gesture/DndGestureGroup.tsx +357 -0
- package/src/gesture/DndGestureHost.tsx +50 -0
- package/src/gesture/gestureConfig.ts +123 -0
- package/src/gesture/gestureGrouping.ts +210 -0
- package/src/gesture/gestureHost.tsx +163 -0
- package/src/index.ts +162 -0
- package/src/pointer/dndTarget.ts +213 -0
- package/src/pointer/geometry.ts +584 -0
- package/src/pointer/layoutTarget.ts +515 -0
- package/src/pointer/listCellMotion.ts +174 -0
- package/src/pointer/listTarget.ts +56 -0
- package/src/pointer/motion.ts +66 -0
- package/src/runtime/dndPresentation.ts +113 -0
- package/src/runtime/dndRenderStore.ts +246 -0
- package/src/runtime/dndRuntime.ts +311 -0
- package/src/runtime/dndSettlement.ts +117 -0
- package/src/runtime/gridRuntime.ts +73 -0
- package/src/types.ts +189 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LayoutLocation } from '../contracts.js';
|
|
2
|
+
import type { GridItemLayout } from '../engine/layoutMove.js';
|
|
3
|
+
import type { GridMovementPolicy } from '../engine/movementPolicy.js';
|
|
4
|
+
import type { GridZone } from '../types.js';
|
|
5
|
+
import type { DndMotion, GridRegistration, ListViewport, ZoneRegistration } from '../runtime/dndRuntime.js';
|
|
6
|
+
import type { MeasuredZone } from '../runtime/gridRuntime.js';
|
|
7
|
+
type RegisteredZone = ZoneRegistration & {
|
|
8
|
+
layoutVersion: number;
|
|
9
|
+
};
|
|
10
|
+
type Registrations = ReadonlyMap<string, RegisteredZone>;
|
|
11
|
+
/** Geometry-only immutable input for UI pointer targeting; no refs or renderers. */
|
|
12
|
+
export type PreparedGridTarget = Omit<MeasuredZone, 'rect' | 'zone'> & {
|
|
13
|
+
/** Ordered grids keep their `itemSpan` so slot targeting applies. */
|
|
14
|
+
zone: GridZone<undefined>;
|
|
15
|
+
zoneId: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
layoutVersion: number;
|
|
18
|
+
};
|
|
19
|
+
/** Prepare on registration, then reuse the result on the UI runtime. */
|
|
20
|
+
export declare function prepareGridTarget(registration: GridRegistration & {
|
|
21
|
+
layoutVersion: number;
|
|
22
|
+
}): PreparedGridTarget;
|
|
23
|
+
/** Attach current viewport coordinates without rebuilding baseline placements. */
|
|
24
|
+
export declare function measurePreparedGrid(prepared: PreparedGridTarget, measured: ListViewport): MeasuredZone | null;
|
|
25
|
+
/**
|
|
26
|
+
* Use committed list geometry and the existing grid pointer policy in one
|
|
27
|
+
* measured coordinate space. Grid recipes are captured by destination zone ID.
|
|
28
|
+
*/
|
|
29
|
+
type LayoutTargetResolution = {
|
|
30
|
+
target: LayoutLocation | null;
|
|
31
|
+
/**
|
|
32
|
+
* The pointer is over a zone whose UI measurement predates the layout
|
|
33
|
+
* version registered on JS. The packet carries no new position; callers
|
|
34
|
+
* keep their current target until the UI publishes the new version.
|
|
35
|
+
*/
|
|
36
|
+
stale: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function layoutTarget(state: DndMotion, registrations: Registrations, gridItemLayouts: ReadonlyMap<string, GridItemLayout>, movementPolicy?: GridMovementPolicy, previousTarget?: LayoutLocation | null): LayoutLocation | null;
|
|
39
|
+
export declare function resolveLayoutTarget(state: DndMotion, registrations: Registrations, gridItemLayouts: ReadonlyMap<string, GridItemLayout>, movementPolicy?: GridMovementPolicy, previousTarget?: LayoutLocation | null): LayoutTargetResolution;
|
|
40
|
+
/** Recheck a resolved grid footprint after an exchange changes its position. */
|
|
41
|
+
export declare function isLayoutTargetVisible(state: DndMotion, registrations: Registrations, target: LayoutLocation, gridItemLayouts: ReadonlyMap<string, GridItemLayout>): boolean;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=layoutTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layoutTarget.d.ts","sourceRoot":"","sources":["../../../../src/pointer/layoutTarget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAc,CAAC;AAMnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAgC,MAAM,aAAU,CAAC;AACvE,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EACjB,MAAM,0BAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,2BAAwB,CAAC;AAErE,KAAK,cAAc,GAAG,gBAAgB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AACnE,KAAK,aAAa,GAAG,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEzD,oFAAoF;AACpF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IACrE,qEAAqE;IACrE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAgEF,wEAAwE;AACxE,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,gBAAgB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GACzD,kBAAkB,CAkFpB;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,YAAY,GACrB,YAAY,GAAG,IAAI,CAgCrB;AAsDD;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EACpD,cAAc,CAAC,EAAE,kBAAkB,EACnC,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,GACrC,cAAc,GAAG,IAAI,CAQvB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EACpD,cAAc,CAAC,EAAE,kBAAkB,EACnC,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,GACrC,sBAAsB,CAgIxB;AAoBD,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,cAAc,EACtB,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,GACnD,OAAO,CA6CT"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
2
|
+
import { type DndPresentation } from '../runtime/dndPresentation.js';
|
|
3
|
+
import type { DndRuntime } from '../runtime/dndRuntime.js';
|
|
4
|
+
type ListCellMotionArgs = {
|
|
5
|
+
zoneId: string;
|
|
6
|
+
itemId: string;
|
|
7
|
+
vertical: boolean;
|
|
8
|
+
fixed: boolean;
|
|
9
|
+
/** Committed main-axis start used when no validated candidate rect exists. */
|
|
10
|
+
start: number | SharedValue<number>;
|
|
11
|
+
/** Committed main-axis size used when no validated candidate rect exists. */
|
|
12
|
+
size: number;
|
|
13
|
+
presentation: DndRuntime['presentation'];
|
|
14
|
+
revision: number | SharedValue<number>;
|
|
15
|
+
hiddenItemId: SharedValue<string | null>;
|
|
16
|
+
animation: DndRuntime['animation'];
|
|
17
|
+
/**
|
|
18
|
+
* JS view of the geometry the Provider has already scheduled for the UI
|
|
19
|
+
* runtime. It is read once at mount for the initial style; the UI mapper
|
|
20
|
+
* adopts the actual UI geometry on its first run without animating.
|
|
21
|
+
*/
|
|
22
|
+
initial: {
|
|
23
|
+
presentation: DndPresentation | undefined;
|
|
24
|
+
revision: number;
|
|
25
|
+
start: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type ListCellMotion = {
|
|
29
|
+
/** Animated main-axis content start in list content coordinates. */
|
|
30
|
+
animatedStart: SharedValue<number>;
|
|
31
|
+
/** Validated main-axis size for authoritative (fixed) item sizes. */
|
|
32
|
+
targetSize: SharedValue<number>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* One UI mapper per cell selects the validated candidate rect and animates the
|
|
36
|
+
* content start. Mount reads no UI state: a synchronous shared-value read from
|
|
37
|
+
* JS blocks on the UI runtime and copies the whole presentation table. The
|
|
38
|
+
* first UI evaluation snaps to the UI geometry so a stale estimate never
|
|
39
|
+
* becomes the start of a timing animation.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useListCellMotion(args: ListCellMotionArgs): ListCellMotion;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=listCellMotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listCellMotion.d.ts","sourceRoot":"","sources":["../../../../src/pointer/listCellMotion.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAAuB,CAAC;AAExD,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,8EAA8E;IAC9E,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACnC;;;;OAIG;IACH,OAAO,EAAE;QACP,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;QAC1C,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,oEAAoE;IACpE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,qEAAqE;IACrE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC;AAyBF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CA+F1E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ListLocation } from '../contracts.js';
|
|
2
|
+
import type { DndMotion, ListRegistration } from '../runtime/dndRuntime.js';
|
|
3
|
+
/** Target from committed order; candidate reflow must not move its own thresholds. */
|
|
4
|
+
export declare function listTarget(state: DndMotion, registrations: ReadonlyMap<string, ListRegistration & {
|
|
5
|
+
layoutVersion: number;
|
|
6
|
+
}>): ListLocation | null;
|
|
7
|
+
//# sourceMappingURL=listTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTarget.d.ts","sourceRoot":"","sources":["../../../../src/pointer/listTarget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAc,CAAC;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAAuB,CAAC;AAGzE,sFAAsF;AACtF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,WAAW,CACxB,MAAM,EACN,gBAAgB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAC7C,GACA,YAAY,GAAG,IAAI,CAyCrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ValidationIssue } from '../types.js';
|
|
2
|
+
export type GridMotionConfig = {
|
|
3
|
+
/** Duration in milliseconds for item movement and preview settling. Defaults to 180. */
|
|
4
|
+
durationMs?: number;
|
|
5
|
+
/** Respect the device accessibility setting by default. */
|
|
6
|
+
reduceMotion?: 'system' | 'always' | 'never';
|
|
7
|
+
};
|
|
8
|
+
type ResolvedGridMotionConfig = Required<GridMotionConfig>;
|
|
9
|
+
export declare const DEFAULT_GRID_MOTION: Readonly<ResolvedGridMotionConfig>;
|
|
10
|
+
type GridMotionResult = {
|
|
11
|
+
valid: true;
|
|
12
|
+
motion: ResolvedGridMotionConfig;
|
|
13
|
+
} | {
|
|
14
|
+
valid: false;
|
|
15
|
+
issues: ValidationIssue[];
|
|
16
|
+
};
|
|
17
|
+
/** Validate before sharing animation settings with the UI runtime. */
|
|
18
|
+
export declare function resolveGridMotion(value: unknown): GridMotionResult;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../../../src/pointer/motion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAU,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF,KAAK,wBAAwB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,wBAAwB,CACP,CAAC;AAE7D,KAAK,gBAAgB,GACjB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE,GACjD;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAEhD,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA8ClE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LayoutLocation, LayoutRect } from '../contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Only validated numeric geometry crosses into the UI runtime. Coordinates
|
|
4
|
+
* form one typed array so a zone table crosses runtimes as a single buffer;
|
|
5
|
+
* the slot map is reused while a zone keeps the same items, so repeated
|
|
6
|
+
* candidates serialize only the coordinates.
|
|
7
|
+
*/
|
|
8
|
+
export type DndZonePresentation = {
|
|
9
|
+
/** Prefixed item ID → slot; four coordinates per slot in `rects`. */
|
|
10
|
+
slots: Readonly<Record<string, number>>;
|
|
11
|
+
/** x, y, width and height of each slot, in zone content coordinates. */
|
|
12
|
+
rects: Float64Array;
|
|
13
|
+
};
|
|
14
|
+
export type DndPresentation = {
|
|
15
|
+
token: number;
|
|
16
|
+
revision: number;
|
|
17
|
+
zones: Record<string, DndZonePresentation>;
|
|
18
|
+
/** Last policy-approved preview, usable for motion before JS acknowledges release. */
|
|
19
|
+
releaseTarget?: {
|
|
20
|
+
target: LayoutLocation;
|
|
21
|
+
policyRevision: number;
|
|
22
|
+
/** Final pointer already validated by JS; controlled state may still be pending. */
|
|
23
|
+
releasedSeq?: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const EMPTY_DND_PRESENTATION: DndPresentation;
|
|
27
|
+
export declare function presentationRect(presentation: DndPresentation | undefined, zoneId: string, itemId: string): LayoutRect | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Build a zone table from item rects. The previous table's slot map is kept
|
|
30
|
+
* when it lists exactly these items, so unchanged maps keep their identity.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createZonePresentation(entries: ReadonlyArray<readonly [itemId: string, rect: LayoutRect]>, previous?: DndZonePresentation | null): DndZonePresentation;
|
|
33
|
+
/** Build a zone table from a `#itemId` keyed rect record. */
|
|
34
|
+
export declare function zonePresentationFromRects(rects: Readonly<Record<string, LayoutRect>>): DndZonePresentation;
|
|
35
|
+
/** Read a zone table back as a `#itemId` keyed rect record. */
|
|
36
|
+
export declare function zonePresentationRects(zone: DndZonePresentation | undefined): Record<string, LayoutRect>;
|
|
37
|
+
//# sourceMappingURL=dndPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dndPresentation.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dndPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,qEAAqE;IACrE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,wEAAwE;IACxE,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3C,sFAAsF;IACtF,aAAa,CAAC,EAAE;QACd,MAAM,EAAE,cAAc,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,oFAAoF;QACpF,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAIpC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,eAAe,GAAG,SAAS,EACzC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,UAAU,GAAG,SAAS,CAaxB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,EACnE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,GACpC,mBAAmB,CAyBrB;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC1C,mBAAmB,CAIrB;AAED,+DAA+D;AAC/D,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,mBAAmB,GAAG,SAAS,GACpC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAa5B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { DndItem, LayoutZone } from '../contracts.js';
|
|
2
|
+
import type { DndSessionSnapshot } from '../controller/dndSession.js';
|
|
3
|
+
type DndSnapshotSource<T = unknown> = {
|
|
4
|
+
getSnapshot(): DndSessionSnapshot<T>;
|
|
5
|
+
subscribe(listener: () => void): () => void;
|
|
6
|
+
};
|
|
7
|
+
export type DndZoneSnapshot = {
|
|
8
|
+
zone: LayoutZone | undefined;
|
|
9
|
+
display: LayoutZone | undefined;
|
|
10
|
+
items: readonly DndItem<unknown>[] | undefined;
|
|
11
|
+
revision: number;
|
|
12
|
+
displayRevision: number;
|
|
13
|
+
activeItemId: string | null;
|
|
14
|
+
scrollEnabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
type DndItemSnapshot = {
|
|
17
|
+
index: number;
|
|
18
|
+
row?: number;
|
|
19
|
+
col?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Answers once per drag session whether a zone keeps its native slots in
|
|
23
|
+
* committed order while `activeItemId` is dragged. Adapters whose mounted set
|
|
24
|
+
* depends on slot order (windowed lists) answer from their render window.
|
|
25
|
+
*/
|
|
26
|
+
export type RetainSlotsRule = (activeItemId: string) => boolean;
|
|
27
|
+
/** Separate React subscriptions from frame-by-frame approved presentation. */
|
|
28
|
+
export declare class DndRenderStore<T = unknown> {
|
|
29
|
+
private readonly source;
|
|
30
|
+
private provider;
|
|
31
|
+
private zones;
|
|
32
|
+
private itemIndices;
|
|
33
|
+
private items;
|
|
34
|
+
private retainDecisions;
|
|
35
|
+
constructor(source: DndSnapshotSource<T>);
|
|
36
|
+
getSnapshot: () => DndSessionSnapshot<T>;
|
|
37
|
+
getProviderSnapshot: () => DndSessionSnapshot<T>;
|
|
38
|
+
getZoneSnapshot: (zoneId: string, preserveSlots?: boolean | RetainSlotsRule) => DndZoneSnapshot;
|
|
39
|
+
/** A rule is consulted once per drag session so its answer cannot flip mid-drag. */
|
|
40
|
+
private retainSlots;
|
|
41
|
+
getItemSnapshot: (zoneId: string, itemId: string) => DndItemSnapshot | undefined;
|
|
42
|
+
subscribeSelection<Selection>(get: () => Selection, listener: () => void): () => void;
|
|
43
|
+
subscribeProvider: (listener: () => void) => (() => void);
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=dndRenderStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dndRenderStore.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dndRenderStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA0B,CAAC;AAEnE,KAAK,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI;IACpC,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACrC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,SAAS,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AA2ChE,8EAA8E;AAC9E,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO;IAUzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATnC,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,WAAW,CAA2D;IAC9E,OAAO,CAAC,KAAK,CAAmD;IAChE,OAAO,CAAC,eAAe,CAGnB;gBAEyB,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEzD,WAAW,QAAO,kBAAkB,CAAC,CAAC,CAAC,CAA8B;IAErE,mBAAmB,QAAO,kBAAkB,CAAC,CAAC,CAAC,CAgB7C;IAEF,eAAe,GACb,QAAQ,MAAM,EACd,gBAAe,OAAO,GAAG,eAAsB,KAC9C,eAAe,CAiDhB;IAEF,oFAAoF;IACpF,OAAO,CAAC,WAAW;IAuBnB,eAAe,GACb,QAAQ,MAAM,EACd,QAAQ,MAAM,KACb,eAAe,GAAG,SAAS,CA0C5B;IAEF,kBAAkB,CAAC,SAAS,EAC1B,GAAG,EAAE,MAAM,SAAS,EACpB,QAAQ,EAAE,MAAM,IAAI,GACnB,MAAM,IAAI;IAUb,iBAAiB,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CACM;CAC/D"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { HostInstance } from 'react-native';
|
|
3
|
+
import { type AnimatedRef, type SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import type { AutoScrollOptions, DragAxis } from '../adapters/scroll.js';
|
|
5
|
+
import type { GridLayoutZone, DndItem, LayoutPoint, LayoutRect, ListLayoutZone, MeasuredRect } from '../contracts.js';
|
|
6
|
+
import type { DndSessionSnapshot } from '../controller/dndSession.js';
|
|
7
|
+
import type { ListLayout } from '../engine/list.js';
|
|
8
|
+
import type { ListTargetIndex } from '../engine/listIndex.js';
|
|
9
|
+
import type { PreparedGridTarget } from '../pointer/layoutTarget.js';
|
|
10
|
+
import type { DndPresentation, DndZonePresentation } from './dndPresentation.js';
|
|
11
|
+
import type { LayoutValidationIssue } from '../contracts.js';
|
|
12
|
+
import type { CancelReason } from '../types.js';
|
|
13
|
+
import type { GridMotionConfig } from '../pointer/motion.js';
|
|
14
|
+
import type { ListItemRenderArgs } from '../components/dndTypes.js';
|
|
15
|
+
import type { GestureRelations, ZoneGeometry } from '../components/gridTypes.js';
|
|
16
|
+
import type { CellGeometry } from './gridRuntime.js';
|
|
17
|
+
import { DndRenderStore, type DndZoneSnapshot, type RetainSlotsRule } from './dndRenderStore.js';
|
|
18
|
+
type UiListRegistration = {
|
|
19
|
+
kind: 'list';
|
|
20
|
+
zoneId: string;
|
|
21
|
+
orientation: 'vertical' | 'horizontal';
|
|
22
|
+
revision: number;
|
|
23
|
+
layoutVersion: number;
|
|
24
|
+
ref: AnimatedRef<HostInstance>;
|
|
25
|
+
offset: SharedValue<number>;
|
|
26
|
+
contentSize: number;
|
|
27
|
+
autoScroll?: AutoScrollOptions;
|
|
28
|
+
targetIndex?: ListTargetIndex;
|
|
29
|
+
};
|
|
30
|
+
type UiGridRegistration = {
|
|
31
|
+
kind: 'grid';
|
|
32
|
+
zoneId: string;
|
|
33
|
+
revision: number;
|
|
34
|
+
layoutVersion: number;
|
|
35
|
+
ref: AnimatedRef<HostInstance>;
|
|
36
|
+
targetGrid?: PreparedGridTarget;
|
|
37
|
+
};
|
|
38
|
+
export type UiZoneRegistration = UiListRegistration | UiGridRegistration;
|
|
39
|
+
export type ListRegistration = Omit<UiListRegistration, 'layoutVersion'> & {
|
|
40
|
+
layout: ListLayout;
|
|
41
|
+
dataIdentity?: readonly DndItem<unknown>[];
|
|
42
|
+
prepareDisplay?(zone: ListLayoutZone, revision: number): DndZonePresentation | null;
|
|
43
|
+
renderItem(args: ListItemRenderArgs<unknown>): ReactNode;
|
|
44
|
+
};
|
|
45
|
+
export type GridRegistration = Omit<UiGridRegistration, 'layoutVersion'> & {
|
|
46
|
+
layout: GridLayoutZone;
|
|
47
|
+
geometry: ZoneGeometry;
|
|
48
|
+
cells: CellGeometry;
|
|
49
|
+
pixelRatio: number;
|
|
50
|
+
renderItem(args: ListItemRenderArgs<unknown>): ReactNode;
|
|
51
|
+
};
|
|
52
|
+
export type ZoneRegistration = ListRegistration | GridRegistration;
|
|
53
|
+
export type ListViewport = {
|
|
54
|
+
zoneId: string;
|
|
55
|
+
viewport: MeasuredRect<'screen'>;
|
|
56
|
+
offset: number;
|
|
57
|
+
layoutVersion: number;
|
|
58
|
+
};
|
|
59
|
+
export type DndMotion = {
|
|
60
|
+
token: number;
|
|
61
|
+
/** Provider-owned native recognizer; independent of virtual cell lifetime. */
|
|
62
|
+
handleId: number | null;
|
|
63
|
+
seq: number;
|
|
64
|
+
phase: 'idle' | 'dragging' | 'released';
|
|
65
|
+
itemId: string | null;
|
|
66
|
+
sourceZoneId: string | null;
|
|
67
|
+
revision: number;
|
|
68
|
+
pointer: LayoutPoint;
|
|
69
|
+
origin: LayoutPoint;
|
|
70
|
+
axis: DragAxis;
|
|
71
|
+
activationDelayMs: number;
|
|
72
|
+
configRevision: number;
|
|
73
|
+
grip: LayoutPoint;
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
root: LayoutRect;
|
|
77
|
+
zones: ListViewport[];
|
|
78
|
+
visible: boolean;
|
|
79
|
+
};
|
|
80
|
+
export declare const EMPTY_DND_MOTION: DndMotion;
|
|
81
|
+
export type DndRuntime = {
|
|
82
|
+
snapshot: DndSessionSnapshot<unknown>;
|
|
83
|
+
renderStore?: DndRenderStore;
|
|
84
|
+
motion: SharedValue<DndMotion>;
|
|
85
|
+
presentation?: SharedValue<DndPresentation>;
|
|
86
|
+
/** JS view of the presentation most recently scheduled for the UI runtime. */
|
|
87
|
+
presentationSnapshot?(): DndPresentation;
|
|
88
|
+
/** Shared committed revision keeps unchanged cell worklets stable on approval. */
|
|
89
|
+
committedRevision?: SharedValue<number>;
|
|
90
|
+
/** Provider frame owns measurements and semantic dispatch when enabled. */
|
|
91
|
+
frameDriven?: boolean;
|
|
92
|
+
zones: SharedValue<UiZoneRegistration[]>;
|
|
93
|
+
disabled: SharedValue<boolean>;
|
|
94
|
+
token: SharedValue<number>;
|
|
95
|
+
rootRef: AnimatedRef<HostInstance>;
|
|
96
|
+
dragAxis: DragAxis;
|
|
97
|
+
activationDelayMs: number;
|
|
98
|
+
gestureConfigRevision: number;
|
|
99
|
+
animation: Required<GridMotionConfig>;
|
|
100
|
+
begin(state: DndMotion): void;
|
|
101
|
+
move(state: DndMotion): void;
|
|
102
|
+
release(state: DndMotion, cancelled: boolean | CancelReason): void;
|
|
103
|
+
cancel(reason: CancelReason): void;
|
|
104
|
+
registerZone(registration: ZoneRegistration, identity: object): void;
|
|
105
|
+
unregisterZone(zoneId: string, identity: object): void;
|
|
106
|
+
registerHandle(registration: DndHandleRegistration, identity: object): void;
|
|
107
|
+
unregisterHandle(identity: object): void;
|
|
108
|
+
reportIssues(owner: string, issues: LayoutValidationIssue[]): void;
|
|
109
|
+
};
|
|
110
|
+
export type DndHandleRegistration = {
|
|
111
|
+
itemId: string;
|
|
112
|
+
zoneId: string;
|
|
113
|
+
ref: AnimatedRef<HostInstance>;
|
|
114
|
+
sourceRef: AnimatedRef<HostInstance>;
|
|
115
|
+
disabled: boolean;
|
|
116
|
+
gestureRelations?: GestureRelations;
|
|
117
|
+
};
|
|
118
|
+
export declare const DndRuntimeContext: import("react").Context<DndRuntime | null>;
|
|
119
|
+
export declare const DndItemContext: import("react").Context<{
|
|
120
|
+
itemId: string;
|
|
121
|
+
zoneId: string;
|
|
122
|
+
ref: AnimatedRef<HostInstance>;
|
|
123
|
+
preview?: boolean;
|
|
124
|
+
} | null>;
|
|
125
|
+
export declare function useDndRuntime(): DndRuntime;
|
|
126
|
+
export declare function useDndZoneSnapshot(runtime: DndRuntime, zoneId: string, preserveSlots?: boolean | RetainSlotsRule): DndZoneSnapshot;
|
|
127
|
+
export declare function useDndHandleActive(runtime: DndRuntime, itemId: string | undefined, disabled: boolean): boolean;
|
|
128
|
+
/** Public render arguments follow approved previews independently of native slots. */
|
|
129
|
+
export declare function useDndItemSnapshot(runtime: DndRuntime, zoneId: string, itemId: string): {
|
|
130
|
+
index: number;
|
|
131
|
+
row?: number;
|
|
132
|
+
col?: number;
|
|
133
|
+
} | undefined;
|
|
134
|
+
export declare function measureDndRect(ref: AnimatedRef<HostInstance>): LayoutRect | null;
|
|
135
|
+
export declare function readListViewports(zones: readonly UiZoneRegistration[]): ListViewport[];
|
|
136
|
+
export declare function pointInRect(point: LayoutPoint, rect: LayoutRect): boolean;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=dndRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dndRuntime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dndRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uBAAoB,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACb,MAAM,iBAAc,CAAC;AACtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM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;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,kBAAkB,EAAE,GACnC,YAAY,EAAE,CAwBhB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAQzE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LayoutPoint, LayoutRect } from '../contracts.js';
|
|
2
|
+
type SettlementGeometry = {
|
|
3
|
+
/** Root and viewport use screen coordinates; contentRect excludes scrolling. */
|
|
4
|
+
root: LayoutRect;
|
|
5
|
+
viewport: LayoutRect;
|
|
6
|
+
contentRect: LayoutRect;
|
|
7
|
+
nativeRect: LayoutRect | null;
|
|
8
|
+
scrollOffset: LayoutPoint;
|
|
9
|
+
pixelRatio?: number;
|
|
10
|
+
};
|
|
11
|
+
/** Resolve the committed logical slot without waiting for a native cell. */
|
|
12
|
+
export declare function settlementTarget({ root, viewport, contentRect, scrollOffset, pixelRatio, }: Omit<SettlementGeometry, 'nativeRect'>): LayoutRect | null;
|
|
13
|
+
/** Native alignment gates only the final handoff, not the overlay animation. */
|
|
14
|
+
export declare function settlementDestination({ root, viewport, contentRect, nativeRect, scrollOffset, pixelRatio, }: SettlementGeometry): LayoutRect | null;
|
|
15
|
+
/** Both rectangles use root coordinates; progress is the native animation value. */
|
|
16
|
+
export declare function interpolateSettlementRect(from: LayoutRect, to: LayoutRect, progress: number): LayoutRect | null;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=dndSettlement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dndSettlement.d.ts","sourceRoot":"","sources":["../../../../src/runtime/dndSettlement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAI5D,KAAK,kBAAkB,GAAG;IACxB,gFAAgF;IAChF,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,UAAU,CAAC;IACxB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAkBF,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAc,GACf,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,UAAU,GAAG,IAAI,CAyB5D;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAc,GACf,EAAE,kBAAkB,GAAG,UAAU,GAAG,IAAI,CA0BxC;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,MAAM,GACf,UAAU,GAAG,IAAI,CAWnB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { HostInstance } from 'react-native';
|
|
2
|
+
import type { AnimatedRef } from 'react-native-reanimated';
|
|
3
|
+
import type { GridMovementPolicy } from '../engine/movementPolicy.js';
|
|
4
|
+
import type { CellSpan, GridZone, ItemLocation } from '../types.js';
|
|
5
|
+
import type { ZoneGeometry } from '../components/gridTypes.js';
|
|
6
|
+
/**
|
|
7
|
+
* Geometry vocabulary of the grid pointer policy (`pointer/geometry.ts`),
|
|
8
|
+
* shared by the provider's layout targeting. The React runtime of the former
|
|
9
|
+
* grid controller no longer lives here.
|
|
10
|
+
*/
|
|
11
|
+
export type WindowRect = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
export type CellGeometry = {
|
|
18
|
+
cellWidth: number;
|
|
19
|
+
cellHeight: number;
|
|
20
|
+
};
|
|
21
|
+
export type ZoneRegistration = {
|
|
22
|
+
zone: GridZone<undefined>;
|
|
23
|
+
geometry: ZoneGeometry;
|
|
24
|
+
pixelRatio: number;
|
|
25
|
+
ref: AnimatedRef<HostInstance>;
|
|
26
|
+
};
|
|
27
|
+
export type MeasuredZone = Omit<ZoneRegistration, 'ref'> & {
|
|
28
|
+
rect: WindowRect;
|
|
29
|
+
cells: CellGeometry;
|
|
30
|
+
};
|
|
31
|
+
export type UiMotion = {
|
|
32
|
+
movementPolicy?: GridMovementPolicy;
|
|
33
|
+
baseRevision?: number;
|
|
34
|
+
token: number;
|
|
35
|
+
phase: 'idle' | 'dragging' | 'finalizing' | 'settling' | 'handoff';
|
|
36
|
+
itemId: string | null;
|
|
37
|
+
sourceZoneId: string | null;
|
|
38
|
+
seq: number;
|
|
39
|
+
target: ItemLocation | null;
|
|
40
|
+
span: CellSpan;
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
gripX: number;
|
|
46
|
+
gripY: number;
|
|
47
|
+
zones: MeasuredZone[];
|
|
48
|
+
outlet: WindowRect;
|
|
49
|
+
validity: 'pending' | 'valid' | 'invalid';
|
|
50
|
+
visible: boolean;
|
|
51
|
+
destination: WindowRect | null;
|
|
52
|
+
};
|
|
53
|
+
export declare const EMPTY_MOTION: UiMotion;
|
|
54
|
+
//# sourceMappingURL=gridRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridRuntime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/gridRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ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M,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC;CAChC,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,QAmB1B,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { MoveProposal, ProposalResponse } from './contracts.js';
|
|
2
|
+
import type { GridMovementPolicy } from './engine/movementPolicy.js';
|
|
3
|
+
export type CellPosition = {
|
|
4
|
+
row: number;
|
|
5
|
+
col: number;
|
|
6
|
+
};
|
|
7
|
+
export type CellSpan = {
|
|
8
|
+
rows: number;
|
|
9
|
+
cols: number;
|
|
10
|
+
};
|
|
11
|
+
/** Optional JS diagnostics; durations are not native rendering or GPU timings. */
|
|
12
|
+
export type GridDiagnosticEvent = {
|
|
13
|
+
type: 'timing';
|
|
14
|
+
name: 'compute-move' | 'input-validation' | 'candidate-validation' | 'policy';
|
|
15
|
+
durationMs: number;
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
attempts?: number;
|
|
18
|
+
status?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'lifecycle';
|
|
21
|
+
name: 'request' | 'request-coalesced' | 'release' | 'proposal' | 'response' | 'settling' | 'end';
|
|
22
|
+
timestampMs: number;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
};
|
|
25
|
+
export type ItemPlacement = 'insert' | 'exchange';
|
|
26
|
+
export type GridItem<T> = {
|
|
27
|
+
id: string;
|
|
28
|
+
span: CellSpan;
|
|
29
|
+
/** Caller-selected spatial behavior. Omitted means exchange, regardless of size. */
|
|
30
|
+
placement?: ItemPlacement;
|
|
31
|
+
data: T;
|
|
32
|
+
};
|
|
33
|
+
export type PositionedItem<T> = GridItem<T> & {
|
|
34
|
+
position: CellPosition;
|
|
35
|
+
};
|
|
36
|
+
export type SpatialZone<T> = {
|
|
37
|
+
id: string;
|
|
38
|
+
rows: number;
|
|
39
|
+
columns: number;
|
|
40
|
+
strategy: 'spatial';
|
|
41
|
+
items: PositionedItem<T>[];
|
|
42
|
+
};
|
|
43
|
+
export type OrderedZone<T> = {
|
|
44
|
+
id: string;
|
|
45
|
+
rows: number;
|
|
46
|
+
columns: number;
|
|
47
|
+
strategy: 'ordered';
|
|
48
|
+
itemSpan: CellSpan;
|
|
49
|
+
items: GridItem<T>[];
|
|
50
|
+
};
|
|
51
|
+
export type GridZone<T> = SpatialZone<T> | OrderedZone<T>;
|
|
52
|
+
export type GridValue<T> = {
|
|
53
|
+
zones: GridZone<T>[];
|
|
54
|
+
/** Increment on every external data/layout edit. Omit only for legacy control. */
|
|
55
|
+
revision?: number;
|
|
56
|
+
proposalResponse?: Omit<ProposalResponse, 'baseRevision'> & {
|
|
57
|
+
baseRevision?: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type RevisionedGridValue<T> = GridValue<T> & {
|
|
61
|
+
revision: number;
|
|
62
|
+
};
|
|
63
|
+
export type GridProposal<T> = MoveProposal<RevisionedGridValue<T>, ItemLocation>;
|
|
64
|
+
export type ValidationCode = 'invalid-structure' | 'duplicate-id' | 'invalid-dimension' | 'invalid-span' | 'invalid-placement' | 'missing-item-span' | 'span-mismatch' | 'invalid-position' | 'out-of-bounds' | 'overlap' | 'capacity-exceeded' | 'invalid-budget' | 'invalid-geometry' | 'invalid-configuration';
|
|
65
|
+
export type ValidationIssue = {
|
|
66
|
+
code: ValidationCode;
|
|
67
|
+
zoneId?: string;
|
|
68
|
+
itemId?: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
export type ValidationResult = {
|
|
72
|
+
valid: true;
|
|
73
|
+
} | {
|
|
74
|
+
valid: false;
|
|
75
|
+
issues: ValidationIssue[];
|
|
76
|
+
};
|
|
77
|
+
export type ZoneLayoutResult<T> = {
|
|
78
|
+
valid: true;
|
|
79
|
+
items: PositionedItem<T>[];
|
|
80
|
+
} | {
|
|
81
|
+
valid: false;
|
|
82
|
+
issues: ValidationIssue[];
|
|
83
|
+
};
|
|
84
|
+
export type PackInput<T> = {
|
|
85
|
+
items: readonly GridItem<T>[];
|
|
86
|
+
rows: number;
|
|
87
|
+
columns: number;
|
|
88
|
+
searchBudget: number;
|
|
89
|
+
};
|
|
90
|
+
export type PackResult<T> = {
|
|
91
|
+
status: 'ok';
|
|
92
|
+
placements: PositionedItem<T>[];
|
|
93
|
+
} | {
|
|
94
|
+
status: 'impossible';
|
|
95
|
+
} | {
|
|
96
|
+
status: 'unresolved';
|
|
97
|
+
} | {
|
|
98
|
+
status: 'invalid';
|
|
99
|
+
issues: ValidationIssue[];
|
|
100
|
+
};
|
|
101
|
+
export type ItemLocation = {
|
|
102
|
+
zoneId: string;
|
|
103
|
+
strategy: 'spatial';
|
|
104
|
+
position: CellPosition;
|
|
105
|
+
} | {
|
|
106
|
+
zoneId: string;
|
|
107
|
+
strategy: 'ordered';
|
|
108
|
+
index: number;
|
|
109
|
+
};
|
|
110
|
+
/** A logical target, after pointer conversion and hysteresis in the controller. */
|
|
111
|
+
export type MoveInput<T> = {
|
|
112
|
+
movementPolicy?: GridMovementPolicy;
|
|
113
|
+
value: GridValue<T>;
|
|
114
|
+
itemId: string;
|
|
115
|
+
to: ItemLocation;
|
|
116
|
+
searchBudget?: number;
|
|
117
|
+
};
|
|
118
|
+
export type MoveResult<T> = {
|
|
119
|
+
status: 'ok';
|
|
120
|
+
value: GridValue<T>;
|
|
121
|
+
from: ItemLocation;
|
|
122
|
+
to: ItemLocation;
|
|
123
|
+
changed: boolean;
|
|
124
|
+
attempts: number;
|
|
125
|
+
} | {
|
|
126
|
+
status: 'impossible' | 'unresolved';
|
|
127
|
+
attempts: number;
|
|
128
|
+
} | {
|
|
129
|
+
status: 'invalid';
|
|
130
|
+
issues: ValidationIssue[];
|
|
131
|
+
};
|
|
132
|
+
export type GridChange = {
|
|
133
|
+
sessionId: string;
|
|
134
|
+
/** Present when the input GridValue supplies a revision (including useGridState). */
|
|
135
|
+
baseRevision?: number;
|
|
136
|
+
itemId: string;
|
|
137
|
+
from: ItemLocation;
|
|
138
|
+
to: ItemLocation;
|
|
139
|
+
};
|
|
140
|
+
export type DragStartEvent = {
|
|
141
|
+
sessionId: string;
|
|
142
|
+
itemId: string;
|
|
143
|
+
sourceZoneId: string;
|
|
144
|
+
};
|
|
145
|
+
export type CanDropArgs<T> = {
|
|
146
|
+
item: GridItem<T>;
|
|
147
|
+
change: GridChange;
|
|
148
|
+
proposedValue: GridValue<T>;
|
|
149
|
+
};
|
|
150
|
+
export type DropDecision = {
|
|
151
|
+
allowed: true;
|
|
152
|
+
} | {
|
|
153
|
+
allowed: false;
|
|
154
|
+
reason?: string;
|
|
155
|
+
};
|
|
156
|
+
export type CleanupReason = 'input-changed' | 'geometry-changed' | 'zone-removed' | 'disabled' | 'unmounted';
|
|
157
|
+
/** Interruptions include every cancel reason a proposal can meet while it awaits a response. */
|
|
158
|
+
export type ProposalInterruptReason = CancelReason | 'response-missing' | 'change-handler-error';
|
|
159
|
+
export type CancelReason = CleanupReason | 'outside-zones' | 'invalid-target' | 'measure-failed' | 'policy-rejected' | 'search-budget' | 'unresolvable' | 'gesture-interrupted' | 'policy-error' | 'start-handler-error';
|
|
160
|
+
export type DragEndEvent = DragStartEvent & {
|
|
161
|
+
cleanupReason?: CleanupReason;
|
|
162
|
+
error?: unknown;
|
|
163
|
+
} & ({
|
|
164
|
+
outcome: 'unchanged';
|
|
165
|
+
} | {
|
|
166
|
+
outcome: 'cancelled';
|
|
167
|
+
targetZoneId?: string;
|
|
168
|
+
reason: CancelReason;
|
|
169
|
+
policyReason?: string;
|
|
170
|
+
} | ({
|
|
171
|
+
outcome: 'proposed';
|
|
172
|
+
change: GridChange;
|
|
173
|
+
targetZoneId: string;
|
|
174
|
+
} & ({
|
|
175
|
+
response: 'accepted' | 'rejected' | 'expired' | 'mismatch';
|
|
176
|
+
} | {
|
|
177
|
+
response: 'interrupted';
|
|
178
|
+
reason: ProposalInterruptReason;
|
|
179
|
+
})));
|
|
180
|
+
//# sourceMappingURL=types.d.ts.map
|