@vibecook/ice 0.16.0-portals.4 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +10 -5
  2. package/dist/{chunk-ZTY2VRIS.js → chunk-6W2FPXR7.js} +13 -7
  3. package/dist/chunk-6W2FPXR7.js.map +1 -0
  4. package/dist/{chunk-Y7K6CHSF.js → chunk-LAZIY3J7.js} +286 -189
  5. package/dist/chunk-LAZIY3J7.js.map +1 -0
  6. package/dist/{chunk-Z7POWSDB.js → chunk-M2HUDENL.js} +288 -318
  7. package/dist/chunk-M2HUDENL.js.map +1 -0
  8. package/dist/{chunk-BH5AFWJX.js → chunk-VZEZ7CYW.js} +9 -13
  9. package/dist/chunk-VZEZ7CYW.js.map +1 -0
  10. package/dist/desk-kit.js +2 -2
  11. package/dist/desk-objects.js +59 -21
  12. package/dist/desk-objects.js.map +1 -1
  13. package/dist/desk.js +3 -3
  14. package/dist/devtools.js +1 -1
  15. package/dist/dom.js +2 -2
  16. package/dist/index.js +7 -1
  17. package/dist/react.js +2 -2
  18. package/dist/types/packages/core/src/canvas/engine-catalog.d.ts +6 -0
  19. package/dist/types/packages/core/src/catalog/desk.d.ts +6 -6
  20. package/dist/types/packages/core/src/catalog/gesture.d.ts +2 -0
  21. package/dist/types/packages/core/src/catalog/selection-presence.d.ts +2 -0
  22. package/dist/types/packages/core/src/catalog/settings-resources.d.ts +8 -4
  23. package/dist/types/packages/core/src/facade/create-canvas-engine.d.ts +11 -5
  24. package/dist/types/packages/core/src/index.d.ts +1 -1
  25. package/dist/types/packages/core/src/ops/selection-drag.d.ts +8 -0
  26. package/dist/types/packages/core/src/settings/defaults.d.ts +2 -0
  27. package/dist/types/packages/core/src/systems/camera-sim.d.ts +13 -0
  28. package/dist/types/packages/core/src/systems/tray.d.ts +5 -4
  29. package/dist/types/packages/core/src/tools/define-tool.d.ts +2 -2
  30. package/dist/types/packages/core/src/widget/define-widget.d.ts +2 -1
  31. package/dist/types/packages/desk/src/ground.d.ts +4 -3
  32. package/dist/types/packages/desk/src/host/layer.d.ts +1 -3
  33. package/dist/types/packages/desk/src/kinds/world.d.ts +5 -1
  34. package/dist/types/packages/desk/src/mat/layout.d.ts +45 -5
  35. package/dist/types/packages/desk/src/mat/mat-pass.d.ts +7 -0
  36. package/dist/types/packages/desk/src/mat/ruler-regions.d.ts +17 -0
  37. package/dist/types/packages/desk/src/shaders.gen.d.ts +4 -4
  38. package/dist/types/packages/desk/src/theme.d.ts +0 -15
  39. package/dist/types/packages/desk/src/tray/drawer.d.ts +10 -8
  40. package/dist/types/packages/desk/src/tray/flux.d.ts +2 -3
  41. package/dist/types/packages/desk/src/tray/layout.d.ts +1 -6
  42. package/dist/types/packages/desk/src/tray/look.d.ts +0 -9
  43. package/dist/types/packages/desk/src/tray/pass.d.ts +7 -18
  44. package/dist/types/packages/desk/src/tray/specimens.d.ts +2 -19
  45. package/dist/types/packages/dom/src/pointer-adapter.d.ts +1 -1
  46. package/dist/types/packages/objects/src/board/board-pen.d.ts +1 -1
  47. package/dist/types/packages/objects/src/calendar/hand.d.ts +5 -1
  48. package/dist/types/packages/objects/src/minimat/layout.d.ts +1 -1
  49. package/dist/types/packages/objects/src/notebook/leaf.d.ts +1 -1
  50. package/dist/types/packages/objects/src/photo/photo.d.ts +2 -2
  51. package/dist/types/packages/objects/src/preset.d.ts +5 -3
  52. package/package.json +15 -16
  53. package/dist/chunk-BH5AFWJX.js.map +0 -1
  54. package/dist/chunk-Y7K6CHSF.js.map +0 -1
  55. package/dist/chunk-Z7POWSDB.js.map +0 -1
  56. package/dist/chunk-ZTY2VRIS.js.map +0 -1
