@aitty/browser 0.1.2 → 0.2.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.
@@ -190,12 +190,14 @@
190
190
  .aitty-scroll-viewport {
191
191
  height: 100%;
192
192
  outline: none;
193
- overflow-x: hidden;
193
+ overflow-anchor: none;
194
+ overflow-x: auto;
194
195
  overflow-y: auto;
195
196
  }
196
197
 
197
198
  .aitty-scroll-content {
198
199
  min-height: 100%;
200
+ overflow-anchor: none;
199
201
  }
200
202
 
201
203
  .aitty-terminal-root {
@@ -203,42 +205,84 @@
203
205
  min-width: 0;
204
206
  min-height: 100%;
205
207
  max-height: none;
206
- background: transparent;
208
+ background: var(--theme-term-bg, transparent);
209
+ overflow-anchor: none;
207
210
  }
208
211
 
209
212
  .aitty-terminal-root.wterm {
210
213
  --term-bg: var(--theme-term-bg, transparent);
211
- --term-fg: var(--theme-term-fg, #edf2ff);
214
+ --term-fg: var(--theme-term-fg, #f0f4ff);
215
+ --term-default-dim-mix-target: var(--term-bg);
216
+ --term-dim-mix-bg: var(--theme-term-dim-mix-bg, var(--term-bg));
217
+ --term-dim-mix-target: var(
218
+ --theme-term-dim-mix-target,
219
+ var(--theme-term-dim-fg, var(--term-dim-mix-bg))
220
+ );
221
+ --term-foreground-mix-target: var(--theme-term-foreground-mix-target, var(--term-bg));
222
+ --term-foreground-mix-weight: var(--theme-term-foreground-mix-weight, 100%);
223
+ --term-reverse-bg: var(--theme-term-reverse-bg, var(--term-fg));
224
+ --term-reverse-fg: var(--theme-term-reverse-fg, var(--term-bg));
212
225
  --term-cursor: var(--theme-term-cursor, currentColor);
213
- --term-color-0: var(--theme-term-color-0, #111724);
226
+ --term-color-0: var(--theme-term-color-0, #1a212e);
214
227
  --term-color-1: var(--theme-term-color-1, #ff7b72);
215
- --term-color-2: var(--theme-term-color-2, #8ddb8c);
216
- --term-color-3: var(--theme-term-color-3, #ffd580);
217
- --term-color-4: var(--theme-term-color-4, #7cc4ff);
228
+ --term-color-2: var(--theme-term-color-2, #7ee787);
229
+ --term-color-3: var(--theme-term-color-3, #f2cc60);
230
+ --term-color-4: var(--theme-term-color-4, #79c0ff);
218
231
  --term-color-5: var(--theme-term-color-5, #d2a8ff);
219
- --term-color-6: var(--theme-term-color-6, #77e0d2);
220
- --term-color-7: var(--theme-term-color-7, #edf2ff);
221
- --term-color-8: var(--theme-term-color-8, #5f6f86);
232
+ --term-color-6: var(--theme-term-color-6, #70e1e8);
233
+ --term-color-7: var(--theme-term-color-7, #f0f4ff);
234
+ --term-color-8: var(--theme-term-color-8, #546681);
222
235
  --term-color-9: var(--theme-term-color-9, #ffa198);
223
- --term-color-10: var(--theme-term-color-10, #b0f2af);
224
- --term-color-11: var(--theme-term-color-11, #ffe4a8);
225
- --term-color-12: var(--theme-term-color-12, #a7d7ff);
226
- --term-color-13: var(--theme-term-color-13, #e1c0ff);
227
- --term-color-14: var(--theme-term-color-14, #9ff4ea);
236
+ --term-color-10: var(--theme-term-color-10, #aff5b4);
237
+ --term-color-11: var(--theme-term-color-11, #ffdf80);
238
+ --term-color-12: var(--theme-term-color-12, #a5d6ff);
239
+ --term-color-13: var(--theme-term-color-13, #e2c5ff);
240
+ --term-color-14: var(--theme-term-color-14, #96f0f5);
228
241
  --term-color-15: var(--theme-term-color-15, #ffffff);
229
242
  --term-font-size: var(--theme-term-font-size, 15px);
230
- --term-line-height: var(--theme-term-line-height, 1.28);
243
+ --term-line-height: var(--theme-term-line-height, 1.6);
231
244
  color: var(--term-fg);
232
- padding: 0 0 var(--theme-term-padding-bottom, 24px);
245
+ padding: 0 0 var(--theme-term-padding-bottom, 32px);
233
246
  border-radius: 0;
234
247
  box-shadow: none;
235
248
  overflow: visible;
236
249
  }
237
250
 
251
+ .aitty-terminal-root.wterm[data-client-role="viewer"] {
252
+ min-inline-size: calc(var(--term-cell-width, 9px) * var(--term-cols, 80));
253
+ }
254
+
255
+ :where(html[data-theme="light"], [data-theme="light"]) .aitty-terminal-root.wterm {
256
+ --term-default-dim-mix-target: #0f172a;
257
+ --term-dim-mix-target: var(
258
+ --theme-term-dim-mix-target,
259
+ var(--theme-term-dim-fg, var(--term-default-dim-mix-target))
260
+ );
261
+ --term-foreground-mix-target: var(--theme-term-foreground-mix-target, #0f172a);
262
+ --term-foreground-mix-weight: var(--theme-term-foreground-mix-weight, 72%);
263
+ }
264
+
238
265
  .aitty-terminal-root.wterm.has-scrollback {
239
266
  overflow-y: visible;
240
267
  }
241
268
 
269
+ .aitty-terminal-root.wterm.focused .term-cursor {
270
+ box-shadow: 0 -1px 0 var(--term-cursor), 0 1px 0 var(--term-cursor);
271
+ }
272
+
273
+ .aitty-terminal-root.wterm.focused.cursor-blink .term-cursor {
274
+ animation-name: aitty-cursor-blink;
275
+ }
276
+
277
+ .aitty-terminal-root .term-row > span {
278
+ overflow: visible;
279
+ }
280
+
281
+ .aitty-terminal-root .term-block,
282
+ .aitty-terminal-root .term-wide {
283
+ overflow: hidden;
284
+ }
285
+
242
286
  .aitty-terminal-root[data-session-interactive="false"] .term-cursor {
243
287
  opacity: 0 !important;
244
288
  }
@@ -247,18 +291,90 @@
247
291
  caret-color: transparent;
248
292
  }
249
293
 
294
+ .aitty-terminal-root[data-session-interactive="false"] {
295
+ cursor: default;
296
+ }
297
+
298
+ @media (max-width: 768px) and (pointer: coarse) {
299
+ .aitty-terminal-root.wterm {
300
+ --term-mobile-cursor-width: clamp(2px, 0.16em, 3px);
301
+ --term-mobile-cursor-color: color-mix(in srgb, var(--term-cursor) 88%, var(--term-fg));
302
+ --term-mobile-cursor-glow: color-mix(in srgb, var(--term-cursor) 34%, transparent);
303
+ }
304
+
305
+ .aitty-terminal-root.wterm .term-cursor,
306
+ .aitty-terminal-root.wterm.focused .term-cursor {
307
+ position: relative;
308
+ background: transparent;
309
+ color: inherit;
310
+ outline: none;
311
+ box-shadow: none;
312
+ }
313
+
314
+ .aitty-terminal-root.wterm.focused.cursor-blink .term-cursor {
315
+ animation-name: none;
316
+ }
317
+
318
+ .aitty-terminal-root.wterm .term-cursor::after {
319
+ content: "";
320
+ position: absolute;
321
+ top: 0.18em;
322
+ bottom: 0.18em;
323
+ left: 0;
324
+ width: var(--term-mobile-cursor-width);
325
+ border-radius: 999px;
326
+ background: var(--term-mobile-cursor-color);
327
+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--term-bg) 22%, transparent),
328
+ 0 0 9px var(--term-mobile-cursor-glow);
329
+ opacity: 0.48;
330
+ pointer-events: none;
331
+ }
332
+
333
+ .aitty-terminal-root.wterm.focused .term-cursor::after {
334
+ opacity: 1;
335
+ }
336
+
337
+ .aitty-terminal-root.wterm.focused.cursor-blink .term-cursor::after {
338
+ animation: aitty-mobile-cursor-blink 1.05s steps(2, start) infinite;
339
+ }
340
+
341
+ :where(html[data-theme="light"], [data-theme="light"]) .aitty-terminal-root.wterm {
342
+ --term-mobile-cursor-color: color-mix(in srgb, var(--term-cursor) 92%, var(--term-fg));
343
+ --term-mobile-cursor-glow: color-mix(in srgb, var(--term-cursor) 24%, transparent);
344
+ }
345
+
346
+ @media (prefers-reduced-motion: reduce) {
347
+ .aitty-terminal-root.wterm.focused.cursor-blink .term-cursor::after {
348
+ animation: none;
349
+ }
350
+ }
351
+ }
352
+
250
353
  .aitty-terminal-root .term-transcript-archive {
354
+ margin: 0;
355
+ min-height: 0;
356
+ padding: 0;
357
+ color: inherit;
358
+ pointer-events: none;
359
+ }
360
+
361
+ .aitty-terminal-root .term-transcript-visible {
251
362
  margin: 0;
252
363
  min-height: 0;
253
364
  padding: 0;
254
365
  color: inherit;
255
366
  font: inherit;
256
367
  line-height: var(--term-row-height);
257
- pointer-events: none;
258
368
  white-space: pre;
259
369
  }
260
370
 
261
- .aitty-terminal-root .term-transcript-archive:empty {
371
+ .aitty-terminal-root .term-transcript-spacer {
372
+ min-height: 0;
373
+ pointer-events: none;
374
+ }
375
+
376
+ .aitty-terminal-root .term-transcript-archive:empty,
377
+ .aitty-terminal-root .term-transcript-visible:empty {
262
378
  display: none;
263
379
  }
264
380
 
@@ -266,3 +382,29 @@
266
382
  .aitty-terminal-root[data-render-mode="screen"] .term-scrollback-row {
267
383
  display: none;
268
384
  }
385
+
386
+ @keyframes aitty-cursor-blink {
387
+ 0%,
388
+ 100% {
389
+ background: var(--term-cursor);
390
+ box-shadow: 0 -1px 0 var(--term-cursor), 0 1px 0 var(--term-cursor);
391
+ color: var(--term-bg);
392
+ }
393
+
394
+ 50% {
395
+ background: transparent;
396
+ box-shadow: none;
397
+ color: inherit;
398
+ }
399
+ }
400
+
401
+ @keyframes aitty-mobile-cursor-blink {
402
+ 0%,
403
+ 100% {
404
+ opacity: 1;
405
+ }
406
+
407
+ 50% {
408
+ opacity: 0.22;
409
+ }
410
+ }
@@ -0,0 +1,42 @@
1
+ function resolveVirtualTranscriptWindow(options) {
2
+ const totalRows = Math.max(0, Math.floor(options.totalRows));
3
+ if (totalRows === 0) return {
4
+ bottomSpacerHeight: 0,
5
+ endRow: 0,
6
+ renderedRows: 0,
7
+ startRow: 0,
8
+ topSpacerHeight: 0,
9
+ virtualized: false
10
+ };
11
+ const rowHeight = Math.max(1, options.rowHeight);
12
+ const viewportHeight = Math.max(rowHeight, options.viewportHeight || rowHeight);
13
+ const overscanRows = Math.max(0, Math.floor(options.overscanRows ?? 80));
14
+ const thresholdRows = Math.max(1, Math.floor(options.thresholdRows ?? 600));
15
+ const visibleRowCapacity = Math.max(1, Math.ceil(viewportHeight / rowHeight));
16
+ const maxRenderedRows = Math.max(thresholdRows, visibleRowCapacity + overscanRows * 2);
17
+ if (totalRows <= maxRenderedRows) return {
18
+ bottomSpacerHeight: 0,
19
+ endRow: totalRows,
20
+ renderedRows: totalRows,
21
+ startRow: 0,
22
+ topSpacerHeight: 0,
23
+ virtualized: false
24
+ };
25
+ const archiveTop = Math.max(0, options.archiveTop ?? 0);
26
+ const viewportStart = Math.max(0, options.scrollTop - archiveTop);
27
+ const startRow = clamp(Math.floor(viewportStart / rowHeight) - overscanRows, 0, Math.max(0, totalRows - 1));
28
+ const endRow = clamp(startRow + maxRenderedRows, startRow, totalRows);
29
+ return {
30
+ bottomSpacerHeight: Math.max(0, totalRows - endRow) * rowHeight,
31
+ endRow,
32
+ renderedRows: endRow - startRow,
33
+ startRow,
34
+ topSpacerHeight: startRow * rowHeight,
35
+ virtualized: true
36
+ };
37
+ }
38
+ function clamp(value, min, max) {
39
+ return Math.min(Math.max(value, min), max);
40
+ }
41
+ //#endregion
42
+ export { resolveVirtualTranscriptWindow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitty/browser",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Browser DOM terminal renderer for aitty.",
5
5
  "keywords": [
6
6
  "agent",
@@ -48,7 +48,7 @@
48
48
  "node": ">=20"
49
49
  },
50
50
  "dependencies": {
51
- "@wterm/dom": "^0.1.9",
52
- "@aitty/protocol": "0.1.2"
51
+ "@aitty/wterm-dom": "^0.3.1-aitty.2",
52
+ "@aitty/protocol": "0.2.0"
53
53
  }
54
54
  }