@thatopen/components 3.1.3 → 3.1.5
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 +0 -16
- package/dist/index.cjs +33 -12
- package/dist/index.d.ts +19 -7
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +2 -2
- package/dist/index.mjs +33 -12
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -24,22 +24,6 @@ This library is a collection of BIM tools based on [Three.js](https://github.com
|
|
|
24
24
|
Are you developing a project with our technology and would like our help?
|
|
25
25
|
Apply now to join [That Open Accelerator Program](https://thatopen.com/accelerator)!
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
## 🧩 Integration with fragments
|
|
29
|
-
As you might know, we have 4 open source libraries:
|
|
30
|
-
- [web-ifc](https://github.com/ThatOpen/engine_web-ifc): the IFC parser and geometry engine.
|
|
31
|
-
- [fragments](https://github.com/ThatOpen/engine_fragment): the open source format and 3D engine.
|
|
32
|
-
- [components](https://github.com/ThatOpen/engine_components): a set of tools to build BIM software fast.
|
|
33
|
-
- [ui components](https://github.com/ThatOpen/engine_ui-components): our agnostic UI system.
|
|
34
|
-
|
|
35
|
-
Components doesn't work with this new version of Fragments yet. In the next release, at the end of Q2, all components will be updated to work with this new version of Fragments. In the meantime, you have 3 options:
|
|
36
|
-
|
|
37
|
-
- Work with Fragments and build your own BIM components from scratch.
|
|
38
|
-
- Work with Components (which don't use this new version of Fragments).
|
|
39
|
-
- Check out our [Accelerator Program](https://thatopen.com/accelerator) to get previous access to the upcoming components.
|
|
40
|
-
|
|
41
|
-
Once the release at the end of Q2 is made, Components will work natively with this new version of Fragments.
|
|
42
|
-
|
|
43
27
|
## Packages
|
|
44
28
|
|
|
45
29
|
This library contains 2 packages:
|
package/dist/index.cjs
CHANGED
|
@@ -3562,6 +3562,7 @@ const _IfcLoader = class _IfcLoader extends Component {
|
|
|
3562
3562
|
const serializer = new FRAGS__namespace.IfcImporter();
|
|
3563
3563
|
serializer.wasm.path = this.settings.wasm.path;
|
|
3564
3564
|
serializer.wasm.absolute = this.settings.wasm.absolute;
|
|
3565
|
+
serializer.webIfcSettings = this.settings.webIfc;
|
|
3565
3566
|
if (config == null ? void 0 : config.instanceCallback)
|
|
3566
3567
|
config.instanceCallback(serializer);
|
|
3567
3568
|
const bytes = await serializer.process({
|
|
@@ -19579,7 +19580,7 @@ class IDSFacet {
|
|
|
19579
19580
|
checks.push(check);
|
|
19580
19581
|
}
|
|
19581
19582
|
}
|
|
19582
|
-
getItemChecks(collector, modelId, item) {
|
|
19583
|
+
getItemChecks(collector, modelId, item, skipIfFails) {
|
|
19583
19584
|
if (!("value" in item._localId && typeof item._localId.value === "number")) {
|
|
19584
19585
|
return null;
|
|
19585
19586
|
}
|
|
@@ -19589,7 +19590,7 @@ class IDSFacet {
|
|
|
19589
19590
|
collector.set(modelId, modelItemResults);
|
|
19590
19591
|
}
|
|
19591
19592
|
let result = modelItemResults.get(item._localId.value);
|
|
19592
|
-
if (result) {
|
|
19593
|
+
if (result && skipIfFails) {
|
|
19593
19594
|
if (!result.pass)
|
|
19594
19595
|
return null;
|
|
19595
19596
|
} else {
|
|
@@ -19735,7 +19736,7 @@ class IDSAttribute extends IDSFacet {
|
|
|
19735
19736
|
// Test cases from buildingSMART repo have been tested and they all match with the expected result
|
|
19736
19737
|
// All invalid cases have been treated as failures
|
|
19737
19738
|
// FragmentsGroup do not hold some of the entities used in the tests
|
|
19738
|
-
async test(items, collector) {
|
|
19739
|
+
async test(items, collector, config = { skipIfFails: true }) {
|
|
19739
19740
|
const fragments = this._components.get(FragmentsManager);
|
|
19740
19741
|
for (const [modelId, localIds] of Object.entries(items)) {
|
|
19741
19742
|
const model = fragments.list.get(modelId);
|
|
@@ -19743,7 +19744,12 @@ class IDSAttribute extends IDSFacet {
|
|
|
19743
19744
|
continue;
|
|
19744
19745
|
const data = await model.getItemsData([...localIds]);
|
|
19745
19746
|
for (const item of data) {
|
|
19746
|
-
const checks = this.getItemChecks(
|
|
19747
|
+
const checks = this.getItemChecks(
|
|
19748
|
+
collector,
|
|
19749
|
+
modelId,
|
|
19750
|
+
item,
|
|
19751
|
+
config.skipIfFails
|
|
19752
|
+
);
|
|
19747
19753
|
if (!checks)
|
|
19748
19754
|
continue;
|
|
19749
19755
|
const attrNames = Object.keys(item);
|
|
@@ -20068,7 +20074,7 @@ class IDSEntity extends IDSFacet {
|
|
|
20068
20074
|
}
|
|
20069
20075
|
}
|
|
20070
20076
|
}
|
|
20071
|
-
async test(items, collector) {
|
|
20077
|
+
async test(items, collector, config) {
|
|
20072
20078
|
const fragments = this._components.get(FragmentsManager);
|
|
20073
20079
|
for (const [modelId, localIds] of Object.entries(items)) {
|
|
20074
20080
|
const model = fragments.list.get(modelId);
|
|
@@ -20078,7 +20084,12 @@ class IDSEntity extends IDSFacet {
|
|
|
20078
20084
|
for (const item of data) {
|
|
20079
20085
|
if (!("value" in item._category))
|
|
20080
20086
|
continue;
|
|
20081
|
-
const checks = this.getItemChecks(
|
|
20087
|
+
const checks = this.getItemChecks(
|
|
20088
|
+
collector,
|
|
20089
|
+
modelId,
|
|
20090
|
+
item,
|
|
20091
|
+
config.skipIfFails
|
|
20092
|
+
);
|
|
20082
20093
|
if (!checks)
|
|
20083
20094
|
continue;
|
|
20084
20095
|
await this.evalName(item._category.value, checks);
|
|
@@ -20260,7 +20271,7 @@ class IDSProperty extends IDSFacet {
|
|
|
20260
20271
|
}
|
|
20261
20272
|
}
|
|
20262
20273
|
}
|
|
20263
|
-
async test(items, collector) {
|
|
20274
|
+
async test(items, collector, config = { skipIfFails: true }) {
|
|
20264
20275
|
const fragments = this._components.get(FragmentsManager);
|
|
20265
20276
|
for (const [modelId, localIds] of Object.entries(items)) {
|
|
20266
20277
|
const model = fragments.list.get(modelId);
|
|
@@ -20275,7 +20286,12 @@ class IDSProperty extends IDSFacet {
|
|
|
20275
20286
|
}
|
|
20276
20287
|
});
|
|
20277
20288
|
for (const item of data) {
|
|
20278
|
-
const checks = this.getItemChecks(
|
|
20289
|
+
const checks = this.getItemChecks(
|
|
20290
|
+
collector,
|
|
20291
|
+
modelId,
|
|
20292
|
+
item,
|
|
20293
|
+
config.skipIfFails
|
|
20294
|
+
);
|
|
20279
20295
|
if (!checks)
|
|
20280
20296
|
continue;
|
|
20281
20297
|
const sets = await this.getPsets(item);
|
|
@@ -20552,7 +20568,7 @@ class IDSMaterial extends IDSFacet {
|
|
|
20552
20568
|
}
|
|
20553
20569
|
}
|
|
20554
20570
|
}
|
|
20555
|
-
async test(items, collector) {
|
|
20571
|
+
async test(items, collector, config = { skipIfFails: true }) {
|
|
20556
20572
|
const fragments = this._components.get(FragmentsManager);
|
|
20557
20573
|
for (const [modelId, localIds] of Object.entries(items)) {
|
|
20558
20574
|
const model = fragments.list.get(modelId);
|
|
@@ -20569,7 +20585,12 @@ class IDSMaterial extends IDSFacet {
|
|
|
20569
20585
|
}
|
|
20570
20586
|
});
|
|
20571
20587
|
for (const item of data) {
|
|
20572
|
-
const checks = this.getItemChecks(
|
|
20588
|
+
const checks = this.getItemChecks(
|
|
20589
|
+
collector,
|
|
20590
|
+
modelId,
|
|
20591
|
+
item,
|
|
20592
|
+
config.skipIfFails
|
|
20593
|
+
);
|
|
20573
20594
|
if (!checks)
|
|
20574
20595
|
continue;
|
|
20575
20596
|
if (!Array.isArray(item.HasAssociations)) {
|
|
@@ -20735,7 +20756,7 @@ class IDSSpecification {
|
|
|
20735
20756
|
* @returns An array representing the test results.
|
|
20736
20757
|
* If no requirements are defined for the specification, an empty array is returned.
|
|
20737
20758
|
*/
|
|
20738
|
-
async test(modelIds) {
|
|
20759
|
+
async test(modelIds, config = { skipIfFails: true }) {
|
|
20739
20760
|
const result = new FRAGS__namespace.DataMap();
|
|
20740
20761
|
if (this.requirements.size === 0)
|
|
20741
20762
|
return result;
|
|
@@ -20747,7 +20768,7 @@ class IDSSpecification {
|
|
|
20747
20768
|
await Promise.all(applicabilityPromises);
|
|
20748
20769
|
const requirementPromises = [];
|
|
20749
20770
|
for (const requirement of this.requirements) {
|
|
20750
|
-
requirementPromises.push(requirement.test(entities, result));
|
|
20771
|
+
requirementPromises.push(requirement.test(entities, result, config));
|
|
20751
20772
|
}
|
|
20752
20773
|
await Promise.all(requirementPromises);
|
|
20753
20774
|
return result;
|
package/dist/index.d.ts
CHANGED
|
@@ -1896,7 +1896,9 @@ export declare class IDSAttribute extends IDSFacet {
|
|
|
1896
1896
|
constructor(components: Components, name: IDSFacetParameter);
|
|
1897
1897
|
serialize(type: "applicability" | "requirement"): string;
|
|
1898
1898
|
getEntities(): Promise<void>;
|
|
1899
|
-
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult
|
|
1899
|
+
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult>, config?: {
|
|
1900
|
+
skipIfFails: boolean;
|
|
1901
|
+
}): Promise<void>;
|
|
1900
1902
|
}
|
|
1901
1903
|
|
|
1902
1904
|
export declare interface IDSBoundsParameter {
|
|
@@ -1941,7 +1943,9 @@ export declare class IDSEntity extends IDSFacet {
|
|
|
1941
1943
|
constructor(components: Components, name: IDSFacetParameter);
|
|
1942
1944
|
serialize(type: "applicability" | "requirement"): string;
|
|
1943
1945
|
getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise<void>;
|
|
1944
|
-
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult
|
|
1946
|
+
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult>, config: {
|
|
1947
|
+
skipIfFails: boolean;
|
|
1948
|
+
}): Promise<void>;
|
|
1945
1949
|
protected evalName(category: string, checks?: IDSCheck[]): Promise<boolean>;
|
|
1946
1950
|
protected evalPredefinedType(modelId: string, itemData: FRAGS.ItemData, checks?: IDSCheck[]): Promise<boolean | null>;
|
|
1947
1951
|
}
|
|
@@ -1959,7 +1963,7 @@ export declare abstract class IDSFacet {
|
|
|
1959
1963
|
constructor(_components: Components);
|
|
1960
1964
|
protected addCheckResult(check: IDSCheck, checks: IDSCheck[]): void;
|
|
1961
1965
|
protected evalRequirement: (value: string | number | boolean | null, facetParameter: IDSFacetParameter, parameter: IDSFacetParameterName, checks?: IDSCheck[]) => boolean;
|
|
1962
|
-
protected getItemChecks(collector: ModelIdDataMap<IDSItemCheckResult>, modelId: string, item: FRAGS.ItemData): IDSCheck[] | null;
|
|
1966
|
+
protected getItemChecks(collector: ModelIdDataMap<IDSItemCheckResult>, modelId: string, item: FRAGS.ItemData, skipIfFails: boolean): IDSCheck[] | null;
|
|
1963
1967
|
/**
|
|
1964
1968
|
* Returns the list of expressIDs that pass the criteria of this facet.
|
|
1965
1969
|
* @param model - The IFC model to retrieve entities from.
|
|
@@ -1970,7 +1974,9 @@ export declare abstract class IDSFacet {
|
|
|
1970
1974
|
* @returns An array of express IDs of the retrieved entities.
|
|
1971
1975
|
*/
|
|
1972
1976
|
abstract getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise<void>;
|
|
1973
|
-
abstract test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult
|
|
1977
|
+
abstract test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult>, config: {
|
|
1978
|
+
skipIfFails: boolean;
|
|
1979
|
+
}): Promise<void>;
|
|
1974
1980
|
abstract serialize(type: "applicability" | "requirement"): string;
|
|
1975
1981
|
}
|
|
1976
1982
|
|
|
@@ -2020,7 +2026,9 @@ export declare class IDSMaterial extends IDSFacet {
|
|
|
2020
2026
|
uri?: string;
|
|
2021
2027
|
serialize(type: "applicability" | "requirement"): string;
|
|
2022
2028
|
getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise<void>;
|
|
2023
|
-
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult
|
|
2029
|
+
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult>, config?: {
|
|
2030
|
+
skipIfFails: boolean;
|
|
2031
|
+
}): Promise<void>;
|
|
2024
2032
|
private hasValidMaterial;
|
|
2025
2033
|
private evalValue;
|
|
2026
2034
|
}
|
|
@@ -2066,7 +2074,9 @@ export declare class IDSProperty extends IDSFacet {
|
|
|
2066
2074
|
constructor(components: Components, propertySet: IDSFacetParameter, baseName: IDSFacetParameter);
|
|
2067
2075
|
serialize(type: "applicability" | "requirement"): string;
|
|
2068
2076
|
getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise<void>;
|
|
2069
|
-
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult
|
|
2077
|
+
test(items: ModelIdMap, collector: ModelIdDataMap<IDSItemCheckResult>, config?: {
|
|
2078
|
+
skipIfFails: boolean;
|
|
2079
|
+
}): Promise<void>;
|
|
2070
2080
|
private getPropertyListName;
|
|
2071
2081
|
private getValueKey;
|
|
2072
2082
|
private getTypePsets;
|
|
@@ -2110,7 +2120,9 @@ export declare class IDSSpecification implements IDSSpecificationData {
|
|
|
2110
2120
|
* @returns An array representing the test results.
|
|
2111
2121
|
* If no requirements are defined for the specification, an empty array is returned.
|
|
2112
2122
|
*/
|
|
2113
|
-
test(modelIds: RegExp[]
|
|
2123
|
+
test(modelIds: RegExp[], config?: {
|
|
2124
|
+
skipIfFails: boolean;
|
|
2125
|
+
}): Promise<IDSCheckResult>;
|
|
2114
2126
|
/**
|
|
2115
2127
|
* Serializes the IDSSpecification instance into XML format.
|
|
2116
2128
|
*
|