@buerli.io/core 0.9.0 → 0.9.1-beta.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.
|
@@ -114,14 +114,25 @@ const structureApi = (set, get, buerliApi) => ({
|
|
|
114
114
|
},
|
|
115
115
|
filterTree: (tree, filter) => {
|
|
116
116
|
const objs = [];
|
|
117
|
-
Object.getOwnPropertyNames(tree)
|
|
118
|
-
|
|
117
|
+
const keys = Object.getOwnPropertyNames(tree);
|
|
118
|
+
for (const key of keys) {
|
|
119
|
+
const obj = tree[key];
|
|
119
120
|
if (filter(obj)) {
|
|
120
121
|
objs.push(obj);
|
|
121
122
|
}
|
|
122
|
-
}
|
|
123
|
+
}
|
|
123
124
|
return objs;
|
|
124
125
|
},
|
|
126
|
+
findTree: (tree, filter) => {
|
|
127
|
+
const keys = Object.getOwnPropertyNames(tree);
|
|
128
|
+
for (const key of keys) {
|
|
129
|
+
const obj = tree[key];
|
|
130
|
+
if (filter(obj)) {
|
|
131
|
+
return obj;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
},
|
|
125
136
|
collectUsedSolidIds: () => {
|
|
126
137
|
const { api, structure } = get();
|
|
127
138
|
const solidObjs = api.structure.filterTree(structure.tree, obj => typeof obj.geometryIdList !== 'undefined');
|
|
@@ -84,14 +84,25 @@ export const structureApi = (set, get, buerliApi) => ({
|
|
|
84
84
|
},
|
|
85
85
|
filterTree: (tree, filter) => {
|
|
86
86
|
const objs = [];
|
|
87
|
-
Object.getOwnPropertyNames(tree)
|
|
88
|
-
|
|
87
|
+
const keys = Object.getOwnPropertyNames(tree);
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
const obj = tree[key];
|
|
89
90
|
if (filter(obj)) {
|
|
90
91
|
objs.push(obj);
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
}
|
|
93
94
|
return objs;
|
|
94
95
|
},
|
|
96
|
+
findTree: (tree, filter) => {
|
|
97
|
+
const keys = Object.getOwnPropertyNames(tree);
|
|
98
|
+
for (const key of keys) {
|
|
99
|
+
const obj = tree[key];
|
|
100
|
+
if (filter(obj)) {
|
|
101
|
+
return obj;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
},
|
|
95
106
|
collectUsedSolidIds: () => {
|
|
96
107
|
const { api, structure } = get();
|
|
97
108
|
const solidObjs = api.structure.filterTree(structure.tree, obj => typeof obj.geometryIdList !== 'undefined');
|
|
@@ -14,6 +14,7 @@ export declare const structureApi: (set: StoreApi<DrawingState>['setState'], get
|
|
|
14
14
|
set: (structure: IStructureProtocol) => void;
|
|
15
15
|
applyPatches: (patches: IStructurePatch[]) => void;
|
|
16
16
|
filterTree: (tree: IStructureTree, filter: (obj: IStructureObject) => boolean) => IStructureObject[];
|
|
17
|
+
findTree: (tree: IStructureTree, filter: (obj: IStructureObject) => boolean) => IStructureObject | undefined;
|
|
17
18
|
collectUsedSolidIds: () => ObjectID[];
|
|
18
19
|
collectProducts: (root: ObjectID) => IStructureObject[];
|
|
19
20
|
getProductSolidIds: (productId: ObjectID) => number[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/core",
|
|
3
|
-
"version": "0.9.0",
|
|
3
|
+
"version": "0.9.1-beta.0",
|
|
4
4
|
"description": "buerli state management",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"fast-json-patch": "^3.1.1",
|
|
37
37
|
"jsonpatch": "^3.1.0",
|
|
38
|
-
"uuid": "^
|
|
38
|
+
"uuid": "^9.0.0",
|
|
39
39
|
"zustand": "^4.1.4"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|