@m3ui-vue/electron 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"preload.js","names":["contextBridge","ipcRenderer","IPC","BRIDGE_KEY","createM3Bridge","listener","handler","_e","state","action","colors","theme","value","count","color","exposeM3UI","bridge"],"sources":["../src/preload.ts"],"sourcesContent":["/**\n * `@m3ui-vue/electron/preload`: exposes the bridge MTitleBar talks through.\n *\n * ```ts\n * // preload.ts (bundled, as electron-vite does)\n * import { exposeM3UI } from '@m3ui-vue/electron/preload'\n * exposeM3UI()\n * ```\n *\n * A sandboxed preload can't `require` npm packages at runtime: bundle it, or paste `createM3Bridge()`'s body (it only\n * needs `ipcRenderer`).\n */\nimport { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'\nimport type { M3Bridge, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowState } from './shared'\n\n// Copies of shared.ts's constants (a test keeps them equal): with no runtime import, the built preload is one\n// self-contained file, which a sandboxed preload needs (it can only `require('electron')`)\nconst IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n} as const\nconst BRIDGE_KEY = 'm3ui'\nexport { IPC as _IPC, BRIDGE_KEY as _BRIDGE_KEY }\n\nexport type { M3Bridge } from './shared'\n\n/** The bridge itself, to expose it yourself (it must end up as `window.m3ui`) */\nexport function createM3Bridge(): M3Bridge {\n return {\n info: () => ipcRenderer.invoke(IPC.info),\n onState(listener: (state: M3WindowState) => void) {\n const handler = (_e: IpcRendererEvent, state: M3WindowState) => listener(state)\n ipcRenderer.on(IPC.state, handler)\n return () => { ipcRenderer.removeListener(IPC.state, handler) }\n },\n action: (action: M3WindowAction) => ipcRenderer.send(IPC.action, action),\n setOverlay: (colors: M3OverlayColors) => ipcRenderer.send(IPC.overlay, { color: colors.color, symbolColor: colors.symbolColor }),\n setTheme: (theme: M3NativeTheme) => ipcRenderer.send(IPC.theme, theme),\n setProgress: (value: number | 'indeterminate' | null) => ipcRenderer.send(IPC.progress, value),\n setBadge: (count: number) => ipcRenderer.send(IPC.badge, count),\n attention: () => ipcRenderer.send(IPC.attention),\n onAccent(listener: (color: string | null) => void) {\n const handler = (_e: IpcRendererEvent, color: string | null) => listener(color)\n ipcRenderer.on(IPC.accent, handler)\n return () => { ipcRenderer.removeListener(IPC.accent, handler) }\n },\n }\n}\n\n/**\n * Exposes the bridge as `window.m3ui`, where `useElectronWindow()` and MTitleBar look for it. Uses `contextBridge`\n * when context isolation is on (the default), a plain global otherwise.\n */\nexport function exposeM3UI(): void {\n const bridge = createM3Bridge()\n if (process.contextIsolated) contextBridge.exposeInMainWorld(BRIDGE_KEY, bridge)\n else (globalThis as unknown as Record<string, unknown>)[BRIDGE_KEY] = bridge\n}\n"],"mappings":";;AAiBA,IAAME,IAAM;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;CACT,OAAO;CACP,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;AACV,GACMC,IAAa;AAMnB,SAAgBC,IAA2B;CACzC,OAAO;EACL,YAAYH,EAAY,OAAOC,EAAI,IAAI;EACvC,QAAQG,GAA0C;GAChD,IAAMC,KAAWC,GAAsBC,MAAyBH,EAASG,CAAK;GAE9E,OADAP,EAAY,GAAGC,EAAI,OAAOI,CAAO,SACpB;IAAEL,EAAY,eAAeC,EAAI,OAAOI,CAAO;GAAE;EAChE;EACA,SAASG,MAA2BR,EAAY,KAAKC,EAAI,QAAQO,CAAM;EACvE,aAAaC,MAA4BT,EAAY,KAAKC,EAAI,SAAS;GAAE,OAAOQ,EAAO;GAAO,aAAaA,EAAO;EAAY,CAAC;EAC/H,WAAWC,MAAyBV,EAAY,KAAKC,EAAI,OAAOS,CAAK;EACrE,cAAcC,MAA2CX,EAAY,KAAKC,EAAI,UAAUU,CAAK;EAC7F,WAAWC,MAAkBZ,EAAY,KAAKC,EAAI,OAAOW,CAAK;EAC9D,iBAAiBZ,EAAY,KAAKC,EAAI,SAAS;EAC/C,SAASG,GAA0C;GACjD,IAAMC,KAAWC,GAAsBO,MAAyBT,EAASS,CAAK;GAE9E,OADAb,EAAY,GAAGC,EAAI,QAAQI,CAAO,SACrB;IAAEL,EAAY,eAAeC,EAAI,QAAQI,CAAO;GAAE;EACjE;CACF;AACF;AAMA,SAAgBS,IAAmB;CACjC,IAAMC,IAASZ,EAAe;CAC1B,QAAQ,kBAAiBJ,EAAc,kBAAkBG,GAAYa,CAAM,IACzE,WAAkDb,KAAca;AACxE"}
1
+ {"version":3,"file":"preload.js","names":["contextBridge","ipcRenderer","IPC","BRIDGE_KEY","createM3Bridge","listener","handler","_e","state","action","colors","theme","value","count","color","menus","id","update","scheme","exposeM3UI","bridge"],"sources":["../src/preload.ts"],"sourcesContent":["/**\n * `@m3ui-vue/electron/preload`: exposes the bridge MTitleBar talks through.\n *\n * ```ts\n * // preload.ts (bundled, as electron-vite does)\n * import { exposeM3UI } from '@m3ui-vue/electron/preload'\n * exposeM3UI()\n * ```\n *\n * A sandboxed preload can't `require` npm packages at runtime: bundle it, or paste `createM3Bridge()`'s body (it only\n * needs `ipcRenderer`).\n */\nimport { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'\nimport type { M3Bridge, M3SplashUpdate, M3NativeMenu, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowState } from './shared'\n\n// Copies of shared.ts's constants (a test keeps them equal): with no runtime import, the built preload is one\n// self-contained file, which a sandboxed preload needs (it can only `require('electron')`)\nconst IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n menu: 'm3ui:menu',\n menuClick: 'm3ui:menu-click',\n splash: 'm3ui:splash',\n splashDone: 'm3ui:splash-done',\n splashColors: 'm3ui:splash-colors',\n} as const\nconst BRIDGE_KEY = 'm3ui'\nexport { IPC as _IPC, BRIDGE_KEY as _BRIDGE_KEY }\n\nexport type { M3Bridge } from './shared'\n\n/** The bridge itself, to expose it yourself (it must end up as `window.m3ui`) */\nexport function createM3Bridge(): M3Bridge {\n return {\n info: () => ipcRenderer.invoke(IPC.info),\n onState(listener: (state: M3WindowState) => void) {\n const handler = (_e: IpcRendererEvent, state: M3WindowState) => listener(state)\n ipcRenderer.on(IPC.state, handler)\n return () => { ipcRenderer.removeListener(IPC.state, handler) }\n },\n action: (action: M3WindowAction) => ipcRenderer.send(IPC.action, action),\n setOverlay: (colors: M3OverlayColors) => ipcRenderer.send(IPC.overlay, { color: colors.color, symbolColor: colors.symbolColor }),\n setTheme: (theme: M3NativeTheme) => ipcRenderer.send(IPC.theme, theme),\n setProgress: (value: number | 'indeterminate' | null) => ipcRenderer.send(IPC.progress, value),\n setBadge: (count: number) => ipcRenderer.send(IPC.badge, count),\n attention: () => ipcRenderer.send(IPC.attention),\n onAccent(listener: (color: string | null) => void) {\n const handler = (_e: IpcRendererEvent, color: string | null) => listener(color)\n ipcRenderer.on(IPC.accent, handler)\n return () => { ipcRenderer.removeListener(IPC.accent, handler) }\n },\n setMenu: (menus: M3NativeMenu[] | null) => ipcRenderer.send(IPC.menu, menus),\n onMenuClick(listener: (id: number) => void) {\n const handler = (_e: IpcRendererEvent, id: number) => listener(id)\n ipcRenderer.on(IPC.menuClick, handler)\n return () => { ipcRenderer.removeListener(IPC.menuClick, handler) }\n },\n splash: (update: M3SplashUpdate) => ipcRenderer.send(IPC.splash, { progress: update.progress, status: update.status }),\n splashDone: () => ipcRenderer.send(IPC.splashDone),\n splashColors: (scheme: 'light' | 'dark', colors: Record<string, string>) => ipcRenderer.send(IPC.splashColors, scheme, { ...colors }),\n }\n}\n\n/**\n * Exposes the bridge as `window.m3ui`, where `useElectronWindow()` and MTitleBar look for it. Uses `contextBridge`\n * when context isolation is on (the default), a plain global otherwise.\n */\nexport function exposeM3UI(): void {\n const bridge = createM3Bridge()\n if (process.contextIsolated) contextBridge.exposeInMainWorld(BRIDGE_KEY, bridge)\n else (globalThis as unknown as Record<string, unknown>)[BRIDGE_KEY] = bridge\n}\n"],"mappings":";;AAiBA,IAAME,IAAM;CACV,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;CACT,OAAO;CACP,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;CACR,MAAM;CACN,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GACMC,IAAa;AAMnB,SAAgBC,IAA2B;CACzC,OAAO;EACL,YAAYH,EAAY,OAAOC,EAAI,IAAI;EACvC,QAAQG,GAA0C;GAChD,IAAMC,KAAWC,GAAsBC,MAAyBH,EAASG,CAAK;GAE9E,OADAP,EAAY,GAAGC,EAAI,OAAOI,CAAO,SACpB;IAAEL,EAAY,eAAeC,EAAI,OAAOI,CAAO;GAAE;EAChE;EACA,SAASG,MAA2BR,EAAY,KAAKC,EAAI,QAAQO,CAAM;EACvE,aAAaC,MAA4BT,EAAY,KAAKC,EAAI,SAAS;GAAE,OAAOQ,EAAO;GAAO,aAAaA,EAAO;EAAY,CAAC;EAC/H,WAAWC,MAAyBV,EAAY,KAAKC,EAAI,OAAOS,CAAK;EACrE,cAAcC,MAA2CX,EAAY,KAAKC,EAAI,UAAUU,CAAK;EAC7F,WAAWC,MAAkBZ,EAAY,KAAKC,EAAI,OAAOW,CAAK;EAC9D,iBAAiBZ,EAAY,KAAKC,EAAI,SAAS;EAC/C,SAASG,GAA0C;GACjD,IAAMC,KAAWC,GAAsBO,MAAyBT,EAASS,CAAK;GAE9E,OADAb,EAAY,GAAGC,EAAI,QAAQI,CAAO,SACrB;IAAEL,EAAY,eAAeC,EAAI,QAAQI,CAAO;GAAE;EACjE;EACA,UAAUS,MAAiCd,EAAY,KAAKC,EAAI,MAAMa,CAAK;EAC3E,YAAYV,GAAgC;GAC1C,IAAMC,KAAWC,GAAsBS,MAAeX,EAASW,CAAE;GAEjE,OADAf,EAAY,GAAGC,EAAI,WAAWI,CAAO,SACxB;IAAEL,EAAY,eAAeC,EAAI,WAAWI,CAAO;GAAE;EACpE;EACA,SAASW,MAA2BhB,EAAY,KAAKC,EAAI,QAAQ;GAAE,UAAUe,EAAO;GAAU,QAAQA,EAAO;EAAO,CAAC;EACrH,kBAAkBhB,EAAY,KAAKC,EAAI,UAAU;EACjD,eAAegB,GAA0BR,MAAmCT,EAAY,KAAKC,EAAI,cAAcgB,GAAQ,EAAE,GAAGR,EAAO,CAAC;CACtI;AACF;AAMA,SAAgBS,IAAmB;CACjC,IAAMC,IAAShB,EAAe;CAC1B,QAAQ,kBAAiBJ,EAAc,kBAAkBG,GAAYiB,CAAM,IACzE,WAAkDjB,KAAciB;AACxE"}
@@ -0,0 +1,15 @@
1
+ import type { MenuBarItem, MenuBarMenu } from '@m3ui-vue/m3ui-vue';
2
+ import type { M3NativeMenu } from '../shared';
3
+ /**
4
+ * MMenuBar's shortcut hint (`'Ctrl+S'`, `'⌘S'`) as an Electron accelerator: Ctrl and ⌘ become `CmdOrCtrl`. A native
5
+ * menu binds it: the key runs the item's `onSelect`.
6
+ */
7
+ export declare function acceleratorOf(shortcut?: string): string | undefined;
8
+ /**
9
+ * The menus as plain data for the main process, and what each id stands for (the item and its menu's index), to run
10
+ * it when main says it was clicked
11
+ */
12
+ export declare function serializeMenus(menus: MenuBarMenu[]): {
13
+ data: M3NativeMenu[];
14
+ picks: Map<number, [MenuBarItem, number]>;
15
+ };
@@ -1,5 +1,5 @@
1
1
  import { type ComputedRef, type Ref } from 'vue';
