@promptctl/rich-js 0.7.0 → 0.8.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.
Files changed (137) hide show
  1. package/README.md +31 -30
  2. package/dist/core/box.d.ts +3 -3
  3. package/dist/core/box.d.ts.map +1 -1
  4. package/dist/core/box.js.map +1 -1
  5. package/dist/core/cells.d.ts +46 -1
  6. package/dist/core/cells.d.ts.map +1 -1
  7. package/dist/core/cells.js +55 -14
  8. package/dist/core/cells.js.map +1 -1
  9. package/dist/core/console.d.ts +28 -10
  10. package/dist/core/console.d.ts.map +1 -1
  11. package/dist/core/console.js +141 -80
  12. package/dist/core/console.js.map +1 -1
  13. package/dist/core/markup.d.ts +0 -2
  14. package/dist/core/markup.d.ts.map +1 -1
  15. package/dist/core/markup.js +31 -17
  16. package/dist/core/markup.js.map +1 -1
  17. package/dist/core/measure.d.ts +11 -0
  18. package/dist/core/measure.d.ts.map +1 -1
  19. package/dist/core/measure.js +15 -3
  20. package/dist/core/measure.js.map +1 -1
  21. package/dist/core/oklch.d.ts +22 -0
  22. package/dist/core/oklch.d.ts.map +1 -1
  23. package/dist/core/oklch.js +62 -18
  24. package/dist/core/oklch.js.map +1 -1
  25. package/dist/core/pretty.d.ts +87 -0
  26. package/dist/core/pretty.d.ts.map +1 -0
  27. package/dist/core/pretty.js +304 -0
  28. package/dist/core/pretty.js.map +1 -0
  29. package/dist/core/protocol.d.ts +64 -0
  30. package/dist/core/protocol.d.ts.map +1 -1
  31. package/dist/core/protocol.js +72 -0
  32. package/dist/core/protocol.js.map +1 -1
  33. package/dist/core/segment.d.ts +21 -0
  34. package/dist/core/segment.d.ts.map +1 -1
  35. package/dist/core/segment.js +40 -1
  36. package/dist/core/segment.js.map +1 -1
  37. package/dist/core/subscription.d.ts +13 -0
  38. package/dist/core/subscription.d.ts.map +1 -0
  39. package/dist/core/subscription.js +13 -0
  40. package/dist/core/subscription.js.map +1 -0
  41. package/dist/core/text.d.ts.map +1 -1
  42. package/dist/core/text.js +45 -13
  43. package/dist/core/text.js.map +1 -1
  44. package/dist/host/host-stream.d.ts +31 -0
  45. package/dist/host/host-stream.d.ts.map +1 -0
  46. package/dist/host/host-stream.js +36 -0
  47. package/dist/host/host-stream.js.map +1 -0
  48. package/dist/host/index.d.ts +4 -0
  49. package/dist/host/index.d.ts.map +1 -0
  50. package/dist/host/index.js +3 -0
  51. package/dist/host/index.js.map +1 -0
  52. package/dist/host/terminal-host.d.ts +144 -0
  53. package/dist/host/terminal-host.d.ts.map +1 -0
  54. package/dist/host/terminal-host.js +133 -0
  55. package/dist/host/terminal-host.js.map +1 -0
  56. package/dist/index.d.ts +10 -33
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +33 -21
  59. package/dist/index.js.map +1 -1
  60. package/dist/node/terminal-host.d.ts +85 -0
  61. package/dist/node/terminal-host.d.ts.map +1 -0
  62. package/dist/node/terminal-host.js +161 -0
  63. package/dist/node/terminal-host.js.map +1 -0
  64. package/dist/node/traceback.d.ts +28 -0
  65. package/dist/node/traceback.d.ts.map +1 -0
  66. package/dist/node/traceback.js +113 -0
  67. package/dist/node/traceback.js.map +1 -0
  68. package/dist/renderables/columns.d.ts +24 -2
  69. package/dist/renderables/columns.d.ts.map +1 -1
  70. package/dist/renderables/columns.js +91 -32
  71. package/dist/renderables/columns.js.map +1 -1
  72. package/dist/renderables/layout.d.ts +61 -5
  73. package/dist/renderables/layout.d.ts.map +1 -1
  74. package/dist/renderables/layout.js +191 -19
  75. package/dist/renderables/layout.js.map +1 -1
  76. package/dist/renderables/padding.d.ts +15 -2
  77. package/dist/renderables/padding.d.ts.map +1 -1
  78. package/dist/renderables/padding.js +92 -37
  79. package/dist/renderables/padding.js.map +1 -1
  80. package/dist/renderables/panel.d.ts +44 -3
  81. package/dist/renderables/panel.d.ts.map +1 -1
  82. package/dist/renderables/panel.js +149 -80
  83. package/dist/renderables/panel.js.map +1 -1
  84. package/dist/renderables/table.d.ts +40 -4
  85. package/dist/renderables/table.d.ts.map +1 -1
  86. package/dist/renderables/table.js +276 -158
  87. package/dist/renderables/table.js.map +1 -1
  88. package/dist/renderables/traceback.d.ts +6 -2
  89. package/dist/renderables/traceback.d.ts.map +1 -1
  90. package/dist/renderables/traceback.js +6 -10
  91. package/dist/renderables/traceback.js.map +1 -1
  92. package/dist/renderables/tree.d.ts +27 -2
  93. package/dist/renderables/tree.d.ts.map +1 -1
  94. package/dist/renderables/tree.js +82 -23
  95. package/dist/renderables/tree.js.map +1 -1
  96. package/dist/template-bindings/color-funcs.d.ts +3 -3
  97. package/dist/template-bindings/color-funcs.js +3 -3
  98. package/dist/template-bindings/index.d.ts +6 -7
  99. package/dist/template-bindings/index.d.ts.map +1 -1
  100. package/dist/template-bindings/index.js +6 -7
  101. package/dist/template-bindings/index.js.map +1 -1
  102. package/dist/template-bindings/palette-funcs.d.ts +17 -5
  103. package/dist/template-bindings/palette-funcs.d.ts.map +1 -1
  104. package/dist/template-bindings/palette-funcs.js +69 -6
  105. package/dist/template-bindings/palette-funcs.js.map +1 -1
  106. package/dist/template-bindings/style-funcs.d.ts +1 -1
  107. package/dist/template-bindings/style-funcs.js +1 -1
  108. package/dist/themes/ramp.d.ts +84 -0
  109. package/dist/themes/ramp.d.ts.map +1 -0
  110. package/dist/themes/ramp.js +123 -0
  111. package/dist/themes/ramp.js.map +1 -0
  112. package/dist/widgets/dropdown.d.ts +1 -1
  113. package/dist/widgets/dropdown.js +1 -1
  114. package/dist/widgets/event-router.d.ts +3 -2
  115. package/dist/widgets/event-router.d.ts.map +1 -1
  116. package/dist/widgets/focus-manager.d.ts +2 -1
  117. package/dist/widgets/focus-manager.d.ts.map +1 -1
  118. package/dist/widgets/index.d.ts +3 -6
  119. package/dist/widgets/index.d.ts.map +1 -1
  120. package/dist/widgets/index.js +4 -3
  121. package/dist/widgets/index.js.map +1 -1
  122. package/dist/widgets/screen.d.ts +1 -1
  123. package/dist/widgets/screen.d.ts.map +1 -1
  124. package/dist/widgets/terminal-host.d.ts +13 -63
  125. package/dist/widgets/terminal-host.d.ts.map +1 -1
  126. package/dist/widgets/terminal-host.js +11 -142
  127. package/dist/widgets/terminal-host.js.map +1 -1
  128. package/dist/widgets/text-input.d.ts +2 -3
  129. package/dist/widgets/text-input.d.ts.map +1 -1
  130. package/dist/widgets/text-input.js +4 -12
  131. package/dist/widgets/text-input.js.map +1 -1
  132. package/dist/widgets/types.d.ts +1 -1
  133. package/dist/widgets/types.d.ts.map +1 -1
  134. package/dist/widgets/types.js.map +1 -1
  135. package/dist/widgets/widget-base.d.ts +2 -1
  136. package/dist/widgets/widget-base.d.ts.map +1 -1
  137. package/package.json +20 -4
