taffy-wasm 0.9.2

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 ADDED
@@ -0,0 +1,2413 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function _assertClass(instance, klass) {
10
+ if (!(instance instanceof klass)) {
11
+ throw new Error(`expected instance of ${klass.name}`);
12
+ }
13
+ }
14
+
15
+ function debugString(val) {
16
+ // primitive types
17
+ const type = typeof val;
18
+ if (type == 'number' || type == 'boolean' || val == null) {
19
+ return `${val}`;
20
+ }
21
+ if (type == 'string') {
22
+ return `"${val}"`;
23
+ }
24
+ if (type == 'symbol') {
25
+ const description = val.description;
26
+ if (description == null) {
27
+ return 'Symbol';
28
+ } else {
29
+ return `Symbol(${description})`;
30
+ }
31
+ }
32
+ if (type == 'function') {
33
+ const name = val.name;
34
+ if (typeof name == 'string' && name.length > 0) {
35
+ return `Function(${name})`;
36
+ } else {
37
+ return 'Function';
38
+ }
39
+ }
40
+ // objects
41
+ if (Array.isArray(val)) {
42
+ const length = val.length;
43
+ let debug = '[';
44
+ if (length > 0) {
45
+ debug += debugString(val[0]);
46
+ }
47
+ for(let i = 1; i < length; i++) {
48
+ debug += ', ' + debugString(val[i]);
49
+ }
50
+ debug += ']';
51
+ return debug;
52
+ }
53
+ // Test for built-in
54
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
55
+ let className;
56
+ if (builtInMatches && builtInMatches.length > 1) {
57
+ className = builtInMatches[1];
58
+ } else {
59
+ // Failed to match the standard '[object ClassName]'
60
+ return toString.call(val);
61
+ }
62
+ if (className == 'Object') {
63
+ // we're a user defined class or Object
64
+ // JSON.stringify avoids problems with cycles, and is generally much
65
+ // easier than looping through ownProperties of `val`.
66
+ try {
67
+ return 'Object(' + JSON.stringify(val) + ')';
68
+ } catch (_) {
69
+ return 'Object';
70
+ }
71
+ }
72
+ // errors
73
+ if (val instanceof Error) {
74
+ return `${val.name}: ${val.message}\n${val.stack}`;
75
+ }
76
+ // TODO we could test for more things here, like `Set`s and `Map`s.
77
+ return className;
78
+ }
79
+
80
+ function getArrayU32FromWasm0(ptr, len) {
81
+ ptr = ptr >>> 0;
82
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
83
+ }
84
+
85
+ function getArrayU8FromWasm0(ptr, len) {
86
+ ptr = ptr >>> 0;
87
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
88
+ }
89
+
90
+ let cachedDataViewMemory0 = null;
91
+ function getDataViewMemory0() {
92
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
93
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
94
+ }
95
+ return cachedDataViewMemory0;
96
+ }
97
+
98
+ function getStringFromWasm0(ptr, len) {
99
+ ptr = ptr >>> 0;
100
+ return decodeText(ptr, len);
101
+ }
102
+
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
+ let cachedUint8ArrayMemory0 = null;
112
+ function getUint8ArrayMemory0() {
113
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
114
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
115
+ }
116
+ return cachedUint8ArrayMemory0;
117
+ }
118
+
119
+ function handleError(f, args) {
120
+ try {
121
+ return f.apply(this, args);
122
+ } catch (e) {
123
+ const idx = addToExternrefTable0(e);
124
+ wasm.__wbindgen_exn_store(idx);
125
+ }
126
+ }
127
+
128
+ function isLikeNone(x) {
129
+ return x === undefined || x === null;
130
+ }
131
+
132
+ function passArray32ToWasm0(arg, malloc) {
133
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
134
+ getUint32ArrayMemory0().set(arg, ptr / 4);
135
+ WASM_VECTOR_LEN = arg.length;
136
+ return ptr;
137
+ }
138
+
139
+ function passStringToWasm0(arg, malloc, realloc) {
140
+ if (realloc === undefined) {
141
+ const buf = cachedTextEncoder.encode(arg);
142
+ const ptr = malloc(buf.length, 1) >>> 0;
143
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
144
+ WASM_VECTOR_LEN = buf.length;
145
+ return ptr;
146
+ }
147
+
148
+ let len = arg.length;
149
+ let ptr = malloc(len, 1) >>> 0;
150
+
151
+ const mem = getUint8ArrayMemory0();
152
+
153
+ let offset = 0;
154
+
155
+ for (; offset < len; offset++) {
156
+ const code = arg.charCodeAt(offset);
157
+ if (code > 0x7F) break;
158
+ mem[ptr + offset] = code;
159
+ }
160
+ if (offset !== len) {
161
+ if (offset !== 0) {
162
+ arg = arg.slice(offset);
163
+ }
164
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
165
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
166
+ const ret = cachedTextEncoder.encodeInto(arg, view);
167
+
168
+ offset += ret.written;
169
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
170
+ }
171
+
172
+ WASM_VECTOR_LEN = offset;
173
+ return ptr;
174
+ }
175
+
176
+ function takeFromExternrefTable0(idx) {
177
+ const value = wasm.__wbindgen_externrefs.get(idx);
178
+ wasm.__externref_table_dealloc(idx);
179
+ return value;
180
+ }
181
+
182
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
183
+ cachedTextDecoder.decode();
184
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
185
+ let numBytesDecoded = 0;
186
+ function decodeText(ptr, len) {
187
+ numBytesDecoded += len;
188
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
189
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
190
+ cachedTextDecoder.decode();
191
+ numBytesDecoded = len;
192
+ }
193
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
194
+ }
195
+
196
+ const cachedTextEncoder = new TextEncoder();
197
+
198
+ if (!('encodeInto' in cachedTextEncoder)) {
199
+ cachedTextEncoder.encodeInto = function (arg, view) {
200
+ const buf = cachedTextEncoder.encode(arg);
201
+ view.set(buf);
202
+ return {
203
+ read: arg.length,
204
+ written: buf.length
205
+ };
206
+ }
207
+ }
208
+
209
+ let WASM_VECTOR_LEN = 0;
210
+
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
+ const LayoutFinalization = (typeof FinalizationRegistry === 'undefined')
220
+ ? { register: () => {}, unregister: () => {} }
221
+ : new FinalizationRegistry(ptr => wasm.__wbg_layout_free(ptr >>> 0, 1));
222
+
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
+ const StyleFinalization = (typeof FinalizationRegistry === 'undefined')
240
+ ? { register: () => {}, unregister: () => {} }
241
+ : new FinalizationRegistry(ptr => wasm.__wbg_style_free(ptr >>> 0, 1));
242
+
243
+ const TaffyNodeFinalization = (typeof FinalizationRegistry === 'undefined')
244
+ ? { register: () => {}, unregister: () => {} }
245
+ : new FinalizationRegistry(ptr => wasm.__wbg_taffynode_free(ptr >>> 0, 1));
246
+
247
+ const TrackDefinitionFinalization = (typeof FinalizationRegistry === 'undefined')
248
+ ? { register: () => {}, unregister: () => {} }
249
+ : new FinalizationRegistry(ptr => wasm.__wbg_trackdefinition_free(ptr >>> 0, 1));
250
+
251
+ /**
252
+ * How lines of content are aligned along the cross axis when there is extra space.
253
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
254
+ */
255
+ export const AlignContent = Object.freeze({
256
+ /**
257
+ * Lines are packed toward the start of the cross axis.
258
+ */
259
+ Start: 0, "0": "Start",
260
+ /**
261
+ * Lines are packed toward the end of the cross axis.
262
+ */
263
+ End: 1, "1": "End",
264
+ /**
265
+ * Lines are packed toward the start of the flex-direction cross axis.
266
+ */
267
+ FlexStart: 2, "2": "FlexStart",
268
+ /**
269
+ * Lines are packed toward the end of the flex-direction cross axis.
270
+ */
271
+ FlexEnd: 3, "3": "FlexEnd",
272
+ /**
273
+ * Lines are packed toward the center of the cross axis.
274
+ */
275
+ Center: 4, "4": "Center",
276
+ /**
277
+ * Lines are evenly distributed; the first line is at the start, the last at the end.
278
+ */
279
+ SpaceBetween: 5, "5": "SpaceBetween",
280
+ /**
281
+ * Lines are evenly distributed with equal space around them.
282
+ */
283
+ SpaceAround: 6, "6": "SpaceAround",
284
+ /**
285
+ * Lines are evenly distributed with equal space between them.
286
+ */
287
+ SpaceEvenly: 7, "7": "SpaceEvenly",
288
+ /**
289
+ * Lines are stretched to take up the remaining space.
290
+ */
291
+ Stretch: 8, "8": "Stretch",
292
+ });
293
+
294
+ /**
295
+ * How items are aligned along the cross axis.
296
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
297
+ */
298
+ export const AlignItems = Object.freeze({
299
+ /**
300
+ * Items are aligned at the start of the cross axis.
301
+ */
302
+ Start: 0, "0": "Start",
303
+ /**
304
+ * Items are aligned at the end of the cross axis.
305
+ */
306
+ End: 1, "1": "End",
307
+ /**
308
+ * Items are aligned at the start of the flex-direction cross axis.
309
+ */
310
+ FlexStart: 2, "2": "FlexStart",
311
+ /**
312
+ * Items are aligned at the end of the flex-direction cross axis.
313
+ */
314
+ FlexEnd: 3, "3": "FlexEnd",
315
+ /**
316
+ * Items are aligned at the center of the cross axis.
317
+ */
318
+ Center: 4, "4": "Center",
319
+ /**
320
+ * Items are aligned based on their baselines.
321
+ */
322
+ Baseline: 5, "5": "Baseline",
323
+ /**
324
+ * Items are stretched to fill the container along the cross axis.
325
+ */
326
+ Stretch: 6, "6": "Stretch",
327
+ });
328
+
329
+ /**
330
+ * How a single item is aligned along the cross axis, overriding `AlignItems`.
331
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
332
+ */
333
+ export const AlignSelf = Object.freeze({
334
+ /**
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.
344
+ */
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",
350
+ /**
351
+ * Items are aligned at the center of the cross axis.
352
+ */
353
+ Center: 4, "4": "Center",
354
+ /**
355
+ * Items are aligned based on their baselines.
356
+ */
357
+ Baseline: 5, "5": "Baseline",
358
+ /**
359
+ * Items are stretched to fill the container along the cross axis.
360
+ */
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
+ }
378
+ /**
379
+ * The available width (None means undefined/max-content).
380
+ * @returns {number | undefined}
381
+ */
382
+ get width() {
383
+ const ret = wasm.__wbg_get_availablespace_width(this.__wbg_ptr);
384
+ return ret === 0x100000001 ? undefined : ret;
385
+ }
386
+ /**
387
+ * The available width (None means undefined/max-content).
388
+ * @param {number | null} [arg0]
389
+ */
390
+ set width(arg0) {
391
+ wasm.__wbg_set_availablespace_width(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : Math.fround(arg0));
392
+ }
393
+ /**
394
+ * The available height (None means undefined/max-content).
395
+ * @returns {number | undefined}
396
+ */
397
+ get height() {
398
+ const ret = wasm.__wbg_get_availablespace_height(this.__wbg_ptr);
399
+ return ret === 0x100000001 ? undefined : ret;
400
+ }
401
+ /**
402
+ * The available height (None means undefined/max-content).
403
+ * @param {number | null} [arg0]
404
+ */
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;
410
+
411
+ /**
412
+ * Represents a length value in CSS.
413
+ *
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}
476
+ */
477
+ export const DimensionUnit = Object.freeze({
478
+ /**
479
+ * The dimension is specified in logical pixels.
480
+ */
481
+ Pixels: 0, "0": "Pixels",
482
+ /**
483
+ * The dimension is specified as a percentage of the parent's size.
484
+ */
485
+ Percent: 1, "1": "Percent",
486
+ /**
487
+ * The dimension is determined automatically based on content or context.
488
+ */
489
+ Auto: 2, "2": "Auto",
490
+ });
491
+
492
+ /**
493
+ * The display style of a node.
494
+ * @enum {0 | 1 | 2 | 3}
495
+ */
496
+ export const Display = Object.freeze({
497
+ /**
498
+ * The node is hidden and does not take up space.
499
+ */
500
+ None: 0, "0": "None",
501
+ /**
502
+ * The node behaves as a flex container.
503
+ */
504
+ Flex: 1, "1": "Flex",
505
+ /**
506
+ * The node behaves as a grid container.
507
+ */
508
+ Grid: 2, "2": "Grid",
509
+ /**
510
+ * The node behaves as a block element.
511
+ */
512
+ Block: 3, "3": "Block",
513
+ });
514
+
515
+ /**
516
+ * The direction of the main axis for a flex container.
517
+ * @enum {0 | 1 | 2 | 3}
518
+ */
519
+ export const FlexDirection = Object.freeze({
520
+ /**
521
+ * Items are placed horizontally from left to right.
522
+ */
523
+ Row: 0, "0": "Row",
524
+ /**
525
+ * Items are placed vertically from top to bottom.
526
+ */
527
+ Column: 1, "1": "Column",
528
+ /**
529
+ * Items are placed horizontally from right to left.
530
+ */
531
+ RowReverse: 2, "2": "RowReverse",
532
+ /**
533
+ * Items are placed vertically from bottom to top.
534
+ */
535
+ ColumnReverse: 3, "3": "ColumnReverse",
536
+ });
537
+
538
+ /**
539
+ * Whether flex items are forced into a single line or can wrap onto multiple lines.
540
+ * @enum {0 | 1 | 2}
541
+ */
542
+ export const FlexWrap = Object.freeze({
543
+ /**
544
+ * Items are forced into a single line.
545
+ */
546
+ NoWrap: 0, "0": "NoWrap",
547
+ /**
548
+ * Items wrap onto multiple lines.
549
+ */
550
+ Wrap: 1, "1": "Wrap",
551
+ /**
552
+ * Items wrap onto multiple lines in reverse order.
553
+ */
554
+ WrapReverse: 2, "2": "WrapReverse",
555
+ });
556
+
557
+ /**
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}
583
+ */
584
+ export const JustifyContent = Object.freeze({
585
+ /**
586
+ * Items are packed toward the start of the layout direction.
587
+ */
588
+ Start: 0, "0": "Start",
589
+ /**
590
+ * Items are packed toward the end of the layout direction.
591
+ */
592
+ End: 1, "1": "End",
593
+ /**
594
+ * Items are packed toward the start of the flex-direction.
595
+ */
596
+ FlexStart: 2, "2": "FlexStart",
597
+ /**
598
+ * Items are packed toward the end of the flex-direction.
599
+ */
600
+ FlexEnd: 3, "3": "FlexEnd",
601
+ /**
602
+ * Items are centered along the line.
603
+ */
604
+ Center: 4, "4": "Center",
605
+ /**
606
+ * Items are evenly distributed; the first item is at the start, the last at the end.
607
+ */
608
+ SpaceBetween: 5, "5": "SpaceBetween",
609
+ /**
610
+ * Items are evenly distributed with equal space around them.
611
+ */
612
+ SpaceAround: 6, "6": "SpaceAround",
613
+ /**
614
+ * Items are evenly distributed with equal space between them using the same gap at ends.
615
+ */
616
+ SpaceEvenly: 7, "7": "SpaceEvenly",
617
+ });
618
+
619
+ /**
620
+ * Represents the computed layout of a node.
621
+ *
622
+ * This struct contains the final position and size of a node after layout computation.
623
+ */
624
+ export class Layout {
625
+ static __wrap(ptr) {
626
+ ptr = ptr >>> 0;
627
+ const obj = Object.create(Layout.prototype);
628
+ obj.__wbg_ptr = ptr;
629
+ LayoutFinalization.register(obj, obj.__wbg_ptr, obj);
630
+ return obj;
631
+ }
632
+ __destroy_into_raw() {
633
+ const ptr = this.__wbg_ptr;
634
+ this.__wbg_ptr = 0;
635
+ LayoutFinalization.unregister(this);
636
+ return ptr;
637
+ }
638
+ free() {
639
+ const ptr = this.__destroy_into_raw();
640
+ wasm.__wbg_layout_free(ptr, 0);
641
+ }
642
+ /**
643
+ * The absolute x-coordinate of the node relative to its parent.
644
+ * @returns {number}
645
+ */
646
+ get x() {
647
+ const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
648
+ return ret;
649
+ }
650
+ /**
651
+ * The absolute x-coordinate of the node relative to its parent.
652
+ * @param {number} arg0
653
+ */
654
+ set x(arg0) {
655
+ wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
656
+ }
657
+ /**
658
+ * The absolute y-coordinate of the node relative to its parent.
659
+ * @returns {number}
660
+ */
661
+ get y() {
662
+ const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
663
+ return ret;
664
+ }
665
+ /**
666
+ * The absolute y-coordinate of the node relative to its parent.
667
+ * @param {number} arg0
668
+ */
669
+ set y(arg0) {
670
+ wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
671
+ }
672
+ /**
673
+ * The computed width of the node.
674
+ * @returns {number}
675
+ */
676
+ get width() {
677
+ const ret = wasm.__wbg_get_layout_width(this.__wbg_ptr);
678
+ return ret;
679
+ }
680
+ /**
681
+ * The computed width of the node.
682
+ * @param {number} arg0
683
+ */
684
+ set width(arg0) {
685
+ wasm.__wbg_set_layout_width(this.__wbg_ptr, arg0);
686
+ }
687
+ /**
688
+ * The computed height of the node.
689
+ * @returns {number}
690
+ */
691
+ get height() {
692
+ const ret = wasm.__wbg_get_layout_height(this.__wbg_ptr);
693
+ return ret;
694
+ }
695
+ /**
696
+ * The computed height of the node.
697
+ * @param {number} arg0
698
+ */
699
+ set height(arg0) {
700
+ wasm.__wbg_set_layout_height(this.__wbg_ptr, arg0);
701
+ }
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;
714
+ }
715
+ free() {
716
+ const ptr = this.__destroy_into_raw();
717
+ wasm.__wbg_line_free(ptr, 0);
718
+ }
719
+ /**
720
+ * The start line index (1-based).
721
+ * @returns {number | undefined}
722
+ */
723
+ get start() {
724
+ const ret = wasm.__wbg_get_line_start(this.__wbg_ptr);
725
+ return ret === 0xFFFFFF ? undefined : ret;
726
+ }
727
+ /**
728
+ * The start line index (1-based).
729
+ * @param {number | null} [arg0]
730
+ */
731
+ set start(arg0) {
732
+ wasm.__wbg_set_line_start(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0);
733
+ }
734
+ /**
735
+ * The end line index (1-based).
736
+ * @returns {number | undefined}
737
+ */
738
+ get end() {
739
+ const ret = wasm.__wbg_get_line_end(this.__wbg_ptr);
740
+ return ret === 0xFFFFFF ? undefined : ret;
741
+ }
742
+ /**
743
+ * The end line index (1-based).
744
+ * @param {number | null} [arg0]
745
+ */
746
+ set end(arg0) {
747
+ wasm.__wbg_set_line_end(this.__wbg_ptr, isLikeNone(arg0) ? 0xFFFFFF : arg0);
748
+ }
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;
763
+ }
764
+ free() {
765
+ const ptr = this.__destroy_into_raw();
766
+ wasm.__wbg_point_free(ptr, 0);
767
+ }
768
+ /**
769
+ * The x-coordinate (horizontal).
770
+ * @returns {number}
771
+ */
772
+ get x() {
773
+ const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
774
+ return ret;
775
+ }
776
+ /**
777
+ * The x-coordinate (horizontal).
778
+ * @param {number} arg0
779
+ */
780
+ set x(arg0) {
781
+ wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
782
+ }
783
+ /**
784
+ * The y-coordinate (vertical).
785
+ * @returns {number}
786
+ */
787
+ get y() {
788
+ const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
789
+ return ret;
790
+ }
791
+ /**
792
+ * The y-coordinate (vertical).
793
+ * @param {number} arg0
794
+ */
795
+ set y(arg0) {
796
+ wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
797
+ }
798
+ }
799
+ if (Symbol.dispose) Point.prototype[Symbol.dispose] = Point.prototype.free;
800
+
801
+ /**
802
+ * Positioning strategy for a node.
803
+ * @enum {0 | 1 | 2}
804
+ */
805
+ export const Position = Object.freeze({
806
+ /**
807
+ * Relative to its normal position in the flow.
808
+ */
809
+ Static: 0, "0": "Static",
810
+ /**
811
+ * Relative to its normal position in the flow.
812
+ */
813
+ Relative: 1, "1": "Relative",
814
+ /**
815
+ * Removed from the flow and positioned relative to its containing block.
816
+ */
817
+ Absolute: 2, "2": "Absolute",
818
+ });
819
+
820
+ /**
821
+ * Represents a rectangle defined by its edges.
822
+ *
823
+ * Used for padding, margin, properties.
824
+ */
825
+ export class Rect {
826
+ __destroy_into_raw() {
827
+ const ptr = this.__wbg_ptr;
828
+ this.__wbg_ptr = 0;
829
+ RectFinalization.unregister(this);
830
+ return ptr;
831
+ }
832
+ free() {
833
+ const ptr = this.__destroy_into_raw();
834
+ wasm.__wbg_rect_free(ptr, 0);
835
+ }
836
+ /**
837
+ * The left edge value.
838
+ * @returns {number}
839
+ */
840
+ get left() {
841
+ const ret = wasm.__wbg_get_dimension_value(this.__wbg_ptr);
842
+ return ret;
843
+ }
844
+ /**
845
+ * The left edge value.
846
+ * @param {number} arg0
847
+ */
848
+ set left(arg0) {
849
+ wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
850
+ }
851
+ /**
852
+ * The right edge value.
853
+ * @returns {number}
854
+ */
855
+ get right() {
856
+ const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
857
+ return ret;
858
+ }
859
+ /**
860
+ * The right edge value.
861
+ * @param {number} arg0
862
+ */
863
+ set right(arg0) {
864
+ wasm.__wbg_set_layout_y(this.__wbg_ptr, arg0);
865
+ }
866
+ /**
867
+ * The top edge value.
868
+ * @returns {number}
869
+ */
870
+ get top() {
871
+ const ret = wasm.__wbg_get_layout_width(this.__wbg_ptr);
872
+ return ret;
873
+ }
874
+ /**
875
+ * The top edge value.
876
+ * @param {number} arg0
877
+ */
878
+ set top(arg0) {
879
+ wasm.__wbg_set_layout_width(this.__wbg_ptr, arg0);
880
+ }
881
+ /**
882
+ * The bottom edge value.
883
+ * @returns {number}
884
+ */
885
+ get bottom() {
886
+ const ret = wasm.__wbg_get_layout_height(this.__wbg_ptr);
887
+ return ret;
888
+ }
889
+ /**
890
+ * The bottom edge value.
891
+ * @param {number} arg0
892
+ */
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);
914
+ }
915
+ /**
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
926
+ */
927
+ set width(arg0) {
928
+ wasm.__wbg_set_dimension_value(this.__wbg_ptr, arg0);
929
+ }
930
+ /**
931
+ * The height dimension.
932
+ * @returns {number}
933
+ */
934
+ get height() {
935
+ const ret = wasm.__wbg_get_layout_y(this.__wbg_ptr);
936
+ return ret;
937
+ }
938
+ /**
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]
976
+ */
977
+ set display(arg0) {
978
+ wasm.__wbg_set_style_display(this.__wbg_ptr, isLikeNone(arg0) ? 4 : arg0);
979
+ }
980
+ /**
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;
987
+ }
988
+ /**
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);
994
+ }
995
+ /**
996
+ * The width of the node.
997
+ * @returns {Dimension | undefined}
998
+ */
999
+ get width() {
1000
+ const ret = wasm.__wbg_get_style_width(this.__wbg_ptr);
1001
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1002
+ }
1003
+ /**
1004
+ * The width of the node.
1005
+ * @param {Dimension | null} [arg0]
1006
+ */
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);
1014
+ }
1015
+ /**
1016
+ * The height of the node.
1017
+ * @returns {Dimension | undefined}
1018
+ */
1019
+ get height() {
1020
+ const ret = wasm.__wbg_get_style_height(this.__wbg_ptr);
1021
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1022
+ }
1023
+ /**
1024
+ * The height of the node.
1025
+ * @param {Dimension | null} [arg0]
1026
+ */
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);
1034
+ }
1035
+ /**
1036
+ * The minimum width of the node.
1037
+ * @returns {Dimension | undefined}
1038
+ */
1039
+ get min_width() {
1040
+ const ret = wasm.__wbg_get_style_min_width(this.__wbg_ptr);
1041
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1042
+ }
1043
+ /**
1044
+ * The minimum width of the node.
1045
+ * @param {Dimension | null} [arg0]
1046
+ */
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);
1054
+ }
1055
+ /**
1056
+ * The minimum height of the node.
1057
+ * @returns {Dimension | undefined}
1058
+ */
1059
+ get min_height() {
1060
+ const ret = wasm.__wbg_get_style_min_height(this.__wbg_ptr);
1061
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1062
+ }
1063
+ /**
1064
+ * The minimum height of the node.
1065
+ * @param {Dimension | null} [arg0]
1066
+ */
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);
1074
+ }
1075
+ /**
1076
+ * The maximum width of the node.
1077
+ * @returns {Dimension | undefined}
1078
+ */
1079
+ get max_width() {
1080
+ const ret = wasm.__wbg_get_style_max_width(this.__wbg_ptr);
1081
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1082
+ }
1083
+ /**
1084
+ * The maximum width of the node.
1085
+ * @param {Dimension | null} [arg0]
1086
+ */
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);
1094
+ }
1095
+ /**
1096
+ * The maximum height of the node.
1097
+ * @returns {Dimension | undefined}
1098
+ */
1099
+ get max_height() {
1100
+ const ret = wasm.__wbg_get_style_max_height(this.__wbg_ptr);
1101
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1102
+ }
1103
+ /**
1104
+ * The maximum height of the node.
1105
+ * @param {Dimension | null} [arg0]
1106
+ */
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);
1114
+ }
1115
+ /**
1116
+ * The offset from the left edge (used with Position::Absolute/Relative).
1117
+ * @returns {Dimension | undefined}
1118
+ */
1119
+ get left() {
1120
+ const ret = wasm.__wbg_get_style_left(this.__wbg_ptr);
1121
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1122
+ }
1123
+ /**
1124
+ * The offset from the left edge (used with Position::Absolute/Relative).
1125
+ * @param {Dimension | null} [arg0]
1126
+ */
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);
1134
+ }
1135
+ /**
1136
+ * The offset from the right edge.
1137
+ * @returns {Dimension | undefined}
1138
+ */
1139
+ get right() {
1140
+ const ret = wasm.__wbg_get_style_right(this.__wbg_ptr);
1141
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1142
+ }
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);
1154
+ }
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);
1162
+ }
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();
1172
+ }
1173
+ wasm.__wbg_set_style_top(this.__wbg_ptr, ptr0);
1174
+ }
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);
1194
+ }
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);
1202
+ }
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();
1212
+ }
1213
+ wasm.__wbg_set_style_margin_left(this.__wbg_ptr, ptr0);
1214
+ }
1215
+ /**
1216
+ * The margin on the right side.
1217
+ * @returns {Dimension | undefined}
1218
+ */
1219
+ get margin_right() {
1220
+ const ret = wasm.__wbg_get_style_margin_right(this.__wbg_ptr);
1221
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1222
+ }
1223
+ /**
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();
1232
+ }
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();
1252
+ }
1253
+ wasm.__wbg_set_style_margin_top(this.__wbg_ptr, ptr0);
1254
+ }
1255
+ /**
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();
1272
+ }
1273
+ wasm.__wbg_set_style_margin_bottom(this.__wbg_ptr, ptr0);
1274
+ }
1275
+ /**
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]
1286
+ */
1287
+ set padding_left(arg0) {
1288
+ let ptr0 = 0;
1289
+ if (!isLikeNone(arg0)) {
1290
+ _assertClass(arg0, Dimension);
1291
+ ptr0 = arg0.__destroy_into_raw();
1292
+ }
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);
1302
+ }
1303
+ /**
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();
1312
+ }
1313
+ wasm.__wbg_set_style_padding_right(this.__wbg_ptr, ptr0);
1314
+ }
1315
+ /**
1316
+ * The padding on the top side.
1317
+ * @returns {Dimension | undefined}
1318
+ */
1319
+ get padding_top() {
1320
+ const ret = wasm.__wbg_get_style_padding_top(this.__wbg_ptr);
1321
+ return ret === 0 ? undefined : Dimension.__wrap(ret);
1322
+ }
1323
+ /**
1324
+ * The padding on the top side.
1325
+ * @param {Dimension | null} [arg0]
1326
+ */
1327
+ set padding_top(arg0) {
1328
+ let ptr0 = 0;
1329
+ if (!isLikeNone(arg0)) {
1330
+ _assertClass(arg0, Dimension);
1331
+ ptr0 = arg0.__destroy_into_raw();
1332
+ }
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();
1352
+ }
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]
1426
+ */
1427
+ set flex_basis(arg0) {
1428
+ let ptr0 = 0;
1429
+ if (!isLikeNone(arg0)) {
1430
+ _assertClass(arg0, Dimension);
1431
+ ptr0 = arg0.__destroy_into_raw();
1432
+ }
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);
1502
+ }
1503
+ /**
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();
1512
+ }
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
+ }
1523
+ /**
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();
1532
+ }
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);
1597
+ if (ret[2]) {
1598
+ throw takeFromExternrefTable0(ret[1]);
1599
+ }
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);
1608
+ if (ret[1]) {
1609
+ throw takeFromExternrefTable0(ret[0]);
1610
+ }
1611
+ }
1612
+ /**
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);
1619
+ if (ret[1]) {
1620
+ throw takeFromExternrefTable0(ret[0]);
1621
+ }
1622
+ }
1623
+ /**
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]);
1630
+ }
1631
+ }
1632
+ /**
1633
+ * @param {any} style
1634
+ */
1635
+ constructor(style) {
1636
+ const ret = wasm.taffynode_new(style);
1637
+ if (ret[2]) {
1638
+ throw takeFromExternrefTable0(ret[1]);
1639
+ }
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]);
1649
+ }
1650
+ }
1651
+ /**
1652
+ * @returns {any}
1653
+ */
1654
+ style() {
1655
+ const ret = wasm.taffynode_style(this.__wbg_ptr);
1656
+ if (ret[2]) {
1657
+ throw takeFromExternrefTable0(ret[1]);
1658
+ }
1659
+ return takeFromExternrefTable0(ret[0]);
1660
+ }
1661
+ /**
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);
1667
+ if (ret[1]) {
1668
+ throw takeFromExternrefTable0(ret[0]);
1669
+ }
1670
+ }
1671
+ /**
1672
+ * @param {any} style
1673
+ */
1674
+ set_style(style) {
1675
+ const ret = wasm.taffynode_set_style(this.__wbg_ptr, style);
1676
+ if (ret[1]) {
1677
+ throw takeFromExternrefTable0(ret[0]);
1678
+ }
1679
+ }
1680
+ }
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
+ }
2114
+
2115
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
2116
+
2117
+ async function __wbg_load(module, imports) {
2118
+ if (typeof Response === 'function' && module instanceof Response) {
2119
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2120
+ try {
2121
+ return await WebAssembly.instantiateStreaming(module, imports);
2122
+ } catch (e) {
2123
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
2124
+
2125
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2126
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
2127
+
2128
+ } else {
2129
+ throw e;
2130
+ }
2131
+ }
2132
+ }
2133
+
2134
+ const bytes = await module.arrayBuffer();
2135
+ return await WebAssembly.instantiate(bytes, imports);
2136
+ } else {
2137
+ const instance = await WebAssembly.instantiate(module, imports);
2138
+
2139
+ if (instance instanceof WebAssembly.Instance) {
2140
+ return { instance, module };
2141
+ } else {
2142
+ return instance;
2143
+ }
2144
+ }
2145
+ }
2146
+
2147
+ function __wbg_get_imports() {
2148
+ const imports = {};
2149
+ imports.wbg = {};
2150
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
2151
+ const ret = Error(getStringFromWasm0(arg0, arg1));
2152
+ return ret;
2153
+ };
2154
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
2155
+ const ret = Number(arg0);
2156
+ return ret;
2157
+ };
2158
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
2159
+ const ret = String(arg1);
2160
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2161
+ const len1 = WASM_VECTOR_LEN;
2162
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2163
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2164
+ };
2165
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
2166
+ const v = arg0;
2167
+ const ret = typeof(v) === 'boolean' ? v : undefined;
2168
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2169
+ };
2170
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
2171
+ const ret = debugString(arg1);
2172
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2173
+ const len1 = WASM_VECTOR_LEN;
2174
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2175
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2176
+ };
2177
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
2178
+ const ret = arg0 in arg1;
2179
+ return ret;
2180
+ };
2181
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
2182
+ const ret = typeof(arg0) === 'function';
2183
+ return ret;
2184
+ };
2185
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
2186
+ const val = arg0;
2187
+ const ret = typeof(val) === 'object' && val !== null;
2188
+ return ret;
2189
+ };
2190
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
2191
+ const ret = typeof(arg0) === 'string';
2192
+ return ret;
2193
+ };
2194
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
2195
+ const ret = arg0 === undefined;
2196
+ return ret;
2197
+ };
2198
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
2199
+ const ret = arg0 == arg1;
2200
+ return ret;
2201
+ };
2202
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
2203
+ const obj = arg1;
2204
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2205
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2206
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2207
+ };
2208
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
2209
+ const obj = arg1;
2210
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2211
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2212
+ var len1 = WASM_VECTOR_LEN;
2213
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2214
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2215
+ };
2216
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
2217
+ throw new Error(getStringFromWasm0(arg0, arg1));
2218
+ };
2219
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
2220
+ const ret = arg0.call(arg1);
2221
+ return ret;
2222
+ }, arguments) };
2223
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
2224
+ const ret = arg0.done;
2225
+ return ret;
2226
+ };
2227
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
2228
+ const ret = Object.entries(arg0);
2229
+ return ret;
2230
+ };
2231
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
2232
+ let deferred0_0;
2233
+ let deferred0_1;
2234
+ try {
2235
+ deferred0_0 = arg0;
2236
+ deferred0_1 = arg1;
2237
+ console.error(getStringFromWasm0(arg0, arg1));
2238
+ } finally {
2239
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2240
+ }
2241
+ };
2242
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
2243
+ const ret = arg0[arg1 >>> 0];
2244
+ return ret;
2245
+ };
2246
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
2247
+ const ret = Reflect.get(arg0, arg1);
2248
+ return ret;
2249
+ }, arguments) };
2250
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
2251
+ const ret = arg0[arg1];
2252
+ return ret;
2253
+ };
2254
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
2255
+ let result;
2256
+ try {
2257
+ result = arg0 instanceof ArrayBuffer;
2258
+ } catch (_) {
2259
+ result = false;
2260
+ }
2261
+ const ret = result;
2262
+ return ret;
2263
+ };
2264
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
2265
+ let result;
2266
+ try {
2267
+ result = arg0 instanceof Uint8Array;
2268
+ } catch (_) {
2269
+ result = false;
2270
+ }
2271
+ const ret = result;
2272
+ return ret;
2273
+ };
2274
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
2275
+ const ret = Array.isArray(arg0);
2276
+ return ret;
2277
+ };
2278
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
2279
+ const ret = Number.isSafeInteger(arg0);
2280
+ return ret;
2281
+ };
2282
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
2283
+ const ret = Symbol.iterator;
2284
+ return ret;
2285
+ };
2286
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
2287
+ const ret = arg0.length;
2288
+ return ret;
2289
+ };
2290
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
2291
+ const ret = arg0.length;
2292
+ return ret;
2293
+ };
2294
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
2295
+ const ret = new Object();
2296
+ return ret;
2297
+ };
2298
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
2299
+ const ret = new Uint8Array(arg0);
2300
+ return ret;
2301
+ };
2302
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
2303
+ const ret = new Error();
2304
+ return ret;
2305
+ };
2306
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
2307
+ const ret = arg0.next;
2308
+ return ret;
2309
+ };
2310
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
2311
+ const ret = arg0.next();
2312
+ return ret;
2313
+ }, arguments) };
2314
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
2315
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2316
+ };
2317
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
2318
+ arg0[arg1] = arg2;
2319
+ };
2320
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
2321
+ const ret = arg1.stack;
2322
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2323
+ const len1 = WASM_VECTOR_LEN;
2324
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2325
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2326
+ };
2327
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
2328
+ const ret = arg0.value;
2329
+ return ret;
2330
+ };
2331
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
2332
+ // Cast intrinsic for `Ref(String) -> Externref`.
2333
+ const ret = getStringFromWasm0(arg0, arg1);
2334
+ return ret;
2335
+ };
2336
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
2337
+ // Cast intrinsic for `F64 -> Externref`.
2338
+ const ret = arg0;
2339
+ return ret;
2340
+ };
2341
+ imports.wbg.__wbindgen_init_externref_table = function() {
2342
+ const table = wasm.__wbindgen_externrefs;
2343
+ const offset = table.grow(4);
2344
+ table.set(0, undefined);
2345
+ table.set(offset + 0, undefined);
2346
+ table.set(offset + 1, null);
2347
+ table.set(offset + 2, true);
2348
+ table.set(offset + 3, false);
2349
+ };
2350
+
2351
+ return imports;
2352
+ }
2353
+
2354
+ function __wbg_finalize_init(instance, module) {
2355
+ wasm = instance.exports;
2356
+ __wbg_init.__wbindgen_wasm_module = module;
2357
+ cachedDataViewMemory0 = null;
2358
+ cachedUint32ArrayMemory0 = null;
2359
+ cachedUint8ArrayMemory0 = null;
2360
+
2361
+
2362
+ wasm.__wbindgen_start();
2363
+ return wasm;
2364
+ }
2365
+
2366
+ function initSync(module) {
2367
+ if (wasm !== undefined) return wasm;
2368
+
2369
+
2370
+ if (typeof module !== 'undefined') {
2371
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2372
+ ({module} = module)
2373
+ } else {
2374
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2375
+ }
2376
+ }
2377
+
2378
+ const imports = __wbg_get_imports();
2379
+ if (!(module instanceof WebAssembly.Module)) {
2380
+ module = new WebAssembly.Module(module);
2381
+ }
2382
+ const instance = new WebAssembly.Instance(module, imports);
2383
+ return __wbg_finalize_init(instance, module);
2384
+ }
2385
+
2386
+ async function __wbg_init(module_or_path) {
2387
+ if (wasm !== undefined) return wasm;
2388
+
2389
+
2390
+ if (typeof module_or_path !== 'undefined') {
2391
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2392
+ ({module_or_path} = module_or_path)
2393
+ } else {
2394
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2395
+ }
2396
+ }
2397
+
2398
+ if (typeof module_or_path === 'undefined') {
2399
+ module_or_path = new URL('taffy_wasm_bg.wasm', import.meta.url);
2400
+ }
2401
+ const imports = __wbg_get_imports();
2402
+
2403
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2404
+ module_or_path = fetch(module_or_path);
2405
+ }
2406
+
2407
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2408
+
2409
+ return __wbg_finalize_init(instance, module);
2410
+ }
2411
+
2412
+ export { initSync };
2413
+ export default __wbg_init;