2
- import { type M3Controls, type M3NativeTheme, type M3OverlayColors } from '../shared';
2
+ import { type M3NativeMenu, type M3Controls, type M3NativeTheme, type M3OverlayColors } from '../shared';
3
3
  /**
4
4
  * The window MTitleBar sits in, from the renderer: its mode and state (reactive) and its buttons. Outside Electron (or
5
5
  * without the preload's bridge) `isElectron` is false, nothing is ever `ready` and the actions do nothing, so the same
@@ -36,6 +36,21 @@ export interface ElectronWindow {
36
36
  setBadge(count: number): void;
37
37
  /** Flashes the taskbar button / bounces the dock icon until the window gets focus */
38
38
  requestAttention(): void;
39
+ /** The preload can set macOS's menu bar (one built before 0.3.0 can't) */
40
+ canSetNativeMenu: boolean;
41
+ /** macOS's menu bar from MTitleBar's `menus` (it does this itself in native mode); `null` puts the app's back */
42
+ setNativeMenu(menus: M3NativeMenu[] | null): void;
43
+ /** Calls `listener` with the id of a native menu item when chosen; returns the unsubscribe */
44
+ onNativeMenuClick(listener: (id: number) => void): () => void;
45
+ /** Updates the bootsplash (`createSplash()` in the main process): its bar (0–1, null for indeterminate) and status */
46
+ splashProgress(value: number | null, status?: string): void;
47
+ /** Tells the bootsplash this window is ready to show (with `splash.handoff(win, { waitForRenderer: true })`) */
48
+ splashDone(): void;
49
+ /**
50
+ * Keeps the page's theme colors (light or dark, and the palette) for the next launch's bootsplash. Done on its own
51
+ * whenever the theme or the palette changes; call it after changing the tokens some other way
52
+ */
53
+ rememberSplashColors(): void;
39
54
  }
40
55
  export declare function useElectronWindow(): ElectronWindow;
41
56
  /** For tests: forget the fetched state */
