@openfin/workspace-platform 4.16.0 → 4.20.0

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.
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import type { Page } from '../../common/src/api/pages/shapes';
6
6
  import type { Workspace } from '../../common/src/api/workspaces';
7
- import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src';
8
- export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src';
7
+ import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src/index';
8
+ export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src/index';
9
9
  export type { Workspace } from '../../common/src/api/workspaces';
10
- export type { Page } from '../../common/src/api/pages/shapes';
11
- export { SearchTagBackground } from '../../search-api/src';
10
+ export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../common/src/utils/layout';
11
+ export type { Page, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
12
+ export { SearchTagBackground } from '../../search-api/src/index';
12
13
  /**
13
14
  * Describes the type of the app directory entry `manifest` attributes.
14
15
  * Launch mechanics are determined by the manifest type.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '@common/api/pages/shapes';
2
+ import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
3
3
  export declare const getBrowserModule: (identity: OpenFin.Identity) => {
4
4
  identity: OpenFin.Identity;
5
5
  openfinWindow: import("openfin-adapter").Window;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachedPage, Page } from '@common/api/pages/shapes';
2
+ import type { AttachedPage, Page } from '../../../../common/src/api/pages/shapes';
3
3
  import type { BrowserCreateWindowRequest, BrowserWindowModule } from '../../shapes';
4
4
  export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
5
5
  wrapSync: (windowIdentity: OpenFin.Identity) => {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import { SnapshotExtended } from '@common/utils/snapshot';
2
+ import { SnapshotExtended } from '../../../../common/src/utils/snapshot';
3
3
  /**
4
4
  * Get a snapshot with pages.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachPagesToWindowPayload } from '@common/api/pages/shapes';
3
- import type { CreateSavedPageRequest, Page, UpdateSavedPageRequest } from '@client-platform/shapes';
2
+ import type { AttachPagesToWindowPayload } from '../../../../common/src/api/pages/shapes';
3
+ import type { CreateSavedPageRequest, Page, UpdateSavedPageRequest } from '../../../../client-api-platform/src/shapes';
4
4
  /**
5
5
  * Get all open pages in which are attached to a window.
6
6
  * @returns the list of attached pages.
@@ -1,4 +1,4 @@
1
- import { Page } from '@common/api/pages/shapes';
1
+ import { Page } from '../../../common/src/api/pages/shapes';
2
2
  import type { CreateSavedPageRequest, UpdateSavedPageRequest } from '../shapes';
3
3
  export declare const getStorageApi: (identity: any) => {
4
4
  createPage: (req: CreateSavedPageRequest) => Promise<any>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { CustomThemes } from '@common/api/theming';
2
+ import type { CustomThemes } from '../../../common/src/api/theming';
3
3
  export declare const getThemingApi: (identity: OpenFin.ApplicationIdentity) => {
4
4
  getThemes: () => Promise<CustomThemes>;
5
5
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { BrowserInitConfig } from '@client-platform/shapes';
2
+ import type { BrowserInitConfig } from '../../../client-api-platform/src/shapes';
3
3
  export declare const getOverrideCallback: (initOptions: BrowserInitConfig) => OpenFin.OverrideCallback<OpenFin.PlatformProvider>;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
2
  import type { InteropBroker } from 'openfin-adapter/src/api/interop';
3
- import type { App } from '../../client-api/src/shapes';
4
3
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
5
4
  import type { CustomThemes } from '../../common/src/api/theming';
5
+ import type { App } from '../../client-api/src/shapes';
6
6
  export type { CustomThemes } from '../../common/src/api/theming';
7
7
  export type { App, Image, AppIntent } from '../../client-api/src/shapes';
8
8
  export { AppManifestType } from '../../client-api/src/shapes';
@@ -43,16 +43,23 @@ export interface UpdateAttachedPageRequest {
43
43
  * Request for creating a browser window.
44
44
  */
45
45
  export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform'> {
46
+ /** WorkspacePlatform specific window options. These options will not work unless a workspace platform has been initialized. */
46
47
  workspacePlatform: {
47
48
  /** The initial set of pages to add to the created browser window. */
48
49
  pages: Page[];
49
- /** The favicon to display on the top right of the created browser window. */
50
+ /** The favicon to display on the top left of the created browser window. */
50
51
  favicon?: string;
51
52
  /** A UI friendly title for the created browser window. */
52
53
  title?: string;
53
- /** A URL to use when creating a new tab. */
54
+ /**
55
+ * Landing page that shows up when you add a new tab from the plus button that exists in the tabstrip.
56
+ * If you do not provide a newTabUrl, then the plus button in the tabstrip will not be shown and users cannot create a new empty tab.
57
+ */
54
58
  newTabUrl?: string;
55
- /** A URL to use when creating the initial tab in a new page. */
59
+ /**
60
+ * Landing page that shows up when you add a new page from the plus button that exists in the window frame where the page selector is shown.
61
+ * If you do not provide a newPageUrl, then the new Page plus button will not be shown and you cannot create a new empty Page or Window.
62
+ */
56
63
  newPageUrl?: string;
57
64
  };
58
65
  }
