@visulima/tui 1.0.8 → 2.0.1
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 +4 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +26 -27
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +40 -46
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +6 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +10 -42
- package/dist/components/static.d.ts +13 -14
- package/dist/components/text.d.ts +34 -48
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -12
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -34
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +7 -7
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +19 -20
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +110 -123
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +7 -8
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +44 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CuCo-R-l.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -179
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +152 -152
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -36,7 +36,7 @@ type UseTextBufferResult = {
|
|
|
36
36
|
readonly value: string;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
|
-
* Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
|
|
40
|
-
*/
|
|
39
|
+
* Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
|
|
40
|
+
*/
|
|
41
41
|
declare const useTextBuffer: (initialValue?: string) => UseTextBufferResult;
|
|
42
42
|
export { CursorPosition, TextBufferState, UseTextBufferResult, useTextBuffer as default, useTextBuffer };
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { D as DOMElement } from "../../packem_shared/dom.d-
|
|
3
|
-
import { S as Selection } from "../../packem_shared/selection.d-
|
|
2
|
+
import { D as DOMElement } from "../../packem_shared/dom.d-CLGlidfI.js";
|
|
3
|
+
import { S as Selection } from "../../packem_shared/selection.d-BSAWa4ey.js";
|
|
4
4
|
import 'yoga-layout';
|
|
5
|
-
import "
|
|
5
|
+
import "../public/cursor.js";
|
|
6
6
|
import '@visulima/colorize';
|
|
7
|
-
import
|
|
8
|
-
import "../../packem_shared/styles.d-cMo36xQz.js";
|
|
7
|
+
import "../../packem_shared/styles.d-CKGQFfm4.js";
|
|
9
8
|
import 'type-fest';
|
|
10
9
|
type UseTextSelectionOptions = {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
* Automatically copy selected text to clipboard when selection changes.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
15
14
|
readonly copyOnSelect?: boolean;
|
|
16
15
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
* Enable or disable text selection.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
20
19
|
readonly isActive?: boolean;
|
|
21
20
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
* Called whenever the selection changes.
|
|
22
|
+
*/
|
|
24
23
|
readonly onSelectionChange?: (selectedText: string) => void;
|
|
25
24
|
};
|
|
26
25
|
type UseTextSelectionResult = {
|
|
@@ -34,12 +33,12 @@ type UseTextSelectionResult = {
|
|
|
34
33
|
readonly selection: Selection;
|
|
35
34
|
};
|
|
36
35
|
/**
|
|
37
|
-
* Hook for managing text selection on a DOM element.
|
|
38
|
-
*
|
|
39
|
-
* ```tsx
|
|
40
|
-
* const ref = useRef(null);
|
|
41
|
-
* const { selectedText, selectAll, clearSelection } = useTextSelection(ref);
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
36
|
+
* Hook for managing text selection on a DOM element.
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const ref = useRef(null);
|
|
40
|
+
* const { selectedText, selectAll, clearSelection } = useTextSelection(ref);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
44
43
|
declare const useTextSelection: (ref: RefObject<DOMElement | null>, options?: UseTextSelectionOptions) => UseTextSelectionResult;
|
|
45
44
|
export { UseTextSelectionOptions, UseTextSelectionResult, useTextSelection as default, useTextSelection };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
type UseTimeoutOptions = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* When false, the timer never starts. Flipping to true restarts it.
|
|
4
|
+
* @default true
|
|
5
|
+
*/
|
|
6
6
|
readonly isActive?: boolean;
|
|
7
7
|
};
|
|
8
8
|
type UseTimeoutResult = {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Cancel the pending timer (no-op if already fired or never scheduled).
|
|
11
|
+
*/
|
|
12
12
|
readonly cancel: () => void;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* Restart the timer from now with the current delay.
|
|
15
|
+
*/
|
|
16
16
|
readonly reset: () => void;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* A React hook that fires `callback` once after `delay` ms. Changing `delay`
|
|
20
|
-
* or toggling `isActive` reschedules the timer from zero. Call `reset()` to
|
|
21
|
-
* restart on demand.
|
|
22
|
-
*/
|
|
19
|
+
* A React hook that fires `callback` once after `delay` ms. Changing `delay`
|
|
20
|
+
* or toggling `isActive` reschedules the timer from zero. Call `reset()` to
|
|
21
|
+
* restart on demand.
|
|
22
|
+
*/
|
|
23
23
|
declare const useTimeout: (callback: () => void, delay: number, options?: UseTimeoutOptions) => UseTimeoutResult;
|
|
24
24
|
export { UseTimeoutOptions, UseTimeoutResult, useTimeout as default, useTimeout };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
type UseTimerOptions = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Whether to start the timer immediately.
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
6
|
readonly autoStart?: boolean;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Total countdown duration in milliseconds.
|
|
9
|
+
*/
|
|
10
10
|
readonly duration: number;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* Tick interval in milliseconds.
|
|
13
|
+
* @default 1000
|
|
14
|
+
*/
|
|
15
15
|
readonly interval?: number;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
* Called once when the timer reaches zero.
|
|
18
|
+
*/
|
|
19
19
|
readonly onTimeout?: () => void;
|
|
20
20
|
};
|
|
21
21
|
type UseTimerResult = {
|
|
@@ -35,14 +35,14 @@ type UseTimerResult = {
|
|
|
35
35
|
readonly toggle: () => void;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
|
-
* A countdown timer hook built on `useAnimation`.
|
|
39
|
-
*
|
|
40
|
-
* ```tsx
|
|
41
|
-
* const { remaining, isRunning, start, stop, reset, isFinished } = useTimer({
|
|
42
|
-
* duration: 60_000,
|
|
43
|
-
* onTimeout: () => console.log("Time's up!"),
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
38
|
+
* A countdown timer hook built on `useAnimation`.
|
|
39
|
+
*
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const { remaining, isRunning, start, stop, reset, isFinished } = useTimer({
|
|
42
|
+
* duration: 60_000,
|
|
43
|
+
* onTimeout: () => console.log("Time's up!"),
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
47
|
declare function useTimer(options: UseTimerOptions): UseTimerResult;
|
|
48
48
|
export { UseTimerOptions, UseTimerResult, useTimer as default, useTimer };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dimensions of the terminal window.
|
|
3
|
-
*/
|
|
2
|
+
* Dimensions of the terminal window.
|
|
3
|
+
*/
|
|
4
4
|
type WindowSize = {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Number of columns (horizontal character cells).
|
|
7
|
+
*/
|
|
8
8
|
readonly columns: number;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Number of rows (vertical character cells).
|
|
11
|
+
*/
|
|
12
12
|
readonly rows: number;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
16
|
-
*/
|
|
15
|
+
* A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
16
|
+
*/
|
|
17
17
|
declare const useWindowSize: () => WindowSize;
|
|
18
18
|
export { WindowSize, useWindowSize as default, useWindowSize };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as i,useEffect as n}from"react";import{g as o}from"../../packem_shared/utils-
|
|
1
|
+
import{useState as i,useEffect as n}from"react";import{g as o}from"../../packem_shared/utils-CVgM8kTn.js";import f from"./use-stdout.js";const c=()=>{const{stdout:e}=f(),[r,s]=i(()=>o(e));return n(()=>{const t=()=>{s(o(e))};return e.on("resize",t),()=>{e.off("resize",t)}},[e]),r};export{c as default,c as useWindowSize};
|
package/dist/ink/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { type C as ClipboardTarget, c as clearOsc52, i as isOsc52Supported, w as writeOsc52 } from "../packem_shared/clipboard.d-
|
|
2
|
-
export { b as COLOR_BLINDNESS_COMPENSATION, c as COLOR_BLINDNESS_SIMULATION, type C as ColorBlindnessType, type a as ColorMatrix, I as IDENTITY_MATRIX, d as applyColorMatrix, h as hexToRgb, r as rgbToHex, t as transformHexColor } from "../packem_shared/color-matrix.d-
|
|
3
|
-
import { D as DOMElement,
|
|
4
|
-
export { R as ResizeObserver, type
|
|
5
|
-
export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-
|
|
1
|
+
export { type C as ClipboardTarget, c as clearOsc52, i as isOsc52Supported, w as writeOsc52 } from "../packem_shared/clipboard.d-nDPQkZ2H.js";
|
|
2
|
+
export { b as COLOR_BLINDNESS_COMPENSATION, c as COLOR_BLINDNESS_SIMULATION, type C as ColorBlindnessType, type a as ColorMatrix, I as IDENTITY_MATRIX, d as applyColorMatrix, h as hexToRgb, r as rgbToHex, t as transformHexColor } from "../packem_shared/color-matrix.d-sTqnJ23h.js";
|
|
3
|
+
import { D as DOMElement, b as DOMNode, e as StyledLine } from "../packem_shared/dom.d-CLGlidfI.js";
|
|
4
|
+
export { R as ResizeObserver, type f as ResizeObserverCallback, g as ResizeObserverEntry, type h as ScrollState, type S as StickyHeader, i as calculateScroll, j as getPathToRoot, k as getScrollHeight, l as getScrollLeft, m as getScrollTop, n as getScrollWidth, o as isNodeSelectable } from "../packem_shared/dom.d-CLGlidfI.js";
|
|
5
|
+
export { type I as Instance, type K as KittyFlagName, type a as KittyKeyboardOptions, type R as RenderOptions, k as kittyFlags, b as kittyModifiers, r as render } from "../packem_shared/render.d-DjQhFsiN.js";
|
|
6
6
|
import 'node:stream';
|
|
7
|
-
export type {
|
|
8
|
-
import { e as MouseButton, d as MousePosition } from "../packem_shared/mouse-context.d-
|
|
9
|
-
export type { f as MouseAction, a as MouseClickAction, M as MouseContextShape, b as MouseDragAction, g as MouseEvents, c as MouseScrollAction } from "../packem_shared/mouse-context.d-
|
|
7
|
+
export type { CursorPosition } from "./public/cursor.js";
|
|
8
|
+
import { e as MouseButton, d as MousePosition } from "../packem_shared/mouse-context.d-W-nszUps.js";
|
|
9
|
+
export type { f as MouseAction, a as MouseClickAction, M as MouseContextShape, b as MouseDragAction, g as MouseEvents, c as MouseScrollAction } from "../packem_shared/mouse-context.d-W-nszUps.js";
|
|
10
10
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
11
11
|
export { useElementDimensions, useElementPosition } from "./mouse/use-element-position.js";
|
|
12
12
|
export { default as useMouseContext } from "./mouse/use-mouse.js";
|
|
@@ -15,76 +15,73 @@ export { default as useMousePosition } from "./mouse/use-mouse-position.js";
|
|
|
15
15
|
export { type UseOnMouseClickOptions, useOnMouseClick } from "./mouse/use-on-mouse-click.js";
|
|
16
16
|
export { default as useOnMouseHover } from "./mouse/use-on-mouse-hover.js";
|
|
17
17
|
export { default as useOnMouseState } from "./mouse/use-on-mouse-state.js";
|
|
18
|
-
export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-
|
|
19
|
-
export { type T as TerminalPalette, i as isTerminalPaletteQuerySupported, q as queryTerminalPalette } from "../packem_shared/terminal-palette.d-
|
|
18
|
+
export { R as Range, S as Selection, a as applySelectionToStyledLine, c as comparePoints } from "../packem_shared/selection.d-BSAWa4ey.js";
|
|
19
|
+
export { type T as TerminalPalette, i as isTerminalPaletteQuerySupported, q as queryTerminalPalette } from "../packem_shared/terminal-palette.d-JbWHISW-.js";
|
|
20
20
|
import 'yoga-layout';
|
|
21
21
|
import '@visulima/colorize';
|
|
22
|
-
import
|
|
23
|
-
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
22
|
+
import "../packem_shared/styles.d-CKGQFfm4.js";
|
|
24
23
|
import 'type-fest';
|
|
24
|
+
import "../packem_shared/app-context.d-DMLw5Nxy.js";
|
|
25
25
|
import 'node:events';
|
|
26
26
|
/**
|
|
27
|
-
* Detect whether a string contains non-ASCII characters that are likely
|
|
28
|
-
* IME (Input Method Editor) composition input — CJK ideographs, Hangul,
|
|
29
|
-
* Thai, Vietnamese diacritics, etc.
|
|
30
|
-
*/
|
|
27
|
+
* Detect whether a string contains non-ASCII characters that are likely
|
|
28
|
+
* IME (Input Method Editor) composition input — CJK ideographs, Hangul,
|
|
29
|
+
* Thai, Vietnamese diacritics, etc.
|
|
30
|
+
*/
|
|
31
31
|
declare const isIMEInput: (data: string) => boolean;
|
|
32
32
|
type IMECompositionBufferOptions = {
|
|
33
33
|
onFlush: (text: string) => void;
|
|
34
34
|
timeout: number;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
|
-
* Buffers rapid multi-byte character input from IME and flushes the
|
|
38
|
-
* accumulated text after a configurable timeout.
|
|
39
|
-
*/
|
|
37
|
+
* Buffers rapid multi-byte character input from IME and flushes the
|
|
38
|
+
* accumulated text after a configurable timeout.
|
|
39
|
+
*/
|
|
40
40
|
declare class IMECompositionBuffer {
|
|
41
41
|
private buffer;
|
|
42
42
|
private timer;
|
|
43
43
|
private readonly onFlush;
|
|
44
44
|
private readonly timeout;
|
|
45
|
-
constructor({
|
|
46
|
-
onFlush,
|
|
47
|
-
timeout
|
|
48
|
-
}: IMECompositionBufferOptions);
|
|
45
|
+
constructor({ onFlush, timeout }: IMECompositionBufferOptions);
|
|
49
46
|
add(text: string): void;
|
|
50
47
|
flush(): void;
|
|
51
48
|
destroy(): void;
|
|
52
49
|
}
|
|
53
50
|
type Output = {
|
|
54
51
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
* Element height.
|
|
53
|
+
*/
|
|
57
54
|
height: number;
|
|
58
55
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
* Element width.
|
|
57
|
+
*/
|
|
61
58
|
width: number;
|
|
62
59
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
* Element X position relative to Ink output origin.
|
|
61
|
+
*/
|
|
65
62
|
x: number;
|
|
66
63
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
* Element Y position relative to Ink output origin.
|
|
65
|
+
*/
|
|
69
66
|
y: number;
|
|
70
67
|
};
|
|
71
68
|
/**
|
|
72
|
-
* Measure the dimensions of a particular `<Box>` element.
|
|
73
|
-
* Returns an object with `x`, `y`, `width` and `height` properties.
|
|
74
|
-
*/
|
|
69
|
+
* Measure the dimensions of a particular `<Box>` element.
|
|
70
|
+
* Returns an object with `x`, `y`, `width` and `height` properties.
|
|
71
|
+
*/
|
|
75
72
|
declare const measureElement: (node: DOMElement) => Output;
|
|
76
73
|
/**
|
|
77
|
-
* Get an element's inner width (excluding borders).
|
|
78
|
-
*/
|
|
74
|
+
* Get an element's inner width (excluding borders).
|
|
75
|
+
*/
|
|
79
76
|
declare const getInnerWidth: (node: DOMElement) => number;
|
|
80
77
|
/**
|
|
81
|
-
* Get an element's inner height (excluding borders).
|
|
82
|
-
*/
|
|
78
|
+
* Get an element's inner height (excluding borders).
|
|
79
|
+
*/
|
|
83
80
|
declare const getInnerHeight: (node: DOMElement) => number;
|
|
84
81
|
/**
|
|
85
|
-
* Get an element's position and dimensions relative to the root,
|
|
86
|
-
* accounting for scroll offsets of ancestor elements.
|
|
87
|
-
*/
|
|
82
|
+
* Get an element's position and dimensions relative to the root,
|
|
83
|
+
* accounting for scroll offsets of ancestor elements.
|
|
84
|
+
*/
|
|
88
85
|
declare const getBoundingBox: (node: DOMElement) => {
|
|
89
86
|
height: number;
|
|
90
87
|
width: number;
|
|
@@ -92,8 +89,8 @@ declare const getBoundingBox: (node: DOMElement) => {
|
|
|
92
89
|
y: number;
|
|
93
90
|
};
|
|
94
91
|
/**
|
|
95
|
-
* Get how much scroll height was added by stableScrollback.
|
|
96
|
-
*/
|
|
92
|
+
* Get how much scroll height was added by stableScrollback.
|
|
93
|
+
*/
|
|
97
94
|
declare const getAddedScrollHeight: (node: DOMElement) => number;
|
|
98
95
|
type ScrollbarBoundingBox = {
|
|
99
96
|
height: number;
|
|
@@ -137,39 +134,39 @@ declare const calculateScrollbarLayout: (options: {
|
|
|
137
134
|
y: number;
|
|
138
135
|
}) => ScrollbarBoundingBox | undefined;
|
|
139
136
|
/**
|
|
140
|
-
* Get the bounding box of the vertical scrollbar.
|
|
141
|
-
*/
|
|
137
|
+
* Get the bounding box of the vertical scrollbar.
|
|
138
|
+
*/
|
|
142
139
|
declare const getVerticalScrollbarBoundingBox: (node: DOMElement, offset?: {
|
|
143
140
|
x: number;
|
|
144
141
|
y: number;
|
|
145
142
|
}) => ScrollbarBoundingBox | undefined;
|
|
146
143
|
/**
|
|
147
|
-
* Get the bounding box of the horizontal scrollbar.
|
|
148
|
-
*/
|
|
144
|
+
* Get the bounding box of the horizontal scrollbar.
|
|
145
|
+
*/
|
|
149
146
|
declare const getHorizontalScrollbarBoundingBox: (node: DOMElement, offset?: {
|
|
150
147
|
x: number;
|
|
151
148
|
y: number;
|
|
152
149
|
}) => ScrollbarBoundingBox | undefined;
|
|
153
150
|
/**
|
|
154
|
-
* Get the top position of a node relative to a given ancestor.
|
|
155
|
-
* Returns undefined if the ancestor is not in the node's parent chain.
|
|
156
|
-
*
|
|
157
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
158
|
-
*/
|
|
151
|
+
* Get the top position of a node relative to a given ancestor.
|
|
152
|
+
* Returns undefined if the ancestor is not in the node's parent chain.
|
|
153
|
+
*
|
|
154
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
155
|
+
*/
|
|
159
156
|
declare const getRelativeTop: (node: DOMElement, ancestor?: DOMElement) => number | undefined;
|
|
160
157
|
/**
|
|
161
|
-
* Get the left position of a node relative to a given ancestor.
|
|
162
|
-
* Returns undefined if the ancestor is not in the node's parent chain.
|
|
163
|
-
*
|
|
164
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
165
|
-
*/
|
|
158
|
+
* Get the left position of a node relative to a given ancestor.
|
|
159
|
+
* Returns undefined if the ancestor is not in the node's parent chain.
|
|
160
|
+
*
|
|
161
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
162
|
+
*/
|
|
166
163
|
declare const getRelativeLeft: (node: DOMElement, ancestor?: DOMElement) => number | undefined;
|
|
167
164
|
/**
|
|
168
|
-
* A text fragment from the layout tree with its position and dimensions.
|
|
169
|
-
* Used by `processLayout` for text extraction and selection.
|
|
170
|
-
*
|
|
171
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
172
|
-
*/
|
|
165
|
+
* A text fragment from the layout tree with its position and dimensions.
|
|
166
|
+
* Used by `processLayout` for text extraction and selection.
|
|
167
|
+
*
|
|
168
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
169
|
+
*/
|
|
173
170
|
type TextFragment = {
|
|
174
171
|
height: number;
|
|
175
172
|
node: DOMElement;
|
|
@@ -181,26 +178,26 @@ type TextFragment = {
|
|
|
181
178
|
y: number;
|
|
182
179
|
};
|
|
183
180
|
/**
|
|
184
|
-
* Get the text content of a DOM node (text node value or squashed children).
|
|
185
|
-
*/
|
|
181
|
+
* Get the text content of a DOM node (text node value or squashed children).
|
|
182
|
+
*/
|
|
186
183
|
declare const getText: (node: DOMNode) => string;
|
|
187
184
|
/**
|
|
188
|
-
* Walk the layout tree to collect all text fragments in document order,
|
|
189
|
-
* with their positions adjusted for borders and flex layout.
|
|
190
|
-
*
|
|
191
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
192
|
-
*/
|
|
185
|
+
* Walk the layout tree to collect all text fragments in document order,
|
|
186
|
+
* with their positions adjusted for borders and flex layout.
|
|
187
|
+
*
|
|
188
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
189
|
+
*/
|
|
193
190
|
declare const collectSortedFragments: (node: DOMNode) => {
|
|
194
191
|
fragments: TextFragment[];
|
|
195
192
|
removedHorizontal: number;
|
|
196
193
|
removedVertical: number;
|
|
197
194
|
};
|
|
198
195
|
/**
|
|
199
|
-
* Generic layout tree walker with callbacks for text, newline, and space events.
|
|
200
|
-
* Used by selection.ts for extracting text from the DOM tree with proper layout positioning.
|
|
201
|
-
*
|
|
202
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
203
|
-
*/
|
|
196
|
+
* Generic layout tree walker with callbacks for text, newline, and space events.
|
|
197
|
+
* Used by selection.ts for extracting text from the DOM tree with proper layout positioning.
|
|
198
|
+
*
|
|
199
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
200
|
+
*/
|
|
204
201
|
type LayoutCallbacks<T> = {
|
|
205
202
|
initialState: () => T;
|
|
206
203
|
onNewline: (count: number, state: T) => void;
|
|
@@ -213,37 +210,37 @@ declare const processLayout: <T>(node: DOMNode, callbacks: LayoutCallbacks<T>) =
|
|
|
213
210
|
};
|
|
214
211
|
type StringWidthFunction = (text: string) => number;
|
|
215
212
|
/**
|
|
216
|
-
* Enable or disable the StyledLine tokenization cache at runtime.
|
|
217
|
-
* Disabling clears the existing cache.
|
|
218
|
-
*/
|
|
213
|
+
* Enable or disable the StyledLine tokenization cache at runtime.
|
|
214
|
+
* Disabling clears the existing cache.
|
|
215
|
+
*/
|
|
219
216
|
declare const setEnableStyledLineCache: (enabled: boolean) => void;
|
|
220
217
|
/**
|
|
221
|
-
* Clear only the StyledLine tokenization cache.
|
|
222
|
-
*/
|
|
218
|
+
* Clear only the StyledLine tokenization cache.
|
|
219
|
+
*/
|
|
223
220
|
declare const clearStyledLineCache: () => void;
|
|
224
221
|
/**
|
|
225
|
-
* Replace the string width function used for text measurement.
|
|
226
|
-
* Useful for terminals with non-standard character widths.
|
|
227
|
-
* Clears the measurement cache when called.
|
|
228
|
-
*/
|
|
222
|
+
* Replace the string width function used for text measurement.
|
|
223
|
+
* Useful for terminals with non-standard character widths.
|
|
224
|
+
* Clears the measurement cache when called.
|
|
225
|
+
*/
|
|
229
226
|
declare const setStringWidthFunction: (function_: StringWidthFunction) => void;
|
|
230
227
|
/**
|
|
231
|
-
* Clear the string width measurement cache. Call this if the terminal
|
|
232
|
-
* environment changes in a way that affects character widths.
|
|
233
|
-
*/
|
|
228
|
+
* Clear the string width measurement cache. Call this if the terminal
|
|
229
|
+
* environment changes in a way that affects character widths.
|
|
230
|
+
*/
|
|
234
231
|
declare const clearStringWidthCache: () => void;
|
|
235
232
|
/**
|
|
236
|
-
* Get the visual width of a single character, with caching and error handling.
|
|
237
|
-
*
|
|
238
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
239
|
-
*/
|
|
233
|
+
* Get the visual width of a single character, with caching and error handling.
|
|
234
|
+
*
|
|
235
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
236
|
+
*/
|
|
240
237
|
declare const inkCharacterWidth: (text: string) => number;
|
|
241
238
|
/**
|
|
242
|
-
* Convert a text string to a StyledLine, with caching.
|
|
243
|
-
* Uses the direct text → StyledLine pipeline (handles combining chars,
|
|
244
|
-
* tabs, regional indicators, ANSI codes, etc.) without intermediate
|
|
245
|
-
* StyledChar objects.
|
|
246
|
-
*/
|
|
239
|
+
* Convert a text string to a StyledLine, with caching.
|
|
240
|
+
* Uses the direct text → StyledLine pipeline (handles combining chars,
|
|
241
|
+
* tabs, regional indicators, ANSI codes, etc.) without intermediate
|
|
242
|
+
* StyledChar objects.
|
|
243
|
+
*/
|
|
247
244
|
declare const toStyledLine: (text: string) => StyledLine;
|
|
248
245
|
type SgrMouseEvent = {
|
|
249
246
|
action: "press" | "release";
|
|
@@ -268,24 +265,16 @@ type SgrMouseEvent = {
|
|
|
268
265
|
y: number;
|
|
269
266
|
};
|
|
270
267
|
/**
|
|
271
|
-
* Parse an SGR 1006 mouse escape sequence into a structured event.
|
|
272
|
-
*
|
|
273
|
-
* Returns `undefined` if the input is not a valid SGR mouse sequence.
|
|
274
|
-
*/
|
|
268
|
+
* Parse an SGR 1006 mouse escape sequence into a structured event.
|
|
269
|
+
*
|
|
270
|
+
* Returns `undefined` if the input is not a valid SGR mouse sequence.
|
|
271
|
+
*/
|
|
275
272
|
declare const parseSgrMouse: (input: string) => SgrMouseEvent | undefined;
|
|
276
|
-
declare const Fullscreen: ({
|
|
277
|
-
children
|
|
278
|
-
}: PropsWithChildren) => React.JSX.Element;
|
|
273
|
+
declare const Fullscreen: ({ children }: PropsWithChildren) => React.JSX.Element;
|
|
279
274
|
/**
|
|
280
|
-
* Determines if the mouse position is intersecting with the element's layout bounds.
|
|
281
|
-
*/
|
|
282
|
-
declare const isIntersecting: ({
|
|
283
|
-
element,
|
|
284
|
-
mouse: {
|
|
285
|
-
x,
|
|
286
|
-
y
|
|
287
|
-
}
|
|
288
|
-
}: {
|
|
275
|
+
* Determines if the mouse position is intersecting with the element's layout bounds.
|
|
276
|
+
*/
|
|
277
|
+
declare const isIntersecting: ({ element, mouse: { x, y } }: {
|
|
289
278
|
element: {
|
|
290
279
|
height: number;
|
|
291
280
|
left: number;
|
|
@@ -294,14 +283,12 @@ declare const isIntersecting: ({
|
|
|
294
283
|
};
|
|
295
284
|
mouse: MousePosition;
|
|
296
285
|
}) => boolean;
|
|
297
|
-
declare const MouseProvider: ({
|
|
298
|
-
children
|
|
299
|
-
}: PropsWithChildren) => React.JSX.Element;
|
|
286
|
+
declare const MouseProvider: ({ children }: PropsWithChildren) => React.JSX.Element;
|
|
300
287
|
type RenderToStringOptions = {
|
|
301
288
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
289
|
+
* Width of the virtual terminal in columns.
|
|
290
|
+
* @default 80
|
|
291
|
+
*/
|
|
305
292
|
columns?: number;
|
|
306
293
|
};
|
|
307
294
|
/**
|
|
@@ -340,12 +327,12 @@ type CharOffsetRange = {
|
|
|
340
327
|
};
|
|
341
328
|
type CharOffsetMap = Map<DOMNode, CharOffsetRange>;
|
|
342
329
|
/**
|
|
343
|
-
* Squash text nodes while building a character offset map.
|
|
344
|
-
* Each DOM node is mapped to its start/end character offsets in the resulting string.
|
|
345
|
-
* Used for selection text extraction and cursor position calculation.
|
|
346
|
-
*
|
|
347
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
348
|
-
*/
|
|
330
|
+
* Squash text nodes while building a character offset map.
|
|
331
|
+
* Each DOM node is mapped to its start/end character offsets in the resulting string.
|
|
332
|
+
* Used for selection text extraction and cursor position calculation.
|
|
333
|
+
*
|
|
334
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
335
|
+
*/
|
|
349
336
|
declare const squashTextNodesWithMap: (node: DOMElement, map: CharOffsetMap, offsetRef: {
|
|
350
337
|
current: number;
|
|
351
338
|
}) => string;
|
package/dist/ink/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/clearOsc52-BUpnQOav.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_COMPENSATION-Ilnoyeqc.js";import{g as d,i as x}from"../packem_shared/dom-rphpG0kf.js";import{IMECompositionBuffer as S,isIMEInput as h}from"../packem_shared/IMECompositionBuffer-VhC9HRCv.js";import{kittyFlags as M,kittyModifiers as O}from"../packem_shared/kittyFlags-g8ALyoCU.js";import{processLayout as I}from"../packem_shared/processLayout-I83k6vXE.js";import{c as b,a as C,b as E,g as R,d as N,e as B,f as P,h as H,i as v,j as W,k,l as A,R as _}from"../packem_shared/measure-element-D4M9iSYp.js";import{c as F,a as z,i as q,s as w,b as j,t as Q}from"../packem_shared/measure-text-B7juNq4Y.js";import{default as V}from"../packem_shared/render-
|
|
1
|
+
import{clearOsc52 as o,isOsc52Supported as r,writeOsc52 as a}from"../packem_shared/clearOsc52-BUpnQOav.js";import{COLOR_BLINDNESS_COMPENSATION as l,COLOR_BLINDNESS_SIMULATION as i,IDENTITY_MATRIX as n,applyColorMatrix as u,hexToRgb as f,rgbToHex as p,transformHexColor as c}from"../packem_shared/COLOR_BLINDNESS_COMPENSATION-Ilnoyeqc.js";import{g as d,i as x}from"../packem_shared/dom-rphpG0kf.js";import{IMECompositionBuffer as S,isIMEInput as h}from"../packem_shared/IMECompositionBuffer-VhC9HRCv.js";import{kittyFlags as M,kittyModifiers as O}from"../packem_shared/kittyFlags-g8ALyoCU.js";import{processLayout as I}from"../packem_shared/processLayout-I83k6vXE.js";import{c as b,a as C,b as E,g as R,d as N,e as B,f as P,h as H,i as v,j as W,k,l as A,R as _}from"../packem_shared/measure-element-D4M9iSYp.js";import{c as F,a as z,i as q,s as w,b as j,t as Q}from"../packem_shared/measure-text-B7juNq4Y.js";import{default as V}from"../packem_shared/render-CuCo-R-l.js";import{default as Y}from"../packem_shared/renderToString-B1LgWcJe.js";import{default as J,ResizeObserverEntry as K}from"../packem_shared/ResizeObserver-BI9bDy-j.js";import{calculateScroll as $,getScrollHeight as ee,getScrollLeft as te,getScrollTop as oe,getScrollWidth as re}from"../packem_shared/calculateScroll-D4Y_JR4H.js";import{Range as se,Selection as le,applySelectionToStyledLine as ie,comparePoints as ne}from"../packem_shared/Range-BsVYNWtg.js";import{squashTextNodesWithMap as fe}from"../packem_shared/squashTextNodesWithMap-BmUSBPfc.js";import{isTerminalPaletteQuerySupported as ce,queryTerminalPalette as me}from"../packem_shared/isTerminalPaletteQuerySupported-BYzmqq9-.js";import{wrapOrTruncateStyledLine as xe}from"../packem_shared/wrapOrTruncateStyledLine-46W8bTtv.js";import{default as Se}from"../packem_shared/Fullscreen-BRhuBLBh.js";import{default as Te}from"../packem_shared/MouseProvider-DOcWCRVq.js";import{default as Oe}from"../packem_shared/isIntersecting-Bo2npvMR.js";import{default as Ie}from"./mouse/use-mouse-action.js";import{default as be}from"./mouse/use-mouse.js";import{default as Ee}from"./mouse/use-mouse-position.js";import{default as Ne}from"./mouse/use-on-mouse-hover.js";import{default as Pe}from"./mouse/use-on-mouse-state.js";import{d as ve}from"../packem_shared/ansi-parser-DlgLtOYO.js";import{useElementDimensions as ke,useElementPosition as Ae}from"./mouse/use-element-position.js";import{useOnMouseClick as De}from"./mouse/use-on-mouse-click.js";export{l as COLOR_BLINDNESS_COMPENSATION,i as COLOR_BLINDNESS_SIMULATION,Se as Fullscreen,n as IDENTITY_MATRIX,S as IMECompositionBuffer,Te as MouseProvider,se as Range,J as ResizeObserver,K as ResizeObserverEntry,le as Selection,u as applyColorMatrix,ie as applySelectionToStyledLine,$ as calculateScroll,b as calculateScrollbarLayout,C as calculateScrollbarThumb,o as clearOsc52,F as clearStringWidthCache,z as clearStyledLineCache,E as collectSortedFragments,ne as comparePoints,R as getAddedScrollHeight,N as getBoundingBox,B as getHorizontalScrollbarBoundingBox,P as getInnerHeight,H as getInnerWidth,d as getPathToRoot,v as getRelativeLeft,W as getRelativeTop,ee as getScrollHeight,te as getScrollLeft,oe as getScrollTop,re as getScrollWidth,k as getText,A as getVerticalScrollbarBoundingBox,f as hexToRgb,q as inkCharacterWidth,h as isIMEInput,Oe as isIntersecting,x as isNodeSelectable,r as isOsc52Supported,ce as isTerminalPaletteQuerySupported,M as kittyFlags,O as kittyModifiers,_ as measureElement,ve as parseSgrMouse,I as processLayout,me as queryTerminalPalette,V as render,Y as renderToString,p as rgbToHex,w as setEnableStyledLineCache,j as setStringWidthFunction,fe as squashTextNodesWithMap,Q as toStyledLine,c as transformHexColor,ke as useElementDimensions,Ae as useElementPosition,Ie as useMouseAction,be as useMouseContext,Ee as useMousePosition,De as useOnMouseClick,Ne as useOnMouseHover,Pe as useOnMouseState,xe as wrapOrTruncateStyledLine,a as writeOsc52};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { D as DOMElement } from "../../packem_shared/dom.d-
|
|
2
|
+
import { D as DOMElement } from "../../packem_shared/dom.d-CLGlidfI.js";
|
|
3
3
|
import 'yoga-layout';
|
|
4
|
-
import "
|
|
4
|
+
import "../public/cursor.js";
|
|
5
5
|
import '@visulima/colorize';
|
|
6
|
-
import
|
|
7
|
-
import "../../packem_shared/styles.d-cMo36xQz.js";
|
|
6
|
+
import "../../packem_shared/styles.d-CKGQFfm4.js";
|
|
8
7
|
import 'type-fest';
|
|
9
8
|
declare const getElementPosition: (node: DOMElement | null) => {
|
|
10
9
|
left: number;
|
|
@@ -15,15 +14,15 @@ declare const getElementDimensions: (node: DOMElement | null) => {
|
|
|
15
14
|
width: number;
|
|
16
15
|
} | undefined;
|
|
17
16
|
/**
|
|
18
|
-
* Stateful hook to provide the absolute position of the referenced element.
|
|
19
|
-
*/
|
|
17
|
+
* Stateful hook to provide the absolute position of the referenced element.
|
|
18
|
+
*/
|
|
20
19
|
declare const useElementPosition: (ref: RefObject<DOMElement | null>, deps?: unknown[]) => {
|
|
21
20
|
left: number;
|
|
22
21
|
top: number;
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
|
-
* Stateful hook to provide the dimensions of the referenced element.
|
|
26
|
-
*/
|
|
24
|
+
* Stateful hook to provide the dimensions of the referenced element.
|
|
25
|
+
*/
|
|
27
26
|
declare const useElementDimensions: (ref: RefObject<DOMElement | null>, deps?: unknown[]) => {
|
|
28
27
|
height: number;
|
|
29
28
|
width: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MouseClickAction, b as MouseDragAction, c as MouseScrollAction } from "../../packem_shared/mouse-context.d-
|
|
1
|
+
import { a as MouseClickAction, b as MouseDragAction, c as MouseScrollAction } from "../../packem_shared/mouse-context.d-W-nszUps.js";
|
|
2
2
|
import 'node:events';
|
|
3
3
|
import 'react';
|
|
4
4
|
declare const useMouseAction: () => MouseClickAction | MouseDragAction | MouseScrollAction | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MouseContextShape } from "../../packem_shared/mouse-context.d-
|
|
1
|
+
import { M as MouseContextShape } from "../../packem_shared/mouse-context.d-W-nszUps.js";
|
|
2
2
|
import 'node:events';
|
|
3
3
|
import 'react';
|
|
4
4
|
declare const useMouseContext: () => MouseContextShape;
|