@openfin/core-web 0.38.32 → 0.38.37

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.
@@ -1,6 +1,6 @@
1
1
  # Platform Developer Guide
2
2
 
3
- If you are a Platform owner who wishes to include OpenFin's web capabilities in your platform, there are a few steps required. This section will guide you through the process of setting up an environment. Please note, none of these steps are necessary for content developers (See the [content developer guide](web-application-developer-guide.md)).
3
+ If you are a Platform owner who wants to include OpenFin's web capabilities in your platform, there are a few steps required. This section will guide you through the process of setting up an environment. Please note, none of these steps are necessary for content developers (See the [content developer guide](web-application-developer-guide.md)).
4
4
 
5
5
  ## First Steps
6
6
 
@@ -10,21 +10,21 @@ Ensure that `@openfin/core-web` is installed by running the following command:
10
10
  npm i @openfin/core-web -S
11
11
  ```
12
12
 
13
- ## Hosting the `@openfin/core-web` Shared Worker
13
+ ### Host the `@openfin/core-web` Shared Worker
14
14
 
15
15
  An `@openfin/core-web/shared-worker` entry point is included in this package's distribution. This is a non-customizable, standalone piece of javascript that must be hosted on your server for `@openfin/core-web` to function.
16
16
 
17
- This file has already been bundled, which means consumers just need to host it on their server on a known url.
17
+ This file has already been bundled, which means you just need to host it on a web server on a known URL.
18
18
 
19
- ## Building a Web Broker
19
+ ## Build a Web Broker
20
20
 
21
- An html page, loaded as a hidden iframe by clients, must be hosted in the same origin as the `@openfin/shared-worker`. This iframe acts as a gatekeeper to the `shared-worker` and therefore must be hosted on the same domain.
21
+ An HTML page, loaded as a hidden iframe by clients, must be hosted in the same origin as the `@openfin/shared-worker`. This iframe acts as a gatekeeper to the `shared-worker` and therefore must be hosted on the same domain.
22
22
 
23
23
  In order to build a Web Broker, the following requirements must be met:
24
24
 
25
25
  1. You must host the `@openfin/core-web/shared-worker` bundle on a domain (for example https://www.example.com/mysharedworker.js).
26
26
  2. You must host a web broker page on that same domain (for example, https://www.example.com/web-broker).
27
- 3. That page must call `init` from `@openfin/core-web/iframe-broker` with the url of the shared worker hosted in step 1.
27
+ 3. That page must call `init` from `@openfin/core-web/iframe-broker` with the URL of the shared worker hosted in step 1.
28
28
 
29
29
  ```typescript
30
30
  // Runs on https://www.example.com/web-broker
@@ -37,11 +37,11 @@ In order to build a Web Broker, the following requirements must be met:
37
37
 
38
38
  Here is a basic example of hosting a Web Broker:
39
39
 
40
- #### Example: Setting up a Basic Web Broker
40
+ ### Example: Set up a Basic Web Broker
41
41
 
42
42
  First, host `@openfin/core-web/shared-worker` at `/openfin-shared-worker.js`
43
43
 
44
- _iframe-broker.html_
44
+ File: iframe-broker.html
45
45
 
46
46
  ```html
47
47
  <html>
@@ -51,7 +51,7 @@ _iframe-broker.html_
51
51
  </html>
52
52
  ```
53
53
 
54
- _iframe-broker.js_
54
+ File: iframe-broker.js
55
55
 
56
56
  ```typescript
57
57
  import { init } from '@openfin/core-web/iframe-broker';
@@ -61,13 +61,13 @@ init({
61
61
  });
62
62
  ```
63
63
 
64
- ## Rejecting Connections
64
+ ## Reject Connections
65
65
 
66
- As an owner of an Iframe Broker, you should first and foremost rely on existing web security tools such as the frame-ancestors CSP rule to prevent content from connecting to you which you don't expect.
66
+ As an owner of an Iframe Broker, you should first rely on existing web security tools such as the frame-ancestors CSP rule to prevent content from connecting to you which you don't expect.
67
67
 
68
- `@openfin/core-web` exposes a `rejectConnections` utility if you wish to implement more bespoke logic. If neither `init` or `rejectConnection` is invoked, an embedding client may hang indefinitely.
68
+ `@openfin/core-web` exposes a `rejectConnections` utility if you wish to implement custom rejection logic. If neither `init` or `rejectConnection` is invoked, an embedding client may hang indefinitely.
69
69
 
70
- #### Example: Rejecting a Cross Origin Connection using `@openfin/core-web/iframe-broker`
70
+ ### Example: Reject a Cross Origin Connection using `@openfin/core-web/iframe-broker`
71
71
 
72
72
  ```typescript
73
73
  import { init, rejectConnections } from '@openfin/core-web/iframe-broker';
@@ -84,11 +84,11 @@ if (new URL(document.referrer).origin !== location.origin) {
84
84
  }
85
85
  ```
