taffy-wasm 0.9.2 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/taffy_wasm.js CHANGED
@@ -77,9 +77,20 @@ function debugString(val) {
77
77
  return className;
78
78
  }
79
79
 
80
- function getArrayU32FromWasm0(ptr, len) {
80
+ function getArrayJsValueFromWasm0(ptr, len) {
81
81
  ptr = ptr >>> 0;
82
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
82
+ const mem = getDataViewMemory0();
83
+ const result = [];
84
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
85
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
86
+ }
87
+ wasm.__externref_drop_slice(ptr, len);
88
+ return result;
89
+ }
90
+
91
+ function getArrayU64FromWasm0(ptr, len) {
92
+ ptr = ptr >>> 0;
93
+ return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
83
94
  }
84
95
 
85
96
  function getArrayU8FromWasm0(ptr, len) {
@@ -87,6 +98,14 @@ function getArrayU8FromWasm0(ptr, len) {
87
98
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
88
99
  }
89
100
 
101
+ let cachedBigUint64ArrayMemory0 = null;
102
+ function getBigUint64ArrayMemory0() {
103
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
104
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
105
+ }
106
+ return cachedBigUint64ArrayMemory0;
107
+ }
108
+
90
109
  let cachedDataViewMemory0 = null;
91
110
  function getDataViewMemory0() {
92
111
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -100,14 +119,6 @@ function getStringFromWasm0(ptr, len) {
100
119
  return decodeText(ptr, len);
101
120
  }
102
121
 
103
- let cachedUint32ArrayMemory0 = null;
104
- function getUint32ArrayMemory0() {
105
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
106
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
107
- }
108
- return cachedUint32ArrayMemory0;
109
- }
110
-
111
122
  let cachedUint8ArrayMemory0 = null;
