@weasel-js/routing 1.11.0 → 1.11.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/dist/{chunk-QBQQIFPI.js → chunk-KLBH7VFF.js} +172 -48
- package/dist/chunk-KLBH7VFF.js.map +1 -0
- package/dist/{index-CmfVvwWD.d.ts → index-Cb7ehEks.d.ts} +912 -766
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/{internal-21M1rTVo.d.ts → internal-Dcyz_cJv.d.ts} +9 -1
- package/dist/internal.d.ts +5 -5
- package/dist/react.d.ts +7 -7
- package/dist/react.js +84 -42
- package/dist/react.js.map +1 -1
- package/package.json +13 -13
- package/dist/chunk-QBQQIFPI.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { RESERVED_ID_PREFIXES, RESERVED_ID_NAMES, isApplePlatform, routeGestureF
|
|
|
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 } from '@weasel-js/prefs';
|
|
7
|
+
import { prefIsShown, prefIsEnabled, isPrefLeaf, prefAliasTarget, prefLeafAt, prefAliasedLeaf, prefNumberAt, resolvePrefUnit, prefDisplayBounds, prefUnitAccepts, prefValueAtPath } from '@weasel-js/prefs';
|
|
8
8
|
import { endlessAllows } from '@weasel-js/quantity';
|
|
9
9
|
|
|
10
10
|
// src/interactions/actions/actionItems.ts
|
|
@@ -34,6 +34,21 @@ function actionItemTitle(item) {
|
|
|
34
34
|
return `${item.action.label}: ${item.label}`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// src/interactions/actions/actionSettings.ts
|
|
38
|
+
var EMPTY = { values: {} };
|
|
39
|
+
function readActionSettings(action, deps) {
|
|
40
|
+
const settings = action.settings;
|
|
41
|
+
if (!settings) return null;
|
|
42
|
+
try {
|
|
43
|
+
return settings.read(deps ?? {});
|
|
44
|
+
} catch {
|
|
45
|
+
return EMPTY;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function actionSettingsParams(settings, path, value) {
|
|
49
|
+
return settings.params ? settings.params(path, value) : { [path]: value };
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
// src/interactions/actions/binding.ts
|
|
38
53
|
function actionBindings(action) {
|
|
39
54
|
const gs = action.defaultBinding;
|
|
@@ -270,13 +285,21 @@ var DepNode = class extends ScopeNode {
|
|
|
270
285
|
};
|
|
271
286
|
},
|
|
272
287
|
get: (name) => {
|
|
288
|
+
const stacks = [...this.start().chain()].map((n) => n.sources.get(name) ?? []);
|
|
289
|
+
return readFrom(stacks, 0, (stacks[0]?.length ?? 0) - 1);
|
|
290
|
+
},
|
|
291
|
+
subscribe: (listener) => this.tree.listeners.subscribe(listener),
|
|
292
|
+
list: () => {
|
|
293
|
+
const found = /* @__PURE__ */ new Map();
|
|
294
|
+
let depth = 0;
|
|
273
295
|
for (const n of this.start().chain()) {
|
|
274
|
-
const
|
|
275
|
-
|
|
296
|
+
for (const [name, stack] of n.sources) {
|
|
297
|
+
if (!found.has(name)) found.set(name, { name, depth, stacked: stack.length });
|
|
298
|
+
}
|
|
299
|
+
depth++;
|
|
276
300
|
}
|
|
277
|
-
return
|
|
301
|
+
return [...found.values()].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
278
302
|
},
|
|
279
|
-
subscribe: (listener) => this.tree.listeners.subscribe(listener),
|
|
280
303
|
changed: () => this.changed()
|
|
281
304
|
};
|
|
282
305
|
constructor(parent, descends) {
|
|
@@ -284,6 +307,11 @@ var DepNode = class extends ScopeNode {
|
|
|
284
307
|
NODES.set(this.registry, this);
|
|
285
308
|
}
|
|
286
309
|
};
|
|
310
|
+
function readFrom(stacks, scope, index) {
|
|
311
|
+
if (scope >= stacks.length) return void 0;
|
|
312
|
+
if (index < 0) return readFrom(stacks, scope + 1, (stacks[scope + 1]?.length ?? 0) - 1);
|
|
313
|
+
return stacks[scope][index](() => readFrom(stacks, scope, index - 1));
|
|
314
|
+
}
|
|
287
315
|
var NODES = /* @__PURE__ */ new WeakMap();
|
|
288
316
|
function depNodeOf(registry) {
|
|
289
317
|
return registry ? NODES.get(registry) ?? null : null;
|
|
@@ -520,7 +548,8 @@ function routesForSpec(spec) {
|
|
|
520
548
|
const phases = phaseAtomsForSpec("phase" in spec ? spec.phase : void 0);
|
|
521
549
|
const target = descriptor.hasTarget ? routeTargetForSpec("target" in spec ? spec.target : void 0) ?? "*" : void 0;
|
|
522
550
|
const args = descriptor.arg ? routeArgsForSpec(spec, descriptor.arg.default) : [void 0];
|
|
523
|
-
|
|
551
|
+
const held = spec.kind === "hover" && spec.held !== void 0 ? { held: spec.held === true ? "required" : "optional" } : {};
|
|
552
|
+
return args.map((arg) => formatRoute({ phases, gesture, arg, target, modifiers, ...held }));
|
|
524
553
|
}
|
|
525
554
|
function entryFor(ownerId, spec, actionId) {
|
|
526
555
|
const gesture = routeGestureForSpecKind(spec.kind);
|
|
@@ -671,11 +700,11 @@ function matchSortedWithBarred(e, bindings, isMac, engagedChannels, opts = {}) {
|
|
|
671
700
|
const scopeBarred = [];
|
|
672
701
|
for (const sb of bindings) {
|
|
673
702
|
if (sb.scope !== scope) continue;
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
703
|
+
const admitted2 = admits(sb);
|
|
704
|
+
if (!admitted2 && !opts.collectBarred) continue;
|
|
676
705
|
const phaseCtx = { selfChannel: sb.ownerId, engagedChannels: engaged };
|
|
677
706
|
if (matchSpec(e, sb.binding.spec, isMac, phaseCtx)) {
|
|
678
|
-
(
|
|
707
|
+
(admitted2 ? scopeMatches : scopeBarred).push({ binding: sb.binding, scope, ownerId: sb.ownerId });
|
|
679
708
|
}
|
|
680
709
|
}
|
|
681
710
|
scopeMatches.sort((a, b) => compareSpecificity(a.binding.spec, b.binding.spec));
|
|
@@ -933,33 +962,14 @@ function buildRuleCtx(args) {
|
|
|
933
962
|
device: args.device
|
|
934
963
|
};
|
|
935
964
|
}
|
|
936
|
-
var DEV2 = isDev();
|
|
937
|
-
var TRACE_LIMIT = 200;
|
|
938
|
-
var traceLog = DEV2 && typeof window !== "undefined" ? window.__weaselDispatchLog__ ??= [] : [];
|
|
939
|
-
function recordTrace(entry) {
|
|
940
|
-
if (!DEV2) return;
|
|
941
|
-
traceLog.push(entry);
|
|
942
|
-
if (traceLog.length > TRACE_LIMIT) traceLog.shift();
|
|
943
|
-
}
|
|
944
|
-
function publishLiveDispatch(explain2) {
|
|
945
|
-
if (!DEV2 || typeof window === "undefined") return;
|
|
946
|
-
window.__weaselDispatchLive__ = explain2;
|
|
947
|
-
}
|
|
948
|
-
function recordModeSwitch(mode, from, to, detail) {
|
|
949
|
-
recordTrace({
|
|
950
|
-
kind: "mode",
|
|
951
|
-
ts: Date.now(),
|
|
952
|
-
mode,
|
|
953
|
-
from,
|
|
954
|
-
to,
|
|
955
|
-
...detail !== void 0 ? { detail } : {}
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
965
|
|
|
959
966
|
// src/interactions/dispatcher/gestureIds.ts
|
|
960
967
|
function pointerGestureId(pointerId) {
|
|
961
968
|
return `pointer-${pointerId ?? "mouse"}`;
|
|
962
969
|
}
|
|
970
|
+
function carryGestureId(pointerId) {
|
|
971
|
+
return `carry-${pointerId ?? "mouse"}`;
|
|
972
|
+
}
|
|
963
973
|
function multiTouchGestureId(fingers) {
|
|
964
974
|
return `multitouch-${fingers}`;
|
|
965
975
|
}
|
|
@@ -977,7 +987,7 @@ function gestureIdFor(event) {
|
|
|
977
987
|
return multiTouchGestureId(event.fingers);
|
|
978
988
|
}
|
|
979
989
|
if (event.kind === "carry") {
|
|
980
|
-
return
|
|
990
|
+
return carryGestureId(event.pointerId);
|
|
981
991
|
}
|
|
982
992
|
return `ongoing-${event.kind}`;
|
|
983
993
|
}
|
|
@@ -1022,6 +1032,51 @@ function assembleEntries(entries, inputs) {
|
|
|
1022
1032
|
}
|
|
1023
1033
|
};
|
|
1024
1034
|
}
|
|
1035
|
+
function createTraceRing(limit = 200, dev = isDev()) {
|
|
1036
|
+
const entries = [];
|
|
1037
|
+
const pushed = createEmitter();
|
|
1038
|
+
let total = 0;
|
|
1039
|
+
let watchers = 0;
|
|
1040
|
+
const recording = () => dev || watchers > 0;
|
|
1041
|
+
return {
|
|
1042
|
+
recording,
|
|
1043
|
+
push(entry) {
|
|
1044
|
+
if (!recording()) return;
|
|
1045
|
+
entries.push(entry);
|
|
1046
|
+
if (entries.length > limit) entries.shift();
|
|
1047
|
+
total++;
|
|
1048
|
+
pushed.emit();
|
|
1049
|
+
},
|
|
1050
|
+
since(cursor) {
|
|
1051
|
+
const first = total - entries.length;
|
|
1052
|
+
return { entries: entries.slice(Math.max(cursor, first) - first), cursor: total };
|
|
1053
|
+
},
|
|
1054
|
+
watch() {
|
|
1055
|
+
watchers++;
|
|
1056
|
+
let released = false;
|
|
1057
|
+
return () => {
|
|
1058
|
+
if (released) return;
|
|
1059
|
+
released = true;
|
|
1060
|
+
watchers--;
|
|
1061
|
+
};
|
|
1062
|
+
},
|
|
1063
|
+
subscribe: pushed.subscribe
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
function createDispatchTrace(limit, dev) {
|
|
1067
|
+
const ring = createTraceRing(limit, dev);
|
|
1068
|
+
let explain2 = null;
|
|
1069
|
+
return {
|
|
1070
|
+
...ring,
|
|
1071
|
+
recordModeSwitch(mode, from, to, detail) {
|
|
1072
|
+
ring.push({ kind: "mode", ts: Date.now(), mode, from, to, ...detail !== void 0 ? { detail } : {} });
|
|
1073
|
+
},
|
|
1074
|
+
setLive(next) {
|
|
1075
|
+
explain2 = next;
|
|
1076
|
+
},
|
|
1077
|
+
live: () => explain2?.() ?? null
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1025
1080
|
|
|
1026
1081
|
// src/interactions/dispatcher/inputFacts.ts
|
|
1027
1082
|
function modifiersOf(e) {
|
|
@@ -1043,6 +1098,7 @@ function worldPointOf(event) {
|
|
|
1043
1098
|
}
|
|
1044
1099
|
}
|
|
1045
1100
|
function carriedBy(event) {
|
|
1101
|
+
if (event.kind === "carry") return { items: [], carry: { type: event.type, value: event.value } };
|
|
1046
1102
|
return event.kind === "drop" || event.kind === "paste" ? { items: event.items } : void 0;
|
|
1047
1103
|
}
|
|
1048
1104
|
function immediateParams(event, resolved) {
|
|
@@ -1109,6 +1165,7 @@ function immediateParams(event, resolved) {
|
|
|
1109
1165
|
affordance: event.affordance,
|
|
1110
1166
|
bodyTarget: event.bodyTarget,
|
|
1111
1167
|
mods: modifiersOf(event),
|
|
1168
|
+
held: event.held === true,
|
|
1112
1169
|
...resolved
|
|
1113
1170
|
};
|
|
1114
1171
|
case "carry":
|
|
@@ -1118,6 +1175,9 @@ function immediateParams(event, resolved) {
|
|
|
1118
1175
|
clientX: event.clientX,
|
|
1119
1176
|
clientY: event.clientY,
|
|
1120
1177
|
carry: { type: event.type, value: event.value },
|
|
1178
|
+
affordance: event.affordance,
|
|
1179
|
+
bodyTarget: event.bodyTarget,
|
|
1180
|
+
bodyKind: event.bodyKind,
|
|
1121
1181
|
mods: modifiersOf(event),
|
|
1122
1182
|
...resolved
|
|
1123
1183
|
};
|
|
@@ -1139,6 +1199,10 @@ function liveInView(binding, view) {
|
|
|
1139
1199
|
const views = binding.opts?.views;
|
|
1140
1200
|
return views === void 0 || views.includes(view);
|
|
1141
1201
|
}
|
|
1202
|
+
function liveForKeys(binding, reach) {
|
|
1203
|
+
if (reach === void 0) return true;
|
|
1204
|
+
return binding.opts?.over ? reach.over : reach.held;
|
|
1205
|
+
}
|
|
1142
1206
|
function namesView(binding, view) {
|
|
1143
1207
|
return binding.opts?.views?.includes(view) ?? false;
|
|
1144
1208
|
}
|
|
@@ -1557,7 +1621,7 @@ function pumpCarry(run, event) {
|
|
|
1557
1621
|
if (event.stage === "enter") return void 0;
|
|
1558
1622
|
const gestureId = gestureIdFor(event);
|
|
1559
1623
|
const handle = run.inFlight.handles.get(gestureId);
|
|
1560
|
-
if (!handle) return event.stage === "
|
|
1624
|
+
if (!handle) return event.stage === "leave" ? "unhandled" : void 0;
|
|
1561
1625
|
if (event.stage === "move") {
|
|
1562
1626
|
handle.onMove?.(ctxFor(run, event, {}, gestureId));
|
|
1563
1627
|
return "handled";
|
|
@@ -1566,7 +1630,7 @@ function pumpCarry(run, event) {
|
|
|
1566
1630
|
}
|
|
1567
1631
|
function carryStageFits(event, timing) {
|
|
1568
1632
|
if (event.kind !== "carry") return true;
|
|
1569
|
-
return
|
|
1633
|
+
return timing === "immediate" ? event.stage === "drop" : event.stage === "enter" || event.stage === "move";
|
|
1570
1634
|
}
|
|
1571
1635
|
function invokeAction(run, event, match, action, deps) {
|
|
1572
1636
|
if (action.invoker && !carryStageFits(event, action.invoker.timing)) return "empty-handle";
|
|
@@ -1696,16 +1760,20 @@ function assembleScopedBindings(ctx) {
|
|
|
1696
1760
|
...allowedCapabilities ? { allowedCapabilities } : {}
|
|
1697
1761
|
});
|
|
1698
1762
|
const view = ctx.viewId ?? null;
|
|
1699
|
-
const
|
|
1763
|
+
const live = (b) => liveInView(b, view) && liveForKeys(b, ctx.keyReach);
|
|
1764
|
+
const result = scopeBindings(ordered, state).filter((sb) => live(sb.binding));
|
|
1700
1765
|
for (const action of ctx.actions.list()) {
|
|
1701
1766
|
const targetScope = action.scope === "hotkey" ? "hotkey" : "ambient";
|
|
1702
1767
|
for (const binding of actionBindings(action)) {
|
|
1703
|
-
if (!
|
|
1768
|
+
if (!live(binding)) continue;
|
|
1704
1769
|
result.push({ binding, scope: targetScope, ownerId: null });
|
|
1705
1770
|
}
|
|
1706
1771
|
}
|
|
1707
1772
|
return result;
|
|
1708
1773
|
}
|
|
1774
|
+
function anyBinding(ctx, test) {
|
|
1775
|
+
return assembleScopedBindings(ctx).some((sb) => test(sb.binding.spec));
|
|
1776
|
+
}
|
|
1709
1777
|
function buildActionMap(registry) {
|
|
1710
1778
|
const map = /* @__PURE__ */ new Map();
|
|
1711
1779
|
for (const action of registry.list()) {
|
|
@@ -1893,10 +1961,11 @@ function createDispatcher(opts) {
|
|
|
1893
1961
|
const pumped = pumpGesture(run, event);
|
|
1894
1962
|
if (pumped !== void 0) return pumped;
|
|
1895
1963
|
if (event.kind === "hover") return hover(event, ctx);
|
|
1896
|
-
const
|
|
1964
|
+
const trace = ctx.trace?.recording() ? ctx.trace : null;
|
|
1965
|
+
const r = rank(event, ctx, inFlight.engagedOwners(), trace !== null);
|
|
1897
1966
|
const walked = walk(r, event, ctx, invoking(event), false);
|
|
1898
1967
|
const outcome = walked.stop === "fired" ? "handled" : "unhandled";
|
|
1899
|
-
|
|
1968
|
+
trace?.push(buildDispatchRecord(r, walked, event, ctx, false, outcome));
|
|
1900
1969
|
return outcome;
|
|
1901
1970
|
}
|
|
1902
1971
|
function hover(event, ctx) {
|
|
@@ -2333,6 +2402,20 @@ function normalizeMime(raw) {
|
|
|
2333
2402
|
const bare = raw.split(";")[0].trim().toLowerCase();
|
|
2334
2403
|
return bare || FALLBACK_MIME;
|
|
2335
2404
|
}
|
|
2405
|
+
var admitted = /* @__PURE__ */ new Map();
|
|
2406
|
+
function admitIngestMime(mime) {
|
|
2407
|
+
const key = normalizeMime(mime);
|
|
2408
|
+
admitted.set(key, (admitted.get(key) ?? 0) + 1);
|
|
2409
|
+
let released = false;
|
|
2410
|
+
return () => {
|
|
2411
|
+
if (released) return;
|
|
2412
|
+
released = true;
|
|
2413
|
+
const n = (admitted.get(key) ?? 1) - 1;
|
|
2414
|
+
if (n > 0) admitted.set(key, n);
|
|
2415
|
+
else admitted.delete(key);
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
var keepsString = (mime) => INGEST_STRING_MIMES.has(mime) || admitted.has(mime);
|
|
2336
2419
|
function itemsFromFiles(files) {
|
|
2337
2420
|
return files.map((file) => ({ kind: "file", mime: normalizeMime(file.type), file }));
|
|
2338
2421
|
}
|
|
@@ -2346,7 +2429,7 @@ function itemsFromDataTransfer(dt) {
|
|
|
2346
2429
|
if (file) files.push({ kind: "file", mime: normalizeMime(file.type), file });
|
|
2347
2430
|
} else if (item.kind === "string") {
|
|
2348
2431
|
const mime = normalizeMime(item.type);
|
|
2349
|
-
if (
|
|
2432
|
+
if (keepsString(mime)) {
|
|
2350
2433
|
const slot = strings.length;
|
|
2351
2434
|
strings.push(null);
|
|
2352
2435
|
reads.push(
|
|
@@ -2372,7 +2455,7 @@ function itemTypesFromDataTransfer(dt) {
|
|
|
2372
2455
|
for (const item of Array.from(dt.items ?? [])) {
|
|
2373
2456
|
const mime = item.type ? normalizeMime(item.type) : "";
|
|
2374
2457
|
if (item.kind === "file") mimes.push(mime && mime !== "application/x-moz-file" ? mime : UNKNOWN_MIME);
|
|
2375
|
-
else if (
|
|
2458
|
+
else if (keepsString(mime)) mimes.push(mime);
|
|
2376
2459
|
}
|
|
2377
2460
|
if (mimes.length === 0 && Array.from(dt.types ?? []).includes("Files")) mimes.push(UNKNOWN_MIME);
|
|
2378
2461
|
return mimes.map((mime) => ({ mime }));
|
|
@@ -2382,7 +2465,7 @@ function itemsFromClipboardData(cd) {
|
|
|
2382
2465
|
for (const file of Array.from(cd.files ?? [])) {
|
|
2383
2466
|
out.push({ kind: "file", mime: normalizeMime(file.type), file });
|
|
2384
2467
|
}
|
|
2385
|
-
for (const mime of INGEST_STRING_MIMES) {
|
|
2468
|
+
for (const mime of /* @__PURE__ */ new Set([...INGEST_STRING_MIMES, ...admitted.keys()])) {
|
|
2386
2469
|
const text = cd.getData(mime);
|
|
2387
2470
|
if (text) out.push({ kind: "string", mime, text });
|
|
2388
2471
|
}
|
|
@@ -2473,6 +2556,7 @@ var sep = (key) => ({ kind: "separator", key });
|
|
|
2473
2556
|
function itemOf(ctx, it, key, label, off, access) {
|
|
2474
2557
|
const deps = ctx.src.depsFor(it.action);
|
|
2475
2558
|
const point = ctx.at ? { worldX: ctx.at.x, worldY: ctx.at.y } : {};
|
|
2559
|
+
if (it.action.settings) return settingsOf(ctx, it, key, label, off || !evaluateEnabled(it.action, deps, ctx.at).enabled, access);
|
|
2476
2560
|
return {
|
|
2477
2561
|
kind: "item",
|
|
2478
2562
|
key,
|
|
@@ -2487,6 +2571,32 @@ function itemOf(ctx, it, key, label, off, access) {
|
|
|
2487
2571
|
}
|
|
2488
2572
|
};
|
|
2489
2573
|
}
|
|
2574
|
+
function settingsOf(ctx, it, key, label, off, access) {
|
|
2575
|
+
const settings = it.action.settings;
|
|
2576
|
+
const state = off ? null : readActionSettings(it.action, ctx.src.depsFor(it.action));
|
|
2577
|
+
const mixed = new Set(state?.mixed ?? []);
|
|
2578
|
+
const values = (path) => mixed.has(path) ? void 0 : prefValueAtPath(state?.values, path);
|
|
2579
|
+
const onChange = (path, value) => {
|
|
2580
|
+
const params = actionSettingsParams(settings, path, value);
|
|
2581
|
+
if (params) ctx.src.trigger(it.action.id, { ...ctx.params, ...it.params, ...params });
|
|
2582
|
+
};
|
|
2583
|
+
const form = {
|
|
2584
|
+
...ctx,
|
|
2585
|
+
src: { ...ctx.src, values, onChange, over: settings.schema },
|
|
2586
|
+
root: settings.schema,
|
|
2587
|
+
read: (path, from) => from === "item" ? void 0 : values(path)
|
|
2588
|
+
};
|
|
2589
|
+
const entries = state ? tidy(groupRows(form, settings.schema, "", false)) : [];
|
|
2590
|
+
return {
|
|
2591
|
+
kind: "submenu",
|
|
2592
|
+
key,
|
|
2593
|
+
label,
|
|
2594
|
+
...it.icon ? { icon: it.icon } : {},
|
|
2595
|
+
...withAccess(access),
|
|
2596
|
+
...entries.length === 0 ? { disabled: true } : {},
|
|
2597
|
+
entries
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2490
2600
|
function itemsNamed(ctx, name) {
|
|
2491
2601
|
const action = ctx.byId.get(name);
|
|
2492
2602
|
if (action) return actionItems(action);
|
|
@@ -2584,9 +2694,23 @@ function colorRows(ctx, leaf, key, path, off) {
|
|
|
2584
2694
|
if (!ctx.src.values) return [];
|
|
2585
2695
|
return [{ kind: "color", key, label: leaf.name, ...withAccess(leaf.access), ...off ? { disabled: true } : {}, value: textAt(ctx, path) }];
|
|
2586
2696
|
}
|
|
2587
|
-
function stringRows(ctx, leaf, key, path) {
|
|
2588
|
-
|
|
2589
|
-
|
|
2697
|
+
function stringRows(ctx, leaf, key, path, off) {
|
|
2698
|
+
const { values, onChange } = ctx.src;
|
|
2699
|
+
if (!values) return [];
|
|
2700
|
+
if (leaf.readout || !onChange) {
|
|
2701
|
+
return [{ kind: "item", key, label: `${leaf.name}: ${textAt(ctx, path) ?? "\u2014"}`, ...withAccess(leaf.access), disabled: true, run: noop }];
|
|
2702
|
+
}
|
|
2703
|
+
const stored = values(path);
|
|
2704
|
+
return [{
|
|
2705
|
+
kind: "text",
|
|
2706
|
+
key,
|
|
2707
|
+
label: leaf.name,
|
|
2708
|
+
...withAccess(leaf.access),
|
|
2709
|
+
...leaf.icon ? { icon: leaf.icon } : {},
|
|
2710
|
+
...off ? { disabled: true } : {},
|
|
2711
|
+
value: typeof stored === "string" ? stored : void 0,
|
|
2712
|
+
set: (text) => onChange(path, text)
|
|
2713
|
+
}];
|
|
2590
2714
|
}
|
|
2591
2715
|
function leafRows(ctx, leaf, key, path, off) {
|
|
2592
2716
|
switch (leaf.kind) {
|
|
@@ -2605,7 +2729,7 @@ function leafRows(ctx, leaf, key, path, off) {
|
|
|
2605
2729
|
case "color":
|
|
2606
2730
|
return colorRows(ctx, leaf, key, path, off);
|
|
2607
2731
|
case "string":
|
|
2608
|
-
return stringRows(ctx, leaf, key, path);
|
|
2732
|
+
return stringRows(ctx, leaf, key, path, off);
|
|
2609
2733
|
case "separator":
|
|
2610
2734
|
return [sep(key)];
|
|
2611
2735
|
case "label":
|
|
@@ -2720,6 +2844,6 @@ function createMenuHost(src) {
|
|
|
2720
2844
|
};
|
|
2721
2845
|
}
|
|
2722
2846
|
|
|
2723
|
-
export { ALWAYS, ActionDisabledReason, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE,
|
|
2724
|
-
//# sourceMappingURL=chunk-
|
|
2725
|
-
//# sourceMappingURL=chunk-
|
|
2847
|
+
export { ALWAYS, ActionDisabledReason, COARSE_TARGET_SCALE, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEVICE_PROFILE, DepNode, INGEST_STRING_MIMES, LONG_PRESS_HAPTIC_MS, NEVER, PREDICATE_TARGET, ScopeNode, TOOL_OFFHAND_ID, actionBindings, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, addCarrySurface, admitIngestMime, anyBinding, assembleEntries, buildDepsFromRequires, buildRouteRegistry, buildRuleCtx, buildToolOffhandBindings, carryGestureId, clientToCanvas, clientToCanvasRect, createDepRegistry, createDispatchTrace, createDispatcher, createLongPressStore, createMenuHost, createTraceRing, depNodeOf, describeRule, dlog, dwarn, evaluate, evaluateActive, evaluateEnabled, findConflicts, heldKeySpec, historyKey, isDebugEnabled, isTool, itemTypesFromDataTransfer, itemsFromClipboardData, itemsFromDataTransfer, itemsFromFiles, keySpecShortcut, keysHeld, liveScope, makeToolOffhandAction, matchBest, matchSorted, matchSortedWithBarred, matchesKeyBinding, mergeMenuDefs, multiTouchGestureId, offhandKeyFor, openPointerSession, pickMenu, pointerGestureId, pushOwner, readActionSettings, reportRouteConflicts, resolveDeviceProfile, resolveMenu, resolveParams, resolveSchemaMenu, roleReader, routesForSpec, ruleCanHoldIn, rulesExclusive, scopeBindings, startCarry, targetConsultsAffordance, tuneAction, tunedParams, validateActionDefaultBinding, validateActionId };
|
|
2848
|
+
//# sourceMappingURL=chunk-KLBH7VFF.js.map
|
|
2849
|
+
//# sourceMappingURL=chunk-KLBH7VFF.js.map
|