@grafloria/element 0.4.37 → 0.4.39

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.37",
3
+ "version": "0.4.39",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1038,7 +1038,15 @@ export function createDashboardHandle(ctx) {
1038
1038
  if (!model || !from || !pg || !pageSpec)
1039
1039
  return null;
1040
1040
  const viewId = (_c = ctx.viewOfBoard.get(containerId)) !== null && _c !== void 0 ? _c : ctx.active;
1041
- const W = `${pageId}__group`;
1041
+ // The new group's id. `${pageId}__group` is the usual — but when the page
1042
+ // is leaving the very group that was BORN from it (torn out twice), that
1043
+ // id is still taken until the emptied group closes later in the same
1044
+ // batch: AddGroup threw "already exists" mid-batch, the split preview
1045
+ // stayed applied and the chip stayed on screen (0.4.39). Take the next
1046
+ // free suffix instead.
1047
+ let W = `${pageId}__group`;
1048
+ for (let n = 2; model.getGroup(W) || ctx.boardGroups.has(W); n++)
1049
+ W = `${pageId}__group${n}`;
1042
1050
  const tabsOpts = (_d = ctx.tabsOf.get(containerId)) !== null && _d !== void 0 ? _d : {};
1043
1051
  const label = (_e = pageSpec.title) !== null && _e !== void 0 ? _e : pageId;
1044
1052
  const size = { width: (_g = (_f = pg.size) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 0, height: ((_j = (_h = pg.size) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : 0) + tabStripReserve(tabsOpts, 1) };
@@ -1486,8 +1494,13 @@ export function createDashboardHandle(ctx) {
1486
1494
  },
1487
1495
  setSizing(mode) {
1488
1496
  var _a;
1489
- for (const b of binders.values())
1490
- b.setSizing(mode);
1497
+ // THE VIEWS ONLY. A nested board (a page, a section) is bound fit with no
1498
+ // design height — its height is its container's business — and switched
1499
+ // to grow it painted its rows at the base height, 700 px past a torn-out
1500
+ // group or a split pane (0.4.38).
1501
+ for (const [id, b] of binders)
1502
+ if (groups.has(id))
1503
+ b.setSizing(mode);
1491
1504
  clampCamera();
1492
1505
  (_a = ctx.apiRef) === null || _a === void 0 ? void 0 : _a.renderNow();
1493
1506
  },
@@ -790,10 +790,12 @@ export function bindDashboardSplit(api, group, options = {}) {
790
790
  // nothing. One history step, like every other drop.
791
791
  let tearing = false;
792
792
  const EDGE_GRACE = 60;
793
+ /** The last batch the tear-out ran — the command manager may land it after this tick, so the board re-projects when it settles. */
794
+ let pendingBatch = undefined;
793
795
  const execute = (name, commands) => {
794
796
  if (commands.length === 0)
795
797
  return false;
796
- void execCommand(new BatchCommand(name, commands));
798
+ pendingBatch = execCommand(new BatchCommand(name, commands));
797
799
  return true;
798
800
  };
799
801
  const beginTearOut = (pageId, fromGroupId, ev, plan) => {
@@ -897,8 +899,22 @@ export function bindDashboardSplit(api, group, options = {}) {
897
899
  };
898
900
  const done = (changed, kind) => {
899
901
  tearing = false;
900
- project(readTree());
901
- api.renderNow();
902
+ // PAINT FROM THE TREE THAT WAS SET. The batch adds the group before it
903
+ // swaps the tree, and the board's member:added reconciles the interim
904
+ // tree by halving the LARGEST leaf; when the manager lands the batch
905
+ // after this tick, that interim projection is what stayed on the canvas
906
+ // (a pane 445 px off). Project now, and again once the batch settles.
907
+ const paint = () => {
908
+ if (disposed)
909
+ return;
910
+ project(readTree());
911
+ api.renderNow();
912
+ };
913
+ paint();
914
+ const p = pendingBatch;
915
+ pendingBatch = undefined;
916
+ if (p && typeof p.then === 'function')
917
+ void p.then(paint, () => undefined);
902
918
  fire({ type: kind, kind: 'move', nodeId: pageId, changed });
903
919
  };
904
920
  const finish = (commit) => {