@promptctl/rich-js 0.28.0 → 0.29.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 (162) hide show
  1. package/README.md +7 -7
  2. package/dist/core/animation.d.ts +37 -37
  3. package/dist/core/animation.js +61 -61
  4. package/dist/core/ansi.d.ts +4 -4
  5. package/dist/core/ansi.js +9 -9
  6. package/dist/core/bidi.js +6 -6
  7. package/dist/core/cells.d.ts +1 -1
  8. package/dist/core/cells.js +5 -5
  9. package/dist/core/clock.d.ts +1 -1
  10. package/dist/core/color.d.ts +50 -50
  11. package/dist/core/color.js +69 -69
  12. package/dist/core/console.d.ts +8 -8
  13. package/dist/core/console.js +5 -5
  14. package/dist/core/control-codes.d.ts +3 -3
  15. package/dist/core/control-codes.js +7 -7
  16. package/dist/core/easing.d.ts +40 -40
  17. package/dist/core/easing.js +40 -40
  18. package/dist/core/env.d.ts +1 -1
  19. package/dist/core/env.js +1 -1
  20. package/dist/core/export-html.js +1 -1
  21. package/dist/core/export-lines.d.ts +11 -11
  22. package/dist/core/export-lines.js +12 -12
  23. package/dist/core/export-svg.d.ts +3 -3
  24. package/dist/core/export-svg.js +4 -4
  25. package/dist/core/markup.js +1 -1
  26. package/dist/core/memo.d.ts +1 -1
  27. package/dist/core/memo.js +1 -1
  28. package/dist/core/oklch.d.ts +14 -14
  29. package/dist/core/oklch.js +10 -10
  30. package/dist/core/orient.d.ts +3 -3
  31. package/dist/core/orient.js +3 -3
  32. package/dist/core/paint.d.ts +9 -9
  33. package/dist/core/paint.js +3 -3
  34. package/dist/core/pretty.d.ts +1 -1
  35. package/dist/core/pretty.js +3 -3
  36. package/dist/core/protocol.d.ts +26 -26
  37. package/dist/core/protocol.js +22 -22
  38. package/dist/core/render.d.ts +11 -11
  39. package/dist/core/render.js +12 -12
  40. package/dist/core/segment.d.ts +3 -3
  41. package/dist/core/segment.js +5 -5
  42. package/dist/core/strip.d.ts +83 -83
  43. package/dist/core/strip.js +70 -70
  44. package/dist/core/style.d.ts +20 -20
  45. package/dist/core/style.js +55 -55
  46. package/dist/core/text.d.ts +2 -2
  47. package/dist/core/text.js +5 -5
  48. package/dist/core/timeline.d.ts +5 -5
  49. package/dist/core/timeline.js +9 -9
  50. package/dist/core/tween.d.ts +6 -6
  51. package/dist/core/tween.js +10 -10
  52. package/dist/core/view.d.ts +4 -4
  53. package/dist/core/view.js +12 -12
  54. package/dist/host/app.d.ts +9 -9
  55. package/dist/host/app.js +12 -12
  56. package/dist/host/host-environment.d.ts +2 -2
  57. package/dist/host/host-environment.js +2 -2
  58. package/dist/host/index.d.ts +2 -2
  59. package/dist/host/input.d.ts +7 -7
  60. package/dist/host/input.js +4 -4
  61. package/dist/host/terminal-colors.d.ts +2 -2
  62. package/dist/host/terminal-colors.js +4 -4
  63. package/dist/host/terminal-host.d.ts +2 -2
  64. package/dist/host/terminal-host.js +1 -1
  65. package/dist/index.d.ts +14 -14
  66. package/dist/index.js +10 -10
  67. package/dist/node/prompt.d.ts +1 -1
  68. package/dist/node/prompt.js +1 -1
  69. package/dist/node/terminal-host.d.ts +1 -1
  70. package/dist/node/traceback.js +2 -2
  71. package/dist/renderables/change.js +2 -2
  72. package/dist/renderables/effect.d.ts +39 -39
  73. package/dist/renderables/effect.js +45 -45
  74. package/dist/renderables/effects.d.ts +81 -81
  75. package/dist/renderables/effects.js +157 -157
  76. package/dist/renderables/embed.d.ts +1 -1
  77. package/dist/renderables/embed.js +2 -2
  78. package/dist/renderables/flexStrip.d.ts +7 -7
  79. package/dist/renderables/flexStrip.js +15 -15
  80. package/dist/renderables/frames.d.ts +6 -6
  81. package/dist/renderables/frames.js +11 -11
  82. package/dist/renderables/glyph-effect.d.ts +15 -15
  83. package/dist/renderables/glyph-effect.js +17 -17
  84. package/dist/renderables/glyph-effects.d.ts +7 -7
  85. package/dist/renderables/glyph-effects.js +16 -16
  86. package/dist/renderables/html-entities.d.ts +1 -1
  87. package/dist/renderables/html-entities.js +1 -1
  88. package/dist/renderables/lifecycle.d.ts +4 -4
  89. package/dist/renderables/lifecycle.js +12 -12
  90. package/dist/renderables/live.d.ts +2 -2
  91. package/dist/renderables/live.js +7 -7
  92. package/dist/renderables/markdown-parse.js +3 -3
  93. package/dist/renderables/panel.js +3 -3
  94. package/dist/renderables/progress.d.ts +1 -1
  95. package/dist/renderables/progress.js +1 -1
  96. package/dist/renderables/progressBar.d.ts +1 -1
  97. package/dist/renderables/progressBar.js +6 -6
  98. package/dist/renderables/prompt.d.ts +1 -1
  99. package/dist/renderables/scroll.d.ts +1 -1
  100. package/dist/renderables/scroll.js +3 -3
  101. package/dist/renderables/spinner.d.ts +4 -4
  102. package/dist/renderables/spinner.js +10 -10
  103. package/dist/renderables/syntax.d.ts +2 -2
  104. package/dist/renderables/syntax.js +2 -2
  105. package/dist/renderables/table.js +3 -3
  106. package/dist/renderables/traceback.d.ts +1 -1
  107. package/dist/renderables/traceback.js +1 -1
  108. package/dist/renderables/tree.js +3 -3
  109. package/dist/template-bindings/animation-funcs.d.ts +14 -14
  110. package/dist/template-bindings/animation-funcs.js +27 -27
  111. package/dist/template-bindings/color-funcs.d.ts +14 -14
  112. package/dist/template-bindings/color-funcs.js +25 -25
  113. package/dist/template-bindings/index.d.ts +9 -9
  114. package/dist/template-bindings/index.js +9 -9
  115. package/dist/template-bindings/palette-funcs.d.ts +1 -1
  116. package/dist/template-bindings/palette-funcs.js +3 -3
  117. package/dist/template-bindings/style-funcs.d.ts +5 -5
  118. package/dist/template-bindings/style-funcs.js +16 -16
  119. package/dist/themes/{transpose.d.ts → adjust.d.ts} +23 -23
  120. package/dist/themes/{transpose.js → adjust.js} +28 -28
  121. package/dist/themes/buildPalette.d.ts +3 -3
  122. package/dist/themes/buildPalette.js +20 -20
  123. package/dist/themes/colorMath.d.ts +16 -16
  124. package/dist/themes/colorMath.js +32 -32
  125. package/dist/themes/data/ansi-tables.d.ts +2 -2
  126. package/dist/themes/data/ansi-tables.js +2 -2
  127. package/dist/themes/data/types.d.ts +4 -4
  128. package/dist/themes/data/types.js +2 -2
  129. package/dist/themes/palette.d.ts +12 -12
  130. package/dist/themes/palette.js +16 -16
  131. package/dist/themes/ramp.d.ts +17 -17
  132. package/dist/themes/ramp.js +12 -12
  133. package/dist/themes/registry.js +4 -4
  134. package/dist/themes/terminalThemes.d.ts +1 -1
  135. package/dist/themes/terminalThemes.js +1 -1
  136. package/dist/widgets/button.d.ts +2 -2
  137. package/dist/widgets/button.js +4 -4
  138. package/dist/widgets/checkbox.d.ts +2 -2
  139. package/dist/widgets/checkbox.js +2 -2
  140. package/dist/widgets/dropdown.d.ts +2 -2
  141. package/dist/widgets/dropdown.js +3 -3
  142. package/dist/widgets/event-router.d.ts +6 -6
  143. package/dist/widgets/event-router.js +2 -2
  144. package/dist/widgets/focus-manager.d.ts +3 -3
  145. package/dist/widgets/focus-manager.js +3 -3
  146. package/dist/widgets/index.d.ts +2 -2
  147. package/dist/widgets/index.js +1 -1
  148. package/dist/widgets/ink.d.ts +3 -3
  149. package/dist/widgets/ink.js +4 -4
  150. package/dist/widgets/slider.d.ts +2 -2
  151. package/dist/widgets/static-item.d.ts +2 -2
  152. package/dist/widgets/text-input.d.ts +2 -2
  153. package/dist/widgets/text-input.js +5 -5
  154. package/dist/widgets/themed-widget.js +1 -1
  155. package/dist/widgets/toggle.d.ts +3 -3
  156. package/dist/widgets/toggle.js +3 -3
  157. package/dist/widgets/types.d.ts +6 -6
  158. package/dist/widgets/types.js +2 -2
  159. package/dist/widgets/widget-app.d.ts +10 -10
  160. package/dist/widgets/widget-app.js +8 -8
  161. package/dist/widgets/widget-base.d.ts +2 -2
  162. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Effected — a renderable whose finished cells' looks — colours and text
