@cplieger/web-terminal-ui 7.2.0 → 7.2.2

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/css/00-tokens.css CHANGED
@@ -142,34 +142,10 @@
142
142
  rides on that fallback. */
143
143
  --font-ui: "Monaspace Neon NF", ui-monospace, monospace;
144
144
  --font-mono: "Monaspace Neon NF", monospace;
145
- /* How far a chip label's INK sits below its line box's centre, so flex
146
- centring can be corrected by exactly that much (see .wt-tab-label in
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).
151
-
152
- This value is only the PRE-MEASUREMENT DEFAULT — what the first paint uses
153
- before the tabs feature replaces it, per site, with a pixel value measured
154
- in the live engine (src/features/tabs/ink-centre.ts). It is not the answer,
155
- because no single value can be: engines round the font's ascent and descent
156
- to whole CSS pixels before building the line box, so the ideal shift is a
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.
164
-
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. */
145
+ /* Pre-measurement default for the chip labels' ink centring; the tabs feature
146
+ writes a measured px value per site (src/features/tabs/ink-centre.ts owns
147
+ why). Zero: flex centring already lands within 0.4px of the cap band, and is
148
+ the best answer when the measurement cannot run. Do not tune it by eye. */
173
149
  --label-ink-shift: 0em;
174
150
  --dur-micro: 0.1s;
175
151
  --dur-standard: 0.2s;
@@ -44,13 +44,13 @@
44
44
  (WebKit bug 240917), which the switcher-bar gesture relies on. */
45
45
  touch-action: pan-x pan-y;
46
46
  font-family: var(--font-mono);
47
+ /* Bold and italic are real faces (page.css); a synthesized stand-in must
48
+ never be drawn in their place. */
49
+ font-synthesis: none;
47
50
  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. */
51
+ /* The cell height. The engine reads it (render.ts updateFontMetrics) and sizes
52
+ the PTY from it. The row background owes it nothing: see the run padding
53
+ below. */
54
54
  line-height: 17px;
55
55
  padding: 4px;
56
56
  background: var(--bg);
@@ -82,6 +82,14 @@
82
82
  content: "\00a0";
83
83
  }
84
84
 
85
+ /* The cell background is THIS padding, not the font: an inline run paints its
86
+ font's content area (16px of the 17px row), and shipping Safari has no
87
+ ascent-override to widen it (webkit.org/b/219735, fixed in trunk 2026-08). */
88
+ :where(.wt-root) .term-row span,
89
+ :where(.wt-root) .term-row a {
90
+ padding-block: 1px;
91
+ }
92
+
85
93
  /* "earlier output trimmed" marker (vterm renderer inserts .term-trim-marker
86
94
  as the first row when history older than the buffer holds was evicted —
87
95
  client-side cap or a server-reported resume gap). A quiet, centered,
@@ -91,6 +99,7 @@
91
99
  font-size: 0.6875rem;
92
100
  text-align: center;
93
101
  padding: 2px 0;
102
+ -webkit-user-select: none;
94
103
  user-select: none;
95
104
  font-family: var(--font-ui);
96
105
  }
@@ -141,12 +150,12 @@
141
150
  explicitly and must never let an ancestor override them. `user-select`
142
151
  is spec'd as non-inherited but WebKit/Chromium treat it as inherited,
143
152
  so a stray `user-select: none` on html/body/.term would silently kill
144
- selection here; keep it `text` (modern Safari honors the unprefixed
145
- form, so no `-webkit-` pair is needed). `-webkit-touch-callout: default`
153
+ selection here; keep it `text`. `-webkit-touch-callout: default`
146
154
  keeps the iOS callout (a page-level `none` suppresses it) and has no
147
155
  standard equivalent. No JS may `preventDefault` a touch/pointer/
148
156
  contextmenu over this element or the native selection dies (see the
149
157
  kernel focus handling + contextMenu feature). */
158
+ -webkit-user-select: text;
150
159
  user-select: text;
151
160
  -webkit-touch-callout: default;
152
161
 
package/css/30-tabs.css CHANGED
@@ -152,6 +152,7 @@
152
152
  font-size: 0.8125rem;
153
153
  cursor: pointer;
