@openfin/workspace 23.2.17 → 23.2.19

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.
@@ -2,6 +2,11 @@ import * as Notifications from '@openfin/notifications';
2
2
  import type { NotificationsPlatform, NotificationsRegisterOptions } from './shapes/notifications';
3
3
  export * from '@openfin/notifications';
4
4
  export * from './shapes/notifications';
5
+ /**
6
+ * Notifications Center <= 2.13 expects a legacy NotificationsThemeSet object.
7
+ * Versions >= 2.14 supports detailed theming.
8
+ */
9
+ export declare const isLegacyNotifications: (version: string) => boolean;
5
10
  /**
6
11
  * @deprecated Use `register` with {@link NotificationsRegisterOptions | options?: NotificationsRegisterOptions} argument instead.
7
12
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -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
@@ -99,12 +106,17 @@ export declare class ThemeStorageController {
99
106
  * @param scheme The default scheme specified in the palette
100
107
  */
101
108
  setThemeDefaultScheme(scheme: ColorSchemeOptionType): void;
102
- setGeneratedPalettes(generatedPalettes: GeneratedPalettes): void;
103
109
  /**
104
110
  * Returns the current scheme
105
111
  * @returns 'light' | 'system' | 'dark'
106
112
  */
107
113
  getScheme(): ColorSchemeOptionType;
114
+ /**
115
+ * Write the theme palette sheet to both in-memory state and providerStorage (namespaced localStorage)
116
+ * immediately. This ensures the theme is available for themeLoader on same-origin pages
117
+ * before the workspace storage proxy is ready.
118
+ */
119
+ setThemePaletteSheet(sheet: string): void;
108
120
  getThemePaletteSheet(): string | undefined;
