stage-browser 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ function createExtensions(ctx) {
26
26
  const compat = (0, node_path_1.join)(__dirname, '..', 'preload', 'extension-compat.js');
27
27
  ctx.session.registerPreloadScript({ id: 'stage-extension-compat-frame', type: 'frame', filePath: compat });
28
28
  ctx.session.registerPreloadScript({ id: 'stage-extension-compat-sw', type: 'service-worker', filePath: compat });
29
- electron_chrome_extensions_1.ElectronChromeExtensions.handleCRXProtocol(ctx.uiView.webContents.session);
29
+ electron_chrome_extensions_1.ElectronChromeExtensions.handleCRXProtocol(ctx.ui.view.webContents.session);
30
30
  ext.on('browser-action-popup-created', (popup) => {
31
31
  ctx.reveal.setPopupOpen(true);
32
32
  if (!ctx.quitting)
package/dist/main/ipc.js CHANGED
@@ -6,18 +6,12 @@ const contract_1 = require("../shared/contract");
6
6
  const context_menu_1 = require("./context-menu");
7
7
  const suggest_1 = require("./suggest");
8
8
  const url_1 = require("./url");
9
+ const window_1 = require("./window");
9
10
  const BUTTONS = ['left', 'middle', 'right'];
10
- const DRAG_TICK_MS = 8;
11
- const DRAG_MAX_MS = 60_000;
12
- // Wires the UI view's IPC to the main process. Returns a function that stops a window drag.
11
+ // Wires the UI window's IPC to the main process.
13
12
  function setupIpc(ctx) {
14
- const { tabs, reveal, win } = ctx;
15
- const fromUI = (e) => e.sender === ctx.uiView.webContents;
16
- let drag;
17
- const endDrag = () => {
18
- clearInterval(drag);
19
- drag = undefined;
20
- };
13
+ const { tabs, reveal, win, drag } = ctx;
14
+ const fromUI = (e) => e.sender === ctx.ui.view.webContents;
21
15
  const queries = {
22
16
  getState: () => ctx.getState(),
23
17
  suggest: (query) => (0, suggest_1.suggest)(tabs.list, query),
@@ -43,7 +37,8 @@ function setupIpc(ctx) {
43
37
  forward: () => tabs.active?.wc.navigationHistory.goForward(),
44
38
  reload: () => tabs.active?.wc.reload(),
45
39
  setBarHover: (hovering) => reveal.setHover(hovering),
46
- // A click in the transparent band under the floating bar: hide the bar and give it to the page.
40
+ // A click the UI window caught in the transparent band under the floating bar, before it
41
+ // started letting the mouse through there: hide the bar and give the click to the page.
47
42
  passClick: (x, y, button, clickCount) => {
48
43
  const tab = tabs.active;
49
44
  if (!tab || tab.wc.isDestroyed() || !Number.isFinite(x) || !Number.isFinite(y))
@@ -51,29 +46,18 @@ function setupIpc(ctx) {
51
46
  reveal.hideNow();
52
47
  const ev = {
53
48
  x: Math.round(x),
54
- y: Math.round(y - ctx.tabBounds().y),
49
+ y: Math.round(y),
55
50
  button: BUTTONS[button] ?? 'left',
56
51
  clickCount: Math.min(3, Math.max(1, clickCount || 1)),
57
52
  };
53
+ win.focus();
58
54
  tab.wc.focus();
59
55
  tab.wc.sendInputEvent({ type: 'mouseDown', ...ev });
60
56
  tab.wc.sendInputEvent({ type: 'mouseUp', ...ev });
61
57
  },
62
- // Fallback window drag: follow the cursor while the UI holds the mouse down.
63
- startWindowDrag: () => {
64
- if (drag || win.isFullScreen())
65
- return;
66
- const p0 = electron_1.screen.getCursorScreenPoint();
67
- const [x0 = 0, y0 = 0] = win.getPosition();
68
- const started = Date.now();
69
- drag = setInterval(() => {
70
- if (Date.now() - started > DRAG_MAX_MS || win.isDestroyed())
71
- return endDrag();
72
- const p = electron_1.screen.getCursorScreenPoint();
73
- win.setPosition(x0 + p.x - p0.x, y0 + p.y - p0.y);
74
- }, DRAG_TICK_MS);
75
- },
76
- endWindowDrag: endDrag,
58
+ startWindowDrag: () => drag.start(),
59
+ endWindowDrag: () => drag.end(),
60
+ windowAction: (action) => (0, window_1.windowAction)(win, action),
77
61
  };
78
62
  for (const name of Object.keys(queries)) {
79
63
  const fn = queries[name];
@@ -86,5 +70,4 @@ function setupIpc(ctx) {
86
70
  fn(...args);
87
71
  });
88
72
  }
89
- return endDrag;
90
73
  }
package/dist/main/main.js CHANGED
@@ -13,6 +13,7 @@ const reveal_1 = require("./reveal");
13
13
  const selftest_1 = require("./selftest");
14
14
  const store_1 = require("./store");
15
15
  const tabs_1 = require("./tabs");
16
+ const ui_window_1 = require("./ui-window");
16
17
  const url_1 = require("./url");
17
18
  const window_1 = require("./window");
18
19
  const APP_ROOT = (0, node_path_1.resolve)(__dirname, '..', '..');
@@ -60,7 +61,8 @@ if (!SELFTEST && !electron_1.app.requestSingleInstanceLock())
60
61
  class Stage {
61
62
  session;
62
63
  win;
63
- uiView;
64
+ ui;
65
+ drag;
64
66
  tabs;
65
67
  reveal;
66
68
  ext;
@@ -71,26 +73,27 @@ class Stage {
71
73
  popupOpen = false;
72
74
  quitting = false;
73
75
  holdQuit = false;
74
- endDrag;
75
76
  pushTimer;
76
77
  saveTimer;
77
78
  lastSent = '';
78
79
  constructor(session, saved, args) {
79
80
  this.session = session;
80
- const { win, uiView } = (0, window_1.createWindow)(saved.bounds, args.size);
81
+ const win = (0, window_1.createWindow)(saved.bounds, args.size);
81
82
  this.win = win;
82
- this.uiView = uiView;
83
+ this.ui = new ui_window_1.UiWindow(win);
84
+ this.drag = new window_1.WindowDrag(win);
83
85
  this.bar.pinned = !!saved.pinned || args.pin;
84
86
  this.tabs = new tabs_1.Tabs(this);
85
87
  this.reveal = new reveal_1.Reveal(this);
86
88
  this.ext = (0, extensions_1.createExtensions)(this);
87
- this.endDrag = (0, ipc_1.setupIpc)(this);
89
+ (0, ipc_1.setupIpc)(this);
88
90
  this.rebuildMenu();
89
- uiView.webContents.on('did-finish-load', () => {
91
+ const ui = this.ui.view.webContents;
92
+ ui.on('did-finish-load', () => {
90
93
  this.lastSent = '';
91
94
  this.flush();
92
95
  });
93
- uiView.webContents.loadFile((0, node_path_1.join)(__dirname, '..', 'ui', 'index.html')).catch((e) => console.error('[stage] UI load failed', e.message));
96
+ ui.loadFile((0, node_path_1.join)(__dirname, '..', 'ui', 'index.html')).catch((e) => console.error('[stage] UI load failed', e.message));
94
97
  const relayout = () => {
95
98
  if (this.quitting)
96
99
  return;
@@ -112,12 +115,12 @@ class Stage {
112
115
  return !this.quitting && !this.win.isDestroyed();
113
116
  }
114
117
  tabBounds() {
115
- return (0, window_1.tabBounds)(this.win, this.bar.pinned);
118
+ return (0, window_1.tabBounds)(this.win);
116
119
  }
117
120
  layout() {
118
- if (this.win.isDestroyed() || this.uiView.webContents.isDestroyed())
121
+ if (this.win.isDestroyed() || this.ui.win.isDestroyed())
119
122
  return;
120
- this.uiView.setBounds((0, window_1.uiBounds)(this.win, this.bar.pinned, this.overlay !== null));
123
+ this.ui.setBounds((0, window_1.uiBounds)(this.win, this.bar.pinned, this.overlay !== null));
121
124
  this.tabs.layout();
122
125
  }
123
126
  getState() {
@@ -134,7 +137,7 @@ class Stage {
134
137
  flush() {
135
138
  clearTimeout(this.pushTimer);
136
139
  this.pushTimer = undefined;
137
- const wc = this.uiView.webContents;
140
+ const wc = this.ui.view.webContents;
138
141
  if (!this.live || wc.isDestroyed() || wc.isLoading())
139
142
  return;
140
143
  const state = this.getState();
@@ -210,7 +213,7 @@ class Stage {
210
213
  this.quitting = true;
211
214
  clearTimeout(this.pushTimer);
212
215
  clearTimeout(this.saveTimer);
213
- this.endDrag();
216
+ this.drag.end();
214
217
  this.reveal.stop();
215
218
  }
216
219
  }
@@ -47,6 +47,7 @@ class Reveal {
47
47
  const b = ctx.win.getContentBounds();
48
48
  const insideX = pt.x >= b.x && pt.x < b.x + b.width;
49
49
  const dy = pt.y - b.y;
50
+ this.syncPointer(insideX && dy >= 0 && dy < window_1.BAR_HEIGHT);
50
51
  if (insideX && dy >= 0 && dy <= REVEAL_PX) {
51
52
  this.awaySince = null;
52
53
  return this.show();
@@ -63,6 +64,13 @@ class Reveal {
63
64
  else if (Date.now() - this.awaySince >= HIDE_DELAY)
64
65
  this.hide();
65
66
  }
67
+ // The UI window takes the mouse over the strip and lets it through to the page below it. The
68
+ // window can't tell the two apart itself, so this follows the polled cursor; a click that lands
69
+ // in the shadow room before the next tick is passed on by the UI (passClick).
70
+ syncPointer(overStrip) {
71
+ const { ctx } = this;
72
+ ctx.ui.setInteractive(ctx.overlay !== null || ctx.drag.active || overStrip);
73
+ }
66
74
  cancelViewHide() {
67
75
  clearTimeout(this.viewTimer);
68
76
  this.viewTimer = undefined;
@@ -72,13 +80,12 @@ class Reveal {
72
80
  if (!this.live)
73
81
  return;
74
82
  this.cancelViewHide();
75
- if (ctx.bar.visible && ctx.uiView.getVisible())
83
+ if (ctx.bar.visible && ctx.ui.shown)
76
84
  return;
77
85
  ctx.bar.visible = true;
78
86
  ctx.layout();
79
- ctx.flush(); // state first, then the view
80
- ctx.uiView.setVisible(true);
81
- ctx.win.setWindowButtonVisibility(true);
87
+ ctx.flush(); // state first, then the window
88
+ ctx.ui.setShown(true);
82
89
  }
83
90
  hide() {
84
91
  const { ctx } = this;
@@ -87,12 +94,11 @@ class Reveal {
87
94
  this.awaySince = null;
88
95
  ctx.bar.visible = false;
89
96
  ctx.flush();
90
- ctx.win.setWindowButtonVisibility(false);
91
97
  this.cancelViewHide();
92
98
  this.viewTimer = setTimeout(() => {
93
99
  this.viewTimer = undefined;
94
100
  if (this.live && !ctx.bar.visible && !ctx.overlay)
95
- ctx.uiView.setVisible(false);
101
+ this.hideWindow();
96
102
  }, VIEW_HIDE_DELAY);
97
103
  }
98
104
  // Hide without the exit animation, so the next mouse events go straight to the page.
@@ -102,7 +108,13 @@ class Reveal {
102
108
  return;
103
109
  this.hide();
104
110
  this.cancelViewHide();
105
- ctx.uiView.setVisible(false);
111
+ this.hideWindow();
112
+ }
113
+ hideWindow() {
114
+ const { ctx } = this;
115
+ ctx.ui.setShown(false);
116
+ // No mouseleave arrives once the window is gone.
117
+ ctx.bar.hover = false;
106
118
  }
107
119
  setPinned(pinned) {
108
120
  const { ctx } = this;
@@ -133,8 +145,9 @@ class Reveal {
133
145
  this.show();
134
146
  ctx.layout();
135
147
  ctx.flush();
136
- ctx.uiView.setVisible(true);
137
- ctx.uiView.webContents.focus();
148
+ ctx.ui.setShown(true);
149
+ ctx.ui.setInteractive(true);
150
+ ctx.ui.focus();
138
151
  }
139
152
  closeOverlay(refocus = true) {
140
153
  const { ctx } = this;
@@ -143,6 +156,8 @@ class Reveal {
143
156
  ctx.overlay = null;
144
157
  ctx.layout();
145
158
  ctx.flush();
159
+ ctx.ui.release();
160
+ this.syncPointer(false);
146
161
  if (refocus)
147
162
  ctx.tabs.focusActive();
148
163
  }
@@ -54,6 +54,15 @@ function writeExtension(prefix, manifest, files = {}) {
54
54
  return dir;
55
55
  }
56
56
  const loaded = (t) => !t.loading && !!t.url && !!t.title;
57
+ const sameRect = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
58
+ // Resolves on the window event, or after `ms` if it never comes.
59
+ const once = (win, event, ms = 3000) => new Promise((r) => {
60
+ const t = setTimeout(r, ms);
61
+ win.once(event, () => {
62
+ clearTimeout(t);
63
+ r();
64
+ });
65
+ });
57
66
  async function run(ctx) {
58
67
  (0, node_fs_1.mkdirSync)(OUT, { recursive: true });
59
68
  const results = [];
@@ -76,8 +85,14 @@ async function run(ctx) {
76
85
  console.log(`[selftest] ${result.pass ? 'PASS' : 'FAIL'} ${name} ${result.detail}`);
77
86
  };
78
87
  const save = (name, data) => (0, node_fs_1.writeFileSync)((0, node_path_1.join)(OUT, name), data);
79
- const { tabs, reveal, uiView, win } = ctx;
80
- const ui = uiView.webContents;
88
+ const { tabs, reveal, win } = ctx;
89
+ const uiWin = ctx.ui.win;
90
+ const ui = ctx.ui.view.webContents;
91
+ // The UI window should sit exactly over the page window's content area, `height` tall.
92
+ const overContent = (height) => {
93
+ const c = win.getContentBounds();
94
+ return uiWin.isVisible() && sameRect(uiWin.getBounds(), { ...c, height });
95
+ };
81
96
  const activeTab = () => {
82
97
  const t = tabs.active;
83
98
  if (!t)
@@ -88,9 +103,14 @@ async function run(ctx) {
88
103
  for (const t of tabs.list.filter((x) => !keep.includes(x)))
89
104
  tabs.close(t.id);
90
105
  };
91
- await check('window and UI view exist; new tab page present when empty', async () => {
106
+ await check('page window and UI child window exist; new tab page present when empty', async () => {
92
107
  tabs.create();
93
- return { pass: tabs.list.length === 1 && !!tabs.list[0]?.newTab, detail: `newtab.html exists=${(0, node_fs_1.existsSync)(tabs_1.NEWTAB_FILE)}` };
108
+ const child = win.getChildWindows().some((w) => w.id === uiWin.id) && uiWin.getParentWindow()?.id === win.id;
109
+ const protectedUi = uiWin.isContentProtected() && !uiWin.isFocusable();
110
+ return {
111
+ pass: tabs.list.length === 1 && !!tabs.list[0]?.newTab && child && protectedUi,
112
+ detail: `newtab.html exists=${(0, node_fs_1.existsSync)(tabs_1.NEWTAB_FILE)} child=${child} protected+unfocusable=${protectedUi}`,
113
+ };
94
114
  });
95
115
  only([]);
96
116
  let t1;
@@ -190,40 +210,97 @@ async function run(ctx) {
190
210
  save(`${name}.png`, Buffer.from(await composite([page, bar]), 'base64'));
191
211
  return { page: page.getSize(), ui: bar.getSize() };
192
212
  };
193
- await check('reveal bar: state pushed visible, view shown, composite captured', async () => {
213
+ await check('reveal bar: state pushed visible, UI window shown over the strip, composite captured', async () => {
194
214
  reveal.setHover(true); // the real cursor is elsewhere; keep the poller from hiding the bar
215
+ try {
216
+ reveal.show();
217
+ await sleep(1200);
218
+ const sizes = await shot('bar-composite');
219
+ const over = overContent(72);
220
+ return { pass: ctx.bar.visible && over && sizes.ui.height > 0, detail: JSON.stringify({ sizes, ui: uiWin.getBounds(), content: win.getContentBounds() }) };
221
+ }
222
+ finally {
223
+ reveal.setHover(false); // a failed capture must not leave the bar pinned for later checks
224
+ }
225
+ });
226
+ await check('UI window follows the page window when it moves', async () => {
227
+ reveal.setHover(true);
195
228
  reveal.show();
196
- await sleep(1200);
197
- const sizes = await shot('bar-composite');
229
+ const [x = 0, y = 0] = win.getPosition();
230
+ win.setPosition(x + 40, y + 30);
231
+ await sleep(100);
232
+ const moved = overContent(72);
233
+ win.setPosition(x, y);
234
+ await sleep(100);
235
+ const back = overContent(72);
198
236
  reveal.setHover(false);
199
- return { pass: ctx.bar.visible && uiView.getVisible() && sizes.ui.height > 0, detail: JSON.stringify(sizes) };
237
+ return { pass: moved && back, detail: JSON.stringify({ moved, back, ui: uiWin.getBounds(), content: win.getContentBounds() }) };
200
238
  });
201
- await check('omnibox overlay: full-size UI view, composite captured', async () => {
239
+ await check('omnibox overlay: UI window covers the content area and takes focus, composite captured', async () => {
202
240
  reveal.openOverlay('new', '');
203
241
  await sleep(800);
204
242
  await ui
205
243
  .executeJavaScript(`(() => { const i = document.querySelector('input'); if (i) { i.focus(); i.value = 'wiki'; i.dispatchEvent(new Event('input', { bubbles: true })) } return !!i })()`)
206
244
  .catch(() => { });
207
245
  await sleep(900);
208
- const [w, h] = win.getContentSize();
209
- const b = uiView.getBounds();
246
+ const [, h = 0] = win.getContentSize();
247
+ const full = overContent(h);
248
+ const focusable = uiWin.isFocusable();
210
249
  const sizes = await shot('omnibox-composite');
211
250
  reveal.closeOverlay();
212
- return { pass: b.width === w && b.height === h && !ctx.overlay, detail: JSON.stringify({ b, sizes }) };
251
+ const released = !uiWin.isFocusable();
252
+ return { pass: full && focusable && released && !ctx.overlay, detail: JSON.stringify({ full, focusable, released, sizes }) };
213
253
  });
214
- await check('pin: tab view bounds start at y=52; unpin: y=0', async () => {
254
+ await check('pin: tab view still fills the content area, UI window is the 52px strip over it', async () => {
215
255
  reveal.setPinned(true);
216
- const pinned = activeTab().view.getBounds();
217
- const [, ch = 0] = win.getContentSize();
256
+ await sleep(100);
257
+ const [cw = 0, ch = 0] = win.getContentSize();
258
+ const fills = sameRect(activeTab().view.getBounds(), { x: 0, y: 0, width: cw, height: ch });
259
+ const strip = overContent(52);
218
260
  reveal.setPinned(false);
219
- const y2 = activeTab().view.getBounds().y;
220
- return { pass: pinned.y === 52 && pinned.height === ch - 52 && y2 === 0, detail: `pinned y=${pinned.y} h=${pinned.height}/${ch}, unpinned y=${y2}` };
261
+ const unpinned = sameRect(activeTab().view.getBounds(), { x: 0, y: 0, width: cw, height: ch });
262
+ return { pass: fills && strip && unpinned, detail: JSON.stringify({ fills, strip, unpinned, view: activeTab().view.getBounds() }) };
221
263
  });
222
- await check('hide: state false, UI view invisible after timeout', async () => {
264
+ await check('hide: state false, UI window hidden after timeout', async () => {
223
265
  reveal.hide();
224
266
  const stateFalse = !ctx.bar.visible;
225
267
  await sleep(500);
226
- return { pass: stateFalse && !uiView.getVisible(), detail: `uiVisible=${uiView.getVisible()}` };
268
+ return { pass: stateFalse && !uiWin.isVisible(), detail: `uiVisible=${uiWin.isVisible()}` };
269
+ });
270
+ await check('minimize hides the UI window; restore brings it back', async () => {
271
+ reveal.setPinned(true);
272
+ await sleep(100);
273
+ const before = overContent(52);
274
+ const minimized = once(win, 'minimize');
275
+ win.minimize();
276
+ await minimized;
277
+ await sleep(200);
278
+ const hiddenWhileMin = win.isMinimized() && !uiWin.isVisible();
279
+ const restored = once(win, 'restore');
280
+ win.restore();
281
+ await restored;
282
+ await sleep(300);
283
+ const after = overContent(52);
284
+ reveal.setPinned(false);
285
+ reveal.hide();
286
+ return { pass: before && hiddenWhileMin && after, detail: JSON.stringify({ before, hiddenWhileMin, after }) };
287
+ });
288
+ await check('full screen: the UI window covers the strip of the full-screen window; leaving restores it', async () => {
289
+ reveal.setPinned(true);
290
+ await sleep(100);
291
+ const entered = once(win, 'enter-full-screen', 5000);
292
+ win.setFullScreen(true);
293
+ await entered;
294
+ await sleep(500);
295
+ const inFull = win.isFullScreen() && overContent(52) && ctx.getState().fullscreen;
296
+ const left = once(win, 'leave-full-screen', 5000);
297
+ win.setFullScreen(false);
298
+ await left;
299
+ await sleep(500);
300
+ const out = !win.isFullScreen() && overContent(52);
301
+ reveal.setPinned(false);
302
+ reveal.hide();
303
+ return { pass: inFull && out, detail: JSON.stringify({ inFull, out, ui: uiWin.getBounds(), content: win.getContentBounds() }) };
227
304
  });
228
305
  await check('floating bar has room for its shadow; clicks under the strip reach the page', async () => {
229
306
  const page = 'data:text/html,' +
@@ -234,14 +311,14 @@ async function run(ctx) {
234
311
  await waitFor(() => !tab.loading && tab.url.startsWith('data:'));
235
312
  reveal.show();
236
313
  await sleep(400);
237
- const floatH = uiView.getBounds().height;
314
+ const floatH = uiWin.getBounds().height;
238
315
  for (const type of ['mouseDown', 'mouseUp'])
239
316
  ui.sendInputEvent({ type, x: 420, y: 62, button: 'left', clickCount: 1 });
240
317
  const clicked = await waitFor(() => tab.wc.executeJavaScript('window.clicked || 0'), 3000).catch(() => 0);
241
- const hidden = !ctx.bar.visible && !uiView.getVisible();
318
+ const hidden = !ctx.bar.visible && !uiWin.isVisible();
242
319
  reveal.setPinned(true);
243
320
  await sleep(100);
244
- const pinnedH = uiView.getBounds().height;
321
+ const pinnedH = uiWin.getBounds().height;
245
322
  reveal.setPinned(false);
246
323
  reveal.hide();
247
324
  tabs.close(tab.id);
@@ -273,10 +350,11 @@ async function run(ctx) {
273
350
  const r = { withExt, hiddenByOption, checked, saved, back, goneWithNone, noPinButton };
274
351
  return { pass: Object.values(r).every(Boolean), detail: JSON.stringify(r) };
275
352
  });
276
- await check('UI view stays topmost after adding tabs', async () => {
353
+ await check('the page window holds only tab views', async () => {
277
354
  tabs.create({ url: 'about:blank', activate: false });
278
355
  const kids = win.contentView.children;
279
- return { pass: kids.at(-1) === uiView, detail: `children=${kids.length}` };
356
+ const onlyTabs = kids.length === tabs.list.length && kids.every((v) => tabs.list.some((t) => t.view === v));
357
+ return { pass: onlyTabs, detail: `children=${kids.length} tabs=${tabs.list.length}` };
280
358
  });
281
359
  await check('content size 1280x720 sets and centers', async () => {
282
360
  win.setContentSize(1280, 720);
@@ -476,11 +554,13 @@ async function run(ctx) {
476
554
  return { pass: !url.startsWith('chrome-extension://'), detail: url.slice(0, 120) };
477
555
  });
478
556
  }
479
- await check('closing the window with a push pending does not throw', async () => {
557
+ await check('closing the window with a push pending does not throw, and takes the UI window with it', async () => {
480
558
  ctx.push();
481
559
  win.close();
482
560
  await sleep(800); // give the push, poll, save and hide timers a chance to fire
483
- return { pass: uncaught.length === 0 && ctx.quitting && win.isDestroyed(), detail: uncaught.join(' | ').slice(0, 400) };
561
+ const left = electron_1.BaseWindow.getAllWindows().filter((w) => !w.isDestroyed()).length;
562
+ const ok = uncaught.length === 0 && ctx.quitting && win.isDestroyed() && uiWin.isDestroyed() && ui.isDestroyed() && left === 0;
563
+ return { pass: ok, detail: `windows left=${left} ${uncaught.join(' | ').slice(0, 400)}` };
484
564
  });
485
565
  const failed = results.filter((r) => !r.pass).length;
486
566
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(OUT, 'results.json'), JSON.stringify({ passed: results.length - failed, failed, results }, null, 2));
package/dist/main/tabs.js CHANGED
@@ -40,7 +40,7 @@ class Tabs {
40
40
  const wc = view.webContents;
41
41
  const tab = { id: wc.id, view, wc, title: '', url: '', favicon: null, loading: false, audible: false, muted: false, newTab: false };
42
42
  this.list.splice(opts.index ?? this.list.length, 0, tab);
43
- ctx.win.contentView.addChildView(view, 0); // the UI view stays on top
43
+ ctx.win.contentView.addChildView(view);
44
44
  view.setBounds(ctx.tabBounds());
45
45
  view.setVisible(false);
46
46
  this.wire(tab);
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UiWindow = void 0;
4
+ const electron_1 = require("electron");
5
+ const node_path_1 = require("node:path");
6
+ // The tab bar, omnibox and traffic lights live in this borderless child window over the page
7
+ // window. Content protection is per window, so keeping them out of the page window is what lets
8
+ // the page stay capturable while they don't.
9
+ class UiWindow {
10
+ win;
11
+ view;
12
+ parent;
13
+ wanted = false;
14
+ interactive = false;
15
+ // Relative to the parent's content area.
16
+ rect = { x: 0, y: 0, width: 0, height: 0 };
17
+ constructor(parent) {
18
+ this.parent = parent;
19
+ // A child window rather than a panel: it moves with the parent natively (no lag during a drag)
20
+ // and stays on the parent's Space, where a panel would float over every app and Space.
21
+ this.win = new electron_1.BaseWindow({
22
+ parent,
23
+ show: false,
24
+ frame: false,
25
+ transparent: true,
26
+ backgroundColor: '#00000000',
27
+ hasShadow: false,
28
+ roundedCorners: false,
29
+ resizable: false,
30
+ movable: false,
31
+ minimizable: false,
32
+ maximizable: false,
33
+ fullscreenable: false,
34
+ skipTaskbar: true,
35
+ // Clicks on the bar shouldn't pull keyboard focus off the page. focus() allows it while the
36
+ // omnibox is open.
37
+ focusable: false,
38
+ });
39
+ this.win.excludedFromShownWindowsMenu = true;
40
+ // This is what hides the UI from a share. A capture of the page window includes its child
41
+ // windows, and so does a full-display capture, but both skip a window whose sharingType is
42
+ // none. Checked with ScreenCaptureKit and screencapture on macOS 26.
43
+ this.win.setContentProtection(true);
44
+ this.win.setIgnoreMouseEvents(true, { forward: true });
45
+ this.view = new electron_1.WebContentsView({
46
+ webPreferences: {
47
+ // Non-persistent: it only serves the local UI. Extension icons load over crx://.
48
+ session: electron_1.session.fromPartition('stage-ui'),
49
+ preload: (0, node_path_1.join)(__dirname, '..', 'preload', 'ui-preload.js'),
50
+ contextIsolation: true,
51
+ sandbox: false,
52
+ nodeIntegration: false,
53
+ },
54
+ });
55
+ this.view.setBackgroundColor('#00000000');
56
+ this.win.contentView.addChildView(this.view);
57
+ const sync = () => this.sync();
58
+ parent
59
+ .on('move', sync)
60
+ .on('resize', sync)
61
+ .on('show', sync)
62
+ .on('hide', sync)
63
+ .on('minimize', sync)
64
+ .on('restore', sync)
65
+ .on('enter-full-screen', sync)
66
+ .on('leave-full-screen', sync)
67
+ .once('closed', () => this.destroy());
68
+ }
69
+ get shown() {
70
+ return this.wanted;
71
+ }
72
+ get live() {
73
+ return !this.win.isDestroyed() && !this.parent.isDestroyed();
74
+ }
75
+ setShown(shown) {
76
+ this.wanted = shown;
77
+ this.sync();
78
+ }
79
+ setBounds(rect) {
80
+ this.rect = rect;
81
+ this.sync();
82
+ }
83
+ // Off for the transparent shadow room under the floating bar, so the page gets those clicks.
84
+ setInteractive(on) {
85
+ if (on === this.interactive || !this.live)
86
+ return;
87
+ this.interactive = on;
88
+ // forward: mouse moves still reach the UI, so hover styles and mouseleave stay right.
89
+ this.win.setIgnoreMouseEvents(!on, { forward: true });
90
+ }
91
+ // Keyboard focus for the omnibox.
92
+ focus() {
93
+ if (!this.live)
94
+ return;
95
+ this.win.setFocusable(true);
96
+ this.win.focus();
97
+ this.view.webContents.focus();
98
+ }
99
+ // Hands keyboard focus back to the page window.
100
+ release() {
101
+ if (!this.live)
102
+ return;
103
+ const had = this.win.isFocused();
104
+ this.win.setFocusable(false);
105
+ if (had)
106
+ this.parent.focus();
107
+ }
108
+ // Shown only with its parent, at the parent's content origin. Child windows follow the parent on
109
+ // their own when it moves; this keeps size and visibility in step.
110
+ sync() {
111
+ if (!this.live)
112
+ return;
113
+ const { parent, win, rect } = this;
114
+ const show = this.wanted && parent.isVisible() && !parent.isMinimized() && rect.width > 0 && rect.height > 0;
115
+ if (!show) {
116
+ if (win.isVisible())
117
+ win.hide();
118
+ return;
119
+ }
120
+ const c = parent.getContentBounds();
121
+ win.setBounds({ x: c.x + rect.x, y: c.y + rect.y, width: rect.width, height: rect.height });
122
+ this.view.setBounds({ x: 0, y: 0, width: rect.width, height: rect.height });
123
+ if (!win.isVisible())
124
+ win.showInactive();
125
+ }
126
+ destroy() {
127
+ if (!this.view.webContents.isDestroyed())
128
+ this.view.webContents.close();
129
+ if (!this.win.isDestroyed())
130
+ this.win.destroy();
131
+ }
132
+ }
133
+ exports.UiWindow = UiWindow;
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BAR_HEIGHT = void 0;
3
+ exports.WindowDrag = exports.BAR_HEIGHT = void 0;
4
4
  exports.bgColor = bgColor;
5
5
  exports.createWindow = createWindow;
6
6
  exports.tabBounds = tabBounds;
7
7
  exports.uiBounds = uiBounds;
8
+ exports.windowAction = windowAction;
8
9
  const electron_1 = require("electron");
9
- const node_path_1 = require("node:path");
10
10
  exports.BAR_HEIGHT = 52;
11
- // Transparent room under the floating bar so the capsule's shadow isn't clipped. Clicks in it are
12
- // passed to the page. Not used when pinned: the page then starts right under the strip.
11
+ // Transparent room under the floating bar so the capsule's shadow isn't clipped. The UI window lets
12
+ // the mouse through to the page there. Not used when pinned: the bar then stays up all the time, so
13
+ // it keeps to the strip.
13
14
  const SHADOW_ROOM = 20;
14
- const TRAFFIC_LIGHTS = { x: 20, y: 19 };
15
+ const DRAG_TICK_MS = 8;
16
+ const DRAG_MAX_MS = 60_000;
15
17
  const EMPTY = { x: 0, y: 0, width: 0, height: 0 };
16
18
  function bgColor() {
17
19
  return electron_1.nativeTheme.shouldUseDarkColors ? '#1c1c1e' : '#ffffff';
@@ -24,6 +26,7 @@ function initialBounds(saved) {
24
26
  });
25
27
  return onScreen ? saved : { width: saved.width, height: saved.height };
26
28
  }
29
+ // The page window: only tab views live in it, so a single-window share shows nothing else.
27
30
  function createWindow(saved, size) {
28
31
  const win = new electron_1.BaseWindow({
29
32
  ...initialBounds(saved),
@@ -32,37 +35,99 @@ function createWindow(saved, size) {
32
35
  minHeight: 320,
33
36
  show: false,
34
37
  titleBarStyle: 'hidden',
35
- trafficLightPosition: TRAFFIC_LIGHTS,
36
38
  backgroundColor: bgColor(),
37
39
  });
38
40
  if (size) {
39
41
  win.setContentSize(size.width, size.height);
40
42
  win.center();
41
43
  }
44
+ // The native traffic lights are part of this window, so a window share would show them. The UI
45
+ // draws its own in the bar instead.
42
46
  win.setWindowButtonVisibility(false);
43
- const uiView = new electron_1.WebContentsView({
44
- webPreferences: {
45
- // Non-persistent: it only serves the local UI. Extension icons load over crx://.
46
- session: electron_1.session.fromPartition('stage-ui'),
47
- preload: (0, node_path_1.join)(__dirname, '..', 'preload', 'ui-preload.js'),
48
- contextIsolation: true,
49
- sandbox: false,
50
- nodeIntegration: false,
51
- },
52
- });
53
- uiView.setBackgroundColor('#00000000');
54
- uiView.setVisible(false);
55
- win.contentView.addChildView(uiView);
56
- return { win, uiView };
47
+ return win;
57
48
  }
58
- function tabBounds(win, pinned) {
49
+ function tabBounds(win) {
59
50
  if (win.isDestroyed())
60
51
  return EMPTY;
61
52
  const [w = 0, h = 0] = win.getContentSize();
62
- const top = pinned ? exports.BAR_HEIGHT : 0;
63
- return { x: 0, y: top, width: w, height: Math.max(0, h - top) };
53
+ return { x: 0, y: 0, width: w, height: h };
64
54
  }
55
+ // The UI window's bounds, relative to the page window's content area.
65
56
  function uiBounds(win, pinned, overlay) {
66
57
  const [w = 0, h = 0] = win.getContentSize();
67
58
  return { x: 0, y: 0, width: w, height: overlay ? h : pinned ? exports.BAR_HEIGHT : exports.BAR_HEIGHT + SHADOW_ROOM };
68
59
  }
60
+ function toggleZoom(win) {
61
+ if (win.isMaximized())
62
+ win.unmaximize();
63
+ else
64
+ win.maximize();
65
+ }
66
+ // What a title bar double-click does, per System Settings → Desktop & Dock.
67
+ function titleBarDoubleClick(win) {
68
+ const pref = electron_1.systemPreferences.getUserDefault('AppleActionOnDoubleClick', 'string');
69
+ if (pref === 'None')
70
+ return;
71
+ if (pref === 'Minimize')
72
+ win.minimize();
73
+ else
74
+ toggleZoom(win);
75
+ }
76
+ // The bar's drawn traffic lights and title-bar double-click, with macOS semantics: green toggles
77
+ // full screen, Option-green zooms.
78
+ function windowAction(win, action) {
79
+ if (win.isDestroyed())
80
+ return;
81
+ const full = win.isFullScreen();
82
+ if (action === 'close')
83
+ return win.close();
84
+ if (action === 'fullscreen')
85
+ return win.setFullScreen(!full);
86
+ if (full)
87
+ return; // minimize and zoom don't apply to a full-screen window
88
+ if (action === 'minimize')
89
+ win.minimize();
90
+ else if (action === 'zoom')
91
+ toggleZoom(win);
92
+ else if (action === 'double-click')
93
+ titleBarDoubleClick(win);
94
+ }
95
+ // Moves the page window with the cursor while the bar holds the mouse down. The bar lives in a
96
+ // child window, so -webkit-app-region would drag only the child; macOS then moves the child along
97
+ // with its parent, so the bar can't lag behind.
98
+ class WindowDrag {
99
+ win;
100
+ timer;
101
+ constructor(win) {
102
+ this.win = win;
103
+ }
104
+ get active() {
105
+ return this.timer !== undefined;
106
+ }
107
+ start() {
108
+ const { win } = this;
109
+ if (this.timer || win.isDestroyed() || win.isFullScreen())
110
+ return;
111
+ const p0 = electron_1.screen.getCursorScreenPoint();
112
+ const [x0 = 0, y0 = 0] = win.getPosition();
113
+ const started = Date.now();
114
+ let last = `${x0},${y0}`;
115
+ // A lost mouse-up can't leave the window stuck to the cursor for more than DRAG_MAX_MS.
116
+ this.timer = setInterval(() => {
117
+ if (Date.now() - started > DRAG_MAX_MS || win.isDestroyed())
118
+ return this.end();
119
+ const p = electron_1.screen.getCursorScreenPoint();
120
+ const x = x0 + p.x - p0.x;
121
+ const y = y0 + p.y - p0.y;
122
+ if (`${x},${y}` === last)
123
+ return;
124
+ last = `${x},${y}`;
125
+ win.setPosition(x, y);
126
+ }, DRAG_TICK_MS);
127
+ }
128
+ end() {
129
+ clearInterval(this.timer);
130
+ this.timer = undefined;
131
+ }
132
+ }
133
+ exports.WindowDrag = WindowDrag;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Preload for the overlay UI view (sandbox: false, contextIsolation: true).
3
+ // Preload for the UI window's view (sandbox: false, contextIsolation: true).
4
4
  const electron_1 = require("electron");
5
5
  const browser_action_1 = require("electron-chrome-extensions/browser-action");
6
6
  const contract_1 = require("../shared/contract");
@@ -29,5 +29,6 @@ const api = {
29
29
  passClick: command('passClick'),
30
30
  startWindowDrag: command('startWindowDrag'),
31
31
  endWindowDrag: command('endWindowDrag'),
32
+ windowAction: command('windowAction'),
32
33
  };
33
34
  electron_1.contextBridge.exposeInMainWorld('stage', api);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // The interface between the main process and the overlay UI. See docs/CONTRACT.md.
2
+ // The interface between the main process and the UI window. See docs/CONTRACT.md.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.channel = void 0;
5
5
  const channel = (name) => `stage:${name}`;
package/dist/ui/app.js CHANGED
@@ -95,7 +95,11 @@
95
95
  const iconFor = (item) => item.favicon ? `<img alt="" draggable="false" src="${item.favicon.replace(/"/g, '&quot;')}">` : ICONS[SUGGESTION_ICON[item.kind]];
96
96
  const boot = (stage) => {
97
97
  const root = document.documentElement;
98
+ const strip = byId('strip', HTMLElement);
98
99
  const capsule = byId('capsule', HTMLElement);
100
+ const lights = byId('lights', HTMLElement);
101
+ const minimizeBtn = byId('light-minimize', HTMLButtonElement);
102
+ const zoomBtn = byId('light-zoom', HTMLButtonElement);
99
103
  const tabsEl = byId('tabs', HTMLElement);
100
104
  const controlsEl = byId('controls', HTMLElement);
101
105
  const newBtn = byId('new-tab', HTMLButtonElement);
@@ -131,6 +135,9 @@
131
135
  root.classList.toggle('bar-pinned', s.bar.pinned);
132
136
  root.classList.toggle('hide-ext', s.hideExtensionIcons);
133
137
  root.classList.toggle('no-ext', !s.extensionActions);
138
+ // A full-screen window can't be minimized, and green takes it back out.
139
+ minimizeBtn.disabled = s.fullscreen;
140
+ zoomBtn.setAttribute('aria-label', s.fullscreen ? 'Exit full screen' : 'Enter full screen');
134
141
  renderTabs(s);
135
142
  };
136
143
  const renderTabs = (s) => {
@@ -588,6 +595,38 @@
588
595
  window.addEventListener('pointerup', onDragEnd);
589
596
  window.addEventListener('pointercancel', onDragCancel);
590
597
  });
598
+ // The strip is the window's title bar: its background drags the window and a double-click
599
+ // zooms it. Tabs, buttons and extension icons keep their own clicks.
600
+ const onBarBackground = (e) => e.target instanceof Element && !e.target.closest('#tabs, button, browser-action-list');
601
+ // The window moves with the cursor, so the button comes up over the strip in this document.
602
+ const endWindowDrag = () => {
603
+ window.removeEventListener('pointerup', endWindowDrag);
604
+ window.removeEventListener('pointercancel', endWindowDrag);
605
+ stage.endWindowDrag();
606
+ };
607
+ strip.addEventListener('pointerdown', (e) => {
608
+ if (e.button !== 0 || !onBarBackground(e))
609
+ return;
610
+ stage.startWindowDrag();
611
+ window.addEventListener('pointerup', endWindowDrag);
612
+ window.addEventListener('pointercancel', endWindowDrag);
613
+ });
614
+ strip.addEventListener('dblclick', (e) => {
615
+ if (onBarBackground(e))
616
+ stage.windowAction('double-click');
617
+ });
618
+ const lightActions = [
619
+ ['light-close', () => 'close'],
620
+ ['light-minimize', () => 'minimize'],
621
+ // Option-click zooms instead, as on any Mac window.
622
+ ['light-zoom', (e) => (e.altKey ? 'zoom' : 'fullscreen')],
623
+ ];
624
+ for (const [id, action] of lightActions)
625
+ byId(id, HTMLButtonElement).addEventListener('click', (e) => stage.windowAction(action(e)));
626
+ // The UI window never has keyboard focus here, so the Option key is read off the mouse events.
627
+ const trackAlt = (e) => lights.classList.toggle('alt', e.altKey);
628
+ lights.addEventListener('mousemove', trackAlt);
629
+ lights.addEventListener('mouseenter', trackAlt);
591
630
  newBtn.addEventListener('click', () => stage.openOmnibox('new'));
592
631
  capsule.addEventListener('mouseenter', () => stage.setBarHover(true));
593
632
  capsule.addEventListener('mouseleave', () => stage.setBarHover(false));
@@ -8,8 +8,21 @@
8
8
  <link rel="stylesheet" href="styles.css">
9
9
  </head>
10
10
  <body>
11
- <!-- Tab bar: a 52px strip with one floating capsule. The leftmost 84px stay free for the traffic lights. -->
11
+ <!-- Tab bar: a 52px strip with the traffic lights in its leftmost 84px and one floating capsule.
12
+ Its background drags the window. -->
12
13
  <div id="strip">
14
+ <div id="lights" role="group" aria-label="Window">
15
+ <button id="light-close" class="light" type="button" tabindex="-1" aria-label="Close window">
16
+ <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.75 3.75l4.5 4.5M8.25 3.75l-4.5 4.5" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>
17
+ </button>
18
+ <button id="light-minimize" class="light" type="button" tabindex="-1" aria-label="Minimize window">
19
+ <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 6h6" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
20
+ </button>
21
+ <button id="light-zoom" class="light" type="button" tabindex="-1" aria-label="Enter full screen">
22
+ <svg class="full" viewBox="0 0 12 12" aria-hidden="true"><path d="M3.5 3.5h3.6L3.5 7.1zM8.5 8.5H4.9l3.6-3.6z" fill="currentColor"/></svg>
23
+ <svg class="plus" viewBox="0 0 12 12" aria-hidden="true"><path d="M6 3v6M3 6h6" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
24
+ </button>
25
+ </div>
13
26
  <div id="capsule">
14
27
  <div id="tabs" role="tablist" aria-label="Tabs"></div>
15
28
  <button id="new-tab" class="icon-btn" type="button" aria-label="New tab" title="New tab (⌘T)">
@@ -22,7 +35,7 @@
22
35
  </div>
23
36
  </div>
24
37
 
25
- <!-- Omnibox overlay (shown when state.overlay.type === 'omnibox'; the view is then full-window). -->
38
+ <!-- Omnibox overlay (shown when state.overlay.type === 'omnibox'; the UI window then covers the page). -->
26
39
  <div id="omni" hidden>
27
40
  <div id="omni-backdrop"></div>
28
41
  <div id="omni-panel" role="dialog" aria-label="Open a page or search">
package/dist/ui/mock.js CHANGED
@@ -222,12 +222,13 @@
222
222
  passClick: (x, y, button, clickCount) => record('passClick', x, y, button, clickCount),
223
223
  startWindowDrag: () => record('startWindowDrag'),
224
224
  endWindowDrag: () => record('endWindowDrag'),
225
+ windowAction: (action) => record('windowAction', action),
225
226
  };
226
227
  window.stage = api;
227
228
  const mockCss = document.createElement('style');
228
229
  mockCss.textContent =
229
230
  'browser-action-list{display:flex}' +
230
- '.mock-action{width:24px;height:24px;margin:0 2px;border-radius:6px;display:grid;place-items:center;-webkit-app-region:no-drag}' +
231
+ '.mock-action{width:24px;height:24px;margin:0 2px;border-radius:6px;display:grid;place-items:center}' +
231
232
  '.mock-action:hover{background:var(--hover)}' +
232
233
  '.mock-action i{width:16px;height:16px;border-radius:5px;background:linear-gradient(135deg,#8b5cf6,#6366f1);display:grid;place-items:center}' +
233
234
  '.mock-action svg{width:10px;height:10px}' +
@@ -350,6 +351,26 @@
350
351
  cap.dispatchEvent(new MouseEvent('mouseleave'));
351
352
  const hovers = calls.flatMap((c) => (c[0] === 'setBarHover' ? [c[1]] : []));
352
353
  check('capsule hover reports setBarHover(true/false)', hovers.join() === 'true,false');
354
+ const lights = q('#lights').getBoundingClientRect();
355
+ check('traffic lights sit in the leftmost 84px, centred on the capsule', lights.left >= 0 && lights.right <= 84 && Math.abs(lights.top + lights.height / 2 - 26) < 0.5, JSON.stringify(lights));
356
+ q('#light-close').click();
357
+ q('#light-minimize').click();
358
+ q('#light-zoom').click();
359
+ q('#light-zoom').dispatchEvent(new MouseEvent('click', { bubbles: true, altKey: true }));
360
+ const actions = calls.flatMap((c) => (c[0] === 'windowAction' ? [c[1]] : []));
361
+ check('traffic lights → windowAction close, minimize, fullscreen; Option-green → zoom', actions.join() === 'close,minimize,fullscreen,zoom', actions.join());
362
+ const strip = q('#strip');
363
+ const drags = () => countCalls('startWindowDrag') + '/' + countCalls('endWindowDrag');
364
+ ptr('pointerdown', strip, 60, 40);
365
+ ptr('pointerup', window, 60, 40);
366
+ check('strip background pointerdown → startWindowDrag, pointerup → endWindowDrag', drags() === '1/1', drags());
367
+ ptr('pointerdown', q('#new-tab'), 60, 40);
368
+ ptr('pointerdown', nth(live(), 0), 60, 40);
369
+ check('pointerdown on a button or a tab does not drag the window', drags() === '1/1', drags());
370
+ ptr('pointercancel', window, 60, 40);
371
+ strip.dispatchEvent(new MouseEvent('dblclick', { bubbles: true }));
372
+ nth(live(), 0).dispatchEvent(new MouseEvent('dblclick', { bubbles: true }));
373
+ check('double-click on the strip background → windowAction("double-click"), on a tab → nothing', calls.filter((c) => c[0] === 'windowAction' && c[1] === 'double-click').length === 1);
353
374
  const t0 = nth(live(), 0);
354
375
  t0.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true, button: 2 }));
355
376
  check('right-click calls showTabMenu', lastCall('showTabMenu')?.[1] === idOf(t0));
@@ -65,9 +65,10 @@ svg { display: block; flex: none; }
65
65
  display: flex;
66
66
  justify-content: center;
67
67
  align-items: flex-start;
68
- -webkit-app-region: drag;
69
68
  pointer-events: none;
70
69
  }
70
+ /* The background drags the window (app.ts): the UI is a separate window, so app-region can't. */
71
+ .bar-visible #strip { pointer-events: auto; }
71
72
 
72
73
  #capsule {
73
74
  display: flex;
@@ -85,8 +86,7 @@ svg { display: block; flex: none; }
85
86
  0 0 0 .5px var(--edge),
86
87
  0 1px 2px rgb(0 0 0 / .08),
87
88
  0 4px 10px -2px var(--shadow-c),
88
- 0 10px 24px -10px var(--shadow-c); /* reaches ~24px below; main gives the view 20px under the strip */
89
- -webkit-app-region: drag;
89
+ 0 10px 24px -10px var(--shadow-c); /* reaches ~24px below; main gives the window 20px under the strip */
90
90
 
91
91
  /* exit: quick and quiet */
92
92
  opacity: 0;
@@ -95,7 +95,7 @@ svg { display: block; flex: none; }
95
95
  transition: opacity 120ms ease-in, transform 120ms ease-in;
96
96
  will-change: opacity, transform;
97
97
  }
98
- /* Pinned: the page starts right under the strip, so the view can't grow; keep the shadow inside 8px. */
98
+ /* Pinned: the window keeps to the strip, so keep the shadow inside its 8px. */
99
99
  .bar-pinned #capsule {
100
100
  box-shadow:
101
101
  inset 0 .5px 0 var(--highlight),
@@ -110,8 +110,40 @@ svg { display: block; flex: none; }
110
110
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
111
111
  }
112
112
 
113
- /* every interactive thing opts out of dragging */
114
- #tabs, #new-tab, browser-action-list, .tab { -webkit-app-region: no-drag; }
113
+ /* ---------- traffic lights ---------- */
114
+
115
+ /* Drawn here, not native: the native ones belong to the page window, which the audience sees. */
116
+ #lights {
117
+ position: absolute;
118
+ left: 20px;
119
+ top: 20px; /* centred on the capsule, 26px down */
120
+ display: flex;
121
+ gap: 8px;
122
+ opacity: 0;
123
+ pointer-events: none;
124
+ transition: opacity 120ms ease-in;
125
+ }
126
+ .bar-visible #lights { opacity: 1; pointer-events: auto; transition: opacity 160ms var(--ease-out); }
127
+
128
+ .light {
129
+ width: 12px;
130
+ height: 12px;
131
+ border-radius: 50%;
132
+ display: grid;
133
+ place-items: center;
134
+ color: rgb(0 0 0 / .55);
135
+ box-shadow: inset 0 0 0 .5px rgb(0 0 0 / .12);
136
+ }
137
+ .light svg { width: 12px; height: 12px; grid-area: 1 / 1; opacity: 0; }
138
+ #lights:hover .light svg { opacity: 1; }
139
+ #light-close { background: #ff5f57; }
140
+ #light-minimize { background: #febc2e; }
141
+ #light-zoom { background: #28c840; }
142
+ #light-zoom .plus, #lights.alt #light-zoom .full { display: none; }
143
+ #lights.alt #light-zoom .plus { display: block; }
144
+ #light-minimize:disabled { background: light-dark(rgb(0 0 0 / .12), rgb(255 255 255 / .18)); }
145
+ #light-minimize:disabled svg { display: none; }
146
+ .light:active { filter: brightness(.85); }
115
147
 
116
148
  #tabs {
117
149
  position: relative;
@@ -253,7 +285,6 @@ svg { display: block; flex: none; }
253
285
  opacity: 0;
254
286
  pointer-events: none;
255
287
  transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
256
- -webkit-app-region: no-drag;
257
288
  }
258
289
  .tab:hover .close, .tab.active .close, .close:focus-visible { opacity: 1; pointer-events: auto; }
259
290
  .close:hover { background: var(--press); color: var(--text); }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stage-browser",
3
3
  "productName": "Stage",
4
- "version": "0.1.1",
4
+ "version": "0.2.0",
5
5
  "description": "A minimal Chromium browser for screen sharing: the page fills the window, tabs hide until you reach for them.",
6
6
  "main": "dist/main/main.js",
7
7
  "scripts": {
@@ -53,7 +53,7 @@
53
53
  "url": "https://github.com/andrewckor/stage-browser/issues"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/node": "^24.19.2",
56
+ "@types/node": "^26.6.6",
57
57
  "oxlint": "^1.94.0",
58
58
  "typescript": "^7.0.2"
59
59
  },