@grafloria/element 0.4.60 → 0.4.61

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.60",
3
+ "version": "0.4.61",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -910,6 +910,52 @@ export function bindDashboardGrid(api, group, options = {}) {
910
910
  * come back by themselves when the widget leaves (S2).
911
911
  */
912
912
  let beside = null;
913
+ /**
914
+ * A VERTICAL BESIDE, HELD BUT NOT APPLIED (0.4.61). A container's top or
915
+ * bottom band pushes it a whole row along its own column — and the zone walk
916
+ * reads the container where it RESTS (0.4.60, which is what stopped the
917
+ * strip flickering), so the moment the push lands, the painted tabs sit a
918
+ * row below the only place that accepts them, and a hand following them down
919
+ * pushes them again. The user met it as "it pushes the entire tab group down
920
+ * and then I cannot go up to the tab header".
921
+ *
922
+ * So a vertical band moves NOTHING while the hand is held: an overlay marks
923
+ * the cell the widget will take and the container gives way on release — the
924
+ * rule a tab's dock and split previews have followed since 0.4.42. The LEFT
925
+ * and RIGHT bands keep their live slide (0.4.48): sideways, a full-width
926
+ * strip never leaves the hand, and the user missed that slide the one time
927
+ * it was frozen.
928
+ */
929
+ let pendingBeside = null;
930
+ let joinEl = null;
931
+ const showJoin = (r) => {
932
+ const layer = htmlLayer();
933
+ if (!layer)
934
+ return;
935
+ if (!joinEl || joinEl.parentElement !== layer) {
936
+ joinEl === null || joinEl === void 0 ? void 0 : joinEl.remove();
937
+ joinEl = document.createElement('div');
938
+ joinEl.className = 'axdb-join';
939
+ layer.prepend(joinEl);
940
+ }
941
+ joinEl.style.left = `${r.x}px`;
942
+ joinEl.style.top = `${r.y}px`;
943
+ joinEl.style.width = `${r.width}px`;
944
+ joinEl.style.height = `${r.height}px`;
945
+ };
946
+ const endPendingBeside = () => {
947
+ pendingBeside = null;
948
+ joinEl === null || joinEl === void 0 ? void 0 : joinEl.remove();
949
+ joinEl = null;
950
+ };
951
+ /** The cell a vertical beside would take: the container's own, or the row under it. Never the pointer's row — the container is not moving. */
952
+ const pendingCellOf = (containerId, side, spans) => {
953
+ const it = engine.getItem(containerId);
954
+ if (!it)
955
+ return null;
956
+ const x = Math.max(0, Math.min(engine.columns - spans.w, it.x));
957
+ return { x, y: side === 'top' ? it.y : it.y + it.h };
958
+ };
913
959
  const endBeside = (restore) => {
914
960
  if (!beside)
915
961
  return;
@@ -1292,6 +1338,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1292
1338
  showRefusal(null, 0, 0);
1293
1339
  }
1294
1340
  }
1341
+ endPendingBeside();
1295
1342
  disarmGlideSoon();
1296
1343
  releasePointer(g.pointerId);
1297
1344
  api.container.style.cursor = '';
@@ -1335,6 +1382,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1335
1382
  };
