@thatopen/components 2.4.0-alpha.9 → 2.4.1

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.
Files changed (35) hide show
  1. package/dist/core/Components/index.d.ts +1 -1
  2. package/dist/core/ConfigManager/src/configurator.d.ts +5 -3
  3. package/dist/core/ShadowedScene/index.d.ts +1 -2
  4. package/dist/core/Types/src/component-with-ui.d.ts +8 -3
  5. package/dist/core/Types/src/config-types.d.ts +5 -0
  6. package/dist/core/Types/src/data-map.d.ts +3 -1
  7. package/dist/core/Types/src/data-set.d.ts +1 -2
  8. package/dist/core/Viewpoints/src/viewpoint.d.ts +2 -2
  9. package/dist/fragments/Classifier/index.d.ts +15 -2
  10. package/dist/fragments/IfcGeometryTiler/index.d.ts +1 -0
  11. package/dist/ifc/IfcIsolator/index.d.ts +24 -0
  12. package/dist/ifc/IfcPropertiesManager/index.d.ts +7 -3
  13. package/dist/ifc/IfcRelationsIndexer/index.d.ts +8 -18
  14. package/dist/ifc/IfcRelationsIndexer/src/newVersion.d.ts +51 -0
  15. package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +16 -0
  16. package/dist/ifc/index.d.ts +1 -0
  17. package/dist/index.cjs +416 -240
  18. package/dist/index.min.cjs +3 -3
  19. package/dist/index.min.mjs +3 -3
  20. package/dist/index.mjs +417 -241
  21. package/dist/namespace.d.ts +3745 -3604
  22. package/dist/openbim/BCFTopics/index.d.ts +1 -2
  23. package/dist/openbim/BCFTopics/src/Topic.d.ts +5 -1
  24. package/dist/openbim/BCFTopics/src/bcf-topics-config.d.ts +1 -2
  25. package/dist/openbim/IDSSpecifications/index.d.ts +1 -2
  26. package/dist/openbim/IDSSpecifications/src/Specification.d.ts +4 -3
  27. package/dist/openbim/IDSSpecifications/src/facets/Attribute.d.ts +1 -0
  28. package/dist/openbim/IDSSpecifications/src/facets/Classification.d.ts +1 -0
  29. package/dist/openbim/IDSSpecifications/src/facets/Entity.d.ts +1 -0
  30. package/dist/openbim/IDSSpecifications/src/facets/Facet.d.ts +2 -1
  31. package/dist/openbim/IDSSpecifications/src/facets/Material.d.ts +1 -0
  32. package/dist/openbim/IDSSpecifications/src/facets/PartOf.d.ts +1 -0
  33. package/dist/openbim/IDSSpecifications/src/facets/Property.d.ts +3 -0
  34. package/dist/openbim/IDSSpecifications/src/types.d.ts +39 -20
  35. package/package.json +5 -5
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
6
6
  /**
7
7
  * The version of the @thatopen/components library.
8
8
  */
9
- static readonly release = "2.4.0-alpha.1";
9
+ static readonly release = "2.4.1";
10
10
  /** {@link Disposable.onDisposed} */
11
11
  readonly onDisposed: Event<void>;
12
12
  /**
@@ -1,11 +1,13 @@
1
- import { ControlsSchema, ControlEntry } from "../../Types";
1
+ import { ControlsSchema } from "../../Types";
2
2
  import { Components } from "../../Components";
3
- export declare abstract class Configurator<T, U extends ControlsSchema> {
3
+ export declare abstract class Configurator<T = any, U extends ControlsSchema = ControlsSchema> {
4
4
  protected abstract _config: U;
5
5
  protected _component: T;
6
6
  name: string;
7
7
  uuid: string;
8
8
  get controls(): U;
9
9
  constructor(component: T, components: Components, name: string, uuid?: string);
10
- copyEntry(controlEntry: ControlEntry): ControlEntry;
10
+ set(data: Partial<U>): void;
11
+ export(controls?: ControlsSchema, exported?: any): any;
12
+ import(exported: any, imported?: any, first?: boolean): void;
11
13
  }
@@ -2,8 +2,7 @@ import { SimpleScene, SimpleSceneConfig, SimpleSceneConfigManager } from "../Wor
2
2
  import { DistanceRenderer } from "./src";
3
3
  import { Configurable, Disposable } from "../Types";
4
4
  /**
5
- * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
6
- * as well as shadows.
5
+ * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights, as well as shadows.
7
6
  */
