@promptctl/rich-js 0.7.0 → 0.9.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 (201) hide show
  1. package/README.md +99 -31
  2. package/dist/core/box.d.ts +96 -42
  3. package/dist/core/box.d.ts.map +1 -1
  4. package/dist/core/box.js +348 -490
  5. package/dist/core/box.js.map +1 -1
  6. package/dist/core/cells.d.ts +46 -1
  7. package/dist/core/cells.d.ts.map +1 -1
  8. package/dist/core/cells.js +55 -14
  9. package/dist/core/cells.js.map +1 -1
  10. package/dist/core/color.d.ts.map +1 -1
  11. package/dist/core/color.js +22 -8
  12. package/dist/core/color.js.map +1 -1
  13. package/dist/core/console.d.ts +30 -14
  14. package/dist/core/console.d.ts.map +1 -1
  15. package/dist/core/console.js +176 -104
  16. package/dist/core/console.js.map +1 -1
  17. package/dist/core/highlighter.d.ts +2 -1
  18. package/dist/core/highlighter.d.ts.map +1 -1
  19. package/dist/core/highlighter.js +28 -6
  20. package/dist/core/highlighter.js.map +1 -1
  21. package/dist/{renderables → core}/json.d.ts +8 -3
  22. package/dist/core/json.d.ts.map +1 -0
  23. package/dist/{renderables → core}/json.js +7 -2
  24. package/dist/core/json.js.map +1 -0
  25. package/dist/core/markup.d.ts +6 -9
  26. package/dist/core/markup.d.ts.map +1 -1
  27. package/dist/core/markup.js +153 -47
  28. package/dist/core/markup.js.map +1 -1
  29. package/dist/core/measure.d.ts +11 -0
  30. package/dist/core/measure.d.ts.map +1 -1
  31. package/dist/core/measure.js +15 -3
  32. package/dist/core/measure.js.map +1 -1
  33. package/dist/core/oklch.d.ts +22 -0
  34. package/dist/core/oklch.d.ts.map +1 -1
  35. package/dist/core/oklch.js +62 -18
  36. package/dist/core/oklch.js.map +1 -1
  37. package/dist/core/pretty.d.ts +122 -0
  38. package/dist/core/pretty.d.ts.map +1 -0
  39. package/dist/core/pretty.js +398 -0
  40. package/dist/core/pretty.js.map +1 -0
  41. package/dist/core/protocol.d.ts +80 -0
  42. package/dist/core/protocol.d.ts.map +1 -1
  43. package/dist/core/protocol.js +85 -0
  44. package/dist/core/protocol.js.map +1 -1
  45. package/dist/core/segment.d.ts +26 -0
  46. package/dist/core/segment.d.ts.map +1 -1
  47. package/dist/core/segment.js +45 -0
  48. package/dist/core/segment.js.map +1 -1
  49. package/dist/core/strip.d.ts +9 -5
  50. package/dist/core/strip.d.ts.map +1 -1
  51. package/dist/core/strip.js +39 -41
  52. package/dist/core/strip.js.map +1 -1
  53. package/dist/core/style.d.ts +19 -0
  54. package/dist/core/style.d.ts.map +1 -1
  55. package/dist/core/style.js +46 -38
  56. package/dist/core/style.js.map +1 -1
  57. package/dist/core/subscription.d.ts +13 -0
  58. package/dist/core/subscription.d.ts.map +1 -0
  59. package/dist/core/subscription.js +13 -0
  60. package/dist/core/subscription.js.map +1 -0
  61. package/dist/core/text.d.ts +102 -4
  62. package/dist/core/text.d.ts.map +1 -1
  63. package/dist/core/text.js +332 -162
  64. package/dist/core/text.js.map +1 -1
  65. package/dist/core/wrap.d.ts +42 -0
  66. package/dist/core/wrap.d.ts.map +1 -0
  67. package/dist/core/wrap.js +128 -0
  68. package/dist/core/wrap.js.map +1 -0
  69. package/dist/host/host-stream.d.ts.map +1 -0
  70. package/dist/host/host-stream.js.map +1 -0
  71. package/dist/host/index.d.ts +4 -0
  72. package/dist/host/index.d.ts.map +1 -0
  73. package/dist/host/index.js +3 -0
  74. package/dist/host/index.js.map +1 -0
  75. package/dist/{widgets → host}/terminal-host.d.ts +20 -64
  76. package/dist/host/terminal-host.d.ts.map +1 -0
  77. package/dist/host/terminal-host.js +133 -0
  78. package/dist/host/terminal-host.js.map +1 -0
  79. package/dist/index.d.ts +13 -36
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +35 -22
  82. package/dist/index.js.map +1 -1
  83. package/dist/node/terminal-host.d.ts +85 -0
  84. package/dist/node/terminal-host.d.ts.map +1 -0
  85. package/dist/node/terminal-host.js +161 -0
  86. package/dist/node/terminal-host.js.map +1 -0
  87. package/dist/node/traceback.d.ts +28 -0
  88. package/dist/node/traceback.d.ts.map +1 -0
  89. package/dist/node/traceback.js +113 -0
  90. package/dist/node/traceback.js.map +1 -0
  91. package/dist/renderables/columns.d.ts +24 -2
  92. package/dist/renderables/columns.d.ts.map +1 -1
  93. package/dist/renderables/columns.js +91 -32
  94. package/dist/renderables/columns.js.map +1 -1
  95. package/dist/renderables/layout.d.ts +61 -5
  96. package/dist/renderables/layout.d.ts.map +1 -1
  97. package/dist/renderables/layout.js +191 -19
  98. package/dist/renderables/layout.js.map +1 -1
  99. package/dist/renderables/markdown.d.ts +1 -1
  100. package/dist/renderables/markdown.d.ts.map +1 -1
  101. package/dist/renderables/markdown.js +7 -14
  102. package/dist/renderables/markdown.js.map +1 -1
  103. package/dist/renderables/padding.d.ts +16 -3
  104. package/dist/renderables/padding.d.ts.map +1 -1
  105. package/dist/renderables/padding.js +96 -47
  106. package/dist/renderables/padding.js.map +1 -1
  107. package/dist/renderables/panel.d.ts +48 -7
  108. package/dist/renderables/panel.d.ts.map +1 -1
  109. package/dist/renderables/panel.js +175 -106
  110. package/dist/renderables/panel.js.map +1 -1
  111. package/dist/renderables/progress.d.ts +3 -3
  112. package/dist/renderables/progress.d.ts.map +1 -1
  113. package/dist/renderables/progress.js +11 -9
  114. package/dist/renderables/progress.js.map +1 -1
  115. package/dist/renderables/progressBar.d.ts +3 -3
  116. package/dist/renderables/progressBar.d.ts.map +1 -1
  117. package/dist/renderables/progressBar.js +9 -15
  118. package/dist/renderables/progressBar.js.map +1 -1
  119. package/dist/renderables/prompt.js +1 -1
  120. package/dist/renderables/prompt.js.map +1 -1
  121. package/dist/renderables/rule.d.ts +1 -1
  122. package/dist/renderables/rule.d.ts.map +1 -1
  123. package/dist/renderables/rule.js +5 -10
  124. package/dist/renderables/rule.js.map +1 -1
  125. package/dist/renderables/spinner.d.ts +2 -2
  126. package/dist/renderables/spinner.d.ts.map +1 -1
  127. package/dist/renderables/spinner.js +6 -11
  128. package/dist/renderables/spinner.js.map +1 -1
  129. package/dist/renderables/status.d.ts.map +1 -1
  130. package/dist/renderables/status.js +5 -11
  131. package/dist/renderables/status.js.map +1 -1
  132. package/dist/renderables/table.d.ts +90 -16
  133. package/dist/renderables/table.d.ts.map +1 -1
  134. package/dist/renderables/table.js +481 -223
  135. package/dist/renderables/table.js.map +1 -1
  136. package/dist/renderables/traceback.d.ts +7 -3
  137. package/dist/renderables/traceback.d.ts.map +1 -1
  138. package/dist/renderables/traceback.js +15 -18
  139. package/dist/renderables/traceback.js.map +1 -1
  140. package/dist/renderables/tree.d.ts +29 -4
  141. package/dist/renderables/tree.d.ts.map +1 -1
  142. package/dist/renderables/tree.js +86 -33
  143. package/dist/renderables/tree.js.map +1 -1
  144. package/dist/template-bindings/color-funcs.d.ts +3 -3
  145. package/dist/template-bindings/color-funcs.js +3 -3
  146. package/dist/template-bindings/helpers.d.ts.map +1 -1
  147. package/dist/template-bindings/helpers.js +19 -1
  148. package/dist/template-bindings/helpers.js.map +1 -1
  149. package/dist/template-bindings/index.d.ts +6 -7
  150. package/dist/template-bindings/index.d.ts.map +1 -1
  151. package/dist/template-bindings/index.js +6 -7
  152. package/dist/template-bindings/index.js.map +1 -1
  153. package/dist/template-bindings/palette-funcs.d.ts +17 -5
  154. package/dist/template-bindings/palette-funcs.d.ts.map +1 -1
  155. package/dist/template-bindings/palette-funcs.js +69 -6
  156. package/dist/template-bindings/palette-funcs.js.map +1 -1
  157. package/dist/template-bindings/style-funcs.d.ts +1 -1
  158. package/dist/template-bindings/style-funcs.js +1 -1
  159. package/dist/themes/ramp.d.ts +84 -0
  160. package/dist/themes/ramp.d.ts.map +1 -0
  161. package/dist/themes/ramp.js +123 -0
  162. package/dist/themes/ramp.js.map +1 -0
  163. package/dist/widgets/dropdown.d.ts +1 -1
  164. package/dist/widgets/dropdown.js +1 -1
  165. package/dist/widgets/event-router.d.ts +3 -2
  166. package/dist/widgets/event-router.d.ts.map +1 -1
  167. package/dist/widgets/focus-manager.d.ts +2 -1
  168. package/dist/widgets/focus-manager.d.ts.map +1 -1
  169. package/dist/widgets/index.d.ts +3 -6
  170. package/dist/widgets/index.d.ts.map +1 -1
  171. package/dist/widgets/index.js +4 -3
  172. package/dist/widgets/index.js.map +1 -1
  173. package/dist/widgets/screen.d.ts +1 -1
  174. package/dist/widgets/screen.d.ts.map +1 -1
  175. package/dist/widgets/text-input.d.ts +2 -3
  176. package/dist/widgets/text-input.d.ts.map +1 -1
  177. package/dist/widgets/text-input.js +4 -12
  178. package/dist/widgets/text-input.js.map +1 -1
  179. package/dist/widgets/types.d.ts +1 -1
  180. package/dist/widgets/types.d.ts.map +1 -1
  181. package/dist/widgets/types.js.map +1 -1
  182. package/dist/widgets/widget-base.d.ts +2 -1
  183. package/dist/widgets/widget-base.d.ts.map +1 -1
  184. package/package.json +38 -6
  185. package/dist/renderables/json.d.ts.map +0 -1
  186. package/dist/renderables/json.js.map +0 -1
  187. package/dist/renderables/pretty.d.ts +0 -29
  188. package/dist/renderables/pretty.d.ts.map +0 -1
  189. package/dist/renderables/pretty.js +0 -141
  190. package/dist/renderables/pretty.js.map +0 -1
  191. package/dist/themes/paletteResolver.d.ts +0 -35
  192. package/dist/themes/paletteResolver.d.ts.map +0 -1
  193. package/dist/themes/paletteResolver.js +0 -88
  194. package/dist/themes/paletteResolver.js.map +0 -1
  195. package/dist/widgets/host-stream.d.ts.map +0 -1
  196. package/dist/widgets/host-stream.js.map +0 -1
  197. package/dist/widgets/terminal-host.d.ts.map +0 -1
  198. package/dist/widgets/terminal-host.js +0 -258
  199. package/dist/widgets/terminal-host.js.map +0 -1
  200. /package/dist/{widgets → host}/host-stream.d.ts +0 -0
  201. /package/dist/{widgets → host}/host-stream.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/template-bindings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH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D;AAC5D,MAAM,oBAAoB,GAAG,IAAI,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AACpE,SAAS,cAAc,CAAC,IAAwB;IAC9C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,oBAAoB,CAAC;IACpD,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,oBAAoB,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -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,9 +58,9 @@
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 type { FuncMap } from "@promptctl/go-template-js";
54
66
  import type { Palette } from "../themes/palette.js";
