react-native-gtkx 0.3.0-alpha.1 → 0.4.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +1 -1
  2. package/dist/adw/index.d.ts +3 -2
  3. package/dist/adw/index.js +21 -4
  4. package/dist/adw/index.js.map +1 -1
  5. package/dist/adw/widgets.generated.d.ts +1 -1
  6. package/dist/adw/widgets.generated.js +2 -2
  7. package/dist/adw/widgets.generated.js.map +1 -1
  8. package/dist/animated/create-animated.d.ts +2 -0
  9. package/dist/animated/create-animated.js +2 -0
  10. package/dist/animated/create-animated.js.map +1 -1
  11. package/dist/animated/event.d.ts +15 -0
  12. package/dist/animated/event.js +80 -0
  13. package/dist/animated/event.js.map +1 -0
  14. package/dist/animated/index.d.ts +4 -0
  15. package/dist/animated/index.js +8 -0
  16. package/dist/animated/index.js.map +1 -1
  17. package/dist/animated/spring.d.ts +10 -0
  18. package/dist/animated/spring.js +20 -6
  19. package/dist/animated/spring.js.map +1 -1
  20. package/dist/animated/timing.d.ts +10 -0
  21. package/dist/animated/timing.js +21 -13
  22. package/dist/animated/timing.js.map +1 -1
  23. package/dist/apis/host.gtkx.js +70 -11
  24. package/dist/apis/host.gtkx.js.map +1 -1
  25. package/dist/common/navigation-stack.d.ts +6 -3
  26. package/dist/common/navigation-stack.js +8 -1
  27. package/dist/common/navigation-stack.js.map +1 -1
  28. package/dist/common/widget.js +2 -11
  29. package/dist/common/widget.js.map +1 -1
  30. package/dist/components/animated.d.ts +1 -0
  31. package/dist/components/animated.js +28 -4
  32. package/dist/components/animated.js.map +1 -1
  33. package/dist/components/app-registry.js +32 -8
  34. package/dist/components/app-registry.js.map +1 -1
  35. package/dist/components/request-animation-frame.d.ts +33 -0
  36. package/dist/components/request-animation-frame.js +83 -0
  37. package/dist/components/request-animation-frame.js.map +1 -0
  38. package/dist/components/scroll-view.js +60 -2
  39. package/dist/components/scroll-view.js.map +1 -1
  40. package/dist/components/virtualized-list.js +1 -4
  41. package/dist/components/virtualized-list.js.map +1 -1
  42. package/dist/dnd/autoscroll.d.ts +44 -0
  43. package/dist/dnd/autoscroll.js +176 -0
  44. package/dist/dnd/autoscroll.js.map +1 -0
  45. package/dist/dnd/grid-order.d.ts +45 -0
  46. package/dist/dnd/grid-order.js +151 -0
  47. package/dist/dnd/grid-order.js.map +1 -0
  48. package/dist/dnd/grid.d.ts +44 -0
  49. package/dist/dnd/grid.js +397 -0
  50. package/dist/dnd/grid.js.map +1 -0
  51. package/dist/dnd/gtk-controllers.d.ts +16 -2
  52. package/dist/dnd/gtk-controllers.js +23 -3
  53. package/dist/dnd/gtk-controllers.js.map +1 -1
  54. package/dist/dnd/index.d.ts +4 -2
  55. package/dist/dnd/index.js +9 -2
  56. package/dist/dnd/index.js.map +1 -1
  57. package/dist/dnd/order-state.d.ts +14 -0
  58. package/dist/dnd/order-state.js +55 -0
  59. package/dist/dnd/order-state.js.map +1 -0
  60. package/dist/dnd/order.d.ts +19 -0
  61. package/dist/dnd/order.js +19 -0
  62. package/dist/dnd/order.js.map +1 -1
  63. package/dist/dnd/sortable.d.ts +29 -4
  64. package/dist/dnd/sortable.js +308 -115
  65. package/dist/dnd/sortable.js.map +1 -1
  66. package/dist/dnd/types.d.ts +236 -14
  67. package/dist/dnd/types.js +30 -0
  68. package/dist/dnd/types.js.map +1 -1
  69. package/dist/gesture-handler-compat/attach-context.d.ts +29 -0
  70. package/dist/gesture-handler-compat/attach-context.js +90 -0
  71. package/dist/gesture-handler-compat/attach-context.js.map +1 -0
  72. package/dist/gesture-handler-compat/detector-runtime.d.ts +14 -3
  73. package/dist/gesture-handler-compat/detector-runtime.js +15 -5
  74. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -1
  75. package/dist/gesture-handler-compat/detector.js +57 -2
  76. package/dist/gesture-handler-compat/detector.js.map +1 -1
  77. package/dist/gesture-handler-compat/gesture-state-manager.d.ts +5 -0
  78. package/dist/gesture-handler-compat/gesture-state-manager.js +77 -0
  79. package/dist/gesture-handler-compat/gesture-state-manager.js.map +1 -0
  80. package/dist/gesture-handler-compat/index.d.ts +2 -2
  81. package/dist/gesture-handler-compat/index.js +38 -33
  82. package/dist/gesture-handler-compat/index.js.map +1 -1
  83. package/dist/gesture-handler-compat/recognizer.d.ts +12 -1
  84. package/dist/gesture-handler-compat/recognizer.js +23 -9
  85. package/dist/gesture-handler-compat/recognizer.js.map +1 -1
  86. package/dist/gesture-handler-compat/tag-registry.d.ts +14 -0
  87. package/dist/gesture-handler-compat/tag-registry.js +19 -0
  88. package/dist/gesture-handler-compat/tag-registry.js.map +1 -0
  89. package/dist/globals/index.d.ts +47 -0
  90. package/dist/globals/index.js +181 -0
  91. package/dist/globals/index.js.map +1 -0
  92. package/dist/globals/install.d.ts +1 -0
  93. package/dist/globals/install.js +14 -0
  94. package/dist/globals/install.js.map +1 -0
  95. package/dist/gtkx/bridge/adw-namespace.d.ts +2 -0
  96. package/dist/gtkx/bridge/adw-namespace.js +26 -0
  97. package/dist/gtkx/bridge/adw-namespace.js.map +1 -0
  98. package/dist/gtkx/bridge/adw.d.ts +23 -0
  99. package/dist/gtkx/bridge/adw.js +93 -0
  100. package/dist/gtkx/bridge/adw.js.map +1 -0
  101. package/dist/gtkx/bridge/color-scheme-parse.d.ts +11 -0
  102. package/dist/gtkx/bridge/color-scheme-parse.js +42 -0
  103. package/dist/gtkx/bridge/color-scheme-parse.js.map +1 -0
  104. package/dist/gtkx/bridge/color-scheme-portal.d.ts +24 -0
  105. package/dist/gtkx/bridge/color-scheme-portal.js +172 -0
  106. package/dist/gtkx/bridge/color-scheme-portal.js.map +1 -0
  107. package/dist/gtkx/bridge/core.d.ts +25 -0
  108. package/dist/gtkx/bridge/core.js +69 -0
  109. package/dist/gtkx/bridge/core.js.map +1 -0
  110. package/dist/gtkx/bridge/drag-layer.d.ts +27 -0
  111. package/dist/gtkx/bridge/drag-layer.js +177 -0
  112. package/dist/gtkx/bridge/drag-layer.js.map +1 -0
  113. package/dist/gtkx/bridge/index.d.ts +1 -27
  114. package/dist/gtkx/bridge/index.js +12 -71
  115. package/dist/gtkx/bridge/index.js.map +1 -1
  116. package/dist/gtkx/bridge/widgets.generated.adw.d.ts +1 -0
  117. package/dist/gtkx/bridge/widgets.generated.adw.js +16 -0
  118. package/dist/gtkx/bridge/widgets.generated.adw.js.map +1 -0
  119. package/dist/gtkx/bridge/widgets.generated.d.ts +0 -1
  120. package/dist/gtkx/bridge/widgets.generated.js +3 -3
  121. package/dist/gtkx/bridge/widgets.generated.js.map +1 -1
  122. package/dist/index.js +20 -0
  123. package/dist/index.js.map +1 -1
  124. package/dist/mcp/data/generated.d.ts +41 -20
  125. package/dist/mcp/data/generated.js +46 -20
  126. package/dist/mcp/data/generated.js.map +1 -1
  127. package/dist/metro/index.d.ts +1 -0
  128. package/dist/metro/index.js +12 -0
  129. package/dist/metro/index.js.map +1 -1
  130. package/dist/navigation/sidebar.js +2 -45
  131. package/dist/navigation/sidebar.js.map +1 -1
  132. package/dist/reanimated-compat/animatable-value.d.ts +158 -0
  133. package/dist/reanimated-compat/animatable-value.js +316 -0
  134. package/dist/reanimated-compat/animatable-value.js.map +1 -0
  135. package/dist/reanimated-compat/animation.d.ts +34 -13
  136. package/dist/reanimated-compat/animation.js +97 -25
  137. package/dist/reanimated-compat/animation.js.map +1 -1
  138. package/dist/reanimated-compat/mutable.js +6 -6
  139. package/dist/reanimated-compat/mutable.js.map +1 -1
  140. package/dist/reanimated-compat/updater-animations.js +32 -12
  141. package/dist/reanimated-compat/updater-animations.js.map +1 -1
  142. package/dist/runner/host-dev.js +5 -1
  143. package/dist/runner/host-dev.js.map +1 -1
  144. package/dist/runner/host.js +9 -1
  145. package/dist/runner/host.js.map +1 -1
  146. package/dist/vite/index.js +130 -0
  147. package/dist/vite/index.js.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/gtkx/bridge/theme.d.ts +0 -4
  150. package/dist/gtkx/bridge/theme.js +0 -5
  151. package/dist/gtkx/bridge/theme.js.map +0 -1
