@openfin/workspace-platform 24.1.5 → 24.1.6-alpha.5c686d8c
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.
- package/client-api/src/internal/providers.d.ts +4 -3
- package/client-api-platform/src/api/controllers/theme-storage-controller-store.d.ts +8 -0
- package/client-api-platform/src/api/controllers/theme-storage-controller.d.ts +19 -3
- package/client-api-platform/src/api/theming.d.ts +8 -4
- package/client-api-platform/src/init/override-callback/commands.d.ts +6 -0
- package/client-api-platform/src/init/override-callback/snapshot.page-tab-groups.test.d.ts +1 -0
- package/client-api-platform/src/init/panels.d.ts +8 -1
- package/client-api-platform/src/init/theming.d.ts +2 -1
- package/client-api-platform/src/init/view-tab-new-tab-shortcut-usage.d.ts +2 -0
- package/client-api-platform/src/shapes.d.ts +6 -2
- package/common/src/api/pages/enterprise-shapes.d.ts +4 -0
- package/common/src/api/pages/shapes.d.ts +10 -2
- package/common/src/api/theme-migration.d.ts +46 -0
- package/common/src/api/theming.d.ts +16 -2
- package/common/src/errors/AppError.d.ts +37 -0
- package/common/src/errors/errors.d.ts +23 -0
- package/common/src/errors/index.d.ts +6 -0
- package/common/src/errors/result.d.ts +23 -0
- package/common/src/errors/toAppError.d.ts +14 -0
- package/common/src/utils/layout.d.ts +9 -6
- package/common/src/utils/menu-window-provider.d.ts +1 -1
- package/common/src/utils/popup-window.d.ts +23 -4
- package/common/src/utils/usage-register.d.ts +13 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/workspace_platform.zip +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PlatformError } from '../../../common/src/errors';
|
|
1
2
|
import { ProviderType } from '../../../common/src/api/provider';
|
|
2
3
|
/**
|
|
3
4
|
* Error thrown when attempting to use a provider that is not registered.
|
|
@@ -7,7 +8,7 @@ import { ProviderType } from '../../../common/src/api/provider';
|
|
|
7
8
|
* // Error: Dock Provider. Dock Provider with id my-dock-id is not currently registered.
|
|
8
9
|
* ```
|
|
9
10
|
*/
|
|
10
|
-
export declare class ProviderNotRegisteredError extends
|
|
11
|
+
export declare class ProviderNotRegisteredError extends PlatformError {
|
|
11
12
|
constructor(providerType: ProviderType, id?: string);
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -19,7 +20,7 @@ export declare class ProviderNotRegisteredError extends Error {
|
|
|
19
20
|
* // Error: Home Provider. Home Provider with id my-home-id is already registered.
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
22
|
-
export declare class ProviderAlreadyRegisteredError extends
|
|
23
|
+
export declare class ProviderAlreadyRegisteredError extends PlatformError {
|
|
23
24
|
constructor(providerType: ProviderType, id?: string);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
@@ -31,7 +32,7 @@ export declare class ProviderAlreadyRegisteredError extends Error {
|
|
|
31
32
|
* // Error: Failed to get Storefront Provider. Storefront Provider with id unknown-id is not currently registered.
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
export declare class FailedToGetProviderError extends
|
|
35
|
+
export declare class FailedToGetProviderError extends PlatformError {
|
|
35
36
|
constructor(providerType: ProviderType, id?: string);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
@@ -23,6 +23,14 @@ export declare const getThemeStorageController: () => ThemeStorageController;
|
|
|
23
23
|
* @param allowFailure Whether to suppress rejections and continue anyway. Recommended for most use cases.
|
|
24
24
|
*/
|
|
25
25
|
export declare const waitForFirstThemeSync: (allowFailure?: boolean) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether `initialiseThemeController` has run in this module instance. Callers that gate on
|
|
28
|
+
* `waitForFirstThemeSync` must check this first: `firstThemeSync` is module-level state, so a
|
|
29
|
+
* separately-bundled copy of this module (e.g. `@openfin/enterprise-api`, which bundles its own
|
|
30
|
+
* copy alongside the customer's `@openfin/workspace-platform`) has a promise that nothing will
|
|
31
|
+
* ever settle — awaiting it would hang forever.
|
|
32
|
+
*/
|
|
33
|
+
export declare const isThemeControllerInitialised: () => boolean;
|
|
26
34
|
/**
|
|
27
35
|
* Creates and initialises the Theme Storage Controller singleton.
|
|
28
36
|
*
|
|
@@ -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,13 +26,21 @@ 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 {
|
|
27
39
|
#private;
|
|
28
40
|
private providerStorage;
|
|
29
41
|
private darkPaletteVars?;
|
|
30
42
|
private lightPaletteVars?;
|
|
31
43
|
private themePaletteSheet?;
|
|
32
|
-
private generatedPalettes?;
|
|
33
44
|
private workspaceStorage?;
|
|
34
45
|
private storageFactory?;
|
|
35
46
|
private isLegacySinglePaletteTheme;
|
|
@@ -56,6 +67,12 @@ export declare class ThemeStorageController {
|
|
|
56
67
|
/**
|
|
57
68
|
* Synchronize the current palette and scheme with workspace's storage instance if
|
|
58
69
|
* storage based theming is enabled.
|
|
70
|
+
*
|
|
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`.
|
|
59
76
|
*/
|
|
60
77
|
synchronizeWorkspaceStorage: () => Promise<void>;
|
|
61
78
|
/**
|
|
@@ -87,7 +104,6 @@ export declare class ThemeStorageController {
|
|
|
87
104
|
* @param scheme The default scheme specified in the palette
|
|
88
105
|
*/
|
|
89
106
|
setThemeDefaultScheme(scheme: ColorSchemeOptionType): void;
|
|
90
|
-
setGeneratedPalettes(generatedPalettes: GeneratedPalettes): void;
|
|
91
107
|
/**
|
|
92
108
|
* Write the theme palette sheet to both in-memory state and providerStorage (namespaced localStorage)
|
|
93
109
|
* immediately. This ensures the theme is available for themeLoader on same-origin pages
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
|
-
import type {
|
|
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
|
|
17
|
-
|
|
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>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type OpenFin from '@openfin/core';
|
|
2
|
+
export declare const KEYBOARD_COMMANDS: {
|
|
3
|
+
readonly NEW_TAB: "workspace.newTab";
|
|
4
|
+
readonly FIND_IN_PAGE: "findInPage.show";
|
|
5
|
+
};
|
|
6
|
+
export declare const getKeyboardCommands: (superGetKeyboardCommands: () => OpenFin.ShortcutOverride[]) => OpenFin.ShortcutOverride[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
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()
|
|
@@ -12,7 +12,7 @@ export * from '../../dock3/src/shapes';
|
|
|
12
12
|
export { AppManifestType } from '../../client-api/src/shapes';
|
|
13
13
|
export type { App, AppIntent, Image } from '../../client-api/src/shapes';
|
|
14
14
|
export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
|
|
15
|
-
export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
|
|
15
|
+
export type { AttachedPage, Page, PagePinnedState, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
|
|
16
16
|
export { PanelPosition } from '../../common/src/api/pages/shapes';
|
|
17
17
|
export type { CustomThemes, CustomThemeOptions, ThemeOptions, CustomThemeOptionsWithScheme, CustomPaletteSet, BaseThemeOptions, ThemeExtension, WorkspaceThemeSet, NotificationIndicatorColorsSet, NotificationIndicatorColorsSetDarkScheme, NotificationIndicatorColorsSetLightScheme, NotificationIndicatorColorsWithScheme } from '../../common/src/api/theming';
|
|
18
18
|
export type { AnalyticsEvent } from '../../common/src/utils/usage-register';
|
|
@@ -155,7 +155,11 @@ export declare enum PageTabContextMenuOptionType {
|
|
|
155
155
|
Rename = "Rename",
|
|
156
156
|
Save = "Save",
|
|
157
157
|
SaveAs = "Save As",
|
|
158
|
-
NewPage = "New Page"
|
|
158
|
+
NewPage = "New Page",
|
|
159
|
+
/** Workspace Browser: pin a normal tab (sets `pinned: 'user'`). */
|
|
160
|
+
Pin = "Pin",
|
|
161
|
+
/** Workspace Browser: unpin a user-pinned tab (clears `pinned`). */
|
|
162
|
+
Unpin = "Unpin",// Enterprise
|
|
159
163
|
DeletePage = "Delete Page",// Enterprise
|
|
160
164
|
SaveWorkspaceAs = "SaveWorkspaceAs",// Enterprise
|
|
161
165
|
Refresh = "Refresh",// Enterprise
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OpenFin } from '@openfin/core';
|
|
2
2
|
import { ExtendedPanelConfig, PageLayout, PanelConfig } from '../../../../client-api-platform/src/index';
|
|
3
|
+
import type { PagePinnedState } from '../../../../common/src/api/pages/shapes';
|
|
3
4
|
export interface Page {
|
|
4
5
|
/** A UI friendly title for the page. */
|
|
5
6
|
title: string;
|
|
@@ -21,6 +22,9 @@ export interface Page {
|
|
|
21
22
|
layout: PageLayout;
|
|
22
23
|
/** True if the page is locked. */
|
|
23
24
|
isLocked?: boolean;
|
|
25
|
+
/** Not used by enterprise — page pinning is a workspace-only feature. Declared here because
|
|
26
|
+
* shared code (page-tab-context-menu.ts) casts to AttachedPageInternal and accesses this field. */
|
|
27
|
+
pinned?: PagePinnedState;
|
|
24
28
|
/** Used to manipulate behaviour of a close button on a page tab. If `undefined`, then close button is visible and actionable.
|
|
25
29
|
* If either property true, this page tab's context menu will disable its 'Close Page' option.
|
|
26
30
|
*/
|
|
@@ -12,6 +12,8 @@ export interface PageLayoutDetails {
|
|
|
12
12
|
export type PageLayout = OpenFin.LayoutOptions & {
|
|
13
13
|
layoutDetails?: PageLayoutDetails;
|
|
14
14
|
};
|
|
15
|
+
/** The pinned state of a page tab. `'platform'` = developer-locked; `'user'` = end-user pinned. */
|
|
16
|
+
export type PagePinnedState = 'platform' | 'user';
|
|
15
17
|
/**
|
|
16
18
|
* Provides configuration options for a set of Workspace Views. An array of Page objects is a required option of the {@link workspacePlatform}
|
|
17
19
|
* property of the {@link BrowserCreateWindowRequest} interface.
|
|
@@ -62,6 +64,8 @@ export interface Page {
|
|
|
62
64
|
layout: PageLayout;
|
|
63
65
|
/** True if the page is locked. */
|
|
64
66
|
isLocked?: boolean;
|
|
67
|
+
/** Pinned state: `'platform'` (developer-locked), `'user'` (end-user pinned), or omitted (normal). */
|
|
68
|
+
pinned?: PagePinnedState;
|
|
65
69
|
/** Used to manipulate behaviour of a close button on a page tab. If `undefined`, then close button is visible and actionable.
|
|
66
70
|
* If either property true, this page tab's context menu will disable its 'Close Page' option.
|
|
67
71
|
*/
|
|
@@ -124,17 +128,21 @@ export interface ReorderPagesForWindowPayload {
|
|
|
124
128
|
/** The ordered ids of the attached pages. */
|
|
125
129
|
pageIds: string[];
|
|
126
130
|
}
|
|
131
|
+
/** Page fields for update payloads. `null` signals "clear this field" over IPC (null survives JSON serialization, undefined does not). */
|
|
132
|
+
type PageUpdateNullableOverrides = {
|
|
133
|
+
pinned?: PagePinnedState | null;
|
|
134
|
+
};
|
|
127
135
|
export interface UpdatePageForWindowPayload {
|
|
128
136
|
/** The OF window identity the pages to change the order of. */
|
|
129
137
|
identity: OpenFin.Identity;
|
|
130
138
|
/** The id of the attached page to update. */
|
|
131
139
|
pageId: string;
|
|
132
140
|
/** The partial updated state of the page. */
|
|
133
|
-
page: Partial<PageWithUpdatableRuntimeAttribs
|
|
141
|
+
page: Omit<Partial<PageWithUpdatableRuntimeAttribs>, 'pinned'> & PageUpdateNullableOverrides;
|
|
134
142
|
}
|
|
135
143
|
export interface ExtendedUpdatePageForWindowPayload extends UpdatePageForWindowPayload {
|
|
136
144
|
/** The partial updated state of the page. */
|
|
137
|
-
page: Partial<AttachedPage
|
|
145
|
+
page: Omit<Partial<AttachedPage>, 'pinned'> & PageUpdateNullableOverrides;
|
|
138
146
|
}
|
|
139
147
|
export interface AttachPagesToWindowPayload {
|
|
140
148
|
/** The OF window identity to attach the pages to. */
|
|
@@ -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,9 +291,23 @@ export declare const OpenFinDarkTheme: {
|
|
|
291
291
|
};
|
|
292
292
|
export declare const DefaultOpenFinTheme: CustomThemes;
|
|
293
293
|
export declare const parseNotificationIndicatorColors: (customTheme: CustomTheme) => NotificationIndicatorColorsParsed;
|
|
294
|
-
|
|
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
|
-
theme:
|
|
310
|
+
theme: GeneratedPalettes | CustomThemes;
|
|
297
311
|
defaultScheme: ColorSchemeOptionType;
|
|
298
312
|
themePaletteSheet: string;
|
|
299
313
|
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppError — base class for all application errors.
|
|
3
|
+
*
|
|
4
|
+
* Use a subclass (NetworkError, PlatformError, etc.) — never instantiate AppError directly
|
|
5
|
+
* in production code. The class identity (`error.name`) is the category; `context` carries
|
|
6
|
+
* the specifics; `cause` chains the underlying error.
|
|
7
|
+
*
|
|
8
|
+
* `instanceof` is the supported way to branch on error type. `toJSON()` is what the
|
|
9
|
+
* existing logger's safeStringify uses to produce structured output, so logging an
|
|
10
|
+
* AppError preserves the full chain automatically.
|
|
11
|
+
*/
|
|
12
|
+
export interface ErrorContext {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface SerializedError {
|
|
16
|
+
name: string;
|
|
17
|
+
message: string;
|
|
18
|
+
context: ErrorContext;
|
|
19
|
+
stack?: string;
|
|
20
|
+
cause?: SerializedError;
|
|
21
|
+
timestamp: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AppErrorOptions {
|
|
24
|
+
cause?: unknown;
|
|
25
|
+
context?: ErrorContext;
|
|
26
|
+
}
|
|
27
|
+
export declare class AppError extends Error {
|
|
28
|
+
readonly context: ErrorContext;
|
|
29
|
+
readonly timestamp: Date;
|
|
30
|
+
constructor(message: string, options?: AppErrorOptions);
|
|
31
|
+
serialize(): SerializedError;
|
|
32
|
+
/**
|
|
33
|
+
* Called automatically by JSON.stringify so `safeStringify({ error })` in the logger
|
|
34
|
+
* produces the full structured form without any logger changes.
|
|
35
|
+
*/
|
|
36
|
+
toJSON(): SerializedError;
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppError, AppErrorOptions } from './AppError';
|
|
2
|
+
/** Put `{ url, status, method, timeoutMs }` in context as relevant. */
|
|
3
|
+
export declare class NetworkError extends AppError {
|
|
4
|
+
}
|
|
5
|
+
/** Put `{ field, received, expected }` in context. */
|
|
6
|
+
export declare class ValidationError extends AppError {
|
|
7
|
+
}
|
|
8
|
+
/** Put `{ status, scope, userId }` in context as available. */
|
|
9
|
+
export declare class AuthError extends AppError {
|
|
10
|
+
}
|
|
11
|
+
/** OpenFin / runtime / channel / provider failures. Put `{ providerId, channelName, identity }` in context. */
|
|
12
|
+
export declare class PlatformError extends AppError {
|
|
13
|
+
}
|
|
14
|
+
/** Read/write failures against persistent storage. Put `{ key, operation }` in context. */
|
|
15
|
+
export declare class StorageError extends AppError {
|
|
16
|
+
}
|
|
17
|
+
/** Bad or missing configuration discovered at runtime. Put `{ configKey, env }` in context. */
|
|
18
|
+
export declare class ConfigError extends AppError {
|
|
19
|
+
}
|
|
20
|
+
/** Catch-all. Prefer creating via `toAppError(unknown)` rather than directly. */
|
|
21
|
+
export declare class UnknownError extends AppError {
|
|
22
|
+
}
|
|
23
|
+
export type { AppErrorOptions };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AppError } from './AppError';
|
|
2
|
+
export type { AppErrorOptions, ErrorContext, SerializedError } from './AppError';
|
|
3
|
+
export { NetworkError, ValidationError, AuthError, PlatformError, StorageError, ConfigError, UnknownError } from './errors';
|
|
4
|
+
export { toAppError } from './toAppError';
|
|
5
|
+
export { ok, err, isOk, isErr, unwrap, mapResult } from './result';
|
|
6
|
+
export type { Ok, Err, Result } from './result';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppError } from './AppError';
|
|
2
|
+
/**
|
|
3
|
+
* Result<T, E> — opt-in alternative to throwing for operations whose callers
|
|
4
|
+
* genuinely need to branch on success vs failure (e.g., a save that has a clear
|
|
5
|
+
* fallback path). Don't blanket-replace throws — invariant violations and
|
|
6
|
+
* programmer errors should still throw.
|
|
7
|
+
*/
|
|
8
|
+
export type Ok<T> = {
|
|
9
|
+
readonly ok: true;
|
|
10
|
+
readonly value: T;
|
|
11
|
+
};
|
|
12
|
+
export type Err<E extends AppError = AppError> = {
|
|
13
|
+
readonly ok: false;
|
|
14
|
+
readonly error: E;
|
|
15
|
+
};
|
|
16
|
+
export type Result<T, E extends AppError = AppError> = Ok<T> | Err<E>;
|
|
17
|
+
export declare const ok: <T>(value: T) => Ok<T>;
|
|
18
|
+
export declare const err: <E extends AppError>(error: E) => Err<E>;
|
|
19
|
+
export declare const isOk: <T, E extends AppError>(r: Result<T, E>) => r is Ok<T>;
|
|
20
|
+
export declare const isErr: <T, E extends AppError>(r: Result<T, E>) => r is Err<E>;
|
|
21
|
+
/** Throw on Err, return value on Ok. Use sparingly — defeats the type-level branch. */
|
|
22
|
+
export declare const unwrap: <T, E extends AppError>(r: Result<T, E>) => T;
|
|
23
|
+
export declare const mapResult: <T, U, E extends AppError>(r: Result<T, E>, fn: (value: T) => U) => Result<U, E>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppError } from './AppError';
|
|
2
|
+
/**
|
|
3
|
+
* Narrow `unknown` (the type of a catch variable when `useUnknownInCatchVariables` is on)
|
|
4
|
+
* to an AppError. Pass through existing AppErrors unchanged; wrap raw Errors and other
|
|
5
|
+
* values in UnknownError, preserving the original via `cause`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* try {
|
|
9
|
+
* await doThing();
|
|
10
|
+
* } catch (e) {
|
|
11
|
+
* throw toAppError(e);
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export declare const toAppError: (caught: unknown, fallbackMessage?: string) => AppError;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type OpenFin from '@openfin/core';
|
|
2
|
+
import type { PagePinnedState } from '../../../common/src/api/pages/shapes';
|
|
2
3
|
import { WindowIdentity } from '../../../common/src/utils/window';
|
|
3
4
|
import { AttachedPage, PageLayout } from '../../../client-api-platform/src/shapes';
|
|
4
5
|
export type LayoutDOMEventType =
|
|
@@ -91,12 +92,6 @@ export declare const generateViewNameAndIdentifierNameIfNotExists: <T extends {
|
|
|
91
92
|
*/
|
|
92
93
|
export declare const cloneLayoutAndConvertViewOptions: (layout: PageLayout, initViewOptions?: Partial<OpenFin.ViewOptions>) => Promise<PageLayout>;
|
|
93
94
|
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
95
|
/**
|
|
101
96
|
* Deep clones a layout and removes generated view names.
|
|
102
97
|
* @param layout The Layout to be cloned
|
|
@@ -121,6 +116,14 @@ export declare const cleanupLayoutObservers: (layoutName: string) => void;
|
|
|
121
116
|
* Initialize the layout for the current OF window.
|
|
122
117
|
*/
|
|
123
118
|
export declare const initLayoutListeners: () => Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns true when a page's in-page layout should be locked.
|
|
121
|
+
* This applies for user-locked pages (`isLocked`) and platform-pinned pages (`pinned === 'platform'`).
|
|
122
|
+
*/
|
|
123
|
+
export declare const isPageLayoutLocked: (page: {
|
|
124
|
+
isLocked?: boolean;
|
|
125
|
+
pinned?: PagePinnedState;
|
|
126
|
+
}) => boolean;
|
|
124
127
|
/**
|
|
125
128
|
* Deep clones a layout and changes its settings to make it "locked".
|
|
126
129
|
* @param layout The Layout to be locked
|
|
@@ -5,7 +5,7 @@ type MenuEventTypes = {
|
|
|
5
5
|
'response': [ModalResponseEvent];
|
|
6
6
|
'ready': [OpenFin.Identity];
|
|
7
7
|
'update': [string, Partial<OpenFin.Bounds>, string];
|
|
8
|
-
'modal-opened': [string];
|
|
8
|
+
'modal-opened': [name: string, parentName: string];
|
|
9
9
|
'modal-closed': [string];
|
|
10
10
|
'search-menu-opening': [string];
|
|
11
11
|
'search-menu-closed': [string];
|
|
@@ -113,12 +113,31 @@ export type RenameSupertabChannelMessage = BasePopupMenuChannelMessage & {
|
|
|
113
113
|
pageId: string;
|
|
114
114
|
};
|
|
115
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* A row in the tab search list. {@link showPin} / {@link showUnpin} are optional; when omitted, no row action.
|
|
118
|
+
*/
|
|
119
|
+
export type TabSearchListItem = {
|
|
120
|
+
id: string;
|
|
121
|
+
title: string;
|
|
122
|
+
/** When true, show a control to pin (move to the user page group). Core UI + ungrouped only. */
|
|
123
|
+
showPin?: boolean;
|
|
124
|
+
/** When true, show a control to unpin (leave the user page group). */
|
|
125
|
+
showUnpin?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* When true, show a non-interactive lock (workspace / platform locked); ungrouped pages only.
|
|
128
|
+
* Mutually exclusive with {@link showPin} in the browser; does not replace {@link showUnpin}.
|
|
129
|
+
*/
|
|
130
|
+
showPlatformLocked?: boolean;
|
|
131
|
+
};
|
|
116
132
|
export type TabSearchModalContent = {
|
|
117
133
|
variant: 'page' | 'view';
|
|
118
|
-
tabs:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
tabs: TabSearchListItem[];
|
|
135
|
+
};
|
|
136
|
+
/** Channel action: browser → tab-search popup; refreshes list rows after pin/unpin while open. */
|
|
137
|
+
export declare const TAB_SEARCH_CHANNEL_ACTION_UPDATE_TABS: "update-tabs";
|
|
138
|
+
export type TabSearchUpdateTabsMessage = {
|
|
139
|
+
requestId: string;
|
|
140
|
+
tabs: TabSearchListItem[];
|
|
122
141
|
};
|
|
123
142
|
export type TabSearchChannelMessage = BasePopupMenuChannelMessage & {
|
|
124
143
|
type: PopupWindowMenuType.TabSearch;
|
|
@@ -15,7 +15,13 @@ export declare enum ComponentName {
|
|
|
15
15
|
Storefront = "Storefront",
|
|
16
16
|
Platform = "Platform",
|
|
17
17
|
Theming = "Theming",
|
|
18
|
-
Microflow = "Microflow"
|
|
18
|
+
Microflow = "Microflow",
|
|
19
|
+
SuppressWorkspaceSwitched = "SuppressWorkspaceSwitched",
|
|
20
|
+
SuppressWorkspaceSaved = "SuppressWorkspaceSaved",
|
|
21
|
+
AllowDuplicatePageTitles = "AllowDuplicatePageTitles",
|
|
22
|
+
PagePinning = "PagePinning",
|
|
23
|
+
ViewTabNewTabShortcut = "ViewTabNewTabShortcut",
|
|
24
|
+
SupertabHideShowTabs = "PRODM-318: Supertab Hide/Show Tab Headers"
|
|
19
25
|
}
|
|
20
26
|
export declare const registerBrowserUsage: (status: RegisterUsageStatus) => void;
|
|
21
27
|
export declare const registerHomeUsage: (status: RegisterUsageStatus) => void;
|
|
@@ -25,6 +31,12 @@ export declare const registerNotificationUsage: (status: RegisterUsageStatus) =>
|
|
|
25
31
|
export declare const registerPlatformUsage: (status: RegisterUsageStatus) => void;
|
|
26
32
|
export declare const registerThemingUsage: (status: RegisterUsageStatus) => void;
|
|
27
33
|
export declare const registerMicroflowUsage: (microflowName: string, status: RegisterUsageStatus) => void;
|
|
34
|
+
export declare const registerSuppressWorkspaceSwitchedUsage: (status: RegisterUsageStatus) => void;
|
|
35
|
+
export declare const registerSuppressWorkspaceSavedUsage: (status: RegisterUsageStatus) => void;
|
|
36
|
+
export declare const registerAllowDuplicatePageTitlesUsage: (status: RegisterUsageStatus) => void;
|
|
37
|
+
export declare const registerPagePinningUsage: (status: RegisterUsageStatus) => void;
|
|
38
|
+
export declare const registerViewTabNewTabShortcutUsage: (status: RegisterUsageStatus) => void;
|
|
39
|
+
export declare const registerSupertabHideShowTabsUsage: () => void;
|
|
28
40
|
export type AnalyticsSource = 'Browser' | 'Dock' | 'Home' | 'Notification' | 'Store' | 'Platform' | 'Theming' | 'Interop';
|
|
29
41
|
/**
|
|
30
42
|
* Event for analytics
|