electrobun 0.5.0-beta.0 → 0.6.0-beta.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.
Files changed (78) hide show
  1. package/{templates/multitab-browser/bun.lock → bun.lock} +20 -13
  2. package/dist/api/bun/proc/native.ts +84 -16
  3. package/package.json +14 -16
  4. package/BETA_RELEASE.md +0 -67
  5. package/BUILD.md +0 -90
  6. package/LICENSE +0 -21
  7. package/README.md +0 -102
  8. package/debug.js +0 -5
  9. package/templates/hello-world/README.md +0 -57
  10. package/templates/hello-world/bun.lock +0 -225
  11. package/templates/hello-world/electrobun.config.ts +0 -28
  12. package/templates/hello-world/package.json +0 -16
  13. package/templates/hello-world/src/bun/index.ts +0 -15
  14. package/templates/hello-world/src/mainview/index.css +0 -124
  15. package/templates/hello-world/src/mainview/index.html +0 -46
  16. package/templates/hello-world/src/mainview/index.ts +0 -1
  17. package/templates/interactive-playground/README.md +0 -26
  18. package/templates/interactive-playground/assets/tray-icon.png +0 -0
  19. package/templates/interactive-playground/electrobun.config.ts +0 -36
  20. package/templates/interactive-playground/package-lock.json +0 -1112
  21. package/templates/interactive-playground/package.json +0 -15
  22. package/templates/interactive-playground/src/bun/demos/files.ts +0 -70
  23. package/templates/interactive-playground/src/bun/demos/menus.ts +0 -139
  24. package/templates/interactive-playground/src/bun/demos/rpc.ts +0 -83
  25. package/templates/interactive-playground/src/bun/demos/system.ts +0 -72
  26. package/templates/interactive-playground/src/bun/demos/updates.ts +0 -105
  27. package/templates/interactive-playground/src/bun/demos/windows.ts +0 -90
  28. package/templates/interactive-playground/src/bun/index.ts +0 -124
  29. package/templates/interactive-playground/src/bun/types/rpc.ts +0 -109
  30. package/templates/interactive-playground/src/mainview/components/EventLog.ts +0 -107
  31. package/templates/interactive-playground/src/mainview/components/Sidebar.ts +0 -65
  32. package/templates/interactive-playground/src/mainview/components/Toast.ts +0 -57
  33. package/templates/interactive-playground/src/mainview/demos/FileDemo.ts +0 -211
  34. package/templates/interactive-playground/src/mainview/demos/MenuDemo.ts +0 -102
  35. package/templates/interactive-playground/src/mainview/demos/RPCDemo.ts +0 -229
  36. package/templates/interactive-playground/src/mainview/demos/TrayDemo.ts +0 -132
  37. package/templates/interactive-playground/src/mainview/demos/WebViewDemo.ts +0 -465
  38. package/templates/interactive-playground/src/mainview/demos/WindowDemo.ts +0 -207
  39. package/templates/interactive-playground/src/mainview/index.css +0 -538
  40. package/templates/interactive-playground/src/mainview/index.html +0 -103
  41. package/templates/interactive-playground/src/mainview/index.ts +0 -238
  42. package/templates/multitab-browser/README.md +0 -34
  43. package/templates/multitab-browser/electrobun.config.ts +0 -32
  44. package/templates/multitab-browser/package-lock.json +0 -20
  45. package/templates/multitab-browser/package.json +0 -12
  46. package/templates/multitab-browser/src/bun/index.ts +0 -144
  47. package/templates/multitab-browser/src/bun/tabManager.ts +0 -200
  48. package/templates/multitab-browser/src/bun/types/rpc.ts +0 -78
  49. package/templates/multitab-browser/src/mainview/index.css +0 -487
  50. package/templates/multitab-browser/src/mainview/index.html +0 -94
  51. package/templates/multitab-browser/src/mainview/index.ts +0 -634
  52. package/templates/photo-booth/README.md +0 -108
  53. package/templates/photo-booth/bun.lock +0 -239
  54. package/templates/photo-booth/electrobun.config.ts +0 -32
  55. package/templates/photo-booth/package.json +0 -17
  56. package/templates/photo-booth/src/bun/index.ts +0 -92
  57. package/templates/photo-booth/src/mainview/index.css +0 -465
  58. package/templates/photo-booth/src/mainview/index.html +0 -124
  59. package/templates/photo-booth/src/mainview/index.ts +0 -499
  60. package/test-new-window-events.ts +0 -26
  61. package/test-new-window.html +0 -75
  62. package/test-npm-install.sh +0 -34
  63. package/tests/bun.lock +0 -14
  64. package/tests/electrobun.config.ts +0 -45
  65. package/tests/package-lock.json +0 -36
  66. package/tests/package.json +0 -13
  67. package/tests/src/bun/index.ts +0 -100
  68. package/tests/src/bun/test-runner.ts +0 -508
  69. package/tests/src/mainview/index.html +0 -110
  70. package/tests/src/mainview/index.ts +0 -458
  71. package/tests/src/mainview/styles/main.css +0 -451
  72. package/tests/src/testviews/tray-test.html +0 -57
  73. package/tests/src/testviews/webview-mask.html +0 -114
  74. package/tests/src/testviews/webview-navigation.html +0 -36
  75. package/tests/src/testviews/window-create.html +0 -17
  76. package/tests/src/testviews/window-events.html +0 -29
  77. package/tests/src/testviews/window-focus.html +0 -37
  78. package/tests/src/webviewtag/index.ts +0 -11
