@openfin/core 35.78.11 → 35.78.12

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.
@@ -5062,12 +5062,10 @@ declare type EntityTypeHelpers<T extends EntityType_2> = T extends 'view' ? {
5062
5062
  } : never;
5063
5063
 
5064
5064
  declare interface Environment {
5065
- initLayout(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<{
5066
- singleInstance: any | undefined;
5067
- layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>;
5068
- }>;
5065
+ initLayoutManager(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>>;
5069
5066
  createLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, options: OpenFin_2.CreateLayoutOptions): Promise<void>;
5070
5067
  destroyLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<void>;
5068
+ resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5071
5069
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5072
5070
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5073
5071
  writeToken(path: string, token: string): Promise<string>;
@@ -8879,7 +8877,7 @@ declare type LayoutItemConfig = {
8879
8877
  *
8880
8878
  * **NOTE**: Internal use only. This type is reserved for Workspace Browser implementation.
8881
8879
  *
8882
- * Responsible for aggergating all layout snapshots and storing layout instances
8880
+ * Responsible for aggregating all layout snapshots and storing layout instances
8883
8881
  */
8884
8882
  declare interface LayoutManager<T extends LayoutSnapshot> {
8885
8883
  /**
@@ -9187,11 +9185,12 @@ declare type LayoutPosition = 'top' | 'bottom' | 'left' | 'right';
9187
9185
  declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs';
9188
9186
 
9189
9187
  /**
9190
- * Generated when a window and all of its layout's views have been created and can receive API calls.
9188
+ * Generated when the layout and all of the its views have been created and can receive API calls.
9191
9189
  * @interface
9192
9190
  */
9193
9191
  declare type LayoutReadyEvent = BaseEvent_5 & {
9194
9192
  type: 'layout-ready';
9193
+ layoutIdentity: OpenFin_2.LayoutIdentity;
9195
9194
  views: (OpenFin_2.Identity & {
9196
9195
  success: boolean;
9197
9196
  })[];
@@ -5062,12 +5062,10 @@ declare type EntityTypeHelpers<T extends EntityType_2> = T extends 'view' ? {
5062
5062
  } : never;
5063
5063
 
5064
5064
  declare interface Environment {
5065
- initLayout(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<{
5066
- singleInstance: any | undefined;
5067
- layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>;
5068
- }>;
5065
+ initLayoutManager(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>>;
5069
5066
  createLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, options: OpenFin_2.CreateLayoutOptions): Promise<void>;
5070
5067
  destroyLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<void>;
5068
+ resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5071
5069
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5072
5070
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5073
5071
  writeToken(path: string, token: string): Promise<string>;
@@ -8879,7 +8877,7 @@ declare type LayoutItemConfig = {
8879
8877
  *
8880
8878
  * **NOTE**: Internal use only. This type is reserved for Workspace Browser implementation.
8881
8879
  *
8882
- * Responsible for aggergating all layout snapshots and storing layout instances
8880
+ * Responsible for aggregating all layout snapshots and storing layout instances
8883
8881
  */
8884
8882
  declare interface LayoutManager<T extends LayoutSnapshot> {
8885
8883
  /**
@@ -9187,11 +9185,12 @@ declare type LayoutPosition = 'top' | 'bottom' | 'left' | 'right';
9187
9185
  declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs';
9188
9186
 
9189
9187
  /**
9190
- * Generated when a window and all of its layout's views have been created and can receive API calls.
9188
+ * Generated when the layout and all of the its views have been created and can receive API calls.
9191
9189
  * @interface
9192
9190
  */
9193
9191
  declare type LayoutReadyEvent = BaseEvent_5 & {
9194
9192
  type: 'layout-ready';
9193
+ layoutIdentity: OpenFin_2.LayoutIdentity;
9195
9194
  views: (OpenFin_2.Identity & {
9196
9195
  success: boolean;
9197
9196
  })[];
@@ -5062,12 +5062,10 @@ declare type EntityTypeHelpers<T extends EntityType_2> = T extends 'view' ? {
5062
5062
  } : never;
5063
5063
 
5064
5064
  declare interface Environment {
5065
- initLayout(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<{
5066
- singleInstance: any | undefined;
5067
- layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>;
5068
- }>;
5065
+ initLayoutManager(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>>;
5069
5066
  createLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, options: OpenFin_2.CreateLayoutOptions): Promise<void>;
5070
5067
  destroyLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<void>;
5068
+ resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5071
5069
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5072
5070
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5073
5071
  writeToken(path: string, token: string): Promise<string>;
@@ -8879,7 +8877,7 @@ declare type LayoutItemConfig = {
8879
8877
  *
8880
8878
  * **NOTE**: Internal use only. This type is reserved for Workspace Browser implementation.
8881
8879
  *
8882
- * Responsible for aggergating all layout snapshots and storing layout instances
8880
+ * Responsible for aggregating all layout snapshots and storing layout instances
8883
8881
  */
8884
8882
  declare interface LayoutManager<T extends LayoutSnapshot> {
8885
8883
  /**
@@ -9187,11 +9185,12 @@ declare type LayoutPosition = 'top' | 'bottom' | 'left' | 'right';
9187
9185
  declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs';
9188
9186
 
9189
9187
  /**
9190
- * Generated when a window and all of its layout's views have been created and can receive API calls.
9188
+ * Generated when the layout and all of the its views have been created and can receive API calls.
9191
9189
  * @interface
9192
9190
  */
9193
9191
  declare type LayoutReadyEvent = BaseEvent_5 & {
9194
9192
  type: 'layout-ready';
9193
+ layoutIdentity: OpenFin_2.LayoutIdentity;
9195
9194
  views: (OpenFin_2.Identity & {
9196
9195
  success: boolean;
9197
9196
  })[];
package/out/mock.d.ts CHANGED
@@ -5161,12 +5161,10 @@ declare type EntityTypeHelpers<T extends EntityType_2> = T extends 'view' ? {
5161
5161
  } : never;
5162
5162
 
5163
5163
  declare interface Environment {
5164
- initLayout(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<{
5165
- singleInstance: any | undefined;
5166
- layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>;
5167
- }>;
5164
+ initLayoutManager(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, wire: Transport, options: OpenFin_2.InitLayoutOptions): Promise<OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>>;
5168
5165
  createLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, options: OpenFin_2.CreateLayoutOptions): Promise<void>;
5169
5166
  destroyLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<void>;
5167
+ resolveLayout(layoutManager: OpenFin_2.LayoutManager<OpenFin_2.LayoutSnapshot>, layoutIdentity: OpenFin_2.LayoutIdentity): Promise<any>;
5170
5168
  initPlatform(fin: OpenFin_2.Fin<OpenFin_2.EntityType>, ...args: Parameters<OpenFin_2.Fin['Platform']['init']>): ReturnType<OpenFin_2.Fin['Platform']['init']>;
5171
5169
  observeBounds(element: Element, onChange: (bounds: DOMRect) => Promise<void> | void): () => void;
5172
5170
  writeToken(path: string, token: string): Promise<string>;
@@ -9032,7 +9030,7 @@ declare type LayoutItemConfig = {
9032
9030
  *
9033
9031
  * **NOTE**: Internal use only. This type is reserved for Workspace Browser implementation.
9034
9032
  *
9035
- * Responsible for aggergating all layout snapshots and storing layout instances
9033
+ * Responsible for aggregating all layout snapshots and storing layout instances
9036
9034
  */
9037
9035
  declare interface LayoutManager<T extends LayoutSnapshot> {
9038
9036
  /**
@@ -9497,11 +9495,12 @@ declare type LayoutPosition = 'top' | 'bottom' | 'left' | 'right';
9497
9495
  declare type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs';
9498
9496
 
9499
9497
  /**
9500
- * Generated when a window and all of its layout's views have been created and can receive API calls.
9498
+ * Generated when the layout and all of the its views have been created and can receive API calls.
9501
9499
  * @interface
9502
9500
  */
9503
9501
  declare type LayoutReadyEvent = BaseEvent_5 & {
9504
9502
  type: 'layout-ready';
9503
+ layoutIdentity: OpenFin_2.LayoutIdentity;
9505
9504
  views: (OpenFin_2.Identity & {
9506
9505
  success: boolean;
9507
9506
  })[];
package/out/mock.js CHANGED
@@ -13079,7 +13079,7 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
13079
13079
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13080
13080
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13081
13081
  };
13082
- var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_throwIfLayoutManagerNotInitialized;
13082
+ var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_getBackCompatLayoutManager, _LayoutModule_throwIfLayoutManagerNotInitialized;
13083
13083
  Object.defineProperty(Factory$2, "__esModule", { value: true });
13084
13084
  Factory$2.LayoutModule = void 0;
13085
13085
  const base_1$5 = base;
@@ -13142,38 +13142,53 @@ class LayoutModule extends base_1$5.Base {
13142
13142
  throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
13143
13143
  }
13144
13144
  __classPrivateFieldSet$4(this, _LayoutModule_layoutInitializationAttempted, true, "f");
13145
- const result = await this.wire.environment.initLayout(this.fin, this.wire, options);
13146
- __classPrivateFieldSet$4(this, _LayoutModule_layoutManager, result.layoutManager, "f");
13147
- // back-compat ONLY if layoutManagerOverride not provided
13145
+ __classPrivateFieldSet$4(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
13146
+ // apply the initial snapshot which in turn will call fin.Platform.Layout.create()
13147
+ const platformClient = await this.fin.Platform.getCurrentSync().getClient();
13148
+ const snapshot = await platformClient.dispatch('get-initial-layout-snapshot');
13149
+ await __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f").applyLayoutSnapshot(snapshot);
13148
13150
  if (!options.layoutManagerOverride) {
13149
- const layout = this.wrapSync(result.singleInstance.identity);
13150
- // Backward compat - undocumented / not typed openfin-layout as layoutManager
13151
- return Object.assign(layout, { layoutManager: result.singleInstance });
13151
+ return __classPrivateFieldGet$4(this, _LayoutModule_getBackCompatLayoutManager, "f").call(this, this.fin);
13152
13152
  }
13153
- // Warn user if they do not create any layouts in the next 10 seconds
13153
+ // warn user if they do not call create() in the next 30 seconds
13154
13154
  setTimeout(() => {
13155
13155
  if (__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f").size() === 0) {
13156
- console.warn(`[Layout.init] Layout.init was called but no layouts have been created yet. Make sure you ` +
13156
+ console.warn(`[Layout.init] Layout.init was called 30s ago, but no layouts have been created yet. Make sure you ` +
13157
13157
  `override LayoutManager.applyLayoutSnapshot, and then call fin.Platform.Layout.create()`);
13158
13158
  }
13159
- }, 10000);
13159
+ }, 30000);
13160
13160
  return this.wrapSync(this.fin.me.identity);
13161
13161
  };
13162
+ _LayoutModule_getBackCompatLayoutManager.set(this, async (fin) => {
13163
+ let layoutManager;
13164
+ let resolve;
13165
+ const layoutResolved = new Promise((r) => {
13166
+ resolve = r;
13167
+ });
13168
+ // wait for a layout to be created
13169
+ await fin.me.once('layout-ready', async ({ layoutIdentity }) => {
13170
+ layoutManager = await this.wire.environment.resolveLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), layoutIdentity);
13171
+ // Backward compat - undocumented / not typed openfin-layout as layoutManager
13172
+ // TODO: eventually deprecate this
13173
+ resolve(Object.assign(this.wrapSync(layoutIdentity), { layoutManager }));
13174
+ });
13175
+ return layoutResolved;
13176
+ });
13162
13177
  /**
13163
13178
  * Returns the layout manager for the current window
13164
13179
  * @returns
13165
13180
  */
13166
13181
  this.getCurrentLayoutManagerSync = () => {
13167
- __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
13182
+ __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
13168
13183
  // @ts-expect-error User may have implemented their own snapshot type when overriding LayoutManager
13169
13184
  return __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f");
13170
13185
  };
13171
13186
  this.create = async (options) => {
13172
- __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
13187
+ __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this, `fin.Platform.Layout.create()`);
13173
13188
  return this.wire.environment.createLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), options);
13174
13189
  };
13175
13190
  this.destroy = async (layoutIdentity) => {
13176
- __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this);
13191
+ __classPrivateFieldGet$4(this, _LayoutModule_instances, "m", _LayoutModule_throwIfLayoutManagerNotInitialized).call(this, `fin.Platform.Layout.destroy()`);
13177
13192
  return this.wire.environment.destroyLayout(__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f"), layoutIdentity);
13178
13193
  };
13179
13194
  }
@@ -13272,9 +13287,9 @@ class LayoutModule extends base_1$5.Base {
13272
13287
  }
13273
13288
  }
13274
13289
  Factory$2.LayoutModule = LayoutModule;
13275
- _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized() {
13290
+ _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getBackCompatLayoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_throwIfLayoutManagerNotInitialized = function _LayoutModule_throwIfLayoutManagerNotInitialized(method) {
13276
13291
  if (!__classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f")) {
13277
- throw new Error('You must call init before using this API');
13292
+ throw new Error(`You must call init before using the API ${method}`);
13278
13293
  }
13279
13294
  };
13280
13295
 
@@ -17210,7 +17225,7 @@ class MockEnvironment {
17210
17225
  getRtcPeer() {
17211
17226
  throw new Error(me_1.environmentUnsupportedMessage);
17212
17227
  }
17213
- initLayout() {
17228
+ initLayoutManager() {
17214
17229
  throw new Error(me_1.environmentUnsupportedMessage);
17215
17230
  }
17216
17231
  async createLayout() {
@@ -17219,6 +17234,9 @@ class MockEnvironment {
17219
17234
  async destroyLayout() {
17220
17235
  throw new Error(me_1.environmentUnsupportedMessage);
17221
17236
  }
17237
+ async resolveLayout() {
17238
+ throw new Error(me_1.environmentUnsupportedMessage);
17239
+ }
17222
17240
  initPlatform() {
17223
17241
  throw new Error(me_1.environmentUnsupportedMessage);
17224
17242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "35.78.11",
3
+ "version": "35.78.12",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/mock.js",