@thatopen/components 1.5.0 → 2.0.0-alpha.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 (85) hide show
  1. package/dist/core/Clipper/index.d.ts +104 -0
  2. package/dist/core/Clipper/src/index.d.ts +1 -0
  3. package/dist/core/Clipper/src/simple-plane.d.ts +61 -0
  4. package/dist/core/Components/index.d.ts +52 -0
  5. package/dist/core/Cullers/index.d.ts +23 -0
  6. package/dist/core/Cullers/src/culler-renderer.d.ts +66 -0
  7. package/dist/core/Cullers/src/index.d.ts +3 -0
  8. package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +27 -0
  9. package/dist/core/Cullers/src/screen-culler-helper.d.ts +1 -0
  10. package/dist/core/Disposer/index.d.ts +43 -0
  11. package/dist/core/Grids/index.d.ts +13 -0
  12. package/dist/core/Grids/src/index.d.ts +1 -0
  13. package/dist/core/Grids/src/simple-grid.d.ts +48 -0
  14. package/dist/core/Materials/index.d.ts +61 -0
  15. package/dist/core/Raycasters/index.d.ts +13 -0
  16. package/dist/core/Raycasters/src/index.d.ts +2 -0
  17. package/dist/core/Raycasters/src/mouse.d.ts +26 -0
  18. package/dist/core/Raycasters/src/simple-raycaster.d.ts +36 -0
  19. package/dist/core/Types/index.d.ts +1 -0
  20. package/dist/core/Types/src/base-camera.d.ts +11 -0
  21. package/dist/core/Types/src/base-renderer.d.ts +40 -0
  22. package/dist/core/Types/src/base-scene.d.ts +13 -0
  23. package/dist/core/Types/src/base-world-item.d.ts +17 -0
  24. package/dist/core/Types/src/base.d.ts +19 -0
  25. package/dist/core/Types/src/component.d.ts +18 -0
  26. package/dist/core/Types/src/event.d.ts +34 -0
  27. package/dist/core/Types/src/index.d.ts +9 -0
  28. package/dist/core/Types/src/interfaces.d.ts +134 -0
  29. package/dist/core/Types/src/world.d.ts +12 -0
  30. package/dist/core/Worlds/index.d.ts +17 -0
  31. package/dist/core/Worlds/src/index.d.ts +4 -0
  32. package/dist/core/Worlds/src/simple-camera.d.ts +46 -0
  33. package/dist/core/Worlds/src/simple-renderer.d.ts +32 -0
  34. package/dist/core/Worlds/src/simple-scene.d.ts +30 -0
  35. package/dist/core/Worlds/src/simple-world.d.ts +26 -0
  36. package/dist/core/index.d.ts +9 -0
  37. package/dist/fragments/FragmentBoundingBox/index.d.ts +36 -0
  38. package/dist/fragments/FragmentClassifier/index.d.ts +30 -0
  39. package/dist/fragments/FragmentExploder/index.d.ts +15 -0
  40. package/dist/fragments/FragmentIfcLoader/index.d.ts +33 -0
  41. package/dist/fragments/FragmentIfcLoader/src/civil-reader.d.ts +15 -0
  42. package/dist/fragments/FragmentIfcLoader/src/ifc-fragment-settings.d.ts +27 -0
  43. package/dist/fragments/FragmentIfcLoader/src/ifc-metadata-reader.d.ts +4 -0
  44. package/dist/fragments/FragmentIfcLoader/src/index.d.ts +3 -0
  45. package/dist/fragments/FragmentIfcLoader/src/spatial-structure.d.ts +8 -0
  46. package/dist/fragments/FragmentIfcLoader/src/transform-helper.d.ts +5 -0
  47. package/dist/fragments/FragmentIfcLoader/src/units.d.ts +10 -0
  48. package/dist/fragments/FragmentIfcStreamer/index.d.ts +1 -0
  49. package/dist/fragments/FragmentIfcStreamer/src/base-types.d.ts +15 -0
  50. package/dist/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.d.ts +41 -0
  51. package/dist/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.d.ts +27 -0
  52. package/dist/fragments/FragmentIfcStreamer/src/index.d.ts +4 -0
  53. package/dist/fragments/FragmentIfcStreamer/src/streaming-settings.d.ts +10 -0
  54. package/dist/fragments/FragmentManager/index.d.ts +44 -0
  55. package/dist/fragments/index.d.ts +5 -0
  56. package/dist/ifc/IfcJsonExporter/index.d.ts +16 -0
  57. package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +1 -0
  58. package/dist/ifc/IfcPropertiesFinder/index.d.ts +37 -0
  59. package/dist/ifc/IfcPropertiesFinder/src/types.d.ts +23 -0
  60. package/dist/ifc/IfcPropertiesIndexer/index.d.ts +31 -0
  61. package/dist/ifc/IfcPropertiesManager/index.d.ts +73 -0
  62. package/dist/ifc/Utils/ifc-categories.d.ts +7 -0
  63. package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
  64. package/dist/ifc/Utils/ifc-elements-map.d.ts +3 -0
  65. package/dist/ifc/Utils/index.d.ts +4 -0
  66. package/dist/ifc/Utils/properties-utils.d.ts +25 -0
  67. package/dist/ifc/index.d.ts +5 -0
  68. package/dist/index.cjs +88 -0
  69. package/dist/index.d.ts +4 -0
  70. package/dist/index.mjs +9024 -0
  71. package/dist/namespace.d.ts +1744 -0
  72. package/dist/navigation/OrthoPerspectiveCamera/index.d.ts +49 -0
  73. package/dist/navigation/OrthoPerspectiveCamera/src/first-person-mode.d.ts +16 -0
  74. package/dist/navigation/OrthoPerspectiveCamera/src/index.d.ts +5 -0
  75. package/dist/navigation/OrthoPerspectiveCamera/src/orbit-mode.d.ts +16 -0
  76. package/dist/navigation/OrthoPerspectiveCamera/src/plan-mode.d.ts +20 -0
  77. package/dist/navigation/OrthoPerspectiveCamera/src/projections.d.ts +37 -0
  78. package/dist/navigation/OrthoPerspectiveCamera/src/types.d.ts +27 -0
  79. package/dist/navigation/index.d.ts +1 -0
  80. package/dist/utils/bbox.d.ts +7 -0
  81. package/dist/utils/geometry.d.ts +1 -0
  82. package/dist/utils/index.d.ts +4 -0
  83. package/dist/utils/materials.d.ts +4 -0
  84. package/dist/utils/uuid.d.ts +6 -0
  85. package/package.json +10 -5
