Rebuild of the kanban scaling logic, and adding constraints to window scaling logic for electron and web

This commit is contained in:
trueheads
2025-12-21 16:47:21 -06:00
parent ee9ccd03d6
commit 9beefd1ac3
10 changed files with 1918 additions and 266 deletions

View File

@@ -5,38 +5,42 @@
* All other operations go through HTTP API.
*/
import { contextBridge, ipcRenderer, OpenDialogOptions, SaveDialogOptions } from "electron";
import { contextBridge, ipcRenderer, OpenDialogOptions, SaveDialogOptions } from 'electron';
// Expose minimal API for native features
contextBridge.exposeInMainWorld("electronAPI", {
contextBridge.exposeInMainWorld('electronAPI', {
// Platform info
platform: process.platform,
isElectron: true,
// Connection check
ping: (): Promise<string> => ipcRenderer.invoke("ping"),
ping: (): Promise<string> => ipcRenderer.invoke('ping'),
// Get server URL for HTTP client
getServerUrl: (): Promise<string> => ipcRenderer.invoke("server:getUrl"),
getServerUrl: (): Promise<string> => ipcRenderer.invoke('server:getUrl'),
// Native dialogs - better UX than prompt()
openDirectory: (): Promise<Electron.OpenDialogReturnValue> =>
ipcRenderer.invoke("dialog:openDirectory"),
ipcRenderer.invoke('dialog:openDirectory'),
openFile: (options?: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue> =>
ipcRenderer.invoke("dialog:openFile", options),
ipcRenderer.invoke('dialog:openFile', options),
saveFile: (options?: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue> =>
ipcRenderer.invoke("dialog:saveFile", options),
ipcRenderer.invoke('dialog:saveFile', options),
// Shell operations
openExternalLink: (url: string): Promise<{ success: boolean; error?: string }> =>
ipcRenderer.invoke("shell:openExternal", url),
ipcRenderer.invoke('shell:openExternal', url),
openPath: (filePath: string): Promise<{ success: boolean; error?: string }> =>
ipcRenderer.invoke("shell:openPath", filePath),
ipcRenderer.invoke('shell:openPath', filePath),
// App info
getPath: (name: string): Promise<string> => ipcRenderer.invoke("app:getPath", name),
getVersion: (): Promise<string> => ipcRenderer.invoke("app:getVersion"),
isPackaged: (): Promise<boolean> => ipcRenderer.invoke("app:isPackaged"),
getPath: (name: string): Promise<string> => ipcRenderer.invoke('app:getPath', name),
getVersion: (): Promise<string> => ipcRenderer.invoke('app:getVersion'),
isPackaged: (): Promise<boolean> => ipcRenderer.invoke('app:isPackaged'),
// Window management
updateMinWidth: (sidebarExpanded: boolean): Promise<void> =>
ipcRenderer.invoke('window:updateMinWidth', sidebarExpanded),
});
console.log("[Preload] Electron API exposed (TypeScript)");
console.log('[Preload] Electron API exposed (TypeScript)');