@vibecook/ice 0.16.0-portals.4 → 0.16.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.
@@ -8,7 +8,7 @@ import {
8
8
  rasterPriority,
9
9
  stringProp,
10
10
  writable
11
- } from "./chunk-Z7POWSDB.js";
11
+ } from "./chunk-REJTEK3V.js";
12
12
  import "./chunk-BKV4ZEU3.js";
13
13
  import {
14
14
  compile,
@@ -4136,6 +4136,10 @@ function createBoardPen(opts) {
4136
4136
  const [x, y] = toSurface(G, at[0], at[1]);
4137
4137
  return [f32(x), f32(y)];
4138
4138
  };
4139
+ const boardInHand = () => {
4140
+ const held = heldEntity(world);
4141
+ return held !== void 0 && world.isAlive(held) && opts.isBoard(held) ? held : void 0;
4142
+ };
4139
4143
  const lift = (s, at, now) => {
4140
4144
  const ink = opts.ink();
4141
4145
  const G = opts.geometryOf(s.board);
@@ -4175,8 +4179,7 @@ function createBoardPen(opts) {
4175
4179
  };
4176
4180
  return {
4177
4181
  follow(now) {
4178
- const held = heldEntity(world);
4179
- const board2 = held !== void 0 && world.isAlive(held) && opts.isBoard(held) ? held : void 0;
4182
+ const board2 = boardInHand();
4180
4183
  if (last !== null && last.board !== board2) {
4181
4184
  if (stroke !== null && stroke.board === last.board) {
4182
4185
  lift(stroke, void 0, now);
@@ -4245,7 +4248,7 @@ function createBoardPen(opts) {
4245
4248
  ...screen !== void 0 ? { screen: [screen.x, screen.y], t: now } : {}
4246
4249
  });
4247
4250
  },
4248
- idle: () => stroke === null && last === null && heldEntity(world) === void 0,
4251
+ idle: () => stroke === null && last === null && boardInHand() === void 0,
4249
4252
  live: () => stroke === null ? null : { board: stroke.board, samples: stroke.points.length },
4250
4253
  commits: () => commits
4251
4254
  };
@@ -7427,7 +7430,8 @@ function createCalendarHand(opts) {
7427
7430
  for (const pad of [...homes.keys()]) if (!world.isAlive(pad) || !world.has(pad, PadSelection)) homes.delete(pad);
7428
7431
  },
7429
7432
  idle() {
7430
- if (heldEntity(world) !== void 0 || hands.size > 0 || peeked.size > 0 || marked.size > 0 || homes.size > 0 || glides.length > 0) return false;
7433
+ const held = heldEntity(world);
7434
+ 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
7435
  const pads = opts.pads();
7432
7436
  if (pads?.rollOwed() === true) return false;
7433
7437
  if (pads?.busy() === true && (world.resourceStamp(PointerVersion) !== seenPointer || world.resourceStamp(Camera) !== seenCamera)) return false;
@@ -10544,6 +10548,10 @@ function createNotebookHand(opts) {
10544
10548
  books.face(book, face);
10545
10549
  if (at !== spreadOf(books, book)) write(books, book, at);
10546
10550
  };
10551
+ const bookInHand = () => {
10552
+ const held = heldEntity(world);
10553
+ return held !== void 0 && world.isAlive(held) && opts.isBook(held) ? held : void 0;
10554
+ };
10547
10555
  const onPage = (G, at, s) => {
10548
10556
  const h = pageHitAt(G, at[0], at[1]);
10549
10557
  if (h === null || h.part !== "page") return null;
@@ -10583,10 +10591,9 @@ function createNotebookHand(opts) {
10583
10591
  });
10584
10592
  };
10585
10593
  return {
10586
- idle: () => stroke === null && turn === null && inHand === null && heldEntity(world) === void 0,
10594
+ idle: () => stroke === null && turn === null && inHand === null && bookInHand() === void 0,
10587
10595
  follow(now) {
10588
- const held = heldEntity(world);
10589
- const book = held !== void 0 && world.isAlive(held) && opts.isBook(held) ? held : void 0;
10596
+ const book = bookInHand();
10590
10597
  if (stroke !== null && !world.isAlive(stroke.book)) {
10591
10598
  opts.books()?.write(stroke.book, null);
10592
10599
  stroke = null;