112
123
  function getUint8ArrayMemory0() {
113
124
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -129,9 +140,9 @@ function isLikeNone(x) {
129
140
  return x === undefined || x === null;
130
141
  }
131
142
 
132
- function passArray32ToWasm0(arg, malloc) {
133
- const ptr = malloc(arg.length * 4, 4) >>> 0;
134
- getUint32ArrayMemory0().set(arg, ptr / 4);
143
+ function passArray64ToWasm0(arg, malloc) {
144
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
145
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
135
146
  WASM_VECTOR_LEN = arg.length;
136
147
  return ptr;
137
148
  }
@@ -208,418 +219,372 @@ if (!('encodeInto' in cachedTextEncoder)) {
208
219
 
209
220
  let WASM_VECTOR_LEN = 0;
210
221
 
211
- const AvailableSpaceFinalization = (typeof FinalizationRegistry === 'undefined')
212
- ? { register: () => {}, unregister: () => {} }
213
- : new FinalizationRegistry(ptr => wasm.__wbg_availablespace_free(ptr >>> 0, 1));
214
-
215
- const DimensionFinalization = (typeof FinalizationRegistry === 'undefined')
216
- ? { register: () => {}, unregister: () => {} }
217
- : new FinalizationRegistry(ptr => wasm.__wbg_dimension_free(ptr >>> 0, 1));
218
-
219
222
  const LayoutFinalization = (typeof FinalizationRegistry === 'undefined')
220
223
  ? { register: () => {}, unregister: () => {} }
221
224
  : new FinalizationRegistry(ptr => wasm.__wbg_layout_free(ptr >>> 0, 1));
222
225
 
223
- const LineFinalization = (typeof FinalizationRegistry === 'undefined')
224
- ? { register: () => {}, unregister: () => {} }
225
- : new FinalizationRegistry(ptr => wasm.__wbg_line_free(ptr >>> 0, 1));
226
-
227
- const PointFinalization = (typeof FinalizationRegistry === 'undefined')
228
- ? { register: () => {}, unregister: () => {} }
229
- : new FinalizationRegistry(ptr => wasm.__wbg_point_free(ptr >>> 0, 1));
230
-
231
- const RectFinalization = (typeof FinalizationRegistry === 'undefined')
232
- ? { register: () => {}, unregister: () => {} }
233
- : new FinalizationRegistry(ptr => wasm.__wbg_rect_free(ptr >>> 0, 1));
234
-
235
- const SizeFinalization = (typeof FinalizationRegistry === 'undefined')
236
- ? { register: () => {}, unregister: () => {} }
237
- : new FinalizationRegistry(ptr => wasm.__wbg_size_free(ptr >>> 0, 1));
238
-
239
226
  const StyleFinalization = (typeof FinalizationRegistry === 'undefined')
240
227
  ? { register: () => {}, unregister: () => {} }
241
228
  : new FinalizationRegistry(ptr => wasm.__wbg_style_free(ptr >>> 0, 1));
242
229
 
243
- const TaffyNodeFinalization = (typeof FinalizationRegistry === 'undefined')
230
+ const TaffyErrorFinalization = (typeof FinalizationRegistry === 'undefined')
244
231
  ? { register: () => {}, unregister: () => {} }
245
- : new FinalizationRegistry(ptr => wasm.__wbg_taffynode_free(ptr >>> 0, 1));
232
+ : new FinalizationRegistry(ptr => wasm.__wbg_taffyerror_free(ptr >>> 0, 1));
246
233
 
247
- const TrackDefinitionFinalization = (typeof FinalizationRegistry === 'undefined')
234
+ const TaffyTreeFinalization = (typeof FinalizationRegistry === 'undefined')
248
235
  ? { register: () => {}, unregister: () => {} }
249
- : new FinalizationRegistry(ptr => wasm.__wbg_trackdefinition_free(ptr >>> 0, 1));
236
+ : new FinalizationRegistry(ptr => wasm.__wbg_taffytree_free(ptr >>> 0, 1));
250
237
 
251
238
  /**
252
- * How lines of content are aligned along the cross axis when there is extra space.
239
+ * Multi-line content alignment enumeration
240
+ *
241
+ * Controls the distribution of space between and around content items along the cross axis
242
+ * in a multi-line flex container. This corresponds to the CSS `align-content` property.
243
+ *
244
+ * **Note**: This property only has effect when `flex-wrap` is set to `Wrap` or `WrapReverse`.
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * import { AlignContent, FlexWrap } from 'taffy-js';
249
+ *
250
+ * style.flexWrap = FlexWrap.Wrap;
251
+ * style.alignContent = AlignContent.SpaceBetween; // Distribute lines evenly
252
+ * ```
253
253
  * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
254
254
  */
255
255
  export const AlignContent = Object.freeze({
256
256
  /**
257
- * Lines are packed toward the start of the cross axis.
257
+ * Lines packed toward the start of the cross axis
258
258
  */
259
259
  Start: 0, "0": "Start",
260
260
  /**
261
- * Lines are packed toward the end of the cross axis.
261
+ * Lines packed toward the end of the cross axis
262
262
  */
263
263
  End: 1, "1": "End",
264
264
  /**
265
- * Lines are packed toward the start of the flex-direction cross axis.
265
+ * Lines packed toward the start of the flex container
266
266
  */
267
267
  FlexStart: 2, "2": "FlexStart",
268
268
  /**
269
- * Lines are packed toward the end of the flex-direction cross axis.
269
+ * Lines packed toward the end of the flex container
270
270
  */
271
271
  FlexEnd: 3, "3": "FlexEnd",
272
272
  /**
273
- * Lines are packed toward the center of the cross axis.
273
+ * Lines centered within the container
274
274
  */
275
275
  Center: 4, "4": "Center",
276
276
  /**
277
- * Lines are evenly distributed; the first line is at the start, the last at the end.
277
+ * Lines stretched to fill the container
278
278
  */
279
- SpaceBetween: 5, "5": "SpaceBetween",
279
+ Stretch: 5, "5": "Stretch",
280
280
  /**
281
- * Lines are evenly distributed with equal space around them.
281
+ * Lines evenly distributed with first/last at edges
282
282
  */
283
- SpaceAround: 6, "6": "SpaceAround",
283
+ SpaceBetween: 6, "6": "SpaceBetween",
284
284
  /**
285
- * Lines are evenly distributed with equal space between them.
285
+ * Lines evenly distributed with equal space around each
286
286
  */
287
- SpaceEvenly: 7, "7": "SpaceEvenly",
287
+ SpaceAround: 7, "7": "SpaceAround",
288
288
  /**
289
- * Lines are stretched to take up the remaining space.
289
+ * Lines evenly distributed with equal space between each
290
290
  */
291
- Stretch: 8, "8": "Stretch",
291
+ SpaceEvenly: 8, "8": "SpaceEvenly",
292
292
  });
293
293
 
294
294
  /**
295
- * How items are aligned along the cross axis.
295
+ * Cross-axis alignment enumeration for all children
296
+ *
297
+ * Defines the default alignment for all flex/grid items along the cross axis.
298
+ * This corresponds to the CSS `align-items` property.
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * import { AlignItems } from 'taffy-js';
303
+ *
304
+ * style.alignItems = AlignItems.Center; // Center items on cross axis
305
+ * style.alignItems = AlignItems.Stretch; // Stretch items to fill container
306
+ * ```
296
307
  * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
297
308
  */
298
309
  export const AlignItems = Object.freeze({
299
310
  /**
300
- * Items are aligned at the start of the cross axis.
311
+ * Items aligned to the start of the cross axis
301
312
  */
302
313
  Start: 0, "0": "Start",
303
314
  /**
304
- * Items are aligned at the end of the cross axis.
315
+ * Items aligned to the end of the cross axis
305
316
  */
306
317
  End: 1, "1": "End",
307
318
  /**
308
- * Items are aligned at the start of the flex-direction cross axis.
319
+ * Items aligned to the start of the flex container
309
320
  */
310
321
  FlexStart: 2, "2": "FlexStart",
311
322
  /**
312
- * Items are aligned at the end of the flex-direction cross axis.
323
+ * Items aligned to the end of the flex container
313
324
  */
314
325
  FlexEnd: 3, "3": "FlexEnd",
315
326
  /**
316
- * Items are aligned at the center of the cross axis.
327
+ * Items centered along the cross axis
317
328
  */
318
329
  Center: 4, "4": "Center",
319
330
  /**
320
- * Items are aligned based on their baselines.
331
+ * Items aligned to their text baselines
321
332
  */
322
333
  Baseline: 5, "5": "Baseline",
323
334
  /**
324
- * Items are stretched to fill the container along the cross axis.
335
+ * Items stretched to fill the container
325
336
  */
326
337
  Stretch: 6, "6": "Stretch",
327
338
  });
328
339
 
329
340
  /**
330
- * How a single item is aligned along the cross axis, overriding `AlignItems`.
331
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
341
+ * Cross-axis alignment enumeration for a single element
342
+ *
343
+ * Overrides the parent's `align-items` value for a specific child element.
344
+ * This corresponds to the CSS `align-self` property.
345
+ *
346
+ * @example
347
+ * ```typescript
348
+ * import { AlignSelf } from 'taffy-js';
349
+ *
350
+ * style.alignSelf = AlignSelf.Auto; // Use parent's align-items
351
+ * style.alignSelf = AlignSelf.Center; // Override to center this item
352
+ * ```
353
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
332
354
  */
333
355
  export const AlignSelf = Object.freeze({
334
356
  /**
335
- * items are aligned at the start of the cross axis.
336
- */
337
- Start: 0, "0": "Start",
338
- /**
339
- * Items are aligned at the end of the cross axis.
340
- */
341
- End: 1, "1": "End",
342
- /**
343
- * Items are aligned at the start of the flex-direction cross axis.
357
+ * Inherits the parent container's `align-items` value
344
358
  */
345
- FlexStart: 2, "2": "FlexStart",
346
- /**
347
- * Items are aligned at the end of the flex-direction cross axis.
348
- */
349
- FlexEnd: 3, "3": "FlexEnd",
359
+ Auto: 0, "0": "Auto",
350
360
  /**
351
- * Items are aligned at the center of the cross axis.
361
+ * Item aligned to the start of the cross axis
352
362
  */
353
- Center: 4, "4": "Center",
363
+ Start: 1, "1": "Start",
354
364
  /**
355
- * Items are aligned based on their baselines.
365
+ * Item aligned to the end of the cross axis
356
366
  */
357
- Baseline: 5, "5": "Baseline",
367
+ End: 2, "2": "End",
358
368
  /**
359
- * Items are stretched to fill the container along the cross axis.
369
+ * Item aligned to the start of the flex container
360
370
  */
361
- Stretch: 6, "6": "Stretch",
362
- });
363
-
364
- /**
365
- * The available space for layout computation.
366
- */
367
- export class AvailableSpace {
368
- __destroy_into_raw() {
369
- const ptr = this.__wbg_ptr;
370
- this.__wbg_ptr = 0;
371
- AvailableSpaceFinalization.unregister(this);
372
- return ptr;
373
- }
374
- free() {
375
- const ptr = this.__destroy_into_raw();
376
- wasm.__wbg_availablespace_free(ptr, 0);
377
- }
371
+ FlexStart: 3, "3": "FlexStart",
378
372
  /**
379
- * The available width (None means undefined/max-content).
380
- * @returns {number | undefined}
373
+ * Item aligned to the end of the flex container
381
374
  */
382
- get width() {
383
- const ret = wasm.__wbg_get_availablespace_width(this.__wbg_ptr);
384
- return ret === 0x100000001 ? undefined : ret;
385
- }
375
+ FlexEnd: 4, "4": "FlexEnd",
386
376
  /**
387
- * The available width (None means undefined/max-content).
388
- * @param {number | null} [arg0]
377
+ * Item centered along the cross axis
389
378
  */
390
- set width(arg0) {
391
- wasm.__wbg_set_availablespace_width(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : Math.fround(arg0));
392
- }
379
+ Center: 5, "5": "Center",
393
380
  /**
394
- * The available height (None means undefined/max-content).
395
- * @returns {number | undefined}
381
+ * Item aligned to its text baseline
396
382
  */
397
- get height() {
398
- const ret = wasm.__wbg_get_availablespace_height(this.__wbg_ptr);
399
- return ret === 0x100000001 ? undefined : ret;
400
- }
383
+ Baseline: 6, "6": "Baseline",
401
384
  /**
402
- * The available height (None means undefined/max-content).
403
- * @param {number | null} [arg0]
385
+ * Item stretched to fill the container
404
386
  */
405
- set height(arg0) {
406
- wasm.__wbg_set_availablespace_height(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : Math.fround(arg0));
407
- }
408
- }
409
- if (Symbol.dispose) AvailableSpace.prototype[Symbol.dispose] = AvailableSpace.prototype.free;
387
+ Stretch: 7, "7": "Stretch",
388
+ });
410
389
 
411
390
  /**
412
- * Represents a length value in CSS.
391
+ * Box sizing enumeration
413
392
  *
414
- * This struct corresponds to a dimension value that can be specified in pixels, percentage, or auto.
415
- */
416
- export class Dimension {
417
- static __wrap(ptr) {
418
- ptr = ptr >>> 0;
419
- const obj = Object.create(Dimension.prototype);
420
- obj.__wbg_ptr = ptr;
421
- DimensionFinalization.register(obj, obj.__wbg_ptr, obj);
422
- return obj;
423
- }
424
- __destroy_into_raw() {
425
- const ptr = this.__wbg_ptr;
426
- this.__wbg_ptr = 0;
427
- DimensionFinalization.unregister(this);
428
- return ptr;
429
- }
430
- free() {
431
- const ptr = this.__destroy_into_raw();
432
- wasm.__wbg_dimension_free(ptr, 0);
433
- }
434
- /**
435
- * The numeric value of the dimension.
436
- * - For `Pixels`, this is the number of pixels.
437
- * - 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).
438
- * - For `Auto`, this value is typically ignored.
439
- * @returns {number}
440
- */
441
- get value() {
442
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
443
- return ret;
444
- }
445
- /**
446
- * The numeric value of the dimension.
447
- * - For `Pixels`, this is the number of pixels.
448
- * - 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).
449
- * - For `Auto`, this value is typically ignored.
450
- * @param {number} arg0
451
- */
452
- set value(arg0) {
453
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
454
- }
455
- /**
456
- * The unit of the dimension.
457
- * @returns {DimensionUnit}
458
- */
459
- get unit() {
460
- const ret = wasm.__wbg_get_dimension_unit(this.__wbg_ptr);
461
- return ret;
462
- }
463
- /**
464
- * The unit of the dimension.
465
- * @param {DimensionUnit} arg0
466
- */
467
- set unit(arg0) {
468
- wasm.__wbg_set_dimension_unit(this.__wbg_ptr, arg0);
469
- }
470
- }
471
- if (Symbol.dispose) Dimension.prototype[Symbol.dispose] = Dimension.prototype.free;
472
-
473
- /**
474
- * The unit of a dimension.
475
- * @enum {0 | 1 | 2}
393
+ * Controls how the total width and height of an element is calculated.
394
+ * This corresponds to the CSS `box-sizing` property.
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * import { BoxSizing } from 'taffy-js';
399
+ *
400
+ * style.boxSizing = BoxSizing.BorderBox; // Size includes padding and border
401
+ * style.boxSizing = BoxSizing.ContentBox; // Size is content only
402
+ * ```
403
+ * @enum {0 | 1}
476
404
  */
477
- export const DimensionUnit = Object.freeze({
478
- /**
479
- * The dimension is specified in logical pixels.
480
- */
481
- Pixels: 0, "0": "Pixels",
405
+ export const BoxSizing = Object.freeze({
482
406
  /**
483
- * The dimension is specified as a percentage of the parent's size.
407
+ * The width and height properties include padding and border
484
408
  */
485
- Percent: 1, "1": "Percent",
409
+ BorderBox: 0, "0": "BorderBox",
486
410
  /**
487
- * The dimension is determined automatically based on content or context.
411
+ * The width and height properties include only the content
488
412
  */
489
- Auto: 2, "2": "Auto",
413
+ ContentBox: 1, "1": "ContentBox",
490
414
  });
491
415
 
492
416
  /**
493
- * The display style of a node.
417
+ * Display mode enumeration
418
+ *
419
+ * Controls the layout algorithm type for an element. This corresponds to the CSS `display` property
420
+ * and determines how an element and its children are laid out.
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * import { Display } from 'taffy-js';
425
+ *
426
+ * style.display = Display.Flex; // Enable flexbox layout
427
+ * style.display = Display.Grid; // Enable grid layout
428
+ * style.display = Display.None; // Hide element from layout
429
+ * ```
494
430
  * @enum {0 | 1 | 2 | 3}
495
431
  */
496
432
  export const Display = Object.freeze({
497
433
  /**
498
- * The node is hidden and does not take up space.
434
+ * Block-level layout where element takes the full available width
499
435
  */
500
- None: 0, "0": "None",
436
+ Block: 0, "0": "Block",
501
437
  /**
502
- * The node behaves as a flex container.
438
+ * Flexbox layout for one-dimensional item arrangement
503
439
  */
504
440
  Flex: 1, "1": "Flex",
505
441
  /**
506
- * The node behaves as a grid container.
442
+ * CSS Grid layout for two-dimensional item arrangement
507
443
  */
508
444
  Grid: 2, "2": "Grid",
509
445
  /**
510
- * The node behaves as a block element.
446
+ * Element is removed from layout calculation entirely
511
447
  */
512
- Block: 3, "3": "Block",
448
+ None: 3, "3": "None",
513
449
  });
514
450
 
515
451
  /**
516
- * The direction of the main axis for a flex container.
452
+ * Flex direction enumeration
453
+ *
454
+ * Defines the main axis direction for flex item layout. This corresponds to the CSS
455
+ * `flex-direction` property and determines how flex items are placed within the container.
456
+ *
457
+ * @example
458
+ * ```typescript
459
+ * import { FlexDirection } from 'taffy-js';
460
+ *
461
+ * style.flexDirection = FlexDirection.Row; // Horizontal, left to right
462
+ * style.flexDirection = FlexDirection.Column; // Vertical, top to bottom
463
+ * ```
517
464
  * @enum {0 | 1 | 2 | 3}
518
465
  */
519
466
  export const FlexDirection = Object.freeze({
520
467
  /**
521
- * Items are placed horizontally from left to right.
468
+ * Main axis runs horizontally from left to right
522
469
  */
523
470
  Row: 0, "0": "Row",
524
471
  /**
525
- * Items are placed vertically from top to bottom.
472
+ * Main axis runs vertically from top to bottom
526
473
  */
527
474
  Column: 1, "1": "Column",
528
475
  /**
529
- * Items are placed horizontally from right to left.
476
+ * Main axis runs horizontally from right to left
530
477
  */
531
478
  RowReverse: 2, "2": "RowReverse",
532
479
  /**
533
- * Items are placed vertically from bottom to top.
480
+ * Main axis runs vertically from bottom to top
534
481
  */
535
482
  ColumnReverse: 3, "3": "ColumnReverse",
536
483
  });
537
484
 
538
485
  /**
539
- * Whether flex items are forced into a single line or can wrap onto multiple lines.
486
+ * Flex wrap mode enumeration
487
+ *
488
+ * Controls whether flex items wrap onto multiple lines when they overflow the container.
489
+ * This corresponds to the CSS `flex-wrap` property.
490
+ *
491
+ * @example
492
+ * ```typescript
493
+ * import { FlexWrap } from 'taffy-js';
494
+ *
495
+ * style.flexWrap = FlexWrap.NoWrap; // All items on single line
496
+ * style.flexWrap = FlexWrap.Wrap; // Items wrap to new lines
497
+ * ```
540
498
  * @enum {0 | 1 | 2}
541
499
  */
542
500
  export const FlexWrap = Object.freeze({
543
501
  /**
544
- * Items are forced into a single line.
502
+ * All flex items are placed on a single line
545
503
  */
546
504
  NoWrap: 0, "0": "NoWrap",
547
505
  /**
548
- * Items wrap onto multiple lines.
506
+ * Flex items wrap onto multiple lines from top to bottom
549
507
  */
550
508
  Wrap: 1, "1": "Wrap",
551
509
  /**
552
- * Items wrap onto multiple lines in reverse order.
510
+ * Flex items wrap onto multiple lines from bottom to top
553
511
  */
554
512
  WrapReverse: 2, "2": "WrapReverse",
555
513
  });
556
514
 
557
515
  /**
558
- * Grid auto-placement algorithm controls how auto-placed items get flowed into the grid.
559
- * @enum {0 | 1 | 2 | 3}
560
- */
561
- export const GridAutoFlow = Object.freeze({
562
- /**
563
- * Items are placed by filling each row in turn, adding new rows as necessary.
564
- */
565
- Row: 0, "0": "Row",
566
- /**
567
- * Items are placed by filling each column in turn, adding new columns as necessary.
568
- */
569
- Column: 1, "1": "Column",
570
- /**
571
- * Items are placed by filling each row, attempting to fill holes earlier in the grid.
572
- */
573
- RowDense: 2, "2": "RowDense",
574
- /**
575
- * Items are placed by filling each column, attempting to fill holes earlier in the grid.
576
- */
577
- ColumnDense: 3, "3": "ColumnDense",
578
- });
579
-
580
- /**
581
- * How items are distributed along the main axis.
582
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
516
+ * Main axis alignment enumeration
517
+ *
518
+ * Defines how flex items are aligned and spaced along the main axis.
519
+ * This corresponds to the CSS `justify-content` property.
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * import { JustifyContent } from 'taffy-js';
524
+ *
525
+ * style.justifyContent = JustifyContent.Center; // Center items
526
+ * style.justifyContent = JustifyContent.SpaceBetween; // Distribute evenly
527
+ * ```
528
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
583
529
  */
584
530
  export const JustifyContent = Object.freeze({
585
531
  /**
586
- * Items are packed toward the start of the layout direction.
532
+ * Items packed toward the start of the main axis
587
533
  */
588
534
  Start: 0, "0": "Start",
589
535
  /**
590
- * Items are packed toward the end of the layout direction.
536
+ * Items packed toward the end of the main axis
591
537
  */
592
538
  End: 1, "1": "End",
593
539
  /**
594
- * Items are packed toward the start of the flex-direction.
540
+ * Items packed toward the start of the flex container
595
541
  */
596
542
  FlexStart: 2, "2": "FlexStart",
597
543
  /**
598
- * Items are packed toward the end of the flex-direction.
544
+ * Items packed toward the end of the flex container
599
545
  */
600
546
  FlexEnd: 3, "3": "FlexEnd",
601
547
  /**
602
- * Items are centered along the line.
548
+ * Items centered along the main axis
603
549
  */
604
550
  Center: 4, "4": "Center",
605
551
  /**
606
- * Items are evenly distributed; the first item is at the start, the last at the end.
552
+ * Items stretched along the main axis
553
+ */
554
+ Stretch: 5, "5": "Stretch",
555
+ /**
556
+ * Items evenly distributed with first/last at edges
607
557
  */
608
- SpaceBetween: 5, "5": "SpaceBetween",
558
+ SpaceBetween: 6, "6": "SpaceBetween",
609
559
  /**
610
- * Items are evenly distributed with equal space around them.
560
+ * Items evenly distributed with equal space around each
611
561
  */
612
- SpaceAround: 6, "6": "SpaceAround",
562
+ SpaceAround: 7, "7": "SpaceAround",
613
563
  /**
614
- * Items are evenly distributed with equal space between them using the same gap at ends.
564
+ * Items evenly distributed with equal space between each
615
565
  */
616
- SpaceEvenly: 7, "7": "SpaceEvenly",
566
+ SpaceEvenly: 8, "8": "SpaceEvenly",
617
567
  });
618
568
 
619
569
  /**
620
- * Represents the computed layout of a node.
621
- *
622
- * This struct contains the final position and size of a node after layout computation.
570
+ * Computed layout result containing position, size, and spacing values for a node.
571
+ *
572
+ * This class wraps the native [`taffy::Layout`] and provides read-only access
573
+ * to all computed layout values. All dimensions are in pixels.
574
+ *
575
+ * @example
576
+ * ```typescript
577
+ * const layout = tree.getLayout(node);
578
+ *
579
+ * console.log("Position:", layout.x, layout.y);
580
+ * console.log("Size:", layout.width, layout.height);
581
+ * console.log("Content:", layout.contentWidth, layout.contentHeight);
582
+ * console.log("Padding:", layout.paddingTop, layout.paddingRight, layout.paddingBottom, layout.paddingLeft);
583
+ * console.log("Border:", layout.borderTop, layout.borderRight, layout.borderBottom, layout.borderLeft);
584
+ * console.log("Margin:", layout.marginTop, layout.marginRight, layout.marginBottom, layout.marginLeft);
585
+ * console.log("Scrollbar:", layout.scrollbarWidth, layout.scrollbarHeight);
586
+ * console.log("Order:", layout.order);
587
+ * ```
623
588
  */
624
589
  export class Layout {
625
590
  static __wrap(ptr) {
@@ -640,1477 +605,1874 @@ export class Layout {
640
605
  wasm.__wbg_layout_free(ptr, 0);
641
606
  }
642
607
  /**
643
- * The absolute x-coordinate of the node relative to its parent.
608
+ * Gets the top border width
609
+ *
610
+ * @returns - The computed top border width in pixels
644
611
  * @returns {number}
645
612
  */
646
- get x() {
647
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
613
+ get borderTop() {
614
+ const ret = wasm.layout_borderTop(this.__wbg_ptr);
648
615
  return ret;
649
616
  }
650
617
  /**
651
- * The absolute x-coordinate of the node relative to its parent.
652
- * @param {number} arg0
618
+ * Gets the top margin
619
+ *
620
+ * @returns - The computed top margin in pixels
621
+ * @returns {number}
653
622
  */
654
- set x(arg0) {
655
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
623
+ get marginTop() {
624
+ const ret = wasm.layout_marginTop(this.__wbg_ptr);
625
+ return ret;
656
626
  }
657
627
  /**
658
- * The absolute y-coordinate of the node relative to its parent.
628
+ * Gets the left border width
629
+ *
630
+ * @returns - The computed left border width in pixels
659
631
  * @returns {number}
660
632
  */
661
- get y() {
662
- const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
633
+ get borderLeft() {
634
+ const ret = wasm.layout_borderLeft(this.__wbg_ptr);
663
635
  return ret;
664
636
  }
665
637
  /**
666
- * The absolute y-coordinate of the node relative to its parent.
667
- * @param {number} arg0
638
+ * Gets the left margin
639
+ *
640
+ * @returns - The computed left margin in pixels
641
+ * @returns {number}
668
642
  */
669
- set y(arg0) {
670
- wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
643
+ get marginLeft() {
644
+ const ret = wasm.layout_marginLeft(this.__wbg_ptr);
645
+ return ret;
671
646
  }
672
647
  /**
673
- * The computed width of the node.
648
+ * Gets the top padding
649
+ *
650
+ * @returns - The computed top padding in pixels
674
651
  * @returns {number}
675
652
  */
676
- get width() {
677
- const ret = wasm.__wbg_get_layout_width(this.__wbg_ptr);
653
+ get paddingTop() {
654
+ const ret = wasm.layout_paddingTop(this.__wbg_ptr);
678
655
  return ret;
679
656
  }
680
657
  /**
681
- * The computed width of the node.
682
- * @param {number} arg0
658
+ * Gets the right border width
659
+ *
660
+ * @returns - The computed right border width in pixels
661
+ * @returns {number}
683
662
  */
684
- set width(arg0) {
685
- wasm.__wbg_set_layout_width(this.__wbg_ptr, arg0);
663
+ get borderRight() {
664
+ const ret = wasm.layout_borderRight(this.__wbg_ptr);
665
+ return ret;
686
666
  }
687
667
  /**
688
- * The computed height of the node.
668
+ * Gets the right margin
669
+ *
670
+ * @returns - The computed right margin in pixels
689
671
  * @returns {number}
690
672
  */
691
- get height() {
692
- const ret = wasm.__wbg_get_layout_height(this.__wbg_ptr);
673
+ get marginRight() {
674
+ const ret = wasm.layout_marginRight(this.__wbg_ptr);
693
675
  return ret;
694
676
  }
695
677
  /**
696
- * The computed height of the node.
697
- * @param {number} arg0
678
+ * Gets the left padding
679
+ *
680
+ * @returns - The computed left padding in pixels
681
+ * @returns {number}
698
682
  */
699
- set height(arg0) {
700
- wasm.__wbg_set_layout_height(this.__wbg_ptr, arg0);
683
+ get paddingLeft() {
684
+ const ret = wasm.layout_paddingLeft(this.__wbg_ptr);
685
+ return ret;
701
686
  }
702
- }
703
- if (Symbol.dispose) Layout.prototype[Symbol.dispose] = Layout.prototype.free;
704
-
705
- /**
706
- * Represents a grid line placement (start and end).
707
- */
708
- export class Line {
709
- __destroy_into_raw() {
710
- const ptr = this.__wbg_ptr;
711
- this.__wbg_ptr = 0;
712
- LineFinalization.unregister(this);
713
- return ptr;
687
+ /**
688
+ * Gets the bottom border width
689
+ *
690
+ * @returns - The computed bottom border width in pixels
691
+ * @returns {number}
692
+ */
693
+ get borderBottom() {
694
+ const ret = wasm.layout_borderBottom(this.__wbg_ptr);
695
+ return ret;
714
696
  }
715
- free() {
716
- const ptr = this.__destroy_into_raw();
717
- wasm.__wbg_line_free(ptr, 0);
697
+ /**
698
+ * Gets the width of the scrollable content
699
+ *
700
+ * If the node has overflow content, this represents the total
701
+ * width of all content (may exceed `width`).
702
+ *
703
+ * @returns - The content width in pixels
704
+ * @returns {number}
705
+ */
706
+ get contentWidth() {
707
+ const ret = wasm.layout_contentWidth(this.__wbg_ptr);
708
+ return ret;
718
709
  }
719
710
  /**
720
- * The start line index (1-based).
721
- * @returns {number | undefined}
711
+ * Gets the bottom margin
712
+ *
713
+ * @returns - The computed bottom margin in pixels
714
+ * @returns {number}
722
715
  */
723
- get start() {
724
- const ret = wasm.__wbg_get_line_start(this.__wbg_ptr);
725
- return ret === 0xFFFFFF ? undefined : ret;
716
+ get marginBottom() {
717
+ const ret = wasm.layout_marginBottom(this.__wbg_ptr);
718
+ return ret;
726
719
  }
727
720
  /**
728
- * The start line index (1-based).
729
- * @param {number | null} [arg0]
721
+ * Gets the right padding
722
+ *
723
+ * @returns - The computed right padding in pixels
724
+ * @returns {number}
730
725
  */
731
- set start(arg0) {
732
- wasm.__wbg_set_line_start(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0);
726
+ get paddingRight() {
727
+ const ret = wasm.layout_paddingRight(this.__wbg_ptr);
728
+ return ret;
733
729
  }
734
730
  /**
735
- * The end line index (1-based).
736
- * @returns {number | undefined}
731
+ * Gets the height of the scrollable content
732
+ *
733
+ * If the node has overflow content, this represents the total
734
+ * height of all content (may exceed `height`).
735
+ *
736
+ * @returns - The content height in pixels
737
+ * @returns {number}
737
738
  */
738
- get end() {
739
- const ret = wasm.__wbg_get_line_end(this.__wbg_ptr);
740
- return ret === 0xFFFFFF ? undefined : ret;
739
+ get contentHeight() {
740
+ const ret = wasm.layout_contentHeight(this.__wbg_ptr);
741
+ return ret;
741
742
  }
742
743
  /**
743
- * The end line index (1-based).
744
- * @param {number | null} [arg0]
744
+ * Gets the bottom padding
745
+ *
746
+ * @returns - The computed bottom padding in pixels
747
+ * @returns {number}
745
748
  */
746
- set end(arg0) {
747
- wasm.__wbg_set_line_end(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0);
749
+ get paddingBottom() {
750
+ const ret = wasm.layout_paddingBottom(this.__wbg_ptr);
751
+ return ret;
748
752
  }
749
- }
750
- if (Symbol.dispose) Line.prototype[Symbol.dispose] = Line.prototype.free;
751
-
752
- /**
753
- * Represents a point in 2D space.
754
- *
755
- * Typically used for coordinates like absolute positioning offsets.
756
- */
757
- export class Point {
758
- __destroy_into_raw() {
759
- const ptr = this.__wbg_ptr;
760
- this.__wbg_ptr = 0;
761
- PointFinalization.unregister(this);
762
- return ptr;
753
+ /**
754
+ * Gets the width of the vertical scrollbar
755
+ *
756
+ * When overflow is set to scroll, this indicates the space
757
+ * reserved for the vertical scrollbar.
758
+ *
759
+ * @returns - The scrollbar width in pixels (0 if no scrollbar)
760
+ * @returns {number}
761
+ */
762
+ get scrollbarWidth() {
763
+ const ret = wasm.layout_scrollbarWidth(this.__wbg_ptr);
764
+ return ret;
763
765
  }
764
- free() {
765
- const ptr = this.__destroy_into_raw();
766
- wasm.__wbg_point_free(ptr, 0);
766
+ /**
767
+ * Gets the height of the horizontal scrollbar
768
+ *
769
+ * When overflow is set to scroll, this indicates the space
770
+ * reserved for the horizontal scrollbar.
771
+ *
772
+ * @returns - The scrollbar height in pixels (0 if no scrollbar)
773
+ * @returns {number}
774
+ */
775
+ get scrollbarHeight() {
776
+ const ret = wasm.layout_scrollbarHeight(this.__wbg_ptr);
777
+ return ret;
767
778
  }
768
779
  /**
769
- * The x-coordinate (horizontal).
780
+ * Gets the X coordinate of the node's top-left corner
781
+ *
782
+ * This value is relative to the node's parent. For the root node,
783
+ * this is always 0.
784
+ *
785
+ * @returns - The horizontal position in pixels
770
786
  * @returns {number}
771
787
  */
772
788
  get x() {
773
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
789
+ const ret = wasm.layout_x(this.__wbg_ptr);
774
790
  return ret;
775
791
  }
776
792
  /**
777
- * The x-coordinate (horizontal).
778
- * @param {number} arg0
793
+ * Gets the Y coordinate of the node's top-left corner
794
+ *
795
+ * This value is relative to the node's parent. For the root node,
796
+ * this is always 0.
797
+ *
798
+ * @returns - The vertical position in pixels
799
+ * @returns {number}
779
800
  */
780
- set x(arg0) {
781
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
801
+ get y() {
802
+ const ret = wasm.layout_y(this.__wbg_ptr);
803
+ return ret;
782
804
  }
783
805
  /**
784
- * The y-coordinate (vertical).
806
+ * Gets the rendering order of the node
807
+ *
808
+ * This value determines the z-order for overlapping elements.
809
+ * Lower values are rendered first (behind higher values).
810
+ *
811
+ * @returns - The rendering order as an unsigned 32-bit integer
785
812
  * @returns {number}
786
813
  */
787
- get y() {
788
- const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
814
+ get order() {
815
+ const ret = wasm.layout_order(this.__wbg_ptr);
816
+ return ret >>> 0;
817
+ }
818
+ /**
819
+ * Gets the computed width of the node
820
+ *
821
+ * This is the final width after layout computation, including
822
+ * any constraints from min/max size or flex properties.
823
+ *
824
+ * @returns - The width in pixels
825
+ * @returns {number}
826
+ */
827
+ get width() {
828
+ const ret = wasm.layout_width(this.__wbg_ptr);
789
829
  return ret;
790
830
  }
791
831
  /**
792
- * The y-coordinate (vertical).
793
- * @param {number} arg0
832
+ * Gets the computed height of the node
833
+ *
834
+ * This is the final height after layout computation, including
835
+ * any constraints from min/max size or flex properties.
836
+ *
837
+ * @returns - The height in pixels
838
+ * @returns {number}
794
839
  */
795
- set y(arg0) {
796
- wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
840
+ get height() {
841
+ const ret = wasm.layout_height(this.__wbg_ptr);
842
+ return ret;
797
843
  }
798
844
  }
799
- if (Symbol.dispose) Point.prototype[Symbol.dispose] = Point.prototype.free;
845
+ if (Symbol.dispose) Layout.prototype[Symbol.dispose] = Layout.prototype.free;
800
846
 
801
847
  /**
802
- * Positioning strategy for a node.
803
- * @enum {0 | 1 | 2}
848
+ * Overflow handling enumeration
849
+ *
850
+ * Defines how content that exceeds the container boundaries is handled.
851
+ * This corresponds to the CSS `overflow` property.
852
+ *
853
+ * @example
854
+ * ```typescript
855
+ * import { Overflow } from 'taffy-js';
856
+ *
857
+ * style.overflow = { x: Overflow.Hidden, y: Overflow.Scroll };
858
+ * ```
859
+ * @enum {0 | 1 | 2 | 3}
804
860
  */
805
- export const Position = Object.freeze({
861
+ export const Overflow = Object.freeze({
862
+ /**
863
+ * Content is not clipped and may render outside the container
864
+ */
865
+ Visible: 0, "0": "Visible",
806
866
  /**
807
- * Relative to its normal position in the flow.
867
+ * Content is clipped at the container boundary
808
868
  */
809
- Static: 0, "0": "Static",
869
+ Hidden: 1, "1": "Hidden",
810
870
  /**
811
- * Relative to its normal position in the flow.
871
+ * Always display scrollbars for scrollable content
812
872
  */
813
- Relative: 1, "1": "Relative",
873
+ Scroll: 2, "2": "Scroll",
814
874
  /**
815
- * Removed from the flow and positioned relative to its containing block.
875
+ * Display scrollbars only when content overflows (internally maps to Scroll)
816
876
  */
817
- Absolute: 2, "2": "Absolute",
877
+ Auto: 3, "3": "Auto",
818
878
  });
819
879
 
820
880
  /**
821
- * Represents a rectangle defined by its edges.
881
+ * Position mode enumeration
822
882
  *
823
- * Used for padding, margin, properties.
883
+ * Controls how an element is positioned within its parent container.
884
+ * This corresponds to the CSS `position` property.
885
+ *
886
+ * @example
887
+ * ```typescript
888
+ * import { Position } from 'taffy-js';
889
+ *
890
+ * style.position = Position.Relative; // Normal document flow
891
+ * style.position = Position.Absolute; // Removed from flow, uses inset values
892
+ * ```
893
+ * @enum {0 | 1}
894
+ */
895
+ export const Position = Object.freeze({
896
+ /**
897
+ * Element participates in normal document flow
898
+ */
899
+ Relative: 0, "0": "Relative",
900
+ /**
901
+ * Element is positioned relative to its nearest positioned ancestor
902
+ */
903
+ Absolute: 1, "1": "Absolute",
904
+ });
905
+
906
+ /**
907
+ * CSS layout configuration for a node, including flexbox, sizing, spacing, and alignment properties.
908
+ *
909
+ * This class holds all CSS layout properties for a node. Create an instance with
910
+ * `new Style()` and configure properties before passing to `TaffyTree.newLeaf()`.
911
+ *
912
+ * @defaultValue
913
+ * When created, all properties are set to their CSS default values:
914
+ * - `display`: `Display.Block`
915
+ * - `position`: `Position.Relative`
916
+ * - `flexDirection`: `FlexDirection.Row`
917
+ * - `flexWrap`: `FlexWrap.NoWrap`
918
+ * - `flexGrow`: `0`
919
+ * - `flexShrink`: `1`
920
+ * - All alignment properties: `undefined` (use default behavior)
921
+ * - All dimensions: `"auto"`
922
+ * - All spacing: `0`
824
923
  */
825
- export class Rect {
924
+ export class Style {
925
+ static __wrap(ptr) {
926
+ ptr = ptr >>> 0;
927
+ const obj = Object.create(Style.prototype);
928
+ obj.__wbg_ptr = ptr;
929
+ StyleFinalization.register(obj, obj.__wbg_ptr, obj);
930
+ return obj;
931
+ }
826
932
  __destroy_into_raw() {
827
933
  const ptr = this.__wbg_ptr;
828
934
  this.__wbg_ptr = 0;
829
- RectFinalization.unregister(this);
935
+ StyleFinalization.unregister(this);
830
936
  return ptr;
831
937
  }
832
938
  free() {
833
939
  const ptr = this.__destroy_into_raw();
834
- wasm.__wbg_rect_free(ptr, 0);
940
+ wasm.__wbg_style_free(ptr, 0);
835
941
  }
836
942
  /**
837
- * The left edge value.
838
- * @returns {number}
943
+ * Gets the align-self property
944
+ *
945
+ * Overrides the parent's align-items for this specific element.
946
+ *
947
+ * @returns - The current [`AlignSelf`](JsAlignSelf) value (returns `Auto` if not set)
948
+ * @returns {AlignSelf | undefined}
839
949
  */
840
- get left() {
841
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
842
- return ret;
950
+ get alignSelf() {
951
+ const ret = wasm.style_alignSelf(this.__wbg_ptr);
952
+ return ret === 8 ? undefined : ret;
843
953
  }
844
954
  /**
845
- * The left edge value.
846
- * @param {number} arg0
955
+ * Gets the box sizing mode
956
+ *
957
+ * Determines whether padding and border are included in dimensions.
958
+ *
959
+ * @returns - The current [`BoxSizing`](JsBoxSizing) value
960
+ *
961
+ * @defaultValue `BoxSizing.BorderBox`
962
+ * @returns {BoxSizing}
847
963
  */
848
- set left(arg0) {
849
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
964
+ get boxSizing() {
965
+ const ret = wasm.style_boxSizing(this.__wbg_ptr);
966
+ return ret;
850
967
  }
851
968
  /**
852
- * The right edge value.
853
- * @returns {number}
969
+ * Gets the flex-basis
970
+ *
971
+ * The initial size of a flex item before growing/shrinking.
972
+ *
973
+ * @returns - A `Dimension` value (`number`, `\"{number}%\"`, or `\"auto\"`)
974
+ * @returns {Dimension}
854
975
  */
855
- get right() {
856
- const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
976
+ get flexBasis() {
977
+ const ret = wasm.style_flexBasis(this.__wbg_ptr);
857
978
  return ret;
858
979
  }
859
980
  /**
860
- * The right edge value.
861
- * @param {number} arg0
981
+ * Sets the border width
982
+ *
983
+ * @param val - A Rect object with LengthPercentage values
984
+ *
985
+ * @example
986
+ * ```typescript
987
+ * style.border = { left: 1, right: 1, top: 1, bottom: 1 };
988
+ * ```
989
+ * @param {Rect<LengthPercentage>} val
862
990
  */
863
- set right(arg0) {
864
- wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
991
+ set border(val) {
992
+ wasm.style_set_border(this.__wbg_ptr, val);
865
993
  }
866
994
  /**
867
- * The top edge value.
868
- * @returns {number}
995
+ * Sets the margin
996
+ *
997
+ * @param val - A Rect object with LengthPercentageAuto values
998
+ *
999
+ * @example
1000
+ * ```typescript
1001
+ * style.margin = { left: 10, right: 10, top: 5, bottom: 5 };
1002
+ * ```
1003
+ * @param {Rect<LengthPercentageAuto>} val
869
1004
  */
870
- get top() {
871
- const ret = wasm.__wbg_get_layout_width(this.__wbg_ptr);
872
- return ret;
1005
+ set margin(val) {
1006
+ wasm.style_set_margin(this.__wbg_ptr, val);
873
1007
  }
874
1008
  /**
875
- * The top edge value.
876
- * @param {number} arg0
1009
+ * Gets the align-items property
1010
+ *
1011
+ * Defines the default alignment for all children on the cross axis.
1012
+ *
1013
+ * @returns - The current [`AlignItems`](JsAlignItems) value, or `undefined` if not set
1014
+ * @returns {AlignItems | undefined}
877
1015
  */
878
- set top(arg0) {
879
- wasm.__wbg_set_layout_width(this.__wbg_ptr, arg0);
1016
+ get alignItems() {
1017
+ const ret = wasm.style_alignItems(this.__wbg_ptr);
1018
+ return ret === 7 ? undefined : ret;
880
1019
  }
881
1020
  /**
882
- * The bottom edge value.
1021
+ * Gets the flex shrink factor
1022
+ *
1023
+ * Determines how much the item shrinks relative to siblings when
1024
+ * there is insufficient space.
1025
+ *
1026
+ * @returns - The flex shrink factor (default: 1)
883
1027
  * @returns {number}
884
1028
  */
885
- get bottom() {
886
- const ret = wasm.__wbg_get_layout_height(this.__wbg_ptr);
1029
+ get flexShrink() {
1030
+ const ret = wasm.style_flexShrink(this.__wbg_ptr);
887
1031
  return ret;
888
1032
  }
889
1033
  /**
890
- * The bottom edge value.
891
- * @param {number} arg0
1034
+ * Sets the display mode
1035
+ *
1036
+ * @param val - The new display mode
1037
+ *
1038
+ *
1039
+ * @example
1040
+ *
1041
+ * ```typescript
1042
+ * style.display = Display.Flex;
1043
+ * ```
1044
+ * @param {Display} val
1045
+ */
1046
+ set display(val) {
1047
+ wasm.style_set_display(this.__wbg_ptr, val);
1048
+ }
1049
+ /**
1050
+ * Sets the padding
1051
+ *
1052
+ * @param val - A Rect object with LengthPercentage values
1053
+ *
1054
+ * @example
1055
+ * ```typescript
1056
+ * style.padding = { left: 20, right: 20, top: 10, bottom: 10 };
1057
+ * ```
1058
+ * @param {Rect<LengthPercentage>} val
1059
+ */
1060
+ set padding(val) {
1061
+ wasm.style_set_padding(this.__wbg_ptr, val);
1062
+ }
1063
+ /**
1064
+ * Gets the aspect ratio
1065
+ *
1066
+ * The ratio of width to height. Used to maintain proportions.
1067
+ *
1068
+ * @returns - The aspect ratio value, or `undefined` if not set
1069
+ * @returns {number | undefined}
892
1070
  */
893
- set bottom(arg0) {
894
- wasm.__wbg_set_layout_height(this.__wbg_ptr, arg0);
895
- }
896
- }
897
- if (Symbol.dispose) Rect.prototype[Symbol.dispose] = Rect.prototype.free;
898
-
899
- /**
900
- * Represents a size in 2D space.
901
- *
902
- * Used for width and height dimensions.
903
- */
904
- export class Size {
905
- __destroy_into_raw() {
906
- const ptr = this.__wbg_ptr;
907
- this.__wbg_ptr = 0;
908
- SizeFinalization.unregister(this);
909
- return ptr;
910
- }
911
- free() {
912
- const ptr = this.__destroy_into_raw();
913
- wasm.__wbg_size_free(ptr, 0);
1071
+ get aspectRatio() {
1072
+ const ret = wasm.style_aspectRatio(this.__wbg_ptr);
1073
+ return ret === 0x100000001 ? undefined : ret;
914
1074
  }
915
1075
  /**
916
- * The width dimension.
917
- * @returns {number}
918
- */
919
- get width() {
920
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
921
- return ret;
922
- }
923
- /**
924
- * The width dimension.
925
- * @param {number} arg0
1076
+ * Sets the maximum size constraints
1077
+ *
1078
+ * @param val - A Size object with maximum Dimension values
1079
+ *
1080
+ * @example
1081
+ * ```typescript
1082
+ * style.maxSize = { width: "auto", height: 500 };
1083
+ * ```
1084
+ * @param {Size<Dimension>} val
1085
+ */
1086
+ set maxSize(val) {
1087
+ wasm.style_set_maxSize(this.__wbg_ptr, val);
1088
+ }
1089
+ /**
1090
+ * Sets the minimum size constraints
1091
+ *
1092
+ * @param val - A Size object with minimum Dimension values
1093
+ *
1094
+ * @example
1095
+ * ```typescript
1096
+ * style.minSize = { width: 100, height: "auto" };
1097
+ * ```
1098
+ * @param {Size<Dimension>} val
1099
+ */
1100
+ set minSize(val) {
1101
+ wasm.style_set_minSize(this.__wbg_ptr, val);
1102
+ }
1103
+ /**
1104
+ * Sets the overflow behavior
1105
+ *
1106
+ * @param val - An object with `x` and `y` overflow values
1107
+ *
1108
+ * @example
1109
+ * ```typescript
1110
+ * style.overflow = { x: Overflow.Hidden, y: Overflow.Scroll };
1111
+ * ```
1112
+ * @param {Point<Overflow>} val
1113
+ */
1114
+ set overflow(val) {
1115
+ wasm.style_set_overflow(this.__wbg_ptr, val);
1116
+ }
1117
+ /**
1118
+ * Sets the position mode
1119
+ *
1120
+ * @param val - The new position mode
1121
+ *
1122
+ *
1123
+ * @example
1124
+ *
1125
+ * ```typescript
1126
+ * style.position = Position.Absolute;
1127
+ * style.inset = { left: 10, top: 10, right: "auto", bottom: "auto" };
1128
+ * ```
1129
+ * @param {Position} val
1130
+ */
1131
+ set position(val) {
1132
+ wasm.style_set_position(this.__wbg_ptr, val);
1133
+ }
1134
+ /**
1135
+ * Gets the align-content property
1136
+ *
1137
+ * Controls distribution of space between lines in a multi-line flex container.
1138
+ *
1139
+ * @returns - The current [`AlignContent`](JsAlignContent) value, or `undefined` if not set
1140
+ * @returns {AlignContent | undefined}
926
1141
  */
927
- set width(arg0) {
928
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
1142
+ get alignContent() {
1143
+ const ret = wasm.style_alignContent(this.__wbg_ptr);
1144
+ return ret === 9 ? undefined : ret;
929
1145
  }
930
1146
  /**
931
- * The height dimension.
932
- * @returns {number}
933
- */
934
- get height() {
935
- const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
1147
+ * Sets the flex grow factor
1148
+ *
1149
+ * @param val - The new flex grow factor (must be >= 0)
1150
+ *
1151
+ * @example
1152
+ * ```typescript
1153
+ * style.flexGrow = 2;
1154
+ * ```
1155
+ * @param {number} val
1156
+ */
1157
+ set flexGrow(val) {
1158
+ wasm.style_set_flexGrow(this.__wbg_ptr, val);
1159
+ }
1160
+ /**
1161
+ * Sets the flex wrap mode
1162
+ *
1163
+ * @param val - The new flex wrap mode
1164
+ *
1165
+ *
1166
+ * @example
1167
+ *
1168
+ * ```typescript
1169
+ * style.flexWrap = FlexWrap.Wrap;
1170
+ * ```
1171
+ * @param {FlexWrap} val
1172
+ */
1173
+ set flexWrap(val) {
1174
+ wasm.style_set_flexWrap(this.__wbg_ptr, val);
1175
+ }
1176
+ /**
1177
+ * Gets the flex direction
1178
+ *
1179
+ * Defines the main axis direction for flex items.
1180
+ *
1181
+ * @returns - The current [`FlexDirection`](JsFlexDirection) value
1182
+ *
1183
+ * @defaultValue - `FlexDirection.Row`
1184
+ * @returns {FlexDirection}
1185
+ */
1186
+ get flexDirection() {
1187
+ const ret = wasm.style_flexDirection(this.__wbg_ptr);
936
1188
  return ret;
937
1189
  }
938
1190
  /**
939
- * The height dimension.
940
- * @param {number} arg0
941
- */
942
- set height(arg0) {
943
- wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
944
- }
945
- }
946
- if (Symbol.dispose) Size.prototype[Symbol.dispose] = Size.prototype.free;
947
-
948
- /**
949
- * Style values for a node.
950
- *
951
- * This struct aggregates all layout styles that can be applied to a node.
952
- * Optional fields allow partial updates or default values.
953
- */
954
- export class Style {
955
- __destroy_into_raw() {
956
- const ptr = this.__wbg_ptr;
957
- this.__wbg_ptr = 0;
958
- StyleFinalization.unregister(this);
959
- return ptr;
960
- }
961
- free() {
962
- const ptr = this.__destroy_into_raw();
963
- wasm.__wbg_style_free(ptr, 0);
964
- }
965
- /**
966
- * The display mode of the node (e.g. Flex, Grid, None).
967
- * @returns {Display | undefined}
968
- */
969
- get display() {
970
- const ret = wasm.__wbg_get_style_display(this.__wbg_ptr);
971
- return ret === 4 ? undefined : ret;
972
- }
973
- /**
974
- * The display mode of the node (e.g. Flex, Grid, None).
975
- * @param {Display | null} [arg0]
1191
+ * Sets the align-self property
1192
+ *
1193
+ * @param val - The new align-self value, or `undefined`/`Auto` to inherit from parent
1194
+ *
1195
+ * @example
1196
+ * ```typescript
1197
+ * style.alignSelf = AlignSelf.Stretch;
1198
+ * ```
1199
+ * @param {AlignSelf | undefined} val
1200
+ */
1201
+ set alignSelf(val) {
1202
+ wasm.style_set_alignSelf(this.__wbg_ptr, val);
1203
+ }
1204
+ /**
1205
+ * Sets the box sizing mode
1206
+ *
1207
+ * @param val - The new box sizing mode
1208
+ *
1209
+ * @example
1210
+ * ```typescript
1211
+ * style.boxSizing = BoxSizing.ContentBox;
1212
+ * ```
1213
+ * @param {BoxSizing} val
1214
+ */
1215
+ set boxSizing(val) {
1216
+ wasm.style_set_boxSizing(this.__wbg_ptr, val);
1217
+ }
1218
+ /**
1219
+ * Sets the flex-basis
1220
+ *
1221
+ * @param val - The initial size as a Dimension
1222
+ *
1223
+ * @example
1224
+ * ```typescript
1225
+ * style.flexBasis = 100;
1226
+ * ```
1227
+ * @param {Dimension} val
1228
+ */
1229
+ set flexBasis(val) {
1230
+ wasm.style_set_flexBasis(this.__wbg_ptr, val);
1231
+ }
1232
+ /**
1233
+ * Gets the justify-content property
1234
+ *
1235
+ * Defines alignment and spacing of items along the main axis.
1236
+ *
1237
+ * @returns - The current [`JustifyContent`](JsJustifyContent) value, or `undefined` if not set
1238
+ * @returns {JustifyContent | undefined}
976
1239
  */
977
- set display(arg0) {
978
- wasm.__wbg_set_style_display(this.__wbg_ptr, isLikeNone(arg0) ? 4 : arg0);
1240
+ get justifyContent() {
1241
+ const ret = wasm.style_justifyContent(this.__wbg_ptr);
1242
+ return ret === 9 ? undefined : ret;
979
1243
  }
980
1244
  /**
981
- * The positioning strategy (e.g. Relative, Absolute).
982
- * @returns {Position | undefined}
983
- */
984
- get position() {
985
- const ret = wasm.__wbg_get_style_position(this.__wbg_ptr);
986
- return ret === 3 ? undefined : ret;
1245
+ * Sets the align-items property
1246
+ *
1247
+ * @param val - The new align-items value, or `undefined` to use default
1248
+ *
1249
+ * @example
1250
+ *
1251
+ * ```typescript
1252
+ * style.alignItems = AlignItems.Center;
1253
+ * ```
1254
+ * @param {AlignItems | undefined} val
1255
+ */
1256
+ set alignItems(val) {
1257
+ wasm.style_set_alignItems(this.__wbg_ptr, val);
1258
+ }
1259
+ /**
1260
+ * Sets the flex shrink factor
1261
+ *
1262
+ * @param val - The new flex shrink factor (must be >= 0)
1263
+ *
1264
+ * @example
1265
+ * ```typescript
1266
+ * style.flexShrink = 2;
1267
+ * ```
1268
+ * @param {number} val
1269
+ */
1270
+ set flexShrink(val) {
1271
+ wasm.style_set_flexShrink(this.__wbg_ptr, val);
1272
+ }
1273
+ /**
1274
+ * Sets the aspect ratio
1275
+ *
1276
+ * @param val - The new aspect ratio (width/height), or `undefined` to clear
1277
+ *
1278
+ * @example
1279
+ * ```typescript
1280
+ * style.aspectRatio = 16 / 9;
1281
+ * ```
1282
+ * @param {number | undefined} val
1283
+ */
1284
+ set aspectRatio(val) {
1285
+ wasm.style_set_aspectRatio(this.__wbg_ptr, val);
1286
+ }
1287
+ /**
1288
+ * Sets the align-content property
1289
+ *
1290
+ * @param val - The new align-content value, or `undefined` to use default
1291
+ *
1292
+ * @example
1293
+ * ```typescript
1294
+ * style.alignContent = AlignContent.SpaceBetween;
1295
+ * ```
1296
+ * @param {AlignContent | undefined} val
1297
+ */
1298
+ set alignContent(val) {
1299
+ wasm.style_set_alignContent(this.__wbg_ptr, val);
1300
+ }
1301
+ /**
1302
+ * Sets the flex direction
1303
+ *
1304
+ * @param val - The new flex direction
1305
+ *
1306
+ *
1307
+ * @example
1308
+ *
1309
+ * ```typescript
1310
+ * style.flexDirection = FlexDirection.Column;
1311
+ * ```
1312
+ * @param {FlexDirection} val
1313
+ */
1314
+ set flexDirection(val) {
1315
+ wasm.style_set_flexDirection(this.__wbg_ptr, val);
1316
+ }
1317
+ /**
1318
+ * Sets the justify-content property
1319
+ *
1320
+ * @param val - The new justify-content value, or `undefined` to use default
1321
+ *
1322
+ * @example
1323
+ * ```typescript
1324
+ * style.justifyContent = JustifyContent.Center;
1325
+ * ```
1326
+ * @param {JustifyContent | undefined} val
1327
+ */
1328
+ set justifyContent(val) {
1329
+ wasm.style_set_justifyContent(this.__wbg_ptr, val);
1330
+ }
1331
+ /**
1332
+ * Gets the gap
1333
+ *
1334
+ * Spacing between flex/grid items.
1335
+ *
1336
+ * @returns - A `Size<LengthPercentage>` with column (width) and row (height) gaps
1337
+ * @returns {Size<LengthPercentage>}
1338
+ */
1339
+ get gap() {
1340
+ const ret = wasm.style_gap(this.__wbg_ptr);
1341
+ return ret;
987
1342
  }
988
1343
  /**
989
- * The positioning strategy (e.g. Relative, Absolute).
990
- * @param {Position | null} [arg0]
991
- */
992
- set position(arg0) {
993
- wasm.__wbg_set_style_position(this.__wbg_ptr, isLikeNone(arg0) ? 3 : arg0);
1344
+ * Creates a new Style instance with default values
1345
+ *
1346
+ * @returns - A new `Style` object with all properties set to CSS defaults
1347
+ *
1348
+ * @example
1349
+ * ```typescript
1350
+ * const style = new Style();
1351
+ * console.log(style.display); // Display.Block
1352
+ * ```
1353
+ */
1354
+ constructor() {
1355
+ const ret = wasm.style_new();
1356
+ this.__wbg_ptr = ret >>> 0;
1357
+ StyleFinalization.register(this, this.__wbg_ptr, this);
1358
+ return this;
994
1359
  }
995
1360
  /**
996
- * The width of the node.
997
- * @returns {Dimension | undefined}
1361
+ * Gets the size (width and height)
1362
+ *
1363
+ * @returns - A `Size<Dimension>` object with `width` and `height` properties
1364
+ * @returns {Size<Dimension>}
998
1365
  */
999
- get width() {
1000
- const ret = wasm.__wbg_get_style_width(this.__wbg_ptr);
1001
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1366
+ get size() {
1367
+ const ret = wasm.style_size(this.__wbg_ptr);
1368
+ return ret;
1002
1369
  }
1003
1370
  /**
1004
- * The width of the node.
1005
- * @param {Dimension | null} [arg0]
1371
+ * Gets the inset
1372
+ *
1373
+ * Positioning offsets for absolutely positioned elements.
1374
+ *
1375
+ * @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom offsets
1376
+ * @returns {Rect<LengthPercentageAuto>}
1006
1377
  */
1007
- set width(arg0) {
1008
- let ptr0 = 0;
1009
- if (!isLikeNone(arg0)) {
1010
- _assertClass(arg0, Dimension);
1011
- ptr0 = arg0.__destroy_into_raw();
1012
- }
1013
- wasm.__wbg_set_style_width(this.__wbg_ptr, ptr0);
1378
+ get inset() {
1379
+ const ret = wasm.style_inset(this.__wbg_ptr);
1380
+ return ret;
1014
1381
  }
1015
1382
  /**
1016
- * The height of the node.
1017
- * @returns {Dimension | undefined}
1383
+ * Gets the border width
1384
+ *
1385
+ * Width of the element's border on each side.
1386
+ *
1387
+ * @returns - A `Rect<LengthPercentage>` with left, right, top, bottom border widths
1388
+ * @returns {Rect<LengthPercentage>}
1018
1389
  */
1019
- get height() {
1020
- const ret = wasm.__wbg_get_style_height(this.__wbg_ptr);
1021
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1390
+ get border() {
1391
+ const ret = wasm.style_border(this.__wbg_ptr);
1392
+ return ret;
1022
1393
  }
1023
1394
  /**
1024
- * The height of the node.
1025
- * @param {Dimension | null} [arg0]
1395
+ * Gets the margin
1396
+ *
1397
+ * Outer spacing around the element.
1398
+ *
1399
+ * @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom margins
1400
+ * @returns {Rect<LengthPercentageAuto>}
1026
1401
  */
1027
- set height(arg0) {
1028
- let ptr0 = 0;
1029
- if (!isLikeNone(arg0)) {
1030
- _assertClass(arg0, Dimension);
1031
- ptr0 = arg0.__destroy_into_raw();
1032
- }
1033
- wasm.__wbg_set_style_height(this.__wbg_ptr, ptr0);
1402
+ get margin() {
1403
+ const ret = wasm.style_margin(this.__wbg_ptr);
1404
+ return ret;
1034
1405
  }
1035
1406
  /**
1036
- * The minimum width of the node.
1037
- * @returns {Dimension | undefined}
1407
+ * Gets the display mode
1408
+ *
1409
+ * Determines the layout algorithm used for this element and its children.
1410
+ *
1411
+ * @returns - The current [`Display`](JsDisplay) value
1412
+ *
1413
+ * @defaultValue - `Display.Block`
1414
+ * @returns {Display}
1038
1415
  */
1039
- get min_width() {
1040
- const ret = wasm.__wbg_get_style_min_width(this.__wbg_ptr);
1041
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1416
+ get display() {
1417
+ const ret = wasm.style_display(this.__wbg_ptr);
1418
+ return ret;
1042
1419
  }
1043
1420
  /**
1044
- * The minimum width of the node.
1045
- * @param {Dimension | null} [arg0]
1421
+ * Gets the padding
1422
+ *
1423
+ * Inner spacing between the element's border and content.
1424
+ *
1425
+ * @returns - A `Rect<LengthPercentage>` with left, right, top, bottom padding
1426
+ * @returns {Rect<LengthPercentage>}
1046
1427
  */
1047
- set min_width(arg0) {
1048
- let ptr0 = 0;
1049
- if (!isLikeNone(arg0)) {
1050
- _assertClass(arg0, Dimension);
1051
- ptr0 = arg0.__destroy_into_raw();
1052
- }
1053
- wasm.__wbg_set_style_min_width(this.__wbg_ptr, ptr0);
1428
+ get padding() {
1429
+ const ret = wasm.style_padding(this.__wbg_ptr);
1430
+ return ret;
1054
1431
  }
1055
1432
  /**
1056
- * The minimum height of the node.
1057
- * @returns {Dimension | undefined}
1433
+ * Sets the gap
1434
+ *
1435
+ * @param val - A Size object with LengthPercentage gap values
1436
+ *
1437
+ * @example
1438
+ * ```typescript
1439
+ * style.gap = { width: 10, height: 10 };
1440
+ * ```
1441
+ * @param {Size<LengthPercentage>} val
1058
1442
  */
1059
- get min_height() {
1060
- const ret = wasm.__wbg_get_style_min_height(this.__wbg_ptr);
1061
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1443
+ set gap(val) {
1444
+ wasm.style_set_gap(this.__wbg_ptr, val);
1062
1445
  }
1063
1446
  /**
1064
- * The minimum height of the node.
1065
- * @param {Dimension | null} [arg0]
1447
+ * Gets the maximum size constraints
1448
+ *
1449
+ * @returns - A `Size<Dimension>` object with maximum width and height
1450
+ * @returns {Size<Dimension>}
1066
1451
  */
1067
- set min_height(arg0) {
1068
- let ptr0 = 0;
1069
- if (!isLikeNone(arg0)) {
1070
- _assertClass(arg0, Dimension);
1071
- ptr0 = arg0.__destroy_into_raw();
1072
- }
1073
- wasm.__wbg_set_style_min_height(this.__wbg_ptr, ptr0);
1452
+ get maxSize() {
1453
+ const ret = wasm.style_maxSize(this.__wbg_ptr);
1454
+ return ret;
1074
1455
  }
1075
1456
  /**
1076
- * The maximum width of the node.
1077
- * @returns {Dimension | undefined}
1457
+ * Gets the minimum size constraints
1458
+ *
1459
+ * @returns - A `Size<Dimension>` object with minimum width and height
1460
+ * @returns {Size<Dimension>}
1078
1461
  */
1079
- get max_width() {
1080
- const ret = wasm.__wbg_get_style_max_width(this.__wbg_ptr);
1081
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1462
+ get minSize() {
1463
+ const ret = wasm.style_minSize(this.__wbg_ptr);
1464
+ return ret;
1082
1465
  }
1083
1466
  /**
1084
- * The maximum width of the node.
1085
- * @param {Dimension | null} [arg0]
1467
+ * Gets the overflow behavior
1468
+ *
1469
+ * Controls how content that exceeds the container is handled.
1470
+ *
1471
+ * @returns - A `Point<Overflow>` with `x` and `y` overflow settings
1472
+ * @returns {Point<Overflow>}
1086
1473
  */
1087
- set max_width(arg0) {
1088
- let ptr0 = 0;
1089
- if (!isLikeNone(arg0)) {
1090
- _assertClass(arg0, Dimension);
1091
- ptr0 = arg0.__destroy_into_raw();
1092
- }
1093
- wasm.__wbg_set_style_max_width(this.__wbg_ptr, ptr0);
1474
+ get overflow() {
1475
+ const ret = wasm.style_overflow(this.__wbg_ptr);
1476
+ return ret;
1094
1477
  }
1095
1478
  /**
1096
- * The maximum height of the node.
1097
- * @returns {Dimension | undefined}
1479
+ * Gets the position mode
1480
+ *
1481
+ * Determines how the element is positioned within its parent.
1482
+ *
1483
+ * @returns - The current [`Position`](JsPosition) value
1484
+ *
1485
+ * @defaultValue - `Position.Relative`
1486
+ * @returns {Position}
1098
1487
  */
1099
- get max_height() {
1100
- const ret = wasm.__wbg_get_style_max_height(this.__wbg_ptr);
1101
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1488
+ get position() {
1489
+ const ret = wasm.style_position(this.__wbg_ptr);
1490
+ return ret;
1102
1491
  }
1103
1492
  /**
1104
- * The maximum height of the node.
1105
- * @param {Dimension | null} [arg0]
1493
+ * Sets the size (width and height)
1494
+ *
1495
+ * @param val - A Size object with Dimension values
1496
+ *
1497
+ * @example
1498
+ * ```typescript
1499
+ * style.size = { width: 200, height: "100%" };
1500
+ * ```
1501
+ * @param {Size<Dimension>} val
1106
1502
  */
1107
- set max_height(arg0) {
1108
- let ptr0 = 0;
1109
- if (!isLikeNone(arg0)) {
1110
- _assertClass(arg0, Dimension);
1111
- ptr0 = arg0.__destroy_into_raw();
1112
- }
1113
- wasm.__wbg_set_style_max_height(this.__wbg_ptr, ptr0);
1503
+ set size(val) {
1504
+ wasm.style_set_size(this.__wbg_ptr, val);
1114
1505
  }
1115
1506
  /**
1116
- * The offset from the left edge (used with Position::Absolute/Relative).
1117
- * @returns {Dimension | undefined}
1507
+ * Gets the flex grow factor
1508
+ *
1509
+ * Determines how much the item grows relative to siblings when
1510
+ * there is extra space available.
1511
+ *
1512
+ * @returns - The flex grow factor (default: 0)
1513
+ * @returns {number}
1118
1514
  */
1119
- get left() {
1120
- const ret = wasm.__wbg_get_style_left(this.__wbg_ptr);
1121
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1515
+ get flexGrow() {
1516
+ const ret = wasm.style_flexGrow(this.__wbg_ptr);
1517
+ return ret;
1122
1518
  }
1123
1519
  /**
1124
- * The offset from the left edge (used with Position::Absolute/Relative).
1125
- * @param {Dimension | null} [arg0]
1520
+ * Gets the flex wrap mode
1521
+ *
1522
+ * Controls whether flex items wrap to new lines.
1523
+ *
1524
+ * @returns - The current [`FlexWrap`](JsFlexWrap) value
1525
+ *
1526
+ * @defaultValue - `FlexWrap.NoWrap`
1527
+ * @returns {FlexWrap}
1126
1528
  */
1127
- set left(arg0) {
1128
- let ptr0 = 0;
1129
- if (!isLikeNone(arg0)) {
1130
- _assertClass(arg0, Dimension);
1131
- ptr0 = arg0.__destroy_into_raw();
1132
- }
1133
- wasm.__wbg_set_style_left(this.__wbg_ptr, ptr0);
1529
+ get flexWrap() {
1530
+ const ret = wasm.style_flexWrap(this.__wbg_ptr);
1531
+ return ret;
1134
1532
  }
1135
1533
  /**
1136
- * The offset from the right edge.
1137
- * @returns {Dimension | undefined}
1534
+ * Sets the inset
1535
+ *
1536
+ * @param val - A Rect object with LengthPercentageAuto offset values
1537
+ *
1538
+ * @example
1539
+ * ```typescript
1540
+ * style.position = Position.Absolute;
1541
+ * style.inset = { left: 0, top: 0, right: "auto", bottom: "auto" };
1542
+ * ```
1543
+ * @param {Rect<LengthPercentageAuto>} val
1138
1544
  */
1139
- get right() {
1140
- const ret = wasm.__wbg_get_style_right(this.__wbg_ptr);
1141
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1545
+ set inset(val) {
1546
+ wasm.style_set_inset(this.__wbg_ptr, val);
1142
1547
  }
1143
- /**
1144
- * The offset from the right edge.
1145
- * @param {Dimension | null} [arg0]
1146
- */
1147
- set right(arg0) {
1148
- let ptr0 = 0;
1149
- if (!isLikeNone(arg0)) {
1150
- _assertClass(arg0, Dimension);
1151
- ptr0 = arg0.__destroy_into_raw();
1152
- }
1153
- wasm.__wbg_set_style_right(this.__wbg_ptr, ptr0);
1548
+ }
1549
+ if (Symbol.dispose) Style.prototype[Symbol.dispose] = Style.prototype.free;
1550
+
1551
+ /**
1552
+ * Error class thrown when a Taffy operation fails, containing a human-readable error message.
1553
+ *
1554
+ * This class wraps the native [`taffy::TaffyError`] type and exposes it to JavaScript
1555
+ * with a readable error message. It is thrown as a JavaScript exception on failure.
1556
+ *
1557
+ * @example
1558
+ * ```typescript
1559
+ * try {
1560
+ * tree.remove(node);
1561
+ * } catch (e) {
1562
+ * if (e instanceof TaffyError) {
1563
+ * console.error(e.message);
1564
+ * }
1565
+ * }
1566
+ * ```
1567
+ *
1568
+ * @remarks
1569
+ * The underlying Taffy errors include:
1570
+ * - `InvalidInputNode`: Node ID doesn't exist in the tree
1571
+ * - `InvalidParentNode`: Specified parent node doesn't exist
1572
+ * - `ChildIndexOutOfBounds`: Child index exceeds available children
1573
+ */
1574
+ export class TaffyError {
1575
+ static __wrap(ptr) {
1576
+ ptr = ptr >>> 0;
1577
+ const obj = Object.create(TaffyError.prototype);
1578
+ obj.__wbg_ptr = ptr;
1579
+ TaffyErrorFinalization.register(obj, obj.__wbg_ptr, obj);
1580
+ return obj;
1154
1581
  }
1155
- /**
1156
- * The offset from the top edge.
1157
- * @returns {Dimension | undefined}
1158
- */
1159
- get top() {
1160
- const ret = wasm.__wbg_get_style_top(this.__wbg_ptr);
1161
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1582
+ __destroy_into_raw() {
1583
+ const ptr = this.__wbg_ptr;
1584
+ this.__wbg_ptr = 0;
1585
+ TaffyErrorFinalization.unregister(this);
1586
+ return ptr;
1162
1587
  }
1163
- /**
1164
- * The offset from the top edge.
1165
- * @param {Dimension | null} [arg0]
1166
- */
1167
- set top(arg0) {
1168
- let ptr0 = 0;
1169
- if (!isLikeNone(arg0)) {
1170
- _assertClass(arg0, Dimension);
1171
- ptr0 = arg0.__destroy_into_raw();
1588
+ free() {
1589
+ const ptr = this.__destroy_into_raw();
1590
+ wasm.__wbg_taffyerror_free(ptr, 0);
1591
+ }
1592
+ /**
1593
+ * Gets the human-readable error message
1594
+ *
1595
+ * @returns - A string describing what went wrong.
1596
+ *
1597
+ * @remarks
1598
+ * Examples:
1599
+ * - "Node with id 1234 is not present in the Taffy tree"
1600
+ * - "Index 5 is out of bounds for node with 3 children"
1601
+ * @returns {string}
1602
+ */
1603
+ get message() {
1604
+ let deferred1_0;
1605
+ let deferred1_1;
1606
+ try {
1607
+ const ret = wasm.taffyerror_message(this.__wbg_ptr);
1608
+ deferred1_0 = ret[0];
1609
+ deferred1_1 = ret[1];
1610
+ return getStringFromWasm0(ret[0], ret[1]);
1611
+ } finally {
1612
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1172
1613
  }
1173
- wasm.__wbg_set_style_top(this.__wbg_ptr, ptr0);
1174
1614
  }
1175
- /**
1176
- * The offset from the bottom edge.
1177
- * @returns {Dimension | undefined}
1178
- */
1179
- get bottom() {
1180
- const ret = wasm.__wbg_get_style_bottom(this.__wbg_ptr);
1181
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1182
- }
1183
- /**
1184
- * The offset from the bottom edge.
1185
- * @param {Dimension | null} [arg0]
1186
- */
1187
- set bottom(arg0) {
1188
- let ptr0 = 0;
1189
- if (!isLikeNone(arg0)) {
1190
- _assertClass(arg0, Dimension);
1191
- ptr0 = arg0.__destroy_into_raw();
1192
- }
1193
- wasm.__wbg_set_style_bottom(this.__wbg_ptr, ptr0);
1615
+ }
1616
+ if (Symbol.dispose) TaffyError.prototype[Symbol.dispose] = TaffyError.prototype.free;
1617
+
1618
+ /**
1619
+ * The main layout tree class for creating nodes, computing layouts, and managing a tree of styled elements.
1620
+ *
1621
+ * TaffyTree is the entry point for the Taffy layout engine. It manages
1622
+ * a tree of nodes and computes their layouts using CSS Flexbox and Grid algorithms.
1623
+ */
1624
+ export class TaffyTree {
1625
+ static __wrap(ptr) {
1626
+ ptr = ptr >>> 0;
1627
+ const obj = Object.create(TaffyTree.prototype);
1628
+ obj.__wbg_ptr = ptr;
1629
+ TaffyTreeFinalization.register(obj, obj.__wbg_ptr, obj);
1630
+ return obj;
1194
1631
  }
1195
- /**
1196
- * The margin on the left side.
1197
- * @returns {Dimension | undefined}
1198
- */
1199
- get margin_left() {
1200
- const ret = wasm.__wbg_get_style_margin_left(this.__wbg_ptr);
1201
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1632
+ __destroy_into_raw() {
1633
+ const ptr = this.__wbg_ptr;
1634
+ this.__wbg_ptr = 0;
1635
+ TaffyTreeFinalization.unregister(this);
1636
+ return ptr;
1202
1637
  }
1203
- /**
1204
- * The margin on the left side.
1205
- * @param {Dimension | null} [arg0]
1206
- */
1207
- set margin_left(arg0) {
1208
- let ptr0 = 0;
1209
- if (!isLikeNone(arg0)) {
1210
- _assertClass(arg0, Dimension);
1211
- ptr0 = arg0.__destroy_into_raw();
1638
+ free() {
1639
+ const ptr = this.__destroy_into_raw();
1640
+ wasm.__wbg_taffytree_free(ptr, 0);
1641
+ }
1642
+ /**
1643
+ * Marks a node as dirty (requiring re-layout)
1644
+ *
1645
+ * Use this when a node's content has changed but its style hasn't.
1646
+ * For example, when text content changes and needs remeasuring.
1647
+ *
1648
+ * @param node - The node ID to mark dirty
1649
+ *
1650
+ * @throws `TaffyError` if the node does not exist
1651
+ *
1652
+ * @example
1653
+ * ```typescript
1654
+ * // After updating text content
1655
+ * tree.setNodeContext(nodeId, { text: "Updated text" });
1656
+ * tree.markDirty(nodeId);
1657
+ * tree.computeLayout(rootId, availableSpace);
1658
+ * ```
1659
+ * @param {bigint} node
1660
+ */
1661
+ markDirty(node) {
1662
+ const ret = wasm.taffytree_markDirty(this.__wbg_ptr, node);
1663
+ if (ret[1]) {
1664
+ throw takeFromExternrefTable0(ret[0]);
1212
1665
  }
1213
- wasm.__wbg_set_style_margin_left(this.__wbg_ptr, ptr0);
1214
1666
  }
1215
1667
  /**
1216
- * The margin on the right side.
1217
- * @returns {Dimension | undefined}
1668
+ * Prints the tree structure to the console (for debugging)
1669
+ *
1670
+ * Outputs a text representation of the tree structure starting from
1671
+ * the given node. Useful for debugging layout issues.
1672
+ *
1673
+ * @param node - The root node ID to print from
1674
+ *
1675
+ * @example
1676
+ * ```typescript
1677
+ * tree.printTree(rootId);
1678
+ * // Output appears in browser console
1679
+ * ```
1680
+ * @param {bigint} node
1681
+ */
1682
+ printTree(node) {
1683
+ wasm.taffytree_printTree(this.__wbg_ptr, node);
1684
+ }
1685
+ /**
1686
+ * Gets the number of children of a node
1687
+ *
1688
+ * @param parent - The parent node ID
1689
+ *
1690
+ * @returns - The number of direct children
1691
+ *
1692
+ * @throws `TaffyError` if the node does not exist
1693
+ *
1694
+ * @example
1695
+ * ```typescript
1696
+ * const count: number = tree.childCount(parentId);
1697
+ * ```
1698
+ * @param {bigint} parent
1699
+ * @returns {number}
1218
1700
  */
1219
- get margin_right() {
1220
- const ret = wasm.__wbg_get_style_margin_right(this.__wbg_ptr);
1221
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1701
+ childCount(parent) {
1702
+ const ret = wasm.taffytree_childCount(this.__wbg_ptr, parent);
1703
+ return ret >>> 0;
1222
1704
  }
1223
1705
  /**
1224
- * The margin on the right side.
1225
- * @param {Dimension | null} [arg0]
1226
- */
1227
- set margin_right(arg0) {
1228
- let ptr0 = 0;
1229
- if (!isLikeNone(arg0)) {
1230
- _assertClass(arg0, Dimension);
1231
- ptr0 = arg0.__destroy_into_raw();
1706
+ * Removes a specific child from a parent
1707
+ *
1708
+ * @param parent - The parent node ID
1709
+ * @param child - The child node ID to remove
1710
+ *
1711
+ * @returns - The removed child ID (`bigint`)
1712
+ *
1713
+ * @throws `TaffyError` if the parent or child node does not exist
1714
+ *
1715
+ * @example
1716
+ * ```typescript
1717
+ * tree.removeChild(parentId, childId);
1718
+ * ```
1719
+ * @param {bigint} parent
1720
+ * @param {bigint} child
1721
+ * @returns {bigint}
1722
+ */
1723
+ removeChild(parent, child) {
1724
+ const ret = wasm.taffytree_removeChild(this.__wbg_ptr, parent, child);
1725
+ if (ret[2]) {
1726
+ throw takeFromExternrefTable0(ret[1]);
1232
1727
  }
1233
- wasm.__wbg_set_style_margin_right(this.__wbg_ptr, ptr0);
1234
- }
1235
- /**
1236
- * The margin on the top side.
1237
- * @returns {Dimension | undefined}
1238
- */
1239
- get margin_top() {
1240
- const ret = wasm.__wbg_get_style_margin_top(this.__wbg_ptr);
1241
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1242
- }
1243
- /**
1244
- * The margin on the top side.
1245
- * @param {Dimension | null} [arg0]
1246
- */
1247
- set margin_top(arg0) {
1248
- let ptr0 = 0;
1249
- if (!isLikeNone(arg0)) {
1250
- _assertClass(arg0, Dimension);
1251
- ptr0 = arg0.__destroy_into_raw();
1728
+ return BigInt.asUintN(64, ret[0]);
1729
+ }
1730
+ /**
1731
+ * Replaces all children of a node
1732
+ *
1733
+ * Any existing children are removed and replaced with the new array.
1734
+ *
1735
+ * @param parent - The parent node ID
1736
+ * @param children - Array of new child node IDs
1737
+ *
1738
+ * @throws `TaffyError` if the parent node does not exist
1739
+ *
1740
+ * @example
1741
+ * ```typescript
1742
+ * const children = BigUint64Array.from([child1, child2, child3]);
1743
+ * tree.setChildren(parentId, children);
1744
+ * ```
1745
+ * @param {bigint} parent
1746
+ * @param {BigUint64Array} children
1747
+ */
1748
+ setChildren(parent, children) {
1749
+ const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
1750
+ const len0 = WASM_VECTOR_LEN;
1751
+ const ret = wasm.taffytree_setChildren(this.__wbg_ptr, parent, ptr0, len0);
1752
+ if (ret[1]) {
1753
+ throw takeFromExternrefTable0(ret[0]);
1252
1754
  }
1253
- wasm.__wbg_set_style_margin_top(this.__wbg_ptr, ptr0);
1254
1755
  }
1255
1756
  /**
1256
- * The margin on the bottom side.
1257
- * @returns {Dimension | undefined}
1258
- */
1259
- get margin_bottom() {
1260
- const ret = wasm.__wbg_get_style_margin_bottom(this.__wbg_ptr);
1261
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1262
- }
1263
- /**
1264
- * The margin on the bottom side.
1265
- * @param {Dimension | null} [arg0]
1266
- */
1267
- set margin_bottom(arg0) {
1268
- let ptr0 = 0;
1269
- if (!isLikeNone(arg0)) {
1270
- _assertClass(arg0, Dimension);
1271
- ptr0 = arg0.__destroy_into_raw();
1757
+ * Creates a new TaffyTree with pre-allocated capacity
1758
+ *
1759
+ * Use this when you know approximately how many nodes will be in the tree.
1760
+ * This can improve performance by reducing memory reallocations.
1761
+ *
1762
+ * @param capacity - The number of nodes to pre-allocate space for
1763
+ *
1764
+ * @example
1765
+ * ```typescript
1766
+ * const tree: TaffyTree = TaffyTree.withCapacity(1000);
1767
+ * ```
1768
+ * @param {number} capacity
1769
+ * @returns {TaffyTree}
1770
+ */
1771
+ static withCapacity(capacity) {
1772
+ const ret = wasm.taffytree_withCapacity(capacity);
1773
+ return TaffyTree.__wrap(ret);
1774
+ }
1775
+ /**
1776
+ * Computes the layout for a subtree
1777
+ *
1778
+ * This is the main layout computation method. Call this on the root node
1779
+ * to compute layouts for all nodes in the tree.
1780
+ *
1781
+ * @param node - The root node ID to compute layout for
1782
+ * @param available_space - The available space constraints
1783
+ *
1784
+ * @example
1785
+ * ```typescript
1786
+ * // Fixed size container
1787
+ * { width: 800, height: 600 }
1788
+ *
1789
+ * // Flexible width, fixed height
1790
+ * { width: "MaxContent", height: 600 }
1791
+ *
1792
+ * // Minimum content size
1793
+ * { width: "MinContent", height: "MinContent" }
1794
+ * ```
1795
+ *
1796
+ * @throws `TaffyError` if the node does not exist or available space is invalid
1797
+ *
1798
+ * @example
1799
+ * ```typescript
1800
+ * tree.computeLayout(rootId, { width: 800, height: 600 });
1801
+ * ```
1802
+ * @param {bigint} node
1803
+ * @param {Size<AvailableSpace>} available_space
1804
+ */
1805
+ computeLayout(node, available_space) {
1806
+ const ret = wasm.taffytree_computeLayout(this.__wbg_ptr, node, available_space);
1807
+ if (ret[1]) {
1808
+ throw takeFromExternrefTable0(ret[0]);
1272
1809
  }
1273
- wasm.__wbg_set_style_margin_bottom(this.__wbg_ptr, ptr0);
1274
1810
  }
1275
1811
  /**
1276
- * The padding on the left side.
1277
- * @returns {Dimension | undefined}
1278
- */
1279
- get padding_left() {
1280
- const ret = wasm.__wbg_get_style_padding_left(this.__wbg_ptr);
1281
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1282
- }
1283
- /**
1284
- * The padding on the left side.
1285
- * @param {Dimension | null} [arg0]
1812
+ * Enables rounding of layout values to whole pixels
1813
+ *
1814
+ * When enabled (default), computed layout values like position and size
1815
+ * are rounded to the nearest integer. This prevents sub-pixel rendering
1816
+ * issues in most rendering contexts.
1817
+ *
1818
+ * @example
1819
+ * ```typescript
1820
+ * tree.enableRounding();
1821
+ * ```
1822
+ */
1823
+ enableRounding() {
1824
+ wasm.taffytree_enableRounding(this.__wbg_ptr);
1825
+ }
1826
+ /**
1827
+ * Disables rounding of layout values
1828
+ *
1829
+ * When disabled, computed layout values retain their fractional precision.
1830
+ * Use this when you need sub-pixel accuracy or when performing custom
1831
+ * rounding.
1832
+ *
1833
+ * @example
1834
+ * ```typescript
1835
+ * tree.disableRounding();
1836
+ * const layout = tree.getLayout(node);
1837
+ * console.log(layout.x);
1838
+ * ```
1839
+ */
1840
+ disableRounding() {
1841
+ wasm.taffytree_disableRounding(this.__wbg_ptr);
1842
+ }
1843
+ /**
1844
+ * Gets the context value for a node
1845
+ *
1846
+ * @param node - The node ID
1847
+ *
1848
+ * @returns - The attached context value, or `undefined` if none is set
1849
+ *
1850
+ * @example
1851
+ * ```typescript
1852
+ * interface Context { text: string };
1853
+ * const context = tree.getNodeContext(nodeId) as Context | undefined;
1854
+ * if (context) {
1855
+ * console.log(context.text);
1856
+ * }
1857
+ * ```
1858
+ * @param {bigint} node
1859
+ * @returns {any}
1286
1860
  */
1287
- set padding_left(arg0) {
1288
- let ptr0 = 0;
1289
- if (!isLikeNone(arg0)) {
1290
- _assertClass(arg0, Dimension);
1291
- ptr0 = arg0.__destroy_into_raw();
1861
+ getNodeContext(node) {
1862
+ const ret = wasm.taffytree_getNodeContext(this.__wbg_ptr, node);
1863
+ if (ret[2]) {
1864
+ throw takeFromExternrefTable0(ret[1]);
1292
1865
  }
1293
- wasm.__wbg_set_style_padding_left(this.__wbg_ptr, ptr0);
1294
- }
1295
- /**
1296
- * The padding on the right side.
1297
- * @returns {Dimension | undefined}
1298
- */
1299
- get padding_right() {
1300
- const ret = wasm.__wbg_get_style_padding_right(this.__wbg_ptr);
1301
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1866
+ return takeFromExternrefTable0(ret[0]);
1302
1867
  }
1303
1868
  /**
1304
- * The padding on the right side.
1305
- * @param {Dimension | null} [arg0]
1306
- */
1307
- set padding_right(arg0) {
1308
- let ptr0 = 0;
1309
- if (!isLikeNone(arg0)) {
1310
- _assertClass(arg0, Dimension);
1311
- ptr0 = arg0.__destroy_into_raw();
1869
+ * Sets a context value for a node
1870
+ *
1871
+ * The context can be any JavaScript value and is passed to the measure
1872
+ * function during layout computation.
1873
+ *
1874
+ * @param node - The node ID
1875
+ * @param context - Any JavaScript value to attach
1876
+ *
1877
+ * @throws `TaffyError` if the node does not exist
1878
+ *
1879
+ * @example
1880
+ * ```typescript
1881
+ * interface Context { text: string };
1882
+ * tree.setNodeContext(nodeId, { text: "Updated text" } as Context);
1883
+ * ```
1884
+ * @param {bigint} node
1885
+ * @param {any} context
1886
+ */
1887
+ setNodeContext(node, context) {
1888
+ const ret = wasm.taffytree_setNodeContext(this.__wbg_ptr, node, context);
1889
+ if (ret[1]) {
1890
+ throw takeFromExternrefTable0(ret[0]);
1312
1891
  }
1313
- wasm.__wbg_set_style_padding_right(this.__wbg_ptr, ptr0);
1314
1892
  }
1315
1893
  /**
1316
- * The padding on the top side.
1317
- * @returns {Dimension | undefined}
1894
+ * Gets the total number of nodes in the tree
1895
+ *
1896
+ * @returns - The total count of all nodes
1897
+ *
1898
+ * @example
1899
+ * ```typescript
1900
+ * const count: number = tree.totalNodeCount();
1901
+ * ```
1902
+ * @returns {number}
1318
1903
  */
1319
- get padding_top() {
1320
- const ret = wasm.__wbg_get_style_padding_top(this.__wbg_ptr);
1321
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1904
+ totalNodeCount() {
1905
+ const ret = wasm.taffytree_totalNodeCount(this.__wbg_ptr);
1906
+ return ret >>> 0;
1322
1907
  }
1323
1908
  /**
1324
- * The padding on the top side.
1325
- * @param {Dimension | null} [arg0]
1909
+ * Gets the unrounded (fractional) layout for a node
1910
+ *
1911
+ * Returns the raw computed values before any rounding is applied.
1912
+ * Useful when you need sub-pixel precision.
1913
+ *
1914
+ * @param node - The node ID
1915
+ *
1916
+ * @returns - The unrounded `Layout`
1917
+ *
1918
+ * @example
1919
+ * ```typescript
1920
+ * const layout: Layout = tree.unroundedLayout(nodeId);
1921
+ * console.log(`Exact width: ${layout.width}`);
1922
+ * ```
1923
+ * @param {bigint} node
1924
+ * @returns {Layout}
1326
1925
  */
1327
- set padding_top(arg0) {
1328
- let ptr0 = 0;
1329
- if (!isLikeNone(arg0)) {
1330
- _assertClass(arg0, Dimension);
1331
- ptr0 = arg0.__destroy_into_raw();
1926
+ unroundedLayout(node) {
1927
+ const ret = wasm.taffytree_unroundedLayout(this.__wbg_ptr, node);
1928
+ return Layout.__wrap(ret);
1929
+ }
1930
+ /**
1931
+ * Creates a new node with the given children
1932
+ *
1933
+ * Use this to create container nodes that have child elements.
1934
+ * The children must already exist in the tree.
1935
+ *
1936
+ * @param style - The style configuration for the node
1937
+ * @param children - Array of child node IDs (as BigUint64Array)
1938
+ *
1939
+ * @returns - The node ID (`bigint`)
1940
+ *
1941
+ * @throws `TaffyError` if the node cannot be created
1942
+ *
1943
+ * @example
1944
+ * ```typescript
1945
+ * const containerStyle = new Style();
1946
+ * containerStyle.display = Display.Flex;
1947
+ *
1948
+ * const child1: bigint = tree.newLeaf(new Style());
1949
+ * const child2: bigint = tree.newLeaf(new Style());
1950
+ *
1951
+ * const container: bigint = tree.newWithChildren(
1952
+ * containerStyle,
1953
+ * BigUint64Array.from([child1, child2])
1954
+ * );
1955
+ * ```
1956
+ * @param {Style} style
1957
+ * @param {BigUint64Array} children
1958
+ * @returns {bigint}
1959
+ */
1960
+ newWithChildren(style, children) {
1961
+ _assertClass(style, Style);
1962
+ const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
1963
+ const len0 = WASM_VECTOR_LEN;
1964
+ const ret = wasm.taffytree_newWithChildren(this.__wbg_ptr, style.__wbg_ptr, ptr0, len0);
1965
+ if (ret[2]) {
1966
+ throw takeFromExternrefTable0(ret[1]);
1332
1967
  }
1333
- wasm.__wbg_set_style_padding_top(this.__wbg_ptr, ptr0);
1334
- }
1335
- /**
1336
- * The padding on the bottom side.
1337
- * @returns {Dimension | undefined}
1338
- */
1339
- get padding_bottom() {
1340
- const ret = wasm.__wbg_get_style_padding_bottom(this.__wbg_ptr);
1341
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1342
- }
1343
- /**
1344
- * The padding on the bottom side.
1345
- * @param {Dimension | null} [arg0]
1346
- */
1347
- set padding_bottom(arg0) {
1348
- let ptr0 = 0;
1349
- if (!isLikeNone(arg0)) {
1350
- _assertClass(arg0, Dimension);
1351
- ptr0 = arg0.__destroy_into_raw();
1968
+ return BigInt.asUintN(64, ret[0]);
1969
+ }
1970
+ /**
1971
+ * Gets the child at a specific index
1972
+ *
1973
+ * @param parent - The parent node ID
1974
+ * @param index - The index of the child (0-based)
1975
+ *
1976
+ * @returns - The child node ID (`bigint`)
1977
+ *
1978
+ * @throws `TaffyError` if the parent node does not exist or index is out of bounds
1979
+ *
1980
+ * @example
1981
+ * ```typescript
1982
+ * const firstChild: bigint = tree.getChildAtIndex(parentId, 0);
1983
+ * ```
1984
+ * @param {bigint} parent
1985
+ * @param {number} index
1986
+ * @returns {bigint}
1987
+ */
1988
+ getChildAtIndex(parent, index) {
1989
+ const ret = wasm.taffytree_getChildAtIndex(this.__wbg_ptr, parent, index);
1990
+ if (ret[2]) {
1991
+ throw takeFromExternrefTable0(ret[1]);
1352
1992
  }
1353
- wasm.__wbg_set_style_padding_bottom(this.__wbg_ptr, ptr0);
1354
- }
1355
- /**
1356
- * The flex direction (e.g. Row, Column).
1357
- * @returns {FlexDirection | undefined}
1358
- */
1359
- get flex_direction() {
1360
- const ret = wasm.__wbg_get_style_flex_direction(this.__wbg_ptr);
1361
- return ret === 4 ? undefined : ret;
1362
- }
1363
- /**
1364
- * The flex direction (e.g. Row, Column).
1365
- * @param {FlexDirection | null} [arg0]
1366
- */
1367
- set flex_direction(arg0) {
1368
- wasm.__wbg_set_style_flex_direction(this.__wbg_ptr, isLikeNone(arg0) ? 4 : arg0);
1369
- }
1370
- /**
1371
- * Whether flex items should wrap.
1372
- * @returns {FlexWrap | undefined}
1373
- */
1374
- get flex_wrap() {
1375
- const ret = wasm.__wbg_get_style_flex_wrap(this.__wbg_ptr);
1376
- return ret === 3 ? undefined : ret;
1377
- }
1378
- /**
1379
- * Whether flex items should wrap.
1380
- * @param {FlexWrap | null} [arg0]
1381
- */
1382
- set flex_wrap(arg0) {
1383
- wasm.__wbg_set_style_flex_wrap(this.__wbg_ptr, isLikeNone(arg0) ? 3 : arg0);
1384
- }
1385
- /**
1386
- * How much the item will grow relative to the rest of the flexible items.
1387
- * @returns {number | undefined}
1388
- */
1389
- get flex_grow() {
1390
- const ret = wasm.__wbg_get_availablespace_width(this.__wbg_ptr);
1391
- return ret === 0x100000001 ? undefined : ret;
1392
- }
1393
- /**
1394
- * How much the item will grow relative to the rest of the flexible items.
1395
- * @param {number | null} [arg0]
1396
- */
1397
- set flex_grow(arg0) {
1398
- wasm.__wbg_set_availablespace_width(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : Math.fround(arg0));
1399
- }
1400
- /**
1401
- * How much the item will shrink relative to the rest of the flexible items.
1402
- * @returns {number | undefined}
1403
- */
1404
- get flex_shrink() {
1405
- const ret = wasm.__wbg_get_availablespace_height(this.__wbg_ptr);
1406
- return ret === 0x100000001 ? undefined : ret;
1407
- }
1408
- /**
1409
- * How much the item will shrink relative to the rest of the flexible items.
1410
- * @param {number | null} [arg0]
1411
- */
1412
- set flex_shrink(arg0) {
1413
- wasm.__wbg_set_availablespace_height(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : Math.fround(arg0));
1414
- }
1415
- /**
1416
- * The initial main size of a flex item.
1417
- * @returns {Dimension | undefined}
1418
- */
1419
- get flex_basis() {
1420
- const ret = wasm.__wbg_get_style_flex_basis(this.__wbg_ptr);
1421
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1422
- }
1423
- /**
1424
- * The initial main size of a flex item.
1425
- * @param {Dimension | null} [arg0]
1993
+ return BigInt.asUintN(64, ret[0]);
1994
+ }
1995
+ /**
1996
+ * Gets a mutable reference to the context value for a node
1997
+ *
1998
+ * In JavaScript, this behaves the same as `getNodeContext()` since
1999
+ * JavaScript objects are always passed by reference.
2000
+ *
2001
+ * @param node - The node ID
2002
+ *
2003
+ * @returns - The attached context value, or `undefined` if none is set
2004
+ * @param {bigint} node
2005
+ * @returns {any}
1426
2006
  */
1427
- set flex_basis(arg0) {
1428
- let ptr0 = 0;
1429
- if (!isLikeNone(arg0)) {
1430
- _assertClass(arg0, Dimension);
1431
- ptr0 = arg0.__destroy_into_raw();
2007
+ getNodeContextMut(node) {
2008
+ const ret = wasm.taffytree_getNodeContextMut(this.__wbg_ptr, node);
2009
+ if (ret[2]) {
2010
+ throw takeFromExternrefTable0(ret[1]);
1432
2011
  }
1433
- wasm.__wbg_set_style_flex_basis(this.__wbg_ptr, ptr0);
1434
- }
1435
- /**
1436
- * How items are distributed along the main axis.
1437
- * @returns {JustifyContent | undefined}
1438
- */
1439
- get justify_content() {
1440
- const ret = wasm.__wbg_get_style_justify_content(this.__wbg_ptr);
1441
- return ret === 8 ? undefined : ret;
1442
- }
1443
- /**
1444
- * How items are distributed along the main axis.
1445
- * @param {JustifyContent | null} [arg0]
1446
- */
1447
- set justify_content(arg0) {
1448
- wasm.__wbg_set_style_justify_content(this.__wbg_ptr, isLikeNone(arg0) ? 8 : arg0);
1449
- }
1450
- /**
1451
- * How items are aligned along the cross axis.
1452
- * @returns {AlignItems | undefined}
1453
- */
1454
- get align_items() {
1455
- const ret = wasm.__wbg_get_style_align_items(this.__wbg_ptr);
1456
- return ret === 7 ? undefined : ret;
1457
- }
1458
- /**
1459
- * How items are aligned along the cross axis.
1460
- * @param {AlignItems | null} [arg0]
1461
- */
1462
- set align_items(arg0) {
1463
- wasm.__wbg_set_style_align_items(this.__wbg_ptr, isLikeNone(arg0) ? 7 : arg0);
1464
- }
1465
- /**
1466
- * How a single item is aligned along the cross axis.
1467
- * @returns {AlignSelf | undefined}
1468
- */
1469
- get align_self() {
1470
- const ret = wasm.__wbg_get_style_align_self(this.__wbg_ptr);
1471
- return ret === 7 ? undefined : ret;
1472
- }
1473
- /**
1474
- * How a single item is aligned along the cross axis.
1475
- * @param {AlignSelf | null} [arg0]
1476
- */
1477
- set align_self(arg0) {
1478
- wasm.__wbg_set_style_align_self(this.__wbg_ptr, isLikeNone(arg0) ? 7 : arg0);
1479
- }
1480
- /**
1481
- * How lines of content are aligned along the cross axis.
1482
- * @returns {AlignContent | undefined}
1483
- */
1484
- get align_content() {
1485
- const ret = wasm.__wbg_get_style_align_content(this.__wbg_ptr);
1486
- return ret === 9 ? undefined : ret;
1487
- }
1488
- /**
1489
- * How lines of content are aligned along the cross axis.
1490
- * @param {AlignContent | null} [arg0]
1491
- */
1492
- set align_content(arg0) {
1493
- wasm.__wbg_set_style_align_content(this.__wbg_ptr, isLikeNone(arg0) ? 9 : arg0);
1494
- }
1495
- /**
1496
- * The gap between rows (flex/grid).
1497
- * @returns {Dimension | undefined}
1498
- */
1499
- get row_gap() {
1500
- const ret = wasm.__wbg_get_style_row_gap(this.__wbg_ptr);
1501
- return ret === 0 ? undefined : Dimension.__wrap(ret);
2012
+ return takeFromExternrefTable0(ret[0]);
1502
2013
  }
1503
2014
  /**
1504
- * The gap between rows (flex/grid).
1505
- * @param {Dimension | null} [arg0]
1506
- */
1507
- set row_gap(arg0) {
1508
- let ptr0 = 0;
1509
- if (!isLikeNone(arg0)) {
1510
- _assertClass(arg0, Dimension);
1511
- ptr0 = arg0.__destroy_into_raw();
2015
+ * Inserts a child at a specific index
2016
+ *
2017
+ * @param parent - The parent node ID
2018
+ * @param index - The position to insert at (0-based)
2019
+ * @param child - The child node ID to insert
2020
+ *
2021
+ * @throws `TaffyError` if the parent or child node does not exist, or index is out of bounds
2022
+ *
2023
+ * @example
2024
+ * ```typescript
2025
+ * tree.insertChildAtIndex(parentId, 0, childId);
2026
+ * ```
2027
+ * @param {bigint} parent
2028
+ * @param {number} index
2029
+ * @param {bigint} child
2030
+ */
2031
+ insertChildAtIndex(parent, index, child) {
2032
+ const ret = wasm.taffytree_insertChildAtIndex(this.__wbg_ptr, parent, index, child);
2033
+ if (ret[1]) {
2034
+ throw takeFromExternrefTable0(ret[0]);
1512
2035
  }
1513
- wasm.__wbg_set_style_row_gap(this.__wbg_ptr, ptr0);
1514
- }
1515
- /**
1516
- * The gap between columns (flex/grid).
1517
- * @returns {Dimension | undefined}
1518
- */
1519
- get column_gap() {
1520
- const ret = wasm.__wbg_get_style_column_gap(this.__wbg_ptr);
1521
- return ret === 0 ? undefined : Dimension.__wrap(ret);
1522
2036
  }
1523
2037
  /**
1524
- * The gap between columns (flex/grid).
1525
- * @param {Dimension | null} [arg0]
1526
- */
1527
- set column_gap(arg0) {
1528
- let ptr0 = 0;
1529
- if (!isLikeNone(arg0)) {
1530
- _assertClass(arg0, Dimension);
1531
- ptr0 = arg0.__destroy_into_raw();
2038
+ * Creates a new leaf node with an attached context value
2039
+ *
2040
+ * The context can be any JavaScript value and is passed to the measure
2041
+ * function during layout computation. This is useful for storing
2042
+ * references to text content or other dynamic data.
2043
+ *
2044
+ * @param style - The style configuration for the node
2045
+ * @param context - Any JavaScript value to attach to the node
2046
+ * @returns - The node ID (`bigint`)
2047
+ * @throws `TaffyError` if the node cannot be created
2048
+ *
2049
+ * @example
2050
+ * ```typescript
2051
+ * interface TextContext { text: string; isBold: boolean; }
2052
+ *
2053
+ * const style = new Style();
2054
+ * const context: TextContext = { text: "Hello, World!", isBold: true };
2055
+ * const nodeId: bigint = tree.newLeafWithContext(style, context);
2056
+ * ```
2057
+ * @param {Style} style
2058
+ * @param {any} context
2059
+ * @returns {bigint}
2060
+ */
2061
+ newLeafWithContext(style, context) {
2062
+ _assertClass(style, Style);
2063
+ const ret = wasm.taffytree_newLeafWithContext(this.__wbg_ptr, style.__wbg_ptr, context);
2064
+ if (ret[2]) {
2065
+ throw takeFromExternrefTable0(ret[1]);
1532
2066
  }
1533
- wasm.__wbg_set_style_column_gap(this.__wbg_ptr, ptr0);
1534
- }
1535
- /**
1536
- * Algorithm for auto-placing items in the grid.
1537
- * @returns {GridAutoFlow | undefined}
1538
- */
1539
- get grid_auto_flow() {
1540
- const ret = wasm.__wbg_get_style_grid_auto_flow(this.__wbg_ptr);
1541
- return ret === 4 ? undefined : ret;
1542
- }
1543
- /**
1544
- * Algorithm for auto-placing items in the grid.
1545
- * @param {GridAutoFlow | null} [arg0]
1546
- */
1547
- set grid_auto_flow(arg0) {
1548
- wasm.__wbg_set_style_grid_auto_flow(this.__wbg_ptr, isLikeNone(arg0) ? 4 : arg0);
1549
- }
1550
- /**
1551
- * Text alignment.
1552
- * @returns {TextAlign | undefined}
1553
- */
1554
- get text_align() {
1555
- const ret = wasm.__wbg_get_style_text_align(this.__wbg_ptr);
1556
- return ret === 5 ? undefined : ret;
1557
- }
1558
- /**
1559
- * Text alignment.
1560
- * @param {TextAlign | null} [arg0]
1561
- */
1562
- set text_align(arg0) {
1563
- wasm.__wbg_set_style_text_align(this.__wbg_ptr, isLikeNone(arg0) ? 5 : arg0);
1564
- }
1565
- }
1566
- if (Symbol.dispose) Style.prototype[Symbol.dispose] = Style.prototype.free;
1567
-
1568
- export class TaffyNode {
1569
- __destroy_into_raw() {
1570
- const ptr = this.__wbg_ptr;
1571
- this.__wbg_ptr = 0;
1572
- TaffyNodeFinalization.unregister(this);
1573
- return ptr;
1574
- }
1575
- free() {
1576
- const ptr = this.__destroy_into_raw();
1577
- wasm.__wbg_taffynode_free(ptr, 0);
1578
- }
1579
- /**
1580
- * @returns {number}
1581
- */
1582
- get id() {
1583
- const ret = wasm.__wbg_get_taffynode_id(this.__wbg_ptr);
1584
- return ret >>> 0;
1585
- }
1586
- /**
1587
- * @param {number} arg0
1588
- */
1589
- set id(arg0) {
1590
- wasm.__wbg_set_taffynode_id(this.__wbg_ptr, arg0);
1591
- }
1592
- /**
1593
- * @returns {Layout}
1594
- */
1595
- get_layout() {
1596
- const ret = wasm.taffynode_get_layout(this.__wbg_ptr);
2067
+ return BigInt.asUintN(64, ret[0]);
2068
+ }
2069
+ /**
2070
+ * Removes a child at a specific index
2071
+ *
2072
+ * @param parent - The parent node ID
2073
+ * @param index - The index of the child to remove (0-based)
2074
+ *
2075
+ * @returns - The removed child ID (`bigint`)
2076
+ *
2077
+ * @throws `TaffyError` if the parent node does not exist or index is out of bounds
2078
+ *
2079
+ * @example
2080
+ * ```typescript
2081
+ * const removedId: bigint = tree.removeChildAtIndex(parentId, 0);
2082
+ * ```
2083
+ * @param {bigint} parent
2084
+ * @param {number} index
2085
+ * @returns {bigint}
2086
+ */
2087
+ removeChildAtIndex(parent, index) {
2088
+ const ret = wasm.taffytree_removeChildAtIndex(this.__wbg_ptr, parent, index);
1597
2089
  if (ret[2]) {
1598
2090
  throw takeFromExternrefTable0(ret[1]);
1599
2091
  }
1600
- return Layout.__wrap(ret[0]);
1601
- }
1602
- /**
1603
- * @param {TaffyNode} child
1604
- */
1605
- remove_child(child) {
1606
- _assertClass(child, TaffyNode);
1607
- const ret = wasm.taffynode_remove_child(this.__wbg_ptr, child.__wbg_ptr);
2092
+ return BigInt.asUintN(64, ret[0]);
2093
+ }
2094
+ /**
2095
+ * Removes a range of children
2096
+ *
2097
+ * Removes children from `start_index` (inclusive) to `end_index` (exclusive).
2098
+ *
2099
+ * @param parent - The parent node ID
2100
+ * @param start_index - Start of range (inclusive)
2101
+ * @param end_index - End of range (exclusive)
2102
+ *
2103
+ * @throws `TaffyError` if the parent node does not exist or range is invalid
2104
+ *
2105
+ * @example
2106
+ * ```typescript
2107
+ * tree.removeChildrenRange(parentId, 1, 3);
2108
+ * ```
2109
+ * @param {bigint} parent
2110
+ * @param {number} start_index
2111
+ * @param {number} end_index
2112
+ */
2113
+ removeChildrenRange(parent, start_index, end_index) {
2114
+ const ret = wasm.taffytree_removeChildrenRange(this.__wbg_ptr, parent, start_index, end_index);
1608
2115
  if (ret[1]) {
1609
2116
  throw takeFromExternrefTable0(ret[0]);
1610
2117
  }
1611
2118
  }
1612
2119
  /**
1613
- * @param {Uint32Array} children
1614
- */
1615
- set_children(children) {
1616
- const ptr0 = passArray32ToWasm0(children, wasm.__wbindgen_malloc);
1617
- const len0 = WASM_VECTOR_LEN;
1618
- const ret = wasm.taffynode_set_children(this.__wbg_ptr, ptr0, len0);
2120
+ * Replaces a child at a specific index
2121
+ *
2122
+ * @param parent - The parent node ID
2123
+ * @param index - The index of the child to replace (0-based)
2124
+ * @param new_child - The new child node ID
2125
+ *
2126
+ * @returns - The replaced (old) child ID (`bigint`)
2127
+ *
2128
+ * @throws `TaffyError` if the parent node does not exist or index is out of bounds
2129
+ *
2130
+ * @example
2131
+ * ```typescript
2132
+ * const oldChildId: bigint = tree.replaceChildAtIndex(parentId, 1, newChildId);
2133
+ * ```
2134
+ * @param {bigint} parent
2135
+ * @param {number} index
2136
+ * @param {bigint} new_child
2137
+ * @returns {bigint}
2138
+ */
2139
+ replaceChildAtIndex(parent, index, new_child) {
2140
+ const ret = wasm.taffytree_replaceChildAtIndex(this.__wbg_ptr, parent, index, new_child);
2141
+ if (ret[2]) {
2142
+ throw takeFromExternrefTable0(ret[1]);
2143
+ }
2144
+ return BigInt.asUintN(64, ret[0]);
2145
+ }
2146
+ /**
2147
+ * Computes layout with a custom measure function for leaf nodes
2148
+ *
2149
+ * Use this when you have leaf nodes with dynamic content (like text)
2150
+ * that needs to be measured during layout. The measure function is
2151
+ * called for each leaf node that needs measurement.
2152
+ *
2153
+ * @param node - The root node ID to compute layout for
2154
+ * @param available_space - The available space constraints
2155
+ * @param measure_func - A function that measures leaf node content
2156
+ *
2157
+ * @throws `TaffyError` if the node does not exist or available space is invalid
2158
+ *
2159
+ * @example
2160
+ * ```typescript
2161
+ * tree.computeLayoutWithMeasure(
2162
+ * rootId,
2163
+ * { width: 800, height: "MaxContent" },
2164
+ * (known, available, node, context, style) => {
2165
+ * if (context?.text) {
2166
+ * const measured = measureText(context.text, available.width);
2167
+ * return { width: measured.width, height: measured.height };
2168
+ * }
2169
+ * return { width: 0, height: 0 };
2170
+ * }
2171
+ * );
2172
+ * ```
2173
+ * @param {bigint} node
2174
+ * @param {Size<AvailableSpace>} available_space
2175
+ * @param {MeasureFunction} measure_func
2176
+ */
2177
+ computeLayoutWithMeasure(node, available_space, measure_func) {
2178
+ const ret = wasm.taffytree_computeLayoutWithMeasure(this.__wbg_ptr, node, available_space, measure_func);
1619
2179
  if (ret[1]) {
1620
2180
  throw takeFromExternrefTable0(ret[0]);
1621
2181
  }
1622
2182
  }
1623
2183
  /**
1624
- * @param {any} available_space
1625
- */
1626
- compute_layout(available_space) {
1627
- const ret = wasm.taffynode_compute_layout(this.__wbg_ptr, available_space);
1628
- if (ret[1]) {
1629
- throw takeFromExternrefTable0(ret[0]);
2184
+ * Gets context values for multiple nodes at once
2185
+ *
2186
+ * This is more efficient than calling `getNodeContext()` multiple times
2187
+ * when you need to access contexts for many nodes.
2188
+ *
2189
+ * @param children - Array of node IDs
2190
+ *
2191
+ * @returns - Array of context values (undefined for nodes without context)
2192
+ *
2193
+ * @example
2194
+ * ```typescript
2195
+ * const nodes = BigUint64Array.from([id1, id2]);
2196
+ * const contexts = tree.getDisjointNodeContextMut(nodes);
2197
+ * ```
2198
+ * @param {BigUint64Array} children
2199
+ * @returns {any[]}
2200
+ */
2201
+ getDisjointNodeContextMut(children) {
2202
+ const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
2203
+ const len0 = WASM_VECTOR_LEN;
2204
+ const ret = wasm.taffytree_getDisjointNodeContextMut(this.__wbg_ptr, ptr0, len0);
2205
+ if (ret[3]) {
2206
+ throw takeFromExternrefTable0(ret[2]);
1630
2207
  }
2208
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2209
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2210
+ return v2;
2211
+ }
2212
+ /**
2213
+ * Creates a new empty TaffyTree
2214
+ *
2215
+ * The tree starts with no nodes. Use `newLeaf()` or `newWithChildren()`
2216
+ * to add nodes.
2217
+ *
2218
+ * @example
2219
+ * ```typescript
2220
+ * const tree: TaffyTree = new TaffyTree();
2221
+ * ```
2222
+ */
2223
+ constructor() {
2224
+ const ret = wasm.taffytree_new();
2225
+ this.__wbg_ptr = ret >>> 0;
2226
+ TaffyTreeFinalization.register(this, this.__wbg_ptr, this);
2227
+ return this;
1631
2228
  }
1632
2229
  /**
1633
- * @param {any} style
1634
- */
1635
- constructor(style) {
1636
- const ret = wasm.taffynode_new(style);
2230
+ * Removes all nodes from the tree
2231
+ *
2232
+ * This clears the entire tree, removing all nodes and their relationships.
2233
+ * Use this to reset the tree for reuse.
2234
+ *
2235
+ * @example
2236
+ * ```typescript
2237
+ * tree.clear();
2238
+ * console.log(tree.totalNodeCount());
2239
+ * ```
2240
+ */
2241
+ clear() {
2242
+ wasm.taffytree_clear(this.__wbg_ptr);
2243
+ }
2244
+ /**
2245
+ * Checks if a node is dirty (needs re-layout)
2246
+ *
2247
+ * A node is dirty if its style or content has changed since the last
2248
+ * layout computation.
2249
+ *
2250
+ * @param node - The node ID to check
2251
+ *
2252
+ * @returns - true if dirty, false otherwise
2253
+ *
2254
+ * @throws `TaffyError` if the node does not exist
2255
+ *
2256
+ * @example
2257
+ * ```typescript
2258
+ * if (tree.dirty(nodeId)) {
2259
+ * tree.computeLayout(rootId, availableSpace);
2260
+ * }
2261
+ * ```
2262
+ * @param {bigint} node
2263
+ * @returns {boolean}
2264
+ */
2265
+ dirty(node) {
2266
+ const ret = wasm.taffytree_dirty(this.__wbg_ptr, node);
1637
2267
  if (ret[2]) {
1638
2268
  throw takeFromExternrefTable0(ret[1]);
1639
2269
  }
1640
- this.__wbg_ptr = ret[0] >>> 0;
1641
- TaffyNodeFinalization.register(this, this.__wbg_ptr, this);
1642
- return this;
1643
- }
1644
- free() {
1645
- const ptr = this.__destroy_into_raw();
1646
- const ret = wasm.taffynode_free(ptr);
1647
- if (ret[1]) {
1648
- throw takeFromExternrefTable0(ret[0]);
2270
+ return ret[0] !== 0;
2271
+ }
2272
+ /**
2273
+ * Gets the style for a node
2274
+ *
2275
+ * @param node - The node ID
2276
+ *
2277
+ * @returns - The node's `Style`
2278
+ *
2279
+ * @throws `TaffyError` if the node does not exist
2280
+ *
2281
+ * @example
2282
+ * ```typescript
2283
+ * const style: Style = tree.getStyle(nodeId);
2284
+ * console.log('Flex grow:', style.flexGrow);
2285
+ * ```
2286
+ * @param {bigint} node
2287
+ * @returns {Style}
2288
+ */
2289
+ getStyle(node) {
2290
+ const ret = wasm.taffytree_getStyle(this.__wbg_ptr, node);
2291
+ if (ret[2]) {
2292
+ throw takeFromExternrefTable0(ret[1]);
1649
2293
  }
1650
- }
1651
- /**
1652
- * @returns {any}
2294
+ return Style.__wrap(ret[0]);
2295
+ }
2296
+ /**
2297
+ * Gets the computed layout for a node
2298
+ *
2299
+ * Call this after `computeLayout()` to retrieve the computed position
2300
+ * and size for a node.
2301
+ *
2302
+ * @param node - The node ID
2303
+ *
2304
+ * @returns - The computed `Layout`
2305
+ *
2306
+ * @throws `TaffyError` if the node does not exist
2307
+ *
2308
+ * @example
2309
+ * ```typescript
2310
+ * tree.computeLayout(rootId, { width: 800, height: 600 });
2311
+ * const layout: Layout = tree.getLayout(nodeId);
2312
+ * console.log(`Position: (${layout.x}, ${layout.y}), Size: ${layout.width}x${layout.height}`);
2313
+ * ```
2314
+ * @param {bigint} node
2315
+ * @returns {Layout}
1653
2316
  */
1654
- style() {
1655
- const ret = wasm.taffynode_style(this.__wbg_ptr);
2317
+ getLayout(node) {
2318
+ const ret = wasm.taffytree_getLayout(this.__wbg_ptr, node);
1656
2319
  if (ret[2]) {
1657
2320
  throw takeFromExternrefTable0(ret[1]);
1658
2321
  }
1659
- return takeFromExternrefTable0(ret[0]);
2322
+ return Layout.__wrap(ret[0]);
1660
2323
  }
1661
2324
  /**
1662
- * @param {TaffyNode} child
1663
- */
1664
- add_child(child) {
1665
- _assertClass(child, TaffyNode);
1666
- const ret = wasm.taffynode_add_child(this.__wbg_ptr, child.__wbg_ptr);
2325
+ * Gets the parent of a node
2326
+ *
2327
+ * @param child - The child node ID
2328
+ *
2329
+ * @returns - The parent node ID, or `undefined` if the node has no parent
2330
+ *
2331
+ * @example
2332
+ * ```typescript
2333
+ * const parentId: bigint | undefined = tree.parent(childId);
2334
+ * ```
2335
+ * @param {bigint} child
2336
+ * @returns {bigint | undefined}
2337
+ */
2338
+ parent(child) {
2339
+ const ret = wasm.taffytree_parent(this.__wbg_ptr, child);
2340
+ return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
2341
+ }
2342
+ /**
2343
+ * Removes a node from the tree
2344
+ *
2345
+ * The node and all its descendants are removed. If the node has a parent,
2346
+ * it is automatically removed from the parent's children.
2347
+ *
2348
+ * @param node - The node ID to remove
2349
+ *
2350
+ * @returns - The removed node ID (`bigint`)
2351
+ *
2352
+ * @throws `TaffyError` if the node does not exist
2353
+ *
2354
+ * @example
2355
+ * ```typescript
2356
+ * try {
2357
+ * const removedId: bigint = tree.remove(nodeId);
2358
+ * } catch (e) {
2359
+ * console.error("Node doesn't exist");
2360
+ * }
2361
+ * ```
2362
+ * @param {bigint} node
2363
+ * @returns {bigint}
2364
+ */
2365
+ remove(node) {
2366
+ const ret = wasm.taffytree_remove(this.__wbg_ptr, node);
2367
+ if (ret[2]) {
2368
+ throw takeFromExternrefTable0(ret[1]);
2369
+ }
2370
+ return BigInt.asUintN(64, ret[0]);
2371
+ }
2372
+ /**
2373
+ * Gets all children of a node
2374
+ *
2375
+ * @param parent - The parent node ID
2376
+ *
2377
+ * @returns - Array of child node IDs (`BigUint64Array`)
2378
+ *
2379
+ * @throws `TaffyError` if the parent node does not exist
2380
+ *
2381
+ * @example
2382
+ * ```typescript
2383
+ * const children: BigUint64Array = tree.children(parentId);
2384
+ * ```
2385
+ * @param {bigint} parent
2386
+ * @returns {BigUint64Array}
2387
+ */
2388
+ children(parent) {
2389
+ const ret = wasm.taffytree_children(this.__wbg_ptr, parent);
2390
+ if (ret[3]) {
2391
+ throw takeFromExternrefTable0(ret[2]);
2392
+ }
2393
+ var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
2394
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2395
+ return v1;
2396
+ }
2397
+ /**
2398
+ * Creates a new leaf node with the given style
2399
+ *
2400
+ * A leaf node has no children. Use this for elements that contain
2401
+ * content (like text) rather than other elements.
2402
+ *
2403
+ * @param style - The style configuration for the node
2404
+ * @returns - The node ID (`bigint`)
2405
+ * @throws `TaffyError` if the node cannot be created
2406
+ *
2407
+ * @example
2408
+ * ```typescript
2409
+ * const style = new Style();
2410
+ * style.size = { width: 100, height: 50 };
2411
+ * const nodeId: bigint = tree.newLeaf(style);
2412
+ * ```
2413
+ * @param {Style} style
2414
+ * @returns {bigint}
2415
+ */
2416
+ newLeaf(style) {
2417
+ _assertClass(style, Style);
2418
+ const ret = wasm.taffytree_newLeaf(this.__wbg_ptr, style.__wbg_ptr);
2419
+ if (ret[2]) {
2420
+ throw takeFromExternrefTable0(ret[1]);
2421
+ }
2422
+ return BigInt.asUintN(64, ret[0]);
2423
+ }
2424
+ /**
2425
+ * Appends a child node to a parent
2426
+ *
2427
+ * The child is added as the last child of the parent.
2428
+ *
2429
+ * @param parent - The parent node ID
2430
+ * @param child - The child node ID to add
2431
+ *
2432
+ * @throws `TaffyError` if the parent or child node does not exist
2433
+ *
2434
+ * @example
2435
+ * ```typescript
2436
+ * tree.addChild(parentId, childId);
2437
+ * ```
2438
+ * @param {bigint} parent
2439
+ * @param {bigint} child
2440
+ */
2441
+ addChild(parent, child) {
2442
+ const ret = wasm.taffytree_addChild(this.__wbg_ptr, parent, child);
1667
2443
  if (ret[1]) {
1668
2444
  throw takeFromExternrefTable0(ret[0]);
1669
2445
  }
1670
2446
  }
1671
2447
  /**
1672
- * @param {any} style
1673
- */
1674
- set_style(style) {
1675
- const ret = wasm.taffynode_set_style(this.__wbg_ptr, style);
2448
+ * Sets the style for an existing node
2449
+ *
2450
+ * This replaces the node's current style with the provided one.
2451
+ * The node will be marked as dirty and require re-layout.
2452
+ *
2453
+ * @param node - The node ID
2454
+ * @param style - The new style configuration
2455
+ *
2456
+ * @throws `TaffyError` if the node does not exist
2457
+ *
2458
+ * @example
2459
+ * ```typescript
2460
+ * const newStyle = new Style();
2461
+ * newStyle.flexGrow = 2;
2462
+ * tree.setStyle(nodeId, newStyle);
2463
+ * ```
2464
+ * @param {bigint} node
2465
+ * @param {Style} style
2466
+ */
2467
+ setStyle(node, style) {
2468
+ _assertClass(style, Style);
2469
+ const ret = wasm.taffytree_setStyle(this.__wbg_ptr, node, style.__wbg_ptr);
1676
2470
  if (ret[1]) {
1677
2471
  throw takeFromExternrefTable0(ret[0]);
1678
2472
  }
1679
2473
  }
1680
2474
  }
1681
- if (Symbol.dispose) TaffyNode.prototype[Symbol.dispose] = TaffyNode.prototype.free;
1682
-
1683
- /**
1684
- * Text alignment within a node (mostly ignored in flex/grid layout but preserved for compatibility).
1685
- * @enum {0 | 1 | 2 | 3 | 4}
1686
- */
1687
- export const TextAlign = Object.freeze({
1688
- Auto: 0, "0": "Auto",
1689
- Left: 1, "1": "Left",
1690
- Right: 2, "2": "Right",
1691
- Center: 3, "3": "Center",
1692
- Justify: 4, "4": "Justify",
1693
- });
1694
-
1695
- /**
1696
- * Definition of a single grid track (row or column).
1697
- */
1698
- export class TrackDefinition {
1699
- __destroy_into_raw() {
1700
- const ptr = this.__wbg_ptr;
1701
- this.__wbg_ptr = 0;
1702
- TrackDefinitionFinalization.unregister(this);
1703
- return ptr;
1704
- }
1705
- free() {
1706
- const ptr = this.__destroy_into_raw();
1707
- wasm.__wbg_trackdefinition_free(ptr, 0);
1708
- }
1709
- /**
1710
- * The numeric value of the track size.
1711
- * @returns {number}
1712
- */
1713
- get value() {
1714
- const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
1715
- return ret;
1716
- }
1717
- /**
1718
- * The numeric value of the track size.
1719
- * @param {number} arg0
1720
- */
1721
- set value(arg0) {
1722
- wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
1723
- }
1724
- /**
1725
- * The unit of the track size.
1726
- * @returns {TrackUnit}
1727
- */
1728
- get unit() {
1729
- const ret = wasm.__wbg_get_trackdefinition_unit(this.__wbg_ptr);
1730
- return ret;
1731
- }
1732
- /**
1733
- * The unit of the track size.
1734
- * @param {TrackUnit} arg0
1735
- */
1736
- set unit(arg0) {
1737
- wasm.__wbg_set_trackdefinition_unit(this.__wbg_ptr, arg0);
1738
- }
1739
- }
1740
- if (Symbol.dispose) TrackDefinition.prototype[Symbol.dispose] = TrackDefinition.prototype.free;
1741
-
1742
- /**
1743
- * The unit for a grid track definition.
1744
- * @enum {0 | 1 | 2 | 3 | 4 | 5}
1745
- */
1746
- export const TrackUnit = Object.freeze({
1747
- /**
1748
- * The track size is specified in logical pixels.
1749
- */
1750
- Pixels: 0, "0": "Pixels",
1751
- /**
1752
- * The track size is specified as a percentage of the container.
1753
- */
1754
- Percent: 1, "1": "Percent",
1755
- /**
1756
- * The track size is a fraction of the remaining free space (fr unit).
1757
- */
1758
- Fraction: 2, "2": "Fraction",
1759
- /**
1760
- * The track size is determined automatically.
1761
- */
1762
- Auto: 3, "3": "Auto",
1763
- /**
1764
- * The track size is the minimum size needed to fit the content.
1765
- */
1766
- MinContent: 4, "4": "MinContent",
1767
- /**
1768
- * The track size is the maximum size needed to fit the content.
1769
- */
1770
- MaxContent: 5, "5": "MaxContent",
1771
- });
1772
-
1773
- /**
1774
- * Adds a child node to a parent node.
1775
- *
1776
- * # Arguments
1777
- *
1778
- * * `parent` - The ID of the parent node.
1779
- * * `child` - The ID of the child node to add.
1780
- *
1781
- * # Errors
1782
- *
1783
- * Returns a `JsValue` error if the operation fails (e.g., recursive hierarchy).
1784
- * @param {number} parent
1785
- * @param {number} child
1786
- */
1787
- export function add_child(parent, child) {
1788
- const ret = wasm.add_child(parent, child);
1789
- if (ret[1]) {
1790
- throw takeFromExternrefTable0(ret[0]);
1791
- }
1792
- }
1793
-
1794
- /**
1795
- * Auto dimension constant
1796
- * @returns {Dimension}
1797
- */
1798
- export function auto() {
1799
- const ret = wasm.auto();
1800
- return Dimension.__wrap(ret);
1801
- }
1802
-
1803
- /**
1804
- * Clear all nodes
1805
- */
1806
- export function clear() {
1807
- const ret = wasm.clear();
1808
- if (ret[1]) {
1809
- throw takeFromExternrefTable0(ret[0]);
1810
- }
1811
- }
1812
-
1813
- /**
1814
- * Computes the layout for a tree starting from the specified root node.
1815
- *
1816
- * # Arguments
1817
- *
1818
- * * `root` - The ID of the root node of the tree to lay out.
1819
- * * `available_space` - The available space constraints for the layout.
1820
- *
1821
- * # Errors
1822
- *
1823
- * Returns a `JsValue` error if the layout computation fails.
1824
- * @param {number} root
1825
- * @param {any} available_space
1826
- */
1827
- export function compute_layout(root, available_space) {
1828
- const ret = wasm.compute_layout(root, available_space);
1829
- if (ret[1]) {
1830
- throw takeFromExternrefTable0(ret[0]);
1831
- }
1832
- }
1833
-
1834
- /**
1835
- * Helper function to create a dimension
1836
- * @param {number} value
1837
- * @param {DimensionUnit} unit
1838
- * @returns {Dimension}
1839
- */
1840
- export function dimension(value, unit) {
1841
- const ret = wasm.dimension(value, unit);
1842
- return Dimension.__wrap(ret);
1843
- }
1844
-
1845
- /**
1846
- * Retrieves the list of children IDs for a given node.
1847
- *
1848
- * # Arguments
1849
- *
1850
- * * `parent` - The ID of the parent node.
1851
- *
1852
- * # Returns
1853
- *
1854
- * A boxed array of child node IDs (`Box<[u32]>`).
1855
- *
1856
- * # Errors
1857
- *
1858
- * Returns a `JsValue` error if the node does not exist.
1859
- * @param {number} parent
1860
- * @returns {Uint32Array}
1861
- */
1862
- export function get_children(parent) {
1863
- const ret = wasm.get_children(parent);
1864
- if (ret[3]) {
1865
- throw takeFromExternrefTable0(ret[2]);
1866
- }
1867
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1868
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1869
- return v1;
1870
- }
1871
-
1872
- /**
1873
- * Retrieves the computed layout information for a specific node.
1874
- *
1875
- * # Arguments
1876
- *
1877
- * * `node` - The ID of the node to query.
1878
- *
1879
- * # Returns
1880
- *
1881
- * A `Layout` object containing the x, y, width, and height of the node.
1882
- *
1883
- * # Errors
1884
- *
1885
- * Returns a `JsValue` error if the node does not exist or layout information is unavailable.
1886
- * @param {number} node
1887
- * @returns {any}
1888
- */
1889
- export function get_layout(node) {
1890
- const ret = wasm.get_layout(node);
1891
- if (ret[2]) {
1892
- throw takeFromExternrefTable0(ret[1]);
1893
- }
1894
- return takeFromExternrefTable0(ret[0]);
1895
- }
1896
-
1897
- /**
1898
- * Retrieves the parent ID of a given node.
1899
- *
1900
- * # Arguments
1901
- *
1902
- * * `node` - The ID of the node to query.
1903
- *
1904
- * # Returns
1905
- *
1906
- * An `Option<u32>` containing the parent ID if it exists, or `None` if the node is a root or orphan.
1907
- *
1908
- * # Errors
1909
- *
1910
- * Returns a `JsValue` error if internal tree access fails.
1911
- * @param {number} node
1912
- * @returns {number | undefined}
1913
- */
1914
- export function get_parent(node) {
1915
- const ret = wasm.get_parent(node);
1916
- if (ret[2]) {
1917
- throw takeFromExternrefTable0(ret[1]);
1918
- }
1919
- return ret[0] === 0x100000001 ? undefined : ret[0];
1920
- }
1921
-
1922
- /**
1923
- * Initialize console error panic hook
1924
- */
1925
- export function init() {
1926
- wasm.init();
1927
- }
1928
-
1929
- /**
1930
- * Marks a node and its ancestors as dirty, requiring a layout re-computation.
1931
- *
1932
- * # Arguments
1933
- *
1934
- * * `node` - The ID of the node to mark dirty.
1935
- *
1936
- * # Errors
1937
- *
1938
- * Returns a `JsValue` error if the node does not exist.
1939
- * @param {number} node
1940
- */
1941
- export function mark_dirty(node) {
1942
- const ret = wasm.mark_dirty(node);
1943
- if (ret[1]) {
1944
- throw takeFromExternrefTable0(ret[0]);
1945
- }
1946
- }
1947
-
1948
- /**
1949
- * Creates a new leaf node with the specified style.
1950
- *
1951
- * # Arguments
1952
- *
1953
- * * `style` - The style object to apply to the new node.
1954
- *
1955
- * # Returns
1956
- *
1957
- * The ID of the created node as a `u32`.
1958
- *
1959
- * # Errors
1960
- *
1961
- * Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
1962
- * @param {any} style
1963
- * @returns {number}
1964
- */
1965
- export function new_leaf(style) {
1966
- const ret = wasm.new_leaf(style);
1967
- if (ret[2]) {
1968
- throw takeFromExternrefTable0(ret[1]);
1969
- }
1970
- return ret[0] >>> 0;
1971
- }
1972
-
1973
- /**
1974
- * Creates a new node with children and the specified style.
1975
- *
1976
- * # Arguments
1977
- *
1978
- * * `style` - The style object to apply to the new node.
1979
- * * `children` - An array of child node IDs (`u32`) to attach to this node.
1980
- *
1981
- * # Returns
1982
- *
1983
- * The ID of the created node as a `u32`.
1984
- *
1985
- * # Errors
1986
- *
1987
- * Returns a `JsValue` error if the style cannot be deserialized or if node creation fails.
1988
- * @param {any} style
1989
- * @param {Uint32Array} children
1990
- * @returns {number}
1991
- */
1992
- export function new_with_children(style, children) {
1993
- const ptr0 = passArray32ToWasm0(children, wasm.__wbindgen_malloc);
1994
- const len0 = WASM_VECTOR_LEN;
1995
- const ret = wasm.new_with_children(style, ptr0, len0);
1996
- if (ret[2]) {
1997
- throw takeFromExternrefTable0(ret[1]);
1998
- }
1999
- return ret[0] >>> 0;
2000
- }
2001
-
2002
- /**
2003
- * Get the total number of nodes
2004
- * @returns {number}
2005
- */
2006
- export function node_count() {
2007
- const ret = wasm.node_count();
2008
- return ret >>> 0;
2009
- }
2010
-
2011
- /**
2012
- * Helper function to create a percent dimension
2013
- * @param {number} value
2014
- * @returns {Dimension}
2015
- */
2016
- export function percent(value) {
2017
- const ret = wasm.percent(value);
2018
- return Dimension.__wrap(ret);
2019
- }
2020
-
2021
- /**
2022
- * Helper function to create a pixel dimension
2023
- * @param {number} value
2024
- * @returns {Dimension}
2025
- */
2026
- export function px(value) {
2027
- const ret = wasm.px(value);
2028
- return Dimension.__wrap(ret);
2029
- }
2030
-
2031
- /**
2032
- * Removes a child node from a parent node.
2033
- *
2034
- * # Arguments
2035
- *
2036
- * * `parent` - The ID of the parent node.
2037
- * * `child` - The ID of the child node to remove.
2038
- *
2039
- * # Errors
2040
- *
2041
- * Returns a `JsValue` error if the child is not found in the parent.
2042
- * @param {number} parent
2043
- * @param {number} child
2044
- */
2045
- export function remove_child(parent, child) {
2046
- const ret = wasm.remove_child(parent, child);
2047
- if (ret[1]) {
2048
- throw takeFromExternrefTable0(ret[0]);
2049
- }
2050
- }
2051
-
2052
- /**
2053
- * Removes a node from the tree and frees its resources.
2054
- *
2055
- * # Arguments
2056
- *
2057
- * * `node` - The ID of the node to remove.
2058
- *
2059
- * # Errors
2060
- *
2061
- * Returns a `JsValue` error if the node does not exist or cannot be removed.
2062
- * @param {number} node
2063
- */
2064
- export function remove_node(node) {
2065
- const ret = wasm.remove_node(node);
2066
- if (ret[1]) {
2067
- throw takeFromExternrefTable0(ret[0]);
2068
- }
2069
- }
2070
-
2071
- /**
2072
- * Sets the children of a node, replacing any existing children.
2073
- *
2074
- * # Arguments
2075
- *
2076
- * * `parent` - The ID of the parent node.
2077
- * * `children` - An array of child node IDs to set.
2078
- *
2079
- * # Errors
2080
- *
2081
- * Returns a `JsValue` error if the operation fails.
2082
- * @param {number} parent
2083
- * @param {Uint32Array} children
2084
- */
2085
- export function set_children(parent, children) {
2086
- const ptr0 = passArray32ToWasm0(children, wasm.__wbindgen_malloc);
2087
- const len0 = WASM_VECTOR_LEN;
2088
- const ret = wasm.set_children(parent, ptr0, len0);
2089
- if (ret[1]) {
2090
- throw takeFromExternrefTable0(ret[0]);
2091
- }
2092
- }
2093
-
2094
- /**
2095
- * Updates the style of an existing node.
2096
- *
2097
- * # Arguments
2098
- *
2099
- * * `node` - The ID of the node to update.
2100
- * * `style` - The new style object to apply.
2101
- *
2102
- * # Errors
2103
- *
2104
- * Returns a `JsValue` error if the style cannot be deserialized or if the node does not exist.
2105
- * @param {number} node
2106
- * @param {any} style
2107
- */
2108
- export function set_style(node, style) {
2109
- const ret = wasm.set_style(node, style);
2110
- if (ret[1]) {
2111
- throw takeFromExternrefTable0(ret[0]);
2112
- }
2113
- }
2475
+ if (Symbol.dispose) TaffyTree.prototype[Symbol.dispose] = TaffyTree.prototype.free;
2114
2476
 
2115
2477
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
2116
2478
 
@@ -2162,6 +2524,12 @@ function __wbg_get_imports() {
2162
2524
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2163
2525
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2164
2526
  };
2527
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
2528
+ const v = arg1;
2529
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2530
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2531
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2532
+ };
2165
2533
  imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
2166
2534
  const v = arg0;
2167
2535
  const ret = typeof(v) === 'boolean' ? v : undefined;
@@ -2178,10 +2546,18 @@ function __wbg_get_imports() {
2178
2546
  const ret = arg0 in arg1;
2179
2547
  return ret;
2180
2548
  };
2549
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
2550
+ const ret = typeof(arg0) === 'bigint';
2551
+ return ret;
2552
+ };
2181
2553
  imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
2182
2554
  const ret = typeof(arg0) === 'function';
2183
2555
  return ret;
2184
2556
  };
2557
+ imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
2558
+ const ret = arg0 === null;
2559
+ return ret;
2560
+ };
2185
2561
  imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
2186
2562
  const val = arg0;
2187
2563
  const ret = typeof(val) === 'object' && val !== null;
@@ -2195,6 +2571,10 @@ function __wbg_get_imports() {
2195
2571
  const ret = arg0 === undefined;
2196
2572
  return ret;
2197
2573
  };
2574
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
2575
+ const ret = arg0 === arg1;
2576
+ return ret;
2577
+ };
2198
2578
  imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
2199
2579
  const ret = arg0 == arg1;
2200
2580
  return ret;
@@ -2216,14 +2596,14 @@ function __wbg_get_imports() {
2216
2596
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
2217
2597
  throw new Error(getStringFromWasm0(arg0, arg1));
2218
2598
  };
2599
+ imports.wbg.__wbg_apply_52e9ae668d017009 = function() { return handleError(function (arg0, arg1, arg2) {
2600
+ const ret = arg0.apply(arg1, arg2);
2601
+ return ret;
2602
+ }, arguments) };
2219
2603
  imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
2220
2604
  const ret = arg0.call(arg1);
2221
2605
  return ret;
2222
2606
  }, arguments) };
2223
- imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
2224
- const ret = arg0.done;
2225
- return ret;
2226
- };
2227
2607
  imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
2228
2608
  const ret = Object.entries(arg0);
2229
2609
  return ret;
@@ -2261,6 +2641,16 @@ function __wbg_get_imports() {
2261
2641
  const ret = result;
2262
2642
  return ret;
2263
2643
  };
2644
+ imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
2645
+ let result;
2646
+ try {
2647
+ result = arg0 instanceof Map;
2648
+ } catch (_) {
2649
+ result = false;
2650
+ }
2651
+ const ret = result;
2652
+ return ret;
2653
+ };
2264
2654
  imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
2265
2655
  let result;
2266
2656
  try {
@@ -2291,10 +2681,17 @@ function __wbg_get_imports() {
2291
2681
  const ret = arg0.length;
2292
2682
  return ret;
2293
2683
  };
2684
+ imports.wbg.__wbg_log_274c70cbdd825a00 = function(arg0, arg1) {
2685
+ console.log(getStringFromWasm0(arg0, arg1));
2686
+ };
2294
2687
  imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
2295
2688
  const ret = new Object();
2296
2689
  return ret;
2297
2690
  };
2691
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
2692
+ const ret = new Array();
2693
+ return ret;
2694
+ };
2298
2695
  imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
2299
2696
  const ret = new Uint8Array(arg0);
2300
2697
  return ret;
@@ -2307,13 +2704,13 @@ function __wbg_get_imports() {
2307
2704
  const ret = arg0.next;
2308
2705
  return ret;
2309
2706
  };
2310
- imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
2311
- const ret = arg0.next();
2312
- return ret;
2313
- }, arguments) };
2314
2707
  imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
2315
2708
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2316
2709
  };
2710
+ imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
2711
+ const ret = arg0.push(arg1);
2712
+ return ret;
2713
+ };
2317
2714
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2318
2715
  arg0[arg1] = arg2;
2319
2716
  };
@@ -2324,8 +2721,16 @@ function __wbg_get_imports() {
2324
2721
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2325
2722
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2326
2723
  };
2327
- imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
2328
- const ret = arg0.value;
2724
+ imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
2725
+ const ret = JSON.stringify(arg0);
2726
+ return ret;
2727
+ }, arguments) };
2728
+ imports.wbg.__wbg_style_new = function(arg0) {
2729
+ const ret = Style.__wrap(arg0);
2730
+ return ret;
2731
+ };
2732
+ imports.wbg.__wbg_taffyerror_new = function(arg0) {
2733
+ const ret = TaffyError.__wrap(arg0);
2329
2734
  return ret;
2330
2735
  };
2331
2736
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -2333,6 +2738,16 @@ function __wbg_get_imports() {
2333
2738
  const ret = getStringFromWasm0(arg0, arg1);
2334
2739
  return ret;
2335
2740
  };
2741
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
2742
+ // Cast intrinsic for `U64 -> Externref`.
2743
+ const ret = BigInt.asUintN(64, arg0);
2744
+ return ret;
2745
+ };
2746
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
2747
+ // Cast intrinsic for `I64 -> Externref`.
2748
+ const ret = arg0;
2749
+ return ret;
2750
+ };
2336
2751
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
2337
2752
  // Cast intrinsic for `F64 -> Externref`.
2338
2753
  const ret = arg0;
@@ -2354,8 +2769,8 @@ function __wbg_get_imports() {
2354
2769
  function __wbg_finalize_init(instance, module) {
2355
2770
  wasm = instance.exports;
2356
2771
  __wbg_init.__wbindgen_wasm_module = module;
2772
+ cachedBigUint64ArrayMemory0 = null;
2357
2773
  cachedDataViewMemory0 = null;
2358
- cachedUint32ArrayMemory0 = null;
2359
2774
  cachedUint8ArrayMemory0 = null;
2360
2775
 
2361
2776