@promptctl/rich-js 0.16.0 → 0.18.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 (206) hide show
  1. package/README.md +14 -27
  2. package/package.json +7 -3
  3. package/dist/core/box.d.ts +0 -144
  4. package/dist/core/box.js +0 -391
  5. package/dist/core/cells.d.ts +0 -148
  6. package/dist/core/cells.js +0 -266
  7. package/dist/core/color.d.ts +0 -229
  8. package/dist/core/color.js +0 -992
  9. package/dist/core/console.d.ts +0 -142
  10. package/dist/core/console.js +0 -477
  11. package/dist/core/emoji.d.ts +0 -24
  12. package/dist/core/emoji.js +0 -391
  13. package/dist/core/export-html.d.ts +0 -24
  14. package/dist/core/export-html.js +0 -106
  15. package/dist/core/export-lines.d.ts +0 -121
  16. package/dist/core/export-lines.js +0 -141
  17. package/dist/core/highlighter.d.ts +0 -33
  18. package/dist/core/highlighter.js +0 -124
  19. package/dist/core/json.d.ts +0 -27
  20. package/dist/core/json.js +0 -53
  21. package/dist/core/markup.d.ts +0 -97
  22. package/dist/core/markup.js +0 -619
  23. package/dist/core/measure.d.ts +0 -27
  24. package/dist/core/measure.js +0 -61
  25. package/dist/core/oklch.d.ts +0 -161
  26. package/dist/core/oklch.js +0 -312
  27. package/dist/core/osc8.d.ts +0 -68
  28. package/dist/core/osc8.js +0 -90
  29. package/dist/core/pretty.d.ts +0 -141
  30. package/dist/core/pretty.js +0 -472
  31. package/dist/core/protocol.d.ts +0 -137
  32. package/dist/core/protocol.js +0 -101
  33. package/dist/core/render.d.ts +0 -69
  34. package/dist/core/render.js +0 -140
  35. package/dist/core/segment.d.ts +0 -142
  36. package/dist/core/segment.js +0 -433
  37. package/dist/core/spinnerData.d.ts +0 -10
  38. package/dist/core/spinnerData.js +0 -115
  39. package/dist/core/strip.d.ts +0 -139
  40. package/dist/core/strip.js +0 -302
  41. package/dist/core/style.d.ts +0 -149
  42. package/dist/core/style.js +0 -741
  43. package/dist/core/subscription.d.ts +0 -12
  44. package/dist/core/subscription.js +0 -12
  45. package/dist/core/text.d.ts +0 -255
  46. package/dist/core/text.js +0 -990
  47. package/dist/core/wrap.d.ts +0 -41
  48. package/dist/core/wrap.js +0 -127
  49. package/dist/host/host-stream.d.ts +0 -30
  50. package/dist/host/host-stream.js +0 -35
  51. package/dist/host/index.d.ts +0 -3
  52. package/dist/host/index.js +0 -2
  53. package/dist/host/terminal-host.d.ts +0 -143
  54. package/dist/host/terminal-host.js +0 -132
  55. package/dist/index.d.ts +0 -87
  56. package/dist/index.js +0 -104
  57. package/dist/node/prompt.d.ts +0 -21
  58. package/dist/node/prompt.js +0 -30
  59. package/dist/node/save.d.ts +0 -17
  60. package/dist/node/save.js +0 -21
  61. package/dist/node/terminal-host.d.ts +0 -84
  62. package/dist/node/terminal-host.js +0 -160
  63. package/dist/node/traceback.d.ts +0 -27
  64. package/dist/node/traceback.js +0 -112
  65. package/dist/renderables/align.d.ts +0 -16
  66. package/dist/renderables/align.js +0 -46
  67. package/dist/renderables/columns.d.ts +0 -61
  68. package/dist/renderables/columns.js +0 -168
  69. package/dist/renderables/constrain.d.ts +0 -15
  70. package/dist/renderables/constrain.js +0 -37
  71. package/dist/renderables/flexStrip.d.ts +0 -41
  72. package/dist/renderables/flexStrip.js +0 -200
  73. package/dist/renderables/group.d.ts +0 -11
  74. package/dist/renderables/group.js +0 -15
  75. package/dist/renderables/layout.d.ts +0 -92
  76. package/dist/renderables/layout.js +0 -315
  77. package/dist/renderables/live.d.ts +0 -47
  78. package/dist/renderables/live.js +0 -131
  79. package/dist/renderables/markdown.d.ts +0 -24
  80. package/dist/renderables/markdown.js +0 -182
  81. package/dist/renderables/padding.d.ts +0 -38
  82. package/dist/renderables/padding.js +0 -140
  83. package/dist/renderables/panel.d.ts +0 -116
  84. package/dist/renderables/panel.js +0 -322
  85. package/dist/renderables/progress.d.ts +0 -90
  86. package/dist/renderables/progress.js +0 -241
  87. package/dist/renderables/progressBar.d.ts +0 -31
  88. package/dist/renderables/progressBar.js +0 -52
  89. package/dist/renderables/prompt.d.ts +0 -49
  90. package/dist/renderables/prompt.js +0 -125
  91. package/dist/renderables/rule.d.ts +0 -24
  92. package/dist/renderables/rule.js +0 -90
  93. package/dist/renderables/spinner.d.ts +0 -29
  94. package/dist/renderables/spinner.js +0 -64
  95. package/dist/renderables/status.d.ts +0 -23
  96. package/dist/renderables/status.js +0 -60
  97. package/dist/renderables/syntax.d.ts +0 -35
  98. package/dist/renderables/syntax.js +0 -114
  99. package/dist/renderables/table.d.ts +0 -182
  100. package/dist/renderables/table.js +0 -697
  101. package/dist/renderables/traceback.d.ts +0 -31
  102. package/dist/renderables/traceback.js +0 -109
  103. package/dist/renderables/tree.d.ts +0 -54
  104. package/dist/renderables/tree.js +0 -159
  105. package/dist/template-bindings/color-funcs.d.ts +0 -87
  106. package/dist/template-bindings/color-funcs.js +0 -219
  107. package/dist/template-bindings/helpers.d.ts +0 -24
  108. package/dist/template-bindings/helpers.js +0 -48
  109. package/dist/template-bindings/index.d.ts +0 -107
  110. package/dist/template-bindings/index.js +0 -144
  111. package/dist/template-bindings/palette-funcs.d.ts +0 -94
  112. package/dist/template-bindings/palette-funcs.js +0 -151
  113. package/dist/template-bindings/style-funcs.d.ts +0 -28
  114. package/dist/template-bindings/style-funcs.js +0 -151
  115. package/dist/themes/buildPalette.d.ts +0 -36
  116. package/dist/themes/buildPalette.js +0 -56
  117. package/dist/themes/colorMath.d.ts +0 -82
  118. package/dist/themes/colorMath.js +0 -254
  119. package/dist/themes/colorRef.d.ts +0 -51
  120. package/dist/themes/colorRef.js +0 -96
  121. package/dist/themes/data/atom-one-dark.d.ts +0 -3
  122. package/dist/themes/data/atom-one-dark.js +0 -158
  123. package/dist/themes/data/atom-one-light.d.ts +0 -3
  124. package/dist/themes/data/atom-one-light.js +0 -158
  125. package/dist/themes/data/catppuccin-frappe.d.ts +0 -3
  126. package/dist/themes/data/catppuccin-frappe.js +0 -158
  127. package/dist/themes/data/catppuccin-latte.d.ts +0 -3
  128. package/dist/themes/data/catppuccin-latte.js +0 -158
  129. package/dist/themes/data/catppuccin-macchiato.d.ts +0 -3
  130. package/dist/themes/data/catppuccin-macchiato.js +0 -158
  131. package/dist/themes/data/catppuccin-mocha.d.ts +0 -3
  132. package/dist/themes/data/catppuccin-mocha.js +0 -158
  133. package/dist/themes/data/cyberpunk.d.ts +0 -17
  134. package/dist/themes/data/cyberpunk.js +0 -191
  135. package/dist/themes/data/default.d.ts +0 -3
  136. package/dist/themes/data/default.js +0 -158
  137. package/dist/themes/data/dracula.d.ts +0 -3
  138. package/dist/themes/data/dracula.js +0 -158
  139. package/dist/themes/data/flexoki.d.ts +0 -3
  140. package/dist/themes/data/flexoki.js +0 -158
  141. package/dist/themes/data/gruvbox.d.ts +0 -3
  142. package/dist/themes/data/gruvbox.js +0 -158
  143. package/dist/themes/data/index.d.ts +0 -35
  144. package/dist/themes/data/index.js +0 -64
  145. package/dist/themes/data/monokai.d.ts +0 -3
  146. package/dist/themes/data/monokai.js +0 -158
  147. package/dist/themes/data/nord.d.ts +0 -3
  148. package/dist/themes/data/nord.js +0 -158
  149. package/dist/themes/data/rose-pine-dawn.d.ts +0 -3
  150. package/dist/themes/data/rose-pine-dawn.js +0 -158
  151. package/dist/themes/data/rose-pine-moon.d.ts +0 -3
  152. package/dist/themes/data/rose-pine-moon.js +0 -158
  153. package/dist/themes/data/rose-pine.d.ts +0 -3
  154. package/dist/themes/data/rose-pine.js +0 -158
  155. package/dist/themes/data/solarized-dark.d.ts +0 -3
  156. package/dist/themes/data/solarized-dark.js +0 -158
  157. package/dist/themes/data/solarized-light.d.ts +0 -3
  158. package/dist/themes/data/solarized-light.js +0 -158
  159. package/dist/themes/data/svg-export.d.ts +0 -3
  160. package/dist/themes/data/svg-export.js +0 -158
  161. package/dist/themes/data/textual-ansi.d.ts +0 -3
  162. package/dist/themes/data/textual-ansi.js +0 -158
  163. package/dist/themes/data/textual-dark.d.ts +0 -3
  164. package/dist/themes/data/textual-dark.js +0 -158
  165. package/dist/themes/data/textual-light.d.ts +0 -3
  166. package/dist/themes/data/textual-light.js +0 -158
  167. package/dist/themes/data/tokyo-night.d.ts +0 -3
  168. package/dist/themes/data/tokyo-night.js +0 -158
  169. package/dist/themes/data/types.d.ts +0 -15
  170. package/dist/themes/data/types.js +0 -1
  171. package/dist/themes/palette.d.ts +0 -21
  172. package/dist/themes/palette.js +0 -28
  173. package/dist/themes/ramp.d.ts +0 -83
  174. package/dist/themes/ramp.js +0 -122
  175. package/dist/themes/registry.d.ts +0 -43
  176. package/dist/themes/registry.js +0 -82
  177. package/dist/themes/terminalThemes.d.ts +0 -54
  178. package/dist/themes/terminalThemes.js +0 -68
  179. package/dist/themes/transpose.d.ts +0 -87
  180. package/dist/themes/transpose.js +0 -138
  181. package/dist/widgets/button.d.ts +0 -49
  182. package/dist/widgets/button.js +0 -206
  183. package/dist/widgets/checkbox.d.ts +0 -41
  184. package/dist/widgets/checkbox.js +0 -155
  185. package/dist/widgets/dropdown.d.ts +0 -67
  186. package/dist/widgets/dropdown.js +0 -453
  187. package/dist/widgets/event-router.d.ts +0 -78
  188. package/dist/widgets/event-router.js +0 -622
  189. package/dist/widgets/focus-manager.d.ts +0 -26
  190. package/dist/widgets/focus-manager.js +0 -193
  191. package/dist/widgets/index.d.ts +0 -22
  192. package/dist/widgets/index.js +0 -15
  193. package/dist/widgets/screen.d.ts +0 -98
  194. package/dist/widgets/screen.js +0 -542
  195. package/dist/widgets/slider.d.ts +0 -57
  196. package/dist/widgets/slider.js +0 -270
  197. package/dist/widgets/static-item.d.ts +0 -40
  198. package/dist/widgets/static-item.js +0 -60
  199. package/dist/widgets/text-input.d.ts +0 -274
  200. package/dist/widgets/text-input.js +0 -1162
  201. package/dist/widgets/toggle.d.ts +0 -44
  202. package/dist/widgets/toggle.js +0 -179
  203. package/dist/widgets/types.d.ts +0 -108
  204. package/dist/widgets/types.js +0 -31
  205. package/dist/widgets/widget-base.d.ts +0 -42
  206. package/dist/widgets/widget-base.js +0 -173
