@promptctl/rich-js 0.7.0 → 0.9.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 +99 -31
- package/dist/core/box.d.ts +96 -42
- package/dist/core/box.d.ts.map +1 -1
- package/dist/core/box.js +348 -490
- package/dist/core/box.js.map +1 -1
- package/dist/core/cells.d.ts +46 -1
- package/dist/core/cells.d.ts.map +1 -1
- package/dist/core/cells.js +55 -14
- package/dist/core/cells.js.map +1 -1
- package/dist/core/color.d.ts.map +1 -1
- package/dist/core/color.js +22 -8
- package/dist/core/color.js.map +1 -1
- package/dist/core/console.d.ts +30 -14
- package/dist/core/console.d.ts.map +1 -1
- package/dist/core/console.js +176 -104
- package/dist/core/console.js.map +1 -1
- package/dist/core/highlighter.d.ts +2 -1
- package/dist/core/highlighter.d.ts.map +1 -1
- package/dist/core/highlighter.js +28 -6
- package/dist/core/highlighter.js.map +1 -1
- package/dist/{renderables → core}/json.d.ts +8 -3
- package/dist/core/json.d.ts.map +1 -0
- package/dist/{renderables → core}/json.js +7 -2
- package/dist/core/json.js.map +1 -0
- package/dist/core/markup.d.ts +6 -9
- package/dist/core/markup.d.ts.map +1 -1
- package/dist/core/markup.js +153 -47
- package/dist/core/markup.js.map +1 -1
- package/dist/core/measure.d.ts +11 -0
- package/dist/core/measure.d.ts.map +1 -1
- package/dist/core/measure.js +15 -3
- package/dist/core/measure.js.map +1 -1
- package/dist/core/oklch.d.ts +22 -0
- package/dist/core/oklch.d.ts.map +1 -1
- package/dist/core/oklch.js +62 -18
- package/dist/core/oklch.js.map +1 -1
- package/dist/core/pretty.d.ts +122 -0
- package/dist/core/pretty.d.ts.map +1 -0
- package/dist/core/pretty.js +398 -0
- package/dist/core/pretty.js.map +1 -0
- package/dist/core/protocol.d.ts +80 -0
- package/dist/core/protocol.d.ts.map +1 -1
- package/dist/core/protocol.js +85 -0
- package/dist/core/protocol.js.map +1 -1
- package/dist/core/segment.d.ts +26 -0
- package/dist/core/segment.d.ts.map +1 -1
- package/dist/core/segment.js +45 -0
- package/dist/core/segment.js.map +1 -1
- package/dist/core/strip.d.ts +9 -5
- package/dist/core/strip.d.ts.map +1 -1
- package/dist/core/strip.js +39 -41
- package/dist/core/strip.js.map +1 -1
- package/dist/core/style.d.ts +19 -0
- package/dist/core/style.d.ts.map +1 -1
- package/dist/core/style.js +46 -38
- package/dist/core/style.js.map +1 -1
- package/dist/core/subscription.d.ts +13 -0
- package/dist/core/subscription.d.ts.map +1 -0
- package/dist/core/subscription.js +13 -0
- package/dist/core/subscription.js.map +1 -0
- package/dist/core/text.d.ts +102 -4
- package/dist/core/text.d.ts.map +1 -1
- package/dist/core/text.js +332 -162
- package/dist/core/text.js.map +1 -1
- package/dist/core/wrap.d.ts +42 -0
- package/dist/core/wrap.d.ts.map +1 -0
- package/dist/core/wrap.js +128 -0
- package/dist/core/wrap.js.map +1 -0
- package/dist/host/host-stream.d.ts.map +1 -0
- package/dist/host/host-stream.js.map +1 -0
- package/dist/host/index.d.ts +4 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +3 -0
- package/dist/host/index.js.map +1 -0
- package/dist/{widgets → host}/terminal-host.d.ts +20 -64
- package/dist/host/terminal-host.d.ts.map +1 -0
- package/dist/host/terminal-host.js +133 -0
- package/dist/host/terminal-host.js.map +1 -0
- package/dist/index.d.ts +13 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -22
- package/dist/index.js.map +1 -1
- package/dist/node/terminal-host.d.ts +85 -0
- package/dist/node/terminal-host.d.ts.map +1 -0
- package/dist/node/terminal-host.js +161 -0
- package/dist/node/terminal-host.js.map +1 -0
- package/dist/node/traceback.d.ts +28 -0
- package/dist/node/traceback.d.ts.map +1 -0
- package/dist/node/traceback.js +113 -0
- package/dist/node/traceback.js.map +1 -0
- package/dist/renderables/columns.d.ts +24 -2
- package/dist/renderables/columns.d.ts.map +1 -1
- package/dist/renderables/columns.js +91 -32
- package/dist/renderables/columns.js.map +1 -1
- package/dist/renderables/layout.d.ts +61 -5
- package/dist/renderables/layout.d.ts.map +1 -1
- package/dist/renderables/layout.js +191 -19
- package/dist/renderables/layout.js.map +1 -1
- package/dist/renderables/markdown.d.ts +1 -1
- package/dist/renderables/markdown.d.ts.map +1 -1
- package/dist/renderables/markdown.js +7 -14
- package/dist/renderables/markdown.js.map +1 -1
- package/dist/renderables/padding.d.ts +16 -3
- package/dist/renderables/padding.d.ts.map +1 -1
- package/dist/renderables/padding.js +96 -47
- package/dist/renderables/padding.js.map +1 -1
- package/dist/renderables/panel.d.ts +48 -7
- package/dist/renderables/panel.d.ts.map +1 -1
- package/dist/renderables/panel.js +175 -106
- package/dist/renderables/panel.js.map +1 -1
- package/dist/renderables/progress.d.ts +3 -3
- package/dist/renderables/progress.d.ts.map +1 -1
- package/dist/renderables/progress.js +11 -9
- package/dist/renderables/progress.js.map +1 -1
- package/dist/renderables/progressBar.d.ts +3 -3
- package/dist/renderables/progressBar.d.ts.map +1 -1
- package/dist/renderables/progressBar.js +9 -15
- package/dist/renderables/progressBar.js.map +1 -1
- package/dist/renderables/prompt.js +1 -1
- package/dist/renderables/prompt.js.map +1 -1
- package/dist/renderables/rule.d.ts +1 -1
- package/dist/renderables/rule.d.ts.map +1 -1
- package/dist/renderables/rule.js +5 -10
- package/dist/renderables/rule.js.map +1 -1
- package/dist/renderables/spinner.d.ts +2 -2
- package/dist/renderables/spinner.d.ts.map +1 -1
- package/dist/renderables/spinner.js +6 -11
- package/dist/renderables/spinner.js.map +1 -1
- package/dist/renderables/status.d.ts.map +1 -1
- package/dist/renderables/status.js +5 -11
- package/dist/renderables/status.js.map +1 -1
- package/dist/renderables/table.d.ts +90 -16
- package/dist/renderables/table.d.ts.map +1 -1
- package/dist/renderables/table.js +481 -223
- package/dist/renderables/table.js.map +1 -1
- package/dist/renderables/traceback.d.ts +7 -3
- package/dist/renderables/traceback.d.ts.map +1 -1
- package/dist/renderables/traceback.js +15 -18
- package/dist/renderables/traceback.js.map +1 -1
- package/dist/renderables/tree.d.ts +29 -4
- package/dist/renderables/tree.d.ts.map +1 -1
- package/dist/renderables/tree.js +86 -33
- package/dist/renderables/tree.js.map +1 -1
- package/dist/template-bindings/color-funcs.d.ts +3 -3
- package/dist/template-bindings/color-funcs.js +3 -3
- package/dist/template-bindings/helpers.d.ts.map +1 -1
- package/dist/template-bindings/helpers.js +19 -1
- package/dist/template-bindings/helpers.js.map +1 -1
- package/dist/template-bindings/index.d.ts +6 -7
- package/dist/template-bindings/index.d.ts.map +1 -1
- package/dist/template-bindings/index.js +6 -7
- package/dist/template-bindings/index.js.map +1 -1
- package/dist/template-bindings/palette-funcs.d.ts +17 -5
- package/dist/template-bindings/palette-funcs.d.ts.map +1 -1
- package/dist/template-bindings/palette-funcs.js +69 -6
- package/dist/template-bindings/palette-funcs.js.map +1 -1
- package/dist/template-bindings/style-funcs.d.ts +1 -1
- package/dist/template-bindings/style-funcs.js +1 -1
- package/dist/themes/ramp.d.ts +84 -0
- package/dist/themes/ramp.d.ts.map +1 -0
- package/dist/themes/ramp.js +123 -0
- package/dist/themes/ramp.js.map +1 -0
- package/dist/widgets/dropdown.d.ts +1 -1
- package/dist/widgets/dropdown.js +1 -1
- package/dist/widgets/event-router.d.ts +3 -2
- package/dist/widgets/event-router.d.ts.map +1 -1
- package/dist/widgets/focus-manager.d.ts +2 -1
- package/dist/widgets/focus-manager.d.ts.map +1 -1
- package/dist/widgets/index.d.ts +3 -6
- package/dist/widgets/index.d.ts.map +1 -1
- package/dist/widgets/index.js +4 -3
- package/dist/widgets/index.js.map +1 -1
- package/dist/widgets/screen.d.ts +1 -1
- package/dist/widgets/screen.d.ts.map +1 -1
- package/dist/widgets/text-input.d.ts +2 -3
- package/dist/widgets/text-input.d.ts.map +1 -1
- package/dist/widgets/text-input.js +4 -12
- package/dist/widgets/text-input.js.map +1 -1
- package/dist/widgets/types.d.ts +1 -1
- package/dist/widgets/types.d.ts.map +1 -1
- package/dist/widgets/types.js.map +1 -1
- package/dist/widgets/widget-base.d.ts +2 -1
- package/dist/widgets/widget-base.d.ts.map +1 -1
- package/package.json +38 -6
- package/dist/renderables/json.d.ts.map +0 -1
- package/dist/renderables/json.js.map +0 -1
- package/dist/renderables/pretty.d.ts +0 -29
- package/dist/renderables/pretty.d.ts.map +0 -1
- package/dist/renderables/pretty.js +0 -141
- package/dist/renderables/pretty.js.map +0 -1
- package/dist/themes/paletteResolver.d.ts +0 -35
- package/dist/themes/paletteResolver.d.ts.map +0 -1
- package/dist/themes/paletteResolver.js +0 -88
- package/dist/themes/paletteResolver.js.map +0 -1
- package/dist/widgets/host-stream.d.ts.map +0 -1
- package/dist/widgets/host-stream.js.map +0 -1
- package/dist/widgets/terminal-host.d.ts.map +0 -1
- package/dist/widgets/terminal-host.js +0 -258
- package/dist/widgets/terminal-host.js.map +0 -1
- /package/dist/{widgets → host}/host-stream.d.ts +0 -0
- /package/dist/{widgets → host}/host-stream.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cellLen, setCellSize, splitText, chopCells, cellFit,
|
|
1
|
+
export { cellLen, setCellSize, splitText, chopCells, cellFit, asCellCol, asCodePoint, } from "./core/cells.js";
|
|
2
2
|
export type { CellCol, CodeUnit, CodePoint } from "./core/cells.js";
|
|
3
3
|
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, parseRgbHex, parseRgbaHex, blendRgb, resolveColorSystem, detectColorSystem, STANDARD_TABLE, EIGHT_BIT_TABLE, WINDOWS_TABLE, ANSI_COLOR_NAMES, } from "./core/color.js";
|
|
4
4
|
export type { DetectColorOptions } from "./core/color.js";
|
|
@@ -13,15 +13,18 @@ export { getThemePalette, listThemePalettes } from "./themes/registry.js";
|
|
|
13
13
|
export type { ThemeName } from "./themes/registry.js";
|
|
14
14
|
export { transposePalette, themeKeyForRoot, isAnchored, ANCHORED_ROOTS, } from "./themes/transpose.js";
|
|
15
15
|
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast, } from "./themes/colorMath.js";
|
|
16
|
+
export { ColorRamp, RAMP_EASING_NAMES, parseRampEasing } from "./themes/ramp.js";
|
|
17
|
+
export type { ColorStop, RampEasing } from "./themes/ramp.js";
|
|
16
18
|
export { Style, StyleSyntaxError, StyleStack, Theme, NULL_STYLE, DEFAULT_STYLES, } from "./core/style.js";
|
|
17
19
|
export type { StyleOptions } from "./core/style.js";
|
|
18
20
|
export { Segment, ControlType, } from "./core/segment.js";
|
|
19
21
|
export type { ControlCode } from "./core/segment.js";
|
|
20
22
|
export { Box } from "./core/box.js";
|
|
21
|
-
export type {
|
|
23
|
+
export type { EdgeChars, ContentChars, RowLevel, SubstituteOptions } from "./core/box.js";
|
|
22
24
|
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";
|
|
23
|
-
export { isRenderable, isMeasurable, } from "./core/protocol.js";
|
|
25
|
+
export { isRenderable, isMeasurable, withCellWidth, withBoundedWidth, } from "./core/protocol.js";
|
|
24
26
|
export type { RenderOptions, Renderable, Measurable, } from "./core/protocol.js";
|
|
27
|
+
export type { Unsubscribe } from "./core/subscription.js";
|
|
25
28
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
26
29
|
export { Span, RichText } from "./core/text.js";
|
|
27
30
|
export type { RichTextOptions } from "./core/text.js";
|
|
@@ -29,15 +32,19 @@ export { Strip, PowerlineJoiner, CapsuleJoiner, PlainJoiner, GradientJoiner, } f
|
|
|
29
32
|
export type { StyledRenderable, Joiner, PowerlineJoinerOptions, CapsuleJoinerOptions, PlainJoinerOptions, GradientJoinerOptions, } from "./core/strip.js";
|
|
30
33
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
31
34
|
export type { RenderToStringOptions } from "./core/render.js";
|
|
32
|
-
export { MarkupRegistry, globalMarkupRegistry,
|
|
35
|
+
export { MarkupRegistry, globalMarkupRegistry, renderMarkup, } from "./core/markup.js";
|
|
33
36
|
export type { MarkupTagContext, MarkupTagHandler, RenderMarkupOptions, } from "./core/markup.js";
|
|
34
37
|
export { EMOJI, emojiReplace, Emoji, NoEmoji } from "./core/emoji.js";
|
|
35
|
-
export {
|
|
38
|
+
export { MarkupError, escape as escapeMarkup } from "./core/markup.js";
|
|
36
39
|
export { Highlighter, NullHighlighter, RegexHighlighter, ReprHighlighter, JSONHighlighter, ISO8601Highlighter, } from "./core/highlighter.js";
|
|
40
|
+
export { Pretty } from "./core/pretty.js";
|
|
41
|
+
export type { PrettyOptions } from "./core/pretty.js";
|
|
42
|
+
export { JSONRenderable } from "./core/json.js";
|
|
43
|
+
export type { JSONOptions } from "./core/json.js";
|
|
37
44
|
export { SPINNERS, DEFAULT_SPINNER } from "./core/spinnerData.js";
|
|
38
45
|
export type { SpinnerData } from "./core/spinnerData.js";
|
|
39
46
|
export { Console } from "./core/console.js";
|
|
40
|
-
export type { ConsoleOptions, ConsoleSink, PrintOptions } from "./core/console.js";
|
|
47
|
+
export type { ConsoleOptions, ConsoleSink, ConsoleStream, ConsoleEnvironment, PrintOptions, } from "./core/console.js";
|
|
41
48
|
export { Constrain } from "./renderables/constrain.js";
|
|
42
49
|
export { Align } from "./renderables/align.js";
|
|
43
50
|
export type { Alignment } from "./renderables/align.js";
|
|
@@ -56,10 +63,6 @@ export { Table, Column } from "./renderables/table.js";
|
|
|
56
63
|
export type { TableOptions, ColumnOptions } from "./renderables/table.js";
|
|
57
64
|
export { Tree } from "./renderables/tree.js";
|
|
58
65
|
export type { TreeOptions } from "./renderables/tree.js";
|
|
59
|
-
export { JSONRenderable } from "./renderables/json.js";
|
|
60
|
-
export type { JSONOptions } from "./renderables/json.js";
|
|
61
|
-
export { Pretty } from "./renderables/pretty.js";
|
|
62
|
-
export type { PrettyOptions } from "./renderables/pretty.js";
|
|
63
66
|
export { Columns } from "./renderables/columns.js";
|
|
64
67
|
export type { ColumnsOptions } from "./renderables/columns.js";
|
|
65
68
|
export { FlexStrip } from "./renderables/flexStrip.js";
|
|
@@ -80,30 +83,4 @@ export { Markdown } from "./renderables/markdown.js";
|
|
|
80
83
|
export type { MarkdownOptions } from "./renderables/markdown.js";
|
|
81
84
|
export { Layout } from "./renderables/layout.js";
|
|
82
85
|
export type { LayoutOptions } from "./renderables/layout.js";
|
|
83
|
-
export type { KeyEventInit, KeyHandlerPriority, KeyHandlerOptions, WidgetMouseEvent, WidgetFocusEvent, WidgetBounds, InteractiveWidget, FocusManager, Screen, MountEntry, Placement, Unsubscribe, OverlayRenderable, } from "./widgets/types.js";
|
|
84
|
-
export { FLOW, KeyEvent, hasOverlay } from "./widgets/types.js";
|
|
85
|
-
export { StaticItem } from "./widgets/static-item.js";
|
|
86
|
-
export type { StaticItemOptions } from "./widgets/static-item.js";
|
|
87
|
-
export { WidgetBase } from "./widgets/widget-base.js";
|
|
88
|
-
export { DefaultFocusManager } from "./widgets/focus-manager.js";
|
|
89
|
-
export { DefaultScreen } from "./widgets/screen.js";
|
|
90
|
-
export type { ScreenOptions, ColorSystemSpec } from "./widgets/screen.js";
|
|
91
|
-
export { Button } from "./widgets/button.js";
|
|
92
|
-
export type { ButtonVariant, ButtonOptions } from "./widgets/button.js";
|
|
93
|
-
export { Checkbox } from "./widgets/checkbox.js";
|
|
94
|
-
export type { CheckboxOptions } from "./widgets/checkbox.js";
|
|
95
|
-
export { Toggle } from "./widgets/toggle.js";
|
|
96
|
-
export type { ToggleVariant, ToggleOptions } from "./widgets/toggle.js";
|
|
97
|
-
export { TextInput } from "./widgets/text-input.js";
|
|
98
|
-
export type { TextInputOptions } from "./widgets/text-input.js";
|
|
99
|
-
export { Dropdown } from "./widgets/dropdown.js";
|
|
100
|
-
export type { DropdownOptions } from "./widgets/dropdown.js";
|
|
101
|
-
export { Slider } from "./widgets/slider.js";
|
|
102
|
-
export type { SliderOptions } from "./widgets/slider.js";
|
|
103
|
-
export { EventRouter } from "./widgets/event-router.js";
|
|
104
|
-
export type { EventRouterOptions } from "./widgets/event-router.js";
|
|
105
|
-
export { NodeTerminalHost, BrowserTerminalHost } from "./widgets/terminal-host.js";
|
|
106
|
-
export type { TerminalHost, TerminalSize, DataHandler, ResizeHandler, NodeTerminalHostOptions, BrowserTerminalHostOptions, XtermTerminal, XtermDisposable, XtermResizeEvent, } from "./widgets/terminal-host.js";
|
|
107
|
-
export { hostStream } from "./widgets/host-stream.js";
|
|
108
|
-
export { createRichTextEngine, richTextFuncs } from "./template-bindings/index.js";
|
|
109
86
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D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AClB,KAAK,GACN,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Core primitives
|
|
2
|
-
export { cellLen, setCellSize, splitText, chopCells, cellFit,
|
|
2
|
+
export { cellLen, setCellSize, splitText, chopCells, cellFit, asCellCol, asCodePoint, } from "./core/cells.js";
|
|
3
3
|
export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, parseRgbHex, parseRgbaHex, blendRgb, resolveColorSystem, detectColorSystem, STANDARD_TABLE, EIGHT_BIT_TABLE, WINDOWS_TABLE, ANSI_COLOR_NAMES, } from "./core/color.js";
|
|
4
4
|
// Perceptually-uniform color space (manipulation, transposition).
|
|
5
5
|
export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
|
|
@@ -22,12 +22,17 @@ export { transposePalette, themeKeyForRoot, isAnchored, ANCHORED_ROOTS, } from "
|
|
|
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
24
|
export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast, } from "./themes/colorMath.js";
|
|
25
|
+
// A number → a color through ordered stops, interpolated in OKLCH — the one
|
|
26
|
+
// color operation whose input is a measurement rather than a color, so a
|
|
27
|
+
// gradient (or, with the `step` easing, a threshold cascade) stays inside the
|
|
28
|
+
// theme system instead of being computed beside it.
|
|
29
|
+
export { ColorRamp, RAMP_EASING_NAMES, parseRampEasing } from "./themes/ramp.js";
|
|
25
30
|
export { Style, StyleSyntaxError, StyleStack, Theme, NULL_STYLE, DEFAULT_STYLES, } from "./core/style.js";
|
|
26
31
|
export { Segment, ControlType, } from "./core/segment.js";
|
|
27
32
|
export { Box } from "./core/box.js";
|
|
28
33
|
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";
|
|
29
34
|
// Protocol
|
|
30
|
-
export { isRenderable, isMeasurable, } from "./core/protocol.js";
|
|
35
|
+
export { isRenderable, isMeasurable, withCellWidth, withBoundedWidth, } from "./core/protocol.js";
|
|
31
36
|
// Measurement
|
|
32
37
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
33
38
|
// Text
|
|
@@ -37,13 +42,17 @@ export { Strip, PowerlineJoiner, CapsuleJoiner, PlainJoiner, GradientJoiner, } f
|
|
|
37
42
|
// renderToString — stateless one-shot emission
|
|
38
43
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
39
44
|
// Markup plugin tags
|
|
40
|
-
export { MarkupRegistry, globalMarkupRegistry,
|
|
45
|
+
export { MarkupRegistry, globalMarkupRegistry, renderMarkup, } from "./core/markup.js";
|
|
41
46
|
// Emoji
|
|
42
47
|
export { EMOJI, emojiReplace, Emoji, NoEmoji } from "./core/emoji.js";
|
|
43
48
|
// Markup
|
|
44
|
-
export {
|
|
49
|
+
export { MarkupError, escape as escapeMarkup } from "./core/markup.js";
|
|
45
50
|
// Highlighter
|
|
46
51
|
export { Highlighter, NullHighlighter, RegexHighlighter, ReprHighlighter, JSONHighlighter, ISO8601Highlighter, } from "./core/highlighter.js";
|
|
52
|
+
// Pretty
|
|
53
|
+
export { Pretty } from "./core/pretty.js";
|
|
54
|
+
// JSON
|
|
55
|
+
export { JSONRenderable } from "./core/json.js";
|
|
47
56
|
// Spinner data
|
|
48
57
|
export { SPINNERS, DEFAULT_SPINNER } from "./core/spinnerData.js";
|
|
49
58
|
// Console
|
|
@@ -59,8 +68,6 @@ export { ProgressBar } from "./renderables/progressBar.js";
|
|
|
59
68
|
export { Spinner } from "./renderables/spinner.js";
|
|
60
69
|
export { Table, Column } from "./renderables/table.js";
|
|
61
70
|
export { Tree } from "./renderables/tree.js";
|
|
62
|
-
export { JSONRenderable } from "./renderables/json.js";
|
|
63
|
-
export { Pretty } from "./renderables/pretty.js";
|
|
64
71
|
export { Columns } from "./renderables/columns.js";
|
|
65
72
|
export { FlexStrip } from "./renderables/flexStrip.js";
|
|
66
73
|
export { Live } from "./renderables/live.js";
|
|
@@ -71,20 +78,26 @@ export { Traceback } from "./renderables/traceback.js";
|
|
|
71
78
|
export { Syntax } from "./renderables/syntax.js";
|
|
72
79
|
export { Markdown } from "./renderables/markdown.js";
|
|
73
80
|
export { Layout } from "./renderables/layout.js";
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
81
|
+
// The barrel stops at `renderables/`, and the two subsystems above it are reached
|
|
82
|
+
// through their own `package.json#exports` subpaths instead:
|
|
83
|
+
//
|
|
84
|
+
// `@promptctl/rich-js/widgets` — the interactive layer (pulls in `mobx`)
|
|
85
|
+
// `@promptctl/rich-js/template-bindings` — the styling vocabulary (pulls in
|
|
86
|
+
// `@promptctl/go-template-js`)
|
|
87
|
+
//
|
|
88
|
+
// `@promptctl/rich-js/host` is a third subpath but a different kind of thing: the
|
|
89
|
+
// terminal seam has no third-party dependency at all, and sits on its own subpath
|
|
90
|
+
// because it is what a *non*-interactive program reaches for. Folding it into either
|
|
91
|
+
// neighbour is what the split was undoing — inside `widgets/` it charged mobx to
|
|
92
|
+
// consumers who only wanted to write bytes; in this barrel it would put an I/O
|
|
93
|
+
// capability in front of consumers who never touch a terminal directly.
|
|
94
|
+
//
|
|
95
|
+
// `export … from` is a static edge, so anything named here is *evaluated* by every
|
|
96
|
+
// consumer, including one that only wanted a Table. Re-exporting the two subsystems
|
|
97
|
+
// therefore charged their dependencies to the whole package — mobx and, transitively,
|
|
98
|
+
// @noble/hashes. The subpaths make that cost something a consumer opts into, the same
|
|
99
|
+
// bargain `src/node/` strikes for Node built-ins.
|
|
100
|
+
//
|
|
101
|
+
// This is also why there is no widget list here to keep in sync: `src/widgets/index.ts`
|
|
102
|
+
// is that list, and a copy of it in this file would be a second one to drift from.
|
|
90
103
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EACL,OAAO,EACP,WAAW,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;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,KAAK,GACN,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,kFAAkF;AAClF,6DAA6D;AAC7D,EAAE;AACF,uFAAuF;AACvF,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,qFAAqF;AACrF,iFAAiF;AACjF,+EAA+E;AAC/E,wEAAwE;AACxE,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,sFAAsF;AACtF,sFAAsF;AACtF,kDAAkD;AAClD,EAAE;AACF,wFAAwF;AACxF,mFAAmF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* node:terminal-host — the `TerminalHost` implementation backed by node's
|
|
3
|
+
* process streams.
|
|
4
|
+
*
|
|
5
|
+
* [LAW:locality-or-seam] The `TerminalHost` interface is the seam and lives
|
|
6
|
+
* in `widgets/terminal-host.ts`, importable anywhere. *This* file is one
|
|
7
|
+
* value satisfying that interface, and it reads `process.stdin` /
|
|
8
|
+
* `process.stdout`, so it is a node subpath:
|
|
9
|
+
*
|
|
10
|
+
* import { NodeTerminalHost } from "@promptctl/rich-js/node/terminal-host";
|
|
11
|
+
* const screen = new Screen(new NodeTerminalHost());
|
|
12
|
+
*
|
|
13
|
+
* The ambient `process` global is not an import, so it slips past the
|
|
14
|
+
* module-graph reasoning that keeps the main barrel browser-safe: reading
|
|
15
|
+
* `process.stdin` inside a constructor throws in a browser only when someone
|
|
16
|
+
* constructs it. Moving the class here makes the boundary structural — a
|
|
17
|
+
* browser bundle that never reaches for this subpath cannot reach the global
|
|
18
|
+
* either.
|
|
19
|
+
*
|
|
20
|
+
* [LAW:no-shared-mutable-globals] Which files may read the host, and what
|
|
21
|
+
* each takes off it, is `HOST_ACCESS` in `test/seam/ambient-process.ts` —
|
|
22
|
+
* this file's entry carries its `why`, and a test fails when anything joins
|
|
23
|
+
* the list. Deliberately not restated here: the sole-ownership sentence that
|
|
24
|
+
* used to stand in this spot is what that list replaced.
|
|
25
|
+
*
|
|
26
|
+
* So if you find yourself reaching for `process.stdin`, `process.stdout`, or
|
|
27
|
+
* `setRawMode` in the runtime or in a demo, take a `TerminalHost` parameter
|
|
28
|
+
* instead. The seam is already here.
|
|
29
|
+
*/
|
|
30
|
+
import type { DataHandler, ResizeHandler, TerminalHost, TerminalSize } from "../host/terminal-host.js";
|
|
31
|
+
import type { Unsubscribe } from "../core/subscription.js";
|
|
32
|
+
/**
|
|
33
|
+
* Subset of NodeJS stream API the node host actually depends on. Tests
|
|
34
|
+
* construct a host over PassThrough / Writable mocks; production wires it
|
|
35
|
+
* to `process.stdin` / `process.stdout`.
|
|
36
|
+
*/
|
|
37
|
+
interface NodeReadable {
|
|
38
|
+
on(event: "data", listener: (chunk: Buffer | string) => void): unknown;
|
|
39
|
+
off(event: "data", listener: (chunk: Buffer | string) => void): unknown;
|
|
40
|
+
setRawMode?(raw: boolean): unknown;
|
|
41
|
+
resume?(): unknown;
|
|
42
|
+
pause?(): unknown;
|
|
43
|
+
readonly isTTY?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface NodeWritable {
|
|
46
|
+
write(chunk: string | Uint8Array): unknown;
|
|
47
|
+
on(event: "resize", listener: () => void): unknown;
|
|
48
|
+
off(event: "resize", listener: () => void): unknown;
|
|
49
|
+
readonly columns?: number;
|
|
50
|
+
readonly rows?: number;
|
|
51
|
+
readonly isTTY?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface NodeTerminalHostOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Input stream. Defaults to `process.stdin` so production code does not
|
|
56
|
+
* have to construct one explicitly. Tests pass a `PassThrough`.
|
|
57
|
+
*/
|
|
58
|
+
stdin?: NodeReadable;
|
|
59
|
+
/**
|
|
60
|
+
* Output stream. Defaults to `process.stdout` for the same reason.
|
|
61
|
+
* Tests pass a `Writable` mock.
|
|
62
|
+
*/
|
|
63
|
+
stdout?: NodeWritable;
|
|
64
|
+
}
|
|
65
|
+
export declare class NodeTerminalHost implements TerminalHost {
|
|
66
|
+
private readonly stdin;
|
|
67
|
+
private readonly stdout;
|
|
68
|
+
private readonly dataHandlers;
|
|
69
|
+
private readonly resizeHandlers;
|
|
70
|
+
private dataListener;
|
|
71
|
+
private resizeListener;
|
|
72
|
+
private rawModeRequested;
|
|
73
|
+
constructor(options?: NodeTerminalHostOptions);
|
|
74
|
+
get isTTY(): boolean;
|
|
75
|
+
write(data: Uint8Array | string): void;
|
|
76
|
+
size(): TerminalSize;
|
|
77
|
+
setRawMode(raw: boolean): void;
|
|
78
|
+
private applyRawMode;
|
|
79
|
+
onData(handler: DataHandler): Unsubscribe;
|
|
80
|
+
onResize(handler: ResizeHandler): Unsubscribe;
|
|
81
|
+
start(): void;
|
|
82
|
+
stop(): void;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=terminal-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-host.d.ts","sourceRoot":"","sources":["../../src/node/terminal-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,WAAW,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,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,YAAY,CAAiD;IACrE,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,GAAE,uBAA4B;IAKjD,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAItC,IAAI,IAAI,YAAY;IAOpB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAwB9B,OAAO,CAAC,YAAY;IASpB,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW;IA2BzC,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW;IAkB7C,KAAK,IAAI,IAAI;IAMb,IAAI,IAAI,IAAI;CAsBb"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* node:terminal-host — the `TerminalHost` implementation backed by node's
|
|
3
|
+
* process streams.
|
|
4
|
+
*
|
|
5
|
+
* [LAW:locality-or-seam] The `TerminalHost` interface is the seam and lives
|
|
6
|
+
* in `widgets/terminal-host.ts`, importable anywhere. *This* file is one
|
|
7
|
+
* value satisfying that interface, and it reads `process.stdin` /
|
|
8
|
+
* `process.stdout`, so it is a node subpath:
|
|
9
|
+
*
|
|
10
|
+
* import { NodeTerminalHost } from "@promptctl/rich-js/node/terminal-host";
|
|
11
|
+
* const screen = new Screen(new NodeTerminalHost());
|
|
12
|
+
*
|
|
13
|
+
* The ambient `process` global is not an import, so it slips past the
|
|
14
|
+
* module-graph reasoning that keeps the main barrel browser-safe: reading
|
|
15
|
+
* `process.stdin` inside a constructor throws in a browser only when someone
|
|
16
|
+
* constructs it. Moving the class here makes the boundary structural — a
|
|
17
|
+
* browser bundle that never reaches for this subpath cannot reach the global
|
|
18
|
+
* either.
|
|
19
|
+
*
|
|
20
|
+
* [LAW:no-shared-mutable-globals] Which files may read the host, and what
|
|
21
|
+
* each takes off it, is `HOST_ACCESS` in `test/seam/ambient-process.ts` —
|
|
22
|
+
* this file's entry carries its `why`, and a test fails when anything joins
|
|
23
|
+
* the list. Deliberately not restated here: the sole-ownership sentence that
|
|
24
|
+
* used to stand in this spot is what that list replaced.
|
|
25
|
+
*
|
|
26
|
+
* So if you find yourself reaching for `process.stdin`, `process.stdout`, or
|
|
27
|
+
* `setRawMode` in the runtime or in a demo, take a `TerminalHost` parameter
|
|
28
|
+
* instead. The seam is already here.
|
|
29
|
+
*/
|
|
30
|
+
const DEFAULT_COLS = 80;
|
|
31
|
+
const DEFAULT_ROWS = 24;
|
|
32
|
+
export class NodeTerminalHost {
|
|
33
|
+
stdin;
|
|
34
|
+
stdout;
|
|
35
|
+
dataHandlers = new Set();
|
|
36
|
+
resizeHandlers = new Set();
|
|
37
|
+
dataListener;
|
|
38
|
+
resizeListener;
|
|
39
|
+
rawModeRequested = false;
|
|
40
|
+
constructor(options = {}) {
|
|
41
|
+
this.stdin = options.stdin ?? process.stdin;
|
|
42
|
+
this.stdout = options.stdout ?? process.stdout;
|
|
43
|
+
}
|
|
44
|
+
get isTTY() {
|
|
45
|
+
return !!this.stdin.isTTY && !!this.stdout.isTTY;
|
|
46
|
+
}
|
|
47
|
+
write(data) {
|
|
48
|
+
this.stdout.write(data);
|
|
49
|
+
}
|
|
50
|
+
size() {
|
|
51
|
+
return {
|
|
52
|
+
cols: this.stdout.columns ?? DEFAULT_COLS,
|
|
53
|
+
rows: this.stdout.rows ?? DEFAULT_ROWS,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
setRawMode(raw) {
|
|
57
|
+
this.rawModeRequested = raw;
|
|
58
|
+
this.applyRawMode(raw);
|
|
59
|
+
}
|
|
60
|
+
// [LAW:single-enforcer] One site decides what to do when toggling raw
|
|
61
|
+
// mode on the underlying transport fails. Both `setRawMode` (call from
|
|
62
|
+
// outside) and `stop` (cleanup) go through this helper so neither
|
|
63
|
+
// caller has to branch on capability or exception-handling.
|
|
64
|
+
//
|
|
65
|
+
// [LAW:dataflow-not-control-flow] Two shapes of "the transport can't do
|
|
66
|
+
// this" are absorbed identically: the optional chain handles "method
|
|
67
|
+
// missing" (non-TTY streams, PassThrough in tests); the try/catch
|
|
68
|
+
// handles "method exists but threw" (node's `setRawMode` throws on
|
|
69
|
+
// closed or non-TTY streams). Callers see neither shape — they always
|
|
70
|
+
// call `setRawMode(bool)`, and the host decides what's possible.
|
|
71
|
+
//
|
|
72
|
+
// The catch is silent because the only call sites are lifecycle
|
|
73
|
+
// transitions: if the stream is already gone, there is nothing
|
|
74
|
+
// semantically meaningful for the host to do, and surfacing the
|
|
75
|
+
// exception would only make teardown brittle without giving the caller
|
|
76
|
+
// a recovery path. The demos this replaces did `try { ... } catch {}`
|
|
77
|
+
// at every call site for exactly this reason — absorbing it once here
|
|
78
|
+
// means the pattern stops spreading.
|
|
79
|
+
applyRawMode(raw) {
|
|
80
|
+
try {
|
|
81
|
+
this.stdin.setRawMode?.(raw);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Underlying stream couldn't honor the request (closed, no longer
|
|
85
|
+
// a TTY, etc.). Lifecycle continues.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
onData(handler) {
|
|
89
|
+
this.dataHandlers.add(handler);
|
|
90
|
+
// [LAW:single-enforcer] One underlying `data` listener fans out to all
|
|
91
|
+
// subscribers — keeps stdin's flowing/paused state derivable from
|
|
92
|
+
// "any subscribers?" instead of from per-call ref-counts scattered
|
|
93
|
+
// through the runtime.
|
|
94
|
+
if (!this.dataListener) {
|
|
95
|
+
this.dataListener = (chunk) => {
|
|
96
|
+
for (const h of this.dataHandlers)
|
|
97
|
+
h(chunk);
|
|
98
|
+
};
|
|
99
|
+
this.stdin.on("data", this.dataListener);
|
|
100
|
+
this.stdin.resume?.();
|
|
101
|
+
}
|
|
102
|
+
return () => {
|
|
103
|
+
this.dataHandlers.delete(handler);
|
|
104
|
+
if (this.dataHandlers.size === 0 && this.dataListener) {
|
|
105
|
+
this.stdin.off("data", this.dataListener);
|
|
106
|
+
this.dataListener = undefined;
|
|
107
|
+
// Returning stdin to paused state mirrors the symmetric "no
|
|
108
|
+
// subscribers → no flow" invariant. Without this, removing the
|
|
109
|
+
// last subscriber leaves stdin in flowing mode and the process
|
|
110
|
+
// hangs forever waiting for an event nobody is listening for.
|
|
111
|
+
this.stdin.pause?.();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
onResize(handler) {
|
|
116
|
+
this.resizeHandlers.add(handler);
|
|
117
|
+
if (!this.resizeListener) {
|
|
118
|
+
this.resizeListener = () => {
|
|
119
|
+
const size = this.size();
|
|
120
|
+
for (const h of this.resizeHandlers)
|
|
121
|
+
h(size);
|
|
122
|
+
};
|
|
123
|
+
this.stdout.on("resize", this.resizeListener);
|
|
124
|
+
}
|
|
125
|
+
return () => {
|
|
126
|
+
this.resizeHandlers.delete(handler);
|
|
127
|
+
if (this.resizeHandlers.size === 0 && this.resizeListener) {
|
|
128
|
+
this.stdout.off("resize", this.resizeListener);
|
|
129
|
+
this.resizeListener = undefined;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
start() {
|
|
134
|
+
// No-op on node: stdin/stdout are always available. Lifecycle exists
|
|
135
|
+
// so `BrowserTerminalHost` can attach to the DOM here without the
|
|
136
|
+
// runtime branching on "do I need to start?"
|
|
137
|
+
}
|
|
138
|
+
stop() {
|
|
139
|
+
// [LAW:one-source-of-truth] Symmetric teardown: drop every subscriber
|
|
140
|
+
// and detach the underlying stream listeners. After stop(), the host
|
|
141
|
+
// is in the same shape a freshly-constructed one would be in. Calling
|
|
142
|
+
// stop() repeatedly is safe — the dataListener/resizeListener guards
|
|
143
|
+
// make later calls no-ops.
|
|
144
|
+
if (this.dataListener) {
|
|
145
|
+
this.stdin.off("data", this.dataListener);
|
|
146
|
+
this.dataListener = undefined;
|
|
147
|
+
this.stdin.pause?.();
|
|
148
|
+
}
|
|
149
|
+
if (this.resizeListener) {
|
|
150
|
+
this.stdout.off("resize", this.resizeListener);
|
|
151
|
+
this.resizeListener = undefined;
|
|
152
|
+
}
|
|
153
|
+
this.dataHandlers.clear();
|
|
154
|
+
this.resizeHandlers.clear();
|
|
155
|
+
if (this.rawModeRequested) {
|
|
156
|
+
this.applyRawMode(false);
|
|
157
|
+
this.rawModeRequested = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=terminal-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-host.js","sourceRoot":"","sources":["../../src/node/terminal-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA8CH,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,OAAO,gBAAgB;IACV,KAAK,CAAe;IACpB,MAAM,CAAe;IACrB,YAAY,GAAG,IAAI,GAAG,EAAe,CAAC;IACtC,cAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnD,YAAY,CAAiD;IAC7D,cAAc,CAA2B;IACzC,gBAAgB,GAAG,KAAK,CAAC;IAEjC,YAAY,UAAmC,EAAE;QAC/C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAK,OAAO,CAAC,KAAiC,CAAC;QACzE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAK,OAAO,CAAC,MAAkC,CAAC;IAC9E,CAAC;IAED,IAAI,KAAK;QACP,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,IAAyB;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK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IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;YAClC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,KAAK;QACH,qEAAqE;QACrE,kEAAkE;QAClE,6CAA6C;IAC/C,CAAC;IAED,IAAI;QACF,sEAAsE;QACtE,qEAAqE;QACrE,sEAAsE;QACtE,qEAAqE;QACrE,2BAA2B;QAC3B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC1C,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YAC/C,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAChC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* node:traceback — install `Traceback` as the process-wide crash renderer.
|
|
3
|
+
*
|
|
4
|
+
* [LAW:locality-or-seam] `process.on` / `process.exit` live only here, on the
|
|
5
|
+
* node side of the API boundary. The `Traceback` renderable itself is pure
|
|
6
|
+
* rendering and stays in the browser-safe barrel; installing it as a global
|
|
7
|
+
* handler is a node capability, so it is a node subpath:
|
|
8
|
+
*
|
|
9
|
+
* import { installTraceback } from "@promptctl/rich-js/node/traceback";
|
|
10
|
+
* installTraceback({ suppress: ["node_modules"] });
|
|
11
|
+
*
|
|
12
|
+
* [LAW:dataflow-not-control-flow] Both crash channels register the same
|
|
13
|
+
* `report` function, unadapted. Neither payload is trusted to be an `Error`:
|
|
14
|
+
* `@types/node` annotates `uncaughtException` with `Error`, but `throw "boom"`
|
|
15
|
+
* delivers the raw string, so the annotation is a claim about the common case
|
|
16
|
+
* rather than a guarantee. `report` takes `unknown` and both channels are
|
|
17
|
+
* literally one code path.
|
|
18
|
+
*/
|
|
19
|
+
import type { TracebackOptions } from "../renderables/traceback.js";
|
|
20
|
+
/**
|
|
21
|
+
* Register rich tracebacks for uncaught exceptions and unhandled rejections.
|
|
22
|
+
*
|
|
23
|
+
* Calling this more than once replaces the previous handler — the last call
|
|
24
|
+
* wins, options included — so a process always has exactly one rich crash
|
|
25
|
+
* renderer no matter how many entry points reach for it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function installTraceback(options?: TracebackOptions): void;
|
|
28
|
+
//# sourceMappingURL=traceback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceback.d.ts","sourceRoot":"","sources":["../../src/node/traceback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAmDpE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAsCjE"}
|