weasel API - v0.8.0
    Preparing search index...

    Function defineTool

    • 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.

      Type Parameters

      • TScratch = void

      Parameters

      Returns Tool<TScratch>