@vibecook/ice 0.14.0 → 0.15.0-desk.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.
Files changed (62) hide show
  1. package/dist/{chunk-ZPUPBULB.js → chunk-52GMQ2BN.js} +1320 -450
  2. package/dist/chunk-52GMQ2BN.js.map +1 -0
  3. package/dist/{chunk-BA7XJC27.js → chunk-K4HUZAYJ.js} +49 -34
  4. package/dist/chunk-K4HUZAYJ.js.map +1 -0
  5. package/dist/{chunk-DYK6KNLG.js → chunk-PFJN3XN2.js} +39 -14
  6. package/dist/chunk-PFJN3XN2.js.map +1 -0
  7. package/dist/{chunk-IBWWLA6D.js → chunk-U4YMA4TJ.js} +6 -5
  8. package/dist/chunk-U4YMA4TJ.js.map +1 -0
  9. package/dist/desk-kit.js +2 -2
  10. package/dist/desk-objects.js +15 -9
  11. package/dist/desk-objects.js.map +1 -1
  12. package/dist/desk.js +31 -3
  13. package/dist/devtools.js +1 -1
  14. package/dist/dom.js +2 -2
  15. package/dist/index.js +1 -1
  16. package/dist/react.js +9 -7
  17. package/dist/react.js.map +1 -1
  18. package/dist/types/packages/core/src/index.d.ts +1 -1
  19. package/dist/types/packages/core/src/interaction/install.d.ts +7 -1
  20. package/dist/types/packages/core/src/systems/held.d.ts +3 -1
  21. package/dist/types/packages/core/src/systems/l1-pick.d.ts +16 -0
  22. package/dist/types/packages/core/src/systems/l2-recognize.d.ts +3 -1
  23. package/dist/types/packages/core/src/systems/press-button.d.ts +25 -0
  24. package/dist/types/packages/core/src/systems/tray.d.ts +3 -0
  25. package/dist/types/packages/desk/src/compose/builder.d.ts +22 -1
  26. package/dist/types/packages/desk/src/compose/marks.d.ts +7 -0
  27. package/dist/types/packages/desk/src/compose/pick.d.ts +1 -1
  28. package/dist/types/packages/desk/src/compose/reflector.d.ts +9 -0
  29. package/dist/types/packages/desk/src/engine/budget.d.ts +5 -0
  30. package/dist/types/packages/desk/src/faults.d.ts +38 -0
  31. package/dist/types/packages/desk/src/ground.d.ts +158 -9
  32. package/dist/types/packages/desk/src/hold/focus.d.ts +1 -1
  33. package/dist/types/packages/desk/src/hold/pose.d.ts +27 -7
  34. package/dist/types/packages/desk/src/host/index.d.ts +1 -1
  35. package/dist/types/packages/desk/src/host/layer.d.ts +110 -4
  36. package/dist/types/packages/desk/src/index.d.ts +5 -2
  37. package/dist/types/packages/desk/src/kind.d.ts +7 -5
  38. package/dist/types/packages/desk/src/kinds/world.d.ts +20 -2
  39. package/dist/types/packages/desk/src/kit/editor.d.ts +3 -1
  40. package/dist/types/packages/desk/src/kit/hold.d.ts +1 -1
  41. package/dist/types/packages/desk/src/missing/layout.d.ts +27 -0
  42. package/dist/types/packages/desk/src/missing/object.d.ts +6 -0
  43. package/dist/types/packages/desk/src/missing/pass.d.ts +39 -0
  44. package/dist/types/packages/desk/src/missing/shaders.d.ts +7 -0
  45. package/dist/types/packages/desk/src/missing/slots.d.ts +8 -0
  46. package/dist/types/packages/desk/src/shaders.gen.d.ts +5 -4
  47. package/dist/types/packages/desk/src/theme.d.ts +22 -0
  48. package/dist/types/packages/desk/src/tray/drawer.d.ts +16 -5
  49. package/dist/types/packages/desk/src/tray/flux.d.ts +4 -1
  50. package/dist/types/packages/desk/src/tray/index.d.ts +1 -1
  51. package/dist/types/packages/desk/src/tray/pass.d.ts +7 -2
  52. package/dist/types/packages/desk/src/tray/specimens.d.ts +21 -6
  53. package/dist/types/packages/dom/src/desk-host.d.ts +15 -2
  54. package/dist/types/packages/dom/src/pointer-adapter.d.ts +6 -0
  55. package/dist/types/packages/objects/src/board/layout.d.ts +1 -1
  56. package/dist/types/packages/objects/src/shaders.gen.d.ts +1 -1
  57. package/dist/types/packages/react/src/selection-menu.d.ts +5 -2
  58. package/package.json +1 -1
  59. package/dist/chunk-BA7XJC27.js.map +0 -1
  60. package/dist/chunk-DYK6KNLG.js.map +0 -1
  61. package/dist/chunk-IBWWLA6D.js.map +0 -1
  62. package/dist/chunk-ZPUPBULB.js.map +0 -1
