Skip to content

v2.0.1: The pointer-first release

Choose a tag to compare

@kindintelligence kindintelligence released this 08 Jul 09:38
· 27 commits to main since this release

The pointer-first release. In-app drag and drop now runs entirely on pointer
events and keyboard input with typed Rust payloads; native browser drag is
reserved for the app boundary, where DataTransfer is the only transport.
Styling is Tailwind-ready through presence-based data attributes, and the
project website is a new multi-page gallery that teaches every pattern.

Breaking: one input model

  • In-app components are pointer + keyboard only. Removed PointerDraggable,
    DragInputMode, DragMode::Native, Draggable::native, the input
    props on sortable/grid/board/multiselect components, and every in-app
    native ondrag* branch (DropZone, SortableList, SortableGrid,
    BoardSlot, TreeNodeTarget, CanvasDropZone). Draggable is now the
    one in-app drag source, and there is no mode to choose.
  • Native DataTransfer remains exactly where the app boundary requires it:
    FileDropZone, ExternalDropZone, ExternalDragSource,
    external::typed, and AutoScroll's dragover listener.
  • DropOutcome gained two fields: mode: DragMode (Pointer or
    Keyboard) and grab: Point (the pointer offset inside the element at
    pickup; element - grab is the landing top-left). Manual DropOutcome
    literals must add both.
  • ZoneId::auto and DragId::auto now start at 2^32 so auto-generated ids
    can never collide with explicit u32-range ids and silently replace a
    neighboring zone in the registry (previously dependent on mount order).

Styling: presence-based data attributes

  • Drag state is exposed as attributes that are present while active and
    absent otherwise, so Tailwind variants like data-dragging:opacity-50
    and CSS [data-over] selectors match only active elements: data-over +
    data-active on DropZone, FileDropZone and ExternalDropZone,
    data-dragging + data-disabled on Draggable, data-dragging +
    data-drop-target on sortable/grid items, data-active + data-over on
    BoardSlot, data-selected on SelectableDraggable, data-intent on
    TreeNodeTarget, data-active on CanvasDropZone, and
    data-sort-handle on touch grips.
  • Forwarded style props merge after functional inline styles instead of
    replacing them, so touch-action, overlay positioning and the grid's
    display: grid survive while your declarations win per property.
  • New item_class prop on SortableGrid for the library-rendered tile
    wrappers; DragOverlay forwards class and friends to the ghost.

Pointer path

  • New web feature: real pointer capture via web-sys, so a mouse drag
    stays glued to its source when the cursor leaves it. Off by default; the
    core stays dependency-free with a held-button recovery fallback, and a
    formal gesture state machine (transition, GesturePhase,
    GestureEvent, GestureEffect) drives every drag.
  • New SortableList::overlay prop: a fixed-position ghost sized from the
    measured source row while the in-flow row becomes the live gap.
  • Live preview translates rows by the measured slot pitch (margins and gaps
    included) so spacing never squashes mid-drag; hover hit-tests client
    coordinates against rects measured at drag start.
  • A release outside a list or grid commits no reorder, and a drop over a
    rejecting zone falls through to an accepting zone stacked beneath it.
    Missed drops re-measure zones and retry within 48px for touch.
  • AutoScroll follows default mouse pointer drags via held-button state,
    never scrolls on passive hover, stops when the pointer leaves the
    container, and takes an optional active gate.
  • Ctrl/Cmd at release resolves pointer drops to Copy and Alt to
    Link (effective_effect is public); keyboard drops report the selected
    zone's center in DropOutcome::element and honor
    CanvasKeyboardPlacement (Center, Origin, Fixed).
  • BoardSlot registers as a real zone (pointer, touch and keyboard can
    target it) and apply_move adjusts same-column forward insertions.
  • TreeNodeTarget, BoardSlot and CanvasDropZone mirror changing props
    through signals so their one-time registry callbacks always read current
    values.
  • FileFilter::content_types gained a real MIME matcher (exact types,
    type/*, */*, structured *+json suffixes, parameters and case
    ignored, malformed patterns rejected), and extensions normalizes dots,
    case and whitespace.

The gallery website

  • examples/gallery/ replaces the showcase, tailwind and canvas examples:
    a multi-page site with one page per pattern (fourteen in all), each
    pairing a live demo with a numbered walkthrough, an annotated snippet, a
    "New to Dioxus?" callout and a real API reference. Deployed to GitHub
    Pages by CI.
  • The design follows the KI-U paper system: paper and ink scales, one
    forest-green accent, earth tones used sparingly, Poppins for UI text and
    Geist Mono for code, no glow shadows. Code panels are inverse-ink with a
    homegrown Rust/rsx highlighter (no JavaScript highlighter).
  • The landing page hero is itself a demo: draggable paper scraps on a
    CanvasDropZone.
  • Removed examples/showcase.rs, examples/tailwind.rs and
    examples/canvas.rs. The Playwright suite now drives headless fixtures
    in examples/regressions.rs on a single dev server, covering overlay
    geometry and cleanup, outside-release cancellation for lists and grids,
    autoscroll edge behavior, canvas grab-offset placement, drop
    fall-through, the Ctrl-drag copy convention, reorder buttons inside
    sortable rows, and the native boundary paths.

2.0.1 docs patch

Docs-only patch. The README packaged into 2.0.0 still carried a stale
pre-release warning line and a malformed crates.io badge link, which
rendered on crates.io and the docs.rs front page. This release ships the
refreshed README: fixed badges, the 2.0 compatibility table, a prominent
link to the live gallery, highlighted code fences, and a precise claim
about JavaScript (the library ships none of its own; the optional web
feature uses web-sys bindings for pointer capture).

Links