electrobun 0.0.19-beta.99 → 0.1.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 (77) hide show
  1. package/README.md +1 -1
  2. package/dist/api/browser/webviewtag.ts +54 -2
  3. package/dist/api/bun/ElectrobunConfig.ts +171 -0
  4. package/dist/api/bun/core/BrowserWindow.ts +4 -0
  5. package/dist/api/bun/core/Tray.ts +14 -0
  6. package/dist/api/bun/core/Updater.ts +4 -3
  7. package/dist/api/bun/index.ts +2 -0
  8. package/dist/api/bun/proc/native.ts +107 -5
  9. package/dist/main.js +5 -4
  10. package/package.json +4 -2
  11. package/src/cli/index.ts +565 -148
  12. package/templates/hello-world/bun.lock +164 -2
  13. package/templates/hello-world/electrobun.config.ts +28 -0
  14. package/templates/hello-world/src/bun/index.ts +2 -2
  15. package/templates/hello-world/src/mainview/index.html +5 -6
  16. package/templates/hello-world/src/mainview/index.ts +1 -5
  17. package/templates/interactive-playground/README.md +26 -0
  18. package/templates/interactive-playground/assets/tray-icon.png +0 -0
  19. package/templates/interactive-playground/electrobun.config.ts +36 -0
  20. package/templates/interactive-playground/package-lock.json +36 -0
  21. package/templates/interactive-playground/package.json +15 -0
  22. package/templates/interactive-playground/src/bun/demos/files.ts +70 -0
  23. package/templates/interactive-playground/src/bun/demos/menus.ts +139 -0
  24. package/templates/interactive-playground/src/bun/demos/rpc.ts +83 -0
  25. package/templates/interactive-playground/src/bun/demos/system.ts +72 -0
  26. package/templates/interactive-playground/src/bun/demos/updates.ts +105 -0
  27. package/templates/interactive-playground/src/bun/demos/windows.ts +90 -0
  28. package/templates/interactive-playground/src/bun/index.ts +124 -0
  29. package/templates/interactive-playground/src/bun/types/rpc.ts +109 -0
  30. package/templates/interactive-playground/src/mainview/components/EventLog.ts +107 -0
  31. package/templates/interactive-playground/src/mainview/components/Sidebar.ts +65 -0
  32. package/templates/interactive-playground/src/mainview/components/Toast.ts +57 -0
  33. package/templates/interactive-playground/src/mainview/demos/FileDemo.ts +211 -0
  34. package/templates/interactive-playground/src/mainview/demos/MenuDemo.ts +102 -0
  35. package/templates/interactive-playground/src/mainview/demos/RPCDemo.ts +229 -0
  36. package/templates/interactive-playground/src/mainview/demos/TrayDemo.ts +132 -0
  37. package/templates/interactive-playground/src/mainview/demos/WebViewDemo.ts +411 -0
  38. package/templates/interactive-playground/src/mainview/demos/WindowDemo.ts +207 -0
  39. package/templates/interactive-playground/src/mainview/index.css +538 -0
  40. package/templates/interactive-playground/src/mainview/index.html +103 -0
  41. package/templates/interactive-playground/src/mainview/index.ts +238 -0
  42. package/templates/multitab-browser/README.md +34 -0
  43. package/templates/multitab-browser/bun.lock +224 -0
  44. package/templates/multitab-browser/electrobun.config.ts +32 -0
  45. package/templates/multitab-browser/package-lock.json +20 -0
  46. package/templates/multitab-browser/package.json +12 -0
  47. package/templates/multitab-browser/src/bun/index.ts +144 -0
  48. package/templates/multitab-browser/src/bun/tabManager.ts +200 -0
  49. package/templates/multitab-browser/src/bun/types/rpc.ts +78 -0
  50. package/templates/multitab-browser/src/mainview/index.css +487 -0
  51. package/templates/multitab-browser/src/mainview/index.html +94 -0
  52. package/templates/multitab-browser/src/mainview/index.ts +634 -0
  53. package/templates/photo-booth/README.md +108 -0
  54. package/templates/photo-booth/bun.lock +239 -0
  55. package/templates/photo-booth/electrobun.config.ts +28 -0
  56. package/templates/photo-booth/package.json +16 -0
  57. package/templates/photo-booth/src/bun/index.ts +92 -0
  58. package/templates/photo-booth/src/mainview/index.css +465 -0
  59. package/templates/photo-booth/src/mainview/index.html +124 -0
  60. package/templates/photo-booth/src/mainview/index.ts +499 -0
  61. package/tests/bun.lock +14 -0
  62. package/tests/electrobun.config.ts +45 -0
  63. package/tests/package-lock.json +36 -0
  64. package/tests/package.json +13 -0
  65. package/tests/src/bun/index.ts +100 -0
  66. package/tests/src/bun/test-runner.ts +508 -0
  67. package/tests/src/mainview/index.html +110 -0
  68. package/tests/src/mainview/index.ts +458 -0
  69. package/tests/src/mainview/styles/main.css +451 -0
  70. package/tests/src/testviews/tray-test.html +57 -0
  71. package/tests/src/testviews/webview-mask.html +114 -0
  72. package/tests/src/testviews/webview-navigation.html +36 -0
  73. package/tests/src/testviews/window-create.html +17 -0
  74. package/tests/src/testviews/window-events.html +29 -0
  75. package/tests/src/testviews/window-focus.html +37 -0
  76. package/tests/src/webviewtag/index.ts +11 -0
  77. package/templates/hello-world/electrobun.config +0 -18
@@ -0,0 +1,487 @@
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
+ }
@@ -0,0 +1,94 @@
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>