@opentui/core 0.0.0-20251202-52296102 → 0.0.0-20251205-41c885f6

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.
@@ -1,1286 +1,4 @@
1
1
  // @bun
2
- import {
3
- __export,
4
- __require,
5
- __toESM
6
- } from "./index-g8dczzvv.js";
7
-
8
- // ../../node_modules/bun-yoga/dist/index.js
9
- var exports_dist = {};
10
- __export(exports_dist, {
11
- default: () => dist_default,
12
- Wrap: () => Wrap,
13
- WRAP_WRAP_REVERSE: () => WRAP_WRAP_REVERSE,
14
- WRAP_WRAP: () => WRAP_WRAP,
15
- WRAP_NO_WRAP: () => WRAP_NO_WRAP,
16
- Unit: () => Unit,
17
- PositionType: () => PositionType,
18
- POSITION_TYPE_STATIC: () => POSITION_TYPE_STATIC,
19
- POSITION_TYPE_RELATIVE: () => POSITION_TYPE_RELATIVE,
20
- POSITION_TYPE_ABSOLUTE: () => POSITION_TYPE_ABSOLUTE,
21
- Overflow: () => Overflow,
22
- OVERFLOW_VISIBLE: () => OVERFLOW_VISIBLE,
23
- OVERFLOW_SCROLL: () => OVERFLOW_SCROLL,
24
- OVERFLOW_HIDDEN: () => OVERFLOW_HIDDEN,
25
- NodeType: () => NodeType,
26
- Node: () => Node,
27
- MeasureMode: () => MeasureMode,
28
- LogLevel: () => LogLevel,
29
- Justify: () => Justify,
30
- JUSTIFY_SPACE_EVENLY: () => JUSTIFY_SPACE_EVENLY,
31
- JUSTIFY_SPACE_BETWEEN: () => JUSTIFY_SPACE_BETWEEN,
32
- JUSTIFY_SPACE_AROUND: () => JUSTIFY_SPACE_AROUND,
33
- JUSTIFY_FLEX_START: () => JUSTIFY_FLEX_START,
34
- JUSTIFY_FLEX_END: () => JUSTIFY_FLEX_END,
35
- JUSTIFY_CENTER: () => JUSTIFY_CENTER,
36
- Gutter: () => Gutter,
37
- FlexDirection: () => FlexDirection,
38
- FLEX_DIRECTION_ROW_REVERSE: () => FLEX_DIRECTION_ROW_REVERSE,
39
- FLEX_DIRECTION_ROW: () => FLEX_DIRECTION_ROW,
40
- FLEX_DIRECTION_COLUMN_REVERSE: () => FLEX_DIRECTION_COLUMN_REVERSE,
41
- FLEX_DIRECTION_COLUMN: () => FLEX_DIRECTION_COLUMN,
42
- ExperimentalFeature: () => ExperimentalFeature,
43
- Errata: () => Errata,
44
- Edge: () => Edge,
45
- EDGE_VERTICAL: () => EDGE_VERTICAL,
46
- EDGE_TOP: () => EDGE_TOP,
47
- EDGE_START: () => EDGE_START,
48
- EDGE_RIGHT: () => EDGE_RIGHT,
49
- EDGE_LEFT: () => EDGE_LEFT,
50
- EDGE_HORIZONTAL: () => EDGE_HORIZONTAL,
51
- EDGE_END: () => EDGE_END,
52
- EDGE_BOTTOM: () => EDGE_BOTTOM,
53
- EDGE_ALL: () => EDGE_ALL,
54
- Display: () => Display,
55
- Direction: () => Direction,
56
- Dimension: () => Dimension,
57
- DISPLAY_NONE: () => DISPLAY_NONE,
58
- DISPLAY_FLEX: () => DISPLAY_FLEX,
59
- DIRECTION_RTL: () => DIRECTION_RTL,
60
- DIRECTION_LTR: () => DIRECTION_LTR,
61
- DIRECTION_INHERIT: () => DIRECTION_INHERIT,
62
- Config: () => Config,
63
- BoxSizing: () => BoxSizing,
64
- Align: () => Align,
65
- ALIGN_STRETCH: () => ALIGN_STRETCH,
66
- ALIGN_SPACE_EVENLY: () => ALIGN_SPACE_EVENLY,
67
- ALIGN_SPACE_BETWEEN: () => ALIGN_SPACE_BETWEEN,
68
- ALIGN_SPACE_AROUND: () => ALIGN_SPACE_AROUND,
69
- ALIGN_FLEX_START: () => ALIGN_FLEX_START,
70
- ALIGN_FLEX_END: () => ALIGN_FLEX_END,
71
- ALIGN_CENTER: () => ALIGN_CENTER,
72
- ALIGN_BASELINE: () => ALIGN_BASELINE,
73
- ALIGN_AUTO: () => ALIGN_AUTO
74
- });
75
- import { dlopen, suffix, JSCallback, FFIType } from "bun:ffi";
76
- import { join } from "path";
77
- import { existsSync } from "fs";
78
- var __dirname = "/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist";
79
- var embeddedLib = await (async () => {
80
- try {
81
- if (process.platform === "darwin" && process.arch === "arm64") {
82
- return (await import("./libyoga-m7gmcz0e.js", { with: { type: "file" } })).default;
83
- } else if (process.platform === "darwin" && process.arch === "x64") {
84
- return (await import("./libyoga-jkq1dr7g.js", { with: { type: "file" } })).default;
85
- } else if (process.platform === "linux" && process.arch === "x64") {
86
- return (await import("./libyoga-zt51h244.js", { with: { type: "file" } })).default;
87
- } else if (process.platform === "linux" && process.arch === "arm64") {
88
- return (await import("./libyoga-jjdjx62k.js", { with: { type: "file" } })).default;
89
- } else if (process.platform === "win32") {
90
- return (await import("./yoga-merwjcba.js", { with: { type: "file" } })).default;
91
- }
92
- } catch {}
93
- return;
94
- })();
95
- function getLibPath() {
96
- if (process.platform === "win32") {
97
- if (existsSync(join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`))) {
98
- return join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`);
99
- }
100
- if (existsSync(join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`))) {
101
- return join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`);
102
- }
103
- } else {
104
- if (existsSync(join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`))) {
105
- return join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`);
106
- }
107
- }
108
- if (embeddedLib && existsSync(embeddedLib)) {
109
- return embeddedLib;
110
- }
111
- throw new Error(`Could not find native library. Platform: ${process.platform}-${process.arch}
112
- Make sure to run 'zig build' or install the package with binaries.`);
113
- }
114
- var Align = {
115
- Auto: 0,
116
- FlexStart: 1,
117
- Center: 2,
118
- FlexEnd: 3,
119
- Stretch: 4,
120
- Baseline: 5,
121
- SpaceBetween: 6,
122
- SpaceAround: 7,
123
- SpaceEvenly: 8
124
- };
125
- var BoxSizing = {
126
- BorderBox: 0,
127
- ContentBox: 1
128
- };
129
- var Dimension = {
130
- Width: 0,
131
- Height: 1
132
- };
133
- var Direction = {
134
- Inherit: 0,
135
- LTR: 1,
136
- RTL: 2
137
- };
138
- var Display = {
139
- Flex: 0,
140
- None: 1,
141
- Contents: 2
142
- };
143
- var Edge = {
144
- Left: 0,
145
- Top: 1,
146
- Right: 2,
147
- Bottom: 3,
148
- Start: 4,
149
- End: 5,
150
- Horizontal: 6,
151
- Vertical: 7,
152
- All: 8
153
- };
154
- var Errata = {
155
- None: 0,
156
- StretchFlexBasis: 1,
157
- AbsolutePositionWithoutInsetsExcludesPadding: 2,
158
- AbsolutePercentAgainstInnerSize: 4,
159
- All: 2147483647,
160
- Classic: 2147483646
161
- };
162
- var ExperimentalFeature = {
163
- WebFlexBasis: 0
164
- };
165
- var FlexDirection = {
166
- Column: 0,
167
- ColumnReverse: 1,
168
- Row: 2,
169
- RowReverse: 3
170
- };
171
- var Gutter = {
172
- Column: 0,
173
- Row: 1,
174
- All: 2
175
- };
176
- var Justify = {
177
- FlexStart: 0,
178
- Center: 1,
179
- FlexEnd: 2,
180
- SpaceBetween: 3,
181
- SpaceAround: 4,
182
- SpaceEvenly: 5
183
- };
184
- var LogLevel = {
185
- Error: 0,
186
- Warn: 1,
187
- Info: 2,
188
- Debug: 3,
189
- Verbose: 4,
190
- Fatal: 5
191
- };
192
- var MeasureMode = {
193
- Undefined: 0,
194
- Exactly: 1,
195
- AtMost: 2
196
- };
197
- var NodeType = {
198
- Default: 0,
199
- Text: 1
200
- };
201
- var Overflow = {
202
- Visible: 0,
203
- Hidden: 1,
204
- Scroll: 2
205
- };
206
- var PositionType = {
207
- Static: 0,
208
- Relative: 1,
209
- Absolute: 2
210
- };
211
- var Unit = {
212
- Undefined: 0,
213
- Point: 1,
214
- Percent: 2,
215
- Auto: 3
216
- };
217
- var Wrap = {
218
- NoWrap: 0,
219
- Wrap: 1,
220
- WrapReverse: 2
221
- };
222
- var EDGE_LEFT = Edge.Left;
223
- var EDGE_TOP = Edge.Top;
224
- var EDGE_RIGHT = Edge.Right;
225
- var EDGE_BOTTOM = Edge.Bottom;
226
- var EDGE_START = Edge.Start;
227
- var EDGE_END = Edge.End;
228
- var EDGE_HORIZONTAL = Edge.Horizontal;
229
- var EDGE_VERTICAL = Edge.Vertical;
230
- var EDGE_ALL = Edge.All;
231
- var FLEX_DIRECTION_COLUMN = FlexDirection.Column;
232
- var FLEX_DIRECTION_COLUMN_REVERSE = FlexDirection.ColumnReverse;
233
- var FLEX_DIRECTION_ROW = FlexDirection.Row;
234
- var FLEX_DIRECTION_ROW_REVERSE = FlexDirection.RowReverse;
235
- var JUSTIFY_FLEX_START = Justify.FlexStart;
236
- var JUSTIFY_CENTER = Justify.Center;
237
- var JUSTIFY_FLEX_END = Justify.FlexEnd;
238
- var JUSTIFY_SPACE_BETWEEN = Justify.SpaceBetween;
239
- var JUSTIFY_SPACE_AROUND = Justify.SpaceAround;
240
- var JUSTIFY_SPACE_EVENLY = Justify.SpaceEvenly;
241
- var ALIGN_AUTO = Align.Auto;
242
- var ALIGN_FLEX_START = Align.FlexStart;
243
- var ALIGN_CENTER = Align.Center;
244
- var ALIGN_FLEX_END = Align.FlexEnd;
245
- var ALIGN_STRETCH = Align.Stretch;
246
- var ALIGN_BASELINE = Align.Baseline;
247
- var ALIGN_SPACE_BETWEEN = Align.SpaceBetween;
248
- var ALIGN_SPACE_AROUND = Align.SpaceAround;
249
- var ALIGN_SPACE_EVENLY = Align.SpaceEvenly;
250
- var WRAP_NO_WRAP = Wrap.NoWrap;
251
- var WRAP_WRAP = Wrap.Wrap;
252
- var WRAP_WRAP_REVERSE = Wrap.WrapReverse;
253
- var OVERFLOW_VISIBLE = Overflow.Visible;
254
- var OVERFLOW_HIDDEN = Overflow.Hidden;
255
- var OVERFLOW_SCROLL = Overflow.Scroll;
256
- var DISPLAY_FLEX = Display.Flex;
257
- var DISPLAY_NONE = Display.None;
258
- var POSITION_TYPE_STATIC = PositionType.Static;
259
- var POSITION_TYPE_RELATIVE = PositionType.Relative;
260
- var POSITION_TYPE_ABSOLUTE = PositionType.Absolute;
261
- var DIRECTION_INHERIT = Direction.Inherit;
262
- var DIRECTION_LTR = Direction.LTR;
263
- var DIRECTION_RTL = Direction.RTL;
264
- function parseValue(value) {
265
- if (value === undefined) {
266
- return { unit: Unit.Undefined, asNumber: undefined };
267
- }
268
- if (value === "auto") {
269
- return { unit: Unit.Auto, asNumber: undefined };
270
- }
271
- if (typeof value === "string" && value.endsWith("%")) {
272
- return { unit: Unit.Percent, asNumber: parseFloat(value) };
273
- }
274
- return { unit: Unit.Point, asNumber: value };
275
- }
276
- var UNDEFINED_VALUE = { unit: Unit.Undefined, value: NaN };
277
- function unpackValue(packed) {
278
- const p = BigInt(packed);
279
- const unit = Number(p & 0xffffffffn);
280
- const valueBits = Number(p >> 32n & 0xffffffffn);
281
- const buffer = new ArrayBuffer(4);
282
- const view = new DataView(buffer);
283
- view.setUint32(0, valueBits, true);
284
- const value = view.getFloat32(0, true);
285
- return { unit, value };
286
- }
287
- var lib = dlopen(getLibPath(), {
288
- ygConfigNew: { args: [], returns: "ptr" },
289
- ygConfigFree: { args: ["ptr"], returns: "void" },
290
- ygConfigGetDefault: { args: [], returns: "ptr" },
291
- ygConfigSetUseWebDefaults: { args: ["ptr", "bool"], returns: "void" },
292
- ygConfigGetUseWebDefaults: { args: ["ptr"], returns: "bool" },
293
- ygConfigSetPointScaleFactor: { args: ["ptr", "f32"], returns: "void" },
294
- ygConfigGetPointScaleFactor: { args: ["ptr"], returns: "f32" },
295
- ygConfigSetErrata: { args: ["ptr", "i32"], returns: "void" },
296
- ygConfigGetErrata: { args: ["ptr"], returns: "i32" },
297
- ygConfigSetExperimentalFeatureEnabled: {
298
- args: ["ptr", "i32", "bool"],
299
- returns: "void"
300
- },
301
- ygConfigIsExperimentalFeatureEnabled: {
302
- args: ["ptr", "i32"],
303
- returns: "bool"
304
- },
305
- ygNodeNew: { args: [], returns: "ptr" },
306
- ygNodeNewWithConfig: { args: ["ptr"], returns: "ptr" },
307
- ygNodeClone: { args: ["ptr"], returns: "ptr" },
308
- ygNodeFree: { args: ["ptr"], returns: "void" },
309
- ygNodeFreeRecursive: { args: ["ptr"], returns: "void" },
310
- ygNodeReset: { args: ["ptr"], returns: "void" },
311
- ygNodeCopyStyle: { args: ["ptr", "ptr"], returns: "void" },
312
- ygNodeSetIsReferenceBaseline: { args: ["ptr", "bool"], returns: "void" },
313
- ygNodeIsReferenceBaseline: { args: ["ptr"], returns: "bool" },
314
- ygNodeSetAlwaysFormsContainingBlock: {
315
- args: ["ptr", "bool"],
316
- returns: "void"
317
- },
318
- ygNodeInsertChild: { args: ["ptr", "ptr", "u64"], returns: "void" },
319
- ygNodeRemoveChild: { args: ["ptr", "ptr"], returns: "void" },
320
- ygNodeRemoveAllChildren: { args: ["ptr"], returns: "void" },
321
- ygNodeGetChild: { args: ["ptr", "u64"], returns: "ptr" },
322
- ygNodeGetChildCount: { args: ["ptr"], returns: "u64" },
323
- ygNodeGetParent: { args: ["ptr"], returns: "ptr" },
324
- ygNodeCalculateLayout: { args: ["ptr", "f32", "f32", "i32"], returns: "void" },
325
- ygNodeGetHasNewLayout: { args: ["ptr"], returns: "bool" },
326
- ygNodeSetHasNewLayout: { args: ["ptr", "bool"], returns: "void" },
327
- ygNodeMarkDirty: { args: ["ptr"], returns: "void" },
328
- ygNodeIsDirty: { args: ["ptr"], returns: "bool" },
329
- ygNodeLayoutGetLeft: { args: ["ptr"], returns: "f32" },
330
- ygNodeLayoutGetTop: { args: ["ptr"], returns: "f32" },
331
- ygNodeLayoutGetRight: { args: ["ptr"], returns: "f32" },
332
- ygNodeLayoutGetBottom: { args: ["ptr"], returns: "f32" },
333
- ygNodeLayoutGetWidth: { args: ["ptr"], returns: "f32" },
334
- ygNodeLayoutGetHeight: { args: ["ptr"], returns: "f32" },
335
- ygNodeLayoutGetBorder: { args: ["ptr", "i32"], returns: "f32" },
336
- ygNodeLayoutGetMargin: { args: ["ptr", "i32"], returns: "f32" },
337
- ygNodeLayoutGetPadding: { args: ["ptr", "i32"], returns: "f32" },
338
- ygNodeStyleSetDirection: { args: ["ptr", "i32"], returns: "void" },
339
- ygNodeStyleGetDirection: { args: ["ptr"], returns: "i32" },
340
- ygNodeStyleSetFlexDirection: { args: ["ptr", "i32"], returns: "void" },
341
- ygNodeStyleGetFlexDirection: { args: ["ptr"], returns: "i32" },
342
- ygNodeStyleSetJustifyContent: { args: ["ptr", "i32"], returns: "void" },
343
- ygNodeStyleGetJustifyContent: { args: ["ptr"], returns: "i32" },
344
- ygNodeStyleSetAlignContent: { args: ["ptr", "i32"], returns: "void" },
345
- ygNodeStyleGetAlignContent: { args: ["ptr"], returns: "i32" },
346
- ygNodeStyleSetAlignItems: { args: ["ptr", "i32"], returns: "void" },
347
- ygNodeStyleGetAlignItems: { args: ["ptr"], returns: "i32" },
348
- ygNodeStyleSetAlignSelf: { args: ["ptr", "i32"], returns: "void" },
349
- ygNodeStyleGetAlignSelf: { args: ["ptr"], returns: "i32" },
350
- ygNodeStyleSetPositionType: { args: ["ptr", "i32"], returns: "void" },
351
- ygNodeStyleGetPositionType: { args: ["ptr"], returns: "i32" },
352
- ygNodeStyleSetFlexWrap: { args: ["ptr", "i32"], returns: "void" },
353
- ygNodeStyleGetFlexWrap: { args: ["ptr"], returns: "i32" },
354
- ygNodeStyleSetOverflow: { args: ["ptr", "i32"], returns: "void" },
355
- ygNodeStyleGetOverflow: { args: ["ptr"], returns: "i32" },
356
- ygNodeStyleSetDisplay: { args: ["ptr", "i32"], returns: "void" },
357
- ygNodeStyleGetDisplay: { args: ["ptr"], returns: "i32" },
358
- ygNodeStyleSetBoxSizing: { args: ["ptr", "i32"], returns: "void" },
359
- ygNodeStyleGetBoxSizing: { args: ["ptr"], returns: "i32" },
360
- ygNodeStyleSetFlex: { args: ["ptr", "f32"], returns: "void" },
361
- ygNodeStyleGetFlex: { args: ["ptr"], returns: "f32" },
362
- ygNodeStyleSetFlexGrow: { args: ["ptr", "f32"], returns: "void" },
363
- ygNodeStyleGetFlexGrow: { args: ["ptr"], returns: "f32" },
364
- ygNodeStyleSetFlexShrink: { args: ["ptr", "f32"], returns: "void" },
365
- ygNodeStyleGetFlexShrink: { args: ["ptr"], returns: "f32" },
366
- ygNodeStyleSetFlexBasis: { args: ["ptr", "f32"], returns: "void" },
367
- ygNodeStyleSetFlexBasisPercent: { args: ["ptr", "f32"], returns: "void" },
368
- ygNodeStyleSetFlexBasisAuto: { args: ["ptr"], returns: "void" },
369
- ygNodeStyleSetPosition: { args: ["ptr", "i32", "f32"], returns: "void" },
370
- ygNodeStyleSetPositionPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
371
- ygNodeStyleSetPositionAuto: { args: ["ptr", "i32"], returns: "void" },
372
- ygNodeStyleSetMargin: { args: ["ptr", "i32", "f32"], returns: "void" },
373
- ygNodeStyleSetMarginPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
374
- ygNodeStyleSetMarginAuto: { args: ["ptr", "i32"], returns: "void" },
375
- ygNodeStyleSetPadding: { args: ["ptr", "i32", "f32"], returns: "void" },
376
- ygNodeStyleSetPaddingPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
377
- ygNodeStyleSetBorder: { args: ["ptr", "i32", "f32"], returns: "void" },
378
- ygNodeStyleGetBorder: { args: ["ptr", "i32"], returns: "f32" },
379
- ygNodeStyleSetGap: { args: ["ptr", "i32", "f32"], returns: "void" },
380
- ygNodeStyleSetGapPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
381
- ygNodeStyleSetWidth: { args: ["ptr", "f32"], returns: "void" },
382
- ygNodeStyleSetWidthPercent: { args: ["ptr", "f32"], returns: "void" },
383
- ygNodeStyleSetWidthAuto: { args: ["ptr"], returns: "void" },
384
- ygNodeStyleSetHeight: { args: ["ptr", "f32"], returns: "void" },
385
- ygNodeStyleSetHeightPercent: { args: ["ptr", "f32"], returns: "void" },
386
- ygNodeStyleSetHeightAuto: { args: ["ptr"], returns: "void" },
387
- ygNodeStyleSetMinWidth: { args: ["ptr", "f32"], returns: "void" },
388
- ygNodeStyleSetMinWidthPercent: { args: ["ptr", "f32"], returns: "void" },
389
- ygNodeStyleSetMinHeight: { args: ["ptr", "f32"], returns: "void" },
390
- ygNodeStyleSetMinHeightPercent: { args: ["ptr", "f32"], returns: "void" },
391
- ygNodeStyleSetMaxWidth: { args: ["ptr", "f32"], returns: "void" },
392
- ygNodeStyleSetMaxWidthPercent: { args: ["ptr", "f32"], returns: "void" },
393
- ygNodeStyleSetMaxHeight: { args: ["ptr", "f32"], returns: "void" },
394
- ygNodeStyleSetMaxHeightPercent: { args: ["ptr", "f32"], returns: "void" },
395
- ygNodeStyleSetAspectRatio: { args: ["ptr", "f32"], returns: "void" },
396
- ygNodeStyleGetAspectRatio: { args: ["ptr"], returns: "f32" },
397
- ygNodeSetContext: { args: ["ptr", "ptr"], returns: "void" },
398
- ygNodeGetContext: { args: ["ptr"], returns: "ptr" },
399
- ygNodeSetMeasureFunc: { args: ["ptr", "ptr"], returns: "void" },
400
- ygNodeUnsetMeasureFunc: { args: ["ptr"], returns: "void" },
401
- ygNodeHasMeasureFunc: { args: ["ptr"], returns: "bool" },
402
- ygNodeSetBaselineFunc: { args: ["ptr", "ptr"], returns: "void" },
403
- ygNodeUnsetBaselineFunc: { args: ["ptr"], returns: "void" },
404
- ygNodeHasBaselineFunc: { args: ["ptr"], returns: "bool" },
405
- ygNodeSetDirtiedFunc: { args: ["ptr", "ptr"], returns: "void" },
406
- ygNodeUnsetDirtiedFunc: { args: ["ptr"], returns: "void" },
407
- ygNodeGetDirtiedFunc: { args: ["ptr"], returns: "ptr" },
408
- ygCreateSize: { args: ["f32", "f32"], returns: "u64" },
409
- ygStoreMeasureResult: { args: ["f32", "f32"], returns: "void" },
410
- ygStoreBaselineResult: { args: ["f32"], returns: "void" },
411
- ygNodeSetMeasureFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
412
- ygNodeUnsetMeasureFuncTrampoline: { args: ["ptr"], returns: "void" },
413
- ygNodeSetBaselineFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
414
- ygNodeUnsetBaselineFuncTrampoline: { args: ["ptr"], returns: "void" },
415
- ygNodeFreeCallbacks: { args: ["ptr"], returns: "void" },
416
- ygNodeStyleGetWidthPacked: { args: ["ptr"], returns: "u64" },
417
- ygNodeStyleGetHeightPacked: { args: ["ptr"], returns: "u64" },
418
- ygNodeStyleGetMinWidthPacked: { args: ["ptr"], returns: "u64" },
419
- ygNodeStyleGetMinHeightPacked: { args: ["ptr"], returns: "u64" },
420
- ygNodeStyleGetMaxWidthPacked: { args: ["ptr"], returns: "u64" },
421
- ygNodeStyleGetMaxHeightPacked: { args: ["ptr"], returns: "u64" },
422
- ygNodeStyleGetMarginPacked: { args: ["ptr", "i32"], returns: "u64" },
423
- ygNodeStyleGetPaddingPacked: { args: ["ptr", "i32"], returns: "u64" },
424
- ygNodeStyleGetPositionPacked: { args: ["ptr", "i32"], returns: "u64" },
425
- ygNodeStyleGetGapPacked: { args: ["ptr", "i32"], returns: "u64" },
426
- ygNodeStyleGetFlexBasisPacked: { args: ["ptr"], returns: "u64" }
427
- });
428
- var yg = lib.symbols;
429
-
430
- class Node {
431
- ptr;
432
- _freed = false;
433
- measureCallback = null;
434
- baselineCallback = null;
435
- dirtiedCallback = null;
436
- constructor(ptr) {
437
- this.ptr = ptr;
438
- }
439
- isFreed() {
440
- return this._freed;
441
- }
442
- static create(config) {
443
- const ptr = config ? yg.ygNodeNewWithConfig(config["ptr"]) : yg.ygNodeNew();
444
- if (!ptr)
445
- throw new Error("Failed to create node");
446
- return new Node(ptr);
447
- }
448
- static createDefault() {
449
- return Node.create();
450
- }
451
- static createWithConfig(config) {
452
- return Node.create(config);
453
- }
454
- static destroy(node) {
455
- node.free();
456
- }
457
- free() {
458
- if (this._freed)
459
- return;
460
- this.unsetMeasureFunc();
461
- this.unsetBaselineFunc();
462
- this.unsetDirtiedFunc();
463
- yg.ygNodeFree(this.ptr);
464
- this._freed = true;
465
- }
466
- freeRecursive() {
467
- if (this._freed)
468
- return;
469
- this.cleanupCallbacks();
470
- yg.ygNodeFreeRecursive(this.ptr);
471
- this._freed = true;
472
- }
473
- reset() {
474
- if (this._freed)
475
- return;
476
- this.cleanupCallbacks();
477
- yg.ygNodeReset(this.ptr);
478
- }
479
- cleanupCallbacks() {
480
- if (this.measureCallback) {
481
- this.measureCallback.close();
482
- this.measureCallback = null;
483
- }
484
- if (this.baselineCallback) {
485
- this.baselineCallback.close();
486
- this.baselineCallback = null;
487
- }
488
- if (this.dirtiedCallback) {
489
- this.dirtiedCallback.close();
490
- this.dirtiedCallback = null;
491
- }
492
- }
493
- clone() {
494
- if (this._freed)
495
- throw new Error("Cannot clone freed node");
496
- const ptr = yg.ygNodeClone(this.ptr);
497
- if (!ptr)
498
- throw new Error("Failed to clone node");
499
- return new Node(ptr);
500
- }
501
- copyStyle(node) {
502
- if (this._freed)
503
- return;
504
- yg.ygNodeCopyStyle(this.ptr, node.ptr);
505
- }
506
- setIsReferenceBaseline(isReferenceBaseline) {
507
- if (this._freed)
508
- return;
509
- yg.ygNodeSetIsReferenceBaseline(this.ptr, isReferenceBaseline);
510
- }
511
- isReferenceBaseline() {
512
- if (this._freed)
513
- return false;
514
- return yg.ygNodeIsReferenceBaseline(this.ptr);
515
- }
516
- setAlwaysFormsContainingBlock(alwaysFormsContainingBlock) {
517
- if (this._freed)
518
- return;
519
- yg.ygNodeSetAlwaysFormsContainingBlock(this.ptr, alwaysFormsContainingBlock);
520
- }
521
- insertChild(child, index) {
522
- if (this._freed)
523
- return;
524
- yg.ygNodeInsertChild(this.ptr, child.ptr, index);
525
- }
526
- removeChild(child) {
527
- if (this._freed)
528
- return;
529
- yg.ygNodeRemoveChild(this.ptr, child.ptr);
530
- }
531
- removeAllChildren() {
532
- if (this._freed)
533
- return;
534
- yg.ygNodeRemoveAllChildren(this.ptr);
535
- }
536
- getChild(index) {
537
- if (this._freed)
538
- return null;
539
- const ptr = yg.ygNodeGetChild(this.ptr, index);
540
- return ptr ? new Node(ptr) : null;
541
- }
542
- getChildCount() {
543
- if (this._freed)
544
- return 0;
545
- return Number(yg.ygNodeGetChildCount(this.ptr));
546
- }
547
- getParent() {
548
- if (this._freed)
549
- return null;
550
- const ptr = yg.ygNodeGetParent(this.ptr);
551
- return ptr ? new Node(ptr) : null;
552
- }
553
- calculateLayout(width, height, direction = Direction.LTR) {
554
- if (this._freed)
555
- return;
556
- const w = width === "auto" || width === undefined ? NaN : width;
557
- const h = height === "auto" || height === undefined ? NaN : height;
558
- yg.ygNodeCalculateLayout(this.ptr, w, h, direction);
559
- }
560
- hasNewLayout() {
561
- if (this._freed)
562
- return false;
563
- return yg.ygNodeGetHasNewLayout(this.ptr);
564
- }
565
- markLayoutSeen() {
566
- if (this._freed)
567
- return;
568
- yg.ygNodeSetHasNewLayout(this.ptr, false);
569
- }
570
- markDirty() {
571
- if (this._freed)
572
- return;
573
- yg.ygNodeMarkDirty(this.ptr);
574
- }
575
- isDirty() {
576
- if (this._freed)
577
- return true;
578
- return yg.ygNodeIsDirty(this.ptr);
579
- }
580
- getComputedLayout() {
581
- if (this._freed)
582
- return { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 };
583
- return {
584
- left: yg.ygNodeLayoutGetLeft(this.ptr),
585
- top: yg.ygNodeLayoutGetTop(this.ptr),
586
- right: yg.ygNodeLayoutGetRight(this.ptr),
587
- bottom: yg.ygNodeLayoutGetBottom(this.ptr),
588
- width: yg.ygNodeLayoutGetWidth(this.ptr),
589
- height: yg.ygNodeLayoutGetHeight(this.ptr)
590
- };
591
- }
592
- getComputedLeft() {
593
- if (this._freed)
594
- return 0;
595
- return yg.ygNodeLayoutGetLeft(this.ptr);
596
- }
597
- getComputedTop() {
598
- if (this._freed)
599
- return 0;
600
- return yg.ygNodeLayoutGetTop(this.ptr);
601
- }
602
- getComputedRight() {
603
- if (this._freed)
604
- return 0;
605
- return yg.ygNodeLayoutGetRight(this.ptr);
606
- }
607
- getComputedBottom() {
608
- if (this._freed)
609
- return 0;
610
- return yg.ygNodeLayoutGetBottom(this.ptr);
611
- }
612
- getComputedWidth() {
613
- if (this._freed)
614
- return 0;
615
- return yg.ygNodeLayoutGetWidth(this.ptr);
616
- }
617
- getComputedHeight() {
618
- if (this._freed)
619
- return 0;
620
- return yg.ygNodeLayoutGetHeight(this.ptr);
621
- }
622
- getComputedBorder(edge) {
623
- if (this._freed)
624
- return 0;
625
- return yg.ygNodeLayoutGetBorder(this.ptr, edge);
626
- }
627
- getComputedMargin(edge) {
628
- if (this._freed)
629
- return 0;
630
- return yg.ygNodeLayoutGetMargin(this.ptr, edge);
631
- }
632
- getComputedPadding(edge) {
633
- if (this._freed)
634
- return 0;
635
- return yg.ygNodeLayoutGetPadding(this.ptr, edge);
636
- }
637
- setDirection(direction) {
638
- if (this._freed)
639
- return;
640
- yg.ygNodeStyleSetDirection(this.ptr, direction);
641
- }
642
- getDirection() {
643
- if (this._freed)
644
- return Direction.Inherit;
645
- return yg.ygNodeStyleGetDirection(this.ptr);
646
- }
647
- setFlexDirection(flexDirection) {
648
- if (this._freed)
649
- return;
650
- yg.ygNodeStyleSetFlexDirection(this.ptr, flexDirection);
651
- }
652
- getFlexDirection() {
653
- if (this._freed)
654
- return FlexDirection.Column;
655
- return yg.ygNodeStyleGetFlexDirection(this.ptr);
656
- }
657
- setJustifyContent(justifyContent) {
658
- if (this._freed)
659
- return;
660
- yg.ygNodeStyleSetJustifyContent(this.ptr, justifyContent);
661
- }
662
- getJustifyContent() {
663
- if (this._freed)
664
- return Justify.FlexStart;
665
- return yg.ygNodeStyleGetJustifyContent(this.ptr);
666
- }
667
- setAlignContent(alignContent) {
668
- if (this._freed)
669
- return;
670
- yg.ygNodeStyleSetAlignContent(this.ptr, alignContent);
671
- }
672
- getAlignContent() {
673
- if (this._freed)
674
- return Align.Auto;
675
- return yg.ygNodeStyleGetAlignContent(this.ptr);
676
- }
677
- setAlignItems(alignItems) {
678
- if (this._freed)
679
- return;
680
- yg.ygNodeStyleSetAlignItems(this.ptr, alignItems);
681
- }
682
- getAlignItems() {
683
- if (this._freed)
684
- return Align.Auto;
685
- return yg.ygNodeStyleGetAlignItems(this.ptr);
686
- }
687
- setAlignSelf(alignSelf) {
688
- if (this._freed)
689
- return;
690
- yg.ygNodeStyleSetAlignSelf(this.ptr, alignSelf);
691
- }
692
- getAlignSelf() {
693
- if (this._freed)
694
- return Align.Auto;
695
- return yg.ygNodeStyleGetAlignSelf(this.ptr);
696
- }
697
- setPositionType(positionType) {
698
- if (this._freed)
699
- return;
700
- yg.ygNodeStyleSetPositionType(this.ptr, positionType);
701
- }
702
- getPositionType() {
703
- if (this._freed)
704
- return PositionType.Static;
705
- return yg.ygNodeStyleGetPositionType(this.ptr);
706
- }
707
- setFlexWrap(flexWrap) {
708
- if (this._freed)
709
- return;
710
- yg.ygNodeStyleSetFlexWrap(this.ptr, flexWrap);
711
- }
712
- getFlexWrap() {
713
- if (this._freed)
714
- return Wrap.NoWrap;
715
- return yg.ygNodeStyleGetFlexWrap(this.ptr);
716
- }
717
- setOverflow(overflow) {
718
- if (this._freed)
719
- return;
720
- yg.ygNodeStyleSetOverflow(this.ptr, overflow);
721
- }
722
- getOverflow() {
723
- if (this._freed)
724
- return Overflow.Visible;
725
- return yg.ygNodeStyleGetOverflow(this.ptr);
726
- }
727
- setDisplay(display) {
728
- if (this._freed)
729
- return;
730
- yg.ygNodeStyleSetDisplay(this.ptr, display);
731
- }
732
- getDisplay() {
733
- if (this._freed)
734
- return Display.Flex;
735
- return yg.ygNodeStyleGetDisplay(this.ptr);
736
- }
737
- setBoxSizing(boxSizing) {
738
- if (this._freed)
739
- return;
740
- yg.ygNodeStyleSetBoxSizing(this.ptr, boxSizing);
741
- }
742
- getBoxSizing() {
743
- if (this._freed)
744
- return BoxSizing.BorderBox;
745
- return yg.ygNodeStyleGetBoxSizing(this.ptr);
746
- }
747
- setFlex(flex) {
748
- if (this._freed)
749
- return;
750
- yg.ygNodeStyleSetFlex(this.ptr, flex);
751
- }
752
- getFlex() {
753
- if (this._freed)
754
- return NaN;
755
- return yg.ygNodeStyleGetFlex(this.ptr);
756
- }
757
- setFlexGrow(flexGrow) {
758
- if (this._freed)
759
- return;
760
- yg.ygNodeStyleSetFlexGrow(this.ptr, flexGrow);
761
- }
762
- getFlexGrow() {
763
- if (this._freed)
764
- return NaN;
765
- return yg.ygNodeStyleGetFlexGrow(this.ptr);
766
- }
767
- setFlexShrink(flexShrink) {
768
- if (this._freed)
769
- return;
770
- yg.ygNodeStyleSetFlexShrink(this.ptr, flexShrink);
771
- }
772
- getFlexShrink() {
773
- if (this._freed)
774
- return NaN;
775
- return yg.ygNodeStyleGetFlexShrink(this.ptr);
776
- }
777
- setFlexBasis(flexBasis) {
778
- if (this._freed)
779
- return;
780
- const { unit, asNumber } = parseValue(flexBasis);
781
- if (unit === Unit.Auto) {
782
- yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
783
- } else if (unit === Unit.Percent) {
784
- yg.ygNodeStyleSetFlexBasisPercent(this.ptr, asNumber);
785
- } else if (unit === Unit.Point && asNumber !== undefined) {
786
- yg.ygNodeStyleSetFlexBasis(this.ptr, asNumber);
787
- }
788
- }
789
- setFlexBasisPercent(flexBasis) {
790
- if (this._freed)
791
- return;
792
- if (flexBasis !== undefined) {
793
- yg.ygNodeStyleSetFlexBasisPercent(this.ptr, flexBasis);
794
- }
795
- }
796
- setFlexBasisAuto() {
797
- if (this._freed)
798
- return;
799
- yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
800
- }
801
- setPosition(edge, position) {
802
- if (this._freed)
803
- return;
804
- const { unit, asNumber } = parseValue(position);
805
- if (unit === Unit.Percent) {
806
- yg.ygNodeStyleSetPositionPercent(this.ptr, edge, asNumber);
807
- } else if (unit === Unit.Point && asNumber !== undefined) {
808
- yg.ygNodeStyleSetPosition(this.ptr, edge, asNumber);
809
- }
810
- }
811
- setPositionPercent(edge, position) {
812
- if (this._freed)
813
- return;
814
- if (position !== undefined) {
815
- yg.ygNodeStyleSetPositionPercent(this.ptr, edge, position);
816
- }
817
- }
818
- setPositionAuto(edge) {
819
- if (this._freed)
820
- return;
821
- yg.ygNodeStyleSetPositionAuto(this.ptr, edge);
822
- }
823
- setMargin(edge, margin) {
824
- if (this._freed)
825
- return;
826
- const { unit, asNumber } = parseValue(margin);
827
- if (unit === Unit.Auto) {
828
- yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
829
- } else if (unit === Unit.Percent) {
830
- yg.ygNodeStyleSetMarginPercent(this.ptr, edge, asNumber);
831
- } else if (unit === Unit.Point && asNumber !== undefined) {
832
- yg.ygNodeStyleSetMargin(this.ptr, edge, asNumber);
833
- }
834
- }
835
- setMarginPercent(edge, margin) {
836
- if (this._freed)
837
- return;
838
- if (margin !== undefined) {
839
- yg.ygNodeStyleSetMarginPercent(this.ptr, edge, margin);
840
- }
841
- }
842
- setMarginAuto(edge) {
843
- if (this._freed)
844
- return;
845
- yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
846
- }
847
- setPadding(edge, padding) {
848
- if (this._freed)
849
- return;
850
- const { unit, asNumber } = parseValue(padding);
851
- if (unit === Unit.Percent) {
852
- yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, asNumber);
853
- } else if (unit === Unit.Point && asNumber !== undefined) {
854
- yg.ygNodeStyleSetPadding(this.ptr, edge, asNumber);
855
- }
856
- }
857
- setPaddingPercent(edge, padding) {
858
- if (this._freed)
859
- return;
860
- if (padding !== undefined) {
861
- yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, padding);
862
- }
863
- }
864
- setBorder(edge, border) {
865
- if (this._freed)
866
- return;
867
- if (border !== undefined) {
868
- yg.ygNodeStyleSetBorder(this.ptr, edge, border);
869
- }
870
- }
871
- getBorder(edge) {
872
- if (this._freed)
873
- return NaN;
874
- return yg.ygNodeStyleGetBorder(this.ptr, edge);
875
- }
876
- setGap(gutter, gap) {
877
- if (this._freed)
878
- return;
879
- const { unit, asNumber } = parseValue(gap);
880
- if (unit === Unit.Percent) {
881
- yg.ygNodeStyleSetGapPercent(this.ptr, gutter, asNumber);
882
- } else if (unit === Unit.Point && asNumber !== undefined) {
883
- yg.ygNodeStyleSetGap(this.ptr, gutter, asNumber);
884
- }
885
- }
886
- setGapPercent(gutter, gap) {
887
- if (this._freed)
888
- return;
889
- if (gap !== undefined) {
890
- yg.ygNodeStyleSetGapPercent(this.ptr, gutter, gap);
891
- }
892
- }
893
- setWidth(width) {
894
- if (this._freed)
895
- return;
896
- const { unit, asNumber } = parseValue(width);
897
- if (unit === Unit.Auto) {
898
- yg.ygNodeStyleSetWidthAuto(this.ptr);
899
- } else if (unit === Unit.Percent) {
900
- yg.ygNodeStyleSetWidthPercent(this.ptr, asNumber);
901
- } else if (unit === Unit.Point && asNumber !== undefined) {
902
- yg.ygNodeStyleSetWidth(this.ptr, asNumber);
903
- }
904
- }
905
- setWidthPercent(width) {
906
- if (this._freed)
907
- return;
908
- if (width !== undefined) {
909
- yg.ygNodeStyleSetWidthPercent(this.ptr, width);
910
- }
911
- }
912
- setWidthAuto() {
913
- if (this._freed)
914
- return;
915
- yg.ygNodeStyleSetWidthAuto(this.ptr);
916
- }
917
- setHeight(height) {
918
- if (this._freed)
919
- return;
920
- const { unit, asNumber } = parseValue(height);
921
- if (unit === Unit.Auto) {
922
- yg.ygNodeStyleSetHeightAuto(this.ptr);
923
- } else if (unit === Unit.Percent) {
924
- yg.ygNodeStyleSetHeightPercent(this.ptr, asNumber);
925
- } else if (unit === Unit.Point && asNumber !== undefined) {
926
- yg.ygNodeStyleSetHeight(this.ptr, asNumber);
927
- }
928
- }
929
- setHeightPercent(height) {
930
- if (this._freed)
931
- return;
932
- if (height !== undefined) {
933
- yg.ygNodeStyleSetHeightPercent(this.ptr, height);
934
- }
935
- }
936
- setHeightAuto() {
937
- if (this._freed)
938
- return;
939
- yg.ygNodeStyleSetHeightAuto(this.ptr);
940
- }
941
- setMinWidth(minWidth) {
942
- if (this._freed)
943
- return;
944
- const { unit, asNumber } = parseValue(minWidth);
945
- if (unit === Unit.Percent) {
946
- yg.ygNodeStyleSetMinWidthPercent(this.ptr, asNumber);
947
- } else if (unit === Unit.Point && asNumber !== undefined) {
948
- yg.ygNodeStyleSetMinWidth(this.ptr, asNumber);
949
- }
950
- }
951
- setMinWidthPercent(minWidth) {
952
- if (this._freed)
953
- return;
954
- if (minWidth !== undefined) {
955
- yg.ygNodeStyleSetMinWidthPercent(this.ptr, minWidth);
956
- }
957
- }
958
- setMinHeight(minHeight) {
959
- if (this._freed)
960
- return;
961
- const { unit, asNumber } = parseValue(minHeight);
962
- if (unit === Unit.Percent) {
963
- yg.ygNodeStyleSetMinHeightPercent(this.ptr, asNumber);
964
- } else if (unit === Unit.Point && asNumber !== undefined) {
965
- yg.ygNodeStyleSetMinHeight(this.ptr, asNumber);
966
- }
967
- }
968
- setMinHeightPercent(minHeight) {
969
- if (this._freed)
970
- return;
971
- if (minHeight !== undefined) {
972
- yg.ygNodeStyleSetMinHeightPercent(this.ptr, minHeight);
973
- }
974
- }
975
- setMaxWidth(maxWidth) {
976
- if (this._freed)
977
- return;
978
- const { unit, asNumber } = parseValue(maxWidth);
979
- if (unit === Unit.Percent) {
980
- yg.ygNodeStyleSetMaxWidthPercent(this.ptr, asNumber);
981
- } else if (unit === Unit.Point && asNumber !== undefined) {
982
- yg.ygNodeStyleSetMaxWidth(this.ptr, asNumber);
983
- }
984
- }
985
- setMaxWidthPercent(maxWidth) {
986
- if (this._freed)
987
- return;
988
- if (maxWidth !== undefined) {
989
- yg.ygNodeStyleSetMaxWidthPercent(this.ptr, maxWidth);
990
- }
991
- }
992
- setMaxHeight(maxHeight) {
993
- if (this._freed)
994
- return;
995
- const { unit, asNumber } = parseValue(maxHeight);
996
- if (unit === Unit.Percent) {
997
- yg.ygNodeStyleSetMaxHeightPercent(this.ptr, asNumber);
998
- } else if (unit === Unit.Point && asNumber !== undefined) {
999
- yg.ygNodeStyleSetMaxHeight(this.ptr, asNumber);
1000
- }
1001
- }
1002
- setMaxHeightPercent(maxHeight) {
1003
- if (this._freed)
1004
- return;
1005
- if (maxHeight !== undefined) {
1006
- yg.ygNodeStyleSetMaxHeightPercent(this.ptr, maxHeight);
1007
- }
1008
- }
1009
- setAspectRatio(aspectRatio) {
1010
- if (this._freed)
1011
- return;
1012
- if (aspectRatio !== undefined) {
1013
- yg.ygNodeStyleSetAspectRatio(this.ptr, aspectRatio);
1014
- }
1015
- }
1016
- getAspectRatio() {
1017
- if (this._freed)
1018
- return NaN;
1019
- return yg.ygNodeStyleGetAspectRatio(this.ptr);
1020
- }
1021
- getWidth() {
1022
- if (this._freed)
1023
- return UNDEFINED_VALUE;
1024
- return unpackValue(yg.ygNodeStyleGetWidthPacked(this.ptr));
1025
- }
1026
- getHeight() {
1027
- if (this._freed)
1028
- return UNDEFINED_VALUE;
1029
- return unpackValue(yg.ygNodeStyleGetHeightPacked(this.ptr));
1030
- }
1031
- getMinWidth() {
1032
- if (this._freed)
1033
- return UNDEFINED_VALUE;
1034
- return unpackValue(yg.ygNodeStyleGetMinWidthPacked(this.ptr));
1035
- }
1036
- getMinHeight() {
1037
- if (this._freed)
1038
- return UNDEFINED_VALUE;
1039
- return unpackValue(yg.ygNodeStyleGetMinHeightPacked(this.ptr));
1040
- }
1041
- getMaxWidth() {
1042
- if (this._freed)
1043
- return UNDEFINED_VALUE;
1044
- return unpackValue(yg.ygNodeStyleGetMaxWidthPacked(this.ptr));
1045
- }
1046
- getMaxHeight() {
1047
- if (this._freed)
1048
- return UNDEFINED_VALUE;
1049
- return unpackValue(yg.ygNodeStyleGetMaxHeightPacked(this.ptr));
1050
- }
1051
- getMargin(edge) {
1052
- if (this._freed)
1053
- return UNDEFINED_VALUE;
1054
- return unpackValue(yg.ygNodeStyleGetMarginPacked(this.ptr, edge));
1055
- }
1056
- getPadding(edge) {
1057
- if (this._freed)
1058
- return UNDEFINED_VALUE;
1059
- return unpackValue(yg.ygNodeStyleGetPaddingPacked(this.ptr, edge));
1060
- }
1061
- getPosition(edge) {
1062
- if (this._freed)
1063
- return UNDEFINED_VALUE;
1064
- return unpackValue(yg.ygNodeStyleGetPositionPacked(this.ptr, edge));
1065
- }
1066
- getGap(gutter) {
1067
- if (this._freed)
1068
- return UNDEFINED_VALUE;
1069
- return unpackValue(yg.ygNodeStyleGetGapPacked(this.ptr, gutter));
1070
- }
1071
- getFlexBasis() {
1072
- if (this._freed)
1073
- return UNDEFINED_VALUE;
1074
- return unpackValue(yg.ygNodeStyleGetFlexBasisPacked(this.ptr));
1075
- }
1076
- setMeasureFunc(measureFunc) {
1077
- if (this._freed)
1078
- return;
1079
- this.unsetMeasureFunc();
1080
- if (measureFunc) {
1081
- this.measureCallback = new JSCallback((nodePtr, width, widthMode, height, heightMode) => {
1082
- const result = measureFunc(width, widthMode, height, heightMode);
1083
- yg.ygStoreMeasureResult(result.width, result.height);
1084
- }, {
1085
- args: [
1086
- FFIType.ptr,
1087
- FFIType.f32,
1088
- FFIType.u32,
1089
- FFIType.f32,
1090
- FFIType.u32
1091
- ],
1092
- returns: FFIType.void
1093
- });
1094
- if (this.measureCallback.ptr) {
1095
- yg.ygNodeSetMeasureFuncTrampoline(this.ptr, this.measureCallback.ptr);
1096
- }
1097
- }
1098
- }
1099
- unsetMeasureFunc() {
1100
- if (this._freed)
1101
- return;
1102
- if (this.measureCallback) {
1103
- this.measureCallback.close();
1104
- this.measureCallback = null;
1105
- }
1106
- yg.ygNodeUnsetMeasureFuncTrampoline(this.ptr);
1107
- }
1108
- hasMeasureFunc() {
1109
- if (this._freed)
1110
- return false;
1111
- return yg.ygNodeHasMeasureFunc(this.ptr);
1112
- }
1113
- setBaselineFunc(baselineFunc) {
1114
- if (this._freed)
1115
- return;
1116
- this.unsetBaselineFunc();
1117
- if (baselineFunc) {
1118
- this.baselineCallback = new JSCallback((nodePtr, width, height) => {
1119
- const result = baselineFunc(width, height);
1120
- yg.ygStoreBaselineResult(result);
1121
- }, {
1122
- args: [FFIType.ptr, FFIType.f32, FFIType.f32],
1123
- returns: FFIType.void
1124
- });
1125
- if (this.baselineCallback.ptr) {
1126
- yg.ygNodeSetBaselineFuncTrampoline(this.ptr, this.baselineCallback.ptr);
1127
- }
1128
- }
1129
- }
1130
- unsetBaselineFunc() {
1131
- if (this._freed)
1132
- return;
1133
- if (this.baselineCallback) {
1134
- this.baselineCallback.close();
1135
- this.baselineCallback = null;
1136
- }
1137
- yg.ygNodeUnsetBaselineFuncTrampoline(this.ptr);
1138
- }
1139
- hasBaselineFunc() {
1140
- if (this._freed)
1141
- return false;
1142
- return yg.ygNodeHasBaselineFunc(this.ptr);
1143
- }
1144
- setDirtiedFunc(dirtiedFunc) {
1145
- if (this._freed)
1146
- return;
1147
- this.unsetDirtiedFunc();
1148
- if (dirtiedFunc) {
1149
- const node = this;
1150
- this.dirtiedCallback = new JSCallback((nodePtr) => {
1151
- dirtiedFunc(node);
1152
- }, {
1153
- args: [FFIType.ptr],
1154
- returns: FFIType.void
1155
- });
1156
- if (this.dirtiedCallback.ptr) {
1157
- yg.ygNodeSetDirtiedFunc(this.ptr, this.dirtiedCallback.ptr);
1158
- }
1159
- }
1160
- }
1161
- unsetDirtiedFunc() {
1162
- if (this._freed)
1163
- return;
1164
- if (this.dirtiedCallback) {
1165
- this.dirtiedCallback.close();
1166
- this.dirtiedCallback = null;
1167
- }
1168
- yg.ygNodeUnsetDirtiedFunc(this.ptr);
1169
- }
1170
- hasDirtiedFunc() {
1171
- if (this._freed)
1172
- return false;
1173
- return yg.ygNodeGetDirtiedFunc(this.ptr) !== null;
1174
- }
1175
- }
1176
-
1177
- class Config {
1178
- ptr;
1179
- constructor(ptr) {
1180
- this.ptr = ptr;
1181
- }
1182
- static create() {
1183
- const ptr = yg.ygConfigNew();
1184
- if (!ptr)
1185
- throw new Error("Failed to create config");
1186
- return new Config(ptr);
1187
- }
1188
- static destroy(config) {
1189
- config.free();
1190
- }
1191
- free() {
1192
- yg.ygConfigFree(this.ptr);
1193
- }
1194
- setUseWebDefaults(useWebDefaults) {
1195
- yg.ygConfigSetUseWebDefaults(this.ptr, useWebDefaults);
1196
- }
1197
- useWebDefaults() {
1198
- return yg.ygConfigGetUseWebDefaults(this.ptr);
1199
- }
1200
- setPointScaleFactor(pointScaleFactor) {
1201
- yg.ygConfigSetPointScaleFactor(this.ptr, pointScaleFactor);
1202
- }
1203
- getPointScaleFactor() {
1204
- return yg.ygConfigGetPointScaleFactor(this.ptr);
1205
- }
1206
- setErrata(errata) {
1207
- yg.ygConfigSetErrata(this.ptr, errata);
1208
- }
1209
- getErrata() {
1210
- return yg.ygConfigGetErrata(this.ptr);
1211
- }
1212
- setExperimentalFeatureEnabled(feature, enabled) {
1213
- yg.ygConfigSetExperimentalFeatureEnabled(this.ptr, feature, enabled);
1214
- }
1215
- isExperimentalFeatureEnabled(feature) {
1216
- return yg.ygConfigIsExperimentalFeatureEnabled(this.ptr, feature);
1217
- }
1218
- }
1219
- var dist_default = {
1220
- Node,
1221
- Config,
1222
- Align,
1223
- BoxSizing,
1224
- Dimension,
1225
- Direction,
1226
- Display,
1227
- Edge,
1228
- Errata,
1229
- ExperimentalFeature,
1230
- FlexDirection,
1231
- Gutter,
1232
- Justify,
1233
- LogLevel,
1234
- MeasureMode,
1235
- NodeType,
1236
- Overflow,
1237
- PositionType,
1238
- Unit,
1239
- Wrap,
1240
- EDGE_LEFT,
1241
- EDGE_TOP,
1242
- EDGE_RIGHT,
1243
- EDGE_BOTTOM,
1244
- EDGE_START,
1245
- EDGE_END,
1246
- EDGE_HORIZONTAL,
1247
- EDGE_VERTICAL,
1248
- EDGE_ALL,
1249
- FLEX_DIRECTION_COLUMN,
1250
- FLEX_DIRECTION_COLUMN_REVERSE,
1251
- FLEX_DIRECTION_ROW,
1252
- FLEX_DIRECTION_ROW_REVERSE,
1253
- JUSTIFY_FLEX_START,
1254
- JUSTIFY_CENTER,
1255
- JUSTIFY_FLEX_END,
1256
- JUSTIFY_SPACE_BETWEEN,
1257
- JUSTIFY_SPACE_AROUND,
1258
- JUSTIFY_SPACE_EVENLY,
1259
- ALIGN_AUTO,
1260
- ALIGN_FLEX_START,
1261
- ALIGN_CENTER,
1262
- ALIGN_FLEX_END,
1263
- ALIGN_STRETCH,
1264
- ALIGN_BASELINE,
1265
- ALIGN_SPACE_BETWEEN,
1266
- ALIGN_SPACE_AROUND,
1267
- ALIGN_SPACE_EVENLY,
1268
- WRAP_NO_WRAP,
1269
- WRAP_WRAP,
1270
- WRAP_WRAP_REVERSE,
1271
- OVERFLOW_VISIBLE,
1272
- OVERFLOW_HIDDEN,
1273
- OVERFLOW_SCROLL,
1274
- DISPLAY_FLEX,
1275
- DISPLAY_NONE,
1276
- POSITION_TYPE_STATIC,
1277
- POSITION_TYPE_RELATIVE,
1278
- POSITION_TYPE_ABSOLUTE,
1279
- DIRECTION_INHERIT,
1280
- DIRECTION_LTR,
1281
- DIRECTION_RTL
1282
- };
1283
-
1284
2
  // src/lib/border.ts
