@visulima/tui 2.0.0 → 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 +2 -0
- package/dist/components/box.d.ts +25 -25
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/cursor.d.ts +39 -44
- package/dist/components/error-overview.d.ts +1 -3
- package/dist/components/error-overview.js +1 -1
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +9 -40
- package/dist/components/static.d.ts +13 -13
- package/dist/components/text.d.ts +34 -47
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -11
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +10 -10
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -3
- package/dist/ink/hooks/use-box-metrics.d.ts +16 -16
- 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 +6 -6
- 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 +18 -18
- 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 +109 -122
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +6 -6
- 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 +3 -3
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +2 -2
- package/dist/ink/mouse/use-on-mouse-state.d.ts +2 -2
- package/dist/ink/public/cursor.d.ts +21 -21
- package/dist/ink/public/dom.d.ts +2 -2
- package/dist/ink/public/highlighter.d.ts +16 -26
- package/dist/ink/public/input.d.ts +6 -6
- package/dist/ink/public/styles.d.ts +1 -1
- package/dist/ink/public/utils.d.ts +2 -2
- package/dist/packem_shared/{DevTools-D9tfChBc.js → DevTools-BxD3PYAN.js} +1 -1
- 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-DjIgv5Sk.js → TuiApp-CCVaiKbf.js} +1 -1
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/{buffer.d-j_dP5JyC.d.ts → buffer.d-CttIC480.d.ts} +26 -26
- 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/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/{dom.d-g-nsYquD.d.ts → dom.d-CLGlidfI.d.ts} +138 -151
- package/dist/packem_shared/{input.d-D-Yxqha8.d.ts → input.d-Bb8pWHvp.d.ts} +24 -24
- 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-D7aV_hO1.js → render-CuCo-R-l.js} +17 -17
- package/dist/packem_shared/{render-DMcWfI6-.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DqLFFPvO.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{selection.d-KWphH--_.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 -178
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +151 -151
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +9 -9
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +0 -56
- 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/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-DhUGYWCr.js +0 -1
- package/dist/packem_shared/render.d-BvfwvSCx.d.ts +0 -435
- 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-D7iZuNC-.d.ts +0 -492
- package/dist/packem_shared/utils-C8l_3Dzw.js +0 -1
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
import { Node } from 'yoga-layout';
|
|
2
2
|
import { CursorShape } from "../ink/public/cursor.js";
|
|
3
3
|
import '@visulima/colorize';
|
|
4
|
-
import { S as Styles } from "./styles.d-
|
|
5
|
-
|
|
4
|
+
import { S as Styles } from "./styles.d-CKGQFfm4.js";
|
|
6
5
|
/**
|
|
7
|
-
* Columnar data structure for a single line of styled terminal text.
|
|
8
|
-
*
|
|
9
|
-
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
10
|
-
*
|
|
11
|
-
* - `text: string` — concatenated raw character values
|
|
12
|
-
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
13
|
-
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
14
|
-
*
|
|
15
|
-
* For an 80-column line this reduces allocations from ~80 objects to
|
|
16
|
-
* 1 string + 1 array + typically 1-5 span objects.
|
|
17
|
-
*
|
|
18
|
-
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
19
|
-
* @license Apache-2.0
|
|
20
|
-
* Copyright 2026 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Columnar data structure for a single line of styled terminal text.
|
|
25
|
-
*
|
|
26
|
-
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
27
|
-
*
|
|
28
|
-
* - `text: string` — concatenated raw character values
|
|
29
|
-
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
30
|
-
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
31
|
-
*
|
|
32
|
-
* For an 80-column line this reduces allocations from ~80 objects to
|
|
33
|
-
* 1 string + 1 array + typically 1-5 span objects.
|
|
34
|
-
*
|
|
35
|
-
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
36
|
-
* @license Apache-2.0
|
|
37
|
-
* Copyright 2026 Google LLC
|
|
38
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
39
|
-
*/
|
|
6
|
+
* Columnar data structure for a single line of styled terminal text.
|
|
7
|
+
*
|
|
8
|
+
* Instead of one heap-allocated object per visible character, StyledLine stores:
|
|
9
|
+
*
|
|
10
|
+
* - `text: string` — concatenated raw character values
|
|
11
|
+
* - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
|
|
12
|
+
* - `spans: StyleSpan[]` — run-length encoded style information
|
|
13
|
+
*
|
|
14
|
+
* For an 80-column line this reduces allocations from ~80 objects to
|
|
15
|
+
* 1 string + 1 array + typically 1-5 span objects.
|
|
16
|
+
*
|
|
17
|
+
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
18
|
+
* @license Apache-2.0
|
|
19
|
+
* Copyright 2026 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
21
|
+
*/
|
|
40
22
|
type StyleSpan = {
|
|
41
23
|
bgColor?: string;
|
|
42
24
|
fgColor?: string;
|
|
@@ -54,9 +36,9 @@ declare class StyledLine {
|
|
|
54
36
|
static empty(length: number): StyledLine;
|
|
55
37
|
getValue(index: number): string;
|
|
56
38
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
* Get the raw text for a range of characters as a single string slice.
|
|
40
|
+
* Much faster than calling getValue() per character.
|
|
41
|
+
*/
|
|
60
42
|
getTextRange(start: number, end: number): string;
|
|
61
43
|
getSpan(index: number): StyleSpan | undefined;
|
|
62
44
|
getFullWidth(index: number): boolean;
|
|
@@ -70,20 +52,20 @@ declare class StyledLine {
|
|
|
70
52
|
setForegroundColor(index: number, color: string | undefined): void;
|
|
71
53
|
setChar(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
72
54
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
55
|
+
* Optimized setChar for same-length single-byte replacement.
|
|
56
|
+
* Skips string rebuild and offset adjustment when old and new values
|
|
57
|
+
* have the same byte length (the common case for ASCII overwrites on empty lines).
|
|
58
|
+
*/
|
|
77
59
|
setCharFast(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
78
60
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
* Overwrite a range of this line with content from a source StyledLine.
|
|
62
|
+
* More efficient than calling setChar() per character because it does
|
|
63
|
+
* a single span split + rebuild instead of per-character span manipulation.
|
|
64
|
+
* @param destinationStart — start index in this line
|
|
65
|
+
* @param source — the StyledLine to copy from
|
|
66
|
+
* @param srcStart — start index in source (default 0)
|
|
67
|
+
* @param count — number of characters to copy (default: source.length)
|
|
68
|
+
*/
|
|
87
69
|
writeFrom(destinationStart: number, source: StyledLine, srcStart?: number, count?: number): void;
|
|
88
70
|
pushChar(value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
|
|
89
71
|
clone(): StyledLine;
|
|
@@ -105,28 +87,28 @@ declare class StyledLine {
|
|
|
105
87
|
value: string;
|
|
106
88
|
}>;
|
|
107
89
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
* Split the span at `index` into a single-char span, apply the updater,
|
|
91
|
+
* then merge adjacent spans. Shared by setInverted/setBackgroundColor/setForegroundColor.
|
|
92
|
+
*/
|
|
111
93
|
private updateSpanAt;
|
|
112
94
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
* Grow the line to at least `minWidth` columns, filling new cells with
|
|
96
|
+
* empty strings (zero-width placeholders). This matches the behavior of
|
|
97
|
+
* sparse JS arrays in the original ink Output where out-of-bounds writes
|
|
98
|
+
* created gaps that produced no visible output.
|
|
99
|
+
*/
|
|
118
100
|
ensureWidth(minWidth: number): void;
|
|
119
101
|
private ensureInitialized;
|
|
120
102
|
private splitSpansAt;
|
|
121
103
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
104
|
+
* Try to apply a single-char style at `index` by matching or merging
|
|
105
|
+
* with an adjacent span, avoiding splitSpansAt + mergeSpans.
|
|
106
|
+
*
|
|
107
|
+
* Returns true if the style was applied (or was already correct),
|
|
108
|
+
* false if the caller must fall through to the split/update/merge path.
|
|
109
|
+
*
|
|
110
|
+
* Ported from jacob314/ink PR #123 (Google LLC, Apache-2.0).
|
|
111
|
+
*/
|
|
130
112
|
private trySetStyleAtIndex;
|
|
131
113
|
private mergeSpans;
|
|
132
114
|
}
|
|
@@ -134,32 +116,41 @@ type Region = {
|
|
|
134
116
|
backgroundColor?: string;
|
|
135
117
|
borderBottom?: number;
|
|
136
118
|
borderTop?: number;
|
|
137
|
-
cachedStickyHeaders?: StickyHeader$1[];
|
|
119
|
+
cachedStickyHeaders?: StickyHeader$1[];
|
|
120
|
+
/** Child regions (nested content areas) */
|
|
138
121
|
children: Region[];
|
|
139
122
|
/** Cursor position within this region */
|
|
140
123
|
cursorPosition?: {
|
|
141
124
|
col: number;
|
|
142
125
|
row: number;
|
|
143
126
|
};
|
|
144
|
-
height: number;
|
|
127
|
+
height: number;
|
|
128
|
+
/** Unique identifier for this region (used for dirty tracking) */
|
|
145
129
|
id: number | string;
|
|
146
|
-
isHorizontallyScrollable?: boolean;
|
|
130
|
+
isHorizontallyScrollable?: boolean;
|
|
131
|
+
/** Whether this region supports scrolling */
|
|
147
132
|
isScrollable: boolean;
|
|
148
|
-
isVerticallyScrollable?: boolean;
|
|
133
|
+
isVerticallyScrollable?: boolean;
|
|
134
|
+
/** Content buffer — StyledLine per row, relative to (0,0) of this region */
|
|
149
135
|
readonly lines: ReadonlyArray<StyledLine>;
|
|
150
136
|
marginBottom?: number;
|
|
151
|
-
marginRight?: number;
|
|
137
|
+
marginRight?: number;
|
|
138
|
+
/** DOM node reference for debugging/caching */
|
|
152
139
|
nodeId?: number;
|
|
153
|
-
opaque?: boolean;
|
|
140
|
+
opaque?: boolean;
|
|
141
|
+
/** Layout properties */
|
|
154
142
|
overflowToBackbuffer?: boolean;
|
|
155
143
|
scrollbarThumbColor?: string;
|
|
156
144
|
scrollbarVisible?: boolean;
|
|
157
145
|
scrollHeight?: number;
|
|
158
|
-
scrollLeft?: number;
|
|
146
|
+
scrollLeft?: number;
|
|
147
|
+
/** Scroll state */
|
|
159
148
|
scrollTop?: number;
|
|
160
|
-
scrollWidth?: number;
|
|
149
|
+
scrollWidth?: number;
|
|
150
|
+
/** Selectable text spans for text selection */
|
|
161
151
|
selectableSpans: SelectableSpan[];
|
|
162
|
-
selectableText?: string;
|
|
152
|
+
selectableText?: string;
|
|
153
|
+
/** Whether the scrollback position is stable */
|
|
163
154
|
stableScrollback?: boolean;
|
|
164
155
|
/** Sticky headers for this region */
|
|
165
156
|
stickyHeaders: StickyHeader$1[];
|
|
@@ -214,14 +205,10 @@ declare class ResizeObserver {
|
|
|
214
205
|
unobserve(element: DOMElement): void;
|
|
215
206
|
disconnect(): void;
|
|
216
207
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
* Internal method called by the layout engine after computing layout.
|
|
209
|
+
*/
|
|
219
210
|
internalTrigger(entries: ResizeObserverEntry[]): void;
|
|
220
211
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Measure a node and collect resize observer entries for it.
|
|
223
|
-
* Used by both the main render loop and static render processing.
|
|
224
|
-
*/
|
|
225
212
|
type ScrollState = {
|
|
226
213
|
actualScrollHeight: number;
|
|
227
214
|
clientHeight: number;
|
|
@@ -235,14 +222,14 @@ declare const getScrollHeight: (node: DOMElement) => number;
|
|
|
235
222
|
declare const getScrollWidth: (node: DOMElement) => number;
|
|
236
223
|
declare const calculateScroll: (node: DOMElement) => void;
|
|
237
224
|
/**
|
|
238
|
-
* Get the effective scroll top position from the pre-computed scroll state.
|
|
239
|
-
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
240
|
-
*/
|
|
225
|
+
* Get the effective scroll top position from the pre-computed scroll state.
|
|
226
|
+
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
227
|
+
*/
|
|
241
228
|
declare const getScrollTop: (node: DOMElement) => number;
|
|
242
229
|
/**
|
|
243
|
-
* Get the effective scroll left position from the pre-computed scroll state.
|
|
244
|
-
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
245
|
-
*/
|
|
230
|
+
* Get the effective scroll left position from the pre-computed scroll state.
|
|
231
|
+
* Falls back to computing from style if scroll state hasn't been calculated yet.
|
|
232
|
+
*/
|
|
246
233
|
declare const getScrollLeft: (node: DOMElement) => number;
|
|
247
234
|
type InkNode = {
|
|
248
235
|
internal_static?: boolean;
|
|
@@ -254,9 +241,9 @@ type LayoutListener = () => void;
|
|
|
254
241
|
type TextName = "#text";
|
|
255
242
|
type ElementNames = "ink-root" | "ink-box" | "ink-text" | "ink-cursor" | "ink-virtual-text" | "ink-static-render";
|
|
256
243
|
/**
|
|
257
|
-
* Describes a sticky header that should be composited on top of scrolled content.
|
|
258
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
259
|
-
*/
|
|
244
|
+
* Describes a sticky header that should be composited on top of scrolled content.
|
|
245
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
246
|
+
*/
|
|
260
247
|
type StickyHeader = {
|
|
261
248
|
/** Content-relative end row. */
|
|
262
249
|
endRow: number;
|
|
@@ -299,10 +286,10 @@ type CursorMarker = {
|
|
|
299
286
|
type DOMElement = InkNode & {
|
|
300
287
|
attributes: Record<string, DOMNodeAttribute>;
|
|
301
288
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
289
|
+
* Cached render result (a Region). When set, the entire subtree is
|
|
290
|
+
* skipped during rendering and the cached region is composited directly.
|
|
291
|
+
* Set by setCachedRender(), cleared on unmount by cleanupNodeTree().
|
|
292
|
+
*/
|
|
306
293
|
cachedRender?: Region;
|
|
307
294
|
childNodes: DOMNode[];
|
|
308
295
|
internal_accessibility?: {
|
|
@@ -322,74 +309,74 @@ type DOMElement = InkNode & {
|
|
|
322
309
|
internal_cursor?: CursorMarker;
|
|
323
310
|
internal_hidden?: boolean;
|
|
324
311
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
* Auto-incrementing unique identifier for this node.
|
|
313
|
+
*/
|
|
327
314
|
internal_id: number;
|
|
328
315
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
* Whether this element's scrollback buffer is dirty (needs recalculation).
|
|
317
|
+
*/
|
|
331
318
|
internal_isScrollbackDirty?: boolean;
|
|
332
319
|
/**
|
|
333
|
-
|
|
334
|
-
|
|
320
|
+
* Last measured size for ResizeObserver tracking.
|
|
321
|
+
*/
|
|
335
322
|
internal_lastMeasuredSize?: {
|
|
336
323
|
height: number;
|
|
337
324
|
width: number;
|
|
338
325
|
};
|
|
339
326
|
internal_layoutListeners?: Set<LayoutListener>;
|
|
340
327
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
328
|
+
* Highest scrollTop whose scrolled-off lines have already been flushed
|
|
329
|
+
* into the terminal's real scrollback history. Monotonic; used by the
|
|
330
|
+
* `overflowToBackbuffer` emission path so a given line is pushed exactly
|
|
331
|
+
* once and scrolling back up never re-emits.
|
|
332
|
+
*/
|
|
346
333
|
internal_maxPushedScrollTop?: number;
|
|
347
334
|
/**
|
|
348
|
-
|
|
349
|
-
|
|
335
|
+
* Maximum scrollTop ever reached, used with stableScrollback.
|
|
336
|
+
*/
|
|
350
337
|
internal_maxScrollTop?: number;
|
|
351
338
|
/**
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
339
|
+
* Callback invoked after prepareYogaTree() caches the render output for
|
|
340
|
+
* an ink-static-render node. StaticRender uses this to set `isRendered`
|
|
341
|
+
* state, which prevents React from re-reconciling children once cached.
|
|
342
|
+
*/
|
|
356
343
|
internal_onRendered?: () => void;
|
|
357
344
|
/**
|
|
358
|
-
|
|
359
|
-
|
|
345
|
+
* Whether this element is opaque (prevents rendering of covered content beneath it).
|
|
346
|
+
*/
|
|
360
347
|
internal_opaque?: boolean;
|
|
361
348
|
/**
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
349
|
+
* Whether the scrollbar should be rendered for this scrollable element.
|
|
350
|
+
* Defaults to true for elements with overflow: 'scroll'.
|
|
351
|
+
*/
|
|
365
352
|
internal_scrollbar?: boolean;
|
|
366
353
|
/**
|
|
367
|
-
|
|
368
|
-
|
|
354
|
+
* Scroll state computed by calculateScroll() for elements with overflow: 'scroll'.
|
|
355
|
+
*/
|
|
369
356
|
internal_scrollState?: ScrollState;
|
|
370
357
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
358
|
+
* Whether this element is sticky (pinned during scroll).
|
|
359
|
+
* - `true` or `'top'`: pinned to the top of the scroll container
|
|
360
|
+
* - `'bottom'`: pinned to the bottom of the scroll container
|
|
361
|
+
*/
|
|
375
362
|
internal_sticky?: boolean | "top" | "bottom";
|
|
376
363
|
/**
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
364
|
+
* Whether this element is the alternate (stuck) version of a sticky header.
|
|
365
|
+
* The stuck version is rendered when the header is pinned.
|
|
366
|
+
*/
|
|
380
367
|
internal_stickyAlternate?: boolean;
|
|
381
368
|
/**
|
|
382
|
-
|
|
383
|
-
|
|
369
|
+
* Whether this element should receive the terminal cursor focus.
|
|
370
|
+
*/
|
|
384
371
|
internal_terminalCursorFocus?: boolean;
|
|
385
372
|
/**
|
|
386
|
-
|
|
387
|
-
|
|
373
|
+
* Terminal cursor position offset within this element.
|
|
374
|
+
*/
|
|
388
375
|
internal_terminalCursorPosition?: number;
|
|
389
376
|
/**
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
377
|
+
* Cached text squash result for this node's subtree.
|
|
378
|
+
* Invalidated by markNodeAsDirty() when children change.
|
|
379
|
+
*/
|
|
393
380
|
internal_textCache?: {
|
|
394
381
|
map: Map<DOMNode, {
|
|
395
382
|
end: number;
|
|
@@ -400,10 +387,10 @@ type DOMElement = InkNode & {
|
|
|
400
387
|
internal_transform?: OutputTransformer;
|
|
401
388
|
isStaticDirty?: boolean;
|
|
402
389
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
390
|
+
* Whether the Yoga subtree has been detached (children removed from Yoga layout)
|
|
391
|
+
* because a cachedRender was set. When cachedRender is invalidated,
|
|
392
|
+
* prepareYogaTree() re-attaches the children before the next layout pass.
|
|
393
|
+
*/
|
|
407
394
|
isYogaTreeDetached?: boolean;
|
|
408
395
|
nodeName: ElementNames;
|
|
409
396
|
onComputeLayout?: () => void;
|
|
@@ -411,13 +398,13 @@ type DOMElement = InkNode & {
|
|
|
411
398
|
onRender?: () => void;
|
|
412
399
|
onStaticChange?: () => void;
|
|
413
400
|
/**
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
401
|
+
* Tracks the previous commit's `staticNode` so the reconciler can detect identity changes
|
|
402
|
+
* (first mount, last unmount, key-driven remount) and reset accumulated `fullStaticOutput`.
|
|
403
|
+
*/
|
|
417
404
|
previousStaticNode?: DOMElement;
|
|
418
405
|
/**
|
|
419
|
-
|
|
420
|
-
|
|
406
|
+
* Set of ResizeObservers attached to this element.
|
|
407
|
+
*/
|
|
421
408
|
resizeObservers?: Set<ResizeObserver>;
|
|
422
409
|
staticNode?: DOMElement;
|
|
423
410
|
};
|
|
@@ -432,17 +419,17 @@ type DOMNode<T = {
|
|
|
432
419
|
} ? U extends "#text" ? TextNode : DOMElement : never;
|
|
433
420
|
type DOMNodeAttribute = boolean | string | number;
|
|
434
421
|
/**
|
|
435
|
-
* Get the path from the root to this node (inclusive).
|
|
436
|
-
* Returns an array starting with the root and ending with the node.
|
|
437
|
-
*
|
|
438
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
439
|
-
*/
|
|
422
|
+
* Get the path from the root to this node (inclusive).
|
|
423
|
+
* Returns an array starting with the root and ending with the node.
|
|
424
|
+
*
|
|
425
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
426
|
+
*/
|
|
440
427
|
declare const getPathToRoot: (node: DOMNode) => DOMNode[];
|
|
441
428
|
/**
|
|
442
|
-
* Check if a node is selectable by walking up the tree checking `userSelect` style.
|
|
443
|
-
* Returns true by default unless an ancestor has `userSelect: 'none'`.
|
|
444
|
-
*
|
|
445
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
446
|
-
*/
|
|
429
|
+
* Check if a node is selectable by walking up the tree checking `userSelect` style.
|
|
430
|
+
* Returns true by default unless an ancestor has `userSelect: 'none'`.
|
|
431
|
+
*
|
|
432
|
+
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
433
|
+
*/
|
|
447
434
|
declare const isNodeSelectable: (node: DOMElement) => boolean;
|
|
448
435
|
export { CursorAnchorRef as C, DOMElement as D, ElementNames as E, NodeNames as N, ResizeObserver as R, StickyHeader as S, TextName as T, CursorMarker as a, DOMNode as b, DOMNodeAttribute as c, TextNode as d, StyledLine as e, ResizeObserverCallback as f, ResizeObserverEntry as g, ScrollState as h, calculateScroll as i, getPathToRoot as j, getScrollHeight as k, getScrollLeft as l, getScrollTop as m, getScrollWidth as n, isNodeSelectable as o };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type Listener = (...args: any[]) => Promise<any> | void;
|
|
2
|
-
type DefaultEventMap = { [event in (string | symbol)]: Listener } & {
|
|
2
|
+
type DefaultEventMap = { [event in (string | symbol)]: Listener; } & {
|
|
3
3
|
/**
|
|
4
4
|
* __proto__ key not allowed due to implementation
|
|
5
5
|
* add prefix, if you want to use this keyword
|
|
@@ -56,8 +56,8 @@ declare function growArgsNum<Func extends (...args: any) => void, AwaitTasks ext
|
|
|
56
56
|
declare function setAutoRebuild<Func extends (...args: any) => void, AwaitTasks extends true | false = false>(this: TaskCollection<Func, AwaitTasks>, newVal: boolean): void;
|
|
57
57
|
/** Implemented event emitter */
|
|
58
58
|
declare class EventEmitter<EventMap extends DefaultEventMap = DefaultEventMap> implements IEventEmitter<EventMap> {
|
|
59
|
-
events: { [eventName in keyof EventMap]?: TaskCollection<EventMap[eventName]
|
|
60
|
-
onceEvents: { [eventName in keyof EventMap]?: (EventMap[eventName][]) | EventMap[eventName] };
|
|
59
|
+
events: { [eventName in keyof EventMap]?: TaskCollection<EventMap[eventName]>; };
|
|
60
|
+
onceEvents: { [eventName in keyof EventMap]?: (EventMap[eventName][]) | EventMap[eventName]; };
|
|
61
61
|
boundFuncs: undefined | Map<Function, Function>;
|
|
62
62
|
_symbolKeys: Set<symbol>;
|
|
63
63
|
maxListeners: number;
|
|
@@ -98,14 +98,14 @@ declare class TuiApp extends EventEmitter {
|
|
|
98
98
|
/** Exits raw mode + alternate screen, then flushes any buffered stdout/stderr. */
|
|
99
99
|
stop(): void;
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
* Buffer a write to stdout. While the alternate screen is active, writing
|
|
102
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
103
|
+
*/
|
|
104
104
|
writeStdout(text: string): void;
|
|
105
105
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
* Buffer a write to stderr. While the alternate screen is active, writing
|
|
107
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
108
|
+
*/
|
|
109
109
|
writeStderr(text: string): void;
|
|
110
110
|
/** Returns the shared Uint32Array back-buffer (width * height * 2 u32 cells). */
|
|
111
111
|
getBuffer(): Uint32Array;
|
|
@@ -117,27 +117,27 @@ declare class TuiApp extends EventEmitter {
|
|
|
117
117
|
/** Update terminal dimensions (called on SIGWINCH). */
|
|
118
118
|
resize(width: number, height: number): void;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
* Callbacks fired on every frame after React paints the buffer but before
|
|
121
|
+
* the Rust diff engine flushes to stdout. Use for direct buffer painting
|
|
122
|
+
* that needs to overlay React output (animated graphs, overlays, FPS counters).
|
|
123
|
+
* Multiple listeners are supported — they fire in registration order.
|
|
124
|
+
*/
|
|
125
125
|
private beforeFlushListeners;
|
|
126
126
|
onBeforeFlush(function_: (buffer: Uint32Array, width: number, height: number) => void): () => void;
|
|
127
127
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
* Layout + paint synchronously. Called from the render loop on every dirty frame,
|
|
129
|
+
* and directly on resize for immediate response.
|
|
130
|
+
*/
|
|
131
131
|
paintNow(calculateLayout: (w: number, h: number) => void, renderToBuffer: (buf: Uint32Array, w: number, h: number) => void): void;
|
|
132
132
|
}
|
|
133
133
|
interface InlineOptions {
|
|
134
134
|
/** Frames per second. Default: 60 */
|
|
135
135
|
fps?: number;
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
* What to do with the rendered content when the loop stops.
|
|
138
|
+
* - 'preserve' (default) — content stays in terminal scrollback
|
|
139
|
+
* - 'destroy' — content is cleared, terminal looks untouched
|
|
140
|
+
*/
|
|
141
141
|
onExit?: "preserve" | "destroy";
|
|
142
142
|
/** Number of terminal rows to reserve. Default: 10 */
|
|
143
143
|
rows?: number;
|
|
@@ -148,9 +148,9 @@ interface InlineLoop {
|
|
|
148
148
|
stop: () => void;
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
-
* Create an inline render loop. Renders `rows` lines immediately below the
|
|
152
|
-
* current cursor position (no alternate screen).
|
|
153
|
-
*/
|
|
151
|
+
* Create an inline render loop. Renders `rows` lines immediately below the
|
|
152
|
+
* current cursor position (no alternate screen).
|
|
153
|
+
*/
|
|
154
154
|
declare function createInlineLoop(paint: InlinePaintFn, options?: InlineOptions): InlineLoop;
|
|
155
155
|
interface MouseEvent {
|
|
156
156
|
button: "left" | "right" | "middle" | "scrollUp" | "scrollDown";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as l}from"node:module";let _;const f=e=>(_??=l(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,n]=t.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return t.getBuiltinModule(e)}return f(e)},{existsSync:d}=i("node:fs"),{createRequire:p}=i("node:module"),{dirname:a,join:r}=i("node:path"),{fileURLToPath:j}=i("node:url"),m=12,h=e=>{const o=p(e),n=a(j(e));let s=n;for(let c=0;c<m;c+=1){if(d(r(s,"package.json"))&&d(r(s,"index.js")))return o(r(s,"index.js"));const u=a(s);if(u===s)break;s=u}return o(r(n,"..","index.js"))};export{h as p};
|
|
@@ -10,14 +10,14 @@ type MouseScrollAction = "scrolldown" | "scrollup" | null;
|
|
|
10
10
|
type MouseDragAction = "dragging" | null;
|
|
11
11
|
type MouseAction = MouseClickAction | MouseDragAction | MouseScrollAction;
|
|
12
12
|
/**
|
|
13
|
-
* Internal event emitter for mouse state changes.
|
|
14
|
-
*
|
|
15
|
-
* Events:
|
|
16
|
-
* - "position" (position: MousePosition)
|
|
17
|
-
* - "click" (position: MousePosition, action: MouseClickAction, button: MouseButton)
|
|
18
|
-
* - "scroll" (position: MousePosition, direction: MouseScrollAction)
|
|
19
|
-
* - "drag" (position: MousePosition, action: MouseDragAction, button: MouseButton)
|
|
20
|
-
*/
|
|
13
|
+
* Internal event emitter for mouse state changes.
|
|
14
|
+
*
|
|
15
|
+
* Events:
|
|
16
|
+
* - "position" (position: MousePosition)
|
|
17
|
+
* - "click" (position: MousePosition, action: MouseClickAction, button: MouseButton)
|
|
18
|
+
* - "scroll" (position: MousePosition, direction: MouseScrollAction)
|
|
19
|
+
* - "drag" (position: MousePosition, action: MouseDragAction, button: MouseButton)
|
|
20
|
+
*/
|
|
21
21
|
type MouseEvents = EventEmitter;
|
|
22
22
|
type MouseContextShape = {
|
|
23
23
|
readonly button: MouseButton | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as $}from"node:module";import{version as S,createContext as L}from"react";import R from"react-reconciler";import{NoEventPriority as A,DefaultEventPriority as b}from"react-reconciler/constants.js";import{unstable_shouldYield as P,unstable_scheduleCallback as D,unstable_now as O,unstable_cancelCallback as G}from"scheduler";import n from"yoga-layout";import{b as _,d as f,s as m,m as p,e as F,r as h,f as v,c as w,h as T,j as I}from"./dom-rphpG0kf.js";const x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=x,W=[["top",n.EDGE_TOP],["right",n.EDGE_RIGHT],["bottom",n.EDGE_BOTTOM],["left",n.EDGE_LEFT]],k=(t,e)=>{if("position"in e){let r=n.POSITION_TYPE_RELATIVE;e.position==="absolute"?r=n.POSITION_TYPE_ABSOLUTE:e.position==="static"&&(r=n.POSITION_TYPE_STATIC),t.setPositionType(r)}for(const[r,s]of W){if(!(r in e))continue;const l=e[r];if(typeof l=="string"){t.setPositionPercent(s,Number.parseFloat(l));continue}t.setPosition(s,l)}},B=(t,e)=>{"margin"in e&&t.setMargin(n.EDGE_ALL,e.margin??0),"marginX"in e&&t.setMargin(n.EDGE_HORIZONTAL,e.marginX??0),"marginY"in e&&t.setMargin(n.EDGE_VERTICAL,e.marginY??0),"marginLeft"in e&&t.setMargin(n.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(n.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(n.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(n.EDGE_BOTTOM,e.marginBottom||0)},H=(t,e)=>{"padding"in e&&t.setPadding(n.EDGE_ALL,e.padding??0),"paddingX"in e&&t.setPadding(n.EDGE_HORIZONTAL,e.paddingX??0),"paddingY"in e&&t.setPadding(n.EDGE_VERTICAL,e.paddingY??0),"paddingLeft"in e&&t.setPadding(n.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(n.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(n.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(n.EDGE_BOTTOM,e.paddingBottom||0)},M=(t,e)=>{"flexGrow"in e&&t.setFlexGrow(e.flexGrow??0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexWrap"in e&&(e.flexWrap==="nowrap"&&t.setFlexWrap(n.WRAP_NO_WRAP),e.flexWrap==="wrap"&&t.setFlexWrap(n.WRAP_WRAP),e.flexWrap==="wrap-reverse"&&t.setFlexWrap(n.WRAP_WRAP_REVERSE)),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(n.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(n.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(n.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(n.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(Number.NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(n.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(n.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(n.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(n.ALIGN_FLEX_END),e.alignItems==="baseline"&&t.setAlignItems(n.ALIGN_BASELINE)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(n.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(n.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(n.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(n.ALIGN_FLEX_END),e.alignSelf==="stretch"&&t.setAlignSelf(n.ALIGN_STRETCH),e.alignSelf==="baseline"&&t.setAlignSelf(n.ALIGN_BASELINE)),"alignContent"in e&&((e.alignContent==="flex-start"||!e.alignContent)&&t.setAlignContent(n.ALIGN_FLEX_START),e.alignContent==="center"&&t.setAlignContent(n.ALIGN_CENTER),e.alignContent==="flex-end"&&t.setAlignContent(n.ALIGN_FLEX_END),e.alignContent==="space-between"&&t.setAlignContent(n.ALIGN_SPACE_BETWEEN),e.alignContent==="space-around"&&t.setAlignContent(n.ALIGN_SPACE_AROUND),e.alignContent==="space-evenly"&&t.setAlignContent(n.ALIGN_SPACE_EVENLY),e.alignContent==="stretch"&&t.setAlignContent(n.ALIGN_STRETCH)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(n.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(n.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(n.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(n.JUSTIFY_SPACE_AROUND),e.justifyContent==="space-evenly"&&t.setJustifyContent(n.JUSTIFY_SPACE_EVENLY))},U=(t,e)=>{"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth(e.minWidth??0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight(e.minHeight??0)),"maxWidth"in e&&(typeof e.maxWidth=="string"?t.setMaxWidthPercent(Number.parseInt(e.maxWidth,10)):t.setMaxWidth(e.maxWidth)),"maxHeight"in e&&(typeof e.maxHeight=="string"?t.setMaxHeightPercent(Number.parseInt(e.maxHeight,10)):t.setMaxHeight(e.maxHeight)),"aspectRatio"in e&&t.setAspectRatio(e.aspectRatio)},Y=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?n.DISPLAY_FLEX:n.DISPLAY_NONE)},j=(t,e,r)=>{if(!("borderStyle"in e||"borderTop"in e||"borderBottom"in e||"borderLeft"in e||"borderRight"in e))return;const s=r.borderStyle?1:0;t.setBorder(n.EDGE_TOP,r.borderTop===!1?0:s),t.setBorder(n.EDGE_BOTTOM,r.borderBottom===!1?0:s),t.setBorder(n.EDGE_LEFT,r.borderLeft===!1?0:s),t.setBorder(n.EDGE_RIGHT,r.borderRight===!1?0:s)},X=(t,e)=>{"gap"in e&&t.setGap(n.GUTTER_ALL,e.gap??0),"columnGap"in e&&t.setGap(n.GUTTER_COLUMN,e.columnGap??0),"rowGap"in e&&t.setGap(n.GUTTER_ROW,e.rowGap??0)},V=(t,e)=>{const r=e.overflow??"visible",s=e.overflowX??r,l=e.overflowY??r;s==="scroll"||l==="scroll"?t.setOverflow(n.OVERFLOW_SCROLL):s==="hidden"||l==="hidden"?t.setOverflow(n.OVERFLOW_HIDDEN):t.setOverflow(n.OVERFLOW_VISIBLE)},C=(t,e={},r=e)=>{k(t,e),B(t,e),H(t,e),M(t,e),U(t,e),Y(t,e),j(t,e,r),X(t,e),V(t,r)};if(y.env.DEV==="true"){let t=!1;try{import.meta.resolve("react-devtools-core"),t=!0}catch{}t&&await import("../packem_chunks/devtools.js")}const N=(t,e)=>{if(t===e)return;if(!t)return e;const r={};let s=!1;for(const l of Object.keys(t))(!e||!Object.hasOwn(e,l))&&(r[l]=void 0,s=!0);if(e)for(const l of Object.keys(e))e[l]!==t[l]&&(r[l]=e[l],s=!0);return s?r:void 0},E=t=>{if(t){if(t.yogaNode?.unsetMeasureFunc(),"resizeObservers"in t&&t.resizeObservers?.clear(),"childNodes"in t&&t.childNodes)for(const e of t.childNodes)E(e);t.yogaNode?.free(),"cachedRender"in t&&(t.cachedRender=void 0),"childNodes"in t&&(t.childNodes=[]),t.parentNode=void 0}};let u=A,g;async function J(){const t=(await import("node:fs")).readFileSync(new URL("../package.json",import.meta.url),"utf8"),e=JSON.parse(t);return{name:e?.name,version:e?.version}}let d={name:"ink",version:S};if(y.env.DEV==="true")try{const t=await J();d={name:t.name||d.name,version:t.version||d.version}}catch(t){console.warn("Failed to load package.json in development mode. Falling back to default renderer metadata.",t)}const nt=R({afterActiveInstanceBlur(){},appendChild:f,appendChildToContainer:f,appendInitialChild:f,beforeActiveInstanceBlur(){},cancelCallback:G,cancelTimeout:clearTimeout,clearContainer:()=>!1,commitTextUpdate(t,e,r){m(t,r)},commitUpdate(t,e,r,s){g&&t.internal_static&&(g.isStaticDirty=!0);const l=N(r,s),a=N(r.style,s.style);if(!l&&!a)return;let i=!!a;if(l){for(const[o,c]of Object.entries(l))if(o!=="children"){if(o==="style"){T(t,c);continue}if(o==="internal_transform"){t.internal_transform=c,i=!0;continue}if(o==="internal_cursor"){t.internal_cursor=c,i=!0;continue}if(o==="internal_static"){t.internal_static=!0,i=!0;continue}if(o==="sticky"){t.internal_sticky=c,i=!0;continue}if(o==="internalStickyAlternate"){t.internal_stickyAlternate=c,i=!0;continue}if(o==="opaque"){t.internal_opaque=c,i=!0;continue}if(o==="scrollbar"){t.internal_scrollbar=c,i=!0;continue}if(o==="internal_terminalCursorFocus"){t.internal_terminalCursorFocus=c,i=!0;continue}if(o==="internal_terminalCursorPosition"){t.internal_terminalCursorPosition=c,i=!0;continue}if(o==="cachedRender"){t.cachedRender=c,i=!0;continue}I(t,o,c),i=!0}}a&&t.yogaNode&&C(t.yogaNode,a,s.style??{}),i&&p(t)},createInstance(t,e,r,s){if(s.isInsideText&&t==="ink-box")throw new Error("<Box> can’t be nested inside <Text> component");if(s.isInsideText&&t==="ink-cursor")throw new Error("<Cursor> can’t be nested inside <Text> component");const l=t==="ink-text"&&s.isInsideText?"ink-virtual-text":t,a=w(l);for(const[i,o]of Object.entries(e))if(i!=="children"){if(i==="style"){T(a,o),a.yogaNode&&C(a.yogaNode,o);continue}if(i==="internal_transform"){a.internal_transform=o;continue}if(i==="internal_cursor"){a.internal_cursor=o;continue}if(i==="internal_static"){g=r,a.internal_static=!0,r.isStaticDirty=!0,r.staticNode=a;continue}if(i==="sticky"){a.internal_sticky=o;continue}if(i==="internalStickyAlternate"){a.internal_stickyAlternate=o;continue}if(i==="opaque"){a.internal_opaque=o;continue}if(i==="scrollbar"){a.internal_scrollbar=o;continue}if(i==="internal_terminalCursorFocus"){a.internal_terminalCursorFocus=o;continue}if(i==="internal_terminalCursorPosition"){a.internal_terminalCursorPosition=o;continue}if(i==="internal_static"){a.internal_static=!0;continue}if(i==="cachedRender"){a.cachedRender=o;continue}I(a,i,o)}return a},createTextInstance(t,e,r){if(!r.isInsideText)throw new Error(`Text string "${t}" must be rendered inside <Text> component`);return v(t)},detachDeletedInstance(){},finalizeInitialChildren(){return!1},getChildHostContext(t,e){const r=t.isInsideText,s=e==="ink-text"||e==="ink-virtual-text";return r===s?t:{isInsideText:s}},getCurrentUpdatePriority:()=>u,getInstanceFromNode:()=>null,getInstanceFromScope:()=>null,getPublicInstance:t=>t,getRootHostContext:()=>({isInsideText:!1}),hideInstance(t){t.internal_hidden=!0,t.yogaNode?.setDisplay(n.DISPLAY_NONE),p(t)},hideTextInstance(t){m(t,"")},HostTransitionContext:L(null),insertBefore:_,insertInContainerBefore:_,isPrimaryRenderer:!0,maySuspendCommit(){return!0},noTimeout:-1,NotPendingTransition:void 0,now:O,preloadInstance(){return!0},prepareForCommit:()=>null,preparePortalMount:()=>null,prepareScopeUpdate(){},removeChild(t,e){h(t,e),E(e)},removeChildFromContainer(t,e){h(t,e),E(e)},rendererPackageName:d.name,rendererVersion:d.version,requestPostPaintCallback(){},resetAfterCommit(t){if(typeof t.onComputeLayout=="function"&&t.onComputeLayout(),F(t),t.staticNode!==t.previousStaticNode&&(t.previousStaticNode=t.staticNode,typeof t.onStaticChange=="function"&&t.onStaticChange()),t.isStaticDirty){t.isStaticDirty=!1,typeof t.onImmediateRender=="function"&&t.onImmediateRender();return}typeof t.onRender=="function"&&t.onRender()},resetFormInstance(){},resetTextContent(){},resolveEventTimeStamp(){return-1.1},resolveEventType(){return null},resolveUpdatePriority(){return u!==A?u:b},scheduleCallback:D,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(t){u=t},shouldAttemptEagerTransition(){return!1},shouldSetTextContent:()=>!1,shouldYield:P,startSuspendingCommit(){},supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance(){},trackSchedulerEvent(){},unhideInstance(t){t.internal_hidden=!1,t.yogaNode?.setDisplay(n.DISPLAY_FLEX),p(t)},unhideTextInstance(t,e){m(t,e)},waitForCommitToBeReady(){return null}});export{C as c,nt as j};
|