@@ -7055,6 +7055,18 @@ function createCanvasSessionController(world) {
7055
7055
 
7056
7056
  // ../core/src/systems/l2-recognize.ts
7057
7057
  import { Any as Any2, Not as Not4, defineQuery as defineQuery10, defineSystem as defineSystem3 } from "@vibecook/strata-ecs";
7058
+
7059
+ // ../core/src/systems/press-button.ts
7060
+ function pressButton(buttons) {
7061
+ if (buttons === 0 || (buttons & (1 | 32)) !== 0) return "primary";
7062
+ return (buttons & 4) !== 0 ? "middle" : "secondary";
7063
+ }
7064
+ function middlePans(ctx, captured) {
7065
+ if (captured === void 0 || ctx.hasTag(captured, CanvasSurface)) return true;
7066
+ return !ctx.has(captured, HandleSpec) && !ctx.has(captured, Port) && !ctx.has(captured, Position);
7067
+ }
7068
+
7069
+ // ../core/src/systems/l2-recognize.ts
7058
7070
  var DEFAULT_SPAWN_PROFILES = {
7059
7071
  select: ["tap", "longPress", "drag"],
7060
7072
  pan: ["drag"]
@@ -7117,6 +7129,8 @@ function createL2Systems({ world, profiles = DEFAULT_SPAWN_PROFILES }) {
7117
7129
  if (claimant !== void 0 && !isTerminal(ctx, claimant)) continue;
7118
7130
  const screen = ctx.read(pointer, PointerScreen);
7119
7131
  const captureTarget = ctx.getRelation(pointer, TouchesExact);
7132
+ const button = pressButton(ctx.get(pointer, PointerButtons)?.buttons ?? 0);
7133
+ if (button === "secondary" || button === "middle" && !middlePans(ctx, captureTarget)) continue;
7120
7134
  const downPart = ctx.get(pointer, PointerPart)?.part ?? "";
7121
7135
  const downMs = now2;
7122
7136
  let pinchPartner;
@@ -7137,7 +7151,7 @@ function createL2Systems({ world, profiles = DEFAULT_SPAWN_PROFILES }) {
7137
7151
  const holdToDrag = captureTarget !== void 0 && ctx.hasTag(captureTarget, LongPressDrag) && profile.includes("longPress");
7138
7152
  let lpRec;
7139
7153
  let rejoined = false;
7140
- if (captureTarget !== void 0 && ctx.has(captureTarget, MultiTap)) {
7154
+ if (button === "primary" && captureTarget !== void 0 && ctx.has(captureTarget, MultiTap)) {
7141
7155
  const mt = ctx.read(captureTarget, MultiTap);
7142
7156
  ctx.query(pendingTapQ).each((pb) => {
7143
7157
  for (const pr of pb) {
@@ -7207,6 +7221,7 @@ function createL2Systems({ world, profiles = DEFAULT_SPAWN_PROFILES }) {
7207
7221
  return rec;
7208
7222
  };
7209
7223
  for (const kind of profile) {
7224
+ if (button === "middle" && kind !== "drag") continue;
7210
7225
  if (kind === "tap" && rejoined) continue;
7211
7226
  const rec = spawnSingle(kind);
7212
7227
  if (kind === "longPress") lpRec = rec;
@@ -8621,14 +8636,16 @@ function createHeldInput(world, opts) {
8621
8636
  }
8622
8637
  }
8623
8638
  if (ctx.hasTag(p2, WentDown)) {
8624
- const buttons = ctx.get(p2, PointerButtons)?.buttons ?? 0;
8625
- const pan = ((buttons & 4) !== 0 || space) && next2.zoom > 1.001;
8626
- const tool = part === "content" && (world.get(held, HeldTool)?.id ?? "") !== "";
8627
- const named = part !== "" && part !== "content" && part !== "frame";
8628
- const kind = pan ? "pan" : tool ? "tool" : named ? "part" : inside ? "object" : "desk";
8629
- const press = { kind, part, x: s.x, y: s.y, panX0: next2.panX, panY0: next2.panY, moved: false };
8630
- if (ctx.has(p2, HeldPress)) ctx.edit(p2).set(HeldPress, press);
8631
- else ctx.addComponent(p2, HeldPress, press);
8639
+ const button = pressButton(ctx.get(p2, PointerButtons)?.buttons ?? 0);
8640
+ const pan = (button === "middle" || button === "primary" && space) && next2.zoom > 1.001;
8641
+ if (pan || button === "primary") {
8642
+ const tool = part === "content" && (world.get(held, HeldTool)?.id ?? "") !== "";
8643
+ const named = part !== "" && part !== "content" && part !== "frame";
8644
+ const kind = pan ? "pan" : tool ? "tool" : named ? "part" : inside ? "object" : "desk";
8645
+ const press = { kind, part, x: s.x, y: s.y, panX0: next2.panX, panY0: next2.panY, moved: false };
8646
+ if (ctx.has(p2, HeldPress)) ctx.edit(p2).set(HeldPress, press);
8647
+ else ctx.addComponent(p2, HeldPress, press);
8648
+ } else if (ctx.has(p2, HeldPress)) ctx.removeComponent(p2, HeldPress);
8632
8649
  } else if (ctx.has(p2, HeldPress)) {
8633
8650
  const pr = ctx.read(p2, HeldPress);
8634
8651
  const dx = s.x - pr.x;
@@ -8787,7 +8804,7 @@ function createTrayInput(world, opts) {
8787
8804
  let takeY = t.takeY;
8788
8805
  let handed = t.handed;
8789
8806
  const over = (x, y, pad) => frame2 !== void 0 && x >= frame2.x && x <= frame2.x + frame2.w && y >= frame2.y - pad;
8790
- const shows = (y) => frame2 !== void 0 && y >= frame2.y + (frame2.head ?? 0);
8807
+ const shows = (y) => frame2 !== void 0 && y >= frame2.y + (frame2.head ?? 0) && (frame2.foot === void 0 || y < frame2.y + frame2.h - frame2.foot);
8791
8808
  const vh = world.getResource(Viewport)?.h ?? 0;
8792
8809
  const inOpen = (x, y) => frame2 !== void 0 && x >= frame2.x && x <= frame2.x + frame2.w && y >= vh - frame2.h;
8793
8810
  for (const r of b) {
@@ -8936,7 +8953,7 @@ function createTrayLay(world, opts) {
8936
8953
  let laidCategory = "";
8937
8954
  const clampToRange = (ctx, tray, frame2, bottom) => {
8938
8955
  if (frame2.face === void 0) return;
8939
- const range = trayScrollMax(bottom, frame2.face, frame2.pitch);
8956
+ const range = trayScrollMax(bottom, frame2.face - (frame2.foot ?? 0), frame2.pitch);
8940
8957
  const key = `${tray}|${range}`;
8941
8958
  if (key === rangeKey) return;
8942
8959
  const t = ctx.read(tray, Tray);
@@ -9506,7 +9523,7 @@ function createPickingSystems(world, index = new SpatialIndex(), wires, frames =
9506
9523
  }
9507
9524
  );
9508
9525
  const order = createSiblingOrderIndex(world);
9509
- const pickTop = (ctx, wx, wy, rWorld) => pickTopAt(ctx, index, wx, wy, rWorld, wires, order.ordinals());
9526
+ const pickTop = (reader, wx, wy, rWorld) => pickTopAt(reader, index, wx, wy, rWorld, wires, order.ordinals());
9510
9527
  const pickFrame = (ctx, wx, wy, rWorld, boxHit) => {
9511
9528
  const src = frames.current;
9512
9529
  if (src === null) return { e: boxHit, part: "" };
@@ -9548,6 +9565,7 @@ function createPickingSystems(world, index = new SpatialIndex(), wires, frames =
9548
9565
  }
9549
9566
  return { e: best, part: bestPart };
9550
9567
  };
9568
+ const pickExact = (reader, wx, wy) => pickFrame(reader, wx, wy, 0, pickTop(reader, wx, wy, 0));
9551
9569
  const versions = makeVersionGuard(world, [PointerVersion, SpatialVersion]);
9552
9570
  const trayIsOpen = () => {
9553
9571
  const t = world.firstOf(trayQ4);
@@ -9580,7 +9598,7 @@ function createPickingSystems(world, index = new SpatialIndex(), wires, frames =
9580
9598
  const s = ctx.read(p2, PointerScreen);
9581
9599
  const w = screenToWorld(s.x, s.y, cam ?? IDENTITY_CAM2);
9582
9600
  const rWorld = (ctx.get(p2, PointerRadius)?.r ?? 0) / zoom;
9583
- const exactFrame = pickFrame(ctx, w.x, w.y, 0, pickTop(ctx, w.x, w.y, 0));
9601
+ const exactFrame = pickExact(ctx, w.x, w.y);
9584
9602
  const exact = exactFrame.e ?? canvas;
9585
9603
  if (exact !== void 0 && ctx.getRelation(p2, TouchesExact) !== exact) {
9586
9604
  ctx.setRelation(p2, TouchesExact, exact);
@@ -9623,6 +9641,12 @@ function createPickingSystems(world, index = new SpatialIndex(), wires, frames =
9623
9641
  spatialSync,
9624
9642
  picking,
9625
9643
  index,
9644
+ pickAt(sx, sy) {
9645
+ if (trayIsOpen()) return void 0;
9646
+ const w = screenToWorld(sx, sy, world.getResource(Camera) ?? IDENTITY_CAM2);
9647
+ const hit = pickExact(world, w.x, w.y);
9648
+ return hit.e === void 0 ? void 0 : { entity: hit.e, part: hit.part };
9649
+ },
9626
9650
  clearCaches: () => {
9627
9651
  seeded = false;
9628
9652
  }
@@ -11021,6 +11045,7 @@ function installInteractionStack(engine, opts = {}) {
11021
11045
  marqueeBuffer: marquee.buffer,
11022
11046
  wirePreview: connect.previewBuffer,
11023
11047
  framePick,
11048
+ pickAt: (sx, sy) => pick.pickAt(sx, sy),
11024
11049
  navGeometry,
11025
11050
  heldPose,
11026
11051
  trayPose,
@@ -17022,4 +17047,4 @@ export {
17022
17047
  Local3 as Local,
17023
17048
  DurableUndoStatus
17024
17049
  };
17025
- //# sourceMappingURL=chunk-DYK6KNLG.js.map
17050
+ //# sourceMappingURL=chunk-PFJN3XN2.js.map