taffy-layout 0.1.0 → 1.0.1
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -17
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
- package/pkg/README.md +4 -4
- package/pkg/taffy_wasm.d.ts +4 -4
- package/pkg/taffy_wasm.js +4 -4
- package/pkg/taffy_wasm_bg.wasm +0 -0
- package/pkg/package-lock.json +0 -13
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,sBAAsB,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,sBAAsB,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAcrD;AAGD,eAAe,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,14 +20,6 @@
|
|
|
20
20
|
export * from "../pkg/taffy_wasm.js";
|
|
21
21
|
// Import the init functions for the loader
|
|
22
22
|
import init, { initSync } from "../pkg/taffy_wasm.js";
|
|
23
|
-
/**
|
|
24
|
-
* Detects if running in a Node.js environment
|
|
25
|
-
*/
|
|
26
|
-
function isNode() {
|
|
27
|
-
return (typeof process !== "undefined" &&
|
|
28
|
-
process.versions != null &&
|
|
29
|
-
process.versions.node != null);
|
|
30
|
-
}
|
|
31
23
|
/**
|
|
32
24
|
* Universal initialization function for Taffy WASM module.
|
|
33
25
|
*
|
|
@@ -44,19 +36,15 @@ function isNode() {
|
|
|
44
36
|
* ```
|
|
45
37
|
*/
|
|
46
38
|
export async function loadTaffy() {
|
|
47
|
-
|
|
39
|
+
try {
|
|
48
40
|
// Node.js environment - use fs to read the WASM file
|
|
49
|
-
const fs = await import("fs");
|
|
50
|
-
const url = await import("url");
|
|
51
|
-
const path = await import("path");
|
|
41
|
+
const fs = await import(/* webpackIgnore: true */ "fs");
|
|
52
42
|
// Resolve WASM path relative to this module
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const wasmPath = path.join(__dirname, "..", "pkg", "taffy_wasm_bg.wasm");
|
|
56
|
-
const wasmBuffer = fs.readFileSync(wasmPath);
|
|
43
|
+
const wasmUrl = new URL("../pkg/taffy_wasm_bg.wasm", import.meta.url);
|
|
44
|
+
const wasmBuffer = fs.readFileSync(wasmUrl);
|
|
57
45
|
return initSync({ module: wasmBuffer });
|
|
58
46
|
}
|
|
59
|
-
|
|
47
|
+
catch {
|
|
60
48
|
// Web environment - use fetch via the default init function
|
|
61
49
|
return await init();
|
|
62
50
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,4CAA4C;AAC5C,cAAc,sBAAsB,CAAC;AAGrC,2CAA2C;AAC3C,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGtD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,4CAA4C;AAC5C,cAAc,sBAAsB,CAAC;AAGrC,2CAA2C;AAC3C,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,IAAI,CAAC;QACH,qDAAqD;QACrD,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAExD,4CAA4C;QAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEtE,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;QAC5D,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;AACH,CAAC;AAED,iCAAiC;AACjC,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taffy-layout",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "WebAssembly bindings for Taffy layout library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"layout",
|
|
@@ -52,10 +52,18 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@commitlint/cli": "^20.3.0",
|
|
54
54
|
"@commitlint/config-conventional": "^20.3.0",
|
|
55
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
56
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
57
|
+
"@semantic-release/git": "^10.0.1",
|
|
58
|
+
"@semantic-release/github": "^12.0.2",
|
|
59
|
+
"@semantic-release/npm": "^13.1.3",
|
|
60
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
55
61
|
"@types/node": "^22.0.0",
|
|
62
|
+
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
56
63
|
"husky": "^9.1.7",
|
|
57
64
|
"lint-staged": "^16.2.7",
|
|
58
65
|
"prettier": "^3.7.4",
|
|
66
|
+
"semantic-release": "^25.0.2",
|
|
59
67
|
"tsx": "^4.0.0",
|
|
60
68
|
"typedoc": "^0.28.15",
|
|
61
69
|
"typedoc-plugin-markdown": "^4.9.0",
|
package/pkg/README.md
CHANGED
|
@@ -56,7 +56,7 @@ const child1 = tree.newLeaf(childStyle);
|
|
|
56
56
|
const child2 = tree.newLeaf(childStyle);
|
|
57
57
|
const container = tree.newWithChildren(
|
|
58
58
|
containerStyle,
|
|
59
|
-
BigUint64Array.from([child1, child2])
|
|
59
|
+
BigUint64Array.from([child1, child2]),
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
// Compute layout
|
|
@@ -69,10 +69,10 @@ const child2Layout = tree.getLayout(child2);
|
|
|
69
69
|
|
|
70
70
|
console.log(`Container: ${containerLayout.width}x${containerLayout.height}`);
|
|
71
71
|
console.log(
|
|
72
|
-
`Child 1: ${child1Layout.width}x${child1Layout.height} at (${child1Layout.x}, ${child1Layout.y})
|
|
72
|
+
`Child 1: ${child1Layout.width}x${child1Layout.height} at (${child1Layout.x}, ${child1Layout.y})`,
|
|
73
73
|
);
|
|
74
74
|
console.log(
|
|
75
|
-
`Child 2: ${child2Layout.width}x${child2Layout.height} at (${child2Layout.x}, ${child2Layout.y})
|
|
75
|
+
`Child 2: ${child2Layout.width}x${child2Layout.height} at (${child2Layout.x}, ${child2Layout.y})`,
|
|
76
76
|
);
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -128,7 +128,7 @@ tree.computeLayoutWithMeasure(
|
|
|
128
128
|
return { width, height };
|
|
129
129
|
}
|
|
130
130
|
return { width: 0, height: 0 };
|
|
131
|
-
}
|
|
131
|
+
},
|
|
132
132
|
);
|
|
133
133
|
```
|
|
134
134
|
|
package/pkg/taffy_wasm.d.ts
CHANGED
|
@@ -2004,11 +2004,11 @@ export class TaffyTree {
|
|
|
2004
2004
|
*/
|
|
2005
2005
|
replaceChildAtIndex(parent: bigint, index: number, newChild: bigint): bigint;
|
|
2006
2006
|
/**
|
|
2007
|
-
*
|
|
2007
|
+
* Updates the stored layout of the provided node and its children
|
|
2008
2008
|
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2009
|
+
* The measure function is called for leaf nodes (nodes without children) that
|
|
2010
|
+
* require measurement according to the layout algorithm (Flexbox/Grid).
|
|
2011
|
+
* For example, this is used for text nodes or other content that has intrinsic size.
|
|
2012
2012
|
*
|
|
2013
2013
|
* @param node - The root node ID to compute layout for
|
|
2014
2014
|
* @param availableSpace - The available space constraints
|
package/pkg/taffy_wasm.js
CHANGED
|
@@ -2739,11 +2739,11 @@ export class TaffyTree {
|
|
|
2739
2739
|
return BigInt.asUintN(64, ret[0]);
|
|
2740
2740
|
}
|
|
2741
2741
|
/**
|
|
2742
|
-
*
|
|
2742
|
+
* Updates the stored layout of the provided node and its children
|
|
2743
2743
|
*
|
|
2744
|
-
*
|
|
2745
|
-
*
|
|
2746
|
-
*
|
|
2744
|
+
* The measure function is called for leaf nodes (nodes without children) that
|
|
2745
|
+
* require measurement according to the layout algorithm (Flexbox/Grid).
|
|
2746
|
+
* For example, this is used for text nodes or other content that has intrinsic size.
|
|
2747
2747
|
*
|
|
2748
2748
|
* @param node - The root node ID to compute layout for
|
|
2749
2749
|
* @param availableSpace - The available space constraints
|
package/pkg/taffy_wasm_bg.wasm
CHANGED
|
Binary file
|