electrobun 0.0.19-beta.11 → 0.0.19-beta.111

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 (46) hide show
  1. package/BUILD.md +90 -0
  2. package/bin/electrobun.cjs +39 -14
  3. package/debug.js +5 -0
  4. package/dist/api/browser/builtinrpcSchema.ts +19 -0
  5. package/dist/api/browser/index.ts +409 -0
  6. package/dist/api/browser/rpc/webview.ts +79 -0
  7. package/dist/api/browser/stylesAndElements.ts +3 -0
  8. package/dist/api/browser/webviewtag.ts +534 -0
  9. package/dist/api/bun/core/ApplicationMenu.ts +66 -0
  10. package/dist/api/bun/core/BrowserView.ts +349 -0
  11. package/dist/api/bun/core/BrowserWindow.ts +191 -0
  12. package/dist/api/bun/core/ContextMenu.ts +67 -0
  13. package/dist/api/bun/core/Paths.ts +5 -0
  14. package/dist/api/bun/core/Socket.ts +181 -0
  15. package/dist/api/bun/core/Tray.ts +107 -0
  16. package/dist/api/bun/core/Updater.ts +680 -0
  17. package/dist/api/bun/core/Utils.ts +48 -0
  18. package/dist/api/bun/events/ApplicationEvents.ts +14 -0
  19. package/dist/api/bun/events/event.ts +29 -0
  20. package/dist/api/bun/events/eventEmitter.ts +45 -0
  21. package/dist/api/bun/events/trayEvents.ts +9 -0
  22. package/dist/api/bun/events/webviewEvents.ts +16 -0
  23. package/dist/api/bun/events/windowEvents.ts +12 -0
  24. package/dist/api/bun/index.ts +45 -0
  25. package/dist/api/bun/proc/linux.md +43 -0
  26. package/dist/api/bun/proc/native.ts +1220 -0
  27. package/dist/api/shared/platform.ts +48 -0
  28. package/dist/main.js +54 -0
  29. package/package.json +9 -6
  30. package/src/cli/index.ts +1227 -223
  31. package/templates/hello-world/README.md +57 -0
  32. package/templates/hello-world/bun.lock +63 -0
  33. package/templates/hello-world/electrobun.config +18 -0
  34. package/templates/hello-world/package.json +16 -0
  35. package/templates/hello-world/src/bun/index.ts +15 -0
  36. package/templates/hello-world/src/mainview/index.css +124 -0
  37. package/templates/hello-world/src/mainview/index.html +50 -0
  38. package/templates/hello-world/src/mainview/index.ts +24 -0
  39. package/templates/photo-booth/README.md +108 -0
  40. package/templates/photo-booth/bun.lock +225 -0
  41. package/templates/photo-booth/electrobun.config +28 -0
  42. package/templates/photo-booth/package.json +16 -0
  43. package/templates/photo-booth/src/bun/index.ts +91 -0
  44. package/templates/photo-booth/src/mainview/index.css +353 -0
  45. package/templates/photo-booth/src/mainview/index.html +95 -0
  46. package/templates/photo-booth/src/mainview/index.ts +584 -0
