@openfin/core 31.74.31 → 32.75.1

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.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +58 -13
  3. package/src/api/application/Instance.d.ts +13 -1
  4. package/src/api/application/Instance.js +39 -7
  5. package/src/api/base.d.ts +1 -2
  6. package/src/api/base.js +1 -2
  7. package/src/api/events/application.d.ts +4 -1
  8. package/src/api/events/system.d.ts +6 -3
  9. package/src/api/events/webcontents.d.ts +54 -5
  10. package/src/api/fin.js +1 -2
  11. package/src/api/interappbus/channel/client.d.ts +2 -2
  12. package/src/api/interappbus/channel/index.d.ts +4 -3
  13. package/src/api/interappbus/channel/index.js +111 -74
  14. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  15. package/src/api/interappbus/index.js +1 -1
  16. package/src/api/interop/InteropClient.d.ts +1 -1
  17. package/src/api/interop/InteropClient.js +1 -1
  18. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  19. package/src/api/interop/SessionContextGroupBroker.js +5 -4
  20. package/src/api/interop/SessionContextGroupClient.js +1 -1
  21. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  22. package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
  23. package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
  24. package/src/api/interop/fdc3/utils.js +24 -4
  25. package/src/api/me.d.ts +1 -1
  26. package/src/api/me.js +2 -1
  27. package/src/api/platform/Factory.d.ts +3 -3
  28. package/src/api/platform/Factory.js +2 -11
  29. package/src/api/platform/Instance.d.ts +5 -4
  30. package/src/api/platform/Instance.js +2 -1
  31. package/src/api/platform/layout/Factory.d.ts +1 -1
  32. package/src/api/platform/layout/Factory.js +7 -39
  33. package/src/api/platform/layout/Instance.js +3 -0
  34. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +6 -2
  35. package/src/api/platform/layout/controllers/layout-entities-controller.js +40 -8
  36. package/src/api/platform/layout/entities/layout-entities.d.ts +143 -42
  37. package/src/api/platform/layout/entities/layout-entities.js +151 -43
  38. package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -0
  39. package/src/api/platform/layout/utils/layout-traversal.js +11 -11
  40. package/src/api/platform/provider.d.ts +2 -1
  41. package/src/api/system/index.d.ts +9 -0
  42. package/src/api/system/index.js +78 -40
  43. package/src/api/view/Instance.d.ts +6 -3
  44. package/src/api/view/Instance.js +10 -9
  45. package/src/api/webcontents/main.d.ts +2 -22
  46. package/src/api/webcontents/main.js +2 -1
  47. package/src/api/window/Instance.d.ts +10 -0
  48. package/src/api/window/Instance.js +22 -0
  49. package/src/environment/browser.d.ts +4 -2
  50. package/src/environment/browser.js +5 -2
  51. package/src/environment/environment.d.ts +4 -2
  52. package/src/environment/mockEnvironment.d.ts +27 -0
  53. package/src/environment/mockEnvironment.js +61 -0
  54. package/src/environment/node-env.d.ts +3 -2
  55. package/src/environment/node-env.js +5 -2
  56. package/src/environment/openfin-env.d.ts +5 -3
  57. package/src/environment/openfin-env.js +12 -10
  58. package/src/mock.js +4 -83
  59. package/src/shapes/protocol.d.ts +26 -9
  60. package/src/transport/mockWire.d.ts +11 -0
  61. package/src/transport/mockWire.js +26 -0
  62. package/src/transport/transport-errors.d.ts +9 -1
  63. package/src/transport/transport-errors.js +45 -2
  64. package/src/transport/transport.d.ts +16 -5
  65. package/src/transport/transport.js +48 -20
  66. package/src/util/channel-api-relay.js +11 -1
  67. package/src/util/errors.d.ts +1 -0
  68. package/src/util/errors.js +1 -0
  69. package/src/util/lazy.d.ts +18 -0
  70. package/src/util/lazy.js +29 -1
  71. package/src/util/ref-counter.d.ts +1 -1
  72. package/src/util/ref-counter.js +3 -2
  73. package/src/api/platform/layout/controllers/splitter-controller.d.ts +0 -30
  74. package/src/api/platform/layout/controllers/splitter-controller.js +0 -83
  75. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +0 -58
  76. package/src/api/platform/layout/controllers/tab-drag-controller.js +0 -124
  77. package/src/api/platform/layout/utils/bounds-observer.d.ts +0 -19
  78. package/src/api/platform/layout/utils/bounds-observer.js +0 -52
  79. package/src/api/platform/layout/utils/view-overlay.d.ts +0 -35
  80. package/src/api/platform/layout/utils/view-overlay.js +0 -49
  81. package/src/transport/fin_store.d.ts +0 -4
  82. package/src/transport/fin_store.js +0 -16
