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.
- package/README.md +1 -1
- package/dist/adw/index.d.ts +3 -2
- package/dist/adw/index.js +21 -4
- package/dist/adw/index.js.map +1 -1
- package/dist/adw/widgets.generated.d.ts +1 -1
- package/dist/adw/widgets.generated.js +2 -2
- package/dist/adw/widgets.generated.js.map +1 -1
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/event.d.ts +15 -0
- package/dist/animated/event.js +80 -0
- package/dist/animated/event.js.map +1 -0
- package/dist/animated/index.d.ts +4 -0
- package/dist/animated/index.js +8 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/spring.d.ts +10 -0
- package/dist/animated/spring.js +20 -6
- package/dist/animated/spring.js.map +1 -1
- package/dist/animated/timing.d.ts +10 -0
- package/dist/animated/timing.js +21 -13
- package/dist/animated/timing.js.map +1 -1
- package/dist/apis/host.gtkx.js +70 -11
- package/dist/apis/host.gtkx.js.map +1 -1
- package/dist/common/navigation-stack.d.ts +6 -3
- package/dist/common/navigation-stack.js +8 -1
- package/dist/common/navigation-stack.js.map +1 -1
- package/dist/common/widget.js +2 -11
- package/dist/common/widget.js.map +1 -1
- package/dist/components/animated.d.ts +1 -0
- package/dist/components/animated.js +28 -4
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.js +32 -8
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/request-animation-frame.d.ts +33 -0
- package/dist/components/request-animation-frame.js +83 -0
- package/dist/components/request-animation-frame.js.map +1 -0
- package/dist/components/scroll-view.js +60 -2
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/virtualized-list.js +1 -4
- package/dist/components/virtualized-list.js.map +1 -1
- package/dist/dnd/autoscroll.d.ts +44 -0
- package/dist/dnd/autoscroll.js +176 -0
- package/dist/dnd/autoscroll.js.map +1 -0
- package/dist/dnd/grid-order.d.ts +45 -0
- package/dist/dnd/grid-order.js +151 -0
- package/dist/dnd/grid-order.js.map +1 -0
- package/dist/dnd/grid.d.ts +44 -0
- package/dist/dnd/grid.js +397 -0
- package/dist/dnd/grid.js.map +1 -0
- package/dist/dnd/gtk-controllers.d.ts +16 -2
- package/dist/dnd/gtk-controllers.js +23 -3
- package/dist/dnd/gtk-controllers.js.map +1 -1
- package/dist/dnd/index.d.ts +4 -2
- package/dist/dnd/index.js +9 -2
- package/dist/dnd/index.js.map +1 -1
- package/dist/dnd/order-state.d.ts +14 -0
- package/dist/dnd/order-state.js +55 -0
- package/dist/dnd/order-state.js.map +1 -0
- package/dist/dnd/order.d.ts +19 -0
- package/dist/dnd/order.js +19 -0
- package/dist/dnd/order.js.map +1 -1
- package/dist/dnd/sortable.d.ts +29 -4
- package/dist/dnd/sortable.js +308 -115
- package/dist/dnd/sortable.js.map +1 -1
- package/dist/dnd/types.d.ts +236 -14
- package/dist/dnd/types.js +30 -0
- package/dist/dnd/types.js.map +1 -1
- package/dist/gesture-handler-compat/attach-context.d.ts +29 -0
- package/dist/gesture-handler-compat/attach-context.js +90 -0
- package/dist/gesture-handler-compat/attach-context.js.map +1 -0
- package/dist/gesture-handler-compat/detector-runtime.d.ts +14 -3
- package/dist/gesture-handler-compat/detector-runtime.js +15 -5
- package/dist/gesture-handler-compat/detector-runtime.js.map +1 -1
- package/dist/gesture-handler-compat/detector.js +57 -2
- package/dist/gesture-handler-compat/detector.js.map +1 -1
- package/dist/gesture-handler-compat/gesture-state-manager.d.ts +5 -0
- package/dist/gesture-handler-compat/gesture-state-manager.js +77 -0
- package/dist/gesture-handler-compat/gesture-state-manager.js.map +1 -0
- package/dist/gesture-handler-compat/index.d.ts +2 -2
- package/dist/gesture-handler-compat/index.js +38 -33
- package/dist/gesture-handler-compat/index.js.map +1 -1
- package/dist/gesture-handler-compat/recognizer.d.ts +12 -1
- package/dist/gesture-handler-compat/recognizer.js +23 -9
- package/dist/gesture-handler-compat/recognizer.js.map +1 -1
- package/dist/gesture-handler-compat/tag-registry.d.ts +14 -0
- package/dist/gesture-handler-compat/tag-registry.js +19 -0
- package/dist/gesture-handler-compat/tag-registry.js.map +1 -0
- package/dist/globals/index.d.ts +47 -0
- package/dist/globals/index.js +181 -0
- package/dist/globals/index.js.map +1 -0
- package/dist/globals/install.d.ts +1 -0
- package/dist/globals/install.js +14 -0
- package/dist/globals/install.js.map +1 -0
- package/dist/gtkx/bridge/adw-namespace.d.ts +2 -0
- package/dist/gtkx/bridge/adw-namespace.js +26 -0
- package/dist/gtkx/bridge/adw-namespace.js.map +1 -0
- package/dist/gtkx/bridge/adw.d.ts +23 -0
- package/dist/gtkx/bridge/adw.js +93 -0
- package/dist/gtkx/bridge/adw.js.map +1 -0
- package/dist/gtkx/bridge/color-scheme-parse.d.ts +11 -0
- package/dist/gtkx/bridge/color-scheme-parse.js +42 -0
- package/dist/gtkx/bridge/color-scheme-parse.js.map +1 -0
- package/dist/gtkx/bridge/color-scheme-portal.d.ts +24 -0
- package/dist/gtkx/bridge/color-scheme-portal.js +172 -0
- package/dist/gtkx/bridge/color-scheme-portal.js.map +1 -0
- package/dist/gtkx/bridge/core.d.ts +25 -0
- package/dist/gtkx/bridge/core.js +69 -0
- package/dist/gtkx/bridge/core.js.map +1 -0
- package/dist/gtkx/bridge/drag-layer.d.ts +27 -0
- package/dist/gtkx/bridge/drag-layer.js +177 -0
- package/dist/gtkx/bridge/drag-layer.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +1 -27
- package/dist/gtkx/bridge/index.js +12 -71
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/widgets.generated.adw.d.ts +1 -0
- package/dist/gtkx/bridge/widgets.generated.adw.js +16 -0
- package/dist/gtkx/bridge/widgets.generated.adw.js.map +1 -0
- package/dist/gtkx/bridge/widgets.generated.d.ts +0 -1
- package/dist/gtkx/bridge/widgets.generated.js +3 -3
- package/dist/gtkx/bridge/widgets.generated.js.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/data/generated.d.ts +41 -20
- package/dist/mcp/data/generated.js +46 -20
- package/dist/mcp/data/generated.js.map +1 -1
- package/dist/metro/index.d.ts +1 -0
- package/dist/metro/index.js +12 -0
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/sidebar.js +2 -45
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/reanimated-compat/animatable-value.d.ts +158 -0
- package/dist/reanimated-compat/animatable-value.js +316 -0
- package/dist/reanimated-compat/animatable-value.js.map +1 -0
- package/dist/reanimated-compat/animation.d.ts +34 -13
- package/dist/reanimated-compat/animation.js +97 -25
- package/dist/reanimated-compat/animation.js.map +1 -1
- package/dist/reanimated-compat/mutable.js +6 -6
- package/dist/reanimated-compat/mutable.js.map +1 -1
- package/dist/reanimated-compat/updater-animations.js +32 -12
- package/dist/reanimated-compat/updater-animations.js.map +1 -1
- package/dist/runner/host-dev.js +5 -1
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +9 -1
- package/dist/runner/host.js.map +1 -1
- package/dist/vite/index.js +130 -0
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/gtkx/bridge/theme.d.ts +0 -4
- package/dist/gtkx/bridge/theme.js +0 -5
- package/dist/gtkx/bridge/theme.js.map +0 -1
package/dist/dnd/sortable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortable.js","sourceRoot":"","sources":["../../src/dnd/sortable.tsx"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,oBAAoB;AACpB,EAAE;AACF,6EAA6E;AAC7E,oEAAoE;AACpE,6BAA6B;AAC7B,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,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A;AACH,CAAC,CAAA;AAED,YAAY,CAAC,MAAM,GAAG,eAAe,CAAA","sourcesContent":["// `Sortable`, `SortableItem`, `useSortable` and `useSortableList` — the\n// drag-to-reorder list, which is the shape most apps actually reach for.\n//\n// The reorder is LIVE: crossing another row moves the dragged row into its\n// place immediately, so the list rearranges under the drag icon. That is\n// upstream's behaviour too — its `onMove` fires as rows cross, not at the\n// end — minus the spring, because here the rows are laid out by Yoga rather\n// than transformed.\n//\n// The component owns the order, exactly as upstream requires (\"do NOT update\n// external state in `onMove`\"). An app reads the settled order from\n// `onDrop`'s `allPositions`.\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\"\nimport { ScrollView } from \"../components/scroll-view\"\nimport { View } from \"../components/view\"\nimport { DraggableContext, DraggableHandle } from \"./draggable\"\nimport { DragSourceControllers, DropTargetControllers } from \"./gtk-controllers\"\nimport { listToObject } from \"./order\"\nimport { nextDraggableId, type DragPayload } from \"./payload\"\nimport {\n ScrollDirection,\n SortableDirection,\n type SharedValueLike,\n type SortableData,\n type SortableItemPlumbing,\n type SortableItemProps,\n type SortableProps,\n type UseSortableListOptions,\n type UseSortableListReturn,\n type UseSortableOptions,\n type UseSortableReturn,\n} from \"./types\"\n\n// Upstream exports these from the same entry point as the components, so\n// they are re-exported here rather than moved; the implementations live in\n// ./order, which imports nothing from GTK.\nexport { clamp, listToObject, objectMove } from \"./order\"\n\n// --- the list ---------------------------------------------------------------\n\ntype SortableContextValue = {\n /** Namespaces this list's payloads, so dragging a row does not light up\n * every `Droppable` on the screen. */\n scope: string\n /** Called by a row when the dragged row crosses it. */\n moveOnto: (draggedId: string, targetId: string) => void\n beginDrag: (draggedId: string) => void\n endDrag: (draggedId: string, cancelled: boolean) => void\n onDragging?: (id: string, overItemId: string | null, y: number) => void\n}\n\nconst SortableContext = createContext<SortableContextValue | null>(null)\n\nconst 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\n/** The order state, shared by `useSortableList` and `Sortable`. */\nconst useOrder = <TData extends SortableData>(\n data: TData[],\n itemKeyExtractor?: (item: TData, index: number) => string,\n) => {\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\n/** The `SharedValue`-shaped boxes upstream hands to `renderItem`. Real,\n * readable and writable here — just not animated. See `SharedValueLike`. */\nconst useSharedBoxes = (order: string[]) => {\n // Rebuilt when the order changes rather than mutated in place. Upstream's\n // box keeps its identity and changes its `.value`; here the identity tracks\n // the value, which is the closest thing available without a mutable cell\n // React allows to be written during a render. The practical difference is\n // that an app using `positions` as an effect dependency re-runs on a\n // reorder — which is what it wanted from a SharedValue anyway.\n const positions = useMemo(\n (): SharedValueLike<Record<string, number>> => ({\n value: listToObject(order),\n }),\n [order],\n )\n // These three this platform never writes: there is no UI-thread scroll\n // position, no autoscroll during a drag (see docs/research/drag-and-drop.md)\n // and no measured row heights, because Yoga lays rows out at their natural\n // height. Stable, so forwarding them is free.\n const idle = useMemo(\n () => ({\n scrollY: { value: 0 },\n autoScroll: { value: ScrollDirection.None as ScrollDirection },\n itemHeights: { value: {} as Record<string, number> },\n }),\n [],\n )\n\n const itemsCount = order.length\n\n return useMemo(\n () => ({\n positions,\n ...idle,\n plumbing: (): SortableItemPlumbing => ({\n positions,\n lowerBound: idle.scrollY,\n autoScrollDirection: idle.autoScroll,\n itemHeights: idle.itemHeights,\n itemsCount,\n isDynamicHeight: false,\n }),\n }),\n [positions, idle, itemsCount],\n )\n}\n\n/**\n * Owns the order of a sortable list, for an app rendering its own container.\n *\n * **The order half only.** Upstream's rows get their drag wiring through the\n * props `getItemProps` hands them; here it travels in context, which only\n * `Sortable` provides — so rows still have to be inside a `Sortable`, and a\n * `SortableItem` outside one throws rather than quietly not dragging. This\n * hook is for reading the order and the `SharedValueLike` boxes, which is\n * what most callers of it actually want.\n */\nexport const useSortableList = <TData extends SortableData>(\n options: UseSortableListOptions<TData>,\n): UseSortableListReturn<TData> => {\n const { order, items } = useOrder(options.data, options.itemKeyExtractor)\n const boxes = useSharedBoxes(order)\n const dropProviderRef = useRef(null)\n const noop = useCallback(() => {}, [])\n\n return {\n positions: boxes.positions,\n scrollY: boxes.scrollY,\n autoScroll: boxes.autoScroll,\n itemHeights: boxes.itemHeights,\n dropProviderRef,\n handleScroll: noop,\n handleScrollEnd: noop,\n contentHeight: 0,\n isDynamicHeight: false,\n items,\n getItemProps: boxes.plumbing,\n }\n}\n\n/**\n * A list whose rows reorder by dragging.\n *\n * ```tsx\n * <Sortable\n * data={tasks}\n * onDrop={(id, position, all) => save(all)}\n * renderItem={({ item, id, ...rest }) => (\n * <SortableItem key={id} id={id} data={item} {...rest}>\n * <View style={styles.row}>\n * <Text>{item.title}</Text>\n * <SortableItem.Handle>\n * <Text>⠿</Text>\n * </SortableItem.Handle>\n * </View>\n * </SortableItem>\n * )}\n * />\n * ```\n *\n * The rows carry a real GTK drag icon — a picture of the row itself, lifted\n * at the point it was grabbed — and the list rearranges live underneath it.\n */\nexport const Sortable = <TData extends SortableData>({\n data,\n renderItem,\n itemKeyExtractor,\n style,\n contentContainerStyle,\n testID,\n direction = SortableDirection.Vertical,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n}: SortableProps<TData>): ReactNode => {\n const { scope, order, setOrder, items } = useOrder(data, itemKeyExtractor)\n const boxes = useSharedBoxes(order)\n\n // The order as it was when the drag began, so a cancelled drag puts the\n // list back rather than leaving it wherever the pointer happened to be.\n const beforeDrag = useRef<string[] | null>(null)\n // The drag callbacks below run from GTK signals, long after any commit, so\n // reading the order through a ref updated in an effect is both current and\n // free of the stale-closure problem `useCallback` would otherwise have.\n const orderRef = useRef(order)\n useEffect(() => {\n orderRef.current = order\n }, [order])\n\n const beginDrag = useCallback(\n (draggedId: string) => {\n beforeDrag.current = orderRef.current\n onDragStart?.(draggedId, orderRef.current.indexOf(draggedId))\n },\n [onDragStart],\n )\n\n const moveOnto = useCallback(\n (draggedId: string, targetId: string) => {\n setOrder((current) => {\n const from = current.indexOf(draggedId)\n const to = current.indexOf(targetId)\n if (from === -1 || to === -1 || from === to) {\n return current\n }\n const next = [...current]\n next.splice(from, 1)\n next.splice(to, 0, draggedId)\n onMove?.(draggedId, from, to)\n return next\n })\n },\n [setOrder, onMove],\n )\n\n const endDrag = useCallback(\n (draggedId: string, cancelled: boolean) => {\n const restore = beforeDrag.current\n beforeDrag.current = null\n if (cancelled) {\n if (restore) {\n setOrder(() => restore)\n }\n return\n }\n const settled = orderRef.current\n onDrop?.(draggedId, settled.indexOf(draggedId), listToObject(settled))\n },\n [setOrder, onDrop],\n )\n\n const contextValue = useMemo<SortableContextValue>(\n () => ({ scope, moveOnto, beginDrag, endDrag, onDragging }),\n [scope, moveOnto, beginDrag, endDrag, onDragging],\n )\n\n if (direction === SortableDirection.Horizontal) {\n // Loud rather than silent: a horizontal list that lays out vertically is\n // a bug report waiting to happen. See docs/research/drag-and-drop.md for\n // why the horizontal surface is deferred rather than approximated.\n throw new Error(\n \"react-native-gtkx/dnd: SortableDirection.Horizontal is not implemented on Linux\",\n )\n }\n\n return (\n <SortableContext.Provider value={contextValue}>\n <ScrollView\n style={style}\n // No `alignItems: \"stretch\"` override here any more. It used to be\n // needed because this platform's ScrollView content container\n // defaulted to `flex-start`, which shrank every row to its intrinsic\n // width and collapsed the `flex: 1` text column inside it. That\n // default was a parity bug — RN's content container is a plain\n // `View`, whose default is `stretch` — and it is fixed at the source\n // now (components/scroll-view.tsx), so a `Sortable` gets full-width\n // rows the same way any other RN list does.\n contentContainerStyle={contentContainerStyle}\n testID={testID}\n >\n {items.map((item, index) =>\n renderItem({\n item,\n index,\n id: keyOf(item, index, itemKeyExtractor),\n direction,\n ...boxes.plumbing(),\n }),\n )}\n </ScrollView>\n </SortableContext.Provider>\n )\n}\n\n/**\n * The reorder half of the module, as a hook, for a row that owns its own\n * view. Render `children` inside that view.\n */\nexport const useSortable = <TData,>(\n options: UseSortableOptions<TData>,\n): UseSortableReturn => {\n const { id, onDragging } = options\n const list = useContext(SortableContext)\n if (list === null) {\n // Loudly, because a silent no-op is the worst failure mode this repo has\n // met: docs/research/gestures.md records `Animated.View` accepting the\n // responder props and ignoring them, which compiled, ran, and did\n // nothing. Unlike upstream — where a row gets its wiring through the\n // props `getItemProps` hands it — the wiring here is in context, so a row\n // outside its list has no drag at all rather than a degraded one.\n throw new Error(\n \"react-native-gtkx/dnd: SortableItem/useSortable must be inside a Sortable\",\n )\n }\n const [isMoving, setIsMoving] = useState(false)\n const [hasHandle, setHasHandle] = useState(false)\n\n const registerHandle = useCallback((registered: boolean) => {\n setHasHandle(registered)\n }, [])\n\n // Same reasoning as draggable.tsx: a handle registers one commit late, so\n // the row's own copy waits for it rather than briefly mounting a second\n // drag source.\n const [mounted, setMounted] = useState(false)\n // eslint-disable-next-line react-hooks/set-state-in-effect\n useEffect(() => setMounted(true), [])\n\n // Same list only — and INCLUDING this row itself. Refusing the self-drop\n // looks right and is wrong: because the reorder happens live on `::enter`,\n // by the time the pointer settles it is over the DRAGGED row, so a row that\n // refuses its own payload leaves GDK with no target, cancels the drag, and\n // the list snaps back to where it started. Accepting is also the honest\n // reading: dropping a row on its own current position means \"leave it\n // here\", which is a completed drag, not an abandoned one.\n const accepts = useCallback(\n (payload: DragPayload) => payload.scope === list.scope,\n [list],\n )\n\n const dragControllers = (\n <DragSourceControllers\n payload={{ scope: list.scope, id }}\n onDragBegin={() => {\n setIsMoving(true)\n list.beginDrag(id)\n }}\n onDragEnd={(dropped) => {\n setIsMoving(false)\n list.endDrag(id, !dropped)\n }}\n />\n )\n\n const dropControllers = (\n <DropTargetControllers\n accepts={accepts}\n // The reorder happens HERE, not on drop: crossing this row is what\n // moves the dragged row into its place, so the list rearranges under\n // the drag icon the way upstream's animated gaps do.\n onEnter={(payload) => list.moveOnto(payload.id, id)}\n onMotion={(payload, _x, y) => {\n list.onDragging?.(payload.id, id, y)\n onDragging?.(payload.id, id, y)\n }}\n // Nothing left to do: the order is already right, and `drag-end` on the\n // source is what settles it.\n onDrop={() => {}}\n />\n )\n\n return {\n animatedStyle: undefined,\n isMoving,\n hasHandle,\n registerHandle,\n dragControllers,\n children: (\n <>\n {mounted && !hasHandle ? dragControllers : null}\n {dropControllers}\n </>\n ),\n }\n}\n\n/** One row of a {@link Sortable}. Both a drag source and a drop target: the\n * row you drag onto is the position the dragged row takes. */\nexport const SortableItem = <TData,>({\n id,\n data,\n children,\n style,\n animatedStyle,\n testID,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n}: SortableItemProps<TData>): ReactNode => {\n const sortable = useSortable<TData>({\n id,\n data,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n } as UseSortableOptions<TData>)\n\n // `SortableItem.Handle` is `Draggable.Handle`: the same context carries the\n // drag source to whichever view claims it, so one implementation serves\n // both components.\n const handleContext = useMemo(\n () => ({\n source: sortable.dragControllers,\n registerHandle: sortable.registerHandle,\n }),\n [sortable.dragControllers, sortable.registerHandle],\n )\n\n return (\n <View\n style={animatedStyle ? [style, animatedStyle] : style}\n testID={testID}\n >\n <DraggableContext.Provider value={handleContext}>\n {sortable.children}\n {children}\n </DraggableContext.Provider>\n </View>\n )\n}\n\nSortableItem.Handle = DraggableHandle\n"]}
|
|
1
|
+
{"version":3,"file":"sortable.js","sourceRoot":"","sources":["../../src/dnd/sortable.tsx"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,iFAAiF;AACjF,0EAA0E;AAC1E,4BAA4B;AAC5B,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,mEAAmE;AACnE,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,mEAAmE;AACnE,8EAA8E;AAC9E,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,qEAAqE;AACrE,2EAA2E;AAC3E,4EAA4E;AAC5E,uEAAuE;AACvE,0EAA0E;AAC1E,4EAA4E;AAC5E,yCAAyC;AACzC,EAAE;AACF,6EAA6E;AAC7E,oEAAoE;AACpE,6BAA6B;AAC7B,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAyB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,oB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MAAM,EACN,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,oBAAoB,GACK,EAAa,EAAE;IACxC,MAAM,QAAQ,GAAG,WAAW,CAAQ;QAClC,EAAE;QACF,IAAI;QACJ,MAAM;QACN,WAAW;QACX,MAAM;QACN,UAAU;QACV,oBAAoB;KACQ,CAAC,CAAA;IAE/B,4EAA4E;IAC5E,wEAAwE;IACxE,mBAAmB;IACnB,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;QACL,MAAM,EAAE,QAAQ,CAAC,eAAe;QAChC,cAAc,EAAE,QAAQ,CAAC,cAAc;KACxC,CAAC,EACF,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,CACpD,CAAA;IAED,OAAO,CACL,KAAC,IAAI,IACH,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,EACrD,MAAM,EAAE,MAAM,YAEd,MAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,aAC5C,QAAQ,CAAC,QAAQ,EACjB,QAAQ,IACiB,GACvB,CACR,CAAA;AACH,CAAC,CAAA;AAED,YAAY,CAAC,MAAM,GAAG,eAAe,CAAA","sourcesContent":["// `Sortable`, `SortableItem`, `useSortable`, `useSortableList` and their\n// horizontal counterparts (`useHorizontalSortable`, `useHorizontalSortableList`)\n// — the drag-to-reorder list, which is the shape most apps actually reach\n// for, in either direction.\n//\n// The reorder is LIVE: crossing another row moves the dragged row into its\n// place immediately, so the list rearranges under the drag icon. That is\n// upstream's behaviour too — its `onMove` fires as rows cross, not at the\n// end — minus the spring, because here the rows are laid out by Yoga rather\n// than transformed. The mechanism does not care which axis the list scrolls\n// along, which is why `SortableDirection.Horizontal` is a render-time branch\n// here (a horizontal `ScrollView`, `leftBound`/`autoScrollHorizontalDirection`\n// plumbing) rather than a second implementation.\n//\n// WHAT DECIDES A CROSSING, and why it changed: this used to be GDK\n// hit-testing the raw pointer against a neighbour row's full rect (a row's\n// own `onEnter`) — grab-point DEPENDENT, unlike upstream's own item-rect\n// reasoning (`docs/research/dnd-collision-feel.md`). It is now the dragged\n// row's own TRACKED position, upstream's shape without upstream's asymmetry:\n// `useEdgeAutoscroll`'s `GtkDropControllerMotion` (already watching every\n// motion event for edge-autoscroll) also reports each one here via\n// `onDragMotion`, and `handleDragMotion` below tracks `fromIndex * slotSize +\n// (pointer delta since the drag began)`, resolving the row it lands on by\n// ROUNDING rather than upstream's own floor — the dragged row's CENTRE\n// against a slot's centre, not its top-left corner against the slot's origin\n// — see `order.ts`'s `resolveTrackedIndex` for the arithmetic. The origin\n// that delta is measured from is `DragSourceControllers`'s `onGrab`,\n// converted to the list's own container coordinates with `computePointIn`,\n// NEVER the first motion sample: a fast drag's first sample arrives already\n// displaced past GDK's own drag-start threshold, undercounting travel.\n// `SortableItem`'s own `onEnter` no longer drives a reorder at all — only\n// `onMotion` still does, for the public `onDragging`/`onDraggingHorizontal`\n// callbacks, unrelated to this decision.\n//\n// The component owns the order, exactly as upstream requires (\"do NOT update\n// external state in `onMove`\"). An app reads the settled order from\n// `onDrop`'s `allPositions`.\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\"\nimport type { MeasureHandle } from \"../components/measure\"\nimport { widgetForHandle } from \"../components/measure\"\nimport { ScrollView, type ScrollViewHandle } from \"../components/scroll-view\"\nimport { View } from \"../components/view\"\nimport { computePointIn, type Gtk } from \"../gtkx/bridge/index\"\nimport { useEdgeAutoscroll } from \"./autoscroll\"\nimport { DraggableContext, DraggableHandle } from \"./draggable\"\nimport { DragSourceControllers, DropTargetControllers } from \"./gtk-controllers\"\nimport { listToObject, resolveTrackedIndex } from \"./order\"\nimport { keyOf, useOrder } from \"./order-state\"\nimport type { DragPayload } from \"./payload\"\nimport {\n HorizontalScrollDirection,\n ScrollDirection,\n SortableDirection,\n type SharedValueLike,\n type SortableData,\n type SortableItemPlumbing,\n type SortableItemProps,\n type SortableProps,\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 the same entry point as the components, so\n// they are re-exported here rather than moved; the implementations live in\n// ./order, which imports nothing from GTK.\nexport { clamp, listToObject, objectMove } from \"./order\"\n\n// --- the list ---------------------------------------------------------------\n\ntype SortableContextValue = {\n /** Namespaces this list's payloads, so dragging a row does not light up\n * every `Droppable` on the screen. */\n scope: string\n direction: SortableDirection\n /** Called from the list's own reorder tracking (`handleDragMotion` below)\n * when the dragged row's tracked position resolves to a new slot — no\n * longer from a row's own `onEnter`, see the module comment. */\n moveOnto: (draggedId: string, targetId: string) => void\n /** `grabWidget`/`grabX`/`grabY` are `DragSourceControllers`'s `onGrab`,\n * forwarded as-is: the widget-local grab point this converts (via\n * `computePointIn`) into the container-relative origin the reorder\n * tracking measures every subsequent motion event against. Taken from the\n * grab, never the first motion sample — see the module comment for why. */\n beginDrag: (\n draggedId: string,\n grabWidget: Gtk.Widget | null,\n grabX: number,\n grabY: number,\n ) => void\n endDrag: (draggedId: string, cancelled: boolean) => void\n onDragging?: (id: string, overItemId: string | null, coord: number) => void\n onDraggingHorizontal?: (\n id: string,\n overItemId: string | null,\n coord: number,\n ) => void\n}\n\nconst SortableContext = createContext<SortableContextValue | null>(null)\n\n/** The `SharedValue`-shaped boxes upstream hands to `renderItem`. Real,\n * readable and writable here — just not animated. See `SharedValueLike`. */\nconst useSharedBoxes = (\n order: string[],\n direction: SortableDirection,\n autoScrollDirection: SharedValueLike<\n ScrollDirection | HorizontalScrollDirection\n >,\n) => {\n // Rebuilt when the order changes rather than mutated in place. Upstream's\n // box keeps its identity and changes its `.value`; here the identity tracks\n // the value, which is the closest thing available without a mutable cell\n // React allows to be written during a render. The practical difference is\n // that an app using `positions` as an effect dependency re-runs on a\n // reorder — which is what it wanted from a SharedValue anyway.\n const positions = useMemo(\n (): SharedValueLike<Record<string, number>> => ({\n value: listToObject(order),\n }),\n [order],\n )\n // Two of these three this platform never writes: there is no UI-thread\n // scroll position and no measured row heights, because Yoga lays rows out\n // at their natural height. `autoScrollDirection` IS written now — see\n // `autoscroll.tsx` — which is why it comes in as a parameter rather than\n // living in this idle bag.\n const idle = useMemo(\n () => ({\n scrollY: { value: 0 },\n scrollX: { value: 0 },\n itemHeights: { value: {} as Record<string, number> },\n }),\n [],\n )\n\n const itemsCount = order.length\n\n return useMemo(\n () => ({\n positions,\n ...idle,\n plumbing: (\n itemWidth?: number,\n gap?: number,\n paddingHorizontal?: number,\n ): SortableItemPlumbing =>\n direction === SortableDirection.Horizontal\n ? {\n positions,\n leftBound: idle.scrollX,\n autoScrollHorizontalDirection:\n autoScrollDirection as SharedValueLike<HorizontalScrollDirection>,\n itemsCount,\n itemWidth,\n gap,\n paddingHorizontal,\n }\n : {\n positions,\n lowerBound: idle.scrollY,\n autoScrollDirection:\n autoScrollDirection as SharedValueLike<ScrollDirection>,\n itemHeights: idle.itemHeights,\n itemsCount,\n },\n }),\n [positions, idle, itemsCount, direction, autoScrollDirection],\n )\n}\n\nconst noneDirectionFor = (\n direction: SortableDirection,\n): ScrollDirection | HorizontalScrollDirection =>\n direction === SortableDirection.Horizontal\n ? HorizontalScrollDirection.None\n : ScrollDirection.None\n\nconst directionForDelta =\n (direction: SortableDirection) =>\n (\n dx: -1 | 0 | 1,\n dy: -1 | 0 | 1,\n ): ScrollDirection | HorizontalScrollDirection => {\n if (direction === SortableDirection.Horizontal) {\n if (dx < 0) {\n return HorizontalScrollDirection.Left\n }\n if (dx > 0) {\n return HorizontalScrollDirection.Right\n }\n return HorizontalScrollDirection.None\n }\n if (dy < 0) {\n return ScrollDirection.Up\n }\n if (dy > 0) {\n return ScrollDirection.Down\n }\n return ScrollDirection.None\n }\n\n/**\n * Owns the order of a sortable list, for an app rendering its own container.\n *\n * **The order half only.** Upstream's rows get their drag wiring through the\n * props `getItemProps` hands them; here it travels in context, which only\n * `Sortable` provides — so rows still have to be inside a `Sortable`, and a\n * `SortableItem` outside one throws rather than quietly not dragging. This\n * hook is for reading the order and the `SharedValueLike` boxes, which is\n * what most callers of it actually want.\n *\n * No autoscroll wiring: this hook builds no `ScrollView` of its own to drive\n * one, hence the no-op `handleScroll`/`handleScrollEnd` below, unchanged from\n * before. `Sortable` is where the edge autoscroll in `autoscroll.tsx` lives.\n */\nexport const useSortableList = <TData extends SortableData>(\n options: UseSortableListOptions<TData>,\n): UseSortableListReturn<TData> => {\n const { order, items } = useOrder(options.data, options.itemKeyExtractor)\n const idleAutoScroll = useMemo(\n (): SharedValueLike<ScrollDirection> => ({ value: ScrollDirection.None }),\n [],\n )\n const boxes = useSharedBoxes(\n order,\n SortableDirection.Vertical,\n idleAutoScroll,\n )\n const dropProviderRef = useRef(null)\n const noop = useCallback(() => {}, [])\n\n return {\n positions: boxes.positions,\n scrollY: boxes.scrollY,\n autoScroll: idleAutoScroll,\n itemHeights: boxes.itemHeights,\n dropProviderRef,\n handleScroll: noop,\n handleScrollEnd: noop,\n contentHeight: 0,\n isDynamicHeight: false,\n items,\n getItemProps: () => boxes.plumbing(),\n }\n}\n\n/**\n * The horizontal counterpart of {@link useSortableList} — its own hook\n * upstream, so its own hook here, even though the order state underneath\n * (`order-state.ts`) is identical.\n */\nexport const useHorizontalSortableList = <TData extends SortableData>(\n options: UseHorizontalSortableListOptions<TData>,\n): UseHorizontalSortableListReturn<TData> => {\n const { order, items } = useOrder(options.data, options.itemKeyExtractor)\n const idleAutoScroll = useMemo(\n (): SharedValueLike<HorizontalScrollDirection> => ({\n value: HorizontalScrollDirection.None,\n }),\n [],\n )\n const boxes = useSharedBoxes(\n order,\n SortableDirection.Horizontal,\n idleAutoScroll,\n )\n const dropProviderRef = useRef(null)\n const noop = useCallback(() => {}, [])\n const {\n itemWidth,\n gap = 0,\n paddingHorizontal = 0,\n itemKeyExtractor,\n } = options\n\n const getItemProps = useCallback(\n (item: TData, index: number) => {\n const plumbing = boxes.plumbing(itemWidth, gap, paddingHorizontal)\n return {\n id: keyOf(item, index, itemKeyExtractor),\n positions: plumbing.positions,\n leftBound: plumbing.leftBound!,\n autoScrollDirection: idleAutoScroll,\n itemsCount: plumbing.itemsCount,\n itemWidth: itemWidth ?? 0,\n gap,\n paddingHorizontal,\n }\n },\n [\n boxes,\n itemWidth,\n gap,\n paddingHorizontal,\n itemKeyExtractor,\n idleAutoScroll,\n ],\n )\n\n return {\n positions: boxes.positions,\n scrollX: boxes.scrollX,\n autoScroll: idleAutoScroll,\n dropProviderRef,\n handleScroll: noop,\n handleScrollEnd: noop,\n contentWidth: 0,\n items,\n getItemProps,\n }\n}\n\n/**\n * A list whose rows reorder by dragging.\n *\n * ```tsx\n * <Sortable\n * data={tasks}\n * onDrop={(id, position, all) => save(all)}\n * renderItem={({ item, id, ...rest }) => (\n * <SortableItem key={id} id={id} data={item} {...rest}>\n * <View style={styles.row}>\n * <Text>{item.title}</Text>\n * <SortableItem.Handle>\n * <Text>⠿</Text>\n * </SortableItem.Handle>\n * </View>\n * </SortableItem>\n * )}\n * />\n * ```\n *\n * The rows carry a real GTK drag icon — a picture of the row itself, lifted\n * at the point it was grabbed — and the list rearranges live underneath it.\n * Near either end of the visible list, the drag keeps the `ScrollView`\n * scrolling toward it for as long as it stays there (`autoscroll.tsx`).\n */\nexport const Sortable = <TData extends SortableData>({\n data,\n renderItem,\n itemKeyExtractor,\n style,\n contentContainerStyle,\n testID,\n direction = SortableDirection.Vertical,\n itemWidth,\n gap,\n paddingHorizontal,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n onDraggingHorizontal,\n}: SortableProps<TData>): ReactNode => {\n const { scope, order, setOrder, items } = useOrder(data, itemKeyExtractor)\n const isHorizontal = direction === SortableDirection.Horizontal\n\n const containerRef = useRef<MeasureHandle | null>(null)\n const scrollViewRef = useRef<ScrollViewHandle | null>(null)\n\n // The order as it was when the drag began, so a cancelled drag puts the\n // list back rather than leaving it wherever the pointer happened to be.\n const beforeDrag = useRef<string[] | null>(null)\n // The drag callbacks below run from GTK signals, long after any commit, so\n // reading the order through a ref updated in an effect is both current and\n // free of the stale-closure problem `useCallback` would otherwise have.\n const orderRef = useRef(order)\n useEffect(() => {\n orderRef.current = order\n }, [order])\n\n const moveOnto = useCallback(\n (draggedId: string, targetId: string) => {\n setOrder((current) => {\n const from = current.indexOf(draggedId)\n const to = current.indexOf(targetId)\n if (from === -1 || to === -1 || from === to) {\n return current\n }\n const next = [...current]\n next.splice(from, 1)\n next.splice(to, 0, draggedId)\n onMove?.(draggedId, from, to)\n return next\n })\n },\n [setOrder, onMove],\n )\n\n // The dragged row's own tracked position, and the slot it last resolved\n // to — null whenever no drag from this list is in flight, or `beginDrag`\n // could not establish an origin (see below). A ref, not state: written\n // from a GTK motion callback outside React's commit cycle, exactly like\n // `beforeDrag`/`orderRef` above.\n const tracking = useRef<{\n draggedId: string\n /** `fromIndex * slotSize - origin`, folded into one constant so\n * `handleDragMotion` only ever adds the CURRENT motion coordinate to\n * it — see the module comment for the arithmetic this is derived\n * from. */\n base: number\n slotSize: number\n lastResolvedIndex: number\n } | null>(null)\n\n const handleDragMotion = useCallback(\n (x: number, y: number) => {\n const state = tracking.current\n if (!state) {\n return\n }\n const trackedPosition = (isHorizontal ? x : y) + state.base\n const resolvedIndex = resolveTrackedIndex(\n trackedPosition,\n state.slotSize,\n orderRef.current.length,\n )\n if (resolvedIndex === state.lastResolvedIndex) {\n return\n }\n state.lastResolvedIndex = resolvedIndex\n const targetId = orderRef.current[resolvedIndex]\n if (targetId !== undefined && targetId !== state.draggedId) {\n moveOnto(state.draggedId, targetId)\n }\n },\n [isHorizontal, moveOnto],\n )\n\n const autoscroll = useEdgeAutoscroll<\n ScrollDirection | HorizontalScrollDirection\n >({\n containerRef,\n scrollViewRef,\n axes: isHorizontal ? \"horizontal\" : \"vertical\",\n none: noneDirectionFor(direction),\n directionFor: directionForDelta(direction),\n onDragMotion: handleDragMotion,\n })\n\n const boxes = useSharedBoxes(order, direction, autoscroll.direction)\n\n const beginDrag = useCallback(\n (\n draggedId: string,\n grabWidget: Gtk.Widget | null,\n grabX: number,\n grabY: number,\n ) => {\n beforeDrag.current = orderRef.current\n autoscroll.setActive(true)\n const fromIndex = orderRef.current.indexOf(draggedId)\n onDragStart?.(draggedId, fromIndex)\n\n tracking.current = null\n const container = widgetForHandle(containerRef.current)\n if (grabWidget && container && fromIndex !== -1) {\n const origin = computePointIn(grabWidget, container, grabX, grabY)\n if (origin) {\n // The row's own real size, measured rather than a hint: rows are\n // Yoga-natural-height (docs/api.md), so there is no `itemHeight`\n // prop to trust — the dragged row's own allocation, at the moment\n // it was grabbed, is what the tracked position's slots are sized\n // to. `gap` (a real Yoga gap on the content container either\n // direction) folds into the slot period the same way upstream's\n // own `itemHeight` would if it accounted for one.\n const rawSize = isHorizontal\n ? grabWidget.getWidth()\n : grabWidget.getHeight()\n const slotSize = rawSize + (gap ?? 0)\n const origin1D = isHorizontal ? origin.x : origin.y\n tracking.current = {\n draggedId,\n base: fromIndex * slotSize - origin1D,\n slotSize,\n lastResolvedIndex: fromIndex,\n }\n }\n }\n },\n [onDragStart, autoscroll, isHorizontal, gap],\n )\n\n const endDrag = useCallback(\n (draggedId: string, cancelled: boolean) => {\n autoscroll.setActive(false)\n tracking.current = null\n const restore = beforeDrag.current\n beforeDrag.current = null\n if (cancelled) {\n if (restore) {\n setOrder(() => restore)\n }\n return\n }\n const settled = orderRef.current\n onDrop?.(draggedId, settled.indexOf(draggedId), listToObject(settled))\n },\n [setOrder, onDrop, autoscroll],\n )\n\n const contextValue = useMemo<SortableContextValue>(\n () => ({\n scope,\n direction,\n moveOnto,\n beginDrag,\n endDrag,\n onDragging,\n onDraggingHorizontal,\n }),\n [\n scope,\n direction,\n moveOnto,\n beginDrag,\n endDrag,\n onDragging,\n onDraggingHorizontal,\n ],\n )\n\n return (\n <SortableContext.Provider value={contextValue}>\n <View\n ref={containerRef}\n style={{ flex: 1 }}\n >\n {autoscroll.controllers}\n <ScrollView\n ref={scrollViewRef}\n horizontal={isHorizontal}\n style={style}\n // No `alignItems: \"stretch\"` override here any more. It used to be\n // needed because this platform's ScrollView content container\n // defaulted to `flex-start`, which shrank every row to its intrinsic\n // width and collapsed the `flex: 1` text column inside it. That\n // default was a parity bug — RN's content container is a plain\n // `View`, whose default `alignItems` is `stretch` — and it is fixed\n // at the source now (components/scroll-view.tsx), so a `Sortable`\n // gets full-width rows the same way any other RN list does.\n //\n // An app that wants the old behaviour writes it, exactly as it\n // would on iOS and Android: `contentContainerStyle={{ alignItems:\n // \"flex-start\" }}`.\n contentContainerStyle={[\n { gap, paddingHorizontal },\n contentContainerStyle,\n ]}\n testID={testID}\n >\n {items.map((item, index) =>\n renderItem({\n item,\n index,\n id: keyOf(item, index, itemKeyExtractor),\n direction,\n ...boxes.plumbing(itemWidth, gap, paddingHorizontal),\n }),\n )}\n </ScrollView>\n </View>\n </SortableContext.Provider>\n )\n}\n\n/**\n * The reorder half of the module, as a hook, for a row that owns its own\n * view.\n *\n * Shared by both directions: which coordinate reaches `onDragging`/\n * `onDraggingHorizontal` (and which of the two fires at all) comes from the\n * enclosing `Sortable`'s own `direction`, read through context — the reorder\n * itself (cross into another cell's drop target) never looks at an axis.\n */\nexport const useSortable = <TData,>(\n options: UseSortableOptions<TData>,\n): UseSortableReturn => {\n const { id, onDragging, onDraggingHorizontal } = options\n const list = useContext(SortableContext)\n if (list === null) {\n // Loudly, because a silent no-op is the worst failure mode this repo has\n // met: docs/research/gestures.md records `Animated.View` accepting the\n // responder props and ignoring them, which compiled, ran, and did\n // nothing. Unlike upstream — where a row gets its wiring through the\n // props `getItemProps` hands it — the wiring here is in context, so a row\n // outside its list has no drag at all rather than a degraded one.\n throw new Error(\n \"react-native-gtkx/dnd: SortableItem/useSortable must be inside a Sortable\",\n )\n }\n const [isMoving, setIsMoving] = useState(false)\n const [hasHandle, setHasHandle] = useState(false)\n\n const registerHandle = useCallback((registered: boolean) => {\n setHasHandle(registered)\n }, [])\n\n // Same reasoning as draggable.tsx: a handle registers one commit late, so\n // the row's own copy waits for it rather than briefly mounting a second\n // drag source.\n const [mounted, setMounted] = useState(false)\n // eslint-disable-next-line react-hooks/set-state-in-effect\n useEffect(() => setMounted(true), [])\n\n // Same list only — and INCLUDING this row itself. Refusing the self-drop\n // looks right and is wrong: the reorder tracking (`Sortable`'s own\n // `handleDragMotion`) can settle the dragged row back onto its OWN slot,\n // so by the time the pointer releases it may well be over the DRAGGED row.\n // A row that refuses its own payload leaves GDK with no target, cancels\n // the drag, and the list snaps back to where it started. Accepting is also\n // the honest reading: dropping a row on its own current position means\n // \"leave it here\", which is a completed drag, not an abandoned one.\n const accepts = useCallback(\n (payload: DragPayload) => payload.scope === list.scope,\n [list],\n )\n\n // `DragSourceControllers`'s own grab point (widget-local), captured here\n // and forwarded to `beginDrag` — see the module comment for why this, and\n // never the first motion sample, is the reorder tracking's origin.\n const grab = useRef<{ widget: Gtk.Widget | null; x: number; y: number }>({\n widget: null,\n x: 0,\n y: 0,\n })\n\n const dragControllers = (\n <DragSourceControllers\n payload={{ scope: list.scope, id }}\n onGrab={(x, y, widget) => {\n grab.current = { widget, x, y }\n }}\n onDragBegin={() => {\n setIsMoving(true)\n list.beginDrag(id, grab.current.widget, grab.current.x, grab.current.y)\n }}\n onDragEnd={(dropped) => {\n setIsMoving(false)\n list.endDrag(id, !dropped)\n }}\n />\n )\n\n const dropControllers = (\n <DropTargetControllers\n accepts={accepts}\n // No `onEnter` any more: crossing this row's drop target used to be\n // what moved the dragged row into its place. That decision is now\n // `Sortable`'s own `handleDragMotion`, driven by the list's shared\n // motion controller rather than each row's own — see the module\n // comment. This target still has to exist and accept, or GDK would\n // refuse the drop and snap the drag back; `onMotion` below still\n // reports the public `onDragging`/`onDraggingHorizontal` callbacks,\n // unrelated to the reorder decision.\n onMotion={(payload, x, y) => {\n if (list.direction === SortableDirection.Horizontal) {\n list.onDraggingHorizontal?.(payload.id, id, x)\n onDraggingHorizontal?.(payload.id, id, x)\n } else {\n list.onDragging?.(payload.id, id, y)\n onDragging?.(payload.id, id, y)\n }\n }}\n // Nothing left to do: the order is already right, and `drag-end` on the\n // source is what settles it.\n onDrop={() => {}}\n />\n )\n\n return {\n animatedStyle: undefined,\n isMoving,\n hasHandle,\n registerHandle,\n dragControllers,\n children: (\n <>\n {mounted && !hasHandle ? dragControllers : null}\n {dropControllers}\n </>\n ),\n }\n}\n\n/**\n * The horizontal counterpart of {@link useSortable} — upstream's own separate\n * hook, kept separate here too, though it is the same implementation under a\n * shape matching `UseHorizontalSortableOptions`. Must be inside a\n * `<Sortable direction=\"horizontal\">`, same as `useSortable` must be inside a\n * `Sortable`.\n */\nexport const useHorizontalSortable = <TData,>(\n options: UseHorizontalSortableOptions<TData>,\n): UseHorizontalSortableReturn =>\n useSortable<TData>({\n id: options.id,\n data: options.data,\n positions: options.positions,\n itemsCount: options.itemsCount,\n onMove: options.onMove,\n onDragStart: options.onDragStart,\n onDrop: options.onDrop,\n onDraggingHorizontal: options.onDragging,\n } as UseSortableOptions<TData>)\n\n/** One row of a {@link Sortable}. Both a drag source and a drop target: the\n * row you drag onto is the position the dragged row takes. */\nexport const SortableItem = <TData,>({\n id,\n data,\n children,\n style,\n animatedStyle,\n testID,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n onDraggingHorizontal,\n}: SortableItemProps<TData>): ReactNode => {\n const sortable = useSortable<TData>({\n id,\n data,\n onMove,\n onDragStart,\n onDrop,\n onDragging,\n onDraggingHorizontal,\n } as UseSortableOptions<TData>)\n\n // `SortableItem.Handle` is `Draggable.Handle`: the same context carries the\n // drag source to whichever view claims it, so one implementation serves\n // both components.\n const handleContext = useMemo(\n () => ({\n source: sortable.dragControllers,\n registerHandle: sortable.registerHandle,\n }),\n [sortable.dragControllers, sortable.registerHandle],\n )\n\n return (\n <View\n style={animatedStyle ? [style, animatedStyle] : style}\n testID={testID}\n >\n <DraggableContext.Provider value={handleContext}>\n {sortable.children}\n {children}\n </DraggableContext.Provider>\n </View>\n )\n}\n\nSortableItem.Handle = DraggableHandle\n"]}
|
package/dist/dnd/types.d.ts
CHANGED
|
@@ -170,31 +170,49 @@ export declare enum SortableDirection {
|
|
|
170
170
|
}
|
|
171
171
|
/** The plumbing `Sortable` hands `renderItem` and `renderItem` hands
|
|
172
172
|
* `SortableItem` — opaque in upstream's own examples, which destructure
|
|
173
|
-
* `item`/`index`/`id` and spread the rest.
|
|
173
|
+
* `item`/`index`/`id` and spread the rest. Vertical and horizontal fields
|
|
174
|
+
* sit side by side, both optional, exactly as upstream's own
|
|
175
|
+
* `SortableRenderItemProps` does — a single list is only ever one direction,
|
|
176
|
+
* so only one half is ever real. */
|
|
174
177
|
export interface SortableItemPlumbing {
|
|
175
178
|
positions: SharedValueLike<Record<string, number>>;
|
|
176
|
-
lowerBound
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
lowerBound?: SharedValueLike<number>;
|
|
180
|
+
leftBound?: SharedValueLike<number>;
|
|
181
|
+
/** Real now — see `autoscroll.tsx`. A vertical list writes this as the
|
|
182
|
+
* drag nears the top or bottom of its own viewport. */
|
|
183
|
+
autoScrollDirection?: SharedValueLike<ScrollDirection>;
|
|
184
|
+
/** The horizontal counterpart, written as the drag nears the left or
|
|
185
|
+
* right edge of a horizontal list's viewport. */
|
|
186
|
+
autoScrollHorizontalDirection?: SharedValueLike<HorizontalScrollDirection>;
|
|
187
|
+
itemHeights?: SharedValueLike<Record<string, number>>;
|
|
179
188
|
itemsCount: number;
|
|
180
189
|
/** Accepted and ignored: Yoga lays rows out at their natural height, so
|
|
181
190
|
* a height hint has nothing to correct. */
|
|
182
191
|
itemHeight?: number;
|
|
183
|
-
/** Accepted and ignored, same reason. */
|
|
192
|
+
/** Accepted and ignored, same reason, for a horizontal list's columns. */
|
|
193
|
+
itemWidth?: number;
|
|
194
|
+
/** Applied to the list's own content container as a real Yoga `gap` —
|
|
195
|
+
* the space between rows/columns is not a hint here, it is the layout. */
|
|
196
|
+
gap?: number;
|
|
197
|
+
/** Applied to the content container as real `paddingHorizontal`, same
|
|
198
|
+
* reason. */
|
|
199
|
+
paddingHorizontal?: number;
|
|
200
|
+
/** Accepted and ignored, same reason as `itemHeight`. */
|
|
184
201
|
estimatedItemHeight?: number;
|
|
185
202
|
/**
|
|
186
|
-
* Accepted and ignored. Upstream needs the container's height
|
|
187
|
-
* when a dragged row has reached an edge
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* its own size.
|
|
203
|
+
* Accepted and ignored for sizing. Upstream needs the container's height
|
|
204
|
+
* to know when a dragged row has reached an edge; the mirror's own
|
|
205
|
+
* `ScrollView` measures its own viewport for that (`autoscroll.tsx`), so
|
|
206
|
+
* the hint has nothing left to correct.
|
|
191
207
|
*
|
|
192
208
|
* Kept because upstream's own example app passes it on every
|
|
193
209
|
* `SortableItem` — a mirror that drops it turns a literal port into an
|
|
194
210
|
* edit, which is the one thing this module exists to avoid.
|
|
195
211
|
*/
|
|
196
212
|
containerHeight?: number;
|
|
197
|
-
/** Accepted and ignored, same reason. */
|
|
213
|
+
/** Accepted and ignored, same reason, for a horizontal list. */
|
|
214
|
+
containerWidth?: number;
|
|
215
|
+
/** Accepted and ignored, same reason as `itemHeight`. */
|
|
198
216
|
isDynamicHeight?: boolean;
|
|
199
217
|
scheduleHeightUpdate?: (id: string, height: number) => void;
|
|
200
218
|
}
|
|
@@ -203,6 +221,10 @@ export interface SortableCallbacks {
|
|
|
203
221
|
onDragStart?: (id: string, position: number) => void;
|
|
204
222
|
onDrop?: (id: string, position: number, allPositions?: Record<string, number>) => void;
|
|
205
223
|
onDragging?: (id: string, overItemId: string | null, yPosition: number) => void;
|
|
224
|
+
/** The horizontal counterpart of `onDragging` — upstream's `SortableItem`
|
|
225
|
+
* carries both, one per direction, rather than reusing the name with a
|
|
226
|
+
* different meaning. */
|
|
227
|
+
onDraggingHorizontal?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
206
228
|
}
|
|
207
229
|
export interface UseSortableOptions<TData = unknown> extends SortableCallbacks, SortableItemPlumbing {
|
|
208
230
|
id: string;
|
|
@@ -247,6 +269,13 @@ export interface SortableProps<TData extends SortableData> extends SortableCallb
|
|
|
247
269
|
testID?: string;
|
|
248
270
|
/** Accepted and ignored — see `SortableItemPlumbing`. */
|
|
249
271
|
itemHeight?: number | number[] | ((item: TData, index: number) => number);
|
|
272
|
+
/** A horizontal list's column width — required in that direction, same as
|
|
273
|
+
* upstream. */
|
|
274
|
+
itemWidth?: number;
|
|
275
|
+
/** Applied to the content container as a real Yoga `gap`. */
|
|
276
|
+
gap?: number;
|
|
277
|
+
/** Applied to the content container as real `paddingHorizontal`. */
|
|
278
|
+
paddingHorizontal?: number;
|
|
250
279
|
/** Accepted and ignored. */
|
|
251
280
|
estimatedItemHeight?: number;
|
|
252
281
|
/** Accepted and ignored. */
|
|
@@ -255,9 +284,10 @@ export interface SortableProps<TData extends SortableData> extends SortableCallb
|
|
|
255
284
|
useFlatList?: boolean;
|
|
256
285
|
/** Accepted and ignored. */
|
|
257
286
|
onHeightsMeasured?: (heights: Record<string, number>) => void;
|
|
258
|
-
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
287
|
+
/** Vertical (the default) scrolls a column; horizontal scrolls a row, with
|
|
288
|
+
* reorder-by-crossing working exactly the same way regardless of which
|
|
289
|
+
* axis it is laid out along — the tracked position (sortable.tsx) reads
|
|
290
|
+
* whichever coordinate this axis cares about. */
|
|
261
291
|
direction?: SortableDirection;
|
|
262
292
|
}
|
|
263
293
|
export interface SortableHandleProps {
|
|
@@ -288,3 +318,195 @@ export interface UseSortableListReturn<TData extends SortableData> {
|
|
|
288
318
|
items: TData[];
|
|
289
319
|
getItemProps: (item: TData, index: number) => SortableItemPlumbing;
|
|
290
320
|
}
|
|
321
|
+
export interface UseHorizontalSortableOptions<TData = unknown> {
|
|
322
|
+
id: string;
|
|
323
|
+
data?: TData;
|
|
324
|
+
positions: SharedValueLike<Record<string, number>>;
|
|
325
|
+
leftBound: SharedValueLike<number>;
|
|
326
|
+
autoScrollDirection: SharedValueLike<HorizontalScrollDirection>;
|
|
327
|
+
itemsCount: number;
|
|
328
|
+
/** Accepted and ignored — see `SortableItemPlumbing.itemWidth`. */
|
|
329
|
+
itemWidth?: number;
|
|
330
|
+
/** Applied to the content container as a real Yoga `gap`. */
|
|
331
|
+
gap?: number;
|
|
332
|
+
/** Applied to the content container as real `paddingHorizontal`. */
|
|
333
|
+
paddingHorizontal?: number;
|
|
334
|
+
/** Accepted and ignored — the mirror's own `ScrollView` measures its own
|
|
335
|
+
* viewport (`autoscroll.tsx`). */
|
|
336
|
+
containerWidth?: number;
|
|
337
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
338
|
+
onDragStart?: (id: string, position: number) => void;
|
|
339
|
+
onDrop?: (id: string, position: number, allPositions?: Record<string, number>) => void;
|
|
340
|
+
onDragging?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
341
|
+
}
|
|
342
|
+
/** Same shape as `UseSortableReturn` — this platform's reorder is a
|
|
343
|
+
* re-render, not a transform, on either axis. */
|
|
344
|
+
export type UseHorizontalSortableReturn = UseSortableReturn;
|
|
345
|
+
export interface UseHorizontalSortableListOptions<TData extends SortableData> {
|
|
346
|
+
data: TData[];
|
|
347
|
+
itemWidth: number;
|
|
348
|
+
gap?: number;
|
|
349
|
+
paddingHorizontal?: number;
|
|
350
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
351
|
+
}
|
|
352
|
+
export interface UseHorizontalSortableListReturn<TData extends SortableData> {
|
|
353
|
+
positions: SharedValueLike<Record<string, number>>;
|
|
354
|
+
scrollX: SharedValueLike<number>;
|
|
355
|
+
autoScroll: SharedValueLike<HorizontalScrollDirection>;
|
|
356
|
+
dropProviderRef: RefObject<DropProviderRef | null>;
|
|
357
|
+
handleScroll: () => void;
|
|
358
|
+
handleScrollEnd: () => void;
|
|
359
|
+
contentWidth: number;
|
|
360
|
+
/** The current order, which this hook owns — same contract as
|
|
361
|
+
* `UseSortableListReturn.items`. */
|
|
362
|
+
items: TData[];
|
|
363
|
+
getItemProps: (item: TData, index: number) => {
|
|
364
|
+
id: string;
|
|
365
|
+
positions: SharedValueLike<Record<string, number>>;
|
|
366
|
+
leftBound: SharedValueLike<number>;
|
|
367
|
+
autoScrollDirection: SharedValueLike<HorizontalScrollDirection>;
|
|
368
|
+
itemsCount: number;
|
|
369
|
+
itemWidth: number;
|
|
370
|
+
gap: number;
|
|
371
|
+
paddingHorizontal: number;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
export declare enum GridScrollDirection {
|
|
375
|
+
None = "none",
|
|
376
|
+
Up = "up",
|
|
377
|
+
Down = "down",
|
|
378
|
+
Left = "left",
|
|
379
|
+
Right = "right",
|
|
380
|
+
UpLeft = "up-left",
|
|
381
|
+
UpRight = "up-right",
|
|
382
|
+
DownLeft = "down-left",
|
|
383
|
+
DownRight = "down-right"
|
|
384
|
+
}
|
|
385
|
+
export declare enum GridOrientation {
|
|
386
|
+
Vertical = "vertical",
|
|
387
|
+
Horizontal = "horizontal"
|
|
388
|
+
}
|
|
389
|
+
export declare enum GridStrategy {
|
|
390
|
+
Insert = "insert",
|
|
391
|
+
Swap = "swap"
|
|
392
|
+
}
|
|
393
|
+
export interface GridPosition {
|
|
394
|
+
index: number;
|
|
395
|
+
row: number;
|
|
396
|
+
column: number;
|
|
397
|
+
x: number;
|
|
398
|
+
y: number;
|
|
399
|
+
}
|
|
400
|
+
export interface GridPositions {
|
|
401
|
+
[id: string]: GridPosition;
|
|
402
|
+
}
|
|
403
|
+
export interface GridDimensions {
|
|
404
|
+
/** Required when `orientation` is `Vertical` (the default) — how many
|
|
405
|
+
* cells make a row before the grid wraps to the next one. */
|
|
406
|
+
columns?: number;
|
|
407
|
+
/** Required when `orientation` is `Horizontal` — how many cells make a
|
|
408
|
+
* column before the grid wraps to the next one. */
|
|
409
|
+
rows?: number;
|
|
410
|
+
itemWidth: number;
|
|
411
|
+
itemHeight: number;
|
|
412
|
+
rowGap?: number;
|
|
413
|
+
columnGap?: number;
|
|
414
|
+
}
|
|
415
|
+
export interface GridCallbacks {
|
|
416
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
417
|
+
onDragStart?: (id: string, position: number) => void;
|
|
418
|
+
onDrop?: (id: string, position: number, allPositions?: GridPositions) => void;
|
|
419
|
+
onDragging?: (id: string, overItemId: string | null, x: number, y: number) => void;
|
|
420
|
+
}
|
|
421
|
+
/** The plumbing `SortableGrid` hands `renderItem` and `renderItem` hands
|
|
422
|
+
* `SortableGridItem` — opaque, same contract as `SortableItemPlumbing`. */
|
|
423
|
+
export interface GridItemPlumbing {
|
|
424
|
+
positions: SharedValueLike<GridPositions>;
|
|
425
|
+
scrollY: SharedValueLike<number>;
|
|
426
|
+
scrollX: SharedValueLike<number>;
|
|
427
|
+
/** Real — see `autoscroll.tsx`. Written as the drag nears any of the
|
|
428
|
+
* grid's four edges, diagonals included. */
|
|
429
|
+
autoScrollDirection: SharedValueLike<GridScrollDirection>;
|
|
430
|
+
itemsCount: number;
|
|
431
|
+
dimensions: GridDimensions;
|
|
432
|
+
orientation: GridOrientation;
|
|
433
|
+
strategy?: GridStrategy;
|
|
434
|
+
/** Accepted and ignored — the mirror's own `ScrollView` measures its own
|
|
435
|
+
* viewport. */
|
|
436
|
+
containerWidth?: number;
|
|
437
|
+
/** Accepted and ignored, same reason. */
|
|
438
|
+
containerHeight?: number;
|
|
439
|
+
/** Accepted and ignored. GDK's own drag threshold already separates a tap
|
|
440
|
+
* from a drag — same as `preDragDelay` elsewhere in this module. */
|
|
441
|
+
activationDelay?: number;
|
|
442
|
+
isBeingRemoved?: boolean;
|
|
443
|
+
}
|
|
444
|
+
export interface UseGridSortableOptions<TData = unknown> extends GridCallbacks, GridItemPlumbing {
|
|
445
|
+
id: string;
|
|
446
|
+
data?: TData;
|
|
447
|
+
}
|
|
448
|
+
export interface UseGridSortableReturn {
|
|
449
|
+
/** Upstream returns a Reanimated style here; this platform reorders by
|
|
450
|
+
* re-rendering, so the cell needs no transform. */
|
|
451
|
+
animatedStyle: StyleProp;
|
|
452
|
+
isMoving: boolean;
|
|
453
|
+
hasHandle: boolean;
|
|
454
|
+
registerHandle: (registered: boolean) => void;
|
|
455
|
+
/** Everything the cell's view must contain: the drop target always, and
|
|
456
|
+
* the drag source unless a handle has claimed it. */
|
|
457
|
+
children: ReactNode;
|
|
458
|
+
/** The drag source on its own, for a caller placing its own handle. */
|
|
459
|
+
dragControllers: ReactNode;
|
|
460
|
+
}
|
|
461
|
+
export interface SortableGridItemProps<TData = unknown> extends Partial<GridItemPlumbing>, GridCallbacks {
|
|
462
|
+
id: string;
|
|
463
|
+
data?: TData;
|
|
464
|
+
children: ReactNode;
|
|
465
|
+
style?: StyleProp;
|
|
466
|
+
/** Accepted for spread compatibility; upstream's own transform style. */
|
|
467
|
+
animatedStyle?: StyleProp;
|
|
468
|
+
testID?: string;
|
|
469
|
+
}
|
|
470
|
+
export interface SortableGridRenderItemProps<TData extends SortableData> extends GridItemPlumbing {
|
|
471
|
+
item: TData;
|
|
472
|
+
index: number;
|
|
473
|
+
id: string;
|
|
474
|
+
}
|
|
475
|
+
export interface SortableGridProps<TData extends SortableData> {
|
|
476
|
+
data: TData[];
|
|
477
|
+
renderItem: (props: SortableGridRenderItemProps<TData>) => ReactNode;
|
|
478
|
+
dimensions: GridDimensions;
|
|
479
|
+
orientation?: GridOrientation;
|
|
480
|
+
strategy?: GridStrategy;
|
|
481
|
+
style?: StyleProp;
|
|
482
|
+
contentContainerStyle?: StyleProp;
|
|
483
|
+
/** Accepted and ignored — upstream declares it but its own
|
|
484
|
+
* `SortableGrid.js` never reads it either; verified against the
|
|
485
|
+
* published 2.0.0 source. */
|
|
486
|
+
itemContainerStyle?: StyleProp;
|
|
487
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
488
|
+
scrollEnabled?: boolean;
|
|
489
|
+
testID?: string;
|
|
490
|
+
}
|
|
491
|
+
export interface UseGridSortableListOptions<TData extends SortableData> {
|
|
492
|
+
data: TData[];
|
|
493
|
+
dimensions: GridDimensions;
|
|
494
|
+
orientation?: GridOrientation;
|
|
495
|
+
strategy?: GridStrategy;
|
|
496
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
497
|
+
}
|
|
498
|
+
export interface UseGridSortableListReturn<TData extends SortableData> {
|
|
499
|
+
positions: SharedValueLike<GridPositions>;
|
|
500
|
+
scrollY: SharedValueLike<number>;
|
|
501
|
+
scrollX: SharedValueLike<number>;
|
|
502
|
+
autoScrollDirection: SharedValueLike<GridScrollDirection>;
|
|
503
|
+
dropProviderRef: RefObject<DropProviderRef | null>;
|
|
504
|
+
handleScroll: () => void;
|
|
505
|
+
handleScrollEnd: () => void;
|
|
506
|
+
contentWidth: number;
|
|
507
|
+
contentHeight: number;
|
|
508
|
+
/** The current order, which this hook owns — same contract as
|
|
509
|
+
* `UseSortableListReturn.items`. */
|
|
510
|
+
items: TData[];
|
|
511
|
+
getItemProps: (item: TData, index: number) => GridItemPlumbing;
|
|
512
|
+
}
|
package/dist/dnd/types.js
CHANGED
|
@@ -22,4 +22,34 @@ export var SortableDirection;
|
|
|
22
22
|
SortableDirection["Vertical"] = "vertical";
|
|
23
23
|
SortableDirection["Horizontal"] = "horizontal";
|
|
24
24
|
})(SortableDirection || (SortableDirection = {}));
|
|
25
|
+
// --- grid sortable -----------------------------------------------------------
|
|
26
|
+
//
|
|
27
|
+
// `SortableGrid`/`SortableGridItem`/`useGridSortable*` — the 2-D reorder,
|
|
28
|
+
// `grid-order.ts` is the arithmetic (row/column from a flat index and back),
|
|
29
|
+
// this is the surface it plugs into. Deliberately NOT re-exported here:
|
|
30
|
+
// `setGridPosition`/`setGridAutoScroll`, upstream's worklets that MUTATE a
|
|
31
|
+
// `SharedValue` mid-gesture — see index.ts for why `setPosition`/
|
|
32
|
+
// `setAutoScroll` are not re-exported either.
|
|
33
|
+
export var GridScrollDirection;
|
|
34
|
+
(function (GridScrollDirection) {
|
|
35
|
+
GridScrollDirection["None"] = "none";
|
|
36
|
+
GridScrollDirection["Up"] = "up";
|
|
37
|
+
GridScrollDirection["Down"] = "down";
|
|
38
|
+
GridScrollDirection["Left"] = "left";
|
|
39
|
+
GridScrollDirection["Right"] = "right";
|
|
40
|
+
GridScrollDirection["UpLeft"] = "up-left";
|
|
41
|
+
GridScrollDirection["UpRight"] = "up-right";
|
|
42
|
+
GridScrollDirection["DownLeft"] = "down-left";
|
|
43
|
+
GridScrollDirection["DownRight"] = "down-right";
|
|
44
|
+
})(GridScrollDirection || (GridScrollDirection = {}));
|
|
45
|
+
export var GridOrientation;
|
|
46
|
+
(function (GridOrientation) {
|
|
47
|
+
GridOrientation["Vertical"] = "vertical";
|
|
48
|
+
GridOrientation["Horizontal"] = "horizontal";
|
|
49
|
+
})(GridOrientation || (GridOrientation = {}));
|
|
50
|
+
export var GridStrategy;
|
|
51
|
+
(function (GridStrategy) {
|
|
52
|
+
GridStrategy["Insert"] = "insert";
|
|
53
|
+
GridStrategy["Swap"] = "swap";
|
|
54
|
+
})(GridStrategy || (GridStrategy = {}));
|
|
25
55
|
//# sourceMappingURL=types.js.map
|
package/dist/dnd/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dnd/types.ts"],"names":[],"mappings":"AAwBA,+EAA+E;AAE/E,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAqKD,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,4BAAS,CAAA;IACT,gCAAa,CAAA;AACf,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAN,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,0CAAa,CAAA;IACb,4CAAe,CAAA;AACjB,CAAC,EAJW,yBAAyB,KAAzB,yBAAyB,QAIpC;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,8CAAyB,CAAA;AAC3B,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["// The mirrored type surface of `react-native-reanimated-dnd`, name for name.\n//\n// WHY the names are copied rather than improved: the point of this subpath\n// is that an app which already uses that library keeps its source. A better\n// name here would be a worse module — see docs/research/drag-and-drop.md.\nimport type { ReactNode, RefObject } from \"react\"\nimport type { StyleProp } from \"../contracts\"\n\n/**\n * What `SharedValue<T>` degrades to here.\n *\n * Reanimated's `SharedValue<T>` is `{ value: T }` plus the worklet plumbing\n * that makes writes cross to the UI thread. There is no UI thread on this\n * platform, so this is the same box without the crossing: **reads and\n * writes both work**, they just do not drive an animation.\n *\n * That matters more than it looks. `positions`, `lowerBound`,\n * `autoScrollDirection` and `itemHeights` appear in\n * `SortableRenderItemProps` — public API an app forwards with `{...rest}`\n * and, occasionally, reads. Typing them as an opaque token would break the\n * reads; typing them as this keeps them working.\n */\nexport type SharedValueLike<T> = { value: T }\n\n// --- draggable --------------------------------------------------------------\n\nexport enum DraggableState {\n IDLE = \"IDLE\",\n DRAGGING = \"DRAGGING\",\n DROPPED = \"DROPPED\",\n}\n\nexport type AnimationFunction = (toValue: number) => number\n\nexport type CollisionAlgorithm = \"center\" | \"intersect\" | \"contain\"\n\nexport interface UseDraggableOptions<TData = unknown> {\n data: TData\n draggableId?: string\n dragDisabled?: boolean\n onDragStart?: (data: TData) => void\n onDragEnd?: (data: TData) => void\n onDragging?: (payload: {\n x: number\n y: number\n tx: number\n ty: number\n itemData: TData\n }) => void\n onStateChange?: (state: DraggableState) => void\n /**\n * Accepted and ignored. Upstream uses it to tell a tap from a drag; GDK\n * already does that with `gtk-dnd-drag-threshold` before it starts a drag\n * at all, so honouring it would only make dragging feel slower.\n */\n preDragDelay?: number\n /**\n * Accepted and ignored. GDK hit-tests the pointer against the real widget\n * tree; of the three upstream algorithms `\"center\"` is closest, since the\n * drag icon is carried at the point it was grabbed.\n */\n collisionAlgorithm?: CollisionAlgorithm\n /** Unsupported: the compositor carries the drag icon and nothing here can\n * constrain its path. Kept in the type so a shared file still compiles\n * for iOS and Android. */\n dragAxis?: \"x\" | \"y\" | \"both\"\n /** Unsupported, same reason as `dragAxis`. */\n dragBoundsRef?: RefObject<unknown>\n /** Unsupported: there is no return animation, because the view never\n * left — GDK drew a picture of it instead. */\n animationFunction?: AnimationFunction\n}\n\nexport interface UseDraggableReturn {\n /** Spread onto the view that should be draggable. Upstream's name for it\n * is `animatedViewProps`; the props are a `style` and the drag\n * controllers, which on this platform are React children rather than a\n * style. */\n animatedViewProps: {\n style?: StyleProp\n children: ReactNode\n }\n state: DraggableState\n hasHandle: boolean\n registerHandle: (registered: boolean) => void\n}\n\nexport interface DraggableProps<\n TData = unknown,\n> extends UseDraggableOptions<TData> {\n style?: StyleProp\n children: ReactNode\n testID?: string\n}\n\nexport interface DraggableHandleProps {\n children: ReactNode\n style?: StyleProp\n testID?: string\n}\n\n// --- droppable --------------------------------------------------------------\n\nexport type DropAlignment =\n | \"center\"\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"center-left\"\n | \"center-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\"\n\nexport interface DropOffset {\n x: number\n y: number\n}\n\nexport interface UseDroppableOptions<TData = unknown> {\n onDrop: (data: TData) => void\n dropDisabled?: boolean\n onActiveChange?: (isActive: boolean) => void\n activeStyle?: StyleProp\n droppableId?: string\n /** How many draggables this zone accepts. When it is full GDK is told to\n * REFUSE the drop, so the pointer shows the no-drop cursor — upstream\n * silently skips the slot instead. */\n capacity?: number\n /** Unsupported: both of these place the dragged view inside the zone\n * after the drop, and the view never moved. */\n dropAlignment?: DropAlignment\n dropOffset?: DropOffset\n}\n\nexport interface UseDroppableReturn {\n viewProps: {\n style?: StyleProp\n children: ReactNode\n }\n isActive: boolean\n activeStyle?: StyleProp\n}\n\nexport interface DroppableProps<\n TData = unknown,\n> extends UseDroppableOptions<TData> {\n style?: StyleProp\n children: ReactNode\n testID?: string\n}\n\n// --- context ----------------------------------------------------------------\n\nexport interface DroppedItemsMap<TData = unknown> {\n [draggableId: string]: { droppableId: string; data: TData }\n}\n\nexport interface DropProviderProps {\n children: ReactNode\n onDroppedItemsUpdate?: (droppedItems: DroppedItemsMap) => void\n onDragStart?: (data: unknown) => void\n onDragEnd?: (data: unknown) => void\n onDragging?: (payload: {\n x: number\n y: number\n tx: number\n ty: number\n itemData: unknown\n }) => void\n /** Accepted and ignored: there is no layout pass to complete, because\n * nothing caches a slot rectangle. See `requestPositionUpdate`. */\n onLayoutUpdateComplete?: () => void\n style?: StyleProp\n testID?: string\n ref?: RefObject<DropProviderRef | null>\n}\n\nexport interface DropProviderRef {\n /**\n * A no-op **because GDK re-hit-tests on every motion**. Upstream needs it\n * to refresh cached slot rectangles after a scroll or a relayout; there\n * are no cached rectangles here, so calling it is harmless and\n * unnecessary. Kept so an app that calls it after a list update compiles.\n */\n requestPositionUpdate: () => void\n getDroppedItems: () => DroppedItemsMap\n}\n\n// --- sortable ---------------------------------------------------------------\n\nexport interface SortableData {\n id: string\n}\n\nexport enum ScrollDirection {\n None = \"none\",\n Up = \"up\",\n Down = \"down\",\n}\n\nexport enum HorizontalScrollDirection {\n None = \"none\",\n Left = \"left\",\n Right = \"right\",\n}\n\nexport enum SortableDirection {\n Vertical = \"vertical\",\n Horizontal = \"horizontal\",\n}\n\n/** The plumbing `Sortable` hands `renderItem` and `renderItem` hands\n * `SortableItem` — opaque in upstream's own examples, which destructure\n * `item`/`index`/`id` and spread the rest. */\nexport interface SortableItemPlumbing {\n positions: SharedValueLike<Record<string, number>>\n lowerBound: SharedValueLike<number>\n autoScrollDirection: SharedValueLike<ScrollDirection>\n itemHeights: SharedValueLike<Record<string, number>>\n itemsCount: number\n /** Accepted and ignored: Yoga lays rows out at their natural height, so\n * a height hint has nothing to correct. */\n itemHeight?: number\n /** Accepted and ignored, same reason. */\n estimatedItemHeight?: number\n /**\n * Accepted and ignored. Upstream needs the container's height to know\n * when a dragged row has reached an edge and autoscroll should start;\n * there is no autoscroll here (docs/research/drag-and-drop.md), and the\n * rows are in flow layout inside a real `ScrollView` that already knows\n * its own size.\n *\n * Kept because upstream's own example app passes it on every\n * `SortableItem` — a mirror that drops it turns a literal port into an\n * edit, which is the one thing this module exists to avoid.\n */\n containerHeight?: number\n /** Accepted and ignored, same reason. */\n isDynamicHeight?: boolean\n scheduleHeightUpdate?: (id: string, height: number) => void\n}\n\nexport interface SortableCallbacks {\n onMove?: (id: string, from: number, to: number) => void\n onDragStart?: (id: string, position: number) => void\n onDrop?: (\n id: string,\n position: number,\n allPositions?: Record<string, number>,\n ) => void\n onDragging?: (\n id: string,\n overItemId: string | null,\n yPosition: number,\n ) => void\n}\n\nexport interface UseSortableOptions<TData = unknown>\n extends SortableCallbacks, SortableItemPlumbing {\n id: string\n data?: TData\n}\n\nexport interface UseSortableReturn {\n /** Upstream returns a Reanimated style here. This platform reorders by\n * re-rendering, so the row needs no transform — the field stays for\n * spread compatibility. */\n animatedStyle: StyleProp\n isMoving: boolean\n hasHandle: boolean\n registerHandle: (registered: boolean) => void\n /** Everything the row's view must contain: the drop target always, and the\n * drag source unless a handle has claimed it. */\n children: ReactNode\n /** The drag source on its own, for a caller placing its own handle. */\n dragControllers: ReactNode\n}\n\nexport interface SortableItemProps<TData = unknown>\n extends Partial<SortableItemPlumbing>, SortableCallbacks {\n id: string\n data?: TData\n children: ReactNode\n style?: StyleProp\n /** Accepted for spread compatibility; upstream's own transform style. */\n animatedStyle?: StyleProp\n direction?: SortableDirection\n testID?: string\n}\n\nexport interface SortableRenderItemProps<\n TData extends SortableData,\n> extends SortableItemPlumbing {\n item: TData\n index: number\n id: string\n direction?: SortableDirection\n}\n\nexport interface SortableProps<\n TData extends SortableData,\n> extends SortableCallbacks {\n data: TData[]\n renderItem: (props: SortableRenderItemProps<TData>) => ReactNode\n itemKeyExtractor?: (item: TData, index: number) => string\n style?: StyleProp\n contentContainerStyle?: StyleProp\n testID?: string\n /** Accepted and ignored — see `SortableItemPlumbing`. */\n itemHeight?: number | number[] | ((item: TData, index: number) => number)\n /** Accepted and ignored. */\n estimatedItemHeight?: number\n /** Accepted and ignored. */\n enableDynamicHeights?: boolean\n /** Accepted and ignored. */\n useFlatList?: boolean\n /** Accepted and ignored. */\n onHeightsMeasured?: (heights: Record<string, number>) => void\n /** `SortableDirection.Horizontal` is not implemented — see\n * docs/research/drag-and-drop.md. Passing it throws, rather than\n * silently laying out vertically. */\n direction?: SortableDirection\n}\n\nexport interface SortableHandleProps {\n children: ReactNode\n style?: StyleProp\n testID?: string\n}\n\nexport interface UseSortableListOptions<TData extends SortableData> {\n data: TData[]\n itemKeyExtractor?: (item: TData, index: number) => string\n itemHeight?: number | number[] | ((item: TData, index: number) => number)\n enableDynamicHeights?: boolean\n estimatedItemHeight?: number\n onHeightsMeasured?: (heights: Record<string, number>) => void\n}\n\nexport interface UseSortableListReturn<TData extends SortableData> {\n positions: SharedValueLike<Record<string, number>>\n scrollY: SharedValueLike<number>\n autoScroll: SharedValueLike<ScrollDirection>\n itemHeights: SharedValueLike<Record<string, number>>\n dropProviderRef: RefObject<DropProviderRef | null>\n handleScroll: () => void\n handleScrollEnd: () => void\n contentHeight: number\n isDynamicHeight: boolean\n /** The current order, which this hook owns — upstream keeps the same\n * contract (\"do NOT update external state in `onMove`\"). */\n items: TData[]\n getItemProps: (item: TData, index: number) => SortableItemPlumbing\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dnd/types.ts"],"names":[],"mappings":"AAwBA,+EAA+E;AAE/E,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,+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d`, name for name.\n//\n// WHY the names are copied rather than improved: the point of this subpath\n// is that an app which already uses that library keeps its source. A better\n// name here would be a worse module — see docs/research/drag-and-drop.md.\nimport type { ReactNode, RefObject } from \"react\"\nimport type { StyleProp } from \"../contracts\"\n\n/**\n * What `SharedValue<T>` degrades to here.\n *\n * Reanimated's `SharedValue<T>` is `{ value: T }` plus the worklet plumbing\n * that makes writes cross to the UI thread. There is no UI thread on this\n * platform, so this is the same box without the crossing: **reads and\n * writes both work**, they just do not drive an animation.\n *\n * That matters more than it looks. `positions`, `lowerBound`,\n * `autoScrollDirection` and `itemHeights` appear in\n * `SortableRenderItemProps` — public API an app forwards with `{...rest}`\n * and, occasionally, reads. Typing them as an opaque token would break the\n * reads; typing them as this keeps them working.\n */\nexport type SharedValueLike<T> = { value: T }\n\n// --- draggable --------------------------------------------------------------\n\nexport enum DraggableState {\n IDLE = \"IDLE\",\n DRAGGING = \"DRAGGING\",\n DROPPED = \"DROPPED\",\n}\n\nexport type AnimationFunction = (toValue: number) => number\n\nexport type CollisionAlgorithm = \"center\" | \"intersect\" | \"contain\"\n\nexport interface UseDraggableOptions<TData = unknown> {\n data: TData\n draggableId?: string\n dragDisabled?: boolean\n onDragStart?: (data: TData) => void\n onDragEnd?: (data: TData) => void\n onDragging?: (payload: {\n x: number\n y: number\n tx: number\n ty: number\n itemData: TData\n }) => void\n onStateChange?: (state: DraggableState) => void\n /**\n * Accepted and ignored. Upstream uses it to tell a tap from a drag; GDK\n * already does that with `gtk-dnd-drag-threshold` before it starts a drag\n * at all, so honouring it would only make dragging feel slower.\n */\n preDragDelay?: number\n /**\n * Accepted and ignored. GDK hit-tests the pointer against the real widget\n * tree; of the three upstream algorithms `\"center\"` is closest, since the\n * drag icon is carried at the point it was grabbed.\n */\n collisionAlgorithm?: CollisionAlgorithm\n /** Unsupported: the compositor carries the drag icon and nothing here can\n * constrain its path. Kept in the type so a shared file still compiles\n * for iOS and Android. */\n dragAxis?: \"x\" | \"y\" | \"both\"\n /** Unsupported, same reason as `dragAxis`. */\n dragBoundsRef?: RefObject<unknown>\n /** Unsupported: there is no return animation, because the view never\n * left — GDK drew a picture of it instead. */\n animationFunction?: AnimationFunction\n}\n\nexport interface UseDraggableReturn {\n /** Spread onto the view that should be draggable. Upstream's name for it\n * is `animatedViewProps`; the props are a `style` and the drag\n * controllers, which on this platform are React children rather than a\n * style. */\n animatedViewProps: {\n style?: StyleProp\n children: ReactNode\n }\n state: DraggableState\n hasHandle: boolean\n registerHandle: (registered: boolean) => void\n}\n\nexport interface DraggableProps<\n TData = unknown,\n> extends UseDraggableOptions<TData> {\n style?: StyleProp\n children: ReactNode\n testID?: string\n}\n\nexport interface DraggableHandleProps {\n children: ReactNode\n style?: StyleProp\n testID?: string\n}\n\n// --- droppable --------------------------------------------------------------\n\nexport type DropAlignment =\n | \"center\"\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"center-left\"\n | \"center-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\"\n\nexport interface DropOffset {\n x: number\n y: number\n}\n\nexport interface UseDroppableOptions<TData = unknown> {\n onDrop: (data: TData) => void\n dropDisabled?: boolean\n onActiveChange?: (isActive: boolean) => void\n activeStyle?: StyleProp\n droppableId?: string\n /** How many draggables this zone accepts. When it is full GDK is told to\n * REFUSE the drop, so the pointer shows the no-drop cursor — upstream\n * silently skips the slot instead. */\n capacity?: number\n /** Unsupported: both of these place the dragged view inside the zone\n * after the drop, and the view never moved. */\n dropAlignment?: DropAlignment\n dropOffset?: DropOffset\n}\n\nexport interface UseDroppableReturn {\n viewProps: {\n style?: StyleProp\n children: ReactNode\n }\n isActive: boolean\n activeStyle?: StyleProp\n}\n\nexport interface DroppableProps<\n TData = unknown,\n> extends UseDroppableOptions<TData> {\n style?: StyleProp\n children: ReactNode\n testID?: string\n}\n\n// --- context ----------------------------------------------------------------\n\nexport interface DroppedItemsMap<TData = unknown> {\n [draggableId: string]: { droppableId: string; data: TData }\n}\n\nexport interface DropProviderProps {\n children: ReactNode\n onDroppedItemsUpdate?: (droppedItems: DroppedItemsMap) => void\n onDragStart?: (data: unknown) => void\n onDragEnd?: (data: unknown) => void\n onDragging?: (payload: {\n x: number\n y: number\n tx: number\n ty: number\n itemData: unknown\n }) => void\n /** Accepted and ignored: there is no layout pass to complete, because\n * nothing caches a slot rectangle. See `requestPositionUpdate`. */\n onLayoutUpdateComplete?: () => void\n style?: StyleProp\n testID?: string\n ref?: RefObject<DropProviderRef | null>\n}\n\nexport interface DropProviderRef {\n /**\n * A no-op **because GDK re-hit-tests on every motion**. Upstream needs it\n * to refresh cached slot rectangles after a scroll or a relayout; there\n * are no cached rectangles here, so calling it is harmless and\n * unnecessary. Kept so an app that calls it after a list update compiles.\n */\n requestPositionUpdate: () => void\n getDroppedItems: () => DroppedItemsMap\n}\n\n// --- sortable ---------------------------------------------------------------\n\nexport interface SortableData {\n id: string\n}\n\nexport enum ScrollDirection {\n None = \"none\",\n Up = \"up\",\n Down = \"down\",\n}\n\nexport enum HorizontalScrollDirection {\n None = \"none\",\n Left = \"left\",\n Right = \"right\",\n}\n\nexport enum SortableDirection {\n Vertical = \"vertical\",\n Horizontal = \"horizontal\",\n}\n\n/** The plumbing `Sortable` hands `renderItem` and `renderItem` hands\n * `SortableItem` — opaque in upstream's own examples, which destructure\n * `item`/`index`/`id` and spread the rest. Vertical and horizontal fields\n * sit side by side, both optional, exactly as upstream's own\n * `SortableRenderItemProps` does — a single list is only ever one direction,\n * so only one half is ever real. */\nexport interface SortableItemPlumbing {\n positions: SharedValueLike<Record<string, number>>\n lowerBound?: SharedValueLike<number>\n leftBound?: SharedValueLike<number>\n /** Real now — see `autoscroll.tsx`. A vertical list writes this as the\n * drag nears the top or bottom of its own viewport. */\n autoScrollDirection?: SharedValueLike<ScrollDirection>\n /** The horizontal counterpart, written as the drag nears the left or\n * right edge of a horizontal list's viewport. */\n autoScrollHorizontalDirection?: SharedValueLike<HorizontalScrollDirection>\n itemHeights?: SharedValueLike<Record<string, number>>\n itemsCount: number\n /** Accepted and ignored: Yoga lays rows out at their natural height, so\n * a height hint has nothing to correct. */\n itemHeight?: number\n /** Accepted and ignored, same reason, for a horizontal list's columns. */\n itemWidth?: number\n /** Applied to the list's own content container as a real Yoga `gap` —\n * the space between rows/columns is not a hint here, it is the layout. */\n gap?: number\n /** Applied to the content container as real `paddingHorizontal`, same\n * reason. */\n paddingHorizontal?: number\n /** Accepted and ignored, same reason as `itemHeight`. */\n estimatedItemHeight?: number\n /**\n * Accepted and ignored for sizing. Upstream needs the container's height\n * to know when a dragged row has reached an edge; the mirror's own\n * `ScrollView` measures its own viewport for that (`autoscroll.tsx`), so\n * the hint has nothing left to correct.\n *\n * Kept because upstream's own example app passes it on every\n * `SortableItem` — a mirror that drops it turns a literal port into an\n * edit, which is the one thing this module exists to avoid.\n */\n containerHeight?: number\n /** Accepted and ignored, same reason, for a horizontal list. */\n containerWidth?: number\n /** Accepted and ignored, same reason as `itemHeight`. */\n isDynamicHeight?: boolean\n scheduleHeightUpdate?: (id: string, height: number) => void\n}\n\nexport interface SortableCallbacks {\n onMove?: (id: string, from: number, to: number) => void\n onDragStart?: (id: string, position: number) => void\n onDrop?: (\n id: string,\n position: number,\n allPositions?: Record<string, number>,\n ) => void\n onDragging?: (\n id: string,\n overItemId: string | null,\n yPosition: number,\n ) => void\n /** The horizontal counterpart of `onDragging` — upstream's `SortableItem`\n * carries both, one per direction, rather than reusing the name with a\n * different meaning. */\n onDraggingHorizontal?: (\n id: string,\n overItemId: string | null,\n xPosition: number,\n ) => void\n}\n\nexport interface UseSortableOptions<TData = unknown>\n extends SortableCallbacks, SortableItemPlumbing {\n id: string\n data?: TData\n}\n\nexport interface UseSortableReturn {\n /** Upstream returns a Reanimated style here. This platform reorders by\n * re-rendering, so the row needs no transform — the field stays for\n * spread compatibility. */\n animatedStyle: StyleProp\n isMoving: boolean\n hasHandle: boolean\n registerHandle: (registered: boolean) => void\n /** Everything the row's view must contain: the drop target always, and the\n * drag source unless a handle has claimed it. */\n children: ReactNode\n /** The drag source on its own, for a caller placing its own handle. */\n dragControllers: ReactNode\n}\n\nexport interface SortableItemProps<TData = unknown>\n extends Partial<SortableItemPlumbing>, SortableCallbacks {\n id: string\n data?: TData\n children: ReactNode\n style?: StyleProp\n /** Accepted for spread compatibility; upstream's own transform style. */\n animatedStyle?: StyleProp\n direction?: SortableDirection\n testID?: string\n}\n\nexport interface SortableRenderItemProps<\n TData extends SortableData,\n> extends SortableItemPlumbing {\n item: TData\n index: number\n id: string\n direction?: SortableDirection\n}\n\nexport interface SortableProps<\n TData extends SortableData,\n> extends SortableCallbacks {\n data: TData[]\n renderItem: (props: SortableRenderItemProps<TData>) => ReactNode\n itemKeyExtractor?: (item: TData, index: number) => string\n style?: StyleProp\n contentContainerStyle?: StyleProp\n testID?: string\n /** Accepted and ignored — see `SortableItemPlumbing`. */\n itemHeight?: number | number[] | ((item: TData, index: number) => number)\n /** A horizontal list's column width — required in that direction, same as\n * upstream. */\n itemWidth?: number\n /** Applied to the content container as a real Yoga `gap`. */\n gap?: number\n /** Applied to the content container as real `paddingHorizontal`. */\n paddingHorizontal?: number\n /** Accepted and ignored. */\n estimatedItemHeight?: number\n /** Accepted and ignored. */\n enableDynamicHeights?: boolean\n /** Accepted and ignored. */\n useFlatList?: boolean\n /** Accepted and ignored. */\n onHeightsMeasured?: (heights: Record<string, number>) => void\n /** Vertical (the default) scrolls a column; horizontal scrolls a row, with\n * reorder-by-crossing working exactly the same way regardless of which\n * axis it is laid out along — the tracked position (sortable.tsx) reads\n * whichever coordinate this axis cares about. */\n direction?: SortableDirection\n}\n\nexport interface SortableHandleProps {\n children: ReactNode\n style?: StyleProp\n testID?: string\n}\n\nexport interface UseSortableListOptions<TData extends SortableData> {\n data: TData[]\n itemKeyExtractor?: (item: TData, index: number) => string\n itemHeight?: number | number[] | ((item: TData, index: number) => number)\n enableDynamicHeights?: boolean\n estimatedItemHeight?: number\n onHeightsMeasured?: (heights: Record<string, number>) => void\n}\n\nexport interface UseSortableListReturn<TData extends SortableData> {\n positions: SharedValueLike<Record<string, number>>\n scrollY: SharedValueLike<number>\n autoScroll: SharedValueLike<ScrollDirection>\n itemHeights: SharedValueLike<Record<string, number>>\n dropProviderRef: RefObject<DropProviderRef | null>\n handleScroll: () => void\n handleScrollEnd: () => void\n contentHeight: number\n isDynamicHeight: boolean\n /** The current order, which this hook owns — upstream keeps the same\n * contract (\"do NOT update external state in `onMove`\"). */\n items: TData[]\n getItemProps: (item: TData, index: number) => SortableItemPlumbing\n}\n\n// --- horizontal sortable -----------------------------------------------------\n//\n// A separate hook from `useSortable`/`useSortableList`, upstream's own shape\n// (`hooks/useHorizontalSortable.ts` is its own file, not a direction branch of\n// `useSortable.ts`) — kept distinct here too, even though the reorder\n// mechanism underneath (the dragged item's own tracked position, sortable.tsx)\n// does not care which axis the list scrolls along.\n\nexport interface UseHorizontalSortableOptions<TData = unknown> {\n id: string\n data?: TData\n positions: SharedValueLike<Record<string, number>>\n leftBound: SharedValueLike<number>\n autoScrollDirection: SharedValueLike<HorizontalScrollDirection>\n itemsCount: number\n /** Accepted and ignored — see `SortableItemPlumbing.itemWidth`. */\n itemWidth?: number\n /** Applied to the content container as a real Yoga `gap`. */\n gap?: number\n /** Applied to the content container as real `paddingHorizontal`. */\n paddingHorizontal?: number\n /** Accepted and ignored — the mirror's own `ScrollView` measures its own\n * viewport (`autoscroll.tsx`). */\n containerWidth?: number\n onMove?: (id: string, from: number, to: number) => void\n onDragStart?: (id: string, position: number) => void\n onDrop?: (\n id: string,\n position: number,\n allPositions?: Record<string, number>,\n ) => void\n onDragging?: (\n id: string,\n overItemId: string | null,\n xPosition: number,\n ) => void\n}\n\n/** Same shape as `UseSortableReturn` — this platform's reorder is a\n * re-render, not a transform, on either axis. */\nexport type UseHorizontalSortableReturn = UseSortableReturn\n\nexport interface UseHorizontalSortableListOptions<TData extends SortableData> {\n data: TData[]\n itemWidth: number\n gap?: number\n paddingHorizontal?: number\n itemKeyExtractor?: (item: TData, index: number) => string\n}\n\nexport interface UseHorizontalSortableListReturn<TData extends SortableData> {\n positions: SharedValueLike<Record<string, number>>\n scrollX: SharedValueLike<number>\n autoScroll: SharedValueLike<HorizontalScrollDirection>\n dropProviderRef: RefObject<DropProviderRef | null>\n handleScroll: () => void\n handleScrollEnd: () => void\n contentWidth: number\n /** The current order, which this hook owns — same contract as\n * `UseSortableListReturn.items`. */\n items: TData[]\n getItemProps: (\n item: TData,\n index: number,\n ) => {\n id: string\n positions: SharedValueLike<Record<string, number>>\n leftBound: SharedValueLike<number>\n autoScrollDirection: SharedValueLike<HorizontalScrollDirection>\n itemsCount: number\n itemWidth: number\n gap: number\n paddingHorizontal: number\n }\n}\n\n// --- grid sortable -----------------------------------------------------------\n//\n// `SortableGrid`/`SortableGridItem`/`useGridSortable*` — the 2-D reorder,\n// `grid-order.ts` is the arithmetic (row/column from a flat index and back),\n// this is the surface it plugs into. Deliberately NOT re-exported here:\n// `setGridPosition`/`setGridAutoScroll`, upstream's worklets that MUTATE a\n// `SharedValue` mid-gesture — see index.ts for why `setPosition`/\n// `setAutoScroll` are not re-exported either.\n\nexport enum GridScrollDirection {\n None = \"none\",\n Up = \"up\",\n Down = \"down\",\n Left = \"left\",\n Right = \"right\",\n UpLeft = \"up-left\",\n UpRight = \"up-right\",\n DownLeft = \"down-left\",\n DownRight = \"down-right\",\n}\n\nexport enum GridOrientation {\n Vertical = \"vertical\",\n Horizontal = \"horizontal\",\n}\n\nexport enum GridStrategy {\n Insert = \"insert\",\n Swap = \"swap\",\n}\n\nexport interface GridPosition {\n index: number\n row: number\n column: number\n x: number\n y: number\n}\n\nexport interface GridPositions {\n [id: string]: GridPosition\n}\n\nexport interface GridDimensions {\n /** Required when `orientation` is `Vertical` (the default) — how many\n * cells make a row before the grid wraps to the next one. */\n columns?: number\n /** Required when `orientation` is `Horizontal` — how many cells make a\n * column before the grid wraps to the next one. */\n rows?: number\n itemWidth: number\n itemHeight: number\n rowGap?: number\n columnGap?: number\n}\n\nexport interface GridCallbacks {\n onMove?: (id: string, from: number, to: number) => void\n onDragStart?: (id: string, position: number) => void\n onDrop?: (id: string, position: number, allPositions?: GridPositions) => void\n onDragging?: (\n id: string,\n overItemId: string | null,\n x: number,\n y: number,\n ) => void\n}\n\n/** The plumbing `SortableGrid` hands `renderItem` and `renderItem` hands\n * `SortableGridItem` — opaque, same contract as `SortableItemPlumbing`. */\nexport interface GridItemPlumbing {\n positions: SharedValueLike<GridPositions>\n scrollY: SharedValueLike<number>\n scrollX: SharedValueLike<number>\n /** Real — see `autoscroll.tsx`. Written as the drag nears any of the\n * grid's four edges, diagonals included. */\n autoScrollDirection: SharedValueLike<GridScrollDirection>\n itemsCount: number\n dimensions: GridDimensions\n orientation: GridOrientation\n strategy?: GridStrategy\n /** Accepted and ignored — the mirror's own `ScrollView` measures its own\n * viewport. */\n containerWidth?: number\n /** Accepted and ignored, same reason. */\n containerHeight?: number\n /** Accepted and ignored. GDK's own drag threshold already separates a tap\n * from a drag — same as `preDragDelay` elsewhere in this module. */\n activationDelay?: number\n isBeingRemoved?: boolean\n}\n\nexport interface UseGridSortableOptions<TData = unknown>\n extends GridCallbacks, GridItemPlumbing {\n id: string\n data?: TData\n}\n\nexport interface UseGridSortableReturn {\n /** Upstream returns a Reanimated style here; this platform reorders by\n * re-rendering, so the cell needs no transform. */\n animatedStyle: StyleProp\n isMoving: boolean\n hasHandle: boolean\n registerHandle: (registered: boolean) => void\n /** Everything the cell's view must contain: the drop target always, and\n * the drag source unless a handle has claimed it. */\n children: ReactNode\n /** The drag source on its own, for a caller placing its own handle. */\n dragControllers: ReactNode\n}\n\nexport interface SortableGridItemProps<TData = unknown>\n extends Partial<GridItemPlumbing>, GridCallbacks {\n id: string\n data?: TData\n children: ReactNode\n style?: StyleProp\n /** Accepted for spread compatibility; upstream's own transform style. */\n animatedStyle?: StyleProp\n testID?: string\n}\n\nexport interface SortableGridRenderItemProps<\n TData extends SortableData,\n> extends GridItemPlumbing {\n item: TData\n index: number\n id: string\n}\n\nexport interface SortableGridProps<TData extends SortableData> {\n data: TData[]\n renderItem: (props: SortableGridRenderItemProps<TData>) => ReactNode\n dimensions: GridDimensions\n orientation?: GridOrientation\n strategy?: GridStrategy\n style?: StyleProp\n contentContainerStyle?: StyleProp\n /** Accepted and ignored — upstream declares it but its own\n * `SortableGrid.js` never reads it either; verified against the\n * published 2.0.0 source. */\n itemContainerStyle?: StyleProp\n itemKeyExtractor?: (item: TData, index: number) => string\n scrollEnabled?: boolean\n testID?: string\n}\n\nexport interface UseGridSortableListOptions<TData extends SortableData> {\n data: TData[]\n dimensions: GridDimensions\n orientation?: GridOrientation\n strategy?: GridStrategy\n itemKeyExtractor?: (item: TData, index: number) => string\n}\n\nexport interface UseGridSortableListReturn<TData extends SortableData> {\n positions: SharedValueLike<GridPositions>\n scrollY: SharedValueLike<number>\n scrollX: SharedValueLike<number>\n autoScrollDirection: SharedValueLike<GridScrollDirection>\n dropProviderRef: RefObject<DropProviderRef | null>\n handleScroll: () => void\n handleScrollEnd: () => void\n contentWidth: number\n contentHeight: number\n /** The current order, which this hook owns — same contract as\n * `UseSortableListReturn.items`. */\n items: TData[]\n getItemProps: (item: TData, index: number) => GridItemPlumbing\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GestureResponderEvent } from "../responder/types";
|
|
2
|
+
export type GestureAttach = {
|
|
3
|
+
/** The same callback ref `GestureDetector` would have put on its child. */
|
|
4
|
+
assignHandle: (instance: unknown) => void;
|
|
5
|
+
/** The same recognizer props `GestureDetector` merges onto its child. */
|
|
6
|
+
handlers: Record<string, (event: GestureResponderEvent) => boolean | void>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Null everywhere except between a `GestureDetector` whose direct attachment
|
|
10
|
+
* failed and the first of this package's own components willing to claim it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const GestureAttachContext: React.Context<GestureAttach | null>;
|
|
13
|
+
export declare const useGestureAttach: () => GestureAttach | null;
|
|
14
|
+
/**
|
|
15
|
+
* The two responder props that answer a question rather than take an event.
|
|
16
|
+
* Canonical here rather than in ./detector-runtime (which re-exports it),
|
|
17
|
+
* because `mergeGestureHandlers` below needs it and this is a leaf module —
|
|
18
|
+
* a component using the fallback should not have to pull in the rest of the
|
|
19
|
+
* recognizer machinery (the orchestrator, the tag registry, every recognizer
|
|
20
|
+
* kind) just to merge two names' worth of predicate rules.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PREDICATES: Set<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Merges a gesture's handlers into a component's own responder props, the
|
|
25
|
+
* same rule `GestureDetector` applies when the child declares one of these
|
|
26
|
+
* itself: for the two that answer a question, either side saying yes is a
|
|
27
|
+
* yes; for the rest, both run.
|
|
28
|
+
*/
|
|
29
|
+
export declare const mergeGestureHandlers: <T extends Record<string, unknown>>(own: T, handlers: GestureAttach["handlers"]) => T;
|