1336
1383
  const cancelActiveGesture = (notify = true) => {
1337
1384
  var _a, _b, _c;
1385
+ endPendingBeside();
1338
1386
  if (gesture === null || gesture === void 0 ? void 0 : gesture.strip) {
1339
1387
  (_a = options.tabDrop) === null || _a === void 0 ? void 0 : _a.markDrop(null, null);
1340
1388
  gesture.strip = null;
@@ -1483,6 +1531,7 @@ export function bindDashboardGrid(api, group, options = {}) {
1483
1531
  // -- INTO A STRIP: the widget becomes a new tab there, so it leaves
1484
1532
  // this board (survivors settle home) and the strip marks the slot.
1485
1533
  endBeside(true); // a band's shift gives way to the strip: the container comes back
1534
+ endPendingBeside();
1486
1535
  leaveSelf();
1487
1536
  setDim(g, false);
1488
1537
  if (!g.strip || g.strip.containerId !== z.containerId || g.strip.index !== z.index) {
@@ -1501,6 +1550,22 @@ export function bindDashboardGrid(api, group, options = {}) {
1501
1550
  // — at the board's edge the container shifts over to make room, live
1502
1551
  // and gliding, like any widget gives way (0.4.48). On THIS board the
1503
1552
  // engine is driven directly; on another board its leg drives it (4a).
1553
+ if (z.kind === 'beside' && !isStatic && z.board.ref === selfPeer && g.subject === 'node' && (z.side === 'top' || z.side === 'bottom')) {
1554
+ // -- A VERTICAL BAND: marked, not applied. Nothing moves until release.
1555
+ if (beside)
1556
+ endBeside(true);
1557
+ const cell = pendingCellOf(z.containerId, z.side, g.spans);
1558
+ if (cell) {
1559
+ leaveSelf();
1560
+ setDim(g, false);
1561
+ pendingBeside = { id: z.containerId, side: z.side, cell, spans: Object.assign({}, g.spans) };
1562
+ showJoin(cellToRect({ x: cell.x, y: cell.y, w: g.spans.w, h: g.spans.h }, frame(), geom(), rows()));
1563
+ syncPlaceholder();
1564
+ return;
1565
+ }
1566
+ }
1567
+ if (pendingBeside)
1568
+ endPendingBeside(); // the hand left the band: the mark goes
1504
1569
  if (z.kind === 'beside' && !isStatic && z.board.ref === selfPeer) {
1505
1570
  const row = rowOfPoint(ev.world.y);
1506
1571
  if (!z.kept || !beside || beside.row !== row)
@@ -1955,6 +2020,13 @@ export function bindDashboardGrid(api, group, options = {}) {
1955
2020
  (_b = options.onGesture) === null || _b === void 0 ? void 0 : _b.call(options, { type: 'commit', kind: g.kind, nodeId: g.id, changed: true });
1956
2021
  return;
1957
2022
  }
2023
+ if (pendingBeside) {
2024
+ // -- REALIZED ON RELEASE: the container held still while the hand chose;
2025
+ // now it gives way, and the commit below reads the settled layout.
2026
+ const p = pendingBeside;
2027
+ endPendingBeside();
2028
+ applyBeside(g, { id: p.id, side: p.side }, p.cell.y);
2029
+ }
1958
2030
  if (g.leg) {
1959
2031
  // -- CROSS-CONTAINER COMMIT: one batch across both boards -----------
1960
2032
  const fin = g.leg.adopted.finalize();
@@ -2209,7 +2281,15 @@ export function bindDashboardGrid(api, group, options = {}) {
2209
2281
  strip,
2210
2282
  prev: beside
2211
2283
  ? { containerId: beside.id, side: beside.side, frame0: beside.frame0, vacated: cellToRect({ x: beside.vacated.x, y: beside.vacated.y, w: g.spans.w, h: g.spans.h }, frame(), geom(), rows()) }
2212
- : ((_e = (_d = g.leg) === null || _d === void 0 ? void 0 : _d.adopted.besideState()) !== null && _e !== void 0 ? _e : null), // a beside another board holds for the ghost, through its leg
2284
+ : pendingBeside
2285
+ ? // a VERTICAL band the hand holds: the container never moved, so its own frame is the sticky one
2286
+ {
2287
+ containerId: pendingBeside.id,
2288
+ side: pendingBeside.side,
2289
+ frame0: (() => { const grp = diagram.getGroup(pendingBeside.id); return grp ? frameOfGroup(grp) : cellToRect({ x: pendingBeside.cell.x, y: pendingBeside.cell.y, w: pendingBeside.spans.w, h: pendingBeside.spans.h }, frame(), geom(), rows()); })(),
2290
+ vacated: cellToRect({ x: pendingBeside.cell.x, y: pendingBeside.cell.y, w: pendingBeside.spans.w, h: pendingBeside.spans.h }, frame(), geom(), rows()),
2291
+ }
2292
+ : ((_e = (_d = g.leg) === null || _d === void 0 ? void 0 : _d.adopted.besideState()) !== null && _e !== void 0 ? _e : null), // a beside another board holds for the ghost, through its leg
2213
2293
  maxDepth: nesting,
2214
2294
  ghostDepth: g.subject === 'group' ? 1 + levelsInside(g.id) : 0, // a group's widgets sit one board deeper than wherever it lands
2215
2295
  restFrames: rests,
@@ -3206,6 +3286,13 @@ export function bindDashboardGrid(api, group, options = {}) {
3206
3286
  chip === null || chip === void 0 ? void 0 : chip.remove();
3207
3287
  return;
3208
3288
  }
3289
+ if (commit && pendingBeside) {
3290
+ const p = pendingBeside;
3291
+ endPendingBeside();
3292
+ applyBeside(g, { id: p.id, side: p.side }, p.cell.y);
3293
+ }
3294
+ else
3295
+ endPendingBeside();
3209
3296
  if (commit && g.leg) {
3210
3297
  // Dropped into another board (a page, a section): its leg closes with
3211
3298
  // that board's displaced tiles; this board displaced nothing.