@vincemakes/kiso-tui-cells 0.22.0 → 0.23.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/dist/components.js +1 -1
- package/dist/ground.d.ts +16 -2
- package/dist/ground.js +18 -1
- package/dist/render.d.ts +13 -2
- package/dist/render.js +1 -1
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -1619,7 +1619,7 @@ const CUT_ROW = "└ ";
|
|
|
1619
1619
|
*
|
|
1620
1620
|
* THE DEGRADATION IS THE POINT OF THE PREDICATE. `wash` is a chosen
|
|
1621
1621
|
* background on the two KNOWN grounds and reverse video on the third
|
|
1622
|
-
* (§3 rung
|
|
1622
|
+
* (§3's last rung). A chip inverting for one row is the design working; eight
|
|
1623
1623
|
* output rows inverting is a blackboard in the middle of the transcript.
|
|
1624
1624
|
* So a slab paints only where the wash is a real background, and where
|
|
1625
1625
|
* it is not the block degrades to what it has always been — the R8a
|
package/dist/ground.d.ts
CHANGED
|
@@ -31,8 +31,12 @@ export declare function parseOscColor(body: string): Rgb | null;
|
|
|
31
31
|
export declare function relativeLuminance({ r, g, b }: Rgb): number;
|
|
32
32
|
export declare function groundFrom(rgb: Rgb): Exclude<Ground, "unknown">;
|
|
33
33
|
export interface GroundInputs {
|
|
34
|
-
/** KISO_THEME — an explicit answer from
|
|
34
|
+
/** KISO_THEME, or the user config's `theme` — an explicit answer from
|
|
35
|
+
* the human. The environment wins over the file; both are rung 1. */
|
|
35
36
|
readonly theme?: string | undefined;
|
|
37
|
+
/** The terminal's OWN account of its colour scheme, from its answer to
|
|
38
|
+
* `CSI ? 996 n` (`CSI ? 997 ; 1|2 n`). */
|
|
39
|
+
readonly colorScheme?: "dark" | "light" | undefined;
|
|
36
40
|
/** The body of the terminal's OSC 11 answer, if one arrived. */
|
|
37
41
|
readonly osc?: string | undefined;
|
|
38
42
|
/** The COLORFGBG environment variable, if it is set. */
|
|
@@ -42,5 +46,15 @@ export interface GroundInputs {
|
|
|
42
46
|
* The ladder, first hit wins. Every rung that cannot answer falls
|
|
43
47
|
* through rather than guessing, and the bottom of the ladder is
|
|
44
48
|
* `unknown` — see the module comment for why that is a result.
|
|
49
|
+
*
|
|
50
|
+
* 1 theme an explicit answer from the human (env, then config)
|
|
51
|
+
* 2 colorScheme the terminal's own report (CSI 997)
|
|
52
|
+
* 3 osc the background colour, and a luminance threshold
|
|
53
|
+
* 4 colorfgbg an environment variable some terminals set
|
|
54
|
+
* unknown reverse video, correct on any ground
|
|
55
|
+
*
|
|
56
|
+
* kiso never guesses. A terminal that answers nothing and a human who
|
|
57
|
+
* set nothing leave the ground `unknown`, and `unknown` degrades — it
|
|
58
|
+
* does not default to dark and hope.
|
|
45
59
|
*/
|
|
46
|
-
export declare function resolveGround({ theme, osc, colorfgbg }: GroundInputs): Ground;
|
|
60
|
+
export declare function resolveGround({ theme, colorScheme, osc, colorfgbg }: GroundInputs): Ground;
|
package/dist/ground.js
CHANGED
|
@@ -60,11 +60,28 @@ function fromColorFgBg(value) {
|
|
|
60
60
|
* The ladder, first hit wins. Every rung that cannot answer falls
|
|
61
61
|
* through rather than guessing, and the bottom of the ladder is
|
|
62
62
|
* `unknown` — see the module comment for why that is a result.
|
|
63
|
+
*
|
|
64
|
+
* 1 theme an explicit answer from the human (env, then config)
|
|
65
|
+
* 2 colorScheme the terminal's own report (CSI 997)
|
|
66
|
+
* 3 osc the background colour, and a luminance threshold
|
|
67
|
+
* 4 colorfgbg an environment variable some terminals set
|
|
68
|
+
* unknown reverse video, correct on any ground
|
|
69
|
+
*
|
|
70
|
+
* kiso never guesses. A terminal that answers nothing and a human who
|
|
71
|
+
* set nothing leave the ground `unknown`, and `unknown` degrades — it
|
|
72
|
+
* does not default to dark and hope.
|
|
63
73
|
*/
|
|
64
|
-
export function resolveGround({ theme, osc, colorfgbg }) {
|
|
74
|
+
export function resolveGround({ theme, colorScheme, osc, colorfgbg }) {
|
|
65
75
|
const explicit = theme?.trim().toLowerCase();
|
|
66
76
|
if (explicit === "light" || explicit === "dark")
|
|
67
77
|
return explicit;
|
|
78
|
+
// The terminal's own REPORT outranks the colour it hands over. OSC 11
|
|
79
|
+
// gives a background colour and kiso infers a ground from its
|
|
80
|
+
// luminance — a threshold applied to someone else's number. `CSI 997`
|
|
81
|
+
// is the terminal saying which it is. When both answer they normally
|
|
82
|
+
// agree; when they do not, the account beats the inference.
|
|
83
|
+
if (colorScheme === "dark" || colorScheme === "light")
|
|
84
|
+
return colorScheme;
|
|
68
85
|
if (osc !== undefined && osc !== "") {
|
|
69
86
|
const rgb = parseOscColor(osc);
|
|
70
87
|
if (rgb !== null)
|
package/dist/render.d.ts
CHANGED
|
@@ -29,6 +29,17 @@ import type { Ground } from "./ground.js";
|
|
|
29
29
|
* The functional colors are deliberately NOT moved and not
|
|
30
30
|
* approximated: red stays SGR 31, green stays SGR 32. A reader who has
|
|
31
31
|
* learned that colour means something must keep being right.
|
|
32
|
+
*
|
|
33
|
+
* R2's retired wordmark, re-measured 2026-09-02 and recorded so the
|
|
34
|
+
* question is not reopened from memory: braille (U+2800–U+28FF) IS
|
|
35
|
+
* available — Apple Terminal's default Menlo falls back to Apple
|
|
36
|
+
* Braille and draws solid dots, correcting what design.md §6 used to
|
|
37
|
+
* say. Rasterised through it, a four-leaf mark reads from 12×6 cells
|
|
38
|
+
* upward and turns to dominoes below 10×5 — the same threshold R2
|
|
39
|
+
* measured for block characters — and a dense tiling bands
|
|
40
|
+
* horizontally, because the font's dot pitch does not divide the cell
|
|
41
|
+
* height. The owner looked at it on the real terminal and declined it.
|
|
42
|
+
* §7.10 stands: no logo, the name is the mark.
|
|
32
43
|
*/
|
|
33
44
|
export interface Palette {
|
|
34
45
|
readonly bold: string;
|
|
@@ -71,7 +82,7 @@ export interface Palette {
|
|
|
71
82
|
readonly rvEnd: string;
|
|
72
83
|
/** DC-3 — the VERBATIM surface: the human's own words, and inline
|
|
73
84
|
* code. A background, so it needs the ground; with no ground it is
|
|
74
|
-
* reverse video, which is correct on any ground and is rung
|
|
85
|
+
* reverse video, which is correct on any ground and is the LAST rung of the
|
|
75
86
|
* ladder in `ground.ts`. Closed with 49 rather than SGR 0, for the
|
|
76
87
|
* reason `rv` is closed with 27: a washed span sits inside other
|
|
77
88
|
* spans and must end without stranding them. */
|
|
@@ -111,7 +122,7 @@ export interface Palette {
|
|
|
111
122
|
* ruling's own set gaining its missing member.
|
|
112
123
|
*
|
|
113
124
|
* With NO ground it is NOTHING: §3.1 forbids an absolute foreground
|
|
114
|
-
* in a palette that has not established a background, and rung
|
|
125
|
+
* in a palette that has not established a background, and the last rung's
|
|
115
126
|
* wash is reverse video, where any foreground grey inverts into a
|
|
116
127
|
* grey block. Body text on the surface is the correct degradation.
|
|
117
128
|
* It closes with 39 (the default foreground) rather than SGR 0, for
|
package/dist/render.js
CHANGED
|
@@ -24,7 +24,7 @@ const BASE = { bold: "\x1b[1m", dim: "\x1b[2m", red: "\x1b[31m", green: "\x1b[32
|
|
|
24
24
|
* dark 173 `#d7875f` 5.97:1
|
|
25
25
|
*
|
|
26
26
|
* With NO ground established the token stays ANSI 31 — the TERMINAL's
|
|
27
|
-
* own red, which its theme picked for its own background. That is rung
|
|
27
|
+
* own red, which its theme picked for its own background. That is the last rung
|
|
28
28
|
* 4's principle exactly: when the ground is unknown, use the thing that
|
|
29
29
|
* is correct on any ground rather than guessing one.
|
|
30
30
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-tui-cells",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "kiso tui-cells — the components cell renderer (components, diff, width, the render slice). Zero runtime dependencies: input is data, output is bytes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|