@thatopen/components 3.1.4 → 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 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
@@ -19580,7 +19580,7 @@ class IDSFacet {
19580
19580
  checks.push(check);
19581
19581
  }
19582
19582
  }
19583
- getItemChecks(collector, modelId, item) {
19583
+ getItemChecks(collector, modelId, item, skipIfFails) {
19584
19584
  if (!("value" in item._localId && typeof item._localId.value === "number")) {
19585
19585
  return null;
19586
19586
  }
@@ -19590,7 +19590,7 @@ class IDSFacet {
19590
19590
  collector.set(modelId, modelItemResults);
19591
19591
  }
19592
19592
  let result = modelItemResults.get(item._localId.value);
19593
- if (result) {
19593
+ if (result && skipIfFails) {
19594
19594
  if (!result.pass)
19595
19595
  return null;
19596
19596
  } else {
@@ -19736,7 +19736,7 @@ class IDSAttribute extends IDSFacet {
19736
19736
  // Test cases from buildingSMART repo have been tested and they all match with the expected result
19737
19737
  // All invalid cases have been treated as failures
19738
19738
  // FragmentsGroup do not hold some of the entities used in the tests
19739
- async test(items, collector) {
19739
+ async test(items, collector, config = { skipIfFails: true }) {
19740
19740
  const fragments = this._components.get(FragmentsManager);
19741
19741
  for (const [modelId, localIds] of Object.entries(items)) {
19742
19742
  const model = fragments.list.get(modelId);
@@ -19744,7 +19744,12 @@ class IDSAttribute extends IDSFacet {
19744
19744
  continue;
19745
19745
  const data = await model.getItemsData([...localIds]);
19746
19746
  for (const item of data) {
19747
- const checks = this.getItemChecks(collector, modelId, item);
19747
+ const checks = this.getItemChecks(
19748
+ collector,
19749
+ modelId,
19750
+ item,
19751
+ config.skipIfFails
19752
+ );
19748
19753
  if (!checks)
19749
19754
  continue;
19750
19755
  const attrNames = Object.keys(item);
@@ -20069,7 +20074,7 @@ class IDSEntity extends IDSFacet {
20069
20074
  }
20070
20075
  }
20071
20076
  }
20072
- async test(items, collector) {
20077
+ async test(items, collector, config) {
20073
20078
  const fragments = this._components.get(FragmentsManager);
20074
20079
  for (const [modelId, localIds] of Object.entries(items)) {
20075
20080
  const model = fragments.list.get(modelId);
@@ -20079,7 +20084,12 @@ class IDSEntity extends IDSFacet {
20079
20084
  for (const item of data) {
20080
20085
  if (!("value" in item._category))
20081
20086
  continue;
20082
- const checks = this.getItemChecks(collector, modelId, item);
20087
+ const checks = this.getItemChecks(
20088
+ collector,
20089
+ modelId,
20090
+ item,
20091
+ config.skipIfFails
20092
+ );
20083
20093
  if (!checks)
20084
20094
  continue;
20085
20095
  await this.evalName(item._category.value, checks);
@@ -20261,7 +20271,7 @@ class IDSProperty extends IDSFacet {
20261
20271
  }
20262
20272
  }
20263
20273
  }
20264
- async test(items, collector) {
20274
+ async test(items, collector, config = { skipIfFails: true }) {
20265
20275
  const fragments = this._components.get(FragmentsManager);
20266
20276
  for (const [modelId, localIds] of Object.entries(items)) {
20267
20277
  const model = fragments.list.get(modelId);
@@ -20276,7 +20286,12 @@ class IDSProperty extends IDSFacet {
20276
20286
  }
20277
20287
  });
20278
20288
  for (const item of data) {
20279
- const checks = this.getItemChecks(collector, modelId, item);
20289
+ const checks = this.getItemChecks(
20290
+ collector,
20291
+ modelId,
20292
+ item,
20293
+ config.skipIfFails
20294
+ );
20280
20295
  if (!checks)
20281
20296
  continue;
20282
20297
  const sets = await this.getPsets(item);
@@ -20553,7 +20568,7 @@ class IDSMaterial extends IDSFacet {
20553
20568
  }
20554
20569
  }
20555
20570
  }
20556
- async test(items, collector) {
20571
+ async test(items, collector, config = { skipIfFails: true }) {
20557
20572
  const fragments = this._components.get(FragmentsManager);
20558
20573
  for (const [modelId, localIds] of Object.entries(items)) {
20559
20574
  const model = fragments.list.get(modelId);
@@ -20570,7 +20585,12 @@ class IDSMaterial extends IDSFacet {
20570
20585
  }
20571
20586
  });
20572
20587
  for (const item of data) {
20573
- const checks = this.getItemChecks(collector, modelId, item);
20588
+ const checks = this.getItemChecks(
20589
+ collector,
20590
+ modelId,
20591
+ item,
20592
+ config.skipIfFails
20593
+ );
20574
20594
  if (!checks)
20575
20595
  continue;
20576
20596
  if (!Array.isArray(item.HasAssociations)) {
@@ -20736,7 +20756,7 @@ class IDSSpecification {
20736
20756
  * @returns An array representing the test results.
20737
20757
  * If no requirements are defined for the specification, an empty array is returned.
20738
20758
  */
20739
- async test(modelIds) {
20759
+ async test(modelIds, config = { skipIfFails: true }) {
20740
20760
  const result = new FRAGS__namespace.DataMap();
20741
20761
  if (this.requirements.size === 0)
20742
20762
  return result;
@@ -20748,7 +20768,7 @@ class IDSSpecification {
20748
20768
  await Promise.all(applicabilityPromises);
20749
20769
  const requirementPromises = [];
20750
20770
  for (const requirement of this.requirements) {
20751
- requirementPromises.push(requirement.test(entities, result));
20771
+ requirementPromises.push(requirement.test(entities, result, config));
20752
20772
  }
20753
20773
  await Promise.all(requirementPromises);
20754
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>): Promise<void>;
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>): Promise<void>;
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>): Promise<void>;
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>): Promise<void>;
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>): Promise<void>;
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[]): Promise<IDSCheckResult>;
2123
+ test(modelIds: RegExp[], config?: {
2124
+ skipIfFails: boolean;
2125
+ }): Promise<IDSCheckResult>;
2114
2126
  /**
2115
2127
  * Serializes the IDSSpecification instance into XML format.
2116
2128
  *