electrobun 1.18.4-beta.6 → 2.0.1-beta.13

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -170
  3. package/bin/electrobun.cjs +230 -153
  4. package/package.json +18 -49
  5. package/bun.lock +0 -119
  6. package/dist/api/browser/builtinrpcSchema.ts +0 -19
  7. package/dist/api/browser/global.d.ts +0 -36
  8. package/dist/api/browser/index.ts +0 -234
  9. package/dist/api/browser/webviewtag.ts +0 -88
  10. package/dist/api/browser/wgputag.ts +0 -48
  11. package/dist/api/bun/ElectrobunConfig.ts +0 -530
  12. package/dist/api/bun/__tests__/ffi-contract.test.ts +0 -105
  13. package/dist/api/bun/core/ApplicationMenu.ts +0 -70
  14. package/dist/api/bun/core/BrowserView.ts +0 -419
  15. package/dist/api/bun/core/BrowserWindow.ts +0 -400
  16. package/dist/api/bun/core/BuildConfig.ts +0 -71
  17. package/dist/api/bun/core/ContextMenu.ts +0 -75
  18. package/dist/api/bun/core/GpuWindow.ts +0 -289
  19. package/dist/api/bun/core/Paths.ts +0 -5
  20. package/dist/api/bun/core/Socket.ts +0 -22
  21. package/dist/api/bun/core/Tray.ts +0 -197
  22. package/dist/api/bun/core/Updater.ts +0 -1162
  23. package/dist/api/bun/core/Utils.ts +0 -487
  24. package/dist/api/bun/core/WGPUView.ts +0 -167
  25. package/dist/api/bun/core/menuRoles.ts +0 -181
  26. package/dist/api/bun/events/ApplicationEvents.ts +0 -22
  27. package/dist/api/bun/events/event.ts +0 -29
  28. package/dist/api/bun/events/eventEmitter.ts +0 -45
  29. package/dist/api/bun/events/trayEvents.ts +0 -11
  30. package/dist/api/bun/events/webviewEvents.ts +0 -39
  31. package/dist/api/bun/events/windowEvents.ts +0 -23
  32. package/dist/api/bun/index.ts +0 -298
  33. package/dist/api/bun/preload/.generated/compiled.ts +0 -8
  34. package/dist/api/bun/preload/build.ts +0 -65
  35. package/dist/api/bun/preload/dragRegions.ts +0 -41
  36. package/dist/api/bun/preload/encryption.ts +0 -86
  37. package/dist/api/bun/preload/events.ts +0 -171
  38. package/dist/api/bun/preload/globals.d.ts +0 -45
  39. package/dist/api/bun/preload/index-sandboxed.ts +0 -28
  40. package/dist/api/bun/preload/index.ts +0 -77
  41. package/dist/api/bun/preload/internalRpc.ts +0 -80
  42. package/dist/api/bun/preload/overlaySync.ts +0 -107
  43. package/dist/api/bun/preload/webviewTag.ts +0 -451
  44. package/dist/api/bun/preload/wgpuTag.ts +0 -246
  45. package/dist/api/bun/proc/linux.md +0 -43
  46. package/dist/api/bun/proc/native.ts +0 -3385
  47. package/dist/api/bun/webGPU.ts +0 -346
  48. package/dist/api/bun/webgpuAdapter.ts +0 -3011
  49. package/dist/api/shared/bun-version.ts +0 -3
  50. package/dist/api/shared/cef-version.ts +0 -5
  51. package/dist/api/shared/electrobun-version.ts +0 -2
  52. package/dist/api/shared/naming.test.ts +0 -327
  53. package/dist/api/shared/naming.ts +0 -188
  54. package/dist/api/shared/platform.ts +0 -48
  55. package/dist/api/shared/rpc.ts +0 -541
  56. package/dist/main.js +0 -168
  57. package/dist/preload-full.js +0 -913
  58. package/dist/preload-sandboxed.js +0 -111
  59. package/dist/zig-sdk/electrobun.zig +0 -1993
  60. package/src/cli/bun.lockb +0 -0
  61. package/src/cli/index.ts +0 -5689
  62. package/src/cli/package-lock.json +0 -81
  63. package/src/cli/package.json +0 -11
