beecast-player 0.10.1

The first-party beecast player — a clean-room, dependency-free asciicast (v1/v2/v3) player and VT emulator, exposed as inlinable JS/CSS string constants, with live-follow append for recordings that are still growing.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
/* beecast-player chrome + terminal palette (see the crate README).
   Clean-room, MIT like the rest of beecast. Semantic chrome tokens (--beecast-*) are the
   stable theming surface; --sp-* covers the terminal palette and remains independently
   themeable. Internal .sp-* classes are not a public API. */

/* Semantic theme tokens (Phase 8). Defaults map to the classic dark chrome. */
.beecast-player {
  --beecast-color-surface: #121417;
  --beecast-color-surface-raised: rgba(255, 255, 255, 0.04);
  --beecast-color-text: #cdd3dc;
  --beecast-color-text-muted: rgba(205, 211, 220, 0.8);
  --beecast-color-accent: #6a9ded;
  --beecast-color-focus: rgba(88, 166, 255, 0.5);
  --beecast-color-marker: #d5b45e;
  --beecast-color-live: #78bd65;
  --beecast-color-error: #e05f65;
  --beecast-control-height: 44px;
  --beecast-radius: 4px;
  --beecast-font-ui: 13px/1.2 ui-sans-serif, system-ui, sans-serif;
  --beecast-font-terminal: 13px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Terminal palette */
  --sp-bg: var(--beecast-color-surface);
  --sp-fg: var(--beecast-color-text);
  --sp-c0: #1c1f24; --sp-c1: #e05f65; --sp-c2: #78bd65; --sp-c3: #d5b45e;
  --sp-c4: #6a9ded; --sp-c5: #bd7bd8; --sp-c6: #55b8c2; --sp-c7: #b8bfc9;
  --sp-c8: #596273; --sp-c9: #ff8188; --sp-c10: #98d989; --sp-c11: #f0d182;
  --sp-c12: #8fb7ff; --sp-c13: #d99df0; --sp-c14: #7fd6df; --sp-c15: #eef1f5;

  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  background: var(--sp-bg);
  color: var(--sp-fg);
  border-radius: var(--beecast-radius);
  outline: none;
  overflow: hidden;
}

/* Built-in themes */
.beecast-player[data-theme="light"] {
  --beecast-color-surface: #f4f5f7;
  --beecast-color-surface-raised: rgba(0, 0, 0, 0.04);
  --beecast-color-text: #1c1f24;
  --beecast-color-text-muted: rgba(28, 31, 36, 0.75);
  --beecast-color-accent: #3b6fd4;
  --beecast-color-focus: rgba(59, 111, 212, 0.45);
  --beecast-color-marker: #b8860b;
  --beecast-color-live: #3d8b40;
  --sp-bg: #f4f5f7;
  --sp-fg: #1c1f24;
}

@media (prefers-color-scheme: light) {
  .beecast-player[data-theme="system"] {
    --beecast-color-surface: #f4f5f7;
    --beecast-color-surface-raised: rgba(0, 0, 0, 0.04);
    --beecast-color-text: #1c1f24;
    --beecast-color-text-muted: rgba(28, 31, 36, 0.75);
    --beecast-color-accent: #3b6fd4;
    --beecast-color-focus: rgba(59, 111, 212, 0.45);
    --beecast-color-marker: #b8860b;
    --beecast-color-live: #3d8b40;
    --sp-bg: #f4f5f7;
    --sp-fg: #1c1f24;
  }
}

.beecast-player:focus-visible { box-shadow: 0 0 0 2px var(--beecast-color-focus); }
.beecast-player.arrival-flash { animation: beecast-arrival 900ms ease-out; }
@keyframes beecast-arrival { from { box-shadow: 0 0 0 3px var(--beecast-color-focus); } to { box-shadow: none; } }

/* Stage grows into leftover height; bar stays at the bottom. Content-sized mounts still
   size to the terminal (flex:1 with an indefinite parent collapses to content). */
.sp-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Fullscreen (and wrap-fullscreen when scsh fullscreens the outer .cast): fill the
   viewport, center the terminal in the stage, pin the control bar at the bottom —
   no margin-auto gap between the terminal and the bar. */