154
154
  white-space: nowrap;
155
+ -webkit-user-select: none;
155
156
  user-select: none;
156
157
  /* Kills the 300ms double-tap-to-zoom delay, which is what makes a double-TAP
157
158
  usable as the touch rename entry: on iPadOS a long-press on this chip starts
@@ -224,81 +225,22 @@
224
225
  background: color-mix(in oklch, var(--tab-active-bg), var(--tab-active-fg) 22%);
225
226
  }
226
227
 
227
- /* The label flexes to fill the fixed-width tab and truncates with an ellipsis
228
- (min-width: 0 lets a flex item shrink below its content width), and it owns the
229
- ink-centring geometry the two switcher labels in 31-switcher.css share verbatim.
230
-
231
- Centre the INK, not the line box. A font's metrics box reaches far higher above
232
- the baseline than below it (the bundled font: 0.995em over, 0.250em under),
233
- while the ink of a mixed-case title runs ~0.734em over (cap height) to ~0.203em
234
- under (descender). Flex centring centres the BOX, which leaves the visible text
235
- --label-ink-shift low — reading as baseline-aligned with the activity dot's
236
- bottom edge instead of level with its centre. Two declarations, one job, and a
237
- third that must NOT be added:
238
-
239
- The band being centred is cap top to BASELINE. Descender ink is deliberately
240
- outside it: including it reserves empty room below the letters, and the label
241
- then reads HIGH — measured on this chip at 13px, the title's cap band sat
242
- 1.32px above the chip's centre while the dot and the close glyph beside it sat
243
- at 0.00px. Same edges as `text-box-edge: cap alphabetic`. Descenders overhang
244
- the band, which is what the padding below is for.
245
-
246
- - padding-block is the ink allowance, not spacing. `overflow: hidden` (which
247
- the ellipsis requires) clips at the padding box, and the line box clears the
248
- tallest ink by only 0.6px, so an unpadded label shaves the top off every
249
- acute accent and caron. 0.125em per side buys 2.2px of clearance at 13px, and
250
- being symmetric it does not move the centred text.
251
- - margin-block hangs TWICE the shift below the box. Flex centring centres the
252
- MARGIN box, so a bottom-heavy margin lifts the border box by half of it --
253
- exactly one shift -- and unlike padding it does not enlarge the clipping box.
254
- The shift can be NEGATIVE (a top-heavy margin, pushing the box down) at sizes
255
- where the engine's rounding already overshoots; that is a normal outcome of
256
- the measurement, not a sign the arithmetic is inverted.
257
- - line-height stays at `normal`, deliberately. Setting it looks like the
258
- responsible thing to do and it is the trap: `normal` is the ONE value whose
259
- half-leading is zero by definition, which is what makes the baseline sit at
260
- exactly the engine's ascent below the box top. Any other value leaves
261
- (line-height - font box) / 2 to be halved and rounded, and Chromium floors
262
- it -- measured with an explicit 1.25 the 14px switcher labels came out a
263
- FULL pixel high (line box 17.5 under an 18px font box, so half-leading
264
- -0.25 floored to -1) while the 13px strip label was fine, which is exactly
265
- the kind of works-where-I-looked bug this rule exists to end.
266
-
267
- --label-ink-shift is MEASURED, not declared. The tabs feature writes a pixel
268
- value per site from the line box the running engine produced for this font at
269
- this size (src/features/tabs/ink-centre.ts); the em value in 00-tokens.css is
270
- only what the first paint uses, and it is 0 because the cap-band correction is
271
- within 0.4px of nothing on every engine measured. Four earlier fixes were
272
- constants, and the reason none held is that engines round the font's ascent and
273
- descent to whole CSS pixels before laying out the line box, so the required
274
- shift is a sawtooth in font size, not a ratio: on the cap band it runs from
275
- about -0.021em (Blink 151 at 13px, a 17px box) to +0.0279em (Gecko at 14px,
276
- where the box is 17px against Blink's 18px), changing sign along the way,
277
- because 0.25em x 13 = 3.25 and 0.25em x 14 = 3.5 round to different whole
278
- pixels. The three engines
279
- also report slightly different ink extents for one font file (cap 0.7344 /
280
- 0.7350 / 0.7300em in WebKit, Blink and Gecko), and iOS resolves metrics through
281
- CoreText where Linux WebKit uses FreeType — which is why the 13px strip
282
- measured centred in every local check and still read high on an
283
- iPad. Nothing here is tunable by eye; if the centring looks wrong, run
284
- scripts/verify-chip-geometry.mjs and fix what it measures.
285
-
286
- What this deliberately does NOT use is `text-box: trim-both`, which three of
287
- the four previous attempts were built on. It ships in Blink and WebKit only
288
- (Firefox 151 still reports false for it), so it can only be applied behind an
289
- @supports gate, and a gate means two engines render two different geometries of
290
- which only the one the author is looking at ever gets tuned. Trimming to
291
- `cap alphabetic` and giving the descender back as asymmetric padding IS
292
- size-independent and holds to 0.05px in both engines that implement it — but
293
- ungated it swings to 0.39px in Firefox, and a measured shift needs no gate and
294
- no second code path to beat it. */
228
+ /* Centres the label's INK (cap top to baseline), not its line box; the shift is
229
+ measured per site by features/tabs/ink-centre.ts, which owns why. Not
230
+ `text-box: trim-both` (Firefox lacks it; a gate is two geometries, one
231
+ untuned), and `line-height` stays `normal`: Chromium floors any other
232
+ half-leading (1.25 put 14px labels a pixel high). */
295
233
  :where(.wt-root) .wt-tab-label {
296
234
  flex: 1 1 auto;
297
235
  min-width: 0;
298
236
  overflow: hidden;
299
237
  white-space: nowrap;
300
238
  text-overflow: ellipsis;
239
+ /* The ink allowance `overflow: hidden` needs (the line box clears an accent by
240
+ ~0.6px); symmetric, so it moves nothing. */
301
241
  padding-block: 0.125em;
242
+ /* Flex centres the MARGIN box, so twice the shift below lifts the border box
243
+ by one shift without growing the clip. A negative shift is a normal result. */
302
244
  margin-block: 0 calc(2 * var(--label-ink-shift));
303
245
  }
