@promptctl/rich-js 0.9.0 → 0.11.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 +0 -1
- package/dist/core/oklch.js +0 -1
- 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 +0 -1
- package/dist/core/strip.js +12 -1
- package/dist/core/style.d.ts +1 -7
- package/dist/core/style.js +84 -67
- 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 +25 -29
- 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 +4 -3
- package/dist/index.js +3 -2
- 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 +4 -6
- package/dist/widgets/checkbox.d.ts +0 -1
- package/dist/widgets/checkbox.js +3 -5
- package/dist/widgets/dropdown.d.ts +0 -1
- package/dist/widgets/dropdown.js +4 -6
- 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 -2
- package/dist/widgets/focus-manager.js +3 -8
- 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 +2 -5
- package/dist/widgets/slider.d.ts +0 -1
- package/dist/widgets/slider.js +7 -9
- 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 +5 -7
- package/dist/widgets/toggle.d.ts +0 -1
- package/dist/widgets/toggle.js +4 -6
- package/dist/widgets/types.d.ts +0 -1
- package/dist/widgets/types.js +0 -1
- package/dist/widgets/widget-base.d.ts +3 -4
- package/dist/widgets/widget-base.js +4 -7
- package/package.json +14 -13
- 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/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
|
|
@@ -7,6 +7,16 @@ import { RichText } from "../core/text.js";
|
|
|
7
7
|
import { isMeasurable, withBoundedWidth, withCellWidth } from "../core/protocol.js";
|
|
8
8
|
import { cellCount } from "../core/cells.js";
|
|
9
9
|
function toRenderable(item) {
|
|
10
|
+
// [LAW:single-enforcer] A `RichText` passed directly implements `render`
|
|
11
|
+
// and would otherwise leave through the passthrough arm below untouched,
|
|
12
|
+
// keeping its default `end: "\n"` (rich-text-5ai) — the same gap the code
|
|
13
|
+
// review found in table.ts's `toRenderable`. A column item is a row
|
|
14
|
+
// fragment, not a printed unit, same as every other embedding site.
|
|
15
|
+
if (item instanceof RichText) {
|
|
16
|
+
const copy = item.copy();
|
|
17
|
+
copy.end = "";
|
|
18
|
+
return copy;
|
|
19
|
+
}
|
|
10
20
|
if (typeof item === "object" && item !== null && "render" in item) {
|
|
11
21
|
return item;
|
|
12
22
|
}
|
|
@@ -78,9 +88,10 @@ export class Columns {
|
|
|
78
88
|
_divide(options) {
|
|
79
89
|
const maxWidth = options.maxWidth;
|
|
80
90
|
const gutter = this.gutterWidth;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
const declared = this._declaredWidth(options);
|
|
92
|
+
if (declared !== undefined) {
|
|
93
|
+
const numCols = Math.max(1, Math.floor((maxWidth + gutter) / (declared + gutter)));
|
|
94
|
+
return { numCols, colWidths: new Array(numCols).fill(declared) };
|
|
84
95
|
}
|
|
85
96
|
if (this.equal) {
|
|
86
97
|
const itemWidth = this._itemWidth(options);
|
|
@@ -118,12 +129,26 @@ export class Columns {
|
|
|
118
129
|
}
|
|
119
130
|
return widest;
|
|
120
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* The declared column width, bounded by the width offered.
|
|
134
|
+
*
|
|
135
|
+
* [LAW:single-enforcer] A declared width is what a column asks for, not what
|
|
136
|
+
* it takes — the contract `Table._outerWidth` keeps for a declared table
|
|
137
|
+
* width. Read by `_divide` for render and by `_naturalWidth` for measure, so
|
|
138
|
+
* the two answer from one number: laid out at the raw declared width, a
|
|
139
|
+
* six-cell column offered three emitted six-cell lines while `measure`
|
|
140
|
+
* reported three, and the terminal's soft wrap took the frame of everything
|
|
141
|
+
* printed after it.
|
|
142
|
+
*/
|
|
143
|
+
_declaredWidth(options) {
|
|
144
|
+
return this.colWidth === undefined ? undefined : Math.min(this.colWidth, options.maxWidth);
|
|
145
|
+
}
|
|
121
146
|
/** The width at which every item sits on one row: n columns and the gutters between them. */
|
|
122
147
|
_naturalWidth(options) {
|
|
123
148
|
const count = this.renderables.length;
|
|
124
149
|
if (count === 0)
|
|
125
150
|
return 0;
|
|
126
|
-
const width = this.
|
|
151
|
+
const width = this._declaredWidth(options) ?? this._itemWidth(options);
|
|
127
152
|
return count * width + this.gutterWidth * (count - 1);
|
|
128
153
|
}
|
|
129
154
|
measure(rawOptions) {
|
|
@@ -141,4 +166,3 @@ export class Columns {
|
|
|
141
166
|
return { minimum: Math.min(1, maximum), maximum };
|
|
142
167
|
}
|
|
143
168
|
}
|
|
144
|
-
//# sourceMappingURL=columns.js.map
|
|
@@ -16,6 +16,24 @@ import { cellCount } from "../core/cells.js";
|
|
|
16
16
|
function growthRatio(ratio) {
|
|
17
17
|
return Number.isFinite(ratio) && ratio > 0 ? ratio : 0;
|
|
18
18
|
}
|
|
19
|
+
// [LAW:single-enforcer] A leaf's content is a pane, not a printed unit — the
|
|
20
|
+
// same reason panel.ts and table.ts clear `end` on a `RichText` they embed.
|
|
21
|
+
// The string branch already built one with `end: ""`; a `RichText` passed
|
|
22
|
+
// directly needs the same treatment, or it keeps its default `end: "\n"`
|
|
23
|
+
// (rich-text-5ai code review) and draws a trailing blank row through
|
|
24
|
+
// `Segment.cropLines`, which — unlike table.ts's `splitLines`-based cell
|
|
25
|
+
// rendering — does not normalize a trailing empty line away.
|
|
26
|
+
function toRenderable(renderable) {
|
|
27
|
+
if (typeof renderable === "string") {
|
|
28
|
+
return new RichText(renderable, { end: "" });
|
|
29
|
+
}
|
|
30
|
+
if (renderable instanceof RichText) {
|
|
31
|
+
const copy = renderable.copy();
|
|
32
|
+
copy.end = "";
|
|
33
|
+
return copy;
|
|
34
|
+
}
|
|
35
|
+
return renderable;
|
|
36
|
+
}
|
|
19
37
|
export class Layout {
|
|
20
38
|
name;
|
|
21
39
|
visible;
|
|
@@ -27,9 +45,7 @@ export class Layout {
|
|
|
27
45
|
_splitDirection;
|
|
28
46
|
constructor(renderable, options) {
|
|
29
47
|
if (renderable !== undefined) {
|
|
30
|
-
this._renderable =
|
|
31
|
-
? new RichText(renderable, { end: "" })
|
|
32
|
-
: renderable;
|
|
48
|
+
this._renderable = toRenderable(renderable);
|
|
33
49
|
}
|
|
34
50
|
this.name = options?.name;
|
|
35
51
|
this.ratio = options?.ratio ?? 1;
|
|
@@ -94,9 +110,7 @@ export class Layout {
|
|
|
94
110
|
this._splitDirection = "row";
|
|
95
111
|
}
|
|
96
112
|
update(renderable) {
|
|
97
|
-
this._renderable =
|
|
98
|
-
? new RichText(renderable, { end: "" })
|
|
99
|
-
: renderable;
|
|
113
|
+
this._renderable = toRenderable(renderable);
|
|
100
114
|
}
|
|
101
115
|
getByName(name) {
|
|
102
116
|
if (this.name === name)
|
|
@@ -299,4 +313,3 @@ export class Layout {
|
|
|
299
313
|
return { minimum: Math.min(this.minimumSize, maximum), maximum };
|
|
300
314
|
}
|
|
301
315
|
}
|
|
302
|
-
//# sourceMappingURL=layout.js.map
|
package/dist/renderables/live.js
CHANGED
|
@@ -55,10 +55,19 @@ function borderTextStyle(options, own, border) {
|
|
|
55
55
|
return own === undefined ? border : getStyle(options, own);
|
|
56
56
|
}
|
|
57
57
|
function toRenderable(content) {
|
|
58
|
+
// [LAW:one-type-per-behavior] Content embedded in a panel is a line, not a
|
|
59
|
+
// printed unit — the same reason columns, table cells, tree labels, and
|
|
60
|
+
// every other embedding site build their RichText with `end: ""`. Now that
|
|
61
|
+
// `RichText.render` honors `end` uniformly (rich-text-5ai), leaving this at
|
|
62
|
+
// the default "\n" would draw a trailing blank row whenever content ends
|
|
63
|
+
// with a literal newline.
|
|
58
64
|
if (typeof content === "string")
|
|
59
|
-
return new RichText(content);
|
|
60
|
-
if (content instanceof RichText)
|
|
61
|
-
|
|
65
|
+
return new RichText(content, { end: "" });
|
|
66
|
+
if (content instanceof RichText) {
|
|
67
|
+
const copy = content.copy();
|
|
68
|
+
copy.end = "";
|
|
69
|
+
return copy;
|
|
70
|
+
}
|
|
62
71
|
return content;
|
|
63
72
|
}
|
|
64
73
|
export class Panel {
|
|
@@ -311,4 +320,3 @@ export class Panel {
|
|
|
311
320
|
return new Panel(content, { ...options, expand: false });
|
|
312
321
|
}
|
|
313
322
|
}
|
|
314
|
-
//# sourceMappingURL=panel.js.map
|
|
@@ -23,7 +23,13 @@ export class TextColumn {
|
|
|
23
23
|
// Use a callback so `$&`/`$1`/`$$` in the task description aren't
|
|
24
24
|
// reinterpreted by String.replace as replacement patterns.
|
|
25
25
|
const formatted = this.format.replace(/\{task\.description\}/g, () => description);
|
|
26
|
-
|
|
26
|
+
// [LAW:one-type-per-behavior] A column is a row fragment, not a printed
|
|
27
|
+
// line, so it clears `end` the same way `toCellText` does in table.ts —
|
|
28
|
+
// `renderMarkup` returns a fresh `RichText` each call, so it is safe to
|
|
29
|
+
// mutate directly rather than copy.
|
|
30
|
+
const text = renderMarkup(formatted);
|
|
31
|
+
text.end = "";
|
|
32
|
+
yield* text.render(options);
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
export class BarColumn {
|
|
@@ -233,4 +239,3 @@ export function* track(iterable, options) {
|
|
|
233
239
|
progress.stop();
|
|
234
240
|
}
|
|
235
241
|
}
|
|
236
|
-
//# sourceMappingURL=progress.js.map
|
package/dist/renderables/rule.js
CHANGED
|
@@ -35,8 +35,14 @@ function toCellText(content) {
|
|
|
35
35
|
return text;
|
|
36
36
|
}
|
|
37
37
|
function toRenderable(content) {
|
|
38
|
-
//
|
|
39
|
-
//
|
|
38
|
+
// [LAW:single-enforcer] `toCellText` is the one place that clears a cell's
|
|
39
|
+
// `end` — route a directly-passed `RichText` through it rather than letting
|
|
40
|
+
// it leave via the passthrough arm below untouched (rich-text-5ai code
|
|
41
|
+
// review): the passthrough exists for a genuine non-text `Renderable` (a
|
|
42
|
+
// nested `Panel` or `Table`), which carries no `end` to clear.
|
|
43
|
+
if (content instanceof RichText) {
|
|
44
|
+
return toCellText(content);
|
|
45
|
+
}
|
|
40
46
|
if (typeof content === "object" && content !== null && "render" in content) {
|
|
41
47
|
return content;
|
|
42
48
|
}
|
|
@@ -689,4 +695,3 @@ export class Table {
|
|
|
689
695
|
}
|
|
690
696
|
}
|
|
691
697
|
}
|
|
692
|
-
//# sourceMappingURL=table.js.map
|
|
@@ -6,25 +6,26 @@
|
|
|
6
6
|
* `process.exit`, so that lives behind the node seam as `installTraceback` in
|
|
7
7
|
* `src/node/traceback.ts` — which is what keeps this module, and therefore the
|
|
8
8
|
* main barrel, importable in a browser.
|
|
9
|
+
*
|
|
10
|
+
* [LAW:types-are-the-program] `TracebackOptions` names only what the renderer
|
|
11
|
+
* reads. There is no `showLocals`: an `Error` carries a stack of locations and
|
|
12
|
+
* nothing of the values in scope at them. The one way to get those in node —
|
|
13
|
+
* an inspector session pausing on exceptions — would have to pause on every
|
|
14
|
+
* throw, caught ones included, to serve `new Traceback(caughtError)`, and it
|
|
15
|
+
* cannot exist in a browser at all. Nor is there a `width` or `theme`: those
|
|
16
|
+
* sized and coloured a source-code excerpt this renderer does not produce.
|
|
9
17
|
*/
|
|
10
18
|
import { Segment } from "../core/segment.js";
|
|
11
19
|
import type { Renderable, RenderOptions } from "../core/protocol.js";
|
|
12
20
|
export interface TracebackOptions {
|
|
13
|
-
showLocals?: boolean;
|
|
14
21
|
suppress?: string[];
|
|
15
22
|
maxFrames?: number;
|
|
16
|
-
width?: number;
|
|
17
|
-
theme?: string;
|
|
18
23
|
}
|
|
19
24
|
export declare class Traceback implements Renderable {
|
|
20
25
|
readonly error: Error;
|
|
21
26
|
readonly maxFrames: number;
|
|
22
27
|
readonly suppress: string[];
|
|
23
|
-
readonly showLocals: boolean;
|
|
24
|
-
readonly width: number | undefined;
|
|
25
|
-
readonly theme: string | undefined;
|
|
26
28
|
constructor(error: Error, options?: TracebackOptions);
|
|
27
29
|
render(options: RenderOptions): Iterable<Segment>;
|
|
28
30
|
private _renderFrame;
|
|
29
31
|
}
|
|
30
|
-
//# sourceMappingURL=traceback.d.ts.map
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* `process.exit`, so that lives behind the node seam as `installTraceback` in
|
|
7
7
|
* `src/node/traceback.ts` — which is what keeps this module, and therefore the
|
|
8
8
|
* main barrel, importable in a browser.
|
|
9
|
+
*
|
|
10
|
+
* [LAW:types-are-the-program] `TracebackOptions` names only what the renderer
|
|
11
|
+
* reads. There is no `showLocals`: an `Error` carries a stack of locations and
|
|
12
|
+
* nothing of the values in scope at them. The one way to get those in node —
|
|
13
|
+
* an inspector session pausing on exceptions — would have to pause on every
|
|
14
|
+
* throw, caught ones included, to serve `new Traceback(caughtError)`, and it
|
|
15
|
+
* cannot exist in a browser at all. Nor is there a `width` or `theme`: those
|
|
16
|
+
* sized and coloured a source-code excerpt this renderer does not produce.
|
|
9
17
|
*/
|
|
10
18
|
import { Segment } from "../core/segment.js";
|
|
11
19
|
import { Style } from "../core/style.js";
|
|
@@ -34,16 +42,10 @@ export class Traceback {
|
|
|
34
42
|
error;
|
|
35
43
|
maxFrames;
|
|
36
44
|
suppress;
|
|
37
|
-
showLocals;
|
|
38
|
-
width;
|
|
39
|
-
theme;
|
|
40
45
|
constructor(error, options) {
|
|
41
46
|
this.error = error;
|
|
42
47
|
this.maxFrames = options?.maxFrames ?? 100;
|
|
43
48
|
this.suppress = options?.suppress ?? [];
|
|
44
|
-
this.showLocals = options?.showLocals ?? false;
|
|
45
|
-
this.width = options?.width;
|
|
46
|
-
this.theme = options?.theme;
|
|
47
49
|
}
|
|
48
50
|
*render(options) {
|
|
49
51
|
const excTypeStyle = getStyle(options, "traceback.exc_type");
|
|
@@ -66,9 +68,12 @@ export class Traceback {
|
|
|
66
68
|
: frames;
|
|
67
69
|
let displayFrames = filteredFrames;
|
|
68
70
|
if (this.maxFrames > 0 && displayFrames.length > this.maxFrames) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
// Spend the budget exactly: the tail takes `maxFrames - head` rather than
|
|
72
|
+
// a second `head`, so an odd budget shows every frame it counts, and it
|
|
73
|
+
// slices from an index because `slice(-0)` is the whole array.
|
|
74
|
+
const head = Math.floor(this.maxFrames / 2);
|
|
75
|
+
const first = displayFrames.slice(0, head);
|
|
76
|
+
const last = displayFrames.slice(displayFrames.length - (this.maxFrames - head));
|
|
72
77
|
const omitted = displayFrames.length - this.maxFrames;
|
|
73
78
|
for (const frame of first) {
|
|
74
79
|
yield* this._renderFrame(frame, options);
|
|
@@ -102,4 +107,3 @@ export class Traceback {
|
|
|
102
107
|
yield Segment.line();
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
|
-
//# sourceMappingURL=traceback.js.map
|
package/dist/renderables/tree.js
CHANGED
|
@@ -46,4 +46,3 @@ function baseStyleOf(style) {
|
|
|
46
46
|
throw new TypeError(`template function cannot style a fragment whose base style "${style}" is not a style definition: a style name resolves only against the theme of a render`, { cause: err });
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -60,4 +60,3 @@ export declare function contrastRatio(a: ColorRgba, b: ColorRgba): number;
|
|
|
60
60
|
* lightness moves — there is no caller-side "should I check contrast" branch.
|
|
61
61
|
*/
|
|
62
62
|
export declare function ensureContrast(fg: ColorRgba, bg: ColorRgba, minRatio?: number): ColorRgba;
|
|
63
|
-
//# sourceMappingURL=colorMath.d.ts.map
|
package/dist/themes/colorMath.js
CHANGED
package/dist/themes/colorRef.js
CHANGED