package/dist/dnd/index.js CHANGED
@@ -20,8 +20,15 @@ export { DropProvider, useDropContext } from "./context";
20
20
  export { Draggable, DraggableHandle, useDraggable, } from "./draggable";
21
21
  export { Droppable, useDroppable } from "./droppable";
22
22
  export { clamp, listToObject, objectMove } from "./order";
23
- export { Sortable, SortableItem, useSortable, useSortableList, } from "./sortable";
24
- export { DraggableState, HorizontalScrollDirection, ScrollDirection, SortableDirection, } from "./types";
23
+ export { Sortable, SortableItem, useHorizontalSortable, useHorizontalSortableList, useSortable, useSortableList, } from "./sortable";
24
+ export { SortableGrid, SortableGridItem, useGridSortable, useGridSortableList, } from "./grid";
25
+ // The pure grid arithmetic — worklets upstream, plain functions here, same
26
+ // reasoning as `clamp`/`listToObject`/`objectMove` above. `setGridPosition`/
27
+ // `setGridAutoScroll` are NOT re-exported, for the same reason
28
+ // `setPosition`/`setAutoScroll` are not: both mutate a SharedValue mid-
29
+ // gesture, and there is no gesture on the UI thread here to drive them.
30
+ export { calculateGridContentDimensions, calculateGridPosition, calculateIndexFromRowColumn, findItemIdAtIndex, getGridCellFromCoordinates, listToGridObject, reorderGridInsert, reorderGridSwap, } from "./grid-order";
31
+ export { DraggableState, GridOrientation, GridScrollDirection, GridStrategy, HorizontalScrollDirection, ScrollDirection, SortableDirection, } from "./types";
25
32
  // Upstream exports these from `components/sortableUtils`; they are worklet