@@ -0,0 +1,49 @@
1
+ import * as THREE from "three";
2
+ import { Components } from "../../core/Components";
3
+ import { SimpleCamera } from "../../core";
4
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
5
+ export * from "./src";
6
+ /**
7
+ * A flexible camera that uses
8
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
9
+ * easily control the camera in 2D and 3D. It supports multiple navigation
10
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
11
+ */
12
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
13
+ /**
14
+ * The current {@link NavigationMode}.
15
+ */
16
+ mode: NavigationMode;
17
+ readonly core: ProjectionManager;
18
+ readonly threeOrtho: THREE.OrthographicCamera;
19
+ protected readonly _userInputButtons: any;
20
+ protected readonly _frustumSize = 50;
21
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
22
+ constructor(components: Components);
23
+ /** {@link Disposable.dispose} */
24
+ dispose(): void;
25
+ /**
26
+ * Sets a new {@link NavigationMode} and disables the previous one.
27
+ *
28
+ * @param mode - The {@link NavigationMode} to set.
29
+ */
30
+ set(mode: NavModeID): void;
31
+ /**
32
+ * Make the camera view fit all the specified meshes.
33
+ *
34
+ * @param meshes the meshes to fit. If it is not defined, it will
35
+ * evaluate {@link Components.meshes}.
36
+ * @param offset the distance to the fit object
37
+ */
38
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
39
+ /**
40
+ * Allows or prevents all user input.
41
+ *
42
+ * @param active - whether to enable or disable user inputs.
43
+ */
44
+ setUserInput(active: boolean): void;
45
+ private disableUserInput;
46
+ private enableUserInput;
47
+ private newOrthoCamera;
48
+ private setOrthoCameraAspect;
49
+ }
@@ -0,0 +1,16 @@
1
+ import { NavigationMode } from "./types";
2
+ /**
3
+ * A {@link NavigationMode} that allows first person navigation,
4
+ * simulating FPS video games.
5
+ */
6
+ export declare class FirstPersonMode implements NavigationMode {
7
+ private camera;
8
+ /** {@link NavigationMode.enabled} */
9
+ enabled: boolean;
10
+ /** {@link NavigationMode.id} */
11
+ readonly id = "FirstPerson";
12
+ constructor(camera: any);
13
+ /** {@link NavigationMode.set} */
14
+ set(active: boolean): void;
15
+ private setupFirstPersonCamera;
16
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./first-person-mode";
2
+ export * from "./orbit-mode";
3
+ export * from "./plan-mode";
4
+ export * from "./projections";
5
+ export * from "./types";
@@ -0,0 +1,16 @@
1
+ import { NavigationMode } from "./types";
2
+ /**
3
+ * A {@link NavigationMode} that allows 3D navigation and panning
4
+ * like in many 3D and CAD softwares.
5
+ */
6
+ export declare class OrbitMode implements NavigationMode {
7
+ camera: any;
8
+ /** {@link NavigationMode.enabled} */
9
+ enabled: boolean;
10
+ /** {@link NavigationMode.id} */
11
+ readonly id = "Orbit";
12
+ constructor(camera: any);
13
+ /** {@link NavigationMode.set} */
14
+ set(active: boolean): void;
15
+ private activateOrbitControls;
16
+ }
@@ -0,0 +1,20 @@
1
+ import { NavigationMode } from "./types";
2
+ /**
3
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
4
+ * like many BIM tools.
5
+ */
6
+ export declare class PlanMode implements NavigationMode {
7
+ private camera;
8
+ /** {@link NavigationMode.enabled} */
9
+ enabled: boolean;
10
+ /** {@link NavigationMode.id} */
11
+ readonly id = "Plan";
12
+ private mouseAction1?;
13
+ private mouseAction2?;
14
+ private mouseInitialized;
15
+ private readonly defaultAzimuthSpeed;
16
+ private readonly defaultPolarSpeed;
17
+ constructor(camera: any);
18
+ /** {@link NavigationMode.set} */
19
+ set(active: boolean): void;
20
+ }
@@ -0,0 +1,37 @@
1
+ import * as THREE from "three";
2
+ import { CameraProjection } from "./types";
3
+ import { Event } from "../../../core";
4
+ import { OrthoPerspectiveCamera } from "../index";
5
+ /**
6
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
7
+ */
8
+ export declare class ProjectionManager {
9
+ /**
10
+ * Event that fires when the {@link CameraProjection} changes.
11
+ */
12
+ readonly onProjectionChanged: Event<THREE.Camera>;
13
+ projection: CameraProjection;
14
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
15
+ private _component;
16
+ private _previousDistance;
17
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
18
+ matchOrthoDistanceEnabled: boolean;
19
+ constructor(camera: OrthoPerspectiveCamera);
20
+ /**
21
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
22
+ *
23
+ * @param projection - the new projection to set. If it is the current projection,
24
+ * it will have no effect.
25
+ */
26
+ set(projection: CameraProjection): Promise<void>;
27
+ /**
28
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
29
+ * and vice versa.
30
+ */
31
+ toggle(): Promise<void>;
32
+ private setOrthoCamera;
33
+ private getDims;
34
+ private setupOrthoCamera;
35
+ private getDistance;
36
+ private setPerspectiveCamera;
37
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The projection system of the camera.
3
+ */
4
+ export type CameraProjection = "Perspective" | "Orthographic";
5
+ /**
6
+ * The extensible list of supported navigation modes.
7
+ */
8
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
9
+ /**
10
+ * An object that determines the behavior of the camera controls
11
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
12
+ */
13
+ export interface NavigationMode {
14
+ /** The unique ID of this navigation mode. */
15
+ id: NavModeID;
16
+ /**
17
+ * Enable or disable this navigation mode.
18
+ * When a new navigation mode is enabled, the previous navigation mode
19
+ * must be disabled.
20
+ *
21
+ * @param active - whether to enable or disable this mode.
22
+ * @param options - any additional data required to enable or disable it.
23
+ * */
24
+ set: (active: boolean, options?: any) => void;
25
+ /** Whether this navigation mode is active or not. */
26
+ enabled: boolean;
27
+ }
@@ -0,0 +1 @@
1
+ export * from "./OrthoPerspectiveCamera";
@@ -0,0 +1,7 @@
1
+ import * as THREE from "three";
2
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
3
+ center: THREE.Vector3;
4
+ halfSizes: THREE.Vector3;
5
+ rotation: THREE.Matrix3;
6
+ transformation: THREE.Matrix4;
7
+ };
@@ -0,0 +1 @@
1
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
@@ -0,0 +1,4 @@
1
+ export * from "./bbox";
2
+ export * from "./geometry";
3
+ export * from "./materials";
4
+ export * from "./uuid";
@@ -0,0 +1,4 @@
1
+ import * as THREE from "three";
2
+ export declare class MaterialsUtils {
3
+ static isTransparent(material: THREE.Material): boolean;
4
+ }
@@ -0,0 +1,6 @@
1
+ export declare class UUID {
2
+ private static _pattern;
3
+ private static _lut;
4
+ static create(): string;
5
+ static validate(uuid: string): void;
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@thatopen/components",
3
3
  "description": "Collection of core functionalities to author BIM apps.",
4
- "version": "1.5.0",
4
+ "version": "2.0.0-alpha.1",
5
5
  "author": "That Open Company",
6
6
  "contributors": [
7
7
  "Antonio Gonzalez Viegas (https://github.com/agviegas)",
@@ -14,7 +14,8 @@
14
14
  "url": "https://github.com/ThatOpen/engine_components/issues"
15
15
  },
16
16
  "type": "module",
17
- "main": "dist/index.js",
17
+ "main": "dist/index.cjs",
18
+ "module": "dist/index.mjs",
18
19
  "types": "dist/index.d.ts",
19
20
  "files": [
20
21
  "dist"
@@ -28,8 +29,12 @@
28
29
  "dev": "vite --host",
29
30
  "test": "jest",
30
31
  "build": "tsc --p ./tsconfig-build.json && vite build",
31
- "publish-repo": "cd dist && npm publish",
32
- "publish-alpha": "cd dist && npm publish --tag alpha"
32
+ "prepublishOnly": "yarn build",
33
+ "publish-repo": "npm publish",
34
+ "publish-alpha": "npm publish --tag alpha"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
33
38
  },
34
39
  "devDependencies": {
35
40
  "@types/jest": "27.0.0",
@@ -64,4 +69,4 @@
64
69
  "three": "^0.160.1",
65
70
  "web-ifc": "0.0.53"
66
71
  }
67
- }
72
+ }