@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/changelog.md
CHANGED
package/dist/workspaces.es.js
CHANGED
|
@@ -1595,6 +1595,7 @@ const OPERATIONS = {
|
|
|
1595
1595
|
maximizeItem: { name: "maximizeItem", argsDecoder: simpleItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1596
1596
|
focusItem: { name: "focusItem", argsDecoder: simpleItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1597
1597
|
closeItem: { name: "closeItem", argsDecoder: closeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1598
|
+
closeWorkspace: { name: "closeWorkspace", argsDecoder: closeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1598
1599
|
resizeItem: { name: "resizeItem", argsDecoder: resizeItemConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1599
1600
|
setMaximizationBoundary: { name: "setMaximizationBoundary", argsDecoder: setMaximizationBoundaryConfigDecoder, resultDecoder: voidResultDecoder },
|
|
1600
1601
|
changeFrameState: { name: "changeFrameState", argsDecoder: frameStateConfigDecoder, resultDecoder: voidResultDecoder },
|
|
@@ -2775,15 +2776,7 @@ class Workspace {
|
|
|
2775
2776
|
}
|
|
2776
2777
|
async close() {
|
|
2777
2778
|
const controller = getData$3(this).controller;
|
|
2778
|
-
|
|
2779
|
-
const platformFrameId = (await controller.getPlatformFrameId()).id;
|
|
2780
|
-
const shouldCloseFrame = workspaces.length === 1 &&
|
|
2781
|
-
workspaces.every((wsp) => wsp.id === this.id) &&
|
|
2782
|
-
platformFrameId !== this.frame.id;
|
|
2783
|
-
if (shouldCloseFrame) {
|
|
2784
|
-
return this.frame.close();
|
|
2785
|
-
}
|
|
2786
|
-
await controller.closeItem(this.id);
|
|
2779
|
+
await controller.closeWorkspace(this.id, this.frameId);
|
|
2787
2780
|
}
|
|
2788
2781
|
snapshot() {
|
|
2789
2782
|
return getData$3(this).controller.getSnapshot(this.id, "workspace");
|
|
@@ -3340,7 +3333,8 @@ class Window {
|
|
|
3340
3333
|
throw new Error("Cannot eject this window, because it is not loaded yet");
|
|
3341
3334
|
}
|
|
3342
3335
|
const itemId = getData$2(this).id;
|
|
3343
|
-
const
|
|
3336
|
+
const windowId = getData$2(this).config.windowId;
|
|
3337
|
+
const newWindowId = await getData$2(this).controller.ejectWindow(itemId, windowId);
|
|
3344
3338
|
getData$2(this).config.windowId = newWindowId;
|
|
3345
3339
|
await this.workspace.refreshReference();
|
|
3346
3340
|
return this.getGdWindow();
|
|
@@ -4283,6 +4277,9 @@ class BaseController {
|
|
|
4283
4277
|
async focusItem(itemId) {
|
|
4284
4278
|
await this.bridge.send(OPERATIONS.focusItem.name, { itemId });
|
|
4285
4279
|
}
|
|
4280
|
+
async closeWorkspace(workspaceId) {
|
|
4281
|
+
await this.bridge.send(OPERATIONS.closeWorkspace.name, { itemId: workspaceId });
|
|
4282
|
+
}
|
|
4286
4283
|
async closeItem(itemId) {
|
|
4287
4284
|
await this.bridge.send(OPERATIONS.closeItem.name, { itemId });
|
|
4288
4285
|
}
|
|
@@ -4314,8 +4311,8 @@ class BaseController {
|
|
|
4314
4311
|
const controlResult = await this.bridge.send(OPERATIONS.forceLoadWindow.name, { itemId });
|
|
4315
4312
|
return controlResult.windowId;
|
|
4316
4313
|
}
|
|
4317
|
-
async ejectWindow(itemId) {
|
|
4318
|
-
return await this.bridge.send(OPERATIONS.ejectWindow.name, { itemId });
|
|
4314
|
+
async ejectWindow(itemId, windowId) {
|
|
4315
|
+
return await this.bridge.send(OPERATIONS.ejectWindow.name, { itemId, windowId });
|
|
4319
4316
|
}
|
|
4320
4317
|
async moveWindowTo(itemId, newParentId) {
|
|
4321
4318
|
await this.bridge.send(OPERATIONS.moveWindowTo.name, { itemId, containerId: newParentId });
|
|
@@ -4597,6 +4594,11 @@ class MainController {
|
|
|
4597
4594
|
}));
|
|
4598
4595
|
return workspacesForFrame;
|
|
4599
4596
|
}
|
|
4597
|
+
async isLastWorkspaceInFrame(workspaceId, frameId) {
|
|
4598
|
+
const workspaceSummaries = await this.getAllWorkspaceSummaries();
|
|
4599
|
+
const summariesForFrame = workspaceSummaries.filter((s) => s.frameId === frameId);
|
|
4600
|
+
return summariesForFrame.length === 1 && summariesForFrame[0].id === workspaceId;
|
|
4601
|
+
}
|
|
4600
4602
|
async getAllWorkspaceSummaries() {
|
|
4601
4603
|
const allSummariesResult = await this.bridge.send(OPERATIONS.getAllWorkspacesSummaries.name, {});
|
|
4602
4604
|
return this.base.getAllWorkspaceSummaries(allSummariesResult);
|
|
@@ -4698,6 +4700,23 @@ class MainController {
|
|
|
4698
4700
|
const frameResult = await this.bridge.send(OPERATIONS.getFrameState.name, { itemId: frameId });
|
|
4699
4701
|
return frameResult.state;
|
|
4700
4702
|
}
|
|
4703
|
+
async closeWorkspace(workspaceId, frameId) {
|
|
4704
|
+
if (isDesktop()) {
|
|
4705
|
+
return await this.closeItem(workspaceId);
|
|
4706
|
+
}
|
|
4707
|
+
let closeWorkspaceCommandExists = false;
|
|
4708
|
+
try {
|
|
4709
|
+
const { isSupported } = await this.base.isOperationSupported(OPERATIONS.closeWorkspace.name);
|
|
4710
|
+
closeWorkspaceCommandExists = isSupported;
|
|
4711
|
+
}
|
|
4712
|
+
catch (error) {
|
|
4713
|
+
closeWorkspaceCommandExists = false;
|
|
4714
|
+
}
|
|
4715
|
+
if (closeWorkspaceCommandExists) {
|
|
4716
|
+
return await this.base.closeWorkspace(workspaceId);
|
|
4717
|
+
}
|
|
4718
|
+
return await this.legacyCloseWorkspace(workspaceId, frameId);
|
|
4719
|
+
}
|
|
4701
4720
|
async closeItem(itemId) {
|
|
4702
4721
|
return await this.base.closeItem(itemId);
|
|
4703
4722
|
}
|
|
@@ -4730,10 +4749,10 @@ class MainController {
|
|
|
4730
4749
|
await this.base.notifyWindowAdded(windowId);
|
|
4731
4750
|
return windowId;
|
|
4732
4751
|
}
|
|
4733
|
-
async ejectWindow(itemId) {
|
|
4734
|
-
const
|
|
4735
|
-
await this.base.notifyWindowAdded(
|
|
4736
|
-
return
|
|
4752
|
+
async ejectWindow(itemId, windowId) {
|
|
4753
|
+
const id = (await this.base.ejectWindow(itemId, windowId)).windowId;
|
|
4754
|
+
await this.base.notifyWindowAdded(id);
|
|
4755
|
+
return id;
|
|
4737
4756
|
}
|
|
4738
4757
|
async moveWindowTo(itemId, newParentId) {
|
|
4739
4758
|
return await this.base.moveWindowTo(itemId, newParentId);
|
|
@@ -4876,6 +4895,16 @@ class MainController {
|
|
|
4876
4895
|
callback(wsp, end);
|
|
4877
4896
|
}
|
|
4878
4897
|
}
|
|
4898
|
+
async legacyCloseWorkspace(workspaceId, frameId) {
|
|
4899
|
+
const isLastWorkspaceInFrame = await this.isLastWorkspaceInFrame(workspaceId, frameId);
|
|
4900
|
+
const platformFrameId = (await this.getPlatformFrameId()).id;
|
|
4901
|
+
const shouldCloseFrame = isLastWorkspaceInFrame &&
|
|
4902
|
+
platformFrameId !== frameId;
|
|
4903
|
+
if (shouldCloseFrame) {
|
|
4904
|
+
return await this.closeFrame(frameId, {});
|
|
4905
|
+
}
|
|
4906
|
+
await this.closeItem(workspaceId);
|
|
4907
|
+
}
|
|
4879
4908
|
}
|
|
4880
4909
|
|
|
4881
4910
|
class ShortcutsController {
|
|
@@ -5104,7 +5133,7 @@ class IoC {
|
|
|
5104
5133
|
}
|
|
5105
5134
|
}
|
|
5106
5135
|
|
|
5107
|
-
var version = "4.0.
|
|
5136
|
+
var version = "4.1.0-beta.0";
|
|
5108
5137
|
|
|
5109
5138
|
const composeAPI = (glue, ioc) => {
|
|
5110
5139
|
const controller = ioc.controller;
|