@glassly/miniapp-cli 0.1.11 → 0.1.12-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/miniapp-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.12-beta.0",
4
4
  "description": "Build tooling for Glassly miniapps: dev server, packer, manifest validation, and JSON Schema. The `glassly` command that drives it ships in @glassly/cli.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,19 +1,45 @@
1
+ /* Same look as the Glassly dashboard's phone page: flat neutral panels, one soft accent, light and dark. */
1
2
  :root {
2
- color-scheme: dark;
3
- --ground: #101214;
4
- --surface: #171a1d;
5
- --raised: #1f2327;
6
- --line: #2b3036;
7
- --text: #e7e9ea;
8
- --dim: #8b949c;
9
- --ink: #00ff88;
10
- --warn: #f0b429;
11
- --bad: #ff6b5e;
3
+ color-scheme: light;
4
+ --page: #ffffff;
5
+ --panel: #f5f5f5;
6
+ --panel-2: #e5e5e5;
7
+ --line: #e5e5e5;
8
+ --ink: #0a0a0a;
9
+ --muted: #737373;
10
+ --accent: #86acff;
11
+ --switch-off: #d4d4d4;
12
+ --bad: #dc2626;
13
+ --warn: #b45309;
14
+ --source-background: #7c5cc4;
15
+ --source-ui: #2a7fb8;
16
+ --bezel: #0a0a0a;
17
+ --sans: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
12
18
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
19
+ --bar: 72px;
20
+ }
21
+
22
+ @media (prefers-color-scheme: dark) {
23
+ :root {
24
+ color-scheme: dark;
25
+ --page: #171717;
26
+ --panel: #2e2e2e;
27
+ --panel-2: #404040;
28
+ --line: #525252;
29
+ --ink: #fafafa;
30
+ --muted: #a3a3a3;
31
+ --switch-off: #ffffffcc;
32
+ --bad: #f87171;
33
+ --warn: #fbbf24;
34
+ --source-background: #b79cf7;
35
+ --source-ui: #6cc7e6;
36
+ --bezel: #000000;
37
+ }
13
38
  }
14
39
 
15
40
  * {
16
41
  box-sizing: border-box;
42
+ -webkit-tap-highlight-color: transparent;
17
43
  }
18
44
 
19
45
  [hidden] {
@@ -21,83 +47,109 @@
21
47
  }
22
48
 
23
49
  html,
24
- body {
25
- height: 100%;
26
- }
27
-
28
50
  body {
29
51
  margin: 0;
30
- display: grid;
31
- grid-template-rows: auto minmax(0, 1fr) minmax(140px, 28vh);
32
- background: var(--ground);
33
- color: var(--text);
34
- font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
52
+ background: var(--page);
53
+ color: var(--ink);
54
+ font-family: var(--sans);
55
+ font-size: 14px;
56
+ line-height: 1.5;
57
+ -webkit-font-smoothing: antialiased;
35
58
  }
36
59
 
37
60
  button,
