@promptctl/rich-js 0.24.1 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/core/anchor.d.ts +5 -0
- package/dist/core/anchor.js +11 -4
- package/dist/core/animation.d.ts +175 -10
- package/dist/core/animation.js +283 -15
- package/dist/core/ansi.js +2 -2
- package/dist/core/box.d.ts +7 -7
- package/dist/core/cells.d.ts +23 -13
- package/dist/core/cells.js +58 -48
- package/dist/core/clock.d.ts +2 -2
- package/dist/core/clock.js +6 -4
- package/dist/core/color.d.ts +27 -10
- package/dist/core/color.js +24 -33
- package/dist/core/console.d.ts +28 -17
- package/dist/core/console.js +44 -39
- package/dist/core/easing.d.ts +30 -0
- package/dist/core/easing.js +65 -20
- package/dist/core/emoji.d.ts +1 -1
- package/dist/core/emoji.js +1 -2
- package/dist/core/export-html.js +2 -1
- package/dist/core/export-lines.js +3 -3
- package/dist/core/highlighter.d.ts +9 -8
- package/dist/core/highlighter.js +3 -2
- package/dist/core/json.js +2 -2
- package/dist/core/markup.js +16 -12
- package/dist/core/measure.js +2 -2
- package/dist/core/memo.d.ts +11 -2
- package/dist/core/memo.js +16 -0
- package/dist/core/oklch.js +17 -6
- package/dist/core/osc8.d.ts +1 -1
- package/dist/core/osc8.js +4 -5
- package/dist/core/paint.d.ts +2 -1
- package/dist/core/paint.js +4 -3
- package/dist/core/pattern.d.ts +21 -0
- package/dist/core/pattern.js +21 -0
- package/dist/core/pretty.js +9 -10
- package/dist/core/protocol.d.ts +100 -39
- package/dist/core/protocol.js +167 -21
- package/dist/core/render.d.ts +15 -2
- package/dist/core/render.js +25 -5
- package/dist/core/segment.d.ts +13 -5
- package/dist/core/segment.js +23 -9
- package/dist/core/spinnerData.d.ts +1 -1
- package/dist/core/state.d.ts +53 -0
- package/dist/core/state.js +82 -0
- package/dist/core/strip.d.ts +98 -29
- package/dist/core/strip.js +211 -150
- package/dist/core/style.d.ts +47 -14
- package/dist/core/style.js +57 -28
- package/dist/core/text.d.ts +5 -8
- package/dist/core/text.js +116 -124
- package/dist/core/timeline.d.ts +30 -5
- package/dist/core/timeline.js +43 -7
- package/dist/core/tween.d.ts +1 -1
- package/dist/core/tween.js +5 -3
- package/dist/core/view.d.ts +92 -0
- package/dist/core/view.js +83 -0
- package/dist/host/app.d.ts +49 -21
- package/dist/host/app.js +71 -37
- package/dist/host/input.js +3 -4
- package/dist/index.d.ts +24 -12
- package/dist/index.js +9 -4
- package/dist/node/traceback.js +4 -3
- package/dist/renderables/align.d.ts +2 -3
- package/dist/renderables/align.js +0 -3
- package/dist/renderables/change.d.ts +42 -0
- package/dist/renderables/change.js +112 -0
- package/dist/renderables/columns.d.ts +3 -4
- package/dist/renderables/columns.js +2 -7
- package/dist/renderables/constrain.d.ts +2 -3
- package/dist/renderables/constrain.js +0 -3
- package/dist/renderables/effect.d.ts +158 -63
- package/dist/renderables/effect.js +378 -155
- package/dist/renderables/effects.d.ts +122 -11
- package/dist/renderables/effects.js +238 -94
- package/dist/renderables/embed.d.ts +1 -1
- package/dist/renderables/embed.js +16 -8
- package/dist/renderables/flexStrip.d.ts +2 -3
- package/dist/renderables/flexStrip.js +0 -4
- package/dist/renderables/frames.d.ts +35 -54
- package/dist/renderables/frames.js +43 -58
- package/dist/renderables/glyph-effect.d.ts +158 -0
- package/dist/renderables/glyph-effect.js +237 -0
- package/dist/renderables/glyph-effects.d.ts +147 -0
- package/dist/renderables/glyph-effects.js +283 -0
- package/dist/renderables/group.d.ts +3 -4
- package/dist/renderables/group.js +0 -3
- package/dist/renderables/layout.d.ts +12 -12
- package/dist/renderables/layout.js +40 -46
- package/dist/renderables/lifecycle.d.ts +77 -0
- package/dist/renderables/lifecycle.js +132 -0
- package/dist/renderables/list-view.d.ts +4 -5
- package/dist/renderables/list-view.js +9 -13
- package/dist/renderables/live.d.ts +36 -21
- package/dist/renderables/live.js +88 -41
- package/dist/renderables/markdown-parse.d.ts +4 -4
- package/dist/renderables/markdown-parse.js +52 -46
- package/dist/renderables/markdown-url.js +11 -11
- package/dist/renderables/padding.d.ts +4 -5
- package/dist/renderables/padding.js +0 -3
- package/dist/renderables/panel.d.ts +14 -16
- package/dist/renderables/panel.js +6 -14
- package/dist/renderables/progress.d.ts +83 -34
- package/dist/renderables/progress.js +182 -95
- package/dist/renderables/progressBar.d.ts +22 -12
- package/dist/renderables/progressBar.js +32 -9
- package/dist/renderables/prompt.js +3 -2
- package/dist/renderables/python-space.js +2 -1
- package/dist/renderables/scroll.d.ts +50 -0
- package/dist/renderables/scroll.js +106 -0
- package/dist/renderables/spinner.d.ts +35 -14
- package/dist/renderables/spinner.js +65 -25
- package/dist/renderables/status.js +1 -1
- package/dist/renderables/syntax.d.ts +10 -9
- package/dist/renderables/syntax.js +3 -2
- package/dist/renderables/table.d.ts +34 -40
- package/dist/renderables/table.js +41 -63
- package/dist/renderables/traceback.d.ts +2 -2
- package/dist/renderables/traceback.js +6 -5
- package/dist/renderables/tree.d.ts +27 -25
- package/dist/renderables/tree.js +104 -58
- package/dist/renderables/viewport.d.ts +75 -44
- package/dist/renderables/viewport.js +145 -82
- package/dist/template-bindings/animation-funcs.d.ts +78 -9
- package/dist/template-bindings/animation-funcs.js +132 -14
- package/dist/template-bindings/index.d.ts +5 -5
- package/dist/template-bindings/index.js +5 -5
- package/dist/themes/ramp.d.ts +46 -3
- package/dist/themes/ramp.js +61 -4
- package/dist/themes/registry.js +5 -7
- package/dist/widgets/button.js +3 -2
- package/dist/widgets/checkbox.js +4 -3
- package/dist/widgets/dropdown.d.ts +3 -1
- package/dist/widgets/dropdown.js +20 -15
- package/dist/widgets/event-router.js +4 -2
- package/dist/widgets/focus-manager.d.ts +2 -0
- package/dist/widgets/focus-manager.js +6 -4
- package/dist/widgets/hit.d.ts +6 -0
- package/dist/widgets/hit.js +8 -1
- package/dist/widgets/observable.d.ts +23 -0
- package/dist/widgets/observable.js +43 -0
- package/dist/widgets/slider.d.ts +1 -1
- package/dist/widgets/slider.js +12 -3
- package/dist/widgets/static-item.d.ts +2 -3
- package/dist/widgets/static-item.js +0 -3
- package/dist/widgets/text-input.d.ts +28 -32
- package/dist/widgets/text-input.js +360 -346
- package/dist/widgets/themed-widget.js +2 -1
- package/dist/widgets/toggle.js +4 -3
- package/dist/widgets/types.d.ts +10 -4
- package/dist/widgets/types.js +8 -2
- package/dist/widgets/widget-app.d.ts +14 -4
- package/dist/widgets/widget-app.js +36 -7
- package/dist/widgets/widget-base.d.ts +2 -2
- package/dist/widgets/widget-base.js +29 -18
- package/package.json +8 -1
package/dist/core/strip.d.ts
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
import type { Anchor } from "./anchor.js";
|
|
29
29
|
import { Segment } from "./segment.js";
|
|
30
30
|
import { Style } from "./style.js";
|
|
31
|
-
import {
|
|
31
|
+
import { ColorDepth, ColorSpec } from "./color.js";
|
|
32
|
+
import { type Measurable, type Renderable, type RenderOptions } from "./protocol.js";
|
|
32
33
|
/**
|
|
33
34
|
* Items in a `Strip` expose their per-edge style so joiners can paint the
|
|
34
35
|
* transition glyph at each boundary.
|
|
@@ -70,21 +71,11 @@ export interface Joiner<T extends StyledRenderable = StyledRenderable> {
|
|
|
70
71
|
* not draw at all. An effect reads it to leave a seam out of the words it
|
|
71
72
|
* keeps legible (`drawnOf`, `../renderables/effect.ts`).
|
|
72
73
|
*
|
|
73
|
-
* Inside it, every cell a `CellJoiner` draws
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* points into — so a cell has no single owner; each side has one.
|
|
74
|
+
* Inside it, every cell a `CellJoiner` draws is stamped with what it was
|
|
75
|
+
* resolved from (`JoinedCell`), so a cell whose neighbours an effect moves is
|
|
76
|
+
* resolved again from where they moved to.
|
|
77
77
|
*/
|
|
78
78
|
export declare const JOIN: object;
|
|
79
|
-
/**
|
|
80
|
-
* Which of a cell's two colours on screen are one of `owners`': both, for a
|
|
81
|
-
* cell one of them drew, itself or through an owner nested in its output; for
|
|
82
|
-
* a cell a `CellJoiner` drew, the sides shown in one of their colours.
|
|
83
|
-
*/
|
|
84
|
-
export declare function colorsOwnedBy(anchor: Anchor | undefined, owners: ReadonlySet<object>): {
|
|
85
|
-
readonly fg: boolean;
|
|
86
|
-
readonly bg: boolean;
|
|
87
|
-
};
|
|
88
79
|
/**
|
|
89
80
|
* [LAW:single-enforcer] What `joiner` draws at one join, every cell stamped
|
|
90
81
|
* as `JOIN`'s: the one way `Strip` and `FlexStrip` draw a join.
|
|
@@ -97,12 +88,11 @@ export declare function drawJoin<T extends StyledRenderable>(joiner: Joiner<T>,
|
|
|
97
88
|
* item.
|
|
98
89
|
*/
|
|
99
90
|
export declare function drawItem(item: StyledRenderable): Renderable;
|
|
100
|
-
export declare class Strip<T extends StyledRenderable = StyledRenderable> implements Renderable, Measurable
|
|
91
|
+
export declare class Strip<T extends StyledRenderable = StyledRenderable> implements Renderable, Measurable {
|
|
101
92
|
readonly items: readonly T[];
|
|
102
93
|
readonly joiner: Joiner<T>;
|
|
103
94
|
constructor(items: readonly T[], joiner: Joiner<T>);
|
|
104
95
|
render(options: RenderOptions): Iterable<Segment>;
|
|
105
|
-
contents(): Iterable<Renderable>;
|
|
106
96
|
/**
|
|
107
97
|
* [LAW:one-source-of-truth] The width of the one row it draws, and that is
|
|
108
98
|
* both bounds: the row never wraps and no item is offered less than the whole
|
|
@@ -167,15 +157,12 @@ export type SeamCell = JoinCell | {
|
|
|
167
157
|
readonly cap: "lead" | "tail";
|
|
168
158
|
};
|
|
169
159
|
/**
|
|
170
|
-
* What a joiner draws between two neighbours, in one form:
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* indistinct from its own ground (see `SEAM_MIN_DELTA_E`), so the seam
|
|
174
|
-
* would vanish; the same width as `seam`.
|
|
160
|
+
* What a joiner draws between two neighbours, in one form: `seam`, the cells
|
|
161
|
+
* between them. Each is drawn with its ink held off its own ground
|
|
162
|
+
* (`SEAM_MIN_DELTA_E`, `standOff`).
|
|
175
163
|
*/
|
|
176
164
|
export interface SeamForm {
|
|
177
165
|
readonly seam: readonly SeamCell[];
|
|
178
|
-
readonly divider: readonly SeamCell[];
|
|
179
166
|
}
|
|
180
167
|
/**
|
|
181
168
|
* What a joiner draws at the ends of a run, in one form:
|
|
@@ -201,12 +188,92 @@ export interface JoinCaps {
|
|
|
201
188
|
readonly ascii: CapsForm;
|
|
202
189
|
}
|
|
203
190
|
/**
|
|
204
|
-
* The least ΔE_OK a
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* one cell wide.
|
|
191
|
+
* The least ΔE_OK a join cell's ink must stand off its own ground by to be
|
|
192
|
+
* seen. Below it the eye cannot tell the ink from the ground, so the joiner
|
|
193
|
+
* lifts the ink to it (`standOff`). Twice the ~.02 threshold of a visible
|
|
194
|
+
* difference, because a seam is one cell wide.
|
|
208
195
|
*/
|
|
209
196
|
export declare const SEAM_MIN_DELTA_E = 0.04;
|
|
197
|
+
/** The parts of each neighbour's edge a join cell paints with. */
|
|
198
|
+
interface CellParts {
|
|
199
|
+
readonly left: ReadonlySet<"fg" | "bg">;
|
|
200
|
+
readonly right: ReadonlySet<"fg" | "bg">;
|
|
201
|
+
}
|
|
202
|
+
/** A neighbour a join cell paints with, and its edge as the cell was resolved from it. */
|
|
203
|
+
export interface JoinSide {
|
|
204
|
+
readonly owner: object;
|
|
205
|
+
readonly edge: Style;
|
|
206
|
+
}
|
|
207
|
+
interface Edges {
|
|
208
|
+
readonly left: Style | undefined;
|
|
209
|
+
readonly right: Style | undefined;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Where an effect moved one slot or both of a neighbour's edge cell to, each
|
|
213
|
+
* the spec the depth writes the slot in, a palette slot as that slot:
|
|
214
|
+
* `color` for its text, `bgcolor` for its ground. A slot left unset did not
|
|
215
|
+
* move.
|
|
216
|
+
*/
|
|
217
|
+
export interface EdgeMove {
|
|
218
|
+
readonly color?: ColorSpec;
|
|
219
|
+
readonly bgcolor?: ColorSpec;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A cell a `CellJoiner` drew, as what it is: one function of its two
|
|
223
|
+
* neighbours' edges. It holds the cell's paints, the neighbour each side of
|
|
224
|
+
* them reads, and the edges and render it was resolved from, and it is stamped
|
|
225
|
+
* on the cell as the owner of its innermost anchor level.
|
|
226
|
+
*
|
|
227
|
+
* [LAW:one-source-of-truth] A seam's colours are its neighbours', so nothing
|
|
228
|
+
* paints them but this resolution. An effect paints a strip's items and never
|
|
229
|
+
* a join cell that `follows` them; once the items are painted, each such cell
|
|
230
|
+
* is handed what moved at the item cells beside it and resolved again through
|
|
231
|
+
* `cellStyle`, the path the join was drawn by, lift included
|
|
232
|
+
* (`../renderables/effect.ts`). A seam then follows its neighbours wherever an
|
|
233
|
+
* effect takes them, a mix of the two included, and an effect that paints
|
|
234
|
+
* both one colour leaves the seam's ink lifted off it. A cell painted from
|
|
235
|
+
* roles and the terminal's ground alone, as `plain`'s separator is, follows
|
|
236
|
+
* nobody, and an effect paints it as it paints any cell.
|
|
237
|
+
*/
|
|
238
|
+
export declare class JoinedCell {
|
|
239
|
+
private readonly cell;
|
|
240
|
+
private readonly parts;
|
|
241
|
+
private readonly neighbours;
|
|
242
|
+
private readonly edges;
|
|
243
|
+
private readonly options;
|
|
244
|
+
/** What the cell's paints read on each side: that neighbour and its edge as the cell was resolved from it, or `null` for a side they read nothing of. */
|
|
245
|
+
readonly reads: {
|
|
246
|
+
readonly left: JoinSide | null;
|
|
247
|
+
readonly right: JoinSide | null;
|
|
248
|
+
};
|
|
249
|
+
/** Whether the cell's paints read either neighbour, so it follows them under an effect. */
|
|
250
|
+
readonly follows: boolean;
|
|
251
|
+
/** The cell as drawn from its edges: the one resolution, at join time and after an effect alike. */
|
|
252
|
+
readonly style: Style;
|
|
253
|
+
constructor(cell: JoinCell, parts: CellParts, neighbours: {
|
|
254
|
+
readonly left: object | null;
|
|
255
|
+
readonly right: object | null;
|
|
256
|
+
}, edges: Edges, options: RenderOptions);
|
|
257
|
+
/**
|
|
258
|
+
* The cell resolved again once each side's edge has moved as `moves` says:
|
|
259
|
+
* its `colors`, as `cellStyle` draws them, and `style`, the cell's own, with
|
|
260
|
+
* the record of that stamped where this one was, so an effect drawn over
|
|
261
|
+
* this one moves on from these edges. Resolved, lift included, at `depth`,
|
|
262
|
+
* the depth the effect writes the frame at. None when nothing moved of what
|
|
263
|
+
* the cell paints with: a seam of arrows in two grounds is as it was drawn
|
|
264
|
+
* while an effect moves only the lettering beside it, and its lift is not
|
|
265
|
+
* walked again for a frame that cannot change it.
|
|
266
|
+
*/
|
|
267
|
+
rederived(moves: {
|
|
268
|
+
readonly left?: EdgeMove;
|
|
269
|
+
readonly right?: EdgeMove;
|
|
270
|
+
}, style: Style, depth: ColorDepth): {
|
|
271
|
+
readonly colors: Style;
|
|
272
|
+
readonly style: Style;
|
|
273
|
+
} | undefined;
|
|
274
|
+
}
|
|
275
|
+
/** The record a `CellJoiner` stamped on the cell `anchor` names, or none for a cell no `CellJoiner` drew. */
|
|
276
|
+
export declare function joinedCell(anchor: Anchor | undefined): JoinedCell | undefined;
|
|
210
277
|
/**
|
|
211
278
|
* The one joiner: what it draws is a `JoinSeam` between neighbours and a
|
|
212
279
|
* `JoinCaps` at the ends of each run, picked independently, so a new joiner is
|
|
@@ -215,9 +282,10 @@ export declare const SEAM_MIN_DELTA_E = 0.04;
|
|
|
215
282
|
* Which part a join draws is read off its two neighbours. A neighbour is
|
|
216
283
|
* missing at the strip's ends, and counts as missing — an endpoint — when the
|
|
217
284
|
* seam paints with its ground anywhere and it has none to paint. With both
|
|
218
|
-
* present the join is the seam
|
|
219
|
-
*
|
|
220
|
-
*
|
|
285
|
+
* present the join is the seam; with only the right, the lead; with only the
|
|
286
|
+
* left, the tail; with neither, nothing. Every cell is drawn with its ink held
|
|
287
|
+
* off its ground at `options.colorSystem` (`standOff`), measured per cell, so a
|
|
288
|
+
* seam stepping in thirds shows every step however close its grounds. A cap
|
|
221
289
|
* that paints with its neighbour's ground is drawn only beside a neighbour
|
|
222
290
|
* with one, so caps that need grounds never stop a seam that needs none.
|
|
223
291
|
*
|
|
@@ -311,3 +379,4 @@ export declare function joinerNamed(spec: JoinerSpec): CellJoiner;
|
|
|
311
379
|
* draws the caps the ramp is ended in.
|
|
312
380
|
*/
|
|
313
381
|
export declare function gradientSeam(steps?: number): JoinSeam;
|
|
382
|
+
export {};
|