@promptctl/rich-js 0.23.0 → 0.24.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.
Files changed (117) hide show
  1. package/THIRD-PARTY-NOTICES +29 -1
  2. package/dist/core/animation.d.ts +78 -0
  3. package/dist/core/animation.js +107 -0
  4. package/dist/core/cell-widths.d.ts +9 -0
  5. package/dist/core/cell-widths.js +140 -0
  6. package/dist/core/cells.d.ts +17 -11
  7. package/dist/core/cells.js +100 -25
  8. package/dist/core/clock.d.ts +9 -1
  9. package/dist/core/clock.js +22 -2
  10. package/dist/core/color.d.ts +10 -0
  11. package/dist/core/color.js +36 -1
  12. package/dist/core/console.js +5 -5
  13. package/dist/core/easing.d.ts +138 -7
  14. package/dist/core/easing.js +355 -17
  15. package/dist/core/json.js +2 -1
  16. package/dist/core/measure.js +2 -2
  17. package/dist/core/place.js +2 -1
  18. package/dist/core/pretty.js +2 -2
  19. package/dist/core/protocol.d.ts +73 -19
  20. package/dist/core/protocol.js +56 -15
  21. package/dist/core/render.js +2 -1
  22. package/dist/core/segment.d.ts +28 -1
  23. package/dist/core/segment.js +60 -44
  24. package/dist/core/strip.d.ts +107 -29
  25. package/dist/core/strip.js +242 -131
  26. package/dist/core/style.d.ts +18 -1
  27. package/dist/core/style.js +49 -9
  28. package/dist/core/text.js +26 -15
  29. package/dist/core/timeline.d.ts +84 -0
  30. package/dist/core/timeline.js +144 -0
  31. package/dist/core/tween.d.ts +49 -0
  32. package/dist/core/tween.js +69 -0
  33. package/dist/host/app.js +4 -6
  34. package/dist/host/index.d.ts +1 -1
  35. package/dist/host/input.d.ts +37 -13
  36. package/dist/host/input.js +146 -56
  37. package/dist/host/terminal-host.d.ts +16 -0
  38. package/dist/host/terminal-host.js +1 -0
  39. package/dist/index.d.ts +16 -11
  40. package/dist/index.js +15 -5
  41. package/dist/node/terminal-host.d.ts +8 -1
  42. package/dist/node/terminal-host.js +2 -0
  43. package/dist/renderables/align.d.ts +3 -2
  44. package/dist/renderables/align.js +3 -0
  45. package/dist/renderables/columns.d.ts +3 -2
  46. package/dist/renderables/columns.js +7 -2
  47. package/dist/renderables/constrain.d.ts +3 -2
  48. package/dist/renderables/constrain.js +5 -1
  49. package/dist/renderables/effect.d.ts +83 -30
  50. package/dist/renderables/effect.js +155 -57
  51. package/dist/renderables/effects.d.ts +88 -39
  52. package/dist/renderables/effects.js +444 -105
  53. package/dist/renderables/embed.d.ts +10 -0
  54. package/dist/renderables/embed.js +18 -9
  55. package/dist/renderables/flexStrip.d.ts +3 -2
  56. package/dist/renderables/flexStrip.js +6 -1
  57. package/dist/renderables/frames.d.ts +116 -0
  58. package/dist/renderables/frames.js +133 -0
  59. package/dist/renderables/group.d.ts +3 -2
  60. package/dist/renderables/group.js +5 -2
  61. package/dist/renderables/html-entities.d.ts +8 -0
  62. package/dist/renderables/html-entities.js +386 -0
  63. package/dist/renderables/layout.d.ts +3 -2
  64. package/dist/renderables/layout.js +15 -2
  65. package/dist/renderables/list-view.d.ts +3 -2
  66. package/dist/renderables/list-view.js +12 -5
  67. package/dist/renderables/live.d.ts +23 -7
  68. package/dist/renderables/live.js +69 -35
  69. package/dist/renderables/markdown-parse.d.ts +109 -0
  70. package/dist/renderables/markdown-parse.js +1421 -0
  71. package/dist/renderables/markdown-url.d.ts +19 -0
  72. package/dist/renderables/markdown-url.js +314 -0
  73. package/dist/renderables/markdown.d.ts +7 -6
  74. package/dist/renderables/markdown.js +363 -499
  75. package/dist/renderables/padding.d.ts +8 -20
  76. package/dist/renderables/padding.js +32 -50
  77. package/dist/renderables/panel.d.ts +26 -26
  78. package/dist/renderables/panel.js +67 -103
  79. package/dist/renderables/progress.d.ts +5 -3
  80. package/dist/renderables/progress.js +14 -3
  81. package/dist/renderables/progressBar.js +4 -4
  82. package/dist/renderables/python-space.d.ts +13 -0
  83. package/dist/renderables/python-space.js +24 -0
  84. package/dist/renderables/spinner.d.ts +73 -27
  85. package/dist/renderables/spinner.js +110 -51
  86. package/dist/renderables/status.d.ts +8 -3
  87. package/dist/renderables/status.js +8 -5
  88. package/dist/renderables/syntax.js +2 -1
  89. package/dist/renderables/table.d.ts +19 -11
  90. package/dist/renderables/table.js +140 -156
  91. package/dist/renderables/traceback.d.ts +1 -1
  92. package/dist/renderables/traceback.js +6 -5
  93. package/dist/renderables/tree.d.ts +6 -5
  94. package/dist/renderables/tree.js +11 -7
  95. package/dist/renderables/viewport.d.ts +13 -5
  96. package/dist/renderables/viewport.js +41 -20
  97. package/dist/template-bindings/animation-funcs.d.ts +37 -0
  98. package/dist/template-bindings/animation-funcs.js +83 -0
  99. package/dist/template-bindings/color-funcs.d.ts +13 -0
  100. package/dist/template-bindings/color-funcs.js +1 -1
  101. package/dist/template-bindings/helpers.d.ts +6 -0
  102. package/dist/template-bindings/helpers.js +12 -3
  103. package/dist/template-bindings/index.d.ts +6 -2
  104. package/dist/template-bindings/index.js +8 -3
  105. package/dist/themes/ramp.d.ts +18 -3
  106. package/dist/themes/ramp.js +23 -2
  107. package/dist/widgets/focus-manager.d.ts +21 -14
  108. package/dist/widgets/focus-manager.js +28 -29
  109. package/dist/widgets/index.d.ts +1 -1
  110. package/dist/widgets/static-item.d.ts +4 -3
  111. package/dist/widgets/static-item.js +9 -7
  112. package/dist/widgets/text-input.d.ts +28 -18
  113. package/dist/widgets/text-input.js +144 -101
  114. package/dist/widgets/widget-app.d.ts +19 -3
  115. package/dist/widgets/widget-app.js +39 -21
  116. package/dist/widgets/widget-base.js +0 -3
  117. package/package.json +2 -5
