mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-21 16:16:11 +00:00
- Updated `@theia/*` to `1.37.0`. - Fixed all `yarn audit` security vulnerabilities. - Updated to `electron@23.2.4`: - `contextIsolation` is `true`, - `nodeIntegration` is `false`, and the - `webpack` target is moved from `electron-renderer` to `web`. - Updated to `typescript@4.9.3`. - Updated the `eslint` plugins. - Added the new `Light High Contrast` theme to the IDE2. - High contrast themes use Theia APIs for style adjustments. - Support for ESM modules: `"moduleResolution": "node16"`. - Node.js >= 16.14 is required. - VISX langage packs were bumped to `1.70.0`. - Removed undesired editor context menu items. (Closes #1394) Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
93 lines
3.8 KiB
TypeScript
93 lines
3.8 KiB
TypeScript
import type {
|
|
MessageBoxOptions as ElectronMessageBoxOptions,
|
|
MessageBoxReturnValue as ElectronMessageBoxReturnValue,
|
|
OpenDialogOptions as ElectronOpenDialogOptions,
|
|
OpenDialogReturnValue as ElectronOpenDialogReturnValue,
|
|
SaveDialogOptions as ElectronSaveDialogOptions,
|
|
SaveDialogReturnValue as ElectronSaveDialogReturnValue,
|
|
} from '@theia/core/electron-shared/electron';
|
|
import type { Disposable } from '@theia/core/lib/common/disposable';
|
|
import type {
|
|
InternalMenuDto as TheiaInternalMenuDto,
|
|
MenuDto,
|
|
} from '@theia/core/lib/electron-common/electron-api';
|
|
import type { Sketch } from '../common/protocol/sketches-service';
|
|
import type { StartupTasks } from './startup-task';
|
|
|
|
export interface InternalMenuDto
|
|
extends Omit<TheiaInternalMenuDto, 'handlerId'> {
|
|
// Theia handles the menus with a running-index handler ID. https://github.com/eclipse-theia/theia/issues/12493
|
|
// IDE2 keeps the menu `nodeId` instead of the running-index.
|
|
nodeId?: string;
|
|
}
|
|
|
|
export type MessageBoxOptions = Omit<
|
|
ElectronMessageBoxOptions,
|
|
'icon' | 'signal'
|
|
>;
|
|
export type MessageBoxReturnValue = ElectronMessageBoxReturnValue;
|
|
export type OpenDialogOptions = ElectronOpenDialogOptions;
|
|
export type OpenDialogReturnValue = ElectronOpenDialogReturnValue;
|
|
export type SaveDialogOptions = ElectronSaveDialogOptions;
|
|
export type SaveDialogReturnValue = ElectronSaveDialogReturnValue;
|
|
|
|
export interface ShowPlotterWindowParams {
|
|
readonly url: string;
|
|
readonly forceReload?: boolean;
|
|
}
|
|
export function isShowPlotterWindowParams(
|
|
arg: unknown
|
|
): arg is ShowPlotterWindowParams {
|
|
return (
|
|
typeof arg === 'object' &&
|
|
typeof (<ShowPlotterWindowParams>arg).url === 'string' &&
|
|
((<ShowPlotterWindowParams>arg).forceReload === undefined ||
|
|
typeof (<ShowPlotterWindowParams>arg).forceReload === 'boolean')
|
|
);
|
|
}
|
|
|
|
export interface ElectronArduino {
|
|
showMessageBox(options: MessageBoxOptions): Promise<MessageBoxReturnValue>;
|
|
showOpenDialog(options: OpenDialogOptions): Promise<OpenDialogReturnValue>;
|
|
showSaveDialog(options: SaveDialogOptions): Promise<SaveDialogReturnValue>;
|
|
appVersion(): Promise<string>;
|
|
quitApp(): void;
|
|
isFirstWindow(): Promise<boolean>;
|
|
requestReload(tasks: StartupTasks): void;
|
|
registerStartupTasksHandler(
|
|
handler: (tasks: StartupTasks) => void
|
|
): Disposable;
|
|
scheduleDeletion(sketch: Sketch): void;
|
|
setRepresentedFilename(fsPath: string): void;
|
|
showPlotterWindow(params: { url: string; forceReload?: boolean }): void;
|
|
registerPlotterWindowCloseHandler(handler: () => void): Disposable;
|
|
openPath(fsPath: string): void;
|
|
// Unlike the Theia implementation, IDE2 uses the command IDs, and not the running-index handler IDs.
|
|
// https://github.com/eclipse-theia/theia/issues/12493
|
|
setMenu(menu: MenuDto[] | undefined): void;
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
electronArduino: ElectronArduino;
|
|
}
|
|
}
|
|
|
|
// renderer to main
|
|
export const CHANNEL_SHOW_MESSAGE_BOX = 'Arduino:ShowMessageBox';
|
|
export const CHANNEL_SHOW_OPEN_DIALOG = 'Arduino:ShowOpenDialog';
|
|
export const CHANNEL_SHOW_SAVE_DIALOG = 'Arduino:ShowSaveDialog';
|
|
export const CHANNEL_APP_VERSION = 'Arduino:AppVersion';
|
|
export const CHANNEL_QUIT_APP = 'Arduino:QuitApp';
|
|
export const CHANNEL_IS_FIRST_WINDOW = 'Arduino:IsFirstWindow';
|
|
export const CHANNEL_SCHEDULE_DELETION = 'Arduino:ScheduleDeletion';
|
|
export const CHANNEL_SET_REPRESENTED_FILENAME =
|
|
'Arduino:SetRepresentedFilename';
|
|
export const CHANNEL_SHOW_PLOTTER_WINDOW = 'Arduino:ShowPlotterWindow';
|
|
export const CHANNEL_OPEN_PATH = 'Arduino:OpenPath';
|
|
export const CHANNEL_SET_MENU_WITH_NODE_ID = 'Arduino:SetMenuWithNodeId';
|
|
// main to renderer
|
|
export const CHANNEL_SEND_STARTUP_TASKS = 'Arduino:SendStartupTasks';
|
|
export const CHANNEL_PLOTTER_WINDOW_DID_CLOSE = 'Arduino:PlotterWindowDidClose';
|
|
export const CHANNEL_MAIN_MENU_ITEM_DID_CLICK = 'Arduino:MainMenuItemDidClick';
|