@openfin/workspace 45.3.5 → 45.3.7

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 { ContentSortRequest, LaunchAppRequest, SearchSitesRequest, SearchSi
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.Platform | OpenFin.View | OpenFin.Application>;
10
+ export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.View | OpenFin.Identity | OpenFin.Platform | OpenFin.Application>;
11
11
  export declare const enterpriseAppDirectoryChannelClient: () => Promise<OpenFin.ChannelClient>;
12
12
  export declare function getResults(payload: {
13
13
  req: SearchSitesRequest;
@@ -0,0 +1,30 @@
1
+ import { KeyboardCommand } from '../../../../common/src/utils/keyboard-commands';
2
+ /**
3
+ * Maps a menu item's `data.type` to the keyboard command that performs the same action, or to a fixed
4
+ * `{ keys }` binding for shortcuts handled outside `getKeyboardCommands` (e.g. quit).
5
+ */
6
+ type MenuShortcutCommands = Partial<Record<string, KeyboardCommand | {
7
+ keys: string;
8
+ }>>;
9
+ export declare const ENTERPRISE_GLOBAL_MENU_SHORTCUTS: MenuShortcutCommands;
10
+ export declare const ENTERPRISE_PAGE_TAB_MENU_SHORTCUTS: MenuShortcutCommands;
11
+ /**
12
+ * View tab New Tab / Close Tab act on the inner view, while Cmd/Ctrl+T and Cmd/Ctrl+W act on the whole
13
+ * page, so they are not labelled.
14
+ */
15
+ export declare const ENTERPRISE_VIEW_TAB_MENU_SHORTCUTS: MenuShortcutCommands;
16
+ type ShortcutMenuItem = {
17
+ data?: {
18
+ type?: string;
19
+ } | null;
20
+ submenu?: ShortcutMenuItem[];
21
+ shortcut?: string;
22
+ };
23
+ /**
24
+ * Returns a copy of `template` with each item that has a registered hotkey labelled with it (as the
25
+ * `shortcut` the Enterprise popup menu renders), formatted for the current OS.
26
+ */
27
+ export declare const addKeyboardShortcuts: <T extends ShortcutMenuItem>(template: T[], shortcutCommands: MenuShortcutCommands) => Promise<(T & {
28
+ shortcut?: string;
29
+ })[]>;
30
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { PositioningType } from '../../../../common/src/utils/positioning';
3
+ import type { PageCreationOrigin } from '../../../../common/src/api/pages/shapes';
3
4
  import { WorkspaceContextMenuItemData } from '../../../../client-api-platform/src/shapes';
4
5
  export declare const saveWorkspaceHandlerWithInjectables: ({ showModal, afterSuccessSave }: {
5
6
  showModal?: () => Promise<void>;
@@ -9,8 +10,10 @@ export declare const saveWorkspaceHandler: (identity: OpenFin.Identity) => Promi
9
10
  export declare const saveWorkspaceAsHandler: (identity: OpenFin.Identity) => void;
10
11
  /**
11
12
  * @param identity Identity of browser window to create a new page on.
13
+ * @param origin User interaction that requested the page. Menu callers omit this.
12
14
  */
13
- export declare const createNewPageHandler: (identity: OpenFin.Identity) => Promise<void>;
15
+ export declare const createNewPageHandler: (identity: OpenFin.Identity, origin?: PageCreationOrigin) => Promise<void>;
16
+ export declare const createNewWindowHandler: (identity: OpenFin.Identity) => Promise<void>;
14
17
  /**
15
18
  * @param identity Identity of browser window to execute save on.
16
19
  * @param pageId Id of a page to save. If omitted, active page is saved.
@@ -1,6 +1,10 @@
1
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
- };
2
+ import { KEYBOARD_COMMANDS } from '../../../../common/src/utils/keyboard-commands';
3
+ export { KEYBOARD_COMMANDS };
6
4
  export declare const getKeyboardCommands: (superGetKeyboardCommands: () => OpenFin.ShortcutOverride[]) => OpenFin.ShortcutOverride[];
5
+ /**
6
+ * The first key binding registered for `command`, or `undefined` if it has none (never registered, or
7
+ * disabled via empty `keys`). Commands with several bindings list their primary one first, e.g. reload's
8
+ * `CommandOrControl+R` before `F5`.
9
+ */
10
+ export declare const getRegisteredShortcutKeys: (command: string) => string | undefined;
@@ -1492,6 +1492,15 @@ export type AppSite = SiteInfo & {
1492
1492
  };
1493
1493
  };
1494
1494
  };
1495
+ /**
1496
+ * Enterprise Web Search result (e.g. Google).
1497
+ * @internal
1498
+ */
1499
+ export type WebSearchSite = SiteInfo & {
1500
+ type: 'websearch';
1501
+ url: string;
1502
+ icon: string;
1503
+ };
1495
1504
  /**
1496
1505
  * @internal
1497
1506
  */
@@ -1512,7 +1521,7 @@ export type CollectionSite = SiteInfo & {
1512
1521
  /**
1513
1522
  * @internal
1514
1523
  */
1515
- export type Site = AppSite | WorkspaceSite;
1524
+ export type Site = AppSite | WorkspaceSite | WebSearchSite;
1516
1525
  /**
1517
1526
  * @internal
1518
1527
  */
@@ -267,11 +267,15 @@ export interface CopyPagePayload {
267
267
  /** Specifies the trigger for creating a copy. */
268
268
  reason: 'save-as' | 'duplicate';
269
269
  }
270
+ /** The user interaction that created a new page. Reported in the `Create Page` analytics event. */
271
+ export type PageCreationOrigin = 'new-tab-button' | 'menu' | 'hotkey' | 'dock' | 'new-window';
270
272
  export type AddDefaultPagePayload = {
271
273
  /** The OF window identity to attach the pages to. */
272
274
  identity: OpenFin.Identity;
273
275
  /** The page to attach. */
274
276
  page: PageWithUpdatableRuntimeAttribs;
277
+ /** The user interaction that requested the page. */
278
+ origin?: PageCreationOrigin;
275
279
  };
276
280
  export type AddPagePayload = {
277
281
  /** The OF window identity to attach the pages to. */
@@ -11,7 +11,7 @@ export declare const isDocumentDefined: boolean;
11
11
  export declare const isWindowDefinedWithIndexDB: boolean;
12
12
  export declare const finUUID: string;
13
13
  export declare const finName: string;
14
- export declare const finEntityType: "" | "view" | "window";
14
+ export declare const finEntityType: "" | "window" | "view";
15
15
  export declare const isEnvLocal: boolean;
16
16
  export declare const isEnvDev: boolean;
17
17
  export declare const isEnvStaging: boolean;
@@ -95,7 +95,11 @@ export declare const deleteWorkspace: () => {
95
95
  label: string;
96
96
  };
97
97
  export declare const downloads: () => {
98
+ type: MenuItemType;
98
99
  label: string;
100
+ data: {
101
+ type: WP.GlobalContextMenuOptionType;
102
+ };
99
103
  };
100
104
  export declare const appearance: () => {
101
105
  label: string;
@@ -0,0 +1,30 @@
1
+ import type OpenFin from '@openfin/core';
2
+ export declare enum InteropEventType {
3
+ JoinedContextGroup = "joined-context-group",
4
+ RemovedFromContextGroup = "removed-from-context-group"
5
+ }
6
+ type InteropEventPayload<E extends InteropEventType> = {
7
+ [InteropEventType.JoinedContextGroup]: {
8
+ viewIdentity: OpenFin.Identity;
9
+ contextGroupId: string;
10
+ };
11
+ [InteropEventType.RemovedFromContextGroup]: {
12
+ viewIdentity: OpenFin.Identity;
13
+ };
14
+ }[E];
15
+ export type InteropListener<EventType extends InteropEventType> = (payload: InteropEventPayload<EventType>) => void;
16
+ /**
17
+ * Returns contextGroup data.
18
+ * @returns Promise<ContextGroup[]>
19
+ */
20
+ export declare function getContextGroups(): Promise<OpenFin.ContextGroupInfo[]>;
21
+ export declare const joinContextGroup: (viewIdentity: OpenFin.Identity, contextGroupId: string) => Promise<void>;
22
+ export declare const removeFromGroup: (viewIdentity: OpenFin.Identity) => Promise<void>;
23
+ export declare function getViewContextGroupId(viewIdentity: OpenFin.Identity): Promise<string | null | undefined>;
24
+ /**
25
+ * Listen for interop events.
26
+ * @param event the interop event to listen for.
27
+ * @param listener the function to call when the event occurs.
28
+ */
29
+ export declare const addInteropListener: <Event extends InteropEventType>(event: Event, listener: InteropListener<Event>) => Promise<void>;
30
+ export {};
@@ -0,0 +1,47 @@
1
+ export declare const KEYBOARD_COMMANDS: {
2
+ readonly NEW_TAB: "workspace.newTab";
3
+ readonly FIND_IN_PAGE: "findInPage.show";
4
+ readonly RESTORE_TAB: "workspace.restoreTab";
5
+ readonly CLOSE_TAB: "workspace.closeTab";
6
+ readonly NEXT_TAB: "workspace.nextTab";
7
+ readonly PREVIOUS_TAB: "workspace.previousTab";
8
+ readonly LAST_TAB: "workspace.lastTab";
9
+ readonly NEW_WINDOW: "workspace.newWindow";
10
+ readonly CLOSE_WINDOW: "workspace.closeWindow";
11
+ readonly SAVE_PAGE: "workspace.savePage";
12
+ readonly SAVE_PAGE_AS: "workspace.savePageAs";
13
+ readonly NAVIGATE_BACK: "workspace.navigateBack";
14
+ readonly NAVIGATE_FORWARD: "workspace.navigateForward";
15
+ readonly RELOAD: "workspace.reload";
16
+ readonly PRINT: "workspace.print";
17
+ readonly FOCUS_ADDRESS_BAR: "workspace.focusAddressBar";
18
+ readonly BOOKMARK_PAGE: "workspace.bookmarkPage";
19
+ readonly ZOOM_IN_VIEW: "workspace.zoomInView";
20
+ readonly ZOOM_OUT_VIEW: "workspace.zoomOutView";
21
+ readonly ZOOM_IN_PAGE: "workspace.zoomInPage";
22
+ readonly ZOOM_OUT_PAGE: "workspace.zoomOutPage";
23
+ };
24
+ export type KeyboardCommand = (typeof KEYBOARD_COMMANDS)[keyof typeof KEYBOARD_COMMANDS];
25
+ /**
26
+ * Which side wins when focused content binds the same shortcut as a HERE command.
27
+ *
28
+ * - `yieldable` (default): content wins. The key reaches the page first, like find-in-page; if the
29
+ * page calls `event.preventDefault()` the HERE command does not run, otherwise it does.
30
+ * - `reserved`: HERE wins and the key never reaches content. Limited to the commands Chrome itself
31
+ * does not let pages override (new/close/restore tab, new/close window, tab cycling) plus
32
+ * focus address bar.
33
+ *
34
+ * Every new command must be classified here. Use `yieldable` unless a page must never be able to
35
+ * block the command.
36
+ */
37
+ export declare const KEYBOARD_COMMAND_PRECEDENCE: Record<KeyboardCommand, 'reserved' | 'yieldable'>;
38
+ /** Numbered tab commands and any command not in {@link KEYBOARD_COMMAND_PRECEDENCE} are yieldable. */
39
+ export declare const isReservedKeyboardCommand: (command: string) => boolean;
40
+ /** Tabs 1–8 have their own command; the ninth shortcut maps to {@link KEYBOARD_COMMANDS.LAST_TAB}. */
41
+ export declare const NUMBERED_TAB_COUNT = 8;
42
+ export declare const getSelectTabCommand: (tabNumber: number) => string;
43
+ /**
44
+ * Formats an Electron-style accelerator (as registered in `getKeyboardCommands`) for display in a menu,
45
+ * e.g. `Shift+CommandOrControl+S` → `⇧⌘S` on Mac and `Ctrl+Shift+S` on Windows.
46
+ */
47
+ export declare const formatKeyboardShortcut: (keys: string, isWindows: boolean) => string;
@@ -1,4 +1,6 @@
1
1
  /** @internal Reset cached host specs — only for test isolation */
2
2
  export declare const resetHostSpecsCache: () => void;
3
3
  export declare const isOSWindows: () => Promise<boolean>;
4
+ /** For synchronous contexts */
5
+ export declare const isOSWindowsSync: () => boolean;
4
6
  export declare const isWindows10Or11: () => Promise<boolean>;
@@ -37,6 +37,7 @@ export type BrowserSearchMenuKeyboardEvent = {
37
37
  metaKey?: boolean;
38
38
  ctrlKey?: boolean;
39
39
  altKey?: boolean;
40
+ shiftKey?: boolean;
40
41
  };
41
42
  };
42
43
  export declare enum PopupWindowMenuType {
@@ -1,4 +1,5 @@
1
1
  import type OpenFin from '@openfin/core';
2
+ import type { Page, PageCreationOrigin } from '../../../common/src/api/pages/shapes';
2
3
  import { AttachedPage } from '../../../client-api-platform/src/shapes';
3
4
  export interface RegisterUsageStatus {
4
5
  apiVersion?: string;
@@ -63,6 +64,10 @@ export interface AnalyticsEventInternal extends AnalyticsEvent {
63
64
  export type AnalyticsEventRaise = Omit<AnalyticsEventInternal, 'source'>;
64
65
  export declare const raiseBrowserAnalytics: (payload: AnalyticsEventRaise) => Promise<void>;
65
66
  export declare const raiseBrowserPageAnalytics: (pages: AttachedPage[], action: string) => Promise<void>;
67
+ /**
68
+ * Raised when a new page ID is minted, as opposed to `Open Page`, which also fires for restored pages.
69
+ */
70
+ export declare const raiseCreatePageAnalytics: (page: Pick<Page, "pageId" | "title">, windowName: string, origin?: PageCreationOrigin) => Promise<void>;
66
71
  export declare const raiseHomeAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
67
72
  export declare const raiseDockAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
68
73
  export declare const raiseStorefrontAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
@@ -22,6 +22,12 @@
22
22
  "packageName": "client-api/package.json",
23
23
  "issuer": "client-api/src/internal/providers.ts"
24
24
  },
25
+ {
26
+ "type": "explicit",
27
+ "version": "3.0.3",
28
+ "packageName": "client-api-platform/package.json",
29
+ "issuer": "client-api-platform/src/api/context-menu/browser-pagetab-handler.ts"
30
+ },
25
31
  {
26
32
  "type": "explicit",
27
33
  "version": "3.0.3",
@@ -67,6 +73,14 @@
67
73
  "issuer": "common/src/api/i18next.ts"
68
74
  }
69
75
  ],
76
+ "lodash.clonedeep": [
77
+ {
78
+ "type": "explicit",
79
+ "version": "4.5.0",
80
+ "packageName": "common/package.json",
81
+ "issuer": "common/src/utils/layout.ts"
82
+ }
83
+ ],
70
84
  "dexie": [
71
85
  {
72
86
  "type": "root-implicit",
@@ -92,13 +106,5 @@
92
106
  "packageName": "common/package.json",
93
107
  "issuer": "common/src/utils/create-and-migrate-ibd-store.ts"
94
108
  }
95
- ],
96
- "lodash.clonedeep": [
97
- {
98
- "type": "explicit",
99
- "version": "4.5.0",
100
- "packageName": "common/package.json",
101
- "issuer": "common/src/utils/layout.ts"
102
- }
103
109
  ]
104
110
  }