@openfin/workspace-platform 23.1.1 → 23.1.3

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.
@@ -1,4 +1,19 @@
1
+ import { GeneratedPalettes, NotificationIndicatorColorsParsed } from '../../../../common/src/api/theming';
1
2
  import { ThemeStorageController } from '../../../../client-api-platform/src/api/controllers/theme-storage-controller';
2
3
  import { CustomThemes } from '../../../../client-api-platform/src/shapes';
3
- export declare const initialiseStoragePalettes: (customThemes: CustomThemes | undefined, isWindows: boolean) => CustomThemes;
4
+ /**
5
+ * Initialises the storage palettes from the custom themes. This function is called on platform init.
6
+ * This function takes both the legacy themes and the new theme system tokens and
7
+ * passes them into the theme engine to generate the css variables.
8
+ *
9
+ * @param customThemes the custom themes to initialise the storage palettes from.
10
+ * @param isWindows whether the operating system is Windows.
11
+ * @returns the generated palettes fromt the theme engine, theme palette sheet which is injected into the DOM, and legacy theme object if it exists.
12
+ */
13
+ export declare const initialiseStoragePalettes: (customThemes: CustomThemes | undefined, isWindows: boolean) => {
14
+ generatedPalettes: GeneratedPalettes;
15
+ themePaletteSheet: string;
16
+ legacyTheme: CustomThemes | null;
17
+ notificationIndicatorColors: NotificationIndicatorColorsParsed | null;
18
+ };
4
19
  export declare const getThemeStorageController: () => ThemeStorageController;
@@ -1,3 +1,5 @@
1
+ import { GeneratedPalettes } from '../../../../common/src/api/theming';
2
+ import { StorageProxy } from '../../../../client-api-platform/src/api/utils';
1
3
  import { ColorSchemeOptionType, CustomPaletteSet } from '../../../../client-api-platform/src/shapes';
2
4
  /**
3
5
  * Palette extensions can be used to add new variables to the palette set.
@@ -5,48 +7,34 @@ import { ColorSchemeOptionType, CustomPaletteSet } from '../../../../client-api-
5
7
  * This is particularly useful if a value uses a different palette constant depending on scheme.
6
8
  */
7
9
  export declare const getPaletteExtensions: (palette: CustomPaletteSet, paletteScheme: "light" | "dark", isWindows: boolean) => {
8
- dockExpandedContainerBorderColor: string;
9
10
  dockExpandedContainerBorderRadius: string;
10
- dockExpandedContainerBackground: string;
11
11
  fillerBackgroundColor: string;
12
- dockCompanionContainerBackground: string;
13
- dockComponentContainerBackground: string;
14
- styledDropdownActiveBackground: string;
15
- contentMenuWrapperInternalDivBorderColor: string;
16
- contentMenuItemContainerActiveBackground: string;
17
- contentMenuItemContainerHoverBackground: string;
18
- contentMenuHeaderBorderColor: string;
19
- dockCompanionSeparatorBorderColor: string;
20
- dockComponentContainerBorderColor: string;
21
- companionDockButtonActiveBackground: string;
22
- companionDockButtonHoverBackground: string;
23
12
  'computed-scrollbar-thumb-alpha': number;
24
13
  'computed-scrollbar-track-alpha': number;
25
14
  'scrollbar-thumb-rgb': string;
26
15
  'scrollbar-track-rgb': string;
27
16
  selectedTab: string;
28
17
  };
