@openfin/core 31.74.21 → 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 (92) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +77 -18
  3. package/src/api/api-exposer/api-consumer.d.ts +28 -0
  4. package/src/api/api-exposer/api-consumer.js +28 -0
  5. package/src/api/api-exposer/api-exposer.d.ts +35 -0
  6. package/src/api/api-exposer/api-exposer.js +38 -0
  7. package/src/api/api-exposer/decorators.d.ts +10 -0
  8. package/src/api/api-exposer/decorators.js +18 -0
  9. package/src/api/api-exposer/index.d.ts +4 -0
  10. package/src/api/api-exposer/index.js +20 -0
  11. package/src/api/api-exposer/strategies/index.d.ts +1 -0
  12. package/src/api/api-exposer/strategies/index.js +17 -0
  13. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
  14. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
  15. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
  16. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
  17. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
  18. package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
  19. package/src/api/application/Factory.js +0 -1
  20. package/src/api/application/Instance.js +23 -5
  21. package/src/api/base.d.ts +1 -2
  22. package/src/api/base.js +1 -2
  23. package/src/api/events/system.d.ts +6 -3
  24. package/src/api/fin.js +1 -2
  25. package/src/api/interappbus/channel/index.d.ts +1 -0
  26. package/src/api/interappbus/channel/index.js +47 -47
  27. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  28. package/src/api/interappbus/index.js +1 -1
  29. package/src/api/interop/InteropClient.d.ts +1 -1
  30. package/src/api/interop/InteropClient.js +1 -1
  31. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  32. package/src/api/interop/SessionContextGroupBroker.js +5 -4
  33. package/src/api/interop/SessionContextGroupClient.js +1 -1
  34. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  35. package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
  36. package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
  37. package/src/api/interop/fdc3/fdc3-2.0.d.ts +11 -10
  38. package/src/api/interop/fdc3/fdc3-2.0.js +10 -9
  39. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
  40. package/src/api/interop/fdc3/utils.js +24 -4
  41. package/src/api/platform/Factory.d.ts +2 -1
  42. package/src/api/platform/Factory.js +1 -4
  43. package/src/api/platform/Instance.d.ts +6 -5
  44. package/src/api/platform/Instance.js +1 -0
  45. package/src/api/platform/layout/Factory.js +15 -4
  46. package/src/api/platform/layout/Instance.d.ts +6 -0
  47. package/src/api/platform/layout/Instance.js +29 -1
  48. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
  49. package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
  50. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +119 -0
  51. package/src/api/platform/layout/controllers/layout-entities-controller.js +287 -0
  52. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
  53. package/src/api/platform/layout/entities/layout-entities.d.ts +235 -0
  54. package/src/api/platform/layout/entities/layout-entities.js +312 -0
  55. package/src/api/platform/layout/entities/shapes.d.ts +6 -0
  56. package/src/api/platform/layout/entities/shapes.js +2 -0
  57. package/src/api/platform/layout/layout.constants.d.ts +1 -0
  58. package/src/api/platform/layout/layout.constants.js +4 -0
  59. package/src/api/platform/layout/shapes.d.ts +3 -0
  60. package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
  61. package/src/api/platform/layout/utils/layout-traversal.js +65 -0
  62. package/src/api/platform/provider.d.ts +2 -1
  63. package/src/api/system/index.d.ts +9 -0
  64. package/src/api/system/index.js +78 -40
  65. package/src/api/view/Instance.d.ts +12 -3
  66. package/src/api/view/Instance.js +39 -4
  67. package/src/api/webcontents/main.d.ts +2 -22
  68. package/src/api/webcontents/main.js +2 -1
  69. package/src/api/window/Instance.d.ts +10 -0
  70. package/src/api/window/Instance.js +22 -0
  71. package/src/environment/mockEnvironment.d.ts +27 -0
  72. package/src/environment/mockEnvironment.js +61 -0
  73. package/src/mock.js +4 -83
  74. package/src/shapes/protocol.d.ts +17 -0
  75. package/src/transport/mockWire.d.ts +11 -0
  76. package/src/transport/mockWire.js +26 -0
  77. package/src/transport/transport-errors.d.ts +9 -1
  78. package/src/transport/transport-errors.js +45 -2
  79. package/src/transport/transport.d.ts +15 -5
  80. package/src/transport/transport.js +48 -20
  81. package/src/util/channel-api-relay.d.ts +13 -0
  82. package/src/util/channel-api-relay.js +47 -0
  83. package/src/util/errors.d.ts +1 -0
  84. package/src/util/errors.js +1 -0
  85. package/src/util/lazy.d.ts +34 -0
  86. package/src/util/lazy.js +54 -0
  87. package/src/util/ref-counter.d.ts +1 -1
  88. package/src/util/ref-counter.js +3 -2
  89. package/src/util/reversible-map.d.ts +11 -0
  90. package/src/util/reversible-map.js +49 -0
  91. package/src/transport/fin_store.d.ts +0 -4
  92. package/src/transport/fin_store.js +0 -16
