@cplieger/web-terminal-ui 5.3.0 → 5.4.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/README.md CHANGED
@@ -425,4 +425,4 @@ This project was built with AI-assisted tooling using [Claude](https://claude.co
425
425
 
426
426
  ## License
427
427
 
428
- GPL-3.0-or-later. See [LICENSE](LICENSE).
428
+ MPL-2.0. See [LICENSE](LICENSE).
package/css/00-tokens.css CHANGED
@@ -144,27 +144,33 @@
144
144
  --font-mono: "Monaspace Neon NF", monospace;
145
145
  /* How far a chip label's INK sits below its line box's centre, so flex
146
146
  centring can be corrected by exactly that much (see .wt-tab-label in
147
- 30-tabs.css).
147
+ 30-tabs.css). The band is the CAP band — cap top to baseline, the visible
148
+ mass of a label — not cap-to-descender, which reserves empty descender room
149
+ below the letters and reads high (measured: 1.32px above the chip's centre
150
+ at 13px, while the dot and close glyph beside it sat at 0.00px).
148
151
 
149
152
  This value is only the PRE-MEASUREMENT DEFAULT — what the first paint uses
150
153
  before the tabs feature replaces it, per site, with a pixel value measured
151
154
  in the live engine (src/features/tabs/ink-centre.ts). It is not the answer,
152
155
  because no single value can be: engines round the font's ascent and descent
153
156
  to whole CSS pixels before building the line box, so the ideal shift is a
154
- sawtooth in font size rather than a ratio. Against the bundled font in
155
- WebKit it is 0.1190em at 13px and 0.0915em at 14px, since 0.25em x 13 =
156
- 3.25 rounds to 3 (a 16px box) while 0.25em x 14 = 3.5 rounds to 4 (an 18px
157
- box). Engines then disagree with each other (Firefox makes that 14px box
158
- 17px) and platforms disagree within one engine (iOS reads metrics through
159
- CoreText, Linux WebKit through FreeType). Four fixes were hardcoded
160
- constants and each was correct only where it was tuned.
157
+ sawtooth in font size rather than a ratio, and on the cap band it does not
158
+ even keep one sign. Measured against the bundled font it runs from about
159
+ -0.021em (Blink 151 at 13px, a 17px box) to +0.028em (Gecko at 14px, where
160
+ the box is 17px against Blink's 18px), and platforms disagree inside one
161
+ engine too (iOS reads metrics through CoreText, Linux WebKit through
162
+ FreeType) — which is why four hardcoded constants each held only where they
163
+ were tuned.
161
164
 
162
- 0.1147em is kept as the default because it is the midpoint of that
163
- sawtooth: worst case 0.34px before the measurement lands, versus 1.5px for
164
- no correction at all. Do not tune it by eye — a wrong default is invisible
165
- the moment the measured value arrives, so eye-tuning it optimises nothing
166
- and pins the wrong number in place. */
167
- --label-ink-shift: 0.1147em;
165
+ ZERO is the default because the whole range is within ~0.03em of it: flex
166
+ centring of the font box is already within 0.4px of cap-band centring, so
167
+ the first paint starts uncorrected and the measurement lands within a frame.
168
+ That is also the best behaviour if the measurement never runs at all (no
169
+ canvas, a display:none probe): 0.4px out rather than the 1.3px a
170
+ descender-inclusive constant was. Do not tune it by eye — a wrong default is
171
+ invisible the moment the measured value arrives, so eye-tuning it optimises
172
+ nothing and pins the wrong number in place. */
173
+ --label-ink-shift: 0em;
168
174
  --dur-micro: 0.1s;
169
175
  --dur-standard: 0.2s;
170
176
  --dur-enter: 0.25s;
package/css/01-scope.css CHANGED
@@ -15,6 +15,16 @@
15
15
  .wt-root.wt-viewport {
16
16
  position: fixed;
17
17
  inset: 0;
18
+ /* Clip like the container mode below, so the two layout modes agree. Inert
19
+ today: the root's box IS the viewport here and page.css already hides
20
+ document overflow, so nothing can currently paint outside it, and
21
+ position:fixed descendants escape a clip regardless. It exists so the
22
+ asymmetry cannot be mistaken for a deliberate difference, and so a future
23
+ transform on .term (see docs/tab-switch-repaint.md) is bounded by a
24
+ declaration rather than by the viewport happening to coincide with the box.
25
+ overflow:clip specifically, not hidden: no scroll container, no block
26
+ formatting context, nothing programmatically scrollable. */
27
+ overflow: clip;
18
28
  }
19
29
 
20
30
  .wt-root.wt-container {
@@ -45,6 +45,12 @@
45
45
  touch-action: pan-x pan-y;
46
46
  font-family: var(--font-mono);
47
47
  font-size: 14px;
48
+ /* The cell height. It is PAIRED with the bundled font's overridden vertical
49
+ metrics (page.css): a cell's background is painted by an inline span, whose
50
+ box comes from the font's ascent + descent, so those must stay >= this value
51
+ or every row boundary shows an unpainted stripe. Changing either number
52
+ alone reopens that gap. The engine reads this as its cell height
53
+ (render.ts updateFontMetrics) and sizes the PTY from it. */
48
54
  line-height: 17px;
49
55
  padding: 4px;
50
56
  background: var(--bg);
package/css/30-tabs.css CHANGED
@@ -215,9 +215,16 @@
215
215
  the baseline than below it (the bundled font: 0.995em over, 0.250em under),
216
216
  while the ink of a mixed-case title runs ~0.734em over (cap height) to ~0.203em
217
217
  under (descender). Flex centring centres the BOX, which leaves the visible text
218
- --label-ink-shift low — about 1.5px at this size — reading as baseline-aligned
219
- with the activity dot's bottom edge instead of level with its centre. Two
220
- declarations, one job, and a third that must NOT be added:
218
+ --label-ink-shift low — reading as baseline-aligned with the activity dot's
219
+ bottom edge instead of level with its centre. Two declarations, one job, and a
220
+ third that must NOT be added:
221
+
222
+ The band being centred is cap top to BASELINE. Descender ink is deliberately
223
+ outside it: including it reserves empty room below the letters, and the label
224
+ then reads HIGH — measured on this chip at 13px, the title's cap band sat
225
+ 1.32px above the chip's centre while the dot and the close glyph beside it sat
226
+ at 0.00px. Same edges as `text-box-edge: cap alphabetic`. Descenders overhang
227
+ the band, which is what the padding below is for.
221
228
 
222
229
  - padding-block is the ink allowance, not spacing. `overflow: hidden` (which
223
230
  the ellipsis requires) clips at the padding box, and the line box clears the
@@ -227,6 +234,9 @@
227
234
  - margin-block hangs TWICE the shift below the box. Flex centring centres the
228
235
  MARGIN box, so a bottom-heavy margin lifts the border box by half of it --
229
236
  exactly one shift -- and unlike padding it does not enlarge the clipping box.
237
+ The shift can be NEGATIVE (a top-heavy margin, pushing the box down) at sizes
238
+ where the engine's rounding already overshoots; that is a normal outcome of
239
+ the measurement, not a sign the arithmetic is inverted.
230
240
  - line-height stays at `normal`, deliberately. Setting it looks like the
231
241
  responsible thing to do and it is the trap: `normal` is the ONE value whose
232
242
  half-leading is zero by definition, which is what makes the baseline sit at
@@ -240,16 +250,19 @@
240
250
  --label-ink-shift is MEASURED, not declared. The tabs feature writes a pixel
241
251
  value per site from the line box the running engine produced for this font at
242
252
  this size (src/features/tabs/ink-centre.ts); the em value in 00-tokens.css is
243
- only what the first paint uses. Four earlier fixes were constants, and the
244
- reason none held is that engines round the font's ascent and descent to whole
245
- CSS pixels before laying out the line box, so the required shift is a sawtooth
246
- in font size, not a ratio: in WebKit 0.1190em at 13px against 0.0915em at 14px,
247
- because 0.25em x 13 = 3.25 rounds to 3 (a 16px box) while 0.25em x 14 = 3.5
248
- rounds to 4 (an 18px box). The three engines also report slightly different ink
249
- extents for one font file (cap 0.7344 / 0.7350 / 0.7300em in WebKit, Blink and
250
- Gecko), Firefox makes that 14px box 17px rather than 18px, and iOS resolves
251
- metrics through CoreText where Linux WebKit uses FreeType — which is why the
252
- 13px strip measured centred in every local check and still read high on an
253
+ only what the first paint uses, and it is 0 because the cap-band correction is
254
+ within 0.4px of nothing on every engine measured. Four earlier fixes were
255
+ constants, and the reason none held is that engines round the font's ascent and
256
+ descent to whole CSS pixels before laying out the line box, so the required
257
+ shift is a sawtooth in font size, not a ratio: on the cap band it runs from
258
+ about -0.021em (Blink 151 at 13px, a 17px box) to +0.0279em (Gecko at 14px,
259
+ where the box is 17px against Blink's 18px), changing sign along the way,
260
+ because 0.25em x 13 = 3.25 and 0.25em x 14 = 3.5 round to different whole
261
+ pixels. The three engines
262
+ also report slightly different ink extents for one font file (cap 0.7344 /
263
+ 0.7350 / 0.7300em in WebKit, Blink and Gecko), and iOS resolves metrics through
264
+ CoreText where Linux WebKit uses FreeType — which is why the 13px strip
265
+ measured centred in every local check and still read high on an
253
266
  iPad. Nothing here is tunable by eye; if the centring looks wrong, run
254
267
  scripts/verify-chip-geometry.mjs and fix what it measures.
255
268
 
@@ -482,9 +495,81 @@
482
495
  }
483
496
  }
484
497
 
485
- /* The tab being dragged (reorder) dims while it moves. */
486
- :where(.wt-root) .wt-tab-dragging {
487
- opacity: 0.5;
498
+ /* ===== Pending drop edge (tabs feature, desktop drag) =====
499
+ The exact boundary the dragged tab will be inserted at, marked while the hold runs
500
+ and filling from nothing to full over the hold's own duration (the tabs feature
501
+ sets the duration inline from REORDER_DWELL_MS, so the bar and the timer cannot
502
+ drift apart).
503
+
504
+ It rides the neighbouring chip: the leading edge of the chip being pushed aside,
505
+ or the trailing edge of the last chip when the tab is heading past the end of the
506
+ strip (.wt-tab-dwell-end). The chip is already position: relative for its progress
507
+ bar, and its overflow clip keeps the rail inside the same rounded padding box.
508
+
509
+ 3px of solid accent rather than a dashed treatment: the dashed vocabulary belongs
510
+ to the SLOT, which is a destination that has been decided. This is a boundary
511
+ still being chosen, so it reads as a caret. inset-block keeps it clear of the
512
+ chip's rounded corners without needing its own radius arithmetic. */
513
+ :where(.wt-root) .wt-tab-dwell {
514
+ position: absolute;
515
+ inset-block: var(--sp-1);
516
+ inset-inline-start: 0;
517
+ width: 3px;
518
+ border-radius: var(--radius-sm);
519
+ background: var(--accent);
520
+ /* Grows upward like a gauge. The feature writes scaleY inline; a transform on this
521
+ element cannot collide with the chip's own animations because it is a separate
522
+ element, which is the whole reason the rail is not a pseudo-element on the chip. */
523
+ transform-origin: bottom;
524
+ pointer-events: none;
525
+ }
526
+
527
+ :where(.wt-root) .wt-tab-dwell-end {
528
+ inset-inline: auto 0;
529
+ }
530
+
531
+ /* ===== Reorder drop slot (tabs feature, desktop drag) =====
532
+ The dragged chip stays in the strip's flow for the whole gesture and renders as
533
+ the SLOT it will land in: an empty dashed outline in the accent over a faint
534
+ accent wash. It used to be a dimmed copy of the tab, and with a solid drag
535
+ image already following the pointer that put three tab-shaped things on screen
536
+ at once — the slot it left, the chip it hovered, and the copy under the
537
+ pointer — none of which read as the answer to "where will this land". One
538
+ solid thing under the pointer, one hollow thing where it will land.
539
+
540
+ Staying in the flow is what keeps the geometry honest: the slot IS the gap,
541
+ exactly one chip wide, so nothing has to synthesise a placeholder box or agree
542
+ with the chip about how wide a tab is. It is also what lets the reorder animate
543
+ at all — the strip's other chips slide around a real box (index.ts, commitSlot).
544
+
545
+ The outline is the chip's OWN reserved border switched to `dashed`: every tab
546
+ carries a transparent 1px border for exactly this kind of toggle (see .wt-tab),
547
+ so the treatment costs no layout and lands on the same --radius-inner corners
548
+ as every other chip state.
549
+
550
+ Scoped through .wt-tab-scroll on purpose, and it is not decoration. A drag
551
+ reorder exists only inside the desktop scroller, and the extra compound is what
552
+ carries the rule past the two rungs it has to out-rank without any of the usual
553
+ tricks: the press rung (.wt-tab:not(.wt-tab-active):active, which a mousedown
554
+ that starts a drag leaves applied for the whole gesture in Blink, so the slot
555
+ would otherwise paint as a pressed tab under the dashes), and the per-status
556
+ dot rules far below, which would otherwise keep the status dot lit inside an
557
+ outline that is meant to be empty. */
558
+ :where(.wt-root) .wt-tab-scroll .wt-tab.wt-tab-dragging {
559
+ background: color-mix(in oklch, var(--accent) 12%, transparent);
560
+ border-color: color-mix(in oklch, var(--accent) 60%, transparent);
561
+ border-style: dashed;
562
+ }
563
+
564
+ /* Nothing inside the slot: the outline is the whole message, and the tab's
565
+ identity is already in the drag image under the pointer. Fading the CONTENT
566
+ rather than the chip is what keeps the dashes at full strength — an opacity on
567
+ the chip dimmed the outline along with everything else, which is exactly how
568
+ the old treatment ended up reading as a faded tab rather than as a gap. The dot
569
+ is included by inheritance: opacity multiplies onto its glow and ripple
570
+ pseudo-elements, so one declaration silences the whole dot. */
571
+ :where(.wt-root) .wt-tab-scroll .wt-tab.wt-tab-dragging > * {
572
+ opacity: 0;
488
573
  }
489
574
 
490
575
  /* ===== Inline rename (tabs feature) =====
@@ -196,11 +196,12 @@
196
196
 
197
197
  /* Ink-centring geometry, identical to .wt-tab-label: a symmetric ink allowance
198
198
  the ellipsis clipping needs, plus a bottom margin of twice --label-ink-shift
199
- that lifts the ink to the row centre. These labels are 14px against the strip's
199
+ that lifts the CAP band (cap top to baseline, never cap-to-descender) to the row
200
+ centre. These labels are 14px against the strip's
200
201
  13px, which is exactly why --label-ink-shift is MEASURED per site at runtime
201
202
  (src/features/tabs/ink-centre.ts) rather than declared once: the shift an engine
202
- needs is a sawtooth in font size, not a ratio, so the single em constant that
203
- served both sizes was correct at 13px and 0.33px high here. See 30-tabs.css for
203
+ needs is a sawtooth in font size, not a ratio — it does not even keep one sign
204
+ across the two sizes. See 30-tabs.css for
204
205
  the full derivation, for why line-height must stay `normal`, and for why a
205
206
  measured shift beats a text-box trim behind an @supports gate. */
206
207
  :where(.wt-root) .wt-switcher-label {
@@ -471,11 +472,12 @@
471
472
 
472
473
  /* Ink-centring geometry, identical to .wt-tab-label: a symmetric ink allowance
473
474
  the ellipsis clipping needs, plus a bottom margin of twice --label-ink-shift
474
- that lifts the ink to the row centre. These labels are 14px against the strip's
475
+ that lifts the CAP band (cap top to baseline, never cap-to-descender) to the row
476
+ centre. These labels are 14px against the strip's
475
477
  13px, which is exactly why --label-ink-shift is MEASURED per site at runtime
476
478
  (src/features/tabs/ink-centre.ts) rather than declared once: the shift an engine
477
- needs is a sawtooth in font size, not a ratio, so the single em constant that
478
- served both sizes was correct at 13px and 0.33px high here. See 30-tabs.css for
479
+ needs is a sawtooth in font size, not a ratio — it does not even keep one sign
480
+ across the two sizes. See 30-tabs.css for
479
481
  the full derivation, for why line-height must stay `normal`, and for why a
480
482
  measured shift beats a text-box trim behind an @supports gate. */
481
483
  :where(.wt-root) .wt-switcher-row-label {
@@ -27,15 +27,48 @@
27
27
  display var(--dur-standard) allow-discrete;
28
28
  }
29
29
 
30
- /* Tab chrome micro-transitions (hover/active color shifts). */
30
+ /* Tab chrome micro-transitions (hover/active colour shifts, and a chip's hand-off
31
+ into the reorder drop slot). border-color rides along because the slot IS a
32
+ border-colour change plus a dashed style (30-tabs.css): without it the chip
33
+ snapped from tab to outline in a single frame, which is the same instant
34
+ rearrangement the reorder preview exists to remove. The dash pattern itself still
35
+ appears at once — border-style does not interpolate — so the slot reads as an
36
+ outline drawing itself in rather than as a tab bleaching out. */
31
37
  :where(.wt-root.wt-animate) .wt-tab,
32
38
  :where(.wt-root.wt-animate) .wt-tab-close,
33
39
  :where(.wt-root.wt-animate) .wt-tab-new {
34
40
  transition:
35
41
  background-color var(--dur-micro) var(--ease-standard),
42
+ border-color var(--dur-micro) var(--ease-standard),
36
43
  color var(--dur-micro) var(--ease-standard);
37
44
  }
38
45
 
46
+ /* The chip's content dissolves as it becomes the drop slot, and comes back when the
47
+ drag ends (30-tabs.css fades every child to nothing). One rule on the children,
48
+ not four per-part rules: the label, the status dot, the progress bar and the close
49
+ all leave together, because they leave for one reason. */
50
+ :where(.wt-root.wt-animate) .wt-tab > * {
51
+ transition: opacity var(--dur-micro) var(--ease-standard);
52
+ }
53
+
54
+ /* The drop slot fades in at each position the reorder preview commits it to
55
+ (index.ts, flashSlot). The chips it displaces SLIDE there — a JS FLIP, because the
56
+ distance is only known at commit time — while the slot itself deliberately does
57
+ not travel: a hole crossing the strip alongside the solid drag image the pointer
58
+ is already carrying is two things moving at once, which is what made the old
59
+ instant reorder unreadable. It appears where the strip has just opened, which is
60
+ the frame that says the reorder took. */
61
+ :where(.wt-root.wt-animate) .wt-tab-slotted {
62
+ animation: wt-slot-in var(--dur-enter) var(--ease-enter);
63
+ }
64
+
65
+ @keyframes wt-slot-in {
66
+ from {
67
+ opacity: 0;
68
+ transform: scale(0.97);
69
+ }
70
+ }
71
+
39
72
  /* New tab enters with a fade + scale-in. Only runtime-added tabs get
40
73
  .wt-tab-enter (the tabs feature's `started` gate). A closing tab is removed
41
74
  immediately with no exit animation, so the strip reflows in one frame (a
package/css/page.css CHANGED
@@ -215,13 +215,44 @@ body {
215
215
  different typeface per engine (see --label-ink-shift in 00-tokens.css). An
216
216
  embedder does not serve these files and never inherits these URLs, so it
217
217
  either ships its own @font-face or lets both tokens fall back to the platform
218
- monospace stack. */
218
+ monospace stack.
219
+
220
+ EVERY face overrides the font's vertical metrics to 0.995em over the baseline
221
+ and 0.250em under, and that is load-bearing for the terminal, not taste.
222
+
223
+ A cell's background is painted by an inline span, and an inline box paints its
224
+ FONT's content area, never the line box: at `font-size: 14px` with
225
+ `line-height: 17px` (02-terminal.css) a font whose ascent + descent is under
226
+ 17px leaves an unpainted stripe between consecutive rows, so an application
227
+ drawing a solid column of background (kiro-cli's green and purple block
228
+ gutters) renders as dashes. GitHub's own Monaspace webfont declares
229
+ ascent 1890/2000 and descent 400/2000 with USE_TYPO_METRICS set, which is
230
+ 0.945em + 0.200em = 16.03px at 14px, and Chromium rounds that to a 16px box
231
+ inside a 17px row: a 1px gap on every row boundary, measured in the sidecar.
232
+
233
+ 0.995em + 0.250em is what the nerd-fonts-patched MonaspiceNe NFM OTFs carried
234
+ until 5.3.0 swapped them for these WOFF2 files (the swap was gated on
235
+ horizontal advances only, which is how the regression shipped). It rounds to
236
+ an 18px box, so a row's background overhangs its box by 1px and consecutive
237
+ rows meet with no seam — and the baseline does not move (13px from the row's
238
+ top edge, before and after), so no glyph shifts by restoring it. It is also
239
+ the metric pair the rest of this package is already tuned and documented
240
+ against: --label-ink-shift's sawtooth and ink-centre.ts both derive from
241
+ 0.995em / 0.250em by name.
242
+
243
+ Do not "modernise" these away, and do not close the gap by lowering
244
+ `line-height` instead: that shrinks the cell, so it changes how many rows fit
245
+ a viewport and what the engine reports to the PTY. If a Monaspace bump ever
246
+ changes the outlines enough that a 0.995em ascent clips them, re-measure both
247
+ halves together — the terminal needs ascent + descent >= the cell height. */
219
248
  @font-face {
220
249
  font-family: "Monaspace Neon NF";
221
250
  src: url("/vendor/fonts/MonaspaceNeonNF-Regular.woff2") format("woff2");
222
251
  font-weight: 400;
223
252
  font-style: normal;
224
253
  font-display: block;
254
+ ascent-override: 99.5%;
255
+ descent-override: 25%;
225
256
  }
226
257
 
227
258
  @font-face {
@@ -230,6 +261,8 @@ body {
230
261
  font-weight: 700;
231
262
  font-style: normal;
232
263
  font-display: block;
264
+ ascent-override: 99.5%;
265
+ descent-override: 25%;
233
266
  }
234
267
 
235
268
  @font-face {
@@ -238,6 +271,8 @@ body {
238
271
  font-weight: 400;
239
272
  font-style: italic;
240
273
  font-display: block;
274
+ ascent-override: 99.5%;
275
+ descent-override: 25%;
241
276
  }
242
277
 
243
278
  @font-face {
@@ -246,4 +281,6 @@ body {
246
281
  font-weight: 700;
247
282
  font-style: italic;
248
283
  font-display: block;
284
+ ascent-override: 99.5%;
285
+ descent-override: 25%;
249
286
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@cplieger/web-terminal-ui",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "type": "module",
5
5
  "description": "Reference touch-first browser UI for @cplieger/web-terminal-engine: a composable kernel + feature modules (tabs, activity monitor, mobile toolbar, context menu, IME, predictive echo, viewport handling) and CSS. One createTerminal() call.",
6
- "license": "GPL-3.0-or-later",
6
+ "license": "MPL-2.0",
7
7
  "exports": {
8
8
  ".": "./src/index.ts",
9
9
  "./startup-copy": "./src/kernel/startup-copy.ts",
@@ -40,7 +40,7 @@
40
40
  "verify": "bash scripts/verify.sh"
41
41
  },
42
42
  "peerDependencies": {
43
- "@cplieger/web-terminal-engine": "^3.7.0"
43
+ "@cplieger/web-terminal-engine": "^3.10.0"
44
44
  },
45
45
  "overrides": {
46
46
  "qs": "^6.15.2"