super-productivity/electron/electronAPI.d.ts
johannesjo 21472356c7 fix(theme): polish liquid-glass — readability, parity, wallpaper, badges
Round of refinements on top of the Liquid Glass theme to take it from
"works" to "ships":

- Default to Liquid Glass on Apple Silicon Macs. Web / Intel / Linux /
  Windows still default to the system theme. Adds an `isAppleSilicon()`
  preload bridge + `IS_APPLE_SILICON` constant, and a CustomTheme
  default selector that picks Liquid Glass when both Electron and arm64
  are detected.
- macOS title-bar inset for the floating side-nav (titleBarStyle
  switched to 'hiddenInset' so AppKit positions traffic-lights at the
  standard inset other native apps use).
- Wallpaper handling: blur `.bg-image` directly so the whole page sees
  one out-of-focus image (no seam at the side-nav edge), drop
  `.main-content` / side-nav backdrop-filters under `body.hasBgImage`
  so the source-blur isn't re-blurred at different strengths, and hide
  the white/black `.bg-overlay` scrim that was washing out the glass.
- Surface opacity: bump every Tier-A fill (tasks, sub-tasks,
  schedule-events, planner-tasks, cards, banner, right-panel, notes,
  task-detail, attachments, sidenav) to 0.78–0.95 alpha so text reads
  cleanly whether the background is the soft primary-radial gradient
  or a user-selected photo. Light + dark aligned to the same alpha.
- Dark-mode further: tasks / sub-tasks / schedule-events / task-detail
  go fully opaque (deep RGB stepped ~10 units toward black) so content
  surfaces stay legible against the wallpaper while chrome / containers
  keep the soft glass material.
- Schedule weekday / week-column headers: bind to a solid --surface-2
  fill instead of the translucent --bg-lighter / transparent --bg the
  defaults used.
- Task time-badge / repeat-date-badge: solid surface (white in light,
  surface-4 in dark, slightly brighter than the task fill so the badge
  reads as a raised label rather than a recessed hole). Defaults bound
  it to translucent tokens, and the icon underneath bled through.
- Two stylelint suppressions for the new layered-token sections in
  _css-variables.scss (Cat B follows Layer 1 primitives on the same
  body / body.isDarkTheme selector — intentional duplicate).
2026-05-09 11:16:25 +02:00

231 lines
5.6 KiB
TypeScript

