taffy-js 0.1.3 → 0.2.1

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/taffy_js.d.ts CHANGED
@@ -2,1208 +2,796 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  /**
5
- * How lines of content are aligned along the cross axis when there is extra space.
5
+ * Multi-line content alignment enum (Align Content)
6
+ *
7
+ * Controls spacing distribution between lines in a multi-line flex container.
8
+ * Corresponds to CSS `align-content` property. Only effective when `flex-wrap: wrap`.
9
+ *
10
+ * # Variants
11
+ * - `SpaceBetween`: Lines evenly distributed, first/last lines flush with edges
12
+ * - `SpaceAround`: Equal space on both sides of each line
13
+ * - `SpaceEvenly`: All spacing completely equal
6
14
  */
7
15
  export enum AlignContent {
8
- /**
9
- * Lines are packed toward the start of the cross axis.
10
- */
11
16
  Start = 0,
12
- /**
13
- * Lines are packed toward the end of the cross axis.
14
- */
15
17
  End = 1,
16
- /**
17
- * Lines are packed toward the start of the flex-direction cross axis.
18
- */
19
18
  FlexStart = 2,
20
- /**
21
- * Lines are packed toward the end of the flex-direction cross axis.
22
- */
23
19
  FlexEnd = 3,
24
- /**
25
- * Lines are packed toward the center of the cross axis.
26
- */
27
20
  Center = 4,
28
- /**
29
- * Lines are evenly distributed; the first line is at the start, the last at the end.
30
- */
31
- SpaceBetween = 5,
32
- /**
33
- * Lines are evenly distributed with equal space around them.
34
- */
35
- SpaceAround = 6,
36
- /**
37
- * Lines are evenly distributed with equal space between them.
38
- */
39
- SpaceEvenly = 7,
40
- /**
41
- * Lines are stretched to take up the remaining space.
42
- */
43
- Stretch = 8,
21
+ Stretch = 5,
22
+ SpaceBetween = 6,
23
+ SpaceAround = 7,
24
+ SpaceEvenly = 8,
44
25
  }
45
26
 
46
27
  /**
47
- * How items are aligned along the cross axis.
28
+ * Cross-axis alignment enum for children (Align Items)
29
+ *
30
+ * Defines how all children are aligned on the cross axis in a Flex/Grid container.
31
+ *
32
+ * # Variants
33
+ * - `Start/FlexStart`: Align to cross axis start
34
+ * - `End/FlexEnd`: Align to cross axis end
35
+ * - `Center`: Center alignment
36
+ * - `Baseline`: Baseline alignment (text baseline)
37
+ * - `Stretch`: Stretch to fill container
48
38
  */
49
39
  export enum AlignItems {
50
- /**
51
- * Items are aligned at the start of the cross axis.
52
- */
53
40
  Start = 0,
54
- /**
55
- * Items are aligned at the end of the cross axis.
56
- */
57
41
  End = 1,
58
- /**
59
- * Items are aligned at the start of the flex-direction cross axis.
60
- */
61
42
  FlexStart = 2,
62
- /**
63
- * Items are aligned at the end of the flex-direction cross axis.
64
- */
65
43
  FlexEnd = 3,
66
- /**
67
- * Items are aligned at the center of the cross axis.
68
- */
69
44
  Center = 4,
70
- /**
71
- * Items are aligned based on their baselines.
72
- */
73
45
  Baseline = 5,
74
- /**
75
- * Items are stretched to fill the container along the cross axis.
76
- */
77
46
  Stretch = 6,
78
47
  }
79
48
 
80
49
  /**
81
- * How a single item is aligned along the cross axis, overriding `AlignItems`.
50
+ * Cross-axis alignment enum for single element (Align Self)
51
+ *
52
+ * Overrides parent's `align-items` for a single child element's cross-axis alignment.
53
+ *
54
+ * # Variants
55
+ * - `Auto`: Inherit parent's `align-items` value
56
+ * - Other values have same meaning as `AlignItems`
82
57
  */
83
58
  export enum AlignSelf {
84
- /**
85
- * Auto
86
- */
87
59
  Auto = 0,
88
- /**
89
- * items are aligned at the start of the cross axis.
90
- */
91
60
  Start = 1,
92
- /**
93
- * Items are aligned at the end of the cross axis.
94
- */
95
61
  End = 2,
96
- /**
97
- * Items are aligned at the start of the flex-direction cross axis.
98
- */
99
62
  FlexStart = 3,
100
- /**
101
- * Items are aligned at the end of the flex-direction cross axis.
102
- */
103
63
  FlexEnd = 4,
104
- /**
105
- * Items are aligned at the center of the cross axis.
106
- */
107
64
  Center = 5,
108
- /**
109
- * Items are aligned based on their baselines.
110
- */
111
65
  Baseline = 6,
112
- /**
113
- * Items are stretched to fill the container along the cross axis.
114
- */
115
66
  Stretch = 7,
116
67
  }
117
68
 
118
- export class AvailableSpace {
119
- private constructor();
120
- free(): void;
121
- [Symbol.dispose](): void;
122
- /**
123
- * The available width (None means undefined/max-content).
124
- */
125
- get width(): number | undefined;
126
- /**
127
- * The available width (None means undefined/max-content).
128
- */
129
- set width(value: number | null | undefined);
130
- /**
131
- * The available height (None means undefined/max-content).
132
- */
133
- get height(): number | undefined;
134
- /**
135
- * The available height (None means undefined/max-content).
136
- */
137
- set height(value: number | null | undefined);
138
- }
139
-
140
- export class Dimension {
141
- private constructor();
142
- free(): void;
143
- [Symbol.dispose](): void;
144
- /**
145
- * The numeric value of the dimension.
146
- * - For `Pixels`, this is the number of pixels.
147
- * - 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).
148
- * - For `Auto`, this value is typically ignored.
149
- */
150
- value: number;
151
- /**
152
- * The unit of the dimension.
153
- */
154
- unit: DimensionUnit;
155
- }
156
-
157
69
  /**
158
- * The unit of a dimension.
159
- */
160
- export enum DimensionUnit {
161
- /**
162
- * The dimension is specified in logical pixels.
163
- */
164
- Pixels = 0,
165
- /**
166
- * The dimension is specified as a percentage of the parent's size.
167
- */
168
- Percent = 1,
169
- /**
170
- * The dimension is determined automatically based on content or context.
171
- */
172
- Auto = 2,
173
- }
174
-
175
- /**
176
- * The display style of a node.
70
+ * Display mode enum
71
+ *
72
+ * Controls the layout algorithm type for an element. Corresponds to CSS `display` property.
73
+ *
74
+ * # Variants
75
+ * - `Block`: Block-level layout, element takes full width
76
+ * - `Flex`: Flexbox layout, one-dimensional layout model
77
+ * - `Grid`: CSS Grid layout, two-dimensional layout model
78
+ * - `None`: Hidden, element does not participate in layout calculation
177
79
  */
178
80
  export enum Display {
179
- /**
180
- * The node is hidden and does not take up space.
181
- */
182
- None = 0,
183
- /**
184
- * The node behaves as a flex container.
185
- */
81
+ Block = 0,
186
82
  Flex = 1,
187
- /**
188
- * The node behaves as a grid container.
189
- */
190
83
  Grid = 2,
191
- /**
192
- * The node behaves as a block element.
193
- */
194
- Block = 3,
84
+ None = 3,
195
85
  }
196
86
 
197
87
  /**
198
- * Start and End are used for logical positioning (e.g. paddingStart).
199
- */
200
- export enum Edge {
201
- Left = 0,
202
- Right = 1,
203
- Top = 2,
204
- Bottom = 3,
205
- Start = 4,
206
- End = 5,
207
- Horizontal = 6,
208
- Vertical = 7,
209
- All = 8,
210
- }
211
-
212
- /**
213
- * The direction of the main axis for a flex container.
88
+ * Flex main axis direction enum
89
+ *
90
+ * Defines the direction children are laid out in a flex container. Corresponds to CSS `flex-direction` property.
91
+ *
92
+ * # Variants
93
+ * - `Row`: Horizontal direction, left to right (LTR mode)
94
+ * - `Column`: Vertical direction, top to bottom
95
+ * - `RowReverse`: Horizontal reverse, right to left
96
+ * - `ColumnReverse`: Vertical reverse, bottom to top
214
97
  */
215
98
  export enum FlexDirection {
216
- /**
217
- * Items are placed horizontally from left to right.
218
- */
219
99
  Row = 0,
220
- /**
221
- * Items are placed vertically from top to bottom.
222
- */
223
100
  Column = 1,
224
- /**
225
- * Items are placed horizontally from right to left.
226
- */
227
101
  RowReverse = 2,
228
- /**
229
- * Items are placed vertically from bottom to top.
230
- */
231
102
  ColumnReverse = 3,
232
103
  }
233
104
 
234
105
  /**
235
- * Whether flex items are forced into a single line or can wrap onto multiple lines.
106
+ * Flex wrap mode enum
107
+ *
108
+ * Controls whether flex items wrap onto multiple lines. Corresponds to CSS `flex-wrap` property.
109
+ *
110
+ * # Variants
111
+ * - `NoWrap`: No wrapping, all items compressed into single line/column
112
+ * - `Wrap`: Automatic wrapping, items flow to next line when container overflows
113
+ * - `WrapReverse`: Reverse wrapping, new lines appear above or to the left
236
114
  */
