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,111 +0,0 @@
1
- (function(){// src/bun/preload/events.ts
2
- function emitWebviewEvent(eventName, detail) {
3
- setTimeout(() => {
4
- const bridge = window.__electrobunEventBridge || window.__electrobunInternalBridge;
5
- bridge?.postMessage(JSON.stringify({
6
- id: "webviewEvent",
7
- type: "message",
8
- payload: {
9
- id: window.__electrobunWebviewId,
10
- eventName,
11
- detail
12
- }
13
- }));
14
- });
15
- }
16
- function initLifecycleEvents() {
17
- window.addEventListener("load", () => {
18
- if (window === window.top) {
19
- emitWebviewEvent("dom-ready", document.location.href);
20
- }
21
- });
22
- window.addEventListener("popstate", () => {
23
- emitWebviewEvent("did-navigate-in-page", window.location.href);
24
- });
25
- window.addEventListener("hashchange", () => {
26
- emitWebviewEvent("did-navigate-in-page", window.location.href);
27
- });
28
- }
29
- var cmdKeyHeld = false;
30
- var cmdKeyTimestamp = 0;
31
- var CMD_KEY_THRESHOLD_MS = 500;
32
- function isCmdHeld() {
33
- if (cmdKeyHeld)
34
- return true;
35
- return Date.now() - cmdKeyTimestamp < CMD_KEY_THRESHOLD_MS && cmdKeyTimestamp > 0;
36
- }
37
- function initCmdClickHandling() {
38
- window.addEventListener("keydown", (event) => {
39
- if (event.key === "Meta" || event.metaKey) {
40
- cmdKeyHeld = true;
41
- cmdKeyTimestamp = Date.now();
42
- }
43
- }, true);
44
- window.addEventListener("keyup", (event) => {
45
- if (event.key === "Meta") {
46
- cmdKeyHeld = false;
47
- cmdKeyTimestamp = Date.now();
48
- }
49
- }, true);
50
- window.addEventListener("blur", () => {
51
- cmdKeyHeld = false;
52
- });
53
- window.addEventListener("click", (event) => {
54
- if (event.metaKey || event.ctrlKey) {
55
- const anchor = event.target?.closest?.("a");
56
- if (anchor && anchor.href) {
57
- event.preventDefault();
58
- event.stopPropagation();
59
- event.stopImmediatePropagation();
60
- emitWebviewEvent("new-window-open", JSON.stringify({
61
- url: anchor.href,
62
- isCmdClick: true,
63
- isSPANavigation: false
64
- }));
65
- }
66
- }
67
- }, true);
68
- }
69
- function initSPANavigationInterception() {
70
- const originalPushState = history.pushState;
71
- const originalReplaceState = history.replaceState;
72
- history.pushState = function(state, title, url) {
73
- if (isCmdHeld() && url) {
74
- const resolvedUrl = new URL(String(url), window.location.href).href;
75
- emitWebviewEvent("new-window-open", JSON.stringify({
76
- url: resolvedUrl,
77
- isCmdClick: true,
78
- isSPANavigation: true
79
- }));
80
- return;
81
- }
82
- return originalPushState.apply(this, [state, title, url]);
83
- };
84
- history.replaceState = function(state, title, url) {
85
- if (isCmdHeld() && url) {
86
- const resolvedUrl = new URL(String(url), window.location.href).href;
87
- emitWebviewEvent("new-window-open", JSON.stringify({
88
- url: resolvedUrl,
89
- isCmdClick: true,
90
- isSPANavigation: true
91
- }));
92
- return;
93
- }
94
- return originalReplaceState.apply(this, [state, title, url]);
95
- };
96
- }
97
- function initOverscrollPrevention() {
98
- document.addEventListener("DOMContentLoaded", () => {
99
- const style = document.createElement("style");
100
- style.type = "text/css";
101
- style.appendChild(document.createTextNode("html, body { overscroll-behavior: none; }"));
102
- document.head.appendChild(style);
103
- });
104
- }
105
-
106
- // src/bun/preload/index-sandboxed.ts
107
- initLifecycleEvents();
108
- initCmdClickHandling();
109
- initSPANavigationInterception();
110
- initOverscrollPrevention();
111
- })();