@openfin/core 33.76.36 → 33.77.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 (271) hide show
  1. package/OpenFin.d.ts +1 -1
  2. package/README.md +29 -4
  3. package/fin.d.ts +2 -2
  4. package/{src → out}/GlobalOpenFin.d.ts +1 -1
  5. package/out/mock-alpha.d.ts +16112 -0
  6. package/out/mock-beta.d.ts +16112 -0
  7. package/out/mock-public.d.ts +16112 -0
  8. package/out/mock.d.ts +16797 -0
  9. package/out/mock.js +17111 -0
  10. package/package.json +30 -23
  11. package/LICENSE +0 -13
  12. package/NOTICE +0 -16
  13. package/openfin-core-33.76.36.tgz +0 -0
  14. package/src/OpenFin.d.ts +0 -3091
  15. package/src/OpenFin.js +0 -2
  16. package/src/api/api-exposer/api-consumer.d.ts +0 -28
  17. package/src/api/api-exposer/api-consumer.js +0 -28
  18. package/src/api/api-exposer/api-exposer.d.ts +0 -35
  19. package/src/api/api-exposer/api-exposer.js +0 -38
  20. package/src/api/api-exposer/decorators.d.ts +0 -10
  21. package/src/api/api-exposer/decorators.js +0 -18
  22. package/src/api/api-exposer/index.d.ts +0 -4
  23. package/src/api/api-exposer/index.js +0 -20
  24. package/src/api/api-exposer/strategies/index.d.ts +0 -1
  25. package/src/api/api-exposer/strategies/index.js +0 -17
  26. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
  27. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
  28. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
  29. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
  30. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
  31. package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
  32. package/src/api/application/Factory.d.ts +0 -196
  33. package/src/api/application/Factory.js +0 -278
  34. package/src/api/application/Instance.d.ts +0 -692
  35. package/src/api/application/Instance.js +0 -821
  36. package/src/api/application/index.d.ts +0 -12
  37. package/src/api/application/index.js +0 -28
  38. package/src/api/base.d.ts +0 -117
  39. package/src/api/base.js +0 -246
  40. package/src/api/clipboard/index.d.ts +0 -172
  41. package/src/api/clipboard/index.js +0 -200
  42. package/src/api/events/application.d.ts +0 -158
  43. package/src/api/events/application.js +0 -14
  44. package/src/api/events/base.d.ts +0 -42
  45. package/src/api/events/base.js +0 -2
  46. package/src/api/events/channel.d.ts +0 -35
  47. package/src/api/events/channel.js +0 -7
  48. package/src/api/events/emitterMap.d.ts +0 -11
  49. package/src/api/events/emitterMap.js +0 -35
  50. package/src/api/events/eventAggregator.d.ts +0 -5
  51. package/src/api/events/eventAggregator.js +0 -35
  52. package/src/api/events/externalApplication.d.ts +0 -24
  53. package/src/api/events/externalApplication.js +0 -7
  54. package/src/api/events/frame.d.ts +0 -35
  55. package/src/api/events/frame.js +0 -2
  56. package/src/api/events/globalHotkey.d.ts +0 -25
  57. package/src/api/events/globalHotkey.js +0 -2
  58. package/src/api/events/platform.d.ts +0 -34
  59. package/src/api/events/platform.js +0 -10
  60. package/src/api/events/system.d.ts +0 -126
  61. package/src/api/events/system.js +0 -15
  62. package/src/api/events/typedEventEmitter.d.ts +0 -20
  63. package/src/api/events/typedEventEmitter.js +0 -2
  64. package/src/api/events/view.d.ts +0 -92
  65. package/src/api/events/view.js +0 -12
  66. package/src/api/events/webcontents.d.ts +0 -277
  67. package/src/api/events/webcontents.js +0 -13
  68. package/src/api/events/window.d.ts +0 -421
  69. package/src/api/events/window.js +0 -12
  70. package/src/api/external-application/Factory.d.ts +0 -34
  71. package/src/api/external-application/Factory.js +0 -47
  72. package/src/api/external-application/Instance.d.ts +0 -110
  73. package/src/api/external-application/Instance.js +0 -117
  74. package/src/api/external-application/index.d.ts +0 -12
  75. package/src/api/external-application/index.js +0 -28
  76. package/src/api/fin.d.ts +0 -54
  77. package/src/api/fin.js +0 -45
  78. package/src/api/frame/Factory.d.ts +0 -54
  79. package/src/api/frame/Factory.js +0 -86
  80. package/src/api/frame/Instance.d.ts +0 -136
  81. package/src/api/frame/Instance.js +0 -143
  82. package/src/api/frame/index.d.ts +0 -14
  83. package/src/api/frame/index.js +0 -30
  84. package/src/api/global-hotkey/index.d.ts +0 -106
  85. package/src/api/global-hotkey/index.js +0 -132
  86. package/src/api/interappbus/channel/channel.d.ts +0 -285
  87. package/src/api/interappbus/channel/channel.js +0 -334
  88. package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
  89. package/src/api/interappbus/channel/channels-docs.js +0 -401
  90. package/src/api/interappbus/channel/client.d.ts +0 -117
  91. package/src/api/interappbus/channel/client.js +0 -181
  92. package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
  93. package/src/api/interappbus/channel/connection-manager.js +0 -246
  94. package/src/api/interappbus/channel/index.d.ts +0 -189
  95. package/src/api/interappbus/channel/index.js +0 -333
  96. package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
  97. package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
  98. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
  99. package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
  100. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
  101. package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
  102. package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
  103. package/src/api/interappbus/channel/protocols/index.js +0 -2
  104. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
  105. package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
  106. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
  107. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
  108. package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
  109. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
  110. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
  111. package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
  112. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
  113. package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
  114. package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
  115. package/src/api/interappbus/channel/protocols/strategy.js +0 -2
  116. package/src/api/interappbus/channel/provider.d.ts +0 -206
  117. package/src/api/interappbus/channel/provider.js +0 -338
  118. package/src/api/interappbus/index.d.ts +0 -120
  119. package/src/api/interappbus/index.js +0 -210
  120. package/src/api/interop/Factory.d.ts +0 -57
  121. package/src/api/interop/Factory.js +0 -96
  122. package/src/api/interop/InteropBroker.d.ts +0 -665
  123. package/src/api/interop/InteropBroker.js +0 -1313
  124. package/src/api/interop/InteropClient.d.ts +0 -502
  125. package/src/api/interop/InteropClient.js +0 -683
  126. package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
  127. package/src/api/interop/SessionContextGroupBroker.js +0 -108
  128. package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
  129. package/src/api/interop/SessionContextGroupClient.js +0 -86
  130. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
  131. package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
  132. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
  133. package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
  134. package/src/api/interop/fdc3/documentationStub.d.ts +0 -14
  135. package/src/api/interop/fdc3/documentationStub.js +0 -17
  136. package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
  137. package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
  138. package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
  139. package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
  140. package/src/api/interop/fdc3/fdc3.d.ts +0 -12
  141. package/src/api/interop/fdc3/fdc3.js +0 -35
  142. package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
  143. package/src/api/interop/fdc3/overrideCheck.js +0 -32
  144. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
  145. package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
  146. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
  147. package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
  148. package/src/api/interop/fdc3/utils.d.ts +0 -45
  149. package/src/api/interop/fdc3/utils.js +0 -239
  150. package/src/api/interop/fdc3/versions.d.ts +0 -1
  151. package/src/api/interop/fdc3/versions.js +0 -2
  152. package/src/api/interop/index.d.ts +0 -12
  153. package/src/api/interop/index.js +0 -28
  154. package/src/api/interop/utils.d.ts +0 -18
  155. package/src/api/interop/utils.js +0 -61
  156. package/src/api/me.d.ts +0 -40
  157. package/src/api/me.js +0 -134
  158. package/src/api/platform/Factory.d.ts +0 -171
  159. package/src/api/platform/Factory.js +0 -240
  160. package/src/api/platform/Instance.d.ts +0 -653
  161. package/src/api/platform/Instance.js +0 -834
  162. package/src/api/platform/common-utils.d.ts +0 -7
  163. package/src/api/platform/common-utils.js +0 -16
  164. package/src/api/platform/index.d.ts +0 -12
  165. package/src/api/platform/index.js +0 -28
  166. package/src/api/platform/layout/Factory.d.ts +0 -91
  167. package/src/api/platform/layout/Factory.js +0 -151
  168. package/src/api/platform/layout/Instance.d.ts +0 -192
  169. package/src/api/platform/layout/Instance.js +0 -224
  170. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
  171. package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
  172. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
  173. package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
  174. package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
  175. package/src/api/platform/layout/entities/layout-entities.js +0 -504
  176. package/src/api/platform/layout/entities/shapes.d.ts +0 -6
  177. package/src/api/platform/layout/entities/shapes.js +0 -2
  178. package/src/api/platform/layout/index.d.ts +0 -11
  179. package/src/api/platform/layout/index.js +0 -27
  180. package/src/api/platform/layout/layout.constants.d.ts +0 -1
  181. package/src/api/platform/layout/layout.constants.js +0 -4
  182. package/src/api/platform/layout/shapes.d.ts +0 -16
  183. package/src/api/platform/layout/shapes.js +0 -2
  184. package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
  185. package/src/api/platform/layout/utils/layout-traversal.js +0 -65
  186. package/src/api/platform/provider.d.ts +0 -510
  187. package/src/api/platform/provider.js +0 -2
  188. package/src/api/snapshot-source/Factory.d.ts +0 -53
  189. package/src/api/snapshot-source/Factory.js +0 -81
  190. package/src/api/snapshot-source/Instance.d.ts +0 -53
  191. package/src/api/snapshot-source/Instance.js +0 -154
  192. package/src/api/snapshot-source/index.d.ts +0 -12
  193. package/src/api/snapshot-source/index.js +0 -28
  194. package/src/api/snapshot-source/utils.d.ts +0 -2
  195. package/src/api/snapshot-source/utils.js +0 -6
  196. package/src/api/system/index.d.ts +0 -1468
  197. package/src/api/system/index.js +0 -1851
  198. package/src/api/view/Factory.d.ts +0 -88
  199. package/src/api/view/Factory.js +0 -141
  200. package/src/api/view/Instance.d.ts +0 -601
  201. package/src/api/view/Instance.js +0 -671
  202. package/src/api/view/index.d.ts +0 -12
  203. package/src/api/view/index.js +0 -28
  204. package/src/api/webcontents/main.d.ts +0 -922
  205. package/src/api/webcontents/main.js +0 -1046
  206. package/src/api/window/Factory.d.ts +0 -96
  207. package/src/api/window/Factory.js +0 -142
  208. package/src/api/window/Instance.d.ts +0 -1598
  209. package/src/api/window/Instance.js +0 -1851
  210. package/src/api/window/index.d.ts +0 -14
  211. package/src/api/window/index.js +0 -30
  212. package/src/browser.d.ts +0 -10
  213. package/src/browser.js +0 -36
  214. package/src/environment/browser.d.ts +0 -29
  215. package/src/environment/browser.js +0 -60
  216. package/src/environment/environment.d.ts +0 -33
  217. package/src/environment/environment.js +0 -4
  218. package/src/environment/mockEnvironment.d.ts +0 -27
  219. package/src/environment/mockEnvironment.js +0 -61
  220. package/src/environment/node-env.d.ts +0 -29
  221. package/src/environment/node-env.js +0 -72
  222. package/src/fdc3.d.ts +0 -3
  223. package/src/fdc3.js +0 -9
  224. package/src/mock.d.ts +0 -3
  225. package/src/mock.js +0 -18
  226. package/src/namespaces.d.ts +0 -22
  227. package/src/namespaces.js +0 -26
  228. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
  229. package/src/shapes/ERROR_BOX_TYPES.js +0 -2
  230. package/src/shapes/WebOptions.d.ts +0 -13
  231. package/src/shapes/WebOptions.js +0 -2
  232. package/src/shapes/WindowOptions.d.ts +0 -43
  233. package/src/shapes/WindowOptions.js +0 -2
  234. package/src/shapes/protocol.d.ts +0 -204
  235. package/src/shapes/protocol.js +0 -2
  236. package/src/transport/mockWire.d.ts +0 -11
  237. package/src/transport/mockWire.js +0 -26
  238. package/src/transport/transport-errors.d.ts +0 -31
  239. package/src/transport/transport-errors.js +0 -79
  240. package/src/transport/transport.d.ts +0 -73
  241. package/src/transport/transport.js +0 -219
  242. package/src/transport/wire.d.ts +0 -77
  243. package/src/transport/wire.js +0 -36
  244. package/src/util/asyncFilter.d.ts +0 -1
  245. package/src/util/asyncFilter.js +0 -7
  246. package/src/util/channel-api-relay.d.ts +0 -13
  247. package/src/util/channel-api-relay.js +0 -47
  248. package/src/util/errors.d.ts +0 -10
  249. package/src/util/errors.js +0 -12
  250. package/src/util/exhaustive.d.ts +0 -1
  251. package/src/util/exhaustive.js +0 -7
  252. package/src/util/http.d.ts +0 -11
  253. package/src/util/http.js +0 -90
  254. package/src/util/inaccessibleObject.d.ts +0 -2
  255. package/src/util/inaccessibleObject.js +0 -49
  256. package/src/util/lazy.d.ts +0 -34
  257. package/src/util/lazy.js +0 -54
  258. package/src/util/normalize-config.d.ts +0 -3
  259. package/src/util/normalize-config.js +0 -52
  260. package/src/util/promises.d.ts +0 -5
  261. package/src/util/promises.js +0 -27
  262. package/src/util/ref-counter.d.ts +0 -7
  263. package/src/util/ref-counter.js +0 -52
  264. package/src/util/reversible-map.d.ts +0 -11
  265. package/src/util/reversible-map.js +0 -49
  266. package/src/util/runtimeVersioning.d.ts +0 -3
  267. package/src/util/runtimeVersioning.js +0 -25
  268. package/src/util/utilTypes.d.ts +0 -8
  269. package/src/util/utilTypes.js +0 -2
  270. package/src/util/validate.d.ts +0 -3
  271. package/src/util/validate.js +0 -11
@@ -1,287 +0,0 @@
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;