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 @@
|
|
|
1
|
+
{"version":3,"names":["PreviewPath","steps","committed","constructor","sameLocation","rebase","length","reset","resolve","origin","target","kind","base","cumulative","sync","index","findIndex","step","newest","value","push"],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AG,CAAC,CAAC;IAChD,OAAOY,MAAM,GACT;MAAEP,IAAI,EAAE,SAAS;MAAEC,IAAI,EAAEM,MAAM,CAACC,KAAK;MAAEN,UAAU,EAAE;IAAK,CAAC,GACzD;MAAEF,IAAI,EAAE,SAAS;MAAEC,IAAI,EAAEV,SAAS;MAAEW,UAAU,EAAE;IAAM,CAAC;EAC7D;;EAEA;EACAO,IAAIA,CAAClB,SAAgB,EAAEe,IAAkC,EAAQ;IAC/D,IAAI,CAACH,IAAI,CAACZ,SAAS,CAAC;IACpB,IAAI,CAACD,KAAK,CAACmB,IAAI,CAACH,IAAI,CAAC;EACvB;EAEQH,IAAIA,CAACZ,SAAgB,EAAQ;IACnC,IAAI,IAAI,CAACA,SAAS,KAAKA,SAAS,EAAE;IAClC,IAAI,IAAI,CAACA,SAAS,KAAK,IAAI,EACzB,KAAK,MAAMe,IAAI,IAAI,IAAI,CAAChB,KAAK,EAC3BgB,IAAI,CAACE,KAAK,GAAG,IAAI,CAACd,MAAM,CAACY,IAAI,CAACE,KAAK,EAAEjB,SAAS,CAAC;IACnD,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC5B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { diagnosticNow, emitDiagnostic } from "../diagnostics.js";
|
|
4
|
+
import { CoordinatorBase } from "./coordinatorBase.js";
|
|
5
|
+
|
|
6
|
+
/** Engine outcome normalized for both value shapes. */
|
|
7
|
+
|
|
8
|
+
export function candidateFailure(status) {
|
|
9
|
+
return status === 'impossible' ? 'unresolvable' : status === 'unresolved' ? 'search-budget' : 'invalid-target';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Snapshot fields every coordinator publishes; subclasses add their own. */
|
|
13
|
+
|
|
14
|
+
/** Session fields the shared candidate flow reads and writes. */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The drag session logic both coordinators share: request guards, the
|
|
18
|
+
* cumulative preview baseline, engine dispatch, the permission callback with
|
|
19
|
+
* its reentrancy guard, candidate publication and the final proposal. The
|
|
20
|
+
* value shape, engine call, snapshot fields and terminal transitions
|
|
21
|
+
* (cancel, unchanged, handoff) come from the subclass.
|
|
22
|
+
*/
|
|
23
|
+
export class SessionCore extends CoordinatorBase {
|
|
24
|
+
session = null;
|
|
25
|
+
disposed = false;
|
|
26
|
+
flushingDiagnostics = false;
|
|
27
|
+
constructor(initial, lastValidValue) {
|
|
28
|
+
super(initial);
|
|
29
|
+
this.lastValidValue = lastValidValue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The consumer's optional JS-only observer; exceptions never affect a drag. */
|
|
33
|
+
|
|
34
|
+
queueDiagnostic(observer, event) {
|
|
35
|
+
(this.diagnosticEvents ??= []).push({
|
|
36
|
+
observer,
|
|
37
|
+
event
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Diagnostics queued during a batch are delivered after its subscribers. */
|
|
42
|
+
batchFinished() {
|
|
43
|
+
if (this.diagnosticEvents) this.flushDiagnostics();
|
|
44
|
+
}
|
|
45
|
+
flushDiagnostics() {
|
|
46
|
+
if (this.flushingDiagnostics) return;
|
|
47
|
+
this.flushingDiagnostics = true;
|
|
48
|
+
try {
|
|
49
|
+
while (this.diagnosticEvents) {
|
|
50
|
+
const pending = this.diagnosticEvents;
|
|
51
|
+
this.diagnosticEvents = undefined;
|
|
52
|
+
for (const {
|
|
53
|
+
observer,
|
|
54
|
+
event
|
|
55
|
+
} of pending) emitDiagnostic(observer, event);
|
|
56
|
+
}
|
|
57
|
+
} finally {
|
|
58
|
+
this.flushingDiagnostics = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
lifecycle(name, session) {
|
|
62
|
+
const observer = this.diagnosticObserver();
|
|
63
|
+
if (!observer) return;
|
|
64
|
+
this.queueDiagnostic(observer, {
|
|
65
|
+
type: 'lifecycle',
|
|
66
|
+
name,
|
|
67
|
+
timestampMs: diagnosticNow(),
|
|
68
|
+
sessionId: session.sessionId
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Time one engine or policy step for the observer, including failures. */
|
|
73
|
+
timed(session, name, run, status, attempts = () => undefined) {
|
|
74
|
+
const observer = this.diagnosticObserver();
|
|
75
|
+
if (!observer) return run();
|
|
76
|
+
const startedAt = diagnosticNow();
|
|
77
|
+
let result;
|
|
78
|
+
try {
|
|
79
|
+
result = run();
|
|
80
|
+
return result;
|
|
81
|
+
} finally {
|
|
82
|
+
const count = result === undefined ? undefined : attempts(result);
|
|
83
|
+
this.queueDiagnostic(observer, {
|
|
84
|
+
type: 'timing',
|
|
85
|
+
name,
|
|
86
|
+
durationMs: diagnosticNow() - startedAt,
|
|
87
|
+
status: result === undefined ? 'error' : status(result),
|
|
88
|
+
...(count === undefined ? {} : {
|
|
89
|
+
attempts: count
|
|
90
|
+
}),
|
|
91
|
+
sessionId: session.sessionId
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
event(session) {
|
|
96
|
+
return {
|
|
97
|
+
sessionId: session.sessionId,
|
|
98
|
+
itemId: session.itemId,
|
|
99
|
+
sourceZoneId: session.sourceZoneId
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The live dragging session when the request sequence is acceptable. */
|
|
104
|
+
acceptsRequest(sessionId, seq, final) {
|
|
105
|
+
const session = this.session;
|
|
106
|
+
if (!session || session.sessionId !== sessionId || this.snapshot.phase !== 'dragging' || !Number.isSafeInteger(seq) || seq < 0 || (final ? seq < session.seq : seq <= session.seq)) return null;
|
|
107
|
+
return session;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Spatial targets accumulate previews; ordered/list targets never do. */
|
|
111
|
+
|
|
112
|
+
/** A failure detail that rejects the target before any computation. */
|
|
113
|
+
|
|
114
|
+
/** Whether a failed candidate leaves the earlier preview on screen. */
|
|
115
|
+
|
|
116
|
+
/** Runs the permission callback and validates its shape; may throw. */
|
|
117
|
+
|
|
118
|
+
/** Re-check a changed candidate after the callback ran; true when it stands. */
|
|
119
|
+
|
|
120
|
+
/** Store the proposal, arm the deadline and enter awaiting-response. */
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Compute, permit and publish the candidate for `session.target`. The
|
|
124
|
+
* subclass has already stored the target and its sequence on the session.
|
|
125
|
+
*/
|
|
126
|
+
calculateCandidate(session, final) {
|
|
127
|
+
const seq = session.seq;
|
|
128
|
+
const committed = this.lastValidValue;
|
|
129
|
+
const target = session.target;
|
|
130
|
+
if (!target || !committed) {
|
|
131
|
+
if (final) this.cancelWith('outside-zones');else this.showFailure(committed, 'outside-zones', false);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const rejected = this.precheck(session, target);
|
|
135
|
+
if (rejected !== null) {
|
|
136
|
+
session.path.reset();
|
|
137
|
+
if (final) this.cancelWith('invalid-target', undefined, rejected);else this.showFailure(committed, rejected, false);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const from = this.location(committed, session.itemId);
|
|
141
|
+
// Previews accumulate only inside the source zone: ordered targets are
|
|
142
|
+
// path-independent, and other zones keep computing from the committed
|
|
143
|
+
// value, so a cross-zone exchange stays impossible.
|
|
144
|
+
const accumulates = from !== null && this.isSpatial(target) && target.zoneId === session.sourceZoneId;
|
|
145
|
+
let baseline;
|
|
146
|
+
if (accumulates) baseline = session.path.resolve(committed, from, target);else {
|
|
147
|
+
session.path.reset();
|
|
148
|
+
baseline = {
|
|
149
|
+
kind: 'compute',
|
|
150
|
+
base: committed,
|
|
151
|
+
cumulative: false
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const result = baseline.kind === 'restored' ? {
|
|
155
|
+
status: 'ok',
|
|
156
|
+
value: baseline.step.value,
|
|
157
|
+
from: baseline.step.from,
|
|
158
|
+
to: baseline.step.to,
|
|
159
|
+
changed: true
|
|
160
|
+
} : this.compute(session, target, baseline, committed, from);
|
|
161
|
+
if (result.status !== 'ok') {
|
|
162
|
+
const failure = candidateFailure(result.status);
|
|
163
|
+
if (final) this.cancelWith(failure);else {
|
|
164
|
+
const keepPreview = this.keepsPreview(session, target, result.status);
|
|
165
|
+
if (!keepPreview) session.path.reset();
|
|
166
|
+
this.showFailure(committed, failure, keepPreview);
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const proposal = this.prepareProposal(session, result);
|
|
171
|
+
let decision;
|
|
172
|
+
try {
|
|
173
|
+
decision = this.timed(session, 'policy', () => this.askPolicy(session, committed, proposal, result), chosen => chosen.allowed ? 'allowed' : 'rejected');
|
|
174
|
+
} catch (error) {
|
|
175
|
+
this.policyFailed(session, seq, error);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
// A consumer callback may have synchronously changed or disposed the input.
|
|
179
|
+
if (this.session !== session || this.sessionEnded(session) || session.seq !== seq || this.snapshot.phase !== this.expectedPhase(final)) return;
|
|
180
|
+
if (!decision.allowed) {
|
|
181
|
+
if (final) this.cancelWith('policy-rejected', undefined, decision.reason);else {
|
|
182
|
+
session.path.reset();
|
|
183
|
+
this.showFailure(committed, 'policy-rejected', false);
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (result.changed && !this.revalidate(session, committed, proposal, result)) {
|
|
188
|
+
if (final) this.cancelWith('invalid-target');else {
|
|
189
|
+
session.path.reset();
|
|
190
|
+
this.showFailure(committed, 'invalid-target', false);
|
|
191
|
+
}
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.showCandidate(result);
|
|
195
|
+
if (baseline.kind === 'compute') {
|
|
196
|
+
if (accumulates && result.changed) session.path.push(committed, {
|
|
197
|
+
target,
|
|
198
|
+
from,
|
|
199
|
+
to: result.to,
|
|
200
|
+
value: result.value
|
|
201
|
+
});else session.path.reset();
|
|
202
|
+
}
|
|
203
|
+
if (!final) return;
|
|
204
|
+
if (!result.changed) {
|
|
205
|
+
this.finishUnchanged(session);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.registerProposal(session, proposal, result);
|
|
209
|
+
try {
|
|
210
|
+
this.emitChange(proposal, result);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
this.changeFailed(session, error);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Shape-check a permission callback result; the caller reports a throw. */
|
|
218
|
+
export function validatedDecision(decision) {
|
|
219
|
+
if (typeof decision !== 'object' || decision === null || typeof decision.allowed !== 'boolean') throw new TypeError('canDrop must return an allowed boolean decision.');
|
|
220
|
+
return decision;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=sessionCore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["diagnosticNow","emitDiagnostic","CoordinatorBase","candidateFailure","status","SessionCore","session","disposed","flushingDiagnostics","constructor","initial","lastValidValue","queueDiagnostic","observer","event","diagnosticEvents","push","batchFinished","flushDiagnostics","pending","undefined","lifecycle","name","diagnosticObserver","type","timestampMs","sessionId","timed","run","attempts","startedAt","result","count","durationMs","itemId","sourceZoneId","acceptsRequest","seq","final","snapshot","phase","Number","isSafeInteger","calculateCandidate","committed","target","cancelWith","showFailure","rejected","precheck","path","reset","from","location","accumulates","isSpatial","zoneId","baseline","resolve","kind","base","cumulative","value","step","to","changed","compute","failure","keepPreview","keepsPreview","proposal","prepareProposal","decision","askPolicy","chosen","allowed","error","policyFailed","sessionEnded","expectedPhase","reason","revalidate","showCandidate","finishUnchanged","registerProposal","emitChange","changeFailed","validatedDecision","TypeError"],"sourceRoot":"../../../src","sources":["controller/sessionCore.ts"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,cAAc,QACT,mBAAgB;AAQvB,SAASC,eAAe,QAAQ,sBAAmB;;AAGnD;;AAmBA,OAAO,SAASC,gBAAgBA,CAC9BC,MAA+C,EAC7B;EAClB,OAAOA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QAAQ,CAA2BG,OAAO,KAAK,SAAS,EAEhE,MAAM,IAAIa,SAAS,CAAC,kDAAkD,CAAC;EACzE,OAAOhB,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createDndStateStore } from "./dndState.js";
|
|
4
|
+
import { useStoreState } from "./useStoreState.js";
|
|
5
|
+
/** Own normalized state and synchronously acknowledge proposals; initialValue is read once. */
|
|
6
|
+
export function useDndState(initialValue) {
|
|
7
|
+
return useStoreState(() => createDndStateStore(typeof initialValue === 'function' ? initialValue() : initialValue));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useDndState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createDndStateStore","useStoreState","useDndState","initialValue"],"sourceRoot":"../../../src","sources":["controller/useDndState.ts"],"mappings":";;AAEA,SACEA,mBAAmB,QAGd,eAAY;AACnB,SAASC,aAAa,QAAQ,oBAAiB;AAS/C;AACA,OAAO,SAASC,WAAWA,CACzBC,YAAqD,EACxC;EACb,OAAOF,aAAa,CAAC,MACnBD,mBAAmB,CACjB,OAAOG,YAAY,KAAK,UAAU,GAAGA,YAAY,CAAC,CAAC,GAAGA,YACxD,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createGridStateStore } from "./gridState.js";
|
|
4
|
+
import { useStoreState } from "./useStoreState.js";
|
|
5
|
+
/** Own grid state and acknowledge proposals synchronously; initialValue is read once. */
|
|
6
|
+
export function useGridState(initialValue) {
|
|
7
|
+
return useStoreState(() => createGridStateStore(typeof initialValue === 'function' ? initialValue() : initialValue));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useGridState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createGridStateStore","useStoreState","useGridState","initialValue"],"sourceRoot":"../../../src","sources":["controller/useGridState.ts"],"mappings":";;AAEA,SAASA,oBAAoB,QAA6B,gBAAa;AACvE,SAASC,aAAa,QAAQ,oBAAiB;AAS/C;AACA,OAAO,SAASC,YAAYA,CAC1BC,YAAiD,EACnC;EACd,OAAOF,aAAa,CAAC,MACnBD,oBAAoB,CAClB,OAAOG,YAAY,KAAK,UAAU,GAAGA,YAAY,CAAC,CAAC,GAAGA,YACxD,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useState, useSyncExternalStore } from 'react';
|
|
4
|
+
/** Own one approval store for the component's lifetime and subscribe to it. */
|
|
5
|
+
export function useStoreState(create) {
|
|
6
|
+
const [store] = useState(create);
|
|
7
|
+
const value = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
8
|
+
return {
|
|
9
|
+
value,
|
|
10
|
+
onChange: store.onChange,
|
|
11
|
+
setValue: store.setValue,
|
|
12
|
+
respond: store.respond
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=useStoreState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","useSyncExternalStore","useStoreState","create","store","value","subscribe","getSnapshot","onChange","setValue","respond"],"sourceRoot":"../../../src","sources":["controller/useStoreState.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,oBAAoB,QAAQ,OAAO;AAUtD;AACA,OAAO,SAASC,aAAaA,CAC3BC,MAA4D,EACgB;EAC5E,MAAM,CAACC,KAAK,CAAC,GAAGJ,QAAQ,CAACG,MAAM,CAAC;EAChC,MAAME,KAAK,GAAGJ,oBAAoB,CAChCG,KAAK,CAACE,SAAS,EACfF,KAAK,CAACG,WAAW,EACjBH,KAAK,CAACG,WACR,CAAC;EACD,OAAO;IACLF,KAAK;IACLG,QAAQ,EAAEJ,KAAK,CAACI,QAAQ;IACxBC,QAAQ,EAAEL,KAAK,CAACK,QAAQ;IACxBC,OAAO,EAAEN,KAAK,CAACM;EACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Maximum search steps per grid calculation; exhaustion is not proof of no space. */
|
|
4
|
+
export const DEFAULT_SEARCH_BUDGET = 10_000;
|
|
5
|
+
/** Long press duration in milliseconds. */
|
|
6
|
+
export const DEFAULT_ACTIVATION_DELAY_MS = 250;
|
|
7
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_SEARCH_BUDGET","DEFAULT_ACTIVATION_DELAY_MS"],"sourceRoot":"../../src","sources":["defaults.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,qBAAqB,GAAG,MAAM;AAC3C;AACA,OAAO,MAAMC,2BAA2B,GAAG,GAAG","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function diagnosticNow() {
|
|
4
|
+
// RN provides this JS monotonic clock; ambient native declarations omit it.
|
|
5
|
+
return globalThis.performance.now();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Observers receive newly-created scalar payloads and cannot fail a drag. */
|
|
9
|
+
export function emitDiagnostic(observer, event) {
|
|
10
|
+
try {
|
|
11
|
+
observer(event);
|
|
12
|
+
} catch {
|
|
13
|
+
// Diagnostics must not alter placement, response or cleanup behavior.
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["diagnosticNow","globalThis","performance","now","emitDiagnostic","observer","event"],"sourceRoot":"../../src","sources":["diagnostics.ts"],"mappings":";;AAKA,OAAO,SAASA,aAAaA,CAAA,EAAW;EACtC;EACA,OACEC,UAAU,CACVC,WAAW,CAACC,GAAG,CAAC,CAAC;AACrB;;AAEA;AACA,OAAO,SAASC,cAAcA,CAC5BC,QAA4B,EAC5BC,KAA0B,EACpB;EACN,IAAI;IACFD,QAAQ,CAACC,KAAK,CAAC;EACjB,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function samePlacement(first, second) {
|
|
4
|
+
return first.itemId === second.itemId && first.position.row === second.position.row && first.position.col === second.position.col && first.span.rows === second.span.rows && first.span.cols === second.span.cols && first.placement === second.placement;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** Slot grid of an ordered zone: reading-order cells of one item span. */
|
|
8
|
+
|
|
9
|
+
export function orderedSlots(zone, itemSpan) {
|
|
10
|
+
return {
|
|
11
|
+
perRow: Math.floor(zone.columns / itemSpan.cols),
|
|
12
|
+
rows: Math.floor(zone.rows / itemSpan.rows)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The cell an ordered slot starts at; the caller guarantees `perRow > 0`. */
|
|
17
|
+
export function slotPosition(index, itemSpan, perRow) {
|
|
18
|
+
return {
|
|
19
|
+
row: Math.floor(index / perRow) * itemSpan.rows,
|
|
20
|
+
col: index % perRow * itemSpan.cols
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The reading-order slot a position starts, or null when it is not a slot origin. */
|
|
25
|
+
export function slotIndex(position, itemSpan, perRow) {
|
|
26
|
+
if (perRow <= 0 || position.row < 0 || position.col < 0 || position.row % itemSpan.rows !== 0 || position.col % itemSpan.cols !== 0) return null;
|
|
27
|
+
const col = position.col / itemSpan.cols;
|
|
28
|
+
if (col >= perRow) return null;
|
|
29
|
+
return position.row / itemSpan.rows * perRow + col;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Give ordered placements their reading-order positions, reusing an existing
|
|
34
|
+
* placement object whenever the item keeps the same slot.
|
|
35
|
+
*/
|
|
36
|
+
export function packOrderedPlacements(placements, itemSpan, perRow, previous = []) {
|
|
37
|
+
const existing = new Map(previous.map(item => [item.itemId, item]));
|
|
38
|
+
return placements.map((placement, index) => {
|
|
39
|
+
const packed = {
|
|
40
|
+
itemId: placement.itemId,
|
|
41
|
+
position: slotPosition(index, itemSpan, perRow),
|
|
42
|
+
span: {
|
|
43
|
+
rows: itemSpan.rows,
|
|
44
|
+
cols: itemSpan.cols
|
|
45
|
+
},
|
|
46
|
+
...(placement.placement === undefined ? {} : {
|
|
47
|
+
placement: placement.placement
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
const before = existing.get(placement.itemId);
|
|
51
|
+
return before && samePlacement(before, packed) ? before : packed;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=gridPlacements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["samePlacement","first","second","itemId","position","row","col","span","rows","cols","placement","orderedSlots","zone","itemSpan","perRow","Math","floor","columns","slotPosition","index","slotIndex","packOrderedPlacements","placements","previous","existing","Map","map","item","packed","undefined","before","get"],"sourceRoot":"../../../src","sources":["engine/gridPlacements.ts"],"mappings":";;AAGA,OAAO,SAASA,aAAaA,CAC3BC,KAAoB,EACpBC,MAAqB,EACZ;EACT,OACED,KAAK,CAACE,MAAM,KAAKD,MAAM,CAACC,MAAM,IAC9BF,KAAK,CAACG,QAAQ,CAACC,GAAG,KAAKH,MAAM,CAACE,QAAQ,CAACC,GAAG,IAC1CJ,KAAK,CAACG,QAAQ,CAACE,GAAG,KAAKJ,MAAM,CAACE,QAAQ,CAACE,GAAG,IAC1CL,KAAK,CAACM,IAAI,CAACC,IAAI,KAAKN,MAAM,CAACK,IAAI,CAACC,IAAI,IACpCP,KAAK,CAACM,IAAI,CAACE,IAAI,KAAKP,MAAM,CAACK,IAAI,CAACE,IAAI,IACpCR,KAAK,CAACS,SAAS,KAAKR,MAAM,CAACQ,S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;EACjB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACF,QAAQ,CAACG,GAAG,CAACC,IAAI,IAAI,CAACA,IAAI,CAACxB,MAAM,EAAEwB,IAAI,CAAC,CAAC,CAAC;EACnE,OAAOL,UAAU,CAACI,GAAG,CAAC,CAAChB,SAAS,EAAES,KAAK,KAAK;IAC1C,MAAMS,MAAqB,GAAG;MAC5BzB,MAAM,EAAEO,SAAS,CAACP,MAAM;MACxBC,QAAQ,EAAEc,YAAY,CAACC,KAAK,EAAEN,QAAQ,EAAEC,MAAM,CAAC;MAC/CP,IAAI,EAAE;QAAEC,IAAI,EAAEK,QAAQ,CAACL,IAAI;QAAEC,IAAI,EAAEI,QAAQ,CAACJ;MAAK,CAAC;MAClD,IAAIC,SAAS,CAACA,SAAS,KAAKmB,SAAS,GACjC,CAAC,CAAC,GACF;QAAEnB,SAAS,EAAEA,SAAS,CAACA;MAAU,CAAC;IACxC,CAAC;IACD,MAAMoB,MAAM,GAAGN,QAAQ,CAACO,GAAG,CAACrB,SAAS,CAACP,MAAM,CAAC;IAC7C,OAAO2B,MAAM,IAAI9B,aAAa,CAAC8B,MAAM,EAAEF,MAAM,CAAC,GAAGE,MAAM,GAAGF,MAAM;EAClE,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { computeZoneLayout } from "./layout.js";
|
|
4
|
+
export { resolveListVirtualization } from "../adapters/virtualizedList.js";
|
|
5
|
+
export { computeListLayout, computeListIndex, ListSizeCache } from "./list.js";
|
|
6
|
+
export { computeLayoutMove } from "./layoutMove.js";
|
|
7
|
+
export { createDndStateStore, respondToDndProposal } from "../controller/dndState.js";
|
|
8
|
+
export { computeAutoScroll, constrainDragPoint, validateAutoScrollOptions } from "../adapters/scroll.js";
|
|
9
|
+
export { validateLayoutState, fromGridValue, toGridValue } from "./layoutState.js";
|
|
10
|
+
export { screenToContent, contentToScreen, screenRectToContent, contentRectToScreen, validateRectMeasurement } from "../adapters/coordinates.js";
|
|
11
|
+
export { DEFAULT_SEARCH_BUDGET } from "../defaults.js";
|
|
12
|
+
export { createGridStateStore, respondToGridProposal } from "../controller/gridState.js";
|
|
13
|
+
export { computeMove } from "./move.js";
|
|
14
|
+
export { DEFAULT_GRID_MOVEMENT_POLICY, HOME_GRID_MOVEMENT_POLICY, resolveGridMovementPolicy, validateGridMovementPolicy } from "./movementPolicy.js";
|
|
15
|
+
export { computeOrderedIndex } from "./orderedTarget.js";
|
|
16
|
+
export { packItems } from "./pack.js";
|
|
17
|
+
export { hasSameLayout } from "./sameLayout.js";
|
|
18
|
+
export { validateValue } from "./validation.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computeZoneLayout","resolveListVirtualization","computeListLayout","computeListIndex","ListSizeCache","computeLayoutMove","createDndStateStore","respondToDndProposal","computeAutoScroll","constrainDragPoint","validateAutoScrollOptions","validateLayoutState","fromGridValue","toGridValue","screenToContent","contentToScreen","screenRectToContent","contentRectToScreen","validateRectMeasurement","DEFAULT_SEARCH_BUDGET","createGridStateStore","respondToGridProposal","computeMove","DEFAULT_GRID_MOVEMENT_POLICY","HOME_GRID_MOVEMENT_POLICY","resolveGridMovementPolicy","validateGridMovementPolicy","computeOrderedIndex","packItems","hasSameLayout","validateValue"],"sourceRoot":"../../../src","sources":["engine/index.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,aAAU;AAC5C,SAASC,yBAAyB,QAAQ,gCAA6B;AAKvE,SAASC,iBAAiB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,WAAQ;AAQ3E,SAASC,iBAAiB,QAAQ,iBAAc;AAMhD,SACEC,mBAAmB,EACnBC,oBAAoB,QACf,2BAAwB;AAQ/B,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,yBAAyB,QACpB,uBAAoB;AAS3B,SAASC,mBAAmB,EAAEC,aAAa,EAAEC,WAAW,QAAQ,kBAAe;AAC/E,SACEC,eAAe,EACfC,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,EACnBC,uBAAuB,QAClB,4BAAyB;AAChC,SAASC,qBAAqB,QAAQ,gBAAa;AACnD,SACEC,oBAAoB,EACpBC,qBAAqB,QAChB,4BAAyB;AAOhC,SAASC,WAAW,QAAQ,WAAQ;AACpC,SACEC,4BAA4B,EAC5BC,yBAAyB,EACzBC,yBAAyB,EACzBC,0BAA0B,QACrB,qBAAkB;AAOzB,SAASC,mBAAmB,QAAQ,oBAAiB;AACrD,SAASC,SAAS,QAAQ,WAAQ;AAClC,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,aAAa,QAAQ,iBAAc","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { validateZone } from "./validation.js";
|
|
4
|
+
|
|
5
|
+
/** Compute cell positions only. This never packs or changes the supplied zone. */
|
|
6
|
+
export function computeZoneLayout(zone) {
|
|
7
|
+
const validation = validateZone(zone);
|
|
8
|
+
if (!validation.valid) {
|
|
9
|
+
return validation;
|
|
10
|
+
}
|
|
11
|
+
if (zone.strategy === 'spatial') {
|
|
12
|
+
return {
|
|
13
|
+
valid: true,
|
|
14
|
+
items: zone.items.slice()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// A valid empty zone can have zero slots; avoid any division in that case.
|
|
18
|
+
if (zone.items.length === 0) {
|
|
19
|
+
return {
|
|
20
|
+
valid: true,
|
|
21
|
+
items: []
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const slotsPerRow = Math.floor(zone.columns / zone.itemSpan.cols);
|
|
25
|
+
return {
|
|
26
|
+
valid: true,
|
|
27
|
+
items: zone.items.map((item, index) => ({
|
|
28
|
+
...item,
|
|
29
|
+
position: {
|
|
30
|
+
row: Math.floor(index / slotsPerRow) * zone.itemSpan.rows,
|
|
31
|
+
col: index % slotsPerRow * zone.itemSpan.cols
|
|
32
|
+
}
|
|
33
|
+
}))
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["validateZone","computeZoneLayout","zone","validation","valid","strategy","items","slice","length","slotsPerRow","Math","floor","columns","itemSpan","cols","map","item","index","position","row","rows","col"],"sourceRoot":"../../../src","sources":["engine/layout.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,iBAAc;;AAE3C;AACA,OAAO,SAASC,iBAAiBA,CAAIC,IAAiB,EAAuB;EAC3E,MAAMC,UAAU,GAAGH,YAAY,CAACE,IAAI,CAAC;EACrC,IAAI,CAACC,UAAU,CAACC,KAAK,EAAE;IACrB,OAAOD,UAAU;EACnB;EACA,IAAID,IAAI,CAACG,QAAQ,KAAK,SAAS,EAAE;IAC/B,OAAO;MAAED,KAAK,EAAE,IAAI;MAAEE,KAAK,EAAEJ,IAAI,CAACI,KAAK,CAACC,KAAK,CAAC;IAAE,CAAC;EACnD;EACA;EACA,IAAIL,IAAI,CAACI,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAO;MAAEJ,KAAK,EAAE,IAAI;MAAEE,KAAK,EAAE;IAAG,CAAC;EACnC;EACA,MAAMG,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACT,IAAI,CAACU,OAAO,GAAGV,IAAI,CAACW,QAAQ,CAACC,IAAI,CAAC;EACjE,OAAO;IACLV,KAAK,EAAE,IAAI;IACXE,KAAK,EAAEJ,IAAI,CAACI,KAAK,CAACS,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,MAAM;MACtC,GAAGD,IAAI;MACPE,QAAQ,EAAE;QACRC,GAAG,EAAET,IAAI,CAACC,KAAK,CAACM,KAAK,GAAGR,WAAW,CAAC,GAAGP,IAAI,CAACW,QAAQ,CAACO,IAAI;QACzDC,GAAG,EAAGJ,KAAK,GAAGR,WAAW,GAAIP,IAAI,CAACW,QAAQ,CAACC;MAC7C;IACF,CAAC,CAAC;EACJ,CAAC;AACH","ignoreList":[]}
|