@@ -1,7 +1,8 @@
1
1
  /**
2
- * The one palette-dependent template function: `color`.
2
+ * The palette-dependent template functions: `color`, and `ramp` whose stops
3
+ * are color references.
3
4
  *
4
- * ### Why exactly one
5
+ * ### Why `color` is the one name resolver
5
6
  *
6
7
  * This module used to register four kinds of thing: one function per
7
8
  * identifier-safe palette variable (`{{ primary child }}`, `{{ accent child }}`,
@@ -31,6 +32,17 @@
31
32
  * `style-funcs.ts` paint them. One shape, total over the palette, open to
32
33
  * arbitrary composition. [LAW:one-type-per-behavior]
33
34
  *
35
+ * ### Why `ramp` lives here and not with the color math
36
+ *
37
+ * `ramp` is the one function whose input is a *number*, and its stops are
38
+ * spelled as color references — `ramp .pct "step" 0 "panel" 50 "warning" 80
39
+ * "error"` — resolved through the same `resolveColorRef` that `color` crosses.
40
+ * Requiring `(color "panel")` around every stop would put the boilerplate
41
+ * back that this binding exists to remove, and an author who writes a hex
42
+ * literal loses nothing: the resolver is idempotent on hex. The arithmetic
43
+ * itself is `ColorRamp` in `themes/ramp.ts`, palette-free; only the
44
+ * reference resolution is here. [LAW:one-way-deps]
45
+ *
34
46
  * ### Why a getter, not a palette
35
47
  *
36
48
  * `paletteFuncs` takes `() => Palette` rather than a `Palette`. A consumer
@@ -46,11 +58,41 @@
46
58
  * engine and their bodies run at *evaluate* time, so reading the palette
47
59
  * through a getter leaves parse-once/evaluate-many completely intact. What the
48
60
  * getter must not change is *which functions exist* — and it cannot, because
49
- * there is now exactly one, whose name does not depend on the palette's
50
- * contents. That was not true of the generated per-variable functions, which
51
- * is the second reason they are gone.
61
+ * the two names here do not depend on the palette's contents. That was not
62
+ * true of the generated per-variable functions, which is the second reason
63
+ * they are gone.
52
64
  */
53
65
  import { resolveColorRef } from "../themes/colorRef.js";