@@ -1 +1 @@
1
- {"version":3,"file":"palette-funcs.d.ts","sourceRoot":"","sources":["../../src/template-bindings/palette-funcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,OAAO,GAAG,OAAO,CAO/D"}
1
+ {"version":3,"file":"palette-funcs.d.ts","sourceRoot":"","sources":["../../src/template-bindings/palette-funcs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAsCpD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,OAAO,GAAG,OAAO,CA8B/D"}
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AAE/E;;;;;;;;;;;GAWG;AACH,SAAS,UAAU,CAAC,IAAwB,EAAE,OAAgB;IAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,CAClB,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAClB,8BAA8B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,mBAAmB;YAC5E,oCAAoC,CACvC,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAgB,EAAE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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,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,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,MA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,CAAC,aAAa,CAAU;IAOxC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,eAAe,CAA0B;IAMjD,OAAO,CAAC,QAAQ,CAA4C;IAM5D,OAAO,CAAC,cAAc,CAAkC;IAKxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgD;gBAElE,OAAO,EAAE,kBAAkB;IA0BvC,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IA+BZ,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,WAAW;IAYpE,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,WAAW;IAOhE,oEAAoE;IACpE,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAoBtC,oDAAoD;IACpD,KAAK,IAAI,IAAI;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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C,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,iBAAiB,GAAG,IAAI;IAOtC,IAAI,IAAI,IAAI;IASZ,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,GAAG,WAAW;IAS3E,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAShC,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,QAAQ;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,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,aA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ggle } 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,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAY3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAcA,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,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,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,E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e;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"}
@@ -100,9 +100,8 @@ export interface WrapRow {
100
100
  * awareness, just fits the line to the width.
101
101
  *
102
102
  * Wide characters (CJK, emoji) are treated as atomic: a char that would
103
- * straddle the budget is moved to the next row rather than split. When the
104
- * budget is too narrow to fit even one character, that character is
105
- * force-taken to guarantee progress (avoids an infinite loop).
103
+ * straddle the budget is moved to the next row rather than split, and one too
104
+ * wide for the whole budget is force-taken — see `cellStepFrom`.
106
105
  */
107
106
  export declare const charGreedyWrap: WrapStrategy;
108
107
  export interface TextInputOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../src/widgets/text-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAUL,KAAK,OAAO,EACZ,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAA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AAU;IAMlB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,WAAW;IAkBnB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;IAKjD,OAAO,CAAC,iBAAiB;IAoEzB,OAAO,CAAC,gBAAgB;IAuGxB,OAAO,CAAC,eAAe;IA6DvB,OAAO,CAAC,kBAAkB;IA+B1B,OAAO,CAAC,QAAQ,EAAE,aAAa,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAMtE;;;;;;;;;;;;OAYG;IACH,IAAI,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAO5C;IAID,OAAO,CAAC,cAAc;CAKvB"}
@@ -93,7 +93,7 @@ import { observable, action } from "mobx";
93
93
  import { Segment } from "../core/segment.js";
94
94
  import { Style } from "../core/style.js";
95
95
  import { ColorSpec } from "../core/color.js";
96
- import { cellLen, setCellSize, splitText, cellFitFrom, cellColToCodeUnitOffset, asCellCol, asCodePoint, nextCodePoint, prevCodePoint, } from "../core/cells.js";
96
+ import { cellLen, setCellSize, splitText, cellStepFrom, cellColToCodeUnitOffset, asCellCol, asCodePoint, nextCodePoint, prevCodePoint, } from "../core/cells.js";
97
97
  import { DEFAULT_TERMINAL_THEME } from "../themes/terminalThemes.js";
98
98
  import { WidgetBase } from "./widget-base.js";
99
99
  /**
@@ -103,9 +103,8 @@ import { WidgetBase } from "./widget-base.js";
103
103
  * awareness, just fits the line to the width.
104
104
  *
105
105
  * Wide characters (CJK, emoji) are treated as atomic: a char that would
106
- * straddle the budget is moved to the next row rather than split. When the
107
- * budget is too narrow to fit even one character, that character is
108
- * force-taken to guarantee progress (avoids an infinite loop).
106
+ * straddle the budget is moved to the next row rather than split, and one too
107
+ * wide for the whole budget is force-taken — see `cellStepFrom`.
109
108
  */
110
109
  export const charGreedyWrap = (line, { firstWidth, continuationWidth }) => {
111
110
  if (line.length === 0)
@@ -117,14 +116,7 @@ export const charGreedyWrap = (line, { firstWidth, continuationWidth }) => {
117
116
  const cap = isFirst ? firstWidth : continuationWidth;
118
117
  if (cap <= 0)
119
118
  break;
120
- let end = cellFitFrom(line, pos, cap);
121
- if (end === pos) {
122
- // Leading character exceeds cap — force-take one code point to guarantee
123
- // progress when the terminal is extremely narrow.
124
- end = nextCodePoint(line, pos);
125
- if (end === pos)
126
- break;
127
- }
119
+ const end = cellStepFrom(line, pos, cap);
128
120
  rows.push({ content: line.slice(pos, end), start: pos });
129
121
  pos = end;
130
122
  isFirst = false;