@grafloria/element 0.4.57 → 0.4.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafloria/element",
3
- "version": "0.4.57",
3
+ "version": "0.4.58",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -697,6 +697,13 @@ export function bindDashboardGrid(api, group, options = {}) {
697
697
  if (!engine.getItem(id))
698
698
  return;
699
699
  engine.remove(id);
700
+ // THE LIVE BOUND FOLLOWS THE MEMBERS. A board that took rows from its
701
+ // parent to hold an arrival (D4) keeps that bound while the tile is here;
702
+ // when the tile leaves — an undo of the drop, a removal — the bound goes
703
+ // back to what the remaining tiles need, or the board stays a row taller
704
+ // than anything in it.
705
+ if (designRows !== undefined)
706
+ setLiveBound(liveBound(engine.getItems()));
700
707
  project();
701
708
  api.render();
702
709
  };
@@ -2394,9 +2401,8 @@ export function bindDashboardGrid(api, group, options = {}) {
2394
2401
  const squeezeBefore = squeezeRoom;
2395
2402
  let entered = engine.add({ id: node.id, x: 0, y: engine.rows(), w: span.w, h: span.h });
2396
2403
  // Only a board with NO parent tile to grow through squeezes — a page. A
2397
- // full SECTION keeps refusing (grid-options s05: refused, then joined once
2398
- // a strip was removed); growing its slab for a dropped tile is the
2399
- // escalation path's, not a squeeze's, and is not built yet.
2404
+ // full SECTION grows instead (D4, below): its height is a tile of its
2405
+ // parent, and the parent is what has the rows to give.
2400
2406
  if (!entered && !parentPeer()) {
2401
2407
  const room = elasticRows();
2402
2408
  if (room !== undefined && room > ((_a = bound()) !== null && _a !== void 0 ? _a : 0)) {
@@ -2405,7 +2411,38 @@ export function bindDashboardGrid(api, group, options = {}) {
2405
2411
  entered = engine.add({ id: node.id, x: 0, y: engine.rows(), w: span.w, h: span.h });
2406
2412
  }
2407
2413
  }
2414
+ let grown = null;
2415
+ const ungrow = () => {
2416
+ const g = grown;
2417
+ if (!g)
2418
+ return;
2419
+ g.peer.resizeMemberBy(group.id, -g.rows);
2420
+ setLiveBound(Math.max(1, (maxRows !== null && maxRows !== void 0 ? maxRows : 1) - g.rows));
2421
+ grown = null;
2422
+ };
2423
+ if (!entered && escalate) {
2424
+ const parent = parentPeer();
2425
+ let rowsAdded = 0;
2426
+ let firstBefore = null;
2427
+ let lastAfter = null;
2428
+ // At most the tile's own height in rows: past that the board is not
2429
+ // "full", it is smaller than the thing being dropped into it.
2430
+ for (let i = 0; parent && !entered && i < Math.max(1, span.h); i++) {
2431
+ const res = parent.resizeMemberBy(group.id, +1);
2432
+ if (!res.changed || !res.cellBefore || !res.cellAfter || !res.frameBefore || !res.frameAfter)
2433
+ break;
2434
+ rowsAdded += 1;
2435
+ firstBefore = firstBefore !== null && firstBefore !== void 0 ? firstBefore : { cell: res.cellBefore, frame: res.frameBefore };
2436
+ lastAfter = { cell: res.cellAfter, frame: res.frameAfter };
2437
+ setLiveBound((maxRows !== null && maxRows !== void 0 ? maxRows : 0) + 1);
2438
+ entered = engine.add({ id: node.id, x: 0, y: engine.rows(), w: span.w, h: span.h });
2439
+ }
2440
+ if (parent && rowsAdded > 0 && firstBefore && lastAfter) {
2441
+ grown = { peer: parent, rows: rowsAdded, cellBefore: firstBefore.cell, frameBefore: firstBefore.frame, cellAfter: lastAfter.cell, frameAfter: lastAfter.frame };
2442
+ }
2443
+ }
2408
2444
  if (!entered) {
2445
+ ungrow();
2409
2446
  setSqueeze(squeezeBefore);
2410
2447
  engine.endGesture();
2411
2448
  return null; // a bounded, full board refuses the adoption
@@ -2535,6 +2572,7 @@ export function bindDashboardGrid(api, group, options = {}) {
2535
2572
  if (engine.getItem(node.id))
2536
2573
  engine.remove(node.id);
2537
2574
  engine.cancelGesture(); // pre-entry layout, memory cleared
2575
+ ungrow(); // the rows this board took from its parent for the arrival go back (D4)
2538
2576
  setSqueeze(squeezeBefore);
2539
2577
  adoptedGhostId = null;
2540
2578
  disarmGlideSoon();
@@ -2555,6 +2593,11 @@ export function bindDashboardGrid(api, group, options = {}) {
2555
2593
  // Widgets AND sections this board's adoption displaced, as one list: a
2556
2594
  // dock or a push that moved a section commits it with the drop.
2557
2595
  const commands = tileCommands(deltasSince(startCells, startGeom, node.id));
2596
+ // …and the rows this board took from its parent to hold the arrival (D4).
2597
+ if (grown) {
2598
+ commands.push(new SetGroupCellCommand(group.id, grown.cellBefore, grown.cellAfter, grown.frameBefore, grown.frameAfter));
2599
+ grown = null;
2600
+ }
2558
2601
  engine.endGesture();
2559
2602
  pendingDrop = node.id; // the tile stays for the member the commit (or the host's drop-in) adds
2560
2603
  if (squeezeRoom !== undefined) {