@@ -82,6 +89,7 @@ export interface BrowserWindowModule {
82
89
  * import * as WorkspacePlatform from '@openfin/workspace-platform';
83
90
  *
84
91
  * const workspacePlatform = WorkspacePlatform.getCurrentSync();
92
+ * // assume a browser window already exists
85
93
  * const windows = await workspacePlatform.Browser.getAllWindows();
86
94
  * const page = await windows[0].getPage('MyPageId');
87
95
  * ```
@@ -95,6 +103,7 @@ export interface BrowserWindowModule {
95
103
  * import * as WorkspacePlatform from '@openfin/workspace-platform';
96
104
  *
97
105
  * const workspacePlatform = WorkspacePlatform.getCurrentSync();
106
+ * // assume a browser window already exists
98
107
  * const windows = await workspacePlatform.Browser.getAllWindows();
99
108
  * const pages = await windows[0].getPages();
100
109
  * ```
@@ -107,6 +116,7 @@ export interface BrowserWindowModule {
107
116
  * import * as WorkspacePlatform from '@openfin/workspace-platform';
108
117
  *
109
118
  * const workspacePlatform = WorkspacePlatform.getCurrentSync();
119
+ * // assume a browser window already exists
110
120
  * const windows = await workspacePlatform.Browser.getAllWindows();
111
121
  * await windows[0].setActivePage('MyPageId');
112
122
  * ```
@@ -143,6 +153,7 @@ export interface BrowserWindowModule {
143
153
  * pageId: 'myPageId',
144
154
  * layout
145
155
  * };
156
+ * // assume a browser window already exists
146
157
  * const windows = await workspacePlatform.Browser.getAllWindows();
147
158
  * await windows[0].addPage(page);
148
159
  * ```
@@ -151,16 +162,69 @@ export interface BrowserWindowModule {
151
162
  addPage(page: PageWithUpdatableRuntimeAttribs): Promise<void>;
152
163
  /**
153
164
  * Remove an attached page from the browser window.
165
+ *
166
+ * ```ts
167
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
168
+ *
169
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
170
+ * // assume a browser window already exists
171
+ * const windows = await workspacePlatform.Browser.getAllWindows();
172
+ * await windows[0].removePage('myPageId');
173
+ * ```
154
174
  * @param id the id of the attached page to remove from the browser window.
155
175
  */
156
176
  removePage(id: string): Promise<void>;
157
177
  /**
158
178
  * Update a page in which is attached to the browser window.
179
+ *
180
+ * ```ts
181
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
182
+ *
183
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
184
+ * const layout = {
185
+ * content: [
186
+ * {
187
+ * type: 'stack',
188
+ * content: [
189
+ * {
190
+ * type: 'component',
191
+ * componentName: 'view',
192
+ * componentState: {
193
+ * name: 'myViewName',
194
+ * url: 'http://google.com'
195
+ * }
196
+ * }
197
+ * ]
198
+ * }
199
+ * ]
200
+ * };
201
+ * const page = {
202
+ * title: 'myPageTitle',
203
+ * pageId: 'myPageId',
204
+ * layout
205
+ * };
206
+ * // assume a browser window already exists
207
+ * const windows = await workspacePlatform.Browser.getAllWindows();
208
+ * const req = {
209
+ * pageId: 'myPageId',
210
+ * page
211
+ * };
212
+ * await windows[0].updatePage(req);
213
+ * ```
159
214
  * @param req the update request.
160
215
  */
161
216
  updatePage(req: UpdateAttachedPageRequest): Promise<void>;
162
217
  /**
163
218
  * Reorder pages attached to the browser window.
219
+ *
220
+ * ```ts
221
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
222
+ *
223
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
224
+ * // assume a browser window already exists and has three pages in it
225
+ * const windows = await workspacePlatform.Browser.getAllWindows();
226
+ * await windows[0].reorderPages(['myPageId2', 'myPageId1', 'myPageId3']);
227
+ * ```
164
228
  * @param req the reorder pages request.
165
229
  */
166
230
  reorderPages(req: ReorderPagesRequest): Promise<void>;
@@ -241,11 +305,25 @@ export interface BrowserWindowFactory {
241
305
  createWindow(options: BrowserCreateWindowRequest): Promise<BrowserWindowModule>;
242
306
  /**
243
307
  * Get a unique title for a page.
308
+ *
309
+ * ```ts
310
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
311
+ *
312
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
313
+ * const uniqueTitle = await workspacePlatform.Browser.getUniquePageTitle('myTitle');
314
+ * ```
244
315
  * @param title a prefix for the title.
245
316
  */
246
317
  getUniquePageTitle(title?: string): Promise<string>;
247
318
  /**
248
319
  * Get the identity of the last focused Browser window.
320
+ *
321
+ * ```ts
322
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
323
+ *
324
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
325
+ * const windowIdentity = await workspacePlatform.Browser.getLastFocusedWindow();
326
+ * ```
249
327
  */
250
328
  getLastFocusedWindow(): Promise<OpenFin.Identity>;
251
329
  }
@@ -428,6 +506,28 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
428
506
  getSnapshot(): Promise<BrowserSnapshot>;
429
507
  /**
430
508
  * Launch an application.
509
+ * ```ts
510
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
511
+ *
512
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
513
+ * const req = {
514
+ * app: {
515
+ * appId: 'myAppId',
516
+ * title: 'appTitle',
517
+ * manifest: 'http://localhost/app.json',
518
+ * manifestType: AppManifestType.Manifest,
519
+ * icons:[
520
+ * {
521
+ * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
522
+ * src: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
523
+ * type: "ico",
524
+ * },
525
+ * ]
526
+ * }
527
+ * }
528
+ * workspacePlatform.launchApp(req);
529
+ *
530
+ * ```
431
531
  * @param req the launch app request.
432
532
  */
433
533
  launchApp(req: LaunchAppRequest): Promise<void>;
@@ -439,6 +539,9 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
439
539
  * The storage API for the Workspace Platform.
440
540
  */
441
541
  Storage: WorkspacePlatformStorage;
542
+ /**
543
+ * Theme API for the Workspace Platform.
544
+ */
442
545
  Theme: ThemeApi;
443
546
  }
444
547
  export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
@@ -1,4 +1,4 @@
1
- import type { Page } from '@common/api/pages/shapes';
1
+ import type { Page } from '../../../../common/src/api/pages/shapes';
2
2
  export declare const store: import("idb-keyval").UseStore;
3
3
  export declare function getPage(id: string): Promise<Page>;
4
4
  export declare function getPageList(filter?: string): Promise<Page[]>;
@@ -1,4 +1,4 @@
1
- import { LayoutExtended } from '@common/utils/layout';
1
+ import { LayoutExtended } from '../../../../common/src/utils/layout';
2
2
  import type { AttachedPage, Page, PageLayout, PageWithUpdatableRuntimeAttribs } from './shapes';
3
3
  export declare function getLegacyPages(): Promise<Page[]>;
4
4
  export declare function cleanPage(page: AttachedPage): Page;
@@ -1,4 +1,4 @@
1
- import type { AttachedPage, PageLayout } from '@common/api/pages/shapes';
1
+ import type { AttachedPage, PageLayout } from '../../../../common/src/api/pages/shapes';
2
2
  interface Workstack {
3
3
  id: string;
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- import { CustomPaletteSet } from '@common/api/theming';
1
+ import { CustomPaletteSet } from '../../../common/src/api/theming';
2
2
  /**
3
3
  * Get hue from a CSS color
4
4
  *
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@openfin/workspace-platform","description":"An API for creating your own Workspace platform.","contributors":[],"version":"4.16.0","main":"index.ts","scripts":{"deploy":"npm run deploy:npm && npm run deploy:docs","deploy:npm":"cd out && npm publish","deploy:docs":"aws s3 cp --recursive ./docs/ s3://cdn.openfin.co/workspace/api/platform/docs/","deploy:next":"npm run deploy:next:npm && npm run deploy:next:docs","deploy:next:npm":"cd out && npm publish --tag next","deploy:next:docs":"aws s3 cp --recursive ./docs/ s3://cdn.openfin.co/workspace/api/platform/docs/next/","cp:readme":"copyfiles README.md out","cp:package":"node ../common/scripts/cp-package.js","cp:next:package":"node ../common/scripts/cp-package-next.js","create:rootIndex":"node ../common/scripts/cp-root-index.js","package":"npm run cp:readme && npm run cp:package && npm run create:rootIndex","package:next":"npm run cp:readme && npm run cp:next:package && npm run create:rootIndex","clean":"rimraf ./out && rimraf ./docs","build:common":"cross-env ENV=prod webpack --mode=production --config ./webpack.common.config.js","build":"npm run clean && npm run build:common && npm run build:docs","build:docs":"typedoc --tsconfig ./tsconfig.json --readme none --disableSources ./src/index.ts","test":"jest --watch --colors","test:ci":"jest"},"keywords":["client","api","workspace","platform"],"license":"MIT"}
1
+ {"name":"@openfin/workspace-platform","description":"An API for creating your own Workspace platform.","contributors":[],"version":"4.20.0","main":"index.ts","scripts":{"deploy":"npm run deploy:npm && npm run deploy:docs","deploy:npm":"cd out && npm publish","deploy:docs":"aws s3 cp --recursive ./docs/ s3://cdn.openfin.co/workspace/api/platform/docs/","deploy:next":"npm run deploy:next:npm && npm run deploy:next:docs","deploy:next:npm":"cd out && npm publish --tag next","deploy:next:docs":"aws s3 cp --recursive ./docs/ s3://cdn.openfin.co/workspace/api/platform/docs/next/","cp:readme":"copyfiles README.md out","cp:package":"node ../common/scripts/cp-package.js","cp:next:package":"node ../common/scripts/cp-package-next.js","create:rootIndex":"node ../common/scripts/cp-root-index.js","package":"npm run cp:readme && npm run cp:package && npm run create:rootIndex","package:next":"npm run cp:readme && npm run cp:next:package && npm run create:rootIndex","clean":"rimraf ./out && rimraf ./docs","build:common":"cross-env ENV=prod webpack --mode=production --config ./webpack.common.config.js","build":"npm run clean && npm run build:common && npm run build:docs","build:docs":"typedoc --tsconfig ./tsconfig.json --readme none --disableSources ./src/index.ts","test":"jest --watch --colors","test:ci":"jest"},"keywords":["client","api","workspace","platform"],"license":"MIT"}
@@ -1,4 +1,4 @@
1
- import { ChannelClient } from '@search/fin/shapes';
1
+ import { ChannelClient } from '../../../search-api/src/fin/shapes';
2
2
  import type { Action, SearchProvider, SearchProviderResponseGeneratorExtended, SearchRequest, SearchResult } from '../shapes';
3
3
  /**
4
4
  * Register a remote search provider.