@openfin/core 33.76.31 → 33.76.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/openfin-core-33.76.36.tgz +0 -0
  2. package/package.json +1 -1
  3. package/src/OpenFin.d.ts +27 -16
  4. package/src/api/application/Factory.d.ts +148 -100
  5. package/src/api/application/Factory.js +148 -100
  6. package/src/api/application/Instance.d.ts +477 -106
  7. package/src/api/application/Instance.js +474 -106
  8. package/src/api/application/index.d.ts +9 -0
  9. package/src/api/application/index.js +9 -0
  10. package/src/api/base.d.ts +69 -0
  11. package/src/api/base.js +69 -0
  12. package/src/api/clipboard/index.d.ts +111 -31
  13. package/src/api/clipboard/index.js +111 -31
  14. package/src/api/events/application.d.ts +12 -0
  15. package/src/api/events/application.js +12 -0
  16. package/src/api/events/channel.d.ts +5 -0
  17. package/src/api/events/channel.js +5 -0
  18. package/src/api/events/externalApplication.d.ts +5 -0
  19. package/src/api/events/externalApplication.js +5 -0
  20. package/src/api/events/frame.d.ts +5 -0
  21. package/src/api/events/globalHotkey.d.ts +5 -0
  22. package/src/api/events/platform.d.ts +9 -1
  23. package/src/api/events/platform.js +8 -0
  24. package/src/api/events/system.d.ts +13 -0
  25. package/src/api/events/system.js +13 -0
  26. package/src/api/events/view.d.ts +19 -9
  27. package/src/api/events/view.js +10 -0
  28. package/src/api/events/webcontents.d.ts +21 -10
  29. package/src/api/events/webcontents.js +11 -0
  30. package/src/api/events/window.d.ts +70 -1
  31. package/src/api/events/window.js +10 -0
  32. package/src/api/external-application/Factory.d.ts +16 -9
  33. package/src/api/external-application/Factory.js +16 -9
  34. package/src/api/external-application/Instance.d.ts +40 -32
  35. package/src/api/external-application/Instance.js +40 -32
  36. package/src/api/external-application/index.d.ts +9 -0
  37. package/src/api/external-application/index.js +9 -0
  38. package/src/api/fin.d.ts +3 -0
  39. package/src/api/fin.js +3 -0
  40. package/src/api/frame/Factory.d.ts +30 -13
  41. package/src/api/frame/Factory.js +30 -13
  42. package/src/api/frame/Instance.d.ts +51 -38
  43. package/src/api/frame/Instance.js +51 -38
  44. package/src/api/frame/index.d.ts +11 -0
  45. package/src/api/frame/index.js +11 -0
  46. package/src/api/global-hotkey/index.d.ts +81 -13
  47. package/src/api/global-hotkey/index.js +81 -13
  48. package/src/api/interappbus/channel/channel.d.ts +257 -0
  49. package/src/api/interappbus/channel/channel.js +257 -0
  50. package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
  51. package/src/api/interappbus/channel/channels-docs.js +71 -68
  52. package/src/api/interappbus/channel/client.d.ts +93 -0
  53. package/src/api/interappbus/channel/client.js +93 -1
  54. package/src/api/interappbus/channel/index.d.ts +164 -0
  55. package/src/api/interappbus/channel/index.js +165 -1
  56. package/src/api/interappbus/channel/provider.d.ts +172 -0
  57. package/src/api/interappbus/channel/provider.js +172 -0
  58. package/src/api/interappbus/index.d.ts +55 -20
  59. package/src/api/interappbus/index.js +55 -20
  60. package/src/api/interop/Factory.d.ts +30 -10
  61. package/src/api/interop/Factory.js +30 -10
  62. package/src/api/interop/InteropBroker.d.ts +298 -70
  63. package/src/api/interop/InteropBroker.js +298 -70
  64. package/src/api/interop/InteropClient.d.ts +286 -62
  65. package/src/api/interop/InteropClient.js +286 -62
  66. package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
  67. package/src/api/interop/SessionContextGroupClient.js +2 -2
  68. package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
  69. package/src/api/interop/fdc3/documentationStub.js +17 -0
  70. package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
  71. package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
  72. package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
  73. package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
  74. package/src/api/interop/index.d.ts +8 -0
  75. package/src/api/interop/index.js +8 -0
  76. package/src/api/platform/Factory.d.ts +121 -65
  77. package/src/api/platform/Factory.js +122 -66
  78. package/src/api/platform/Instance.d.ts +551 -48
  79. package/src/api/platform/Instance.js +551 -49
  80. package/src/api/platform/index.d.ts +9 -0
  81. package/src/api/platform/index.js +9 -0
  82. package/src/api/platform/layout/Factory.d.ts +53 -76
  83. package/src/api/platform/layout/Factory.js +53 -76
  84. package/src/api/platform/layout/Instance.d.ts +158 -23
  85. package/src/api/platform/layout/Instance.js +118 -20
  86. package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
  87. package/src/api/platform/layout/entities/layout-entities.js +222 -30
  88. package/src/api/platform/layout/index.d.ts +9 -0
  89. package/src/api/platform/layout/index.js +9 -0
  90. package/src/api/platform/provider.d.ts +398 -51
  91. package/src/api/snapshot-source/Factory.d.ts +33 -18
  92. package/src/api/snapshot-source/Factory.js +33 -18
  93. package/src/api/snapshot-source/Instance.d.ts +30 -8
  94. package/src/api/snapshot-source/Instance.js +30 -8
  95. package/src/api/snapshot-source/index.d.ts +9 -0
  96. package/src/api/snapshot-source/index.js +9 -0
  97. package/src/api/system/index.d.ts +1137 -186
  98. package/src/api/system/index.js +1142 -186
  99. package/src/api/view/Factory.d.ts +54 -16
  100. package/src/api/view/Factory.js +54 -16
  101. package/src/api/view/Instance.d.ts +330 -216
  102. package/src/api/view/Instance.js +331 -217
  103. package/src/api/view/index.d.ts +9 -0
  104. package/src/api/view/index.js +9 -0
  105. package/src/api/webcontents/main.d.ts +890 -0
  106. package/src/api/webcontents/main.js +890 -0
  107. package/src/api/window/Factory.d.ts +67 -16
  108. package/src/api/window/Factory.js +67 -16
  109. package/src/api/window/Instance.d.ts +824 -316
  110. package/src/api/window/Instance.js +822 -320
  111. package/src/api/window/index.d.ts +11 -0
  112. package/src/api/window/index.js +11 -0
  113. package/src/namespaces.d.ts +1 -0
  114. package/src/namespaces.js +3 -1
  115. package/src/shapes/protocol.d.ts +4 -0
  116. package/openfin-core-33.76.31.tgz +0 -0
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Entry point for the OpenFin Platform namespace.
3
+ *
4
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "PlatformModule" is used for
5
+ * the module containing static members of the `Platform` namespace (available under `fin.Platform`), while `Platform` documents
6
+ * instances of the OpenFin `Platform` class.
7
+ *
8
+ * @packageDocumentation
9
+ */
1
10
  import PlatformModule from './Factory';