26
33
  // helpers there, plain functions here. `setPosition` and `setAutoScroll`
27
34
  // mutate a SharedValue during a UI-thread gesture — there is no gesture on
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dnd/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,wDAAwD;AACxD,oEAAoE;AACpE,sBAAsB;AACtB,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AAEvE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,GASb,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,eAAe,EACf,iBAAiB,GAyBlB,MAAM,SAAS,CAAA;AAEhB,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE","sourcesContent":["// react-native-gtkx/dnd — `react-native-reanimated-dnd`'s API, on GTK's own\n// drag-and-drop.\n//\n// WHY this is a subpath of its own rather than part of `common` or `gtk`.\n// `common` is Adwaita's LOOK written in portable React Native; this is\n// behaviour, and GTK behaviour at that. `gtk` exists on the premise that the\n// import is the signal an app is crossing into Linux-only code — and this\n// module's premise is the exact opposite: the app's import should not change\n// at all, so the specifier has to be ALIASABLE. `react-native-gtkx/svg` is\n// the precedent, and the Metro and Vite presets rewrite\n// `react-native-reanimated-dnd` onto this the same way they rewrite\n// `react-native-svg`.\n//\n// The library itself cannot run here: Reanimated 4, worklets and RNGH at\n// module scope in twelve of its files, with the sort algorithm inside\n// `useAnimatedReaction` and the row layout inside `useAnimatedStyle`. The\n// evidence, and the prop-by-prop account of what this mirror honours and\n// what it deliberately does not, is in docs/research/drag-and-drop.md.\n\nexport { DropProvider, useDropContext } from \"./context\"\n\nexport {\n Draggable,\n DraggableHandle,\n useDraggable,\n // What `useDraggable` actually returns. `UseDraggableReturn` below is the\n // mirrored half (upstream's field names); this adds the two fields a\n // caller rendering its own view cannot do without — the measurable ref and\n // the drag source itself. Unexported, the hook's own documented use case\n // (\"for a component that owns its own view\") could not be typed by the\n // component that owns it; porting upstream's `CustomDraggable` is what\n // found that.\n type UseDraggableResult,\n} from \"./draggable\"\n\nexport { Droppable, useDroppable } from \"./droppable\"\n\nexport { clamp, listToObject, objectMove } from \"./order\"\n\nexport {\n Sortable,\n SortableItem,\n useSortable,\n useSortableList,\n} from \"./sortable\"\n\nexport {\n DraggableState,\n HorizontalScrollDirection,\n ScrollDirection,\n SortableDirection,\n type AnimationFunction,\n type CollisionAlgorithm,\n type DraggableHandleProps,\n type DraggableProps,\n type DropAlignment,\n type DroppableProps,\n type DroppedItemsMap,\n type DropOffset,\n type DropProviderProps,\n type DropProviderRef,\n type SharedValueLike,\n type SortableData,\n type SortableHandleProps,\n type SortableItemProps,\n type SortableProps,\n type SortableRenderItemProps,\n type UseDraggableOptions,\n type UseDraggableReturn,\n type UseDroppableOptions,\n type UseDroppableReturn,\n type UseSortableListOptions,\n type UseSortableListReturn,\n type UseSortableOptions,\n type UseSortableReturn,\n} from \"./types\"\n\n// Upstream exports these from `components/sortableUtils`; they are worklet\n// helpers there, plain functions here. `setPosition` and `setAutoScroll`\n// mutate a SharedValue during a UI-thread gesture — there is no gesture on\n// the UI thread here, so they would have nothing to drive and are NOT\n// re-exported. An app that imported them was reaching into upstream's\n// internals; the build failing at that import is the correct outcome.\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dnd/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,wDAAwD;AACxD,oEAAoE;AACpE,sBAAsB;AACtB,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AAEvE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,GASb,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,GACpB,MAAM,QAAQ,CAAA;AAEf,2EAA2E;AAC3E,6EAA6E;AAC7E,+DAA+D;AAC/D,wEAAwE;AACxE,wEAAwE;AACxE,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,eAAe,EACf,iBAAiB,GAyClB,MAAM,SAAS,CAAA;AAEhB,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE","sourcesContent":["// react-native-gtkx/dnd — `react-native-reanimated-dnd`'s API, on GTK's own\n// drag-and-drop.\n//\n// WHY this is a subpath of its own rather than part of `common` or `gtk`.\n// `common` is Adwaita's LOOK written in portable React Native; this is\n// behaviour, and GTK behaviour at that. `gtk` exists on the premise that the\n// import is the signal an app is crossing into Linux-only code — and this\n// module's premise is the exact opposite: the app's import should not change\n// at all, so the specifier has to be ALIASABLE. `react-native-gtkx/svg` is\n// the precedent, and the Metro and Vite presets rewrite\n// `react-native-reanimated-dnd` onto this the same way they rewrite\n// `react-native-svg`.\n//\n// The library itself cannot run here: Reanimated 4, worklets and RNGH at\n// module scope in twelve of its files, with the sort algorithm inside\n// `useAnimatedReaction` and the row layout inside `useAnimatedStyle`. The\n// evidence, and the prop-by-prop account of what this mirror honours and\n// what it deliberately does not, is in docs/research/drag-and-drop.md.\n\nexport { DropProvider, useDropContext } from \"./context\"\n\nexport {\n Draggable,\n DraggableHandle,\n useDraggable,\n // What `useDraggable` actually returns. `UseDraggableReturn` below is the\n // mirrored half (upstream's field names); this adds the two fields a\n // caller rendering its own view cannot do without — the measurable ref and\n // the drag source itself. Unexported, the hook's own documented use case\n // (\"for a component that owns its own view\") could not be typed by the\n // component that owns it; porting upstream's `CustomDraggable` is what\n // found that.\n type UseDraggableResult,\n} from \"./draggable\"\n\nexport { Droppable, useDroppable } from \"./droppable\"\n\nexport { clamp, listToObject, objectMove } from \"./order\"\n\nexport {\n Sortable,\n SortableItem,\n useHorizontalSortable,\n useHorizontalSortableList,\n useSortable,\n useSortableList,\n} from \"./sortable\"\n\nexport {\n SortableGrid,\n SortableGridItem,\n useGridSortable,\n useGridSortableList,\n} from \"./grid\"\n\n// The pure grid arithmetic — worklets upstream, plain functions here, same\n// reasoning as `clamp`/`listToObject`/`objectMove` above. `setGridPosition`/\n// `setGridAutoScroll` are NOT re-exported, for the same reason\n// `setPosition`/`setAutoScroll` are not: both mutate a SharedValue mid-\n// gesture, and there is no gesture on the UI thread here to drive them.\nexport {\n calculateGridContentDimensions,\n calculateGridPosition,\n calculateIndexFromRowColumn,\n findItemIdAtIndex,\n getGridCellFromCoordinates,\n listToGridObject,\n reorderGridInsert,\n reorderGridSwap,\n} from \"./grid-order\"\n\nexport {\n DraggableState,\n GridOrientation,\n GridScrollDirection,\n GridStrategy,\n HorizontalScrollDirection,\n ScrollDirection,\n SortableDirection,\n type AnimationFunction,\n type CollisionAlgorithm,\n type DraggableHandleProps,\n type DraggableProps,\n type DropAlignment,\n type DroppableProps,\n type DroppedItemsMap,\n type DropOffset,\n type DropProviderProps,\n type DropProviderRef,\n type GridCallbacks,\n type GridDimensions,\n type GridItemPlumbing,\n type GridPosition,\n type GridPositions,\n type SharedValueLike,\n type SortableData,\n type SortableGridItemProps,\n type SortableGridProps,\n type SortableGridRenderItemProps,\n type SortableHandleProps,\n type SortableItemProps,\n type SortableProps,\n type SortableRenderItemProps,\n type UseDraggableOptions,\n type UseDraggableReturn,\n type UseDroppableOptions,\n type UseDroppableReturn,\n type UseGridSortableListOptions,\n type UseGridSortableListReturn,\n type UseGridSortableOptions,\n type UseGridSortableReturn,\n type UseHorizontalSortableListOptions,\n type UseHorizontalSortableListReturn,\n type UseHorizontalSortableOptions,\n type UseHorizontalSortableReturn,\n type UseSortableListOptions,\n type UseSortableListReturn,\n type UseSortableOptions,\n type UseSortableReturn,\n} from \"./types\"\n\n// Upstream exports these from `components/sortableUtils`; they are worklet\n// helpers there, plain functions here. `setPosition` and `setAutoScroll`\n// mutate a SharedValue during a UI-thread gesture — there is no gesture on\n// the UI thread here, so they would have nothing to drive and are NOT\n// re-exported. An app that imported them was reaching into upstream's\n// internals; the build failing at that import is the correct outcome.\n"]}
@@ -0,0 +1,14 @@
1
+ import { type Dispatch, type SetStateAction } from "react";
2
+ import type { SortableData } from "./types";
3
+ export declare const keyOf: <TData extends SortableData>(item: TData, index: number, extractor?: (item: TData, index: number) => string) => string;
4
+ export type OrderState<TData> = {
5
+ /** Namespaces this list's payloads, so dragging a row does not light up
6
+ * every `Droppable` on the screen. */
7
+ scope: string;
8
+ order: string[];
9
+ setOrder: Dispatch<SetStateAction<string[]>>;
10
+ items: TData[];
11
+ };
12
+ /** The order state, shared by every `use*SortableList` hook and every list
13
+ * component (`Sortable`, `SortableGrid`) in this module. */
14
+ export declare const useOrder: <TData extends SortableData>(data: TData[], itemKeyExtractor?: (item: TData, index: number) => string) => OrderState<TData>;
@@ -0,0 +1,55 @@
1
+ // The order-owning state shared by every list shape in this module: the
2
+ // plain vertical `Sortable`, the horizontal direction of the same component,
3
+ // and `SortableGrid`. All three keep the SAME representation — an ARRAY of
4
+ // ids, index 0..N-1 — because that is what upstream's own `listToObject` /
5
+ // `listToGridObject` build from a list on mount, and reducing every reorder
6
+ // back to "produce a new array in this order" is what lets one hook serve
7
+ // a row, a column and a grid cell alike (a grid's `GridPositions` is just
8
+ // this array run through `calculateGridPosition`; see grid-order.ts).
9
+ import { useMemo, useState } from "react";
10
+ import { nextDraggableId } from "./payload";
11
+ export const keyOf = (item, index, extractor) => extractor?.(item, index) ?? item.id;
12
+ /** The order state, shared by every `use*SortableList` hook and every list
13
+ * component (`Sortable`, `SortableGrid`) in this module. */
14
+ export const useOrder = (data, itemKeyExtractor) => {
15
+ // Lazy initial state, not a ref: stable for the list's lifetime, and a ref
16
+ // may not be read during render.
17
+ const [scope] = useState(() => `sortable-${nextDraggableId()}`);
18
+ const incoming = useMemo(() => data.map((item, index) => keyOf(item, index, itemKeyExtractor)), [data, itemKeyExtractor]);
19
+ const [order, setOrder] = useState(incoming);
20
+ // The list owns the ORDER; the app owns the SET. Adding or removing an item
21
+ // has to reach the order without discarding a reorder the user already
22
+ // made — so new ids go to the end, departed ids drop out, and a pure
23
+ // reorder of `data` by the app is ignored (upstream's contract too: the
24
+ // component owns the order).
25
+ //
26
+ // Adjusted DURING RENDER rather than in an effect. React documents this as
27
+ // the way to derive state from changed props, and it matters here: an
28
+ // effect would paint one frame in the stale order every time the app
29
+ // appends an item.
30
+ const signature = incoming.join(" ");
31
+ const [seenSignature, setSeenSignature] = useState(signature);
32
+ if (seenSignature !== signature) {
33
+ setSeenSignature(signature);
34
+ const known = new Set(incoming);
35
+ const next = [
36
+ ...order.filter((id) => known.has(id)),
37
+ ...incoming.filter((id) => !order.includes(id)),
38
+ ];
39
+ if (next.length !== order.length ||
40
+ next.some((id, index) => id !== order[index])) {
41
+ setOrder(next);
42
+ }
43
+ }
44
+ const items = useMemo(() => {
45
+ const byId = new Map();
46
+ data.forEach((item, index) => {
47
+ byId.set(keyOf(item, index, itemKeyExtractor), item);
48
+ });
49
+ return order
50
+ .map((id) => byId.get(id))
51
+ .filter((item) => item !== undefined);
52
+ }, [order, data, itemKeyExtractor]);
53
+ return { scope, order, setOrder, items };
54
+ };
55
+ //# sourceMappingURL=order-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-state.js","sourceRoot":"","sources":["../../src/dnd/order-state.ts"],"names":[],"mappings":"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","sourcesContent":["// The order-owning state shared by every list shape in this module: the\n// plain vertical `Sortable`, the horizontal direction of the same component,\n// and `SortableGrid`. All three keep the SAME representation — an ARRAY of\n// ids, index 0..N-1 — because that is what upstream's own `listToObject` /\n// `listToGridObject` build from a list on mount, and reducing every reorder\n// back to \"produce a new array in this order\" is what lets one hook serve\n// a row, a column and a grid cell alike (a grid's `GridPositions` is just\n// this array run through `calculateGridPosition`; see grid-order.ts).\nimport { useMemo, useState, type Dispatch, type SetStateAction } from \"react\"\nimport { nextDraggableId } from \"./payload\"\nimport type { SortableData } from \"./types\"\n\nexport const keyOf = <TData extends SortableData>(\n item: TData,\n index: number,\n extractor?: (item: TData, index: number) => string,\n): string => extractor?.(item, index) ?? item.id\n\nexport type OrderState<TData> = {\n /** Namespaces this list's payloads, so dragging a row does not light up\n * every `Droppable` on the screen. */\n scope: string\n order: string[]\n setOrder: Dispatch<SetStateAction<string[]>>\n items: TData[]\n}\n\n/** The order state, shared by every `use*SortableList` hook and every list\n * component (`Sortable`, `SortableGrid`) in this module. */\nexport const useOrder = <TData extends SortableData>(\n data: TData[],\n itemKeyExtractor?: (item: TData, index: number) => string,\n): OrderState<TData> => {\n // Lazy initial state, not a ref: stable for the list's lifetime, and a ref\n // may not be read during render.\n const [scope] = useState(() => `sortable-${nextDraggableId()}`)\n\n const incoming = useMemo(\n () => data.map((item, index) => keyOf(item, index, itemKeyExtractor)),\n [data, itemKeyExtractor],\n )\n const [order, setOrder] = useState<string[]>(incoming)\n\n // The list owns the ORDER; the app owns the SET. Adding or removing an item\n // has to reach the order without discarding a reorder the user already\n // made — so new ids go to the end, departed ids drop out, and a pure\n // reorder of `data` by the app is ignored (upstream's contract too: the\n // component owns the order).\n //\n // Adjusted DURING RENDER rather than in an effect. React documents this as\n // the way to derive state from changed props, and it matters here: an\n // effect would paint one frame in the stale order every time the app\n // appends an item.\n const signature = incoming.join(\" \")\n const [seenSignature, setSeenSignature] = useState(signature)\n if (seenSignature !== signature) {\n setSeenSignature(signature)\n const known = new Set(incoming)\n const next = [\n ...order.filter((id) => known.has(id)),\n ...incoming.filter((id) => !order.includes(id)),\n ]\n if (\n next.length !== order.length ||\n next.some((id, index) => id !== order[index])\n ) {\n setOrder(next)\n }\n }\n\n const items = useMemo(() => {\n const byId = new Map<string, TData>()\n data.forEach((item, index) => {\n byId.set(keyOf(item, index, itemKeyExtractor), item)\n })\n return order\n .map((id) => byId.get(id))\n .filter((item): item is TData => item !== undefined)\n }, [order, data, itemKeyExtractor])\n\n return { scope, order, setOrder, items }\n}\n"]}
@@ -5,3 +5,22 @@ export declare const listToObject: (items: readonly (string | SortableData)[]) =
5
5
  /** Moves the entry at `from` to `to`, returning a new position map. */