2
+ * Effected — a renderable whose finished cells' looks — colors and text
3
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`
@@ -11,7 +11,7 @@
11
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
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'
14
+ * them, which are no one's to paint: a seam's colors are its neighbours'
15
15
  * edges, so once the effect has painted every other cell, each such cell is
16
16
  * resolved again from the cells beside it as the effect left them
17
17
  * (`JoinedCell`, `../core/strip.ts`), the way the joiner drew it. Shimmer,
@@ -22,16 +22,16 @@
22
22
  * a cell by what the element drew (`EffectCell.pair`), or by nesting one
23
23
  * wrapper in another, which measures the inner one's output instead.
24
24
  *
25
- * A cell's look is one value, its colours and its attributes together
26
- * (`CellLook`), rather than an attribute stage beside the colour one, so
27
- * everything that takes an `Effect` — `confined`, `onBeat`,
25
+ * A cell's look is one value, its colors and its attributes together
26
+ * (`CellLook`), rather than an attribute stage beside the color one, so
27
+ * everything that takes an `Effect` — `confined`, `sampleAndHold`,
28
28
  * `Animation.all`, nesting over a glyph effect — takes one that moves
29
29
  * attributes with no second copy of itself. `reverse` is the one attribute
30
30
  * a look leaves out (`CellAttributes`): it decides which of a style's slots
31
- * a colour on screen is in, and a swap of the two is already a colour move.
31
+ * a color on screen is in, and a swap of the two is already a color move.
32
32
  *
33
33
  * What the element draws (`Drawn`) — the cells the effect will be handed,
34
- * and the colours of its words — is measured here, in the render, off the
34
+ * and the colors of its words — is measured here, in the render, off the
35
35
  * same reading of each segment its cells are drawn from, and handed to the
36
36
  * effect once a frame. It is what an effect keeping words legible is settled
37
37
  * against (`onColors`, `./effects.ts`), so no caller derives it a second time
@@ -51,18 +51,18 @@
51
51
  * to the effect and is never cut, and a run cut out of a segment keeps that
52
52
  * segment's link and meta and carries its anchor shifted to the run's first
53
53
  * cell (`Style.shiftedBy`), so hit testing still finds the owner.
54
- * - A cell whose colours come back unchanged keeps its original `ColorSpec`,
54
+ * - A cell whose colors come back unchanged keeps its original `ColorSpec`,
55
55
  * one whose attributes come back as its style set them keeps them, and a
56
56
  * segment whose every cell is unchanged is yielded with its look as
57
57
  * it was, so the identity effect is byte-identical; what an `Effected` gains is when
58
58
  * the frame next changes (`Style.hold`), which writes no byte.
59
59
  * Neighbouring cells the output depth
60
60
  * writes alike stay one segment: a segment is cut only where the written
61
- * colours or the attributes change, so two colours that land on one index
61
+ * colors or the attributes change, so two colors that land on one index
62
62
  * are one run.
63
- * - New colours are built with `ColorSpec.fromRgba`, never parsed from a
63
+ * - New colors are built with `ColorSpec.fromRgba`, never parsed from a
64
64
  * string, so no frame adds an entry to a parse cache.
65
- * - With no colour output (`colorSystem: null`) no style is written at all,
65
+ * - With no color output (`colorSystem: null`) no style is written at all,
66
66
  * attributes included, so there is nothing for an effect to change, and
67
67
  * the child's segments pass through untouched.
68
68
  *
@@ -70,15 +70,15 @@
70
70
  * what the child drew, so a sweep crosses the element, not the screen.
71
71
  */
72
72
  import { type Anchor } from "../core/anchor.js";
73
- import { Animation, type Moves, type Shown } from "../core/animation.js";
73
+ import { Animation, type Reads, type Shown } from "../core/animation.js";
74
74
  import { ColorDepth, type ColorRgba, type TerminalColors } from "../core/color.js";
75
75
  import type { Measurable, Renderable, RenderOptions } from "../core/protocol.js";
76
76
  import { Segment } from "../core/segment.js";
77
- import { type Attributes, type Hold } from "../core/style.js";
77
+ import { type Attributes, type ValidityInterval } from "../core/style.js";
78
78
  /**
79
79
  * A cell's foreground and background as they appear on screen — the glyph's
80
- * colour and the colour behind it — which are the colours an effect moves.
81
- * Under `reverse` they are the style's two colours swapped.
80
+ * color and the color behind it — which are the colors an effect moves.
81
+ * Under `reverse` they are the style's two colors swapped.
82
82
  */
83
83
  export interface CellColors {
84
84
  readonly fg: ColorRgba;
@@ -90,7 +90,7 @@ export interface CellColors {
90
90
  * one lets a style laid beneath show through, as it does undrawn.
91
91
  */
92
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. */
93
+ /** What an effect moves in a cell: its colors as the screen shows them, and its attributes. */
94
94
  export interface CellLook extends CellColors {
95
95
  readonly attributes: CellAttributes;
96
96
  }
@@ -107,27 +107,27 @@ export interface EffectCell {
107
107
  /**
108
108
  * The ink and ground the element drew the cell in: what the cell is, where
109
109
  * the `CellLook` beside it is what is there now. Under one effect they are
110
- * the same colours; under `layered` (`./effects.ts`) the look is what the
110
+ * the same colors; under `layered` (`./effects.ts`) the look is what the
111
111
  * layers beneath left, so an effect recognises a cell by its pair and moves
112
112
  * its look. [LAW:one-source-of-truth] A pair's `terminal` is what tells a
113
- * colour the terminal resolved from one the element wrote at the same hex.
113
+ * color the terminal resolved from one the element wrote at the same hex.
114
114
  */
115
115
  readonly pair: Pair;
116
116
  /**
117
117
  * Who drew the cell, and where it sits in their output, as
118
118
  * `Segment.anchorAt` reads it off a frame: what tells one owner's cells
119
- * from another's when their colours are alike (`confined`).
119
+ * from another's when their colors are alike (`confined`).
120
120
  */
121
121
  readonly anchor: Anchor | undefined;
122
122
  /** The drawing of a box the cell is the frame of (`Style.boxFrame`), or none. */
123
123
  readonly boxFrame: object | undefined;
124
124
  }
125
- /** Where a cell sits and who drew it: an `EffectCell` before it has a seed or colours. */
125
+ /** Where a cell sits and who drew it: an `EffectCell` before it has a seed or colors. */
126
126
  export type Placed = Pick<EffectCell, "row" | "col" | "anchor" | "boxFrame">;
127
127
  /**
128
128
  * A cell as `Drawn.all` lists it: where it sits and who drew it, the
129
129
  * columns its glyph takes, its ink and ground as the screen shows them, and
130
- * whether a strip's joiner drew it — a seam, no item's, whose colours are its
130
+ * whether a strip's joiner drew it — a seam, no item's, whose colors are its
131
131
  * neighbours' edges. Each is read off the one look and the one walk the cell
132
132
  * is later handed with, so an effect that groups cells into the runs they
133
133
  * are drawn in — `wheel`'s segments — reads what the frame hands, never a
@@ -145,9 +145,9 @@ export interface ListedCell extends Placed {
145
145
  */
146
146
  export interface Pair extends CellColors {
147
147
  /**
148
- * Whether the glyph's colour and the colour behind it, as the screen shows
148
+ * Whether the glyph's color and the color behind it, as the screen shows
149
149
  * them, are the terminal's own: a slot the element's style leaves unset or
150
- * sets to `default`. Such a colour is resolved through the terminal, so its
150
+ * sets to `default`. Such a color is resolved through the terminal, so its
151
151
  * hex can equal one the element wrote; this is what tells them apart.
152
152
  */
153
153
  readonly terminal: {
@@ -156,7 +156,7 @@ export interface Pair extends CellColors {
156
156
  };
157
157
  /**
158
158
  * Whether the ink is written in the style's ground slot and the ground in
159
- * its ink slot. Below truecolor the slot decides what a moved colour can
159
+ * its ink slot. Below truecolor the slot decides what a moved color can
160
160
  * land on: a slot set to `default` draws the terminal's foreground in one
161
161
  * and its background in the other.
162
162
  */
@@ -164,7 +164,7 @@ export interface Pair extends CellColors {
164
164
  }
165
165
  /**
166
166
  * What the element an effect wraps draws in one frame: the cells the effect
167
- * is handed, and the colours the element draws its words in, as the screen
167
+ * is handed, and the colors the element draws its words in, as the screen
168
168
  * shows them — what an effect that must keep the words legible is measured
169
169
  * against. A word cell is one whose glyph is not blank and that a strip's
170
170
  * joiner did not draw (`JOIN`): a seam's ink is the fill beside it, not words.
@@ -195,11 +195,11 @@ export interface Drawn {
195
195
  cells(): readonly ListedCell[];
196
196
  /** Every distinct ink and ground of a word cell. */
197
197
  readonly pairs: readonly Pair[];
198
- /** The colours the element sets itself in its word cells, by hex: never the terminal's, whatever its hex. */
198
+ /** The colors the element sets itself in its word cells, by hex: never the terminal's, whatever its hex. */
199
199
  readonly colors: ReadonlySet<string>;
200
200
  /** Of `colors`, the ones a word cell has for its ground. */
201
201
  readonly fills: ReadonlySet<string>;
202
- /** The depth the frame is written at: below truecolor a moved colour lands on a palette colour. */
202
+ /** The depth the frame is written at: below truecolor a moved color lands on a palette color. */
203
203
  readonly depth: ColorDepth;
204
204
  /** The terminal the frame is drawn on. */
205
205
  readonly terminal: TerminalColors;
@@ -212,7 +212,7 @@ export type EffectFrame = (look: CellLook, cell: EffectCell) => CellLook;
212
212
  * frame by the shape of the call, never by a cache asking whether this cell's
213
213
  * frame is the last one's.
214
214
  *
215
- * Its `nextChange` is when the frame next changes: a stepped effect its next
215
+ * Its `validUntil` is when the frame next changes: a stepped effect its next
216
216
  * step's start, a transition `t` until it is done and `Infinity` after, a
217
217
  * loop that holds every cell still, at the frame's depth or with nothing in
218
218
  * it to move, `Infinity` there, and a loop that moves `t`
@@ -234,13 +234,13 @@ export interface EffectedOptions {
234
234
  * good over no cell, since it changes how cells look and never which exist.
235
235
  * What drew none says for itself when it will (a lifecycle not yet entered).
236
236
  */
237
- export declare function holdOver(anyCell: boolean, shown: Shown<unknown>, t: number): Hold;
237
+ export declare function validityOver(anyCell: boolean, shown: Shown<unknown>, t: number): ValidityInterval;
238
238
  /**
239
239
  * An `Effected` at `t`, or an element through an effect at a time an
240
240
  * animation's `at` was handed — a lifecycle's time since it entered: `renderable`
241
241
  * with its cells' looks passed through `effect` at `t`. Its cells say nothing
242
242
  * of when that changes, since `t` is not the frame's clock: it tells the hold
243
- * it drew in (`RenderOptions.onMoved`), and whatever placed the animation
243
+ * it drew in (`RenderOptions.onReads`), and whatever placed the animation
244
244
  * carries that onto the frame's and stamps it. [LAW:one-type-per-behavior]
245
245
  */
246
246
  export declare class Recolored implements Renderable, Measurable {
@@ -268,7 +268,7 @@ export declare class Recolored implements Renderable, Measurable {
268
268
  maximum: number;
269
269
  };
270
270
  /**
271
- * The specs that draw a cell's slot colours `to` where the segment drew
271
+ * The specs that draw a cell's slot colors `to` where the segment drew
272
272
  * `from` with `wire`: each moved slot in the spec `movedSpecs` writes it
273
273
  * in, the rest as `wire` wrote them.
274
274
  */
@@ -281,7 +281,7 @@ export declare class Recolored implements Renderable, Measurable {
281
281
  * nothing drawn its answer to when it changes is `t`, at every time: early,
282
282
  * never false. Placed, on its own or as a part of any combinator, it says
283
283
  * exactly: the frame's drawing told the effect's hold at that time and the
284
- * output's depth (`Moves`), so at a depth that shows no motion a loop says it
284
+ * output's depth (`Reads`), so at a depth that shows no motion a loop says it
285
285
  * never changes there and the host sleeps.
286
286
  */
287
287
  export declare class Effected implements Animation<Renderable> {
@@ -291,8 +291,8 @@ export declare class Effected implements Animation<Renderable> {
291
291
  constructor(renderable: Renderable, effect: Effect, options: EffectedOptions);
292
292
  /** The element through the effect at `t`, unstamped. */
293
293
  at(t: number): Recolored;
294
- nextChange(t: number, moves?: Moves): number;
295
- lastChange(t: number, moves?: Moves): number;
294
+ validUntil(t: number, moves?: Reads): number;
295
+ validFrom(t: number, moves?: Reads): number;
296
296
  /** The element under the effect with its motion taken out. */
297
297
  reduced(): Effected;
298
298
  /** Drawn at the frame's time, its cells stamped with the effect's exact hold there. */
@@ -302,9 +302,9 @@ export declare class Effected implements Animation<Renderable> {
302
302
  maximum: number;
303
303
  };
304
304
  /**
305
- * The colours the screen shows for `pair` once it is drawn moved to `to`,
305
+ * The colors the screen shows for `pair` once it is drawn moved to `to`,
306
306
  * both as the screen shows them, at `depth` on `terminal`: what an effect
307
- * moving a pair's colours leaves its words reading in.
307
+ * moving a pair's colors leaves its words reading in.
308
308
  * [LAW:one-source-of-truth] Read through `movedSpecs`, the one writer a
309
309
  * moved slot is written with.
310
310
  */
@@ -312,7 +312,7 @@ export declare class Effected implements Animation<Renderable> {
312
312
  }
313
313
  /**
314
314
  * A cell's seed: FNV-1a of the element's key and the cell's position, scaled
315
- * into [0, 1). [LAW:one-source-of-truth] One rule for a colour effect's seeds
315
+ * into [0, 1). [LAW:one-source-of-truth] One rule for a color effect's seeds
316
316
  * and a glyph effect's, so one element under both twinkles from one seed.
317
317
  */
318
318
  export declare function cellSeed(key: string, row: number, col: number): number;
@@ -329,13 +329,13 @@ export interface WalkedGlyph {
329
329
  * column, and its anchor shifted to that column as `Style.shiftedBy` shifts
330
330
  * a run's. A control segment draws nothing and has none.
331
331
  * [LAW:one-source-of-truth] The one walk: what `Drawn.cells` lists, what the
332
- * render hands a colour effect, and what a glyph effect (`./glyph-effect.ts`)
332
+ * render hands a color effect, and what a glyph effect (`./glyph-effect.ts`)
333
333
  * is handed are all read off it.
334
334
  */
335
335
  export declare function walkGlyphs(segments: readonly Segment[]): (readonly WalkedGlyph[])[];
336
336
  /**
337
337
  * Whether `text` draws ink: anything but blanks. [LAW:one-source-of-truth]
338
- * The one test, so the words a colour effect lights are the words a glyph
338
+ * The one test, so the words a color effect lights are the words a glyph
339
339
  * effect (`./glyph-effects.ts`) scrambles and its particles pass behind.
340
340
  */
341
341
  export declare function inked(text: string): boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Effected — a renderable whose finished cells' looks — colours and text
2
+ * Effected — a renderable whose finished cells' looks — colors and text
3
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`
@@ -11,7 +11,7 @@
11
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
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'
14
+ * them, which are no one's to paint: a seam's colors are its neighbours'
15
15
  * edges, so once the effect has painted every other cell, each such cell is