66
+ import { ColorRamp, parseRampEasing } from "../themes/ramp.js";
67
+ /**
68
+ * The `(position, color-ref)` pairs a `ramp` call's tail spells, as stops.
69
+ *
70
+ * The engine's `alternating` gate has already typed every even slot as a
71
+ * float and every odd slot as a string; what it cannot see is the *pairing*
72
+ * — a trailing position with no color — nor that the string is a color
73
+ * reference. Both are settled here, once, and `ColorRamp` receives resolved
74
+ * stops it never re-checks. [LAW:parse-dont-validate]
75
+ *
76
+ * Each reference resolves against the palette of *this* evaluation, so a
77
+ * ramp over palette names follows the theme exactly as `color` does.
78
+ */
79
+ function colorStops(tail, palette) {
80
+ if (tail.length === 0) {
81
+ throw new RangeError(`ramp needs at least one stop after the easing: ramp <value> <easing> <position> <color> …`);
82
+ }
83
+ if (tail.length % 2 !== 0) {
84
+ throw new RangeError(`ramp's last stop (position ${String(tail[tail.length - 1])}) has no color — ` +
85
+ `stops are <position> <color> pairs`);
86
+ }
87
+ const stops = [];
88
+ for (let i = 0; i < tail.length; i += 2) {
89
+ stops.push({
90
+ at: tail[i],
91
+ color: resolveColorRef(palette, tail[i + 1]),
92
+ });
93
+ }
94
+ return stops;
95
+ }
54
96
  /**
55
97
  * Register `color "name-or-hex"` against a live palette.
56
98
  *
@@ -84,6 +126,27 @@ export function paletteFuncs(getPalette) {
84
126
  argTypes: ["string"],
85
127
  returnType: "string",
86
128
  };
87
- return { color: colorFunc };
129
+ // `ramp <value> <easing> <position> <color> …` — the argument list is one
130
+ // float/string cycle end to end (value, easing, then each stop's position
131
+ // and color), so the engine's `alternating` gate types every slot; the
132
+ // pairing and the references are parsed in `colorStops`.
133
+ // [LAW:types-are-the-program]
134
+ const rampFunc = {
135
+ fn: ((...args) => {
136
+ // The engine's `alternating` gate types each slot but sets no minimum
137
+ // count, so `{{ ramp }}` and `{{ ramp 65 }}` both reach here: one
138
+ // check over the whole list, naming what is missing. [LAW:no-silent-failure]
139
+ if (args.length < 2) {
140
+ throw new RangeError(`ramp needs a value and an easing before its stops (got ${args.length}): ` +
141
+ `ramp <value> "linear"|"step" <position> <color> …`);
142
+ }
143
+ const [value, easing, ...tail] = args;
144
+ return new ColorRamp(parseRampEasing(easing), colorStops(tail, getPalette())).at(value).hex;
145
+ }),
146
+ argTypes: ["float", "string"],
147
+ argTypePattern: "alternating",
148
+ returnType: "string",
149
+ };
150
+ return { color: colorFunc, ramp: rampFunc };
88
151
  }
89
152
  //# sourceMappingURL=palette-funcs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"palette-funcs.js","sourceRoot":"","sources":["../../src/template-bindings/palette-funcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAAC,UAAyB;IACpD,MAAM,SAAS,GAAiB;QAC9B,EAAE,EAAE,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAuB;QACnF,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,UAAU,EAAE,QAAQ;KACrB,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"palette-funcs.js","sourceRoot":"","sources":["../../src/template-bindings/palette-funcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;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IACF,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,yDAAyD;IACzD,8BAA8B;IAC9B,MAAM,QAAQ,GAAiB;QAC7B,EAAE,EAAE,CAAC,CAAC,GAAG,IAAe,EAAE,EAAE;YAC1B,sEAAsE;YACtE,kEAAkE;YAClE,6EAA6E;YAC7E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,UAAU,CAClB,0DAA0D,IAAI,CAAC,MAAM,KAAK;oBACxE,mDAAmD,CACtD,CAAC;YACJ,CAAC;YACD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,IAAsC,CAAC;YACxE,OAAO,IAAI,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QAC9F,CAAC,CAAuB;QACxB,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC7B,cAAc,EAAE,aAAa;QAC7B,UAAU,EAAE,QAAQ;KACrB,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC9C,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Style-function registrations for the rich-js template binding.
3
3
  *
4
4
  * [LAW:one-source-of-truth] The function inventory below mirrors the
5
- * string-syntax style vocabulary documented in `spec/style.md` — the two
5
+ * string-syntax style vocabulary documented in `docs/style.md` — the two
6
6
  * colour slots (`fg`/`bg`), text attributes (positive + negated), short
7
7
  * aliases, and the hyperlink. Each registration is a templating-time analogue
8
8
  * of a piece of `Style.parse`, so a template fragment composed by these
@@ -2,7 +2,7 @@
2
2
  * Style-function registrations for the rich-js template binding.
3
3
  *
4
4
  * [LAW:one-source-of-truth] The function inventory below mirrors the
5
- * string-syntax style vocabulary documented in `spec/style.md` — the two
5
+ * string-syntax style vocabulary documented in `docs/style.md` — the two
6
6
  * colour slots (`fg`/`bg`), text attributes (positive + negated), short
7
7
  * aliases, and the hyperlink. Each registration is a templating-time analogue
8
8
  * of a piece of `Style.parse`, so a template fragment composed by these
@@ -0,0 +1,84 @@
1
+ /**
2
+ * A color ramp: a number mapped onto a color through ordered stops.
3
+ *
4
+ * "What does 73 % spent look like" has no answer in a vocabulary of discrete
5
+ * adjustments (`darken`, `mix`, `contrastOn`): each takes colors and returns a
6
+ * color, and none takes a *measurement*. Without a ramp the answer gets
7
+ * computed outside the theme system — a script emits a hex, a template
8
+ * branches `if ge .pct 80 … else if ge .pct 50 …` — and that color decision
9
+ * can no longer transpose with the palette it was meant to belong to. A ramp
10
+ * is the one function whose input is a number, so the decision stays inside.
11
+ *
12
+ * A threshold cascade is a ramp too: the same stops with a `step` easing hold
13
+ * each color until the next position, which is exactly `≥ threshold → hotter`
14
+ * written as data. [LAW:one-type-per-behavior] One primitive; the easing is a
15
+ * value, so a gradient and a cascade differ by one word, not by which function
16
+ * was called.
17
+ *
18
+ * Interpolation is in OKLCH (`Oklch.mix`), so a `linear` ramp between two
19
+ * theme colors passes through perceptually even steps rather than the muddy
20
+ * midpoints of an sRGB blend.
21
+ *
22
+ * [LAW:one-way-deps] Imports `core/color` and `core/oklch` only; nothing here
23
+ * knows what a palette is. Resolving stop *names* is the template binding's
24
+ * job (`paletteFuncs`), which hands this module resolved colors.
25
+ */
26
+ import type { ColorRgba } from "../core/color.js";
27
+ /** One stop: the color the ramp is exactly `color` at position `at`. */
28
+ export interface ColorStop {
29
+ readonly at: number;
30
+ readonly color: ColorRgba;
31
+ }
32
+ /**
33
+ * How a value between two stops maps to progress along them. Each easing is
34
+ * a function on segment progress `t ∈ [0, 1)` — `linear` keeps it, `step`
35
+ * holds the left stop for the whole segment.
36
+ *
37
+ * [LAW:dataflow-not-control-flow] The easing is looked up by name and applied
38
+ * unconditionally; `at` runs the same code for a gradient and a cascade.
39
+ */
40
+ export declare const RAMP_EASINGS: {
41
+ readonly linear: (t: number) => number;
42
+ readonly step: () => number;
43
+ };
44
+ export type RampEasing = keyof typeof RAMP_EASINGS;
45
+ export declare const RAMP_EASING_NAMES: readonly RampEasing[];
46
+ /**
47
+ * The gate a spelled easing crosses. [LAW:parse-dont-validate] — returns the
48
+ * narrowed name, so `ColorRamp` never re-checks. Unknown names throw naming
49
+ * every legal one. [LAW:no-silent-failure]
50
+ */
51
+ export declare function parseRampEasing(name: string): RampEasing;
52
+ /**
53
+ * An immutable ramp over stops sorted by position.
54
+ *
55
+ * [LAW:single-enforcer] The constructor is the one place a ramp's shape is
56
+ * checked — at least one stop, every position finite, positions
57
+ * non-decreasing — matching the `ColorRgba`/`Oklch` pattern. Positions are
58
+ * required to arrive in order rather than being sorted here: a ramp whose
59
+ * stops are read from configuration (`warning at 80, error at 50`) is an
60
+ * authoring mistake, and sorting would quietly render a different ramp than
61
+ * the one written. [LAW:no-silent-failure]
62
+ *
63
+ * Two stops may share a position: that is a hard edge, the later color
64
+ * taking over at exactly that value (CSS gradients spell a hard stop the
65
+ * same way).
66
+ */
67
+ export declare class ColorRamp {
68
+ readonly easing: RampEasing;
69
+ readonly stops: readonly ColorStop[];
70
+ constructor(easing: RampEasing, stops: readonly ColorStop[]);
71
+ /**
72
+ * The color at `value`. Below the first stop it is the first color; at or
73
+ * above the last stop it is the last; between two stops it is `easing`
74
+ * of the way from the lower to the upper, so a value exactly on a stop is
75
+ * that stop's color, byte for byte.
76
+ *
77
+ * The two endpoint returns are the exactness contract, not a shortcut:
78
+ * the sRGB → OKLCH → sRGB round-trip can land a channel one unit off, and a
79
+ * ramp that does not hit its own stops exactly would make a `step` ramp
80
+ * paint a color the author never wrote.
81
+ */
82
+ at(value: number): ColorRgba;
83
+ }
84
+ //# sourceMappingURL=ramp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ramp.d.ts","sourceRoot":"","sources":["../../src/themes/ramp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,wEAAwE;AACxE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;yBACX,MAAM,KAAG,MAAM;yBACjB,MAAM;CACR,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,YAAY,CAAC;AAEnD,eAAO,MAAM,iBAAiB,EAAgC,SAAS,UAAU,EAAE,CAAC;AAEpF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAQxD;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAS;IAElB,QAAQ,CAAC,MAAM,EAAE,UAAU;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE;gBAD3B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,SAAS,EAAE;IAmBtC;;;;;;;;;;OAUG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;CAmB7B"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * A color ramp: a number mapped onto a color through ordered stops.
3
+ *
4
+ * "What does 73 % spent look like" has no answer in a vocabulary of discrete
5
+ * adjustments (`darken`, `mix`, `contrastOn`): each takes colors and returns a
6
+ * color, and none takes a *measurement*. Without a ramp the answer gets
7
+ * computed outside the theme system — a script emits a hex, a template
8
+ * branches `if ge .pct 80 … else if ge .pct 50 …` — and that color decision
9
+ * can no longer transpose with the palette it was meant to belong to. A ramp
10
+ * is the one function whose input is a number, so the decision stays inside.
11
+ *
12
+ * A threshold cascade is a ramp too: the same stops with a `step` easing hold
13
+ * each color until the next position, which is exactly `≥ threshold → hotter`
14
+ * written as data. [LAW:one-type-per-behavior] One primitive; the easing is a
15
+ * value, so a gradient and a cascade differ by one word, not by which function
16
+ * was called.
17
+ *
18
+ * Interpolation is in OKLCH (`Oklch.mix`), so a `linear` ramp between two
19
+ * theme colors passes through perceptually even steps rather than the muddy
20
+ * midpoints of an sRGB blend.
21
+ *
22
+ * [LAW:one-way-deps] Imports `core/color` and `core/oklch` only; nothing here
23
+ * knows what a palette is. Resolving stop *names* is the template binding's
24
+ * job (`paletteFuncs`), which hands this module resolved colors.
25
+ */
26
+ import { Oklch } from "../core/oklch.js";
27
+ /**
28
+ * How a value between two stops maps to progress along them. Each easing is
29
+ * a function on segment progress `t ∈ [0, 1)` — `linear` keeps it, `step`
30
+ * holds the left stop for the whole segment.
31
+ *
32
+ * [LAW:dataflow-not-control-flow] The easing is looked up by name and applied
33
+ * unconditionally; `at` runs the same code for a gradient and a cascade.
34
+ */
35
+ export const RAMP_EASINGS = {
36
+ linear: (t) => t,
37
+ step: () => 0,
38
+ };
39
+ export const RAMP_EASING_NAMES = Object.keys(RAMP_EASINGS);
40
+ /**
41
+ * The gate a spelled easing crosses. [LAW:parse-dont-validate] — returns the
42
+ * narrowed name, so `ColorRamp` never re-checks. Unknown names throw naming
43
+ * every legal one. [LAW:no-silent-failure]
44
+ */
45
+ export function parseRampEasing(name) {
46
+ if (!Object.hasOwn(RAMP_EASINGS, name)) {
47
+ throw new RangeError(`unknown ramp easing ${JSON.stringify(name)}; expected one of ` +
48
+ RAMP_EASING_NAMES.map((n) => JSON.stringify(n)).join(", "));
49
+ }
50
+ return name;
51
+ }
52
+ /**
53
+ * An immutable ramp over stops sorted by position.
54
+ *
55
+ * [LAW:single-enforcer] The constructor is the one place a ramp's shape is
56
+ * checked — at least one stop, every position finite, positions
57
+ * non-decreasing — matching the `ColorRgba`/`Oklch` pattern. Positions are
58
+ * required to arrive in order rather than being sorted here: a ramp whose
59
+ * stops are read from configuration (`warning at 80, error at 50`) is an
60
+ * authoring mistake, and sorting would quietly render a different ramp than
61
+ * the one written. [LAW:no-silent-failure]
62
+ *
63
+ * Two stops may share a position: that is a hard edge, the later color
64
+ * taking over at exactly that value (CSS gradients spell a hard stop the
65
+ * same way).
66
+ */
67
+ export class ColorRamp {
68
+ easing;
69
+ stops;
70
+ constructor(easing, stops) {
71
+ this.easing = easing;
72
+ this.stops = stops;
73
+ if (stops.length === 0) {
74
+ throw new RangeError("a ColorRamp needs at least one stop");
75
+ }
76
+ for (const [i, stop] of stops.entries()) {
77
+ if (!Number.isFinite(stop.at)) {
78
+ throw new RangeError(`ColorRamp stop ${i} has a non-finite position ${stop.at}`);
79
+ }
80
+ const prev = stops[i - 1];
81
+ if (prev !== undefined && stop.at < prev.at) {
82
+ throw new RangeError(`ColorRamp stops must be in ascending position order; ` +
83
+ `stop ${i} at ${stop.at} follows stop ${i - 1} at ${prev.at}`);
84
+ }
85
+ }
86
+ }
87
+ /**
88
+ * The color at `value`. Below the first stop it is the first color; at or
89
+ * above the last stop it is the last; between two stops it is `easing`
90
+ * of the way from the lower to the upper, so a value exactly on a stop is
91
+ * that stop's color, byte for byte.
92
+ *
93
+ * The two endpoint returns are the exactness contract, not a shortcut:
94
+ * the sRGB → OKLCH → sRGB round-trip can land a channel one unit off, and a
95
+ * ramp that does not hit its own stops exactly would make a `step` ramp
96
+ * paint a color the author never wrote.
97
+ */
98
+ at(value) {
99
+ if (!Number.isFinite(value)) {
100
+ throw new RangeError(`ColorRamp.at needs a finite value, got ${value}`);
101
+ }
102
+ const stops = this.stops;
103
+ // The last stop at or below `value`; -1 when `value` is below them all.
104
+ let lower = -1;
105
+ while (lower + 1 < stops.length && stops[lower + 1].at <= value)
106
+ lower++;
107
+ if (lower < 0)
108
+ return stops[0].color;
109
+ const from = stops[lower];
110
+ if (lower === stops.length - 1)
111
+ return from.color;
112
+ // `to.at > value >= from.at` by construction of `lower`, so the segment
113
+ // has positive width and `t ∈ [0, 1)`.
114
+ const to = stops[lower + 1];
115
+ const t = RAMP_EASINGS[this.easing]((value - from.at) / (to.at - from.at));
116
+ if (t <= 0)
117
+ return from.color;
118
+ if (t >= 1)
119
+ return to.color;
120
+ return Oklch.fromRgba(from.color).mix(Oklch.fromRgba(to.color), t).toRgba();
121
+ }
122
+ }
123
+ //# sourceMappingURL=ramp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ramp.js","sourceRoot":"","sources":["../../src/themes/ramp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC;IAChC,IAAI,EAAE,GAAW,EAAE,CAAC,CAAC;CACb,CAAC;AAIX,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAA0B,CAAC;AAEpF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,UAAU,CAClB,uBAAuB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB;YAC7D,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,IAAkB,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,SAAS;IAET;IACA;IAFX,YACW,MAAkB,EAClB,KAA2B;QAD3B,WAAM,GAAN,MAAM,CAAY;QAClB,UAAK,GAAL,KAAK,CAAsB;QAEpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,UAAU,CAAC,qCAAqC,CAAC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K,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAClD,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAc,CAAC;QACzC,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC,KAAK,CAAC;QAC5B,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9E,CAAC;CACF"}
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Width invariant: measure() always returns maxLabelLen(options) + 4
22
22
  * regardless of filter state — the query is right-clipped, never wider
