@m3ui-vue/electron 0.3.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/dist/main.js CHANGED
@@ -1,28 +1,177 @@
1
1
  import { readFileSync as e, writeFileSync as t } from "node:fs";
2
- import { join as n } from "node:path";
3
- import { Menu as r, app as i, ipcMain as a, nativeTheme as o, screen as s, shell as c, systemPreferences as l } from "electron";
4
- import { n as u } from "./shared-CmmPhgMH.js";
2
+ import { extname as n, join as r } from "node:path";
3
+ import { BrowserWindow as i, Menu as a, app as o, ipcMain as s, nativeTheme as c, screen as l, shell as u, systemPreferences as d } from "electron";
4
+ import { n as f } from "./shared-DrrWmxv6.js";
5
+ import { SPLASH_BASELINE as p, SPLASH_LOGO_SIZES as m, SPLASH_PRESETS as h, SPLASH_SIZES as g, isSafeColor as _, splashHtml as v } from "./splash-html.js";
6
+ // src/splash.ts
7
+ var y = "m3-splash.json", b = () => r(o.getPath("userData"), y);
8
+ function x() {
9
+ try {
10
+ return JSON.parse(e(b(), "utf8"));
11
+ } catch {
12
+ return {};
13
+ }
14
+ }
15
+ var S = (e) => Object.fromEntries(Object.entries(e ?? {}).filter(([e, t]) => e in p.light && _(t)));
16
+ function C(e, n) {
17
+ let r = x(), i = S(n);
18
+ if (JSON.stringify(r[e]) !== JSON.stringify(i)) {
19
+ r[e] = i;
20
+ try {
21
+ t(b(), JSON.stringify(r));
22
+ } catch {}
23
+ }
24
+ }
25
+ var w = {
26
+ ".png": "image/png",
27
+ ".svg": "image/svg+xml",
28
+ ".jpg": "image/jpeg",
29
+ ".jpeg": "image/jpeg",
30
+ ".webp": "image/webp",
31
+ ".ico": "image/x-icon",
32
+ ".gif": "image/gif"
33
+ };
34
+ function T(t) {
35
+ if (t) {
36
+ if (/^(data:|https?:)/i.test(t)) return t;
37
+ try {
38
+ return `data:${w[n(t).toLowerCase()] ?? "image/png"};base64,${e(t).toString("base64")}`;
39
+ } catch {
40
+ return;
41
+ }
42
+ }
43
+ }
44
+ function E(e, t) {
45
+ let n = e === "banner" ? t.primaryContainer : e === "immersive" ? t.primary : t.surface;
46
+ return /^#[0-9a-f]{6}$/i.test(n) ? n : void 0;
47
+ }
48
+ var D = null, O = !1;
49
+ function k() {
50
+ O || (O = !0, s.on(f.splash, (e, t) => D?.update(t)), s.on(f.splashDone, (e) => {
51
+ let t = i.fromWebContents(e.sender);
52
+ t && D?.done(t);
53
+ }), s.on(f.splashColors, (e, t, n) => {
54
+ (t === "light" || t === "dark") && n && typeof n == "object" && C(t, n);
55
+ }));
56
+ }
57
+ function A() {
58
+ k();
59
+ }
60
+ function j(e = {}) {
61
+ k();
62
+ let t = e.theme === "light" || e.theme === "dark" ? e.theme : c.shouldUseDarkColors ? "dark" : "light", n = e.colors ?? {}, r = "light" in n || "dark" in n ? n[t] : n, a = {
63
+ ...p[t],
64
+ ...S(r),
65
+ ...e.remember === !1 ? {} : S(x()[t])
66
+ }, s = e.rounded ?? process.platform !== "linux", l = h.includes(e.preset) ? e.preset : "classic", u = Math.round(e.width ?? g[l].width), d = Math.round(e.height ?? g[l].height), f = Math.max(0, Math.round(e.duration ?? 0)), _ = Math.max(0, e.minDuration ?? 700, f), y = new i({
67
+ width: u,
68
+ height: d,
69
+ show: !1,
70
+ frame: !1,
71
+ resizable: !1,
72
+ maximizable: !1,
73
+ minimizable: !1,
74
+ fullscreenable: !1,
75
+ center: !0,
76
+ title: e.title ?? o.getName(),
77
+ transparent: s,
78
+ hasShadow: !s || process.platform === "darwin",
79
+ backgroundColor: s ? "#00000000" : E(l, a),
80
+ webPreferences: {
81
+ sandbox: !0,
82
+ contextIsolation: !0,
83
+ nodeIntegration: !1,
84
+ devTools: !1,
85
+ backgroundThrottling: !1
86
+ }
87
+ });
88
+ y.setMenu?.(null);
89
+ let b = 0, C, w = new Promise((e) => {
90
+ C = e;
91
+ });
92
+ y.once("ready-to-show", () => {
93
+ y.isDestroyed() || (y.show(), b = Date.now(), C());
94
+ }), y.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(v({
95
+ title: e.title ?? o.getName(),
96
+ logo: T(e.logo),
97
+ logoSize: Math.max(16, Math.round(e.logoSize ?? m[l])),
98
+ preset: l,
99
+ indicator: e.indicator === "linear" ? "linear" : "wavy",
100
+ status: e.status ?? "",
101
+ progress: e.progress ?? null,
102
+ colors: a,
103
+ fontFamily: e.fontFamily ?? "system-ui, sans-serif",
104
+ rounded: s,
105
+ footer: e.footer ?? "",
106
+ fill: f
107
+ }))}`);
108
+ let O = (e) => {
109
+ if (y.isDestroyed()) return;
110
+ let t = () => {
111
+ y.isDestroyed() || y.webContents.executeJavaScript(`window.m3splash&&window.m3splash.set(${JSON.stringify(e)})`).catch(() => {});
112
+ };
113
+ y.webContents.isLoading() ? y.webContents.once("did-finish-load", t) : t();
114
+ }, A = null, j = () => (A ??= (async () => {
115
+ if (D === P && (D = null), !y.isDestroyed()) {
116
+ try {
117
+ await y.webContents.executeJavaScript("window.m3splash?window.m3splash.exit():0");
118
+ } catch {}
119
+ y.isDestroyed() || y.destroy();
120
+ }
121
+ })(), A), M = /* @__PURE__ */ new Set(), N = null, P = {
122
+ update(e) {
123
+ let t = {};
124
+ e && "progress" in e && (t.progress = typeof e.progress == "number" && Number.isFinite(e.progress) ? e.progress : null), e && typeof e.status == "string" && (t.status = e.status.slice(0, 200)), O(t);
125
+ },
126
+ done(e) {
127
+ N?.id === e.id ? N.resolve() : M.add(e.id);
128
+ }
129
+ };
130
+ return D = P, {
131
+ window: y,
132
+ progress: (e, t) => P.update(t === void 0 ? { progress: e } : {
133
+ progress: e,
134
+ status: t
135
+ }),
136
+ status: (e) => P.update({ status: e }),
137
+ async handoff(e, t = {}) {
138
+ let n = t.waitForRenderer ? new Promise((t) => {
139
+ M.has(e.id) ? t() : N = {
140
+ id: e.id,
141
+ resolve: t
142
+ };
143
+ }) : new Promise((t) => {
144
+ e.isVisible() ? t() : e.once("ready-to-show", () => t());
145
+ }), r = new Promise((t) => e.once("closed", () => t())), i = (e) => new Promise((t) => setTimeout(t, e));
146
+ if (await Promise.race([Promise.all([Promise.race([n, i(t.timeout ?? 2e4)]), Promise.race([w, i(3e3)])]), r]), e.isDestroyed()) return j();
147
+ let a = _ - (Date.now() - b);
148
+ if (a > 0 && await new Promise((e) => setTimeout(e, a)), e.isDestroyed()) return j();
149
+ e.show(), e.focus(), await j();
150
+ },
151
+ close: j
152
+ };
153
+ }
5
154
  // src/main.ts
6
- var d = {
155
+ var M = {
7
156
  color: "#fef7ff",
8
157
  symbolColor: "#49454f"
9
158
  };
10
- function f(e = {}) {
159
+ function N(e = {}) {
11
160
  return {
12
161
  controls: e.controls === "custom" ? "custom" : "native",
13
162
  titleBarHeight: Math.max(24, Math.round(e.titleBarHeight ?? 40)),
14
163
  overlay: {
15
- ...d,
164
+ ...M,
16
165
  ...e.overlay
17
166
  },
18
167
  bounds: e.rememberBounds ? `m3-window${typeof e.rememberBounds == "string" ? `-${e.rememberBounds.replace(/[^\w-]/g, "_")}` : ""}.json` : null,
19
168
  externalLinks: e.externalLinks !== !1
20
169
  };
21
170
  }
22
- var p = (e) => n(i.getPath("userData"), e);
23
- function m(t) {
171
+ var P = (e) => r(o.getPath("userData"), e);
172
+ function F(t) {
24
173
  try {
25
- let n = JSON.parse(e(p(t), "utf8"));
174
+ let n = JSON.parse(e(P(t), "utf8"));
26
175
  return [
27
176
  n.x,
28
177
  n.y,
@@ -33,18 +182,18 @@ function m(t) {
33
182
  return null;
34
183
  }
35
184
  }
36
- function h(e) {
37
- let t = m(e);
38
- return t ? s.getAllDisplays().some(({ workArea: e }) => Math.min(t.x + t.width, e.x + e.width) - Math.max(t.x, e.x) >= 100 && Math.min(t.y + 40, e.y + e.height) - Math.max(t.y, e.y) >= 20) ? t : {
185
+ function I(e) {
186
+ let t = F(e);
187
+ return t ? l.getAllDisplays().some(({ workArea: e }) => Math.min(t.x + t.width, e.x + e.width) - Math.max(t.x, e.x) >= 100 && Math.min(t.y + 40, e.y + e.height) - Math.max(t.y, e.y) >= 20) ? t : {
39
188
  width: t.width,
40
189
  height: t.height,
41
190
  maximized: t.maximized
42
191
  } : {};
43
192
  }
44
- function g(e = {}) {
45
- let t = f(e), n = {};
193
+ function L(e = {}) {
194
+ let t = N(e), n = {};
46
195
  if (t.bounds) {
47
- let { x: e, y: r, width: i, height: a } = h(t.bounds);
196
+ let { x: e, y: r, width: i, height: a } = I(t.bounds);
48
197
  n = {
49
198
  ...i ? {
50
199
  width: i,
@@ -74,100 +223,100 @@ function g(e = {}) {
74
223
  } } : {}
75
224
  };
76
225
  }
77
- var _ = /* @__PURE__ */ new Map(), v = !1, y = () => {
226
+ var R = /* @__PURE__ */ new Map(), z = !1, B = () => {
78
227
  try {
79
- let e = process.platform === "win32" || process.platform === "darwin" ? l.getAccentColor() : "";
228
+ let e = process.platform === "win32" || process.platform === "darwin" ? d.getAccentColor() : "";
80
229
  return /^[0-9a-f]{6}/i.test(e) ? `#${e.slice(0, 6).toLowerCase()}` : null;