16
16
  * resolved again from the cells beside it as the effect left them
17
17
  * (`JoinedCell`, `../core/strip.ts`), the way the joiner drew it. Shimmer,
@@ -22,16 +22,16 @@
22
22
  * a cell by what the element drew (`EffectCell.pair`), or by nesting one
23
23
  * wrapper in another, which measures the inner one's output instead.
24
24
  *
25
- * A cell's look is one value, its colours and its attributes together
26
- * (`CellLook`), rather than an attribute stage beside the colour one, so
27
- * everything that takes an `Effect` — `confined`, `onBeat`,
25
+ * A cell's look is one value, its colors and its attributes together
26
+ * (`CellLook`), rather than an attribute stage beside the color one, so
27
+ * everything that takes an `Effect` — `confined`, `sampleAndHold`,
28
28
  * `Animation.all`, nesting over a glyph effect — takes one that moves
29
29
  * attributes with no second copy of itself. `reverse` is the one attribute
30
30
  * a look leaves out (`CellAttributes`): it decides which of a style's slots
31
- * a colour on screen is in, and a swap of the two is already a colour move.
31
+ * a color on screen is in, and a swap of the two is already a color move.
32
32
  *
33
33
  * What the element draws (`Drawn`) — the cells the effect will be handed,
34
- * and the colours of its words — is measured here, in the render, off the
34
+ * and the colors of its words — is measured here, in the render, off the
35
35
  * same reading of each segment its cells are drawn from, and handed to the
