taffy-layout 1.3.0 → 2.0.0
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.ja-JP.md +6 -9
- package/README.md +6 -9
- package/README.zh-CN.md +6 -9
- package/package.json +1 -1
- package/pkg/README.md +6 -9
- package/pkg/taffy_wasm.d.ts +23 -20
- package/pkg/taffy_wasm.js +36 -52
- package/pkg/taffy_wasm_bg.wasm +0 -0
- package/pkg/taffy_wasm_bg.wasm.d.ts +5 -5
package/README.ja-JP.md
CHANGED
|
@@ -71,10 +71,7 @@ childStyle.height = "auto";
|
|
|
71
71
|
// ノードを生成
|
|
72
72
|
const child1 = tree.newLeaf(childStyle);
|
|
73
73
|
const child2 = tree.newLeaf(childStyle);
|
|
74
|
-
const container = tree.newWithChildren(
|
|
75
|
-
containerStyle,
|
|
76
|
-
BigUint64Array.from([child1, child2]),
|
|
77
|
-
);
|
|
74
|
+
const container = tree.newWithChildren(containerStyle, [child1, child2]);
|
|
78
75
|
|
|
79
76
|
// レイアウト計算
|
|
80
77
|
tree.computeLayout(container, { width: 300, height: 200 });
|
|
@@ -99,27 +96,27 @@ console.log(
|
|
|
99
96
|
|
|
100
97
|
レイアウトツリーを管理するメインクラス。
|
|
101
98
|
|
|
102
|
-
[ドキュメントを見る](./docs/classes/TaffyTree.md)
|
|
99
|
+
[ドキュメントを見る](./docs/api/classes/TaffyTree.md)
|
|
103
100
|
|
|
104
101
|
### Style
|
|
105
102
|
|
|
106
103
|
ノードのレイアウトプロパティを設定するオブジェクト。
|
|
107
104
|
|
|
108
|
-
[ドキュメントを見る](./docs/classes/Style.md)
|
|
105
|
+
[ドキュメントを見る](./docs/api/classes/Style.md)
|
|
109
106
|
|
|
110
107
|
### Layout
|
|
111
108
|
|
|
112
109
|
計算後のレイアウト結果 (読み取り専用)。
|
|
113
110
|
|
|
114
|
-
[ドキュメントを見る](./docs/classes/Layout.md)
|
|
111
|
+
[ドキュメントを見る](./docs/api/classes/Layout.md)
|
|
115
112
|
|
|
116
113
|
### 列挙型
|
|
117
114
|
|
|
118
|
-
[ドキュメントを見る](./docs/index.md#enumerations)
|
|
115
|
+
[ドキュメントを見る](./docs/api/index.md#enumerations)
|
|
119
116
|
|
|
120
117
|
### 型エイリアス
|
|
121
118
|
|
|
122
|
-
[ドキュメントを見る](./docs/index.md#type-aliases)
|
|
119
|
+
[ドキュメントを見る](./docs/api/index.md#type-aliases)
|
|
123
120
|
|
|
124
121
|
## 📐 カスタムテキスト計測
|
|
125
122
|
|
package/README.md
CHANGED
|
@@ -71,10 +71,7 @@ childStyle.height = "auto";
|
|
|
71
71
|
// Create nodes
|
|
72
72
|
const child1 = tree.newLeaf(childStyle);
|
|
73
73
|
const child2 = tree.newLeaf(childStyle);
|
|
74
|
-
const container = tree.newWithChildren(
|
|
75
|
-
containerStyle,
|
|
76
|
-
BigUint64Array.from([child1, child2]),
|
|
77
|
-
);
|
|
74
|
+
const container = tree.newWithChildren(containerStyle, [child1, child2]);
|
|
78
75
|
|
|
79
76
|
// Compute layout
|
|
80
77
|
tree.computeLayout(container, { width: 300, height: 200 });
|
|
@@ -99,27 +96,27 @@ console.log(
|
|
|
99
96
|
|
|
100
97
|
The main class for managing layout trees.
|
|
101
98
|
|
|
102
|
-
[View Documentation](./docs/classes/TaffyTree.md)
|
|
99
|
+
[View Documentation](./docs/api/classes/TaffyTree.md)
|
|
103
100
|
|
|
104
101
|
### Style
|
|
105
102
|
|
|
106
103
|
Configuration object for node layout properties.
|
|
107
104
|
|
|
108
|
-
[View Documentation](./docs/classes/Style.md)
|
|
105
|
+
[View Documentation](./docs/api/classes/Style.md)
|
|
109
106
|
|
|
110
107
|
### Layout
|
|
111
108
|
|
|
112
109
|
Read-only computed layout result.
|
|
113
110
|
|
|
114
|
-
[View Documentation](./docs/classes/Layout.md)
|
|
111
|
+
[View Documentation](./docs/api/classes/Layout.md)
|
|
115
112
|
|
|
116
113
|
### Enums
|
|
117
114
|
|
|
118
|
-
[View Documentation](./docs/index.md#enumerations)
|
|
115
|
+
[View Documentation](./docs/api/index.md#enumerations)
|
|
119
116
|
|
|
120
117
|
### Types
|
|
121
118
|
|
|
122
|
-
[View Documentation](./docs/index.md#type-aliases)
|
|
119
|
+
[View Documentation](./docs/api/index.md#type-aliases)
|
|
123
120
|
|
|
124
121
|
## 📐 Custom Text Measurement
|
|
125
122
|
|
package/README.zh-CN.md
CHANGED
|
@@ -71,10 +71,7 @@ childStyle.height = "auto";
|
|
|
71
71
|
// 创建节点
|
|
72
72
|
const child1 = tree.newLeaf(childStyle);
|
|
73
73
|
const child2 = tree.newLeaf(childStyle);
|
|
74
|
-
const container = tree.newWithChildren(
|
|
75
|
-
containerStyle,
|
|
76
|
-
BigUint64Array.from([child1, child2]),
|
|
77
|
-
);
|
|
74
|
+
const container = tree.newWithChildren(containerStyle, [child1, child2]);
|
|
78
75
|
|
|
79
76
|
// 计算布局
|
|
80
77
|
tree.computeLayout(container, { width: 300, height: 200 });
|
|
@@ -99,27 +96,27 @@ console.log(
|
|
|
99
96
|
|
|
100
97
|
管理布局树的核心类。
|
|
101
98
|
|
|
102
|
-
[查看文档](./docs/classes/TaffyTree.md)
|
|
99
|
+
[查看文档](./docs/api/classes/TaffyTree.md)
|
|
103
100
|
|
|
104
101
|
### Style
|
|
105
102
|
|
|
106
103
|
用于配置节点布局属性的对象。
|
|
107
104
|
|
|
108
|
-
[查看文档](./docs/classes/Style.md)
|
|
105
|
+
[查看文档](./docs/api/classes/Style.md)
|
|
109
106
|
|
|
110
107
|
### Layout
|
|
111
108
|
|
|
112
109
|
只读的布局计算结果。
|
|
113
110
|
|
|
114
|
-
[查看文档](./docs/classes/Layout.md)
|
|
111
|
+
[查看文档](./docs/api/classes/Layout.md)
|
|
115
112
|
|
|
116
113
|
### 枚举
|
|
117
114
|
|
|
118
|
-
[查看文档](./docs/index.md#enumerations)
|
|
115
|
+
[查看文档](./docs/api/index.md#enumerations)
|
|
119
116
|
|
|
120
117
|
### 类型别名
|
|
121
118
|
|
|
122
|
-
[查看文档](./docs/index.md#type-aliases)
|
|
119
|
+
[查看文档](./docs/api/index.md#type-aliases)
|
|
123
120
|
|
|
124
121
|
## 📐 自定义文本测量
|
|
125
122
|
|
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -71,10 +71,7 @@ childStyle.height = "auto";
|
|
|
71
71
|
// Create nodes
|
|
72
72
|
const child1 = tree.newLeaf(childStyle);
|
|
73
73
|
const child2 = tree.newLeaf(childStyle);
|
|
74
|
-
const container = tree.newWithChildren(
|
|
75
|
-
containerStyle,
|
|
76
|
-
BigUint64Array.from([child1, child2]),
|
|
77
|
-
);
|
|
74
|
+
const container = tree.newWithChildren(containerStyle, [child1, child2]);
|
|
78
75
|
|
|
79
76
|
// Compute layout
|
|
80
77
|
tree.computeLayout(container, { width: 300, height: 200 });
|
|
@@ -99,27 +96,27 @@ console.log(
|
|
|
99
96
|
|
|
100
97
|
The main class for managing layout trees.
|
|
101
98
|
|
|
102
|
-
[View Documentation](./docs/classes/TaffyTree.md)
|
|
99
|
+
[View Documentation](./docs/api/classes/TaffyTree.md)
|
|
103
100
|
|
|
104
101
|
### Style
|
|
105
102
|
|
|
106
103
|
Configuration object for node layout properties.
|
|
107
104
|
|
|
108
|
-
[View Documentation](./docs/classes/Style.md)
|
|
105
|
+
[View Documentation](./docs/api/classes/Style.md)
|
|
109
106
|
|
|
110
107
|
### Layout
|
|
111
108
|
|
|
112
109
|
Read-only computed layout result.
|
|
113
110
|
|
|
114
|
-
[View Documentation](./docs/classes/Layout.md)
|
|
111
|
+
[View Documentation](./docs/api/classes/Layout.md)
|
|
115
112
|
|
|
116
113
|
### Enums
|
|
117
114
|
|
|
118
|
-
[View Documentation](./docs/index.md#enumerations)
|
|
115
|
+
[View Documentation](./docs/api/index.md#enumerations)
|
|
119
116
|
|
|
120
117
|
### Types
|
|
121
118
|
|
|
122
|
-
[View Documentation](./docs/index.md#type-aliases)
|
|
119
|
+
[View Documentation](./docs/api/index.md#type-aliases)
|
|
123
120
|
|
|
124
121
|
## 📐 Custom Text Measurement
|
|
125
122
|
|
package/pkg/taffy_wasm.d.ts
CHANGED
|
@@ -2229,15 +2229,17 @@ export class TaffyTree {
|
|
|
2229
2229
|
*
|
|
2230
2230
|
* @param node - The root node ID to print from
|
|
2231
2231
|
*
|
|
2232
|
+
* @returns - A string representation of the tree structure
|
|
2233
|
+
*
|
|
2232
2234
|
* @example
|
|
2233
2235
|
* ```typescript
|
|
2234
2236
|
* const tree = new TaffyTree();
|
|
2235
2237
|
* const rootId = tree.newLeaf(new Style());
|
|
2236
|
-
* tree.printTree(rootId);
|
|
2237
|
-
*
|
|
2238
|
+
* const output = tree.printTree(rootId);
|
|
2239
|
+
* console.log(output);
|
|
2238
2240
|
* ```
|
|
2239
2241
|
*/
|
|
2240
|
-
printTree(node: bigint):
|
|
2242
|
+
printTree(node: bigint): string;
|
|
2241
2243
|
/**
|
|
2242
2244
|
* Gets the number of children of a node
|
|
2243
2245
|
*
|
|
@@ -2292,11 +2294,11 @@ export class TaffyTree {
|
|
|
2292
2294
|
* const child1 = tree.newLeaf(new Style());
|
|
2293
2295
|
* const child2 = tree.newLeaf(new Style());
|
|
2294
2296
|
* const child3 = tree.newLeaf(new Style());
|
|
2295
|
-
* const children =
|
|
2297
|
+
* const children = [child1, child2, child3];
|
|
2296
2298
|
* tree.setChildren(parentId, children);
|
|
2297
2299
|
* ```
|
|
2298
2300
|
*/
|
|
2299
|
-
setChildren(parent: bigint, children:
|
|
2301
|
+
setChildren(parent: bigint, children: bigint[]): void;
|
|
2300
2302
|
/**
|
|
2301
2303
|
* Creates a new TaffyTree with pre-allocated capacity
|
|
2302
2304
|
*
|
|
@@ -2453,7 +2455,7 @@ export class TaffyTree {
|
|
|
2453
2455
|
* The children must already exist in the tree.
|
|
2454
2456
|
*
|
|
2455
2457
|
* @param style - The style configuration for the node
|
|
2456
|
-
* @param children - Array of child node IDs (as
|
|
2458
|
+
* @param children - Array of child node IDs (as bigint[])
|
|
2457
2459
|
*
|
|
2458
2460
|
* @returns - The node ID (`bigint`)
|
|
2459
2461
|
*
|
|
@@ -2470,11 +2472,11 @@ export class TaffyTree {
|
|
|
2470
2472
|
*
|
|
2471
2473
|
* const container: bigint = tree.newWithChildren(
|
|
2472
2474
|
* containerStyle,
|
|
2473
|
-
*
|
|
2475
|
+
* [child1, child2]
|
|
2474
2476
|
* );
|
|
2475
2477
|
* ```
|
|
2476
2478
|
*/
|
|
2477
|
-
newWithChildren(style: Style, children:
|
|
2479
|
+
newWithChildren(style: Style, children: bigint[]): bigint;
|
|
2478
2480
|
/**
|
|
2479
2481
|
* Gets the child at a specific index
|
|
2480
2482
|
*
|
|
@@ -2596,12 +2598,13 @@ export class TaffyTree {
|
|
|
2596
2598
|
* ```typescript
|
|
2597
2599
|
* const tree = new TaffyTree();
|
|
2598
2600
|
* const parentId = tree.newLeaf(new Style());
|
|
2601
|
+
* const child0 = tree.newLeaf(new Style());
|
|
2599
2602
|
* const child1 = tree.newLeaf(new Style());
|
|
2600
2603
|
* const child2 = tree.newLeaf(new Style());
|
|
2601
2604
|
* const child3 = tree.newLeaf(new Style());
|
|
2602
|
-
* tree.setChildren(parentId,
|
|
2605
|
+
* tree.setChildren(parentId, [child0, child1, child2, child3]);
|
|
2603
2606
|
*
|
|
2604
|
-
* tree.removeChildrenRange(parentId, 1, 3);
|
|
2607
|
+
* tree.removeChildrenRange(parentId, 1, 3); // Removes child1 and child2
|
|
2605
2608
|
* ```
|
|
2606
2609
|
*/
|
|
2607
2610
|
removeChildrenRange(parent: bigint, startIndex: number, endIndex: number): void;
|
|
@@ -2679,11 +2682,11 @@ export class TaffyTree {
|
|
|
2679
2682
|
* const tree = new TaffyTree();
|
|
2680
2683
|
* const id1 = tree.newLeaf(new Style());
|
|
2681
2684
|
* const id2 = tree.newLeaf(new Style());
|
|
2682
|
-
* const nodes =
|
|
2685
|
+
* const nodes = [id1, id2];
|
|
2683
2686
|
* const contexts = tree.getDisjointNodeContextMut(nodes);
|
|
2684
2687
|
* ```
|
|
2685
2688
|
*/
|
|
2686
|
-
getDisjointNodeContextMut(children:
|
|
2689
|
+
getDisjointNodeContextMut(children: bigint[]): any[];
|
|
2687
2690
|
/**
|
|
2688
2691
|
* Creates a new empty TaffyTree
|
|
2689
2692
|
*
|
|
@@ -2825,7 +2828,7 @@ export class TaffyTree {
|
|
|
2825
2828
|
*
|
|
2826
2829
|
* @param parent - The parent node ID
|
|
2827
2830
|
*
|
|
2828
|
-
* @returns - Array of child node IDs
|
|
2831
|
+
* @returns - Array of child node IDs
|
|
2829
2832
|
*
|
|
2830
2833
|
* @throws `TaffyError` if the parent node does not exist
|
|
2831
2834
|
*
|
|
@@ -2833,10 +2836,10 @@ export class TaffyTree {
|
|
|
2833
2836
|
* ```typescript
|
|
2834
2837
|
* const tree = new TaffyTree();
|
|
2835
2838
|
* const parentId = tree.newLeaf(new Style());
|
|
2836
|
-
* const children
|
|
2839
|
+
* const children = tree.children(parentId);
|
|
2837
2840
|
* ```
|
|
2838
2841
|
*/
|
|
2839
|
-
children(parent: bigint):
|
|
2842
|
+
children(parent: bigint): bigint[];
|
|
2840
2843
|
/**
|
|
2841
2844
|
* Creates a new leaf node with the given style
|
|
2842
2845
|
*
|
|
@@ -3110,7 +3113,7 @@ export interface InitOutput {
|
|
|
3110
3113
|
readonly taffyerror_message: (a: number) => [number, number];
|
|
3111
3114
|
readonly taffytree_addChild: (a: number, b: bigint, c: bigint) => [number, number];
|
|
3112
3115
|
readonly taffytree_childCount: (a: number, b: bigint) => number;
|
|
3113
|
-
readonly taffytree_children: (a: number, b: bigint) => [number, number, number
|
|
3116
|
+
readonly taffytree_children: (a: number, b: bigint) => [number, number, number];
|
|
3114
3117
|
readonly taffytree_clear: (a: number) => void;
|
|
3115
3118
|
readonly taffytree_computeLayout: (a: number, b: bigint, c: any) => [number, number];
|
|
3116
3119
|
readonly taffytree_computeLayoutWithMeasure: (a: number, b: bigint, c: any, d: any) => [number, number];
|
|
@@ -3119,7 +3122,7 @@ export interface InitOutput {
|
|
|
3119
3122
|
readonly taffytree_disableRounding: (a: number) => void;
|
|
3120
3123
|
readonly taffytree_enableRounding: (a: number) => void;
|
|
3121
3124
|
readonly taffytree_getChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
3122
|
-
readonly taffytree_getDisjointNodeContextMut: (a: number, b:
|
|
3125
|
+
readonly taffytree_getDisjointNodeContextMut: (a: number, b: any) => [number, number, number, number];
|
|
3123
3126
|
readonly taffytree_getLayout: (a: number, b: bigint) => [number, number, number];
|
|
3124
3127
|
readonly taffytree_getNodeContext: (a: number, b: bigint) => [number, number, number];
|
|
3125
3128
|
readonly taffytree_getNodeContextMut: (a: number, b: bigint) => [number, number, number];
|
|
@@ -3129,15 +3132,15 @@ export interface InitOutput {
|
|
|
3129
3132
|
readonly taffytree_new: () => number;
|
|
3130
3133
|
readonly taffytree_newLeaf: (a: number, b: number) => [bigint, number, number];
|
|
3131
3134
|
readonly taffytree_newLeafWithContext: (a: number, b: number, c: any) => [bigint, number, number];
|
|
3132
|
-
readonly taffytree_newWithChildren: (a: number, b: number, c:
|
|
3135
|
+
readonly taffytree_newWithChildren: (a: number, b: number, c: any) => [bigint, number, number];
|
|
3133
3136
|
readonly taffytree_parent: (a: number, b: bigint) => [number, bigint];
|
|
3134
|
-
readonly taffytree_printTree: (a: number, b: bigint) =>
|
|
3137
|
+
readonly taffytree_printTree: (a: number, b: bigint) => [number, number];
|
|
3135
3138
|
readonly taffytree_remove: (a: number, b: bigint) => [bigint, number, number];
|
|
3136
3139
|
readonly taffytree_removeChild: (a: number, b: bigint, c: bigint) => [bigint, number, number];
|
|
3137
3140
|
readonly taffytree_removeChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
3138
3141
|
readonly taffytree_removeChildrenRange: (a: number, b: bigint, c: number, d: number) => [number, number];
|
|
3139
3142
|
readonly taffytree_replaceChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [bigint, number, number];
|
|
3140
|
-
readonly taffytree_setChildren: (a: number, b: bigint, c:
|
|
3143
|
+
readonly taffytree_setChildren: (a: number, b: bigint, c: any) => [number, number];
|
|
3141
3144
|
readonly taffytree_setNodeContext: (a: number, b: bigint, c: any) => [number, number];
|
|
3142
3145
|
readonly taffytree_setStyle: (a: number, b: bigint, c: number) => [number, number];
|
|
3143
3146
|
readonly taffytree_totalNodeCount: (a: number) => number;
|
package/pkg/taffy_wasm.js
CHANGED
|
@@ -88,24 +88,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
88
88
|
return result;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function getArrayU64FromWasm0(ptr, len) {
|
|
92
|
-
ptr = ptr >>> 0;
|
|
93
|
-
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
function getArrayU8FromWasm0(ptr, len) {
|
|
97
92
|
ptr = ptr >>> 0;
|
|
98
93
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
99
94
|
}
|
|
100
95
|
|
|
101
|
-
let cachedBigUint64ArrayMemory0 = null;
|
|
102
|
-
function getBigUint64ArrayMemory0() {
|
|
103
|
-
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
104
|
-
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
105
|
-
}
|
|
106
|
-
return cachedBigUint64ArrayMemory0;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
96
|
let cachedDataViewMemory0 = null;
|
|
110
97
|
function getDataViewMemory0() {
|
|
111
98
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -140,13 +127,6 @@ function isLikeNone(x) {
|
|
|
140
127
|
return x === undefined || x === null;
|
|
141
128
|
}
|
|
142
129
|
|
|
143
|
-
function passArray64ToWasm0(arg, malloc) {
|
|
144
|
-
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
145
|
-
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
146
|
-
WASM_VECTOR_LEN = arg.length;
|
|
147
|
-
return ptr;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
130
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
151
131
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
152
132
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -3277,17 +3257,29 @@ export class TaffyTree {
|
|
|
3277
3257
|
*
|
|
3278
3258
|
* @param node - The root node ID to print from
|
|
3279
3259
|
*
|
|
3260
|
+
* @returns - A string representation of the tree structure
|
|
3261
|
+
*
|
|
3280
3262
|
* @example
|
|
3281
3263
|
* ```typescript
|
|
3282
3264
|
* const tree = new TaffyTree();
|
|
3283
3265
|
* const rootId = tree.newLeaf(new Style());
|
|
3284
|
-
* tree.printTree(rootId);
|
|
3285
|
-
*
|
|
3266
|
+
* const output = tree.printTree(rootId);
|
|
3267
|
+
* console.log(output);
|
|
3286
3268
|
* ```
|
|
3287
3269
|
* @param {bigint} node
|
|
3270
|
+
* @returns {string}
|
|
3288
3271
|
*/
|
|
3289
3272
|
printTree(node) {
|
|
3290
|
-
|
|
3273
|
+
let deferred1_0;
|
|
3274
|
+
let deferred1_1;
|
|
3275
|
+
try {
|
|
3276
|
+
const ret = wasm.taffytree_printTree(this.__wbg_ptr, node);
|
|
3277
|
+
deferred1_0 = ret[0];
|
|
3278
|
+
deferred1_1 = ret[1];
|
|
3279
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3280
|
+
} finally {
|
|
3281
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3282
|
+
}
|
|
3291
3283
|
}
|
|
3292
3284
|
/**
|
|
3293
3285
|
* Gets the number of children of a node
|
|
@@ -3357,16 +3349,14 @@ export class TaffyTree {
|
|
|
3357
3349
|
* const child1 = tree.newLeaf(new Style());
|
|
3358
3350
|
* const child2 = tree.newLeaf(new Style());
|
|
3359
3351
|
* const child3 = tree.newLeaf(new Style());
|
|
3360
|
-
* const children =
|
|
3352
|
+
* const children = [child1, child2, child3];
|
|
3361
3353
|
* tree.setChildren(parentId, children);
|
|
3362
3354
|
* ```
|
|
3363
3355
|
* @param {bigint} parent
|
|
3364
|
-
* @param {
|
|
3356
|
+
* @param {bigint[]} children
|
|
3365
3357
|
*/
|
|
3366
3358
|
setChildren(parent, children) {
|
|
3367
|
-
const
|
|
3368
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3369
|
-
const ret = wasm.taffytree_setChildren(this.__wbg_ptr, parent, ptr0, len0);
|
|
3359
|
+
const ret = wasm.taffytree_setChildren(this.__wbg_ptr, parent, children);
|
|
3370
3360
|
if (ret[1]) {
|
|
3371
3361
|
throw takeFromExternrefTable0(ret[0]);
|
|
3372
3362
|
}
|
|
@@ -3567,7 +3557,7 @@ export class TaffyTree {
|
|
|
3567
3557
|
* The children must already exist in the tree.
|
|
3568
3558
|
*
|
|
3569
3559
|
* @param style - The style configuration for the node
|
|
3570
|
-
* @param children - Array of child node IDs (as
|
|
3560
|
+
* @param children - Array of child node IDs (as bigint[])
|
|
3571
3561
|
*
|
|
3572
3562
|
* @returns - The node ID (`bigint`)
|
|
3573
3563
|
*
|
|
@@ -3584,18 +3574,16 @@ export class TaffyTree {
|
|
|
3584
3574
|
*
|
|
3585
3575
|
* const container: bigint = tree.newWithChildren(
|
|
3586
3576
|
* containerStyle,
|
|
3587
|
-
*
|
|
3577
|
+
* [child1, child2]
|
|
3588
3578
|
* );
|
|
3589
3579
|
* ```
|
|
3590
3580
|
* @param {Style} style
|
|
3591
|
-
* @param {
|
|
3581
|
+
* @param {bigint[]} children
|
|
3592
3582
|
* @returns {bigint}
|
|
3593
3583
|
*/
|
|
3594
3584
|
newWithChildren(style, children) {
|
|
3595
3585
|
_assertClass(style, Style);
|
|
3596
|
-
const
|
|
3597
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3598
|
-
const ret = wasm.taffytree_newWithChildren(this.__wbg_ptr, style.__wbg_ptr, ptr0, len0);
|
|
3586
|
+
const ret = wasm.taffytree_newWithChildren(this.__wbg_ptr, style.__wbg_ptr, children);
|
|
3599
3587
|
if (ret[2]) {
|
|
3600
3588
|
throw takeFromExternrefTable0(ret[1]);
|
|
3601
3589
|
}
|
|
@@ -3774,12 +3762,13 @@ export class TaffyTree {
|
|
|
3774
3762
|
* ```typescript
|
|
3775
3763
|
* const tree = new TaffyTree();
|
|
3776
3764
|
* const parentId = tree.newLeaf(new Style());
|
|
3765
|
+
* const child0 = tree.newLeaf(new Style());
|
|
3777
3766
|
* const child1 = tree.newLeaf(new Style());
|
|
3778
3767
|
* const child2 = tree.newLeaf(new Style());
|
|
3779
3768
|
* const child3 = tree.newLeaf(new Style());
|
|
3780
|
-
* tree.setChildren(parentId,
|
|
3769
|
+
* tree.setChildren(parentId, [child0, child1, child2, child3]);
|
|
3781
3770
|
*
|
|
3782
|
-
* tree.removeChildrenRange(parentId, 1, 3);
|
|
3771
|
+
* tree.removeChildrenRange(parentId, 1, 3); // Removes child1 and child2
|
|
3783
3772
|
* ```
|
|
3784
3773
|
* @param {bigint} parent
|
|
3785
3774
|
* @param {number} startIndex
|
|
@@ -3883,22 +3872,20 @@ export class TaffyTree {
|
|
|
3883
3872
|
* const tree = new TaffyTree();
|
|
3884
3873
|
* const id1 = tree.newLeaf(new Style());
|
|
3885
3874
|
* const id2 = tree.newLeaf(new Style());
|
|
3886
|
-
* const nodes =
|
|
3875
|
+
* const nodes = [id1, id2];
|
|
3887
3876
|
* const contexts = tree.getDisjointNodeContextMut(nodes);
|
|
3888
3877
|
* ```
|
|
3889
|
-
* @param {
|
|
3878
|
+
* @param {bigint[]} children
|
|
3890
3879
|
* @returns {any[]}
|
|
3891
3880
|
*/
|
|
3892
3881
|
getDisjointNodeContextMut(children) {
|
|
3893
|
-
const
|
|
3894
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3895
|
-
const ret = wasm.taffytree_getDisjointNodeContextMut(this.__wbg_ptr, ptr0, len0);
|
|
3882
|
+
const ret = wasm.taffytree_getDisjointNodeContextMut(this.__wbg_ptr, children);
|
|
3896
3883
|
if (ret[3]) {
|
|
3897
3884
|
throw takeFromExternrefTable0(ret[2]);
|
|
3898
3885
|
}
|
|
3899
|
-
var
|
|
3886
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3900
3887
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3901
|
-
return
|
|
3888
|
+
return v1;
|
|
3902
3889
|
}
|
|
3903
3890
|
/**
|
|
3904
3891
|
* Creates a new empty TaffyTree
|
|
@@ -4085,7 +4072,7 @@ export class TaffyTree {
|
|
|
4085
4072
|
*
|
|
4086
4073
|
* @param parent - The parent node ID
|
|
4087
4074
|
*
|
|
4088
|
-
* @returns - Array of child node IDs
|
|
4075
|
+
* @returns - Array of child node IDs
|
|
4089
4076
|
*
|
|
4090
4077
|
* @throws `TaffyError` if the parent node does not exist
|
|
4091
4078
|
*
|
|
@@ -4093,19 +4080,17 @@ export class TaffyTree {
|
|
|
4093
4080
|
* ```typescript
|
|
4094
4081
|
* const tree = new TaffyTree();
|
|
4095
4082
|
* const parentId = tree.newLeaf(new Style());
|
|
4096
|
-
* const children
|
|
4083
|
+
* const children = tree.children(parentId);
|
|
4097
4084
|
* ```
|
|
4098
4085
|
* @param {bigint} parent
|
|
4099
|
-
* @returns {
|
|
4086
|
+
* @returns {bigint[]}
|
|
4100
4087
|
*/
|
|
4101
4088
|
children(parent) {
|
|
4102
4089
|
const ret = wasm.taffytree_children(this.__wbg_ptr, parent);
|
|
4103
|
-
if (ret[
|
|
4104
|
-
throw takeFromExternrefTable0(ret[
|
|
4090
|
+
if (ret[2]) {
|
|
4091
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4105
4092
|
}
|
|
4106
|
-
|
|
4107
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
4108
|
-
return v1;
|
|
4093
|
+
return takeFromExternrefTable0(ret[0]);
|
|
4109
4094
|
}
|
|
4110
4095
|
/**
|
|
4111
4096
|
* Creates a new leaf node with the given style
|
|
@@ -4541,7 +4526,6 @@ function __wbg_get_imports() {
|
|
|
4541
4526
|
function __wbg_finalize_init(instance, module) {
|
|
4542
4527
|
wasm = instance.exports;
|
|
4543
4528
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
4544
|
-
cachedBigUint64ArrayMemory0 = null;
|
|
4545
4529
|
cachedDataViewMemory0 = null;
|
|
4546
4530
|
cachedUint8ArrayMemory0 = null;
|
|
4547
4531
|
|
package/pkg/taffy_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -176,7 +176,7 @@ export const style_width: (a: number) => any;
|
|
|
176
176
|
export const taffyerror_message: (a: number) => [number, number];
|
|
177
177
|
export const taffytree_addChild: (a: number, b: bigint, c: bigint) => [number, number];
|
|
178
178
|
export const taffytree_childCount: (a: number, b: bigint) => number;
|
|
179
|
-
export const taffytree_children: (a: number, b: bigint) => [number, number, number
|
|
179
|
+
export const taffytree_children: (a: number, b: bigint) => [number, number, number];
|
|
180
180
|
export const taffytree_clear: (a: number) => void;
|
|
181
181
|
export const taffytree_computeLayout: (a: number, b: bigint, c: any) => [number, number];
|
|
182
182
|
export const taffytree_computeLayoutWithMeasure: (a: number, b: bigint, c: any, d: any) => [number, number];
|
|
@@ -185,7 +185,7 @@ export const taffytree_dirty: (a: number, b: bigint) => [number, number, number]
|
|
|
185
185
|
export const taffytree_disableRounding: (a: number) => void;
|
|
186
186
|
export const taffytree_enableRounding: (a: number) => void;
|
|
187
187
|
export const taffytree_getChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
188
|
-
export const taffytree_getDisjointNodeContextMut: (a: number, b:
|
|
188
|
+
export const taffytree_getDisjointNodeContextMut: (a: number, b: any) => [number, number, number, number];
|
|
189
189
|
export const taffytree_getLayout: (a: number, b: bigint) => [number, number, number];
|
|
190
190
|
export const taffytree_getNodeContext: (a: number, b: bigint) => [number, number, number];
|
|
191
191
|
export const taffytree_getNodeContextMut: (a: number, b: bigint) => [number, number, number];
|
|
@@ -195,15 +195,15 @@ export const taffytree_markDirty: (a: number, b: bigint) => [number, number];
|
|
|
195
195
|
export const taffytree_new: () => number;
|
|
196
196
|
export const taffytree_newLeaf: (a: number, b: number) => [bigint, number, number];
|
|
197
197
|
export const taffytree_newLeafWithContext: (a: number, b: number, c: any) => [bigint, number, number];
|
|
198
|
-
export const taffytree_newWithChildren: (a: number, b: number, c:
|
|
198
|
+
export const taffytree_newWithChildren: (a: number, b: number, c: any) => [bigint, number, number];
|
|
199
199
|
export const taffytree_parent: (a: number, b: bigint) => [number, bigint];
|
|
200
|
-
export const taffytree_printTree: (a: number, b: bigint) =>
|
|
200
|
+
export const taffytree_printTree: (a: number, b: bigint) => [number, number];
|
|
201
201
|
export const taffytree_remove: (a: number, b: bigint) => [bigint, number, number];
|
|
202
202
|
export const taffytree_removeChild: (a: number, b: bigint, c: bigint) => [bigint, number, number];
|
|
203
203
|
export const taffytree_removeChildAtIndex: (a: number, b: bigint, c: number) => [bigint, number, number];
|
|
204
204
|
export const taffytree_removeChildrenRange: (a: number, b: bigint, c: number, d: number) => [number, number];
|
|
205
205
|
export const taffytree_replaceChildAtIndex: (a: number, b: bigint, c: number, d: bigint) => [bigint, number, number];
|
|
206
|
-
export const taffytree_setChildren: (a: number, b: bigint, c:
|
|
206
|
+
export const taffytree_setChildren: (a: number, b: bigint, c: any) => [number, number];
|
|
207
207
|
export const taffytree_setNodeContext: (a: number, b: bigint, c: any) => [number, number];
|
|
208
208
|
export const taffytree_setStyle: (a: number, b: bigint, c: number) => [number, number];
|
|
209
209
|
export const taffytree_totalNodeCount: (a: number) => number;
|