@interopio/workspaces-api 5.0.0-next.0 → 5.1.0-next.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 CHANGED
@@ -1,8 +1,15 @@
1
- ## 5.0.0-next.0
1
+ ## 5.1.0-next.0
2
+
3
+ ### Minor Changes
4
+
5
+ - 93a3b92: feat: G4E-10864 add a `positionIndex` setting to the window, group, row and column definition configs, so `addWindow()`, `addGroup()`, `addRow()` and `addColumn()` can insert the new element at a specific position among its siblings instead of always appending it
6
+ - 7a3ed82: feat: G4E-10376 add preventable close of Workspace frames and windows in io.Connect Browser via `frame.onClosing()` and the `allowPrevent` / `showDialog` close options, including when closing from the Workspaces UI
7
+
8
+ ## 5.0.0
2
9
 
3
10
  ### Major Changes
4
11
 
5
- - b7b1ac5: chore: bump all packages to v5.0.0
12
+ - 0cc546d: chore: bump all packages to v5.0.0
6
13
 
7
14
  ### Minor Changes
8
15
 
@@ -10,6 +17,7 @@
10
17
 
11
18
  ### Patch Changes
12
19
 
20
+ - 2bc37f7: breaking change: Updated the types for various getters to also indicate that the return type is possibly undefined
13
21
  - 04c50d6: feature: Added support for IDs in layouts and general support for layout sharing
14
22
 
15
23
  ## 4.5.0
@@ -905,6 +905,7 @@ var lazy = Decoder.lazy;
905
905
 
906
906
  const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
907
907
  const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number");
908
+ const nonNegativeIntegerDecoder = number().where((num) => Number.isInteger(num) && num >= 0, "Expected a non-negative integer");
908
909
  const positiveNumberDecoder = number().where((num) => num > 0, "Expected a positive number");
909
910
  const windowDragModeDecoder = oneOf(constant("keepInside"), constant("autoEject"));
