@weasel-js/routing 1.5.1 → 1.5.2
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.
- package/dist/{chunk-ZZICE4J7.js → chunk-H5AGTB2J.js} +12 -12
- package/dist/chunk-H5AGTB2J.js.map +1 -0
- package/dist/{index-DhFGCPmN.d.ts → index-D4hKg8yu.d.ts} +12 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +18 -10
- package/dist/react.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-ZZICE4J7.js.map +0 -1
|
@@ -542,6 +542,10 @@ interface InvocationCtx {
|
|
|
542
542
|
* per-sample stylus state when the browser reported it.
|
|
543
543
|
* Accumulated by the dispatcher on every `pointermove` pump event.
|
|
544
544
|
* Available only during `onMove` and `onEnd` calls (not on `start`).
|
|
545
|
+
*
|
|
546
|
+
* During `onMove` this is the dispatcher's live accumulator, and it grows
|
|
547
|
+
* under you — read it, don't retain it. On `onEnd` it is a snapshot, so
|
|
548
|
+
* that is where an action that keeps the trail should take it.
|
|
545
549
|
* Used by `lassoSelectAction` to build its polygon vertex list and by
|
|
546
550
|
* `insertAction`'s pencil kind to carry the freehand stroke.
|
|
547
551
|
*/
|
|
@@ -553,7 +557,11 @@ interface InvocationCtx {
|
|
|
553
557
|
deltaZ: number;
|
|
554
558
|
};
|
|
555
559
|
multiTouch?: {
|
|
560
|
+
/** Canvas-local CSS pixels — see `MultitouchEvent.centroid`. Neither
|
|
561
|
+
* `world` nor `screen`: it is the space `zoomAt` anchors in, so passing
|
|
562
|
+
* it through `clientToWorld` removes the canvas origin twice. */
|
|
556
563
|
centroid: Point2;
|
|
564
|
+
/** Distance between the two primary pointers, in CSS pixels. */
|
|
557
565
|
spread: number;
|
|
558
566
|
rotation: number;
|
|
559
567
|
/**
|
|
@@ -565,6 +573,7 @@ interface InvocationCtx {
|
|
|
565
573
|
pinch?: {
|
|
566
574
|
startSpread: number;
|
|
567
575
|
currentSpread: number;
|
|
576
|
+
/** Canvas-local, same as the enclosing `centroid`. */
|
|
568
577
|
centroid: Point2;
|
|
569
578
|
};
|
|
570
579
|
};
|
|
@@ -1241,14 +1250,6 @@ interface ToolCtx<TScratch = unknown> {
|
|
|
1241
1250
|
* zoom/pan tools to convert event clientX/clientY to canvas-relative
|
|
1242
1251
|
* anchors. */
|
|
1243
1252
|
canvasRect: DOMRect;
|
|
1244
|
-
/** Screen-space pointer coords relative to `canvasRect`. Useful for
|
|
1245
|
-
* viewport tools that pan/zoom in screen space (e.g. hand-pan
|
|
1246
|
-
* computes deltas in pixels, not world units). Optional — populated
|
|
1247
|
-
* by the dispatcher on pointer events; absent on keyboard events. */
|
|
1248
|
-
screenPoint?: {
|
|
1249
|
-
x: number;
|
|
1250
|
-
y: number;
|
|
1251
|
-
};
|
|
1252
1253
|
/** Optional debug sink. When `<Canvas debug={...}>` is enabled, Canvas
|
|
1253
1254
|
* threads its sink here so tool-internal hit math (handle hitboxes,
|
|
1254
1255
|
* rotation handle, etc.) lands in the same overlay as Canvas's own
|
|
@@ -1992,7 +1993,9 @@ declare function mergeContributions(...bundles: readonly Contribution[][]): Cont
|
|
|
1992
1993
|
*/
|
|
1993
1994
|
interface ToolDef<TScratch = void, TOverlay = unknown> {
|
|
1994
1995
|
id: string;
|
|
1995
|
-
/** Capability tags for modality eligibility.
|
|
1996
|
+
/** Capability tags for modality eligibility. `defineTool` forwards these
|
|
1997
|
+
* onto `Tool.eligibility.capabilities`, which is where every gate reads
|
|
1998
|
+
* them — the assembled `Tool` carries no `capabilities` of its own. */
|
|
1996
1999
|
capabilities?: CapabilityTag[];
|
|
1997
2000
|
/**
|
|
1998
2001
|
* Actions this tool owns and needs registered while it is in the tools
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { i as ALWAYS, c as Action, j as ActionDeps, k as ActionDisabledReason, k as ActionDisabledReasonValue, l as ActionDispatch, m as ActionEnabledResult, n as ActionEntry, o as ActionPresentation, p as ActionSource, q as ActionsProp, A as ActionsRegistry, a as AffordanceHit, r as AnyTool, d as AnyToolOf, B as BindingOpts, s as BindingScope, t as BindingSource, v as BodyPredicate, w as BoundGesture, x as Bounds, y as BuildRuleCtxArgs, z as COARSE_TARGET_SCALE, E as Condition, F as Conflict, C as Contribution, G as ContributionChrome, H as ContributionRouting, I as DEFAULT_ALLOWED_CAPABILITIES, J as DEFAULT_DEVICE_PROFILE, K as DebugSink, L as DepName, b as DepSchema, M as DetectedDeviceFacts, N as DeviceProfile, P as DispatchLogEntry, D as Dispatcher, Q as DispatcherContext, U as DragSample, V as Eligibility, W as EligibilityState, X as GestureBinding, Y as HandleKind, Z as HitShape, _ as HotkeyTrigger, $ as INGEST_STRING_MIMES, a0 as ImmediateInvoker, a1 as InvocationCtx, a2 as Invoker, a3 as KeyBinding, a4 as MatchResult, a5 as ModeSwitchLogEntry, a6 as ModifierState, a7 as NEVER, a8 as NodeId, a9 as OngoingHandle, aa as OngoingInvoker, ab as OngoingOverlay, O as OverlayPosition, ac as OverlayRole, ad as PREDICATE_TARGET, ae as Point2, af as PointerSession, ag as PointerSessionCallbacks, ah as PointerSessionCancelReason, ai as PointerSessionOptions, aj as RegistryEntry, ak as ResizeAnchor, al as ResolveAllOptions, am as ResolveOnlyResult, an as ResolvedCandidate, ao as Rule, R as RuleCtx, S as ScopedBinding, ap as ScratchKey, aq as ScratchStore, ar as SelectionApi, as as SelectionExtendKey, at as SelectionMode, au as Selector, av as TOOL_OFFHAND_ID, T as Tool, aw as ToolBounds, ax as ToolCtx, ay as ToolDef, az as ToolKeybinding, aA as ToolModifiers, aB as ToolOffhandBindingSpec, aC as ToolPresentation, aD as ToolSlot, aE as TraceLogEntry, aF as UiOngoingControl, aG as View, aH as ViewportToolDef, aI as actionBindings, aJ as buildDepsFromRequires, aK as buildRouteRegistry, aL as buildRuleCtx, aM as buildToolOffhandBindings, aN as clientToCanvas, aO as clientToCanvasRect, aP as createDispatcher, aQ as defineTool, aR as defineViewportTool, aS as deleteScratch, aT as describeRule, aU as dlog, aV as evaluate, aW as evaluateEnabled, aX as filterEligible, aY as findConflicts, aZ as getScratch, a_ as isAnchor, a$ as isAnchorOrControl, b0 as isBody, b1 as isControlHandle, b2 as isEditableTarget, b3 as isEmpty, b4 as isResizeHandle, b5 as isRotateHandle, b6 as isSelectedBody, b7 as isUnselectedBody, b8 as itemsFromClipboardData, b9 as itemsFromDataTransfer, ba as itemsFromFiles, bb as liveScope, bc as makeToolOffhandAction, bd as matchBest, be as matchSorted, bf as matchesKeyBinding, bg as mergeContributions, bh as offhandKeyFor, bi as openPointerSession, bj as pointerGestureId, bk as recordModeSwitch, bl as reportRouteConflicts, bm as resolveDeviceProfile, bn as resolveParams, bo as routeGestureForSpecKind, bp as routesForSpec, bq as scopeBindings, br as scratchKey, bs as setScratch, bt as specificity, bu as targetConsultsAffordance, bv as validateActionDefaultBinding, bw as validateActionId } from './index-
|
|
1
|
+
export { i as ALWAYS, c as Action, j as ActionDeps, k as ActionDisabledReason, k as ActionDisabledReasonValue, l as ActionDispatch, m as ActionEnabledResult, n as ActionEntry, o as ActionPresentation, p as ActionSource, q as ActionsProp, A as ActionsRegistry, a as AffordanceHit, r as AnyTool, d as AnyToolOf, B as BindingOpts, s as BindingScope, t as BindingSource, v as BodyPredicate, w as BoundGesture, x as Bounds, y as BuildRuleCtxArgs, z as COARSE_TARGET_SCALE, E as Condition, F as Conflict, C as Contribution, G as ContributionChrome, H as ContributionRouting, I as DEFAULT_ALLOWED_CAPABILITIES, J as DEFAULT_DEVICE_PROFILE, K as DebugSink, L as DepName, b as DepSchema, M as DetectedDeviceFacts, N as DeviceProfile, P as DispatchLogEntry, D as Dispatcher, Q as DispatcherContext, U as DragSample, V as Eligibility, W as EligibilityState, X as GestureBinding, Y as HandleKind, Z as HitShape, _ as HotkeyTrigger, $ as INGEST_STRING_MIMES, a0 as ImmediateInvoker, a1 as InvocationCtx, a2 as Invoker, a3 as KeyBinding, a4 as MatchResult, a5 as ModeSwitchLogEntry, a6 as ModifierState, a7 as NEVER, a8 as NodeId, a9 as OngoingHandle, aa as OngoingInvoker, ab as OngoingOverlay, O as OverlayPosition, ac as OverlayRole, ad as PREDICATE_TARGET, ae as Point2, af as PointerSession, ag as PointerSessionCallbacks, ah as PointerSessionCancelReason, ai as PointerSessionOptions, aj as RegistryEntry, ak as ResizeAnchor, al as ResolveAllOptions, am as ResolveOnlyResult, an as ResolvedCandidate, ao as Rule, R as RuleCtx, S as ScopedBinding, ap as ScratchKey, aq as ScratchStore, ar as SelectionApi, as as SelectionExtendKey, at as SelectionMode, au as Selector, av as TOOL_OFFHAND_ID, T as Tool, aw as ToolBounds, ax as ToolCtx, ay as ToolDef, az as ToolKeybinding, aA as ToolModifiers, aB as ToolOffhandBindingSpec, aC as ToolPresentation, aD as ToolSlot, aE as TraceLogEntry, aF as UiOngoingControl, aG as View, aH as ViewportToolDef, aI as actionBindings, aJ as buildDepsFromRequires, aK as buildRouteRegistry, aL as buildRuleCtx, aM as buildToolOffhandBindings, aN as clientToCanvas, aO as clientToCanvasRect, aP as createDispatcher, aQ as defineTool, aR as defineViewportTool, aS as deleteScratch, aT as describeRule, aU as dlog, aV as evaluate, aW as evaluateEnabled, aX as filterEligible, aY as findConflicts, aZ as getScratch, a_ as isAnchor, a$ as isAnchorOrControl, b0 as isBody, b1 as isControlHandle, b2 as isEditableTarget, b3 as isEmpty, b4 as isResizeHandle, b5 as isRotateHandle, b6 as isSelectedBody, b7 as isUnselectedBody, b8 as itemsFromClipboardData, b9 as itemsFromDataTransfer, ba as itemsFromFiles, bb as liveScope, bc as makeToolOffhandAction, bd as matchBest, be as matchSorted, bf as matchesKeyBinding, bg as mergeContributions, bh as offhandKeyFor, bi as openPointerSession, bj as pointerGestureId, bk as recordModeSwitch, bl as reportRouteConflicts, bm as resolveDeviceProfile, bn as resolveParams, bo as routeGestureForSpecKind, bp as routesForSpec, bq as scopeBindings, br as scratchKey, bs as setScratch, bt as specificity, bu as targetConsultsAffordance, bv as validateActionDefaultBinding, bw as validateActionId } from './index-D4hKg8yu.js';
|
|
2
2
|
export { ChannelRef, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, GestureName, IngestItem, InputEvent, ModRequirement, ModifierKey, ParsedModifiers, ParsedRoute, PhaseAtom, PhaseContext, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RouteDescriptionPart, RouteFieldName, RouteTermLabel, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, matchKey, matchModifiers, matchPhase, matchSpec, matchTarget, parseRoute } from '@weasel-js/gestures';
|
|
3
3
|
import '@weasel-js/modes';
|
|
4
4
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isDev } from './chunk-
|
|
2
|
-
export { ALWAYS, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, GESTURE_DESCRIPTORS, INGEST_STRING_MIMES, NEVER, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, TOOL_OFFHAND_ID, actionBindings, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, canonicalModifiers, clientToCanvas, clientToCanvasRect, collapseShiftPairs, createDispatcher, describeRoute, describeRouteParts, describeRule, dlog, evaluate, filterEligible, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isEditableTarget, isKnownGestureName, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, liveScope, makeToolOffhandAction, matchBest, matchKey, matchModifiers, matchPhase, matchSorted, matchSpec, matchTarget, matchesKeyBinding, offhandKeyFor, openPointerSession, parseRoute, pointerGestureId, recordModeSwitch, reportRouteConflicts, resolveDeviceProfile, resolveParams, routeGestureForSpecKind, routesForSpec, scopeBindings, specificity, targetConsultsAffordance, validateActionDefaultBinding, validateActionId } from './chunk-
|
|
1
|
+
import { isDev } from './chunk-H5AGTB2J.js';
|
|
2
|
+
export { ALWAYS, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, GESTURE_DESCRIPTORS, INGEST_STRING_MIMES, NEVER, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, TOOL_OFFHAND_ID, actionBindings, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, canonicalModifiers, clientToCanvas, clientToCanvasRect, collapseShiftPairs, createDispatcher, describeRoute, describeRouteParts, describeRule, dlog, evaluate, filterEligible, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isEditableTarget, isKnownGestureName, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, liveScope, makeToolOffhandAction, matchBest, matchKey, matchModifiers, matchPhase, matchSorted, matchSpec, matchTarget, matchesKeyBinding, offhandKeyFor, openPointerSession, parseRoute, pointerGestureId, recordModeSwitch, reportRouteConflicts, resolveDeviceProfile, resolveParams, routeGestureForSpecKind, routesForSpec, scopeBindings, specificity, targetConsultsAffordance, validateActionDefaultBinding, validateActionId } from './chunk-H5AGTB2J.js';
|
|
3
3
|
import { RESERVED_ID_PREFIXES, RESERVED_ID_NAMES } from '@weasel-js/gestures';
|
|
4
4
|
|
|
5
5
|
// src/interactions/actions/action.ts
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as Dispatcher, A as ActionsRegistry, T as Tool, a as AffordanceHit, R as RuleCtx, b as DepSchema, c as Action, d as AnyToolOf, O as OverlayPosition, C as Contribution, S as ScopedBinding } from './index-
|
|
2
|
-
export { e as DepRegistry, f as DepRegistryProvider, u as useDepRegistry, g as useDepSource, h as useOptionalDepRegistry } from './index-
|
|
1
|
+
import { D as Dispatcher, A as ActionsRegistry, T as Tool, a as AffordanceHit, R as RuleCtx, b as DepSchema, c as Action, d as AnyToolOf, O as OverlayPosition, C as Contribution, S as ScopedBinding } from './index-D4hKg8yu.js';
|
|
2
|
+
export { e as DepRegistry, f as DepRegistryProvider, u as useDepRegistry, g as useDepSource, h as useOptionalDepRegistry } from './index-D4hKg8yu.js';
|
|
3
3
|
import { RefObject, ReactNode, ReactElement } from 'react';
|
|
4
4
|
import { BodyClassification } from '@weasel-js/gestures';
|
|
5
5
|
import { PaintedCursorState } from '@weasel-js/cursor';
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDispatcher, buildDepsFromRequires, validateActionId, validateActionDefaultBinding, scopeBindings, liveScope, offhandKeyFor, makeToolOffhandAction, buildToolOffhandBindings, isDev, reportRouteConflicts, dlog, isEditableTarget, clientToCanvasRect, openPointerSession, pointerGestureId, itemsFromDataTransfer, itemsFromClipboardData } from './chunk-
|
|
1
|
+
import { createDispatcher, buildDepsFromRequires, validateActionId, validateActionDefaultBinding, scopeBindings, liveScope, offhandKeyFor, makeToolOffhandAction, buildToolOffhandBindings, isDev, reportRouteConflicts, dlog, isEditableTarget, clientToCanvasRect, openPointerSession, pointerGestureId, itemsFromDataTransfer, itemsFromClipboardData } from './chunk-H5AGTB2J.js';
|
|
2
2
|
import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
3
3
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { resolveCursorTier } from '@weasel-js/cursor';
|
|
@@ -301,8 +301,10 @@ function useGestureDispatcher(opts) {
|
|
|
301
301
|
if (result === "unhandled") {
|
|
302
302
|
dispatch({
|
|
303
303
|
kind: "contextmenu",
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
x: down.worldX,
|
|
305
|
+
y: down.worldY,
|
|
306
|
+
clientX: down.clientX,
|
|
307
|
+
clientY: down.clientY,
|
|
306
308
|
...shared
|
|
307
309
|
});
|
|
308
310
|
}
|
|
@@ -607,7 +609,7 @@ function useGestureDispatcher(opts) {
|
|
|
607
609
|
ctx
|
|
608
610
|
)?.action.cursor;
|
|
609
611
|
const cursor = dragCursor ?? dispatcherNow().resolveOnly(
|
|
610
|
-
{ kind: "click",
|
|
612
|
+
{ kind: "click", x: w.x, y: w.y, pressX: w.x, pressY: w.y, ...where },
|
|
611
613
|
ctx
|
|
612
614
|
)?.action.cursor;
|
|
613
615
|
applyHoverCursor(cursor ?? null);
|
|
@@ -696,8 +698,10 @@ function useGestureDispatcher(opts) {
|
|
|
696
698
|
ctrlKey: e.ctrlKey,
|
|
697
699
|
metaKey: e.metaKey,
|
|
698
700
|
shiftKey: e.shiftKey,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
+
x: wClick.x,
|
|
702
|
+
y: wClick.y,
|
|
703
|
+
clientX: e.clientX,
|
|
704
|
+
clientY: e.clientY,
|
|
701
705
|
pressX: down.worldX,
|
|
702
706
|
pressY: down.worldY,
|
|
703
707
|
...down.affordance !== void 0 ? { affordance: down.affordance } : {},
|
|
@@ -717,8 +721,10 @@ function useGestureDispatcher(opts) {
|
|
|
717
721
|
ctrlKey: e.ctrlKey,
|
|
718
722
|
metaKey: e.metaKey,
|
|
719
723
|
shiftKey: e.shiftKey,
|
|
720
|
-
|
|
721
|
-
|
|
724
|
+
x: wClick.x,
|
|
725
|
+
y: wClick.y,
|
|
726
|
+
clientX: e.clientX,
|
|
727
|
+
clientY: e.clientY,
|
|
722
728
|
...down.affordance !== void 0 ? { affordance: down.affordance } : {},
|
|
723
729
|
...down.bodyTarget !== void 0 ? { bodyTarget: down.bodyTarget } : {},
|
|
724
730
|
...down.bodyKind !== void 0 ? { bodyKind: down.bodyKind } : {}
|
|
@@ -775,8 +781,10 @@ function useGestureDispatcher(opts) {
|
|
|
775
781
|
ctrlKey: e.ctrlKey,
|
|
776
782
|
metaKey: e.metaKey,
|
|
777
783
|
shiftKey: e.shiftKey,
|
|
778
|
-
|
|
779
|
-
|
|
784
|
+
x: w.x,
|
|
785
|
+
y: w.y,
|
|
786
|
+
clientX: e.clientX,
|
|
787
|
+
clientY: e.clientY,
|
|
780
788
|
...affordance !== void 0 ? { affordance } : {},
|
|
781
789
|
...menuBody?.body !== void 0 ? { bodyTarget: menuBody.body } : {},
|
|
782
790
|
...menuBody?.kind !== void 0 ? { bodyKind: menuBody.kind } : {}
|