import { IpcRendererEvent } from 'electron';
import {
GlobalConfigState,
TakeABreakConfig,
TaskWidgetConfig,
} from '../src/app/features/config/global-config.model';
import { KeyboardConfig } from '../src/app/features/config/keyboard-config.model';
import { JiraCfg } from '../src/app/features/issue/providers/jira/jira.model';
import { AppDataCompleteLegacy } from '../src/app/imex/sync/sync.model';
import { Task } from '../src/app/features/tasks/task.model';
import { LocalBackupMeta } from '../src/app/imex/local-backup/local-backup.model';
import { AppDataComplete } from '../src/app/op-log/model/model-config';
import {
PluginNodeScriptRequest,
PluginNodeScriptResult,
PluginManifest,
} from '../packages/plugin-api/src/types';
import {
LocalRestApiRequestPayload,
LocalRestApiResponsePayload,
} from './shared-with-frontend/local-rest-api.model';
export interface ElectronAPI {
on(
channel: string,
listener: (event: IpcRendererEvent, ...args: unknown[]) => void,
): void;
// INVOKE
// ------
getUserDataPath(): Promise<string>;
getBackupPath(): Promise<string>;
checkBackupAvailable(): Promise<false | LocalBackupMeta>;
loadBackupData(backupPath: string): Promise<string>;
fileSyncSave(args: {
filePath: string;
localRev: string | null;
dataStr: string;
}): Promise<string | Error>;
fileSyncLoad(args: {
filePath: string;
localRev: string | null;
}): Promise<{ rev: string; dataStr: string | undefined } | Error>;
fileSyncRemove(args: { filePath: string }): Promise<unknown | Error>;
fileSyncListFiles(args: { dirPath: string }): Promise<string[] | Error>;
checkDirExists(args: { dirPath: string }): Promise<true | Error>;
pickDirectory(): Promise<string | undefined>;
showOpenDialog(options: {
properties: string[];
title?: string;
defaultPath?: string;
}): Promise<string[] | undefined>;
// checkDirExists(dirPath: string): Promise<true | Error>;
// STANDARD
// --------
setZoomFactor(zoomFactor: number): void;
getZoomFactor(): number;
openPath(path: string): void;
openExternalUrl(url: string): void;
saveFileDialog(
filename: string,
data: string,
): Promise<{ success: boolean; path?: string }>;
shareNative(payload: {
text?: string;
url?: string;
title?: string;
files?: string[];
}): Promise<{ success: boolean; error?: string }>;
isLinux(): boolean;
isGnomeDesktop(): boolean;
isMacOS(): boolean;
isAppleSilicon(): boolean;
isSnap(): boolean;
isFlatpak(): boolean;
// CLIPBOARD IMAGES
// ----------------
saveClipboardImage(
basePath: string,
fileName: string,
base64Data: string,
mimeType: string,
): Promise<string>;
loadClipboardImage(
basePath: string,
imageId: string,
): Promise<{ base64: string; mimeType: string } | null>;
deleteClipboardImage(basePath: string, imageId: string): Promise<boolean>;
listClipboardImages(
basePath: string,
): Promise<{ id: string; mimeType: string; createdAt: number; size: number }[]>;
getClipboardImagePath(basePath: string, imageId: string): Promise<string | null>;
getClipboardFilePaths(): Promise<string[]>;
copyClipboardImageFile(
basePath: string,
filePath: string,
): Promise<{
id: string;
mimeType: string;
size: number;
createdAt: number;
} | null>;
readClipboardImage(basePath: string): Promise<{
id: string;
mimeType: string;
size: number;
createdAt: number;
} | null>;
getPathForFile(file: File): string | null;
// SEND
// ----
reloadMainWin(): void;
openDevTools(): void;
showEmojiPanel(): void;
relaunch(): void;
exit(exitCode: number): void;
shutdownNow(): void;
flashFrame(): void;
showOrFocus(): void;
lockScreen(): void;
informAboutAppReady(): void;
scheduleRegisterBeforeClose(id: string): void;
unscheduleRegisterBeforeClose(id: string): void;
setDoneRegisterBeforeClose(id: string): void;
setProgressBar(args: {
progress: number;
progressBarMode: 'normal' | 'pause' | 'none';
}): void;
sendAppSettingsToElectron(globalCfg: GlobalConfigState): void;
sendSettingsUpdate(globalCfg: GlobalConfigState): void;
updateTaskWidgetSettings(cfg: TaskWidgetConfig): void;
updateTitleBarDarkMode(isDarkMode: boolean): void;
registerGlobalShortcuts(keyboardConfig: KeyboardConfig): void;
showFullScreenBlocker(args: { msg?: string; takeABreakCfg: TakeABreakConfig }): void;
// TODO use invoke instead
makeJiraRequest(args: {
requestId: string;
url: string;
requestInit: RequestInit;
jiraCfg: JiraCfg;
}): void;
jiraSetupImgHeaders(args: { jiraCfg: JiraCfg }): void;
backupAppData(appData: AppDataCompleteLegacy | AppDataComplete): void;
updateCurrentTask(
task: Task | null,
isPomodoroEnabled: boolean,
currentPomodoroSessionTime: number,
isFocusModeEnabled?: boolean,
currentFocusSessionTime?: number,
focusModeMode?: string,
);
updateTodayTasks(
tasks: { id: string; title: string; timeEstimate: number; timeSpent: number }[],
): void;
onSwitchTask(listener: (taskId: string) => void): void;
exec(command: string): void;
pluginExecNodeScript(
pluginId: string,
manifest: PluginManifest,
request: PluginNodeScriptRequest,
): Promise<PluginNodeScriptResult>;
// Plugin OAuth
pluginOAuthPrepare(): Promise<{ port: number }>;
pluginOAuthStart(url: string): void;
onPluginOAuthCb(
listener: (data: { code?: string; error?: string; state?: string }) => void,
): void;
onLocalRestApiRequest(listener: (payload: LocalRestApiRequestPayload) => void): void;
sendLocalRestApiResponse(payload: LocalRestApiResponsePayload): void;
}