6
6
  export declare const objectMove: (positions: Record<string, number>, from: number, to: number) => Record<string, number>;
7
7
  export declare const clamp: (value: number, lower: number, upper: number) => number;
8
+ /**
9
+ * Resolves a TRACKED row position (`sortable.tsx`'s `useSortable`: the row's
10
+ * own top/left edge, `fromIndex * slotSize` plus the pointer's delta since
11
+ * the drag began — never a measured layout, same as upstream's own
12
+ * `positionY.value`) onto the nearest slot index.
13
+ *
14
+ * ROUNDS rather than floors. Upstream's `setPosition` floors this exact
15
+ * quantity (`Math.floor(positionY / itemHeight)`), which resolves by the
16
+ * row's TOP-LEFT corner against the slot's origin: crossing away from index
17
+ * 0 needs the row's own full `itemHeight` of travel, crossing toward it needs
18
+ * about one pixel (`docs/research/dnd-collision-feel.md`). Rounding instead
19
+ * is mathematically the same as resolving by the row's own CENTRE against
20
+ * each slot's centre — `Math.round(top / slotSize)` is exactly
21
+ * `Math.floor((top + slotSize / 2) / slotSize)` — so both directions need
22
+ * about half a slot, symmetric, and independent of `slotSize`'s value (a
23
+ * gap folded into it does not change the symmetry, only the threshold's
24
+ * size).
25
+ */
26
+ export declare const resolveTrackedIndex: (trackedPosition: number, slotSize: number, itemsCount: number) => number;
package/dist/dnd/order.js CHANGED
@@ -17,4 +17,23 @@ export const objectMove = (positions, from, to) => {
17
17
  return listToObject(ids);
18
18
  };