36
36
  * effect once a frame. It is what an effect keeping words legible is settled
37
37
  * against (`onColors`, `./effects.ts`), so no caller derives it a second time
@@ -51,18 +51,18 @@
51
51
  * to the effect and is never cut, and a run cut out of a segment keeps that
52
52
  * segment's link and meta and carries its anchor shifted to the run's first
53
53
  * cell (`Style.shiftedBy`), so hit testing still finds the owner.
54
- * - A cell whose colours come back unchanged keeps its original `ColorSpec`,
54
+ * - A cell whose colors come back unchanged keeps its original `ColorSpec`,
55
55
  * one whose attributes come back as its style set them keeps them, and a
56
56
  * segment whose every cell is unchanged is yielded with its look as
57
57
  * it was, so the identity effect is byte-identical; what an `Effected` gains is when
58
58
  * the frame next changes (`Style.hold`), which writes no byte.
59
59
  * Neighbouring cells the output depth
60
60
  * writes alike stay one segment: a segment is cut only where the written
61
- * colours or the attributes change, so two colours that land on one index
61
+ * colors or the attributes change, so two colors that land on one index
62
62
  * are one run.
63
- * - New colours are built with `ColorSpec.fromRgba`, never parsed from a
63
+ * - New colors are built with `ColorSpec.fromRgba`, never parsed from a
64
64
  * string, so no frame adds an entry to a parse cache.
