@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
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Effected — a renderable whose finished cells' colours
|
|
3
|
-
* effect at a moment `t`.
|
|
2
|
+
* Effected — a renderable whose finished cells' looks — colours and text
|
|
3
|
+
* attributes — pass through an effect at a moment `t`.
|
|
4
4
|
*
|
|
5
5
|
* An effect is, for what an element draws in a frame, an `Animation`
|
|
6
6
|
* (`core/animation.ts`) of what is done to its cells: its value at `t` is a
|
|
7
|
-
* function from a cell's
|
|
8
|
-
*
|
|
7
|
+
* function from a cell's look and where the cell is to the cell's new look
|
|
8
|
+
* (`EffectFrame`), and it says when that next changes as every
|
|
9
9
|
* animation does. Whatever holds for the whole frame is worked out once, in
|
|
10
10
|
* the effect and its `at(t)`, and every cell of the frame is handed to the
|
|
11
|
-
* function `at(t)` returns, but for those a wrapper keeps back
|
|
11
|
+
* function `at(t)` returns, but for those a wrapper keeps back — `confined`
|
|
12
12
|
* hands over only the cells its owners drew, so an effect never counts on
|
|
13
|
-
* seeing them all
|
|
13
|
+
* seeing them all — and for a strip's join cells painted from the items beside
|
|
14
|
+
* them, which are no one's to paint: a seam's colours are its neighbours'
|
|
15
|
+
* edges, so once the effect has painted every other cell, each such cell is
|
|
16
|
+
* resolved again from the cells beside it as the effect left them
|
|
17
|
+
* (`JoinedCell`, `../core/strip.ts`), the way the joiner drew it. Shimmer,
|
|
18
|
+
* pulse, fade, dissolve and a blinking attribute are all this one shape,
|
|
14
19
|
* differing by what the function does with its inputs
|
|
15
|
-
* [LAW:one-type-per-behavior]; two effects stack by nesting one
|
|
16
|
-
* another, which is the same as calling one after the other but
|
|
17
|
-
* outer one measures: the inner one's output.
|
|
20
|
+
* [LAW:one-type-per-behavior]; two effects stack by nesting one
|
|
21
|
+
* wrapper in another, which is the same as calling one after the other but
|
|
22
|
+
* for what the outer one measures: the inner one's output.
|
|
23
|
+
*
|
|
24
|
+
* A cell's look is one value, its colours and its attributes together
|
|
25
|
+
* (`CellLook`), rather than an attribute stage beside the colour one, so
|
|
26
|
+
* everything that takes an `Effect` — `confined`, `onBeat`,
|
|
27
|
+
* `Animation.all`, nesting over a glyph effect — takes one that moves
|
|
28
|
+
* attributes with no second copy of itself. `reverse` is the one attribute
|
|
29
|
+
* a look leaves out (`CellAttributes`): it decides which of a style's slots
|
|
30
|
+
* a colour on screen is in, and a swap of the two is already a colour move.
|
|
18
31
|
*
|
|
19
32
|
* What the element draws (`Drawn`) — the cells the effect will be handed,
|
|
20
33
|
* and the colours of its words — is measured here, in the render, off the
|
|
@@ -23,10 +36,12 @@
|
|
|
23
36
|
* against (`onColors`, `./effects.ts`), so no caller derives it a second time
|
|
24
37
|
* from a render of its own.
|
|
25
38
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* the
|
|
29
|
-
*
|
|
39
|
+
* An `Effected` is the element under its effect over time: an
|
|
40
|
+
* `Animation<Renderable>`, placed wherever a renderable goes and drawn at
|
|
41
|
+
* the time of the frame it is drawn in. Its value at `t` is the element
|
|
42
|
+
* through the effect at `t` (`Recolored`). [LAW:no-ambient-temporal-coupling]
|
|
43
|
+
* The time is the frame's, never a clock read, so the same time always draws
|
|
44
|
+
* the same bytes, at 30 frames a second or one every two seconds.
|
|
30
45
|
*
|
|
31
46
|
* What an effect may not do is the contract this module holds:
|
|
32
47
|
*
|
|
@@ -36,26 +51,30 @@
|
|
|
36
51
|
* segment's link and meta and carries its anchor shifted to the run's first
|
|
37
52
|
* cell (`Style.shiftedBy`), so hit testing still finds the owner.
|
|
38
53
|
* - A cell whose colours come back unchanged keeps its original `ColorSpec`,
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* the
|
|
54
|
+
* one whose attributes come back as its style set them keeps them, and a
|
|
55
|
+
* segment whose every cell is unchanged is yielded with its look as
|
|
56
|
+
* it was, so the identity effect is byte-identical; what an `Effected` gains is when
|
|
57
|
+
* the frame next changes (`Style.hold`), which writes no byte.
|
|
42
58
|
* Neighbouring cells the output depth
|
|
43
59
|
* writes alike stay one segment: a segment is cut only where the written
|
|
44
|
-
* colours change, so two colours that land on one index
|
|
60
|
+
* colours or the attributes change, so two colours that land on one index
|
|
61
|
+
* are one run.
|
|
45
62
|
* - New colours are built with `ColorSpec.fromRgba`, never parsed from a
|
|
46
63
|
* string, so no frame adds an entry to a parse cache.
|
|
47
|
-
* - With no colour output (`colorSystem: null`)
|
|
48
|
-
*
|
|
64
|
+
* - With no colour output (`colorSystem: null`) no style is written at all,
|
|
65
|
+
* attributes included, so there is nothing for an effect to change, and
|
|
66
|
+
* the child's segments pass through untouched.
|
|
49
67
|
*
|
|
50
68
|
* Positions are the child's own: row and column count from the top-left of
|
|
51
69
|
* what the child drew, so a sweep crosses the element, not the screen.
|
|
52
70
|
*/
|
|
53
71
|
import { type Anchor } from "../core/anchor.js";
|
|
54
72
|
import { Animation } from "../core/animation.js";
|
|
73
|
+
import type { Hold } from "../core/style.js";
|
|
55
74
|
import { ColorDepth, type ColorRgba, type TerminalTheme } from "../core/color.js";
|
|
56
|
-
import type {
|
|
57
|
-
import type { Composite, Measurable, Renderable, RenderOptions } from "../core/protocol.js";
|
|
75
|
+
import type { Measurable, Renderable, RenderOptions } from "../core/protocol.js";
|
|
58
76
|
import { Segment } from "../core/segment.js";
|
|
77
|
+
import { type Attributes } from "../core/style.js";
|
|
59
78
|
/**
|
|
60
79
|
* A cell's foreground and background as they appear on screen — the glyph's
|
|
61
80
|
* colour and the colour behind it — which are the colours an effect moves.
|
|
@@ -65,6 +84,16 @@ export interface CellColors {
|
|
|
65
84
|
readonly fg: ColorRgba;
|
|
66
85
|
readonly bg: ColorRgba;
|
|
67
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The text attributes an effect moves: every one a style sets but
|
|
89
|
+
* `reverse`, each on, off or unset as the cell's style has it. An unset
|
|
90
|
+
* one lets a style laid beneath show through, as it does undrawn.
|
|
91
|
+
*/
|
|
92
|
+
export type CellAttributes = Omit<Attributes, "reverse">;
|
|
93
|
+
/** What an effect moves in a cell: its colours as the screen shows them, and its attributes. */
|
|
94
|
+
export interface CellLook extends CellColors {
|
|
95
|
+
readonly attributes: CellAttributes;
|
|
96
|
+
}
|
|
68
97
|
/**
|
|
69
98
|
* Where a cell is in the output of the renderable an effect wraps, its seed:
|
|
70
99
|
* a number in [0, 1) that is the same for that cell on every frame, for an
|
|
@@ -125,9 +154,12 @@ export interface Drawn {
|
|
|
125
154
|
* sits and who drew it, listed before the effect is handed any: what
|
|
126
155
|
* an effect spread over the element — a transition, which has its last cell
|
|
127
156
|
* settle as it ends — is spread over. A blank cell on the terminal's ground
|
|
128
|
-
* that draws no line is handed but not listed, since nothing in it shows
|
|
129
|
-
*
|
|
130
|
-
*
|
|
157
|
+
* that draws no line is handed but not listed, since nothing in it shows,
|
|
158
|
+
* and a strip's join cell painted from the items beside it is listed but
|
|
159
|
+
* never handed its own look, since it follows them: it is handed only a
|
|
160
|
+
* neighbour's edge the frame does not show, to be painted where the seam
|
|
161
|
+
* shows it. `confined` narrows it to the cells its owners drew. A call, so a
|
|
162
|
+
* frame whose effect does not ask lists none.
|
|
131
163
|
*/
|
|
132
164
|
cells(): readonly Placed[];
|
|
133
165
|
/** Every distinct ink and ground of a word cell. */
|
|
@@ -141,8 +173,8 @@ export interface Drawn {
|
|
|
141
173
|
/** The terminal the frame is drawn on. */
|
|
142
174
|
readonly theme: TerminalTheme;
|
|
143
175
|
}
|
|
144
|
-
/** What an effect does to the cells of one frame: each cell's
|
|
145
|
-
export type EffectFrame = (
|
|
176
|
+
/** What an effect does to the cells of one frame: each cell's look and where it is in, its look out. Return `look` to leave a cell be. */
|
|
177
|
+
export type EffectFrame = (look: CellLook, cell: EffectCell) => CellLook;
|
|
146
178
|
/**
|
|
147
179
|
* For an element drawing `drawn`, the animation of what is done to its cells.
|
|
148
180
|
* [LAW:types-are-the-program] Per-frame work is `at(t)`, so it runs once a
|
|
@@ -159,8 +191,6 @@ export type EffectFrame = (colors: CellColors, cell: EffectCell) => CellColors;
|
|
|
159
191
|
*/
|
|
160
192
|
export type Effect = (drawn: Drawn) => Animation<EffectFrame>;
|
|
161
193
|
export interface EffectedOptions {
|
|
162
|
-
/** The moment to draw, in seconds. */
|
|
163
|
-
readonly t: number;
|
|
164
194
|
/**
|
|
165
195
|
* Names the element for its seeds, so two elements showing the same text do
|
|
166
196
|
* not twinkle in lockstep. The same key gives the same seeds on every frame.
|
|
@@ -173,17 +203,77 @@ export interface EffectedOptions {
|
|
|
173
203
|
*/
|
|
174
204
|
readonly theme: TerminalTheme;
|
|
175
205
|
}
|
|
176
|
-
|
|
206
|
+
/** A frame an effect drew at a moment, and the hold the effect says it is in there. */
|
|
207
|
+
export interface Moved {
|
|
208
|
+
readonly segments: Iterable<Segment>;
|
|
209
|
+
readonly hold: Hold;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* An `Effected` at `t`, or an element through an effect at a time an
|
|
213
|
+
* animation's `at` was handed — a lifecycle's time since it entered: `renderable`
|
|
214
|
+
* with its cells' looks passed through `effect` at `t`, saying nothing of
|
|
215
|
+
* when that changes, since whatever placed the animation stamps its hold.
|
|
216
|
+
* [LAW:one-type-per-behavior]
|
|
217
|
+
*/
|
|
218
|
+
export declare class Recolored implements Renderable, Measurable {
|
|
177
219
|
readonly renderable: Renderable;
|
|
178
220
|
readonly effect: Effect;
|
|
179
221
|
readonly t: number;
|
|
180
222
|
readonly key: string;
|
|
181
223
|
readonly theme: TerminalTheme;
|
|
182
|
-
constructor(renderable: Renderable, effect: Effect, options: EffectedOptions
|
|
224
|
+
constructor(renderable: Renderable, effect: Effect, options: EffectedOptions & {
|
|
225
|
+
readonly t: number;
|
|
226
|
+
});
|
|
183
227
|
render(options: RenderOptions): Iterable<Segment>;
|
|
184
|
-
|
|
185
|
-
|
|
228
|
+
/** The frame the effect draws at `t`, and the hold it says that is in. */
|
|
229
|
+
moved(options: RenderOptions): Moved;
|
|
186
230
|
private _recolored;
|
|
231
|
+
/** `segment`'s cells drawn in the looks the effect painted them. */
|
|
232
|
+
private _repainted;
|
|
233
|
+
/**
|
|
234
|
+
* A join cell's `segment` resolved again from the edges beside it, as the
|
|
235
|
+
* effect left them: each neighbour's nearest cell to the join on its row,
|
|
236
|
+
* its slots as the depth writes them. A side whose neighbour the effect moved
|
|
237
|
+
* nothing of keeps the edge the cell was drawn from, so with neither moved
|
|
238
|
+
* the cell is as it was drawn.
|
|
239
|
+
*/
|
|
240
|
+
private _rejoined;
|
|
241
|
+
measure(options: RenderOptions): {
|
|
242
|
+
minimum: number;
|
|
243
|
+
maximum: number;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* The specs that draw a cell's slot colours `to` where the segment drew
|
|
247
|
+
* `from` with `wire`: each moved slot in the spec `movedSpecs` writes it
|
|
248
|
+
* in, the rest as `wire` wrote them.
|
|
249
|
+
*/
|
|
250
|
+
private respec;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* `renderable` under `effect` over time: an `Animation<Renderable>` whose
|
|
254
|
+
* value at `t` is the element through the effect at `t`, placed wherever a
|
|
255
|
+
* renderable goes. Its own answer to when it changes is `t`, at every time:
|
|
256
|
+
* an `Effect` is made from what the element draws, so with nothing drawn
|
|
257
|
+
* nothing can say more — early, never false. Placed, it says exactly: its
|
|
258
|
+
* cells carry the effect's own hold at the frame's time and the output's
|
|
259
|
+
* depth (`stampFrame`), under whatever the element already said, so at a
|
|
260
|
+
* depth that shows no motion a loop says it never changes there and the
|
|
261
|
+
* host sleeps.
|
|
262
|
+
*/
|
|
263
|
+
export declare class Effected implements Animation<Renderable> {
|
|
264
|
+
readonly renderable: Renderable;
|
|
265
|
+
readonly effect: Effect;
|
|
266
|
+
readonly key: string;
|
|
267
|
+
readonly theme: TerminalTheme;
|
|
268
|
+
constructor(renderable: Renderable, effect: Effect, options: EffectedOptions);
|
|
269
|
+
/** The element through the effect at `t`, unstamped. */
|
|
270
|
+
at(t: number): Recolored;
|
|
271
|
+
nextChange(t: number): number;
|
|
272
|
+
lastChange(t: number): number;
|
|
273
|
+
/** The element under the effect with its motion taken out. */
|
|
274
|
+
reduced(): Effected;
|
|
275
|
+
/** Drawn at the frame's time, its cells stamped with the effect's exact hold there. */
|
|
276
|
+
render(options: RenderOptions): Iterable<Segment>;
|
|
187
277
|
measure(options: RenderOptions): {
|
|
188
278
|
minimum: number;
|
|
189
279
|
maximum: number;
|
|
@@ -196,42 +286,41 @@ export declare class Effected implements Renderable, Measurable, Composite {
|
|
|
196
286
|
* moved slot is written with.
|
|
197
287
|
*/
|
|
198
288
|
static shows(pair: Pair, to: CellColors, depth: ColorDepth, theme: TerminalTheme): CellColors;
|
|
199
|
-
/**
|
|
200
|
-
* The specs that draw a cell's slot colours `to` where the segment drew
|
|
201
|
-
* `from` with `wire`: each moved slot in the spec `movedSpecs` writes it
|
|
202
|
-
* in, the rest as `wire` wrote them.
|
|
203
|
-
*/
|
|
204
|
-
private respec;
|
|
205
|
-
/** A cell's seed: FNV-1a of the key and the position, scaled into [0, 1). */
|
|
206
|
-
private seed;
|
|
207
289
|
}
|
|
208
290
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
291
|
+
* A cell's seed: FNV-1a of the element's key and the cell's position, scaled
|
|
292
|
+
* into [0, 1). [LAW:one-source-of-truth] One rule for a colour effect's seeds
|
|
293
|
+
* and a glyph effect's, so one element under both twinkles from one seed.
|
|
294
|
+
*/
|
|
295
|
+
export declare function cellSeed(key: string, row: number, col: number): number;
|
|
296
|
+
/** A glyph of a segment, placed where its cell is drawn — or none for a newline, which is no cell. */
|
|
297
|
+
export interface WalkedGlyph {
|
|
298
|
+
readonly glyph: string;
|
|
299
|
+
readonly cell: Placed | undefined;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Each glyph of each of `segments`, where its cell sits: rows and columns
|
|
303
|
+
* from the top-left of the output, a wide glyph one cell at its first
|
|
304
|
+
* column, and its anchor shifted to that column as `Style.shiftedBy` shifts
|
|
305
|
+
* a run's. A control segment draws nothing and has none.
|
|
306
|
+
* [LAW:one-source-of-truth] The one walk: what `Drawn.cells` lists, what the
|
|
307
|
+
* render hands a colour effect, and what a glyph effect (`./glyph-effect.ts`)
|
|
308
|
+
* is handed are all read off it.
|
|
309
|
+
*/
|
|
310
|
+
export declare function walkGlyphs(segments: readonly Segment[]): (readonly WalkedGlyph[])[];
|
|
311
|
+
/**
|
|
312
|
+
* Whether `text` draws ink: anything but blanks. [LAW:one-source-of-truth]
|
|
313
|
+
* The one test, so the words a colour effect lights are the words a glyph
|
|
314
|
+
* effect (`./glyph-effects.ts`) scrambles and its particles pass behind.
|
|
225
315
|
*/
|
|
226
|
-
export declare function
|
|
316
|
+
export declare function inked(text: string): boolean;
|
|
227
317
|
/**
|
|
228
|
-
* `effect` on the
|
|
229
|
-
* nested in its output, and every other
|
|
318
|
+
* `effect` on the cells any of `owners` drew, itself or through an owner
|
|
319
|
+
* nested in its output, and every other cell left as it is: one item of a
|
|
230
320
|
* strip whose items share a fill, the items of a row one other item stands
|
|
231
|
-
* apart from, one widget of a screen. A
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* `../core/strip.ts`). A cell none of them drew is never handed to the
|
|
321
|
+
* apart from, one widget of a screen. A strip's join cell is no item's, so it
|
|
322
|
+
* is never handed; one painted from the items beside it follows them, the
|
|
323
|
+
* moved ones included (`Recolored`). A cell none of them drew is never handed to the
|
|
235
324
|
* effect, so confining one effect to many owners costs one call a cell, not
|
|
236
325
|
* one for each owner.
|
|
237
326
|
*/
|
|
@@ -242,3 +331,9 @@ export declare function confined(effect: Effect, ...owners: readonly object[]):
|
|
|
242
331
|
* output under an effect to read the contrast its words are left at.
|
|
243
332
|
*/
|
|
244
333
|
export declare function drawnOf(segments: Iterable<Segment>, depth: ColorDepth, theme: TerminalTheme): Drawn;
|
|
334
|
+
/**
|
|
335
|
+
* The attributes a look carries, read off anything that sets them — a
|
|
336
|
+
* `Style`, or a look a frame returned with more on it than `CellAttributes`
|
|
337
|
+
* names. [LAW:one-source-of-truth] The one place `reverse` is left out.
|
|
338
|
+
*/
|
|
339
|
+
export declare function cellAttributes(of: CellAttributes): CellAttributes;
|