storebound/apps/desktop/vite.config.ts
CRT 5236f002f1 desktop: tray menu panels and pinnable context menus
The tray's right-click menu is drawn by the app: one tree from tray.rs
(stable submenu keys), one frameless always-on-top menu-N window per
panel rendered by tray-menu.html with the design system, placed inside
the monitor's work area. A pure panel book keeps transient and pinned
panels apart; pinned panels (pin button, Ctrl+click, middle click) are
draggable, step aside from each other and are saved in state.json
(menuPins) and restored at start. tray_update pushes the tree to the
open panels, which update in place; closed panels are destroyed. The
native menu, rendered from the same tree, stays as the fallback and on
Linux. Only menu-* windows get the menu_* commands (menu.json).

In-app context menus get the same behaviour through a pure menu stack
(ui/menu-stack.ts): pin a menu, tear off a submenu, pinned panels
survive the next menu, are draggable and re-read their entries from
live sources so data changes update them in place.

Also drops a stray diff3 marker line from CHANGELOG.md.
2026-10-24 13:44:08 +08:00

23 lines
1 KiB
TypeScript

import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { freezeSafe } from './build/freeze-safe';
// Tauri loads the dev server from build.devUrl (http://127.0.0.1:1420) and the built files from ../dist.
export default defineConfig({
// freezeSafe: the bundle must load under Tauri's frozen Object.prototype (build/freeze-safe.ts)
plugins: [freezeSafe(), react()],
clearScreen: false,
server: { host: '127.0.0.1', port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } },
build: {
target: ['safari15', 'chrome110'],
outDir: 'dist',
emptyOutDir: true,
sourcemap: false,
// no inline scripts or styles: the CSP is script-src 'self', style-src 'self'
assetsInlineLimit: 0,
cssCodeSplit: false,
// three pages: the main window, the tray card (pre-created hidden by src-tauri/src/card.rs) and the tray menu panels
// (one window per panel, src-tauri/src/menu_panel.rs)
rollupOptions: { input: { main: 'index.html', card: 'card.html', menu: 'tray-menu.html' } },
},
});