@weasel-js/core 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +330 -0
  2. package/dist/{DrawCommand-DCmiNkBj.d.ts → DrawCommand-BbPrSTra.d.ts} +24 -0
  3. package/dist/{chunk-Z3KNFTTS.js → chunk-3JYFAQIB.js} +3 -3
  4. package/dist/chunk-3JYFAQIB.js.map +1 -0
  5. package/dist/{chunk-UB6A6L77.js → chunk-3KGMJMOS.js} +3 -3
  6. package/dist/{chunk-UB6A6L77.js.map → chunk-3KGMJMOS.js.map} +1 -1
  7. package/dist/{chunk-IO5Z75X4.js → chunk-HGF5X6MZ.js} +2 -2
  8. package/dist/chunk-HGF5X6MZ.js.map +1 -0
  9. package/dist/{chunk-775XXAHR.js → chunk-JOSUVS6C.js} +2 -2
  10. package/dist/{chunk-775XXAHR.js.map → chunk-JOSUVS6C.js.map} +1 -1
  11. package/dist/{chunk-FVNWK7U3.js → chunk-SMCZRSYB.js} +1677 -1371
  12. package/dist/chunk-SMCZRSYB.js.map +1 -0
  13. package/dist/{chunk-DCIU3SRK.js → chunk-TR3HZN34.js} +79 -151
  14. package/dist/chunk-TR3HZN34.js.map +1 -0
  15. package/dist/{chunk-6SHZHXXR.js → chunk-U45SODC2.js} +2 -2
  16. package/dist/{chunk-6SHZHXXR.js.map → chunk-U45SODC2.js.map} +1 -1
  17. package/dist/clipboard.d.ts +5 -2
  18. package/dist/clipboard.js +1 -2
  19. package/dist/clone.d.ts +2 -2
  20. package/dist/clone.js +0 -1
  21. package/dist/{geometry-DVeZ2i-c.d.ts → geometry-5X6TrAkX.d.ts} +1 -1
  22. package/dist/{grid-XcFQVS0f.d.ts → grid-sfilv5HP.d.ts} +7 -2
  23. package/dist/index.d.ts +695 -49
  24. package/dist/index.js +7 -8
  25. package/dist/insert.d.ts +6 -3
  26. package/dist/insert.js +1 -2
  27. package/dist/insert.js.map +1 -1
  28. package/dist/move.d.ts +26 -5
  29. package/dist/move.js +2 -3
  30. package/dist/move.js.map +1 -1
  31. package/dist/{options-wAvCnOZd.d.ts → options-CbsIgQci.d.ts} +3 -1
  32. package/dist/patterns-builtin.d.ts +8 -0
  33. package/dist/patterns-builtin.js +1 -2
  34. package/dist/{pointSnapToGrid-BuDZWBrL.d.ts → pointSnapToGrid-C3wowsQy.d.ts} +9 -3
  35. package/dist/{index-DPI8DV0A.d.ts → registry-CxnkXbG8.d.ts} +225 -350
  36. package/dist/renderer.d.ts +36 -4
  37. package/dist/renderer.js +7 -8
  38. package/dist/resize.d.ts +12 -5
  39. package/dist/resize.js +2 -3
  40. package/dist/routing.d.ts +106 -7
  41. package/dist/routing.js +1 -2
  42. package/dist/{types-BJ8_cyT7.d.ts → types-BHK2dkMu.d.ts} +43 -1
  43. package/dist/{types-BhJJ2OCM.d.ts → types-ByZxoD6P.d.ts} +1 -1
  44. package/dist/{types-B_-khFM0.d.ts → types-DpQ0cWYC.d.ts} +32 -0
  45. package/dist/{types-Kh_osAq9.d.ts → types-vqxpCFVp.d.ts} +31 -0
  46. package/dist/{viewToMat3-BvaWCN99.d.ts → viewToMat3-CQW_YqDw.d.ts} +1 -1
  47. package/package.json +6 -6
  48. package/dist/chunk-DCIU3SRK.js.map +0 -1
  49. package/dist/chunk-FVNWK7U3.js.map +0 -1
  50. package/dist/chunk-IO5Z75X4.js.map +0 -1
  51. package/dist/chunk-PZ5AY32C.js +0 -9
  52. package/dist/chunk-PZ5AY32C.js.map +0 -1
  53. package/dist/chunk-Z3KNFTTS.js.map +0 -1
@@ -1,19 +1,19 @@
1
- import { N as NodeId, R as RectPose, S as Scene } from './types-Kh_osAq9.js';
2
- import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-BhJJ2OCM.js';
1
+ import { N as NodeId, R as RectPose, S as Scene } from './types-vqxpCFVp.js';
2
+ import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-ByZxoD6P.js';
3
3
  import { V as View } from './view-DSQgxBJB.js';
4
4
  import { CapabilityTag } from '@weasel-js/modes';
5
5
  import * as React from 'react';
6
6
  import { MutableRefObject, ReactNode, ReactElement } from 'react';
7
- import { GestureSpec, IngestItem, InputEvent, ParsedModifiers, GestureName, ChannelRef, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, ModRequirement, ModifierKey, ParsedRoute, PhaseAtom, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RouteDescriptionPart, RouteFieldName, RouteTermLabel, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from '@weasel-js/gestures';
8
- import { B as Bounds, P as PoseProjection } from './geometry-DVeZ2i-c.js';
7
+ import { GestureSpec, IngestItem, InputEvent } from '@weasel-js/gestures';
8
+ import { B as Bounds, P as PoseProjection } from './geometry-5X6TrAkX.js';
9
9
  import { F as FillStyle, S as Stroke } from './paint-types-CnLIzqq1.js';
10
- import { D as DrawCommand } from './DrawCommand-DCmiNkBj.js';
10
+ import { D as DrawCommand } from './DrawCommand-BbPrSTra.js';
11
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
12
  import { P as Path } from './path-B6MMiodD.js';
13
13
  import { Op, History } from '@weasel-js/history';
14
- import { L as LayoutStrategy, I as InsertAdapter } from './types-B_-khFM0.js';
14
+ import { L as LayoutStrategy, I as InsertAdapter } from './types-DpQ0cWYC.js';
15
+ import { D as DebugSink } from './types-BHK2dkMu.js';
15
16
  import { Mat3 } from '@weasel-js/geom';
16
- import { D as DebugSink } from './types-BJ8_cyT7.js';
17
17
 
18
18
  /**
19
19
  * Read-only state that affordances consult on every render and hit-test
@@ -169,6 +169,13 @@ interface AffordanceRegion<TScratch = unknown> {
169
169
  * pump in `useGestureDispatcher` via `AffordanceHit.cursor`, which
170
170
  * `buildAffordanceAt` fills in from the region the walk landed on. */
171
171
  cursor?: string;
172
+ /** `'exclusive'` bars every binding whose target doesn't consult the
173
+ * affordance. Read only when the affordance is composed into a
174
+ * consumer-registered layer; kit chrome routes through
175
+ * `buildAffordanceAt`, which reports `'shared'`. */
176
+ strength?: 'exclusive' | 'shared';
177
+ /** Which gestures an exclusive claim bars. Omitted bars all of them. */
178
+ claimedKinds?: readonly ClaimableGesture[];
172
179
  /** Drag binding produced when this region is hit. Lazily called so
173
180
  * affordances don't pay binding-construction cost on every paint frame —
174
181
  * state snapshots (e.g., capturing per-leaf poses at click time) belong
@@ -448,6 +455,8 @@ interface RuleCtx {
448
455
  * an absent profile is behavior-preserving by construction. */
449
456
  readonly device?: DeviceProfile;
450
457
  }