@@ -1,8 +1,8 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
- import { Channel } from '../interappbus/channel/index';
4
3
  import { Transport } from '../../transport/transport';
5
4
  import { LayoutModule } from './layout/index';
5
+ type Channel = OpenFin.Fin['InterApplicationBus']['Channel'];
6
6
  /**
7
7
  * @PORTED
8
8
  * InitPlatformOptions interface
@@ -113,3 +113,4 @@ export default class PlatformModule extends Base {
113
113
  */
114
114
  startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise<OpenFin.Platform>;
115
115
  }
116
+ export {};
@@ -152,8 +152,7 @@ class PlatformModule extends base_1.Base {
152
152
  // TODO: fix typing (internal)
153
153
  // @ts-expect-error
154
154
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid })));
155
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
156
- // @ts-ignore using private variable.
155
+ // @ts-expect-error using private variable.
157
156
  app._run({ uuid });
158
157
  }
159
158
  catch (e) {
@@ -177,13 +176,11 @@ class PlatformModule extends base_1.Base {
177
176
  // eslint-disable-next-line no-async-promise-executor
178
177
  return new Promise(async (resolve, reject) => {
179
178
  try {
180
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
181
179
  // @ts-expect-error using private variable.
182
180
  const app = await this.fin.Application._createFromManifest(manifestUrl);
183
181
  // TODO: fix typing (internal)
184
182
  // @ts-expect-error
185
183
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid })));
186
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
187
184
  // @ts-expect-error using private method without warning.
188
185
  app._run(opts);
189
186
  }
@@ -1,9 +1,9 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
- import { View } from '../view';
3
2
  import { EmitterBase } from '../base';
4
- import { Channel } from '../interappbus/channel/index';
5
- import ChannelClient from '../interappbus/channel/client';
6
- import { LayoutModule } from './layout';
3
+ type View = OpenFin.View;
4
+ type Channel = OpenFin.Fin['InterApplicationBus']['Channel'];
5
+ type ChannelClient = OpenFin.ChannelClient;
6
+ type LayoutModule = OpenFin.Fin['Platform']['Layout'];
7
7
  /** Manages the life cycle of windows and views in the application.
8
8
  *
9
9
  * Enables taking snapshots of itself and applyi
@@ -27,7 +27,7 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
27
27
  * @return { Promise<View> }
28
28
  * @tutorial Platform.createView
29
29
  */
30
- createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.Identity, targetView?: OpenFin.Identity): Promise<View>;
30
+ createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.CreateViewTarget, targetView?: OpenFin.Identity): Promise<View>;
31
31
  /**
32
32
  * Creates a new Window.
33
33
  * @param { Window~options } options Window creation options
@@ -147,3 +147,4 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
147
147
  skipBeforeUnload: boolean;
148
148
  }): Promise<void>;
149
149
  }
150
+ export {};
@@ -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
@@ -10,7 +10,7 @@ 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_layoutManager, _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 */
@@ -19,6 +19,10 @@ const Instance_1 = require("./Instance");
19
19
  const base_1 = require("../../base");
20
20
  const splitter_controller_1 = require("./controllers/splitter-controller");
