@grafloria/element 0.4.40 → 0.4.41

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.40",
3
+ "version": "0.4.41",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1051,6 +1051,30 @@ export function createDashboardHandle(ctx) {
1051
1051
  const label = (_e = pageSpec.title) !== null && _e !== void 0 ? _e : pageId;
1052
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) };
1053
1053
  const remaining = [...((_k = from.members) !== null && _k !== void 0 ? _k : [])].filter((m) => m !== pageId && !!model.getGroup(m));
1054
+ // The page that was showing when the gesture began. Undo puts the tab
1055
+ // back — and shows THAT page again, not the one the container switched to
1056
+ // when the tab left (the live walk: Filters showing, tear out, undo, Alerts
1057
+ // showing — 0.4.41). It goes FIRST in each move sequence so its undo runs
1058
+ // LAST, after the tab is back among the pages: a sync fired in between by
1059
+ // a neighbour's reflow would otherwise reset a page that is not there yet.
1060
+ const showing = ctx.activeTab.get(containerId);
1061
+ const showingAgain = () => new RegisterWidgetCommand({
1062
+ register: () => { },
1063
+ unregister: () => {
1064
+ var _a, _b, _c, _d;
1065
+ const cg = (_a = ctx.boardGroups.get(containerId)) !== null && _a !== void 0 ? _a : model.getGroup(containerId);
1066
+ const spec = specById.get(containerId);
1067
+ if (!showing || !cg || !spec || ctx.activeTab.get(containerId) === showing)
1068
+ return;
1069
+ if (!((_b = spec.widgets) !== null && _b !== void 0 ? _b : []).some((p) => p.id === showing) || !((_c = cg.members) === null || _c === void 0 ? void 0 : _c.has(showing)))
1070
+ return;
1071
+ ctx.activeTab.set(containerId, showing);
1072
+ spec.active = showing;
1073
+ const cw = (_d = cg.getMetadata('containerWidget')) !== null && _d !== void 0 ? _d : {};
1074
+ cg.setMetadata('containerWidget', Object.assign(Object.assign({}, cw), { active: showing }));
1075
+ teleport(ctx.container, () => { var _a; return (_a = ctx.syncTabs) === null || _a === void 0 ? void 0 : _a.call(ctx, containerId); });
1076
+ },
1077
+ }, 'register');
1054
1078
  return {
1055
1079
  arrivingId: W,
1056
1080
  label,
@@ -1120,6 +1144,7 @@ export function createDashboardHandle(ctx) {
1120
1144
  };
1121
1145
  const move = [
1122
1146
  new SequenceCommand('Move tab out', [
1147
+ showingAgain(),
1123
1148
  new AddGroupCommand(g),
1124
1149
  new RemoveFromGroupCommand(containerId, pageId),
1125
1150
  new AddToGroupCommand(W, pageId),
@@ -1202,6 +1227,7 @@ export function createDashboardHandle(ctx) {
1202
1227
  };
1203
1228
  const move = [
1204
1229
  new SequenceCommand('Move tab', [
1230
+ showingAgain(),
1205
1231
  new RemoveFromGroupCommand(containerId, pageId),
1206
1232
  new AddToGroupCommand(targetId, pageId),
1207
1233
  new RegisterWidgetCommand(joined, 'register'),