458
+ /** The live state a `RuleCtx` is assembled from — the chrome context plus
459
+ * what the active mode allows. */
451
460
  interface BuildRuleCtxArgs {
452
461
  focused: boolean;
453
462
  selection: readonly NodeId[];
@@ -468,6 +477,8 @@ interface BuildRuleCtxArgs {
468
477
  /** Optional — omitted means {@link DEFAULT_DEVICE_PROFILE}. */
469
478
  device?: DeviceProfile;
470
479
  }
480
+ /** Gather the current canvas and mode state into the context that action
481
+ * eligibility and chrome-visibility rules are evaluated against. */
471
482
  declare function buildRuleCtx(args: BuildRuleCtxArgs): RuleCtx;
472
483
 
473
484
  /**
@@ -528,6 +539,7 @@ type Rule = Selector | {
528
539
  };
529
540
  /** Constant rules. Kept here so they have a single source. */
530
541
  declare const ALWAYS: Rule;
542
+ /** A rule that never passes. `any` of nothing is false. */
531
543
  declare const NEVER: Rule;
532
544
  /**
533
545
  * Render a {@link Rule} as a short human-readable string, for inspectors and
@@ -544,6 +556,8 @@ declare const NEVER: Rule;
544
556
  * on a cyclic value and renders the `when` arm as a useless `{}`.
545
557
  */
546
558
  declare function describeRule(rule: Rule): string;
559
+ /** Evaluate a rule against a context. Pure, and cheap enough to run per
560
+ * frame for every piece of chrome. */
547
561
  declare function evaluate(rule: Rule, ctx: RuleCtx): boolean;
548
562
 
549
563
  /**
@@ -862,7 +876,7 @@ type OngoingOverlay = {
862
876
  * renderer narrows on `shape` and casts the field shape it expects.
863
877
  */
864
878
  kind: 'insertPreview';
865
- shape: 'rect' | 'ellipse' | 'line' | 'polygon' | 'star' | 'pencil';
879
+ shape: 'rect' | 'ellipse' | 'line' | 'polygon' | 'star' | 'pencil' | 'image';
866
880
  bounds: {
867
881
  x: number;
868
882
  y: number;
@@ -926,6 +940,14 @@ interface OngoingHandle {
926
940
  */
927
941
  previewIds?(): Iterable<string> | null;
928
942
  previewPose?(id: string): unknown | null;
943
+ /**
944
+ * Subset of `previewIds()` the ghost layer paints at full opacity. The
945
+ * ghost alpha says "this is in flight under the pointer"; a node the
946
+ * gesture merely displaces — a layout sibling reflowing into its
947
+ * destination slot — is not, and reads better settled. Honored at
948
+ * subtree-root granularity.
949
+ */
950
+ previewOpaqueIds?(): Iterable<string> | null;
929
951
  /**
930
952
  * When `false`, the preview-ghost layer paints the ghost AND the
931
953
  * source node stays visible at its committed pose. Defaults to
@@ -993,6 +1015,9 @@ type Invoker = ImmediateInvoker | OngoingInvoker;
993
1015
  * See `docs/superpowers/specs/2026-05-16-registry-unification-design.md`.
994
1016
  */
995
1017
 
1018
+ /** An interaction: a gesture spec composed with the id of the action it
1019
+ * invokes. Tools declare arrays of these; the dispatcher matches an incoming
1020
+ * input event against them and runs the winner's action. */
996
1021
  interface GestureBinding {
997
1022
  spec: GestureSpec;
998
1023
  actionId: string;
@@ -1154,6 +1179,15 @@ type BooleanOpResult = {
1154
1179
  kind: 'noop';
1155
1180
  reason: 'no-paths' | 'too-few-for-subtract' | 'empty-result';
1156
1181
  };
1182
+ /**
1183
+ * Run one Boolean operation over the selected paths and commit the result as a
1184
+ * single undoable batch.
1185
+ *
1186
+ * Operands are ordered back-to-front, which is what makes `subtract` mean
1187
+ * "everything in front removed from the backmost shape". Returns without
1188
+ * mutating anything when the selection holds no paths, or too few for the
1189
+ * requested operation.
1190
+ */
1157
1191
  declare function applyBooleanOp(adapter: BooleansAdapter, op: BooleanOp): BooleanOpResult;
1158
1192
 
1159
1193
  /**
@@ -1276,6 +1310,9 @@ interface IngestCtx {
1276
1310
  /** Full action-deps bag, for consumer handlers that need more. */
1277
1311
  deps: ActionDeps;
1278
1312
  }
1313
+ /** A handler for content arriving by paste, drop or file picker. Handlers are
1314
+ * matched by MIME glob or predicate and run highest-priority first; the kit's
1315
+ * own register at a low priority so a consumer's handler wins by default. */
1279
1316
  interface ContentHandlerEntry {
1280
1317
  /** Stable identifier — used for unregistration and debugging
1281
1318
  * (`'kit:image'`, `'app:csv'`). */
@@ -1342,6 +1379,9 @@ declare function PointerContextProvider({ children }: {
1342
1379
  * no provider is in scope. */
1343
1380
  declare function usePointerContext(): PointerContextValue | null;
1344
1381
 
1382
+ /** Which tool is active, plus the stack of tools temporarily held active by a
1383
+ * hotkey (space-for-hand and the like). The dispatcher reads this to decide
1384
+ * whose bindings are in scope. */
1345
1385
  interface ActiveToolContextValue {
1346
1386
  active: string;
1347
1387
  hotkeyStack: string[];
@@ -1349,11 +1389,15 @@ interface ActiveToolContextValue {
1349
1389
  pushHotkey(id: string): void;
1350
1390
  popHotkey(): void;
1351
1391
  }
1392
+ /** Props for `<ActiveToolContextProvider>`. */
1352
1393
  interface ActiveToolContextProviderProps {
1353
1394
  children: ReactNode;
1354
1395
  initialActive?: string;
1355
1396
  }
1397
+ /** Provides active-tool state for a canvas. `<SceneCanvas>` mounts one. */
1356
1398
  declare function ActiveToolContextProvider({ children, initialActive, }: ActiveToolContextProviderProps): react_jsx_runtime.JSX.Element;
1399
+ /** The active-tool state in scope. Throws outside a provider; use
1400
+ * `useActiveToolContextOptional` where one is not guaranteed. */
1357
1401
  declare function useActiveToolContext(): ActiveToolContextValue;
1358
1402
  /**
1359
1403
  * Like `useActiveToolContext`, but returns `null` when no
@@ -1585,6 +1629,8 @@ type NodeAtPointDep = (point: {
1585
1629
  x: number;
1586
1630
  y: number;
1587
1631
  }, exclude?: Iterable<NodeId>) => NodeId | null;
1632
+ /** What an area-selecting action needs: a way to ask what a region covers,
1633
+ * and a way to read and replace the selection. */
1588
1634
  interface AreaSelectDep {
1589
1635
  /** Return ids of all scene nodes whose AABB overlaps `bounds`. */
1590
1636
  hitTestArea(bounds: {
@@ -1833,6 +1879,13 @@ type InsertExtras = {
1833
1879
  } | {
1834
1880
  kind: 'text';
1835
1881
  text?: string;
1882
+ } | {
1883
+ kind: 'image';
1884
+ src?: string;
1885
+ opacity?: number;
1886
+ /** Chrome-only: what the in-flight drag paints. Read by the overlay
1887
+ * layer, ignored by the insert dep. */
1888
+ preview?: 'bitmap' | 'outline';
1836
1889
  } | {
1837
1890
  kind: string;
1838
1891
  [extra: string]: unknown;
@@ -1916,6 +1969,14 @@ interface ResizePolicy<TPose> {
1916
1969
  interface LayoutDep {
1917
1970
  getLayout(containerId: string): LayoutStrategy<unknown> | null;
1918
1971
  }
1972
+ /**
1973
+ * The names an action may declare in `requires`, and what each resolves to.
1974
+ *
1975
+ * This is the whole vocabulary of things an action can reach — selection,
1976
+ * scene, view, history, and the rest. Consumers add their own entries by
1977
+ * augmenting the interface (`declare module '@weasel-js/core'`), which is what
1978
+ * makes a custom dep name type-check in `requires` and in the deps bag.
1979
+ */
1919
1980
  interface DepSchema {
1920
1981
  /** Kit selection state — ids of currently selected nodes. */
1921
1982
  selection: SelectionApi;
@@ -2102,13 +2163,19 @@ interface DepSchema {
2102
2163
  */
2103
2164
  type DepName = keyof DepSchema;
2104
2165
 
2166
+ /** Holds the live sources an action's declared dependencies resolve to.
2167
+ * Sources are thunks, read at invocation time, so an action never captures
2168
+ * stale state. */
2105
2169
  interface DepRegistry {
2106
2170
  register<K extends DepName>(name: K, source: () => DepSchema[K]): () => void;
2107
2171
  get<K extends DepName>(name: K): DepSchema[K] | undefined;
2108
2172
  }
2173
+ /** Provides the dep registry for a canvas. `<SceneCanvas>` mounts one; a
2174
+ * consumer registering its own dep sources must be inside it. */
2109
2175
  declare function DepRegistryProvider({ children }: {
2110
2176
  children: ReactNode;
2111
2177
  }): react_jsx_runtime.JSX.Element;
2178
+ /** The dep registry in scope. Throws outside a `<DepRegistryProvider>`. */
2112
2179
  declare function useDepRegistry(): DepRegistry;
2113
2180
  /**
2114
2181
  * Like `useDepRegistry`, but returns `null` when no `<DepRegistryProvider>` is
@@ -2137,6 +2204,14 @@ interface Eligibility {
2137
2204
  /** Modality filter, applied wherever it would otherwise be live. */
2138
2205
  capabilities?: CapabilityTag[];
2139
2206
  }
2207
+ /**
2208
+ * Where an entry's overlay sits in the layer stack, relative to the
2209
+ * selection chrome. `'top'` is the default and renders above everything;
2210
+ * the other two exist for chrome that belongs under the selection handles
2211
+ * (a snap-target highlight, say). With no selection overlay in the stack,
2212
+ * all three collapse to `'top'`.
2213
+ */
2214
+ type OverlayPosition = 'top' | 'before-selection' | 'after-selection';
2140
2215
  /**
2141
2216
  * A registry entry: what it contributes, and when it is eligible. Every role
2142
2217
  * is optional and independent — an entry that only routes input declares only
@@ -2147,12 +2222,121 @@ interface Contribution {
2147
2222
  eligibility: Eligibility;
2148
2223
  bindings?: GestureBinding[];
2149
2224
  actions?: Action[];
2150
- overlay?: RenderLayer<unknown>;
2225
+ /** One layer, or several composed in the given order. */
2226
+ overlay?: RenderLayer<unknown> | RenderLayer<unknown>[];
2227
+ /** Defaults to `'top'`. Applies to every layer in `overlay`. */
2228
+ overlayPosition?: OverlayPosition;
2151
2229
  presentation?: ToolPresentation;
2152
2230
  /** Reflection escape hatch — the authored form, when there was one. */
2153
2231
  def?: unknown;
2154
2232
  }
2155
2233
 
2234
+ /**
2235
+ * Configurable activation-key descriptor for tools that expose their
2236
+ * keybinding to the host (currently Lasso and Eyedropper). Captures
2237
+ * only the fields meaningful to a caller-supplied tool-select key —
2238
+ * dispatcher-internal fields (`skipInEditable`, `enabled`,
2239
+ * `preventDefault`) live on `KeyBinding` in keyHelpers.ts and are
2240
+ * not part of the configurable surface.
2241
+ */
2242
+ interface ToolKeybinding {
2243
+ /** Key or list of keys to match (case-insensitive against `event.key`). */
2244
+ key: string | readonly string[];
2245
+ /** Require Cmd (mac) / Ctrl (others). Default `false`. */
2246
+ mod?: boolean;
2247
+ /** Require Alt. Default `false`. */
2248
+ alt?: boolean;
2249
+ /**
2250
+ * Shift policy. `undefined`/`false` forbids shift, `true` requires
2251
+ * shift, `'optional'` allows either.
2252
+ */
2253
+ shift?: boolean | 'optional';
2254
+ }
2255
+ /**
2256
+ * What a tool declares.
2257
+ *
2258
+ * A tool is a declarative shell, not an event handler: it names the gestures
2259
+ * it responds to and, for each, the action to invoke. The dispatcher owns the
2260
+ * gesture, and the action owns the preview and the commit — so a tool
2261
+ * definition is mostly `bindings`, plus presentation and any actions the tool
2262
+ * itself introduces.
2263
+ */
2264
+ interface ToolDef<TScratch = void> {
2265
+ id: string;
2266
+ /** Capability tags for modality eligibility. Forwarded onto `Tool.capabilities`. */
2267
+ capabilities?: CapabilityTag[];
2268
+ /**
2269
+ * Actions this tool owns and needs registered while it is in the tools
2270
+ * registry — e.g. polygon's `polygon.adjustSides`, which its own bindings
2271
+ * reference by id.
2272
+ *
2273
+ * Declared here rather than registered by the hook with `useAction`,
2274
+ * because tool hooks run wherever the consumer calls them — for
2275
+ * `<SceneCanvas>` that is ABOVE `<ActionsProviderIfRoot>`, where
2276
+ * `useActionsRegistry()` returns null and `useAction` silently no-ops. The
2277
+ * result was a binding pointing at an action id nothing had registered, so
2278
+ * the gesture fell through to whatever matched next (polygon's
2279
+ * wheel/arrow-key side adjustment did nothing and `nudge.*` moved the
2280
+ * selection instead). `<ToolActionsMounter>` registers these from inside
2281
+ * the provider.
2282
+ */
2283
+ actions?: Action[];
2284
+ /** Hook name as exported from the kit barrel (e.g. `'useHandTool'`).
2285
+ * Set by built-in hooks for inspector / debugging. Consumer-authored
2286
+ * tools may set this to surface their hook name; omitted is fine.
2287
+ * Introspection-only — do not make this load-bearing in production.
2288
+ * Read off the def via `Tool.def` (the reflection escape hatch). */
2289
+ hookName?: string;
2290
+ presentation?: ToolPresentation<TScratch>;
2291
+ /** Optional caller-supplied activation key. Most built-in tools have their
2292
+ * activation key declared in `BUILTIN_SELECT_KEYS` in `useKeybindings.ts`;
2293
+ * this field is for tools that want their activation key to be
2294
+ * configurable by the host (currently Lasso and Eyedropper). The dynamic
2295
+ * loop in `useKeybindings.ts` picks this up and appends a binding entry
2296
+ * to the consolidated `tool.activate` action (with `opts.params.toolId`
2297
+ * set so the invoker knows which tool to switch to). */
2298
+ keybinding?: ToolKeybinding;
2299
+ /** Held-key trigger: this tool engages while the key is down and
2300
+ * disengages on release. Carried onto `Tool.eligibility.offhand`, which
2301
+ * assembly reads to register the consolidated `tool.offhand` action — the
2302
+ * declaration is the wiring, with nothing for the host to do. */
2303
+ hotkey?: HotkeyTrigger;
2304
+ onActivate?: (ctx: ToolCtx<TScratch>) => void;
2305
+ onDeactivate?: (ctx: ToolCtx<TScratch>) => void;
2306
+ cursor?: string | ((ctx: ToolCtx<TScratch>) => string);
2307
+ /** Override the default scratch initializer. Default is `() => null`
2308
+ * cast to `TScratch`, which works for tools whose scratch is fresh
2309
+ * every gesture. Tools that need scratch identity to survive across
2310
+ * gesture boundaries (e.g. the pen tool's multi-click subpath state)
2311
+ * pass a stable-ref-returning thunk here. The factory forwards this
2312
+ * onto the returned `Tool.initScratch`. */
2313
+ initScratch?: () => TScratch;
2314
+ /** Declarative gesture bindings, forwarded onto `Tool.bindings`. The
2315
+ * gesture dispatcher consults these at active scope while this tool is the
2316
+ * active one, and at hotkey scope while it is held. This is the tool's
2317
+ * entire input surface — the `initial` / `engaged` phase tables that used
2318
+ * to sit beside it are gone, along with the second dispatcher that read
2319
+ * them. */
2320
+ bindings?: GestureBinding[];
2321
+ /** Optional overlay layer rendered while the tool occupies any slot
2322
+ * (active, hotkey, or ambient), surfaced on `Tool.overlay`.
2323
+ *
2324
+ * The layer's `draw` closure should read dynamic state through refs or
2325
+ * closures captured in the enclosing render scope, and gate on it there —
2326
+ * `if (!scratch.something) return []` — rather than expecting the kit to
2327
+ * swap layers as the gesture progresses.
2328
+ *
2329
+ * Pass an array to contribute several layers; they render in order. */
2330
+ overlay?: RenderLayer<unknown> | RenderLayer<unknown>[];
2331
+ /** Where `overlay` sits relative to the selection chrome. Defaults to
2332
+ * `'top'`, above everything. */
2333
+ overlayPosition?: OverlayPosition;
2334
+ }
2335
+ /** Viewport-tool spec. Once phase tables went away this stopped differing
2336
+ * from `ToolDef` in any structural way; `defineViewportTool` survives as the
2337
+ * authoring signal that a tool pans/zooms the view rather than the scene. */
2338
+ type ViewportToolDef<TScratch = void> = ToolDef<TScratch>;
2339
+
2156
2340
  /** Modifier-key snapshot at event dispatch time. `space` is included
2157
2341
  * because tools commonly use space as a hotkey-slot trigger and may
2158
2342
  * also want to read it as a flag mid-gesture. */
@@ -2281,7 +2465,11 @@ type AnyTool = Tool<any>;
2281
2465
  * binding-scope / matchBest logic on top.
2282
2466
  */
2283
2467
 
2468
+ /** Where a binding came from, which is also its priority: a held hotkey beats
2469
+ * the active tool, which beats bindings that are always in scope. */
2284
2470
  type BindingScope = 'ambient' | 'active' | 'hotkey';
2471
+ /** A binding paired with where it came from, ready to be matched against an
2472
+ * event. */
2285
2473
  interface ScopedBinding {
2286
2474
  binding: GestureBinding;
2287
2475
  scope: BindingScope;
@@ -2290,6 +2478,7 @@ interface ScopedBinding {
2290
2478
  * Action with no owning tool. */
2291
2479
  ownerToolId: string | null;
2292
2480
  }
2481
+ /** The binding that won a match. */
2293
2482
  interface MatchResult {
2294
2483
  binding: GestureBinding;
2295
2484
  scope: BindingScope;
@@ -2303,7 +2492,7 @@ interface MatchResult {
2303
2492
  * [0] target — how much the spec's target narrows; see `targetRank`.
2304
2493
  * [1] mods — count of required modifier keys (shift/alt/ctrl/meta/mod).
2305
2494
  * `'optional'` does NOT count.
2306
- * [2] phase — 1 if the spec declares a `phase` field, else 0.
2495
+ * [2] phase — how much the spec's `phase` narrows; see `phaseRank`.
2307
2496
  * [3] exact — per-kind tiebreak: 2 for a drop/paste spec with a
2308
2497
  * non-empty `types` MIME filter, else 1.
2309
2498
  *
@@ -2349,6 +2538,11 @@ declare function specificity(spec: GestureSpec): readonly [number, number, numbe
2349
2538
  * the misconfiguration at dev time.
2350
2539
  */
2351
2540
 
2541
+ /** Everything the dispatcher must consult to route one input event: the
2542
+ * registered actions and their deps, which tool is active, which hotkeys are
2543
+ * held, and — optionally — the chrome state that action eligibility rules are
2544
+ * evaluated against. Rebuilt per event rather than held, so the dispatcher
2545
+ * itself stays stateless apart from in-flight gestures. */
2352
2546
  interface DispatcherContext {
2353
2547
  /** All registered actions; the dispatcher walks `.defaultBinding` for ambient bindings. */
2354
2548
  actions: ActionsRegistry;
@@ -2454,6 +2648,15 @@ interface ResolveAllOptions {
2454
2648
  */
2455
2649
  evaluateShadowed?: boolean;
2456
2650
  }
2651
+ /**
2652
+ * Routes input events to actions.
2653
+ *
2654
+ * For each event it assembles the bindings in scope (hotkey, then active tool,
2655
+ * then ambient), matches them in specificity order, filters by eligibility and
2656
+ * each action's `enabled` gate, and invokes the first survivor. Ongoing
2657
+ * actions — anything that runs across a drag — are kept in flight here and
2658
+ * pumped with subsequent moves until the gesture ends.
2659
+ */
2457
2660
  interface Dispatcher {
2458
2661
  /**
2459
2662
  * Route an input event through the binding pipeline. Returns `'handled'`
@@ -2590,6 +2793,8 @@ interface Dispatcher {
2590
2793
  */
2591
2794
  beginUiOngoing(actionId: string, deps: ActionDeps, params?: Record<string, unknown>): UiOngoingControl | null;
2592
2795
  }
2796
+ /** Build a dispatcher. `getAction` overrides how action ids are resolved;
2797
+ * by default the `DispatcherContext`'s registry is used. */
2593
2798
  declare function createDispatcher(opts?: {
2594
2799
  getAction?: (id: string) => Action | undefined;
2595
2800
  }): Dispatcher;
@@ -2743,6 +2948,7 @@ declare const ActionDisabledReason: {
2743
2948
  /** Sentinel: the predicate threw. Surfaced by `evaluateEnabled`'s catch. */
2744
2949
  readonly PredicateThrew: "predicate-threw";
2745
2950
  };
2951
+ /** Why an action is unavailable right now. */
2746
2952
  type ActionDisabledReason = (typeof ActionDisabledReason)[keyof typeof ActionDisabledReason];
2747
2953
  /**
2748
2954
  * @experimental
@@ -2752,6 +2958,14 @@ interface ActionEnabledResult {
2752
2958
  enabled: boolean;
2753
2959
  reason?: ActionDisabledReason;
2754
2960
  }
2961
+ /**
2962
+ * @experimental
2963
+ * Safely evaluate an action's `enabled` predicate. Returns `{enabled: true}`
2964
+ * when no predicate is supplied. Catches throws and treats them as disabled
2965
+ * with reason `'(predicate threw)'`. In dev mode, warns once per action id
2966
+ * when a single call exceeds 4ms (single frame at 240fps — generous; real
2967
+ * predicates should be sub-millisecond).
2968
+ */
2755
2969
  declare function evaluateEnabled(action: Action, deps?: ActionDeps): ActionEnabledResult;
2756
2970
  /**
2757
2971
  * @experimental
@@ -2829,343 +3043,4 @@ declare function useActionsRegistry(): ActionsRegistry | null;
2829
3043
  */
2830
3044
  declare function useAction(action: Action): void;
2831
3045
 
2832
- /**
2833
- * Configurable activation-key descriptor for tools that expose their
2834
- * keybinding to the host (currently Lasso and Eyedropper). Captures
2835
- * only the fields meaningful to a caller-supplied tool-select key —
2836
- * dispatcher-internal fields (`skipInEditable`, `enabled`,
2837
- * `preventDefault`) live on `KeyBinding` in keyHelpers.ts and are
2838
- * not part of the configurable surface.
2839
- */
2840
- interface ToolKeybinding {
2841
- /** Key or list of keys to match (case-insensitive against `event.key`). */
2842
- key: string | readonly string[];
2843
- /** Require Cmd (mac) / Ctrl (others). Default `false`. */
2844
- mod?: boolean;
2845
- /** Require Alt. Default `false`. */
2846
- alt?: boolean;
2847
- /**
2848
- * Shift policy. `undefined`/`false` forbids shift, `true` requires
2849
- * shift, `'optional'` allows either.
2850
- */
2851
- shift?: boolean | 'optional';
2852
- }
2853
- interface ToolDef<TScratch = void> {
2854
- id: string;
2855
- /** Capability tags for modality eligibility. Forwarded onto `Tool.capabilities`. */
2856
- capabilities?: CapabilityTag[];
2857
- /**
2858
- * Actions this tool owns and needs registered while it is in the tools
2859
- * registry — e.g. polygon's `polygon.adjustSides`, which its own bindings
2860
- * reference by id.
2861
- *
2862
- * Declared here rather than registered by the hook with `useAction`,
2863
- * because tool hooks run wherever the consumer calls them — for
2864
- * `<SceneCanvas>` that is ABOVE `<ActionsProviderIfRoot>`, where
2865
- * `useActionsRegistry()` returns null and `useAction` silently no-ops. The
2866
- * result was a binding pointing at an action id nothing had registered, so
2867
- * the gesture fell through to whatever matched next (polygon's
2868
- * wheel/arrow-key side adjustment did nothing and `nudge.*` moved the
2869
- * selection instead). `<ToolActionsMounter>` registers these from inside
2870
- * the provider.
2871
- */
2872
- actions?: Action[];
2873
- /** Hook name as exported from the kit barrel (e.g. `'useHandTool'`).
2874
- * Set by built-in hooks for inspector / debugging. Consumer-authored
2875
- * tools may set this to surface their hook name; omitted is fine.
2876
- * Introspection-only — do not make this load-bearing in production.
2877
- * Read off the def via `Tool.def` (the reflection escape hatch). */
2878
- hookName?: string;
2879
- presentation?: ToolPresentation<TScratch>;
2880
- /** Optional caller-supplied activation key. Most built-in tools have their
2881
- * activation key declared in `BUILTIN_SELECT_KEYS` in `useKeybindings.ts`;
2882
- * this field is for tools that want their activation key to be
2883
- * configurable by the host (currently Lasso and Eyedropper). The dynamic
2884
- * loop in `useKeybindings.ts` picks this up and appends a binding entry
2885
- * to the consolidated `tool.activate` action (with `opts.params.toolId`
2886
- * set so the invoker knows which tool to switch to). */
2887
- keybinding?: ToolKeybinding;
2888
- /** Held-key trigger: this tool engages while the key is down and
2889
- * disengages on release. Carried onto `Tool.eligibility.offhand`, which
2890
- * assembly reads to register the consolidated `tool.offhand` action — the
2891
- * declaration is the wiring, with nothing for the host to do. */
2892
- hotkey?: HotkeyTrigger;
2893
- onActivate?: (ctx: ToolCtx<TScratch>) => void;
2894
- onDeactivate?: (ctx: ToolCtx<TScratch>) => void;
2895
- cursor?: string | ((ctx: ToolCtx<TScratch>) => string);
2896
- /** Override the default scratch initializer. Default is `() => null`
2897
- * cast to `TScratch`, which works for tools whose scratch is fresh
2898
- * every gesture. Tools that need scratch identity to survive across
2899
- * gesture boundaries (e.g. the pen tool's multi-click subpath state)
2900
- * pass a stable-ref-returning thunk here. The factory forwards this
2901
- * onto the returned `Tool.initScratch`. */
2902
- initScratch?: () => TScratch;
2903
- /** Declarative gesture bindings, forwarded onto `Tool.bindings`. The
2904
- * gesture dispatcher consults these at active scope while this tool is the
2905
- * active one, and at hotkey scope while it is held. This is the tool's
2906
- * entire input surface — the `initial` / `engaged` phase tables that used
2907
- * to sit beside it are gone, along with the second dispatcher that read
2908
- * them. */
2909
- bindings?: GestureBinding[];
2910
- /** Optional overlay layer rendered while the tool occupies any slot
2911
- * (active, hotkey, or ambient), surfaced on `Tool.overlay`.
2912
- *
2913
- * The layer's `draw` closure should read dynamic state through refs or
2914
- * closures captured in the enclosing render scope, and gate on it there —
2915
- * `if (!scratch.something) return []` — rather than expecting the kit to
2916
- * swap layers as the gesture progresses. */
2917
- overlay?: RenderLayer<unknown>;
2918
- }
2919
- /** Viewport-tool spec. Once phase tables went away this stopped differing
2920
- * from `ToolDef` in any structural way; `defineViewportTool` survives as the
2921
- * authoring signal that a tool pans/zooms the view rather than the scene. */
2922
- type ViewportToolDef<TScratch = void> = ToolDef<TScratch>;
2923
-
2924
- /**
2925
- * Build a `Tool<TScratch>` from a declarative `ToolDef<TScratch>`.
2926
- *
2927
- * This used to be a translator: `ToolDef` carried `initial` / `engaged` phase
2928
- * tables of hit-keyed route handlers, and `defineTool` compiled them into the
2929
- * imperative `pointer` / `drag` / `keyboard` / `wheel` handlers the
2930
- * tool-routing dispatcher called. Both ends of that are gone — tools declare
2931
- * `bindings` and the gesture dispatcher routes them — so what remains is
2932
- * identity plumbing plus the id check and the cursor resolver.
2933
- *
2934
- * It stays a function rather than becoming a spread because the id validation
2935
- * and the `initScratch` / `cursor` defaults are worth applying uniformly, and
2936
- * because `Tool.def` gives reflection a handle on the authored form.
2937
- */
2938
- declare function defineTool<TScratch = void>(def: ToolDef<TScratch>): Tool<TScratch>;
2939
-
2940
- /**
2941
- * Define a tool that acts on the viewport rather than the scene.
2942
- *
2943
- * This used to do real work: `ViewportPhaseDef` was a narrowed `PhaseDef`
2944
- * (no click routes, drag restricted to the function form), and the factory
2945
- * lifted it back to the permissive shape before handing it to `defineTool`.
2946
- * With phase tables gone there is no shape left to narrow — a viewport tool
2947
- * declares `bindings` like any other, pointing at `viewport.*` actions.
2948
- *
2949
- * It survives as an authoring signal. `defineViewportTool` at the top of a
2950
- * hook says "this tool moves the camera, not the drawing", which is worth
2951
- * more than the type gymnastics it replaced.
2952
- */
2953
- declare function defineViewportTool<TScratch = void>(def: ViewportToolDef<TScratch>): Tool<TScratch>;
2954
-
2955
- /**
2956
- * One row in the route registry — a single `GestureBinding` on one tool,
2957
- * flattened into the route grammar's vocabulary so the inspector, the
2958
- * conflict checker, and `describeRoute` can all read the same shape.
2959
- *
2960
- * Multiple rows can share (gesture, arg, target, modifiers) if different tools
2961
- * declare them; consumers walk the list and group client-side.
2962
- */
2963
- interface RegistryEntry {
2964
- toolId: string;
2965
- /** Which phase the binding's `phase` spec restricts it to. `'any'` when it
2966
- * declares none, declares `'*'`, or declares an atom list whose atoms
2967
- * don't agree on one phase — such a binding fires in either phase, and
2968
- * reporting it as `'initial'` made it collide with genuinely-initial
2969
- * bindings in `findConflicts`' bucket key. */
2970
- phase: 'initial' | 'engaged' | 'any';
2971
- /** Structured v3 modifier requirements. Empty object = "no modifiers
2972
- * held" (the strict default). */
2973
- modifiers: ParsedModifiers;
2974
- gesture: GestureName;
2975
- /** Resolved arg value for arg-bearing gestures (wheel direction,
2976
- * key name, multiTouchTap fingers). Undefined for gestures whose
2977
- * descriptor has no `arg`. */
2978
- arg: string | undefined;
2979
- /** Target class for hit-testing gestures. `undefined` when the descriptor
2980
- * has `hasTarget: false` or the spec declares no target;
2981
- * {@link PREDICATE_TARGET} when the spec uses a `kindOf` predicate, which
2982
- * the route grammar has no notation for. */
2983
- target: string | undefined;
2984
- /** The action this binding fires. */
2985
- actionId: string;
2986
- /** The `GestureSpec` this row was flattened from, by reference. Reflection
2987
- * consumers that need something the grammar doesn't capture — the
2988
- * specificity tuple, a `kindOf` predicate identity — read it here rather
2989
- * than re-walking `Tool.bindings`. */
2990
- spec: GestureSpec;
2991
- }
2992
- /**
2993
- * Stand-in target for a `{ kindOf }` predicate spec.
2994
- *
2995
- * The route grammar can name target *classes* (`empty`, `selected-body`,
2996
- * `kind:rect`) but not arbitrary predicates, so three distinct select-tool
2997
- * bindings all render as this one token. Narrowing it would mean giving the
2998
- * grammar a way to describe a function, which is a real design question and
2999
- * not one this reflection layer should answer by inventing syntax.
3000
- */
3001
- declare const PREDICATE_TARGET = "predicate";
3002
- /**
3003
- * Flatten every tool's `bindings` into route-registry rows.
3004
- *
3005
- * This was `buildActionRegistry`, and it walked `ToolDef.initial` /
3006
- * `.engaged` phase tables — the grammar that no longer exists. It was also
3007
- * blind to `Tool.bindings` the entire time the two lived side by side, which
3008
- * is why the inspector under-reported select by more than half. The rename
3009
- * fixes a second thing: it never had anything to do with the Actions
3010
- * Registry, and reading `buildActionRegistry` next to `ActionsRegistry`
3011
- * suggested otherwise.
3012
- */
3013
- declare function buildRouteRegistry(tools: readonly Tool<unknown>[]): RegistryEntry[];
3014
-
3015
- /** Two or more tools declare the same exact (phase, gesture, arg, target,
3016
- * modifiers) tuple — the dispatcher's slot precedence picks one
3017
- * arbitrarily (well, deterministically by slot order, but the author
3018
- * probably didn't intend the duplication). */
3019
- interface Conflict {
3020
- phase: 'initial' | 'engaged' | 'any';
3021
- gesture: GestureName;
3022
- arg: string | undefined;
3023
- target: string | undefined;
3024
- modifiers: ParsedModifiers;
3025
- /** All tool ids that registered the same tuple. At least 2 by
3026
- * construction. Order matches the input tools[] order. */
3027
- toolIds: string[];
3028
- }
3029
- /** Detect exact-tuple overlaps across a tool registration set.
3030
- *
3031
- * Intentionally NOT flagged:
3032
- * - Broad vs. narrow targets (e.g. an untargeted `click` alongside
3033
- * `click` on `empty`) — the dispatcher's specificity ordering resolves
3034
- * those cleanly, and the broad one is usually the intended fallback.
3035
- * - Different modifier requirements on the same target — they fire on
3036
- * different inputs.
3037
- * - A binding whose action declines via `enabled()` so a lower-priority
3038
- * one can take the gesture. Detecting that intent would mean evaluating
3039
- * the action; consumers can suppress known-intentional compositions in
3040
- * their UI layer.
3041
- *
3042
- * - Two `{ kindOf }` predicate targets. The route grammar renders every
3043
- * predicate as the single token {@link PREDICATE_TARGET}, so bucketing on
3044
- * the rendered target alone reported select's `resize` / `rotate` / `move`
3045
- * drags — three genuinely different predicates — as a three-way conflict.
3046
- * Predicate entries bucket by function identity instead, which means two
3047
- * *separately written but equivalent* predicates go unflagged. That's the
3048
- * right way to be wrong here: this check has to be silent when nothing is
3049
- * wrong or nobody will keep it on.
3050
- *
3051
- * Note that two bindings sharing a tuple on the SAME tool are now possible
3052
- * (bindings are an array, where phase tables were objects with unique
3053
- * keys) — so a conflict may name one tool twice.
3054
- *
3055
- * This is the raw same-tuple detector. Feeding it a whole tool *registry*
3056
- * over-reports, because registry tools take turns in the active slot and
3057
- * can't collide with each other — see {@link findScopedConflicts}.
3058
- */
3059
- declare function findConflicts(tools: readonly Tool<unknown>[]): Conflict[];
3060
- /**
3061
- * The tool scopes as the dispatcher sees them — which is what decides whether
3062
- * two same-tuple bindings can actually collide.
3063
- */
3064
- interface ToolScopes {
3065
- /** Tools eligible for the active slot, keyed by id or as a flat list. */
3066
- registry: readonly Tool<unknown>[] | Readonly<Record<string, Tool<unknown>>>;
3067
- /** Always-on tools. Every one of these is live at once. */
3068
- ambient?: readonly Tool<unknown>[];
3069
- /** Registered actions. Their `defaultBinding`s assemble at ambient scope
3070
- * (hotkey scope when `Action.scope` says so), alongside the tools above. */
3071
- actions?: readonly Action[];
3072
- }
3073
- /**
3074
- * Detect the same-tuple overlaps that are *reachable* — the ones where the
3075
- * dispatcher really does fall back on declaration order.
3076
- *
3077
- * `matchSorted` walks scopes in strict priority (hotkey > active > ambient)
3078
- * and only sorts by specificity *within* a scope. So a cross-scope tie isn't
3079
- * a tie at all: an ambient tool losing a tuple to the active tool is the
3080
- * documented design, not an accident. Likewise two registry tools sharing a
3081
- * tuple — `rect` and `ellipse` both binding a bare `drag` — can never both be
3082
- * in the active slot, so they never compete.
3083
- *
3084
- * What's left, and what this reports:
3085
- * - a single tool colliding with **itself** (possible since bindings became
3086
- * an array), which is ambiguous in whichever slot it occupies;
3087
- * - two **ambient** tools, all of which are live simultaneously and are
3088
- * ordered only by registration;
3089
- * - two **hotkey-capable** tools, which can stack.
3090
- *
3091
- * Registered actions join the same two buckets: their `defaultBinding`s
3092
- * assemble at ambient scope (hotkey scope when `Action.scope` says so), so an
3093
- * ambient tool and an action claiming one tuple really do fall back on
3094
- * declaration order.
3095
- */
3096
- declare function findScopedConflicts(scopes: ToolScopes): Conflict[];
3097
- /**
3098
- * Render a conflict as one line of human-readable text.
3099
- *
3100
- * The tuple is printed through {@link formatRoute}, so the message names the
3101
- * collision in the same grammar the author wrote the binding in — modulo the
3102
- * phase slot, which prints as a bare `'&'`-channel atom because the bucket key
3103
- * collapses channel-bearing phase specs (`sel:engaged` and `&:engaged` collide
3104
- * with each other, and the collapse is what made them collide).
3105
- */
3106
- declare function formatConflict(conflict: Conflict): string;
3107
- /**
3108
- * Detect reachable route conflicts in an assembled tool set and report each one.
3109
- *
3110
- * This is the wiring `findConflicts` spent its first life without: the kit
3111
- * could detect the one class of genuine routing ambiguity it has and never
3112
- * looked. Call it once wherever a tool set is assembled (`useTools` does),
3113
- * behind a `process.env.NODE_ENV !== 'production'` guard.
3114
- *
3115
- * **Warn, never throw.** A conflict between a consumer's tool and a kit tool
3116
- * is a design question — sometimes deliberate, since the loser can still take
3117
- * the gesture by declining through `enabled()` — and exploding in a running
3118
- * app is the wrong way to raise it. A conflict between two *kit* tools is
3119
- * always a bug, but the place to fail on that is the kit's own test suite
3120
- * (`canvas/SceneCanvas.routeConflicts.test.tsx`), not a consumer's console.
3121
- *
3122
- * @returns The conflicts found, so callers can dedupe repeat reports.
3123
- */
3124
- declare function reportRouteConflicts(scopes: ToolScopes, warn?: (message: string) => void): Conflict[];
3125
-
3126
- declare const index_ChannelRef: typeof ChannelRef;
3127
- type index_Conflict = Conflict;
3128
- declare const index_DescribeRouteOptions: typeof DescribeRouteOptions;
3129
- declare const index_GESTURE_DESCRIPTORS: typeof GESTURE_DESCRIPTORS;
3130
- declare const index_GestureArgSpec: typeof GestureArgSpec;
3131
- declare const index_GestureDescriptor: typeof GestureDescriptor;
3132
- declare const index_GestureName: typeof GestureName;
3133
- declare const index_ModRequirement: typeof ModRequirement;
3134
- declare const index_ModifierKey: typeof ModifierKey;
3135
- declare const index_PREDICATE_TARGET: typeof PREDICATE_TARGET;
3136
- declare const index_ParsedModifiers: typeof ParsedModifiers;
3137
- declare const index_ParsedRoute: typeof ParsedRoute;
3138
- declare const index_PhaseAtom: typeof PhaseAtom;
3139
- declare const index_RESERVED_ID_NAMES: typeof RESERVED_ID_NAMES;
3140
- declare const index_RESERVED_ID_PREFIXES: typeof RESERVED_ID_PREFIXES;
3141
- declare const index_ROUTE_FIELD_DEFINITIONS: typeof ROUTE_FIELD_DEFINITIONS;
3142
- declare const index_ROUTE_TERMS: typeof ROUTE_TERMS;
3143
- type index_RegistryEntry = RegistryEntry;
3144
- declare const index_RouteDescriptionPart: typeof RouteDescriptionPart;
3145
- declare const index_RouteFieldName: typeof RouteFieldName;
3146
- declare const index_RouteTermLabel: typeof RouteTermLabel;
3147
- type index_ToolDef<TScratch = void> = ToolDef<TScratch>;
3148
- type index_ToolKeybinding = ToolKeybinding;
3149
- type index_ToolScopes = ToolScopes;
3150
- type index_ViewportToolDef<TScratch = void> = ViewportToolDef<TScratch>;
3151
- declare const index_buildRouteRegistry: typeof buildRouteRegistry;
3152
- declare const index_canonicalModifiers: typeof canonicalModifiers;
3153
- declare const index_collapseShiftPairs: typeof collapseShiftPairs;
3154
- declare const index_defineTool: typeof defineTool;
3155
- declare const index_defineViewportTool: typeof defineViewportTool;
3156
- declare const index_describeRoute: typeof describeRoute;
3157
- declare const index_describeRouteParts: typeof describeRouteParts;
3158
- declare const index_findConflicts: typeof findConflicts;
3159
- declare const index_findScopedConflicts: typeof findScopedConflicts;
3160
- declare const index_formatConflict: typeof formatConflict;
3161
- declare const index_formatPhaseAtom: typeof formatPhaseAtom;
3162
- declare const index_formatRoute: typeof formatRoute;
3163
- declare const index_getGestureDescriptor: typeof getGestureDescriptor;
3164
- declare const index_isKnownGestureName: typeof isKnownGestureName;
3165
- declare const index_parseRoute: typeof parseRoute;
3166
- declare const index_reportRouteConflicts: typeof reportRouteConflicts;
3167
- declare namespace index {
3168
- export { index_ChannelRef as ChannelRef, type index_Conflict as Conflict, index_DescribeRouteOptions as DescribeRouteOptions, index_GESTURE_DESCRIPTORS as GESTURE_DESCRIPTORS, index_GestureArgSpec as GestureArgSpec, index_GestureDescriptor as GestureDescriptor, index_GestureName as GestureName, index_ModRequirement as ModRequirement, index_ModifierKey as ModifierKey, index_PREDICATE_TARGET as PREDICATE_TARGET, index_ParsedModifiers as ParsedModifiers, index_ParsedRoute as ParsedRoute, index_PhaseAtom as PhaseAtom, index_RESERVED_ID_NAMES as RESERVED_ID_NAMES, index_RESERVED_ID_PREFIXES as RESERVED_ID_PREFIXES, index_ROUTE_FIELD_DEFINITIONS as ROUTE_FIELD_DEFINITIONS, index_ROUTE_TERMS as ROUTE_TERMS, type index_RegistryEntry as RegistryEntry, index_RouteDescriptionPart as RouteDescriptionPart, index_RouteFieldName as RouteFieldName, index_RouteTermLabel as RouteTermLabel, type index_ToolDef as ToolDef, type index_ToolKeybinding as ToolKeybinding, type index_ToolScopes as ToolScopes, type index_ViewportToolDef as ViewportToolDef, index_buildRouteRegistry as buildRouteRegistry, index_canonicalModifiers as canonicalModifiers, index_collapseShiftPairs as collapseShiftPairs, index_defineTool as defineTool, index_defineViewportTool as defineViewportTool, index_describeRoute as describeRoute, index_describeRouteParts as describeRouteParts, index_findConflicts as findConflicts, index_findScopedConflicts as findScopedConflicts, index_formatConflict as formatConflict, index_formatPhaseAtom as formatPhaseAtom, index_formatRoute as formatRoute, index_getGestureDescriptor as getGestureDescriptor, index_isKnownGestureName as isKnownGestureName, index_parseRoute as parseRoute, index_reportRouteConflicts as reportRouteConflicts };
3169
- }
3170
-
3171
- export { type BoundGesture as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, type Eligibility as E, type ActionDeps as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, ActionDisabledReason as J, type ActionEnabledResult as K, type LayerHit as L, type ActionEntry as M, ActionsProvider as N, ActiveToolContextProvider as O, ActiveToolContextProviderIfRoot as P, type ActiveToolContextProviderProps as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, type ActiveToolContextValue as W, type AreaSelectDep as X, type BindingOpts as Y, type BooleanOp as Z, type BooleanOpResult as _, type DeviceProfile as a, index as a$, type BuildRuleCtxArgs as a0, type ClaimableGesture as a1, type ClipboardDep as a2, type ClipboardIngestCtx as a3, type CustomPaintContext as a4, type DepName as a5, type DepRegistry as a6, DepRegistryProvider as a7, type DispatcherContext as a8, type DragSample as a9, type ResolvedCandidate as aA, type SelectionExtendKey as aB, type SelectionMode as aC, type Selector as aD, type SnapDep as aE, type SvgUnpacker as aF, type TextEditDep as aG, type ToolModifiers as aH, type ToolPresentation as aI, type ToolSlot as aJ, type UiOngoingControl as aK, type ViewApi as aL, applyBooleanOp as aM, buildRuleCtx as aN, clipboardCopyAction as aO, clipboardCutAction as aP, composeRectPose as aQ, composeWorldPose as aR, createDispatcher as aS, decomposeRectPose as aT, describeRule as aU, drawLayers as aV, enterTextEditAction as aW, evaluate as aX, evaluateEnabled as aY, rebaseLocalPose as aZ, registerContentHandler as a_, type EditAnchorsDep as aa, type GestureBinding as ab, IDENTITY_POSE_COMPOSITION as ac, type ImmediateInvoker as ad, type IngestCtx as ae, type IngestionDep as af, type InsertDep as ag, type InvocationCtx as ah, type Invoker as ai, type LassoSelectDep as aj, type LayoutDep as ak, type MatchResult as al, NEVER as am, type NodeAtPointDep as an, type OngoingHandle as ao, type OngoingInvoker as ap, type OngoingOverlay as aq, type Point2 as ar, PointerContextProvider as as, type PointerContextValue as at, type PointerWorldPos as au, type PoseAdapter as av, type PoseComposition as aw, type ResizePolicy as ax, type ResolveAllOptions as ay, type ResolveOnlyResult as az, type DetectedDeviceFacts as b, sliceAction as b0, specificity as b1, translateRectPose as b2, useAction as b3, useActionsRegistry as b4, useActiveToolContext as b5, useDepRegistry as b6, useDepSource as b7, useOptionalActiveToolContext as b8, useOptionalDepRegistry as b9, usePointerContext as ba, useSelection as bb, worldPoseLookup as bc, type Conflict as bd, PREDICATE_TARGET as be, type RegistryEntry as bf, type ToolDef as bg, type ToolScopes as bh, type ViewportToolDef as bi, buildRouteRegistry as bj, defineTool as bk, defineViewportTool as bl, findConflicts as bm, findScopedConflicts as bn, formatConflict as bo, reportRouteConflicts as bp, type Rule as c, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type DepSchema as g, type ActionsRegistry as h, type AffordanceHit as i, type Dispatcher as j, type AnyTool as k, type ToolCtx as l, type ToolKeybinding as m, type ChromeState as n, type SelectionApi as o, type ContentHandlerEntry as p, type SvgIngestOptions as q, type ActionsProp as r, type Affordance as s, type AffordanceBinding as t, type AffordanceRegion as u, type CommonAffordanceScratch as v, type BindingScope as w, type Contribution as x, type ScopedBinding as y, ALWAYS as z };
3046
+ export { type BindingOpts as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, type Eligibility as E, type ScopedBinding as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, ALWAYS as J, type ActionDeps as K, type LayerHit as L, ActionDisabledReason as M, type ActionEnabledResult as N, type OverlayPosition as O, type ActionEntry as P, ActionsProvider as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, ActiveToolContextProvider as W, ActiveToolContextProviderIfRoot as X, type ActiveToolContextProviderProps as Y, type ActiveToolContextValue as Z, type AreaSelectDep as _, type DeviceProfile as a, evaluateEnabled as a$, type BooleanOp as a0, type BooleanOpResult as a1, type BoundGesture as a2, type BuildRuleCtxArgs as a3, type ClaimableGesture as a4, type ClipboardDep as a5, type ClipboardIngestCtx as a6, type CustomPaintContext as a7, type DepName as a8, type DepRegistry as a9, type ResizePolicy as aA, type ResolveAllOptions as aB, type ResolveOnlyResult as aC, type ResolvedCandidate as aD, type SelectionExtendKey as aE, type SelectionMode as aF, type Selector as aG, type SnapDep as aH, type SvgUnpacker as aI, type TextEditDep as aJ, type ToolModifiers as aK, type ToolPresentation as aL, type ToolSlot as aM, type UiOngoingControl as aN, type ViewApi as aO, applyBooleanOp as aP, buildRuleCtx as aQ, clipboardCopyAction as aR, clipboardCutAction as aS, composeRectPose as aT, composeWorldPose as aU, createDispatcher as aV, decomposeRectPose as aW, describeRule as aX, drawLayers as aY, enterTextEditAction as aZ, evaluate as a_, DepRegistryProvider as aa, type DispatcherContext as ab, type DragSample as ac, type EditAnchorsDep as ad, type GestureBinding as ae, IDENTITY_POSE_COMPOSITION as af, type ImmediateInvoker as ag, type IngestCtx as ah, type IngestionDep as ai, type InsertDep as aj, type InvocationCtx as ak, type Invoker as al, type LassoSelectDep as am, type LayoutDep as an, type MatchResult as ao, NEVER as ap, type NodeAtPointDep as aq, type OngoingHandle as ar, type OngoingInvoker as as, type OngoingOverlay as at, type Point2 as au, PointerContextProvider as av, type PointerContextValue as aw, type PointerWorldPos as ax, type PoseAdapter as ay, type PoseComposition as az, type DetectedDeviceFacts as b, rebaseLocalPose as b0, registerContentHandler as b1, sliceAction as b2, specificity as b3, translateRectPose as b4, useAction as b5, useActionsRegistry as b6, useActiveToolContext as b7, useDepRegistry as b8, useDepSource as b9, useOptionalActiveToolContext as ba, useOptionalDepRegistry as bb, usePointerContext as bc, useSelection as bd, worldPoseLookup as be, type Rule as c, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type DepSchema as g, type ActionsRegistry as h, type AffordanceHit as i, type Dispatcher as j, type ToolDef as k, type ViewportToolDef as l, type AnyTool as m, type ToolCtx as n, type ToolKeybinding as o, type ChromeState as p, type SelectionApi as q, type ContentHandlerEntry as r, type SvgIngestOptions as s, type ActionsProp as t, type Affordance as u, type AffordanceRegion as v, type AffordanceBinding as w, type CommonAffordanceScratch as x, type BindingScope as y, type Contribution as z };