@openfin/workspace-platform 24.0.13 → 24.0.14

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.
@@ -7,7 +7,7 @@ import type { LaunchAppRequest, SearchSitesRequest, SearchSitesResponse, Site }
7
7
  * @param app the app directory entry.
8
8
  * @param opts launch options.
9
9
  */
10
- export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.Identity | OpenFin.View | OpenFin.Platform | OpenFin.Application>;
10
+ export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.Identity | OpenFin.Application | OpenFin.View | OpenFin.Platform>;
11
11
  export declare const enterpriseAppDirectoryChannelClient: () => Promise<OpenFin.ChannelClient>;
12
12
  export declare function getResults(payload: {
13
13
  req: SearchSitesRequest;
@@ -0,0 +1,19 @@
1
+ import { StorageProxy } from '../../../../../client-api-platform/src/api/utils';
2
+ /**
3
+ * Channel Storage Proxy allows population of storage keys in a different origin, assuming that origin has set up
4
+ * a storage proxy on the specified URL.
5
+ *
6
+ * This is useful for writing to the localStorage of workspace when the provider is on a different origin.
7
+ */
8
+ export declare class ChannelStorageProxy implements StorageProxy {
9
+ #private;
10
+ constructor(url: string);
11
+ get isDestroyed(): boolean;
12
+ /**
13
+ * Sets a key in the proxied storage partition.
14
+ * @param key Key to set
15
+ * @param value Value.
16
+ */
17
+ setItem(key: string, value: string): Promise<void>;
18
+ destroy(): Promise<void>;
19
+ }
@@ -0,0 +1,12 @@
1
+ import { StorageProxy } from '../../../../../client-api-platform/src/api/utils';
2
+ /**
3
+ * LocalStorage backed StorageProxy, for use in same origin scenarios (i.e. when the provider and workspace UI are guaranteed
4
+ * to share a storage partition).
5
+ */
6
+ export declare class LocalStorageProxy implements StorageProxy {
7
+ #private;
8
+ constructor(storage: Pick<Storage, 'setItem'>);
9
+ setItem(key: string, value: string): Promise<void>;
10
+ destroy(): Promise<void>;
11
+ get isDestroyed(): boolean;
12
+ }
@@ -17,3 +17,20 @@ export declare const initialiseStoragePalettes: (customThemes: CustomThemes | un
17
17
  notificationIndicatorColors: NotificationIndicatorColorsParsed | null;
18
18
  };
19
19
  export declare const getThemeStorageController: () => ThemeStorageController;
20
+ /**
21
+ * Resolves when the first theme sync completes. Use this to ensure that we do not launch UI such as browser until this has completed.
22
+ *
23
+ * @param allowFailure Whether to suppress rejections and continue anyway. Recommended for most use cases.
24
+ */
25
+ export declare const waitForFirstThemeSync: (allowFailure?: boolean) => Promise<void>;
26
+ /**
27
+ * Creates and initialises the Theme Storage Controller singleton.
28
+ *
29
+ * Triggers the first theme sync, but does not await it. To ensure dependent UI can guarantee the theme palette is synced,
30
+ * you can call `await waitForFirstThemeSync` (e.g. in the createWindow provider override).
31
+ *
32
+ * @param isEnterprise Whether in enterprise mode (allows using local storage proxy directly).
33
+ * @param baseUrl Base url of the hosted workspace UI.
34
+ * @param syncTimeout How long `waitForFirstThemeSync` should wait before rejecting.
35
+ */
36
+ export declare const initialiseThemeController: (isEnterprise: boolean, baseUrl: string, syncTimeout: number) => void;
@@ -1,6 +1,9 @@
1
- import { GeneratedPalettes } from '../../../../common/src/api/theming';
2
1
  import { StorageProxy } from '../../../../client-api-platform/src/api/utils';
3
2
  import { ColorSchemeOptionType, CustomPaletteSet } from '../../../../client-api-platform/src/shapes';
3
+ /**
4
+ * Converts a string => (string | number) dictionary into a set of css vars.
5
+ */
6
+ export declare const getVars: (vars: Record<string, string | number>) => string;
4
7
  /**
5
8
  * Palette extensions can be used to add new variables to the palette set.
6
9
  *
@@ -23,38 +26,38 @@ export type Palettes = {
23
26
  light: string;
24
27
  dark: string;
25
28
  };
29
+ /**
30
+ * Generates `--workspace-palette-*` CSS variable strings from a CustomPaletteSet.
31
+ * Used to produce legacy CSS vars for backwards compatibility with workspace apps
32
+ * that still consume the legacy theme system.
33
+ */
34
+ export declare const generateLegacyCSSVars: (palettes: LegacyPalettes, isWindows: boolean) => {
35
+ light: string;
36
+ dark: string;
37
+ };
26
38
  export declare class ThemeStorageController {
39
+ #private;
27
40
  private providerStorage;
28
41
  private darkPaletteVars?;
29
42
  private lightPaletteVars?;
30
43
  private themePaletteSheet?;
31
- private generatedPalettes?;
32
44
  private workspaceStorage?;
33
- private recreateFactory?;
45
+ private storageFactory?;
34
46
  private isLegacySinglePaletteTheme;
35
47
  constructor(providerStorage: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>);
36
48
  /**
37
- * Set the current Storage Proxy to enable Workspace Storage properties to be populated.
38
- */
39
- setWorkspaceStorageProxy: (proxy: StorageProxy) => void;
40
- /**
41
- * Set a factory to recreate the storage proxy if it was destroyed (e.g. when a new browser
42
- * window is opened after the last one closed with preventQuitOnLastWindowClosed true).
43
- * Called once at platform init; avoids createWindow needing URL/env dependencies.
49
+ * Sets the storage factory. This can only be done once, and will throw for subsequent calls.
50
+ *
51
+ * All storage writes will be pending until the factory is created.
52
+ * @param factory
44
53
  */
45
- setRecreateFactory: (factory: () => Promise<StorageProxy>) => void;
54
+ setStorageFactory: (factory: () => StorageProxy) => void;
46
55
  /**
47
56
  * Close the storage proxy window and clear the reference. Called when the last browser window
48
57
  * closes so the platform can quit (storage proxy would otherwise keep the process alive).
49
- * Clears the reference before awaiting destroy() to avoid a race with ensureWorkspaceStorageProxy.
58
+ * Clears the reference before awaiting destroy() to avoid a race with getOrCreateStorageProxy.
50
59
  */
51
60
  destroyWorkspaceStorageProxy: () => Promise<void>;
52
- /**
53
- * Ensure the workspace storage proxy exists, recreating via the factory set at init if it was
54
- * previously destroyed. No-op if no factory was set (e.g. in tests). Call before using
55
- * workspace storage (e.g. when creating a browser window).
56
- */
57
- ensureWorkspaceStorageProxy: () => Promise<void>;
58
61
  /**
59
62
  * Check if there's an explicit user preference stored in localStorage.
60
63
  * A user preference is indicated by the presence of a SelectedColorScheme key. Which is something assigned if you click on the Appearance dropdown.
@@ -63,11 +66,15 @@ export declare class ThemeStorageController {
63
66
  private hasUserPreference;
64
67
  /**
65
68
  * Synchronize the current palette and scheme with workspace's storage instance if
66
- * storage based theming is enabled. Only syncs when user has explicitly selected a scheme.
69
+ * storage based theming is enabled.
67
70
  *
68
- * Wrapped in try/catch so it does not throw
71
+ * Workspace storage is consumed by workspace apps still on the legacy theme system
72
+ * whose theme-loader does NOT set `data-scheme` on the document. To maintain
73
+ * backwards compatibility the sheet written here uses the legacy format: for an
74
+ * explicit light/dark scheme only that scheme's vars are placed inside `:root{}`,
75
+ * while "system" uses `@media (prefers-color-scheme)` queries with `:root`.
69
76
  */
70
- trySynchronizeWorkspaceStorage: () => Promise<void>;
77
+ synchronizeWorkspaceStorage: () => Promise<void>;
71
78
  /**
72
79
  * Set the current Palette to be used by workspace. This palette will be converted into
73
80
  * css vars and combined into a single stylesheet. This stylesheet is exposed in localstorage
@@ -97,7 +104,6 @@ export declare class ThemeStorageController {
97
104
  * @param scheme The default scheme specified in the palette
98
105
  */
99
106
  setThemeDefaultScheme(scheme: ColorSchemeOptionType): void;
100
- setGeneratedPalettes(generatedPalettes: GeneratedPalettes): void;
101
107
  /**
102
108
  * Write the theme palette sheet to both in-memory state and providerStorage (namespaced localStorage)
103
109
  * immediately. This ensures the theme is available for themeLoader on same-origin pages
@@ -26,10 +26,15 @@ export declare const getActivePageIdForWindow: (identity: OpenFin.Identity) => P
26
26
  *
27
27
  * If the name is not unique, it will append a number to the end of the name.
28
28
  *
29
+ * When `BrowserInitConfig.allowDuplicatePageTitles` is `true`, this function
30
+ * short-circuits and returns the supplied name (or the default title) as-is,
31
+ * without appending a numeric suffix.
32
+ *
29
33
  * @param initialName The initial name to test
30
- * @returns string: a unique page name
34
+ * @param allowDuplicatePageTitles Whether duplicate page titles are permitted
35
+ * @returns string: a unique page name (or the input unchanged when duplicates are allowed)
31
36
  */
32
- export declare function getUniquePageTitle(initialName?: string): Promise<string>;
37
+ export declare function getUniquePageTitle(initialName?: string, allowDuplicatePageTitles?: boolean): Promise<string>;
33
38
  export declare function handleSaveModalOnPageClose({ page }: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
34
39
  /**
35
40
  * Default implementation of shouldPageClose. If enableBeforeUnload isn't set to true, always returns True (proceed with close).
@@ -1,6 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
- import type { BaseThemeOptions, CustomTheme, GenerateThemeParams } from '../../../common/src/api/theming';
3
- import { ColorSchemeOptionType, ThemeApi } from '../../../client-api-platform/src/shapes';
2
+ import type { GeneratedPalettes, NotificationIndicatorColorsParsed } from '../../../common/src/api/theming';
3
+ import { ColorSchemeOptionType, LegacyNotificationsThemeSet, ThemeApi } from '../../../client-api-platform/src/shapes';
4
4
  export declare const getThemingApi: (identity: OpenFin.ApplicationIdentity) => ThemeApi;
5
5
  export declare const dispatchThemeToWorkspaceProvider: (themeData: {
6
6
  themePaletteSheet: string;
@@ -13,5 +13,9 @@ export declare const dispatchThemeToWorkspaceProvider: (themeData: {
13
13
  export declare const setSelectedScheme: (schemeType: ColorSchemeOptionType) => Promise<void>;
14
14
  export declare const getSelectedScheme: () => ColorSchemeOptionType | null | undefined;
15
15
  export declare const getThemePaletteSheet: () => string | undefined;
16
- export declare const mapLegacyThemeToCustomTheme: (legacyTheme: CustomTheme) => GenerateThemeParams;
17
- export declare const mapLegacyBrandIcons: (legacyBrand: BaseThemeOptions["brand"]) => GenerateThemeParams[1];
16
+ export { assignIfDefined, mapGeneratedPalettesToLegacyPalettes, mapLegacyBrandIcons, mapLegacyThemeToCustomTheme } from '../../../common/src/api/theme-migration';
17
+ /**
18
+ * Builds a legacy NotificationsThemeSet from generated palettes and indicator colors.
19
+ * Used by the provider-side handler to serve old Notification Center versions (<=2.13).
20
+ */
21
+ export declare const buildLegacyNotificationsTheme: (generatedPalettes: GeneratedPalettes, notificationIndicatorColors: NotificationIndicatorColorsParsed | null) => Promise<LegacyNotificationsThemeSet | null>;
@@ -2,11 +2,6 @@ export declare const listenForStoreClose: () => void;
2
2
  export type StorageProxy = {
3
3
  setItem: (data: string, value: string) => Promise<void>;
4
4
  destroy: () => Promise<void>;
5
+ isDestroyed: boolean;
5
6
  };
6
- export declare const createStorageProxy: (url: string, isEnterprise: boolean) => Promise<StorageProxy>;
7
- /**
8
- * Ensure the workspace storage proxy window exists. Recreates it if it was previously destroyed
9
- * (e.g. when the last browser window closed with preventQuitOnLastWindowClosed true and a new
10
- * browser window is now being created). Uses the factory registered at init; no-op in tests.
11
- */
12
- export declare const ensureWorkspaceStorageProxy: () => Promise<void>;
7
+ export declare const getStorageFactory: (isEnterprise: boolean, baseUrl: string) => (() => StorageProxy);
@@ -1,5 +1,6 @@
1
1
  import OpenFin from '@openfin/core';
2
2
  import { WorkspacePlatformInitConfig } from '../../../client-api-platform/src/shapes';
3
+ export declare const MAX_FIRST_THEME_SYNC_WAIT = 3000;
3
4
  /**
4
5
  * Initilaize a Workspace Platform.
5
6
  *
@@ -4,4 +4,4 @@ import { BrowserInitConfig } from '../../../../client-api-platform/src/shapes';
4
4
  /**
5
5
  * Applies default options to the creation of browser windows.
6
6
  */
7
- export declare function applyBrowserDefaults(options: OpenFin.PlatformWindowCreationOptions, initOptions: Pick<BrowserInitConfig, 'defaultWindowOptions' | 'defaultPageOptions' | 'defaultViewOptions' | 'browserIconSize'> | undefined, themeData?: PreloadedThemeData): Promise<OpenFin.PlatformWindowCreationOptions>;
7
+ export declare function applyBrowserDefaults(options: OpenFin.PlatformWindowCreationOptions, initOptions: Pick<BrowserInitConfig, 'defaultWindowOptions' | 'defaultPageOptions' | 'defaultViewOptions' | 'browserIconSize' | 'allowDuplicatePageTitles'> | undefined, themeData?: PreloadedThemeData): Promise<OpenFin.PlatformWindowCreationOptions>;
@@ -1,4 +1,4 @@
1
1
  import OpenFin from '@openfin/core';
2
2
  import type { AttachedPage, AttachedPageInternal } from '../../../../common/src/api/pages/shapes';
3
3
  import { BrowserInitConfig } from '../..';
4
- export declare const applyPageDefaults: (pages: AttachedPage[], initOptions?: Pick<BrowserInitConfig, "defaultPageOptions" | "defaultViewOptions" | "defaultWindowOptions">, overrideOptions?: OpenFin.PlatformWindowCreationOptions) => Promise<AttachedPageInternal[]>;
4
+ export declare const applyPageDefaults: (pages: AttachedPage[], initOptions?: Pick<BrowserInitConfig, "defaultPageOptions" | "defaultViewOptions" | "defaultWindowOptions" | "allowDuplicatePageTitles">, overrideOptions?: OpenFin.PlatformWindowCreationOptions) => Promise<AttachedPageInternal[]>;
@@ -4,5 +4,12 @@ export declare function convertPanelViewOpts(panels: PanelConfig[], updatePageRe
4
4
  identity: OpenFin.Identity;
5
5
  pageId: string;
6
6
  }): Promise<ExtendedPanelConfig[]>;
7
- export declare function createPanelViewsForPages(pages: AttachedPage[]): Promise<void>;
7
+ /**
8
+ * Creates panel views for all pages in parallel. Returns a promise that callers
9
+ * may optionally await. In the initial window creation path the return value is
10
+ * intentionally ignored (fire-and-forget) so panel creation doesn't block
11
+ * `super.createWindow`. In the `attachPagesToWindow` path the promise is awaited
12
+ * so views exist before the browser dispatches `attachPanelViews`.
13
+ */
14
+ export declare function createPanelViewsForPages(pages: AttachedPage[]): Promise<PromiseSettledResult<unknown>[]> | undefined;
8
15
  export declare function createPanelViews(panels: PanelConfig[]): Promise<(void | OpenFin.View)[]>;
@@ -1,9 +1,10 @@
1
1
  import { GeneratedPalettes, NotificationIndicatorColorsParsed } from '../../../common/src/api/theming';
2
- import { CustomThemes } from '../shapes';
2
+ import { CustomThemes, LegacyNotificationsThemeSet } from '../shapes';
3
3
  export declare const getThemes: () => CustomThemes | null;
4
4
  export declare const getGeneratedPalettes: () => GeneratedPalettes;
5
5
  export declare const getThemePaletteSheet: () => string;
6
6
  export declare const getNotificationIndicatorColorsInternal: () => NotificationIndicatorColorsParsed;
7
+ export declare const getLegacyNotificationsThemeInternal: () => Promise<LegacyNotificationsThemeSet | null>;
7
8
  export declare const isThemePreInitialised: () => boolean;
8
9
  /**
9
10
  * initTheming()
@@ -796,6 +796,13 @@ export interface BrowserWorkspacePlatformWindowOptions {
796
796
  * When true, disables the ability to close pages in the window. False by default.
797
797
  */
798
798
  preventPageClose?: boolean;
799
+ /**
800
+ * When true, disables the find in page feature for the window.
801
+ * The find in page view will not be created and no find in page logic will run.
802
+ * This option must be set at window creation time and cannot be changed dynamically.
803
+ * False by default.
804
+ */
805
+ disableFindInPage?: boolean;
799
806
  /**
800
807
  * Taskbar Icon for the Browser Window. If light and dark icon are defined, then the taskbar icon will change when the scheme changes.
801
808
  */
@@ -2456,6 +2463,15 @@ export interface BrowserInitConfig {
2456
2463
  * https://developer.openfin.co/docs/javascript/stable/classes/OpenFin.InteropBroker.html
2457
2464
  */
2458
2465
  interopOverride?: OpenFin.OverrideCallback<OpenFin.InteropBroker, OpenFin.InteropBroker>;
2466
+ /**
2467
+ * When true, allows multiple pages to share the same title across browser
2468
+ * windows. No numeric suffixes are appended and attach/add operations
2469
+ * will not reject on title collision. `pageId` remains the unique
2470
+ * identifier for all page operations.
2471
+ *
2472
+ * Defaults to `false` (current unique-title behavior preserved).
2473
+ */
2474
+ allowDuplicatePageTitles?: boolean;
2459
2475
  }
2460
2476
  interface WorkspaceMetadata {
2461
2477
  APIVersion: string;
@@ -0,0 +1,46 @@
1
+ import type { BaseThemeOptions, CustomPaletteSet, CustomTheme, CustomThemes, GeneratedPalettes, GenerateThemeParams } from './theming';
2
+ export declare const assignIfDefined: (target: Record<string, unknown>, key: string, value: unknown) => void;
3
+ /**
4
+ * Maps a legacy palette-based theme to theme-engine seed + overrides.
5
+ *
6
+ * Legacy themes use `palette` (single scheme) or `palettes` (light/dark) with
7
+ * explicit color values. This function translates those values into the dotted
8
+ * token paths that `generateTheme` expects.
9
+ *
10
+ * Mapping reference: https://www.figma.com/design/bUbUpAHJl8xGEtFbpYZ5z3/Theme?node-id=0-1&p=f&m=dev
11
+ */
12
+ export declare const mapLegacyThemeToCustomTheme: (legacyTheme: CustomTheme) => GenerateThemeParams;
13
+ /**
14
+ * Reverse of mapLegacyThemeToCustomTheme.
15
+ * Takes the resolved token maps from a generated theme and maps them back to the
16
+ * legacy CustomPaletteSet shape so that workspace apps still on the legacy theme
17
+ * system can consume them.
18
+ */
19
+ export declare const mapGeneratedPalettesToLegacyPalettes: (generatedPalettes: GeneratedPalettes) => {
20
+ light: CustomPaletteSet;
21
+ dark: CustomPaletteSet;
22
+ };
23
+ export declare const mapLegacyBrandIcons: (legacyBrand: BaseThemeOptions["brand"]) => GenerateThemeParams[1];
24
+ /**
25
+ * Converts legacy CustomThemes (from old workspace platforms v23.0.22 and earlier)
26
+ * into GeneratedPalettes with toCSS() methods and a ready-to-inject palette sheet.
27
+ *
28
+ * This is the backward-compatibility bridge: when a new workspace app (home, dock,
29
+ * storefront) discovers it's running against a legacy platform — detected by
30
+ * `getGeneratedPalettes()` throwing because the channel action doesn't exist —
31
+ * it calls `getThemes()` to retrieve the old-format themes and runs them through
32
+ * this function to produce the same output the new pipeline expects.
33
+ *
34
+ * The conversion mirrors `initialiseStoragePalettes` in client-api-platform but
35
+ * omits storage controller side-effects (setPalettes, setThemePaletteSheet) since
36
+ * those belong to the platform init path, not the workspace app consumption path.
37
+ *
38
+ * Theme shape discrimination:
39
+ * - `palette`: single palette applied to both schemes (legacy single-scheme theme)
40
+ * - `palettes`: explicit light/dark palettes (legacy dual-scheme theme)
41
+ * - `seed`: already a token-based theme (should not reach this path, but handled for safety)
42
+ */
43
+ export declare const convertLegacyThemesToGeneratedPalettes: (themes: CustomThemes | null | undefined) => {
44
+ generatedPalettes: GeneratedPalettes;
45
+ themePaletteSheet: string;
46
+ };
@@ -291,7 +291,21 @@ export declare const OpenFinDarkTheme: {
291
291
  };
292
292
  export declare const DefaultOpenFinTheme: CustomThemes;
293
293
  export declare const parseNotificationIndicatorColors: (customTheme: CustomTheme) => NotificationIndicatorColorsParsed;
294
- export declare const constructThemePaletteSheet: (themes: GeneratedPalettes) => string;
294
+ /**
295
+ * Builds a CSS stylesheet that exposes theme tokens as custom properties.
296
+ *
297
+ * The sheet is written to provider storage and consumed by same-origin pages
298
+ * via an adopted stylesheet. It uses `data-scheme` selectors for dark/system
299
+ * switching, which the new theme-loader sets on the document element.
300
+ *
301
+ * @param legacyVars Optional `--workspace-palette-*` CSS variable strings to
302
+ * merge alongside the new `--color-role-*` variables. When provided, apps on
303
+ * the legacy theme system that read these variables will receive correct values.
304
+ */
305
+ export declare const constructThemePaletteSheet: (themes: GeneratedPalettes, legacyVars?: {
306
+ light: string;
307
+ dark: string;
308
+ }) => string;
295
309
  export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<{
296
310
  theme: CustomThemes | GeneratedPalettes;
297
311
  defaultScheme: ColorSchemeOptionType;
@@ -91,12 +91,6 @@ export declare const generateViewNameAndIdentifierNameIfNotExists: <T extends {
91
91
  */
92
92
  export declare const cloneLayoutAndConvertViewOptions: (layout: PageLayout, initViewOptions?: Partial<OpenFin.ViewOptions>) => Promise<PageLayout>;
93
93
  export declare const cloneViewComponentWithoutName: (componentState: any) => any;
94
- /**
95
- * Deep clones a layout and removes view names.
96
- * @param layout The Layout to be cloned
97
- * @returns A copy of the layout with names removed
98
- */
99
- export declare const cloneLayoutAndRemoveNames: (layout: PageLayout) => any;
100
94
  /**
101
95
  * Deep clones a layout and removes generated view names.
102
96
  * @param layout The Layout to be cloned
@@ -46,18 +46,18 @@
46
46
  }
47
47
  ],
48
48
  "dexie": [
49
- {
50
- "type": "root-implicit",
51
- "version": "^4.0.11",
52
- "packageName": "dock3/package.json",
53
- "issuer": "dock3/src/api/idb.ts"
54
- },
55
49
  {
56
50
  "type": "explicit",
57
51
  "version": "^4.0.11",
58
52
  "packageName": "client-api-platform/package.json",
59
53
  "issuer": "client-api-platform/src/api/dock/idb.ts"
60
54
  },
55
+ {
56
+ "type": "root-implicit",
57
+ "version": "^4.0.11",
58
+ "packageName": "dock3/package.json",
59
+ "issuer": "dock3/src/api/idb.ts"
60
+ },
61
61
  {
62
62
  "type": "explicit",
63
63
  "version": "^4.0.11",