@vibecook/ice 0.15.0 → 0.16.0-portals.3
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-644DO6PN.js → chunk-6VY7I6VA.js} +2 -2
- package/dist/chunk-6VY7I6VA.js.map +1 -0
- package/dist/{chunk-US7WJNR6.js → chunk-NB4ALBIY.js} +349 -66
- package/dist/chunk-NB4ALBIY.js.map +1 -0
- package/dist/{chunk-SPG45AVV.js → chunk-SHU3HVMF.js} +72 -12
- package/dist/chunk-SHU3HVMF.js.map +1 -0
- package/dist/{chunk-A6PUTIL7.js → chunk-SUNUMQLC.js} +494 -57
- package/dist/chunk-SUNUMQLC.js.map +1 -0
- package/dist/desk-kit.js +14 -2
- package/dist/desk-objects.js +3 -3
- package/dist/desk.js +15 -3
- package/dist/devtools.js +1 -1
- package/dist/dom.js +2 -2
- package/dist/index.js +5 -3
- package/dist/react.js +20 -5
- package/dist/react.js.map +1 -1
- package/dist/types/packages/core/src/catalog/desk.d.ts +36 -1
- package/dist/types/packages/core/src/catalog/selection-presence.d.ts +0 -10
- package/dist/types/packages/core/src/systems/held.d.ts +10 -3
- package/dist/types/packages/core/src/systems/l4-cursor.d.ts +9 -2
- package/dist/types/packages/core/src/widget/define-widget.d.ts +16 -22
- package/dist/types/packages/desk/src/card/card.d.ts +7 -2
- package/dist/types/packages/desk/src/encoder-guard.d.ts +16 -0
- package/dist/types/packages/desk/src/engine/budget.d.ts +4 -2
- package/dist/types/packages/desk/src/ground.d.ts +46 -0
- package/dist/types/packages/desk/src/hold/told.d.ts +15 -0
- package/dist/types/packages/desk/src/host/layer.d.ts +8 -2
- package/dist/types/packages/desk/src/index.d.ts +2 -1
- package/dist/types/packages/desk/src/kind.d.ts +5 -1
- package/dist/types/packages/desk/src/kinds/world.d.ts +93 -2
- package/dist/types/packages/desk/src/kit/editor.d.ts +9 -1
- package/dist/types/packages/desk/src/kit/index.d.ts +1 -0
- package/dist/types/packages/desk/src/kit/live.d.ts +260 -0
- package/dist/types/packages/desk/src/kit/mips.d.ts +11 -0
- package/dist/types/packages/desk/src/kit/wgsl.d.ts +5 -2
- package/dist/types/packages/desk/src/missing/slots.d.ts +9 -1
- package/dist/types/packages/desk/src/object.d.ts +1 -1
- package/dist/types/packages/desk/src/still.d.ts +3 -1
- package/dist/types/packages/dom/src/desk-host.d.ts +3 -2
- package/dist/types/packages/dom/src/input-ownership.d.ts +5 -3
- package/dist/types/packages/dom/src/widget-focus.d.ts +2 -2
- package/dist/types/packages/objects/src/minimat/layout.d.ts +1 -1
- package/dist/types/packages/react/src/keymap.d.ts +9 -3
- package/package.json +1 -1
- package/dist/chunk-644DO6PN.js.map +0 -1
- package/dist/chunk-A6PUTIL7.js.map +0 -1
- package/dist/chunk-SPG45AVV.js.map +0 -1
- package/dist/chunk-US7WJNR6.js.map +0 -1
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
spring,
|
|
79
79
|
themeFrom,
|
|
80
80
|
tilted
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-NB4ALBIY.js";
|
|
82
82
|
import {
|
|
83
83
|
BLEND_OVER,
|
|
84
84
|
bindGroup,
|
|
@@ -105,8 +105,11 @@ import {
|
|
|
105
105
|
Grab,
|
|
106
106
|
GuideLine,
|
|
107
107
|
Held,
|
|
108
|
+
HeldPointer,
|
|
109
|
+
HeldPress,
|
|
108
110
|
HeldTool,
|
|
109
111
|
HeldView,
|
|
112
|
+
HeldWheel,
|
|
110
113
|
InsertGhost,
|
|
111
114
|
LocalPointer,
|
|
112
115
|
Locked,
|
|
@@ -115,6 +118,7 @@ import {
|
|
|
115
118
|
NavTransition,
|
|
116
119
|
OverInteractive,
|
|
117
120
|
Pointer,
|
|
121
|
+
PointerButtons,
|
|
118
122
|
PointerScreen,
|
|
119
123
|
PointerVersion,
|
|
120
124
|
Position,
|
|
@@ -160,7 +164,7 @@ import {
|
|
|
160
164
|
trayTakeProps,
|
|
161
165
|
widgetSpawnInits,
|
|
162
166
|
widgetTypeFor
|
|
163
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-SHU3HVMF.js";
|
|
164
168
|
import {
|
|
165
169
|
clientToScreen,
|
|
166
170
|
cubicBezierEase,
|
|
@@ -1074,8 +1078,12 @@ var CardPass = class _CardPass {
|
|
|
1074
1078
|
this.list[this.n] = (m << CARD_SLOT_BITS | slot & SLOT_MASK) >>> 0;
|
|
1075
1079
|
return this.n++;
|
|
1076
1080
|
}
|
|
1077
|
-
/**
|
|
1078
|
-
|
|
1081
|
+
/**
|
|
1082
|
+
* The list uploaded when it changed, the group made again when anything under it moved, the pipeline for the slot's light. `threw`
|
|
1083
|
+
* (the ground's kind boundary, M24 LT3): a material kind's `cardResources` that throws is handed there by name, and the card draws
|
|
1084
|
+
* nothing this frame (0 — every object is its own kind's, as with the card off); absent, the throw is the caller's.
|
|
1085
|
+
*/
|
|
1086
|
+
prepare(slot, threw) {
|
|
1079
1087
|
const n = this.n;
|
|
1080
1088
|
if (n > 0) {
|
|
1081
1089
|
if (this.buffer.size < n * 4) {
|
|
@@ -1097,31 +1105,47 @@ var CardPass = class _CardPass {
|
|
|
1097
1105
|
this.sent.set(this.list.subarray(0, n));
|
|
1098
1106
|
this.sentN = n;
|
|
1099
1107
|
}
|
|
1100
|
-
this.rebind()
|
|
1108
|
+
if (!this.rebind(threw)) {
|
|
1109
|
+
this.group = null;
|
|
1110
|
+
return 0;
|
|
1111
|
+
}
|
|
1101
1112
|
}
|
|
1102
1113
|
this.litElsewhere = !litByOwn(slot.view, slot.lit);
|
|
1103
1114
|
return n;
|
|
1104
1115
|
}
|
|
1105
|
-
|
|
1116
|
+
/** The group made again when anything under it moved — false when a kind's `cardResources` threw (handed to `threw`). */
|
|
1117
|
+
rebind(threw) {
|
|
1118
|
+
const resourcesOf = (name, pass) => {
|
|
1119
|
+
if (threw === void 0) return pass.cardResources?.();
|
|
1120
|
+
try {
|
|
1121
|
+
return pass.cardResources?.();
|
|
1122
|
+
} catch (err) {
|
|
1123
|
+
threw(name, err);
|
|
1124
|
+
return null;
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1106
1127
|
const over = this.boundOver;
|
|
1107
1128
|
let stale = this.group === null || over[0] !== this.mat.assetVersion || over[1] !== this.bufferVersion;
|
|
1108
1129
|
let i = 2;
|
|
1109
|
-
for (const pass of this.kinds
|
|
1110
|
-
const
|
|
1111
|
-
if (
|
|
1130
|
+
for (const [name, pass] of this.kinds) {
|
|
1131
|
+
const r = resourcesOf(name, pass);
|
|
1132
|
+
if (r === null) return false;
|
|
1133
|
+
if (over[i] !== (r?.version ?? -1)) stale = true;
|
|
1112
1134
|
i++;
|
|
1113
1135
|
}
|
|
1114
|
-
if (!stale) return;
|
|
1136
|
+
if (!stale) return true;
|
|
1115
1137
|
const resources = [this.mat.view, this.mat.silhouette, this.mat.noiseTexture.createView(), this.buffer];
|
|
1116
1138
|
const versions = [this.mat.assetVersion, this.bufferVersion];
|
|
1117
1139
|
for (const [name, pass] of this.kinds) {
|
|
1118
|
-
const r = pass
|
|
1140
|
+
const r = resourcesOf(name, pass);
|
|
1141
|
+
if (r === null) return false;
|
|
1119
1142
|
if (r === void 0) throw new Error(`card: kind "${name}" declares a card material but its pass hands no resources`);
|
|
1120
1143
|
resources.push(...r.resources);
|
|
1121
1144
|
versions.push(r.version);
|
|
1122
1145
|
}
|
|
1123
1146
|
this.group = bindGroup(this.device, this.shared.layout, resources, "card/flat");
|
|
1124
1147
|
this.boundOver = versions;
|
|
1148
|
+
return true;
|
|
1125
1149
|
}
|
|
1126
1150
|
/** Cards [first, end) of this frame's list — interleaved objects of every material kind — as ONE instanced draw. */
|
|
1127
1151
|
drawRange(pass, first, end) {
|
|
@@ -1140,6 +1164,60 @@ var CardPass = class _CardPass {
|
|
|
1140
1164
|
}
|
|
1141
1165
|
};
|
|
1142
1166
|
|
|
1167
|
+
// ../desk/src/encoder-guard.ts
|
|
1168
|
+
var guards = /* @__PURE__ */ new WeakMap();
|
|
1169
|
+
function guardEncoder(encoder) {
|
|
1170
|
+
const had = guards.get(encoder);
|
|
1171
|
+
if (had !== void 0) return had;
|
|
1172
|
+
let depth = 0;
|
|
1173
|
+
let open = null;
|
|
1174
|
+
let passDepth = 0;
|
|
1175
|
+
const watch = (pass) => {
|
|
1176
|
+
const { end, pushDebugGroup: pushDebugGroup2, popDebugGroup: popDebugGroup2 } = pass;
|
|
1177
|
+
pass.end = () => {
|
|
1178
|
+
if (open === pass) open = null;
|
|
1179
|
+
return end.call(pass);
|
|
1180
|
+
};
|
|
1181
|
+
pass.pushDebugGroup = (label) => {
|
|
1182
|
+
if (open === pass) passDepth += 1;
|
|
1183
|
+
return pushDebugGroup2.call(pass, label);
|
|
1184
|
+
};
|
|
1185
|
+
pass.popDebugGroup = () => {
|
|
1186
|
+
if (open === pass && passDepth > 0) passDepth -= 1;
|
|
1187
|
+
return popDebugGroup2.call(pass);
|
|
1188
|
+
};
|
|
1189
|
+
open = pass;
|
|
1190
|
+
passDepth = 0;
|
|
1191
|
+
return pass;
|
|
1192
|
+
};
|
|
1193
|
+
const { beginRenderPass, beginComputePass, pushDebugGroup, popDebugGroup } = encoder;
|
|
1194
|
+
encoder.beginRenderPass = (d) => watch(beginRenderPass.call(encoder, d));
|
|
1195
|
+
if (typeof beginComputePass === "function") encoder.beginComputePass = (d) => watch(beginComputePass.call(encoder, d));
|
|
1196
|
+
if (typeof pushDebugGroup === "function") encoder.pushDebugGroup = (label) => {
|
|
1197
|
+
depth += 1;
|
|
1198
|
+
return pushDebugGroup.call(encoder, label);
|
|
1199
|
+
};
|
|
1200
|
+
if (typeof popDebugGroup === "function") encoder.popDebugGroup = () => {
|
|
1201
|
+
if (depth > 0) depth -= 1;
|
|
1202
|
+
return popDebugGroup.call(encoder);
|
|
1203
|
+
};
|
|
1204
|
+
const guard = {
|
|
1205
|
+
mark: () => ({ depth, open, passDepth }),
|
|
1206
|
+
unwind(m) {
|
|
1207
|
+
const left = open;
|
|
1208
|
+
if (left !== null && left !== m.open) {
|
|
1209
|
+
for (let n = passDepth; n > 0; n--) left.popDebugGroup();
|
|
1210
|
+
left.end();
|
|
1211
|
+
} else if (left !== null) {
|
|
1212
|
+
for (let n = passDepth - m.passDepth; n > 0; n--) left.popDebugGroup();
|
|
1213
|
+
}
|
|
1214
|
+
if (open === null) for (let n = depth - m.depth; n > 0; n--) encoder.popDebugGroup();
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
guards.set(encoder, guard);
|
|
1218
|
+
return guard;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1143
1221
|
// ../desk/src/missing/slots.ts
|
|
1144
1222
|
function swapToMissing(s, name, faces) {
|
|
1145
1223
|
const k = s.kinds.get(name);
|
|
@@ -1147,6 +1225,16 @@ function swapToMissing(s, name, faces) {
|
|
|
1147
1225
|
s.kinds.set(name, { name, stratum: k.stratum, pass: faces.spawn(s.mat) });
|
|
1148
1226
|
return k.pass;
|
|
1149
1227
|
}
|
|
1228
|
+
function spawnInside(root, k, mat) {
|
|
1229
|
+
const b = root.boundary;
|
|
1230
|
+
if (b === void 0 || root.missing === void 0 || k.name === MISSING_KIND) return k.pass.spawn(mat);
|
|
1231
|
+
try {
|
|
1232
|
+
return k.pass.spawn(mat);
|
|
1233
|
+
} catch (err) {
|
|
1234
|
+
b.threw(k.name, "spawn", err);
|
|
1235
|
+
return root.missing.spawn(mat);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1150
1238
|
|
|
1151
1239
|
// ../desk/src/hold/focus.ts
|
|
1152
1240
|
var HoldUniformsStruct = defineStruct("HoldUniforms", [
|
|
@@ -2410,7 +2498,7 @@ var TraySlots = class {
|
|
|
2410
2498
|
const own = this.root.kinds.get(kind);
|
|
2411
2499
|
if (own === void 0 || own.composite === true) return void 0;
|
|
2412
2500
|
const mat = this.root.mat.spawn();
|
|
2413
|
-
const slot = { mat, kinds: /* @__PURE__ */ new Map([[kind, { ...own, pass: own
|
|
2501
|
+
const slot = { mat, kinds: /* @__PURE__ */ new Map([[kind, { ...own, pass: spawnInside(this.root, own, mat) }]]) };
|
|
2414
2502
|
this.slots.set(type, slot);
|
|
2415
2503
|
return slot;
|
|
2416
2504
|
}
|
|
@@ -2457,12 +2545,38 @@ var TraySlots = class {
|
|
|
2457
2545
|
* — the notebook's and the calendar's layers, a few seconds after the drawer shuts); asked every tick, drawing or not.
|
|
2458
2546
|
*/
|
|
2459
2547
|
idle(ms = LAYER_IDLE_MS) {
|
|
2460
|
-
|
|
2548
|
+
const b = this.root.boundary;
|
|
2549
|
+
for (const s of this.slots.values()) {
|
|
2550
|
+
for (const k of s.kinds.values()) {
|
|
2551
|
+
if (b === void 0) {
|
|
2552
|
+
k.pass.idle?.(ms);
|
|
2553
|
+
continue;
|
|
2554
|
+
}
|
|
2555
|
+
try {
|
|
2556
|
+
k.pass.idle?.(ms);
|
|
2557
|
+
} catch (err) {
|
|
2558
|
+
b.threw(k.name, "idle", err);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2461
2562
|
}
|
|
2462
2563
|
/** When `idle` next lets a layer go — the soonest slot's (K7a: the host's registered time wake); ∞ — nothing to let go. */
|
|
2463
2564
|
idleAt(ms = LAYER_IDLE_MS) {
|
|
2565
|
+
const b = this.root.boundary;
|
|
2464
2566
|
let t = Number.POSITIVE_INFINITY;
|
|
2465
|
-
for (const s of this.slots.values())
|
|
2567
|
+
for (const s of this.slots.values()) {
|
|
2568
|
+
for (const k of s.kinds.values()) {
|
|
2569
|
+
if (b === void 0) {
|
|
2570
|
+
t = Math.min(t, k.pass.idleAt?.(ms) ?? Number.POSITIVE_INFINITY);
|
|
2571
|
+
continue;
|
|
2572
|
+
}
|
|
2573
|
+
try {
|
|
2574
|
+
t = Math.min(t, k.pass.idleAt?.(ms) ?? Number.POSITIVE_INFINITY);
|
|
2575
|
+
} catch (err) {
|
|
2576
|
+
b.threw(k.name, "idleAt", err);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2466
2580
|
return t;
|
|
2467
2581
|
}
|
|
2468
2582
|
/**
|
|
@@ -2734,6 +2848,14 @@ var TrayPass = class _TrayPass {
|
|
|
2734
2848
|
};
|
|
2735
2849
|
|
|
2736
2850
|
// ../desk/src/ground.ts
|
|
2851
|
+
function closeScope(b, kinds) {
|
|
2852
|
+
b.device.popErrorScope().then((e) => {
|
|
2853
|
+
if (e === null) return;
|
|
2854
|
+
if (kinds.length === 1) b.gpu(kinds[0], e);
|
|
2855
|
+
else b.gpuIn(kinds, e);
|
|
2856
|
+
}, () => {
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2737
2859
|
var visible = (p) => (p?.opacity ?? 1) > 0;
|
|
2738
2860
|
function checkPrograms(programs) {
|
|
2739
2861
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -2867,7 +2989,7 @@ var SlotPool = class {
|
|
|
2867
2989
|
if (this.used === this.slots.length) {
|
|
2868
2990
|
const mat = this.root.mat.spawn();
|
|
2869
2991
|
const kinds = /* @__PURE__ */ new Map();
|
|
2870
|
-
for (const k of this.root.kinds.values()) kinds.set(k.name, { name: k.name, stratum: k.stratum, pass: k
|
|
2992
|
+
for (const k of this.root.kinds.values()) kinds.set(k.name, { name: k.name, stratum: k.stratum, pass: spawnInside(this.root, k, mat), ...k.composite ? { composite: true } : {} });
|
|
2871
2993
|
const card = this.root.card?.spawn(mat, kinds);
|
|
2872
2994
|
if (card !== void 0 && !this.cardOn) card.on = false;
|
|
2873
2995
|
this.slots.push(card === void 0 ? { mat, kinds } : { mat, kinds, card });
|
|
@@ -2912,10 +3034,46 @@ function drawSlot(pass, size, dpr, slot) {
|
|
|
2912
3034
|
const inside = (child) => {
|
|
2913
3035
|
if (drawSlot(pass, size, dpr, child)) pass.setScissorRect(x, y, w, h);
|
|
2914
3036
|
};
|
|
3037
|
+
const boundary = slot.boundary;
|
|
3038
|
+
const skip = slot.skip;
|
|
3039
|
+
const guard = slot.guard;
|
|
3040
|
+
const threw = (kind, call, err, mark) => {
|
|
3041
|
+
if (mark !== void 0) guard?.unwind(mark);
|
|
3042
|
+
boundary?.threw(kind, call, err);
|
|
3043
|
+
skip?.add(kind);
|
|
3044
|
+
pass.setScissorRect(x, y, w, h);
|
|
3045
|
+
pass.setViewport(0, 0, size.w, size.h, 0, 1);
|
|
3046
|
+
};
|
|
3047
|
+
const draw = (p, kind, first, end) => {
|
|
3048
|
+
if (boundary === void 0 || skip === void 0 || kind === void 0 || kind === MISSING_KIND) {
|
|
3049
|
+
p.drawRange(pass, first, end);
|
|
3050
|
+
return;
|
|
3051
|
+
}
|
|
3052
|
+
const mark = guard?.mark();
|
|
3053
|
+
try {
|
|
3054
|
+
p.drawRange(pass, first, end);
|
|
3055
|
+
} catch (err) {
|
|
3056
|
+
threw(kind, "drawRange", err, mark);
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
const over = (k, index) => {
|
|
3060
|
+
if (k.pass.drawOver === void 0 || skip?.has(k.name) === true) return;
|
|
3061
|
+
if (boundary === void 0 || skip === void 0 || k.name === MISSING_KIND) {
|
|
3062
|
+
k.pass.drawOver(pass, index);
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3065
|
+
const mark = guard?.mark();
|
|
3066
|
+
try {
|
|
3067
|
+
k.pass.drawOver(pass, index);
|
|
3068
|
+
} catch (err) {
|
|
3069
|
+
threw(k.name, "drawOver", err, mark);
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
2915
3072
|
const next = /* @__PURE__ */ new Map();
|
|
2916
3073
|
const card = slot.card;
|
|
2917
3074
|
for (const stratum of STRATA) {
|
|
2918
3075
|
let run;
|
|
3076
|
+
let runKind;
|
|
2919
3077
|
let first = 0;
|
|
2920
3078
|
let end = 0;
|
|
2921
3079
|
for (let i = 0; i < objects.length; i++) {
|
|
@@ -2924,29 +3082,39 @@ function drawSlot(pass, size, dpr, slot) {
|
|
|
2924
3082
|
const index = next.get(k.name) ?? 0;
|
|
2925
3083
|
next.set(k.name, index + 1);
|
|
2926
3084
|
if (k.composite) continue;
|
|
3085
|
+
if (skip?.has(k.name) === true) {
|
|
3086
|
+
const children2 = insides.get(i);
|
|
3087
|
+
if (!children2) continue;
|
|
3088
|
+
if (run !== void 0) draw(run, runKind, first, end);
|
|
3089
|
+
run = void 0;
|
|
3090
|
+
for (const child of children2) inside(child);
|
|
3091
|
+
insides.delete(i);
|
|
3092
|
+
continue;
|
|
3093
|
+
}
|
|
2927
3094
|
const c = card === void 0 ? -1 : card.route[i];
|
|
2928
3095
|
const p = c >= 0 ? card.pass : k.pass;
|
|
2929
3096
|
const at2 = c >= 0 ? c : index;
|
|
2930
3097
|
if (p !== run) {
|
|
2931
|
-
run
|
|
3098
|
+
if (run !== void 0) draw(run, runKind, first, end);
|
|
2932
3099
|
run = p;
|
|
3100
|
+
runKind = c >= 0 ? void 0 : k.name;
|
|
2933
3101
|
first = at2;
|
|
2934
3102
|
}
|
|
2935
3103
|
end = at2 + 1;
|
|
2936
3104
|
const children = insides.get(i);
|
|
2937
3105
|
if (!children) continue;
|
|
2938
|
-
p
|
|
3106
|
+
draw(p, runKind, first, end);
|
|
2939
3107
|
run = void 0;
|
|
2940
3108
|
for (const child of children) {
|
|
2941
3109
|
inside(child);
|
|
2942
|
-
k
|
|
3110
|
+
over(k, index);
|
|
2943
3111
|
}
|
|
2944
3112
|
insides.delete(i);
|
|
2945
3113
|
}
|
|
2946
|
-
run
|
|
3114
|
+
if (run !== void 0) draw(run, runKind, first, end);
|
|
2947
3115
|
for (const k of slot.kinds.values()) {
|
|
2948
|
-
const count = k.composite && k.stratum === stratum ? next.get(k.name) ?? 0 : 0;
|
|
2949
|
-
if (count > 0) k.pass.
|
|
3116
|
+
const count = k.composite && k.stratum === stratum && skip?.has(k.name) !== true ? next.get(k.name) ?? 0 : 0;
|
|
3117
|
+
if (count > 0) draw(k.pass, k.name, 0, count);
|
|
2950
3118
|
}
|
|
2951
3119
|
}
|
|
2952
3120
|
for (const children of insides.values()) for (const child of children) inside(child);
|
|
@@ -2976,6 +3144,7 @@ var objectsOf = (p) => p?.objects === void 0 ? p : { ...p, opacity: p.opacity *
|
|
|
2976
3144
|
var liveOf = (p) => p ? p.opacity * (p.objects ?? 1) : 1;
|
|
2977
3145
|
function prepareFrame(encoder, root, pool, inputs, grid = DEFAULT_GRID, target, traySlots) {
|
|
2978
3146
|
pool.reset();
|
|
3147
|
+
const guard = root.boundary !== void 0 ? guardEncoder(encoder) : void 0;
|
|
2979
3148
|
root.mat.newFrame();
|
|
2980
3149
|
const theme = inputs.theme;
|
|
2981
3150
|
let portals = 0;
|
|
@@ -3038,19 +3207,48 @@ function prepareFrame(encoder, root, pool, inputs, grid = DEFAULT_GRID, target,
|
|
|
3038
3207
|
}
|
|
3039
3208
|
const slot = { view: inp.view, fadeIn: g.fadeIn, cfg: g.mat, frame: inp.mat, present: objectsOf(inp.present), light: theme.matLight, lit, select: theme.select, theme, ...target !== void 0 ? { target } : {} };
|
|
3040
3209
|
const drawn = [];
|
|
3041
|
-
|
|
3042
|
-
const list = records.get(k.name) ?? [];
|
|
3043
|
-
if (list.length === 0) {
|
|
3044
|
-
if (k.name !== MISSING_KIND) drawn.push([k.name, 0]);
|
|
3045
|
-
continue;
|
|
3046
|
-
}
|
|
3210
|
+
const ask = (k, list, extra) => {
|
|
3047
3211
|
const own = root.kinds.get(k.name);
|
|
3048
3212
|
if (own && k.pass !== own.pass) k.pass.tune?.(own.pass);
|
|
3049
|
-
const
|
|
3050
|
-
const ks = keys.get(k.name);
|
|
3051
|
-
drawn.push([k.name, k.pass.prepare(encoder, slot, list, { live: (i) => told?.get(i) ?? -1, ...ks !== null && ks !== void 0 ? { keys: ks } : {} })]);
|
|
3213
|
+
const n = k.pass.prepare(encoder, slot, list, extra);
|
|
3052
3214
|
const turned = k.pass.dropped?.() ?? 0;
|
|
3053
3215
|
if (turned > 0) dropped[k.name] = (dropped[k.name] ?? 0) + turned;
|
|
3216
|
+
return n;
|
|
3217
|
+
};
|
|
3218
|
+
const boundary = root.boundary;
|
|
3219
|
+
const skip = /* @__PURE__ */ new Set();
|
|
3220
|
+
const scopes = boundary !== void 0 && watched(boundary.device) ? boundary.scopes : "off";
|
|
3221
|
+
const asked = [];
|
|
3222
|
+
try {
|
|
3223
|
+
for (const k of s.kinds.values()) {
|
|
3224
|
+
const list = records.get(k.name) ?? [];
|
|
3225
|
+
if (list.length === 0) {
|
|
3226
|
+
if (k.name !== MISSING_KIND) drawn.push([k.name, 0]);
|
|
3227
|
+
continue;
|
|
3228
|
+
}
|
|
3229
|
+
const told = live.get(k.name);
|
|
3230
|
+
const ks = keys.get(k.name);
|
|
3231
|
+
const extra = { live: (i) => told?.get(i) ?? -1, ...ks !== null && ks !== void 0 ? { keys: ks } : {} };
|
|
3232
|
+
if (boundary === void 0 || k.name === MISSING_KIND) {
|
|
3233
|
+
drawn.push([k.name, ask(k, list, extra)]);
|
|
3234
|
+
continue;
|
|
3235
|
+
}
|
|
3236
|
+
if (scopes === "kind" || scopes === "slot" && asked.length === 0) boundary.device.pushErrorScope("validation");
|
|
3237
|
+
asked.push(k.name);
|
|
3238
|
+
const mark = guard?.mark();
|
|
3239
|
+
try {
|
|
3240
|
+
drawn.push([k.name, ask(k, list, extra)]);
|
|
3241
|
+
} catch (err) {
|
|
3242
|
+
if (mark !== void 0) guard?.unwind(mark);
|
|
3243
|
+
boundary.threw(k.name, "prepare", err);
|
|
3244
|
+
skip.add(k.name);
|
|
3245
|
+
drawn.push([k.name, 0]);
|
|
3246
|
+
} finally {
|
|
3247
|
+
if (scopes === "kind") closeScope(boundary, [k.name]);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
} finally {
|
|
3251
|
+
if (scopes === "slot" && asked.length > 0) closeScope(boundary, asked);
|
|
3054
3252
|
}
|
|
3055
3253
|
if (s === root) rootDrawn = drawn;
|
|
3056
3254
|
let card;
|
|
@@ -3064,18 +3262,31 @@ function prepareFrame(encoder, root, pool, inputs, grid = DEFAULT_GRID, target,
|
|
|
3064
3262
|
const m = s.card.materialOf(o.kind);
|
|
3065
3263
|
if (m === void 0) continue;
|
|
3066
3264
|
const at2 = indexOf[i];
|
|
3067
|
-
if (live.get(o.kind)?.has(at2) === true) continue;
|
|
3068
|
-
|
|
3265
|
+
if (live.get(o.kind)?.has(at2) === true || skip.has(o.kind)) continue;
|
|
3266
|
+
let cs = -1;
|
|
3267
|
+
if (boundary === void 0) cs = k.pass.cardSlot?.(at2) ?? -1;
|
|
3268
|
+
else try {
|
|
3269
|
+
cs = k.pass.cardSlot?.(at2) ?? -1;
|
|
3270
|
+
} catch (err) {
|
|
3271
|
+
boundary.threw(o.kind, "cardSlot", err);
|
|
3272
|
+
skip.add(o.kind);
|
|
3273
|
+
continue;
|
|
3274
|
+
}
|
|
3069
3275
|
if (cs >= 0) route[i] = s.card.push(m, cs);
|
|
3070
3276
|
}
|
|
3071
3277
|
}
|
|
3072
|
-
|
|
3278
|
+
const cards = boundary === void 0 ? s.card.prepare(slot) : s.card.prepare(slot, (kind, err) => {
|
|
3279
|
+
boundary.threw(kind, "cardResources", err);
|
|
3280
|
+
skip.add(kind);
|
|
3281
|
+
});
|
|
3282
|
+
if (cards > 0) card = { pass: s.card, route };
|
|
3073
3283
|
}
|
|
3074
3284
|
return {
|
|
3075
3285
|
mat: s.mat,
|
|
3076
3286
|
present: inp.present,
|
|
3077
3287
|
stats: gridStats(inp.view, wind),
|
|
3078
3288
|
kinds: s.kinds,
|
|
3289
|
+
...boundary !== void 0 ? { boundary, skip, guard } : {},
|
|
3079
3290
|
...card !== void 0 ? { card } : {},
|
|
3080
3291
|
...inp.underlays?.length ? { underlays: inp.underlays } : {},
|
|
3081
3292
|
...objects.length ? { objects } : {},
|
|
@@ -3225,7 +3436,8 @@ var Ground = class _Ground {
|
|
|
3225
3436
|
opts.hold === void 0 ? null : HoldPass.create(opts.device, surf.format, opts.hold),
|
|
3226
3437
|
opts.tray === void 0 ? null : TrayPass.create(opts.device, surf.format, opts.tray, mat)
|
|
3227
3438
|
]);
|
|
3228
|
-
|
|
3439
|
+
const root = slotSetOf(opts.device, mat, opts.kinds, made, missingFaces(opts.device, surf.format, mat), cards);
|
|
3440
|
+
return new _Ground(opts.device, surf, opts.boundary !== void 0 ? { ...root, boundary: opts.boundary } : root, marks, hold, tray, opts.kinds);
|
|
3229
3441
|
}
|
|
3230
3442
|
/**
|
|
3231
3443
|
* The root's pass of the kind registered as `name` (undefined if none, or MISSING — petition I24: nothing of a missing kind is reached
|
|
@@ -3279,7 +3491,18 @@ var Ground = class _Ground {
|
|
|
3279
3491
|
if (held !== void 0 && held.e > 0 && this.hold !== null) return this.said(renderHeldFrame(this.device, this.hold, this.root, this.pool, this.grid, this.surface, inputs, held, this.heldCache));
|
|
3280
3492
|
if (this.heldCache.stamp !== null) {
|
|
3281
3493
|
this.heldCache.stamp = null;
|
|
3282
|
-
|
|
3494
|
+
const b = this.root.boundary;
|
|
3495
|
+
for (const k of this.root.kinds.values()) {
|
|
3496
|
+
if (b === void 0) {
|
|
3497
|
+
k.pass.endHold?.();
|
|
3498
|
+
continue;
|
|
3499
|
+
}
|
|
3500
|
+
try {
|
|
3501
|
+
k.pass.endHold?.();
|
|
3502
|
+
} catch (err) {
|
|
3503
|
+
b.threw(k.name, "endHold", err);
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3283
3506
|
}
|
|
3284
3507
|
const encoder = this.device.createCommandEncoder({ label: "ground" });
|
|
3285
3508
|
const { stats } = encodeFrame(encoder, this, inputs, this.surface);
|
|
@@ -3953,6 +4176,9 @@ function defineObject(def) {
|
|
|
3953
4176
|
// …and its held bar's tools ride the widget type (D3t-a), so the keymap and the bar reach them through the engine
|
|
3954
4177
|
...kind.open?.tools !== void 0 ? { heldTools: kind.open.tools } : {},
|
|
3955
4178
|
...kind.open?.tool !== void 0 ? { heldTool: kind.open.tool } : {},
|
|
4179
|
+
// …and who owns the wheel and Escape in hand (design-019 §5, M24 LT2): core's held input and the keymap read them off the type
|
|
4180
|
+
...kind.open?.wheel !== void 0 ? { heldWheel: kind.open.wheel } : {},
|
|
4181
|
+
...kind.open?.escape !== void 0 ? { heldEscape: kind.open.escape } : {},
|
|
3956
4182
|
...size !== void 0 ? { defaultSize: size } : {},
|
|
3957
4183
|
...container !== void 0 ? { container } : {}
|
|
3958
4184
|
});
|
|
@@ -4029,7 +4255,17 @@ function createDeskBuilder(world, opts) {
|
|
|
4029
4255
|
const locals = opts.locals;
|
|
4030
4256
|
const faults = opts.faults;
|
|
4031
4257
|
const forget = (kind, e) => {
|
|
4032
|
-
locals?.get(kind.name)
|
|
4258
|
+
const local = locals?.get(kind.name);
|
|
4259
|
+
if (local?.forget === void 0) return;
|
|
4260
|
+
if (faults === void 0) {
|
|
4261
|
+
local.forget(e);
|
|
4262
|
+
return;
|
|
4263
|
+
}
|
|
4264
|
+
try {
|
|
4265
|
+
local.forget(e);
|
|
4266
|
+
} catch (err) {
|
|
4267
|
+
faults.strike(kind.name, "forget", err, e);
|
|
4268
|
+
}
|
|
4033
4269
|
};
|
|
4034
4270
|
const drawerOf = (kind) => kind === MISSING_OBJECT || faults?.missing(kind.name) === true ? MISSING_OBJECT : kind;
|
|
4035
4271
|
const fault = (kind, call, err, e) => {
|
|
@@ -5294,7 +5530,7 @@ function createRasterBudget(cap, floor = Math.floor(cap * BUDGET_FLOOR)) {
|
|
|
5294
5530
|
}
|
|
5295
5531
|
return bytes;
|
|
5296
5532
|
},
|
|
5297
|
-
trim(keep2) {
|
|
5533
|
+
trim(keep2, threw) {
|
|
5298
5534
|
const limit = room();
|
|
5299
5535
|
if (cached <= limit) return 0;
|
|
5300
5536
|
const order = [...entries.entries()].filter(([, e]) => !e.resident && (keep2 === void 0 || !keep2(e.owner, e.key))).sort((a, b) => a[1].used - b[1].used);
|
|
@@ -5304,7 +5540,12 @@ function createRasterBudget(cap, floor = Math.floor(cap * BUDGET_FLOOR)) {
|
|
|
5304
5540
|
drop(k, ent);
|
|
5305
5541
|
freed += ent.bytes;
|
|
5306
5542
|
evictions += 1;
|
|
5307
|
-
ent.evict();
|
|
5543
|
+
if (threw === void 0) ent.evict();
|
|
5544
|
+
else try {
|
|
5545
|
+
ent.evict();
|
|
5546
|
+
} catch (err) {
|
|
5547
|
+
threw(ent.owner, err);
|
|
5548
|
+
}
|
|
5308
5549
|
}
|
|
5309
5550
|
return freed;
|
|
5310
5551
|
},
|
|
@@ -5594,6 +5835,18 @@ function createDeskReflector(opts) {
|
|
|
5594
5835
|
let drawnCarried = [];
|
|
5595
5836
|
let trayDrawn = /* @__PURE__ */ new Set();
|
|
5596
5837
|
const faced = /* @__PURE__ */ new Map();
|
|
5838
|
+
const letGo2 = (key, f) => {
|
|
5839
|
+
if (f.local.forget === void 0) return;
|
|
5840
|
+
if (faults === void 0) {
|
|
5841
|
+
f.local.forget(key);
|
|
5842
|
+
return;
|
|
5843
|
+
}
|
|
5844
|
+
try {
|
|
5845
|
+
f.local.forget(key);
|
|
5846
|
+
} catch (err) {
|
|
5847
|
+
faults.strike(f.kind, "forget", err, key > 0 ? key : void 0);
|
|
5848
|
+
}
|
|
5849
|
+
};
|
|
5597
5850
|
let trayShownAt = Number.NEGATIVE_INFINITY;
|
|
5598
5851
|
let trayFocusSeen = "";
|
|
5599
5852
|
let facedAt = Number.POSITIVE_INFINITY;
|
|
@@ -5689,8 +5942,8 @@ function createDeskReflector(opts) {
|
|
|
5689
5942
|
const showing = pinned !== null ? pinned.hidden !== true && (pinned.p ?? 1) > 0 : tf?.open === true || (tray.frame()?.p ?? 0) > 0;
|
|
5690
5943
|
if (showing) trayShownAt = now;
|
|
5691
5944
|
else if (faced.size > 0 && now - trayShownAt > LAYER_IDLE_MS) {
|
|
5692
|
-
for (const [key,
|
|
5693
|
-
|
|
5945
|
+
for (const [key, f] of faced) if (key > 0) {
|
|
5946
|
+
letGo2(key, f);
|
|
5694
5947
|
faced.delete(key);
|
|
5695
5948
|
}
|
|
5696
5949
|
}
|
|
@@ -5726,7 +5979,7 @@ function createDeskReflector(opts) {
|
|
|
5726
5979
|
const specimens = readSpecimens(w, te, opts.locals, kindOn);
|
|
5727
5980
|
if (specimens.length > 0) {
|
|
5728
5981
|
ground.warmTray(specimens.map((q) => [q.type, q.kind.name]), trayLanded);
|
|
5729
|
-
for (const q of specimens) if (q.local !== void 0) faced.set(q.key, q.local);
|
|
5982
|
+
for (const q of specimens) if (q.local !== void 0) faced.set(q.key, { kind: q.kind.name, local: q.local });
|
|
5730
5983
|
drawnSpecimens = specimenFrames(specimens, { rect: drawerRect(vp.w, vp.h, trayed.p), scroll: trayed.scroll, ...trayed.foot !== void 0 ? { foot: trayed.foot } : {} }, { view: { width: vp.w, height: vp.h, dpr }, theme, grid, looks, lift: (t) => tray.lift(t), ...faults !== void 0 ? { faults } : {} });
|
|
5731
5984
|
trayed = { ...trayed, specimens: drawnSpecimens };
|
|
5732
5985
|
}
|
|
@@ -5781,7 +6034,7 @@ function createDeskReflector(opts) {
|
|
|
5781
6034
|
const cx = cam.x + pose.px / cam.zoom - (pose.u - 0.5) * n.w;
|
|
5782
6035
|
const cy = cam.y + pose.py / cam.zoom - (pose.v - 0.5) * n.h;
|
|
5783
6036
|
const key = -(1073741824 + pose.id);
|
|
5784
|
-
if (copyLocal !== void 0) faced.set(key, copyLocal);
|
|
6037
|
+
if (copyLocal !== void 0) faced.set(key, { kind: kind.name, local: copyLocal });
|
|
5785
6038
|
const frame = carriedFrame(pose, { kind, rect: { x: -n.w / 2, y: -n.h / 2, w: n.w, h: n.h }, props: takenProps(widget), key, lamp: { x: L.x - cx, y: L.y - cy, h: L.h }, ...copyLocal !== void 0 ? { local: copyLocal } : {} }, env);
|
|
5786
6039
|
if (frame !== void 0) made.push(frame);
|
|
5787
6040
|
}
|
|
@@ -5793,10 +6046,10 @@ function createDeskReflector(opts) {
|
|
|
5793
6046
|
if (made.length > 0) trayed = { ...trayed, carried: made };
|
|
5794
6047
|
}
|
|
5795
6048
|
trayDrawn = /* @__PURE__ */ new Set([...drawnSpecimens.map((f) => f.key), ...drawnCarried.map((f) => f.key)]);
|
|
5796
|
-
for (const [key,
|
|
6049
|
+
for (const [key, f] of faced) {
|
|
5797
6050
|
const gone = key < 0 ? !poses.some((q) => q.ghost === void 0 && -(1073741824 + q.id) === key) : !w.isAlive(key);
|
|
5798
6051
|
if (gone) {
|
|
5799
|
-
|
|
6052
|
+
letGo2(key, f);
|
|
5800
6053
|
faced.delete(key);
|
|
5801
6054
|
}
|
|
5802
6055
|
}
|
|
@@ -6061,6 +6314,8 @@ function createDeskEditor(opts) {
|
|
|
6061
6314
|
let lent;
|
|
6062
6315
|
let idle;
|
|
6063
6316
|
let composing = false;
|
|
6317
|
+
let compStart = 0;
|
|
6318
|
+
let compText = "";
|
|
6064
6319
|
let down = null;
|
|
6065
6320
|
let lastTransform = "";
|
|
6066
6321
|
let lastBox = "";
|
|
@@ -6147,6 +6402,12 @@ function createDeskEditor(opts) {
|
|
|
6147
6402
|
const onInput = () => {
|
|
6148
6403
|
const l = lent;
|
|
6149
6404
|
if (l === void 0) return;
|
|
6405
|
+
if (composing && l.compose !== void 0) {
|
|
6406
|
+
l.compose(compText, Math.min(Math.max(el.selectionEnd - compStart, 0), compText.length));
|
|
6407
|
+
arm();
|
|
6408
|
+
opts.wake();
|
|
6409
|
+
return;
|
|
6410
|
+
}
|
|
6150
6411
|
l.input(el.value);
|
|
6151
6412
|
arm();
|
|
6152
6413
|
opts.wake();
|
|
@@ -6164,10 +6425,18 @@ function createDeskEditor(opts) {
|
|
|
6164
6425
|
};
|
|
6165
6426
|
const onCompositionStart = () => {
|
|
6166
6427
|
composing = true;
|
|
6428
|
+
compStart = el.selectionStart;
|
|
6429
|
+
compText = "";
|
|
6430
|
+
lent?.compose?.("", 0);
|
|
6167
6431
|
};
|
|
6168
|
-
const
|
|
6432
|
+
const onCompositionUpdate = (ev) => {
|
|
6433
|
+
compText = ev.data ?? "";
|
|
6434
|
+
};
|
|
6435
|
+
const onCompositionEnd = (ev) => {
|
|
6169
6436
|
composing = false;
|
|
6437
|
+
lent?.commit?.(ev.data ?? "");
|
|
6170
6438
|
arm();
|
|
6439
|
+
opts.wake();
|
|
6171
6440
|
};
|
|
6172
6441
|
const onSelection = () => {
|
|
6173
6442
|
if (doc.activeElement !== el || lent === void 0) return;
|
|
@@ -6178,6 +6447,7 @@ function createDeskEditor(opts) {
|
|
|
6178
6447
|
el.addEventListener("keydown", onKeyDown);
|
|
6179
6448
|
el.addEventListener("blur", onBlur);
|
|
6180
6449
|
el.addEventListener("compositionstart", onCompositionStart);
|
|
6450
|
+
el.addEventListener("compositionupdate", onCompositionUpdate);
|
|
6181
6451
|
el.addEventListener("compositionend", onCompositionEnd);
|
|
6182
6452
|
doc.addEventListener("selectionchange", onSelection);
|
|
6183
6453
|
const onDown = (ev) => {
|
|
@@ -6246,6 +6516,7 @@ function createDeskEditor(opts) {
|
|
|
6246
6516
|
el.removeEventListener("keydown", onKeyDown);
|
|
6247
6517
|
el.removeEventListener("blur", onBlur);
|
|
6248
6518
|
el.removeEventListener("compositionstart", onCompositionStart);
|
|
6519
|
+
el.removeEventListener("compositionupdate", onCompositionUpdate);
|
|
6249
6520
|
el.removeEventListener("compositionend", onCompositionEnd);
|
|
6250
6521
|
doc.removeEventListener("selectionchange", onSelection);
|
|
6251
6522
|
container.removeEventListener("pointerdown", onDown, { capture: true });
|
|
@@ -7134,6 +7405,82 @@ function surface(device, canvas, opts = {}) {
|
|
|
7134
7405
|
};
|
|
7135
7406
|
}
|
|
7136
7407
|
|
|
7408
|
+
// ../desk/src/hold/told.ts
|
|
7409
|
+
var HANDS = /* @__PURE__ */ new Set(["pan", "desk"]);
|
|
7410
|
+
var pointersQ2 = defineQuery([Pointer, LocalPointer, HeldPointer]);
|
|
7411
|
+
function createHeldFold(world) {
|
|
7412
|
+
let holding;
|
|
7413
|
+
const seen = /* @__PURE__ */ new Map();
|
|
7414
|
+
const up = (s) => ({ type: "pointer", phase: "up", x: s.x, y: s.y, part: s.part, button: 0, buttons: 0, count: s.press?.count ?? 1 });
|
|
7415
|
+
return {
|
|
7416
|
+
step() {
|
|
7417
|
+
const out = [];
|
|
7418
|
+
const held = heldEntity(world);
|
|
7419
|
+
if (holding !== void 0 && holding !== held) {
|
|
7420
|
+
const ups = [...seen.values()].filter((s) => s.press?.told === true).map(up);
|
|
7421
|
+
if (ups.length > 0 && world.isAlive(holding)) out.push({ entity: holding, events: ups });
|
|
7422
|
+
seen.clear();
|
|
7423
|
+
}
|
|
7424
|
+
holding = held;
|
|
7425
|
+
if (held === void 0) return out;
|
|
7426
|
+
const events = [];
|
|
7427
|
+
const present = /* @__PURE__ */ new Set();
|
|
7428
|
+
world.query(pointersQ2).each((b) => {
|
|
7429
|
+
for (const r of b) {
|
|
7430
|
+
const p = b.entity(r);
|
|
7431
|
+
present.add(p);
|
|
7432
|
+
const hp = world.read(p, HeldPointer);
|
|
7433
|
+
const part = hp.part === "" ? null : hp.part;
|
|
7434
|
+
const pb = world.get(p, PointerButtons);
|
|
7435
|
+
const raw = pb?.buttons ?? 0;
|
|
7436
|
+
const pr = world.get(p, HeldPress);
|
|
7437
|
+
const wheel = world.get(p, HeldWheel)?.seq ?? 0;
|
|
7438
|
+
const sig = pr === void 0 ? "" : `${pb?.downMs ?? 0}|${pr.x}|${pr.y}|${pr.count}`;
|
|
7439
|
+
let s = seen.get(p);
|
|
7440
|
+
if (s === void 0) {
|
|
7441
|
+
s = { x: Number.NaN, y: Number.NaN, part, buttons: raw, press: void 0, wheel };
|
|
7442
|
+
seen.set(p, s);
|
|
7443
|
+
}
|
|
7444
|
+
const press = s.press;
|
|
7445
|
+
const ended = press !== void 0 && press.sig !== sig;
|
|
7446
|
+
const began = pr !== void 0 && press?.sig !== sig;
|
|
7447
|
+
const pressing = press !== void 0 && !ended ? press : void 0;
|
|
7448
|
+
const told = pressing !== void 0 ? pressing.told : raw === 0;
|
|
7449
|
+
const buttons = pressing?.told === true && raw === 0 ? 1 : raw;
|
|
7450
|
+
if (!ended && !began && told && (hp.x !== s.x || hp.y !== s.y || part !== s.part || buttons !== s.buttons)) {
|
|
7451
|
+
events.push({ type: "pointer", phase: "move", x: hp.x, y: hp.y, part, button: -1, buttons, count: 0 });
|
|
7452
|
+
}
|
|
7453
|
+
if (wheel !== s.wheel) {
|
|
7454
|
+
const w = world.get(p, HeldWheel);
|
|
7455
|
+
if (w !== void 0) events.push({ type: "wheel", x: hp.x, y: hp.y, dx: w.dx, dy: w.dy });
|
|
7456
|
+
s.wheel = wheel;
|
|
7457
|
+
}
|
|
7458
|
+
s.x = hp.x;
|
|
7459
|
+
s.y = hp.y;
|
|
7460
|
+
s.part = part;
|
|
7461
|
+
s.buttons = buttons;
|
|
7462
|
+
if (ended) {
|
|
7463
|
+
if (press.told) events.push(up(s));
|
|
7464
|
+
s.press = void 0;
|
|
7465
|
+
}
|
|
7466
|
+
if (began) {
|
|
7467
|
+
const mine = !HANDS.has(pr.kind);
|
|
7468
|
+
s.press = { sig, told: mine, count: pr.count };
|
|
7469
|
+
if (mine) events.push({ type: "pointer", phase: "down", x: hp.x, y: hp.y, part, button: 0, buttons: raw === 0 ? 1 : raw, count: pr.count });
|
|
7470
|
+
}
|
|
7471
|
+
}
|
|
7472
|
+
});
|
|
7473
|
+
for (const [p, s] of seen) {
|
|
7474
|
+
if (present.has(p)) continue;
|
|
7475
|
+
if (s.press?.told === true) events.push(up(s));
|
|
7476
|
+
seen.delete(p);
|
|
7477
|
+
}
|
|
7478
|
+
if (events.length > 0) out.push({ entity: held, events });
|
|
7479
|
+
return out;
|
|
7480
|
+
}
|
|
7481
|
+
};
|
|
7482
|
+
}
|
|
7483
|
+
|
|
7137
7484
|
// ../desk/src/hold/shaders.ts
|
|
7138
7485
|
var HOLD_SHADER_FILES = {
|
|
7139
7486
|
hold: "hold/hold.wgsl"
|
|
@@ -7187,6 +7534,7 @@ function worldChildren(world) {
|
|
|
7187
7534
|
|
|
7188
7535
|
// ../desk/src/host/layer.ts
|
|
7189
7536
|
var DEFAULT_RASTER_BUDGET = 256 * 1024 * 1024;
|
|
7537
|
+
var KIND_SCOPE_FRAMES = 120;
|
|
7190
7538
|
function kindsOf(types, extra) {
|
|
7191
7539
|
const byName = /* @__PURE__ */ new Map();
|
|
7192
7540
|
const objectKinds = [];
|
|
@@ -7269,6 +7617,15 @@ function deskLayer(opts) {
|
|
|
7269
7617
|
let status = { state: "pending" };
|
|
7270
7618
|
const statusHeard = /* @__PURE__ */ new Set();
|
|
7271
7619
|
const faults = createKindFaults();
|
|
7620
|
+
const unstruck = [];
|
|
7621
|
+
const strikeLater = (kind, call, err) => {
|
|
7622
|
+
unstruck.push({ kind, call, err });
|
|
7623
|
+
};
|
|
7624
|
+
const strikeNow = () => {
|
|
7625
|
+
for (const u of unstruck.splice(0)) faults.strike(u.kind, u.call, u.err);
|
|
7626
|
+
};
|
|
7627
|
+
let renderBoundary;
|
|
7628
|
+
let kindScopesUntil = 0;
|
|
7272
7629
|
const setStatus = (next) => {
|
|
7273
7630
|
const { faults: _was, ...rest } = next;
|
|
7274
7631
|
status = faults.size > 0 ? { ...rest, faults: faults.list() } : rest;
|
|
@@ -7312,13 +7669,37 @@ function deskLayer(opts) {
|
|
|
7312
7669
|
builder.remake(e);
|
|
7313
7670
|
if (compose2.trayShows(e)) compose2.wake("ink");
|
|
7314
7671
|
};
|
|
7672
|
+
let composed = false;
|
|
7673
|
+
const redraw = () => {
|
|
7674
|
+
if (composed) compose2.wake("ink");
|
|
7675
|
+
};
|
|
7676
|
+
const docs = opts.docs ?? NO_DOCS;
|
|
7677
|
+
const keyOf = (e) => docs.current()?.store.keyOf(e);
|
|
7678
|
+
const frames = () => composed ? compose2.redraws() : 0;
|
|
7315
7679
|
for (const k of objectKinds) {
|
|
7316
|
-
const local = k.local?.({ pass: () => ground?.pass(k.name), use: services.use, children, drawn, budget, rasters, remake, wake: () => wakeKind(k.name) });
|
|
7680
|
+
const local = k.local?.({ pass: () => ground?.pass(k.name), use: services.use, children, drawn, budget, rasters, remake, wake: () => wakeKind(k.name), redraw, keyOf, frames });
|
|
7317
7681
|
if (local === void 0) continue;
|
|
7318
7682
|
locals.set(k.name, local);
|
|
7319
7683
|
if (local.tick !== void 0 && local.due === void 0) tellAwake(k.name);
|
|
7320
7684
|
}
|
|
7321
|
-
const
|
|
7685
|
+
const keepsThrew = /* @__PURE__ */ new Set();
|
|
7686
|
+
const evictThrew = /* @__PURE__ */ new Set();
|
|
7687
|
+
const evicted = (owner, err) => {
|
|
7688
|
+
if (evictThrew.has(owner)) return;
|
|
7689
|
+
evictThrew.add(owner);
|
|
7690
|
+
strikeLater(owner, "evict", err);
|
|
7691
|
+
};
|
|
7692
|
+
const keeps = (owner, key) => {
|
|
7693
|
+
const local = locals.get(owner);
|
|
7694
|
+
if (local?.keeps === void 0 || keepsThrew.has(owner)) return false;
|
|
7695
|
+
try {
|
|
7696
|
+
return local.keeps(key);
|
|
7697
|
+
} catch (err) {
|
|
7698
|
+
keepsThrew.add(owner);
|
|
7699
|
+
strikeLater(owner, "keeps", err);
|
|
7700
|
+
return false;
|
|
7701
|
+
}
|
|
7702
|
+
};
|
|
7322
7703
|
const readMarquee = ctx.readMarquee;
|
|
7323
7704
|
const builder = createDeskBuilder(world, { objects: [...types], locals, faults, ...opts.springs !== void 0 ? { springs: opts.springs } : {}, ...readMarquee !== void 0 ? { marquee: readMarquee } : {}, ...ctx.spatial !== void 0 ? { spatial: ctx.spatial } : {}, ...hold.reserves !== void 0 ? { hold: hold.reserves } : {} });
|
|
7324
7705
|
const typeNamed = new Map([...types].map((t) => [t.type, t]));
|
|
@@ -7444,8 +7825,8 @@ function deskLayer(opts) {
|
|
|
7444
7825
|
// a frame asked for outside the flush — a pin, an ink landing, the ground arriving, a theme: a sleeping loop wakes (K7a)
|
|
7445
7826
|
onWake: (reason) => frame?.wake(`desk:${reason}`)
|
|
7446
7827
|
});
|
|
7828
|
+
composed = true;
|
|
7447
7829
|
motionQuery?.addEventListener("change", syncMotion);
|
|
7448
|
-
const docs = opts.docs ?? NO_DOCS;
|
|
7449
7830
|
const drivers = /* @__PURE__ */ new Map();
|
|
7450
7831
|
const driverKinds = /* @__PURE__ */ new Map();
|
|
7451
7832
|
const parked = [];
|
|
@@ -7506,6 +7887,7 @@ function deskLayer(opts) {
|
|
|
7506
7887
|
const kindTicks = {};
|
|
7507
7888
|
const perf = { ticks: 0, ms: 0, frames: 0, frameMs: 0, driverAsks: 0 };
|
|
7508
7889
|
const restless = /* @__PURE__ */ new Set();
|
|
7890
|
+
const told = createHeldFold(world);
|
|
7509
7891
|
const inner = compose2.reflector;
|
|
7510
7892
|
const reflector = {
|
|
7511
7893
|
...inner,
|
|
@@ -7513,16 +7895,34 @@ function deskLayer(opts) {
|
|
|
7513
7895
|
const now = performance.now();
|
|
7514
7896
|
const drawn2 = compose2.redraws();
|
|
7515
7897
|
const timeAlone = frame?.settled() === true && woken.size === 0 && !compose2.dirty();
|
|
7898
|
+
strikeNow();
|
|
7899
|
+
if (renderBoundary?.scopes === "kind" && compose2.redraws() >= kindScopesUntil) renderBoundary.scopes = "slot";
|
|
7516
7900
|
if (!timeAlone) {
|
|
7517
7901
|
following = false;
|
|
7518
|
-
for (const d of drivers
|
|
7902
|
+
for (const [type, d] of drivers) {
|
|
7519
7903
|
perf.driverAsks += 1;
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
d.
|
|
7904
|
+
let call = "idle";
|
|
7905
|
+
try {
|
|
7906
|
+
if (d.idle?.() !== true) {
|
|
7907
|
+
following = true;
|
|
7908
|
+
call = "follow";
|
|
7909
|
+
d.follow(now);
|
|
7910
|
+
}
|
|
7911
|
+
} catch (err) {
|
|
7912
|
+
faults.strike(driverKinds.get(type) ?? type, call, err);
|
|
7523
7913
|
}
|
|
7524
7914
|
}
|
|
7525
7915
|
}
|
|
7916
|
+
for (const { entity, events: events2 } of told.step()) {
|
|
7917
|
+
const k = builder.kindOf(entity);
|
|
7918
|
+
const local = k === void 0 ? void 0 : locals.get(k.name);
|
|
7919
|
+
if (k === void 0 || local?.held === void 0 || faults.missing(k.name)) continue;
|
|
7920
|
+
try {
|
|
7921
|
+
local.held(entity, events2);
|
|
7922
|
+
} catch (err) {
|
|
7923
|
+
faults.strike(k.name, "held", err, entity);
|
|
7924
|
+
}
|
|
7925
|
+
}
|
|
7526
7926
|
let want = false;
|
|
7527
7927
|
restless.clear();
|
|
7528
7928
|
for (const [name, local] of locals) {
|
|
@@ -7548,7 +7948,10 @@ function deskLayer(opts) {
|
|
|
7548
7948
|
moving = want;
|
|
7549
7949
|
inner.flush(w);
|
|
7550
7950
|
editor.follow();
|
|
7551
|
-
|
|
7951
|
+
keepsThrew.clear();
|
|
7952
|
+
evictThrew.clear();
|
|
7953
|
+
budget.trim(keeps, evicted);
|
|
7954
|
+
strikeNow();
|
|
7552
7955
|
const drew = compose2.redraws() !== drawn2;
|
|
7553
7956
|
if (drew) rasters.wake();
|
|
7554
7957
|
if (rasters.size > 0) moving = true;
|
|
@@ -7607,6 +8010,10 @@ function deskLayer(opts) {
|
|
|
7607
8010
|
}
|
|
7608
8011
|
ground?.quarantine(name);
|
|
7609
8012
|
compose2.wake("ink");
|
|
8013
|
+
const h = heldEntity(world);
|
|
8014
|
+
if (h !== void 0 && builder.kindOf(h)?.name === name) queueMicrotask(() => {
|
|
8015
|
+
if (heldEntity(world) === h) ctx.ops?.putDown?.();
|
|
8016
|
+
});
|
|
7610
8017
|
};
|
|
7611
8018
|
faults.subscribe((f) => {
|
|
7612
8019
|
retire(f.kind);
|
|
@@ -7624,7 +8031,19 @@ function deskLayer(opts) {
|
|
|
7624
8031
|
return h !== void 0 && h.entity === e && !h.landing ? h.frame : void 0;
|
|
7625
8032
|
},
|
|
7626
8033
|
// …and which of the kind's parts is under a point of it (D3t-a): its `hit` on the geometry drawn in hand
|
|
7627
|
-
part: (e, x, y) => builder.heldPart(e, x, y)
|
|
8034
|
+
part: (e, x, y) => builder.heldPart(e, x, y),
|
|
8035
|
+
// …and (design-019 §5, M24 LT2) the kind's cursor over one of its named parts — its `open.cursor`, through the kind's boundary
|
|
8036
|
+
cursor: (e, part) => {
|
|
8037
|
+
const k = builder.kindOf(e);
|
|
8038
|
+
const open = k?.open;
|
|
8039
|
+
if (k === void 0 || open?.cursor === void 0 || faults.missing(k.name)) return void 0;
|
|
8040
|
+
try {
|
|
8041
|
+
return open.cursor({ entity: e, part, local: locals.get(k.name) });
|
|
8042
|
+
} catch (err) {
|
|
8043
|
+
faults.strike(k.name, "cursor", err, e);
|
|
8044
|
+
return void 0;
|
|
8045
|
+
}
|
|
8046
|
+
}
|
|
7628
8047
|
};
|
|
7629
8048
|
const heldPose2 = ctx.heldPose;
|
|
7630
8049
|
if (heldPose2 !== void 0) heldPose2.current = poseSource;
|
|
@@ -7668,7 +8087,22 @@ function deskLayer(opts) {
|
|
|
7668
8087
|
if (shared === void 0) ownDevice = g.device;
|
|
7669
8088
|
if (opts.gpuLedger === true) ledger = instrumentMemory(g.device);
|
|
7670
8089
|
opts.onDevice?.(g.device);
|
|
7671
|
-
const
|
|
8090
|
+
const boundary = {
|
|
8091
|
+
threw: strikeLater,
|
|
8092
|
+
scopes: "slot",
|
|
8093
|
+
device: g.device,
|
|
8094
|
+
gpu: (kind, error) => {
|
|
8095
|
+
strikeLater(kind, "prepare", new Error(`a GPU error in its own scope \u2014 ${error.constructor?.name ?? "GPUError"}: ${error.message}`));
|
|
8096
|
+
frame?.wake("desk:gpu");
|
|
8097
|
+
},
|
|
8098
|
+
gpuIn: (names, error) => {
|
|
8099
|
+
console.warn(`[ice] desk: a GPU error in the prepare of one of ${names.map((n) => `"${n}"`).join(", ")} \u2014 each kind's own scope kept for the next ${KIND_SCOPE_FRAMES} frames, a repeat is its strike: ${error.constructor?.name ?? "GPUError"}: ${error.message}`);
|
|
8100
|
+
boundary.scopes = "kind";
|
|
8101
|
+
kindScopesUntil = compose2.redraws() + KIND_SCOPE_FRAMES;
|
|
8102
|
+
}
|
|
8103
|
+
};
|
|
8104
|
+
renderBoundary = boundary;
|
|
8105
|
+
const made = await Ground.create({ device: g.device, surface: surface(g.device, canvas), mat: matShaders(shaderText(MAT_SHADER_FILES)), kinds, marks: marksShaders(shaderText(MARKS_SHADER_FILES)), hold: holdShaders(shaderText(HOLD_SHADER_FILES)), tray: trayShaders(shaderText), boundary, ...events.onError !== void 0 ? { onError: events.onError } : {} });
|
|
7672
8106
|
if (disposed || ended) {
|
|
7673
8107
|
made.dispose();
|
|
7674
8108
|
return;
|
|
@@ -8317,9 +8751,12 @@ async function drawStill(opts, plan) {
|
|
|
8317
8751
|
} }), `the object "${t.type}"`);
|
|
8318
8752
|
}
|
|
8319
8753
|
const children = worldChildren(world);
|
|
8754
|
+
const docs = engine.docs;
|
|
8755
|
+
const keyOf = (e) => docs.current()?.store.keyOf(e);
|
|
8320
8756
|
for (const k of plan.kinds) {
|
|
8321
8757
|
const local = k.local?.({ pass: () => desk.root.kinds.get(k.name)?.pass, use: services.use, children, wake: () => {
|
|
8322
|
-
}
|
|
8758
|
+
}, redraw: () => {
|
|
8759
|
+
}, keyOf });
|
|
8323
8760
|
if (local !== void 0) locals.set(k.name, local);
|
|
8324
8761
|
}
|
|
8325
8762
|
}
|
|
@@ -8475,4 +8912,4 @@ export {
|
|
|
8475
8912
|
STILL_PALETTE,
|
|
8476
8913
|
createStill
|
|
8477
8914
|
};
|
|
8478
|
-
//# sourceMappingURL=chunk-
|
|
8915
|
+
//# sourceMappingURL=chunk-SUNUMQLC.js.map
|