dockview-core 4.11.0 → 4.12.0

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.
Files changed (41) hide show
  1. package/dist/cjs/api/component.api.d.ts +3 -1
  2. package/dist/cjs/api/component.api.js +2 -2
  3. package/dist/cjs/dockview/components/panel/content.d.ts +7 -0
  4. package/dist/cjs/dockview/components/panel/content.js +11 -0
  5. package/dist/cjs/dockview/dockviewComponent.d.ts +7 -1
  6. package/dist/cjs/dockview/dockviewComponent.js +159 -84
  7. package/dist/cjs/dockview/dockviewGroupPanelModel.js +3 -0
  8. package/dist/cjs/dockview/dockviewPanel.d.ts +6 -4
  9. package/dist/cjs/dockview/dockviewPanel.js +12 -0
  10. package/dist/dockview-core.amd.js +119 -34
  11. package/dist/dockview-core.amd.js.map +1 -1
  12. package/dist/dockview-core.amd.min.js +2 -2
  13. package/dist/dockview-core.amd.min.js.map +1 -1
  14. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  15. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  16. package/dist/dockview-core.amd.noStyle.js +119 -34
  17. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  18. package/dist/dockview-core.cjs.js +119 -34
  19. package/dist/dockview-core.cjs.js.map +1 -1
  20. package/dist/dockview-core.esm.js +119 -34
  21. package/dist/dockview-core.esm.js.map +1 -1
  22. package/dist/dockview-core.esm.min.js +2 -2
  23. package/dist/dockview-core.esm.min.js.map +1 -1
  24. package/dist/dockview-core.js +119 -34
  25. package/dist/dockview-core.js.map +1 -1
  26. package/dist/dockview-core.min.js +2 -2
  27. package/dist/dockview-core.min.js.map +1 -1
  28. package/dist/dockview-core.min.noStyle.js +2 -2
  29. package/dist/dockview-core.min.noStyle.js.map +1 -1
  30. package/dist/dockview-core.noStyle.js +119 -34
  31. package/dist/dockview-core.noStyle.js.map +1 -1
  32. package/dist/esm/api/component.api.d.ts +3 -1
  33. package/dist/esm/api/component.api.js +2 -2
  34. package/dist/esm/dockview/components/panel/content.d.ts +7 -0
  35. package/dist/esm/dockview/components/panel/content.js +11 -0
  36. package/dist/esm/dockview/dockviewComponent.d.ts +7 -1
  37. package/dist/esm/dockview/dockviewComponent.js +90 -31
  38. package/dist/esm/dockview/dockviewGroupPanelModel.js +3 -0
  39. package/dist/esm/dockview/dockviewPanel.d.ts +6 -4
  40. package/dist/esm/dockview/dockviewPanel.js +12 -0
  41. package/package.json +1 -1
