@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.
@@ -0,0 +1,242 @@
1
+ // src/splashHtml.ts
2
+ var e = {
3
+ light: {
4
+ surface: "#f7f2fa",
5
+ onSurface: "#1d1b20",
6
+ onSurfaceVariant: "#49454f",
7
+ primary: "#6750a4",
8
+ onPrimary: "#ffffff",
9
+ secondaryContainer: "#e8def8",
10
+ primaryContainer: "#eaddff",
11
+ onPrimaryContainer: "#4f378b"
12
+ },
13
+ dark: {
14
+ surface: "#1d1b20",
15
+ onSurface: "#e6e0e9",
16
+ onSurfaceVariant: "#cac4d0",
17
+ primary: "#d0bcff",
18
+ onPrimary: "#381e72",
19
+ secondaryContainer: "#4a4458",
20
+ primaryContainer: "#4f378b",
21
+ onPrimaryContainer: "#eaddff"
22
+ }
23
+ }, t = {
24
+ surface: "--color-surface-container-low",
25
+ onSurface: "--color-on-surface",
26
+ onSurfaceVariant: "--color-on-surface-variant",
27
+ primary: "--color-primary",
28
+ onPrimary: "--color-on-primary",
29
+ secondaryContainer: "--color-secondary-container",
30
+ primaryContainer: "--color-primary-container",
31
+ onPrimaryContainer: "--color-on-primary-container"
32
+ }, n = [
33
+ "classic",
34
+ "banner",
35
+ "minimal",
36
+ "immersive"
37
+ ], r = {
38
+ classic: {
39
+ width: 300,
40
+ height: 340
41
+ },
42
+ banner: {
43
+ width: 520,
44
+ height: 280
45
+ },
46
+ minimal: {
47
+ width: 240,
48
+ height: 240
49
+ },
50
+ immersive: {
51
+ width: 360,
52
+ height: 420
53
+ }
54
+ }, i = {
55
+ classic: 96,
56
+ banner: 72,
57
+ minimal: 112,
58
+ immersive: 112
59
+ }, a = /^[#\w\s(),.%/+-]{1,80}$/, o = (e) => typeof e == "string" && a.test(e) && !/url|expression|;|[<>"'{}]/i.test(e), s = (e) => e.replace(/[&<>"']/g, (e) => `&#${e.charCodeAt(0)};`), c = 20, l = 2.5, u = 4.5, d = `<svg class="wave" width="1840" height="9" viewBox="0 0 1840 9" aria-hidden="true"><path d="${`M0,${u}Q${c / 4},${u - 2 * l} ${c / 2},${u}` + Array.from({ length: 90 }, (e, t) => `T${c / 2 * (t + 2)},${u}`).join("")}"/></svg>`, f = `<!DOCTYPE html>
60
+ <html lang="en">
61
+ <head>
62
+ <meta charset="utf-8">
63
+ <title>{{title}}</title>
64
+ <style>
65
+ :root{{{vars}};--logo:{{logoSize}}px;--radius:{{radius}};--outer:{{background}}}
66
+ *{box-sizing:border-box;margin:0}
67
+ html,body{height:100%;overflow:hidden;background:var(--outer);-webkit-user-select:none;user-select:none;cursor:default}
68
+ body{font-family:{{font}};-webkit-font-smoothing:antialiased}
69
+ .card{position:absolute;inset:0;display:grid;overflow:hidden;border-radius:var(--radius);-webkit-app-region:drag;
70
+ background:var(--bg);color:var(--fg);opacity:0;transform:scale(.96);animation:in .35s cubic-bezier(.05,.7,.1,1) forwards}
71
+ .card.out{animation:out .2s cubic-bezier(.3,0,.8,.15) forwards}
72
+ @keyframes in{to{opacity:1;transform:none}}
73
+ @keyframes out{from{opacity:1;transform:none}to{opacity:0;transform:scale(1.04)}}
74
+ .logo{grid-area:logo;width:var(--logo);height:var(--logo);object-fit:contain}
75
+ .initial{display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--chip);color:var(--onChip);
76
+ font-size:calc(var(--logo) * .45);font-weight:500;line-height:1}
77
+ h1{grid-area:title;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
78
+ .status{grid-area:status;min-height:20px;font-size:14px;line-height:20px;letter-spacing:.25px;color:var(--muted);max-width:100%;
79
+ overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
80
+ .footer{grid-area:footer;font-size:11px;line-height:16px;letter-spacing:.5px;color:var(--muted);opacity:.85}
81
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
82
+
83
+ /* The bar: a flat track, the active indicator (a line, or a scrolling wave), a 4px gap between them and, determinate,
84
+ a 4px stop dot at the end. Indeterminate: two segments run along it (Compose's keyframes, roughly) */
85
+ .bar{grid-area:bar;position:relative;width:100%;height:10px}
86
+ .bar>i{position:absolute;top:3px;height:4px;border-radius:2px}
87
+ .trk{background:var(--track)}
88
+ .det .trk{left:calc(var(--v) + 4px);right:0;transition:left .4s cubic-bezier(.2,0,0,1)}
89
+ .det .stop{right:0;width:4px;background:var(--ind)}
90
+ .indet{overflow:hidden}
91
+ .indet .trk{left:0;right:0}
92
+ .indet .stop{display:none}
93
+ .bar>.a{top:0;height:10px;overflow:hidden;border-radius:0}
94
+ .det .a1{left:0;width:var(--v);transition:width .4s cubic-bezier(.2,0,0,1)}
95
+ .det .a2,.det .a1.zero{display:none}
96
+ .indet .a1{animation:s1 1.75s linear infinite}
97
+ .indet .a2{animation:s2 1.75s linear infinite}
98
+ @keyframes s1{0%{left:0;right:100%}20%{left:0}57%{left:100%;right:-4%}100%{left:100%;right:-4%}}
99
+ @keyframes s2{0%,37%{left:-4%;right:100%}49%{left:0}86%{left:100%;right:-4%}100%{left:100%;right:-4%}}
100
+ .indet .a{box-shadow:0 0 0 4px var(--bg);background:var(--bg);border-radius:2px}
101
+ .a>b{position:absolute;inset:3px 0;border-radius:2px;background:var(--ind)}
102
+ .wave{position:absolute;left:0;top:.5px;display:none;animation:scroll 1s linear infinite}
103
+ .wave path{fill:none;stroke:var(--ind);stroke-width:4;stroke-linecap:round}
104
+ @keyframes scroll{to{transform:translateX(-${c}px)}}
105
+ .i-wavy .wave{display:block}
106
+ .i-wavy .a>b{display:none}
107
+ .det.filling .a1,.det.filling .trk{transition-duration:var(--fill);transition-timing-function:cubic-bezier(.3,0,.4,1)}
108
+
109
+ /* classic */
110
+ .p-classic{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}
111
+ .p-classic .card{grid-template:"." 1fr "logo" auto "title" auto "." 1fr "bar" auto "status" auto "footer" auto/100%;justify-items:center;padding:32px 40px 24px}
112
+ .p-classic h1{margin-top:20px;font-size:22px;line-height:28px}
113
+ .p-classic .status{margin-top:12px;text-align:center}
114
+ .p-classic .footer{margin-top:6px}
115
+
116
+ /* banner */
117
+ .p-banner{--bg:var(--primaryContainer);--fg:var(--onPrimaryContainer);--muted:var(--onPrimaryContainer);--ind:var(--primary);--track:color-mix(in srgb,var(--onPrimaryContainer) 16%,transparent);--chip:var(--primary);--onChip:var(--onPrimary)}
118
+ .p-banner .card{grid-template:"footer footer" auto ". ." 1fr "logo title" auto "logo status" auto ". ." 1fr "bar bar" auto/auto 1fr;column-gap:24px;padding:20px 32px 0}
119
+ .p-banner .logo{align-self:center}
120
+ .p-banner h1{align-self:end;font-size:32px;line-height:40px}
121
+ .p-banner .status{opacity:.8}
122
+ .p-banner .footer{justify-self:end;color:var(--fg);opacity:.7}
123
+ .p-banner .bar{margin:24px 0 26px}
124
+
125
+ /* minimal */
126
+ .p-minimal{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}
127
+ .p-minimal .card{grid-template:"." 1fr "logo" auto "bar" auto "." 1fr/100%;justify-items:center;row-gap:28px;padding:24px}
128
+ .p-minimal .bar{width:min(120px,60%)}
129
+ .p-minimal h1,.p-minimal .status,.p-minimal .footer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
130
+
131
+ /* immersive */
132
+ .p-immersive{--bg:var(--primary);--fg:var(--onPrimary);--muted:var(--onPrimary);--ind:var(--onPrimary);--track:color-mix(in srgb,var(--onPrimary) 28%,transparent);--chip:var(--onPrimary);--onChip:var(--primary)}
133
+ .p-immersive .card{grid-template:"." 1.2fr "logo" auto "title" auto "status" auto "." 1fr "bar" auto "footer" auto/100%;justify-items:center;padding:32px 48px 28px}
134
+ .p-immersive h1{margin-top:24px;font-size:28px;line-height:36px;font-weight:500}
135
+ .p-immersive .status{margin-top:8px;opacity:.85;text-align:center}
136
+ .p-immersive .footer{margin-top:14px;opacity:.75}
137
+ .p-immersive .logo:not(.initial){filter:drop-shadow(0 2px 6px rgb(0 0 0 / .2))}
138
+
139
+ @media (prefers-reduced-motion:reduce){.card,.card.out{animation-duration:.01s}.wave{animation:none}.indet .a1{animation-duration:4s}.indet .a2{display:none}}
140
+ </style>
141
+ </head>
142
+ <body class="p-{{preset}} i-{{indicator}}">
143
+ <div class="card" role="progressbar" aria-label="{{title}}"{{ariaNow}} aria-valuemin="0" aria-valuemax="100">
144
+ {{logo}}
145
+ <h1>{{title}}</h1>
146
+ <div class="bar {{mode}}" style="--v:{{v}}%">
147
+ <i class="trk"></i><i class="a a1{{zero}}"><b></b>${d}</i><i class="a a2"><b></b>${d}</i><i class="stop"></i>
148
+ </div>
149
+ <p class="status">{{status}}</p>
150
+ {{footer}}
151
+ </div>
152
+ <script>
153
+ (() => {
154
+ const card = document.querySelector('.card'), bar = document.querySelector('.bar'), a1 = bar.querySelector('.a1'), status = document.querySelector('.status')
155
+ let filling, ampFrame, amp = ${l}
156
+ // The wave flattens at 100% and comes back below it, as Compose's does: its amplitude eases (the first curve sets it,
157
+ // the T's after it mirror that one)
158
+ const waves = bar.querySelectorAll('.wave path'), rest = waves[0].getAttribute('d').slice(waves[0].getAttribute('d').indexOf('T'))
159
+ const drawWave = () => {
160
+ const d = 'M0,${u}Q${c / 4},' + (${u} - 2 * amp).toFixed(2) + ' ${c / 2},${u}' + rest
161
+ waves.forEach((w) => w.setAttribute('d', d))
162
+ }
163
+ const toAmp = (target) => {
164
+ cancelAnimationFrame(ampFrame)
165
+ if (amp === target) return
166
+ const from = amp, start = performance.now(), ms = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 500
167
+ const step = (now) => {
168
+ const k = ms ? Math.min(1, (now - start) / ms) : 1
169
+ amp = from + (target - from) * (1 - Math.pow(1 - k, 3))
170
+ drawWave()
171
+ if (k < 1) ampFrame = requestAnimationFrame(step)
172
+ }
173
+ ampFrame = requestAnimationFrame(step)
174
+ }
175
+ if (bar.classList.contains('full')) { amp = 0; drawWave() }
176
+ window.m3splash = {
177
+ set(o) {
178
+ if ('progress' in o) {
179
+ clearTimeout(filling)
180
+ const v = o.progress == null ? null : Math.min(1, Math.max(0, Number(o.progress) || 0))
181
+ bar.className = 'bar ' + (v == null ? 'indet' : 'det') + (v === 1 ? ' full' : '')
182
+ bar.style.setProperty('--v', (v == null ? 0 : Math.round(v * 1000) / 10) + '%')
183
+ a1.classList.toggle('zero', v === 0)
184
+ toAmp(v === 1 ? 0 : ${l})
185
+ if (v == null) card.removeAttribute('aria-valuenow'); else card.setAttribute('aria-valuenow', String(Math.round(v * 100)))
186
+ }
187
+ if (typeof o.status === 'string') status.textContent = o.status
188
+ },
189
+ /** The bar fills by itself over \`ms\` */
190
+ fill(ms) {
191
+ ms = Math.max(0, Number(ms) || 0)
192
+ clearTimeout(filling)
193
+ // From an empty bar that's already laid out (a segment that only now appears has nothing to transition from)
194
+ bar.className = 'bar det'
195
+ a1.classList.remove('zero')
196
+ toAmp(${l})
197
+ bar.style.setProperty('--v', '0%')
198
+ void bar.offsetWidth
199
+ bar.style.setProperty('--fill', ms + 'ms')
200
+ bar.classList.add('filling')
201
+ bar.style.setProperty('--v', '100%')
202
+ card.setAttribute('aria-valuenow', '100')
203
+ filling = setTimeout(() => { bar.className = 'bar det full'; toAmp(0) }, ms)
204
+ },
205
+ exit() {
206
+ card.classList.add('out')
207
+ return new Promise((r) => setTimeout(r, matchMedia('(prefers-reduced-motion: reduce)').matches ? 20 : 210))
208
+ },
209
+ }
210
+ if ({{fill}} > 0) requestAnimationFrame(() => window.m3splash.fill({{fill}}))
211
+ })()
212
+ <\/script>
213
+ </body>
214
+ </html>`;
215
+ function p(r) {
216
+ let i = r.colors, a = r.progress == null ? null : Math.min(1, Math.max(0, r.progress)), c = s((r.title.trim()[0] ?? "").toUpperCase()), l = Math.max(16, Math.round(r.logoSize)), u = n.includes(r.preset) ? r.preset : "classic";
217
+ return {
218
+ vars: Object.keys(t).map((t) => `--${t}:${o(i[t]) ? i[t] : e.light[t]}`).join(";"),
219
+ logoSize: String(l),
220
+ title: s(r.title),
221
+ background: r.rounded ? "transparent" : "var(--bg)",
222
+ font: r.fontFamily.replace(/[<>{};]/g, ""),
223
+ radius: r.rounded ? "28px" : "0",
224
+ ariaNow: a == null ? "" : ` aria-valuenow="${Math.round(a * 100)}"`,
225
+ logo: r.logo ? `<img class="logo" src="${s(r.logo)}" alt="" width="${l}" height="${l}">` : `<div class="logo initial" aria-hidden="true">${c}</div>`,
226
+ mode: (a == null ? "indet" : "det") + (a === 1 ? " full" : ""),
227
+ v: String(Math.round((a ?? 0) * 1e3) / 10),
228
+ zero: a === 0 ? " zero" : "",
229
+ status: s(r.status),
230
+ footer: r.footer ? `<p class="footer">${s(r.footer)}</p>` : "",
231
+ preset: u,
232
+ indicator: r.indicator === "linear" ? "linear" : "wavy",
233
+ fill: String(Math.max(0, Math.round(Number(r.fill) || 0)))
234
+ };
235
+ }
236
+ function m(e) {
237
+ let t = p(e);
238
+ return f.replace(/\{\{(\w+)\}\}/g, (e, n) => t[n] ?? "");
239
+ }
240
+ export { e as SPLASH_BASELINE, i as SPLASH_LOGO_SIZES, n as SPLASH_PRESETS, r as SPLASH_SIZES, f as SPLASH_TEMPLATE, t as SPLASH_TOKENS, o as isSafeColor, m as splashHtml, p as splashSlots };
241
+
242
+ //# sourceMappingURL=splash-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splash-html.js","names":["SPLASH_BASELINE","SPLASH_TOKENS","SPLASH_PRESETS","SPLASH_SIZES","SPLASH_LOGO_SIZES","SAFE_COLOR","isSafeColor","c","esc","s","WAVE_LEN","WAVE_AMP","WAVE_MID","WAVE","_","i","SPLASH_TEMPLATE","splashSlots","p","value","initial","size","preset","k","splashHtml","slots"],"sources":["../src/splashHtml.ts"],"sourcesContent":["/**\n * The bootsplash's page: one self-contained HTML document (styles, script and logo inline), so the splash window shows\n * at once, before the app's own bundle has even been read. Pure: no Electron here, the same page serves any shell (the\n * Tauri plugin fills the same template, `SPLASH_TEMPLATE`, from Rust).\n *\n * The page exposes `window.m3splash`: `set({ progress, status })` updates it, `exit()` plays its fade-out (resolves\n * when done). M3 has no launch window for desktop: the presets are built from M3 parts (surface and primary roles,\n * extra-large corners, the type scale, the linear and wavy progress indicators with their gap and stop dot).\n */\n\n/** The theme colors the splash is painted with: any CSS color, as the M3 tokens of the same names */\nexport interface M3SplashColors {\n /** The window's background in `classic` and `minimal` (`--color-surface-container-low`) */\n surface: string\n /** Text on it (`--color-on-surface`) */\n onSurface: string\n /** The status line (`--color-on-surface-variant`) */\n onSurfaceVariant: string\n /** The progress indicator, the stop dot; `immersive`'s background (`--color-primary`) */\n primary: string\n /** Text and the indicator on `immersive` (`--color-on-primary`) */\n onPrimary: string\n /** The progress track (`--color-secondary-container`) */\n secondaryContainer: string\n /** `banner`'s background, the initial's circle (`--color-primary-container`, `--color-on-primary-container`) */\n primaryContainer: string\n onPrimaryContainer: string\n}\n\n/** The M3 baseline (purple) scheme, as theme.css defines it */\nexport const SPLASH_BASELINE: Record<'light' | 'dark', M3SplashColors> = {\n light: {\n surface: '#f7f2fa',\n onSurface: '#1d1b20',\n onSurfaceVariant: '#49454f',\n primary: '#6750a4',\n onPrimary: '#ffffff',\n secondaryContainer: '#e8def8',\n primaryContainer: '#eaddff',\n onPrimaryContainer: '#4f378b',\n },\n dark: {\n surface: '#1d1b20',\n onSurface: '#e6e0e9',\n onSurfaceVariant: '#cac4d0',\n primary: '#d0bcff',\n onPrimary: '#381e72',\n secondaryContainer: '#4a4458',\n primaryContainer: '#4f378b',\n onPrimaryContainer: '#eaddff',\n },\n}\n\n/** The M3 tokens each splash color is read from (the renderer remembers them for the next launch) */\nexport const SPLASH_TOKENS: Record<keyof M3SplashColors, string> = {\n surface: '--color-surface-container-low',\n onSurface: '--color-on-surface',\n onSurfaceVariant: '--color-on-surface-variant',\n primary: '--color-primary',\n onPrimary: '--color-on-primary',\n secondaryContainer: '--color-secondary-container',\n primaryContainer: '--color-primary-container',\n onPrimaryContainer: '--color-on-primary-container',\n}\n\n/**\n * The layouts:\n * - `classic`: logo, name and the bar under them on the surface, status and footer below (300 × 340)\n * - `banner`: landscape on the primary container: logo beside a large name and the status, the bar along the bottom (520 × 280)\n * - `minimal`: just the logo and a short bar under it (240 × 240; the name stays as the accessible label)\n * - `immersive`: the whole window in the primary color, everything on it in on-primary (360 × 420)\n */\nexport type M3SplashPreset = 'classic' | 'banner' | 'minimal' | 'immersive'\n/** `wavy`: M3 Expressive's wavy linear indicator; `linear`: the flat one */\nexport type M3SplashIndicator = 'wavy' | 'linear'\n\nexport const SPLASH_PRESETS: M3SplashPreset[] = ['classic', 'banner', 'minimal', 'immersive']\n/** Each preset's window size */\nexport const SPLASH_SIZES: Record<M3SplashPreset, { width: number; height: number }> = {\n classic: { width: 300, height: 340 },\n banner: { width: 520, height: 280 },\n minimal: { width: 240, height: 240 },\n immersive: { width: 360, height: 420 },\n}\n/** Each preset's logo size */\nexport const SPLASH_LOGO_SIZES: Record<M3SplashPreset, number> = { classic: 96, banner: 72, minimal: 112, immersive: 112 }\n\nexport interface SplashPage {\n title: string\n /** Image URL (a data: URL in practice: the page loads nothing else) */\n logo?: string\n /** The logo's size in px */\n logoSize: number\n status: string\n /** 0–1, or null for an indeterminate bar */\n progress: number | null\n colors: M3SplashColors\n fontFamily: string\n /** Rounded window corners (the window is transparent around them) */\n rounded: boolean\n /** A line under everything (a version) */\n footer: string\n preset?: M3SplashPreset\n indicator?: M3SplashIndicator\n /** ms: the bar fills by itself over this long, from the moment the page shows (a later `set({ progress })` takes over) */\n fill?: number\n}\n\n// A color goes into a style attribute: only what a CSS color can contain\nconst SAFE_COLOR = /^[#\\w\\s(),.%/+-]{1,80}$/\nexport const isSafeColor = (c: unknown): c is string => typeof c === 'string' && SAFE_COLOR.test(c) && !/url|expression|;|[<>\"'{}]/i.test(c)\n\nconst esc = (s: string) => s.replace(/[&<>\"']/g, (c) => `&#${c.charCodeAt(0)};`)\n\n// The wave (MProgressBar's geometry: 20px wavelength, 2.5px amplitude, 4px thick): one long path scrolled a wavelength\n// per second, as Compose's wavy indicator moves. Quadratic halves (`T`) are close enough to a sine at this size\nconst WAVE_LEN = 20\nconst WAVE_AMP = 2.5\nconst WAVE_MID = 4.5\nconst WAVE_PATH = `M0,${WAVE_MID}Q${WAVE_LEN / 4},${WAVE_MID - 2 * WAVE_AMP} ${WAVE_LEN / 2},${WAVE_MID}` +\n Array.from({ length: 90 }, (_, i) => `T${WAVE_LEN / 2 * (i + 2)},${WAVE_MID}`).join('')\nconst WAVE = `<svg class=\"wave\" width=\"1840\" height=\"9\" viewBox=\"0 0 1840 9\" aria-hidden=\"true\"><path d=\"${WAVE_PATH}\"/></svg>`\n\n/**\n * The page with `{{slot}}`s for what changes (see `splashSlots`): the same template, filled the same way, serves the\n * Tauri plugin's splash (Rust `include_str!`s a copy, a test keeps it equal)\n */\nexport const SPLASH_TEMPLATE = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>{{title}}</title>\n<style>\n:root{{{vars}};--logo:{{logoSize}}px;--radius:{{radius}};--outer:{{background}}}\n*{box-sizing:border-box;margin:0}\nhtml,body{height:100%;overflow:hidden;background:var(--outer);-webkit-user-select:none;user-select:none;cursor:default}\nbody{font-family:{{font}};-webkit-font-smoothing:antialiased}\n.card{position:absolute;inset:0;display:grid;overflow:hidden;border-radius:var(--radius);-webkit-app-region:drag;\n background:var(--bg);color:var(--fg);opacity:0;transform:scale(.96);animation:in .35s cubic-bezier(.05,.7,.1,1) forwards}\n.card.out{animation:out .2s cubic-bezier(.3,0,.8,.15) forwards}\n@keyframes in{to{opacity:1;transform:none}}\n@keyframes out{from{opacity:1;transform:none}to{opacity:0;transform:scale(1.04)}}\n.logo{grid-area:logo;width:var(--logo);height:var(--logo);object-fit:contain}\n.initial{display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--chip);color:var(--onChip);\n font-size:calc(var(--logo) * .45);font-weight:500;line-height:1}\nh1{grid-area:title;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.status{grid-area:status;min-height:20px;font-size:14px;line-height:20px;letter-spacing:.25px;color:var(--muted);max-width:100%;\n overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.footer{grid-area:footer;font-size:11px;line-height:16px;letter-spacing:.5px;color:var(--muted);opacity:.85}\n.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}\n\n/* The bar: a flat track, the active indicator (a line, or a scrolling wave), a 4px gap between them and, determinate,\n a 4px stop dot at the end. Indeterminate: two segments run along it (Compose's keyframes, roughly) */\n.bar{grid-area:bar;position:relative;width:100%;height:10px}\n.bar>i{position:absolute;top:3px;height:4px;border-radius:2px}\n.trk{background:var(--track)}\n.det .trk{left:calc(var(--v) + 4px);right:0;transition:left .4s cubic-bezier(.2,0,0,1)}\n.det .stop{right:0;width:4px;background:var(--ind)}\n.indet{overflow:hidden}\n.indet .trk{left:0;right:0}\n.indet .stop{display:none}\n.bar>.a{top:0;height:10px;overflow:hidden;border-radius:0}\n.det .a1{left:0;width:var(--v);transition:width .4s cubic-bezier(.2,0,0,1)}\n.det .a2,.det .a1.zero{display:none}\n.indet .a1{animation:s1 1.75s linear infinite}\n.indet .a2{animation:s2 1.75s linear infinite}\n@keyframes s1{0%{left:0;right:100%}20%{left:0}57%{left:100%;right:-4%}100%{left:100%;right:-4%}}\n@keyframes s2{0%,37%{left:-4%;right:100%}49%{left:0}86%{left:100%;right:-4%}100%{left:100%;right:-4%}}\n.indet .a{box-shadow:0 0 0 4px var(--bg);background:var(--bg);border-radius:2px}\n.a>b{position:absolute;inset:3px 0;border-radius:2px;background:var(--ind)}\n.wave{position:absolute;left:0;top:.5px;display:none;animation:scroll 1s linear infinite}\n.wave path{fill:none;stroke:var(--ind);stroke-width:4;stroke-linecap:round}\n@keyframes scroll{to{transform:translateX(-${WAVE_LEN}px)}}\n.i-wavy .wave{display:block}\n.i-wavy .a>b{display:none}\n.det.filling .a1,.det.filling .trk{transition-duration:var(--fill);transition-timing-function:cubic-bezier(.3,0,.4,1)}\n\n/* classic */\n.p-classic{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}\n.p-classic .card{grid-template:\".\" 1fr \"logo\" auto \"title\" auto \".\" 1fr \"bar\" auto \"status\" auto \"footer\" auto/100%;justify-items:center;padding:32px 40px 24px}\n.p-classic h1{margin-top:20px;font-size:22px;line-height:28px}\n.p-classic .status{margin-top:12px;text-align:center}\n.p-classic .footer{margin-top:6px}\n\n/* banner */\n.p-banner{--bg:var(--primaryContainer);--fg:var(--onPrimaryContainer);--muted:var(--onPrimaryContainer);--ind:var(--primary);--track:color-mix(in srgb,var(--onPrimaryContainer) 16%,transparent);--chip:var(--primary);--onChip:var(--onPrimary)}\n.p-banner .card{grid-template:\"footer footer\" auto \". .\" 1fr \"logo title\" auto \"logo status\" auto \". .\" 1fr \"bar bar\" auto/auto 1fr;column-gap:24px;padding:20px 32px 0}\n.p-banner .logo{align-self:center}\n.p-banner h1{align-self:end;font-size:32px;line-height:40px}\n.p-banner .status{opacity:.8}\n.p-banner .footer{justify-self:end;color:var(--fg);opacity:.7}\n.p-banner .bar{margin:24px 0 26px}\n\n/* minimal */\n.p-minimal{--bg:var(--surface);--fg:var(--onSurface);--muted:var(--onSurfaceVariant);--ind:var(--primary);--track:var(--secondaryContainer);--chip:var(--primaryContainer);--onChip:var(--onPrimaryContainer)}\n.p-minimal .card{grid-template:\".\" 1fr \"logo\" auto \"bar\" auto \".\" 1fr/100%;justify-items:center;row-gap:28px;padding:24px}\n.p-minimal .bar{width:min(120px,60%)}\n.p-minimal h1,.p-minimal .status,.p-minimal .footer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}\n\n/* immersive */\n.p-immersive{--bg:var(--primary);--fg:var(--onPrimary);--muted:var(--onPrimary);--ind:var(--onPrimary);--track:color-mix(in srgb,var(--onPrimary) 28%,transparent);--chip:var(--onPrimary);--onChip:var(--primary)}\n.p-immersive .card{grid-template:\".\" 1.2fr \"logo\" auto \"title\" auto \"status\" auto \".\" 1fr \"bar\" auto \"footer\" auto/100%;justify-items:center;padding:32px 48px 28px}\n.p-immersive h1{margin-top:24px;font-size:28px;line-height:36px;font-weight:500}\n.p-immersive .status{margin-top:8px;opacity:.85;text-align:center}\n.p-immersive .footer{margin-top:14px;opacity:.75}\n.p-immersive .logo:not(.initial){filter:drop-shadow(0 2px 6px rgb(0 0 0 / .2))}\n\n@media (prefers-reduced-motion:reduce){.card,.card.out{animation-duration:.01s}.wave{animation:none}.indet .a1{animation-duration:4s}.indet .a2{display:none}}\n</style>\n</head>\n<body class=\"p-{{preset}} i-{{indicator}}\">\n<div class=\"card\" role=\"progressbar\" aria-label=\"{{title}}\"{{ariaNow}} aria-valuemin=\"0\" aria-valuemax=\"100\">\n {{logo}}\n <h1>{{title}}</h1>\n <div class=\"bar {{mode}}\" style=\"--v:{{v}}%\">\n <i class=\"trk\"></i><i class=\"a a1{{zero}}\"><b></b>${WAVE}</i><i class=\"a a2\"><b></b>${WAVE}</i><i class=\"stop\"></i>\n </div>\n <p class=\"status\">{{status}}</p>\n {{footer}}\n</div>\n<script>\n(() => {\n const card = document.querySelector('.card'), bar = document.querySelector('.bar'), a1 = bar.querySelector('.a1'), status = document.querySelector('.status')\n let filling, ampFrame, amp = ${WAVE_AMP}\n // The wave flattens at 100% and comes back below it, as Compose's does: its amplitude eases (the first curve sets it,\n // the T's after it mirror that one)\n const waves = bar.querySelectorAll('.wave path'), rest = waves[0].getAttribute('d').slice(waves[0].getAttribute('d').indexOf('T'))\n const drawWave = () => {\n const d = 'M0,${WAVE_MID}Q${WAVE_LEN / 4},' + (${WAVE_MID} - 2 * amp).toFixed(2) + ' ${WAVE_LEN / 2},${WAVE_MID}' + rest\n waves.forEach((w) => w.setAttribute('d', d))\n }\n const toAmp = (target) => {\n cancelAnimationFrame(ampFrame)\n if (amp === target) return\n const from = amp, start = performance.now(), ms = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 500\n const step = (now) => {\n const k = ms ? Math.min(1, (now - start) / ms) : 1\n amp = from + (target - from) * (1 - Math.pow(1 - k, 3))\n drawWave()\n if (k < 1) ampFrame = requestAnimationFrame(step)\n }\n ampFrame = requestAnimationFrame(step)\n }\n if (bar.classList.contains('full')) { amp = 0; drawWave() }\n window.m3splash = {\n set(o) {\n if ('progress' in o) {\n clearTimeout(filling)\n const v = o.progress == null ? null : Math.min(1, Math.max(0, Number(o.progress) || 0))\n bar.className = 'bar ' + (v == null ? 'indet' : 'det') + (v === 1 ? ' full' : '')\n bar.style.setProperty('--v', (v == null ? 0 : Math.round(v * 1000) / 10) + '%')\n a1.classList.toggle('zero', v === 0)\n toAmp(v === 1 ? 0 : ${WAVE_AMP})\n if (v == null) card.removeAttribute('aria-valuenow'); else card.setAttribute('aria-valuenow', String(Math.round(v * 100)))\n }\n if (typeof o.status === 'string') status.textContent = o.status\n },\n /** The bar fills by itself over \\`ms\\` */\n fill(ms) {\n ms = Math.max(0, Number(ms) || 0)\n clearTimeout(filling)\n // From an empty bar that's already laid out (a segment that only now appears has nothing to transition from)\n bar.className = 'bar det'\n a1.classList.remove('zero')\n toAmp(${WAVE_AMP})\n bar.style.setProperty('--v', '0%')\n void bar.offsetWidth\n bar.style.setProperty('--fill', ms + 'ms')\n bar.classList.add('filling')\n bar.style.setProperty('--v', '100%')\n card.setAttribute('aria-valuenow', '100')\n filling = setTimeout(() => { bar.className = 'bar det full'; toAmp(0) }, ms)\n },\n exit() {\n card.classList.add('out')\n return new Promise((r) => setTimeout(r, matchMedia('(prefers-reduced-motion: reduce)').matches ? 20 : 210))\n },\n }\n if ({{fill}} > 0) requestAnimationFrame(() => window.m3splash.fill({{fill}}))\n})()\n</script>\n</body>\n</html>`\n\n/** The template's slots for a page, HTML-escaped where they're text */\nexport function splashSlots(p: SplashPage): Record<string, string> {\n const c = p.colors\n const value = p.progress == null ? null : Math.min(1, Math.max(0, p.progress))\n const initial = esc((p.title.trim()[0] ?? '').toUpperCase())\n const size = Math.max(16, Math.round(p.logoSize))\n const preset = SPLASH_PRESETS.includes(p.preset as M3SplashPreset) ? p.preset! : 'classic'\n return {\n vars: (Object.keys(SPLASH_TOKENS) as (keyof M3SplashColors)[])\n .map((k) => `--${k}:${isSafeColor(c[k]) ? c[k] : SPLASH_BASELINE.light[k]}`)\n .join(';'),\n logoSize: String(size),\n title: esc(p.title),\n background: p.rounded ? 'transparent' : 'var(--bg)',\n font: p.fontFamily.replace(/[<>{};]/g, ''),\n radius: p.rounded ? '28px' : '0',\n ariaNow: value == null ? '' : ` aria-valuenow=\"${Math.round(value * 100)}\"`,\n logo: p.logo\n ? `<img class=\"logo\" src=\"${esc(p.logo)}\" alt=\"\" width=\"${size}\" height=\"${size}\">`\n : `<div class=\"logo initial\" aria-hidden=\"true\">${initial}</div>`,\n mode: (value == null ? 'indet' : 'det') + (value === 1 ? ' full' : ''),\n v: String(Math.round((value ?? 0) * 1000) / 10),\n zero: value === 0 ? ' zero' : '',\n status: esc(p.status),\n footer: p.footer ? `<p class=\"footer\">${esc(p.footer)}</p>` : '',\n preset,\n indicator: p.indicator === 'linear' ? 'linear' : 'wavy',\n fill: String(Math.max(0, Math.round(Number(p.fill) || 0))),\n }\n}\n\nexport function splashHtml(p: SplashPage): string {\n const slots = splashSlots(p)\n return SPLASH_TEMPLATE.replace(/\\{\\{(\\w+)\\}\\}/g, (_, k: string) => slots[k] ?? '')\n}\n"],"mappings":"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"}
@@ -0,0 +1,86 @@
1
+ import { BrowserWindow } from 'electron';
2
+ import { type M3SplashColors, type M3SplashIndicator, type M3SplashPreset } from './splashHtml';
3
+ export type { M3SplashColors, M3SplashIndicator, M3SplashPreset } from './splashHtml';
4
+ export interface M3SplashOptions {
5
+ /**
6
+ * The layout: `'classic'` (default: logo, name, bar, status on the surface), `'banner'` (landscape on the primary
7
+ * container, logo beside a large name), `'minimal'` (the logo and a short bar) or `'immersive'` (the whole window in
8
+ * the primary color). Each has its own window and logo size; `width`, `height` and `logoSize` change them
9
+ */
10
+ preset?: M3SplashPreset;
11
+ /** `'wavy'` (default: M3 Expressive's wavy indicator) or `'linear'` (the flat one) */
12
+ indicator?: M3SplashIndicator;
13
+ /** The app's name (under the logo; the accessible label in `minimal`) */
14
+ title?: string;
15
+ /**
16
+ * The logo: a file path (png, svg, jpg, webp, ico), a data: URL, or an http(s) URL. Without one, the title's
17
+ * initial in a circle
18
+ */
19
+ logo?: string;
20
+ /** The logo's size in px. Default per preset (96 classic, 72 banner, 112 minimal and immersive) */
21
+ logoSize?: number;
22
+ /** The first status line. Default empty */
23
+ status?: string;
24
+ /** The first progress, 0–1, or null (default) for an indeterminate bar */
25
+ progress?: number | null;
26
+ /** A line under everything, e.g. the version: `` `v${app.getVersion()}` `` */
27
+ footer?: string;
28
+ /** Light or dark: default `'system'` (`nativeTheme.shouldUseDarkColors`) */
29
+ theme?: 'light' | 'dark' | 'system';
30
+ /**
31
+ * The colors for the first launch, per scheme or for both. Default the M3 baseline (purple). Later launches use the
32
+ * user's own theme and palette, which the renderer remembers (see `remember`)
33
+ */
34
+ colors?: Partial<M3SplashColors> | {
35
+ light?: Partial<M3SplashColors>;
36
+ dark?: Partial<M3SplashColors>;
37
+ };
38
+ /**
39
+ * Paint later launches with the theme and palette the app last showed (MTitleBar, or `useElectronWindow()
40
+ * .rememberSplashColors()`, keep them in the userData folder). Default true
41
+ */
42
+ remember?: boolean;
43
+ /** Window size. Default per preset: classic 300 × 340, banner 520 × 280, minimal 240 × 240, immersive 360 × 420 */
44
+ width?: number;
45
+ height?: number;
46
+ /**
47
+ * Rounded corners on a transparent window. Default true on Windows and macOS; false on Linux, where a window manager
48
+ * without a compositor paints the transparent corners black
49
+ */
50
+ rounded?: boolean;
51
+ /** Default `system-ui, sans-serif`: the app's fonts aren't loaded in the splash */
52
+ fontFamily?: string;
53
+ /** Stays at least this long (ms) once shown, so a fast start doesn't flash it. Default 700 */
54
+ minDuration?: number;
55
+ /**
56
+ * 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
57
+ * takes longer. Leave it out to go as soon as the app is ready, driving the bar with `progress()` (or leaving it
58
+ * indeterminate)
59
+ */
60
+ duration?: number;
61
+ }
62
+ export interface M3Splash {
63
+ /** The splash's BrowserWindow */
64
+ window: BrowserWindow;
65
+ /** Sets the bar (0–1; null for indeterminate) and, if given, the status line */
66
+ progress(value: number | null, status?: string): void;
67
+ /** Sets the status line */
68
+ status(text: string): void;
69
+ /**
70
+ * Shows `win` once it's ready, then fades the splash out and closes it. Ready is its `ready-to-show` by default;
71
+ * with `{ waitForRenderer: true }`, when the page calls `useElectronWindow().splashDone()` (after its first data
72
+ * loads, say). `timeout` (ms, default 20000) shows it anyway if that never comes. Resolves once the splash is gone
73
+ */
74
+ handoff(win: BrowserWindow, options?: {
75
+ waitForRenderer?: boolean;
76
+ timeout?: number;
77
+ }): Promise<void>;
78
+ /** Fades the splash out and closes it, without showing any window */
79
+ close(): Promise<void>;
80
+ }
81
+ /** Keeps the colors the page showed, per scheme, for the next launch's splash */
82
+ export declare function rememberSplashColors(scheme: 'light' | 'dark', colors: Partial<M3SplashColors>): void;
83
+ /** Registers the renderer's splash messages (remembering its colors) without opening a splash: `setupM3Window` calls it */
84
+ export declare function registerSplashIpc(): void;
85
+ /** Opens the bootsplash now. Call it as soon as the app is ready (`app.whenReady()`), before creating the main window */
86
+ export declare function createSplash(options?: M3SplashOptions): M3Splash;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * The bootsplash's page: one self-contained HTML document (styles, script and logo inline), so the splash window shows
3
+ * at once, before the app's own bundle has even been read. Pure: no Electron here, the same page serves any shell (the
4
+ * Tauri plugin fills the same template, `SPLASH_TEMPLATE`, from Rust).
5
+ *
6
+ * The page exposes `window.m3splash`: `set({ progress, status })` updates it, `exit()` plays its fade-out (resolves
7
+ * when done). M3 has no launch window for desktop: the presets are built from M3 parts (surface and primary roles,
8
+ * extra-large corners, the type scale, the linear and wavy progress indicators with their gap and stop dot).
9
+ */
10
+ /** The theme colors the splash is painted with: any CSS color, as the M3 tokens of the same names */
11
+ export interface M3SplashColors {
12
+ /** The window's background in `classic` and `minimal` (`--color-surface-container-low`) */
13
+ surface: string;
14
+ /** Text on it (`--color-on-surface`) */
15
+ onSurface: string;
16
+ /** The status line (`--color-on-surface-variant`) */
17
+ onSurfaceVariant: string;
18
+ /** The progress indicator, the stop dot; `immersive`'s background (`--color-primary`) */
19
+ primary: string;
20
+ /** Text and the indicator on `immersive` (`--color-on-primary`) */
21
+ onPrimary: string;
22
+ /** The progress track (`--color-secondary-container`) */
23
+ secondaryContainer: string;
24
+ /** `banner`'s background, the initial's circle (`--color-primary-container`, `--color-on-primary-container`) */
25
+ primaryContainer: string;
26
+ onPrimaryContainer: string;
27
+ }
28
+ /** The M3 baseline (purple) scheme, as theme.css defines it */
29
+ export declare const SPLASH_BASELINE: Record<'light' | 'dark', M3SplashColors>;
30
+ /** The M3 tokens each splash color is read from (the renderer remembers them for the next launch) */
31
+ export declare const SPLASH_TOKENS: Record<keyof M3SplashColors, string>;
32
+ /**
33
+ * The layouts:
34
+ * - `classic`: logo, name and the bar under them on the surface, status and footer below (300 × 340)
35
+ * - `banner`: landscape on the primary container: logo beside a large name and the status, the bar along the bottom (520 × 280)
36
+ * - `minimal`: just the logo and a short bar under it (240 × 240; the name stays as the accessible label)
37
+ * - `immersive`: the whole window in the primary color, everything on it in on-primary (360 × 420)
38
+ */
39
+ export type M3SplashPreset = 'classic' | 'banner' | 'minimal' | 'immersive';
40
+ /** `wavy`: M3 Expressive's wavy linear indicator; `linear`: the flat one */
41
+ export type M3SplashIndicator = 'wavy' | 'linear';
42
+ export declare const SPLASH_PRESETS: M3SplashPreset[];
43
+ /** Each preset's window size */
44
+ export declare const SPLASH_SIZES: Record<M3SplashPreset, {
45
+ width: number;
46
+ height: number;
47
+ }>;
48
+ /** Each preset's logo size */
49
+ export declare const SPLASH_LOGO_SIZES: Record<M3SplashPreset, number>;
50
+ export interface SplashPage {
51
+ title: string;
52
+ /** Image URL (a data: URL in practice: the page loads nothing else) */
53
+ logo?: string;
54
+ /** The logo's size in px */
55
+ logoSize: number;
56
+ status: string;
57
+ /** 0–1, or null for an indeterminate bar */
58
+ progress: number | null;
59
+ colors: M3SplashColors;
60
+ fontFamily: string;
61
+ /** Rounded window corners (the window is transparent around them) */
62
+ rounded: boolean;
63
+ /** A line under everything (a version) */
64
+ footer: string;
65
+ preset?: M3SplashPreset;
66
+ indicator?: M3SplashIndicator;
67
+ /** ms: the bar fills by itself over this long, from the moment the page shows (a later `set({ progress })` takes over) */
68
+ fill?: number;
69
+ }
70
+ export declare const isSafeColor: (c: unknown) => c is string;
71
+ /**
72
+ * The page with `{{slot}}`s for what changes (see `splashSlots`): the same template, filled the same way, serves the
73
+ * Tauri plugin's splash (Rust `include_str!`s a copy, a test keeps it equal)
74
+ */
75
+ export declare const SPLASH_TEMPLATE: string;
76
+ /** The template's slots for a page, HTML-escaped where they're text */
77
+ export declare function splashSlots(p: SplashPage): Record<string, string>;
78
+ export declare function splashHtml(p: SplashPage): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m3ui-vue/electron",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Electron integration for m3ui-vue: a Material Design 3 title bar with native or custom window controls, themed live from the M3 tokens",
5
5
  "keywords": ["electron", "material-design", "material-3", "m3", "vue", "title-bar", "window-controls-overlay", "tailwindcss"],
6
6
  "homepage": "https://m3ui.dev",
@@ -27,6 +27,11 @@
27
27
  "import": "./dist/preload.js",
28
28
  "require": "./dist/preload.cjs"
29
29
  },
30
+ "./splash-html": {
31
+ "types": "./dist/splashHtml.d.ts",
32
+ "import": "./dist/splash-html.js",
33
+ "require": "./dist/splash-html.cjs"
34
+ },
30
35
  "./styles": "./dist/styles.css"
31
36
  },
32
37
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- var e={info:`m3ui:info`,state:`m3ui:state`,action:`m3ui:action`,overlay:`m3ui:overlay`,theme:`m3ui:theme`,progress:`m3ui:progress`,badge:`m3ui:badge`,attention:`m3ui:attention`,accent:`m3ui:accent`},t=`m3ui`;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
2
- //# sourceMappingURL=shared-BLenUWPr.cjs.map