@@ -0,0 +1,2 @@
1
+ var e={info:`m3ui:info`,state:`m3ui:state`,action:`m3ui:action`,overlay:`m3ui:overlay`,theme:`m3ui:theme`,progress:`m3ui:progress`,badge:`m3ui:badge`,attention:`m3ui:attention`,accent:`m3ui:accent`,menu:`m3ui:menu`,menuClick:`m3ui:menu-click`,splash:`m3ui:splash`,splashDone:`m3ui:splash-done`,splashColors:`m3ui:splash-colors`},t=`m3ui`;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
2
+ //# sourceMappingURL=shared-DS-DQqb1.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-BLenUWPr.cjs","names":["IPC","BRIDGE_KEY"],"sources":["../src/shared.ts"],"sourcesContent":["/**\n * The contract between the three sides: main (`@m3ui-vue/electron/main`), preload (`/preload`) and the renderer\n * (`@m3ui-vue/electron`). Types and IPC channel names only, no runtime dependency on either side.\n */\n\n/**\n * Who draws the window buttons.\n * - `native`: the system does (`titleBarStyle: 'hidden'` + `titleBarOverlay`): Windows 11 snap layouts, macOS\n * traffic lights, Linux's own buttons; their colors follow the M3 theme live.\n * - `custom`: a frameless window (`frame: false`) and MTitleBar draws M3 buttons (or traffic lights) itself.\n */\nexport type M3Controls = 'native' | 'custom'\n\n/** What the main process says about the window, once, when the renderer asks */\nexport interface M3WindowInfo {\n controls: M3Controls\n /** `process.platform` of the main process: `'darwin'`, `'win32'`, `'linux'`… */\n platform: string\n /** Height of the title bar in px (also the native overlay's height) */\n titleBarHeight: number\n state: M3WindowState\n /** The system accent color as `#rrggbb` (Windows and macOS), or null where there's none */\n accentColor: string | null\n}\n\n/** The window's state, sent again on every change */\nexport interface M3WindowState {\n maximized: boolean\n fullscreen: boolean\n focused: boolean\n}\n\nexport type M3WindowAction = 'minimize' | 'toggle-maximize' | 'close'\n\n/** Colors of the native buttons (Windows/Linux `titleBarOverlay`), as hex */\nexport interface M3OverlayColors {\n color: string\n symbolColor: string\n}\n\n/** What the preload exposes to the page (`window.m3ui` by default) */\nexport interface M3Bridge {\n /** Resolves with the window's mode and state */\n info(): Promise<M3WindowInfo>\n /** Calls `listener` on every state change; returns the unsubscribe */\n onState(listener: (state: M3WindowState) => void): () => void\n action(action: M3WindowAction): void\n /** Recolors the native buttons (ignored with `custom` controls and on macOS, whose traffic lights are fixed) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (dialogs, context menus, scrollbars, the frame): `nativeTheme.themeSource` */\n setTheme(theme: M3NativeTheme): void\n /** Taskbar / dock progress, 0–1; `null` removes it, `'indeterminate'` for an unknown amount (Windows) */\n setProgress(value: number | 'indeterminate' | null): void\n /** Badge count on the dock / launcher icon (macOS, Linux Unity launchers); 0 removes it */\n setBadge(count: number): void\n /** Flashes the taskbar button / bounces the dock icon until the window gets focus */\n attention(): void\n /** Calls `listener` when the system accent color changes; returns the unsubscribe */\n onAccent(listener: (color: string | null) => void): () => void\n}\n\nexport type M3NativeTheme = 'light' | 'dark' | 'system'\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n} as const\n\n/** The default key the bridge is exposed under (`window.m3ui`) */\nexport const BRIDGE_KEY = 'm3ui'\n\n/** Default title bar height: Windows 11 caption buttons are 32px, GNOME header bars ~46px; 40 sits between */\nexport const DEFAULT_TITLE_BAR_HEIGHT = 40\n"],"mappings":"AA+DA,IAAaA,EAAM,CACjB,KAAM,YACN,MAAO,aACP,OAAQ,cACR,QAAS,eACT,MAAO,aACP,SAAU,gBACV,MAAO,aACP,UAAW,iBACX,OAAQ,aACV,EAGaC,EAAa,O"}
1
+ {"version":3,"file":"shared-DS-DQqb1.cjs","names":["IPC","BRIDGE_KEY"],"sources":["../src/shared.ts"],"sourcesContent":["/**\n * The contract between the three sides: main (`@m3ui-vue/electron/main`), preload (`/preload`) and the renderer\n * (`@m3ui-vue/electron`). Types and IPC channel names only, no runtime dependency on either side.\n */\n\n/**\n * Who draws the window buttons.\n * - `native`: the system does (`titleBarStyle: 'hidden'` + `titleBarOverlay`): Windows 11 snap layouts, macOS\n * traffic lights, Linux's own buttons; their colors follow the M3 theme live.\n * - `custom`: a frameless window (`frame: false`) and MTitleBar draws M3 buttons (or traffic lights) itself.\n */\nexport type M3Controls = 'native' | 'custom'\n\n/** What the main process says about the window, once, when the renderer asks */\nexport interface M3WindowInfo {\n controls: M3Controls\n /** `process.platform` of the main process: `'darwin'`, `'win32'`, `'linux'`… */\n platform: string\n /** Height of the title bar in px (also the native overlay's height) */\n titleBarHeight: number\n state: M3WindowState\n /** The system accent color as `#rrggbb` (Windows and macOS), or null where there's none */\n accentColor: string | null\n}\n\n/** The window's state, sent again on every change */\nexport interface M3WindowState {\n maximized: boolean\n fullscreen: boolean\n focused: boolean\n}\n\nexport type M3WindowAction = 'minimize' | 'toggle-maximize' | 'close'\n\n/** Colors of the native buttons (Windows/Linux `titleBarOverlay`), as hex */\nexport interface M3OverlayColors {\n color: string\n symbolColor: string\n}\n\n/** What the preload exposes to the page (`window.m3ui` by default) */\nexport interface M3Bridge {\n /** Resolves with the window's mode and state */\n info(): Promise<M3WindowInfo>\n /** Calls `listener` on every state change; returns the unsubscribe */\n onState(listener: (state: M3WindowState) => void): () => void\n action(action: M3WindowAction): void\n /** Recolors the native buttons (ignored with `custom` controls and on macOS, whose traffic lights are fixed) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (dialogs, context menus, scrollbars, the frame): `nativeTheme.themeSource` */\n setTheme(theme: M3NativeTheme): void\n /** Taskbar / dock progress, 0–1; `null` removes it, `'indeterminate'` for an unknown amount (Windows) */\n setProgress(value: number | 'indeterminate' | null): void\n /** Badge count on the dock / launcher icon (macOS, Linux Unity launchers); 0 removes it */\n setBadge(count: number): void\n /** Flashes the taskbar button / bounces the dock icon until the window gets focus */\n attention(): void\n /** Calls `listener` when the system accent color changes; returns the unsubscribe */\n onAccent(listener: (color: string | null) => void): () => void\n /** The app's menus in macOS's menu bar (ignored elsewhere); `null` puts back the menu the app had */\n setMenu(menus: M3NativeMenu[] | null): void\n /** Calls `listener` with the `id` of a native menu item when it's chosen; returns the unsubscribe */\n onMenuClick(listener: (id: number) => void): () => void\n /** Updates the bootsplash (`createSplash()` in the main process) while the app loads */\n splash?(update: M3SplashUpdate): void\n /** Tells the bootsplash this window is ready (`handoff(win, { waitForRenderer: true })`) */\n splashDone?(): void\n /** Remembers the theme's colors for the next launch's bootsplash */\n splashColors?(scheme: 'light' | 'dark', colors: Record<string, string>): void\n}\n\n/** A menu of the native menu bar (macOS), as MTitleBar sends its `menus`: plain data, the clicks come back by id */\nexport interface M3NativeMenu {\n label: string\n enabled: boolean\n items: M3NativeMenuItem[]\n}\n\nexport type M3NativeMenuItem =\n | { type: 'separator' }\n | { type: 'submenu'; label: string; enabled: boolean; items: M3NativeMenuItem[] }\n | { type: 'normal' | 'checkbox'; id: number; label: string; enabled: boolean; checked?: boolean; accelerator?: string }\n\nexport type M3NativeTheme = 'light' | 'dark' | 'system'\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n menu: 'm3ui:menu',\n menuClick: 'm3ui:menu-click',\n splash: 'm3ui:splash',\n splashDone: 'm3ui:splash-done',\n splashColors: 'm3ui:splash-colors',\n} as const\n\n/** A change to the bootsplash: the bar (0–1, null for indeterminate) and/or the status line */\nexport interface M3SplashUpdate {\n progress?: number | null\n status?: string\n}\n\n/** The default key the bridge is exposed under (`window.m3ui`) */\nexport const BRIDGE_KEY = 'm3ui'\n\n/** Default title bar height: Windows 11 caption buttons are 32px, GNOME header bars ~46px; 40 sits between */\nexport const DEFAULT_TITLE_BAR_HEIGHT = 40\n"],"mappings":"AAqFA,IAAaA,EAAM,CACjB,KAAM,YACN,MAAO,aACP,OAAQ,cACR,QAAS,eACT,MAAO,aACP,SAAU,gBACV,MAAO,aACP,UAAW,iBACX,OAAQ,cACR,KAAM,YACN,UAAW,kBACX,OAAQ,cACR,WAAY,mBACZ,aAAc,oBAChB,EASaC,EAAa,O"}
@@ -8,8 +8,13 @@ var e = {
8
8
  progress: "m3ui:progress",
9
9
  badge: "m3ui:badge",
10
10
  attention: "m3ui:attention",
11
- accent: "m3ui:accent"
11
+ accent: "m3ui:accent",
12
+ menu: "m3ui:menu",
13
+ menuClick: "m3ui:menu-click",
14
+ splash: "m3ui:splash",
15
+ splashDone: "m3ui:splash-done",
16
+ splashColors: "m3ui:splash-colors"
12
17
  }, t = "m3ui";
13
18
  export { e as n, t };
14
19
 
