@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.
package/README.md CHANGED
@@ -92,7 +92,7 @@ anything else that should be with `data-no-drag`.
92
92
  |---|---|---|
93
93
  | `title` | | Window title (or the default slot) |
94
94
  | `icon` | | App icon: an image (path, import, URL, data: URL; shown at 20px) or a Material Symbol name |
95
- | `menus` | | `MenuBarMenu[]` (File, Edit…), rendered by the library's `MMenuBar`: icons, shortcut hints, checks, dividers, submenus. Each item's `onSelect` runs, and `menu-select` gets every chosen item |
95
+ | `menus` | | `MenuBarMenu[]` (File, Edit…), rendered by the library's `MMenuBar`: icons, shortcut hints, checks, dividers, submenus. Each item's `onSelect` runs, and `menu-select` gets every chosen item. With `native` controls on macOS they go to the menu bar at the top of the screen instead (after the app menu, and a standard Edit menu unless yours is called Edit); there the shortcuts are bound, so don't bind those keys yourself. Elsewhere native mode has no system title bar to hold a menu, so they stay in the bar |
96
96
  | `menusPosition` | `'inline'` | `'inline'`: menus in the bar after the icon. `'below'`: a row of their own under it (classic) |
97
97
  | `syncNativeTheme` | `true` | Keep Electron's `nativeTheme` (dialogs, context menus, scrollbars, macOS frame) on the app's `useTheme()` choice |
98
98
  | `color` | `'surface'` | An M3 role or any CSS color |
@@ -138,11 +138,75 @@ watchEffect(() => win.accentColor.value && setSeed(win.accentColor.value))
138
138
  | Badge | macOS, Linux Unity launchers |
139
139
  | Attention | all |
140
140
 
141
+ ### Bootsplash
142
+
143
+ A small window shown the moment the app starts, with a loading bar and a status line (Discord's launcher is the
144
+ idea), that hands over to your window once it's ready. It's a self-contained page drawn from M3 parts (surface
145
+ container, extra-large corners, the wavy or flat progress indicator), so it shows before your bundle has even loaded.
146
+ Four presets: `classic` (logo, name, bar, status), `banner` (landscape, on the primary container), `minimal` (the logo
147
+ and a short bar) and `immersive` (the whole window in the primary color); each has its own size, which `width` and
148
+ `height` change.
149
+
150
+ It goes when the app is ready (by default, with the bar on your `progress()` steps or indeterminate), or after a set
151
+ time with `duration`: the bar fills by itself over it, and it still waits for the app if that's slower.
152
+
153
+ ```ts
154
+ // main
155
+ import { createSplash, m3WindowOptions, setupM3Window } from '@m3ui-vue/electron/main'
156
+
157
+ app.whenReady().then(async () => {
158
+ const splash = createSplash({ title: 'Acme', logo: join(import.meta.dirname, 'icon.png'), footer: `v${app.getVersion()}` })
159
+ const win = new BrowserWindow({ show: false, ...m3WindowOptions(m3), webPreferences: { preload } })
160
+ setupM3Window(win, m3)
161
+ splash.progress(0.3, 'Loading your workspace…') // 0–1; null for an indeterminate bar
162
+ win.loadURL(url)
163
+ await splash.handoff(win) // shows win once it's ready, then the splash fades out
164
+ })
165
+ ```
166
+
167
+ The page can drive it too, and say when it's really ready (after its first data, say):
168
+
169
+ ```ts
170
+ // main: splash.handoff(win, { waitForRenderer: true })
171
+ const win = useElectronWindow()
172
+ win.splashProgress(0.6, 'Syncing projects…')
173
+ await loadEverything()
174
+ win.splashDone()
175
+ ```
176
+
177
+ | Option | Default | |
178
+ |---|---|---|
179
+ | `preset` | `'classic'` | `'classic'`, `'banner'`, `'minimal'`, `'immersive'` |
180
+ | `indicator` | `'wavy'` | M3 Expressive's wavy indicator, or `'linear'` |
181
+ | `duration` | none | ms: a set time, the bar fills by itself (it still waits for the app if that's slower) |
182
+ | `title` | `app.getName()` | Under the logo |
183
+ | `logo` | the title's initial | A file path (png, svg, jpg, webp, ico), a data: or http(s) URL |
184
+ | `logoSize` | per preset | px: 96 classic, 72 banner, 112 minimal and immersive |
185
+ | `status`, `progress` | `''`, `null` | The first status line and bar (null: indeterminate) |
186
+ | `footer` | `''` | A line at the bottom, e.g. the version |
187
+ | `theme` | `'system'` | `'light'`, `'dark'`, or the system's |
188
+ | `colors` | M3 baseline | First-launch colors: `{ primary, surface, … }`, or `{ light: {…}, dark: {…} }` |
189
+ | `remember` | `true` | Later launches use the theme and palette the app last showed |
190
+ | `width`, `height` | per preset | classic 300 × 340, banner 520 × 280, minimal 240 × 240, immersive 360 × 420 |
191
+ | `rounded` | not on Linux | 28px corners on a transparent window (a Linux window manager without a compositor paints them black) |
192
+ | `fontFamily` | `system-ui, sans-serif` | Your app's fonts aren't loaded there |
193
+ | `minDuration` | `700` | ms it stays at least, so a fast start doesn't flash it |
194
+
195
+ `handoff(win, { waitForRenderer, timeout })` waits for `win`'s `ready-to-show` (or `splashDone()`; `timeout`, 20 s by
196
+ default, shows it anyway), shows it, fades the splash out and closes it; if `win` closes first, the splash goes too.
197
+ `splash.close()` closes it without showing anything.
198
+
199
+ **Your theme from the second launch on.** The page keeps its current colors (light or dark, the palette, a seed) in
200
+ the userData folder whenever they change, and the next splash is painted with them: only the very first launch uses
201
+ `colors` or the baseline. `remember: false` turns it off. `@m3ui-vue/electron/splash-html` has the page alone
202
+ (`splashHtml()`), to preview it or serve it from another shell.
203
+
141
204
  ## Playground
142
205
 
143
206
  ```bash
144
207
  pnpm install
145
- pnpm -C playground dev # native controls
208
+ pnpm -C playground dev # native controls, after the bootsplash (M3_SPLASH=0 skips it; M3_SPLASH_PRESET=banner,
209
+ # M3_SPLASH_INDICATOR=linear, M3_SPLASH_DURATION=4000 try the options)
146
210
  pnpm -C playground dev:custom # frameless, custom controls
147
211
  ```
