@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.
- package/README.md +7 -7
- package/dist/core/animation.d.ts +37 -37
- package/dist/core/animation.js +61 -61
- package/dist/core/ansi.d.ts +4 -4
- package/dist/core/ansi.js +9 -9
- package/dist/core/bidi.js +6 -6
- package/dist/core/cells.d.ts +1 -1
- package/dist/core/cells.js +5 -5
- package/dist/core/clock.d.ts +1 -1
- package/dist/core/color.d.ts +50 -50
- package/dist/core/color.js +69 -69
- package/dist/core/console.d.ts +8 -8
- package/dist/core/console.js +5 -5
- package/dist/core/control-codes.d.ts +3 -3
- package/dist/core/control-codes.js +7 -7
- package/dist/core/easing.d.ts +40 -40
- package/dist/core/easing.js +40 -40
- package/dist/core/env.d.ts +1 -1
- package/dist/core/env.js +1 -1
- package/dist/core/export-html.js +1 -1
- package/dist/core/export-lines.d.ts +11 -11
- package/dist/core/export-lines.js +12 -12
- package/dist/core/export-svg.d.ts +3 -3
- package/dist/core/export-svg.js +4 -4
- package/dist/core/markup.js +1 -1
- package/dist/core/memo.d.ts +1 -1
- package/dist/core/memo.js +1 -1
- package/dist/core/oklch.d.ts +14 -14
- package/dist/core/oklch.js +10 -10
- package/dist/core/orient.d.ts +3 -3
- package/dist/core/orient.js +3 -3
- package/dist/core/paint.d.ts +9 -9
- package/dist/core/paint.js +3 -3
- package/dist/core/pretty.d.ts +1 -1
- package/dist/core/pretty.js +3 -3
- package/dist/core/protocol.d.ts +26 -26
- package/dist/core/protocol.js +22 -22
- package/dist/core/render.d.ts +11 -11
- package/dist/core/render.js +12 -12
- package/dist/core/segment.d.ts +3 -3
- package/dist/core/segment.js +5 -5
- package/dist/core/strip.d.ts +83 -83
- package/dist/core/strip.js +70 -70
- package/dist/core/style.d.ts +20 -20
- package/dist/core/style.js +55 -55
- package/dist/core/text.d.ts +2 -2
- package/dist/core/text.js +5 -5
- package/dist/core/timeline.d.ts +5 -5
- package/dist/core/timeline.js +9 -9
- package/dist/core/tween.d.ts +6 -6
- package/dist/core/tween.js +10 -10
- package/dist/core/view.d.ts +4 -4
- package/dist/core/view.js +12 -12
- package/dist/host/app.d.ts +9 -9
- package/dist/host/app.js +12 -12
- package/dist/host/host-environment.d.ts +2 -2
- package/dist/host/host-environment.js +2 -2
- package/dist/host/index.d.ts +2 -2
- package/dist/host/input.d.ts +7 -7
- package/dist/host/input.js +4 -4
- package/dist/host/terminal-colors.d.ts +2 -2
- package/dist/host/terminal-colors.js +4 -4
- package/dist/host/terminal-host.d.ts +2 -2
- package/dist/host/terminal-host.js +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.js +10 -10
- package/dist/node/prompt.d.ts +1 -1
- package/dist/node/prompt.js +1 -1
- package/dist/node/terminal-host.d.ts +1 -1
- package/dist/node/traceback.js +2 -2
- package/dist/renderables/change.js +2 -2
- package/dist/renderables/effect.d.ts +39 -39
- package/dist/renderables/effect.js +45 -45
- package/dist/renderables/effects.d.ts +81 -81
- package/dist/renderables/effects.js +157 -157
- package/dist/renderables/embed.d.ts +1 -1
- package/dist/renderables/embed.js +2 -2
- package/dist/renderables/flexStrip.d.ts +7 -7
- package/dist/renderables/flexStrip.js +15 -15
- package/dist/renderables/frames.d.ts +6 -6
- package/dist/renderables/frames.js +11 -11
- package/dist/renderables/glyph-effect.d.ts +15 -15
- package/dist/renderables/glyph-effect.js +17 -17
- package/dist/renderables/glyph-effects.d.ts +7 -7
- package/dist/renderables/glyph-effects.js +16 -16
- package/dist/renderables/html-entities.d.ts +1 -1
- package/dist/renderables/html-entities.js +1 -1
- package/dist/renderables/lifecycle.d.ts +4 -4
- package/dist/renderables/lifecycle.js +12 -12
- package/dist/renderables/live.d.ts +2 -2
- package/dist/renderables/live.js +7 -7
- package/dist/renderables/markdown-parse.js +3 -3
- package/dist/renderables/panel.js +3 -3
- package/dist/renderables/progress.d.ts +1 -1
- package/dist/renderables/progress.js +1 -1
- package/dist/renderables/progressBar.d.ts +1 -1
- package/dist/renderables/progressBar.js +6 -6
- package/dist/renderables/prompt.d.ts +1 -1
- package/dist/renderables/scroll.d.ts +1 -1
- package/dist/renderables/scroll.js +3 -3
- package/dist/renderables/spinner.d.ts +4 -4
- package/dist/renderables/spinner.js +10 -10
- package/dist/renderables/syntax.d.ts +2 -2
- package/dist/renderables/syntax.js +2 -2
- package/dist/renderables/table.js +3 -3
- package/dist/renderables/traceback.d.ts +1 -1
- package/dist/renderables/traceback.js +1 -1
- package/dist/renderables/tree.js +3 -3
- package/dist/template-bindings/animation-funcs.d.ts +14 -14
- package/dist/template-bindings/animation-funcs.js +27 -27
- package/dist/template-bindings/color-funcs.d.ts +14 -14
- package/dist/template-bindings/color-funcs.js +25 -25
- package/dist/template-bindings/index.d.ts +9 -9
- package/dist/template-bindings/index.js +9 -9
- package/dist/template-bindings/palette-funcs.d.ts +1 -1
- package/dist/template-bindings/palette-funcs.js +3 -3
- package/dist/template-bindings/style-funcs.d.ts +5 -5
- package/dist/template-bindings/style-funcs.js +16 -16
- package/dist/themes/{transpose.d.ts → adjust.d.ts} +23 -23
- package/dist/themes/{transpose.js → adjust.js} +28 -28
- package/dist/themes/buildPalette.d.ts +3 -3
- package/dist/themes/buildPalette.js +20 -20
- package/dist/themes/colorMath.d.ts +16 -16
- package/dist/themes/colorMath.js +32 -32
- package/dist/themes/data/ansi-tables.d.ts +2 -2
- package/dist/themes/data/ansi-tables.js +2 -2
- package/dist/themes/data/types.d.ts +4 -4
- package/dist/themes/data/types.js +2 -2
- package/dist/themes/palette.d.ts +12 -12
- package/dist/themes/palette.js +16 -16
- package/dist/themes/ramp.d.ts +17 -17
- package/dist/themes/ramp.js +12 -12
- package/dist/themes/registry.js +4 -4
- package/dist/themes/terminalThemes.d.ts +1 -1
- package/dist/themes/terminalThemes.js +1 -1
- package/dist/widgets/button.d.ts +2 -2
- package/dist/widgets/button.js +4 -4
- package/dist/widgets/checkbox.d.ts +2 -2
- package/dist/widgets/checkbox.js +2 -2
- package/dist/widgets/dropdown.d.ts +2 -2
- package/dist/widgets/dropdown.js +3 -3
- package/dist/widgets/event-router.d.ts +6 -6
- package/dist/widgets/event-router.js +2 -2
- package/dist/widgets/focus-manager.d.ts +3 -3
- package/dist/widgets/focus-manager.js +3 -3
- package/dist/widgets/index.d.ts +2 -2
- package/dist/widgets/index.js +1 -1
- package/dist/widgets/ink.d.ts +3 -3
- package/dist/widgets/ink.js +4 -4
- package/dist/widgets/slider.d.ts +2 -2
- package/dist/widgets/static-item.d.ts +2 -2
- package/dist/widgets/text-input.d.ts +2 -2
- package/dist/widgets/text-input.js +5 -5
- package/dist/widgets/themed-widget.js +1 -1
- package/dist/widgets/toggle.d.ts +3 -3
- package/dist/widgets/toggle.js +3 -3
- package/dist/widgets/types.d.ts +6 -6
- package/dist/widgets/types.js +2 -2
- package/dist/widgets/widget-app.d.ts +10 -10
- package/dist/widgets/widget-app.js +8 -8
- package/dist/widgets/widget-base.d.ts +2 -2
- package/package.json +1 -1
package/dist/host/app.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { type HostFrame, type FrameHost } from "../core/protocol.js";
|
|
|
39
39
|
import type { Unsubscribe } from "../core/subscription.js";
|
|
40
40
|
import { Timeline } from "../core/timeline.js";
|
|
41
41
|
import { type View } from "../core/view.js";
|
|
42
|
-
import { type
|
|
42
|
+
import { type KeyEvent, type TerminalMouseEvent, type TerminalReply } from "./input.js";
|
|
43
43
|
import type { TerminalHost } from "./terminal-host.js";
|
|
44
44
|
/**
|
|
45
45
|
* Where an app is in its life. `idle` has not run; `running` holds the
|
|
@@ -89,7 +89,7 @@ export interface AppOptions extends DrawOptions {
|
|
|
89
89
|
* A turn of the wheel, where the pointer was when it turned: `lines` is
|
|
90
90
|
* positive towards the end of the content, a line a notch.
|
|
91
91
|
*/
|
|
92
|
-
export interface
|
|
92
|
+
export interface WheelEvent {
|
|
93
93
|
readonly x: number;
|
|
94
94
|
readonly y: number;
|
|
95
95
|
readonly lines: number;
|
|
@@ -98,11 +98,11 @@ declare const WHEEL_LINES: {
|
|
|
98
98
|
readonly scroll_up: -1;
|
|
99
99
|
readonly scroll_down: 1;
|
|
100
100
|
};
|
|
101
|
-
type WheelTurn = Extract<
|
|
101
|
+
type WheelTurn = Extract<TerminalMouseEvent, {
|
|
102
102
|
type: keyof typeof WHEEL_LINES;
|
|
103
103
|
}>;
|
|
104
104
|
/** A pointer event `onMouse` hears: every one but the vertical wheel, which is `onWheel`'s. */
|
|
105
|
-
export type AppMouseEvent = Exclude<
|
|
105
|
+
export type AppMouseEvent = Exclude<TerminalMouseEvent, WheelTurn>;
|
|
106
106
|
/**
|
|
107
107
|
* How an ask ended, with the replies heard before it did. `answered`: the
|
|
108
108
|
* terminal answered DA1, so a query with no reply among `replies` is one it
|
|
@@ -148,8 +148,8 @@ export declare class App implements FrameHost {
|
|
|
148
148
|
private settle;
|
|
149
149
|
constructor(options: AppOptions);
|
|
150
150
|
/**
|
|
151
|
-
* The terminal the app draws on: the
|
|
152
|
-
* in, and the sixteen an ANSI
|
|
151
|
+
* The terminal the app draws on: the colors a cell that sets none is drawn
|
|
152
|
+
* in, and the sixteen an ANSI color names — as given, or as the color
|
|
153
153
|
* depth assumes (`resolveTerminal`).
|
|
154
154
|
*/
|
|
155
155
|
get terminal(): TerminalColors;
|
|
@@ -226,10 +226,10 @@ export declare class App implements FrameHost {
|
|
|
226
226
|
*/
|
|
227
227
|
onPaint(handler: (frame: readonly (readonly Segment[])[]) => void): Unsubscribe;
|
|
228
228
|
/**
|
|
229
|
-
* Hear every key the app does not quit on, by the `
|
|
229
|
+
* Hear every key the app does not quit on, by the `KeyEvent` the terminal
|
|
230
230
|
* reported; `keyName` names it. A handler that throws fails the app.
|
|
231
231
|
*/
|
|
232
|
-
onKey(handler: (press:
|
|
232
|
+
onKey(handler: (press: KeyEvent) => void): Unsubscribe;
|
|
233
233
|
/**
|
|
234
234
|
* Hear every pointer event but the vertical wheel, which is `onWheel`'s,
|
|
235
235
|
* in terminal cells. Only the alternate surface reports the pointer. A
|
|
@@ -244,7 +244,7 @@ export declare class App implements FrameHost {
|
|
|
244
244
|
* and the first that moves something takes it. A handler that throws fails
|
|
245
245
|
* the app.
|
|
246
246
|
*/
|
|
247
|
-
onWheel(handler: (wheel:
|
|
247
|
+
onWheel(handler: (wheel: WheelEvent) => boolean): Unsubscribe;
|
|
248
248
|
/** Hand the terminal back for good; `run` resolves. */
|
|
249
249
|
stop(): void;
|
|
250
250
|
/**
|
package/dist/host/app.js
CHANGED
|
@@ -34,17 +34,17 @@ import { frameRate, systemClock } from "../core/clock.js";
|
|
|
34
34
|
import { ColorDepth, resolveTerminal } from "../core/color.js";
|
|
35
35
|
import { Console } from "../core/console.js";
|
|
36
36
|
import { Segment } from "../core/segment.js";
|
|
37
|
-
import {
|
|
37
|
+
import { SurfaceRenderer } from "../core/paint.js";
|
|
38
38
|
import { fitHeight, render } from "../core/protocol.js";
|
|
39
39
|
import { Timeline } from "../core/timeline.js";
|
|
40
40
|
import { drawView, frameNow, hostView, undrawn } from "../core/view.js";
|
|
41
41
|
import { hostEnvironment } from "./host-environment.js";
|
|
42
42
|
import { InputParser, keyName, parseKeyName } from "./input.js";
|
|
43
43
|
// [LAW:one-source-of-truth] How a frame draws — its glyphs, the terminal its
|
|
44
|
-
//
|
|
44
|
+
// colors resolve on, the style names it knows, what happens to a style it
|
|
45
45
|
// cannot resolve, markup and highlighting — is the console's to say, so App takes those options as the
|
|
46
46
|
// console declares them. This list is both the type and what is copied: the
|
|
47
|
-
// host alone decides the console's size,
|
|
47
|
+
// host alone decides the console's size, colors and sink, so no other
|
|
48
48
|
// property of the options object reaches it, whatever the object carries.
|
|
49
49
|
const DRAW_OPTIONS = ["asciiOnly", "reducedMotion", "textOrder", "terminal", "theme", "onStyleError", "markup", "highlight", "highlighter"];
|
|
50
50
|
function drawOptions(options) {
|
|
@@ -91,10 +91,10 @@ export class App {
|
|
|
91
91
|
// What the frame on screen says about when it changes, on the clock.
|
|
92
92
|
// Before a frame, nothing.
|
|
93
93
|
said = undrawn(0);
|
|
94
|
-
// The one wait for the frame's `
|
|
94
|
+
// The one wait for the frame's `validUntil`, armed after each frame.
|
|
95
95
|
waking = null;
|
|
96
96
|
// [LAW:one-source-of-truth] The host is the console's whole environment:
|
|
97
|
-
// its size, its
|
|
97
|
+
// its size, its colors, where bytes go. Every frame renders with this
|
|
98
98
|
// console's options and is encoded for its destination.
|
|
99
99
|
console;
|
|
100
100
|
drawing;
|
|
@@ -122,7 +122,7 @@ export class App {
|
|
|
122
122
|
this.host = options.host;
|
|
123
123
|
this.input = new InputParser({ key: (press) => this.key(press), mouse: (event) => this.mouse(event), reply: (reply) => this.reply(reply) }, options.host.inputChunks);
|
|
124
124
|
this.surface = options.surface;
|
|
125
|
-
this.painter = new
|
|
125
|
+
this.painter = new SurfaceRenderer(options.surface, (bytes) => this.host.write(bytes));
|
|
126
126
|
this.view = hostView(options.view);
|
|
127
127
|
this._clock = options.clock ?? systemClock();
|
|
128
128
|
this._epoch = this._clock.now();
|
|
@@ -133,8 +133,8 @@ export class App {
|
|
|
133
133
|
this.console = this.drawingConsole();
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
|
-
* The terminal the app draws on: the
|
|
137
|
-
* in, and the sixteen an ANSI
|
|
136
|
+
* The terminal the app draws on: the colors a cell that sets none is drawn
|
|
137
|
+
* in, and the sixteen an ANSI color names — as given, or as the color
|
|
138
138
|
* depth assumes (`resolveTerminal`).
|
|
139
139
|
*/
|
|
140
140
|
get terminal() {
|
|
@@ -348,7 +348,7 @@ export class App {
|
|
|
348
348
|
return () => this.paintHandlers.delete(handler);
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
|
-
* Hear every key the app does not quit on, by the `
|
|
351
|
+
* Hear every key the app does not quit on, by the `KeyEvent` the terminal
|
|
352
352
|
* reported; `keyName` names it. A handler that throws fails the app.
|
|
353
353
|
*/
|
|
354
354
|
onKey(handler) {
|
|
@@ -488,8 +488,8 @@ export class App {
|
|
|
488
488
|
// says whether the view moves.
|
|
489
489
|
tick() {
|
|
490
490
|
const running = this._phase === "running";
|
|
491
|
-
const { t,
|
|
492
|
-
const wanted = running &&
|
|
491
|
+
const { t, validUntil } = this.said;
|
|
492
|
+
const wanted = running && validUntil === t;
|
|
493
493
|
if (this.ticking !== null && (!wanted || this.ticking.rate.perSecond !== this._rate.perSecond)) {
|
|
494
494
|
this.ticking.stop();
|
|
495
495
|
this.ticking = null;
|
|
@@ -498,7 +498,7 @@ export class App {
|
|
|
498
498
|
this.ticking = { rate: this._rate, stop: this._clock.every(this._rate, () => this.paint()) };
|
|
499
499
|
}
|
|
500
500
|
this.waking?.();
|
|
501
|
-
this.waking = running && t <
|
|
501
|
+
this.waking = running && t < validUntil && validUntil < Number.POSITIVE_INFINITY ? this._clock.at(validUntil, () => this.paint()) : null;
|
|
502
502
|
}
|
|
503
503
|
// [LAW:no-silent-failure] A frame that throws ends the app with that
|
|
504
504
|
// error: the terminal is handed back, and `run` rejects with it.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* [LAW:one-source-of-truth] A console asks its destination four things: where
|
|
7
7
|
* bytes go, is it a terminal, how big is it, and — through the environment —
|
|
8
|
-
* what
|
|
8
|
+
* what colors it draws. A bare sink answers only the first, and the other
|
|
9
9
|
* three fall to the ambient `process`: some other stream's answer in node,
|
|
10
10
|
* none in a browser, where a console on xterm.js saw an unnamed TTY and drew
|
|
11
|
-
* 16
|
|
11
|
+
* 16 colors. Handing the console the whole environment keeps all four
|
|
12
12
|
* answers the host's.
|
|
13
13
|
*
|
|
14
14
|
* The host's size is `size()`, so the environment handed on carries no
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* [LAW:one-source-of-truth] A console asks its destination four things: where
|
|
7
7
|
* bytes go, is it a terminal, how big is it, and — through the environment —
|
|
8
|
-
* what
|
|
8
|
+
* what colors it draws. A bare sink answers only the first, and the other
|
|
9
9
|
* three fall to the ambient `process`: some other stream's answer in node,
|
|
10
10
|
* none in a browser, where a console on xterm.js saw an unnamed TTY and drew
|
|
11
|
-
* 16
|
|
11
|
+
* 16 colors. Handing the console the whole environment keeps all four
|
|
12
12
|
* answers the host's.
|
|
13
13
|
*
|
|
14
14
|
* The host's size is `size()`, so the environment handed on carries no
|
package/dist/host/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { BrowserTerminalHost } from "./terminal-host.js";
|
|
|
2
2
|
export type { TerminalHost, TerminalSize, DataHandler, InputChunks, ResizeHandler, ExitHandler, BrowserTerminalHostOptions, XtermTerminal, XtermDisposable, XtermResizeEvent, } from "./terminal-host.js";
|
|
3
3
|
export { hostEnvironment } from "./host-environment.js";
|
|
4
4
|
export { App } from "./app.js";
|
|
5
|
-
export type { AppMouseEvent, AppOptions, AppPhase, Asked, AskOptions,
|
|
5
|
+
export type { AppMouseEvent, AppOptions, AppPhase, Asked, AskOptions, WheelEvent } from "./app.js";
|
|
6
6
|
export { terminalColors } from "./terminal-colors.js";
|
|
7
7
|
export type { Surface } from "../core/paint.js";
|
|
8
8
|
export { keyName } from "./input.js";
|
|
9
|
-
export type {
|
|
9
|
+
export type { KeyEvent, TerminalMouseEvent, TerminalReply } from "./input.js";
|
package/dist/host/input.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Terminal input: the bytes a terminal sends for keys and the pointer,
|
|
3
|
-
* parsed into `
|
|
3
|
+
* parsed into `KeyEvent` and `TerminalMouseEvent` values, and the one name
|
|
4
4
|
* each key goes by.
|
|
5
5
|
*
|
|
6
6
|
* [LAW:single-enforcer] Escape-sequence parsing lives only here. `App` owns
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
*/
|
|
43
43
|
import type { InputChunks } from "./terminal-host.js";
|
|
44
44
|
/** A key as the terminal reported it: plain data, with no say over who hears it. */
|
|
45
|
-
export interface
|
|
45
|
+
export interface KeyEvent {
|
|
46
46
|
readonly key: string;
|
|
47
47
|
/** The printable character the key types, or "" for a key that types none. */
|
|
48
48
|
readonly character: string;
|
|
@@ -50,7 +50,7 @@ export interface KeyPress {
|
|
|
50
50
|
readonly ctrl: boolean;
|
|
51
51
|
readonly meta: boolean;
|
|
52
52
|
}
|
|
53
|
-
export type
|
|
53
|
+
export type TerminalMouseEvent = {
|
|
54
54
|
[T in MouseEventType]: MouseEventOf<T>;
|
|
55
55
|
}[MouseEventType];
|
|
56
56
|
type MouseEventType = "mouse_down" | "mouse_up" | "mouse_move" | "scroll_up" | "scroll_down" | "scroll_left" | "scroll_right";
|
|
@@ -70,7 +70,7 @@ interface MouseEventOf<Type extends string> {
|
|
|
70
70
|
* `ctrl+c`, `shift+tab`, `meta+left`. Shift is not named on a character,
|
|
71
71
|
* which already carries it: Shift+G is `G`.
|
|
72
72
|
*/
|
|
73
|
-
export declare function keyName(press:
|
|
73
|
+
export declare function keyName(press: KeyEvent): string;
|
|
74
74
|
/**
|
|
75
75
|
* What a terminal sends back when it is asked something: an OSC, DCS or APC
|
|
76
76
|
* string, its introducer and terminator taken off (`11;rgb:1e1e/1e1e/1e1e`
|
|
@@ -84,8 +84,8 @@ export interface TerminalReply {
|
|
|
84
84
|
}
|
|
85
85
|
/** Where a parser delivers what it parses. */
|
|
86
86
|
export interface InputSink {
|
|
87
|
-
key(press:
|
|
88
|
-
mouse(event:
|
|
87
|
+
key(press: KeyEvent): void;
|
|
88
|
+
mouse(event: TerminalMouseEvent): void;
|
|
89
89
|
reply(reply: TerminalReply): void;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -114,7 +114,7 @@ export declare class InputParser {
|
|
|
114
114
|
/** Feed a chunk of bytes (or a string of them) into the parser. */
|
|
115
115
|
feed(chunk: Uint8Array | string): void;
|
|
116
116
|
private drainAndHold;
|
|
117
|
-
private
|
|
117
|
+
private validity;
|
|
118
118
|
/**
|
|
119
119
|
* Whether an ask is awaiting the terminal's replies, told by whoever asks
|
|
120
120
|
* at the ask's start and end. Only while one is does an unfinished
|
package/dist/host/input.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Terminal input: the bytes a terminal sends for keys and the pointer,
|
|
3
|
-
* parsed into `
|
|
3
|
+
* parsed into `KeyEvent` and `TerminalMouseEvent` values, and the one name
|
|
4
4
|
* each key goes by.
|
|
5
5
|
*
|
|
6
6
|
* [LAW:single-enforcer] Escape-sequence parsing lives only here. `App` owns
|
|
@@ -250,7 +250,7 @@ export class InputParser {
|
|
|
250
250
|
this.drainFully();
|
|
251
251
|
}
|
|
252
252
|
finally {
|
|
253
|
-
this.
|
|
253
|
+
this.validity();
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
// [LAW:no-ambient-temporal-coupling] Whatever drain leaves at an ESC is an
|
|
@@ -264,7 +264,7 @@ export class InputParser {
|
|
|
264
264
|
// While a reply may arrive the delay settles no hold that may open one: a
|
|
265
265
|
// reply split over a slow link may take longer than it. The wait's end arms
|
|
266
266
|
// it afresh (`awaitReplies`), so what is held then gets the whole delay.
|
|
267
|
-
|
|
267
|
+
validity() {
|
|
268
268
|
this.cancelEscape();
|
|
269
269
|
if (this.buffer[0] !== ESC)
|
|
270
270
|
return;
|
|
@@ -285,7 +285,7 @@ export class InputParser {
|
|
|
285
285
|
awaitReplies(awaiting) {
|
|
286
286
|
this.awaiting = awaiting;
|
|
287
287
|
if (!awaiting && this.chunks === "split")
|
|
288
|
-
this.
|
|
288
|
+
this.validity();
|
|
289
289
|
}
|
|
290
290
|
// [LAW:single-enforcer] The one reading of whether an unfinished control
|
|
291
291
|
// string may be a reply still arriving: only a split host splits one, and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The terminal's own foreground and background, asked of it with OSC 10 and
|
|
3
|
-
* OSC 11 — the
|
|
3
|
+
* OSC 11 — the colors every contrast decision is measured against, which the
|
|
4
4
|
* library otherwise has to assume.
|
|
5
5
|
*
|
|
6
6
|
* [LAW:effects-at-boundaries] The ask is `App`'s, the one reader of its
|
|
@@ -11,7 +11,7 @@ import { TerminalColors } from "../core/color.js";
|
|
|
11
11
|
import type { App } from "./app.js";
|
|
12
12
|
/**
|
|
13
13
|
* Ask the terminal `app` runs on for its foreground and background, and return
|
|
14
|
-
* the terminal `app` draws on with them in place — its sixteen ANSI
|
|
14
|
+
* the terminal `app` draws on with them in place — its sixteen ANSI colors
|
|
15
15
|
* kept, since nothing asks for those. `undefined` when the terminal did not
|
|
16
16
|
* answer both, so the caller keeps what it had. Set it as `app.terminal`.
|
|
17
17
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The terminal's own foreground and background, asked of it with OSC 10 and
|
|
3
|
-
* OSC 11 — the
|
|
3
|
+
* OSC 11 — the colors every contrast decision is measured against, which the
|
|
4
4
|
* library otherwise has to assume.
|
|
5
5
|
*
|
|
6
6
|
* [LAW:effects-at-boundaries] The ask is `App`'s, the one reader of its
|
|
@@ -13,12 +13,12 @@ import { pattern } from "../core/pattern.js";
|
|
|
13
13
|
const QUERIES = ["\x1b]10;?\x1b\\", "\x1b]11;?\x1b\\"];
|
|
14
14
|
// XParseColor's `rgb:` form, 1–4 hex digits a channel, as xterm and every
|
|
15
15
|
// terminal that copies it answers, or `rgba:`, as urxvt answers with
|
|
16
|
-
// transparency on; the alpha says nothing about the
|
|
16
|
+
// transparency on; the alpha says nothing about the color a cell is drawn in.
|
|
17
17
|
const RGB = pattern(/^rgba?:([0-9a-f]{1,4})\/([0-9a-f]{1,4})\/([0-9a-f]{1,4})(?:\/[0-9a-f]{1,4})?$/i);
|
|
18
18
|
// A channel of n hex digits is a fraction of 16ⁿ − 1, scaled to 8 bits.
|
|
19
19
|
const channel = (hex) => Math.round((parseInt(hex, 16) / (16 ** hex.length - 1)) * 255);
|
|
20
20
|
/**
|
|
21
|
-
* The
|
|
21
|
+
* The color an OSC 10 or OSC 11 reply reports, or `undefined` when `reply`
|
|
22
22
|
* is not that answer to `slot`.
|
|
23
23
|
*/
|
|
24
24
|
function parseColorReply(reply, slot) {
|
|
@@ -32,7 +32,7 @@ function parseColorReply(reply, slot) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Ask the terminal `app` runs on for its foreground and background, and return
|
|
35
|
-
* the terminal `app` draws on with them in place — its sixteen ANSI
|
|
35
|
+
* the terminal `app` draws on with them in place — its sixteen ANSI colors
|
|
36
36
|
* kept, since nothing asks for those. `undefined` when the terminal did not
|
|
37
37
|
* answer both, so the caller keeps what it had. Set it as `app.terminal`.
|
|
38
38
|
*/
|
|
@@ -96,13 +96,13 @@ export interface TerminalHost {
|
|
|
96
96
|
readonly isTTY: boolean;
|
|
97
97
|
/**
|
|
98
98
|
* Whether the bytes `write` sends land on a terminal, whatever the input
|
|
99
|
-
* is.
|
|
99
|
+
* is. Color detection asks this: a program with piped stdin and a terminal
|
|
100
100
|
* stdout still draws on a terminal, and `isTTY` would call it plain.
|
|
101
101
|
*/
|
|
102
102
|
readonly writesToTerminal: boolean;
|
|
103
103
|
/**
|
|
104
104
|
* The environment a program running on this terminal sees — `TERM`,
|
|
105
|
-
* `COLORTERM`, `NO_COLOR` and the rest.
|
|
105
|
+
* `COLORTERM`, `NO_COLOR` and the rest. Color detection reads it: what a
|
|
106
106
|
* terminal can draw is a fact about the host, so it travels with the host
|
|
107
107
|
* rather than being read off whatever `process` the renderer happens to
|
|
108
108
|
* share a runtime with, which in a browser is none.
|
|
@@ -64,7 +64,7 @@ export class BrowserTerminalHost {
|
|
|
64
64
|
}
|
|
65
65
|
// What xterm.js is, stated the way a terminal states it: it identifies as
|
|
66
66
|
// `xterm-256color` and draws 24-bit SGR. With no env at all, detection saw
|
|
67
|
-
// an unnamed TTY and drew every
|
|
67
|
+
// an unnamed TTY and drew every color at 16-color depth.
|
|
68
68
|
get env() {
|
|
69
69
|
return XTERM_ENV;
|
|
70
70
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { cellLen, setCellSize, splitText, chopCells, cellFit, graphemes, asCellCol, asCodePoint, } from "./core/cells.js";
|
|
2
2
|
export type { CellCol, CodeUnit, CodePoint } from "./core/cells.js";
|
|
3
|
-
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, type TerminalColors, parseRgbHex, parseRgbaHex, parseHexColor, blendRgb, resolveColorSystem, detectColorSystem,
|
|
4
|
-
export type { ColorSystemName, DetectColorOptions,
|
|
3
|
+
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, type TerminalColors, parseRgbHex, parseRgbaHex, parseHexColor, blendRgb, resolveColorSystem, detectColorSystem, resolveOutputTarget, STANDARD_TABLE, EIGHT_BIT_TABLE, WINDOWS_TABLE, ANSI_COLOR_NAMES, } from "./core/color.js";
|
|
4
|
+
export type { ColorSystemName, DetectColorOptions, OutputTarget, DestinationOptions } from "./core/color.js";
|
|
5
5
|
export type { TextOrder } from "./core/text-order.js";
|
|
6
6
|
export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
|
|
7
|
-
export type {
|
|
7
|
+
export type { ColorAdjustment, OklchWeights } from "./core/oklch.js";
|
|
8
8
|
export { Palette } from "./themes/palette.js";
|
|
9
9
|
export type { AccentRole, BaseRole, PaletteRole, PaletteRoles, ShadedRole } from "./themes/palette.js";
|
|
10
10
|
export { resolveColorRef, ColorRefError } from "./themes/colorRef.js";
|
|
@@ -13,21 +13,21 @@ export type { BaseColors, StatedRoles } from "./themes/buildPalette.js";
|
|
|
13
13
|
export { DEFAULT_TERMINAL_THEME, MONOKAI, SVG_EXPORT_THEME, NORD, GRUVBOX, DRACULA, TOKYO_NIGHT, FLEXOKI, CYBERPUNK, CATPPUCCIN_MOCHA, CATPPUCCIN_LATTE, CATPPUCCIN_FRAPPE, CATPPUCCIN_MACCHIATO, SOLARIZED_DARK, SOLARIZED_LIGHT, ROSE_PINE, ROSE_PINE_MOON, ROSE_PINE_DAWN, ATOM_ONE_DARK, ATOM_ONE_LIGHT, TEXTUAL_DARK, TEXTUAL_LIGHT, TEXTUAL_ANSI, } from "./themes/terminalThemes.js";
|
|
14
14
|
export { getThemePalette, listThemePalettes } from "./themes/registry.js";
|
|
15
15
|
export type { ThemeName } from "./themes/registry.js";
|
|
16
|
-
export {
|
|
17
|
-
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast,
|
|
16
|
+
export { adjustPalette, adjustmentForRoot, isHueLocked, HUE_LOCKED_ROOTS, } from "./themes/adjust.js";
|
|
17
|
+
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast, ensureMinimumDelta, compositedColor, } from "./themes/colorMath.js";
|
|
18
18
|
export { ColorRamp } from "./themes/ramp.js";
|
|
19
19
|
export type { ColorStop, RampMotion } from "./themes/ramp.js";
|
|
20
|
-
export { EASES,
|
|
21
|
-
export type {
|
|
20
|
+
export { EASES, WrapMode, stepSequence, cubicBezier, parseEasing, spring, steps } from "./core/easing.js";
|
|
21
|
+
export type { StepSequence, Easing, SpringOptions, StepPosition, Timing } from "./core/easing.js";
|
|
22
22
|
export { Animation } from "./core/animation.js";
|
|
23
|
-
export type {
|
|
23
|
+
export type { Reads, Behavior } from "./core/animation.js";
|
|
24
24
|
export { tween } from "./core/tween.js";
|
|
25
25
|
export { Timeline } from "./core/timeline.js";
|
|
26
26
|
export type { View } from "./core/view.js";
|
|
27
27
|
export { frameRate, systemClock } from "./core/clock.js";
|
|
28
28
|
export type { Clock, FrameRate } from "./core/clock.js";
|
|
29
29
|
export { Style, StyleSyntaxError, StyleStack, Theme, NULL_STYLE, DEFAULT_STYLES, } from "./core/style.js";
|
|
30
|
-
export type { Attributes,
|
|
30
|
+
export type { Attributes, ValidityInterval, StyleOptions, TextStyle, LayeredStyle } from "./core/style.js";
|
|
31
31
|
export { Segment, ControlType, } from "./core/segment.js";
|
|
32
32
|
export type { ControlCode } from "./core/segment.js";
|
|
33
33
|
export type { Anchor } from "./core/anchor.js";
|
|
@@ -35,13 +35,13 @@ export { Box } from "./core/box.js";
|
|
|
35
35
|
export type { EdgeChars, ContentChars, RowLevel, SubstituteOptions } from "./core/box.js";
|
|
36
36
|
export { ASCII, ASCII2, ASCII_DOUBLE_HEAD, SQUARE, SQUARE_DOUBLE_HEAD, MINIMAL, MINIMAL_HEAVY_HEAD, MINIMAL_DOUBLE_HEAD, SIMPLE, SIMPLE_HEAD, SIMPLE_HEAVY, HORIZONTALS, ROUNDED, HEAVY, HEAVY_EDGE, HEAVY_HEAD, DOUBLE, DOUBLE_EDGE, MARKDOWN, } from "./core/box.js";
|
|
37
37
|
export { render, isRenderable, isMeasurable, withCellWidth, withBoundedWidth, insetHeight, stackedHeight, regionRows, fitHeight, getStyle, } from "./core/protocol.js";
|
|
38
|
-
export type { RenderOptions, OverflowMethod, Height, Renderable, Measurable,
|
|
38
|
+
export type { RenderOptions, OverflowMethod, Height, Renderable, Measurable, Visibility, StyleErrorHandler, FrameHost, HostFrame, } from "./core/protocol.js";
|
|
39
39
|
export type { Unsubscribe } from "./core/subscription.js";
|
|
40
40
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
41
41
|
export { Span, RichText } from "./core/text.js";
|
|
42
42
|
export type { RichTextOptions } from "./core/text.js";
|
|
43
|
-
export { Strip,
|
|
44
|
-
export type { StyledRenderable,
|
|
43
|
+
export { Strip, CellSeparator, SEAM_MIN_DELTA_E, SEPARATORS, END_CAPS, SEPARATOR_STYLES, separatorNamed, gradientSeam, } from "./core/strip.js";
|
|
44
|
+
export type { StyledRenderable, Separator, JoinContext, SeparatorSeam, EndCaps, SeamForm, CapsForm, SeamCell, JoinCell, CellColor, Paint, SeparatorSpec, } from "./core/strip.js";
|
|
45
45
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
46
46
|
export type { RenderToStringOptions } from "./core/render.js";
|
|
47
47
|
export { OSC8, osc8Sequences } from "./core/osc8.js";
|
|
@@ -64,8 +64,8 @@ export type { Env } from "./core/env.js";
|
|
|
64
64
|
export { Constrain } from "./renderables/constrain.js";
|
|
65
65
|
export { Effected, confined, drawnOf } from "./renderables/effect.js";
|
|
66
66
|
export type { CellAttributes, CellColors, CellLook, Drawn, Effect, EffectCell, EffectedOptions, EffectFrame, ListedCell, Pair, Placed } from "./renderables/effect.js";
|
|
67
|
-
export { ATTRIBUTE_DEFAULTS, EFFECT_CATALOGUE, EFFECT_CURVES, EFFECT_LIGHTS, blink, dissolveOut, fadeIn, gradient,
|
|
68
|
-
export type { AttributeLoopName, Blink, ColorStep, Curve, EffectTarget, Field, Loop, LoopName,
|
|
67
|
+
export { ATTRIBUTE_DEFAULTS, EFFECT_CATALOGUE, EFFECT_CURVES, EFFECT_LIGHTS, blink, dissolveOut, fadeIn, gradient, sampleAndHold, layered, onColors, pulse, shimmer, sparkle, steppedInk, wheel, } from "./renderables/effects.js";
|
|
68
|
+
export type { AttributeLoopName, Blink, ColorStep, Curve, EffectTarget, Field, Loop, LoopName, ColorModifier, Transition, TransitionName } from "./renderables/effects.js";
|
|
69
69
|
export { crossfade, wipe } from "./renderables/change.js";
|
|
70
70
|
export type { Between, Change } from "./renderables/change.js";
|
|
71
71
|
export { lifecycle, throughColors, throughGlyphs } from "./renderables/lifecycle.js";
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Core primitives
|
|
2
2
|
export { cellLen, setCellSize, splitText, chopCells, cellFit, graphemes, asCellCol, asCodePoint, } from "./core/cells.js";
|
|
3
|
-
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, parseRgbHex, parseRgbaHex, parseHexColor, blendRgb, resolveColorSystem, detectColorSystem,
|
|
4
|
-
// Perceptually-uniform color space (manipulation,
|
|
3
|
+
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, parseRgbHex, parseRgbaHex, parseHexColor, blendRgb, resolveColorSystem, detectColorSystem, resolveOutputTarget, STANDARD_TABLE, EIGHT_BIT_TABLE, WINDOWS_TABLE, ANSI_COLOR_NAMES, } from "./core/color.js";
|
|
4
|
+
// Perceptually-uniform color space (manipulation, adjustment).
|
|
5
5
|
export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
|
|
6
6
|
// Themes — semantic palettes (distinct from ColorTable quantization LUTs)
|
|
7
7
|
export { Palette } from "./themes/palette.js";
|
|
8
|
-
// The one checkpoint turning an author-written
|
|
9
|
-
// variable name or a `#RRGGBB` literal — into a
|
|
8
|
+
// The one checkpoint turning an author-written color string — a palette
|
|
9
|
+
// variable name or a `#RRGGBB` literal — into a color. [LAW:parse-dont-validate]
|
|
10
10
|
export { resolveColorRef, ColorRefError } from "./themes/colorRef.js";
|
|
11
11
|
export { buildPalette } from "./themes/buildPalette.js";
|
|
12
12
|
export { DEFAULT_TERMINAL_THEME, MONOKAI, SVG_EXPORT_THEME, NORD, GRUVBOX, DRACULA, TOKYO_NIGHT, FLEXOKI, CYBERPUNK, CATPPUCCIN_MOCHA, CATPPUCCIN_LATTE, CATPPUCCIN_FRAPPE, CATPPUCCIN_MACCHIATO, SOLARIZED_DARK, SOLARIZED_LIGHT, ROSE_PINE, ROSE_PINE_MOON, ROSE_PINE_DAWN, ATOM_ONE_DARK, ATOM_ONE_LIGHT, TEXTUAL_DARK, TEXTUAL_LIGHT, TEXTUAL_ANSI, } from "./themes/terminalThemes.js";
|
|
13
13
|
export { getThemePalette, listThemePalettes } from "./themes/registry.js";
|
|
14
|
-
export {
|
|
14
|
+
export { adjustPalette, adjustmentForRoot, isHueLocked, HUE_LOCKED_ROOTS, } from "./themes/adjust.js";
|
|
15
15
|
// WCAG contrast toolkit — accessibility-aware color for styled output.
|
|
16
16
|
// `ensureContrast` keeps a color's hue and only slides its OKLCH lightness to
|
|
17
17
|
// meet the ratio, so themed text stays themed; `contrastFor` picks black/white
|
|
@@ -21,7 +21,7 @@ export { transposePalette, themeKeyForRoot, isAnchored, ANCHORED_ROOTS, } from "
|
|
|
21
21
|
// reaches for to tint a resolved color against itself (e.g. a focused-while-open
|
|
22
22
|
// menu cell lightening its inherited background) without re-deriving from a
|
|
23
23
|
// palette name. Negative levels invert (lighten(c,-n) === darken(c,n)).
|
|
24
|
-
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast,
|
|
24
|
+
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast, ensureMinimumDelta, compositedColor, } from "./themes/colorMath.js";
|
|
25
25
|
// A number → a color through ordered stops, interpolated in OKLCH — the one
|
|
26
26
|
// color operation whose input is a measurement rather than a color, so a
|
|
27
27
|
// gradient (or, with the `step` ease, a threshold cascade) stays inside the
|
|
@@ -29,7 +29,7 @@ export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureC
|
|
|
29
29
|
export { ColorRamp } from "./themes/ramp.js";
|
|
30
30
|
// Progress in [0, 1]: phases turn seconds into it, eases reshape it. One
|
|
31
31
|
// vocabulary for ramps and time-based effects alike, CSS's names throughout.
|
|
32
|
-
export { EASES,
|
|
32
|
+
export { EASES, WrapMode, stepSequence, cubicBezier, parseEasing, spring, steps } from "./core/easing.js";
|
|
33
33
|
// A value for a time, and when it next changes: the one type every kind of
|
|
34
34
|
// motion is an instance of — beats, frame sequences, spinners, effects.
|
|
35
35
|
export { Animation } from "./core/animation.js";
|
|
@@ -52,8 +52,8 @@ export { render, isRenderable, isMeasurable, withCellWidth, withBoundedWidth, in
|
|
|
52
52
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
53
53
|
// Text
|
|
54
54
|
export { Span, RichText } from "./core/text.js";
|
|
55
|
-
// Strip +
|
|
56
|
-
export { Strip,
|
|
55
|
+
// Strip + Separator
|
|
56
|
+
export { Strip, CellSeparator, SEAM_MIN_DELTA_E, SEPARATORS, END_CAPS, SEPARATOR_STYLES, separatorNamed, gradientSeam, } from "./core/strip.js";
|
|
57
57
|
// renderToString — stateless one-shot emission
|
|
58
58
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
59
59
|
// OSC 8 hyperlink wire grammar — for consumers that read rendered bytes back
|
|
@@ -79,7 +79,7 @@ export { Console } from "./core/console.js";
|
|
|
79
79
|
// Renderables
|
|
80
80
|
export { Constrain } from "./renderables/constrain.js";
|
|
81
81
|
export { Effected, confined, drawnOf } from "./renderables/effect.js";
|
|
82
|
-
export { ATTRIBUTE_DEFAULTS, EFFECT_CATALOGUE, EFFECT_CURVES, EFFECT_LIGHTS, blink, dissolveOut, fadeIn, gradient,
|
|
82
|
+
export { ATTRIBUTE_DEFAULTS, EFFECT_CATALOGUE, EFFECT_CURVES, EFFECT_LIGHTS, blink, dissolveOut, fadeIn, gradient, sampleAndHold, layered, onColors, pulse, shimmer, sparkle, steppedInk, wheel, } from "./renderables/effects.js";
|
|
83
83
|
export { crossfade, wipe } from "./renderables/change.js";
|
|
84
84
|
export { lifecycle, throughColors, throughGlyphs } from "./renderables/lifecycle.js";
|
|
85
85
|
export { scroll } from "./renderables/scroll.js";
|
package/dist/node/prompt.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* The prompt is printed by the `Console` it was asked on — the app's, when it
|
|
17
17
|
* passed one as `console`, a new default one otherwise — and then a line is
|
|
18
18
|
* read, as Rich's `Console.input` prints its prompt and calls `input()`. So
|
|
19
|
-
* the prompt is
|
|
19
|
+
* the prompt is colored exactly as that console's own output would be and
|
|
20
20
|
* goes to its target: a console on stderr asks on stderr, beside the
|
|
21
21
|
* invalid-answer messages it prints. It goes as one logical line, never broken
|
|
22
22
|
* at the console's width: the terminal wraps it at whatever width it has.
|
package/dist/node/prompt.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* The prompt is printed by the `Console` it was asked on — the app's, when it
|
|
17
17
|
* passed one as `console`, a new default one otherwise — and then a line is
|
|
18
18
|
* read, as Rich's `Console.input` prints its prompt and calls `input()`. So
|
|
19
|
-
* the prompt is
|
|
19
|
+
* the prompt is colored exactly as that console's own output would be and
|
|
20
20
|
* goes to its target: a console on stderr asks on stderr, beside the
|
|
21
21
|
* invalid-answer messages it prints. It goes as one logical line, never broken
|
|
22
22
|
* at the console's width: the terminal wraps it at whatever width it has.
|
|
@@ -88,7 +88,7 @@ export interface NodeTerminalHostOptions {
|
|
|
88
88
|
*/
|
|
89
89
|
stdout?: NodeWritable;
|
|
90
90
|
/**
|
|
91
|
-
* The environment
|
|
91
|
+
* The environment color detection reads. Defaults to `process.env`; tests
|
|
92
92
|
* pass a fixed map so what the host reports does not depend on the shell
|
|
93
93
|
* that ran them.
|
|
94
94
|
*/
|
package/dist/node/traceback.js
CHANGED
|
@@ -77,8 +77,8 @@ export function installTraceback(options) {
|
|
|
77
77
|
crashing = true;
|
|
78
78
|
// [LAW:effects-at-boundaries] Render to a string first, then perform one
|
|
79
79
|
// write. `beginCapture` redirects the console's sink without setting
|
|
80
|
-
// `file:`, so stderr's TTY status still drives
|
|
81
|
-
// sink would report `isTTY === false` and silently strip
|
|
80
|
+
// `file:`, so stderr's TTY status still drives color depth — a `file:`
|
|
81
|
+
// sink would report `isTTY === false` and silently strip color.
|
|
82
82
|
const out = new Console({ stderr: true });
|
|
83
83
|
out.beginCapture();
|
|
84
84
|
out.print(new Traceback(reason, options));
|
|
@@ -25,7 +25,7 @@ import { Measurement } from "../core/measure.js";
|
|
|
25
25
|
import { render } from "../core/protocol.js";
|
|
26
26
|
import { Segment } from "../core/segment.js";
|
|
27
27
|
import { Recolored } from "./effect.js";
|
|
28
|
-
import { requireCurve, transition,
|
|
28
|
+
import { requireCurve, transition, mask } from "./effects.js";
|
|
29
29
|
const clamp01 = (x) => Math.min(1, Math.max(0, x));
|
|
30
30
|
/** How much of a cell `p` of the way through a change shows: all of it at either end, none at the half, where the old gives way to the new. */
|
|
31
31
|
const shows = (p) => Math.abs(2 * p - 1);
|
|
@@ -85,7 +85,7 @@ class ChangeFrame {
|
|
|
85
85
|
...(row < after.length - 1 || ended ? [Segment.line()] : []),
|
|
86
86
|
]);
|
|
87
87
|
// The change's own animation says it moves every frame, and reads nothing this frame tells.
|
|
88
|
-
const veil =
|
|
88
|
+
const veil = mask(() => (cell) => shows(at(cell.row, cell.col)), this.swing);
|
|
89
89
|
return render(new Recolored({ render: () => rows }, veil, { t: this.t, key: "change" }), options);
|
|
90
90
|
}
|
|
91
91
|
measure(options) {
|