@opentui/core 0.0.0-20251202-71dcabc4 → 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.
- package/3d.js +57 -31293
- package/3d.js.map +3 -136
- package/{index-r6acnfwr.js → index-x5bb5xvn.js} +220 -2022
- package/{index-r6acnfwr.js.map → index-x5bb5xvn.js.map} +3 -5
- package/index.js +22 -736
- package/index.js.map +4 -14
- package/package.json +8 -8
- package/testing.js +1 -1
- package/libyoga-2ksztx35.dylib +0 -0
- package/libyoga-gh2tjwb7.so +0 -0
- package/libyoga-j5nt7np1.dylib +0 -0
- package/libyoga-wnbqxxhv.so +0 -0
- package/yoga-jkgc6c1f.dll +0 -0
|
@@ -1,1215 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, {
|
|
22
|
-
get: all[name],
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
set: (newValue) => all[name] = () => newValue
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
|
-
var __require = import.meta.require;
|
|
30
|
-
|
|
31
|
-
// ../../node_modules/bun-yoga/dist/darwin-arm64/libyoga.dylib
|
|
32
|
-
var exports_libyoga = {};
|
|
33
|
-
__export(exports_libyoga, {
|
|
34
|
-
default: () => libyoga_default
|
|
35
|
-
});
|
|
36
|
-
var libyoga_default = "./libyoga-j5nt7np1.dylib";
|
|
37
|
-
var init_libyoga = () => {};
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/bun-yoga/dist/darwin-x64/libyoga.dylib
|
|
40
|
-
var exports_libyoga2 = {};
|
|
41
|
-
__export(exports_libyoga2, {
|
|
42
|
-
default: () => libyoga_default2
|
|
43
|
-
});
|
|
44
|
-
var libyoga_default2 = "./libyoga-2ksztx35.dylib";
|
|
45
|
-
var init_libyoga2 = () => {};
|
|
46
|
-
|
|
47
|
-
// ../../node_modules/bun-yoga/dist/linux-x64/libyoga.so
|
|
48
|
-
var exports_libyoga3 = {};
|
|
49
|
-
__export(exports_libyoga3, {
|
|
50
|
-
default: () => libyoga_default3
|
|
51
|
-
});
|
|
52
|
-
var libyoga_default3 = "./libyoga-wnbqxxhv.so";
|
|
53
|
-
var init_libyoga3 = () => {};
|
|
54
|
-
|
|
55
|
-
// ../../node_modules/bun-yoga/dist/linux-arm64/libyoga.so
|
|
56
|
-
var exports_libyoga4 = {};
|
|
57
|
-
__export(exports_libyoga4, {
|
|
58
|
-
default: () => libyoga_default4
|
|
59
|
-
});
|
|
60
|
-
var libyoga_default4 = "./libyoga-gh2tjwb7.so";
|
|
61
|
-
var init_libyoga4 = () => {};
|
|
62
|
-
|
|
63
|
-
// ../../node_modules/bun-yoga/dist/windows-x64/yoga.dll
|
|
64
|
-
var exports_yoga = {};
|
|
65
|
-
__export(exports_yoga, {
|
|
66
|
-
default: () => yoga_default
|
|
67
|
-
});
|
|
68
|
-
var yoga_default = "./yoga-jkgc6c1f.dll";
|
|
69
|
-
var init_yoga = () => {};
|
|
70
|
-
|
|
71
|
-
// ../../node_modules/bun-yoga/dist/index.js
|
|
72
|
-
var require_dist = __commonJS((exports) => {
|
|
73
|
-
var __dirname = "/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist";
|
|
74
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
-
exports.OVERFLOW_VISIBLE = exports.WRAP_WRAP_REVERSE = exports.WRAP_WRAP = exports.WRAP_NO_WRAP = exports.ALIGN_SPACE_EVENLY = exports.ALIGN_SPACE_AROUND = exports.ALIGN_SPACE_BETWEEN = exports.ALIGN_BASELINE = exports.ALIGN_STRETCH = exports.ALIGN_FLEX_END = exports.ALIGN_CENTER = exports.ALIGN_FLEX_START = exports.ALIGN_AUTO = exports.JUSTIFY_SPACE_EVENLY = exports.JUSTIFY_SPACE_AROUND = exports.JUSTIFY_SPACE_BETWEEN = exports.JUSTIFY_FLEX_END = exports.JUSTIFY_CENTER = exports.JUSTIFY_FLEX_START = exports.FLEX_DIRECTION_ROW_REVERSE = exports.FLEX_DIRECTION_ROW = exports.FLEX_DIRECTION_COLUMN_REVERSE = exports.FLEX_DIRECTION_COLUMN = exports.EDGE_ALL = exports.EDGE_VERTICAL = exports.EDGE_HORIZONTAL = exports.EDGE_END = exports.EDGE_START = exports.EDGE_BOTTOM = exports.EDGE_RIGHT = exports.EDGE_TOP = exports.EDGE_LEFT = exports.Wrap = exports.Unit = exports.PositionType = exports.Overflow = exports.NodeType = exports.MeasureMode = exports.LogLevel = exports.Justify = exports.Gutter = exports.FlexDirection = exports.ExperimentalFeature = exports.Errata = exports.Edge = exports.Display = exports.Direction = exports.Dimension = exports.BoxSizing = exports.Align = undefined;
|
|
76
|
-
exports.Config = exports.Node = exports.DIRECTION_RTL = exports.DIRECTION_LTR = exports.DIRECTION_INHERIT = exports.POSITION_TYPE_ABSOLUTE = exports.POSITION_TYPE_RELATIVE = exports.POSITION_TYPE_STATIC = exports.DISPLAY_NONE = exports.DISPLAY_FLEX = exports.OVERFLOW_SCROLL = exports.OVERFLOW_HIDDEN = undefined;
|
|
77
|
-
var bun_ffi_1 = __require("bun:ffi");
|
|
78
|
-
var path_1 = __require("path");
|
|
79
|
-
var fs_1 = __require("fs");
|
|
80
|
-
function getEmbeddedLib() {
|
|
81
|
-
try {
|
|
82
|
-
if (process.platform === "darwin" && process.arch === "arm64") {
|
|
83
|
-
return __require.resolve("/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist/darwin-arm64/libyoga.dylib");
|
|
84
|
-
} else if (process.platform === "darwin" && process.arch === "x64") {
|
|
85
|
-
return __require.resolve("/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist/darwin-x64/libyoga.dylib");
|
|
86
|
-
} else if (process.platform === "linux" && process.arch === "x64") {
|
|
87
|
-
return __require.resolve("/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist/linux-x64/libyoga.so");
|
|
88
|
-
} else if (process.platform === "linux" && process.arch === "arm64") {
|
|
89
|
-
return __require.resolve("/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist/linux-arm64/libyoga.so");
|
|
90
|
-
} else if (process.platform === "win32") {
|
|
91
|
-
return __require.resolve("/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist/windows-x64/yoga.dll");
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
} catch {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function getLibPath() {
|
|
99
|
-
if (process.platform === "win32") {
|
|
100
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "zig-out", "lib", `yoga.${bun_ffi_1.suffix}`))) {
|
|
101
|
-
return (0, path_1.join)(__dirname, "..", "zig-out", "lib", `yoga.${bun_ffi_1.suffix}`);
|
|
102
|
-
}
|
|
103
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "zig-out", "bin", `yoga.${bun_ffi_1.suffix}`))) {
|
|
104
|
-
return (0, path_1.join)(__dirname, "..", "zig-out", "bin", `yoga.${bun_ffi_1.suffix}`);
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "zig-out", "lib", `libyoga.${bun_ffi_1.suffix}`))) {
|
|
108
|
-
return (0, path_1.join)(__dirname, "..", "zig-out", "lib", `libyoga.${bun_ffi_1.suffix}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const embedded = getEmbeddedLib();
|
|
112
|
-
if (embedded) {
|
|
113
|
-
return embedded;
|
|
114
|
-
}
|
|
115
|
-
if (process.platform === "darwin" && process.arch === "arm64") {
|
|
116
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "dist", "darwin-arm64", `libyoga.${bun_ffi_1.suffix}`))) {
|
|
117
|
-
return (0, path_1.join)(__dirname, "..", "dist", "darwin-arm64", `libyoga.${bun_ffi_1.suffix}`);
|
|
118
|
-
}
|
|
119
|
-
} else if (process.platform === "darwin" && process.arch === "x64") {
|
|
120
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "dist", "darwin-x64", `libyoga.${bun_ffi_1.suffix}`))) {
|
|
121
|
-
return (0, path_1.join)(__dirname, "..", "dist", "darwin-x64", `libyoga.${bun_ffi_1.suffix}`);
|
|
122
|
-
}
|
|
123
|
-
} else if (process.platform === "linux" && process.arch === "x64") {
|
|
124
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "dist", "linux-x64", `libyoga.${bun_ffi_1.suffix}`))) {
|
|
125
|
-
return (0, path_1.join)(__dirname, "..", "dist", "linux-x64", `libyoga.${bun_ffi_1.suffix}`);
|
|
126
|
-
}
|
|
127
|
-
} else if (process.platform === "linux" && process.arch === "arm64") {
|
|
128
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "dist", "linux-arm64", `libyoga.${bun_ffi_1.suffix}`))) {
|
|
129
|
-
return (0, path_1.join)(__dirname, "..", "dist", "linux-arm64", `libyoga.${bun_ffi_1.suffix}`);
|
|
130
|
-
}
|
|
131
|
-
} else if (process.platform === "win32") {
|
|
132
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(__dirname, "..", "dist", "windows-x64", `yoga.${bun_ffi_1.suffix}`))) {
|
|
133
|
-
return (0, path_1.join)(__dirname, "..", "dist", "windows-x64", `yoga.${bun_ffi_1.suffix}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
throw new Error(`Could not find native library. ` + `Platform: ${process.platform}-${process.arch}
|
|
137
|
-
` + `Make sure to run 'zig build' or install the package with binaries.`);
|
|
138
|
-
}
|
|
139
|
-
exports.Align = {
|
|
140
|
-
Auto: 0,
|
|
141
|
-
FlexStart: 1,
|
|
142
|
-
Center: 2,
|
|
143
|
-
FlexEnd: 3,
|
|
144
|
-
Stretch: 4,
|
|
145
|
-
Baseline: 5,
|
|
146
|
-
SpaceBetween: 6,
|
|
147
|
-
SpaceAround: 7,
|
|
148
|
-
SpaceEvenly: 8
|
|
149
|
-
};
|
|
150
|
-
exports.BoxSizing = {
|
|
151
|
-
BorderBox: 0,
|
|
152
|
-
ContentBox: 1
|
|
153
|
-
};
|
|
154
|
-
exports.Dimension = {
|
|
155
|
-
Width: 0,
|
|
156
|
-
Height: 1
|
|
157
|
-
};
|
|
158
|
-
exports.Direction = {
|
|
159
|
-
Inherit: 0,
|
|
160
|
-
LTR: 1,
|
|
161
|
-
RTL: 2
|
|
162
|
-
};
|
|
163
|
-
exports.Display = {
|
|
164
|
-
Flex: 0,
|
|
165
|
-
None: 1,
|
|
166
|
-
Contents: 2
|
|
167
|
-
};
|
|
168
|
-
exports.Edge = {
|
|
169
|
-
Left: 0,
|
|
170
|
-
Top: 1,
|
|
171
|
-
Right: 2,
|
|
172
|
-
Bottom: 3,
|
|
173
|
-
Start: 4,
|
|
174
|
-
End: 5,
|
|
175
|
-
Horizontal: 6,
|
|
176
|
-
Vertical: 7,
|
|
177
|
-
All: 8
|
|
178
|
-
};
|
|
179
|
-
exports.Errata = {
|
|
180
|
-
None: 0,
|
|
181
|
-
StretchFlexBasis: 1,
|
|
182
|
-
AbsolutePositionWithoutInsetsExcludesPadding: 2,
|
|
183
|
-
AbsolutePercentAgainstInnerSize: 4,
|
|
184
|
-
All: 2147483647,
|
|
185
|
-
Classic: 2147483646
|
|
186
|
-
};
|
|
187
|
-
exports.ExperimentalFeature = {
|
|
188
|
-
WebFlexBasis: 0
|
|
189
|
-
};
|
|
190
|
-
exports.FlexDirection = {
|
|
191
|
-
Column: 0,
|
|
192
|
-
ColumnReverse: 1,
|
|
193
|
-
Row: 2,
|
|
194
|
-
RowReverse: 3
|
|
195
|
-
};
|
|
196
|
-
exports.Gutter = {
|
|
197
|
-
Column: 0,
|
|
198
|
-
Row: 1,
|
|
199
|
-
All: 2
|
|
200
|
-
};
|
|
201
|
-
exports.Justify = {
|
|
202
|
-
FlexStart: 0,
|
|
203
|
-
Center: 1,
|
|
204
|
-
FlexEnd: 2,
|
|
205
|
-
SpaceBetween: 3,
|
|
206
|
-
SpaceAround: 4,
|
|
207
|
-
SpaceEvenly: 5
|
|
208
|
-
};
|
|
209
|
-
exports.LogLevel = {
|
|
210
|
-
Error: 0,
|
|
211
|
-
Warn: 1,
|
|
212
|
-
Info: 2,
|
|
213
|
-
Debug: 3,
|
|
214
|
-
Verbose: 4,
|
|
215
|
-
Fatal: 5
|
|
216
|
-
};
|
|
217
|
-
exports.MeasureMode = {
|
|
218
|
-
Undefined: 0,
|
|
219
|
-
Exactly: 1,
|
|
220
|
-
AtMost: 2
|
|
221
|
-
};
|
|
222
|
-
exports.NodeType = {
|
|
223
|
-
Default: 0,
|
|
224
|
-
Text: 1
|
|
225
|
-
};
|
|
226
|
-
exports.Overflow = {
|
|
227
|
-
Visible: 0,
|
|
228
|
-
Hidden: 1,
|
|
229
|
-
Scroll: 2
|
|
230
|
-
};
|
|
231
|
-
exports.PositionType = {
|
|
232
|
-
Static: 0,
|
|
233
|
-
Relative: 1,
|
|
234
|
-
Absolute: 2
|
|
235
|
-
};
|
|
236
|
-
exports.Unit = {
|
|
237
|
-
Undefined: 0,
|
|
238
|
-
Point: 1,
|
|
239
|
-
Percent: 2,
|
|
240
|
-
Auto: 3
|
|
241
|
-
};
|
|
242
|
-
exports.Wrap = {
|
|
243
|
-
NoWrap: 0,
|
|
244
|
-
Wrap: 1,
|
|
245
|
-
WrapReverse: 2
|
|
246
|
-
};
|
|
247
|
-
exports.EDGE_LEFT = exports.Edge.Left;
|
|
248
|
-
exports.EDGE_TOP = exports.Edge.Top;
|
|
249
|
-
exports.EDGE_RIGHT = exports.Edge.Right;
|
|
250
|
-
exports.EDGE_BOTTOM = exports.Edge.Bottom;
|
|
251
|
-
exports.EDGE_START = exports.Edge.Start;
|
|
252
|
-
exports.EDGE_END = exports.Edge.End;
|
|
253
|
-
exports.EDGE_HORIZONTAL = exports.Edge.Horizontal;
|
|
254
|
-
exports.EDGE_VERTICAL = exports.Edge.Vertical;
|
|
255
|
-
exports.EDGE_ALL = exports.Edge.All;
|
|
256
|
-
exports.FLEX_DIRECTION_COLUMN = exports.FlexDirection.Column;
|
|
257
|
-
exports.FLEX_DIRECTION_COLUMN_REVERSE = exports.FlexDirection.ColumnReverse;
|
|
258
|
-
exports.FLEX_DIRECTION_ROW = exports.FlexDirection.Row;
|
|
259
|
-
exports.FLEX_DIRECTION_ROW_REVERSE = exports.FlexDirection.RowReverse;
|
|
260
|
-
exports.JUSTIFY_FLEX_START = exports.Justify.FlexStart;
|
|
261
|
-
exports.JUSTIFY_CENTER = exports.Justify.Center;
|
|
262
|
-
exports.JUSTIFY_FLEX_END = exports.Justify.FlexEnd;
|
|
263
|
-
exports.JUSTIFY_SPACE_BETWEEN = exports.Justify.SpaceBetween;
|
|
264
|
-
exports.JUSTIFY_SPACE_AROUND = exports.Justify.SpaceAround;
|
|
265
|
-
exports.JUSTIFY_SPACE_EVENLY = exports.Justify.SpaceEvenly;
|
|
266
|
-
exports.ALIGN_AUTO = exports.Align.Auto;
|
|
267
|
-
exports.ALIGN_FLEX_START = exports.Align.FlexStart;
|
|
268
|
-
exports.ALIGN_CENTER = exports.Align.Center;
|
|
269
|
-
exports.ALIGN_FLEX_END = exports.Align.FlexEnd;
|
|
270
|
-
exports.ALIGN_STRETCH = exports.Align.Stretch;
|
|
271
|
-
exports.ALIGN_BASELINE = exports.Align.Baseline;
|
|
272
|
-
exports.ALIGN_SPACE_BETWEEN = exports.Align.SpaceBetween;
|
|
273
|
-
exports.ALIGN_SPACE_AROUND = exports.Align.SpaceAround;
|
|
274
|
-
exports.ALIGN_SPACE_EVENLY = exports.Align.SpaceEvenly;
|
|
275
|
-
exports.WRAP_NO_WRAP = exports.Wrap.NoWrap;
|
|
276
|
-
exports.WRAP_WRAP = exports.Wrap.Wrap;
|
|
277
|
-
exports.WRAP_WRAP_REVERSE = exports.Wrap.WrapReverse;
|
|
278
|
-
exports.OVERFLOW_VISIBLE = exports.Overflow.Visible;
|
|
279
|
-
exports.OVERFLOW_HIDDEN = exports.Overflow.Hidden;
|
|
280
|
-
exports.OVERFLOW_SCROLL = exports.Overflow.Scroll;
|
|
281
|
-
exports.DISPLAY_FLEX = exports.Display.Flex;
|
|
282
|
-
exports.DISPLAY_NONE = exports.Display.None;
|
|
283
|
-
exports.POSITION_TYPE_STATIC = exports.PositionType.Static;
|
|
284
|
-
exports.POSITION_TYPE_RELATIVE = exports.PositionType.Relative;
|
|
285
|
-
exports.POSITION_TYPE_ABSOLUTE = exports.PositionType.Absolute;
|
|
286
|
-
exports.DIRECTION_INHERIT = exports.Direction.Inherit;
|
|
287
|
-
exports.DIRECTION_LTR = exports.Direction.LTR;
|
|
288
|
-
exports.DIRECTION_RTL = exports.Direction.RTL;
|
|
289
|
-
function parseValue(value) {
|
|
290
|
-
if (value === undefined) {
|
|
291
|
-
return { unit: exports.Unit.Undefined, asNumber: undefined };
|
|
292
|
-
}
|
|
293
|
-
if (value === "auto") {
|
|
294
|
-
return { unit: exports.Unit.Auto, asNumber: undefined };
|
|
295
|
-
}
|
|
296
|
-
if (typeof value === "string" && value.endsWith("%")) {
|
|
297
|
-
return { unit: exports.Unit.Percent, asNumber: parseFloat(value) };
|
|
298
|
-
}
|
|
299
|
-
return { unit: exports.Unit.Point, asNumber: value };
|
|
300
|
-
}
|
|
301
|
-
function unpackValue(packed) {
|
|
302
|
-
const p = BigInt(packed);
|
|
303
|
-
const unit = Number(p & 0xffffffffn);
|
|
304
|
-
const valueBits = Number(p >> 32n & 0xffffffffn);
|
|
305
|
-
const buffer = new ArrayBuffer(4);
|
|
306
|
-
const view = new DataView(buffer);
|
|
307
|
-
view.setUint32(0, valueBits, true);
|
|
308
|
-
const value = view.getFloat32(0, true);
|
|
309
|
-
return { unit, value };
|
|
310
|
-
}
|
|
311
|
-
var lib = (0, bun_ffi_1.dlopen)(getLibPath(), {
|
|
312
|
-
ygConfigNew: { args: [], returns: "ptr" },
|
|
313
|
-
ygConfigFree: { args: ["ptr"], returns: "void" },
|
|
314
|
-
ygConfigGetDefault: { args: [], returns: "ptr" },
|
|
315
|
-
ygConfigSetUseWebDefaults: { args: ["ptr", "bool"], returns: "void" },
|
|
316
|
-
ygConfigGetUseWebDefaults: { args: ["ptr"], returns: "bool" },
|
|
317
|
-
ygConfigSetPointScaleFactor: { args: ["ptr", "f32"], returns: "void" },
|
|
318
|
-
ygConfigGetPointScaleFactor: { args: ["ptr"], returns: "f32" },
|
|
319
|
-
ygConfigSetErrata: { args: ["ptr", "i32"], returns: "void" },
|
|
320
|
-
ygConfigGetErrata: { args: ["ptr"], returns: "i32" },
|
|
321
|
-
ygConfigSetExperimentalFeatureEnabled: {
|
|
322
|
-
args: ["ptr", "i32", "bool"],
|
|
323
|
-
returns: "void"
|
|
324
|
-
},
|
|
325
|
-
ygConfigIsExperimentalFeatureEnabled: {
|
|
326
|
-
args: ["ptr", "i32"],
|
|
327
|
-
returns: "bool"
|
|
328
|
-
},
|
|
329
|
-
ygNodeNew: { args: [], returns: "ptr" },
|
|
330
|
-
ygNodeNewWithConfig: { args: ["ptr"], returns: "ptr" },
|
|
331
|
-
ygNodeClone: { args: ["ptr"], returns: "ptr" },
|
|
332
|
-
ygNodeFree: { args: ["ptr"], returns: "void" },
|
|
333
|
-
ygNodeFreeRecursive: { args: ["ptr"], returns: "void" },
|
|
334
|
-
ygNodeReset: { args: ["ptr"], returns: "void" },
|
|
335
|
-
ygNodeCopyStyle: { args: ["ptr", "ptr"], returns: "void" },
|
|
336
|
-
ygNodeSetIsReferenceBaseline: { args: ["ptr", "bool"], returns: "void" },
|
|
337
|
-
ygNodeIsReferenceBaseline: { args: ["ptr"], returns: "bool" },
|
|
338
|
-
ygNodeSetAlwaysFormsContainingBlock: {
|
|
339
|
-
args: ["ptr", "bool"],
|
|
340
|
-
returns: "void"
|
|
341
|
-
},
|
|
342
|
-
ygNodeInsertChild: { args: ["ptr", "ptr", "u64"], returns: "void" },
|
|
343
|
-
ygNodeRemoveChild: { args: ["ptr", "ptr"], returns: "void" },
|
|
344
|
-
ygNodeRemoveAllChildren: { args: ["ptr"], returns: "void" },
|
|
345
|
-
ygNodeGetChild: { args: ["ptr", "u64"], returns: "ptr" },
|
|
346
|
-
ygNodeGetChildCount: { args: ["ptr"], returns: "u64" },
|
|
347
|
-
ygNodeGetParent: { args: ["ptr"], returns: "ptr" },
|
|
348
|
-
ygNodeCalculateLayout: { args: ["ptr", "f32", "f32", "i32"], returns: "void" },
|
|
349
|
-
ygNodeGetHasNewLayout: { args: ["ptr"], returns: "bool" },
|
|
350
|
-
ygNodeSetHasNewLayout: { args: ["ptr", "bool"], returns: "void" },
|
|
351
|
-
ygNodeMarkDirty: { args: ["ptr"], returns: "void" },
|
|
352
|
-
ygNodeIsDirty: { args: ["ptr"], returns: "bool" },
|
|
353
|
-
ygNodeLayoutGetLeft: { args: ["ptr"], returns: "f32" },
|
|
354
|
-
ygNodeLayoutGetTop: { args: ["ptr"], returns: "f32" },
|
|
355
|
-
ygNodeLayoutGetRight: { args: ["ptr"], returns: "f32" },
|
|
356
|
-
ygNodeLayoutGetBottom: { args: ["ptr"], returns: "f32" },
|
|
357
|
-
ygNodeLayoutGetWidth: { args: ["ptr"], returns: "f32" },
|
|
358
|
-
ygNodeLayoutGetHeight: { args: ["ptr"], returns: "f32" },
|
|
359
|
-
ygNodeLayoutGetBorder: { args: ["ptr", "i32"], returns: "f32" },
|
|
360
|
-
ygNodeLayoutGetMargin: { args: ["ptr", "i32"], returns: "f32" },
|
|
361
|
-
ygNodeLayoutGetPadding: { args: ["ptr", "i32"], returns: "f32" },
|
|
362
|
-
ygNodeStyleSetDirection: { args: ["ptr", "i32"], returns: "void" },
|
|
363
|
-
ygNodeStyleGetDirection: { args: ["ptr"], returns: "i32" },
|
|
364
|
-
ygNodeStyleSetFlexDirection: { args: ["ptr", "i32"], returns: "void" },
|
|
365
|
-
ygNodeStyleGetFlexDirection: { args: ["ptr"], returns: "i32" },
|
|
366
|
-
ygNodeStyleSetJustifyContent: { args: ["ptr", "i32"], returns: "void" },
|
|
367
|
-
ygNodeStyleGetJustifyContent: { args: ["ptr"], returns: "i32" },
|
|
368
|
-
ygNodeStyleSetAlignContent: { args: ["ptr", "i32"], returns: "void" },
|
|
369
|
-
ygNodeStyleGetAlignContent: { args: ["ptr"], returns: "i32" },
|
|
370
|
-
ygNodeStyleSetAlignItems: { args: ["ptr", "i32"], returns: "void" },
|
|
371
|
-
ygNodeStyleGetAlignItems: { args: ["ptr"], returns: "i32" },
|
|
372
|
-
ygNodeStyleSetAlignSelf: { args: ["ptr", "i32"], returns: "void" },
|
|
373
|
-
ygNodeStyleGetAlignSelf: { args: ["ptr"], returns: "i32" },
|
|
374
|
-
ygNodeStyleSetPositionType: { args: ["ptr", "i32"], returns: "void" },
|
|
375
|
-
ygNodeStyleGetPositionType: { args: ["ptr"], returns: "i32" },
|
|
376
|
-
ygNodeStyleSetFlexWrap: { args: ["ptr", "i32"], returns: "void" },
|
|
377
|
-
ygNodeStyleGetFlexWrap: { args: ["ptr"], returns: "i32" },
|
|
378
|
-
ygNodeStyleSetOverflow: { args: ["ptr", "i32"], returns: "void" },
|
|
379
|
-
ygNodeStyleGetOverflow: { args: ["ptr"], returns: "i32" },
|
|
380
|
-
ygNodeStyleSetDisplay: { args: ["ptr", "i32"], returns: "void" },
|
|
381
|
-
ygNodeStyleGetDisplay: { args: ["ptr"], returns: "i32" },
|
|
382
|
-
ygNodeStyleSetBoxSizing: { args: ["ptr", "i32"], returns: "void" },
|
|
383
|
-
ygNodeStyleGetBoxSizing: { args: ["ptr"], returns: "i32" },
|
|
384
|
-
ygNodeStyleSetFlex: { args: ["ptr", "f32"], returns: "void" },
|
|
385
|
-
ygNodeStyleGetFlex: { args: ["ptr"], returns: "f32" },
|
|
386
|
-
ygNodeStyleSetFlexGrow: { args: ["ptr", "f32"], returns: "void" },
|
|
387
|
-
ygNodeStyleGetFlexGrow: { args: ["ptr"], returns: "f32" },
|
|
388
|
-
ygNodeStyleSetFlexShrink: { args: ["ptr", "f32"], returns: "void" },
|
|
389
|
-
ygNodeStyleGetFlexShrink: { args: ["ptr"], returns: "f32" },
|
|
390
|
-
ygNodeStyleSetFlexBasis: { args: ["ptr", "f32"], returns: "void" },
|
|
391
|
-
ygNodeStyleSetFlexBasisPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
392
|
-
ygNodeStyleSetFlexBasisAuto: { args: ["ptr"], returns: "void" },
|
|
393
|
-
ygNodeStyleSetPosition: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
394
|
-
ygNodeStyleSetPositionPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
395
|
-
ygNodeStyleSetPositionAuto: { args: ["ptr", "i32"], returns: "void" },
|
|
396
|
-
ygNodeStyleSetMargin: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
397
|
-
ygNodeStyleSetMarginPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
398
|
-
ygNodeStyleSetMarginAuto: { args: ["ptr", "i32"], returns: "void" },
|
|
399
|
-
ygNodeStyleSetPadding: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
400
|
-
ygNodeStyleSetPaddingPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
401
|
-
ygNodeStyleSetBorder: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
402
|
-
ygNodeStyleGetBorder: { args: ["ptr", "i32"], returns: "f32" },
|
|
403
|
-
ygNodeStyleSetGap: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
404
|
-
ygNodeStyleSetGapPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
405
|
-
ygNodeStyleSetWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
406
|
-
ygNodeStyleSetWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
407
|
-
ygNodeStyleSetWidthAuto: { args: ["ptr"], returns: "void" },
|
|
408
|
-
ygNodeStyleSetHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
409
|
-
ygNodeStyleSetHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
410
|
-
ygNodeStyleSetHeightAuto: { args: ["ptr"], returns: "void" },
|
|
411
|
-
ygNodeStyleSetMinWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
412
|
-
ygNodeStyleSetMinWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
413
|
-
ygNodeStyleSetMinHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
414
|
-
ygNodeStyleSetMinHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
415
|
-
ygNodeStyleSetMaxWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
416
|
-
ygNodeStyleSetMaxWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
417
|
-
ygNodeStyleSetMaxHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
418
|
-
ygNodeStyleSetMaxHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
419
|
-
ygNodeStyleSetAspectRatio: { args: ["ptr", "f32"], returns: "void" },
|
|
420
|
-
ygNodeStyleGetAspectRatio: { args: ["ptr"], returns: "f32" },
|
|
421
|
-
ygNodeSetContext: { args: ["ptr", "ptr"], returns: "void" },
|
|
422
|
-
ygNodeGetContext: { args: ["ptr"], returns: "ptr" },
|
|
423
|
-
ygNodeSetMeasureFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
424
|
-
ygNodeUnsetMeasureFunc: { args: ["ptr"], returns: "void" },
|
|
425
|
-
ygNodeHasMeasureFunc: { args: ["ptr"], returns: "bool" },
|
|
426
|
-
ygNodeSetBaselineFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
427
|
-
ygNodeUnsetBaselineFunc: { args: ["ptr"], returns: "void" },
|
|
428
|
-
ygNodeHasBaselineFunc: { args: ["ptr"], returns: "bool" },
|
|
429
|
-
ygNodeSetDirtiedFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
430
|
-
ygNodeUnsetDirtiedFunc: { args: ["ptr"], returns: "void" },
|
|
431
|
-
ygNodeGetDirtiedFunc: { args: ["ptr"], returns: "ptr" },
|
|
432
|
-
ygCreateSize: { args: ["f32", "f32"], returns: "u64" },
|
|
433
|
-
ygStoreMeasureResult: { args: ["f32", "f32"], returns: "void" },
|
|
434
|
-
ygStoreBaselineResult: { args: ["f32"], returns: "void" },
|
|
435
|
-
ygNodeSetMeasureFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
|
|
436
|
-
ygNodeUnsetMeasureFuncTrampoline: { args: ["ptr"], returns: "void" },
|
|
437
|
-
ygNodeSetBaselineFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
|
|
438
|
-
ygNodeUnsetBaselineFuncTrampoline: { args: ["ptr"], returns: "void" },
|
|
439
|
-
ygNodeFreeCallbacks: { args: ["ptr"], returns: "void" },
|
|
440
|
-
ygNodeStyleGetWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
441
|
-
ygNodeStyleGetHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
442
|
-
ygNodeStyleGetMinWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
443
|
-
ygNodeStyleGetMinHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
444
|
-
ygNodeStyleGetMaxWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
445
|
-
ygNodeStyleGetMaxHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
446
|
-
ygNodeStyleGetMarginPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
447
|
-
ygNodeStyleGetPaddingPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
448
|
-
ygNodeStyleGetPositionPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
449
|
-
ygNodeStyleGetGapPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
450
|
-
ygNodeStyleGetFlexBasisPacked: { args: ["ptr"], returns: "u64" }
|
|
451
|
-
});
|
|
452
|
-
var yg = lib.symbols;
|
|
453
|
-
|
|
454
|
-
class Node {
|
|
455
|
-
ptr;
|
|
456
|
-
_freed = false;
|
|
457
|
-
measureCallback = null;
|
|
458
|
-
baselineCallback = null;
|
|
459
|
-
dirtiedCallback = null;
|
|
460
|
-
constructor(ptr) {
|
|
461
|
-
this.ptr = ptr;
|
|
462
|
-
}
|
|
463
|
-
isFreed() {
|
|
464
|
-
return this._freed;
|
|
465
|
-
}
|
|
466
|
-
assertNotFreed() {
|
|
467
|
-
if (this._freed) {
|
|
468
|
-
throw new Error("Cannot access freed Yoga node");
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
static create(config) {
|
|
472
|
-
const ptr = config ? yg.ygNodeNewWithConfig(config["ptr"]) : yg.ygNodeNew();
|
|
473
|
-
if (!ptr)
|
|
474
|
-
throw new Error("Failed to create node");
|
|
475
|
-
return new Node(ptr);
|
|
476
|
-
}
|
|
477
|
-
static createDefault() {
|
|
478
|
-
return Node.create();
|
|
479
|
-
}
|
|
480
|
-
static createWithConfig(config) {
|
|
481
|
-
return Node.create(config);
|
|
482
|
-
}
|
|
483
|
-
static destroy(node) {
|
|
484
|
-
node.free();
|
|
485
|
-
}
|
|
486
|
-
free() {
|
|
487
|
-
if (this._freed)
|
|
488
|
-
return;
|
|
489
|
-
this.unsetMeasureFunc();
|
|
490
|
-
this.unsetBaselineFunc();
|
|
491
|
-
this.unsetDirtiedFunc();
|
|
492
|
-
yg.ygNodeFree(this.ptr);
|
|
493
|
-
this._freed = true;
|
|
494
|
-
}
|
|
495
|
-
freeRecursive() {
|
|
496
|
-
if (this._freed)
|
|
497
|
-
return;
|
|
498
|
-
this.cleanupCallbacks();
|
|
499
|
-
yg.ygNodeFreeRecursive(this.ptr);
|
|
500
|
-
this._freed = true;
|
|
501
|
-
}
|
|
502
|
-
reset() {
|
|
503
|
-
this.assertNotFreed();
|
|
504
|
-
this.cleanupCallbacks();
|
|
505
|
-
yg.ygNodeReset(this.ptr);
|
|
506
|
-
}
|
|
507
|
-
cleanupCallbacks() {
|
|
508
|
-
if (this.measureCallback) {
|
|
509
|
-
this.measureCallback.close();
|
|
510
|
-
this.measureCallback = null;
|
|
511
|
-
}
|
|
512
|
-
if (this.baselineCallback) {
|
|
513
|
-
this.baselineCallback.close();
|
|
514
|
-
this.baselineCallback = null;
|
|
515
|
-
}
|
|
516
|
-
if (this.dirtiedCallback) {
|
|
517
|
-
this.dirtiedCallback.close();
|
|
518
|
-
this.dirtiedCallback = null;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
clone() {
|
|
522
|
-
this.assertNotFreed();
|
|
523
|
-
const ptr = yg.ygNodeClone(this.ptr);
|
|
524
|
-
if (!ptr)
|
|
525
|
-
throw new Error("Failed to clone node");
|
|
526
|
-
return new Node(ptr);
|
|
527
|
-
}
|
|
528
|
-
copyStyle(node) {
|
|
529
|
-
this.assertNotFreed();
|
|
530
|
-
yg.ygNodeCopyStyle(this.ptr, node.ptr);
|
|
531
|
-
}
|
|
532
|
-
setIsReferenceBaseline(isReferenceBaseline) {
|
|
533
|
-
this.assertNotFreed();
|
|
534
|
-
yg.ygNodeSetIsReferenceBaseline(this.ptr, isReferenceBaseline);
|
|
535
|
-
}
|
|
536
|
-
isReferenceBaseline() {
|
|
537
|
-
this.assertNotFreed();
|
|
538
|
-
return yg.ygNodeIsReferenceBaseline(this.ptr);
|
|
539
|
-
}
|
|
540
|
-
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock) {
|
|
541
|
-
this.assertNotFreed();
|
|
542
|
-
yg.ygNodeSetAlwaysFormsContainingBlock(this.ptr, alwaysFormsContainingBlock);
|
|
543
|
-
}
|
|
544
|
-
insertChild(child, index) {
|
|
545
|
-
this.assertNotFreed();
|
|
546
|
-
yg.ygNodeInsertChild(this.ptr, child.ptr, index);
|
|
547
|
-
}
|
|
548
|
-
removeChild(child) {
|
|
549
|
-
this.assertNotFreed();
|
|
550
|
-
yg.ygNodeRemoveChild(this.ptr, child.ptr);
|
|
551
|
-
}
|
|
552
|
-
removeAllChildren() {
|
|
553
|
-
this.assertNotFreed();
|
|
554
|
-
yg.ygNodeRemoveAllChildren(this.ptr);
|
|
555
|
-
}
|
|
556
|
-
getChild(index) {
|
|
557
|
-
this.assertNotFreed();
|
|
558
|
-
const ptr = yg.ygNodeGetChild(this.ptr, index);
|
|
559
|
-
return ptr ? new Node(ptr) : null;
|
|
560
|
-
}
|
|
561
|
-
getChildCount() {
|
|
562
|
-
this.assertNotFreed();
|
|
563
|
-
return Number(yg.ygNodeGetChildCount(this.ptr));
|
|
564
|
-
}
|
|
565
|
-
getParent() {
|
|
566
|
-
this.assertNotFreed();
|
|
567
|
-
const ptr = yg.ygNodeGetParent(this.ptr);
|
|
568
|
-
return ptr ? new Node(ptr) : null;
|
|
569
|
-
}
|
|
570
|
-
calculateLayout(width, height, direction = exports.Direction.LTR) {
|
|
571
|
-
this.assertNotFreed();
|
|
572
|
-
const w = width === "auto" || width === undefined ? NaN : width;
|
|
573
|
-
const h = height === "auto" || height === undefined ? NaN : height;
|
|
574
|
-
yg.ygNodeCalculateLayout(this.ptr, w, h, direction);
|
|
575
|
-
}
|
|
576
|
-
hasNewLayout() {
|
|
577
|
-
this.assertNotFreed();
|
|
578
|
-
return yg.ygNodeGetHasNewLayout(this.ptr);
|
|
579
|
-
}
|
|
580
|
-
markLayoutSeen() {
|
|
581
|
-
this.assertNotFreed();
|
|
582
|
-
yg.ygNodeSetHasNewLayout(this.ptr, false);
|
|
583
|
-
}
|
|
584
|
-
markDirty() {
|
|
585
|
-
this.assertNotFreed();
|
|
586
|
-
yg.ygNodeMarkDirty(this.ptr);
|
|
587
|
-
}
|
|
588
|
-
isDirty() {
|
|
589
|
-
this.assertNotFreed();
|
|
590
|
-
return yg.ygNodeIsDirty(this.ptr);
|
|
591
|
-
}
|
|
592
|
-
getComputedLayout() {
|
|
593
|
-
this.assertNotFreed();
|
|
594
|
-
return {
|
|
595
|
-
left: yg.ygNodeLayoutGetLeft(this.ptr),
|
|
596
|
-
top: yg.ygNodeLayoutGetTop(this.ptr),
|
|
597
|
-
right: yg.ygNodeLayoutGetRight(this.ptr),
|
|
598
|
-
bottom: yg.ygNodeLayoutGetBottom(this.ptr),
|
|
599
|
-
width: yg.ygNodeLayoutGetWidth(this.ptr),
|
|
600
|
-
height: yg.ygNodeLayoutGetHeight(this.ptr)
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
getComputedLeft() {
|
|
604
|
-
this.assertNotFreed();
|
|
605
|
-
return yg.ygNodeLayoutGetLeft(this.ptr);
|
|
606
|
-
}
|
|
607
|
-
getComputedTop() {
|
|
608
|
-
this.assertNotFreed();
|
|
609
|
-
return yg.ygNodeLayoutGetTop(this.ptr);
|
|
610
|
-
}
|
|
611
|
-
getComputedRight() {
|
|
612
|
-
this.assertNotFreed();
|
|
613
|
-
return yg.ygNodeLayoutGetRight(this.ptr);
|
|
614
|
-
}
|
|
615
|
-
getComputedBottom() {
|
|
616
|
-
this.assertNotFreed();
|
|
617
|
-
return yg.ygNodeLayoutGetBottom(this.ptr);
|
|
618
|
-
}
|
|
619
|
-
getComputedWidth() {
|
|
620
|
-
this.assertNotFreed();
|
|
621
|
-
return yg.ygNodeLayoutGetWidth(this.ptr);
|
|
622
|
-
}
|
|
623
|
-
getComputedHeight() {
|
|
624
|
-
this.assertNotFreed();
|
|
625
|
-
return yg.ygNodeLayoutGetHeight(this.ptr);
|
|
626
|
-
}
|
|
627
|
-
getComputedBorder(edge) {
|
|
628
|
-
this.assertNotFreed();
|
|
629
|
-
return yg.ygNodeLayoutGetBorder(this.ptr, edge);
|
|
630
|
-
}
|
|
631
|
-
getComputedMargin(edge) {
|
|
632
|
-
this.assertNotFreed();
|
|
633
|
-
return yg.ygNodeLayoutGetMargin(this.ptr, edge);
|
|
634
|
-
}
|
|
635
|
-
getComputedPadding(edge) {
|
|
636
|
-
this.assertNotFreed();
|
|
637
|
-
return yg.ygNodeLayoutGetPadding(this.ptr, edge);
|
|
638
|
-
}
|
|
639
|
-
setDirection(direction) {
|
|
640
|
-
this.assertNotFreed();
|
|
641
|
-
yg.ygNodeStyleSetDirection(this.ptr, direction);
|
|
642
|
-
}
|
|
643
|
-
getDirection() {
|
|
644
|
-
this.assertNotFreed();
|
|
645
|
-
return yg.ygNodeStyleGetDirection(this.ptr);
|
|
646
|
-
}
|
|
647
|
-
setFlexDirection(flexDirection) {
|
|
648
|
-
this.assertNotFreed();
|
|
649
|
-
yg.ygNodeStyleSetFlexDirection(this.ptr, flexDirection);
|
|
650
|
-
}
|
|
651
|
-
getFlexDirection() {
|
|
652
|
-
this.assertNotFreed();
|
|
653
|
-
return yg.ygNodeStyleGetFlexDirection(this.ptr);
|
|
654
|
-
}
|
|
655
|
-
setJustifyContent(justifyContent) {
|
|
656
|
-
this.assertNotFreed();
|
|
657
|
-
yg.ygNodeStyleSetJustifyContent(this.ptr, justifyContent);
|
|
658
|
-
}
|
|
659
|
-
getJustifyContent() {
|
|
660
|
-
this.assertNotFreed();
|
|
661
|
-
return yg.ygNodeStyleGetJustifyContent(this.ptr);
|
|
662
|
-
}
|
|
663
|
-
setAlignContent(alignContent) {
|
|
664
|
-
this.assertNotFreed();
|
|
665
|
-
yg.ygNodeStyleSetAlignContent(this.ptr, alignContent);
|
|
666
|
-
}
|
|
667
|
-
getAlignContent() {
|
|
668
|
-
this.assertNotFreed();
|
|
669
|
-
return yg.ygNodeStyleGetAlignContent(this.ptr);
|
|
670
|
-
}
|
|
671
|
-
setAlignItems(alignItems) {
|
|
672
|
-
this.assertNotFreed();
|
|
673
|
-
yg.ygNodeStyleSetAlignItems(this.ptr, alignItems);
|
|
674
|
-
}
|
|
675
|
-
getAlignItems() {
|
|
676
|
-
this.assertNotFreed();
|
|
677
|
-
return yg.ygNodeStyleGetAlignItems(this.ptr);
|
|
678
|
-
}
|
|
679
|
-
setAlignSelf(alignSelf) {
|
|
680
|
-
this.assertNotFreed();
|
|
681
|
-
yg.ygNodeStyleSetAlignSelf(this.ptr, alignSelf);
|
|
682
|
-
}
|
|
683
|
-
getAlignSelf() {
|
|
684
|
-
this.assertNotFreed();
|
|
685
|
-
return yg.ygNodeStyleGetAlignSelf(this.ptr);
|
|
686
|
-
}
|
|
687
|
-
setPositionType(positionType) {
|
|
688
|
-
this.assertNotFreed();
|
|
689
|
-
yg.ygNodeStyleSetPositionType(this.ptr, positionType);
|
|
690
|
-
}
|
|
691
|
-
getPositionType() {
|
|
692
|
-
this.assertNotFreed();
|
|
693
|
-
return yg.ygNodeStyleGetPositionType(this.ptr);
|
|
694
|
-
}
|
|
695
|
-
setFlexWrap(flexWrap) {
|
|
696
|
-
this.assertNotFreed();
|
|
697
|
-
yg.ygNodeStyleSetFlexWrap(this.ptr, flexWrap);
|
|
698
|
-
}
|
|
699
|
-
getFlexWrap() {
|
|
700
|
-
this.assertNotFreed();
|
|
701
|
-
return yg.ygNodeStyleGetFlexWrap(this.ptr);
|
|
702
|
-
}
|
|
703
|
-
setOverflow(overflow) {
|
|
704
|
-
this.assertNotFreed();
|
|
705
|
-
yg.ygNodeStyleSetOverflow(this.ptr, overflow);
|
|
706
|
-
}
|
|
707
|
-
getOverflow() {
|
|
708
|
-
this.assertNotFreed();
|
|
709
|
-
return yg.ygNodeStyleGetOverflow(this.ptr);
|
|
710
|
-
}
|
|
711
|
-
setDisplay(display) {
|
|
712
|
-
this.assertNotFreed();
|
|
713
|
-
yg.ygNodeStyleSetDisplay(this.ptr, display);
|
|
714
|
-
}
|
|
715
|
-
getDisplay() {
|
|
716
|
-
this.assertNotFreed();
|
|
717
|
-
return yg.ygNodeStyleGetDisplay(this.ptr);
|
|
718
|
-
}
|
|
719
|
-
setBoxSizing(boxSizing) {
|
|
720
|
-
this.assertNotFreed();
|
|
721
|
-
yg.ygNodeStyleSetBoxSizing(this.ptr, boxSizing);
|
|
722
|
-
}
|
|
723
|
-
getBoxSizing() {
|
|
724
|
-
this.assertNotFreed();
|
|
725
|
-
return yg.ygNodeStyleGetBoxSizing(this.ptr);
|
|
726
|
-
}
|
|
727
|
-
setFlex(flex) {
|
|
728
|
-
this.assertNotFreed();
|
|
729
|
-
yg.ygNodeStyleSetFlex(this.ptr, flex);
|
|
730
|
-
}
|
|
731
|
-
getFlex() {
|
|
732
|
-
this.assertNotFreed();
|
|
733
|
-
return yg.ygNodeStyleGetFlex(this.ptr);
|
|
734
|
-
}
|
|
735
|
-
setFlexGrow(flexGrow) {
|
|
736
|
-
this.assertNotFreed();
|
|
737
|
-
yg.ygNodeStyleSetFlexGrow(this.ptr, flexGrow);
|
|
738
|
-
}
|
|
739
|
-
getFlexGrow() {
|
|
740
|
-
this.assertNotFreed();
|
|
741
|
-
return yg.ygNodeStyleGetFlexGrow(this.ptr);
|
|
742
|
-
}
|
|
743
|
-
setFlexShrink(flexShrink) {
|
|
744
|
-
this.assertNotFreed();
|
|
745
|
-
yg.ygNodeStyleSetFlexShrink(this.ptr, flexShrink);
|
|
746
|
-
}
|
|
747
|
-
getFlexShrink() {
|
|
748
|
-
this.assertNotFreed();
|
|
749
|
-
return yg.ygNodeStyleGetFlexShrink(this.ptr);
|
|
750
|
-
}
|
|
751
|
-
setFlexBasis(flexBasis) {
|
|
752
|
-
this.assertNotFreed();
|
|
753
|
-
const { unit, asNumber } = parseValue(flexBasis);
|
|
754
|
-
if (unit === exports.Unit.Auto) {
|
|
755
|
-
yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
|
|
756
|
-
} else if (unit === exports.Unit.Percent) {
|
|
757
|
-
yg.ygNodeStyleSetFlexBasisPercent(this.ptr, asNumber);
|
|
758
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
759
|
-
yg.ygNodeStyleSetFlexBasis(this.ptr, asNumber);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
setFlexBasisPercent(flexBasis) {
|
|
763
|
-
this.assertNotFreed();
|
|
764
|
-
if (flexBasis !== undefined) {
|
|
765
|
-
yg.ygNodeStyleSetFlexBasisPercent(this.ptr, flexBasis);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
setFlexBasisAuto() {
|
|
769
|
-
this.assertNotFreed();
|
|
770
|
-
yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
|
|
771
|
-
}
|
|
772
|
-
setPosition(edge, position) {
|
|
773
|
-
this.assertNotFreed();
|
|
774
|
-
const { unit, asNumber } = parseValue(position);
|
|
775
|
-
if (unit === exports.Unit.Percent) {
|
|
776
|
-
yg.ygNodeStyleSetPositionPercent(this.ptr, edge, asNumber);
|
|
777
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
778
|
-
yg.ygNodeStyleSetPosition(this.ptr, edge, asNumber);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
setPositionPercent(edge, position) {
|
|
782
|
-
this.assertNotFreed();
|
|
783
|
-
if (position !== undefined) {
|
|
784
|
-
yg.ygNodeStyleSetPositionPercent(this.ptr, edge, position);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
setPositionAuto(edge) {
|
|
788
|
-
this.assertNotFreed();
|
|
789
|
-
yg.ygNodeStyleSetPositionAuto(this.ptr, edge);
|
|
790
|
-
}
|
|
791
|
-
setMargin(edge, margin) {
|
|
792
|
-
this.assertNotFreed();
|
|
793
|
-
const { unit, asNumber } = parseValue(margin);
|
|
794
|
-
if (unit === exports.Unit.Auto) {
|
|
795
|
-
yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
|
|
796
|
-
} else if (unit === exports.Unit.Percent) {
|
|
797
|
-
yg.ygNodeStyleSetMarginPercent(this.ptr, edge, asNumber);
|
|
798
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
799
|
-
yg.ygNodeStyleSetMargin(this.ptr, edge, asNumber);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
setMarginPercent(edge, margin) {
|
|
803
|
-
this.assertNotFreed();
|
|
804
|
-
if (margin !== undefined) {
|
|
805
|
-
yg.ygNodeStyleSetMarginPercent(this.ptr, edge, margin);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
setMarginAuto(edge) {
|
|
809
|
-
this.assertNotFreed();
|
|
810
|
-
yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
|
|
811
|
-
}
|
|
812
|
-
setPadding(edge, padding) {
|
|
813
|
-
this.assertNotFreed();
|
|
814
|
-
const { unit, asNumber } = parseValue(padding);
|
|
815
|
-
if (unit === exports.Unit.Percent) {
|
|
816
|
-
yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, asNumber);
|
|
817
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
818
|
-
yg.ygNodeStyleSetPadding(this.ptr, edge, asNumber);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
setPaddingPercent(edge, padding) {
|
|
822
|
-
this.assertNotFreed();
|
|
823
|
-
if (padding !== undefined) {
|
|
824
|
-
yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, padding);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
setBorder(edge, border) {
|
|
828
|
-
this.assertNotFreed();
|
|
829
|
-
if (border !== undefined) {
|
|
830
|
-
yg.ygNodeStyleSetBorder(this.ptr, edge, border);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
getBorder(edge) {
|
|
834
|
-
this.assertNotFreed();
|
|
835
|
-
return yg.ygNodeStyleGetBorder(this.ptr, edge);
|
|
836
|
-
}
|
|
837
|
-
setGap(gutter, gap) {
|
|
838
|
-
this.assertNotFreed();
|
|
839
|
-
const { unit, asNumber } = parseValue(gap);
|
|
840
|
-
if (unit === exports.Unit.Percent) {
|
|
841
|
-
yg.ygNodeStyleSetGapPercent(this.ptr, gutter, asNumber);
|
|
842
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
843
|
-
yg.ygNodeStyleSetGap(this.ptr, gutter, asNumber);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
setGapPercent(gutter, gap) {
|
|
847
|
-
this.assertNotFreed();
|
|
848
|
-
if (gap !== undefined) {
|
|
849
|
-
yg.ygNodeStyleSetGapPercent(this.ptr, gutter, gap);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
setWidth(width) {
|
|
853
|
-
this.assertNotFreed();
|
|
854
|
-
const { unit, asNumber } = parseValue(width);
|
|
855
|
-
if (unit === exports.Unit.Auto) {
|
|
856
|
-
yg.ygNodeStyleSetWidthAuto(this.ptr);
|
|
857
|
-
} else if (unit === exports.Unit.Percent) {
|
|
858
|
-
yg.ygNodeStyleSetWidthPercent(this.ptr, asNumber);
|
|
859
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
860
|
-
yg.ygNodeStyleSetWidth(this.ptr, asNumber);
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
setWidthPercent(width) {
|
|
864
|
-
this.assertNotFreed();
|
|
865
|
-
if (width !== undefined) {
|
|
866
|
-
yg.ygNodeStyleSetWidthPercent(this.ptr, width);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
setWidthAuto() {
|
|
870
|
-
this.assertNotFreed();
|
|
871
|
-
yg.ygNodeStyleSetWidthAuto(this.ptr);
|
|
872
|
-
}
|
|
873
|
-
setHeight(height) {
|
|
874
|
-
this.assertNotFreed();
|
|
875
|
-
const { unit, asNumber } = parseValue(height);
|
|
876
|
-
if (unit === exports.Unit.Auto) {
|
|
877
|
-
yg.ygNodeStyleSetHeightAuto(this.ptr);
|
|
878
|
-
} else if (unit === exports.Unit.Percent) {
|
|
879
|
-
yg.ygNodeStyleSetHeightPercent(this.ptr, asNumber);
|
|
880
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
881
|
-
yg.ygNodeStyleSetHeight(this.ptr, asNumber);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
setHeightPercent(height) {
|
|
885
|
-
this.assertNotFreed();
|
|
886
|
-
if (height !== undefined) {
|
|
887
|
-
yg.ygNodeStyleSetHeightPercent(this.ptr, height);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
setHeightAuto() {
|
|
891
|
-
this.assertNotFreed();
|
|
892
|
-
yg.ygNodeStyleSetHeightAuto(this.ptr);
|
|
893
|
-
}
|
|
894
|
-
setMinWidth(minWidth) {
|
|
895
|
-
this.assertNotFreed();
|
|
896
|
-
const { unit, asNumber } = parseValue(minWidth);
|
|
897
|
-
if (unit === exports.Unit.Percent) {
|
|
898
|
-
yg.ygNodeStyleSetMinWidthPercent(this.ptr, asNumber);
|
|
899
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
900
|
-
yg.ygNodeStyleSetMinWidth(this.ptr, asNumber);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
setMinWidthPercent(minWidth) {
|
|
904
|
-
this.assertNotFreed();
|
|
905
|
-
if (minWidth !== undefined) {
|
|
906
|
-
yg.ygNodeStyleSetMinWidthPercent(this.ptr, minWidth);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
setMinHeight(minHeight) {
|
|
910
|
-
this.assertNotFreed();
|
|
911
|
-
const { unit, asNumber } = parseValue(minHeight);
|
|
912
|
-
if (unit === exports.Unit.Percent) {
|
|
913
|
-
yg.ygNodeStyleSetMinHeightPercent(this.ptr, asNumber);
|
|
914
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
915
|
-
yg.ygNodeStyleSetMinHeight(this.ptr, asNumber);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
setMinHeightPercent(minHeight) {
|
|
919
|
-
this.assertNotFreed();
|
|
920
|
-
if (minHeight !== undefined) {
|
|
921
|
-
yg.ygNodeStyleSetMinHeightPercent(this.ptr, minHeight);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
setMaxWidth(maxWidth) {
|
|
925
|
-
this.assertNotFreed();
|
|
926
|
-
const { unit, asNumber } = parseValue(maxWidth);
|
|
927
|
-
if (unit === exports.Unit.Percent) {
|
|
928
|
-
yg.ygNodeStyleSetMaxWidthPercent(this.ptr, asNumber);
|
|
929
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
930
|
-
yg.ygNodeStyleSetMaxWidth(this.ptr, asNumber);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
setMaxWidthPercent(maxWidth) {
|
|
934
|
-
this.assertNotFreed();
|
|
935
|
-
if (maxWidth !== undefined) {
|
|
936
|
-
yg.ygNodeStyleSetMaxWidthPercent(this.ptr, maxWidth);
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
setMaxHeight(maxHeight) {
|
|
940
|
-
this.assertNotFreed();
|
|
941
|
-
const { unit, asNumber } = parseValue(maxHeight);
|
|
942
|
-
if (unit === exports.Unit.Percent) {
|
|
943
|
-
yg.ygNodeStyleSetMaxHeightPercent(this.ptr, asNumber);
|
|
944
|
-
} else if (unit === exports.Unit.Point && asNumber !== undefined) {
|
|
945
|
-
yg.ygNodeStyleSetMaxHeight(this.ptr, asNumber);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
setMaxHeightPercent(maxHeight) {
|
|
949
|
-
this.assertNotFreed();
|
|
950
|
-
if (maxHeight !== undefined) {
|
|
951
|
-
yg.ygNodeStyleSetMaxHeightPercent(this.ptr, maxHeight);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
setAspectRatio(aspectRatio) {
|
|
955
|
-
this.assertNotFreed();
|
|
956
|
-
if (aspectRatio !== undefined) {
|
|
957
|
-
yg.ygNodeStyleSetAspectRatio(this.ptr, aspectRatio);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
getAspectRatio() {
|
|
961
|
-
this.assertNotFreed();
|
|
962
|
-
return yg.ygNodeStyleGetAspectRatio(this.ptr);
|
|
963
|
-
}
|
|
964
|
-
getWidth() {
|
|
965
|
-
this.assertNotFreed();
|
|
966
|
-
return unpackValue(yg.ygNodeStyleGetWidthPacked(this.ptr));
|
|
967
|
-
}
|
|
968
|
-
getHeight() {
|
|
969
|
-
this.assertNotFreed();
|
|
970
|
-
return unpackValue(yg.ygNodeStyleGetHeightPacked(this.ptr));
|
|
971
|
-
}
|
|
972
|
-
getMinWidth() {
|
|
973
|
-
this.assertNotFreed();
|
|
974
|
-
return unpackValue(yg.ygNodeStyleGetMinWidthPacked(this.ptr));
|
|
975
|
-
}
|
|
976
|
-
getMinHeight() {
|
|
977
|
-
this.assertNotFreed();
|
|
978
|
-
return unpackValue(yg.ygNodeStyleGetMinHeightPacked(this.ptr));
|
|
979
|
-
}
|
|
980
|
-
getMaxWidth() {
|
|
981
|
-
this.assertNotFreed();
|
|
982
|
-
return unpackValue(yg.ygNodeStyleGetMaxWidthPacked(this.ptr));
|
|
983
|
-
}
|
|
984
|
-
getMaxHeight() {
|
|
985
|
-
this.assertNotFreed();
|
|
986
|
-
return unpackValue(yg.ygNodeStyleGetMaxHeightPacked(this.ptr));
|
|
987
|
-
}
|
|
988
|
-
getMargin(edge) {
|
|
989
|
-
this.assertNotFreed();
|
|
990
|
-
return unpackValue(yg.ygNodeStyleGetMarginPacked(this.ptr, edge));
|
|
991
|
-
}
|
|
992
|
-
getPadding(edge) {
|
|
993
|
-
this.assertNotFreed();
|
|
994
|
-
return unpackValue(yg.ygNodeStyleGetPaddingPacked(this.ptr, edge));
|
|
995
|
-
}
|
|
996
|
-
getPosition(edge) {
|
|
997
|
-
this.assertNotFreed();
|
|
998
|
-
return unpackValue(yg.ygNodeStyleGetPositionPacked(this.ptr, edge));
|
|
999
|
-
}
|
|
1000
|
-
getGap(gutter) {
|
|
1001
|
-
this.assertNotFreed();
|
|
1002
|
-
return unpackValue(yg.ygNodeStyleGetGapPacked(this.ptr, gutter));
|
|
1003
|
-
}
|
|
1004
|
-
getFlexBasis() {
|
|
1005
|
-
this.assertNotFreed();
|
|
1006
|
-
return unpackValue(yg.ygNodeStyleGetFlexBasisPacked(this.ptr));
|
|
1007
|
-
}
|
|
1008
|
-
setMeasureFunc(measureFunc) {
|
|
1009
|
-
this.assertNotFreed();
|
|
1010
|
-
this.unsetMeasureFunc();
|
|
1011
|
-
if (measureFunc) {
|
|
1012
|
-
this.measureCallback = new bun_ffi_1.JSCallback((nodePtr, width, widthMode, height, heightMode) => {
|
|
1013
|
-
const result = measureFunc(width, widthMode, height, heightMode);
|
|
1014
|
-
yg.ygStoreMeasureResult(result.width, result.height);
|
|
1015
|
-
}, {
|
|
1016
|
-
args: [
|
|
1017
|
-
bun_ffi_1.FFIType.ptr,
|
|
1018
|
-
bun_ffi_1.FFIType.f32,
|
|
1019
|
-
bun_ffi_1.FFIType.u32,
|
|
1020
|
-
bun_ffi_1.FFIType.f32,
|
|
1021
|
-
bun_ffi_1.FFIType.u32
|
|
1022
|
-
],
|
|
1023
|
-
returns: bun_ffi_1.FFIType.void
|
|
1024
|
-
});
|
|
1025
|
-
if (this.measureCallback.ptr) {
|
|
1026
|
-
yg.ygNodeSetMeasureFuncTrampoline(this.ptr, this.measureCallback.ptr);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
unsetMeasureFunc() {
|
|
1031
|
-
if (this._freed)
|
|
1032
|
-
return;
|
|
1033
|
-
if (this.measureCallback) {
|
|
1034
|
-
this.measureCallback.close();
|
|
1035
|
-
this.measureCallback = null;
|
|
1036
|
-
}
|
|
1037
|
-
yg.ygNodeUnsetMeasureFuncTrampoline(this.ptr);
|
|
1038
|
-
}
|
|
1039
|
-
hasMeasureFunc() {
|
|
1040
|
-
this.assertNotFreed();
|
|
1041
|
-
return yg.ygNodeHasMeasureFunc(this.ptr);
|
|
1042
|
-
}
|
|
1043
|
-
setBaselineFunc(baselineFunc) {
|
|
1044
|
-
this.assertNotFreed();
|
|
1045
|
-
this.unsetBaselineFunc();
|
|
1046
|
-
if (baselineFunc) {
|
|
1047
|
-
this.baselineCallback = new bun_ffi_1.JSCallback((nodePtr, width, height) => {
|
|
1048
|
-
const result = baselineFunc(width, height);
|
|
1049
|
-
yg.ygStoreBaselineResult(result);
|
|
1050
|
-
}, {
|
|
1051
|
-
args: [bun_ffi_1.FFIType.ptr, bun_ffi_1.FFIType.f32, bun_ffi_1.FFIType.f32],
|
|
1052
|
-
returns: bun_ffi_1.FFIType.void
|
|
1053
|
-
});
|
|
1054
|
-
if (this.baselineCallback.ptr) {
|
|
1055
|
-
yg.ygNodeSetBaselineFuncTrampoline(this.ptr, this.baselineCallback.ptr);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
unsetBaselineFunc() {
|
|
1060
|
-
if (this._freed)
|
|
1061
|
-
return;
|
|
1062
|
-
if (this.baselineCallback) {
|
|
1063
|
-
this.baselineCallback.close();
|
|
1064
|
-
this.baselineCallback = null;
|
|
1065
|
-
}
|
|
1066
|
-
yg.ygNodeUnsetBaselineFuncTrampoline(this.ptr);
|
|
1067
|
-
}
|
|
1068
|
-
hasBaselineFunc() {
|
|
1069
|
-
this.assertNotFreed();
|
|
1070
|
-
return yg.ygNodeHasBaselineFunc(this.ptr);
|
|
1071
|
-
}
|
|
1072
|
-
setDirtiedFunc(dirtiedFunc) {
|
|
1073
|
-
this.assertNotFreed();
|
|
1074
|
-
this.unsetDirtiedFunc();
|
|
1075
|
-
if (dirtiedFunc) {
|
|
1076
|
-
const node = this;
|
|
1077
|
-
this.dirtiedCallback = new bun_ffi_1.JSCallback((nodePtr) => {
|
|
1078
|
-
dirtiedFunc(node);
|
|
1079
|
-
}, {
|
|
1080
|
-
args: [bun_ffi_1.FFIType.ptr],
|
|
1081
|
-
returns: bun_ffi_1.FFIType.void
|
|
1082
|
-
});
|
|
1083
|
-
if (this.dirtiedCallback.ptr) {
|
|
1084
|
-
yg.ygNodeSetDirtiedFunc(this.ptr, this.dirtiedCallback.ptr);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
unsetDirtiedFunc() {
|
|
1089
|
-
if (this._freed)
|
|
1090
|
-
return;
|
|
1091
|
-
if (this.dirtiedCallback) {
|
|
1092
|
-
this.dirtiedCallback.close();
|
|
1093
|
-
this.dirtiedCallback = null;
|
|
1094
|
-
}
|
|
1095
|
-
yg.ygNodeUnsetDirtiedFunc(this.ptr);
|
|
1096
|
-
}
|
|
1097
|
-
hasDirtiedFunc() {
|
|
1098
|
-
this.assertNotFreed();
|
|
1099
|
-
return yg.ygNodeGetDirtiedFunc(this.ptr) !== null;
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
exports.Node = Node;
|
|
1103
|
-
|
|
1104
|
-
class Config {
|
|
1105
|
-
ptr;
|
|
1106
|
-
constructor(ptr) {
|
|
1107
|
-
this.ptr = ptr;
|
|
1108
|
-
}
|
|
1109
|
-
static create() {
|
|
1110
|
-
const ptr = yg.ygConfigNew();
|
|
1111
|
-
if (!ptr)
|
|
1112
|
-
throw new Error("Failed to create config");
|
|
1113
|
-
return new Config(ptr);
|
|
1114
|
-
}
|
|
1115
|
-
static destroy(config) {
|
|
1116
|
-
config.free();
|
|
1117
|
-
}
|
|
1118
|
-
free() {
|
|
1119
|
-
yg.ygConfigFree(this.ptr);
|
|
1120
|
-
}
|
|
1121
|
-
setUseWebDefaults(useWebDefaults) {
|
|
1122
|
-
yg.ygConfigSetUseWebDefaults(this.ptr, useWebDefaults);
|
|
1123
|
-
}
|
|
1124
|
-
useWebDefaults() {
|
|
1125
|
-
return yg.ygConfigGetUseWebDefaults(this.ptr);
|
|
1126
|
-
}
|
|
1127
|
-
setPointScaleFactor(pointScaleFactor) {
|
|
1128
|
-
yg.ygConfigSetPointScaleFactor(this.ptr, pointScaleFactor);
|
|
1129
|
-
}
|
|
1130
|
-
getPointScaleFactor() {
|
|
1131
|
-
return yg.ygConfigGetPointScaleFactor(this.ptr);
|
|
1132
|
-
}
|
|
1133
|
-
setErrata(errata) {
|
|
1134
|
-
yg.ygConfigSetErrata(this.ptr, errata);
|
|
1135
|
-
}
|
|
1136
|
-
getErrata() {
|
|
1137
|
-
return yg.ygConfigGetErrata(this.ptr);
|
|
1138
|
-
}
|
|
1139
|
-
setExperimentalFeatureEnabled(feature, enabled) {
|
|
1140
|
-
yg.ygConfigSetExperimentalFeatureEnabled(this.ptr, feature, enabled);
|
|
1141
|
-
}
|
|
1142
|
-
isExperimentalFeatureEnabled(feature) {
|
|
1143
|
-
return yg.ygConfigIsExperimentalFeatureEnabled(this.ptr, feature);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
exports.Config = Config;
|
|
1147
|
-
exports.default = {
|
|
1148
|
-
Node,
|
|
1149
|
-
Config,
|
|
1150
|
-
Align: exports.Align,
|
|
1151
|
-
BoxSizing: exports.BoxSizing,
|
|
1152
|
-
Dimension: exports.Dimension,
|
|
1153
|
-
Direction: exports.Direction,
|
|
1154
|
-
Display: exports.Display,
|
|
1155
|
-
Edge: exports.Edge,
|
|
1156
|
-
Errata: exports.Errata,
|
|
1157
|
-
ExperimentalFeature: exports.ExperimentalFeature,
|
|
1158
|
-
FlexDirection: exports.FlexDirection,
|
|
1159
|
-
Gutter: exports.Gutter,
|
|
1160
|
-
Justify: exports.Justify,
|
|
1161
|
-
LogLevel: exports.LogLevel,
|
|
1162
|
-
MeasureMode: exports.MeasureMode,
|
|
1163
|
-
NodeType: exports.NodeType,
|
|
1164
|
-
Overflow: exports.Overflow,
|
|
1165
|
-
PositionType: exports.PositionType,
|
|
1166
|
-
Unit: exports.Unit,
|
|
1167
|
-
Wrap: exports.Wrap,
|
|
1168
|
-
EDGE_LEFT: exports.EDGE_LEFT,
|
|
1169
|
-
EDGE_TOP: exports.EDGE_TOP,
|
|
1170
|
-
EDGE_RIGHT: exports.EDGE_RIGHT,
|
|
1171
|
-
EDGE_BOTTOM: exports.EDGE_BOTTOM,
|
|
1172
|
-
EDGE_START: exports.EDGE_START,
|
|
1173
|
-
EDGE_END: exports.EDGE_END,
|
|
1174
|
-
EDGE_HORIZONTAL: exports.EDGE_HORIZONTAL,
|
|
1175
|
-
EDGE_VERTICAL: exports.EDGE_VERTICAL,
|
|
1176
|
-
EDGE_ALL: exports.EDGE_ALL,
|
|
1177
|
-
FLEX_DIRECTION_COLUMN: exports.FLEX_DIRECTION_COLUMN,
|
|
1178
|
-
FLEX_DIRECTION_COLUMN_REVERSE: exports.FLEX_DIRECTION_COLUMN_REVERSE,
|
|
1179
|
-
FLEX_DIRECTION_ROW: exports.FLEX_DIRECTION_ROW,
|
|
1180
|
-
FLEX_DIRECTION_ROW_REVERSE: exports.FLEX_DIRECTION_ROW_REVERSE,
|
|
1181
|
-
JUSTIFY_FLEX_START: exports.JUSTIFY_FLEX_START,
|
|
1182
|
-
JUSTIFY_CENTER: exports.JUSTIFY_CENTER,
|
|
1183
|
-
JUSTIFY_FLEX_END: exports.JUSTIFY_FLEX_END,
|
|
1184
|
-
JUSTIFY_SPACE_BETWEEN: exports.JUSTIFY_SPACE_BETWEEN,
|
|
1185
|
-
JUSTIFY_SPACE_AROUND: exports.JUSTIFY_SPACE_AROUND,
|
|
1186
|
-
JUSTIFY_SPACE_EVENLY: exports.JUSTIFY_SPACE_EVENLY,
|
|
1187
|
-
ALIGN_AUTO: exports.ALIGN_AUTO,
|
|
1188
|
-
ALIGN_FLEX_START: exports.ALIGN_FLEX_START,
|
|
1189
|
-
ALIGN_CENTER: exports.ALIGN_CENTER,
|
|
1190
|
-
ALIGN_FLEX_END: exports.ALIGN_FLEX_END,
|
|
1191
|
-
ALIGN_STRETCH: exports.ALIGN_STRETCH,
|
|
1192
|
-
ALIGN_BASELINE: exports.ALIGN_BASELINE,
|
|
1193
|
-
ALIGN_SPACE_BETWEEN: exports.ALIGN_SPACE_BETWEEN,
|
|
1194
|
-
ALIGN_SPACE_AROUND: exports.ALIGN_SPACE_AROUND,
|
|
1195
|
-
ALIGN_SPACE_EVENLY: exports.ALIGN_SPACE_EVENLY,
|
|
1196
|
-
WRAP_NO_WRAP: exports.WRAP_NO_WRAP,
|
|
1197
|
-
WRAP_WRAP: exports.WRAP_WRAP,
|
|
1198
|
-
WRAP_WRAP_REVERSE: exports.WRAP_WRAP_REVERSE,
|
|
1199
|
-
OVERFLOW_VISIBLE: exports.OVERFLOW_VISIBLE,
|
|
1200
|
-
OVERFLOW_HIDDEN: exports.OVERFLOW_HIDDEN,
|
|
1201
|
-
OVERFLOW_SCROLL: exports.OVERFLOW_SCROLL,
|
|
1202
|
-
DISPLAY_FLEX: exports.DISPLAY_FLEX,
|
|
1203
|
-
DISPLAY_NONE: exports.DISPLAY_NONE,
|
|
1204
|
-
POSITION_TYPE_STATIC: exports.POSITION_TYPE_STATIC,
|
|
1205
|
-
POSITION_TYPE_RELATIVE: exports.POSITION_TYPE_RELATIVE,
|
|
1206
|
-
POSITION_TYPE_ABSOLUTE: exports.POSITION_TYPE_ABSOLUTE,
|
|
1207
|
-
DIRECTION_INHERIT: exports.DIRECTION_INHERIT,
|
|
1208
|
-
DIRECTION_LTR: exports.DIRECTION_LTR,
|
|
1209
|
-
DIRECTION_RTL: exports.DIRECTION_RTL
|
|
1210
|
-
};
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
2
|
// src/lib/border.ts
|
|
1214
3
|
var BorderChars = {
|
|
1215
4
|
single: {
|
|
@@ -5638,266 +4427,282 @@ class StdinBuffer extends EventEmitter2 {
|
|
|
5638
4427
|
}
|
|
5639
4428
|
|
|
5640
4429
|
// src/lib/yoga.options.ts
|
|
5641
|
-
|
|
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";
|
|
5642
4447
|
function parseAlign(value) {
|
|
5643
4448
|
if (value == null) {
|
|
5644
|
-
return
|
|
4449
|
+
return Align.Auto;
|
|
5645
4450
|
}
|
|
5646
4451
|
switch (value.toLowerCase()) {
|
|
5647
4452
|
case "auto":
|
|
5648
|
-
return
|
|
4453
|
+
return Align.Auto;
|
|
5649
4454
|
case "flex-start":
|
|
5650
|
-
return
|
|
4455
|
+
return Align.FlexStart;
|
|
5651
4456
|
case "center":
|
|
5652
|
-
return
|
|
4457
|
+
return Align.Center;
|
|
5653
4458
|
case "flex-end":
|
|
5654
|
-
return
|
|
4459
|
+
return Align.FlexEnd;
|
|
5655
4460
|
case "stretch":
|
|
5656
|
-
return
|
|
4461
|
+
return Align.Stretch;
|
|
5657
4462
|
case "baseline":
|
|
5658
|
-
return
|
|
4463
|
+
return Align.Baseline;
|
|
5659
4464
|
case "space-between":
|
|
5660
|
-
return
|
|
4465
|
+
return Align.SpaceBetween;
|
|
5661
4466
|
case "space-around":
|
|
5662
|
-
return
|
|
4467
|
+
return Align.SpaceAround;
|
|
5663
4468
|
case "space-evenly":
|
|
5664
|
-
return
|
|
4469
|
+
return Align.SpaceEvenly;
|
|
5665
4470
|
default:
|
|
5666
|
-
return
|
|
4471
|
+
return Align.Auto;
|
|
5667
4472
|
}
|
|
5668
4473
|
}
|
|
5669
4474
|
function parseBoxSizing(value) {
|
|
5670
4475
|
if (value == null) {
|
|
5671
|
-
return
|
|
4476
|
+
return BoxSizing.BorderBox;
|
|
5672
4477
|
}
|
|
5673
4478
|
switch (value.toLowerCase()) {
|
|
5674
4479
|
case "border-box":
|
|
5675
|
-
return
|
|
4480
|
+
return BoxSizing.BorderBox;
|
|
5676
4481
|
case "content-box":
|
|
5677
|
-
return
|
|
4482
|
+
return BoxSizing.ContentBox;
|
|
5678
4483
|
default:
|
|
5679
|
-
return
|
|
4484
|
+
return BoxSizing.BorderBox;
|
|
5680
4485
|
}
|
|
5681
4486
|
}
|
|
5682
4487
|
function parseDimension(value) {
|
|
5683
4488
|
if (value == null) {
|
|
5684
|
-
return
|
|
4489
|
+
return Dimension.Width;
|
|
5685
4490
|
}
|
|
5686
4491
|
switch (value.toLowerCase()) {
|
|
5687
4492
|
case "width":
|
|
5688
|
-
return
|
|
4493
|
+
return Dimension.Width;
|
|
5689
4494
|
case "height":
|
|
5690
|
-
return
|
|
4495
|
+
return Dimension.Height;
|
|
5691
4496
|
default:
|
|
5692
|
-
return
|
|
4497
|
+
return Dimension.Width;
|
|
5693
4498
|
}
|
|
5694
4499
|
}
|
|
5695
4500
|
function parseDirection(value) {
|
|
5696
4501
|
if (value == null) {
|
|
5697
|
-
return
|
|
4502
|
+
return Direction.LTR;
|
|
5698
4503
|
}
|
|
5699
4504
|
switch (value.toLowerCase()) {
|
|
5700
4505
|
case "inherit":
|
|
5701
|
-
return
|
|
4506
|
+
return Direction.Inherit;
|
|
5702
4507
|
case "ltr":
|
|
5703
|
-
return
|
|
4508
|
+
return Direction.LTR;
|
|
5704
4509
|
case "rtl":
|
|
5705
|
-
return
|
|
4510
|
+
return Direction.RTL;
|
|
5706
4511
|
default:
|
|
5707
|
-
return
|
|
4512
|
+
return Direction.LTR;
|
|
5708
4513
|
}
|
|
5709
4514
|
}
|
|
5710
4515
|
function parseDisplay(value) {
|
|
5711
4516
|
if (value == null) {
|
|
5712
|
-
return
|
|
4517
|
+
return Display.Flex;
|
|
5713
4518
|
}
|
|
5714
4519
|
switch (value.toLowerCase()) {
|
|
5715
4520
|
case "flex":
|
|
5716
|
-
return
|
|
4521
|
+
return Display.Flex;
|
|
5717
4522
|
case "none":
|
|
5718
|
-
return
|
|
4523
|
+
return Display.None;
|
|
5719
4524
|
case "contents":
|
|
5720
|
-
return
|
|
4525
|
+
return Display.Contents;
|
|
5721
4526
|
default:
|
|
5722
|
-
return
|
|
4527
|
+
return Display.Flex;
|
|
5723
4528
|
}
|
|
5724
4529
|
}
|
|
5725
4530
|
function parseEdge(value) {
|
|
5726
4531
|
if (value == null) {
|
|
5727
|
-
return
|
|
4532
|
+
return Edge.All;
|
|
5728
4533
|
}
|
|
5729
4534
|
switch (value.toLowerCase()) {
|
|
5730
4535
|
case "left":
|
|
5731
|
-
return
|
|
4536
|
+
return Edge.Left;
|
|
5732
4537
|
case "top":
|
|
5733
|
-
return
|
|
4538
|
+
return Edge.Top;
|
|
5734
4539
|
case "right":
|
|
5735
|
-
return
|
|
4540
|
+
return Edge.Right;
|
|
5736
4541
|
case "bottom":
|
|
5737
|
-
return
|
|
4542
|
+
return Edge.Bottom;
|
|
5738
4543
|
case "start":
|
|
5739
|
-
return
|
|
4544
|
+
return Edge.Start;
|
|
5740
4545
|
case "end":
|
|
5741
|
-
return
|
|
4546
|
+
return Edge.End;
|
|
5742
4547
|
case "horizontal":
|
|
5743
|
-
return
|
|
4548
|
+
return Edge.Horizontal;
|
|
5744
4549
|
case "vertical":
|
|
5745
|
-
return
|
|
4550
|
+
return Edge.Vertical;
|
|
5746
4551
|
case "all":
|
|
5747
|
-
return
|
|
4552
|
+
return Edge.All;
|
|
5748
4553
|
default:
|
|
5749
|
-
return
|
|
4554
|
+
return Edge.All;
|
|
5750
4555
|
}
|
|
5751
4556
|
}
|
|
5752
4557
|
function parseFlexDirection(value) {
|
|
5753
4558
|
if (value == null) {
|
|
5754
|
-
return
|
|
4559
|
+
return FlexDirection.Column;
|
|
5755
4560
|
}
|
|
5756
4561
|
switch (value.toLowerCase()) {
|
|
5757
4562
|
case "column":
|
|
5758
|
-
return
|
|
4563
|
+
return FlexDirection.Column;
|
|
5759
4564
|
case "column-reverse":
|
|
5760
|
-
return
|
|
4565
|
+
return FlexDirection.ColumnReverse;
|
|
5761
4566
|
case "row":
|
|
5762
|
-
return
|
|
4567
|
+
return FlexDirection.Row;
|
|
5763
4568
|
case "row-reverse":
|
|
5764
|
-
return
|
|
4569
|
+
return FlexDirection.RowReverse;
|
|
5765
4570
|
default:
|
|
5766
|
-
return
|
|
4571
|
+
return FlexDirection.Column;
|
|
5767
4572
|
}
|
|
5768
4573
|
}
|
|
5769
4574
|
function parseGutter(value) {
|
|
5770
4575
|
if (value == null) {
|
|
5771
|
-
return
|
|
4576
|
+
return Gutter.All;
|
|
5772
4577
|
}
|
|
5773
4578
|
switch (value.toLowerCase()) {
|
|
5774
4579
|
case "column":
|
|
5775
|
-
return
|
|
4580
|
+
return Gutter.Column;
|
|
5776
4581
|
case "row":
|
|
5777
|
-
return
|
|
4582
|
+
return Gutter.Row;
|
|
5778
4583
|
case "all":
|
|
5779
|
-
return
|
|
4584
|
+
return Gutter.All;
|
|
5780
4585
|
default:
|
|
5781
|
-
return
|
|
4586
|
+
return Gutter.All;
|
|
5782
4587
|
}
|
|
5783
4588
|
}
|
|
5784
4589
|
function parseJustify(value) {
|
|
5785
4590
|
if (value == null) {
|
|
5786
|
-
return
|
|
4591
|
+
return Justify.FlexStart;
|
|
5787
4592
|
}
|
|
5788
4593
|
switch (value.toLowerCase()) {
|
|
5789
4594
|
case "flex-start":
|
|
5790
|
-
return
|
|
4595
|
+
return Justify.FlexStart;
|
|
5791
4596
|
case "center":
|
|
5792
|
-
return
|
|
4597
|
+
return Justify.Center;
|
|
5793
4598
|
case "flex-end":
|
|
5794
|
-
return
|
|
4599
|
+
return Justify.FlexEnd;
|
|
5795
4600
|
case "space-between":
|
|
5796
|
-
return
|
|
4601
|
+
return Justify.SpaceBetween;
|
|
5797
4602
|
case "space-around":
|
|
5798
|
-
return
|
|
4603
|
+
return Justify.SpaceAround;
|
|
5799
4604
|
case "space-evenly":
|
|
5800
|
-
return
|
|
4605
|
+
return Justify.SpaceEvenly;
|
|
5801
4606
|
default:
|
|
5802
|
-
return
|
|
4607
|
+
return Justify.FlexStart;
|
|
5803
4608
|
}
|
|
5804
4609
|
}
|
|
5805
4610
|
function parseLogLevel(value) {
|
|
5806
4611
|
if (value == null) {
|
|
5807
|
-
return
|
|
4612
|
+
return LogLevel.Info;
|
|
5808
4613
|
}
|
|
5809
4614
|
switch (value.toLowerCase()) {
|
|
5810
4615
|
case "error":
|
|
5811
|
-
return
|
|
4616
|
+
return LogLevel.Error;
|
|
5812
4617
|
case "warn":
|
|
5813
|
-
return
|
|
4618
|
+
return LogLevel.Warn;
|
|
5814
4619
|
case "info":
|
|
5815
|
-
return
|
|
4620
|
+
return LogLevel.Info;
|
|
5816
4621
|
case "debug":
|
|
5817
|
-
return
|
|
4622
|
+
return LogLevel.Debug;
|
|
5818
4623
|
case "verbose":
|
|
5819
|
-
return
|
|
4624
|
+
return LogLevel.Verbose;
|
|
5820
4625
|
case "fatal":
|
|
5821
|
-
return
|
|
4626
|
+
return LogLevel.Fatal;
|
|
5822
4627
|
default:
|
|
5823
|
-
return
|
|
4628
|
+
return LogLevel.Info;
|
|
5824
4629
|
}
|
|
5825
4630
|
}
|
|
5826
4631
|
function parseMeasureMode(value) {
|
|
5827
4632
|
if (value == null) {
|
|
5828
|
-
return
|
|
4633
|
+
return MeasureMode.Undefined;
|
|
5829
4634
|
}
|
|
5830
4635
|
switch (value.toLowerCase()) {
|
|
5831
4636
|
case "undefined":
|
|
5832
|
-
return
|
|
4637
|
+
return MeasureMode.Undefined;
|
|
5833
4638
|
case "exactly":
|
|
5834
|
-
return
|
|
4639
|
+
return MeasureMode.Exactly;
|
|
5835
4640
|
case "at-most":
|
|
5836
|
-
return
|
|
4641
|
+
return MeasureMode.AtMost;
|
|
5837
4642
|
default:
|
|
5838
|
-
return
|
|
4643
|
+
return MeasureMode.Undefined;
|
|
5839
4644
|
}
|
|
5840
4645
|
}
|
|
5841
4646
|
function parseOverflow(value) {
|
|
5842
4647
|
if (value == null) {
|
|
5843
|
-
return
|
|
4648
|
+
return Overflow.Visible;
|
|
5844
4649
|
}
|
|
5845
4650
|
switch (value.toLowerCase()) {
|
|
5846
4651
|
case "visible":
|
|
5847
|
-
return
|
|
4652
|
+
return Overflow.Visible;
|
|
5848
4653
|
case "hidden":
|
|
5849
|
-
return
|
|
4654
|
+
return Overflow.Hidden;
|
|
5850
4655
|
case "scroll":
|
|
5851
|
-
return
|
|
4656
|
+
return Overflow.Scroll;
|
|
5852
4657
|
default:
|
|
5853
|
-
return
|
|
4658
|
+
return Overflow.Visible;
|
|
5854
4659
|
}
|
|
5855
4660
|
}
|
|
5856
4661
|
function parsePositionType(value) {
|
|
5857
4662
|
if (value == null) {
|
|
5858
|
-
return
|
|
4663
|
+
return PositionType.Relative;
|
|
5859
4664
|
}
|
|
5860
4665
|
switch (value.toLowerCase()) {
|
|
5861
4666
|
case "static":
|
|
5862
|
-
return
|
|
4667
|
+
return PositionType.Static;
|
|
5863
4668
|
case "relative":
|
|
5864
|
-
return
|
|
4669
|
+
return PositionType.Relative;
|
|
5865
4670
|
case "absolute":
|
|
5866
|
-
return
|
|
4671
|
+
return PositionType.Absolute;
|
|
5867
4672
|
default:
|
|
5868
|
-
return
|
|
4673
|
+
return PositionType.Static;
|
|
5869
4674
|
}
|
|
5870
4675
|
}
|
|
5871
4676
|
function parseUnit(value) {
|
|
5872
4677
|
if (value == null) {
|
|
5873
|
-
return
|
|
4678
|
+
return Unit.Point;
|
|
5874
4679
|
}
|
|
5875
4680
|
switch (value.toLowerCase()) {
|
|
5876
4681
|
case "undefined":
|
|
5877
|
-
return
|
|
4682
|
+
return Unit.Undefined;
|
|
5878
4683
|
case "point":
|
|
5879
|
-
return
|
|
4684
|
+
return Unit.Point;
|
|
5880
4685
|
case "percent":
|
|
5881
|
-
return
|
|
4686
|
+
return Unit.Percent;
|
|
5882
4687
|
case "auto":
|
|
5883
|
-
return
|
|
4688
|
+
return Unit.Auto;
|
|
5884
4689
|
default:
|
|
5885
|
-
return
|
|
4690
|
+
return Unit.Point;
|
|
5886
4691
|
}
|
|
5887
4692
|
}
|
|
5888
4693
|
function parseWrap(value) {
|
|
5889
4694
|
if (value == null) {
|
|
5890
|
-
return
|
|
4695
|
+
return Wrap.NoWrap;
|
|
5891
4696
|
}
|
|
5892
4697
|
switch (value.toLowerCase()) {
|
|
5893
4698
|
case "no-wrap":
|
|
5894
|
-
return
|
|
4699
|
+
return Wrap.NoWrap;
|
|
5895
4700
|
case "wrap":
|
|
5896
|
-
return
|
|
4701
|
+
return Wrap.Wrap;
|
|
5897
4702
|
case "wrap-reverse":
|
|
5898
|
-
return
|
|
4703
|
+
return Wrap.WrapReverse;
|
|
5899
4704
|
default:
|
|
5900
|
-
return
|
|
4705
|
+
return Wrap.NoWrap;
|
|
5901
4706
|
}
|
|
5902
4707
|
}
|
|
5903
4708
|
|
|
@@ -8702,7 +7507,7 @@ function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux) {
|
|
|
8702
7507
|
return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux);
|
|
8703
7508
|
}
|
|
8704
7509
|
// src/zig.ts
|
|
8705
|
-
import { dlopen, toArrayBuffer as
|
|
7510
|
+
import { dlopen, toArrayBuffer as toArrayBuffer3, JSCallback, ptr as ptr2 } from "bun:ffi";
|
|
8706
7511
|
import { existsSync as existsSync2 } from "fs";
|
|
8707
7512
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
8708
7513
|
|
|
@@ -8924,618 +7729,11 @@ class OptimizedBuffer {
|
|
|
8924
7729
|
}
|
|
8925
7730
|
}
|
|
8926
7731
|
|
|
8927
|
-
// ../../node_modules/bun-ffi-structs/index.js
|
|
8928
|
-
import { ptr, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
|
|
8929
|
-
function fatalError(...args) {
|
|
8930
|
-
const message = args.join(" ");
|
|
8931
|
-
console.error("FATAL ERROR:", message);
|
|
8932
|
-
throw new Error(message);
|
|
8933
|
-
}
|
|
8934
|
-
var pointerSize = process.arch === "x64" || process.arch === "arm64" ? 8 : 4;
|
|
8935
|
-
var typeSizes = {
|
|
8936
|
-
u8: 1,
|
|
8937
|
-
bool_u8: 1,
|
|
8938
|
-
bool_u32: 4,
|
|
8939
|
-
u16: 2,
|
|
8940
|
-
i16: 2,
|
|
8941
|
-
u32: 4,
|
|
8942
|
-
u64: 8,
|
|
8943
|
-
f32: 4,
|
|
8944
|
-
f64: 8,
|
|
8945
|
-
pointer: pointerSize,
|
|
8946
|
-
i32: 4
|
|
8947
|
-
};
|
|
8948
|
-
var primitiveKeys = Object.keys(typeSizes);
|
|
8949
|
-
function isPrimitiveType(type) {
|
|
8950
|
-
return typeof type === "string" && primitiveKeys.includes(type);
|
|
8951
|
-
}
|
|
8952
|
-
var typeAlignments = { ...typeSizes };
|
|
8953
|
-
var typeGetters = {
|
|
8954
|
-
u8: (view, offset) => view.getUint8(offset),
|
|
8955
|
-
bool_u8: (view, offset) => Boolean(view.getUint8(offset)),
|
|
8956
|
-
bool_u32: (view, offset) => Boolean(view.getUint32(offset, true)),
|
|
8957
|
-
u16: (view, offset) => view.getUint16(offset, true),
|
|
8958
|
-
i16: (view, offset) => view.getInt16(offset, true),
|
|
8959
|
-
u32: (view, offset) => view.getUint32(offset, true),
|
|
8960
|
-
u64: (view, offset) => view.getBigUint64(offset, true),
|
|
8961
|
-
f32: (view, offset) => view.getFloat32(offset, true),
|
|
8962
|
-
f64: (view, offset) => view.getFloat64(offset, true),
|
|
8963
|
-
i32: (view, offset) => view.getInt32(offset, true),
|
|
8964
|
-
pointer: (view, offset) => pointerSize === 8 ? view.getBigUint64(offset, true) : BigInt(view.getUint32(offset, true))
|
|
8965
|
-
};
|
|
8966
|
-
function isObjectPointerDef(type) {
|
|
8967
|
-
return typeof type === "object" && type !== null && type.__type === "objectPointer";
|
|
8968
|
-
}
|
|
8969
|
-
function alignOffset(offset, align) {
|
|
8970
|
-
return offset + (align - 1) & ~(align - 1);
|
|
8971
|
-
}
|
|
8972
|
-
function enumTypeError(value) {
|
|
8973
|
-
throw new TypeError(`Invalid enum value: ${value}`);
|
|
8974
|
-
}
|
|
8975
|
-
function defineEnum(mapping, base = "u32") {
|
|
8976
|
-
const reverse2 = Object.fromEntries(Object.entries(mapping).map(([k, v]) => [v, k]));
|
|
8977
|
-
return {
|
|
8978
|
-
__type: "enum",
|
|
8979
|
-
type: base,
|
|
8980
|
-
to(value) {
|
|
8981
|
-
return typeof value === "number" ? value : mapping[value] ?? enumTypeError(String(value));
|
|
8982
|
-
},
|
|
8983
|
-
from(value) {
|
|
8984
|
-
return reverse2[value] ?? enumTypeError(String(value));
|
|
8985
|
-
},
|
|
8986
|
-
enum: mapping
|
|
8987
|
-
};
|
|
8988
|
-
}
|
|
8989
|
-
function isEnum(type) {
|
|
8990
|
-
return typeof type === "object" && type.__type === "enum";
|
|
8991
|
-
}
|
|
8992
|
-
function isStruct(type) {
|
|
8993
|
-
return typeof type === "object" && type.__type === "struct";
|
|
8994
|
-
}
|
|
8995
|
-
function primitivePackers(type) {
|
|
8996
|
-
let pack;
|
|
8997
|
-
let unpack;
|
|
8998
|
-
switch (type) {
|
|
8999
|
-
case "u8":
|
|
9000
|
-
pack = (view, off, val) => view.setUint8(off, val);
|
|
9001
|
-
unpack = (view, off) => view.getUint8(off);
|
|
9002
|
-
break;
|
|
9003
|
-
case "bool_u8":
|
|
9004
|
-
pack = (view, off, val) => view.setUint8(off, val ? 1 : 0);
|
|
9005
|
-
unpack = (view, off) => Boolean(view.getUint8(off));
|
|
9006
|
-
break;
|
|
9007
|
-
case "bool_u32":
|
|
9008
|
-
pack = (view, off, val) => view.setUint32(off, val ? 1 : 0, true);
|
|
9009
|
-
unpack = (view, off) => Boolean(view.getUint32(off, true));
|
|
9010
|
-
break;
|
|
9011
|
-
case "u16":
|
|
9012
|
-
pack = (view, off, val) => view.setUint16(off, val, true);
|
|
9013
|
-
unpack = (view, off) => view.getUint16(off, true);
|
|
9014
|
-
break;
|
|
9015
|
-
case "i16":
|
|
9016
|
-
pack = (view, off, val) => view.setInt16(off, val, true);
|
|
9017
|
-
unpack = (view, off) => view.getInt16(off, true);
|
|
9018
|
-
break;
|
|
9019
|
-
case "u32":
|
|
9020
|
-
pack = (view, off, val) => view.setUint32(off, val, true);
|
|
9021
|
-
unpack = (view, off) => view.getUint32(off, true);
|
|
9022
|
-
break;
|
|
9023
|
-
case "i32":
|
|
9024
|
-
pack = (view, off, val) => view.setInt32(off, val, true);
|
|
9025
|
-
unpack = (view, off) => view.getInt32(off, true);
|
|
9026
|
-
break;
|
|
9027
|
-
case "u64":
|
|
9028
|
-
pack = (view, off, val) => view.setBigUint64(off, BigInt(val), true);
|
|
9029
|
-
unpack = (view, off) => view.getBigUint64(off, true);
|
|
9030
|
-
break;
|
|
9031
|
-
case "f32":
|
|
9032
|
-
pack = (view, off, val) => view.setFloat32(off, val, true);
|
|
9033
|
-
unpack = (view, off) => view.getFloat32(off, true);
|
|
9034
|
-
break;
|
|
9035
|
-
case "f64":
|
|
9036
|
-
pack = (view, off, val) => view.setFloat64(off, val, true);
|
|
9037
|
-
unpack = (view, off) => view.getFloat64(off, true);
|
|
9038
|
-
break;
|
|
9039
|
-
case "pointer":
|
|
9040
|
-
pack = (view, off, val) => {
|
|
9041
|
-
pointerSize === 8 ? view.setBigUint64(off, val ? BigInt(val) : 0n, true) : view.setUint32(off, val ? Number(val) : 0, true);
|
|
9042
|
-
};
|
|
9043
|
-
unpack = (view, off) => {
|
|
9044
|
-
const bint = pointerSize === 8 ? view.getBigUint64(off, true) : BigInt(view.getUint32(off, true));
|
|
9045
|
-
return Number(bint);
|
|
9046
|
-
};
|
|
9047
|
-
break;
|
|
9048
|
-
default:
|
|
9049
|
-
fatalError(`Unsupported primitive type: ${type}`);
|
|
9050
|
-
}
|
|
9051
|
-
return { pack, unpack };
|
|
9052
|
-
}
|
|
9053
|
-
var { pack: pointerPacker, unpack: pointerUnpacker } = primitivePackers("pointer");
|
|
9054
|
-
function packObjectArray(val) {
|
|
9055
|
-
const buffer = new ArrayBuffer(val.length * pointerSize);
|
|
9056
|
-
const bufferView = new DataView(buffer);
|
|
9057
|
-
for (let i = 0;i < val.length; i++) {
|
|
9058
|
-
const instance = val[i];
|
|
9059
|
-
const ptrValue = instance?.ptr ?? null;
|
|
9060
|
-
pointerPacker(bufferView, i * pointerSize, ptrValue);
|
|
9061
|
-
}
|
|
9062
|
-
return bufferView;
|
|
9063
|
-
}
|
|
9064
|
-
var encoder = new TextEncoder;
|
|
9065
|
-
var decoder = new TextDecoder;
|
|
9066
|
-
function defineStruct(fields, structDefOptions) {
|
|
9067
|
-
let offset = 0;
|
|
9068
|
-
let maxAlign = 1;
|
|
9069
|
-
const layout = [];
|
|
9070
|
-
const lengthOfFields = {};
|
|
9071
|
-
const lengthOfRequested = [];
|
|
9072
|
-
const arrayFieldsMetadata = {};
|
|
9073
|
-
for (const [name, typeOrStruct, options = {}] of fields) {
|
|
9074
|
-
if (options.condition && !options.condition()) {
|
|
9075
|
-
continue;
|
|
9076
|
-
}
|
|
9077
|
-
let size = 0, align = 0;
|
|
9078
|
-
let pack;
|
|
9079
|
-
let unpack;
|
|
9080
|
-
let needsLengthOf = false;
|
|
9081
|
-
let lengthOfDef = null;
|
|
9082
|
-
if (isPrimitiveType(typeOrStruct)) {
|
|
9083
|
-
size = typeSizes[typeOrStruct];
|
|
9084
|
-
align = typeAlignments[typeOrStruct];
|
|
9085
|
-
({ pack, unpack } = primitivePackers(typeOrStruct));
|
|
9086
|
-
} else if (typeof typeOrStruct === "string" && typeOrStruct === "cstring") {
|
|
9087
|
-
size = pointerSize;
|
|
9088
|
-
align = pointerSize;
|
|
9089
|
-
pack = (view, off, val) => {
|
|
9090
|
-
const bufPtr = val ? ptr(encoder.encode(val + "\x00")) : null;
|
|
9091
|
-
pointerPacker(view, off, bufPtr);
|
|
9092
|
-
};
|
|
9093
|
-
unpack = (view, off) => {
|
|
9094
|
-
const ptrVal = pointerUnpacker(view, off);
|
|
9095
|
-
return ptrVal;
|
|
9096
|
-
};
|
|
9097
|
-
} else if (typeof typeOrStruct === "string" && typeOrStruct === "char*") {
|
|
9098
|
-
size = pointerSize;
|
|
9099
|
-
align = pointerSize;
|
|
9100
|
-
pack = (view, off, val) => {
|
|
9101
|
-
const bufPtr = val ? ptr(encoder.encode(val)) : null;
|
|
9102
|
-
pointerPacker(view, off, bufPtr);
|
|
9103
|
-
};
|
|
9104
|
-
unpack = (view, off) => {
|
|
9105
|
-
const ptrVal = pointerUnpacker(view, off);
|
|
9106
|
-
return ptrVal;
|
|
9107
|
-
};
|
|
9108
|
-
needsLengthOf = true;
|
|
9109
|
-
} else if (isEnum(typeOrStruct)) {
|
|
9110
|
-
const base = typeOrStruct.type;
|
|
9111
|
-
size = typeSizes[base];
|
|
9112
|
-
align = typeAlignments[base];
|
|
9113
|
-
const { pack: packEnum } = primitivePackers(base);
|
|
9114
|
-
pack = (view, off, val) => {
|
|
9115
|
-
const num = typeOrStruct.to(val);
|
|
9116
|
-
packEnum(view, off, num);
|
|
9117
|
-
};
|
|
9118
|
-
unpack = (view, off) => {
|
|
9119
|
-
const raw = typeGetters[base](view, off);
|
|
9120
|
-
return typeOrStruct.from(raw);
|
|
9121
|
-
};
|
|
9122
|
-
} else if (isStruct(typeOrStruct)) {
|
|
9123
|
-
if (options.asPointer === true) {
|
|
9124
|
-
size = pointerSize;
|
|
9125
|
-
align = pointerSize;
|
|
9126
|
-
pack = (view, off, val, obj, options2) => {
|
|
9127
|
-
if (!val) {
|
|
9128
|
-
pointerPacker(view, off, null);
|
|
9129
|
-
return;
|
|
9130
|
-
}
|
|
9131
|
-
const nestedBuf = typeOrStruct.pack(val, options2);
|
|
9132
|
-
pointerPacker(view, off, ptr(nestedBuf));
|
|
9133
|
-
};
|
|
9134
|
-
unpack = (view, off) => {
|
|
9135
|
-
throw new Error("Not implemented yet");
|
|
9136
|
-
};
|
|
9137
|
-
} else {
|
|
9138
|
-
size = typeOrStruct.size;
|
|
9139
|
-
align = typeOrStruct.align;
|
|
9140
|
-
pack = (view, off, val, obj, options2) => {
|
|
9141
|
-
const nestedBuf = typeOrStruct.pack(val, options2);
|
|
9142
|
-
const nestedView = new Uint8Array(nestedBuf);
|
|
9143
|
-
const dView = new Uint8Array(view.buffer);
|
|
9144
|
-
dView.set(nestedView, off);
|
|
9145
|
-
};
|
|
9146
|
-
unpack = (view, off) => {
|
|
9147
|
-
const slice = view.buffer.slice(off, off + size);
|
|
9148
|
-
return typeOrStruct.unpack(slice);
|
|
9149
|
-
};
|
|
9150
|
-
}
|
|
9151
|
-
} else if (isObjectPointerDef(typeOrStruct)) {
|
|
9152
|
-
size = pointerSize;
|
|
9153
|
-
align = pointerSize;
|
|
9154
|
-
pack = (view, off, value) => {
|
|
9155
|
-
const ptrValue = value?.ptr ?? null;
|
|
9156
|
-
if (ptrValue === undefined) {
|
|
9157
|
-
console.warn(`Field '${name}' expected object with '.ptr' property, but got undefined pointer value from:`, value);
|
|
9158
|
-
pointerPacker(view, off, null);
|
|
9159
|
-
} else {
|
|
9160
|
-
pointerPacker(view, off, ptrValue);
|
|
9161
|
-
}
|
|
9162
|
-
};
|
|
9163
|
-
unpack = (view, off) => {
|
|
9164
|
-
return pointerUnpacker(view, off);
|
|
9165
|
-
};
|
|
9166
|
-
} else if (Array.isArray(typeOrStruct) && typeOrStruct.length === 1 && typeOrStruct[0] !== undefined) {
|
|
9167
|
-
const [def] = typeOrStruct;
|
|
9168
|
-
size = pointerSize;
|
|
9169
|
-
align = pointerSize;
|
|
9170
|
-
let arrayElementSize;
|
|
9171
|
-
if (isEnum(def)) {
|
|
9172
|
-
arrayElementSize = typeSizes[def.type];
|
|
9173
|
-
pack = (view, off, val, obj) => {
|
|
9174
|
-
if (!val || val.length === 0) {
|
|
9175
|
-
pointerPacker(view, off, null);
|
|
9176
|
-
return;
|
|
9177
|
-
}
|
|
9178
|
-
const buffer = new ArrayBuffer(val.length * arrayElementSize);
|
|
9179
|
-
const bufferView = new DataView(buffer);
|
|
9180
|
-
for (let i = 0;i < val.length; i++) {
|
|
9181
|
-
const num = def.to(val[i]);
|
|
9182
|
-
bufferView.setUint32(i * arrayElementSize, num, true);
|
|
9183
|
-
}
|
|
9184
|
-
pointerPacker(view, off, ptr(buffer));
|
|
9185
|
-
};
|
|
9186
|
-
unpack = null;
|
|
9187
|
-
needsLengthOf = true;
|
|
9188
|
-
lengthOfDef = def;
|
|
9189
|
-
} else if (isStruct(def)) {
|
|
9190
|
-
arrayElementSize = def.size;
|
|
9191
|
-
pack = (view, off, val, obj, options2) => {
|
|
9192
|
-
if (!val || val.length === 0) {
|
|
9193
|
-
pointerPacker(view, off, null);
|
|
9194
|
-
return;
|
|
9195
|
-
}
|
|
9196
|
-
const buffer = new ArrayBuffer(val.length * arrayElementSize);
|
|
9197
|
-
const bufferView = new DataView(buffer);
|
|
9198
|
-
for (let i = 0;i < val.length; i++) {
|
|
9199
|
-
def.packInto(val[i], bufferView, i * arrayElementSize, options2);
|
|
9200
|
-
}
|
|
9201
|
-
pointerPacker(view, off, ptr(buffer));
|
|
9202
|
-
};
|
|
9203
|
-
unpack = (view, off) => {
|
|
9204
|
-
throw new Error("Not implemented yet");
|
|
9205
|
-
};
|
|
9206
|
-
} else if (isPrimitiveType(def)) {
|
|
9207
|
-
arrayElementSize = typeSizes[def];
|
|
9208
|
-
const { pack: primitivePack } = primitivePackers(def);
|
|
9209
|
-
pack = (view, off, val) => {
|
|
9210
|
-
if (!val || val.length === 0) {
|
|
9211
|
-
pointerPacker(view, off, null);
|
|
9212
|
-
return;
|
|
9213
|
-
}
|
|
9214
|
-
const buffer = new ArrayBuffer(val.length * arrayElementSize);
|
|
9215
|
-
const bufferView = new DataView(buffer);
|
|
9216
|
-
for (let i = 0;i < val.length; i++) {
|
|
9217
|
-
primitivePack(bufferView, i * arrayElementSize, val[i]);
|
|
9218
|
-
}
|
|
9219
|
-
pointerPacker(view, off, ptr(buffer));
|
|
9220
|
-
};
|
|
9221
|
-
unpack = null;
|
|
9222
|
-
needsLengthOf = true;
|
|
9223
|
-
lengthOfDef = def;
|
|
9224
|
-
} else if (isObjectPointerDef(def)) {
|
|
9225
|
-
arrayElementSize = pointerSize;
|
|
9226
|
-
pack = (view, off, val) => {
|
|
9227
|
-
if (!val || val.length === 0) {
|
|
9228
|
-
pointerPacker(view, off, null);
|
|
9229
|
-
return;
|
|
9230
|
-
}
|
|
9231
|
-
const packedView = packObjectArray(val);
|
|
9232
|
-
pointerPacker(view, off, ptr(packedView.buffer));
|
|
9233
|
-
};
|
|
9234
|
-
unpack = () => {
|
|
9235
|
-
throw new Error("not implemented yet");
|
|
9236
|
-
};
|
|
9237
|
-
} else {
|
|
9238
|
-
throw new Error(`Unsupported array element type for ${name}: ${JSON.stringify(def)}`);
|
|
9239
|
-
}
|
|
9240
|
-
const lengthOfField = Object.values(lengthOfFields).find((f) => f.lengthOf === name);
|
|
9241
|
-
if (lengthOfField && isPrimitiveType(lengthOfField.type)) {
|
|
9242
|
-
const { pack: lengthPack } = primitivePackers(lengthOfField.type);
|
|
9243
|
-
arrayFieldsMetadata[name] = {
|
|
9244
|
-
elementSize: arrayElementSize,
|
|
9245
|
-
arrayOffset: offset,
|
|
9246
|
-
lengthOffset: lengthOfField.offset,
|
|
9247
|
-
lengthPack
|
|
9248
|
-
};
|
|
9249
|
-
}
|
|
9250
|
-
} else {
|
|
9251
|
-
throw new Error(`Unsupported field type for ${name}: ${JSON.stringify(typeOrStruct)}`);
|
|
9252
|
-
}
|
|
9253
|
-
offset = alignOffset(offset, align);
|
|
9254
|
-
if (options.unpackTransform) {
|
|
9255
|
-
const originalUnpack = unpack;
|
|
9256
|
-
unpack = (view, off) => options.unpackTransform(originalUnpack(view, off));
|
|
9257
|
-
}
|
|
9258
|
-
if (options.packTransform) {
|
|
9259
|
-
const originalPack = pack;
|
|
9260
|
-
pack = (view, off, val, obj, packOptions) => originalPack(view, off, options.packTransform(val), obj, packOptions);
|
|
9261
|
-
}
|
|
9262
|
-
if (options.optional) {
|
|
9263
|
-
const originalPack = pack;
|
|
9264
|
-
if (isStruct(typeOrStruct) && !options.asPointer) {
|
|
9265
|
-
pack = (view, off, val, obj, packOptions) => {
|
|
9266
|
-
if (val || options.mapOptionalInline) {
|
|
9267
|
-
originalPack(view, off, val, obj, packOptions);
|
|
9268
|
-
}
|
|
9269
|
-
};
|
|
9270
|
-
} else {
|
|
9271
|
-
pack = (view, off, val, obj, packOptions) => originalPack(view, off, val ?? 0, obj, packOptions);
|
|
9272
|
-
}
|
|
9273
|
-
}
|
|
9274
|
-
if (options.lengthOf) {
|
|
9275
|
-
const originalPack = pack;
|
|
9276
|
-
pack = (view, off, val, obj, packOptions) => {
|
|
9277
|
-
const targetValue = obj[options.lengthOf];
|
|
9278
|
-
let length = 0;
|
|
9279
|
-
if (targetValue) {
|
|
9280
|
-
if (typeof targetValue === "string") {
|
|
9281
|
-
length = Buffer.byteLength(targetValue);
|
|
9282
|
-
} else {
|
|
9283
|
-
length = targetValue.length;
|
|
9284
|
-
}
|
|
9285
|
-
}
|
|
9286
|
-
return originalPack(view, off, length, obj, packOptions);
|
|
9287
|
-
};
|
|
9288
|
-
}
|
|
9289
|
-
let validateFunctions;
|
|
9290
|
-
if (options.validate) {
|
|
9291
|
-
validateFunctions = Array.isArray(options.validate) ? options.validate : [options.validate];
|
|
9292
|
-
}
|
|
9293
|
-
const layoutField = {
|
|
9294
|
-
name,
|
|
9295
|
-
offset,
|
|
9296
|
-
size,
|
|
9297
|
-
align,
|
|
9298
|
-
validate: validateFunctions,
|
|
9299
|
-
optional: !!options.optional || !!options.lengthOf || options.default !== undefined,
|
|
9300
|
-
default: options.default,
|
|
9301
|
-
pack,
|
|
9302
|
-
unpack,
|
|
9303
|
-
type: typeOrStruct,
|
|
9304
|
-
lengthOf: options.lengthOf
|
|
9305
|
-
};
|
|
9306
|
-
layout.push(layoutField);
|
|
9307
|
-
if (options.lengthOf) {
|
|
9308
|
-
lengthOfFields[options.lengthOf] = layoutField;
|
|
9309
|
-
}
|
|
9310
|
-
if (needsLengthOf) {
|
|
9311
|
-
const def = typeof typeOrStruct === "string" && typeOrStruct === "char*" ? "char*" : lengthOfDef;
|
|
9312
|
-
if (!def)
|
|
9313
|
-
fatalError(`Internal error: needsLengthOf=true but def is null for ${name}`);
|
|
9314
|
-
lengthOfRequested.push({ requester: layoutField, def });
|
|
9315
|
-
}
|
|
9316
|
-
offset += size;
|
|
9317
|
-
maxAlign = Math.max(maxAlign, align);
|
|
9318
|
-
}
|
|
9319
|
-
for (const { requester, def } of lengthOfRequested) {
|
|
9320
|
-
const lengthOfField = lengthOfFields[requester.name];
|
|
9321
|
-
if (!lengthOfField) {
|
|
9322
|
-
if (def === "char*") {
|
|
9323
|
-
continue;
|
|
9324
|
-
}
|
|
9325
|
-
throw new Error(`lengthOf field not found for array field ${requester.name}`);
|
|
9326
|
-
}
|
|
9327
|
-
if (def === "char*") {
|
|
9328
|
-
requester.unpack = (view, off) => {
|
|
9329
|
-
const ptrAddress = pointerUnpacker(view, off);
|
|
9330
|
-
const length = lengthOfField.unpack(view, lengthOfField.offset);
|
|
9331
|
-
if (ptrAddress === 0) {
|
|
9332
|
-
return null;
|
|
9333
|
-
}
|
|
9334
|
-
const byteLength = typeof length === "bigint" ? Number(length) : length;
|
|
9335
|
-
if (byteLength === 0) {
|
|
9336
|
-
return "";
|
|
9337
|
-
}
|
|
9338
|
-
const buffer = toArrayBuffer2(ptrAddress, 0, byteLength);
|
|
9339
|
-
return decoder.decode(buffer);
|
|
9340
|
-
};
|
|
9341
|
-
} else if (isPrimitiveType(def)) {
|
|
9342
|
-
const elemSize = typeSizes[def];
|
|
9343
|
-
const { unpack: primitiveUnpack } = primitivePackers(def);
|
|
9344
|
-
requester.unpack = (view, off) => {
|
|
9345
|
-
const result = [];
|
|
9346
|
-
const length = lengthOfField.unpack(view, lengthOfField.offset);
|
|
9347
|
-
const ptrAddress = pointerUnpacker(view, off);
|
|
9348
|
-
if (ptrAddress === 0n && length > 0) {
|
|
9349
|
-
throw new Error(`Array field ${requester.name} has null pointer but length ${length}.`);
|
|
9350
|
-
}
|
|
9351
|
-
if (ptrAddress === 0n || length === 0) {
|
|
9352
|
-
return [];
|
|
9353
|
-
}
|
|
9354
|
-
const buffer = toArrayBuffer2(ptrAddress, 0, length * elemSize);
|
|
9355
|
-
const bufferView = new DataView(buffer);
|
|
9356
|
-
for (let i = 0;i < length; i++) {
|
|
9357
|
-
result.push(primitiveUnpack(bufferView, i * elemSize));
|
|
9358
|
-
}
|
|
9359
|
-
return result;
|
|
9360
|
-
};
|
|
9361
|
-
} else {
|
|
9362
|
-
const elemSize = def.type === "u32" ? 4 : 8;
|
|
9363
|
-
requester.unpack = (view, off) => {
|
|
9364
|
-
const result = [];
|
|
9365
|
-
const length = lengthOfField.unpack(view, lengthOfField.offset);
|
|
9366
|
-
const ptrAddress = pointerUnpacker(view, off);
|
|
9367
|
-
if (ptrAddress === 0n && length > 0) {
|
|
9368
|
-
throw new Error(`Array field ${requester.name} has null pointer but length ${length}.`);
|
|
9369
|
-
}
|
|
9370
|
-
if (ptrAddress === 0n || length === 0) {
|
|
9371
|
-
return [];
|
|
9372
|
-
}
|
|
9373
|
-
const buffer = toArrayBuffer2(ptrAddress, 0, length * elemSize);
|
|
9374
|
-
const bufferView = new DataView(buffer);
|
|
9375
|
-
for (let i = 0;i < length; i++) {
|
|
9376
|
-
result.push(def.from(bufferView.getUint32(i * elemSize, true)));
|
|
9377
|
-
}
|
|
9378
|
-
return result;
|
|
9379
|
-
};
|
|
9380
|
-
}
|
|
9381
|
-
}
|
|
9382
|
-
const totalSize = alignOffset(offset, maxAlign);
|
|
9383
|
-
const description = layout.map((f) => ({
|
|
9384
|
-
name: f.name,
|
|
9385
|
-
offset: f.offset,
|
|
9386
|
-
size: f.size,
|
|
9387
|
-
align: f.align,
|
|
9388
|
-
optional: f.optional,
|
|
9389
|
-
type: f.type,
|
|
9390
|
-
lengthOf: f.lengthOf
|
|
9391
|
-
}));
|
|
9392
|
-
const layoutByName = new Map(description.map((f) => [f.name, f]));
|
|
9393
|
-
const arrayFields = new Map(Object.entries(arrayFieldsMetadata));
|
|
9394
|
-
return {
|
|
9395
|
-
__type: "struct",
|
|
9396
|
-
size: totalSize,
|
|
9397
|
-
align: maxAlign,
|
|
9398
|
-
hasMapValue: !!structDefOptions?.mapValue,
|
|
9399
|
-
layoutByName,
|
|
9400
|
-
arrayFields,
|
|
9401
|
-
pack(obj, options) {
|
|
9402
|
-
const buf = new ArrayBuffer(totalSize);
|
|
9403
|
-
const view = new DataView(buf);
|
|
9404
|
-
let mappedObj = obj;
|
|
9405
|
-
if (structDefOptions?.mapValue) {
|
|
9406
|
-
mappedObj = structDefOptions.mapValue(obj);
|
|
9407
|
-
}
|
|
9408
|
-
for (const field of layout) {
|
|
9409
|
-
const value = mappedObj[field.name] ?? field.default;
|
|
9410
|
-
if (!field.optional && value === undefined) {
|
|
9411
|
-
fatalError(`Packing non-optional field '${field.name}' but value is undefined (and no default provided)`);
|
|
9412
|
-
}
|
|
9413
|
-
if (field.validate) {
|
|
9414
|
-
for (const validateFn of field.validate) {
|
|
9415
|
-
validateFn(value, field.name, {
|
|
9416
|
-
hints: options?.validationHints,
|
|
9417
|
-
input: mappedObj
|
|
9418
|
-
});
|
|
9419
|
-
}
|
|
9420
|
-
}
|
|
9421
|
-
field.pack(view, field.offset, value, mappedObj, options);
|
|
9422
|
-
}
|
|
9423
|
-
return view.buffer;
|
|
9424
|
-
},
|
|
9425
|
-
packInto(obj, view, offset2, options) {
|
|
9426
|
-
let mappedObj = obj;
|
|
9427
|
-
if (structDefOptions?.mapValue) {
|
|
9428
|
-
mappedObj = structDefOptions.mapValue(obj);
|
|
9429
|
-
}
|
|
9430
|
-
for (const field of layout) {
|
|
9431
|
-
const value = mappedObj[field.name] ?? field.default;
|
|
9432
|
-
if (!field.optional && value === undefined) {
|
|
9433
|
-
console.warn(`packInto missing value for non-optional field '${field.name}' at offset ${offset2 + field.offset}. Writing default or zero.`);
|
|
9434
|
-
}
|
|
9435
|
-
if (field.validate) {
|
|
9436
|
-
for (const validateFn of field.validate) {
|
|
9437
|
-
validateFn(value, field.name, {
|
|
9438
|
-
hints: options?.validationHints,
|
|
9439
|
-
input: mappedObj
|
|
9440
|
-
});
|
|
9441
|
-
}
|
|
9442
|
-
}
|
|
9443
|
-
field.pack(view, offset2 + field.offset, value, mappedObj, options);
|
|
9444
|
-
}
|
|
9445
|
-
},
|
|
9446
|
-
unpack(buf) {
|
|
9447
|
-
if (buf.byteLength < totalSize) {
|
|
9448
|
-
fatalError(`Buffer size (${buf.byteLength}) is smaller than struct size (${totalSize}) for unpacking.`);
|
|
9449
|
-
}
|
|
9450
|
-
const view = new DataView(buf);
|
|
9451
|
-
const result = structDefOptions?.default ? { ...structDefOptions.default } : {};
|
|
9452
|
-
for (const field of layout) {
|
|
9453
|
-
if (!field.unpack) {
|
|
9454
|
-
continue;
|
|
9455
|
-
}
|
|
9456
|
-
try {
|
|
9457
|
-
result[field.name] = field.unpack(view, field.offset);
|
|
9458
|
-
} catch (e) {
|
|
9459
|
-
console.error(`Error unpacking field '${field.name}' at offset ${field.offset}:`, e);
|
|
9460
|
-
throw e;
|
|
9461
|
-
}
|
|
9462
|
-
}
|
|
9463
|
-
if (structDefOptions?.reduceValue) {
|
|
9464
|
-
return structDefOptions.reduceValue(result);
|
|
9465
|
-
}
|
|
9466
|
-
return result;
|
|
9467
|
-
},
|
|
9468
|
-
packList(objects, options) {
|
|
9469
|
-
if (objects.length === 0) {
|
|
9470
|
-
return new ArrayBuffer(0);
|
|
9471
|
-
}
|
|
9472
|
-
const buffer = new ArrayBuffer(totalSize * objects.length);
|
|
9473
|
-
const view = new DataView(buffer);
|
|
9474
|
-
for (let i = 0;i < objects.length; i++) {
|
|
9475
|
-
let mappedObj = objects[i];
|
|
9476
|
-
if (structDefOptions?.mapValue) {
|
|
9477
|
-
mappedObj = structDefOptions.mapValue(objects[i]);
|
|
9478
|
-
}
|
|
9479
|
-
for (const field of layout) {
|
|
9480
|
-
const value = mappedObj[field.name] ?? field.default;
|
|
9481
|
-
if (!field.optional && value === undefined) {
|
|
9482
|
-
fatalError(`Packing non-optional field '${field.name}' at index ${i} but value is undefined (and no default provided)`);
|
|
9483
|
-
}
|
|
9484
|
-
if (field.validate) {
|
|
9485
|
-
for (const validateFn of field.validate) {
|
|
9486
|
-
validateFn(value, field.name, {
|
|
9487
|
-
hints: options?.validationHints,
|
|
9488
|
-
input: mappedObj
|
|
9489
|
-
});
|
|
9490
|
-
}
|
|
9491
|
-
}
|
|
9492
|
-
field.pack(view, i * totalSize + field.offset, value, mappedObj, options);
|
|
9493
|
-
}
|
|
9494
|
-
}
|
|
9495
|
-
return buffer;
|
|
9496
|
-
},
|
|
9497
|
-
unpackList(buf, count) {
|
|
9498
|
-
if (count === 0) {
|
|
9499
|
-
return [];
|
|
9500
|
-
}
|
|
9501
|
-
const expectedSize = totalSize * count;
|
|
9502
|
-
if (buf.byteLength < expectedSize) {
|
|
9503
|
-
fatalError(`Buffer size (${buf.byteLength}) is smaller than expected size (${expectedSize}) for unpacking ${count} structs.`);
|
|
9504
|
-
}
|
|
9505
|
-
const view = new DataView(buf);
|
|
9506
|
-
const results = [];
|
|
9507
|
-
for (let i = 0;i < count; i++) {
|
|
9508
|
-
const offset2 = i * totalSize;
|
|
9509
|
-
const result = structDefOptions?.default ? { ...structDefOptions.default } : {};
|
|
9510
|
-
for (const field of layout) {
|
|
9511
|
-
if (!field.unpack) {
|
|
9512
|
-
continue;
|
|
9513
|
-
}
|
|
9514
|
-
try {
|
|
9515
|
-
result[field.name] = field.unpack(view, offset2 + field.offset);
|
|
9516
|
-
} catch (e) {
|
|
9517
|
-
console.error(`Error unpacking field '${field.name}' at index ${i}, offset ${offset2 + field.offset}:`, e);
|
|
9518
|
-
throw e;
|
|
9519
|
-
}
|
|
9520
|
-
}
|
|
9521
|
-
if (structDefOptions?.reduceValue) {
|
|
9522
|
-
results.push(structDefOptions.reduceValue(result));
|
|
9523
|
-
} else {
|
|
9524
|
-
results.push(result);
|
|
9525
|
-
}
|
|
9526
|
-
}
|
|
9527
|
-
return results;
|
|
9528
|
-
},
|
|
9529
|
-
describe() {
|
|
9530
|
-
return description;
|
|
9531
|
-
}
|
|
9532
|
-
};
|
|
9533
|
-
}
|
|
9534
|
-
|
|
9535
7732
|
// src/zig-structs.ts
|
|
9536
|
-
import {
|
|
9537
|
-
|
|
9538
|
-
var
|
|
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;
|
|
9539
7737
|
var StyledChunkStruct = defineStruct([
|
|
9540
7738
|
["text", "char*"],
|
|
9541
7739
|
["text_len", "u64", { lengthOf: "text" }],
|
|
@@ -10588,7 +8786,7 @@ class FFIRenderLib {
|
|
|
10588
8786
|
if (msgLen === 0 || !msgPtr) {
|
|
10589
8787
|
return;
|
|
10590
8788
|
}
|
|
10591
|
-
const msgBuffer =
|
|
8789
|
+
const msgBuffer = toArrayBuffer3(msgPtr, 0, msgLen);
|
|
10592
8790
|
const msgBytes = new Uint8Array(msgBuffer);
|
|
10593
8791
|
const message = this.decoder.decode(msgBytes);
|
|
10594
8792
|
switch (level) {
|
|
@@ -10634,12 +8832,12 @@ class FFIRenderLib {
|
|
|
10634
8832
|
if (nameLen === 0 || !namePtr) {
|
|
10635
8833
|
return;
|
|
10636
8834
|
}
|
|
10637
|
-
const nameBuffer =
|
|
8835
|
+
const nameBuffer = toArrayBuffer3(namePtr, 0, nameLen);
|
|
10638
8836
|
const nameBytes = new Uint8Array(nameBuffer);
|
|
10639
8837
|
const eventName = this.decoder.decode(nameBytes);
|
|
10640
8838
|
let eventData;
|
|
10641
8839
|
if (dataLen > 0 && dataPtr) {
|
|
10642
|
-
eventData =
|
|
8840
|
+
eventData = toArrayBuffer3(dataPtr, 0, dataLen).slice();
|
|
10643
8841
|
} else {
|
|
10644
8842
|
eventData = new ArrayBuffer(0);
|
|
10645
8843
|
}
|
|
@@ -10705,32 +8903,32 @@ class FFIRenderLib {
|
|
|
10705
8903
|
return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
|
|
10706
8904
|
}
|
|
10707
8905
|
bufferGetCharPtr(buffer) {
|
|
10708
|
-
const
|
|
10709
|
-
if (!
|
|
8906
|
+
const ptr3 = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
8907
|
+
if (!ptr3) {
|
|
10710
8908
|
throw new Error("Failed to get char pointer");
|
|
10711
8909
|
}
|
|
10712
|
-
return
|
|
8910
|
+
return ptr3;
|
|
10713
8911
|
}
|
|
10714
8912
|
bufferGetFgPtr(buffer) {
|
|
10715
|
-
const
|
|
10716
|
-
if (!
|
|
8913
|
+
const ptr3 = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
8914
|
+
if (!ptr3) {
|
|
10717
8915
|
throw new Error("Failed to get fg pointer");
|
|
10718
8916
|
}
|
|
10719
|
-
return
|
|
8917
|
+
return ptr3;
|
|
10720
8918
|
}
|
|
10721
8919
|
bufferGetBgPtr(buffer) {
|
|
10722
|
-
const
|
|
10723
|
-
if (!
|
|
8920
|
+
const ptr3 = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
8921
|
+
if (!ptr3) {
|
|
10724
8922
|
throw new Error("Failed to get bg pointer");
|
|
10725
8923
|
}
|
|
10726
|
-
return
|
|
8924
|
+
return ptr3;
|
|
10727
8925
|
}
|
|
10728
8926
|
bufferGetAttributesPtr(buffer) {
|
|
10729
|
-
const
|
|
10730
|
-
if (!
|
|
8927
|
+
const ptr3 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
8928
|
+
if (!ptr3) {
|
|
10731
8929
|
throw new Error("Failed to get attributes pointer");
|
|
10732
8930
|
}
|
|
10733
|
-
return
|
|
8931
|
+
return ptr3;
|
|
10734
8932
|
}
|
|
10735
8933
|
bufferGetRespectAlpha(buffer) {
|
|
10736
8934
|
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
@@ -10973,7 +9171,7 @@ class FFIRenderLib {
|
|
|
10973
9171
|
return;
|
|
10974
9172
|
}
|
|
10975
9173
|
const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
|
|
10976
|
-
this.opentui.symbols.textBufferSetStyledText(buffer,
|
|
9174
|
+
this.opentui.symbols.textBufferSetStyledText(buffer, ptr2(chunksBuffer), nonEmptyChunks.length);
|
|
10977
9175
|
}
|
|
10978
9176
|
textBufferGetLineCount(buffer) {
|
|
10979
9177
|
return this.opentui.symbols.textBufferGetLineCount(buffer);
|
|
@@ -10984,7 +9182,7 @@ class FFIRenderLib {
|
|
|
10984
9182
|
}
|
|
10985
9183
|
getPlainTextBytes(buffer, maxLength) {
|
|
10986
9184
|
const outBuffer = new Uint8Array(maxLength);
|
|
10987
|
-
const actualLen = this.textBufferGetPlainText(buffer,
|
|
9185
|
+
const actualLen = this.textBufferGetPlainText(buffer, ptr2(outBuffer), maxLength);
|
|
10988
9186
|
if (actualLen === 0) {
|
|
10989
9187
|
return null;
|
|
10990
9188
|
}
|
|
@@ -10992,7 +9190,7 @@ class FFIRenderLib {
|
|
|
10992
9190
|
}
|
|
10993
9191
|
textBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
10994
9192
|
const outBuffer = new Uint8Array(maxLength);
|
|
10995
|
-
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset,
|
|
9193
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRange(buffer, startOffset, endOffset, ptr2(outBuffer), maxLength);
|
|
10996
9194
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
10997
9195
|
if (len === 0) {
|
|
10998
9196
|
return null;
|
|
@@ -11001,7 +9199,7 @@ class FFIRenderLib {
|
|
|
11001
9199
|
}
|
|
11002
9200
|
textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
11003
9201
|
const outBuffer = new Uint8Array(maxLength);
|
|
11004
|
-
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol,
|
|
9202
|
+
const actualLen = this.opentui.symbols.textBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr2(outBuffer), maxLength);
|
|
11005
9203
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11006
9204
|
if (len === 0) {
|
|
11007
9205
|
return null;
|
|
@@ -11061,7 +9259,7 @@ class FFIRenderLib {
|
|
|
11061
9259
|
}
|
|
11062
9260
|
textBufferViewGetLineInfo(view) {
|
|
11063
9261
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11064
|
-
this.textBufferViewGetLineInfoDirect(view,
|
|
9262
|
+
this.textBufferViewGetLineInfoDirect(view, ptr2(outBuffer));
|
|
11065
9263
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11066
9264
|
return {
|
|
11067
9265
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11073,7 +9271,7 @@ class FFIRenderLib {
|
|
|
11073
9271
|
}
|
|
11074
9272
|
textBufferViewGetLogicalLineInfo(view) {
|
|
11075
9273
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11076
|
-
this.textBufferViewGetLogicalLineInfoDirect(view,
|
|
9274
|
+
this.textBufferViewGetLogicalLineInfoDirect(view, ptr2(outBuffer));
|
|
11077
9275
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11078
9276
|
return {
|
|
11079
9277
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11102,7 +9300,7 @@ class FFIRenderLib {
|
|
|
11102
9300
|
}
|
|
11103
9301
|
textBufferViewGetSelectedTextBytes(view, maxLength) {
|
|
11104
9302
|
const outBuffer = new Uint8Array(maxLength);
|
|
11105
|
-
const actualLen = this.textBufferViewGetSelectedText(view,
|
|
9303
|
+
const actualLen = this.textBufferViewGetSelectedText(view, ptr2(outBuffer), maxLength);
|
|
11106
9304
|
if (actualLen === 0) {
|
|
11107
9305
|
return null;
|
|
11108
9306
|
}
|
|
@@ -11110,7 +9308,7 @@ class FFIRenderLib {
|
|
|
11110
9308
|
}
|
|
11111
9309
|
textBufferViewGetPlainTextBytes(view, maxLength) {
|
|
11112
9310
|
const outBuffer = new Uint8Array(maxLength);
|
|
11113
|
-
const actualLen = this.textBufferViewGetPlainText(view,
|
|
9311
|
+
const actualLen = this.textBufferViewGetPlainText(view, ptr2(outBuffer), maxLength);
|
|
11114
9312
|
if (actualLen === 0) {
|
|
11115
9313
|
return null;
|
|
11116
9314
|
}
|
|
@@ -11124,7 +9322,7 @@ class FFIRenderLib {
|
|
|
11124
9322
|
}
|
|
11125
9323
|
textBufferViewMeasureForDimensions(view, width, height) {
|
|
11126
9324
|
const resultBuffer = new ArrayBuffer(MeasureResultStruct.size);
|
|
11127
|
-
const resultPtr =
|
|
9325
|
+
const resultPtr = ptr2(new Uint8Array(resultBuffer));
|
|
11128
9326
|
const success = this.opentui.symbols.textBufferViewMeasureForDimensions(view, width, height, resultPtr);
|
|
11129
9327
|
if (!success) {
|
|
11130
9328
|
return null;
|
|
@@ -11134,11 +9332,11 @@ class FFIRenderLib {
|
|
|
11134
9332
|
}
|
|
11135
9333
|
textBufferAddHighlightByCharRange(buffer, highlight) {
|
|
11136
9334
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11137
|
-
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer,
|
|
9335
|
+
this.opentui.symbols.textBufferAddHighlightByCharRange(buffer, ptr2(packedHighlight));
|
|
11138
9336
|
}
|
|
11139
9337
|
textBufferAddHighlight(buffer, lineIdx, highlight) {
|
|
11140
9338
|
const packedHighlight = HighlightStruct.pack(highlight);
|
|
11141
|
-
this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx,
|
|
9339
|
+
this.opentui.symbols.textBufferAddHighlight(buffer, lineIdx, ptr2(packedHighlight));
|
|
11142
9340
|
}
|
|
11143
9341
|
textBufferRemoveHighlightsByRef(buffer, hlRef) {
|
|
11144
9342
|
this.opentui.symbols.textBufferRemoveHighlightsByRef(buffer, hlRef);
|
|
@@ -11154,12 +9352,12 @@ class FFIRenderLib {
|
|
|
11154
9352
|
}
|
|
11155
9353
|
textBufferGetLineHighlights(buffer, lineIdx) {
|
|
11156
9354
|
const outCountBuf = new BigUint64Array(1);
|
|
11157
|
-
const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx,
|
|
9355
|
+
const nativePtr = this.opentui.symbols.textBufferGetLineHighlightsPtr(buffer, lineIdx, ptr2(outCountBuf));
|
|
11158
9356
|
if (!nativePtr)
|
|
11159
9357
|
return [];
|
|
11160
9358
|
const count = Number(outCountBuf[0]);
|
|
11161
9359
|
const byteLen = count * HighlightStruct.size;
|
|
11162
|
-
const raw =
|
|
9360
|
+
const raw = toArrayBuffer3(nativePtr, 0, byteLen);
|
|
11163
9361
|
const results = HighlightStruct.unpackList(raw, count);
|
|
11164
9362
|
this.opentui.symbols.textBufferFreeLineHighlights(nativePtr, count);
|
|
11165
9363
|
return results;
|
|
@@ -11195,7 +9393,7 @@ class FFIRenderLib {
|
|
|
11195
9393
|
const y = new Uint32Array(1);
|
|
11196
9394
|
const width = new Uint32Array(1);
|
|
11197
9395
|
const height = new Uint32Array(1);
|
|
11198
|
-
this.opentui.symbols.editorViewGetViewport(view,
|
|
9396
|
+
this.opentui.symbols.editorViewGetViewport(view, ptr2(x), ptr2(y), ptr2(width), ptr2(height));
|
|
11199
9397
|
return {
|
|
11200
9398
|
offsetX: x[0],
|
|
11201
9399
|
offsetY: y[0],
|
|
@@ -11225,7 +9423,7 @@ class FFIRenderLib {
|
|
|
11225
9423
|
}
|
|
11226
9424
|
editorViewGetLineInfo(view) {
|
|
11227
9425
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11228
|
-
this.opentui.symbols.editorViewGetLineInfoDirect(view,
|
|
9426
|
+
this.opentui.symbols.editorViewGetLineInfoDirect(view, ptr2(outBuffer));
|
|
11229
9427
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11230
9428
|
return {
|
|
11231
9429
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11237,7 +9435,7 @@ class FFIRenderLib {
|
|
|
11237
9435
|
}
|
|
11238
9436
|
editorViewGetLogicalLineInfo(view) {
|
|
11239
9437
|
const outBuffer = new ArrayBuffer(LineInfoStruct.size);
|
|
11240
|
-
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view,
|
|
9438
|
+
this.opentui.symbols.editorViewGetLogicalLineInfoDirect(view, ptr2(outBuffer));
|
|
11241
9439
|
const struct = LineInfoStruct.unpack(outBuffer);
|
|
11242
9440
|
return {
|
|
11243
9441
|
maxLineWidth: struct.maxWidth,
|
|
@@ -11266,7 +9464,7 @@ class FFIRenderLib {
|
|
|
11266
9464
|
}
|
|
11267
9465
|
editBufferGetText(buffer, maxLength) {
|
|
11268
9466
|
const outBuffer = new Uint8Array(maxLength);
|
|
11269
|
-
const actualLen = this.opentui.symbols.editBufferGetText(buffer,
|
|
9467
|
+
const actualLen = this.opentui.symbols.editBufferGetText(buffer, ptr2(outBuffer), maxLength);
|
|
11270
9468
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11271
9469
|
if (len === 0)
|
|
11272
9470
|
return null;
|
|
@@ -11321,7 +9519,7 @@ class FFIRenderLib {
|
|
|
11321
9519
|
}
|
|
11322
9520
|
editBufferGetCursorPosition(buffer) {
|
|
11323
9521
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
11324
|
-
this.opentui.symbols.editBufferGetCursorPosition(buffer,
|
|
9522
|
+
this.opentui.symbols.editBufferGetCursorPosition(buffer, ptr2(cursorBuffer));
|
|
11325
9523
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
11326
9524
|
}
|
|
11327
9525
|
editBufferGetId(buffer) {
|
|
@@ -11339,7 +9537,7 @@ class FFIRenderLib {
|
|
|
11339
9537
|
}
|
|
11340
9538
|
editBufferUndo(buffer, maxLength) {
|
|
11341
9539
|
const outBuffer = new Uint8Array(maxLength);
|
|
11342
|
-
const actualLen = this.opentui.symbols.editBufferUndo(buffer,
|
|
9540
|
+
const actualLen = this.opentui.symbols.editBufferUndo(buffer, ptr2(outBuffer), maxLength);
|
|
11343
9541
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11344
9542
|
if (len === 0)
|
|
11345
9543
|
return null;
|
|
@@ -11347,7 +9545,7 @@ class FFIRenderLib {
|
|
|
11347
9545
|
}
|
|
11348
9546
|
editBufferRedo(buffer, maxLength) {
|
|
11349
9547
|
const outBuffer = new Uint8Array(maxLength);
|
|
11350
|
-
const actualLen = this.opentui.symbols.editBufferRedo(buffer,
|
|
9548
|
+
const actualLen = this.opentui.symbols.editBufferRedo(buffer, ptr2(outBuffer), maxLength);
|
|
11351
9549
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11352
9550
|
if (len === 0)
|
|
11353
9551
|
return null;
|
|
@@ -11367,22 +9565,22 @@ class FFIRenderLib {
|
|
|
11367
9565
|
}
|
|
11368
9566
|
editBufferGetNextWordBoundary(buffer) {
|
|
11369
9567
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
11370
|
-
this.opentui.symbols.editBufferGetNextWordBoundary(buffer,
|
|
9568
|
+
this.opentui.symbols.editBufferGetNextWordBoundary(buffer, ptr2(cursorBuffer));
|
|
11371
9569
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
11372
9570
|
}
|
|
11373
9571
|
editBufferGetPrevWordBoundary(buffer) {
|
|
11374
9572
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
11375
|
-
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer,
|
|
9573
|
+
this.opentui.symbols.editBufferGetPrevWordBoundary(buffer, ptr2(cursorBuffer));
|
|
11376
9574
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
11377
9575
|
}
|
|
11378
9576
|
editBufferGetEOL(buffer) {
|
|
11379
9577
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
11380
|
-
this.opentui.symbols.editBufferGetEOL(buffer,
|
|
9578
|
+
this.opentui.symbols.editBufferGetEOL(buffer, ptr2(cursorBuffer));
|
|
11381
9579
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
11382
9580
|
}
|
|
11383
9581
|
editBufferOffsetToPosition(buffer, offset) {
|
|
11384
9582
|
const cursorBuffer = new ArrayBuffer(LogicalCursorStruct.size);
|
|
11385
|
-
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset,
|
|
9583
|
+
const success = this.opentui.symbols.editBufferOffsetToPosition(buffer, offset, ptr2(cursorBuffer));
|
|
11386
9584
|
if (!success)
|
|
11387
9585
|
return null;
|
|
11388
9586
|
return LogicalCursorStruct.unpack(cursorBuffer);
|
|
@@ -11395,7 +9593,7 @@ class FFIRenderLib {
|
|
|
11395
9593
|
}
|
|
11396
9594
|
editBufferGetTextRange(buffer, startOffset, endOffset, maxLength) {
|
|
11397
9595
|
const outBuffer = new Uint8Array(maxLength);
|
|
11398
|
-
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset,
|
|
9596
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRange(buffer, startOffset, endOffset, ptr2(outBuffer), maxLength);
|
|
11399
9597
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11400
9598
|
if (len === 0)
|
|
11401
9599
|
return null;
|
|
@@ -11403,7 +9601,7 @@ class FFIRenderLib {
|
|
|
11403
9601
|
}
|
|
11404
9602
|
editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, maxLength) {
|
|
11405
9603
|
const outBuffer = new Uint8Array(maxLength);
|
|
11406
|
-
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol,
|
|
9604
|
+
const actualLen = this.opentui.symbols.editBufferGetTextRangeByCoords(buffer, startRow, startCol, endRow, endCol, ptr2(outBuffer), maxLength);
|
|
11407
9605
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11408
9606
|
if (len === 0)
|
|
11409
9607
|
return null;
|
|
@@ -11436,7 +9634,7 @@ class FFIRenderLib {
|
|
|
11436
9634
|
}
|
|
11437
9635
|
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
11438
9636
|
const outBuffer = new Uint8Array(maxLength);
|
|
11439
|
-
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view,
|
|
9637
|
+
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, ptr2(outBuffer), maxLength);
|
|
11440
9638
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11441
9639
|
if (len === 0)
|
|
11442
9640
|
return null;
|
|
@@ -11445,12 +9643,12 @@ class FFIRenderLib {
|
|
|
11445
9643
|
editorViewGetCursor(view) {
|
|
11446
9644
|
const row = new Uint32Array(1);
|
|
11447
9645
|
const col = new Uint32Array(1);
|
|
11448
|
-
this.opentui.symbols.editorViewGetCursor(view,
|
|
9646
|
+
this.opentui.symbols.editorViewGetCursor(view, ptr2(row), ptr2(col));
|
|
11449
9647
|
return { row: row[0], col: col[0] };
|
|
11450
9648
|
}
|
|
11451
9649
|
editorViewGetText(view, maxLength) {
|
|
11452
9650
|
const outBuffer = new Uint8Array(maxLength);
|
|
11453
|
-
const actualLen = this.opentui.symbols.editorViewGetText(view,
|
|
9651
|
+
const actualLen = this.opentui.symbols.editorViewGetText(view, ptr2(outBuffer), maxLength);
|
|
11454
9652
|
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
11455
9653
|
if (len === 0)
|
|
11456
9654
|
return null;
|
|
@@ -11458,7 +9656,7 @@ class FFIRenderLib {
|
|
|
11458
9656
|
}
|
|
11459
9657
|
editorViewGetVisualCursor(view) {
|
|
11460
9658
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
11461
|
-
this.opentui.symbols.editorViewGetVisualCursor(view,
|
|
9659
|
+
this.opentui.symbols.editorViewGetVisualCursor(view, ptr2(cursorBuffer));
|
|
11462
9660
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
11463
9661
|
}
|
|
11464
9662
|
editorViewMoveUpVisual(view) {
|
|
@@ -11475,17 +9673,17 @@ class FFIRenderLib {
|
|
|
11475
9673
|
}
|
|
11476
9674
|
editorViewGetNextWordBoundary(view) {
|
|
11477
9675
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
11478
|
-
this.opentui.symbols.editorViewGetNextWordBoundary(view,
|
|
9676
|
+
this.opentui.symbols.editorViewGetNextWordBoundary(view, ptr2(cursorBuffer));
|
|
11479
9677
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
11480
9678
|
}
|
|
11481
9679
|
editorViewGetPrevWordBoundary(view) {
|
|
11482
9680
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
11483
|
-
this.opentui.symbols.editorViewGetPrevWordBoundary(view,
|
|
9681
|
+
this.opentui.symbols.editorViewGetPrevWordBoundary(view, ptr2(cursorBuffer));
|
|
11484
9682
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
11485
9683
|
}
|
|
11486
9684
|
editorViewGetEOL(view) {
|
|
11487
9685
|
const cursorBuffer = new ArrayBuffer(VisualCursorStruct.size);
|
|
11488
|
-
this.opentui.symbols.editorViewGetEOL(view,
|
|
9686
|
+
this.opentui.symbols.editorViewGetEOL(view, ptr2(cursorBuffer));
|
|
11489
9687
|
return VisualCursorStruct.unpack(cursorBuffer);
|
|
11490
9688
|
}
|
|
11491
9689
|
bufferPushScissorRect(buffer, x, y, width, height) {
|
|
@@ -11499,7 +9697,7 @@ class FFIRenderLib {
|
|
|
11499
9697
|
}
|
|
11500
9698
|
getTerminalCapabilities(renderer) {
|
|
11501
9699
|
const capsBuffer = new ArrayBuffer(TerminalCapabilitiesStruct.size);
|
|
11502
|
-
this.opentui.symbols.getTerminalCapabilities(renderer,
|
|
9700
|
+
this.opentui.symbols.getTerminalCapabilities(renderer, ptr2(capsBuffer));
|
|
11503
9701
|
const caps = TerminalCapabilitiesStruct.unpack(capsBuffer);
|
|
11504
9702
|
return {
|
|
11505
9703
|
kitty_keyboard: caps.kitty_keyboard,
|
|
@@ -11531,7 +9729,7 @@ class FFIRenderLib {
|
|
|
11531
9729
|
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
11532
9730
|
const outPtrBuffer = new ArrayBuffer(8);
|
|
11533
9731
|
const outLenBuffer = new ArrayBuffer(8);
|
|
11534
|
-
const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length,
|
|
9732
|
+
const success = this.opentui.symbols.encodeUnicode(textBytes, textBytes.length, ptr2(outPtrBuffer), ptr2(outLenBuffer), widthMethodCode);
|
|
11535
9733
|
if (!success) {
|
|
11536
9734
|
return null;
|
|
11537
9735
|
}
|
|
@@ -11543,7 +9741,7 @@ class FFIRenderLib {
|
|
|
11543
9741
|
return { ptr: resultPtr, data: [] };
|
|
11544
9742
|
}
|
|
11545
9743
|
const byteLen = resultLen * EncodedCharStruct.size;
|
|
11546
|
-
const raw =
|
|
9744
|
+
const raw = toArrayBuffer3(resultPtr, 0, byteLen);
|
|
11547
9745
|
const data = EncodedCharStruct.unpackList(raw, resultLen);
|
|
11548
9746
|
return { ptr: resultPtr, data };
|
|
11549
9747
|
}
|
|
@@ -11585,7 +9783,7 @@ class FFIRenderLib {
|
|
|
11585
9783
|
return;
|
|
11586
9784
|
}
|
|
11587
9785
|
const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
|
|
11588
|
-
this.opentui.symbols.editorViewSetPlaceholderStyledText(view,
|
|
9786
|
+
this.opentui.symbols.editorViewSetPlaceholderStyledText(view, ptr2(chunksBuffer), nonEmptyChunks.length);
|
|
11589
9787
|
}
|
|
11590
9788
|
editorViewSetTabIndicator(view, indicator) {
|
|
11591
9789
|
this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
|
|
@@ -11640,9 +9838,9 @@ class TextBuffer {
|
|
|
11640
9838
|
_textBytes;
|
|
11641
9839
|
_memId;
|
|
11642
9840
|
_appendedChunks = [];
|
|
11643
|
-
constructor(lib,
|
|
9841
|
+
constructor(lib, ptr3) {
|
|
11644
9842
|
this.lib = lib;
|
|
11645
|
-
this.bufferPtr =
|
|
9843
|
+
this.bufferPtr = ptr3;
|
|
11646
9844
|
}
|
|
11647
9845
|
static create(widthMethod) {
|
|
11648
9846
|
const lib = resolveRenderLib();
|
|
@@ -11824,8 +10022,8 @@ class TextBuffer {
|
|
|
11824
10022
|
}
|
|
11825
10023
|
|
|
11826
10024
|
// src/Renderable.ts
|
|
11827
|
-
var import_bun_yoga2 = __toESM(require_dist(), 1);
|
|
11828
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";
|
|
11829
10027
|
|
|
11830
10028
|
// src/lib/renderable.validations.ts
|
|
11831
10029
|
function validateOptions(id, options) {
|
|
@@ -11955,7 +10153,7 @@ class BaseRenderable extends EventEmitter6 {
|
|
|
11955
10153
|
this._visible = value;
|
|
11956
10154
|
}
|
|
11957
10155
|
}
|
|
11958
|
-
var yogaConfig =
|
|
10156
|
+
var yogaConfig = Yoga.Config.create();
|
|
11959
10157
|
yogaConfig.setUseWebDefaults(false);
|
|
11960
10158
|
yogaConfig.setPointScaleFactor(1);
|
|
11961
10159
|
|
|
@@ -12021,8 +10219,8 @@ class Renderable extends BaseRenderable {
|
|
|
12021
10219
|
this.buffered = options.buffered ?? false;
|
|
12022
10220
|
this._live = options.live ?? false;
|
|
12023
10221
|
this._liveCount = this._live && this._visible ? 1 : 0;
|
|
12024
|
-
this.yogaNode =
|
|
12025
|
-
this.yogaNode.setDisplay(this._visible ?
|
|
10222
|
+
this.yogaNode = Yoga.Node.create(yogaConfig);
|
|
10223
|
+
this.yogaNode.setDisplay(this._visible ? Display2.Flex : Display2.None);
|
|
12026
10224
|
this.setupYogaProperties(options);
|
|
12027
10225
|
this.applyEventOptions(options);
|
|
12028
10226
|
if (this.buffered) {
|
|
@@ -12057,7 +10255,7 @@ class Renderable extends BaseRenderable {
|
|
|
12057
10255
|
return;
|
|
12058
10256
|
const wasVisible = this._visible;
|
|
12059
10257
|
this._visible = value;
|
|
12060
|
-
this.yogaNode.setDisplay(value ?
|
|
10258
|
+
this.yogaNode.setDisplay(value ? Display2.Flex : Display2.None);
|
|
12061
10259
|
if (this._live) {
|
|
12062
10260
|
if (!wasVisible && value) {
|
|
12063
10261
|
this.propagateLiveCount(1);
|
|
@@ -12376,40 +10574,40 @@ class Renderable extends BaseRenderable {
|
|
|
12376
10574
|
setupMarginAndPadding(options) {
|
|
12377
10575
|
const node = this.yogaNode;
|
|
12378
10576
|
if (isMarginType(options.margin)) {
|
|
12379
|
-
node.setMargin(
|
|
12380
|
-
node.setMargin(
|
|
12381
|
-
node.setMargin(
|
|
12382
|
-
node.setMargin(
|
|
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);
|
|
12383
10581
|
}
|
|
12384
10582
|
if (isMarginType(options.marginTop)) {
|
|
12385
|
-
node.setMargin(
|
|
10583
|
+
node.setMargin(Edge2.Top, options.marginTop);
|
|
12386
10584
|
}
|
|
12387
10585
|
if (isMarginType(options.marginRight)) {
|
|
12388
|
-
node.setMargin(
|
|
10586
|
+
node.setMargin(Edge2.Right, options.marginRight);
|
|
12389
10587
|
}
|
|
12390
10588
|
if (isMarginType(options.marginBottom)) {
|
|
12391
|
-
node.setMargin(
|
|
10589
|
+
node.setMargin(Edge2.Bottom, options.marginBottom);
|
|
12392
10590
|
}
|
|
12393
10591
|
if (isMarginType(options.marginLeft)) {
|
|
12394
|
-
node.setMargin(
|
|
10592
|
+
node.setMargin(Edge2.Left, options.marginLeft);
|
|
12395
10593
|
}
|
|
12396
10594
|
if (isPaddingType(options.padding)) {
|
|
12397
|
-
node.setPadding(
|
|
12398
|
-
node.setPadding(
|
|
12399
|
-
node.setPadding(
|
|
12400
|
-
node.setPadding(
|
|
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);
|
|
12401
10599
|
}
|
|
12402
10600
|
if (isPaddingType(options.paddingTop)) {
|
|
12403
|
-
node.setPadding(
|
|
10601
|
+
node.setPadding(Edge2.Top, options.paddingTop);
|
|
12404
10602
|
}
|
|
12405
10603
|
if (isPaddingType(options.paddingRight)) {
|
|
12406
|
-
node.setPadding(
|
|
10604
|
+
node.setPadding(Edge2.Right, options.paddingRight);
|
|
12407
10605
|
}
|
|
12408
10606
|
if (isPaddingType(options.paddingBottom)) {
|
|
12409
|
-
node.setPadding(
|
|
10607
|
+
node.setPadding(Edge2.Bottom, options.paddingBottom);
|
|
12410
10608
|
}
|
|
12411
10609
|
if (isPaddingType(options.paddingLeft)) {
|
|
12412
|
-
node.setPadding(
|
|
10610
|
+
node.setPadding(Edge2.Left, options.paddingLeft);
|
|
12413
10611
|
}
|
|
12414
10612
|
}
|
|
12415
10613
|
set position(positionType) {
|
|
@@ -12438,30 +10636,30 @@ class Renderable extends BaseRenderable {
|
|
|
12438
10636
|
const { top, right, bottom, left } = position;
|
|
12439
10637
|
if (isPositionType(top)) {
|
|
12440
10638
|
if (top === "auto") {
|
|
12441
|
-
node.setPositionAuto(
|
|
10639
|
+
node.setPositionAuto(Edge2.Top);
|
|
12442
10640
|
} else {
|
|
12443
|
-
node.setPosition(
|
|
10641
|
+
node.setPosition(Edge2.Top, top);
|
|
12444
10642
|
}
|
|
12445
10643
|
}
|
|
12446
10644
|
if (isPositionType(right)) {
|
|
12447
10645
|
if (right === "auto") {
|
|
12448
|
-
node.setPositionAuto(
|
|
10646
|
+
node.setPositionAuto(Edge2.Right);
|
|
12449
10647
|
} else {
|
|
12450
|
-
node.setPosition(
|
|
10648
|
+
node.setPosition(Edge2.Right, right);
|
|
12451
10649
|
}
|
|
12452
10650
|
}
|
|
12453
10651
|
if (isPositionType(bottom)) {
|
|
12454
10652
|
if (bottom === "auto") {
|
|
12455
|
-
node.setPositionAuto(
|
|
10653
|
+
node.setPositionAuto(Edge2.Bottom);
|
|
12456
10654
|
} else {
|
|
12457
|
-
node.setPosition(
|
|
10655
|
+
node.setPosition(Edge2.Bottom, bottom);
|
|
12458
10656
|
}
|
|
12459
10657
|
}
|
|
12460
10658
|
if (isPositionType(left)) {
|
|
12461
10659
|
if (left === "auto") {
|
|
12462
|
-
node.setPositionAuto(
|
|
10660
|
+
node.setPositionAuto(Edge2.Left);
|
|
12463
10661
|
} else {
|
|
12464
|
-
node.setPosition(
|
|
10662
|
+
node.setPosition(Edge2.Left, left);
|
|
12465
10663
|
}
|
|
12466
10664
|
}
|
|
12467
10665
|
this.requestRender();
|
|
@@ -12533,68 +10731,68 @@ class Renderable extends BaseRenderable {
|
|
|
12533
10731
|
set margin(margin) {
|
|
12534
10732
|
if (isMarginType(margin)) {
|
|
12535
10733
|
const node = this.yogaNode;
|
|
12536
|
-
node.setMargin(
|
|
12537
|
-
node.setMargin(
|
|
12538
|
-
node.setMargin(
|
|
12539
|
-
node.setMargin(
|
|
10734
|
+
node.setMargin(Edge2.Top, margin);
|
|
10735
|
+
node.setMargin(Edge2.Right, margin);
|
|
10736
|
+
node.setMargin(Edge2.Bottom, margin);
|
|
10737
|
+
node.setMargin(Edge2.Left, margin);
|
|
12540
10738
|
this.requestRender();
|
|
12541
10739
|
}
|
|
12542
10740
|
}
|
|
12543
10741
|
set marginTop(margin) {
|
|
12544
10742
|
if (isMarginType(margin)) {
|
|
12545
|
-
this.yogaNode.setMargin(
|
|
10743
|
+
this.yogaNode.setMargin(Edge2.Top, margin);
|
|
12546
10744
|
this.requestRender();
|
|
12547
10745
|
}
|
|
12548
10746
|
}
|
|
12549
10747
|
set marginRight(margin) {
|
|
12550
10748
|
if (isMarginType(margin)) {
|
|
12551
|
-
this.yogaNode.setMargin(
|
|
10749
|
+
this.yogaNode.setMargin(Edge2.Right, margin);
|
|
12552
10750
|
this.requestRender();
|
|
12553
10751
|
}
|
|
12554
10752
|
}
|
|
12555
10753
|
set marginBottom(margin) {
|
|
12556
10754
|
if (isMarginType(margin)) {
|
|
12557
|
-
this.yogaNode.setMargin(
|
|
10755
|
+
this.yogaNode.setMargin(Edge2.Bottom, margin);
|
|
12558
10756
|
this.requestRender();
|
|
12559
10757
|
}
|
|
12560
10758
|
}
|
|
12561
10759
|
set marginLeft(margin) {
|
|
12562
10760
|
if (isMarginType(margin)) {
|
|
12563
|
-
this.yogaNode.setMargin(
|
|
10761
|
+
this.yogaNode.setMargin(Edge2.Left, margin);
|
|
12564
10762
|
this.requestRender();
|
|
12565
10763
|
}
|
|
12566
10764
|
}
|
|
12567
10765
|
set padding(padding) {
|
|
12568
10766
|
if (isPaddingType(padding)) {
|
|
12569
10767
|
const node = this.yogaNode;
|
|
12570
|
-
node.setPadding(
|
|
12571
|
-
node.setPadding(
|
|
12572
|
-
node.setPadding(
|
|
12573
|
-
node.setPadding(
|
|
10768
|
+
node.setPadding(Edge2.Top, padding);
|
|
10769
|
+
node.setPadding(Edge2.Right, padding);
|
|
10770
|
+
node.setPadding(Edge2.Bottom, padding);
|
|
10771
|
+
node.setPadding(Edge2.Left, padding);
|
|
12574
10772
|
this.requestRender();
|
|
12575
10773
|
}
|
|
12576
10774
|
}
|
|
12577
10775
|
set paddingTop(padding) {
|
|
12578
10776
|
if (isPaddingType(padding)) {
|
|
12579
|
-
this.yogaNode.setPadding(
|
|
10777
|
+
this.yogaNode.setPadding(Edge2.Top, padding);
|
|
12580
10778
|
this.requestRender();
|
|
12581
10779
|
}
|
|
12582
10780
|
}
|
|
12583
10781
|
set paddingRight(padding) {
|
|
12584
10782
|
if (isPaddingType(padding)) {
|
|
12585
|
-
this.yogaNode.setPadding(
|
|
10783
|
+
this.yogaNode.setPadding(Edge2.Right, padding);
|
|
12586
10784
|
this.requestRender();
|
|
12587
10785
|
}
|
|
12588
10786
|
}
|
|
12589
10787
|
set paddingBottom(padding) {
|
|
12590
10788
|
if (isPaddingType(padding)) {
|
|
12591
|
-
this.yogaNode.setPadding(
|
|
10789
|
+
this.yogaNode.setPadding(Edge2.Bottom, padding);
|
|
12592
10790
|
this.requestRender();
|
|
12593
10791
|
}
|
|
12594
10792
|
}
|
|
12595
10793
|
set paddingLeft(padding) {
|
|
12596
10794
|
if (isPaddingType(padding)) {
|
|
12597
|
-
this.yogaNode.setPadding(
|
|
10795
|
+
this.yogaNode.setPadding(Edge2.Left, padding);
|
|
12598
10796
|
this.requestRender();
|
|
12599
10797
|
}
|
|
12600
10798
|
}
|
|
@@ -13010,10 +11208,10 @@ class RootRenderable extends Renderable {
|
|
|
13010
11208
|
if (this.yogaNode) {
|
|
13011
11209
|
this.yogaNode.free();
|
|
13012
11210
|
}
|
|
13013
|
-
this.yogaNode =
|
|
11211
|
+
this.yogaNode = Yoga.Node.create(yogaConfig);
|
|
13014
11212
|
this.yogaNode.setWidth(ctx.width);
|
|
13015
11213
|
this.yogaNode.setHeight(ctx.height);
|
|
13016
|
-
this.yogaNode.setFlexDirection(
|
|
11214
|
+
this.yogaNode.setFlexDirection(FlexDirection2.Column);
|
|
13017
11215
|
this.calculateLayout();
|
|
13018
11216
|
}
|
|
13019
11217
|
render(buffer, deltaTime) {
|
|
@@ -13054,7 +11252,7 @@ class RootRenderable extends Renderable {
|
|
|
13054
11252
|
}
|
|
13055
11253
|
}
|
|
13056
11254
|
calculateLayout() {
|
|
13057
|
-
this.yogaNode.calculateLayout(this.width, this.height,
|
|
11255
|
+
this.yogaNode.calculateLayout(this.width, this.height, Direction2.LTR);
|
|
13058
11256
|
this.emit("layout-changed" /* LAYOUT_CHANGED */);
|
|
13059
11257
|
}
|
|
13060
11258
|
resize(width, height) {
|
|
@@ -15380,7 +13578,7 @@ Captured output:
|
|
|
15380
13578
|
}
|
|
15381
13579
|
}
|
|
15382
13580
|
|
|
15383
|
-
export {
|
|
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 };
|
|
15384
13582
|
|
|
15385
|
-
//# debugId=
|
|
15386
|
-
//# sourceMappingURL=index-
|
|
13583
|
+
//# debugId=D2D576D668A923C064756E2164756E21
|
|
13584
|
+
//# sourceMappingURL=index-x5bb5xvn.js.map
|