@openfin/core 30.73.28 → 30.74.6
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/package.json +2 -2
- package/src/OpenFin.d.ts +1726 -189
- package/src/OpenFin.js +3 -2
- package/src/api/api-exposer/api-consumer.d.ts +28 -0
- package/src/api/api-exposer/api-consumer.js +28 -0
- package/src/api/api-exposer/api-exposer.d.ts +35 -0
- package/src/api/api-exposer/api-exposer.js +38 -0
- package/src/api/api-exposer/decorators.d.ts +10 -0
- package/src/api/api-exposer/decorators.js +18 -0
- package/src/api/api-exposer/index.d.ts +4 -0
- package/src/api/api-exposer/index.js +20 -0
- package/src/api/api-exposer/strategies/index.d.ts +1 -0
- package/src/api/api-exposer/strategies/index.js +17 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
- package/src/api/application/Factory.d.ts +1 -0
- package/src/api/application/Factory.js +1 -0
- package/src/api/application/Instance.d.ts +2 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/base.d.ts +2 -2
- package/src/api/clipboard/index.d.ts +1 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/base.d.ts +0 -3
- package/src/api/events/platform.d.ts +4 -5
- package/src/api/events/system.d.ts +5 -6
- package/src/api/events/view.d.ts +6 -3
- package/src/api/events/webcontents.d.ts +25 -3
- package/src/api/events/window.d.ts +21 -13
- package/src/api/external-application/Instance.d.ts +1 -1
- package/src/api/fin.d.ts +1 -1
- package/src/api/frame/Instance.d.ts +1 -1
- package/src/api/global-hotkey/index.d.ts +1 -1
- package/src/api/interappbus/channel/channel.d.ts +1 -1
- package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
- package/src/api/interappbus/channel/channels-docs.js +7 -0
- package/src/api/interappbus/channel/client.d.ts +3 -2
- package/src/api/interappbus/channel/client.js +12 -5
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
- package/src/api/interappbus/channel/index.d.ts +1 -1
- package/src/api/interappbus/channel/index.js +6 -8
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
- package/src/api/interappbus/channel/provider.d.ts +1 -1
- package/src/api/interappbus/index.d.ts +1 -1
- package/src/api/interop/Factory.d.ts +1 -2
- package/src/api/interop/Factory.js +20 -4
- package/src/api/interop/InteropBroker.d.ts +15 -47
- package/src/api/interop/InteropBroker.js +38 -46
- package/src/api/interop/InteropClient.d.ts +10 -9
- package/src/api/interop/InteropClient.js +9 -8
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -0
- package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +15 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
- package/src/api/interop/fdc3/fdc3-1.2.js +27 -12
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +13 -12
- package/src/api/interop/fdc3/fdc3-2.0.js +33 -26
- package/src/api/interop/fdc3/fdc3.d.ts +4 -5
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
- package/src/api/interop/fdc3/utils.d.ts +17 -0
- package/src/api/interop/fdc3/utils.js +52 -18
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/me.d.ts +1 -1
- package/src/api/platform/Factory.d.ts +6 -1
- package/src/api/platform/Factory.js +5 -0
- package/src/api/platform/Instance.d.ts +5 -3
- package/src/api/platform/Instance.js +5 -3
- package/src/api/platform/layout/Factory.d.ts +4 -0
- package/src/api/platform/layout/Factory.js +15 -3
- package/src/api/platform/layout/Instance.d.ts +7 -1
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
- package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
- package/src/api/platform/layout/entities/layout-entities.js +216 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +3 -0
- package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +1 -0
- package/src/api/snapshot-source/Factory.js +1 -0
- package/src/api/snapshot-source/Instance.d.ts +1 -1
- package/src/api/system/index.d.ts +1 -471
- package/src/api/system/index.js +6 -476
- package/src/api/view/Instance.d.ts +24 -5
- package/src/api/view/Instance.js +53 -8
- package/src/api/webcontents/main.d.ts +18 -4
- package/src/api/window/Instance.d.ts +26 -1
- package/src/api/window/Instance.js +25 -0
- package/src/browser.js +1 -1
- package/src/mock.js +1 -1
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/transport/fin_store.d.ts +1 -1
- package/src/transport/transport-errors.d.ts +6 -1
- package/src/transport/transport-errors.js +1 -2
- package/src/transport/transport.d.ts +9 -6
- package/src/transport/transport.js +11 -2
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +37 -0
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
|
@@ -21,8 +21,25 @@ export declare enum ResultError {
|
|
|
21
21
|
*/
|
|
22
22
|
IntentHandlerRejected = "IntentHandlerRejected"
|
|
23
23
|
}
|
|
24
|
+
export declare enum ChannelError {
|
|
25
|
+
/** Returned if the specified channel is not found when attempting to join a
|
|
26
|
+
* channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
|
|
27
|
+
*/
|
|
28
|
+
NoChannelFound = "NoChannelFound",
|
|
29
|
+
/** SHOULD be returned when a request to join a user channel or to a retrieve
|
|
30
|
+
* a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
|
|
31
|
+
* of the DesktopAgent (`fdc3`) object is denied.
|
|
32
|
+
*/
|
|
33
|
+
AccessDenied = "AccessDenied",
|
|
34
|
+
/** SHOULD be returned when a channel cannot be created or retrieved via the
|
|
35
|
+
* `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
|
|
36
|
+
*/
|
|
37
|
+
CreationFailed = "CreationFailed"
|
|
38
|
+
}
|
|
24
39
|
export declare const buildPrivateChannelObject: (privateChannelClient: PrivateChannelClient) => PrivateChannel;
|
|
25
40
|
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) => Channel;
|
|
26
41
|
export declare const connectPrivateChannel: (channelId: string) => Promise<PrivateChannel>;
|
|
42
|
+
export declare const isContext: (context: unknown) => context is Context;
|
|
43
|
+
export declare const isChannel: (channel: unknown) => channel is Channel;
|
|
27
44
|
export declare const getIntentResolution: (interopModule: OpenFin.InteropClient, context: Context, app?: AppIdentifier | TargetApp, intent?: string) => Promise<IntentResolution>;
|
|
28
45
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIntentResolution = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
3
|
+
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const PrivateChannelClient_1 = require("./PrivateChannelClient");
|
|
6
6
|
const getUnsupportedChannelApis = (channelType) => {
|
|
@@ -35,6 +35,22 @@ var ResultError;
|
|
|
35
35
|
*/
|
|
36
36
|
ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
|
|
37
37
|
})(ResultError = exports.ResultError || (exports.ResultError = {}));
|
|
38
|
+
var ChannelError;
|
|
39
|
+
(function (ChannelError) {
|
|
40
|
+
/** Returned if the specified channel is not found when attempting to join a
|
|
41
|
+
* channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
|
|
42
|
+
*/
|
|
43
|
+
ChannelError["NoChannelFound"] = "NoChannelFound";
|
|
44
|
+
/** SHOULD be returned when a request to join a user channel or to a retrieve
|
|
45
|
+
* a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
|
|
46
|
+
* of the DesktopAgent (`fdc3`) object is denied.
|
|
47
|
+
*/
|
|
48
|
+
ChannelError["AccessDenied"] = "AccessDenied";
|
|
49
|
+
/** SHOULD be returned when a channel cannot be created or retrieved via the
|
|
50
|
+
* `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
|
|
51
|
+
*/
|
|
52
|
+
ChannelError["CreationFailed"] = "CreationFailed";
|
|
53
|
+
})(ChannelError = exports.ChannelError || (exports.ChannelError = {}));
|
|
38
54
|
const buildPrivateChannelObject = (privateChannelClient) => {
|
|
39
55
|
let clientDisconnected = false;
|
|
40
56
|
const checkIfClientDisconnected = () => {
|
|
@@ -122,6 +138,22 @@ const connectPrivateChannel = async (channelId) => {
|
|
|
122
138
|
}
|
|
123
139
|
};
|
|
124
140
|
exports.connectPrivateChannel = connectPrivateChannel;
|
|
141
|
+
const isContext = (context) => {
|
|
142
|
+
if (context && typeof context === 'object' && 'type' in context) {
|
|
143
|
+
const { type } = context;
|
|
144
|
+
return typeof type === 'string';
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
};
|
|
148
|
+
exports.isContext = isContext;
|
|
149
|
+
const isChannel = (channel) => {
|
|
150
|
+
if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
|
|
151
|
+
const { type, id } = channel;
|
|
152
|
+
return (typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private'));
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
};
|
|
156
|
+
exports.isChannel = isChannel;
|
|
125
157
|
const getIntentResolution = async (interopModule, context, app, intent) => {
|
|
126
158
|
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
127
159
|
// The broker will then setContext on that session context group later with our Intent Result,
|
|
@@ -138,31 +170,33 @@ const getIntentResolution = async (interopModule, context, app, intent) => {
|
|
|
138
170
|
// Set up the getResult call.
|
|
139
171
|
const getResult = async () => {
|
|
140
172
|
let intentResult = await getResultPromise;
|
|
141
|
-
if (!intentResult) {
|
|
173
|
+
if (!intentResult || typeof intentResult !== 'object') {
|
|
142
174
|
throw new Error(ResultError.NoResultReturned);
|
|
143
175
|
}
|
|
144
|
-
|
|
176
|
+
const { error } = intentResult;
|
|
177
|
+
if (error) {
|
|
145
178
|
throw new Error(ResultError.IntentHandlerRejected);
|
|
146
179
|
}
|
|
147
|
-
if (
|
|
180
|
+
if ((0, exports.isChannel)(intentResult)) {
|
|
148
181
|
const { id, type } = intentResult;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
182
|
+
switch (type) {
|
|
183
|
+
case 'private': {
|
|
184
|
+
intentResult = await (0, exports.connectPrivateChannel)(id);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 'app': {
|
|
188
|
+
const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
|
|
189
|
+
intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
default: {
|
|
193
|
+
break;
|
|
163
194
|
}
|
|
164
195
|
}
|
|
165
196
|
}
|
|
197
|
+
else if (!(0, exports.isContext)(intentResult)) {
|
|
198
|
+
throw new Error(ResultError.NoResultReturned);
|
|
199
|
+
}
|
|
166
200
|
return intentResult;
|
|
167
201
|
};
|
|
168
202
|
// Finally fire the intent.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Fdc3Version = '1.2' | '2.0';
|
package/src/api/me.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as OpenFin from '../OpenFin';
|
|
2
|
-
import type Transport from '../transport/transport';
|
|
2
|
+
import type { Transport } from '../transport/transport';
|
|
3
3
|
import type { InteropClient } from './interop';
|
|
4
4
|
export declare const environmentUnsupportedMessage = "You are not running in OpenFin.";
|
|
5
5
|
declare type EntityType = OpenFin.EntityType;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { Base } from '../base';
|
|
3
3
|
import { Channel } from '../interappbus/channel/index';
|
|
4
|
-
import Transport from '../../transport/transport';
|
|
4
|
+
import { Transport } from '../../transport/transport';
|
|
5
5
|
import { LayoutModule } from './layout/index';
|
|
6
6
|
/**
|
|
7
|
+
* @PORTED
|
|
7
8
|
* InitPlatformOptions interface
|
|
8
9
|
* @typedef { object } InitPlatformOptions
|
|
9
10
|
* @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
|
|
10
11
|
*/
|
|
11
12
|
/**
|
|
13
|
+
* @PORTED
|
|
12
14
|
* @typedef { same | different } ProcessAffinityStrategy
|
|
13
15
|
* @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
|
|
14
16
|
* @property { string } same views in the same domain will have the same process affinity.
|
|
15
17
|
* @property { string } different views in the same domain will have different process affinities.
|
|
16
18
|
*/
|
|
17
19
|
/**
|
|
20
|
+
* @PORTED
|
|
18
21
|
* @typedef { object } PlatformOptions
|
|
19
22
|
* @summary The options object required by {@link Platform#start Platform.start}
|
|
20
23
|
* Any {@link ApplicationOptions Application option} is also a valid platform option
|
|
@@ -25,6 +28,7 @@ import { LayoutModule } from './layout/index';
|
|
|
25
28
|
* @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
|
|
26
29
|
*/
|
|
27
30
|
/**
|
|
31
|
+
* @PORTED
|
|
28
32
|
* @typedef { object } DefaultWindowOptions
|
|
29
33
|
* @summary Default window options apply to all platform windows.
|
|
30
34
|
* Any {@link Window~options Window option} is also a valid Default Window option
|
|
@@ -36,6 +40,7 @@ import { LayoutModule } from './layout/index';
|
|
|
36
40
|
* Windows with a specified url (Custom Windows) will not be affected by this option.
|
|
37
41
|
*/
|
|
38
42
|
/**
|
|
43
|
+
* @DELETED
|
|
39
44
|
* Snapshot interface
|
|
40
45
|
* @typedef { object } Snapshot
|
|
41
46
|
* @property { WindowOption[] } windows The array of window options objects
|
|
@@ -5,17 +5,20 @@ const base_1 = require("../base");
|
|
|
5
5
|
const index_1 = require("./layout/index");
|
|
6
6
|
const Instance_1 = require("./Instance");
|
|
7
7
|
/**
|
|
8
|
+
* @PORTED
|
|
8
9
|
* InitPlatformOptions interface
|
|
9
10
|
* @typedef { object } InitPlatformOptions
|
|
10
11
|
* @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
|
|
11
12
|
*/
|
|
12
13
|
/**
|
|
14
|
+
* @PORTED
|
|
13
15
|
* @typedef { same | different } ProcessAffinityStrategy
|
|
14
16
|
* @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
|
|
15
17
|
* @property { string } same views in the same domain will have the same process affinity.
|
|
16
18
|
* @property { string } different views in the same domain will have different process affinities.
|
|
17
19
|
*/
|
|
18
20
|
/**
|
|
21
|
+
* @PORTED
|
|
19
22
|
* @typedef { object } PlatformOptions
|
|
20
23
|
* @summary The options object required by {@link Platform#start Platform.start}
|
|
21
24
|
* Any {@link ApplicationOptions Application option} is also a valid platform option
|
|
@@ -26,6 +29,7 @@ const Instance_1 = require("./Instance");
|
|
|
26
29
|
* @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
|
|
27
30
|
*/
|
|
28
31
|
/**
|
|
32
|
+
* @PORTED
|
|
29
33
|
* @typedef { object } DefaultWindowOptions
|
|
30
34
|
* @summary Default window options apply to all platform windows.
|
|
31
35
|
* Any {@link Window~options Window option} is also a valid Default Window option
|
|
@@ -37,6 +41,7 @@ const Instance_1 = require("./Instance");
|
|
|
37
41
|
* Windows with a specified url (Custom Windows) will not be affected by this option.
|
|
38
42
|
*/
|
|
39
43
|
/**
|
|
44
|
+
* @DELETED
|
|
40
45
|
* Snapshot interface
|
|
41
46
|
* @typedef { object } Snapshot
|
|
42
47
|
* @property { WindowOption[] } windows The array of window options objects
|
|
@@ -27,7 +27,7 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
|
|
|
27
27
|
* @return { Promise<View> }
|
|
28
28
|
* @tutorial Platform.createView
|
|
29
29
|
*/
|
|
30
|
-
createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.
|
|
30
|
+
createView(viewOptions: OpenFin.PlatformViewCreationOptions, target?: OpenFin.CreateViewTarget, targetView?: OpenFin.Identity): Promise<View>;
|
|
31
31
|
/**
|
|
32
32
|
* Creates a new Window.
|
|
33
33
|
* @param { Window~options } options Window creation options
|
|
@@ -66,14 +66,16 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
|
|
|
66
66
|
*/
|
|
67
67
|
getSnapshot(): Promise<OpenFin.Snapshot>;
|
|
68
68
|
/**
|
|
69
|
+
* **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
|
|
70
|
+
*
|
|
69
71
|
* Returns a snapshot of a single view's options in its current state.
|
|
70
72
|
*
|
|
71
73
|
* Can be used to restore a view to a previous state.
|
|
72
74
|
*
|
|
73
|
-
* NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
|
|
74
|
-
*
|
|
75
75
|
* @param { Identity } viewIdentity View identity
|
|
76
76
|
* @returns { Promise<ViewState> }
|
|
77
|
+
* @internal
|
|
78
|
+
* @experimental
|
|
77
79
|
* @tutorial Platform.getViewSnapshot
|
|
78
80
|
*/
|
|
79
81
|
getViewSnapshot(viewIdentity: OpenFin.Identity): Promise<OpenFin.ViewState>;
|
|
@@ -78,7 +78,7 @@ class Platform extends base_1.EmitterBase {
|
|
|
78
78
|
const response = await client.dispatch('create-view', {
|
|
79
79
|
target,
|
|
80
80
|
opts: viewOptions,
|
|
81
|
-
targetView
|
|
81
|
+
targetView,
|
|
82
82
|
});
|
|
83
83
|
if (!response || (0, validate_1.validateIdentity)(response.identity)) {
|
|
84
84
|
throw new Error(`When overwriting the createView call, please return an object that has a valid 'identity' property: ${JSON.stringify(response)}`);
|
|
@@ -175,14 +175,16 @@ class Platform extends base_1.EmitterBase {
|
|
|
175
175
|
return client.dispatch('get-snapshot');
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
+
* **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
|
|
179
|
+
*
|
|
178
180
|
* Returns a snapshot of a single view's options in its current state.
|
|
179
181
|
*
|
|
180
182
|
* Can be used to restore a view to a previous state.
|
|
181
183
|
*
|
|
182
|
-
* NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
|
|
183
|
-
*
|
|
184
184
|
* @param { Identity } viewIdentity View identity
|
|
185
185
|
* @returns { Promise<ViewState> }
|
|
186
|
+
* @internal
|
|
187
|
+
* @experimental
|
|
186
188
|
* @tutorial Platform.getViewSnapshot
|
|
187
189
|
*/
|
|
188
190
|
async getViewSnapshot(viewIdentity) {
|
|
@@ -3,12 +3,14 @@ import { Layout } from './Instance';
|
|
|
3
3
|
import { Base } from '../../base';
|
|
4
4
|
declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
5
5
|
/**
|
|
6
|
+
* @PORTED
|
|
6
7
|
* InitLayoutOptions interface
|
|
7
8
|
* @typedef { object } InitLayoutOptions
|
|
8
9
|
* @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
|
|
9
10
|
* then an element with id `layout-container` is used. We recommend using a div element.
|
|
10
11
|
*/
|
|
11
12
|
/**
|
|
13
|
+
* @PORTED
|
|
12
14
|
* PresetLayoutOptions interface
|
|
13
15
|
* @typedef { object } PresetLayoutOptions
|
|
14
16
|
* @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
|
|
@@ -23,6 +25,7 @@ declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
|
23
25
|
* @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
|
|
24
26
|
*/
|
|
25
27
|
/**
|
|
28
|
+
* @PORTED
|
|
26
29
|
* LayoutItem Interface
|
|
27
30
|
* @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
|
|
28
31
|
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
|
|
@@ -34,6 +37,7 @@ declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
|
34
37
|
* options of a given component.
|
|
35
38
|
*/
|
|
36
39
|
/**
|
|
40
|
+
* @PORTED
|
|
37
41
|
* LayoutSettings Interface
|
|
38
42
|
* @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
|
|
39
43
|
* @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
|
|
@@ -19,13 +19,19 @@ const Instance_1 = require("./Instance");
|
|
|
19
19
|
const base_1 = require("../../base");
|
|
20
20
|
const splitter_controller_1 = require("./controllers/splitter-controller");
|
|
21
21
|
const view_overlay_1 = require("./utils/view-overlay");
|
|
22
|
+
const api_exposer_1 = require("../../api-exposer");
|
|
23
|
+
const layout_entities_controller_1 = require("./controllers/layout-entities-controller");
|
|
24
|
+
const layout_constants_1 = require("./layout.constants");
|
|
25
|
+
const layout_content_cache_1 = require("./controllers/layout-content-cache");
|
|
22
26
|
/**
|
|
27
|
+
* @PORTED
|
|
23
28
|
* InitLayoutOptions interface
|
|
24
29
|
* @typedef { object } InitLayoutOptions
|
|
25
30
|
* @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
|
|
26
31
|
* then an element with id `layout-container` is used. We recommend using a div element.
|
|
27
32
|
*/
|
|
28
33
|
/**
|
|
34
|
+
* @PORTED
|
|
29
35
|
* PresetLayoutOptions interface
|
|
30
36
|
* @typedef { object } PresetLayoutOptions
|
|
31
37
|
* @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
|
|
@@ -40,6 +46,7 @@ const view_overlay_1 = require("./utils/view-overlay");
|
|
|
40
46
|
* @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
|
|
41
47
|
*/
|
|
42
48
|
/**
|
|
49
|
+
* @PORTED
|
|
43
50
|
* LayoutItem Interface
|
|
44
51
|
* @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
|
|
45
52
|
* to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
|
|
@@ -51,6 +58,7 @@ const view_overlay_1 = require("./utils/view-overlay");
|
|
|
51
58
|
* options of a given component.
|
|
52
59
|
*/
|
|
53
60
|
/**
|
|
61
|
+
* @PORTED
|
|
54
62
|
* LayoutSettings Interface
|
|
55
63
|
* @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
|
|
56
64
|
* @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
|
|
@@ -109,9 +117,9 @@ class LayoutModule extends base_1.Base {
|
|
|
109
117
|
const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
|
|
110
118
|
const splitterController = new splitter_controller_1.SplitterController(viewOverlay);
|
|
111
119
|
const tabDragController = new tab_drag_controller_1.TabDragController(viewOverlay);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// @ts-
|
|
120
|
+
const contentItemCache = new layout_content_cache_1.LayoutContentCache();
|
|
121
|
+
__classPrivateFieldSet(this, _LayoutModule_layoutManager, new ManagerConstructor(splitterController, tabDragController, contentItemCache), "f");
|
|
122
|
+
// @ts-expect-error - layout warning here for backwards compatibility, can remove layout check in .52
|
|
115
123
|
let { layout, containerId } = options;
|
|
116
124
|
if (layout) {
|
|
117
125
|
console.warn(`We recommend using a layout in window options.
|
|
@@ -125,6 +133,10 @@ class LayoutModule extends base_1.Base {
|
|
|
125
133
|
// pull createChannelConnection out of LayoutManager and setup channel connections here using layoutmanager instance methods?
|
|
126
134
|
await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").initManager();
|
|
127
135
|
await __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f").createLayout(layout, container);
|
|
136
|
+
const { client, ofWindow } = ManagerConstructor.getClientAndWindow(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"));
|
|
137
|
+
// expose LayoutEntitiesController instance for API consumption
|
|
138
|
+
const channelStrategy = new api_exposer_1.ChannelsExposer(client);
|
|
139
|
+
await new api_exposer_1.ApiExposer(channelStrategy).exposeInstance(new layout_entities_controller_1.LayoutEntitiesController(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"), contentItemCache), { id: layout_constants_1.LAYOUT_CONTROLLER_ID });
|
|
128
140
|
// Adding this to the returned instance undocumented/typed for Browser.
|
|
129
141
|
return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f") });
|
|
130
142
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../OpenFin';
|
|
2
|
-
import Transport from '../../../transport/transport';
|
|
2
|
+
import { Transport } from '../../../transport/transport';
|
|
3
3
|
import { Base } from '../../base';
|
|
4
4
|
declare type Identity = OpenFin.Identity;
|
|
5
5
|
declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
@@ -8,6 +8,7 @@ declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
|
|
|
8
8
|
* @lends Platform#Layout
|
|
9
9
|
*/
|
|
10
10
|
export declare class Layout extends Base {
|
|
11
|
+
#private;
|
|
11
12
|
init: (options?: InitLayoutOptions) => Promise<Layout>;
|
|
12
13
|
identity: Identity;
|
|
13
14
|
private platform;
|
|
@@ -19,6 +20,11 @@ export declare class Layout extends Base {
|
|
|
19
20
|
* @tutorial Layout.getConfig
|
|
20
21
|
*/
|
|
21
22
|
getConfig(): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the top level content item of the layout.
|
|
25
|
+
* @return {Promise<TabStack | ColumnOrRow>}
|
|
26
|
+
*/
|
|
27
|
+
getRootItem(): Promise<OpenFin.ColumnOrRow | OpenFin.TabStack>;
|
|
22
28
|
/**
|
|
23
29
|
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
|
|
24
30
|
* will be destroyed.
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _Layout_layoutClient;
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.Layout = void 0;
|
|
10
|
+
const lazy_1 = require("../../../util/lazy");
|
|
4
11
|
const validate_1 = require("../../../util/validate");
|
|
5
|
-
const common_utils_1 = require("../common-utils");
|
|
6
12
|
const base_1 = require("../../base");
|
|
13
|
+
const common_utils_1 = require("../common-utils");
|
|
14
|
+
const layout_entities_1 = require("./entities/layout-entities");
|
|
15
|
+
const layout_constants_1 = require("./layout.constants");
|
|
7
16
|
/**
|
|
8
17
|
* @lends Platform#Layout
|
|
9
18
|
*/
|
|
@@ -11,6 +20,12 @@ class Layout extends base_1.Base {
|
|
|
11
20
|
// eslint-disable-next-line no-shadow
|
|
12
21
|
constructor(identity, wire) {
|
|
13
22
|
super(wire);
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
* Lazily constructed {@link LayoutEntitiesClient} bound to this platform's client and identity
|
|
26
|
+
* The client is for {@link LayoutEntitiesController}
|
|
27
|
+
*/
|
|
28
|
+
_Layout_layoutClient.set(this, new lazy_1.Lazy(async () => layout_entities_1.LayoutNode.newLayoutEntitiesClient(await this.platform.getClient(), layout_constants_1.LAYOUT_CONTROLLER_ID, this.identity)));
|
|
14
29
|
/**
|
|
15
30
|
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
|
|
16
31
|
* will be destroyed.
|
|
@@ -94,5 +109,15 @@ class Layout extends base_1.Base {
|
|
|
94
109
|
target: this.identity
|
|
95
110
|
});
|
|
96
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves the top level content item of the layout.
|
|
114
|
+
* @return {Promise<TabStack | ColumnOrRow>}
|
|
115
|
+
*/
|
|
116
|
+
async getRootItem() {
|
|
117
|
+
const client = await __classPrivateFieldGet(this, _Layout_layoutClient, "f").getValue();
|
|
118
|
+
const root = await client.getRoot();
|
|
119
|
+
return layout_entities_1.LayoutNode.getEntity(root, client);
|
|
120
|
+
}
|
|
97
121
|
}
|
|
98
122
|
exports.Layout = Layout;
|
|
123
|
+
_Layout_layoutClient = new WeakMap();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class LayoutContentCache {
|
|
2
|
+
private contentItemCache;
|
|
3
|
+
private contentItemCacheId;
|
|
4
|
+
private createCacheKey;
|
|
5
|
+
hasKey: (id: string) => boolean;
|
|
6
|
+
getItemOrUndefined: (id: string) => GoldenLayout.ContentItem | undefined;
|
|
7
|
+
getContentItemOrThrow: (id: string, expectedType?: string[]) => GoldenLayout.ContentItem;
|
|
8
|
+
getOrCreateEntityId: (contentItem: GoldenLayout.ContentItem) => string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LayoutContentCache = void 0;
|
|
4
|
+
const reversible_map_1 = require("../../../../util/reversible-map");
|
|
5
|
+
class LayoutContentCache {
|
|
6
|
+
constructor() {
|
|
7
|
+
// ContentItems currently do not have a unique id, this helps us to lookup items by value
|
|
8
|
+
this.contentItemCache = new reversible_map_1.ReversibleMap();
|
|
9
|
+
this.contentItemCacheId = 0;
|
|
10
|
+
this.createCacheKey = () => {
|
|
11
|
+
const key = `entity-${this.contentItemCacheId.toString()}`;
|
|
12
|
+
this.contentItemCacheId += 1;
|
|
13
|
+
return key;
|
|
14
|
+
};
|
|
15
|
+
this.hasKey = (id) => {
|
|
16
|
+
return this.contentItemCache.hasKey(id);
|
|
17
|
+
};
|
|
18
|
+
this.getItemOrUndefined = (id) => {
|
|
19
|
+
try {
|
|
20
|
+
return this.getContentItemOrThrow(id);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.getContentItemOrThrow = (id, expectedType) => {
|
|
27
|
+
if (!this.contentItemCache.hasKey(id)) {
|
|
28
|
+
throw new Error('Layout component has been destroyed or detached from the current layout.');
|
|
29
|
+
}
|
|
30
|
+
const contentItem = this.contentItemCache.getValue(id);
|
|
31
|
+
if (expectedType && !expectedType.includes(contentItem.type)) {
|
|
32
|
+
throw new Error(`Layout item is not the expected type. Expected ${expectedType.join(', ')}, got ${contentItem.type}.`);
|
|
33
|
+
}
|
|
34
|
+
return contentItem;
|
|
35
|
+
};
|
|
36
|
+
this.getOrCreateEntityId = (contentItem) => {
|
|
37
|
+
if (this.contentItemCache.hasValue(contentItem)) {
|
|
38
|
+
return this.contentItemCache.getKey(contentItem);
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
|
+
const onItemDestroyed = ({ origin, ...rest }) => {
|
|
42
|
+
if (origin === contentItem) {
|
|
43
|
+
this.contentItemCache.deleteValue(contentItem);
|
|
44
|
+
contentItem.unbind('itemDestroyed', onItemDestroyed);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
contentItem.on('itemDestroyed', onItemDestroyed);
|
|
48
|
+
const key = this.createCacheKey();
|
|
49
|
+
this.contentItemCache.setUnique(key, contentItem);
|
|
50
|
+
return key;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.LayoutContentCache = LayoutContentCache;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
+
import type { LayoutContentCache } from './layout-content-cache';
|
|
3
|
+
declare type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOptions;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Controller for the layout entities apis, allowing alterations to be applied
|
|
7
|
+
* to an instance of layout manager in a structured manner.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LayoutEntitiesController {
|
|
10
|
+
private layoutManager;
|
|
11
|
+
private layoutContentCache;
|
|
12
|
+
constructor(layoutManager: any, layoutContentCache: LayoutContentCache);
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
* @returns the root contentItem of the layout.
|
|
16
|
+
*/
|
|
17
|
+
getRoot: () => OpenFin.LayoutEntityDefinition;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* Retrieves the containing stack of a given view identity.
|
|
21
|
+
* @param view Identity of the view to retrieve the stack of.
|
|
22
|
+
* @returns Stack containing the given view.
|
|
23
|
+
* @throws If the view does not belong to a stack within the layout manager.
|
|
24
|
+
*/
|
|
25
|
+
getStackByView: (view: OpenFin.Identity) => Promise<OpenFin.LayoutEntityDefinition | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* Returns all views belonging to a given stack
|
|
29
|
+
*
|
|
30
|
+
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
31
|
+
* when the amount of new views to add overflows the width of the container. This results
|
|
32
|
+
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
33
|
+
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
34
|
+
* with indexes that will not match up to the render-order of the tabs.
|
|
35
|
+
*
|
|
36
|
+
* @param id - Entity id of the stack.
|
|
37
|
+
* @returns A list of view identities in order of appearance.
|
|
38
|
+
* @throws if the content item associated with the entity id does not exist or is not a stack.
|
|
39
|
+
*/
|
|
40
|
+
getStackViews: (id: string) => OpenFin.Identity[];
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* Retrieves the content of a column or row and adds each to the
|
|
44
|
+
* entity cache to allow them to be addressed externally.
|
|
45
|
+
* @param id Entity id of the Column Or Row to retrieve the content of.
|
|
46
|
+
* @returns Array of layout entity definitions
|
|
47
|
+
* @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.
|
|
48
|
+
*/
|
|
49
|
+
getContent(id: string): OpenFin.LayoutEntityDefinition[];
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
* Retrieves the parent content item of the given entity, and adds it to the entity cache
|
|
53
|
+
* so it can be addressed externally.
|
|
54
|
+
* @param id Entity id associated with a layout content item.
|
|
55
|
+
* @returns An entity definition for the given entity's parent, or undefined if the entity is the top level
|
|
56
|
+
* content item or has been removed from the layout entirely.
|
|
57
|
+
*/
|
|
58
|
+
getParent(id: string): OpenFin.LayoutEntityDefinition | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
* @param id Entity id associated with a layout content item.
|
|
62
|
+
* @returns true if the given entity is the root content item, false otherwise.
|
|
63
|
+
*/
|
|
64
|
+
isRoot: (id: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
* Checks whether the given entity exists.
|
|
68
|
+
* @param entityId Id of a content item within the layout
|
|
69
|
+
* @returns True if the content item exists and belongs to the layout.
|
|
70
|
+
*/
|
|
71
|
+
exists: (entityId: string) => boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
* Adds an existing view to the stack, or creates and adds a view to the given stack.
|
|
75
|
+
*
|
|
76
|
+
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
77
|
+
* when the amount of new views to add overflows the width of the container. This results
|
|
78
|
+
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
79
|
+
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
80
|
+
* with indexes that will not match up to the render-order of the tabs.
|
|
81
|
+
*
|
|
82
|
+
* @param stackEntityId Entity id of the stack content item within the layout.
|
|
83
|
+
* @param viewCreationOrReference View identity or creation options
|
|
84
|
+
* @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)
|
|
85
|
+
* @returns Promise resolving with the identity of the newly added view.
|
|
86
|
+
* @throws If the view does not exist, fails to create, or the stack does not exist.
|
|
87
|
+
*/
|
|
88
|
+
addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, { index }?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
|
|
89
|
+
private findViewInStack;
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
* Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
|
|
93
|
+
* option closeOnLastViewRemoved is set to false.
|
|
94
|
+
*
|
|
95
|
+
* @param stackEntityId Entity id of a stack content item to remove the view from.
|
|
96
|
+
* @param view Identity of the view to remove.
|
|
97
|
+
* @throws If the stack does not exist or the view does not exist or belong to the stack.
|
|
98
|
+
*/
|
|
99
|
+
removeViewFromStack: (stackEntityId: string, view: OpenFin.Identity) => Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
* Creates a new adjacent 'stack' and adds the views to it at the specified position
|
|
103
|
+
* @param targetId Entity id of the content item to add a stack adjacent to it
|
|
104
|
+
* @param views List of identities or view creation options of the views to include in the stack
|
|
105
|
+
* @param options Creation options, defaults to position: 'right'
|
|
106
|
+
* @returns the Entity Id of the new stack
|
|
107
|
+
*/
|
|
108
|
+
createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], options: {
|
|
109
|
+
position?: OpenFin.LayoutPosition;
|
|
110
|
+
}) => Promise<string>;
|
|
111
|
+
getAdjacentStacks: ({ targetId, edge }: {
|
|
112
|
+
targetId: string;
|
|
113
|
+
edge: OpenFin.LayoutPosition;
|
|
114
|
+
}) => Promise<Pick<OpenFin.LayoutEntityDefinition, 'entityId'>[]>;
|
|
115
|
+
setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
export {};
|