.beecast-player:fullscreen,
:fullscreen .beecast-player {
  width: 100%; height: 100%; border-radius: 0;
}
.beecast-player:fullscreen .sp-bar,
:fullscreen .beecast-player .sp-bar {
  position: relative;
  z-index: 20;
  box-sizing: border-box;
  padding-right: 0.35rem; /* keep 1× / ⛶ from kissing the edge after scale */
}
.beecast-player [hidden] { display: none !important; }

.sp-screen-box { overflow: hidden; position: relative; flex: 0 0 auto; }

/* Center play overlay: soft dim + a geometric `|>` (SVG bar + chevron, equal height). */
.sp-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.42);
  cursor: pointer;
}
.sp-overlay:focus-visible {
  outline: 2px solid var(--beecast-color-accent);
  outline-offset: -4px;
}
.sp-bigplay {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 7rem;
  height: 7rem;
  color: #fff;
  opacity: 0.92;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)) drop-shadow(0 4px 18px rgba(0, 0, 0, 0.65));
  transition: opacity 0.15s, transform 0.15s;
  user-select: none;
}
.sp-bigplay-icon {
  display: block;
  width: 100%;
  height: 100%;
}
.sp-overlay:hover .sp-bigplay,
.sp-overlay:focus-visible .sp-bigplay {
  opacity: 1;
  transform: scale(1.06);
}
@media (prefers-reduced-motion: reduce) {
  .beecast-player.arrival-flash { animation: none; outline: 2px solid var(--beecast-color-accent); }
  .sp-toast { transition: none; }
  .sp-bigplay { transition: none; }
  .sp-overlay:hover .sp-bigplay,
  .sp-overlay:focus-visible .sp-bigplay { transform: none; }
}

/* Off-screen snapshot for accessibility="snapshot" — readable, not a live region. */
.sp-a11y {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: pre;
  border: 0;
}