21
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");
22
26
  /**
23
27
  * @PORTED
24
28
  * InitLayoutOptions interface
@@ -87,6 +91,7 @@ class LayoutModule extends base_1.Base {
87
91
  constructor() {
88
92
  super(...arguments);
89
93
  _LayoutModule_layoutManager.set(this, void 0);
94
+ _LayoutModule_layoutInitializationAttempted.set(this, false);
90
95
  /**
91
96
  * Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
92
97
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
@@ -105,15 +110,17 @@ class LayoutModule extends base_1.Base {
105
110
  if (!this.fin.me.isWindow) {
106
111
  throw new Error('Layout.init can only be called from a Window context.');
107
112
  }
108
- else if (__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f")) {
113
+ else if (__classPrivateFieldGet(this, _LayoutModule_layoutInitializationAttempted, "f")) {
109
114
  throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
110
115
  }
116
+ __classPrivateFieldSet(this, _LayoutModule_layoutInitializationAttempted, true, "f");
111
117
  // We need to go through environment to make sure it is only imported/bundled in OpenFin.
112
118
  const ManagerConstructor = await this.wire.environment.getManagerConstructor();
113
119
  const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
114
120
  const splitterController = new splitter_controller_1.SplitterController(viewOverlay);
115
121
  const tabDragController = new tab_drag_controller_1.TabDragController(viewOverlay);
116
- __classPrivateFieldSet(this, _LayoutModule_layoutManager, new ManagerConstructor(splitterController, tabDragController), "f");
122
+ const contentItemCache = new layout_content_cache_1.LayoutContentCache();
123
+ __classPrivateFieldSet(this, _LayoutModule_layoutManager, new ManagerConstructor(splitterController, tabDragController, contentItemCache), "f");
117
124
  // @ts-expect-error - layout warning here for backwards compatibility, can remove layout check in .52
118
125
  let { layout, containerId } = options;
119
126
  if (layout) {
@@ -128,6 +135,10 @@ class LayoutModule extends base_1.Base {
128
135
  // pull createChannelConnection out of LayoutManager and setup channel connections here using layoutmanager instance methods?
129
136
  await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").initManager();
130
137
  await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").createLayout(layout, container);
138
+ const { client, ofWindow } = ManagerConstructor.getClientAndWindow(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"));
139
+ // expose LayoutEntitiesController instance for API consumption
140
+ const channelStrategy = new api_exposer_1.ChannelsExposer(client);
141
+ 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 });
131
142
  // Adding this to the returned instance undocumented/typed for Browser.
132
143
  return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f") });
133
144
  };
@@ -194,4 +205,4 @@ class LayoutModule extends base_1.Base {
194
205
  }
195
206
  }
196
207
  exports.LayoutModule = LayoutModule;
197
- _LayoutModule_layoutManager = new WeakMap();
208
+ _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_layoutInitializationAttempted = new WeakMap();
@@ -8,6 +8,7 @@ type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
8
8
  * @lends Platform#Layout
9
9
  */
