{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "reorder-drag-wake",
  "title": "Reorder Drag Wake",
  "description": "Drag-to-reorder where the dragged row pushes a continuous falloff field through its neighbors: they shoulder sideways and the gap ahead widens before the card ever arrives, instead of a hard placeholder line.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/core/reorder-drag-wake/component.tsx",
      "content": "\"use client\";\n\nimport {\n  useCallback,\n  useEffect,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  type KeyboardEvent as ReactKeyboardEvent,\n  type PointerEvent as ReactPointerEvent,\n} from \"react\";\n\n// ---------------------------------------------------------------------------\n// BowWake — drag-to-reorder where the dragged row pushes a continuous falloff\n// field through its neighbors instead of snapping them onto a hard placeholder\n// line. Every other row's transform is a function of its distance to the\n// dragged card's live center: translateY reflows it into the slot the card\n// would land in, translateX shoulders it up to 10px sideways (smoothstep\n// falloff over 1.5 row heights) so the gap it will drop into visibly reads as\n// the widest point of the wake before the card ever arrives. The dragged card\n// gets a 1.01 scale and a velocity-deepened shadow; on release the wake\n// collapses inward first (neighbors are already converging on their slots)\n// and the card itself settles last, on a short hold, into one underdamped\n// spring with a single overshoot. Positions are refs-only, written per-frame\n// on a direct-DOM rAF loop that sleeps once every row is at rest — no canvas,\n// DOM + CSS transforms only. Distinct from avatar-stack-flock: nothing here trails a\n// leader, every neighbor reacts independently to a field around one dragged\n// card. Full keyboard reorder ships alongside: a grip button arms discrete\n// mode (aria-pressed), arrow keys step the row through the same slots with a\n// position announcement, and Escape restores the pre-pickup order. Reduced\n// motion turns the field off entirely: rows reflow instantly and a plain\n// dashed placeholder marks the drop slot instead.\n// ---------------------------------------------------------------------------\n\nexport interface BowWakeItem {\n  id: string;\n  label: string;\n  subtitle?: string;\n}\n\nexport interface BowWakeProps {\n  /** the reorderable rows, in order */\n  items: BowWakeItem[];\n  /** fires whenever the committed order changes — drag drop or a keyboard step */\n  onReorder?: (items: BowWakeItem[]) => void;\n  /** extra classes merged onto the rendered root element */\n  className?: string;\n  /** accessible name for the list */\n  \"aria-label\"?: string;\n}\n\nconst ROW_H = 56;\nconst ROW_GAP = 8;\nconst STEP = ROW_H + ROW_GAP;\nconst WAKE_X = 10; // px, max lateral shoulder\nconst WAKE_RADIUS = STEP * 1.5; // smoothstep falloff distance\nconst DRAG_THRESHOLD = 4; // px of travel before a pointerdown becomes a live drag\nconst NEIGHBOR_K = 220;\nconst NEIGHBOR_C = 2 * 0.92 * Math.sqrt(NEIGHBOR_K); // near-critical, no overshoot\nconst SETTLE_K = 170;\nconst SETTLE_C = 2 * 0.58 * Math.sqrt(SETTLE_K); // underdamped — one overshoot\nconst SETTLE_HOLD_MS = 90; // wake collapses before the dragged card starts settling\nconst REST_EPS = 0.3;\nconst REST_VEPS = 2;\n\nfunction smoothstep(t: number) {\n  const x = Math.min(1, Math.max(0, t));\n  return x * x * (3 - 2 * x);\n}\n\nfunction buildLiveOrder(base: string[], dragId: string, insertionIndex: number): string[] {\n  const rest = base.filter((id) => id !== dragId);\n  const clamped = Math.min(rest.length, Math.max(0, insertionIndex));\n  rest.splice(clamped, 0, dragId);\n  return rest;\n}\n\ntype Phys = { x: number; y: number; vx: number; vy: number; scale: number };\n\ntype DragState = {\n  id: string;\n  pointerId: number;\n  grabOffsetY: number;\n  startClientY: number;\n  active: boolean;\n  baseOrder: string[];\n  topY: number;\n  insertionIndex: number;\n  lastY: number;\n  lastT: number;\n  vY: number;\n};\n\ntype SettleState = { startAt: number; targetSlot: number };\n\nfunction GripIcon() {\n  return (\n    <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\">\n      <circle cx=\"9\" cy=\"6\" r=\"1.6\" />\n      <circle cx=\"15\" cy=\"6\" r=\"1.6\" />\n      <circle cx=\"9\" cy=\"12\" r=\"1.6\" />\n      <circle cx=\"15\" cy=\"12\" r=\"1.6\" />\n      <circle cx=\"9\" cy=\"18\" r=\"1.6\" />\n      <circle cx=\"15\" cy=\"18\" r=\"1.6\" />\n    </svg>\n  );\n}\n\nexport function BowWake({\n  items,\n  onReorder,\n  className = \"\",\n  \"aria-label\": ariaLabel = \"Reorderable list\",\n}: BowWakeProps) {\n  const itemsById = useMemo(() => {\n    const m = new Map<string, BowWakeItem>();\n    for (const it of items) m.set(it.id, it);\n    return m;\n  }, [items]);\n\n  const [order, setOrder] = useState<string[]>(() => items.map((i) => i.id));\n  const [armedId, setArmedId] = useState<string | null>(null);\n  const [liveMsg, setLiveMsg] = useState(\"\");\n  const [reduced, setReduced] = useState(false);\n\n  const orderRef = useRef(order);\n  orderRef.current = order;\n  const armedIdRef = useRef<string | null>(null);\n  armedIdRef.current = armedId;\n  const reducedRef = useRef(false);\n  reducedRef.current = reduced;\n  const pickupOrderRef = useRef<string[] | null>(null);\n  const firstReorder = useRef(true);\n\n  const containerRef = useRef<HTMLDivElement>(null);\n  const rowRefs = useRef<Map<string, HTMLDivElement>>(new Map());\n  const placeholderRef = useRef<HTMLDivElement>(null);\n  const physRef = useRef<Map<string, Phys>>(new Map());\n  const dragRef = useRef<DragState | null>(null);\n  const settleRef = useRef<Map<string, SettleState>>(new Map());\n  const suppressClickRef = useRef(false);\n  const rafRef = useRef(0);\n  const lastFrameRef = useRef(0);\n\n  useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const update = () => setReduced(mq.matches);\n    update();\n    mq.addEventListener(\"change\", update);\n    return () => mq.removeEventListener(\"change\", update);\n  }, []);\n\n  // announce committed reorders (drag drop or keyboard step), never on mount\n  useEffect(() => {\n    if (firstReorder.current) {\n      firstReorder.current = false;\n      return;\n    }\n    onReorder?.(order.map((id) => itemsById.get(id)).filter((x): x is BowWakeItem => !!x));\n  }, [order, itemsById, onReorder]);\n\n  const writeTransform = useCallback((id: string, p: Phys) => {\n    const el = rowRefs.current.get(id);\n    if (!el) return;\n    el.style.transform = `translate3d(${p.x.toFixed(2)}px, ${p.y.toFixed(2)}px, 0) scale(${p.scale.toFixed(3)})`;\n  }, []);\n\n  const ensureLoop = useCallback(() => {\n    if (rafRef.current) return;\n    lastFrameRef.current = 0;\n    rafRef.current = requestAnimationFrame(loop);\n  }, []);\n\n  // Seed physics for ids that don't have a record yet (mount, or items added)\n  // and write their transform synchronously before paint — otherwise every\n  // row sits at the browser's default (0,0) for one frame and the whole list\n  // reads as a single stacked card until the rAF loop happens to run.\n  useLayoutEffect(() => {\n    const phys = physRef.current;\n    order.forEach((id, i) => {\n      let p = phys.get(id);\n      if (!p) {\n        p = { x: 0, y: i * STEP, vx: 0, vy: 0, scale: 1 };\n        phys.set(id, p);\n      }\n      writeTransform(id, p);\n    });\n    for (const id of Array.from(phys.keys())) {\n      if (!itemsById.has(id)) phys.delete(id);\n    }\n    ensureLoop();\n  }, [order, itemsById, writeTransform, ensureLoop]);\n\n  // dragged-row-only visuals (lift shadow, stacking order) reset the moment\n  // a drag ends, whichever way it ends — the settle spring below only owns x/y\n  const resetDragVisual = useCallback((id: string) => {\n    const el = rowRefs.current.get(id);\n    if (!el) return;\n    el.style.zIndex = \"10\";\n    el.style.setProperty(\"--bw-lift\", \"0.35\");\n  }, []);\n\n  // eslint-disable-next-line react-hooks/exhaustive-deps -- loop reads refs, deps stable across renders\n  function loop(now: number) {\n    rafRef.current = 0;\n    const dt = lastFrameRef.current ? Math.min(0.032, (now - lastFrameRef.current) / 1000) : 1 / 60;\n    lastFrameRef.current = now;\n\n    const ord = orderRef.current;\n    const drag = dragRef.current;\n    const phys = physRef.current;\n    let settled = true;\n\n    const liveOrder = drag && drag.active ? buildLiveOrder(drag.baseOrder, drag.id, drag.insertionIndex) : null;\n\n    if (drag && drag.active) {\n      const p = phys.get(drag.id);\n      if (p) {\n        p.x = 0;\n        p.y = drag.topY;\n        p.vx = 0;\n        p.vy = 0;\n        const shadowLift = Math.min(1, Math.abs(drag.vY) / 900);\n        const el = rowRefs.current.get(drag.id);\n        if (el) {\n          el.style.setProperty(\"--bw-lift\", (0.35 + shadowLift * 0.65).toFixed(2));\n          el.style.zIndex = \"30\";\n        }\n        if (!reducedRef.current) {\n          p.scale += (1.01 - p.scale) * Math.min(1, 16 * dt);\n        } else {\n          p.scale = 1;\n        }\n        writeTransform(drag.id, p);\n      }\n      settled = false;\n\n      const ph = placeholderRef.current;\n      if (ph && reducedRef.current) {\n        ph.style.display = \"block\";\n        ph.style.transform = `translate3d(0, ${(drag.insertionIndex * STEP).toFixed(2)}px, 0)`;\n      } else if (ph) {\n        ph.style.display = \"none\";\n      }\n    } else {\n      const ph = placeholderRef.current;\n      if (ph) ph.style.display = \"none\";\n    }\n\n    for (const id of ord) {\n      if (drag && drag.active && id === drag.id) continue;\n      const p = phys.get(id);\n      if (!p) continue;\n\n      let targetX = 0;\n      let targetY: number;\n\n      if (liveOrder && drag) {\n        const slot = liveOrder.indexOf(id);\n        targetY = slot * STEP;\n        const dist = Math.abs(p.y - drag.topY);\n        const falloff = reducedRef.current ? 0 : smoothstep(1 - dist / WAKE_RADIUS);\n        const sign = p.y < drag.topY ? -1 : 1;\n        targetX = sign * WAKE_X * falloff;\n      } else {\n        targetY = ord.indexOf(id) * STEP;\n      }\n\n      const settle = !drag ? settleRef.current.get(id) : undefined;\n      if (settle) {\n        if (now < settle.startAt) {\n          p.vx = 0;\n          p.vy = 0;\n          settled = false;\n        } else {\n          const targetSlotY = settle.targetSlot * STEP;\n          if (reducedRef.current) {\n            p.x = 0;\n            p.y = targetSlotY;\n            p.vx = 0;\n            p.vy = 0;\n            p.scale = 1;\n            settleRef.current.delete(id);\n          } else {\n            const ax = -SETTLE_K * (p.x - 0) - SETTLE_C * p.vx;\n            const ay = -SETTLE_K * (p.y - targetSlotY) - SETTLE_C * p.vy;\n            p.vx += ax * dt;\n            p.vy += ay * dt;\n            p.x += p.vx * dt;\n            p.y += p.vy * dt;\n            p.scale += (1 - p.scale) * Math.min(1, 10 * dt);\n            if (Math.abs(p.x) < REST_EPS && Math.abs(p.y - targetSlotY) < REST_EPS && Math.abs(p.vx) < REST_VEPS && Math.abs(p.vy) < REST_VEPS) {\n              p.x = 0;\n              p.y = targetSlotY;\n              p.vx = 0;\n              p.vy = 0;\n              p.scale = 1;\n              settleRef.current.delete(id);\n            } else {\n              settled = false;\n            }\n          }\n        }\n        writeTransform(id, p);\n        continue;\n      }\n\n      if (reducedRef.current) {\n        p.x = 0;\n        p.y = targetY;\n        p.vx = 0;\n        p.vy = 0;\n        p.scale = 1;\n      } else {\n        const ax = -NEIGHBOR_K * (p.x - targetX) - NEIGHBOR_C * p.vx;\n        const ay = -NEIGHBOR_K * (p.y - targetY) - NEIGHBOR_C * p.vy;\n        p.vx += ax * dt;\n        p.vy += ay * dt;\n        p.x += p.vx * dt;\n        p.y += p.vy * dt;\n        p.scale += (1 - p.scale) * Math.min(1, 12 * dt);\n        if (Math.abs(p.x - targetX) > REST_EPS || Math.abs(p.y - targetY) > REST_EPS || Math.abs(p.vx) > REST_VEPS || Math.abs(p.vy) > REST_VEPS) {\n          settled = false;\n        }\n      }\n      const el = rowRefs.current.get(id);\n      if (el) el.style.zIndex = \"10\";\n      writeTransform(id, p);\n    }\n\n    if (!settled || (drag && drag.active)) {\n      rafRef.current = requestAnimationFrame(loop);\n    }\n  }\n\n  const beginDrag = useCallback(\n    (id: string, e: ReactPointerEvent<HTMLButtonElement>) => {\n      if (armedIdRef.current) return; // no live drag while another row is keyboard-armed\n      const container = containerRef.current;\n      const row = rowRefs.current.get(id);\n      if (!container || !row) return;\n      const rowTop = row.getBoundingClientRect().top;\n      e.currentTarget.setPointerCapture(e.pointerId);\n      dragRef.current = {\n        id,\n        pointerId: e.pointerId,\n        grabOffsetY: e.clientY - rowTop,\n        startClientY: e.clientY,\n        active: false,\n        baseOrder: orderRef.current.slice(),\n        topY: rowTop - container.getBoundingClientRect().top,\n        insertionIndex: orderRef.current.indexOf(id),\n        lastY: 0,\n        lastT: 0,\n        vY: 0,\n      };\n    },\n    []\n  );\n\n  const moveDrag = useCallback(\n    (id: string, e: ReactPointerEvent<HTMLButtonElement>) => {\n      const d = dragRef.current;\n      if (!d || d.id !== id || d.pointerId !== e.pointerId) return;\n      const container = containerRef.current;\n      if (!container) return;\n\n      if (!d.active && Math.abs(e.clientY - d.startClientY) > DRAG_THRESHOLD) {\n        d.active = true;\n        suppressClickRef.current = true;\n        ensureLoop();\n      }\n      if (!d.active) return;\n\n      const n = d.baseOrder.length;\n      const maxTop = Math.max(0, (n - 1) * STEP);\n      const containerTop = container.getBoundingClientRect().top;\n      const rawTop = e.clientY - containerTop - d.grabOffsetY;\n      d.topY = Math.min(maxTop, Math.max(0, rawTop));\n      d.insertionIndex = Math.min(n - 1, Math.max(0, Math.round(d.topY / STEP)));\n\n      const now = performance.now();\n      if (d.lastT) {\n        const dt = (now - d.lastT) / 1000;\n        if (dt > 0.001) d.vY = (d.topY - d.lastY) / dt;\n      }\n      d.lastY = d.topY;\n      d.lastT = now;\n      ensureLoop();\n    },\n    [ensureLoop]\n  );\n\n  const endDrag = useCallback(\n    (id: string, e: ReactPointerEvent<HTMLButtonElement>, cancelled: boolean) => {\n      const d = dragRef.current;\n      if (!d || d.id !== id || d.pointerId !== e.pointerId) return;\n      if (e.currentTarget.hasPointerCapture(e.pointerId)) {\n        e.currentTarget.releasePointerCapture(e.pointerId);\n      }\n      dragRef.current = null;\n\n      if (!d.active) return; // it was a click-length press; the click handler arms it\n      resetDragVisual(id);\n\n      if (cancelled) {\n        settleRef.current.set(id, { startAt: 0, targetSlot: d.baseOrder.indexOf(id) });\n        ensureLoop();\n        return;\n      }\n\n      const finalOrder = buildLiveOrder(d.baseOrder, id, d.insertionIndex);\n      settleRef.current.set(id, { startAt: performance.now() + SETTLE_HOLD_MS, targetSlot: finalOrder.indexOf(id) });\n      setOrder(finalOrder);\n      ensureLoop();\n    },\n    [ensureLoop, resetDragVisual]\n  );\n\n  const armOrDrop = useCallback(\n    (id: string) => {\n      if (suppressClickRef.current) {\n        suppressClickRef.current = false;\n        return;\n      }\n      if (armedIdRef.current && armedIdRef.current !== id) return; // another row already armed\n\n      if (armedIdRef.current === id) {\n        const idx = orderRef.current.indexOf(id);\n        setLiveMsg(`Dropped. ${itemsById.get(id)?.label ?? \"\"}, now at position ${idx + 1} of ${orderRef.current.length}.`);\n        setArmedId(null);\n        pickupOrderRef.current = null;\n      } else {\n        pickupOrderRef.current = orderRef.current.slice();\n        setArmedId(id);\n        const idx = orderRef.current.indexOf(id);\n        setLiveMsg(\n          `Grabbed ${itemsById.get(id)?.label ?? \"\"}. Now at position ${idx + 1} of ${orderRef.current.length}. Use arrow keys to move, space to drop, escape to cancel.`\n        );\n      }\n    },\n    [itemsById]\n  );\n\n  const onHandleKeyDown = useCallback(\n    (id: string, e: ReactKeyboardEvent<HTMLButtonElement>) => {\n      if (armedIdRef.current !== id) return;\n      if (e.key !== \"ArrowUp\" && e.key !== \"ArrowDown\") return;\n      e.preventDefault();\n      const cur = orderRef.current;\n      const idx = cur.indexOf(id);\n      const swapWith = e.key === \"ArrowUp\" ? idx - 1 : idx + 1;\n      if (swapWith < 0 || swapWith >= cur.length) return;\n      const next = cur.slice();\n      next[idx] = cur[swapWith];\n      next[swapWith] = cur[idx];\n      setOrder(next);\n      settleRef.current.set(id, { startAt: 0, targetSlot: swapWith });\n      const otherId = cur[swapWith];\n      settleRef.current.set(otherId, { startAt: 0, targetSlot: idx });\n      setLiveMsg(`${itemsById.get(id)?.label ?? \"\"}, now at position ${swapWith + 1} of ${cur.length}.`);\n      ensureLoop();\n    },\n    [ensureLoop, itemsById]\n  );\n\n  // Escape: cancel a live pointer drag, or restore the pre-pickup order while\n  // keyboard-armed. Deliberately global (not scoped to focus) — the operation\n  // is \"in flight\" regardless of where focus lands in between.\n  useEffect(() => {\n    function onKeyDown(e: KeyboardEvent) {\n      if (e.key !== \"Escape\") return;\n      const d = dragRef.current;\n      if (d) {\n        if (d.active) {\n          resetDragVisual(d.id);\n          settleRef.current.set(d.id, { startAt: 0, targetSlot: d.baseOrder.indexOf(d.id) });\n          ensureLoop();\n        }\n        dragRef.current = null;\n        return;\n      }\n      const armed = armedIdRef.current;\n      if (!armed) return;\n      const restore = pickupOrderRef.current;\n      if (restore) setOrder(restore);\n      const idx = restore ? restore.indexOf(armed) : 0;\n      setLiveMsg(`Reorder cancelled. ${itemsById.get(armed)?.label ?? \"\"} restored to position ${idx + 1} of ${restore?.length ?? 0}.`);\n      setArmedId(null);\n      pickupOrderRef.current = null;\n    }\n    document.addEventListener(\"keydown\", onKeyDown);\n    return () => document.removeEventListener(\"keydown\", onKeyDown);\n  }, [itemsById, ensureLoop, resetDragVisual]);\n\n  useEffect(() => {\n    return () => {\n      if (rafRef.current) cancelAnimationFrame(rafRef.current);\n    };\n  }, []);\n\n  const containerHeight = Math.max(ROW_H, order.length * STEP - ROW_GAP);\n\n  return (\n    <div\n      className={`relative ${className}`}\n      role=\"list\"\n      aria-label={ariaLabel}\n      style={{ height: containerHeight }}\n      ref={containerRef}\n    >\n      <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n        {liveMsg}\n      </div>\n\n      <div\n        ref={placeholderRef}\n        aria-hidden=\"true\"\n        style={{ display: \"none\", height: ROW_H }}\n        className=\"pointer-events-none absolute inset-x-0 top-0 rounded-md border border-dashed border-border/70\"\n      />\n\n      {order.map((id, rowIdx) => {\n        const item = itemsById.get(id);\n        if (!item) return null;\n        const pos = order.indexOf(id) + 1;\n        const isArmed = armedId === id;\n        return (\n          <div\n            key={id}\n            ref={(el) => {\n              if (el) rowRefs.current.set(id, el);\n              else rowRefs.current.delete(id);\n            }}\n            role=\"listitem\"\n            className=\"absolute inset-x-0 top-0 will-change-transform\"\n            style={{ height: ROW_H, \"--bw-lift\": 0.35 } as React.CSSProperties}\n          >\n            <div\n              className={`flex h-full items-center gap-3 rounded-md border bg-surface px-3 transition-colors duration-150 ${\n                isArmed ? \"border-ns-accent\" : \"border-border hover:border-foreground/20\"\n              }`}\n              style={{\n                boxShadow: `0 calc(6px + 10px * var(--bw-lift)) calc(16px + 10px * var(--bw-lift)) calc(-8px - 2px * var(--bw-lift)) rgba(0,0,0,calc(0.22 + 0.18 * var(--bw-lift)))`,\n              }}\n            >\n              <button\n                type=\"button\"\n                data-bow-handle\n                data-bow-row={rowIdx}\n                aria-pressed={isArmed}\n                aria-label={`${isArmed ? \"Grabbed. \" : \"\"}Reorder ${item.label}. Position ${pos} of ${order.length}.`}\n                onPointerDown={(e) => beginDrag(id, e)}\n                onPointerMove={(e) => moveDrag(id, e)}\n                onPointerUp={(e) => endDrag(id, e, false)}\n                onPointerCancel={(e) => endDrag(id, e, true)}\n                onClick={() => armOrDrop(id)}\n                onKeyDown={(e) => onHandleKeyDown(id, e)}\n                className={`flex shrink-0 cursor-grab touch-none select-none items-center justify-center rounded-sm p-1.5 text-ns-muted transition-colors duration-150 hover:bg-foreground/10 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ns-accent active:cursor-grabbing ${\n                  isArmed ? \"bg-ns-accent/10 text-ns-accent\" : \"\"\n                }`}\n              >\n                <GripIcon />\n              </button>\n              <div className=\"min-w-0 flex-1\">\n                <p className=\"truncate text-sm text-foreground\">{item.label}</p>\n                {item.subtitle ? (\n                  <p className=\"truncate font-mono text-xs text-ns-muted\">{item.subtitle}</p>\n                ) : null}\n              </div>\n              <span className=\"shrink-0 rounded-full border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-ns-muted\">\n                {pos}\n              </span>\n            </div>\n          </div>\n        );\n      })}\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/ui/reorder-drag-wake.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-ns-muted": "var(--ns-muted)",
      "color-ns-accent": "var(--ns-accent)",
      "color-surface": "var(--surface)"
    },
    "light": {
      "ns-muted": "#4d4d4d",
      "ns-accent": "#006bff",
      "surface": "#fafafa"
    },
    "dark": {
      "ns-muted": "#8f8f8f",
      "surface": "#171717"
    }
  },
  "meta": {
    "collection": "core",
    "tags": [
      "drag-reorder",
      "list",
      "kanban",
      "spring",
      "physics",
      "keyboard",
      "reorder",
      "micro-interaction"
    ],
    "instruction": "A vertical drag-to-reorder list for task lists or a kanban lane's cards. RENDERING: absolutely-positioned DOM rows inside one relatively-positioned container (no canvas); every row's transform is written per-frame on a refs-only rAF loop, never React state on the hot path. MECHANISM: picking up a row's grip button and moving the pointer past a 4px threshold starts a live drag — the dragged row tracks the pointer 1:1 on Y (pinned to X=0, scale ramping to 1.01). Every OTHER row is pushed by a continuous field centered on the dragged row's live position: translateY reflows it into the slot the card would occupy if dropped right now (computed by splicing the dragged id into its base order at the pointer-derived insertion index, so the gap between two rows is always exactly the width of one settled row, reading as the drop target before the card arrives — no separate placeholder line); translateX shoulders it up to 10px sideways, sign set by which side of the drag point it sits on, magnitude a smoothstep falloff over 1.5 row-heights (~96px) of distance to the drag point, so a neighbor's push grows and fades continuously as the field sweeps past rather than snapping on or off. Both axes are damped springs (k=220, zeta=0.92) so entering and leaving the field is always continuous, even under fast pointer motion. The dragged card's own shadow deepens with instantaneous drag velocity (a fixed dark rgba ink, not a theme token, so it never inverts to a light halo in dark mode — the same reasoning toast-gravity-stack's shadow uses). DROP: the underlying order commits immediately; neighbors are already converging on their final slots so the wake collapses inward first via the same near-critical spring, while the dragged card itself holds for 90ms and then springs the rest of the way (k=170, zeta=0.58 — one clear overshoot) so it visibly settles last, after the water has closed behind it. Escape while dragging cancels: the card springs back to its pre-pickup slot and the order never commits. A11Y: every row exposes a grip button (`aria-label` names the item and its live position); a click or Space/Enter arms discrete keyboard-reorder mode instead of a live drag (`aria-pressed` on the handle, an `aria-live=\"polite\"` region announces 'Grabbed <item>. Now at position N of M.'); Arrow Up/Down step the armed row through the same slots with a 'now at position N of M' announcement; Space or clicking the handle again drops it and announces the final position; Escape restores the pre-pickup order and announces the restore. Escape is a global document listener (not scoped to focus) since the operation is 'in flight' regardless of where focus sits. REDUCED MOTION: the field is off entirely — rows reflow with an instant snap (no spring, no lateral shoulder) and a plain dashed placeholder box marks the slot the card would drop into while dragging, replacing the wake as the anticipatory cue. Distinct from avatar-stack-flock: nothing here trails a leader on a shared boids sim — every neighbor reacts independently and continuously to a falloff field around one dragged card, and the insertion point is legible before the card lands, not after a leader settles."
  },
  "type": "registry:ui"
}