65
- * - With no colour output (`colorSystem: null`) no style is written at all,
65
+ * - With no color output (`colorSystem: null`) no style is written at all,
66
66
  * attributes included, so there is nothing for an effect to change, and
67
67
  * the child's segments pass through untouched.
68
68
  *
@@ -70,7 +70,7 @@
70
70
  * what the child drew, so a sweep crosses the element, not the screen.
71
71
  */
72
72
  import { drawnBy, shiftAnchor } from "../core/anchor.js";
73
- import { Animation, holdOf, placedRender, shownAt } from "../core/animation.js";
73
+ import { Animation, validityOf, placedRender, shownAt } from "../core/animation.js";
74
74
  import { cellLen, graphemes } from "../core/cells.js";
75
75
  import { ColorDepth, ColorSpec, resolveTerminal, SURFACE_BLACK } from "../core/color.js";
76
76
  import { fnv1a } from "../core/fnv1a.js";
@@ -85,15 +85,15 @@ import { finiteTime } from "../core/easing.js";
85
85
  * good over no cell, since it changes how cells look and never which exist.
86
86
  * What drew none says for itself when it will (a lifecycle not yet entered).
87
87
  */
88
- export function holdOver(anyCell, shown, t) {
89
- return anyCell ? holdOf(shown, t) : NEVER_CHANGES;
88
+ export function validityOver(anyCell, shown, t) {
89
+ return anyCell ? validityOf(shown, t) : NEVER_CHANGES;
90
90
  }
91
91
  /**
92
92
  * An `Effected` at `t`, or an element through an effect at a time an
93
93
  * animation's `at` was handed — a lifecycle's time since it entered: `renderable`
94
94
  * with its cells' looks passed through `effect` at `t`. Its cells say nothing
95
95
  * of when that changes, since `t` is not the frame's clock: it tells the hold
96
- * it drew in (`RenderOptions.onMoved`), and whatever placed the animation
96
+ * it drew in (`RenderOptions.onReads`), and whatever placed the animation
97
97
  * carries that onto the frame's and stamps it. [LAW:one-type-per-behavior]
98
98
  */
99
99
  export class Recolored {
@@ -109,15 +109,15 @@ export class Recolored {
109
109
  }
110
110
  render(options) {
111
111
  const segments = render(this.renderable, options);
112
- // With no colour output nothing the effect does is written, so the child
112
+ // With no color output nothing the effect does is written, so the child
113
113
  // is what is shown, and it changes when the child says it does.
114
114
  if (options.colorSystem === null) {
115
- options.onMoved?.(this._t, this.key, NEVER_CHANGES);
115
+ options.onReads?.(this._t, this.key, NEVER_CHANGES);
116
116
  return segments;
117
117
  }
118
118
  // No depth named is no downgrade, as `drawnColors` reads it.
119
119
  const depth = options.colorSystem ?? ColorDepth.TRUECOLOR;
120
- // [LAW:one-source-of-truth] Every colour below resolves on the frame's
120
+ // [LAW:one-source-of-truth] Every color below resolves on the frame's
121
121
  // terminal, so two effects in a frame cannot disagree.
122
122
  const terminal = resolveTerminal(options.terminal, depth);
123
123
  // [LAW:one-source-of-truth] The frame is measured before any cell is
@@ -127,7 +127,7 @@ export class Recolored {
127
127
  const walked = walk(looked);
128
128
  const drawn = measured(looked, () => walked, depth, terminal);
129
129
  const shown = shownAt(this.effect(drawn), this._t, options);
130
- options.onMoved?.(this._t, this.key, holdOver(walked.some(({ glyphs }) => glyphs.some(({ cell }) => cell !== undefined)), shown, this._t));
130
+ options.onReads?.(this._t, this.key, validityOver(walked.some(({ glyphs }) => glyphs.some(({ cell }) => cell !== undefined)), shown, this._t));
131
131
  return this._recolored(walked, shown.value, drawn);
132
132
  }
133
133
  *_recolored(walked, frame, drawn) {
@@ -158,7 +158,7 @@ export class Recolored {
158
158
  *_repainted(segment, look, glyphs, moved, drawn) {
159
159
  const { style: base, wire, slots, pair, attributes } = look;
160
160
  // [LAW:one-source-of-truth] A run is cells the wire writes alike: each
161
- // cell is drawn at the output depth first and merged on the colours that
161
+ // cell is drawn at the output depth first and merged on the colors that
162
162
  // writes and on its attributes, so two truecolors landing on one index
163
163
  // stay one run. A cell the effect gave its neighbour's look is drawn as
164
164
  // that neighbour was.
@@ -209,9 +209,9 @@ export class Recolored {
209
209
  // slot in, the spec the joiner reads of an item drawn so: a palette slot
210
210
  // stays that slot, which the lift tells apart by number, never an RGB read
211
211
  // back through a palette the writer did not use. Only the terminal's own
212
- // colour names none, and the terminal the effect draws on says what it is.
212
+ // color names none, and the terminal the effect draws on says what it is.
213
213
  // Each such spec is kept, so the writer below knows it by identity: an
214
- // RGB a blend or another colour lands on is not the terminal's own.
214
+ // RGB a blend or another color lands on is not the terminal's own.
215
215
  const terminals = new Set();
216
216
  const edgeOf = (spec, foreground) => {
217
217
  if (!spec?.isDefault)
@@ -253,9 +253,9 @@ export class Recolored {
253
253
  // [LAW:one-source-of-truth] Each slot is written as the depth writes what
254
254
  // it resolved to, by the writer the lift measured it with
255
255
  // (`Style.drawnColors`), so a lifted ink stands off its ground in the bytes
256
- // as it did when measured. A slot resolved to the colour it was before
256
+ // as it did when measured. A slot resolved to the color it was before
257
257
  // keeps the spec it was written in, as a painted cell's unmoved slot does.
258
- // The terminal's own colours, which stand in a moved edge as the spec of
258
+ // The terminal's own colors, which stand in a moved edge as the spec of
259
259
  // the RGB the effect's terminal gives them and reach a slot unchanged or
260
260
  // not at all, are written by the writer that wrote them on the item
261
261
  // beside, on that terminal, which writes its own ground below truecolor as
@@ -268,7 +268,7 @@ export class Recolored {
268
268
  if (sameSpec(now, before))
269
269
  return wrote;
270
270
  // [LAW:no-silent-failure] Unreachable: a move only fills an edge in, so
271
- // a slot that resolved to a colour when drawn resolves to one after.
271
+ // a slot that resolved to a color when drawn resolves to one after.
272
272
  if (now === undefined)
273
273
  throw new Error(`a seam cell resolved to ${before?.name ?? "nothing"} when drawn and to nothing after an effect moved its neighbours`);
274
274
  return terminals.has(now) ? round : drew;
@@ -283,7 +283,7 @@ export class Recolored {
283
283
  return Measurement.get(options, this.renderable);
284
284
  }
285
285
  /**
286
- * The specs that draw a cell's slot colours `to` where the segment drew
286
+ * The specs that draw a cell's slot colors `to` where the segment drew
287
287
  * `from` with `wire`: each moved slot in the spec `movedSpecs` writes it
288
288
  * in, the rest as `wire` wrote them.
289
289
  */
@@ -299,7 +299,7 @@ export class Recolored {
299
299
  * nothing drawn its answer to when it changes is `t`, at every time: early,
300
300
  * never false. Placed, on its own or as a part of any combinator, it says
301
301
  * exactly: the frame's drawing told the effect's hold at that time and the
302
- * output's depth (`Moves`), so at a depth that shows no motion a loop says it
302
+ * output's depth (`Reads`), so at a depth that shows no motion a loop says it
303
303
  * never changes there and the host sleeps.
304
304
  */
305
305
  export class Effected {
@@ -315,11 +315,11 @@ export class Effected {
315
315
  at(t) {
316
316
  return new Recolored(this.renderable, this.effect, { t, key: this.key });
317
317
  }
318
- nextChange(t, moves) {
319
- return moves?.(t, this.key)?.nextChange ?? t;
318
+ validUntil(t, moves) {
319
+ return moves?.(t, this.key)?.validUntil ?? t;
320
320
  }
321
- lastChange(t, moves) {
322
- return moves?.(t, this.key)?.lastChange ?? t;
321
+ validFrom(t, moves) {
322
+ return moves?.(t, this.key)?.validFrom ?? t;
323
323
  }
324
324
  /** The element under the effect with its motion taken out. */
325
325
  reduced() {
@@ -334,9 +334,9 @@ export class Effected {
334
334
  return Measurement.get(options, this.renderable);
335
335
  }
336
336
  /**
337
- * The colours the screen shows for `pair` once it is drawn moved to `to`,
337
+ * The colors the screen shows for `pair` once it is drawn moved to `to`,
338
338
  * both as the screen shows them, at `depth` on `terminal`: what an effect
339
- * moving a pair's colours leaves its words reading in.
339
+ * moving a pair's colors leaves its words reading in.
340
340
  * [LAW:one-source-of-truth] Read through `movedSpecs`, the one writer a
341
341
  * moved slot is written with.
342
342
  */
@@ -348,7 +348,7 @@ export class Effected {
348
348
  }
349
349
  /**
350
350
  * A cell's seed: FNV-1a of the element's key and the cell's position, scaled
351
- * into [0, 1). [LAW:one-source-of-truth] One rule for a colour effect's seeds
351
+ * into [0, 1). [LAW:one-source-of-truth] One rule for a color effect's seeds
352
352
  * and a glyph effect's, so one element under both twinkles from one seed.
353
353
  */
354
354
  export function cellSeed(key, row, col) {
@@ -374,7 +374,7 @@ function looks(segments, depth, terminal) {
374
374
  * column, and its anchor shifted to that column as `Style.shiftedBy` shifts
375
375
  * a run's. A control segment draws nothing and has none.
376
376
  * [LAW:one-source-of-truth] The one walk: what `Drawn.cells` lists, what the
377
- * render hands a colour effect, and what a glyph effect (`./glyph-effect.ts`)
377
+ * render hands a color effect, and what a glyph effect (`./glyph-effect.ts`)
378
378
  * is handed are all read off it.
379
379
  */
380
380
  export function walkGlyphs(segments) {
@@ -398,7 +398,7 @@ export function walkGlyphs(segments) {
398
398
  }
399
399
  /**
400
400
  * Whether `text` draws ink: anything but blanks. [LAW:one-source-of-truth]
401
- * The one test, so the words a colour effect lights are the words a glyph
401
+ * The one test, so the words a color effect lights are the words a glyph
402
402
  * effect (`./glyph-effects.ts`) scrambles and its particles pass behind.
403
403
  */
404
404
  export function inked(text) {
@@ -450,7 +450,7 @@ function edgesBeside(walked, drawings) {
450
450
  }
451
451
  /** Whether `style` draws in its ink on a blank glyph: a line under, through or over it, or a frame round it. */
452
452
  function drawsLines(style) {
453
- return [style.underline, style.underline2, style.strike, style.overline, style.frame, style.encircle].some((on) => on === true);
453
+ return [style.underline, style.doubleUnderline, style.strike, style.overline, style.frame, style.encircle].some((on) => on === true);
454
454
  }
455
455
  /**
456
456
  * What `looked` draws: `Drawn`'s measure, taken once per frame. Its `all`
@@ -475,7 +475,7 @@ function measured(looked, walked, depth, terminal) {
475
475
  let shown;
476
476
  const words = looked.flatMap(({ segment, look }) => (look !== undefined && inked(segment.text) && !look.seam ? [look.pair] : []));
477
477
  const pairs = [...new Map(words.map((pair) => [`${pair.fg.hex}/${pair.bg.hex}/${pair.terminal.fg}/${pair.terminal.bg}/${pair.reverse}`, pair])).values()];
478
- // [LAW:one-source-of-truth] A slot the terminal fills is no colour of the element's, whatever its hex.
478
+ // [LAW:one-source-of-truth] A slot the terminal fills is no color of the element's, whatever its hex.
479
479
  const own = (slot) => pairs.flatMap((pair) => (pair.terminal[slot] ? [] : [pair[slot].hex]));
480
480
  return {
481
481
  all: () => (all ??= listed().map(({ cell }) => cell)),
@@ -527,29 +527,29 @@ export function drawnOf(segments, depth, terminal) {
527
527
  return measured(looked, () => walk(looked), depth, on);
528
528
  }
529
529
  /**
530
- * A style's colour slots as the screen shows them, or the reverse: `reverse`
530
+ * A style's color slots as the screen shows them, or the reverse: `reverse`
531
531
  * swaps glyph and ground, and swapping twice is where you started.
532
532
  */
533
533
  function onScreen(slots, reverse) {
534
534
  return reverse ? { fg: slots.bg, bg: slots.fg } : slots;
535
535
  }
536
536
  /**
537
- * The specs a cell's slots are written in once their colours move from
537
+ * The specs a cell's slots are written in once their colors move from
538
538
  * `from`, what the written specs draw, to `to`: each laid on what is beneath
539
539
  * it — the ground on `SURFACE_BLACK`, the glyph on that ground, as the writer
540
- * lays any translucent colour (`Style.drawnColors`) — then matched at `depth`
540
+ * lays any translucent color (`Style.drawnColors`) — then matched at `depth`
541
541
  * (`ColorSpec.matchMove`). A slot the depth shows no move in has none, and
542
542
  * keeps the spec it was written in.
543
543
  */
544
544
  function movedSpecs(from, to, depth, terminal) {
545
- // [LAW:one-source-of-truth] The writer's surface, so one translucent colour draws one way in a frame.
545
+ // [LAW:one-source-of-truth] The writer's surface, so one translucent color draws one way in a frame.
546
546
  const ground = to.bg.compositeOver(SURFACE_BLACK);
547
547
  const glyph = to.fg.compositeOver(ground);
548
548
  return { fg: ColorSpec.matchMove(from.fg, glyph, depth, terminal, true), bg: ColorSpec.matchMove(from.bg, ground, depth, terminal, false) };
549
549
  }
550
550
  /**
551
- * Whether two cells' colours are written alike. A slot with no colour is not
552
- * the default colour: it writes nothing, so a style a container lays beneath
551
+ * Whether two cells' colors are written alike. A slot with no color is not
552
+ * the default color: it writes nothing, so a style a container lays beneath
553
553
  * (`Segment.applyStyle`) still shows through it, where `39`/`49` would not.
554
554
  */
555
555
  function writesAlike(a, b) {
@@ -587,7 +587,7 @@ export function cellAttributes(of) {
587
587
  function sameAttributes(a, b) {
588
588
  return a === b || MOVED.every((name) => a[name] === b[name]);
589
589
  }
590
- /** Whether two specs are one colour as written: the same kind, naming the same colour. */
590
+ /** Whether two specs are one color as written: the same kind, naming the same color. */
591
591
  function sameSpec(a, b) {
592
592
  return a === b || (a !== undefined && b !== undefined && a.type === b.type && a.name === b.name);
593
593
  }