@weasel-js/routing 1.13.0-rc.0 → 1.13.0

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.
@@ -4,7 +4,7 @@ import { RESERVED_ID_PREFIXES, RESERVED_ID_NAMES, isApplePlatform, bindingSpec,
4
4
  export { GESTURE_DESCRIPTORS, LONG_PRESS_MS, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, activatesFocusedControl, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, focusedControlOwnsKey, formatPhaseAtom, formatRoute, getGestureDescriptor, isEditableTarget, isKnownGestureName, matchKey, matchModifiers, matchPhase, matchSpec, matchTarget, parseRoute, routeGestureForSpecKind, specKindForRouteGesture, specificity } from '@weasel-js/gestures';
5
5
  import { activeModeOf, NORMAL, DEFAULT_MODES, capabilitiesAllowed } from '@weasel-js/modes';
6
6
  import { resolveCursor } from '@weasel-js/cursor';
7
- import { prefIsShown, prefIsEnabled, isPrefLeaf, prefAliasTarget, prefLeafAt, prefAliasedLeaf, prefNumberAt, resolvePrefUnit, prefDisplayBounds, prefUnitAccepts, prefValueAtPath } from '@weasel-js/prefs';
7
+ import { isPrefLeaf, prefScopeIn, prefScopeUnder, prefConditionHolds, prefAliasTarget, prefLeafAt, prefAliasedLeaf, prefNumberAt, resolvePrefUnit, prefDisplayBounds, prefUnitAccepts, PREF_SCOPE, prefValueAtPath } from '@weasel-js/prefs';
8
8
  import { endlessAllows } from '@weasel-js/quantity';
9
9
 
10
10
  // src/interactions/actions/actionItems.ts
@@ -2930,7 +2930,7 @@ function settingsOf(ctx, it, key, label, off, access) {
2930
2930
  root: settings.schema,
2931
2931
  read: (path, from) => from === "item" ? void 0 : values(path)
2932
2932
  };
2933
- const entries = state ? tidy(groupRows(form, settings.schema, "", false)) : [];
2933
+ const entries = state ? tidy(groupRows(form, settings.schema, "", ROOT)) : [];
2934
2934
  return {
2935
2935
  kind: "submenu",
2936
2936
  key,
@@ -3087,21 +3087,27 @@ function leafRows(ctx, leaf, key, path, off) {
3087
3087
  return [];
3088
3088
  }
3089
3089
  }
3090
- function groupRows(ctx, group, prefix, off) {
3090
+ var ROOT = { node: {}, scope: PREF_SCOPE, above: PREF_SCOPE };
3091
+ function groupRows(ctx, group, prefix, owner) {
3092
+ const { read: read2 } = ctx;
3093
+ const holds = (condition) => read2 === void 0 || prefConditionHolds(condition, read2);
3091
3094
  const out = [];
3092
3095
  for (const [k, node] of Object.entries(group.children)) {
3093
3096
  const path = prefix ? `${prefix}.${k}` : k;
3094
- if (ctx.read && !prefIsShown(node, ctx.read)) continue;
3095
- const disabled = off || ctx.read !== void 0 && !prefIsEnabled(node, ctx.read);
3097
+ const sits = isPrefLeaf(node) ? prefScopeIn(owner, path, holds) : owner.scope;
3098
+ const scope = prefScopeUnder(sits, node, holds);
3099
+ if (!scope.shown) continue;
3100
+ const disabled = !scope.enabled;
3101
+ const inner = { node, scope, above: sits };
3096
3102
  if (isPrefLeaf(node)) {
3097
3103
  out.push(...leafRows(ctx, node, path, path, disabled));
3098
3104
  } else if (node.as !== void 0 && SUBMENU_AS.has(node.as)) {
3099
- const entries = tidy(groupRows(ctx, node, path, disabled));
3105
+ const entries = tidy(groupRows(ctx, node, path, inner));
3100
3106
  if (entries.length) {
3101
3107
  out.push({ kind: "submenu", key: path, label: node.name, ...node.icon ? { icon: node.icon } : {}, ...withAccess(node.access), entries });
3102
3108
  }
3103
3109
  } else {
3104
- out.push(sep(`${path}/<`), ...groupRows(ctx, node, path, disabled), sep(`${path}/>`));
3110
+ out.push(sep(`${path}/<`), ...groupRows(ctx, node, path, inner), sep(`${path}/>`));
3105
3111
  }
3106
3112
  }
3107
3113
  return out;
@@ -3125,7 +3131,7 @@ function resolveSchemaMenu(schema, src, at, params) {
3125
3131
  at,
3126
3132
  params
3127
3133
  };
3128
- return tidy(groupRows(ctx, schema, "", false));
3134
+ return tidy(groupRows(ctx, schema, "", ROOT));
3129
3135
  }
3130
3136
  function resolveMenu(def, src, at, params) {
3131
3137
  return resolveSchemaMenu(def.menu, src, at, params);
@@ -3190,5 +3196,5 @@ function createMenuHost(src) {
3190
3196
  }
3191
3197
 
3192
3198
  export { ALWAYS, ActionDisabledReason, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, DepNode, INGEST_STRING_MIMES, KEYMAP_HOLD, LONG_PRESS_HAPTIC_MS, NEVER, NO_OVERRIDES, PREDICATE_TARGET, ScopeNode, TOOL_OFFHAND_ID, actionBindings, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, addCarrySurface, admitIngestMime, anyBinding, assembleEntries, bindingId, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, carryGestureId, clientToCanvas, clientToCanvasRect, createDepRegistry, createDispatchTrace, createDispatcher, createKeymapStack, createLongPressStore, createMenuHost, createTraceRing, depNodeOf, describeKeymap, describeRule, dlog, dwarn, evaluate, evaluateActive, evaluateEnabled, findConflicts, heldKeySpec, historyKey, isDebugEnabled, isTool, itemTypesFromDataTransfer, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, keySpecShortcut, keymapContribution, keymapLeaderBindingId, keymapLeaderId, keymapShortcuts, keysHeld, liveScope, makeToolOffhandAction, matchBest, matchSorted, matchSortedWithBarred, matchesKeyBinding, mergeMenuDefs, modifierStateOf, multiTouchGestureId, offhandKeyFor, openPointerSession, overriddenBindings, overrideActionBindings, pickMenu, pointerGestureId, pushOwner, readActionSettings, reportRouteConflicts, resolveBindingOverrides, resolveDeviceProfile, resolveMenu, resolveParams, resolveSchemaMenu, roleReader, routesForSpec, ruleCanHoldIn, rulesExclusive, scopeBindings, startCarry, targetConsultsAffordance, tuneAction, tunedParams, validateActionDefaultBinding, validateActionId };
3193
- //# sourceMappingURL=chunk-CRF3ROBB.js.map
3194
- //# sourceMappingURL=chunk-CRF3ROBB.js.map
3199
+ //# sourceMappingURL=chunk-XVWEZTUX.js.map
3200
+ //# sourceMappingURL=chunk-XVWEZTUX.js.map