Declarative Dragging
Declarative Dragging (D2) is a model-driven system that creates drag-and-drop interactions by speculatively rendering future application states.
summary is enough The core concept is elegant and well-explained in the summary, but the full paper is primarily valuable for those implementing complex SVG-based interactive diagrams.
summary
D2 inverts traditional drag-and-drop implementation by allowing developers to specify desired future model states rather than manual geometry and animation code. The system speculatively renders these potential states to determine where elements can be moved and synthesizes a smooth interaction. This approach is implemented in the Dragology library for SVG web interfaces, particularly useful for mathematical explorables and parallel representations.
key points
- D2 uses speculative rendering of multiple possible future states to derive drag-and-drop targets and visual feedback.
- The system is composable, using a combinator language to layer behaviors like snapping, floating, and transitions.
- It supports continuous degrees of freedom via a 'vary' operator for unconstrained positioning.
- The implementation focuses on SVG interfaces, reducing the need for bespoke, 'fiddly' geometry code.
who should read it
UI/UX engineers and researchers building complex, interactive data visualizations or educational tools.
discussion warm
consensus
Most commenters find the approach elegant and the demos satisfying, praising it as a way to actually implement rich interactions that are usually skipped due to complexity.
pushback
Some question the scalability of speculative rendering for large numbers of nodes and whether the DSL/composables introduce more complexity than they solve.
Oh, this is very, very cool, and very, very timely!
Paper here: https://declarative-dragging.github.io/D2.pdf
IMO one of the remaining gaps of agentic coding is that it's hard for even multimodal LLMs to check interactive motion effects for correctness and "feel." Like, sure, they can take screenshots of a few snapshotted states, but in terms of how things react as underlying nodes move and (potentially) reflow. How do you QA the feel of moving your wrist rapidly in the context of nested zones?
The answer is that you avoid the need to: you have a (nearly-provably) correct foundation that …
Connects the research to the current 'agentic coding' era, noting that declarative foundations make interactive motion easier to QA than imperative animations.
Generated by an LLM from the article and thread. Check the sources before relying on it.