@m3ui-vue/electron 0.1.0 → 0.2.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.
@@ -0,0 +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"}
package/dist/shared.d.ts CHANGED
@@ -17,6 +17,8 @@ export interface M3WindowInfo {
17
17
  /** Height of the title bar in px (also the native overlay's height) */
18
18
  titleBarHeight: number;
19
19
  state: M3WindowState;
20
+ /** The system accent color as `#rrggbb` (Windows and macOS), or null where there's none */
21
+ accentColor: string | null;
20
22
  }
21
23
  /** The window's state, sent again on every change */
22
24
  export interface M3WindowState {
@@ -39,12 +41,28 @@ export interface M3Bridge {
39
41
  action(action: M3WindowAction): void;
40
42
  /** Recolors the native buttons (ignored with `custom` controls and on macOS, whose traffic lights are fixed) */
41
43
  setOverlay(colors: M3OverlayColors): void;
44
+ /** Native UI theme (dialogs, context menus, scrollbars, the frame): `nativeTheme.themeSource` */
45
+ setTheme(theme: M3NativeTheme): void;
46
+ /** Taskbar / dock progress, 0–1; `null` removes it, `'indeterminate'` for an unknown amount (Windows) */
47
+ setProgress(value: number | 'indeterminate' | null): void;
48
+ /** Badge count on the dock / launcher icon (macOS, Linux Unity launchers); 0 removes it */
49
+ setBadge(count: number): void;
50
+ /** Flashes the taskbar button / bounces the dock icon until the window gets focus */
51
+ attention(): void;
52
+ /** Calls `listener` when the system accent color changes; returns the unsubscribe */
53
+ onAccent(listener: (color: string | null) => void): () => void;
42
54
  }
55
+ export type M3NativeTheme = 'light' | 'dark' | 'system';
43
56
  export declare const IPC: {
44
57
  readonly info: "m3ui:info";
45
58
  readonly state: "m3ui:state";
46
59
  readonly action: "m3ui:action";
47
60
  readonly overlay: "m3ui:overlay";
61
+ readonly theme: "m3ui:theme";
62
+ readonly progress: "m3ui:progress";
63
+ readonly badge: "m3ui:badge";
64
+ readonly attention: "m3ui:attention";
65
+ readonly accent: "m3ui:accent";
48
66
  };
49
67
  /** The default key the bridge is exposed under (`window.m3ui`) */
50
68
  export declare const BRIDGE_KEY = "m3ui";
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
- @layer base{.m3-title-bar{width:100%;color:var(--color-on-surface);-webkit-user-select:none;user-select:none;app-region:drag;-webkit-app-region:drag;flex-shrink:0;display:block;position:relative}}.m3-title-bar :is(button,a,input,select,textarea,[role=button],[contenteditable],[data-no-drag]){app-region:no-drag;-webkit-app-region:no-drag}.m3-title-bar-area{box-sizing:border-box;align-items:center;gap:8px;height:100%;padding-inline:8px;display:flex}.m3-title-bar-native .m3-title-bar-area{inset-block:0;left:env(titlebar-area-x,0px);width:env(titlebar-area-width,100%);position:absolute}.m3-title-bar-start,.m3-title-bar-end{align-items:center;gap:4px;min-width:0;display:flex}.m3-title-bar-start:empty,.m3-title-bar-end:empty{display:none}.m3-title-bar-title{white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:var(--text-title-small,.875rem);line-height:var(--text-title-small--line-height,1.25rem);letter-spacing:.006em;flex:1;padding-inline:4px;font-weight:500;transition:color .15s;overflow:hidden}.m3-title-bar-center .m3-title-bar-title{text-align:center}.m3-title-bar-blurred .m3-title-bar-title{color:var(--color-on-surface-variant)}.m3-title-bar-probe{width:0;height:0;color:var(--color-on-surface-variant);position:absolute;overflow:hidden}.m3-title-bar-side{flex-shrink:0;display:flex}.m3-title-bar-controls-start{order:-1}.m3-title-bar-controls{flex-shrink:0;align-items:center;gap:4px;display:flex}.m3-title-bar-btn{width:32px;height:32px;color:var(--color-on-surface-variant);cursor:default;background:0 0;border:0;border-radius:9999px;outline:none;justify-content:center;align-items:center;padding:0;transition:background-color .15s,color .15s;display:inline-flex}.m3-title-bar-btn:hover{background-color:color-mix(in srgb, var(--color-on-surface-variant) 8%, transparent)}.m3-title-bar-btn:active{background-color:color-mix(in srgb, var(--color-on-surface-variant) 10%, transparent)}.m3-title-bar-btn:focus-visible{box-shadow:0 0 0 2px var(--color-secondary)}.m3-title-bar-btn-close:hover{color:var(--color-error);background-color:color-mix(in srgb, var(--color-error) 8%, transparent)}.m3-title-bar-btn-close:active{background-color:color-mix(in srgb, var(--color-error) 10%, transparent)}.m3-title-bar-lights{gap:8px;padding-inline:6px}.m3-title-bar-lights .m3-title-bar-btn{color:#0000008c;width:12px;height:12px;box-shadow:inset 0 0 0 .5px #0000002e}.m3-title-bar-lights .m3-title-bar-btn svg{fill:none;stroke:currentColor;stroke-width:1.4px;stroke-linecap:round;opacity:0;width:8px;height:8px}.m3-title-bar-lights:hover .m3-title-bar-btn svg,.m3-title-bar-lights .m3-title-bar-btn:focus-visible svg{opacity:1}.m3-title-bar-lights .m3-title-bar-btn-close{background-color:#ff5f57}.m3-title-bar-lights .m3-title-bar-btn-minimize{background-color:#febc2e}.m3-title-bar-lights .m3-title-bar-btn-maximize{background-color:#28c840}.m3-title-bar-lights .m3-title-bar-btn:hover,.m3-title-bar-lights .m3-title-bar-btn-close:hover{color:#0000008c;filter:brightness(.94)}.m3-title-bar-blurred .m3-title-bar-lights:not(:hover) .m3-title-bar-btn{background-color:color-mix(in srgb, var(--color-on-surface) 20%, transparent);box-shadow:none}
1
+ @layer base{.m3-title-bar{width:100%;color:var(--color-on-surface);-webkit-user-select:none;user-select:none;app-region:drag;-webkit-app-region:drag;flex-shrink:0;display:block;position:relative}}.m3-title-bar :is(button,a,input,select,textarea,[role=button],[contenteditable],[data-no-drag]){app-region:no-drag;-webkit-app-region:no-drag}.m3-title-bar-row{position:relative}.m3-title-bar-menu-row{app-region:no-drag;-webkit-app-region:no-drag;align-items:center;padding:0 8px 4px;display:flex}.m3-title-bar-area{box-sizing:border-box;align-items:center;gap:8px;height:100%;padding-inline:8px;display:flex}.m3-title-bar-native .m3-title-bar-area{margin-left:env(titlebar-area-x,0px);width:env(titlebar-area-width,100%)}.m3-title-bar-icon{width:28px;color:var(--color-primary);flex-shrink:0;justify-content:center;align-items:center;display:flex}.m3-title-bar-icon img{object-fit:contain;pointer-events:none;width:20px;height:20px}.m3-title-bar-menus{flex-shrink:0}.m3-title-bar-start,.m3-title-bar-end{align-items:center;gap:4px;min-width:0;display:flex}.m3-title-bar-start:empty,.m3-title-bar-end:empty{display:none}.m3-title-bar-title{white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:var(--text-title-small,.875rem);line-height:var(--text-title-small--line-height,1.25rem);letter-spacing:.006em;flex:1;padding-inline:4px;font-weight:500;transition:color .15s;overflow:hidden}.m3-title-bar-center .m3-title-bar-text{inset-inline-start:50%;text-overflow:ellipsis;max-width:40%;transform:translate(calc(-50% * var(--m3-dir,1)), -50%);pointer-events:none;position:absolute;top:50%;overflow:hidden}.m3-title-bar-blurred .m3-title-bar-title{color:var(--color-on-surface-variant)}.m3-title-bar-probe{width:0;height:0;color:var(--color-on-surface-variant);position:absolute;overflow:hidden}.m3-title-bar-side{flex-shrink:0;display:flex}.m3-title-bar-controls-start{order:-1}.m3-title-bar-controls{flex-shrink:0;align-items:center;gap:4px;display:flex}.m3-title-bar-btn{width:32px;height:32px;color:var(--color-on-surface-variant);cursor:default;background:0 0;border:0;border-radius:9999px;outline:none;justify-content:center;align-items:center;padding:0;transition:background-color .15s,color .15s;display:inline-flex}.m3-title-bar-btn:hover{background-color:color-mix(in srgb, var(--color-on-surface-variant) 8%, transparent)}.m3-title-bar-btn:active{background-color:color-mix(in srgb, var(--color-on-surface-variant) 10%, transparent)}.m3-title-bar-btn:focus-visible{box-shadow:0 0 0 2px var(--color-secondary)}.m3-title-bar-btn-close:hover{color:var(--color-error);background-color:color-mix(in srgb, var(--color-error) 8%, transparent)}.m3-title-bar-btn-close:active{background-color:color-mix(in srgb, var(--color-error) 10%, transparent)}.m3-title-bar-lights{gap:8px;padding-inline:6px}.m3-title-bar-lights .m3-title-bar-btn{color:#0000008c;width:12px;height:12px;box-shadow:inset 0 0 0 .5px #0000002e}.m3-title-bar-lights .m3-title-bar-btn svg{fill:none;stroke:currentColor;stroke-width:1.4px;stroke-linecap:round;opacity:0;width:8px;height:8px}.m3-title-bar-lights:hover .m3-title-bar-btn svg,.m3-title-bar-lights .m3-title-bar-btn:focus-visible svg{opacity:1}.m3-title-bar-lights .m3-title-bar-btn-close{background-color:#ff5f57}.m3-title-bar-lights .m3-title-bar-btn-minimize{background-color:#febc2e}.m3-title-bar-lights .m3-title-bar-btn-maximize{background-color:#28c840}.m3-title-bar-lights .m3-title-bar-btn:hover,.m3-title-bar-lights .m3-title-bar-btn-close:hover{color:#0000008c;filter:brightness(.94)}.m3-title-bar-blurred .m3-title-bar-lights:not(:hover) .m3-title-bar-btn{background-color:color-mix(in srgb, var(--color-on-surface) 20%, transparent);box-shadow:none}
2
2
  /*$vite$:1*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m3ui-vue/electron",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Electron integration for m3ui-vue: a Material Design 3 title bar with native or custom window controls, themed live from the M3 tokens",
5
5
  "keywords": ["electron", "material-design", "material-3", "m3", "vue", "title-bar", "window-controls-overlay", "tailwindcss"],
6
6
  "homepage": "https://m3ui.dev",
@@ -40,7 +40,7 @@
40
40
  "prepack": "pnpm build"
41
41
  },
42
42
  "peerDependencies": {
43
- "@m3ui-vue/m3ui-vue": "^1.12.0",
43
+ "@m3ui-vue/m3ui-vue": "^1.13.0",
44
44
  "electron": ">=33",
45
45
  "vue": "^3.5.0"
46
46
  },
@@ -48,7 +48,7 @@
48
48
  "electron": { "optional": true }
49
49
  },
50
50
  "devDependencies": {
51
- "@m3ui-vue/m3ui-vue": "^1.12.0",
51
+ "@m3ui-vue/m3ui-vue": "^1.13.0",
52
52
  "@types/node": "^24.0.0",
53
53
  "@vitejs/plugin-vue": "^6.0.11",
54
54
  "@vue/test-utils": "^2.6.0",
@@ -1,10 +0,0 @@
1
- // src/shared.ts
2
- var e = {
3
- info: "m3ui:info",
4
- state: "m3ui:state",
5
- action: "m3ui:action",
6
- overlay: "m3ui:overlay"
7
- }, t = "m3ui";
8
- export { e as n, t };
9
-
10
- //# sourceMappingURL=shared-B-ScY3hE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-B-ScY3hE.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}\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}\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\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":";AAiDA,IAAaA,IAAM;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;AACX,GAGaC,IAAa"}
@@ -1,2 +0,0 @@
1
- var e={info:`m3ui:info`,state:`m3ui:state`,action:`m3ui:action`,overlay:`m3ui:overlay`},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-CWEPeNW8.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-CWEPeNW8.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}\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}\n\nexport const IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\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":"AAiDA,IAAaA,EAAM,CACjB,KAAM,YACN,MAAO,aACP,OAAQ,cACR,QAAS,cACX,EAGaC,EAAa,O"}