Build a Tool<TScratch> from a declarative ToolDef<TScratch>.
This used to be a translator: ToolDef carried initial / engaged phase
tables of hit-keyed route handlers, and defineTool compiled them into the
imperative pointer / drag / keyboard / wheel handlers the
tool-routing dispatcher called. Both ends of that are gone — tools declare
bindings and the gesture dispatcher routes them — so what remains is
identity plumbing plus the id check and the cursor resolver.
It stays a function rather than becoming a spread because the id validation
and the initScratch / cursor defaults are worth applying uniformly, and
because Tool.def gives reflection a handle on the authored form.
Build a
Tool<TScratch>from a declarativeToolDef<TScratch>.This used to be a translator:
ToolDefcarriedinitial/engagedphase tables of hit-keyed route handlers, anddefineToolcompiled them into the imperativepointer/drag/keyboard/wheelhandlers the tool-routing dispatcher called. Both ends of that are gone — tools declarebindingsand the gesture dispatcher routes them — so what remains is identity plumbing plus the id check and the cursor resolver.It stays a function rather than becoming a spread because the id validation and the
initScratch/cursordefaults are worth applying uniformly, and becauseTool.defgives reflection a handle on the authored form.