@visulima/tui 1.0.0-alpha.2 → 1.0.0-alpha.20
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/CHANGELOG.md +285 -0
- package/LICENSE.md +2650 -55
- package/README.md +38 -10
- package/dist/components/accordion.d.ts +59 -0
- package/dist/components/accordion.js +1 -0
- package/dist/components/alert.d.ts +26 -0
- package/dist/components/alert.js +1 -0
- package/dist/components/animate-presence.d.ts +18 -0
- package/dist/components/animate-presence.js +1 -0
- package/dist/components/approval-prompt.d.ts +65 -0
- package/dist/components/approval-prompt.js +1 -0
- package/dist/components/area-chart.d.ts +66 -0
- package/dist/components/area-chart.js +1 -0
- package/dist/components/badge.d.ts +22 -0
- package/dist/components/badge.js +1 -0
- package/dist/components/bar-chart.d.ts +67 -0
- package/dist/components/bar-chart.js +1 -0
- package/dist/components/big-text.d.ts +81 -0
- package/dist/components/big-text.js +1 -0
- package/dist/components/blink-dot.d.ts +36 -0
- package/dist/components/blink-dot.js +1 -0
- package/dist/components/box.d.ts +61 -0
- package/dist/components/box.js +1 -0
- package/dist/components/breadcrumb.d.ts +33 -0
- package/dist/components/breadcrumb.js +1 -0
- package/dist/components/button.d.ts +45 -0
- package/dist/components/button.js +1 -0
- package/dist/components/calendar.d.ts +72 -0
- package/dist/components/calendar.js +1 -0
- package/dist/components/canvas.d.ts +44 -0
- package/dist/components/canvas.js +1 -0
- package/dist/components/card.d.ts +57 -0
- package/dist/components/card.js +1 -0
- package/dist/components/checkbox.d.ts +48 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/code.d.ts +48 -0
- package/dist/components/code.js +2 -0
- package/dist/components/collapsible.d.ts +53 -0
- package/dist/components/collapsible.js +1 -0
- package/dist/components/command-block.d.ts +47 -0
- package/dist/components/command-block.js +4 -0
- package/dist/components/command-palette.d.ts +82 -0
- package/dist/components/command-palette.js +1 -0
- package/dist/components/confirm-dialog.d.ts +75 -0
- package/dist/components/confirm-dialog.js +1 -0
- package/dist/components/confirm-input.d.ts +38 -0
- package/dist/components/confirm-input.js +1 -0
- package/dist/components/console-overlay.d.ts +54 -0
- package/dist/components/console-overlay.js +1 -0
- package/dist/components/content-switcher.d.ts +57 -0
- package/dist/components/content-switcher.js +1 -0
- package/dist/components/controlled-scroll-view.d.ts +60 -0
- package/dist/components/controlled-scroll-view.js +1 -0
- package/dist/components/cursor.d.ts +61 -0
- package/dist/components/cursor.js +1 -0
- package/dist/components/date-picker.d.ts +65 -0
- package/dist/components/date-picker.js +1 -0
- package/dist/components/definition-list.d.ts +44 -0
- package/dist/components/definition-list.js +1 -0
- package/dist/components/dialog.d.ts +116 -0
- package/dist/components/dialog.js +1 -0
- package/dist/components/diff-view.d.ts +85 -0
- package/dist/components/diff-view.js +1 -0
- package/dist/components/divider.d.ts +49 -0
- package/dist/components/divider.js +1 -0
- package/dist/components/file-picker-entry.d.ts +104 -0
- package/dist/components/file-picker-entry.js +1 -0
- package/dist/components/form.d.ts +81 -0
- package/dist/components/form.js +1 -0
- package/dist/components/gauge.d.ts +87 -0
- package/dist/components/gauge.js +1 -0
- package/dist/components/gradient.d.ts +59 -0
- package/dist/components/gradient.js +4 -0
- package/dist/components/heading.d.ts +33 -0
- package/dist/components/heading.js +1 -0
- package/dist/components/heatmap.d.ts +62 -0
- package/dist/components/heatmap.js +1 -0
- package/dist/components/help.d.ts +52 -0
- package/dist/components/help.js +1 -0
- package/dist/components/histogram.d.ts +62 -0
- package/dist/components/histogram.js +1 -0
- package/dist/components/kbd.d.ts +31 -0
- package/dist/components/kbd.js +1 -0
- package/dist/components/line-chart.d.ts +109 -0
- package/dist/components/line-chart.js +1 -0
- package/dist/components/link.d.ts +38 -0
- package/dist/components/link.js +1 -0
- package/dist/components/loading-indicator.d.ts +29 -0
- package/dist/components/loading-indicator.js +1 -0
- package/dist/components/markdown.d.ts +40 -0
- package/dist/components/markdown.js +1 -0
- package/dist/components/masked-input.d.ts +50 -0
- package/dist/components/masked-input.js +1 -0
- package/dist/components/menu.d.ts +78 -0
- package/dist/components/menu.js +1 -0
- package/dist/components/message-bubble.d.ts +43 -0
- package/dist/components/message-bubble.js +1 -0
- package/dist/components/model-badge.d.ts +39 -0
- package/dist/components/model-badge.js +1 -0
- package/dist/components/multi-select.d.ts +65 -0
- package/dist/components/multi-select.js +1 -0
- package/dist/components/newline.d.ts +15 -0
- package/dist/components/newline.js +2 -0
- package/dist/components/operation-tree.d.ts +49 -0
- package/dist/components/operation-tree.js +1 -0
- package/dist/components/option-list.d.ts +47 -0
- package/dist/components/option-list.js +1 -0
- package/dist/components/ordered-list.d.ts +24 -0
- package/dist/components/ordered-list.js +1 -0
- package/dist/components/paginator.d.ts +69 -0
- package/dist/components/paginator.js +1 -0
- package/dist/components/paragraph.d.ts +38 -0
- package/dist/components/paragraph.js +1 -0
- package/dist/components/placeholder.d.ts +55 -0
- package/dist/components/placeholder.js +1 -0
- package/dist/components/progress-bar.d.ts +55 -0
- package/dist/components/progress-bar.js +1 -0
- package/dist/components/radio-group.d.ts +74 -0
- package/dist/components/radio-group.js +1 -0
- package/dist/components/scatter-plot.d.ts +35 -0
- package/dist/components/scatter-plot.js +1 -0
- package/dist/components/scroll-bar-box.d.ts +36 -0
- package/dist/components/scroll-bar-box.js +1 -0
- package/dist/components/scroll-bar.d.ts +24 -0
- package/dist/components/scroll-bar.js +1 -0
- package/dist/components/scroll-list.d.ts +19 -0
- package/dist/components/scroll-list.js +1 -0
- package/dist/components/scroll-view.d.ts +9 -0
- package/dist/components/scroll-view.js +1 -0
- package/dist/components/search-input.d.ts +55 -0
- package/dist/components/search-input.js +1 -0
- package/dist/components/select-input-indicator.d.ts +32 -0
- package/dist/components/select-input-indicator.js +1 -0
- package/dist/components/select-input-item.d.ts +41 -0
- package/dist/components/select-input-item.js +1 -0
- package/dist/components/select-input.d.ts +110 -0
- package/dist/components/select-input.js +1 -0
- package/dist/components/shimmer-text.d.ts +47 -0
- package/dist/components/shimmer-text.js +1 -0
- package/dist/components/slider.d.ts +103 -0
- package/dist/components/slider.js +1 -0
- package/dist/components/spacer.d.ts +8 -0
- package/dist/components/spacer.js +1 -0
- package/dist/components/sparkline.d.ts +35 -0
- package/dist/components/sparkline.js +1 -0
- package/dist/components/spinner.d.ts +17 -0
- package/dist/components/spinner.js +1 -0
- package/dist/components/static-render.d.ts +54 -0
- package/dist/components/static-render.js +1 -0
- package/dist/components/static.d.ts +28 -0
- package/dist/components/static.js +1 -0
- package/dist/components/status-line.d.ts +37 -0
- package/dist/components/status-line.js +1 -0
- package/dist/components/status-message.d.ts +21 -0
- package/dist/components/status-message.js +1 -0
- package/dist/components/stepper.d.ts +48 -0
- package/dist/components/stepper.js +1 -0
- package/dist/components/stopwatch.d.ts +49 -0
- package/dist/components/stopwatch.js +1 -0
- package/dist/components/streaming-text.d.ts +46 -0
- package/dist/components/streaming-text.js +1 -0
- package/dist/components/switch.d.ts +55 -0
- package/dist/components/switch.js +1 -0
- package/dist/components/tab.d.ts +19 -0
- package/dist/components/tab.js +1 -0
- package/dist/components/table.d.ts +119 -0
- package/dist/components/table.js +1 -0
- package/dist/components/tabs.d.ts +107 -0
- package/dist/components/tabs.js +1 -0
- package/dist/components/tag.d.ts +35 -0
- package/dist/components/tag.js +1 -0
- package/dist/components/text-input.d.ts +48 -0
- package/dist/components/text-input.js +1 -0
- package/dist/components/text.d.ts +78 -0
- package/dist/components/text.js +1 -0
- package/dist/components/textarea.d.ts +68 -0
- package/dist/components/textarea.js +2 -0
- package/dist/components/timer.d.ts +59 -0
- package/dist/components/timer.js +1 -0
- package/dist/components/toast.d.ts +49 -0
- package/dist/components/toast.js +1 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +1 -0
- package/dist/components/transform.d.ts +21 -0
- package/dist/components/transform.js +1 -0
- package/dist/components/transition.d.ts +74 -0
- package/dist/components/transition.js +1 -0
- package/dist/components/tree-view-entry.d.ts +356 -0
- package/dist/components/tree-view-entry.js +1 -0
- package/dist/components/unordered-list.d.ts +30 -0
- package/dist/components/unordered-list.js +1 -0
- package/dist/core/index.d.ts +57 -5
- package/dist/core/index.js +1 -5
- package/dist/ink/hooks/use-animation.d.ts +37 -39
- package/dist/ink/hooks/use-animation.js +1 -0
- package/dist/ink/hooks/use-app.d.ts +36 -4
- package/dist/ink/hooks/use-app.js +1 -0
- package/dist/ink/hooks/use-box-metrics.d.ts +57 -50
- package/dist/ink/hooks/use-box-metrics.js +1 -0
- package/dist/ink/hooks/use-clipboard.d.ts +26 -25
- package/dist/ink/hooks/use-clipboard.js +1 -0
- package/dist/ink/hooks/use-color-blindness.d.ts +29 -29
- package/dist/ink/hooks/use-color-blindness.js +1 -0
- package/dist/ink/hooks/use-console-capture.d.ts +38 -38
- package/dist/ink/hooks/use-console-capture.js +1 -0
- package/dist/ink/hooks/use-cursor.d.ts +10 -9
- package/dist/ink/hooks/use-cursor.js +1 -0
- package/dist/ink/hooks/use-focus-manager.d.ts +53 -38
- package/dist/ink/hooks/use-focus-manager.js +1 -0
- package/dist/ink/hooks/use-focus.d.ts +29 -25
- package/dist/ink/hooks/use-focus.js +1 -0
- package/dist/ink/hooks/use-form.d.ts +68 -0
- package/dist/ink/hooks/use-form.js +1 -0
- package/dist/ink/hooks/use-hotkey.d.ts +37 -0
- package/dist/ink/hooks/use-hotkey.js +1 -0
- package/dist/ink/hooks/use-input.d.ts +142 -142
- package/dist/ink/hooks/use-input.js +2 -0
- package/dist/ink/hooks/use-interval.d.ts +25 -0
- package/dist/ink/hooks/use-interval.js +1 -0
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +4 -4
- package/dist/ink/hooks/use-is-screen-reader-enabled.js +1 -0
- package/dist/ink/hooks/use-key-bindings.d.ts +50 -52
- package/dist/ink/hooks/use-key-bindings.js +1 -0
- package/dist/ink/hooks/use-key-chord.d.ts +25 -0
- package/dist/ink/hooks/use-key-chord.js +1 -0
- package/dist/ink/hooks/use-linked-scroll.d.ts +44 -37
- package/dist/ink/hooks/use-linked-scroll.js +1 -0
- package/dist/ink/hooks/use-paste.d.ts +41 -40
- package/dist/ink/hooks/use-paste.js +1 -0
- package/dist/ink/hooks/use-persistent-state.d.ts +56 -0
- package/dist/ink/hooks/use-persistent-state.js +2 -0
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +43 -43
- package/dist/ink/hooks/use-scroll-acceleration.js +1 -0
- package/dist/ink/hooks/use-scroll-input.d.ts +31 -31
- package/dist/ink/hooks/use-scroll-input.js +1 -0
- package/dist/ink/hooks/use-stderr.d.ts +14 -4
- package/dist/ink/hooks/use-stderr.js +1 -0
- package/dist/ink/hooks/use-stdin.d.ts +28 -5
- package/dist/ink/hooks/use-stdin.js +1 -0
- package/dist/ink/hooks/use-stdout.d.ts +14 -4
- package/dist/ink/hooks/use-stdout.js +1 -0
- package/dist/ink/hooks/use-stopwatch.d.ts +36 -37
- package/dist/ink/hooks/use-stopwatch.js +1 -0
- package/dist/ink/hooks/use-terminal-palette.d.ts +17 -16
- package/dist/ink/hooks/use-terminal-palette.js +1 -0
- package/dist/ink/hooks/use-text-buffer.d.ts +37 -37
- package/dist/ink/hooks/use-text-buffer.js +4 -0
- package/dist/ink/hooks/use-text-selection.d.ts +40 -41
- package/dist/ink/hooks/use-text-selection.js +1 -0
- package/dist/ink/hooks/use-timeout.d.ts +24 -0
- package/dist/ink/hooks/use-timeout.js +1 -0
- package/dist/ink/hooks/use-timer.d.ts +45 -46
- package/dist/ink/hooks/use-timer.js +1 -0
- package/dist/ink/hooks/use-window-size.d.ts +14 -14
- package/dist/ink/hooks/use-window-size.js +1 -0
- package/dist/ink/index.d.ts +397 -159
- package/dist/ink/index.js +1 -100
- package/dist/packem_chunks/devtools.js +3 -26
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
- package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
- package/dist/packem_shared/ControlledScrollView-CIc-x1Cx.js +1 -0
- package/dist/packem_shared/DevTools-BR7K-5JX.js +1 -0
- package/dist/packem_shared/FilePicker-tYj_CIau.js +1 -0
- package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
- package/dist/packem_shared/Fullscreen-CxLd1-Zu.js +1 -0
- package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
- package/dist/packem_shared/InputParser-BAqciKJ6.js +2 -0
- package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
- package/dist/packem_shared/LayoutNode-B0qeT8sl.js +1 -0
- package/dist/packem_shared/MouseProvider-CHU5DuwC.js +1 -0
- package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
- package/dist/packem_shared/Renderer-DJXooAsp.js +1 -0
- package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +1 -0
- package/dist/packem_shared/ScrollBar-U_37hlIT.js +1 -0
- package/dist/packem_shared/ScrollBarBox-DwiCxilX.js +1 -0
- package/dist/packem_shared/ScrollList-C7nZ9ufK.js +1 -0
- package/dist/packem_shared/ScrollView-DKZ8OM-m.js +1 -0
- package/dist/packem_shared/Static-DLynr5pn.js +1 -0
- package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
- package/dist/packem_shared/TreeView-C0Iv3et8.js +1 -0
- package/dist/packem_shared/TuiApp-CxBtziW8.js +1 -0
- package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
- package/dist/packem_shared/_commonjsHelpers-CHNfUHCT.js +1 -0
- package/dist/packem_shared/accessibility-context-DDyHTwmA.js +1 -0
- package/dist/packem_shared/animation-context-DW3p-vpk.js +1 -0
- package/dist/packem_shared/ansi-parser-C5JuL732.js +1 -0
- package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +1 -0
- package/dist/packem_shared/app-context-BVpKlG1z.js +1 -0
- package/dist/packem_shared/background-context-rjOaWFki.js +1 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +39 -0
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +50 -0
- package/dist/packem_shared/colorize-gy_cY-wC.js +2 -0
- package/dist/packem_shared/comparePoints-Dez5FkH9.js +1 -0
- package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-CcUS50jx.js +1 -0
- package/dist/packem_shared/createInlineLoop-D0JaKX9A.js +2 -0
- package/dist/packem_shared/createScreen-87XLHZq6.js +3 -0
- package/dist/packem_shared/cursor-context-CFviBqPX.js +1 -0
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +12 -0
- package/dist/packem_shared/dom-CW6KYzFK.js +8 -0
- package/dist/packem_shared/dom.d-DgP_exKU.d.ts +412 -0
- package/dist/packem_shared/erase-DKKNxHZ_.js +1 -0
- package/dist/packem_shared/focus-context-CsT69klR.js +1 -0
- package/dist/packem_shared/format-time-C7Q-hQZq.js +1 -0
- package/dist/packem_shared/get-string-width-CbMPWEJO.js +1 -0
- package/dist/packem_shared/getPathToRoot-B3q6OlQy.js +1 -0
- package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
- package/dist/packem_shared/index-COPEEDn3.js +9 -0
- package/dist/packem_shared/index-CqsHHJkn.js +75 -0
- package/dist/packem_shared/index.d-Bk52cbgN.d.ts +14 -0
- package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +5 -0
- package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
- package/dist/packem_shared/isIntersecting-B3KbKTmu.js +1 -0
- package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +1 -0
- package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +1 -0
- package/dist/packem_shared/kittyFlags-C3rZLbcK.js +1 -0
- package/dist/packem_shared/layout-BMo200nF.js +2 -0
- package/dist/packem_shared/line-chart-kf7uhR0K.js +1 -0
- package/dist/packem_shared/measure-text-D-jVetsl.js +3 -0
- package/dist/packem_shared/measureElement-BTtTFZg4.js +1 -0
- package/dist/packem_shared/mode-BOIU4Roy.js +1 -0
- package/dist/packem_shared/mouse-context-DaARgUu1.js +1 -0
- package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +1 -0
- package/dist/packem_shared/processLayout-FEKj_mWu.js +1 -0
- package/dist/packem_shared/reconciler-CGhHgXXG.js +1 -0
- package/dist/packem_shared/reconciler-ClRKkLS4.js +1 -0
- package/dist/packem_shared/render-BoukeuYD.js +1 -0
- package/dist/packem_shared/render-CBFHzIKj.js +27 -0
- package/dist/packem_shared/render.d-DarVJBG2.d.ts +417 -0
- package/dist/packem_shared/renderToString-Cx3DmmMR.js +4 -0
- package/dist/packem_shared/renderToString-nZdqfdWT.js +2 -0
- package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +2 -0
- package/dist/packem_shared/renderer-C2ycheBL.js +17 -0
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +119 -0
- package/dist/packem_shared/selection.d-WuD_83yQ.d.ts +62 -0
- package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-DCdi3SZ2.js +1 -0
- package/dist/packem_shared/stderr-context-BzEaUICS.js +1 -0
- package/dist/packem_shared/stdin-context-BTaaFagk.js +1 -0
- package/dist/packem_shared/stdout-context-BnblEPez.js +1 -0
- package/dist/packem_shared/strip-C6HQYmlg.js +1 -0
- package/dist/packem_shared/styles.d-CLJdt-kg.d.ts +492 -0
- package/dist/packem_shared/terminal-palette.d-D2SQjfn-.d.ts +19 -0
- package/dist/packem_shared/text-width-CI9G0a-z.js +2 -0
- package/dist/packem_shared/token-to-elements-BAZpNZsu.js +1 -0
- package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
- package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
- package/dist/packem_shared/useMouseAction-2dRfU1vE.js +1 -0
- package/dist/packem_shared/useMouseContext-C746G7kY.js +1 -0
- package/dist/packem_shared/useMousePosition-BTWfV4JK.js +1 -0
- package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +1 -0
- package/dist/packem_shared/useOnMouseHover-D3DczIol.js +1 -0
- package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +1 -0
- package/dist/packem_shared/useTreeView-BoMMeRPq.js +1 -0
- package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
- package/dist/packem_shared/utils-THUhYKG2.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
- package/dist/packem_shared/waitFor-Dj5zfL5s.js +4 -0
- package/dist/packem_shared/wrapOrTruncateStyledLine-kyi6yijx.js +3 -0
- package/dist/react/index.d.ts +518 -8
- package/dist/react/index.js +1 -9
- package/dist/testing/index.d.ts +277 -135
- package/dist/testing/index.js +1 -260
- package/index.js +52 -52
- package/package.json +552 -40
- package/dist/core/app.d.ts +0 -50
- package/dist/core/cell.d.ts +0 -33
- package/dist/core/inline.d.ts +0 -22
- package/dist/core/input.d.ts +0 -18
- package/dist/core/native-binding.d.ts +0 -22
- package/dist/ink/ansi-to-cell.d.ts +0 -5
- package/dist/ink/ansi-tokenizer.d.ts +0 -38
- package/dist/ink/clipboard.d.ts +0 -29
- package/dist/ink/color-matrix.d.ts +0 -49
- package/dist/ink/color-utils.d.ts +0 -30
- package/dist/ink/colorize.d.ts +0 -4
- package/dist/ink/components/AccessibilityContext.d.ts +0 -4
- package/dist/ink/components/Alert.d.ts +0 -30
- package/dist/ink/components/AnimationContext.d.ts +0 -10
- package/dist/ink/components/App.d.ts +0 -19
- package/dist/ink/components/AppContext.d.ts +0 -38
- package/dist/ink/components/BackgroundContext.d.ts +0 -5
- package/dist/ink/components/Badge.d.ts +0 -27
- package/dist/ink/components/BigText.d.ts +0 -71
- package/dist/ink/components/Box.d.ts +0 -58
- package/dist/ink/components/Code.d.ts +0 -46
- package/dist/ink/components/ConfirmInput.d.ts +0 -40
- package/dist/ink/components/ConsoleOverlay.d.ts +0 -52
- package/dist/ink/components/Cursor.d.ts +0 -43
- package/dist/ink/components/CursorContext.d.ts +0 -12
- package/dist/ink/components/Dialog.d.ts +0 -93
- package/dist/ink/components/DiffView.d.ts +0 -71
- package/dist/ink/components/ErrorBoundary.d.ts +0 -17
- package/dist/ink/components/ErrorOverview.d.ts +0 -6
- package/dist/ink/components/FocusContext.d.ts +0 -17
- package/dist/ink/components/Gradient.d.ts +0 -38
- package/dist/ink/components/Help.d.ts +0 -49
- package/dist/ink/components/Link.d.ts +0 -34
- package/dist/ink/components/Markdown.d.ts +0 -34
- package/dist/ink/components/MultiSelect.d.ts +0 -63
- package/dist/ink/components/Newline.d.ts +0 -12
- package/dist/ink/components/OrderedList.d.ts +0 -30
- package/dist/ink/components/Paginator.d.ts +0 -75
- package/dist/ink/components/ProgressBar.d.ts +0 -51
- package/dist/ink/components/SelectInput.d.ts +0 -96
- package/dist/ink/components/SelectInputIndicator.d.ts +0 -36
- package/dist/ink/components/SelectInputItem.d.ts +0 -43
- package/dist/ink/components/Slider.d.ts +0 -92
- package/dist/ink/components/Spacer.d.ts +0 -7
- package/dist/ink/components/Spinner.d.ts +0 -42
- package/dist/ink/components/Static.d.ts +0 -24
- package/dist/ink/components/StaticRender.d.ts +0 -28
- package/dist/ink/components/StatusMessage.d.ts +0 -26
- package/dist/ink/components/StderrContext.d.ts +0 -16
- package/dist/ink/components/StdinContext.d.ts +0 -29
- package/dist/ink/components/StdoutContext.d.ts +0 -16
- package/dist/ink/components/Stopwatch.d.ts +0 -44
- package/dist/ink/components/Tab.d.ts +0 -25
- package/dist/ink/components/Table.d.ts +0 -80
- package/dist/ink/components/Tabs.d.ts +0 -104
- package/dist/ink/components/Text.d.ts +0 -63
- package/dist/ink/components/TextInput.d.ts +0 -48
- package/dist/ink/components/Textarea.d.ts +0 -62
- package/dist/ink/components/Timer.d.ts +0 -52
- package/dist/ink/components/Transform.d.ts +0 -16
- package/dist/ink/components/UnorderedList.d.ts +0 -35
- package/dist/ink/components/file-picker/FilePicker.d.ts +0 -75
- package/dist/ink/components/file-picker/index.d.ts +0 -3
- package/dist/ink/components/file-picker/types.d.ts +0 -38
- package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
- package/dist/ink/components/scroll/ControlledScrollView.d.ts +0 -43
- package/dist/ink/components/scroll/ScrollBar.d.ts +0 -20
- package/dist/ink/components/scroll/ScrollBarBox.d.ts +0 -15
- package/dist/ink/components/scroll/ScrollList.d.ts +0 -12
- package/dist/ink/components/scroll/ScrollView.d.ts +0 -98
- package/dist/ink/components/scroll/index.d.ts +0 -10
- package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
- package/dist/ink/components/tree-view/TreeView.d.ts +0 -89
- package/dist/ink/components/tree-view/TreeViewNode.d.ts +0 -29
- package/dist/ink/components/tree-view/index.d.ts +0 -11
- package/dist/ink/components/tree-view/theme.d.ts +0 -24
- package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
- package/dist/ink/components/tree-view/types.d.ts +0 -55
- package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
- package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
- package/dist/ink/components/variant-config.d.ts +0 -10
- package/dist/ink/cursor-helpers.d.ts +0 -38
- package/dist/ink/data-limited-lru-map.d.ts +0 -21
- package/dist/ink/devtools-window-polyfill.d.ts +0 -1
- package/dist/ink/devtools.d.ts +0 -1
- package/dist/ink/dom.d.ts +0 -213
- package/dist/ink/get-max-width.d.ts +0 -3
- package/dist/ink/highlighter.d.ts +0 -28
- package/dist/ink/ime-utils.d.ts +0 -25
- package/dist/ink/ink.d.ts +0 -189
- package/dist/ink/input-parser.d.ts +0 -10
- package/dist/ink/input-utils.d.ts +0 -16
- package/dist/ink/instances.d.ts +0 -3
- package/dist/ink/kitty-keyboard.d.ts +0 -23
- package/dist/ink/layout.d.ts +0 -26
- package/dist/ink/log-update-native.d.ts +0 -14
- package/dist/ink/log-update.d.ts +0 -21
- package/dist/ink/measure-element.d.ts +0 -147
- package/dist/ink/measure-text.d.ts +0 -56
- package/dist/ink/mouse/Fullscreen.d.ts +0 -8
- package/dist/ink/mouse/MouseProvider.d.ts +0 -11
- package/dist/ink/mouse/ansi-parser.d.ts +0 -37
- package/dist/ink/mouse/constants.d.ts +0 -59
- package/dist/ink/mouse/index.d.ts +0 -20
- package/dist/ink/mouse/is-intersecting.d.ts +0 -18
- package/dist/ink/mouse/mouse-context.d.ts +0 -36
- package/dist/ink/mouse/use-element-position.d.ts +0 -29
- package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
- package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
- package/dist/ink/mouse/use-mouse.d.ts +0 -7
- package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
- package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
- package/dist/ink/output.d.ts +0 -74
- package/dist/ink/parse-keypress.d.ts +0 -22
- package/dist/ink/reconciler.d.ts +0 -3
- package/dist/ink/region.d.ts +0 -99
- package/dist/ink/render-background.d.ts +0 -4
- package/dist/ink/render-border.d.ts +0 -4
- package/dist/ink/render-node-to-output.d.ts +0 -38
- package/dist/ink/render-scrollbar.d.ts +0 -9
- package/dist/ink/render-sticky.d.ts +0 -44
- package/dist/ink/render-to-string.d.ts +0 -37
- package/dist/ink/render.d.ts +0 -191
- package/dist/ink/renderer.d.ts +0 -17
- package/dist/ink/resize-observer.d.ts +0 -44
- package/dist/ink/sanitize-ansi.d.ts +0 -2
- package/dist/ink/scroll.d.ts +0 -23
- package/dist/ink/selection.d.ts +0 -70
- package/dist/ink/squash-text-nodes.d.ts +0 -18
- package/dist/ink/style-flags.d.ts +0 -17
- package/dist/ink/styled-line-factory.d.ts +0 -25
- package/dist/ink/styled-line-serializer.d.ts +0 -18
- package/dist/ink/styled-line.d.ts +0 -109
- package/dist/ink/styles.d.ts +0 -369
- package/dist/ink/terminal-palette.d.ts +0 -25
- package/dist/ink/text-wrap.d.ts +0 -10
- package/dist/ink/token-to-elements.d.ts +0 -22
- package/dist/ink/utils/format-time.d.ts +0 -4
- package/dist/ink/utils.d.ts +0 -9
- package/dist/ink/wrap-text.d.ts +0 -3
- package/dist/ink/write-synchronized.d.ts +0 -4
- package/dist/packem_shared/AccessibilityContext-BLelHhNU.js +0 -7
- package/dist/packem_shared/Alert-Dr3s_LD9.js +0 -17
- package/dist/packem_shared/AnimationContext-BcJg8Jr6.js +0 -15
- package/dist/packem_shared/AppContext-CP0U6H7O.js +0 -11
- package/dist/packem_shared/BackgroundContext-BAUaxfOb.js +0 -5
- package/dist/packem_shared/Badge-Dk7EGGM6.js +0 -13
- package/dist/packem_shared/BigText-CjMdY63X.js +0 -24
- package/dist/packem_shared/Box-D_pSJ9Jp.js +0 -73
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-BsMy5Ewl.js +0 -81
- package/dist/packem_shared/Cell-DCg1kJY-.js +0 -48
- package/dist/packem_shared/Code-DjQvPBD9.js +0 -53
- package/dist/packem_shared/ConfirmInput-85Y4kRQW.js +0 -44
- package/dist/packem_shared/ConsoleOverlay-DBNa4vtj.js +0 -57
- package/dist/packem_shared/ControlledScrollView-BlOaxcsN.js +0 -286
- package/dist/packem_shared/ControlledScrollView-DfAhcufF.js +0 -5
- package/dist/packem_shared/Cursor-DiW7YoSK.js +0 -18
- package/dist/packem_shared/CursorContext-JxRzlqAx.js +0 -9
- package/dist/packem_shared/DevTools-aMPIsaHx.js +0 -61
- package/dist/packem_shared/Dialog-DsSNAVgC.js +0 -71
- package/dist/packem_shared/DiffView-hqaw-2S6.js +0 -329
- package/dist/packem_shared/FilePicker-DNwFxRhq.js +0 -254
- package/dist/packem_shared/FocusContext-CWkYtgcm.js +0 -26
- package/dist/packem_shared/FocusContext-D5wFxSRz.js +0 -153
- package/dist/packem_shared/Fullscreen-DrElAE1o.js +0 -11
- package/dist/packem_shared/Gradient-Ql5P0GUd.js +0 -136
- package/dist/packem_shared/Help-6wanGG38.js +0 -112
- package/dist/packem_shared/IMECompositionBuffer-Dl3S0KnF.js +0 -55
- package/dist/packem_shared/InputParser-BKHpWfvN.js +0 -156
- package/dist/packem_shared/LayoutNode-Cjnsodiy.js +0 -131
- package/dist/packem_shared/Link-COcKYfGT.js +0 -66
- package/dist/packem_shared/Markdown-y1ISztof.js +0 -212
- package/dist/packem_shared/MouseProvider-Y9TSSEGl.js +0 -136
- package/dist/packem_shared/MultiSelect-ChoLUcDI.js +0 -129
- package/dist/packem_shared/NAMED_COLORS-a4QBvb5r.js +0 -262
- package/dist/packem_shared/Newline-DBtYEg8x.js +0 -7
- package/dist/packem_shared/OrderedList-Cp7pXr6m.js +0 -26
- package/dist/packem_shared/Paginator-D1AuD-kj.js +0 -104
- package/dist/packem_shared/ProgressBar-DOfpVagn.js +0 -22
- package/dist/packem_shared/Renderer-zZ5O3vxc.js +0 -31
- package/dist/packem_shared/ResizeObserverEntry-Br4seLeQ.js +0 -102
- package/dist/packem_shared/ScrollBar-EWAs2Uc7.js +0 -106
- package/dist/packem_shared/ScrollBarBox-DTNNlh7R.js +0 -72
- package/dist/packem_shared/ScrollList-DCeIFL8M.js +0 -227
- package/dist/packem_shared/ScrollView-v3MCNIyX.js +0 -196
- package/dist/packem_shared/SelectInput-BN2TMyxp.js +0 -260
- package/dist/packem_shared/SelectInputIndicator-DkRMoH_b.js +0 -9
- package/dist/packem_shared/SelectInputItem-BF9LQgKu.js +0 -8
- package/dist/packem_shared/Slider-BWD7xZX6.js +0 -116
- package/dist/packem_shared/Spacer-Bs4ER-HK.js +0 -8
- package/dist/packem_shared/Spinner-BuI-kN4p.js +0 -1799
- package/dist/packem_shared/Static-DpTd6Eed.js +0 -22
- package/dist/packem_shared/Static-xmD9giJj.js +0 -18
- package/dist/packem_shared/StaticRender-tYwH6QXl.js +0 -33
- package/dist/packem_shared/StatusMessage-BtSYxzwb.js +0 -14
- package/dist/packem_shared/StderrContext-Bj4Mf7v7.js +0 -17
- package/dist/packem_shared/StdinContext-Bq_GNJ3z.js +0 -38
- package/dist/packem_shared/StdoutContext-CgjWeCdO.js +0 -17
- package/dist/packem_shared/Stopwatch-DjtTCyHn.js +0 -23
- package/dist/packem_shared/Tab-C6r5q4hR.js +0 -7
- package/dist/packem_shared/Table-D-rSVlzb.js +0 -82
- package/dist/packem_shared/Tabs-hki-KRnx.js +0 -153
- package/dist/packem_shared/Text-DvAUdZcK.js +0 -65
- package/dist/packem_shared/TextInput-C79WEQ5U.js +0 -137
- package/dist/packem_shared/Textarea-Dj06R6Zd.js +0 -272
- package/dist/packem_shared/Timer-wi9zuh4n.js +0 -22
- package/dist/packem_shared/Transform-BHxY_dAM.js +0 -14
- package/dist/packem_shared/TreeNodeMap-CtJUvBnd.js +0 -155
- package/dist/packem_shared/TreeView-C2062dtj.js +0 -148
- package/dist/packem_shared/TuiApp-DfxOnXqi.js +0 -120
- package/dist/packem_shared/TuiContext-CqEjMyXd.js +0 -415
- package/dist/packem_shared/UnorderedList-DhnadWjX.js +0 -33
- package/dist/packem_shared/ansi-parser-0BdVTKho.js +0 -41
- package/dist/packem_shared/ansi-tokenizer-LHq2LUWA.js +0 -307
- package/dist/packem_shared/boxes-oi3WUbyR.js +0 -92
- package/dist/packem_shared/colorize-88_Vk8cn.js +0 -48
- package/dist/packem_shared/comparePoints-CGMDnd3_.js +0 -287
- package/dist/packem_shared/createInlineLoop-BxMmcq9D.js +0 -93
- package/dist/packem_shared/createLinkedScrollGroup-Djw4Ceo0.js +0 -44
- package/dist/packem_shared/dom-DvzhsAez.js +0 -225
- package/dist/packem_shared/format-time-BGmnDukX.js +0 -12
- package/dist/packem_shared/getPathToRoot-a1wbwxfL.js +0 -4
- package/dist/packem_shared/getScrollHeight-BubfU_df.js +0 -63
- package/dist/packem_shared/input-utils-ViAEXa0Z.js +0 -19
- package/dist/packem_shared/isIntersecting-fEXHJN5R.js +0 -10
- package/dist/packem_shared/isOsc52Supported-G0k4sXJx.js +0 -36
- package/dist/packem_shared/isTerminalPaletteQuerySupported-EeiwMKbr.js +0 -93
- package/dist/packem_shared/kittyFlags-bNNf_9kX.js +0 -26
- package/dist/packem_shared/measure-element-Reza_yfC.js +0 -396
- package/dist/packem_shared/measure-text-DItZYotK.js +0 -1189
- package/dist/packem_shared/measureElement-CTgFCmKd.js +0 -4
- package/dist/packem_shared/mouse-context-BUHWKEIe.js +0 -6
- package/dist/packem_shared/parseSgrMouse-BHVBPP9G.js +0 -1
- package/dist/packem_shared/processLayout-BQ9kXfd3.js +0 -2
- package/dist/packem_shared/reconciler-BXf6miSS.js +0 -211
- package/dist/packem_shared/reconciler-gfmqURLy.js +0 -680
- package/dist/packem_shared/render-BAwdjfki.js +0 -2806
- package/dist/packem_shared/render-Bpjhf0lD.js +0 -195
- package/dist/packem_shared/renderToString-Cfg55DRD.js +0 -62
- package/dist/packem_shared/renderToString-ClIaXgrC.js +0 -86
- package/dist/packem_shared/renderTreeToBuffer-D3mo7M7m.js +0 -308
- package/dist/packem_shared/renderer-B3wROkeg.js +0 -1431
- package/dist/packem_shared/setEnableStyledLineCache-BpskngSJ.js +0 -2
- package/dist/packem_shared/squashTextNodesWithMap-iqm6OMMT.js +0 -100
- package/dist/packem_shared/text-width-DhuarWcB.js +0 -42
- package/dist/packem_shared/token-to-elements-BRFl_rzw.js +0 -249
- package/dist/packem_shared/treeViewTheme-BpSw9TMf.js +0 -52
- package/dist/packem_shared/useAnimation-kj31sA-T.js +0 -62
- package/dist/packem_shared/useApp-DPQlRzi5.js +0 -6
- package/dist/packem_shared/useBoxMetrics-rBjKc-g4.js +0 -54
- package/dist/packem_shared/useClipboard-B_9-adw1.js +0 -23
- package/dist/packem_shared/useColorBlindness-D_sTIhcb.js +0 -30
- package/dist/packem_shared/useConsoleCapture-Dvt7G1W1.js +0 -61
- package/dist/packem_shared/useCursor-BIJzc8k9.js +0 -19
- package/dist/packem_shared/useElementDimensions-CAoKitVD.js +0 -67
- package/dist/packem_shared/useFocus-CNl5QHHf.js +0 -37
- package/dist/packem_shared/useFocusManager-BPYaUuKQ.js +0 -16
- package/dist/packem_shared/useInput-Cfp5zB2s.js +0 -594
- package/dist/packem_shared/useIsScreenReaderEnabled-CnGKCe0f.js +0 -9
- package/dist/packem_shared/useKeyBindings-B78l1E1n.js +0 -66
- package/dist/packem_shared/useMouseAction-C5gZ2nj7.js +0 -29
- package/dist/packem_shared/useMouseContext-D-rFy60Q.js +0 -12
- package/dist/packem_shared/useMousePosition-BHBJ-kBk.js +0 -25
- package/dist/packem_shared/useOnMouseClick--ZIyBOBO.js +0 -35
- package/dist/packem_shared/useOnMouseHover-26diuXUC.js +0 -32
- package/dist/packem_shared/useOnMouseState-NO_Kda_C.js +0 -13
- package/dist/packem_shared/usePaste-Ct8J4AGR.js +0 -35
- package/dist/packem_shared/useScrollAcceleration-R9LfrPVG.js +0 -73
- package/dist/packem_shared/useScrollInput-D3CpBq_a.js +0 -72
- package/dist/packem_shared/useStderr-CAOVUh4E.js +0 -6
- package/dist/packem_shared/useStdin-X-O0kd-n.js +0 -7
- package/dist/packem_shared/useStdout-DyF6DSH0.js +0 -6
- package/dist/packem_shared/useStopwatch-qC4Beai4.js +0 -33
- package/dist/packem_shared/useTerminalPalette-BaWO2c4Q.js +0 -38
- package/dist/packem_shared/useTextBuffer-C8fEe9Ly.js +0 -398
- package/dist/packem_shared/useTextSelection-mXtxgsPK.js +0 -50
- package/dist/packem_shared/useTimer-CPQ7j827.js +0 -46
- package/dist/packem_shared/useTreeView-BT57P3Kx.js +0 -101
- package/dist/packem_shared/useTreeViewState-BpS_KZ-K.js +0 -502
- package/dist/packem_shared/useWindowSize-ugEmGZJm.js +0 -20
- package/dist/packem_shared/utils-BgdlrbOH.js +0 -140
- package/dist/packem_shared/variant-config-DSZoX5TM.js +0 -8
- package/dist/packem_shared/wrapOrTruncateStyledLine-DN3Nogoc.js +0 -147
- package/dist/react/devtools.d.ts +0 -27
- package/dist/react/focus.d.ts +0 -39
- package/dist/react/hooks.d.ts +0 -238
- package/dist/react/layout.d.ts +0 -35
- package/dist/react/react.d.ts +0 -57
- package/dist/react/reconciler.d.ts +0 -4
- package/dist/react/render-to-string.d.ts +0 -21
- package/dist/react/renderer.d.ts +0 -2
- package/dist/react/scene.d.ts +0 -3
- package/dist/react/static.d.ts +0 -39
- package/dist/react/styles.d.ts +0 -83
- package/dist/react/text-width.d.ts +0 -20
- package/dist/testing/keys.d.ts +0 -89
- package/dist/testing/screen.d.ts +0 -35
- package/dist/testing/wait-for.d.ts +0 -21
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type DiffViewMode = "split" | "unified";
|
|
3
|
+
type InlineDiffMode = "chars" | "words";
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Number of unchanged context lines around changes.
|
|
7
|
+
* @default 3
|
|
8
|
+
*/
|
|
9
|
+
readonly context?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Pre-computed unified diff string. If provided, `oldText`/`newText` are ignored.
|
|
12
|
+
*/
|
|
13
|
+
readonly diff?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Enable character-level inline diff highlighting within changed lines.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
readonly inlineDiff?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Granularity of inline diff highlighting.
|
|
21
|
+
* - `"chars"` — character-level (best for code)
|
|
22
|
+
* - `"words"` — word-level (best for prose)
|
|
23
|
+
* @default "chars"
|
|
24
|
+
*/
|
|
25
|
+
readonly inlineDiffMode?: InlineDiffMode;
|
|
26
|
+
/**
|
|
27
|
+
* Programming language for syntax highlighting within diff lines.
|
|
28
|
+
* When provided, diff content is highlighted with Shiki.
|
|
29
|
+
*/
|
|
30
|
+
readonly language?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Display mode: unified (interleaved) or split (side-by-side).
|
|
33
|
+
* @default "unified"
|
|
34
|
+
*/
|
|
35
|
+
readonly mode?: DiffViewMode;
|
|
36
|
+
/**
|
|
37
|
+
* Label for the new version.
|
|
38
|
+
*/
|
|
39
|
+
readonly newLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Modified text ("new" / right side).
|
|
42
|
+
*/
|
|
43
|
+
readonly newText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Label for the old version.
|
|
46
|
+
*/
|
|
47
|
+
readonly oldLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Original text ("old" / left side).
|
|
50
|
+
*/
|
|
51
|
+
readonly oldText?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to display line numbers.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
readonly showLineNumbers?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Shiki theme for syntax highlighting.
|
|
59
|
+
* @default "github-dark-default"
|
|
60
|
+
*/
|
|
61
|
+
readonly theme?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Display file differences with colored additions/deletions.
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <DiffView oldText="hello" newText="hello world" />
|
|
68
|
+
* <DiffView diff={unifiedDiffString} mode="split" />
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function DiffView({
|
|
72
|
+
context,
|
|
73
|
+
diff: diffProp,
|
|
74
|
+
inlineDiff,
|
|
75
|
+
inlineDiffMode,
|
|
76
|
+
language,
|
|
77
|
+
mode,
|
|
78
|
+
newLabel,
|
|
79
|
+
newText,
|
|
80
|
+
oldLabel,
|
|
81
|
+
oldText,
|
|
82
|
+
showLineNumbers,
|
|
83
|
+
theme
|
|
84
|
+
}: Props): ReactElement;
|
|
85
|
+
export { DiffView, DiffViewMode, type Props as DiffViewProps, InlineDiffMode, Props, DiffView as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var M=Object.defineProperty;var v=(r,i)=>M(r,"name",{value:i,configurable:!0});import{jsx as u,jsxs as g,Fragment as $}from"react/jsx-runtime";import{createPatch as V,parsePatch as W,diffWords as j,diffChars as B}from"diff";import{useMemo as k,useState as U,useRef as q,useEffect as A}from"react";import{r as E,i as F,P as J,g as K,a as O}from"../packem_shared/token-to-elements-BAZpNZsu.js";import R from"../ink/hooks/use-window-size.js";import{Box as p}from"./box.js";import{Text as a}from"./text.js";var X=Object.defineProperty,x=v((r,i)=>X(r,"name",{value:i,configurable:!0}),"y");const L=x((r,i,n,d)=>{if(!i||n===void 0||n<1||n>i.length)return d?u(a,{color:d,children:r}):u(a,{dimColor:!0,children:r});const o=i[n-1];return!o||o.length===0?d?u(a,{color:d,children:r}):u(a,{dimColor:!0,children:r}):O(o)},"renderHighlightedContent"),S=x((r,i,n)=>{const[d,o]=U(null),h=q(!1);return A(()=>{if(h.current=!1,!i){o(null);return}const e=E(i);if(!F(e)){o(null);return}return(async()=>{try{const f=await J([e],n),l=K(f,r,e,n);h.current||o(l.tokens)}catch{h.current||o(null)}})(),()=>{h.current=!0}},[r,i,n]),d},"useHighlightedLines"),z=x((r,i,n="chars")=>{const d=W(r),o=[];for(const h of d)for(const e of h.hunks){const f=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`,l=[];let s=e.oldStart,c=e.newStart;for(const w of e.lines)w.startsWith("\\")||(w.startsWith("+")?l.push({content:w.slice(1),newLineNum:c++,type:"add"}):w.startsWith("-")?l.push({content:w.slice(1),oldLineNum:s++,type:"del"}):l.push({content:w.slice(1),newLineNum:c++,oldLineNum:s++,type:"context"}));if(i){const w=Q(l);for(const[N,t]of w)if(l[N].type==="del"&&l[t].type==="add"){const m=G(l[N].content,l[t].content,n);l[N].inlineDiff=m??void 0,l[N].pairedIndex=t,l[t].inlineDiff=m??void 0,l[t].pairedIndex=N}}o.push({header:f,lines:l})}return o},"parseDiffLines"),P=500,G=x((r,i,n="chars")=>{if(r.length>P||i.length>P)return null;const d=n==="words"?j(r,i):B(r,i),o=[],h=[];for(const e of d)e.removed?o.push({highlight:!0,value:e.value}):e.added?h.push({highlight:!0,value:e.value}):(o.push({highlight:!1,value:e.value}),h.push({highlight:!1,value:e.value}));return{addParts:h,delParts:o}},"computeInlineDiff"),C=x((r,i,n)=>u($,{children:r.map((d,o)=>d.highlight?u(a,{backgroundColor:n,color:"white",children:d.value},o):u(a,{color:i,children:d.value},o))}),"renderInlineParts"),Q=x(r=>{const i=new Map;let n=0;for(;n<r.length;){const d=n;for(;n<r.length&&r[n].type==="del";)n++;const o=n,h=n;for(;n<r.length&&r[n].type==="add";)n++;const e=n,f=o-d,l=e-h,s=Math.min(f,l);for(let c=0;c<s;c++)i.set(d+c,h+c),i.set(h+c,d+c);n===d&&n++}return i},"findInlinePairs");function H({hunks:r,newHighlighted:i,oldHighlighted:n,showLineNumbers:d}){return u(p,{flexDirection:"column",children:r.map((o,h)=>g(p,{flexDirection:"column",children:[h>0?u(p,{marginBottom:0,marginTop:0,children:u(a,{dimColor:!0,children:"···"})}):void 0,u(a,{color:"cyan",dimColor:!0,children:o.header}),o.lines.map((e,f)=>{let l,s,c;switch(e.type){case"add":{s="+",c="green",l=e.inlineDiff?C(e.inlineDiff.addParts,"green","green"):L(e.content,i,e.newLineNum,"green");break}case"del":{s="-",c="red",l=e.inlineDiff?C(e.inlineDiff.delParts,"red","red"):L(e.content,n,e.oldLineNum,"red");break}default:{s=" ",c=void 0,l=L(e.content,n,e.oldLineNum);break}}return g(p,{children:[d?g(a,{color:c,dimColor:e.type==="context",children:[String(e.oldLineNum??"").padStart(4)," ",String(e.newLineNum??"").padStart(4)," "]}):void 0,u(a,{color:c,children:s}),l]},f)})]},h))})}v(H,"J");x(H,"UnifiedView");function I({hunks:r,newHighlighted:i,oldHighlighted:n,showLineNumbers:d,width:o}){const h=Math.floor(o/2)-1;return u(p,{flexDirection:"column",children:r.map((e,f)=>{const l=f>0?u(p,{marginBottom:0,marginTop:0,children:u(a,{dimColor:!0,children:"···"})}):void 0,s=[],c=[];for(let N=0;N<e.lines.length;N++){const t=e.lines[N];switch(t.type){case"add":{t.pairedIndex===void 0&&(s.push({content:u(a,{dimColor:!0})}),c.push({content:L(t.content,i,t.newLineNum,"green"),lineNum:t.newLineNum}));break}case"context":{s.push({content:L(t.content,n,t.oldLineNum),lineNum:t.oldLineNum}),c.push({content:L(t.content,i,t.newLineNum),lineNum:t.newLineNum});break}case"del":{if(t.pairedIndex===void 0)s.push({content:L(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),c.push({content:u(a,{dimColor:!0})});else{const m=e.lines[t.pairedIndex];s.push({content:t.inlineDiff?C(t.inlineDiff.delParts,"red","red"):L(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),c.push({content:m.inlineDiff?C(m.inlineDiff.addParts,"green","green"):L(m.content,i,m.newLineNum,"green"),lineNum:m.newLineNum})}break}}}const w=Math.max(s.length,c.length);return g(p,{flexDirection:"column",children:[l,u(a,{color:"cyan",dimColor:!0,children:e.header}),Array.from({length:w},(N,t)=>{const m=s[t],D=c[t];return g(p,{flexDirection:"row",children:[g(p,{width:h,children:[d?g(a,{dimColor:!0,children:[String(m?.lineNum??"").padStart(4)," "]}):void 0,m?.content]}),u(a,{dimColor:!0,children:"│"}),g(p,{width:h,children:[d?g(a,{dimColor:!0,children:[String(D?.lineNum??"").padStart(4)," "]}):void 0,D?.content]})]},t)})]},f)})})}v(I,"K");x(I,"SplitView");function Y({context:r=3,diff:i,inlineDiff:n=!0,inlineDiffMode:d="chars",language:o,mode:h="unified",newLabel:e="new",newText:f="",oldLabel:l="old",oldText:s="",showLineNumbers:c=!0,theme:w="github-dark-default"}){const{columns:N}=R(),t=S(s,o,w),m=S(f,o,w),D=k(()=>i||V("file",s,f,l,e,{context:r}),[i,s,f,l,e,r]),b=k(()=>z(D,n,d),[D,n,d]);if(b.every(T=>T.lines.length===0))return u(p,{children:u(a,{dimColor:!0,children:"No differences found."})});const y=g(p,{flexDirection:"column",children:[g(a,{color:"red",dimColor:!0,children:["---"," ",l]}),g(a,{color:"green",dimColor:!0,children:["+++"," ",e]})]});return h==="split"?g(p,{flexDirection:"column",children:[y,u(I,{hunks:b,newHighlighted:m,oldHighlighted:t,showLineNumbers:c,width:N??80})]}):g(p,{flexDirection:"column",children:[y,u(H,{hunks:b,newHighlighted:m,oldHighlighted:t,showLineNumbers:c})]})}v(Y,"S");x(Y,"DiffView");export{Y as DiffView,Y as default};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { A as AnsiColors } from "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Custom character to use instead of the default line character.
|
|
7
|
+
*/
|
|
8
|
+
readonly character?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Color of the divider line.
|
|
11
|
+
*/
|
|
12
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Render the divider with dim color.
|
|
15
|
+
*/
|
|
16
|
+
readonly dimColor?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional label rendered in the middle of a horizontal divider.
|
|
19
|
+
*/
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Padding around the label.
|
|
23
|
+
* @default 1
|
|
24
|
+
*/
|
|
25
|
+
readonly labelPadding?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Total length of the divider. When omitted, horizontal dividers stretch to
|
|
28
|
+
* fill the available space and vertical dividers default to one row.
|
|
29
|
+
*/
|
|
30
|
+
readonly length?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Orientation of the divider.
|
|
33
|
+
* @default "horizontal"
|
|
34
|
+
*/
|
|
35
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal or vertical divider line, optionally with a centered label.
|
|
39
|
+
*/
|
|
40
|
+
declare function Divider({
|
|
41
|
+
character,
|
|
42
|
+
color,
|
|
43
|
+
dimColor,
|
|
44
|
+
label,
|
|
45
|
+
labelPadding,
|
|
46
|
+
length,
|
|
47
|
+
orientation
|
|
48
|
+
}: Props): ReactElement;
|
|
49
|
+
export { Divider, type Props as DividerProps, Props, Divider as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var d=(l,r)=>w(l,"name",{value:r,configurable:!0});import{jsx as o,jsxs as p}from"react/jsx-runtime";import C from"../ink/hooks/use-window-size.js";import{Box as i}from"./box.js";import{Text as n}from"./text.js";var g=Object.defineProperty,b=d((l,r)=>g(l,"name",{value:r,configurable:!0}),"m");function G({character:l,color:r,dimColor:t=!1,label:h,labelPadding:u=1,length:e,orientation:m="horizontal"}){const{columns:s}=C(),a=l??(m==="horizontal"?"─":"│");if(m==="vertical"){const x=e??1;return o(i,{flexDirection:"column",height:x,children:Array.from({length:x},(j,v)=>o(n,{color:r,dimColor:t,children:a},`divider-row-${v}`))})}const c=Math.min(500,e??Math.max(s,1));if(h===void 0)return o(i,{flexGrow:e===void 0?1:0,width:e,children:o(n,{color:r,dimColor:t,wrap:"truncate",children:a.repeat(c)})});const f=" ".repeat(u);return p(i,{flexGrow:e===void 0?1:0,width:e,children:[o(i,{flexGrow:1,flexShrink:1,children:o(n,{color:r,dimColor:t,wrap:"truncate",children:a.repeat(c)})}),o(i,{flexShrink:0,children:p(n,{color:r,dimColor:t,children:[f,h,f]})}),o(i,{flexGrow:1,flexShrink:1,children:o(n,{color:r,dimColor:t,wrap:"truncate",children:a.repeat(c)})})]})}d(G,"u");b(G,"Divider");export{G as Divider,G as default};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A single entry (file or directory) returned by the file system hook.
|
|
4
|
+
*/
|
|
5
|
+
type FileEntry = {
|
|
6
|
+
readonly isDirectory: boolean;
|
|
7
|
+
readonly isHidden: boolean;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly permissions: string;
|
|
11
|
+
readonly size: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Filter options for the file picker.
|
|
15
|
+
*/
|
|
16
|
+
type FilePickerFilter = {
|
|
17
|
+
/**
|
|
18
|
+
* Allowed file extensions (e.g. `[".ts", ".tsx"]`). Empty or omitted means all.
|
|
19
|
+
*/
|
|
20
|
+
readonly extensions?: ReadonlyArray<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to include directories in the list.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
readonly showDirectories?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include regular files in the list.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
readonly showFiles?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to include hidden files (names starting with `.`).
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
readonly showHidden?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type Props = {
|
|
38
|
+
/**
|
|
39
|
+
* Color for the focused item highlight.
|
|
40
|
+
* @default "cyan"
|
|
41
|
+
*/
|
|
42
|
+
readonly accentColor?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Color for directory entries.
|
|
45
|
+
* @default "blue"
|
|
46
|
+
*/
|
|
47
|
+
readonly directoryColor?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Color for file entries.
|
|
50
|
+
* @default "white"
|
|
51
|
+
*/
|
|
52
|
+
readonly fileColor?: string;
|
|
53
|
+
/**
|
|
54
|
+
* File filter options.
|
|
55
|
+
*/
|
|
56
|
+
readonly filter?: FilePickerFilter;
|
|
57
|
+
/**
|
|
58
|
+
* Starting directory path.
|
|
59
|
+
* @default process.cwd()
|
|
60
|
+
*/
|
|
61
|
+
readonly initialPath?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether keyboard navigation is active.
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
readonly isFocused?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Maximum number of visible items (viewport height).
|
|
69
|
+
* @default 10
|
|
70
|
+
*/
|
|
71
|
+
readonly limit?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Called when escape is pressed.
|
|
74
|
+
*/
|
|
75
|
+
readonly onCancel?: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Called when a file is selected (enter on a file entry).
|
|
78
|
+
*/
|
|
79
|
+
readonly onSelect?: (entry: FileEntry) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Show file permissions column.
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
readonly showPermissions?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Show file size column.
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
readonly showSize?: boolean;
|
|
90
|
+
};
|
|
91
|
+
declare const FilePicker: ({
|
|
92
|
+
accentColor,
|
|
93
|
+
directoryColor,
|
|
94
|
+
fileColor,
|
|
95
|
+
filter,
|
|
96
|
+
initialPath,
|
|
97
|
+
isFocused,
|
|
98
|
+
limit,
|
|
99
|
+
onCancel,
|
|
100
|
+
onSelect,
|
|
101
|
+
showPermissions,
|
|
102
|
+
showSize
|
|
103
|
+
}: Props) => ReactElement;
|
|
104
|
+
export { type FileEntry, FilePicker, type FilePickerFilter, type Props as FilePickerProps, FilePicker as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as f,default as l}from"../packem_shared/FilePicker-tYj_CIau.js";export{f as FilePicker,l as default};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { A as AnsiColors } from "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type FormFieldProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The input element (TextInput, Checkbox, Select, …).
|
|
7
|
+
*/
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Optional helper text rendered beneath the input.
|
|
11
|
+
*/
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Validation error — dimmed red below the input.
|
|
15
|
+
*/
|
|
16
|
+
readonly error?: string;
|
|
17
|
+
/**
|
|
18
|
+
* When true, the field's label and description are dim.
|
|
19
|
+
*/
|
|
20
|
+
readonly isDisabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Label rendered above the input.
|
|
23
|
+
*/
|
|
24
|
+
readonly label: string;
|
|
25
|
+
/**
|
|
26
|
+
* Mark the field as required (adds a trailing `*`).
|
|
27
|
+
*/
|
|
28
|
+
readonly required?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Standard form field wrapper: label + input + helper/error.
|
|
32
|
+
*/
|
|
33
|
+
declare const FormField: ({
|
|
34
|
+
children,
|
|
35
|
+
description,
|
|
36
|
+
error,
|
|
37
|
+
isDisabled,
|
|
38
|
+
label,
|
|
39
|
+
required
|
|
40
|
+
}: FormFieldProps) => ReactElement;
|
|
41
|
+
type Props = {
|
|
42
|
+
/**
|
|
43
|
+
* Accent color for the form chrome.
|
|
44
|
+
* @default "blue"
|
|
45
|
+
*/
|
|
46
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
47
|
+
/**
|
|
48
|
+
* Render a border around the form.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
readonly bordered?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Fields composed via `<FormField />`.
|
|
54
|
+
*/
|
|
55
|
+
readonly children: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Optional description rendered under the title.
|
|
58
|
+
*/
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional footer rendered below the fields (buttons, hints, summary).
|
|
62
|
+
*/
|
|
63
|
+
readonly footer?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* Optional heading rendered at the top.
|
|
66
|
+
*/
|
|
67
|
+
readonly title?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Fixed width.
|
|
70
|
+
*/
|
|
71
|
+
readonly width?: number;
|
|
72
|
+
};
|
|
73
|
+
type FormComponent = ((props: Props) => ReactElement) & {
|
|
74
|
+
Field: typeof FormField;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Stateless form layout. Pair with the `useForm` hook for state management
|
|
78
|
+
* and `FormField` for consistent label/error styling.
|
|
79
|
+
*/
|
|
80
|
+
declare const Form: FormComponent;
|
|
81
|
+
export { Form, FormField, FormFieldProps, type Props as FormProps, Props, Form as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var s=(e,i)=>u(e,"name",{value:i,configurable:!0});import{jsxs as m,jsx as r}from"react/jsx-runtime";import{Box as o}from"./box.js";import{Text as d}from"./text.js";var f=Object.defineProperty,v=s((e,i)=>f(e,"name",{value:i,configurable:!0}),"s");const b=v(({children:e,description:i,error:l,isDisabled:n=!1,label:c,required:t=!1})=>m(o,{flexDirection:"column",marginBottom:1,children:[m(o,{children:[r(d,{bold:!0,dimColor:n,children:c}),t?r(d,{color:"red",children:" *"}):void 0]}),r(o,{marginTop:0,children:e}),l===void 0?i===void 0?void 0:r(d,{dimColor:!0,children:i}):r(d,{color:"red",children:l})]}),"FormField"),F=Object.assign(({accentColor:e="blue",bordered:i=!0,children:l,description:n,footer:c,title:t,width:a})=>{const h=m(o,{flexDirection:"column",children:[t===void 0?void 0:r(o,{marginBottom:1,children:r(d,{bold:!0,color:e,children:t})}),n===void 0?void 0:r(o,{marginBottom:1,children:r(d,{dimColor:!0,children:n})}),r(o,{flexDirection:"column",children:l}),c===void 0?void 0:r(o,{marginTop:1,children:c})]});return i?r(o,{borderColor:e,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:a,children:h}):r(o,{flexDirection:"column",width:a,children:h})},{Field:b});export{F as Form,b as FormField,F as default};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { A as AnsiColors } from "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type GaugeThreshold = {
|
|
5
|
+
/**
|
|
6
|
+
* Color used for the arc segment and, when the current value falls into
|
|
7
|
+
* this segment, for the value readout.
|
|
8
|
+
*/
|
|
9
|
+
readonly color: LiteralUnion<AnsiColors, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Optional label used by the legend under the gauge.
|
|
12
|
+
*/
|
|
13
|
+
readonly label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Upper bound of this threshold segment (inclusive). Segments are sorted
|
|
16
|
+
* ascending and painted in order.
|
|
17
|
+
*/
|
|
18
|
+
readonly max: number;
|
|
19
|
+
};
|
|
20
|
+
type GaugeSize = "large" | "medium" | "small";
|
|
21
|
+
type Props = {
|
|
22
|
+
/**
|
|
23
|
+
* Color of the arc background (the portion beyond `value`).
|
|
24
|
+
* @default "gray"
|
|
25
|
+
*/
|
|
26
|
+
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Format for the numeric readout. Defaults to rounding to an integer.
|
|
29
|
+
*/
|
|
30
|
+
readonly formatValue?: (value: number) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional label rendered above the readout.
|
|
33
|
+
*/
|
|
34
|
+
readonly label?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Upper bound of the range.
|
|
37
|
+
* @default 100
|
|
38
|
+
*/
|
|
39
|
+
readonly max?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Lower bound of the range.
|
|
42
|
+
* @default 0
|
|
43
|
+
*/
|
|
44
|
+
readonly min?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Show a legend listing thresholds below the gauge.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
readonly showLegend?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Show a numeric readout in the middle of the gauge.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
readonly showValue?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Overall dimension preset.
|
|
57
|
+
* @default "medium"
|
|
58
|
+
*/
|
|
59
|
+
readonly size?: GaugeSize;
|
|
60
|
+
/**
|
|
61
|
+
* Color threshold ramp. When provided, segments of the arc are painted in
|
|
62
|
+
* the corresponding colors and the value readout picks up the color for
|
|
63
|
+
* the segment `value` lands in.
|
|
64
|
+
*/
|
|
65
|
+
readonly thresholds?: ReadonlyArray<GaugeThreshold>;
|
|
66
|
+
/**
|
|
67
|
+
* Current value. Clamped into the `[min, max]` range.
|
|
68
|
+
*/
|
|
69
|
+
readonly value: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Semi-circular gauge rendered at 2x4 sub-cell resolution. Supports colored
|
|
73
|
+
* threshold segments and an optional needle.
|
|
74
|
+
*/
|
|
75
|
+
declare function Gauge({
|
|
76
|
+
backgroundColor,
|
|
77
|
+
formatValue,
|
|
78
|
+
label,
|
|
79
|
+
max,
|
|
80
|
+
min,
|
|
81
|
+
showLegend,
|
|
82
|
+
showValue,
|
|
83
|
+
size,
|
|
84
|
+
thresholds,
|
|
85
|
+
value
|
|
86
|
+
}: Props): ReactElement;
|
|
87
|
+
export { Gauge, type Props as GaugeProps, GaugeSize, GaugeThreshold, Props, Gauge as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Z=Object.defineProperty;var x=(o,e)=>Z(o,"name",{value:e,configurable:!0});import{jsxs as j,jsx as h}from"react/jsx-runtime";import{useMemo as A}from"react";import{c as _}from"../packem_shared/braille-BBjIoaN0.js";import{Box as d}from"./box.js";import{Canvas as $}from"./canvas.js";import{Text as w}from"./text.js";var q=Object.defineProperty,v=x((o,e)=>q(o,"name",{value:e,configurable:!0}),"f");const J={large:{cols:40,rows:10},medium:{cols:24,rows:6},small:{cols:16,rows:4}},R=.9,oo=2,ro=v(o=>String(Math.round(o)),"defaultFormat"),G=v((o,e,s,a)=>{const t=e+(s-e)*a;for(const f of o)if(t<=f.max)return f;return o[o.length-1]},"thresholdAtRatio");function to({backgroundColor:o="gray",formatValue:e=ro,label:s,max:a=100,min:t=0,showLegend:f=!1,showValue:P=!0,size:B="medium",thresholds:n,value:D}){const{cols:O,rows:T}=J[B],F=Math.max(t,Math.min(a,D)),E=a-t||1,M=(F-t)/E,m=A(()=>{if(!(n===void 0||n.length===0))return[...n].toSorted((r,c)=>r.max-c.max)},[n]),I=A(()=>{if(m!==void 0)return G(m,t,a,M)},[m,t,a,M]),H=e(F);return j(d,{flexDirection:"column",children:[h($,{draw:x(r=>{r.clear();const c=r.width*2,L=r.height*4,y=c/2,C=L-1,K=c/2-1,N=L-1,g=Math.max(1,Math.min(K,N)),b=new Map,S=v(i=>{const l=b.get(i);if(l!==void 0)return l;const u=_(r.width,r.height);return b.set(i,u),u},"gridFor"),V=Math.max(32,Math.round(Math.PI*g)*oo);for(let i=0;i<=V;i+=1){const l=i/V,u=Math.PI*(1-l),X=Math.round(y+g*Math.cos(u)),Y=Math.round(C-g*Math.sin(u));let p;l>M?p=o:m?p=G(m,t,a,l)?.color??"cyan":p="cyan",S(p).plotPoint(X,Y)}const k=g*R,z=Math.PI*(1-M),Q=Math.round(y+k*Math.cos(z)),U=Math.round(C-k*Math.sin(z)),W=I?.color??"white";S(W).plotLine(Math.round(y),Math.round(C),Q,U);for(const[i,l]of b)l.flush(r,{color:i})},"draw"),height:T,version:[D,t,a,B,n,o],width:O}),P||s?j(d,{flexDirection:"column",children:[s===void 0?void 0:h(d,{justifyContent:"center",children:h(w,{dimColor:!0,children:s})}),P?h(d,{justifyContent:"center",children:h(w,{bold:!0,color:I?.color??"white",children:H})}):void 0]}):void 0,f&&n&&n.length>0?h(d,{gap:2,justifyContent:"center",marginTop:1,children:n.map((r,c)=>j(d,{gap:1,children:[h(w,{color:r.color,children:"●"}),h(w,{dimColor:!0,children:r.label??`≤ ${r.max}`})]},c))}):void 0]})}x(to,"j");v(to,"Gauge");export{to as Gauge,to as default};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
type ColorValueHex = `#${string}`;
|
|
3
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
4
|
+
type StopInput = {
|
|
5
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
6
|
+
colorLess?: boolean;
|
|
7
|
+
position: number;
|
|
8
|
+
};
|
|
9
|
+
type RGB = {
|
|
10
|
+
b: number;
|
|
11
|
+
g: number;
|
|
12
|
+
r: number;
|
|
13
|
+
};
|
|
14
|
+
declare const multilineGradient: (stops: (ColorValueHex | CssColorName | RGB | StopInput | [number, number, number])[], options?: {
|
|
15
|
+
hsvSpin?: "long" | "short";
|
|
16
|
+
interpolation?: "hsv" | "rgb";
|
|
17
|
+
loop?: boolean;
|
|
18
|
+
reverse?: boolean;
|
|
19
|
+
}) => (string_: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* A color stop for the gradient — hex string, CSS color name, RGB tuple, RGB object, or positioned stop.
|
|
22
|
+
*/
|
|
23
|
+
type GradientStop = Parameters<typeof multilineGradient>[0][number];
|
|
24
|
+
/**
|
|
25
|
+
* Built-in gradient presets.
|
|
26
|
+
*/
|
|
27
|
+
type GradientName = "atlas" | "cristal" | "fruit" | "instagram" | "mind" | "morning" | "pastel" | "passion" | "rainbow" | "retro" | "summer" | "teen" | "vice";
|
|
28
|
+
/**
|
|
29
|
+
* Custom gradient colors — an array of color stops accepted by `@visulima/colorize`'s gradient API.
|
|
30
|
+
*/
|
|
31
|
+
type GradientColors = GradientStop[];
|
|
32
|
+
type Props = {
|
|
33
|
+
/**
|
|
34
|
+
* The content to colorize.
|
|
35
|
+
*
|
|
36
|
+
* Multiple `<Text>` children are treated as separate nodes, which preserves layout when `<Gradient>` is placed inside a `<Box flexDirection="column">`.
|
|
37
|
+
*
|
|
38
|
+
* If you want a continuous gradient across multiple lines, pass a single string or a single `<Text>` with `\n`.
|
|
39
|
+
*/
|
|
40
|
+
readonly children: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* [Colors to use to make the gradient.](https://visulima.com/packages/colorize)
|
|
43
|
+
*
|
|
44
|
+
* Mutually exclusive with `name`.
|
|
45
|
+
*/
|
|
46
|
+
readonly colors?: GradientColors;
|
|
47
|
+
/**
|
|
48
|
+
* The name of a built-in gradient preset.
|
|
49
|
+
*
|
|
50
|
+
* Mutually exclusive with `colors`.
|
|
51
|
+
*/
|
|
52
|
+
readonly name?: GradientName;
|
|
53
|
+
};
|
|
54
|
+
declare function Gradient({
|
|
55
|
+
children,
|
|
56
|
+
colors,
|
|
57
|
+
name
|
|
58
|
+
}: Props): ReactElement | null;
|
|
59
|
+
export { Gradient, type GradientColors, type GradientName, type Props as GradientProps, Props, Gradient as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var ke=Object.defineProperty;var $=(e,r)=>ke(e,"name",{value:r,configurable:!0});import{jsx as S,Fragment as Oe}from"react/jsx-runtime";import{s as Be}from"../packem_shared/strip-C6HQYmlg.js";import{B as je}from"../packem_shared/colorize-gy_cY-wC.js";import{useMemo as Se,Children as q,isValidElement as he,cloneElement as C}from"react";import{Box as ge}from"./box.js";import{Text as W}from"./text.js";import{Transform as G}from"./transform.js";var xe=Object.defineProperty,Pe=$((e,r)=>xe(e,"name",{value:r,configurable:!0}),"b$3"),Me=Object.defineProperty,Ee=Pe((e,r)=>Me(e,"name",{value:r,configurable:!0}),"s"),Ne=Object.defineProperty,Re=Ee((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"a");const Ae=/([a-f\d]{3,6})/i,I=Re(e=>{let[,r]=Ae.exec(e)??[];const o=r?r.length:0;if(o===3){const t=r.charAt(0),s=r.charAt(1),i=r.charAt(2);r=t+t+s+s+i+i}else if(o!==6)return[0,0,0];const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,n&255]},"convertHexToRgb");var Te=Object.defineProperty,Ce=$((e,r)=>Te(e,"name",{value:r,configurable:!0}),"o$2"),Ge=Object.defineProperty,qe=Ce((e,r)=>Ge(e,"name",{value:r,configurable:!0}),"s"),Ie=Object.defineProperty,V=qe((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"e");const pe=V((e,r,o)=>e===r&&r===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(r/51)+Math.round(o/51),"rgbToAnsi256"),H=V(e=>{let r,o,n;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)r=o=n=((e-232)*10+8)/255;else{e-=16;const i=e%36;r=Math.floor(e/36)/5,o=Math.floor(i/6)/5,n=i%6/5}const t=Math.max(r,o,n)*2;if(t===0)return 30;const s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));return t===2?s+60:s},"ansi256To16"),Z=V((e,r,o)=>H(pe(e,r,o)),"rgbToAnsi16");var He=Object.defineProperty,fe=$((e,r)=>He(e,"name",{value:r,configurable:!0}),"m$2"),ze=Object.defineProperty,B=fe((e,r)=>ze(e,"name",{value:r,configurable:!0}),"u"),Fe=Object.defineProperty,Le=B((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"e");function A({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}$(A,"$$1");fe(A,"j");B(A,"t$1");Le(A,"ansiRegex");var De=Object.defineProperty,Ke=B((e,r)=>De(e,"name",{value:r,configurable:!0}),"n$1");const k=Ke((e,r,o)=>r>e?r:Math.min(e,o),"clamp");var Ye=Object.defineProperty,m=B((e,r)=>Ye(e,"name",{value:r,configurable:!0}),"b");const b=39,d=49,J=10,z=je(),be={close:"",open:""},a=z>0?(e,r)=>({close:`\x1B[${String(r)}m`,open:`\x1B[${String(e)}m`}):()=>be,Q=m(e=>(r,o,n)=>e(pe(Number(r),Number(o),Number(n))),"createRgbFunction"),U=m(e=>r=>{const[o,n,t]=I(r);return e(o,n,t)},"createHexFunction");let F=m(e=>a(`38;5;${String(e)}`,b),"createAnsi256"),L=m(e=>a(`48;5;${String(e)}`,d),"createBgAnsi256"),N=m((e,r,o)=>a(`38;2;${String(e)};${String(r)};${String(o)}`,b),"createRgb"),R=m((e,r,o)=>a(`48;2;${String(e)};${String(r)};${String(o)}`,d),"createBgRgb");z===1?(F=m(e=>a(H(Number(e)),b),"createAnsi256"),L=m(e=>a(H(Number(e))+J,d),"createBgAnsi256"),N=m((e,r,o)=>a(Z(Number(e),Number(r),Number(o)),b),"createRgb"),R=m((e,r,o)=>a(Z(Number(e),Number(r),Number(o))+J,d),"createBgRgb")):z===2&&(N=Q(F),R=Q(L));const X={bold:a(1,22),dim:a(2,22),hidden:a(8,28),inverse:a(7,27),italic:a(3,23),overline:a(53,55),reset:a(0,0),strike:a(9,29),strikethrough:a(9,29),underline:a(4,24),visible:be},_={bgBlack:a(40,d),bgBlackBright:a(100,d),bgBlue:a(44,d),bgBlueBright:a(104,d),bgCyan:a(46,d),bgCyanBright:a(106,d),bgGray:a(100,d),bgGreen:a(42,d),bgGreenBright:a(102,d),bgGrey:a(100,d),bgMagenta:a(45,d),bgMagentaBright:a(105,d),bgRed:a(41,d),bgRedBright:a(101,d),bgWhite:a(47,d),bgWhiteBright:a(107,d),bgYellow:a(43,d),bgYellowBright:a(103,d),black:a(30,b),blackBright:a(90,b),blue:a(34,b),blueBright:a(94,b),cyan:a(36,b),cyanBright:a(96,b),gray:a(90,b),green:a(32,b),greenBright:a(92,b),grey:a(90,b),magenta:a(35,b),magentaBright:a(95,b),red:a(31,b),redBright:a(91,b),white:a(37,b),whiteBright:a(97,b),yellow:a(33,b),yellowBright:a(93,b)},ee={bg:m(e=>L(k(e,0,255)),"bg"),bgHex:U(R),bgRgb:m((e,r,o)=>R(k(e,0,255),k(r,0,255),k(o,0,255)),"bgRgb"),fg:m(e=>F(k(e,0,255)),"fg"),hex:U(N),rgb:m((e,r,o)=>N(k(e,0,255),k(r,0,255),k(o,0,255)),"rgb")};var Ve=Object.defineProperty,We=B((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const Ze=We((e,r,o)=>{if(r==="")return e;let n=e.indexOf(r);if(n<0)return e;const t=r.length;let s=0,i="";for(;~n;)i+=e.slice(s,n)+o,s=n+t,n=e.indexOf(r,s);return i+e.slice(s)},"stringReplaceAll");var Je=Object.defineProperty,x=B((e,r)=>Je(e,"name",{value:r,configurable:!0}),"a");const O={};let D=null;const Qe=x((e,r,o)=>{if(!e)return"";let n;if(e.raw===void 0?n=String(e):n=String.raw(e,...r),n.includes("\x1B"))for(let t=o;t;t=t.props)n=Ze(n,t.close,t.open);return n.includes(`
|
|
2
|
+
`)&&(n=n.replace(/(\r*\n)/g,`${o.closeStack}$1${o.openStack}`)),o.openStack+n+o.closeStack},"wrapText"),K=x(({props:e},{close:r,open:o})=>{const n=(e?.openStack??"")+o,t=r+(e?.closeStack??""),s=x((i,...u)=>Qe(i,u,s.props),"style");return Object.setPrototypeOf(s,D),s.props={close:r,closeStack:t,open:o,openStack:n,props:e},s.open=n,s.close=t,s},"createStyle"),Ue=x(function(){const e=x(r=>String(r),"self");e.strip=r=>r.replaceAll(A(),"");for(const r in _)O[r]={get(){const o=K(this,_[r]);return Object.defineProperty(this,r,{value:o}),o}};for(const r in X)O[r]={get(){const o=K(this,X[r]);return Object.defineProperty(this,r,{value:o}),o}};return D=Object.defineProperties({},O),Object.setPrototypeOf(e,D),e},"Colorize");for(const e in ee)O[e]={get(){return(...r)=>K(this,ee[e](...r))}};O.ansi256=O.fg;O.bgAnsi256=O.bg;var Xe=Object.defineProperty,de=$((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"y$1"),_e=Object.defineProperty,j=de((e,r)=>_e(e,"name",{value:r,configurable:!0}),"u");const re={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var er=Object.defineProperty,rr=j((e,r)=>er(e,"name",{value:r,configurable:!0}),"i");const oe=rr((e,r)=>{const o=e.length;if(r=Number.parseInt(r.toString(),10),Number.isNaN(r)||r<2)throw new Error("Invalid number of steps (< 2)");if(r<o)throw new Error("Number of steps cannot be inferior to number of stops");const n=[];for(let s=1;s<o;s+=1){const i=(r-1)*(e[s].position-e[s-1].position);n.push(Math.max(1,Math.round(i)))}let t=1;for(let s=o-2;s>=0;s-=1)t+=n[s];for(;t!==r;)if(t<r){const s=Math.min(...n),i=n.indexOf(s);n[i]=n[i]+1,t+=1}else{const s=Math.max(...n),i=n.indexOf(s);n[i]=n[i]-1,t-=1}return n},"computeSubSteps");var or=Object.defineProperty,tr=j((e,r)=>or(e,"name",{value:r,configurable:!0}),"c$1");const nr=tr((e,r,o)=>{let n=0,t=0,s=0;const i=Math.floor(e/60),u=e/60-i,c=o*(1-r),h=o*(1-u*r),l=o*(1-(1-u)*r);return i%6===0?(n=o,t=l,s=c):i%6===1?(n=h,t=o,s=c):i%6===2?(n=c,t=o,s=l):i%6===3?(n=c,t=h,s=o):i%6===4?(n=l,t=c,s=o):i%6===5&&(n=o,t=c,s=h),{b:Math.round(s*255),g:Math.round(t*255),r:Math.round(n*255)}},"hsvToRgb");var sr=Object.defineProperty,te=j((e,r)=>sr(e,"name",{value:r,configurable:!0}),"b");const ne=te(({b:e,g:r,r:o})=>{let n,t,s,i=0,u=0;o/=255,r/=255,e/=255;const c=Math.max(o,r,e),h=c-Math.min(o,r,e),l=te(p=>(c-p)/6/h+1/2,"diffc");return h!==0&&(u=h/c,n=l(o),t=l(r),s=l(e),c===o?i=s-t:c===r?i=.3333333333333333+n-s:c===e&&(i=.6666666666666666+t-n),i<0?i+=1:i>1&&(i-=1)),{h:i*360,s:u,v:c}},"rgbToHsv");var ir=Object.defineProperty,T=j((e,r)=>ir(e,"name",{value:r,configurable:!0}),"c");const ar={b:256,g:256,r:256},lr={h:360,s:1,v:1},me=T((e,r,o)=>{const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=o===0?0:(r[t]-e[t])/o);return n},"calculateStepSize"),ve=T((e,r,o,n)=>{const t={};for(const s in r)if(Object.hasOwn(r,s)){let i=e[s]*o+r[s];i<0?i+=n[s]:n[s]!==1&&(i%=n[s]),t[s]=i}return t},"interpolate"),Y=T((e,r,o)=>{const n={b:e.color[2],g:e.color[1],r:e.color[0]},t={b:r.color[2],g:r.color[1],r:r.color[0]},s=me(n,t,o),i=[{...n}];for(let u=1;u<o;u+=1){const c=ve(s,n,u,ar);i.push({b:Math.floor(c.b),g:Math.floor(c.g),r:Math.floor(c.r)})}return i},"interpolateRgb"),se=T((e,r,o,n)=>{const t=ne({b:e.color[2],g:e.color[1],r:e.color[0]}),s=ne({b:r.color[2],g:r.color[1],r:r.color[0]});if(t.s===0||s.s===0)return Y(e,r,o);let i;if(typeof n=="boolean")i=n;else{const l=t.h<s.h&&s.h-t.h<180||t.h>s.h&&t.h-s.h>180;i=n==="long"&&l||n==="short"&&!l}const u=me(t,s,o),c=[{b:e.color[2],g:e.color[1],r:e.color[0]}];let h;t.h<=s.h&&!i||t.h>=s.h&&i?h=s.h-t.h:i?h=360-s.h+t.h:h=360-t.h+s.h,u.h=(-1)**(i?1:0)*Math.abs(h)/o;for(let l=1;l<o;l+=1){const p=ve(u,t,l,lr);c.push(nr(p.h,p.s,p.v))}return c},"interpolateHsv");var cr=Object.defineProperty,ur=j((e,r)=>cr(e,"name",{value:r,configurable:!0}),"d");class P{static{$(this,"f")}static{de(this,"v")}static{j(this,"GradientBuilder")}static{ur(this,"GradientBuilder")}#e;stops;constructor(r,o){if(this.#e=r,this.stops=[],o.length<2)throw new Error("Invalid number of stops (< 2)");const n=o[0].position!==void 0;let t=o.length,s=-1,i=!1;for(const[h,l]of o.entries()){let p;const w=l.position!==void 0;if(n!==w)throw new Error("Cannot mix positioned and non-positioned color stops");if(w){const f=l,g=f.color!==void 0;if(!g&&(i||h===0||h===t-1))throw new Error("Cannot define two consecutive position-only stops");i=!g;let v;if(g&&(Array.isArray(f.color)?v=f.color:typeof f.color=="string"?v=f.color.includes("#")?I(f.color):re[f.color]:f.color&&"r"in f.color&&"g"in f.color&&"b"in f.color&&(v=[f.color.r,f.color.g,f.color.b])),p={color:v,colorLess:!g,position:f.position},p.position<0||p.position>1)throw new Error("Color stops positions must be between 0 and 1");if(p.position<s)throw new Error("Color stops positions are not ordered");s=p.position}else if(Array.isArray(l))p={color:l,position:h/(t-1)};else if(typeof l=="string")p={color:l.includes("#")?I(l):re[l],position:h/(t-1)};else if(l?.r!==void 0&&l?.g!==void 0&&l?.b!==void 0)p={color:[l.r,l.g,l.b],position:h/(t-1)};else throw new Error("Invalid color stop");this.stops.push(p)}const u=this.stops[0];u.position!==0&&(this.stops.unshift({color:u.color,position:0}),t+=1);const c=this.stops[t-1];c.position!==1&&this.stops.push({color:c.color,position:1})}reverse(){const r=[];for(const o of this.stops){const n={...o,position:1-o.position};r.push(n)}return new P(this.#e,r.toReversed())}loop(){const r=[],o=[];for(const n of this.stops)r.push({color:n.color,position:(n.position||0)/2});for(const n of this.stops.slice(0,-1))o.push({color:n.color,position:1-(n.position||0)/2});return new P(this.#e,[...r,...o.toReversed()])}rgb(r){const o=oe(this.stops,r),n=[];this.stops.forEach((t,s)=>{if(t.colorLess){const i=Y(this.stops[s-1],this.stops[s+1],2);t.color=[i[1].r,i[1].g,i[1].b]}});for(let t=0,s=this.stops.length;t<s-1;t+=1){const i=Y(this.stops[t],this.stops[t+1],o[t]);n.splice(n.length,0,...i.map(u=>this.#e.rgb(u.r,u.g,u.b)))}return n.push(this.#e.rgb(...this.stops.at(-1).color)),n}hsv(r,o=!1){const n=oe(this.stops,r),t=[];this.stops.forEach((s,i)=>{if(s.colorLess){const u=se(this.stops[i-1],this.stops[i+1],2,o);s.color=[u[1].r,u[1].g,u[1].b]}});for(let s=0,i=this.stops.length;s<i-1;s+=1){const u=se(this.stops[s],this.stops[s+1],n[s],o);t.splice(t.length,0,...u.map(c=>this.#e.rgb(c.r,c.g,c.b)))}return t.push(this.#e.rgb(...this.stops.at(-1).color)),t}}var hr=Object.defineProperty,gr=$((e,r)=>hr(e,"name",{value:r,configurable:!0}),"u"),pr=Object.defineProperty,fr=gr((e,r)=>pr(e,"name",{value:r,configurable:!0}),"u"),br=Object.defineProperty,ye=fr((e,r)=>br(e,"name",{value:r,configurable:!0}),"h");const we=new Ue,dr=/\s/g,$e=/\s/;ye((e,r)=>{const{hsvSpin:o="short",interpolation:n="rgb"}=r??{};let t=new P(we,e);return r?.loop?t=t.loop():r?.reverse&&(t=t.reverse()),s=>{const i=s.replaceAll(dr,""),u=Math.max(i.length,t.stops.length),c=n==="rgb"?t.rgb(u):t.hsv(u,o);let h="";for(const l of s)if($e.test(l))h+=l;else{const p=c.shift();h+=p(l)}return h}},"gradient");const ie=ye((e,r)=>{const{hsvSpin:o="short",interpolation:n="rgb"}=r??{};let t=new P(we,e);return r?.loop?t=t.loop():r?.reverse&&(t=t.reverse()),s=>{const i=s.split(`
|
|
3
|
+
`),u=Reflect.apply(Math.max,void 0,[...i.map(l=>l.length),t.stops.length]),c=n==="rgb"?t.rgb(u):t.hsv(u,o),h=[];for(const l of i){const p=[...c];let w="";for(const f of l)w+=$e.test(f)?f:p.shift()(f);h.push(w)}return h.join(`
|
|
4
|
+
`)}},"multilineGradient");var mr=Object.defineProperty,y=$((e,r)=>mr(e,"name",{value:r,configurable:!0}),"o");const ae={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"]},cristal:{colors:["#bdfff3","#4ac29a"]},fruit:{colors:["#ff4e50","#f9d423"]},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"]},mind:{colors:["#473b7b","#3584a7","#30d2be"]},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"]},pastel:{colors:["#74ebd5","#74ecd5"],options:{hsvSpin:"long",interpolation:"hsv"}},rainbow:{colors:["#ff0000","#ff0100"],options:{hsvSpin:"long",interpolation:"hsv"}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"]},summer:{colors:["#fdbb2d","#22c1c3"]},teen:{colors:["#77a1d3","#79cbca","#e684ae"]},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}}},le=y(e=>{let r=!1;const o=y(n=>{q.forEach(n,t=>{if(r||!he(t))return;if(t.type===ge){r=!0;return}const s=t.props;Object.hasOwn(s,"children")&&o(s.children)})},"search");return o(e),r},"containsBoxDescendant"),ce=y(e=>Object.hasOwn(e,"children"),"hasChildrenProp"),ue=y(e=>typeof e=="string"||typeof e=="number","isPlainTextNode"),vr=y(e=>e==null||typeof e=="boolean","isNonRenderableChild");function yr({children:e,colors:r,name:o}){if(o&&r)throw new Error("The `name` and `colors` props are mutually exclusive");if(!o&&!r)throw new Error("Either `name` or `colors` prop must be provided");const n=Se(()=>o?ie(ae[o].colors,ae[o].options):ie(r??[]),[o,r]),t=y(u=>n(Be(u)),"applyGradient"),s=q.count(e);if(ue(e))return S(G,{transform:t,children:e});if(s===1&&!le(e))return S(G,{transform:t,children:e});const i=y(u=>{const c=[];let h="",l=0;const p=y(()=>{const g=`gradient-node-${String(l)}`;return l+=1,g},"createKey"),w=y((g,v)=>{c.push(S(G,{transform:t,children:g},v))},"pushTransformed"),f=y(()=>{if(h==="")return;const g=h;h="",w(S(W,{children:g}),p())},"flushText");return q.forEach(u,g=>{if(!vr(g)){if(ue(g)){h+=String(g);return}if(f(),he(g)){const v=g.key??p(),M=g.props;if(g.type===W){w(g,v);return}if(g.type===ge){if(ce(M)){const E=M.children;c.push(C(g,{key:v},i(E)));return}c.push(C(g,{key:v}));return}if(ce(M)){const E=M.children;if(!le(E)){w(g,v);return}c.push(C(g,{key:v},i(E)));return}w(g,v);return}c.push(g)}}),f(),c},"applyGradientToChildren");return S(Oe,{children:i(e)})}$(yr,"K");y(yr,"Gradient");export{yr as Gradient,yr as default};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { A as AnsiColors } from "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
type Props = {
|
|
6
|
+
/**
|
|
7
|
+
* Heading content.
|
|
8
|
+
*/
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Explicit color. By default the color is derived from the level.
|
|
12
|
+
*/
|
|
13
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Heading level controls decoration and color.
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
readonly level?: HeadingLevel;
|
|
19
|
+
/**
|
|
20
|
+
* When true, renders an underline on a second line.
|
|
21
|
+
*/
|
|
22
|
+
readonly underline?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Semantic heading with level-based styling.
|
|
26
|
+
*/
|
|
27
|
+
declare function Heading({
|
|
28
|
+
children,
|
|
29
|
+
color,
|
|
30
|
+
level,
|
|
31
|
+
underline
|
|
32
|
+
}: Props): ReactElement;
|
|
33
|
+
export { Heading, HeadingLevel, type Props as HeadingProps, Props, Heading as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty;var o=(e,r)=>l(e,"name",{value:r,configurable:!0});import{jsx as a,jsxs as c}from"react/jsx-runtime";import{Box as s}from"./box.js";import{Text as d}from"./text.js";var u=Object.defineProperty,f=o((e,r)=>u(e,"name",{value:r,configurable:!0}),"t");const g={1:"blueBright",2:"cyanBright",3:"magentaBright",4:"yellowBright",5:"green",6:"white"},m={1:"# ",2:"## ",3:"### ",4:"#### ",5:"##### ",6:"###### "};function h({children:e,color:r,level:n=1,underline:t=!1}){const i=r??g[n];return a(s,{flexDirection:"column",children:c(d,{bold:n<=2,color:i,underline:t,children:[m[n],e]})})}o(h,"n");f(h,"Heading");export{h as Heading,h as default};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { A as AnsiColors } from "../packem_shared/index.server.d-eZWyC2Ku.js";
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type HeatmapProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Width of each cell in character columns.
|
|
7
|
+
* @default 2
|
|
8
|
+
*/
|
|
9
|
+
readonly cellWidth?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Glyph used to paint each heatmap cell. Defaults to `█` so the
|
|
12
|
+
* background color fills the cell.
|
|
13
|
+
* @default "█" (full block)
|
|
14
|
+
*/
|
|
15
|
+
readonly character?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Column labels rendered below the grid.
|
|
18
|
+
*/
|
|
19
|
+
readonly columnLabels?: ReadonlyArray<string>;
|
|
20
|
+
/**
|
|
21
|
+
* 2D matrix, rows × cols.
|
|
22
|
+
*/
|
|
23
|
+
readonly data: ReadonlyArray<ReadonlyArray<number>>;
|
|
24
|
+
/**
|
|
25
|
+
* Fixed maximum (for consistent scales across multiple heatmaps).
|
|
26
|
+
*/
|
|
27
|
+
readonly max?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Fixed minimum.
|
|
30
|
+
*/
|
|
31
|
+
readonly min?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Color palette, lowest-to-highest intensity. Values are mapped into the
|
|
34
|
+
* palette by their position in the [min, max] range.
|
|
35
|
+
* @default ["#0b1e4f", "#1f3b96", "#3258c8", "#4e84ec", "#78b0ff"]
|
|
36
|
+
*/
|
|
37
|
+
readonly palette?: ReadonlyArray<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Row labels rendered to the left of the grid.
|
|
40
|
+
*/
|
|
41
|
+
readonly rowLabels?: ReadonlyArray<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Foreground color override (rarely needed since the character is a full block).
|
|
44
|
+
*/
|
|
45
|
+
readonly textColor?: LiteralUnion<AnsiColors, string>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 2D heatmap. Each cell's background color is derived from its value's
|
|
49
|
+
* position in the [min, max] range mapped into `palette`.
|
|
50
|
+
*/
|
|
51
|
+
declare function Heatmap({
|
|
52
|
+
cellWidth,
|
|
53
|
+
character,
|
|
54
|
+
columnLabels,
|
|
55
|
+
data,
|
|
56
|
+
max: maxOverride,
|
|
57
|
+
min: minOverride,
|
|
58
|
+
palette,
|
|
59
|
+
rowLabels,
|
|
60
|
+
textColor
|
|
61
|
+
}: HeatmapProps): ReactElement;
|
|
62
|
+
export { Heatmap, HeatmapProps, Heatmap as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=Object.defineProperty;var v=(r,l)=>T(r,"name",{value:l,configurable:!0});import{jsxs as j,jsx as c}from"react/jsx-runtime";import{useMemo as k}from"react";import{Box as s}from"./box.js";import{Canvas as B}from"./canvas.js";import{Text as y}from"./text.js";var E=Object.defineProperty,O=v((r,l)=>E(r,"name",{value:l,configurable:!0}),"A");const P=["#0b1e4f","#1f3b96","#3258c8","#4e84ec","#78b0ff"];function R({cellWidth:r=2,character:l="█",columnLabels:g,data:n,max:d,min:m,palette:x=P,rowLabels:w,textColor:D}){const{cols:C,colWidth:f,extent:L,rows:p}=k(()=>{const t=n.length,e=n.reduce((a,o)=>Math.max(a,o.length),0);let i=m??1/0,h=d??-1/0;if(m===void 0||d===void 0)for(const a of n)for(const o of a)m===void 0&&o<i&&(i=o),d===void 0&&o>h&&(h=o);return{cols:e,colWidth:r,extent:{max:h,min:i},rows:t}},[n,m,d,r]),W=C*f,A=p;return j(s,{children:[w===void 0?void 0:c(s,{flexDirection:"column",marginRight:1,children:Array.from({length:p},(t,e)=>c(y,{dimColor:!0,children:w[e]??""},e))}),j(s,{flexDirection:"column",children:[c(B,{draw:v(t=>{t.clear();const{max:e,min:i}=L,h=e-i||1,a=x.length-1;for(let o=0;o<p;o+=1)for(let u=0;u<C;u+=1){const M=n[o]?.[u],H=M===void 0?void 0:x[Math.max(0,Math.min(a,Math.round((M-i)/h*a)))];for(let b=0;b<f;b+=1)t.setCell(u*f+b,o,l,{background:H,color:D})}},"draw"),height:A,version:[n,x,r,m,d],width:W}),g===void 0?void 0:c(s,{children:g.map((t,e)=>c(s,{width:f,children:c(y,{dimColor:!0,wrap:"truncate-end",children:t})},e))})]})]})}v(R,"T");O(R,"Heatmap");export{R as Heatmap,R as default};
|