@vizejs/fresco-native 0.323.0 → 0.325.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +299 -167
- package/package.json +6 -3
- package/vize-fresco.darwin-arm64.node +0 -0
- package/vize-fresco.darwin-x64.node +0 -0
- package/vize-fresco.linux-arm64-gnu.node +0 -0
- package/vize-fresco.linux-arm64-musl.node +0 -0
- package/vize-fresco.linux-x64-gnu.node +0 -0
- package/vize-fresco.linux-x64-musl.node +0 -0
- package/vize-fresco.win32-arm64-msvc.node +0 -0
- package/vize-fresco.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,185 +1,317 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/** Add child to parent node. */
|
|
4
|
+
export declare function addLayoutChild(parent: number, child: number): void
|
|
5
|
+
|
|
6
|
+
/** Clear layout engine. */
|
|
7
|
+
export declare function clearLayout(): void
|
|
8
|
+
|
|
9
|
+
/** Clear a rectangular area. */
|
|
10
|
+
export declare function clearRect(x: number, y: number, width: number, height: number): void
|
|
11
|
+
|
|
12
|
+
/** Clear the screen. */
|
|
13
|
+
export declare function clearScreen(): void
|
|
14
|
+
|
|
15
|
+
/** Compute layout. */
|
|
16
|
+
export declare function computeLayout(width: number, height: number): void
|
|
17
|
+
|
|
18
|
+
/** Create a new leaf layout node with measured size. */
|
|
19
|
+
export declare function createLayoutLeaf(width: number, height: number, style?: FlexStyleNapi | undefined | null): number
|
|
13
20
|
|
|
21
|
+
/** Create a new layout node. */
|
|
22
|
+
export declare function createLayoutNode(style?: FlexStyleNapi | undefined | null): number
|
|
23
|
+
|
|
24
|
+
/** Disable IME. */
|
|
25
|
+
export declare function disableIme(): boolean
|
|
26
|
+
|
|
27
|
+
/** Enable IME. */
|
|
28
|
+
export declare function enableIme(): boolean
|
|
29
|
+
|
|
30
|
+
/** Fill a rectangle with a character. */
|
|
31
|
+
export declare function fillRect(x: number, y: number, width: number, height: number, char?: string | undefined | null, style?: StyleNapi | undefined | null): void
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Flex style options for NAPI.
|
|
35
|
+
* NAPI automatically converts JavaScript camelCase to Rust snake_case.
|
|
36
|
+
*/
|
|
14
37
|
export interface FlexStyleNapi {
|
|
15
|
-
display?: string
|
|
16
|
-
position?: string
|
|
17
|
-
top?: string
|
|
18
|
-
right?: string
|
|
19
|
-
bottom?: string
|
|
20
|
-
left?: string
|
|
21
|
-
overflow?: string
|
|
22
|
-
overflowX?: string
|
|
23
|
-
overflowY?: string
|
|
24
|
-
flexDirection?: string
|
|
25
|
-
flexWrap?: string
|
|
26
|
-
justifyContent?: string
|
|
27
|
-
alignItems?: string
|
|
28
|
-
alignSelf?: string
|
|
29
|
-
alignContent?: string
|
|
30
|
-
flexGrow?: number
|
|
31
|
-
flexShrink?: number
|
|
32
|
-
flexBasis?: string
|
|
33
|
-
width?: string
|
|
34
|
-
height?: string
|
|
35
|
-
minWidth?: string
|
|
36
|
-
minHeight?: string
|
|
37
|
-
maxWidth?: string
|
|
38
|
-
maxHeight?: string
|
|
39
|
-
aspectRatio?: number
|
|
40
|
-
padding?: number
|
|
41
|
-
paddingTop?: number
|
|
42
|
-
paddingRight?: number
|
|
43
|
-
paddingBottom?: number
|
|
44
|
-
paddingLeft?: number
|
|
45
|
-
margin?: number
|
|
46
|
-
marginTop?: number
|
|
47
|
-
marginRight?: number
|
|
48
|
-
marginBottom?: number
|
|
49
|
-
marginLeft?: number
|
|
50
|
-
gap?: number
|
|
51
|
-
columnGap?: number
|
|
52
|
-
rowGap?: number
|
|
38
|
+
display?: string
|
|
39
|
+
position?: string
|
|
40
|
+
top?: string
|
|
41
|
+
right?: string
|
|
42
|
+
bottom?: string
|
|
43
|
+
left?: string
|
|
44
|
+
overflow?: string
|
|
45
|
+
overflowX?: string
|
|
46
|
+
overflowY?: string
|
|
47
|
+
flexDirection?: string
|
|
48
|
+
flexWrap?: string
|
|
49
|
+
justifyContent?: string
|
|
50
|
+
alignItems?: string
|
|
51
|
+
alignSelf?: string
|
|
52
|
+
alignContent?: string
|
|
53
|
+
flexGrow?: number
|
|
54
|
+
flexShrink?: number
|
|
55
|
+
flexBasis?: string
|
|
56
|
+
width?: string
|
|
57
|
+
height?: string
|
|
58
|
+
minWidth?: string
|
|
59
|
+
minHeight?: string
|
|
60
|
+
maxWidth?: string
|
|
61
|
+
maxHeight?: string
|
|
62
|
+
aspectRatio?: number
|
|
63
|
+
padding?: number
|
|
64
|
+
paddingTop?: number
|
|
65
|
+
paddingRight?: number
|
|
66
|
+
paddingBottom?: number
|
|
67
|
+
paddingLeft?: number
|
|
68
|
+
margin?: number
|
|
69
|
+
marginTop?: number
|
|
70
|
+
marginRight?: number
|
|
71
|
+
marginBottom?: number
|
|
72
|
+
marginLeft?: number
|
|
73
|
+
gap?: number
|
|
74
|
+
columnGap?: number
|
|
75
|
+
rowGap?: number
|
|
53
76
|
}
|
|
54
77
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
nodeType: "root" | "box" | "text" | "input";
|
|
58
|
-
text?: string;
|
|
59
|
-
wrap?: boolean;
|
|
60
|
-
wrapMode?: string;
|
|
61
|
-
value?: string;
|
|
62
|
-
placeholder?: string;
|
|
63
|
-
focused?: boolean;
|
|
64
|
-
cursor?: number;
|
|
65
|
-
mask?: boolean;
|
|
66
|
-
maskChar?: string;
|
|
67
|
-
style?: FlexStyleNapi;
|
|
68
|
-
appearance?: StyleNapi;
|
|
69
|
-
border?: string;
|
|
70
|
-
children?: number[];
|
|
71
|
-
}
|
|
78
|
+
/** Flush the terminal buffer. */
|
|
79
|
+
export declare function flushTerminal(): void
|
|
72
80
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
/** Get all layout results. */
|
|
82
|
+
export declare function getAllLayouts(): Array<LayoutResultNapi>
|
|
83
|
+
|
|
84
|
+
/** Get current IME state. */
|
|
85
|
+
export declare function getImeState(): ImeStateNapi
|
|
86
|
+
|
|
87
|
+
/** Get layout results from the most recent renderTree call. */
|
|
88
|
+
export declare function getLastRenderLayouts(): Array<LayoutResultNapi>
|
|
89
|
+
|
|
90
|
+
/** Get layout result for a node. */
|
|
91
|
+
export declare function getLayout(id: number): LayoutResultNapi | null
|
|
92
|
+
|
|
93
|
+
/** Get terminal info. */
|
|
94
|
+
export declare function getTerminalInfo(): TerminalInfoNapi
|
|
95
|
+
|
|
96
|
+
/** Hide cursor. */
|
|
97
|
+
export declare function hideCursor(): void
|
|
98
|
+
|
|
99
|
+
/** IME state for NAPI. */
|
|
100
|
+
export interface ImeStateNapi {
|
|
101
|
+
/** Whether IME is active */
|
|
102
|
+
active: boolean
|
|
103
|
+
/** Current input mode */
|
|
104
|
+
mode: string
|
|
105
|
+
/** Whether currently composing */
|
|
106
|
+
composing: boolean
|
|
107
|
+
/** Preedit text */
|
|
108
|
+
preedit?: string
|
|
109
|
+
/** Cursor position in preedit */
|
|
110
|
+
preeditCursor?: number
|
|
111
|
+
/** Candidate list */
|
|
112
|
+
candidates?: Array<string>
|
|
113
|
+
/** Selected candidate index */
|
|
114
|
+
selected?: number
|
|
82
115
|
}
|
|
83
116
|
|
|
117
|
+
/** Initialize layout engine. */
|
|
118
|
+
export declare function initLayout(): void
|
|
119
|
+
|
|
120
|
+
/** Initialize terminal for TUI mode. */
|
|
121
|
+
export declare function initTerminal(): void
|
|
122
|
+
|
|
123
|
+
/** Initialize terminal with mouse capture. */
|
|
124
|
+
export declare function initTerminalWithMouse(): void
|
|
125
|
+
|
|
126
|
+
/** Initialize terminal with explicit TUI mode options. */
|
|
127
|
+
export declare function initTerminalWithOptions(options: TerminalOptionsNapi): void
|
|
128
|
+
|
|
129
|
+
/** Input event for NAPI. */
|
|
84
130
|
export interface InputEventNapi {
|
|
85
|
-
|
|
86
|
-
key
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
131
|
+
/** Event type: "key" | "mouse" | "resize" | "focus" | "paste" */
|
|
132
|
+
eventType: "key" | "mouse" | "resize" | "focus" | "paste" | (string & {})
|
|
133
|
+
/** Key code (for key events) */
|
|
134
|
+
key?: string
|
|
135
|
+
/** Character (for key events) */
|
|
136
|
+
char?: string
|
|
137
|
+
/** Key event type: "press" | "repeat" | "release" */
|
|
138
|
+
keyEventType?: string
|
|
139
|
+
/** Modifiers: { ctrl, alt, shift, meta } */
|
|
140
|
+
modifiers?: ModifiersNapi
|
|
141
|
+
/** Mouse button (for mouse events) */
|
|
142
|
+
button?: string
|
|
143
|
+
/** Mouse x position */
|
|
144
|
+
x?: number
|
|
145
|
+
/** Mouse y position */
|
|
146
|
+
y?: number
|
|
147
|
+
/** New width (for resize events) */
|
|
148
|
+
width?: number
|
|
149
|
+
/** New height (for resize events) */
|
|
150
|
+
height?: number
|
|
151
|
+
/** Pasted text (for paste events) */
|
|
152
|
+
text?: string
|
|
153
|
+
/** Cursor position (for composition events) */
|
|
154
|
+
cursor?: number
|
|
97
155
|
}
|
|
98
156
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
/** Layout result for NAPI. */
|
|
158
|
+
export interface LayoutResultNapi {
|
|
159
|
+
/** Node ID */
|
|
160
|
+
id: number
|
|
161
|
+
/** X position */
|
|
162
|
+
x: number
|
|
163
|
+
/** Y position */
|
|
164
|
+
y: number
|
|
165
|
+
/** Width */
|
|
166
|
+
width: number
|
|
167
|
+
/** Height */
|
|
168
|
+
height: number
|
|
107
169
|
}
|
|
108
170
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
171
|
+
/** Key modifiers for NAPI. */
|
|
172
|
+
export interface ModifiersNapi {
|
|
173
|
+
ctrl: boolean
|
|
174
|
+
alt: boolean
|
|
175
|
+
shift: boolean
|
|
176
|
+
meta: boolean
|
|
177
|
+
super: boolean
|
|
178
|
+
hyper: boolean
|
|
179
|
+
capsLock: boolean
|
|
180
|
+
numLock: boolean
|
|
114
181
|
}
|
|
115
182
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Poll for input events.
|
|
185
|
+
*
|
|
186
|
+
* Returns an event if available within the timeout, or null if no event.
|
|
187
|
+
*/
|
|
188
|
+
export declare function pollEvent(timeoutMs: number): InputEventNapi | null
|
|
189
|
+
|
|
190
|
+
/** Poll for input events without blocking. */
|
|
191
|
+
export declare function pollEventNonBlocking(): InputEventNapi | null
|
|
192
|
+
|
|
193
|
+
/** Read an input event, blocking until one is available. */
|
|
194
|
+
export declare function readEvent(): InputEventNapi
|
|
195
|
+
|
|
196
|
+
/** Remove child from parent node. */
|
|
197
|
+
export declare function removeLayoutChild(parent: number, child: number): void
|
|
198
|
+
|
|
199
|
+
/** Remove a node. */
|
|
200
|
+
export declare function removeLayoutNode(id: number): void
|
|
201
|
+
|
|
202
|
+
/** Render a box (rectangle). */
|
|
203
|
+
export declare function renderBox(x: number, y: number, width: number, height: number, border?: string | undefined | null, style?: StyleNapi | undefined | null): void
|
|
204
|
+
|
|
205
|
+
/** Render node for NAPI. */
|
|
206
|
+
export interface RenderNodeNapi {
|
|
207
|
+
/** Node ID */
|
|
208
|
+
id: number
|
|
209
|
+
/** Node type accepted by the native renderer. */
|
|
210
|
+
nodeType: "root" | "box" | "text" | "input"
|
|
211
|
+
/** Text content (for text nodes) */
|
|
212
|
+
text?: string
|
|
213
|
+
/** Whether text should wrap */
|
|
214
|
+
wrap?: boolean
|
|
215
|
+
/** Ink-compatible text wrapping/truncation mode */
|
|
216
|
+
wrapMode?: string
|
|
217
|
+
/** Input value (for input nodes) */
|
|
218
|
+
value?: string
|
|
219
|
+
/** Placeholder text (for input nodes) */
|
|
220
|
+
placeholder?: string
|
|
221
|
+
/** Whether input is focused */
|
|
222
|
+
focused?: boolean
|
|
223
|
+
/** Cursor position in input */
|
|
224
|
+
cursor?: number
|
|
225
|
+
/** Whether to mask input (password) */
|
|
226
|
+
mask?: boolean
|
|
227
|
+
/** Mask character */
|
|
228
|
+
maskChar?: string
|
|
229
|
+
/** Flex style */
|
|
230
|
+
style?: FlexStyleNapi
|
|
231
|
+
/** Visual appearance */
|
|
232
|
+
appearance?: StyleNapi
|
|
233
|
+
/** Border style: "none" | "single" | "double" | "rounded" | "heavy" */
|
|
234
|
+
border?: string
|
|
235
|
+
/** Child node IDs */
|
|
236
|
+
children?: Array<number>
|
|
122
237
|
}
|
|
123
238
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
239
|
+
/** Render text at position. */
|
|
240
|
+
export declare function renderText(x: number, y: number, text: string, style?: StyleNapi | undefined | null): void
|
|
241
|
+
|
|
242
|
+
/** Render a tree of nodes. */
|
|
243
|
+
export declare function renderTree(nodes: Array<RenderNodeNapi>): void
|
|
244
|
+
|
|
245
|
+
/** Restore terminal to normal mode. */
|
|
246
|
+
export declare function restoreTerminal(): void
|
|
247
|
+
|
|
248
|
+
/** Set cursor position. */
|
|
249
|
+
export declare function setCursor(x: number, y: number): void
|
|
250
|
+
|
|
251
|
+
/** Set cursor shape. */
|
|
252
|
+
export declare function setCursorShape(shape: "block" | "underline" | "bar" | (string & {})): void
|
|
253
|
+
|
|
254
|
+
/** Set IME input mode. */
|
|
255
|
+
export declare function setImeMode(mode: string): void
|
|
256
|
+
|
|
257
|
+
/** Set layout root node. */
|
|
258
|
+
export declare function setLayoutRoot(id: number): void
|
|
259
|
+
|
|
260
|
+
/** Update node style. */
|
|
261
|
+
export declare function setLayoutStyle(id: number, style: FlexStyleNapi): void
|
|
262
|
+
|
|
263
|
+
/** Show cursor. */
|
|
264
|
+
export declare function showCursor(): void
|
|
265
|
+
|
|
266
|
+
/** Style options for NAPI. */
|
|
267
|
+
export interface StyleNapi {
|
|
268
|
+
/** Foreground color (hex or named) */
|
|
269
|
+
fg?: string
|
|
270
|
+
/** Background color (hex or named) */
|
|
271
|
+
bg?: string
|
|
272
|
+
/** Bold text */
|
|
273
|
+
bold?: boolean
|
|
274
|
+
/** Dim text */
|
|
275
|
+
dim?: boolean
|
|
276
|
+
/** Italic text */
|
|
277
|
+
italic?: boolean
|
|
278
|
+
/** Underline text */
|
|
279
|
+
underline?: boolean
|
|
280
|
+
/** Inverse background/foreground */
|
|
281
|
+
inverse?: boolean
|
|
282
|
+
/** Blinking text */
|
|
283
|
+
blink?: boolean
|
|
284
|
+
/** Hidden text */
|
|
285
|
+
hidden?: boolean
|
|
286
|
+
/** Strikethrough text */
|
|
287
|
+
strikethrough?: boolean
|
|
130
288
|
}
|
|
131
289
|
|
|
132
|
-
|
|
133
|
-
export function
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
export
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
border?: string,
|
|
161
|
-
style?: StyleNapi,
|
|
162
|
-
): void;
|
|
163
|
-
export function fillRect(
|
|
164
|
-
x: number,
|
|
165
|
-
y: number,
|
|
166
|
-
width: number,
|
|
167
|
-
height: number,
|
|
168
|
-
char?: string,
|
|
169
|
-
style?: StyleNapi,
|
|
170
|
-
): void;
|
|
171
|
-
export function clearRect(x: number, y: number, width: number, height: number): void;
|
|
172
|
-
export function setCursor(x: number, y: number): void;
|
|
173
|
-
export function showCursor(): void;
|
|
174
|
-
export function hideCursor(): void;
|
|
175
|
-
export function setCursorShape(shape: "block" | "underline" | "bar" | (string & {})): void;
|
|
176
|
-
export function renderTree(nodes: RenderNodeNapi[]): void;
|
|
177
|
-
export function getLastRenderLayouts(): LayoutResultNapi[];
|
|
178
|
-
|
|
179
|
-
export function pollEvent(timeoutMs: number): InputEventNapi | undefined;
|
|
180
|
-
export function pollEventNonBlocking(): InputEventNapi | undefined;
|
|
181
|
-
export function readEvent(): InputEventNapi;
|
|
182
|
-
export function getImeState(): ImeStateNapi;
|
|
183
|
-
export function enableIme(): boolean;
|
|
184
|
-
export function disableIme(): boolean;
|
|
185
|
-
export function setImeMode(mode: string): boolean;
|
|
290
|
+
/** Sync terminal size (call after resize events). */
|
|
291
|
+
export declare function syncTerminalSize(): boolean
|
|
292
|
+
|
|
293
|
+
/** Terminal info for NAPI. */
|
|
294
|
+
export interface TerminalInfoNapi {
|
|
295
|
+
/** Terminal width in columns */
|
|
296
|
+
width: number
|
|
297
|
+
/** Terminal height in rows */
|
|
298
|
+
height: number
|
|
299
|
+
/** Whether colors are supported */
|
|
300
|
+
colors: boolean
|
|
301
|
+
/** Whether true color (24-bit) is supported */
|
|
302
|
+
trueColor: boolean
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Terminal initialization options for NAPI. */
|
|
306
|
+
export interface TerminalOptionsNapi {
|
|
307
|
+
/** Enable raw mode */
|
|
308
|
+
rawMode?: boolean
|
|
309
|
+
/** Enable the alternate screen buffer */
|
|
310
|
+
alternateScreen?: boolean
|
|
311
|
+
/** Enable mouse capture */
|
|
312
|
+
mouse?: boolean
|
|
313
|
+
/** Enable bracketed paste mode */
|
|
314
|
+
bracketedPaste?: boolean
|
|
315
|
+
/** Hide the terminal cursor */
|
|
316
|
+
hideCursor?: boolean
|
|
317
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/fresco-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.325.0",
|
|
4
4
|
"description": "Vue TUI framework - Native bindings",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fresco",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@napi-rs/cli": "3.6.2"
|
|
35
|
+
"@napi-rs/cli": "3.6.2",
|
|
36
|
+
"typescript": "6.0.3"
|
|
36
37
|
},
|
|
37
38
|
"napi": {
|
|
38
39
|
"binaryName": "vize-fresco",
|
|
@@ -53,6 +54,8 @@
|
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "napi build --platform --release --manifest-path ../../crates/vize_fresco/Cargo.toml -p vize_fresco --features napi --output-dir .",
|
|
55
56
|
"build:ci": "napi build --platform --profile ci --manifest-path ../../crates/vize_fresco/Cargo.toml -p vize_fresco --features napi --output-dir .",
|
|
56
|
-
"build:debug": "napi build --platform --manifest-path ../../crates/vize_fresco/Cargo.toml -p vize_fresco --features napi --output-dir ."
|
|
57
|
+
"build:debug": "napi build --platform --manifest-path ../../crates/vize_fresco/Cargo.toml -p vize_fresco --features napi --output-dir .",
|
|
58
|
+
"check:generated": "node ./scripts/verify-generated-contract.mjs --profile ci",
|
|
59
|
+
"check:types": "node ./scripts/verify-consumer-types.mjs"
|
|
57
60
|
}
|
|
58
61
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|