.sp-chapters {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 4;
  width: min(320px, 60%);
  overflow-y: auto;
  background: rgba(9, 11, 15, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  font: 12px/1.45 ui-sans-serif, system-ui, sans-serif;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
  pointer-events: auto;
}
/* Tall + wide mounts (and fullscreen): dock chapters beside the terminal instead of
   overlaying it. The list stretches full stage height; the terminal stays centered. */
.beecast-player.sp-chapters-dock .sp-stage {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
}
.beecast-player.sp-chapters-dock .sp-screen-box {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.beecast-player.sp-chapters-dock .sp-chapters {
  position: static;
  flex: 0 0 min(280px, 32%);
  width: min(280px, 32%);
  max-width: 320px;
  align-self: stretch;
  z-index: 1;
}
/* Chapter rows mirror scsh job-graph cards: left accent, state / title / meta. */
.sp-chap {
  display: flex; flex-direction: column; justify-content: center;
  gap: 0.15rem; width: 100%; text-align: left;
  font: inherit; color: var(--sp-fg);
  background: #0d1117; border: 1px solid #2a3140;
  border-left: 3px solid #2a3140; border-radius: 6px;
  cursor: pointer; padding: 0.45rem 0.65rem;
  box-sizing: border-box;
  pointer-events: auto;
}
.sp-chap:hover { border-color: #3a4558; background: #161b22; }
.sp-chap:focus-visible {
  outline: 2px solid var(--beecast-color-accent);
  outline-offset: 1px;
}
.sp-chap-state {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--beecast-color-text-muted);
}
.sp-chap-id {
  font-weight: 600; font-size: 0.95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-chap-meta {
  font-size: 0.75rem; color: var(--beecast-color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sp-chap-on {
  border-left-color: #3fb950;
  background: #161b22;
}
.sp-chap-on .sp-chap-state,
.sp-chap-on .sp-chap-id { color: #3fb950; }
.sp-chap-ann .sp-chap-id { font-style: italic; opacity: 0.95; }

/* Bottom-center disappearing toast: scsh job-graph card silhouette (left accent,
   state / title / meta), above the control bar. */
.sp-toast {
  position: absolute; left: 50%; bottom: 52px; z-index: 6;
  transform: translateX(-50%) translateY(0.6rem);
  display: flex; flex-direction: column; justify-content: center;
  gap: 0.15rem;
  max-width: min(22rem, calc(100% - 24px));
  min-width: min(12rem, calc(100% - 24px));
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  background: #0d1117;
  border: 1px solid #2a3140;
  border-left: 3px solid #3fb950;
  color: var(--sp-fg);
  font: 0.85rem/1.25 ui-sans-serif, system-ui, sans-serif;
  text-align: left;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-sizing: border-box;
}
.sp-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sp-toast-state {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #3fb950;
}
.sp-toast-id {
  font-weight: 600; font-size: 0.95rem; color: #3fb950;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-toast-meta {
  font-size: 0.75rem; color: var(--beecast-color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sp-screen {
  margin: 0;
  padding: 4px 6px;
  font: var(--beecast-font-terminal);
  white-space: pre;
  transform-origin: top left;
  width: max-content;
}
/* Styled runs as inline-blocks so a run's background paints the full 1.25 line box. */
.sp-screen span { display: inline-block; }
.sp-probe { visibility: hidden; position: absolute; }
.sp-b { font-weight: 700; }
.sp-d { opacity: 0.6; }
.sp-i { font-style: italic; }
.sp-u { text-decoration: underline; }
.sp-s { text-decoration: line-through; }
.sp-u.sp-s { text-decoration: underline line-through; }
.sp-cur { outline: 1px solid var(--sp-fg); outline-offset: -1px; }

.sp-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
  min-height: var(--beecast-control-height);
  padding: 10px 12px;
  background: var(--beecast-color-surface-raised);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font: var(--beecast-font-ui);
  user-select: none;
  box-sizing: border-box;
  /* Menus grow upward out of the bar; keep them paintable over the terminal. */
  position: relative;
  z-index: 6;
  overflow: visible;
}
.sp-bar button {
  font: inherit;
  color: var(--sp-fg);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  min-height: 36px;
  min-width: 36px;
  line-height: 1.2;
  flex: 0 0 auto;
}
.sp-bar button:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.sp-bar button:focus-visible {
  outline: 2px solid var(--beecast-color-accent);
  outline-offset: 1px;
}
.sp-play { font-size: 18px; padding: 8px 14px; min-width: 40px; }
.sp-live {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--beecast-color-text-muted);
}
.sp-live.on {
  color: var(--beecast-color-live);
  background: rgba(120, 189, 101, 0.12);
}
.sp-live.on:hover { color: var(--beecast-color-live); background: rgba(120, 189, 101, 0.18); }

.sp-speedwrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}
.sp-speed {
  min-width: 3.25em;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.sp-speedmenu {
  position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 30;
  display: flex; flex-direction: column;
  min-width: 4.5em; padding: 4px;
  background: #161a20;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--beecast-radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.sp-speedopt {
  text-align: center;
  border-radius: 3px;
  min-height: 32px;
  padding: 6px 10px;
}
.sp-speedopt.sp-on {
  color: var(--sp-c12);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--beecast-color-accent);
}
.sp-speedopt:hover { background: rgba(106, 157, 237, 0.18); }
.sp-speedopt:focus-visible {
  outline: 2px solid var(--beecast-color-accent);
  outline-offset: 0;
}

.sp-time, .sp-dur {
  color: var(--beecast-color-text-muted);
  min-width: 3.6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  font-size: 13px;
}
.sp-seek {
  position: relative;
  flex: 1 1 auto;
  min-width: 64px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  touch-action: none;
}
.sp-seek:focus-visible {
  outline: 2px solid var(--beecast-color-accent);
  outline-offset: 3px;
}
.sp-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 3px;
  background: var(--beecast-color-accent);
  pointer-events: none;
}
/* Declared-live (setLive): the bar reads "now" — pinned full-width, live green — not a
   position that jitters as the growing recording keeps re-proportioning it. */
.beecast-player.sp-islive .sp-fill { width: 100% !important; background: var(--beecast-color-live); }
.sp-markers { position: absolute; inset: 0; pointer-events: none; }
.sp-marker {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--beecast-color-marker);
  pointer-events: auto;
}
.sp-marker-ann {
  width: 0;
  border-left: 2px dashed var(--beecast-color-marker);
  background: transparent;
}

/* Custom element host fills its mount when used directly. */
beecast-player {
  display: block;
  width: 100%;
  height: 100%;
}

/* Keep every primary action reachable on narrow phones. Time remains available to
   assistive technology through the seek slider's aria-valuetext. */
@media (max-width: 430px) {
  .sp-bar { gap: 4px; padding: 6px; }
  .sp-bar button { padding-left: 8px; padding-right: 8px; }
  .sp-time, .sp-dur { display: none; }
  .sp-seek { min-width: 40px; }
}