8
7
  export interface ShadowedSceneConfig extends SimpleSceneConfig {
9
8
  shadows: {
@@ -1,11 +1,16 @@
1
1
  import { Component } from "./component";
2
+ import { Configurator } from "../../ConfigManager";
3
+ import { Components } from "../../Components";
2
4
  export type ComponentUIElement = {
3
5
  name: string;
6
+ id: string;
7
+ icon: string;
4
8
  componentID: string;
5
- attributes: {
6
- [name: string]: string;
9
+ get: (components: Components) => {
10
+ element: HTMLElement;
11
+ config?: Configurator;
12
+ dispose?: () => void;
7
13
  };
8
- get: () => HTMLElement;
9
14
  };
10
15
  export declare abstract class ComponentWithUI extends Component {
11
16
  abstract name: string;
@@ -40,3 +40,8 @@ export type ControlEntry = BooleanSettingsControl | ColorSettingsControl | TextS
40
40
  export interface ControlsSchema {
41
41
  [name: string]: ControlEntry | ControlsSchema;
42
42
  }
43
+ export declare class ControlsUtils {
44
+ static isEntry(item: any): boolean;
45
+ static copySchema<T extends ControlsSchema = ControlsSchema>(schema: T, copy?: ControlsSchema): T;
46
+ static copyEntry(controlEntry: ControlEntry): ControlEntry;
47
+ }
@@ -39,7 +39,9 @@ export declare class DataMap<K, V> extends Map<K, V> {
39
39
  */
40
40
  clear(): void;
41
41
  /**
42
- * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
42
+ * Sets the value for the specified key in the map.
43
+ * If the item is new, then onItemSet is triggered.
44
+ * If the item is already in the map, then onItemUpdated is triggered.
43
45
  *
44
46
  * @param key - The key of the item to set.
45
47
  * @param value - The value of the item to set.
@@ -1,7 +1,6 @@
1
1
  import { Event } from "./event";
2
2
  /**
3
- * A class that extends the built-in Set class and provides additional functionality.
4
- * It triggers events when items are added, deleted, or the set is cleared.
3
+ * A class that extends the built-in Set class and provides additional functionality. It triggers events when items are added, deleted, or the set is cleared.
5
4
  *
6
5
  * @template T - The type of elements in the set.
7
6
  */
@@ -150,7 +150,7 @@ export declare class Viewpoint implements BCFViewpoint {
150
150
  *
151
151
  * @returns A Promise that resolves when the camera has been set.
152
152
  */
153
- go(transition?: boolean): Promise<void>;
153
+ go(world?: World, transition?: boolean): Promise<void>;
154
154
  /**
155
155
  * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
156
156
  *
@@ -162,7 +162,7 @@ export declare class Viewpoint implements BCFViewpoint {
162
162
  * @throws An error if the world's camera does not have camera controls.
163
163
  * @throws An error if the world's renderer is not available.
164
164
  */
165
- updateCamera(): void;
165
+ updateCamera(world?: World): void;
166
166
  applyVisibility(): void;
167
167
  /**
168
168
  * Applies color to the components in the viewpoint based on their GUIDs.
@@ -21,6 +21,17 @@ export interface Classification {
21
21
  };
22
22
  };
23
23
  }
24
+ interface ExportedClassification {
25
+ [system: string]: {
26
+ [groupName: string]: {
27
+ map: {
28
+ [name: string]: number[];
29
+ };
30
+ name: string;
31
+ id: number | null;
32
+ };
33
+ };
34
+ }
24
35
  /**
25
36
  * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
26
37
  */
@@ -143,6 +154,7 @@ export declare class Classifier extends Component implements Disposable {
143
154
  bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
144
155
  useProperties?: boolean;
145
156
  isolate?: Set<number>;
157
+ systemName?: string;
146
158
  }): Promise<void>;
147
159
  /**
148
160
  * Sets the color of the specified fragments.
@@ -174,11 +186,12 @@ export declare class Classifier extends Component implements Disposable {
174
186
  * Exports the computed classification to persists them and import them back
175
187
  * later for faster loading.
176
188
  */
177
- export(): string;
189
+ export(): ExportedClassification;
178
190
  /**
179
191
  * Imports a classification previously exported with .export().
180
192
  * @param data the serialized classification to import.
181
193
  */
182
- import(data: string): void;
194
+ import(data: ExportedClassification): void;
183
195
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
184
196
  }
197
+ export {};
@@ -98,5 +98,6 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
98
98
  private getGeometry;
99
99
  private streamAssets;
100
100
  private streamGeometries;
101
+ private outputGeometries;
101
102
  private registerGeometryData;
102
103
  }
@@ -0,0 +1,24 @@
1
+ import * as WEBIFC from "web-ifc";
2
+ import { Component, Components } from "../../core";
3
+ /**
4
+ * Component to isolate certain elements from an IFC and export to another IFC. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcIsolator). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcIsolator).
5
+ */
6
+ export declare class IfcIsolator extends Component {
7
+ /**
8
+ * A unique identifier for the component.
9
+ * This UUID is used to register the component within the Components system.
10
+ */
11
+ static readonly uuid: "6eb0ba2f-71c0-464e-bcec-2d7c335186b2";
12
+ /** {@link Component.enabled} */
13
+ enabled: boolean;
14
+ constructor(components: Components);
15
+ getIsolatedElements(webIfc: WEBIFC.IfcAPI, modelID: number, elementIDs: Array<number>): Promise<any[]>;
16
+ /**
17
+ * Exports isolated elements to the new model.
18
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
19
+ * @param modelID ID of the new IFC model.
20
+ * @param isolatedElements The array of isolated elements
21
+ */
22
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, isolatedElements: Array<any>): Promise<Uint8Array>;
23
+ splitIfc(webIfc: WEBIFC.IfcAPI, ifcFile: ArrayBuffer, idsToExtract: Array<number>): Promise<Uint8Array>;
24
+ }
@@ -138,7 +138,6 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
138
138
  */
139
139
  newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
140
140
  pset: WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
141
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties;
142
141
  }>;
143
142
  /**
144
143
  * Removes a Property Set (Pset) from the given model.
@@ -278,8 +277,13 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
278
277
  setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
279
278
  private getNewExpressID;
280
279
  private newGUID;
281
- private getOwnerHistory;
282
- private registerChange;
280
+ getOwnerHistory(model: FragmentsGroup): Promise<{
281
+ entity: {
282
+ [attribute: string]: any;
283
+ };
284
+ handle: WEBIFC.Handle<unknown>;
285
+ }>;
286
+ registerChange(model: FragmentsGroup, ...expressID: number[]): void;
283
287
  private newSingleProperty;
284
288
  }
285
289
  export * from "./src";
@@ -1,7 +1,7 @@
1
1
  import * as WEBIFC from "web-ifc";
2
2
  import { FragmentsGroup } from "@thatopen/fragments";
3
3
  import { Disposable, Event, Component, Components } from "../../core";
4
- import { RelationsMap, ModelsRelationMap, InverseAttribute, IfcRelation } from "./src";
4
+ import { RelationsMap, ModelsRelationMap, InverseAttribute, IfcRelation, RelationsProcessingConfig, EntitiesRelatedEvent } from "./src";
5
5
  /**
6
6
  * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
7
7
  */
@@ -42,7 +42,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
42
42
  constructor(components: Components);
43
43
  private onFragmentsDisposed;
44
44
  private indexRelations;
45
- getAttributeIndex(inverseAttribute: InverseAttribute): number | null;
45
+ getAttributeIndex(inverseAttribute: InverseAttribute): number;
46
46
  /**
47
47
  * Adds a relation map to the model's relations map.
48
48
  *
@@ -68,7 +68,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
68
68
  * representation of the relations indexed by entity expressIDs and relation types.
69
69
  * @throws An error if the model does not have properties loaded.
70
70
  */
71
- process(model: FragmentsGroup): Promise<RelationsMap>;
71
+ process(model: FragmentsGroup, config?: Partial<RelationsProcessingConfig>): Promise<RelationsMap>;
72
72
  /**
73
73
  * Processes a given model from a WebIfc API to index its IFC entities relations.
74
74
  *
@@ -85,11 +85,10 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
85
85
  *
86
86
  * @param model The `FragmentsGroup` model containing the entity, or its UUID.
87
87
  * @param expressID The unique identifier of the entity within the model.
88
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
89
- * @returns An array of express IDs representing the related entities, or `null` if no relations are found
90
- * or the specified relation name is not indexed.
88
+ * @param attribute The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
89
+ * @returns An array of express IDs representing the related entities. If the array is empty, no relations were found.
91
90
  */
92
- getEntityRelations(model: FragmentsGroup | string, expressID: number, relationName: InverseAttribute): number[] | null;
91
+ getEntityRelations(model: FragmentsGroup | string | RelationsMap, expressID: number, attribute: InverseAttribute): number[];
93
92
  /**
94
93
  * Serializes the relations of a given relation map into a JSON string.
95
94
  * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
@@ -166,7 +165,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
166
165
  * Converts the relations made into actual IFC data.
167
166
  *
168
167
  * @remarks This function iterates through the changes made to the relations and applies them to the corresponding BIM model.
169
- * It only make sense to use if the relations need to be write in the IFC file.
168
+ * It only make sense to use it if the relations need to be write in the IFC file.
170
169
  *
171
170
  * @returns A promise that resolves when all the relation changes have been applied.
172
171
  */
@@ -177,16 +176,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
177
176
  * The event provides information about the type of relation, the inverse attribute,
178
177
  * the IDs of the entities related, and the IDs of the entities that are being related.
179
178
  */
180
- readonly onEntitiesRelated: Event<{
181
- /** The type of the IFC relation. */
182
- relType: IfcRelation;
183
- /** The inverse attribute of the relation. */
184
- invAttribute: InverseAttribute;
185
- /** The IDs of the entities that are relating. */
186
- relatingIDs: number[];
187
- /** The IDs of the entities that are being related. */
188
- relatedIDs: number[];
189
- }>;
179
+ readonly onEntitiesRelated: Event<EntitiesRelatedEvent>;
190
180
  addEntitiesRelation(model: FragmentsGroup, relatingID: number, rel: {
191
181
  type: IfcRelation;
192
182
  inv: InverseAttribute;
@@ -0,0 +1,51 @@
1
+ declare const actual: {
2
+ 186: {
3
+ 7: number[];
4
+ };
5
+ 250: {
6
+ 8: number[];
7
+ };
8
+ 253: {
9
+ 8: number[];
10
+ };
11
+ 257: {
12
+ 8: number[];
13
+ };
14
+ };
15
+ declare const newVersion: {
16
+ 186: {
17
+ 7: ({
18
+ 259: number[];
19
+ 263?: undefined;
20
+ 266?: undefined;
21
+ } | {
22
+ 263: number[];
23
+ 259?: undefined;
24
+ 266?: undefined;
25
+ } | {
26
+ 266: number[];
27
+ 259?: undefined;
28
+ 263?: undefined;
29
+ })[];
30
+ };
31
+ 190: {
32
+ 7: {
33
+ 259: number[];
34
+ }[];
35
+ };
36
+ 250: {
37
+ 8: {
38
+ 259: number[];
39
+ }[];
40
+ };
41
+ };
42
+ interface V2Schema {
43
+ [expressID: number]: {
44
+ [invAttrIndex: number]: {
45
+ [IfcRelationship: number]: number[];
46
+ };
47
+ };
48
+ }
49
+ type RelationsMap = Map<number, Map<number, {
50
+ [ifcRel: number]: number[];
51
+ }>>;
@@ -55,3 +55,19 @@ export type IfcRelations = [
55
55
  typeof WEBIFC.IFCRELASSOCIATESDOCUMENT
56
56
  ];
57
57
  export type IfcRelation = IfcRelations[number];
58
+ export interface RelationsProcessingConfig {
59
+ relationsToProcess: IfcRelation[];
60
+ }
61
+ /**
62
+ * Interface definition of an Entities Related Event from the IfcRelationsIndexer. This event gets triggered when two or more entities has been related with each other.
63
+ */
64
+ export interface EntitiesRelatedEvent {
65
+ /** The type of the IFC relation. */
66
+ relType: IfcRelation;
67
+ /** The inverse attribute of the relation. */
68
+ invAttribute: InverseAttribute;
69
+ /** The IDs of the entities that are relating. */
70
+ relatingIDs: number[];
71
+ /** The IDs of the entities that are being related. */
72
+ relatedIDs: number[];
73
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./IfcJsonExporter";
2
+ export * from "./IfcIsolator";
2
3
  export * from "./IfcRelationsIndexer";
3
4
  export * from "./IfcPropertiesManager";
4
5
  export * from "./Utils";