taffy-wasm 0.9.5 → 0.9.7
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 +3 -3
- package/package.json +1 -1
- package/taffy_wasm.d.ts +6 -6
- package/taffy_wasm.js +4 -8
- package/taffy_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -325,11 +325,11 @@ interface Point<T> {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
// Available space for layout computation
|
|
328
|
-
type AvailableSpace = number | "
|
|
328
|
+
type AvailableSpace = number | "minContent" | "maxContent";
|
|
329
329
|
|
|
330
330
|
// Measure function for custom content measurement
|
|
331
331
|
type MeasureFunction = (
|
|
332
|
-
knownDimensions: Size<number |
|
|
332
|
+
knownDimensions: Size<number | undefined>,
|
|
333
333
|
availableSpace: Size<AvailableSpace>,
|
|
334
334
|
node: bigint,
|
|
335
335
|
context: any,
|
|
@@ -346,7 +346,7 @@ const textNode = tree.newLeafWithContext(textStyle, { text: "Hello, World!" });
|
|
|
346
346
|
|
|
347
347
|
tree.computeLayoutWithMeasure(
|
|
348
348
|
rootNode,
|
|
349
|
-
{ width: 800, height: "
|
|
349
|
+
{ width: 800, height: "maxContent" },
|
|
350
350
|
(known, available, node, context, style) => {
|
|
351
351
|
if (context?.text) {
|
|
352
352
|
// Your text measurement logic here
|
package/package.json
CHANGED
package/taffy_wasm.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export type AvailableSpace = number | "minContent" | "maxContent";
|
|
|
62
62
|
*
|
|
63
63
|
* const availableSize: Size<AvailableSpace> = {
|
|
64
64
|
* width: 800,
|
|
65
|
-
* height: "
|
|
65
|
+
* height: "maxContent"
|
|
66
66
|
* };
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
@@ -80,7 +80,7 @@ export interface Size<T> {
|
|
|
80
80
|
* custom sizing based on their content (e.g., text nodes that need text measurement).
|
|
81
81
|
*
|
|
82
82
|
* @param knownDimensions - Dimensions already determined by constraints. Each dimension
|
|
83
|
-
* is `number` if known, or `
|
|
83
|
+
* is `number` if known, or `undefined` if needs to be measured.
|
|
84
84
|
* @param availableSpace - The available space constraints for the node. Can be definite
|
|
85
85
|
* pixels, "minContent", or "maxContent".
|
|
86
86
|
* @param node - The node ID (`bigint`) of the node being measured
|
|
@@ -130,7 +130,7 @@ export interface Size<T> {
|
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
132
|
export type MeasureFunction = (
|
|
133
|
-
knownDimensions: Size<number |
|
|
133
|
+
knownDimensions: Size<number | undefined>,
|
|
134
134
|
availableSpace: Size<AvailableSpace>,
|
|
135
135
|
node: bigint,
|
|
136
136
|
context: any,
|
|
@@ -1345,10 +1345,10 @@ export class TaffyTree {
|
|
|
1345
1345
|
* { width: 800, height: 600 }
|
|
1346
1346
|
*
|
|
1347
1347
|
* // Flexible width, fixed height
|
|
1348
|
-
* { width: "
|
|
1348
|
+
* { width: "maxContent", height: 600 }
|
|
1349
1349
|
*
|
|
1350
1350
|
* // Minimum content size
|
|
1351
|
-
* { width: "
|
|
1351
|
+
* { width: "minContent", height: "minContent" }
|
|
1352
1352
|
* ```
|
|
1353
1353
|
*
|
|
1354
1354
|
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
@@ -1609,7 +1609,7 @@ export class TaffyTree {
|
|
|
1609
1609
|
* ```typescript
|
|
1610
1610
|
* tree.computeLayoutWithMeasure(
|
|
1611
1611
|
* rootId,
|
|
1612
|
-
* { width: 800, height: "
|
|
1612
|
+
* { width: 800, height: "maxContent" },
|
|
1613
1613
|
* (known, available, node, context, style) => {
|
|
1614
1614
|
* if (context?.text) {
|
|
1615
1615
|
* const measured = measureText(context.text, available.width);
|
package/taffy_wasm.js
CHANGED
|
@@ -1787,10 +1787,10 @@ export class TaffyTree {
|
|
|
1787
1787
|
* { width: 800, height: 600 }
|
|
1788
1788
|
*
|
|
1789
1789
|
* // Flexible width, fixed height
|
|
1790
|
-
* { width: "
|
|
1790
|
+
* { width: "maxContent", height: 600 }
|
|
1791
1791
|
*
|
|
1792
1792
|
* // Minimum content size
|
|
1793
|
-
* { width: "
|
|
1793
|
+
* { width: "minContent", height: "minContent" }
|
|
1794
1794
|
* ```
|
|
1795
1795
|
*
|
|
1796
1796
|
* @throws `TaffyError` if the node does not exist or available space is invalid
|
|
@@ -2160,7 +2160,7 @@ export class TaffyTree {
|
|
|
2160
2160
|
* ```typescript
|
|
2161
2161
|
* tree.computeLayoutWithMeasure(
|
|
2162
2162
|
* rootId,
|
|
2163
|
-
* { width: 800, height: "
|
|
2163
|
+
* { width: 800, height: "maxContent" },
|
|
2164
2164
|
* (known, available, node, context, style) => {
|
|
2165
2165
|
* if (context?.text) {
|
|
2166
2166
|
* const measured = measureText(context.text, available.width);
|
|
@@ -2513,10 +2513,6 @@ function __wbg_get_imports() {
|
|
|
2513
2513
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
2514
2514
|
return ret;
|
|
2515
2515
|
};
|
|
2516
|
-
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
|
|
2517
|
-
const ret = Number(arg0);
|
|
2518
|
-
return ret;
|
|
2519
|
-
};
|
|
2520
2516
|
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
2521
2517
|
const ret = String(arg1);
|
|
2522
2518
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -2681,7 +2677,7 @@ function __wbg_get_imports() {
|
|
|
2681
2677
|
const ret = arg0.length;
|
|
2682
2678
|
return ret;
|
|
2683
2679
|
};
|
|
2684
|
-
imports.wbg.
|
|
2680
|
+
imports.wbg.__wbg_log_d1f98d69ddd6fc3e = function(arg0, arg1) {
|
|
2685
2681
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
2686
2682
|
};
|
|
2687
2683
|
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
package/taffy_wasm_bg.wasm
CHANGED
|
Binary file
|