@@ -775,7 +775,7 @@ var DockviewComponent = /** @class */ (function (_super) {
775
775
  : (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
776
776
  var el = group.element.querySelector('.dv-void-container');
777
777
  if (!el) {
778
- throw new Error('failed to find drag handle');
778
+ throw new Error('dockview: failed to find drag handle');
779
779
  }
780
780
  overlay.setupDrag(el, {
781
781
  inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
@@ -849,7 +849,7 @@ var DockviewComponent = /** @class */ (function (_super) {
849
849
  case 'right':
850
850
  return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
851
851
  default:
852
- throw new Error("unsupported position ".concat(position));
852
+ throw new Error("dockview: unsupported position ".concat(position));
853
853
  }
854
854
  };
855
855
  DockviewComponent.prototype.updateOptions = function (options) {
@@ -1030,27 +1030,70 @@ var DockviewComponent = /** @class */ (function (_super) {
1030
1030
  }
1031
1031
  return result;
1032
1032
  };
1033
- DockviewComponent.prototype.fromJSON = function (data) {
1034
- var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f;
1033
+ DockviewComponent.prototype.fromJSON = function (data, options) {
1034
+ var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f, e_12, _g;
1035
1035
  var _this = this;
1036
- var _g, _h;
1036
+ var _h, _j;
1037
+ var existingPanels = new Map();
1038
+ var tempGroup;
1039
+ if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
1040
+ /**
1041
+ * What are we doing here?
1042
+ *
1043
+ * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
1044
+ * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
1045
+ */
1046
+ tempGroup = this.createGroup();
1047
+ this._groups.delete(tempGroup.api.id);
1048
+ var newPanels = Object.keys(data.panels);
1049
+ try {
1050
+ for (var _k = __values(this.panels), _l = _k.next(); !_l.done; _l = _k.next()) {
1051
+ var panel = _l.value;
1052
+ if (newPanels.includes(panel.api.id)) {
1053
+ existingPanels.set(panel.api.id, panel);
1054
+ }
1055
+ }
1056
+ }
1057
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1058
+ finally {
1059
+ try {
1060
+ if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
1061
+ }
1062
+ finally { if (e_6) throw e_6.error; }
1063
+ }
1064
+ this.movingLock(function () {
1065
+ Array.from(existingPanels.values()).forEach(function (panel) {
1066
+ _this.moveGroupOrPanel({
1067
+ from: {
1068
+ groupId: panel.api.group.api.id,
1069
+ panelId: panel.api.id,
1070
+ },
1071
+ to: {
1072
+ group: tempGroup,
1073
+ position: 'center',
1074
+ },
1075
+ keepEmptyGroups: true,
1076
+ });
1077
+ });
1078
+ });
1079
+ }
1037
1080
  this.clear();
1038
1081
  if (typeof data !== 'object' || data === null) {
1039
- throw new Error('serialized layout must be a non-null object');
1082
+ throw new Error('dockview: serialized layout must be a non-null object');
1040
1083
  }
1041
1084
  var grid = data.grid, panels = data.panels, activeGroup = data.activeGroup;
1042
1085
  if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
1043
- throw new Error('root must be of type branch');
1086
+ throw new Error('dockview: root must be of type branch');
1044
1087
  }
1045
1088
  try {
1046
1089
  // take note of the existing dimensions
1047
1090
  var width = this.width;
1048
1091
  var height = this.height;
1049
1092
  var createGroupFromSerializedState_1 = function (data) {
1050
- var e_12, _a;
1093
+ var e_13, _a;
1051
1094
  var id = data.id, locked = data.locked, hideHeader = data.hideHeader, views = data.views, activeView = data.activeView;
1052
1095
  if (typeof id !== 'string') {
1053
- throw new Error('group id must be of type string');
1096
+ throw new Error('dockview: group id must be of type string');
1054
1097
  }
1055
1098
  var group = _this.createGroup({
1056
1099
  id: id,
@@ -1059,33 +1102,60 @@ var DockviewComponent = /** @class */ (function (_super) {
1059
1102
  });
1060
1103
  _this._onDidAddGroup.fire(group);
1061
1104
  var createdPanels = [];
1105
+ var _loop_1 = function (child) {
1106
+ /**
1107
+ * Run the deserializer step seperately since this may fail to due corrupted external state.
1108
+ * In running this section first we avoid firing lots of 'add' events in the event of a failure
1109
+ * due to a corruption of input data.
1110
+ */
1111
+ var existingPanel = existingPanels.get(child);
1112
+ if (tempGroup && existingPanel) {
1113
+ _this.movingLock(function () {
1114
+ tempGroup.model.removePanel(existingPanel);
1115
+ });
1116
+ createdPanels.push(existingPanel);
1117
+ existingPanel.updateFromStateModel(panels[child]);
1118
+ }
1119
+ else {
1120
+ var panel = _this._deserializer.fromJSON(panels[child], group);
1121
+ createdPanels.push(panel);
1122
+ }
1123
+ };
1062
1124
  try {
1063
1125
  for (var views_1 = __values(views), views_1_1 = views_1.next(); !views_1_1.done; views_1_1 = views_1.next()) {
1064
1126
  var child = views_1_1.value;
1065
- /**
1066
- * Run the deserializer step seperately since this may fail to due corrupted external state.
1067
- * In running this section first we avoid firing lots of 'add' events in the event of a failure
1068
- * due to a corruption of input data.
1069
- */
1070
- var panel = _this._deserializer.fromJSON(panels[child], group);
1071
- createdPanels.push(panel);
1127
+ _loop_1(child);
1072
1128
  }
1073
1129
  }
1074
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1130
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1075
1131
  finally {
1076
1132
  try {
1077
1133
  if (views_1_1 && !views_1_1.done && (_a = views_1.return)) _a.call(views_1);
1078
1134
  }
1079
- finally { if (e_12) throw e_12.error; }
1135
+ finally { if (e_13) throw e_13.error; }
1080
1136
  }
1081
- for (var i = 0; i < views.length; i++) {
1137
+ var _loop_2 = function (i) {
1082
1138
  var panel = createdPanels[i];
1083
1139
  var isActive = typeof activeView === 'string' &&
1084
1140
  activeView === panel.id;
1085
- group.model.openPanel(panel, {
1086
- skipSetActive: !isActive,
1087
- skipSetGroupActive: true,
1088
- });
1141
+ var hasExisting = existingPanels.has(panel.api.id);
1142
+ if (hasExisting) {
1143
+ _this.movingLock(function () {
1144
+ group.model.openPanel(panel, {
1145
+ skipSetActive: !isActive,
1146
+ skipSetGroupActive: true,
1147
+ });
1148
+ });
1149
+ }
1150
+ else {
1151
+ group.model.openPanel(panel, {
1152
+ skipSetActive: !isActive,
1153
+ skipSetGroupActive: true,
1154
+ });
1155
+ }
1156
+ };
1157
+ for (var i = 0; i < views.length; i++) {
1158
+ _loop_2(i);
1089
1159
  }
1090
1160
  if (!group.activePanel && group.panels.length > 0) {
1091
1161
  group.model.openPanel(group.panels[group.panels.length - 1], {
@@ -1100,7 +1170,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1100
1170
  },
1101
1171
  });
1102
1172
  this.layout(width, height, true);
1103
- var serializedFloatingGroups = (_g = data.floatingGroups) !== null && _g !== void 0 ? _g : [];
1173
+ var serializedFloatingGroups = (_h = data.floatingGroups) !== null && _h !== void 0 ? _h : [];
1104
1174
  try {
1105
1175
  for (var serializedFloatingGroups_1 = __values(serializedFloatingGroups), serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next(); !serializedFloatingGroups_1_1.done; serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next()) {
1106
1176
  var serializedFloatingGroup = serializedFloatingGroups_1_1.value;
@@ -1115,14 +1185,14 @@ var DockviewComponent = /** @class */ (function (_super) {
1115
1185
  });
1116
1186
  }
1117
1187
  }
1118
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1188
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1119
1189
  finally {
1120
1190
  try {
1121
- if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (_a = serializedFloatingGroups_1.return)) _a.call(serializedFloatingGroups_1);
1191
+ if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (_b = serializedFloatingGroups_1.return)) _b.call(serializedFloatingGroups_1);
1122
1192
  }
1123
- finally { if (e_6) throw e_6.error; }
1193
+ finally { if (e_7) throw e_7.error; }
1124
1194
  }
1125
- var serializedPopoutGroups = (_h = data.popoutGroups) !== null && _h !== void 0 ? _h : [];
1195
+ var serializedPopoutGroups = (_j = data.popoutGroups) !== null && _j !== void 0 ? _j : [];
1126
1196
  // Create a promise that resolves when all popout groups are created
1127
1197
  var popoutPromises_1 = [];
1128
1198
  // Queue popup group creation with delays to avoid browser blocking
@@ -1134,7 +1204,9 @@ var DockviewComponent = /** @class */ (function (_super) {
1134
1204
  setTimeout(function () {
1135
1205
  _this.addPopoutGroup(group, {
1136
1206
  position: position !== null && position !== void 0 ? position : undefined,
1137
- overridePopoutGroup: gridReferenceGroup ? group : undefined,
1207
+ overridePopoutGroup: gridReferenceGroup
1208
+ ? group
1209
+ : undefined,
1138
1210
  referenceGroup: gridReferenceGroup
1139
1211
  ? _this.getPanel(gridReferenceGroup)
1140
1212
  : undefined,
@@ -1148,17 +1220,17 @@ var DockviewComponent = /** @class */ (function (_super) {
1148
1220
  // Store the promise for tests to wait on
1149
1221
  this._popoutRestorationPromise = Promise.all(popoutPromises_1).then(function () { return void 0; });
1150
1222
  try {
1151
- for (var _j = __values(this._floatingGroups), _k = _j.next(); !_k.done; _k = _j.next()) {
1152
- var floatingGroup = _k.value;
1223
+ for (var _m = __values(this._floatingGroups), _o = _m.next(); !_o.done; _o = _m.next()) {
1224
+ var floatingGroup = _o.value;
1153
1225
  floatingGroup.overlay.setBounds();
1154
1226
  }
1155
1227
  }
1156
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1228
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1157
1229
  finally {
1158
1230
  try {
1159
- if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
1231
+ if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
1160
1232
  }
1161
- finally { if (e_7) throw e_7.error; }
1233
+ finally { if (e_8) throw e_8.error; }
1162
1234
  }
1163
1235
  if (typeof activeGroup === 'string') {
1164
1236
  var panel = this.getPanel(activeGroup);
@@ -1173,65 +1245,65 @@ var DockviewComponent = /** @class */ (function (_super) {
1173
1245
  /**
1174
1246
  * Takes all the successfully created groups and remove all of their panels.
1175
1247
  */
1176
- for (var _l = __values(this.groups), _m = _l.next(); !_m.done; _m = _l.next()) {
1177
- var group = _m.value;
1248
+ for (var _p = __values(this.groups), _q = _p.next(); !_q.done; _q = _p.next()) {
1249
+ var group = _q.value;
1178
1250
  try {
1179
- for (var _o = (e_9 = void 0, __values(group.panels)), _p = _o.next(); !_p.done; _p = _o.next()) {
1180
- var panel = _p.value;
1251
+ for (var _r = (e_10 = void 0, __values(group.panels)), _s = _r.next(); !_s.done; _s = _r.next()) {
1252
+ var panel = _s.value;
1181
1253
  this.removePanel(panel, {
1182
1254
  removeEmptyGroup: false,
1183
1255
  skipDispose: false,
1184
1256
  });
1185
1257
  }
1186
1258
  }
1187
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
1259
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
1188
1260
  finally {
1189
1261
  try {
1190
- if (_p && !_p.done && (_d = _o.return)) _d.call(_o);
1262
+ if (_s && !_s.done && (_e = _r.return)) _e.call(_r);
1191
1263
  }
1192
- finally { if (e_9) throw e_9.error; }
1264
+ finally { if (e_10) throw e_10.error; }
1193
1265
  }
1194
1266
  }
1195
1267
  }
1196
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
1268
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1197
1269
  finally {
1198
1270
  try {
1199
- if (_m && !_m.done && (_c = _l.return)) _c.call(_l);
1271
+ if (_q && !_q.done && (_d = _p.return)) _d.call(_p);
1200
1272
  }
1201
- finally { if (e_8) throw e_8.error; }
1273
+ finally { if (e_9) throw e_9.error; }
1202
1274
  }
1203
1275
  try {
1204
1276
  /**
1205
1277
  * To remove a group we cannot call this.removeGroup(...) since this makes assumptions about
1206
1278
  * the underlying HTMLElement existing in the Gridview.
1207
1279
  */
1208
- for (var _q = __values(this.groups), _r = _q.next(); !_r.done; _r = _q.next()) {
1209
- var group = _r.value;
1280
+ for (var _t = __values(this.groups), _u = _t.next(); !_u.done; _u = _t.next()) {
1281
+ var group = _u.value;
1210
1282
  group.dispose();
1211
1283
  this._groups.delete(group.id);
1212
1284
  this._onDidRemoveGroup.fire(group);
1213
1285
  }
1214
1286
  }
1215
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
1287
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
1216
1288
  finally {
1217
1289
  try {
1218
- if (_r && !_r.done && (_e = _q.return)) _e.call(_q);
1290
+ if (_u && !_u.done && (_f = _t.return)) _f.call(_t);
1219
1291
  }
1220
- finally { if (e_10) throw e_10.error; }
1292
+ finally { if (e_11) throw e_11.error; }
1221
1293
  }
1222
1294
  try {
1223
1295
  // iterate over a reassigned array since original array will be modified
1224
- for (var _s = __values(__spreadArray([], __read(this._floatingGroups), false)), _t = _s.next(); !_t.done; _t = _s.next()) {
1225
- var floatingGroup = _t.value;
1296
+ for (var _v = __values(__spreadArray([], __read(this._floatingGroups), false)), _w = _v.next(); !_w.done; _w = _v.next()) {
1297
+ var floatingGroup = _w.value;
1226
1298
  floatingGroup.dispose();
1227
1299
  }
1228
1300
  }
1229
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1301
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
1230
1302
  finally {
1231
1303
  try {
1232
- if (_t && !_t.done && (_f = _s.return)) _f.call(_s);
1304
+ if (_w && !_w.done && (_g = _v.return)) _g.call(_v);
1233
1305
  }
1234
- finally { if (e_11) throw e_11.error; }
1306
+ finally { if (e_12) throw e_12.error; }
1235
1307
  }
1236
1308
  // fires clean-up events and clears the underlying HTML gridview.
1237
1309
  this.clear();
@@ -1250,7 +1322,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1250
1322
  this._onDidLayoutFromJSON.fire();
1251
1323
  };
1252
1324
  DockviewComponent.prototype.clear = function () {
1253
- var e_13, _a;
1325
+ var e_14, _a;
1254
1326
  var groups = Array.from(this._groups.values()).map(function (_) { return _.value; });
1255
1327
  var hasActiveGroup = !!this.activeGroup;
1256
1328
  try {
@@ -1260,12 +1332,12 @@ var DockviewComponent = /** @class */ (function (_super) {
1260
1332
  this.removeGroup(group, { skipActive: true });
1261
1333
  }
1262
1334
  }
1263
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
1335
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
1264
1336
  finally {
1265
1337
  try {
1266
1338
  if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
1267
1339
  }
1268
- finally { if (e_13) throw e_13.error; }
1340
+ finally { if (e_14) throw e_14.error; }
1269
1341
  }
1270
1342
  if (hasActiveGroup) {
1271
1343
  this.doSetGroupAndPanelActive(undefined);
@@ -1273,7 +1345,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1273
1345
  this.gridview.clear();
1274
1346
  };
1275
1347
  DockviewComponent.prototype.closeAllGroups = function () {
1276
- var e_14, _a;
1348
+ var e_15, _a;
1277
1349
  try {
1278
1350
  for (var _b = __values(this._groups.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
1279
1351
  var entry = _c.value;
@@ -1281,22 +1353,22 @@ var DockviewComponent = /** @class */ (function (_super) {
1281
1353
  group.value.model.closeAllPanels();
1282
1354
  }
1283
1355
  }
1284
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
1356
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1285
1357
  finally {
1286
1358
  try {
1287
1359
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1288
1360
  }
1289
- finally { if (e_14) throw e_14.error; }
1361
+ finally { if (e_15) throw e_15.error; }
1290
1362
  }
1291
1363
  };
1292
1364
  DockviewComponent.prototype.addPanel = function (options) {
1293
1365
  var _a, _b;
1294
1366
  if (this.panels.find(function (_) { return _.id === options.id; })) {
1295
- throw new Error("panel with id ".concat(options.id, " already exists"));
1367
+ throw new Error("dockview: panel with id ".concat(options.id, " already exists"));
1296
1368
  }
1297
1369
  var referenceGroup;
1298
1370
  if (options.position && options.floating) {
1299
- throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
1371
+ throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
1300
1372
  }
1301
1373
  var initial = {
1302
1374
  width: options.initialWidth,
@@ -1310,7 +1382,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1310
1382
  : options.position.referencePanel;
1311
1383
  index = options.position.index;
1312
1384
  if (!referencePanel) {
1313
- throw new Error("referencePanel '".concat(options.position.referencePanel, "' does not exist"));
1385
+ throw new Error("dockview: referencePanel '".concat(options.position.referencePanel, "' does not exist"));
1314
1386
  }
1315
1387
  referenceGroup = this.findGroup(referencePanel);
1316
1388
  }
@@ -1321,7 +1393,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1321
1393
  : options.position.referenceGroup;
1322
1394
  index = options.position.index;
1323
1395
  if (!referenceGroup) {
1324
- throw new Error("referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
1396
+ throw new Error("dockview: referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
1325
1397
  }
1326
1398
  }
1327
1399
  else {
@@ -1434,7 +1506,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1434
1506
  }; }
1435
1507
  var group = panel.group;
1436
1508
  if (!group) {
1437
- throw new Error("cannot remove panel ".concat(panel.id, ". it's missing a group."));
1509
+ throw new Error("dockview: cannot remove panel ".concat(panel.id, ". it's missing a group."));
1438
1510
  }
1439
1511
  group.model.removePanel(panel, {
1440
1512
  skipSetActiveGroup: options.skipSetActiveGroup,
@@ -1483,11 +1555,11 @@ var DockviewComponent = /** @class */ (function (_super) {
1483
1555
  ? this.panels.find(function (panel) { return panel.id === options.referencePanel; })
1484
1556
  : options.referencePanel;
1485
1557
  if (!referencePanel) {
1486
- throw new Error("reference panel ".concat(options.referencePanel, " does not exist"));
1558
+ throw new Error("dockview: reference panel ".concat(options.referencePanel, " does not exist"));
1487
1559
  }
1488
1560
  referenceGroup = this.findGroup(referencePanel);
1489
1561
  if (!referenceGroup) {
1490
- throw new Error("reference group for reference panel ".concat(options.referencePanel, " does not exist"));
1562
+ throw new Error("dockview: reference group for reference panel ".concat(options.referencePanel, " does not exist"));
1491
1563
  }
1492
1564
  }
1493
1565
  else if ((0, options_1.isGroupOptionsWithGroup)(options)) {
@@ -1496,7 +1568,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1496
1568
  ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
1497
1569
  : options.referenceGroup;
1498
1570
  if (!referenceGroup) {
1499
- throw new Error("reference group ".concat(options.referenceGroup, " does not exist"));
1571
+ throw new Error("dockview: reference group ".concat(options.referenceGroup, " does not exist"));
1500
1572
  }
1501
1573
  }
1502
1574
  else {
@@ -1537,7 +1609,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1537
1609
  this.doRemoveGroup(group, options);
1538
1610
  };
1539
1611
  DockviewComponent.prototype.doRemoveGroup = function (group, options) {
1540
- var e_15, _a;
1612
+ var e_16, _a;
1541
1613
  var _b;
1542
1614
  var panels = __spreadArray([], __read(group.panels), false); // reassign since group panels will mutate
1543
1615
  if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
@@ -1550,12 +1622,12 @@ var DockviewComponent = /** @class */ (function (_super) {
1550
1622
  });
1551
1623
  }
1552
1624
  }
1553
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
1625
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
1554
1626
  finally {
1555
1627
  try {
1556
1628
  if (panels_1_1 && !panels_1_1.done && (_a = panels_1.return)) _a.call(panels_1);
1557
1629
  }
1558
- finally { if (e_15) throw e_15.error; }
1630
+ finally { if (e_16) throw e_16.error; }
1559
1631
  }
1560
1632
  }
1561
1633
  var activePanel = this.activePanel;
@@ -1575,7 +1647,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1575
1647
  }
1576
1648
  return floatingGroup.group;
1577
1649
  }
1578
- throw new Error('failed to find floating group');
1650
+ throw new Error('dockview: failed to find floating group');
1579
1651
  }
1580
1652
  if (group.api.location.type === 'popout') {
1581
1653
  var selectedGroup = this._popoutGroups.find(function (_) { return _.popoutGroup === group; });
@@ -1606,7 +1678,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1606
1678
  this.updateWatermark();
1607
1679
  return selectedGroup.popoutGroup;
1608
1680
  }
1609
- throw new Error('failed to find popout group');
1681
+ throw new Error('dockview: failed to find popout group');
1610
1682
  }
1611
1683
  var re = _super.prototype.doRemoveGroup.call(this, group, options);
1612
1684
  if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
@@ -1638,7 +1710,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1638
1710
  ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
1639
1711
  : undefined;
1640
1712
  if (!sourceGroup) {
1641
- throw new Error("Failed to find group id ".concat(sourceGroupId));
1713
+ throw new Error("dockview: Failed to find group id ".concat(sourceGroupId));
1642
1714
  }
1643
1715
  if (sourceItemId === undefined) {
1644
1716
  /**
@@ -1665,9 +1737,9 @@ var DockviewComponent = /** @class */ (function (_super) {
1665
1737
  });
1666
1738
  });
1667
1739
  if (!removedPanel_1) {
1668
- throw new Error("No panel with id ".concat(sourceItemId));
1740
+ throw new Error("dockview: No panel with id ".concat(sourceItemId));
1669
1741
  }
1670
- if (sourceGroup.model.size === 0) {
1742
+ if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
1671
1743
  // remove the group and do not set a new group as active
1672
1744
  this.doRemoveGroup(sourceGroup, { skipActive: true });
1673
1745
  }
@@ -1677,7 +1749,8 @@ var DockviewComponent = /** @class */ (function (_super) {
1677
1749
  var _a;
1678
1750
  return destinationGroup.model.openPanel(removedPanel_1, {
1679
1751
  index: destinationIndex,
1680
- skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty_1,
1752
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
1753
+ !isDestinationGroupEmpty_1,
1681
1754
  skipSetGroupActive: true,
1682
1755
  });
1683
1756
  });
@@ -1735,7 +1808,9 @@ var DockviewComponent = /** @class */ (function (_super) {
1735
1808
  this.doRemoveGroup(sourceGroup, { skipActive: true });
1736
1809
  var newGroup_1 = this.createGroupAtLocation(targetLocation);
1737
1810
  this.movingLock(function () {
1738
- return newGroup_1.model.openPanel(removedPanel_2);
1811
+ return newGroup_1.model.openPanel(removedPanel_2, {
1812
+ skipSetActive: true,
1813
+ });
1739
1814
  });
1740
1815
  this.doSetGroupAndPanelActive(newGroup_1);
1741
1816
  this._onDidMovePanel.fire({
@@ -1773,7 +1848,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1773
1848
  });
1774
1849
  });
1775
1850
  if (!removedPanel_3) {
1776
- throw new Error("No panel with id ".concat(sourceItemId));
1851
+ throw new Error("dockview: No panel with id ".concat(sourceItemId));
1777
1852
  }
1778
1853
  var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, destinationTarget);
1779
1854
  var group_2 = this.createGroupAtLocation(dropLocation);
@@ -1808,7 +1883,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1808
1883
  this.doRemoveGroup(from, { skipActive: true });
1809
1884
  }
1810
1885
  this.movingLock(function () {
1811
- var e_16, _a;
1886
+ var e_17, _a;
1812
1887
  try {
1813
1888
  for (var panels_3 = __values(panels_2), panels_3_1 = panels_3.next(); !panels_3_1.done; panels_3_1 = panels_3.next()) {
1814
1889
  var panel = panels_3_1.value;
@@ -1818,12 +1893,12 @@ var DockviewComponent = /** @class */ (function (_super) {
1818
1893
  });
1819
1894
  }
1820
1895
  }
1821
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
1896
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
1822
1897
  finally {
1823
1898
  try {
1824
1899
  if (panels_3_1 && !panels_3_1.done && (_a = panels_3.return)) _a.call(panels_3);
1825
1900
  }
1826
- finally { if (e_16) throw e_16.error; }
1901
+ finally { if (e_17) throw e_17.error; }
1827
1902
  }
1828
1903
  });
1829
1904
  // Ensure group becomes active after move
@@ -1846,7 +1921,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1846
1921
  case 'floating': {
1847
1922
  var selectedFloatingGroup = this._floatingGroups.find(function (x) { return x.group === from; });
1848
1923
  if (!selectedFloatingGroup) {
1849
- throw new Error('failed to find floating group');
1924
+ throw new Error('dockview: failed to find floating group');
1850
1925
  }
1851
1926
  selectedFloatingGroup.dispose();
1852
1927
  break;
@@ -1854,7 +1929,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1854
1929
  case 'popout': {
1855
1930
  var selectedPopoutGroup = this._popoutGroups.find(function (x) { return x.popoutGroup === from; });
1856
1931
  if (!selectedPopoutGroup) {
1857
- throw new Error('failed to find popout group');
1932
+ throw new Error('dockview: failed to find popout group');
1858
1933
  }
1859
1934
  // Remove from popout groups list to prevent automatic restoration
1860
1935
  var index = this._popoutGroups.indexOf(selectedPopoutGroup);
@@ -651,8 +651,11 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
651
651
  this._activePanel = panel;
652
652
  if (panel) {
653
653
  this.tabsContainer.setActivePanel(panel);
654
+ this.contentContainer.openPanel(panel);
654
655
  panel.layout(this._width, this._height);
655
656
  this.updateMru(panel);
657
+ // Refresh focus state to handle programmatic activation without DOM focus change
658
+ this.contentContainer.refreshFocusState();
656
659
  this._onDidActivePanelChange.fire({
657
660
  panel: panel,
658
661
  });
@@ -21,6 +21,7 @@ export interface IDockviewPanel extends IDisposable, IPanel {
21
21
  updateParentGroup(group: DockviewGroupPanel, options?: {
22
22
  skipSetActive?: boolean;
23
23
  }): void;
24
+ updateFromStateModel(state: GroupviewPanelState): void;
24
25
  init(params: IGroupPanelInitParameters): void;
25
26
  toJSON(): GroupviewPanelState;
26
27
  setTitle(title: string): void;
@@ -37,10 +38,10 @@ export declare class DockviewPanel extends CompositeDisposable implements IDockv
37
38
  private _params?;
38
39
  private _title;
39
40
  private _renderer;
40
- private readonly _minimumWidth;
41
- private readonly _minimumHeight;
42
- private readonly _maximumWidth;
43
- private readonly _maximumHeight;
41
+ private _minimumWidth;
42
+ private _minimumHeight;
43
+ private _maximumWidth;
44
+ private _maximumHeight;
44
45
  get params(): Parameters | undefined;
45
46
  get title(): string | undefined;
46
47
  get group(): DockviewGroupPanel;
@@ -58,6 +59,7 @@ export declare class DockviewPanel extends CompositeDisposable implements IDockv
58
59
  setTitle(title: string): void;
59
60
  setRenderer(renderer: DockviewPanelRenderer): void;
60
61
  update(event: PanelUpdateEvent): void;
62
+ updateFromStateModel(state: GroupviewPanelState): void;
61
63
  updateParentGroup(group: DockviewGroupPanel, options?: {
62
64
  skipSetActive?: boolean;
63
65
  }): void;
@@ -200,6 +200,18 @@ var DockviewPanel = /** @class */ (function (_super) {
200
200
  params: this._params,
201
201
  });
202
202
  };
203
+ DockviewPanel.prototype.updateFromStateModel = function (state) {
204
+ var _a, _b, _c;
205
+ this._maximumHeight = state.maximumHeight;
206
+ this._minimumHeight = state.minimumHeight;
207
+ this._maximumWidth = state.maximumWidth;
208
+ this._minimumWidth = state.minimumWidth;
209
+ this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
210
+ this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
211
+ this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
212
+ // state.contentComponent;
213
+ // state.tabComponent;
214
+ };
203
215
  DockviewPanel.prototype.updateParentGroup = function (group, options) {
204
216
  this._group = group;
205
217
  this.api.group = this._group;