237
115
  export enum FlexWrap {
238
- /**
239
- * Items are forced into a single line.
240
- */
241
116
  NoWrap = 0,
242
- /**
243
- * Items wrap onto multiple lines.
244
- */
245
117
  Wrap = 1,
246
- /**
247
- * Items wrap onto multiple lines in reverse order.
248
- */
249
118
  WrapReverse = 2,
250
119
  }
251
120
 
252
121
  /**
253
- * Grid auto-placement algorithm controls how auto-placed items get flowed into the grid.
254
- */
255
- export enum GridAutoFlow {
256
- /**
257
- * Items are placed by filling each row in turn, adding new rows as necessary.
258
- */
259
- Row = 0,
260
- /**
261
- * Items are placed by filling each column in turn, adding new columns as necessary.
262
- */
263
- Column = 1,
264
- /**
265
- * Items are placed by filling each row, attempting to fill holes earlier in the grid.
266
- */
267
- RowDense = 2,
268
- /**
269
- * Items are placed by filling each column, attempting to fill holes earlier in the grid.
270
- */
271
- ColumnDense = 3,
272
- }
273
-
274
- export enum Gutter {
275
- Column = 0,
276
- Row = 1,
277
- All = 2,
278
- }
279
-
280
- /**
281
- * How items are distributed along the main axis.
122
+ * Main axis alignment enum (Justify Content)
123
+ *
124
+ * Defines alignment and spacing distribution of children along the main axis.
125
+ * Corresponds to CSS `justify-content` property.
126
+ *
127
+ * # Variants
128
+ * - `Start/FlexStart`: Align to main axis start
129
+ * - `End/FlexEnd`: Align to main axis end
130
+ * - `Center`: Center alignment
131
+ * - `SpaceBetween`: First and last items flush with edges, remaining space distributed evenly
132
+ * - `SpaceAround`: Equal space on both sides of each item
133
+ * - `SpaceEvenly`: All spacing completely equal
282
134
  */
283
135
  export enum JustifyContent {
284
- /**
285
- * Items are packed toward the start of the layout direction.
286
- */
287
136
  Start = 0,
288
- /**
289
- * Items are packed toward the end of the layout direction.
290
- */
291
137
  End = 1,
292
- /**
293
- * Items are packed toward the start of the flex-direction.
294
- */
295
138
  FlexStart = 2,
296
- /**
297
- * Items are packed toward the end of the flex-direction.
298
- */
299
139
  FlexEnd = 3,
300
- /**
301
- * Items are centered along the line.
302
- */
303
140
  Center = 4,
304
- /**
305
- * Items are evenly distributed; the first item is at the start, the last at the end.
306
- */
307
- SpaceBetween = 5,
308
- /**
309
- * Items are evenly distributed with equal space around them.
310
- */
311
- SpaceAround = 6,
312
- /**
313
- * Items are evenly distributed with equal space between them using the same gap at ends.
314
- */
315
- SpaceEvenly = 7,
141
+ Stretch = 5,
142
+ SpaceBetween = 6,
143
+ SpaceAround = 7,
144
+ SpaceEvenly = 8,
316
145
  }
317
146
 