@@ -1,246 +0,0 @@
1
- // <electrobun-wgpu> Custom Element
2
- // Provides a layout-driven native WGPU view that is positioned via a DOM element.
3
-
4
- import "./globals.d.ts";
5
- import { send, request } from "./internalRpc";
6
- import { OverlaySyncController, type Rect } from "./overlaySync";
7
-
8
- type WgpuTagEventType = "ready";
9
-
10
- // Registry for WGPU view instances (for event routing if needed)
11
- export const wgpuTagRegistry: Record<number, ElectrobunWgpuTag> = {};
12
-
13
- export class ElectrobunWgpuTag extends HTMLElement {
14
- wgpuViewId: number | null = null;
15
- maskSelectors: Set<string> = new Set();
16
- private _sync: OverlaySyncController | null = null;
17
- transparent = false;
18
- passthroughEnabled = false;
19
- hidden = false;
20
- private _eventListeners: Record<string, Array<(event: CustomEvent) => void>> =
21
- {};
22
-
23
- constructor() {
24
- super();
25
- }
26
-
27
- connectedCallback() {
28
- requestAnimationFrame(() => this.initWgpuView());
29
- }
30
-
31
- disconnectedCallback() {
32
- if (this.wgpuViewId !== null) {
33
- send("wgpuTagRemove", { id: this.wgpuViewId });
34
- delete wgpuTagRegistry[this.wgpuViewId];
35
- }
36
- if (this._sync) this._sync.stop();
37
- }
38
-
39
- async initWgpuView() {
40
- const rect = this.getBoundingClientRect();
41
- const initialRect = {
42
- x: rect.x,
43
- y: rect.y,
44
- width: rect.width,
45
- height: rect.height,
46
- };
47
-
48
- const transparent = this.hasAttribute("transparent");
49
- const passthrough = this.hasAttribute("passthrough");
50
- const hidden = this.hasAttribute("hidden");
51
- const masks = this.getAttribute("masks");
52
-
53
- this.transparent = transparent;
54
- this.passthroughEnabled = passthrough;
55
- this.hidden = hidden;
56
-
57
- if (masks) {
58
- masks.split(",").forEach((s) => this.maskSelectors.add(s.trim()));
59
- }
60
-
61
- if (transparent) this.style.opacity = "0";
62
- if (passthrough) this.style.pointerEvents = "none";
63
-
64
- try {
65
- const wgpuViewId = (await request("wgpuTagInit", {
66
- windowId: window.__electrobunWindowId,
67
- frame: {
68
- width: rect.width,
69
- height: rect.height,
70
- x: rect.x,
71
- y: rect.y,
72
- },
73
- transparent,
74
- passthrough,
75
- })) as number;
76
-
77
- this.wgpuViewId = wgpuViewId;
78
- this.id = `electrobun-wgpu-${wgpuViewId}`;
79
- wgpuTagRegistry[wgpuViewId] = this;
80
-
81
- this.setupObservers(initialRect);
82
- // Force immediate sync after initialization
83
- this.syncDimensions(true);
84
-
85
- // Apply hidden state after creation (no init flag for hidden)
86
- if (hidden) {
87
- this.toggleHidden(true);
88
- }
89
-
90
- // When adding a new WGPU view, force all existing WGPU views to re-sync
91
- requestAnimationFrame(() => {
92
- Object.values(wgpuTagRegistry).forEach((view) => {
93
- if (view !== this && view.wgpuViewId !== null) {
94
- view.syncDimensions(true);
95
- }
96
- });
97
- });
98
-
99
- this.emit("ready", { id: wgpuViewId });
100
- } catch (err) {
101
- console.error("Failed to init WGPU view:", err);
102
- }
103
- }
104
-
105
- setupObservers(initialRect: Rect) {
106
- const getMasks = () => {
107
- const rect = this.getBoundingClientRect();
108
- const masks: Rect[] = [];
109
- this.maskSelectors.forEach((selector) => {
110
- try {
111
- document.querySelectorAll(selector).forEach((el) => {
112
- const mr = el.getBoundingClientRect();
113
- masks.push({
114
- x: mr.x - rect.x,
115
- y: mr.y - rect.y,
116
- width: mr.width,
117
- height: mr.height,
118
- });
119
- });
120
- } catch (_e) {
121
- // Invalid selector, ignore
122
- }
123
- });
124
- return masks;
125
- };
126
-
127
- this._sync = new OverlaySyncController(this, {
128
- onSync: (rect, masksJson) => {
129
- if (this.wgpuViewId === null) return;
130
- send("wgpuTagResize", {
131
- id: this.wgpuViewId,
132
- frame: rect,
133
- masks: masksJson,
134
- });
135
- },
136
- getMasks,
137
- burstIntervalMs: 10,
138
- baseIntervalMs: 100,
139
- burstDurationMs: 50,
140
- });
141
- this._sync.setLastRect(initialRect);
142
- this._sync.start();
143
- }
144
-
145
- syncDimensions(force = false) {
146
- if (!this._sync) return;
147
- if (force) {
148
- this._sync.forceSync();
149
- }
150
- }
151
-
152
- // Visibility methods
153
- toggleTransparent(value?: boolean) {
154
- if (this.wgpuViewId === null) return;
155
- this.transparent = value !== undefined ? value : !this.transparent;
156
- this.style.opacity = this.transparent ? "0" : "";
157
- send("wgpuTagSetTransparent", {
158
- id: this.wgpuViewId,
159
- transparent: this.transparent,
160
- });
161
- }
162
-
163
- togglePassthrough(value?: boolean) {
164
- if (this.wgpuViewId === null) return;
165
- this.passthroughEnabled =
166
- value !== undefined ? value : !this.passthroughEnabled;
167
- this.style.pointerEvents = this.passthroughEnabled ? "none" : "";
168
- send("wgpuTagSetPassthrough", {
169
- id: this.wgpuViewId,
170
- passthrough: this.passthroughEnabled,
171
- });
172
- }
173
-
174
- toggleHidden(value?: boolean) {
175
- if (this.wgpuViewId === null) return;
176
- this.hidden = value !== undefined ? value : !this.hidden;
177
- send("wgpuTagSetHidden", { id: this.wgpuViewId, hidden: this.hidden });
178
- }
179
-
180
- // Debug helper (native test renderer)
181
- runTest() {
182
- if (this.wgpuViewId === null) return;
183
- send("wgpuTagRunTest", { id: this.wgpuViewId });
184
- }
185
-
186
- // Mask management
187
- addMaskSelector(selector: string) {
188
- this.maskSelectors.add(selector);
189
- this.syncDimensions(true);
190
- }
191
-
192
- removeMaskSelector(selector: string) {
193
- this.maskSelectors.delete(selector);
194
- this.syncDimensions(true);
195
- }
196
-
197
- // Event handling
198
- on(event: WgpuTagEventType, listener: (event: CustomEvent) => void) {
199
- if (!this._eventListeners[event]) this._eventListeners[event] = [];
200
- this._eventListeners[event].push(listener);
201
- }
202
-
203
- off(event: WgpuTagEventType, listener: (event: CustomEvent) => void) {
204
- if (!this._eventListeners[event]) return;
205
- const idx = this._eventListeners[event].indexOf(listener);
206
- if (idx !== -1) this._eventListeners[event].splice(idx, 1);
207
- }
208
-
209
- emit(event: WgpuTagEventType, detail: unknown) {
210
- const listeners = this._eventListeners[event];
211
- if (listeners) {
212
- const customEvent = new CustomEvent(event, { detail });
213
- listeners.forEach((fn) => fn(customEvent));
214
- }
215
- }
216
- }
217
-
218
- export function initWgpuTag() {
219
- if (!customElements.get("electrobun-wgpu")) {
220
- customElements.define("electrobun-wgpu", ElectrobunWgpuTag);
221
- }
222
-
223
- const injectStyles = () => {
224
- const style = document.createElement("style");
225
- style.textContent = `
226
- electrobun-wgpu {
227
- display: block;
228
- width: 800px;
229
- height: 300px;
230
- background: #000;
231
- overflow: hidden;
232
- }
233
- `;
234
- if (document.head?.firstChild) {
235
- document.head.insertBefore(style, document.head.firstChild);
236
- } else if (document.head) {
237
- document.head.appendChild(style);
238
- }
239
- };
240
-
241
- if (document.head) {
242
- injectStyles();
243
- } else {
244
- document.addEventListener("DOMContentLoaded", injectStyles);
245
- }
246
- }
@@ -1,43 +0,0 @@
1
-
2
- ## Linux System Tray Support
3
-
4
- System tray functionality on Linux requires a compatible desktop environment or additional packages. Many modern Linux distributions (especially those using GNOME 3.26+) don't display system trays by default.
5
-
6
- ### Installation Instructions by Desktop Environment
7
-
8
- You probably need to tell users to install whatever system tray thing works on their linux distro or whatever.
9
-
10
- **For Unity:**
11
- ```bash
12
- # Install indicator support
13
- sudo apt install indicator-application
14
-
15
- ```
16
-
17
- **For KDE Plasma, XFCE, MATE, Cinnamon:**
18
- - System tray support works out of the box, no additional installation needed
19
-
20
- ### Alternative Installation Method
21
-
22
- You can also install the GNOME extension through your web browser:
23
- 1. Visit https://extensions.gnome.org/extension/615/appindicator-support/
24
- 2. Install the browser extension if prompted
25
- 3. Click the toggle to enable the extension
26
-
27
- ### Verifying Installation
28
-
29
- After installation and restart, system tray icons should appear in your top panel (usually top-right corner). If the tray still doesn't appear, your application will continue to function normally without tray support.
30
-
31
- ### Note for Application Developers
32
-
33
- When distributing Electrobun applications that use system tray:
34
- - Document the system tray requirements for GNOME users
35
- - Consider providing alternative UI access to tray functionality
36
- - The tray implementation gracefully handles environments where system tray is unavailable
37
-
38
-
39
- ### Application menus
40
- The standard file, edit, etc. menus are super jank and would complicated the complex OOPIF compositing we do on gtk windows and x11 so on linux they're not wired up. You can get the same functionality by just using html in your webview to make a menu like interface and rpc to bun.
41
-
42
- ### Context menus
43
- Likewise the showContextMenu functionality that works on mac to show an arbitrary context menu wherever the mouse is (regardless of what it's over or what app is focused) is just not a ux linux supports well so that's also a noop on linux