@openfin/core 31.74.22 → 31.74.23

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 (76) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +77 -18
  3. package/src/api/application/Factory.js +0 -1
  4. package/src/api/application/Instance.js +23 -5
  5. package/src/api/base.d.ts +1 -2
  6. package/src/api/base.js +1 -2
  7. package/src/api/events/system.d.ts +6 -3
  8. package/src/api/fin.js +1 -2
  9. package/src/api/interappbus/channel/index.d.ts +1 -0
  10. package/src/api/interappbus/channel/index.js +47 -47
  11. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  12. package/src/api/interappbus/index.js +1 -1
  13. package/src/api/interop/InteropClient.d.ts +1 -1
  14. package/src/api/interop/InteropClient.js +1 -1
  15. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  16. package/src/api/interop/SessionContextGroupBroker.js +5 -4
  17. package/src/api/interop/SessionContextGroupClient.js +1 -1
  18. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  19. package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
  20. package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
  21. package/src/api/interop/fdc3/fdc3-2.0.d.ts +11 -10
  22. package/src/api/interop/fdc3/fdc3-2.0.js +10 -9
  23. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
  24. package/src/api/interop/fdc3/utils.js +24 -4
  25. package/src/api/platform/Factory.d.ts +2 -1
  26. package/src/api/platform/Factory.js +1 -4
  27. package/src/api/platform/Instance.d.ts +6 -5
  28. package/src/api/platform/Instance.js +1 -0
  29. package/src/api/platform/layout/Factory.js +15 -4
  30. package/src/api/platform/layout/Instance.d.ts +6 -0
  31. package/src/api/platform/layout/Instance.js +29 -1
  32. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
  33. package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
  34. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +119 -0
  35. package/src/api/platform/layout/controllers/layout-entities-controller.js +287 -0
  36. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
  37. package/src/api/platform/layout/entities/layout-entities.d.ts +235 -0
  38. package/src/api/platform/layout/entities/layout-entities.js +312 -0
  39. package/src/api/platform/layout/entities/shapes.d.ts +6 -0
  40. package/src/api/platform/layout/entities/shapes.js +2 -0
  41. package/src/api/platform/layout/layout.constants.d.ts +1 -0
  42. package/src/api/platform/layout/layout.constants.js +4 -0
  43. package/src/api/platform/layout/shapes.d.ts +3 -0
  44. package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
  45. package/src/api/platform/layout/utils/layout-traversal.js +65 -0
  46. package/src/api/platform/provider.d.ts +2 -1
  47. package/src/api/system/index.d.ts +9 -0
  48. package/src/api/system/index.js +78 -40
  49. package/src/api/view/Instance.d.ts +12 -3
  50. package/src/api/view/Instance.js +39 -4
  51. package/src/api/webcontents/main.d.ts +2 -22
  52. package/src/api/webcontents/main.js +2 -1
  53. package/src/api/window/Instance.d.ts +10 -0
  54. package/src/api/window/Instance.js +22 -0
  55. package/src/environment/mockEnvironment.d.ts +27 -0
  56. package/src/environment/mockEnvironment.js +61 -0
  57. package/src/mock.js +4 -83
  58. package/src/shapes/protocol.d.ts +17 -0
  59. package/src/transport/mockWire.d.ts +11 -0
  60. package/src/transport/mockWire.js +26 -0
  61. package/src/transport/transport-errors.d.ts +9 -1
  62. package/src/transport/transport-errors.js +45 -2
  63. package/src/transport/transport.d.ts +15 -5
  64. package/src/transport/transport.js +48 -20
  65. package/src/util/channel-api-relay.d.ts +13 -0
  66. package/src/util/channel-api-relay.js +47 -0
  67. package/src/util/errors.d.ts +1 -0
  68. package/src/util/errors.js +1 -0
  69. package/src/util/lazy.d.ts +34 -0
  70. package/src/util/lazy.js +54 -0
  71. package/src/util/ref-counter.d.ts +1 -1
  72. package/src/util/ref-counter.js +3 -2
  73. package/src/util/reversible-map.d.ts +11 -0
  74. package/src/util/reversible-map.js +49 -0
  75. package/src/transport/fin_store.d.ts +0 -4
  76. package/src/transport/fin_store.js +0 -16