318
- export class Layout {
319
- private constructor();
320
- free(): void;
321
- [Symbol.dispose](): void;
322
- /**
323
- * The absolute x-coordinate of the node relative to its parent.
324
- */
325
- x: number;
326
- /**
327
- * The absolute y-coordinate of the node relative to its parent.
328
- */
329
- y: number;
330
- /**
331
- * The computed width of the node.
332
- */
333
- width: number;
334
- /**
335
- * The computed height of the node.
336
- */
337
- height: number;
338
- }
339
-
340
- export class Line {
341
- private constructor();
342
- free(): void;
343
- [Symbol.dispose](): void;
344
- /**
345
- * The start line index (1-based).
346
- */
347
- get start(): number | undefined;
348
- /**
349
- * The start line index (1-based).
350
- */
351
- set start(value: number | null | undefined);
352
- /**
353
- * The end line index (1-based).
354
- */
355
- get end(): number | undefined;
356
- /**
357
- * The end line index (1-based).
358
- */
359
- set end(value: number | null | undefined);
360
- }
361
-
362
- export class Point {
363
- private constructor();
364
- free(): void;
365
- [Symbol.dispose](): void;
366
- /**
367
- * The x-coordinate (horizontal).
368
- */
369
- x: number;
370
- /**
371
- * The y-coordinate (vertical).
372
- */
373
- y: number;
147
+ /**
148
+ * Overflow handling enum
149
+ *
150
+ * Defines how content that overflows container boundaries is handled.
151
+ * Corresponds to CSS `overflow` property.
152
+ *
153
+ * # Variants
154
+ * - `Visible`: Content is not clipped
155
+ * - `Hidden`: Content is clipped, overflow hidden
156
+ * - `Scroll`: Always show scrollbars
157
+ * - `Auto`: Show scrollbars when needed (internally mapped to Scroll)
158
+ */
159
+ export enum Overflow {
160
+ Visible = 0,
161
+ Hidden = 1,
162
+ Scroll = 2,
163
+ Auto = 3,
374
164
  }
375
165
 
376
166
  /**
377
- * Positioning strategy for a node.
167
+ * Position mode enum
168
+ *
169
+ * Controls element positioning method. Corresponds to CSS `position` property.
170
+ *
171
+ * # Variants
172
+ * - `Relative`: Relative positioning, element stays in normal document flow
173
+ * - `Absolute`: Absolute positioning, element removed from flow, positioned relative to nearest positioned ancestor
378
174
  */
379
175
  export enum Position {
380
- /**
381
- * Relative to its normal position in the flow.
382
- */
383
- Static = 0,
384
- /**
385
- * Relative to its normal position in the flow.
386
- */
387
- Relative = 1,
388
- /**
389
- * Removed from the flow and positioned relative to its containing block.
390
- */
391
- Absolute = 2,
392
- }
393
-
394
- export class Rect {
395
- private constructor();
396
- free(): void;
397
- [Symbol.dispose](): void;
398
- /**
399
- * The left edge value.
400
- */
401
- left: number;
402
- /**
403
- * The right edge value.
404
- */
405
- right: number;
406
- /**
407
- * The top edge value.
408
- */
409
- top: number;
410
- /**
411
- * The bottom edge value.
412
- */
413
- bottom: number;
414
- }
415
-
416
- export class Size {
417
- private constructor();
418
- free(): void;
419
- [Symbol.dispose](): void;
420
- /**
421
- * The width dimension.
422
- */
423
- width: number;
424
- /**
425
- * The height dimension.
426
- */
427
- height: number;
176
+ Relative = 0,
177
+ Absolute = 1,
428
178
  }
429
179
 
430
180
  export class Style {
431
- private constructor();
432
181
  free(): void;
433
182
  [Symbol.dispose](): void;
434
183
  /**
435
- * The display mode of the node (e.g. Flex, Grid, None).
436
- */
437
- get display(): Display | undefined;
438
- /**
439
- * The display mode of the node (e.g. Flex, Grid, None).
440
- */
441
- set display(value: Display | null | undefined);
442
- /**
443
- * The positioning strategy (e.g. Relative, Absolute).
444
- */
445
- get position(): Position | undefined;
446
- /**
447
- * The positioning strategy (e.g. Relative, Absolute).
448
- */
449
- set position(value: Position | null | undefined);
450
- /**
451
- * The width of the node.
452
- */
453
- get width(): Dimension | undefined;
454
- /**
455
- * The width of the node.
456
- */
457
- set width(value: Dimension | null | undefined);
458
- /**
459
- * The height of the node.
460
- */
461
- get height(): Dimension | undefined;
462
- /**
463
- * The height of the node.
464
- */
465
- set height(value: Dimension | null | undefined);
466
- /**
467
- * The minimum width of the node.
468
- */
469
- get min_width(): Dimension | undefined;
470
- /**
471
- * The minimum width of the node.
472
- */
473
- set min_width(value: Dimension | null | undefined);
474
- /**
475
- * The minimum height of the node.
476
- */
477
- get min_height(): Dimension | undefined;
478
- /**
479
- * The minimum height of the node.
480
- */
481
- set min_height(value: Dimension | null | undefined);
482
- /**
483
- * The maximum width of the node.
484
- */
485
- get max_width(): Dimension | undefined;
486
- /**
487
- * The maximum width of the node.
488
- */
489
- set max_width(value: Dimension | null | undefined);
490
- /**
491
- * The maximum height of the node.
492
- */
493
- get max_height(): Dimension | undefined;
494
- /**
495
- * The maximum height of the node.
496
- */
497
- set max_height(value: Dimension | null | undefined);
498
- /**
499
- * The offset from the left edge (used with Position::Absolute/Relative).
500
- */
501
- get left(): Dimension | undefined;
502
- /**
503
- * The offset from the left edge (used with Position::Absolute/Relative).
504
- */
505
- set left(value: Dimension | null | undefined);
506
- /**
507
- * The offset from the right edge.
508
- */
509
- get right(): Dimension | undefined;
510
- /**
511
- * The offset from the right edge.
512
- */
513
- set right(value: Dimension | null | undefined);
514
- /**
515
- * The offset from the top edge.
184
+ * Creates a new Style instance with default values.
185
+ *
186
+ * All properties are initialized to their CSS default values:
187
+ * - display: Block
188
+ * - position: Relative
189
+ * - flex_direction: Row
190
+ * - All dimensions: Auto
191
+ * - All spacing (margin, padding, border): 0
192
+ *
193
+ * # Returns
194
+ * A new Style instance with default configuration.
195
+ *
196
+ * # Example
197
+ * ```javascript
198
+ * const style = new Style();
199
+ * style.display = Display.Flex;
200
+ * ```
201
+ */
202
+ constructor();
203
+ /**
204
+ * Gets the align-self property. Overrides parent's align-items for this element.
205
+ * Returns AlignSelf.Auto if not explicitly set.
516
206
  */
517
- get top(): Dimension | undefined;
518
- /**
519
- * The offset from the top edge.
520
- */
521
- set top(value: Dimension | null | undefined);
522
- /**
523
- * The offset from the bottom edge.
524
- */
525
- get bottom(): Dimension | undefined;
526
- /**
527
- * The offset from the bottom edge.
528
- */
529
- set bottom(value: Dimension | null | undefined);
530
- /**
531
- * The margin on the left side.
532
- */
533
- get margin_left(): Dimension | undefined;
534
- /**
535
- * The margin on the left side.
536
- */
537
- set margin_left(value: Dimension | null | undefined);
538
- /**
539
- * The margin on the right side.
540
- */
541
- get margin_right(): Dimension | undefined;
542
- /**
543
- * The margin on the right side.
544
- */
545
- set margin_right(value: Dimension | null | undefined);
546
- /**
547
- * The margin on the top side.
548
- */
549
- get margin_top(): Dimension | undefined;
550
- /**
551
- * The margin on the top side.
552
- */
553
- set margin_top(value: Dimension | null | undefined);
554
- /**
555
- * The margin on the bottom side.
556
- */
557
- get margin_bottom(): Dimension | undefined;
558
- /**
559
- * The margin on the bottom side.
560
- */
561
- set margin_bottom(value: Dimension | null | undefined);
562
- /**
563
- * The padding on the left side.
564
- */
565
- get padding_left(): Dimension | undefined;
566
- /**
567
- * The padding on the left side.
568
- */
569
- set padding_left(value: Dimension | null | undefined);
570
- /**
571
- * The padding on the right side.
572
- */
573
- get padding_right(): Dimension | undefined;
574
- /**
575
- * The padding on the right side.
576
- */
577
- set padding_right(value: Dimension | null | undefined);
578
- /**
579
- * The padding on the top side.
580
- */
581
- get padding_top(): Dimension | undefined;
582
- /**
583
- * The padding on the top side.
584
- */
585
- set padding_top(value: Dimension | null | undefined);
586
- /**
587
- * The padding on the bottom side.
588
- */
589
- get padding_bottom(): Dimension | undefined;
590
- /**
591
- * The padding on the bottom side.
592
- */
593
- set padding_bottom(value: Dimension | null | undefined);
594
- /**
595
- * The flex direction (e.g. Row, Column).
596
- */
597
- get flex_direction(): FlexDirection | undefined;
207
+ get align_self(): AlignSelf | undefined;
598
208
  /**
599
- * The flex direction (e.g. Row, Column).
209
+ * Sets the align-self property. Use AlignSelf.Auto to inherit from parent.
600
210
  */
601
- set flex_direction(value: FlexDirection | null | undefined);
211
+ set align_self(value: AlignSelf | null | undefined);
602
212
  /**
603
- * Whether flex items should wrap.
213
+ * Gets the flex-basis as a JsDimension (Length, Percent, or Auto).
214
+ * Flex-basis defines the initial main size before grow/shrink.
604
215
  */
605
- get flex_wrap(): FlexWrap | undefined;
216
+ flex_basis: any;
606
217
  /**
607
- * Whether flex items should wrap.
218
+ * Gets the border width as a JsRect<JsLengthPercentage>.
219
+ * Border width defines the thickness of element borders.
220
+ * Supports Length or Percent for each edge (not Auto).
608
221
  */
609
- set flex_wrap(value: FlexWrap | null | undefined);
222
+ border: any;
610
223
  /**
611
- * How much the item will grow relative to the rest of the flexible items.
224
+ * Gets the margin as a JsRect<JsLengthPercentageAuto>.
225
+ * Margin is the outer spacing around the element's border.
226
+ * Supports Length, Percent, or Auto for each edge.
612
227
  */
613
- get flex_grow(): number | undefined;
228
+ margin: any;
614
229
  /**
615
- * How much the item will grow relative to the rest of the flexible items.
230
+ * Gets the align-items property. Controls cross-axis alignment of children.
616
231
  */
617
- set flex_grow(value: number | null | undefined);
232
+ get align_items(): AlignItems | undefined;
618
233
  /**
619
- * How much the item will shrink relative to the rest of the flexible items.
234
+ * Sets the align-items property. Affects all children's cross-axis alignment.
620
235
  */
621
- get flex_shrink(): number | undefined;
236
+ set align_items(value: AlignItems | null | undefined);
622
237
  /**
623
- * How much the item will shrink relative to the rest of the flexible items.
238
+ * Gets the flex shrink factor. Determines how much the item shrinks relative to siblings.
624
239
  */
625
- set flex_shrink(value: number | null | undefined);
240
+ flex_shrink: number;
626
241
  /**
627
- * The initial main size of a flex item.
242
+ * Gets the display mode (Block, Flex, Grid, or None).
628
243
  */
629
- get flex_basis(): Dimension | undefined;
244
+ display: Display;
630
245
  /**
631
- * The initial main size of a flex item.
246
+ * Gets the padding as a JsRect<JsLengthPercentage>.
247
+ * Padding is the inner spacing between the border and content.
248
+ * Supports Length or Percent for each edge (not Auto).
632
249
  */
633
- set flex_basis(value: Dimension | null | undefined);
250
+ padding: any;
634
251
  /**
635
- * How items are distributed along the main axis.
252
+ * Gets the aspect ratio (width / height). Returns None if not set.
636
253
  */
637
- get justify_content(): JustifyContent | undefined;
254
+ get aspect_ratio(): number | undefined;
638
255
  /**
639
- * How items are distributed along the main axis.
256
+ * Sets the aspect ratio. For example, 16/9 = 1.777... for widescreen.
257
+ * Set to None to remove the constraint.
640
258
  */
641
- set justify_content(value: JustifyContent | null | undefined);
259
+ set aspect_ratio(value: number | null | undefined);
642
260
  /**
643
- * How items are aligned along the cross axis.
261
+ * Gets the maximum size constraints as a JsSize<JsDimension>.
262
+ * Prevents the element from growing beyond these values.
644
263
  */
645
- get align_items(): AlignItems | undefined;
264
+ max_size: any;
646
265
  /**
647
- * How items are aligned along the cross axis.
266
+ * Gets the minimum size constraints as a JsSize<JsDimension>.
267
+ * Prevents the element from shrinking below these values.
648
268
  */
649
- set align_items(value: AlignItems | null | undefined);
269
+ min_size: any;
650
270
  /**
651
- * How a single item is aligned along the cross axis.
271
+ * Gets the overflow behavior as a JS object with {x, y} properties.
652
272
  */
653
- get align_self(): AlignSelf | undefined;
273
+ overflow: any;
654
274
  /**
655
- * How a single item is aligned along the cross axis.
275
+ * Gets the position mode (Relative or Absolute).
656
276
  */
657
- set align_self(value: AlignSelf | null | undefined);
277
+ position: Position;
658
278
  /**
659
- * How lines of content are aligned along the cross axis.
279
+ * Gets the align-content property. Controls spacing between lines in multi-line flex.
660
280
  */
661
281
  get align_content(): AlignContent | undefined;
662
282
  /**
663
- * How lines of content are aligned along the cross axis.
283
+ * Sets the align-content property. Only effective when flex-wrap is enabled.
664
284
  */
665
285
  set align_content(value: AlignContent | null | undefined);
666
286
  /**
667
- * The gap between rows (flex/grid).
287
+ * Gets the flex grow factor. Determines how much the item grows relative to siblings.
668
288
  */
669
- get row_gap(): Dimension | undefined;
289
+ flex_grow: number;
670
290
  /**
671
- * The gap between rows (flex/grid).
291
+ * Gets the flex wrap mode (NoWrap, Wrap, WrapReverse).
672
292
  */
673
- set row_gap(value: Dimension | null | undefined);
293
+ flex_wrap: FlexWrap;
674
294
  /**
675
- * The gap between columns (flex/grid).
295
+ * Gets the flex direction (Row, Column, RowReverse, ColumnReverse).
676
296
  */
677
- get column_gap(): Dimension | undefined;
297
+ flex_direction: FlexDirection;
678
298
  /**
679
- * The gap between columns (flex/grid).
299
+ * Gets the justify-content property. Controls main-axis alignment and spacing.
680
300
  */
681
- set column_gap(value: Dimension | null | undefined);
301
+ get justify_content(): JustifyContent | undefined;
682
302
  /**
683
- * Algorithm for auto-placing items in the grid.
303
+ * Sets the justify-content property. Distributes space along the main axis.
684
304
  */
685
- get grid_auto_flow(): GridAutoFlow | undefined;
305
+ set justify_content(value: JustifyContent | null | undefined);
686
306
  /**
687
- * Algorithm for auto-placing items in the grid.
307
+ * Gets the gap between children as a JsSize<JsLengthPercentage>.
308
+ * Used in Flex and Grid layouts to add spacing between items.
309
+ * - width: column gap (horizontal spacing)
310
+ * - height: row gap (vertical spacing)
688
311
  */
689
- set grid_auto_flow(value: GridAutoFlow | null | undefined);
312
+ gap: any;
690
313
  /**
691
- * Text alignment.
314
+ * Gets the size (width, height) as a JsSize<JsDimension>.
315
+ * Each dimension can be Length, Percent, or Auto.
692
316
  */
693
- get text_align(): TextAlign | undefined;
317
+ size: any;
694
318
  /**
695
- * Text alignment.
319
+ * Gets the inset (absolute positioning offsets) as a JsRect<JsLengthPercentageAuto>.
320
+ * Only effective when position is Absolute.
321
+ * Defines the distance from each edge of the containing block.
696
322
  */
697
- set text_align(value: TextAlign | null | undefined);
698
- }
699
-
700
- export class TaffyNode {
701
- free(): void;
702
- [Symbol.dispose](): void;
703
- getLayout(): Layout;
704
- markDirty(): void;
705
- setBorder(edge: Edge, value: number): void;
706
- setHeight(value: number): void;
707
- setMargin(edge: Edge, value: number): void;
708
- setDisplay(display: Display): void;
709
- setPadding(edge: Edge, value: number): void;
710
- insertChild(child: TaffyNode, index: number): void;
711
- removeChild(child: TaffyNode): void;
712
- setChildren(children: BigUint64Array): void;
713
- setFlexGrow(value: number): void;
714
- setFlexWrap(wrap: FlexWrap): void;
715
- setMinWidth(value: number): void;
716
- computeLayout(available_space: any): void;
717
- setAlignSelf(align: AlignSelf): void;
718
- setFlexBasis(value: number): void;
719
- setMinHeight(value: number): void;
720
- setWidthAuto(): void;
721
- setAlignItems(align: AlignItems): void;
722
- setFlexShrink(value: number): void;
723
- setHeightAuto(): void;
724
- setMarginAuto(edge: Edge): void;
725
- setMeasureFunc(js_func: Function): void;
726
- setPositionType(position: Position): void;
727
- setWidthPercent(value: number): void;
728
- setFlexDirection(direction: FlexDirection): void;
729
- setHeightPercent(value: number): void;
730
- setFlexBasisAuto(): void;
731
- setJustifyContent(justify: JustifyContent): void;
732
- setMinWidthPercent(value: number): void;
733
- setFlexBasisPercent(value: number): void;
734
- setMinHeightPercent(value: number): void;
735
- constructor(style: any);
736
- free(): void;
737
- style(): any;
738
- setGap(gutter: Gutter, value: number): void;
739
- addChild(child: TaffyNode): void;
740
- set_style(style: any): void;
741
- setWidth(value: number): void;
742
- id: bigint;
743
- }
744
-
745
- /**
746
- * Text alignment within a node (mostly ignored in flex/grid layout but preserved for compatibility).
747
- */
748
- export enum TextAlign {
749
- Auto = 0,
750
- Left = 1,
751
- Right = 2,
752
- Center = 3,
753
- Justify = 4,
323
+ inset: any;
754
324
  }
755
325
 
756
- export class TrackDefinition {
757
- private constructor();
326
+ export class TaffyTree {
758
327
  free(): void;
759
328
  [Symbol.dispose](): void;
760
329
  /**
761
- * The numeric value of the track size.
762
- */
763
- value: number;
764
- /**
765
- * The unit of the track size.
766
- */
767
- unit: TrackUnit;
330
+ * Marks a node as dirty, requiring re-layout.
331
+ *
332
+ * Call this when a node's content changes (e.g., text content)
333
+ * but its style hasn't. Style changes automatically mark nodes dirty.
334
+ *
335
+ * # Arguments
336
+ * * `node` - The node ID to mark dirty.
337
+ */
338
+ markDirty(node: bigint): void;
339
+ /**
340
+ * Prints the tree structure to the console (for debugging).
341
+ *
342
+ * # Arguments
343
+ * * `node` - The root node ID to start printing from.
344
+ */
345
+ printTree(node: bigint): void;
346
+ /**
347
+ * Gets the number of children of a node.
348
+ *
349
+ * # Arguments
350
+ * * `parent` - The parent node ID.
351
+ *
352
+ * # Returns
353
+ * The number of children.
354
+ */
355
+ childCount(parent: bigint): number;
356
+ /**
357
+ * Removes a specific child from a parent.
358
+ *
359
+ * # Arguments
360
+ * * `parent` - The parent node ID.
361
+ * * `child` - The child node ID to remove.
362
+ *
363
+ * # Returns
364
+ * * `Ok(u64)` - The ID of the removed child.
365
+ * * `Err(JsValue)` - Error if parent or child doesn't exist.
366
+ */
367
+ removeChild(parent: bigint, child: bigint): bigint;
368
+ /**
369
+ * Replaces all children of a node.
370
+ *
371
+ * Previous children are detached but not removed from the tree.
372
+ *
373
+ * # Arguments
374
+ * * `parent` - The parent node ID.
375
+ * * `children` - Array of new child node IDs.
376
+ */
377
+ setChildren(parent: bigint, children: BigUint64Array): void;
378
+ /**
379
+ * Creates a new TaffyTree with pre-allocated capacity.
380
+ *
381
+ * Use this when you know approximately how many nodes you'll create
382
+ * to avoid reallocation overhead.
383
+ *
384
+ * # Arguments
385
+ * * `capacity` - The number of nodes to pre-allocate space for.
386
+ *
387
+ * # Returns
388
+ * A new TaffyTree instance with pre-allocated capacity.
389
+ */
390
+ static withCapacity(capacity: number): TaffyTree;
391
+ /**
392
+ * Gets a child at a specific index.
393
+ *
394
+ * # Arguments
395
+ * * `parent` - The parent node ID.
396
+ * * `index` - The zero-based index.
397
+ *
398
+ * # Returns
399
+ * * `Ok(u64)` - The child node ID at the given index.
400
+ * * `Err(JsValue)` - Error if index is out of bounds.
401
+ */
402
+ getChildAtIndex(parent: bigint, index: number): bigint;
403
+ /**
404
+ * Computes the layout for a subtree.
405
+ *
406
+ * Runs the layout algorithm (Flexbox/Grid/Block) on the given node
407
+ * and all its descendants. Results are cached and can be retrieved
408
+ * with `getLayout()`.
409
+ *
410
+ * # Arguments
411
+ * * `node` - The root node ID for layout computation.
412
+ * * `available_space` - The available space constraint, e.g.:
413
+ * `{ width: { Definite: 800 }, height: { Definite: 600 } }`
414
+ *
415
+ * Available space options per dimension:
416
+ * - `{ Definite: number }` - A specific size in pixels
417
+ * - `"MinContent"` - Use minimum content size
418
+ * - `"MaxContent"` - Use maximum content size
419
+ */
420
+ computeLayout(node: bigint, available_space: any): void;
421
+ /**
422
+ * Enables rounding of layout values to whole pixels.
423
+ *
424
+ * When enabled, all computed layout values (x, y, width, height) are
425
+ * rounded to the nearest integer. This is the default behavior.
426
+ */
427
+ enableRounding(): void;
428
+ /**
429
+ * Disables rounding of layout values.
430
+ *
431
+ * When disabled, layout values may have fractional pixel values.
432
+ * Use `unroundedLayout()` to get the pre-rounding values.
433
+ */
434
+ disableRounding(): void;
435
+ /**
436
+ * Gets the context value for a node.
437
+ *
438
+ * # Arguments
439
+ * * `node` - The node ID.
440
+ *
441
+ * # Returns
442
+ * The context value, or `undefined` if not set.
443
+ */
444
+ getNodeContext(node: bigint): any;
445
+ /**
446
+ * Sets a context value for a node.
447
+ *
448
+ * Context values are passed to the measure function during layout.
449
+ * Use this to attach data like text content or custom metadata.
450
+ *
451
+ * # Arguments
452
+ * * `node` - The node ID.
453
+ * * `context` - Any JavaScript value.
454
+ */
455
+ setNodeContext(node: bigint, context: any): void;
456
+ /**
457
+ * Gets the total number of nodes in the tree.
458
+ *
459
+ * # Returns
460
+ * The count of all nodes (including removed nodes that haven't been reclaimed).
461
+ */
462
+ totalNodeCount(): number;
463
+ /**
464
+ * Gets the unrounded (fractional) layout for a node.
465
+ *
466
+ * Useful when you need sub-pixel precision.
467
+ *
468
+ * # Arguments
469
+ * * `node` - The node ID to query.
470
+ *
471
+ * # Returns
472
+ * A layout object with potentially fractional values.
473
+ */
474
+ unroundedLayout(node: bigint): any;
475
+ /**
476
+ * Creates a new node with the given children.
477
+ *
478
+ * # Arguments
479
+ * * `style` - The Style object to apply to this node.
480
+ * * `children` - Array of child node IDs.
481
+ *
482
+ * # Returns
483
+ * * `Ok(u64)` - The node ID of the newly created node.
484
+ * * `Err(JsValue)` - Error message if creation fails.
485
+ */
486
+ newWithChildren(style: Style, children: BigUint64Array): bigint;
487
+ /**
488
+ * Gets a mutable reference to the context value for a node.
489
+ *
490
+ * Note: In WASM, this returns a clone since we can't return mutable references.
491
+ *
492
+ * # Arguments
493
+ * * `node` - The node ID.
494
+ *
495
+ * # Returns
496
+ * The context value, or `undefined` if not set.
497
+ */
498
+ getNodeContextMut(node: bigint): any;
499
+ /**
500
+ * Inserts a child at a specific index.
501
+ *
502
+ * Existing children at and after the index are shifted right.
503
+ *
504
+ * # Arguments
505
+ * * `parent` - The parent node ID.
506
+ * * `index` - The zero-based index at which to insert.
507
+ * * `child` - The child node ID to insert.
508
+ */
509
+ insertChildAtIndex(parent: bigint, index: number, child: bigint): void;
510
+ /**
511
+ * Creates a new leaf node with an attached context value.
512
+ *
513
+ * The context can be any JavaScript value and is useful for associating
514
+ * custom data (like text content) with a node for use in measure functions.
515
+ *
516
+ * # Arguments
517
+ * * `style` - The Style object to apply to this node.
518
+ * * `context` - Any JavaScript value to attach to this node.
519
+ *
520
+ * # Returns
521
+ * * `Ok(u64)` - The node ID of the newly created node.
522
+ * * `Err(JsValue)` - Error message if creation fails.
523
+ */
524
+ newLeafWithContext(style: Style, context: any): bigint;
525
+ /**
526
+ * Removes a child at a specific index.
527
+ *
528
+ * # Arguments
529
+ * * `parent` - The parent node ID.
530
+ * * `index` - The zero-based index of the child to remove.
531
+ *
532
+ * # Returns
533
+ * * `Ok(u64)` - The ID of the removed child.
534
+ * * `Err(JsValue)` - Error if index is out of bounds.
535
+ */
536
+ removeChildAtIndex(parent: bigint, index: number): bigint;
537
+ /**
538
+ * Removes a range of children from a parent.
539
+ *
540
+ * # Arguments
541
+ * * `parent` - The parent node ID.
542
+ * * `start` - The start index (inclusive).
543
+ * * `end` - The end index (exclusive).
544
+ */
545
+ removeChildrenRange(parent: bigint, start: number, end: number): void;
546
+ /**
547
+ * Replaces a child at a specific index with a new child.
548
+ *
549
+ * # Arguments
550
+ * * `parent` - The parent node ID.
551
+ * * `index` - The zero-based index of the child to replace.
552
+ * * `child` - The new child node ID.
553
+ *
554
+ * # Returns
555
+ * * `Ok(u64)` - The ID of the replaced (old) child.
556
+ * * `Err(JsValue)` - Error if index is out of bounds.
557
+ */
558
+ replaceChildAtIndex(parent: bigint, index: number, child: bigint): bigint;
559
+ /**
560
+ * Computes layout with a custom measure function for leaf nodes.
561
+ *
562
+ * The measure function is called for leaf nodes to determine their
563
+ * intrinsic size (e.g., for text measurement).
564
+ *
565
+ * # Arguments
566
+ * * `node` - The root node ID for layout computation.
567
+ * * `available_space` - The available space constraint.
568
+ * * `measure_func` - A JavaScript function with signature:
569
+ * `(knownDimensions, availableSpace, context) => { width, height }`
570
+ *
571
+ * The measure function receives:
572
+ * - `knownDimensions`: `{ width: number | null, height: number | null }`
573
+ * - `availableSpace`: `{ width: AvailableSpace, height: AvailableSpace }`
574
+ * - `context`: The context value attached to the node (or undefined)
575
+ *
576
+ * And should return: `{ width: number, height: number }`
577
+ */
578
+ computeLayoutWithMeasure(node: bigint, available_space: any, measure_func: Function): void;
579
+ /**
580
+ * Gets context values for multiple nodes at once.
581
+ *
582
+ * Useful for batch operations.
583
+ *
584
+ * # Arguments
585
+ * * `children` - Array of node IDs to query.
586
+ *
587
+ * # Returns
588
+ * Array of context values in the same order as input.
589
+ */
590
+ getDisjointNodeContextMut(children: BigUint64Array): any[];
591
+ /**
592
+ * Creates a new empty TaffyTree.
593
+ *
594
+ * This is the primary constructor. Initializes panic hook in debug builds
595
+ * to provide better error messages in the browser console.
596
+ *
597
+ * # Returns
598
+ * A new TaffyTree instance with no nodes.
599
+ */
600
+ constructor();
601
+ /**
602
+ * Removes all nodes from the tree.
603
+ *
604
+ * After calling this, the tree is empty and all previous node IDs are invalid.
605
+ */
606
+ clear(): void;
607
+ /**
608
+ * Checks if a node is dirty (needs re-layout).
609
+ *
610
+ * # Arguments
611
+ * * `node` - The node ID to check.
612
+ *
613
+ * # Returns
614
+ * * `Ok(true)` - The node needs re-layout.
615
+ * * `Ok(false)` - The node's layout is up-to-date.
616
+ * * `Err(JsValue)` - Error if the node doesn't exist.
617
+ */
618
+ dirty(node: bigint): boolean;
619
+ /**
620
+ * Gets the style for a node.
621
+ *
622
+ * # Arguments
623
+ * * `node` - The node ID to query.
624
+ *
625
+ * # Returns
626
+ * * `Ok(Style)` - A copy of the node's style.
627
+ * * `Err(JsValue)` - Error if the node doesn't exist.
628
+ */
629
+ getStyle(node: bigint): Style;
630
+ /**
631
+ * Gets the computed layout for a node.
632
+ *
633
+ * Must be called after `computeLayout()`.
634
+ *
635
+ * # Arguments
636
+ * * `node` - The node ID to query.
637
+ *
638
+ * # Returns
639
+ * A layout object: `{ order, size: {width, height}, location: {x, y}, ... }`
640
+ */
641
+ getLayout(node: bigint): any;
642
+ /**
643
+ * Gets the parent of a node.
644
+ *
645
+ * # Arguments
646
+ * * `child` - The child node ID.
647
+ *
648
+ * # Returns
649
+ * * `Some(u64)` - The parent node ID.
650
+ * * `None` - If the node has no parent (is a root).
651
+ */
652
+ parent(child: bigint): bigint | undefined;
653
+ /**
654
+ * Removes a node from the tree.
655
+ *
656
+ * The node is detached from its parent (if any) and removed from the tree.
657
+ * Child nodes are NOT automatically removed.
658
+ *
659
+ * # Arguments
660
+ * * `node` - The node ID to remove.
661
+ *
662
+ * # Returns
663
+ * * `Ok(u64)` - The ID of the removed node.
664
+ * * `Err(JsValue)` - Error if the node doesn't exist.
665
+ */
666
+ remove(node: bigint): bigint;
667
+ /**
668
+ * Gets all children of a node.
669
+ *
670
+ * # Arguments
671
+ * * `parent` - The parent node ID.
672
+ *
673
+ * # Returns
674
+ * * `Ok(Box<[u64]>)` - Array of child node IDs.
675
+ * * `Err(JsValue)` - Error if the node doesn't exist.
676
+ */
677
+ children(parent: bigint): BigUint64Array;
678
+ /**
679
+ * Creates a new leaf node (no children) with the given style.
680
+ *
681
+ * # Arguments
682
+ * * `style` - The Style object to apply to this node.
683
+ *
684
+ * # Returns
685
+ * * `Ok(u64)` - The node ID of the newly created node.
686
+ * * `Err(JsValue)` - Error message if creation fails.
687
+ */
688
+ newLeaf(style: Style): bigint;
689
+ /**
690
+ * Appends a child node to a parent.
691
+ *
692
+ * The child is added at the end of the parent's children list.
693
+ *
694
+ * # Arguments
695
+ * * `parent` - The parent node ID.
696
+ * * `child` - The child node ID to add.
697
+ */
698
+ addChild(parent: bigint, child: bigint): void;
699
+ /**
700
+ * Sets the style for an existing node.
701
+ *
702
+ * This will mark the node and its ancestors as dirty, triggering
703
+ * a re-layout on the next `computeLayout()` call.
704
+ *
705
+ * # Arguments
706
+ * * `node` - The node ID to update.
707
+ * * `style` - The new Style to apply.
708
+ */
709
+ setStyle(node: bigint, style: Style): void;
768
710
  }
769
711
 
770
- /**
771
- * The unit for a grid track definition.
772
- */
773
- export enum TrackUnit {
774
- /**
775
- * The track size is specified in logical pixels.
776
- */
777
- Pixels = 0,
778
- /**
779
- * The track size is specified as a percentage of the container.
780
- */
781
- Percent = 1,
782
- /**
783
- * The track size is a fraction of the remaining free space (fr unit).
784
- */
785
- Fraction = 2,
786
- /**
787
- * The track size is determined automatically.
788
- */
789
- Auto = 3,
790
- /**
791
- * The track size is the minimum size needed to fit the content.
792
- */
793
- MinContent = 4,
794
- /**
795
- * The track size is the maximum size needed to fit the content.
796
- */
797
- MaxContent = 5,
798
- }
799
-
800
- /**
801
- * Adds a child node to a parent node.
802
- *
803
- * # Arguments
804
- *
805
- * * `parent` - The ID of the parent node.
806
- * * `child` - The ID of the child node to add.
807
- *
808
- * # Errors
809
- *
810
- * Returns a `JsValue` error if the operation fails (e.g., recursive hierarchy).
811
- */
812
- export function add_child(parent: bigint, child: bigint): void;
813
-
814
- /**
815
- * Auto dimension constant
816
- */
817
- export function auto(): Dimension;
818
-
819
- /**
820
- * Clear all nodes from the layout tree.
821
- *
822
- * This removes all nodes and resets the tree to an empty state.
823
- * Any existing node IDs become invalid after this call.
824
- */
825
- export function clear(): void;
826
-
827
- /**
828
- * Computes the layout for a tree starting from the specified root node.
829
- *
830
- * # Arguments
831
- *
832
- * * `root` - The ID of the root node of the tree to lay out.
833
- * * `available_space` - The available space constraints for the layout.
834
- *
835
- * # Errors
836
- *
837
- * Returns a `JsValue` error if the layout computation fails.
838
- */
839
- export function compute_layout(root: bigint, available_space: any): void;
840
-
841
- /**
842
- * Helper function to create a dimension
843
- */
844
- export function dimension(value: number, unit: DimensionUnit): Dimension;
845
-
846
- /**
847
- * Retrieves the list of children IDs for a given node.
848
- *
849
- * # Arguments
850
- *
851
- * * `parent` - The ID of the parent node.
852
- *
853
- * # Returns
854
- *
855
- * A boxed array of child node IDs (`Box<[u32]>`).
856
- *
857
- * # Errors
858
- *
859
- * Returns a `JsValue` error if the node does not exist.
860
- */
861
- export function get_children(parent: bigint): BigUint64Array;
862
-
863
- /**
864
- * Retrieves the computed layout information for a specific node.
865
- *
866
- * # Arguments
867
- *
868
- * * `node` - The ID of the node to query.
869
- *
870
- * # Returns
871
- *
872
- * A `Layout` object containing the x, y, width, and height of the node.
873
- *
874
- * # Errors
875
- *
876
- * Returns a `JsValue` error if the node does not exist or layout information is unavailable.
877
- */
878
- export function get_layout(node: bigint): any;
879
-
880
- /**
881
- * Retrieves the parent ID of a given node.
882
- *
883
- * # Arguments
884
- *
885
- * * `node` - The ID of the node to query.
886
- *
887
- * # Returns
888
- *
889
- * An `Option<u32>` containing the parent ID if it exists, or `None` if the node is a root or orphan.
890
- *
891
- * # Errors
892
- *
893
- * Returns a `JsValue` error if internal tree access fails.
894
- */
895
- export function get_parent(node: bigint): bigint | undefined;
896
-
897
- /**
898
- * Initialize the WASM module.
899
- *
900
- * This function is automatically called when the WASM module is loaded.
901
- * It sets up the console error panic hook for better error messages in development.
902
- */
903
- export function init(): void;
904
-
905
- /**
906
- * Marks a node and its ancestors as dirty, requiring a layout re-computation.
907
- *
908
- * # Arguments
909
- *
910
- * * `node` - The ID of the node to mark dirty.
911
- *
912
- * # Errors
913
- *
914
- * Returns a `JsValue` error if the node does not exist.
915
- */
916
- export function mark_dirty(node: bigint): void;
917
-
918
- /**
919
- * Creates a new leaf node with the specified style.
920
- *
921
- * # Arguments
922
- *
923
- * * `style` - The style object to apply to the new node.
924
- *
925
- * # Returns
926
- *
927
- * The ID of the created node as a `u32`.
928
- *
929
- * # Errors
930
- *
931
- * Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
932
- */
933
- export function new_leaf(style: any): bigint;
934
-
935
- /**
936
- * Creates a new node with children and the specified style.
937
- *
938
- * # Arguments
939
- *
940
- * * `style` - The style object to apply to the new node.
941
- * * `children` - An array of child node IDs (`u32`) to attach to this node.
942
- *
943
- * # Returns
944
- *
945
- * The ID of the created node as a `u32`.
946
- *
947
- * # Errors
948
- *
949
- * Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
950
- */
951
- export function new_with_children(style: any, children: BigUint64Array): bigint;
952
-
953
- /**
954
- * Get the total number of nodes currently in the layout tree.
955
- *
956
- * # Returns
957
- *
958
- * The total count of all nodes in the tree.
959
- */
960
- export function node_count(): number;
961
-
962
- /**
963
- * Helper function to create a percent dimension
964
- */
965
- export function percent(value: number): Dimension;
966
-
967
- /**
968
- * Helper function to create a pixel dimension
969
- */
970
- export function px(value: number): Dimension;
971
-
972
- /**
973
- * Removes a child node from a parent node.
974
- *
975
- * # Arguments
976
- *
977
- * * `parent` - The ID of the parent node.
978
- * * `child` - The ID of the child node to remove.
979
- *
980
- * # Errors
981
- *
982
- * Returns a `JsValue` error if the child is not found in the parent.
983
- */
984
- export function remove_child(parent: bigint, child: bigint): void;
985
-
986
- /**
987
- * Removes a node from the tree and frees its resources.
988
- *
989
- * # Arguments
990
- *
991
- * * `node` - The ID of the node to remove.
992
- *
993
- * # Errors
994
- *
995
- * Returns a `JsValue` error if the node does not exist or cannot be removed.
996
- */
997
- export function remove_node(node: bigint): void;
998
-
999
- /**
1000
- * Sets the children of a node, replacing any existing children.
1001
- *
1002
- * # Arguments
1003
- *
1004
- * * `parent` - The ID of the parent node.
1005
- * * `children` - An array of child node IDs to set.
1006
- *
1007
- * # Errors
1008
- *
1009
- * Returns a `JsValue` error if the operation fails.
1010
- */
1011
- export function set_children(parent: bigint, children: BigUint64Array): void;
1012
-
1013
- /**
1014
- * Updates the style of an existing node.
1015
- *
1016
- * # Arguments
1017
- *
1018
- * * `node` - The ID of the node to update.
1019
- * * `style` - The new style object to apply.
1020
- *
1021
- * # Errors
1022
- *
1023
- * Returns a `JsValue` error if the style cannot be deserialized or if the node does not exist.
1024
- */
1025
- export function set_style(node: bigint, style: any): void;
1026
-
1027
712
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1028
713
 
1029
714
  export interface InitOutput {
1030
715
  readonly memory: WebAssembly.Memory;
1031
- readonly __wbg_availablespace_free: (a: number, b: number) => void;
1032
- readonly __wbg_dimension_free: (a: number, b: number) => void;
1033
- readonly __wbg_get_availablespace_height: (a: number) => number;
1034
- readonly __wbg_get_availablespace_width: (a: number) => number;
1035
- readonly __wbg_get_dimension_unit: (a: number) => number;
1036
- readonly __wbg_get_dimension_value: (a: number) => number;
1037
- readonly __wbg_get_layout_height: (a: number) => number;
1038
- readonly __wbg_get_layout_width: (a: number) => number;
1039
- readonly __wbg_get_layout_y: (a: number) => number;
1040
- readonly __wbg_get_line_end: (a: number) => number;
1041
- readonly __wbg_get_line_start: (a: number) => number;
1042
- readonly __wbg_get_style_align_content: (a: number) => number;
1043
- readonly __wbg_get_style_align_items: (a: number) => number;
1044
- readonly __wbg_get_style_align_self: (a: number) => number;
1045
- readonly __wbg_get_style_bottom: (a: number) => number;
1046
- readonly __wbg_get_style_column_gap: (a: number) => number;
1047
- readonly __wbg_get_style_display: (a: number) => number;
1048
- readonly __wbg_get_style_flex_basis: (a: number) => number;
1049
- readonly __wbg_get_style_flex_direction: (a: number) => number;
1050
- readonly __wbg_get_style_flex_wrap: (a: number) => number;
1051
- readonly __wbg_get_style_grid_auto_flow: (a: number) => number;
1052
- readonly __wbg_get_style_height: (a: number) => number;
1053
- readonly __wbg_get_style_justify_content: (a: number) => number;
1054
- readonly __wbg_get_style_left: (a: number) => number;
1055
- readonly __wbg_get_style_margin_bottom: (a: number) => number;
1056
- readonly __wbg_get_style_margin_left: (a: number) => number;
1057
- readonly __wbg_get_style_margin_right: (a: number) => number;
1058
- readonly __wbg_get_style_margin_top: (a: number) => number;
1059
- readonly __wbg_get_style_max_height: (a: number) => number;
1060
- readonly __wbg_get_style_max_width: (a: number) => number;
1061
- readonly __wbg_get_style_min_height: (a: number) => number;
1062
- readonly __wbg_get_style_min_width: (a: number) => number;
1063
- readonly __wbg_get_style_padding_bottom: (a: number) => number;
1064
- readonly __wbg_get_style_padding_left: (a: number) => number;
1065
- readonly __wbg_get_style_padding_right: (a: number) => number;
1066
- readonly __wbg_get_style_padding_top: (a: number) => number;
1067
- readonly __wbg_get_style_position: (a: number) => number;
1068
- readonly __wbg_get_style_right: (a: number) => number;
1069
- readonly __wbg_get_style_row_gap: (a: number) => number;
1070
- readonly __wbg_get_style_text_align: (a: number) => number;
1071
- readonly __wbg_get_style_top: (a: number) => number;
1072
- readonly __wbg_get_style_width: (a: number) => number;
1073
- readonly __wbg_get_taffynode_id: (a: number) => bigint;
1074
- readonly __wbg_get_trackdefinition_unit: (a: number) => number;
1075
- readonly __wbg_line_free: (a: number, b: number) => void;
1076
- readonly __wbg_point_free: (a: number, b: number) => void;
1077
- readonly __wbg_set_availablespace_height: (a: number, b: number) => void;
1078
- readonly __wbg_set_availablespace_width: (a: number, b: number) => void;
1079
- readonly __wbg_set_dimension_unit: (a: number, b: number) => void;
1080
- readonly __wbg_set_dimension_value: (a: number, b: number) => void;
1081
- readonly __wbg_set_layout_height: (a: number, b: number) => void;
1082
- readonly __wbg_set_layout_width: (a: number, b: number) => void;
1083
- readonly __wbg_set_layout_y: (a: number, b: number) => void;
1084
- readonly __wbg_set_line_end: (a: number, b: number) => void;
1085
- readonly __wbg_set_line_start: (a: number, b: number) => void;
1086
- readonly __wbg_set_style_align_content: (a: number, b: number) => void;
1087
- readonly __wbg_set_style_align_items: (a: number, b: number) => void;
1088
- readonly __wbg_set_style_align_self: (a: number, b: number) => void;
1089
- readonly __wbg_set_style_bottom: (a: number, b: number) => void;
1090
- readonly __wbg_set_style_column_gap: (a: number, b: number) => void;
1091
- readonly __wbg_set_style_display: (a: number, b: number) => void;
1092
- readonly __wbg_set_style_flex_basis: (a: number, b: number) => void;
1093
- readonly __wbg_set_style_flex_direction: (a: number, b: number) => void;
1094
- readonly __wbg_set_style_flex_wrap: (a: number, b: number) => void;
1095
- readonly __wbg_set_style_grid_auto_flow: (a: number, b: number) => void;
1096
- readonly __wbg_set_style_height: (a: number, b: number) => void;
1097
- readonly __wbg_set_style_justify_content: (a: number, b: number) => void;
1098
- readonly __wbg_set_style_left: (a: number, b: number) => void;
1099
- readonly __wbg_set_style_margin_bottom: (a: number, b: number) => void;
1100
- readonly __wbg_set_style_margin_left: (a: number, b: number) => void;
1101
- readonly __wbg_set_style_margin_right: (a: number, b: number) => void;
1102
- readonly __wbg_set_style_margin_top: (a: number, b: number) => void;
1103
- readonly __wbg_set_style_max_height: (a: number, b: number) => void;
1104
- readonly __wbg_set_style_max_width: (a: number, b: number) => void;
1105
- readonly __wbg_set_style_min_height: (a: number, b: number) => void;
1106
- readonly __wbg_set_style_min_width: (a: number, b: number) => void;
1107
- readonly __wbg_set_style_padding_bottom: (a: number, b: number) => void;
1108
- readonly __wbg_set_style_padding_left: (a: number, b: number) => void;
1109
- readonly __wbg_set_style_padding_right: (a: number, b: number) => void;
1110
- readonly __wbg_set_style_padding_top: (a: number, b: number) => void;
1111
- readonly __wbg_set_style_position: (a: number, b: number) => void;
1112
- readonly __wbg_set_style_right: (a: number, b: number) => void;
1113
- readonly __wbg_set_style_row_gap: (a: number, b: number) => void;
1114
- readonly __wbg_set_style_text_align: (a: number, b: number) => void;
1115
- readonly __wbg_set_style_top: (a: number, b: number) => void;
1116
- readonly __wbg_set_style_width: (a: number, b: number) => void;
1117
- readonly __wbg_set_taffynode_id: (a: number, b: bigint) => void;
1118
- readonly __wbg_set_trackdefinition_unit: (a: number, b: number) => void;
1119
716
  readonly __wbg_style_free: (a: number, b: number) => void;
1120
- readonly __wbg_taffynode_free: (a: number, b: number) => void;
1121
- readonly __wbg_trackdefinition_free: (a: number, b: number) => void;
1122
- readonly add_child: (a: bigint, b: bigint) => [number, number];
1123
- readonly auto: () => number;
1124
- readonly clear: () => [number, number];
1125
- readonly compute_layout: (a: bigint, b: any) => [number, number];
1126
- readonly dimension: (a: number, b: number) => number;
1127
- readonly get_children: (a: bigint) => [number, number, number, number];
1128
- readonly get_layout: (a: bigint) => [number, number, number];
1129
- readonly get_parent: (a: bigint) => [number, bigint, number, number];
1130
- readonly init: () => void;
1131
- readonly mark_dirty: (a: bigint) => [number, number];
1132
- readonly new_leaf: (a: any) => [bigint, number, number];
1133
- readonly new_with_children: (a: any, b: number, c: number) => [bigint, number, number];
1134
- readonly node_count: () => number;
1135
- readonly percent: (a: number) => number;
1136
- readonly px: (a: number) => number;
1137
- readonly remove_child: (a: bigint, b: bigint) => [number, number];
1138
- readonly remove_node: (a: bigint) => [number, number];
1139
- readonly set_children: (a: bigint, b: number, c: number) => [number, number];
1140
- readonly set_style: (a: bigint, b: any) => [number, number];
1141
- readonly taffynode_addChild: (a: number, b: number) => [number, number];
1142
- readonly taffynode_computeLayout: (a: number, b: any) => [number, number];
1143
- readonly taffynode_free: (a: number) => [number, number];
1144
- readonly taffynode_getLayout: (a: number) => [number, number, number];
1145
- readonly taffynode_insertChild: (a: number, b: number, c: number) => [number, number];
1146
- readonly taffynode_markDirty: (a: number) => [number, number];
1147
- readonly taffynode_new: (a: any) => [number, number, number];
1148
- readonly taffynode_removeChild: (a: number, b: number) => [number, number];
1149
- readonly taffynode_setAlignItems: (a: number, b: number) => [number, number];
1150
- readonly taffynode_setAlignSelf: (a: number, b: number) => [number, number];
1151
- readonly taffynode_setBorder: (a: number, b: number, c: number) => [number, number];
1152
- readonly taffynode_setChildren: (a: number, b: number, c: number) => [number, number];
1153
- readonly taffynode_setDisplay: (a: number, b: number) => [number, number];
1154
- readonly taffynode_setFlexBasis: (a: number, b: number) => [number, number];
1155
- readonly taffynode_setFlexBasisAuto: (a: number) => [number, number];
1156
- readonly taffynode_setFlexBasisPercent: (a: number, b: number) => [number, number];
1157
- readonly taffynode_setFlexDirection: (a: number, b: number) => [number, number];
1158
- readonly taffynode_setFlexGrow: (a: number, b: number) => [number, number];
1159
- readonly taffynode_setFlexShrink: (a: number, b: number) => [number, number];
1160
- readonly taffynode_setFlexWrap: (a: number, b: number) => [number, number];
1161
- readonly taffynode_setGap: (a: number, b: number, c: number) => [number, number];
1162
- readonly taffynode_setHeight: (a: number, b: number) => [number, number];
1163
- readonly taffynode_setHeightAuto: (a: number) => [number, number];
1164
- readonly taffynode_setHeightPercent: (a: number, b: number) => [number, number];
1165
- readonly taffynode_setJustifyContent: (a: number, b: number) => [number, number];
1166
- readonly taffynode_setMargin: (a: number, b: number, c: number) => [number, number];
1167
- readonly taffynode_setMarginAuto: (a: number, b: number) => [number, number];
1168
- readonly taffynode_setMeasureFunc: (a: number, b: any) => [number, number];
1169
- readonly taffynode_setMinHeight: (a: number, b: number) => [number, number];
1170
- readonly taffynode_setMinHeightPercent: (a: number, b: number) => [number, number];
1171
- readonly taffynode_setMinWidth: (a: number, b: number) => [number, number];
1172
- readonly taffynode_setMinWidthPercent: (a: number, b: number) => [number, number];
1173
- readonly taffynode_setPadding: (a: number, b: number, c: number) => [number, number];
1174
- readonly taffynode_setPositionType: (a: number, b: number) => [number, number];
1175
- readonly taffynode_setWidth: (a: number, b: number) => [number, number];
1176
- readonly taffynode_setWidthAuto: (a: number) => [number, number];
1177
- readonly taffynode_setWidthPercent: (a: number, b: number) => [number, number];
1178
- readonly taffynode_set_style: (a: number, b: any) => [number, number];
1179
- readonly taffynode_style: (a: number) => [number, number, number];
1180
- readonly __wbg_set_layout_x: (a: number, b: number) => void;
1181
- readonly __wbg_set_point_x: (a: number, b: number) => void;
1182
- readonly __wbg_set_point_y: (a: number, b: number) => void;
1183
- readonly __wbg_set_rect_bottom: (a: number, b: number) => void;
1184
- readonly __wbg_set_rect_left: (a: number, b: number) => void;
1185
- readonly __wbg_set_rect_right: (a: number, b: number) => void;
1186
- readonly __wbg_set_rect_top: (a: number, b: number) => void;
1187
- readonly __wbg_set_size_height: (a: number, b: number) => void;
1188
- readonly __wbg_set_size_width: (a: number, b: number) => void;
1189
- readonly __wbg_set_trackdefinition_value: (a: number, b: number) => void;
1190
- readonly __wbg_set_style_flex_grow: (a: number, b: number) => void;
1191
- readonly __wbg_set_style_flex_shrink: (a: number, b: number) => void;
1192
- readonly __wbg_get_style_flex_grow: (a: number) => number;
1193
- readonly __wbg_get_style_flex_shrink: (a: number) => number;
1194
- readonly __wbg_get_layout_x: (a: number) => number;
1195
- readonly __wbg_get_point_x: (a: number) => number;
1196
- readonly __wbg_get_point_y: (a: number) => number;
1197
- readonly __wbg_get_rect_bottom: (a: number) => number;
1198
- readonly __wbg_get_rect_left: (a: number) => number;
1199
- readonly __wbg_get_rect_right: (a: number) => number;
1200
- readonly __wbg_get_rect_top: (a: number) => number;
1201
- readonly __wbg_get_size_height: (a: number) => number;
1202
- readonly __wbg_get_size_width: (a: number) => number;
1203
- readonly __wbg_get_trackdefinition_value: (a: number) => number;
1204
- readonly __wbg_rect_free: (a: number, b: number) => void;
1205
- readonly __wbg_layout_free: (a: number, b: number) => void;
1206
- readonly __wbg_size_free: (a: number, b: number) => void;
717
+ readonly __wbg_taffytree_free: (a: number, b: number) => void;
718
+ readonly style_align_content: (a: number) => number;
719
+ readonly style_align_items: (a: number) => number;
720
+ readonly style_align_self: (a: number) => number;
721
+ readonly style_aspect_ratio: (a: number) => number;
722
+ readonly style_border: (a: number) => any;
723
+ readonly style_display: (a: number) => number;
724
+ readonly style_flex_basis: (a: number) => any;
725
+ readonly style_flex_direction: (a: number) => number;
726
+ readonly style_flex_grow: (a: number) => number;
727
+ readonly style_flex_shrink: (a: number) => number;
728
+ readonly style_flex_wrap: (a: number) => number;
729
+ readonly style_gap: (a: number) => any;
730
+ readonly style_inset: (a: number) => any;
731
+ readonly style_justify_content: (a: number) => number;
732
+ readonly style_margin: (a: number) => any;
733
+ readonly style_max_size: (a: number) => any;
734
+ readonly style_min_size: (a: number) => any;
735
+ readonly style_new: () => number;
736
+ readonly style_overflow: (a: number) => any;
737
+ readonly style_padding: (a: number) => any;
738
+ readonly style_position: (a: number) => number;
739
+ readonly style_set_align_content: (a: number, b: number) => void;
740
+ readonly style_set_align_items: (a: number, b: number) => void;
741
+ readonly style_set_align_self: (a: number, b: number) => void;
742
+ readonly style_set_aspect_ratio: (a: number, b: number) => void;
743
+ readonly style_set_border: (a: number, b: any) => void;
744
+ readonly style_set_display: (a: number, b: number) => void;
745
+ readonly style_set_flex_basis: (a: number, b: any) => void;
746
+ readonly style_set_flex_direction: (a: number, b: number) => void;
747
+ readonly style_set_flex_grow: (a: number, b: number) => void;
748
+ readonly style_set_flex_shrink: (a: number, b: number) => void;
749
+ readonly style_set_flex_wrap: (a: number, b: number) => void;
750
+ readonly style_set_gap: (a: number, b: any) => void;
751
+ readonly style_set_inset: (a: number, b: any) => void;
752
+ readonly style_set_justify_content: (a: number, b: number) => void;
753
+ readonly style_set_margin: (a: number, b: any) => void;
754
+ readonly style_set_max_size: (a: number, b: any) => void;
755
+ readonly style_set_min_size: (a: number, b: any) => void;
756
+ readonly style_set_overflow: (a: number, b: any) => void;
757
+ readonly style_set_padding: (a: number, b: any) => void;
758
+ readonly style_set_position: (a: number, b: number) => void;
759
+ readonly style_set_size: (a: number, b: any) => void;
760
+ readonly style_size: (a: number) => any;
761
+ readonly taffytree_addChild: (a: number, b: bigint, c: bigint) => [number, number];
762
+ readonly taffytree_childCount: (a: number, b: bigint) => number;
763
+ readonly taffytree_children: (a: number, b: bigint) => [number, number, number, number];
764
+ readonly taffytree_clear: (a: number) => void;
765
+ readonly taffytree_computeLayout: (a: number, b: bigint, c: any) => [number, number];
766
+ readonly taffytree_computeLayoutWithMeasure: (a: number, b: bigint, c: any, d: any) => [number, number];
767
+ readonly taffytree_dirty: (a: number, b: bigint) => [number, number, number];
768
+ readonly taffytree_disableRounding: (a: number) => void;
769
+ readonly taffytree_enableRounding: (a: number) => void;
770
+ readonly taffytree_getChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
771
+ readonly taffytree_getDisjointNodeContextMut: (a: number, b: number, c: number) => [number, number, number, number];
772
+ readonly taffytree_getLayout: (a: number, b: bigint) => [number, number, number];
773
+ readonly taffytree_getNodeContext: (a: number, b: bigint) => [number, number, number];
774
+ readonly taffytree_getNodeContextMut: (a: number, b: bigint) => [number, number, number];
775
+ readonly taffytree_getStyle: (a: number, b: bigint) => [number, number, number];
776
+ readonly taffytree_insertChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [number, number];
777
+ readonly taffytree_markDirty: (a: number, b: bigint) => [number, number];
778
+ readonly taffytree_new: () => number;
779
+ readonly taffytree_newLeaf: (a: number, b: number) => [bigint, number, number];
780
+ readonly taffytree_newLeafWithContext: (a: number, b: number, c: any) => [bigint, number, number];
781
+ readonly taffytree_newWithChildren: (a: number, b: number, c: number, d: number) => [bigint, number, number];
782
+ readonly taffytree_parent: (a: number, b: bigint) => [number, bigint];
783
+ readonly taffytree_printTree: (a: number, b: bigint) => void;
784
+ readonly taffytree_remove: (a: number, b: bigint) => [bigint, number, number];
785
+ readonly taffytree_removeChild: (a: number, b: bigint, c: bigint) => [bigint, number, number];
786
+ readonly taffytree_removeChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
787
+ readonly taffytree_removeChildrenRange: (a: number, b: bigint, c: number, d: number) => [number, number];
788
+ readonly taffytree_replaceChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [bigint, number, number];
789
+ readonly taffytree_setChildren: (a: number, b: bigint, c: number, d: number) => [number, number];
790
+ readonly taffytree_setNodeContext: (a: number, b: bigint, c: any) => [number, number];
791
+ readonly taffytree_setStyle: (a: number, b: bigint, c: number) => [number, number];
792
+ readonly taffytree_totalNodeCount: (a: number) => number;
793
+ readonly taffytree_unroundedLayout: (a: number, b: bigint) => [number, number, number];
794
+ readonly taffytree_withCapacity: (a: number) => number;
1207
795
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1208
796
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1209
797
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -1211,6 +799,7 @@ export interface InitOutput {
1211
799
  readonly __wbindgen_externrefs: WebAssembly.Table;
1212
800
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1213
801
  readonly __externref_table_dealloc: (a: number) => void;
802
+ readonly __externref_drop_slice: (a: number, b: number) => void;
1214
803
  readonly __wbindgen_start: () => void;
1215
804
  }
1216
805