@promptctl/rich-js 0.27.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 -6
- package/THIRD-PARTY-NOTICES +42 -0
- package/dist/core/animation.d.ts +65 -46
- package/dist/core/animation.js +91 -67
- package/dist/core/ansi.d.ts +19 -12
- package/dist/core/ansi.js +114 -36
- package/dist/core/bidi-data.d.ts +14 -0
- package/dist/core/bidi-data.js +385 -0
- package/dist/core/bidi.d.ts +89 -0
- package/dist/core/bidi.js +615 -0
- package/dist/core/box.d.ts +9 -1
- package/dist/core/box.js +11 -0
- package/dist/core/cell-widths.d.ts +3 -2
- package/dist/core/cell-widths.js +93 -93
- package/dist/core/cells.d.ts +20 -0
- package/dist/core/cells.js +94 -6
- package/dist/core/clock.d.ts +1 -1
- package/dist/core/color.d.ts +56 -57
- package/dist/core/color.js +79 -81
- package/dist/core/console.d.ts +24 -7
- package/dist/core/console.js +27 -8
- package/dist/core/control-codes.d.ts +61 -0
- package/dist/core/control-codes.js +157 -0
- package/dist/core/easing.d.ts +40 -40
- package/dist/core/easing.js +40 -40
- package/dist/core/env.d.ts +6 -0
- package/dist/core/env.js +9 -1
- package/dist/core/export-html.js +5 -4
- package/dist/core/export-lines.d.ts +13 -11
- package/dist/core/export-lines.js +19 -15
- package/dist/core/export-svg.d.ts +3 -3
- package/dist/core/export-svg.js +10 -9
- package/dist/core/json.js +9 -2
- package/dist/core/markup.js +5 -4
- 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 +68 -0
- package/dist/core/orient.js +224 -0
- package/dist/core/osc8.d.ts +12 -5
- package/dist/core/osc8.js +14 -7
- 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 +23 -19
- package/dist/core/protocol.d.ts +47 -26
- package/dist/core/protocol.js +31 -23
- package/dist/core/render.d.ts +19 -14
- package/dist/core/render.js +30 -17
- package/dist/core/seal.d.ts +26 -0
- package/dist/core/seal.js +75 -0
- package/dist/core/segment.d.ts +12 -4
- package/dist/core/segment.js +16 -6
- package/dist/core/strip.d.ts +83 -83
- package/dist/core/strip.js +70 -70
- package/dist/core/style.d.ts +46 -18
- package/dist/core/style.js +92 -56
- package/dist/core/text-order.d.ts +51 -0
- package/dist/core/text-order.js +50 -0
- package/dist/core/text.d.ts +12 -2
- package/dist/core/text.js +136 -90
- package/dist/core/timeline.d.ts +5 -5
- package/dist/core/timeline.js +11 -11
- package/dist/core/tween.d.ts +6 -6
- package/dist/core/tween.js +10 -10
- package/dist/core/view.d.ts +5 -5
- package/dist/core/view.js +15 -14
- package/dist/core/wrap.d.ts +24 -6
- package/dist/core/wrap.js +82 -16
- package/dist/host/app.d.ts +50 -9
- package/dist/host/app.js +120 -15
- package/dist/host/host-environment.d.ts +2 -2
- package/dist/host/host-environment.js +2 -2
- package/dist/host/index.d.ts +3 -2
- package/dist/host/index.js +1 -0
- package/dist/host/input.d.ts +42 -9
- package/dist/host/input.js +91 -7
- package/dist/host/terminal-colors.d.ts +18 -0
- package/dist/host/terminal-colors.js +46 -0
- package/dist/host/terminal-host.d.ts +4 -3
- package/dist/host/terminal-host.js +1 -1
- package/dist/index.d.ts +17 -16
- package/dist/index.js +11 -11
- 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.d.ts +1 -3
- package/dist/renderables/change.js +6 -8
- package/dist/renderables/effect.d.ts +88 -87
- package/dist/renderables/effect.js +124 -114
- package/dist/renderables/effects.d.ts +105 -76
- package/dist/renderables/effects.js +309 -176
- 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 +7 -16
- package/dist/renderables/frames.js +12 -27
- package/dist/renderables/glyph-effect.d.ts +22 -23
- package/dist/renderables/glyph-effect.js +43 -41
- package/dist/renderables/glyph-effects.d.ts +33 -14
- package/dist/renderables/glyph-effects.js +90 -22
- package/dist/renderables/html-entities.d.ts +1 -1
- package/dist/renderables/html-entities.js +1 -1
- package/dist/renderables/lifecycle.d.ts +8 -10
- package/dist/renderables/lifecycle.js +17 -18
- 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/markdown.js +4 -2
- package/dist/renderables/panel.js +7 -5
- package/dist/renderables/progress.d.ts +1 -1
- package/dist/renderables/progress.js +1 -1
- package/dist/renderables/progressBar.d.ts +3 -3
- package/dist/renderables/progressBar.js +21 -18
- 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 +9 -4
- package/dist/renderables/table.js +5 -4
- 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 +60 -29
- package/dist/template-bindings/animation-funcs.js +126 -43
- 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 +16 -14
- package/dist/template-bindings/index.js +17 -14
- package/dist/template-bindings/palette-funcs.d.ts +2 -2
- package/dist/template-bindings/palette-funcs.js +4 -4
- 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 +6 -5
- package/dist/themes/buildPalette.js +22 -22
- 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/index.js +1 -4
- package/dist/themes/data/textual-ansi.js +0 -143
- 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.d.ts +6 -8
- package/dist/themes/registry.js +6 -8
- package/dist/themes/terminalThemes.d.ts +4 -11
- package/dist/themes/terminalThemes.js +31 -47
- package/dist/widgets/button.d.ts +3 -3
- package/dist/widgets/button.js +8 -8
- package/dist/widgets/checkbox.d.ts +2 -2
- package/dist/widgets/checkbox.js +4 -4
- package/dist/widgets/dropdown.d.ts +3 -3
- package/dist/widgets/dropdown.js +7 -5
- 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 +4 -4
- package/dist/widgets/toggle.d.ts +4 -4
- package/dist/widgets/toggle.js +6 -6
- 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 +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +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
|
+
export type { TextOrder } from "./core/text-order.js";
|
|
5
6
|
export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
|
|
6
|
-
export type {
|
|
7
|
+
export type { ColorAdjustment, OklchWeights } from "./core/oklch.js";
|
|
7
8
|
export { Palette } from "./themes/palette.js";
|
|
8
9
|
export type { AccentRole, BaseRole, PaletteRole, PaletteRoles, ShadedRole } from "./themes/palette.js";
|
|
9
10
|
export { resolveColorRef, ColorRefError } from "./themes/colorRef.js";
|
|
@@ -12,21 +13,21 @@ export type { BaseColors, StatedRoles } from "./themes/buildPalette.js";
|
|
|
12
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";
|
|
13
14
|
export { getThemePalette, listThemePalettes } from "./themes/registry.js";
|
|
14
15
|
export type { ThemeName } from "./themes/registry.js";
|
|
15
|
-
export {
|
|
16
|
-
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";
|
|
17
18
|
export { ColorRamp } from "./themes/ramp.js";
|
|
18
19
|
export type { ColorStop, RampMotion } from "./themes/ramp.js";
|
|
19
|
-
export { EASES,
|
|
20
|
-
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";
|
|
21
22
|
export { Animation } from "./core/animation.js";
|
|
22
|
-
export type {
|
|
23
|
+
export type { Reads, Behavior } from "./core/animation.js";
|
|
23
24
|
export { tween } from "./core/tween.js";
|
|
24
25
|
export { Timeline } from "./core/timeline.js";
|
|
25
26
|
export type { View } from "./core/view.js";
|
|
26
27
|
export { frameRate, systemClock } from "./core/clock.js";
|
|
27
28
|
export type { Clock, FrameRate } from "./core/clock.js";
|
|
28
29
|
export { Style, StyleSyntaxError, StyleStack, Theme, NULL_STYLE, DEFAULT_STYLES, } from "./core/style.js";
|
|
29
|
-
export type { Attributes,
|
|
30
|
+
export type { Attributes, ValidityInterval, StyleOptions, TextStyle, LayeredStyle } from "./core/style.js";
|
|
30
31
|
export { Segment, ControlType, } from "./core/segment.js";
|
|
31
32
|
export type { ControlCode } from "./core/segment.js";
|
|
32
33
|
export type { Anchor } from "./core/anchor.js";
|
|
@@ -34,13 +35,13 @@ export { Box } from "./core/box.js";
|
|
|
34
35
|
export type { EdgeChars, ContentChars, RowLevel, SubstituteOptions } from "./core/box.js";
|
|
35
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";
|
|
36
37
|
export { render, isRenderable, isMeasurable, withCellWidth, withBoundedWidth, insetHeight, stackedHeight, regionRows, fitHeight, getStyle, } from "./core/protocol.js";
|
|
37
|
-
export type { RenderOptions, OverflowMethod, Height, Renderable, Measurable,
|
|
38
|
+
export type { RenderOptions, OverflowMethod, Height, Renderable, Measurable, Visibility, StyleErrorHandler, FrameHost, HostFrame, } from "./core/protocol.js";
|
|
38
39
|
export type { Unsubscribe } from "./core/subscription.js";
|
|
39
40
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
40
41
|
export { Span, RichText } from "./core/text.js";
|
|
41
42
|
export type { RichTextOptions } from "./core/text.js";
|
|
42
|
-
export { Strip,
|
|
43
|
-
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";
|
|
44
45
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
45
46
|
export type { RenderToStringOptions } from "./core/render.js";
|
|
46
47
|
export { OSC8, osc8Sequences } from "./core/osc8.js";
|
|
@@ -63,8 +64,8 @@ export type { Env } from "./core/env.js";
|
|
|
63
64
|
export { Constrain } from "./renderables/constrain.js";
|
|
64
65
|
export { Effected, confined, drawnOf } from "./renderables/effect.js";
|
|
65
66
|
export type { CellAttributes, CellColors, CellLook, Drawn, Effect, EffectCell, EffectedOptions, EffectFrame, ListedCell, Pair, Placed } from "./renderables/effect.js";
|
|
66
|
-
export { ATTRIBUTE_DEFAULTS, EFFECT_CATALOGUE, EFFECT_CURVES, EFFECT_LIGHTS, blink, dissolveOut, fadeIn, gradient,
|
|
67
|
-
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";
|
|
68
69
|
export { crossfade, wipe } from "./renderables/change.js";
|
|
69
70
|
export type { Between, Change } from "./renderables/change.js";
|
|
70
71
|
export { lifecycle, throughColors, throughGlyphs } from "./renderables/lifecycle.js";
|
|
@@ -73,8 +74,8 @@ export { scroll } from "./renderables/scroll.js";
|
|
|
73
74
|
export type { ScrollOptions } from "./renderables/scroll.js";
|
|
74
75
|
export { GlyphEffected } from "./renderables/glyph-effect.js";
|
|
75
76
|
export type { DrawnGlyphs, GlyphCell, GlyphEffect, GlyphEffectedOptions, GlyphFrame } from "./renderables/glyph-effect.js";
|
|
76
|
-
export { GLYPH_DEFAULTS, GLYPH_EFFECT_CATALOGUE, backspace, caseWave, particles, scramble, scrambleOut, typewriter } from "./renderables/glyph-effects.js";
|
|
77
|
-
export type { CaseWave, GlyphLoopName, GlyphTransition, GlyphTransitionName, Particles } from "./renderables/glyph-effects.js";
|
|
77
|
+
export { GLYPH_DEFAULTS, GLYPH_EFFECT_CATALOGUE, backspace, caseWave, marchingAnts, particles, scramble, scrambleOut, typewriter } from "./renderables/glyph-effects.js";
|
|
78
|
+
export type { CaseWave, GlyphLoopName, GlyphTransition, GlyphTransitionName, MarchingAnts, Particles } from "./renderables/glyph-effects.js";
|
|
78
79
|
export { Align } from "./renderables/align.js";
|
|
79
80
|
export type { Alignment } from "./core/place.js";
|
|
80
81
|
export { Padding } from "./renderables/padding.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,12 +79,12 @@ 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";
|
|
86
86
|
export { GlyphEffected } from "./renderables/glyph-effect.js";
|
|
87
|
-
export { GLYPH_DEFAULTS, GLYPH_EFFECT_CATALOGUE, backspace, caseWave, particles, scramble, scrambleOut, typewriter } from "./renderables/glyph-effects.js";
|
|
87
|
+
export { GLYPH_DEFAULTS, GLYPH_EFFECT_CATALOGUE, backspace, caseWave, marchingAnts, particles, scramble, scrambleOut, typewriter } from "./renderables/glyph-effects.js";
|
|
88
88
|
export { Align } from "./renderables/align.js";
|
|
89
89
|
export { Padding } from "./renderables/padding.js";
|
|
90
90
|
export { Viewport, ViewportPerKey, SCROLLBAR } from "./renderables/viewport.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));
|
|
@@ -21,14 +21,12 @@
|
|
|
21
21
|
* frame to the next, so the same `t` draws the same bytes at any frame rate.
|
|
22
22
|
*/
|
|
23
23
|
import { Animation } from "../core/animation.js";
|
|
24
|
-
import type { TerminalTheme } from "../core/color.js";
|
|
25
24
|
import type { Renderable } from "../core/protocol.js";
|
|
26
25
|
import { type Curve, type Transition } from "./effects.js";
|
|
27
|
-
/** What a change is between: the renderable drawn until now
|
|
26
|
+
/** What a change is between: the renderable drawn until now and the one drawn from now on. */
|
|
28
27
|
export interface Between {
|
|
29
28
|
readonly from: Renderable;
|
|
30
29
|
readonly to: Renderable;
|
|
31
|
-
readonly theme: TerminalTheme;
|
|
32
30
|
}
|
|
33
31
|
/** A change from one renderable to another: what it draws at each moment, from `t = 0` on its own clock. */
|
|
34
32
|
export type Change = (between: Between) => Animation<Renderable>;
|
|
@@ -25,14 +25,14 @@ 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);
|
|
32
32
|
/** The change over `curve`, each cell as far through it as `progress` says. */
|
|
33
33
|
function change(curve, progress) {
|
|
34
34
|
requireCurve(curve);
|
|
35
|
-
return transition(curve.seconds, ({ from, to
|
|
35
|
+
return transition(curve.seconds, ({ from, to }) => Animation.sequence(Animation.continuous((t) => new ChangeFrame(from, to, progress, t, curve.swing)), curve.seconds, Animation.constant(to)));
|
|
36
36
|
}
|
|
37
37
|
/** A crossfade: the old renderable fades to the terminal's ground and the new one rises from it, every cell together, over `curve`. */
|
|
38
38
|
export function crossfade(curve) {
|
|
@@ -61,14 +61,12 @@ export function wipe(curve, edge = WIPE_EDGE) {
|
|
|
61
61
|
class ChangeFrame {
|
|
62
62
|
from;
|
|
63
63
|
to;
|
|
64
|
-
theme;
|
|
65
64
|
progress;
|
|
66
65
|
t;
|
|
67
66
|
swing;
|
|
68
|
-
constructor(from, to,
|
|
67
|
+
constructor(from, to, progress, t, swing) {
|
|
69
68
|
this.from = from;
|
|
70
69
|
this.to = to;
|
|
71
|
-
this.theme = theme;
|
|
72
70
|
this.progress = progress;
|
|
73
71
|
this.t = t;
|
|
74
72
|
this.swing = swing;
|
|
@@ -86,9 +84,9 @@ class ChangeFrame {
|
|
|
86
84
|
...splice(Segment.adjustLineLength(before[row] ?? [], lengths[row]), line, (col) => at(row, col) >= 0.5),
|
|
87
85
|
...(row < after.length - 1 || ended ? [Segment.line()] : []),
|
|
88
86
|
]);
|
|
89
|
-
// The
|
|
90
|
-
const veil =
|
|
91
|
-
return render(new Recolored({ render: () => rows }, veil, { t: this.t, key: "change"
|
|
87
|
+
// The change's own animation says it moves every frame, and reads nothing this frame tells.
|
|
88
|
+
const veil = mask(() => (cell) => shows(at(cell.row, cell.col)), this.swing);
|
|
89
|
+
return render(new Recolored({ render: () => rows }, veil, { t: this.t, key: "change" }), options);
|
|
92
90
|
}
|
|
93
91
|
measure(options) {
|
|
94
92
|
return Measurement.get(options, this.to);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Effected — a renderable whose finished cells' looks —
|
|
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,26 +11,27 @@
|
|
|
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
|
|
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,
|
|
18
18
|
* pulse, fade, dissolve and a blinking attribute are all this one shape,
|
|
19
19
|
* differing by what the function does with its inputs
|
|
20
|
-
* [LAW:one-type-per-behavior]; two effects stack
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* [LAW:one-type-per-behavior]; two effects stack as layers of one effect
|
|
21
|
+
* (`layered`, `./effects.ts`), each moving what the last left and recognising
|
|
22
|
+
* a cell by what the element drew (`EffectCell.pair`), or by nesting one
|
|
23
|
+
* wrapper in another, which measures the inner one's output instead.
|
|
23
24
|
*
|
|
24
|
-
* A cell's look is one value, its
|
|
25
|
-
* (`CellLook`), rather than an attribute stage beside the
|
|
26
|
-
* everything that takes an `Effect` — `confined`, `
|
|
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`,
|
|
27
28
|
* `Animation.all`, nesting over a glyph effect — takes one that moves
|
|
28
29
|
* attributes with no second copy of itself. `reverse` is the one attribute
|
|
29
30
|
* a look leaves out (`CellAttributes`): it decides which of a style's slots
|
|
30
|
-
* a
|
|
31
|
+
* a color on screen is in, and a swap of the two is already a color move.
|
|
31
32
|
*
|
|
32
33
|
* What the element draws (`Drawn`) — the cells the effect will be handed,
|
|
33
|
-
* and the
|
|
34
|
+
* and the colors of its words — is measured here, in the render, off the
|
|
34
35
|
* same reading of each segment its cells are drawn from, and handed to the
|
|
35
36
|
* effect once a frame. It is what an effect keeping words legible is settled
|
|
36
37
|
* against (`onColors`, `./effects.ts`), so no caller derives it a second time
|
|
@@ -50,18 +51,18 @@
|
|
|
50
51
|
* to the effect and is never cut, and a run cut out of a segment keeps that
|
|
51
52
|
* segment's link and meta and carries its anchor shifted to the run's first
|
|
52
53
|
* cell (`Style.shiftedBy`), so hit testing still finds the owner.
|
|
53
|
-
* - A cell whose
|
|
54
|
+
* - A cell whose colors come back unchanged keeps its original `ColorSpec`,
|
|
54
55
|
* one whose attributes come back as its style set them keeps them, and a
|
|
55
56
|
* segment whose every cell is unchanged is yielded with its look as
|
|
56
57
|
* it was, so the identity effect is byte-identical; what an `Effected` gains is when
|
|
57
58
|
* the frame next changes (`Style.hold`), which writes no byte.
|
|
58
59
|
* Neighbouring cells the output depth
|
|
59
60
|
* writes alike stay one segment: a segment is cut only where the written
|
|
60
|
-
*
|
|
61
|
+
* colors or the attributes change, so two colors that land on one index
|
|
61
62
|
* are one run.
|
|
62
|
-
* - New
|
|
63
|
+
* - New colors are built with `ColorSpec.fromRgba`, never parsed from a
|
|
63
64
|
* string, so no frame adds an entry to a parse cache.
|
|
64
|
-
* - With no
|
|
65
|
+
* - With no color output (`colorSystem: null`) no style is written at all,
|
|
65
66
|
* attributes included, so there is nothing for an effect to change, and
|
|
66
67
|
* the child's segments pass through untouched.
|
|
67
68
|
*
|
|
@@ -69,16 +70,15 @@
|
|
|
69
70
|
* what the child drew, so a sweep crosses the element, not the screen.
|
|
70
71
|
*/
|
|
71
72
|
import { type Anchor } from "../core/anchor.js";
|
|
72
|
-
import { Animation } from "../core/animation.js";
|
|
73
|
-
import type { Hold } from "../core/style.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 } 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
|
-
*
|
|
81
|
-
* Under `reverse` they are the style's two
|
|
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
|
|
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
|
}
|
|
@@ -98,37 +98,36 @@ export interface CellLook extends CellColors {
|
|
|
98
98
|
* Where a cell is in the output of the renderable an effect wraps, its seed:
|
|
99
99
|
* a number in [0, 1) that is the same for that cell on every frame, for an
|
|
100
100
|
* effect that varies cell by cell (a per-cell offset in time, a sparkle) —
|
|
101
|
-
* and
|
|
101
|
+
* and what the element drew it in.
|
|
102
102
|
*/
|
|
103
103
|
export interface EffectCell {
|
|
104
104
|
readonly row: number;
|
|
105
105
|
readonly col: number;
|
|
106
106
|
readonly seed: number;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
108
|
+
* The ink and ground the element drew the cell in: what the cell is, where
|
|
109
|
+
* the `CellLook` beside it is what is there now. Under one effect they are
|
|
110
|
+
* the same colors; under `layered` (`./effects.ts`) the look is what the
|
|
111
|
+
* layers beneath left, so an effect recognises a cell by its pair and moves
|
|
112
|
+
* its look. [LAW:one-source-of-truth] A pair's `terminal` is what tells a
|
|
113
|
+
* color the terminal resolved from one the element wrote at the same hex.
|
|
112
114
|
*/
|
|
113
|
-
readonly
|
|
114
|
-
readonly fg: boolean;
|
|
115
|
-
readonly bg: boolean;
|
|
116
|
-
};
|
|
117
|
-
/** Whether the cell's style swaps its two slots, as `Pair.reverse` says: with `colors` and `terminal`, the cell's `Pair`. */
|
|
118
|
-
readonly reverse: boolean;
|
|
115
|
+
readonly pair: Pair;
|
|
119
116
|
/**
|
|
120
117
|
* Who drew the cell, and where it sits in their output, as
|
|
121
118
|
* `Segment.anchorAt` reads it off a frame: what tells one owner's cells
|
|
122
|
-
* from another's when their
|
|
119
|
+
* from another's when their colors are alike (`confined`).
|
|
123
120
|
*/
|
|
124
121
|
readonly anchor: Anchor | undefined;
|
|
122
|
+
/** The drawing of a box the cell is the frame of (`Style.boxFrame`), or none. */
|
|
123
|
+
readonly boxFrame: object | undefined;
|
|
125
124
|
}
|
|
126
|
-
/** Where a cell sits and who drew it: an `EffectCell` before it has a seed or
|
|
127
|
-
export type Placed = Pick<EffectCell, "row" | "col" | "anchor">;
|
|
125
|
+
/** Where a cell sits and who drew it: an `EffectCell` before it has a seed or colors. */
|
|
126
|
+
export type Placed = Pick<EffectCell, "row" | "col" | "anchor" | "boxFrame">;
|
|
128
127
|
/**
|
|
129
128
|
* A cell as `Drawn.all` lists it: where it sits and who drew it, the
|
|
130
129
|
* columns its glyph takes, its ink and ground as the screen shows them, and
|
|
131
|
-
* whether a strip's joiner drew it — a seam, no item's, whose
|
|
130
|
+
* whether a strip's joiner drew it — a seam, no item's, whose colors are its
|
|
132
131
|
* neighbours' edges. Each is read off the one look and the one walk the cell
|
|
133
132
|
* is later handed with, so an effect that groups cells into the runs they
|
|
134
133
|
* are drawn in — `wheel`'s segments — reads what the frame hands, never a
|
|
@@ -145,10 +144,19 @@ export interface ListedCell extends Placed {
|
|
|
145
144
|
* is handed for that cell.
|
|
146
145
|
*/
|
|
147
146
|
export interface Pair extends CellColors {
|
|
148
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Whether the glyph's color and the color behind it, as the screen shows
|
|
149
|
+
* them, are the terminal's own: a slot the element's style leaves unset or
|
|
150
|
+
* sets to `default`. Such a color is resolved through the terminal, so its
|
|
151
|
+
* hex can equal one the element wrote; this is what tells them apart.
|
|
152
|
+
*/
|
|
153
|
+
readonly terminal: {
|
|
154
|
+
readonly fg: boolean;
|
|
155
|
+
readonly bg: boolean;
|
|
156
|
+
};
|
|
149
157
|
/**
|
|
150
158
|
* Whether the ink is written in the style's ground slot and the ground in
|
|
151
|
-
* its ink slot. Below truecolor the slot decides what a moved
|
|
159
|
+
* its ink slot. Below truecolor the slot decides what a moved color can
|
|
152
160
|
* land on: a slot set to `default` draws the terminal's foreground in one
|
|
153
161
|
* and its background in the other.
|
|
154
162
|
*/
|
|
@@ -156,7 +164,7 @@ export interface Pair extends CellColors {
|
|
|
156
164
|
}
|
|
157
165
|
/**
|
|
158
166
|
* What the element an effect wraps draws in one frame: the cells the effect
|
|
159
|
-
* is handed, and the
|
|
167
|
+
* is handed, and the colors the element draws its words in, as the screen
|
|
160
168
|
* shows them — what an effect that must keep the words legible is measured
|
|
161
169
|
* against. A word cell is one whose glyph is not blank and that a strip's
|
|
162
170
|
* joiner did not draw (`JOIN`): a seam's ink is the fill beside it, not words.
|
|
@@ -187,14 +195,14 @@ export interface Drawn {
|
|
|
187
195
|
cells(): readonly ListedCell[];
|
|
188
196
|
/** Every distinct ink and ground of a word cell. */
|
|
189
197
|
readonly pairs: readonly Pair[];
|
|
190
|
-
/** The
|
|
198
|
+
/** The colors the element sets itself in its word cells, by hex: never the terminal's, whatever its hex. */
|
|
191
199
|
readonly colors: ReadonlySet<string>;
|
|
192
200
|
/** Of `colors`, the ones a word cell has for its ground. */
|
|
193
201
|
readonly fills: ReadonlySet<string>;
|
|
194
|
-
/** The depth the frame is written at: below truecolor a moved
|
|
202
|
+
/** The depth the frame is written at: below truecolor a moved color lands on a palette color. */
|
|
195
203
|
readonly depth: ColorDepth;
|
|
196
204
|
/** The terminal the frame is drawn on. */
|
|
197
|
-
readonly
|
|
205
|
+
readonly terminal: TerminalColors;
|
|
198
206
|
}
|
|
199
207
|
/** What an effect does to the cells of one frame: each cell's look and where it is in, its look out. Return `look` to leave a cell be. */
|
|
200
208
|
export type EffectFrame = (look: CellLook, cell: EffectCell) => CellLook;
|
|
@@ -204,13 +212,14 @@ export type EffectFrame = (look: CellLook, cell: EffectCell) => CellLook;
|
|
|
204
212
|
* frame by the shape of the call, never by a cache asking whether this cell's
|
|
205
213
|
* frame is the last one's.
|
|
206
214
|
*
|
|
207
|
-
* Its `
|
|
215
|
+
* Its `validUntil` is when the frame next changes: a stepped effect its next
|
|
208
216
|
* step's start, a transition `t` until it is done and `Infinity` after, a
|
|
209
|
-
* loop that holds every cell still at the frame's depth
|
|
210
|
-
* a loop that moves `t`
|
|
211
|
-
* The answer is a fact
|
|
212
|
-
*
|
|
213
|
-
* that a frame is still because of
|
|
217
|
+
* loop that holds every cell still, at the frame's depth or with nothing in
|
|
218
|
+
* it to move, `Infinity` there, and a loop that moves `t`
|
|
219
|
+
* (`Animation.continuous`). [LAW:types-are-the-program] The answer is a fact
|
|
220
|
+
* about the frame, so the animation is made from everything the frame is drawn
|
|
221
|
+
* from; one made from `t` alone could not say that a frame is still because of
|
|
222
|
+
* its depth.
|
|
214
223
|
*/
|
|
215
224
|
export type Effect = (drawn: Drawn) => Animation<EffectFrame>;
|
|
216
225
|
export interface EffectedOptions {
|
|
@@ -219,37 +228,30 @@ export interface EffectedOptions {
|
|
|
219
228
|
* not twinkle in lockstep. The same key gives the same seeds on every frame.
|
|
220
229
|
*/
|
|
221
230
|
readonly key: string;
|
|
222
|
-
/**
|
|
223
|
-
* The terminal the frame is drawn on: the colours a cell that sets none is
|
|
224
|
-
* drawn in, and the sixteen an ANSI colour names. The terminal's own palette
|
|
225
|
-
* is never queried, so the caller says what it is.
|
|
226
|
-
*/
|
|
227
|
-
readonly theme: TerminalColors;
|
|
228
|
-
}
|
|
229
|
-
/** A frame an effect drew at a moment, and the hold the effect says it is in there. */
|
|
230
|
-
export interface Moved {
|
|
231
|
-
readonly segments: Iterable<Segment>;
|
|
232
|
-
readonly hold: Hold;
|
|
233
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* The hold an effect drawn at `t` tells: its animation's there, or held for
|
|
234
|
+
* good over no cell, since it changes how cells look and never which exist.
|
|
235
|
+
* What drew none says for itself when it will (a lifecycle not yet entered).
|
|
236
|
+
*/
|
|
237
|
+
export declare function validityOver(anyCell: boolean, shown: Shown<unknown>, t: number): ValidityInterval;
|
|
234
238
|
/**
|
|
235
239
|
* An `Effected` at `t`, or an element through an effect at a time an
|
|
236
240
|
* animation's `at` was handed — a lifecycle's time since it entered: `renderable`
|
|
237
|
-
* with its cells' looks passed through `effect` at `t
|
|
238
|
-
* when that changes, since
|
|
239
|
-
*
|
|
241
|
+
* with its cells' looks passed through `effect` at `t`. Its cells say nothing
|
|
242
|
+
* of when that changes, since `t` is not the frame's clock: it tells the hold
|
|
243
|
+
* it drew in (`RenderOptions.onReads`), and whatever placed the animation
|
|
244
|
+
* carries that onto the frame's and stamps it. [LAW:one-type-per-behavior]
|
|
240
245
|
*/
|
|
241
246
|
export declare class Recolored implements Renderable, Measurable {
|
|
242
247
|
readonly renderable: Renderable;
|
|
243
248
|
readonly effect: Effect;
|
|
244
|
-
readonly
|
|
249
|
+
private readonly _t;
|
|
245
250
|
readonly key: string;
|
|
246
|
-
readonly theme: TerminalColors;
|
|
247
251
|
constructor(renderable: Renderable, effect: Effect, options: EffectedOptions & {
|
|
248
252
|
readonly t: number;
|
|
249
253
|
});
|
|
250
254
|
render(options: RenderOptions): Iterable<Segment>;
|
|
251
|
-
/** The frame the effect draws at `t`, and the hold it says that is in. */
|
|
252
|
-
moved(options: RenderOptions): Moved;
|
|
253
255
|
private _recolored;
|
|
254
256
|
/** `segment`'s cells drawn in the looks the effect painted them. */
|
|
255
257
|
private _repainted;
|
|
@@ -266,7 +268,7 @@ export declare class Recolored implements Renderable, Measurable {
|
|
|
266
268
|
maximum: number;
|
|
267
269
|
};
|
|
268
270
|
/**
|
|
269
|
-
* The specs that draw a cell's slot
|
|
271
|
+
* The specs that draw a cell's slot colors `to` where the segment drew
|
|
270
272
|
* `from` with `wire`: each moved slot in the spec `movedSpecs` writes it
|
|
271
273
|
* in, the rest as `wire` wrote them.
|
|
272
274
|
*/
|
|
@@ -275,24 +277,22 @@ export declare class Recolored implements Renderable, Measurable {
|
|
|
275
277
|
/**
|
|
276
278
|
* `renderable` under `effect` over time: an `Animation<Renderable>` whose
|
|
277
279
|
* value at `t` is the element through the effect at `t`, placed wherever a
|
|
278
|
-
* renderable goes.
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* depth (`
|
|
283
|
-
*
|
|
284
|
-
* host sleeps.
|
|
280
|
+
* renderable goes. An `Effect` is made from what the element draws, so with
|
|
281
|
+
* nothing drawn its answer to when it changes is `t`, at every time: early,
|
|
282
|
+
* never false. Placed, on its own or as a part of any combinator, it says
|
|
283
|
+
* exactly: the frame's drawing told the effect's hold at that time and the
|
|
284
|
+
* output's depth (`Reads`), so at a depth that shows no motion a loop says it
|
|
285
|
+
* never changes there and the host sleeps.
|
|
285
286
|
*/
|
|
286
287
|
export declare class Effected implements Animation<Renderable> {
|
|
287
288
|
readonly renderable: Renderable;
|
|
288
289
|
readonly effect: Effect;
|
|
289
290
|
readonly key: string;
|
|
290
|
-
readonly theme: TerminalColors;
|
|
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
|
-
|
|
295
|
-
|
|
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,17 +302,17 @@ export declare class Effected implements Animation<Renderable> {
|
|
|
302
302
|
maximum: number;
|
|
303
303
|
};
|
|
304
304
|
/**
|
|
305
|
-
* The
|
|
306
|
-
* both as the screen shows them, at `depth` on `
|
|
307
|
-
* moving a pair's
|
|
305
|
+
* The colors the screen shows for `pair` once it is drawn moved to `to`,
|
|
306
|
+
* both as the screen shows them, at `depth` on `terminal`: what an effect
|
|
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
|
*/
|
|
311
|
-
static shows(pair: Pair, to: CellColors, depth: ColorDepth,
|
|
311
|
+
static shows(pair: Pair, to: CellColors, depth: ColorDepth, terminal: TerminalColors): CellColors;
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -351,11 +351,12 @@ export declare function inked(text: string): boolean;
|
|
|
351
351
|
*/
|
|
352
352
|
export declare function confined(effect: Effect, ...owners: readonly object[]): Effect;
|
|
353
353
|
/**
|
|
354
|
-
* What `segments`, drawn at `depth` on `
|
|
355
|
-
* as `Effected` measures its child for every frame
|
|
356
|
-
*
|
|
354
|
+
* What `segments`, drawn at `depth` on `terminal`, draw their words in, measured
|
|
355
|
+
* as `Effected` measures its child for every frame, so `options.terminal` means
|
|
356
|
+
* here what it means on a frame. Measure an element's output under an effect to
|
|
357
|
+
* read the contrast its words are left at.
|
|
357
358
|
*/
|
|
358
|
-
export declare function drawnOf(segments: Iterable<Segment>, depth: ColorDepth,
|
|
359
|
+
export declare function drawnOf(segments: Iterable<Segment>, depth: ColorDepth, terminal?: TerminalColors): Drawn;
|
|
359
360
|
/**
|
|
360
361
|
* The attributes a look carries, read off anything that sets them — a
|
|
361
362
|
* `Style`, or a look a frame returned with more on it than `CellAttributes`
|