@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/style.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Immutable style descriptors — colors, text attributes, links, metadata.
|
|
3
3
|
*/
|
|
4
|
-
import { ColorRgba, ColorSpec, } from "./color.js";
|
|
5
|
-
import {
|
|
4
|
+
import { COLOR_NAMES, ColorRgba, ColorSpec, } from "./color.js";
|
|
5
|
+
import { OSC8_CLOSE, osc8Open } from "./osc8.js";
|
|
6
6
|
// [LAW:one-way-deps] `core/style` depends only on `core/color` and the leaf
|
|
7
|
-
// `core/
|
|
7
|
+
// `core/osc8` (the link wire grammar). The substrate fallback is the
|
|
8
8
|
// canonical canvas color (black), inlined to avoid pulling in any preset
|
|
9
9
|
// theme constants. Preset themes live in `src/themes/` and depend on core,
|
|
10
10
|
// never the reverse.
|
|
11
|
-
const SURFACE_BLACK = new ColorRgba(0, 0, 0);
|
|
11
|
+
export const SURFACE_BLACK = new ColorRgba(0, 0, 0);
|
|
12
12
|
// --- Attribute definitions ---
|
|
13
13
|
/**
|
|
14
14
|
* Canonical text-attribute inventory. Single source of truth consumed by
|
|
@@ -64,8 +64,8 @@ export const ATTRIBUTE_SHORT_ALIASES = {
|
|
|
64
64
|
uu: "underline2",
|
|
65
65
|
};
|
|
66
66
|
export class StyleSyntaxError extends Error {
|
|
67
|
-
constructor(message) {
|
|
68
|
-
super(message);
|
|
67
|
+
constructor(message, options) {
|
|
68
|
+
super(message, options);
|
|
69
69
|
this.name = "StyleSyntaxError";
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -315,57 +315,11 @@ export class Style {
|
|
|
315
315
|
const codes = this.toSgrCodes(colorSystem);
|
|
316
316
|
let result = codes.length > 0 ? `\x1b[${codes}m${text}\x1b[0m` : text;
|
|
317
317
|
if (this.link) {
|
|
318
|
-
// [LAW:
|
|
319
|
-
|
|
320
|
-
// global counter, no construction-order dependence. Tradeoff: terminals
|
|
321
|
-
// can no longer hover-group non-adjacent same-URL spans (when linked
|
|
322
|
-
// segments are separated by other content, each becomes its own OSC 8
|
|
323
|
-
// pair instead of sharing an id). The coalescer in render.ts already
|
|
324
|
-
// merges adjacent same-link runs into one wrap, so the common case is
|
|
325
|
-
// unaffected; non-adjacent hover-grouping is the intentional sacrifice.
|
|
326
|
-
//
|
|
327
|
-
// [LAW:single-enforcer] Wire-byte sanitization at the OSC 8 emit site
|
|
328
|
-
// — paired with the same call in render.ts:segmentsToString so every
|
|
329
|
-
// path that turns `Style.link` into bytes goes through one rule. Style
|
|
330
|
-
// itself stays a faithful container (this.link is unchanged); only the
|
|
331
|
-
// bytes going out the door are stripped.
|
|
332
|
-
result = `\x1b]8;;${stripOscTerminators(this.link)}\x1b\\${result}\x1b]8;;\x1b\\`;
|
|
318
|
+
// [LAW:single-enforcer] One OSC 8 spelling, shared with segmentsToString.
|
|
319
|
+
result = `${osc8Open(this.link)}${result}${OSC8_CLOSE}`;
|
|
333
320
|
}
|
|
334
321
|
return result;
|
|
335
322
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Returns a CSS style string for HTML rendering.
|
|
338
|
-
*/
|
|
339
|
-
getHtmlStyle(theme) {
|
|
340
|
-
if (this.isNull)
|
|
341
|
-
return "";
|
|
342
|
-
const parts = [];
|
|
343
|
-
if (this.color) {
|
|
344
|
-
const triplet = this.color.getTruecolor(theme, true);
|
|
345
|
-
parts.push(`color: ${triplet.hex}`);
|
|
346
|
-
}
|
|
347
|
-
if (this.bgcolor) {
|
|
348
|
-
const triplet = this.bgcolor.getTruecolor(theme, false);
|
|
349
|
-
parts.push(`background-color: ${triplet.hex}`);
|
|
350
|
-
}
|
|
351
|
-
if (this.bold)
|
|
352
|
-
parts.push("font-weight: bold");
|
|
353
|
-
if (this.italic)
|
|
354
|
-
parts.push("font-style: italic");
|
|
355
|
-
const decorations = [];
|
|
356
|
-
if (this.underline)
|
|
357
|
-
decorations.push("underline");
|
|
358
|
-
if (this.strike)
|
|
359
|
-
decorations.push("line-through");
|
|
360
|
-
if (this.overline)
|
|
361
|
-
decorations.push("overline");
|
|
362
|
-
if (decorations.length > 0) {
|
|
363
|
-
parts.push(`text-decoration: ${decorations.join(" ")}`);
|
|
364
|
-
}
|
|
365
|
-
if (this.dim)
|
|
366
|
-
parts.push("opacity: 0.5");
|
|
367
|
-
return parts.join("; ");
|
|
368
|
-
}
|
|
369
323
|
/**
|
|
370
324
|
* Serializes to a canonical string that round-trips through `Style.parse()`.
|
|
371
325
|
*/
|
|
@@ -503,6 +457,80 @@ export class Theme {
|
|
|
503
457
|
}
|
|
504
458
|
// --- Parse helpers ---
|
|
505
459
|
const ATTRIBUTE_SET = new Set(ATTRIBUTE_NAMES);
|
|
460
|
+
// The words each position of a definition can hold: a bare token is a keyword,
|
|
461
|
+
// an attribute or a colour name; `on` takes a colour name; `not` an attribute.
|
|
462
|
+
// The short aliases are left out, since `b` is no help to someone who typed
|
|
463
|
+
// `bolt` and a one-letter name sits one edit from every other short word.
|
|
464
|
+
// [LAW:one-source-of-truth] Derived from the lists the parser accepts from; the
|
|
465
|
+
// keywords are the three `parseStyleDefinition` reads before anything else.
|
|
466
|
+
const FOREGROUND_WORDS = ["not", "on", "link", ...ATTRIBUTE_NAMES, ...COLOR_NAMES];
|
|
467
|
+
/**
|
|
468
|
+
* Optimal string alignment distance: insertions, deletions, substitutions, and
|
|
469
|
+
* swaps of two neighbouring letters each cost one edit, so `cyna` is as near
|
|
470
|
+
* `cyan` as `rd` is to `red`. Kept to three rows, since only the two before the
|
|
471
|
+
* current one are ever read.
|
|
472
|
+
*/
|
|
473
|
+
function editDistance(a, b) {
|
|
474
|
+
let before = [];
|
|
475
|
+
let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
476
|
+
for (let i = 1; i <= a.length; i++) {
|
|
477
|
+
const current = [i];
|
|
478
|
+
for (let j = 1; j <= b.length; j++) {
|
|
479
|
+
const swap = i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1];
|
|
480
|
+
current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + Number(a[i - 1] !== b[j - 1]), swap ? before[j - 2] + 1 : Infinity);
|
|
481
|
+
}
|
|
482
|
+
[before, previous] = [previous, current];
|
|
483
|
+
}
|
|
484
|
+
return previous[b.length];
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* The ` (did you mean …?)` clause for a word no position accepted, or `""`
|
|
488
|
+
* when nothing in `words` is a plausible typo of it.
|
|
489
|
+
*
|
|
490
|
+
* Plausible means within one edit per three letters, at least one, which lets
|
|
491
|
+
* `rd` reach `red` and keeps `hello` from reaching `yellow`. Every name tied
|
|
492
|
+
* for nearest is offered: `gold` is one edit from `bold` and from three
|
|
493
|
+
* `goldN` colours, and choosing among them would be a guess the reader cannot
|
|
494
|
+
* tell from a finding. Case is not an edit, because the colour parser ignores
|
|
495
|
+
* it: `Cyna` is as near `cyan` as `cyna` is.
|
|
496
|
+
*
|
|
497
|
+
* This runs on every render that meets the bad style, since only successful
|
|
498
|
+
* parses are cached. Two words differ by at least their difference in length,
|
|
499
|
+
* so a name outside the budget on length alone is never measured — which is
|
|
500
|
+
* also what keeps a long garbage token from costing length × length per name.
|
|
501
|
+
*/
|
|
502
|
+
function nearMiss(word, words) {
|
|
503
|
+
const typed = word.toLowerCase();
|
|
504
|
+
const budget = Math.max(1, Math.floor(typed.length / 3));
|
|
505
|
+
const scored = words
|
|
506
|
+
.filter((name) => Math.abs(name.length - typed.length) <= budget)
|
|
507
|
+
.map((name) => ({ name, distance: editDistance(typed, name) }));
|
|
508
|
+
const nearest = Math.min(budget, ...scored.map((s) => s.distance));
|
|
509
|
+
const names = scored
|
|
510
|
+
.filter((s) => s.distance === nearest)
|
|
511
|
+
.map((s) => `"${s.name}"`)
|
|
512
|
+
.sort();
|
|
513
|
+
return names.length === 0 ? "" : ` (did you mean ${names.join(" or ")}?)`;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* A style token read as a colour. The colour parser's own error is the reason
|
|
517
|
+
* the token failed, so it rides along twice: in the message, for a reader with
|
|
518
|
+
* only the text, and as `cause`, for code that wants the original error.
|
|
519
|
+
*
|
|
520
|
+
* [LAW:single-enforcer] Both colour positions in a definition rewrap here, and
|
|
521
|
+
* the near miss is named here rather than by the colour parser: only a
|
|
522
|
+
* definition knows whether the token could also have been an attribute.
|
|
523
|
+
*/
|
|
524
|
+
function parseStyleColor(token, failure, words) {
|
|
525
|
+
try {
|
|
526
|
+
return ColorSpec.parse(token);
|
|
527
|
+
}
|
|
528
|
+
catch (cause) {
|
|
529
|
+
throw new StyleSyntaxError(`${failure} "${token}"${nearMiss(token, words)}: ${String(cause)}`, {
|
|
530
|
+
cause,
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
}
|
|
506
534
|
function parseStyleDefinition(definition) {
|
|
507
535
|
const tokens = definition.split(/\s+/);
|
|
508
536
|
const opts = {};
|
|
@@ -518,7 +546,7 @@ function parseStyleDefinition(definition) {
|
|
|
518
546
|
}
|
|
519
547
|
const attrName = ATTRIBUTE_SHORT_ALIASES[next] ?? next;
|
|
520
548
|
if (!ATTRIBUTE_SET.has(attrName)) {
|
|
521
|
-
throw new StyleSyntaxError(`Invalid attribute: "${next}"`);
|
|
549
|
+
throw new StyleSyntaxError(`Invalid attribute: "${next}"${nearMiss(next, ATTRIBUTE_NAMES)}`);
|
|
522
550
|
}
|
|
523
551
|
opts[attrName] = false;
|
|
524
552
|
i++;
|
|
@@ -531,12 +559,7 @@ function parseStyleDefinition(definition) {
|
|
|
531
559
|
if (!next) {
|
|
532
560
|
throw new StyleSyntaxError(`Expected color after "on" in style definition`);
|
|
533
561
|
}
|
|
534
|
-
|
|
535
|
-
opts.bgcolor = ColorSpec.parse(next);
|
|
536
|
-
}
|
|
537
|
-
catch {
|
|
538
|
-
throw new StyleSyntaxError(`Invalid background color: "${next}"`);
|
|
539
|
-
}
|
|
562
|
+
opts.bgcolor = parseStyleColor(next, "Invalid background color", COLOR_NAMES);
|
|
540
563
|
i++;
|
|
541
564
|
continue;
|
|
542
565
|
}
|
|
@@ -558,12 +581,7 @@ function parseStyleDefinition(definition) {
|
|
|
558
581
|
continue;
|
|
559
582
|
}
|
|
560
583
|
// Must be a color
|
|
561
|
-
|
|
562
|
-
opts.color = ColorSpec.parse(token);
|
|
563
|
-
}
|
|
564
|
-
catch {
|
|
565
|
-
throw new StyleSyntaxError(`Invalid style definition: "${token}"`);
|
|
566
|
-
}
|
|
584
|
+
opts.color = parseStyleColor(token, "Invalid style definition", FOREGROUND_WORDS);
|
|
567
585
|
i++;
|
|
568
586
|
}
|
|
569
587
|
return new Style(opts);
|
|
@@ -713,4 +731,3 @@ export const DEFAULT_STYLES = {
|
|
|
713
731
|
* a renderable sees outside a `Console`, as in `renderToString`.
|
|
714
732
|
*/
|
|
715
733
|
export const DEFAULT_THEME = new Theme();
|
|
716
|
-
//# sourceMappingURL=style.js.map
|
package/dist/core/text.d.ts
CHANGED
|
@@ -104,8 +104,7 @@ export declare class RichText implements Renderable, Measurable {
|
|
|
104
104
|
setLength(length: number): this;
|
|
105
105
|
extendStyle(count: number): this;
|
|
106
106
|
/**
|
|
107
|
-
* Truncate to a fixed cell-column width
|
|
108
|
-
* `overflow` form.
|
|
107
|
+
* Truncate to a fixed cell-column width, in one of three modes.
|
|
109
108
|
*
|
|
110
109
|
* - `mode: "right"` (default) \u2014 drop characters from the right; append
|
|
111
110
|
* `marker` (if any) at the cut.
|
|
@@ -117,10 +116,6 @@ export declare class RichText implements Renderable, Measurable {
|
|
|
117
116
|
* Marker default is `"\u2026"`. Pass `marker: ""` for raw cropping without an
|
|
118
117
|
* indicator glyph.
|
|
119
118
|
*
|
|
120
|
-
* Legacy form: `{ overflow: "ellipsis" }` is equivalent to
|
|
121
|
-
* `{ mode: "right", marker: "\u2026" }`; `{ overflow: "crop" | "fold" }` is
|
|
122
|
-
* equivalent to `{ marker: "" }`.
|
|
123
|
-
*
|
|
124
119
|
* Spans are preserved through the cut: characters that survive keep their
|
|
125
120
|
* styling; the marker (if any) is inserted as plain text with no span.
|
|
126
121
|
* Use `stylize(...)` on the result to color the marker if needed.
|
|
@@ -130,7 +125,6 @@ export declare class RichText implements Renderable, Measurable {
|
|
|
130
125
|
* branch \u2014 the unchanged path just early-returns when content fits.
|
|
131
126
|
*/
|
|
132
127
|
truncate(width: number, options?: {
|
|
133
|
-
overflow?: "fold" | "crop" | "ellipsis";
|
|
134
128
|
mode?: "right" | "left" | "middle";
|
|
135
129
|
marker?: string;
|
|
136
130
|
}): this;
|
|
@@ -259,4 +253,3 @@ export declare class RichText implements Renderable, Measurable {
|
|
|
259
253
|
*/
|
|
260
254
|
private _fitLine;
|
|
261
255
|
}
|
|
262
|
-
//# sourceMappingURL=text.d.ts.map
|
package/dist/core/text.js
CHANGED
|
@@ -5,7 +5,7 @@ import { cellLen, cellCount } from "./cells.js";
|
|
|
5
5
|
import { divideLine } from "./wrap.js";
|
|
6
6
|
import { Segment } from "./segment.js";
|
|
7
7
|
import { Style, NULL_STYLE, StyleSyntaxError } from "./style.js";
|
|
8
|
-
import { stripOscTerminators } from "./
|
|
8
|
+
import { stripOscTerminators } from "./osc8.js";
|
|
9
9
|
import { getStyle, withBoundedWidth } from "./protocol.js";
|
|
10
10
|
// Strip control characters except \t and \n
|
|
11
11
|
// [LAW:single-enforcer] Single place where control chars are sanitized
|
|
@@ -48,8 +48,9 @@ function hangingWhitespace(line) {
|
|
|
48
48
|
// [LAW:single-enforcer] RichText is the data-model trust boundary for link
|
|
49
49
|
// URLs: a `Style` is sanitized as it enters (`admitStyle`), and the `Style` a
|
|
50
50
|
// stored string resolves to is sanitized as it leaves for a render
|
|
51
|
-
// (`resolveStyle`). Wire-byte safety is enforced separately
|
|
52
|
-
//
|
|
51
|
+
// (`resolveStyle`). Wire-byte safety is enforced separately by `osc8Open`
|
|
52
|
+
// (core/osc8.ts), which every link producer calls and which applies the same
|
|
53
|
+
// `stripOscTerminators`.
|
|
53
54
|
function sanitizeStyleLink(style) {
|
|
54
55
|
const link = style.link;
|
|
55
56
|
if (!link)
|
|
@@ -76,21 +77,29 @@ function isEmptyStyle(style) {
|
|
|
76
77
|
/**
|
|
77
78
|
* The style a stored `string | Style` stands for in this render.
|
|
78
79
|
*
|
|
80
|
+
* A parsed string can carry a link, so the result is sanitized on the way out
|
|
81
|
+
* as well.
|
|
82
|
+
*/
|
|
83
|
+
function resolveStyle(options, style) {
|
|
84
|
+
return sanitizeStyleLink(style instanceof Style ? style : resolveDefinition(options, style));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
79
87
|
* [LAW:single-enforcer] Styling is non-critical — an unrecognized style name
|
|
80
88
|
* (typo, missing theme key, bad concatenation) degrades to unstyled rather
|
|
81
89
|
* than crashing, as the reference's `Text.render` resolves with a null
|
|
82
90
|
* default. Absorb only StyleSyntaxError here; other errors are genuine bugs
|
|
83
|
-
* and must surface.
|
|
84
|
-
*
|
|
91
|
+
* and must surface. The render's `onStyleError` hears about each one first,
|
|
92
|
+
* and a handler that throws turns the degrade into a failure.
|
|
85
93
|
*/
|
|
86
|
-
function
|
|
94
|
+
function resolveDefinition(options, style) {
|
|
87
95
|
try {
|
|
88
|
-
return
|
|
96
|
+
return getStyle(options, style);
|
|
89
97
|
}
|
|
90
98
|
catch (err) {
|
|
91
|
-
if (err instanceof StyleSyntaxError)
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
if (!(err instanceof StyleSyntaxError))
|
|
100
|
+
throw err;
|
|
101
|
+
options.onStyleError?.(err, style);
|
|
102
|
+
return NULL_STYLE;
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
// --- Span ---
|
|
@@ -467,8 +476,7 @@ export class RichText {
|
|
|
467
476
|
}
|
|
468
477
|
// --- Truncation ---
|
|
469
478
|
/**
|
|
470
|
-
* Truncate to a fixed cell-column width
|
|
471
|
-
* `overflow` form.
|
|
479
|
+
* Truncate to a fixed cell-column width, in one of three modes.
|
|
472
480
|
*
|
|
473
481
|
* - `mode: "right"` (default) \u2014 drop characters from the right; append
|
|
474
482
|
* `marker` (if any) at the cut.
|
|
@@ -480,10 +488,6 @@ export class RichText {
|
|
|
480
488
|
* Marker default is `"\u2026"`. Pass `marker: ""` for raw cropping without an
|
|
481
489
|
* indicator glyph.
|
|
482
490
|
*
|
|
483
|
-
* Legacy form: `{ overflow: "ellipsis" }` is equivalent to
|
|
484
|
-
* `{ mode: "right", marker: "\u2026" }`; `{ overflow: "crop" | "fold" }` is
|
|
485
|
-
* equivalent to `{ marker: "" }`.
|
|
486
|
-
*
|
|
487
491
|
* Spans are preserved through the cut: characters that survive keep their
|
|
488
492
|
* styling; the marker (if any) is inserted as plain text with no span.
|
|
489
493
|
* Use `stylize(...)` on the result to color the marker if needed.
|
|
@@ -495,15 +499,8 @@ export class RichText {
|
|
|
495
499
|
truncate(width, options) {
|
|
496
500
|
if (this.cellLength <= width)
|
|
497
501
|
return this;
|
|
498
|
-
const overflow = options?.overflow;
|
|
499
502
|
const mode = options?.mode ?? "right";
|
|
500
|
-
const marker = options?.marker
|
|
501
|
-
? options.marker
|
|
502
|
-
: overflow === "ellipsis"
|
|
503
|
-
? "\u2026"
|
|
504
|
-
: overflow === undefined && options?.mode !== undefined
|
|
505
|
-
? "\u2026"
|
|
506
|
-
: "";
|
|
503
|
+
const marker = options?.marker ?? "\u2026";
|
|
507
504
|
const markerWidth = cellLen(marker);
|
|
508
505
|
if (width <= 0) {
|
|
509
506
|
this.plain = "";
|
|
@@ -697,11 +694,6 @@ export class RichText {
|
|
|
697
694
|
// --- Renderable ---
|
|
698
695
|
*render(options) {
|
|
699
696
|
const text = this._expandTabs(this._text);
|
|
700
|
-
if (text.length === 0) {
|
|
701
|
-
if (this._end)
|
|
702
|
-
yield new Segment(this._end);
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
697
|
const base = this.resolvedStyle(options);
|
|
706
698
|
const allSegments = this._buildSegments(text, base, options);
|
|
707
699
|
const logicalLines = Segment.splitLines(allSegments);
|
|
@@ -744,7 +736,13 @@ export class RichText {
|
|
|
744
736
|
}
|
|
745
737
|
}
|
|
746
738
|
}
|
|
747
|
-
|
|
739
|
+
// [LAW:single-enforcer] The one place `end` is emitted, for empty and
|
|
740
|
+
// non-empty text alike — the pre-fix code checked it once for empty text
|
|
741
|
+
// (truthy) and again for non-empty text (truthy and not the default
|
|
742
|
+
// "\n"), which gave `end` two meanings depending on whether the text was
|
|
743
|
+
// empty (rich-text-5ai). Empty text takes zero iterations of the loop
|
|
744
|
+
// above, so this is reached either way with nothing yielded but this.
|
|
745
|
+
if (this._end) {
|
|
748
746
|
yield new Segment(this._end);
|
|
749
747
|
}
|
|
750
748
|
}
|
|
@@ -990,4 +988,3 @@ export class RichText {
|
|
|
990
988
|
yield* Segment.adjustLineLength(line, maxWidth, undefined, false);
|
|
991
989
|
}
|
|
992
990
|
}
|
|
993
|
-
//# sourceMappingURL=text.js.map
|
package/dist/core/wrap.d.ts
CHANGED
package/dist/core/wrap.js
CHANGED
package/dist/host/host-stream.js
CHANGED
package/dist/host/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { BrowserTerminalHost } from "./terminal-host.js";
|
|
2
2
|
export type { TerminalHost, TerminalSize, DataHandler, ResizeHandler, BrowserTerminalHostOptions, XtermTerminal, XtermDisposable, XtermResizeEvent, } from "./terminal-host.js";
|
|
3
3
|
export { hostStream } from "./host-stream.js";
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/host/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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";
|
|
5
5
|
export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
|
|
6
|
-
export type { ThemeKey } from "./core/oklch.js";
|
|
6
|
+
export type { ThemeKey, OklchWeights } from "./core/oklch.js";
|
|
7
7
|
export { Palette } from "./themes/palette.js";
|
|
8
8
|
export { resolveColorRef, parseHexColor, ColorRefError, HEX_COLOR_RE, } from "./themes/colorRef.js";
|
|
9
9
|
export { buildPalette } from "./themes/buildPalette.js";
|
|
@@ -23,19 +23,21 @@ export { Box } from "./core/box.js";
|
|
|
23
23
|
export type { EdgeChars, ContentChars, RowLevel, SubstituteOptions } from "./core/box.js";
|
|
24
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";
|
|
25
25
|
export { isRenderable, isMeasurable, withCellWidth, withBoundedWidth, } from "./core/protocol.js";
|
|
26
|
-
export type { RenderOptions, Renderable, Measurable, } from "./core/protocol.js";
|
|
26
|
+
export type { RenderOptions, Renderable, Measurable, StyleErrorHandler, } from "./core/protocol.js";
|
|
27
27
|
export type { Unsubscribe } from "./core/subscription.js";
|
|
28
28
|
export { Measurement, measureRenderables } from "./core/measure.js";
|
|
29
29
|
export { Span, RichText } from "./core/text.js";
|
|
30
30
|
export type { RichTextOptions } from "./core/text.js";
|
|
31
|
-
export { Strip, PowerlineJoiner, CapsuleJoiner, PlainJoiner, GradientJoiner, } from "./core/strip.js";
|
|
31
|
+
export { Strip, PowerlineJoiner, SEAM_MIN_DELTA_E, POWERLINE_JOINER_GLYPHS, CapsuleJoiner, PlainJoiner, GradientJoiner, } from "./core/strip.js";
|
|
32
32
|
export type { StyledRenderable, Joiner, PowerlineJoinerOptions, CapsuleJoinerOptions, PlainJoinerOptions, GradientJoinerOptions, } from "./core/strip.js";
|
|
33
33
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
34
34
|
export type { RenderToStringOptions } from "./core/render.js";
|
|
35
|
+
export { OSC8, osc8Sequences } from "./core/osc8.js";
|
|
36
|
+
export type { Osc8Sequence } from "./core/osc8.js";
|
|
35
37
|
export { MarkupRegistry, globalMarkupRegistry, renderMarkup, } from "./core/markup.js";
|
|
36
38
|
export type { MarkupTagContext, MarkupTagHandler, RenderMarkupOptions, } from "./core/markup.js";
|
|
37
39
|
export { EMOJI, emojiReplace, Emoji, NoEmoji } from "./core/emoji.js";
|
|
38
|
-
export { MarkupError, escape as escapeMarkup } from "./core/markup.js";
|
|
40
|
+
export { MarkupError, MarkupSyntaxError, escape as escapeMarkup } from "./core/markup.js";
|
|
39
41
|
export { Highlighter, NullHighlighter, RegexHighlighter, ReprHighlighter, JSONHighlighter, ISO8601Highlighter, } from "./core/highlighter.js";
|
|
40
42
|
export { Pretty } from "./core/pretty.js";
|
|
41
43
|
export type { PrettyOptions } from "./core/pretty.js";
|
|
@@ -83,4 +85,3 @@ export { Markdown } from "./renderables/markdown.js";
|
|
|
83
85
|
export type { MarkdownOptions } from "./renderables/markdown.js";
|
|
84
86
|
export { Layout } from "./renderables/layout.js";
|
|
85
87
|
export type { LayoutOptions } from "./renderables/layout.js";
|
|
86
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -38,15 +38,17 @@ export { Measurement, measureRenderables } from "./core/measure.js";
|
|
|
38
38
|
// Text
|
|
39
39
|
export { Span, RichText } from "./core/text.js";
|
|
40
40
|
// Strip + Joiner
|
|
41
|
-
export { Strip, PowerlineJoiner, CapsuleJoiner, PlainJoiner, GradientJoiner, } from "./core/strip.js";
|
|
41
|
+
export { Strip, PowerlineJoiner, SEAM_MIN_DELTA_E, POWERLINE_JOINER_GLYPHS, CapsuleJoiner, PlainJoiner, GradientJoiner, } from "./core/strip.js";
|
|
42
42
|
// renderToString — stateless one-shot emission
|
|
43
43
|
export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
|
|
44
|
+
// OSC 8 hyperlink wire grammar — for consumers that read rendered bytes back
|
|
45
|
+
export { OSC8, osc8Sequences } from "./core/osc8.js";
|
|
44
46
|
// Markup plugin tags
|
|
45
47
|
export { MarkupRegistry, globalMarkupRegistry, renderMarkup, } from "./core/markup.js";
|
|
46
48
|
// Emoji
|
|
47
49
|
export { EMOJI, emojiReplace, Emoji, NoEmoji } from "./core/emoji.js";
|
|
48
50
|
// Markup
|
|
49
|
-
export { MarkupError, escape as escapeMarkup } from "./core/markup.js";
|
|
51
|
+
export { MarkupError, MarkupSyntaxError, escape as escapeMarkup } from "./core/markup.js";
|
|
50
52
|
// Highlighter
|
|
51
53
|
export { Highlighter, NullHighlighter, RegexHighlighter, ReprHighlighter, JSONHighlighter, ISO8601Highlighter, } from "./core/highlighter.js";
|
|
52
54
|
// Pretty
|
|
@@ -100,4 +102,3 @@ export { Layout } from "./renderables/layout.js";
|
|
|
100
102
|
//
|
|
101
103
|
// This is also why there is no widget list here to keep in sync: `src/widgets/index.ts`
|
|
102
104
|
// is that list, and a copy of it in this file would be a second one to drift from.
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
package/dist/node/prompt.d.ts
CHANGED
package/dist/node/prompt.js
CHANGED
package/dist/node/save.d.ts
CHANGED
|
@@ -13,10 +13,5 @@
|
|
|
13
13
|
* the IO sink.
|
|
14
14
|
*/
|
|
15
15
|
import type { Console } from "../core/console.js";
|
|
16
|
-
export declare function saveText(out: Console, path: string, options?:
|
|
17
|
-
|
|
18
|
-
}): void;
|
|
19
|
-
export declare function saveHtml(out: Console, path: string, options?: {
|
|
20
|
-
clear?: boolean;
|
|
21
|
-
}): void;
|
|
22
|
-
//# sourceMappingURL=save.d.ts.map
|
|
16
|
+
export declare function saveText(out: Console, path: string, options?: Parameters<Console["exportText"]>[0]): void;
|
|
17
|
+
export declare function saveHtml(out: Console, path: string, options?: Parameters<Console["exportHtml"]>[0]): void;
|
package/dist/node/save.js
CHANGED
package/dist/node/traceback.d.ts
CHANGED
package/dist/node/traceback.js
CHANGED
|
@@ -40,6 +40,18 @@ export declare class Columns implements Renderable, Measurable {
|
|
|
40
40
|
* cropped forty cells of content down to `"x"` with no error at all.
|
|
41
41
|
*/
|
|
42
42
|
private _itemWidth;
|
|
43
|
+
/**
|
|
44
|
+
* The declared column width, bounded by the width offered.
|
|
45
|
+
*
|
|
46
|
+
* [LAW:single-enforcer] A declared width is what a column asks for, not what
|
|
47
|
+
* it takes — the contract `Table._outerWidth` keeps for a declared table
|
|
48
|
+
* width. Read by `_divide` for render and by `_naturalWidth` for measure, so
|
|
49
|
+
* the two answer from one number: laid out at the raw declared width, a
|
|
50
|
+
* six-cell column offered three emitted six-cell lines while `measure`
|
|
51
|
+
* reported three, and the terminal's soft wrap took the frame of everything
|
|
52
|
+
* printed after it.
|
|
53
|
+
*/
|
|
54
|
+
private _declaredWidth;
|
|
43
55
|
/** The width at which every item sits on one row: n columns and the gutters between them. */
|
|
44
56
|
private _naturalWidth;
|
|
45
57
|
measure(rawOptions: RenderOptions): {
|
|
@@ -47,4 +59,3 @@ export declare class Columns implements Renderable, Measurable {
|
|
|
47
59
|
maximum: number;
|
|
48
60
|
};
|
|
49
61
|
}
|
|
50
|
-
//# sourceMappingURL=columns.d.ts.map
|