15
- //# sourceMappingURL=shared-OD5t8cpt.js.map
20
+ //# sourceMappingURL=shared-DrrWmxv6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-OD5t8cpt.js","names":["IPC","BRIDGE_KEY"],"sources":["../src/shared.ts"],"sourcesContent":["/**\n * The contract between the three sides: main (`@m3ui-vue/electron/main`), preload (`/preload`) and the renderer\n * (`@m3ui-vue/electron`). Types and IPC channel names only, no runtime dependency on either side.\n */\n\n/**\n * Who draws the window buttons.\n * - `native`: the system does (`titleBarStyle: 'hidden'` + `titleBarOverlay`): Windows 11 snap layouts, macOS\n * traffic lights, Linux's own buttons; their colors follow the M3 theme live.\n * - `custom`: a frameless window (`frame: false`) and MTitleBar draws M3 buttons (or traffic lights) itself.\n */\nexport type M3Controls = 'native' | 'custom'\n\n/** What the main process says about the window, once, when the renderer asks */\nexport interface M3WindowInfo {\n controls: M3Controls\n /** `process.platform` of the main process: `'darwin'`, `'win32'`, `'linux'`… */\n platform: string\n /** Height of the title bar in px (also the native overlay's height) */\n titleBarHeight: number\n state: M3WindowState\n /** The system accent color as `#rrggbb` (Windows and macOS), or null where there's none */\n accentColor: string | null\n}\n\n/** The window's state, sent again on every change */\nexport interface M3WindowState {\n maximized: boolean\n fullscreen: boolean\n focused: boolean\n}\n\nexport type M3WindowAction = 'minimize' | 'toggle-maximize' | 'close'\n\n/** Colors of the native buttons (Windows/Linux `titleBarOverlay`), as hex */\nexport interface M3OverlayColors {\n color: string\n symbolColor: string\n}\n\n/** What the preload exposes to the page (`window.m3ui` by default) */\nexport interface M3Bridge {\n /** Resolves with the window's mode and state */\n info(): Promise<M3WindowInfo>\n /** Calls `listener` on every state change; returns the unsubscribe */\n onState(listener: (state: M3WindowState) => void): () => void\n action(action: M3WindowAction): void\n /** Recolors the native buttons (ignored with `custom` controls and on macOS, whose traffic lights are fixed) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (dialogs, context menus, scrollbars, the frame): `nativeTheme.themeSource` */\n setTheme(theme: M3NativeTheme): void\n /** Taskbar / dock progress, 0–1; `null` removes it, `'indeterminate'` for an unknown amount (Windows) */\n setProgress(value: number | 'indeterminate' | null): void\n /** Badge count on the dock / launcher icon (macOS, Linux Unity launchers); 0 removes it */\n setBadge(count: number): void\n /** Flashes the taskbar button / bounces the dock icon until the window gets focus */\n attention(): void\n /** Calls `listener` when the system accent color changes; returns the unsubscribe */\n onAccent(listener: (color: string | null) => void): () => void\n}\n\nexport type M3NativeTheme = 'light' | 'dark' | 'system'\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n} as const\n\n/** The default key the bridge is exposed under (`window.m3ui`) */\nexport const BRIDGE_KEY = 'm3ui'\n\n/** Default title bar height: Windows 11 caption buttons are 32px, GNOME header bars ~46px; 40 sits between */\nexport const DEFAULT_TITLE_BAR_HEIGHT = 40\n"],"mappings":";AA+DA,IAAaA,IAAM;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;CACT,OAAO;CACP,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;AACV,GAGaC,IAAa"}
1
+ {"version":3,"file":"shared-DrrWmxv6.js","names":["IPC","BRIDGE_KEY"],"sources":["../src/shared.ts"],"sourcesContent":["/**\n * The contract between the three sides: main (`@m3ui-vue/electron/main`), preload (`/preload`) and the renderer\n * (`@m3ui-vue/electron`). Types and IPC channel names only, no runtime dependency on either side.\n */\n\n/**\n * Who draws the window buttons.\n * - `native`: the system does (`titleBarStyle: 'hidden'` + `titleBarOverlay`): Windows 11 snap layouts, macOS\n * traffic lights, Linux's own buttons; their colors follow the M3 theme live.\n * - `custom`: a frameless window (`frame: false`) and MTitleBar draws M3 buttons (or traffic lights) itself.\n */\nexport type M3Controls = 'native' | 'custom'\n\n/** What the main process says about the window, once, when the renderer asks */\nexport interface M3WindowInfo {\n controls: M3Controls\n /** `process.platform` of the main process: `'darwin'`, `'win32'`, `'linux'`… */\n platform: string\n /** Height of the title bar in px (also the native overlay's height) */\n titleBarHeight: number\n state: M3WindowState\n /** The system accent color as `#rrggbb` (Windows and macOS), or null where there's none */\n accentColor: string | null\n}\n\n/** The window's state, sent again on every change */\nexport interface M3WindowState {\n maximized: boolean\n fullscreen: boolean\n focused: boolean\n}\n\nexport type M3WindowAction = 'minimize' | 'toggle-maximize' | 'close'\n\n/** Colors of the native buttons (Windows/Linux `titleBarOverlay`), as hex */\nexport interface M3OverlayColors {\n color: string\n symbolColor: string\n}\n\n/** What the preload exposes to the page (`window.m3ui` by default) */\nexport interface M3Bridge {\n /** Resolves with the window's mode and state */\n info(): Promise<M3WindowInfo>\n /** Calls `listener` on every state change; returns the unsubscribe */\n onState(listener: (state: M3WindowState) => void): () => void\n action(action: M3WindowAction): void\n /** Recolors the native buttons (ignored with `custom` controls and on macOS, whose traffic lights are fixed) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (dialogs, context menus, scrollbars, the frame): `nativeTheme.themeSource` */\n setTheme(theme: M3NativeTheme): void\n /** Taskbar / dock progress, 0–1; `null` removes it, `'indeterminate'` for an unknown amount (Windows) */\n setProgress(value: number | 'indeterminate' | null): void\n /** Badge count on the dock / launcher icon (macOS, Linux Unity launchers); 0 removes it */\n setBadge(count: number): void\n /** Flashes the taskbar button / bounces the dock icon until the window gets focus */\n attention(): void\n /** Calls `listener` when the system accent color changes; returns the unsubscribe */\n onAccent(listener: (color: string | null) => void): () => void\n /** The app's menus in macOS's menu bar (ignored elsewhere); `null` puts back the menu the app had */\n setMenu(menus: M3NativeMenu[] | null): void\n /** Calls `listener` with the `id` of a native menu item when it's chosen; returns the unsubscribe */\n onMenuClick(listener: (id: number) => void): () => void\n /** Updates the bootsplash (`createSplash()` in the main process) while the app loads */\n splash?(update: M3SplashUpdate): void\n /** Tells the bootsplash this window is ready (`handoff(win, { waitForRenderer: true })`) */\n splashDone?(): void\n /** Remembers the theme's colors for the next launch's bootsplash */\n splashColors?(scheme: 'light' | 'dark', colors: Record<string, string>): void\n}\n\n/** A menu of the native menu bar (macOS), as MTitleBar sends its `menus`: plain data, the clicks come back by id */\nexport interface M3NativeMenu {\n label: string\n enabled: boolean\n items: M3NativeMenuItem[]\n}\n\nexport type M3NativeMenuItem =\n | { type: 'separator' }\n | { type: 'submenu'; label: string; enabled: boolean; items: M3NativeMenuItem[] }\n | { type: 'normal' | 'checkbox'; id: number; label: string; enabled: boolean; checked?: boolean; accelerator?: string }\n\nexport type M3NativeTheme = 'light' | 'dark' | 'system'\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n menu: 'm3ui:menu',\n menuClick: 'm3ui:menu-click',\n splash: 'm3ui:splash',\n splashDone: 'm3ui:splash-done',\n splashColors: 'm3ui:splash-colors',\n} as const\n\n/** A change to the bootsplash: the bar (0–1, null for indeterminate) and/or the status line */\nexport interface M3SplashUpdate {\n progress?: number | null\n status?: string\n}\n\n/** The default key the bridge is exposed under (`window.m3ui`) */\nexport const BRIDGE_KEY = 'm3ui'\n\n/** Default title bar height: Windows 11 caption buttons are 32px, GNOME header bars ~46px; 40 sits between */\nexport const DEFAULT_TITLE_BAR_HEIGHT = 40\n"],"mappings":";AAqFA,IAAaA,IAAM;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;CACT,OAAO;CACP,UAAU;CACV,OAAO;CACP,WAAW;CACX,QAAQ;CACR,MAAM;CACN,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,cAAc;AAChB,GASaC,IAAa"}
package/dist/shared.d.ts CHANGED
@@ -51,7 +51,38 @@ export interface M3Bridge {
51
51
  attention(): void;
52
52
  /** Calls `listener` when the system accent color changes; returns the unsubscribe */
53
53
  onAccent(listener: (color: string | null) => void): () => void;
54
+ /** The app's menus in macOS's menu bar (ignored elsewhere); `null` puts back the menu the app had */
55
+ setMenu(menus: M3NativeMenu[] | null): void;
56
+ /** Calls `listener` with the `id` of a native menu item when it's chosen; returns the unsubscribe */
57
+ onMenuClick(listener: (id: number) => void): () => void;
58
+ /** Updates the bootsplash (`createSplash()` in the main process) while the app loads */
59
+ splash?(update: M3SplashUpdate): void;
60
+ /** Tells the bootsplash this window is ready (`handoff(win, { waitForRenderer: true })`) */
61
+ splashDone?(): void;
62
+ /** Remembers the theme's colors for the next launch's bootsplash */
63
+ splashColors?(scheme: 'light' | 'dark', colors: Record<string, string>): void;
54
64
  }
65
+ /** A menu of the native menu bar (macOS), as MTitleBar sends its `menus`: plain data, the clicks come back by id */
66
+ export interface M3NativeMenu {
67
+ label: string;
68
+ enabled: boolean;
69
+ items: M3NativeMenuItem[];
70
+ }
71
+ export type M3NativeMenuItem = {
72
+ type: 'separator';
73
+ } | {
74
+ type: 'submenu';
75
+ label: string;
76
+ enabled: boolean;
77
+ items: M3NativeMenuItem[];
78
+ } | {
79
+ type: 'normal' | 'checkbox';
80
+ id: number;
81
+ label: string;
82
+ enabled: boolean;
83
+ checked?: boolean;
84
+ accelerator?: string;
85
+ };
55
86
  export type M3NativeTheme = 'light' | 'dark' | 'system';