304
246
 
@@ -553,6 +495,7 @@
553
495
  even though the property is non-inherited per spec (the same deviation the
554
496
  touch model documents for .term-output). Without this, caret placement and
555
497
  text selection break inside the field in Safari — i.e. on the iPad. */
498
+ -webkit-user-select: text;
556
499
  user-select: text;
557
500
  /* The chip is cursor: pointer; a text field must not inherit that. */
558
501
  cursor: text;
package/css/page.css CHANGED
@@ -28,7 +28,6 @@ body {
28
28
  this, rotating a phone to landscape zooms the text. iOS Safari implements
29
29
  ONLY the -webkit- prefixed form (the unprefixed property is ignored there),
30
30
  so both are required — unprefixed alone left iPhones inflating on rotate. */
31
- /* stylelint-disable-next-line property-no-vendor-prefix -- iOS Safari only implements the prefixed form */
32
31
  -webkit-text-size-adjust: 100%;
33
32
  text-size-adjust: 100%;
34
33
  overscroll-behavior: none;
@@ -236,42 +235,14 @@ body {
236
235
  either ships its own @font-face or lets both tokens fall back to the platform
237
236
  monospace stack.
238
237
 
239
- EVERY face overrides the font's vertical metrics to 0.995em over the baseline
240
- and 0.250em under, and that is load-bearing for the terminal, not taste.
241
-
242
- A cell's background is painted by an inline span, and an inline box paints its
243
- FONT's content area, never the line box: at `font-size: 14px` with
244
- `line-height: 17px` (02-terminal.css) a font whose ascent + descent is under
245
- 17px leaves an unpainted stripe between consecutive rows, so an application
246
- drawing a solid column of background (kiro-cli's green and purple block
247
- gutters) renders as dashes. GitHub's own Monaspace webfont declares
248
- ascent 1890/2000 and descent 400/2000 with USE_TYPO_METRICS set, which is
249
- 0.945em + 0.200em = 16.03px at 14px, and Chromium rounds that to a 16px box
250
- inside a 17px row: a 1px gap on every row boundary, measured in the sidecar.
251
-
252
- 0.995em + 0.250em is what the nerd-fonts-patched MonaspiceNe NFM OTFs carried
253
- until 5.3.0 swapped them for these WOFF2 files (the swap was gated on
254
- horizontal advances only, which is how the regression shipped). It rounds to
255
- an 18px box, so a row's background overhangs its box by 1px and consecutive
256
- rows meet with no seam — and the baseline does not move (13px from the row's
257
- top edge, before and after), so no glyph shifts by restoring it. It is also
258
- the metric pair the rest of this package is already tuned and documented
259
- against: --label-ink-shift's sawtooth and ink-centre.ts both derive from
260
- 0.995em / 0.250em by name.
261
-
262
- Do not "modernise" these away, and do not close the gap by lowering
263
- `line-height` instead: that shrinks the cell, so it changes how many rows fit
264
- a viewport and what the engine reports to the PTY. If a Monaspace bump ever
265
- changes the outlines enough that a 0.995em ascent clips them, re-measure both
266
- halves together — the terminal needs ascent + descent >= the cell height. */
238
+ No face carries ascent-override or descent-override: the terminal's cell
239
+ background is the run padding in 02-terminal.css, never these metrics. */
267
240
  @font-face {
268
241
  font-family: "Monaspace Neon NF";
269
242
  src: url("/vendor/fonts/MonaspaceNeonNF-Regular.woff2") format("woff2");
270
243
  font-weight: 400;
271
244
  font-style: normal;
272
245
  font-display: block;
273
- ascent-override: 99.5%;
274
- descent-override: 25%;
275
246
  }
276
247
 
277
248
  @font-face {
@@ -280,8 +251,6 @@ body {
280
251
  font-weight: 700;
281
252
  font-style: normal;
282
253
  font-display: block;
283
- ascent-override: 99.5%;
284
- descent-override: 25%;
285
254
  }
286
255
 
287
256
  @font-face {
@@ -290,8 +259,6 @@ body {
290
259
  font-weight: 400;
291
260
  font-style: italic;
292
261
  font-display: block;
293
- ascent-override: 99.5%;
294
- descent-override: 25%;
295
262
  }
296
263
 
297
264
  @font-face {
@@ -300,6 +267,4 @@ body {
300
267
  font-weight: 700;
301
268
  font-style: italic;
302
269
  font-display: block;
303
- ascent-override: 99.5%;
304
- descent-override: 25%;
305
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplieger/web-terminal-ui",
3
- "version": "7.2.0",
3
+ "version": "7.2.2",
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
6
  "license": "MPL-2.0",
@@ -40,7 +40,7 @@
40
40
  "verify": "bash scripts/verify.sh"
41
41
  },
42
42
  "peerDependencies": {
43
- "@cplieger/web-terminal-engine": "^5.1.0"
43
+ "@cplieger/web-terminal-engine": "^5.2.0"
44
44
  },
45
45
  "overrides": {
46
46
  "qs": "^6.15.2"
@@ -56,7 +56,7 @@
56
56
  "@vitest/browser-playwright": "5.0.0",
57
57
  "@vitest/coverage-v8": "5.0.0",
58
58
  "eslint": "10.10.0",
59
- "fast-check": "4.9.0",
59
+ "fast-check": "4.10.0",
60
60
  "html-validate": "11.15.0",
61
61
  "knip": "6.35.1",
62
62
  "playwright": "1.63.0",
@@ -64,7 +64,7 @@
64
64
  "stylelint": "17.15.0",
65
65
  "stylelint-config-standard": "40.0.0",
66
66
  "typescript": "npm:@typescript/typescript6@6.0.2",
67
- "typescript-eslint": "8.69.0",
67
+ "typescript-eslint": "8.70.0",
68
68
  "vitest": "5.0.0"
69
69
  },
70
70
  "publishConfig": {
@@ -1,41 +1,11 @@
1
- // Optical centring for the three chip labels (desktop strip, mobile switcher
2
- // chip, overview rows), measured in the engine instead of predicted from the
3
- // font's tables.
4
- //
5
- // Flex centring centres a label's LINE BOX. A font's metrics box reaches much
6
- // further above the baseline than below (the bundled Monaspace Neon NF: 0.995em
7
- // over, 0.250em under), so the visible text sits low inside the box it is
8
- // centred by, and the correction is the gap between the box's centre and the
9
- // text's own.
10
- //
11
- // WHICH BAND is the text's own is the load-bearing decision, and the first
12
- // version of this got it wrong. It centred cap-top-to-DESCENDER-bottom, which
13
- // reserves descender room below the letters and reads high: measured on the real
14
- // chip in Blink, the title's cap band sat 1.320px above the chip's centre while
15
- // the status dot and the close glyph beside it sat at exactly 0.000px, and a
16
- // title is judged against those two neighbours. So the band is cap-top to
17
- // BASELINE — the visible mass of a UI label, and the same pair of edges CSS
18
- // spells `text-box-edge: cap alphabetic`. Descenders overhang it deliberately;
19
- // the label's `padding-block` (30-tabs.css) is the allowance that keeps them
20
- // clear of `overflow: hidden`, so nothing is clipped by the choice.
21
- //
22
- // The correction is NOT a font-relative constant, which is what four earlier
23
- // fixes assumed. Engines round the font's ascent and descent to whole CSS pixels
24
- // before building the line box, so the ideal shift jumps whenever a size crosses
25
- // a rounding boundary: 0.25em x 13 = 3.25 rounds to 3 (a 16px box) while
26
- // 0.25em x 14 = 3.5 rounds to 4 (an 18px box), and the shift moves with it.
27
- // Engines disagree with each other too (Gecko makes that same 14px box 17px, not
28
- // 18px), and so do platforms within one engine: iOS resolves metrics through
29
- // CoreText, Linux WebKit through FreeType, which is why the strip read correct
30
- // in every local check and high on an iPad. Measured across 11-20px the cap-band
31
- // shift sawtooths between about -0.010em and +0.028em — small, but still wider
32
- // than the 0.33px error that was reported as a defect, so it stays measured.
33
- //
34
- // So nothing here predicts. Each measurement asks the engine for the line box
35
- // and baseline it actually produced, asks the font for its actual cap ink, and
36
- // writes the difference to --label-ink-shift as pixels. The CSS keeps an em
37
- // default for the pre-measurement paint (see 00-tokens.css); this only ever
38
- // narrows the error.
1
+ // Optical centring for the three chip labels, measured in the engine rather than
2
+ // predicted from the font's tables. Flex centring centres the LINE BOX, and a
3
+ // font's box reaches further above the baseline than below it, so the text sits
4
+ // low; the correction is the gap from the box's centre to the CAP band's (cap
5
+ // top to baseline, the `text-box-edge: cap alphabetic` edges; a band including
6
+ // descender ink reads high beside the dot and close glyph). Measured, not a
7
+ // constant, because engines round ascent and descent to whole CSS pixels before
8
+ // building the line box, and round differently per engine and platform.
39
9
  import { fromHTML } from "../dom.js";
40
10
 
41
11
  /** Ink extents are measured at this size and scaled back to em: WebKit and Blink
@@ -20,18 +20,9 @@ export type { SessionInfo };
20
20
  * (SessionStatus.progressValue). Both status sources flow through one code path
21
21
  * this way, and the optionality is meaningful: the polling fallback lists
22
22
  * SessionInfo with no percentage at all, which means "no information" and must
23
- * not be read as "the percentage was cleared".
24
- *
25
- * `activity`/`activityCount` are declared here as a FORWARD declaration: the
26
- * published engine's SessionInfo does not carry them yet. Drop both from this
27
- * intersection once it does, so the wire shape has one home again — if the
28
- * intersection then narrows anything, the engine's declaration is the wrong
29
- * one. Both are `string`/`number` rather than unions for the same reason
30
- * `status` is: the stream is parsed, not validated. */
23
+ * not be read as "the percentage was cleared". */
31
24
  export type StatusRecord = SessionInfo & {
32
25
  readonly progressValue?: number;
33
- readonly activity?: string;
34
- readonly activityCount?: number;
35
26
  };
36
27
 
37
28
  // The status vocabulary, module-private on purpose: every consumer asks one of