148
212
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("vue"),t=require("@m3ui-vue/m3ui-vue");const n=require("./shared-BLenUWPr.cjs");function r(){return typeof window<`u`?window[n.t]:void 0}var i=(0,e.ref)(!1),a=(0,e.ref)(`native`),o=(0,e.ref)(``),s=(0,e.ref)(40),c=(0,e.ref)(!1),l=(0,e.ref)(!1),u=(0,e.ref)(!0),d=(0,e.ref)(null),f=0,p=null,m=null,h=null;function g(e){c.value=e.maximized,l.value=e.fullscreen,u.value=e.focused}function _(e){p||=e.onState(g),m||=e.onAccent?.(e=>{d.value=e})??null,h??=e.info().then(e=>{e&&(a.value=e.controls,o.value=e.platform,s.value=e.titleBarHeight,d.value=e.accentColor??null,g(e.state),i.value=!0)}).catch(()=>{h=null})}function v(){p?.(),p=null,m?.(),m=null}function y(){let t=r();return t&&(f++,_(t),(0,e.getCurrentScope)()&&(0,e.onScopeDispose)(()=>{--f===0&&v()})),{isElectron:!!t,ready:(0,e.readonly)(i),controls:(0,e.readonly)(a),platform:(0,e.readonly)(o),isMac:(0,e.computed)(()=>o.value===`darwin`),titleBarHeight:(0,e.readonly)(s),maximized:(0,e.readonly)(c),fullscreen:(0,e.readonly)(l),focused:(0,e.readonly)(u),accentColor:(0,e.readonly)(d),minimize:()=>t?.action(`minimize`),toggleMaximize:()=>t?.action(`toggle-maximize`),close:()=>t?.action(`close`),setOverlay:e=>t?.setOverlay(e),setTheme:e=>t?.setTheme?.(e),setProgress:e=>t?.setProgress?.(e),setBadge:e=>t?.setBadge?.(e),requestAttention:()=>t?.attention?.()}}var ee=[`data-controls`],te={class:`m3-title-bar-area`},b={key:0,class:`m3-title-bar-icon`},x=[`src`],ne={class:`m3-title-bar-start`},re={class:`m3-title-bar-title`},ie={class:`m3-title-bar-text`},S={class:`m3-title-bar-end`},ae=[`aria-label`,`title`,`onClick`],C={key:1,viewBox:`0 0 12 12`,"aria-hidden":`true`},w={key:0,d:`M3.5 3.5l5 5M8.5 3.5l-5 5`},T={key:1,d:`M3 6h6`},E={key:2,d:`M6 3v6M3 6h6`},oe={key:0,class:`m3-title-bar-menu-row`},D=(0,e.defineComponent)({__name:`MTitleBar`,props:{title:{},icon:{},menus:{},menusPosition:{default:`inline`},menusVisibility:{default:`visible`},color:{default:`surface`},titleAlign:{default:`start`},buttons:{default:()=>[`minimize`,`maximize`,`close`]},side:{default:`auto`},look:{default:`auto`},syncNativeTheme:{type:Boolean,default:!0}},emits:[`menu-select`],setup(n,{emit:r}){let i=n,a=r,o=(0,t.useLocale)(),s=(0,e.ref)(!1),c=(0,e.computed)(()=>{let e=i.menus??[];return!e.length||i.menusVisibility===`hidden`||i.menusVisibility===`toggle`&&!s.value?[]:i.menusVisibility===`compact`?[{label:o.appMenuLabel,icon:`menu`,items:e.map(e=>({label:e.label,disabled:e.disabled,children:e.items}))}]:e}),l=(0,e.computed)(()=>i.menusPosition===`below`&&i.menusVisibility!==`compact`),u=(e,t)=>e.some(e=>e===t||!!e.children&&u(e.children,t));function d(e){a(`menu-select`,e,Math.max(0,(i.menus??[]).findIndex(t=>u(t.items,e)))),i.menusVisibility===`toggle`&&(s.value=!1)}let f=!1;function p(e){f=e.key===`Alt`&&!e.repeat&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey}function m(t){t.key===`Alt`&&f&&i.menusVisibility===`toggle`&&i.menus?.length&&(f=!1,t.preventDefault(),s.value=!s.value,s.value&&(0,e.nextTick)(()=>H.value?.querySelector(`.m3-menu-bar [role="menuitem"]`)?.focus()))}function h(){s.value&&setTimeout(()=>{let e=H.value?.querySelector(`.m3-menu-bar`);e&&(e.querySelector(`[aria-expanded="true"]`)||e.contains(document.activeElement)||(s.value=!1))},0)}function g(e){if(e.key!==`Escape`||!s.value)return;let t=e.target;t.closest(`.m3-menu-bar`)&&t.getAttribute(`aria-expanded`)!==`true`&&(s.value=!1)}(0,e.watch)(()=>i.menusVisibility,()=>{s.value=!1}),(0,e.onMounted)(()=>{window.addEventListener(`keydown`,p,!0),window.addEventListener(`keyup`,m,!0),document.addEventListener(`pointerdown`,h,!0),document.addEventListener(`focusin`,h)}),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keyup`,m,!0),document.removeEventListener(`pointerdown`,h,!0),document.removeEventListener(`focusin`,h)});let _=(0,e.computed)(()=>!!i.icon&&/[/.:]/.test(i.icon)),v=y(),{controls:D,maximized:O,focused:k,fullscreen:A,isMac:j,titleBarHeight:M}=v,se=/^[a-z]+(-[a-z]+)*$/,ce=(0,e.computed)(()=>se.test(i.color)?`var(--color-${i.color})`:i.color),N=(0,e.computed)(()=>v.isElectron&&D.value===`custom`),P=(0,e.computed)(()=>v.isElectron&&D.value===`native`),F=(0,e.computed)(()=>i.side===`auto`?j.value:i.side===`start`),I=(0,e.computed)(()=>i.look===`auto`?j.value:i.look===`traffic-lights`),L=(0,e.computed)(()=>{let e=i.buttons.filter((e,t,n)=>n.indexOf(e)===t);return I.value?[`close`,`minimize`,`maximize`].filter(t=>e.includes(t)):F.value?[...e].reverse():e}),R=(0,e.computed)(()=>O.value||A.value?o.windowRestore:o.windowMaximize),z=(0,e.computed)(()=>({minimize:o.windowMinimize,maximize:R.value,close:o.close})),B=e=>e===`minimize`?v.minimize():e===`maximize`?v.toggleMaximize():v.close();function V(e){N.value&&(e.target.closest(`button, a, input, select, textarea, [role="button"], [data-no-drag]`)||v.toggleMaximize())}let H=(0,e.ref)(),U=(0,e.ref)(),W=0,G=0,K=null,q=null;function J(e,t){let n=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/.exec(e);if(!n)return null;let r=n[4]==null?1:n[4].endsWith(`%`)?parseFloat(n[4])/100:parseFloat(n[4]),i=[+n[1],+n[2],+n[3]];return r<1&&t?i.forEach((e,n)=>i[n]=e*r+t[n]*(1-r)):r=1,`#${i.map(e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`)).join(``)}`}function le(){let e=J(getComputedStyle(document.body).backgroundColor)??J(getComputedStyle(document.documentElement).backgroundColor)??`#ffffff`;return[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))}function ue(){if(!H.value||!U.value)return;let e=J(getComputedStyle(H.value).backgroundColor,le()),t=J(getComputedStyle(U.value).color);e&&t&&v.setOverlay({color:e,symbolColor:t})}function Y(e=600){if(!P.value||j.value||(G=performance.now()+e,W))return;let t=()=>{ue(),W=performance.now()<G?requestAnimationFrame(t):0};t()}let X=()=>Y();function Z(){K||!P.value||j.value||(Y(),K=new MutationObserver(()=>Y()),K.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-palette`,`data-theme`]}),q=window.matchMedia?.(`(prefers-color-scheme: dark)`)??null,q?.addEventListener?.(`change`,X))}function Q(){K?.disconnect(),K=null,q?.removeEventListener?.(`change`,X),q=null,cancelAnimationFrame(W),W=0}(0,e.onMounted)(()=>{v.ready.value&&Z()}),(0,e.watch)([v.ready,P,j],()=>{Q(),v.ready.value&&Z()}),(0,e.watch)(()=>i.color,()=>Y());let{theme:$}=(0,t.useTheme)();return(0,e.watch)([$,()=>i.syncNativeTheme,v.ready],()=>{i.syncNativeTheme&&v.ready.value&&v.setTheme($.value)},{immediate:!0}),(0,e.onBeforeUnmount)(Q),(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`header`,{ref_key:`bar`,ref:H,class:(0,e.normalizeClass)([`m3-title-bar`,{"m3-title-bar-native":P.value,"m3-title-bar-blurred":!(0,e.unref)(k),"m3-title-bar-center":n.titleAlign===`center`}]),style:(0,e.normalizeStyle)({background:ce.value}),"data-controls":(0,e.unref)(v).isElectron?(0,e.unref)(D):void 0},[(0,e.createElementVNode)(`span`,{ref_key:`probe`,ref:U,class:`m3-title-bar-probe`,"aria-hidden":`true`},null,512),(0,e.createElementVNode)(`div`,{class:`m3-title-bar-row`,style:(0,e.normalizeStyle)({height:`${(0,e.unref)(M)}px`}),onDblclick:V},[(0,e.createElementVNode)(`div`,te,[n.icon||r.$slots.icon?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,b,[(0,e.renderSlot)(r.$slots,`icon`,{},()=>[_.value?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,src:n.icon,alt:``,draggable:`false`},null,8,x)):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MIcon),{key:1,name:n.icon,size:20},null,8,[`name`]))])])):(0,e.createCommentVNode)(``,!0),c.value.length&&!l.value?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MMenuBar),{key:1,menus:c.value,height:Math.min(32,(0,e.unref)(M)-8),class:`m3-title-bar-menus`,onSelect:d,onKeydown:g},null,8,[`menus`,`height`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,ne,[(0,e.renderSlot)(r.$slots,`start`)]),(0,e.createElementVNode)(`div`,re,[(0,e.createElementVNode)(`span`,ie,[(0,e.renderSlot)(r.$slots,`default`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(n.title),1)])])]),(0,e.createElementVNode)(`div`,S,[(0,e.renderSlot)(r.$slots,`end`)]),N.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,class:(0,e.normalizeClass)([`m3-title-bar-side`,F.value&&`m3-title-bar-controls-start`])},[(0,e.renderSlot)(r.$slots,`controls`,(0,e.normalizeProps)((0,e.guardReactiveProps)({minimize:(0,e.unref)(v).minimize,toggleMaximize:(0,e.unref)(v).toggleMaximize,close:(0,e.unref)(v).close,maximized:(0,e.unref)(O),focused:(0,e.unref)(k)})),()=>[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`m3-title-bar-controls`,I.value&&`m3-title-bar-lights`])},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(L.value,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:n,type:`button`,class:(0,e.normalizeClass)([`m3-title-bar-btn`,`m3-title-bar-btn-${n}`]),"aria-label":z.value[n],title:z.value[n],onClick:e=>B(n)},[I.value?((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,C,[n===`close`?((0,e.openBlock)(),(0,e.createElementBlock)(`path`,w)):n===`minimize`?((0,e.openBlock)(),(0,e.createElementBlock)(`path`,T)):((0,e.openBlock)(),(0,e.createElementBlock)(`path`,E))])):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MIcon),{key:0,name:n===`minimize`?`minimize`:n===`close`?`close`:(0,e.unref)(O)||(0,e.unref)(A)?`close_fullscreen`:`open_in_full`,size:n===`maximize`?16:18},null,8,[`name`,`size`]))],10,ae))),128))],2)])],2)):(0,e.createCommentVNode)(``,!0)])],36),c.value.length&&l.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[(0,e.createVNode)((0,e.unref)(t.MMenuBar),{menus:c.value,height:32,onSelect:d,onKeydown:g},null,8,[`menus`])])):(0,e.createCommentVNode)(``,!0)],14,ee))}});exports.MTitleBar=D,exports.useElectronWindow=y;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("vue"),t=require("@m3ui-vue/m3ui-vue");const n=require("./splash-html.cjs"),r=require("./shared-DS-DQqb1.cjs");function i(){return typeof window<`u`?window[r.t]:void 0}var a=(0,e.ref)(!1),o=(0,e.ref)(`native`),s=(0,e.ref)(``),c=(0,e.ref)(40),l=(0,e.ref)(!1),u=(0,e.ref)(!1),d=(0,e.ref)(!0),f=(0,e.ref)(null),p=0,m=null,h=null,g=null,_=null;function v(){if(typeof document>`u`)return null;let e=getComputedStyle(document.documentElement),t={};for(let[r,i]of Object.entries(n.SPLASH_TOKENS)){let n=e.getPropertyValue(i).trim();n&&(t[r]=n)}return Object.keys(t).length?{scheme:document.documentElement.classList.contains(`dark`)?`dark`:`light`,colors:t}:null}function y(e){let t=v();t&&e.splashColors?.(t.scheme,t.colors)}function b(e){if(_||!e.splashColors||typeof MutationObserver>`u`)return;let t,n=()=>{clearTimeout(t),t=setTimeout(()=>y(e),800)},r=new MutationObserver(n);r.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-palette`,`data-theme`,`data-contrast`]});let i=window.matchMedia?.(`(prefers-color-scheme: dark)`);i?.addEventListener?.(`change`,n),n(),_=()=>{clearTimeout(t),r.disconnect(),i?.removeEventListener?.(`change`,n)}}function x(e){l.value=e.maximized,u.value=e.fullscreen,d.value=e.focused}function S(e){m||=e.onState(x),h||=e.onAccent?.(e=>{f.value=e})??null,b(e),g??=e.info().then(e=>{e&&(o.value=e.controls,s.value=e.platform,c.value=e.titleBarHeight,f.value=e.accentColor??null,x(e.state),a.value=!0)}).catch(()=>{g=null})}function C(){m?.(),m=null,h?.(),h=null,_?.(),_=null}function w(){let t=i();return t&&(p++,S(t),(0,e.getCurrentScope)()&&(0,e.onScopeDispose)(()=>{--p===0&&C()})),{isElectron:!!t,ready:(0,e.readonly)(a),controls:(0,e.readonly)(o),platform:(0,e.readonly)(s),isMac:(0,e.computed)(()=>s.value===`darwin`),titleBarHeight:(0,e.readonly)(c),maximized:(0,e.readonly)(l),fullscreen:(0,e.readonly)(u),focused:(0,e.readonly)(d),accentColor:(0,e.readonly)(f),minimize:()=>t?.action(`minimize`),toggleMaximize:()=>t?.action(`toggle-maximize`),close:()=>t?.action(`close`),setOverlay:e=>t?.setOverlay(e),setTheme:e=>t?.setTheme?.(e),setProgress:e=>t?.setProgress?.(e),setBadge:e=>t?.setBadge?.(e),requestAttention:()=>t?.attention?.(),canSetNativeMenu:typeof t?.setMenu==`function`,setNativeMenu:e=>t?.setMenu?.(e),onNativeMenuClick:e=>t?.onMenuClick?.(e)??(()=>{}),splashProgress:(e,n)=>t?.splash?.(n===void 0?{progress:e}:{progress:e,status:n}),splashDone:()=>t?.splashDone?.(),rememberSplashColors:()=>{t&&y(t)}}}function T(e){if(!e)return;let t=e.replace(/([⌘⇧⌥⌃])/g,`$1+`).split(`+`).map(e=>e.trim()).filter(Boolean),n={"⌘":`CmdOrCtrl`,"⌃":`CmdOrCtrl`,"⇧":`Shift`,"⌥":`Alt`};return t.map(e=>n[e]??(/^(ctrl|control|cmd|command)$/i.test(e)?`CmdOrCtrl`:/^option$/i.test(e)?`Alt`:e)).join(`+`)}function ee(e){let t=new Map,n=1,r=(e,i)=>e.map(e=>{if(e.divider)return{type:`separator`};let a=e.label??``;if(e.children)return{type:`submenu`,label:a,enabled:!e.disabled,items:r(e.children,i)};let o=n++;t.set(o,[e,i]);let s=e.checked!==void 0||e.selected!==void 0;return{type:s?`checkbox`:`normal`,id:o,label:a,enabled:!e.disabled,...s?{checked:!!(e.checked??e.selected)}:{},accelerator:T(e.shortcut)}});return{data:e.map((e,t)=>({label:e.label,enabled:!e.disabled,items:r(e.items,t)})),picks:t}}var te=[`data-controls`],ne={class:`m3-title-bar-area`},re={key:0,class:`m3-title-bar-icon`},ie=[`src`],ae={class:`m3-title-bar-start`},E={class:`m3-title-bar-title`},D={class:`m3-title-bar-text`},O={class:`m3-title-bar-end`},oe=[`aria-label`,`title`,`onClick`],se={key:1,viewBox:`0 0 12 12`,"aria-hidden":`true`},ce={key:0,d:`M3.5 3.5l5 5M8.5 3.5l-5 5`},le={key:1,d:`M3 6h6`},ue={key:2,d:`M6 3v6M3 6h6`},de={key:0,class:`m3-title-bar-menu-row`},k=(0,e.defineComponent)({__name:`MTitleBar`,props:{title:{},icon:{},menus:{},menusPosition:{default:`inline`},menusVisibility:{default:`visible`},color:{default:`surface`},titleAlign:{default:`start`},buttons:{default:()=>[`minimize`,`maximize`,`close`]},side:{default:`auto`},look:{default:`auto`},syncNativeTheme:{type:Boolean,default:!0}},emits:[`menu-select`],setup(n,{emit:r}){let i=n,a=r,o=(0,t.useLocale)(),s=(0,e.ref)(!1),c=(0,e.computed)(()=>{let e=i.menus??[];return M.value||!e.length||i.menusVisibility===`hidden`||i.menusVisibility===`toggle`&&!s.value?[]:i.menusVisibility===`compact`?[{label:o.appMenuLabel,icon:`menu`,items:e.map(e=>({label:e.label,disabled:e.disabled,children:e.items}))}]:e}),l=(0,e.computed)(()=>i.menusPosition===`below`&&i.menusVisibility!==`compact`),u=(e,t)=>e.some(e=>e===t||!!e.children&&u(e.children,t));function d(e){a(`menu-select`,e,Math.max(0,(i.menus??[]).findIndex(t=>u(t.items,e)))),i.menusVisibility===`toggle`&&(s.value=!1)}let f=!1;function p(e){f=e.key===`Alt`&&!e.repeat&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey}function m(t){t.key===`Alt`&&f&&i.menusVisibility===`toggle`&&i.menus?.length&&(f=!1,t.preventDefault(),s.value=!s.value,s.value&&(0,e.nextTick)(()=>V.value?.querySelector(`.m3-menu-bar [role="menuitem"]`)?.focus()))}function h(){s.value&&setTimeout(()=>{let e=V.value?.querySelector(`.m3-menu-bar`);e&&(e.querySelector(`[aria-expanded="true"]`)||e.contains(document.activeElement)||(s.value=!1))},0)}function g(e){if(e.key!==`Escape`||!s.value)return;let t=e.target;t.closest(`.m3-menu-bar`)&&t.getAttribute(`aria-expanded`)!==`true`&&(s.value=!1)}(0,e.watch)(()=>i.menusVisibility,()=>{s.value=!1}),(0,e.onMounted)(()=>{window.addEventListener(`keydown`,p,!0),window.addEventListener(`keyup`,m,!0),document.addEventListener(`pointerdown`,h,!0),document.addEventListener(`focusin`,h)}),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keyup`,m,!0),document.removeEventListener(`pointerdown`,h,!0),document.removeEventListener(`focusin`,h)});let _=(0,e.computed)(()=>!!i.icon&&/[/.:]/.test(i.icon)),v=w(),{controls:y,maximized:b,focused:x,fullscreen:S,isMac:C,titleBarHeight:T}=v,k=/^[a-z]+(-[a-z]+)*$/,fe=(0,e.computed)(()=>k.test(i.color)?`var(--color-${i.color})`:i.color),A=(0,e.computed)(()=>v.isElectron&&y.value===`custom`),j=(0,e.computed)(()=>v.isElectron&&y.value===`native`),M=(0,e.computed)(()=>j.value&&C.value&&v.canSetNativeMenu&&!!i.menus?.length),N=new Map,P=!1,F=v.onNativeMenuClick(e=>{let t=N.get(e);t&&(t[0].onSelect?.(),a(`menu-select`,t[0],t[1]))});(0,e.watch)([M,()=>i.menus],()=>{if(M.value){let{data:e,picks:t}=ee(i.menus);N=t,v.setNativeMenu(e),P=!0}else P&&=(v.setNativeMenu(null),!1)},{immediate:!0}),(0,e.onBeforeUnmount)(()=>{F(),P&&v.setNativeMenu(null)});let I=(0,e.computed)(()=>i.side===`auto`?C.value:i.side===`start`),L=(0,e.computed)(()=>i.look===`auto`?C.value:i.look===`traffic-lights`),R=(0,e.computed)(()=>{let e=i.buttons.filter((e,t,n)=>n.indexOf(e)===t);return L.value?[`close`,`minimize`,`maximize`].filter(t=>e.includes(t)):I.value?[...e].reverse():e}),z=(0,e.computed)(()=>b.value||S.value?o.windowRestore:o.windowMaximize),B=(0,e.computed)(()=>({minimize:o.windowMinimize,maximize:z.value,close:o.close})),pe=e=>e===`minimize`?v.minimize():e===`maximize`?v.toggleMaximize():v.close();function me(e){A.value&&(e.target.closest(`button, a, input, select, textarea, [role="button"], [data-no-drag]`)||v.toggleMaximize())}let V=(0,e.ref)(),H=(0,e.ref)(),U=0,W=0,G=null,K=null;function q(e,t){let n=/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/.exec(e);if(!n)return null;let r=n[4]==null?1:n[4].endsWith(`%`)?parseFloat(n[4])/100:parseFloat(n[4]),i=[+n[1],+n[2],+n[3]];return r<1&&t?i.forEach((e,n)=>i[n]=e*r+t[n]*(1-r)):r=1,`#${i.map(e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`)).join(``)}`}function J(){let e=q(getComputedStyle(document.body).backgroundColor)??q(getComputedStyle(document.documentElement).backgroundColor)??`#ffffff`;return[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))}function he(){if(!V.value||!H.value)return;let e=q(getComputedStyle(V.value).backgroundColor,J()),t=q(getComputedStyle(H.value).color);e&&t&&v.setOverlay({color:e,symbolColor:t})}function Y(e=600){if(!j.value||C.value||(W=performance.now()+e,U))return;let t=()=>{he(),U=performance.now()<W?requestAnimationFrame(t):0};t()}let X=()=>Y();function Z(){G||!j.value||C.value||(Y(),G=new MutationObserver(()=>Y()),G.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-palette`,`data-theme`]}),K=window.matchMedia?.(`(prefers-color-scheme: dark)`)??null,K?.addEventListener?.(`change`,X))}function Q(){G?.disconnect(),G=null,K?.removeEventListener?.(`change`,X),K=null,cancelAnimationFrame(U),U=0}(0,e.onMounted)(()=>{v.ready.value&&Z()}),(0,e.watch)([v.ready,j,C],()=>{Q(),v.ready.value&&Z()}),(0,e.watch)(()=>i.color,()=>Y());let{theme:$}=(0,t.useTheme)();return(0,e.watch)([$,()=>i.syncNativeTheme,v.ready],()=>{i.syncNativeTheme&&v.ready.value&&v.setTheme($.value)},{immediate:!0}),(0,e.onBeforeUnmount)(Q),(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`header`,{ref_key:`bar`,ref:V,class:(0,e.normalizeClass)([`m3-title-bar`,{"m3-title-bar-native":j.value,"m3-title-bar-blurred":!(0,e.unref)(x),"m3-title-bar-center":n.titleAlign===`center`}]),style:(0,e.normalizeStyle)({background:fe.value}),"data-controls":(0,e.unref)(v).isElectron?(0,e.unref)(y):void 0},[(0,e.createElementVNode)(`span`,{ref_key:`probe`,ref:H,class:`m3-title-bar-probe`,"aria-hidden":`true`},null,512),(0,e.createElementVNode)(`div`,{class:`m3-title-bar-row`,style:(0,e.normalizeStyle)({height:`${(0,e.unref)(T)}px`}),onDblclick:me},[(0,e.createElementVNode)(`div`,ne,[n.icon||r.$slots.icon?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,re,[(0,e.renderSlot)(r.$slots,`icon`,{},()=>[_.value?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,src:n.icon,alt:``,draggable:`false`},null,8,ie)):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MIcon),{key:1,name:n.icon,size:20},null,8,[`name`]))])])):(0,e.createCommentVNode)(``,!0),c.value.length&&!l.value?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MMenuBar),{key:1,menus:c.value,height:Math.min(32,(0,e.unref)(T)-8),class:`m3-title-bar-menus`,onSelect:d,onKeydown:g},null,8,[`menus`,`height`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,ae,[(0,e.renderSlot)(r.$slots,`start`)]),(0,e.createElementVNode)(`div`,E,[(0,e.createElementVNode)(`span`,D,[(0,e.renderSlot)(r.$slots,`default`,{},()=>[(0,e.createTextVNode)((0,e.toDisplayString)(n.title),1)])])]),(0,e.createElementVNode)(`div`,O,[(0,e.renderSlot)(r.$slots,`end`)]),A.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,class:(0,e.normalizeClass)([`m3-title-bar-side`,I.value&&`m3-title-bar-controls-start`])},[(0,e.renderSlot)(r.$slots,`controls`,(0,e.normalizeProps)((0,e.guardReactiveProps)({minimize:(0,e.unref)(v).minimize,toggleMaximize:(0,e.unref)(v).toggleMaximize,close:(0,e.unref)(v).close,maximized:(0,e.unref)(b),focused:(0,e.unref)(x)})),()=>[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`m3-title-bar-controls`,L.value&&`m3-title-bar-lights`])},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(R.value,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:n,type:`button`,class:(0,e.normalizeClass)([`m3-title-bar-btn`,`m3-title-bar-btn-${n}`]),"aria-label":B.value[n],title:B.value[n],onClick:e=>pe(n)},[L.value?((0,e.openBlock)(),(0,e.createElementBlock)(`svg`,se,[n===`close`?((0,e.openBlock)(),(0,e.createElementBlock)(`path`,ce)):n===`minimize`?((0,e.openBlock)(),(0,e.createElementBlock)(`path`,le)):((0,e.openBlock)(),(0,e.createElementBlock)(`path`,ue))])):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.MIcon),{key:0,name:n===`minimize`?`minimize`:n===`close`?`close`:(0,e.unref)(b)||(0,e.unref)(S)?`close_fullscreen`:`open_in_full`,size:n===`maximize`?16:18},null,8,[`name`,`size`]))],10,oe))),128))],2)])],2)):(0,e.createCommentVNode)(``,!0)])],36),c.value.length&&l.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,de,[(0,e.createVNode)((0,e.unref)(t.MMenuBar),{menus:c.value,height:32,onSelect:d,onKeydown:g},null,8,[`menus`])])):(0,e.createCommentVNode)(``,!0)],14,te))}});exports.MTitleBar=k,exports.useElectronWindow=w;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BRIDGE_KEY","ref","getCurrentScope","onScopeDispose","readonly","computed","$slots","useLocale","ref","computed","nextTick","watch","onMounted","onBeforeUnmount","useTheme","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createElementVNode","_renderSlot","_createBlock","MIcon","MMenuBar","_createTextVNode","_toDisplayString","_normalizeProps","_guardReactiveProps","_Fragment","_renderList","_createVNode","vue","_m3ui_vue_m3ui_vue","require_shared","bridge","ready","controls","platform","titleBarHeight","maximized","fullscreen","focused","accentColor","users","unsubscribe","unsubscribeAccent","started","apply","s","start","b","c","info","stop","useElectronWindow","colors","theme","value","count","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","MTitleBar_default","__props","__emit","props","emit","locale","revealed","shownMenus","menus","m","menusBelow","contains","items","item","i","onMenuSelect","altAlone","onKeydown","onKeyup","e","bar","hideLater","menubar","onBarKeydown","iconIsImage","win","isMac","ROLE","background","custom","native","atStart","lights","order","set","a","maximizeLabel","labels","run","onDblclick","probe","raf","until","observer","media","toHex","css","under","v","pageColor","hex","sendOverlay","color","symbolColor","follow","ms","step","onScheme","startSync","stopSync","_ctx","_cache","$event"],"sources":["../src/renderer/useElectronWindow.ts","../src/renderer/MTitleBar.vue"],"sourcesContent":["import { computed, onScopeDispose, readonly, ref, getCurrentScope, type ComputedRef, type Ref } from 'vue'\nimport { BRIDGE_KEY, DEFAULT_TITLE_BAR_HEIGHT, type M3Bridge, type M3Controls, type M3NativeTheme, type M3OverlayColors, type M3WindowState } from '../shared'\n\n/**\n * The window MTitleBar sits in, from the renderer: its mode and state (reactive) and its buttons. Outside Electron (or\n * without the preload's bridge) `isElectron` is false, nothing is ever `ready` and the actions do nothing, so the same\n * app also runs in a browser.\n */\nexport interface ElectronWindow {\n /** The preload's bridge is there */\n isElectron: boolean\n /** The main process has answered (mode, platform and state are real from here on) */\n ready: Readonly<Ref<boolean>>\n controls: Readonly<Ref<M3Controls>>\n /** `process.platform` of the main process (`''` until ready) */\n platform: Readonly<Ref<string>>\n isMac: ComputedRef<boolean>\n titleBarHeight: Readonly<Ref<number>>\n maximized: Readonly<Ref<boolean>>\n fullscreen: Readonly<Ref<boolean>>\n focused: Readonly<Ref<boolean>>\n /**\n * The system accent color (`#rrggbb`, Windows and macOS; null elsewhere), live. Seed the palette with it:\n * `watchEffect(() => accentColor.value && setSeed(accentColor.value))` with `useColorPalette()`\n */\n accentColor: Readonly<Ref<string | null>>\n minimize(): void\n toggleMaximize(): void\n close(): void\n /** Recolors the native buttons (MTitleBar does it from the theme; for a bar of your own) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (MTitleBar keeps it in step with `useTheme()`; for an app without the bar) */\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 requestAttention(): void\n}\n\n// The methods added after 0.1.0 are called with ?.(): a preload bundled from an older version (an app that updated\n// the package but not its preload build) must not break the renderer, it just doesn't get those features\nfunction bridge(): M3Bridge | undefined {\n return typeof window !== 'undefined' ? (window as unknown as Record<string, M3Bridge | undefined>)[BRIDGE_KEY] : undefined\n}\n\n// One window per renderer: the state is shared by every caller, fetched once, and kept while anyone uses it\nconst ready = ref(false)\nconst controls = ref<M3Controls>('native')\nconst platform = ref('')\nconst titleBarHeight = ref(DEFAULT_TITLE_BAR_HEIGHT)\nconst maximized = ref(false)\nconst fullscreen = ref(false)\nconst focused = ref(true)\nconst accentColor = ref<string | null>(null)\nlet users = 0\nlet unsubscribe: (() => void) | null = null\nlet unsubscribeAccent: (() => void) | null = null\nlet started: Promise<void> | null = null\n\nfunction apply(s: M3WindowState) {\n maximized.value = s.maximized\n fullscreen.value = s.fullscreen\n focused.value = s.focused\n}\n\nfunction start(b: M3Bridge) {\n if (!unsubscribe) unsubscribe = b.onState(apply)\n if (!unsubscribeAccent) unsubscribeAccent = b.onAccent?.((c) => { accentColor.value = c }) ?? null\n started ??= b.info().then((info) => {\n if (!info) return\n controls.value = info.controls\n platform.value = info.platform\n titleBarHeight.value = info.titleBarHeight\n accentColor.value = info.accentColor ?? null\n apply(info.state)\n ready.value = true\n }).catch(() => { started = null })\n}\n\nfunction stop() {\n unsubscribe?.()\n unsubscribe = null\n unsubscribeAccent?.()\n unsubscribeAccent = null\n}\n\nexport function useElectronWindow(): ElectronWindow {\n const b = bridge()\n if (b) {\n users++\n start(b)\n if (getCurrentScope()) onScopeDispose(() => { if (--users === 0) stop() })\n }\n return {\n isElectron: !!b,\n ready: readonly(ready),\n controls: readonly(controls),\n platform: readonly(platform),\n isMac: computed(() => platform.value === 'darwin'),\n titleBarHeight: readonly(titleBarHeight),\n maximized: readonly(maximized),\n fullscreen: readonly(fullscreen),\n focused: readonly(focused),\n accentColor: readonly(accentColor),\n minimize: () => b?.action('minimize'),\n toggleMaximize: () => b?.action('toggle-maximize'),\n close: () => b?.action('close'),\n setOverlay: (colors) => b?.setOverlay(colors),\n setTheme: (theme) => b?.setTheme?.(theme),\n setProgress: (value) => b?.setProgress?.(value),\n setBadge: (count) => b?.setBadge?.(count),\n requestAttention: () => b?.attention?.(),\n }\n}\n\n/** For tests: forget the fetched state */\nexport function _resetElectronWindow() {\n stop()\n users = 0\n started = null\n ready.value = false\n controls.value = 'native'\n platform.value = ''\n titleBarHeight.value = DEFAULT_TITLE_BAR_HEIGHT\n maximized.value = false\n fullscreen.value = false\n focused.value = true\n accentColor.value = null\n}\n","<script setup lang=\"ts\">\n/**\n * MTitleBar — the window's title bar for an Electron app, in M3: drags the window, double-click maximizes, and holds\n * the title plus anything you put at its start or end. The controls mode comes from the main process\n * (`m3WindowOptions({ controls })`), not a prop, so the two can't disagree:\n * - `native`: the system draws the buttons over the bar (Windows 11 snap layouts, macOS traffic lights) and the bar\n * leaves their room free; their colors follow the bar's background and the theme live, palette changes included.\n * - `custom`: a frameless window; the bar draws M3 buttons (or traffic lights), on the side and with the buttons\n * you choose, or your own through `#controls`.\n * Outside Electron it renders as a plain bar without buttons, so the same app runs in a browser.\n *\n * @slot default The title (replaces `title`)\n * @slot start Content after the icon and the menus (a back button, a breadcrumb…)\n * @slot end Content before the trailing controls (a search field, account button…)\n * @slot controls Replaces the custom controls (`{ minimize, toggleMaximize, close, maximized, focused }`)\n * @slot icon Replaces the app icon\n * @event menu-select Emitted with the menu item chosen (and its menu's index), as MMenuBar's `select`\n */\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { MIcon, MMenuBar, useLocale, useTheme, type MenuBarItem, type MenuBarMenu } from '@m3ui-vue/m3ui-vue'\nimport { useElectronWindow } from './useElectronWindow'\n\ntype Button = 'minimize' | 'maximize' | 'close'\n\nconst props = withDefaults(\n defineProps<{\n /** The window title */\n title?: string\n /**\n * The app icon at the start: an image URL (`'/icon.png'`, an import, a data: URL) or a Material Symbol name.\n * Clicking it does nothing (the `#icon` slot takes a button of yours)\n */\n icon?: string\n /** Menus (File, Edit…) after the icon, as an MMenuBar: items with submenus, dividers, checks, shortcut hints */\n menus?: MenuBarMenu[]\n /** `inline`: the menus sit in the title bar, after the icon. `below`: in a row of their own under it (classic) */\n menusPosition?: 'inline' | 'below'\n /**\n * Like VS Code's \"menu bar visibility\": `visible`; `compact`, one ☰ button in the bar holding every menu;\n * `toggle`, hidden until Alt is pressed (and hidden again after a pick, Esc or a click elsewhere); `hidden`\n */\n menusVisibility?: 'visible' | 'compact' | 'toggle' | 'hidden'\n /** Bar color: an M3 role (`'surface-container'`) or any CSS color */\n color?: string\n /** Where the title sits */\n titleAlign?: 'start' | 'center'\n /** Custom controls only: which buttons, in this order on the end side (mirrored on the start side) */\n buttons?: Button[]\n /** Custom controls only: the side they sit on; `auto` is the start on macOS, the end elsewhere */\n side?: 'auto' | 'start' | 'end'\n /** Custom controls only: M3 icon buttons or macOS-style traffic lights; `auto` picks by platform */\n look?: 'auto' | 'm3' | 'traffic-lights'\n /**\n * Keep the native UI's theme (dialogs, context menus, scrollbars, macOS's frame) on the app's `useTheme()`\n * choice: light, dark or system\n */\n syncNativeTheme?: boolean\n }>(),\n { color: 'surface', titleAlign: 'start', buttons: () => ['minimize', 'maximize', 'close'], side: 'auto', look: 'auto', syncNativeTheme: true, menusPosition: 'inline', menusVisibility: 'visible' },\n)\n\nconst emit = defineEmits<{ 'menu-select': [item: MenuBarItem, menu: number] }>()\n\nconst locale = useLocale()\n// ── Menus ─────────────────────────────────────────────────────────────────────────────────────────────────────\nconst revealed = ref(false) // toggle mode: shown by Alt\nconst shownMenus = computed<MenuBarMenu[]>(() => {\n const menus = props.menus ?? []\n if (!menus.length || props.menusVisibility === 'hidden') return []\n if (props.menusVisibility === 'toggle' && !revealed.value) return []\n if (props.menusVisibility === 'compact') {\n return [{ label: locale.appMenuLabel, icon: 'menu', items: menus.map((m) => ({ label: m.label, disabled: m.disabled, children: m.items })) }]\n }\n return menus\n})\n// The ☰ button always sits in the bar; a row below for it alone would waste a row\nconst menusBelow = computed(() => props.menusPosition === 'below' && props.menusVisibility !== 'compact')\n\nconst contains = (items: MenuBarItem[], item: MenuBarItem): boolean => items.some((i) => i === item || (!!i.children && contains(i.children, item)))\nfunction onMenuSelect(item: MenuBarItem) {\n // The index in `menus`, also from the compact button (where MMenuBar only sees one menu)\n emit('menu-select', item, Math.max(0, (props.menus ?? []).findIndex((m) => contains(m.items, item))))\n if (props.menusVisibility === 'toggle') revealed.value = false\n}\n\n// Alt pressed and released alone shows the menus and focuses the first one, as on Windows and Linux\nlet altAlone = false\nfunction onKeydown(e: KeyboardEvent) {\n altAlone = e.key === 'Alt' && !e.repeat && !e.ctrlKey && !e.shiftKey && !e.metaKey\n}\nfunction onKeyup(e: KeyboardEvent) {\n if (e.key !== 'Alt' || !altAlone || props.menusVisibility !== 'toggle' || !props.menus?.length) return\n altAlone = false\n e.preventDefault()\n revealed.value = !revealed.value\n if (revealed.value) void nextTick(() => bar.value?.querySelector<HTMLElement>('.m3-menu-bar [role=\"menuitem\"]')?.focus())\n}\n// Hidden again once nothing in it is open or focused (a click elsewhere, Esc on a title, Tab away)\nfunction hideLater() {\n if (!revealed.value) return\n setTimeout(() => {\n const menubar = bar.value?.querySelector('.m3-menu-bar')\n if (!menubar) return\n if (menubar.querySelector('[aria-expanded=\"true\"]') || menubar.contains(document.activeElement)) return\n revealed.value = false\n }, 0)\n}\nfunction onBarKeydown(e: KeyboardEvent) {\n if (e.key !== 'Escape' || !revealed.value) return\n const t = e.target as Element\n if (t.closest('.m3-menu-bar') && t.getAttribute('aria-expanded') !== 'true') revealed.value = false\n}\nwatch(() => props.menusVisibility, () => { revealed.value = false })\nonMounted(() => {\n window.addEventListener('keydown', onKeydown, true)\n window.addEventListener('keyup', onKeyup, true)\n document.addEventListener('pointerdown', hideLater, true)\n document.addEventListener('focusin', hideLater)\n})\nonBeforeUnmount(() => {\n window.removeEventListener('keydown', onKeydown, true)\n window.removeEventListener('keyup', onKeyup, true)\n document.removeEventListener('pointerdown', hideLater, true)\n document.removeEventListener('focusin', hideLater)\n})\n\n// An image when it looks like one (a path, a URL, a file name), a Material Symbol otherwise\nconst iconIsImage = computed(() => !!props.icon && /[/.:]/.test(props.icon))\nconst win = useElectronWindow()\nconst { controls, maximized, focused, fullscreen, isMac, titleBarHeight } = win\n\nconst ROLE = /^[a-z]+(-[a-z]+)*$/\nconst background = computed(() => (ROLE.test(props.color) ? `var(--color-${props.color})` : props.color))\nconst custom = computed(() => win.isElectron && controls.value === 'custom')\nconst native = computed(() => win.isElectron && controls.value === 'native')\nconst atStart = computed(() => (props.side === 'auto' ? isMac.value : props.side === 'start'))\nconst lights = computed(() => (props.look === 'auto' ? isMac.value : props.look === 'traffic-lights'))\nconst order = computed<Button[]>(() => {\n const set = props.buttons.filter((b, i, a) => a.indexOf(b) === i)\n // Traffic lights always read close, minimize, maximize; M3 buttons put close at the outer edge\n if (lights.value) return (['close', 'minimize', 'maximize'] as Button[]).filter((b) => set.includes(b))\n return atStart.value ? [...set].reverse() : set\n})\nconst maximizeLabel = computed(() => (maximized.value || fullscreen.value ? locale.windowRestore : locale.windowMaximize))\nconst labels = computed<Record<Button, string>>(() => ({ minimize: locale.windowMinimize, maximize: maximizeLabel.value, close: locale.close }))\nconst run = (b: Button) => (b === 'minimize' ? win.minimize() : b === 'maximize' ? win.toggleMaximize() : win.close())\n\n// Double-click on the bar itself (not on its content) maximizes, as on every desktop. Native title bars do it on\n// their own over the drag region; frameless ones on Linux don't\nfunction onDblclick(e: MouseEvent) {\n if (!custom.value) return\n if ((e.target as Element).closest('button, a, input, select, textarea, [role=\"button\"], [data-no-drag]')) return\n win.toggleMaximize()\n}\n\n// ── Native buttons follow the theme ────────────────────────────────────────────────────────────────────────────\n// They aren't CSS, so on every theme or palette change (and while its transition runs, ~300ms) the bar's computed\n// colors are sent each frame; main skips the ones that didn't change. macOS's traffic lights have fixed colors.\nconst bar = ref<HTMLElement>()\nconst probe = ref<HTMLElement>()\nlet raf = 0\nlet until = 0\nlet observer: MutationObserver | null = null\nlet media: MediaQueryList | null = null\n\nfunction toHex(css: string, under?: [number, number, number]): string | null {\n const m = /rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)(?:[\\s,/]+([\\d.]+%?))?/.exec(css)\n if (!m) return null\n let a = m[4] == null ? 1 : m[4].endsWith('%') ? parseFloat(m[4]) / 100 : parseFloat(m[4])\n const c = [+m[1]!, +m[2]!, +m[3]!]\n // A see-through bar: blend it over what's under it (the page), since the overlay can't be translucent\n if (a < 1 && under) c.forEach((v, i) => (c[i] = v * a + under[i]! * (1 - a)))\n else a = 1\n return `#${c.map((v) => Math.round(Math.min(255, Math.max(0, v))).toString(16).padStart(2, '0')).join('')}`\n}\n\nfunction pageColor(): [number, number, number] {\n const hex = toHex(getComputedStyle(document.body).backgroundColor) ?? toHex(getComputedStyle(document.documentElement).backgroundColor) ?? '#ffffff'\n return [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) as [number, number, number]\n}\n\nfunction sendOverlay() {\n if (!bar.value || !probe.value) return\n const color = toHex(getComputedStyle(bar.value).backgroundColor, pageColor())\n const symbolColor = toHex(getComputedStyle(probe.value).color)\n if (color && symbolColor) win.setOverlay({ color, symbolColor })\n}\n\nfunction follow(ms = 600) {\n if (!native.value || isMac.value) return\n until = performance.now() + ms\n if (raf) return\n const step = () => {\n sendOverlay()\n raf = performance.now() < until ? requestAnimationFrame(step) : 0\n }\n step()\n}\nconst onScheme = () => follow()\n\nfunction startSync() {\n if (observer || !native.value || isMac.value) return\n follow()\n observer = new MutationObserver(() => follow())\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-palette', 'data-theme'] })\n media = window.matchMedia?.('(prefers-color-scheme: dark)') ?? null\n media?.addEventListener?.('change', onScheme)\n}\n\nfunction stopSync() {\n observer?.disconnect()\n observer = null\n media?.removeEventListener?.('change', onScheme)\n media = null\n cancelAnimationFrame(raf)\n raf = 0\n}\n\nonMounted(() => { if (win.ready.value) startSync() })\nwatch([win.ready, native, isMac], () => { stopSync(); if (win.ready.value) startSync() })\nwatch(() => props.color, () => follow())\n\nconst { theme } = useTheme()\nwatch([theme, () => props.syncNativeTheme, win.ready], () => {\n if (props.syncNativeTheme && win.ready.value) win.setTheme(theme.value)\n}, { immediate: true })\nonBeforeUnmount(stopSync)\n</script>\n\n<template>\n <header\n ref=\"bar\"\n class=\"m3-title-bar\"\n :class=\"{ 'm3-title-bar-native': native, 'm3-title-bar-blurred': !focused, 'm3-title-bar-center': titleAlign === 'center' }\"\n :style=\"{ background }\"\n :data-controls=\"win.isElectron ? controls : undefined\"\n >\n <span ref=\"probe\" class=\"m3-title-bar-probe\" aria-hidden=\"true\" />\n <div class=\"m3-title-bar-row\" :style=\"{ height: `${titleBarHeight}px` }\" @dblclick=\"onDblclick\">\n <div class=\"m3-title-bar-area\">\n <div v-if=\"icon || $slots.icon\" class=\"m3-title-bar-icon\">\n <slot name=\"icon\">\n <img v-if=\"iconIsImage\" :src=\"icon\" alt=\"\" draggable=\"false\" />\n <MIcon v-else :name=\"icon!\" :size=\"20\" />\n </slot>\n </div>\n <MMenuBar v-if=\"shownMenus.length && !menusBelow\" :menus=\"shownMenus\" :height=\"Math.min(32, titleBarHeight - 8)\" class=\"m3-title-bar-menus\" @select=\"onMenuSelect\" @keydown=\"onBarKeydown\" />\n <div class=\"m3-title-bar-start\"><slot name=\"start\" /></div>\n <div class=\"m3-title-bar-title\"><span class=\"m3-title-bar-text\"><slot>{{ title }}</slot></span></div>\n <div class=\"m3-title-bar-end\"><slot name=\"end\" /></div>\n\n <!-- One set of controls (yours or ours); on the start side it moves first with `order` -->\n <div v-if=\"custom\" class=\"m3-title-bar-side\" :class=\"atStart && 'm3-title-bar-controls-start'\">\n <slot name=\"controls\" v-bind=\"{ minimize: win.minimize, toggleMaximize: win.toggleMaximize, close: win.close, maximized, focused }\">\n <div class=\"m3-title-bar-controls\" :class=\"lights && 'm3-title-bar-lights'\">\n <button\n v-for=\"b in order\"\n :key=\"b\"\n type=\"button\"\n :class=\"['m3-title-bar-btn', `m3-title-bar-btn-${b}`]\"\n :aria-label=\"labels[b]\"\n :title=\"labels[b]\"\n @click=\"run(b)\"\n >\n <MIcon v-if=\"!lights\" :name=\"b === 'minimize' ? 'minimize' : b === 'close' ? 'close' : maximized || fullscreen ? 'close_fullscreen' : 'open_in_full'\" :size=\"b === 'maximize' ? 16 : 18\" />\n <svg v-else viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path v-if=\"b === 'close'\" d=\"M3.5 3.5l5 5M8.5 3.5l-5 5\" />\n <path v-else-if=\"b === 'minimize'\" d=\"M3 6h6\" />\n <path v-else d=\"M6 3v6M3 6h6\" />\n </svg>\n </button>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <!-- The classic menu row: not a drag area, like every app's -->\n <div v-if=\"shownMenus.length && menusBelow\" class=\"m3-title-bar-menu-row\">\n <MMenuBar :menus=\"shownMenus\" :height=\"32\" @select=\"onMenuSelect\" @keydown=\"onBarKeydown\" />\n </div>\n </header>\n</template>\n\n<style>\n/* Plain CSS on the M3 tokens: the lib's Tailwind build doesn't scan this package, so no utility classes here */\n@layer base {\n .m3-title-bar {\n position: relative;\n display: block;\n flex-shrink: 0;\n width: 100%;\n color: var(--color-on-surface);\n user-select: none;\n -webkit-user-select: none;\n app-region: drag;\n -webkit-app-region: drag;\n }\n}\n.m3-title-bar :is(button, a, input, select, textarea, [role='button'], [contenteditable], [data-no-drag]) {\n app-region: no-drag;\n -webkit-app-region: no-drag;\n}\n.m3-title-bar-row {\n position: relative;\n}\n.m3-title-bar-menu-row {\n display: flex;\n align-items: center;\n padding: 0 8px 4px;\n app-region: no-drag;\n -webkit-app-region: no-drag;\n}\n.m3-title-bar-area {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 100%;\n padding-inline: 8px;\n box-sizing: border-box;\n}\n/* The system's buttons sit over the bar: keep to the area Window Controls Overlay leaves free */\n.m3-title-bar-native .m3-title-bar-area {\n /* not positioned, so a centered title centers on the whole row, not on this area */\n margin-left: env(titlebar-area-x, 0px);\n width: env(titlebar-area-width, 100%);\n}\n.m3-title-bar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 28px;\n color: var(--color-primary);\n}\n.m3-title-bar-icon img {\n width: 20px;\n height: 20px;\n object-fit: contain;\n pointer-events: none;\n}\n.m3-title-bar-menus {\n flex-shrink: 0;\n}\n.m3-title-bar-start,\n.m3-title-bar-end {\n display: flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n}\n.m3-title-bar-start:empty,\n.m3-title-bar-end:empty {\n display: none;\n}\n.m3-title-bar-title {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n padding-inline: 4px;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-size: var(--text-title-small, 0.875rem);\n line-height: var(--text-title-small--line-height, 1.25rem);\n font-weight: 500;\n letter-spacing: 0.006em;\n transition: color 150ms;\n}\n/* Centered on the whole bar, not on the room the menus and controls leave; the empty title box still takes that\n room so the end content stays at the end */\n.m3-title-bar-center .m3-title-bar-text {\n position: absolute;\n inset-inline-start: 50%;\n top: 50%;\n max-width: 40%;\n overflow: hidden;\n text-overflow: ellipsis;\n transform: translate(calc(-50% * var(--m3-dir, 1)), -50%);\n pointer-events: none;\n}\n.m3-title-bar-blurred .m3-title-bar-title {\n color: var(--color-on-surface-variant);\n}\n/* What the native buttons' symbols are colored from */\n.m3-title-bar-probe {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n color: var(--color-on-surface-variant);\n}\n\n.m3-title-bar-side {\n display: flex;\n flex-shrink: 0;\n}\n.m3-title-bar-controls-start {\n order: -1;\n}\n.m3-title-bar-controls {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n.m3-title-bar-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n border: 0;\n border-radius: 9999px;\n background: transparent;\n color: var(--color-on-surface-variant);\n cursor: default;\n outline: none;\n transition: background-color 150ms, color 150ms;\n}\n.m3-title-bar-btn:hover {\n background-color: color-mix(in srgb, var(--color-on-surface-variant) 8%, transparent);\n}\n.m3-title-bar-btn:active {\n background-color: color-mix(in srgb, var(--color-on-surface-variant) 10%, transparent);\n}\n.m3-title-bar-btn:focus-visible {\n box-shadow: 0 0 0 2px var(--color-secondary);\n}\n.m3-title-bar-btn-close:hover {\n color: var(--color-error);\n background-color: color-mix(in srgb, var(--color-error) 8%, transparent);\n}\n.m3-title-bar-btn-close:active {\n background-color: color-mix(in srgb, var(--color-error) 10%, transparent);\n}\n\n/* Traffic lights: 12px dots 8px apart, glyphs on hover of the group, gray when the window is in the background */\n.m3-title-bar-lights {\n gap: 8px;\n padding-inline: 6px;\n}\n.m3-title-bar-lights .m3-title-bar-btn {\n width: 12px;\n height: 12px;\n color: rgb(0 0 0 / 0.55);\n box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.18);\n}\n.m3-title-bar-lights .m3-title-bar-btn svg {\n width: 8px;\n height: 8px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.4;\n stroke-linecap: round;\n opacity: 0;\n}\n.m3-title-bar-lights:hover .m3-title-bar-btn svg,\n.m3-title-bar-lights .m3-title-bar-btn:focus-visible svg {\n opacity: 1;\n}\n.m3-title-bar-lights .m3-title-bar-btn-close { background-color: #ff5f57; }\n.m3-title-bar-lights .m3-title-bar-btn-minimize { background-color: #febc2e; }\n.m3-title-bar-lights .m3-title-bar-btn-maximize { background-color: #28c840; }\n.m3-title-bar-lights .m3-title-bar-btn:hover,\n.m3-title-bar-lights .m3-title-bar-btn-close:hover { color: rgb(0 0 0 / 0.55); filter: brightness(0.94); }\n.m3-title-bar-blurred .m3-title-bar-lights:not(:hover) .m3-title-bar-btn {\n background-color: color-mix(in srgb, var(--color-on-surface) 20%, transparent);\n box-shadow: none;\n}\n</style>\n"],"mappings":"A,iKA2CA,SAASmC,GAA+B,CACtC,OAAO,OAAO,OAAW,IAAe,OAA2DnC,EAAAA,GAAc,IAAA,EACnH,CAGA,IAAMoC,GAAA,EAAQnC,EAAAA,IAAAA,CAAI,EAAK,EACjBoC,GAAA,EAAWpC,EAAAA,IAAAA,CAAgB,QAAQ,EACnCqC,GAAA,EAAWrC,EAAAA,IAAAA,CAAI,EAAE,EACjBsC,GAAA,EAAiBtC,EAAAA,IAAAA,CAAAA,EAA4B,EAC7CuC,GAAA,EAAYvC,EAAAA,IAAAA,CAAI,EAAK,EACrBwC,GAAA,EAAaxC,EAAAA,IAAAA,CAAI,EAAK,EACtByC,GAAA,EAAUzC,EAAAA,IAAAA,CAAI,EA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","onScopeDispose","readonly","computed","$slots","useLocale","ref","computed","nextTick","watch","onMounted","onBeforeUnmount","useTheme","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createElementVNode","_renderSlot","_createBlock","MIcon","MMenuBar","_createTextVNode","_toDisplayString","_normalizeProps","_guardReactiveProps","_Fragment","_renderList","_createVNode","vue","_m3ui_vue_m3ui_vue","require_splash_html","require_shared","bridge","ready","controls","platform","titleBarHeight","maximized","fullscreen","focused","accentColor","users","unsubscribe","unsubscribeAccent","started","stopColors","readSplashColors","cs","colors","key","token","v","sendSplashColors","b","read","watchColors","timer","later","observer","media","apply","s","start","c","info","stop","useElectronWindow","theme","value","count","menus","listener","status","acceleratorOf","shortcut","tokens","t","names","serializeMenus","picks","next","items","list","menu","i","label","id","check","m","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","MTitleBar_default","__props","__emit","props","emit","locale","revealed","shownMenus","osMenus","menusBelow","contains","item","onMenuSelect","altAlone","onKeydown","onKeyup","e","bar","hideLater","menubar","onBarKeydown","iconIsImage","win","isMac","ROLE","background","custom","native","menuSet","offClick","pick","data","p","atStart","lights","order","set","a","maximizeLabel","labels","run","onDblclick","probe","raf","until","toHex","css","under","pageColor","hex","sendOverlay","color","symbolColor","follow","ms","step","onScheme","startSync","stopSync","_ctx","_cache","$event"],"sources":["../src/renderer/useElectronWindow.ts","../src/renderer/_nativeMenu.ts","../src/renderer/MTitleBar.vue"],"sourcesContent":["import { computed, onScopeDispose, readonly, ref, getCurrentScope, type ComputedRef, type Ref } from 'vue'\nimport { SPLASH_TOKENS } from '../splashHtml'\nimport { BRIDGE_KEY, DEFAULT_TITLE_BAR_HEIGHT, type M3Bridge, type M3SplashUpdate, type M3NativeMenu, type M3Controls, type M3NativeTheme, type M3OverlayColors, type M3WindowState } from '../shared'\n\n/**\n * The window MTitleBar sits in, from the renderer: its mode and state (reactive) and its buttons. Outside Electron (or\n * without the preload's bridge) `isElectron` is false, nothing is ever `ready` and the actions do nothing, so the same\n * app also runs in a browser.\n */\nexport interface ElectronWindow {\n /** The preload's bridge is there */\n isElectron: boolean\n /** The main process has answered (mode, platform and state are real from here on) */\n ready: Readonly<Ref<boolean>>\n controls: Readonly<Ref<M3Controls>>\n /** `process.platform` of the main process (`''` until ready) */\n platform: Readonly<Ref<string>>\n isMac: ComputedRef<boolean>\n titleBarHeight: Readonly<Ref<number>>\n maximized: Readonly<Ref<boolean>>\n fullscreen: Readonly<Ref<boolean>>\n focused: Readonly<Ref<boolean>>\n /**\n * The system accent color (`#rrggbb`, Windows and macOS; null elsewhere), live. Seed the palette with it:\n * `watchEffect(() => accentColor.value && setSeed(accentColor.value))` with `useColorPalette()`\n */\n accentColor: Readonly<Ref<string | null>>\n minimize(): void\n toggleMaximize(): void\n close(): void\n /** Recolors the native buttons (MTitleBar does it from the theme; for a bar of your own) */\n setOverlay(colors: M3OverlayColors): void\n /** Native UI theme (MTitleBar keeps it in step with `useTheme()`; for an app without the bar) */\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 requestAttention(): void\n /** The preload can set macOS's menu bar (one built before 0.3.0 can't) */\n canSetNativeMenu: boolean\n /** macOS's menu bar from MTitleBar's `menus` (it does this itself in native mode); `null` puts the app's back */\n setNativeMenu(menus: M3NativeMenu[] | null): void\n /** Calls `listener` with the id of a native menu item when chosen; returns the unsubscribe */\n onNativeMenuClick(listener: (id: number) => void): () => void\n /** Updates the bootsplash (`createSplash()` in the main process): its bar (0–1, null for indeterminate) and status */\n splashProgress(value: number | null, status?: string): void\n /** Tells the bootsplash this window is ready to show (with `splash.handoff(win, { waitForRenderer: true })`) */\n splashDone(): void\n /**\n * Keeps the page's theme colors (light or dark, and the palette) for the next launch's bootsplash. Done on its own\n * whenever the theme or the palette changes; call it after changing the tokens some other way\n */\n rememberSplashColors(): void\n}\n\n// The methods added after 0.1.0 are called with ?.(): a preload bundled from an older version (an app that updated\n// the package but not its preload build) must not break the renderer, it just doesn't get those features\nfunction bridge(): M3Bridge | undefined {\n return typeof window !== 'undefined' ? (window as unknown as Record<string, M3Bridge | undefined>)[BRIDGE_KEY] : undefined\n}\n\n// One window per renderer: the state is shared by every caller, fetched once, and kept while anyone uses it\nconst ready = ref(false)\nconst controls = ref<M3Controls>('native')\nconst platform = ref('')\nconst titleBarHeight = ref(DEFAULT_TITLE_BAR_HEIGHT)\nconst maximized = ref(false)\nconst fullscreen = ref(false)\nconst focused = ref(true)\nconst accentColor = ref<string | null>(null)\nlet users = 0\nlet unsubscribe: (() => void) | null = null\nlet unsubscribeAccent: (() => void) | null = null\nlet started: Promise<void> | null = null\nlet stopColors: (() => void) | null = null\n\n/** The splash colors from the page's tokens, and whether it's dark */\nfunction readSplashColors(): { scheme: 'light' | 'dark'; colors: Record<string, string> } | null {\n if (typeof document === 'undefined') return null\n const cs = getComputedStyle(document.documentElement)\n const colors: Record<string, string> = {}\n for (const [key, token] of Object.entries(SPLASH_TOKENS)) {\n const v = cs.getPropertyValue(token).trim()\n if (v) colors[key] = v\n }\n return Object.keys(colors).length ? { scheme: document.documentElement.classList.contains('dark') ? 'dark' : 'light', colors } : null\n}\n\nfunction sendSplashColors(b: M3Bridge) {\n const read = readSplashColors()\n if (read) b.splashColors?.(read.scheme, read.colors)\n}\n\n// Follows theme and palette changes (the class and data-palette on <html>, the system scheme), once they've settled:\n// the tokens animate for a moment when they change\nfunction watchColors(b: M3Bridge) {\n if (stopColors || !b.splashColors || typeof MutationObserver === 'undefined') return\n let timer: ReturnType<typeof setTimeout> | undefined\n const later = () => { clearTimeout(timer); timer = setTimeout(() => sendSplashColors(b), 800) }\n const observer = new MutationObserver(later)\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-palette', 'data-theme', 'data-contrast'] })\n const media = window.matchMedia?.('(prefers-color-scheme: dark)')\n media?.addEventListener?.('change', later)\n later()\n stopColors = () => {\n clearTimeout(timer)\n observer.disconnect()\n media?.removeEventListener?.('change', later)\n }\n}\n\nfunction apply(s: M3WindowState) {\n maximized.value = s.maximized\n fullscreen.value = s.fullscreen\n focused.value = s.focused\n}\n\nfunction start(b: M3Bridge) {\n if (!unsubscribe) unsubscribe = b.onState(apply)\n if (!unsubscribeAccent) unsubscribeAccent = b.onAccent?.((c) => { accentColor.value = c }) ?? null\n watchColors(b)\n started ??= b.info().then((info) => {\n if (!info) return\n controls.value = info.controls\n platform.value = info.platform\n titleBarHeight.value = info.titleBarHeight\n accentColor.value = info.accentColor ?? null\n apply(info.state)\n ready.value = true\n }).catch(() => { started = null })\n}\n\nfunction stop() {\n unsubscribe?.()\n unsubscribe = null\n unsubscribeAccent?.()\n unsubscribeAccent = null\n stopColors?.()\n stopColors = null\n}\n\nexport function useElectronWindow(): ElectronWindow {\n const b = bridge()\n if (b) {\n users++\n start(b)\n if (getCurrentScope()) onScopeDispose(() => { if (--users === 0) stop() })\n }\n return {\n isElectron: !!b,\n ready: readonly(ready),\n controls: readonly(controls),\n platform: readonly(platform),\n isMac: computed(() => platform.value === 'darwin'),\n titleBarHeight: readonly(titleBarHeight),\n maximized: readonly(maximized),\n fullscreen: readonly(fullscreen),\n focused: readonly(focused),\n accentColor: readonly(accentColor),\n minimize: () => b?.action('minimize'),\n toggleMaximize: () => b?.action('toggle-maximize'),\n close: () => b?.action('close'),\n setOverlay: (colors) => b?.setOverlay(colors),\n setTheme: (theme) => b?.setTheme?.(theme),\n setProgress: (value) => b?.setProgress?.(value),\n setBadge: (count) => b?.setBadge?.(count),\n requestAttention: () => b?.attention?.(),\n canSetNativeMenu: typeof b?.setMenu === 'function',\n setNativeMenu: (menus) => b?.setMenu?.(menus),\n onNativeMenuClick: (listener) => b?.onMenuClick?.(listener) ?? (() => {}),\n splashProgress: (value, status) => b?.splash?.(status === undefined ? { progress: value } : { progress: value, status } satisfies M3SplashUpdate),\n splashDone: () => b?.splashDone?.(),\n rememberSplashColors: () => { if (b) sendSplashColors(b) },\n }\n}\n\n/** For tests: forget the fetched state */\nexport function _resetElectronWindow() {\n stop()\n users = 0\n started = null\n ready.value = false\n controls.value = 'native'\n platform.value = ''\n titleBarHeight.value = DEFAULT_TITLE_BAR_HEIGHT\n maximized.value = false\n fullscreen.value = false\n focused.value = true\n accentColor.value = null\n}\n","import type { MenuBarItem, MenuBarMenu } from '@m3ui-vue/m3ui-vue'\nimport type { M3NativeMenu, M3NativeMenuItem } from '../shared'\n\n/**\n * MMenuBar's shortcut hint (`'Ctrl+S'`, `'⌘S'`) as an Electron accelerator: Ctrl and ⌘ become `CmdOrCtrl`. A native\n * menu binds it: the key runs the item's `onSelect`.\n */\nexport function acceleratorOf(shortcut?: string): string | undefined {\n if (!shortcut) return undefined\n const tokens = shortcut.replace(/([⌘⇧⌥⌃])/g, '$1+').split('+').map((t) => t.trim()).filter(Boolean)\n const names: Record<string, string> = { '⌘': 'CmdOrCtrl', '⌃': 'CmdOrCtrl', '⇧': 'Shift', '⌥': 'Alt' }\n return tokens.map((t) => names[t] ?? (/^(ctrl|control|cmd|command)$/i.test(t) ? 'CmdOrCtrl' : /^option$/i.test(t) ? 'Alt' : t)).join('+')\n}\n\n/**\n * The menus as plain data for the main process, and what each id stands for (the item and its menu's index), to run\n * it when main says it was clicked\n */\nexport function serializeMenus(menus: MenuBarMenu[]): { data: M3NativeMenu[]; picks: Map<number, [MenuBarItem, number]> } {\n const picks = new Map<number, [MenuBarItem, number]>()\n let next = 1\n const items = (list: MenuBarItem[], menu: number): M3NativeMenuItem[] => list.map((i): M3NativeMenuItem => {\n if (i.divider) return { type: 'separator' }\n const label = i.label ?? ''\n if (i.children) return { type: 'submenu', label, enabled: !i.disabled, items: items(i.children, menu) }\n const id = next++\n picks.set(id, [i, menu])\n // A check mark for both: a radio item would make macOS uncheck its neighbors on its own\n const check = i.checked !== undefined || i.selected !== undefined\n return { type: check ? 'checkbox' : 'normal', id, label, enabled: !i.disabled, ...(check ? { checked: !!(i.checked ?? i.selected) } : {}), accelerator: acceleratorOf(i.shortcut) }\n })\n return { data: menus.map((m, i) => ({ label: m.label, enabled: !m.disabled, items: items(m.items, i) })), picks }\n}\n","<script setup lang=\"ts\">\n/**\n * MTitleBar — the window's title bar for an Electron app, in M3: drags the window, double-click maximizes, and holds\n * the title plus anything you put at its start or end. The controls mode comes from the main process\n * (`m3WindowOptions({ controls })`), not a prop, so the two can't disagree:\n * - `native`: the system draws the buttons over the bar (Windows 11 snap layouts, macOS traffic lights) and the bar\n * leaves their room free; their colors follow the bar's background and the theme live, palette changes included.\n * - `custom`: a frameless window; the bar draws M3 buttons (or traffic lights), on the side and with the buttons\n * you choose, or your own through `#controls`.\n * Outside Electron it renders as a plain bar without buttons, so the same app runs in a browser.\n *\n * @slot default The title (replaces `title`)\n * @slot start Content after the icon and the menus (a back button, a breadcrumb…)\n * @slot end Content before the trailing controls (a search field, account button…)\n * @slot controls Replaces the custom controls (`{ minimize, toggleMaximize, close, maximized, focused }`)\n * @slot icon Replaces the app icon\n * @event menu-select Emitted with the menu item chosen (and its menu's index), as MMenuBar's `select`\n */\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { MIcon, MMenuBar, useLocale, useTheme, type MenuBarItem, type MenuBarMenu } from '@m3ui-vue/m3ui-vue'\nimport { useElectronWindow } from './useElectronWindow'\nimport { serializeMenus } from './_nativeMenu'\n\ntype Button = 'minimize' | 'maximize' | 'close'\n\nconst props = withDefaults(\n defineProps<{\n /** The window title */\n title?: string\n /**\n * The app icon at the start: an image URL (`'/icon.png'`, an import, a data: URL) or a Material Symbol name.\n * Clicking it does nothing (the `#icon` slot takes a button of yours)\n */\n icon?: string\n /** Menus (File, Edit…) after the icon, as an MMenuBar: items with submenus, dividers, checks, shortcut hints */\n menus?: MenuBarMenu[]\n /** `inline`: the menus sit in the title bar, after the icon. `below`: in a row of their own under it (classic) */\n menusPosition?: 'inline' | 'below'\n /**\n * Like VS Code's \"menu bar visibility\": `visible`; `compact`, one ☰ button in the bar holding every menu;\n * `toggle`, hidden until Alt is pressed (and hidden again after a pick, Esc or a click elsewhere); `hidden`\n */\n menusVisibility?: 'visible' | 'compact' | 'toggle' | 'hidden'\n /** Bar color: an M3 role (`'surface-container'`) or any CSS color */\n color?: string\n /** Where the title sits */\n titleAlign?: 'start' | 'center'\n /** Custom controls only: which buttons, in this order on the end side (mirrored on the start side) */\n buttons?: Button[]\n /** Custom controls only: the side they sit on; `auto` is the start on macOS, the end elsewhere */\n side?: 'auto' | 'start' | 'end'\n /** Custom controls only: M3 icon buttons or macOS-style traffic lights; `auto` picks by platform */\n look?: 'auto' | 'm3' | 'traffic-lights'\n /**\n * Keep the native UI's theme (dialogs, context menus, scrollbars, macOS's frame) on the app's `useTheme()`\n * choice: light, dark or system\n */\n syncNativeTheme?: boolean\n }>(),\n { color: 'surface', titleAlign: 'start', buttons: () => ['minimize', 'maximize', 'close'], side: 'auto', look: 'auto', syncNativeTheme: true, menusPosition: 'inline', menusVisibility: 'visible' },\n)\n\nconst emit = defineEmits<{ 'menu-select': [item: MenuBarItem, menu: number] }>()\n\nconst locale = useLocale()\n// ── Menus ─────────────────────────────────────────────────────────────────────────────────────────────────────\nconst revealed = ref(false) // toggle mode: shown by Alt\nconst shownMenus = computed<MenuBarMenu[]>(() => {\n const menus = props.menus ?? []\n if (osMenus.value) return [] // macOS's menu bar has them\n if (!menus.length || props.menusVisibility === 'hidden') return []\n if (props.menusVisibility === 'toggle' && !revealed.value) return []\n if (props.menusVisibility === 'compact') {\n return [{ label: locale.appMenuLabel, icon: 'menu', items: menus.map((m) => ({ label: m.label, disabled: m.disabled, children: m.items })) }]\n }\n return menus\n})\n// The ☰ button always sits in the bar; a row below for it alone would waste a row\nconst menusBelow = computed(() => props.menusPosition === 'below' && props.menusVisibility !== 'compact')\n\nconst contains = (items: MenuBarItem[], item: MenuBarItem): boolean => items.some((i) => i === item || (!!i.children && contains(i.children, item)))\nfunction onMenuSelect(item: MenuBarItem) {\n // The index in `menus`, also from the compact button (where MMenuBar only sees one menu)\n emit('menu-select', item, Math.max(0, (props.menus ?? []).findIndex((m) => contains(m.items, item))))\n if (props.menusVisibility === 'toggle') revealed.value = false\n}\n\n// Alt pressed and released alone shows the menus and focuses the first one, as on Windows and Linux\nlet altAlone = false\nfunction onKeydown(e: KeyboardEvent) {\n altAlone = e.key === 'Alt' && !e.repeat && !e.ctrlKey && !e.shiftKey && !e.metaKey\n}\nfunction onKeyup(e: KeyboardEvent) {\n if (e.key !== 'Alt' || !altAlone || props.menusVisibility !== 'toggle' || !props.menus?.length) return\n altAlone = false\n e.preventDefault()\n revealed.value = !revealed.value\n if (revealed.value) void nextTick(() => bar.value?.querySelector<HTMLElement>('.m3-menu-bar [role=\"menuitem\"]')?.focus())\n}\n// Hidden again once nothing in it is open or focused (a click elsewhere, Esc on a title, Tab away)\nfunction hideLater() {\n if (!revealed.value) return\n setTimeout(() => {\n const menubar = bar.value?.querySelector('.m3-menu-bar')\n if (!menubar) return\n if (menubar.querySelector('[aria-expanded=\"true\"]') || menubar.contains(document.activeElement)) return\n revealed.value = false\n }, 0)\n}\nfunction onBarKeydown(e: KeyboardEvent) {\n if (e.key !== 'Escape' || !revealed.value) return\n const t = e.target as Element\n if (t.closest('.m3-menu-bar') && t.getAttribute('aria-expanded') !== 'true') revealed.value = false\n}\nwatch(() => props.menusVisibility, () => { revealed.value = false })\nonMounted(() => {\n window.addEventListener('keydown', onKeydown, true)\n window.addEventListener('keyup', onKeyup, true)\n document.addEventListener('pointerdown', hideLater, true)\n document.addEventListener('focusin', hideLater)\n})\nonBeforeUnmount(() => {\n window.removeEventListener('keydown', onKeydown, true)\n window.removeEventListener('keyup', onKeyup, true)\n document.removeEventListener('pointerdown', hideLater, true)\n document.removeEventListener('focusin', hideLater)\n})\n\n// An image when it looks like one (a path, a URL, a file name), a Material Symbol otherwise\nconst iconIsImage = computed(() => !!props.icon && /[/.:]/.test(props.icon))\nconst win = useElectronWindow()\nconst { controls, maximized, focused, fullscreen, isMac, titleBarHeight } = win\n\nconst ROLE = /^[a-z]+(-[a-z]+)*$/\nconst background = computed(() => (ROLE.test(props.color) ? `var(--color-${props.color})` : props.color))\nconst custom = computed(() => win.isElectron && controls.value === 'custom')\nconst native = computed(() => win.isElectron && controls.value === 'native')\n\n// ── Native menus (macOS) ─────────────────────────────────────────────────────────────────────────────────────\n// With native controls on macOS the menus go to the menu bar at the top of the screen, like every Mac app's.\n// Elsewhere the native mode has no system title bar to hold a menu, so they stay in this bar as an MMenuBar.\nconst osMenus = computed(() => native.value && isMac.value && win.canSetNativeMenu && !!props.menus?.length)\nlet picks = new Map<number, [MenuBarItem, number]>()\nlet menuSet = false\nconst offClick = win.onNativeMenuClick((id) => {\n const pick = picks.get(id)\n if (!pick) return\n pick[0].onSelect?.()\n emit('menu-select', pick[0], pick[1])\n})\nwatch([osMenus, () => props.menus], () => {\n if (osMenus.value) {\n const { data, picks: p } = serializeMenus(props.menus!)\n picks = p\n win.setNativeMenu(data)\n menuSet = true\n } else if (menuSet) {\n win.setNativeMenu(null)\n menuSet = false\n }\n}, { immediate: true })\nonBeforeUnmount(() => {\n offClick()\n if (menuSet) win.setNativeMenu(null)\n})\nconst atStart = computed(() => (props.side === 'auto' ? isMac.value : props.side === 'start'))\nconst lights = computed(() => (props.look === 'auto' ? isMac.value : props.look === 'traffic-lights'))\nconst order = computed<Button[]>(() => {\n const set = props.buttons.filter((b, i, a) => a.indexOf(b) === i)\n // Traffic lights always read close, minimize, maximize; M3 buttons put close at the outer edge\n if (lights.value) return (['close', 'minimize', 'maximize'] as Button[]).filter((b) => set.includes(b))\n return atStart.value ? [...set].reverse() : set\n})\nconst maximizeLabel = computed(() => (maximized.value || fullscreen.value ? locale.windowRestore : locale.windowMaximize))\nconst labels = computed<Record<Button, string>>(() => ({ minimize: locale.windowMinimize, maximize: maximizeLabel.value, close: locale.close }))\nconst run = (b: Button) => (b === 'minimize' ? win.minimize() : b === 'maximize' ? win.toggleMaximize() : win.close())\n\n// Double-click on the bar itself (not on its content) maximizes, as on every desktop. Native title bars do it on\n// their own over the drag region; frameless ones on Linux don't\nfunction onDblclick(e: MouseEvent) {\n if (!custom.value) return\n if ((e.target as Element).closest('button, a, input, select, textarea, [role=\"button\"], [data-no-drag]')) return\n win.toggleMaximize()\n}\n\n// ── Native buttons follow the theme ────────────────────────────────────────────────────────────────────────────\n// They aren't CSS, so on every theme or palette change (and while its transition runs, ~300ms) the bar's computed\n// colors are sent each frame; main skips the ones that didn't change. macOS's traffic lights have fixed colors.\nconst bar = ref<HTMLElement>()\nconst probe = ref<HTMLElement>()\nlet raf = 0\nlet until = 0\nlet observer: MutationObserver | null = null\nlet media: MediaQueryList | null = null\n\nfunction toHex(css: string, under?: [number, number, number]): string | null {\n const m = /rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)(?:[\\s,/]+([\\d.]+%?))?/.exec(css)\n if (!m) return null\n let a = m[4] == null ? 1 : m[4].endsWith('%') ? parseFloat(m[4]) / 100 : parseFloat(m[4])\n const c = [+m[1]!, +m[2]!, +m[3]!]\n // A see-through bar: blend it over what's under it (the page), since the overlay can't be translucent\n if (a < 1 && under) c.forEach((v, i) => (c[i] = v * a + under[i]! * (1 - a)))\n else a = 1\n return `#${c.map((v) => Math.round(Math.min(255, Math.max(0, v))).toString(16).padStart(2, '0')).join('')}`\n}\n\nfunction pageColor(): [number, number, number] {\n const hex = toHex(getComputedStyle(document.body).backgroundColor) ?? toHex(getComputedStyle(document.documentElement).backgroundColor) ?? '#ffffff'\n return [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) as [number, number, number]\n}\n\nfunction sendOverlay() {\n if (!bar.value || !probe.value) return\n const color = toHex(getComputedStyle(bar.value).backgroundColor, pageColor())\n const symbolColor = toHex(getComputedStyle(probe.value).color)\n if (color && symbolColor) win.setOverlay({ color, symbolColor })\n}\n\nfunction follow(ms = 600) {\n if (!native.value || isMac.value) return\n until = performance.now() + ms\n if (raf) return\n const step = () => {\n sendOverlay()\n raf = performance.now() < until ? requestAnimationFrame(step) : 0\n }\n step()\n}\nconst onScheme = () => follow()\n\nfunction startSync() {\n if (observer || !native.value || isMac.value) return\n follow()\n observer = new MutationObserver(() => follow())\n observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-palette', 'data-theme'] })\n media = window.matchMedia?.('(prefers-color-scheme: dark)') ?? null\n media?.addEventListener?.('change', onScheme)\n}\n\nfunction stopSync() {\n observer?.disconnect()\n observer = null\n media?.removeEventListener?.('change', onScheme)\n media = null\n cancelAnimationFrame(raf)\n raf = 0\n}\n\nonMounted(() => { if (win.ready.value) startSync() })\nwatch([win.ready, native, isMac], () => { stopSync(); if (win.ready.value) startSync() })\nwatch(() => props.color, () => follow())\n\nconst { theme } = useTheme()\nwatch([theme, () => props.syncNativeTheme, win.ready], () => {\n if (props.syncNativeTheme && win.ready.value) win.setTheme(theme.value)\n}, { immediate: true })\nonBeforeUnmount(stopSync)\n</script>\n\n<template>\n <header\n ref=\"bar\"\n class=\"m3-title-bar\"\n :class=\"{ 'm3-title-bar-native': native, 'm3-title-bar-blurred': !focused, 'm3-title-bar-center': titleAlign === 'center' }\"\n :style=\"{ background }\"\n :data-controls=\"win.isElectron ? controls : undefined\"\n >\n <span ref=\"probe\" class=\"m3-title-bar-probe\" aria-hidden=\"true\" />\n <div class=\"m3-title-bar-row\" :style=\"{ height: `${titleBarHeight}px` }\" @dblclick=\"onDblclick\">\n <div class=\"m3-title-bar-area\">\n <div v-if=\"icon || $slots.icon\" class=\"m3-title-bar-icon\">\n <slot name=\"icon\">\n <img v-if=\"iconIsImage\" :src=\"icon\" alt=\"\" draggable=\"false\" />\n <MIcon v-else :name=\"icon!\" :size=\"20\" />\n </slot>\n </div>\n <MMenuBar v-if=\"shownMenus.length && !menusBelow\" :menus=\"shownMenus\" :height=\"Math.min(32, titleBarHeight - 8)\" class=\"m3-title-bar-menus\" @select=\"onMenuSelect\" @keydown=\"onBarKeydown\" />\n <div class=\"m3-title-bar-start\"><slot name=\"start\" /></div>\n <div class=\"m3-title-bar-title\"><span class=\"m3-title-bar-text\"><slot>{{ title }}</slot></span></div>\n <div class=\"m3-title-bar-end\"><slot name=\"end\" /></div>\n\n <!-- One set of controls (yours or ours); on the start side it moves first with `order` -->\n <div v-if=\"custom\" class=\"m3-title-bar-side\" :class=\"atStart && 'm3-title-bar-controls-start'\">\n <slot name=\"controls\" v-bind=\"{ minimize: win.minimize, toggleMaximize: win.toggleMaximize, close: win.close, maximized, focused }\">\n <div class=\"m3-title-bar-controls\" :class=\"lights && 'm3-title-bar-lights'\">\n <button\n v-for=\"b in order\"\n :key=\"b\"\n type=\"button\"\n :class=\"['m3-title-bar-btn', `m3-title-bar-btn-${b}`]\"\n :aria-label=\"labels[b]\"\n :title=\"labels[b]\"\n @click=\"run(b)\"\n >\n <MIcon v-if=\"!lights\" :name=\"b === 'minimize' ? 'minimize' : b === 'close' ? 'close' : maximized || fullscreen ? 'close_fullscreen' : 'open_in_full'\" :size=\"b === 'maximize' ? 16 : 18\" />\n <svg v-else viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path v-if=\"b === 'close'\" d=\"M3.5 3.5l5 5M8.5 3.5l-5 5\" />\n <path v-else-if=\"b === 'minimize'\" d=\"M3 6h6\" />\n <path v-else d=\"M6 3v6M3 6h6\" />\n </svg>\n </button>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <!-- The classic menu row: not a drag area, like every app's -->\n <div v-if=\"shownMenus.length && menusBelow\" class=\"m3-title-bar-menu-row\">\n <MMenuBar :menus=\"shownMenus\" :height=\"32\" @select=\"onMenuSelect\" @keydown=\"onBarKeydown\" />\n </div>\n </header>\n</template>\n\n<style>\n/* Plain CSS on the M3 tokens: the lib's Tailwind build doesn't scan this package, so no utility classes here */\n@layer base {\n .m3-title-bar {\n position: relative;\n display: block;\n flex-shrink: 0;\n width: 100%;\n color: var(--color-on-surface);\n user-select: none;\n -webkit-user-select: none;\n app-region: drag;\n -webkit-app-region: drag;\n }\n}\n.m3-title-bar :is(button, a, input, select, textarea, [role='button'], [contenteditable], [data-no-drag]) {\n app-region: no-drag;\n -webkit-app-region: no-drag;\n}\n.m3-title-bar-row {\n position: relative;\n}\n.m3-title-bar-menu-row {\n display: flex;\n align-items: center;\n padding: 0 8px 4px;\n app-region: no-drag;\n -webkit-app-region: no-drag;\n}\n.m3-title-bar-area {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 100%;\n padding-inline: 8px;\n box-sizing: border-box;\n}\n/* The system's buttons sit over the bar: keep to the area Window Controls Overlay leaves free */\n.m3-title-bar-native .m3-title-bar-area {\n /* not positioned, so a centered title centers on the whole row, not on this area */\n margin-left: env(titlebar-area-x, 0px);\n width: env(titlebar-area-width, 100%);\n}\n.m3-title-bar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 28px;\n color: var(--color-primary);\n}\n.m3-title-bar-icon img {\n width: 20px;\n height: 20px;\n object-fit: contain;\n pointer-events: none;\n}\n.m3-title-bar-menus {\n flex-shrink: 0;\n}\n.m3-title-bar-start,\n.m3-title-bar-end {\n display: flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n}\n.m3-title-bar-start:empty,\n.m3-title-bar-end:empty {\n display: none;\n}\n.m3-title-bar-title {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n padding-inline: 4px;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-size: var(--text-title-small, 0.875rem);\n line-height: var(--text-title-small--line-height, 1.25rem);\n font-weight: 500;\n letter-spacing: 0.006em;\n transition: color 150ms;\n}\n/* Centered on the whole bar, not on the room the menus and controls leave; the empty title box still takes that\n room so the end content stays at the end */\n.m3-title-bar-center .m3-title-bar-text {\n position: absolute;\n inset-inline-start: 50%;\n top: 50%;\n max-width: 40%;\n overflow: hidden;\n text-overflow: ellipsis;\n transform: translate(calc(-50% * var(--m3-dir, 1)), -50%);\n pointer-events: none;\n}\n.m3-title-bar-blurred .m3-title-bar-title {\n color: var(--color-on-surface-variant);\n}\n/* What the native buttons' symbols are colored from */\n.m3-title-bar-probe {\n position: absolute;\n width: 0;\n height: 0;\n overflow: hidden;\n color: var(--color-on-surface-variant);\n}\n\n.m3-title-bar-side {\n display: flex;\n flex-shrink: 0;\n}\n.m3-title-bar-controls-start {\n order: -1;\n}\n.m3-title-bar-controls {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n.m3-title-bar-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n border: 0;\n border-radius: 9999px;\n background: transparent;\n color: var(--color-on-surface-variant);\n cursor: default;\n outline: none;\n transition: background-color 150ms, color 150ms;\n}\n.m3-title-bar-btn:hover {\n background-color: color-mix(in srgb, var(--color-on-surface-variant) 8%, transparent);\n}\n.m3-title-bar-btn:active {\n background-color: color-mix(in srgb, var(--color-on-surface-variant) 10%, transparent);\n}\n.m3-title-bar-btn:focus-visible {\n box-shadow: 0 0 0 2px var(--color-secondary);\n}\n.m3-title-bar-btn-close:hover {\n color: var(--color-error);\n background-color: color-mix(in srgb, var(--color-error) 8%, transparent);\n}\n.m3-title-bar-btn-close:active {\n background-color: color-mix(in srgb, var(--color-error) 10%, transparent);\n}\n\n/* Traffic lights: 12px dots 8px apart, glyphs on hover of the group, gray when the window is in the background */\n.m3-title-bar-lights {\n gap: 8px;\n padding-inline: 6px;\n}\n.m3-title-bar-lights .m3-title-bar-btn {\n width: 12px;\n height: 12px;\n color: rgb(0 0 0 / 0.55);\n box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.18);\n}\n.m3-title-bar-lights .m3-title-bar-btn svg {\n width: 8px;\n height: 8px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.4;\n stroke-linecap: round;\n opacity: 0;\n}\n.m3-title-bar-lights:hover .m3-title-bar-btn svg,\n.m3-title-bar-lights .m3-title-bar-btn:focus-visible svg {\n opacity: 1;\n}\n.m3-title-bar-lights .m3-title-bar-btn-close { background-color: #ff5f57; }\n.m3-title-bar-lights .m3-title-bar-btn-minimize { background-color: #febc2e; }\n.m3-title-bar-lights .m3-title-bar-btn-maximize { background-color: #28c840; }\n.m3-title-bar-lights .m3-title-bar-btn:hover,\n.m3-title-bar-lights .m3-title-bar-btn-close:hover { color: rgb(0 0 0 / 0.55); filter: brightness(0.94); }\n.m3-title-bar-blurred .m3-title-bar-lights:not(:hover) .m3-title-bar-btn {\n background-color: color-mix(in srgb, var(--color-on-surface) 20%, transparent);\n box-shadow: none;\n}\n</style>\n"],"mappings":"A,gMA2DA,SAASqC,GAA+B,CACtC,OAAO,OAAO,OAAW,IAAe,OAA2DrC,EAAAA,GAAc,IAAA,EACnH,CAGA,IAAMsC,GAAA,EAAQrC,EAAAA,IAAAA,CAAI,EAAK,EACjBsC,GAAA,EAAWtC,EAAAA,IAAAA,CAAgB,QAAQ,EACnCuC,GAAA,EAAWvC,EAAAA,IAAAA,CAAI,EAAE,EACjBwC,GAAA,EAAiBxC,EAAAA,IAAAA,CAAAA,EAA4B,EAC7CyC,GAAA,EAAYzC,EAAAA,IAAAA,CAAI,EAAK,EACrB0C,GAAA,EAAa1C,EAAAA,IAAAA,CAAI,EAAK,EACtB2C,GAAA,EAAU3C,EAAAA,IAAAA,CAAI,EAAI,EAClB4C,GAAA,EAAc5C,EAAAA,IAAAA,CAAmB,IAAI,EACvC6C,EAAQ,EACRC,EAAmC,KACnCC,EAAyC,KACzCC,EAAgC,KAChCC,EAAkC,KAGtC,SAASC,GAAwF,CAC/F,GAAI,OAAO,SAAa,IAAa,OAAO,KAC5C,IAAMC,EAAK,iBAAiB,SAAS,eAAe,EAC9CC,EAAiC,CAAC,EACxC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AAAA,UAAAA,CAAA,GAAA,EAAAC,EAAAA,mBAAAA,CAAgD,OAAhDwF,EAAgD,KAAA,EAChDzF,EAAAA,UAAAA,CAAA,GAAA,EAAAC,EAAAA,mBAAAA,CAAgC,OAAhCyF,EAAgC,E,MAJpB,EAAd1F,EAAAA,UAAAA,CAAA,GAAA,EAAAO,EAAAA,YAAAA,EAAAA,EAA2LJ,EAAAA,MAAAA,CAAAK,EAAAA,KAAA,EAAA,C,MAApK,KAAMkC,IAAC,WAAA,WAA+BA,IAAC,QAAA,SAAA,EAAyBvC,EAAAA,MAAAA,CAAAuB,CAAA,IAAA,EAAavB,EAAAA,MAAAA,CAAAwB,CAAA,EAAU,mBAAA,eAAyC,KAAMe,IAAC,WAAA,GAAA,E,6FAa7JyD,EAAA,MAAW,QAAUE,EAAA,QAAA,EAAhCrG,EAAAA,UAAAA,CAAA,GAAA,EAAAC,EAAAA,mBAAAA,CAEM,MAFN0F,GAEM,EAAA,EADJ3E,EAAAA,YAAAA,EAAAA,EAA4Fb,EAAAA,MAAAA,CAAAM,EAAAA,QAAA,EAAA,CAAjF,MAAO0F,EAAA,MAAa,OAAQ,GAAK,SAAQK,EAAe,UAASQ,C"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as MTitleBar } from './renderer/MTitleBar.vue';
2
2
  export { useElectronWindow } from './renderer/useElectronWindow';
3
3
  export type { ElectronWindow } from './renderer/useElectronWindow';
4
- export type { M3Bridge, M3Controls, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowInfo, M3WindowState } from './shared';
4
+ export type { M3Bridge, M3Controls, M3NativeTheme, M3OverlayColors, M3SplashUpdate, M3WindowAction, M3WindowInfo, M3WindowState } from './shared';
5
+ export type { M3SplashColors, M3SplashIndicator, M3SplashPreset } from './splashHtml';