@@ -259,6 +259,16 @@ export declare class ColorSpec {
259
259
  * on a ground (`flattenAlpha`).
260
260
  */
261
261
  static matchOn(value: ColorRgba, depth: ColorDepth, theme: TerminalTheme, foreground: boolean): ColorSpec;
262
+ /**
263
+ * Every colour `depth` writes by index, each with the colour a terminal
264
+ * known to show `theme` draws it in, lowest index first: the theme's
265
+ * sixteen, and at 256 colours the cube and grey ramp after them. Each is
266
+ * drawn alike as glyph and as ground, which the default colour is not, so
267
+ * it is not among them. Truecolor writes a colour itself and the default
268
+ * depth only the default, so neither writes any by index. The colours
269
+ * `matchOn` rounds to, but for the default, read off the same two tables.
270
+ */
271
+ static indexed(depth: ColorDepth, theme: TerminalTheme): readonly (readonly [ColorSpec, ColorRgba])[];
262
272
  /**
263
273
  * The spec a slot is written in once its colour moves from `was`, what its
264
274
  * written spec draws on `theme`, to the opaque `now`: `matchOn`'s — or
@@ -614,9 +614,11 @@ export class ColorSpec {
614
614
  return ColorSpec.fromRgba(value);
615
615
  if (depth === ColorDepth.DEFAULT)
616
616
  return ColorSpec.default();
617
- const slot = theme.ansiColors.match(value);
618
617
  // [LAW:dataflow-not-control-flow] Every candidate is scored; the depth
619
618
  // only decides whether the cube is among them. Ties go to the earlier.
619
+ // Each table's nearest stands in for all of it: the tables' `match` is
620
+ // memoised and ranks by this distance, so the winner is `indexed`'s.
621
+ const slot = theme.ansiColors.match(value);
620
622
  const candidates = [
621
623
  [ColorSpec.default(), foreground ? theme.foregroundColor : theme.backgroundColor],
622
624
  [new ColorSpec(`color(${slot})`, depth === ColorDepth.WINDOWS ? depth : ColorDepth.STANDARD, slot), theme.ansiColors.get(slot)],
@@ -624,6 +626,22 @@ export class ColorSpec {
624
626
  ];
625
627
  return candidates.reduce((best, next) => (rgbDistance(next[1], value) < rgbDistance(best[1], value) ? next : best))[0];
626
628
  }
629
+ /**
630
+ * Every colour `depth` writes by index, each with the colour a terminal
631
+ * known to show `theme` draws it in, lowest index first: the theme's
632
+ * sixteen, and at 256 colours the cube and grey ramp after them. Each is
633
+ * drawn alike as glyph and as ground, which the default colour is not, so
634
+ * it is not among them. Truecolor writes a colour itself and the default
635
+ * depth only the default, so neither writes any by index. The colours
636
+ * `matchOn` rounds to, but for the default, read off the same two tables.
637
+ */
638
+ static indexed(depth, theme) {
639
+ const byDepth = indexedMemo.get(theme) ?? new Map();
640
+ indexedMemo.set(theme, byDepth);
641
+ const listed = byDepth.get(depth) ?? listIndexed(depth, theme);
642
+ byDepth.set(depth, listed);
643
+ return listed;
644
+ }
627
645
  /**
628
646
  * The spec a slot is written in once its colour moves from `was`, what its
629
647
  * written spec draws on `theme`, to the opaque `now`: `matchOn`'s — or
@@ -670,6 +688,23 @@ function cubeCandidate(value) {
670
688
  const index = EIGHT_BIT_DOWNGRADE_TABLE.match(value);
671
689
  return [ColorSpec.fromAnsi(index), EIGHT_BIT_DOWNGRADE_TABLE.get(index)];
672
690
  }
691
+ /** `ColorSpec.indexed`'s list, made once for each theme and depth. */
692
+ const indexedMemo = new WeakMap();
693
+ function listIndexed(depth, theme) {
694
+ const slots = () => Array.from({ length: 16 }, (_, slot) => [new ColorSpec(`color(${slot})`, depth === ColorDepth.WINDOWS ? depth : ColorDepth.STANDARD, slot), theme.ansiColors.get(slot)]);
695
+ switch (depth) {
696
+ case ColorDepth.TRUECOLOR:
697
+ case ColorDepth.DEFAULT:
698
+ return [];
699
+ case ColorDepth.STANDARD:
700
+ case ColorDepth.WINDOWS:
701
+ return slots();
702
+ case ColorDepth.EIGHT_BIT: {
703
+ const { firstIndex, size } = EIGHT_BIT_DOWNGRADE_TABLE;
704
+ return [...slots(), ...Array.from({ length: size }, (_, i) => [ColorSpec.fromAnsi(firstIndex + i), EIGHT_BIT_DOWNGRADE_TABLE.get(firstIndex + i)])];
705
+ }
706
+ }
707
+ }
673
708
  function mix(from, to, t, theme) {
674
709
  return blendRgb(from.getTruecolor(theme), to.getTruecolor(theme), t);
675
710
  }
@@ -18,7 +18,7 @@ import { ReprHighlighter, NullHighlighter } from "./highlighter.js";
18
18
  import { Rule } from "../renderables/rule.js";
19
19
  import { segmentsToString } from "./render.js";
20
20
  import { placeBlock } from "./place.js";
21
- import { isRenderable } from "./protocol.js";
21
+ import { isRenderable, render } from "./protocol.js";
22
22
  // [LAW:dataflow-not-control-flow] With no live region claimed, stepping around
23
23
  // it is the text itself: every write takes the same path.
24
24
  const NO_LIVE_REGION = { around: (text) => text };
@@ -67,7 +67,7 @@ class TextRun {
67
67
  this.text = items.reduce((joined, item) => joined.append(item), new RichText("", { end: "" }));
68
68
  }
69
69
  *render(options) {
70
- yield* this.text.render(options);
70
+ yield* render(this.text, options);
71
71
  yield this.end;
72
72
  }
73
73
  measure(options) {
@@ -433,7 +433,7 @@ export class Console {
433
433
  const renderable = block.kind === "text" ? new TextRun(block.items, terminator) : block.renderable;
434
434
  if (align)
435
435
  return { lines: placeBlock(renderable, align, renderOpts), closed: true };
436
- const drawn = [...renderable.render(renderOpts)];
436
+ const drawn = [...render(renderable, renderOpts)];
437
437
  // A text run's last segment is always its `end`, yielded even when
438
438
  // empty, and `splitLines` drops the empty line after a final break only
439
439
  // when nothing follows it — so the run is closed exactly when `end` is.
@@ -479,7 +479,7 @@ export class Console {
479
479
  time.stylize("log.time");
480
480
  const width = Math.min(time.cellLength, options.maxWidth - 1);
481
481
  const { rows, cropWidth } = this._draw(args, { ...options, maxWidth: options.maxWidth - width });
482
- const [stampLine = []] = Segment.splitLines(time.render({ ...options, maxWidth: time.cellLength }));
482
+ const [stampLine = []] = Segment.splitLines(render(time, { ...options, maxWidth: time.cellLength }));
483
483
  const styled = (cell) => [...Segment.applyStyle(cell, this._style)];
484
484
  const stamp = styled(Segment.adjustLineLength(stampLine, width));
485
485
  const blank = styled([new Segment(" ".repeat(width))]);
@@ -499,7 +499,7 @@ export class Console {
499
499
  // into this constructor, which made a second map of one shape — identical
500
500
  // then, free to drift the moment `Rule` grew an option.
501
501
  rule(title, options) {
502
- const segments = [...new Rule(title, options).render(this.options)];
502
+ const segments = [...render(new Rule(title, options), this.options)];
503
503
  this._writeSegments(segments);
504
504
  }
505
505
  // [LAW:one-source-of-truth] `JSONRenderable` is the one formatter for JSON and
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Easing and phase: the one vocabulary for "how far along" — every function
3
- * here returns progress in [0, 1].
2
+ * Easing and phase: the one vocabulary for "how far along" — a time in
3
+ * seconds becomes progress in [0, 1], and an ease reshapes that progress,
4
+ * usually but not always within [0, 1].
4
5
  *
5
6
  * Two kinds of curve, composed as `ease(phase(t))`:
6
7
  *
@@ -13,20 +14,31 @@
13
14
  * built-ins are CSS's easing functions (CSS Easing Functions Level 1):
14
15
  * `linear`, `cubic-bezier()` with its named curves, and `steps()` with its
15
16
  * jump terms, plus `sine` for pulses — a half-cosine, so a `pingPong`
16
- * through it brightens and dims with no corner at either end.
17
+ * through it brightens and dims with no corner at either end — and the
18
+ * physics-flavoured curves a cursor snapping, a counter settling or a
19
+ * panel sliding in want: `spring`, a damped harmonic oscillator released
20
+ * toward its rest, which is the one of them with parameters and so the one
21
+ * that also says how long it takes; `bounce`, `back-in`, `back-out` and
22
+ * `elastic`, Robert Penner's curves at the constants every animation
23
+ * library since has shipped. An ease that leaves [0, 1] — a spring or a
24
+ * back curve overshooting its rest — is still an ease: a `ColorRamp` holds
25
+ * its end colours where it does, and an effect's `Curve` saturates at its
26
+ * swing, so the overshoot is read by what can show it (a position, a
27
+ * count) and clipped by what cannot.
17
28
  *
18
29
  * [LAW:no-ambient-temporal-coupling] Nothing here reads a clock. `t` is an
19
30
  * argument; whoever draws frames owns the clock and samples these at
20
31
  * whatever rate it likes, so the same `t` always gives the same progress.
21
32
  *
22
33
  * [LAW:one-type-per-behavior] An ease is a plain function value. CSS's named
23
- * curves are four instances of `cubicBezier`, not four implementations, and
24
- * `ColorRamp` and every effect take the same `Ease`.
34
+ * curves are four instances of `cubicBezier`, not four implementations, the
35
+ * spring in `EASES` is one `spring()`, and `ColorRamp` and every effect take
36
+ * the same `Ease`.
25
37
  *
26
38
  * Tier 0 of `src/core/`: imports nothing, so `themes/` and every later
27
39
  * `core/` module reach it downhill. [LAW:one-way-deps]
28
40
  */
29
- /** Progress in, progress out: a reshaping of [0, 1]. */
41
+ /** Progress in [0, 1] in, progress out: a reshaping of [0, 1] that may leave it, as a spring overshooting its rest does. */
30
42
  export type Ease = (x: number) => number;
31
43
  /** Time in seconds (plus any per-cell offset) in, progress in [0, 1] out. */
32
44
  export type Phase = (t: number) => number;
@@ -51,11 +63,66 @@ export type StepPosition = "jump-start" | "jump-end" | "jump-none" | "jump-both"
51
63
  * the very end.
52
64
  */
53
65
  export declare function steps(n: number, position?: StepPosition): Ease;
66
+ /**
67
+ * A spring's physics: the mass on it, the stiffness of its coil and the
68
+ * damping it moves against, in the units every animation library spells them
69
+ * in (React Spring, Framer Motion), whose defaults these are — a spring that
70
+ * overshoots once and settles in about a second and a quarter.
71
+ */
72
+ export interface SpringOptions {
73
+ /** The restoring force per unit of displacement; stiffer swings faster and settles in about the same time, since the decay is the damping's over the mass's. Positive. Defaults to 100. */
74
+ readonly stiffness?: number;
75
+ /** The force against the motion per unit of velocity; more settles sooner and overshoots less. Positive. Defaults to 10. */
76
+ readonly damping?: number;
77
+ /** What the spring moves; heavier is slower and overshoots further. Positive. Defaults to 1. */
78
+ readonly mass?: number;
79
+ }
80
+ /**
81
+ * An ease over a duration: CSS's timing function and duration as one value,
82
+ * the whole of what a one-shot move needs to know about time — a tween's
83
+ * (`./tween.ts`), a `spring()`'s, and the part of an effect's `Curve` that
84
+ * is not its swing. `Phase.once(start, seconds)` through `ease` is the move
85
+ * on a timeline. [LAW:one-type-per-behavior] One shape, so a spring is handed
86
+ * to a tween as it is, and a curve written for an effect times a tween.
87
+ */
88
+ export interface Timing {
89
+ /** How the move is shaped, as progress in to progress out. */
90
+ readonly ease: Ease;
91
+ /** How long the move takes, in seconds. */
92
+ readonly seconds: number;
93
+ }
94
+ /**
95
+ * How close to its rest a spring must come to count as settled: one part in a
96
+ * thousand of the way it moves, under a colour channel's step (1/255) and
97
+ * under any cell, so what rounds the spring's value to show it draws the rest
98
+ * from there on.
99
+ */
100
+ export declare const SPRING_REST = 0.001;
101
+ /**
102
+ * A damped harmonic oscillator, `m·x″ = −k·x − c·x′`, released at rest one
103
+ * unit from its equilibrium: the spring every animation library means. Its
104
+ * progress at `s` seconds is `1 − displacement(s)`, the closed-form solution
105
+ * of that equation in the regime its damping ratio `ζ = c / 2√(k·m)` puts it
106
+ * in — ringing past its rest for `ζ < 1`, creeping up to it for `ζ ≥ 1` — and
107
+ * its `seconds` is its settling time: the first moment after which the
108
+ * displacement stays within `SPRING_REST`, found once here by `crossing` on
109
+ * the bracket each regime knows its last crossing lies in, so a sample costs
110
+ * an exponential and a cosine whatever `x` is. [LAW:no-ambient-temporal-coupling]
111
+ *
112
+ * The ease is exactly 1 at `x = 1` (`settled`): settled means at rest. The
113
+ * `seconds` are the spring's to say, not the caller's: how long it rings is
114
+ * a fact about its physics, which is why this is the one ease that comes as
115
+ * a `Timing` — released at rest a unit from where it is going, at 1 when it
116
+ * has settled there.
117
+ */
118
+ export declare function spring(options?: SpringOptions): Timing;
54
119
  /**
55
120
  * Every built-in ease by the name a template spells it with — CSS's keyword
56
121
  * names, plus `sine`, plus `step`: the spelling `ColorRamp` used before this
57
122
  * vocabulary existed, kept so every template written against it renders the
58
- * same. It is CSS's `step-end`, the same function value.
123
+ * same. It is CSS's `step-end`, the same function value. Then the
124
+ * physics-flavoured curves: `spring` is the default `spring()`, whose
125
+ * `seconds` are `DEFAULT_SPRING`'s; the rest are Penner's at his constants.
59
126
  */
60
127
  export declare const EASES: {
61
128
  readonly linear: Ease;
@@ -67,6 +134,11 @@ export declare const EASES: {
67
134
  readonly "step-end": Ease;
68
135
  readonly step: Ease;
69
136
  readonly sine: Ease;
137
+ readonly spring: Ease;
138
+ readonly bounce: Ease;
139
+ readonly "back-in": Ease;
140
+ readonly "back-out": Ease;
141
+ readonly elastic: Ease;
70
142
  };
71
143
  export type EaseName = keyof typeof EASES;
72
144
  /**
@@ -75,6 +147,65 @@ export type EaseName = keyof typeof EASES;
75
147
  * Unknown names throw naming every legal one. [LAW:no-silent-failure]
76
148
  */
77
149
  export declare function parseEase(name: string): Ease;
150
+ /** Throws, naming `what`, unless `seconds` is a positive, finite number of seconds. */
151
+ export declare function positiveSeconds(what: string, seconds: number): void;
152
+ /**
153
+ * A beat: holds of given lengths in seconds, played in order and looped, the
154
+ * way the frames of an animation are each held and then replaced. `at(t)` is
155
+ * the index of the hold in progress at `t`, counted from the first hold at
156
+ * `t = 0`, and the sequence wraps every `period` seconds, before zero too,
157
+ * as `Phase.loop` wraps. With equal holds `at` is `steps(n)` read as an
158
+ * index; the holds here may differ, which `steps` cannot say, so a frame
159
+ * held for a second and the next for a quarter are one beat.
160
+ */
161
+ export interface Beat {
162
+ readonly holds: readonly number[];
163
+ /** The sum of the holds: how long one pass takes, in seconds. */
164
+ readonly period: number;
165
+ /** Which hold is in progress at `t` seconds: an index into `holds`. */
166
+ at(t: number): number;
167
+ /**
168
+ * When the hold in progress at `t` began, in seconds on `t`'s own
169
+ * timeline: what a sample-and-hold on this beat reads at `t`. Every `t`
170
+ * inside one hold of one pass answers the same number, to the bit, so an
171
+ * effect handed it draws the same frame throughout. With `nextChange`,
172
+ * the two ends of the hold, as every `Animation` answers them.
173
+ */
174
+ lastChange(t: number): number;
175
+ /**
176
+ * When the hold in progress at `t` ends, in seconds on `t`'s own timeline:
177
+ * the start of the next hold, the first moment `at` places in it, so it is
178
+ * always after `t`. What is drawn on this beat at `t` is drawn until then.
179
+ * With `at`, this makes a beat an `Animation` of the hold in progress
180
+ * (`./animation.ts`).
181
+ */
182
+ nextChange(t: number): number;
183
+ }
184
+ /**
185
+ * The first float from `sum` up at which `reached` holds: a time built as a
186
+ * sum to land on a boundary — where a hold begins, where an animation's next
187
+ * part changes — that rounding put an ulp or two under it, walked up to the
188
+ * first moment on the far side. [LAW:single-enforcer] The one walk, so every
189
+ * boundary a time is carried onto is the moment the change shows, to the
190
+ * float. A walk longer than rounding can cost throws `finer()`'s message: the
191
+ * boundary is narrower than the floats around it are apart.
192
+ */
193
+ export declare function walkUp(sum: number, reached: (x: number) => boolean, finer: () => string): number;
194
+ /**
195
+ * The least float at which `reached` holds, `reached` being false up to some
196
+ * float and true from it on, found from `near`, a guess at it on either
197
+ * side. Where `walkUp` carries a sum onto a boundary on its own clock, and
198
+ * an ulp or two is all rounding can cost, this carries a moment across
199
+ * clocks (`./timeline.ts`): a host float is a step of `rate` on the
200
+ * animation's clock, so the host floats between the guess and the first one
201
+ * past the boundary are as many as the two clocks' resolutions are apart,
202
+ * which no cap bounds and is no error. The bracket is found by doubling the
203
+ * step out from `near`, and halved to two adjacent floats, so the answer is
204
+ * exact to the float and the cost is logarithmic in that distance.
205
+ */
206
+ export declare function firstReaching(near: number, reached: (x: number) => boolean): number;
207
+ /** `holds` as a `Beat`; a beat with no hold, or a hold that is not a positive number of seconds, throws. */
208
+ export declare function beat(holds: readonly number[]): Beat;
78
209
  /** The three phase shapes. Each takes seconds and returns a `Phase`. */
79
210
  export declare const Phase: {
80
211
  /** 0 before `start`, rising to 1 over `duration` seconds, then held at 1. */