29
- export type Palettes = {
18
+ export type LegacyPalettes = {
30
19
  dark: CustomPaletteSet;
31
20
  light: CustomPaletteSet;
32
21
  };
22
+ export type Palettes = {
23
+ light: string;
24
+ dark: string;
25
+ };
33
26
  export declare class ThemeStorageController {
34
27
  private providerStorage;
35
28
  private darkPaletteVars?;
36
29
  private lightPaletteVars?;
30
+ private themePaletteSheet?;
31
+ private generatedPalettes?;
37
32
  private workspaceStorage?;
38
33
  constructor(providerStorage: Pick<Storage, 'getItem' | 'setItem'>);
39
- private getVarsByScheme;
40
34
  /**
41
35
  * Set the current Storage Proxy to enable Workspace Storage properties to be populated.
42
- *
43
- * Currently, we only support same Storage Based theming for same origin scenarios like EB, where the provider
44
- * is in the same origin as the workspace pages.
45
- *
46
- * A workaround that can be leveraged in cross origin scenarios (which is the majority of the workspace use case) is available in this commit: 233e843cda6cd68968fd5831fb20597e0d5bb7cc
47
- * `git revert 233e843cda6cd68968fd5831fb20597e0d5bb7cc --no-commit`
48
36
  */
49
- setWorkspaceStorage: (proxy: Pick<Storage, "setItem">) => void;
37
+ setWorkspaceStorageProxy: (proxy: StorageProxy) => void;
50
38
  /**
51
39
  * Check if there's an explicit user preference stored in localStorage.
52
40
  * A user preference is indicated by the presence of a SelectedColorScheme key. Which is something assigned if you click on the Appearance dropdown.
@@ -64,7 +52,11 @@ export declare class ThemeStorageController {
64
52
  * to allow workspace UI elements to load the palette before their first paint.
65
53
  * @param palettes Light and Dark Palette constants
66
54
  */
67
- setPalettes: ({ light, dark }: Palettes, isWindows: boolean) => Promise<void>;
55
+ setLegacyPalettes: ({ light, dark }: LegacyPalettes, isWindows: boolean) => Promise<void>;
56
+ setPalettes: ({ light, dark }: {
57
+ light: string;
58
+ dark: string;
59
+ }) => Promise<void>;
68
60
  /**
69
61
  * Set the current scheme of workspace. Specifically setting light or dark
70
62
  * will ignore the OS scheme, whereas 'system' will always respect it.
@@ -78,9 +70,15 @@ export declare class ThemeStorageController {
78
70
  * @param scheme The default scheme specified in the palette
79
71
  */
80
72
  setThemeDefaultScheme(scheme: ColorSchemeOptionType): void;
73
+ setGeneratedPalettes(generatedPalettes: GeneratedPalettes): void;
81
74
  /**
82
75
  * Returns the current scheme
83
76
  * @returns 'light' | 'system' | 'dark'
84
77
  */
85
78
  getScheme(): ColorSchemeOptionType;
79
+ getThemePaletteSheet(): string | undefined;
80
+ getThemePalette(): {
81
+ light: string;
82
+ dark: string;
83
+ };
86
84
  }
@@ -1,5 +1,16 @@
1
1
  import type OpenFin from '@openfin/core';
2
+ import type { CustomTheme, GenerateThemeParams } from '../../../common/src/api/theming';
2
3
  import { ColorSchemeOptionType, ThemeApi } from '../../../client-api-platform/src/shapes';
3
4
  export declare const getThemingApi: (identity: OpenFin.ApplicationIdentity) => ThemeApi;
5
+ export declare const dispatchThemeToWorkspaceProvider: (themeData: {
6
+ themePaletteSheet: string;
7
+ selectedScheme: ColorSchemeOptionType;
8
+ themePalette: {
9
+ light: string;
10
+ dark: string;
11
+ };
12
+ }) => Promise<void>;
4
13
  export declare const setSelectedScheme: (schemeType: ColorSchemeOptionType) => Promise<void>;
5
14
  export declare const getSelectedScheme: () => ColorSchemeOptionType | null | undefined;
15
+ export declare const getThemePaletteSheet: () => string | undefined;
16
+ export declare const mapLegacyThemeToCustomTheme: (legacyTheme: CustomTheme) => GenerateThemeParams;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,6 @@
1
1
  export declare const listenForStoreClose: () => void;
2
+ export type StorageProxy = {
3
+ setItem: (data: string, value: string) => Promise<void>;
4
+ destroy: () => Promise<void>;
5
+ };
6
+ export declare const createStorageProxy: (url: string) => Promise<StorageProxy>;
@@ -1,5 +1,9 @@
1
+ import { GeneratedPalettes, NotificationIndicatorColorsParsed } from '../../../common/src/api/theming';
1
2
  import { CustomThemes } from '../shapes';
2
- export declare const getThemes: () => CustomThemes;
3
+ export declare const getThemes: () => CustomThemes | null;
4
+ export declare const getGeneratedPalettes: () => GeneratedPalettes;
5
+ export declare const getThemePaletteSheet: () => string;
6
+ export declare const getNotificationIndicatorColorsInternal: () => NotificationIndicatorColorsParsed;
3
7
  /**
4
8
  * initTheming()
5
9
  * @param customThemes array of theme objects
@@ -4,7 +4,7 @@ import type { AnalyticsEvent } from '../../common/src/utils/usage-register';
4
4
  import type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
5
5
  import type { AddDefaultPagePayload, AttachedPage, BookmarkNode, CopyPagePayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, Page, PageLayoutsWithSelectedViews, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
6
6
  import type { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
7
- import type { CustomThemes } from '../../common/src/api/theming';
7
+ import type { CustomThemes, GeneratedPalettes } from '../../common/src/api/theming';
8
8
  import type { App, DockProviderConfigWithIdentity, StoreButtonConfig } from '../../client-api/src/shapes';
9
9
  import type { WorkflowIntegration } from '../../client-api/src/shapes/integrations';
10
10
  export * from '../../dock3/src/shapes';
@@ -1478,12 +1478,27 @@ export interface LaunchAppRequest {
1478
1478
  target?: OpenFin.EntityInfo;
1479
1479
  app: App;
1480
1480
  }
1481
- /**
1482
- * Get Themes from API
1483
- */
1484
1481
  export interface ThemeApi {
1485
- getThemes(): Promise<CustomThemes>;
1482
+ /**
1483
+ * @deprecated This method is deprecated. It is recommended to use {@link getGeneratedPalettes} instead.
1484
+ * Get the legacy themes from the platform provider.
1485
+ * @returns the legacy themes or null if the platform provider is using the new theme system.
1486
+ */
1487
+ getThemes(): Promise<CustomThemes | null>;
1488
+ /**
1489
+ * Get the generated palettes from the platform provider.
1490
+ * @returns the generated palettes.
1491
+ */
1492
+ getGeneratedPalettes(): Promise<GeneratedPalettes>;
1493
+ /**
1494
+ * Set the selected scheme for the platform provider.
1495
+ * @param newScheme the new scheme to set.
1496
+ */
1486
1497
  setSelectedScheme(newScheme: ColorSchemeOptionType): Promise<void>;
1498
+ /**
1499
+ * Get the selected scheme from the platform provider.
1500
+ * @returns the selected scheme.
1501
+ */
1487
1502
  getSelectedScheme(): Promise<ColorSchemeOptionType>;
1488
1503
  }
1489
1504
  /**
@@ -85,6 +85,14 @@ type WorkspaceChannelTypes = {
85
85
  'set-search-query': (payload: SearchQueryWithProviderID) => Promise<void>;
86
86
  'assign-home-search-context': (payload: Partial<HomeSearchListenerRequest['context']>) => Promise<void>;
87
87
  'set-selected-scheme': (ctx: ColorSchemeOptionType) => Promise<void>;
88
+ 'initialize-theme': (themeData: {
89
+ themePaletteSheet: string;
90
+ selectedScheme: ColorSchemeOptionType;
91
+ themePalette: {
92
+ light: string;
93
+ dark: string;
94
+ };
95
+ }) => Promise<void>;
88
96
  'get-legacy-pages': () => Promise<Page[]>;
89
97
  'get-legacy-workspaces': (payload: undefined) => Promise<LegacyWorkspace[]>;
90
98
  'register-storefront-provider': () => Promise<void>;
@@ -35,6 +35,8 @@ export declare enum WorkspacePlatformChannelAction {
35
35
  GetLastFocusedBrowserWindow = "getLastFocusedBrowserWindow",
36
36
  GetPageByViewIdentity = "getPageByViewIdentity",
37
37
  GetThemes = "getThemes",
38
+ GetGeneratedPalettes = "getGeneratedPalettes",
39
+ GetThemePaletteSheet = "getThemePaletteSheet",
38
40
  GetSelectedScheme = "getSelectedScheme",
39
41
  SetSelectedScheme = "setSelectedScheme",
40
42
  OpenGlobalContextMenuInternal = "openGlobalContextMenuInternal",
@@ -93,7 +95,8 @@ export declare enum WorkspacePlatformChannelAction {
93
95
  AddDockFavoriteInternal = "addDockFavoriteInternal",// Enterprise
94
96
  FocusAndExpandSearchInternal = "focusAndExpandSearchInternal",// Enterprise
95
97
  SendUpdateVersionModalResponseInternal = "sendUpdateVersionModalResponseInternal",// Enterprise
96
- ShowUpdateVersionModalInternal = "showUpdateVersionModalInternal"
98
+ ShowUpdateVersionModalInternal = "showUpdateVersionModalInternal",// Enterprise
99
+ GetNotificationIndicatorColorsInternal = "getNotificationIndicatorColorsInternal"
97
100
  }
98
101
  export type PlatFormSupportedFeatures = boolean | {
99
102
  isWorkspacePlatform: boolean;
@@ -19,8 +19,8 @@ export declare const launchProvider: () => Promise<void>;
19
19
  */
20
20
  export declare const getChannelClientAndLaunchProvider: () => Promise<WorkspaceComponentChannelClient>;
21
21
  /**
22
- * Launches the Workspace provider if it is not running.
22
+ * Gets the theme data from the Platform provider, then launches the Workspace provider if it is not running, and then dispatches the theme data to the Workspace provider.
23
23
  * Then gets a Channel Client that is connected to the Workspace Provider.
24
24
  * @returns the Channel Client that is connected to the Workspace Provider.
25
25
  */
26
- export declare const getClientAPIChannelClientAndLaunchProvider: () => Promise<WorkspaceAPIClientChannelClient>;
26
+ export declare const getChannelClientAndInitializeWorkspaceProvider: () => Promise<WorkspaceAPIClientChannelClient>;
@@ -1,8 +1,13 @@
1
1
  import type { DefaultTheme } from 'styled-components';
2
2
  import type OpenFin from '@openfin/core';
3
3
  import type { ColorSchemeType, ThemeSet } from '@openfin/ui-library';
4
- import { Palette } from '@openfin/ui-library/dist/theme';
5
4
  import { ColorSchemeOptionType } from '../../../client-api-platform/src/shapes';
5
+ import type { generateTheme } from '@openfin/theme-engine';
6
+ export declare const ColorScheme: {
7
+ light: string;
8
+ dark: string;
9
+ system: string;
10
+ };
6
11
  export type WorkspaceComponentSetSelectedSchemePayload = {
7
12
  newScheme: ColorSchemeOptionType;
8
13
  identity: OpenFin.Identity;
@@ -35,6 +40,13 @@ export interface NotificationIndicatorColorsSetLightScheme {
35
40
  dark?: NotificationIndicatorColorsSet;
36
41
  light: NotificationIndicatorColorsSet;
37
42
  }
43
+ export type NotificationIndicatorColors = Record<string, Omit<NotificationIndicatorColorsSet, 'foreground'> & {
44
+ foreground: string;
45
+ }>;
46
+ export type NotificationIndicatorColorsParsed = {
47
+ dark: NotificationIndicatorColors;
48
+ light: NotificationIndicatorColors;
49
+ };
38
50
  export type NotificationIndicatorColorsWithScheme = Record<string, NotificationIndicatorColorsSetDarkScheme | NotificationIndicatorColorsSetLightScheme>;
39
51
  export interface BaseThemeOptions {
40
52
  label: string;
@@ -65,7 +77,7 @@ export type CustomThemeOptions = BaseThemeOptions & {
65
77
  * };
66
78
  * ```
67
79
  */
68
- notificationIndicatorColors?: Record<string, NotificationIndicatorColorsSet>;
80
+ notificationIndicatorColors?: NotificationIndicatorColors;
69
81
  };
70
82
  export type CustomThemeOptionsWithScheme = BaseThemeOptions & {
71
83
  /**
@@ -121,10 +133,22 @@ export type CustomThemeOptionsWithScheme = BaseThemeOptions & {
121
133
  */
122
134
  notificationIndicatorColors?: NotificationIndicatorColorsWithScheme;
123
135
  };
124
- export type CustomThemes = (CustomThemeOptions | CustomThemeOptionsWithScheme)[];
136
+ export type ThemeOptions = BaseThemeOptions & {
137
+ seed: Parameters<typeof generateTheme>[0];
138
+ overrides?: Parameters<typeof generateTheme>[1];
139
+ } & {
140
+ notificationIndicatorColors?: NotificationIndicatorColorsWithScheme | NotificationIndicatorColors;
141
+ };
142
+ type GenerateThemeReturn = ReturnType<typeof generateTheme>;
143
+ export type GeneratedPalettes = Pick<GenerateThemeReturn, 'dark' | 'light'>;
144
+ export type LegacyPalettes = CustomThemeOptions | CustomThemeOptionsWithScheme;
145
+ export type GenerateThemeParams = Parameters<typeof generateTheme>;
146
+ export type CustomTheme = CustomThemeOptions | CustomThemeOptionsWithScheme | ThemeOptions;
147
+ export type CustomThemes = CustomTheme[];
125
148
  export interface PreloadedThemeData {
126
- themes: CustomThemes;
149
+ themes: CustomThemes | GeneratedPalettes;
127
150
  selectedScheme: ColorSchemeOptionType;
151
+ themePaletteSheet?: string;
128
152
  }
129
153
  export interface DefaultPaletteSet {
130
154
  brandPrimary: string;
@@ -265,16 +289,13 @@ export declare const OpenFinDarkTheme: {
265
289
  borderNeutral: "#C0C1C2";
266
290
  };
267
291
  export declare const DefaultOpenFinTheme: CustomThemes;
268
- export declare const getComputedPaletteSets: (customTheme: CustomThemeOptions | CustomThemeOptionsWithScheme) => WorkspaceThemeSet;
269
- /**
270
- * Transforms input {@link CustomThemes} to {@link ComputedThemes} used by Workspace Platform / Notifications Platform.
271
- *
272
- * @param customThemes array of themes to transform
273
- * @param storedScheme sets the default scheme if provided
274
- * @returns array of {@link ComputedThemes | computed themes}
275
- */
276
- export declare const computeThemes: (customThemes: CustomThemes, storedScheme?: ColorSchemeOptionType) => ComputedThemes;
277
- export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<ComputedTheme>;
292
+ export declare const parseNotificationIndicatorColors: (customTheme: CustomTheme) => NotificationIndicatorColorsParsed;
293
+ export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<{
294
+ theme: CustomThemes | GeneratedPalettes;
295
+ defaultScheme: ColorSchemeOptionType;
296
+ }>;
278
297
  export declare const setSelectedScheme: (ctx: ColorSchemeOptionType) => Promise<void>;
279
298
  export declare const getComputedScheme: (identity?: OpenFin.Identity) => Promise<Exclude<ColorSchemeType, "system">>;
280
- export declare const getComputedBackgroundColor: (paletteKey: keyof typeof Palette, defaultColor?: string) => Promise<string>;
299
+ export declare const getComputedBackgroundColor: (platformIdentity: OpenFin.Identity) => Promise<string>;
300
+ export declare const constructThemePaletteSheet: (themes: GeneratedPalettes) => string;
301
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { EnterpriseMainContextMenuItemData, EnterpriseMainContextMenuItemTemplate, OpenGlobalContextMenuPayload } from '../../../client-api-platform/src/shapes';
3
- export declare const getEnterpriseContextMenuTemplate: ({ identity, selectedViews }: {
3
+ export declare const getEnterpriseContextMenuTemplate: ({ identity }: {
4
4
  identity: OpenFin.Identity;
5
5
  selectedViews: OpenFin.Identity[];
6
6
  }) => Promise<EnterpriseMainContextMenuItemTemplate[]>;
@@ -1,4 +1,5 @@
1
+ import LocalStorageKey from './local-storage-key';
2
+ export declare const setItem: (key: LocalStorageKey, value: string) => void;
3
+ export declare const getItem: (key: LocalStorageKey) => string;
4
+ export declare const removeItem: (key: LocalStorageKey) => void;
1
5
  export declare const createNamespacedLocalStorage: <TKey extends string>(namespace: string) => Pick<Storage, "setItem" | "getItem" | "removeItem">;
2
- export declare const setItem: (key: string, value: string) => void;
3
- export declare const getItem: (key: string) => string | null;
4
- export declare const removeItem: (key: string) => void;
@@ -29,6 +29,7 @@ declare enum BrowserRoute {
29
29
  EnterpriseContextMenu = "/context-menu/",
30
30
  EnterpriseBookmarkDialog = "/bookmark-dialog/",
31
31
  EnterpriseAboutPage = "/popup-menu/about/",
32
+ StorageProxy = "/browser/storage-proxy",
32
33
  DropdownMenu = "/dropdown-menu/",
33
34
  EnterpriseDock = "/dock/",
34
35
  ZoomControlsDialog = "/zoom-controls-dialog/",
@@ -51,6 +52,7 @@ declare const PageRoute: {
51
52
  EnterpriseContextMenu: BrowserRoute.EnterpriseContextMenu;
52
53
  EnterpriseBookmarkDialog: BrowserRoute.EnterpriseBookmarkDialog;
53
54
  EnterpriseAboutPage: BrowserRoute.EnterpriseAboutPage;
55
+ StorageProxy: BrowserRoute.StorageProxy;
54
56
  DropdownMenu: BrowserRoute.DropdownMenu;
55
57
  EnterpriseDock: BrowserRoute.EnterpriseDock;
56
58
  ZoomControlsDialog: BrowserRoute.ZoomControlsDialog;