taffy-js 0.2.3 → 0.2.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/taffy_js.d.ts DELETED
@@ -1,958 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
-
4
- /**
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
14
- */
15
- export enum AlignContent {
16
- Start = 0,
17
- End = 1,
18
- FlexStart = 2,
19
- FlexEnd = 3,
20
- Center = 4,
21
- Stretch = 5,
22
- SpaceBetween = 6,
23
- SpaceAround = 7,
24
- SpaceEvenly = 8,
25
- }
26
-
27
- /**
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
38
- */
39
- export enum AlignItems {
40
- Start = 0,
41
- End = 1,
42
- FlexStart = 2,
43
- FlexEnd = 3,
44
- Center = 4,
45
- Baseline = 5,
46
- Stretch = 6,
47
- }
48
-
49
- /**
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`
57
- */
58
- export enum AlignSelf {
59
- Auto = 0,
60
- Start = 1,
61
- End = 2,
62
- FlexStart = 3,
63
- FlexEnd = 4,
64
- Center = 5,
65
- Baseline = 6,
66
- Stretch = 7,
67
- }
68
-
69
- /**
70
- * Box sizing enum
71
- *
72
- * Controls how the total width and height of an element is calculated.
73
- *
74
- * # Variants
75
- * - `BorderBox`: Width and height include content, padding, and border (default)
76
- * - `ContentBox`: Width and height include only the content
77
- */
78
- export enum BoxSizing {
79
- BorderBox = 0,
80
- ContentBox = 1,
81
- }
82
-
83
- /**
84
- * Display mode enum
85
- *
86
- * Controls the layout algorithm type for an element. Corresponds to CSS `display` property.
87
- *
88
- * # Variants
89
- * - `Block`: Block-level layout, element takes full width
90
- * - `Flex`: Flexbox layout, one-dimensional layout model
91
- * - `Grid`: CSS Grid layout, two-dimensional layout model
92
- * - `None`: Hidden, element does not participate in layout calculation
93
- */
94
- export enum Display {
95
- Block = 0,
96
- Flex = 1,
97
- Grid = 2,
98
- None = 3,
99
- }
100
-
101
- /**
102
- * Flex main axis direction enum
103
- *
104
- * Defines the direction children are laid out in a flex container. Corresponds to CSS `flex-direction` property.
105
- *
106
- * # Variants
107
- * - `Row`: Horizontal direction, left to right (LTR mode)
108
- * - `Column`: Vertical direction, top to bottom
109
- * - `RowReverse`: Horizontal reverse, right to left
110
- * - `ColumnReverse`: Vertical reverse, bottom to top
111
- */
112
- export enum FlexDirection {
113
- Row = 0,
114
- Column = 1,
115
- RowReverse = 2,
116
- ColumnReverse = 3,
117
- }
118
-
119
- /**
120
- * Flex wrap mode enum
121
- *
122
- * Controls whether flex items wrap onto multiple lines. Corresponds to CSS `flex-wrap` property.
123
- *
124
- * # Variants
125
- * - `NoWrap`: No wrapping, all items compressed into single line/column
126
- * - `Wrap`: Automatic wrapping, items flow to next line when container overflows
127
- * - `WrapReverse`: Reverse wrapping, new lines appear above or to the left
128
- */
129
- export enum FlexWrap {
130
- NoWrap = 0,
131
- Wrap = 1,
132
- WrapReverse = 2,
133
- }
134
-
135
- /**
136
- * Main axis alignment enum (Justify Content)
137
- *
138
- * Defines alignment and spacing distribution of children along the main axis.
139
- * Corresponds to CSS `justify-content` property.
140
- *
141
- * # Variants
142
- * - `Start/FlexStart`: Align to main axis start
143
- * - `End/FlexEnd`: Align to main axis end
144
- * - `Center`: Center alignment
145
- * - `SpaceBetween`: First and last items flush with edges, remaining space distributed evenly
146
- * - `SpaceAround`: Equal space on both sides of each item
147
- * - `SpaceEvenly`: All spacing completely equal
148
- */
149
- export enum JustifyContent {
150
- Start = 0,
151
- End = 1,
152
- FlexStart = 2,
153
- FlexEnd = 3,
154
- Center = 4,
155
- Stretch = 5,
156
- SpaceBetween = 6,
157
- SpaceAround = 7,
158
- SpaceEvenly = 8,
159
- }
160
-
161
- export class Layout {
162
- private constructor();
163
- free(): void;
164
- [Symbol.dispose](): void;
165
- /**
166
- * Gets the top border width.
167
- */
168
- readonly borderTop: number;
169
- /**
170
- * Gets the top margin.
171
- */
172
- readonly marginTop: number;
173
- /**
174
- * Gets the left border width.
175
- */
176
- readonly borderLeft: number;
177
- /**
178
- * Gets the left margin.
179
- */
180
- readonly marginLeft: number;
181
- /**
182
- * Gets the top padding.
183
- */
184
- readonly paddingTop: number;
185
- /**
186
- * Gets the right border width.
187
- */
188
- readonly borderRight: number;
189
- /**
190
- * Gets the right margin.
191
- */
192
- readonly marginRight: number;
193
- /**
194
- * Gets the left padding.
195
- */
196
- readonly paddingLeft: number;
197
- /**
198
- * Gets the bottom border width.
199
- */
200
- readonly borderBottom: number;
201
- /**
202
- * Gets the width of the scrollable content.
203
- */
204
- readonly contentWidth: number;
205
- /**
206
- * Gets the bottom margin.
207
- */
208
- readonly marginBottom: number;
209
- /**
210
- * Gets the right padding.
211
- */
212
- readonly paddingRight: number;
213
- /**
214
- * Gets the height of the scrollable content.
215
- */
216
- readonly contentHeight: number;
217
- /**
218
- * Gets the bottom padding.
219
- */
220
- readonly paddingBottom: number;
221
- /**
222
- * Gets the width of the vertical scrollbar.
223
- */
224
- readonly scrollbarWidth: number;
225
- /**
226
- * Gets the height of the horizontal scrollbar.
227
- */
228
- readonly scrollbarHeight: number;
229
- /**
230
- * Gets the x coordinate of the node's top-left corner.
231
- */
232
- readonly x: number;
233
- /**
234
- * Gets the y coordinate of the node's top-left corner.
235
- */
236
- readonly y: number;
237
- /**
238
- * Gets the rendering order of the node.
239
- */
240
- readonly order: number;
241
- /**
242
- * Gets the computed width of the node.
243
- */
244
- readonly width: number;
245
- /**
246
- * Gets the computed height of the node.
247
- */
248
- readonly height: number;
249
- }
250
-
251
- /**
252
- * Overflow handling enum
253
- *
254
- * Defines how content that overflows container boundaries is handled.
255
- * Corresponds to CSS `overflow` property.
256
- *
257
- * # Variants
258
- * - `Visible`: Content is not clipped
259
- * - `Hidden`: Content is clipped, overflow hidden
260
- * - `Scroll`: Always show scrollbars
261
- * - `Auto`: Show scrollbars when needed (internally mapped to Scroll)
262
- */
263
- export enum Overflow {
264
- Visible = 0,
265
- Hidden = 1,
266
- Scroll = 2,
267
- Auto = 3,
268
- }
269
-
270
- /**
271
- * Position mode enum
272
- *
273
- * Controls element positioning method. Corresponds to CSS `position` property.
274
- *
275
- * # Variants
276
- * - `Relative`: Relative positioning, element stays in normal document flow
277
- * - `Absolute`: Absolute positioning, element removed from flow, positioned relative to nearest positioned ancestor
278
- */
279
- export enum Position {
280
- Relative = 0,
281
- Absolute = 1,
282
- }
283
-
284
- export class Style {
285
- free(): void;
286
- [Symbol.dispose](): void;
287
- /**
288
- * Creates a new Style instance with default values.
289
- *
290
- * All properties are initialized to their CSS default values:
291
- * - display: Block
292
- * - position: Relative
293
- * - flex_direction: Row
294
- * - All dimensions: Auto
295
- * - All spacing (margin, padding, border): 0
296
- *
297
- * # Returns
298
- * A new Style instance with default configuration.
299
- *
300
- * # Example
301
- * ```javascript
302
- * const style = new Style();
303
- * style.display = Display.Flex;
304
- * ```
305
- */
306
- constructor();
307
- /**
308
- * Gets the align-self property. Overrides parent's align-items for this element.
309
- * Returns AlignSelf.Auto if not explicitly set.
310
- */
311
- get align_self(): AlignSelf | undefined;
312
- /**
313
- * Sets the align-self property. Use AlignSelf.Auto to inherit from parent.
314
- */
315
- set align_self(value: AlignSelf | null | undefined);
316
- /**
317
- * Gets the box sizing mode (BorderBox or ContentBox).
318
- */
319
- box_sizing: BoxSizing;
320
- /**
321
- * Gets the flex-basis as a JsDimension (Length, Percent, or Auto).
322
- * Flex-basis defines the initial main size before grow/shrink.
323
- */
324
- flex_basis: any;
325
- /**
326
- * Gets the border width as a JsRect<JsLengthPercentage>.
327
- * Border width defines the thickness of element borders.
328
- * Supports Length or Percent for each edge (not Auto).
329
- */
330
- border: any;
331
- /**
332
- * Gets the margin as a JsRect<JsLengthPercentageAuto>.
333
- * Margin is the outer spacing around the element's border.
334
- * Supports Length, Percent, or Auto for each edge.
335
- */
336
- margin: any;
337
- /**
338
- * Gets the align-items property. Controls cross-axis alignment of children.
339
- */
340
- get align_items(): AlignItems | undefined;
341
- /**
342
- * Sets the align-items property. Affects all children's cross-axis alignment.
343
- */
344
- set align_items(value: AlignItems | null | undefined);
345
- /**
346
- * Gets the flex shrink factor. Determines how much the item shrinks relative to siblings.
347
- */
348
- flex_shrink: number;
349
- /**
350
- * Gets the display mode (Block, Flex, Grid, or None).
351
- */
352
- display: Display;
353
- /**
354
- * Gets the padding as a JsRect<JsLengthPercentage>.
355
- * Padding is the inner spacing between the border and content.
356
- * Supports Length or Percent for each edge (not Auto).
357
- */
358
- padding: any;
359
- /**
360
- * Gets the aspect ratio (width / height). Returns None if not set.
361
- */
362
- get aspect_ratio(): number | undefined;
363
- /**
364
- * Sets the aspect ratio. For example, 16/9 = 1.777... for widescreen.
365
- * Set to None to remove the constraint.
366
- */
367
- set aspect_ratio(value: number | null | undefined);
368
- /**
369
- * Gets the maximum size constraints as a JsSize<JsDimension>.
370
- * Prevents the element from growing beyond these values.
371
- */
372
- max_size: any;
373
- /**
374
- * Gets the minimum size constraints as a JsSize<JsDimension>.
375
- * Prevents the element from shrinking below these values.
376
- */
377
- min_size: any;
378
- /**
379
- * Gets the overflow behavior as a JS object with {x, y} properties.
380
- */
381
- overflow: any;
382
- /**
383
- * Gets the position mode (Relative or Absolute).
384
- */
385
- position: Position;
386
- /**
387
- * Gets the align-content property. Controls spacing between lines in multi-line flex.
388
- */
389
- get align_content(): AlignContent | undefined;
390
- /**
391
- * Sets the align-content property. Only effective when flex-wrap is enabled.
392
- */
393
- set align_content(value: AlignContent | null | undefined);
394
- /**
395
- * Gets the flex grow factor. Determines how much the item grows relative to siblings.
396
- */
397
- flex_grow: number;
398
- /**
399
- * Gets the flex wrap mode (NoWrap, Wrap, WrapReverse).
400
- */
401
- flex_wrap: FlexWrap;
402
- /**
403
- * Gets the flex direction (Row, Column, RowReverse, ColumnReverse).
404
- */
405
- flex_direction: FlexDirection;
406
- /**
407
- * Gets the justify-content property. Controls main-axis alignment and spacing.
408
- */
409
- get justify_content(): JustifyContent | undefined;
410
- /**
411
- * Sets the justify-content property. Distributes space along the main axis.
412
- */
413
- set justify_content(value: JustifyContent | null | undefined);
414
- /**
415
- * Gets the gap between children as a JsSize<JsLengthPercentage>.
416
- * Used in Flex and Grid layouts to add spacing between items.
417
- * - width: column gap (horizontal spacing)
418
- * - height: row gap (vertical spacing)
419
- */
420
- gap: any;
421
- /**
422
- * Gets the size (width, height) as a JsSize<JsDimension>.
423
- * Each dimension can be Length, Percent, or Auto.
424
- */
425
- size: any;
426
- /**
427
- * Gets the inset (absolute positioning offsets) as a JsRect<JsLengthPercentageAuto>.
428
- * Only effective when position is Absolute.
429
- * Defines the distance from each edge of the containing block.
430
- */
431
- inset: any;
432
- }
433
-
434
- export class TaffyTree {
435
- free(): void;
436
- [Symbol.dispose](): void;
437
- /**
438
- * Marks a node as dirty, requiring re-layout.
439
- *
440
- * Call this when a node's content changes (e.g., text content)
441
- * but its style hasn't. Style changes automatically mark nodes dirty.
442
- *
443
- * # Arguments
444
- * * `node` - The node ID to mark dirty.
445
- */
446
- markDirty(node: bigint): void;
447
- /**
448
- * Prints the tree structure to the console (for debugging).
449
- *
450
- * # Arguments
451
- * * `node` - The root node ID to start printing from.
452
- */
453
- printTree(node: bigint): void;
454
- /**
455
- * Gets the number of children of a node.
456
- *
457
- * # Arguments
458
- * * `parent` - The parent node ID.
459
- *
460
- * # Returns
461
- * The number of children.
462
- */
463
- childCount(parent: bigint): number;
464
- /**
465
- * Removes a specific child from a parent.
466
- *
467
- * # Arguments
468
- * * `parent` - The parent node ID.
469
- * * `child` - The child node ID to remove.
470
- *
471
- * # Returns
472
- * * `Ok(u64)` - The ID of the removed child.
473
- * * `Err(JsValue)` - Error if parent or child doesn't exist.
474
- */
475
- removeChild(parent: bigint, child: bigint): bigint;
476
- /**
477
- * Replaces all children of a node.
478
- *
479
- * Previous children are detached but not removed from the tree.
480
- *
481
- * # Arguments
482
- * * `parent` - The parent node ID.
483
- * * `children` - Array of new child node IDs.
484
- */
485
- setChildren(parent: bigint, children: BigUint64Array): void;
486
- /**
487
- * Creates a new TaffyTree with pre-allocated capacity.
488
- *
489
- * Use this when you know approximately how many nodes you'll create
490
- * to avoid reallocation overhead.
491
- *
492
- * # Arguments
493
- * * `capacity` - The number of nodes to pre-allocate space for.
494
- *
495
- * # Returns
496
- * A new TaffyTree instance with pre-allocated capacity.
497
- */
498
- static withCapacity(capacity: number): TaffyTree;
499
- /**
500
- * Gets a child at a specific index.
501
- *
502
- * # Arguments
503
- * * `parent` - The parent node ID.
504
- * * `index` - The zero-based index.
505
- *
506
- * # Returns
507
- * * `Ok(u64)` - The child node ID at the given index.
508
- * * `Err(JsValue)` - Error if index is out of bounds.
509
- */
510
- getChildAtIndex(parent: bigint, index: number): bigint;
511
- /**
512
- * Computes the layout for a subtree.
513
- *
514
- * Runs the layout algorithm (Flexbox/Grid/Block) on the given node
515
- * and all its descendants. Results are cached and can be retrieved
516
- * with `getLayout()`.
517
- *
518
- * # Arguments
519
- * * `node` - The root node ID for layout computation.
520
- * * `available_space` - The available space constraint, e.g.:
521
- * `{ width: { Definite: 800 }, height: { Definite: 600 } }`
522
- *
523
- * Available space options per dimension:
524
- * - `{ Definite: number }` - A specific size in pixels
525
- * - `"MinContent"` - Use minimum content size
526
- * - `"MaxContent"` - Use maximum content size
527
- */
528
- computeLayout(node: bigint, available_space: any): void;
529
- /**
530
- * Enables rounding of layout values to whole pixels.
531
- *
532
- * When enabled, all computed layout values (x, y, width, height) are
533
- * rounded to the nearest integer. This is the default behavior.
534
- */
535
- enableRounding(): void;
536
- /**
537
- * Disables rounding of layout values.
538
- *
539
- * When disabled, layout values may have fractional pixel values.
540
- * Use `unroundedLayout()` to get the pre-rounding values.
541
- */
542
- disableRounding(): void;
543
- /**
544
- * Gets the context value for a node.
545
- *
546
- * # Arguments
547
- * * `node` - The node ID.
548
- *
549
- * # Returns
550
- * The context value, or `undefined` if not set.
551
- */
552
- getNodeContext(node: bigint): any;
553
- /**
554
- * Sets a context value for a node.
555
- *
556
- * Context values are passed to the measure function during layout.
557
- * Use this to attach data like text content or custom metadata.
558
- *
559
- * # Arguments
560
- * * `node` - The node ID.
561
- * * `context` - Any JavaScript value.
562
- */
563
- setNodeContext(node: bigint, context: any): void;
564
- /**
565
- * Gets the total number of nodes in the tree.
566
- *
567
- * # Returns
568
- * The count of all nodes (including removed nodes that haven't been reclaimed).
569
- */
570
- totalNodeCount(): number;
571
- /**
572
- * Gets the unrounded (fractional) layout for a node.
573
- *
574
- * Useful when you need sub-pixel precision.
575
- *
576
- * # Arguments
577
- * * `node` - The node ID to query.
578
- *
579
- * # Returns
580
- * A `Layout` object with potentially fractional pixel values.
581
- */
582
- unroundedLayout(node: bigint): Layout;
583
- /**
584
- * Creates a new node with the given children.
585
- *
586
- * # Arguments
587
- * * `style` - The Style object to apply to this node.
588
- * * `children` - Array of child node IDs.
589
- *
590
- * # Returns
591
- * * `Ok(u64)` - The node ID of the newly created node.
592
- * * `Err(JsValue)` - Error message if creation fails.
593
- */
594
- newWithChildren(style: Style, children: BigUint64Array): bigint;
595
- /**
596
- * Gets a mutable reference to the context value for a node.
597
- *
598
- * Note: In WASM, this returns a clone since we can't return mutable references.
599
- *
600
- * # Arguments
601
- * * `node` - The node ID.
602
- *
603
- * # Returns
604
- * The context value, or `undefined` if not set.
605
- */
606
- getNodeContextMut(node: bigint): any;
607
- /**
608
- * Inserts a child at a specific index.
609
- *
610
- * Existing children at and after the index are shifted right.
611
- *
612
- * # Arguments
613
- * * `parent` - The parent node ID.
614
- * * `index` - The zero-based index at which to insert.
615
- * * `child` - The child node ID to insert.
616
- */
617
- insertChildAtIndex(parent: bigint, index: number, child: bigint): void;
618
- /**
619
- * Creates a new leaf node with an attached context value.
620
- *
621
- * The context can be any JavaScript value and is useful for associating
622
- * custom data (like text content) with a node for use in measure functions.
623
- *
624
- * # Arguments
625
- * * `style` - The Style object to apply to this node.
626
- * * `context` - Any JavaScript value to attach to this node.
627
- *
628
- * # Returns
629
- * * `Ok(u64)` - The node ID of the newly created node.
630
- * * `Err(JsValue)` - Error message if creation fails.
631
- */
632
- newLeafWithContext(style: Style, context: any): bigint;
633
- /**
634
- * Removes a child at a specific index.
635
- *
636
- * # Arguments
637
- * * `parent` - The parent node ID.
638
- * * `index` - The zero-based index of the child to remove.
639
- *
640
- * # Returns
641
- * * `Ok(u64)` - The ID of the removed child.
642
- * * `Err(JsValue)` - Error if index is out of bounds.
643
- */
644
- removeChildAtIndex(parent: bigint, index: number): bigint;
645
- /**
646
- * Removes a range of children from a parent.
647
- *
648
- * # Arguments
649
- * * `parent` - The parent node ID.
650
- * * `start` - The start index (inclusive).
651
- * * `end` - The end index (exclusive).
652
- */
653
- removeChildrenRange(parent: bigint, start: number, end: number): void;
654
- /**
655
- * Replaces a child at a specific index with a new child.
656
- *
657
- * # Arguments
658
- * * `parent` - The parent node ID.
659
- * * `index` - The zero-based index of the child to replace.
660
- * * `child` - The new child node ID.
661
- *
662
- * # Returns
663
- * * `Ok(u64)` - The ID of the replaced (old) child.
664
- * * `Err(JsValue)` - Error if index is out of bounds.
665
- */
666
- replaceChildAtIndex(parent: bigint, index: number, child: bigint): bigint;
667
- /**
668
- * Computes layout with a custom measure function for leaf nodes.
669
- *
670
- * The measure function is called for leaf nodes to determine their
671
- * intrinsic size (e.g., for text measurement).
672
- *
673
- * # Arguments
674
- * * `node` - The root node ID for layout computation.
675
- * * `available_space` - The available space constraint.
676
- * * `measure_func` - A JavaScript function with signature:
677
- * `(knownDimensions, availableSpace, context) => { width, height }`
678
- *
679
- * The measure function receives:
680
- * - `knownDimensions`: `{ width: number | null, height: number | null }`
681
- * - `availableSpace`: `{ width: AvailableSpace, height: AvailableSpace }`
682
- * - `context`: The context value attached to the node (or undefined)
683
- *
684
- * And should return: `{ width: number, height: number }`
685
- */
686
- computeLayoutWithMeasure(node: bigint, available_space: any, measure_func: Function): void;
687
- /**
688
- * Gets context values for multiple nodes at once.
689
- *
690
- * Useful for batch operations.
691
- *
692
- * # Arguments
693
- * * `children` - Array of node IDs to query.
694
- *
695
- * # Returns
696
- * Array of context values in the same order as input.
697
- */
698
- getDisjointNodeContextMut(children: BigUint64Array): any[];
699
- /**
700
- * Creates a new empty TaffyTree.
701
- *
702
- * This is the primary constructor. Initializes panic hook in debug builds
703
- * to provide better error messages in the browser console.
704
- *
705
- * # Returns
706
- * A new TaffyTree instance with no nodes.
707
- */
708
- constructor();
709
- /**
710
- * Removes all nodes from the tree.
711
- *
712
- * After calling this, the tree is empty and all previous node IDs are invalid.
713
- */
714
- clear(): void;
715
- /**
716
- * Checks if a node is dirty (needs re-layout).
717
- *
718
- * # Arguments
719
- * * `node` - The node ID to check.
720
- *
721
- * # Returns
722
- * * `Ok(true)` - The node needs re-layout.
723
- * * `Ok(false)` - The node's layout is up-to-date.
724
- * * `Err(JsValue)` - Error if the node doesn't exist.
725
- */
726
- dirty(node: bigint): boolean;
727
- /**
728
- * Gets the style for a node.
729
- *
730
- * # Arguments
731
- * * `node` - The node ID to query.
732
- *
733
- * # Returns
734
- * * `Ok(Style)` - A copy of the node's style.
735
- * * `Err(JsValue)` - Error if the node doesn't exist.
736
- */
737
- getStyle(node: bigint): Style;
738
- /**
739
- * Gets the computed layout for a node.
740
- *
741
- * Must be called after `computeLayout()`.
742
- *
743
- * # Arguments
744
- * * `node` - The node ID to query.
745
- *
746
- * # Returns
747
- * A `Layout` object with computed position, size, and spacing values.
748
- */
749
- getLayout(node: bigint): Layout;
750
- /**
751
- * Gets the parent of a node.
752
- *
753
- * # Arguments
754
- * * `child` - The child node ID.
755
- *
756
- * # Returns
757
- * * `Some(u64)` - The parent node ID.
758
- * * `None` - If the node has no parent (is a root).
759
- */
760
- parent(child: bigint): bigint | undefined;
761
- /**
762
- * Removes a node from the tree.
763
- *
764
- * The node is detached from its parent (if any) and removed from the tree.
765
- * Child nodes are NOT automatically removed.
766
- *
767
- * # Arguments
768
- * * `node` - The node ID to remove.
769
- *
770
- * # Returns
771
- * * `Ok(u64)` - The ID of the removed node.
772
- * * `Err(JsValue)` - Error if the node doesn't exist.
773
- */
774
- remove(node: bigint): bigint;
775
- /**
776
- * Gets all children of a node.
777
- *
778
- * # Arguments
779
- * * `parent` - The parent node ID.
780
- *
781
- * # Returns
782
- * * `Ok(Box<[u64]>)` - Array of child node IDs.
783
- * * `Err(JsValue)` - Error if the node doesn't exist.
784
- */
785
- children(parent: bigint): BigUint64Array;
786
- /**
787
- * Creates a new leaf node (no children) with the given style.
788
- *
789
- * # Arguments
790
- * * `style` - The Style object to apply to this node.
791
- *
792
- * # Returns
793
- * * `Ok(u64)` - The node ID of the newly created node.
794
- * * `Err(JsValue)` - Error message if creation fails.
795
- */
796
- newLeaf(style: Style): bigint;
797
- /**
798
- * Appends a child node to a parent.
799
- *
800
- * The child is added at the end of the parent's children list.
801
- *
802
- * # Arguments
803
- * * `parent` - The parent node ID.
804
- * * `child` - The child node ID to add.
805
- */
806
- addChild(parent: bigint, child: bigint): void;
807
- /**
808
- * Sets the style for an existing node.
809
- *
810
- * This will mark the node and its ancestors as dirty, triggering
811
- * a re-layout on the next `computeLayout()` call.
812
- *
813
- * # Arguments
814
- * * `node` - The node ID to update.
815
- * * `style` - The new Style to apply.
816
- */
817
- setStyle(node: bigint, style: Style): void;
818
- }
819
-
820
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
821
-
822
- export interface InitOutput {
823
- readonly memory: WebAssembly.Memory;
824
- readonly __wbg_layout_free: (a: number, b: number) => void;
825
- readonly __wbg_style_free: (a: number, b: number) => void;
826
- readonly __wbg_taffytree_free: (a: number, b: number) => void;
827
- readonly layout_borderBottom: (a: number) => number;
828
- readonly layout_borderLeft: (a: number) => number;
829
- readonly layout_borderRight: (a: number) => number;
830
- readonly layout_borderTop: (a: number) => number;
831
- readonly layout_contentHeight: (a: number) => number;
832
- readonly layout_contentWidth: (a: number) => number;
833
- readonly layout_height: (a: number) => number;
834
- readonly layout_marginBottom: (a: number) => number;
835
- readonly layout_marginLeft: (a: number) => number;
836
- readonly layout_marginRight: (a: number) => number;
837
- readonly layout_marginTop: (a: number) => number;
838
- readonly layout_order: (a: number) => number;
839
- readonly layout_paddingBottom: (a: number) => number;
840
- readonly layout_paddingLeft: (a: number) => number;
841
- readonly layout_paddingRight: (a: number) => number;
842
- readonly layout_paddingTop: (a: number) => number;
843
- readonly layout_scrollbarHeight: (a: number) => number;
844
- readonly layout_scrollbarWidth: (a: number) => number;
845
- readonly layout_width: (a: number) => number;
846
- readonly layout_x: (a: number) => number;
847
- readonly layout_y: (a: number) => number;
848
- readonly style_align_content: (a: number) => number;
849
- readonly style_align_items: (a: number) => number;
850
- readonly style_align_self: (a: number) => number;
851
- readonly style_aspect_ratio: (a: number) => number;
852
- readonly style_border: (a: number) => any;
853
- readonly style_box_sizing: (a: number) => number;
854
- readonly style_display: (a: number) => number;
855
- readonly style_flex_basis: (a: number) => any;
856
- readonly style_flex_direction: (a: number) => number;
857
- readonly style_flex_grow: (a: number) => number;
858
- readonly style_flex_shrink: (a: number) => number;
859
- readonly style_flex_wrap: (a: number) => number;
860
- readonly style_gap: (a: number) => any;
861
- readonly style_inset: (a: number) => any;
862
- readonly style_justify_content: (a: number) => number;
863
- readonly style_margin: (a: number) => any;
864
- readonly style_max_size: (a: number) => any;
865
- readonly style_min_size: (a: number) => any;
866
- readonly style_new: () => number;
867
- readonly style_overflow: (a: number) => any;
868
- readonly style_padding: (a: number) => any;
869
- readonly style_position: (a: number) => number;
870
- readonly style_set_align_content: (a: number, b: number) => void;
871
- readonly style_set_align_items: (a: number, b: number) => void;
872
- readonly style_set_align_self: (a: number, b: number) => void;
873
- readonly style_set_aspect_ratio: (a: number, b: number) => void;
874
- readonly style_set_border: (a: number, b: any) => void;
875
- readonly style_set_box_sizing: (a: number, b: number) => void;
876
- readonly style_set_display: (a: number, b: number) => void;
877
- readonly style_set_flex_basis: (a: number, b: any) => void;
878
- readonly style_set_flex_direction: (a: number, b: number) => void;
879
- readonly style_set_flex_grow: (a: number, b: number) => void;
880
- readonly style_set_flex_shrink: (a: number, b: number) => void;
881
- readonly style_set_flex_wrap: (a: number, b: number) => void;
882
- readonly style_set_gap: (a: number, b: any) => void;
883
- readonly style_set_inset: (a: number, b: any) => void;
884
- readonly style_set_justify_content: (a: number, b: number) => void;
885
- readonly style_set_margin: (a: number, b: any) => void;
886
- readonly style_set_max_size: (a: number, b: any) => void;
887
- readonly style_set_min_size: (a: number, b: any) => void;
888
- readonly style_set_overflow: (a: number, b: any) => void;
889
- readonly style_set_padding: (a: number, b: any) => void;
890
- readonly style_set_position: (a: number, b: number) => void;
891
- readonly style_set_size: (a: number, b: any) => void;
892
- readonly style_size: (a: number) => any;
893
- readonly taffytree_addChild: (a: number, b: bigint, c: bigint) => [number, number];
894
- readonly taffytree_childCount: (a: number, b: bigint) => number;
895
- readonly taffytree_children: (a: number, b: bigint) => [number, number, number, number];
896
- readonly taffytree_clear: (a: number) => void;
897
- readonly taffytree_computeLayout: (a: number, b: bigint, c: any) => [number, number];
898
- readonly taffytree_computeLayoutWithMeasure: (a: number, b: bigint, c: any, d: any) => [number, number];
899
- readonly taffytree_dirty: (a: number, b: bigint) => [number, number, number];
900
- readonly taffytree_disableRounding: (a: number) => void;
901
- readonly taffytree_enableRounding: (a: number) => void;
902
- readonly taffytree_getChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
903
- readonly taffytree_getDisjointNodeContextMut: (a: number, b: number, c: number) => [number, number, number, number];
904
- readonly taffytree_getLayout: (a: number, b: bigint) => [number, number, number];
905
- readonly taffytree_getNodeContext: (a: number, b: bigint) => [number, number, number];
906
- readonly taffytree_getNodeContextMut: (a: number, b: bigint) => [number, number, number];
907
- readonly taffytree_getStyle: (a: number, b: bigint) => [number, number, number];
908
- readonly taffytree_insertChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [number, number];
909
- readonly taffytree_markDirty: (a: number, b: bigint) => [number, number];
910
- readonly taffytree_new: () => number;
911
- readonly taffytree_newLeaf: (a: number, b: number) => [bigint, number, number];
912
- readonly taffytree_newLeafWithContext: (a: number, b: number, c: any) => [bigint, number, number];
913
- readonly taffytree_newWithChildren: (a: number, b: number, c: number, d: number) => [bigint, number, number];
914
- readonly taffytree_parent: (a: number, b: bigint) => [number, bigint];
915
- readonly taffytree_printTree: (a: number, b: bigint) => void;
916
- readonly taffytree_remove: (a: number, b: bigint) => [bigint, number, number];
917
- readonly taffytree_removeChild: (a: number, b: bigint, c: bigint) => [bigint, number, number];
918
- readonly taffytree_removeChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
919
- readonly taffytree_removeChildrenRange: (a: number, b: bigint, c: number, d: number) => [number, number];
920
- readonly taffytree_replaceChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [bigint, number, number];
921
- readonly taffytree_setChildren: (a: number, b: bigint, c: number, d: number) => [number, number];
922
- readonly taffytree_setNodeContext: (a: number, b: bigint, c: any) => [number, number];
923
- readonly taffytree_setStyle: (a: number, b: bigint, c: number) => [number, number];
924
- readonly taffytree_totalNodeCount: (a: number) => number;
925
- readonly taffytree_unroundedLayout: (a: number, b: bigint) => [number, number, number];
926
- readonly taffytree_withCapacity: (a: number) => number;
927
- readonly __wbindgen_malloc: (a: number, b: number) => number;
928
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
929
- readonly __wbindgen_exn_store: (a: number) => void;
930
- readonly __externref_table_alloc: () => number;
931
- readonly __wbindgen_externrefs: WebAssembly.Table;
932
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
933
- readonly __externref_table_dealloc: (a: number) => void;
934
- readonly __externref_drop_slice: (a: number, b: number) => void;
935
- readonly __wbindgen_start: () => void;
936
- }
937
-
938
- export type SyncInitInput = BufferSource | WebAssembly.Module;
939
-
940
- /**
941
- * Instantiates the given `module`, which can either be bytes or
942
- * a precompiled `WebAssembly.Module`.
943
- *
944
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
945
- *
946
- * @returns {InitOutput}
947
- */
948
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
949
-
950
- /**
951
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
952
- * for everything else, calls `WebAssembly.instantiate` directly.
953
- *
954
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
955
- *
956
- * @returns {Promise<InitOutput>}
957
- */
958
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;