19
19
  export const clamp = (value, lower, upper) => Math.min(Math.max(value, lower), upper);
20
+ /**
21
+ * Resolves a TRACKED row position (`sortable.tsx`'s `useSortable`: the row's
22
+ * own top/left edge, `fromIndex * slotSize` plus the pointer's delta since
23
+ * the drag began — never a measured layout, same as upstream's own
24
+ * `positionY.value`) onto the nearest slot index.
25
+ *
26
+ * ROUNDS rather than floors. Upstream's `setPosition` floors this exact
27
+ * quantity (`Math.floor(positionY / itemHeight)`), which resolves by the
28
+ * row's TOP-LEFT corner against the slot's origin: crossing away from index
29
+ * 0 needs the row's own full `itemHeight` of travel, crossing toward it needs
30
+ * about one pixel (`docs/research/dnd-collision-feel.md`). Rounding instead
31
+ * is mathematically the same as resolving by the row's own CENTRE against
32
+ * each slot's centre — `Math.round(top / slotSize)` is exactly
33
+ * `Math.floor((top + slotSize / 2) / slotSize)` — so both directions need
34
+ * about half a slot, symmetric, and independent of `slotSize`'s value (a
35
+ * gap folded into it does not change the symmetry, only the threshold's
36
+ * size).
37
+ */
38
+ export const resolveTrackedIndex = (trackedPosition, slotSize, itemsCount) => clamp(Math.round(trackedPosition / slotSize), 0, itemsCount - 1);
20
39
  //# sourceMappingURL=order.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/dnd/order.ts"],"names":[],"mappings":"AASA;+DAC+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAyC,EACjB,EAAE;IAC1B,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;IAC3D,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,SAAiC,EACjC,IAAY,EACZ,EAAU,EACc,EAAE;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CACpD,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACnC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa,EAAU,EAAE,CAC3E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA","sourcesContent":["// The order arithmetic, kept free of every GTK import.\n//\n// Upstream's equivalents live in `components/sortableUtils` and are worklets;\n// here they are plain functions, and they are in their own module so the unit\n// test project — which has no GTK runtime — can import them. `sortable.tsx`\n// re-exports them, so an app still imports them from the subpath root exactly\n// as it does upstream.\nimport type { SortableData } from \"./types\"\n\n/** `[\"a\", \"b\"]` → `{ a: 0, b: 1 }`. Upstream's takes objects with an `id`;\n * both shapes are accepted so no call site has to convert. */\nexport const listToObject = (\n items: readonly (string | SortableData)[],\n): Record<string, number> => {\n const result: Record<string, number> = {}\n items.forEach((item, index) => {\n result[typeof item === \"string\" ? item : item.id] = index\n })\n return result\n}\n\n/** Moves the entry at `from` to `to`, returning a new position map. */\nexport const objectMove = (\n positions: Record<string, number>,\n from: number,\n to: number,\n): Record<string, number> => {\n const ids = Object.keys(positions).sort(\n (a, b) => (positions[a] ?? 0) - (positions[b] ?? 0),\n )\n const [moved] = ids.splice(from, 1)\n if (moved !== undefined) {\n ids.splice(to, 0, moved)\n }\n return listToObject(ids)\n}\n\nexport const clamp = (value: number, lower: number, upper: number): number =>\n Math.min(Math.max(value, lower), upper)\n"]}
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/dnd/order.ts"],"names":[],"mappings":"AASA;+DAC+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAyC,EACjB,EAAE;IAC1B,MAAM,MAAM,GAA2B,EAAE,CAAA;IACzC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;IAC3D,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,SAAiC,EACjC,IAAY,EACZ,EAAU,EACc,EAAE;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CACpD,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACnC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,YAAY,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa,EAAU,EAAE,CAC3E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,eAAuB,EACvB,QAAgB,EAChB,UAAkB,EACV,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAA","sourcesContent":["// The order arithmetic, kept free of every GTK import.\n//\n// Upstream's equivalents live in `components/sortableUtils` and are worklets;\n// here they are plain functions, and they are in their own module so the unit\n// test project — which has no GTK runtime — can import them. `sortable.tsx`\n// re-exports them, so an app still imports them from the subpath root exactly\n// as it does upstream.\nimport type { SortableData } from \"./types\"\n\n/** `[\"a\", \"b\"]` → `{ a: 0, b: 1 }`. Upstream's takes objects with an `id`;\n * both shapes are accepted so no call site has to convert. */\nexport const listToObject = (\n items: readonly (string | SortableData)[],\n): Record<string, number> => {\n const result: Record<string, number> = {}\n items.forEach((item, index) => {\n result[typeof item === \"string\" ? item : item.id] = index\n })\n return result\n}\n\n/** Moves the entry at `from` to `to`, returning a new position map. */\nexport const objectMove = (\n positions: Record<string, number>,\n from: number,\n to: number,\n): Record<string, number> => {\n const ids = Object.keys(positions).sort(\n (a, b) => (positions[a] ?? 0) - (positions[b] ?? 0),\n )\n const [moved] = ids.splice(from, 1)\n if (moved !== undefined) {\n ids.splice(to, 0, moved)\n }\n return listToObject(ids)\n}\n\nexport const clamp = (value: number, lower: number, upper: number): number =>\n Math.min(Math.max(value, lower), upper)\n\n/**\n * Resolves a TRACKED row position (`sortable.tsx`'s `useSortable`: the row's\n * own top/left edge, `fromIndex * slotSize` plus the pointer's delta since\n * the drag began — never a measured layout, same as upstream's own\n * `positionY.value`) onto the nearest slot index.\n *\n * ROUNDS rather than floors. Upstream's `setPosition` floors this exact\n * quantity (`Math.floor(positionY / itemHeight)`), which resolves by the\n * row's TOP-LEFT corner against the slot's origin: crossing away from index\n * 0 needs the row's own full `itemHeight` of travel, crossing toward it needs\n * about one pixel (`docs/research/dnd-collision-feel.md`). Rounding instead\n * is mathematically the same as resolving by the row's own CENTRE against\n * each slot's centre — `Math.round(top / slotSize)` is exactly\n * `Math.floor((top + slotSize / 2) / slotSize)` — so both directions need\n * about half a slot, symmetric, and independent of `slotSize`'s value (a\n * gap folded into it does not change the symmetry, only the threshold's\n * size).\n */\nexport const resolveTrackedIndex = (\n trackedPosition: number,\n slotSize: number,\n itemsCount: number,\n): number => clamp(Math.round(trackedPosition / slotSize), 0, itemsCount - 1)\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import { type SortableData, type SortableItemProps, type SortableProps, type UseSortableListOptions, type UseSortableListReturn, type UseSortableOptions, type UseSortableReturn } from "./types";
2
+ import { type SortableData, type SortableItemProps, type SortableProps, type UseHorizontalSortableListOptions, type UseHorizontalSortableListReturn, type UseHorizontalSortableOptions, type UseHorizontalSortableReturn, type UseSortableListOptions, type UseSortableListReturn, type UseSortableOptions, type UseSortableReturn } from "./types";
3
3
  export { clamp, listToObject, objectMove } from "./order";
