@promptctl/rich-js 0.10.0 → 0.12.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/LICENSE +21 -0
- package/README.md +20 -110
- package/THIRD-PARTY-NOTICES +81 -0
- package/dist/core/box.d.ts +0 -1
- package/dist/core/box.js +0 -1
- package/dist/core/cells.d.ts +0 -1
- package/dist/core/cells.js +0 -1
- package/dist/core/color.d.ts +6 -1
- package/dist/core/color.js +6 -1
- package/dist/core/console.d.ts +13 -4
- package/dist/core/console.js +78 -87
- package/dist/core/emoji.d.ts +0 -1
- package/dist/core/emoji.js +0 -1
- package/dist/core/export-html.d.ts +24 -0
- package/dist/core/export-html.js +106 -0
- package/dist/core/export-lines.d.ts +121 -0
- package/dist/core/export-lines.js +141 -0
- package/dist/core/highlighter.d.ts +0 -1
- package/dist/core/highlighter.js +0 -1
- package/dist/core/json.d.ts +0 -1
- package/dist/core/json.js +0 -1
- package/dist/core/markup.d.ts +33 -2
- package/dist/core/markup.js +128 -16
- package/dist/core/measure.d.ts +0 -1
- package/dist/core/measure.js +0 -1
- package/dist/core/oklch.d.ts +34 -1
- package/dist/core/oklch.js +52 -5
- package/dist/core/osc8.d.ts +68 -0
- package/dist/core/osc8.js +90 -0
- package/dist/core/pretty.d.ts +21 -2
- package/dist/core/pretty.js +90 -16
- package/dist/core/protocol.d.ts +18 -2
- package/dist/core/protocol.js +0 -1
- package/dist/core/render.d.ts +0 -1
- package/dist/core/render.js +3 -10
- package/dist/core/segment.d.ts +0 -1
- package/dist/core/segment.js +0 -1
- package/dist/core/spinnerData.d.ts +0 -1
- package/dist/core/spinnerData.js +0 -1
- package/dist/core/strip.d.ts +19 -3
- package/dist/core/strip.js +58 -11
- package/dist/core/style.d.ts +3 -8
- package/dist/core/style.js +85 -68
- package/dist/core/subscription.d.ts +0 -1
- package/dist/core/subscription.js +0 -1
- package/dist/core/text.d.ts +1 -8
- package/dist/core/text.js +28 -31
- package/dist/core/wrap.d.ts +0 -1
- package/dist/core/wrap.js +0 -1
- package/dist/host/host-stream.d.ts +0 -1
- package/dist/host/host-stream.js +0 -1
- package/dist/host/index.d.ts +0 -1
- package/dist/host/index.js +0 -1
- package/dist/host/terminal-host.d.ts +0 -1
- package/dist/host/terminal-host.js +0 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +4 -3
- package/dist/node/prompt.d.ts +0 -1
- package/dist/node/prompt.js +0 -1
- package/dist/node/save.d.ts +2 -7
- package/dist/node/save.js +0 -1
- package/dist/node/terminal-host.d.ts +0 -1
- package/dist/node/terminal-host.js +0 -1
- package/dist/node/traceback.d.ts +0 -1
- package/dist/node/traceback.js +0 -1
- package/dist/renderables/align.d.ts +0 -1
- package/dist/renderables/align.js +0 -1
- package/dist/renderables/columns.d.ts +12 -1
- package/dist/renderables/columns.js +29 -5
- package/dist/renderables/constrain.d.ts +0 -1
- package/dist/renderables/constrain.js +0 -1
- package/dist/renderables/flexStrip.d.ts +0 -1
- package/dist/renderables/flexStrip.js +0 -1
- package/dist/renderables/group.d.ts +0 -1
- package/dist/renderables/group.js +0 -1
- package/dist/renderables/layout.d.ts +0 -1
- package/dist/renderables/layout.js +20 -7
- package/dist/renderables/live.d.ts +0 -1
- package/dist/renderables/live.js +0 -1
- package/dist/renderables/markdown.d.ts +0 -1
- package/dist/renderables/markdown.js +0 -1
- package/dist/renderables/padding.d.ts +0 -1
- package/dist/renderables/padding.js +0 -1
- package/dist/renderables/panel.d.ts +0 -1
- package/dist/renderables/panel.js +12 -4
- package/dist/renderables/progress.d.ts +0 -1
- package/dist/renderables/progress.js +7 -2
- package/dist/renderables/progressBar.d.ts +0 -1
- package/dist/renderables/progressBar.js +0 -1
- package/dist/renderables/prompt.d.ts +0 -1
- package/dist/renderables/prompt.js +0 -1
- package/dist/renderables/rule.d.ts +0 -1
- package/dist/renderables/rule.js +0 -1
- package/dist/renderables/spinner.d.ts +0 -1
- package/dist/renderables/spinner.js +0 -1
- package/dist/renderables/status.d.ts +0 -1
- package/dist/renderables/status.js +0 -1
- package/dist/renderables/syntax.d.ts +0 -1
- package/dist/renderables/syntax.js +0 -1
- package/dist/renderables/table.d.ts +0 -1
- package/dist/renderables/table.js +8 -3
- package/dist/renderables/traceback.d.ts +8 -7
- package/dist/renderables/traceback.js +14 -10
- package/dist/renderables/tree.d.ts +0 -1
- package/dist/renderables/tree.js +0 -1
- package/dist/template-bindings/color-funcs.d.ts +0 -1
- package/dist/template-bindings/color-funcs.js +0 -1
- package/dist/template-bindings/helpers.d.ts +0 -1
- package/dist/template-bindings/helpers.js +0 -1
- package/dist/template-bindings/index.d.ts +0 -1
- package/dist/template-bindings/index.js +0 -1
- package/dist/template-bindings/palette-funcs.d.ts +0 -1
- package/dist/template-bindings/palette-funcs.js +0 -1
- package/dist/template-bindings/style-funcs.d.ts +0 -1
- package/dist/template-bindings/style-funcs.js +0 -1
- package/dist/themes/buildPalette.d.ts +0 -1
- package/dist/themes/buildPalette.js +0 -1
- package/dist/themes/colorMath.d.ts +0 -1
- package/dist/themes/colorMath.js +0 -1
- package/dist/themes/colorRef.d.ts +0 -1
- package/dist/themes/colorRef.js +0 -1
- package/dist/themes/data/atom-one-dark.d.ts +0 -1
- package/dist/themes/data/atom-one-dark.js +0 -1
- package/dist/themes/data/atom-one-light.d.ts +0 -1
- package/dist/themes/data/atom-one-light.js +0 -1
- package/dist/themes/data/catppuccin-frappe.d.ts +0 -1
- package/dist/themes/data/catppuccin-frappe.js +0 -1
- package/dist/themes/data/catppuccin-latte.d.ts +0 -1
- package/dist/themes/data/catppuccin-latte.js +0 -1
- package/dist/themes/data/catppuccin-macchiato.d.ts +0 -1
- package/dist/themes/data/catppuccin-macchiato.js +0 -1
- package/dist/themes/data/catppuccin-mocha.d.ts +0 -1
- package/dist/themes/data/catppuccin-mocha.js +0 -1
- package/dist/themes/data/cyberpunk.d.ts +0 -1
- package/dist/themes/data/cyberpunk.js +0 -1
- package/dist/themes/data/default.d.ts +0 -1
- package/dist/themes/data/default.js +0 -1
- package/dist/themes/data/dracula.d.ts +0 -1
- package/dist/themes/data/dracula.js +0 -1
- package/dist/themes/data/flexoki.d.ts +0 -1
- package/dist/themes/data/flexoki.js +0 -1
- package/dist/themes/data/gruvbox.d.ts +0 -1
- package/dist/themes/data/gruvbox.js +0 -1
- package/dist/themes/data/index.d.ts +0 -1
- package/dist/themes/data/index.js +0 -1
- package/dist/themes/data/monokai.d.ts +0 -1
- package/dist/themes/data/monokai.js +0 -1
- package/dist/themes/data/nord.d.ts +0 -1
- package/dist/themes/data/nord.js +0 -1
- package/dist/themes/data/rose-pine-dawn.d.ts +0 -1
- package/dist/themes/data/rose-pine-dawn.js +0 -1
- package/dist/themes/data/rose-pine-moon.d.ts +0 -1
- package/dist/themes/data/rose-pine-moon.js +0 -1
- package/dist/themes/data/rose-pine.d.ts +0 -1
- package/dist/themes/data/rose-pine.js +0 -1
- package/dist/themes/data/solarized-dark.d.ts +0 -1
- package/dist/themes/data/solarized-dark.js +0 -1
- package/dist/themes/data/solarized-light.d.ts +0 -1
- package/dist/themes/data/solarized-light.js +0 -1
- package/dist/themes/data/svg-export.d.ts +0 -1
- package/dist/themes/data/svg-export.js +0 -1
- package/dist/themes/data/textual-ansi.d.ts +0 -1
- package/dist/themes/data/textual-ansi.js +0 -1
- package/dist/themes/data/textual-dark.d.ts +0 -1
- package/dist/themes/data/textual-dark.js +0 -1
- package/dist/themes/data/textual-light.d.ts +0 -1
- package/dist/themes/data/textual-light.js +0 -1
- package/dist/themes/data/tokyo-night.d.ts +0 -1
- package/dist/themes/data/tokyo-night.js +0 -1
- package/dist/themes/data/types.d.ts +0 -1
- package/dist/themes/data/types.js +0 -1
- package/dist/themes/palette.d.ts +0 -1
- package/dist/themes/palette.js +0 -1
- package/dist/themes/ramp.d.ts +0 -1
- package/dist/themes/ramp.js +0 -1
- package/dist/themes/registry.d.ts +0 -1
- package/dist/themes/registry.js +0 -1
- package/dist/themes/terminalThemes.d.ts +0 -1
- package/dist/themes/terminalThemes.js +0 -1
- package/dist/themes/transpose.d.ts +0 -1
- package/dist/themes/transpose.js +0 -1
- package/dist/widgets/button.d.ts +0 -1
- package/dist/widgets/button.js +0 -1
- package/dist/widgets/checkbox.d.ts +0 -1
- package/dist/widgets/checkbox.js +0 -1
- package/dist/widgets/dropdown.d.ts +0 -1
- package/dist/widgets/dropdown.js +0 -1
- package/dist/widgets/event-router.d.ts +0 -1
- package/dist/widgets/event-router.js +0 -1
- package/dist/widgets/focus-manager.d.ts +0 -1
- package/dist/widgets/focus-manager.js +0 -1
- package/dist/widgets/index.d.ts +0 -1
- package/dist/widgets/index.js +0 -1
- package/dist/widgets/screen.d.ts +0 -1
- package/dist/widgets/screen.js +0 -1
- package/dist/widgets/slider.d.ts +0 -1
- package/dist/widgets/slider.js +0 -1
- package/dist/widgets/static-item.d.ts +0 -1
- package/dist/widgets/static-item.js +0 -1
- package/dist/widgets/text-input.d.ts +0 -1
- package/dist/widgets/text-input.js +0 -1
- package/dist/widgets/toggle.d.ts +0 -1
- package/dist/widgets/toggle.js +0 -1
- package/dist/widgets/types.d.ts +0 -1
- package/dist/widgets/types.js +0 -1
- package/dist/widgets/widget-base.d.ts +0 -1
- package/dist/widgets/widget-base.js +0 -1
- package/package.json +4 -3
- package/dist/core/box.d.ts.map +0 -1
- package/dist/core/box.js.map +0 -1
- package/dist/core/cells.d.ts.map +0 -1
- package/dist/core/cells.js.map +0 -1
- package/dist/core/color.d.ts.map +0 -1
- package/dist/core/color.js.map +0 -1
- package/dist/core/console.d.ts.map +0 -1
- package/dist/core/console.js.map +0 -1
- package/dist/core/emoji.d.ts.map +0 -1
- package/dist/core/emoji.js.map +0 -1
- package/dist/core/highlighter.d.ts.map +0 -1
- package/dist/core/highlighter.js.map +0 -1
- package/dist/core/json.d.ts.map +0 -1
- package/dist/core/json.js.map +0 -1
- package/dist/core/markup.d.ts.map +0 -1
- package/dist/core/markup.js.map +0 -1
- package/dist/core/measure.d.ts.map +0 -1
- package/dist/core/measure.js.map +0 -1
- package/dist/core/oklch.d.ts.map +0 -1
- package/dist/core/oklch.js.map +0 -1
- package/dist/core/pretty.d.ts.map +0 -1
- package/dist/core/pretty.js.map +0 -1
- package/dist/core/protocol.d.ts.map +0 -1
- package/dist/core/protocol.js.map +0 -1
- package/dist/core/render.d.ts.map +0 -1
- package/dist/core/render.js.map +0 -1
- package/dist/core/sanitize.d.ts +0 -16
- package/dist/core/sanitize.d.ts.map +0 -1
- package/dist/core/sanitize.js +0 -19
- package/dist/core/sanitize.js.map +0 -1
- package/dist/core/segment.d.ts.map +0 -1
- package/dist/core/segment.js.map +0 -1
- package/dist/core/spinnerData.d.ts.map +0 -1
- package/dist/core/spinnerData.js.map +0 -1
- package/dist/core/strip.d.ts.map +0 -1
- package/dist/core/strip.js.map +0 -1
- package/dist/core/style.d.ts.map +0 -1
- package/dist/core/style.js.map +0 -1
- package/dist/core/subscription.d.ts.map +0 -1
- package/dist/core/subscription.js.map +0 -1
- package/dist/core/text.d.ts.map +0 -1
- package/dist/core/text.js.map +0 -1
- package/dist/core/wrap.d.ts.map +0 -1
- package/dist/core/wrap.js.map +0 -1
- package/dist/host/host-stream.d.ts.map +0 -1
- package/dist/host/host-stream.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js.map +0 -1
- package/dist/host/terminal-host.d.ts.map +0 -1
- package/dist/host/terminal-host.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/node/prompt.d.ts.map +0 -1
- package/dist/node/prompt.js.map +0 -1
- package/dist/node/save.d.ts.map +0 -1
- package/dist/node/save.js.map +0 -1
- package/dist/node/terminal-host.d.ts.map +0 -1
- package/dist/node/terminal-host.js.map +0 -1
- package/dist/node/traceback.d.ts.map +0 -1
- package/dist/node/traceback.js.map +0 -1
- package/dist/renderables/align.d.ts.map +0 -1
- package/dist/renderables/align.js.map +0 -1
- package/dist/renderables/columns.d.ts.map +0 -1
- package/dist/renderables/columns.js.map +0 -1
- package/dist/renderables/constrain.d.ts.map +0 -1
- package/dist/renderables/constrain.js.map +0 -1
- package/dist/renderables/flexStrip.d.ts.map +0 -1
- package/dist/renderables/flexStrip.js.map +0 -1
- package/dist/renderables/group.d.ts.map +0 -1
- package/dist/renderables/group.js.map +0 -1
- package/dist/renderables/layout.d.ts.map +0 -1
- package/dist/renderables/layout.js.map +0 -1
- package/dist/renderables/live.d.ts.map +0 -1
- package/dist/renderables/live.js.map +0 -1
- package/dist/renderables/markdown.d.ts.map +0 -1
- package/dist/renderables/markdown.js.map +0 -1
- package/dist/renderables/padding.d.ts.map +0 -1
- package/dist/renderables/padding.js.map +0 -1
- package/dist/renderables/panel.d.ts.map +0 -1
- package/dist/renderables/panel.js.map +0 -1
- package/dist/renderables/progress.d.ts.map +0 -1
- package/dist/renderables/progress.js.map +0 -1
- package/dist/renderables/progressBar.d.ts.map +0 -1
- package/dist/renderables/progressBar.js.map +0 -1
- package/dist/renderables/prompt.d.ts.map +0 -1
- package/dist/renderables/prompt.js.map +0 -1
- package/dist/renderables/rule.d.ts.map +0 -1
- package/dist/renderables/rule.js.map +0 -1
- package/dist/renderables/spinner.d.ts.map +0 -1
- package/dist/renderables/spinner.js.map +0 -1
- package/dist/renderables/status.d.ts.map +0 -1
- package/dist/renderables/status.js.map +0 -1
- package/dist/renderables/syntax.d.ts.map +0 -1
- package/dist/renderables/syntax.js.map +0 -1
- package/dist/renderables/table.d.ts.map +0 -1
- package/dist/renderables/table.js.map +0 -1
- package/dist/renderables/traceback.d.ts.map +0 -1
- package/dist/renderables/traceback.js.map +0 -1
- package/dist/renderables/tree.d.ts.map +0 -1
- package/dist/renderables/tree.js.map +0 -1
- package/dist/template-bindings/color-funcs.d.ts.map +0 -1
- package/dist/template-bindings/color-funcs.js.map +0 -1
- package/dist/template-bindings/helpers.d.ts.map +0 -1
- package/dist/template-bindings/helpers.js.map +0 -1
- package/dist/template-bindings/index.d.ts.map +0 -1
- package/dist/template-bindings/index.js.map +0 -1
- package/dist/template-bindings/palette-funcs.d.ts.map +0 -1
- package/dist/template-bindings/palette-funcs.js.map +0 -1
- package/dist/template-bindings/style-funcs.d.ts.map +0 -1
- package/dist/template-bindings/style-funcs.js.map +0 -1
- package/dist/themes/buildPalette.d.ts.map +0 -1
- package/dist/themes/buildPalette.js.map +0 -1
- package/dist/themes/colorMath.d.ts.map +0 -1
- package/dist/themes/colorMath.js.map +0 -1
- package/dist/themes/colorRef.d.ts.map +0 -1
- package/dist/themes/colorRef.js.map +0 -1
- package/dist/themes/data/atom-one-dark.d.ts.map +0 -1
- package/dist/themes/data/atom-one-dark.js.map +0 -1
- package/dist/themes/data/atom-one-light.d.ts.map +0 -1
- package/dist/themes/data/atom-one-light.js.map +0 -1
- package/dist/themes/data/catppuccin-frappe.d.ts.map +0 -1
- package/dist/themes/data/catppuccin-frappe.js.map +0 -1
- package/dist/themes/data/catppuccin-latte.d.ts.map +0 -1
- package/dist/themes/data/catppuccin-latte.js.map +0 -1
- package/dist/themes/data/catppuccin-macchiato.d.ts.map +0 -1
- package/dist/themes/data/catppuccin-macchiato.js.map +0 -1
- package/dist/themes/data/catppuccin-mocha.d.ts.map +0 -1
- package/dist/themes/data/catppuccin-mocha.js.map +0 -1
- package/dist/themes/data/cyberpunk.d.ts.map +0 -1
- package/dist/themes/data/cyberpunk.js.map +0 -1
- package/dist/themes/data/default.d.ts.map +0 -1
- package/dist/themes/data/default.js.map +0 -1
- package/dist/themes/data/dracula.d.ts.map +0 -1
- package/dist/themes/data/dracula.js.map +0 -1
- package/dist/themes/data/flexoki.d.ts.map +0 -1
- package/dist/themes/data/flexoki.js.map +0 -1
- package/dist/themes/data/gruvbox.d.ts.map +0 -1
- package/dist/themes/data/gruvbox.js.map +0 -1
- package/dist/themes/data/index.d.ts.map +0 -1
- package/dist/themes/data/index.js.map +0 -1
- package/dist/themes/data/monokai.d.ts.map +0 -1
- package/dist/themes/data/monokai.js.map +0 -1
- package/dist/themes/data/nord.d.ts.map +0 -1
- package/dist/themes/data/nord.js.map +0 -1
- package/dist/themes/data/rose-pine-dawn.d.ts.map +0 -1
- package/dist/themes/data/rose-pine-dawn.js.map +0 -1
- package/dist/themes/data/rose-pine-moon.d.ts.map +0 -1
- package/dist/themes/data/rose-pine-moon.js.map +0 -1
- package/dist/themes/data/rose-pine.d.ts.map +0 -1
- package/dist/themes/data/rose-pine.js.map +0 -1
- package/dist/themes/data/solarized-dark.d.ts.map +0 -1
- package/dist/themes/data/solarized-dark.js.map +0 -1
- package/dist/themes/data/solarized-light.d.ts.map +0 -1
- package/dist/themes/data/solarized-light.js.map +0 -1
- package/dist/themes/data/svg-export.d.ts.map +0 -1
- package/dist/themes/data/svg-export.js.map +0 -1
- package/dist/themes/data/textual-ansi.d.ts.map +0 -1
- package/dist/themes/data/textual-ansi.js.map +0 -1
- package/dist/themes/data/textual-dark.d.ts.map +0 -1
- package/dist/themes/data/textual-dark.js.map +0 -1
- package/dist/themes/data/textual-light.d.ts.map +0 -1
- package/dist/themes/data/textual-light.js.map +0 -1
- package/dist/themes/data/tokyo-night.d.ts.map +0 -1
- package/dist/themes/data/tokyo-night.js.map +0 -1
- package/dist/themes/data/types.d.ts.map +0 -1
- package/dist/themes/data/types.js.map +0 -1
- package/dist/themes/palette.d.ts.map +0 -1
- package/dist/themes/palette.js.map +0 -1
- package/dist/themes/ramp.d.ts.map +0 -1
- package/dist/themes/ramp.js.map +0 -1
- package/dist/themes/registry.d.ts.map +0 -1
- package/dist/themes/registry.js.map +0 -1
- package/dist/themes/terminalThemes.d.ts.map +0 -1
- package/dist/themes/terminalThemes.js.map +0 -1
- package/dist/themes/transpose.d.ts.map +0 -1
- package/dist/themes/transpose.js.map +0 -1
- package/dist/widgets/button.d.ts.map +0 -1
- package/dist/widgets/button.js.map +0 -1
- package/dist/widgets/checkbox.d.ts.map +0 -1
- package/dist/widgets/checkbox.js.map +0 -1
- package/dist/widgets/dropdown.d.ts.map +0 -1
- package/dist/widgets/dropdown.js.map +0 -1
- package/dist/widgets/event-router.d.ts.map +0 -1
- package/dist/widgets/event-router.js.map +0 -1
- package/dist/widgets/focus-manager.d.ts.map +0 -1
- package/dist/widgets/focus-manager.js.map +0 -1
- package/dist/widgets/index.d.ts.map +0 -1
- package/dist/widgets/index.js.map +0 -1
- package/dist/widgets/screen.d.ts.map +0 -1
- package/dist/widgets/screen.js.map +0 -1
- package/dist/widgets/slider.d.ts.map +0 -1
- package/dist/widgets/slider.js.map +0 -1
- package/dist/widgets/static-item.d.ts.map +0 -1
- package/dist/widgets/static-item.js.map +0 -1
- package/dist/widgets/text-input.d.ts.map +0 -1
- package/dist/widgets/text-input.js.map +0 -1
- package/dist/widgets/toggle.d.ts.map +0 -1
- package/dist/widgets/toggle.js.map +0 -1
- package/dist/widgets/types.d.ts.map +0 -1
- package/dist/widgets/types.js.map +0 -1
- package/dist/widgets/widget-base.d.ts.map +0 -1
- package/dist/widgets/widget-base.js.map +0 -1
package/dist/core/pretty.js
CHANGED
|
@@ -20,7 +20,28 @@ import { cellLen } from "./cells.js";
|
|
|
20
20
|
import { RichText } from "./text.js";
|
|
21
21
|
import { ReprHighlighter } from "./highlighter.js";
|
|
22
22
|
const reprHighlighter = new ReprHighlighter();
|
|
23
|
-
const rootFrame = (maxWidth) => ({
|
|
23
|
+
const rootFrame = (maxWidth) => ({
|
|
24
|
+
inset: 0,
|
|
25
|
+
level: 0,
|
|
26
|
+
maxWidth,
|
|
27
|
+
column: 0,
|
|
28
|
+
reserve: 0,
|
|
29
|
+
open: new WeakSet(),
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* The column reached after `text` is appended to a line currently at `column`.
|
|
33
|
+
*
|
|
34
|
+
* A hole's formatted value can itself span multiple lines — a nested
|
|
35
|
+
* container that failed its own compact try. What comes after it (a Map
|
|
36
|
+
* entry's tail, the next hole) sits after `text`'s *last* line, not at
|
|
37
|
+
* `column + cellLen(text)`, so a multi-line insert resets the column to that
|
|
38
|
+
* last line's width instead of accumulating across lines that were never on
|
|
39
|
+
* the same row.
|
|
40
|
+
*/
|
|
41
|
+
function lineColumn(column, text) {
|
|
42
|
+
const lastNewline = text.lastIndexOf("\n");
|
|
43
|
+
return lastNewline === -1 ? column + cellLen(text) : cellLen(text.slice(lastNewline + 1));
|
|
44
|
+
}
|
|
24
45
|
/**
|
|
25
46
|
* The text, when it is a single line no wider than `budget` — otherwise `null`.
|
|
26
47
|
*
|
|
@@ -111,6 +132,15 @@ function describesItself(value) {
|
|
|
111
132
|
}
|
|
112
133
|
/** What joins a container's positions on one line. Its width is charged for, so it is named once. */
|
|
113
134
|
const SEPARATOR = ", ";
|
|
135
|
+
/**
|
|
136
|
+
* What joins a container's positions across lines, once it has expanded —
|
|
137
|
+
* `SEPARATOR` without the trailing space a newline already provides.
|
|
138
|
+
* rich-pretty-xms: named, and derived rather than a second hand-typed
|
|
139
|
+
* literal, so the width it costs a non-last slot's own compact try —
|
|
140
|
+
* reserved via `Frame.reserve` — cannot drift from what `_formatObject`
|
|
141
|
+
* actually joins with.
|
|
142
|
+
*/
|
|
143
|
+
const EXPAND_SEPARATOR = SEPARATOR.trimEnd();
|
|
114
144
|
/** The marker for positions the bound dropped, or nothing when it dropped none. */
|
|
115
145
|
const elided = (dropped) => dropped > 0 ? [{ head: `... +${dropped}`, holes: [] }] : [];
|
|
116
146
|
export class Pretty {
|
|
@@ -165,11 +195,15 @@ export class Pretty {
|
|
|
165
195
|
return "undefined";
|
|
166
196
|
switch (typeof value) {
|
|
167
197
|
case "string": {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
198
|
+
// The dropped count is an annotation about the value, not part of it,
|
|
199
|
+
// so it goes after the closing quote — the way `maxLength`'s `... +N`
|
|
200
|
+
// sits beside the kept entries rather than inside the last one. Inside
|
|
201
|
+
// the quotes it reads as content, and copying it out yields a string
|
|
202
|
+
// the program never held.
|
|
203
|
+
if (this.maxString === undefined || value.length <= this.maxString) {
|
|
204
|
+
return JSON.stringify(value);
|
|
171
205
|
}
|
|
172
|
-
return JSON.stringify(
|
|
206
|
+
return JSON.stringify(value.slice(0, this.maxString)) + `+${value.length - this.maxString}`;
|
|
173
207
|
}
|
|
174
208
|
case "number":
|
|
175
209
|
case "bigint":
|
|
@@ -281,35 +315,76 @@ export class Pretty {
|
|
|
281
315
|
const shape = this._shape(value, at.level, Infinity);
|
|
282
316
|
if (shape.kind === "text")
|
|
283
317
|
return shape.text;
|
|
284
|
-
const indentStr = " ".repeat(this.indent * at.inset);
|
|
285
318
|
if (!this.expandAll) {
|
|
319
|
+
// rich-pretty-xms: budget from `at.column` and `at.reserve`, not from
|
|
320
|
+
// `at.inset` alone. `at.column` is where *this* value's text actually
|
|
321
|
+
// starts on its line, which already includes whatever `_expandSlot`
|
|
322
|
+
// prepended for us (a key and its separator, a Map entry's `" => "`,
|
|
323
|
+
// ...); `at.reserve` is what a fixed piece of literal text — the rest
|
|
324
|
+
// of this hole's own tail, or the trailing `,` a non-last slot gets
|
|
325
|
+
// joined with — is known to cost right after, before this value's own
|
|
326
|
+
// text even starts. Deriving the budget from the indent alone assumed
|
|
327
|
+
// nothing precedes *or follows* the value on its line, which is only
|
|
328
|
+
// true at the root and for the last hole of an array's last element.
|
|
286
329
|
const compact = this._joinOneLine(shape, {
|
|
287
330
|
level: at.level + 1,
|
|
288
|
-
budget: at.maxWidth -
|
|
331
|
+
budget: at.maxWidth - at.column - at.reserve,
|
|
289
332
|
open: at.open,
|
|
290
333
|
});
|
|
291
334
|
if (compact !== null)
|
|
292
335
|
return compact;
|
|
293
336
|
}
|
|
337
|
+
const indentStr = " ".repeat(this.indent * at.inset);
|
|
294
338
|
const innerIndent = " ".repeat(this.indent * (at.inset + 1));
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
339
|
+
// Every non-last slot gets `EXPAND_SEPARATOR` appended right after it
|
|
340
|
+
// below, on the same line as whatever its own last character was — the
|
|
341
|
+
// last slot doesn't. Two frames, not one per slot: `reserve` is the only
|
|
342
|
+
// field that varies, and it only ever takes these two values.
|
|
343
|
+
const base = { inset: at.inset + 1, level: at.level + 1, maxWidth: at.maxWidth, column: cellLen(innerIndent), open: at.open };
|
|
344
|
+
const midFrame = { ...base, reserve: cellLen(EXPAND_SEPARATOR) };
|
|
345
|
+
const lastFrame = { ...base, reserve: 0 };
|
|
346
|
+
const lastSlot = shape.slots.length - 1;
|
|
347
|
+
const parts = shape.slots.map((slot, i) => innerIndent + this._expandSlot(slot, i === lastSlot ? lastFrame : midFrame));
|
|
348
|
+
return shape.open + "\n" + parts.join(EXPAND_SEPARATOR + "\n") + "\n" + indentStr + shape.close;
|
|
298
349
|
}
|
|
299
|
-
/**
|
|
350
|
+
/**
|
|
351
|
+
* One position, with every value in it laid out.
|
|
352
|
+
*
|
|
353
|
+
* `at.column` is where `slot.head` begins. Rather than hand-tracking a
|
|
354
|
+
* second, parallel "column so far" alongside `out` — two values a future
|
|
355
|
+
* edit could update out of step, silently reintroducing a stale-budget bug
|
|
356
|
+
* of the same shape this file just fixed — each hole derives its own
|
|
357
|
+
* column fresh from `out` via `lineColumn`, the one place "text just
|
|
358
|
+
* emitted" becomes "column now". [LAW:one-source-of-truth] `out` is
|
|
359
|
+
* already the complete record; `column` is a read of it, not a second copy
|
|
360
|
+
* of the same fact. `_joinOneLine`'s probe sibling tracks the analogous
|
|
361
|
+
* thing via `budget` shrinking instead, because a probe already discards
|
|
362
|
+
* anything that overruns and so never needs to know where a multi-line
|
|
363
|
+
* insert's last line ends.
|
|
364
|
+
*
|
|
365
|
+
* Each hole's `reserve` is its own `tail` plus, only for the slot's last
|
|
366
|
+
* hole, whatever `at.reserve` already asked this whole slot to leave room
|
|
367
|
+
* for (`_formatObject`'s trailing `,`). An earlier hole's tail is never
|
|
368
|
+
* folded into a later hole's reserve — it is spent, not carried, the moment
|
|
369
|
+
* `out` grows past it.
|
|
370
|
+
*/
|
|
300
371
|
_expandSlot(slot, at) {
|
|
301
372
|
let out = slot.head;
|
|
302
|
-
|
|
373
|
+
const lastHole = slot.holes.length - 1;
|
|
374
|
+
for (let i = 0; i < slot.holes.length; i++) {
|
|
375
|
+
const hole = slot.holes[i];
|
|
303
376
|
// This is the read that costs the least when it fails: neighbours are
|
|
304
377
|
// unaffected, so `{ a: 1, b: [Threw: …], c: 3 }` still shows everything
|
|
305
378
|
// that could be read.
|
|
379
|
+
let text;
|
|
306
380
|
try {
|
|
307
|
-
|
|
381
|
+
const reserve = cellLen(hole.tail) + (i === lastHole ? at.reserve : 0);
|
|
382
|
+
text = this._format(hole.read(), { ...at, column: lineColumn(at.column, out), reserve });
|
|
308
383
|
}
|
|
309
384
|
catch (error) {
|
|
310
|
-
|
|
385
|
+
text = threw(error);
|
|
311
386
|
}
|
|
312
|
-
out += hole.tail;
|
|
387
|
+
out += text + hole.tail;
|
|
313
388
|
}
|
|
314
389
|
return out;
|
|
315
390
|
}
|
|
@@ -395,4 +470,3 @@ export class Pretty {
|
|
|
395
470
|
}
|
|
396
471
|
}
|
|
397
472
|
}
|
|
398
|
-
//# sourceMappingURL=pretty.js.map
|
package/dist/core/protocol.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* [LAW:one-source-of-truth] These interfaces are the single authority for the rendering contract.
|
|
4
4
|
*/
|
|
5
5
|
import type { Segment } from "./segment.js";
|
|
6
|
-
import { type Style, type Theme } from "./style.js";
|
|
6
|
+
import { type Style, type StyleSyntaxError, type Theme } from "./style.js";
|
|
7
7
|
export interface RenderOptions {
|
|
8
8
|
/**
|
|
9
9
|
* The cells this renderable may occupy. A count of cells, so a non-negative
|
|
@@ -30,7 +30,24 @@ export interface RenderOptions {
|
|
|
30
30
|
* built-in defaults apply. Read it through `getStyle` rather than directly.
|
|
31
31
|
*/
|
|
32
32
|
theme?: Theme;
|
|
33
|
+
/**
|
|
34
|
+
* Called each time a render degrades a style string it cannot parse to
|
|
35
|
+
* unstyled, once per resolution — a style the render reads twice is reported
|
|
36
|
+
* twice. Absent, the failure passes silently. A handler that throws makes
|
|
37
|
+
* the render strict: the error leaves `render`.
|
|
38
|
+
*/
|
|
39
|
+
onStyleError?: StyleErrorHandler;
|
|
33
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Receives a style error a render would otherwise absorb: the parse failure,
|
|
43
|
+
* and the whole style string it came from — the error names only the token
|
|
44
|
+
* that failed, and `"bold rd"` loses its `bold` too.
|
|
45
|
+
*
|
|
46
|
+
* [LAW:no-mode-explosion] Strict mode is not a second option beside this one.
|
|
47
|
+
* It is a handler that throws, so there is no "strict and a callback" state
|
|
48
|
+
* whose order anyone has to define.
|
|
49
|
+
*/
|
|
50
|
+
export type StyleErrorHandler = (error: StyleSyntaxError, style: string) => void;
|
|
34
51
|
/**
|
|
35
52
|
* The style a `string | Style` stands for in this render.
|
|
36
53
|
*
|
|
@@ -109,4 +126,3 @@ export interface Measurable {
|
|
|
109
126
|
}
|
|
110
127
|
export declare function isRenderable(obj: unknown): obj is Renderable;
|
|
111
128
|
export declare function isMeasurable(obj: unknown): obj is Measurable;
|
|
112
|
-
//# sourceMappingURL=protocol.d.ts.map
|
package/dist/core/protocol.js
CHANGED
package/dist/core/render.d.ts
CHANGED
|
@@ -67,4 +67,3 @@ export declare function segmentToString(segment: Segment, colorSystem: ColorDept
|
|
|
67
67
|
*/
|
|
68
68
|
export declare function segmentsToString(segments: Iterable<Segment>, colorSystem: ColorDepth | null): string;
|
|
69
69
|
export declare function renderToString(renderable: Renderable, options?: RenderToStringOptions): string;
|
|
70
|
-
//# sourceMappingURL=render.d.ts.map
|
package/dist/core/render.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* mechanical fold over it.
|
|
30
30
|
*/
|
|
31
31
|
import { ColorDepth, resolveColorSystem } from "./color.js";
|
|
32
|
-
import {
|
|
32
|
+
import { OSC8_CLOSE, osc8Open } from "./osc8.js";
|
|
33
33
|
const DEFAULT_WIDTH = 80;
|
|
34
34
|
function segmentToPiece(segment, colorSystem) {
|
|
35
35
|
if (segment.isControl)
|
|
@@ -86,16 +86,10 @@ export function segmentsToString(segments, colorSystem) {
|
|
|
86
86
|
while (l < j && pieces[l].link === link)
|
|
87
87
|
l++;
|
|
88
88
|
if (link) {
|
|
89
|
-
|
|
90
|
-
// at the one place it becomes an OSC 8 sequence, regardless of which
|
|
91
|
-
// upstream API attached it to the Style. Defense-in-depth for the
|
|
92
|
-
// RichText data-model boundary in text.ts; also covers Style paths
|
|
93
|
-
// that don't go through RichText (Console.print({style: ...}), any
|
|
94
|
-
// direct `Segment.applyStyle(... new Style({ link })) ...`).
|
|
95
|
-
parts.push(`\x1b]8;;${stripOscTerminators(link)}\x1b\\`);
|
|
89
|
+
parts.push(osc8Open(link));
|
|
96
90
|
for (let m = k; m < l; m++)
|
|
97
91
|
parts.push(pieces[m].text);
|
|
98
|
-
parts.push(
|
|
92
|
+
parts.push(OSC8_CLOSE);
|
|
99
93
|
}
|
|
100
94
|
else {
|
|
101
95
|
for (let m = k; m < l; m++)
|
|
@@ -141,4 +135,3 @@ export function renderToString(renderable, options) {
|
|
|
141
135
|
};
|
|
142
136
|
return segmentsToString(renderable.render(renderOptions), colorSystem);
|
|
143
137
|
}
|
|
144
|
-
//# sourceMappingURL=render.js.map
|
package/dist/core/segment.d.ts
CHANGED
package/dist/core/segment.js
CHANGED
package/dist/core/spinnerData.js
CHANGED
package/dist/core/strip.d.ts
CHANGED
|
@@ -58,12 +58,29 @@ export declare class Strip<T extends StyledRenderable = StyledRenderable> implem
|
|
|
58
58
|
constructor(items: readonly T[], joiner: Joiner<T>);
|
|
59
59
|
render(options: RenderOptions): Iterable<Segment>;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The least ΔE_OK two neighbouring backgrounds must differ by for the powerline
|
|
63
|
+
* arrow between them to be seen. Below it the arrow is drawn in a colour the
|
|
64
|
+
* eye cannot tell from its own background, so the joiner draws the divider
|
|
65
|
+
* instead. Twice the ~.02 threshold of a visible difference, because a seam is
|
|
66
|
+
* one cell wide.
|
|
67
|
+
*/
|
|
68
|
+
export declare const SEAM_MIN_DELTA_E = 0.04;
|
|
61
69
|
export interface PowerlineJoinerOptions {
|
|
62
|
-
/** Glyph used for every join
|
|
63
|
-
glyph
|
|
70
|
+
/** Glyph used for every join. */
|
|
71
|
+
glyph: string;
|
|
72
|
+
/**
|
|
73
|
+
* Glyph drawn between neighbours whose backgrounds the eye cannot tell apart,
|
|
74
|
+
* in the left item's text colour — the arrow itself would vanish into the
|
|
75
|
+
* shared background.
|
|
76
|
+
*/
|
|
77
|
+
divider: string;
|
|
64
78
|
}
|
|
79
|
+
/** The powerline pair: U+E0B0 (right-arrow) divided by U+E0B1 (thin right-arrow). */
|
|
80
|
+
export declare const POWERLINE_JOINER_GLYPHS: Readonly<PowerlineJoinerOptions>;
|
|
65
81
|
export declare class PowerlineJoiner<T extends StyledRenderable = StyledRenderable> implements Joiner<T> {
|
|
66
82
|
private readonly _glyph;
|
|
83
|
+
private readonly _divider;
|
|
67
84
|
constructor(options?: PowerlineJoinerOptions);
|
|
68
85
|
join(left: T | null, right: T | null): Renderable;
|
|
69
86
|
}
|
|
@@ -102,4 +119,3 @@ export declare class GradientJoiner<T extends StyledRenderable = StyledRenderabl
|
|
|
102
119
|
constructor(options?: GradientJoinerOptions);
|
|
103
120
|
join(left: T | null, right: T | null): Renderable;
|
|
104
121
|
}
|
|
105
|
-
//# sourceMappingURL=strip.d.ts.map
|
package/dist/core/strip.js
CHANGED
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
* styling, so the cell type does too.
|
|
27
27
|
*/
|
|
28
28
|
import { Segment } from "./segment.js";
|
|
29
|
-
import { Style } from "./style.js";
|
|
29
|
+
import { Style, SURFACE_BLACK } from "./style.js";
|
|
30
30
|
import { ColorSpec, blendRgb } from "./color.js";
|
|
31
|
+
import { Oklch } from "./oklch.js";
|
|
31
32
|
// --- Strip ---
|
|
32
33
|
export class Strip {
|
|
33
34
|
items;
|
|
@@ -51,6 +52,18 @@ export class Strip {
|
|
|
51
52
|
const next = i + 1 < items.length ? items[i + 1] : null;
|
|
52
53
|
yield* this.joiner.join(item, next).render(options);
|
|
53
54
|
}
|
|
55
|
+
// [LAW:one-source-of-truth] `Strip`'s sibling `FlexStrip` ends every line
|
|
56
|
+
// it emits, including the last, and the other block-level renderables
|
|
57
|
+
// (`Panel`/`Rule`/`Table` structurally, `RichText` via `end`) do too — so
|
|
58
|
+
// `Group` can emit children back to back with nothing in between
|
|
59
|
+
// (docs/group.md). A `Strip` that left its last line open broke only
|
|
60
|
+
// under composition: printed alone, Console's own "close whatever the
|
|
61
|
+
// renderable left open" step (console.ts) papered over it, and a `Group`
|
|
62
|
+
// of a Strip and a RichText ran the RichText onto the Strip's line
|
|
63
|
+
// instead of below it. (Not every renderable follows this — a `Spinner`
|
|
64
|
+
// or `ProgressBar` is a line *fragment*, not a block; see
|
|
65
|
+
// rich-flexstrip-5kf.4cq for the open question of formalizing that split.)
|
|
66
|
+
yield Segment.line();
|
|
54
67
|
}
|
|
55
68
|
}
|
|
56
69
|
// --- Helpers ---
|
|
@@ -88,10 +101,38 @@ function bgAsFg(edge) {
|
|
|
88
101
|
function paintableBg(bg) {
|
|
89
102
|
return bg !== undefined && !bg.isDefault ? bg : undefined;
|
|
90
103
|
}
|
|
104
|
+
// --- PowerlineJoiner ---
|
|
105
|
+
/**
|
|
106
|
+
* The least ΔE_OK two neighbouring backgrounds must differ by for the powerline
|
|
107
|
+
* arrow between them to be seen. Below it the arrow is drawn in a colour the
|
|
108
|
+
* eye cannot tell from its own background, so the joiner draws the divider
|
|
109
|
+
* instead. Twice the ~.02 threshold of a visible difference, because a seam is
|
|
110
|
+
* one cell wide.
|
|
111
|
+
*/
|
|
112
|
+
export const SEAM_MIN_DELTA_E = 0.04;
|
|
113
|
+
// Two backgrounds the eye cannot tell apart. What is measured is what is
|
|
114
|
+
// drawn: each colour flattened onto the substrate Style.toSgrCodes flattens it
|
|
115
|
+
// onto, so two alphas over one RGB are the two greys they render as. A palette
|
|
116
|
+
// colour has no value here, so two of them are the same only when they are the
|
|
117
|
+
// same palette slot — `type` + `number`, never the name, which spells one slot
|
|
118
|
+
// many ways ("red", "color(1)").
|
|
119
|
+
function indistinct(a, b) {
|
|
120
|
+
if (b === undefined)
|
|
121
|
+
return false;
|
|
122
|
+
const av = a.flattenAlpha(SURFACE_BLACK).value;
|
|
123
|
+
const bv = b.flattenAlpha(SURFACE_BLACK).value;
|
|
124
|
+
return av !== undefined && bv !== undefined
|
|
125
|
+
? Oklch.fromRgba(av).deltaE(Oklch.fromRgba(bv)) < SEAM_MIN_DELTA_E
|
|
126
|
+
: a.type === b.type && a.number === b.number;
|
|
127
|
+
}
|
|
128
|
+
/** The powerline pair: U+E0B0 (right-arrow) divided by U+E0B1 (thin right-arrow). */
|
|
129
|
+
export const POWERLINE_JOINER_GLYPHS = Object.freeze({ glyph: "\ue0b0", divider: "\ue0b1" });
|
|
91
130
|
export class PowerlineJoiner {
|
|
92
131
|
_glyph;
|
|
93
|
-
|
|
94
|
-
|
|
132
|
+
_divider;
|
|
133
|
+
constructor(options = POWERLINE_JOINER_GLYPHS) {
|
|
134
|
+
this._glyph = options.glyph;
|
|
135
|
+
this._divider = options.divider;
|
|
95
136
|
}
|
|
96
137
|
join(left, right) {
|
|
97
138
|
// [LAW:dataflow-not-control-flow] One expression for all three positions
|
|
@@ -105,20 +146,27 @@ export class PowerlineJoiner {
|
|
|
105
146
|
// colourless arrow is not drawn.)
|
|
106
147
|
// • no right bg — the end cap — bleeds the left colour out over the
|
|
107
148
|
// terminal background (fg = left bg, no bg).
|
|
108
|
-
// Equal REAL bgs still emit:
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
149
|
+
// Equal REAL bgs still emit: a same-bg seam between two distinct items is a
|
|
150
|
+
// structural boundary, never suppressed. The arrow would be drawn in its own
|
|
151
|
+
// background colour there and vanish, so the seam is the DIVIDER instead, in
|
|
152
|
+
// the left item's text colour — the vim-airline convention for neighbours
|
|
153
|
+
// that share a background. "Equal" is perceptual (SEAM_MIN_DELTA_E): an
|
|
154
|
+
// arrow a hair off its background is as invisible as one exactly on it.
|
|
155
|
+
// Background colour is paint, not structure; its ABSENCE (nothing to paint)
|
|
156
|
+
// is the only thing that elides the separator, and that is paint logic.
|
|
113
157
|
// "Absent" = no bg OR the terminal default (transparent) — paintableBg folds
|
|
114
158
|
// both to undefined so an explicit `… on default` cannot smuggle a separator.
|
|
115
159
|
const glyph = this._glyph;
|
|
160
|
+
const divider = this._divider;
|
|
116
161
|
return deferred(function* (options) {
|
|
117
|
-
const
|
|
162
|
+
const leftEdge = left?.edgeStyle("right", options);
|
|
163
|
+
const leftBg = paintableBg(leftEdge?.bgcolor);
|
|
118
164
|
if (leftBg === undefined)
|
|
119
165
|
return;
|
|
120
166
|
const rightBg = paintableBg(right?.edgeStyle("left", options).bgcolor);
|
|
121
|
-
yield
|
|
167
|
+
yield indistinct(leftBg, rightBg)
|
|
168
|
+
? new Segment(divider, new Style({ color: leftEdge?.color, bgcolor: rightBg }))
|
|
169
|
+
: new Segment(glyph, new Style({ color: leftBg, bgcolor: rightBg }));
|
|
122
170
|
});
|
|
123
171
|
}
|
|
124
172
|
}
|
|
@@ -206,4 +254,3 @@ export class GradientJoiner {
|
|
|
206
254
|
});
|
|
207
255
|
}
|
|
208
256
|
}
|
|
209
|
-
//# sourceMappingURL=strip.js.map
|
package/dist/core/style.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Immutable style descriptors — colors, text attributes, links, metadata.
|
|
3
3
|
*/
|
|
4
|
-
import { ColorSpec, ColorDepth } from "./color.js";
|
|
5
|
-
|
|
4
|
+
import { ColorRgba, ColorSpec, ColorDepth } from "./color.js";
|
|
5
|
+
export declare const SURFACE_BLACK: ColorRgba;
|
|
6
6
|
/**
|
|
7
7
|
* Canonical text-attribute inventory. Single source of truth consumed by
|
|
8
8
|
* `Style.parse` / `Style.toString` and the template bindings — adding an
|
|
@@ -38,7 +38,7 @@ export interface StyleOptions {
|
|
|
38
38
|
meta?: Record<string, unknown>;
|
|
39
39
|
}
|
|
40
40
|
export declare class StyleSyntaxError extends Error {
|
|
41
|
-
constructor(message: string);
|
|
41
|
+
constructor(message: string, options?: ErrorOptions);
|
|
42
42
|
}
|
|
43
43
|
export declare class Style {
|
|
44
44
|
readonly color: ColorSpec | undefined;
|
|
@@ -85,10 +85,6 @@ export declare class Style {
|
|
|
85
85
|
* Render text with this style's ANSI escape codes.
|
|
86
86
|
*/
|
|
87
87
|
render(text: string, colorSystem?: ColorDepth): string;
|
|
88
|
-
/**
|
|
89
|
-
* Returns a CSS style string for HTML rendering.
|
|
90
|
-
*/
|
|
91
|
-
getHtmlStyle(theme?: TerminalTheme): string;
|
|
92
88
|
/**
|
|
93
89
|
* Serializes to a canonical string that round-trips through `Style.parse()`.
|
|
94
90
|
*/
|
|
@@ -141,4 +137,3 @@ export declare const DEFAULT_STYLES: Record<string, Style>;
|
|
|
141
137
|
* a renderable sees outside a `Console`, as in `renderToString`.
|
|
142
138
|
*/
|
|
143
139
|
export declare const DEFAULT_THEME: Theme;
|
|
144
|
-
//# sourceMappingURL=style.d.ts.map
|