@thatopen/components 3.1.6 → 3.2.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.md +76 -76
- package/dist/index.cjs +41 -37
- package/dist/index.d.ts +10 -6
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +3 -3
- package/dist/index.mjs +41 -37
- package/package.json +59 -59
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,10 @@ class Base {
|
|
|
105
105
|
__publicField(this, "isConfigurable", () => {
|
|
106
106
|
return "setup" in this && "config" in this && "onSetup" in this;
|
|
107
107
|
});
|
|
108
|
+
/** Whether is component is {@link Serializable}. */
|
|
109
|
+
__publicField(this, "isSerializable", () => {
|
|
110
|
+
return "import" in this && "export" in this;
|
|
111
|
+
});
|
|
108
112
|
this.components = components;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
@@ -3157,6 +3161,7 @@ const _FragmentsManager = class _FragmentsManager extends Component {
|
|
|
3157
3161
|
super(components);
|
|
3158
3162
|
/** {@link Disposable.onDisposed} */
|
|
3159
3163
|
__publicField(this, "onDisposed", new Event());
|
|
3164
|
+
__publicField(this, "onBeforeDispose", new Event());
|
|
3160
3165
|
/**
|
|
3161
3166
|
* Event triggered when fragments are loaded.
|
|
3162
3167
|
*/
|
|
@@ -3165,10 +3170,12 @@ const _FragmentsManager = class _FragmentsManager extends Component {
|
|
|
3165
3170
|
__publicField(this, "baseCoordinationMatrix", new THREE$1.Matrix4());
|
|
3166
3171
|
/** {@link Component.enabled} */
|
|
3167
3172
|
__publicField(this, "enabled", true);
|
|
3168
|
-
__publicField(this, "initialized", false);
|
|
3169
3173
|
__publicField(this, "_core");
|
|
3170
3174
|
this.components.add(_FragmentsManager.uuid, this);
|
|
3171
3175
|
}
|
|
3176
|
+
get initialized() {
|
|
3177
|
+
return !!this._core;
|
|
3178
|
+
}
|
|
3172
3179
|
/**
|
|
3173
3180
|
* Map containing all loaded fragment models.
|
|
3174
3181
|
* The key is the group's unique identifier, and the value is the model itself.
|
|
@@ -3182,8 +3189,12 @@ const _FragmentsManager = class _FragmentsManager extends Component {
|
|
|
3182
3189
|
}
|
|
3183
3190
|
return this._core;
|
|
3184
3191
|
}
|
|
3192
|
+
get _hasCoordinationModel() {
|
|
3193
|
+
return this.baseCoordinationModel !== "";
|
|
3194
|
+
}
|
|
3185
3195
|
/** {@link Disposable.dispose} */
|
|
3186
3196
|
dispose() {
|
|
3197
|
+
this.onBeforeDispose.trigger();
|
|
3187
3198
|
if (this._core) {
|
|
3188
3199
|
this.core.dispose();
|
|
3189
3200
|
this._core = void 0;
|
|
@@ -3195,12 +3206,14 @@ const _FragmentsManager = class _FragmentsManager extends Component {
|
|
|
3195
3206
|
}
|
|
3196
3207
|
init(workerURL) {
|
|
3197
3208
|
this._core = new FragmentsModels(workerURL);
|
|
3198
|
-
this.
|
|
3199
|
-
|
|
3200
|
-
|
|
3209
|
+
this.core.onModelLoaded.add(async () => {
|
|
3210
|
+
if (this._hasCoordinationModel)
|
|
3211
|
+
return;
|
|
3212
|
+
const firstModel = [...this.list.values()][0];
|
|
3213
|
+
if (!firstModel)
|
|
3201
3214
|
return;
|
|
3202
|
-
this.baseCoordinationModel =
|
|
3203
|
-
this.baseCoordinationMatrix = await
|
|
3215
|
+
this.baseCoordinationModel = firstModel.modelId;
|
|
3216
|
+
this.baseCoordinationMatrix = await firstModel.getCoordinationMatrix();
|
|
3204
3217
|
});
|
|
3205
3218
|
this.list.onItemDeleted.add(() => {
|
|
3206
3219
|
if (this.list.size > 0)
|
|
@@ -3875,7 +3888,7 @@ __publicField(_BoundingBoxer, "uuid", "d1444724-dba6-4cdd-a0c7-68ee1450d166");
|
|
|
3875
3888
|
let BoundingBoxer = _BoundingBoxer;
|
|
3876
3889
|
class FinderQuery {
|
|
3877
3890
|
constructor(components, queries) {
|
|
3878
|
-
__publicField(this, "
|
|
3891
|
+
__publicField(this, "customData", {});
|
|
3879
3892
|
__publicField(this, "_components");
|
|
3880
3893
|
__publicField(this, "_queries", []);
|
|
3881
3894
|
__publicField(this, "_aggregation", "exclusive");
|
|
@@ -3998,9 +4011,11 @@ class FinderQuery {
|
|
|
3998
4011
|
* @returns A `SerializedFinderQuery` object representing the serialized query.
|
|
3999
4012
|
*/
|
|
4000
4013
|
toJSON() {
|
|
4014
|
+
const manager = this._components.get(ItemsFinder);
|
|
4015
|
+
const name = manager.list.getKey(this) ?? "Finder Query";
|
|
4001
4016
|
const result = {
|
|
4002
|
-
name
|
|
4003
|
-
|
|
4017
|
+
name,
|
|
4018
|
+
customData: this.customData,
|
|
4004
4019
|
queries: this.queries.map(this.serializeQueryParameters),
|
|
4005
4020
|
aggregation: this.aggregation,
|
|
4006
4021
|
cache: this.cache
|
|
@@ -4032,7 +4047,7 @@ class FinderQuery {
|
|
|
4032
4047
|
* @returns A `FinderQuery` instance.
|
|
4033
4048
|
*/
|
|
4034
4049
|
fromJSON(data) {
|
|
4035
|
-
this.
|
|
4050
|
+
this.customData = data.customData;
|
|
4036
4051
|
this.aggregation = data.aggregation;
|
|
4037
4052
|
this.cache = data.cache;
|
|
4038
4053
|
this.queries = data.queries.map(this.deserializeQueryParameters);
|
|
@@ -4132,9 +4147,9 @@ const _ItemsFinder = class _ItemsFinder extends Component {
|
|
|
4132
4147
|
if (!data)
|
|
4133
4148
|
return instances;
|
|
4134
4149
|
for (const value of data) {
|
|
4135
|
-
const { name,
|
|
4150
|
+
const { name, customData, queries, aggregation, cache } = value;
|
|
4136
4151
|
const finderQuery = this.create(name, []);
|
|
4137
|
-
finderQuery.fromJSON({
|
|
4152
|
+
finderQuery.fromJSON({ customData, queries, aggregation, cache });
|
|
4138
4153
|
instances.push(finderQuery);
|
|
4139
4154
|
}
|
|
4140
4155
|
return instances;
|
|
@@ -15876,21 +15891,6 @@ ${users}
|
|
|
15876
15891
|
const viewpoint = new Viewpoint(this.components, bcfViewpoint);
|
|
15877
15892
|
createdViewpoints.push(viewpoint);
|
|
15878
15893
|
}
|
|
15879
|
-
const getNameWithoutExtension = (name) => {
|
|
15880
|
-
const partsBySlash = name.split("/");
|
|
15881
|
-
const partsByDot = partsBySlash[partsBySlash.length - 1].split(".");
|
|
15882
|
-
partsByDot.pop();
|
|
15883
|
-
return partsByDot.join(".");
|
|
15884
|
-
};
|
|
15885
|
-
const snapshotFiles = files.filter(
|
|
15886
|
-
(file) => file.name.endsWith(".png") || file.name.endsWith(".jpeg")
|
|
15887
|
-
);
|
|
15888
|
-
for (const file of snapshotFiles) {
|
|
15889
|
-
const name = getNameWithoutExtension(file.name);
|
|
15890
|
-
const buffer = await file.async("arraybuffer");
|
|
15891
|
-
const bytes = new Uint8Array(buffer);
|
|
15892
|
-
viewpoints.snapshots.set(name, bytes);
|
|
15893
|
-
}
|
|
15894
15894
|
const topicRelations = {};
|
|
15895
15895
|
const topics = [];
|
|
15896
15896
|
const markupFiles = files.filter((file) => file.name.endsWith(".bcf"));
|
|
@@ -15939,12 +15939,16 @@ ${users}
|
|
|
15939
15939
|
if (!(markupViewpoint && markupViewpoint.Guid))
|
|
15940
15940
|
continue;
|
|
15941
15941
|
const viewpoint = viewpoints.list.get(markupViewpoint.Guid);
|
|
15942
|
-
if (viewpoint)
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
15946
|
-
|
|
15947
|
-
|
|
15942
|
+
if (!viewpoint)
|
|
15943
|
+
continue;
|
|
15944
|
+
topic.viewpoints.add(viewpoint.guid);
|
|
15945
|
+
const snapshotName = `${topic.guid}/${markupViewpoint.Snapshot}`;
|
|
15946
|
+
const snapshotFile = files.find(({ name }) => name === snapshotName);
|
|
15947
|
+
if (snapshotFile) {
|
|
15948
|
+
const buffer = await snapshotFile.async("arraybuffer");
|
|
15949
|
+
const bytes = new Uint8Array(buffer);
|
|
15950
|
+
viewpoints.snapshots.set(viewpoint.guid, bytes);
|
|
15951
|
+
viewpoint.snapshot = viewpoint.guid ?? null;
|
|
15948
15952
|
}
|
|
15949
15953
|
}
|
|
15950
15954
|
const markupDocReferences = this.getMarkupDocumentReferences(
|
|
@@ -18477,21 +18481,21 @@ ${colorTags}
|
|
|
18477
18481
|
</CameraUpVector>`;
|
|
18478
18482
|
const cameraRatioXML = `<AspectRatio>${this.camera.aspect_ratio}</AspectRatio>`;
|
|
18479
18483
|
let cameraXML = "";
|
|
18480
|
-
if ("
|
|
18484
|
+
if ("view_to_world_scale" in this.camera) {
|
|
18481
18485
|
cameraXML = `<OrthogonalCamera>
|
|
18482
18486
|
${cameraViewpointXML}
|
|
18483
18487
|
${cameraDirectionXML}
|
|
18484
18488
|
${cameraUpVectorXML}
|
|
18485
18489
|
${cameraRatioXML}
|
|
18486
|
-
<ViewToWorldScale>${this.camera.
|
|
18490
|
+
<ViewToWorldScale>${this.camera.view_to_world_scale}</ViewToWorldScale>
|
|
18487
18491
|
</OrthogonalCamera>`;
|
|
18488
|
-
} else if ("
|
|
18492
|
+
} else if ("field_of_view" in this.camera) {
|
|
18489
18493
|
cameraXML = `<PerspectiveCamera>
|
|
18490
18494
|
${cameraViewpointXML}
|
|
18491
18495
|
${cameraDirectionXML}
|
|
18492
18496
|
${cameraUpVectorXML}
|
|
18493
18497
|
${cameraRatioXML}
|
|
18494
|
-
<FieldOfView>${this.camera.
|
|
18498
|
+
<FieldOfView>${this.camera.field_of_view}</FieldOfView>
|
|
18495
18499
|
</PerspectiveCamera>`;
|
|
18496
18500
|
}
|
|
18497
18501
|
const viewSetupHints = `<ViewSetupHints SpacesVisible="${this.spacesVisible ?? false}" SpaceBoundariesVisible="${this.spaceBoundariesVisible ?? false}" OpeningsVisible="${this.openingsVisible ?? false}" />`;
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@thatopen/components",
|
|
3
|
-
"description": "Collection of core functionalities to author BIM apps.",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"author": "That Open Company",
|
|
6
|
-
"contributors": [
|
|
7
|
-
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
|
|
8
|
-
"Juan Hoyos (https://github.com/HoyosJuan)",
|
|
9
|
-
"Harry Collin (https://github.com/harrycollin)",
|
|
10
|
-
"Pablo Aguilar (https://github.com/pabloaguilarv"
|
|
11
|
-
],
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"homepage": "https://github.com/ThatOpen/engine_components/tree/main/packages/components#readme",
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/ThatOpen/engine_components/issues"
|
|
16
|
-
},
|
|
17
|
-
"type": "module",
|
|
18
|
-
"main": "dist/index.cjs",
|
|
19
|
-
"module": "dist/index.mjs",
|
|
20
|
-
"types": "dist/index.d.ts",
|
|
21
|
-
"files": [
|
|
22
|
-
"dist",
|
|
23
|
-
"README.md"
|
|
24
|
-
],
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/ThatOpen/engine_components/tree/main/packages/components.git"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"dev": "vite --host",
|
|
31
|
-
"test": "jest",
|
|
32
|
-
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
33
|
-
"prepublishOnly": "node ./resources/updateComponentsVersion.mjs && yarn build",
|
|
34
|
-
"publish-repo": "npm publish"
|
|
35
|
-
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@thatopen/fragments": "~3.
|
|
41
|
-
"@thatopen/ui": "~3.
|
|
42
|
-
"@types/convert-units": "2.3.11",
|
|
43
|
-
"@types/three": "0.175.0",
|
|
44
|
-
"stats.js": "^0.17.0",
|
|
45
|
-
"three": "^0.175.0",
|
|
46
|
-
"web-ifc": "0.0.
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"camera-controls": "^2.9.0",
|
|
50
|
-
"fast-xml-parser": "4.4.1",
|
|
51
|
-
"jszip": "3.10.1",
|
|
52
|
-
"three-mesh-bvh": "0.7.0"
|
|
53
|
-
},
|
|
54
|
-
"peerDependencies": {
|
|
55
|
-
"@thatopen/fragments": "~3.
|
|
56
|
-
"three": ">=0.175.0",
|
|
57
|
-
"web-ifc": ">=0.0.
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@thatopen/components",
|
|
3
|
+
"description": "Collection of core functionalities to author BIM apps.",
|
|
4
|
+
"version": "3.2.0",
|
|
5
|
+
"author": "That Open Company",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
|
|
8
|
+
"Juan Hoyos (https://github.com/HoyosJuan)",
|
|
9
|
+
"Harry Collin (https://github.com/harrycollin)",
|
|
10
|
+
"Pablo Aguilar (https://github.com/pabloaguilarv"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/ThatOpen/engine_components/tree/main/packages/components#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ThatOpen/engine_components/issues"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "dist/index.cjs",
|
|
19
|
+
"module": "dist/index.mjs",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/ThatOpen/engine_components/tree/main/packages/components.git"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "vite --host",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
33
|
+
"prepublishOnly": "node ./resources/updateComponentsVersion.mjs && yarn build",
|
|
34
|
+
"publish-repo": "npm publish"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@thatopen/fragments": "~3.2.0",
|
|
41
|
+
"@thatopen/ui": "~3.2.0",
|
|
42
|
+
"@types/convert-units": "2.3.11",
|
|
43
|
+
"@types/three": "0.175.0",
|
|
44
|
+
"stats.js": "^0.17.0",
|
|
45
|
+
"three": "^0.175.0",
|
|
46
|
+
"web-ifc": "0.0.72"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"camera-controls": "^2.9.0",
|
|
50
|
+
"fast-xml-parser": "4.4.1",
|
|
51
|
+
"jszip": "3.10.1",
|
|
52
|
+
"three-mesh-bvh": "0.7.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@thatopen/fragments": "~3.2.0",
|
|
56
|
+
"three": ">=0.175.0",
|
|
57
|
+
"web-ifc": ">=0.0.72"
|
|
58
|
+
}
|
|
59
|
+
}
|