86
86
 
87
- ## Experimental: Enabling Cross Tab Support
87
+ ## Experimental: Enable Cross Tab Support
88
88
 
89
89
  By default, `@openfin/core-web` disables the sharing of connections across browser Tabs. However, this feature may be enabled by specifying the following flag in an IFrame Broker:
90
90
 
91
- ### Example: Enabling Cross Tab Support
91
+ ### Example: Enable Cross Tab Support
92
92
 
93
93
  ```typescript
94
94
  init({
@@ -99,13 +99,9 @@ init({
99
99
  });
100
100
  ```
101
101
 
102
- ## Creating Layouts
102
+ ## Create Layouts
103
103
 
104
- Layouts in the web are very similar to the desktop OpenFin environment. They consist of a layout configuration
105
- that descibes the rows/columns/view components. The major difference is the `layout` key is not supported, instead
106
- we expose the `layoutSnapshot` key to plug into the multiple-layout architecture. See our
107
- [Multi-Layout guide](https://developers.openfin.co/of-docs/docs/multi-layouts) for more information on how to
108
- set it up.
104
+ Layouts in the web are very similar to the desktop OpenFin environment. They consist of a layout configuration that describes the rows/columns/view components. The major difference is that the `layout` key is not supported. Instead, we expose the `layoutSnapshot` key to plug into the multiple-layout architecture. See the [Multi-Layout guide](https://developers.openfin.co/of-docs/docs/multi-layouts) for more information on how to set it up.
109
105
 
110
106
  Note that you can achieve a single layout by having only 1 key in your `layoutSnapshot`:
111
107
 
@@ -117,8 +113,7 @@ const layoutSnapshot = {
117
113
  }
118
114
  ```
119
115
 
120
- The underlying layout options JSON structure is interchangeable between Desktop and Web, however Web Layout Snapshots have an optional `web` property
121
- within the view `componentState` options that will be ignored on desktop, but the rest is the same.
116
+ The JSON structure of the underlying layout options is interchangeable, though not identical, between Desktop and Web. Web Layout Snapshots have an optional `web` property within the view `componentState` options which stores web specific properties. This `web` property is ignored on desktop.
122
117
 
123
118
  ### Example: Retrieve a layoutSnapshot from both desktop and web environments
124
119
 
@@ -130,10 +125,9 @@ const layoutManager = fin.Platform.Layout.getCurrentLayoutManagerSync();
130
125
  const layoutSnapshot = await layoutManager.getLayoutSnapshot();
131
126
  ```
132
127
 
133
- Note that the `fin.Platform.Layout` API is exactly the same in web, so you can retrieve
134
- the Web Layout Snapshot using the same code.
128
+ Note that the `fin.Platform.Layout` API is exactly the same in web, so you can retrieve the Web Layout Snapshot using the same code.
135
129
 
136
- ### Example: Creating a layoutSnapshot with 2 layouts and initializing it via connect call
130
+ ### Example: Create a layoutSnapshot with 2 layouts and initialize it via connect call
137
131
 
138
132
  In order to use layouts, specify the `platform` option to the `connect` call and pass in the `layoutSnapshot`.
139
133
 
@@ -142,7 +136,7 @@ import { connect, type WebLayoutSnapshot } from '@openfin/web-interop';
142
136
 
143
137
  const brokerUrl = 'http://example.com/web-broker';
144
138
 
145
- // presumably retrieved from fin.Platform.Layout.getCurrentLayoutManagerSync().getLayoutSnapshot()
139
+ // Presumably retrieved from fin.Platform.Layout.getCurrentLayoutManagerSync().getLayoutSnapshot()
146
140
  // in a v34+ Desktop environment, but also can be manually constructed like this:
147
141
  const layoutSnapshot: WebLayoutSnapshot = {
148
142
  layouts: {
@@ -192,10 +186,10 @@ const layoutSnapshot: WebLayoutSnapshot = {
192
186
  };
193
187
 
194
188
  (async () => {
195
- // Connect to the OpenFin Web Broker. Pass in the `platform` key with a layoutSnapshot
189
+ // Connect to the OpenFin Web Broker. Pass in the `platform` key with a layoutSnapshot.
196
190
  const fin = await connect({ options: { brokerUrl, platform: { layoutSnapshot } } });
197
191
 
198
- // You may now use the `fin` object. In this case, we want to initialize and create layouts
192
+ // You may now use the `fin` object. In this case, we want to initialize and create layouts.
199
193
  await fin.Platform.Layout.init();
200
194
 
201
195
  // Then from the context of our Layout UI component, we create the layout (see https://developers.openfin.co/of-docs/docs/multi-layouts):
@@ -209,11 +203,11 @@ Note that cross-tab support is experimental, browser-dependent and respects each
209
203
 
210
204
  (Please note, these links work in your IDE and not on npmjs.com, we will update this soon.)
211
205
 
212
- - [@openfin/core-web](../out/docs/@openfin/core-web/README.md)
213
- - [@openfin/core-web/iframe-broker](../out/docs/@openfin/core-web/iframe-broker/README.md)
214
- - [@openfin/core-web/shared-worker](../out/docs/@openfin/core-web/shared-worker/README.md)
206
+ - [@openfin/core-web](../out/docs/@openfin/core-web/README.md)
207
+ - [@openfin/core-web/iframe-broker](../out/docs/@openfin/core-web/iframe-broker/README.md)
208
+ - [@openfin/core-web/shared-worker](../out/docs/@openfin/core-web/shared-worker/README.md)
215
209
 
216
210
  ## See Also
217
211
 
218
- - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
219
- - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
212
+ - [OpenFin Container Developer guide](https://developers.openfin.co/of-docs/docs/container-overview)
213
+ - [Fin API reference](https://developer.openfin.co/docs/javascript/stable)
package/out/api-client.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("./main-b9fafc4d.js");require("buffer"),require("uuid"),require("events"),require("lodash"),exports.connect=e.connect;
1
+ "use strict";var e=require("./main-fd66bc39.js");require("buffer"),require("uuid"),require("events"),require("lodash"),exports.connect=e.connect;
@@ -6,13 +6,13 @@
6
6
 
7
7
  # Type alias: ConnectionOptions
8
8
 
9
- > **ConnectionOptions**: `Object`
9
+ > **ConnectionOptions**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
13
13
  ### experimental?
14
14
 
15
- > **`optional`** **experimental**: `Object`
15
+ > **`optional`** **experimental**: `object`
16
16
 
17
17
  ### experimental.crossTab?
18
18
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: BaseConnectionOptions
8
8
 
9
- > **BaseConnectionOptions**: `Object`
9
+ > **BaseConnectionOptions**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: InheritModeConnectConfig
8
8
 
9
- > **InheritModeConnectConfig**: `Object`
9
+ > **InheritModeConnectConfig**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: StandAloneConnectonConfig
8
8
 
9
- > **StandAloneConnectonConfig**: `Object`
9
+ > **StandAloneConnectonConfig**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebCreateLayoutOptions
8
8
 
9
- > **WebCreateLayoutOptions**: `Omit`\<`OpenFin.CreateLayoutOptions`, `"layout"`\> & `Object`
9
+ > **WebCreateLayoutOptions**: `Omit`\<`OpenFin.CreateLayoutOptions`, `"layout"`\> & `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutComponent
8
8
 
9
- > **WebLayoutComponent**: `OpenFin.LayoutComponent` & `Object`
9
+ > **WebLayoutComponent**: `OpenFin.LayoutComponent` & `object`
10
10
 
11
11
  Web-only component supplied to IframeViewComponent as it's config
12
12
 
@@ -14,7 +14,7 @@ Web-only component supplied to IframeViewComponent as it's config
14
14
 
15
15
  ### componentState?
16
16
 
17
- > **`optional`** **componentState**: `OpenFin.LayoutComponent`\[`"componentState"`\] & `Object`
17
+ > **`optional`** **componentState**: `OpenFin.LayoutComponent`\[`"componentState"`\] & `object`
18
18
 
19
19
  #### Type declaration
20
20
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutInitOptions
8
8
 
9
- > **WebLayoutInitOptions**: `Omit`\<`OpenFin.InitLayoutOptions`, `"layoutManagerOverride"`\> & `Object`
9
+ > **WebLayoutInitOptions**: `Omit`\<`OpenFin.InitLayoutOptions`, `"layoutManagerOverride"`\> & `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutOptions
8
8
 
9
- > **WebLayoutOptions**: `Omit`\<`OpenFin.LayoutOptions`, `"content"`\> & `Object`
9
+ > **WebLayoutOptions**: `Omit`\<`OpenFin.LayoutOptions`, `"content"`\> & `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutPlatformOptions
8
8
 
9
- > **WebLayoutPlatformOptions**: `Object`
9
+ > **WebLayoutPlatformOptions**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type alias: WebLayoutSnapshot
8
8
 
9
- > **WebLayoutSnapshot**: `Object`
9
+ > **WebLayoutSnapshot**: `object`
10
10
 
11
11
  ## Type declaration
12
12
 
@@ -1 +1 @@
1
- "use strict";var t=require("./main-b9fafc4d.js"),e=require("uuid"),o=require("golden-layout");require("buffer"),require("events"),require("lodash");var i={},r={};Object.defineProperty(r,"__esModule",{value:!0}),r.mapValuesAsync=r.mapEntriesAsync=void 0;const a=(t,[e,o])=>({...t,[e]:o});async function n(t,e){return(await Promise.all(e.map((async([e,o])=>[e,await t(o,e)])))).reduce(a,{})}r.mapEntriesAsync=n,r.mapValuesAsync=async function(t,e){let o;return o=e instanceof Map?[...e.entries()]:Object.entries(e),n(t,o)};var s,c,u,l,d=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldSet||function(t,e,o,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(t,o):r?r.value=o:e.set(t,o),o},h=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldGet||function(t,e,o,i){if("a"===o&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?i:"a"===o?i.call(t):i?i.value:e.get(t)};Object.defineProperty(i,"__esModule",{value:!0});var m=i.DefaultLayoutManager=void 0;const y=r;class f{constructor(t){c.set(this,void 0),u.set(this,new Map),d(this,c,t,"f")}size(){return h(this,u,"f").size}async applyLayoutSnapshot({layouts:t}){if(Object.keys(t).length>1)throw new Error("[LayoutManager] Tried to call applyLayoutSnapshot with more than 1 layout. When implementing multiple layouts via overridden LayoutManager class, you must override and fully implement the applyLayoutSnapshot method without calling super.applyLayoutSnapshot().");const[[e,o]]=Object.entries(t);await f.createLayout(this,{layoutName:e,layout:o})}async showLayout({layoutName:t}){}async getLayoutSnapshot(){return{layouts:await(0,y.mapValuesAsync)((t=>t.getFrameSnapshot()),h(this,u,"f"))}}async removeLayout({layoutName:t}){}getLayoutIdentityForView(t){const e=[...h(this,u,"f").values()].find((e=>e.getCurrentViews().some((e=>e.name===t.name&&e.uuid===t.uuid))));return e?.identity??void 0}isLayoutVisible({layoutName:t}){return h(f,s,"m",l).call(f,this,t).isVisible()}resolveLayoutIdentity(t){if(t&&"layoutName"in t)return t;const e=[...h(this,u,"f").values()];if(1===e.length)return e[0].identity;const o=e.find((t=>t.isVisible()));return o?.identity??void 0}static async resolveLayout(t,e){const o=t.resolveLayoutIdentity(e);if(void 0===o||!("layoutName"in o))throw new Error("[layout-manager] resolveLayout: Could not resolve the layout identity. Make sure you include 'layoutName' in the identity object.");return h(f,s,"m",l).call(f,t,o.layoutName)}static async handleSharedView(t,e,o){await(0,y.mapValuesAsync)((async t=>{if(t.identity.layoutName!==e.layoutName){const e=t.getCurrentViews().find((t=>t.name===o.name));e&&await t.onViewDetached({viewIdentity:e,target:null}).catch(console.error)}}),h(t,u,"f"))}static async handleLastViewRemoved(t,e){await t.removeLayout(e),await h(t,c,"f").handleLastViewRemoved(t)}static async destroyLayout(t,{layoutName:e}){await h(f,s,"m",l).call(f,t,e).destroy(),h(t,u,"f").delete(e)}static async createLayout(t,e){const{layoutName:o}=e;if(h(t,u,"f").has(o))throw new Error(`Layout name ${o} already exists`);await h(t,c,"f").createLayout(e,t)}static registerLayout(t,e,o){h(t,u,"f").set(e,o)}static getAllLayouts(t){return[...h(t,u,"f").values()]}static setInitialSnapshot(t,e){h(t,c,"f").setInitialSnapshot(e)}static createClosedConstructor(...t){return class extends f{constructor(){super(...t)}}}}m=i.DefaultLayoutManager=f,s=f,c=new WeakMap,u=new WeakMap,l=function(t,e){const o=h(t,u,"f").get(e);if(!o)throw new Error(`[layout-manager] getLayoutByName: Could not locate layout with name '${e}'`);return o};var p={};Object.defineProperty(p,"__esModule",{value:!0});var w=p.BaseLayout=void 0;w=p.BaseLayout=class{};var v={};Object.defineProperty(v,"__esModule",{value:!0});var g=v.DOMEmitter=void 0;g=v.DOMEmitter=class{constructor(t){this.container=t}dispatchLocalEvent(t,e){const o={...e,type:t,tabSelector:`tab-${e.name}`,containerSelector:`container-${e.name}`,topic:"openfin-DOM-event"};this.container.dispatchEvent(new CustomEvent(t,{detail:o}))}};var b={};Object.defineProperty(b,"__esModule",{value:!0});var L=b.isVisible=void 0;L=b.isVisible=t=>(0!==t.offsetWidth||0!==t.offsetHeight)&&"hidden"!==window.getComputedStyle(t).visibility&&t.offsetTop>=0&&t.offsetLeft>=0&&t.offsetTop<=window.innerHeight&&t.offsetLeft<=window.innerWidth;const E={show:"top",popout:!1,maximise:!1,close:!1},_={headerHeight:31},C={hasHeaders:!0},M={reorderEnabled:!1,popoutWholeStack:!1,constrainDragToContainer:!1,constrainDragToHeaders:!1,preventDragout:!1,showMaximiseIcon:!1,showPopoutIcon:!1,showCloseIcon:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,selectionEnabled:!1};function A(t=[],e){for(const o of t)"component"===o.type?Object.keys(e).forEach((t=>o[t]=e[t])):A(o.content,e)}const P=e=>class extends e{connectedCallback(){if(!this.name||!this.uuid)throw new Error("<of-view> Name or uuid attribute missing");if(!this.src)throw new Error("<of-view> missing 'src' attribute.");this.#t||(this.#t=document.createElement("iframe"),this.#t.src=this.src,this.#t.style.height="100%",this.#t.style.width="100%",this.forceFrameName?this.#t.setAttribute("name",this.forceFrameName):this.#t.setAttribute("name",t.encodeOptions({brokerUrl:this.brokerUrl,name:this.name,uuid:this.uuid,providerId:this.providerId,contextGroup:this.contextGroup},"of-frame")),this.#t.setAttribute("id",this.name),this.appendChild(this.#t))}#t;get brokerUrl(){return this.getAttribute("of-broker")}set brokerUrl(t){t&&this.setAttribute("of-broker",t)}get name(){return this.getAttribute("of-name")}set name(t){t&&this.setAttribute("of-name",t)}get forceFrameName(){return this.getAttribute("forceFrameName")}set forceFrameName(t){t&&this.setAttribute("forceFrameName",t)}get uuid(){return this.getAttribute("of-uuid")}set uuid(t){t&&this.setAttribute("of-uuid",t)}get src(){return this.getAttribute("src")}set src(t){t&&this.setAttribute("src",t)}get providerId(){return this.getAttribute("of-provider-id")}set providerId(t){t&&this.setAttribute("of-provider-id",t)}get contextGroup(){return this.getAttribute("of-context-group")}set contextGroup(t){t&&this.setAttribute("of-context-group",t)}static get observedAttributes(){return["name"]}};class N{static create(t){const e=document.createElement("of-view");return Object.entries(t).forEach((([t,o])=>{e.setAttribute(t,o)})),e}}customElements.define("of-view",P(HTMLElement));class S{constructor(t,o,i,{options:{brokerUrl:r,interopConfig:a}}){this.container=t;const{url:n,web:s,name:c=e.v4(),interop:u}=o||{};if(this.container.element.setAttribute("of-name",c),this.container.element.id=`container-${c}`,void 0===n)return void this.handleUrlMissing();const l=this.updateTitleIfNotSet(n),d={"of-broker":r,"of-uuid":i,"of-name":c,src:n};s?.frameName&&(d.forceFrameName=s.frameName);const h=u?.currentContextGroup??a?.currentContextGroup;h&&(d["of-context-group"]=h),a?.providerId&&(d["of-provider-id"]=a?.providerId);const m=N.create(d);m.title=l??`Iframe: ${n}`,this.container.element.appendChild(m)}updateTitleIfNotSet(t){return"view"===this.container.parent.title&&this.container.parent.setTitle(t),this.container.parent.title}handleUrlMissing(){const t=document.createElement("div");t.setAttribute("style","padding: 20px");t.innerText="No URL provided",this.container.element.appendChild(t)}}class F extends w{static overrideConfig(t){return A(t.content,{isClosable:!1}),{dimensions:_,...t,settings:{...C,...t.settings,...M},header:{...E,show:!1!==t.settings?.hasHeaders&&E.show}}}constructor(t,e,i,r){super(),this.identity=t,this.container=e,this.domEmitter=new g(e),this.layout=new o.GoldenLayout(this.container),this.layout.resizeWithContainerAutomatically=!0,this.layout.registerComponent("view",((e,o)=>new S(e,o,t.uuid,r))),this.setupListeners(),this.layout.loadLayout(F.overrideConfig(i))}addView(t){throw new Error("Method not implemented.")}replaceView({viewToReplace:t,newView:e}){throw new Error("Method not implemented.")}replaceLayout(t){throw new Error("Method not implemented.")}closeView(t){throw new Error("Method not implemented.")}applyPreset(t){throw new Error("Method not implemented.")}getCurrentViews(){throw new Error("Method not implemented.")}async getFrameSnapshot(){return function(t){if(t.root){t.root.content&&A(t.root.content,{componentName:"view"});const e=t.root;t.content=[e],delete t.root}return t}(o.LayoutConfig.fromResolved(this.layout.toConfig()))}isVisible(){return L(this.container)}async onViewDetached(){throw new Error("Method not implemented.")}async destroy(){this.layout.destroy()}setupListeners(){this.layout.on("tabCreated",(t=>{const o=t.componentItem.container.element.getAttribute("of-name")??e.v4(),i={name:o,uuid:o};t.element.id=`tab-${o}`,this.domEmitter.dispatchLocalEvent("tab-created",i)})),this.layout.on("itemCreated",(({target:t})=>{const o=t;if(!o.isComponent)return;const i=o.element.querySelector("[of-name]")?.getAttribute("of-name")??e.v4(),r={name:i,uuid:i};this.domEmitter.dispatchLocalEvent("container-created",r)}))}}class V{constructor(t,e){this.identity=t,this.connectionConfig=e}async createLayout(t,e){if(!("container"in t))throw new Error("Container property is not optional in web");const{container:o,layout:i,layoutName:r}=t,a=new F({...this.identity,layoutName:r},o,i,this.connectionConfig);m.registerLayout(e,r,a)}async getLayoutSnapshot(t){return t.getLayoutSnapshot()}async handleLastViewRemoved(t){throw new Error("Method not implemented.")}}var G,k,I,j,x;const T=t=>t;class O{constructor(o){G.add(this),k.set(this,void 0),I.set(this,void 0),j.set(this,void 0),this.init=async({layoutManagerOverride:e})=>{const o=e??T,i=new V(t.__classPrivateFieldGet(this,j,"f"),t.__classPrivateFieldGet(this,k,"f"));t.__classPrivateFieldSet(this,I,new(o(m.createClosedConstructor(i))),"f"),await t.__classPrivateFieldGet(this,I,"f").applyLayoutSnapshot(t.__classPrivateFieldGet(this,k,"f").platform.layoutSnapshot)},this.getCurrentLayoutManagerSync=()=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),t.__classPrivateFieldGet(this,I,"f")),this.create=async e=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),m.createLayout(t.__classPrivateFieldGet(this,I,"f"),e)),this.destroy=async e=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),m.destroyLayout(t.__classPrivateFieldGet(this,I,"f"),e)),t.__classPrivateFieldSet(this,k,o,"f");const i=e.v4();t.__classPrivateFieldSet(this,j,{name:i,uuid:i},"f")}}k=new WeakMap,I=new WeakMap,j=new WeakMap,G=new WeakSet,x=function(){if(!t.__classPrivateFieldGet(this,I,"f"))throw new Error("You must call init before using this API")};exports.createWebLayoutModule=t=>new O(t);
1
+ "use strict";var t=require("./main-fd66bc39.js"),e=require("uuid"),o=require("golden-layout");require("buffer"),require("events"),require("lodash");var i={},r={};Object.defineProperty(r,"__esModule",{value:!0}),r.mapValuesAsync=r.mapEntriesAsync=void 0;const a=(t,[e,o])=>({...t,[e]:o});async function n(t,e){return(await Promise.all(e.map((async([e,o])=>[e,await t(o,e)])))).reduce(a,{})}r.mapEntriesAsync=n,r.mapValuesAsync=async function(t,e){let o;return o=e instanceof Map?[...e.entries()]:Object.entries(e),n(t,o)};var s,c,u,l,d=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldSet||function(t,e,o,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(t,o):r?r.value=o:e.set(t,o),o},h=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldGet||function(t,e,o,i){if("a"===o&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?i:"a"===o?i.call(t):i?i.value:e.get(t)};Object.defineProperty(i,"__esModule",{value:!0});var m=i.DefaultLayoutManager=void 0;const y=r;class f{constructor(t){c.set(this,void 0),u.set(this,new Map),d(this,c,t,"f")}size(){return h(this,u,"f").size}async applyLayoutSnapshot({layouts:t}){if(Object.keys(t).length>1)throw new Error("[LayoutManager] Tried to call applyLayoutSnapshot with more than 1 layout. When implementing multiple layouts via overridden LayoutManager class, you must override and fully implement the applyLayoutSnapshot method without calling super.applyLayoutSnapshot().");const[[e,o]]=Object.entries(t);await f.createLayout(this,{layoutName:e,layout:o})}async showLayout({layoutName:t}){}async getLayoutSnapshot(){return{layouts:await(0,y.mapValuesAsync)((t=>t.getFrameSnapshot()),h(this,u,"f"))}}async removeLayout({layoutName:t}){}getLayoutIdentityForView(t){const e=[...h(this,u,"f").values()].find((e=>e.getCurrentViews().some((e=>e.name===t.name&&e.uuid===t.uuid))));return e?.identity??void 0}isLayoutVisible({layoutName:t}){return h(f,s,"m",l).call(f,this,t).isVisible()}resolveLayoutIdentity(t){if(t&&"layoutName"in t)return t;const e=[...h(this,u,"f").values()];if(1===e.length)return e[0].identity;const o=e.find((t=>t.isVisible()));return o?.identity??void 0}static async resolveLayout(t,e){const o=t.resolveLayoutIdentity(e);if(void 0===o||!("layoutName"in o))throw new Error("[layout-manager] resolveLayout: Could not resolve the layout identity. Make sure you include 'layoutName' in the identity object.");return h(f,s,"m",l).call(f,t,o.layoutName)}static async handleSharedView(t,e,o){await(0,y.mapValuesAsync)((async t=>{if(t.identity.layoutName!==e.layoutName){const e=t.getCurrentViews().find((t=>t.name===o.name));e&&await t.onViewDetached({viewIdentity:e,target:null}).catch(console.error)}}),h(t,u,"f"))}static async handleLastViewRemoved(t,e){await t.removeLayout(e),await h(t,c,"f").handleLastViewRemoved(t)}static async destroyLayout(t,{layoutName:e}){await h(f,s,"m",l).call(f,t,e).destroy(),h(t,u,"f").delete(e)}static async createLayout(t,e){const{layoutName:o}=e;if(h(t,u,"f").has(o))throw new Error(`Layout name ${o} already exists`);await h(t,c,"f").createLayout(e,t)}static registerLayout(t,e,o){h(t,u,"f").set(e,o)}static getAllLayouts(t){return[...h(t,u,"f").values()]}static setInitialSnapshot(t,e){h(t,c,"f").setInitialSnapshot(e)}static createClosedConstructor(...t){return class extends f{constructor(){super(...t)}}}}m=i.DefaultLayoutManager=f,s=f,c=new WeakMap,u=new WeakMap,l=function(t,e){const o=h(t,u,"f").get(e);if(!o)throw new Error(`[layout-manager] getLayoutByName: Could not locate layout with name '${e}'`);return o};var p={};Object.defineProperty(p,"__esModule",{value:!0});var w=p.BaseLayout=void 0;w=p.BaseLayout=class{};var v={};Object.defineProperty(v,"__esModule",{value:!0});var g=v.DOMEmitter=void 0;g=v.DOMEmitter=class{constructor(t){this.container=t}dispatchLocalEvent(t,e){const o={...e,type:t,tabSelector:`tab-${e.name}`,containerSelector:`container-${e.name}`,topic:"openfin-DOM-event"};this.container.dispatchEvent(new CustomEvent(t,{detail:o}))}};var b={};Object.defineProperty(b,"__esModule",{value:!0});var L=b.isVisible=void 0;L=b.isVisible=t=>(0!==t.offsetWidth||0!==t.offsetHeight)&&"hidden"!==window.getComputedStyle(t).visibility&&t.offsetTop>=0&&t.offsetLeft>=0&&t.offsetTop<=window.innerHeight&&t.offsetLeft<=window.innerWidth;const E={show:"top",popout:!1,maximise:!1,close:!1},_={headerHeight:31},C={hasHeaders:!0},M={reorderEnabled:!1,popoutWholeStack:!1,constrainDragToContainer:!1,constrainDragToHeaders:!1,preventDragout:!1,showMaximiseIcon:!1,showPopoutIcon:!1,showCloseIcon:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,selectionEnabled:!1};function A(t=[],e){for(const o of t)"component"===o.type?Object.keys(e).forEach((t=>o[t]=e[t])):A(o.content,e)}const P=e=>class extends e{connectedCallback(){if(!this.name||!this.uuid)throw new Error("<of-view> Name or uuid attribute missing");if(!this.src)throw new Error("<of-view> missing 'src' attribute.");this.#t||(this.#t=document.createElement("iframe"),this.#t.src=this.src,this.#t.style.height="100%",this.#t.style.width="100%",this.forceFrameName?this.#t.setAttribute("name",this.forceFrameName):this.#t.setAttribute("name",t.encodeOptions({brokerUrl:this.brokerUrl,name:this.name,uuid:this.uuid,providerId:this.providerId,contextGroup:this.contextGroup},"of-frame")),this.#t.setAttribute("id",this.name),this.appendChild(this.#t))}#t;get brokerUrl(){return this.getAttribute("of-broker")}set brokerUrl(t){t&&this.setAttribute("of-broker",t)}get name(){return this.getAttribute("of-name")}set name(t){t&&this.setAttribute("of-name",t)}get forceFrameName(){return this.getAttribute("forceFrameName")}set forceFrameName(t){t&&this.setAttribute("forceFrameName",t)}get uuid(){return this.getAttribute("of-uuid")}set uuid(t){t&&this.setAttribute("of-uuid",t)}get src(){return this.getAttribute("src")}set src(t){t&&this.setAttribute("src",t)}get providerId(){return this.getAttribute("of-provider-id")}set providerId(t){t&&this.setAttribute("of-provider-id",t)}get contextGroup(){return this.getAttribute("of-context-group")}set contextGroup(t){t&&this.setAttribute("of-context-group",t)}static get observedAttributes(){return["name"]}};class N{static create(t){const e=document.createElement("of-view");return Object.entries(t).forEach((([t,o])=>{e.setAttribute(t,o)})),e}}customElements.define("of-view",P(HTMLElement));class S{constructor(t,o,i,{options:{brokerUrl:r,interopConfig:a}}){this.container=t;const{url:n,web:s,name:c=e.v4(),interop:u}=o||{};if(this.container.element.setAttribute("of-name",c),this.container.element.id=`container-${c}`,void 0===n)return void this.handleUrlMissing();const l=this.updateTitleIfNotSet(n),d={"of-broker":r,"of-uuid":i,"of-name":c,src:n};s?.frameName&&(d.forceFrameName=s.frameName);const h=u?.currentContextGroup??a?.currentContextGroup;h&&(d["of-context-group"]=h),a?.providerId&&(d["of-provider-id"]=a?.providerId);const m=N.create(d);m.title=l??`Iframe: ${n}`,this.container.element.appendChild(m)}updateTitleIfNotSet(t){return"view"===this.container.parent.title&&this.container.parent.setTitle(t),this.container.parent.title}handleUrlMissing(){const t=document.createElement("div");t.setAttribute("style","padding: 20px");t.innerText="No URL provided",this.container.element.appendChild(t)}}class F extends w{static overrideConfig(t){return A(t.content,{isClosable:!1}),{dimensions:_,...t,settings:{...C,...t.settings,...M},header:{...E,show:!1!==t.settings?.hasHeaders&&E.show}}}constructor(t,e,i,r){super(),this.identity=t,this.container=e,this.domEmitter=new g(e),this.layout=new o.GoldenLayout(this.container),this.layout.resizeWithContainerAutomatically=!0,this.layout.registerComponent("view",((e,o)=>new S(e,o,t.uuid,r))),this.setupListeners(),this.layout.loadLayout(F.overrideConfig(i))}addView(t){throw new Error("Method not implemented.")}replaceView({viewToReplace:t,newView:e}){throw new Error("Method not implemented.")}replaceLayout(t){throw new Error("Method not implemented.")}closeView(t){throw new Error("Method not implemented.")}applyPreset(t){throw new Error("Method not implemented.")}getCurrentViews(){throw new Error("Method not implemented.")}async getFrameSnapshot(){return function(t){if(t.root){t.root.content&&A(t.root.content,{componentName:"view"});const e=t.root;t.content=[e],delete t.root}return t}(o.LayoutConfig.fromResolved(this.layout.toConfig()))}isVisible(){return L(this.container)}async onViewDetached(){throw new Error("Method not implemented.")}async destroy(){this.layout.destroy()}setupListeners(){this.layout.on("tabCreated",(t=>{const o=t.componentItem.container.element.getAttribute("of-name")??e.v4(),i={name:o,uuid:o};t.element.id=`tab-${o}`,this.domEmitter.dispatchLocalEvent("tab-created",i)})),this.layout.on("itemCreated",(({target:t})=>{const o=t;if(!o.isComponent)return;const i=o.element.querySelector("[of-name]")?.getAttribute("of-name")??e.v4(),r={name:i,uuid:i};this.domEmitter.dispatchLocalEvent("container-created",r)}))}}class V{constructor(t,e){this.identity=t,this.connectionConfig=e}async createLayout(t,e){if(!("container"in t))throw new Error("Container property is not optional in web");const{container:o,layout:i,layoutName:r}=t,a=new F({...this.identity,layoutName:r},o,i,this.connectionConfig);m.registerLayout(e,r,a)}async getLayoutSnapshot(t){return t.getLayoutSnapshot()}async handleLastViewRemoved(t){throw new Error("Method not implemented.")}}var G,k,I,j,x;const T=t=>t;class O{constructor(o){G.add(this),k.set(this,void 0),I.set(this,void 0),j.set(this,void 0),this.init=async({layoutManagerOverride:e})=>{const o=e??T,i=new V(t.__classPrivateFieldGet(this,j,"f"),t.__classPrivateFieldGet(this,k,"f"));t.__classPrivateFieldSet(this,I,new(o(m.createClosedConstructor(i))),"f"),await t.__classPrivateFieldGet(this,I,"f").applyLayoutSnapshot(t.__classPrivateFieldGet(this,k,"f").platform.layoutSnapshot)},this.getCurrentLayoutManagerSync=()=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),t.__classPrivateFieldGet(this,I,"f")),this.create=async e=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),m.createLayout(t.__classPrivateFieldGet(this,I,"f"),e)),this.destroy=async e=>(t.__classPrivateFieldGet(this,G,"m",x).call(this),m.destroyLayout(t.__classPrivateFieldGet(this,I,"f"),e)),t.__classPrivateFieldSet(this,k,o,"f");const i=e.v4();t.__classPrivateFieldSet(this,j,{name:i,uuid:i},"f")}}k=new WeakMap,I=new WeakMap,j=new WeakMap,G=new WeakSet,x=function(){if(!t.__classPrivateFieldGet(this,I,"f"))throw new Error("You must call init before using this API")};exports.createWebLayoutModule=t=>new O(t);