@interopio/workspaces-api 4.0.2 → 4.1.1-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/dist/workspaces.es.js +41 -16
- package/dist/workspaces.es.js.map +1 -1
- package/dist/workspaces.umd.js +41 -16
- package/dist/workspaces.umd.js.map +1 -1
- package/dist/workspaces.umd.min.js +1 -1
- package/package.json +3 -3
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,14 +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 = isLastWorkspaceInFrame &&
|
|
2781
|
-
platformFrameId !== this.frame.id;
|
|
2782
|
-
if (shouldCloseFrame) {
|
|
2783
|
-
return this.frame.close();
|
|
2784
|
-
}
|
|
2785
|
-
await controller.closeItem(this.id);
|
|
2779
|
+
await controller.closeWorkspace(this.id, this.frameId);
|
|
2786
2780
|
}
|
|
2787
2781
|
snapshot() {
|
|
2788
2782
|
return getData$3(this).controller.getSnapshot(this.id, "workspace");
|
|
@@ -3339,7 +3333,8 @@ class Window {
|
|
|
3339
3333
|
throw new Error("Cannot eject this window, because it is not loaded yet");
|
|
3340
3334
|
}
|
|
3341
3335
|
const itemId = getData$2(this).id;
|
|
3342
|
-
const
|
|
3336
|
+
const windowId = getData$2(this).config.windowId;
|
|
3337
|
+
const newWindowId = await getData$2(this).controller.ejectWindow(itemId, windowId);
|
|
3343
3338
|
getData$2(this).config.windowId = newWindowId;
|
|
3344
3339
|
await this.workspace.refreshReference();
|
|
3345
3340
|
return this.getGdWindow();
|
|
@@ -4282,6 +4277,9 @@ class BaseController {
|
|
|
4282
4277
|
async focusItem(itemId) {
|
|
4283
4278
|
await this.bridge.send(OPERATIONS.focusItem.name, { itemId });
|
|
4284
4279
|
}
|
|
4280
|
+
async closeWorkspace(workspaceId) {
|
|
4281
|
+
await this.bridge.send(OPERATIONS.closeWorkspace.name, { itemId: workspaceId });
|
|
4282
|
+
}
|
|
4285
4283
|
async closeItem(itemId) {
|
|
4286
4284
|
await this.bridge.send(OPERATIONS.closeItem.name, { itemId });
|
|
4287
4285
|
}
|
|
@@ -4313,8 +4311,8 @@ class BaseController {
|
|
|
4313
4311
|
const controlResult = await this.bridge.send(OPERATIONS.forceLoadWindow.name, { itemId });
|
|
4314
4312
|
return controlResult.windowId;
|
|
4315
4313
|
}
|
|
4316
|
-
async ejectWindow(itemId) {
|
|
4317
|
-
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 });
|
|
4318
4316
|
}
|
|
4319
4317
|
async moveWindowTo(itemId, newParentId) {
|
|
4320
4318
|
await this.bridge.send(OPERATIONS.moveWindowTo.name, { itemId, containerId: newParentId });
|
|
@@ -4702,6 +4700,23 @@ class MainController {
|
|
|
4702
4700
|
const frameResult = await this.bridge.send(OPERATIONS.getFrameState.name, { itemId: frameId });
|
|
4703
4701
|
return frameResult.state;
|
|
4704
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
|
+
}
|
|
4705
4720
|
async closeItem(itemId) {
|
|
4706
4721
|
return await this.base.closeItem(itemId);
|
|
4707
4722
|
}
|
|
@@ -4734,10 +4749,10 @@ class MainController {
|
|
|
4734
4749
|
await this.base.notifyWindowAdded(windowId);
|
|
4735
4750
|
return windowId;
|
|
4736
4751
|
}
|
|
4737
|
-
async ejectWindow(itemId) {
|
|
4738
|
-
const
|
|
4739
|
-
await this.base.notifyWindowAdded(
|
|
4740
|
-
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;
|
|
4741
4756
|
}
|
|
4742
4757
|
async moveWindowTo(itemId, newParentId) {
|
|
4743
4758
|
return await this.base.moveWindowTo(itemId, newParentId);
|
|
@@ -4880,6 +4895,16 @@ class MainController {
|
|
|
4880
4895
|
callback(wsp, end);
|
|
4881
4896
|
}
|
|
4882
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
|
+
}
|
|
4883
4908
|
}
|
|
4884
4909
|
|
|
4885
4910
|
class ShortcutsController {
|
|
@@ -5108,7 +5133,7 @@ class IoC {
|
|
|
5108
5133
|
}
|
|
5109
5134
|
}
|
|
5110
5135
|
|
|
5111
|
-
var version = "4.0
|
|
5136
|
+
var version = "4.1.1-beta.0";
|
|
5112
5137
|
|
|
5113
5138
|
const composeAPI = (glue, ioc) => {
|
|
5114
5139
|
const controller = ioc.controller;
|