38
- input {
61
+ input,
62
+ output {
39
63
  font: inherit;
40
64
  color: inherit;
41
65
  }
42
66
 
43
- .muted {
44
- color: var(--dim);
67
+ button {
68
+ cursor: pointer;
69
+ }
70
+
71
+ button:not(:disabled):active {
72
+ opacity: 0.65;
73
+ }
74
+
75
+ button:focus-visible,
76
+ input:focus-visible {
77
+ outline: 2px solid var(--accent);
78
+ outline-offset: 4px;
79
+ }
80
+
81
+ input::placeholder {
82
+ color: var(--muted);
45
83
  }
46
84
 
85
+ h1,
86
+ h2,
87
+ p {
88
+ margin: 0;
89
+ }
90
+
91
+ .spacer {
92
+ flex: 1;
93
+ }
94
+
95
+ /* Header */
96
+
47
97
  .bar {
48
98
  display: flex;
49
99
  align-items: center;
50
100
  justify-content: space-between;
51
101
  gap: 16px;
52
- padding: 8px 16px;
53
- border-bottom: 1px solid var(--line);
102
+ height: var(--bar);
103
+ padding: 0 24px;
54
104
  }
55
105
 
56
106
  .identity {
57
- display: flex;
58
- align-items: baseline;
59
- gap: 10px;
60
107
  min-width: 0;
61
- white-space: nowrap;
62
108
  }
63
109
 
64
- .mark {
65
- font-weight: 650;
66
- letter-spacing: 0.01em;
110
+ .identity h1 {
111
+ font-size: 20px;
112
+ line-height: 28px;
113
+ font-weight: 600;
114
+ overflow: hidden;
115
+ white-space: nowrap;
116
+ text-overflow: ellipsis;
67
117
  }
68
118
 
69
- .app-name {
70
- padding-left: 10px;
71
- border-left: 1px solid var(--line);
119
+ .sub {
120
+ font-size: 12px;
121
+ line-height: 18px;
122
+ color: var(--muted);
123
+ overflow: hidden;
124
+ white-space: nowrap;
125
+ text-overflow: ellipsis;
72
126
  }
73
127
 
74
128
  .bar-actions {
75
129
  display: flex;
76
130
  align-items: center;
77
- gap: 12px;
131
+ gap: 16px;
78
132
  }
79
133
 
80
134
  .state {
81
- font: 12px var(--mono);
82
- color: var(--dim);
135
+ display: inline-flex;
136
+ align-items: center;
137
+ gap: 8px;
138
+ font-size: 12px;
139
+ color: var(--muted);
140
+ white-space: nowrap;
83
141
  }
84
142
 
85
143
  .state::before {
86
144
  content: "";
87
- display: inline-block;
88
- width: 7px;
89
- height: 7px;
90
- margin-right: 6px;
145
+ width: 8px;
146
+ height: 8px;
91
147
  border-radius: 50%;
92
- background: var(--dim);
93
- }
94
-
95
- .state[data-state="running"] {
96
- color: var(--text);
148
+ background: var(--switch-off);
97
149
  }
98
150
 
99
151
  .state[data-state="running"]::before {
100
- background: var(--ink);
152
+ background: var(--accent);
101
153
  }
102
154
 
103
155
  .state[data-state="crashed"],
@@ -110,33 +162,113 @@ input {
110
162
  background: var(--bad);
111
163
  }
112
164
 
165
+ /* Layout: a scrolling page, or three full-height columns when the window can hold them */
166
+
113
167
  .bench {
114
168
  display: grid;
115
169
  grid-template-columns: minmax(0, 1fr) auto;
116
- gap: 20px;
117
- min-height: 0;
118
- padding: 16px;
119
- overflow: auto;
170
+ grid-template-areas:
171
+ "screen phone"
172
+ "controls phone"
173
+ "panel panel";
174
+ align-items: start;
175
+ gap: 24px 40px;
176
+ padding: 0 24px 24px;
120
177
  }
121
178
 
122
- .glasses {
123
- display: grid;
124
- grid-template-columns: minmax(380px, 760px) minmax(280px, 1fr);
125
- align-items: start;
126
- gap: 20px;
179
+ .display {
180
+ display: contents;
181
+ }
182
+
183
+ .screen {
184
+ grid-area: screen;
127
185
  min-width: 0;
128
186
  }
129
187
 
130
- .lens-wrap {
188
+ .panel {
189
+ grid-area: panel;
190
+ }
191
+
192
+ .controls {
193
+ grid-area: controls;
194
+ display: grid;
195
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
196
+ align-content: start;
197
+ gap: 24px 40px;
131
198
  min-width: 0;
132
199
  }
133
200
 
201
+ .phone {
202
+ grid-area: phone;
203
+ }
204
+
205
+ .lens {
206
+ width: min(100%, calc((100vh - var(--bar) - 300px) * 2));
207
+ min-width: min(100%, 320px);
208
+ }
209
+
210
+ @media (min-width: 1200px) {
211
+ body {
212
+ height: 100vh;
213
+ overflow: hidden;
214
+ }
215
+
216
+ .bench {
217
+ height: calc(100vh - var(--bar));
218
+ grid-template-columns: minmax(0, 1fr) 340px auto;
219
+ grid-template-areas: "display controls phone";
220
+ align-items: stretch;
221
+ }
222
+
223
+ .display {
224
+ grid-area: display;
225
+ display: flex;
226
+ flex-direction: column;
227
+ gap: 24px;
228
+ min-width: 0;
229
+ min-height: 0;
230
+ }
231
+
232
+ .controls {
233
+ grid-template-columns: minmax(0, 1fr);
234
+ overflow-y: auto;
235
+ padding-bottom: 24px;
236
+ }
237
+
238
+ .lens {
239
+ width: min(100%, calc((100vh - var(--bar) - 280px) * 2));
240
+ }
241
+
242
+ .panel {
243
+ flex: 1;
244
+ min-height: 0;
245
+ height: auto;
246
+ }
247
+ }
248
+
249
+ @media (max-width: 759px) {
250
+ .bar {
251
+ padding: 0 16px;
252
+ }
253
+
254
+ .bench {
255
+ grid-template-columns: minmax(0, 1fr);
256
+ grid-template-areas: "screen" "controls" "phone" "panel";
257
+ padding: 0 16px 16px;
258
+ }
259
+
260
+ .lens {
261
+ width: 100%;
262
+ }
263
+ }
264
+
265
+ /* Glasses display: black like the hardware in either theme */
266
+
134
267
  .lens {
135
268
  position: relative;
136
269
  aspect-ratio: 2 / 1;
137
- border-radius: 10px;
270
+ border-radius: 16px;
138
271
  background: #000;
139
- outline: 1px solid var(--line);
140
272
  overflow: hidden;
141
273
  }
142
274
 
@@ -151,153 +283,259 @@ input {
151
283
  inset: 0;
152
284
  display: grid;
153
285
  place-items: center;
154
- color: var(--dim);
155
- font: 12px var(--mono);
286
+ color: #a3a3a3;
156
287
  background: rgba(0, 0, 0, 0.7);
157
288
  }
158
289
 
159
290
  .lens-meta {
160
291
  display: flex;
161
292
  justify-content: space-between;
162
- padding: 6px 2px 0;
163
- font: 11px var(--mono);
293
+ gap: 16px;
294
+ margin: 8px 4px 0;
295
+ font-size: 12px;
296
+ line-height: 18px;
297
+ color: var(--muted);
164
298
  }
165
299
 
166
- .controls {
300
+ /* Controls */
301
+
302
+ .controls h2 {
303
+ margin-bottom: 8px;
304
+ font-size: 16px;
305
+ line-height: 24px;
306
+ font-weight: 400;
307
+ }
308
+
309
+ .keys {
167
310
  display: grid;
168
- gap: 14px;
169
- max-width: 520px;
311
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
312
+ gap: 8px;
170
313
  }
171
314
 
172
- fieldset {
173
- margin: 0;
174
- padding: 0;
315
+ .key {
316
+ display: flex;
317
+ align-items: center;
318
+ justify-content: space-between;
319
+ gap: 8px;
320
+ min-height: 48px;
321
+ padding: 0 12px;
175
322
  border: 0;
176
- min-width: 0;
323
+ border-radius: 12px;
324
+ background: var(--panel);
325
+ text-align: left;
326
+ line-height: 18px;
177
327
  }
178
328
 
179
- legend {
180
- padding: 0 0 5px;
181
- font-size: 11px;
182
- text-transform: uppercase;
183
- letter-spacing: 0.06em;
184
- color: var(--dim);
329
+ kbd {
330
+ font: 11px var(--mono);
331
+ color: var(--muted);
332
+ }
333
+
334
+ .group {
335
+ display: flex;
336
+ flex-direction: column;
337
+ gap: 8px;
185
338
  }
186
339
 
187
- .keys,
188
340
  .row {
189
341
  display: flex;
190
- gap: 6px;
191
342
  align-items: center;
343
+ justify-content: space-between;
344
+ gap: 12px;
345
+ min-height: 56px;
346
+ padding: 8px 16px;
347
+ border-radius: 4px;
348
+ background: var(--panel);
192
349
  }
193
350
 
194
- .keys,
195
- .row.wrap {
196
- flex-wrap: wrap;
351
+ .row:first-child {
352
+ border-top-left-radius: 16px;
353
+ border-top-right-radius: 16px;
354
+ }
355
+
356
+ .row:last-child {
357
+ border-bottom-left-radius: 16px;
358
+ border-bottom-right-radius: 16px;
197
359
  }
198
360
 
199
- .row.wrap {
200
- align-items: end;
201
- row-gap: 8px;
361
+ .label {
362
+ min-width: 0;
363
+ flex: 1;
202
364
  }
203
365
 
204
- .row + .row {
205
- margin-top: 6px;
366
+ .label small {
367
+ display: block;
368
+ margin-top: 4px;
369
+ font-size: 12px;
370
+ line-height: 18px;
371
+ color: var(--muted);
206
372
  }
207
373
 
208
- button {
209
- padding: 5px 10px;
210
- border: 1px solid var(--line);
211
- border-radius: 6px;
212
- background: var(--raised);
374
+ input.bare {
375
+ flex: 1;
376
+ min-width: 0;
377
+ padding: 0;
378
+ border: 0;
379
+ background: transparent;
380
+ }
381
+
382
+ input.bare:focus-visible {
383
+ outline: 0;
384
+ }
385
+
386
+ .row:has(input.bare:focus-visible) {
387
+ outline: 2px solid var(--accent);
388
+ outline-offset: 2px;
389
+ }
390
+
391
+ input.bare.end {
392
+ flex: 0 1 120px;
393
+ text-align: right;
394
+ color: var(--muted);
395
+ }
396
+
397
+ input[type="number"] {
398
+ -moz-appearance: textfield;
399
+ }
400
+
401
+ input[type="number"]::-webkit-inner-spin-button,
402
+ input[type="number"]::-webkit-outer-spin-button {
403
+ -webkit-appearance: none;
404
+ margin: 0;
405
+ }
406
+
407
+ input[type="range"] {
408
+ flex: 0 1 40%;
409
+ min-width: 80px;
410
+ accent-color: var(--accent);
411
+ }
412
+
413
+ output {
414
+ min-width: 4ch;
415
+ text-align: right;
416
+ color: var(--muted);
417
+ }
418
+
419
+ .switch {
420
+ appearance: none;
421
+ flex: 0 0 46px;
422
+ width: 46px;
423
+ height: 28px;
424
+ margin: 0;
425
+ border-radius: 14px;
426
+ background: var(--switch-off) radial-gradient(circle, var(--page) 11.5px, transparent 12.5px) no-repeat 0 0 / 28px
427
+ 28px;
213
428
  cursor: pointer;
214
- white-space: nowrap;
429
+ transition:
430
+ background-color 0.2s,
431
+ background-position 0.2s;
215
432
  }
216
433
 
217
- button:hover {
218
- border-color: #46505a;
434
+ .switch:checked {
435
+ background-color: var(--accent);
436
+ background-position: 18px 0;
219
437
  }
220
438
 
221
- button:active,
222
- button.pressed {
223
- background: #2a3138;
224
- border-color: var(--ink);
439
+ .switch.small {
440
+ flex-basis: 36px;
441
+ width: 36px;
442
+ height: 22px;
443
+ border-radius: 11px;
444
+ background-size: 22px 22px;
445
+ background-image: radial-gradient(circle, var(--page) 8.5px, transparent 9.5px);
225
446
  }
226
447
 
227
- button:focus-visible,
228
- input:focus-visible {
229
- outline: 2px solid var(--ink);
230
- outline-offset: 1px;
448
+ .switch.small:checked {
449
+ background-position: 14px 0;
231
450
  }
232
451
 
233
- button.primary {
234
- background: var(--ink);
235
- border-color: var(--ink);
236
- color: #04130b;
237
- font-weight: 600;
452
+ .seg {
453
+ display: flex;
454
+ gap: 2px;
455
+ padding: 3px;
456
+ border-radius: 10px;
457
+ background: var(--panel-2);
238
458
  }
239
459
 
240
- button.quiet {
460
+ .seg button {
461
+ min-height: 32px;
462
+ padding: 4px 12px;
463
+ border: 0;
464
+ border-radius: 7px;
241
465
  background: transparent;
466
+ font-size: 12px;
242
467
  }
243
468
 
244
- kbd {
245
- margin-left: 4px;
246
- padding: 0 4px;
247
- border: 1px solid var(--line);
248
- border-radius: 3px;
249
- font: 10px var(--mono);
250
- color: var(--dim);
469
+ .seg button[aria-selected="true"],
470
+ .seg button[aria-pressed="true"] {
471
+ background: var(--page);
472
+ box-shadow: 0 1px 3px #00000012;
251
473
  }
252
474
 
253
- input[type="text"],
254
- input[type="number"] {
255
- min-width: 0;
256
- padding: 5px 8px;
257
- border: 1px solid var(--line);
258
- border-radius: 6px;
259
- background: var(--surface);
475
+ .actions {
476
+ display: flex;
477
+ flex-wrap: wrap;
478
+ gap: 12px;
479
+ margin-top: 16px;
260
480
  }
261
481
 
262
- #say-text,
263
- #notify-content {
264
- flex: 1;
482
+ .action {
483
+ flex: 1 1 140px;
484
+ min-height: 48px;
485
+ padding: 12px 16px;
486
+ border: 0;
487
+ border-radius: 12px;
488
+ font-weight: 600;
489
+ text-align: center;
490
+ box-shadow: 0 2px 3px #00000012;
491
+ transition:
492
+ scale 0.15s,
493
+ opacity 0.15s;
265
494
  }
266
495
 
267
- input[type="number"] {
268
- width: 96px;
496
+ .action:active {
497
+ scale: 0.97;
269
498
  }
270
499
 
271
- #battery {
272
- width: 62px;
500
+ .action.primary {
501
+ background: var(--accent);
502
+ color: #0a0a0a;
273
503
  }
274
504
 
275
- .field {
276
- display: grid;
277
- gap: 2px;
278
- font-size: 11px;
279
- color: var(--dim);
505
+ .action.secondary {
506
+ border: 1px solid var(--line);
507
+ background: var(--panel);
280
508
  }
281
509
 
282
- .field input {
283
- color: var(--text);
284
- font-size: 13px;
510
+ .action.compact {
511
+ flex: none;
512
+ min-height: 36px;
513
+ padding: 6px 16px;
285
514
  }
286
515
 
287
- .check {
516
+ .text-button {
517
+ padding: 4px 8px;
518
+ border: 0;
519
+ background: none;
520
+ font-size: 12px;
521
+ color: var(--muted);
522
+ }
523
+
524
+ .inline {
288
525
  display: inline-flex;
289
526
  align-items: center;
290
- gap: 5px;
291
- color: var(--dim);
292
- white-space: nowrap;
527
+ gap: 8px;
528
+ font-size: 12px;
529
+ color: var(--muted);
293
530
  }
294
531
 
532
+ /* Phone */
533
+
295
534
  .phone {
296
535
  display: flex;
297
536
  flex-direction: column;
298
537
  align-items: center;
299
- gap: 8px;
300
- font-size: 12px;
538
+ gap: 12px;
301
539
  }
302
540
 
303
541
  .phone-body {
@@ -306,8 +544,7 @@ input[type="number"] {
306
544
  width: calc(393px * var(--scale));
307
545
  height: calc(852px * var(--scale));
308
546
  border-radius: calc(44px * var(--scale));
309
- outline: 1px solid var(--line);
310
- box-shadow: 0 0 0 calc(7px * var(--scale)) #050607;
547
+ box-shadow: 0 0 0 calc(7px * var(--scale)) var(--bezel);
311
548
  background: #000;
312
549
  overflow: hidden;
313
550
  }
@@ -319,7 +556,7 @@ input[type="number"] {
319
556
  border: 0;
320
557
  transform: scale(var(--scale));
321
558
  transform-origin: 0 0;
322
- background: #fff;
559
+ background: var(--page);
323
560
  }
324
561
 
325
562
  .phone-empty {
@@ -329,77 +566,63 @@ input[type="number"] {
329
566
  place-items: center;
330
567
  padding: 24px;
331
568
  text-align: center;
332
- color: var(--dim);
569
+ color: #a3a3a3;
333
570
  }
334
571
 
335
572
  .phone a {
573
+ font-size: 12px;
574
+ color: var(--muted);
336
575
  text-decoration: none;
337
576
  }
338
577
 
339
578
  .phone a:hover {
340
- color: var(--text);
579
+ color: var(--ink);
341
580
  }
342
581
 
582
+ /* Log, scene, state */
583
+
343
584
  .panel {
344
585
  display: grid;
345
586
  grid-template-rows: auto minmax(0, 1fr);
346
- min-height: 0;
347
- border-top: 1px solid var(--line);
348
- background: var(--surface);
587
+ height: 320px;
588
+ border-radius: 16px;
589
+ background: var(--panel);
590
+ overflow: hidden;
349
591
  }
350
592
 
351
- .tabs {
593
+ .panel-head {
352
594
  display: flex;
353
595
  align-items: center;
354
- gap: 2px;
355
- padding: 4px 10px 0;
356
- border-bottom: 1px solid var(--line);
357
- }
358
-
359
- .tabs [role="tab"] {
360
- border: 0;
361
- border-bottom: 2px solid transparent;
362
- border-radius: 0;
363
- background: none;
364
- color: var(--dim);
365
- padding: 5px 10px 6px;
366
- }
367
-
368
- .tabs [role="tab"][aria-selected="true"] {
369
- color: var(--text);
370
- border-bottom-color: var(--ink);
371
- }
372
-
373
- .spacer {
374
- flex: 1;
596
+ gap: 12px;
597
+ padding: 12px 12px 4px;
375
598
  }
376
599
 
377
600
  .tab {
378
601
  margin: 0;
379
- padding: 8px 14px;
602
+ padding: 8px 16px 16px;
380
603
  overflow: auto;
381
604
  font: 12px/1.5 var(--mono);
382
605
  }
383
606
 
384
607
  .log-line {
385
608
  display: grid;
386
- grid-template-columns: 62px 84px minmax(0, 1fr);
387
- gap: 10px;
609
+ grid-template-columns: 62px 80px minmax(0, 1fr);
610
+ gap: 8px;
388
611
  white-space: pre-wrap;
389
612
  overflow-wrap: anywhere;
390
613
  }
391
614
 
392
615
  .log-line .time,
393
616
  .log-line .source {
394
- color: var(--dim);
617
+ color: var(--muted);
395
618
  }
396
619
 
397
620
  .log-line[data-source="background"] .source {
398
- color: #b79cf7;
621
+ color: var(--source-background);
399
622
  }
400
623
 
401
624
  .log-line[data-source="ui"] .source {
402
- color: #6cc7e6;
625
+ color: var(--source-ui);
403
626
  }
404
627
 
405
628
  .log-line[data-level="warn"] .message {
@@ -413,12 +636,12 @@ input[type="number"] {
413
636
  .state-grid {
414
637
  display: grid;
415
638
  grid-template-columns: max-content minmax(0, 1fr);
416
- gap: 3px 18px;
639
+ gap: 4px 16px;
417
640
  align-content: start;
418
641
  }
419
642
 
420
643
  .state-grid dt {
421
- color: var(--dim);
644
+ color: var(--muted);
422
645
  }
423
646
 
424
647
  .state-grid dd {
@@ -430,21 +653,12 @@ input[type="number"] {
430
653
  color: var(--warn);
431
654
  }
432
655
 
433
- @media (max-width: 1180px) {
434
- .glasses {
435
- grid-template-columns: minmax(0, 760px);
656
+ @media (prefers-reduced-motion: reduce) {
657
+ * {
658
+ transition: none !important;
436
659
  }
437
660
  }
438
661
 
439
- @media (max-width: 900px) {
440
- body {
441
- grid-template-rows: auto auto minmax(180px, 30vh);
442
- height: auto;
443
- min-height: 100%;
444
- }
445
-
446
- .bench {
447
- grid-template-columns: minmax(0, 1fr);
448
- overflow: visible;
449
- }
662
+ .key.pressed {
663
+ opacity: 0.65;
450
664
  }
@@ -9,85 +9,147 @@
9
9
  <body>
10
10
  <header class="bar">
11
11
  <div class="identity">
12
- <span class="mark">Glassly Simulator</span>
13
- <span id="app-name" class="app-name"></span>
14
- <span id="app-package" class="muted"></span>
12
+ <h1 id="app-name">Glassly Simulator</h1>
13
+ <p id="app-package" class="sub"></p>
15
14
  </div>
16
15
  <div class="bar-actions">
17
16
  <span id="run-state" class="state" data-state="stopped">stopped</span>
18
- <button id="restart" class="quiet" title="Restart the background script">Restart</button>
17
+ <button id="restart" type="button" class="action secondary compact" title="Restart the background script">
18
+ Restart
19
+ </button>
19
20
  </div>
20
21
  </header>
21
22
 
22
23
  <main class="bench">
23
- <section class="glasses" aria-label="Glasses">
24
- <div class="lens-wrap">
24
+ <section class="display" aria-label="Glasses display">
25
+ <div class="screen">
25
26
  <div class="lens" id="lens">
26
27
  <canvas id="display" width="576" height="288"></canvas>
27
28
  <div id="lens-note" class="lens-note" hidden></div>
28
29
  </div>
29
30
  <div class="lens-meta">
30
31
  <span id="device-model"></span>
31
- <span id="display-meta" class="muted"></span>
32
+ <span id="display-meta"></span>
32
33
  </div>
33
34
  </div>
34
35
 
35
- <div class="controls">
36
- <fieldset>
37
- <legend>Touch bar</legend>
38
- <div class="keys">
39
- <button data-touch="single_tap">Tap <kbd>T</kbd></button>
40
- <button data-touch="double_tap">Double tap <kbd>D</kbd></button>
41
- <button data-touch="triple_tap">Triple tap</button>
42
- <button data-touch="long_press">Hold <kbd>H</kbd></button>
43
- <button data-touch="swipe_up">Swipe up <kbd>↑</kbd></button>
44
- <button data-touch="swipe_down">Swipe down <kbd>↓</kbd></button>
36
+ <section class="panel">
37
+ <div class="panel-head">
38
+ <div class="seg" role="tablist" aria-label="Details">
39
+ <button type="button" role="tab" data-tab="log" aria-selected="true">Log</button>
40
+ <button type="button" role="tab" data-tab="scene" aria-selected="false">Scene</button>
41
+ <button type="button" role="tab" data-tab="state" aria-selected="false">State</button>
45
42
  </div>
46
- </fieldset>
47
- <fieldset>
48
- <legend>Head and button</legend>
49
- <div class="keys">
50
- <button data-touch="head_up">Look up <kbd>U</kbd></button>
51
- <button data-touch="head_down">Look down <kbd>J</kbd></button>
52
- <button data-button="short">Button <kbd>B</kbd></button>
53
- <button data-button="long">Long button</button>
54
- </div>
55
- </fieldset>
56
- <fieldset>
57
- <legend>Speech heard by the glasses</legend>
58
- <form id="say" class="row">
59
- <input id="say-text" type="text" placeholder="Type what the wearer says" autocomplete="off" />
60
- <input id="say-language" type="text" value="en-US" size="6" aria-label="Language" />
61
- <label class="check"><input id="say-interim" type="checkbox" /> interim</label>
62
- <button type="submit" class="primary">Say</button>
63
- </form>
64
- </fieldset>
65
- <fieldset>
66
- <legend>Phone and sensors</legend>
67
- <div class="row wrap">
68
- <label class="field">Glasses battery
69
- <input id="battery" type="number" min="0" max="100" value="80" />
70
- </label>
71
- <label class="field">Latitude
72
- <input id="lat" type="number" step="any" value="37.7749" />
43
+ <span class="spacer"></span>
44
+ <label class="inline">Follow <input id="follow" type="checkbox" class="switch small" checked /></label>
45
+ <button id="clear-log" type="button" class="text-button">Clear</button>
46
+ </div>
47
+ <div id="tab-log" class="tab log" role="tabpanel"></div>
48
+ <pre id="tab-scene" class="tab" role="tabpanel" hidden></pre>
49
+ <dl id="tab-state" class="tab state-grid" role="tabpanel" hidden></dl>
50
+ </section>
51
+ </section>
52
+
53
+ <section class="controls" aria-label="Input">
54
+ <section>
55
+ <h2>Touch bar</h2>
56
+ <div class="keys">
57
+ <button type="button" class="key" data-touch="single_tap">Tap <kbd>T</kbd></button>
58
+ <button type="button" class="key" data-touch="double_tap">Double tap <kbd>D</kbd></button>
59
+ <button type="button" class="key" data-touch="triple_tap">Triple tap</button>
60
+ <button type="button" class="key" data-touch="long_press">Hold <kbd>H</kbd></button>
61
+ <button type="button" class="key" data-touch="swipe_up">Swipe up <kbd>↑</kbd></button>
62
+ <button type="button" class="key" data-touch="swipe_down">Swipe down <kbd>↓</kbd></button>
63
+ </div>
64
+ </section>
65
+
66
+ <section>
67
+ <h2>Head and button</h2>
68
+ <div class="keys">
69
+ <button type="button" class="key" data-touch="head_up">Look up <kbd>U</kbd></button>
70
+ <button type="button" class="key" data-touch="head_down">Look down <kbd>J</kbd></button>
71
+ <button type="button" class="key" data-button="short">Button <kbd>B</kbd></button>
72
+ <button type="button" class="key" data-button="long">Long press</button>
73
+ </div>
74
+ </section>
75
+
76
+ <section>
77
+ <h2>Speech</h2>
78
+ <form id="say">
79
+ <div class="group">
80
+ <div class="row">
81
+ <input id="say-text" type="text" class="bare" placeholder="What the wearer says" autocomplete="off" />
82
+ </div>
83
+ <label class="row">
84
+ <span class="label">Language</span>
85
+ <input id="say-language" type="text" class="bare end" value="en-US" />
73
86
  </label>
74
- <label class="field">Longitude
75
- <input id="lng" type="number" step="any" value="-122.4194" />
87
+ <label class="row">
88
+ <span class="label">Interim result</span>
89
+ <input id="say-interim" type="checkbox" class="switch" />
76
90
  </label>
77
- <button id="send-location">Set location</button>
78
91
  </div>
79
- <div class="row wrap">
80
- <label class="check"><input id="connected" type="checkbox" checked /> glasses connected</label>
81
- <label class="check"><input id="light" type="checkbox" /> light phone theme</label>
82
- <label class="check"><input id="aloud" type="checkbox" /> speak aloud</label>
92
+ <div class="actions"><button type="submit" class="action primary">Say</button></div>
93
+ </form>
94
+ </section>
95
+
96
+ <section>
97
+ <h2>Phone notification</h2>
98
+ <form id="notify">
99
+ <div class="group">
100
+ <div class="row">
101
+ <input id="notify-title" type="text" class="bare" placeholder="Title" autocomplete="off" />
102
+ </div>
103
+ <div class="row">
104
+ <input id="notify-content" type="text" class="bare" placeholder="Text" autocomplete="off" />
105
+ </div>
83
106
  </div>
84
- <form id="notify" class="row">
85
- <input id="notify-title" type="text" placeholder="Notification title" autocomplete="off" />
86
- <input id="notify-content" type="text" placeholder="Notification text" autocomplete="off" />
87
- <button type="submit">Notify</button>
88
- </form>
89
- </fieldset>
90
- </div>
107
+ <div class="actions"><button type="submit" class="action secondary">Notify</button></div>
108
+ </form>
109
+ </section>
110
+
111
+ <section>
112
+ <h2>Location</h2>
113
+ <div class="group">
114
+ <label class="row">
115
+ <span class="label">Latitude</span>
116
+ <input id="lat" type="number" step="any" class="bare end" value="37.7749" />
117
+ </label>
118
+ <label class="row">
119
+ <span class="label">Longitude</span>
120
+ <input id="lng" type="number" step="any" class="bare end" value="-122.4194" />
121
+ </label>
122
+ </div>
123
+ <div class="actions">
124
+ <button id="send-location" type="button" class="action secondary">Set location</button>
125
+ </div>
126
+ </section>
127
+
128
+ <section>
129
+ <h2>Glasses and phone</h2>
130
+ <div class="group">
131
+ <label class="row">
132
+ <span class="label">Glasses connected</span>
133
+ <input id="connected" type="checkbox" class="switch" checked />
134
+ </label>
135
+ <label class="row">
136
+ <span class="label">Glasses battery</span>
137
+ <input id="battery" type="range" min="0" max="100" value="80" />
138
+ <output id="battery-value" for="battery">80%</output>
139
+ </label>
140
+ <div class="row">
141
+ <span class="label">Phone theme</span>
142
+ <div class="seg" role="group" aria-label="Phone theme">
143
+ <button type="button" data-scheme="light" aria-pressed="false">Light</button>
144
+ <button type="button" data-scheme="dark" aria-pressed="true">Dark</button>
145
+ </div>
146
+ </div>
147
+ <label class="row">
148
+ <span class="label">Read speech aloud<small>Speaks what the miniapp says</small></span>
149
+ <input id="aloud" type="checkbox" class="switch" />
150
+ </label>
151
+ </div>
152
+ </section>
91
153
  </section>
92
154
 
93
155
  <section class="phone" aria-label="Phone">
@@ -95,24 +157,10 @@
95
157
  <iframe id="phone-frame" title="Miniapp phone page"></iframe>
96
158
  <div id="phone-empty" class="phone-empty" hidden>This miniapp has no phone page.</div>
97
159
  </div>
98
- <a id="phone-link" class="muted" href="/ui/" target="_blank" rel="noopener">Open the phone page in its own tab</a>
160
+ <a id="phone-link" href="/ui/" target="_blank" rel="noopener">Open in its own tab</a>
99
161
  </section>
100
162
  </main>
101
163
 
102
- <section class="panel">
103
- <nav class="tabs" role="tablist">
104
- <button role="tab" data-tab="log" aria-selected="true">Log</button>
105
- <button role="tab" data-tab="scene" aria-selected="false">Scene</button>
106
- <button role="tab" data-tab="state" aria-selected="false">State</button>
107
- <span class="spacer"></span>
108
- <label class="check"><input id="follow" type="checkbox" checked /> follow</label>
109
- <button id="clear-log" class="quiet">Clear</button>
110
- </nav>
111
- <div id="tab-log" class="tab log" role="tabpanel"></div>
112
- <pre id="tab-scene" class="tab" role="tabpanel" hidden></pre>
113
- <div id="tab-state" class="tab state-grid" role="tabpanel" hidden></div>
114
- </section>
115
-
116
164
  <script type="module" src="/sim/app.js"></script>
117
165
  </body>
118
166
  </html>
@@ -105,13 +105,20 @@ function showDisplay(frame: MirrorSnapshot): void {
105
105
 
106
106
  function showStatus(status: Status): void {
107
107
  document.title = `${status.name} · Glassly Simulator`
108
- $("app-name").textContent = status.version ? `${status.name} ${status.version}` : status.name
109
- $("app-package").textContent = status.packageName
108
+ $("app-name").textContent = status.name
109
+ $("app-package").textContent = [status.packageName, status.version, "Glassly Simulator"].filter(Boolean).join(" · ")
110
110
  const state = $("run-state")
111
111
  const label = status.background === "running" && !status.connected ? "starting" : status.background
112
112
  state.dataset.state = status.background
113
113
  state.textContent = status.paused && status.background === "running" ? "paused" : label
114
114
  $("device-model").textContent = status.device.model
115
+ const battery = $<HTMLInputElement>("battery")
116
+ if (document.activeElement !== battery) battery.value = String(status.sensors.glassesBattery.level)
117
+ $("battery-value").textContent = `${battery.value}%`
118
+ $<HTMLInputElement>("connected").checked = status.sensors.glassesConnected
119
+ document.querySelectorAll<HTMLButtonElement>("[data-scheme]").forEach((button) => {
120
+ button.setAttribute("aria-pressed", String(button.dataset.scheme === status.colorScheme))
121
+ })
115
122
 
116
123
  const rows: [string, string, boolean?][] = [
117
124
  ["subscriptions", status.subscriptions.join(", ") || "none"],
@@ -217,6 +224,9 @@ $("notify").addEventListener("submit", (event) => {
217
224
  })
218
225
  })
219
226
 
227
+ $("battery").addEventListener("input", (event) => {
228
+ $("battery-value").textContent = `${(event.target as HTMLInputElement).value}%`
229
+ })
220
230
  $("battery").addEventListener("change", (event) => {
221
231
  void post("battery", {target: "glasses", level: Number((event.target as HTMLInputElement).value)})
222
232
  })
@@ -226,8 +236,8 @@ $("send-location").addEventListener("click", () => {
226
236
  $("connected").addEventListener("change", (event) => {
227
237
  void post("connection", {connected: (event.target as HTMLInputElement).checked})
228
238
  })
229
- $("light").addEventListener("change", (event) => {
230
- void post("color-scheme", {colorScheme: (event.target as HTMLInputElement).checked ? "light" : "dark"})
239
+ document.querySelectorAll<HTMLButtonElement>("[data-scheme]").forEach((button) => {
240
+ button.addEventListener("click", () => void post("color-scheme", {colorScheme: button.dataset.scheme}))
231
241
  })
232
242
  $("restart").addEventListener("click", () => void post("restart"))
233
243
  $("clear-log").addEventListener("click", () => logPane.replaceChildren())
@@ -241,8 +251,9 @@ document.querySelectorAll<HTMLButtonElement>('[role="tab"]').forEach((tab) => {
241
251
 
242
252
  function fitPhone(): void {
243
253
  const body = $("phone-body")
244
- const room = (body.parentElement?.parentElement?.clientHeight ?? 700) - 70
245
- body.style.setProperty("--scale", String(Math.max(0.45, Math.min(1, room / 852))))
254
+ const wide = window.matchMedia("(min-width: 1200px)").matches
255
+ const room = wide ? body.parentElement!.clientHeight - 40 : window.innerHeight - 96
256
+ body.style.setProperty("--scale", String(Math.max(0.5, Math.min(1, room / 852))))
246
257
  }
247
258
  window.addEventListener("resize", fitPhone)
248
259
  fitPhone()