10
10
  export declare class Layout extends Base {
11
+ #private;
11
12
  init: (options?: InitLayoutOptions) => Promise<Layout>;
12
13
  identity: Identity;
13
14
  private platform;
@@ -19,6 +20,11 @@ export declare class Layout extends Base {
19
20
  * @tutorial Layout.getConfig
20
21
  */
21
22
  getConfig(): Promise<any>;
23
+ /**
24
+ * Retrieves the top level content item of the layout.
25
+ * @return {Promise<TabStack | ColumnOrRow>}
26
+ */
27
+ getRootItem(): Promise<OpenFin.ColumnOrRow | OpenFin.TabStack>;
22
28
  /**
23
29
  * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
24
30
  * will be destroyed.
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _Layout_layoutClient;
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.Layout = void 0;
10
+ const lazy_1 = require("../../../util/lazy");
4
11
  const validate_1 = require("../../../util/validate");
5
- const common_utils_1 = require("../common-utils");
6
12
  const base_1 = require("../../base");
13
+ const common_utils_1 = require("../common-utils");
14
+ const layout_entities_1 = require("./entities/layout-entities");
15
+ const layout_constants_1 = require("./layout.constants");
7
16
  /**
8
17
  * @lends Platform#Layout
9
18
  */
@@ -11,6 +20,12 @@ class Layout extends base_1.Base {
11
20
  // eslint-disable-next-line no-shadow
12
21
  constructor(identity, wire) {
13
22
  super(wire);
23
+ /**
24
+ * @internal
25
+ * Lazily constructed {@link LayoutEntitiesClient} bound to this platform's client and identity
26
+ * The client is for {@link LayoutEntitiesController}
27
+ */
28
+ _Layout_layoutClient.set(this, new lazy_1.Lazy(async () => layout_entities_1.LayoutNode.newLayoutEntitiesClient(await this.platform.getClient(), layout_constants_1.LAYOUT_CONTROLLER_ID, this.identity)));
14
29
  /**
15
30
  * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
16
31
  * will be destroyed.
@@ -94,5 +109,18 @@ class Layout extends base_1.Base {
94
109
  target: this.identity
95
110
  });
96
111
  }
112
+ /**
113
+ * Retrieves the top level content item of the layout.
114
+ * @return {Promise<TabStack | ColumnOrRow>}
115
+ */
116
+ async getRootItem() {
117
+ this.wire.sendAction('layout-get-root-item').catch(() => {
118
+ // don't expose
119
+ });
120
+ const client = await __classPrivateFieldGet(this, _Layout_layoutClient, "f").getValue();
121
+ const root = await client.getRoot();
122
+ return layout_entities_1.LayoutNode.getEntity(root, client);
123
+ }
97
124
  }
98
125
  exports.Layout = Layout;
126
+ _Layout_layoutClient = new WeakMap();
@@ -0,0 +1,9 @@
1
+ export declare class LayoutContentCache {
2
+ private contentItemCache;
3
+ private contentItemCacheId;
4
+ private createCacheKey;
5
+ hasKey: (id: string) => boolean;
6
+ getItemOrUndefined: (id: string) => GoldenLayout.ContentItem | undefined;
7
+ getContentItemOrThrow: (id: string, expectedType?: string[]) => GoldenLayout.ContentItem;
8
+ getOrCreateEntityId: (contentItem: GoldenLayout.ContentItem) => string;
9
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LayoutContentCache = void 0;
4
+ const reversible_map_1 = require("../../../../util/reversible-map");
5
+ class LayoutContentCache {
6
+ constructor() {
7
+ // ContentItems currently do not have a unique id, this helps us to lookup items by value
8
+ this.contentItemCache = new reversible_map_1.ReversibleMap();
9
+ this.contentItemCacheId = 0;
10
+ this.createCacheKey = () => {
11
+ const key = `entity-${this.contentItemCacheId.toString()}`;
12
+ this.contentItemCacheId += 1;
13
+ return key;
14
+ };
15
+ this.hasKey = (id) => {
16
+ return this.contentItemCache.hasKey(id);
17
+ };
18
+ this.getItemOrUndefined = (id) => {
19
+ try {
20
+ return this.getContentItemOrThrow(id);
21
+ }
22
+ catch (error) {
23
+ return undefined;
24
+ }
25
+ };
26
+ this.getContentItemOrThrow = (id, expectedType) => {
27
+ if (!this.contentItemCache.hasKey(id)) {
28
+ throw new Error('Layout component has been destroyed or detached from the current layout.');
29
+ }
30
+ const contentItem = this.contentItemCache.getValue(id);
31
+ if (expectedType && !expectedType.includes(contentItem.type)) {
32
+ throw new Error(`Layout item is not the expected type. Expected ${expectedType.join(', ')}, got ${contentItem.type}.`);
33
+ }
34
+ return contentItem;
35
+ };
36
+ this.getOrCreateEntityId = (contentItem) => {
37
+ if (this.contentItemCache.hasValue(contentItem)) {
38
+ return this.contentItemCache.getKey(contentItem);
39
+ }
40
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
+ const onItemDestroyed = ({ origin, ...rest }) => {
42
+ if (origin === contentItem) {
43
+ this.contentItemCache.deleteValue(contentItem);
44
+ contentItem.unbind('itemDestroyed', onItemDestroyed);
45
+ }
46
+ };
47
+ contentItem.on('itemDestroyed', onItemDestroyed);
48
+ const key = this.createCacheKey();
49
+ this.contentItemCache.setUnique(key, contentItem);
50
+ return key;
51
+ };
52
+ }
53
+ }
54
+ exports.LayoutContentCache = LayoutContentCache;
@@ -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 {};