4
4
  /**
5
5
  * Owns the order of a sortable list, for an app rendering its own container.
@@ -10,8 +10,18 @@ export { clamp, listToObject, objectMove } from "./order";
10
10
  * `SortableItem` outside one throws rather than quietly not dragging. This
11
11
  * hook is for reading the order and the `SharedValueLike` boxes, which is
12
12
  * what most callers of it actually want.
13
+ *
14
+ * No autoscroll wiring: this hook builds no `ScrollView` of its own to drive
15
+ * one, hence the no-op `handleScroll`/`handleScrollEnd` below, unchanged from
16
+ * before. `Sortable` is where the edge autoscroll in `autoscroll.tsx` lives.
13
17
  */
14
18
  export declare const useSortableList: <TData extends SortableData>(options: UseSortableListOptions<TData>) => UseSortableListReturn<TData>;
19
+ /**
20
+ * The horizontal counterpart of {@link useSortableList} — its own hook
21
+ * upstream, so its own hook here, even though the order state underneath
22
+ * (`order-state.ts`) is identical.
23
+ */
24
+ export declare const useHorizontalSortableList: <TData extends SortableData>(options: UseHorizontalSortableListOptions<TData>) => UseHorizontalSortableListReturn<TData>;
15
25
  /**
16
26
  * A list whose rows reorder by dragging.
17
27
  *
@@ -34,16 +44,31 @@ export declare const useSortableList: <TData extends SortableData>(options: UseS
34
44
  *
35
45
  * The rows carry a real GTK drag icon — a picture of the row itself, lifted
36
46
  * at the point it was grabbed — and the list rearranges live underneath it.
47
+ * Near either end of the visible list, the drag keeps the `ScrollView`
48
+ * scrolling toward it for as long as it stays there (`autoscroll.tsx`).
37
49
  */
