@vibecook/ice 0.15.0 → 0.16.0-portals.2
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-K4SKRVLK.js} +2 -2
- package/dist/chunk-K4SKRVLK.js.map +1 -0
- package/dist/{chunk-A6PUTIL7.js → chunk-KV6RMWG4.js} +142 -8
- package/dist/chunk-KV6RMWG4.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/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/hold/told.d.ts +15 -0
- package/dist/types/packages/desk/src/index.d.ts +1 -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/object.d.ts +1 -1
- package/dist/types/packages/desk/src/still.d.ts +3 -1
- 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
|
@@ -1367,7 +1367,18 @@ var HeldPress = defineComponent("HeldPress", {
|
|
|
1367
1367
|
y: field3("f64", { default: 0 }),
|
|
1368
1368
|
panX0: field3("f64", { default: 0 }),
|
|
1369
1369
|
panY0: field3("f64", { default: 0 }),
|
|
1370
|
-
moved: field3("bool", { default: false })
|
|
1370
|
+
moved: field3("bool", { default: false }),
|
|
1371
|
+
count: field3("u32", { default: 1 })
|
|
1372
|
+
});
|
|
1373
|
+
var HeldPressMemo = defineResource(
|
|
1374
|
+
"HeldPressMemo",
|
|
1375
|
+
{ x: field3("f64", { default: 0 }), y: field3("f64", { default: 0 }), at: field3("f64", { default: 0 }), count: field3("u32", { default: 0 }) },
|
|
1376
|
+
{ durable: false }
|
|
1377
|
+
);
|
|
1378
|
+
var HeldWheel = defineComponent("HeldWheel", {
|
|
1379
|
+
dx: field3("f64", { default: 0 }),
|
|
1380
|
+
dy: field3("f64", { default: 0 }),
|
|
1381
|
+
seq: field3("u32", { default: 0 })
|
|
1371
1382
|
});
|
|
1372
1383
|
var HeldTapMemo = defineResource(
|
|
1373
1384
|
"HeldTapMemo",
|
|
@@ -1730,7 +1741,6 @@ var SnapSource = defineTag("SnapSource");
|
|
|
1730
1741
|
var SnapTarget = defineTag("SnapTarget");
|
|
1731
1742
|
var SweepsContained = defineTag("SweepsContained");
|
|
1732
1743
|
var WheelTurns = defineTag("WheelTurns");
|
|
1733
|
-
var KeyboardExclusive = defineTag("KeyboardExclusive");
|
|
1734
1744
|
var PresencePeer = defineTag("PresencePeer");
|
|
1735
1745
|
var PresenceInfo = defineComponent("PresenceInfo", { name: "string", color: "string" });
|
|
1736
1746
|
var PresenceCursor = defineComponent("PresenceCursor", {
|
|
@@ -3176,6 +3186,12 @@ function defineWidget(def) {
|
|
|
3176
3186
|
`ice: defineWidget("${def.type}") declares ${retired.join(", ")} \u2014 the view half of a widget is retired (design-015 D5b): a widget's face is its object kind's program (\`object:\`), and nothing mounts a component, a chrome, a preview or a surface for it. Drop ${retired.length > 1 ? "them" : "it"}.`
|
|
3177
3187
|
);
|
|
3178
3188
|
}
|
|
3189
|
+
const claim = ["keyboard", "keyboardEscape"].filter((k) => def.interaction?.[k] !== void 0);
|
|
3190
|
+
if (claim.length > 0) {
|
|
3191
|
+
throw new Error(
|
|
3192
|
+
`ice: defineWidget("${def.type}") declares interaction.${claim.join(" and interaction.")} \u2014 the keyboard claim is retired (design-019 \xA75, M24 LT2): a kind takes keys by LEASING the desk's one editor (\`EditorLease\`), and an object in hand that owns Escape says \`open.escape: "kind"\`. Drop ${claim.length > 1 ? "them" : "it"}.`
|
|
3193
|
+
);
|
|
3194
|
+
}
|
|
3179
3195
|
if (def.container?.framePreview !== void 0) {
|
|
3180
3196
|
throw new Error(
|
|
3181
3197
|
`ice: defineWidget("${def.type}") container declares framePreview \u2014 the container's preview renderer is retired (design-015 D5b): a mini mat's inside is drawn by the desk.`
|
|
@@ -3193,6 +3209,17 @@ function defineWidget(def) {
|
|
|
3193
3209
|
}
|
|
3194
3210
|
validateHeldTools(def.type, def.heldTools ?? []);
|
|
3195
3211
|
}
|
|
3212
|
+
if (def.heldWheel !== void 0 || def.heldEscape !== void 0) {
|
|
3213
|
+
if (!(hasObject && def.openable === true)) {
|
|
3214
|
+
throw new Error(`ice: defineWidget("${def.type}") declares heldWheel or heldEscape but does not open \u2014 only an object picked up into the hand has a wheel or an Escape of its own (design-019 \xA75).`);
|
|
3215
|
+
}
|
|
3216
|
+
if (def.heldWheel !== void 0 && def.heldWheel !== "hand" && def.heldWheel !== "kind") {
|
|
3217
|
+
throw new Error(`ice: defineWidget("${def.type}") declares heldWheel "${String(def.heldWheel)}" \u2014 the wheel in hand is "hand" or "kind" (design-019 \xA75).`);
|
|
3218
|
+
}
|
|
3219
|
+
if (def.heldEscape !== void 0 && def.heldEscape !== "desk" && def.heldEscape !== "kind") {
|
|
3220
|
+
throw new Error(`ice: defineWidget("${def.type}") declares heldEscape "${String(def.heldEscape)}" \u2014 Escape in hand is "desk" or "kind" (design-019 \xA75).`);
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3196
3223
|
validateMenuActions(def.type, def.menu ?? []);
|
|
3197
3224
|
for (const d of def.data ?? []) {
|
|
3198
3225
|
if (d.store !== "durable") throw new Error(`ice: defineWidget("${def.type}") data prefab "${d.id}" is ${d.store} \u2014 an object's data children live in the document (durable).`);
|
|
@@ -3229,7 +3256,6 @@ function defineWidget(def) {
|
|
|
3229
3256
|
if (interaction.dragOn === "longPress") capabilityTags.push(LongPressDrag);
|
|
3230
3257
|
if (interaction.sweepContained === true) capabilityTags.push(SweepsContained);
|
|
3231
3258
|
if (interaction.wheelTurns === true) capabilityTags.push(WheelTurns);
|
|
3232
|
-
if (interaction.keyboard === "exclusive") capabilityTags.push(KeyboardExclusive);
|
|
3233
3259
|
const snap = interaction.snap ?? "target";
|
|
3234
3260
|
if (snap === "source" || snap === "both") capabilityTags.push(SnapSource);
|
|
3235
3261
|
if (snap === "target" || snap === "both") capabilityTags.push(SnapTarget);
|
|
@@ -3268,8 +3294,8 @@ function defineWidget(def) {
|
|
|
3268
3294
|
frameProjection: def.container.frameProjection,
|
|
3269
3295
|
typed: def.container.typed === true
|
|
3270
3296
|
}),
|
|
3271
|
-
|
|
3272
|
-
|
|
3297
|
+
heldWheel: def.heldWheel ?? "hand",
|
|
3298
|
+
heldEscape: def.heldEscape ?? "desk",
|
|
3273
3299
|
drop: interaction.drop ?? "into",
|
|
3274
3300
|
migrate: def.migrate ?? {},
|
|
3275
3301
|
behaviors: behaviorEntries,
|
|
@@ -8517,6 +8543,22 @@ function heldToolCursor(world) {
|
|
|
8517
8543
|
});
|
|
8518
8544
|
return over ? cursor : void 0;
|
|
8519
8545
|
}
|
|
8546
|
+
function heldKindCursor(world, pose) {
|
|
8547
|
+
const source = pose?.current;
|
|
8548
|
+
if (source?.cursor === void 0) return void 0;
|
|
8549
|
+
const held = world.firstOf(heldQ);
|
|
8550
|
+
if (held === void 0) return void 0;
|
|
8551
|
+
let part = "";
|
|
8552
|
+
world.query(localPointerQ).each((b) => {
|
|
8553
|
+
for (const r of b) {
|
|
8554
|
+
const p2 = b.entity(r);
|
|
8555
|
+
if (world.read(p2, Pointer).device === "mouse") part = world.get(p2, HeldPointer)?.part ?? "";
|
|
8556
|
+
}
|
|
8557
|
+
});
|
|
8558
|
+
if (part === "" || part === "content" || part === "frame") return void 0;
|
|
8559
|
+
const c = source.cursor(held, part);
|
|
8560
|
+
return typeof c === "string" && c !== "" ? c : void 0;
|
|
8561
|
+
}
|
|
8520
8562
|
function trayCursor(world) {
|
|
8521
8563
|
const tray = world.firstOf(trayQ);
|
|
8522
8564
|
const t = tray === void 0 ? void 0 : world.get(tray, Tray);
|
|
@@ -8547,12 +8589,12 @@ function resizeCursorForAnchor(anchor) {
|
|
|
8547
8589
|
return "ew-resize";
|
|
8548
8590
|
}
|
|
8549
8591
|
}
|
|
8550
|
-
function createCursorSync(world) {
|
|
8592
|
+
function createCursorSync(world, opts = {}) {
|
|
8551
8593
|
let cursor = "default";
|
|
8552
8594
|
const system = defineSystem7(
|
|
8553
8595
|
anchorQ,
|
|
8554
8596
|
(_b, ctx) => {
|
|
8555
|
-
let resolved = heldToolCursor(world) ?? trayCursor(world);
|
|
8597
|
+
let resolved = heldKindCursor(world, opts.pose) ?? heldToolCursor(world) ?? trayCursor(world);
|
|
8556
8598
|
let mouseTargets;
|
|
8557
8599
|
world.query(localPointerQ).each((b) => {
|
|
8558
8600
|
for (const r of b) {
|
|
@@ -8617,10 +8659,12 @@ function createHeldInput(world, opts) {
|
|
|
8617
8659
|
if (held === void 0 || !ctx.isAlive(held)) {
|
|
8618
8660
|
const mute = world.getResource(HeldMute);
|
|
8619
8661
|
let muted = mute !== void 0 && now2 < mute.until;
|
|
8662
|
+
if ((world.getResource(HeldPressMemo)?.count ?? 0) !== 0) world.setResource(HeldPressMemo, { x: 0, y: 0, at: 0, count: 0 });
|
|
8620
8663
|
for (const r of b) {
|
|
8621
8664
|
const p2 = b.entity(r);
|
|
8622
8665
|
if (ctx.has(p2, HeldPointer)) ctx.removeComponent(p2, HeldPointer);
|
|
8623
8666
|
if (ctx.has(p2, HeldPress)) ctx.removeComponent(p2, HeldPress);
|
|
8667
|
+
if (ctx.has(p2, HeldWheel)) ctx.removeComponent(p2, HeldWheel);
|
|
8624
8668
|
if (!muted) continue;
|
|
8625
8669
|
const w = ctx.get(p2, PointerWheel);
|
|
8626
8670
|
if (w === void 0 || w.dx === 0 && w.dy === 0 && w.pinch === 0 || ctx.hasTag(p2, WheelHandled)) continue;
|
|
@@ -8636,6 +8680,8 @@ function createHeldInput(world, opts) {
|
|
|
8636
8680
|
const windowMs = gs2?.multiTapWindowMs ?? GESTURE_DEFAULTS.multiTapWindowMs;
|
|
8637
8681
|
const slopPx = gs2?.multiTapSlopPx ?? GESTURE_DEFAULTS.multiTapSlopPx;
|
|
8638
8682
|
const space = world.getResource(Keyboard)?.space === true;
|
|
8683
|
+
const typeId = world.get(held, PrefabId)?.id;
|
|
8684
|
+
const wheelToKind = typeof typeId === "string" && widgetTypeFor(world, typeId)?.heldWheel === "kind";
|
|
8639
8685
|
const clampPan = (x, y, zoom) => {
|
|
8640
8686
|
if (frame2 === void 0) return [x, y];
|
|
8641
8687
|
const hx = frame2.hx / Math.max(view.zoom, 1e-9) * zoom;
|
|
@@ -8679,6 +8725,11 @@ function createHeldInput(world, opts) {
|
|
|
8679
8725
|
const [px, py] = zoom <= 1 ? [0, 0] : clampPan(next2.panX + (s.x - cx) * (1 - ratio), next2.panY + (s.y - cy) * (1 - ratio), zoom);
|
|
8680
8726
|
next2 = { zoom, panX: px, panY: py };
|
|
8681
8727
|
}
|
|
8728
|
+
} else if (wheelToKind) {
|
|
8729
|
+
const cur = ctx.get(p2, HeldWheel);
|
|
8730
|
+
const wheel = { dx: w.dx, dy: w.dy, seq: (cur?.seq ?? 0) + 1 };
|
|
8731
|
+
if (cur === void 0) ctx.addComponent(p2, HeldWheel, wheel);
|
|
8732
|
+
else ctx.edit(p2).set(HeldWheel, wheel);
|
|
8682
8733
|
} else if (next2.zoom > 1.001) {
|
|
8683
8734
|
const [px, py] = clampPan(next2.panX - w.dx, next2.panY - w.dy, next2.zoom);
|
|
8684
8735
|
next2 = { ...next2, panX: px, panY: py };
|
|
@@ -8691,7 +8742,15 @@ function createHeldInput(world, opts) {
|
|
|
8691
8742
|
const tool = part === "content" && (world.get(held, HeldTool)?.id ?? "") !== "";
|
|
8692
8743
|
const named = part !== "" && part !== "content" && part !== "frame";
|
|
8693
8744
|
const kind = pan ? "pan" : tool ? "tool" : named ? "part" : inside ? "object" : "desk";
|
|
8694
|
-
|
|
8745
|
+
let count = 1;
|
|
8746
|
+
if (button === "primary") {
|
|
8747
|
+
const memo = world.getResource(HeldPressMemo);
|
|
8748
|
+
const downMs = ctx.get(p2, PointerButtons)?.downMs ?? 0;
|
|
8749
|
+
const at = downMs !== 0 ? downMs : now2;
|
|
8750
|
+
if (memo !== void 0 && memo.count > 0 && at - memo.at <= windowMs && Math.hypot(s.x - memo.x, s.y - memo.y) <= slopPx) count = memo.count + 1;
|
|
8751
|
+
world.setResource(HeldPressMemo, { x: s.x, y: s.y, at, count });
|
|
8752
|
+
}
|
|
8753
|
+
const press = { kind, part, x: s.x, y: s.y, panX0: next2.panX, panY0: next2.panY, moved: false, count };
|
|
8695
8754
|
if (ctx.has(p2, HeldPress)) ctx.edit(p2).set(HeldPress, press);
|
|
8696
8755
|
else ctx.addComponent(p2, HeldPress, press);
|
|
8697
8756
|
} else if (ctx.has(p2, HeldPress)) ctx.removeComponent(p2, HeldPress);
|
|
@@ -8732,7 +8791,7 @@ function createHeldInput(world, opts) {
|
|
|
8732
8791
|
else ctx.addComponent(held, HeldView, next2);
|
|
8733
8792
|
}
|
|
8734
8793
|
},
|
|
8735
|
-
{ name: "heldInput", access: { write: [HeldView, HeldPointer, HeldPress] } }
|
|
8794
|
+
{ name: "heldInput", access: { write: [HeldView, HeldPointer, HeldPress, HeldWheel] } }
|
|
8736
8795
|
);
|
|
8737
8796
|
}
|
|
8738
8797
|
|
|
@@ -11097,7 +11156,7 @@ function installInteractionStack(engine, opts = {}) {
|
|
|
11097
11156
|
const connect = createConnectSystems(world, sink, index, wires);
|
|
11098
11157
|
const ports = createPortMaterialize(world, index);
|
|
11099
11158
|
const camera = createCameraSystems(world);
|
|
11100
|
-
const cursor = createCursorSync(world);
|
|
11159
|
+
const cursor = createCursorSync(world, { pose: heldPose });
|
|
11101
11160
|
const cleanup = createCleanupSystems(world);
|
|
11102
11161
|
const removers = [
|
|
11103
11162
|
// the stack's registered wake (K7a, interaction/wakes.ts): due every frame while its time-driven work is pending
|
|
@@ -16911,6 +16970,8 @@ export {
|
|
|
16911
16970
|
HeldMute,
|
|
16912
16971
|
HeldPointer,
|
|
16913
16972
|
HeldPress,
|
|
16973
|
+
HeldPressMemo,
|
|
16974
|
+
HeldWheel,
|
|
16914
16975
|
HeldTapMemo,
|
|
16915
16976
|
Tray,
|
|
16916
16977
|
TrayIntent,
|
|
@@ -17014,7 +17075,6 @@ export {
|
|
|
17014
17075
|
SnapTarget,
|
|
17015
17076
|
SweepsContained,
|
|
17016
17077
|
WheelTurns,
|
|
17017
|
-
KeyboardExclusive,
|
|
17018
17078
|
PresencePeer,
|
|
17019
17079
|
PresenceInfo,
|
|
17020
17080
|
PresenceCursor,
|
|
@@ -17236,4 +17296,4 @@ export {
|
|
|
17236
17296
|
Local3 as Local,
|
|
17237
17297
|
DurableUndoStatus
|
|
17238
17298
|
};
|
|
17239
|
-
//# sourceMappingURL=chunk-
|
|
17299
|
+
//# sourceMappingURL=chunk-SHU3HVMF.js.map
|