910
911
  const isWindowInSwimlaneResultDecoder = object({
@@ -962,7 +963,8 @@ const windowDefinitionConfigDecoder = object({
962
963
  maxHeight: optional(number()),
963
964
  allowExtract: optional(boolean()),
964
965
  allowReorder: optional(boolean()),
965
- showCloseButton: optional(boolean())
966
+ showCloseButton: optional(boolean()),
967
+ positionIndex: optional(nonNegativeIntegerDecoder)
966
968
  });
967
969
  const groupDefinitionConfigDecoder = object({
968
970
  minWidth: optional(number()),
@@ -979,7 +981,8 @@ const groupDefinitionConfigDecoder = object({
979
981
  allowDropBottom: optional(boolean()),
980
982
  showMaximizeButton: optional(boolean()),
981
983
  showEjectButton: optional(boolean()),
982
- showAddWindowButton: optional(boolean())
984
+ showAddWindowButton: optional(boolean()),
985
+ positionIndex: optional(nonNegativeIntegerDecoder)
983
986
  });
984
987
  const rowDefinitionConfigDecoder = object({
985
988
  minHeight: optional(number()),
@@ -987,7 +990,8 @@ const rowDefinitionConfigDecoder = object({
987
990
  allowDrop: optional(boolean()),
988
991
  allowSplitters: optional(boolean()),
989
992
  isPinned: optional(boolean()),
990
- maximizationBoundary: optional(boolean())
993
+ maximizationBoundary: optional(boolean()),
994
+ positionIndex: optional(nonNegativeIntegerDecoder)
991
995
  });
992
996
  const columnDefinitionConfigDecoder = object({
993
997
  minWidth: optional(number()),
@@ -995,7 +999,8 @@ const columnDefinitionConfigDecoder = object({
995
999
  allowDrop: optional(boolean()),
996
1000
  allowSplitters: optional(boolean()),
997
1001
  isPinned: optional(boolean()),
998
- maximizationBoundary: optional(boolean())
1002
+ maximizationBoundary: optional(boolean()),
1003
+ positionIndex: optional(nonNegativeIntegerDecoder)
999
1004
  });
1000
1005
  const swimlaneWindowDefinitionDecoder = object({
1001
1006
  type: optional(constant("window")),
@@ -2065,17 +2070,18 @@ class InteropTransport {
2065
2070
  await Promise.all(Object.values(OUTGOING_METHODS).map((method) => {
2066
2071
  return this.verifyMethodLive(method.name);
2067
2072
  }));
2068
- await Promise.all(Object.keys(INCOMING_METHODS).map((method) => {
2069
- return this.registerMethod(method);
2070
- }));
2071
- return;
2072
2073
  }
2073
- const systemId = browserGlobal().communicationId;
2074
- await Promise.all([
2075
- this.verifyMethodLive(webPlatformMethodName, systemId),
2076
- this.verifyMethodLive(webPlatformWspStreamName, systemId)
2077
- ]);
2078
- await this.transmitControl("frameHello", { windowId: actualWindowId });
2074
+ else {
2075
+ const systemId = browserGlobal().communicationId;
2076
+ await Promise.all([
2077
+ this.verifyMethodLive(webPlatformMethodName, systemId),
2078
+ this.verifyMethodLive(webPlatformWspStreamName, systemId)
2079
+ ]);
2080
+ await this.transmitControl("frameHello", { windowId: actualWindowId });
2081
+ }
2082
+ await Promise.all(Object.keys(INCOMING_METHODS).map((method) => {
2083
+ return this.registerMethod(method);
2084
+ }));
2079
2085
  }
2080
2086
  coreSubscriptionReady(eventCallback) {
2081
2087
  if (!this.coreEventMethodInitiated) {
@@ -3790,14 +3796,19 @@ class Frame {
3790
3796
  return getData$1(this).controller.setFrameOnTop(this.id, options);
3791
3797
  }
3792
3798
  async onClosing(callback) {
3793
- if (!isDesktop()) {
3794
- throw new Error("Frame closing operations are not supported in io.Connect Browser");
3795
- }
3796
3799
  checkThrowCallback(callback);
3797
3800
  const wrappedCallback = async () => {
3798
3801
  let shouldPrevent = false;
3799
3802
  const preventClose = () => shouldPrevent = true;
3800
- await callback({ prevent: preventClose });
3803
+ try {
3804
+ await callback({ prevent: preventClose });
3805
+ }
3806
+ catch (error) {
3807
+ if (isDesktop()) {
3808
+ throw error;
3809
+ }
3810
+ console.warn(`onClosing callback for frame "${this.id}" threw: ${error}`);
3811
+ }
3801
3812
  return { prevent: shouldPrevent };
3802
3813
  };
3803
3814
  const unsubscribe = await getData$1(this).controller.registerFrameOnClosing(this.id, wrappedCallback);
@@ -5261,6 +5272,13 @@ class ClosingController {
5261
5272
  this.subscribeToFrameClosing();
5262
5273
  }
5263
5274
  async registerFrameOnClosing(frameId, callback) {
5275
+ if (!isDesktop()) {
5276
+ const { isSupported } = await this.bridge.send(OPERATIONS.operationCheck.name, { operation: OPERATIONS.subscribeToFrameClosing.name }).catch(() => ({ isSupported: false }));
5277
+ if (!isSupported) {
5278
+ console.warn(`onClosing for frame "${frameId}" is not supported by the current version of @interopio/browser-platform (requires 5.0.0+).`);
5279
+ return () => { };
5280
+ }
5281
+ }
5264
5282
  await this.bridge.send(OPERATIONS.subscribeToFrameClosing.name, { itemId: frameId });
5265
5283
  return this.registry.add(frameId, callback);
5266
5284
  }
@@ -5459,7 +5477,7 @@ class IoC {
5459
5477
  }
5460
5478
  }
5461
5479
 
5462
- var version = "5.0.0-next.0";
5480
+ var version = "5.1.0-next.0";
5463
5481
 
5464
5482
  const composeAPI = (glue, ioc) => {
5465
5483
  const controller = ioc.controller;