1285
3
  var BorderChars = {
1286
4
  single: {
@@ -5709,6 +4427,23 @@ class StdinBuffer extends EventEmitter2 {
5709
4427
  }
5710
4428
 
5711
4429
  // src/lib/yoga.options.ts
4430
+ import {
4431
+ BoxSizing,
4432
+ Align,
4433
+ Dimension,
4434
+ Direction,
4435
+ Display,
4436
+ Edge,
4437
+ FlexDirection,
4438
+ Gutter,
4439
+ Justify,
4440
+ LogLevel,
4441
+ MeasureMode,
4442
+ Overflow,
4443
+ PositionType,
4444
+ Unit,
4445
+ Wrap
4446
+ } from "bun-yoga";
5712
4447
  function parseAlign(value) {
5713
4448
  if (value == null) {
5714
4449
  return Align.Auto;
@@ -6818,7 +5553,7 @@ function getParsers() {
6818
5553
 
6819
5554
  // src/lib/tree-sitter/client.ts
6820
5555
  import { resolve as resolve2, isAbsolute } from "path";
6821
- import { existsSync as existsSync2 } from "fs";
5556
+ import { existsSync } from "fs";
6822
5557
  import { parse } from "path";
6823
5558
  registerEnvVar({
6824
5559
  name: "OTUI_TREE_SITTER_WORKER_PATH",
@@ -6879,7 +5614,7 @@ class TreeSitterClient extends EventEmitter3 {
6879
5614
  worker_path = this.options.workerPath;
6880
5615
  } else {
6881
5616
  worker_path = new URL("./parser.worker.js", import.meta.url).href;
6882
- if (!existsSync2(resolve2(import.meta.dirname, "parser.worker.js"))) {
5617
+ if (!existsSync(resolve2(import.meta.dirname, "parser.worker.js"))) {
6883
5618
  worker_path = new URL("./parser.worker.ts", import.meta.url).href;
6884
5619
  }
6885
5620
  }
@@ -8772,8 +7507,8 @@ function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux) {
8772
7507
  return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux);
8773
7508
  }
8774
7509
  // src/zig.ts
8775
- import { dlopen as dlopen2, toArrayBuffer as toArrayBuffer4, JSCallback as JSCallback2, ptr as ptr3 } from "bun:ffi";
8776
- import { existsSync as existsSync3 } from "fs";
7510
+ import { dlopen, toArrayBuffer as toArrayBuffer3, JSCallback, ptr as ptr2 } from "bun:ffi";
7511
+ import { existsSync as existsSync2 } from "fs";
8777
7512
  import { EventEmitter as EventEmitter5 } from "events";
8778
7513
 
8779
7514
  // src/buffer.ts
@@ -8840,9 +7575,9 @@ class OptimizedBuffer {
8840
7575
  }
8841
7576
  return this._rawBuffers;
8842
7577
  }
8843
- constructor(lib2, ptr, width, height, options) {
7578
+ constructor(lib, ptr, width, height, options) {
8844
7579
  this.id = options.id || `fb_${OptimizedBuffer.fbIdCounter++}`;
8845
- this.lib = lib2;
7580
+ this.lib = lib;
8846
7581
  this.respectAlpha = options.respectAlpha || false;
8847
7582
  this._width = width;
8848
7583
  this._height = height;
@@ -8850,10 +7585,10 @@ class OptimizedBuffer {
8850
7585
  this.bufferPtr = ptr;
8851
7586
  }
8852
7587
  static create(width, height, widthMethod, options = {}) {
8853
- const lib2 = resolveRenderLib();
7588
+ const lib = resolveRenderLib();
8854
7589
  const respectAlpha = options.respectAlpha || false;
8855
7590
  const id = options.id && options.id.trim() !== "" ? options.id : "unnamed buffer";
8856
- const buffer = lib2.createOptimizedBuffer(width, height, widthMethod, respectAlpha, id);
7591
+ const buffer = lib.createOptimizedBuffer(width, height, widthMethod, respectAlpha, id);
8857
7592
  return buffer;
8858
7593
  }
8859
7594
  get widthMethod() {
@@ -8994,618 +7729,11 @@ class OptimizedBuffer {
8994
7729
  }
8995
7730
  }
8996
7731
 
8997
- // ../../node_modules/bun-ffi-structs/index.js
8998
- import { ptr, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
8999
- function fatalError(...args) {
9000
- const message = args.join(" ");
9001
- console.error("FATAL ERROR:", message);
9002
- throw new Error(message);
9003
- }
9004
- var pointerSize = process.arch === "x64" || process.arch === "arm64" ? 8 : 4;
9005
- var typeSizes = {
9006
- u8: 1,
9007
- bool_u8: 1,
9008
- bool_u32: 4,
9009
- u16: 2,
9010
- i16: 2,
9011
- u32: 4,
9012
- u64: 8,
9013
- f32: 4,
9014
- f64: 8,
9015
- pointer: pointerSize,
9016
- i32: 4
9017
- };
9018
- var primitiveKeys = Object.keys(typeSizes);
9019
- function isPrimitiveType(type) {
9020
- return typeof type === "string" && primitiveKeys.includes(type);
9021
- }
9022
- var typeAlignments = { ...typeSizes };
9023
- var typeGetters = {
9024
- u8: (view, offset) => view.getUint8(offset),
9025
- bool_u8: (view, offset) => Boolean(view.getUint8(offset)),
9026
- bool_u32: (view, offset) => Boolean(view.getUint32(offset, true)),
9027
- u16: (view, offset) => view.getUint16(offset, true),
9028
- i16: (view, offset) => view.getInt16(offset, true),
9029
- u32: (view, offset) => view.getUint32(offset, true),
9030
- u64: (view, offset) => view.getBigUint64(offset, true),
9031
- f32: (view, offset) => view.getFloat32(offset, true),
9032
- f64: (view, offset) => view.getFloat64(offset, true),
9033
- i32: (view, offset) => view.getInt32(offset, true),
9034
- pointer: (view, offset) => pointerSize === 8 ? view.getBigUint64(offset, true) : BigInt(view.getUint32(offset, true))
9035
- };
9036
- function isObjectPointerDef(type) {
9037
- return typeof type === "object" && type !== null && type.__type === "objectPointer";
9038
- }
9039
- function alignOffset(offset, align) {
9040
- return offset + (align - 1) & ~(align - 1);
9041
- }
9042
- function enumTypeError(value) {
9043
- throw new TypeError(`Invalid enum value: ${value}`);
9044
- }
9045
- function defineEnum(mapping, base = "u32") {
9046
- const reverse2 = Object.fromEntries(Object.entries(mapping).map(([k, v]) => [v, k]));
9047
- return {
9048
- __type: "enum",
9049
- type: base,
9050
- to(value) {
9051
- return typeof value === "number" ? value : mapping[value] ?? enumTypeError(String(value));
9052
- },
9053
- from(value) {
9054
- return reverse2[value] ?? enumTypeError(String(value));
9055
- },
9056
- enum: mapping
9057
- };
9058
- }
9059
- function isEnum(type) {
9060
- return typeof type === "object" && type.__type === "enum";
9061
- }
9062
- function isStruct(type) {
9063
- return typeof type === "object" && type.__type === "struct";
9064
- }
9065
- function primitivePackers(type) {
9066
- let pack;
9067
- let unpack;
9068
- switch (type) {
9069
- case "u8":
9070
- pack = (view, off, val) => view.setUint8(off, val);
9071
- unpack = (view, off) => view.getUint8(off);
9072
- break;
9073
- case "bool_u8":
9074
- pack = (view, off, val) => view.setUint8(off, val ? 1 : 0);
9075
- unpack = (view, off) => Boolean(view.getUint8(off));
9076
- break;
9077
- case "bool_u32":
9078
- pack = (view, off, val) => view.setUint32(off, val ? 1 : 0, true);
9079
- unpack = (view, off) => Boolean(view.getUint32(off, true));
9080
- break;
9081
- case "u16":
9082
- pack = (view, off, val) => view.setUint16(off, val, true);
9083
- unpack = (view, off) => view.getUint16(off, true);
9084
- break;
9085
- case "i16":
9086
- pack = (view, off, val) => view.setInt16(off, val, true);
9087
- unpack = (view, off) => view.getInt16(off, true);
9088
- break;
9089
- case "u32":
9090
- pack = (view, off, val) => view.setUint32(off, val, true);
9091
- unpack = (view, off) => view.getUint32(off, true);
9092
- break;
9093
- case "i32":
9094
- pack = (view, off, val) => view.setInt32(off, val, true);
9095
- unpack = (view, off) => view.getInt32(off, true);
9096
- break;
9097
- case "u64":
9098
- pack = (view, off, val) => view.setBigUint64(off, BigInt(val), true);
9099
- unpack = (view, off) => view.getBigUint64(off, true);
9100
- break;
9101
- case "f32":
9102
- pack = (view, off, val) => view.setFloat32(off, val, true);
9103
- unpack = (view, off) => view.getFloat32(off, true);
9104
- break;
9105
- case "f64":
9106
- pack = (view, off, val) => view.setFloat64(off, val, true);
9107
- unpack = (view, off) => view.getFloat64(off, true);
9108
- break;
9109
- case "pointer":
9110
- pack = (view, off, val) => {
9111
- pointerSize === 8 ? view.setBigUint64(off, val ? BigInt(val) : 0n, true) : view.setUint32(off, val ? Number(val) : 0, true);
9112
- };
9113
- unpack = (view, off) => {
9114
- const bint = pointerSize === 8 ? view.getBigUint64(off, true) : BigInt(view.getUint32(off, true));
9115
- return Number(bint);
9116
- };
9117
- break;
9118
- default:
9119
- fatalError(`Unsupported primitive type: ${type}`);
9120
- }
9121
- return { pack, unpack };
9122
- }
9123
- var { pack: pointerPacker, unpack: pointerUnpacker } = primitivePackers("pointer");
9124
- function packObjectArray(val) {
9125
- const buffer = new ArrayBuffer(val.length * pointerSize);
9126
- const bufferView = new DataView(buffer);
9127
- for (let i = 0;i < val.length; i++) {
9128
- const instance = val[i];
9129
- const ptrValue = instance?.ptr ?? null;
9130
- pointerPacker(bufferView, i * pointerSize, ptrValue);
9131
- }
9132
- return bufferView;
9133
- }
9134
- var encoder = new TextEncoder;
9135
- var decoder = new TextDecoder;
9136
- function defineStruct(fields, structDefOptions) {
9137
- let offset = 0;
9138
- let maxAlign = 1;
9139
- const layout = [];
9140
- const lengthOfFields = {};
9141
- const lengthOfRequested = [];
9142
- const arrayFieldsMetadata = {};
9143
- for (const [name, typeOrStruct, options = {}] of fields) {
9144
- if (options.condition && !options.condition()) {
9145
- continue;
9146
- }
9147
- let size = 0, align = 0;
9148
- let pack;
9149
- let unpack;
9150
- let needsLengthOf = false;
9151
- let lengthOfDef = null;
9152
- if (isPrimitiveType(typeOrStruct)) {
9153
- size = typeSizes[typeOrStruct];
9154
- align = typeAlignments[typeOrStruct];
9155
- ({ pack, unpack } = primitivePackers(typeOrStruct));
9156
- } else if (typeof typeOrStruct === "string" && typeOrStruct === "cstring") {
9157
- size = pointerSize;
9158
- align = pointerSize;
9159
- pack = (view, off, val) => {
9160
- const bufPtr = val ? ptr(encoder.encode(val + "\x00")) : null;
9161
- pointerPacker(view, off, bufPtr);
9162
- };
9163
- unpack = (view, off) => {
9164
- const ptrVal = pointerUnpacker(view, off);
9165
- return ptrVal;
9166
- };
9167
- } else if (typeof typeOrStruct === "string" && typeOrStruct === "char*") {
9168
- size = pointerSize;
9169
- align = pointerSize;
9170
- pack = (view, off, val) => {
9171
- const bufPtr = val ? ptr(encoder.encode(val)) : null;
9172
- pointerPacker(view, off, bufPtr);
9173
- };
9174
- unpack = (view, off) => {
9175
- const ptrVal = pointerUnpacker(view, off);
9176
- return ptrVal;
9177
- };
9178
- needsLengthOf = true;
9179
- } else if (isEnum(typeOrStruct)) {
9180
- const base = typeOrStruct.type;
9181
- size = typeSizes[base];
9182
- align = typeAlignments[base];
9183
- const { pack: packEnum } = primitivePackers(base);
9184
- pack = (view, off, val) => {
9185
- const num = typeOrStruct.to(val);
9186
- packEnum(view, off, num);
9187
- };
9188
- unpack = (view, off) => {
9189
- const raw = typeGetters[base](view, off);
9190
- return typeOrStruct.from(raw);
9191
- };
9192
- } else if (isStruct(typeOrStruct)) {
9193
- if (options.asPointer === true) {
9194
- size = pointerSize;
9195
- align = pointerSize;
9196
- pack = (view, off, val, obj, options2) => {
9197
- if (!val) {
9198
- pointerPacker(view, off, null);
9199
- return;
9200
- }
9201
- const nestedBuf = typeOrStruct.pack(val, options2);
9202
- pointerPacker(view, off, ptr(nestedBuf));
9203
- };
9204
- unpack = (view, off) => {
9205
- throw new Error("Not implemented yet");
9206
- };
9207
- } else {
9208
- size = typeOrStruct.size;
9209
- align = typeOrStruct.align;
9210
- pack = (view, off, val, obj, options2) => {
9211
- const nestedBuf = typeOrStruct.pack(val, options2);
9212
- const nestedView = new Uint8Array(nestedBuf);
9213
- const dView = new Uint8Array(view.buffer);
9214
- dView.set(nestedView, off);
9215
- };
9216
- unpack = (view, off) => {
9217
- const slice = view.buffer.slice(off, off + size);
9218
- return typeOrStruct.unpack(slice);
9219
- };
9220
- }
9221
- } else if (isObjectPointerDef(typeOrStruct)) {
9222
- size = pointerSize;
9223
- align = pointerSize;
9224
- pack = (view, off, value) => {
9225
- const ptrValue = value?.ptr ?? null;
9226
- if (ptrValue === undefined) {
9227
- console.warn(`Field '${name}' expected object with '.ptr' property, but got undefined pointer value from:`, value);
9228
- pointerPacker(view, off, null);
9229
- } else {
9230
- pointerPacker(view, off, ptrValue);
9231
- }
9232
- };
9233
- unpack = (view, off) => {
9234
- return pointerUnpacker(view, off);
9235
- };
9236
- } else if (Array.isArray(typeOrStruct) && typeOrStruct.length === 1 && typeOrStruct[0] !== undefined) {
9237
- const [def] = typeOrStruct;
9238
- size = pointerSize;
9239
- align = pointerSize;
9240
- let arrayElementSize;
9241
- if (isEnum(def)) {
9242
- arrayElementSize = typeSizes[def.type];
9243
- pack = (view, off, val, obj) => {
9244
- if (!val || val.length === 0) {
9245
- pointerPacker(view, off, null);
9246
- return;
9247
- }
9248
- const buffer = new ArrayBuffer(val.length * arrayElementSize);
9249
- const bufferView = new DataView(buffer);
9250
- for (let i = 0;i < val.length; i++) {
9251
- const num = def.to(val[i]);
9252
- bufferView.setUint32(i * arrayElementSize, num, true);
9253
- }
9254
- pointerPacker(view, off, ptr(buffer));
9255
- };
9256
- unpack = null;
9257
- needsLengthOf = true;
9258
- lengthOfDef = def;
9259
- } else if (isStruct(def)) {
9260
- arrayElementSize = def.size;
9261
- pack = (view, off, val, obj, options2) => {
9262
- if (!val || val.length === 0) {
9263
- pointerPacker(view, off, null);
9264
- return;
9265
- }
9266
- const buffer = new ArrayBuffer(val.length * arrayElementSize);
9267
- const bufferView = new DataView(buffer);
9268
- for (let i = 0;i < val.length; i++) {
9269
- def.packInto(val[i], bufferView, i * arrayElementSize, options2);
9270
- }
9271
- pointerPacker(view, off, ptr(buffer));
9272
- };
9273
- unpack = (view, off) => {
9274
- throw new Error("Not implemented yet");
9275
- };
9276
- } else if (isPrimitiveType(def)) {
9277
- arrayElementSize = typeSizes[def];
9278
- const { pack: primitivePack } = primitivePackers(def);
9279
- pack = (view, off, val) => {
9280
- if (!val || val.length === 0) {
9281
- pointerPacker(view, off, null);
9282
- return;
9283
- }
9284
- const buffer = new ArrayBuffer(val.length * arrayElementSize);
9285
- const bufferView = new DataView(buffer);
9286
- for (let i = 0;i < val.length; i++) {
9287
- primitivePack(bufferView, i * arrayElementSize, val[i]);
9288
- }
9289
- pointerPacker(view, off, ptr(buffer));
9290
- };
9291
- unpack = null;
9292
- needsLengthOf = true;
9293
- lengthOfDef = def;
9294
- } else if (isObjectPointerDef(def)) {
9295
- arrayElementSize = pointerSize;
9296
- pack = (view, off, val) => {
9297
- if (!val || val.length === 0) {
9298
- pointerPacker(view, off, null);
9299
- return;
9300
- }
9301
- const packedView = packObjectArray(val);
9302
- pointerPacker(view, off, ptr(packedView.buffer));
9303
- };
9304
- unpack = () => {
9305
- throw new Error("not implemented yet");
9306
- };
9307
- } else {
9308
- throw new Error(`Unsupported array element type for ${name}: ${JSON.stringify(def)}`);
9309
- }
9310
- const lengthOfField = Object.values(lengthOfFields).find((f) => f.lengthOf === name);
9311
- if (lengthOfField && isPrimitiveType(lengthOfField.type)) {
9312
- const { pack: lengthPack } = primitivePackers(lengthOfField.type);
9313
- arrayFieldsMetadata[name] = {
9314
- elementSize: arrayElementSize,
9315
- arrayOffset: offset,
9316
- lengthOffset: lengthOfField.offset,
9317
- lengthPack
9318
- };
9319
- }
9320
- } else {
9321
- throw new Error(`Unsupported field type for ${name}: ${JSON.stringify(typeOrStruct)}`);
9322
- }
9323
- offset = alignOffset(offset, align);
9324
- if (options.unpackTransform) {
9325
- const originalUnpack = unpack;
9326
- unpack = (view, off) => options.unpackTransform(originalUnpack(view, off));
9327
- }
9328
- if (options.packTransform) {
9329
- const originalPack = pack;
9330
- pack = (view, off, val, obj, packOptions) => originalPack(view, off, options.packTransform(val), obj, packOptions);
9331
- }
9332
- if (options.optional) {
9333
- const originalPack = pack;
9334
- if (isStruct(typeOrStruct) && !options.asPointer) {
9335
- pack = (view, off, val, obj, packOptions) => {
9336
- if (val || options.mapOptionalInline) {
9337
- originalPack(view, off, val, obj, packOptions);
9338
- }
9339
- };
9340
- } else {
9341
- pack = (view, off, val, obj, packOptions) => originalPack(view, off, val ?? 0, obj, packOptions);
9342
- }
9343
- }
9344
- if (options.lengthOf) {
9345
- const originalPack = pack;
9346
- pack = (view, off, val, obj, packOptions) => {
9347
- const targetValue = obj[options.lengthOf];
9348
- let length = 0;
9349
- if (targetValue) {
9350
- if (typeof targetValue === "string") {
9351
- length = Buffer.byteLength(targetValue);
9352
- } else {
9353
- length = targetValue.length;
9354
- }
9355
- }
9356
- return originalPack(view, off, length, obj, packOptions);
9357
- };
9358
- }
9359
- let validateFunctions;
9360
- if (options.validate) {
9361
- validateFunctions = Array.isArray(options.validate) ? options.validate : [options.validate];
9362
- }
9363
- const layoutField = {
9364
- name,
9365
- offset,
9366
- size,
9367
- align,
9368
- validate: validateFunctions,
9369
- optional: !!options.optional || !!options.lengthOf || options.default !== undefined,
9370
- default: options.default,
9371
- pack,
9372
- unpack,
9373
- type: typeOrStruct,
9374
- lengthOf: options.lengthOf
9375
- };
9376
- layout.push(layoutField);
9377
- if (options.lengthOf) {
9378
- lengthOfFields[options.lengthOf] = layoutField;
9379
- }
9380
- if (needsLengthOf) {
9381
- const def = typeof typeOrStruct === "string" && typeOrStruct === "char*" ? "char*" : lengthOfDef;
9382
- if (!def)
9383
- fatalError(`Internal error: needsLengthOf=true but def is null for ${name}`);
9384
- lengthOfRequested.push({ requester: layoutField, def });
9385
- }
9386
- offset += size;
9387
- maxAlign = Math.max(maxAlign, align);
9388
- }
9389
- for (const { requester, def } of lengthOfRequested) {
9390
- const lengthOfField = lengthOfFields[requester.name];
9391
- if (!lengthOfField) {
9392
- if (def === "char*") {
9393
- continue;
9394
- }
9395
- throw new Error(`lengthOf field not found for array field ${requester.name}`);
9396
- }
9397
- if (def === "char*") {
9398
- requester.unpack = (view, off) => {
9399
- const ptrAddress = pointerUnpacker(view, off);
9400
- const length = lengthOfField.unpack(view, lengthOfField.offset);
9401
- if (ptrAddress === 0) {
9402
- return null;
9403
- }
9404
- const byteLength = typeof length === "bigint" ? Number(length) : length;
9405
- if (byteLength === 0) {
9406
- return "";
9407
- }
9408
- const buffer = toArrayBuffer2(ptrAddress, 0, byteLength);
9409
- return decoder.decode(buffer);
9410
- };
9411
- } else if (isPrimitiveType(def)) {
9412
- const elemSize = typeSizes[def];
9413
- const { unpack: primitiveUnpack } = primitivePackers(def);
9414
- requester.unpack = (view, off) => {
9415
- const result = [];
9416
- const length = lengthOfField.unpack(view, lengthOfField.offset);
9417
- const ptrAddress = pointerUnpacker(view, off);
9418
- if (ptrAddress === 0n && length > 0) {
9419
- throw new Error(`Array field ${requester.name} has null pointer but length ${length}.`);
9420
- }
9421
- if (ptrAddress === 0n || length === 0) {
9422
- return [];
9423
- }
9424
- const buffer = toArrayBuffer2(ptrAddress, 0, length * elemSize);
9425
- const bufferView = new DataView(buffer);
9426
- for (let i = 0;i < length; i++) {
9427
- result.push(primitiveUnpack(bufferView, i * elemSize));
9428
- }
9429
- return result;
9430
- };
9431
- } else {
9432
- const elemSize = def.type === "u32" ? 4 : 8;
9433
- requester.unpack = (view, off) => {
9434
- const result = [];
9435
- const length = lengthOfField.unpack(view, lengthOfField.offset);
9436
- const ptrAddress = pointerUnpacker(view, off);
9437
- if (ptrAddress === 0n && length > 0) {
9438
- throw new Error(`Array field ${requester.name} has null pointer but length ${length}.`);
9439
- }
9440
- if (ptrAddress === 0n || length === 0) {
9441
- return [];
9442
- }
9443
- const buffer = toArrayBuffer2(ptrAddress, 0, length * elemSize);
9444
- const bufferView = new DataView(buffer);
9445
- for (let i = 0;i < length; i++) {
9446
- result.push(def.from(bufferView.getUint32(i * elemSize, true)));
9447
- }
9448
- return result;
9449
- };
9450
- }
9451
- }
9452
- const totalSize = alignOffset(offset, maxAlign);
9453
- const description = layout.map((f) => ({
9454
- name: f.name,
9455
- offset: f.offset,
9456
- size: f.size,
9457
- align: f.align,
9458
- optional: f.optional,
9459
- type: f.type,
9460
- lengthOf: f.lengthOf
9461
- }));
9462
- const layoutByName = new Map(description.map((f) => [f.name, f]));
9463
- const arrayFields = new Map(Object.entries(arrayFieldsMetadata));
9464
- return {
9465
- __type: "struct",
9466
- size: totalSize,
9467
- align: maxAlign,
9468
- hasMapValue: !!structDefOptions?.mapValue,
9469
- layoutByName,
9470
- arrayFields,
9471
- pack(obj, options) {
9472
- const buf = new ArrayBuffer(totalSize);
9473
- const view = new DataView(buf);
9474
- let mappedObj = obj;
9475
- if (structDefOptions?.mapValue) {
9476
- mappedObj = structDefOptions.mapValue(obj);
9477
- }
9478
- for (const field of layout) {
9479
- const value = mappedObj[field.name] ?? field.default;
9480
- if (!field.optional && value === undefined) {
9481
- fatalError(`Packing non-optional field '${field.name}' but value is undefined (and no default provided)`);
9482
- }
9483
- if (field.validate) {
9484
- for (const validateFn of field.validate) {
9485
- validateFn(value, field.name, {
9486
- hints: options?.validationHints,
9487
- input: mappedObj
9488
- });
9489
- }
9490
- }
9491
- field.pack(view, field.offset, value, mappedObj, options);
9492
- }
9493
- return view.buffer;
9494
- },
9495
- packInto(obj, view, offset2, options) {
9496
- let mappedObj = obj;
9497
- if (structDefOptions?.mapValue) {
9498
- mappedObj = structDefOptions.mapValue(obj);
9499
- }
9500
- for (const field of layout) {
9501
- const value = mappedObj[field.name] ?? field.default;
9502
- if (!field.optional && value === undefined) {
9503
- console.warn(`packInto missing value for non-optional field '${field.name}' at offset ${offset2 + field.offset}. Writing default or zero.`);
9504
- }
9505
- if (field.validate) {
9506
- for (const validateFn of field.validate) {
9507
- validateFn(value, field.name, {
9508
- hints: options?.validationHints,
9509
- input: mappedObj
9510
- });
9511
- }
9512
- }
9513
- field.pack(view, offset2 + field.offset, value, mappedObj, options);
9514
- }
9515
- },
9516
- unpack(buf) {
9517
- if (buf.byteLength < totalSize) {
9518
- fatalError(`Buffer size (${buf.byteLength}) is smaller than struct size (${totalSize}) for unpacking.`);
9519
- }
9520
- const view = new DataView(buf);
9521
- const result = structDefOptions?.default ? { ...structDefOptions.default } : {};
9522
- for (const field of layout) {
9523
- if (!field.unpack) {
9524
- continue;
9525
- }
9526
- try {
9527
- result[field.name] = field.unpack(view, field.offset);
9528
- } catch (e) {
9529
- console.error(`Error unpacking field '${field.name}' at offset ${field.offset}:`, e);
9530
- throw e;
9531
- }
9532
- }
9533
- if (structDefOptions?.reduceValue) {
9534
- return structDefOptions.reduceValue(result);
9535
- }
9536
- return result;
9537
- },
9538
- packList(objects, options) {
9539
- if (objects.length === 0) {
9540
- return new ArrayBuffer(0);
9541
- }
9542
- const buffer = new ArrayBuffer(totalSize * objects.length);
9543
- const view = new DataView(buffer);
9544
- for (let i = 0;i < objects.length; i++) {
9545
- let mappedObj = objects[i];
9546
- if (structDefOptions?.mapValue) {
9547
- mappedObj = structDefOptions.mapValue(objects[i]);
9548
- }
9549
- for (const field of layout) {
9550
- const value = mappedObj[field.name] ?? field.default;
9551
- if (!field.optional && value === undefined) {
9552
- fatalError(`Packing non-optional field '${field.name}' at index ${i} but value is undefined (and no default provided)`);
9553
- }
9554
- if (field.validate) {
9555
- for (const validateFn of field.validate) {
9556
- validateFn(value, field.name, {
9557
- hints: options?.validationHints,
9558
- input: mappedObj
9559
- });
9560
- }
9561
- }
9562
- field.pack(view, i * totalSize + field.offset, value, mappedObj, options);
9563
- }
9564
- }
9565
- return buffer;
9566
- },
9567
- unpackList(buf, count) {
9568
- if (count === 0) {
9569
- return [];
9570
- }
9571
- const expectedSize = totalSize * count;
9572
- if (buf.byteLength < expectedSize) {
9573
- fatalError(`Buffer size (${buf.byteLength}) is smaller than expected size (${expectedSize}) for unpacking ${count} structs.`);
9574
- }
9575
- const view = new DataView(buf);
9576
- const results = [];
9577
- for (let i = 0;i < count; i++) {
9578
- const offset2 = i * totalSize;
9579
- const result = structDefOptions?.default ? { ...structDefOptions.default } : {};
9580
- for (const field of layout) {
9581
- if (!field.unpack) {
9582
- continue;
9583
- }
9584
- try {
9585
- result[field.name] = field.unpack(view, offset2 + field.offset);
9586
- } catch (e) {
9587
- console.error(`Error unpacking field '${field.name}' at index ${i}, offset ${offset2 + field.offset}:`, e);
9588
- throw e;
9589
- }
9590
- }
9591
- if (structDefOptions?.reduceValue) {
9592
- results.push(structDefOptions.reduceValue(result));
9593
- } else {
9594
- results.push(result);
9595
- }
9596
- }
9597
- return results;
9598
- },
9599
- describe() {
9600
- return description;
9601
- }
9602
- };
9603
- }
9604
-
9605
7732
  // src/zig-structs.ts
9606
- import { ptr as ptr2, toArrayBuffer as toArrayBuffer3 } from "bun:ffi";
9607
- var rgbaPackTransform = (rgba) => rgba ? ptr2(rgba.buffer) : null;
9608
- var rgbaUnpackTransform = (ptr3) => ptr3 ? RGBA.fromArray(new Float32Array(toArrayBuffer3(ptr3))) : undefined;
7733
+ import { defineStruct, defineEnum } from "bun-ffi-structs";
7734
+ import { ptr, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
7735
+ var rgbaPackTransform = (rgba) => rgba ? ptr(rgba.buffer) : null;
7736
+ var rgbaUnpackTransform = (ptr2) => ptr2 ? RGBA.fromArray(new Float32Array(toArrayBuffer2(ptr2))) : undefined;
9609
7737
  var StyledChunkStruct = defineStruct([
9610
7738
  ["text", "char*"],
9611
7739
  ["text_len", "u64", { lengthOf: "text" }],
@@ -9695,7 +7823,7 @@ var targetLibPath = module.default;
9695
7823
  if (/\$bunfs/.test(targetLibPath)) {
9696
7824
  targetLibPath = targetLibPath.replace("../", "");
9697
7825
  }
9698
- if (!existsSync3(targetLibPath)) {
7826
+ if (!existsSync2(targetLibPath)) {
9699
7827
  throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
9700
7828
  }
9701
7829
  registerEnvVar({
@@ -9724,7 +7852,7 @@ registerEnvVar({
9724
7852
  });
9725
7853
  function getOpenTUILib(libPath) {
9726
7854
  const resolvedLibPath = libPath || targetLibPath;
9727
- const rawSymbols = dlopen2(resolvedLibPath, {
7855
+ const rawSymbols = dlopen(resolvedLibPath, {
9728
7856
  setLogCallback: {
9729
7857
  args: ["ptr"],
9730
7858
  returns: "void"
@@ -10652,13 +8780,13 @@ class FFIRenderLib {
10652
8780
  if (this.logCallbackWrapper) {
10653
8781
  return;
10654
8782
  }
10655
- const logCallback = new JSCallback2((level, msgPtr, msgLenBigInt) => {
8783
+ const logCallback = new JSCallback((level, msgPtr, msgLenBigInt) => {
10656
8784
  try {
10657
8785
  const msgLen = typeof msgLenBigInt === "bigint" ? Number(msgLenBigInt) : msgLenBigInt;
10658
8786
  if (msgLen === 0 || !msgPtr) {
10659
8787
  return;
10660
8788
  }
10661
- const msgBuffer = toArrayBuffer4(msgPtr, 0, msgLen);
8789
+ const msgBuffer = toArrayBuffer3(msgPtr, 0, msgLen);
10662
8790
  const msgBytes = new Uint8Array(msgBuffer);
10663
8791
  const message = this.decoder.decode(msgBytes);
10664
8792
  switch (level) {
@@ -10697,19 +8825,19 @@ class FFIRenderLib {
10697
8825
  if (this.eventCallbackWrapper) {
10698
8826
  return;
10699
8827
  }
10700
- const eventCallback = new JSCallback2((namePtr, nameLenBigInt, dataPtr, dataLenBigInt) => {
8828
+ const eventCallback = new JSCallback((namePtr, nameLenBigInt, dataPtr, dataLenBigInt) => {
10701
8829
  try {
10702
8830
  const nameLen = typeof nameLenBigInt === "bigint" ? Number(nameLenBigInt) : nameLenBigInt;
10703
8831
  const dataLen = typeof dataLenBigInt === "bigint" ? Number(dataLenBigInt) : dataLenBigInt;
10704
8832
  if (nameLen === 0 || !namePtr) {
10705
8833
  return;
10706
8834
  }
10707
- const nameBuffer = toArrayBuffer4(namePtr, 0, nameLen);
8835
+ const nameBuffer = toArrayBuffer3(namePtr, 0, nameLen);
10708
8836
  const nameBytes = new Uint8Array(nameBuffer);
10709
8837
  const eventName = this.decoder.decode(nameBytes);
10710
8838
  let eventData;
10711
8839
  if (dataLen > 0 && dataPtr) {
10712
- eventData = toArrayBuffer4(dataPtr, 0, dataLen).slice();
8840
+ eventData = toArrayBuffer3(dataPtr, 0, dataLen).slice();
10713
8841
  } else {
10714
8842
  eventData = new ArrayBuffer(0);
10715
8843
  }
@@ -10775,32 +8903,32 @@ class FFIRenderLib {
10775
8903
  return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
10776
8904
  }
10777
8905
  bufferGetCharPtr(buffer) {
10778
- const ptr4 = this.opentui.symbols.bufferGetCharPtr(buffer);
10779
- if (!ptr4) {
8906
+ const ptr3 = this.opentui.symbols.bufferGetCharPtr(buffer);
8907
+ if (!ptr3) {
10780
8908
  throw new Error("Failed to get char pointer");
10781
8909
  }
10782
- return ptr4;
8910
+ return ptr3;
10783
8911
  }
10784
8912
  bufferGetFgPtr(buffer) {
10785
- const ptr4 = this.opentui.symbols.bufferGetFgPtr(buffer);
10786
- if (!ptr4) {
8913
+ const ptr3 = this.opentui.symbols.bufferGetFgPtr(buffer);
8914
+ if (!ptr3) {
10787
8915
  throw new Error("Failed to get fg pointer");
10788
8916
  }
10789
- return ptr4;
8917
+ return ptr3;
10790
8918
  }
10791
8919
  bufferGetBgPtr(buffer) {
10792
- const ptr4 = this.opentui.symbols.bufferGetBgPtr(buffer);
10793
- if (!ptr4) {
8920
+ const ptr3 = this.opentui.symbols.bufferGetBgPtr(buffer);
8921
+ if (!ptr3) {
10794
8922
  throw new Error("Failed to get bg pointer");
10795
8923
  }
10796
- return ptr4;
8924
+ return ptr3;
10797
8925
  }
10798
8926
  bufferGetAttributesPtr(buffer) {
10799
- const ptr4 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
10800
- if (!ptr4) {
8927
+ const ptr3 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
8928
+ if (!ptr3) {
10801
8929
  throw new Error("Failed to get attributes pointer");
10802
8930
  }
10803
- return ptr4;
8931
+ return ptr3;
10804
8932
  }
10805
8933
  bufferGetRespectAlpha(buffer) {
10806
8934
  return this.opentui.symbols.bufferGetRespectAlpha(buffer);
@@ -11043,7 +9171,7 @@ class FFIRenderLib {
11043
9171
  return;
11044
9172
  }
11045
9173
  const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
11046
- this.opentui.symbols.textBufferSetStyledText(buffer, ptr3(chunksBuffer), nonEmptyChunks.length);
9174
+ this.opentui.symbols.textBufferSetStyledText(buffer, ptr2(chunksBuffer), nonEmptyChunks.length);
11047
9175
  }
11048
9176
  textBufferGetLineCount(buffer) {
11049
9177
  return this.opentui.symbols.textBufferGetLineCount(buffer);
@@ -11054,7 +9182,7 @@ class FFIRenderLib {
11054
9182
  }
11055
9183
  getPlainTextBytes(buffer, maxLength) {
11056
9184
  const outBuffer = new Uint8Array(maxLength);
11057
- const actualLen = this.textBufferGetPlainText(buffer, ptr3(outBuffer), maxLength);
9185
+ const actualLen = this.textBufferGetPlainText(buffer, ptr2(outBuffer), maxLength);
11058
9186
  if (actualLen === 0) {
11059
9187
  return null;
11060
9188
  }
@@ -11062,7 +9190,7 @@ class FFIRenderLib {
11062
9190
  }
11063
9191
  textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
11064
9192
  const outBuffer = new Uint8Array(maxLength);
11065
- const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
9193
+ const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr2(outBuffer), maxLength);
11066
9194
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11067
9195
  if (len === 0) {
11068
9196
  return null;
@@ -11071,7 +9199,7 @@ class FFIRenderLib {
11071
9199
  }
11072
9200
  textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
11073
9201
  const outBuffer = new Uint8Array(maxLength);
11074
- const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
9202
+ const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr2(outBuffer), maxLength);
11075
9203
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11076
9204
  if (len === 0) {
11077
9205
  return null;
@@ -11131,7 +9259,7 @@ class FFIRenderLib {
11131
9259
  }
11132
9260
  textBufferViewGetLineInfo(view) {
11133
9261
  const outBuffer = new ArrayBuffer(LineInfoStruct.size);
11134
- this.textBufferViewGetLineInfoDirect(view, ptr3(outBuffer));
9262
+ this.textBufferViewGetLineInfoDirect(view, ptr2(outBuffer));
11135
9263
  const struct = LineInfoStruct.unpack(outBuffer);
11136
9264
  return {
11137
9265
  maxLineWidth: struct.maxWidth,
@@ -11143,7 +9271,7 @@ class FFIRenderLib {
11143
9271
  }
11144
9272
  textBufferViewGetLogicalLineInfo(view) {
11145
9273
  const outBuffer = new ArrayBuffer(LineInfoStruct.size);
11146
- this.textBufferViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
9274
+ this.textBufferViewGetLogicalLineInfoDirect(view, ptr2(outBuffer));
11147
9275
  const struct = LineInfoStruct.unpack(outBuffer);
11148
9276
  return {
11149
9277
  maxLineWidth: struct.maxWidth,
@@ -11172,7 +9300,7 @@ class FFIRenderLib {
11172
9300
  }
11173
9301
  textBufferViewGetSelectedTextBytes(view, maxLength) {
11174
9302
  const outBuffer = new Uint8Array(maxLength);
11175
- const actualLen = this.textBufferViewGetSelectedText(view, ptr3(outBuffer), maxLength);
9303
+ const actualLen = this.textBufferViewGetSelectedText(view, ptr2(outBuffer), maxLength);
11176
9304
  if (actualLen === 0) {
11177
9305
  return null;
11178
9306
  }
@@ -11180,7 +9308,7 @@ class FFIRenderLib {
11180
9308
  }
11181
9309
  textBufferViewGetPlainTextBytes(view, maxLength) {
11182
9310
  const outBuffer = new Uint8Array(maxLength);
11183
- const actualLen = this.textBufferViewGetPlainText(view, ptr3(outBuffer), maxLength);
9311
+ const actualLen = this.textBufferViewGetPlainText(view, ptr2(outBuffer), maxLength);
11184
9312
  if (actualLen === 0) {
11185
9313
  return null;
11186
9314
  }
@@ -11194,7 +9322,7 @@ class FFIRenderLib {
11194
9322
  }
11195
9323
  textBufferViewMeasureForDimensions(view, width, height) {
11196
9324
  const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
11197
- const resultPtr = ptr3(new Uint8Array(resultBuffer));
9325
+ const resultPtr = ptr2(new Uint8Array(resultBuffer));
11198
9326
  const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
11199
9327
  if (!success) {
11200
9328
  return null;
@@ -11204,11 +9332,11 @@ class FFIRenderLib {
11204
9332
  }
11205
9333
  textBufferAddHighlightByCharRange(buffer, highlight) {
11206
9334
  const packedHighlight = HighlightStruct.pack(highlight);
11207
- this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr3(packedHighlight));
9335
+ this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr2(packedHighlight));
11208
9336
  }
11209
9337
  textBufferAddHighlight(buffer, lineIdx, highlight) {
11210
9338
  const packedHighlight = HighlightStruct.pack(highlight);
11211
- this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx, ptr3(packedHighlight));
9339
+ this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx, ptr2(packedHighlight));
11212
9340
  }
11213
9341
  textBufferRemoveHighlightsByRef(buffer, hlRef) {
11214
9342
  this.opentui.symbols.textBufferRemoveHighlightsByRef(buffer, hlRef);
@@ -11224,12 +9352,12 @@ class FFIRenderLib {
11224
9352
  }
11225
9353
  textBufferGetLineHighlights(buffer, lineIdx) {
11226
9354
  const outCountBuf = new BigUint64Array(1);
11227
- const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx, ptr3(outCountBuf));
9355
+ const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx, ptr2(outCountBuf));
11228
9356
  if (!nativePtr)
11229
9357
  return [];
11230
9358
  const count = Number(outCountBuf[0]);
11231
9359
  const byteLen = count * HighlightStruct.size;
11232
- const raw = toArrayBuffer4(nativePtr, 0, byteLen);
9360
+ const raw = toArrayBuffer3(nativePtr, 0, byteLen);
11233
9361
  const results = HighlightStruct.unpackList(raw, count);
11234
9362
  this.opentui.symbols.textBufferFreeLineHighlights(nativePtr, count);
11235
9363
  return results;
@@ -11265,7 +9393,7 @@ class FFIRenderLib {
11265
9393
  const y = new Uint32Array(1);
11266
9394
  const width = new Uint32Array(1);
11267
9395
  const height = new Uint32Array(1);
11268
- this.opentui.symbols.editorViewGetViewport(view, ptr3(x), ptr3(y), ptr3(width), ptr3(height));
9396
+ this.opentui.symbols.editorViewGetViewport(view, ptr2(x), ptr2(y), ptr2(width), ptr2(height));
11269
9397
  return {
11270
9398
  offsetX: x[0],
11271
9399
  offsetY: y[0],
@@ -11295,7 +9423,7 @@ class FFIRenderLib {
11295
9423
  }
11296
9424
  editorViewGetLineInfo(view) {
11297
9425
  const outBuffer = new ArrayBuffer(LineInfoStruct.size);
11298
- this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr3(outBuffer));
9426
+ this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr2(outBuffer));
11299
9427
  const struct = LineInfoStruct.unpack(outBuffer);
11300
9428
  return {
11301
9429
  maxLineWidth: struct.maxWidth,
@@ -11307,7 +9435,7 @@ class FFIRenderLib {
11307
9435
  }
11308
9436
  editorViewGetLogicalLineInfo(view) {
11309
9437
  const outBuffer = new ArrayBuffer(LineInfoStruct.size);
11310
- this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr3(outBuffer));
9438
+ this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr2(outBuffer));
11311
9439
  const struct = LineInfoStruct.unpack(outBuffer);
11312
9440
  return {
11313
9441
  maxLineWidth: struct.maxWidth,
@@ -11336,7 +9464,7 @@ class FFIRenderLib {
11336
9464
  }
11337
9465
  editBufferGetText(buffer, maxLength) {
11338
9466
  const outBuffer = new Uint8Array(maxLength);
11339
- const actualLen = this.opentui.symbols.editBufferGetText(buffer, ptr3(outBuffer), maxLength);
9467
+ const actualLen = this.opentui.symbols.editBufferGetText(buffer, ptr2(outBuffer), maxLength);
11340
9468
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11341
9469
  if (len === 0)
11342
9470
  return null;
@@ -11391,7 +9519,7 @@ class FFIRenderLib {
11391
9519
  }
11392
9520
  editBufferGetCursorPosition(buffer) {
11393
9521
  const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
11394
- this.opentui.symbols.editBufferGetCursorPosition(buffer, ptr3(cursorBuffer));
9522
+ this.opentui.symbols.editBufferGetCursorPosition(buffer, ptr2(cursorBuffer));
11395
9523
  return LogicalCursorStruct.unpack(cursorBuffer);
11396
9524
  }
11397
9525
  editBufferGetId(buffer) {
@@ -11409,7 +9537,7 @@ class FFIRenderLib {
11409
9537
  }
11410
9538
  editBufferUndo(buffer, maxLength) {
11411
9539
  const outBuffer = new Uint8Array(maxLength);
11412
- const actualLen = this.opentui.symbols.editBufferUndo(buffer, ptr3(outBuffer), maxLength);
9540
+ const actualLen = this.opentui.symbols.editBufferUndo(buffer, ptr2(outBuffer), maxLength);
11413
9541
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11414
9542
  if (len === 0)
11415
9543
  return null;
@@ -11417,7 +9545,7 @@ class FFIRenderLib {
11417
9545
  }
11418
9546
  editBufferRedo(buffer, maxLength) {
11419
9547
  const outBuffer = new Uint8Array(maxLength);
11420
- const actualLen = this.opentui.symbols.editBufferRedo(buffer, ptr3(outBuffer), maxLength);
9548
+ const actualLen = this.opentui.symbols.editBufferRedo(buffer, ptr2(outBuffer), maxLength);
11421
9549
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11422
9550
  if (len === 0)
11423
9551
  return null;
@@ -11437,22 +9565,22 @@ class FFIRenderLib {
11437
9565
  }
11438
9566
  editBufferGetNextWordBoundary(buffer) {
11439
9567
  const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
11440
- this.opentui.symbols.editBufferGetNextWordBoundary(buffer, ptr3(cursorBuffer));
9568
+ this.opentui.symbols.editBufferGetNextWordBoundary(buffer, ptr2(cursorBuffer));
11441
9569
  return LogicalCursorStruct.unpack(cursorBuffer);
11442
9570
  }
11443
9571
  editBufferGetPrevWordBoundary(buffer) {
11444
9572
  const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
11445
- this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, ptr3(cursorBuffer));
9573
+ this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, ptr2(cursorBuffer));
11446
9574
  return LogicalCursorStruct.unpack(cursorBuffer);
11447
9575
  }
11448
9576
  editBufferGetEOL(buffer) {
11449
9577
  const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
11450
- this.opentui.symbols.editBufferGetEOL(buffer, ptr3(cursorBuffer));
9578
+ this.opentui.symbols.editBufferGetEOL(buffer, ptr2(cursorBuffer));
11451
9579
  return LogicalCursorStruct.unpack(cursorBuffer);
11452
9580
  }
11453
9581
  editBufferOffsetToPosition(buffer, offset) {
11454
9582
  const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
11455
- const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, ptr3(cursorBuffer));
9583
+ const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, ptr2(cursorBuffer));
11456
9584
  if (!success)
11457
9585
  return null;
11458
9586
  return LogicalCursorStruct.unpack(cursorBuffer);
@@ -11465,7 +9593,7 @@ class FFIRenderLib {
11465
9593
  }
11466
9594
  editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
11467
9595
  const outBuffer = new Uint8Array(maxLength);
11468
- const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr3(outBuffer), maxLength);
9596
+ const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr2(outBuffer), maxLength);
11469
9597
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11470
9598
  if (len === 0)
11471
9599
  return null;
@@ -11473,7 +9601,7 @@ class FFIRenderLib {
11473
9601
  }
11474
9602
  editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
11475
9603
  const outBuffer = new Uint8Array(maxLength);
11476
- const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr3(outBuffer), maxLength);
9604
+ const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr2(outBuffer), maxLength);
11477
9605
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11478
9606
  if (len === 0)
11479
9607
  return null;
@@ -11506,7 +9634,7 @@ class FFIRenderLib {
11506
9634
  }
11507
9635
  editorViewGetSelectedTextBytes(view, maxLength) {
11508
9636
  const outBuffer = new Uint8Array(maxLength);
11509
- const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, ptr3(outBuffer), maxLength);
9637
+ const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, ptr2(outBuffer), maxLength);
11510
9638
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11511
9639
  if (len === 0)
11512
9640
  return null;
@@ -11515,12 +9643,12 @@ class FFIRenderLib {
11515
9643
  editorViewGetCursor(view) {
11516
9644
  const row = new Uint32Array(1);
11517
9645
  const col = new Uint32Array(1);
11518
- this.opentui.symbols.editorViewGetCursor(view, ptr3(row), ptr3(col));
9646
+ this.opentui.symbols.editorViewGetCursor(view, ptr2(row), ptr2(col));
11519
9647
  return { row: row[0], col: col[0] };
11520
9648
  }
11521
9649
  editorViewGetText(view, maxLength) {
11522
9650
  const outBuffer = new Uint8Array(maxLength);
11523
- const actualLen = this.opentui.symbols.editorViewGetText(view, ptr3(outBuffer), maxLength);
9651
+ const actualLen = this.opentui.symbols.editorViewGetText(view, ptr2(outBuffer), maxLength);
11524
9652
  const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
11525
9653
  if (len === 0)
11526
9654
  return null;
@@ -11528,7 +9656,7 @@ class FFIRenderLib {
11528
9656
  }
11529
9657
  editorViewGetVisualCursor(view) {
11530
9658
  const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
11531
- this.opentui.symbols.editorViewGetVisualCursor(view, ptr3(cursorBuffer));
9659
+ this.opentui.symbols.editorViewGetVisualCursor(view, ptr2(cursorBuffer));
11532
9660
  return VisualCursorStruct.unpack(cursorBuffer);
11533
9661
  }
11534
9662
  editorViewMoveUpVisual(view) {
@@ -11545,17 +9673,17 @@ class FFIRenderLib {
11545
9673
  }
11546
9674
  editorViewGetNextWordBoundary(view) {
11547
9675
  const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
11548
- this.opentui.symbols.editorViewGetNextWordBoundary(view, ptr3(cursorBuffer));
9676
+ this.opentui.symbols.editorViewGetNextWordBoundary(view, ptr2(cursorBuffer));
11549
9677
  return VisualCursorStruct.unpack(cursorBuffer);
11550
9678
  }
11551
9679
  editorViewGetPrevWordBoundary(view) {
11552
9680
  const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
11553
- this.opentui.symbols.editorViewGetPrevWordBoundary(view, ptr3(cursorBuffer));
9681
+ this.opentui.symbols.editorViewGetPrevWordBoundary(view, ptr2(cursorBuffer));
11554
9682
  return VisualCursorStruct.unpack(cursorBuffer);
11555
9683
  }
11556
9684
  editorViewGetEOL(view) {
11557
9685
  const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
11558
- this.opentui.symbols.editorViewGetEOL(view, ptr3(cursorBuffer));
9686
+ this.opentui.symbols.editorViewGetEOL(view, ptr2(cursorBuffer));
11559
9687
  return VisualCursorStruct.unpack(cursorBuffer);
11560
9688
  }
11561
9689
  bufferPushScissorRect(buffer, x, y, width, height) {
@@ -11569,7 +9697,7 @@ class FFIRenderLib {
11569
9697
  }
11570
9698
  getTerminalCapabilities(renderer) {
11571
9699
  const capsBuffer = new ArrayBuffer(TerminalCapabilitiesStruct.size);
11572
- this.opentui.symbols.getTerminalCapabilities(renderer, ptr3(capsBuffer));
9700
+ this.opentui.symbols.getTerminalCapabilities(renderer, ptr2(capsBuffer));
11573
9701
  const caps = TerminalCapabilitiesStruct.unpack(capsBuffer);
11574
9702
  return {
11575
9703
  kitty_keyboard: caps.kitty_keyboard,
@@ -11601,7 +9729,7 @@ class FFIRenderLib {
11601
9729
  const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
11602
9730
  const outPtrBuffer = new ArrayBuffer(8);
11603
9731
  const outLenBuffer = new ArrayBuffer(8);
11604
- const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length, ptr3(outPtrBuffer), ptr3(outLenBuffer), widthMethodCode);
9732
+ const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length, ptr2(outPtrBuffer), ptr2(outLenBuffer), widthMethodCode);
11605
9733
  if (!success) {
11606
9734
  return null;
11607
9735
  }
@@ -11613,7 +9741,7 @@ class FFIRenderLib {
11613
9741
  return { ptr: resultPtr, data: [] };
11614
9742
  }
11615
9743
  const byteLen = resultLen * EncodedCharStruct.size;
11616
- const raw = toArrayBuffer4(resultPtr, 0, byteLen);
9744
+ const raw = toArrayBuffer3(resultPtr, 0, byteLen);
11617
9745
  const data = EncodedCharStruct.unpackList(raw, resultLen);
11618
9746
  return { ptr: resultPtr, data };
11619
9747
  }
@@ -11655,7 +9783,7 @@ class FFIRenderLib {
11655
9783
  return;
11656
9784
  }
11657
9785
  const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
11658
- this.opentui.symbols.editorViewSetPlaceholderStyledText(view, ptr3(chunksBuffer), nonEmptyChunks.length);
9786
+ this.opentui.symbols.editorViewSetPlaceholderStyledText(view, ptr2(chunksBuffer), nonEmptyChunks.length);
11659
9787
  }
11660
9788
  editorViewSetTabIndicator(view, indicator) {
11661
9789
  this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
@@ -11710,13 +9838,13 @@ class TextBuffer {
11710
9838
  _textBytes;
11711
9839
  _memId;
11712
9840
  _appendedChunks = [];
11713
- constructor(lib2, ptr4) {
11714
- this.lib = lib2;
11715
- this.bufferPtr = ptr4;
9841
+ constructor(lib, ptr3) {
9842
+ this.lib = lib;
9843
+ this.bufferPtr = ptr3;
11716
9844
  }
11717
9845
  static create(widthMethod) {
11718
- const lib2 = resolveRenderLib();
11719
- return lib2.createTextBuffer(widthMethod);
9846
+ const lib = resolveRenderLib();
9847
+ return lib.createTextBuffer(widthMethod);
11720
9848
  }
11721
9849
  guard() {
11722
9850
  if (this._destroyed)
@@ -11895,6 +10023,7 @@ class TextBuffer {
11895
10023
 
11896
10024
  // src/Renderable.ts
11897
10025
  import { EventEmitter as EventEmitter6 } from "events";
10026
+ import Yoga, { Direction as Direction2, Display as Display2, Edge as Edge2, FlexDirection as FlexDirection2 } from "bun-yoga";
11898
10027
 
11899
10028
  // src/lib/renderable.validations.ts
11900
10029
  function validateOptions(id, options) {
@@ -12024,7 +10153,7 @@ class BaseRenderable extends EventEmitter6 {
12024
10153
  this._visible = value;
12025
10154
  }
12026
10155
  }
12027
- var yogaConfig = dist_default.Config.create();
10156
+ var yogaConfig = Yoga.Config.create();
12028
10157
  yogaConfig.setUseWebDefaults(false);
12029
10158
  yogaConfig.setPointScaleFactor(1);
12030
10159
 
@@ -12090,8 +10219,8 @@ class Renderable extends BaseRenderable {
12090
10219
  this.buffered = options.buffered ?? false;
12091
10220
  this._live = options.live ?? false;
12092
10221
  this._liveCount = this._live && this._visible ? 1 : 0;
12093
- this.yogaNode = dist_default.Node.create(yogaConfig);
12094
- this.yogaNode.setDisplay(this._visible ? Display.Flex : Display.None);
10222
+ this.yogaNode = Yoga.Node.create(yogaConfig);
10223
+ this.yogaNode.setDisplay(this._visible ? Display2.Flex : Display2.None);
12095
10224
  this.setupYogaProperties(options);
12096
10225
  this.applyEventOptions(options);
12097
10226
  if (this.buffered) {
@@ -12126,7 +10255,7 @@ class Renderable extends BaseRenderable {
12126
10255
  return;
12127
10256
  const wasVisible = this._visible;
12128
10257
  this._visible = value;
12129
- this.yogaNode.setDisplay(value ? Display.Flex : Display.None);
10258
+ this.yogaNode.setDisplay(value ? Display2.Flex : Display2.None);
12130
10259
  if (this._live) {
12131
10260
  if (!wasVisible && value) {
12132
10261
  this.propagateLiveCount(1);
@@ -12445,40 +10574,40 @@ class Renderable extends BaseRenderable {
12445
10574
  setupMarginAndPadding(options) {
12446
10575
  const node = this.yogaNode;
12447
10576
  if (isMarginType(options.margin)) {
12448
- node.setMargin(Edge.Top, options.margin);
12449
- node.setMargin(Edge.Right, options.margin);
12450
- node.setMargin(Edge.Bottom, options.margin);
12451
- node.setMargin(Edge.Left, options.margin);
10577
+ node.setMargin(Edge2.Top, options.margin);
10578
+ node.setMargin(Edge2.Right, options.margin);
10579
+ node.setMargin(Edge2.Bottom, options.margin);
10580
+ node.setMargin(Edge2.Left, options.margin);
12452
10581
  }
12453
10582
  if (isMarginType(options.marginTop)) {
12454
- node.setMargin(Edge.Top, options.marginTop);
10583
+ node.setMargin(Edge2.Top, options.marginTop);
12455
10584
  }
12456
10585
  if (isMarginType(options.marginRight)) {
12457
- node.setMargin(Edge.Right, options.marginRight);
10586
+ node.setMargin(Edge2.Right, options.marginRight);
12458
10587
  }
12459
10588
  if (isMarginType(options.marginBottom)) {
12460
- node.setMargin(Edge.Bottom, options.marginBottom);
10589
+ node.setMargin(Edge2.Bottom, options.marginBottom);
12461
10590
  }
12462
10591
  if (isMarginType(options.marginLeft)) {
12463
- node.setMargin(Edge.Left, options.marginLeft);
10592
+ node.setMargin(Edge2.Left, options.marginLeft);
12464
10593
  }
12465
10594
  if (isPaddingType(options.padding)) {
12466
- node.setPadding(Edge.Top, options.padding);
12467
- node.setPadding(Edge.Right, options.padding);
12468
- node.setPadding(Edge.Bottom, options.padding);
12469
- node.setPadding(Edge.Left, options.padding);
10595
+ node.setPadding(Edge2.Top, options.padding);
10596
+ node.setPadding(Edge2.Right, options.padding);
10597
+ node.setPadding(Edge2.Bottom, options.padding);
10598
+ node.setPadding(Edge2.Left, options.padding);
12470
10599
  }
12471
10600
  if (isPaddingType(options.paddingTop)) {
12472
- node.setPadding(Edge.Top, options.paddingTop);
10601
+ node.setPadding(Edge2.Top, options.paddingTop);
12473
10602
  }
12474
10603
  if (isPaddingType(options.paddingRight)) {
12475
- node.setPadding(Edge.Right, options.paddingRight);
10604
+ node.setPadding(Edge2.Right, options.paddingRight);
12476
10605
  }
12477
10606
  if (isPaddingType(options.paddingBottom)) {
12478
- node.setPadding(Edge.Bottom, options.paddingBottom);
10607
+ node.setPadding(Edge2.Bottom, options.paddingBottom);
12479
10608
  }
12480
10609
  if (isPaddingType(options.paddingLeft)) {
12481
- node.setPadding(Edge.Left, options.paddingLeft);
10610
+ node.setPadding(Edge2.Left, options.paddingLeft);
12482
10611
  }
12483
10612
  }
12484
10613
  set position(positionType) {
@@ -12507,30 +10636,30 @@ class Renderable extends BaseRenderable {
12507
10636
  const { top, right, bottom, left } = position;
12508
10637
  if (isPositionType(top)) {
12509
10638
  if (top === "auto") {
12510
- node.setPositionAuto(Edge.Top);
10639
+ node.setPositionAuto(Edge2.Top);
12511
10640
  } else {
12512
- node.setPosition(Edge.Top, top);
10641
+ node.setPosition(Edge2.Top, top);
12513
10642
  }
12514
10643
  }
12515
10644
  if (isPositionType(right)) {
12516
10645
  if (right === "auto") {
12517
- node.setPositionAuto(Edge.Right);
10646
+ node.setPositionAuto(Edge2.Right);
12518
10647
  } else {
12519
- node.setPosition(Edge.Right, right);
10648
+ node.setPosition(Edge2.Right, right);
12520
10649
  }
12521
10650
  }
12522
10651
  if (isPositionType(bottom)) {
12523
10652
  if (bottom === "auto") {
12524
- node.setPositionAuto(Edge.Bottom);
10653
+ node.setPositionAuto(Edge2.Bottom);
12525
10654
  } else {
12526
- node.setPosition(Edge.Bottom, bottom);
10655
+ node.setPosition(Edge2.Bottom, bottom);
12527
10656
  }
12528
10657
  }
12529
10658
  if (isPositionType(left)) {
12530
10659
  if (left === "auto") {
12531
- node.setPositionAuto(Edge.Left);
10660
+ node.setPositionAuto(Edge2.Left);
12532
10661
  } else {
12533
- node.setPosition(Edge.Left, left);
10662
+ node.setPosition(Edge2.Left, left);
12534
10663
  }
12535
10664
  }
12536
10665
  this.requestRender();
@@ -12602,68 +10731,68 @@ class Renderable extends BaseRenderable {
12602
10731
  set margin(margin) {
12603
10732
  if (isMarginType(margin)) {
12604
10733
  const node = this.yogaNode;
12605
- node.setMargin(Edge.Top, margin);
12606
- node.setMargin(Edge.Right, margin);
12607
- node.setMargin(Edge.Bottom, margin);
12608
- node.setMargin(Edge.Left, margin);
10734
+ node.setMargin(Edge2.Top, margin);
10735
+ node.setMargin(Edge2.Right, margin);
10736
+ node.setMargin(Edge2.Bottom, margin);
10737
+ node.setMargin(Edge2.Left, margin);
12609
10738
  this.requestRender();
12610
10739
  }
12611
10740
  }
12612
10741
  set marginTop(margin) {
12613
10742
  if (isMarginType(margin)) {
12614
- this.yogaNode.setMargin(Edge.Top, margin);
10743
+ this.yogaNode.setMargin(Edge2.Top, margin);
12615
10744
  this.requestRender();
12616
10745
  }
12617
10746
  }
12618
10747
  set marginRight(margin) {
12619
10748
  if (isMarginType(margin)) {
12620
- this.yogaNode.setMargin(Edge.Right, margin);
10749
+ this.yogaNode.setMargin(Edge2.Right, margin);
12621
10750
  this.requestRender();
12622
10751
  }
12623
10752
  }
12624
10753
  set marginBottom(margin) {
12625
10754
  if (isMarginType(margin)) {
12626
- this.yogaNode.setMargin(Edge.Bottom, margin);
10755
+ this.yogaNode.setMargin(Edge2.Bottom, margin);
12627
10756
  this.requestRender();
12628
10757
  }
12629
10758
  }
12630
10759
  set marginLeft(margin) {
12631
10760
  if (isMarginType(margin)) {
12632
- this.yogaNode.setMargin(Edge.Left, margin);
10761
+ this.yogaNode.setMargin(Edge2.Left, margin);
12633
10762
  this.requestRender();
12634
10763
  }
12635
10764
  }
12636
10765
  set padding(padding) {
12637
10766
  if (isPaddingType(padding)) {
12638
10767
  const node = this.yogaNode;
12639
- node.setPadding(Edge.Top, padding);
12640
- node.setPadding(Edge.Right, padding);
12641
- node.setPadding(Edge.Bottom, padding);
12642
- node.setPadding(Edge.Left, padding);
10768
+ node.setPadding(Edge2.Top, padding);
10769
+ node.setPadding(Edge2.Right, padding);
10770
+ node.setPadding(Edge2.Bottom, padding);
10771
+ node.setPadding(Edge2.Left, padding);
12643
10772
  this.requestRender();
12644
10773
  }
12645
10774
  }
12646
10775
  set paddingTop(padding) {
12647
10776
  if (isPaddingType(padding)) {
12648
- this.yogaNode.setPadding(Edge.Top, padding);
10777
+ this.yogaNode.setPadding(Edge2.Top, padding);
12649
10778
  this.requestRender();
12650
10779
  }
12651
10780
  }
12652
10781
  set paddingRight(padding) {
12653
10782
  if (isPaddingType(padding)) {
12654
- this.yogaNode.setPadding(Edge.Right, padding);
10783
+ this.yogaNode.setPadding(Edge2.Right, padding);
12655
10784
  this.requestRender();
12656
10785
  }
12657
10786
  }
12658
10787
  set paddingBottom(padding) {
12659
10788
  if (isPaddingType(padding)) {
12660
- this.yogaNode.setPadding(Edge.Bottom, padding);
10789
+ this.yogaNode.setPadding(Edge2.Bottom, padding);
12661
10790
  this.requestRender();
12662
10791
  }
12663
10792
  }
12664
10793
  set paddingLeft(padding) {
12665
10794
  if (isPaddingType(padding)) {
12666
- this.yogaNode.setPadding(Edge.Left, padding);
10795
+ this.yogaNode.setPadding(Edge2.Left, padding);
12667
10796
  this.requestRender();
12668
10797
  }
12669
10798
  }
@@ -13079,10 +11208,10 @@ class RootRenderable extends Renderable {
13079
11208
  if (this.yogaNode) {
13080
11209
  this.yogaNode.free();
13081
11210
  }
13082
- this.yogaNode = dist_default.Node.create(yogaConfig);
11211
+ this.yogaNode = Yoga.Node.create(yogaConfig);
13083
11212
  this.yogaNode.setWidth(ctx.width);
13084
11213
  this.yogaNode.setHeight(ctx.height);
13085
- this.yogaNode.setFlexDirection(FlexDirection.Column);
11214
+ this.yogaNode.setFlexDirection(FlexDirection2.Column);
13086
11215
  this.calculateLayout();
13087
11216
  }
13088
11217
  render(buffer, deltaTime) {
@@ -13123,7 +11252,7 @@ class RootRenderable extends Renderable {
13123
11252
  }
13124
11253
  }
13125
11254
  calculateLayout() {
13126
- this.yogaNode.calculateLayout(this.width, this.height, Direction.LTR);
11255
+ this.yogaNode.calculateLayout(this.width, this.height, Direction2.LTR);
13127
11256
  this.emit("layout-changed" /* LAYOUT_CHANGED */);
13128
11257
  }
13129
11258
  resize(width, height) {
@@ -14389,13 +12518,13 @@ Captured output:
14389
12518
  get controlState() {
14390
12519
  return this._controlState;
14391
12520
  }
14392
- constructor(lib2, rendererPtr, stdin, stdout, width, height, config = {}) {
12521
+ constructor(lib, rendererPtr, stdin, stdout, width, height, config = {}) {
14393
12522
  super();
14394
12523
  rendererTracker.addRenderer(this);
14395
12524
  this.stdin = stdin;
14396
12525
  this.stdout = stdout;
14397
12526
  this.realStdoutWrite = stdout.write;
14398
- this.lib = lib2;
12527
+ this.lib = lib;
14399
12528
  this._terminalWidth = stdout.columns;
14400
12529
  this._terminalHeight = stdout.rows;
14401
12530
  this.width = width;
@@ -14406,7 +12535,7 @@ Captured output:
14406
12535
  capture.on("write", this.captureCallback);
14407
12536
  this.renderOffset = height - this._splitHeight;
14408
12537
  this.height = this._splitHeight;
14409
- lib2.setRenderOffset(rendererPtr, this.renderOffset);
12538
+ lib.setRenderOffset(rendererPtr, this.renderOffset);
14410
12539
  }
14411
12540
  this.rendererPtr = rendererPtr;
14412
12541
  this.exitOnCtrlC = config.exitOnCtrlC === undefined ? true : config.exitOnCtrlC;
@@ -15000,19 +13129,19 @@ Captured output:
15000
13129
  this.lib.dumpStdoutBuffer(this.rendererPtr, timestamp);
15001
13130
  }
15002
13131
  static setCursorPosition(renderer, x, y, visible = true) {
15003
- const lib2 = resolveRenderLib();
15004
- lib2.setCursorPosition(renderer.rendererPtr, x, y, visible);
13132
+ const lib = resolveRenderLib();
13133
+ lib.setCursorPosition(renderer.rendererPtr, x, y, visible);
15005
13134
  }
15006
13135
  static setCursorStyle(renderer, style, blinking = false, color) {
15007
- const lib2 = resolveRenderLib();
15008
- lib2.setCursorStyle(renderer.rendererPtr, style, blinking);
13136
+ const lib = resolveRenderLib();
13137
+ lib.setCursorStyle(renderer.rendererPtr, style, blinking);
15009
13138
  if (color) {
15010
- lib2.setCursorColor(renderer.rendererPtr, color);
13139
+ lib.setCursorColor(renderer.rendererPtr, color);
15011
13140
  }
15012
13141
  }
15013
13142
  static setCursorColor(renderer, color) {
15014
- const lib2 = resolveRenderLib();
15015
- lib2.setCursorColor(renderer.rendererPtr, color);
13143
+ const lib = resolveRenderLib();
13144
+ lib.setCursorColor(renderer.rendererPtr, color);
15016
13145
  }
15017
13146
  setCursorPosition(x, y, visible = true) {
15018
13147
  this.lib.setCursorPosition(this.rendererPtr, x, y, visible);
@@ -15449,7 +13578,7 @@ Captured output:
15449
13578
  }
15450
13579
  }
15451
13580
 
15452
- export { Edge, Gutter, MeasureMode, exports_dist, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
13581
+ export { BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
15453
13582
 
15454
- //# debugId=1623532973D99D8964756E2164756E21
15455
- //# sourceMappingURL=index-re80811e.js.map
13583
+ //# debugId=D2D576D668A923C064756E2164756E21
13584
+ //# sourceMappingURL=index-x5bb5xvn.js.map