@@ -0,0 +1,353 @@
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: #1a1a1a;
10
+ color: #ffffff;
11
+ overflow: hidden;
12
+ }
13
+
14
+ .container {
15
+ height: 100vh;
16
+ display: flex;
17
+ flex-direction: column;
18
+ }
19
+
20
+ header {
21
+ background: #2a2a2a;
22
+ padding: 1rem 2rem;
23
+ display: flex;
24
+ justify-content: space-between;
25
+ align-items: center;
26
+ border-bottom: 1px solid #3a3a3a;
27
+ }
28
+
29
+ h1 {
30
+ font-size: 1.5rem;
31
+ font-weight: 600;
32
+ }
33
+
34
+ .status {
35
+ display: flex;
36
+ align-items: center;
37
+ gap: 0.5rem;
38
+ font-size: 0.875rem;
39
+ color: #999;
40
+ }
41
+
42
+ .status-dot {
43
+ width: 8px;
44
+ height: 8px;
45
+ border-radius: 50%;
46
+ background: #666;
47
+ transition: background 0.3s;
48
+ }
49
+
50
+ .status.active .status-dot {
51
+ background: #4CAF50;
52
+ box-shadow: 0 0 8px #4CAF50;
53
+ }
54
+
55
+ .status.error .status-dot {
56
+ background: #f44336;
57
+ }
58
+
59
+ main {
60
+ flex: 1;
61
+ display: flex;
62
+ overflow: hidden;
63
+ }
64
+
65
+ .camera-section {
66
+ flex: 1;
67
+ display: flex;
68
+ flex-direction: column;
69
+ padding: 2rem;
70
+ gap: 1.5rem;
71
+ }
72
+
73
+ .video-container {
74
+ flex: 1;
75
+ position: relative;
76
+ background: #000;
77
+ border-radius: 12px;
78
+ overflow: hidden;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ }
83
+
84
+ #video {
85
+ width: 100%;
86
+ height: 100%;
87
+ object-fit: cover;
88
+ }
89
+
90
+ .countdown {
91
+ position: absolute;
92
+ top: 50%;
93
+ left: 50%;
94
+ transform: translate(-50%, -50%);
95
+ font-size: 8rem;
96
+ font-weight: bold;
97
+ color: white;
98
+ text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
99
+ opacity: 0;
100
+ transition: opacity 0.3s;
101
+ }
102
+
103
+ .countdown.active {
104
+ opacity: 1;
105
+ }
106
+
107
+ .controls {
108
+ display: flex;
109
+ flex-direction: column;
110
+ gap: 1rem;
111
+ align-items: center;
112
+ }
113
+
114
+ .capture-btn {
115
+ display: flex;
116
+ align-items: center;
117
+ gap: 0.75rem;
118
+ padding: 0.75rem 2rem;
119
+ font-size: 1rem;
120
+ font-weight: 500;
121
+ background: #007AFF;
122
+ color: white;
123
+ border: none;
124
+ border-radius: 8px;
125
+ cursor: pointer;
126
+ transition: all 0.3s;
127
+ }
128
+
129
+ .capture-btn:hover:not(:disabled) {
130
+ background: #0056b3;
131
+ transform: scale(1.05);
132
+ }
133
+
134
+ .capture-btn:active:not(:disabled) {
135
+ transform: scale(0.95);
136
+ }
137
+
138
+ .capture-btn:disabled {
139
+ background: #444;
140
+ cursor: not-allowed;
141
+ opacity: 0.6;
142
+ }
143
+
144
+ .settings {
145
+ display: flex;
146
+ gap: 2rem;
147
+ align-items: center;
148
+ }
149
+
150
+ .settings label {
151
+ display: flex;
152
+ align-items: center;
153
+ gap: 0.5rem;
154
+ cursor: pointer;
155
+ }
156
+
157
+ .settings input[type="checkbox"] {
158
+ width: 18px;
159
+ height: 18px;
160
+ cursor: pointer;
161
+ }
162
+
163
+ .camera-select {
164
+ padding: 0.5rem;
165
+ background: #2a2a2a;
166
+ color: white;
167
+ border: 1px solid #3a3a3a;
168
+ border-radius: 4px;
169
+ cursor: pointer;
170
+ }
171
+
172
+ .change-source-btn {
173
+ display: flex;
174
+ align-items: center;
175
+ gap: 0.5rem;
176
+ padding: 0.5rem 1rem;
177
+ background: #444;
178
+ color: white;
179
+ border: 1px solid #555;
180
+ border-radius: 4px;
181
+ cursor: pointer;
182
+ font-size: 0.875rem;
183
+ transition: background 0.2s;
184
+ }
185
+
186
+ .change-source-btn:hover {
187
+ background: #555;
188
+ }
189
+
190
+ .gallery-section {
191
+ width: 300px;
192
+ background: #2a2a2a;
193
+ padding: 1.5rem;
194
+ overflow-y: auto;
195
+ border-left: 1px solid #3a3a3a;
196
+ }
197
+
198
+ .gallery-section h2 {
199
+ font-size: 1.125rem;
200
+ margin-bottom: 1rem;
201
+ }
202
+
203
+ .gallery {
204
+ display: grid;
205
+ grid-template-columns: repeat(2, 1fr);
206
+ gap: 0.75rem;
207
+ }
208
+
209
+ .empty-state {
210
+ grid-column: 1 / -1;
211
+ text-align: center;
212
+ color: #666;
213
+ padding: 2rem 0;
214
+ font-size: 0.875rem;
215
+ }
216
+
217
+ .photo-item {
218
+ position: relative;
219
+ aspect-ratio: 1;
220
+ border-radius: 8px;
221
+ overflow: hidden;
222
+ cursor: pointer;
223
+ transition: transform 0.2s;
224
+ }
225
+
226
+ .photo-item:hover {
227
+ transform: scale(1.05);
228
+ }
229
+
230
+ .photo-item img {
231
+ width: 100%;
232
+ height: 100%;
233
+ object-fit: cover;
234
+ }
235
+
236
+ .photo-item .photo-time {
237
+ position: absolute;
238
+ bottom: 0;
239
+ left: 0;
240
+ right: 0;
241
+ background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
242
+ color: white;
243
+ font-size: 0.75rem;
244
+ padding: 0.5rem;
245
+ text-align: center;
246
+ }
247
+
248
+ .photo-modal {
249
+ display: none;
250
+ position: fixed;
251
+ top: 0;
252
+ left: 0;
253
+ right: 0;
254
+ bottom: 0;
255
+ background: rgba(0, 0, 0, 0.9);
256
+ z-index: 1000;
257
+ padding: 2rem;
258
+ }
259
+
260
+ .photo-modal.active {
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+ }
265
+
266
+ .modal-content {
267
+ position: relative;
268
+ max-width: 90vw;
269
+ max-height: 90vh;
270
+ display: flex;
271
+ flex-direction: column;
272
+ gap: 1rem;
273
+ }
274
+
275
+ .modal-close {
276
+ position: absolute;
277
+ top: -40px;
278
+ right: 0;
279
+ background: none;
280
+ border: none;
281
+ color: white;
282
+ font-size: 2rem;
283
+ cursor: pointer;
284
+ width: 40px;
285
+ height: 40px;
286
+ display: flex;
287
+ align-items: center;
288
+ justify-content: center;
289
+ border-radius: 4px;
290
+ transition: background 0.2s;
291
+ }
292
+
293
+ .modal-close:hover {
294
+ background: rgba(255, 255, 255, 0.1);
295
+ }
296
+
297
+ #modalImage {
298
+ max-width: 100%;
299
+ max-height: calc(90vh - 60px);
300
+ object-fit: contain;
301
+ border-radius: 8px;
302
+ }
303
+
304
+ .modal-actions {
305
+ display: flex;
306
+ gap: 1rem;
307
+ justify-content: center;
308
+ }
309
+
310
+ .action-btn {
311
+ display: flex;
312
+ align-items: center;
313
+ gap: 0.5rem;
314
+ padding: 0.75rem 1.5rem;
315
+ background: #007AFF;
316
+ color: white;
317
+ border: none;
318
+ border-radius: 6px;
319
+ cursor: pointer;
320
+ font-size: 0.875rem;
321
+ font-weight: 500;
322
+ transition: background 0.2s;
323
+ }
324
+
325
+ .action-btn:hover {
326
+ background: #0056b3;
327
+ }
328
+
329
+ .action-btn.danger {
330
+ background: #dc3545;
331
+ }
332
+
333
+ .action-btn.danger:hover {
334
+ background: #c82333;
335
+ }
336
+
337
+ @media (max-width: 768px) {
338
+ main {
339
+ flex-direction: column;
340
+ }
341
+
342
+ .gallery-section {
343
+ width: 100%;
344
+ border-left: none;
345
+ border-top: 1px solid #3a3a3a;
346
+ height: 200px;
347
+ flex-shrink: 0;
348
+ }
349
+
350
+ .gallery {
351
+ grid-template-columns: repeat(3, 1fr);
352
+ }
353
+ }
@@ -0,0 +1,95 @@
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>Photo Booth</title>
7
+ <link rel="stylesheet" href="./index.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <h1>Photo Booth / Screenshot Tool</h1>
13
+ <div class="status" id="status">
14
+ <span class="status-dot"></span>
15
+ <span class="status-text">Initializing media...</span>
16
+ </div>
17
+ </header>
18
+
19
+ <main>
20
+ <div class="camera-section">
21
+ <div class="video-container">
22
+ <video id="video" autoplay playsinline></video>
23
+ <canvas id="canvas" style="display: none;"></canvas>
24
+ <div class="countdown" id="countdown"></div>
25
+ </div>
26
+
27
+ <div class="controls">
28
+ <button id="captureBtn" class="capture-btn" disabled>
29
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
30
+ <circle cx="12" cy="12" r="10"/>
31
+ <circle cx="12" cy="12" r="7"/>
32
+ </svg>
33
+ Take Photo
34
+ </button>
35
+
36
+ <div class="settings">
37
+ <label>
38
+ <input type="checkbox" id="timerToggle">
39
+ <span>3s Timer</span>
40
+ </label>
41
+
42
+ <select id="cameraSelect" class="camera-select">
43
+ <option value="">Select Camera</option>
44
+ </select>
45
+
46
+ <button id="changeSourceBtn" class="change-source-btn" style="display: none;">
47
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
48
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
49
+ <circle cx="12" cy="12" r="3"/>
50
+ </svg>
51
+ Change Source
52
+ </button>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="gallery-section">
58
+ <h2>Captured Photos</h2>
59
+ <div class="gallery" id="gallery">
60
+ <div class="empty-state">
61
+ No photos/screenshots yet. Click the capture button to get started!
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </main>
66
+ </div>
67
+
68
+ <div class="photo-modal" id="photoModal">
69
+ <div class="modal-content">
70
+ <button class="modal-close" id="modalClose">&times;</button>
71
+ <img id="modalImage" src="" alt="Full size photo">
72
+ <div class="modal-actions">
73
+ <button id="downloadBtn" class="action-btn">
74
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
75
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
76
+ <polyline points="7 10 12 15 17 10"/>
77
+ <line x1="12" y1="15" x2="12" y2="3"/>
78
+ </svg>
79
+ Save
80
+ </button>
81
+ <button id="deleteBtn" class="action-btn danger">
82
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
83
+ <path d="M3 6h18"/>
84
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/>
85
+ <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
86
+ </svg>
87
+ Delete
88
+ </button>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <script src="./index.js"></script>
94
+ </body>
95
+ </html>