@@ -1,78 +0,0 @@
1
- import type { RPCSchema } from "electrobun/bun";
2
-
3
- export type Tab = {
4
- id: string;
5
- title: string;
6
- url: string;
7
- canGoBack: boolean;
8
- canGoForward: boolean;
9
- isLoading: boolean;
10
- favicon?: string;
11
- };
12
-
13
- export type Bookmark = {
14
- id: string;
15
- title: string;
16
- url: string;
17
- createdAt: number;
18
- };
19
-
20
- export type BrowserRPC = {
21
- bun: RPCSchema<{
22
- requests: {
23
- createTab: {
24
- params: { url?: string };
25
- response: Tab;
26
- };
27
- closeTab: {
28
- params: { id: string };
29
- response: void;
30
- };
31
- navigateTo: {
32
- params: { tabId: string; url: string };
33
- response: void;
34
- };
35
- goBack: {
36
- params: { tabId: string };
37
- response: void;
38
- };
39
- goForward: {
40
- params: { tabId: string };
41
- response: void;
42
- };
43
- reload: {
44
- params: { tabId: string };
45
- response: void;
46
- };
47
- getTabInfo: {
48
- params: { tabId: string };
49
- response: Tab;
50
- };
51
- getAllTabs: {
52
- params: {};
53
- response: Tab[];
54
- };
55
- addBookmark: {
56
- params: { title: string; url: string };
57
- response: Bookmark;
58
- };
59
- getBookmarks: {
60
- params: {};
61
- response: Bookmark[];
62
- };
63
- removeBookmark: {
64
- params: { id: string };
65
- response: void;
66
- };
67
- };
68
- messages: {
69
- tabUpdated: Tab;
70
- tabClosed: { id: string };
71
- loadingStateChanged: { tabId: string; isLoading: boolean };
72
- };
73
- }>;
74
- webview: RPCSchema<{
75
- requests: {};
76
- messages: {};
77
- }>;
78
- };
@@ -1,487 +0,0 @@
1
- * {
2
- margin: 0;
3
- padding: 0;
4
- box-sizing: border-box;
5
- }
6
-
7
- body {
8
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
9
- background: #f5f5f5;
10
- overflow: hidden;
11
- user-select: none;
12
- }
13
-
14
- #browser-container {
15
- display: flex;
16
- flex-direction: column;
17
- height: 100vh;
18
- }
19
-
20
- /* Tab Bar */
21
- #tab-bar {
22
- display: flex;
23
- background: #e0e0e0;
24
- border-bottom: 1px solid #ccc;
25
- padding: 4px 4px 0;
26
- min-height: 36px;
27
- -webkit-app-region: drag;
28
- }
29
-
30
- #tabs-container {
31
- display: flex;
32
- flex: 1;
33
- gap: 2px;
34
- -webkit-app-region: no-drag;
35
- }
36
-
37
- .tab {
38
- display: flex;
39
- align-items: center;
40
- background: #f0f0f0;
41
- border: 1px solid #d0d0d0;
42
- border-bottom: none;
43
- border-radius: 8px 8px 0 0;
44
- padding: 6px 12px;
45
- min-width: 120px;
46
- max-width: 240px;
47
- cursor: pointer;
48
- transition: background 0.2s;
49
- -webkit-app-region: no-drag;
50
- }
51
-
52
- .tab:hover {
53
- background: #f8f8f8;
54
- }
55
-
56
- .tab.active {
57
- background: white;
58
- border-color: #ccc;
59
- }
60
-
61
- .tab-title {
62
- flex: 1;
63
- overflow: hidden;
64
- text-overflow: ellipsis;
65
- white-space: nowrap;
66
- font-size: 13px;
67
- }
68
-
69
- .tab-close {
70
- margin-left: 8px;
71
- background: none;
72
- border: none;
73
- color: #666;
74
- cursor: pointer;
75
- font-size: 16px;
76
- width: 18px;
77
- height: 18px;
78
- border-radius: 3px;
79
- display: flex;
80
- align-items: center;
81
- justify-content: center;
82
- transition: background 0.2s;
83
- }
84
-
85
- .tab-close:hover {
86
- background: rgba(0, 0, 0, 0.1);
87
- }
88
-
89
- #new-tab-btn {
90
- background: none;
91
- border: none;
92
- font-size: 20px;
93
- padding: 0 12px;
94
- cursor: pointer;
95
- color: #666;
96
- transition: background 0.2s;
97
- border-radius: 4px;
98
- -webkit-app-region: no-drag;
99
- }
100
-
101
- #new-tab-btn:hover {
102
- background: rgba(0, 0, 0, 0.1);
103
- }
104
-
105
- /* Navigation Bar */
106
- #nav-bar {
107
- display: flex;
108
- align-items: center;
109
- background: white;
110
- border-bottom: 1px solid #ddd;
111
- padding: 8px 12px;
112
- gap: 12px;
113
- }
114
-
115
- .nav-controls {
116
- display: flex;
117
- gap: 4px;
118
- }
119
-
120
- .nav-btn {
121
- background: none;
122
- border: 1px solid transparent;
123
- width: 32px;
124
- height: 32px;
125
- border-radius: 6px;
126
- cursor: pointer;
127
- display: flex;
128
- align-items: center;
129
- justify-content: center;
130
- transition: all 0.2s;
131
- color: #333;
132
- }
133
-
134
- .nav-btn:hover:not(:disabled) {
135
- background: #f0f0f0;
136
- border-color: #ddd;
137
- }
138
-
139
- .nav-btn:disabled {
140
- opacity: 0.3;
141
- cursor: not-allowed;
142
- }
143
-
144
- .nav-btn.bookmarked {
145
- color: #f39c12;
146
- background: rgba(243, 156, 18, 0.1);
147
- border-color: #f39c12;
148
- }
149
-
150
- .nav-btn.bookmarked svg {
151
- fill: currentColor;
152
- }
153
-
154
- .url-container {
155
- flex: 1;
156
- }
157
-
158
- #url-bar {
159
- width: 100%;
160
- padding: 8px 12px;
161
- border: 1px solid #ddd;
162
- border-radius: 20px;
163
- font-size: 14px;
164
- background: #f8f8f8;
165
- transition: all 0.2s;
166
- }
167
-
168
- #url-bar:focus {
169
- outline: none;
170
- background: white;
171
- border-color: #4a90e2;
172
- box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
173
- }
174
-
175
- .nav-actions {
176
- display: flex;
177
- gap: 4px;
178
- }
179
-
180
- /* Bookmarks Dropdown */
181
- #bookmarks-dropdown {
182
- position: absolute;
183
- top: 108px;
184
- right: 12px;
185
- background: white;
186
- border: 1px solid #ddd;
187
- border-radius: 8px;
188
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
189
- width: 320px;
190
- max-height: 400px;
191
- overflow-y: auto;
192
- z-index: 1000;
193
- }
194
-
195
- #bookmarks-dropdown.hidden {
196
- display: none;
197
- }
198
-
199
- .bookmarks-header {
200
- padding: 12px 16px;
201
- border-bottom: 1px solid #eee;
202
- display: flex;
203
- justify-content: space-between;
204
- align-items: center;
205
- }
206
-
207
- .bookmarks-header h3 {
208
- font-size: 14px;
209
- font-weight: 600;
210
- color: #333;
211
- margin: 0;
212
- }
213
-
214
- .reset-btn {
215
- background: #4a90e2;
216
- color: white;
217
- border: 1px solid #4a90e2;
218
- border-radius: 4px;
219
- padding: 5px 10px;
220
- font-size: 12px;
221
- cursor: pointer;
222
- transition: all 0.2s;
223
- font-weight: 500;
224
- }
225
-
226
- .reset-btn:hover {
227
- background: #357abd;
228
- border-color: #357abd;
229
- }
230
-
231
- #bookmarks-list {
232
- padding: 8px;
233
- }
234
-
235
- .bookmark-item {
236
- display: flex;
237
- align-items: center;
238
- padding: 8px;
239
- border-radius: 6px;
240
- cursor: pointer;
241
- transition: background 0.2s;
242
- }
243
-
244
- .bookmark-item:hover {
245
- background: #f8f8f8;
246
- }
247
-
248
- .bookmark-info {
249
- flex: 1;
250
- overflow: hidden;
251
- }
252
-
253
- .bookmark-title {
254
- font-size: 13px;
255
- font-weight: 500;
256
- color: #333;
257
- overflow: hidden;
258
- text-overflow: ellipsis;
259
- white-space: nowrap;
260
- }
261
-
262
- .bookmark-url {
263
- font-size: 11px;
264
- color: #666;
265
- overflow: hidden;
266
- text-overflow: ellipsis;
267
- white-space: nowrap;
268
- margin-top: 2px;
269
- }
270
-
271
- .bookmark-delete {
272
- background: none;
273
- border: none;
274
- color: #999;
275
- cursor: pointer;
276
- font-size: 18px;
277
- width: 24px;
278
- height: 24px;
279
- border-radius: 4px;
280
- display: flex;
281
- align-items: center;
282
- justify-content: center;
283
- transition: all 0.2s;
284
- }
285
-
286
- .bookmark-delete:hover {
287
- background: rgba(255, 0, 0, 0.1);
288
- color: #e74c3c;
289
- }
290
-
291
- .no-bookmarks {
292
- padding: 24px;
293
- text-align: center;
294
- color: #999;
295
- font-size: 13px;
296
- }
297
-
298
- /* Content Area */
299
- #content-area {
300
- flex: 1;
301
- position: relative;
302
- background: white;
303
- }
304
-
305
- #webview-container {
306
- position: relative;
307
- width: 100%;
308
- height: 100%;
309
- display: none;
310
- }
311
-
312
- /* Style for electrobun-webview elements */
313
- electrobun-webview {
314
- position: absolute;
315
- top: 0;
316
- left: 0;
317
- width: 100%;
318
- height: 100%;
319
- display: none;
320
- }
321
-
322
- electrobun-webview.active {
323
- display: block;
324
- }
325
-
326
- #welcome-screen {
327
- display: flex;
328
- flex-direction: column;
329
- align-items: center;
330
- justify-content: center;
331
- height: 100%;
332
- padding: 48px;
333
- }
334
-
335
- #welcome-screen h1 {
336
- font-size: 32px;
337
- font-weight: 300;
338
- color: #333;
339
- margin-bottom: 16px;
340
- }
341
-
342
- #welcome-screen p {
343
- font-size: 16px;
344
- color: #666;
345
- margin-bottom: 48px;
346
- }
347
-
348
- .keyboard-shortcut {
349
- background: #f0f0f0;
350
- padding: 2px 6px;
351
- border-radius: 3px;
352
- font-family: monospace;
353
- font-size: 14px;
354
- border: 1px solid #ddd;
355
- }
356
-
357
- .quick-links {
358
- width: 100%;
359
- max-width: 600px;
360
- }
361
-
362
- .quick-links h3 {
363
- font-size: 14px;
364
- font-weight: 600;
365
- color: #666;
366
- margin-bottom: 16px;
367
- text-transform: uppercase;
368
- letter-spacing: 0.5px;
369
- }
370
-
371
- #quick-links-container {
372
- display: grid;
373
- grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
374
- gap: 16px;
375
- }
376
-
377
- .quick-link {
378
- display: flex;
379
- flex-direction: column;
380
- align-items: center;
381
- padding: 16px 8px;
382
- background: #f8f8f8;
383
- border: 1px solid #e0e0e0;
384
- border-radius: 8px;
385
- cursor: pointer;
386
- transition: all 0.2s;
387
- }
388
-
389
- .quick-link:hover {
390
- background: white;
391
- border-color: #4a90e2;
392
- transform: translateY(-2px);
393
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
394
- }
395
-
396
- .quick-link-favicon {
397
- font-size: 24px;
398
- margin-bottom: 8px;
399
- }
400
-
401
- .quick-link-title {
402
- font-size: 12px;
403
- color: #333;
404
- text-align: center;
405
- overflow: hidden;
406
- text-overflow: ellipsis;
407
- white-space: nowrap;
408
- width: 100%;
409
- }
410
-
411
- .reset-bookmarks-quick {
412
- background: #4a90e2 !important;
413
- color: white !important;
414
- border-color: #4a90e2 !important;
415
- }
416
-
417
- .reset-bookmarks-quick:hover {
418
- background: #357abd !important;
419
- border-color: #357abd !important;
420
- }
421
-
422
- .reset-bookmarks-quick .quick-link-title {
423
- color: white !important;
424
- }
425
-
426
- .reset-fallback-btn {
427
- background: #4a90e2;
428
- color: white;
429
- border: 1px solid #4a90e2;
430
- border-radius: 6px;
431
- padding: 10px 20px;
432
- font-size: 14px;
433
- cursor: pointer;
434
- transition: all 0.2s;
435
- font-weight: 500;
436
- }
437
-
438
- .reset-fallback-btn:hover {
439
- background: #357abd;
440
- border-color: #357abd;
441
- }
442
-
443
- /* Loading Indicator */
444
- #loading-indicator {
445
- position: absolute;
446
- top: 50%;
447
- left: 50%;
448
- transform: translate(-50%, -50%);
449
- z-index: 100;
450
- }
451
-
452
- #loading-indicator.hidden {
453
- display: none;
454
- }
455
-
456
- .spinner {
457
- width: 40px;
458
- height: 40px;
459
- border: 4px solid #f3f3f3;
460
- border-top: 4px solid #4a90e2;
461
- border-radius: 50%;
462
- animation: spin 1s linear infinite;
463
- }
464
-
465
- @keyframes spin {
466
- 0% { transform: rotate(0deg); }
467
- 100% { transform: rotate(360deg); }
468
- }
469
-
470
- /* Scrollbar Styling */
471
- ::-webkit-scrollbar {
472
- width: 8px;
473
- height: 8px;
474
- }
475
-
476
- ::-webkit-scrollbar-track {
477
- background: #f1f1f1;
478
- }
479
-
480
- ::-webkit-scrollbar-thumb {
481
- background: #888;
482
- border-radius: 4px;
483
- }
484
-
485
- ::-webkit-scrollbar-thumb:hover {
486
- background: #555;
487
- }
@@ -1,94 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Multitab Browser</title>
7
- <link rel="stylesheet" href="index.css">
8
- </head>
9
- <body>
10
- <div id="browser-container">
11
- <!-- Tab Bar -->
12
- <div id="tab-bar">
13
- <div id="tabs-container"></div>
14
- <button id="new-tab-btn" title="New Tab">+</button>
15
- </div>
16
-
17
- <!-- Navigation Bar -->
18
- <div id="nav-bar">
19
- <div class="nav-controls">
20
- <button id="back-btn" class="nav-btn" disabled title="Go Back">
21
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
22
- <path d="M19 12H5M12 19l-7-7 7-7"/>
23
- </svg>
24
- </button>
25
- <button id="forward-btn" class="nav-btn" disabled title="Go Forward">
26
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
27
- <path d="M5 12h14M12 5l7 7-7 7"/>
28
- </svg>
29
- </button>
30
- <button id="reload-btn" class="nav-btn" title="Reload">
31
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
32
- <path d="M23 4v6h-6M1 20v-6h6M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
33
- </svg>
34
- </button>
35
- <button id="home-btn" class="nav-btn" title="Home">
36
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
37
- <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
38
- </svg>
39
- </button>
40
- </div>
41
-
42
- <div class="url-container">
43
- <input type="text" id="url-bar" placeholder="Enter URL or search..." />
44
- </div>
45
-
46
- <div class="nav-actions">
47
- <button id="bookmark-btn" class="nav-btn" title="Bookmark this page">
48
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
49
- <path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/>
50
- </svg>
51
- </button>
52
- <button id="bookmarks-menu-btn" class="nav-btn" title="Show bookmarks">
53
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
54
- <circle cx="12" cy="12" r="1"/>
55
- <circle cx="12" cy="5" r="1"/>
56
- <circle cx="12" cy="19" r="1"/>
57
- </svg>
58
- </button>
59
- </div>
60
- </div>
61
-
62
- <!-- Bookmarks Dropdown -->
63
- <div id="bookmarks-dropdown" class="hidden">
64
- <div class="bookmarks-header">
65
- <h3>Bookmarks</h3>
66
- <button id="reset-bookmarks-btn" class="reset-btn" title="Reset to default bookmarks">Reset</button>
67
- </div>
68
- <div id="bookmarks-list"></div>
69
- </div>
70
-
71
- <!-- Content Area -->
72
- <div id="content-area">
73
- <div id="webview-container">
74
- <!-- Webviews for each tab will be added here dynamically -->
75
- </div>
76
- <div id="welcome-screen">
77
- <h1>Welcome to Multitab Browser</h1>
78
- <p>Click the + button or press <span class="keyboard-shortcut">Cmd/Ctrl+T</span> to open a new tab</p>
79
- <div class="quick-links">
80
- <h3>Bookmarks</h3>
81
- <div id="quick-links-container"></div>
82
- </div>
83
- </div>
84
- </div>
85
-
86
- <!-- Loading Indicator -->
87
- <div id="loading-indicator" class="hidden">
88
- <div class="spinner"></div>
89
- </div>
90
- </div>
91
-
92
- <script src="index.js" type="module"></script>
93
- </body>
94
- </html>