81
230
  } catch {
82
231
  return null;
83
232
  }
84
- }, b = (e) => ({
233
+ }, V = (e) => ({
85
234
  maximized: e.isMaximized(),
86
235
  fullscreen: e.isFullScreen(),
87
236
  focused: e.isFocused()
88
237
  });
89
- function x(e) {
90
- return _.get(e.id);
238
+ function H(e) {
239
+ return R.get(e.id);
91
240
  }
92
- function S() {
93
- v || (v = !0, a.handle(u.info, (e) => {
94
- let t = x(e.sender);
241
+ function U() {
242
+ z || (z = !0, s.handle(f.info, (e) => {
243
+ let t = H(e.sender);
95
244
  return t ? {
96
245
  controls: t.o.controls,
97
246
  platform: process.platform,
98
247
  titleBarHeight: t.o.titleBarHeight,
99
- state: b(t.win),
100
- accentColor: y()
248
+ state: V(t.win),
249
+ accentColor: B()
101
250
  } : null;
102
- }), a.on(u.action, (e, t) => {
103
- let n = x(e.sender);
251
+ }), s.on(f.action, (e, t) => {
252
+ let n = H(e.sender);
104
253
  n && !n.win.isDestroyed() && (t === "minimize" ? n.win.minimize() : t === "toggle-maximize" ? n.win.isFullScreen() ? n.win.setFullScreen(!1) : n.win.isMaximized() ? n.win.unmaximize() : n.win.maximize() : t === "close" && n.win.close());
105
- }), a.on(u.overlay, (e, t) => {
106
- let n = x(e.sender);
107
- if (!n || n.win.isDestroyed() || n.o.controls !== "native" || process.platform === "darwin" || !E(t?.color) || !E(t?.symbolColor)) return;
254
+ }), s.on(f.overlay, (e, t) => {
255
+ let n = H(e.sender);
256
+ if (!n || n.win.isDestroyed() || n.o.controls !== "native" || process.platform === "darwin" || !q(t?.color) || !q(t?.symbolColor)) return;
108
257
  let r = `${t.color}|${t.symbolColor}`;
109
258
  r !== n.overlay && (n.overlay = r, n.win.setTitleBarOverlay({
110
259
  color: t.color,
111
260
  symbolColor: t.symbolColor,
112
261
  height: n.o.titleBarHeight
113
262
  }));
114
- }), a.on(u.theme, (e, t) => {
115
- x(e.sender) && [
263
+ }), s.on(f.theme, (e, t) => {
264
+ H(e.sender) && [
116
265
  "light",
117
266
  "dark",
118
267
  "system"
119
- ].includes(t) && o.themeSource !== t && (o.themeSource = t);
120
- }), a.on(u.progress, (e, t) => {
121
- let n = x(e.sender);
268
+ ].includes(t) && c.themeSource !== t && (c.themeSource = t);
269
+ }), s.on(f.progress, (e, t) => {
270
+ let n = H(e.sender);
122
271
  n && !n.win.isDestroyed() && (t === "indeterminate" ? n.win.setProgressBar(2, { mode: "indeterminate" }) : typeof t == "number" && Number.isFinite(t) ? n.win.setProgressBar(Math.min(1, Math.max(0, t))) : n.win.setProgressBar(-1));
123
- }), a.on(u.badge, (e, t) => {
124
- x(e.sender) && i.setBadgeCount(Math.max(0, Math.floor(Number(t) || 0)));
125
- }), a.on(u.attention, (e) => {
126
- let t = x(e.sender);
127
- !t || t.win.isDestroyed() || t.win.isFocused() || (process.platform === "darwin" ? i.dock?.bounce("informational") : (t.win.flashFrame(!0), t.win.once("focus", () => {
272
+ }), s.on(f.badge, (e, t) => {
273
+ H(e.sender) && o.setBadgeCount(Math.max(0, Math.floor(Number(t) || 0)));
274
+ }), s.on(f.attention, (e) => {
275
+ let t = H(e.sender);
276
+ !t || t.win.isDestroyed() || t.win.isFocused() || (process.platform === "darwin" ? o.dock?.bounce("informational") : (t.win.flashFrame(!0), t.win.once("focus", () => {
128
277
  t.win.isDestroyed() || t.win.flashFrame(!1);
129
278
  })));
130
- }), a.on(u.menu, (e, t) => {
131
- if (!x(e.sender) || process.platform !== "darwin") return;
132
- if (T ??= { menu: r.getApplicationMenu() }, !Array.isArray(t)) return r.setApplicationMenu(T.menu);
133
- let n = e.sender, i = (e) => () => {
134
- n.isDestroyed() || n.send(u.menuClick, e);
135
- }, a = (e) => e.type === "separator" ? { type: "separator" } : e.type === "submenu" ? {
279
+ }), s.on(f.menu, (e, t) => {
280
+ if (!H(e.sender) || process.platform !== "darwin") return;
281
+ if (K ??= { menu: a.getApplicationMenu() }, !Array.isArray(t)) return a.setApplicationMenu(K.menu);
282
+ let n = e.sender, r = (e) => () => {
283
+ n.isDestroyed() || n.send(f.menuClick, e);
284
+ }, i = (e) => e.type === "separator" ? { type: "separator" } : e.type === "submenu" ? {
136
285
  label: e.label,
137
286
  enabled: e.enabled,
138
- submenu: e.items.map(a)
287
+ submenu: e.items.map(i)
139
288
  } : {
140
289
  type: e.type,
141
290
  label: e.label,
142
291
  enabled: e.enabled,
143
292
  checked: e.checked,
144
293
  accelerator: e.accelerator,
145
- click: i(e.id)
294
+ click: r(e.id)
146
295
  }, o = t.map((e) => ({
147
296
  label: e.label,
148
297
  enabled: e.enabled,
149
- submenu: e.items.map(a)
150
- })), s = t.some((e) => w.test(e.label.trim())) ? [] : [{ role: "editMenu" }];
151
- r.setApplicationMenu(r.buildFromTemplate([
298
+ submenu: e.items.map(i)
299
+ })), s = t.some((e) => G.test(e.label.trim())) ? [] : [{ role: "editMenu" }];
300
+ a.setApplicationMenu(a.buildFromTemplate([
152
301
  { role: "appMenu" },
153
302
  ...s,
154
303
  ...o
155
304
  ]));
156
- }), l.on?.("accent-color-changed", () => {
157
- for (let { win: e } of _.values()) e.isDestroyed() || e.webContents.send(u.accent, y());
305
+ }), d.on?.("accent-color-changed", () => {
306
+ for (let { win: e } of R.values()) e.isDestroyed() || e.webContents.send(f.accent, B());
158
307
  }));
159
308
  }
160
- var C = /^(https?|mailto):/i, w = /^(edit|editar|édition|edition|bearbeiten|modifica|編集|编辑|編輯|편집|تحرير|edycja)$/i, T, E = (e) => typeof e == "string" && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e);
161
- function D(e, n = {}) {
162
- S();
163
- let r = f(n), i = e.webContents.id;
164
- _.set(i, {
309
+ var W = /^(https?|mailto):/i, G = /^(edit|editar|édition|edition|bearbeiten|modifica|編集|编辑|編輯|편집|تحرير|edycja)$/i, K, q = (e) => typeof e == "string" && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e);
310
+ function J(e, n = {}) {
311
+ U(), A();
312
+ let r = N(n), i = e.webContents.id;
313
+ R.set(i, {
165
314
  win: e,
166
315
  o: r,
167
316
  overlay: ""
168
317
  });
169
318
  let a = () => {
170
- e.isDestroyed() || e.webContents.send(u.state, b(e));
319
+ e.isDestroyed() || e.webContents.send(f.state, V(e));
171
320
  }, o = [
172
321
  "maximize",
173
322
  "unmaximize",
@@ -178,14 +327,14 @@ function D(e, n = {}) {
178
327
  "restore"
179
328
  ];
180
329
  for (let t of o) e.on(t, a);
181
- let s = () => {}, l, d = () => {
182
- clearTimeout(l), l = setTimeout(s, 400);
330
+ let s = () => {}, c, l = () => {
331
+ clearTimeout(c), c = setTimeout(s, 400);
183
332
  };
184
333
  if (r.bounds) {
185
334
  let n = r.bounds;
186
- m(n)?.maximized && e.maximize(), s = () => {
335
+ F(n)?.maximized && e.maximize(), s = () => {
187
336
  if (!(e.isDestroyed() || e.isMinimized() || e.isFullScreen())) try {
188
- t(p(n), JSON.stringify({
337
+ t(P(n), JSON.stringify({
189
338
  ...e.getNormalBounds(),
190
339
  maximized: e.isMaximized()
191
340
  }));
@@ -196,31 +345,31 @@ function D(e, n = {}) {
196
345
  "move",
197
346
  "maximize",
198
347
  "unmaximize"
199
- ]) e.on(t, d);
348
+ ]) e.on(t, l);
200
349
  e.on("close", () => {
201
- clearTimeout(l), s();
350
+ clearTimeout(c), s();
202
351
  });
203
352
  }
204
- return r.externalLinks && (e.webContents.setWindowOpenHandler(({ url: e }) => (C.test(e) && c.openExternal(e), { action: "deny" })), e.webContents.on("will-navigate", (t, n) => {
353
+ return r.externalLinks && (e.webContents.setWindowOpenHandler(({ url: e }) => (W.test(e) && u.openExternal(e), { action: "deny" })), e.webContents.on("will-navigate", (t, n) => {
205
354
  let r = e.webContents.getURL(), i = !1;
206
355
  try {
207
356
  i = new URL(n).origin !== new URL(r).origin;
208
357
  } catch {}
209
- C.test(n) && i && (t.preventDefault(), c.openExternal(n));
358
+ W.test(n) && i && (t.preventDefault(), u.openExternal(n));
210
359
  })), e.once("closed", () => {
211
- _.delete(i), clearTimeout(l);
360
+ R.delete(i), clearTimeout(c);
212
361
  }), () => {
213
- if (_.delete(i), clearTimeout(l), !e.isDestroyed()) {
362
+ if (R.delete(i), clearTimeout(c), !e.isDestroyed()) {
214
363
  for (let t of o) e.off(t, a);
215
364
  for (let t of [
216
365
  "resize",
217
366
  "move",
218
367
  "maximize",
219
368
  "unmaximize"
220
- ]) e.off(t, d);
369
+ ]) e.off(t, l);
221
370
  }
222
371
  };
223
372
  }
224
- export { g as m3WindowOptions, D as setupM3Window };
373
+ export { j as createSplash, L as m3WindowOptions, C as rememberSplashColors, J as setupM3Window };
225
374
 
226
375
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["readFileSync","writeFileSync","join","Menu","app","ipcMain","nativeTheme","screen","shell","systemPreferences","IPC","BASELINE","resolve","o","boundsFile","name","readBounds","b","restoredBounds","a","m3WindowOptions","options","saved","x","y","width","height","mac","windows","registered","accent","c","stateOf","win","entry","sender","register","w","action","colors","isHex","key","theme","value","count","menus","original","click","id","item","i","own","m","edit","EDIT","EXTERNAL","setupM3Window","send","events","ev","save","timer","later","url","e","here","other"],"sources":["../src/main.ts"],"sourcesContent":["/**\n * `@m3ui-vue/electron/main`: the main-process half. `m3WindowOptions()` gives the BrowserWindow options for the mode\n * you pick, `setupM3Window()` wires that window to MTitleBar (its state, its buttons, the native overlay's colors) and\n * to `useElectronWindow()` (native theme, accent color, taskbar progress and badge, attention), remembers its bounds\n * and sends outside links to the browser.\n *\n * ```ts\n * const m3 = { controls: 'native' } as const\n * const win = new BrowserWindow({ width: 1100, height: 720, ...m3WindowOptions(m3), webPreferences: { preload } })\n * setupM3Window(win, m3)\n * ```\n */\nimport { readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { app, BrowserWindow, ipcMain, Menu, nativeTheme, screen, shell, systemPreferences, type BrowserWindowConstructorOptions, type IpcMainEvent, type IpcMainInvokeEvent, type MenuItemConstructorOptions, type Rectangle, type WebContents } from 'electron'\nimport { DEFAULT_TITLE_BAR_HEIGHT, IPC, type M3NativeMenu, type M3NativeMenuItem, type M3Controls, type M3NativeTheme, type M3OverlayColors, type M3WindowAction, type M3WindowInfo, type M3WindowState } from './shared'\n\nexport type { M3Controls, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowInfo, M3WindowState } from './shared'\n\nexport interface M3WindowOptions {\n /** `'native'` (default): the system's buttons, recolored from the theme. `'custom'`: frameless, MTitleBar draws them */\n controls?: M3Controls\n /** Title bar height in px (default 40) */\n titleBarHeight?: number\n /**\n * The native buttons' colors before the page has loaded (MTitleBar sends the real ones from the theme as soon as\n * it mounts). Defaults to the M3 baseline light surface\n */\n overlay?: Partial<M3OverlayColors>\n /**\n * Reopen the window with the size, position and maximized state it closed with (kept in the app's userData\n * folder). `true`, or a name per window when the app has several. Spread `m3WindowOptions()` after your own\n * width/height so the remembered ones win\n */\n rememberBounds?: boolean | string\n /**\n * Open http(s) and mailto links that would leave the app (`target=\"_blank\"`, `window.open`, a link to another\n * site) in the system browser instead of a new Electron window. Default true\n */\n externalLinks?: boolean\n}\n\ninterface Resolved {\n controls: M3Controls\n titleBarHeight: number\n overlay: M3OverlayColors\n bounds: string | null\n externalLinks: boolean\n}\n\nconst BASELINE: M3OverlayColors = { color: '#fef7ff', symbolColor: '#49454f' }\n\nfunction resolve(o: M3WindowOptions = {}): Resolved {\n return {\n controls: o.controls === 'custom' ? 'custom' : 'native',\n titleBarHeight: Math.max(24, Math.round(o.titleBarHeight ?? DEFAULT_TITLE_BAR_HEIGHT)),\n overlay: { ...BASELINE, ...o.overlay },\n bounds: o.rememberBounds ? `m3-window${typeof o.rememberBounds === 'string' ? `-${o.rememberBounds.replace(/[^\\w-]/g, '_')}` : ''}.json` : null,\n externalLinks: o.externalLinks !== false,\n }\n}\n\n// ── Remembered bounds ───────────────────────────────────────────────────────────────────────────────────────────\ninterface Saved extends Rectangle { maximized: boolean }\nconst boundsFile = (name: string) => join(app.getPath('userData'), name)\n\nfunction readBounds(name: string): Saved | null {\n try {\n const b = JSON.parse(readFileSync(boundsFile(name), 'utf8')) as Saved\n if (![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null\n return b\n } catch {\n return null\n }\n}\n\n/** The saved bounds, without the position when no screen shows enough of the window anymore (a monitor unplugged) */\nfunction restoredBounds(name: string): Partial<Rectangle> & { maximized?: boolean } {\n const b = readBounds(name)\n if (!b) return {}\n const visible = screen.getAllDisplays().some(({ workArea: a }) =>\n Math.min(b.x + b.width, a.x + a.width) - Math.max(b.x, a.x) >= 100 && Math.min(b.y + 40, a.y + a.height) - Math.max(b.y, a.y) >= 20)\n return visible ? b : { width: b.width, height: b.height, maximized: b.maximized }\n}\n\n/** The BrowserWindow options for a mode: spread them into `new BrowserWindow({ ... })` */\nexport function m3WindowOptions(options: M3WindowOptions = {}): BrowserWindowConstructorOptions {\n const o = resolve(options)\n let saved: BrowserWindowConstructorOptions = {}\n if (o.bounds) {\n const { x, y, width, height } = restoredBounds(o.bounds)\n saved = { ...(width ? { width, height } : {}), ...(x != null ? { x, y } : {}) }\n }\n if (o.controls === 'custom') return { ...saved, frame: false }\n const mac = process.platform === 'darwin'\n return {\n ...saved,\n titleBarStyle: 'hidden',\n // macOS keeps its traffic lights (`true` only turns on the overlay's CSS env() area); elsewhere the system's\n // buttons are drawn over the page in these colors, at the bar's height\n titleBarOverlay: mac ? true : { ...o.overlay, height: o.titleBarHeight },\n // Traffic lights (12px, 20px apart) centered in the bar\n ...(mac ? { trafficLightPosition: { x: 14, y: Math.round((o.titleBarHeight - 16) / 2) } } : {}),\n }\n}\n\n// One handler per channel for the whole app; each message finds its window's settings by the sender\nconst windows = new Map<number, { win: BrowserWindow; o: Resolved; overlay: string }>()\nlet registered = false\n\nconst accent = (): string | null => {\n try {\n const c = process.platform === 'win32' || process.platform === 'darwin' ? systemPreferences.getAccentColor() : ''\n return /^[0-9a-f]{6}/i.test(c) ? `#${c.slice(0, 6).toLowerCase()}` : null\n } catch {\n return null\n }\n}\n\nconst stateOf = (win: BrowserWindow): M3WindowState => ({\n maximized: win.isMaximized(),\n fullscreen: win.isFullScreen(),\n focused: win.isFocused(),\n})\n\nfunction entry(sender: WebContents) {\n return windows.get(sender.id)\n}\n\nfunction register() {\n if (registered) return\n registered = true\n ipcMain.handle(IPC.info, (e: IpcMainInvokeEvent): M3WindowInfo | null => {\n const w = entry(e.sender)\n if (!w) return null\n return { controls: w.o.controls, platform: process.platform, titleBarHeight: w.o.titleBarHeight, state: stateOf(w.win), accentColor: accent() }\n })\n ipcMain.on(IPC.action, (e: IpcMainEvent, action: M3WindowAction) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed()) return\n if (action === 'minimize') w.win.minimize()\n else if (action === 'toggle-maximize') {\n if (w.win.isFullScreen()) w.win.setFullScreen(false)\n else if (w.win.isMaximized()) w.win.unmaximize()\n else w.win.maximize()\n } else if (action === 'close') w.win.close()\n })\n ipcMain.on(IPC.overlay, (e: IpcMainEvent, colors: M3OverlayColors) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed() || w.o.controls !== 'native' || process.platform === 'darwin') return\n if (!isHex(colors?.color) || !isHex(colors?.symbolColor)) return\n // The renderer sends every frame of a theme transition: skip what wouldn't change anything\n const key = `${colors.color}|${colors.symbolColor}`\n if (key === w.overlay) return\n w.overlay = key\n w.win.setTitleBarOverlay({ color: colors.color, symbolColor: colors.symbolColor, height: w.o.titleBarHeight })\n })\n // The app's theme choice drives the native UI too (dialogs, context menus, scrollbars, macOS's frame). The\n // choice, not the result: 'system' must stay 'system', or prefers-color-scheme would follow the app back\n ipcMain.on(IPC.theme, (e: IpcMainEvent, theme: M3NativeTheme) => {\n if (!entry(e.sender) || !['light', 'dark', 'system'].includes(theme)) return\n if (nativeTheme.themeSource !== theme) nativeTheme.themeSource = theme\n })\n ipcMain.on(IPC.progress, (e: IpcMainEvent, value: number | 'indeterminate' | null) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed()) return\n if (value === 'indeterminate') w.win.setProgressBar(2, { mode: 'indeterminate' })\n else if (typeof value === 'number' && Number.isFinite(value)) w.win.setProgressBar(Math.min(1, Math.max(0, value)))\n else w.win.setProgressBar(-1)\n })\n ipcMain.on(IPC.badge, (e: IpcMainEvent, count: number) => {\n if (!entry(e.sender)) return\n app.setBadgeCount(Math.max(0, Math.floor(Number(count) || 0)))\n })\n ipcMain.on(IPC.attention, (e: IpcMainEvent) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed() || w.win.isFocused()) return\n if (process.platform === 'darwin') app.dock?.bounce('informational')\n else {\n w.win.flashFrame(true)\n w.win.once('focus', () => { if (!w.win.isDestroyed()) w.win.flashFrame(false) })\n }\n })\n // The page's menus in macOS's menu bar (native controls: the page has no bar of its own for them there). The app\n // menu comes first, and a standard Edit menu unless the page has one: it's what makes ⌘C/⌘V work in the page\n ipcMain.on(IPC.menu, (e: IpcMainEvent, menus: M3NativeMenu[] | null) => {\n if (!entry(e.sender) || process.platform !== 'darwin') return\n original ??= { menu: Menu.getApplicationMenu() }\n if (!Array.isArray(menus)) return Menu.setApplicationMenu(original.menu)\n const sender = e.sender\n const click = (id: number) => () => { if (!sender.isDestroyed()) sender.send(IPC.menuClick, id) }\n const item = (i: M3NativeMenuItem): MenuItemConstructorOptions =>\n i.type === 'separator' ? { type: 'separator' }\n : i.type === 'submenu' ? { label: i.label, enabled: i.enabled, submenu: i.items.map(item) }\n : { type: i.type, label: i.label, enabled: i.enabled, checked: i.checked, accelerator: i.accelerator, click: click(i.id) }\n const own = menus.map((m): MenuItemConstructorOptions => ({ label: m.label, enabled: m.enabled, submenu: m.items.map(item) }))\n const edit = menus.some((m) => EDIT.test(m.label.trim())) ? [] : [{ role: 'editMenu' } as const]\n Menu.setApplicationMenu(Menu.buildFromTemplate([{ role: 'appMenu' }, ...edit, ...own]))\n })\n // Accent color changes (Windows sends them; macOS asks for a relaunch of most apps anyway)\n const sendAccent = () => { for (const { win } of windows.values()) if (!win.isDestroyed()) win.webContents.send(IPC.accent, accent()) }\n systemPreferences.on?.('accent-color-changed', sendAccent)\n}\n\nconst EXTERNAL = /^(https?|mailto):/i\n// An Edit menu of the page's own, in the languages the library ships\nconst EDIT = /^(edit|editar|édition|edition|bearbeiten|modifica|編集|编辑|編輯|편집|تحرير|edycja)$/i\n// The application menu before the page's first menus, put back when they go\nlet original: { menu: Menu | null } | undefined\n\nconst isHex = (c: unknown): c is string => typeof c === 'string' && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(c)\n\n/**\n * Connects `win` to MTitleBar: answers its questions, runs its buttons, sends it the window's state and recolors the\n * native buttons with the theme. Pass the same options as to `m3WindowOptions()`. Returns a function that undoes it\n * (it's undone on its own when the window closes).\n */\nexport function setupM3Window(win: BrowserWindow, options: M3WindowOptions = {}): () => void {\n register()\n const o = resolve(options)\n const id = win.webContents.id\n windows.set(id, { win, o, overlay: '' })\n const send = () => { if (!win.isDestroyed()) win.webContents.send(IPC.state, stateOf(win)) }\n const events = ['maximize', 'unmaximize', 'enter-full-screen', 'leave-full-screen', 'focus', 'blur', 'restore'] as const\n for (const ev of events) win.on(ev as 'maximize', send)\n\n // Bounds: the size it had before being maximized (getNormalBounds), saved after moves and resizes settle\n let save = () => {}\n let timer: ReturnType<typeof setTimeout> | undefined\n const later = () => { clearTimeout(timer); timer = setTimeout(save, 400) }\n if (o.bounds) {\n const name = o.bounds\n if (readBounds(name)?.maximized) win.maximize()\n save = () => {\n if (win.isDestroyed() || win.isMinimized() || win.isFullScreen()) return\n try {\n writeFileSync(boundsFile(name), JSON.stringify({ ...win.getNormalBounds(), maximized: win.isMaximized() }))\n } catch { /* a read-only profile: nothing to remember */ }\n }\n for (const ev of ['resize', 'move', 'maximize', 'unmaximize'] as const) win.on(ev as 'resize', later)\n win.on('close', () => { clearTimeout(timer); save() })\n }\n\n // Links that leave the app open in the browser\n if (o.externalLinks) {\n win.webContents.setWindowOpenHandler(({ url }) => {\n if (EXTERNAL.test(url)) void shell.openExternal(url)\n return { action: 'deny' }\n })\n win.webContents.on('will-navigate', (e, url) => {\n const here = win.webContents.getURL()\n let other = false\n try { other = new URL(url).origin !== new URL(here).origin } catch { /* about:blank and the like */ }\n if (EXTERNAL.test(url) && other) {\n e.preventDefault()\n void shell.openExternal(url)\n }\n })\n }\n\n const dispose = () => {\n windows.delete(id)\n clearTimeout(timer)\n if (!win.isDestroyed()) {\n for (const ev of events) win.off(ev as 'maximize', send)\n for (const ev of ['resize', 'move', 'maximize', 'unmaximize'] as const) win.off(ev as 'resize', later)\n }\n }\n win.once('closed', () => { windows.delete(id); clearTimeout(timer) })\n return dispose\n}\n"],"mappings":";;;;;AAkDA,IAAMW,IAA4B;CAAE,OAAO;CAAW,aAAa;AAAU;AAE7E,SAASC,EAAQC,IAAqB,CAAC,GAAa;CAClD,OAAO;EACL,UAAUA,EAAE,aAAa,WAAW,WAAW;EAC/C,gBAAgB,KAAK,IAAI,IAAI,KAAK,MAAMA,EAAE,kBAAA,EAA0C,CAAC;EACrF,SAAS;GAAE,GAAGF;G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;IAAU;IAAQ;IAAY;GAAY,GAAY1B,EAAI,IAAI0B,GAAgBG,CAAK;EACvG;CACF;AAGF"}
1
+ {"version":3,"file":"main.js","names":["registered","register","readFileSync","writeFileSync","extname","join","BrowserWindow","Menu","app","ipcMain","nativeTheme","screen","shell","systemPreferences","IPC","SPLASH_BASELINE","SPLASH_LOGO_SIZES","SPLASH_PRESETS","SPLASH_SIZES","isSafeColor","splashHtml","COLORS_FILE","colorsFile","readRemembered","clean","c","k","v","rememberSplashColors","scheme","colors","all","next","MIME","logoUrl","logo","windowColor","preset","bg","current","registered$1","register$1","_e","u","win","registerSplashIpc","createSplash","options","given","perScheme","rounded","width","height","duration","minDuration","shownAt","shown","onScreen","r","send","run","closing","close","controller","readyFrom","waiting","out","from","value","status","text","target","o","ready","resolve","gone","late","ms","left","BASELINE","boundsFile","name","readBounds","b","restoredBounds","a","m3WindowOptions","saved","x","y","mac","windows","registered","accent","stateOf","entry","sender","register","w","action","isHex","key","theme","count","menus","original","click","id","item","i","own","m","edit","EDIT","EXTERNAL","setupM3Window","events","ev","save","timer","later","url","e","here","other"],"sources":["../src/splash.ts","../src/main.ts"],"sourcesContent":["/**\n * The bootsplash, main-process side: a small frameless window shown at once while the app starts (a loading bar and a\n * status line, as Discord's launcher), handing over to the app's window when it's ready.\n *\n * ```ts\n * const splash = createSplash({ title: 'Acme', logo: join(__dirname, 'icon.png') })\n * const win = new BrowserWindow({ show: false, ...m3WindowOptions(m3), webPreferences: { preload } })\n * splash.progress(0.3, 'Loading your workspace…')\n * win.loadURL(url)\n * splash.handoff(win) // shows `win` when it's ready, then the splash fades out\n * ```\n */\nimport { readFileSync, writeFileSync } from 'node:fs'\nimport { extname, join } from 'node:path'\nimport { app, BrowserWindow, ipcMain, nativeTheme, type IpcMainEvent } from 'electron'\nimport { IPC, type M3SplashUpdate } from './shared'\nimport { SPLASH_BASELINE, SPLASH_LOGO_SIZES, SPLASH_PRESETS, SPLASH_SIZES, isSafeColor, splashHtml, type M3SplashColors, type M3SplashIndicator, type M3SplashPreset } from './splashHtml'\n\nexport type { M3SplashColors, M3SplashIndicator, M3SplashPreset } from './splashHtml'\n\nexport interface M3SplashOptions {\n /**\n * The layout: `'classic'` (default: logo, name, bar, status on the surface), `'banner'` (landscape on the primary\n * container, logo beside a large name), `'minimal'` (the logo and a short bar) or `'immersive'` (the whole window in\n * the primary color). Each has its own window and logo size; `width`, `height` and `logoSize` change them\n */\n preset?: M3SplashPreset\n /** `'wavy'` (default: M3 Expressive's wavy indicator) or `'linear'` (the flat one) */\n indicator?: M3SplashIndicator\n /** The app's name (under the logo; the accessible label in `minimal`) */\n title?: string\n /**\n * The logo: a file path (png, svg, jpg, webp, ico), a data: URL, or an http(s) URL. Without one, the title's\n * initial in a circle\n */\n logo?: string\n /** The logo's size in px. Default per preset (96 classic, 72 banner, 112 minimal and immersive) */\n logoSize?: number\n /** The first status line. Default empty */\n status?: string\n /** The first progress, 0–1, or null (default) for an indeterminate bar */\n progress?: number | null\n /** A line under everything, e.g. the version: `` `v${app.getVersion()}` `` */\n footer?: string\n /** Light or dark: default `'system'` (`nativeTheme.shouldUseDarkColors`) */\n theme?: 'light' | 'dark' | 'system'\n /**\n * The colors for the first launch, per scheme or for both. Default the M3 baseline (purple). Later launches use the\n * user's own theme and palette, which the renderer remembers (see `remember`)\n */\n colors?: Partial<M3SplashColors> | { light?: Partial<M3SplashColors>; dark?: Partial<M3SplashColors> }\n /**\n * Paint later launches with the theme and palette the app last showed (MTitleBar, or `useElectronWindow()\n * .rememberSplashColors()`, keep them in the userData folder). Default true\n */\n remember?: boolean\n /** Window size. Default per preset: classic 300 × 340, banner 520 × 280, minimal 240 × 240, immersive 360 × 420 */\n width?: number\n height?: number\n /**\n * Rounded corners on a transparent window. Default true on Windows and macOS; false on Linux, where a window manager\n * without a compositor paints the transparent corners black\n */\n rounded?: boolean\n /** Default `system-ui, sans-serif`: the app's fonts aren't loaded in the splash */\n fontFamily?: string\n /** Stays at least this long (ms) once shown, so a fast start doesn't flash it. Default 700 */\n minDuration?: number\n /**\n * A set time (ms): the bar fills by itself over it and the splash stays that long, or until the app is ready if that\n * takes longer. Leave it out to go as soon as the app is ready, driving the bar with `progress()` (or leaving it\n * indeterminate)\n */\n duration?: number\n}\n\nexport interface M3Splash {\n /** The splash's BrowserWindow */\n window: BrowserWindow\n /** Sets the bar (0–1; null for indeterminate) and, if given, the status line */\n progress(value: number | null, status?: string): void\n /** Sets the status line */\n status(text: string): void\n /**\n * Shows `win` once it's ready, then fades the splash out and closes it. Ready is its `ready-to-show` by default;\n * with `{ waitForRenderer: true }`, when the page calls `useElectronWindow().splashDone()` (after its first data\n * loads, say). `timeout` (ms, default 20000) shows it anyway if that never comes. Resolves once the splash is gone\n */\n handoff(win: BrowserWindow, options?: { waitForRenderer?: boolean; timeout?: number }): Promise<void>\n /** Fades the splash out and closes it, without showing any window */\n close(): Promise<void>\n}\n\nconst COLORS_FILE = 'm3-splash.json'\nconst colorsFile = () => join(app.getPath('userData'), COLORS_FILE)\ntype Remembered = Partial<Record<'light' | 'dark', Partial<M3SplashColors>>>\n\nfunction readRemembered(): Remembered {\n try {\n return JSON.parse(readFileSync(colorsFile(), 'utf8')) as Remembered\n } catch {\n return {}\n }\n}\n\nconst clean = (c: Partial<M3SplashColors> | undefined): Partial<M3SplashColors> =>\n Object.fromEntries(Object.entries(c ?? {}).filter(([k, v]) => k in SPLASH_BASELINE.light && isSafeColor(v))) as Partial<M3SplashColors>\n\n/** Keeps the colors the page showed, per scheme, for the next launch's splash */\nexport function rememberSplashColors(scheme: 'light' | 'dark', colors: Partial<M3SplashColors>): void {\n const all = readRemembered()\n const next = clean(colors)\n if (JSON.stringify(all[scheme]) === JSON.stringify(next)) return\n all[scheme] = next\n try {\n writeFileSync(colorsFile(), JSON.stringify(all))\n } catch { /* a read-only userData: the next splash uses the defaults */ }\n}\n\nconst MIME: Record<string, string> = { '.png': 'image/png', '.svg': 'image/svg+xml', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.ico': 'image/x-icon', '.gif': 'image/gif' }\n\nfunction logoUrl(logo: string | undefined): string | undefined {\n if (!logo) return undefined\n if (/^(data:|https?:)/i.test(logo)) return logo\n try {\n return `data:${MIME[extname(logo).toLowerCase()] ?? 'image/png'};base64,${readFileSync(logo).toString('base64')}`\n } catch {\n return undefined\n }\n}\n\n/** The window's own color behind the page (no white flash), when it's a hex: the preset's background */\nfunction windowColor(preset: M3SplashPreset, c: M3SplashColors): string | undefined {\n const bg = preset === 'banner' ? c.primaryContainer : preset === 'immersive' ? c.primary : c.surface\n return /^#[0-9a-f]{6}$/i.test(bg) ? bg : undefined\n}\n\nlet current: { update(u: M3SplashUpdate): void; done(win: BrowserWindow): void } | null = null\nlet registered = false\n\nfunction register() {\n if (registered) return\n registered = true\n // From the page of the app's window (useElectronWindow): the bar, the status, its first launch's colors, \"ready\"\n ipcMain.on(IPC.splash, (_e: IpcMainEvent, u: M3SplashUpdate) => current?.update(u))\n ipcMain.on(IPC.splashDone, (e: IpcMainEvent) => {\n const win = BrowserWindow.fromWebContents(e.sender)\n if (win) current?.done(win)\n })\n ipcMain.on(IPC.splashColors, (_e: IpcMainEvent, scheme: unknown, colors: unknown) => {\n if ((scheme === 'light' || scheme === 'dark') && colors && typeof colors === 'object') rememberSplashColors(scheme, colors as Partial<M3SplashColors>)\n })\n}\n\n/** Registers the renderer's splash messages (remembering its colors) without opening a splash: `setupM3Window` calls it */\nexport function registerSplashIpc(): void {\n register()\n}\n\n/** Opens the bootsplash now. Call it as soon as the app is ready (`app.whenReady()`), before creating the main window */\nexport function createSplash(options: M3SplashOptions = {}): M3Splash {\n register()\n const scheme = options.theme === 'light' || options.theme === 'dark' ? options.theme : nativeTheme.shouldUseDarkColors ? 'dark' : 'light'\n const given = options.colors ?? {}\n const perScheme = 'light' in given || 'dark' in given\n ? (given as { light?: Partial<M3SplashColors>; dark?: Partial<M3SplashColors> })[scheme]\n : (given as Partial<M3SplashColors>)\n const colors: M3SplashColors = {\n ...SPLASH_BASELINE[scheme],\n ...clean(perScheme),\n ...(options.remember === false ? {} : clean(readRemembered()[scheme])),\n }\n const rounded = options.rounded ?? process.platform !== 'linux'\n const preset: M3SplashPreset = SPLASH_PRESETS.includes(options.preset as M3SplashPreset) ? options.preset! : 'classic'\n const width = Math.round(options.width ?? SPLASH_SIZES[preset].width)\n const height = Math.round(options.height ?? SPLASH_SIZES[preset].height)\n const duration = Math.max(0, Math.round(options.duration ?? 0))\n const minDuration = Math.max(0, options.minDuration ?? 700, duration)\n\n const win = new BrowserWindow({\n width,\n height,\n show: false,\n frame: false,\n resizable: false,\n maximizable: false,\n minimizable: false,\n fullscreenable: false,\n center: true,\n title: options.title ?? app.getName(),\n transparent: rounded,\n hasShadow: !rounded || process.platform === 'darwin',\n backgroundColor: rounded ? '#00000000' : windowColor(preset, colors),\n // Keeps painting (the bar moving) while another window covers it\n webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false, devTools: false, backgroundThrottling: false },\n })\n win.setMenu?.(null)\n\n let shownAt = 0\n let shown: () => void\n const onScreen = new Promise<void>((r) => { shown = r })\n win.once('ready-to-show', () => {\n if (win.isDestroyed()) return\n win.show()\n shownAt = Date.now()\n shown()\n })\n void win.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(splashHtml({\n title: options.title ?? app.getName(),\n logo: logoUrl(options.logo),\n logoSize: Math.max(16, Math.round(options.logoSize ?? SPLASH_LOGO_SIZES[preset])),\n preset,\n indicator: options.indicator === 'linear' ? 'linear' : 'wavy',\n status: options.status ?? '',\n progress: options.progress ?? null,\n colors,\n fontFamily: options.fontFamily ?? 'system-ui, sans-serif',\n rounded,\n footer: options.footer ?? '',\n fill: duration,\n }))}`)\n\n const send = (u: M3SplashUpdate) => {\n if (win.isDestroyed()) return\n const run = () => { if (!win.isDestroyed()) void win.webContents.executeJavaScript(`window.m3splash&&window.m3splash.set(${JSON.stringify(u)})`).catch(() => {}) }\n if (win.webContents.isLoading()) win.webContents.once('did-finish-load', run)\n else run()\n }\n\n let closing: Promise<void> | null = null\n const close = (): Promise<void> => {\n closing ??= (async () => {\n if (current === controller) current = null\n if (win.isDestroyed()) return\n try {\n await win.webContents.executeJavaScript('window.m3splash?window.m3splash.exit():0')\n } catch { /* closing anyway */ }\n if (!win.isDestroyed()) win.destroy()\n })()\n return closing\n }\n\n // A renderer's \"ready\" that came before handoff() waits for it\n const readyFrom = new Set<number>()\n let waiting: { id: number; resolve: () => void } | null = null\n const controller = {\n update(u: M3SplashUpdate) {\n const out: M3SplashUpdate = {}\n if (u && 'progress' in u) out.progress = typeof u.progress === 'number' && Number.isFinite(u.progress) ? u.progress : null\n if (u && typeof u.status === 'string') out.status = u.status.slice(0, 200)\n send(out)\n },\n done(from: BrowserWindow) {\n if (waiting?.id === from.id) waiting.resolve()\n else readyFrom.add(from.id)\n },\n }\n current = controller\n\n return {\n window: win,\n progress: (value, status) => controller.update(status === undefined ? { progress: value } : { progress: value, status }),\n status: (text) => controller.update({ status: text }),\n async handoff(target, o = {}) {\n const ready = o.waitForRenderer\n ? new Promise<void>((resolve) => {\n if (readyFrom.has(target.id)) resolve()\n else waiting = { id: target.id, resolve }\n })\n : new Promise<void>((resolve) => {\n if (target.isVisible()) resolve()\n else target.once('ready-to-show', () => resolve())\n })\n // The app's window closed before it was ever ready: don't leave the splash behind\n const gone = new Promise<void>((resolve) => target.once('closed', () => resolve()))\n const late = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))\n // Never stuck: a splash that can't paint (3s) or a page that never says it's ready (`timeout`) don't hold the app\n await Promise.race([Promise.all([Promise.race([ready, late(o.timeout ?? 20000)]), Promise.race([onScreen, late(3000)])]), gone])\n if (target.isDestroyed()) return close()\n const left = minDuration - (Date.now() - shownAt)\n if (left > 0) await new Promise((r) => setTimeout(r, left))\n if (target.isDestroyed()) return close()\n target.show()\n target.focus()\n await close()\n },\n close,\n }\n}\n","/**\n * `@m3ui-vue/electron/main`: the main-process half. `m3WindowOptions()` gives the BrowserWindow options for the mode\n * you pick, `setupM3Window()` wires that window to MTitleBar (its state, its buttons, the native overlay's colors) and\n * to `useElectronWindow()` (native theme, accent color, taskbar progress and badge, attention), remembers its bounds\n * and sends outside links to the browser.\n *\n * ```ts\n * const m3 = { controls: 'native' } as const\n * const win = new BrowserWindow({ width: 1100, height: 720, ...m3WindowOptions(m3), webPreferences: { preload } })\n * setupM3Window(win, m3)\n * ```\n */\nimport { readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { app, BrowserWindow, ipcMain, Menu, nativeTheme, screen, shell, systemPreferences, type BrowserWindowConstructorOptions, type IpcMainEvent, type IpcMainInvokeEvent, type MenuItemConstructorOptions, type Rectangle, type WebContents } from 'electron'\nimport { DEFAULT_TITLE_BAR_HEIGHT, IPC, type M3NativeMenu, type M3NativeMenuItem, type M3Controls, type M3NativeTheme, type M3OverlayColors, type M3WindowAction, type M3WindowInfo, type M3WindowState } from './shared'\nimport { registerSplashIpc } from './splash'\n\nexport type { M3Controls, M3NativeTheme, M3OverlayColors, M3SplashUpdate, M3WindowAction, M3WindowInfo, M3WindowState } from './shared'\nexport { createSplash, rememberSplashColors, type M3Splash, type M3SplashColors, type M3SplashIndicator, type M3SplashOptions, type M3SplashPreset } from './splash'\n\nexport interface M3WindowOptions {\n /** `'native'` (default): the system's buttons, recolored from the theme. `'custom'`: frameless, MTitleBar draws them */\n controls?: M3Controls\n /** Title bar height in px (default 40) */\n titleBarHeight?: number\n /**\n * The native buttons' colors before the page has loaded (MTitleBar sends the real ones from the theme as soon as\n * it mounts). Defaults to the M3 baseline light surface\n */\n overlay?: Partial<M3OverlayColors>\n /**\n * Reopen the window with the size, position and maximized state it closed with (kept in the app's userData\n * folder). `true`, or a name per window when the app has several. Spread `m3WindowOptions()` after your own\n * width/height so the remembered ones win\n */\n rememberBounds?: boolean | string\n /**\n * Open http(s) and mailto links that would leave the app (`target=\"_blank\"`, `window.open`, a link to another\n * site) in the system browser instead of a new Electron window. Default true\n */\n externalLinks?: boolean\n}\n\ninterface Resolved {\n controls: M3Controls\n titleBarHeight: number\n overlay: M3OverlayColors\n bounds: string | null\n externalLinks: boolean\n}\n\nconst BASELINE: M3OverlayColors = { color: '#fef7ff', symbolColor: '#49454f' }\n\nfunction resolve(o: M3WindowOptions = {}): Resolved {\n return {\n controls: o.controls === 'custom' ? 'custom' : 'native',\n titleBarHeight: Math.max(24, Math.round(o.titleBarHeight ?? DEFAULT_TITLE_BAR_HEIGHT)),\n overlay: { ...BASELINE, ...o.overlay },\n bounds: o.rememberBounds ? `m3-window${typeof o.rememberBounds === 'string' ? `-${o.rememberBounds.replace(/[^\\w-]/g, '_')}` : ''}.json` : null,\n externalLinks: o.externalLinks !== false,\n }\n}\n\n// ── Remembered bounds ───────────────────────────────────────────────────────────────────────────────────────────\ninterface Saved extends Rectangle { maximized: boolean }\nconst boundsFile = (name: string) => join(app.getPath('userData'), name)\n\nfunction readBounds(name: string): Saved | null {\n try {\n const b = JSON.parse(readFileSync(boundsFile(name), 'utf8')) as Saved\n if (![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null\n return b\n } catch {\n return null\n }\n}\n\n/** The saved bounds, without the position when no screen shows enough of the window anymore (a monitor unplugged) */\nfunction restoredBounds(name: string): Partial<Rectangle> & { maximized?: boolean } {\n const b = readBounds(name)\n if (!b) return {}\n const visible = screen.getAllDisplays().some(({ workArea: a }) =>\n Math.min(b.x + b.width, a.x + a.width) - Math.max(b.x, a.x) >= 100 && Math.min(b.y + 40, a.y + a.height) - Math.max(b.y, a.y) >= 20)\n return visible ? b : { width: b.width, height: b.height, maximized: b.maximized }\n}\n\n/** The BrowserWindow options for a mode: spread them into `new BrowserWindow({ ... })` */\nexport function m3WindowOptions(options: M3WindowOptions = {}): BrowserWindowConstructorOptions {\n const o = resolve(options)\n let saved: BrowserWindowConstructorOptions = {}\n if (o.bounds) {\n const { x, y, width, height } = restoredBounds(o.bounds)\n saved = { ...(width ? { width, height } : {}), ...(x != null ? { x, y } : {}) }\n }\n if (o.controls === 'custom') return { ...saved, frame: false }\n const mac = process.platform === 'darwin'\n return {\n ...saved,\n titleBarStyle: 'hidden',\n // macOS keeps its traffic lights (`true` only turns on the overlay's CSS env() area); elsewhere the system's\n // buttons are drawn over the page in these colors, at the bar's height\n titleBarOverlay: mac ? true : { ...o.overlay, height: o.titleBarHeight },\n // Traffic lights (12px, 20px apart) centered in the bar\n ...(mac ? { trafficLightPosition: { x: 14, y: Math.round((o.titleBarHeight - 16) / 2) } } : {}),\n }\n}\n\n// One handler per channel for the whole app; each message finds its window's settings by the sender\nconst windows = new Map<number, { win: BrowserWindow; o: Resolved; overlay: string }>()\nlet registered = false\n\nconst accent = (): string | null => {\n try {\n const c = process.platform === 'win32' || process.platform === 'darwin' ? systemPreferences.getAccentColor() : ''\n return /^[0-9a-f]{6}/i.test(c) ? `#${c.slice(0, 6).toLowerCase()}` : null\n } catch {\n return null\n }\n}\n\nconst stateOf = (win: BrowserWindow): M3WindowState => ({\n maximized: win.isMaximized(),\n fullscreen: win.isFullScreen(),\n focused: win.isFocused(),\n})\n\nfunction entry(sender: WebContents) {\n return windows.get(sender.id)\n}\n\nfunction register() {\n if (registered) return\n registered = true\n ipcMain.handle(IPC.info, (e: IpcMainInvokeEvent): M3WindowInfo | null => {\n const w = entry(e.sender)\n if (!w) return null\n return { controls: w.o.controls, platform: process.platform, titleBarHeight: w.o.titleBarHeight, state: stateOf(w.win), accentColor: accent() }\n })\n ipcMain.on(IPC.action, (e: IpcMainEvent, action: M3WindowAction) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed()) return\n if (action === 'minimize') w.win.minimize()\n else if (action === 'toggle-maximize') {\n if (w.win.isFullScreen()) w.win.setFullScreen(false)\n else if (w.win.isMaximized()) w.win.unmaximize()\n else w.win.maximize()\n } else if (action === 'close') w.win.close()\n })\n ipcMain.on(IPC.overlay, (e: IpcMainEvent, colors: M3OverlayColors) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed() || w.o.controls !== 'native' || process.platform === 'darwin') return\n if (!isHex(colors?.color) || !isHex(colors?.symbolColor)) return\n // The renderer sends every frame of a theme transition: skip what wouldn't change anything\n const key = `${colors.color}|${colors.symbolColor}`\n if (key === w.overlay) return\n w.overlay = key\n w.win.setTitleBarOverlay({ color: colors.color, symbolColor: colors.symbolColor, height: w.o.titleBarHeight })\n })\n // The app's theme choice drives the native UI too (dialogs, context menus, scrollbars, macOS's frame). The\n // choice, not the result: 'system' must stay 'system', or prefers-color-scheme would follow the app back\n ipcMain.on(IPC.theme, (e: IpcMainEvent, theme: M3NativeTheme) => {\n if (!entry(e.sender) || !['light', 'dark', 'system'].includes(theme)) return\n if (nativeTheme.themeSource !== theme) nativeTheme.themeSource = theme\n })\n ipcMain.on(IPC.progress, (e: IpcMainEvent, value: number | 'indeterminate' | null) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed()) return\n if (value === 'indeterminate') w.win.setProgressBar(2, { mode: 'indeterminate' })\n else if (typeof value === 'number' && Number.isFinite(value)) w.win.setProgressBar(Math.min(1, Math.max(0, value)))\n else w.win.setProgressBar(-1)\n })\n ipcMain.on(IPC.badge, (e: IpcMainEvent, count: number) => {\n if (!entry(e.sender)) return\n app.setBadgeCount(Math.max(0, Math.floor(Number(count) || 0)))\n })\n ipcMain.on(IPC.attention, (e: IpcMainEvent) => {\n const w = entry(e.sender)\n if (!w || w.win.isDestroyed() || w.win.isFocused()) return\n if (process.platform === 'darwin') app.dock?.bounce('informational')\n else {\n w.win.flashFrame(true)\n w.win.once('focus', () => { if (!w.win.isDestroyed()) w.win.flashFrame(false) })\n }\n })\n // The page's menus in macOS's menu bar (native controls: the page has no bar of its own for them there). The app\n // menu comes first, and a standard Edit menu unless the page has one: it's what makes ⌘C/⌘V work in the page\n ipcMain.on(IPC.menu, (e: IpcMainEvent, menus: M3NativeMenu[] | null) => {\n if (!entry(e.sender) || process.platform !== 'darwin') return\n original ??= { menu: Menu.getApplicationMenu() }\n if (!Array.isArray(menus)) return Menu.setApplicationMenu(original.menu)\n const sender = e.sender\n const click = (id: number) => () => { if (!sender.isDestroyed()) sender.send(IPC.menuClick, id) }\n const item = (i: M3NativeMenuItem): MenuItemConstructorOptions =>\n i.type === 'separator' ? { type: 'separator' }\n : i.type === 'submenu' ? { label: i.label, enabled: i.enabled, submenu: i.items.map(item) }\n : { type: i.type, label: i.label, enabled: i.enabled, checked: i.checked, accelerator: i.accelerator, click: click(i.id) }\n const own = menus.map((m): MenuItemConstructorOptions => ({ label: m.label, enabled: m.enabled, submenu: m.items.map(item) }))\n const edit = menus.some((m) => EDIT.test(m.label.trim())) ? [] : [{ role: 'editMenu' } as const]\n Menu.setApplicationMenu(Menu.buildFromTemplate([{ role: 'appMenu' }, ...edit, ...own]))\n })\n // Accent color changes (Windows sends them; macOS asks for a relaunch of most apps anyway)\n const sendAccent = () => { for (const { win } of windows.values()) if (!win.isDestroyed()) win.webContents.send(IPC.accent, accent()) }\n systemPreferences.on?.('accent-color-changed', sendAccent)\n}\n\nconst EXTERNAL = /^(https?|mailto):/i\n// An Edit menu of the page's own, in the languages the library ships\nconst EDIT = /^(edit|editar|édition|edition|bearbeiten|modifica|編集|编辑|編輯|편집|تحرير|edycja)$/i\n// The application menu before the page's first menus, put back when they go\nlet original: { menu: Menu | null } | undefined\n\nconst isHex = (c: unknown): c is string => typeof c === 'string' && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(c)\n\n/**\n * Connects `win` to MTitleBar: answers its questions, runs its buttons, sends it the window's state and recolors the\n * native buttons with the theme. Pass the same options as to `m3WindowOptions()`. Returns a function that undoes it\n * (it's undone on its own when the window closes).\n */\nexport function setupM3Window(win: BrowserWindow, options: M3WindowOptions = {}): () => void {\n register()\n // The page remembers its theme's colors for the next launch's bootsplash, splash or not this time\n registerSplashIpc()\n const o = resolve(options)\n const id = win.webContents.id\n windows.set(id, { win, o, overlay: '' })\n const send = () => { if (!win.isDestroyed()) win.webContents.send(IPC.state, stateOf(win)) }\n const events = ['maximize', 'unmaximize', 'enter-full-screen', 'leave-full-screen', 'focus', 'blur', 'restore'] as const\n for (const ev of events) win.on(ev as 'maximize', send)\n\n // Bounds: the size it had before being maximized (getNormalBounds), saved after moves and resizes settle\n let save = () => {}\n let timer: ReturnType<typeof setTimeout> | undefined\n const later = () => { clearTimeout(timer); timer = setTimeout(save, 400) }\n if (o.bounds) {\n const name = o.bounds\n if (readBounds(name)?.maximized) win.maximize()\n save = () => {\n if (win.isDestroyed() || win.isMinimized() || win.isFullScreen()) return\n try {\n writeFileSync(boundsFile(name), JSON.stringify({ ...win.getNormalBounds(), maximized: win.isMaximized() }))\n } catch { /* a read-only profile: nothing to remember */ }\n }\n for (const ev of ['resize', 'move', 'maximize', 'unmaximize'] as const) win.on(ev as 'resize', later)\n win.on('close', () => { clearTimeout(timer); save() })\n }\n\n // Links that leave the app open in the browser\n if (o.externalLinks) {\n win.webContents.setWindowOpenHandler(({ url }) => {\n if (EXTERNAL.test(url)) void shell.openExternal(url)\n return { action: 'deny' }\n })\n win.webContents.on('will-navigate', (e, url) => {\n const here = win.webContents.getURL()\n let other = false\n try { other = new URL(url).origin !== new URL(here).origin } catch { /* about:blank and the like */ }\n if (EXTERNAL.test(url) && other) {\n e.preventDefault()\n void shell.openExternal(url)\n }\n })\n }\n\n const dispose = () => {\n windows.delete(id)\n clearTimeout(timer)\n if (!win.isDestroyed()) {\n for (const ev of events) win.off(ev as 'maximize', send)\n for (const ev of ['resize', 'move', 'maximize', 'unmaximize'] as const) win.off(ev as 'resize', later)\n }\n }\n win.once('closed', () => { windows.delete(id); clearTimeout(timer) })\n return dispose\n}\n"],"mappings":";;;;;;AA6FA,IAAMqB,IAAc,kBACdC,UAAmBjB,EAAKG,EAAI,QAAQ,UAAU,GAAGa,CAAW;AAGlE,SAASE,IAA6B;CACpC,IAAI;EACF,OAAO,KAAK,MAAMrB,EAAaoB,EAAW,GAAG,MAAM,CAAC;CACtD,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,IAAME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GAAE,aAAa2E,CAAK,GAAGD,EAAK;EAAE,CAAC;CACvD;CA4BA,OAzBI9C,EAAE,kBACJ5B,EAAI,YAAY,sBAAsB,EAAE6E,cAClCP,EAAS,KAAKO,CAAG,KAAQ7G,EAAM,aAAa6G,CAAG,GAC5C,EAAE,QAAQ,OAAO,EACzB,GACD7E,EAAI,YAAY,GAAG,kBAAkB8E,GAAGD,MAAQ;EAC9C,IAAME,IAAO/E,EAAI,YAAY,OAAO,GAChCgF,IAAQ;EACZ,IAAI;GAAEA,IAAQ,IAAI,IAAIH,CAAG,CAAC,CAAC,WAAW,IAAI,IAAIE,CAAI,CAAC,CAAC;EAAO,QAAQ,CAAiC;EAChGT,EAAS,KAAKO,CAAG,KAAKG,MACxBF,EAAE,eAAe,GACZ9G,EAAM,aAAa6G,CAAG;CAE/B,CAAC,IAWH7E,EAAI,KAAK,gBAAgB;EAAE+C,EAAQ,OAAOgB,CAAE,GAAG,aAAaY,CAAK;CAAE,CAAC,SAR9C;EAGpB,IAFA5B,EAAQ,OAAOgB,CAAE,GACjB,aAAaY,CAAK,GACd,CAAC3E,EAAI,YAAY,GAAG;GACtB,KAAK,IAAMyE,KAAMD,GAAQxE,EAAI,IAAIyE,GAAkB1D,CAAI;GACvD,KAAK,IAAM0D,KAAM;IAAC;IAAU;IAAQ;IAAY;GAAY,GAAYzE,EAAI,IAAIyE,GAAgBG,CAAK;EACvG;CACF;AAGF"}
package/dist/preload.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("electron");var t={info:`m3ui:info`,state:`m3ui:state`,action:`m3ui:action`,overlay:`m3ui:overlay`,theme:`m3ui:theme`,progress:`m3ui:progress`,badge:`m3ui:badge`,attention:`m3ui:attention`,accent:`m3ui:accent`,menu:`m3ui:menu`,menuClick:`m3ui:menu-click`},n=`m3ui`;function r(){return{info:()=>e.ipcRenderer.invoke(t.info),onState(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.state,r),()=>{e.ipcRenderer.removeListener(t.state,r)}},action:n=>e.ipcRenderer.send(t.action,n),setOverlay:n=>e.ipcRenderer.send(t.overlay,{color:n.color,symbolColor:n.symbolColor}),setTheme:n=>e.ipcRenderer.send(t.theme,n),setProgress:n=>e.ipcRenderer.send(t.progress,n),setBadge:n=>e.ipcRenderer.send(t.badge,n),attention:()=>e.ipcRenderer.send(t.attention),onAccent(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.accent,r),()=>{e.ipcRenderer.removeListener(t.accent,r)}},setMenu:n=>e.ipcRenderer.send(t.menu,n),onMenuClick(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.menuClick,r),()=>{e.ipcRenderer.removeListener(t.menuClick,r)}}}}exports._BRIDGE_KEY=n,exports._IPC=t,exports.createM3Bridge=r,exports.exposeM3UI=function(){let t=r();process.contextIsolated?e.contextBridge.exposeInMainWorld(n,t):globalThis[n]=t};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("electron");var t={info:`m3ui:info`,state:`m3ui:state`,action:`m3ui:action`,overlay:`m3ui:overlay`,theme:`m3ui:theme`,progress:`m3ui:progress`,badge:`m3ui:badge`,attention:`m3ui:attention`,accent:`m3ui:accent`,menu:`m3ui:menu`,menuClick:`m3ui:menu-click`,splash:`m3ui:splash`,splashDone:`m3ui:splash-done`,splashColors:`m3ui:splash-colors`},n=`m3ui`;function r(){return{info:()=>e.ipcRenderer.invoke(t.info),onState(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.state,r),()=>{e.ipcRenderer.removeListener(t.state,r)}},action:n=>e.ipcRenderer.send(t.action,n),setOverlay:n=>e.ipcRenderer.send(t.overlay,{color:n.color,symbolColor:n.symbolColor}),setTheme:n=>e.ipcRenderer.send(t.theme,n),setProgress:n=>e.ipcRenderer.send(t.progress,n),setBadge:n=>e.ipcRenderer.send(t.badge,n),attention:()=>e.ipcRenderer.send(t.attention),onAccent(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.accent,r),()=>{e.ipcRenderer.removeListener(t.accent,r)}},setMenu:n=>e.ipcRenderer.send(t.menu,n),onMenuClick(n){let r=(e,t)=>n(t);return e.ipcRenderer.on(t.menuClick,r),()=>{e.ipcRenderer.removeListener(t.menuClick,r)}},splash:n=>e.ipcRenderer.send(t.splash,{progress:n.progress,status:n.status}),splashDone:()=>e.ipcRenderer.send(t.splashDone),splashColors:(n,r)=>e.ipcRenderer.send(t.splashColors,n,{...r})}}exports._BRIDGE_KEY=n,exports._IPC=t,exports.createM3Bridge=r,exports.exposeM3UI=function(){let t=r();process.contextIsolated?e.contextBridge.exposeInMainWorld(n,t):globalThis[n]=t};
2
2
  //# sourceMappingURL=preload.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"preload.cjs","names":["ipcRenderer","contextBridge","electron","IPC","BRIDGE_KEY","createM3Bridge","listener","handler","_e","state","action","colors","theme","value","count","color","menus","id","bridge"],"sources":["../src/preload.ts"],"sourcesContent":["/**\n * `@m3ui-vue/electron/preload`: exposes the bridge MTitleBar talks through.\n *\n * ```ts\n * // preload.ts (bundled, as electron-vite does)\n * import { exposeM3UI } from '@m3ui-vue/electron/preload'\n * exposeM3UI()\n * ```\n *\n * A sandboxed preload can't `require` npm packages at runtime: bundle it, or paste `createM3Bridge()`'s body (it only\n * needs `ipcRenderer`).\n */\nimport { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'\nimport type { M3Bridge, M3NativeMenu, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowState } from './shared'\n\n// Copies of shared.ts's constants (a test keeps them equal): with no runtime import, the built preload is one\n// self-contained file, which a sandboxed preload needs (it can only `require('electron')`)\nconst IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n menu: 'm3ui:menu',\n menuClick: 'm3ui:menu-click',\n} as const\nconst BRIDGE_KEY = 'm3ui'\nexport { IPC as _IPC, BRIDGE_KEY as _BRIDGE_KEY }\n\nexport type { M3Bridge } from './shared'\n\n/** The bridge itself, to expose it yourself (it must end up as `window.m3ui`) */\nexport function createM3Bridge(): M3Bridge {\n return {\n info: () => ipcRenderer.invoke(IPC.info),\n onState(listener: (state: M3WindowState) => void) {\n const handler = (_e: IpcRendererEvent, state: M3WindowState) => listener(state)\n ipcRenderer.on(IPC.state, handler)\n return () => { ipcRenderer.removeListener(IPC.state, handler) }\n },\n action: (action: M3WindowAction) => ipcRenderer.send(IPC.action, action),\n setOverlay: (colors: M3OverlayColors) => ipcRenderer.send(IPC.overlay, { color: colors.color, symbolColor: colors.symbolColor }),\n setTheme: (theme: M3NativeTheme) => ipcRenderer.send(IPC.theme, theme),\n setProgress: (value: number | 'indeterminate' | null) => ipcRenderer.send(IPC.progress, value),\n setBadge: (count: number) => ipcRenderer.send(IPC.badge, count),\n attention: () => ipcRenderer.send(IPC.attention),\n onAccent(listener: (color: string | null) => void) {\n const handler = (_e: IpcRendererEvent, color: string | null) => listener(color)\n ipcRenderer.on(IPC.accent, handler)\n return () => { ipcRenderer.removeListener(IPC.accent, handler) }\n },\n setMenu: (menus: M3NativeMenu[] | null) => ipcRenderer.send(IPC.menu, menus),\n onMenuClick(listener: (id: number) => void) {\n const handler = (_e: IpcRendererEvent, id: number) => listener(id)\n ipcRenderer.on(IPC.menuClick, handler)\n return () => { ipcRenderer.removeListener(IPC.menuClick, handler) }\n },\n }\n}\n\n/**\n * Exposes the bridge as `window.m3ui`, where `useElectronWindow()` and MTitleBar look for it. Uses `contextBridge`\n * when context isolation is on (the default), a plain global otherwise.\n */\nexport function exposeM3UI(): void {\n const bridge = createM3Bridge()\n if (process.contextIsolated) contextBridge.exposeInMainWorld(BRIDGE_KEY, bridge)\n else (globalThis as unknown as Record<string, unknown>)[BRIDGE_KEY] = bridge\n}\n"],"mappings":"A,6FAiBA,IAA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,UAAWI,CAAO,CAAE,CACpE,CACF,CACF,C,iFAMA,UAAmC,CACjC,IAAMW,EAASb,EAAe,EAC1B,QAAQ,gBAAiBJ,EAAAA,cAAc,kBAAkBG,EAAYc,CAAM,EACzE,WAAkDd,GAAcc,CACxE"}
1
+ {"version":3,"file":"preload.cjs","names":["ipcRenderer","contextBridge","electron","IPC","BRIDGE_KEY","createM3Bridge","listener","handler","_e","state","action","colors","theme","value","count","color","menus","id","update","scheme","bridge"],"sources":["../src/preload.ts"],"sourcesContent":["/**\n * `@m3ui-vue/electron/preload`: exposes the bridge MTitleBar talks through.\n *\n * ```ts\n * // preload.ts (bundled, as electron-vite does)\n * import { exposeM3UI } from '@m3ui-vue/electron/preload'\n * exposeM3UI()\n * ```\n *\n * A sandboxed preload can't `require` npm packages at runtime: bundle it, or paste `createM3Bridge()`'s body (it only\n * needs `ipcRenderer`).\n */\nimport { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'\nimport type { M3Bridge, M3SplashUpdate, M3NativeMenu, M3NativeTheme, M3OverlayColors, M3WindowAction, M3WindowState } from './shared'\n\n// Copies of shared.ts's constants (a test keeps them equal): with no runtime import, the built preload is one\n// self-contained file, which a sandboxed preload needs (it can only `require('electron')`)\nconst IPC = {\n info: 'm3ui:info',\n state: 'm3ui:state',\n action: 'm3ui:action',\n overlay: 'm3ui:overlay',\n theme: 'm3ui:theme',\n progress: 'm3ui:progress',\n badge: 'm3ui:badge',\n attention: 'm3ui:attention',\n accent: 'm3ui:accent',\n menu: 'm3ui:menu',\n menuClick: 'm3ui:menu-click',\n splash: 'm3ui:splash',\n splashDone: 'm3ui:splash-done',\n splashColors: 'm3ui:splash-colors',\n} as const\nconst BRIDGE_KEY = 'm3ui'\nexport { IPC as _IPC, BRIDGE_KEY as _BRIDGE_KEY }\n\nexport type { M3Bridge } from './shared'\n\n/** The bridge itself, to expose it yourself (it must end up as `window.m3ui`) */\nexport function createM3Bridge(): M3Bridge {\n return {\n info: () => ipcRenderer.invoke(IPC.info),\n onState(listener: (state: M3WindowState) => void) {\n const handler = (_e: IpcRendererEvent, state: M3WindowState) => listener(state)\n ipcRenderer.on(IPC.state, handler)\n return () => { ipcRenderer.removeListener(IPC.state, handler) }\n },\n action: (action: M3WindowAction) => ipcRenderer.send(IPC.action, action),\n setOverlay: (colors: M3OverlayColors) => ipcRenderer.send(IPC.overlay, { color: colors.color, symbolColor: colors.symbolColor }),\n setTheme: (theme: M3NativeTheme) => ipcRenderer.send(IPC.theme, theme),\n setProgress: (value: number | 'indeterminate' | null) => ipcRenderer.send(IPC.progress, value),\n setBadge: (count: number) => ipcRenderer.send(IPC.badge, count),\n attention: () => ipcRenderer.send(IPC.attention),\n onAccent(listener: (color: string | null) => void) {\n const handler = (_e: IpcRendererEvent, color: string | null) => listener(color)\n ipcRenderer.on(IPC.accent, handler)\n return () => { ipcRenderer.removeListener(IPC.accent, handler) }\n },\n setMenu: (menus: M3NativeMenu[] | null) => ipcRenderer.send(IPC.menu, menus),\n onMenuClick(listener: (id: number) => void) {\n const handler = (_e: IpcRendererEvent, id: number) => listener(id)\n ipcRenderer.on(IPC.menuClick, handler)\n return () => { ipcRenderer.removeListener(IPC.menuClick, handler) }\n },\n splash: (update: M3SplashUpdate) => ipcRenderer.send(IPC.splash, { progress: update.progress, status: update.status }),\n splashDone: () => ipcRenderer.send(IPC.splashDone),\n splashColors: (scheme: 'light' | 'dark', colors: Record<string, string>) => ipcRenderer.send(IPC.splashColors, scheme, { ...colors }),\n }\n}\n\n/**\n * Exposes the bridge as `window.m3ui`, where `useElectronWindow()` and MTitleBar look for it. Uses `contextBridge`\n * when context isolation is on (the default), a plain global otherwise.\n */\nexport function exposeM3UI(): void {\n const bridge = createM3Bridge()\n if (process.contextIsolated) contextBridge.exposeInMainWorld(BRIDGE_KEY, bridge)\n else (globalThis as unknown as Record<string, unknown>)[BRIDGE_KEY] = bridge\n}\n"],"mappings":"A,6FAiBA,IAAMG,EAAM,CACV,KAAM,YACN,MAAO,aACP,O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I,UAAWI,CAAO,CAAE,CACpE,EACA,OAASW,GAA2BlB,EAAAA,YAAY,KAAKG,EAAI,OAAQ,CAAE,SAAUe,EAAO,SAAU,OAAQA,EAAO,MAAO,CAAC,EACrH,eAAkBlB,EAAAA,YAAY,KAAKG,EAAI,UAAU,EACjD,cAAegB,EAA0BR,IAAmCX,EAAAA,YAAY,KAAKG,EAAI,aAAcgB,EAAQ,CAAE,GAAGR,CAAO,CAAC,CACtI,CACF,C,iFAMA,UAAmC,CACjC,IAAMS,EAASf,EAAe,EAC1B,QAAQ,gBAAiBJ,EAAAA,cAAc,kBAAkBG,EAAYgB,CAAM,EACzE,WAAkDhB,GAAcgB,CACxE"}
package/dist/preload.d.ts CHANGED
@@ -11,6 +11,9 @@ declare const IPC: {
11
11
  readonly accent: "m3ui:accent";
12
12
  readonly menu: "m3ui:menu";
13
13
  readonly menuClick: "m3ui:menu-click";
14
+ readonly splash: "m3ui:splash";
15
+ readonly splashDone: "m3ui:splash-done";
16
+ readonly splashColors: "m3ui:splash-colors";
14
17
  };
15
18
  declare const BRIDGE_KEY = "m3ui";
16
19
  export { IPC as _IPC, BRIDGE_KEY as _BRIDGE_KEY };