109
121
  getThemePalette(): {
110
122
  light: string;
@@ -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;
@@ -15,5 +15,9 @@ export declare const getSelectedScheme: () => ColorSchemeOptionType | null | und
15
15
  /** @internal */
16
16
  export declare const getIsLegacySinglePaletteTheme: () => boolean;
17
17
  export declare const getThemePaletteSheet: () => string | undefined;
18
- export declare const mapLegacyThemeToCustomTheme: (legacyTheme: CustomTheme) => GenerateThemeParams;
19
- export declare const mapLegacyBrandIcons: (legacyBrand: BaseThemeOptions["brand"]) => GenerateThemeParams[1];
18
+ export { assignIfDefined, mapGeneratedPalettesToLegacyPalettes, mapLegacyBrandIcons, mapLegacyThemeToCustomTheme } from '../../../common/src/api/theme-migration';
19
+ /**
20
+ * Builds a legacy NotificationsThemeSet from generated palettes and indicator colors.
21
+ * Used by the provider-side handler to serve old Notification Center versions (<=2.13).
22
+ */
23
+ 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
  *
@@ -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
  /**
8
9
  * initTheming()
9
10
  * @param customThemes array of theme objects
@@ -809,6 +809,13 @@ export interface BrowserWorkspacePlatformWindowOptions {
809
809
  * When true, disables the ability to close pages in the window. False by default.
810
810
  */
811
811
  preventPageClose?: boolean;
812
+ /**
813
+ * When true, disables the find in page feature for the window.
814
+ * The find in page view will not be created and no find in page logic will run.
815
+ * This option must be set at window creation time and cannot be changed dynamically.
816
+ * False by default.
817
+ */
818
+ disableFindInPage?: boolean;
812
819
  /**
813
820
  * Taskbar Icon for the Browser Window. If light and dark icon are defined, then the taskbar icon will change when the scheme changes.
814
821
  */
@@ -1818,6 +1825,33 @@ export interface ThemeApi {
1818
1825
  * @returns the notification indicator colors.
1819
1826
  */
1820
1827
  getNotificationIndicatorColorsInternal(): Promise<NotificationIndicatorColorsParsed | null>;
1828
+ /**
1829
+ * @internal
1830
+ * Build a legacy NotificationsThemeSet from the current generated palettes.
1831
+ * Used for backwards compatibility with older Notification Center versions
1832
+ * that do not support detailed theming.
1833
+ */
1834
+ getLegacyNotificationsThemeInternal(): Promise<LegacyNotificationsThemeSet | null>;
1835
+ }
1836
+ /**
1837
+ * @internal
1838
+ * Legacy theme format expected by Notification Center <= 2.13.
1839
+ * Each scheme contains a styled-components DefaultTheme-compatible object
1840
+ * with optional embedded notification indicator colors.
1841
+ */
1842
+ export interface LegacyNotificationsThemeSet {
1843
+ light: Record<string, unknown> & {
1844
+ notificationIndicatorColors?: Record<string, {
1845
+ background: string;
1846
+ foreground: string;
1847
+ }>;
1848
+ };
1849
+ dark: Record<string, unknown> & {
1850
+ notificationIndicatorColors?: Record<string, {
1851
+ background: string;
1852
+ foreground: string;
1853
+ }>;
1854
+ };
1821
1855
  }
1822
1856
  /**
1823
1857
  * Controller for a Workspace Platform.
@@ -2823,7 +2857,6 @@ export type WorkspacePlatformOverrideCallback = OpenFin.OverrideCallback<Workspa
2823
2857
  export type BrowserOverrideCallback = WorkspacePlatformOverrideCallback;
2824
2858
  /**
2825
2859
  * Content menu entry shape cloned and re-exported from UI Library.
2826
- * @internal
2827
2860
  */
2828
2861
  export type ContentMenuEntry = {
2829
2862
  bookmarked?: boolean;
@@ -2851,7 +2884,6 @@ export type BookmarkDockEntryPayload = {
2851
2884
  };
2852
2885
  /**
2853
2886
  * Represents dock entry for favorites
2854
- * @internal
2855
2887
  */
2856
2888
  export type DockEntry = {
2857
2889
  type: 'folder';
@@ -98,7 +98,9 @@ export declare enum WorkspacePlatformChannelAction {
98
98
  ShowUpdateVersionModalInternal = "showUpdateVersionModalInternal",// Enterprise
99
99
  GetNotificationIndicatorColorsInternal = "getNotificationIndicatorColorsInternal",// Custom Notification Indicators Colors
100
100
  /** @internal */
101
- GetIsLegacySinglePaletteTheme = "getIsLegacySinglePaletteTheme"
101
+ GetIsLegacySinglePaletteTheme = "getIsLegacySinglePaletteTheme",
102
+ /** @internal */
103
+ GetLegacyNotificationsThemeInternal = "getLegacyNotificationsThemeInternal"
102
104
  }
103
105
  export type PlatFormSupportedFeatures = boolean | {
104
106
  isWorkspacePlatform: boolean;
@@ -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
+ };
@@ -315,7 +315,21 @@ export declare const OpenFinDarkTheme: {
315
315
  };
316
316
  export declare const DefaultOpenFinTheme: CustomThemes;
317
317
  export declare const parseNotificationIndicatorColors: (customTheme: CustomTheme) => NotificationIndicatorColorsParsed;
318
- export declare const constructThemePaletteSheet: (themes: GeneratedPalettes) => string;
318
+ /**
319
+ * Builds a CSS stylesheet that exposes theme tokens as custom properties.
320
+ *
321
+ * The sheet is written to provider storage and consumed by same-origin pages
322
+ * via an adopted stylesheet. It uses `data-scheme` selectors for dark/system
323
+ * switching, which the new theme-loader sets on the document element.
324
+ *
325
+ * @param legacyVars Optional `--workspace-palette-*` CSS variable strings to
326
+ * merge alongside the new `--color-role-*` variables. When provided, apps on
327
+ * the legacy theme system that read these variables will receive correct values.
328
+ */
329
+ export declare const constructThemePaletteSheet: (themes: GeneratedPalettes, legacyVars?: {
330
+ light: string;
331
+ dark: string;
332
+ }) => string;
319
333
  export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<{
320
334
  theme: GeneratedPalettes | CustomThemes;
321
335
  defaultScheme: ColorSchemeOptionType;
@@ -2,7 +2,7 @@
2
2
  "@openfin/notifications": [
3
3
  {
4
4
  "type": "explicit",
5
- "version": "2.14.1",
5
+ "version": "2.14.2",
6
6
  "packageName": "client-api/package.json",
7
7
  "issuer": "client-api/src/notifications.ts"
8
8
  }
@@ -43,37 +43,31 @@
43
43
  "issuer": "common/src/utils/layout.ts"
44
44
  }
45
45
  ],
46
- "react-i18next": [
46
+ "lodash.clonedeep": [
47
47
  {
48
48
  "type": "root-implicit",
49
- "version": "15.4.0",
49
+ "version": "4.5.0",
50
50
  "packageName": "common/package.json",
51
- "issuer": "common/src/api/i18next.ts"
51
+ "issuer": "common/src/utils/layout.ts"
52
52
  }
53
53
  ],
54
- "i18next": [
54
+ "react-i18next": [
55
55
  {
56
56
  "type": "root-implicit",
57
- "version": "^23.7.16",
57
+ "version": "15.4.0",
58
58
  "packageName": "common/package.json",
59
59
  "issuer": "common/src/api/i18next.ts"
60
60
  }
61
61
  ],
62
- "lodash.clonedeep": [
62
+ "i18next": [
63
63
  {
64
64
  "type": "root-implicit",
65
- "version": "4.5.0",
65
+ "version": "^23.7.16",
66
66
  "packageName": "common/package.json",
67
- "issuer": "common/src/utils/layout.ts"
67
+ "issuer": "common/src/api/i18next.ts"
68
68
  }
69
69
  ],
70
70
  "dexie": [
71
- {
72
- "type": "root-implicit",
73
- "version": "^4.0.11",
74
- "packageName": "common/package.json",
75
- "issuer": "common/src/api/pages/idb.ts"
76
- },
77
71
  {
78
72
  "type": "root-implicit",
79
73
  "version": "^4.0.11",
@@ -86,6 +80,12 @@
86
80
  "packageName": "client-api-platform/package.json",
87
81
  "issuer": "client-api-platform/src/api/dock/idb.ts"
88
82
  },
83
+ {
84
+ "type": "root-implicit",
85
+ "version": "^4.0.11",
86
+ "packageName": "common/package.json",
87
+ "issuer": "common/src/api/pages/idb.ts"
88
+ },
89
89
  {
90
90
  "type": "root-implicit",
91
91
  "version": "^4.0.11",