UNPKG

@interopio/workspaces-api

Version:

IOConnect Workspaces API

1,244 lines (979 loc) 99.5 kB
/* eslint-disable @typescript-eslint/no-explicit-any */ export type WorkspacesFactoryFunction = (io: any, config?: any) => Promise<void>; declare const WorkspacesFactory: WorkspacesFactoryFunction; export default WorkspacesFactory; /** * @docname Workspaces * @intro * The Workspaces API offers advanced window management functionalities. Using Workspaces, users are able to arrange multiple apps * within the same visual window (called Frame or a Workspaces App). This arrangement can be performed programmatically or by dragging and dropping * apps within the Frame. Users can also save Workspace Layouts and restore them within the same Frame or even in different Frames. * * The app windows in a Workspace are treated as individual building blocks that can be added, removed, moved, or resized within the Workspace. * The Frame can hold multiple Workspaces (as tabs) and can also be maximized, minimized or resized. * * The Workspaces API is accessible via the [`io.workspaces`](#API) object. */ export namespace IOConnectWorkspaces { /** An object describing a workspace layout. */ export interface WorkspaceLayout { /** An unique string name and identifier of the layout */ name: string; /** The type of the workspace element. */ type: "Workspace"; /** The components of the workspace layout. This collection can contain only one element and it must be a workspace component. */ components: Array<WorkspaceComponent>; /** An object containing various layout metadata. */ metadata?: any; } export interface WorkspaceLayoutComponentState { /** An array of all the workspace's children. */ children: Array<RowLayoutItem | ColumnLayoutItem | GroupLayoutItem | WindowLayoutItem>; /** An object containing various element settings. */ config: any; /** An object containing the context of the workspace layout */ context: any; } /** An object describing a workspace definition in a workspace layout. */ export interface WorkspaceComponent { /** The type of the workspace element. */ type: "Workspace"; /** * The name of the workspaces app with which the layout is associated. * *Available only in **io.Connect Desktop**.* */ application?: string; state: WorkspaceLayoutComponentState; } /** An object describing a row definition in a workspace layout. */ export interface RowLayoutItem { /** The type of the workspace element. */ type: "row"; /** An array of all the row's children. */ children: Array<RowLayoutItem | ColumnLayoutItem | GroupLayoutItem | WindowLayoutItem>; /** An object containing various element settings. */ config: any; } /** An object describing a column definition in a workspace layout. */ export interface ColumnLayoutItem { /** The type of the workspace element. */ type: "column"; /** An array of all the column's children. */ children: Array<RowLayoutItem | ColumnLayoutItem | GroupLayoutItem | WindowLayoutItem>; /** An object containing various element settings. */ config: any; } /** An object describing a group definition in a workspace layout. */ export interface GroupLayoutItem { /** The type of the workspace element. */ type: "group"; /** An array of all the group's children which can only of type window. */ children: WindowLayoutItem[]; /** An object containing various element settings. */ config: any; } export interface WindowLayoutItemConfig { /** The name of the application as specified in its definition. */ appName: string; /** The id of the window */ windowId?: string; /** The url of the window, in case it is not a defined as an application. */ url?: string; /** The title of the window */ title?: string; /** The context of the window used when restoring the window */ context?: any; } /** An object describing a window definition in a workspace layout. */ export interface WindowLayoutItem { /** The type of the workspace element. */ type: "window"; /** A configuration object for the window layout */ config: WindowLayoutItemConfig; } /** A function which when called unsubscribes the user from further notifications. */ export type Unsubscribe = () => void; /** An object containing all the possible settings when restoring a workspace from a layout. */ export interface RestoreWorkspaceConfig { /** An object which will be set as the window context of all windows inside this workspace. */ context?: object; /** The title of the new workspace. */ title?: string; /** A string id of an existing frame. If provided, this workspace will be opened in that specific frame */ frameId?: string; /** * The application name of the workspace app that should be used for the new frame. * *Available only in **io.Connect Desktop**.* */ applicationName?: string; /** A setting used to declare that the workspace must be in a new frame and also provide options for that new frame */ newFrame?: NewFrameConfig | boolean; loadingStrategy?: LoadingStrategy; /** Used for replacing the specified workspace instead of creating a new one */ reuseWorkspaceId?: string; /** Opens the workspace without a workspace tab element */ noTabHeader?: boolean; /** * Controls whether the workspace will be opened in a pinned or in a normal state */ isPinned?: boolean; /** * Sets the icon related for the workspace. The icon will be used for example for pinned workspaces. */ icon?: string; /** * Controls whether the workspace will be focused or not in the frame when opened */ isSelected?: boolean; /** * Specifies where in the frame should the workspace be placed */ positionIndex?: number; /** * If `true`, the Workspaces Frame instance containing the restored Workspace will be activated. * This means that the Workspaces Frame window will gain focus, will be restored to its normal state (e.g., if it has been previously minimized), * and will be brought in front of other existing windows. * Defaults to the configuration passed in the `workspaces.json` file or to `false`. * *Available only in **io.Connect Desktop**.* */ activateFrame?: boolean; /** * If `true`, will allow the Workspace to be hibernated via the platform configuration. * This setting doesn't apply to programmatic hibernation via the `hibernate()` method of a `Workspace` instance. */ allowSystemHibernation?: boolean; } /** * Settings for showing a previously hidden Workspaces Frame instance. */ export interface FrameShowConfig { /** * If `true`, the Workspaces Frame instance will be activated. This means that the Workspaces Frame window will gain focus, * will be restored to its normal state (e.g., if it has been previously minimized), and will be brought in front of other existing windows. * @default false */ activate?: boolean; } /** An object containing the bounds of a frame */ export interface FrameBounds { top: number; left: number; width: number; height: number; } /** An object describing the possible settings when defining a new frame. */ export interface NewFrameConfig { /** An object describing the possible settings when defining a new frame. */ bounds?: { top?: number; left?: number; width?: number; height?: number; }; /** * If `true`, the newly created Workspaces Frame instance will be visible. * *Available only in **io.Connect Desktop**.* * @since io.Connect Desktop 9.9.5 * @default true */ isVisible?: boolean; /** A string which will be used as an id of the new frame. The call will reject if a frame with id already exists */ frameId?: string; } /** An object defining the resize parameters of a frame. */ export interface ResizeConfig { /** The targeted width value */ width?: number; /** The targeted height value */ height?: number; /** Toggles whether or not the provided width and height values should be treated as absolute or relative to the current values. */ relative?: boolean; } /** An object defining the position parameters of a frame. */ export interface MoveConfig { /** The targeted top value */ top?: number; /** The targeted left value */ left?: number; /** Toggles whether or not the provided top and left values should be treated as absolute or relative to the current values. */ relative?: boolean; } /** * Options for closing a Frame. * *Available only for **io.Connect Desktop**.* * @since io.Connect Desktop 9.9 */ export interface FrameCloseOptions { /** * If `true`, will allow preventing the operation for closing the Frame. */ allowPrevent?: boolean; /** * If `true`, will show a dialog for the user to confirm or cancel closing the Frame. */ showDialog?: boolean; } /** An object containing settings applied when creating a new workspace. */ export interface WorkspaceCreateConfig { /** A boolean which defines whether or not the workspace should also be saved as a layout when created. */ saveLayout?: boolean; } /** * The loading strategy used to open new workspaces. * "direct" will cause all windows to start loading at the same time as soon as the workspace loads * "delayed" will cause all visible/active/selected windows to start loading at the same time as soon as the workspace loads. The rest will be loaded gradually at a specific interval. * "lazy" will cause all visible/active/selected windows to start loading at the same time as soon as the workspace loads. The rest will start loading when the user selects them and not before that. /** The loading strategy used to open new workspaces. "direct" will cause all windows to start loading at the same time, "delayed" */ export type LoadingStrategy = "direct" | "delayed" | "lazy"; /** An object which represent a workspace element. This is an element can be a box or a workspace window. */ export type WorkspaceElement = WorkspaceBox | WorkspaceWindow; /** An object which represent a workspace box. This is an element which contains other elements, called children. */ export type WorkspaceBox = Row | Column | Group; /** The possible window states for a workspaces frame. */ export type FrameState = "maximized" | "minimized" | "normal"; /** The possible types of window dragging inside a workspaces frame */ export type WindowDragMode = "keepInside" | "autoEject"; /** An object describing the options of the builder. */ export interface BuilderConfig { /** A string defining the type of the builder. */ type: "workspace" | "row" | "column" | "group"; /** An object describing various options when creating a builder. */ definition?: WorkspaceDefinition | BoxDefinition; } /** Workspace-specific options. */ export interface WorkspaceConfig { /** A title of the workspace. */ title?: string; /** Position of the workspace in relation to it's siblings in the frame. */ position?: number; /** * Provides the opportunity to open a workspace with no tab header * @default false */ noTabHeader?: boolean; /** Used for replacing the specified workspace instead of creating a new one */ reuseWorkspaceId?: string; /** Controls when the windows inside this workspace should load when the workspace is created or restored */ loadStrategy?: LoadingStrategy; /** * Controls the users ability to drop outside windows in the workspace * @default true */ allowDrop?: boolean; /** * Controls the users ability to drop windows in the left-most zone of the workspace * @default true */ allowDropLeft?: boolean; /** * Controls the users ability to drop windows in the top-most zone of the workspace * @default true */ allowDropTop?: boolean; /** * Controls the users ability to drop windows in the right-most zone of the workspace * @default true */ allowDropRight?: boolean; /** * Controls the users ability to drop windows in the bottom-most zone of the workspace * @default true */ allowDropBottom?: boolean; /** * Controls the users ability to extract windows from the workspace * @default true */ allowExtract?: boolean; /** * Control the users ability to reorder windows in the workspace * @default true */ allowWindowReorder?: boolean; /** * Controls the visibility of the save workspace button located in the workspace tab * @default true */ showSaveButton?: boolean; /** * Controls whether a workspace tab can be reordered in the frame * @default true */ allowWorkspaceTabReorder?: boolean; /** * Controls whether a workspace tab can be extracted from the frame. * *Available only in **io.Connect Desktop**.* * @default true */ allowWorkspaceTabExtract?: boolean; /** * Controls the visibility of the close button located in the workspaces tab * @default true */ showCloseButton?: boolean; /** * Prevents the splitters for being draggable, so the windows cannot be resized * @default true */ allowSplitters?: boolean; /** * Controls the visibility of all close button located in the windows' tab elements * @default true */ showWindowCloseButtons?: boolean; /** * Controls the visibility of all eject buttons located in the groups' headers * @default true */ showEjectButtons?: boolean; /** * Controls the visibility of all the add window buttons (the ones with the plus icon) located in the group headers * @default true */ showAddWindowButtons?: boolean; /** * Controls whether the workspace will be opened in a pinned or in a normal state * @default false */ isPinned?: boolean; /** * Sets the icon related for the workspace. The icon will be used for example for pinned workspaces. */ icon?: string; /** * Controls whether the workspace will be focused or not in the frame when opened * @default true */ isSelected?: boolean; /** * Specifies where in the frame should the workspace be placed */ positionIndex?: number; /** * Mode for dragging the windows that are part of the Workspace. If set to `"autoEject"` (available only in **io.Connect Desktop**), when the user drags a Workspace window, it will be ejected from the Workspace during the dragging operation and the user will be able to drop it back inside the Workspace, or out of the Workspace. * If set to `"keepInside"`, the window won't be ejected from the Workspace when being dragged and the user will be able to drop it only inside the Workspace. */ windowDragMode?: "keepInside" | "autoEject"; /** * If `true`, will allow the Workspace to be hibernated via the platform configuration. * This setting doesn't apply to programmatic hibernation via the `hibernate()` method of a `Workspace` instance. * @default true */ allowSystemHibernation?: boolean; } /** A config object which provides fine grain control when locking a workspace */ export interface WorkspaceLockConfig { /** Prevents the splitters for being draggable, so the windows cannot be resized */ allowSplitters?: boolean; /** (Enterprise only) Controls the ability of the users to drop outside windows in the workspace */ allowDrop?: boolean; /** Controls the users ability to drop windows in left-most zone of the workspace */ allowDropLeft?: boolean; /** Controls the users ability to drop windows in top-most zone of the workspace */ allowDropTop?: boolean; /** Controls the users ability to drop windows in right-most zone of the workspace */ allowDropRight?: boolean; /** Controls the users ability to drop windows in bottom-most zone of the workspace */ allowDropBottom?: boolean; /** Controls the ability of the users to extract (or rearrange) windows inside the workspace */ allowExtract?: boolean; /** Control the users ability to reorder windows in the workspace */ allowWindowReorder?: boolean; /** Controls the visibility of the close button located in the workspaces tab */ showCloseButton?: boolean; /** Controls the visibility of the save workspace button located in the workspace tab */ showSaveButton?: boolean; /** Controls the whether the workspace tab can be reordered */ allowWorkspaceTabReorder?: boolean; /** * Controls the whether the workspace tab can be extracted. * *Available only in **io.Connect Desktop**.* */ allowWorkspaceTabExtract?: boolean; /** Controls the visibility of all the add window buttons (the ones with the plus icon) located in the group headers */ showAddWindowButtons?: boolean; /** Controls the visibility of all eject buttons located in the groups' headers */ showEjectButtons?: boolean; /** Controls the visibility of all close button located in the windows' tab elements */ showWindowCloseButtons?: boolean; /** * If `true`, will allow the Workspace to be hibernated via the platform configuration. * This setting doesn't apply to programmatic hibernation via the `hibernate()` method of a `Workspace` instance. */ allowSystemHibernation?: boolean; } /** A config object which provides fine grain control when locking a window */ export interface WorkspaceWindowLockConfig { /** Blocks the users ability to extract the specified window */ allowExtract?: boolean; /** Blocks the users ability to reorder the specified window */ allowReorder?: boolean; /** Controls the visibility of the close button which is located in the window's tab */ showCloseButton?: boolean; } /** A config object which provides fine grain control when locking a group */ export interface GroupLockConfig { /** Blocks the users ability to extract windows from the group */ allowExtract?: boolean; /** Blocks the ussers ability to reorder windows from the group */ allowReorder?: boolean; /** (Enterprise only) Controls the ability of the users to drop outside windows in the group */ allowDrop?: boolean; /** Controls the users ability to drop windows in left zone of the group */ allowDropLeft?: boolean; /** Controls the users ability to drop windows in right zone of the group */ allowDropRight?: boolean; /** Controls the users ability to drop windows in top zone of the group */ allowDropTop?: boolean; /** Controls the users ability to drop windows in bottom zone of the group */ allowDropBottom?: boolean; /** Controls the users ability to drop windows in header zone of the group */ allowDropHeader?: boolean; /** Controls the visibility of the maximize/restore button located in the group header */ showMaximizeButton?: boolean; /** Controls the visibility of the eject button located in the group header */ showEjectButton?: boolean; /** Controls the visibility of the add window buttons (the ones with the plus icon) located in the group header */ showAddWindowButton?: boolean; } /** A config object which provides fine grain control when locking a row */ export interface RowLockConfig { /** (Enterprise only) Controls the ability of the users to drop outside windows in the row */ allowDrop?: boolean; /** Prevents the splitters for being draggable, so the windows cannot be resized within the row */ allowSplitters?: boolean; } /** A config object which provides fine grain control when locking a column */ export interface ColumnLockConfig { /** (Enterprise only) Controls the ability of the users to drop outside windows in the column */ allowDrop?: boolean; /** Prevents the splitters for being draggable, so the windows cannot be resized within the row */ allowSplitters?: boolean; } /** A config object which defines various workspace window-specific settings */ export interface WorkspaceWindowDefinitionConfig { /** Specifies the minimum width in pixels for the workspace window */ minWidth?: number; /** Specifies the maximum width in pixels for the workspace window */ maxWidth?: number; /** Specifies the minimum height in pixels for the workspace window */ minHeight?: number; /** Specifies the maximum height in pixels for the workspace window */ maxHeight?: number; /** Blocks the users ability to extract the specified window */ allowExtract?: boolean; /** Blocks the users ability to reorder the specified window */ allowReorder?: boolean; /** Controls the visibility of the close button which is located in the window's tab */ showCloseButton?: boolean; } /** A config object which defines various group-specific settings */ export interface GroupDefinitionConfig { /** Specifies the minimum width in pixels for the group */ minWidth?: number; /** Specifies the maximum width in pixels for the group */ maxWidth?: number; /** Specifies the minimum height in pixels for the group */ minHeight?: number; /** Specifies the maximum height in pixels for the group */ maxHeight?: number; /** Blocks the users ability to extract windows from the group */ allowExtract?: boolean; /** Blocks the users ability to reorder windows from the group */ allowReorder?: boolean; /** Controls the visibility of the maximize/restore button located in the group header */ showMaximizeButton?: boolean; /** Controls the visibility of the eject button located in the group header */ showEjectButton?: boolean; /** (Enterprise only) Controls the ability of the users to drop outside windows in the group */ allowDrop?: boolean; /** Controls the users ability to drop windows in left zone of the group */ allowDropLeft?: boolean; /** Controls the users ability to drop windows in right zone of the group */ allowDropRight?: boolean; /** Controls the users ability to drop windows in top zone of the group */ allowDropTop?: boolean; /** Controls the users ability to drop windows in bottom zone of the group */ allowDropBottom?: boolean; /** Controls the users ability to drop windows in header zone of the group */ allowDropHeader?: boolean; /** Controls the visibility of the add window buttons (the ones with the plus icon) located in the group header */ showAddWindowButton?: boolean; } /** A config object which defines various row-specific settings */ export interface RowDefinitionConfig { /** Specifies the minimum height in pixels for the row */ minHeight?: number; /** Specifies the maximum height in pixels for the row */ maxHeight?: number; /** (Enterprise only) Controls the ability of the users to drop outside windows in the row */ allowDrop?: boolean; /** Prevents the splitters for being draggable, so the windows cannot be resized within the row */ allowSplitters?: boolean; /** Specifies if a row should be pinned. A pinned row will always maintain it's height, unless the user manually changes it by dragging the splitter */ isPinned?: boolean; /** If set to true any child that is maximized will have its width and height constricted to the current element's size */ maximizationBoundary?: boolean; } /** A config object which defines various column-specific settings */ export interface ColumnDefinitionConfig { /** Specifies the minimum width in pixels for the column */ minWidth?: number; /** Specifies the maximum width in pixels for the column */ maxWidth?: number; /** (Enterprise only) Controls the ability of the users to drop outside windows in the column */ allowDrop?: boolean; /** Prevents the splitters for being draggable, so the windows cannot be resized within the column */ allowSplitters?: boolean; /** Specifies if a column should be pinned. A pinned column will always maintain it's width, unless the user manually changes it by dragging the splitter */ isPinned?: boolean; /** If set to true any child that is maximized will have its width and height constricted to the current element's size */ maximizationBoundary?: boolean; } export interface FrameTargetingOptions { /** * If `true`, the targeted Workspaces Frame instance will be activated. This means that the Workspaces Frame window will gain focus, * will be restored to its normal state (e.g., if it has been previously minimized), and will be brought in front of other existing windows. * Defaults to the configuration passed in the `workspaces.json` file or to `false`. * *Available only in **io.Connect Desktop**.* */ activate?: boolean; /** A string id of an existing frame. If provided, this workspace will be opened in that specific frame */ reuseFrameId?: string; /** * The application name of the workspace app that should be used for the new frame. * *Available only in **io.Connect Desktop**.* */ applicationName?: string; /** A setting used to declare that the workspace must be in a new frame and also provide options for that new frame */ newFrame?: NewFrameConfig | boolean; } export interface WorkspacePinOptions { /** * Icon which will be used for the pinned workspace. */ icon?: string; } /** An object describing the possible options when defining a new workspace */ export interface WorkspaceDefinition { /** An array of all the workspace's children which will also be opened. */ children?: Array<WorkspaceWindowDefinition | BoxDefinition>; /** An object which will be set as the window context of all windows inside this workspace. */ context?: any; /** Workspace-specific options. */ config?: WorkspaceConfig; /** Options regarding the frame where this workspace will be opened in. */ frame?: FrameTargetingOptions; } /** An object describing the possible options when restoring a workspace */ export interface RestoreWorkspaceDefinition { /** * The name of a saved workspace layout, which will be restored. */ name: string; /** * An optional object containing various workspace restore options. */ restoreOptions?: RestoreWorkspaceConfig; } /** An object describing the possible options when opening a box inside a workspace. */ export interface BoxDefinition { /** The type of the workspace element. */ type?: "column" | "row" | "group"; /** An array of all the box's children which will also be opened. */ children?: Array<WorkspaceWindowDefinition | BoxDefinition>; /** An optional config object which defines various box-specific settings */ config?: GroupDefinitionConfig | RowDefinitionConfig | ColumnDefinitionConfig; } /** An object describing the possible options when opening a window inside a workspace. */ export interface WorkspaceWindowDefinition { /** The type of the workspace element. */ type?: "window"; /** The name of the application as defined, which will be opened. */ appName?: string; /** The window id of an existing standalone window, which will be dragged into the workspace. */ windowId?: string; /** An object which will be passed to the newly created window. This object is then accessible via the Windows API */ context?: any; /** A config object which defines various workspace window-specific settings */ config?: WorkspaceWindowDefinitionConfig; } /** A config object which shows the possible frame size constraints, which are calculated using all internal elements' constraints */ export interface FrameConstraints { /** Shows the minimum width of the frame */ minWidth: number; /** Shows the maximum width of the frame */ maxWidth: number; /** Shows the minimum height of the frame */ minHeight: number; /** Shows the maximum height of the frame */ maxHeight: number; } /** A config object which defines how a workspace element should be resized */ export interface ElementResizeConfig { /** Defines the desired new width of the element */ width?: number; /** Defines the desired new height of the element */ height?: number; } /** An object describing a workspace layout without the underlying structure */ export interface WorkspaceLayoutSummary { /** An unique string name and identifier of the layout */ name: string; /** * The name of the workspaces app with which the layout is associated. * *Available only in **io.Connect Desktop**.* */ applicationName?: string; } export interface EmptyFrameDefinition { /** * The application name of the workspace app that should be used for the new frame. * *Available only in **io.Connect Desktop**.* */ applicationName?: string; /** * Optional frame related settings */ frameConfig?: IOConnectWorkspaces.NewFrameConfig; /** * Optional context which will be passed to the initialization callback */ context?: object; /** * Optional the id of the layout component which is being restored */ layoutComponentId?: string; } export interface FrameInitializationConfig { /** * Array of workspace definitions with which the frame should be opened */ workspaces: Array<IOConnectWorkspaces.WorkspaceDefinition | RestoreWorkspaceDefinition>; } export interface FrameInitializationContext { /** * Context passed when the frame was created */ context?: object; } /** An object describing the basic details of a frame */ export interface FrameSummary { /** An unique string identifier of the frame */ id: string; /** Indicates whether the frame has been initialized or not */ isInitialized: boolean; } /** * Describes a Frame (a Workspaces App instance). */ export interface Frame extends FrameSummary { /** * Registers a keyboard shortcut for the current Frame. * @param shortcut Keyboard combination to register as a shortcut for the Frame (e.g., "ctrl+w"). * @param callback Callback that will be invoked when the Frame for which the shortcut is registered * is on focus and the user presses the registered keyboard combination. * *Available only in **io.Connect Desktop**.* */ registerShortcut(shortcut: string, callback: () => void): Promise<Unsubscribe>; /** * Retrieves the current bounds of the Frame. */ getBounds(): Promise<FrameBounds>; /** * Resizes the Frame. * @param config Options for resizing the Frame. */ resize(config: ResizeConfig): Promise<void>; /** * Moves the Frame. * @param config Options for moving the Frame. */ move(config: MoveConfig): Promise<void>; /** * Focuses the Frame. */ focus(): Promise<void>; /** * Returns the current state of the Frame. * *Available only in **io.Connect Desktop**.* */ state(): Promise<FrameState>; /** * Minimizes the Frame. * *Available only in **io.Connect Desktop**.* */ minimize(): Promise<void>; /** * Maximizes the Frame. * *Available only in **io.Connect Desktop**.* */ maximize(): Promise<void>; /** * Restores the Frame. * *Available only in **io.Connect Desktop**.* */ restore(): Promise<void>; /** * Closes the Frame. * The result from using this method in **io.Connect Browser** projects may vary depending on whether the browser will allow the closing operation. * @param options Options for closing the Frame. */ close(options?: FrameCloseOptions): Promise<void>; /** * Initializes the frame with the provided workspaces in the config when the frame has been opened as empty * @param config The configuration with which the frame will be initialized */ init(config: FrameInitializationConfig): Promise<void>; /** * Retrieves the taskbar icon of the `Frame` instance. * *Available only for **io.Connect Desktop**.* * @since io.Connect Desktop 9.9 */ getIcon(): Promise<Icon>; /** * Sets the taskbar icon of the `Frame` instance. * *Available only for **io.Connect Desktop**.* * @param icon New icon to be displayed in the taskbar for the `Frame` instance. The icon must be encoded as a Base64 string. * @since io.Connect Desktop 9.9 */ setIcon(icon: Icon): Promise<void>; /** * Returns an object detailing the current state of this frame. */ snapshot(): Promise<FrameSnapshot>; /** * Returns a collection of all workspaces present in this frame. */ workspaces(): Promise<Workspace[]>; /** * Returns the current size constraints this frame. The constraints are calculated using all of the individual constraints of the elements within the workspaces in the frame. */ getConstraints(): Promise<FrameConstraints>; /** * Retrieves the current visibility state of the Workspaces Frame instance. * *Available only in **io.Connect Desktop**.* * @since io.Connect Desktop 9.9.5 */ isVisible(): Promise<boolean>; /** * Shows the Workspaces Frame instance if it has been previously hidden. * *Available only in **io.Connect Desktop**.* * @since io.Connect Desktop 9.9.5 */ show(config?: FrameShowConfig): Promise<void>; /** * Hides the Workspaces Frame instance if it's currently visible. * *Available only in **io.Connect Desktop**.* * @since io.Connect Desktop 9.9.5 */ hide(): Promise<void>; /** * Opens a new workspace in this frame by restoring a previously saved workspace layout. * @param name The name of a saved workspace layout, which will be restored. * @param options An optional object containing various workspace restore options. */ restoreWorkspace(name: string, options?: RestoreWorkspaceConfig): Promise<Workspace>; /** * Opens a new workspace in this frame based on the provided definition. * @param definition An object describing the shape and options of the workspace. * @param saveConfig An object used to set various create options. */ createWorkspace(definition: WorkspaceDefinition, config?: WorkspaceCreateConfig): Promise<Workspace>; /** * Notifies when the Frame is about to be closed. * *Available only for io.Connect Desktop.* * @param callback Callback function for handling the event. Receives as an argument an object with options for closing the Frame. * @since io.Connect Desktop 9.9 */ onClosing(callback: (options: FrameClosingData) => void | Promise<void>): Promise<Unsubscribe>; /** * Notifies when this frame is closed. * @param callback Callback function to handle the event. */ onClosed(callback: (closed: FrameClosedData) => void): Promise<Unsubscribe>; /** * Notifies when this frame is maximized. * This event is not supported in **io.Connect Browser**. * @param callback Callback function to handle the event. */ onMaximized(callback: () => void): Promise<Unsubscribe>; /** * Notifies when this frame is closed. * This event is not supported in **io.Connect Browser**. * @param callback Callback function to handle the event. */ onMinimized(callback: () => void): Promise<Unsubscribe>; /** * Notifies when this frame is closed. * This event is not supported in **io.Connect Browser**. * @param callback Callback function to handle the event. */ onNormal(callback: () => void): Promise<Unsubscribe>; /** * Triggered when either a window in the frame is focused or the frame itself. * *Available only in **io.Connect Desktop**.* * @param callback Callback function to handle the event. It receives a data oject which indicates how the focus has changed. */ onFocusChanged(callback: (data: FrameFocusChangedData) => void): Promise<IOConnectWorkspaces.Unsubscribe>; /** * Notifies when a the frame is created without being initialized. * @param callback Callback function to handle the event. Receives a context for the initialization request */ onInitializationRequested(callback: (context?: IOConnectWorkspaces.FrameInitializationContext) => void): Promise<Unsubscribe>; /** * Notifies when a new workspace was opened in this frame and returns an unsubscribe function. * @param callback Callback function to handle the event. Receives the added workspace as a parameter. */ onWorkspaceOpened(callback: (workspace: Workspace) => void): Promise<Unsubscribe>; /** * Notifies when a workspace is selected in this frame and returns an unsubscribe function. * @param callback Callback function to handle the event. Receives the selected workspace as a parameter. */ onWorkspaceSelected(callback: (workspace: Workspace) => void): Promise<Unsubscribe>; /** * Notifies when a workspace present in this frame was closed and returns an unsubscribe function. * @param callback Callback function to handle the event. Receives an object with the closed workspace id and frame id as a parameter. */ onWorkspaceClosed(callback: (closed: { frameId: string; workspaceId: string }) => void): Promise<Unsubscribe>; /** * Notifies when a new window was added to a workspace part of this frame and returns an unsubscribe function. * An added window means that the window has a place in the workspace (it is a valid workspace element), but does not guarantee that the contents of the window are loaded. * @param callback Callback function to handle the event. Receives the added window as a parameter. */ onWindowAdded(callback: (window: WorkspaceWindow) => void): Promise<Unsubscribe>; /** * Notifies when a window was removed from a workspace part of this frame and returns an unsubscribe function. * @param callback Callback function to handle the event. Receives an object containing the ids of the removed window, and the respective workspace and frame as a parameter. */ onWindowRemoved(callback: (removed: { windowId?: string; workspaceId: string; frameId: string }) => void): Promise<Unsubscribe>; /** * Notifies when a window's content was loaded in a workspace part of this frame and returns an unsubscribe function. * A loaded window is a window, which was added to a workspace, it's contents were loaded and is present in the windows collection. * @param callback Callback function to handle the event. Receives the loaded window as a parameter. */ onWindowLoaded(callback: (window: WorkspaceWindow) => void): Promise<Unsubscribe>; } /** An object describing the basic details of a workspace */ export interface WorkspaceSummary { /** An unique string identifier of the workspace */ id: string; /** The string id of the frame containing this workspace */ frameId: string; /** The position of this workspace regarding it's siblings */ positionIndex: number; /** The title of the workspace */ title: string; /** The name of the originating layout of the current workspace if any */ layoutName: string | undefined; /** Indicates if the workspace is hibernated */ isHibernated?: boolean; /** Indicates if the workspace is selected in its frame. Can be undefined if using with an older version of **io.Connect Desktop** or **io.Connect Browser**. */ isSelected?: boolean; /** Indicates if dragging of splitters is allowed in the workspace */ allowSplitters?: boolean; /** Indicates if dropping outsize windows to the workspace is allowed */ allowDrop?: boolean; /** Indicates if dropping windows in the left-most zone of the workspace is allowed */ allowDropLeft?: boolean; /** Indicates if dropping windows in the top-most zone of the workspace is allowed */ allowDropTop?: boolean; /** Indicates if dropping windows in the right-most zone of the workspace is allowed */ allowDropRight?: boolean; /** Indicates if dropping windows in the bottom-most zone of the workspace is allowed */ allowDropBottom?: boolean; /** Indicates if extracting windows from the workspace is allowed */ allowExtract?: boolean; /** Indicates if reordering windows in the workspace is allowed */ allowWindowReorder?: boolean; /** Indicates if the close button for this workspace is visible to the user */ showCloseButton?: boolean; /** Indicates if the save button for this workspace is visible to the user */ showSaveButton?: boolean; /** * Controls whether the workspace tab can be extracted. * *Available only in **io.Connect Desktop**.* */ allowWorkspaceTabExtract?: boolean; /** Controls whether the workspace tab can be reordered*/ allowWorkspaceTabReorder?: boolean; /** Returns the minimum width of the workspace, calculated by the constraints of all elements inside it */ minWidth?: number; /** Returns the minimum height of the workspace, calculated by the constraints of all elements inside it */ minHeight?: number; /** Returns the maximum width of the workspace, calculated by the constraints of all elements inside it */ maxWidth?: number; /** Returns the maximum height of the workspace, calculated by the constraints of all elements inside it */ maxHeight?: number; /** Returns the current width of the workspace */ width?: number; /** Returns the current height of the workspace */ height?: number; /** Indicates if the close buttons of the windows within this workspace are visible to the user */ showWindowCloseButtons?: boolean; /** Indicates if the eject buttons of the windows within this workspace are visible to the user */ showEjectButtons?: boolean; /** Indicates if the window add buttons within this workspace are visible to the user */ showAddWindowButtons?: boolean; /** * Indicates the loading strategy for the Workspace. * *Available only in **io.Connect Desktop**.* */ loadingStrategy?: LoadingStrategy; /** * Indicates whether the Workspace can be hibernated via the platform configuration. * This setting doesn't apply to programmatic hibernation via the `hibernate()` method of a `Workspace` instance. */ allowSystemHibernation?: boolean; } /** An object describing a workspace */ export interface Workspace extends WorkspaceSummary { /** A collection containing the immediate children of this workspace */ children: WorkspaceElement[]; /** An object representing the frame containing this workspace */ frame: Frame; /** * Gives focus to this workspace. */ focus(): Promise<void>; /** * Closes this workspace and all of it's children. */ close(): Promise<void>; /** * Returns a snapshot object describing the full current state of this workspace. */ snapshot(): Promise<WorkspaceSnapshot>; /** * Sets a new title for this workspace. * @param title The new title value. */ setTitle(title: string): Promise<void>; /** * Gets the context for this workspace. */ getContext(): Promise<any>; /** * Sets the context for this workspace. This operation will completely overwrite the existing context. * @param data The new context value. */ setContext(data: any): Promise<void>; /** * Updated the context for this workspace. This operation will merge the existing context with the provided value. * @param data The context value to update. */ updateContext(data: any): Promise<void>; /** * Notifies when the context for this workspace was updated. * @param callback Callback function to handle the event. */ onContextUpdated(callback: (data: any) => void): Promise<Unsubscribe>; /** * Updates this workspace reference to reflect the current state of the workspace. */ refreshReference(): Promise<void>; /** * Saves the current workspace structure as a layout. In **io.Connect Browser** this will throw an error if the name matches the name of a read-only layout. * @param name A string representing the name (also ID) of the new workspace layout. */ saveLayout(name: string, config?: