@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.
- package/THIRD-PARTY-NOTICES +29 -1
- package/dist/core/animation.d.ts +78 -0
- package/dist/core/animation.js +107 -0
- package/dist/core/cell-widths.d.ts +9 -0
- package/dist/core/cell-widths.js +140 -0
- package/dist/core/cells.d.ts +17 -11
- package/dist/core/cells.js +100 -25
- package/dist/core/clock.d.ts +9 -1
- package/dist/core/clock.js +22 -2
- package/dist/core/color.d.ts +10 -0
- package/dist/core/color.js +36 -1
- package/dist/core/console.js +5 -5
- package/dist/core/easing.d.ts +138 -7
- package/dist/core/easing.js +355 -17
- package/dist/core/json.js +2 -1
- package/dist/core/measure.js +2 -2
- package/dist/core/place.js +2 -1
- package/dist/core/pretty.js +2 -2
- package/dist/core/protocol.d.ts +73 -19
- package/dist/core/protocol.js +56 -15
- package/dist/core/render.js +2 -1
- package/dist/core/segment.d.ts +28 -1
- package/dist/core/segment.js +60 -44
- package/dist/core/strip.d.ts +107 -29
- package/dist/core/strip.js +242 -131
- package/dist/core/style.d.ts +18 -1
- package/dist/core/style.js +49 -9
- package/dist/core/text.js +26 -15
- package/dist/core/timeline.d.ts +84 -0
- package/dist/core/timeline.js +144 -0
- package/dist/core/tween.d.ts +49 -0
- package/dist/core/tween.js +69 -0
- package/dist/host/app.js +4 -6
- package/dist/host/index.d.ts +1 -1
- package/dist/host/input.d.ts +37 -13
- package/dist/host/input.js +146 -56
- package/dist/host/terminal-host.d.ts +16 -0
- package/dist/host/terminal-host.js +1 -0
- package/dist/index.d.ts +16 -11
- package/dist/index.js +15 -5
- package/dist/node/terminal-host.d.ts +8 -1
- package/dist/node/terminal-host.js +2 -0
- package/dist/renderables/align.d.ts +3 -2
- package/dist/renderables/align.js +3 -0
- package/dist/renderables/columns.d.ts +3 -2
- package/dist/renderables/columns.js +7 -2
- package/dist/renderables/constrain.d.ts +3 -2
- package/dist/renderables/constrain.js +5 -1
- package/dist/renderables/effect.d.ts +83 -30
- package/dist/renderables/effect.js +155 -57
- package/dist/renderables/effects.d.ts +88 -39
- package/dist/renderables/effects.js +444 -105
- package/dist/renderables/embed.d.ts +10 -0
- package/dist/renderables/embed.js +18 -9
- package/dist/renderables/flexStrip.d.ts +3 -2
- package/dist/renderables/flexStrip.js +6 -1
- package/dist/renderables/frames.d.ts +116 -0
- package/dist/renderables/frames.js +133 -0
- package/dist/renderables/group.d.ts +3 -2
- package/dist/renderables/group.js +5 -2
- package/dist/renderables/html-entities.d.ts +8 -0
- package/dist/renderables/html-entities.js +386 -0
- package/dist/renderables/layout.d.ts +3 -2
- package/dist/renderables/layout.js +15 -2
- package/dist/renderables/list-view.d.ts +3 -2
- package/dist/renderables/list-view.js +12 -5
- package/dist/renderables/live.d.ts +23 -7
- package/dist/renderables/live.js +69 -35
- package/dist/renderables/markdown-parse.d.ts +109 -0
- package/dist/renderables/markdown-parse.js +1421 -0
- package/dist/renderables/markdown-url.d.ts +19 -0
- package/dist/renderables/markdown-url.js +314 -0
- package/dist/renderables/markdown.d.ts +7 -6
- package/dist/renderables/markdown.js +363 -499
- package/dist/renderables/padding.d.ts +8 -20
- package/dist/renderables/padding.js +32 -50
- package/dist/renderables/panel.d.ts +26 -26
- package/dist/renderables/panel.js +67 -103
- package/dist/renderables/progress.d.ts +5 -3
- package/dist/renderables/progress.js +14 -3
- package/dist/renderables/progressBar.js +4 -4
- package/dist/renderables/python-space.d.ts +13 -0
- package/dist/renderables/python-space.js +24 -0
- package/dist/renderables/spinner.d.ts +73 -27
- package/dist/renderables/spinner.js +110 -51
- package/dist/renderables/status.d.ts +8 -3
- package/dist/renderables/status.js +8 -5
- package/dist/renderables/syntax.js +2 -1
- package/dist/renderables/table.d.ts +19 -11
- package/dist/renderables/table.js +140 -156
- package/dist/renderables/traceback.d.ts +1 -1
- package/dist/renderables/traceback.js +6 -5
- package/dist/renderables/tree.d.ts +6 -5
- package/dist/renderables/tree.js +11 -7
- package/dist/renderables/viewport.d.ts +13 -5
- package/dist/renderables/viewport.js +41 -20
- package/dist/template-bindings/animation-funcs.d.ts +37 -0
- package/dist/template-bindings/animation-funcs.js +83 -0
- package/dist/template-bindings/color-funcs.d.ts +13 -0
- package/dist/template-bindings/color-funcs.js +1 -1
- package/dist/template-bindings/helpers.d.ts +6 -0
- package/dist/template-bindings/helpers.js +12 -3
- package/dist/template-bindings/index.d.ts +6 -2
- package/dist/template-bindings/index.js +8 -3
- package/dist/themes/ramp.d.ts +18 -3
- package/dist/themes/ramp.js +23 -2
- package/dist/widgets/focus-manager.d.ts +21 -14
- package/dist/widgets/focus-manager.js +28 -29
- package/dist/widgets/index.d.ts +1 -1
- package/dist/widgets/static-item.d.ts +4 -3
- package/dist/widgets/static-item.js +9 -7
- package/dist/widgets/text-input.d.ts +28 -18
- package/dist/widgets/text-input.js +144 -101
- package/dist/widgets/widget-app.d.ts +19 -3
- package/dist/widgets/widget-app.js +39 -21
- package/dist/widgets/widget-base.js +0 -3
- package/package.json +2 -5
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* a slow glow, sunlight moving on water, the colours of daylight, fireflies, ink
|
|
11
11
|
* blooming in water, mist lifting — because a motion the eye recognises
|
|
12
12
|
* reads as calm and alive, where a motion it has to learn reads as a widget.
|
|
13
|
-
*
|
|
13
|
+
* One effect here is not ambience but a signal, and keeps none of this on
|
|
14
|
+
* purpose: `steppedInk` steps its ink through colours on a beat, the news
|
|
15
|
+
* that something is at its limit, and jumps from slot to slot where the
|
|
16
|
+
* loops hold still. What makes the loops' motions familiar is what every
|
|
17
|
+
* curve of theirs keeps:
|
|
14
18
|
*
|
|
15
19
|
* - Nothing jumps. Every curve is continuous in time, built from smooth
|
|
16
20
|
* noise (`core/noise.ts`) and smooth waveforms, so at one frame a second a cell
|
|
@@ -43,16 +47,17 @@
|
|
|
43
47
|
* (`examples/effects-playground/programs.ts`), on the published library.
|
|
44
48
|
*/
|
|
45
49
|
import { ColorRgba } from "../core/color.js";
|
|
46
|
-
import { type
|
|
50
|
+
import { type Timing } from "../core/easing.js";
|
|
47
51
|
import { type Drawn, type Effect, type EffectCell } from "./effect.js";
|
|
48
52
|
/** What a loop does to one colour at strength `w` in [0, 1]: at 0, nothing. */
|
|
49
53
|
export type Touch = (color: ColorRgba, w: number) => ColorRgba;
|
|
50
54
|
/**
|
|
51
|
-
* How strongly a loop acts at a moment `t` on each cell
|
|
52
|
-
* holds a field outside it to it.
|
|
53
|
-
* whole moment is worked out once,
|
|
55
|
+
* How strongly a loop acts at a moment `t` on each cell of a frame drawing
|
|
56
|
+
* what `Drawn` says, in [0, 1]; `onColors` holds a field outside it to it.
|
|
57
|
+
* Staged as `Effect` is: what holds for the whole moment is worked out once,
|
|
58
|
+
* then every cell is asked.
|
|
54
59
|
*/
|
|
55
|
-
export type Field = (t: number) => (cell: EffectCell) => number;
|
|
60
|
+
export type Field = (t: number, drawn: Drawn) => (cell: EffectCell) => number;
|
|
56
61
|
/** A looping effect: what it does to a colour, and where and when, how strongly. */
|
|
57
62
|
export interface Loop {
|
|
58
63
|
readonly touch: Touch;
|
|
@@ -79,9 +84,10 @@ export declare function shares({ pairs, depth, theme }: Drawn, colors: ReadonlyS
|
|
|
79
84
|
* A loop as an `Effect` on the element's own colours, by hex, wherever a cell
|
|
80
85
|
* shows them, each touched at its share of the cell's strength: the share
|
|
81
86
|
* `shares` settles for it against the pairs the element draws its words in
|
|
82
|
-
* (`Drawn`), touched as `Effected` writes them at the frame's depth —
|
|
83
|
-
*
|
|
84
|
-
* contrast it spends is that colour's
|
|
87
|
+
* (`Drawn`), touched as `Effected` writes them at the frame's depth — at 256
|
|
88
|
+
* colours a touched colour lands on a colour the slot can write, and the
|
|
89
|
+
* contrast it spends is that colour's; on a sixteen-colour terminal nothing
|
|
90
|
+
* moves (`stillOnSlots`). `colors` are the ones lit, by default every colour the element
|
|
85
91
|
* sets itself. A powerline strip's fill is the ground of its cells and the
|
|
86
92
|
* ink of the seam glyphs between them, so the arrow moves with the cell it
|
|
87
93
|
* points out of. A colour the terminal supplies (`EffectCell.terminal`) is
|
|
@@ -98,12 +104,14 @@ export declare function onColors(loop: Loop, colors?: ReadonlySet<string>): Effe
|
|
|
98
104
|
* says; a colour it gives none, and one the terminal supplies, stays as it is.
|
|
99
105
|
*/
|
|
100
106
|
export declare function atShares(loop: Loop, share: (drawn: Drawn) => ReadonlyMap<string, number>): Effect;
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
/**
|
|
108
|
+
* How the curves below are tuned: a `Timing` — seconds, a looping effect's
|
|
109
|
+
* period or a transition's duration, and an ease, intensity in [0, 1] to
|
|
110
|
+
* the fraction of `swing` applied; one that overshoots, as a CSS
|
|
111
|
+
* `cubic-bezier` may, saturates, since an effect never acts past its swing —
|
|
112
|
+
* and the swing itself.
|
|
113
|
+
*/
|
|
114
|
+
export interface Curve extends Timing {
|
|
107
115
|
/** How far the move goes at full intensity, in [0, 1]; what 1 means is the effect's. */
|
|
108
116
|
readonly swing: number;
|
|
109
117
|
}
|
|
@@ -116,32 +124,32 @@ export interface Curve {
|
|
|
116
124
|
export declare const EFFECT_CURVES: {
|
|
117
125
|
readonly shimmer: {
|
|
118
126
|
readonly seconds: 109;
|
|
119
|
-
readonly ease: Ease;
|
|
127
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
120
128
|
readonly swing: 0.9;
|
|
121
129
|
};
|
|
122
130
|
readonly pulse: {
|
|
123
131
|
readonly seconds: 43;
|
|
124
|
-
readonly ease: Ease;
|
|
132
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
125
133
|
readonly swing: 0.85;
|
|
126
134
|
};
|
|
127
135
|
readonly sparkle: {
|
|
128
136
|
readonly seconds: 139;
|
|
129
|
-
readonly ease: Ease;
|
|
137
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
130
138
|
readonly swing: 0.95;
|
|
131
139
|
};
|
|
132
140
|
readonly wheel: {
|
|
133
141
|
readonly seconds: 907;
|
|
134
|
-
readonly ease: Ease;
|
|
142
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
135
143
|
readonly swing: 1;
|
|
136
144
|
};
|
|
137
145
|
readonly fade: {
|
|
138
146
|
readonly seconds: 20;
|
|
139
|
-
readonly ease: Ease;
|
|
147
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
140
148
|
readonly swing: 1;
|
|
141
149
|
};
|
|
142
150
|
readonly dissolve: {
|
|
143
151
|
readonly seconds: 30;
|
|
144
|
-
readonly ease: Ease;
|
|
152
|
+
readonly ease: import("../core/easing.js").Ease;
|
|
145
153
|
readonly swing: 1;
|
|
146
154
|
};
|
|
147
155
|
};
|
|
@@ -177,8 +185,9 @@ export declare function pulse(curve: Curve, glow: ColorRgba, z: number): Loop;
|
|
|
177
185
|
/**
|
|
178
186
|
* Shimmer, as sunlight moving across water. Swing: how far into `light` the
|
|
179
187
|
* brightest glint goes, 0–1. A soft band of light, `width` columns either
|
|
180
|
-
* side of its centre, crosses
|
|
181
|
-
*
|
|
188
|
+
* side of its centre, crosses the element from the first column a frame
|
|
189
|
+
* lists (`Drawn.cells`) to the last, entering and leaving fully off it,
|
|
190
|
+
* `STRIDE` columns in about three quarters of a period. Its passes
|
|
182
191
|
* come the way light comes and goes on water as clouds move: while the sun
|
|
183
192
|
* is out they are bright and follow close on one another, one sometimes
|
|
184
193
|
* catching the last; under cloud they thin to faint ones with the row still
|
|
@@ -188,11 +197,17 @@ export declare function pulse(curve: Curve, glow: ColorRgba, z: number): Loop;
|
|
|
188
197
|
* on a slow current and re-forming as they go, so the glints dance while
|
|
189
198
|
* the band glides. Before the first pass enters, the row is untouched.
|
|
190
199
|
*/
|
|
191
|
-
export declare function shimmer(curve: Curve,
|
|
200
|
+
export declare function shimmer(curve: Curve, width: number, glow: ColorRgba, z: number): Loop;
|
|
192
201
|
/**
|
|
193
202
|
* Sparkle, as fireflies. Swing: how far into the firefly's `light` a glow
|
|
194
|
-
* goes at its brightest, 0–1.
|
|
195
|
-
*
|
|
203
|
+
* goes at its brightest, 0–1. Fireflies keep to a lattice laid from the
|
|
204
|
+
* element's first column and top row as a frame lists its cells
|
|
205
|
+
* (`Drawn.cells`): one every `PER` columns along a row of the lattice, a row
|
|
206
|
+
* of the lattice every `ROWS` rows, each firefly near a home of its own.
|
|
207
|
+
* The lattice does not hang on how wide or deep the element is, so one that
|
|
208
|
+
* grows or shrinks at its last column or bottom row moves no firefly; one
|
|
209
|
+
* whose first column moves, as centred words that change length do, carries
|
|
210
|
+
* its fireflies with it. A firefly flashes — kindles,
|
|
196
211
|
* drifts a few cells glowing, slowing as it fades — then flies on in the
|
|
197
212
|
* dark and flashes again somewhere a few cells off, the way fireflies at
|
|
198
213
|
* dusk are seen: a short lit stroke, then gone, each time a little
|
|
@@ -203,13 +218,14 @@ export declare function shimmer(curve: Curve, span: number, width: number, glow:
|
|
|
203
218
|
* turn: its brightest flash, rise and fall, takes `FLASH` of it, and a
|
|
204
219
|
* dimmer one less.
|
|
205
220
|
*/
|
|
206
|
-
export declare function sparkle(curve: Curve,
|
|
221
|
+
export declare function sparkle(curve: Curve, glow: ColorRgba, z: number): Loop;
|
|
207
222
|
/**
|
|
208
|
-
* How much of each cell shows at `t
|
|
209
|
-
* gone to the terminal's ground. Read per
|
|
210
|
-
* apart, and staged as `
|
|
223
|
+
* How much of each cell shows at `t` in a frame drawing what `Drawn` says: 1
|
|
224
|
+
* is the cell as drawn, 0 is the cell gone to the terminal's ground. Read per
|
|
225
|
+
* cell, so cells can arrive or leave apart, and staged as `Effect` is. One
|
|
226
|
+
* outside [0, 1] is held to it.
|
|
211
227
|
*/
|
|
212
|
-
export type Visibility = (t: number) => (cell: EffectCell) => number;
|
|
228
|
+
export type Visibility = (t: number, drawn: Drawn) => (cell: EffectCell) => number;
|
|
213
229
|
/**
|
|
214
230
|
* A cell mixed toward the ground of the terminal the frame is drawn on
|
|
215
231
|
* (`Drawn.theme`) by how hidden it is: its fill toward the ground, and its ink
|
|
@@ -225,6 +241,8 @@ export declare function veiled(visibility: Visibility, swing: number): Effect;
|
|
|
225
241
|
* draws it at the time since it began. `done(t)` is true from the moment
|
|
226
242
|
* every cell has arrived or gone, so the caller knows when to stop drawing an
|
|
227
243
|
* element that is leaving, or to drop the effect from one that has arrived.
|
|
244
|
+
* Until then the effect's frame changes every frame, and from then never:
|
|
245
|
+
* its `nextChange` is `done` read as a time. [LAW:one-source-of-truth]
|
|
228
246
|
*/
|
|
229
247
|
export interface Transition {
|
|
230
248
|
readonly effect: Effect;
|
|
@@ -259,19 +277,50 @@ export declare function dissolveOut(curve: Curve, z: number): Transition;
|
|
|
259
277
|
* together; on the terminal's ground, a run of text's ink is a segment of
|
|
260
278
|
* its own. A segment's stray is slow noise of its own, at `STRAY_PERIODS`,
|
|
261
279
|
* so no two keep step, and the row never shows one spread of hues twice.
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
280
|
+
* A colour keeps its luminance as it turns (`hueTurned`), so every pair of
|
|
281
|
+
* words reads at the contrast it rested at; at 256 colours a turned colour
|
|
282
|
+
* lands on a colour the depth writes, one that keeps every pair of words it
|
|
283
|
+
* is drawn in at its floor (`floorOf`) — its resting contrast or WCAG AA,
|
|
284
|
+
* whichever is lower — as `shares` keeps the light's (`turnedBounds`). The
|
|
285
|
+
* turn only happens to the element's own colours (`Drawn.colors`), never the
|
|
286
|
+
* terminal's. On a sixteen-colour terminal nothing turns (`stillOnSlots`).
|
|
265
287
|
*/
|
|
266
288
|
export declare function wheel(curve: Curve, z: number): Effect;
|
|
289
|
+
/** One step of a signal: the ink it draws, and how long it is held, in seconds. */
|
|
290
|
+
export interface ColorStep {
|
|
291
|
+
readonly color: ColorRgba;
|
|
292
|
+
readonly seconds: number;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A signal: every cell's ink stepping through `steps`' colours on a beat,
|
|
296
|
+
* one colour a hold, looping, for the time it is handed — a gauge's
|
|
297
|
+
* chevrons in bright changing colours. The ground is left as the cell draws
|
|
298
|
+
* it, and the words stay legible on it: each step's ink is written as the
|
|
299
|
+
* colour nearest the step's (OKLab's ΔE) that the depth draws and that
|
|
300
|
+
* reads on the cell's ground, as `Effected` writes it, at the cell's floor
|
|
301
|
+
* (`floorOf`) — its resting contrast or `LEGIBLE`, whichever is lower, the
|
|
302
|
+
* floor every loop here keeps. In truecolor that is the step itself, or its
|
|
303
|
+
* hue and chroma at the lightness nearest it that reaches the floor
|
|
304
|
+
* (`ensureContrast`, the one slide a template's `readableOn` makes too);
|
|
305
|
+
* below truecolor, the nearest of the colours the depth has an index for, so on a
|
|
306
|
+
* sixteen-colour terminal it steps from slot to slot, the one effect here
|
|
307
|
+
* that does (`stillOnSlots`). A cell whose ground no offered colour reads
|
|
308
|
+
* on keeps the ink it rested in.
|
|
309
|
+
*
|
|
310
|
+
* The search is settled once for each ink, ground and step, so a frame
|
|
311
|
+
* inside a step redoes none, and nor does a later pass of the beat: at sixty
|
|
312
|
+
* frames a second a one-second step is sixty identical frames, and the
|
|
313
|
+
* frame changes when the beat does: the signal is the beat mapped to inks.
|
|
314
|
+
* [LAW:no-ambient-temporal-coupling] The beat is `core/easing.ts`'s, and
|
|
315
|
+
* nothing here reads a clock.
|
|
316
|
+
*/
|
|
317
|
+
export declare function steppedInk(steps: readonly ColorStep[]): Effect;
|
|
267
318
|
/**
|
|
268
|
-
* What a catalogue effect is made for: the element it is drawn on,
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* lockstep.
|
|
319
|
+
* What a catalogue effect is made for: the element it is drawn on, at `z` in
|
|
320
|
+
* the noise, so two elements under one effect do not move in lockstep. How
|
|
321
|
+
* wide the element is, the effect reads off each frame (`Drawn.cells`).
|
|
272
322
|
*/
|
|
273
323
|
export interface EffectTarget {
|
|
274
|
-
readonly span: number;
|
|
275
324
|
readonly z: number;
|
|
276
325
|
}
|
|
277
326
|
/** The names of the effects that loop. */
|