@weasel-js/routing 1.7.0 → 1.7.1
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/README.md +3 -1
- package/dist/{chunk-Q3Y3DPKH.js → chunk-ZGKJWZ4S.js} +31 -10
- package/dist/chunk-ZGKJWZ4S.js.map +1 -0
- package/dist/{index-Bmq4lSHY.d.ts → index-BV53gfyB.d.ts} +115 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/internal--mYnGecm.d.ts +275 -0
- package/dist/internal.d.ts +7 -0
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -0
- package/dist/react.d.ts +8 -272
- package/dist/react.js +121 -130
- package/dist/react.js.map +1 -1
- package/package.json +10 -5
- package/dist/chunk-Q3Y3DPKH.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,13 +9,15 @@ knows nothing about what an action does to a scene — actions themselves, the
|
|
|
9
9
|
scene graph, the renderer and the concrete dependency interfaces all live in
|
|
10
10
|
`@weasel-js/core`, which consumes this package and re-exports its surface.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Entry points
|
|
13
13
|
|
|
14
14
|
- `@weasel-js/routing` — the pure half. No React, no DOM: the dispatcher, the
|
|
15
15
|
matcher, the rule algebra, the action and tool types, the invoker.
|
|
16
16
|
- `@weasel-js/routing/react` — the React seam. `useGestureDispatcher` and the
|
|
17
17
|
providers that feed it (`ActionsProvider`, `DepRegistryProvider`,
|
|
18
18
|
`useTools`, `useContributions`). React is an optional peer.
|
|
19
|
+
- `@weasel-js/routing/internal` — not public API. Types `@weasel-js/core` fills
|
|
20
|
+
from across the package boundary; they change without notice.
|
|
19
21
|
|
|
20
22
|
## The dependency schema
|
|
21
23
|
|
|
@@ -799,13 +799,6 @@ function isEligible(action, ruleCtx) {
|
|
|
799
799
|
function describeEligible(eligible) {
|
|
800
800
|
return describeRule(eligibleToRule(eligible));
|
|
801
801
|
}
|
|
802
|
-
function filterEligible(matches, actionLookup, ruleCtx) {
|
|
803
|
-
return matches.filter((m) => {
|
|
804
|
-
const action = actionLookup(m.binding.actionId);
|
|
805
|
-
if (!action) return true;
|
|
806
|
-
return isEligible(action, ruleCtx);
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
802
|
function preferContextual(matches, actionLookup, holds, view) {
|
|
810
803
|
const out = [];
|
|
811
804
|
let run = [];
|
|
@@ -1576,6 +1569,34 @@ function createDispatcher(opts) {
|
|
|
1576
1569
|
};
|
|
1577
1570
|
}
|
|
1578
1571
|
|
|
1572
|
+
// src/interactions/dispatcher/longPressState.ts
|
|
1573
|
+
var LONG_PRESS_MS = 500;
|
|
1574
|
+
var nowMs = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
1575
|
+
function createLongPressStore() {
|
|
1576
|
+
let current = null;
|
|
1577
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1578
|
+
return {
|
|
1579
|
+
get: () => current,
|
|
1580
|
+
progress: (now = nowMs()) => {
|
|
1581
|
+
if (!current) return 0;
|
|
1582
|
+
if (!(current.duration > 0)) return 1;
|
|
1583
|
+
const t = (now - current.startedAt) / current.duration;
|
|
1584
|
+
return t <= 0 ? 0 : t >= 1 ? 1 : t;
|
|
1585
|
+
},
|
|
1586
|
+
subscribe: (fn) => {
|
|
1587
|
+
listeners.add(fn);
|
|
1588
|
+
return () => {
|
|
1589
|
+
listeners.delete(fn);
|
|
1590
|
+
};
|
|
1591
|
+
},
|
|
1592
|
+
set: (next) => {
|
|
1593
|
+
if (next === current) return;
|
|
1594
|
+
current = next;
|
|
1595
|
+
for (const fn of [...listeners]) fn();
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1579
1600
|
// src/interactions/pointerSession/pointerSession.ts
|
|
1580
1601
|
var LOST_CAPTURE_EVENT = "lostpointercapture";
|
|
1581
1602
|
function reportsButtons(down) {
|
|
@@ -1923,6 +1944,6 @@ function dlog(namespace, ...args) {
|
|
|
1923
1944
|
console.debug(`[${namespace}]`, ...args);
|
|
1924
1945
|
}
|
|
1925
1946
|
|
|
1926
|
-
export { ALWAYS, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, DepNode, INGEST_STRING_MIMES, NEVER, PREDICATE_TARGET, ScopeNode, TOOL_OFFHAND_ID, actionBindings, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, clientToCanvas, clientToCanvasRect, createDepRegistry, createDispatcher, depNodeOf, describeRule, dlog, evaluate,
|
|
1927
|
-
//# sourceMappingURL=chunk-
|
|
1928
|
-
//# sourceMappingURL=chunk-
|
|
1947
|
+
export { ALWAYS, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, DepNode, INGEST_STRING_MIMES, LONG_PRESS_MS, NEVER, PREDICATE_TARGET, ScopeNode, TOOL_OFFHAND_ID, actionBindings, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, clientToCanvas, clientToCanvasRect, createDepRegistry, createDispatcher, createLongPressStore, depNodeOf, describeRule, dlog, evaluate, findConflicts, isDev, isEditableTarget, isTool, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, liveScope, makeToolOffhandAction, matchBest, matchSorted, matchSortedWithBarred, matchesKeyBinding, offhandKeyFor, openPointerSession, pointerGestureId, publishLiveDispatch, pushOwner, recordModeSwitch, reportRouteConflicts, resolveDeviceProfile, resolveParams, routesForSpec, ruleCanHoldIn, rulesExclusive, scopeBindings, targetConsultsAffordance, validateActionDefaultBinding, validateActionId };
|
|
1948
|
+
//# sourceMappingURL=chunk-ZGKJWZ4S.js.map
|
|
1949
|
+
//# sourceMappingURL=chunk-ZGKJWZ4S.js.map
|