@jossuealcala/madre 1.0.0 → 1.0.1

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.
@@ -573,6 +573,15 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
573
573
  now[key] = answer ?? { unreachable: true };
574
574
  if (now.loading) delete now.loading[key];
575
575
  if (!full) { now.dirty = true; redraw(); }
576
+ // A saturated machine can miss one read while the room is still alive. Do not keep
577
+ // that transient failure as the universe's permanent texture.
578
+ if (now[key].unreachable || now[key].outdated) setTimeout(() => {
579
+ const current = universes.find((item) => item.room.id === one.room.id);
580
+ if (!current || current.face !== one.face || (!current[key]?.unreachable && !current[key]?.outdated)) return;
581
+ current[key] = null;
582
+ if (full) { if (focus === current && !live) enterLive(current); }
583
+ else { current.dirty = true; redraw(); }
584
+ }, 5000);
576
585
  return now[key];
577
586
  });
578
587
  one.loading = { ...(one.loading ?? {}), [key]: asked };
@@ -1345,8 +1354,16 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
1345
1354
 
1346
1355
  // Pointer: a drag on the space moves it; a drag on the chosen universe turns it; a click picks a
1347
1356
  // universe, or a memory inside the chosen one; the wheel brings the space closer round the pointer.
1357
+ const covered = (event) => {
1358
+ const panels = [...windows.map((win) => win.el), card, ...document.querySelectorAll('dialog[open], .tree.window, .surface.window, .conv-window, .browser-dock.window')];
1359
+ return panels.some((panel) => {
1360
+ if (panel.hidden || panel.contains(canvas)) return false;
1361
+ const rect = panel.getBoundingClientRect();
1362
+ return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
1363
+ });
1364
+ };
1348
1365
  canvas.addEventListener('pointerdown', (event) => {
1349
- if (event.button !== 0) return;
1366
+ if (event.button !== 0 || covered(event)) return;
1350
1367
  drag.active = true;
1351
1368
  drag.moved = false;
1352
1369
  drag.turning = Boolean(liveAt(event)?.inside);
@@ -1357,6 +1374,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
1357
1374
  try { canvas.setPointerCapture(event.pointerId); } catch { /* the pointer already left */ }
1358
1375
  });
1359
1376
  canvas.addEventListener('pointermove', (event) => {
1377
+ if (covered(event)) return;
1360
1378
  const box = canvas.getBoundingClientRect();
1361
1379
  pointer = { x: event.clientX - box.left, y: event.clientY - box.top };
1362
1380
  if (drag.active) {
@@ -1400,7 +1418,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
1400
1418
  });
1401
1419
  const release = (event) => {
1402
1420
  // Let go over another universe: the notes of the one carried would travel to it.
1403
- if (linking?.over && event?.type === 'pointerup') actions.link?.(linking.from.room, linking.over.room);
1421
+ if (linking?.over && event?.type === 'pointerup' && !covered(event)) actions.link?.(linking.from.room, linking.over.room);
1404
1422
  linking = null;
1405
1423
  drag.active = false;
1406
1424
  drag.turning = false;
@@ -1412,6 +1430,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
1412
1430
  canvas.addEventListener('pointercancel', release);
1413
1431
  canvas.addEventListener('pointerleave', () => { hover = null; pointer = null; if (live) live.scene.hover = null; redraw(); });
1414
1432
  canvas.addEventListener('click', (event) => {
1433
+ if (covered(event)) return;
1415
1434
  if (drag.moved) { drag.moved = false; return; }
1416
1435
  const over = liveAt(event);
1417
1436
  if (over?.inside && live) {
@@ -1428,6 +1447,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
1428
1447
  choose(one && one !== focus ? one : focus && !one ? null : one);
1429
1448
  });
1430
1449
  canvas.addEventListener('wheel', (event) => {
1450
+ if (covered(event)) return;
1431
1451
  event.preventDefault();
1432
1452
  const rect = canvas.getBoundingClientRect();
1433
1453
  const px = event.clientX - rect.left, py = event.clientY - rect.top;