@@ -0,0 +1,119 @@
1
+ import type * as OpenFin from '../../../../OpenFin';
2
+ import type { LayoutContentCache } from './layout-content-cache';
3
+ type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOptions;
4
+ /**
5
+ * @internal
6
+ * Controller for the layout entities apis, allowing alterations to be applied
7
+ * to an instance of layout manager in a structured manner.
8
+ */
9
+ export declare class LayoutEntitiesController {
10
+ private layoutManager;
11
+ private layoutContentCache;
12
+ private wire;
13
+ constructor(layoutManager: any, layoutContentCache: LayoutContentCache);
14
+ private analytics;
15
+ /**
16
+ * @internal
17
+ * @returns the root contentItem of the layout.
18
+ */
19
+ getRoot: () => OpenFin.LayoutEntityDefinition;
20
+ /**
21
+ * @internal
22
+ * Retrieves the containing stack of a given view identity.
23
+ * @param view Identity of the view to retrieve the stack of.
24
+ * @returns Stack containing the given view.
25
+ * @throws If the view does not belong to a stack within the layout manager.
26
+ */
27
+ getStackByView: (view: OpenFin.Identity) => Promise<OpenFin.LayoutEntityDefinition | undefined>;
28
+ /**
29
+ * @internal
30
+ * Returns all views belonging to a given stack
31
+ *
32
+ * NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
33
+ * when the amount of new views to add overflows the width of the container. This results
34
+ * in tabs being re-ordered in the UI, while the underlying content item array remains in the
35
+ * original order specified. So calling getStackViews() will return this underlying array order,
36
+ * with indexes that will not match up to the render-order of the tabs.
37
+ *
38
+ * @param id - Entity id of the stack.
39
+ * @returns A list of view identities in order of appearance.
40
+ * @throws if the content item associated with the entity id does not exist or is not a stack.
41
+ */
42
+ getStackViews: (id: string) => OpenFin.Identity[];
43
+ /**
44
+ * @internal
45
+ * Retrieves the content of a column or row and adds each to the
46
+ * entity cache to allow them to be addressed externally.
47
+ * @param id Entity id of the Column Or Row to retrieve the content of.
48
+ * @returns Array of layout entity definitions
49
+ * @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.
50
+ */
51
+ getContent(id: string): OpenFin.LayoutEntityDefinition[];
52
+ /**
53
+ * @internal
54
+ * Retrieves the parent content item of the given entity, and adds it to the entity cache
55
+ * so it can be addressed externally.
56
+ * @param id Entity id associated with a layout content item.
57
+ * @returns An entity definition for the given entity's parent, or undefined if the entity is the top level
58
+ * content item or has been removed from the layout entirely.
59
+ */
60
+ getParent(id: string): OpenFin.LayoutEntityDefinition | undefined;
61
+ /**
62
+ * @internal
63
+ * @param id Entity id associated with a layout content item.
64
+ * @returns true if the given entity is the root content item, false otherwise.
65
+ */
66
+ isRoot: (id: string) => boolean;
67
+ /**
68
+ * @internal
69
+ * Checks whether the given entity exists.
70
+ * @param entityId Id of a content item within the layout
71
+ * @returns True if the content item exists and belongs to the layout.
72
+ */
73
+ exists: (entityId: string) => boolean;
74
+ /**
75
+ * @internal
76
+ * Adds an existing view to the stack, or creates and adds a view to the given stack.
77
+ *
78
+ * NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
79
+ * when the amount of new views to add overflows the width of the container. This results
80
+ * in tabs being re-ordered in the UI, while the underlying content item array remains in the
81
+ * original order specified. So calling getStackViews() will return this underlying array order,
82
+ * with indexes that will not match up to the render-order of the tabs.
83
+ *
84
+ * @param stackEntityId Entity id of the stack content item within the layout.
85
+ * @param viewCreationOrReference View identity or creation options
86
+ * @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)
87
+ * @returns Promise resolving with the identity of the newly added view.
88
+ * @throws If the view does not exist, fails to create, or the stack does not exist.
89
+ */
90
+ addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, { index }?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
91
+ private findViewInStack;
92
+ /**
93
+ * @internal
94
+ * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
95
+ * option closeOnLastViewRemoved is set to false.
96
+ *
97
+ * @param stackEntityId Entity id of a stack content item to remove the view from.
98
+ * @param view Identity of the view to remove.
99
+ * @throws If the stack does not exist or the view does not exist or belong to the stack.
100
+ */
101
+ removeViewFromStack: (stackEntityId: string, view: OpenFin.Identity) => Promise<void>;
102
+ /**
103
+ * @internal
104
+ * Creates a new adjacent 'stack' and adds the views to it at the specified position
105
+ * @param targetId Entity id of the content item to add a stack adjacent to it
106
+ * @param views List of identities or view creation options of the views to include in the stack
107
+ * @param options Creation options, defaults to { position: 'right' }
108
+ * @returns the Entity Id of the new stack
109
+ */
110
+ createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], { position }?: {
111
+ position?: OpenFin.LayoutPosition;
112
+ }) => Promise<string>;
113
+ getAdjacentStacks: ({ targetId, edge }: {
114
+ targetId: string;
115
+ edge: OpenFin.LayoutPosition;
116
+ }) => Promise<Pick<OpenFin.LayoutEntityDefinition, 'entityId'>[]>;
117
+ setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise<void>;
118
+ }
119
+ export {};
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LayoutEntitiesController = void 0;
10
+ const decorators_1 = require("../../../api-exposer/decorators");
11
+ const layout_traversal_1 = require("../utils/layout-traversal");
12
+ /**
13
+ * @internal
14
+ * Controller for the layout entities apis, allowing alterations to be applied
15
+ * to an instance of layout manager in a structured manner.
16
+ */
17
+ class LayoutEntitiesController {
18
+ constructor(
19
+ // workaround to prevent importing entire GoldenLayouts, also re-written at build time to type any
20
+ layoutManager, layoutContentCache) {
21
+ this.layoutManager = layoutManager;
22
+ this.layoutContentCache = layoutContentCache;
23
+ this.analytics = (topic) => {
24
+ this.wire.sendAction(`layout-controller-${topic}`).catch(() => {
25
+ // don't expose
26
+ });
27
+ };
28
+ /**
29
+ * @internal
30
+ * @returns the root contentItem of the layout.
31
+ */
32
+ this.getRoot = () => {
33
+ this.analytics('get-root');
34
+ const root = this.layoutManager.layout.root.contentItems[0];
35
+ return {
36
+ // TODO: fix typing
37
+ type: root.type,
38
+ entityId: this.layoutContentCache.getOrCreateEntityId(root)
39
+ };
40
+ };
41
+ /**
42
+ * @internal
43
+ * Retrieves the containing stack of a given view identity.
44
+ * @param view Identity of the view to retrieve the stack of.
45
+ * @returns Stack containing the given view.
46
+ * @throws If the view does not belong to a stack within the layout manager.
47
+ */
48
+ this.getStackByView = async (view) => {
49
+ var _a, _b, _c, _d;
50
+ this.analytics('get-stack-by-view');
51
+ const viewComponent = this.layoutManager.getViewComponent(view);
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') {
53
+ return undefined;
54
+ }
55
+ const stack = (_d = (_c = viewComponent.container) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.parent;
56
+ return { entityId: this.layoutContentCache.getOrCreateEntityId(stack), type: 'stack' };
57
+ };
58
+ /**
59
+ * @internal
60
+ * Returns all views belonging to a given stack
61
+ *
62
+ * NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
63
+ * when the amount of new views to add overflows the width of the container. This results
64
+ * in tabs being re-ordered in the UI, while the underlying content item array remains in the
65
+ * original order specified. So calling getStackViews() will return this underlying array order,
66
+ * with indexes that will not match up to the render-order of the tabs.
67
+ *
68
+ * @param id - Entity id of the stack.
69
+ * @returns A list of view identities in order of appearance.
70
+ * @throws if the content item associated with the entity id does not exist or is not a stack.
71
+ */
72
+ this.getStackViews = (id) => {
73
+ this.analytics('get-stack-views');
74
+ const stack = this.layoutContentCache.getContentItemOrThrow(id, ['stack']);
75
+ const views = stack.contentItems.map((ci) => {
76
+ var _a;
77
+ return ({
78
+ name: (_a = ci.config.componentState) === null || _a === void 0 ? void 0 : _a.name,
79
+ uuid: this.layoutManager.ofWindow.identity.uuid
80
+ });
81
+ });
82
+ return views;
83
+ };
84
+ /**
85
+ * @internal
86
+ * @param id Entity id associated with a layout content item.
87
+ * @returns true if the given entity is the root content item, false otherwise.
88
+ */
89
+ this.isRoot = (id) => {
90
+ var _a;
91
+ this.analytics('is-root');
92
+ const ci = this.layoutContentCache.getContentItemOrThrow(id);
93
+ return !!((_a = ci.parent) === null || _a === void 0 ? void 0 : _a.isRoot);
94
+ };
95
+ /**
96
+ * @internal
97
+ * Checks whether the given entity exists.
98
+ * @param entityId Id of a content item within the layout
99
+ * @returns True if the content item exists and belongs to the layout.
100
+ */
101
+ this.exists = (entityId) => {
102
+ this.analytics('exists');
103
+ return this.layoutContentCache.hasKey(entityId);
104
+ };
105
+ /**
106
+ * @internal
107
+ * Adds an existing view to the stack, or creates and adds a view to the given stack.
108
+ *
109
+ * NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
110
+ * when the amount of new views to add overflows the width of the container. This results
111
+ * in tabs being re-ordered in the UI, while the underlying content item array remains in the
112
+ * original order specified. So calling getStackViews() will return this underlying array order,
113
+ * with indexes that will not match up to the render-order of the tabs.
114
+ *
115
+ * @param stackEntityId Entity id of the stack content item within the layout.
116
+ * @param viewCreationOrReference View identity or creation options
117
+ * @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)
118
+ * @returns Promise resolving with the identity of the newly added view.
119
+ * @throws If the view does not exist, fails to create, or the stack does not exist.
120
+ */
121
+ this.addViewToStack = async (stackEntityId, viewCreationOrReference, { index } = { index: 0 }) => {
122
+ this.analytics('add-view-to-stack');
123
+ const currentStack = this.layoutContentCache.getContentItemOrThrow(stackEntityId);
124
+ if (index && index > currentStack.contentItems.length + 1) {
125
+ throw new Error(`Index '${index}' out of range, please exclude the index or specify a number between 0 and ${currentStack.contentItems.length}`);
126
+ }
127
+ const location = {
128
+ id: stackEntityId,
129
+ index
130
+ };
131
+ const { identity } = await this.layoutManager.platform.createView(viewCreationOrReference, {
132
+ ...this.layoutManager.ofWindow.identity,
133
+ location,
134
+ });
135
+ return identity;
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
+ };
140
+ /**
141
+ * @internal
142
+ * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
143
+ * option closeOnLastViewRemoved is set to false.
144
+ *
145
+ * @param stackEntityId Entity id of a stack content item to remove the view from.
146
+ * @param view Identity of the view to remove.
147
+ * @throws If the stack does not exist or the view does not exist or belong to the stack.
148
+ */
149
+ this.removeViewFromStack = async (stackEntityId, view) => {
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.`);
155
+ }
156
+ await this.layoutManager.platform.closeView(view);
157
+ };
158
+ /**
159
+ * @internal
160
+ * Creates a new adjacent 'stack' and adds the views to it at the specified position
161
+ * @param targetId Entity id of the content item to add a stack adjacent to it
162
+ * @param views List of identities or view creation options of the views to include in the stack
163
+ * @param options Creation options, defaults to { position: 'right' }
164
+ * @returns the Entity Id of the new stack
165
+ */
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.');
170
+ }
171
+ if (!['top', 'bottom', 'left', 'right'].includes(position)) {
172
+ throw new Error(`Invalid position '${position}' specified.`);
173
+ }
174
+ const currentStack = this.layoutContentCache.getContentItemOrThrow(targetId);
175
+ const { parent } = currentStack;
176
+ const containerType = ['top', 'bottom'].includes(position) ? 'column' : 'row';
177
+ const newContainer = this.layoutManager.layout.createContentItem({
178
+ type: containerType,
179
+ });
180
+ const newStack = this.layoutManager.layout.createContentItem({
181
+ type: 'stack'
182
+ });
183
+ parent.replaceChild(currentStack, newContainer);
184
+ newContainer.addChild(currentStack);
185
+ const offset = ['left', 'top'].includes(position) ? -1 : 1;
186
+ const newStackIndex = newContainer.contentItems.indexOf(currentStack) + offset;
187
+ newContainer.addChild(newStack, newStackIndex);
188
+ const entityId = this.layoutContentCache.getOrCreateEntityId(newStack);
189
+ // !! reverse the views list so we can utilize index=0 (prepending each tab)
190
+ // which will maintain correct order in the underlying GL structure and avoids the reflow bug
191
+ await Promise.all(views.reverse().map((view) => this.addViewToStack(entityId, view)));
192
+ return entityId;
193
+ };
194
+ this.getAdjacentStacks = async ({ targetId, edge }) => {
195
+ this.analytics('get-adjacent-stacks');
196
+ const contentItem = this.layoutContentCache.getContentItemOrThrow(targetId);
197
+ // call utils helper to traverse and return adjacent stacks
198
+ return (0, layout_traversal_1.getAdjacentStacks)(contentItem, edge).map((stack) => ({
199
+ entityId: this.layoutContentCache.getOrCreateEntityId(stack),
200
+ }));
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;
212
+ }
213
+ /**
214
+ * @internal
215
+ * Retrieves the content of a column or row and adds each to the
216
+ * entity cache to allow them to be addressed externally.
217
+ * @param id Entity id of the Column Or Row to retrieve the content of.
218
+ * @returns Array of layout entity definitions
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.
220
+ */
221
+ getContent(id) {
222
+ this.analytics('get-content');
223
+ const ci = this.layoutContentCache.getContentItemOrThrow(id, ['column', 'row']);
224
+ return ci.contentItems.map((item) => ({
225
+ type: item.type,
226
+ entityId: this.layoutContentCache.getOrCreateEntityId(item)
227
+ }));
228
+ }
229
+ ;
230
+ /**
231
+ * @internal
232
+ * Retrieves the parent content item of the given entity, and adds it to the entity cache
233
+ * so it can be addressed externally.
234
+ * @param id Entity id associated with a layout content item.
235
+ * @returns An entity definition for the given entity's parent, or undefined if the entity is the top level
236
+ * content item or has been removed from the layout entirely.
237
+ */
238
+ getParent(id) {
239
+ this.analytics('get-parent');
240
+ const ci = this.layoutContentCache.getContentItemOrThrow(id);
241
+ if (ci.parent && !ci.parent.isRoot && ci.parent.contentItems.includes(ci)) {
242
+ return {
243
+ type: ci.parent.type,
244
+ entityId: this.layoutContentCache.getOrCreateEntityId(ci.parent)
245
+ };
246
+ }
247
+ return undefined;
248
+ }
249
+ ;
250
+ }
251
+ __decorate([
252
+ (0, decorators_1.expose)()
253
+ ], LayoutEntitiesController.prototype, "getRoot", void 0);
254
+ __decorate([
255
+ (0, decorators_1.expose)()
256
+ ], LayoutEntitiesController.prototype, "getStackByView", void 0);
257
+ __decorate([
258
+ (0, decorators_1.expose)()
259
+ ], LayoutEntitiesController.prototype, "getStackViews", void 0);
260
+ __decorate([
261
+ (0, decorators_1.expose)()
262
+ ], LayoutEntitiesController.prototype, "getContent", null);
263
+ __decorate([
264
+ (0, decorators_1.expose)()
265
+ ], LayoutEntitiesController.prototype, "getParent", null);
266
+ __decorate([
267
+ (0, decorators_1.expose)()
268
+ ], LayoutEntitiesController.prototype, "isRoot", void 0);
269
+ __decorate([
270
+ (0, decorators_1.expose)()
271
+ ], LayoutEntitiesController.prototype, "exists", void 0);
272
+ __decorate([
273
+ (0, decorators_1.expose)()
274
+ ], LayoutEntitiesController.prototype, "addViewToStack", void 0);
275
+ __decorate([
276
+ (0, decorators_1.expose)()
277
+ ], LayoutEntitiesController.prototype, "removeViewFromStack", void 0);
278
+ __decorate([
279
+ (0, decorators_1.expose)()
280
+ ], LayoutEntitiesController.prototype, "createAdjacentStack", void 0);
281
+ __decorate([
282
+ (0, decorators_1.expose)()
283
+ ], LayoutEntitiesController.prototype, "getAdjacentStacks", void 0);
284
+ __decorate([
285
+ (0, decorators_1.expose)()
286
+ ], LayoutEntitiesController.prototype, "setStackActiveView", void 0);
287
+ exports.LayoutEntitiesController = LayoutEntitiesController;
@@ -1,6 +1,6 @@
1
1
  import type * as OpenFin from '../../../../OpenFin';
2
2
  import { ViewOverlay } from '../utils/view-overlay';
3
- import { View } from '../../../view';
3
+ type View = OpenFin.View;
4
4
  /**
5
5
  * Set of apis used to facilitate tab drag interactions without needing to hide views.
6
6
  * @ignore
@@ -56,3 +56,4 @@ export declare class TabDragController {
56
56
  */
57
57
  observeOverlay: (dropZonePreview: HTMLElement) => Promise<void>;
58
58
  }
59
+ export {};
@@ -0,0 +1,235 @@
1
+ import type * as OpenFin from '../../../../OpenFin';
2
+ import { LayoutEntitiesClient } from '../shapes';
3
+ /**
4
+ * @ignore
5
+ * @internal
6
+ * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
7
+ * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
8
+ */
9
+ export declare abstract class LayoutNode {
10
+ #private;
11
+ /**
12
+ * @internal
13
+ * @ignore
14
+ */
15
+ protected constructor(client: LayoutEntitiesClient, entityId: string);
16
+ abstract readonly type: OpenFin.LayoutEntityTypes;
17
+ /**
18
+ * @internal
19
+ * @ignore
20
+ * This instance's unique id used when calling the layout-entities-controller api client
21
+ */
22
+ protected readonly entityId: string;
23
+ /**
24
+ * @ignore
25
+ * @internal
26
+ * Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
27
+ * @param client
28
+ * @param controllerId
29
+ * @param identity
30
+ * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
31
+ */
32
+ static newLayoutEntitiesClient: (client: OpenFin.ChannelClient, controllerId: string, identity: OpenFin.Identity) => Promise<LayoutEntitiesClient>;
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;
61
+ /**
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.
68
+ */
69
+ /**
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.
76
+ */
77
+ /**
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.
84
+ */
85
+ /**
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}
96
+ *
97
+ * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
98
+ * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
99
+ * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
100
+ * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
101
+ *
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
109
+ * @experimental
110
+ */
111
+ /** @internal */
112
+ constructor(client: LayoutEntitiesClient, entityId: string);
113
+ /**
114
+ * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
115
+ */
116
+ readonly type = "stack";
117
+ /**
118
+ * Retrieves a list of all views belonging to this {@link TabStack}.
119
+ *
120
+ * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
121
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
122
+ * If that happens and then getViews() is called, it will return the identities in a different order than
123
+ * than the currently rendered tab order.
124
+ *
125
+ * @returns {Promise<Identity[]>} Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
126
+ * @throws If the {@link TabStack} has been destroyed.
127
+ * @tutorial TabStack.getViews
128
+ * @experimental
129
+ */
130
+ getViews: () => Promise<OpenFin.Identity[]>;
131
+ /**
132
+ * Adds or creates a view in this {@link TabStack}.
133
+ *
134
+ * Known Issue: If adding a view overflows the tab-container, the added view will be set as active
135
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
136
+ *
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.
140
+ * @throws If the view does not exist or fails to create.
141
+ * @throws If the {@link TabStack} has been destroyed.
142
+ * @tutorial TabStack.addView
143
+ * @experimental
144
+ */
145
+ addView: (view: OpenFin.Identity | OpenFin.PlatformViewCreationOptions, options?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
146
+ /**
147
+ * Removes a view from this {@link TabStack}.
148
+ * @param {Identity} view - Identity of the view to remove.
149
+ * @throws If the view does not exist or does not belong to the stack.
150
+ * @throws If the {@link TabStack} has been destroyed.
151
+ * @return {Promise<void>}
152
+ * @tutorial TabStack.removeView
153
+ */
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>;
165
+ }
166
+ /**
167
+ * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
168
+ */
169
+ export declare class ColumnOrRow extends LayoutNode {
170
+ #private;
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
+ */
224
+ constructor(client: LayoutEntitiesClient, entityId: string, type: 'row' | 'column');
225
+ /**
226
+ * The type of this {@link ColumnOrRow}. Either 'row' or 'column'.
227
+ */
228
+ readonly type: 'column' | 'row';
229
+ /**
230
+ * Retrieves a list of all content items belonging to this {@link ColumnOrRow} in order of appearance.
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
233
+ */
234
+ getContent: () => Promise<(ColumnOrRow | TabStack)[]>;
235
+ }