56
87
  export declare const IPC: {
57
88
  readonly info: "m3ui:info";
@@ -63,7 +94,17 @@ export declare const IPC: {
63
94
  readonly badge: "m3ui:badge";
64
95
  readonly attention: "m3ui:attention";
65
96
  readonly accent: "m3ui:accent";
97
+ readonly menu: "m3ui:menu";
98
+ readonly menuClick: "m3ui:menu-click";
99
+ readonly splash: "m3ui:splash";
100
+ readonly splashDone: "m3ui:splash-done";
101
+ readonly splashColors: "m3ui:splash-colors";
66
102
  };
103
+ /** A change to the bootsplash: the bar (0–1, null for indeterminate) and/or the status line */
104
+ export interface M3SplashUpdate {
105
+ progress?: number | null;
106
+ status?: string;
107
+ }
67
108
  /** The default key the bridge is exposed under (`window.m3ui`) */
68
109
  export declare const BRIDGE_KEY = "m3ui";
69
110
  /** Default title bar height: Windows 11 caption buttons are 32px, GNOME header bars ~46px; 40 sits between */
@@ -0,0 +1,157 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e={light:{surface:`#f7f2fa`,onSurface:`#1d1b20`,onSurfaceVariant:`#49454f`,primary:`#6750a4`,onPrimary:`#ffffff`,secondaryContainer:`#e8def8`,primaryContainer:`#eaddff`,onPrimaryContainer:`#4f378b`},dark:{surface:`#1d1b20`,onSurface:`#e6e0e9`,onSurfaceVariant:`#cac4d0`,primary:`#d0bcff`,onPrimary:`#381e72`,secondaryContainer:`#4a4458`,primaryContainer:`#4f378b`,onPrimaryContainer:`#eaddff`}},t={surface:`--color-surface-container-low`,onSurface:`--color-on-surface`,onSurfaceVariant:`--color-on-surface-variant`,primary:`--color-primary`,onPrimary:`--color-on-primary`,secondaryContainer:`--color-secondary-container`,primaryContainer:`--color-primary-container`,onPrimaryContainer:`--color-on-primary-container`},n=[`classic`,`banner`,`minimal`,`immersive`],r={classic:{width:300,height:340},banner:{width:520,height:280},minimal:{width:240,height:240},immersive:{width:360,height:420}},i={classic:96,banner:72,minimal:112,immersive:112},a=/^[#\w\s(),.%/+-]{1,80}$/,o=e=>typeof e==`string`&&a.test(e)&&!/url|expression|;|[<>"'{}]/i.test(e),s=e=>e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),c=20,l=2.5,u=4.5,d=`<svg class="wave" width="1840" height="9" viewBox="0 0 1840 9" aria-hidden="true"><path d="${`M0,${u}Q${c/4},${u-2*l} ${c/2},${u}`+Array.from({length:90},(e,t)=>`T${c/2*(t+2)},${u}`).join(``)}"/></svg>`,f=`<!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>{{title}}</title>
6
+ <style>
7
+ :root{{{vars}};--logo:{{logoSize}}px;--radius:{{radius}};--outer:{{background}}}
8
+ *{box-sizing:border-box;margin:0}
9
+ html,body{height:100%;overflow:hidden;background:var(--outer);-webkit-user-select:none;user-select:none;cursor:default}
10
+ body{font-family:{{font}};-webkit-font-smoothing:antialiased}
11
+ .card{position:absolute;inset:0;display:grid;overflow:hidden;border-radius:var(--radius);-webkit-app-region:drag;
12
+ background:var(--bg);color:var(--fg);opacity:0;transform:scale(.96);animation:in .35s cubic-bezier(.05,.7,.1,1) forwards}
13
+ .card.out{animation:out .2s cubic-bezier(.3,0,.8,.15) forwards}
14
+ @keyframes in{to{opacity:1;transform:none}}
15
+ @keyframes out{from{opacity:1;transform:none}to{opacity:0;transform:scale(1.04)}}
16
+ .logo{grid-area:logo;width:var(--logo);height:var(--logo);object-fit:contain}
17
+ .initial{display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--chip);color:var(--onChip);
18
+ font-size:calc(var(--logo) * .45);font-weight:500;line-height:1}
19
+ h1{grid-area:title;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
20
+ .status{grid-area:status;min-height:20px;font-size:14px;line-height:20px;letter-spacing:.25px;color:var(--muted);max-width:100%;
21
+ overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
22
+ .footer{grid-area:footer;font-size:11px;line-height:16px;letter-spacing:.5px;color:var(--muted);opacity:.85}
23
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
24
+
25
+ /* The bar: a flat track, the active indicator (a line, or a scrolling wave), a 4px gap between them and, determinate,
26
+ a 4px stop dot at the end. Indeterminate: two segments run along it (Compose's keyframes, roughly) */
27
+ .bar{grid-area:bar;position:relative;width:100%;height:10px}
28
+ .bar>i{position:absolute;top:3px;height:4px;border-radius:2px}
29
+ .trk{background:var(--track)}
30
+ .det .trk{left:calc(var(--v) + 4px);right:0;transition:left .4s cubic-bezier(.2,0,0,1)}
31
+ .det .stop{right:0;width:4px;background:var(--ind)}
32
+ .indet{overflow:hidden}
33
+ .indet .trk{left:0;right:0}
34
+ .indet .stop{display:none}
35
+ .bar>.a{top:0;height:10px;overflow:hidden;border-radius:0}
36
+ .det .a1{left:0;width:var(--v);transition:width .4s cubic-bezier(.2,0,0,1)}
37
+ .det .a2,.det .a1.zero{display:none}
38
+ .indet .a1{animation:s1 1.75s linear infinite}
39
+ .indet .a2{animation:s2 1.75s linear infinite}
40
+ @keyframes s1{0%{left:0;right:100%}20%{left:0}57%{left:100%;right:-4%}100%{left:100%;right:-4%}}
41
+ @keyframes s2{0%,37%{left:-4%;right:100%}49%{left:0}86%{left:100%;right:-4%}100%{left:100%;right:-4%}}
42
+ .indet .a{box-shadow:0 0 0 4px var(--bg);background:var(--bg);border-radius:2px}
43
+ .a>b{position:absolute;inset:3px 0;border-radius:2px;background:var(--ind)}
44
+ .wave{position:absolute;left:0;top:.5px;display:none;animation:scroll 1s linear infinite}
45
+ .wave path{fill:none;stroke:var(--ind);stroke-width:4;stroke-linecap:round}
46
+ @keyframes scroll{to{transform:translateX(-${c}px)}}
47
+ .i-wavy .wave{display:block}
48
+ .i-wavy .a>b{display:none}
49
+ .det.filling .a1,.det.filling .trk{transition-duration:var(--fill);transition-timing-function:cubic-bezier(.3,0,.4,1)}
50
+
51
+ /* classic */
52
+ .p-classic{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}
53
+ .p-classic .card{grid-template:"." 1fr "logo" auto "title" auto "." 1fr "bar" auto "status" auto "footer" auto/100%;justify-items:center;padding:32px 40px 24px}
54
+ .p-classic h1{margin-top:20px;font-size:22px;line-height:28px}
55
+ .p-classic .status{margin-top:12px;text-align:center}
56
+ .p-classic .footer{margin-top:6px}
57
+
58
+ /* banner */
59
+ .p-banner{--bg:var(--primaryContainer);--fg:var(--onPrimaryContainer);--muted:var(--onPrimaryContainer);--ind:var(--primary);--track:color-mix(in srgb,var(--onPrimaryContainer) 16%,transparent);--chip:var(--primary);--onChip:var(--onPrimary)}
60
+ .p-banner .card{grid-template:"footer footer" auto ". ." 1fr "logo title" auto "logo status" auto ". ." 1fr "bar bar" auto/auto 1fr;column-gap:24px;padding:20px 32px 0}
61
+ .p-banner .logo{align-self:center}
62
+ .p-banner h1{align-self:end;font-size:32px;line-height:40px}
63
+ .p-banner .status{opacity:.8}
64
+ .p-banner .footer{justify-self:end;color:var(--fg);opacity:.7}
65
+ .p-banner .bar{margin:24px 0 26px}
66
+
67
+ /* minimal */
68
+ .p-minimal{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}
69
+ .p-minimal .card{grid-template:"." 1fr "logo" auto "bar" auto "." 1fr/100%;justify-items:center;row-gap:28px;padding:24px}
70
+ .p-minimal .bar{width:min(120px,60%)}
71
+ .p-minimal h1,.p-minimal .status,.p-minimal .footer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
72
+
73
+ /* immersive */
74
+ .p-immersive{--bg:var(--primary);--fg:var(--onPrimary);--muted:var(--onPrimary);--ind:var(--onPrimary);--track:color-mix(in srgb,var(--onPrimary) 28%,transparent);--chip:var(--onPrimary);--onChip:var(--primary)}
75
+ .p-immersive .card{grid-template:"." 1.2fr "logo" auto "title" auto "status" auto "." 1fr "bar" auto "footer" auto/100%;justify-items:center;padding:32px 48px 28px}
76
+ .p-immersive h1{margin-top:24px;font-size:28px;line-height:36px;font-weight:500}
77
+ .p-immersive .status{margin-top:8px;opacity:.85;text-align:center}
78
+ .p-immersive .footer{margin-top:14px;opacity:.75}
79
+ .p-immersive .logo:not(.initial){filter:drop-shadow(0 2px 6px rgb(0 0 0 / .2))}
80
+
81
+ @media (prefers-reduced-motion:reduce){.card,.card.out{animation-duration:.01s}.wave{animation:none}.indet .a1{animation-duration:4s}.indet .a2{display:none}}
82
+ </style>
83
+ </head>
84
+ <body class="p-{{preset}} i-{{indicator}}">
85
+ <div class="card" role="progressbar" aria-label="{{title}}"{{ariaNow}} aria-valuemin="0" aria-valuemax="100">
86
+ {{logo}}
87
+ <h1>{{title}}</h1>
88
+ <div class="bar {{mode}}" style="--v:{{v}}%">
89
+ <i class="trk"></i><i class="a a1{{zero}}"><b></b>${d}</i><i class="a a2"><b></b>${d}</i><i class="stop"></i>
90
+ </div>
91
+ <p class="status">{{status}}</p>
92
+ {{footer}}
93
+ </div>
94
+ <script>
95
+ (() => {
96
+ const card = document.querySelector('.card'), bar = document.querySelector('.bar'), a1 = bar.querySelector('.a1'), status = document.querySelector('.status')
97
+ let filling, ampFrame, amp = ${l}
98
+ // The wave flattens at 100% and comes back below it, as Compose's does: its amplitude eases (the first curve sets it,
99
+ // the T's after it mirror that one)
100
+ const waves = bar.querySelectorAll('.wave path'), rest = waves[0].getAttribute('d').slice(waves[0].getAttribute('d').indexOf('T'))
101
+ const drawWave = () => {
102
+ const d = 'M0,${u}Q${c/4},' + (${u} - 2 * amp).toFixed(2) + ' ${c/2},${u}' + rest
103
+ waves.forEach((w) => w.setAttribute('d', d))
104
+ }
105
+ const toAmp = (target) => {
106
+ cancelAnimationFrame(ampFrame)
107
+ if (amp === target) return
108
+ const from = amp, start = performance.now(), ms = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 500
109
+ const step = (now) => {
110
+ const k = ms ? Math.min(1, (now - start) / ms) : 1
111
+ amp = from + (target - from) * (1 - Math.pow(1 - k, 3))
112
+ drawWave()
113
+ if (k < 1) ampFrame = requestAnimationFrame(step)
114
+ }
115
+ ampFrame = requestAnimationFrame(step)
116
+ }
117
+ if (bar.classList.contains('full')) { amp = 0; drawWave() }
118
+ window.m3splash = {
119
+ set(o) {
120
+ if ('progress' in o) {
121
+ clearTimeout(filling)
122
+ const v = o.progress == null ? null : Math.min(1, Math.max(0, Number(o.progress) || 0))
123
+ bar.className = 'bar ' + (v == null ? 'indet' : 'det') + (v === 1 ? ' full' : '')
124
+ bar.style.setProperty('--v', (v == null ? 0 : Math.round(v * 1000) / 10) + '%')
125
+ a1.classList.toggle('zero', v === 0)
126
+ toAmp(v === 1 ? 0 : ${l})
127
+ if (v == null) card.removeAttribute('aria-valuenow'); else card.setAttribute('aria-valuenow', String(Math.round(v * 100)))
128
+ }
129
+ if (typeof o.status === 'string') status.textContent = o.status
130
+ },
131
+ /** The bar fills by itself over \`ms\` */
132
+ fill(ms) {
133
+ ms = Math.max(0, Number(ms) || 0)
134
+ clearTimeout(filling)
135
+ // From an empty bar that's already laid out (a segment that only now appears has nothing to transition from)
136
+ bar.className = 'bar det'
137
+ a1.classList.remove('zero')
138
+ toAmp(${l})
139
+ bar.style.setProperty('--v', '0%')
140
+ void bar.offsetWidth
141
+ bar.style.setProperty('--fill', ms + 'ms')
142
+ bar.classList.add('filling')
143
+ bar.style.setProperty('--v', '100%')
144
+ card.setAttribute('aria-valuenow', '100')
145
+ filling = setTimeout(() => { bar.className = 'bar det full'; toAmp(0) }, ms)
146
+ },
147
+ exit() {
148
+ card.classList.add('out')
149
+ return new Promise((r) => setTimeout(r, matchMedia('(prefers-reduced-motion: reduce)').matches ? 20 : 210))
150
+ },
151
+ }
152
+ if ({{fill}} > 0) requestAnimationFrame(() => window.m3splash.fill({{fill}}))
153
+ })()
154
+ <\/script>
155
+ </body>
156
+ </html>`;function p(r){let i=r.colors,a=r.progress==null?null:Math.min(1,Math.max(0,r.progress)),c=s((r.title.trim()[0]??``).toUpperCase()),l=Math.max(16,Math.round(r.logoSize)),u=n.includes(r.preset)?r.preset:`classic`;return{vars:Object.keys(t).map(t=>`--${t}:${o(i[t])?i[t]:e.light[t]}`).join(`;`),logoSize:String(l),title:s(r.title),background:r.rounded?`transparent`:`var(--bg)`,font:r.fontFamily.replace(/[<>{};]/g,``),radius:r.rounded?`28px`:`0`,ariaNow:a==null?``:` aria-valuenow="${Math.round(a*100)}"`,logo:r.logo?`<img class="logo" src="${s(r.logo)}" alt="" width="${l}" height="${l}">`:`<div class="logo initial" aria-hidden="true">${c}</div>`,mode:(a==null?`indet`:`det`)+(a===1?` full`:``),v:String(Math.round((a??0)*1e3)/10),zero:a===0?` zero`:``,status:s(r.status),footer:r.footer?`<p class="footer">${s(r.footer)}</p>`:``,preset:u,indicator:r.indicator===`linear`?`linear`:`wavy`,fill:String(Math.max(0,Math.round(Number(r.fill)||0)))}}exports.SPLASH_BASELINE=e,exports.SPLASH_LOGO_SIZES=i,exports.SPLASH_PRESETS=n,exports.SPLASH_SIZES=r,exports.SPLASH_TEMPLATE=f,exports.SPLASH_TOKENS=t,exports.isSafeColor=o,exports.splashHtml=function(e){let t=p(e);return f.replace(/\{\{(\w+)\}\}/g,(e,n)=>t[n]??``)},exports.splashSlots=p;
157
+ //# sourceMappingURL=splash-html.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splash-html.cjs","names":["SPLASH_BASELINE","SPLASH_TOKENS","SPLASH_PRESETS","SPLASH_SIZES","SPLASH_LOGO_SIZES","SAFE_COLOR","isSafeColor","c","esc","s","WAVE_LEN","WAVE_AMP","WAVE_MID","WAVE","_","i","SPLASH_TEMPLATE","splashSlots","p","value","initial","size","preset","k","slots"],"sources":["../src/splashHtml.ts"],"sourcesContent":["/**\n * The bootsplash's page: one self-contained HTML document (styles, script and logo inline), so the splash window shows\n * at once, before the app's own bundle has even been read. Pure: no Electron here, the same page serves any shell (the\n * Tauri plugin fills the same template, `SPLASH_TEMPLATE`, from Rust).\n *\n * The page exposes `window.m3splash`: `set({ progress, status })` updates it, `exit()` plays its fade-out (resolves\n * when done). M3 has no launch window for desktop: the presets are built from M3 parts (surface and primary roles,\n * extra-large corners, the type scale, the linear and wavy progress indicators with their gap and stop dot).\n */\n\n/** The theme colors the splash is painted with: any CSS color, as the M3 tokens of the same names */\nexport interface M3SplashColors {\n /** The window's background in `classic` and `minimal` (`--color-surface-container-low`) */\n surface: string\n /** Text on it (`--color-on-surface`) */\n onSurface: string\n /** The status line (`--color-on-surface-variant`) */\n onSurfaceVariant: string\n /** The progress indicator, the stop dot; `immersive`'s background (`--color-primary`) */\n primary: string\n /** Text and the indicator on `immersive` (`--color-on-primary`) */\n onPrimary: string\n /** The progress track (`--color-secondary-container`) */\n secondaryContainer: string\n /** `banner`'s background, the initial's circle (`--color-primary-container`, `--color-on-primary-container`) */\n primaryContainer: string\n onPrimaryContainer: string\n}\n\n/** The M3 baseline (purple) scheme, as theme.css defines it */\nexport const SPLASH_BASELINE: Record<'light' | 'dark', M3SplashColors> = {\n light: {\n surface: '#f7f2fa',\n onSurface: '#1d1b20',\n onSurfaceVariant: '#49454f',\n primary: '#6750a4',\n onPrimary: '#ffffff',\n secondaryContainer: '#e8def8',\n primaryContainer: '#eaddff',\n onPrimaryContainer: '#4f378b',\n },\n dark: {\n surface: '#1d1b20',\n onSurface: '#e6e0e9',\n onSurfaceVariant: '#cac4d0',\n primary: '#d0bcff',\n onPrimary: '#381e72',\n secondaryContainer: '#4a4458',\n primaryContainer: '#4f378b',\n onPrimaryContainer: '#eaddff',\n },\n}\n\n/** The M3 tokens each splash color is read from (the renderer remembers them for the next launch) */\nexport const SPLASH_TOKENS: Record<keyof M3SplashColors, string> = {\n surface: '--color-surface-container-low',\n onSurface: '--color-on-surface',\n onSurfaceVariant: '--color-on-surface-variant',\n primary: '--color-primary',\n onPrimary: '--color-on-primary',\n secondaryContainer: '--color-secondary-container',\n primaryContainer: '--color-primary-container',\n onPrimaryContainer: '--color-on-primary-container',\n}\n\n/**\n * The layouts:\n * - `classic`: logo, name and the bar under them on the surface, status and footer below (300 × 340)\n * - `banner`: landscape on the primary container: logo beside a large name and the status, the bar along the bottom (520 × 280)\n * - `minimal`: just the logo and a short bar under it (240 × 240; the name stays as the accessible label)\n * - `immersive`: the whole window in the primary color, everything on it in on-primary (360 × 420)\n */\nexport type M3SplashPreset = 'classic' | 'banner' | 'minimal' | 'immersive'\n/** `wavy`: M3 Expressive's wavy linear indicator; `linear`: the flat one */\nexport type M3SplashIndicator = 'wavy' | 'linear'\n\nexport const SPLASH_PRESETS: M3SplashPreset[] = ['classic', 'banner', 'minimal', 'immersive']\n/** Each preset's window size */\nexport const SPLASH_SIZES: Record<M3SplashPreset, { width: number; height: number }> = {\n classic: { width: 300, height: 340 },\n banner: { width: 520, height: 280 },\n minimal: { width: 240, height: 240 },\n immersive: { width: 360, height: 420 },\n}\n/** Each preset's logo size */\nexport const SPLASH_LOGO_SIZES: Record<M3SplashPreset, number> = { classic: 96, banner: 72, minimal: 112, immersive: 112 }\n\nexport interface SplashPage {\n title: string\n /** Image URL (a data: URL in practice: the page loads nothing else) */\n logo?: string\n /** The logo's size in px */\n logoSize: number\n status: string\n /** 0–1, or null for an indeterminate bar */\n progress: number | null\n colors: M3SplashColors\n fontFamily: string\n /** Rounded window corners (the window is transparent around them) */\n rounded: boolean\n /** A line under everything (a version) */\n footer: string\n preset?: M3SplashPreset\n indicator?: M3SplashIndicator\n /** ms: the bar fills by itself over this long, from the moment the page shows (a later `set({ progress })` takes over) */\n fill?: number\n}\n\n// A color goes into a style attribute: only what a CSS color can contain\nconst SAFE_COLOR = /^[#\\w\\s(),.%/+-]{1,80}$/\nexport const isSafeColor = (c: unknown): c is string => typeof c === 'string' && SAFE_COLOR.test(c) && !/url|expression|;|[<>\"'{}]/i.test(c)\n\nconst esc = (s: string) => s.replace(/[&<>\"']/g, (c) => `&#${c.charCodeAt(0)};`)\n\n// The wave (MProgressBar's geometry: 20px wavelength, 2.5px amplitude, 4px thick): one long path scrolled a wavelength\n// per second, as Compose's wavy indicator moves. Quadratic halves (`T`) are close enough to a sine at this size\nconst WAVE_LEN = 20\nconst WAVE_AMP = 2.5\nconst WAVE_MID = 4.5\nconst WAVE_PATH = `M0,${WAVE_MID}Q${WAVE_LEN / 4},${WAVE_MID - 2 * WAVE_AMP} ${WAVE_LEN / 2},${WAVE_MID}` +\n Array.from({ length: 90 }, (_, i) => `T${WAVE_LEN / 2 * (i + 2)},${WAVE_MID}`).join('')\nconst WAVE = `<svg class=\"wave\" width=\"1840\" height=\"9\" viewBox=\"0 0 1840 9\" aria-hidden=\"true\"><path d=\"${WAVE_PATH}\"/></svg>`\n\n/**\n * The page with `{{slot}}`s for what changes (see `splashSlots`): the same template, filled the same way, serves the\n * Tauri plugin's splash (Rust `include_str!`s a copy, a test keeps it equal)\n */\nexport const SPLASH_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>{{title}}</title>\n<style>\n:root{{{vars}};--logo:{{logoSize}}px;--radius:{{radius}};--outer:{{background}}}\n*{box-sizing:border-box;margin:0}\nhtml,body{height:100%;overflow:hidden;background:var(--outer);-webkit-user-select:none;user-select:none;cursor:default}\nbody{font-family:{{font}};-webkit-font-smoothing:antialiased}\n.card{position:absolute;inset:0;display:grid;overflow:hidden;border-radius:var(--radius);-webkit-app-region:drag;\n background:var(--bg);color:var(--fg);opacity:0;transform:scale(.96);animation:in .35s cubic-bezier(.05,.7,.1,1) forwards}\n.card.out{animation:out .2s cubic-bezier(.3,0,.8,.15) forwards}\n@keyframes in{to{opacity:1;transform:none}}\n@keyframes out{from{opacity:1;transform:none}to{opacity:0;transform:scale(1.04)}}\n.logo{grid-area:logo;width:var(--logo);height:var(--logo);object-fit:contain}\n.initial{display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--chip);color:var(--onChip);\n font-size:calc(var(--logo) * .45);font-weight:500;line-height:1}\nh1{grid-area:title;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.status{grid-area:status;min-height:20px;font-size:14px;line-height:20px;letter-spacing:.25px;color:var(--muted);max-width:100%;\n overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.footer{grid-area:footer;font-size:11px;line-height:16px;letter-spacing:.5px;color:var(--muted);opacity:.85}\n.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}\n\n/* The bar: a flat track, the active indicator (a line, or a scrolling wave), a 4px gap between them and, determinate,\n a 4px stop dot at the end. Indeterminate: two segments run along it (Compose's keyframes, roughly) */\n.bar{grid-area:bar;position:relative;width:100%;height:10px}\n.bar>i{position:absolute;top:3px;height:4px;border-radius:2px}\n.trk{background:var(--track)}\n.det .trk{left:calc(var(--v) + 4px);right:0;transition:left .4s cubic-bezier(.2,0,0,1)}\n.det .stop{right:0;width:4px;background:var(--ind)}\n.indet{overflow:hidden}\n.indet .trk{left:0;right:0}\n.indet .stop{display:none}\n.bar>.a{top:0;height:10px;overflow:hidden;border-radius:0}\n.det .a1{left:0;width:var(--v);transition:width .4s cubic-bezier(.2,0,0,1)}\n.det .a2,.det .a1.zero{display:none}\n.indet .a1{animation:s1 1.75s linear infinite}\n.indet .a2{animation:s2 1.75s linear infinite}\n@keyframes s1{0%{left:0;right:100%}20%{left:0}57%{left:100%;right:-4%}100%{left:100%;right:-4%}}\n@keyframes s2{0%,37%{left:-4%;right:100%}49%{left:0}86%{left:100%;right:-4%}100%{left:100%;right:-4%}}\n.indet .a{box-shadow:0 0 0 4px var(--bg);background:var(--bg);border-radius:2px}\n.a>b{position:absolute;inset:3px 0;border-radius:2px;background:var(--ind)}\n.wave{position:absolute;left:0;top:.5px;display:none;animation:scroll 1s linear infinite}\n.wave path{fill:none;stroke:var(--ind);stroke-width:4;stroke-linecap:round}\n@keyframes scroll{to{transform:translateX(-${WAVE_LEN}px)}}\n.i-wavy .wave{display:block}\n.i-wavy .a>b{display:none}\n.det.filling .a1,.det.filling .trk{transition-duration:var(--fill);transition-timing-function:cubic-bezier(.3,0,.4,1)}\n\n/* classic */\n.p-classic{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}\n.p-classic .card{grid-template:\".\" 1fr \"logo\" auto \"title\" auto \".\" 1fr \"bar\" auto \"status\" auto \"footer\" auto/100%;justify-items:center;padding:32px 40px 24px}\n.p-classic h1{margin-top:20px;font-size:22px;line-height:28px}\n.p-classic .status{margin-top:12px;text-align:center}\n.p-classic .footer{margin-top:6px}\n\n/* banner */\n.p-banner{--bg:var(--primaryContainer);--fg:var(--onPrimaryContainer);--muted:var(--onPrimaryContainer);--ind:var(--primary);--track:color-mix(in srgb,var(--onPrimaryContainer) 16%,transparent);--chip:var(--primary);--onChip:var(--onPrimary)}\n.p-banner .card{grid-template:\"footer footer\" auto \". .\" 1fr \"logo title\" auto \"logo status\" auto \". .\" 1fr \"bar bar\" auto/auto 1fr;column-gap:24px;padding:20px 32px 0}\n.p-banner .logo{align-self:center}\n.p-banner h1{align-self:end;font-size:32px;line-height:40px}\n.p-banner .status{opacity:.8}\n.p-banner .footer{justify-self:end;color:var(--fg);opacity:.7}\n.p-banner .bar{margin:24px 0 26px}\n\n/* minimal */\n.p-minimal{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}\n.p-minimal .card{grid-template:\".\" 1fr \"logo\" auto \"bar\" auto \".\" 1fr/100%;justify-items:center;row-gap:28px;padding:24px}\n.p-minimal .bar{width:min(120px,60%)}\n.p-minimal h1,.p-minimal .status,.p-minimal .footer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}\n\n/* immersive */\n.p-immersive{--bg:var(--primary);--fg:var(--onPrimary);--muted:var(--onPrimary);--ind:var(--onPrimary);--track:color-mix(in srgb,var(--onPrimary) 28%,transparent);--chip:var(--onPrimary);--onChip:var(--primary)}\n.p-immersive .card{grid-template:\".\" 1.2fr \"logo\" auto \"title\" auto \"status\" auto \".\" 1fr \"bar\" auto \"footer\" auto/100%;justify-items:center;padding:32px 48px 28px}\n.p-immersive h1{margin-top:24px;font-size:28px;line-height:36px;font-weight:500}\n.p-immersive .status{margin-top:8px;opacity:.85;text-align:center}\n.p-immersive .footer{margin-top:14px;opacity:.75}\n.p-immersive .logo:not(.initial){filter:drop-shadow(0 2px 6px rgb(0 0 0 / .2))}\n\n@media (prefers-reduced-motion:reduce){.card,.card.out{animation-duration:.01s}.wave{animation:none}.indet .a1{animation-duration:4s}.indet .a2{display:none}}\n</style>\n</head>\n<body class=\"p-{{preset}} i-{{indicator}}\">\n<div class=\"card\" role=\"progressbar\" aria-label=\"{{title}}\"{{ariaNow}} aria-valuemin=\"0\" aria-valuemax=\"100\">\n {{logo}}\n <h1>{{title}}</h1>\n <div class=\"bar {{mode}}\" style=\"--v:{{v}}%\">\n <i class=\"trk\"></i><i class=\"a a1{{zero}}\"><b></b>${WAVE}</i><i class=\"a a2\"><b></b>${WAVE}</i><i class=\"stop\"></i>\n </div>\n <p class=\"status\">{{status}}</p>\n {{footer}}\n</div>\n<script>\n(() => {\n const card = document.querySelector('.card'), bar = document.querySelector('.bar'), a1 = bar.querySelector('.a1'), status = document.querySelector('.status')\n let filling, ampFrame, amp = ${WAVE_AMP}\n // The wave flattens at 100% and comes back below it, as Compose's does: its amplitude eases (the first curve sets it,\n // the T's after it mirror that one)\n const waves = bar.querySelectorAll('.wave path'), rest = waves[0].getAttribute('d').slice(waves[0].getAttribute('d').indexOf('T'))\n const drawWave = () => {\n const d = 'M0,${WAVE_MID}Q${WAVE_LEN / 4},' + (${WAVE_MID} - 2 * amp).toFixed(2) + ' ${WAVE_LEN / 2},${WAVE_MID}' + rest\n waves.forEach((w) => w.setAttribute('d', d))\n }\n const toAmp = (target) => {\n cancelAnimationFrame(ampFrame)\n if (amp === target) return\n const from = amp, start = performance.now(), ms = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 500\n const step = (now) => {\n const k = ms ? Math.min(1, (now - start) / ms) : 1\n amp = from + (target - from) * (1 - Math.pow(1 - k, 3))\n drawWave()\n if (k < 1) ampFrame = requestAnimationFrame(step)\n }\n ampFrame = requestAnimationFrame(step)\n }\n if (bar.classList.contains('full')) { amp = 0; drawWave() }\n window.m3splash = {\n set(o) {\n if ('progress' in o) {\n clearTimeout(filling)\n const v = o.progress == null ? null : Math.min(1, Math.max(0, Number(o.progress) || 0))\n bar.className = 'bar ' + (v == null ? 'indet' : 'det') + (v === 1 ? ' full' : '')\n bar.style.setProperty('--v', (v == null ? 0 : Math.round(v * 1000) / 10) + '%')\n a1.classList.toggle('zero', v === 0)\n toAmp(v === 1 ? 0 : ${WAVE_AMP})\n if (v == null) card.removeAttribute('aria-valuenow'); else card.setAttribute('aria-valuenow', String(Math.round(v * 100)))\n }\n if (typeof o.status === 'string') status.textContent = o.status\n },\n /** The bar fills by itself over \\`ms\\` */\n fill(ms) {\n ms = Math.max(0, Number(ms) || 0)\n clearTimeout(filling)\n // From an empty bar that's already laid out (a segment that only now appears has nothing to transition from)\n bar.className = 'bar det'\n a1.classList.remove('zero')\n toAmp(${WAVE_AMP})\n bar.style.setProperty('--v', '0%')\n void bar.offsetWidth\n bar.style.setProperty('--fill', ms + 'ms')\n bar.classList.add('filling')\n bar.style.setProperty('--v', '100%')\n card.setAttribute('aria-valuenow', '100')\n filling = setTimeout(() => { bar.className = 'bar det full'; toAmp(0) }, ms)\n },\n exit() {\n card.classList.add('out')\n return new Promise((r) => setTimeout(r, matchMedia('(prefers-reduced-motion: reduce)').matches ? 20 : 210))\n },\n }\n if ({{fill}} > 0) requestAnimationFrame(() => window.m3splash.fill({{fill}}))\n})()\n</script>\n</body>\n</html>`\n\n/** The template's slots for a page, HTML-escaped where they're text */\nexport function splashSlots(p: SplashPage): Record<string, string> {\n const c = p.colors\n const value = p.progress == null ? null : Math.min(1, Math.max(0, p.progress))\n const initial = esc((p.title.trim()[0] ?? '').toUpperCase())\n const size = Math.max(16, Math.round(p.logoSize))\n const preset = SPLASH_PRESETS.includes(p.preset as M3SplashPreset) ? p.preset! : 'classic'\n return {\n vars: (Object.keys(SPLASH_TOKENS) as (keyof M3SplashColors)[])\n .map((k) => `--${k}:${isSafeColor(c[k]) ? c[k] : SPLASH_BASELINE.light[k]}`)\n .join(';'),\n logoSize: String(size),\n title: esc(p.title),\n background: p.rounded ? 'transparent' : 'var(--bg)',\n font: p.fontFamily.replace(/[<>{};]/g, ''),\n radius: p.rounded ? '28px' : '0',\n ariaNow: value == null ? '' : ` aria-valuenow=\"${Math.round(value * 100)}\"`,\n logo: p.logo\n ? `<img class=\"logo\" src=\"${esc(p.logo)}\" alt=\"\" width=\"${size}\" height=\"${size}\">`\n : `<div class=\"logo initial\" aria-hidden=\"true\">${initial}</div>`,\n mode: (value == null ? 'indet' : 'det') + (value === 1 ? ' full' : ''),\n v: String(Math.round((value ?? 0) * 1000) / 10),\n zero: value === 0 ? ' zero' : '',\n status: esc(p.status),\n footer: p.footer ? `<p class=\"footer\">${esc(p.footer)}</p>` : '',\n preset,\n indicator: p.indicator === 'linear' ? 'linear' : 'wavy',\n fill: String(Math.max(0, Math.round(Number(p.fill) || 0))),\n }\n}\n\nexport function splashHtml(p: SplashPage): string {\n const slots = splashSlots(p)\n return SPLASH_TEMPLATE.replace(/\\{\\{(\\w+)\\}\\}/g, (_, k: string) => slots[k] ?? '')\n}\n"],"mappings":"A,mEA8BA,IAAaA,EAA4D,CACvE,MAAO,CACL,QAAS,UACT,UAAW,UACX,iBAAkB,UAClB,QAAS,UACT,UAAW,UACX,mBAAoB,UACpB,iBAAkB,UAClB,mBAAoB,SACtB,EACA,KAAM,CACJ,QAAS,UACT,UAAW,UACX,iBAAkB,UAClB,QAAS,UACT,UAAW,UACX,mBAAoB,UACpB,iBAAkB,UAClB,mBAAoB,SACtB,CACF,EAGaC,EAAsD,CACjE,QAAS,gCACT,UAAW,qBACX,iBAAkB,6BAClB,QAAS,kBACT,UAAW,qBACX,mBAAoB,8BACpB,iBAAkB,4BAClB,mBAAoB,8BACtB,EAaaC,EAAmC,CAAC,UAAW,SAAU,UAAW,WAAW,EAE/EC,EAA0E,CACrF,QAAS,CAAE,MAAO,IAAK,OAAQ,GAAI,EACnC,OAAQ,CAAE,MAAO,IAAK,OAAQ,GAAI,EAClC,QAAS,CAAE,MAAO,IAAK,OAAQ,GAAI,EACnC,UAAW,CAAE,MAAO,IAAK,OAAQ,GAAI,CACvC,EAEaC,EAAoD,CAAE,QAAS,GAAI,OAAQ,GAAI,QAAS,IAAK,UAAW,GAAI,EAwBnHC,EAAa,0BACNC,EAAeC,GAA4B,OAAOA,GAAM,UAAYF,EAAW,KAAKE,CAAC,GAAK,CAAC,6BAA6B,KAAKA,CAAC,EAErIC,EAAOC,GAAcA,EAAE,QAAQ,WAAaF,GAAM,KAAKA,EAAE,WAAW,CAAC,EAAE,EAAE,EAIzEG,EAAW,GACXC,EAAW,IACXC,EAAW,IAGXC,EAAO,8FAFK,MAAMD,EAAS,GAAGF,EAAW,EAAE,GAAGE,EAAW,EAAID,EAAS,GAAGD,EAAW,EAAE,GAAGE,IAC7F,MAAM,KAAK,CAAE,OAAQ,EAAG,GAAIE,EAAGC,IAAM,IAAIL,EAAW,GAAKK,EAAI,GAAG,GAAGH,GAAU,CAAC,CAAC,KAAK,EAAE,EAC6B,WAMxGI,EAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA6CcN,EAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDA2CEG,EAAK,6BAA6BA,EAAK;;;;;;;;iCAQ9DF,EAAS;;;;;oBAKtBC,EAAS,GAAGF,EAAW,EAAE,QAAQE,EAAS,6BAA6BF,EAAW,EAAE,GAAGE,EAAS;;;;;;;;;;;;;;;;;;;;;;;;8BAwBtFD,EAAS;;;;;;;;;;;;cAYzBA,EAAS;;;;;;;;;;;;;;;;;;SAqBvB,SAAgBM,EAAYC,EAAuC,CACjE,IAAMX,EAAIW,EAAE,OACNC,EAAQD,EAAE,UAAY,KAAO,KAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAGA,EAAE,QAAQ,CAAC,EACvEE,EAAUZ,GAAKU,EAAE,MAAM,KAAK,CAAC,CAAC,IAAM,GAAA,CAAI,YAAY,CAAC,EACrDG,EAAO,KAAK,IAAI,GAAI,KAAK,MAAMH,EAAE,QAAQ,CAAC,EAC1CI,EAASpB,EAAe,SAASgB,EAAE,MAAwB,EAAIA,EAAE,OAAU,UACjF,MAAO,CACL,KAAO,OAAO,KAAKjB,CAAa,CAAC,CAC9B,IAAKsB,GAAM,KAAKA,EAAE,GAAGjB,EAAYC,EAAEgB,EAAE,EAAIhB,EAAEgB,GAAKvB,EAAgB,MAAMuB,IAAI,CAAC,CAC3E,KAAK,GAAG,EACX,SAAU,OAAOF,CAAI,EACrB,MAAOb,EAAIU,EAAE,KAAK,EAClB,WAAYA,EAAE,QAAU,cAAgB,YACxC,KAAMA,EAAE,WAAW,QAAQ,WAAY,EAAE,EACzC,OAAQA,EAAE,QAAU,OAAS,IAC7B,QAASC,GAAS,KAAO,GAAK,mBAAmB,KAAK,MAAMA,EAAQ,GAAG,EAAE,GACzE,KAAMD,EAAE,KACJ,0BAA0BV,EAAIU,EAAE,IAAI,EAAE,kBAAkBG,EAAK,YAAYA,EAAK,IAC9E,gDAAgDD,EAAQ,QAC5D,MAAOD,GAAS,KAAO,QAAU,QAAUA,IAAU,EAAI,QAAU,IACnE,EAAG,OAAO,KAAK,OAAOA,GAAS,GAAK,GAAI,EAAI,EAAE,EAC9C,KAAMA,IAAU,EAAI,QAAU,GAC9B,OAAQX,EAAIU,EAAE,MAAM,EACpB,OAAQA,EAAE,OAAS,qBAAqBV,EAAIU,EAAE,MAAM,EAAE,MAAQ,GAC9DI,SACA,UAAWJ,EAAE,YAAc,SAAW,SAAW,OACjD,KAAM,OAAO,KAAK,IAAI,EAAG,KAAK,MAAM,OAAOA,EAAE,IAAI,GAAK,CAAC,CAAC,CAAC,CAC3D,CACF,C,iMAEA,SAA2BA,EAAuB,CAChD,IAAMM,EAAQP,EAAYC,CAAC,EAC3B,OAAOF,EAAgB,QAAQ,kBAAmBF,EAAGS,IAAcC,EAAMD,IAAM,EAAE,CACnF,E"}