@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 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
- ## Two entry points
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, filterEligible, findConflicts, isDev, isEditableTarget, isTool, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, liveScope, makeToolOffhandAction, matchBest, matchSorted, matchSortedWithBarred, matchesKeyBinding, offhandKeyFor, openPointerSession, pointerGestureId, preferContextual, publishLiveDispatch, pushOwner, recordModeSwitch, reportRouteConflicts, resolveDeviceProfile, resolveParams, routesForSpec, ruleCanHoldIn, rulesExclusive, scopeBindings, targetConsultsAffordance, validateActionDefaultBinding, validateActionId };
1927
- //# sourceMappingURL=chunk-Q3Y3DPKH.js.map
1928
- //# sourceMappingURL=chunk-Q3Y3DPKH.js.map
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