23
- * than the header. See spec/widgets.md → Dropdown → Filtering.
23
+ * than the header. See docs/widgets.md → Dropdown.
24
24
  */
25
25
  import { Segment } from "../core/segment.js";
26
26
  import type { RenderOptions } from "../core/protocol.js";
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Width invariant: measure() always returns maxLabelLen(options) + 4
22
22
  * regardless of filter state — the query is right-clipped, never wider
23
- * than the header. See spec/widgets.md → Dropdown → Filtering.
23
+ * than the header. See docs/widgets.md → Dropdown.
24
24
  */
25
25
  var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
26
26
  var useValue = arguments.length > 2;
@@ -17,8 +17,9 @@
17
17
  * if it extends the sequence. Tests can call `flush()` to drain synchronously.
18
18
  */
19
19
  import { KeyEvent } from "./types.js";
20
- import type { Screen, FocusManager, InteractiveWidget, WidgetMouseEvent, KeyHandlerOptions, Unsubscribe } from "./types.js";
21
- import type { TerminalHost } from "./terminal-host.js";
20
+ import type { Screen, FocusManager, InteractiveWidget, WidgetMouseEvent, KeyHandlerOptions } from "./types.js";
21
+ import type { Unsubscribe } from "../core/subscription.js";
22
+ import type { TerminalHost } from "../host/terminal-host.js";
22
23
  type KeyHandler = (event: KeyEvent) => void;