@@ -7,6 +7,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
7
7
  var _Platform_connectToProvider;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Platform = void 0;
10
+ /* eslint-disable import/prefer-default-export, no-undef */
10
11
  const base_1 = require("../base");
11
12
  const validate_1 = require("../../util/validate");
12
13
  // Reuse clients to avoid overwriting already-registered client in provider
@@ -78,7 +79,7 @@ class Platform extends base_1.EmitterBase {
78
79
  const response = await client.dispatch('create-view', {
79
80
  target,
80
81
  opts: viewOptions,
81
- targetView,
82
+ targetView
82
83
  });
83
84
  if (!response || (0, validate_1.validateIdentity)(response.identity)) {
84
85
  throw new Error(`When overwriting the createView call, please return an object that has a valid 'identity' property: ${JSON.stringify(response)}`);
@@ -1,6 +1,6 @@
1
1
  import type * as OpenFin from '../../../OpenFin';
2
- import { Layout } from './Instance';
3
2
  import { Base } from '../../base';
3
+ import { Layout } from './Instance';
4
4
  type InitLayoutOptions = OpenFin.InitLayoutOptions;
5
5
  /**
6
6
  * @PORTED
@@ -10,19 +10,12 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
10
10
  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");
11
11
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
12
  };
13
- var _LayoutModule_layoutManager;
13
+ var _LayoutModule_layoutInitializationAttempted;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.LayoutModule = void 0;
16
16
  /* eslint-disable no-undef, import/prefer-default-export */
17
- const tab_drag_controller_1 = require("./controllers/tab-drag-controller");
18
- const Instance_1 = require("./Instance");
19
17
  const base_1 = require("../../base");
20
- const splitter_controller_1 = require("./controllers/splitter-controller");
21
- const view_overlay_1 = require("./utils/view-overlay");
22
- const api_exposer_1 = require("../../api-exposer");
23
- const layout_entities_controller_1 = require("./controllers/layout-entities-controller");
24
- const layout_constants_1 = require("./layout.constants");
25
- const layout_content_cache_1 = require("./controllers/layout-content-cache");
18
+ const Instance_1 = require("./Instance");
26
19
  /**
27
20
  * @PORTED
28
21
  * InitLayoutOptions interface
@@ -90,7 +83,7 @@ const layout_content_cache_1 = require("./controllers/layout-content-cache");
90
83
  class LayoutModule extends base_1.Base {
91
84
  constructor() {
92
85
  super(...arguments);
93
- _LayoutModule_layoutManager.set(this, void 0);
86
+ _LayoutModule_layoutInitializationAttempted.set(this, false);
94
87
  /**
95
88
  * Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
96
89
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
@@ -109,36 +102,11 @@ class LayoutModule extends base_1.Base {
109
102
  if (!this.fin.me.isWindow) {
110
103
  throw new Error('Layout.init can only be called from a Window context.');
111
104
  }
112
- else if (__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f")) {
105
+ else if (__classPrivateFieldGet(this, _LayoutModule_layoutInitializationAttempted, "f")) {
113
106
  throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
114
107
  }
115
- // We need to go through environment to make sure it is only imported/bundled in OpenFin.
116
- const ManagerConstructor = await this.wire.environment.getManagerConstructor();
117
- const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
118
- const splitterController = new splitter_controller_1.SplitterController(viewOverlay);
119
- const tabDragController = new tab_drag_controller_1.TabDragController(viewOverlay);
120
- const contentItemCache = new layout_content_cache_1.LayoutContentCache();
121
- __classPrivateFieldSet(this, _LayoutModule_layoutManager, new ManagerConstructor(splitterController, tabDragController, contentItemCache), "f");
122
- // @ts-expect-error - layout warning here for backwards compatibility, can remove layout check in .52
123
- let { layout, containerId } = options;
124
- if (layout) {
125
- console.warn(`We recommend using a layout in window options.
126
- This layout has not been sanitized and unexpected behavior can occur.`);
127
- }
128
- layout = layout || (await this.fin.Window.getCurrentSync().getOptions()).layout;
129
- containerId = containerId || 'layout-container';
130
- const container = document.getElementById(containerId);
131
- // Should we error here if there is no container? Getting a typescript complaint on createLayout
132
- // override here
133
- // pull createChannelConnection out of LayoutManager and setup channel connections here using layoutmanager instance methods?
134
- await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").initManager();
135
- await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").createLayout(layout, container);
136
- const { client, ofWindow } = ManagerConstructor.getClientAndWindow(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"));
137
- // expose LayoutEntitiesController instance for API consumption
138
- const channelStrategy = new api_exposer_1.ChannelsExposer(client);
139
- await new api_exposer_1.ApiExposer(channelStrategy).exposeInstance(new layout_entities_controller_1.LayoutEntitiesController(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"), contentItemCache), { id: layout_constants_1.LAYOUT_CONTROLLER_ID });
140
- // Adding this to the returned instance undocumented/typed for Browser.
141
- return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f") });
108
+ __classPrivateFieldSet(this, _LayoutModule_layoutInitializationAttempted, true, "f");
109
+ return this.wire.environment.initLayout(this.fin, this.wire, options);
142
110
  };
143
111
  }
144
112
  /**
@@ -203,4 +171,4 @@ class LayoutModule extends base_1.Base {
203
171
  }
204
172
  }
205
173
  exports.LayoutModule = LayoutModule;
206
- _LayoutModule_layoutManager = new WeakMap();
174
+ _LayoutModule_layoutInitializationAttempted = new WeakMap();
@@ -114,6 +114,9 @@ class Layout extends base_1.Base {
114
114
  * @return {Promise<TabStack | ColumnOrRow>}
115
115
  */
116
116
  async getRootItem() {
117
+ this.wire.sendAction('layout-get-root-item').catch(() => {
118
+ // don't expose
119
+ });
117
120
  const client = await __classPrivateFieldGet(this, _Layout_layoutClient, "f").getValue();
118
121
  const root = await client.getRoot();
119
122
  return layout_entities_1.LayoutNode.getEntity(root, client);
@@ -9,7 +9,9 @@ type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOp
9
9
  export declare class LayoutEntitiesController {
10
10
  private layoutManager;
11
11
  private layoutContentCache;
12
+ private wire;
12
13
  constructor(layoutManager: any, layoutContentCache: LayoutContentCache);
14
+ private analytics;
13
15
  /**
14
16
  * @internal
15
17
  * @returns the root contentItem of the layout.
@@ -86,6 +88,7 @@ export declare class LayoutEntitiesController {
86
88
  * @throws If the view does not exist, fails to create, or the stack does not exist.
87
89
  */
88
90
  addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, { index }?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
91
+ private findViewInStack;
89
92
  /**
90
93
  * @internal
91
94
  * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
@@ -101,15 +104,16 @@ export declare class LayoutEntitiesController {
101
104
  * Creates a new adjacent 'stack' and adds the views to it at the specified position
102
105
  * @param targetId Entity id of the content item to add a stack adjacent to it
103
106
  * @param views List of identities or view creation options of the views to include in the stack
104
- * @param options Creation options, defaults to position: 'right'
107
+ * @param options Creation options, defaults to { position: 'right' }
105
108
  * @returns the Entity Id of the new stack
106
109
  */
107
- createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], options: {
110
+ createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], { position }?: {
108
111
  position?: OpenFin.LayoutPosition;
109
112
  }) => Promise<string>;
110
113
  getAdjacentStacks: ({ targetId, edge }: {
111
114
  targetId: string;
112
115
  edge: OpenFin.LayoutPosition;
113
116
  }) => Promise<Pick<OpenFin.LayoutEntityDefinition, 'entityId'>[]>;
117
+ setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise<void>;
114
118
  }
115
119
  export {};
@@ -20,11 +20,17 @@ class LayoutEntitiesController {
20
20
  layoutManager, layoutContentCache) {
21
21
  this.layoutManager = layoutManager;
22
22
  this.layoutContentCache = layoutContentCache;
23
+ this.analytics = (topic) => {
24
+ this.wire.sendAction(`layout-controller-${topic}`).catch(() => {
25
+ // don't expose
26
+ });
27
+ };
23
28
  /**
24
29
  * @internal
25
30
  * @returns the root contentItem of the layout.
26
31
  */
27
32
  this.getRoot = () => {
33
+ this.analytics('get-root');
28
34
  const root = this.layoutManager.layout.root.contentItems[0];
29
35
  return {
30
36
  // TODO: fix typing
@@ -41,6 +47,7 @@ class LayoutEntitiesController {
41
47
  */
42
48
  this.getStackByView = async (view) => {
43
49
  var _a, _b, _c, _d;
50
+ this.analytics('get-stack-by-view');
44
51
  const viewComponent = this.layoutManager.getViewComponent(view);
45
52
  if (!viewComponent || ((_b = (_a = viewComponent.container) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent.type) !== 'stack') {
46
53
  return undefined;
@@ -63,6 +70,7 @@ class LayoutEntitiesController {
63
70
  * @throws if the content item associated with the entity id does not exist or is not a stack.
64
71
  */
65
72
  this.getStackViews = (id) => {
73
+ this.analytics('get-stack-views');
66
74
  const stack = this.layoutContentCache.getContentItemOrThrow(id, ['stack']);
67
75
  const views = stack.contentItems.map((ci) => {
68
76
  var _a;
@@ -80,6 +88,7 @@ class LayoutEntitiesController {
80
88
  */
81
89
  this.isRoot = (id) => {
82
90
  var _a;
91
+ this.analytics('is-root');
83
92
  const ci = this.layoutContentCache.getContentItemOrThrow(id);
84
93
  return !!((_a = ci.parent) === null || _a === void 0 ? void 0 : _a.isRoot);
85
94
  };
@@ -90,6 +99,7 @@ class LayoutEntitiesController {
90
99
  * @returns True if the content item exists and belongs to the layout.
91
100
  */
92
101
  this.exists = (entityId) => {
102
+ this.analytics('exists');
93
103
  return this.layoutContentCache.hasKey(entityId);
94
104
  };
95
105
  /**
@@ -109,6 +119,7 @@ class LayoutEntitiesController {
109
119
  * @throws If the view does not exist, fails to create, or the stack does not exist.
110
120
  */
111
121
  this.addViewToStack = async (stackEntityId, viewCreationOrReference, { index } = { index: 0 }) => {
122
+ this.analytics('add-view-to-stack');
112
123
  const currentStack = this.layoutContentCache.getContentItemOrThrow(stackEntityId);
113
124
  if (index && index > currentStack.contentItems.length + 1) {
114
125
  throw new Error(`Index '${index}' out of range, please exclude the index or specify a number between 0 and ${currentStack.contentItems.length}`);
@@ -123,6 +134,9 @@ class LayoutEntitiesController {
123
134
  });
124
135
  return identity;
125
136
  };
137
+ this.findViewInStack = (stack, viewIdentity) => {
138
+ return stack.contentItems.find((ci) => { var _a, _b; return ((_b = (_a = ci.config) === null || _a === void 0 ? void 0 : _a.componentState) === null || _b === void 0 ? void 0 : _b.name) === viewIdentity.name; });
139
+ };
126
140
  /**
127
141
  * @internal
128
142
  * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
@@ -133,9 +147,11 @@ class LayoutEntitiesController {
133
147
  * @throws If the stack does not exist or the view does not exist or belong to the stack.
134
148
  */
135
149
  this.removeViewFromStack = async (stackEntityId, view) => {
136
- const views = this.getStackViews(stackEntityId);
137
- if (!views.find((existingView) => existingView.name === view.name)) {
138
- throw new Error(`Tried to remove a view ('${view.name}') which does not exist in the stack.`);
150
+ this.analytics('remove-view-from-stack');
151
+ const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
152
+ const viewInstance = this.findViewInStack(stack, view);
153
+ if (!viewInstance) {
154
+ throw new Error(`Tried to remove a view ('${view.name}') which does not belong to the stack.`);
139
155
  }
140
156
  await this.layoutManager.platform.closeView(view);
141
157
  };
@@ -144,14 +160,14 @@ class LayoutEntitiesController {
144
160
  * Creates a new adjacent 'stack' and adds the views to it at the specified position
145
161
  * @param targetId Entity id of the content item to add a stack adjacent to it
146
162
  * @param views List of identities or view creation options of the views to include in the stack
147
- * @param options Creation options, defaults to position: 'right'
163
+ * @param options Creation options, defaults to { position: 'right' }
148
164
  * @returns the Entity Id of the new stack
149
165
  */
150
- this.createAdjacentStack = async (targetId, views, options) => {
151
- if (views.length === 0) {
152
- throw new Error('Cannot create stack with empty view array.');
166
+ this.createAdjacentStack = async (targetId, views, { position = 'right' } = {}) => {
167
+ this.analytics('create-adjacent-stack');
168
+ if (!Array.isArray(views) || views.length === 0) {
169
+ throw new Error('The parameter "views" must be an array with at least 1 element.');
153
170
  }
154
- const { position = 'right' } = options;
155
171
  if (!['top', 'bottom', 'left', 'right'].includes(position)) {
156
172
  throw new Error(`Invalid position '${position}' specified.`);
157
173
  }
@@ -176,12 +192,23 @@ class LayoutEntitiesController {
176
192
  return entityId;
177
193
  };
178
194
  this.getAdjacentStacks = async ({ targetId, edge }) => {
195
+ this.analytics('get-adjacent-stacks');
179
196
  const contentItem = this.layoutContentCache.getContentItemOrThrow(targetId);
180
197
  // call utils helper to traverse and return adjacent stacks
181
198
  return (0, layout_traversal_1.getAdjacentStacks)(contentItem, edge).map((stack) => ({
182
199
  entityId: this.layoutContentCache.getOrCreateEntityId(stack),
183
200
  }));
184
201
  };
202
+ this.setStackActiveView = async (stackEntityId, viewIdentity) => {
203
+ this.analytics('set-stack-active-view');
204
+ const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
205
+ const view = this.findViewInStack(stack, viewIdentity);
206
+ if (!view) {
207
+ throw new Error(`Tried to set a view ('${viewIdentity.name}') as active when it does not belong to the stack.`);
208
+ }
209
+ stack.setActiveContentItem(view, true);
210
+ };
211
+ this.wire = this.layoutManager.platform.wire;
185
212
  }
186
213
  /**
187
214
  * @internal
@@ -192,6 +219,7 @@ class LayoutEntitiesController {
192
219
  * @throws if the entity associated with {@link id} is not in the entity cache, does not belogn to a layout, or is not a column/row.
193
220
  */
194
221
  getContent(id) {
222
+ this.analytics('get-content');
195
223
  const ci = this.layoutContentCache.getContentItemOrThrow(id, ['column', 'row']);
196
224
  return ci.contentItems.map((item) => ({
197
225
  type: item.type,
@@ -208,6 +236,7 @@ class LayoutEntitiesController {
208
236
  * content item or has been removed from the layout entirely.
209
237
  */
210
238
  getParent(id) {
239
+ this.analytics('get-parent');
211
240
  const ci = this.layoutContentCache.getContentItemOrThrow(id);
212
241
  if (ci.parent && !ci.parent.isRoot && ci.parent.contentItems.includes(ci)) {
213
242
  return {
@@ -252,4 +281,7 @@ __decorate([
252
281
  __decorate([
253
282
  (0, decorators_1.expose)()
254
283
  ], LayoutEntitiesController.prototype, "getAdjacentStacks", void 0);
284
+ __decorate([
285
+ (0, decorators_1.expose)()
286
+ ], LayoutEntitiesController.prototype, "setStackActiveView", void 0);
255
287
  exports.LayoutEntitiesController = LayoutEntitiesController;
@@ -1,25 +1,27 @@
1
1
  import type * as OpenFin from '../../../../OpenFin';
2
2
  import { LayoutEntitiesClient } from '../shapes';
3
3
  /**
4
+ * @ignore
4
5
  * @internal
5
6
  * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
6
7
  * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
7
8
  */
8
9
  export declare abstract class LayoutNode {
9
10
  #private;
10
- /** @internal */
11
- protected constructor(client: LayoutEntitiesClient, entityId: string);
12
11
  /**
13
12
  * @internal
14
- * The type of this node, one of: 'row' | 'column' | 'stack';
13
+ * @ignore
15
14
  */
16
- readonly abstract type: OpenFin.LayoutEntityTypes;
15
+ protected constructor(client: LayoutEntitiesClient, entityId: string);
16
+ abstract readonly type: OpenFin.LayoutEntityTypes;
17
17
  /**
18
18
  * @internal
19
+ * @ignore
19
20
  * This instance's unique id used when calling the layout-entities-controller api client
20
21
  */
21
22
  protected readonly entityId: string;
22
23
  /**
24
+ * @ignore
23
25
  * @internal
24
26
  * Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
25
27
  * @param client
@@ -29,51 +31,83 @@ export declare abstract class LayoutNode {
29
31
  */
30
32
  static newLayoutEntitiesClient: (client: OpenFin.ChannelClient, controllerId: string, identity: OpenFin.Identity) => Promise<LayoutEntitiesClient>;
31
33
  static getEntity: (definition: OpenFin.LayoutEntityDefinition, client: LayoutEntitiesClient) => ColumnOrRow | TabStack;
34
+ isRoot: () => Promise<boolean>;
35
+ exists: () => Promise<boolean>;
36
+ getParent: () => Promise<ColumnOrRow | TabStack | undefined>;
37
+ createAdjacentStack: (views: OpenFin.PlatformViewCreationOptions[], options: {
38
+ position?: OpenFin.LayoutPosition;
39
+ }) => Promise<TabStack>;
40
+ getAdjacentStacks: (edge: OpenFin.LayoutPosition) => Promise<TabStack[]>;
41
+ }
42
+ /**
43
+ * @typedef {string} LayoutPosition
44
+ * @summary Represents the position of an item in a layout relative to another. Possible values are 'top', 'bottom', 'left' and 'right'.
45
+ */
46
+ /**
47
+ * @typedef {object} StackCreationOptions
48
+ * @summary Stack creation options.
49
+ * @property {LayoutPosition} [position] - The position to create the new {@link TabStack} in, relative to the given adjacent {@link TabStack}. Defaults to 'right'.
50
+ */
51
+ /**
52
+ * @typedef {object} TabStack~AddViewOptions
53
+ * @summary Options to use when adding a view to a {@link TabStack}
54
+ * @property {number} [index] - Insertion index when adding the view. Defaults to 0.
55
+ */
56
+ /**
57
+ * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
58
+ */
59
+ export declare class TabStack extends LayoutNode {
60
+ #private;
32
61
  /**
33
- * Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level content item in the current layout.
34
- * @returns Promise resolving true if this is the root, or false otherwise.
62
+ * Determines if this {@link TabStack} is the top level content item in the current layout.
63
+ * @function isRoot
64
+ * @memberof TabStack
65
+ * @instance
66
+ * @tutorial TabStack.isRoot
67
+ * @return {Promise<boolean>} Resolves true if this TabStack is the top level content item, or false if it is not.
35
68
  */
36
- isRoot: () => Promise<boolean>;
37
69
  /**
38
- * Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level
39
- * content item in the current layout.
40
- * @returns Promise resolving true if this is the root, or false otherwise.
70
+ * Determines if this {@link TabStack} exists.
71
+ * @function exists
72
+ * @instance
73
+ * @memberof TabStack
74
+ * @tutorial TabStack.exists
75
+ * @return {Promise<boolean>} Resolves true if this is the TabStack exists, or false if it has been destroyed.
41
76
  */
42
- exists: () => Promise<boolean>;
43
77
  /**
44
- * Retrieves the parent {@link ColumnOrRow} or {@link TabStack} of this item, if one exists.
45
- * @returns Promise resolving with the {@link ColumnOrRow} or {@link TabStack} that contains this item, or undefined if this is the root content item.
78
+ * Retrieves the parent {@link ColumnOrRow} of this {@link TabStack}, if one exists.
79
+ * @function getParent
80
+ * @instance
81
+ * @memberof TabStack
82
+ * @tutorial TabStack.getParent
83
+ * @return {Promise<ColumnOrRow | TabStack | undefined>} Promise resolving with the {@link ColumnOrRow} that contains this item, or undefined if this {@link TabStack} is the root content item or does not exist.
46
84
  */
47
- getParent: () => Promise<ColumnOrRow | TabStack | undefined>;
48
85
  /**
49
- * Given a list of view creation options or references and a layout position, creates an adjacent {@link TabStack}
86
+ * Returns all the adjacent stacks that share an edge with the given {@link TabStack}.
87
+ * @function getAdjacentStacks
88
+ * @instance
89
+ * @memberof TabStack
90
+ * @param {LayoutPosition} edge - Edge to check for any adjacent stacks.
91
+ * @returns {Promise<TabStack[]>}
92
+ * @tutorial TabStack.getAdjacentStacks
93
+ */
94
+ /**
95
+ * Given a list of view creation options or references and a layout position, creates a {@link TabStack} adjacent to the current {@link TabStack}
50
96
  *
51
97
  * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
52
98
  * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
53
99
  * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
54
100
  * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
55
101
  *
56
- * @param views List of identities or view creation options of the views to include in the stack
57
- * @param options Creation options, defaults to position: 'right'
58
- * @returns an instance of {@link TabStack} containing the given views
102
+ * @function createAdjacentStack
103
+ * @instance
104
+ * @memberof TabStack
105
+ * @param {View~options} views - List of identities or view creation options of the views to include in the stack
106
+ * @param {StackCreationOptions} options - Creation options.
107
+ * @returns {Promise<TabStack>} The created TabStack.
108
+ * @tutorial TabStack.createAdjacentStack
59
109
  * @experimental
60
110
  */
61
- createAdjacentStack: (views: OpenFin.PlatformViewCreationOptions[], options: {
62
- position?: OpenFin.LayoutPosition;
63
- }) => Promise<TabStack>;
64
- /**
65
- * Finds the immediate adjacent layout item given an edge Position
66
- * @param edgePosition
67
- * @returns either {@link TabStack} or {@link ColumnOrRow} that was found, or `undefined` if there is no item with that edgePosition
68
- */
69
- getAdjacentStacks: (edge: OpenFin.LayoutPosition) => Promise<TabStack[]>;
70
- }
71
- /**
72
- * A {@link TabStack} is used to manage the state of a TabStack within an OpenFin Layout and
73
- * traverse to its parent Content Item.
74
- */
75
- export declare class TabStack extends LayoutNode {
76
- #private;
77
111
  /** @internal */
78
112
  constructor(client: LayoutEntitiesClient, entityId: string);
79
113
  /**
@@ -88,8 +122,9 @@ export declare class TabStack extends LayoutNode {
88
122
  * If that happens and then getViews() is called, it will return the identities in a different order than
89
123
  * than the currently rendered tab order.
90
124
  *
91
- * @returns Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
125
+ * @returns {Promise<Identity[]>} Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
92
126
  * @throws If the {@link TabStack} has been destroyed.
127
+ * @tutorial TabStack.getViews
93
128
  * @experimental
94
129
  */
95
130
  getViews: () => Promise<OpenFin.Identity[]>;
@@ -99,28 +134,93 @@ export declare class TabStack extends LayoutNode {
99
134
  * Known Issue: If adding a view overflows the tab-container, the added view will be set as active
100
135
  * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
101
136
  *
102
- * @param view The identity of an existing view to add, or options to create a view.
103
- * @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
104
- * @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
137
+ * @param {View~options} view The identity of an existing view to add, or options to create a view.
138
+ * @param {TabStack~AddViewOptions} options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
139
+ * @returns {Promise<identity>} Resolves with the {@link OpenFin.Identity identity} of the added view.
105
140
  * @throws If the view does not exist or fails to create.
106
141
  * @throws If the {@link TabStack} has been destroyed.
142
+ * @tutorial TabStack.addView
107
143
  * @experimental
108
144
  */
109
145
  addView: (view: OpenFin.Identity | OpenFin.PlatformViewCreationOptions, options?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
110
146
  /**
111
147
  * Removes a view from this {@link TabStack}.
112
- * @param view {@link OpenFin.Identiy Identity} of the view to remove.
148
+ * @param {Identity} view - Identity of the view to remove.
113
149
  * @throws If the view does not exist or does not belong to the stack.
114
150
  * @throws If the {@link TabStack} has been destroyed.
151
+ * @return {Promise<void>}
152
+ * @tutorial TabStack.removeView
115
153
  */
116
154
  removeView: (view: OpenFin.Identity) => Promise<void>;
155
+ /**
156
+ * Sets the active view of the {@link TabStack} without focusing it.
157
+ * @param {Identity} view - Identity of the view to activate.
158
+ * @returns {Promise<void>} Promise which resolves with void once the view has been activated.
159
+ * @throws If the {@link TabStack} has been destroyed.
160
+ * @throws If the view does not exist.
161
+ * @tutorial TabStack.setActiveView
162
+ * @experimental
163
+ */
164
+ setActiveView: (view: OpenFin.Identity) => Promise<void>;
117
165
  }
118
166
  /**
119
- * A {@link ColumnOrRow} is used to manage the state of a ColumnOrRow within an OpenFin Layout.
167
+ * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
120
168
  */
121
169
  export declare class ColumnOrRow extends LayoutNode {
122
170
  #private;
123
- /** @internal */
171
+ /**
172
+ * Determines if this {@link ColumnOrRow} is the top level content item in the current layout.
173
+ * @function isRoot
174
+ * @memberof ColumnOrRow
175
+ * @instance
176
+ * @tutorial ColumnOrRow.isRoot
177
+ * @return {Promise<boolean>} Resolves true if this TabStack is the top level content item, or false if it is not.
178
+ */
179
+ /**
180
+ * Determines if this {@link ColumnOrRow} exists.
181
+ * @function exists
182
+ * @instance
183
+ * @memberof ColumnOrRow
184
+ * @tutorial ColumnOrRow.exists
185
+ * @return {Promise<boolean>} Resolves true if the TabStack exists, or false if it has been destroyed.
186
+ */
187
+ /**
188
+ * Retrieves the parent {@link ColumnOrRow} of this {@link ColumnOrRow}, if one exists.
189
+ * @function getParent
190
+ * @instance
191
+ * @memberof ColumnOrRow
192
+ * @tutorial ColumnOrRow.getParent
193
+ * @return {Promise<ColumnOrRow | undefined>} Promise resolving with the {@link ColumnOrRow} that contains this item, or undefined if this {@link ColumnOrRow} does not exist or is the root content item.
194
+ */
195
+ /**
196
+ * Returns all the adjacent stacks that share an edge with the given {@link ColumnOrRow}.
197
+ * @function getAdjacentStacks
198
+ * @instance
199
+ * @memberof ColumnOrRow
200
+ * @param {LayoutPosition} edge - Edge to check for any adjacent stacks.
201
+ * @returns {Promise<TabStack[]>}
202
+ * @tutorial ColumnOrRow.getAdjacentStacks
203
+ */
204
+ /**
205
+ * Given a list of view creation options or references and a layout position, creates a {@link TabStack} adjacent to the given {@link ColumnOrRow}
206
+ *
207
+ * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
208
+ * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
209
+ * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
210
+ * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
211
+ *
212
+ * @function createAdjacentStack
213
+ * @instance
214
+ * @memberof ColumnOrRow
215
+ * @param {View~options} views - List of identities or view creation options of the views to include in the stack
216
+ * @param {StackCreationOptions} options - Creation options.
217
+ * @returns {Promise<TabStack>} The created TabStack
218
+ * @tutorial ColumnOrRow.createAdjacentStack
219
+ * @experimental
220
+ */
221
+ /**
222
+ * @internal
223
+ */
124
224
  constructor(client: LayoutEntitiesClient, entityId: string, type: 'row' | 'column');
125
225
  /**
126
226
  * The type of this {@link ColumnOrRow}. Either 'row' or 'column'.
@@ -128,7 +228,8 @@ export declare class ColumnOrRow extends LayoutNode {
128
228
  readonly type: 'column' | 'row';
129
229
  /**
130
230
  * Retrieves a list of all content items belonging to this {@link ColumnOrRow} in order of appearance.
131
- * @returns Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
231
+ * @returns {Promise<Array<ColumnOrRow | TabStack>>} Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
232
+ * @tutorial ColumnOrRow.getContent
132
233
  */
133
234
  getContent: () => Promise<(ColumnOrRow | TabStack)[]>;
134
235
  }