package/dist/desk-kit.js CHANGED
@@ -121,9 +121,9 @@ import {
121
121
  visibleRect,
122
122
  worldBounds,
123
123
  writeChanged
124
- } from "./chunk-BH5AFWJX.js";
124
+ } from "./chunk-VZEZ7CYW.js";
125
125
  import "./chunk-RTBW5AIZ.js";
126
- import "./chunk-Y7K6CHSF.js";
126
+ import "./chunk-LAZIY3J7.js";
127
127
  import "./chunk-RE4GDHFJ.js";
128
128
  export {
129
129
  BLOB_STORE,
@@ -8,7 +8,7 @@ import {
8
8
  rasterPriority,
9
9
  stringProp,
10
10
  writable
11
- } from "./chunk-Z7POWSDB.js";
11
+ } from "./chunk-M2HUDENL.js";
12
12
  import "./chunk-BKV4ZEU3.js";
13
13
  import {
14
14
  compile,
@@ -110,7 +110,7 @@ import {
110
110
  unproject,
111
111
  worldBounds,
112
112
  writeChanged
113
- } from "./chunk-BH5AFWJX.js";
113
+ } from "./chunk-VZEZ7CYW.js";
114
114
  import {
115
115
  bindGroup,
116
116
  bindLayout,
@@ -129,6 +129,7 @@ import {
129
129
  Down,
130
130
  DownPart,
131
131
  Drag,
132
+ Drags,
132
133
  Editing,
133
134
  GestureActive,
134
135
  GestureCancelled,
@@ -142,6 +143,7 @@ import {
142
143
  HeldTool,
143
144
  LocalPointer,
144
145
  Locked,
146
+ MovesSelection,
145
147
  Pointer,
146
148
  PointerButtons,
147
149
  PointerPart,
@@ -151,6 +153,7 @@ import {
151
153
  Position,
152
154
  PrefabId,
153
155
  PressWheel,
156
+ RoutedMove,
154
157
  Size,
155
158
  TouchesExact,
156
159
  TransformTween,
@@ -170,7 +173,7 @@ import {
170
173
  setWidgetProps,
171
174
  tools,
172
175
  trayOpen
173
- } from "./chunk-Y7K6CHSF.js";
176
+ } from "./chunk-LAZIY3J7.js";
174
177
  import {
175
178
  clientToScreen
176
179
  } from "./chunk-RE4GDHFJ.js";
@@ -4136,6 +4139,10 @@ function createBoardPen(opts) {
4136
4139
  const [x, y] = toSurface(G, at[0], at[1]);
4137
4140
  return [f32(x), f32(y)];
4138
4141
  };
4142
+ const boardInHand = () => {
4143
+ const held = heldEntity(world);
4144
+ return held !== void 0 && world.isAlive(held) && opts.isBoard(held) ? held : void 0;
4145
+ };
4139
4146
  const lift = (s, at, now) => {
4140
4147
  const ink = opts.ink();
4141
4148
  const G = opts.geometryOf(s.board);
@@ -4175,8 +4182,7 @@ function createBoardPen(opts) {
4175
4182
  };
4176
4183
  return {
4177
4184
  follow(now) {
4178
- const held = heldEntity(world);
4179
- const board2 = held !== void 0 && world.isAlive(held) && opts.isBoard(held) ? held : void 0;
4185
+ const board2 = boardInHand();
4180
4186
  if (last !== null && last.board !== board2) {
4181
4187
  if (stroke !== null && stroke.board === last.board) {
4182
4188
  lift(stroke, void 0, now);
@@ -4245,7 +4251,7 @@ function createBoardPen(opts) {
4245
4251
  ...screen !== void 0 ? { screen: [screen.x, screen.y], t: now } : {}
4246
4252
  });
4247
4253
  },
4248
- idle: () => stroke === null && last === null && heldEntity(world) === void 0,
4254
+ idle: () => stroke === null && last === null && boardInHand() === void 0,
4249
4255
  live: () => stroke === null ? null : { board: stroke.board, samples: stroke.points.length },
4250
4256
  commits: () => commits
4251
4257
  };
@@ -7427,7 +7433,8 @@ function createCalendarHand(opts) {
7427
7433
  for (const pad of [...homes.keys()]) if (!world.isAlive(pad) || !world.has(pad, PadSelection)) homes.delete(pad);
7428
7434
  },
7429
7435
  idle() {
7430
- if (heldEntity(world) !== void 0 || hands.size > 0 || peeked.size > 0 || marked.size > 0 || homes.size > 0 || glides.length > 0) return false;
7436
+ const held = heldEntity(world);
7437
+ if (held !== void 0 && opts.isPad?.(held) === true || hands.size > 0 || peeked.size > 0 || marked.size > 0 || homes.size > 0 || glides.length > 0) return false;
7431
7438
  const pads = opts.pads();
7432
7439
  if (pads?.rollOwed() === true) return false;
7433
7440
  if (pads?.busy() === true && (world.resourceStamp(PointerVersion) !== seenPointer || world.resourceStamp(Camera) !== seenCamera)) return false;
@@ -10544,6 +10551,10 @@ function createNotebookHand(opts) {
10544
10551
  books.face(book, face);
10545
10552
  if (at !== spreadOf(books, book)) write(books, book, at);
10546
10553
  };
10554
+ const bookInHand = () => {
10555
+ const held = heldEntity(world);
10556
+ return held !== void 0 && world.isAlive(held) && opts.isBook(held) ? held : void 0;
10557
+ };
10547
10558
  const onPage = (G, at, s) => {
10548
10559
  const h = pageHitAt(G, at[0], at[1]);
10549
10560
  if (h === null || h.part !== "page") return null;
@@ -10583,10 +10594,9 @@ function createNotebookHand(opts) {
10583
10594
  });
10584
10595
  };
10585
10596
  return {
10586
- idle: () => stroke === null && turn === null && inHand === null && heldEntity(world) === void 0,
10597
+ idle: () => stroke === null && turn === null && inHand === null && bookInHand() === void 0,
10587
10598
  follow(now) {
10588
- const held = heldEntity(world);
10589
- const book = held !== void 0 && world.isAlive(held) && opts.isBook(held) ? held : void 0;
10599
+ const book = bookInHand();
10590
10600
  if (stroke !== null && !world.isAlive(stroke.book)) {
10591
10601
  opts.books()?.write(stroke.book, null);
10592
10602
  stroke = null;
@@ -10813,8 +10823,8 @@ var CAST = MAT_COLORS.cast;
10813
10823
  var PHOTO_SPEC = {
10814
10824
  /** The print's long side — a 6×4 at the note's scale. */
10815
10825
  long: 400,
10816
- /** The white border, as a fraction of the short side (a classic bordered print). 0 = borderless. */
10817
- border: 0.05,
10826
+ /** Optional host styling, as a fraction of the short side. Images fill the sheet by default. */
10827
+ border: 0,
10818
10828
  /** The die-cut corner. */
10819
10829
  radius: 2.5,
10820
10830
  /** The paper under the emulsion: a resin-coated white, a touch warm (sRGB), and its fibre ±/255. */
@@ -12223,7 +12233,7 @@ function photoKind(opts = {}) {
12223
12233
  },
12224
12234
  record(G, ctx) {
12225
12235
  const { w, h } = extentOf(ctx);
12226
- const border = borderOf(w / 2, h / 2, { ...law, border: numberProp(ctx.props, "border", law.border) });
12236
+ const border = borderOf(w / 2, h / 2, law);
12227
12237
  const prints = ctx.local;
12228
12238
  const picture = prints?.pictureFor(ctx.entity, stringProp(ctx.props, "blob", ""), numberProp(ctx.props, "width", 0), numberProp(ctx.props, "height", 0)) ?? null;
12229
12239
  return { geometry: G, border, picture };
@@ -12243,11 +12253,13 @@ function printRect(cx, cy, width, height, long = PHOTO.long) {
12243
12253
 
12244
12254
  // ../objects/src/photo/carry.ts
12245
12255
  var pointersQ5 = defineQuery([Pointer, LocalPointer, PointerWorld, PointerButtons]);
12256
+ var coreMovesQ = defineQuery([Drag, RoutedMove, GestureActive]);
12246
12257
  var TWIST_PER_WHEEL = 35e-4;
12247
12258
  function createPhotoCarry(opts) {
12248
12259
  const { world, docs } = opts;
12249
12260
  const defer = opts.defer ?? ((fn) => queueMicrotask(fn));
12250
12261
  const held = /* @__PURE__ */ new Set();
12262
+ const coreMoves = /* @__PURE__ */ new Set();
12251
12263
  const refusing = /* @__PURE__ */ new Set();
12252
12264
  const wheel = /* @__PURE__ */ new Map();
12253
12265
  let cancelStamp = world.resourceStamp(CancelRequest);
@@ -12275,7 +12287,26 @@ function createPhotoCarry(opts) {
12275
12287
  follow(now) {
12276
12288
  const prints = opts.prints();
12277
12289
  if (prints === void 0) return;
12278
- for (const r of prints.rests()) defer(() => prints.settle(r.entity, commit(r.entity, r.x, r.y, r.angle)));
12290
+ for (const rec of coreMoves) if (!world.isAlive(rec) || !world.hasTag(rec, GestureActive)) coreMoves.delete(rec);
12291
+ world.query(coreMovesQ).each((b) => {
12292
+ for (const row of b) {
12293
+ const rec = b.entity(row);
12294
+ if (coreMoves.has(rec)) continue;
12295
+ coreMoves.add(rec);
12296
+ for (const e of world.getRelations(rec, Drags)) {
12297
+ if (!opts.isPrint(e)) continue;
12298
+ prints.settle(e, false);
12299
+ held.delete(e);
12300
+ wheel.delete(e);
12301
+ }
12302
+ }
12303
+ });
12304
+ for (const r of prints.rests()) {
12305
+ if (world.has(r.entity, Grab)) continue;
12306
+ defer(() => {
12307
+ if (!world.has(r.entity, Grab)) prints.settle(r.entity, commit(r.entity, r.x, r.y, r.angle));
12308
+ });
12309
+ }
12279
12310
  const stamp = world.resourceStamp(CancelRequest);
12280
12311
  const cancelled = stamp !== cancelStamp;
12281
12312
  cancelStamp = stamp;
@@ -12286,7 +12317,9 @@ function createPhotoCarry(opts) {
12286
12317
  for (const row of b) {
12287
12318
  const p2 = b.entity(row);
12288
12319
  if ((world.read(p2, PointerButtons).buttons & 1) === 0) continue;
12289
- for (const rec of world.getReverse(p2, Watches)) {
12320
+ const watchers = world.getReverse(p2, Watches);
12321
+ if (watchers.some((rec) => (world.hasTag(rec, MovesSelection) || world.hasTag(rec, RoutedMove)) && !world.hasTag(rec, GestureCancelled) && !world.hasTag(rec, GestureFailed) && !world.hasTag(rec, GestureEnded))) continue;
12322
+ for (const rec of watchers) {
12290
12323
  if (world.hasTag(rec, GestureCancelled) || world.hasTag(rec, GestureFailed) || world.hasTag(rec, GestureEnded)) continue;
12291
12324
  const e = world.getRelation(rec, Captures);
12292
12325
  if (e === void 0 || hands.has(e) || !world.isAlive(e) || !opts.isPrint(e)) continue;
@@ -12350,16 +12383,15 @@ var Photo2 = defineObject({
12350
12383
  blob: p.string({ default: "" }),
12351
12384
  width: p.number({ default: 0 }),
12352
12385
  height: p.number({ default: 0 }),
12386
+ // Legacy saved field: presentation follows the kind's law, borderless by default.
12353
12387
  border: p.number({ default: PHOTO.border }),
12354
12388
  angle: p.number({ default: 0 })
12355
12389
  },
12356
12390
  size: { w: printExtent(0, 0).w, h: printExtent(0, 0).h },
12357
12391
  kind: photoKind(),
12358
- // on the pegboard tray (design-017 §8): a print, clipped
12359
- // …showing the kind's sample picture (K5b, D-K5b.4) through its own pictures (`local`); one taken is blank — it asks for a picture
12360
- tray: { label: "Print", category: "paper", order: 1, props: { blob: SAMPLE_PICTURE, width: SAMPLE_SIZE.w, height: SAMPLE_SIZE.h }, local: true, hang: { w: 150, h: 100, accessory: "clip", pegs: [[0, -0.5]] } },
12392
+ // Created from an image (paste, drop, or a host's card), never as a blank tray specimen.
12361
12393
  // the wheel TURNS a print held in a hand (PHOTO.md; D3t-a — core cedes that pointer's wheel to it, `PressWheel`)
12362
- interaction: { selectable: true, movable: false, resizable: false, snap: "both", wheelTurns: true },
12394
+ interaction: { selectable: true, movable: "selection", resizable: false, snap: "both", wheelTurns: true },
12363
12395
  // it lies on the desk by what it provides (K8a — `DESK_OBJECT`, the desk canvas's one key), as a plugin kind does
12364
12396
  provides: [PHOTO_TYPE, DESK_OBJECT],
12365
12397
  // the prints' CARRY (D3w): the hands onto the photo kind's bodies, each rest ONE transaction out of the frame (D-D7-A.3)
@@ -12373,7 +12405,7 @@ function builtin(id) {
12373
12405
  if (tool === void 0) throw new Error(`desk: missing built-in tool ${id}`);
12374
12406
  return tool;
12375
12407
  }
12376
- var deskSelect = defineTool({ id: "desk.select", shortcut: "v", route: { canvasDrag: "pan", canvasDragShift: "marquee" } });
12408
+ var deskSelect = defineTool({ id: "desk.select", shortcut: "v", route: { canvasDrag: "marquee" } });
12377
12409
  var DESK_TOOLS = [builtin("select"), deskSelect, builtin("pan")];
12378
12410
  var DeskCanvas = defineCanvasType({
12379
12411
  id: "desk.desk",
@@ -12390,7 +12422,13 @@ var DESK_ENGINE = {
12390
12422
  canvasTypes: [DeskCanvas],
12391
12423
  rootCanvas: DeskCanvas,
12392
12424
  presentationFallback: DeskCanvas,
12393
- settings: { zoom: { min: ZOOM_MIN, max: ZOOM_MAX }, gestures: { wheel: "zoom" }, nav: { zoomThrough: { enabled: true } } }
12425
+ settings: {
12426
+ zoom: { min: ZOOM_MIN, max: ZOOM_MAX },
12427
+ // Chromium encodes native pinch scale as deltaY = -100 * log(scale).
12428
+ // exp(-deltaY * 0.01) restores that scale without damping the macOS gesture.
12429
+ gestures: { wheel: "pan", wheelZoomCurve: "exponential", wheelZoomRate: 0.01 },
12430
+ nav: { zoomThrough: { enabled: true } }
12431
+ }
12394
12432
  };
12395
12433
 
12396
12434
  // ../objects/src/palette.ts