2
11
  export default PlatformModule;
3
12
  export * from './Instance';
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ /**
3
+ * Entry point for the OpenFin Platform namespace.
4
+ *
5
+ * Because TypeDoc does not currently support multiple modules with the same name, the module alias "PlatformModule" is used for
6
+ * the module containing static members of the `Platform` namespace (available under `fin.Platform`), while `Platform` documents
7
+ * instances of the OpenFin `Platform` class.
8
+ *
9
+ * @packageDocumentation
10
+ */
2
11
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
12
  if (k2 === undefined) k2 = k;
4
13
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -2,99 +2,76 @@ import type * as OpenFin from '../../../OpenFin';
2
2
  import { Base } from '../../base';
3
3
  import { Layout } from './Instance';
4
4
  type InitLayoutOptions = OpenFin.InitLayoutOptions;
5
- /**
6
- * @PORTED
7
- * InitLayoutOptions interface
8
- * @typedef { object } InitLayoutOptions
9
- * @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
10
- * then an element with id `layout-container` is used. We recommend using a div element.
11
- */
12
- /**
13
- * @PORTED
14
- * PresetLayoutOptions interface
15
- * @typedef { object } PresetLayoutOptions
16
- * @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
17
- * The preset options are `columns`, `grid`, `rows`, and `tabs`.
18
- */
19
- /**
20
- * LayoutConfig interface
21
- * @typedef { object } LayoutConfig
22
- * @property { Array<LayoutItem> } content Content of the layout. There can only be one top-level LayoutItem in the content array.
23
- * We do not recommend trying to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot}
24
- * or our {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }.
25
- * @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
26
- */
27
- /**
28
- * @PORTED
29
- * LayoutItem Interface
30
- * @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
31
- * to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
32
- * {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }.
33
- * @property { string } type The type of the item. Possible values are 'row', 'column', 'stack', and 'component'.
34
- * @property { Array<LayoutItem> } [content] An array of configurations for items that will be created as children of this item.
35
- * @property { string } [componentName] Only a `component` type will have this property and it should be set to `view`.
36
- * @property { View~options } [componentState] Only a `component` type will have this property and it represents the view
37
- * options of a given component.
38
- */
39
- /**
40
- * @PORTED
41
- * LayoutSettings Interface
42
- * @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
43
- * @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
44
- * If true, stack headers are the only areas where tabs can be dropped.
45
- * @property { boolean } [hasHeaders=true] Turns tab headers on or off.
46
- * If false, the layout will be displayed with splitters only.
47
- * @property {object} [newTabButton]
48
- * Configuration of the Plus button that appears on each tabstrip. Upon pressing, a new tab
49
- * will be added to the tabstrip with the specified url.
50
- * @property {string} [newTabButton.url] Specifies the url that opens in the tab created upon pressing the button.
51
- * @property { boolean } [popoutWholeStack=false] Whether the popout button will only act on the entire stack,
52
- * as opposed to only the active tab.
53
- * @property { boolean } [preventDragIn=false] If true, tabs can't be dragged into the window.
54
- * @property { boolean } [preventDragOut=false] If true, tabs can't be dragged out of the window.
55
- * @property { boolean } [preventSplitterResize=false] If true, tab contents can't be resized by the user.
56
- * @property { boolean } [reorderEnabled=true] If true, the user can re-arrange the layout by
57
- * dragging items by their tabs to the desired location.
58
- * @property { boolean } [showCloseIcon=false] Whether to show the close button on stack header
59
- * (not to be confused with close button on every tab).
60
- * @property { boolean } [showMaximiseIcon=false] Whether to show the maximize button on stack header.
61
- * The button will maximize the current tab to fill the entire window.
62
- * @property { boolean } [showPopoutIcon=false] Whether to show the popout button on stack header.
63
- * The button will create a new window with current tab as its content.
64
- * In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window.
65
- */
66
- /**
67
- * @lends Platform#Layout
68
- */
69
5
  export declare class LayoutModule extends Base {
70
6
  #private;
71
7
  /**
72
8
  * Asynchronously returns a Layout object that represents a Window's layout.
73
- * @param { Identity } identity
74
- * @return {Promise.<Layout>}
75
- * @tutorial Layout.wrap
9
+ * @param identity
10
+ *
11
+ * @example
12
+ * ```js
13
+ * let windowIdentity;
14
+ * if (!fin.me.isWindow) {
15
+ * windowIdentity = fin.me.identity;
16
+ * } else if (fin.me.isView) {
17
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
18
+ * } else {
19
+ * throw new Error('Not running in a platform View or Window');
20
+ * }
21
+ *
22
+ * const layout = await fin.Platform.Layout.wrap(windowIdentity);
23
+ * // Use wrapped instance to control layout, e.g.:
24
+ * const layoutConfig = await layout.getConfig();
25
+ * ```
76
26
  * @static
77
27
  */
78
28
  wrap(identity: OpenFin.Identity): Promise<OpenFin.Layout>;
79
29
  /**
80
30
  * Synchronously returns a Layout object that represents a Window's layout.
81
- * @param { Identity } identity
82
- * @return {Layout}
83
- * @tutorial Layout.wrapSync
31
+ * @param identity
32
+ *
33
+ * @example
34
+ * ```js
35
+ * let windowIdentity;
36
+ * if (!fin.me.isWindow) {
37
+ * windowIdentity = fin.me.identity;
38
+ * } else if (fin.me.isView) {
39
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
40
+ * } else {
41
+ * throw new Error('Not running in a platform View or Window');
42
+ * }
43
+ *
44
+ * const layout = fin.Platform.Layout.wrapSync(windowIdentity);
45
+ * // Use wrapped instance to control layout, e.g.:
46
+ * const layoutConfig = await layout.getConfig();
47
+ * ```
84
48
  * @static
85
49
  */
86
50
  wrapSync(identity: OpenFin.Identity): OpenFin.Layout;
87
51
  /**
88
52
  * Asynchronously returns a Layout object that represents a Window's layout.
89
- * @return {Promise.<Layout>}
90
- * @tutorial Layout.getCurrent
53
+ *
54
+ * @example
55
+ * ```js
56
+ * const layout = await fin.Platform.Layout.getCurrent();
57
+ * // Use wrapped instance to control layout, e.g.:
58
+ * const layoutConfig = await layout.getConfig();
59
+ * ```
91
60
  * @static
92
61
  */
93
62
  getCurrent(): Promise<OpenFin.Layout>;
94
63
  /**
95
64
  * Synchronously returns a Layout object that represents a Window's layout.
96
- * @return {Layout}
97
- * @tutorial Layout.getCurrentSync
65
+ *
66
+ * @remarks Cannot be called from a view.
67
+ *
68
+ *
69
+ * @example
70
+ * ```js
71
+ * const layout = fin.Platform.Layout.getCurrentSync();
72
+ * // Use wrapped instance to control layout, e.g.:
73
+ * const layoutConfig = await layout.getConfig();
74
+ * ```
98
75
  * @static
99
76
  */
100
77
  getCurrentSync(): OpenFin.Layout;
@@ -103,8 +80,8 @@ export declare class LayoutModule extends Base {
103
80
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
104
81
  * A Layout will <a href="tutorial-Layout.DOMEvents.html">emit events locally</a> on the DOM element representing the layout-container.
105
82
  * In order to capture the relevant events during Layout initiation, set up the listeners on the DOM element prior to calling `init`.
106
- * @param { InitLayoutOptions } [options] - Layout init options.
107
- * @return { Promise<Layout> }
83
+ * @param options - Layout init options.
84
+ *
108
85
  * @static
109
86
  * @experimental
110
87
  * @tutorial Layout.init
@@ -16,70 +16,6 @@ exports.LayoutModule = void 0;
16
16
  /* eslint-disable no-undef, import/prefer-default-export */
17
17
  const base_1 = require("../../base");
18
18
  const Instance_1 = require("./Instance");
19
- /**
20
- * @PORTED
21
- * InitLayoutOptions interface
22
- * @typedef { object } InitLayoutOptions
23
- * @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
24
- * then an element with id `layout-container` is used. We recommend using a div element.
25
- */
26
- /**
27
- * @PORTED
28
- * PresetLayoutOptions interface
29
- * @typedef { object } PresetLayoutOptions
30
- * @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
31
- * The preset options are `columns`, `grid`, `rows`, and `tabs`.
32
- */
33
- /**
34
- * LayoutConfig interface
35
- * @typedef { object } LayoutConfig
36
- * @property { Array<LayoutItem> } content Content of the layout. There can only be one top-level LayoutItem in the content array.
37
- * We do not recommend trying to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot}
38
- * or our {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }.
39
- * @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
40
- */
41
- /**
42
- * @PORTED
43
- * LayoutItem Interface
44
- * @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
45
- * to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
46
- * {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }.
47
- * @property { string } type The type of the item. Possible values are 'row', 'column', 'stack', and 'component'.
48
- * @property { Array<LayoutItem> } [content] An array of configurations for items that will be created as children of this item.
49
- * @property { string } [componentName] Only a `component` type will have this property and it should be set to `view`.
50
- * @property { View~options } [componentState] Only a `component` type will have this property and it represents the view
51
- * options of a given component.
52
- */
53
- /**
54
- * @PORTED
55
- * LayoutSettings Interface
56
- * @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
57
- * @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
58
- * If true, stack headers are the only areas where tabs can be dropped.
59
- * @property { boolean } [hasHeaders=true] Turns tab headers on or off.
60
- * If false, the layout will be displayed with splitters only.
61
- * @property {object} [newTabButton]
62
- * Configuration of the Plus button that appears on each tabstrip. Upon pressing, a new tab
63
- * will be added to the tabstrip with the specified url.
64
- * @property {string} [newTabButton.url] Specifies the url that opens in the tab created upon pressing the button.
65
- * @property { boolean } [popoutWholeStack=false] Whether the popout button will only act on the entire stack,
66
- * as opposed to only the active tab.
67
- * @property { boolean } [preventDragIn=false] If true, tabs can't be dragged into the window.
68
- * @property { boolean } [preventDragOut=false] If true, tabs can't be dragged out of the window.
69
- * @property { boolean } [preventSplitterResize=false] If true, tab contents can't be resized by the user.
70
- * @property { boolean } [reorderEnabled=true] If true, the user can re-arrange the layout by
71
- * dragging items by their tabs to the desired location.
72
- * @property { boolean } [showCloseIcon=false] Whether to show the close button on stack header
73
- * (not to be confused with close button on every tab).
74
- * @property { boolean } [showMaximiseIcon=false] Whether to show the maximize button on stack header.
75
- * The button will maximize the current tab to fill the entire window.
76
- * @property { boolean } [showPopoutIcon=false] Whether to show the popout button on stack header.
77
- * The button will create a new window with current tab as its content.
78
- * In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window.
79
- */
80
- /**
81
- * @lends Platform#Layout
82
- */
83
19
  class LayoutModule extends base_1.Base {
84
20
  constructor() {
85
21
  super(...arguments);
@@ -89,8 +25,8 @@ class LayoutModule extends base_1.Base {
89
25
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
90
26
  * A Layout will <a href="tutorial-Layout.DOMEvents.html">emit events locally</a> on the DOM element representing the layout-container.
91
27
  * In order to capture the relevant events during Layout initiation, set up the listeners on the DOM element prior to calling `init`.
92
- * @param { InitLayoutOptions } [options] - Layout init options.
93
- * @return { Promise<Layout> }
28
+ * @param options - Layout init options.
29
+ *
94
30
  * @static
95
31
  * @experimental
96
32
  * @tutorial Layout.init
@@ -111,9 +47,23 @@ class LayoutModule extends base_1.Base {
111
47
  }
112
48
  /**
113
49
  * Asynchronously returns a Layout object that represents a Window's layout.
114
- * @param { Identity } identity
115
- * @return {Promise.<Layout>}
116
- * @tutorial Layout.wrap
50
+ * @param identity
51
+ *
52
+ * @example
53
+ * ```js
54
+ * let windowIdentity;
55
+ * if (!fin.me.isWindow) {
56
+ * windowIdentity = fin.me.identity;
57
+ * } else if (fin.me.isView) {
58
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
59
+ * } else {
60
+ * throw new Error('Not running in a platform View or Window');
61
+ * }
62
+ *
63
+ * const layout = await fin.Platform.Layout.wrap(windowIdentity);
64
+ * // Use wrapped instance to control layout, e.g.:
65
+ * const layoutConfig = await layout.getConfig();
66
+ * ```
117
67
  * @static
118
68
  */
119
69
  // eslint-disable-next-line class-methods-use-this
@@ -125,9 +75,23 @@ class LayoutModule extends base_1.Base {
125
75
  }
126
76
  /**
127
77
  * Synchronously returns a Layout object that represents a Window's layout.
128
- * @param { Identity } identity
129
- * @return {Layout}
130
- * @tutorial Layout.wrapSync
78
+ * @param identity
79
+ *
80
+ * @example
81
+ * ```js
82
+ * let windowIdentity;
83
+ * if (!fin.me.isWindow) {
84
+ * windowIdentity = fin.me.identity;
85
+ * } else if (fin.me.isView) {
86
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
87
+ * } else {
88
+ * throw new Error('Not running in a platform View or Window');
89
+ * }
90
+ *
91
+ * const layout = fin.Platform.Layout.wrapSync(windowIdentity);
92
+ * // Use wrapped instance to control layout, e.g.:
93
+ * const layoutConfig = await layout.getConfig();
94
+ * ```
131
95
  * @static
132
96
  */
133
97
  // eslint-disable-next-line class-methods-use-this
@@ -139,8 +103,13 @@ class LayoutModule extends base_1.Base {
139
103
  }
140
104
  /**
141
105
  * Asynchronously returns a Layout object that represents a Window's layout.
142
- * @return {Promise.<Layout>}
143
- * @tutorial Layout.getCurrent
106
+ *
107
+ * @example
108
+ * ```js
109
+ * const layout = await fin.Platform.Layout.getCurrent();
110
+ * // Use wrapped instance to control layout, e.g.:
111
+ * const layoutConfig = await layout.getConfig();
112
+ * ```
144
113
  * @static
145
114
  */
146
115
  async getCurrent() {
@@ -155,8 +124,16 @@ class LayoutModule extends base_1.Base {
155
124
  }
156
125
  /**
157
126
  * Synchronously returns a Layout object that represents a Window's layout.
158
- * @return {Layout}
159
- * @tutorial Layout.getCurrentSync
127
+ *
128
+ * @remarks Cannot be called from a view.
129
+ *
130
+ *
131
+ * @example
132
+ * ```js
133
+ * const layout = fin.Platform.Layout.getCurrentSync();
134
+ * // Use wrapped instance to control layout, e.g.:
135
+ * const layoutConfig = await layout.getConfig();
136
+ * ```
160
137
  * @static
161
138
  */
162
139
  getCurrentSync() {
@@ -4,53 +4,188 @@ import { Base } from '../../base';
4
4
  type Identity = OpenFin.Identity;
5
5
  type InitLayoutOptions = OpenFin.InitLayoutOptions;
6
6
  type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
7
- /**
8
- * @lends Platform#Layout
9
- */
10
7
  export declare class Layout extends Base {
11
8
  #private;
9
+ /**
10
+ * Initialize the window's Layout.
11
+ *
12
+ * @remarks Must be called from a custom window that has a 'layout' option set upon creation of that window. If a containerId
13
+ * is not provided, this method attempts to find an element with the id `layout-container`.
14
+ *
15
+ * A Layout will emit events locally on the DOM element representing the layout-container. In order to capture the relevant
16
+ * events during Layout initiation, set up the listeners on the DOM element prior to calling init.
17
+ *
18
+ * @example
19
+ * ```js
20
+ * // if no options are included, the layout in the window options is initialized in an element with the id `layout-container`
21
+ * const layout = await fin.Platform.Layout.init();
22
+ * ```
23
+ * <br /><br />
24
+ * # Example
25
+ * To target a different HTML element use the options object.
26
+ * ```js
27
+ * const containerId = 'my-custom-container-id';
28
+ *
29
+ * const myLayoutContainer = document.getElementById(containerId);
30
+ *
31
+ * myLayoutContainer.addEventListener('tab-created', function(event) {
32
+ * const { tabSelector } = event.detail;
33
+ * const tabElement = document.getElementById(tabSelector);
34
+ * const existingColor = tabElement.style.backgroundColor;
35
+ * tabElement.style.backgroundColor = "red";
36
+ * setTimeout(() => {
37
+ * tabElement.style.backgroundColor = existingColor;
38
+ * }, 2000);
39
+ * });
40
+ *
41
+ * // initialize the layout into an existing HTML element with the div `my-custom-container-id`
42
+ * // the window must have been created with a layout in its window options
43
+ * const layout = await fin.Platform.Layout.init({ containerId });
44
+ * ```
45
+ */
12
46
  init: (options?: InitLayoutOptions) => Promise<Layout>;
13
47
  identity: Identity;
14
48
  private platform;
15
49
  wire: Transport;
50
+ /**
51
+ * @internal
52
+ */
16
53
  constructor(identity: OpenFin.Identity, wire: Transport);
17
54
  /**
18
55
  * Returns the configuration of the window's layout. Returns the same information that is returned for all windows in getSnapshot.
19
- * @return { Promise<LayoutConfig> }
20
- * @tutorial Layout.getConfig
56
+ *
57
+ * @remarks Cannot be called from a View.
58
+ *
59
+ *
60
+ * @example
61
+ * ```js
62
+ * const layout = fin.Platform.Layout.getCurrentSync();
63
+ * // Use wrapped instance to get the layout configuration of the current window's Layout:
64
+ * const layoutConfig = await layout.getConfig();
65
+ * ```
21
66
  */
22
67
  getConfig(): Promise<any>;
23
68
  /**
24
- * Retrieves the top level content item of the layout.
25
- * @return {Promise<TabStack | ColumnOrRow>}
69
+ * Replaces a Platform window's layout with a new layout.
70
+ *
71
+ * @remarks Any views that were in the old layout but not the new layout will be destroyed. Views will be assigned a randomly generated name to avoid collisions.
72
+ * @example
73
+ * ```js
74
+ * let windowIdentity;
75
+ * if (fin.me.isWindow) {
76
+ * windowIdentity = fin.me.identity;
77
+ * } else if (fin.me.isView) {
78
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
79
+ * } else {
80
+ * throw new Error('Not running in a platform View or Window');
81
+ * }
82
+ *
83
+ * const layout = fin.Platform.Layout.wrapSync(windowIdentity);
84
+ *
85
+ * const newLayout = {
86
+ * content: [
87
+ * {
88
+ * type: 'stack',
89
+ * content: [
90
+ * {
91
+ * type: 'component',
92
+ * componentName: 'view',
93
+ * componentState: {
94
+ * name: 'new_component_A1',
95
+ * processAffinity: 'ps_1',
96
+ * url: 'https://www.example.com'
97
+ * }
98
+ * },
99
+ * {
100
+ * type: 'component',
101
+ * componentName: 'view',
102
+ * componentState: {
103
+ * name: 'new_component_A2',
104
+ * url: 'https://cdn.openfin.co/embed-web/chart.html'
105
+ * }
106
+ * }
107
+ * ]
108
+ * }
109
+ * ]
110
+ * };
111
+ *
112
+ * layout.replace(newLayout);
113
+ * ```
26
114
  */
27
- getRootItem(): Promise<OpenFin.ColumnOrRow | OpenFin.TabStack>;
115
+ replace: (layout: OpenFin.LayoutOptions) => Promise<void>;
28
116
  /**
29
- * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
30
- * will be destroyed.
31
- * @param { LayoutConfig } layout New layout to implement in the target window.
32
- * Please see explanation of a layout {@link https://developers.openfin.co/docs/platform-api#section-layout here}.
33
- * @return { Promise<void> }
34
- * @tutorial Layout.replace
117
+ * Retrieves the top level content item of the layout.
118
+ *
119
+ * @remarks Cannot be called from a view.
120
+ *
121
+ *
122
+ *
123
+ * @example
124
+ * ```js
125
+ * if (!fin.me.isWindow) {
126
+ * throw new Error('Not running in a platform View.');
127
+ * }
128
+ *
129
+ * // From the layout window
130
+ * const layout = fin.Platform.Layout.getCurrentSync();
131
+ * // Retrieves the ColumnOrRow instance
132
+ * const rootItem = await layout.getRootItem();
133
+ * const content = await rootItem.getContent();
134
+ * console.log(`The root ColumnOrRow instance has ${content.length} item(s)`);
135
+ * ```
35
136
  */
36
- replace: (layout: OpenFin.LayoutOptions) => Promise<void>;
137
+ getRootItem(): Promise<OpenFin.ColumnOrRow | OpenFin.TabStack>;
37
138
  /**
38
139
  * Replaces the specified view with a view with the provided configuration.
39
- * The old view is stripped of its listeners and either closed or attached to the provider window
140
+ *
141
+ * @remarks The old view is stripped of its listeners and either closed or attached to the provider window
40
142
  * depending on `detachOnClose` view option.
41
- * @param { Identity } viewToReplace Identity of the view to be replaced
42
- * @param { View~options } newView Creation options of the new view.
43
- * @return { Promise<void> }
44
- * @tutorial Layout.replaceView
143
+ *
144
+ * @param viewToReplace Identity of the view to be replaced
145
+ * @param newView Creation options of the new view.
146
+ *
147
+ * @example
148
+ * ```js
149
+ * let currentWindow;
150
+ * if (fin.me.isWindow) {
151
+ * currentWindow = fin.me;
152
+ * } else if (fin.me.isView) {
153
+ * currentWindow = await fin.me.getCurrentWindow();
154
+ * } else {
155
+ * throw new Error('Not running in a platform View or Window');
156
+ * }
157
+ *
158
+ * const layout = fin.Platform.Layout.wrapSync(currentWindow.identity);
159
+ * const viewToReplace = (await currentWindow.getCurrentViews())[0];
160
+ * const newViewConfig = {url: 'https://example.com'};
161
+ * await layout.replaceView(viewToReplace.identity, newViewConfig);
162
+ * ```
45
163
  */
46
164
  replaceView: (viewToReplace: Identity, newView: OpenFin.PlatformViewCreationOptions) => Promise<void>;
47
165
  /**
48
166
  * Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window.
49
167
  * The preset options are `columns`, `grid`, `rows`, and `tabs`.
50
- * @param { PresetLayoutOptions } options Mandatory object with `presetType` property that sets which preset layout arrangement to use.
168
+ * @param options Mandatory object with `presetType` property that sets which preset layout arrangement to use.
51
169
  * The preset options are `columns`, `grid`, `rows`, and `tabs`.
52
- * @return { Promise<void> }
53
- * @tutorial Layout.applyPreset
170
+ *
171
+ * @example
172
+ * ```js
173
+ * let windowIdentity;
174
+ * if (fin.me.isWindow) {
175
+ * windowIdentity = fin.me.identity;
176
+ * } else if (fin.me.isView) {
177
+ * windowIdentity = (await fin.me.getCurrentWindow()).identity;
178
+ * } else {
179
+ * throw new Error('Not running in a platform View or Window');
180
+ * }
181
+ *
182
+ * const layout = fin.Platform.Layout.wrapSync(windowIdentity);
183
+ * await layout.applyPreset({ presetType: 'grid' });
184
+ *
185
+ * // wait 5 seconds until you change the layout from grid to tabs
186
+ * await new Promise (res => setTimeout(res, 5000));
187
+ * await layout.applyPreset({ presetType: 'tabs' });
188
+ * ```
54
189
  */
55
190
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
56
191
  }