@@ -1,182 +0,0 @@
1
- /**
2
- * Table — tabular data with headers, borders, auto-sizing, and alignment.
3
- */
4
- import { Segment } from "../core/segment.js";
5
- import { Style } from "../core/style.js";
6
- import { Box } from "../core/box.js";
7
- import { RichText } from "../core/text.js";
8
- import type { PaddingDimensions } from "./padding.js";
9
- import type { Renderable, Measurable, RenderOptions } from "../core/protocol.js";
10
- export interface ColumnOptions {
11
- header?: string | RichText;
12
- footer?: string | RichText;
13
- headerStyle?: string | Style;
14
- footerStyle?: string | Style;
15
- style?: string | Style;
16
- justify?: "left" | "center" | "right" | "full";
17
- width?: number;
18
- minWidth?: number;
19
- maxWidth?: number;
20
- ratio?: number;
21
- noWrap?: boolean;
22
- overflow?: "fold" | "crop" | "ellipsis";
23
- }
24
- export declare class Column {
25
- private _header;
26
- private _footer;
27
- headerStyle: string | Style;
28
- footerStyle: string | Style;
29
- style: string | Style;
30
- justify: "left" | "center" | "right" | "full";
31
- width: number | undefined;
32
- minWidth: number | undefined;
33
- maxWidth: number | undefined;
34
- ratio: number | undefined;
35
- noWrap: boolean;
36
- overflow: "fold" | "crop" | "ellipsis";
37
- private _cells;
38
- constructor(options?: ColumnOptions);
39
- /**
40
- * The two stamped cells, parsed on assignment rather than at the constructor.
41
- * `Table.columns` hands out the live column and both fields are public, so a
42
- * constructor-only stamp held only until the first `columns[0].footer = mine`
43
- * — which installed content that had parsed no markup, still carried its
44
- * `end`, and was still owned by the caller, into a slot every reader below
45
- * assumes `toCellText` has been through. [LAW:parse-dont-validate] The setter
46
- * is the border, so the guarantee holds for the object's whole lifetime and
47
- * the constructor is one caller of it rather than the one place it is true.
48
- *
49
- * Absent and empty are the same header, and the same footer.
50
- * [LAW:types-are-the-program] Rich declares `footer: RenderableType = ""`, so
51
- * a column always has one and `show_footer` alone decides whether it is
52
- * drawn. Modelling the absence as `undefined` instead made "no column has a
53
- * footer" a state the render path could ask about — and it did, skipping the
54
- * row a caller had asked for. `toCellText` already maps nothing onto empty,
55
- * which is why the setters take `undefined` rather than defaulting around it.
56
- */
57
- get header(): RichText;
58
- set header(content: string | RichText | undefined);
59
- get footer(): RichText;
60
- set footer(content: string | RichText | undefined);
61
- get flexible(): boolean;
62
- /** @internal */
63
- addCell(cell: Renderable): void;
64
- /** @internal */
65
- getCells(): Renderable[];
66
- copy(): Column;
67
- }
68
- export interface TableOptions {
69
- box?: Box | null;
70
- title?: string | RichText;
71
- caption?: string | RichText;
72
- expand?: boolean;
73
- showHeader?: boolean;
74
- showFooter?: boolean;
75
- showLines?: boolean;
76
- showEdge?: boolean;
77
- padding?: PaddingDimensions;
78
- style?: string | Style;
79
- headerStyle?: string | Style;
80
- footerStyle?: string | Style;
81
- borderStyle?: string | Style;
82
- titleStyle?: string | Style;
83
- captionStyle?: string | Style;
84
- titleJustify?: "left" | "center" | "right" | "full";
85
- captionJustify?: "left" | "center" | "right" | "full";
86
- width?: number;
87
- minWidth?: number;
88
- rowStyles?: string[];
89
- }
90
- export declare class Table implements Renderable, Measurable {
91
- private _columns;
92
- private _rows;
93
- readonly box: Box | null;
94
- readonly title: RichText | undefined;
95
- readonly caption: RichText | undefined;
96
- readonly expand: boolean;
97
- readonly showHeader: boolean;
98
- readonly showFooter: boolean;
99
- readonly showLines: boolean;
100
- readonly showEdge: boolean;
101
- readonly padding: [number, number, number, number];
102
- readonly style: string | Style;
103
- readonly headerStyle: string | Style;
104
- readonly footerStyle: string | Style;
105
- readonly borderStyle: string | Style;
106
- readonly titleStyle: string | Style;
107
- readonly captionStyle: string | Style;
108
- readonly titleJustify: "left" | "center" | "right" | "full";
109
- readonly captionJustify: "left" | "center" | "right" | "full";
110
- readonly tableWidth: number | undefined;
111
- readonly minWidth: number | undefined;
112
- readonly rowStyles: string[];
113
- constructor(options?: TableOptions);
114
- get columns(): Column[];
115
- get rowCount(): number;
116
- addColumn(header?: string | RichText, options?: ColumnOptions): this;
117
- addRow(...cells: unknown[]): this;
118
- addSection(): this;
119
- render(rawOptions: RenderOptions): Iterable<Segment>;
120
- /**
121
- * [LAW:one-source-of-truth] Both ends of the range are widths the geometry
122
- * actually produced — the maximum from the demands as they stand, the
123
- * minimum from the same layout with every column asking for a single cell.
124
- * Neither end stretches: a stretch only spends cells an offer happens to
125
- * leave over, and a renderable reports the width its content wants rather
126
- * than the width it was offered. Letting it in made an expanding table
127
- * measure `Infinity` against an unbounded offer, where `withBoundedWidth`
128
- * needs a natural width to fall back on.
129
- * Neither can exceed the width offered and the tighter request cannot exceed
130
- * the looser one, so the range cannot invert. Deriving the minimum from raw
131
- * column and padding counts instead is what used to return
132
- * `{minimum: 6, maximum: 1}` at `maxWidth: 1` — a floor above its own ceiling.
133
- */
134
- measure(rawOptions: RenderOptions): {
135
- minimum: number;
136
- maximum: number;
137
- };
138
- static grid(options?: Omit<TableOptions, "box" | "showHeader" | "showEdge">): Table;
139
- private _frame;
140
- /**
141
- * The width this table lays itself out against: what it was told to be, as a
142
- * count of cells, never wider than what it was offered.
143
- *
144
- * [LAW:one-source-of-truth] `render` and `measure` divide the same two fields
145
- * and once did it in two places. `measure` bounded the declared width by the
146
- * offer and `render` preferred it outright, walking past the value
147
- * `withBoundedWidth` had just resolved — so `new Table({width: Infinity})`
148
- * with a `{ratio: 1}` column granted that column `UNBOUNDED` cells and threw
149
- * `RangeError: Invalid string length` out of the top border, at a perfectly
150
- * ordinary 80-cell offer.
151
- */
152
- private _outerWidth;
153
- private _geometry;
154
- /**
155
- * [LAW:dataflow-not-control-flow] The three ways a column can be sized —
156
- * declared width, ratio, natural content — differ only in the demand they
157
- * produce, and `expand` only in its `stretch`. They are resolved once, here, into uniform data, so
158
- * `layoutTable` runs the same apportionment for every table and no sizing
159
- * mode gets its own path through the width division.
160
- */
161
- private _columnDemands;
162
- /**
163
- * Every cell column `index` draws, in draw order.
164
- *
165
- * [LAW:one-source-of-truth] The reference's `_get_cells` is the one answer to
166
- * "which cells belong to this column", and both `_measure_column` and
167
- * `_render` read it. Enumerating that set a second time inside the width path
168
- * is how the two ends drifted: the header was measured whether or not
169
- * `showHeader` drew it, and `col.footer` was never measured at all, so a
170
- * footer wider than its column — a totals row, exactly — was cut to `…`.
171
- * A flag is the whole membership rule; nothing here asks after content.
172
- */
173
- private _columnCells;
174
- /**
175
- * The widest cell in a column, bounded by its own `minWidth`/`maxWidth`.
176
- * Zero for a column that draws nothing — a gutter asks for its padding and
177
- * nothing else.
178
- */
179
- private _naturalWidth;
180
- private _renderRow;
181
- private _renderTitle;
182
- }