@openfin/core-web 0.38.29
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.
- package/LICENSE.md +4 -0
- package/README.md +40 -0
- package/docs/platform-developer-guide.md +115 -0
- package/docs/web-application-developer-guide.md +125 -0
- package/out/api-client.d.ts +122 -0
- package/out/api-client.js +1 -0
- package/out/docs/@openfin/core-web/README.md +48 -0
- package/out/docs/@openfin/core-web/functions/connect.md +46 -0
- package/out/docs/@openfin/core-web/iframe-broker/README.md +35 -0
- package/out/docs/@openfin/core-web/iframe-broker/functions/init.md +17 -0
- package/out/docs/@openfin/core-web/iframe-broker/functions/rejectConnections.md +19 -0
- package/out/docs/@openfin/core-web/iframe-broker/type-aliases/ConnectionOptions.md +23 -0
- package/out/docs/@openfin/core-web/shared-worker/README.md +16 -0
- package/out/docs/@openfin/core-web/shared-worker/variables/default.md +9 -0
- package/out/docs/@openfin/core-web/type-aliases/BaseConnectionOptions.md +29 -0
- package/out/docs/@openfin/core-web/type-aliases/ConnectionConfig.md +9 -0
- package/out/docs/@openfin/core-web/type-aliases/InheritModeConnectConfig.md +42 -0
- package/out/docs/@openfin/core-web/type-aliases/StandAloneConnectonConfig.md +31 -0
- package/out/docs/@openfin/core-web/type-aliases/WebCreateLayoutOptions.md +15 -0
- package/out/docs/@openfin/core-web/type-aliases/WebLayoutComponent.md +23 -0
- package/out/docs/@openfin/core-web/type-aliases/WebLayoutInitOptions.md +15 -0
- package/out/docs/@openfin/core-web/type-aliases/WebLayoutOptions.md +15 -0
- package/out/docs/@openfin/core-web/type-aliases/WebLayoutPlatformOptions.md +15 -0
- package/out/docs/@openfin/core-web/type-aliases/WebLayoutSnapshot.md +15 -0
- package/out/docs/README.md +11 -0
- package/out/iframe-broker.d.ts +14 -0
- package/out/iframe-broker.js +1 -0
- package/out/main-95b39f26.js +1 -0
- package/out/main-ca728fd0.js +1 -0
- package/out/shared-worker.js +1 -0
- package/out/styles.css +737 -0
- package/package.json +58 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / InheritModeConnectConfig
|
6
|
+
|
7
|
+
# Type alias: InheritModeConnectConfig
|
8
|
+
|
9
|
+
> **InheritModeConnectConfig**: `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### connectionInheritance
|
14
|
+
|
15
|
+
> **connectionInheritance**: `"enabled"`
|
16
|
+
|
17
|
+
If 'enabled', connection option inheritance is enabled if the current browsing context is
|
18
|
+
a nested browsing context within an `<of-view>` element. This means that the brokerUrl and Identity
|
19
|
+
of the connection will be determined by the parent browsing context. Specifying a value is mandatory.
|
20
|
+
|
21
|
+
### options?
|
22
|
+
|
23
|
+
> **`optional`** **options**: [`BaseConnectionOptions`](BaseConnectionOptions.md)
|
24
|
+
|
25
|
+
Options used to connect to an OpenFin Web Broker. Please note, these will be overriden if connection inheritance
|
26
|
+
is enabled and supported for the current browsing context.
|
27
|
+
|
28
|
+
### validateOptions()?
|
29
|
+
|
30
|
+
> **`optional`** **validateOptions**: (`inheritedOptions`) => `boolean` \| `Promise`\<`boolean`\>
|
31
|
+
|
32
|
+
Validates the inherited connection options from the parent browsing context, if available.
|
33
|
+
|
34
|
+
#### Parameters
|
35
|
+
|
36
|
+
• **inheritedOptions**: `Omit`\<[`BaseConnectionOptions`](BaseConnectionOptions.md), `"timeout"`\>
|
37
|
+
|
38
|
+
Inherited options
|
39
|
+
|
40
|
+
#### Returns
|
41
|
+
|
42
|
+
`boolean` \| `Promise`\<`boolean`\>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / StandAloneConnectonConfig
|
6
|
+
|
7
|
+
# Type alias: StandAloneConnectonConfig
|
8
|
+
|
9
|
+
> **StandAloneConnectonConfig**: `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### connectionInheritance?
|
14
|
+
|
15
|
+
> **`optional`** **connectionInheritance**: `"disabled"`
|
16
|
+
|
17
|
+
If 'enabled', connection option inheritance is enabled if the current browsing context is
|
18
|
+
a nested browsing context within an `<of-view>` element. This means that the brokerUrl and Identity
|
19
|
+
of the connection will be determined by the parent browsing context. Specifying a value is mandatory.
|
20
|
+
|
21
|
+
### options
|
22
|
+
|
23
|
+
> **options**: [`BaseConnectionOptions`](BaseConnectionOptions.md)
|
24
|
+
|
25
|
+
Options used to connect to an OpenFin Web Broker. Mandatory if StandAloneConnectonConfig.connectionInheritance is false.
|
26
|
+
|
27
|
+
### platform?
|
28
|
+
|
29
|
+
> **`optional`** **platform**: [`WebLayoutPlatformOptions`](WebLayoutPlatformOptions.md)
|
30
|
+
|
31
|
+
Options used to initialize web-layouts related features.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebCreateLayoutOptions
|
6
|
+
|
7
|
+
# Type alias: WebCreateLayoutOptions
|
8
|
+
|
9
|
+
> **WebCreateLayoutOptions**: `Omit`\<`OpenFin.CreateLayoutOptions`, `"layout"`\> & `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### layout
|
14
|
+
|
15
|
+
> **layout**: [`WebLayoutOptions`](WebLayoutOptions.md)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutComponent
|
6
|
+
|
7
|
+
# Type alias: WebLayoutComponent
|
8
|
+
|
9
|
+
> **WebLayoutComponent**: `OpenFin.LayoutComponent` & `Object`
|
10
|
+
|
11
|
+
Web-only component supplied to IframeViewComponent as it's config
|
12
|
+
|
13
|
+
## Type declaration
|
14
|
+
|
15
|
+
### componentState?
|
16
|
+
|
17
|
+
> **`optional`** **componentState**: `OpenFin.LayoutComponent`\[`"componentState"`\] & `Object`
|
18
|
+
|
19
|
+
#### Type declaration
|
20
|
+
|
21
|
+
##### web?
|
22
|
+
|
23
|
+
> **`optional`** **web**: `WebState`
|
@@ -0,0 +1,15 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutInitOptions
|
6
|
+
|
7
|
+
# Type alias: WebLayoutInitOptions
|
8
|
+
|
9
|
+
> **WebLayoutInitOptions**: `Omit`\<`OpenFin.InitLayoutOptions`, `"layoutManagerOverride"`\> & `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### layoutManagerOverride?
|
14
|
+
|
15
|
+
> **`optional`** **layoutManagerOverride**: `OpenFin.LayoutManagerOverride`\<[`WebLayoutSnapshot`](WebLayoutSnapshot.md)\>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutOptions
|
6
|
+
|
7
|
+
# Type alias: WebLayoutOptions
|
8
|
+
|
9
|
+
> **WebLayoutOptions**: `Omit`\<`OpenFin.LayoutOptions`, `"content"`\> & `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### content?
|
14
|
+
|
15
|
+
> **`optional`** **content**: `WebLayoutContent`
|
@@ -0,0 +1,15 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutPlatformOptions
|
6
|
+
|
7
|
+
# Type alias: WebLayoutPlatformOptions
|
8
|
+
|
9
|
+
> **WebLayoutPlatformOptions**: `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### layoutSnapshot
|
14
|
+
|
15
|
+
> **layoutSnapshot**: [`WebLayoutSnapshot`](WebLayoutSnapshot.md)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
**@openfin/core-web** • [API](../../../README.md)
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
[@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutSnapshot
|
6
|
+
|
7
|
+
# Type alias: WebLayoutSnapshot
|
8
|
+
|
9
|
+
> **WebLayoutSnapshot**: `Object`
|
10
|
+
|
11
|
+
## Type declaration
|
12
|
+
|
13
|
+
### layouts
|
14
|
+
|
15
|
+
> **layouts**: `Record`\<`string`, [`WebLayoutOptions`](WebLayoutOptions.md)\>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
**@openfin/core-web** • API
|
2
|
+
|
3
|
+
***
|
4
|
+
|
5
|
+
# @openfin/core-web
|
6
|
+
|
7
|
+
## Modules
|
8
|
+
|
9
|
+
- [@openfin/core-web](@openfin/core-web/README.md)
|
10
|
+
- [@openfin/core-web/iframe-broker](@openfin/core-web/iframe-broker/README.md)
|
11
|
+
- [@openfin/core-web/shared-worker](@openfin/core-web/shared-worker/README.md)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare type ConnectionOptions = {
|
2
|
+
sharedWorkerUrl: string;
|
3
|
+
experimental?: {
|
4
|
+
crossTab?: 'same-site' | 'none';
|
5
|
+
};
|
6
|
+
};
|
7
|
+
|
8
|
+
export declare const init: (options: ConnectionOptions) => Promise<void>;
|
9
|
+
|
10
|
+
export declare function rejectConnections(options?: {
|
11
|
+
reason: string;
|
12
|
+
}): void;
|
13
|
+
|
14
|
+
export { }
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";const e="web-broker-ports-ready",t="worker-initialize-connection",r="create-fallback-connection",i="request-fallback-connection",o=e=>`ack-${e}`,n=(...e)=>({log:(...t)=>console.log(`[${(new Date).toISOString()}]`,...(e=>e.map((e=>`[${e}]`)))(e),...t),getLogger:(...t)=>n(...e,...t)});class s{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,s.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=s.lockApi.request(this.name,(()=>(s.pending.delete(this),e(),new Promise((e=>{s.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,s.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}s.pending=new Set,s.held=new Set;const a=e=>window.top===e,c=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},d="openfin/web-shared-worker";class h{constructor(e,t,n){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=n,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async e=>{if(c(this.iframeWindow,e)){const t=new MessageChannel;return new Promise(((n,s)=>{t.port1.addEventListener("message",(e=>{e.data.topic===o(r)&&(e.data.success?n(t.port1):s(e.data.reason))})),t.port1.start();const a={topic:i};e.postMessage(a,location.origin,[t.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&c(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(t=>{if(t.origin===location.origin&&t.data.topic===i){const[i]=t.ports,o={topic:r};e.postMessage(o,[i])}}))},this.initialize=async()=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");if((e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!a(r)&&t(r.parent);return!a(e)&&t(e.parent)})(this.iframeWindow)&&c(this.iframeWindow,this.iframeWindow.top))return this.state="partitioned-frame",this.establishWorkerConnectionViaWindow(this.iframeWindow.top);if(a(this.iframeWindow.parent)){let e;return this.state="top-window",e=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,d).port:new Worker(this.workerUrl),this.listenForNestedConnections(e),e}{if(this.state="frame",!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`)}const{port:e}=new SharedWorker(this.workerUrl,d);return e}}}}const l=n("@openfin/core-web/iframe-broker"),w=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function p(t){const r={topic:o(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}exports.init=async r=>{try{const{sharedWorkerUrl:i}=r;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const n=w(),a=new h(i,window,"same-site"!==r.experimental?.crossTab),c=await a.initialize();l.log(`Loading ${i} in ${a.state} mode...`);const d=await(async(r,i,n)=>{const a=new MessageChannel,c=new MessageChannel,d={topic:t,payload:{identity:n}},h=new s((e=>`__OPENFIN__${e.uuid}_${e.name}`)(n));await h.acquired(),await new Promise(((e,r)=>{i.addEventListener("message",(i=>{i.data.topic===o(t)&&(i.data.success?e():r(new Error(i.data.reason)))})),i.start?.(),i.postMessage(d,[c.port2])}));const l={topic:o(e),success:!0,payload:{identity:n}};return r.postMessage(l,"*",[a.port2,c.port1]),a.port1})(window.parent,c,n);d.start(),c.start?.(),l.log(`Port transfer complete in ${a.state} mode. Connection established with identity ${JSON.stringify(n)}. SharedWorker support=${a.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);p({reason:t.message}),console.error(t)}},exports.rejectConnections=p;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var t=require("./main-ca728fd0.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);
|