23
24
  type WidgetSource = {
24
25
  focusManager: FocusManager;
@@ -1 +1 @@
1
- {"version":3,"file":"event-router.d.ts","sourceRoot":"","sources":["../../src/widgets/event-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAEjB,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAM5C,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,MAAM,SAAS,iBAAiB,EAAE,CAAC;CAChD,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B;;;;OAIG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAuGD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;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IAab,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,UAAU;IA6ClB,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,aAAa;IA2ErB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,UAAU;IA2DlB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,aAAa;CA+BtB"}
@@ -4,7 +4,8 @@
4
4
  * [LAW:dataflow-not-control-flow] focus transitions are observable state;
5
5
  * widgets react to focus/blur events, the manager never skips dispatch.
6
6
  */
7
- import type { InteractiveWidget, FocusManager, KeyEvent, Unsubscribe } from "./types.js";
7
+ import type { InteractiveWidget, FocusManager, KeyEvent } from "./types.js";
8
+ import type { Unsubscribe } from "../core/subscription.js";
8
9
  export declare class DefaultFocusManager implements FocusManager {
9
10
  accessor widgetList: InteractiveWidget[];
10
11
  accessor currentWidget: InteractiveWidget | null;
@@ -1 +1 @@
1
- {"version":3,"file":"focus-manager.d.ts","sourceRoot":"","sources":["../../src/widgets/focus-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,qBAAa,mBAAoB,YAAW,YAAY;IAEtD,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAM;IAG9C,QAAQ,CAAC,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAExD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA0D;;IAMzF,IAAI,OAAO,IAAI,iBAAiB,GAAG,IAAI,CAEtC;IAED,IAAI,OAAO,IAAI,SAAS,iBAAiB,EAAE,CAE1C;IAGD,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAazC,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAkB3C,IAAI,IAAI,IAAI;IAUZ,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,MAAM,EAAE,iB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;IAUhB,OAAO,CAAC,UAAU;CAKnB"}
@@ -1,4 +1,4 @@
1
- export type { KeyEventInit, KeyHandlerPriority, KeyHandlerOptions, WidgetMouseEvent, WidgetFocusEvent, WidgetBounds, InteractiveWidget, OverlayRenderable, FocusManager, Screen, MountEntry, Placement, Unsubscribe, } from "./types.js";
1
+ export type { KeyEventInit, KeyHandlerPriority, KeyHandlerOptions, WidgetMouseEvent, WidgetFocusEvent, WidgetBounds, InteractiveWidget, OverlayRenderable, FocusManager, Screen, MountEntry, Placement, } from "./types.js";
2
2
  export { FLOW, hasOverlay, KeyEvent } from "./types.js";
3
3
  export { StaticItem } from "./static-item.js";
4
4
  export type { StaticItemOptions } from "./static-item.js";
@@ -12,15 +12,12 @@ export { Checkbox } from "./checkbox.js";
12
12
  export type { CheckboxOptions } from "./checkbox.js";
13
13
  export { Toggle } from "./toggle.js";
14
14
  export type { ToggleVariant, ToggleOptions } from "./toggle.js";
15
- export { TextInput } from "./text-input.js";
16
- export type { TextInputOptions } from "./text-input.js";
15
+ export { TextInput, charGreedyWrap } from "./text-input.js";
16
+ export type { TextInputOptions, WrapStrategy, WrapRow } from "./text-input.js";
17
17
  export { Dropdown } from "./dropdown.js";
18
18
  export type { DropdownOptions } from "./dropdown.js";
19
19
  export { Slider } from "./slider.js";
20
20
  export type { SliderOptions } from "./slider.js";
21
21
  export { EventRouter } from "./event-router.js";
22
22
  export type { EventRouterOptions } from "./event-router.js";
23
- export { NodeTerminalHost, BrowserTerminalHost } from "./terminal-host.js";
24
- export type { TerminalHost, TerminalSize, DataHandler, ResizeHandler, NodeTerminalHostOptions, BrowserTerminalHostOptions, XtermTerminal, XtermDisposable, XtermResizeEvent, } from "./terminal-host.js";
25
- export { hostStream } from "./host-stream.js";
26
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,kBA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C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -6,10 +6,11 @@ export { DefaultScreen } from "./screen.js";
6
6
  export { Button } from "./button.js";
7
7
  export { Checkbox } from "./checkbox.js";
8
8
  export { Toggle } from "./toggle.js";
9
- export { TextInput } from "./text-input.js";
9
+ export { TextInput, charGreedyWrap } from "./text-input.js";
10
10
  export { Dropdown } from "./dropdown.js";
11
11
  export { Slider } from "./slider.js";
12
12
  export { EventRouter } from "./event-router.js";
13
- export { NodeTerminalHost, BrowserTerminalHost } from "./terminal-host.js";
14
- export { hostStream } from "./host-stream.js";
13
+ // The terminal seam is not re-exported here. It lives on the `host` subpath,
14
+ // and a second path to `TerminalHost` would be the two-clocks problem the
15
+ // subpath split exists to remove.
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,mBAAmB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,MAAM,mBAAmB,CAAC;AAGhD,6EAA6E;AAC7E,0EAA0E;AAC1E,kCAAkC"}
@@ -51,7 +51,7 @@
51
51
  */
52
52
  import { ColorDepth } from "../core/color.js";
53
53
  import type { Screen, InteractiveWidget, FocusManager, MountEntry } from "./types.js";
54
- import type { TerminalHost } from "./terminal-host.js";
54
+ import type { TerminalHost } from "../host/terminal-host.js";
55
55
  export type ColorSystemSpec = ColorDepth | "auto" | "truecolor" | "256" | "ansi" | "none" | null;
56
56
  export interface ScreenOptions {
57
57
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/widgets/screen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAMH,OAAO,EAAE,UAAU,EAAsB,MAAM,kBAAkB,CAAC;AAIlE,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,UAAU,EAGX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,MAAM,GACN,WAAW,GACX,KAAK,GACL,MAAM,GACN,MAAM,GACN,IAAI,CAAC;AAET,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAmBD,qBAAa,aAAc,YAAW,MAAM;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAKpC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAM;IAM9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2C;IAOtE,OAAO,CAAC,e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;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAmBD,qBAAa,aAAc,YAAW,MAAM;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAKpC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAM;IAM9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2C;IAOtE,OAAO,CAAC,eAAe,CAAqC;IAE5D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,cAAc,CAAgC;IACtD,OAAO,CAAC,eAAe,CAAS;IAKhC,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;gBAE3B,OAAO,EAAE,aAAa;IAYlC,IAAI,OAAO,IAAI,OAAO,CAErB;IASD,IAAI,OAAO,IAAI,SAAS,iBAAiB,EAAE,CAQ1C;IAID,KAAK,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI;IAcrC,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAcxC,KAAK,IAAI,IAAI;IAoBb,IAAI,IAAI,IAAI;IAwBZ,OAAO,KAAK,KAAK,GAGhB;IAED,OAAO,CAAC,YAAY;IA8IpB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,IAAI;CAyDb"}
@@ -6,20 +6,23 @@
6
6
  * type existed, Screen and EventRouter reached for ambient `process.stdin`/
7
7
  * `process.stdout`, which crystallised them to node. With a `TerminalHost`
8
8
  * value flowing across one boundary, the same runtime code runs against any
9
- * implementation — node's TTY (`NodeTerminalHost`, this file) or a browser
10
- * xterm.js terminal (a downstream ticket's adapter).
9
+ * implementation — node's TTY (`NodeTerminalHost`, on the `node/terminal-host`
10
+ * subpath) or a browser xterm.js terminal (`BrowserTerminalHost`, below).
11
11
  *
12
12
  * [LAW:dataflow-not-control-flow] The runtime never branches on "am I in
13
13
  * node or browser." The host is the value that differs; the code path is
14
14
  * the same. Variability lives in which host is constructed at the program
15
15
  * entry, not in any `if` inside the runtime.
16
16
  *
17
- * [LAW:no-shared-mutable-globals] This file is the *single owner* of node
18
- * TTY access in the codebase. Every other module receives a `TerminalHost`
19
- * from outside. If you find yourself reaching for `process.stdin`,
20
- * `process.stdout`, or `setRawMode` anywhere else in the runtime or in a
21
- * demo, fix the call site to take a `TerminalHost` parameter instead —
22
- * the seam is already here; use it.
17
+ * [LAW:one-way-deps] The interface and the browser host live here, in the
18
+ * barrel; the node host lives in `src/node/terminal-host.ts`, behind an
19
+ * explicit subpath, because it reads `process.stdin` / `process.stdout`. The
20
+ * dependency runs one way — the node adapter imports this seam; nothing here
21
+ * imports the adapter — so importing the main barrel in a browser cannot
22
+ * reach the ambient `process` global by any path, rather than merely not
23
+ * reaching it in practice. `test/seam/browser-safe.test.ts` is what holds
24
+ * that direction; who reads the host at all is `HOST_ACCESS` in
25
+ * `test/seam/ambient-process.ts`, and neither list is repeated here.
23
26
  *
24
27
  * [boundaries: capabilities over context] A `TerminalHost` grants exactly
25
28
  * the I/O capabilities the runtime needs: write bytes, read input, query
@@ -83,58 +86,6 @@ export interface TerminalHost {
83
86
  */
84
87
  stop(): void;
85
88
  }
86
- /**
87
- * Subset of NodeJS stream API the node host actually depends on. Tests
88
- * construct a host over PassThrough / Writable mocks; production wires it
89
- * to `process.stdin` / `process.stdout`.
90
- */
91
- interface NodeReadable {
92
- on(event: "data", listener: (chunk: Buffer | string) => void): unknown;
93
- off(event: "data", listener: (chunk: Buffer | string) => void): unknown;
94
- setRawMode?(raw: boolean): unknown;
95
- resume?(): unknown;
96
- pause?(): unknown;
97
- readonly isTTY?: boolean;
98
- }
99
- interface NodeWritable {
100
- write(chunk: string | Uint8Array): unknown;
101
- on(event: "resize", listener: () => void): unknown;
102
- off(event: "resize", listener: () => void): unknown;
103
- readonly columns?: number;
104
- readonly rows?: number;
105
- readonly isTTY?: boolean;
106
- }
107
- export interface NodeTerminalHostOptions {
108
- /**
109
- * Input stream. Defaults to `process.stdin` so production code does not
110
- * have to construct one explicitly. Tests pass a `PassThrough`.
111
- */
112
- stdin?: NodeReadable;
113
- /**
114
- * Output stream. Defaults to `process.stdout` for the same reason.
115
- * Tests pass a `Writable` mock.
116
- */
117
- stdout?: NodeWritable;
118
- }
119
- export declare class NodeTerminalHost implements TerminalHost {
120
- private readonly stdin;
121
- private readonly stdout;
122
- private readonly dataHandlers;
123
- private readonly resizeHandlers;
124
- private dataListener;
125
- private resizeListener;
126
- private rawModeRequested;
127
- constructor(options?: NodeTerminalHostOptions);
128
- get isTTY(): boolean;
129
- write(data: Uint8Array | string): void;
130
- size(): TerminalSize;
131
- setRawMode(raw: boolean): void;
132
- private applyRawMode;
133
- onData(handler: DataHandler): Unsubscribe;
134
- onResize(handler: ResizeHandler): Unsubscribe;
135
- start(): void;
136
- stop(): void;
137
- }
138
89
  /**
139
90
  * Subset of xterm.js's `Terminal` surface the browser host depends on.
140
91
  *
@@ -142,8 +93,8 @@ export declare class NodeTerminalHost implements TerminalHost {
142
93
  * importing xterm.js's types — keeps this package free of an xterm.js
143
94
  * dev-dep at the type level, lets the browser-bundle pipeline (downstream
144
95
  * ticket) pin whichever xterm.js version it wants, and lets unit tests
145
- * pass a hand-built fake. Same idea as `NodeReadable`/`NodeWritable`
146
- * above: ask for exactly the capabilities the host uses, no more.
96
+ * pass a hand-built fake: ask for exactly the capabilities the host uses,
97
+ * no more.
147
98
  */
148
99
  export interface XtermDisposable {
149
100
  dispose(): void;
@@ -184,5 +135,4 @@ export declare class BrowserTerminalHost implements TerminalHost {
184
135
  start(): void;
185
136
  stop(): void;
186
137
  }
187
- export {};
188
138
  //# sourceMappingURL=terminal-host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-host.d.ts","sourceRoot":"","sources":["../../src/widgets/terminal-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAEvC;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IAE1C;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,CAAC;IAE9C,mEAAmE;IACnE,IAAI,IAAI,YAAY,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAExB;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;;;;OAOG;IACH,IAAI,IAAI,IAAI,CAAC;CACd;AAMD;;;;GAIG;AACH,UAAU,YAAY;IACpB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,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