taffy-wasm 0.9.2 → 0.9.5
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 +395 -133
- package/package.json +3 -5
- package/taffy_wasm.d.ts +1684 -859
- package/taffy_wasm.js +1901 -1486
- package/taffy_wasm_bg.wasm +0 -0
package/taffy_wasm.d.ts
CHANGED
|
@@ -2,1113 +2,1937 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Available space constraint for layout computation.
|
|
6
|
+
*
|
|
7
|
+
* Specifies how much space is available for a node during layout calculation.
|
|
8
|
+
* This is passed to `computeLayout()` to define the container constraints.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* - Use `number` when you have a fixed container size
|
|
12
|
+
* - Use `"minContent"` to shrink-wrap to the minimum content size
|
|
13
|
+
* - Use `"maxContent"` to expand to fit all content without wrapping
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import init, { TaffyTree, Style, type AvailableSpace, type Size } from 'taffy-js';
|
|
18
|
+
*
|
|
19
|
+
* await init();
|
|
20
|
+
* const tree = new TaffyTree();
|
|
21
|
+
* const root: bigint = tree.newLeaf(new Style());
|
|
22
|
+
*
|
|
23
|
+
* // Fixed size container with type annotation
|
|
24
|
+
* const fixedSpace: Size<AvailableSpace> = {
|
|
25
|
+
* width: 800,
|
|
26
|
+
* height: 600
|
|
27
|
+
* };
|
|
28
|
+
* tree.computeLayout(root, fixedSpace);
|
|
29
|
+
*
|
|
30
|
+
* // Flexible width, fixed height
|
|
31
|
+
* const flexibleSpace: Size<AvailableSpace> = {
|
|
32
|
+
* width: "maxContent",
|
|
33
|
+
* height: 400
|
|
34
|
+
* };
|
|
35
|
+
* tree.computeLayout(root, flexibleSpace);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export type AvailableSpace = number | "minContent" | "maxContent";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Generic size type with width and height.
|
|
42
|
+
*
|
|
43
|
+
* A two-dimensional container for width and height values. The type parameter `T`
|
|
44
|
+
* determines what kind of values are stored.
|
|
45
|
+
*
|
|
46
|
+
* @typeParam T - The type of each dimension (e.g., `number`, `Dimension`, `AvailableSpace`)
|
|
47
|
+
*
|
|
48
|
+
* @property width - The horizontal dimension value
|
|
49
|
+
* @property height - The vertical dimension value
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import type { Size, Dimension, AvailableSpace } from 'taffy-js';
|
|
54
|
+
*
|
|
55
|
+
* // Size with explicit type parameters
|
|
56
|
+
* const pixelSize: Size<number> = { width: 200, height: 100 };
|
|
57
|
+
*
|
|
58
|
+
* const dimensionSize: Size<Dimension> = {
|
|
59
|
+
* width: 200,
|
|
60
|
+
* height: "50%"
|
|
61
|
+
* };
|
|
62
|
+
*
|
|
63
|
+
* const availableSize: Size<AvailableSpace> = {
|
|
64
|
+
* width: 800,
|
|
65
|
+
* height: "MaxContent"
|
|
66
|
+
* };
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export interface Size<T> {
|
|
70
|
+
/** The horizontal dimension value */
|
|
71
|
+
width: T;
|
|
72
|
+
/** The vertical dimension value */
|
|
73
|
+
height: T;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Custom measure function for leaf nodes with text or other dynamic content.
|
|
78
|
+
*
|
|
79
|
+
* This callback is invoked during layout computation for leaf nodes that need
|
|
80
|
+
* custom sizing based on their content (e.g., text nodes that need text measurement).
|
|
81
|
+
*
|
|
82
|
+
* @param knownDimensions - Dimensions already determined by constraints. Each dimension
|
|
83
|
+
* is `number` if known, or `null` if needs to be measured.
|
|
84
|
+
* @param availableSpace - The available space constraints for the node. Can be definite
|
|
85
|
+
* pixels, "minContent", or "maxContent".
|
|
86
|
+
* @param node - The node ID (`bigint`) of the node being measured
|
|
87
|
+
* @param context - User-provided context attached to the node via `newLeafWithContext()`
|
|
88
|
+
* @param style - The node's current Style configuration
|
|
89
|
+
*
|
|
90
|
+
* @returns - The measured size of the content in pixels
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* import init, { TaffyTree, Style, type MeasureFunction, type Size } from 'taffy-js';
|
|
95
|
+
*
|
|
96
|
+
* interface TextContext {
|
|
97
|
+
* text: string;
|
|
98
|
+
* fontSize: number;
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* await init();
|
|
102
|
+
* const tree = new TaffyTree();
|
|
103
|
+
*
|
|
104
|
+
* const style = new Style();
|
|
105
|
+
* const context: TextContext = { text: "Hello, World!", fontSize: 16 };
|
|
106
|
+
* const textNode: bigint = tree.newLeafWithContext(style, context);
|
|
107
|
+
*
|
|
108
|
+
* // Typed measure function
|
|
109
|
+
* const measureText: MeasureFunction = (
|
|
110
|
+
* knownDimensions,
|
|
111
|
+
* availableSpace,
|
|
112
|
+
* node,
|
|
113
|
+
* context,
|
|
114
|
+
* style
|
|
115
|
+
* ): Size<number> => {
|
|
116
|
+
* const ctx = context as TextContext | undefined;
|
|
117
|
+
* if (!ctx?.text) return { width: 0, height: 0 };
|
|
118
|
+
*
|
|
119
|
+
* const width = knownDimensions.width ?? measureTextWidth(ctx.text, ctx.fontSize);
|
|
120
|
+
* const height = knownDimensions.height ?? ctx.fontSize * 1.2;
|
|
121
|
+
*
|
|
122
|
+
* return { width, height };
|
|
123
|
+
* };
|
|
124
|
+
*
|
|
125
|
+
* tree.computeLayoutWithMeasure(
|
|
126
|
+
* textNode,
|
|
127
|
+
* { width: 200, height: "maxContent" },
|
|
128
|
+
* measureText
|
|
129
|
+
* );
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export type MeasureFunction = (
|
|
133
|
+
knownDimensions: Size<number | null>,
|
|
134
|
+
availableSpace: Size<AvailableSpace>,
|
|
135
|
+
node: bigint,
|
|
136
|
+
context: any,
|
|
137
|
+
style: Style,
|
|
138
|
+
) => Size<number>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Dimension type supporting length, percentage, or auto values.
|
|
142
|
+
*
|
|
143
|
+
* Used for sizing properties like `width`, `height`, `flexBasis`, etc.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* - `number`: Fixed size in pixels
|
|
147
|
+
* - `"{number}%"`: Percentage of parent's size (0-100)
|
|
148
|
+
* - `"auto"`: Size determined by content or layout algorithm
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* import { Style, type Dimension, type Size } from 'taffy-js';
|
|
153
|
+
*
|
|
154
|
+
* const style = new Style();
|
|
155
|
+
*
|
|
156
|
+
* // With explicit type annotations
|
|
157
|
+
* const fixedSize: Size<Dimension> = {
|
|
158
|
+
* width: 200,
|
|
159
|
+
* height: 100
|
|
160
|
+
* };
|
|
161
|
+
*
|
|
162
|
+
* const percentSize: Size<Dimension> = {
|
|
163
|
+
* width: "50%",
|
|
164
|
+
* height: "100%"
|
|
165
|
+
* };
|
|
166
|
+
*
|
|
167
|
+
* const autoSize: Size<Dimension> = {
|
|
168
|
+
* width: "auto",
|
|
169
|
+
* height: "auto"
|
|
170
|
+
* };
|
|
171
|
+
*
|
|
172
|
+
* style.size = fixedSize;
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export type Dimension = number | `${number}%` | "auto";
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Length or percentage value (no auto support).
|
|
179
|
+
*
|
|
180
|
+
* Used for properties that require explicit values, such as `padding`, `border`, and `gap`.
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* - `number`: Fixed size in pixels
|
|
184
|
+
* - `"{number}%"`: Percentage of parent's size (0-100)
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* import { Style, type LengthPercentage, type Rect, type Size } from 'taffy-js';
|
|
189
|
+
*
|
|
190
|
+
* const style = new Style();
|
|
191
|
+
*
|
|
192
|
+
* const padding: Rect<LengthPercentage> = {
|
|
193
|
+
* left: 10,
|
|
194
|
+
* right: 10,
|
|
195
|
+
* top: 5,
|
|
196
|
+
* bottom: 5
|
|
197
|
+
* };
|
|
198
|
+
*
|
|
199
|
+
* const gap: Size<LengthPercentage> = {
|
|
200
|
+
* width: "5%",
|
|
201
|
+
* height: "5%"
|
|
202
|
+
* };
|
|
203
|
+
*
|
|
204
|
+
* style.padding = padding;
|
|
205
|
+
* style.gap = gap;
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export type LengthPercentage = number | `${number}%`;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Length, percentage, or auto value.
|
|
212
|
+
*
|
|
213
|
+
* Used for properties that support auto values, such as `margin` and `inset`.
|
|
214
|
+
*
|
|
215
|
+
* @remarks
|
|
216
|
+
* - `number`: Fixed size in pixels
|
|
217
|
+
* - `"{number}%"`: Percentage of parent's size (0-100)
|
|
218
|
+
* - `"auto"`: Automatic value (behavior depends on property)
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import { Style, type LengthPercentageAuto, type Rect } from 'taffy-js';
|
|
223
|
+
*
|
|
224
|
+
* const style = new Style();
|
|
225
|
+
*
|
|
226
|
+
* // Auto margins for horizontal centering
|
|
227
|
+
* const centerMargin: Rect<LengthPercentageAuto> = {
|
|
228
|
+
* left: "auto",
|
|
229
|
+
* right: "auto",
|
|
230
|
+
* top: 0,
|
|
231
|
+
* bottom: 0
|
|
232
|
+
* };
|
|
233
|
+
*
|
|
234
|
+
* style.margin = centerMargin;
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
export type LengthPercentageAuto = number | `${number}%` | "auto";
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Point with x and y coordinates/values.
|
|
241
|
+
*
|
|
242
|
+
* Used for properties that have separate horizontal (x) and vertical (y) values,
|
|
243
|
+
* such as `overflow`.
|
|
244
|
+
*
|
|
245
|
+
* @typeParam T - The type of each coordinate
|
|
246
|
+
*
|
|
247
|
+
* @property x - The horizontal value
|
|
248
|
+
* @property y - The vertical value
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* import { Style, Overflow, type Point } from 'taffy-js';
|
|
253
|
+
*
|
|
254
|
+
* const style = new Style();
|
|
255
|
+
*
|
|
256
|
+
* const overflow: Point<typeof Overflow[keyof typeof Overflow]> = {
|
|
257
|
+
* x: Overflow.Hidden,
|
|
258
|
+
* y: Overflow.Scroll
|
|
259
|
+
* };
|
|
260
|
+
*
|
|
261
|
+
* style.overflow = overflow;
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
export interface Point<T> {
|
|
265
|
+
/** The horizontal (x-axis) value */
|
|
266
|
+
x: T;
|
|
267
|
+
/** The vertical (y-axis) value */
|
|
268
|
+
y: T;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Rectangle with left, right, top, and bottom values.
|
|
273
|
+
*
|
|
274
|
+
* Used for box model properties like `margin`, `padding`, `border`, and `inset`.
|
|
275
|
+
*
|
|
276
|
+
* @typeParam T - The type of each side value
|
|
277
|
+
*
|
|
278
|
+
* @property left - The left side value
|
|
279
|
+
* @property right - The right side value
|
|
280
|
+
* @property top - The top side value
|
|
281
|
+
* @property bottom - The bottom side value
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* import { Style, type Rect, type LengthPercentage, type LengthPercentageAuto } from 'taffy-js';
|
|
286
|
+
*
|
|
287
|
+
* const style = new Style();
|
|
288
|
+
*
|
|
289
|
+
* // Typed padding
|
|
290
|
+
* const padding: Rect<LengthPercentage> = {
|
|
291
|
+
* left: 10,
|
|
292
|
+
* right: 10,
|
|
293
|
+
* top: 10,
|
|
294
|
+
* bottom: 10
|
|
295
|
+
* };
|
|
296
|
+
*
|
|
297
|
+
* // Typed margin with auto
|
|
298
|
+
* const margin: Rect<LengthPercentageAuto> = {
|
|
299
|
+
* left: "auto",
|
|
300
|
+
* right: "auto",
|
|
301
|
+
* top: 10,
|
|
302
|
+
* bottom: 30
|
|
303
|
+
* };
|
|
304
|
+
*
|
|
305
|
+
* style.padding = padding;
|
|
306
|
+
* style.margin = margin;
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
export interface Rect<T> {
|
|
310
|
+
/** The left side value */
|
|
311
|
+
left: T;
|
|
312
|
+
/** The right side value */
|
|
313
|
+
right: T;
|
|
314
|
+
/** The top side value */
|
|
315
|
+
top: T;
|
|
316
|
+
/** The bottom side value */
|
|
317
|
+
bottom: T;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Detailed layout information (for grid layouts).
|
|
322
|
+
*
|
|
323
|
+
* Returned by `detailedLayoutInfo()` for nodes using CSS Grid layout.
|
|
324
|
+
* Contains detailed information about grid tracks and item placement.
|
|
325
|
+
*
|
|
326
|
+
* @remarks
|
|
327
|
+
* This is only available when the `detailed_layout_info` feature is enabled.
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* import type { DetailedLayoutInfo, DetailedGridInfo } from 'taffy-js';
|
|
332
|
+
*
|
|
333
|
+
* const info: DetailedLayoutInfo = tree.detailedLayoutInfo(gridNode);
|
|
334
|
+
*
|
|
335
|
+
* if (info !== "None" && typeof info === 'object' && 'Grid' in info) {
|
|
336
|
+
* const grid: DetailedGridInfo = info.Grid;
|
|
337
|
+
* console.log('Rows:', grid.rows.sizes);
|
|
338
|
+
* console.log('Columns:', grid.columns.sizes);
|
|
339
|
+
* }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export type DetailedLayoutInfo = DetailedGridInfo | null;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Detailed information about a grid layout.
|
|
346
|
+
*
|
|
347
|
+
* Contains information about grid rows, columns, and item placement.
|
|
348
|
+
*
|
|
349
|
+
* @property rows - Information about row tracks
|
|
350
|
+
* @property columns - Information about column tracks
|
|
351
|
+
* @property items - Array of item placement information
|
|
352
|
+
*/
|
|
353
|
+
export interface DetailedGridInfo {
|
|
354
|
+
/** Information about the grid's row tracks */
|
|
355
|
+
rows: DetailedGridTracksInfo;
|
|
356
|
+
/** Information about the grid's column tracks */
|
|
357
|
+
columns: DetailedGridTracksInfo;
|
|
358
|
+
/** Placement information for each grid item */
|
|
359
|
+
items: DetailedGridItemsInfo[];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Information about grid tracks (rows or columns).
|
|
364
|
+
*
|
|
365
|
+
* Provides detailed sizing and gutter information for a set of grid tracks.
|
|
366
|
+
*
|
|
367
|
+
* @property negative_implicit_tracks - Number of implicit tracks before explicit tracks
|
|
368
|
+
* @property explicit_tracks - Number of explicitly defined tracks
|
|
369
|
+
* @property positive_implicit_tracks - Number of implicit tracks after explicit tracks
|
|
370
|
+
* @property gutters - Array of gutter sizes between tracks (in pixels)
|
|
371
|
+
* @property sizes - Array of track sizes (in pixels)
|
|
372
|
+
*/
|
|
373
|
+
export interface DetailedGridTracksInfo {
|
|
374
|
+
/** Number of implicit tracks before explicit tracks (for negative line numbers) */
|
|
375
|
+
negative_implicit_tracks: number;
|
|
376
|
+
/** Number of tracks explicitly defined in grid-template-rows/columns */
|
|
377
|
+
explicit_tracks: number;
|
|
378
|
+
/** Number of implicit tracks created after explicit tracks */
|
|
379
|
+
positive_implicit_tracks: number;
|
|
380
|
+
/** Gap sizes between tracks in pixels */
|
|
381
|
+
gutters: number[];
|
|
382
|
+
/** Computed sizes of each track in pixels */
|
|
383
|
+
sizes: number[];
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Information about a grid item's placement.
|
|
388
|
+
*
|
|
389
|
+
* Specifies which grid lines the item spans on both axes.
|
|
390
|
+
* Line numbers are 1-indexed, with 1 being the first line.
|
|
391
|
+
*
|
|
392
|
+
* @property row_start - Starting row line number (1-indexed)
|
|
393
|
+
* @property row_end - Ending row line number (exclusive)
|
|
394
|
+
* @property column_start - Starting column line number (1-indexed)
|
|
395
|
+
* @property column_end - Ending column line number (exclusive)
|
|
396
|
+
*/
|
|
397
|
+
export interface DetailedGridItemsInfo {
|
|
398
|
+
/** Starting row line (1-indexed) */
|
|
399
|
+
row_start: number;
|
|
400
|
+
/** Ending row line (exclusive) */
|
|
401
|
+
row_end: number;
|
|
402
|
+
/** Starting column line (1-indexed) */
|
|
403
|
+
column_start: number;
|
|
404
|
+
/** Ending column line (exclusive) */
|
|
405
|
+
column_end: number;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Multi-line content alignment enumeration
|
|
412
|
+
*
|
|
413
|
+
* Controls the distribution of space between and around content items along the cross axis
|
|
414
|
+
* in a multi-line flex container. This corresponds to the CSS `align-content` property.
|
|
415
|
+
*
|
|
416
|
+
* **Note**: This property only has effect when `flex-wrap` is set to `Wrap` or `WrapReverse`.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* import { AlignContent, FlexWrap } from 'taffy-js';
|
|
421
|
+
*
|
|
422
|
+
* style.flexWrap = FlexWrap.Wrap;
|
|
423
|
+
* style.alignContent = AlignContent.SpaceBetween; // Distribute lines evenly
|
|
424
|
+
* ```
|
|
6
425
|
*/
|
|
7
426
|
export enum AlignContent {
|
|
8
427
|
/**
|
|
9
|
-
* Lines
|
|
428
|
+
* Lines packed toward the start of the cross axis
|
|
10
429
|
*/
|
|
11
430
|
Start = 0,
|
|
12
431
|
/**
|
|
13
|
-
* Lines
|
|
432
|
+
* Lines packed toward the end of the cross axis
|
|
14
433
|
*/
|
|
15
434
|
End = 1,
|
|
16
435
|
/**
|
|
17
|
-
* Lines
|
|
436
|
+
* Lines packed toward the start of the flex container
|
|
18
437
|
*/
|
|
19
438
|
FlexStart = 2,
|
|
20
439
|
/**
|
|
21
|
-
* Lines
|
|
440
|
+
* Lines packed toward the end of the flex container
|
|
22
441
|
*/
|
|
23
442
|
FlexEnd = 3,
|
|
24
443
|
/**
|
|
25
|
-
* Lines
|
|
444
|
+
* Lines centered within the container
|
|
26
445
|
*/
|
|
27
446
|
Center = 4,
|
|
28
447
|
/**
|
|
29
|
-
* Lines
|
|
448
|
+
* Lines stretched to fill the container
|
|
30
449
|
*/
|
|
31
|
-
|
|
450
|
+
Stretch = 5,
|
|
32
451
|
/**
|
|
33
|
-
* Lines
|
|
452
|
+
* Lines evenly distributed with first/last at edges
|
|
34
453
|
*/
|
|
35
|
-
|
|
454
|
+
SpaceBetween = 6,
|
|
36
455
|
/**
|
|
37
|
-
* Lines
|
|
456
|
+
* Lines evenly distributed with equal space around each
|
|
38
457
|
*/
|
|
39
|
-
|
|
458
|
+
SpaceAround = 7,
|
|
40
459
|
/**
|
|
41
|
-
* Lines
|
|
460
|
+
* Lines evenly distributed with equal space between each
|
|
42
461
|
*/
|
|
43
|
-
|
|
462
|
+
SpaceEvenly = 8,
|
|
44
463
|
}
|
|
45
464
|
|
|
46
465
|
/**
|
|
47
|
-
*
|
|
466
|
+
* Cross-axis alignment enumeration for all children
|
|
467
|
+
*
|
|
468
|
+
* Defines the default alignment for all flex/grid items along the cross axis.
|
|
469
|
+
* This corresponds to the CSS `align-items` property.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```typescript
|
|
473
|
+
* import { AlignItems } from 'taffy-js';
|
|
474
|
+
*
|
|
475
|
+
* style.alignItems = AlignItems.Center; // Center items on cross axis
|
|
476
|
+
* style.alignItems = AlignItems.Stretch; // Stretch items to fill container
|
|
477
|
+
* ```
|
|
48
478
|
*/
|
|
49
479
|
export enum AlignItems {
|
|
50
480
|
/**
|
|
51
|
-
* Items
|
|
481
|
+
* Items aligned to the start of the cross axis
|
|
52
482
|
*/
|
|
53
483
|
Start = 0,
|
|
54
484
|
/**
|
|
55
|
-
* Items
|
|
485
|
+
* Items aligned to the end of the cross axis
|
|
56
486
|
*/
|
|
57
487
|
End = 1,
|
|
58
488
|
/**
|
|
59
|
-
* Items
|
|
489
|
+
* Items aligned to the start of the flex container
|
|
60
490
|
*/
|
|
61
491
|
FlexStart = 2,
|
|
62
492
|
/**
|
|
63
|
-
* Items
|
|
493
|
+
* Items aligned to the end of the flex container
|
|
64
494
|
*/
|
|
65
495
|
FlexEnd = 3,
|
|
66
496
|
/**
|
|
67
|
-
* Items
|
|
497
|
+
* Items centered along the cross axis
|
|
68
498
|
*/
|
|
69
499
|
Center = 4,
|
|
70
500
|
/**
|
|
71
|
-
* Items
|
|
501
|
+
* Items aligned to their text baselines
|
|
72
502
|
*/
|
|
73
503
|
Baseline = 5,
|
|
74
504
|
/**
|
|
75
|
-
* Items
|
|
505
|
+
* Items stretched to fill the container
|
|
76
506
|
*/
|
|
77
507
|
Stretch = 6,
|
|
78
508
|
}
|
|
79
509
|
|
|
80
510
|
/**
|
|
81
|
-
*
|
|
511
|
+
* Cross-axis alignment enumeration for a single element
|
|
512
|
+
*
|
|
513
|
+
* Overrides the parent's `align-items` value for a specific child element.
|
|
514
|
+
* This corresponds to the CSS `align-self` property.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```typescript
|
|
518
|
+
* import { AlignSelf } from 'taffy-js';
|
|
519
|
+
*
|
|
520
|
+
* style.alignSelf = AlignSelf.Auto; // Use parent's align-items
|
|
521
|
+
* style.alignSelf = AlignSelf.Center; // Override to center this item
|
|
522
|
+
* ```
|
|
82
523
|
*/
|
|
83
524
|
export enum AlignSelf {
|
|
84
525
|
/**
|
|
85
|
-
*
|
|
86
|
-
*/
|
|
87
|
-
Start = 0,
|
|
88
|
-
/**
|
|
89
|
-
* Items are aligned at the end of the cross axis.
|
|
90
|
-
*/
|
|
91
|
-
End = 1,
|
|
92
|
-
/**
|
|
93
|
-
* Items are aligned at the start of the flex-direction cross axis.
|
|
94
|
-
*/
|
|
95
|
-
FlexStart = 2,
|
|
96
|
-
/**
|
|
97
|
-
* Items are aligned at the end of the flex-direction cross axis.
|
|
98
|
-
*/
|
|
99
|
-
FlexEnd = 3,
|
|
100
|
-
/**
|
|
101
|
-
* Items are aligned at the center of the cross axis.
|
|
526
|
+
* Inherits the parent container's `align-items` value
|
|
102
527
|
*/
|
|
103
|
-
|
|
528
|
+
Auto = 0,
|
|
104
529
|
/**
|
|
105
|
-
*
|
|
530
|
+
* Item aligned to the start of the cross axis
|
|
106
531
|
*/
|
|
107
|
-
|
|
532
|
+
Start = 1,
|
|
108
533
|
/**
|
|
109
|
-
*
|
|
534
|
+
* Item aligned to the end of the cross axis
|
|
110
535
|
*/
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export class AvailableSpace {
|
|
115
|
-
private constructor();
|
|
116
|
-
free(): void;
|
|
117
|
-
[Symbol.dispose](): void;
|
|
118
|
-
/**
|
|
119
|
-
* The available width (None means undefined/max-content).
|
|
120
|
-
*/
|
|
121
|
-
get width(): number | undefined;
|
|
536
|
+
End = 2,
|
|
122
537
|
/**
|
|
123
|
-
*
|
|
538
|
+
* Item aligned to the start of the flex container
|
|
124
539
|
*/
|
|
125
|
-
|
|
540
|
+
FlexStart = 3,
|
|
126
541
|
/**
|
|
127
|
-
*
|
|
542
|
+
* Item aligned to the end of the flex container
|
|
128
543
|
*/
|
|
129
|
-
|
|
544
|
+
FlexEnd = 4,
|
|
130
545
|
/**
|
|
131
|
-
*
|
|
546
|
+
* Item centered along the cross axis
|
|
132
547
|
*/
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export class Dimension {
|
|
137
|
-
private constructor();
|
|
138
|
-
free(): void;
|
|
139
|
-
[Symbol.dispose](): void;
|
|
548
|
+
Center = 5,
|
|
140
549
|
/**
|
|
141
|
-
*
|
|
142
|
-
* - For `Pixels`, this is the number of pixels.
|
|
143
|
-
* - For `Percent`, this is the percentage value (0.0 to 100.0, or sometimes 0.0 to 1.0 depending on context, handled by internal logic).
|
|
144
|
-
* - For `Auto`, this value is typically ignored.
|
|
550
|
+
* Item aligned to its text baseline
|
|
145
551
|
*/
|
|
146
|
-
|
|
552
|
+
Baseline = 6,
|
|
147
553
|
/**
|
|
148
|
-
*
|
|
554
|
+
* Item stretched to fill the container
|
|
149
555
|
*/
|
|
150
|
-
|
|
556
|
+
Stretch = 7,
|
|
151
557
|
}
|
|
152
558
|
|
|
153
559
|
/**
|
|
154
|
-
*
|
|
560
|
+
* Box sizing enumeration
|
|
561
|
+
*
|
|
562
|
+
* Controls how the total width and height of an element is calculated.
|
|
563
|
+
* This corresponds to the CSS `box-sizing` property.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```typescript
|
|
567
|
+
* import { BoxSizing } from 'taffy-js';
|
|
568
|
+
*
|
|
569
|
+
* style.boxSizing = BoxSizing.BorderBox; // Size includes padding and border
|
|
570
|
+
* style.boxSizing = BoxSizing.ContentBox; // Size is content only
|
|
571
|
+
* ```
|
|
155
572
|
*/
|
|
156
|
-
export enum
|
|
157
|
-
/**
|
|
158
|
-
* The dimension is specified in logical pixels.
|
|
159
|
-
*/
|
|
160
|
-
Pixels = 0,
|
|
573
|
+
export enum BoxSizing {
|
|
161
574
|
/**
|
|
162
|
-
* The
|
|
575
|
+
* The width and height properties include padding and border
|
|
163
576
|
*/
|
|
164
|
-
|
|
577
|
+
BorderBox = 0,
|
|
165
578
|
/**
|
|
166
|
-
* The
|
|
579
|
+
* The width and height properties include only the content
|
|
167
580
|
*/
|
|
168
|
-
|
|
581
|
+
ContentBox = 1,
|
|
169
582
|
}
|
|
170
583
|
|
|
171
584
|
/**
|
|
172
|
-
*
|
|
585
|
+
* Display mode enumeration
|
|
586
|
+
*
|
|
587
|
+
* Controls the layout algorithm type for an element. This corresponds to the CSS `display` property
|
|
588
|
+
* and determines how an element and its children are laid out.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* import { Display } from 'taffy-js';
|
|
593
|
+
*
|
|
594
|
+
* style.display = Display.Flex; // Enable flexbox layout
|
|
595
|
+
* style.display = Display.Grid; // Enable grid layout
|
|
596
|
+
* style.display = Display.None; // Hide element from layout
|
|
597
|
+
* ```
|
|
173
598
|
*/
|
|
174
599
|
export enum Display {
|
|
175
600
|
/**
|
|
176
|
-
*
|
|
601
|
+
* Block-level layout where element takes the full available width
|
|
177
602
|
*/
|
|
178
|
-
|
|
603
|
+
Block = 0,
|
|
179
604
|
/**
|
|
180
|
-
*
|
|
605
|
+
* Flexbox layout for one-dimensional item arrangement
|
|
181
606
|
*/
|
|
182
607
|
Flex = 1,
|
|
183
608
|
/**
|
|
184
|
-
*
|
|
609
|
+
* CSS Grid layout for two-dimensional item arrangement
|
|
185
610
|
*/
|
|
186
611
|
Grid = 2,
|
|
187
612
|
/**
|
|
188
|
-
*
|
|
613
|
+
* Element is removed from layout calculation entirely
|
|
189
614
|
*/
|
|
190
|
-
|
|
615
|
+
None = 3,
|
|
191
616
|
}
|
|
192
617
|
|
|
193
618
|
/**
|
|
194
|
-
*
|
|
619
|
+
* Flex direction enumeration
|
|
620
|
+
*
|
|
621
|
+
* Defines the main axis direction for flex item layout. This corresponds to the CSS
|
|
622
|
+
* `flex-direction` property and determines how flex items are placed within the container.
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* ```typescript
|
|
626
|
+
* import { FlexDirection } from 'taffy-js';
|
|
627
|
+
*
|
|
628
|
+
* style.flexDirection = FlexDirection.Row; // Horizontal, left to right
|
|
629
|
+
* style.flexDirection = FlexDirection.Column; // Vertical, top to bottom
|
|
630
|
+
* ```
|
|
195
631
|
*/
|
|
196
632
|
export enum FlexDirection {
|
|
197
633
|
/**
|
|
198
|
-
*
|
|
634
|
+
* Main axis runs horizontally from left to right
|
|
199
635
|
*/
|
|
200
636
|
Row = 0,
|
|
201
637
|
/**
|
|
202
|
-
*
|
|
638
|
+
* Main axis runs vertically from top to bottom
|
|
203
639
|
*/
|
|
204
640
|
Column = 1,
|
|
205
641
|
/**
|
|
206
|
-
*
|
|
642
|
+
* Main axis runs horizontally from right to left
|
|
207
643
|
*/
|
|
208
644
|
RowReverse = 2,
|
|
209
645
|
/**
|
|
210
|
-
*
|
|
646
|
+
* Main axis runs vertically from bottom to top
|
|
211
647
|
*/
|
|
212
648
|
ColumnReverse = 3,
|
|
213
649
|
}
|
|
214
650
|
|
|
215
651
|
/**
|
|
216
|
-
*
|
|
652
|
+
* Flex wrap mode enumeration
|
|
653
|
+
*
|
|
654
|
+
* Controls whether flex items wrap onto multiple lines when they overflow the container.
|
|
655
|
+
* This corresponds to the CSS `flex-wrap` property.
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* ```typescript
|
|
659
|
+
* import { FlexWrap } from 'taffy-js';
|
|
660
|
+
*
|
|
661
|
+
* style.flexWrap = FlexWrap.NoWrap; // All items on single line
|
|
662
|
+
* style.flexWrap = FlexWrap.Wrap; // Items wrap to new lines
|
|
663
|
+
* ```
|
|
217
664
|
*/
|
|
218
665
|
export enum FlexWrap {
|
|
219
666
|
/**
|
|
220
|
-
*
|
|
667
|
+
* All flex items are placed on a single line
|
|
221
668
|
*/
|
|
222
669
|
NoWrap = 0,
|
|
223
670
|
/**
|
|
224
|
-
*
|
|
671
|
+
* Flex items wrap onto multiple lines from top to bottom
|
|
225
672
|
*/
|
|
226
673
|
Wrap = 1,
|
|
227
674
|
/**
|
|
228
|
-
*
|
|
675
|
+
* Flex items wrap onto multiple lines from bottom to top
|
|
229
676
|
*/
|
|
230
677
|
WrapReverse = 2,
|
|
231
678
|
}
|
|
232
679
|
|
|
233
680
|
/**
|
|
234
|
-
*
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* Items are placed by filling each row, attempting to fill holes earlier in the grid.
|
|
247
|
-
*/
|
|
248
|
-
RowDense = 2,
|
|
249
|
-
/**
|
|
250
|
-
* Items are placed by filling each column, attempting to fill holes earlier in the grid.
|
|
251
|
-
*/
|
|
252
|
-
ColumnDense = 3,
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* How items are distributed along the main axis.
|
|
681
|
+
* Main axis alignment enumeration
|
|
682
|
+
*
|
|
683
|
+
* Defines how flex items are aligned and spaced along the main axis.
|
|
684
|
+
* This corresponds to the CSS `justify-content` property.
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```typescript
|
|
688
|
+
* import { JustifyContent } from 'taffy-js';
|
|
689
|
+
*
|
|
690
|
+
* style.justifyContent = JustifyContent.Center; // Center items
|
|
691
|
+
* style.justifyContent = JustifyContent.SpaceBetween; // Distribute evenly
|
|
692
|
+
* ```
|
|
257
693
|
*/
|
|
258
694
|
export enum JustifyContent {
|
|
259
695
|
/**
|
|
260
|
-
* Items
|
|
696
|
+
* Items packed toward the start of the main axis
|
|
261
697
|
*/
|
|
262
698
|
Start = 0,
|
|
263
699
|
/**
|
|
264
|
-
* Items
|
|
700
|
+
* Items packed toward the end of the main axis
|
|
265
701
|
*/
|
|
266
702
|
End = 1,
|
|
267
703
|
/**
|
|
268
|
-
* Items
|
|
704
|
+
* Items packed toward the start of the flex container
|
|
269
705
|
*/
|
|
270
706
|
FlexStart = 2,
|
|
271
707
|
/**
|
|
272
|
-
* Items
|
|
708
|
+
* Items packed toward the end of the flex container
|
|
273
709
|
*/
|
|
274
710
|
FlexEnd = 3,
|
|
275
711
|
/**
|
|
276
|
-
* Items
|
|
712
|
+
* Items centered along the main axis
|
|
277
713
|
*/
|
|
278
714
|
Center = 4,
|
|
279
715
|
/**
|
|
280
|
-
* Items
|
|
281
|
-
*/
|
|
282
|
-
SpaceBetween = 5,
|
|
283
|
-
/**
|
|
284
|
-
* Items are evenly distributed with equal space around them.
|
|
285
|
-
*/
|
|
286
|
-
SpaceAround = 6,
|
|
287
|
-
/**
|
|
288
|
-
* Items are evenly distributed with equal space between them using the same gap at ends.
|
|
289
|
-
*/
|
|
290
|
-
SpaceEvenly = 7,
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export class Layout {
|
|
294
|
-
private constructor();
|
|
295
|
-
free(): void;
|
|
296
|
-
[Symbol.dispose](): void;
|
|
297
|
-
/**
|
|
298
|
-
* The absolute x-coordinate of the node relative to its parent.
|
|
299
|
-
*/
|
|
300
|
-
x: number;
|
|
301
|
-
/**
|
|
302
|
-
* The absolute y-coordinate of the node relative to its parent.
|
|
303
|
-
*/
|
|
304
|
-
y: number;
|
|
305
|
-
/**
|
|
306
|
-
* The computed width of the node.
|
|
307
|
-
*/
|
|
308
|
-
width: number;
|
|
309
|
-
/**
|
|
310
|
-
* The computed height of the node.
|
|
311
|
-
*/
|
|
312
|
-
height: number;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export class Line {
|
|
316
|
-
private constructor();
|
|
317
|
-
free(): void;
|
|
318
|
-
[Symbol.dispose](): void;
|
|
319
|
-
/**
|
|
320
|
-
* The start line index (1-based).
|
|
321
|
-
*/
|
|
322
|
-
get start(): number | undefined;
|
|
323
|
-
/**
|
|
324
|
-
* The start line index (1-based).
|
|
716
|
+
* Items stretched along the main axis
|
|
325
717
|
*/
|
|
326
|
-
|
|
718
|
+
Stretch = 5,
|
|
327
719
|
/**
|
|
328
|
-
*
|
|
720
|
+
* Items evenly distributed with first/last at edges
|
|
329
721
|
*/
|
|
330
|
-
|
|
722
|
+
SpaceBetween = 6,
|
|
331
723
|
/**
|
|
332
|
-
*
|
|
724
|
+
* Items evenly distributed with equal space around each
|
|
333
725
|
*/
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export class Point {
|
|
338
|
-
private constructor();
|
|
339
|
-
free(): void;
|
|
340
|
-
[Symbol.dispose](): void;
|
|
341
|
-
/**
|
|
342
|
-
* The x-coordinate (horizontal).
|
|
343
|
-
*/
|
|
344
|
-
x: number;
|
|
726
|
+
SpaceAround = 7,
|
|
345
727
|
/**
|
|
346
|
-
*
|
|
728
|
+
* Items evenly distributed with equal space between each
|
|
347
729
|
*/
|
|
348
|
-
|
|
730
|
+
SpaceEvenly = 8,
|
|
349
731
|
}
|
|
350
732
|
|
|
351
733
|
/**
|
|
352
|
-
*
|
|
734
|
+
* Computed layout result containing position, size, and spacing values for a node.
|
|
735
|
+
*
|
|
736
|
+
* This class wraps the native [`taffy::Layout`] and provides read-only access
|
|
737
|
+
* to all computed layout values. All dimensions are in pixels.
|
|
738
|
+
*
|
|
739
|
+
* @example
|
|
740
|
+
* ```typescript
|
|
741
|
+
* const layout = tree.getLayout(node);
|
|
742
|
+
*
|
|
743
|
+
* console.log("Position:", layout.x, layout.y);
|
|
744
|
+
* console.log("Size:", layout.width, layout.height);
|
|
745
|
+
* console.log("Content:", layout.contentWidth, layout.contentHeight);
|
|
746
|
+
* console.log("Padding:", layout.paddingTop, layout.paddingRight, layout.paddingBottom, layout.paddingLeft);
|
|
747
|
+
* console.log("Border:", layout.borderTop, layout.borderRight, layout.borderBottom, layout.borderLeft);
|
|
748
|
+
* console.log("Margin:", layout.marginTop, layout.marginRight, layout.marginBottom, layout.marginLeft);
|
|
749
|
+
* console.log("Scrollbar:", layout.scrollbarWidth, layout.scrollbarHeight);
|
|
750
|
+
* console.log("Order:", layout.order);
|
|
751
|
+
* ```
|
|
353
752
|
*/
|
|
354
|
-
export
|
|
355
|
-
/**
|
|
356
|
-
* Relative to its normal position in the flow.
|
|
357
|
-
*/
|
|
358
|
-
Static = 0,
|
|
359
|
-
/**
|
|
360
|
-
* Relative to its normal position in the flow.
|
|
361
|
-
*/
|
|
362
|
-
Relative = 1,
|
|
363
|
-
/**
|
|
364
|
-
* Removed from the flow and positioned relative to its containing block.
|
|
365
|
-
*/
|
|
366
|
-
Absolute = 2,
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
export class Rect {
|
|
370
|
-
private constructor();
|
|
371
|
-
free(): void;
|
|
372
|
-
[Symbol.dispose](): void;
|
|
373
|
-
/**
|
|
374
|
-
* The left edge value.
|
|
375
|
-
*/
|
|
376
|
-
left: number;
|
|
377
|
-
/**
|
|
378
|
-
* The right edge value.
|
|
379
|
-
*/
|
|
380
|
-
right: number;
|
|
381
|
-
/**
|
|
382
|
-
* The top edge value.
|
|
383
|
-
*/
|
|
384
|
-
top: number;
|
|
385
|
-
/**
|
|
386
|
-
* The bottom edge value.
|
|
387
|
-
*/
|
|
388
|
-
bottom: number;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export class Size {
|
|
392
|
-
private constructor();
|
|
393
|
-
free(): void;
|
|
394
|
-
[Symbol.dispose](): void;
|
|
395
|
-
/**
|
|
396
|
-
* The width dimension.
|
|
397
|
-
*/
|
|
398
|
-
width: number;
|
|
399
|
-
/**
|
|
400
|
-
* The height dimension.
|
|
401
|
-
*/
|
|
402
|
-
height: number;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
export class Style {
|
|
753
|
+
export class Layout {
|
|
406
754
|
private constructor();
|
|
407
755
|
free(): void;
|
|
408
756
|
[Symbol.dispose](): void;
|
|
409
757
|
/**
|
|
410
|
-
*
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* The display mode of the node (e.g. Flex, Grid, None).
|
|
415
|
-
*/
|
|
416
|
-
set display(value: Display | null | undefined);
|
|
417
|
-
/**
|
|
418
|
-
* The positioning strategy (e.g. Relative, Absolute).
|
|
419
|
-
*/
|
|
420
|
-
get position(): Position | undefined;
|
|
421
|
-
/**
|
|
422
|
-
* The positioning strategy (e.g. Relative, Absolute).
|
|
423
|
-
*/
|
|
424
|
-
set position(value: Position | null | undefined);
|
|
425
|
-
/**
|
|
426
|
-
* The width of the node.
|
|
427
|
-
*/
|
|
428
|
-
get width(): Dimension | undefined;
|
|
429
|
-
/**
|
|
430
|
-
* The width of the node.
|
|
431
|
-
*/
|
|
432
|
-
set width(value: Dimension | null | undefined);
|
|
433
|
-
/**
|
|
434
|
-
* The height of the node.
|
|
435
|
-
*/
|
|
436
|
-
get height(): Dimension | undefined;
|
|
437
|
-
/**
|
|
438
|
-
* The height of the node.
|
|
439
|
-
*/
|
|
440
|
-
set height(value: Dimension | null | undefined);
|
|
441
|
-
/**
|
|
442
|
-
* The minimum width of the node.
|
|
443
|
-
*/
|
|
444
|
-
get min_width(): Dimension | undefined;
|
|
445
|
-
/**
|
|
446
|
-
* The minimum width of the node.
|
|
447
|
-
*/
|
|
448
|
-
set min_width(value: Dimension | null | undefined);
|
|
449
|
-
/**
|
|
450
|
-
* The minimum height of the node.
|
|
451
|
-
*/
|
|
452
|
-
get min_height(): Dimension | undefined;
|
|
453
|
-
/**
|
|
454
|
-
* The minimum height of the node.
|
|
455
|
-
*/
|
|
456
|
-
set min_height(value: Dimension | null | undefined);
|
|
457
|
-
/**
|
|
458
|
-
* The maximum width of the node.
|
|
459
|
-
*/
|
|
460
|
-
get max_width(): Dimension | undefined;
|
|
461
|
-
/**
|
|
462
|
-
* The maximum width of the node.
|
|
463
|
-
*/
|
|
464
|
-
set max_width(value: Dimension | null | undefined);
|
|
465
|
-
/**
|
|
466
|
-
* The maximum height of the node.
|
|
467
|
-
*/
|
|
468
|
-
get max_height(): Dimension | undefined;
|
|
469
|
-
/**
|
|
470
|
-
* The maximum height of the node.
|
|
471
|
-
*/
|
|
472
|
-
set max_height(value: Dimension | null | undefined);
|
|
473
|
-
/**
|
|
474
|
-
* The offset from the left edge (used with Position::Absolute/Relative).
|
|
475
|
-
*/
|
|
476
|
-
get left(): Dimension | undefined;
|
|
477
|
-
/**
|
|
478
|
-
* The offset from the left edge (used with Position::Absolute/Relative).
|
|
479
|
-
*/
|
|
480
|
-
set left(value: Dimension | null | undefined);
|
|
481
|
-
/**
|
|
482
|
-
* The offset from the right edge.
|
|
483
|
-
*/
|
|
484
|
-
get right(): Dimension | undefined;
|
|
485
|
-
/**
|
|
486
|
-
* The offset from the right edge.
|
|
487
|
-
*/
|
|
488
|
-
set right(value: Dimension | null | undefined);
|
|
489
|
-
/**
|
|
490
|
-
* The offset from the top edge.
|
|
491
|
-
*/
|
|
492
|
-
get top(): Dimension | undefined;
|
|
493
|
-
/**
|
|
494
|
-
* The offset from the top edge.
|
|
495
|
-
*/
|
|
496
|
-
set top(value: Dimension | null | undefined);
|
|
497
|
-
/**
|
|
498
|
-
* The offset from the bottom edge.
|
|
499
|
-
*/
|
|
500
|
-
get bottom(): Dimension | undefined;
|
|
501
|
-
/**
|
|
502
|
-
* The offset from the bottom edge.
|
|
503
|
-
*/
|
|
504
|
-
set bottom(value: Dimension | null | undefined);
|
|
505
|
-
/**
|
|
506
|
-
* The margin on the left side.
|
|
507
|
-
*/
|
|
508
|
-
get margin_left(): Dimension | undefined;
|
|
509
|
-
/**
|
|
510
|
-
* The margin on the left side.
|
|
758
|
+
* Gets the top border width
|
|
759
|
+
*
|
|
760
|
+
* @returns - The computed top border width in pixels
|
|
511
761
|
*/
|
|
512
|
-
|
|
762
|
+
readonly borderTop: number;
|
|
513
763
|
/**
|
|
514
|
-
*
|
|
764
|
+
* Gets the top margin
|
|
765
|
+
*
|
|
766
|
+
* @returns - The computed top margin in pixels
|
|
515
767
|
*/
|
|
516
|
-
|
|
768
|
+
readonly marginTop: number;
|
|
517
769
|
/**
|
|
518
|
-
*
|
|
770
|
+
* Gets the left border width
|
|
771
|
+
*
|
|
772
|
+
* @returns - The computed left border width in pixels
|
|
519
773
|
*/
|
|
520
|
-
|
|
774
|
+
readonly borderLeft: number;
|
|
521
775
|
/**
|
|
522
|
-
*
|
|
776
|
+
* Gets the left margin
|
|
777
|
+
*
|
|
778
|
+
* @returns - The computed left margin in pixels
|
|
523
779
|
*/
|
|
524
|
-
|
|
780
|
+
readonly marginLeft: number;
|
|
525
781
|
/**
|
|
526
|
-
*
|
|
782
|
+
* Gets the top padding
|
|
783
|
+
*
|
|
784
|
+
* @returns - The computed top padding in pixels
|
|
527
785
|
*/
|
|
528
|
-
|
|
786
|
+
readonly paddingTop: number;
|
|
529
787
|
/**
|
|
530
|
-
*
|
|
788
|
+
* Gets the right border width
|
|
789
|
+
*
|
|
790
|
+
* @returns - The computed right border width in pixels
|
|
531
791
|
*/
|
|
532
|
-
|
|
792
|
+
readonly borderRight: number;
|
|
533
793
|
/**
|
|
534
|
-
*
|
|
794
|
+
* Gets the right margin
|
|
795
|
+
*
|
|
796
|
+
* @returns - The computed right margin in pixels
|
|
535
797
|
*/
|
|
536
|
-
|
|
798
|
+
readonly marginRight: number;
|
|
537
799
|
/**
|
|
538
|
-
*
|
|
800
|
+
* Gets the left padding
|
|
801
|
+
*
|
|
802
|
+
* @returns - The computed left padding in pixels
|
|
539
803
|
*/
|
|
540
|
-
|
|
804
|
+
readonly paddingLeft: number;
|
|
541
805
|
/**
|
|
542
|
-
*
|
|
806
|
+
* Gets the bottom border width
|
|
807
|
+
*
|
|
808
|
+
* @returns - The computed bottom border width in pixels
|
|
543
809
|
*/
|
|
544
|
-
|
|
810
|
+
readonly borderBottom: number;
|
|
545
811
|
/**
|
|
546
|
-
*
|
|
812
|
+
* Gets the width of the scrollable content
|
|
813
|
+
*
|
|
814
|
+
* If the node has overflow content, this represents the total
|
|
815
|
+
* width of all content (may exceed `width`).
|
|
816
|
+
*
|
|
817
|
+
* @returns - The content width in pixels
|
|
547
818
|
*/
|
|
548
|
-
|
|
819
|
+
readonly contentWidth: number;
|
|
549
820
|
/**
|
|
550
|
-
*
|
|
821
|
+
* Gets the bottom margin
|
|
822
|
+
*
|
|
823
|
+
* @returns - The computed bottom margin in pixels
|
|
551
824
|
*/
|
|
552
|
-
|
|
825
|
+
readonly marginBottom: number;
|
|
553
826
|
/**
|
|
554
|
-
*
|
|
827
|
+
* Gets the right padding
|
|
828
|
+
*
|
|
829
|
+
* @returns - The computed right padding in pixels
|
|
555
830
|
*/
|
|
556
|
-
|
|
831
|
+
readonly paddingRight: number;
|
|
557
832
|
/**
|
|
558
|
-
*
|
|
833
|
+
* Gets the height of the scrollable content
|
|
834
|
+
*
|
|
835
|
+
* If the node has overflow content, this represents the total
|
|
836
|
+
* height of all content (may exceed `height`).
|
|
837
|
+
*
|
|
838
|
+
* @returns - The content height in pixels
|
|
559
839
|
*/
|
|
560
|
-
|
|
840
|
+
readonly contentHeight: number;
|
|
561
841
|
/**
|
|
562
|
-
*
|
|
842
|
+
* Gets the bottom padding
|
|
843
|
+
*
|
|
844
|
+
* @returns - The computed bottom padding in pixels
|
|
563
845
|
*/
|
|
564
|
-
|
|
846
|
+
readonly paddingBottom: number;
|
|
565
847
|
/**
|
|
566
|
-
*
|
|
848
|
+
* Gets the width of the vertical scrollbar
|
|
849
|
+
*
|
|
850
|
+
* When overflow is set to scroll, this indicates the space
|
|
851
|
+
* reserved for the vertical scrollbar.
|
|
852
|
+
*
|
|
853
|
+
* @returns - The scrollbar width in pixels (0 if no scrollbar)
|
|
567
854
|
*/
|
|
568
|
-
|
|
855
|
+
readonly scrollbarWidth: number;
|
|
569
856
|
/**
|
|
570
|
-
*
|
|
857
|
+
* Gets the height of the horizontal scrollbar
|
|
858
|
+
*
|
|
859
|
+
* When overflow is set to scroll, this indicates the space
|
|
860
|
+
* reserved for the horizontal scrollbar.
|
|
861
|
+
*
|
|
862
|
+
* @returns - The scrollbar height in pixels (0 if no scrollbar)
|
|
571
863
|
*/
|
|
572
|
-
|
|
864
|
+
readonly scrollbarHeight: number;
|
|
573
865
|
/**
|
|
574
|
-
*
|
|
866
|
+
* Gets the X coordinate of the node's top-left corner
|
|
867
|
+
*
|
|
868
|
+
* This value is relative to the node's parent. For the root node,
|
|
869
|
+
* this is always 0.
|
|
870
|
+
*
|
|
871
|
+
* @returns - The horizontal position in pixels
|
|
575
872
|
*/
|
|
576
|
-
|
|
873
|
+
readonly x: number;
|
|
577
874
|
/**
|
|
578
|
-
*
|
|
875
|
+
* Gets the Y coordinate of the node's top-left corner
|
|
876
|
+
*
|
|
877
|
+
* This value is relative to the node's parent. For the root node,
|
|
878
|
+
* this is always 0.
|
|
879
|
+
*
|
|
880
|
+
* @returns - The vertical position in pixels
|
|
579
881
|
*/
|
|
580
|
-
|
|
882
|
+
readonly y: number;
|
|
581
883
|
/**
|
|
582
|
-
*
|
|
884
|
+
* Gets the rendering order of the node
|
|
885
|
+
*
|
|
886
|
+
* This value determines the z-order for overlapping elements.
|
|
887
|
+
* Lower values are rendered first (behind higher values).
|
|
888
|
+
*
|
|
889
|
+
* @returns - The rendering order as an unsigned 32-bit integer
|
|
583
890
|
*/
|
|
584
|
-
|
|
891
|
+
readonly order: number;
|
|
585
892
|
/**
|
|
586
|
-
*
|
|
893
|
+
* Gets the computed width of the node
|
|
894
|
+
*
|
|
895
|
+
* This is the final width after layout computation, including
|
|
896
|
+
* any constraints from min/max size or flex properties.
|
|
897
|
+
*
|
|
898
|
+
* @returns - The width in pixels
|
|
587
899
|
*/
|
|
588
|
-
|
|
900
|
+
readonly width: number;
|
|
589
901
|
/**
|
|
590
|
-
*
|
|
902
|
+
* Gets the computed height of the node
|
|
903
|
+
*
|
|
904
|
+
* This is the final height after layout computation, including
|
|
905
|
+
* any constraints from min/max size or flex properties.
|
|
906
|
+
*
|
|
907
|
+
* @returns - The height in pixels
|
|
591
908
|
*/
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* How items are distributed along the main axis.
|
|
611
|
-
*/
|
|
612
|
-
get justify_content(): JustifyContent | undefined;
|
|
613
|
-
/**
|
|
614
|
-
* How items are distributed along the main axis.
|
|
615
|
-
*/
|
|
616
|
-
set justify_content(value: JustifyContent | null | undefined);
|
|
909
|
+
readonly height: number;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Overflow handling enumeration
|
|
914
|
+
*
|
|
915
|
+
* Defines how content that exceeds the container boundaries is handled.
|
|
916
|
+
* This corresponds to the CSS `overflow` property.
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```typescript
|
|
920
|
+
* import { Overflow } from 'taffy-js';
|
|
921
|
+
*
|
|
922
|
+
* style.overflow = { x: Overflow.Hidden, y: Overflow.Scroll };
|
|
923
|
+
* ```
|
|
924
|
+
*/
|
|
925
|
+
export enum Overflow {
|
|
617
926
|
/**
|
|
618
|
-
*
|
|
927
|
+
* Content is not clipped and may render outside the container
|
|
619
928
|
*/
|
|
620
|
-
|
|
929
|
+
Visible = 0,
|
|
621
930
|
/**
|
|
622
|
-
*
|
|
931
|
+
* Content is clipped at the container boundary
|
|
623
932
|
*/
|
|
624
|
-
|
|
933
|
+
Hidden = 1,
|
|
625
934
|
/**
|
|
626
|
-
*
|
|
935
|
+
* Always display scrollbars for scrollable content
|
|
627
936
|
*/
|
|
628
|
-
|
|
937
|
+
Scroll = 2,
|
|
629
938
|
/**
|
|
630
|
-
*
|
|
939
|
+
* Display scrollbars only when content overflows (internally maps to Scroll)
|
|
631
940
|
*/
|
|
632
|
-
|
|
941
|
+
Auto = 3,
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Position mode enumeration
|
|
946
|
+
*
|
|
947
|
+
* Controls how an element is positioned within its parent container.
|
|
948
|
+
* This corresponds to the CSS `position` property.
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```typescript
|
|
952
|
+
* import { Position } from 'taffy-js';
|
|
953
|
+
*
|
|
954
|
+
* style.position = Position.Relative; // Normal document flow
|
|
955
|
+
* style.position = Position.Absolute; // Removed from flow, uses inset values
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
export enum Position {
|
|
633
959
|
/**
|
|
634
|
-
*
|
|
960
|
+
* Element participates in normal document flow
|
|
635
961
|
*/
|
|
636
|
-
|
|
962
|
+
Relative = 0,
|
|
637
963
|
/**
|
|
638
|
-
*
|
|
964
|
+
* Element is positioned relative to its nearest positioned ancestor
|
|
639
965
|
*/
|
|
640
|
-
|
|
966
|
+
Absolute = 1,
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* CSS layout configuration for a node, including flexbox, sizing, spacing, and alignment properties.
|
|
971
|
+
*
|
|
972
|
+
* This class holds all CSS layout properties for a node. Create an instance with
|
|
973
|
+
* `new Style()` and configure properties before passing to `TaffyTree.newLeaf()`.
|
|
974
|
+
*
|
|
975
|
+
* @defaultValue
|
|
976
|
+
* When created, all properties are set to their CSS default values:
|
|
977
|
+
* - `display`: `Display.Block`
|
|
978
|
+
* - `position`: `Position.Relative`
|
|
979
|
+
* - `flexDirection`: `FlexDirection.Row`
|
|
980
|
+
* - `flexWrap`: `FlexWrap.NoWrap`
|
|
981
|
+
* - `flexGrow`: `0`
|
|
982
|
+
* - `flexShrink`: `1`
|
|
983
|
+
* - All alignment properties: `undefined` (use default behavior)
|
|
984
|
+
* - All dimensions: `"auto"`
|
|
985
|
+
* - All spacing: `0`
|
|
986
|
+
*
|
|
987
|
+
*/
|
|
988
|
+
export class Style {
|
|
989
|
+
free(): void;
|
|
990
|
+
[Symbol.dispose](): void;
|
|
641
991
|
/**
|
|
642
|
-
*
|
|
992
|
+
* Creates a new Style instance with default values
|
|
993
|
+
*
|
|
994
|
+
* @returns - A new `Style` object with all properties set to CSS defaults
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```typescript
|
|
998
|
+
* const style = new Style();
|
|
999
|
+
* console.log(style.display); // Display.Block
|
|
1000
|
+
* ```
|
|
643
1001
|
*/
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
*
|
|
1002
|
+
constructor();
|
|
1003
|
+
/**
|
|
1004
|
+
* Gets the align-self property
|
|
1005
|
+
*
|
|
1006
|
+
* Overrides the parent's align-items for this specific element.
|
|
1007
|
+
*
|
|
1008
|
+
* @returns - The current [`AlignSelf`](JsAlignSelf) value (returns `Auto` if not set)
|
|
647
1009
|
*/
|
|
648
|
-
|
|
1010
|
+
alignSelf: AlignSelf | undefined;
|
|
1011
|
+
/**
|
|
1012
|
+
* Gets the box sizing mode
|
|
1013
|
+
*
|
|
1014
|
+
* Determines whether padding and border are included in dimensions.
|
|
1015
|
+
*
|
|
1016
|
+
* @returns - The current [`BoxSizing`](JsBoxSizing) value
|
|
1017
|
+
*
|
|
1018
|
+
* @defaultValue `BoxSizing.BorderBox`
|
|
1019
|
+
*/
|
|
1020
|
+
boxSizing: BoxSizing;
|
|
1021
|
+
/**
|
|
1022
|
+
* Gets the flex-basis
|
|
1023
|
+
*
|
|
1024
|
+
* The initial size of a flex item before growing/shrinking.
|
|
1025
|
+
*
|
|
1026
|
+
* @returns - A `Dimension` value (`number`, `\"{number}%\"`, or `\"auto\"`)
|
|
1027
|
+
*/
|
|
1028
|
+
flexBasis: Dimension;
|
|
1029
|
+
/**
|
|
1030
|
+
* Gets the border width
|
|
1031
|
+
*
|
|
1032
|
+
* Width of the element's border on each side.
|
|
1033
|
+
*
|
|
1034
|
+
* @returns - A `Rect<LengthPercentage>` with left, right, top, bottom border widths
|
|
1035
|
+
*/
|
|
1036
|
+
border: Rect<LengthPercentage>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Gets the margin
|
|
1039
|
+
*
|
|
1040
|
+
* Outer spacing around the element.
|
|
1041
|
+
*
|
|
1042
|
+
* @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom margins
|
|
1043
|
+
*/
|
|
1044
|
+
margin: Rect<LengthPercentageAuto>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Gets the align-items property
|
|
1047
|
+
*
|
|
1048
|
+
* Defines the default alignment for all children on the cross axis.
|
|
1049
|
+
*
|
|
1050
|
+
* @returns - The current [`AlignItems`](JsAlignItems) value, or `undefined` if not set
|
|
1051
|
+
*/
|
|
1052
|
+
alignItems: AlignItems | undefined;
|
|
1053
|
+
/**
|
|
1054
|
+
* Gets the flex shrink factor
|
|
1055
|
+
*
|
|
1056
|
+
* Determines how much the item shrinks relative to siblings when
|
|
1057
|
+
* there is insufficient space.
|
|
1058
|
+
*
|
|
1059
|
+
* @returns - The flex shrink factor (default: 1)
|
|
1060
|
+
*/
|
|
1061
|
+
flexShrink: number;
|
|
1062
|
+
/**
|
|
1063
|
+
* Gets the display mode
|
|
1064
|
+
*
|
|
1065
|
+
* Determines the layout algorithm used for this element and its children.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns - The current [`Display`](JsDisplay) value
|
|
1068
|
+
*
|
|
1069
|
+
* @defaultValue - `Display.Block`
|
|
1070
|
+
*/
|
|
1071
|
+
display: Display;
|
|
1072
|
+
/**
|
|
1073
|
+
* Gets the padding
|
|
1074
|
+
*
|
|
1075
|
+
* Inner spacing between the element's border and content.
|
|
1076
|
+
*
|
|
1077
|
+
* @returns - A `Rect<LengthPercentage>` with left, right, top, bottom padding
|
|
1078
|
+
*/
|
|
1079
|
+
padding: Rect<LengthPercentage>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Gets the aspect ratio
|
|
1082
|
+
*
|
|
1083
|
+
* The ratio of width to height. Used to maintain proportions.
|
|
1084
|
+
*
|
|
1085
|
+
* @returns - The aspect ratio value, or `undefined` if not set
|
|
1086
|
+
*/
|
|
1087
|
+
aspectRatio: number | undefined;
|
|
1088
|
+
/**
|
|
1089
|
+
* Gets the maximum size constraints
|
|
1090
|
+
*
|
|
1091
|
+
* @returns - A `Size<Dimension>` object with maximum width and height
|
|
1092
|
+
*/
|
|
1093
|
+
maxSize: Size<Dimension>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Gets the minimum size constraints
|
|
1096
|
+
*
|
|
1097
|
+
* @returns - A `Size<Dimension>` object with minimum width and height
|
|
1098
|
+
*/
|
|
1099
|
+
minSize: Size<Dimension>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Gets the overflow behavior
|
|
1102
|
+
*
|
|
1103
|
+
* Controls how content that exceeds the container is handled.
|
|
1104
|
+
*
|
|
1105
|
+
* @returns - A `Point<Overflow>` with `x` and `y` overflow settings
|
|
1106
|
+
*/
|
|
1107
|
+
overflow: Point<Overflow>;
|
|
1108
|
+
/**
|
|
1109
|
+
* Gets the position mode
|
|
1110
|
+
*
|
|
1111
|
+
* Determines how the element is positioned within its parent.
|
|
1112
|
+
*
|
|
1113
|
+
* @returns - The current [`Position`](JsPosition) value
|
|
1114
|
+
*
|
|
1115
|
+
* @defaultValue - `Position.Relative`
|
|
1116
|
+
*/
|
|
1117
|
+
position: Position;
|
|
649
1118
|
/**
|
|
650
|
-
*
|
|
651
|
-
|
|
652
|
-
|
|
1119
|
+
* Gets the align-content property
|
|
1120
|
+
*
|
|
1121
|
+
* Controls distribution of space between lines in a multi-line flex container.
|
|
1122
|
+
*
|
|
1123
|
+
* @returns - The current [`AlignContent`](JsAlignContent) value, or `undefined` if not set
|
|
1124
|
+
*/
|
|
1125
|
+
alignContent: AlignContent | undefined;
|
|
653
1126
|
/**
|
|
654
|
-
*
|
|
655
|
-
|
|
656
|
-
|
|
1127
|
+
* Gets the flex grow factor
|
|
1128
|
+
*
|
|
1129
|
+
* Determines how much the item grows relative to siblings when
|
|
1130
|
+
* there is extra space available.
|
|
1131
|
+
*
|
|
1132
|
+
* @returns - The flex grow factor (default: 0)
|
|
1133
|
+
*/
|
|
1134
|
+
flexGrow: number;
|
|
657
1135
|
/**
|
|
658
|
-
*
|
|
1136
|
+
* Gets the flex wrap mode
|
|
1137
|
+
*
|
|
1138
|
+
* Controls whether flex items wrap to new lines.
|
|
1139
|
+
*
|
|
1140
|
+
* @returns - The current [`FlexWrap`](JsFlexWrap) value
|
|
1141
|
+
*
|
|
1142
|
+
* @defaultValue - `FlexWrap.NoWrap`
|
|
659
1143
|
*/
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
*
|
|
1144
|
+
flexWrap: FlexWrap;
|
|
1145
|
+
/**
|
|
1146
|
+
* Gets the flex direction
|
|
1147
|
+
*
|
|
1148
|
+
* Defines the main axis direction for flex items.
|
|
1149
|
+
*
|
|
1150
|
+
* @returns - The current [`FlexDirection`](JsFlexDirection) value
|
|
1151
|
+
*
|
|
1152
|
+
* @defaultValue - `FlexDirection.Row`
|
|
1153
|
+
*/
|
|
1154
|
+
flexDirection: FlexDirection;
|
|
1155
|
+
/**
|
|
1156
|
+
* Gets the justify-content property
|
|
1157
|
+
*
|
|
1158
|
+
* Defines alignment and spacing of items along the main axis.
|
|
1159
|
+
*
|
|
1160
|
+
* @returns - The current [`JustifyContent`](JsJustifyContent) value, or `undefined` if not set
|
|
1161
|
+
*/
|
|
1162
|
+
justifyContent: JustifyContent | undefined;
|
|
1163
|
+
/**
|
|
1164
|
+
* Gets the gap
|
|
1165
|
+
*
|
|
1166
|
+
* Spacing between flex/grid items.
|
|
1167
|
+
*
|
|
1168
|
+
* @returns - A `Size<LengthPercentage>` with column (width) and row (height) gaps
|
|
663
1169
|
*/
|
|
664
|
-
|
|
1170
|
+
gap: Size<LengthPercentage>;
|
|
665
1171
|
/**
|
|
666
|
-
*
|
|
1172
|
+
* Gets the size (width and height)
|
|
1173
|
+
*
|
|
1174
|
+
* @returns - A `Size<Dimension>` object with `width` and `height` properties
|
|
667
1175
|
*/
|
|
668
|
-
|
|
1176
|
+
size: Size<Dimension>;
|
|
669
1177
|
/**
|
|
670
|
-
*
|
|
1178
|
+
* Gets the inset
|
|
1179
|
+
*
|
|
1180
|
+
* Positioning offsets for absolutely positioned elements.
|
|
1181
|
+
*
|
|
1182
|
+
* @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom offsets
|
|
671
1183
|
*/
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
export class TaffyNode {
|
|
676
|
-
free(): void;
|
|
677
|
-
[Symbol.dispose](): void;
|
|
678
|
-
get_layout(): Layout;
|
|
679
|
-
remove_child(child: TaffyNode): void;
|
|
680
|
-
set_children(children: Uint32Array): void;
|
|
681
|
-
compute_layout(available_space: any): void;
|
|
682
|
-
constructor(style: any);
|
|
683
|
-
free(): void;
|
|
684
|
-
style(): any;
|
|
685
|
-
add_child(child: TaffyNode): void;
|
|
686
|
-
set_style(style: any): void;
|
|
687
|
-
id: number;
|
|
1184
|
+
inset: Rect<LengthPercentageAuto>;
|
|
688
1185
|
}
|
|
689
1186
|
|
|
690
1187
|
/**
|
|
691
|
-
*
|
|
1188
|
+
* Error class thrown when a Taffy operation fails, containing a human-readable error message.
|
|
1189
|
+
*
|
|
1190
|
+
* This class wraps the native [`taffy::TaffyError`] type and exposes it to JavaScript
|
|
1191
|
+
* with a readable error message. It is thrown as a JavaScript exception on failure.
|
|
1192
|
+
*
|
|
1193
|
+
* @example
|
|
1194
|
+
* ```typescript
|
|
1195
|
+
* try {
|
|
1196
|
+
* tree.remove(node);
|
|
1197
|
+
* } catch (e) {
|
|
1198
|
+
* if (e instanceof TaffyError) {
|
|
1199
|
+
* console.error(e.message);
|
|
1200
|
+
* }
|
|
1201
|
+
* }
|
|
1202
|
+
* ```
|
|
1203
|
+
*
|
|
1204
|
+
* @remarks
|
|
1205
|
+
* The underlying Taffy errors include:
|
|
1206
|
+
* - `InvalidInputNode`: Node ID doesn't exist in the tree
|
|
1207
|
+
* - `InvalidParentNode`: Specified parent node doesn't exist
|
|
1208
|
+
* - `ChildIndexOutOfBounds`: Child index exceeds available children
|
|
692
1209
|
*/
|
|
693
|
-
export
|
|
694
|
-
Auto = 0,
|
|
695
|
-
Left = 1,
|
|
696
|
-
Right = 2,
|
|
697
|
-
Center = 3,
|
|
698
|
-
Justify = 4,
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
export class TrackDefinition {
|
|
1210
|
+
export class TaffyError {
|
|
702
1211
|
private constructor();
|
|
703
1212
|
free(): void;
|
|
704
1213
|
[Symbol.dispose](): void;
|
|
705
1214
|
/**
|
|
706
|
-
*
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
*
|
|
1215
|
+
* Gets the human-readable error message
|
|
1216
|
+
*
|
|
1217
|
+
* @returns - A string describing what went wrong.
|
|
1218
|
+
*
|
|
1219
|
+
* @remarks
|
|
1220
|
+
* Examples:
|
|
1221
|
+
* - "Node with id 1234 is not present in the Taffy tree"
|
|
1222
|
+
* - "Index 5 is out of bounds for node with 3 children"
|
|
711
1223
|
*/
|
|
712
|
-
|
|
1224
|
+
readonly message: string;
|
|
713
1225
|
}
|
|
714
1226
|
|
|
715
1227
|
/**
|
|
716
|
-
* The
|
|
1228
|
+
* The main layout tree class for creating nodes, computing layouts, and managing a tree of styled elements.
|
|
1229
|
+
*
|
|
1230
|
+
* TaffyTree is the entry point for the Taffy layout engine. It manages
|
|
1231
|
+
* a tree of nodes and computes their layouts using CSS Flexbox and Grid algorithms.
|
|
1232
|
+
*
|
|
717
1233
|
*/
|
|
718
|
-
export
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
*/
|
|
722
|
-
Pixels = 0,
|
|
723
|
-
/**
|
|
724
|
-
* The track size is specified as a percentage of the container.
|
|
725
|
-
*/
|
|
726
|
-
Percent = 1,
|
|
727
|
-
/**
|
|
728
|
-
* The track size is a fraction of the remaining free space (fr unit).
|
|
729
|
-
*/
|
|
730
|
-
Fraction = 2,
|
|
731
|
-
/**
|
|
732
|
-
* The track size is determined automatically.
|
|
733
|
-
*/
|
|
734
|
-
Auto = 3,
|
|
735
|
-
/**
|
|
736
|
-
* The track size is the minimum size needed to fit the content.
|
|
737
|
-
*/
|
|
738
|
-
MinContent = 4,
|
|
1234
|
+
export class TaffyTree {
|
|
1235
|
+
free(): void;
|
|
1236
|
+
[Symbol.dispose](): void;
|
|
739
1237
|
/**
|
|
740
|
-
*
|
|
741
|
-
|
|
742
|
-
|
|
1238
|
+
* Marks a node as dirty (requiring re-layout)
|
|
1239
|
+
*
|
|
1240
|
+
* Use this when a node's content has changed but its style hasn't.
|
|
1241
|
+
* For example, when text content changes and needs remeasuring.
|
|
1242
|
+
*
|
|
1243
|
+
* @param node - The node ID to mark dirty
|
|
1244
|
+
*
|
|
1245
|
+
* @throws `TaffyError` if the node does not exist
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```typescript
|
|
1249
|
+
* // After updating text content
|
|
1250
|
+
* tree.setNodeContext(nodeId, { text: "Updated text" });
|
|
1251
|
+
* tree.markDirty(nodeId);
|
|
1252
|
+
* tree.computeLayout(rootId, availableSpace);
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
markDirty(node: bigint): void;
|
|
1256
|
+
/**
|
|
1257
|
+
* Prints the tree structure to the console (for debugging)
|
|
1258
|
+
*
|
|
1259
|
+
* Outputs a text representation of the tree structure starting from
|
|
1260
|
+
* the given node. Useful for debugging layout issues.
|
|
1261
|
+
*
|
|
1262
|
+
* @param node - The root node ID to print from
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```typescript
|
|
1266
|
+
* tree.printTree(rootId);
|
|
1267
|
+
* // Output appears in browser console
|
|
1268
|
+
* ```
|
|
1269
|
+
*/
|
|
1270
|
+
printTree(node: bigint): void;
|
|
1271
|
+
/**
|
|
1272
|
+
* Gets the number of children of a node
|
|
1273
|
+
*
|
|
1274
|
+
* @param parent - The parent node ID
|
|
1275
|
+
*
|
|
1276
|
+
* @returns - The number of direct children
|
|
1277
|
+
*
|
|
1278
|
+
* @throws `TaffyError` if the node does not exist
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* ```typescript
|
|
1282
|
+
* const count: number = tree.childCount(parentId);
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
childCount(parent: bigint): number;
|
|
1286
|
+
/**
|
|
1287
|
+
* Removes a specific child from a parent
|
|
1288
|
+
*
|
|
1289
|
+
* @param parent - The parent node ID
|
|
1290
|
+
* @param child - The child node ID to remove
|
|
1291
|
+
*
|
|
1292
|
+
* @returns - The removed child ID (`bigint`)
|
|
1293
|
+
*
|
|
1294
|
+
* @throws `TaffyError` if the parent or child node does not exist
|
|
1295
|
+
*
|
|
1296
|
+
* @example
|
|
1297
|
+
* ```typescript
|
|
1298
|
+
* tree.removeChild(parentId, childId);
|
|
1299
|
+
* ```
|
|
1300
|
+
*/
|
|
1301
|
+
removeChild(parent: bigint, child: bigint): bigint;
|
|
1302
|
+
/**
|
|
1303
|
+
* Replaces all children of a node
|
|
1304
|
+
*
|
|
1305
|
+
* Any existing children are removed and replaced with the new array.
|
|
1306
|
+
*
|
|
1307
|
+
* @param parent - The parent node ID
|
|
1308
|
+
* @param children - Array of new child node IDs
|
|
1309
|
+
*
|
|
1310
|
+
* @throws `TaffyError` if the parent node does not exist
|
|
1311
|
+
*
|
|
1312
|
+
* @example
|
|
1313
|
+
* ```typescript
|
|
1314
|
+
* const children = BigUint64Array.from([child1, child2, child3]);
|
|
1315
|
+
* tree.setChildren(parentId, children);
|
|
1316
|
+
* ```
|
|
1317
|
+
*/
|
|
1318
|
+
setChildren(parent: bigint, children: BigUint64Array): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* Creates a new TaffyTree with pre-allocated capacity
|
|
1321
|
+
*
|
|
1322
|
+
* Use this when you know approximately how many nodes will be in the tree.
|
|
1323
|
+
* This can improve performance by reducing memory reallocations.
|
|
1324
|
+
*
|
|
1325
|
+
* @param capacity - The number of nodes to pre-allocate space for
|
|
1326
|
+
*
|
|
1327
|
+
* @example
|
|
1328
|
+
* ```typescript
|
|
1329
|
+
* const tree: TaffyTree = TaffyTree.withCapacity(1000);
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
static withCapacity(capacity: number): TaffyTree;
|
|
1333
|
+
/**
|
|
1334
|
+
* Computes the layout for a subtree
|
|
1335
|
+
*
|
|
1336
|
+
* This is the main layout computation method. Call this on the root node
|
|
1337
|
+
* to compute layouts for all nodes in the tree.
|
|
1338
|
+
*
|
|
1339
|
+
* @param node - The root node ID to compute layout for
|
|
1340
|
+
* @param available_space - The available space constraints
|
|
1341
|
+
*
|
|
1342
|
+
* @example
|
|
1343
|
+
* ```typescript
|
|
1344
|
+
* // Fixed size container
|
|
1345
|
+
* { width: 800, height: 600 }
|
|
1346
|
+
*
|
|
1347
|
+
* // Flexible width, fixed height
|
|
1348
|
+
* { width: "MaxContent", height: 600 }
|
|
1349
|
+
*
|
|
1350
|
+
* // Minimum content size
|
|
1351
|
+
* { width: "MinContent", height: "MinContent" }
|
|
1352
|
+
* ```
|
|
1353
|
+
*
|
|
1354
|
+
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
1355
|
+
*
|
|
1356
|
+
* @example
|
|
1357
|
+
* ```typescript
|
|
1358
|
+
* tree.computeLayout(rootId, { width: 800, height: 600 });
|
|
1359
|
+
* ```
|
|
1360
|
+
*/
|
|
1361
|
+
computeLayout(node: bigint, available_space: Size<AvailableSpace>): void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Enables rounding of layout values to whole pixels
|
|
1364
|
+
*
|
|
1365
|
+
* When enabled (default), computed layout values like position and size
|
|
1366
|
+
* are rounded to the nearest integer. This prevents sub-pixel rendering
|
|
1367
|
+
* issues in most rendering contexts.
|
|
1368
|
+
*
|
|
1369
|
+
* @example
|
|
1370
|
+
* ```typescript
|
|
1371
|
+
* tree.enableRounding();
|
|
1372
|
+
* ```
|
|
1373
|
+
*/
|
|
1374
|
+
enableRounding(): void;
|
|
1375
|
+
/**
|
|
1376
|
+
* Disables rounding of layout values
|
|
1377
|
+
*
|
|
1378
|
+
* When disabled, computed layout values retain their fractional precision.
|
|
1379
|
+
* Use this when you need sub-pixel accuracy or when performing custom
|
|
1380
|
+
* rounding.
|
|
1381
|
+
*
|
|
1382
|
+
* @example
|
|
1383
|
+
* ```typescript
|
|
1384
|
+
* tree.disableRounding();
|
|
1385
|
+
* const layout = tree.getLayout(node);
|
|
1386
|
+
* console.log(layout.x);
|
|
1387
|
+
* ```
|
|
1388
|
+
*/
|
|
1389
|
+
disableRounding(): void;
|
|
1390
|
+
/**
|
|
1391
|
+
* Gets the context value for a node
|
|
1392
|
+
*
|
|
1393
|
+
* @param node - The node ID
|
|
1394
|
+
*
|
|
1395
|
+
* @returns - The attached context value, or `undefined` if none is set
|
|
1396
|
+
*
|
|
1397
|
+
* @example
|
|
1398
|
+
* ```typescript
|
|
1399
|
+
* interface Context { text: string };
|
|
1400
|
+
* const context = tree.getNodeContext(nodeId) as Context | undefined;
|
|
1401
|
+
* if (context) {
|
|
1402
|
+
* console.log(context.text);
|
|
1403
|
+
* }
|
|
1404
|
+
* ```
|
|
1405
|
+
*/
|
|
1406
|
+
getNodeContext(node: bigint): any;
|
|
1407
|
+
/**
|
|
1408
|
+
* Sets a context value for a node
|
|
1409
|
+
*
|
|
1410
|
+
* The context can be any JavaScript value and is passed to the measure
|
|
1411
|
+
* function during layout computation.
|
|
1412
|
+
*
|
|
1413
|
+
* @param node - The node ID
|
|
1414
|
+
* @param context - Any JavaScript value to attach
|
|
1415
|
+
*
|
|
1416
|
+
* @throws `TaffyError` if the node does not exist
|
|
1417
|
+
*
|
|
1418
|
+
* @example
|
|
1419
|
+
* ```typescript
|
|
1420
|
+
* interface Context { text: string };
|
|
1421
|
+
* tree.setNodeContext(nodeId, { text: "Updated text" } as Context);
|
|
1422
|
+
* ```
|
|
1423
|
+
*/
|
|
1424
|
+
setNodeContext(node: bigint, context: any): void;
|
|
1425
|
+
/**
|
|
1426
|
+
* Gets the total number of nodes in the tree
|
|
1427
|
+
*
|
|
1428
|
+
* @returns - The total count of all nodes
|
|
1429
|
+
*
|
|
1430
|
+
* @example
|
|
1431
|
+
* ```typescript
|
|
1432
|
+
* const count: number = tree.totalNodeCount();
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
totalNodeCount(): number;
|
|
1436
|
+
/**
|
|
1437
|
+
* Gets the unrounded (fractional) layout for a node
|
|
1438
|
+
*
|
|
1439
|
+
* Returns the raw computed values before any rounding is applied.
|
|
1440
|
+
* Useful when you need sub-pixel precision.
|
|
1441
|
+
*
|
|
1442
|
+
* @param node - The node ID
|
|
1443
|
+
*
|
|
1444
|
+
* @returns - The unrounded `Layout`
|
|
1445
|
+
*
|
|
1446
|
+
* @example
|
|
1447
|
+
* ```typescript
|
|
1448
|
+
* const layout: Layout = tree.unroundedLayout(nodeId);
|
|
1449
|
+
* console.log(`Exact width: ${layout.width}`);
|
|
1450
|
+
* ```
|
|
1451
|
+
*/
|
|
1452
|
+
unroundedLayout(node: bigint): Layout;
|
|
1453
|
+
/**
|
|
1454
|
+
* Creates a new node with the given children
|
|
1455
|
+
*
|
|
1456
|
+
* Use this to create container nodes that have child elements.
|
|
1457
|
+
* The children must already exist in the tree.
|
|
1458
|
+
*
|
|
1459
|
+
* @param style - The style configuration for the node
|
|
1460
|
+
* @param children - Array of child node IDs (as BigUint64Array)
|
|
1461
|
+
*
|
|
1462
|
+
* @returns - The node ID (`bigint`)
|
|
1463
|
+
*
|
|
1464
|
+
* @throws `TaffyError` if the node cannot be created
|
|
1465
|
+
*
|
|
1466
|
+
* @example
|
|
1467
|
+
* ```typescript
|
|
1468
|
+
* const containerStyle = new Style();
|
|
1469
|
+
* containerStyle.display = Display.Flex;
|
|
1470
|
+
*
|
|
1471
|
+
* const child1: bigint = tree.newLeaf(new Style());
|
|
1472
|
+
* const child2: bigint = tree.newLeaf(new Style());
|
|
1473
|
+
*
|
|
1474
|
+
* const container: bigint = tree.newWithChildren(
|
|
1475
|
+
* containerStyle,
|
|
1476
|
+
* BigUint64Array.from([child1, child2])
|
|
1477
|
+
* );
|
|
1478
|
+
* ```
|
|
1479
|
+
*/
|
|
1480
|
+
newWithChildren(style: Style, children: BigUint64Array): bigint;
|
|
1481
|
+
/**
|
|
1482
|
+
* Gets the child at a specific index
|
|
1483
|
+
*
|
|
1484
|
+
* @param parent - The parent node ID
|
|
1485
|
+
* @param index - The index of the child (0-based)
|
|
1486
|
+
*
|
|
1487
|
+
* @returns - The child node ID (`bigint`)
|
|
1488
|
+
*
|
|
1489
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
* ```typescript
|
|
1493
|
+
* const firstChild: bigint = tree.getChildAtIndex(parentId, 0);
|
|
1494
|
+
* ```
|
|
1495
|
+
*/
|
|
1496
|
+
getChildAtIndex(parent: bigint, index: number): bigint;
|
|
1497
|
+
/**
|
|
1498
|
+
* Gets a mutable reference to the context value for a node
|
|
1499
|
+
*
|
|
1500
|
+
* In JavaScript, this behaves the same as `getNodeContext()` since
|
|
1501
|
+
* JavaScript objects are always passed by reference.
|
|
1502
|
+
*
|
|
1503
|
+
* @param node - The node ID
|
|
1504
|
+
*
|
|
1505
|
+
* @returns - The attached context value, or `undefined` if none is set
|
|
1506
|
+
*/
|
|
1507
|
+
getNodeContextMut(node: bigint): any;
|
|
1508
|
+
/**
|
|
1509
|
+
* Inserts a child at a specific index
|
|
1510
|
+
*
|
|
1511
|
+
* @param parent - The parent node ID
|
|
1512
|
+
* @param index - The position to insert at (0-based)
|
|
1513
|
+
* @param child - The child node ID to insert
|
|
1514
|
+
*
|
|
1515
|
+
* @throws `TaffyError` if the parent or child node does not exist, or index is out of bounds
|
|
1516
|
+
*
|
|
1517
|
+
* @example
|
|
1518
|
+
* ```typescript
|
|
1519
|
+
* tree.insertChildAtIndex(parentId, 0, childId);
|
|
1520
|
+
* ```
|
|
1521
|
+
*/
|
|
1522
|
+
insertChildAtIndex(parent: bigint, index: number, child: bigint): void;
|
|
1523
|
+
/**
|
|
1524
|
+
* Creates a new leaf node with an attached context value
|
|
1525
|
+
*
|
|
1526
|
+
* The context can be any JavaScript value and is passed to the measure
|
|
1527
|
+
* function during layout computation. This is useful for storing
|
|
1528
|
+
* references to text content or other dynamic data.
|
|
1529
|
+
*
|
|
1530
|
+
* @param style - The style configuration for the node
|
|
1531
|
+
* @param context - Any JavaScript value to attach to the node
|
|
1532
|
+
* @returns - The node ID (`bigint`)
|
|
1533
|
+
* @throws `TaffyError` if the node cannot be created
|
|
1534
|
+
*
|
|
1535
|
+
* @example
|
|
1536
|
+
* ```typescript
|
|
1537
|
+
* interface TextContext { text: string; isBold: boolean; }
|
|
1538
|
+
*
|
|
1539
|
+
* const style = new Style();
|
|
1540
|
+
* const context: TextContext = { text: "Hello, World!", isBold: true };
|
|
1541
|
+
* const nodeId: bigint = tree.newLeafWithContext(style, context);
|
|
1542
|
+
* ```
|
|
1543
|
+
*/
|
|
1544
|
+
newLeafWithContext(style: Style, context: any): bigint;
|
|
1545
|
+
/**
|
|
1546
|
+
* Removes a child at a specific index
|
|
1547
|
+
*
|
|
1548
|
+
* @param parent - The parent node ID
|
|
1549
|
+
* @param index - The index of the child to remove (0-based)
|
|
1550
|
+
*
|
|
1551
|
+
* @returns - The removed child ID (`bigint`)
|
|
1552
|
+
*
|
|
1553
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
1554
|
+
*
|
|
1555
|
+
* @example
|
|
1556
|
+
* ```typescript
|
|
1557
|
+
* const removedId: bigint = tree.removeChildAtIndex(parentId, 0);
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
removeChildAtIndex(parent: bigint, index: number): bigint;
|
|
1561
|
+
/**
|
|
1562
|
+
* Removes a range of children
|
|
1563
|
+
*
|
|
1564
|
+
* Removes children from `start_index` (inclusive) to `end_index` (exclusive).
|
|
1565
|
+
*
|
|
1566
|
+
* @param parent - The parent node ID
|
|
1567
|
+
* @param start_index - Start of range (inclusive)
|
|
1568
|
+
* @param end_index - End of range (exclusive)
|
|
1569
|
+
*
|
|
1570
|
+
* @throws `TaffyError` if the parent node does not exist or range is invalid
|
|
1571
|
+
*
|
|
1572
|
+
* @example
|
|
1573
|
+
* ```typescript
|
|
1574
|
+
* tree.removeChildrenRange(parentId, 1, 3);
|
|
1575
|
+
* ```
|
|
1576
|
+
*/
|
|
1577
|
+
removeChildrenRange(parent: bigint, start_index: number, end_index: number): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* Replaces a child at a specific index
|
|
1580
|
+
*
|
|
1581
|
+
* @param parent - The parent node ID
|
|
1582
|
+
* @param index - The index of the child to replace (0-based)
|
|
1583
|
+
* @param new_child - The new child node ID
|
|
1584
|
+
*
|
|
1585
|
+
* @returns - The replaced (old) child ID (`bigint`)
|
|
1586
|
+
*
|
|
1587
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
1588
|
+
*
|
|
1589
|
+
* @example
|
|
1590
|
+
* ```typescript
|
|
1591
|
+
* const oldChildId: bigint = tree.replaceChildAtIndex(parentId, 1, newChildId);
|
|
1592
|
+
* ```
|
|
1593
|
+
*/
|
|
1594
|
+
replaceChildAtIndex(parent: bigint, index: number, new_child: bigint): bigint;
|
|
1595
|
+
/**
|
|
1596
|
+
* Computes layout with a custom measure function for leaf nodes
|
|
1597
|
+
*
|
|
1598
|
+
* Use this when you have leaf nodes with dynamic content (like text)
|
|
1599
|
+
* that needs to be measured during layout. The measure function is
|
|
1600
|
+
* called for each leaf node that needs measurement.
|
|
1601
|
+
*
|
|
1602
|
+
* @param node - The root node ID to compute layout for
|
|
1603
|
+
* @param available_space - The available space constraints
|
|
1604
|
+
* @param measure_func - A function that measures leaf node content
|
|
1605
|
+
*
|
|
1606
|
+
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* ```typescript
|
|
1610
|
+
* tree.computeLayoutWithMeasure(
|
|
1611
|
+
* rootId,
|
|
1612
|
+
* { width: 800, height: "MaxContent" },
|
|
1613
|
+
* (known, available, node, context, style) => {
|
|
1614
|
+
* if (context?.text) {
|
|
1615
|
+
* const measured = measureText(context.text, available.width);
|
|
1616
|
+
* return { width: measured.width, height: measured.height };
|
|
1617
|
+
* }
|
|
1618
|
+
* return { width: 0, height: 0 };
|
|
1619
|
+
* }
|
|
1620
|
+
* );
|
|
1621
|
+
* ```
|
|
1622
|
+
*/
|
|
1623
|
+
computeLayoutWithMeasure(node: bigint, available_space: Size<AvailableSpace>, measure_func: MeasureFunction): void;
|
|
1624
|
+
/**
|
|
1625
|
+
* Gets context values for multiple nodes at once
|
|
1626
|
+
*
|
|
1627
|
+
* This is more efficient than calling `getNodeContext()` multiple times
|
|
1628
|
+
* when you need to access contexts for many nodes.
|
|
1629
|
+
*
|
|
1630
|
+
* @param children - Array of node IDs
|
|
1631
|
+
*
|
|
1632
|
+
* @returns - Array of context values (undefined for nodes without context)
|
|
1633
|
+
*
|
|
1634
|
+
* @example
|
|
1635
|
+
* ```typescript
|
|
1636
|
+
* const nodes = BigUint64Array.from([id1, id2]);
|
|
1637
|
+
* const contexts = tree.getDisjointNodeContextMut(nodes);
|
|
1638
|
+
* ```
|
|
1639
|
+
*/
|
|
1640
|
+
getDisjointNodeContextMut(children: BigUint64Array): any[];
|
|
1641
|
+
/**
|
|
1642
|
+
* Creates a new empty TaffyTree
|
|
1643
|
+
*
|
|
1644
|
+
* The tree starts with no nodes. Use `newLeaf()` or `newWithChildren()`
|
|
1645
|
+
* to add nodes.
|
|
1646
|
+
*
|
|
1647
|
+
* @example
|
|
1648
|
+
* ```typescript
|
|
1649
|
+
* const tree: TaffyTree = new TaffyTree();
|
|
1650
|
+
* ```
|
|
1651
|
+
*/
|
|
1652
|
+
constructor();
|
|
1653
|
+
/**
|
|
1654
|
+
* Removes all nodes from the tree
|
|
1655
|
+
*
|
|
1656
|
+
* This clears the entire tree, removing all nodes and their relationships.
|
|
1657
|
+
* Use this to reset the tree for reuse.
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* ```typescript
|
|
1661
|
+
* tree.clear();
|
|
1662
|
+
* console.log(tree.totalNodeCount());
|
|
1663
|
+
* ```
|
|
1664
|
+
*/
|
|
1665
|
+
clear(): void;
|
|
1666
|
+
/**
|
|
1667
|
+
* Checks if a node is dirty (needs re-layout)
|
|
1668
|
+
*
|
|
1669
|
+
* A node is dirty if its style or content has changed since the last
|
|
1670
|
+
* layout computation.
|
|
1671
|
+
*
|
|
1672
|
+
* @param node - The node ID to check
|
|
1673
|
+
*
|
|
1674
|
+
* @returns - true if dirty, false otherwise
|
|
1675
|
+
*
|
|
1676
|
+
* @throws `TaffyError` if the node does not exist
|
|
1677
|
+
*
|
|
1678
|
+
* @example
|
|
1679
|
+
* ```typescript
|
|
1680
|
+
* if (tree.dirty(nodeId)) {
|
|
1681
|
+
* tree.computeLayout(rootId, availableSpace);
|
|
1682
|
+
* }
|
|
1683
|
+
* ```
|
|
1684
|
+
*/
|
|
1685
|
+
dirty(node: bigint): boolean;
|
|
1686
|
+
/**
|
|
1687
|
+
* Gets the style for a node
|
|
1688
|
+
*
|
|
1689
|
+
* @param node - The node ID
|
|
1690
|
+
*
|
|
1691
|
+
* @returns - The node's `Style`
|
|
1692
|
+
*
|
|
1693
|
+
* @throws `TaffyError` if the node does not exist
|
|
1694
|
+
*
|
|
1695
|
+
* @example
|
|
1696
|
+
* ```typescript
|
|
1697
|
+
* const style: Style = tree.getStyle(nodeId);
|
|
1698
|
+
* console.log('Flex grow:', style.flexGrow);
|
|
1699
|
+
* ```
|
|
1700
|
+
*/
|
|
1701
|
+
getStyle(node: bigint): Style;
|
|
1702
|
+
/**
|
|
1703
|
+
* Gets the computed layout for a node
|
|
1704
|
+
*
|
|
1705
|
+
* Call this after `computeLayout()` to retrieve the computed position
|
|
1706
|
+
* and size for a node.
|
|
1707
|
+
*
|
|
1708
|
+
* @param node - The node ID
|
|
1709
|
+
*
|
|
1710
|
+
* @returns - The computed `Layout`
|
|
1711
|
+
*
|
|
1712
|
+
* @throws `TaffyError` if the node does not exist
|
|
1713
|
+
*
|
|
1714
|
+
* @example
|
|
1715
|
+
* ```typescript
|
|
1716
|
+
* tree.computeLayout(rootId, { width: 800, height: 600 });
|
|
1717
|
+
* const layout: Layout = tree.getLayout(nodeId);
|
|
1718
|
+
* console.log(`Position: (${layout.x}, ${layout.y}), Size: ${layout.width}x${layout.height}`);
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
getLayout(node: bigint): Layout;
|
|
1722
|
+
/**
|
|
1723
|
+
* Gets the parent of a node
|
|
1724
|
+
*
|
|
1725
|
+
* @param child - The child node ID
|
|
1726
|
+
*
|
|
1727
|
+
* @returns - The parent node ID, or `undefined` if the node has no parent
|
|
1728
|
+
*
|
|
1729
|
+
* @example
|
|
1730
|
+
* ```typescript
|
|
1731
|
+
* const parentId: bigint | undefined = tree.parent(childId);
|
|
1732
|
+
* ```
|
|
1733
|
+
*/
|
|
1734
|
+
parent(child: bigint): bigint | undefined;
|
|
1735
|
+
/**
|
|
1736
|
+
* Removes a node from the tree
|
|
1737
|
+
*
|
|
1738
|
+
* The node and all its descendants are removed. If the node has a parent,
|
|
1739
|
+
* it is automatically removed from the parent's children.
|
|
1740
|
+
*
|
|
1741
|
+
* @param node - The node ID to remove
|
|
1742
|
+
*
|
|
1743
|
+
* @returns - The removed node ID (`bigint`)
|
|
1744
|
+
*
|
|
1745
|
+
* @throws `TaffyError` if the node does not exist
|
|
1746
|
+
*
|
|
1747
|
+
* @example
|
|
1748
|
+
* ```typescript
|
|
1749
|
+
* try {
|
|
1750
|
+
* const removedId: bigint = tree.remove(nodeId);
|
|
1751
|
+
* } catch (e) {
|
|
1752
|
+
* console.error("Node doesn't exist");
|
|
1753
|
+
* }
|
|
1754
|
+
* ```
|
|
1755
|
+
*/
|
|
1756
|
+
remove(node: bigint): bigint;
|
|
1757
|
+
/**
|
|
1758
|
+
* Gets all children of a node
|
|
1759
|
+
*
|
|
1760
|
+
* @param parent - The parent node ID
|
|
1761
|
+
*
|
|
1762
|
+
* @returns - Array of child node IDs (`BigUint64Array`)
|
|
1763
|
+
*
|
|
1764
|
+
* @throws `TaffyError` if the parent node does not exist
|
|
1765
|
+
*
|
|
1766
|
+
* @example
|
|
1767
|
+
* ```typescript
|
|
1768
|
+
* const children: BigUint64Array = tree.children(parentId);
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
children(parent: bigint): BigUint64Array;
|
|
1772
|
+
/**
|
|
1773
|
+
* Creates a new leaf node with the given style
|
|
1774
|
+
*
|
|
1775
|
+
* A leaf node has no children. Use this for elements that contain
|
|
1776
|
+
* content (like text) rather than other elements.
|
|
1777
|
+
*
|
|
1778
|
+
* @param style - The style configuration for the node
|
|
1779
|
+
* @returns - The node ID (`bigint`)
|
|
1780
|
+
* @throws `TaffyError` if the node cannot be created
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```typescript
|
|
1784
|
+
* const style = new Style();
|
|
1785
|
+
* style.size = { width: 100, height: 50 };
|
|
1786
|
+
* const nodeId: bigint = tree.newLeaf(style);
|
|
1787
|
+
* ```
|
|
1788
|
+
*/
|
|
1789
|
+
newLeaf(style: Style): bigint;
|
|
1790
|
+
/**
|
|
1791
|
+
* Appends a child node to a parent
|
|
1792
|
+
*
|
|
1793
|
+
* The child is added as the last child of the parent.
|
|
1794
|
+
*
|
|
1795
|
+
* @param parent - The parent node ID
|
|
1796
|
+
* @param child - The child node ID to add
|
|
1797
|
+
*
|
|
1798
|
+
* @throws `TaffyError` if the parent or child node does not exist
|
|
1799
|
+
*
|
|
1800
|
+
* @example
|
|
1801
|
+
* ```typescript
|
|
1802
|
+
* tree.addChild(parentId, childId);
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
addChild(parent: bigint, child: bigint): void;
|
|
1806
|
+
/**
|
|
1807
|
+
* Sets the style for an existing node
|
|
1808
|
+
*
|
|
1809
|
+
* This replaces the node's current style with the provided one.
|
|
1810
|
+
* The node will be marked as dirty and require re-layout.
|
|
1811
|
+
*
|
|
1812
|
+
* @param node - The node ID
|
|
1813
|
+
* @param style - The new style configuration
|
|
1814
|
+
*
|
|
1815
|
+
* @throws `TaffyError` if the node does not exist
|
|
1816
|
+
*
|
|
1817
|
+
* @example
|
|
1818
|
+
* ```typescript
|
|
1819
|
+
* const newStyle = new Style();
|
|
1820
|
+
* newStyle.flexGrow = 2;
|
|
1821
|
+
* tree.setStyle(nodeId, newStyle);
|
|
1822
|
+
* ```
|
|
1823
|
+
*/
|
|
1824
|
+
setStyle(node: bigint, style: Style): void;
|
|
743
1825
|
}
|
|
744
1826
|
|
|
745
|
-
/**
|
|
746
|
-
* Adds a child node to a parent node.
|
|
747
|
-
*
|
|
748
|
-
* # Arguments
|
|
749
|
-
*
|
|
750
|
-
* * `parent` - The ID of the parent node.
|
|
751
|
-
* * `child` - The ID of the child node to add.
|
|
752
|
-
*
|
|
753
|
-
* # Errors
|
|
754
|
-
*
|
|
755
|
-
* Returns a `JsValue` error if the operation fails (e.g., recursive hierarchy).
|
|
756
|
-
*/
|
|
757
|
-
export function add_child(parent: number, child: number): void;
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* Auto dimension constant
|
|
761
|
-
*/
|
|
762
|
-
export function auto(): Dimension;
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Clear all nodes
|
|
766
|
-
*/
|
|
767
|
-
export function clear(): void;
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* Computes the layout for a tree starting from the specified root node.
|
|
771
|
-
*
|
|
772
|
-
* # Arguments
|
|
773
|
-
*
|
|
774
|
-
* * `root` - The ID of the root node of the tree to lay out.
|
|
775
|
-
* * `available_space` - The available space constraints for the layout.
|
|
776
|
-
*
|
|
777
|
-
* # Errors
|
|
778
|
-
*
|
|
779
|
-
* Returns a `JsValue` error if the layout computation fails.
|
|
780
|
-
*/
|
|
781
|
-
export function compute_layout(root: number, available_space: any): void;
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Helper function to create a dimension
|
|
785
|
-
*/
|
|
786
|
-
export function dimension(value: number, unit: DimensionUnit): Dimension;
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Retrieves the list of children IDs for a given node.
|
|
790
|
-
*
|
|
791
|
-
* # Arguments
|
|
792
|
-
*
|
|
793
|
-
* * `parent` - The ID of the parent node.
|
|
794
|
-
*
|
|
795
|
-
* # Returns
|
|
796
|
-
*
|
|
797
|
-
* A boxed array of child node IDs (`Box<[u32]>`).
|
|
798
|
-
*
|
|
799
|
-
* # Errors
|
|
800
|
-
*
|
|
801
|
-
* Returns a `JsValue` error if the node does not exist.
|
|
802
|
-
*/
|
|
803
|
-
export function get_children(parent: number): Uint32Array;
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Retrieves the computed layout information for a specific node.
|
|
807
|
-
*
|
|
808
|
-
* # Arguments
|
|
809
|
-
*
|
|
810
|
-
* * `node` - The ID of the node to query.
|
|
811
|
-
*
|
|
812
|
-
* # Returns
|
|
813
|
-
*
|
|
814
|
-
* A `Layout` object containing the x, y, width, and height of the node.
|
|
815
|
-
*
|
|
816
|
-
* # Errors
|
|
817
|
-
*
|
|
818
|
-
* Returns a `JsValue` error if the node does not exist or layout information is unavailable.
|
|
819
|
-
*/
|
|
820
|
-
export function get_layout(node: number): any;
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Retrieves the parent ID of a given node.
|
|
824
|
-
*
|
|
825
|
-
* # Arguments
|
|
826
|
-
*
|
|
827
|
-
* * `node` - The ID of the node to query.
|
|
828
|
-
*
|
|
829
|
-
* # Returns
|
|
830
|
-
*
|
|
831
|
-
* An `Option<u32>` containing the parent ID if it exists, or `None` if the node is a root or orphan.
|
|
832
|
-
*
|
|
833
|
-
* # Errors
|
|
834
|
-
*
|
|
835
|
-
* Returns a `JsValue` error if internal tree access fails.
|
|
836
|
-
*/
|
|
837
|
-
export function get_parent(node: number): number | undefined;
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Initialize console error panic hook
|
|
841
|
-
*/
|
|
842
|
-
export function init(): void;
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Marks a node and its ancestors as dirty, requiring a layout re-computation.
|
|
846
|
-
*
|
|
847
|
-
* # Arguments
|
|
848
|
-
*
|
|
849
|
-
* * `node` - The ID of the node to mark dirty.
|
|
850
|
-
*
|
|
851
|
-
* # Errors
|
|
852
|
-
*
|
|
853
|
-
* Returns a `JsValue` error if the node does not exist.
|
|
854
|
-
*/
|
|
855
|
-
export function mark_dirty(node: number): void;
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Creates a new leaf node with the specified style.
|
|
859
|
-
*
|
|
860
|
-
* # Arguments
|
|
861
|
-
*
|
|
862
|
-
* * `style` - The style object to apply to the new node.
|
|
863
|
-
*
|
|
864
|
-
* # Returns
|
|
865
|
-
*
|
|
866
|
-
* The ID of the created node as a `u32`.
|
|
867
|
-
*
|
|
868
|
-
* # Errors
|
|
869
|
-
*
|
|
870
|
-
* Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
|
|
871
|
-
*/
|
|
872
|
-
export function new_leaf(style: any): number;
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* Creates a new node with children and the specified style.
|
|
876
|
-
*
|
|
877
|
-
* # Arguments
|
|
878
|
-
*
|
|
879
|
-
* * `style` - The style object to apply to the new node.
|
|
880
|
-
* * `children` - An array of child node IDs (`u32`) to attach to this node.
|
|
881
|
-
*
|
|
882
|
-
* # Returns
|
|
883
|
-
*
|
|
884
|
-
* The ID of the created node as a `u32`.
|
|
885
|
-
*
|
|
886
|
-
* # Errors
|
|
887
|
-
*
|
|
888
|
-
* Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
|
|
889
|
-
*/
|
|
890
|
-
export function new_with_children(style: any, children: Uint32Array): number;
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Get the total number of nodes
|
|
894
|
-
*/
|
|
895
|
-
export function node_count(): number;
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* Helper function to create a percent dimension
|
|
899
|
-
*/
|
|
900
|
-
export function percent(value: number): Dimension;
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Helper function to create a pixel dimension
|
|
904
|
-
*/
|
|
905
|
-
export function px(value: number): Dimension;
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Removes a child node from a parent node.
|
|
909
|
-
*
|
|
910
|
-
* # Arguments
|
|
911
|
-
*
|
|
912
|
-
* * `parent` - The ID of the parent node.
|
|
913
|
-
* * `child` - The ID of the child node to remove.
|
|
914
|
-
*
|
|
915
|
-
* # Errors
|
|
916
|
-
*
|
|
917
|
-
* Returns a `JsValue` error if the child is not found in the parent.
|
|
918
|
-
*/
|
|
919
|
-
export function remove_child(parent: number, child: number): void;
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* Removes a node from the tree and frees its resources.
|
|
923
|
-
*
|
|
924
|
-
* # Arguments
|
|
925
|
-
*
|
|
926
|
-
* * `node` - The ID of the node to remove.
|
|
927
|
-
*
|
|
928
|
-
* # Errors
|
|
929
|
-
*
|
|
930
|
-
* Returns a `JsValue` error if the node does not exist or cannot be removed.
|
|
931
|
-
*/
|
|
932
|
-
export function remove_node(node: number): void;
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* Sets the children of a node, replacing any existing children.
|
|
936
|
-
*
|
|
937
|
-
* # Arguments
|
|
938
|
-
*
|
|
939
|
-
* * `parent` - The ID of the parent node.
|
|
940
|
-
* * `children` - An array of child node IDs to set.
|
|
941
|
-
*
|
|
942
|
-
* # Errors
|
|
943
|
-
*
|
|
944
|
-
* Returns a `JsValue` error if the operation fails.
|
|
945
|
-
*/
|
|
946
|
-
export function set_children(parent: number, children: Uint32Array): void;
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* Updates the style of an existing node.
|
|
950
|
-
*
|
|
951
|
-
* # Arguments
|
|
952
|
-
*
|
|
953
|
-
* * `node` - The ID of the node to update.
|
|
954
|
-
* * `style` - The new style object to apply.
|
|
955
|
-
*
|
|
956
|
-
* # Errors
|
|
957
|
-
*
|
|
958
|
-
* Returns a `JsValue` error if the style cannot be deserialized or if the node does not exist.
|
|
959
|
-
*/
|
|
960
|
-
export function set_style(node: number, style: any): void;
|
|
961
|
-
|
|
962
1827
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
963
1828
|
|
|
964
1829
|
export interface InitOutput {
|
|
965
1830
|
readonly memory: WebAssembly.Memory;
|
|
966
|
-
readonly __wbg_availablespace_free: (a: number, b: number) => void;
|
|
967
|
-
readonly __wbg_dimension_free: (a: number, b: number) => void;
|
|
968
|
-
readonly __wbg_get_availablespace_height: (a: number) => number;
|
|
969
|
-
readonly __wbg_get_availablespace_width: (a: number) => number;
|
|
970
|
-
readonly __wbg_get_dimension_unit: (a: number) => number;
|
|
971
|
-
readonly __wbg_get_dimension_value: (a: number) => number;
|
|
972
|
-
readonly __wbg_get_layout_height: (a: number) => number;
|
|
973
|
-
readonly __wbg_get_layout_width: (a: number) => number;
|
|
974
|
-
readonly __wbg_get_layout_y: (a: number) => number;
|
|
975
|
-
readonly __wbg_get_line_end: (a: number) => number;
|
|
976
|
-
readonly __wbg_get_line_start: (a: number) => number;
|
|
977
|
-
readonly __wbg_get_style_align_content: (a: number) => number;
|
|
978
|
-
readonly __wbg_get_style_align_items: (a: number) => number;
|
|
979
|
-
readonly __wbg_get_style_align_self: (a: number) => number;
|
|
980
|
-
readonly __wbg_get_style_bottom: (a: number) => number;
|
|
981
|
-
readonly __wbg_get_style_column_gap: (a: number) => number;
|
|
982
|
-
readonly __wbg_get_style_display: (a: number) => number;
|
|
983
|
-
readonly __wbg_get_style_flex_basis: (a: number) => number;
|
|
984
|
-
readonly __wbg_get_style_flex_direction: (a: number) => number;
|
|
985
|
-
readonly __wbg_get_style_flex_wrap: (a: number) => number;
|
|
986
|
-
readonly __wbg_get_style_grid_auto_flow: (a: number) => number;
|
|
987
|
-
readonly __wbg_get_style_height: (a: number) => number;
|
|
988
|
-
readonly __wbg_get_style_justify_content: (a: number) => number;
|
|
989
|
-
readonly __wbg_get_style_left: (a: number) => number;
|
|
990
|
-
readonly __wbg_get_style_margin_bottom: (a: number) => number;
|
|
991
|
-
readonly __wbg_get_style_margin_left: (a: number) => number;
|
|
992
|
-
readonly __wbg_get_style_margin_right: (a: number) => number;
|
|
993
|
-
readonly __wbg_get_style_margin_top: (a: number) => number;
|
|
994
|
-
readonly __wbg_get_style_max_height: (a: number) => number;
|
|
995
|
-
readonly __wbg_get_style_max_width: (a: number) => number;
|
|
996
|
-
readonly __wbg_get_style_min_height: (a: number) => number;
|
|
997
|
-
readonly __wbg_get_style_min_width: (a: number) => number;
|
|
998
|
-
readonly __wbg_get_style_padding_bottom: (a: number) => number;
|
|
999
|
-
readonly __wbg_get_style_padding_left: (a: number) => number;
|
|
1000
|
-
readonly __wbg_get_style_padding_right: (a: number) => number;
|
|
1001
|
-
readonly __wbg_get_style_padding_top: (a: number) => number;
|
|
1002
|
-
readonly __wbg_get_style_position: (a: number) => number;
|
|
1003
|
-
readonly __wbg_get_style_right: (a: number) => number;
|
|
1004
|
-
readonly __wbg_get_style_row_gap: (a: number) => number;
|
|
1005
|
-
readonly __wbg_get_style_text_align: (a: number) => number;
|
|
1006
|
-
readonly __wbg_get_style_top: (a: number) => number;
|
|
1007
|
-
readonly __wbg_get_style_width: (a: number) => number;
|
|
1008
|
-
readonly __wbg_get_taffynode_id: (a: number) => number;
|
|
1009
|
-
readonly __wbg_get_trackdefinition_unit: (a: number) => number;
|
|
1010
|
-
readonly __wbg_line_free: (a: number, b: number) => void;
|
|
1011
|
-
readonly __wbg_point_free: (a: number, b: number) => void;
|
|
1012
|
-
readonly __wbg_set_availablespace_height: (a: number, b: number) => void;
|
|
1013
|
-
readonly __wbg_set_availablespace_width: (a: number, b: number) => void;
|
|
1014
|
-
readonly __wbg_set_dimension_unit: (a: number, b: number) => void;
|
|
1015
|
-
readonly __wbg_set_dimension_value: (a: number, b: number) => void;
|
|
1016
|
-
readonly __wbg_set_layout_height: (a: number, b: number) => void;
|
|
1017
|
-
readonly __wbg_set_layout_width: (a: number, b: number) => void;
|
|
1018
|
-
readonly __wbg_set_layout_y: (a: number, b: number) => void;
|
|
1019
|
-
readonly __wbg_set_line_end: (a: number, b: number) => void;
|
|
1020
|
-
readonly __wbg_set_line_start: (a: number, b: number) => void;
|
|
1021
|
-
readonly __wbg_set_style_align_content: (a: number, b: number) => void;
|
|
1022
|
-
readonly __wbg_set_style_align_items: (a: number, b: number) => void;
|
|
1023
|
-
readonly __wbg_set_style_align_self: (a: number, b: number) => void;
|
|
1024
|
-
readonly __wbg_set_style_bottom: (a: number, b: number) => void;
|
|
1025
|
-
readonly __wbg_set_style_column_gap: (a: number, b: number) => void;
|
|
1026
|
-
readonly __wbg_set_style_display: (a: number, b: number) => void;
|
|
1027
|
-
readonly __wbg_set_style_flex_basis: (a: number, b: number) => void;
|
|
1028
|
-
readonly __wbg_set_style_flex_direction: (a: number, b: number) => void;
|
|
1029
|
-
readonly __wbg_set_style_flex_wrap: (a: number, b: number) => void;
|
|
1030
|
-
readonly __wbg_set_style_grid_auto_flow: (a: number, b: number) => void;
|
|
1031
|
-
readonly __wbg_set_style_height: (a: number, b: number) => void;
|
|
1032
|
-
readonly __wbg_set_style_justify_content: (a: number, b: number) => void;
|
|
1033
|
-
readonly __wbg_set_style_left: (a: number, b: number) => void;
|
|
1034
|
-
readonly __wbg_set_style_margin_bottom: (a: number, b: number) => void;
|
|
1035
|
-
readonly __wbg_set_style_margin_left: (a: number, b: number) => void;
|
|
1036
|
-
readonly __wbg_set_style_margin_right: (a: number, b: number) => void;
|
|
1037
|
-
readonly __wbg_set_style_margin_top: (a: number, b: number) => void;
|
|
1038
|
-
readonly __wbg_set_style_max_height: (a: number, b: number) => void;
|
|
1039
|
-
readonly __wbg_set_style_max_width: (a: number, b: number) => void;
|
|
1040
|
-
readonly __wbg_set_style_min_height: (a: number, b: number) => void;
|
|
1041
|
-
readonly __wbg_set_style_min_width: (a: number, b: number) => void;
|
|
1042
|
-
readonly __wbg_set_style_padding_bottom: (a: number, b: number) => void;
|
|
1043
|
-
readonly __wbg_set_style_padding_left: (a: number, b: number) => void;
|
|
1044
|
-
readonly __wbg_set_style_padding_right: (a: number, b: number) => void;
|
|
1045
|
-
readonly __wbg_set_style_padding_top: (a: number, b: number) => void;
|
|
1046
|
-
readonly __wbg_set_style_position: (a: number, b: number) => void;
|
|
1047
|
-
readonly __wbg_set_style_right: (a: number, b: number) => void;
|
|
1048
|
-
readonly __wbg_set_style_row_gap: (a: number, b: number) => void;
|
|
1049
|
-
readonly __wbg_set_style_text_align: (a: number, b: number) => void;
|
|
1050
|
-
readonly __wbg_set_style_top: (a: number, b: number) => void;
|
|
1051
|
-
readonly __wbg_set_style_width: (a: number, b: number) => void;
|
|
1052
|
-
readonly __wbg_set_taffynode_id: (a: number, b: number) => void;
|
|
1053
|
-
readonly __wbg_set_trackdefinition_unit: (a: number, b: number) => void;
|
|
1054
|
-
readonly __wbg_style_free: (a: number, b: number) => void;
|
|
1055
|
-
readonly __wbg_taffynode_free: (a: number, b: number) => void;
|
|
1056
|
-
readonly __wbg_trackdefinition_free: (a: number, b: number) => void;
|
|
1057
|
-
readonly add_child: (a: number, b: number) => [number, number];
|
|
1058
|
-
readonly auto: () => number;
|
|
1059
|
-
readonly clear: () => [number, number];
|
|
1060
|
-
readonly compute_layout: (a: number, b: any) => [number, number];
|
|
1061
|
-
readonly dimension: (a: number, b: number) => number;
|
|
1062
|
-
readonly get_children: (a: number) => [number, number, number, number];
|
|
1063
|
-
readonly get_layout: (a: number) => [number, number, number];
|
|
1064
|
-
readonly get_parent: (a: number) => [number, number, number];
|
|
1065
|
-
readonly init: () => void;
|
|
1066
|
-
readonly mark_dirty: (a: number) => [number, number];
|
|
1067
|
-
readonly new_leaf: (a: any) => [number, number, number];
|
|
1068
|
-
readonly new_with_children: (a: any, b: number, c: number) => [number, number, number];
|
|
1069
|
-
readonly node_count: () => number;
|
|
1070
|
-
readonly percent: (a: number) => number;
|
|
1071
|
-
readonly px: (a: number) => number;
|
|
1072
|
-
readonly remove_child: (a: number, b: number) => [number, number];
|
|
1073
|
-
readonly remove_node: (a: number) => [number, number];
|
|
1074
|
-
readonly set_children: (a: number, b: number, c: number) => [number, number];
|
|
1075
|
-
readonly set_style: (a: number, b: any) => [number, number];
|
|
1076
|
-
readonly taffynode_add_child: (a: number, b: number) => [number, number];
|
|
1077
|
-
readonly taffynode_compute_layout: (a: number, b: any) => [number, number];
|
|
1078
|
-
readonly taffynode_free: (a: number) => [number, number];
|
|
1079
|
-
readonly taffynode_get_layout: (a: number) => [number, number, number];
|
|
1080
|
-
readonly taffynode_new: (a: any) => [number, number, number];
|
|
1081
|
-
readonly taffynode_remove_child: (a: number, b: number) => [number, number];
|
|
1082
|
-
readonly taffynode_set_children: (a: number, b: number, c: number) => [number, number];
|
|
1083
|
-
readonly taffynode_set_style: (a: number, b: any) => [number, number];
|
|
1084
|
-
readonly taffynode_style: (a: number) => [number, number, number];
|
|
1085
|
-
readonly __wbg_set_layout_x: (a: number, b: number) => void;
|
|
1086
|
-
readonly __wbg_set_point_x: (a: number, b: number) => void;
|
|
1087
|
-
readonly __wbg_set_point_y: (a: number, b: number) => void;
|
|
1088
|
-
readonly __wbg_set_rect_bottom: (a: number, b: number) => void;
|
|
1089
|
-
readonly __wbg_set_rect_left: (a: number, b: number) => void;
|
|
1090
|
-
readonly __wbg_set_rect_right: (a: number, b: number) => void;
|
|
1091
|
-
readonly __wbg_set_rect_top: (a: number, b: number) => void;
|
|
1092
|
-
readonly __wbg_set_size_height: (a: number, b: number) => void;
|
|
1093
|
-
readonly __wbg_set_size_width: (a: number, b: number) => void;
|
|
1094
|
-
readonly __wbg_set_trackdefinition_value: (a: number, b: number) => void;
|
|
1095
|
-
readonly __wbg_set_style_flex_grow: (a: number, b: number) => void;
|
|
1096
|
-
readonly __wbg_set_style_flex_shrink: (a: number, b: number) => void;
|
|
1097
|
-
readonly __wbg_get_style_flex_grow: (a: number) => number;
|
|
1098
|
-
readonly __wbg_get_style_flex_shrink: (a: number) => number;
|
|
1099
|
-
readonly __wbg_get_layout_x: (a: number) => number;
|
|
1100
|
-
readonly __wbg_get_point_x: (a: number) => number;
|
|
1101
|
-
readonly __wbg_get_point_y: (a: number) => number;
|
|
1102
|
-
readonly __wbg_get_rect_bottom: (a: number) => number;
|
|
1103
|
-
readonly __wbg_get_rect_left: (a: number) => number;
|
|
1104
|
-
readonly __wbg_get_rect_right: (a: number) => number;
|
|
1105
|
-
readonly __wbg_get_rect_top: (a: number) => number;
|
|
1106
|
-
readonly __wbg_get_size_height: (a: number) => number;
|
|
1107
|
-
readonly __wbg_get_size_width: (a: number) => number;
|
|
1108
|
-
readonly __wbg_get_trackdefinition_value: (a: number) => number;
|
|
1109
|
-
readonly __wbg_rect_free: (a: number, b: number) => void;
|
|
1110
1831
|
readonly __wbg_layout_free: (a: number, b: number) => void;
|
|
1111
|
-
readonly
|
|
1832
|
+
readonly __wbg_style_free: (a: number, b: number) => void;
|
|
1833
|
+
readonly __wbg_taffyerror_free: (a: number, b: number) => void;
|
|
1834
|
+
readonly __wbg_taffytree_free: (a: number, b: number) => void;
|
|
1835
|
+
readonly layout_borderBottom: (a: number) => number;
|
|
1836
|
+
readonly layout_borderLeft: (a: number) => number;
|
|
1837
|
+
readonly layout_borderRight: (a: number) => number;
|
|
1838
|
+
readonly layout_borderTop: (a: number) => number;
|
|
1839
|
+
readonly layout_contentHeight: (a: number) => number;
|
|
1840
|
+
readonly layout_contentWidth: (a: number) => number;
|
|
1841
|
+
readonly layout_height: (a: number) => number;
|
|
1842
|
+
readonly layout_marginBottom: (a: number) => number;
|
|
1843
|
+
readonly layout_marginLeft: (a: number) => number;
|
|
1844
|
+
readonly layout_marginRight: (a: number) => number;
|
|
1845
|
+
readonly layout_marginTop: (a: number) => number;
|
|
1846
|
+
readonly layout_order: (a: number) => number;
|
|
1847
|
+
readonly layout_paddingBottom: (a: number) => number;
|
|
1848
|
+
readonly layout_paddingLeft: (a: number) => number;
|
|
1849
|
+
readonly layout_paddingRight: (a: number) => number;
|
|
1850
|
+
readonly layout_paddingTop: (a: number) => number;
|
|
1851
|
+
readonly layout_scrollbarHeight: (a: number) => number;
|
|
1852
|
+
readonly layout_scrollbarWidth: (a: number) => number;
|
|
1853
|
+
readonly layout_width: (a: number) => number;
|
|
1854
|
+
readonly layout_x: (a: number) => number;
|
|
1855
|
+
readonly layout_y: (a: number) => number;
|
|
1856
|
+
readonly style_alignContent: (a: number) => number;
|
|
1857
|
+
readonly style_alignItems: (a: number) => number;
|
|
1858
|
+
readonly style_alignSelf: (a: number) => number;
|
|
1859
|
+
readonly style_aspectRatio: (a: number) => number;
|
|
1860
|
+
readonly style_border: (a: number) => any;
|
|
1861
|
+
readonly style_boxSizing: (a: number) => number;
|
|
1862
|
+
readonly style_display: (a: number) => number;
|
|
1863
|
+
readonly style_flexBasis: (a: number) => any;
|
|
1864
|
+
readonly style_flexDirection: (a: number) => number;
|
|
1865
|
+
readonly style_flexGrow: (a: number) => number;
|
|
1866
|
+
readonly style_flexShrink: (a: number) => number;
|
|
1867
|
+
readonly style_flexWrap: (a: number) => number;
|
|
1868
|
+
readonly style_gap: (a: number) => any;
|
|
1869
|
+
readonly style_inset: (a: number) => any;
|
|
1870
|
+
readonly style_justifyContent: (a: number) => number;
|
|
1871
|
+
readonly style_margin: (a: number) => any;
|
|
1872
|
+
readonly style_maxSize: (a: number) => any;
|
|
1873
|
+
readonly style_minSize: (a: number) => any;
|
|
1874
|
+
readonly style_new: () => number;
|
|
1875
|
+
readonly style_overflow: (a: number) => any;
|
|
1876
|
+
readonly style_padding: (a: number) => any;
|
|
1877
|
+
readonly style_position: (a: number) => number;
|
|
1878
|
+
readonly style_set_alignContent: (a: number, b: any) => void;
|
|
1879
|
+
readonly style_set_alignItems: (a: number, b: any) => void;
|
|
1880
|
+
readonly style_set_alignSelf: (a: number, b: any) => void;
|
|
1881
|
+
readonly style_set_aspectRatio: (a: number, b: any) => void;
|
|
1882
|
+
readonly style_set_border: (a: number, b: any) => void;
|
|
1883
|
+
readonly style_set_boxSizing: (a: number, b: number) => void;
|
|
1884
|
+
readonly style_set_display: (a: number, b: number) => void;
|
|
1885
|
+
readonly style_set_flexBasis: (a: number, b: any) => void;
|
|
1886
|
+
readonly style_set_flexDirection: (a: number, b: number) => void;
|
|
1887
|
+
readonly style_set_flexGrow: (a: number, b: number) => void;
|
|
1888
|
+
readonly style_set_flexShrink: (a: number, b: number) => void;
|
|
1889
|
+
readonly style_set_flexWrap: (a: number, b: number) => void;
|
|
1890
|
+
readonly style_set_gap: (a: number, b: any) => void;
|
|
1891
|
+
readonly style_set_inset: (a: number, b: any) => void;
|
|
1892
|
+
readonly style_set_justifyContent: (a: number, b: any) => void;
|
|
1893
|
+
readonly style_set_margin: (a: number, b: any) => void;
|
|
1894
|
+
readonly style_set_maxSize: (a: number, b: any) => void;
|
|
1895
|
+
readonly style_set_minSize: (a: number, b: any) => void;
|
|
1896
|
+
readonly style_set_overflow: (a: number, b: any) => void;
|
|
1897
|
+
readonly style_set_padding: (a: number, b: any) => void;
|
|
1898
|
+
readonly style_set_position: (a: number, b: number) => void;
|
|
1899
|
+
readonly style_set_size: (a: number, b: any) => void;
|
|
1900
|
+
readonly style_size: (a: number) => any;
|
|
1901
|
+
readonly taffyerror_message: (a: number) => [number, number];
|
|
1902
|
+
readonly taffytree_addChild: (a: number, b: bigint, c: bigint) => [number, number];
|
|
1903
|
+
readonly taffytree_childCount: (a: number, b: bigint) => number;
|
|
1904
|
+
readonly taffytree_children: (a: number, b: bigint) => [number, number, number, number];
|
|
1905
|
+
readonly taffytree_clear: (a: number) => void;
|
|
1906
|
+
readonly taffytree_computeLayout: (a: number, b: bigint, c: any) => [number, number];
|
|
1907
|
+
readonly taffytree_computeLayoutWithMeasure: (a: number, b: bigint, c: any, d: any) => [number, number];
|
|
1908
|
+
readonly taffytree_dirty: (a: number, b: bigint) => [number, number, number];
|
|
1909
|
+
readonly taffytree_disableRounding: (a: number) => void;
|
|
1910
|
+
readonly taffytree_enableRounding: (a: number) => void;
|
|
1911
|
+
readonly taffytree_getChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
1912
|
+
readonly taffytree_getDisjointNodeContextMut: (a: number, b: number, c: number) => [number, number, number, number];
|
|
1913
|
+
readonly taffytree_getLayout: (a: number, b: bigint) => [number, number, number];
|
|
1914
|
+
readonly taffytree_getNodeContext: (a: number, b: bigint) => [number, number, number];
|
|
1915
|
+
readonly taffytree_getNodeContextMut: (a: number, b: bigint) => [number, number, number];
|
|
1916
|
+
readonly taffytree_getStyle: (a: number, b: bigint) => [number, number, number];
|
|
1917
|
+
readonly taffytree_insertChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [number, number];
|
|
1918
|
+
readonly taffytree_markDirty: (a: number, b: bigint) => [number, number];
|
|
1919
|
+
readonly taffytree_new: () => number;
|
|
1920
|
+
readonly taffytree_newLeaf: (a: number, b: number) => [bigint, number, number];
|
|
1921
|
+
readonly taffytree_newLeafWithContext: (a: number, b: number, c: any) => [bigint, number, number];
|
|
1922
|
+
readonly taffytree_newWithChildren: (a: number, b: number, c: number, d: number) => [bigint, number, number];
|
|
1923
|
+
readonly taffytree_parent: (a: number, b: bigint) => [number, bigint];
|
|
1924
|
+
readonly taffytree_printTree: (a: number, b: bigint) => void;
|
|
1925
|
+
readonly taffytree_remove: (a: number, b: bigint) => [bigint, number, number];
|
|
1926
|
+
readonly taffytree_removeChild: (a: number, b: bigint, c: bigint) => [bigint, number, number];
|
|
1927
|
+
readonly taffytree_removeChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
1928
|
+
readonly taffytree_removeChildrenRange: (a: number, b: bigint, c: number, d: number) => [number, number];
|
|
1929
|
+
readonly taffytree_replaceChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [bigint, number, number];
|
|
1930
|
+
readonly taffytree_setChildren: (a: number, b: bigint, c: number, d: number) => [number, number];
|
|
1931
|
+
readonly taffytree_setNodeContext: (a: number, b: bigint, c: any) => [number, number];
|
|
1932
|
+
readonly taffytree_setStyle: (a: number, b: bigint, c: number) => [number, number];
|
|
1933
|
+
readonly taffytree_totalNodeCount: (a: number) => number;
|
|
1934
|
+
readonly taffytree_unroundedLayout: (a: number, b: bigint) => number;
|
|
1935
|
+
readonly taffytree_withCapacity: (a: number) => number;
|
|
1112
1936
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1113
1937
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
1114
1938
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
@@ -1116,6 +1940,7 @@ export interface InitOutput {
|
|
|
1116
1940
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
1117
1941
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
1118
1942
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
1943
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
1119
1944
|
readonly __wbindgen_start: () => void;
|
|
1120
1945
|
}
|
|
1121
1946
|
|