@simonklee/yoga 0.2.24
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/README.md +87 -0
- package/dist/darwin-arm64/libyoga.dylib +0 -0
- package/dist/darwin-x64/libyoga.dylib +0 -0
- package/dist/index.d.ts +575 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1502 -0
- package/dist/linux-arm64/libyoga.so +0 -0
- package/dist/linux-x64/libyoga.so +0 -0
- package/dist/windows-x64/yoga.dll +0 -0
- package/package.json +43 -0
- package/src/index.test.ts +939 -0
- package/src/index.ts +1648 -0
- package/src/yoga_ffi.zig +1324 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,1648 @@
|
|
|
1
|
+
import { dlopen, suffix, JSCallback, FFIType, type Pointer } from "bun:ffi";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
|
|
5
|
+
// Import native libraries with { type: "file" } for bun compile support
|
|
6
|
+
// This tells Bun to embed the file and return a real filesystem path
|
|
7
|
+
// Using top-level await import() to load only the current platform's library
|
|
8
|
+
const embeddedLib: string | undefined = await (async () => {
|
|
9
|
+
try {
|
|
10
|
+
if (process.platform === "darwin" && process.arch === "arm64") {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
return (await import("../dist/darwin-arm64/libyoga.dylib", { with: { type: "file" } })).default;
|
|
13
|
+
} else if (process.platform === "darwin" && process.arch === "x64") {
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
return (await import("../dist/darwin-x64/libyoga.dylib", { with: { type: "file" } })).default;
|
|
16
|
+
} else if (process.platform === "linux" && process.arch === "x64") {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
return (await import("../dist/linux-x64/libyoga.so", { with: { type: "file" } })).default;
|
|
19
|
+
} else if (process.platform === "linux" && process.arch === "arm64") {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
return (await import("../dist/linux-arm64/libyoga.so", { with: { type: "file" } })).default;
|
|
22
|
+
} else if (process.platform === "win32") {
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
return (await import("../dist/windows-x64/yoga.dll", { with: { type: "file" } })).default;
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
// Library not found for this platform
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
})();
|
|
31
|
+
|
|
32
|
+
function getLibPath(): string {
|
|
33
|
+
// Check local development path (zig-out) first for development
|
|
34
|
+
if (process.platform === "win32") {
|
|
35
|
+
if (existsSync(join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`))) {
|
|
36
|
+
return join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`);
|
|
37
|
+
}
|
|
38
|
+
if (existsSync(join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`))) {
|
|
39
|
+
return join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (existsSync(join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`))) {
|
|
43
|
+
return join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Check embedded libraries (for bun compile)
|
|
48
|
+
if (embeddedLib && existsSync(embeddedLib)) {
|
|
49
|
+
return embeddedLib;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Could not find native library. ` +
|
|
54
|
+
`Platform: ${process.platform}-${process.arch}\n` +
|
|
55
|
+
`Make sure to run 'zig build' or install the package with binaries.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Yoga enum definitions
|
|
60
|
+
export const Align = {
|
|
61
|
+
Auto: 0,
|
|
62
|
+
FlexStart: 1,
|
|
63
|
+
Center: 2,
|
|
64
|
+
FlexEnd: 3,
|
|
65
|
+
Stretch: 4,
|
|
66
|
+
Baseline: 5,
|
|
67
|
+
SpaceBetween: 6,
|
|
68
|
+
SpaceAround: 7,
|
|
69
|
+
SpaceEvenly: 8,
|
|
70
|
+
} as const;
|
|
71
|
+
export type Align = (typeof Align)[keyof typeof Align];
|
|
72
|
+
|
|
73
|
+
export const BoxSizing = {
|
|
74
|
+
BorderBox: 0,
|
|
75
|
+
ContentBox: 1,
|
|
76
|
+
} as const;
|
|
77
|
+
export type BoxSizing = (typeof BoxSizing)[keyof typeof BoxSizing];
|
|
78
|
+
|
|
79
|
+
export const Dimension = {
|
|
80
|
+
Width: 0,
|
|
81
|
+
Height: 1,
|
|
82
|
+
} as const;
|
|
83
|
+
export type Dimension = (typeof Dimension)[keyof typeof Dimension];
|
|
84
|
+
|
|
85
|
+
export const Direction = {
|
|
86
|
+
Inherit: 0,
|
|
87
|
+
LTR: 1,
|
|
88
|
+
RTL: 2,
|
|
89
|
+
} as const;
|
|
90
|
+
export type Direction = (typeof Direction)[keyof typeof Direction];
|
|
91
|
+
|
|
92
|
+
export const Display = {
|
|
93
|
+
Flex: 0,
|
|
94
|
+
None: 1,
|
|
95
|
+
Contents: 2,
|
|
96
|
+
} as const;
|
|
97
|
+
export type Display = (typeof Display)[keyof typeof Display];
|
|
98
|
+
|
|
99
|
+
export const Edge = {
|
|
100
|
+
Left: 0,
|
|
101
|
+
Top: 1,
|
|
102
|
+
Right: 2,
|
|
103
|
+
Bottom: 3,
|
|
104
|
+
Start: 4,
|
|
105
|
+
End: 5,
|
|
106
|
+
Horizontal: 6,
|
|
107
|
+
Vertical: 7,
|
|
108
|
+
All: 8,
|
|
109
|
+
} as const;
|
|
110
|
+
export type Edge = (typeof Edge)[keyof typeof Edge];
|
|
111
|
+
|
|
112
|
+
export const Errata = {
|
|
113
|
+
None: 0,
|
|
114
|
+
StretchFlexBasis: 1,
|
|
115
|
+
AbsolutePositionWithoutInsetsExcludesPadding: 2,
|
|
116
|
+
AbsolutePercentAgainstInnerSize: 4,
|
|
117
|
+
All: 2147483647,
|
|
118
|
+
Classic: 2147483646,
|
|
119
|
+
} as const;
|
|
120
|
+
export type Errata = (typeof Errata)[keyof typeof Errata];
|
|
121
|
+
|
|
122
|
+
export const ExperimentalFeature = {
|
|
123
|
+
WebFlexBasis: 0,
|
|
124
|
+
} as const;
|
|
125
|
+
export type ExperimentalFeature =
|
|
126
|
+
(typeof ExperimentalFeature)[keyof typeof ExperimentalFeature];
|
|
127
|
+
|
|
128
|
+
export const FlexDirection = {
|
|
129
|
+
Column: 0,
|
|
130
|
+
ColumnReverse: 1,
|
|
131
|
+
Row: 2,
|
|
132
|
+
RowReverse: 3,
|
|
133
|
+
} as const;
|
|
134
|
+
export type FlexDirection = (typeof FlexDirection)[keyof typeof FlexDirection];
|
|
135
|
+
|
|
136
|
+
export const Gutter = {
|
|
137
|
+
Column: 0,
|
|
138
|
+
Row: 1,
|
|
139
|
+
All: 2,
|
|
140
|
+
} as const;
|
|
141
|
+
export type Gutter = (typeof Gutter)[keyof typeof Gutter];
|
|
142
|
+
|
|
143
|
+
export const Justify = {
|
|
144
|
+
FlexStart: 0,
|
|
145
|
+
Center: 1,
|
|
146
|
+
FlexEnd: 2,
|
|
147
|
+
SpaceBetween: 3,
|
|
148
|
+
SpaceAround: 4,
|
|
149
|
+
SpaceEvenly: 5,
|
|
150
|
+
} as const;
|
|
151
|
+
export type Justify = (typeof Justify)[keyof typeof Justify];
|
|
152
|
+
|
|
153
|
+
export const LogLevel = {
|
|
154
|
+
Error: 0,
|
|
155
|
+
Warn: 1,
|
|
156
|
+
Info: 2,
|
|
157
|
+
Debug: 3,
|
|
158
|
+
Verbose: 4,
|
|
159
|
+
Fatal: 5,
|
|
160
|
+
} as const;
|
|
161
|
+
export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
162
|
+
|
|
163
|
+
export const MeasureMode = {
|
|
164
|
+
Undefined: 0,
|
|
165
|
+
Exactly: 1,
|
|
166
|
+
AtMost: 2,
|
|
167
|
+
} as const;
|
|
168
|
+
export type MeasureMode = (typeof MeasureMode)[keyof typeof MeasureMode];
|
|
169
|
+
|
|
170
|
+
export const NodeType = {
|
|
171
|
+
Default: 0,
|
|
172
|
+
Text: 1,
|
|
173
|
+
} as const;
|
|
174
|
+
export type NodeType = (typeof NodeType)[keyof typeof NodeType];
|
|
175
|
+
|
|
176
|
+
export const Overflow = {
|
|
177
|
+
Visible: 0,
|
|
178
|
+
Hidden: 1,
|
|
179
|
+
Scroll: 2,
|
|
180
|
+
} as const;
|
|
181
|
+
export type Overflow = (typeof Overflow)[keyof typeof Overflow];
|
|
182
|
+
|
|
183
|
+
export const PositionType = {
|
|
184
|
+
Static: 0,
|
|
185
|
+
Relative: 1,
|
|
186
|
+
Absolute: 2,
|
|
187
|
+
} as const;
|
|
188
|
+
export type PositionType = (typeof PositionType)[keyof typeof PositionType];
|
|
189
|
+
|
|
190
|
+
export const Unit = {
|
|
191
|
+
Undefined: 0,
|
|
192
|
+
Point: 1,
|
|
193
|
+
Percent: 2,
|
|
194
|
+
Auto: 3,
|
|
195
|
+
MaxContent: 4,
|
|
196
|
+
FitContent: 5,
|
|
197
|
+
Stretch: 6,
|
|
198
|
+
} as const;
|
|
199
|
+
export type Unit = (typeof Unit)[keyof typeof Unit];
|
|
200
|
+
|
|
201
|
+
export const Wrap = {
|
|
202
|
+
NoWrap: 0,
|
|
203
|
+
Wrap: 1,
|
|
204
|
+
WrapReverse: 2,
|
|
205
|
+
} as const;
|
|
206
|
+
export type Wrap = (typeof Wrap)[keyof typeof Wrap];
|
|
207
|
+
|
|
208
|
+
// Constants for yoga-layout compatibility
|
|
209
|
+
export const EDGE_LEFT = Edge.Left;
|
|
210
|
+
export const EDGE_TOP = Edge.Top;
|
|
211
|
+
export const EDGE_RIGHT = Edge.Right;
|
|
212
|
+
export const EDGE_BOTTOM = Edge.Bottom;
|
|
213
|
+
export const EDGE_START = Edge.Start;
|
|
214
|
+
export const EDGE_END = Edge.End;
|
|
215
|
+
export const EDGE_HORIZONTAL = Edge.Horizontal;
|
|
216
|
+
export const EDGE_VERTICAL = Edge.Vertical;
|
|
217
|
+
export const EDGE_ALL = Edge.All;
|
|
218
|
+
|
|
219
|
+
export const GUTTER_COLUMN = Gutter.Column;
|
|
220
|
+
export const GUTTER_ROW = Gutter.Row;
|
|
221
|
+
export const GUTTER_ALL = Gutter.All;
|
|
222
|
+
|
|
223
|
+
export const FLEX_DIRECTION_COLUMN = FlexDirection.Column;
|
|
224
|
+
export const FLEX_DIRECTION_COLUMN_REVERSE = FlexDirection.ColumnReverse;
|
|
225
|
+
export const FLEX_DIRECTION_ROW = FlexDirection.Row;
|
|
226
|
+
export const FLEX_DIRECTION_ROW_REVERSE = FlexDirection.RowReverse;
|
|
227
|
+
|
|
228
|
+
export const JUSTIFY_FLEX_START = Justify.FlexStart;
|
|
229
|
+
export const JUSTIFY_CENTER = Justify.Center;
|
|
230
|
+
export const JUSTIFY_FLEX_END = Justify.FlexEnd;
|
|
231
|
+
export const JUSTIFY_SPACE_BETWEEN = Justify.SpaceBetween;
|
|
232
|
+
export const JUSTIFY_SPACE_AROUND = Justify.SpaceAround;
|
|
233
|
+
export const JUSTIFY_SPACE_EVENLY = Justify.SpaceEvenly;
|
|
234
|
+
|
|
235
|
+
export const ALIGN_AUTO = Align.Auto;
|
|
236
|
+
export const ALIGN_FLEX_START = Align.FlexStart;
|
|
237
|
+
export const ALIGN_CENTER = Align.Center;
|
|
238
|
+
export const ALIGN_FLEX_END = Align.FlexEnd;
|
|
239
|
+
export const ALIGN_STRETCH = Align.Stretch;
|
|
240
|
+
export const ALIGN_BASELINE = Align.Baseline;
|
|
241
|
+
export const ALIGN_SPACE_BETWEEN = Align.SpaceBetween;
|
|
242
|
+
export const ALIGN_SPACE_AROUND = Align.SpaceAround;
|
|
243
|
+
export const ALIGN_SPACE_EVENLY = Align.SpaceEvenly;
|
|
244
|
+
|
|
245
|
+
export const WRAP_NO_WRAP = Wrap.NoWrap;
|
|
246
|
+
export const WRAP_WRAP = Wrap.Wrap;
|
|
247
|
+
export const WRAP_WRAP_REVERSE = Wrap.WrapReverse;
|
|
248
|
+
|
|
249
|
+
export const OVERFLOW_VISIBLE = Overflow.Visible;
|
|
250
|
+
export const OVERFLOW_HIDDEN = Overflow.Hidden;
|
|
251
|
+
export const OVERFLOW_SCROLL = Overflow.Scroll;
|
|
252
|
+
|
|
253
|
+
export const DISPLAY_FLEX = Display.Flex;
|
|
254
|
+
export const DISPLAY_NONE = Display.None;
|
|
255
|
+
export const DISPLAY_CONTENTS = Display.Contents;
|
|
256
|
+
|
|
257
|
+
export const BOX_SIZING_BORDER_BOX = BoxSizing.BorderBox;
|
|
258
|
+
export const BOX_SIZING_CONTENT_BOX = BoxSizing.ContentBox;
|
|
259
|
+
|
|
260
|
+
export const DIMENSION_WIDTH = Dimension.Width;
|
|
261
|
+
export const DIMENSION_HEIGHT = Dimension.Height;
|
|
262
|
+
|
|
263
|
+
export const POSITION_TYPE_STATIC = PositionType.Static;
|
|
264
|
+
export const POSITION_TYPE_RELATIVE = PositionType.Relative;
|
|
265
|
+
export const POSITION_TYPE_ABSOLUTE = PositionType.Absolute;
|
|
266
|
+
|
|
267
|
+
export const DIRECTION_INHERIT = Direction.Inherit;
|
|
268
|
+
export const DIRECTION_LTR = Direction.LTR;
|
|
269
|
+
export const DIRECTION_RTL = Direction.RTL;
|
|
270
|
+
|
|
271
|
+
export const UNIT_UNDEFINED = Unit.Undefined;
|
|
272
|
+
export const UNIT_POINT = Unit.Point;
|
|
273
|
+
export const UNIT_PERCENT = Unit.Percent;
|
|
274
|
+
export const UNIT_AUTO = Unit.Auto;
|
|
275
|
+
export const UNIT_MAX_CONTENT = Unit.MaxContent;
|
|
276
|
+
export const UNIT_FIT_CONTENT = Unit.FitContent;
|
|
277
|
+
export const UNIT_STRETCH = Unit.Stretch;
|
|
278
|
+
|
|
279
|
+
export const MEASURE_MODE_UNDEFINED = MeasureMode.Undefined;
|
|
280
|
+
export const MEASURE_MODE_EXACTLY = MeasureMode.Exactly;
|
|
281
|
+
export const MEASURE_MODE_AT_MOST = MeasureMode.AtMost;
|
|
282
|
+
|
|
283
|
+
export const NODE_TYPE_DEFAULT = NodeType.Default;
|
|
284
|
+
export const NODE_TYPE_TEXT = NodeType.Text;
|
|
285
|
+
|
|
286
|
+
export const LOG_LEVEL_ERROR = LogLevel.Error;
|
|
287
|
+
export const LOG_LEVEL_WARN = LogLevel.Warn;
|
|
288
|
+
export const LOG_LEVEL_INFO = LogLevel.Info;
|
|
289
|
+
export const LOG_LEVEL_DEBUG = LogLevel.Debug;
|
|
290
|
+
export const LOG_LEVEL_VERBOSE = LogLevel.Verbose;
|
|
291
|
+
export const LOG_LEVEL_FATAL = LogLevel.Fatal;
|
|
292
|
+
|
|
293
|
+
export const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS = ExperimentalFeature.WebFlexBasis;
|
|
294
|
+
|
|
295
|
+
export const ERRATA_NONE = Errata.None;
|
|
296
|
+
export const ERRATA_STRETCH_FLEX_BASIS = Errata.StretchFlexBasis;
|
|
297
|
+
export const ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING = Errata.AbsolutePositionWithoutInsetsExcludesPadding;
|
|
298
|
+
export const ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE = Errata.AbsolutePercentAgainstInnerSize;
|
|
299
|
+
export const ERRATA_ALL = Errata.All;
|
|
300
|
+
export const ERRATA_CLASSIC = Errata.Classic;
|
|
301
|
+
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// Value type for yoga-layout compatibility
|
|
304
|
+
// ============================================================================
|
|
305
|
+
|
|
306
|
+
export type Value = {
|
|
307
|
+
unit: Unit;
|
|
308
|
+
value: number;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// Helper to parse value strings like "auto", "50%", or numbers
|
|
312
|
+
type ValueInput = number | "auto" | `${number}%` | undefined;
|
|
313
|
+
type ValueInputWithAuto = number | "auto" | `${number}%` | undefined;
|
|
314
|
+
type ValueInputNoAuto = number | `${number}%` | undefined;
|
|
315
|
+
|
|
316
|
+
function parseValue(value: ValueInput): {
|
|
317
|
+
unit: Unit;
|
|
318
|
+
asNumber: number | undefined;
|
|
319
|
+
} {
|
|
320
|
+
if (value === undefined) {
|
|
321
|
+
return { unit: Unit.Undefined, asNumber: undefined };
|
|
322
|
+
}
|
|
323
|
+
if (value === "auto") {
|
|
324
|
+
return { unit: Unit.Auto, asNumber: undefined };
|
|
325
|
+
}
|
|
326
|
+
if (typeof value === "string" && value.endsWith("%")) {
|
|
327
|
+
return { unit: Unit.Percent, asNumber: parseFloat(value) };
|
|
328
|
+
}
|
|
329
|
+
return { unit: Unit.Point, asNumber: value as number };
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Default value for freed nodes (matches yoga-layout behavior)
|
|
333
|
+
const UNDEFINED_VALUE: Value = { unit: Unit.Undefined, value: NaN };
|
|
334
|
+
|
|
335
|
+
// Helper to unpack Value from u64 (lower 32 bits = unit, upper 32 bits = value as f32 bits)
|
|
336
|
+
function unpackValue(packed: number | bigint): Value {
|
|
337
|
+
const p = BigInt(packed);
|
|
338
|
+
const unit = Number(p & 0xffffffffn) as Unit;
|
|
339
|
+
const valueBits = Number((p >> 32n) & 0xffffffffn);
|
|
340
|
+
// Convert u32 bits back to f32
|
|
341
|
+
const buffer = new ArrayBuffer(4);
|
|
342
|
+
const view = new DataView(buffer);
|
|
343
|
+
view.setUint32(0, valueBits, true);
|
|
344
|
+
const value = view.getFloat32(0, true);
|
|
345
|
+
return { unit, value };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Load the library
|
|
349
|
+
const lib = dlopen(getLibPath(), {
|
|
350
|
+
// Config functions
|
|
351
|
+
ygConfigNew: { args: [], returns: "ptr" },
|
|
352
|
+
ygConfigFree: { args: ["ptr"], returns: "void" },
|
|
353
|
+
ygConfigGetDefault: { args: [], returns: "ptr" },
|
|
354
|
+
ygConfigSetUseWebDefaults: { args: ["ptr", "bool"], returns: "void" },
|
|
355
|
+
ygConfigGetUseWebDefaults: { args: ["ptr"], returns: "bool" },
|
|
356
|
+
ygConfigSetPointScaleFactor: { args: ["ptr", "f32"], returns: "void" },
|
|
357
|
+
ygConfigGetPointScaleFactor: { args: ["ptr"], returns: "f32" },
|
|
358
|
+
ygConfigSetErrata: { args: ["ptr", "i32"], returns: "void" },
|
|
359
|
+
ygConfigGetErrata: { args: ["ptr"], returns: "i32" },
|
|
360
|
+
ygConfigSetExperimentalFeatureEnabled: {
|
|
361
|
+
args: ["ptr", "i32", "bool"],
|
|
362
|
+
returns: "void",
|
|
363
|
+
},
|
|
364
|
+
ygConfigIsExperimentalFeatureEnabled: {
|
|
365
|
+
args: ["ptr", "i32"],
|
|
366
|
+
returns: "bool",
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
// Node creation and management
|
|
370
|
+
ygNodeNew: { args: [], returns: "ptr" },
|
|
371
|
+
ygNodeNewWithConfig: { args: ["ptr"], returns: "ptr" },
|
|
372
|
+
ygNodeClone: { args: ["ptr"], returns: "ptr" },
|
|
373
|
+
ygNodeFree: { args: ["ptr"], returns: "void" },
|
|
374
|
+
ygNodeFreeRecursive: { args: ["ptr"], returns: "void" },
|
|
375
|
+
ygNodeReset: { args: ["ptr"], returns: "void" },
|
|
376
|
+
ygNodeCopyStyle: { args: ["ptr", "ptr"], returns: "void" },
|
|
377
|
+
ygNodeSetIsReferenceBaseline: { args: ["ptr", "bool"], returns: "void" },
|
|
378
|
+
ygNodeIsReferenceBaseline: { args: ["ptr"], returns: "bool" },
|
|
379
|
+
ygNodeSetAlwaysFormsContainingBlock: {
|
|
380
|
+
args: ["ptr", "bool"],
|
|
381
|
+
returns: "void",
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
// Node hierarchy management
|
|
385
|
+
ygNodeInsertChild: { args: ["ptr", "ptr", "u64"], returns: "void" },
|
|
386
|
+
ygNodeRemoveChild: { args: ["ptr", "ptr"], returns: "void" },
|
|
387
|
+
ygNodeRemoveAllChildren: { args: ["ptr"], returns: "void" },
|
|
388
|
+
ygNodeGetChild: { args: ["ptr", "u64"], returns: "ptr" },
|
|
389
|
+
ygNodeGetChildCount: { args: ["ptr"], returns: "u64" },
|
|
390
|
+
ygNodeGetParent: { args: ["ptr"], returns: "ptr" },
|
|
391
|
+
|
|
392
|
+
// Layout calculation
|
|
393
|
+
ygNodeCalculateLayout: { args: ["ptr", "f32", "f32", "i32"], returns: "void" },
|
|
394
|
+
ygNodeGetHasNewLayout: { args: ["ptr"], returns: "bool" },
|
|
395
|
+
ygNodeSetHasNewLayout: { args: ["ptr", "bool"], returns: "void" },
|
|
396
|
+
ygNodeMarkDirty: { args: ["ptr"], returns: "void" },
|
|
397
|
+
ygNodeIsDirty: { args: ["ptr"], returns: "bool" },
|
|
398
|
+
|
|
399
|
+
// Layout result access
|
|
400
|
+
ygNodeLayoutGetLeft: { args: ["ptr"], returns: "f32" },
|
|
401
|
+
ygNodeLayoutGetTop: { args: ["ptr"], returns: "f32" },
|
|
402
|
+
ygNodeLayoutGetRight: { args: ["ptr"], returns: "f32" },
|
|
403
|
+
ygNodeLayoutGetBottom: { args: ["ptr"], returns: "f32" },
|
|
404
|
+
ygNodeLayoutGetWidth: { args: ["ptr"], returns: "f32" },
|
|
405
|
+
ygNodeLayoutGetHeight: { args: ["ptr"], returns: "f32" },
|
|
406
|
+
ygNodeLayoutGetBorder: { args: ["ptr", "i32"], returns: "f32" },
|
|
407
|
+
ygNodeLayoutGetMargin: { args: ["ptr", "i32"], returns: "f32" },
|
|
408
|
+
ygNodeLayoutGetPadding: { args: ["ptr", "i32"], returns: "f32" },
|
|
409
|
+
ygNodeLayoutGetRawWidth: { args: ["ptr"], returns: "f32" },
|
|
410
|
+
ygNodeLayoutGetRawHeight: { args: ["ptr"], returns: "f32" },
|
|
411
|
+
|
|
412
|
+
// Style properties - Layout
|
|
413
|
+
ygNodeStyleSetDirection: { args: ["ptr", "i32"], returns: "void" },
|
|
414
|
+
ygNodeStyleGetDirection: { args: ["ptr"], returns: "i32" },
|
|
415
|
+
ygNodeStyleSetFlexDirection: { args: ["ptr", "i32"], returns: "void" },
|
|
416
|
+
ygNodeStyleGetFlexDirection: { args: ["ptr"], returns: "i32" },
|
|
417
|
+
ygNodeStyleSetJustifyContent: { args: ["ptr", "i32"], returns: "void" },
|
|
418
|
+
ygNodeStyleGetJustifyContent: { args: ["ptr"], returns: "i32" },
|
|
419
|
+
ygNodeStyleSetAlignContent: { args: ["ptr", "i32"], returns: "void" },
|
|
420
|
+
ygNodeStyleGetAlignContent: { args: ["ptr"], returns: "i32" },
|
|
421
|
+
ygNodeStyleSetAlignItems: { args: ["ptr", "i32"], returns: "void" },
|
|
422
|
+
ygNodeStyleGetAlignItems: { args: ["ptr"], returns: "i32" },
|
|
423
|
+
ygNodeStyleSetAlignSelf: { args: ["ptr", "i32"], returns: "void" },
|
|
424
|
+
ygNodeStyleGetAlignSelf: { args: ["ptr"], returns: "i32" },
|
|
425
|
+
ygNodeStyleSetPositionType: { args: ["ptr", "i32"], returns: "void" },
|
|
426
|
+
ygNodeStyleGetPositionType: { args: ["ptr"], returns: "i32" },
|
|
427
|
+
ygNodeStyleSetFlexWrap: { args: ["ptr", "i32"], returns: "void" },
|
|
428
|
+
ygNodeStyleGetFlexWrap: { args: ["ptr"], returns: "i32" },
|
|
429
|
+
ygNodeStyleSetOverflow: { args: ["ptr", "i32"], returns: "void" },
|
|
430
|
+
ygNodeStyleGetOverflow: { args: ["ptr"], returns: "i32" },
|
|
431
|
+
ygNodeStyleSetDisplay: { args: ["ptr", "i32"], returns: "void" },
|
|
432
|
+
ygNodeStyleGetDisplay: { args: ["ptr"], returns: "i32" },
|
|
433
|
+
ygNodeStyleSetBoxSizing: { args: ["ptr", "i32"], returns: "void" },
|
|
434
|
+
ygNodeStyleGetBoxSizing: { args: ["ptr"], returns: "i32" },
|
|
435
|
+
|
|
436
|
+
// Style properties - Flex
|
|
437
|
+
ygNodeStyleSetFlex: { args: ["ptr", "f32"], returns: "void" },
|
|
438
|
+
ygNodeStyleGetFlex: { args: ["ptr"], returns: "f32" },
|
|
439
|
+
ygNodeStyleSetFlexGrow: { args: ["ptr", "f32"], returns: "void" },
|
|
440
|
+
ygNodeStyleGetFlexGrow: { args: ["ptr"], returns: "f32" },
|
|
441
|
+
ygNodeStyleSetFlexShrink: { args: ["ptr", "f32"], returns: "void" },
|
|
442
|
+
ygNodeStyleGetFlexShrink: { args: ["ptr"], returns: "f32" },
|
|
443
|
+
ygNodeStyleSetFlexBasis: { args: ["ptr", "f32"], returns: "void" },
|
|
444
|
+
ygNodeStyleSetFlexBasisPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
445
|
+
ygNodeStyleSetFlexBasisAuto: { args: ["ptr"], returns: "void" },
|
|
446
|
+
ygNodeStyleSetFlexBasisMaxContent: { args: ["ptr"], returns: "void" },
|
|
447
|
+
ygNodeStyleSetFlexBasisFitContent: { args: ["ptr"], returns: "void" },
|
|
448
|
+
ygNodeStyleSetFlexBasisStretch: { args: ["ptr"], returns: "void" },
|
|
449
|
+
|
|
450
|
+
// Style properties - Position
|
|
451
|
+
ygNodeStyleSetPosition: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
452
|
+
ygNodeStyleSetPositionPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
453
|
+
ygNodeStyleSetPositionAuto: { args: ["ptr", "i32"], returns: "void" },
|
|
454
|
+
|
|
455
|
+
// Style properties - Margin
|
|
456
|
+
ygNodeStyleSetMargin: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
457
|
+
ygNodeStyleSetMarginPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
458
|
+
ygNodeStyleSetMarginAuto: { args: ["ptr", "i32"], returns: "void" },
|
|
459
|
+
|
|
460
|
+
// Style properties - Padding
|
|
461
|
+
ygNodeStyleSetPadding: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
462
|
+
ygNodeStyleSetPaddingPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
463
|
+
|
|
464
|
+
// Style properties - Border
|
|
465
|
+
ygNodeStyleSetBorder: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
466
|
+
ygNodeStyleGetBorder: { args: ["ptr", "i32"], returns: "f32" },
|
|
467
|
+
|
|
468
|
+
// Style properties - Gap
|
|
469
|
+
ygNodeStyleSetGap: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
470
|
+
ygNodeStyleSetGapPercent: { args: ["ptr", "i32", "f32"], returns: "void" },
|
|
471
|
+
|
|
472
|
+
// Style properties - Size
|
|
473
|
+
ygNodeStyleSetWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
474
|
+
ygNodeStyleSetWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
475
|
+
ygNodeStyleSetWidthAuto: { args: ["ptr"], returns: "void" },
|
|
476
|
+
ygNodeStyleSetWidthMaxContent: { args: ["ptr"], returns: "void" },
|
|
477
|
+
ygNodeStyleSetWidthFitContent: { args: ["ptr"], returns: "void" },
|
|
478
|
+
ygNodeStyleSetWidthStretch: { args: ["ptr"], returns: "void" },
|
|
479
|
+
ygNodeStyleSetHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
480
|
+
ygNodeStyleSetHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
481
|
+
ygNodeStyleSetHeightAuto: { args: ["ptr"], returns: "void" },
|
|
482
|
+
ygNodeStyleSetHeightMaxContent: { args: ["ptr"], returns: "void" },
|
|
483
|
+
ygNodeStyleSetHeightFitContent: { args: ["ptr"], returns: "void" },
|
|
484
|
+
ygNodeStyleSetHeightStretch: { args: ["ptr"], returns: "void" },
|
|
485
|
+
ygNodeStyleSetMinWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
486
|
+
ygNodeStyleSetMinWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
487
|
+
ygNodeStyleSetMinWidthMaxContent: { args: ["ptr"], returns: "void" },
|
|
488
|
+
ygNodeStyleSetMinWidthFitContent: { args: ["ptr"], returns: "void" },
|
|
489
|
+
ygNodeStyleSetMinWidthStretch: { args: ["ptr"], returns: "void" },
|
|
490
|
+
ygNodeStyleSetMinHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
491
|
+
ygNodeStyleSetMinHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
492
|
+
ygNodeStyleSetMinHeightMaxContent: { args: ["ptr"], returns: "void" },
|
|
493
|
+
ygNodeStyleSetMinHeightFitContent: { args: ["ptr"], returns: "void" },
|
|
494
|
+
ygNodeStyleSetMinHeightStretch: { args: ["ptr"], returns: "void" },
|
|
495
|
+
ygNodeStyleSetMaxWidth: { args: ["ptr", "f32"], returns: "void" },
|
|
496
|
+
ygNodeStyleSetMaxWidthPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
497
|
+
ygNodeStyleSetMaxWidthMaxContent: { args: ["ptr"], returns: "void" },
|
|
498
|
+
ygNodeStyleSetMaxWidthFitContent: { args: ["ptr"], returns: "void" },
|
|
499
|
+
ygNodeStyleSetMaxWidthStretch: { args: ["ptr"], returns: "void" },
|
|
500
|
+
ygNodeStyleSetMaxHeight: { args: ["ptr", "f32"], returns: "void" },
|
|
501
|
+
ygNodeStyleSetMaxHeightPercent: { args: ["ptr", "f32"], returns: "void" },
|
|
502
|
+
ygNodeStyleSetMaxHeightMaxContent: { args: ["ptr"], returns: "void" },
|
|
503
|
+
ygNodeStyleSetMaxHeightFitContent: { args: ["ptr"], returns: "void" },
|
|
504
|
+
ygNodeStyleSetMaxHeightStretch: { args: ["ptr"], returns: "void" },
|
|
505
|
+
|
|
506
|
+
// Style properties - Aspect Ratio
|
|
507
|
+
ygNodeStyleSetAspectRatio: { args: ["ptr", "f32"], returns: "void" },
|
|
508
|
+
ygNodeStyleGetAspectRatio: { args: ["ptr"], returns: "f32" },
|
|
509
|
+
|
|
510
|
+
// Node context
|
|
511
|
+
ygNodeSetContext: { args: ["ptr", "ptr"], returns: "void" },
|
|
512
|
+
ygNodeGetContext: { args: ["ptr"], returns: "ptr" },
|
|
513
|
+
|
|
514
|
+
// Callback functions
|
|
515
|
+
ygNodeSetMeasureFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
516
|
+
ygNodeUnsetMeasureFunc: { args: ["ptr"], returns: "void" },
|
|
517
|
+
ygNodeHasMeasureFunc: { args: ["ptr"], returns: "bool" },
|
|
518
|
+
ygNodeSetBaselineFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
519
|
+
ygNodeUnsetBaselineFunc: { args: ["ptr"], returns: "void" },
|
|
520
|
+
ygNodeHasBaselineFunc: { args: ["ptr"], returns: "bool" },
|
|
521
|
+
ygNodeSetDirtiedFunc: { args: ["ptr", "ptr"], returns: "void" },
|
|
522
|
+
ygNodeUnsetDirtiedFunc: { args: ["ptr"], returns: "void" },
|
|
523
|
+
ygNodeGetDirtiedFunc: { args: ["ptr"], returns: "ptr" },
|
|
524
|
+
|
|
525
|
+
// Callback helper functions
|
|
526
|
+
ygCreateSize: { args: ["f32", "f32"], returns: "u64" },
|
|
527
|
+
ygStoreMeasureResult: { args: ["f32", "f32"], returns: "void" },
|
|
528
|
+
ygStoreBaselineResult: { args: ["f32"], returns: "void" },
|
|
529
|
+
ygNodeSetMeasureFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
|
|
530
|
+
ygNodeUnsetMeasureFuncTrampoline: { args: ["ptr"], returns: "void" },
|
|
531
|
+
ygNodeSetBaselineFuncTrampoline: { args: ["ptr", "ptr"], returns: "void" },
|
|
532
|
+
ygNodeUnsetBaselineFuncTrampoline: { args: ["ptr"], returns: "void" },
|
|
533
|
+
ygNodeFreeCallbacks: { args: ["ptr"], returns: "void" },
|
|
534
|
+
|
|
535
|
+
// Value getters (packed: lower 32 bits = unit, upper 32 bits = value)
|
|
536
|
+
ygNodeStyleGetWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
537
|
+
ygNodeStyleGetHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
538
|
+
ygNodeStyleGetMinWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
539
|
+
ygNodeStyleGetMinHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
540
|
+
ygNodeStyleGetMaxWidthPacked: { args: ["ptr"], returns: "u64" },
|
|
541
|
+
ygNodeStyleGetMaxHeightPacked: { args: ["ptr"], returns: "u64" },
|
|
542
|
+
ygNodeStyleGetMarginPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
543
|
+
ygNodeStyleGetPaddingPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
544
|
+
ygNodeStyleGetPositionPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
545
|
+
ygNodeStyleGetGapPacked: { args: ["ptr", "i32"], returns: "u64" },
|
|
546
|
+
ygNodeStyleGetFlexBasisPacked: { args: ["ptr"], returns: "u64" },
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
const yg = lib.symbols;
|
|
550
|
+
|
|
551
|
+
// ============================================================================
|
|
552
|
+
// Callback function types
|
|
553
|
+
// ============================================================================
|
|
554
|
+
|
|
555
|
+
export type MeasureFunction = (
|
|
556
|
+
width: number,
|
|
557
|
+
widthMode: MeasureMode,
|
|
558
|
+
height: number,
|
|
559
|
+
heightMode: MeasureMode
|
|
560
|
+
) => { width: number; height: number };
|
|
561
|
+
|
|
562
|
+
export type BaselineFunction = (width: number, height: number) => number;
|
|
563
|
+
|
|
564
|
+
export type DirtiedFunction = (node: Node) => void;
|
|
565
|
+
|
|
566
|
+
// ============================================================================
|
|
567
|
+
// Node class - yoga-layout compatible API
|
|
568
|
+
// ============================================================================
|
|
569
|
+
|
|
570
|
+
export class Node {
|
|
571
|
+
private ptr: Pointer;
|
|
572
|
+
private _freed: boolean = false;
|
|
573
|
+
private measureCallback: InstanceType<typeof JSCallback> | null = null;
|
|
574
|
+
private baselineCallback: InstanceType<typeof JSCallback> | null = null;
|
|
575
|
+
private dirtiedCallback: InstanceType<typeof JSCallback> | null = null;
|
|
576
|
+
|
|
577
|
+
private constructor(ptr: Pointer) {
|
|
578
|
+
this.ptr = ptr;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/** Check if the node has been freed */
|
|
582
|
+
isFreed(): boolean {
|
|
583
|
+
return this._freed;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
static create(config?: Config): Node {
|
|
587
|
+
const ptr = config
|
|
588
|
+
? yg.ygNodeNewWithConfig(config["ptr"])
|
|
589
|
+
: yg.ygNodeNew();
|
|
590
|
+
if (!ptr) throw new Error("Failed to create node");
|
|
591
|
+
return new Node(ptr);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
static createDefault(): Node {
|
|
595
|
+
return Node.create();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
static createWithConfig(config: Config): Node {
|
|
599
|
+
return Node.create(config);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
static destroy(node: Node): void {
|
|
603
|
+
node.free();
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
free(): void {
|
|
607
|
+
if (this._freed) return; // Already freed, no-op
|
|
608
|
+
// Clean up callbacks before freeing the node
|
|
609
|
+
this.unsetMeasureFunc();
|
|
610
|
+
this.unsetBaselineFunc();
|
|
611
|
+
this.unsetDirtiedFunc();
|
|
612
|
+
yg.ygNodeFree(this.ptr);
|
|
613
|
+
this._freed = true;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
freeRecursive(): void {
|
|
617
|
+
if (this._freed) return; // Already freed, no-op
|
|
618
|
+
// Clean up this node's callbacks before freeing
|
|
619
|
+
// Note: Child nodes' JSCallback objects are not tracked here - if you have
|
|
620
|
+
// references to child Node objects, their callbacks become invalid after this call
|
|
621
|
+
this.cleanupCallbacks();
|
|
622
|
+
yg.ygNodeFreeRecursive(this.ptr);
|
|
623
|
+
this._freed = true;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
reset(): void {
|
|
627
|
+
if (this._freed) return;
|
|
628
|
+
// Clean up callbacks before reset since reset clears all state
|
|
629
|
+
this.cleanupCallbacks();
|
|
630
|
+
yg.ygNodeReset(this.ptr);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/** Internal helper to close JSCallback objects without calling native unset functions */
|
|
634
|
+
private cleanupCallbacks(): void {
|
|
635
|
+
if (this.measureCallback) {
|
|
636
|
+
this.measureCallback.close();
|
|
637
|
+
this.measureCallback = null;
|
|
638
|
+
}
|
|
639
|
+
if (this.baselineCallback) {
|
|
640
|
+
this.baselineCallback.close();
|
|
641
|
+
this.baselineCallback = null;
|
|
642
|
+
}
|
|
643
|
+
if (this.dirtiedCallback) {
|
|
644
|
+
this.dirtiedCallback.close();
|
|
645
|
+
this.dirtiedCallback = null;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
clone(): Node {
|
|
650
|
+
if (this._freed) throw new Error("Cannot clone freed node");
|
|
651
|
+
const ptr = yg.ygNodeClone(this.ptr);
|
|
652
|
+
if (!ptr) throw new Error("Failed to clone node");
|
|
653
|
+
return new Node(ptr);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
copyStyle(node: Node): void {
|
|
657
|
+
if (this._freed) return;
|
|
658
|
+
yg.ygNodeCopyStyle(this.ptr, node.ptr);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
setIsReferenceBaseline(isReferenceBaseline: boolean): void {
|
|
662
|
+
if (this._freed) return;
|
|
663
|
+
yg.ygNodeSetIsReferenceBaseline(this.ptr, isReferenceBaseline);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
isReferenceBaseline(): boolean {
|
|
667
|
+
if (this._freed) return false;
|
|
668
|
+
return yg.ygNodeIsReferenceBaseline(this.ptr);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void {
|
|
672
|
+
if (this._freed) return;
|
|
673
|
+
yg.ygNodeSetAlwaysFormsContainingBlock(this.ptr, alwaysFormsContainingBlock);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// Hierarchy
|
|
677
|
+
insertChild(child: Node, index: number): void {
|
|
678
|
+
if (this._freed) return;
|
|
679
|
+
yg.ygNodeInsertChild(this.ptr, child.ptr, index);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
removeChild(child: Node): void {
|
|
683
|
+
if (this._freed) return;
|
|
684
|
+
yg.ygNodeRemoveChild(this.ptr, child.ptr);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
removeAllChildren(): void {
|
|
688
|
+
if (this._freed) return;
|
|
689
|
+
yg.ygNodeRemoveAllChildren(this.ptr);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
getChild(index: number): Node | null {
|
|
693
|
+
if (this._freed) return null;
|
|
694
|
+
const ptr = yg.ygNodeGetChild(this.ptr, index);
|
|
695
|
+
return ptr ? new Node(ptr) : null;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
getChildCount(): number {
|
|
699
|
+
if (this._freed) return 0;
|
|
700
|
+
return Number(yg.ygNodeGetChildCount(this.ptr));
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
getParent(): Node | null {
|
|
704
|
+
if (this._freed) return null;
|
|
705
|
+
const ptr = yg.ygNodeGetParent(this.ptr);
|
|
706
|
+
return ptr ? new Node(ptr) : null;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// Layout
|
|
710
|
+
calculateLayout(
|
|
711
|
+
width?: number | "auto",
|
|
712
|
+
height?: number | "auto",
|
|
713
|
+
direction: number = Direction.LTR
|
|
714
|
+
): void {
|
|
715
|
+
if (this._freed) return;
|
|
716
|
+
const w = width === "auto" || width === undefined ? NaN : width;
|
|
717
|
+
const h = height === "auto" || height === undefined ? NaN : height;
|
|
718
|
+
yg.ygNodeCalculateLayout(this.ptr, w, h, direction);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
hasNewLayout(): boolean {
|
|
722
|
+
if (this._freed) return false;
|
|
723
|
+
return yg.ygNodeGetHasNewLayout(this.ptr);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
markLayoutSeen(): void {
|
|
727
|
+
if (this._freed) return;
|
|
728
|
+
yg.ygNodeSetHasNewLayout(this.ptr, false);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
markDirty(): void {
|
|
732
|
+
if (this._freed) return;
|
|
733
|
+
yg.ygNodeMarkDirty(this.ptr);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
isDirty(): boolean {
|
|
737
|
+
if (this._freed) return true; // yoga-layout returns true for freed nodes
|
|
738
|
+
return yg.ygNodeIsDirty(this.ptr);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// Layout results
|
|
742
|
+
getComputedLayout() {
|
|
743
|
+
if (this._freed) return { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 };
|
|
744
|
+
return {
|
|
745
|
+
left: yg.ygNodeLayoutGetLeft(this.ptr),
|
|
746
|
+
top: yg.ygNodeLayoutGetTop(this.ptr),
|
|
747
|
+
right: yg.ygNodeLayoutGetRight(this.ptr),
|
|
748
|
+
bottom: yg.ygNodeLayoutGetBottom(this.ptr),
|
|
749
|
+
width: yg.ygNodeLayoutGetWidth(this.ptr),
|
|
750
|
+
height: yg.ygNodeLayoutGetHeight(this.ptr),
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
getComputedLeft(): number {
|
|
755
|
+
if (this._freed) return 0;
|
|
756
|
+
return yg.ygNodeLayoutGetLeft(this.ptr);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
getComputedTop(): number {
|
|
760
|
+
if (this._freed) return 0;
|
|
761
|
+
return yg.ygNodeLayoutGetTop(this.ptr);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
getComputedRight(): number {
|
|
765
|
+
if (this._freed) return 0;
|
|
766
|
+
return yg.ygNodeLayoutGetRight(this.ptr);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
getComputedBottom(): number {
|
|
770
|
+
if (this._freed) return 0;
|
|
771
|
+
return yg.ygNodeLayoutGetBottom(this.ptr);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
getComputedWidth(): number {
|
|
775
|
+
if (this._freed) return 0;
|
|
776
|
+
return yg.ygNodeLayoutGetWidth(this.ptr);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
getComputedHeight(): number {
|
|
780
|
+
if (this._freed) return 0;
|
|
781
|
+
return yg.ygNodeLayoutGetHeight(this.ptr);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
getComputedRawWidth(): number {
|
|
785
|
+
if (this._freed) return 0;
|
|
786
|
+
return yg.ygNodeLayoutGetRawWidth(this.ptr);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
getComputedRawHeight(): number {
|
|
790
|
+
if (this._freed) return 0;
|
|
791
|
+
return yg.ygNodeLayoutGetRawHeight(this.ptr);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
getComputedBorder(edge: number): number {
|
|
795
|
+
if (this._freed) return 0;
|
|
796
|
+
return yg.ygNodeLayoutGetBorder(this.ptr, edge);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
getComputedMargin(edge: number): number {
|
|
800
|
+
if (this._freed) return 0;
|
|
801
|
+
return yg.ygNodeLayoutGetMargin(this.ptr, edge);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
getComputedPadding(edge: number): number {
|
|
805
|
+
if (this._freed) return 0;
|
|
806
|
+
return yg.ygNodeLayoutGetPadding(this.ptr, edge);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// Style setters
|
|
810
|
+
setDirection(direction: Direction): void {
|
|
811
|
+
if (this._freed) return;
|
|
812
|
+
yg.ygNodeStyleSetDirection(this.ptr, direction);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
getDirection(): Direction {
|
|
816
|
+
if (this._freed) return Direction.Inherit;
|
|
817
|
+
return yg.ygNodeStyleGetDirection(this.ptr) as Direction;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
setFlexDirection(flexDirection: FlexDirection): void {
|
|
821
|
+
if (this._freed) return;
|
|
822
|
+
yg.ygNodeStyleSetFlexDirection(this.ptr, flexDirection);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
getFlexDirection(): FlexDirection {
|
|
826
|
+
if (this._freed) return FlexDirection.Column;
|
|
827
|
+
return yg.ygNodeStyleGetFlexDirection(this.ptr) as FlexDirection;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
setJustifyContent(justifyContent: Justify): void {
|
|
831
|
+
if (this._freed) return;
|
|
832
|
+
yg.ygNodeStyleSetJustifyContent(this.ptr, justifyContent);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
getJustifyContent(): Justify {
|
|
836
|
+
if (this._freed) return Justify.FlexStart;
|
|
837
|
+
return yg.ygNodeStyleGetJustifyContent(this.ptr) as Justify;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
setAlignContent(alignContent: Align): void {
|
|
841
|
+
if (this._freed) return;
|
|
842
|
+
yg.ygNodeStyleSetAlignContent(this.ptr, alignContent);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
getAlignContent(): Align {
|
|
846
|
+
if (this._freed) return Align.Auto;
|
|
847
|
+
return yg.ygNodeStyleGetAlignContent(this.ptr) as Align;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
setAlignItems(alignItems: Align): void {
|
|
851
|
+
if (this._freed) return;
|
|
852
|
+
yg.ygNodeStyleSetAlignItems(this.ptr, alignItems);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
getAlignItems(): Align {
|
|
856
|
+
if (this._freed) return Align.Auto;
|
|
857
|
+
return yg.ygNodeStyleGetAlignItems(this.ptr) as Align;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
setAlignSelf(alignSelf: Align): void {
|
|
861
|
+
if (this._freed) return;
|
|
862
|
+
yg.ygNodeStyleSetAlignSelf(this.ptr, alignSelf);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
getAlignSelf(): Align {
|
|
866
|
+
if (this._freed) return Align.Auto;
|
|
867
|
+
return yg.ygNodeStyleGetAlignSelf(this.ptr) as Align;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
setPositionType(positionType: PositionType): void {
|
|
871
|
+
if (this._freed) return;
|
|
872
|
+
yg.ygNodeStyleSetPositionType(this.ptr, positionType);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
getPositionType(): PositionType {
|
|
876
|
+
if (this._freed) return PositionType.Static;
|
|
877
|
+
return yg.ygNodeStyleGetPositionType(this.ptr) as PositionType;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
setFlexWrap(flexWrap: Wrap): void {
|
|
881
|
+
if (this._freed) return;
|
|
882
|
+
yg.ygNodeStyleSetFlexWrap(this.ptr, flexWrap);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
getFlexWrap(): Wrap {
|
|
886
|
+
if (this._freed) return Wrap.NoWrap;
|
|
887
|
+
return yg.ygNodeStyleGetFlexWrap(this.ptr) as Wrap;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
setOverflow(overflow: Overflow): void {
|
|
891
|
+
if (this._freed) return;
|
|
892
|
+
yg.ygNodeStyleSetOverflow(this.ptr, overflow);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
getOverflow(): Overflow {
|
|
896
|
+
if (this._freed) return Overflow.Visible;
|
|
897
|
+
return yg.ygNodeStyleGetOverflow(this.ptr) as Overflow;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
setDisplay(display: Display): void {
|
|
901
|
+
if (this._freed) return;
|
|
902
|
+
yg.ygNodeStyleSetDisplay(this.ptr, display);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
getDisplay(): Display {
|
|
906
|
+
if (this._freed) return Display.Flex;
|
|
907
|
+
return yg.ygNodeStyleGetDisplay(this.ptr) as Display;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
setBoxSizing(boxSizing: BoxSizing): void {
|
|
911
|
+
if (this._freed) return;
|
|
912
|
+
yg.ygNodeStyleSetBoxSizing(this.ptr, boxSizing);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
getBoxSizing(): BoxSizing {
|
|
916
|
+
if (this._freed) return BoxSizing.BorderBox;
|
|
917
|
+
return yg.ygNodeStyleGetBoxSizing(this.ptr) as BoxSizing;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
setFlex(flex: number): void {
|
|
921
|
+
if (this._freed) return;
|
|
922
|
+
yg.ygNodeStyleSetFlex(this.ptr, flex);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
getFlex(): number {
|
|
926
|
+
if (this._freed) return NaN;
|
|
927
|
+
return yg.ygNodeStyleGetFlex(this.ptr);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
setFlexGrow(flexGrow: number): void {
|
|
931
|
+
if (this._freed) return;
|
|
932
|
+
yg.ygNodeStyleSetFlexGrow(this.ptr, flexGrow);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
getFlexGrow(): number {
|
|
936
|
+
if (this._freed) return NaN;
|
|
937
|
+
return yg.ygNodeStyleGetFlexGrow(this.ptr);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
setFlexShrink(flexShrink: number): void {
|
|
941
|
+
if (this._freed) return;
|
|
942
|
+
yg.ygNodeStyleSetFlexShrink(this.ptr, flexShrink);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
getFlexShrink(): number {
|
|
946
|
+
if (this._freed) return NaN;
|
|
947
|
+
return yg.ygNodeStyleGetFlexShrink(this.ptr);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
setFlexBasis(flexBasis: number | "auto" | `${number}%` | undefined): void {
|
|
951
|
+
if (this._freed) return;
|
|
952
|
+
const { unit, asNumber } = parseValue(flexBasis);
|
|
953
|
+
if (unit === Unit.Auto) {
|
|
954
|
+
yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
|
|
955
|
+
} else if (unit === Unit.Percent) {
|
|
956
|
+
yg.ygNodeStyleSetFlexBasisPercent(this.ptr, asNumber!);
|
|
957
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
958
|
+
yg.ygNodeStyleSetFlexBasis(this.ptr, asNumber);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
setFlexBasisPercent(flexBasis: number | undefined): void {
|
|
963
|
+
if (this._freed) return;
|
|
964
|
+
if (flexBasis !== undefined) {
|
|
965
|
+
yg.ygNodeStyleSetFlexBasisPercent(this.ptr, flexBasis);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
setFlexBasisAuto(): void {
|
|
970
|
+
if (this._freed) return;
|
|
971
|
+
yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
setFlexBasisMaxContent(): void {
|
|
975
|
+
if (this._freed) return;
|
|
976
|
+
yg.ygNodeStyleSetFlexBasisMaxContent(this.ptr);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
setFlexBasisFitContent(): void {
|
|
980
|
+
if (this._freed) return;
|
|
981
|
+
yg.ygNodeStyleSetFlexBasisFitContent(this.ptr);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
setFlexBasisStretch(): void {
|
|
985
|
+
if (this._freed) return;
|
|
986
|
+
yg.ygNodeStyleSetFlexBasisStretch(this.ptr);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
setPosition(edge: Edge, position: number | `${number}%` | undefined): void {
|
|
990
|
+
if (this._freed) return;
|
|
991
|
+
const { unit, asNumber } = parseValue(position);
|
|
992
|
+
if (unit === Unit.Percent) {
|
|
993
|
+
yg.ygNodeStyleSetPositionPercent(this.ptr, edge, asNumber!);
|
|
994
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
995
|
+
yg.ygNodeStyleSetPosition(this.ptr, edge, asNumber);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
setPositionPercent(edge: Edge, position: number | undefined): void {
|
|
1000
|
+
if (this._freed) return;
|
|
1001
|
+
if (position !== undefined) {
|
|
1002
|
+
yg.ygNodeStyleSetPositionPercent(this.ptr, edge, position);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
setPositionAuto(edge: Edge): void {
|
|
1007
|
+
if (this._freed) return;
|
|
1008
|
+
yg.ygNodeStyleSetPositionAuto(this.ptr, edge);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
setMargin(
|
|
1012
|
+
edge: Edge,
|
|
1013
|
+
margin: number | "auto" | `${number}%` | undefined
|
|
1014
|
+
): void {
|
|
1015
|
+
if (this._freed) return;
|
|
1016
|
+
const { unit, asNumber } = parseValue(margin);
|
|
1017
|
+
if (unit === Unit.Auto) {
|
|
1018
|
+
yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
|
|
1019
|
+
} else if (unit === Unit.Percent) {
|
|
1020
|
+
yg.ygNodeStyleSetMarginPercent(this.ptr, edge, asNumber!);
|
|
1021
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1022
|
+
yg.ygNodeStyleSetMargin(this.ptr, edge, asNumber);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
setMarginPercent(edge: Edge, margin: number | undefined): void {
|
|
1027
|
+
if (this._freed) return;
|
|
1028
|
+
if (margin !== undefined) {
|
|
1029
|
+
yg.ygNodeStyleSetMarginPercent(this.ptr, edge, margin);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
setMarginAuto(edge: Edge): void {
|
|
1034
|
+
if (this._freed) return;
|
|
1035
|
+
yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
setPadding(edge: Edge, padding: number | `${number}%` | undefined): void {
|
|
1039
|
+
if (this._freed) return;
|
|
1040
|
+
const { unit, asNumber } = parseValue(padding);
|
|
1041
|
+
if (unit === Unit.Percent) {
|
|
1042
|
+
yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, asNumber!);
|
|
1043
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1044
|
+
yg.ygNodeStyleSetPadding(this.ptr, edge, asNumber);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
setPaddingPercent(edge: Edge, padding: number | undefined): void {
|
|
1049
|
+
if (this._freed) return;
|
|
1050
|
+
if (padding !== undefined) {
|
|
1051
|
+
yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, padding);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
setBorder(edge: Edge, border: number | undefined): void {
|
|
1056
|
+
if (this._freed) return;
|
|
1057
|
+
if (border !== undefined) {
|
|
1058
|
+
yg.ygNodeStyleSetBorder(this.ptr, edge, border);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
getBorder(edge: Edge): number {
|
|
1063
|
+
if (this._freed) return NaN;
|
|
1064
|
+
return yg.ygNodeStyleGetBorder(this.ptr, edge);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
setGap(gutter: Gutter, gap: number | `${number}%` | undefined): void {
|
|
1068
|
+
if (this._freed) return;
|
|
1069
|
+
const { unit, asNumber } = parseValue(gap);
|
|
1070
|
+
if (unit === Unit.Percent) {
|
|
1071
|
+
yg.ygNodeStyleSetGapPercent(this.ptr, gutter, asNumber!);
|
|
1072
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1073
|
+
yg.ygNodeStyleSetGap(this.ptr, gutter, asNumber);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
setGapPercent(gutter: Gutter, gap: number | undefined): void {
|
|
1078
|
+
if (this._freed) return;
|
|
1079
|
+
if (gap !== undefined) {
|
|
1080
|
+
yg.ygNodeStyleSetGapPercent(this.ptr, gutter, gap);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
setWidth(width: number | "auto" | `${number}%` | undefined): void {
|
|
1085
|
+
if (this._freed) return;
|
|
1086
|
+
const { unit, asNumber } = parseValue(width);
|
|
1087
|
+
if (unit === Unit.Auto) {
|
|
1088
|
+
yg.ygNodeStyleSetWidthAuto(this.ptr);
|
|
1089
|
+
} else if (unit === Unit.Percent) {
|
|
1090
|
+
yg.ygNodeStyleSetWidthPercent(this.ptr, asNumber!);
|
|
1091
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1092
|
+
yg.ygNodeStyleSetWidth(this.ptr, asNumber);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
setWidthPercent(width: number | undefined): void {
|
|
1097
|
+
if (this._freed) return;
|
|
1098
|
+
if (width !== undefined) {
|
|
1099
|
+
yg.ygNodeStyleSetWidthPercent(this.ptr, width);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
setWidthAuto(): void {
|
|
1104
|
+
if (this._freed) return;
|
|
1105
|
+
yg.ygNodeStyleSetWidthAuto(this.ptr);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
setWidthMaxContent(): void {
|
|
1109
|
+
if (this._freed) return;
|
|
1110
|
+
yg.ygNodeStyleSetWidthMaxContent(this.ptr);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
setWidthFitContent(): void {
|
|
1114
|
+
if (this._freed) return;
|
|
1115
|
+
yg.ygNodeStyleSetWidthFitContent(this.ptr);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
setWidthStretch(): void {
|
|
1119
|
+
if (this._freed) return;
|
|
1120
|
+
yg.ygNodeStyleSetWidthStretch(this.ptr);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
setHeight(height: number | "auto" | `${number}%` | undefined): void {
|
|
1124
|
+
if (this._freed) return;
|
|
1125
|
+
const { unit, asNumber } = parseValue(height);
|
|
1126
|
+
if (unit === Unit.Auto) {
|
|
1127
|
+
yg.ygNodeStyleSetHeightAuto(this.ptr);
|
|
1128
|
+
} else if (unit === Unit.Percent) {
|
|
1129
|
+
yg.ygNodeStyleSetHeightPercent(this.ptr, asNumber!);
|
|
1130
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1131
|
+
yg.ygNodeStyleSetHeight(this.ptr, asNumber);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
setHeightPercent(height: number | undefined): void {
|
|
1136
|
+
if (this._freed) return;
|
|
1137
|
+
if (height !== undefined) {
|
|
1138
|
+
yg.ygNodeStyleSetHeightPercent(this.ptr, height);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
setHeightAuto(): void {
|
|
1143
|
+
if (this._freed) return;
|
|
1144
|
+
yg.ygNodeStyleSetHeightAuto(this.ptr);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
setHeightMaxContent(): void {
|
|
1148
|
+
if (this._freed) return;
|
|
1149
|
+
yg.ygNodeStyleSetHeightMaxContent(this.ptr);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
setHeightFitContent(): void {
|
|
1153
|
+
if (this._freed) return;
|
|
1154
|
+
yg.ygNodeStyleSetHeightFitContent(this.ptr);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
setHeightStretch(): void {
|
|
1158
|
+
if (this._freed) return;
|
|
1159
|
+
yg.ygNodeStyleSetHeightStretch(this.ptr);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
setMinWidth(minWidth: number | `${number}%` | undefined): void {
|
|
1163
|
+
if (this._freed) return;
|
|
1164
|
+
const { unit, asNumber } = parseValue(minWidth);
|
|
1165
|
+
if (unit === Unit.Percent) {
|
|
1166
|
+
yg.ygNodeStyleSetMinWidthPercent(this.ptr, asNumber!);
|
|
1167
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1168
|
+
yg.ygNodeStyleSetMinWidth(this.ptr, asNumber);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
setMinWidthPercent(minWidth: number | undefined): void {
|
|
1173
|
+
if (this._freed) return;
|
|
1174
|
+
if (minWidth !== undefined) {
|
|
1175
|
+
yg.ygNodeStyleSetMinWidthPercent(this.ptr, minWidth);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
setMinWidthMaxContent(): void {
|
|
1180
|
+
if (this._freed) return;
|
|
1181
|
+
yg.ygNodeStyleSetMinWidthMaxContent(this.ptr);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
setMinWidthFitContent(): void {
|
|
1185
|
+
if (this._freed) return;
|
|
1186
|
+
yg.ygNodeStyleSetMinWidthFitContent(this.ptr);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
setMinWidthStretch(): void {
|
|
1190
|
+
if (this._freed) return;
|
|
1191
|
+
yg.ygNodeStyleSetMinWidthStretch(this.ptr);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
setMinHeight(minHeight: number | `${number}%` | undefined): void {
|
|
1195
|
+
if (this._freed) return;
|
|
1196
|
+
const { unit, asNumber } = parseValue(minHeight);
|
|
1197
|
+
if (unit === Unit.Percent) {
|
|
1198
|
+
yg.ygNodeStyleSetMinHeightPercent(this.ptr, asNumber!);
|
|
1199
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1200
|
+
yg.ygNodeStyleSetMinHeight(this.ptr, asNumber);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
setMinHeightPercent(minHeight: number | undefined): void {
|
|
1205
|
+
if (this._freed) return;
|
|
1206
|
+
if (minHeight !== undefined) {
|
|
1207
|
+
yg.ygNodeStyleSetMinHeightPercent(this.ptr, minHeight);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
setMinHeightMaxContent(): void {
|
|
1212
|
+
if (this._freed) return;
|
|
1213
|
+
yg.ygNodeStyleSetMinHeightMaxContent(this.ptr);
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
setMinHeightFitContent(): void {
|
|
1217
|
+
if (this._freed) return;
|
|
1218
|
+
yg.ygNodeStyleSetMinHeightFitContent(this.ptr);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
setMinHeightStretch(): void {
|
|
1222
|
+
if (this._freed) return;
|
|
1223
|
+
yg.ygNodeStyleSetMinHeightStretch(this.ptr);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
setMaxWidth(maxWidth: number | `${number}%` | undefined): void {
|
|
1227
|
+
if (this._freed) return;
|
|
1228
|
+
const { unit, asNumber } = parseValue(maxWidth);
|
|
1229
|
+
if (unit === Unit.Percent) {
|
|
1230
|
+
yg.ygNodeStyleSetMaxWidthPercent(this.ptr, asNumber!);
|
|
1231
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1232
|
+
yg.ygNodeStyleSetMaxWidth(this.ptr, asNumber);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
setMaxWidthPercent(maxWidth: number | undefined): void {
|
|
1237
|
+
if (this._freed) return;
|
|
1238
|
+
if (maxWidth !== undefined) {
|
|
1239
|
+
yg.ygNodeStyleSetMaxWidthPercent(this.ptr, maxWidth);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
setMaxWidthMaxContent(): void {
|
|
1244
|
+
if (this._freed) return;
|
|
1245
|
+
yg.ygNodeStyleSetMaxWidthMaxContent(this.ptr);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
setMaxWidthFitContent(): void {
|
|
1249
|
+
if (this._freed) return;
|
|
1250
|
+
yg.ygNodeStyleSetMaxWidthFitContent(this.ptr);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
setMaxWidthStretch(): void {
|
|
1254
|
+
if (this._freed) return;
|
|
1255
|
+
yg.ygNodeStyleSetMaxWidthStretch(this.ptr);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
setMaxHeight(maxHeight: number | `${number}%` | undefined): void {
|
|
1259
|
+
if (this._freed) return;
|
|
1260
|
+
const { unit, asNumber } = parseValue(maxHeight);
|
|
1261
|
+
if (unit === Unit.Percent) {
|
|
1262
|
+
yg.ygNodeStyleSetMaxHeightPercent(this.ptr, asNumber!);
|
|
1263
|
+
} else if (unit === Unit.Point && asNumber !== undefined) {
|
|
1264
|
+
yg.ygNodeStyleSetMaxHeight(this.ptr, asNumber);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
setMaxHeightPercent(maxHeight: number | undefined): void {
|
|
1269
|
+
if (this._freed) return;
|
|
1270
|
+
if (maxHeight !== undefined) {
|
|
1271
|
+
yg.ygNodeStyleSetMaxHeightPercent(this.ptr, maxHeight);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
setMaxHeightMaxContent(): void {
|
|
1276
|
+
if (this._freed) return;
|
|
1277
|
+
yg.ygNodeStyleSetMaxHeightMaxContent(this.ptr);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
setMaxHeightFitContent(): void {
|
|
1281
|
+
if (this._freed) return;
|
|
1282
|
+
yg.ygNodeStyleSetMaxHeightFitContent(this.ptr);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
setMaxHeightStretch(): void {
|
|
1286
|
+
if (this._freed) return;
|
|
1287
|
+
yg.ygNodeStyleSetMaxHeightStretch(this.ptr);
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
setAspectRatio(aspectRatio: number | undefined): void {
|
|
1291
|
+
if (this._freed) return;
|
|
1292
|
+
if (aspectRatio !== undefined) {
|
|
1293
|
+
yg.ygNodeStyleSetAspectRatio(this.ptr, aspectRatio);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
getAspectRatio(): number {
|
|
1298
|
+
if (this._freed) return NaN;
|
|
1299
|
+
return yg.ygNodeStyleGetAspectRatio(this.ptr);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// Value getters (return {unit, value} like yoga-layout)
|
|
1303
|
+
getWidth(): Value {
|
|
1304
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1305
|
+
return unpackValue(yg.ygNodeStyleGetWidthPacked(this.ptr));
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
getHeight(): Value {
|
|
1309
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1310
|
+
return unpackValue(yg.ygNodeStyleGetHeightPacked(this.ptr));
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
getMinWidth(): Value {
|
|
1314
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1315
|
+
return unpackValue(yg.ygNodeStyleGetMinWidthPacked(this.ptr));
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
getMinHeight(): Value {
|
|
1319
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1320
|
+
return unpackValue(yg.ygNodeStyleGetMinHeightPacked(this.ptr));
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
getMaxWidth(): Value {
|
|
1324
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1325
|
+
return unpackValue(yg.ygNodeStyleGetMaxWidthPacked(this.ptr));
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
getMaxHeight(): Value {
|
|
1329
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1330
|
+
return unpackValue(yg.ygNodeStyleGetMaxHeightPacked(this.ptr));
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
getMargin(edge: Edge): Value {
|
|
1334
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1335
|
+
return unpackValue(yg.ygNodeStyleGetMarginPacked(this.ptr, edge));
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
getPadding(edge: Edge): Value {
|
|
1339
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1340
|
+
return unpackValue(yg.ygNodeStyleGetPaddingPacked(this.ptr, edge));
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
getPosition(edge: Edge): Value {
|
|
1344
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1345
|
+
return unpackValue(yg.ygNodeStyleGetPositionPacked(this.ptr, edge));
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
getGap(gutter: Gutter): Value {
|
|
1349
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1350
|
+
return unpackValue(yg.ygNodeStyleGetGapPacked(this.ptr, gutter));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
getFlexBasis(): Value {
|
|
1354
|
+
if (this._freed) return UNDEFINED_VALUE;
|
|
1355
|
+
return unpackValue(yg.ygNodeStyleGetFlexBasisPacked(this.ptr));
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// Callback functions
|
|
1359
|
+
setMeasureFunc(measureFunc: MeasureFunction | null): void {
|
|
1360
|
+
if (this._freed) return;
|
|
1361
|
+
this.unsetMeasureFunc(); // Clean up existing callback
|
|
1362
|
+
|
|
1363
|
+
if (measureFunc) {
|
|
1364
|
+
// Use trampoline approach to work around ARM64 ABI limitations
|
|
1365
|
+
// The trampoline doesn't return the result directly - instead it stores
|
|
1366
|
+
// the result via ygStoreMeasureResult, and our Zig wrapper reads it
|
|
1367
|
+
this.measureCallback = new JSCallback(
|
|
1368
|
+
(
|
|
1369
|
+
nodePtr: Pointer,
|
|
1370
|
+
width: number,
|
|
1371
|
+
widthMode: number,
|
|
1372
|
+
height: number,
|
|
1373
|
+
heightMode: number
|
|
1374
|
+
) => {
|
|
1375
|
+
const result = measureFunc(width, widthMode as MeasureMode, height, heightMode as MeasureMode);
|
|
1376
|
+
// Store the result for the Zig wrapper to read
|
|
1377
|
+
yg.ygStoreMeasureResult(result.width, result.height);
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
args: [
|
|
1381
|
+
FFIType.ptr,
|
|
1382
|
+
FFIType.f32,
|
|
1383
|
+
FFIType.u32,
|
|
1384
|
+
FFIType.f32,
|
|
1385
|
+
FFIType.u32,
|
|
1386
|
+
],
|
|
1387
|
+
returns: FFIType.void,
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
|
|
1391
|
+
if (this.measureCallback.ptr) {
|
|
1392
|
+
yg.ygNodeSetMeasureFuncTrampoline(this.ptr, this.measureCallback.ptr);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
unsetMeasureFunc(): void {
|
|
1398
|
+
if (this._freed) return; // Skip if already freed
|
|
1399
|
+
if (this.measureCallback) {
|
|
1400
|
+
this.measureCallback.close();
|
|
1401
|
+
this.measureCallback = null;
|
|
1402
|
+
}
|
|
1403
|
+
yg.ygNodeUnsetMeasureFuncTrampoline(this.ptr);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
hasMeasureFunc(): boolean {
|
|
1407
|
+
if (this._freed) return false;
|
|
1408
|
+
return yg.ygNodeHasMeasureFunc(this.ptr);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
setBaselineFunc(baselineFunc: BaselineFunction | null): void {
|
|
1412
|
+
if (this._freed) return;
|
|
1413
|
+
this.unsetBaselineFunc(); // Clean up existing callback
|
|
1414
|
+
|
|
1415
|
+
if (baselineFunc) {
|
|
1416
|
+
// Use trampoline approach to work around ARM64 ABI limitations
|
|
1417
|
+
// The trampoline stores the result via ygStoreBaselineResult
|
|
1418
|
+
this.baselineCallback = new JSCallback(
|
|
1419
|
+
(nodePtr: Pointer, width: number, height: number) => {
|
|
1420
|
+
const result = baselineFunc(width, height);
|
|
1421
|
+
yg.ygStoreBaselineResult(result);
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
args: [FFIType.ptr, FFIType.f32, FFIType.f32],
|
|
1425
|
+
returns: FFIType.void,
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
1428
|
+
|
|
1429
|
+
if (this.baselineCallback.ptr) {
|
|
1430
|
+
yg.ygNodeSetBaselineFuncTrampoline(this.ptr, this.baselineCallback.ptr);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
unsetBaselineFunc(): void {
|
|
1436
|
+
if (this._freed) return; // Skip if already freed
|
|
1437
|
+
if (this.baselineCallback) {
|
|
1438
|
+
this.baselineCallback.close();
|
|
1439
|
+
this.baselineCallback = null;
|
|
1440
|
+
}
|
|
1441
|
+
yg.ygNodeUnsetBaselineFuncTrampoline(this.ptr);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
hasBaselineFunc(): boolean {
|
|
1445
|
+
if (this._freed) return false;
|
|
1446
|
+
return yg.ygNodeHasBaselineFunc(this.ptr);
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void {
|
|
1450
|
+
if (this._freed) return;
|
|
1451
|
+
this.unsetDirtiedFunc(); // Clean up existing callback
|
|
1452
|
+
|
|
1453
|
+
if (dirtiedFunc) {
|
|
1454
|
+
// Capture this node instance for the callback
|
|
1455
|
+
const node = this;
|
|
1456
|
+
// Create a JSCallback that matches Yoga's expected dirtied function signature
|
|
1457
|
+
this.dirtiedCallback = new JSCallback(
|
|
1458
|
+
(nodePtr: Pointer) => {
|
|
1459
|
+
dirtiedFunc(node);
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
args: [FFIType.ptr],
|
|
1463
|
+
returns: FFIType.void,
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
|
|
1467
|
+
if (this.dirtiedCallback.ptr) {
|
|
1468
|
+
yg.ygNodeSetDirtiedFunc(this.ptr, this.dirtiedCallback.ptr);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
unsetDirtiedFunc(): void {
|
|
1474
|
+
if (this._freed) return; // Skip if already freed
|
|
1475
|
+
if (this.dirtiedCallback) {
|
|
1476
|
+
this.dirtiedCallback.close();
|
|
1477
|
+
this.dirtiedCallback = null;
|
|
1478
|
+
}
|
|
1479
|
+
yg.ygNodeUnsetDirtiedFunc(this.ptr);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
hasDirtiedFunc(): boolean {
|
|
1483
|
+
if (this._freed) return false;
|
|
1484
|
+
return Boolean(yg.ygNodeGetDirtiedFunc(this.ptr));
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// ============================================================================
|
|
1489
|
+
// Config class
|
|
1490
|
+
// ============================================================================
|
|
1491
|
+
|
|
1492
|
+
export class Config {
|
|
1493
|
+
private ptr: Pointer;
|
|
1494
|
+
|
|
1495
|
+
private constructor(ptr: Pointer) {
|
|
1496
|
+
this.ptr = ptr;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
static create(): Config {
|
|
1500
|
+
const ptr = yg.ygConfigNew();
|
|
1501
|
+
if (!ptr) throw new Error("Failed to create config");
|
|
1502
|
+
return new Config(ptr);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
static destroy(config: Config): void {
|
|
1506
|
+
config.free();
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
free(): void {
|
|
1510
|
+
yg.ygConfigFree(this.ptr);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
setUseWebDefaults(useWebDefaults: boolean): void {
|
|
1514
|
+
yg.ygConfigSetUseWebDefaults(this.ptr, useWebDefaults);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
useWebDefaults(): boolean {
|
|
1518
|
+
return yg.ygConfigGetUseWebDefaults(this.ptr);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
setPointScaleFactor(pointScaleFactor: number): void {
|
|
1522
|
+
yg.ygConfigSetPointScaleFactor(this.ptr, pointScaleFactor);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
getPointScaleFactor(): number {
|
|
1526
|
+
return yg.ygConfigGetPointScaleFactor(this.ptr);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
setErrata(errata: Errata): void {
|
|
1530
|
+
yg.ygConfigSetErrata(this.ptr, errata);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
getErrata(): Errata {
|
|
1534
|
+
return yg.ygConfigGetErrata(this.ptr) as Errata;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
setExperimentalFeatureEnabled(
|
|
1538
|
+
feature: ExperimentalFeature,
|
|
1539
|
+
enabled: boolean
|
|
1540
|
+
): void {
|
|
1541
|
+
yg.ygConfigSetExperimentalFeatureEnabled(this.ptr, feature, enabled);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
isExperimentalFeatureEnabled(feature: ExperimentalFeature): boolean {
|
|
1545
|
+
return yg.ygConfigIsExperimentalFeatureEnabled(this.ptr, feature);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
// Default export for yoga-layout compatibility
|
|
1550
|
+
export default {
|
|
1551
|
+
Node,
|
|
1552
|
+
Config,
|
|
1553
|
+
// Enums
|
|
1554
|
+
Align,
|
|
1555
|
+
BoxSizing,
|
|
1556
|
+
Dimension,
|
|
1557
|
+
Direction,
|
|
1558
|
+
Display,
|
|
1559
|
+
Edge,
|
|
1560
|
+
Errata,
|
|
1561
|
+
ExperimentalFeature,
|
|
1562
|
+
FlexDirection,
|
|
1563
|
+
Gutter,
|
|
1564
|
+
Justify,
|
|
1565
|
+
LogLevel,
|
|
1566
|
+
MeasureMode,
|
|
1567
|
+
NodeType,
|
|
1568
|
+
Overflow,
|
|
1569
|
+
PositionType,
|
|
1570
|
+
Unit,
|
|
1571
|
+
Wrap,
|
|
1572
|
+
// Constants
|
|
1573
|
+
EDGE_LEFT,
|
|
1574
|
+
EDGE_TOP,
|
|
1575
|
+
EDGE_RIGHT,
|
|
1576
|
+
EDGE_BOTTOM,
|
|
1577
|
+
EDGE_START,
|
|
1578
|
+
EDGE_END,
|
|
1579
|
+
EDGE_HORIZONTAL,
|
|
1580
|
+
EDGE_VERTICAL,
|
|
1581
|
+
EDGE_ALL,
|
|
1582
|
+
FLEX_DIRECTION_COLUMN,
|
|
1583
|
+
FLEX_DIRECTION_COLUMN_REVERSE,
|
|
1584
|
+
FLEX_DIRECTION_ROW,
|
|
1585
|
+
FLEX_DIRECTION_ROW_REVERSE,
|
|
1586
|
+
JUSTIFY_FLEX_START,
|
|
1587
|
+
JUSTIFY_CENTER,
|
|
1588
|
+
JUSTIFY_FLEX_END,
|
|
1589
|
+
JUSTIFY_SPACE_BETWEEN,
|
|
1590
|
+
JUSTIFY_SPACE_AROUND,
|
|
1591
|
+
JUSTIFY_SPACE_EVENLY,
|
|
1592
|
+
ALIGN_AUTO,
|
|
1593
|
+
ALIGN_FLEX_START,
|
|
1594
|
+
ALIGN_CENTER,
|
|
1595
|
+
ALIGN_FLEX_END,
|
|
1596
|
+
ALIGN_STRETCH,
|
|
1597
|
+
ALIGN_BASELINE,
|
|
1598
|
+
ALIGN_SPACE_BETWEEN,
|
|
1599
|
+
ALIGN_SPACE_AROUND,
|
|
1600
|
+
ALIGN_SPACE_EVENLY,
|
|
1601
|
+
WRAP_NO_WRAP,
|
|
1602
|
+
WRAP_WRAP,
|
|
1603
|
+
WRAP_WRAP_REVERSE,
|
|
1604
|
+
OVERFLOW_VISIBLE,
|
|
1605
|
+
OVERFLOW_HIDDEN,
|
|
1606
|
+
OVERFLOW_SCROLL,
|
|
1607
|
+
DISPLAY_FLEX,
|
|
1608
|
+
DISPLAY_NONE,
|
|
1609
|
+
DISPLAY_CONTENTS,
|
|
1610
|
+
POSITION_TYPE_STATIC,
|
|
1611
|
+
POSITION_TYPE_RELATIVE,
|
|
1612
|
+
POSITION_TYPE_ABSOLUTE,
|
|
1613
|
+
DIRECTION_INHERIT,
|
|
1614
|
+
DIRECTION_LTR,
|
|
1615
|
+
DIRECTION_RTL,
|
|
1616
|
+
BOX_SIZING_BORDER_BOX,
|
|
1617
|
+
BOX_SIZING_CONTENT_BOX,
|
|
1618
|
+
DIMENSION_WIDTH,
|
|
1619
|
+
DIMENSION_HEIGHT,
|
|
1620
|
+
GUTTER_COLUMN,
|
|
1621
|
+
GUTTER_ROW,
|
|
1622
|
+
GUTTER_ALL,
|
|
1623
|
+
UNIT_UNDEFINED,
|
|
1624
|
+
UNIT_POINT,
|
|
1625
|
+
UNIT_PERCENT,
|
|
1626
|
+
UNIT_AUTO,
|
|
1627
|
+
UNIT_MAX_CONTENT,
|
|
1628
|
+
UNIT_FIT_CONTENT,
|
|
1629
|
+
UNIT_STRETCH,
|
|
1630
|
+
MEASURE_MODE_UNDEFINED,
|
|
1631
|
+
MEASURE_MODE_EXACTLY,
|
|
1632
|
+
MEASURE_MODE_AT_MOST,
|
|
1633
|
+
NODE_TYPE_DEFAULT,
|
|
1634
|
+
NODE_TYPE_TEXT,
|
|
1635
|
+
LOG_LEVEL_ERROR,
|
|
1636
|
+
LOG_LEVEL_WARN,
|
|
1637
|
+
LOG_LEVEL_INFO,
|
|
1638
|
+
LOG_LEVEL_DEBUG,
|
|
1639
|
+
LOG_LEVEL_VERBOSE,
|
|
1640
|
+
LOG_LEVEL_FATAL,
|
|
1641
|
+
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS,
|
|
1642
|
+
ERRATA_NONE,
|
|
1643
|
+
ERRATA_STRETCH_FLEX_BASIS,
|
|
1644
|
+
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING,
|
|
1645
|
+
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE,
|
|
1646
|
+
ERRATA_ALL,
|
|
1647
|
+
ERRATA_CLASSIC,
|
|
1648
|
+
};
|