@interopio/workspaces-api 4.0.1 → 4.1.0-beta.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.
- package/changelog.md +2 -0
- package/dist/workspaces.es.js +46 -17
- package/dist/workspaces.es.js.map +1 -1
- package/dist/workspaces.umd.js +46 -17
- package/dist/workspaces.umd.js.map +1 -1
- package/dist/workspaces.umd.min.js +1 -1
- package/package.json +3 -3
package/dist/workspaces.umd.js
CHANGED
|
@@ -1601,6 +1601,7 @@
|
|
|
1601
1601
|
maximizeItem: { name: "maximizeItem", argsDecoder: simpleItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1602
1602
|
focusItem: { name: "focusItem", argsDecoder: simpleItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1603
1603
|
closeItem: { name: "closeItem", argsDecoder: closeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1604
|
+
closeWorkspace: { name: "closeWorkspace", argsDecoder: closeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1604
1605
|
resizeItem: { name: "resizeItem", argsDecoder: resizeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1605
1606
|
setMaximizationBoundary: { name: "setMaximizationBoundary", argsDecoder: setMaximizationBoundaryConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1606
1607
|
changeFrameState: { name: "changeFrameState", argsDecoder: frameStateConfigDecoder, resultDecoder: voidResultDecoder },
|
|
@@ -2781,15 +2782,7 @@
|
|
|
2781
2782
|
}
|
|
2782
2783
|
async close() {
|
|
2783
2784
|
const controller = getData$3(this).controller;
|
|
2784
|
-
|
|
2785
|
-
const platformFrameId = (await controller.getPlatformFrameId()).id;
|
|
2786
|
-
const shouldCloseFrame = workspaces.length === 1 &&
|
|
2787
|
-
workspaces.every((wsp) => wsp.id === this.id) &&
|
|
2788
|
-
platformFrameId !== this.frame.id;
|
|
2789
|
-
if (shouldCloseFrame) {
|
|
2790
|
-
return this.frame.close();
|
|
2791
|
-
}
|
|
2792
|
-
await controller.closeItem(this.id);
|
|
2785
|
+
await controller.closeWorkspace(this.id, this.frameId);
|
|
2793
2786
|
}
|
|
2794
2787
|
snapshot() {
|
|
2795
2788
|
return getData$3(this).controller.getSnapshot(this.id, "workspace");
|
|
@@ -3346,7 +3339,8 @@
|
|
|
3346
3339
|
throw new Error("Cannot eject this window, because it is not loaded yet");
|
|
3347
3340
|
}
|
|
3348
3341
|
const itemId = getData$2(this).id;
|
|
3349
|
-
const
|
|
3342
|
+
const windowId = getData$2(this).config.windowId;
|
|
3343
|
+
const newWindowId = await getData$2(this).controller.ejectWindow(itemId, windowId);
|
|
3350
3344
|
getData$2(this).config.windowId = newWindowId;
|
|
3351
3345
|
await this.workspace.refreshReference();
|
|
3352
3346
|
return this.getGdWindow();
|
|
@@ -4289,6 +4283,9 @@
|
|
|
4289
4283
|
async focusItem(itemId) {
|
|
4290
4284
|
await this.bridge.send(OPERATIONS.focusItem.name, { itemId });
|
|
4291
4285
|
}
|
|
4286
|
+
async closeWorkspace(workspaceId) {
|
|
4287
|
+
await this.bridge.send(OPERATIONS.closeWorkspace.name, { itemId: workspaceId });
|
|
4288
|
+
}
|
|
4292
4289
|
async closeItem(itemId) {
|
|
4293
4290
|
await this.bridge.send(OPERATIONS.closeItem.name, { itemId });
|
|
4294
4291
|
}
|
|
@@ -4320,8 +4317,8 @@
|
|
|
4320
4317
|
const controlResult = await this.bridge.send(OPERATIONS.forceLoadWindow.name, { itemId });
|
|
4321
4318
|
return controlResult.windowId;
|
|
4322
4319
|
}
|
|
4323
|
-
async ejectWindow(itemId) {
|
|
4324
|
-
return await this.bridge.send(OPERATIONS.ejectWindow.name, { itemId });
|
|
4320
|
+
async ejectWindow(itemId, windowId) {
|
|
4321
|
+
return await this.bridge.send(OPERATIONS.ejectWindow.name, { itemId, windowId });
|
|
4325
4322
|
}
|
|
4326
4323
|
async moveWindowTo(itemId, newParentId) {
|
|
4327
4324
|
await this.bridge.send(OPERATIONS.moveWindowTo.name, { itemId, containerId: newParentId });
|
|
@@ -4603,6 +4600,11 @@
|
|
|
4603
4600
|
}));
|
|
4604
4601
|
return workspacesForFrame;
|
|
4605
4602
|
}
|
|
4603
|
+
async isLastWorkspaceInFrame(workspaceId, frameId) {
|
|
4604
|
+
const workspaceSummaries = await this.getAllWorkspaceSummaries();
|
|
4605
|
+
const summariesForFrame = workspaceSummaries.filter((s) => s.frameId === frameId);
|
|
4606
|
+
return summariesForFrame.length === 1 && summariesForFrame[0].id === workspaceId;
|
|
4607
|
+
}
|
|
4606
4608
|
async getAllWorkspaceSummaries() {
|
|
4607
4609
|
const allSummariesResult = await this.bridge.send(OPERATIONS.getAllWorkspacesSummaries.name, {});
|
|
4608
4610
|
return this.base.getAllWorkspaceSummaries(allSummariesResult);
|
|
@@ -4704,6 +4706,23 @@
|
|
|
4704
4706
|
const frameResult = await this.bridge.send(OPERATIONS.getFrameState.name, { itemId: frameId });
|
|
4705
4707
|
return frameResult.state;
|
|
4706
4708
|
}
|
|
4709
|
+
async closeWorkspace(workspaceId, frameId) {
|
|
4710
|
+
if (isDesktop()) {
|
|
4711
|
+
return await this.closeItem(workspaceId);
|
|
4712
|
+
}
|
|
4713
|
+
let closeWorkspaceCommandExists = false;
|
|
4714
|
+
try {
|
|
4715
|
+
const { isSupported } = await this.base.isOperationSupported(OPERATIONS.closeWorkspace.name);
|
|
4716
|
+
closeWorkspaceCommandExists = isSupported;
|
|
4717
|
+
}
|
|
4718
|
+
catch (error) {
|
|
4719
|
+
closeWorkspaceCommandExists = false;
|
|
4720
|
+
}
|
|
4721
|
+
if (closeWorkspaceCommandExists) {
|
|
4722
|
+
return await this.base.closeWorkspace(workspaceId);
|
|
4723
|
+
}
|
|
4724
|
+
return await this.legacyCloseWorkspace(workspaceId, frameId);
|
|
4725
|
+
}
|
|
4707
4726
|
async closeItem(itemId) {
|
|
4708
4727
|
return await this.base.closeItem(itemId);
|
|
4709
4728
|
}
|
|
@@ -4736,10 +4755,10 @@
|
|
|
4736
4755
|
await this.base.notifyWindowAdded(windowId);
|
|
4737
4756
|
return windowId;
|
|
4738
4757
|
}
|
|
4739
|
-
async ejectWindow(itemId) {
|
|
4740
|
-
const
|
|
4741
|
-
await this.base.notifyWindowAdded(
|
|
4742
|
-
return
|
|
4758
|
+
async ejectWindow(itemId, windowId) {
|
|
4759
|
+
const id = (await this.base.ejectWindow(itemId, windowId)).windowId;
|
|
4760
|
+
await this.base.notifyWindowAdded(id);
|
|
4761
|
+
return id;
|
|
4743
4762
|
}
|
|
4744
4763
|
async moveWindowTo(itemId, newParentId) {
|
|
4745
4764
|
return await this.base.moveWindowTo(itemId, newParentId);
|
|
@@ -4882,6 +4901,16 @@
|
|
|
4882
4901
|
callback(wsp, end);
|
|
4883
4902
|
}
|
|
4884
4903
|
}
|
|
4904
|
+
async legacyCloseWorkspace(workspaceId, frameId) {
|
|
4905
|
+
const isLastWorkspaceInFrame = await this.isLastWorkspaceInFrame(workspaceId, frameId);
|
|
4906
|
+
const platformFrameId = (await this.getPlatformFrameId()).id;
|
|
4907
|
+
const shouldCloseFrame = isLastWorkspaceInFrame &&
|
|
4908
|
+
platformFrameId !== frameId;
|
|
4909
|
+
if (shouldCloseFrame) {
|
|
4910
|
+
return await this.closeFrame(frameId, {});
|
|
4911
|
+
}
|
|
4912
|
+
await this.closeItem(workspaceId);
|
|
4913
|
+
}
|
|
4885
4914
|
}
|
|
4886
4915
|
|
|
4887
4916
|
class ShortcutsController {
|
|
@@ -5110,7 +5139,7 @@
|
|
|
5110
5139
|
}
|
|
5111
5140
|
}
|
|
5112
5141
|
|
|
5113
|
-
var version = "4.0.
|
|
5142
|
+
var version = "4.1.0-beta.0";
|
|
5114
5143
|
|
|
5115
5144
|
const composeAPI = (glue, ioc) => {
|
|
5116
5145
|
const controller = ioc.controller;
|