taffy-js 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -395
- package/package.json +2 -2
- package/taffy_js.d.ts +1688 -572
- package/taffy_js.js +2804 -1820
- package/taffy_js_bg.wasm +0 -0
package/taffy_js.js
CHANGED
|
@@ -1,2030 +1,3014 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
3
|
function addToExternrefTable0(obj) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function _assertClass(instance, klass) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (!(instance instanceof klass)) {
|
|
11
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function debugString(val) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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];
|
|
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";
|
|
58
28
|
} else {
|
|
59
|
-
|
|
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
|
-
}
|
|
29
|
+
return `Symbol(${description})`;
|
|
71
30
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
78
|
}
|
|
79
79
|
|
|
80
80
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
ptr = ptr >>> 0;
|
|
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
89
|
}
|
|
90
90
|
|
|
91
91
|
function getArrayU64FromWasm0(ptr, len) {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
ptr = ptr >>> 0;
|
|
93
|
+
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function getArrayU8FromWasm0(ptr, len) {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
ptr = ptr >>> 0;
|
|
98
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
let cachedBigUint64ArrayMemory0 = null;
|
|
102
102
|
function getBigUint64ArrayMemory0() {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
if (
|
|
104
|
+
cachedBigUint64ArrayMemory0 === null ||
|
|
105
|
+
cachedBigUint64ArrayMemory0.byteLength === 0
|
|
106
|
+
) {
|
|
107
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
108
|
+
}
|
|
109
|
+
return cachedBigUint64ArrayMemory0;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
let cachedDataViewMemory0 = null;
|
|
110
113
|
function getDataViewMemory0() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
if (
|
|
115
|
+
cachedDataViewMemory0 === null ||
|
|
116
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
117
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
118
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
119
|
+
) {
|
|
120
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
121
|
+
}
|
|
122
|
+
return cachedDataViewMemory0;
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
function getStringFromWasm0(ptr, len) {
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
ptr = ptr >>> 0;
|
|
127
|
+
return decodeText(ptr, len);
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
let cachedUint8ArrayMemory0 = null;
|
|
123
131
|
function getUint8ArrayMemory0() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
if (
|
|
133
|
+
cachedUint8ArrayMemory0 === null ||
|
|
134
|
+
cachedUint8ArrayMemory0.byteLength === 0
|
|
135
|
+
) {
|
|
136
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
137
|
+
}
|
|
138
|
+
return cachedUint8ArrayMemory0;
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
function handleError(f, args) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
try {
|
|
143
|
+
return f.apply(this, args);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
const idx = addToExternrefTable0(e);
|
|
146
|
+
wasm.__wbindgen_exn_store(idx);
|
|
147
|
+
}
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
function isLikeNone(x) {
|
|
140
|
-
|
|
151
|
+
return x === undefined || x === null;
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
function passArray64ToWasm0(arg, malloc) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
156
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
157
|
+
WASM_VECTOR_LEN = arg.length;
|
|
158
|
+
return ptr;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
if (realloc === undefined) {
|
|
163
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
164
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
165
|
+
getUint8ArrayMemory0()
|
|
166
|
+
.subarray(ptr, ptr + buf.length)
|
|
167
|
+
.set(buf);
|
|
168
|
+
WASM_VECTOR_LEN = buf.length;
|
|
169
|
+
return ptr;
|
|
170
|
+
}
|
|
158
171
|
|
|
159
|
-
|
|
160
|
-
|
|
172
|
+
let len = arg.length;
|
|
173
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
161
174
|
|
|
162
|
-
|
|
175
|
+
const mem = getUint8ArrayMemory0();
|
|
163
176
|
|
|
164
|
-
|
|
177
|
+
let offset = 0;
|
|
165
178
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
for (; offset < len; offset++) {
|
|
180
|
+
const code = arg.charCodeAt(offset);
|
|
181
|
+
if (code > 0x7f) break;
|
|
182
|
+
mem[ptr + offset] = code;
|
|
183
|
+
}
|
|
184
|
+
if (offset !== len) {
|
|
185
|
+
if (offset !== 0) {
|
|
186
|
+
arg = arg.slice(offset);
|
|
170
187
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
176
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
177
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
188
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
189
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
190
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
178
191
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
192
|
+
offset += ret.written;
|
|
193
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
194
|
+
}
|
|
182
195
|
|
|
183
|
-
|
|
184
|
-
|
|
196
|
+
WASM_VECTOR_LEN = offset;
|
|
197
|
+
return ptr;
|
|
185
198
|
}
|
|
186
199
|
|
|
187
200
|
function takeFromExternrefTable0(idx) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
202
|
+
wasm.__externref_table_dealloc(idx);
|
|
203
|
+
return value;
|
|
191
204
|
}
|
|
192
205
|
|
|
193
|
-
let cachedTextDecoder = new TextDecoder(
|
|
206
|
+
let cachedTextDecoder = new TextDecoder("utf-8", {
|
|
207
|
+
ignoreBOM: true,
|
|
208
|
+
fatal: true,
|
|
209
|
+
});
|
|
194
210
|
cachedTextDecoder.decode();
|
|
195
211
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
196
212
|
let numBytesDecoded = 0;
|
|
197
213
|
function decodeText(ptr, len) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
214
|
+
numBytesDecoded += len;
|
|
215
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
216
|
+
cachedTextDecoder = new TextDecoder("utf-8", {
|
|
217
|
+
ignoreBOM: true,
|
|
218
|
+
fatal: true,
|
|
219
|
+
});
|
|
220
|
+
cachedTextDecoder.decode();
|
|
221
|
+
numBytesDecoded = len;
|
|
222
|
+
}
|
|
223
|
+
return cachedTextDecoder.decode(
|
|
224
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + len),
|
|
225
|
+
);
|
|
205
226
|
}
|
|
206
227
|
|
|
207
228
|
const cachedTextEncoder = new TextEncoder();
|
|
208
229
|
|
|
209
|
-
if (!(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
231
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
232
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
233
|
+
view.set(buf);
|
|
234
|
+
return {
|
|
235
|
+
read: arg.length,
|
|
236
|
+
written: buf.length,
|
|
237
|
+
};
|
|
238
|
+
};
|
|
218
239
|
}
|
|
219
240
|
|
|
220
241
|
let WASM_VECTOR_LEN = 0;
|
|
221
242
|
|
|
222
|
-
const LayoutFinalization =
|
|
243
|
+
const LayoutFinalization =
|
|
244
|
+
typeof FinalizationRegistry === "undefined"
|
|
245
|
+
? { register: () => {}, unregister: () => {} }
|
|
246
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_layout_free(ptr >>> 0, 1));
|
|
247
|
+
|
|
248
|
+
const StyleFinalization =
|
|
249
|
+
typeof FinalizationRegistry === "undefined"
|
|
223
250
|
? { register: () => {}, unregister: () => {} }
|
|
224
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
251
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_style_free(ptr >>> 0, 1));
|
|
225
252
|
|
|
226
|
-
const
|
|
253
|
+
const TaffyErrorFinalization =
|
|
254
|
+
typeof FinalizationRegistry === "undefined"
|
|
227
255
|
? { register: () => {}, unregister: () => {} }
|
|
228
|
-
: new FinalizationRegistry(ptr =>
|
|
256
|
+
: new FinalizationRegistry((ptr) =>
|
|
257
|
+
wasm.__wbg_taffyerror_free(ptr >>> 0, 1),
|
|
258
|
+
);
|
|
229
259
|
|
|
230
|
-
const TaffyTreeFinalization =
|
|
260
|
+
const TaffyTreeFinalization =
|
|
261
|
+
typeof FinalizationRegistry === "undefined"
|
|
231
262
|
? { register: () => {}, unregister: () => {} }
|
|
232
|
-
: new FinalizationRegistry(ptr =>
|
|
263
|
+
: new FinalizationRegistry((ptr) =>
|
|
264
|
+
wasm.__wbg_taffytree_free(ptr >>> 0, 1),
|
|
265
|
+
);
|
|
233
266
|
|
|
234
267
|
/**
|
|
235
|
-
* Multi-line content alignment
|
|
268
|
+
* Multi-line content alignment enumeration
|
|
269
|
+
*
|
|
270
|
+
* Controls the distribution of space between and around content items along the cross axis
|
|
271
|
+
* in a multi-line flex container. This corresponds to the CSS `align-content` property.
|
|
272
|
+
*
|
|
273
|
+
* **Note**: This property only has effect when `flex-wrap` is set to `Wrap` or `WrapReverse`.
|
|
236
274
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* import { AlignContent, FlexWrap } from 'taffy-js';
|
|
239
278
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* - `SpaceEvenly`: All spacing completely equal
|
|
279
|
+
* style.flexWrap = FlexWrap.Wrap;
|
|
280
|
+
* style.alignContent = AlignContent.SpaceBetween; // Distribute lines evenly
|
|
281
|
+
* ```
|
|
244
282
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
|
|
245
283
|
*/
|
|
246
284
|
export const AlignContent = Object.freeze({
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Lines packed toward the start of the cross axis
|
|
287
|
+
*/
|
|
288
|
+
Start: 0,
|
|
289
|
+
0: "Start",
|
|
290
|
+
/**
|
|
291
|
+
* Lines packed toward the end of the cross axis
|
|
292
|
+
*/
|
|
293
|
+
End: 1,
|
|
294
|
+
1: "End",
|
|
295
|
+
/**
|
|
296
|
+
* Lines packed toward the start of the flex container
|
|
297
|
+
*/
|
|
298
|
+
FlexStart: 2,
|
|
299
|
+
2: "FlexStart",
|
|
300
|
+
/**
|
|
301
|
+
* Lines packed toward the end of the flex container
|
|
302
|
+
*/
|
|
303
|
+
FlexEnd: 3,
|
|
304
|
+
3: "FlexEnd",
|
|
305
|
+
/**
|
|
306
|
+
* Lines centered within the container
|
|
307
|
+
*/
|
|
308
|
+
Center: 4,
|
|
309
|
+
4: "Center",
|
|
310
|
+
/**
|
|
311
|
+
* Lines stretched to fill the container
|
|
312
|
+
*/
|
|
313
|
+
Stretch: 5,
|
|
314
|
+
5: "Stretch",
|
|
315
|
+
/**
|
|
316
|
+
* Lines evenly distributed with first/last at edges
|
|
317
|
+
*/
|
|
318
|
+
SpaceBetween: 6,
|
|
319
|
+
6: "SpaceBetween",
|
|
320
|
+
/**
|
|
321
|
+
* Lines evenly distributed with equal space around each
|
|
322
|
+
*/
|
|
323
|
+
SpaceAround: 7,
|
|
324
|
+
7: "SpaceAround",
|
|
325
|
+
/**
|
|
326
|
+
* Lines evenly distributed with equal space between each
|
|
327
|
+
*/
|
|
328
|
+
SpaceEvenly: 8,
|
|
329
|
+
8: "SpaceEvenly",
|
|
256
330
|
});
|
|
257
331
|
|
|
258
332
|
/**
|
|
259
|
-
* Cross-axis alignment
|
|
333
|
+
* Cross-axis alignment enumeration for all children
|
|
334
|
+
*
|
|
335
|
+
* Defines the default alignment for all flex/grid items along the cross axis.
|
|
336
|
+
* This corresponds to the CSS `align-items` property.
|
|
260
337
|
*
|
|
261
|
-
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* import { AlignItems } from 'taffy-js';
|
|
262
341
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* - `Center`: Center alignment
|
|
267
|
-
* - `Baseline`: Baseline alignment (text baseline)
|
|
268
|
-
* - `Stretch`: Stretch to fill container
|
|
342
|
+
* style.alignItems = AlignItems.Center; // Center items on cross axis
|
|
343
|
+
* style.alignItems = AlignItems.Stretch; // Stretch items to fill container
|
|
344
|
+
* ```
|
|
269
345
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
|
|
270
346
|
*/
|
|
271
347
|
export const AlignItems = Object.freeze({
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Items aligned to the start of the cross axis
|
|
350
|
+
*/
|
|
351
|
+
Start: 0,
|
|
352
|
+
0: "Start",
|
|
353
|
+
/**
|
|
354
|
+
* Items aligned to the end of the cross axis
|
|
355
|
+
*/
|
|
356
|
+
End: 1,
|
|
357
|
+
1: "End",
|
|
358
|
+
/**
|
|
359
|
+
* Items aligned to the start of the flex container
|
|
360
|
+
*/
|
|
361
|
+
FlexStart: 2,
|
|
362
|
+
2: "FlexStart",
|
|
363
|
+
/**
|
|
364
|
+
* Items aligned to the end of the flex container
|
|
365
|
+
*/
|
|
366
|
+
FlexEnd: 3,
|
|
367
|
+
3: "FlexEnd",
|
|
368
|
+
/**
|
|
369
|
+
* Items centered along the cross axis
|
|
370
|
+
*/
|
|
371
|
+
Center: 4,
|
|
372
|
+
4: "Center",
|
|
373
|
+
/**
|
|
374
|
+
* Items aligned to their text baselines
|
|
375
|
+
*/
|
|
376
|
+
Baseline: 5,
|
|
377
|
+
5: "Baseline",
|
|
378
|
+
/**
|
|
379
|
+
* Items stretched to fill the container
|
|
380
|
+
*/
|
|
381
|
+
Stretch: 6,
|
|
382
|
+
6: "Stretch",
|
|
279
383
|
});
|
|
280
384
|
|
|
281
385
|
/**
|
|
282
|
-
* Cross-axis alignment
|
|
386
|
+
* Cross-axis alignment enumeration for a single element
|
|
387
|
+
*
|
|
388
|
+
* Overrides the parent's `align-items` value for a specific child element.
|
|
389
|
+
* This corresponds to the CSS `align-self` property.
|
|
283
390
|
*
|
|
284
|
-
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* import { AlignSelf } from 'taffy-js';
|
|
285
394
|
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
395
|
+
* style.alignSelf = AlignSelf.Auto; // Use parent's align-items
|
|
396
|
+
* style.alignSelf = AlignSelf.Center; // Override to center this item
|
|
397
|
+
* ```
|
|
289
398
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
|
|
290
399
|
*/
|
|
291
400
|
export const AlignSelf = Object.freeze({
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Inherits the parent container's `align-items` value
|
|
403
|
+
*/
|
|
404
|
+
Auto: 0,
|
|
405
|
+
0: "Auto",
|
|
406
|
+
/**
|
|
407
|
+
* Item aligned to the start of the cross axis
|
|
408
|
+
*/
|
|
409
|
+
Start: 1,
|
|
410
|
+
1: "Start",
|
|
411
|
+
/**
|
|
412
|
+
* Item aligned to the end of the cross axis
|
|
413
|
+
*/
|
|
414
|
+
End: 2,
|
|
415
|
+
2: "End",
|
|
416
|
+
/**
|
|
417
|
+
* Item aligned to the start of the flex container
|
|
418
|
+
*/
|
|
419
|
+
FlexStart: 3,
|
|
420
|
+
3: "FlexStart",
|
|
421
|
+
/**
|
|
422
|
+
* Item aligned to the end of the flex container
|
|
423
|
+
*/
|
|
424
|
+
FlexEnd: 4,
|
|
425
|
+
4: "FlexEnd",
|
|
426
|
+
/**
|
|
427
|
+
* Item centered along the cross axis
|
|
428
|
+
*/
|
|
429
|
+
Center: 5,
|
|
430
|
+
5: "Center",
|
|
431
|
+
/**
|
|
432
|
+
* Item aligned to its text baseline
|
|
433
|
+
*/
|
|
434
|
+
Baseline: 6,
|
|
435
|
+
6: "Baseline",
|
|
436
|
+
/**
|
|
437
|
+
* Item stretched to fill the container
|
|
438
|
+
*/
|
|
439
|
+
Stretch: 7,
|
|
440
|
+
7: "Stretch",
|
|
300
441
|
});
|
|
301
442
|
|
|
302
443
|
/**
|
|
303
|
-
* Box sizing
|
|
444
|
+
* Box sizing enumeration
|
|
304
445
|
*
|
|
305
446
|
* Controls how the total width and height of an element is calculated.
|
|
447
|
+
* This corresponds to the CSS `box-sizing` property.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* import { BoxSizing } from 'taffy-js';
|
|
306
452
|
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
453
|
+
* style.boxSizing = BoxSizing.BorderBox; // Size includes padding and border
|
|
454
|
+
* style.boxSizing = BoxSizing.ContentBox; // Size is content only
|
|
455
|
+
* ```
|
|
310
456
|
* @enum {0 | 1}
|
|
311
457
|
*/
|
|
312
458
|
export const BoxSizing = Object.freeze({
|
|
313
|
-
|
|
314
|
-
|
|
459
|
+
/**
|
|
460
|
+
* The width and height properties include padding and border
|
|
461
|
+
*/
|
|
462
|
+
BorderBox: 0,
|
|
463
|
+
0: "BorderBox",
|
|
464
|
+
/**
|
|
465
|
+
* The width and height properties include only the content
|
|
466
|
+
*/
|
|
467
|
+
ContentBox: 1,
|
|
468
|
+
1: "ContentBox",
|
|
315
469
|
});
|
|
316
470
|
|
|
317
471
|
/**
|
|
318
|
-
* Display mode
|
|
472
|
+
* Display mode enumeration
|
|
319
473
|
*
|
|
320
|
-
* Controls the layout algorithm type for an element.
|
|
474
|
+
* Controls the layout algorithm type for an element. This corresponds to the CSS `display` property
|
|
475
|
+
* and determines how an element and its children are laid out.
|
|
321
476
|
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```typescript
|
|
479
|
+
* import { Display } from 'taffy-js';
|
|
480
|
+
*
|
|
481
|
+
* style.display = Display.Flex; // Enable flexbox layout
|
|
482
|
+
* style.display = Display.Grid; // Enable grid layout
|
|
483
|
+
* style.display = Display.None; // Hide element from layout
|
|
484
|
+
* ```
|
|
327
485
|
* @enum {0 | 1 | 2 | 3}
|
|
328
486
|
*/
|
|
329
487
|
export const Display = Object.freeze({
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
488
|
+
/**
|
|
489
|
+
* Block-level layout where element takes the full available width
|
|
490
|
+
*/
|
|
491
|
+
Block: 0,
|
|
492
|
+
0: "Block",
|
|
493
|
+
/**
|
|
494
|
+
* Flexbox layout for one-dimensional item arrangement
|
|
495
|
+
*/
|
|
496
|
+
Flex: 1,
|
|
497
|
+
1: "Flex",
|
|
498
|
+
/**
|
|
499
|
+
* CSS Grid layout for two-dimensional item arrangement
|
|
500
|
+
*/
|
|
501
|
+
Grid: 2,
|
|
502
|
+
2: "Grid",
|
|
503
|
+
/**
|
|
504
|
+
* Element is removed from layout calculation entirely
|
|
505
|
+
*/
|
|
506
|
+
None: 3,
|
|
507
|
+
3: "None",
|
|
334
508
|
});
|
|
335
509
|
|
|
336
510
|
/**
|
|
337
|
-
* Flex
|
|
511
|
+
* Flex direction enumeration
|
|
338
512
|
*
|
|
339
|
-
* Defines the
|
|
513
|
+
* Defines the main axis direction for flex item layout. This corresponds to the CSS
|
|
514
|
+
* `flex-direction` property and determines how flex items are placed within the container.
|
|
340
515
|
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```typescript
|
|
518
|
+
* import { FlexDirection } from 'taffy-js';
|
|
519
|
+
*
|
|
520
|
+
* style.flexDirection = FlexDirection.Row; // Horizontal, left to right
|
|
521
|
+
* style.flexDirection = FlexDirection.Column; // Vertical, top to bottom
|
|
522
|
+
* ```
|
|
346
523
|
* @enum {0 | 1 | 2 | 3}
|
|
347
524
|
*/
|
|
348
525
|
export const FlexDirection = Object.freeze({
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
526
|
+
/**
|
|
527
|
+
* Main axis runs horizontally from left to right
|
|
528
|
+
*/
|
|
529
|
+
Row: 0,
|
|
530
|
+
0: "Row",
|
|
531
|
+
/**
|
|
532
|
+
* Main axis runs vertically from top to bottom
|
|
533
|
+
*/
|
|
534
|
+
Column: 1,
|
|
535
|
+
1: "Column",
|
|
536
|
+
/**
|
|
537
|
+
* Main axis runs horizontally from right to left
|
|
538
|
+
*/
|
|
539
|
+
RowReverse: 2,
|
|
540
|
+
2: "RowReverse",
|
|
541
|
+
/**
|
|
542
|
+
* Main axis runs vertically from bottom to top
|
|
543
|
+
*/
|
|
544
|
+
ColumnReverse: 3,
|
|
545
|
+
3: "ColumnReverse",
|
|
353
546
|
});
|
|
354
547
|
|
|
355
548
|
/**
|
|
356
|
-
* Flex wrap mode
|
|
549
|
+
* Flex wrap mode enumeration
|
|
357
550
|
*
|
|
358
|
-
* Controls whether flex items wrap onto multiple lines
|
|
551
|
+
* Controls whether flex items wrap onto multiple lines when they overflow the container.
|
|
552
|
+
* This corresponds to the CSS `flex-wrap` property.
|
|
359
553
|
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```typescript
|
|
556
|
+
* import { FlexWrap } from 'taffy-js';
|
|
557
|
+
*
|
|
558
|
+
* style.flexWrap = FlexWrap.NoWrap; // All items on single line
|
|
559
|
+
* style.flexWrap = FlexWrap.Wrap; // Items wrap to new lines
|
|
560
|
+
* ```
|
|
364
561
|
* @enum {0 | 1 | 2}
|
|
365
562
|
*/
|
|
366
563
|
export const FlexWrap = Object.freeze({
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
564
|
+
/**
|
|
565
|
+
* All flex items are placed on a single line
|
|
566
|
+
*/
|
|
567
|
+
NoWrap: 0,
|
|
568
|
+
0: "NoWrap",
|
|
569
|
+
/**
|
|
570
|
+
* Flex items wrap onto multiple lines from top to bottom
|
|
571
|
+
*/
|
|
572
|
+
Wrap: 1,
|
|
573
|
+
1: "Wrap",
|
|
574
|
+
/**
|
|
575
|
+
* Flex items wrap onto multiple lines from bottom to top
|
|
576
|
+
*/
|
|
577
|
+
WrapReverse: 2,
|
|
578
|
+
2: "WrapReverse",
|
|
370
579
|
});
|
|
371
580
|
|
|
372
581
|
/**
|
|
373
|
-
* Main axis alignment
|
|
582
|
+
* Main axis alignment enumeration
|
|
374
583
|
*
|
|
375
|
-
* Defines
|
|
376
|
-
*
|
|
584
|
+
* Defines how flex items are aligned and spaced along the main axis.
|
|
585
|
+
* This corresponds to the CSS `justify-content` property.
|
|
377
586
|
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* import { JustifyContent } from 'taffy-js';
|
|
590
|
+
*
|
|
591
|
+
* style.justifyContent = JustifyContent.Center; // Center items
|
|
592
|
+
* style.justifyContent = JustifyContent.SpaceBetween; // Distribute evenly
|
|
593
|
+
* ```
|
|
385
594
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
|
|
386
595
|
*/
|
|
387
596
|
export const JustifyContent = Object.freeze({
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
597
|
+
/**
|
|
598
|
+
* Items packed toward the start of the main axis
|
|
599
|
+
*/
|
|
600
|
+
Start: 0,
|
|
601
|
+
0: "Start",
|
|
602
|
+
/**
|
|
603
|
+
* Items packed toward the end of the main axis
|
|
604
|
+
*/
|
|
605
|
+
End: 1,
|
|
606
|
+
1: "End",
|
|
607
|
+
/**
|
|
608
|
+
* Items packed toward the start of the flex container
|
|
609
|
+
*/
|
|
610
|
+
FlexStart: 2,
|
|
611
|
+
2: "FlexStart",
|
|
612
|
+
/**
|
|
613
|
+
* Items packed toward the end of the flex container
|
|
614
|
+
*/
|
|
615
|
+
FlexEnd: 3,
|
|
616
|
+
3: "FlexEnd",
|
|
617
|
+
/**
|
|
618
|
+
* Items centered along the main axis
|
|
619
|
+
*/
|
|
620
|
+
Center: 4,
|
|
621
|
+
4: "Center",
|
|
622
|
+
/**
|
|
623
|
+
* Items stretched along the main axis
|
|
624
|
+
*/
|
|
625
|
+
Stretch: 5,
|
|
626
|
+
5: "Stretch",
|
|
627
|
+
/**
|
|
628
|
+
* Items evenly distributed with first/last at edges
|
|
629
|
+
*/
|
|
630
|
+
SpaceBetween: 6,
|
|
631
|
+
6: "SpaceBetween",
|
|
632
|
+
/**
|
|
633
|
+
* Items evenly distributed with equal space around each
|
|
634
|
+
*/
|
|
635
|
+
SpaceAround: 7,
|
|
636
|
+
7: "SpaceAround",
|
|
637
|
+
/**
|
|
638
|
+
* Items evenly distributed with equal space between each
|
|
639
|
+
*/
|
|
640
|
+
SpaceEvenly: 8,
|
|
641
|
+
8: "SpaceEvenly",
|
|
397
642
|
});
|
|
398
643
|
|
|
399
644
|
/**
|
|
400
|
-
*
|
|
645
|
+
* Computed layout result containing position, size, and spacing values for a node.
|
|
646
|
+
*
|
|
647
|
+
* This class wraps the native [`taffy::Layout`] and provides read-only access
|
|
648
|
+
* to all computed layout values. All dimensions are in pixels.
|
|
401
649
|
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```typescript
|
|
652
|
+
* const layout = tree.getLayout(node);
|
|
405
653
|
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
654
|
+
* console.log("Position:", layout.x, layout.y);
|
|
655
|
+
* console.log("Size:", layout.width, layout.height);
|
|
656
|
+
* console.log("Content:", layout.contentWidth, layout.contentHeight);
|
|
657
|
+
* console.log("Padding:", layout.paddingTop, layout.paddingRight, layout.paddingBottom, layout.paddingLeft);
|
|
658
|
+
* console.log("Border:", layout.borderTop, layout.borderRight, layout.borderBottom, layout.borderLeft);
|
|
659
|
+
* console.log("Margin:", layout.marginTop, layout.marginRight, layout.marginBottom, layout.marginLeft);
|
|
660
|
+
* console.log("Scrollbar:", layout.scrollbarWidth, layout.scrollbarHeight);
|
|
661
|
+
* console.log("Order:", layout.order);
|
|
662
|
+
* ```
|
|
415
663
|
*/
|
|
416
664
|
export class Layout {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
665
|
+
static __wrap(ptr) {
|
|
666
|
+
ptr = ptr >>> 0;
|
|
667
|
+
const obj = Object.create(Layout.prototype);
|
|
668
|
+
obj.__wbg_ptr = ptr;
|
|
669
|
+
LayoutFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
670
|
+
return obj;
|
|
671
|
+
}
|
|
672
|
+
__destroy_into_raw() {
|
|
673
|
+
const ptr = this.__wbg_ptr;
|
|
674
|
+
this.__wbg_ptr = 0;
|
|
675
|
+
LayoutFinalization.unregister(this);
|
|
676
|
+
return ptr;
|
|
677
|
+
}
|
|
678
|
+
free() {
|
|
679
|
+
const ptr = this.__destroy_into_raw();
|
|
680
|
+
wasm.__wbg_layout_free(ptr, 0);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Gets the top border width
|
|
684
|
+
*
|
|
685
|
+
* @returns - The computed top border width in pixels
|
|
686
|
+
* @returns {number}
|
|
687
|
+
*/
|
|
688
|
+
get borderTop() {
|
|
689
|
+
const ret = wasm.layout_borderTop(this.__wbg_ptr);
|
|
690
|
+
return ret;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Gets the top margin
|
|
694
|
+
*
|
|
695
|
+
* @returns - The computed top margin in pixels
|
|
696
|
+
* @returns {number}
|
|
697
|
+
*/
|
|
698
|
+
get marginTop() {
|
|
699
|
+
const ret = wasm.layout_marginTop(this.__wbg_ptr);
|
|
700
|
+
return ret;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Gets the left border width
|
|
704
|
+
*
|
|
705
|
+
* @returns - The computed left border width in pixels
|
|
706
|
+
* @returns {number}
|
|
707
|
+
*/
|
|
708
|
+
get borderLeft() {
|
|
709
|
+
const ret = wasm.layout_borderLeft(this.__wbg_ptr);
|
|
710
|
+
return ret;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Gets the left margin
|
|
714
|
+
*
|
|
715
|
+
* @returns - The computed left margin in pixels
|
|
716
|
+
* @returns {number}
|
|
717
|
+
*/
|
|
718
|
+
get marginLeft() {
|
|
719
|
+
const ret = wasm.layout_marginLeft(this.__wbg_ptr);
|
|
720
|
+
return ret;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Gets the top padding
|
|
724
|
+
*
|
|
725
|
+
* @returns - The computed top padding in pixels
|
|
726
|
+
* @returns {number}
|
|
727
|
+
*/
|
|
728
|
+
get paddingTop() {
|
|
729
|
+
const ret = wasm.layout_paddingTop(this.__wbg_ptr);
|
|
730
|
+
return ret;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Gets the right border width
|
|
734
|
+
*
|
|
735
|
+
* @returns - The computed right border width in pixels
|
|
736
|
+
* @returns {number}
|
|
737
|
+
*/
|
|
738
|
+
get borderRight() {
|
|
739
|
+
const ret = wasm.layout_borderRight(this.__wbg_ptr);
|
|
740
|
+
return ret;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Gets the right margin
|
|
744
|
+
*
|
|
745
|
+
* @returns - The computed right margin in pixels
|
|
746
|
+
* @returns {number}
|
|
747
|
+
*/
|
|
748
|
+
get marginRight() {
|
|
749
|
+
const ret = wasm.layout_marginRight(this.__wbg_ptr);
|
|
750
|
+
return ret;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Gets the left padding
|
|
754
|
+
*
|
|
755
|
+
* @returns - The computed left padding in pixels
|
|
756
|
+
* @returns {number}
|
|
757
|
+
*/
|
|
758
|
+
get paddingLeft() {
|
|
759
|
+
const ret = wasm.layout_paddingLeft(this.__wbg_ptr);
|
|
760
|
+
return ret;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Gets the bottom border width
|
|
764
|
+
*
|
|
765
|
+
* @returns - The computed bottom border width in pixels
|
|
766
|
+
* @returns {number}
|
|
767
|
+
*/
|
|
768
|
+
get borderBottom() {
|
|
769
|
+
const ret = wasm.layout_borderBottom(this.__wbg_ptr);
|
|
770
|
+
return ret;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Gets the width of the scrollable content
|
|
774
|
+
*
|
|
775
|
+
* If the node has overflow content, this represents the total
|
|
776
|
+
* width of all content (may exceed `width`).
|
|
777
|
+
*
|
|
778
|
+
* @returns - The content width in pixels
|
|
779
|
+
* @returns {number}
|
|
780
|
+
*/
|
|
781
|
+
get contentWidth() {
|
|
782
|
+
const ret = wasm.layout_contentWidth(this.__wbg_ptr);
|
|
783
|
+
return ret;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Gets the bottom margin
|
|
787
|
+
*
|
|
788
|
+
* @returns - The computed bottom margin in pixels
|
|
789
|
+
* @returns {number}
|
|
790
|
+
*/
|
|
791
|
+
get marginBottom() {
|
|
792
|
+
const ret = wasm.layout_marginBottom(this.__wbg_ptr);
|
|
793
|
+
return ret;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Gets the right padding
|
|
797
|
+
*
|
|
798
|
+
* @returns - The computed right padding in pixels
|
|
799
|
+
* @returns {number}
|
|
800
|
+
*/
|
|
801
|
+
get paddingRight() {
|
|
802
|
+
const ret = wasm.layout_paddingRight(this.__wbg_ptr);
|
|
803
|
+
return ret;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Gets the height of the scrollable content
|
|
807
|
+
*
|
|
808
|
+
* If the node has overflow content, this represents the total
|
|
809
|
+
* height of all content (may exceed `height`).
|
|
810
|
+
*
|
|
811
|
+
* @returns - The content height in pixels
|
|
812
|
+
* @returns {number}
|
|
813
|
+
*/
|
|
814
|
+
get contentHeight() {
|
|
815
|
+
const ret = wasm.layout_contentHeight(this.__wbg_ptr);
|
|
816
|
+
return ret;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Gets the bottom padding
|
|
820
|
+
*
|
|
821
|
+
* @returns - The computed bottom padding in pixels
|
|
822
|
+
* @returns {number}
|
|
823
|
+
*/
|
|
824
|
+
get paddingBottom() {
|
|
825
|
+
const ret = wasm.layout_paddingBottom(this.__wbg_ptr);
|
|
826
|
+
return ret;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Gets the width of the vertical scrollbar
|
|
830
|
+
*
|
|
831
|
+
* When overflow is set to scroll, this indicates the space
|
|
832
|
+
* reserved for the vertical scrollbar.
|
|
833
|
+
*
|
|
834
|
+
* @returns - The scrollbar width in pixels (0 if no scrollbar)
|
|
835
|
+
* @returns {number}
|
|
836
|
+
*/
|
|
837
|
+
get scrollbarWidth() {
|
|
838
|
+
const ret = wasm.layout_scrollbarWidth(this.__wbg_ptr);
|
|
839
|
+
return ret;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Gets the height of the horizontal scrollbar
|
|
843
|
+
*
|
|
844
|
+
* When overflow is set to scroll, this indicates the space
|
|
845
|
+
* reserved for the horizontal scrollbar.
|
|
846
|
+
*
|
|
847
|
+
* @returns - The scrollbar height in pixels (0 if no scrollbar)
|
|
848
|
+
* @returns {number}
|
|
849
|
+
*/
|
|
850
|
+
get scrollbarHeight() {
|
|
851
|
+
const ret = wasm.layout_scrollbarHeight(this.__wbg_ptr);
|
|
852
|
+
return ret;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Gets the X coordinate of the node's top-left corner
|
|
856
|
+
*
|
|
857
|
+
* This value is relative to the node's parent. For the root node,
|
|
858
|
+
* this is always 0.
|
|
859
|
+
*
|
|
860
|
+
* @returns - The horizontal position in pixels
|
|
861
|
+
* @returns {number}
|
|
862
|
+
*/
|
|
863
|
+
get x() {
|
|
864
|
+
const ret = wasm.layout_x(this.__wbg_ptr);
|
|
865
|
+
return ret;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Gets the Y coordinate of the node's top-left corner
|
|
869
|
+
*
|
|
870
|
+
* This value is relative to the node's parent. For the root node,
|
|
871
|
+
* this is always 0.
|
|
872
|
+
*
|
|
873
|
+
* @returns - The vertical position in pixels
|
|
874
|
+
* @returns {number}
|
|
875
|
+
*/
|
|
876
|
+
get y() {
|
|
877
|
+
const ret = wasm.layout_y(this.__wbg_ptr);
|
|
878
|
+
return ret;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Gets the rendering order of the node
|
|
882
|
+
*
|
|
883
|
+
* This value determines the z-order for overlapping elements.
|
|
884
|
+
* Lower values are rendered first (behind higher values).
|
|
885
|
+
*
|
|
886
|
+
* @returns - The rendering order as an unsigned 32-bit integer
|
|
887
|
+
* @returns {number}
|
|
888
|
+
*/
|
|
889
|
+
get order() {
|
|
890
|
+
const ret = wasm.layout_order(this.__wbg_ptr);
|
|
891
|
+
return ret >>> 0;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Gets the computed width of the node
|
|
895
|
+
*
|
|
896
|
+
* This is the final width after layout computation, including
|
|
897
|
+
* any constraints from min/max size or flex properties.
|
|
898
|
+
*
|
|
899
|
+
* @returns - The width in pixels
|
|
900
|
+
* @returns {number}
|
|
901
|
+
*/
|
|
902
|
+
get width() {
|
|
903
|
+
const ret = wasm.layout_width(this.__wbg_ptr);
|
|
904
|
+
return ret;
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Gets the computed height of the node
|
|
908
|
+
*
|
|
909
|
+
* This is the final height after layout computation, including
|
|
910
|
+
* any constraints from min/max size or flex properties.
|
|
911
|
+
*
|
|
912
|
+
* @returns - The height in pixels
|
|
913
|
+
* @returns {number}
|
|
914
|
+
*/
|
|
915
|
+
get height() {
|
|
916
|
+
const ret = wasm.layout_height(this.__wbg_ptr);
|
|
917
|
+
return ret;
|
|
918
|
+
}
|
|
602
919
|
}
|
|
603
920
|
if (Symbol.dispose) Layout.prototype[Symbol.dispose] = Layout.prototype.free;
|
|
604
921
|
|
|
605
922
|
/**
|
|
606
|
-
* Overflow handling
|
|
923
|
+
* Overflow handling enumeration
|
|
924
|
+
*
|
|
925
|
+
* Defines how content that exceeds the container boundaries is handled.
|
|
926
|
+
* This corresponds to the CSS `overflow` property.
|
|
607
927
|
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
928
|
+
* @example
|
|
929
|
+
* ```typescript
|
|
930
|
+
* import { Overflow } from 'taffy-js';
|
|
610
931
|
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
* - `Hidden`: Content is clipped, overflow hidden
|
|
614
|
-
* - `Scroll`: Always show scrollbars
|
|
615
|
-
* - `Auto`: Show scrollbars when needed (internally mapped to Scroll)
|
|
932
|
+
* style.overflow = { x: Overflow.Hidden, y: Overflow.Scroll };
|
|
933
|
+
* ```
|
|
616
934
|
* @enum {0 | 1 | 2 | 3}
|
|
617
935
|
*/
|
|
618
936
|
export const Overflow = Object.freeze({
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
937
|
+
/**
|
|
938
|
+
* Content is not clipped and may render outside the container
|
|
939
|
+
*/
|
|
940
|
+
Visible: 0,
|
|
941
|
+
0: "Visible",
|
|
942
|
+
/**
|
|
943
|
+
* Content is clipped at the container boundary
|
|
944
|
+
*/
|
|
945
|
+
Hidden: 1,
|
|
946
|
+
1: "Hidden",
|
|
947
|
+
/**
|
|
948
|
+
* Always display scrollbars for scrollable content
|
|
949
|
+
*/
|
|
950
|
+
Scroll: 2,
|
|
951
|
+
2: "Scroll",
|
|
952
|
+
/**
|
|
953
|
+
* Display scrollbars only when content overflows (internally maps to Scroll)
|
|
954
|
+
*/
|
|
955
|
+
Auto: 3,
|
|
956
|
+
3: "Auto",
|
|
623
957
|
});
|
|
624
958
|
|
|
625
959
|
/**
|
|
626
|
-
* Position mode
|
|
960
|
+
* Position mode enumeration
|
|
961
|
+
*
|
|
962
|
+
* Controls how an element is positioned within its parent container.
|
|
963
|
+
* This corresponds to the CSS `position` property.
|
|
627
964
|
*
|
|
628
|
-
*
|
|
965
|
+
* @example
|
|
966
|
+
* ```typescript
|
|
967
|
+
* import { Position } from 'taffy-js';
|
|
629
968
|
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
969
|
+
* style.position = Position.Relative; // Normal document flow
|
|
970
|
+
* style.position = Position.Absolute; // Removed from flow, uses inset values
|
|
971
|
+
* ```
|
|
633
972
|
* @enum {0 | 1}
|
|
634
973
|
*/
|
|
635
974
|
export const Position = Object.freeze({
|
|
636
|
-
|
|
637
|
-
|
|
975
|
+
/**
|
|
976
|
+
* Element participates in normal document flow
|
|
977
|
+
*/
|
|
978
|
+
Relative: 0,
|
|
979
|
+
0: "Relative",
|
|
980
|
+
/**
|
|
981
|
+
* Element is positioned relative to its nearest positioned ancestor
|
|
982
|
+
*/
|
|
983
|
+
Absolute: 1,
|
|
984
|
+
1: "Absolute",
|
|
638
985
|
});
|
|
639
986
|
|
|
640
987
|
/**
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
* Configuration object containing all CSS layout properties.
|
|
644
|
-
* Access properties via getter/setter methods.
|
|
988
|
+
* CSS layout configuration for a node, including flexbox, sizing, spacing, and alignment properties.
|
|
645
989
|
*
|
|
646
|
-
*
|
|
990
|
+
* This class holds all CSS layout properties for a node. Create an instance with
|
|
991
|
+
* `new Style()` and configure properties before passing to `TaffyTree.newLeaf()`.
|
|
647
992
|
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
* - `
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
* - `
|
|
654
|
-
* - `
|
|
655
|
-
* - `
|
|
656
|
-
* - `
|
|
657
|
-
* -
|
|
658
|
-
*
|
|
659
|
-
* ## Alignment Properties
|
|
660
|
-
* - `align_items`, `align_self`, `align_content`
|
|
661
|
-
* - `justify_content`
|
|
662
|
-
*
|
|
663
|
-
* ## Sizing Properties
|
|
664
|
-
* - `size`, `min_size`, `max_size`
|
|
665
|
-
* - `aspect_ratio`: Width-to-height ratio
|
|
666
|
-
*
|
|
667
|
-
* ## Spacing Properties
|
|
668
|
-
* - `margin`, `padding`, `border`
|
|
669
|
-
* - `gap`: Gap between children
|
|
670
|
-
* - `inset`: Absolute positioning offsets
|
|
993
|
+
* @defaultValue
|
|
994
|
+
* When created, all properties are set to their CSS default values:
|
|
995
|
+
* - `display`: `Display.Block`
|
|
996
|
+
* - `position`: `Position.Relative`
|
|
997
|
+
* - `flexDirection`: `FlexDirection.Row`
|
|
998
|
+
* - `flexWrap`: `FlexWrap.NoWrap`
|
|
999
|
+
* - `flexGrow`: `0`
|
|
1000
|
+
* - `flexShrink`: `1`
|
|
1001
|
+
* - All alignment properties: `undefined` (use default behavior)
|
|
1002
|
+
* - All dimensions: `"Auto"`
|
|
1003
|
+
* - All spacing: `{ Length: 0 }`
|
|
671
1004
|
*/
|
|
672
1005
|
export class Style {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1006
|
+
static __wrap(ptr) {
|
|
1007
|
+
ptr = ptr >>> 0;
|
|
1008
|
+
const obj = Object.create(Style.prototype);
|
|
1009
|
+
obj.__wbg_ptr = ptr;
|
|
1010
|
+
StyleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1011
|
+
return obj;
|
|
1012
|
+
}
|
|
1013
|
+
__destroy_into_raw() {
|
|
1014
|
+
const ptr = this.__wbg_ptr;
|
|
1015
|
+
this.__wbg_ptr = 0;
|
|
1016
|
+
StyleFinalization.unregister(this);
|
|
1017
|
+
return ptr;
|
|
1018
|
+
}
|
|
1019
|
+
free() {
|
|
1020
|
+
const ptr = this.__destroy_into_raw();
|
|
1021
|
+
wasm.__wbg_style_free(ptr, 0);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Gets the align-self property
|
|
1025
|
+
*
|
|
1026
|
+
* Overrides the parent's align-items for this specific element.
|
|
1027
|
+
*
|
|
1028
|
+
* @returns - The current [`AlignSelf`](JsAlignSelf) value (returns `Auto` if not set)
|
|
1029
|
+
* @returns {AlignSelf | undefined}
|
|
1030
|
+
*/
|
|
1031
|
+
get alignSelf() {
|
|
1032
|
+
const ret = wasm.style_alignSelf(this.__wbg_ptr);
|
|
1033
|
+
return ret === 8 ? undefined : ret;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Gets the box sizing mode
|
|
1037
|
+
*
|
|
1038
|
+
* Determines whether padding and border are included in dimensions.
|
|
1039
|
+
*
|
|
1040
|
+
* @returns - The current [`BoxSizing`](JsBoxSizing) value
|
|
1041
|
+
*
|
|
1042
|
+
* @defaultValue `BoxSizing.BorderBox`
|
|
1043
|
+
* @returns {BoxSizing}
|
|
1044
|
+
*/
|
|
1045
|
+
get boxSizing() {
|
|
1046
|
+
const ret = wasm.style_boxSizing(this.__wbg_ptr);
|
|
1047
|
+
return ret;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Gets the flex-basis
|
|
1051
|
+
*
|
|
1052
|
+
* The initial size of a flex item before growing/shrinking.
|
|
1053
|
+
*
|
|
1054
|
+
* @returns - A `Dimension` value (`{ Length: n }`, `{ Percent: n }`, or `"Auto"`)
|
|
1055
|
+
* @returns {Dimension}
|
|
1056
|
+
*/
|
|
1057
|
+
get flexBasis() {
|
|
1058
|
+
const ret = wasm.style_flexBasis(this.__wbg_ptr);
|
|
1059
|
+
return ret;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Sets the border width
|
|
1063
|
+
*
|
|
1064
|
+
* @param val - A Rect object with LengthPercentage values
|
|
1065
|
+
*
|
|
1066
|
+
* @example
|
|
1067
|
+
* ```typescript
|
|
1068
|
+
* style.border = { left: { Length: 1 }, right: { Length: 1 }, top: { Length: 1 }, bottom: { Length: 1 } };
|
|
1069
|
+
* ```
|
|
1070
|
+
* @param {Rect<LengthPercentage>} val
|
|
1071
|
+
*/
|
|
1072
|
+
set border(val) {
|
|
1073
|
+
wasm.style_set_border(this.__wbg_ptr, val);
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Sets the margin
|
|
1077
|
+
*
|
|
1078
|
+
* @param val - A Rect object with LengthPercentageAuto values
|
|
1079
|
+
*
|
|
1080
|
+
* @example
|
|
1081
|
+
* ```typescript
|
|
1082
|
+
* style.margin = { left: { Length: 10 }, right: { Length: 10 }, top: { Length: 5 }, bottom: { Length: 5 } };
|
|
1083
|
+
* ```
|
|
1084
|
+
* @param {Rect<LengthPercentageAuto>} val
|
|
1085
|
+
*/
|
|
1086
|
+
set margin(val) {
|
|
1087
|
+
wasm.style_set_margin(this.__wbg_ptr, val);
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Gets the align-items property
|
|
1091
|
+
*
|
|
1092
|
+
* Defines the default alignment for all children on the cross axis.
|
|
1093
|
+
*
|
|
1094
|
+
* @returns - The current [`AlignItems`](JsAlignItems) value, or `undefined` if not set
|
|
1095
|
+
* @returns {AlignItems | undefined}
|
|
1096
|
+
*/
|
|
1097
|
+
get alignItems() {
|
|
1098
|
+
const ret = wasm.style_alignItems(this.__wbg_ptr);
|
|
1099
|
+
return ret === 7 ? undefined : ret;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Gets the flex shrink factor
|
|
1103
|
+
*
|
|
1104
|
+
* Determines how much the item shrinks relative to siblings when
|
|
1105
|
+
* there is insufficient space.
|
|
1106
|
+
*
|
|
1107
|
+
* @returns - The flex shrink factor (default: 1)
|
|
1108
|
+
* @returns {number}
|
|
1109
|
+
*/
|
|
1110
|
+
get flexShrink() {
|
|
1111
|
+
const ret = wasm.style_flexShrink(this.__wbg_ptr);
|
|
1112
|
+
return ret;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Sets the display mode
|
|
1116
|
+
*
|
|
1117
|
+
* @param val - The new display mode
|
|
1118
|
+
*
|
|
1119
|
+
*
|
|
1120
|
+
* @example
|
|
1121
|
+
*
|
|
1122
|
+
* ```typescript
|
|
1123
|
+
* style.display = Display.Flex;
|
|
1124
|
+
* ```
|
|
1125
|
+
* @param {Display} val
|
|
1126
|
+
*/
|
|
1127
|
+
set display(val) {
|
|
1128
|
+
wasm.style_set_display(this.__wbg_ptr, val);
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Sets the padding
|
|
1132
|
+
*
|
|
1133
|
+
* @param val - A Rect object with LengthPercentage values
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* ```typescript
|
|
1137
|
+
* style.padding = { left: { Length: 20 }, right: { Length: 20 }, top: { Length: 10 }, bottom: { Length: 10 } };
|
|
1138
|
+
* ```
|
|
1139
|
+
* @param {Rect<LengthPercentage>} val
|
|
1140
|
+
*/
|
|
1141
|
+
set padding(val) {
|
|
1142
|
+
wasm.style_set_padding(this.__wbg_ptr, val);
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Gets the aspect ratio
|
|
1146
|
+
*
|
|
1147
|
+
* The ratio of width to height. Used to maintain proportions.
|
|
1148
|
+
*
|
|
1149
|
+
* @returns - The aspect ratio value, or `undefined` if not set
|
|
1150
|
+
* @returns {number | undefined}
|
|
1151
|
+
*/
|
|
1152
|
+
get aspectRatio() {
|
|
1153
|
+
const ret = wasm.style_aspectRatio(this.__wbg_ptr);
|
|
1154
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Sets the maximum size constraints
|
|
1158
|
+
*
|
|
1159
|
+
* @param val - A Size object with maximum Dimension values
|
|
1160
|
+
*
|
|
1161
|
+
* @example
|
|
1162
|
+
* ```typescript
|
|
1163
|
+
* style.maxSize = { width: "MaxContent", height: { Length: 500 } };
|
|
1164
|
+
* ```
|
|
1165
|
+
* @param {Size<Dimension>} val
|
|
1166
|
+
*/
|
|
1167
|
+
set maxSize(val) {
|
|
1168
|
+
wasm.style_set_maxSize(this.__wbg_ptr, val);
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Sets the minimum size constraints
|
|
1172
|
+
*
|
|
1173
|
+
* @param val - A Size object with minimum Dimension values
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* ```typescript
|
|
1177
|
+
* style.minSize = { width: { Length: 100 }, height: "Auto" };
|
|
1178
|
+
* ```
|
|
1179
|
+
* @param {Size<Dimension>} val
|
|
1180
|
+
*/
|
|
1181
|
+
set minSize(val) {
|
|
1182
|
+
wasm.style_set_minSize(this.__wbg_ptr, val);
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Sets the overflow behavior
|
|
1186
|
+
*
|
|
1187
|
+
* @param val - An object with `x` and `y` overflow values
|
|
1188
|
+
*
|
|
1189
|
+
* @example
|
|
1190
|
+
* ```typescript
|
|
1191
|
+
* style.overflow = { x: Overflow.Hidden, y: Overflow.Scroll };
|
|
1192
|
+
* ```
|
|
1193
|
+
* @param {Point<Overflow>} val
|
|
1194
|
+
*/
|
|
1195
|
+
set overflow(val) {
|
|
1196
|
+
wasm.style_set_overflow(this.__wbg_ptr, val);
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Sets the position mode
|
|
1200
|
+
*
|
|
1201
|
+
* @param val - The new position mode
|
|
1202
|
+
*
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
*
|
|
1206
|
+
* ```typescript
|
|
1207
|
+
* style.position = Position.Absolute;
|
|
1208
|
+
* style.inset = { left: { Length: 10 }, top: { Length: 10 }, right: "Auto", bottom: "Auto" };
|
|
1209
|
+
* ```
|
|
1210
|
+
* @param {Position} val
|
|
1211
|
+
*/
|
|
1212
|
+
set position(val) {
|
|
1213
|
+
wasm.style_set_position(this.__wbg_ptr, val);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Gets the align-content property
|
|
1217
|
+
*
|
|
1218
|
+
* Controls distribution of space between lines in a multi-line flex container.
|
|
1219
|
+
*
|
|
1220
|
+
* @returns - The current [`AlignContent`](JsAlignContent) value, or `undefined` if not set
|
|
1221
|
+
* @returns {AlignContent | undefined}
|
|
1222
|
+
*/
|
|
1223
|
+
get alignContent() {
|
|
1224
|
+
const ret = wasm.style_alignContent(this.__wbg_ptr);
|
|
1225
|
+
return ret === 9 ? undefined : ret;
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Sets the flex grow factor
|
|
1229
|
+
*
|
|
1230
|
+
* @param val - The new flex grow factor (must be >= 0)
|
|
1231
|
+
*
|
|
1232
|
+
* @example
|
|
1233
|
+
* ```typescript
|
|
1234
|
+
* style.flexGrow = 2;
|
|
1235
|
+
* ```
|
|
1236
|
+
* @param {number} val
|
|
1237
|
+
*/
|
|
1238
|
+
set flexGrow(val) {
|
|
1239
|
+
wasm.style_set_flexGrow(this.__wbg_ptr, val);
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Sets the flex wrap mode
|
|
1243
|
+
*
|
|
1244
|
+
* @param val - The new flex wrap mode
|
|
1245
|
+
*
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
*
|
|
1249
|
+
* ```typescript
|
|
1250
|
+
* style.flexWrap = FlexWrap.Wrap;
|
|
1251
|
+
* ```
|
|
1252
|
+
* @param {FlexWrap} val
|
|
1253
|
+
*/
|
|
1254
|
+
set flexWrap(val) {
|
|
1255
|
+
wasm.style_set_flexWrap(this.__wbg_ptr, val);
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Gets the flex direction
|
|
1259
|
+
*
|
|
1260
|
+
* Defines the main axis direction for flex items.
|
|
1261
|
+
*
|
|
1262
|
+
* @returns - The current [`FlexDirection`](JsFlexDirection) value
|
|
1263
|
+
*
|
|
1264
|
+
* @defaultValue - `FlexDirection.Row`
|
|
1265
|
+
* @returns {FlexDirection}
|
|
1266
|
+
*/
|
|
1267
|
+
get flexDirection() {
|
|
1268
|
+
const ret = wasm.style_flexDirection(this.__wbg_ptr);
|
|
1269
|
+
return ret;
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Sets the align-self property
|
|
1273
|
+
*
|
|
1274
|
+
* @param val - The new align-self value, or `undefined`/`Auto` to inherit from parent
|
|
1275
|
+
*
|
|
1276
|
+
* @example
|
|
1277
|
+
* ```typescript
|
|
1278
|
+
* style.alignSelf = AlignSelf.Stretch;
|
|
1279
|
+
* ```
|
|
1280
|
+
* @param {AlignSelf | undefined} val
|
|
1281
|
+
*/
|
|
1282
|
+
set alignSelf(val) {
|
|
1283
|
+
wasm.style_set_alignSelf(this.__wbg_ptr, val);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Sets the box sizing mode
|
|
1287
|
+
*
|
|
1288
|
+
* @param val - The new box sizing mode
|
|
1289
|
+
*
|
|
1290
|
+
* @example
|
|
1291
|
+
* ```typescript
|
|
1292
|
+
* style.boxSizing = BoxSizing.ContentBox;
|
|
1293
|
+
* ```
|
|
1294
|
+
* @param {BoxSizing} val
|
|
1295
|
+
*/
|
|
1296
|
+
set boxSizing(val) {
|
|
1297
|
+
wasm.style_set_boxSizing(this.__wbg_ptr, val);
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Sets the flex-basis
|
|
1301
|
+
*
|
|
1302
|
+
* @param val - The initial size as a Dimension
|
|
1303
|
+
*
|
|
1304
|
+
* @example
|
|
1305
|
+
* ```typescript
|
|
1306
|
+
* style.flexBasis = { Length: 100 };
|
|
1307
|
+
* ```
|
|
1308
|
+
* @param {Dimension} val
|
|
1309
|
+
*/
|
|
1310
|
+
set flexBasis(val) {
|
|
1311
|
+
wasm.style_set_flexBasis(this.__wbg_ptr, val);
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Gets the justify-content property
|
|
1315
|
+
*
|
|
1316
|
+
* Defines alignment and spacing of items along the main axis.
|
|
1317
|
+
*
|
|
1318
|
+
* @returns - The current [`JustifyContent`](JsJustifyContent) value, or `undefined` if not set
|
|
1319
|
+
* @returns {JustifyContent | undefined}
|
|
1320
|
+
*/
|
|
1321
|
+
get justifyContent() {
|
|
1322
|
+
const ret = wasm.style_justifyContent(this.__wbg_ptr);
|
|
1323
|
+
return ret === 9 ? undefined : ret;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Sets the align-items property
|
|
1327
|
+
*
|
|
1328
|
+
* @param val - The new align-items value, or `undefined` to use default
|
|
1329
|
+
*
|
|
1330
|
+
* @example
|
|
1331
|
+
*
|
|
1332
|
+
* ```typescript
|
|
1333
|
+
* style.alignItems = AlignItems.Center;
|
|
1334
|
+
* ```
|
|
1335
|
+
* @param {AlignItems | undefined} val
|
|
1336
|
+
*/
|
|
1337
|
+
set alignItems(val) {
|
|
1338
|
+
wasm.style_set_alignItems(this.__wbg_ptr, val);
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Sets the flex shrink factor
|
|
1342
|
+
*
|
|
1343
|
+
* @param val - The new flex shrink factor (must be >= 0)
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* ```typescript
|
|
1347
|
+
* style.flexShrink = 2;
|
|
1348
|
+
* ```
|
|
1349
|
+
* @param {number} val
|
|
1350
|
+
*/
|
|
1351
|
+
set flexShrink(val) {
|
|
1352
|
+
wasm.style_set_flexShrink(this.__wbg_ptr, val);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Sets the aspect ratio
|
|
1356
|
+
*
|
|
1357
|
+
* @param val - The new aspect ratio (width/height), or `undefined` to clear
|
|
1358
|
+
*
|
|
1359
|
+
* @example
|
|
1360
|
+
* ```typescript
|
|
1361
|
+
* style.aspectRatio = 16 / 9;
|
|
1362
|
+
* ```
|
|
1363
|
+
* @param {number | undefined} val
|
|
1364
|
+
*/
|
|
1365
|
+
set aspectRatio(val) {
|
|
1366
|
+
wasm.style_set_aspectRatio(this.__wbg_ptr, val);
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Sets the align-content property
|
|
1370
|
+
*
|
|
1371
|
+
* @param val - The new align-content value, or `undefined` to use default
|
|
1372
|
+
*
|
|
1373
|
+
* @example
|
|
1374
|
+
* ```typescript
|
|
1375
|
+
* style.alignContent = AlignContent.SpaceBetween;
|
|
1376
|
+
* ```
|
|
1377
|
+
* @param {AlignContent | undefined} val
|
|
1378
|
+
*/
|
|
1379
|
+
set alignContent(val) {
|
|
1380
|
+
wasm.style_set_alignContent(this.__wbg_ptr, val);
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Sets the flex direction
|
|
1384
|
+
*
|
|
1385
|
+
* @param val - The new flex direction
|
|
1386
|
+
*
|
|
1387
|
+
*
|
|
1388
|
+
* @example
|
|
1389
|
+
*
|
|
1390
|
+
* ```typescript
|
|
1391
|
+
* style.flexDirection = FlexDirection.Column;
|
|
1392
|
+
* ```
|
|
1393
|
+
* @param {FlexDirection} val
|
|
1394
|
+
*/
|
|
1395
|
+
set flexDirection(val) {
|
|
1396
|
+
wasm.style_set_flexDirection(this.__wbg_ptr, val);
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Sets the justify-content property
|
|
1400
|
+
*
|
|
1401
|
+
* @param val - The new justify-content value, or `undefined` to use default
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```typescript
|
|
1405
|
+
* style.justifyContent = JustifyContent.Center;
|
|
1406
|
+
* ```
|
|
1407
|
+
* @param {JustifyContent | undefined} val
|
|
1408
|
+
*/
|
|
1409
|
+
set justifyContent(val) {
|
|
1410
|
+
wasm.style_set_justifyContent(this.__wbg_ptr, val);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Gets the gap
|
|
1414
|
+
*
|
|
1415
|
+
* Spacing between flex/grid items.
|
|
1416
|
+
*
|
|
1417
|
+
* @returns - A `Size<LengthPercentage>` with column (width) and row (height) gaps
|
|
1418
|
+
* @returns {Size<LengthPercentage>}
|
|
1419
|
+
*/
|
|
1420
|
+
get gap() {
|
|
1421
|
+
const ret = wasm.style_gap(this.__wbg_ptr);
|
|
1422
|
+
return ret;
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Creates a new Style instance with default values
|
|
1426
|
+
*
|
|
1427
|
+
* @returns - A new `Style` object with all properties set to CSS defaults
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* const style = new Style();
|
|
1432
|
+
* console.log(style.display); // Display.Block
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
constructor() {
|
|
1436
|
+
const ret = wasm.style_new();
|
|
1437
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1438
|
+
StyleFinalization.register(this, this.__wbg_ptr, this);
|
|
1439
|
+
return this;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Gets the size (width and height)
|
|
1443
|
+
*
|
|
1444
|
+
* @returns - A `Size<Dimension>` object with `width` and `height` properties
|
|
1445
|
+
* @returns {Size<Dimension>}
|
|
1446
|
+
*/
|
|
1447
|
+
get size() {
|
|
1448
|
+
const ret = wasm.style_size(this.__wbg_ptr);
|
|
1449
|
+
return ret;
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Gets the inset
|
|
1453
|
+
*
|
|
1454
|
+
* Positioning offsets for absolutely positioned elements.
|
|
1455
|
+
*
|
|
1456
|
+
* @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom offsets
|
|
1457
|
+
* @returns {Rect<LengthPercentageAuto>}
|
|
1458
|
+
*/
|
|
1459
|
+
get inset() {
|
|
1460
|
+
const ret = wasm.style_inset(this.__wbg_ptr);
|
|
1461
|
+
return ret;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Gets the border width
|
|
1465
|
+
*
|
|
1466
|
+
* Width of the element's border on each side.
|
|
1467
|
+
*
|
|
1468
|
+
* @returns - A `Rect<LengthPercentage>` with left, right, top, bottom border widths
|
|
1469
|
+
* @returns {Rect<LengthPercentage>}
|
|
1470
|
+
*/
|
|
1471
|
+
get border() {
|
|
1472
|
+
const ret = wasm.style_border(this.__wbg_ptr);
|
|
1473
|
+
return ret;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Gets the margin
|
|
1477
|
+
*
|
|
1478
|
+
* Outer spacing around the element.
|
|
1479
|
+
*
|
|
1480
|
+
* @returns - A `Rect<LengthPercentageAuto>` with left, right, top, bottom margins
|
|
1481
|
+
* @returns {Rect<LengthPercentageAuto>}
|
|
1482
|
+
*/
|
|
1483
|
+
get margin() {
|
|
1484
|
+
const ret = wasm.style_margin(this.__wbg_ptr);
|
|
1485
|
+
return ret;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Gets the display mode
|
|
1489
|
+
*
|
|
1490
|
+
* Determines the layout algorithm used for this element and its children.
|
|
1491
|
+
*
|
|
1492
|
+
* @returns - The current [`Display`](JsDisplay) value
|
|
1493
|
+
*
|
|
1494
|
+
* @defaultValue - `Display.Block`
|
|
1495
|
+
* @returns {Display}
|
|
1496
|
+
*/
|
|
1497
|
+
get display() {
|
|
1498
|
+
const ret = wasm.style_display(this.__wbg_ptr);
|
|
1499
|
+
return ret;
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Gets the padding
|
|
1503
|
+
*
|
|
1504
|
+
* Inner spacing between the element's border and content.
|
|
1505
|
+
*
|
|
1506
|
+
* @returns - A `Rect<LengthPercentage>` with left, right, top, bottom padding
|
|
1507
|
+
* @returns {Rect<LengthPercentage>}
|
|
1508
|
+
*/
|
|
1509
|
+
get padding() {
|
|
1510
|
+
const ret = wasm.style_padding(this.__wbg_ptr);
|
|
1511
|
+
return ret;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Sets the gap
|
|
1515
|
+
*
|
|
1516
|
+
* @param val - A Size object with LengthPercentage gap values
|
|
1517
|
+
*
|
|
1518
|
+
* @example
|
|
1519
|
+
* ```typescript
|
|
1520
|
+
* style.gap = { width: { Length: 10 }, height: { Length: 10 } };
|
|
1521
|
+
* ```
|
|
1522
|
+
* @param {Size<LengthPercentage>} val
|
|
1523
|
+
*/
|
|
1524
|
+
set gap(val) {
|
|
1525
|
+
wasm.style_set_gap(this.__wbg_ptr, val);
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Gets the maximum size constraints
|
|
1529
|
+
*
|
|
1530
|
+
* @returns - A `Size<Dimension>` object with maximum width and height
|
|
1531
|
+
* @returns {Size<Dimension>}
|
|
1532
|
+
*/
|
|
1533
|
+
get maxSize() {
|
|
1534
|
+
const ret = wasm.style_maxSize(this.__wbg_ptr);
|
|
1535
|
+
return ret;
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Gets the minimum size constraints
|
|
1539
|
+
*
|
|
1540
|
+
* @returns - A `Size<Dimension>` object with minimum width and height
|
|
1541
|
+
* @returns {Size<Dimension>}
|
|
1542
|
+
*/
|
|
1543
|
+
get minSize() {
|
|
1544
|
+
const ret = wasm.style_minSize(this.__wbg_ptr);
|
|
1545
|
+
return ret;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Gets the overflow behavior
|
|
1549
|
+
*
|
|
1550
|
+
* Controls how content that exceeds the container is handled.
|
|
1551
|
+
*
|
|
1552
|
+
* @returns - A `Point<Overflow>` with `x` and `y` overflow settings
|
|
1553
|
+
* @returns {Point<Overflow>}
|
|
1554
|
+
*/
|
|
1555
|
+
get overflow() {
|
|
1556
|
+
const ret = wasm.style_overflow(this.__wbg_ptr);
|
|
1557
|
+
return ret;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Gets the position mode
|
|
1561
|
+
*
|
|
1562
|
+
* Determines how the element is positioned within its parent.
|
|
1563
|
+
*
|
|
1564
|
+
* @returns - The current [`Position`](JsPosition) value
|
|
1565
|
+
*
|
|
1566
|
+
* @defaultValue - `Position.Relative`
|
|
1567
|
+
* @returns {Position}
|
|
1568
|
+
*/
|
|
1569
|
+
get position() {
|
|
1570
|
+
const ret = wasm.style_position(this.__wbg_ptr);
|
|
1571
|
+
return ret;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Sets the size (width and height)
|
|
1575
|
+
*
|
|
1576
|
+
* @param val - A Size object with Dimension values
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* ```typescript
|
|
1580
|
+
* style.size = { width: { Length: 200 }, height: { Percent: 100 } };
|
|
1581
|
+
* ```
|
|
1582
|
+
* @param {Size<Dimension>} val
|
|
1583
|
+
*/
|
|
1584
|
+
set size(val) {
|
|
1585
|
+
wasm.style_set_size(this.__wbg_ptr, val);
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Gets the flex grow factor
|
|
1589
|
+
*
|
|
1590
|
+
* Determines how much the item grows relative to siblings when
|
|
1591
|
+
* there is extra space available.
|
|
1592
|
+
*
|
|
1593
|
+
* @returns - The flex grow factor (default: 0)
|
|
1594
|
+
* @returns {number}
|
|
1595
|
+
*/
|
|
1596
|
+
get flexGrow() {
|
|
1597
|
+
const ret = wasm.style_flexGrow(this.__wbg_ptr);
|
|
1598
|
+
return ret;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Gets the flex wrap mode
|
|
1602
|
+
*
|
|
1603
|
+
* Controls whether flex items wrap to new lines.
|
|
1604
|
+
*
|
|
1605
|
+
* @returns - The current [`FlexWrap`](JsFlexWrap) value
|
|
1606
|
+
*
|
|
1607
|
+
* @defaultValue - `FlexWrap.NoWrap`
|
|
1608
|
+
* @returns {FlexWrap}
|
|
1609
|
+
*/
|
|
1610
|
+
get flexWrap() {
|
|
1611
|
+
const ret = wasm.style_flexWrap(this.__wbg_ptr);
|
|
1612
|
+
return ret;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Sets the inset
|
|
1616
|
+
*
|
|
1617
|
+
* @param val - A Rect object with LengthPercentageAuto offset values
|
|
1618
|
+
*
|
|
1619
|
+
* @example
|
|
1620
|
+
* ```typescript
|
|
1621
|
+
* style.position = Position.Absolute;
|
|
1622
|
+
* style.inset = { left: { Length: 0 }, top: { Length: 0 }, right: "Auto", bottom: "Auto" };
|
|
1623
|
+
* ```
|
|
1624
|
+
* @param {Rect<LengthPercentageAuto>} val
|
|
1625
|
+
*/
|
|
1626
|
+
set inset(val) {
|
|
1627
|
+
wasm.style_set_inset(this.__wbg_ptr, val);
|
|
1628
|
+
}
|
|
1079
1629
|
}
|
|
1080
1630
|
if (Symbol.dispose) Style.prototype[Symbol.dispose] = Style.prototype.free;
|
|
1081
1631
|
|
|
1082
1632
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1085
|
-
* This is the main entry point for the Taffy layout engine. It wraps the native
|
|
1086
|
-
* `taffy::TaffyTree<JsValue>` to provide a JavaScript-friendly API.
|
|
1633
|
+
* Error class thrown when a Taffy operation fails, containing a human-readable error message.
|
|
1087
1634
|
*
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
* - **Style Control**: Get/set styles for any node
|
|
1091
|
-
* - **Layout Computation**: Run Flexbox/Grid/Block layout algorithms
|
|
1092
|
-
* - **Custom Measurement**: Support for text measurement via callback functions
|
|
1093
|
-
* - **Node Context**: Attach arbitrary JS data to nodes for custom logic
|
|
1635
|
+
* This class wraps the native [`taffy::TaffyError`] type and exposes it to JavaScript
|
|
1636
|
+
* with a readable error message. It is thrown as a JavaScript exception on failure.
|
|
1094
1637
|
*
|
|
1095
|
-
*
|
|
1096
|
-
* ```
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```typescript
|
|
1640
|
+
* try {
|
|
1641
|
+
* tree.remove(node);
|
|
1642
|
+
* } catch (e) {
|
|
1643
|
+
* if (e instanceof TaffyError) {
|
|
1644
|
+
* console.error(e.message);
|
|
1645
|
+
* }
|
|
1646
|
+
* }
|
|
1103
1647
|
* ```
|
|
1648
|
+
*
|
|
1649
|
+
* @remarks
|
|
1650
|
+
* The underlying Taffy errors include:
|
|
1651
|
+
* - `InvalidInputNode`: Node ID doesn't exist in the tree
|
|
1652
|
+
* - `InvalidParentNode`: Specified parent node doesn't exist
|
|
1653
|
+
* - `ChildIndexOutOfBounds`: Child index exceeds available children
|
|
1654
|
+
*/
|
|
1655
|
+
export class TaffyError {
|
|
1656
|
+
static __wrap(ptr) {
|
|
1657
|
+
ptr = ptr >>> 0;
|
|
1658
|
+
const obj = Object.create(TaffyError.prototype);
|
|
1659
|
+
obj.__wbg_ptr = ptr;
|
|
1660
|
+
TaffyErrorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1661
|
+
return obj;
|
|
1662
|
+
}
|
|
1663
|
+
__destroy_into_raw() {
|
|
1664
|
+
const ptr = this.__wbg_ptr;
|
|
1665
|
+
this.__wbg_ptr = 0;
|
|
1666
|
+
TaffyErrorFinalization.unregister(this);
|
|
1667
|
+
return ptr;
|
|
1668
|
+
}
|
|
1669
|
+
free() {
|
|
1670
|
+
const ptr = this.__destroy_into_raw();
|
|
1671
|
+
wasm.__wbg_taffyerror_free(ptr, 0);
|
|
1672
|
+
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Gets the human-readable error message
|
|
1675
|
+
*
|
|
1676
|
+
* @returns - A string describing what went wrong.
|
|
1677
|
+
*
|
|
1678
|
+
* @remarks
|
|
1679
|
+
* Examples:
|
|
1680
|
+
* - "Node with id 1234 is not present in the Taffy tree"
|
|
1681
|
+
* - "Index 5 is out of bounds for node with 3 children"
|
|
1682
|
+
* @returns {string}
|
|
1683
|
+
*/
|
|
1684
|
+
get message() {
|
|
1685
|
+
let deferred1_0;
|
|
1686
|
+
let deferred1_1;
|
|
1687
|
+
try {
|
|
1688
|
+
const ret = wasm.taffyerror_message(this.__wbg_ptr);
|
|
1689
|
+
deferred1_0 = ret[0];
|
|
1690
|
+
deferred1_1 = ret[1];
|
|
1691
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1692
|
+
} finally {
|
|
1693
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
if (Symbol.dispose)
|
|
1698
|
+
TaffyError.prototype[Symbol.dispose] = TaffyError.prototype.free;
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* The main layout tree class for creating nodes, computing layouts, and managing a tree of styled elements.
|
|
1702
|
+
*
|
|
1703
|
+
* TaffyTree is the entry point for the Taffy layout engine. It manages
|
|
1704
|
+
* a tree of nodes and computes their layouts using CSS Flexbox and Grid algorithms.
|
|
1104
1705
|
*/
|
|
1105
1706
|
export class TaffyTree {
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1707
|
+
static __wrap(ptr) {
|
|
1708
|
+
ptr = ptr >>> 0;
|
|
1709
|
+
const obj = Object.create(TaffyTree.prototype);
|
|
1710
|
+
obj.__wbg_ptr = ptr;
|
|
1711
|
+
TaffyTreeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1712
|
+
return obj;
|
|
1713
|
+
}
|
|
1714
|
+
__destroy_into_raw() {
|
|
1715
|
+
const ptr = this.__wbg_ptr;
|
|
1716
|
+
this.__wbg_ptr = 0;
|
|
1717
|
+
TaffyTreeFinalization.unregister(this);
|
|
1718
|
+
return ptr;
|
|
1719
|
+
}
|
|
1720
|
+
free() {
|
|
1721
|
+
const ptr = this.__destroy_into_raw();
|
|
1722
|
+
wasm.__wbg_taffytree_free(ptr, 0);
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Marks a node as dirty (requiring re-layout)
|
|
1726
|
+
*
|
|
1727
|
+
* Use this when a node's content has changed but its style hasn't.
|
|
1728
|
+
* For example, when text content changes and needs remeasuring.
|
|
1729
|
+
*
|
|
1730
|
+
* @param node - The node ID to mark dirty
|
|
1731
|
+
*
|
|
1732
|
+
* @throws `TaffyError` if the node does not exist
|
|
1733
|
+
*
|
|
1734
|
+
* @example
|
|
1735
|
+
* ```typescript
|
|
1736
|
+
* // After updating text content
|
|
1737
|
+
* tree.setNodeContext(nodeId, { text: "Updated text" });
|
|
1738
|
+
* tree.markDirty(nodeId);
|
|
1739
|
+
* tree.computeLayout(rootId, availableSpace);
|
|
1740
|
+
* ```
|
|
1741
|
+
* @param {bigint} node
|
|
1742
|
+
*/
|
|
1743
|
+
markDirty(node) {
|
|
1744
|
+
const ret = wasm.taffytree_markDirty(this.__wbg_ptr, node);
|
|
1745
|
+
if (ret[1]) {
|
|
1746
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Prints the tree structure to the console (for debugging)
|
|
1751
|
+
*
|
|
1752
|
+
* Outputs a text representation of the tree structure starting from
|
|
1753
|
+
* the given node. Useful for debugging layout issues.
|
|
1754
|
+
*
|
|
1755
|
+
* @param node - The root node ID to print from
|
|
1756
|
+
*
|
|
1757
|
+
* @example
|
|
1758
|
+
* ```typescript
|
|
1759
|
+
* tree.printTree(rootId);
|
|
1760
|
+
* // Output appears in browser console
|
|
1761
|
+
* ```
|
|
1762
|
+
* @param {bigint} node
|
|
1763
|
+
*/
|
|
1764
|
+
printTree(node) {
|
|
1765
|
+
wasm.taffytree_printTree(this.__wbg_ptr, node);
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Gets the number of children of a node
|
|
1769
|
+
*
|
|
1770
|
+
* @param parent - The parent node ID
|
|
1771
|
+
*
|
|
1772
|
+
* @returns - The number of direct children
|
|
1773
|
+
*
|
|
1774
|
+
* @throws `TaffyError` if the node does not exist
|
|
1775
|
+
*
|
|
1776
|
+
* @example
|
|
1777
|
+
* ```typescript
|
|
1778
|
+
* const count: number = tree.childCount(parentId);
|
|
1779
|
+
* ```
|
|
1780
|
+
* @param {bigint} parent
|
|
1781
|
+
* @returns {number}
|
|
1782
|
+
*/
|
|
1783
|
+
childCount(parent) {
|
|
1784
|
+
const ret = wasm.taffytree_childCount(this.__wbg_ptr, parent);
|
|
1785
|
+
return ret >>> 0;
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Removes a specific child from a parent
|
|
1789
|
+
*
|
|
1790
|
+
* @param parent - The parent node ID
|
|
1791
|
+
* @param child - The child node ID to remove
|
|
1792
|
+
*
|
|
1793
|
+
* @returns - The removed child ID (`bigint`)
|
|
1794
|
+
*
|
|
1795
|
+
* @throws `TaffyError` if the parent or child node does not exist
|
|
1796
|
+
*
|
|
1797
|
+
* @example
|
|
1798
|
+
* ```typescript
|
|
1799
|
+
* tree.removeChild(parentId, childId);
|
|
1800
|
+
* ```
|
|
1801
|
+
* @param {bigint} parent
|
|
1802
|
+
* @param {bigint} child
|
|
1803
|
+
* @returns {bigint}
|
|
1804
|
+
*/
|
|
1805
|
+
removeChild(parent, child) {
|
|
1806
|
+
const ret = wasm.taffytree_removeChild(this.__wbg_ptr, parent, child);
|
|
1807
|
+
if (ret[2]) {
|
|
1808
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1809
|
+
}
|
|
1810
|
+
return BigInt.asUintN(64, ret[0]);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Replaces all children of a node
|
|
1814
|
+
*
|
|
1815
|
+
* Any existing children are removed and replaced with the new array.
|
|
1816
|
+
*
|
|
1817
|
+
* @param parent - The parent node ID
|
|
1818
|
+
* @param children - Array of new child node IDs
|
|
1819
|
+
*
|
|
1820
|
+
* @throws `TaffyError` if the parent node does not exist
|
|
1821
|
+
*
|
|
1822
|
+
* @example
|
|
1823
|
+
* ```typescript
|
|
1824
|
+
* const children = BigUint64Array.from([child1, child2, child3]);
|
|
1825
|
+
* tree.setChildren(parentId, children);
|
|
1826
|
+
* ```
|
|
1827
|
+
* @param {bigint} parent
|
|
1828
|
+
* @param {BigUint64Array} children
|
|
1829
|
+
*/
|
|
1830
|
+
setChildren(parent, children) {
|
|
1831
|
+
const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
|
|
1832
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1833
|
+
const ret = wasm.taffytree_setChildren(this.__wbg_ptr, parent, ptr0, len0);
|
|
1834
|
+
if (ret[1]) {
|
|
1835
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Creates a new TaffyTree with pre-allocated capacity
|
|
1840
|
+
*
|
|
1841
|
+
* Use this when you know approximately how many nodes will be in the tree.
|
|
1842
|
+
* This can improve performance by reducing memory reallocations.
|
|
1843
|
+
*
|
|
1844
|
+
* @param capacity - The number of nodes to pre-allocate space for
|
|
1845
|
+
*
|
|
1846
|
+
* @example
|
|
1847
|
+
* ```typescript
|
|
1848
|
+
* const tree: TaffyTree = TaffyTree.withCapacity(1000);
|
|
1849
|
+
* ```
|
|
1850
|
+
* @param {number} capacity
|
|
1851
|
+
* @returns {TaffyTree}
|
|
1852
|
+
*/
|
|
1853
|
+
static withCapacity(capacity) {
|
|
1854
|
+
const ret = wasm.taffytree_withCapacity(capacity);
|
|
1855
|
+
return TaffyTree.__wrap(ret);
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Computes the layout for a subtree
|
|
1859
|
+
*
|
|
1860
|
+
* This is the main layout computation method. Call this on the root node
|
|
1861
|
+
* to compute layouts for all nodes in the tree.
|
|
1862
|
+
*
|
|
1863
|
+
* @param node - The root node ID to compute layout for
|
|
1864
|
+
* @param available_space - The available space constraints
|
|
1865
|
+
*
|
|
1866
|
+
* @example
|
|
1867
|
+
* ```typescript
|
|
1868
|
+
* // Fixed size container
|
|
1869
|
+
* { width: { Definite: 800 }, height: { Definite: 600 } }
|
|
1870
|
+
*
|
|
1871
|
+
* // Flexible width, fixed height
|
|
1872
|
+
* { width: "MaxContent", height: { Definite: 600 } }
|
|
1873
|
+
*
|
|
1874
|
+
* // Minimum content size
|
|
1875
|
+
* { width: "MinContent", height: "MinContent" }
|
|
1876
|
+
* ```
|
|
1877
|
+
*
|
|
1878
|
+
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
1879
|
+
*
|
|
1880
|
+
* @example
|
|
1881
|
+
* ```typescript
|
|
1882
|
+
* tree.computeLayout(rootId, { width: { Definite: 800 }, height: { Definite: 600 } });
|
|
1883
|
+
* ```
|
|
1884
|
+
* @param {bigint} node
|
|
1885
|
+
* @param {Size<AvailableSpace>} available_space
|
|
1886
|
+
*/
|
|
1887
|
+
computeLayout(node, available_space) {
|
|
1888
|
+
const ret = wasm.taffytree_computeLayout(
|
|
1889
|
+
this.__wbg_ptr,
|
|
1890
|
+
node,
|
|
1891
|
+
available_space,
|
|
1892
|
+
);
|
|
1893
|
+
if (ret[1]) {
|
|
1894
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Enables rounding of layout values to whole pixels
|
|
1899
|
+
*
|
|
1900
|
+
* When enabled (default), computed layout values like position and size
|
|
1901
|
+
* are rounded to the nearest integer. This prevents sub-pixel rendering
|
|
1902
|
+
* issues in most rendering contexts.
|
|
1903
|
+
*
|
|
1904
|
+
* @example
|
|
1905
|
+
* ```typescript
|
|
1906
|
+
* tree.enableRounding();
|
|
1907
|
+
* ```
|
|
1908
|
+
*/
|
|
1909
|
+
enableRounding() {
|
|
1910
|
+
wasm.taffytree_enableRounding(this.__wbg_ptr);
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Disables rounding of layout values
|
|
1914
|
+
*
|
|
1915
|
+
* When disabled, computed layout values retain their fractional precision.
|
|
1916
|
+
* Use this when you need sub-pixel accuracy or when performing custom
|
|
1917
|
+
* rounding.
|
|
1918
|
+
*
|
|
1919
|
+
* @example
|
|
1920
|
+
* ```typescript
|
|
1921
|
+
* tree.disableRounding();
|
|
1922
|
+
* const layout = tree.getLayout(node);
|
|
1923
|
+
* console.log(layout.x);
|
|
1924
|
+
* ```
|
|
1925
|
+
*/
|
|
1926
|
+
disableRounding() {
|
|
1927
|
+
wasm.taffytree_disableRounding(this.__wbg_ptr);
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Gets the context value for a node
|
|
1931
|
+
*
|
|
1932
|
+
* @param node - The node ID
|
|
1933
|
+
*
|
|
1934
|
+
* @returns - The attached context value, or `undefined` if none is set
|
|
1935
|
+
*
|
|
1936
|
+
* @example
|
|
1937
|
+
* ```typescript
|
|
1938
|
+
* interface Context { text: string };
|
|
1939
|
+
* const context = tree.getNodeContext(nodeId) as Context | undefined;
|
|
1940
|
+
* if (context) {
|
|
1941
|
+
* console.log(context.text);
|
|
1942
|
+
* }
|
|
1943
|
+
* ```
|
|
1944
|
+
* @param {bigint} node
|
|
1945
|
+
* @returns {any}
|
|
1946
|
+
*/
|
|
1947
|
+
getNodeContext(node) {
|
|
1948
|
+
const ret = wasm.taffytree_getNodeContext(this.__wbg_ptr, node);
|
|
1949
|
+
if (ret[2]) {
|
|
1950
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1951
|
+
}
|
|
1952
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Sets a context value for a node
|
|
1956
|
+
*
|
|
1957
|
+
* The context can be any JavaScript value and is passed to the measure
|
|
1958
|
+
* function during layout computation.
|
|
1959
|
+
*
|
|
1960
|
+
* @param node - The node ID
|
|
1961
|
+
* @param context - Any JavaScript value to attach
|
|
1962
|
+
*
|
|
1963
|
+
* @throws `TaffyError` if the node does not exist
|
|
1964
|
+
*
|
|
1965
|
+
* @example
|
|
1966
|
+
* ```typescript
|
|
1967
|
+
* interface Context { text: string };
|
|
1968
|
+
* tree.setNodeContext(nodeId, { text: "Updated text" } as Context);
|
|
1969
|
+
* ```
|
|
1970
|
+
* @param {bigint} node
|
|
1971
|
+
* @param {any} context
|
|
1972
|
+
*/
|
|
1973
|
+
setNodeContext(node, context) {
|
|
1974
|
+
const ret = wasm.taffytree_setNodeContext(this.__wbg_ptr, node, context);
|
|
1975
|
+
if (ret[1]) {
|
|
1976
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Gets the total number of nodes in the tree
|
|
1981
|
+
*
|
|
1982
|
+
* @returns - The total count of all nodes
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* ```typescript
|
|
1986
|
+
* const count: number = tree.totalNodeCount();
|
|
1987
|
+
* ```
|
|
1988
|
+
* @returns {number}
|
|
1989
|
+
*/
|
|
1990
|
+
totalNodeCount() {
|
|
1991
|
+
const ret = wasm.taffytree_totalNodeCount(this.__wbg_ptr);
|
|
1992
|
+
return ret >>> 0;
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Gets the unrounded (fractional) layout for a node
|
|
1996
|
+
*
|
|
1997
|
+
* Returns the raw computed values before any rounding is applied.
|
|
1998
|
+
* Useful when you need sub-pixel precision.
|
|
1999
|
+
*
|
|
2000
|
+
* @param node - The node ID
|
|
2001
|
+
*
|
|
2002
|
+
* @returns - The unrounded `Layout`
|
|
2003
|
+
*
|
|
2004
|
+
* @example
|
|
2005
|
+
* ```typescript
|
|
2006
|
+
* const layout: Layout = tree.unroundedLayout(nodeId);
|
|
2007
|
+
* console.log(`Exact width: ${layout.width}`);
|
|
2008
|
+
* ```
|
|
2009
|
+
* @param {bigint} node
|
|
2010
|
+
* @returns {Layout}
|
|
2011
|
+
*/
|
|
2012
|
+
unroundedLayout(node) {
|
|
2013
|
+
const ret = wasm.taffytree_unroundedLayout(this.__wbg_ptr, node);
|
|
2014
|
+
return Layout.__wrap(ret);
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Creates a new node with the given children
|
|
2018
|
+
*
|
|
2019
|
+
* Use this to create container nodes that have child elements.
|
|
2020
|
+
* The children must already exist in the tree.
|
|
2021
|
+
*
|
|
2022
|
+
* @param style - The style configuration for the node
|
|
2023
|
+
* @param children - Array of child node IDs (as BigUint64Array)
|
|
2024
|
+
*
|
|
2025
|
+
* @returns - The node ID (`bigint`)
|
|
2026
|
+
*
|
|
2027
|
+
* @throws `TaffyError` if the node cannot be created
|
|
2028
|
+
*
|
|
2029
|
+
* @example
|
|
2030
|
+
* ```typescript
|
|
2031
|
+
* const containerStyle = new Style();
|
|
2032
|
+
* containerStyle.display = Display.Flex;
|
|
2033
|
+
*
|
|
2034
|
+
* const child1: bigint = tree.newLeaf(new Style());
|
|
2035
|
+
* const child2: bigint = tree.newLeaf(new Style());
|
|
2036
|
+
*
|
|
2037
|
+
* const container: bigint = tree.newWithChildren(
|
|
2038
|
+
* containerStyle,
|
|
2039
|
+
* BigUint64Array.from([child1, child2])
|
|
2040
|
+
* );
|
|
2041
|
+
* ```
|
|
2042
|
+
* @param {Style} style
|
|
2043
|
+
* @param {BigUint64Array} children
|
|
2044
|
+
* @returns {bigint}
|
|
2045
|
+
*/
|
|
2046
|
+
newWithChildren(style, children) {
|
|
2047
|
+
_assertClass(style, Style);
|
|
2048
|
+
const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
|
|
2049
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2050
|
+
const ret = wasm.taffytree_newWithChildren(
|
|
2051
|
+
this.__wbg_ptr,
|
|
2052
|
+
style.__wbg_ptr,
|
|
2053
|
+
ptr0,
|
|
2054
|
+
len0,
|
|
2055
|
+
);
|
|
2056
|
+
if (ret[2]) {
|
|
2057
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2058
|
+
}
|
|
2059
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Gets the child at a specific index
|
|
2063
|
+
*
|
|
2064
|
+
* @param parent - The parent node ID
|
|
2065
|
+
* @param index - The index of the child (0-based)
|
|
2066
|
+
*
|
|
2067
|
+
* @returns - The child node ID (`bigint`)
|
|
2068
|
+
*
|
|
2069
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
2070
|
+
*
|
|
2071
|
+
* @example
|
|
2072
|
+
* ```typescript
|
|
2073
|
+
* const firstChild: bigint = tree.getChildAtIndex(parentId, 0);
|
|
2074
|
+
* ```
|
|
2075
|
+
* @param {bigint} parent
|
|
2076
|
+
* @param {number} index
|
|
2077
|
+
* @returns {bigint}
|
|
2078
|
+
*/
|
|
2079
|
+
getChildAtIndex(parent, index) {
|
|
2080
|
+
const ret = wasm.taffytree_getChildAtIndex(this.__wbg_ptr, parent, index);
|
|
2081
|
+
if (ret[2]) {
|
|
2082
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2083
|
+
}
|
|
2084
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Gets a mutable reference to the context value for a node
|
|
2088
|
+
*
|
|
2089
|
+
* In JavaScript, this behaves the same as `getNodeContext()` since
|
|
2090
|
+
* JavaScript objects are always passed by reference.
|
|
2091
|
+
*
|
|
2092
|
+
* @param node - The node ID
|
|
2093
|
+
*
|
|
2094
|
+
* @returns - The attached context value, or `undefined` if none is set
|
|
2095
|
+
* @param {bigint} node
|
|
2096
|
+
* @returns {any}
|
|
2097
|
+
*/
|
|
2098
|
+
getNodeContextMut(node) {
|
|
2099
|
+
const ret = wasm.taffytree_getNodeContextMut(this.__wbg_ptr, node);
|
|
2100
|
+
if (ret[2]) {
|
|
2101
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2102
|
+
}
|
|
2103
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Inserts a child at a specific index
|
|
2107
|
+
*
|
|
2108
|
+
* @param parent - The parent node ID
|
|
2109
|
+
* @param index - The position to insert at (0-based)
|
|
2110
|
+
* @param child - The child node ID to insert
|
|
2111
|
+
*
|
|
2112
|
+
* @throws `TaffyError` if the parent or child node does not exist, or index is out of bounds
|
|
2113
|
+
*
|
|
2114
|
+
* @example
|
|
2115
|
+
* ```typescript
|
|
2116
|
+
* tree.insertChildAtIndex(parentId, 0, childId);
|
|
2117
|
+
* ```
|
|
2118
|
+
* @param {bigint} parent
|
|
2119
|
+
* @param {number} index
|
|
2120
|
+
* @param {bigint} child
|
|
2121
|
+
*/
|
|
2122
|
+
insertChildAtIndex(parent, index, child) {
|
|
2123
|
+
const ret = wasm.taffytree_insertChildAtIndex(
|
|
2124
|
+
this.__wbg_ptr,
|
|
2125
|
+
parent,
|
|
2126
|
+
index,
|
|
2127
|
+
child,
|
|
2128
|
+
);
|
|
2129
|
+
if (ret[1]) {
|
|
2130
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Creates a new leaf node with an attached context value
|
|
2135
|
+
*
|
|
2136
|
+
* The context can be any JavaScript value and is passed to the measure
|
|
2137
|
+
* function during layout computation. This is useful for storing
|
|
2138
|
+
* references to text content or other dynamic data.
|
|
2139
|
+
*
|
|
2140
|
+
* @param style - The style configuration for the node
|
|
2141
|
+
* @param context - Any JavaScript value to attach to the node
|
|
2142
|
+
* @returns - The node ID (`bigint`)
|
|
2143
|
+
* @throws `TaffyError` if the node cannot be created
|
|
2144
|
+
*
|
|
2145
|
+
* @example
|
|
2146
|
+
* ```typescript
|
|
2147
|
+
* interface TextContext { text: string; isBold: boolean; }
|
|
2148
|
+
*
|
|
2149
|
+
* const style = new Style();
|
|
2150
|
+
* const context: TextContext = { text: "Hello, World!", isBold: true };
|
|
2151
|
+
* const nodeId: bigint = tree.newLeafWithContext(style, context);
|
|
2152
|
+
* ```
|
|
2153
|
+
* @param {Style} style
|
|
2154
|
+
* @param {any} context
|
|
2155
|
+
* @returns {bigint}
|
|
2156
|
+
*/
|
|
2157
|
+
newLeafWithContext(style, context) {
|
|
2158
|
+
_assertClass(style, Style);
|
|
2159
|
+
const ret = wasm.taffytree_newLeafWithContext(
|
|
2160
|
+
this.__wbg_ptr,
|
|
2161
|
+
style.__wbg_ptr,
|
|
2162
|
+
context,
|
|
2163
|
+
);
|
|
2164
|
+
if (ret[2]) {
|
|
2165
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2166
|
+
}
|
|
2167
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Removes a child at a specific index
|
|
2171
|
+
*
|
|
2172
|
+
* @param parent - The parent node ID
|
|
2173
|
+
* @param index - The index of the child to remove (0-based)
|
|
2174
|
+
*
|
|
2175
|
+
* @returns - The removed child ID (`bigint`)
|
|
2176
|
+
*
|
|
2177
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
2178
|
+
*
|
|
2179
|
+
* @example
|
|
2180
|
+
* ```typescript
|
|
2181
|
+
* const removedId: bigint = tree.removeChildAtIndex(parentId, 0);
|
|
2182
|
+
* ```
|
|
2183
|
+
* @param {bigint} parent
|
|
2184
|
+
* @param {number} index
|
|
2185
|
+
* @returns {bigint}
|
|
2186
|
+
*/
|
|
2187
|
+
removeChildAtIndex(parent, index) {
|
|
2188
|
+
const ret = wasm.taffytree_removeChildAtIndex(
|
|
2189
|
+
this.__wbg_ptr,
|
|
2190
|
+
parent,
|
|
2191
|
+
index,
|
|
2192
|
+
);
|
|
2193
|
+
if (ret[2]) {
|
|
2194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2195
|
+
}
|
|
2196
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2197
|
+
}
|
|
2198
|
+
/**
|
|
2199
|
+
* Removes a range of children
|
|
2200
|
+
*
|
|
2201
|
+
* Removes children from `start_index` (inclusive) to `end_index` (exclusive).
|
|
2202
|
+
*
|
|
2203
|
+
* @param parent - The parent node ID
|
|
2204
|
+
* @param start_index - Start of range (inclusive)
|
|
2205
|
+
* @param end_index - End of range (exclusive)
|
|
2206
|
+
*
|
|
2207
|
+
* @throws `TaffyError` if the parent node does not exist or range is invalid
|
|
2208
|
+
*
|
|
2209
|
+
* @example
|
|
2210
|
+
* ```typescript
|
|
2211
|
+
* tree.removeChildrenRange(parentId, 1, 3);
|
|
2212
|
+
* ```
|
|
2213
|
+
* @param {bigint} parent
|
|
2214
|
+
* @param {number} start_index
|
|
2215
|
+
* @param {number} end_index
|
|
2216
|
+
*/
|
|
2217
|
+
removeChildrenRange(parent, start_index, end_index) {
|
|
2218
|
+
const ret = wasm.taffytree_removeChildrenRange(
|
|
2219
|
+
this.__wbg_ptr,
|
|
2220
|
+
parent,
|
|
2221
|
+
start_index,
|
|
2222
|
+
end_index,
|
|
2223
|
+
);
|
|
2224
|
+
if (ret[1]) {
|
|
2225
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Replaces a child at a specific index
|
|
2230
|
+
*
|
|
2231
|
+
* @param parent - The parent node ID
|
|
2232
|
+
* @param index - The index of the child to replace (0-based)
|
|
2233
|
+
* @param new_child - The new child node ID
|
|
2234
|
+
*
|
|
2235
|
+
* @returns - The replaced (old) child ID (`bigint`)
|
|
2236
|
+
*
|
|
2237
|
+
* @throws `TaffyError` if the parent node does not exist or index is out of bounds
|
|
2238
|
+
*
|
|
2239
|
+
* @example
|
|
2240
|
+
* ```typescript
|
|
2241
|
+
* const oldChildId: bigint = tree.replaceChildAtIndex(parentId, 1, newChildId);
|
|
2242
|
+
* ```
|
|
2243
|
+
* @param {bigint} parent
|
|
2244
|
+
* @param {number} index
|
|
2245
|
+
* @param {bigint} new_child
|
|
2246
|
+
* @returns {bigint}
|
|
2247
|
+
*/
|
|
2248
|
+
replaceChildAtIndex(parent, index, new_child) {
|
|
2249
|
+
const ret = wasm.taffytree_replaceChildAtIndex(
|
|
2250
|
+
this.__wbg_ptr,
|
|
2251
|
+
parent,
|
|
2252
|
+
index,
|
|
2253
|
+
new_child,
|
|
2254
|
+
);
|
|
2255
|
+
if (ret[2]) {
|
|
2256
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2257
|
+
}
|
|
2258
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Computes layout with a custom measure function for leaf nodes
|
|
2262
|
+
*
|
|
2263
|
+
* Use this when you have leaf nodes with dynamic content (like text)
|
|
2264
|
+
* that needs to be measured during layout. The measure function is
|
|
2265
|
+
* called for each leaf node that needs measurement.
|
|
2266
|
+
*
|
|
2267
|
+
* @param node - The root node ID to compute layout for
|
|
2268
|
+
* @param available_space - The available space constraints
|
|
2269
|
+
* @param measure_func - A function that measures leaf node content
|
|
2270
|
+
*
|
|
2271
|
+
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
2272
|
+
*
|
|
2273
|
+
* @example
|
|
2274
|
+
* ```typescript
|
|
2275
|
+
* tree.computeLayoutWithMeasure(
|
|
2276
|
+
* rootId,
|
|
2277
|
+
* { width: { Definite: 800 }, height: "MaxContent" },
|
|
2278
|
+
* (known, available, node, context, style) => {
|
|
2279
|
+
* if (context?.text) {
|
|
2280
|
+
* const measured = measureText(context.text, available.width);
|
|
2281
|
+
* return { width: measured.width, height: measured.height };
|
|
2282
|
+
* }
|
|
2283
|
+
* return { width: 0, height: 0 };
|
|
2284
|
+
* }
|
|
2285
|
+
* );
|
|
2286
|
+
* ```
|
|
2287
|
+
* @param {bigint} node
|
|
2288
|
+
* @param {Size<AvailableSpace>} available_space
|
|
2289
|
+
* @param {MeasureFunction} measure_func
|
|
2290
|
+
*/
|
|
2291
|
+
computeLayoutWithMeasure(node, available_space, measure_func) {
|
|
2292
|
+
const ret = wasm.taffytree_computeLayoutWithMeasure(
|
|
2293
|
+
this.__wbg_ptr,
|
|
2294
|
+
node,
|
|
2295
|
+
available_space,
|
|
2296
|
+
measure_func,
|
|
2297
|
+
);
|
|
2298
|
+
if (ret[1]) {
|
|
2299
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Gets context values for multiple nodes at once
|
|
2304
|
+
*
|
|
2305
|
+
* This is more efficient than calling `getNodeContext()` multiple times
|
|
2306
|
+
* when you need to access contexts for many nodes.
|
|
2307
|
+
*
|
|
2308
|
+
* @param children - Array of node IDs
|
|
2309
|
+
*
|
|
2310
|
+
* @returns - Array of context values (undefined for nodes without context)
|
|
2311
|
+
*
|
|
2312
|
+
* @example
|
|
2313
|
+
* ```typescript
|
|
2314
|
+
* const nodes = BigUint64Array.from([id1, id2]);
|
|
2315
|
+
* const contexts = tree.getDisjointNodeContextMut(nodes);
|
|
2316
|
+
* ```
|
|
2317
|
+
* @param {BigUint64Array} children
|
|
2318
|
+
* @returns {any[]}
|
|
2319
|
+
*/
|
|
2320
|
+
getDisjointNodeContextMut(children) {
|
|
2321
|
+
const ptr0 = passArray64ToWasm0(children, wasm.__wbindgen_malloc);
|
|
2322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2323
|
+
const ret = wasm.taffytree_getDisjointNodeContextMut(
|
|
2324
|
+
this.__wbg_ptr,
|
|
2325
|
+
ptr0,
|
|
2326
|
+
len0,
|
|
2327
|
+
);
|
|
2328
|
+
if (ret[3]) {
|
|
2329
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2330
|
+
}
|
|
2331
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
2332
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2333
|
+
return v2;
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* Creates a new empty TaffyTree
|
|
2337
|
+
*
|
|
2338
|
+
* The tree starts with no nodes. Use `newLeaf()` or `newWithChildren()`
|
|
2339
|
+
* to add nodes.
|
|
2340
|
+
*
|
|
2341
|
+
* @example
|
|
2342
|
+
* ```typescript
|
|
2343
|
+
* const tree: TaffyTree = new TaffyTree();
|
|
2344
|
+
* ```
|
|
2345
|
+
*/
|
|
2346
|
+
constructor() {
|
|
2347
|
+
const ret = wasm.taffytree_new();
|
|
2348
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2349
|
+
TaffyTreeFinalization.register(this, this.__wbg_ptr, this);
|
|
2350
|
+
return this;
|
|
2351
|
+
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Removes all nodes from the tree
|
|
2354
|
+
*
|
|
2355
|
+
* This clears the entire tree, removing all nodes and their relationships.
|
|
2356
|
+
* Use this to reset the tree for reuse.
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* ```typescript
|
|
2360
|
+
* tree.clear();
|
|
2361
|
+
* console.log(tree.totalNodeCount());
|
|
2362
|
+
* ```
|
|
2363
|
+
*/
|
|
2364
|
+
clear() {
|
|
2365
|
+
wasm.taffytree_clear(this.__wbg_ptr);
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Checks if a node is dirty (needs re-layout)
|
|
2369
|
+
*
|
|
2370
|
+
* A node is dirty if its style or content has changed since the last
|
|
2371
|
+
* layout computation.
|
|
2372
|
+
*
|
|
2373
|
+
* @param node - The node ID to check
|
|
2374
|
+
*
|
|
2375
|
+
* @returns - true if dirty, false otherwise
|
|
2376
|
+
*
|
|
2377
|
+
* @throws `TaffyError` if the node does not exist
|
|
2378
|
+
*
|
|
2379
|
+
* @example
|
|
2380
|
+
* ```typescript
|
|
2381
|
+
* if (tree.dirty(nodeId)) {
|
|
2382
|
+
* tree.computeLayout(rootId, availableSpace);
|
|
2383
|
+
* }
|
|
2384
|
+
* ```
|
|
2385
|
+
* @param {bigint} node
|
|
2386
|
+
* @returns {boolean}
|
|
2387
|
+
*/
|
|
2388
|
+
dirty(node) {
|
|
2389
|
+
const ret = wasm.taffytree_dirty(this.__wbg_ptr, node);
|
|
2390
|
+
if (ret[2]) {
|
|
2391
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2392
|
+
}
|
|
2393
|
+
return ret[0] !== 0;
|
|
2394
|
+
}
|
|
2395
|
+
/**
|
|
2396
|
+
* Gets the style for a node
|
|
2397
|
+
*
|
|
2398
|
+
* @param node - The node ID
|
|
2399
|
+
*
|
|
2400
|
+
* @returns - The node's `Style`
|
|
2401
|
+
*
|
|
2402
|
+
* @throws `TaffyError` if the node does not exist
|
|
2403
|
+
*
|
|
2404
|
+
* @example
|
|
2405
|
+
* ```typescript
|
|
2406
|
+
* const style: Style = tree.getStyle(nodeId);
|
|
2407
|
+
* console.log('Flex grow:', style.flexGrow);
|
|
2408
|
+
* ```
|
|
2409
|
+
* @param {bigint} node
|
|
2410
|
+
* @returns {Style}
|
|
2411
|
+
*/
|
|
2412
|
+
getStyle(node) {
|
|
2413
|
+
const ret = wasm.taffytree_getStyle(this.__wbg_ptr, node);
|
|
2414
|
+
if (ret[2]) {
|
|
2415
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2416
|
+
}
|
|
2417
|
+
return Style.__wrap(ret[0]);
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Gets the computed layout for a node
|
|
2421
|
+
*
|
|
2422
|
+
* Call this after `computeLayout()` to retrieve the computed position
|
|
2423
|
+
* and size for a node.
|
|
2424
|
+
*
|
|
2425
|
+
* @param node - The node ID
|
|
2426
|
+
*
|
|
2427
|
+
* @returns - The computed `Layout`
|
|
2428
|
+
*
|
|
2429
|
+
* @throws `TaffyError` if the node does not exist
|
|
2430
|
+
*
|
|
2431
|
+
* @example
|
|
2432
|
+
* ```typescript
|
|
2433
|
+
* tree.computeLayout(rootId, { width: { Definite: 800 }, height: { Definite: 600 } });
|
|
2434
|
+
* const layout: Layout = tree.getLayout(nodeId);
|
|
2435
|
+
* console.log(`Position: (${layout.x}, ${layout.y}), Size: ${layout.width}x${layout.height}`);
|
|
2436
|
+
* ```
|
|
2437
|
+
* @param {bigint} node
|
|
2438
|
+
* @returns {Layout}
|
|
2439
|
+
*/
|
|
2440
|
+
getLayout(node) {
|
|
2441
|
+
const ret = wasm.taffytree_getLayout(this.__wbg_ptr, node);
|
|
2442
|
+
if (ret[2]) {
|
|
2443
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2444
|
+
}
|
|
2445
|
+
return Layout.__wrap(ret[0]);
|
|
2446
|
+
}
|
|
2447
|
+
/**
|
|
2448
|
+
* Gets the parent of a node
|
|
2449
|
+
*
|
|
2450
|
+
* @param child - The child node ID
|
|
2451
|
+
*
|
|
2452
|
+
* @returns - The parent node ID, or `undefined` if the node has no parent
|
|
2453
|
+
*
|
|
2454
|
+
* @example
|
|
2455
|
+
* ```typescript
|
|
2456
|
+
* const parentId: bigint | undefined = tree.parent(childId);
|
|
2457
|
+
* ```
|
|
2458
|
+
* @param {bigint} child
|
|
2459
|
+
* @returns {bigint | undefined}
|
|
2460
|
+
*/
|
|
2461
|
+
parent(child) {
|
|
2462
|
+
const ret = wasm.taffytree_parent(this.__wbg_ptr, child);
|
|
2463
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
* Removes a node from the tree
|
|
2467
|
+
*
|
|
2468
|
+
* The node and all its descendants are removed. If the node has a parent,
|
|
2469
|
+
* it is automatically removed from the parent's children.
|
|
2470
|
+
*
|
|
2471
|
+
* @param node - The node ID to remove
|
|
2472
|
+
*
|
|
2473
|
+
* @returns - The removed node ID (`bigint`)
|
|
2474
|
+
*
|
|
2475
|
+
* @throws `TaffyError` if the node does not exist
|
|
2476
|
+
*
|
|
2477
|
+
* @example
|
|
2478
|
+
* ```typescript
|
|
2479
|
+
* try {
|
|
2480
|
+
* const removedId: bigint = tree.remove(nodeId);
|
|
2481
|
+
* } catch (e) {
|
|
2482
|
+
* console.error("Node doesn't exist");
|
|
2483
|
+
* }
|
|
2484
|
+
* ```
|
|
2485
|
+
* @param {bigint} node
|
|
2486
|
+
* @returns {bigint}
|
|
2487
|
+
*/
|
|
2488
|
+
remove(node) {
|
|
2489
|
+
const ret = wasm.taffytree_remove(this.__wbg_ptr, node);
|
|
2490
|
+
if (ret[2]) {
|
|
2491
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2492
|
+
}
|
|
2493
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Gets all children of a node
|
|
2497
|
+
*
|
|
2498
|
+
* @param parent - The parent node ID
|
|
2499
|
+
*
|
|
2500
|
+
* @returns - Array of child node IDs (`BigUint64Array`)
|
|
2501
|
+
*
|
|
2502
|
+
* @throws `TaffyError` if the parent node does not exist
|
|
2503
|
+
*
|
|
2504
|
+
* @example
|
|
2505
|
+
* ```typescript
|
|
2506
|
+
* const children: BigUint64Array = tree.children(parentId);
|
|
2507
|
+
* ```
|
|
2508
|
+
* @param {bigint} parent
|
|
2509
|
+
* @returns {BigUint64Array}
|
|
2510
|
+
*/
|
|
2511
|
+
children(parent) {
|
|
2512
|
+
const ret = wasm.taffytree_children(this.__wbg_ptr, parent);
|
|
2513
|
+
if (ret[3]) {
|
|
2514
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2515
|
+
}
|
|
2516
|
+
var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
|
|
2517
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2518
|
+
return v1;
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* Creates a new leaf node with the given style
|
|
2522
|
+
*
|
|
2523
|
+
* A leaf node has no children. Use this for elements that contain
|
|
2524
|
+
* content (like text) rather than other elements.
|
|
2525
|
+
*
|
|
2526
|
+
* @param style - The style configuration for the node
|
|
2527
|
+
* @returns - The node ID (`bigint`)
|
|
2528
|
+
* @throws `TaffyError` if the node cannot be created
|
|
2529
|
+
*
|
|
2530
|
+
* @example
|
|
2531
|
+
* ```typescript
|
|
2532
|
+
* const style = new Style();
|
|
2533
|
+
* style.size = { width: { Length: 100 }, height: { Length: 50 } };
|
|
2534
|
+
* const nodeId: bigint = tree.newLeaf(style);
|
|
2535
|
+
* ```
|
|
2536
|
+
* @param {Style} style
|
|
2537
|
+
* @returns {bigint}
|
|
2538
|
+
*/
|
|
2539
|
+
newLeaf(style) {
|
|
2540
|
+
_assertClass(style, Style);
|
|
2541
|
+
const ret = wasm.taffytree_newLeaf(this.__wbg_ptr, style.__wbg_ptr);
|
|
2542
|
+
if (ret[2]) {
|
|
2543
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2544
|
+
}
|
|
2545
|
+
return BigInt.asUintN(64, ret[0]);
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Appends a child node to a parent
|
|
2549
|
+
*
|
|
2550
|
+
* The child is added as the last child of the parent.
|
|
2551
|
+
*
|
|
2552
|
+
* @param parent - The parent node ID
|
|
2553
|
+
* @param child - The child node ID to add
|
|
2554
|
+
*
|
|
2555
|
+
* @throws `TaffyError` if the parent or child node does not exist
|
|
2556
|
+
*
|
|
2557
|
+
* @example
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* tree.addChild(parentId, childId);
|
|
2560
|
+
* ```
|
|
2561
|
+
* @param {bigint} parent
|
|
2562
|
+
* @param {bigint} child
|
|
2563
|
+
*/
|
|
2564
|
+
addChild(parent, child) {
|
|
2565
|
+
const ret = wasm.taffytree_addChild(this.__wbg_ptr, parent, child);
|
|
2566
|
+
if (ret[1]) {
|
|
2567
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Sets the style for an existing node
|
|
2572
|
+
*
|
|
2573
|
+
* This replaces the node's current style with the provided one.
|
|
2574
|
+
* The node will be marked as dirty and require re-layout.
|
|
2575
|
+
*
|
|
2576
|
+
* @param node - The node ID
|
|
2577
|
+
* @param style - The new style configuration
|
|
2578
|
+
*
|
|
2579
|
+
* @throws `TaffyError` if the node does not exist
|
|
2580
|
+
*
|
|
2581
|
+
* @example
|
|
2582
|
+
* ```typescript
|
|
2583
|
+
* const newStyle = new Style();
|
|
2584
|
+
* newStyle.flexGrow = 2;
|
|
2585
|
+
* tree.setStyle(nodeId, newStyle);
|
|
2586
|
+
* ```
|
|
2587
|
+
* @param {bigint} node
|
|
2588
|
+
* @param {Style} style
|
|
2589
|
+
*/
|
|
2590
|
+
setStyle(node, style) {
|
|
2591
|
+
_assertClass(style, Style);
|
|
2592
|
+
const ret = wasm.taffytree_setStyle(this.__wbg_ptr, node, style.__wbg_ptr);
|
|
2593
|
+
if (ret[1]) {
|
|
2594
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
1751
2597
|
}
|
|
1752
|
-
if (Symbol.dispose)
|
|
2598
|
+
if (Symbol.dispose)
|
|
2599
|
+
TaffyTree.prototype[Symbol.dispose] = TaffyTree.prototype.free;
|
|
1753
2600
|
|
|
1754
|
-
const EXPECTED_RESPONSE_TYPES = new Set([
|
|
2601
|
+
const EXPECTED_RESPONSE_TYPES = new Set(["basic", "cors", "default"]);
|
|
1755
2602
|
|
|
1756
2603
|
async function __wbg_load(module, imports) {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
2604
|
+
if (typeof Response === "function" && module instanceof Response) {
|
|
2605
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
2606
|
+
try {
|
|
2607
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
2608
|
+
} catch (e) {
|
|
2609
|
+
const validResponse =
|
|
2610
|
+
module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
2611
|
+
|
|
2612
|
+
if (
|
|
2613
|
+
validResponse &&
|
|
2614
|
+
module.headers.get("Content-Type") !== "application/wasm"
|
|
2615
|
+
) {
|
|
2616
|
+
console.warn(
|
|
2617
|
+
"`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",
|
|
2618
|
+
e,
|
|
2619
|
+
);
|
|
2620
|
+
} else {
|
|
2621
|
+
throw e;
|
|
1771
2622
|
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
1772
2625
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2626
|
+
const bytes = await module.arrayBuffer();
|
|
2627
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
2628
|
+
} else {
|
|
2629
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1777
2630
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}
|
|
2631
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
2632
|
+
return { instance, module };
|
|
2633
|
+
} else {
|
|
2634
|
+
return instance;
|
|
1783
2635
|
}
|
|
2636
|
+
}
|
|
1784
2637
|
}
|
|
1785
2638
|
|
|
1786
2639
|
function __wbg_get_imports() {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
|
|
2640
|
+
const imports = {};
|
|
2641
|
+
imports.wbg = {};
|
|
2642
|
+
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function (arg0, arg1) {
|
|
2643
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
2644
|
+
return ret;
|
|
2645
|
+
};
|
|
2646
|
+
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function (arg0) {
|
|
2647
|
+
const ret = Number(arg0);
|
|
2648
|
+
return ret;
|
|
2649
|
+
};
|
|
2650
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
|
|
2651
|
+
const ret = String(arg1);
|
|
2652
|
+
const ptr1 = passStringToWasm0(
|
|
2653
|
+
ret,
|
|
2654
|
+
wasm.__wbindgen_malloc,
|
|
2655
|
+
wasm.__wbindgen_realloc,
|
|
2656
|
+
);
|
|
2657
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2658
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2659
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2660
|
+
};
|
|
2661
|
+
imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function (
|
|
2662
|
+
arg0,
|
|
2663
|
+
arg1,
|
|
2664
|
+
) {
|
|
2665
|
+
const v = arg1;
|
|
2666
|
+
const ret = typeof v === "bigint" ? v : undefined;
|
|
2667
|
+
getDataViewMemory0().setBigInt64(
|
|
2668
|
+
arg0 + 8 * 1,
|
|
2669
|
+
isLikeNone(ret) ? BigInt(0) : ret,
|
|
2670
|
+
true,
|
|
2671
|
+
);
|
|
2672
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2673
|
+
};
|
|
2674
|
+
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function (arg0) {
|
|
2675
|
+
const v = arg0;
|
|
2676
|
+
const ret = typeof v === "boolean" ? v : undefined;
|
|
2677
|
+
return isLikeNone(ret) ? 0xffffff : ret ? 1 : 0;
|
|
2678
|
+
};
|
|
2679
|
+
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function (
|
|
2680
|
+
arg0,
|
|
2681
|
+
arg1,
|
|
2682
|
+
) {
|
|
2683
|
+
const ret = debugString(arg1);
|
|
2684
|
+
const ptr1 = passStringToWasm0(
|
|
2685
|
+
ret,
|
|
2686
|
+
wasm.__wbindgen_malloc,
|
|
2687
|
+
wasm.__wbindgen_realloc,
|
|
2688
|
+
);
|
|
2689
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2690
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2691
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2692
|
+
};
|
|
2693
|
+
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function (arg0, arg1) {
|
|
2694
|
+
const ret = arg0 in arg1;
|
|
2695
|
+
return ret;
|
|
2696
|
+
};
|
|
2697
|
+
imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function (arg0) {
|
|
2698
|
+
const ret = typeof arg0 === "bigint";
|
|
2699
|
+
return ret;
|
|
2700
|
+
};
|
|
2701
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function (arg0) {
|
|
2702
|
+
const ret = typeof arg0 === "function";
|
|
2703
|
+
return ret;
|
|
2704
|
+
};
|
|
2705
|
+
imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function (arg0) {
|
|
2706
|
+
const ret = arg0 === null;
|
|
2707
|
+
return ret;
|
|
2708
|
+
};
|
|
2709
|
+
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function (arg0) {
|
|
2710
|
+
const val = arg0;
|
|
2711
|
+
const ret = typeof val === "object" && val !== null;
|
|
2712
|
+
return ret;
|
|
2713
|
+
};
|
|
2714
|
+
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function (arg0) {
|
|
2715
|
+
const ret = typeof arg0 === "string";
|
|
2716
|
+
return ret;
|
|
2717
|
+
};
|
|
2718
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function (arg0) {
|
|
2719
|
+
const ret = arg0 === undefined;
|
|
2720
|
+
return ret;
|
|
2721
|
+
};
|
|
2722
|
+
imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function (
|
|
2723
|
+
arg0,
|
|
2724
|
+
arg1,
|
|
2725
|
+
) {
|
|
2726
|
+
const ret = arg0 === arg1;
|
|
2727
|
+
return ret;
|
|
2728
|
+
};
|
|
2729
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function (
|
|
2730
|
+
arg0,
|
|
2731
|
+
arg1,
|
|
2732
|
+
) {
|
|
2733
|
+
const ret = arg0 == arg1;
|
|
2734
|
+
return ret;
|
|
2735
|
+
};
|
|
2736
|
+
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function (
|
|
2737
|
+
arg0,
|
|
2738
|
+
arg1,
|
|
2739
|
+
) {
|
|
2740
|
+
const obj = arg1;
|
|
2741
|
+
const ret = typeof obj === "number" ? obj : undefined;
|
|
2742
|
+
getDataViewMemory0().setFloat64(
|
|
2743
|
+
arg0 + 8 * 1,
|
|
2744
|
+
isLikeNone(ret) ? 0 : ret,
|
|
2745
|
+
true,
|
|
2746
|
+
);
|
|
2747
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2748
|
+
};
|
|
2749
|
+
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function (
|
|
2750
|
+
arg0,
|
|
2751
|
+
arg1,
|
|
2752
|
+
) {
|
|
2753
|
+
const obj = arg1;
|
|
2754
|
+
const ret = typeof obj === "string" ? obj : undefined;
|
|
2755
|
+
var ptr1 = isLikeNone(ret)
|
|
2756
|
+
? 0
|
|
2757
|
+
: passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2758
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2759
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2760
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2761
|
+
};
|
|
2762
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function (arg0, arg1) {
|
|
2763
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2764
|
+
};
|
|
2765
|
+
imports.wbg.__wbg_apply_52e9ae668d017009 = function () {
|
|
2766
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
2767
|
+
const ret = arg0.apply(arg1, arg2);
|
|
2768
|
+
return ret;
|
|
2769
|
+
}, arguments);
|
|
2770
|
+
};
|
|
2771
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function () {
|
|
2772
|
+
return handleError(function (arg0, arg1) {
|
|
2773
|
+
const ret = arg0.call(arg1);
|
|
2774
|
+
return ret;
|
|
2775
|
+
}, arguments);
|
|
2776
|
+
};
|
|
2777
|
+
imports.wbg.__wbg_entries_83c79938054e065f = function (arg0) {
|
|
2778
|
+
const ret = Object.entries(arg0);
|
|
2779
|
+
return ret;
|
|
2780
|
+
};
|
|
2781
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
|
|
2782
|
+
let deferred0_0;
|
|
2783
|
+
let deferred0_1;
|
|
2784
|
+
try {
|
|
2785
|
+
deferred0_0 = arg0;
|
|
2786
|
+
deferred0_1 = arg1;
|
|
2787
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
2788
|
+
} finally {
|
|
2789
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2790
|
+
}
|
|
2791
|
+
};
|
|
2792
|
+
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function (arg0, arg1) {
|
|
2793
|
+
const ret = arg0[arg1 >>> 0];
|
|
2794
|
+
return ret;
|
|
2795
|
+
};
|
|
2796
|
+
imports.wbg.__wbg_get_af9dab7e9603ea93 = function () {
|
|
2797
|
+
return handleError(function (arg0, arg1) {
|
|
2798
|
+
const ret = Reflect.get(arg0, arg1);
|
|
2799
|
+
return ret;
|
|
2800
|
+
}, arguments);
|
|
2801
|
+
};
|
|
2802
|
+
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function (arg0, arg1) {
|
|
2803
|
+
const ret = arg0[arg1];
|
|
2804
|
+
return ret;
|
|
2805
|
+
};
|
|
2806
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function (arg0) {
|
|
2807
|
+
let result;
|
|
2808
|
+
try {
|
|
2809
|
+
result = arg0 instanceof ArrayBuffer;
|
|
2810
|
+
} catch (_) {
|
|
2811
|
+
result = false;
|
|
2812
|
+
}
|
|
2813
|
+
const ret = result;
|
|
2814
|
+
return ret;
|
|
2815
|
+
};
|
|
2816
|
+
imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function (arg0) {
|
|
2817
|
+
let result;
|
|
2818
|
+
try {
|
|
2819
|
+
result = arg0 instanceof Map;
|
|
2820
|
+
} catch (_) {
|
|
2821
|
+
result = false;
|
|
2822
|
+
}
|
|
2823
|
+
const ret = result;
|
|
2824
|
+
return ret;
|
|
2825
|
+
};
|
|
2826
|
+
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function (arg0) {
|
|
2827
|
+
let result;
|
|
2828
|
+
try {
|
|
2829
|
+
result = arg0 instanceof Uint8Array;
|
|
2830
|
+
} catch (_) {
|
|
2831
|
+
result = false;
|
|
2832
|
+
}
|
|
2833
|
+
const ret = result;
|
|
2834
|
+
return ret;
|
|
2835
|
+
};
|
|
2836
|
+
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function (arg0) {
|
|
2837
|
+
const ret = Array.isArray(arg0);
|
|
2838
|
+
return ret;
|
|
2839
|
+
};
|
|
2840
|
+
imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function (arg0) {
|
|
2841
|
+
const ret = Number.isSafeInteger(arg0);
|
|
2842
|
+
return ret;
|
|
2843
|
+
};
|
|
2844
|
+
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function () {
|
|
2845
|
+
const ret = Symbol.iterator;
|
|
2846
|
+
return ret;
|
|
2847
|
+
};
|
|
2848
|
+
imports.wbg.__wbg_length_22ac23eaec9d8053 = function (arg0) {
|
|
2849
|
+
const ret = arg0.length;
|
|
2850
|
+
return ret;
|
|
2851
|
+
};
|
|
2852
|
+
imports.wbg.__wbg_length_d45040a40c570362 = function (arg0) {
|
|
2853
|
+
const ret = arg0.length;
|
|
2854
|
+
return ret;
|
|
2855
|
+
};
|
|
2856
|
+
imports.wbg.__wbg_log_e4aa4f07b01ebf55 = function (arg0, arg1) {
|
|
2857
|
+
console.log(getStringFromWasm0(arg0, arg1));
|
|
2858
|
+
};
|
|
2859
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function () {
|
|
2860
|
+
const ret = new Object();
|
|
2861
|
+
return ret;
|
|
2862
|
+
};
|
|
2863
|
+
imports.wbg.__wbg_new_25f239778d6112b9 = function () {
|
|
2864
|
+
const ret = new Array();
|
|
2865
|
+
return ret;
|
|
2866
|
+
};
|
|
2867
|
+
imports.wbg.__wbg_new_6421f6084cc5bc5a = function (arg0) {
|
|
2868
|
+
const ret = new Uint8Array(arg0);
|
|
2869
|
+
return ret;
|
|
2870
|
+
};
|
|
2871
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
|
|
2872
|
+
const ret = new Error();
|
|
2873
|
+
return ret;
|
|
2874
|
+
};
|
|
2875
|
+
imports.wbg.__wbg_next_138a17bbf04e926c = function (arg0) {
|
|
2876
|
+
const ret = arg0.next;
|
|
2877
|
+
return ret;
|
|
2878
|
+
};
|
|
2879
|
+
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function (
|
|
2880
|
+
arg0,
|
|
2881
|
+
arg1,
|
|
2882
|
+
arg2,
|
|
2883
|
+
) {
|
|
2884
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
2885
|
+
};
|
|
2886
|
+
imports.wbg.__wbg_push_7d9be8f38fc13975 = function (arg0, arg1) {
|
|
2887
|
+
const ret = arg0.push(arg1);
|
|
2888
|
+
return ret;
|
|
2889
|
+
};
|
|
2890
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
|
|
2891
|
+
arg0[arg1] = arg2;
|
|
2892
|
+
};
|
|
2893
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
|
|
2894
|
+
const ret = arg1.stack;
|
|
2895
|
+
const ptr1 = passStringToWasm0(
|
|
2896
|
+
ret,
|
|
2897
|
+
wasm.__wbindgen_malloc,
|
|
2898
|
+
wasm.__wbindgen_realloc,
|
|
2899
|
+
);
|
|
2900
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2901
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2902
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2903
|
+
};
|
|
2904
|
+
imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function () {
|
|
2905
|
+
return handleError(function (arg0) {
|
|
2906
|
+
const ret = JSON.stringify(arg0);
|
|
2907
|
+
return ret;
|
|
2908
|
+
}, arguments);
|
|
2909
|
+
};
|
|
2910
|
+
imports.wbg.__wbg_style_new = function (arg0) {
|
|
2911
|
+
const ret = Style.__wrap(arg0);
|
|
2912
|
+
return ret;
|
|
2913
|
+
};
|
|
2914
|
+
imports.wbg.__wbg_taffyerror_new = function (arg0) {
|
|
2915
|
+
const ret = TaffyError.__wrap(arg0);
|
|
2916
|
+
return ret;
|
|
2917
|
+
};
|
|
2918
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
2919
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
2920
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
2921
|
+
return ret;
|
|
2922
|
+
};
|
|
2923
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
|
|
2924
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
2925
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
2926
|
+
return ret;
|
|
2927
|
+
};
|
|
2928
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
|
|
2929
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
2930
|
+
const ret = arg0;
|
|
2931
|
+
return ret;
|
|
2932
|
+
};
|
|
2933
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
|
2934
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
2935
|
+
const ret = arg0;
|
|
2936
|
+
return ret;
|
|
2937
|
+
};
|
|
2938
|
+
imports.wbg.__wbindgen_init_externref_table = function () {
|
|
2939
|
+
const table = wasm.__wbindgen_externrefs;
|
|
2940
|
+
const offset = table.grow(4);
|
|
2941
|
+
table.set(0, undefined);
|
|
2942
|
+
table.set(offset + 0, undefined);
|
|
2943
|
+
table.set(offset + 1, null);
|
|
2944
|
+
table.set(offset + 2, true);
|
|
2945
|
+
table.set(offset + 3, false);
|
|
2946
|
+
};
|
|
2947
|
+
|
|
2948
|
+
return imports;
|
|
1970
2949
|
}
|
|
1971
2950
|
|
|
1972
2951
|
function __wbg_finalize_init(instance, module) {
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
return wasm;
|
|
2952
|
+
wasm = instance.exports;
|
|
2953
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
2954
|
+
cachedBigUint64ArrayMemory0 = null;
|
|
2955
|
+
cachedDataViewMemory0 = null;
|
|
2956
|
+
cachedUint8ArrayMemory0 = null;
|
|
2957
|
+
|
|
2958
|
+
wasm.__wbindgen_start();
|
|
2959
|
+
return wasm;
|
|
1982
2960
|
}
|
|
1983
2961
|
|
|
1984
2962
|
function initSync(module) {
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
if (typeof module !== 'undefined') {
|
|
1989
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1990
|
-
({module} = module)
|
|
1991
|
-
} else {
|
|
1992
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
2963
|
+
if (wasm !== undefined) return wasm;
|
|
1995
2964
|
|
|
1996
|
-
|
|
1997
|
-
if (
|
|
1998
|
-
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
|
|
2965
|
+
if (typeof module !== "undefined") {
|
|
2966
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
2967
|
+
({ module } = module);
|
|
2968
|
+
} else {
|
|
2969
|
+
console.warn(
|
|
2970
|
+
"using deprecated parameters for `initSync()`; pass a single object instead",
|
|
2971
|
+
);
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
const imports = __wbg_get_imports();
|
|
2976
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
2977
|
+
module = new WebAssembly.Module(module);
|
|
2978
|
+
}
|
|
2979
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
2980
|
+
return __wbg_finalize_init(instance, module);
|
|
2002
2981
|
}
|
|
2003
2982
|
|
|
2004
2983
|
async function __wbg_init(module_or_path) {
|
|
2005
|
-
|
|
2984
|
+
if (wasm !== undefined) return wasm;
|
|
2006
2985
|
|
|
2007
|
-
|
|
2008
|
-
if (
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2986
|
+
if (typeof module_or_path !== "undefined") {
|
|
2987
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
2988
|
+
({ module_or_path } = module_or_path);
|
|
2989
|
+
} else {
|
|
2990
|
+
console.warn(
|
|
2991
|
+
"using deprecated parameters for the initialization function; pass a single object instead",
|
|
2992
|
+
);
|
|
2014
2993
|
}
|
|
2994
|
+
}
|
|
2015
2995
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2996
|
+
if (typeof module_or_path === "undefined") {
|
|
2997
|
+
module_or_path = new URL("taffy_js_bg.wasm", import.meta.url);
|
|
2998
|
+
}
|
|
2999
|
+
const imports = __wbg_get_imports();
|
|
2020
3000
|
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
3001
|
+
if (
|
|
3002
|
+
typeof module_or_path === "string" ||
|
|
3003
|
+
(typeof Request === "function" && module_or_path instanceof Request) ||
|
|
3004
|
+
(typeof URL === "function" && module_or_path instanceof URL)
|
|
3005
|
+
) {
|
|
3006
|
+
module_or_path = fetch(module_or_path);
|
|
3007
|
+
}
|
|
2024
3008
|
|
|
2025
|
-
|
|
3009
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
2026
3010
|
|
|
2027
|
-
|
|
3011
|
+
return __wbg_finalize_init(instance, module);
|
|
2028
3012
|
}
|
|
2029
3013
|
|
|
2030
3014
|
export { initSync };
|