38
- export declare const Sortable: <TData extends SortableData>({ data, renderItem, itemKeyExtractor, style, contentContainerStyle, testID, direction, onMove, onDragStart, onDrop, onDragging, }: SortableProps<TData>) => ReactNode;
50
+ export declare const Sortable: <TData extends SortableData>({ data, renderItem, itemKeyExtractor, style, contentContainerStyle, testID, direction, itemWidth, gap, paddingHorizontal, onMove, onDragStart, onDrop, onDragging, onDraggingHorizontal, }: SortableProps<TData>) => ReactNode;
39
51
  /**
40
52
  * The reorder half of the module, as a hook, for a row that owns its own
41
- * view. Render `children` inside that view.
53
+ * view.
54
+ *
55
+ * Shared by both directions: which coordinate reaches `onDragging`/
56
+ * `onDraggingHorizontal` (and which of the two fires at all) comes from the
57
+ * enclosing `Sortable`'s own `direction`, read through context — the reorder
58
+ * itself (cross into another cell's drop target) never looks at an axis.
42
59
  */
43
60
  export declare const useSortable: <TData>(options: UseSortableOptions<TData>) => UseSortableReturn;
61
+ /**
62
+ * The horizontal counterpart of {@link useSortable} — upstream's own separate
63
+ * hook, kept separate here too, though it is the same implementation under a
64
+ * shape matching `UseHorizontalSortableOptions`. Must be inside a
65
+ * `<Sortable direction="horizontal">`, same as `useSortable` must be inside a
66
+ * `Sortable`.
67
+ */
68
+ export declare const useHorizontalSortable: <TData>(options: UseHorizontalSortableOptions<TData>) => UseHorizontalSortableReturn;
44
69
  /** One row of a {@link Sortable}. Both a drag source and a drop target: the
45
70
  * row you drag onto is the position the dragged row takes. */
46
71
  export declare const SortableItem: {
47
- <TData>({ id, data, children, style, animatedStyle, testID, onMove, onDragStart, onDrop, onDragging, }: SortableItemProps<TData>): ReactNode;
72
+ <TData>({ id, data, children, style, animatedStyle, testID, onMove, onDragStart, onDrop, onDragging, onDraggingHorizontal, }: SortableItemProps<TData>): ReactNode;
48
73
  Handle: ({ children, style, testID, }: import("./types").DraggableHandleProps) => ReactNode;
49
74
  };