openfin-adapter
Advanced tools
Comparing version 17.55.19 to 17.55.20
{ | ||
"name": "openfin-adapter", | ||
"version": "17.55.19", | ||
"version": "17.55.20", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "./src/main.js", |
@@ -6,2 +6,3 @@ import { EventEmitter } from 'events'; | ||
import { BaseEventMap } from './events/base'; | ||
import Fin from './fin'; | ||
export interface SubOptions { | ||
@@ -14,2 +15,3 @@ timestamp?: number; | ||
private _topic; | ||
protected get fin(): Fin; | ||
protected get topic(): string; | ||
@@ -16,0 +18,0 @@ protected set topic(t: string); |
@@ -5,2 +5,3 @@ "use strict"; | ||
const promises_1 = require("../util/promises"); | ||
const fin_store_1 = require("../transport/fin_store"); | ||
class Base { | ||
@@ -16,2 +17,5 @@ constructor(wire) { | ||
} | ||
get fin() { | ||
return fin_store_1.getFin(this.wire); | ||
} | ||
get topic() { | ||
@@ -18,0 +22,0 @@ return this._topic || this.constructor.name.replace('_', '').toLowerCase(); |
@@ -18,5 +18,7 @@ "use strict"; | ||
const me_1 = require("./me"); | ||
const fin_store_1 = require("../transport/fin_store"); | ||
class Fin extends events_1.EventEmitter { | ||
constructor(wire) { | ||
super(); | ||
fin_store_1.registerFin(wire, this); | ||
this.wire = wire; | ||
@@ -23,0 +25,0 @@ this.System = new index_1.default(wire); |
@@ -149,3 +149,3 @@ "use strict"; | ||
// @ts-ignore using private variable. | ||
const app = await fin.Application._create({ ...platformOptions, isPlatformController: true }); | ||
const app = await this.fin.Application._create({ ...platformOptions, isPlatformController: true }); | ||
app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid }))); | ||
@@ -182,3 +182,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
// @ts-ignore using private variable. | ||
const app = await fin.Application._createFromManifest(manifestUrl); | ||
const app = await this.fin.Application._createFromManifest(manifestUrl); | ||
app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid }))); | ||
@@ -185,0 +185,0 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore |
@@ -8,8 +8,2 @@ import { View, ViewCreationOptions } from '../view'; | ||
import { ApplySnapshotOptions, Snapshot, PlatformWindowCreationOptions } from '../../shapes/Platform'; | ||
/** Manages the life cycle of windows and views in the application. | ||
* | ||
* Enables taking snapshots of itself and applying them to restore a previous configuration | ||
* as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>. | ||
* @namespace | ||
*/ | ||
export declare class Platform extends EmitterBase<PlatformEvents> { | ||
@@ -16,0 +10,0 @@ #private; |
@@ -16,9 +16,4 @@ "use strict"; | ||
const clientMap = new Map(); | ||
/** Manages the life cycle of windows and views in the application. | ||
* | ||
* Enables taking snapshots of itself and applying them to restore a previous configuration | ||
* as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>. | ||
* @namespace | ||
*/ | ||
class Platform extends base_1.EmitterBase { | ||
// eslint-disable-next-line no-shadow | ||
constructor(identity, channel) { | ||
@@ -67,4 +62,4 @@ // we piggyback off of application event emitter because from the core's perspective platform is just an app. | ||
this.topic = 'application'; | ||
this.Layout = fin.Platform.Layout; | ||
this.Application = fin.Application.wrapSync(this.identity); | ||
this.Layout = this.fin.Platform.Layout; | ||
this.Application = this.fin.Application.wrapSync(this.identity); | ||
} | ||
@@ -93,3 +88,3 @@ /** | ||
} | ||
return fin.View.wrapSync(response.identity); | ||
return this.fin.View.wrapSync(response.identity); | ||
} | ||
@@ -118,3 +113,3 @@ /** | ||
const { identity } = response; | ||
const res = fin.Window.wrapSync(identity); | ||
const res = this.fin.Window.wrapSync(identity); | ||
// we add the identity at the top level for backwards compatibility. | ||
@@ -180,3 +175,3 @@ res.name = identity.name; | ||
}; | ||
const view = await fin.View.wrap(normalizedViewIdentity); | ||
const view = await this.fin.View.wrap(normalizedViewIdentity); | ||
const viewOptions = await view.getOptions(); | ||
@@ -301,7 +296,7 @@ return this.createView(viewOptions, target); | ||
const client = await this.getClient(); | ||
const { entityType } = target ? await fin.System.getEntityInfo(target.uuid, target.name) : fin.me; | ||
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me; | ||
await client.dispatch('set-window-context', { | ||
context, | ||
entityType, | ||
target: target || { uuid: fin.me.uuid, name: fin.me.name } | ||
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name } | ||
}); | ||
@@ -326,5 +321,5 @@ } | ||
const client = await this.getClient(); | ||
const { entityType } = target ? await fin.System.getEntityInfo(target.uuid, target.name) : fin.me; | ||
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me; | ||
return client.dispatch('get-window-context', { | ||
target: target || { uuid: fin.me.uuid, name: fin.me.name }, | ||
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }, | ||
entityType | ||
@@ -331,0 +326,0 @@ }); |
@@ -1,63 +0,6 @@ | ||
import Transport from '../../../transport/transport'; | ||
import { InitLayoutOptions } from './shapes'; | ||
import { Layout } from './Instance'; | ||
/** | ||
* InitLayoutOptions interface | ||
* @typedef { object } InitLayoutOptions | ||
* @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided | ||
* then an element with id `layout-container` is used. We recommend using a div element. | ||
*/ | ||
/** | ||
* PresetLayoutOptions interface | ||
* @typedef { object } PresetLayoutOptions | ||
* @property { LayoutPresetTypes } presetType Which preset layout arrangement to use. | ||
* The preset options are `columns`, `grid`, `rows`, and `tabs`. | ||
*/ | ||
/** | ||
* LayoutConfig interface | ||
* @typedef { object } LayoutConfig | ||
* @property { Array<LayoutItem> } content Content of the layout. There can only be one top-level LayoutItem in the content array. | ||
* We do not recommend trying to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} | ||
* or our {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }. | ||
* @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface. | ||
*/ | ||
/** | ||
* LayoutItem Interface | ||
* @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying | ||
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our | ||
* {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }. | ||
* @property { string } type The type of the item. Possible values are 'row', 'column', 'stack', and 'component'. | ||
* @property { Array<LayoutItem> } [content] An array of configurations for items that will be created as children of this item. | ||
* @property { string } [componentName] Only a `component` type will have this property and it should be set to `view`. | ||
* @property { View~options } [componentState] Only a `component` type will have this property and it represents the view | ||
* options of a given component. | ||
*/ | ||
/** | ||
* LayoutSettings Interface | ||
* @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout | ||
* @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged. | ||
* If true, stack headers are the only areas where tabs can be dropped. | ||
* @property { boolean } [hasHeaders=true] Turns tab headers on or off. | ||
* If false, the layout will be displayed with splitters only. | ||
* @property { boolean } [popoutWholeStack=false] Whether the popout button will only act on the entire stack, | ||
* as opposed to only the active tab. | ||
* @property { boolean } [preventDragIn=false] If true, tabs can't be dragged into the window. | ||
* @property { boolean } [preventDragOut=false] If true, tabs can't be dragged out of the window. | ||
* @property { boolean } [reorderEnabled=true] If true, the user can re-arrange the layout by | ||
* dragging items by their tabs to the desired location. | ||
* @property { boolean } [showCloseIcon=false] Whether to show the close button on stack header | ||
* (not to be confused with close button on every tab). | ||
* @property { boolean } [showMaximiseIcon=false] Whether to show the maximize button on stack header. | ||
* The button will maximize the current tab to fill the entire window. | ||
* @property { boolean } [showPopoutIcon=false] Whether to show the popout button on stack header. | ||
* The button will create a new window with current tab as its content. | ||
* In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window. | ||
*/ | ||
/** | ||
* @lends Platform#Layout | ||
*/ | ||
export declare class LayoutModule { | ||
import { Base } from '../../base'; | ||
export declare class LayoutModule extends Base { | ||
#private; | ||
wire: Transport; | ||
constructor(wire: Transport); | ||
/** | ||
@@ -64,0 +7,0 @@ * Asynchronously returns a Layout object that represents a Window's layout. |
@@ -19,59 +19,6 @@ "use strict"; | ||
const Instance_1 = require("./Instance"); | ||
/** | ||
* InitLayoutOptions interface | ||
* @typedef { object } InitLayoutOptions | ||
* @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided | ||
* then an element with id `layout-container` is used. We recommend using a div element. | ||
*/ | ||
/** | ||
* PresetLayoutOptions interface | ||
* @typedef { object } PresetLayoutOptions | ||
* @property { LayoutPresetTypes } presetType Which preset layout arrangement to use. | ||
* The preset options are `columns`, `grid`, `rows`, and `tabs`. | ||
*/ | ||
/** | ||
* LayoutConfig interface | ||
* @typedef { object } LayoutConfig | ||
* @property { Array<LayoutItem> } content Content of the layout. There can only be one top-level LayoutItem in the content array. | ||
* We do not recommend trying to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} | ||
* or our {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }. | ||
* @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface. | ||
*/ | ||
/** | ||
* LayoutItem Interface | ||
* @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying | ||
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our | ||
* {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }. | ||
* @property { string } type The type of the item. Possible values are 'row', 'column', 'stack', and 'component'. | ||
* @property { Array<LayoutItem> } [content] An array of configurations for items that will be created as children of this item. | ||
* @property { string } [componentName] Only a `component` type will have this property and it should be set to `view`. | ||
* @property { View~options } [componentState] Only a `component` type will have this property and it represents the view | ||
* options of a given component. | ||
*/ | ||
/** | ||
* LayoutSettings Interface | ||
* @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout | ||
* @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged. | ||
* If true, stack headers are the only areas where tabs can be dropped. | ||
* @property { boolean } [hasHeaders=true] Turns tab headers on or off. | ||
* If false, the layout will be displayed with splitters only. | ||
* @property { boolean } [popoutWholeStack=false] Whether the popout button will only act on the entire stack, | ||
* as opposed to only the active tab. | ||
* @property { boolean } [preventDragIn=false] If true, tabs can't be dragged into the window. | ||
* @property { boolean } [preventDragOut=false] If true, tabs can't be dragged out of the window. | ||
* @property { boolean } [reorderEnabled=true] If true, the user can re-arrange the layout by | ||
* dragging items by their tabs to the desired location. | ||
* @property { boolean } [showCloseIcon=false] Whether to show the close button on stack header | ||
* (not to be confused with close button on every tab). | ||
* @property { boolean } [showMaximiseIcon=false] Whether to show the maximize button on stack header. | ||
* The button will maximize the current tab to fill the entire window. | ||
* @property { boolean } [showPopoutIcon=false] Whether to show the popout button on stack header. | ||
* The button will create a new window with current tab as its content. | ||
* In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window. | ||
*/ | ||
/** | ||
* @lends Platform#Layout | ||
*/ | ||
class LayoutModule { | ||
constructor(wire) { | ||
const base_1 = require("../../base"); | ||
class LayoutModule extends base_1.Base { | ||
constructor() { | ||
super(...arguments); | ||
_layoutManager.set(this, void 0); | ||
@@ -96,3 +43,3 @@ /** | ||
} | ||
if (!fin.me.isWindow) { | ||
if (!this.fin.me.isWindow) { | ||
throw new Error('Layout.init can only be called from a Window context.'); | ||
@@ -104,3 +51,3 @@ } | ||
const ManagerConstructor = (await Promise.resolve().then(() => require('../renderer/openfin-layout'))).default; | ||
__classPrivateFieldSet(this, _layoutManager, new ManagerConstructor(fin)); | ||
__classPrivateFieldSet(this, _layoutManager, new ManagerConstructor()); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore | ||
@@ -113,3 +60,3 @@ // @ts-ignore - layout warning here for backwards compatibility, can remove layout check in .52 | ||
} | ||
layout = layout || (await fin.Window.getCurrentSync().getOptions()).layout; | ||
layout = layout || (await this.fin.Window.getCurrentSync().getOptions()).layout; | ||
containerId = containerId || 'layout-container'; | ||
@@ -123,3 +70,2 @@ const container = document.getElementById(containerId); | ||
}; | ||
this.wire = wire; | ||
} | ||
@@ -173,6 +119,6 @@ /** | ||
} | ||
if (!fin.me.isWindow) { | ||
if (!this.fin.me.isWindow) { | ||
throw new Error('You are not in a Window context. Only Windows can have a Layout.'); | ||
} | ||
const { uuid, name } = fin.me; | ||
const { uuid, name } = this.fin.me; | ||
return this.wrap({ uuid, name }); | ||
@@ -193,6 +139,6 @@ } | ||
} | ||
if (!fin.me.isWindow) { | ||
if (!this.fin.me.isWindow) { | ||
throw new Error('You are not in a Window context. Only Windows can have a Layout.'); | ||
} | ||
const { uuid, name } = fin.me; | ||
const { uuid, name } = this.fin.me; | ||
return this.wrapSync({ uuid, name }); | ||
@@ -199,0 +145,0 @@ } |
import { Identity } from '../../../identity'; | ||
import Transport from '../../../transport/transport'; | ||
import { InitLayoutOptions, PresetLayoutOptions } from './shapes'; | ||
/** | ||
* @lends Platform#Layout | ||
*/ | ||
export declare class Layout { | ||
import { Base } from '../../base'; | ||
export declare class Layout extends Base { | ||
init: (options?: InitLayoutOptions) => Promise<Layout>; | ||
@@ -9,0 +7,0 @@ identity: Identity; |
@@ -7,7 +7,7 @@ "use strict"; | ||
const common_utils_1 = require("../common-utils"); | ||
/** | ||
* @lends Platform#Layout | ||
*/ | ||
class Layout { | ||
const base_1 = require("../../base"); | ||
class Layout extends base_1.Base { | ||
// eslint-disable-next-line no-shadow | ||
constructor(identity, wire) { | ||
super(wire); | ||
/** | ||
@@ -64,7 +64,6 @@ * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout | ||
this.identity = identity; | ||
this.platform = fin.Platform.wrapSync({ uuid: identity.uuid }); | ||
if (identity.uuid === fin.me.uuid && identity.name === fin.me.name) { | ||
this.init = fin.Platform.Layout.init; | ||
this.platform = this.fin.Platform.wrapSync({ uuid: identity.uuid }); | ||
if (identity.uuid === this.fin.me.uuid && identity.name === this.fin.me.name) { | ||
this.init = this.fin.Platform.Layout.init; | ||
} | ||
this.wire = wire; | ||
} | ||
@@ -71,0 +70,0 @@ /** |
import { View } from '../../../main'; | ||
import { ViewComponent } from './utils'; | ||
import { FinApi } from '../../fin'; | ||
import EntityType from '../../../shapes/EntityType'; | ||
export default class LayoutManager { | ||
private fin; | ||
private client; | ||
@@ -18,3 +15,3 @@ private container; | ||
private showBackgroundImages; | ||
constructor(fin: FinApi<EntityType.WINDOW>); | ||
constructor(); | ||
initManager: () => Promise<void>; | ||
@@ -21,0 +18,0 @@ createLayout: (layout: GoldenLayout.Config, container: HTMLElement) => void; |
@@ -15,4 +15,3 @@ "use strict"; | ||
class LayoutManager { | ||
constructor(fin) { | ||
this.fin = fin; | ||
constructor() { | ||
this.isDragging = false; | ||
@@ -82,3 +81,3 @@ this.resizing = false; | ||
this.dragProxy = null; | ||
const originWindow = this.fin.Window.wrapSync({ | ||
const originWindow = fin.Window.wrapSync({ | ||
uuid: this.ofWindow.identity.uuid, | ||
@@ -215,3 +214,2 @@ name: sourceIdentity.name | ||
this.registerViewComponent = () => { | ||
const { fin } = this; | ||
// WARNING: Do not try to use arrow function here, it breaks somewhere in golden-layout | ||
@@ -283,3 +281,3 @@ this.layout.registerComponent('view', function registerComponentCallback(container, componentState) { | ||
const viewIdentity = { uuid: this.ofWindow.identity.uuid, name: viewName }; | ||
const ofView = this.fin.View.wrapSync(viewIdentity); | ||
const ofView = fin.View.wrapSync(viewIdentity); | ||
const boundingRect = entry.target.getBoundingClientRect(); | ||
@@ -499,3 +497,3 @@ utils_1.setViewBoundsByRect(boundingRect, ofView); | ||
// TODO: provide hook for user customization of default context | ||
options.customContext = await this.fin.Platform.getCurrentSync().getWindowContext(); | ||
options.customContext = await fin.Platform.getCurrentSync().getWindowContext(); | ||
this.removeView(viewState); | ||
@@ -638,3 +636,3 @@ ofView.once('target-changed', (evt) => { | ||
}; | ||
this.fin.Platform.Layout.getCurrentSync().replace(newLayout); | ||
fin.Platform.Layout.getCurrentSync().replace(newLayout); | ||
}); | ||
@@ -655,3 +653,3 @@ }; | ||
const identity = { uuid, name }; | ||
return this.fin.View.wrapSync(identity); | ||
return fin.View.wrapSync(identity); | ||
}; | ||
@@ -717,3 +715,3 @@ this.hideAllViews = () => { | ||
container.setState(viewComponent.componentState); | ||
return new resizable_view_1.ResizableView(this.fin, viewComponent, this.viewsResizeObserver); | ||
return new resizable_view_1.ResizableView(viewComponent, this.viewsResizeObserver); | ||
} | ||
@@ -723,3 +721,3 @@ catch (e) { | ||
} | ||
return new resizable_view_1.ResizableView(this.fin, vc, this.viewsResizeObserver); | ||
return new resizable_view_1.ResizableView(vc, this.viewsResizeObserver); | ||
}; | ||
@@ -801,6 +799,6 @@ this.attachView = async (rView, bv) => { | ||
}; | ||
this.ofWindow = this.fin.Window.getCurrentSync(); | ||
this.platform = this.fin.Platform.getCurrentSync(); | ||
this.ofWindow = fin.Window.getCurrentSync(); | ||
this.platform = fin.Platform.getCurrentSync(); | ||
} | ||
} | ||
exports.default = LayoutManager; |
@@ -304,3 +304,3 @@ "use strict"; | ||
// check the original manifest for a snapshot and launch it | ||
return platformProvider.launchIntoPlatform(manifest); | ||
return platformProvider.launchIntoPlatform({ manifest }); | ||
} | ||
@@ -307,0 +307,0 @@ throw new Error('Failed to launch into platform from run-requested call. Requires an `appManifestUrl` query parameter or a snapshot in the manifest.'); |
import { View } from '../../../main'; | ||
import { ViewCreationOptions } from '../../view'; | ||
import { ViewComponent } from './utils'; | ||
import { FinApi } from '../../fin'; | ||
import EntityType from '../../../shapes/EntityType'; | ||
export interface ViewState extends ViewCreationOptions { | ||
@@ -10,3 +8,2 @@ url: string; | ||
export declare class ResizableView { | ||
private fin; | ||
private options; | ||
@@ -17,5 +14,5 @@ ofView: View; | ||
private container; | ||
constructor(fin: FinApi<EntityType.WINDOW>, { container, componentState }: ViewComponent, viewObserver: ResizeObserver); | ||
constructor({ container, componentState }: ViewComponent, viewObserver: ResizeObserver); | ||
renderIntoComponent(): Promise<void>; | ||
private createOrAttachView; | ||
} |
@@ -6,8 +6,7 @@ "use strict"; | ||
class ResizableView { | ||
constructor(fin, { container, componentState }, viewObserver) { | ||
this.fin = fin; | ||
this.windowIdentity = this.fin.Window.getCurrentSync().identity; | ||
constructor({ container, componentState }, viewObserver) { | ||
this.windowIdentity = fin.Window.getCurrentSync().identity; | ||
this.container = container; | ||
this.options = { ...componentState, target: this.windowIdentity }; | ||
this.ofView = this.fin.View.wrapSync({ | ||
this.ofView = fin.View.wrapSync({ | ||
uuid: this.windowIdentity.uuid, | ||
@@ -34,3 +33,3 @@ name: this.options.name | ||
async createOrAttachView() { | ||
const app = this.fin.Application.getCurrentSync(); | ||
const app = fin.Application.getCurrentSync(); | ||
const attachView = () => this.ofView.attach(this.windowIdentity); | ||
@@ -37,0 +36,0 @@ const boundAttachView = attachView.bind(this); |
@@ -9,3 +9,2 @@ "use strict"; | ||
const EntityType_1 = require("../../shapes/EntityType"); | ||
const layout_1 = require("../platform/layout"); | ||
/** | ||
@@ -912,3 +911,3 @@ * @typedef { object } Margins | ||
} | ||
return new layout_1.Layout(this.identity, this.wire); | ||
return this.fin.Platform.Layout.wrap(this.identity); | ||
} | ||
@@ -915,0 +914,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential security risk
Supply chain riskAI has determined that this package may contain potential security issues or vulnerabilities.
Found 1 instance in 1 package
272
5
3977610
18015
22