diff --git a/packages/components-front/src/core/Renderers/Simplerenderer/index.js b/packages/components-front/src/core/Renderers/Simplerenderer/index.js new file mode 100644 index 000000000..49fce0c6e --- /dev/null +++ b/packages/components-front/src/core/Renderers/Simplerenderer/index.js @@ -0,0 +1,214 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SimpleRenderer = void 0; +var THREE = require("three"); +var CSS2DRenderer_js_1 = require("three/examples/jsm/renderers/CSS2DRenderer.js"); +var base_types_1 = require("../../base-types"); +/** + * A basic renderer capable of rendering 3D and 2D objects + * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D) and + * [CSS2DObjects](https://threejs.org/docs/#examples/en/renderers/CSS2DRenderer) + * respectively). + */ +var SimpleRenderer = /** @class */ (function (_super) { + __extends(SimpleRenderer, _super); + function SimpleRenderer(components, container, parameters) { + var _this = _super.call(this, components) || this; + /** {@link Component.enabled} */ + _this.enabled = true; + /** {@link Disposable.onDisposed} */ + _this.onDisposed = new base_types_1.Event(); + /** {@link Updateable.onBeforeUpdate} */ + _this.onBeforeUpdate = new base_types_1.Event(); + /** {@link Updateable.onAfterUpdate} */ + _this.onAfterUpdate = new base_types_1.Event(); + _this._renderer2D = new CSS2DRenderer_js_1.CSS2DRenderer(); + /** {@link Resizeable.resize}. */ + _this.resize = function (size) { + _this.updateContainer(); + if (!_this.container) { + return; + } + var width = size ? size.x : _this.container.clientWidth; + var height = size ? size.y : _this.container.clientHeight; + _this._renderer.setSize(width, height); + _this._renderer2D.setSize(width, height); + _this.onResize.trigger(size); + }; + _this.resizeEvent = function () { + _this.resize(); + }; + _this.onContextLost = function (event) { + event.preventDefault(); + _this.components.enabled = false; + }; + _this.onContextBack = function () { + _this._renderer.setRenderTarget(null); + _this._renderer.dispose(); + _this._renderer = new THREE.WebGLRenderer(__assign({ canvas: _this._canvas, antialias: true, alpha: true }, _this._parameters)); + _this.components.enabled = true; + }; + _this.container = container || null; + _this._parameters = parameters; + _this._renderer = new THREE.WebGLRenderer(__assign({ antialias: true, alpha: true }, parameters)); + _this._renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); + _this.setupRenderers(); + _this.setupEvents(true); + _this.resize(); + _this._canvas = _this._renderer.domElement; + var context = _this._renderer.getContext(); + var canvas = context.canvas; + canvas.addEventListener("webglcontextlost", _this.onContextLost, false); + canvas.addEventListener("webglcontextrestored", _this.onContextBack, false); + return _this; + } + /** {@link Component.get} */ + SimpleRenderer.prototype.get = function () { + return this._renderer; + }; + /** {@link Updateable.update} */ + SimpleRenderer.prototype.update = function () { + return __awaiter(this, void 0, void 0, function () { + var scene, camera; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.enabled) + return [2 /*return*/]; + return [4 /*yield*/, this.onBeforeUpdate.trigger(this)]; + case 1: + _a.sent(); + scene = this.overrideScene || this.components.scene.get(); + camera = this.overrideCamera || this.components.camera.get(); + if (!scene || !camera) + return [2 /*return*/]; + this._renderer.render(scene, camera); + this._renderer2D.render(scene, camera); + return [4 /*yield*/, this.onAfterUpdate.trigger(this)]; + case 2: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + /** {@link Disposable.dispose} */ + SimpleRenderer.prototype.dispose = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.enabled = false; + this.setupEvents(false); + this._renderer.domElement.remove(); + this._renderer.dispose(); + this._renderer2D.domElement.remove(); + this.onResize.reset(); + this.onAfterUpdate.reset(); + this.onBeforeUpdate.reset(); + return [4 /*yield*/, this.onDisposed.trigger()]; + case 1: + _a.sent(); + this.onDisposed.reset(); + return [2 /*return*/]; + } + }); + }); + }; + /** {@link Resizeable.getSize}. */ + SimpleRenderer.prototype.getSize = function () { + return new THREE.Vector2(this._renderer.domElement.clientWidth, this._renderer.domElement.clientHeight); + }; + SimpleRenderer.prototype.setupEvents = function (active) { + if (active) { + window.addEventListener("resize", this.resizeEvent); + } + else { + window.removeEventListener("resize", this.resizeEvent); + } + }; + SimpleRenderer.prototype.setupRenderers = function () { + this._renderer.localClippingEnabled = true; + this._renderer2D.domElement.style.position = "absolute"; + this._renderer2D.domElement.style.top = "0px"; + this._renderer2D.domElement.style.pointerEvents = "none"; + if (this.container) { + this.container.appendChild(this._renderer.domElement); + this.container.appendChild(this._renderer2D.domElement); + } + this.updateContainer(); + }; + SimpleRenderer.prototype.updateContainer = function () { + if (!this.container) { + var parent_1 = this._renderer.domElement.parentElement; + if (parent_1) { + this.container = parent_1; + parent_1.appendChild(this._renderer2D.domElement); + } + } + }; + return SimpleRenderer; +}(base_types_1.BaseRenderer)); +exports.SimpleRenderer = SimpleRenderer; diff --git a/packages/components/src/core/SimpleRenderer/index.ts b/packages/components-front/src/core/Renderers/Simplerenderer/index.ts similarity index 100% rename from packages/components/src/core/SimpleRenderer/index.ts rename to packages/components-front/src/core/Renderers/Simplerenderer/index.ts diff --git a/packages/components-front/src/index.js b/packages/components-front/src/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/packages/components/package.json b/packages/components/package.json index 8a8a73d50..2813d6abd 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -33,11 +33,8 @@ "prepublishOnly": "yarn build" }, "devDependencies": { - "@types/earcut": "^2.1.1", "@types/jest": "27.0.0", "@types/node": "20.11.30", - "@types/node-fetch": "^2.6.4", - "@types/stats": "0.16.30", "@types/three": "0.160.0", "@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/parser": "7.2.0", @@ -50,9 +47,7 @@ "eslint-plugin-prettier": "5.1.3", "glob": "latest", "jest": "^27.0.4", - "node-fetch": "^3.3.2", "prettier": "3.2.5", - "tailwindcss": "^3.3.5", "three": "^0.160.1", "ts-jest": "^27.0.3", "ts-node": "^10.0.0", @@ -60,18 +55,9 @@ "web-ifc": "0.0.53" }, "dependencies": { - "@popperjs/core": "2.11.8", "camera-controls": "2.7.3", - "dexie": "^3.2.3", - "dxf-writer": "^1.18.4", - "earcut": "^2.2.4", - "n8ao": "1.5.1", - "openbim-clay": "0.0.5", - "postprocessing": "6.34.2", - "stats.js": "^0.17.0", "three-mesh-bvh": "0.7.0", - "top-tool-package-reader": "0.0.3", - "unzipit": "^1.4.3" + "top-tool-package-reader": "0.0.3" }, "peerDependencies": { "bim-fragment": "1.5.0", diff --git a/packages/components/src/base-types/component.ts b/packages/components/src/base-types/component.ts deleted file mode 100644 index 66981a644..000000000 --- a/packages/components/src/base-types/component.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - Disposable, - Hideable, - Resizeable, - Updateable, - UI, - Configurable, -} from "./base-types"; -import { Components } from "../core"; - -/** - * Components are the building blocks of this library. Everything is a - * component: tools, scenes, objects, cameras, etc. - * All components must inherit from this class. The `Type` parameter defines - * the type of the core of this component. For instance, a component containing a - */ -export abstract class Component { - /** - * Whether this component is active or not. The behaviour can vary depending - * on the type of component. E.g. a disabled dimension tool will stop creating - * dimensions, while a disabled camera will stop moving. A disabled component - * will not be updated automatically each frame. - */ - abstract enabled: boolean; - - /** - * The core of the component. For instance, if it's a camera component, it - * could be a [THREE.Camera](https://threejs.org/docs/#api/en/cameras/Camera). - */ - abstract get(...args: any): Type; - - constructor(public components: Components) {} - - /** Whether is component is {@link Disposable}. */ - isDisposeable = (): this is Disposable => { - return "dispose" in this; - }; - - /** Whether is component is {@link Resizeable}. */ - isResizeable = (): this is Resizeable => { - return "resize" in this && "getSize" in this; - }; - - /** Whether is component is {@link Updateable}. */ - isUpdateable = (): this is Updateable => { - return ( - "onAfterUpdate" in this && "onBeforeUpdate" in this && "update" in this - ); - }; - - /** Whether is component is {@link Hideable}. */ - isHideable = (): this is Hideable => { - return "visible" in this; - }; - - /** Whether is component is {@link Configurable}. */ - isConfigurable = (): this is Configurable => { - return "setup" in this && "config" in this && "onSetup" in this; - }; - - /** Whether is component implements any kind of {@link UI}. */ - hasUI = (): this is UI => { - return "uiElement" in this; - }; -} diff --git a/packages/components/src/fragments/FragmentIfcStreamer/index.ts b/packages/components/src/core/Cameras/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/index.ts rename to packages/components/src/core/Cameras/index.ts diff --git a/packages/components/src/core/Cameras/src/index.ts b/packages/components/src/core/Cameras/src/index.ts new file mode 100644 index 000000000..b8e40cd48 --- /dev/null +++ b/packages/components/src/core/Cameras/src/index.ts @@ -0,0 +1 @@ +export * from "./simple-camera"; diff --git a/packages/components/src/core/Cameras/src/simple-camera.ts b/packages/components/src/core/Cameras/src/simple-camera.ts new file mode 100644 index 000000000..e02c0669a --- /dev/null +++ b/packages/components/src/core/Cameras/src/simple-camera.ts @@ -0,0 +1,156 @@ +import * as THREE from "three"; +import CameraControls from "camera-controls"; +import { + Component, + Disposable, + Updateable, + Event, + BaseCamera, +} from "../../Types"; +import { Components } from "../../Components"; + +/** + * A basic camera that uses + * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to + * easily control the camera in 2D and 3D. Check out it's API to find out + * what features it offers. + */ +export class SimpleCamera extends BaseCamera implements Updateable, Disposable { + /** {@link Updateable.onBeforeUpdate} */ + readonly onBeforeUpdate = new Event(); + + /** {@link Updateable.onAfterUpdate} */ + readonly onAfterUpdate = new Event(); + + readonly onAspectUpdated = new Event(); + + /** {@link Disposable.onDisposed} */ + readonly onDisposed = new Event(); + + readonly three: THREE.PerspectiveCamera; + + private _controls?: CameraControls; + + /** + * The object that controls the camera. An instance of + * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls). + * Transforming the camera directly will have no effect: you need to use this + * object to move, rotate, look at objects, etc. + */ + get controls() { + if (!this._controls) { + throw new Error("Camera not initialized!"); + } + return this._controls; + } + + /** {@link Component.enabled} */ + get enabled() { + return this.controls.enabled; + } + + /** {@link Component.enabled} */ + set enabled(enabled: boolean) { + this.controls.enabled = enabled; + } + + constructor(components: Components) { + super(components); + this.three = this.setupCamera(); + + this.setupEvents(true); + + this.onWorldChanged.add(() => { + // This makes sure the DOM element of the camera + // controls matches the one of the renderer + if (this._controls) { + this._controls.dispose(); + } + this._controls = this.newCameraControls(); + }); + } + + /** {@link Disposable.dispose} */ + dispose() { + this.setupEvents(false); + this.enabled = false; + this.onAspectUpdated.reset(); + this.onBeforeUpdate.reset(); + this.onAfterUpdate.reset(); + this.three.removeFromParent(); + this.controls.dispose(); + this.onDisposed.trigger(); + this.onDisposed.reset(); + } + + /** {@link Updateable.update} */ + async update(_delta: number) { + if (this.enabled) { + await this.onBeforeUpdate.trigger(this); + this.controls.update(_delta); + await this.onAfterUpdate.trigger(this); + } + } + + /** + * Updates the aspect of the camera to match the size of the + * {@link Components.renderer}. + */ + updateAspect = () => { + if (!this.world || !this.world.renderer) return; + if (this.world.renderer?.isResizeable()) { + const size = this.world.renderer.getSize(); + this.three.aspect = size.width / size.height; + this.three.updateProjectionMatrix(); + this.onAspectUpdated.trigger(); + } + }; + + private setupCamera() { + const aspect = window.innerWidth / window.innerHeight; + const camera = new THREE.PerspectiveCamera(60, aspect, 1, 1000); + camera.position.set(50, 50, 50); + camera.lookAt(new THREE.Vector3(0, 0, 0)); + return camera; + } + + private newCameraControls() { + if (!this.world) { + throw new Error("This camera needs a world to work!"); + } + if (!this.world.renderer) { + throw new Error("This camera needs a renderer to work!"); + } + CameraControls.install({ THREE: SimpleCamera.getSubsetOfThree() }); + const { domElement } = this.world.renderer.three; + const controls = new CameraControls(this.three, domElement); + controls.smoothTime = 0.2; + controls.dollyToCursor = true; + controls.infinityDolly = true; + return controls; + } + + private setupEvents(active: boolean) { + if (active) { + window.addEventListener("resize", this.updateAspect); + } else { + window.removeEventListener("resize", this.updateAspect); + } + } + + private static getSubsetOfThree() { + return { + MOUSE: THREE.MOUSE, + Vector2: THREE.Vector2, + Vector3: THREE.Vector3, + Vector4: THREE.Vector4, + Quaternion: THREE.Quaternion, + Matrix4: THREE.Matrix4, + Spherical: THREE.Spherical, + Box3: THREE.Box3, + Sphere: THREE.Sphere, + Raycaster: THREE.Raycaster, + MathUtils: THREE.MathUtils, + }; + } +} diff --git a/packages/components/src/core/Components/index.ts b/packages/components/src/core/Components/index.ts index 5b57514cd..0f4a2fa5b 100644 --- a/packages/components/src/core/Components/index.ts +++ b/packages/components/src/core/Components/index.ts @@ -1,141 +1,69 @@ import * as THREE from "three"; - import { acceleratedRaycast, computeBoundsTree, disposeBoundsTree, } from "three-mesh-bvh"; -import { UIManager } from "../../ui"; -import { BaseRenderer, Component, Disposable, Event } from "../../base-types"; -import { ToolComponent } from "../ToolsComponent"; -import { BaseRaycaster } from "../../base-types/base-raycaster"; +import { Component, Disposable, Event } from "../Types"; import { Disposer } from "../Disposer"; +import { UUID } from "../UUID"; /** - * The entry point of Open BIM Components. - * It contains the basic items to create a BIM 3D scene based on Three.js, as - * well as all the tools provided by this library. It also manages the update - * loop of everything. Each instance has to be initialized with {@link init}. - * + * The entry point of the Components library. + * It can: + * - Create and access all the components of the library. + * - Update all the updatable components automatically. + * - Dispose all the components, preventing memory leaks. */ export class Components implements Disposable { - /** {@link ToolComponent} */ - readonly tools: ToolComponent; + static readonly release = "1.4.21"; /** * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). - * This includes fragments, 3D scans, etc. */ readonly meshes = new Set(); - /** - * Event that fires when this instance has been fully initialized and is - * ready to work (scene, camera and renderer are ready). - */ - readonly onInitialized = new Event(); - /** {@link Disposable.onDisposed} */ - readonly onDisposed = new Event(); - - enabled = false; + readonly onDisposed = new Event(); - static readonly release = "1.4.21"; + /** The list of components created in this app. */ + readonly list: Record = {}; - /** Whether UI components should be created. */ - uiEnabled = true; + /** If disabled, the animation loop will be stopped. */ + enabled = false; - private _ui?: UIManager; - private _renderer?: BaseRenderer; - private _scene?: Component; - private _camera?: Component; - private _raycaster?: BaseRaycaster; private _clock: THREE.Clock; - /** {@link UIManager} */ - get ui(): UIManager { - if (!this._ui) { - throw new Error("UIManager hasn't been initialised."); - } - return this._ui; - } - - /** - * The [Three.js renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) - * used to render the scene. This library provides multiple renderer - * components with pre-made functionality (e.g. rendering of 2D CSS elements. - */ - get renderer() { - if (!this._renderer) { - throw new Error("Renderer hasn't been initialised."); - } - return this._renderer; - } - - /** - * This needs to be initialized before calling init(). - */ - set renderer(renderer: BaseRenderer) { - this._renderer = renderer; - } - - /** - * The [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene) - * where all the rendered items are placed. - */ - get scene() { - if (!this._scene) { - throw new Error("Scene hasn't been initialised."); - } - return this._scene; - } - - /** - * This needs to be initialized before calling init(). - */ - set scene(scene: Component) { - this._scene = scene; + add(uuid: string, instance: Component) { + if (uuid in this.list) + throw new Error( + `You're trying to add a component that already exists in the components intance. Use Components.get() instead.`, + ); + UUID.validate(uuid); + this.list[uuid] = instance; } /** - * The [Three.js camera](https://threejs.org/docs/#api/en/cameras/Camera) - * that determines the point of view of the renderer. - */ - get camera() { - if (!this._camera) { - throw new Error("Camera hasn't been initialised."); - } - return this._camera; - } - - /** - * This needs to be initialized before calling init(). - */ - set camera(camera: Component) { - this._camera = camera; - } - - /** - * A component using the [Three.js raycaster](https://threejs.org/docs/#api/en/core/Raycaster) - * used primarily to pick 3D items with the mouse or a touch screen. + * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it + * doesn't exist, it will instance it automatically. + * + * @param Component - The component to get or create. */ - get raycaster() { - if (!this._raycaster) { - throw new Error("Raycaster hasn't been initialised."); + get(Component: new (components: Components) => U): U { + const uuid = (Component as any).uuid; + if (!(uuid in this.list)) { + const toolInstance = new Component(this); + if (!(uuid in this.list)) { + // In case the component is not auto-registered. + this.add(uuid, toolInstance); + } + return toolInstance; } - return this._raycaster; - } - - /** - * Although this is not necessary to make the library work, it's necessary - * to initialize this if any component that needs a raycaster is used. - */ - set raycaster(raycaster: BaseRaycaster) { - this._raycaster = raycaster; + return this.list[uuid] as U; } constructor() { this._clock = new THREE.Clock(); - this.tools = new ToolComponent(this); Components.setupBVH(); } @@ -148,12 +76,7 @@ export class Components implements Disposable { async init() { this.enabled = true; this._clock.start(); - if (this.uiEnabled) { - this._ui = new UIManager(this); - await this.ui.init(); - } await this.update(); - await this.onInitialized.trigger(this); } /** @@ -172,52 +95,44 @@ export class Components implements Disposable { * */ async dispose() { - const disposer = this.tools.get(Disposer); + const disposer = this.get(Disposer); this.enabled = false; - await this.tools.dispose(); - await this._ui?.dispose(); - this.onInitialized.reset(); + + for (const uuid in this.list) { + const tool = this.list[uuid]; + tool.enabled = false; + if (tool.isDisposeable()) { + await tool.dispose(); + } + } + this._clock.stop(); for (const mesh of this.meshes) { disposer.destroy(mesh); } + this.meshes.clear(); - if (this._renderer?.isDisposeable()) { - await this._renderer.dispose(); - } - if (this._scene?.isDisposeable()) { - await this._scene.dispose(); - } - if (this._camera?.isDisposeable()) { - await this._camera.dispose(); - } - if (this._raycaster?.isDisposeable()) { - await this._raycaster.dispose(); - } await this.onDisposed.trigger(); this.onDisposed.reset(); } private update = async () => { if (!this.enabled) return; + const delta = this._clock.getDelta(); - await Components.update(this.scene, delta); - await Components.update(this.renderer, delta); - await Components.update(this.camera, delta); - await this.tools.update(delta); - const renderer = this.renderer.get(); - // Works the same as requestAnimationFrame, but let us use WebXR. - renderer.setAnimationLoop(this.update); - }; - private static async update(component: Component, delta: number) { - if (component.isUpdateable() && component.enabled) { - await component.update(delta); + for (const uuid in this.list) { + const component = this.list[uuid]; + if (component.enabled && component.isUpdateable()) { + await component.update(delta); + } } - } + }; private static setupBVH() { + // @ts-ignore THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree; + // @ts-ignore THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree; THREE.Mesh.prototype.raycast = acceleratedRaycast; } diff --git a/packages/components/src/core/Disposer/index.ts b/packages/components/src/core/Disposer/index.ts index bc081e80e..79921f77b 100644 --- a/packages/components/src/core/Disposer/index.ts +++ b/packages/components/src/core/Disposer/index.ts @@ -1,13 +1,12 @@ import * as THREE from "three"; -import { Component } from "../../base-types/component"; import { Components } from "../Components"; -import { ToolComponent } from "../ToolsComponent"; +import { BVHGeometry, Component } from "../Types"; /** * A tool to safely remove meshes and geometries from memory to * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). */ -export class Disposer extends Component> { +export class Disposer extends Component { private _disposedComponents = new Set(); /** {@link Component.enabled} */ @@ -17,7 +16,7 @@ export class Disposer extends Component> { constructor(components: Components) { super(components); - components.tools.add(Disposer.uuid, this); + components.add(Disposer.uuid, this); } /** @@ -62,15 +61,16 @@ export class Disposer extends Component> { * to remove. */ disposeGeometry(geometry: THREE.BufferGeometry) { - if (geometry.boundsTree) { - geometry.disposeBoundsTree(); + const bvhGeom = geometry as BVHGeometry; + if (bvhGeom.boundsTree) { + bvhGeom.disposeBoundsTree(); } geometry.dispose(); } private disposeGeometryAndMaterials( mesh: THREE.Object3D, - materials: boolean + materials: boolean, ) { const item = mesh as any; if (item.geometry) { @@ -101,5 +101,3 @@ export class Disposer extends Component> { } } } - -ToolComponent.libraryUUIDs.add(Disposer.uuid); diff --git a/packages/components/src/core/Renderers/index.ts b/packages/components/src/core/Renderers/index.ts new file mode 100644 index 000000000..3bd16e178 --- /dev/null +++ b/packages/components/src/core/Renderers/index.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/packages/components/src/core/Renderers/src/index.ts b/packages/components/src/core/Renderers/src/index.ts new file mode 100644 index 000000000..acc572db8 --- /dev/null +++ b/packages/components/src/core/Renderers/src/index.ts @@ -0,0 +1 @@ +export * from "./simple-renderer"; diff --git a/packages/components/src/core/Renderers/src/simple-renderer.ts b/packages/components/src/core/Renderers/src/simple-renderer.ts new file mode 100644 index 000000000..819f04c8a --- /dev/null +++ b/packages/components/src/core/Renderers/src/simple-renderer.ts @@ -0,0 +1,157 @@ +import * as THREE from "three"; +import { CSS2DRenderer } from "three/examples/jsm/renderers/CSS2DRenderer.js"; +import { Disposable, Updateable, Resizeable, BaseRenderer } from "../../Types"; +import { Components } from "../../Components"; + +/** + * A basic renderer capable of rendering 3D and 2D objects + * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D) and + * [CSS2DObjects](https://threejs.org/docs/#examples/en/renderers/CSS2DRenderer) + * respectively). + */ +export class SimpleRenderer extends BaseRenderer { + /** {@link Component.enabled} */ + enabled = true; + + /** The HTML container of the THREE.js canvas where the scene is rendered. */ + container: HTMLElement | null; + + three: THREE.WebGLRenderer; + + protected _renderer2D = new CSS2DRenderer(); + protected _canvas: HTMLCanvasElement; + protected _parameters?: Partial; + + constructor( + components: Components, + container?: HTMLElement, + parameters?: Partial, + ) { + super(components); + + this.container = container || null; + this._parameters = parameters; + + this.three = new THREE.WebGLRenderer({ + antialias: true, + alpha: true, + ...parameters, + }); + + this.three.setPixelRatio(Math.min(window.devicePixelRatio, 2)); + this.setupRenderers(); + this.setupEvents(true); + this.resize(); + + this._canvas = this.three.domElement; + + const context = this.three.getContext(); + const { canvas } = context; + canvas.addEventListener("webglcontextlost", this.onContextLost, false); + canvas.addEventListener("webglcontextrestored", this.onContextBack, false); + } + + /** {@link Component.get} */ + get() { + return this.three; + } + + /** {@link Updateable.update} */ + update() { + if (!this.enabled || !this.world) return; + this.onBeforeUpdate.trigger(this); + const scene = this.world.scene.three; + const camera = this.world.camera.three; + this.three.render(scene, camera); + if (scene instanceof THREE.Scene) { + this._renderer2D.render(scene, camera); + } + this.onAfterUpdate.trigger(this); + } + + /** {@link Disposable.dispose} */ + dispose() { + this.enabled = false; + this.setupEvents(false); + this.three.domElement.remove(); + this.three.dispose(); + this._renderer2D.domElement.remove(); + this.onResize.reset(); + this.onAfterUpdate.reset(); + this.onBeforeUpdate.reset(); + this.onDisposed.trigger(); + this.onDisposed.reset(); + } + + /** {@link Resizeable.getSize}. */ + getSize() { + return new THREE.Vector2( + this.three.domElement.clientWidth, + this.three.domElement.clientHeight, + ); + } + + /** {@link Resizeable.resize}. */ + resize = (size?: THREE.Vector2) => { + this.updateContainer(); + if (!this.container) { + return; + } + const width = size ? size.x : this.container.clientWidth; + const height = size ? size.y : this.container.clientHeight; + this.three.setSize(width, height); + this._renderer2D.setSize(width, height); + this.onResize.trigger(size); + }; + + private resizeEvent = () => { + this.resize(); + }; + + setupEvents(active: boolean) { + if (active) { + window.addEventListener("resize", this.resizeEvent); + } else { + window.removeEventListener("resize", this.resizeEvent); + } + } + + private setupRenderers() { + this.three.localClippingEnabled = true; + this._renderer2D.domElement.style.position = "absolute"; + this._renderer2D.domElement.style.top = "0px"; + this._renderer2D.domElement.style.pointerEvents = "none"; + if (this.container) { + this.container.appendChild(this.three.domElement); + this.container.appendChild(this._renderer2D.domElement); + } + this.updateContainer(); + } + + private onContextLost = (event: any) => { + event.preventDefault(); + this.components.enabled = false; + }; + + private onContextBack = () => { + this.three.setRenderTarget(null); + this.three.dispose(); + this.three = new THREE.WebGLRenderer({ + canvas: this._canvas, + antialias: true, + alpha: true, + ...this._parameters, + }); + this.components.enabled = true; + }; + + private updateContainer() { + if (!this.container) { + const parent = this.three.domElement.parentElement; + if (parent) { + this.container = parent; + parent.appendChild(this._renderer2D.domElement); + } + } + } +} diff --git a/packages/components/src/core/Scenes/index.ts b/packages/components/src/core/Scenes/index.ts new file mode 100644 index 000000000..3bd16e178 --- /dev/null +++ b/packages/components/src/core/Scenes/index.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/packages/components/src/core/Scenes/src/index.ts b/packages/components/src/core/Scenes/src/index.ts new file mode 100644 index 000000000..d4dfeb251 --- /dev/null +++ b/packages/components/src/core/Scenes/src/index.ts @@ -0,0 +1 @@ +export * from "./simple-scene"; diff --git a/packages/components/src/core/SimpleScene/index.ts b/packages/components/src/core/Scenes/src/simple-scene.ts similarity index 56% rename from packages/components/src/core/SimpleScene/index.ts rename to packages/components/src/core/Scenes/src/simple-scene.ts index 0b5efa0f0..b4acec3f0 100644 --- a/packages/components/src/core/SimpleScene/index.ts +++ b/packages/components/src/core/Scenes/src/simple-scene.ts @@ -1,7 +1,6 @@ import * as THREE from "three"; -import { Component, Configurable, Disposable, Event } from "../../base-types"; -import { Disposer } from "../Disposer"; -import { Components } from "../Components"; +import { BaseScene, Configurable, Event } from "../../Types"; +import { Components } from "../../Components"; export interface SimpleSceneConfig { directionalLight: { @@ -20,45 +19,14 @@ export interface SimpleSceneConfig { * objects hierarchically, and easily dispose them when you are finished with it. * @noInheritDoc */ -export class SimpleScene - extends Component - implements Disposable, Configurable<{}> -{ - /** {@link Component.enabled} */ - enabled = true; - +export class SimpleScene extends BaseScene implements Configurable<{}> { /** {@link Configurable.isSetup} */ isSetup = false; - /** {@link Disposable.onDisposed} */ - readonly onDisposed = new Event(); - - private readonly _scene: THREE.Scene; - - constructor(components: Components) { - super(components); - this._scene = new THREE.Scene(); - this._scene.background = new THREE.Color(0x202932); - } - - /** {@link Component.get} */ - get() { - return this._scene; - } + three: THREE.Scene; - /** {@link Disposable.dispose} */ - async dispose() { - const disposer = this.components.tools.get(Disposer); - for (const child of this._scene.children) { - const mesh = child as THREE.Mesh; - if (mesh.geometry) { - disposer.destroy(mesh); - } - } - this._scene.children = []; - await this.onDisposed.trigger(); - this.onDisposed.reset(); - } + /** {@link Configurable.onSetup} */ + readonly onSetup = new Event(); config: Required = { directionalLight: { @@ -71,10 +39,15 @@ export class SimpleScene intensity: 1, }, }; - readonly onSetup = new Event(); + + constructor(components: Components) { + super(components); + this.three = new THREE.Scene(); + this.three.background = new THREE.Color(0x202932); + } /** Creates a simple and nice default set up for the scene (e.g. lighting). */ - async setup(config?: Partial) { + setup(config?: Partial) { this.config = { ...this.config, ...config }; const directionalLight = new THREE.DirectionalLight( this.config.directionalLight.color, @@ -85,7 +58,7 @@ export class SimpleScene this.config.ambientLight.color, this.config.ambientLight.intensity, ); - this._scene.add(directionalLight, ambientLight); + this.three.add(directionalLight, ambientLight); this.isSetup = true; this.onSetup.trigger(this); } diff --git a/packages/components/src/core/SimpleScene/example.html b/packages/components/src/core/SimpleScene/example.html deleted file mode 100644 index 2c9f59db9..000000000 --- a/packages/components/src/core/SimpleScene/example.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - Simple Scene - - - - -
- - - - \ No newline at end of file diff --git a/packages/components/src/core/SimpleScene/example.ts b/packages/components/src/core/SimpleScene/example.ts deleted file mode 100644 index d883fc231..000000000 --- a/packages/components/src/core/SimpleScene/example.ts +++ /dev/null @@ -1,152 +0,0 @@ -/* MD - ### ๐ŸŒ Let's create a 3D world! - ___ - The `SimpleScene` component is the easiest way to create a 3D space to start working. - Let's start by importing Components and Three.js: - */ - -import * as THREE from "three"; -import * as OBC from "../.."; - -/* MD - Now, the first step is getting a container for our viewer. ๐Ÿ“ฆ - This is just a place where the 3D scene will be rendered. - In this example we have just added an HTML `div` element with - the ID `"container"`. - */ - -const container = document.getElementById("container")!; - -/* MD - Now, let's create an awesome 3D scene inside that HTML element! ๐Ÿ”ฅ - - :::info Are you using a library/framework like React, Angular or vue? - - Then probably you have other mechanisms for getting a reference to the - HTML div element. However you do it, as long as you get a reference - in your code, you are good to go! - - ::: - - ### ๐Ÿงฐ Setting up a components project - ___ - Next, we will instantiate the main object of the library: **[Components](../api/classes/components.Components)**. ๐Ÿค– - This object will keep track of all the components that you create, making them - easily accessible in all your application and making sure to update them - in each frame, so you don't have to worry about that. ๐Ÿ’ช - - :::danger The minimum components application - - Any components app needs 4 things to work: - - ๐ŸŒ A **[scene component](../api/classes/components.SimpleScene)** where our objects will live in 3D. - - โŒš A **[renderer component](../api/classes/components.SimpleRenderer)** that allows us to see things moving around. - - ๐ŸŽฅ A **[camera component](../api/classes/components.SimpleCamera)** that defines where we are and in that 3D world. - - โšก A **[raycaster component](../api/classes/components.SimpleRaycaster)** that makes it possible to interact with - that 3D scene with our mouse / touch. - - ::: - */ - -const components = new OBC.Components(); - -const sceneComponent = new OBC.SimpleScene(components); -components.scene = sceneComponent; - -const rendererComponent = new OBC.SimpleRenderer(components, container); -components.renderer = rendererComponent; - -const cameraComponent = new OBC.SimpleCamera(components); -components.camera = cameraComponent; - -components.raycaster = new OBC.SimpleRaycaster(components); - -/* MD - Now that everything is set up, let's start the app! You can do that with the `init` method. - It will start updating all the components at 60 fps, so that you don't have to worry about the - animation loop: ๐Ÿš—๐Ÿ’จ๐Ÿ’จ๐Ÿ’จ - */ - -components.init(); - -/* MD - And that's it! You already have set up 3D scene that can run on any device. Easy, right? ๐Ÿฅณ But right now or scene - is not very interesting, as it's only a infinite white void. Let's add some things to it! First, we need a reference - to the scene, which you can get with the `get()` method. This method is present in all the components and is used to - get the core of the component. We can do it like this: - */ - -const scene = components.scene.get(); - -/* MD - ### ๐ŸŽฅ Adjusting scene and camera - ___ - Great! Now we will locate the camera in a nice starting position. We can control the `SimpleCamera` component through its - `controls` attribute. This object is an instance of the [camera-controls](https://github.com/yomotsu/camera-controls) - library, which makes it super easy to control the camera in our 3D scene. We will set the position of the camera - to `[10, 10, 10]` and make it look at the origin (`[0, 0, 0]`). - */ - -cameraComponent.controls.setLookAt(10, 10, 10, 0, 0, 0); - -/* MD - ### ๐Ÿ€ Adding some 3D objects - ___ - Awesome! We are now ready to start adding some objects. First, we will add a - **[simple grid component](../api/classes/components.SimpleGrid)**. As the name implies, this component adds a simple - 2D grid to the scene that we can use as a reference. - - */ - -// @ts-ignore -const grid = new OBC.SimpleGrid(components); - -/* MD - - ๐Ÿš€ Also, let's add some real geometry to our small 3D app. All the components are built on top of - [Three.js](https://threejs.org/), which means that Three.js code will work natively with them. - This is great, because you can easily integrate components with any 3D app that you create. - - Let's try it by adding a simple cube: - */ - -const boxMaterial = new THREE.MeshStandardMaterial({ color: "#6528D7" }); -const boxGeometry = new THREE.BoxGeometry(3, 3, 3); -const cube = new THREE.Mesh(boxGeometry, boxMaterial); -cube.position.set(0, 1.5, 0); -scene.add(cube); - -/* MD - ### ๐Ÿ”ฆ Lighting things up - ___ - Of course, everything is black because we have no lights! Let's fix it by adding some basic illumination: - */ - -sceneComponent.setup(); - -/* MD - ### ๐Ÿงน Cleaning up - ___ - As you might now, JavaScript has an automatic garbage collector that gets rid of the variables that you are no longer - using. Unfortunately, that's not the case for - [Three.js](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). But don't worry: components - takes care of this for you. When you are finished working with a `Components` instance, simply call - `components.dispose()` and we will clean everything up for you! - - :::caution Watch your variables! - - When you dispose the memory, make sure that you don't have any object or array referencing anything inside the - `Components` instance or this won't work, because JavaScript will detect that you are still using it! - - ::: - - :::tip Using React, Angular, Vue...? - - This topic is especially relevant in Single Page Application technologies because they never reload the page (which - would release all the memory automatically). If you are using some of these, make sure that you set up the disposing - logic to fire when you re-render the component that has the 3D app. - - ::: - - And voilร ! You have made your first 3D application using components. Easy, right? Of course, this is still far from a - full-fledged BIM app, but don't worry! Keep following our tutorials and your app will go from zero to hero in no time! ๐Ÿš€ - */ diff --git a/packages/components/src/core/Types/index.ts b/packages/components/src/core/Types/index.ts new file mode 100644 index 000000000..3bd16e178 --- /dev/null +++ b/packages/components/src/core/Types/index.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/packages/components/src/core/Types/src/base-camera.ts b/packages/components/src/core/Types/src/base-camera.ts new file mode 100644 index 000000000..9983e7312 --- /dev/null +++ b/packages/components/src/core/Types/src/base-camera.ts @@ -0,0 +1,6 @@ +import * as THREE from "three"; +import { BaseWorldItem } from "./base-world-item"; + +export abstract class BaseCamera extends BaseWorldItem { + abstract three: THREE.Camera; +} diff --git a/packages/components/src/core/Types/src/base-renderer.ts b/packages/components/src/core/Types/src/base-renderer.ts new file mode 100644 index 000000000..25d7cada9 --- /dev/null +++ b/packages/components/src/core/Types/src/base-renderer.ts @@ -0,0 +1,31 @@ +import * as THREE from "three"; +import { Vector2 } from "three"; +import { Event } from "./event"; +import { BaseWorldItem } from "./base-world-item"; +import { Disposable, Resizeable, Updateable } from "./interfaces"; + +export abstract class BaseRenderer + extends BaseWorldItem + implements Updateable, Disposable, Resizeable +{ + abstract three: THREE.Renderer; + + /** {@link Updateable.onBeforeUpdate} */ + onAfterUpdate = new Event(); + + /** {@link Updateable.onAfterUpdate} */ + onBeforeUpdate = new Event(); + + /** {@link Disposable.onDisposed} */ + readonly onDisposed = new Event(); + + readonly onResize = new Event(); + + abstract update(delta?: number): void | Promise; + + abstract dispose(): void; + + abstract getSize(): Vector2; + + abstract resize(size: Vector2 | undefined): void; +} diff --git a/packages/components/src/core/Types/src/base-scene.ts b/packages/components/src/core/Types/src/base-scene.ts new file mode 100644 index 000000000..1fd0e753b --- /dev/null +++ b/packages/components/src/core/Types/src/base-scene.ts @@ -0,0 +1,31 @@ +import * as THREE from "three"; +import { Disposable } from "./interfaces"; +import { Event } from "./event"; +import { Components } from "../../Components"; +import { Disposer } from "../../Disposer"; +import { BaseWorldItem } from "./base-world-item"; + +export abstract class BaseScene extends BaseWorldItem implements Disposable { + /** {@link Disposable.onDisposed} */ + readonly onDisposed = new Event(); + + abstract three: THREE.Object3D; + + protected constructor(components: Components) { + super(components); + } + + /** {@link Disposable.dispose} */ + dispose() { + const disposer = this.components.get(Disposer); + for (const child of this.three.children) { + const mesh = child as THREE.Mesh; + if (mesh.geometry) { + disposer.destroy(mesh); + } + } + this.three.children = []; + this.onDisposed.trigger(); + this.onDisposed.reset(); + } +} diff --git a/packages/components/src/core/Types/src/base-world-item.ts b/packages/components/src/core/Types/src/base-world-item.ts new file mode 100644 index 000000000..037a878da --- /dev/null +++ b/packages/components/src/core/Types/src/base-world-item.ts @@ -0,0 +1,25 @@ +import { Base } from "./base"; +import { World } from "./world"; +import { Event } from "./event"; + +/** + * One of the elements that make a world. It can be either a scene, a camera + * or a renderer. + */ +export abstract class BaseWorldItem extends Base { + private _world: World | null = null; + + readonly onWorldChanged = new Event(); + + get world() { + if (!this._world) { + throw new Error("World not initialized!"); + } + return this._world; + } + + set world(world: World | null) { + this._world = world; + this.onWorldChanged.trigger(world); + } +} diff --git a/packages/components/src/core/Types/src/base.ts b/packages/components/src/core/Types/src/base.ts new file mode 100644 index 000000000..7be97d4f1 --- /dev/null +++ b/packages/components/src/core/Types/src/base.ts @@ -0,0 +1,42 @@ +import { + Disposable, + Hideable, + Resizeable, + Updateable, + Configurable, +} from "./interfaces"; +import { Components } from "../../Components"; + +/** + * Base class of the library. Useful for finding out the interfaces it implements. + */ +export abstract class Base { + constructor(public components: Components) {} + + /** Whether is component is {@link Disposable}. */ + isDisposeable = (): this is Disposable => { + return "dispose" in this && "onDisposed" in this; + }; + + /** Whether is component is {@link Resizeable}. */ + isResizeable = (): this is Resizeable => { + return "resize" in this && "getSize" in this; + }; + + /** Whether is component is {@link Updateable}. */ + isUpdateable = (): this is Updateable => { + return ( + "onAfterUpdate" in this && "onBeforeUpdate" in this && "update" in this + ); + }; + + /** Whether is component is {@link Hideable}. */ + isHideable = (): this is Hideable => { + return "visible" in this; + }; + + /** Whether is component is {@link Configurable}. */ + isConfigurable = (): this is Configurable => { + return "setup" in this && "config" in this && "onSetup" in this; + }; +} diff --git a/packages/components/src/core/Types/src/component.ts b/packages/components/src/core/Types/src/component.ts new file mode 100644 index 000000000..5bcc19e47 --- /dev/null +++ b/packages/components/src/core/Types/src/component.ts @@ -0,0 +1,20 @@ +import { Components } from "../../Components"; +import { Base } from "./base"; + +/** + * Components are the building blocks of this library. Components are singleton + * elements that contain specific functionality. For instance, the SimpleClipper + * Component can create, delete and handle 3D clipping planes. Components must be + * unique (they can't be instanced more than once), and have a static UUID that + * identifies them uniquely. The can be accessed globally using the {@link Components} + * instance. + */ +export abstract class Component extends Base { + /** + * Whether this component is active or not. The behaviour can vary depending + * on the type of component. E.g. a disabled dimension tool will stop creating + * dimensions, while a disabled camera will stop moving. A disabled component + * will not be updated automatically each frame. + */ + abstract enabled: boolean; +} diff --git a/packages/components/src/core/Types/src/event.ts b/packages/components/src/core/Types/src/event.ts new file mode 100644 index 000000000..751efb3f9 --- /dev/null +++ b/packages/components/src/core/Types/src/event.ts @@ -0,0 +1,42 @@ +/** + * Simple event handler by + * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). + * Keep in mind that: + * - If you want to remove it later, you might want to declare the callback as + * an object. + * - If you want to maintain the reference to `this`, you will need to declare + * the callback as an arrow function. + */ +export class Event { + /** + * Add a callback to this event instance. + * @param handler - the callback to be added to this event. + */ + add(handler: T extends void ? { (): void } : { (data: T): void }): void { + this.handlers.push(handler); + } + + /** + * Removes a callback from this event instance. + * @param handler - the callback to be removed from this event. + */ + remove(handler: T extends void ? { (): void } : { (data: T): void }): void { + this.handlers = this.handlers.filter((h) => h !== handler); + } + + /** Triggers all the callbacks assigned to this event. */ + trigger = (data?: T) => { + const handlers = this.handlers.slice(0); + for (const handler of handlers) { + handler(data as any); + } + }; + + /** Gets rid of all the suscribed events. */ + reset() { + this.handlers.length = 0; + } + + private handlers: (T extends void ? { (): void } : { (data: T): void })[] = + []; +} diff --git a/packages/components/src/core/Types/src/index.ts b/packages/components/src/core/Types/src/index.ts new file mode 100644 index 000000000..741f0ef80 --- /dev/null +++ b/packages/components/src/core/Types/src/index.ts @@ -0,0 +1,9 @@ +export * from "./event"; +export * from "./interfaces"; +export * from "./component"; +export * from "./base"; +export * from "./base-world-item"; +export * from "./base-camera"; +export * from "./base-renderer"; +export * from "./base-scene"; +export * from "./world"; diff --git a/packages/components/src/base-types/base-types.ts b/packages/components/src/core/Types/src/interfaces.ts similarity index 69% rename from packages/components/src/base-types/base-types.ts rename to packages/components/src/core/Types/src/interfaces.ts index 5a9fc8c16..1908920a2 100644 --- a/packages/components/src/base-types/base-types.ts +++ b/packages/components/src/core/Types/src/interfaces.ts @@ -1,49 +1,5 @@ import * as THREE from "three"; -import { UIElement } from "./ui-element"; -import { SimpleUIComponent } from "../ui/SimpleUIComponent"; - -/** - * Simple event handler by - * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). - * Keep in mind that: - * - If you want to remove it later, you might want to declare the callback as - * an object. - * - If you want to maintain the reference to `this`, you will need to declare - * the callback as an arrow function. - */ -export class Event { - /** - * Add a callback to this event instance. - * @param handler - the callback to be added to this event. - */ - add(handler: T extends void ? { (): void } : { (data: T): void }): void { - this.handlers.push(handler); - } - - /** - * Removes a callback from this event instance. - * @param handler - the callback to be removed from this event. - */ - remove(handler: T extends void ? { (): void } : { (data: T): void }): void { - this.handlers = this.handlers.filter((h) => h !== handler); - } - - /** Triggers all the callbacks assigned to this event. */ - trigger = async (data?: T) => { - const handlers = this.handlers.slice(0); - for (const handler of handlers) { - await handler(data as any); - } - }; - - /** Gets rid of all the suscribed events. */ - reset() { - this.handlers.length = 0; - } - - private handlers: (T extends void ? { (): void } : { (data: T): void })[] = - []; -} +import { Event } from "./event"; /** * Whether this component has to be manually destroyed once you are done with @@ -57,7 +13,7 @@ export interface Disposable { * Destroys the object from memory to prevent a * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). */ - dispose: () => Promise; + dispose: () => void | Promise; /** Fired after the tool has been {@link Disposable.dispose()} */ readonly onDisposed: Event; @@ -115,7 +71,7 @@ export interface Updateable { * Function used to update the state of this component each frame. For * instance, a renderer component will make a render each frame. */ - update(delta?: number): void; + update(delta?: number): void | Promise; } /** Basic type to describe the progress of any kind of process. */ @@ -177,7 +133,7 @@ export interface Configurable> { isSetup: boolean; /** Use the provided configuration to setup the tool. */ - setup: (config?: Partial) => Promise; + setup: (config?: Partial) => void | Promise; /** Fired after successfully calling {@link Configurable.setup()} */ readonly onSetup: Event; @@ -189,18 +145,9 @@ export interface Configurable> { } /** - * Whether this component has a representation in the user - * interface, like a button or a window. - */ -export interface UI { - /** The class containing all the buttons, windows, tables, etc., of this component. */ - readonly uiElement: UIElement<{ [name: string]: SimpleUIComponent }>; -} - -/** - * A list of IDs indexed by the fragments where they exist. As an item can be - * made of multiple fragments, there might be repeated IDs across entries. + * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript. */ -export interface FragmentIdMap { - [fragmentID: string]: Set; +export interface BVHGeometry extends THREE.BufferGeometry { + boundsTree: Object | undefined; + disposeBoundsTree: () => void; } diff --git a/packages/components/src/core/Types/src/world.ts b/packages/components/src/core/Types/src/world.ts new file mode 100644 index 000000000..6661cec03 --- /dev/null +++ b/packages/components/src/core/Types/src/world.ts @@ -0,0 +1,10 @@ +import { BaseScene } from "./base-scene"; +import { BaseCamera } from "./base-camera"; +import { BaseRenderer } from "./base-renderer"; +import { Updateable, Disposable } from "./interfaces"; + +export interface World extends Disposable, Updateable { + scene: BaseScene; + camera: BaseCamera; + renderer: BaseRenderer | null; +} diff --git a/packages/components/src/core/UUID/index.ts b/packages/components/src/core/UUID/index.ts new file mode 100644 index 000000000..2ff41729e --- /dev/null +++ b/packages/components/src/core/UUID/index.ts @@ -0,0 +1,61 @@ +/* eslint no-bitwise: 0 */ + +export class UUID { + private static _pattern = + /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/; + + // prettier-ignore + private static _lut = [ + '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', + '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', + '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', + '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', + '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', + '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', + '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', + '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', + '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', + '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', + 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', + 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', + 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', + 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', + 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', + 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff' + ]; + + // Copied from three.js source + // Original source: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 + static create() { + const d0 = (Math.random() * 0xffffffff) | 0; + const d1 = (Math.random() * 0xffffffff) | 0; + const d2 = (Math.random() * 0xffffffff) | 0; + const d3 = (Math.random() * 0xffffffff) | 0; + const uuid = `${ + UUID._lut[d0 & 0xff] + + UUID._lut[(d0 >> 8) & 0xff] + + UUID._lut[(d0 >> 16) & 0xff] + + UUID._lut[(d0 >> 24) & 0xff] + }-${UUID._lut[d1 & 0xff]}${UUID._lut[(d1 >> 8) & 0xff]}-${ + UUID._lut[((d1 >> 16) & 0x0f) | 0x40] + }${UUID._lut[(d1 >> 24) & 0xff]}-${UUID._lut[(d2 & 0x3f) | 0x80]}${ + UUID._lut[(d2 >> 8) & 0xff] + }-${UUID._lut[(d2 >> 16) & 0xff]}${UUID._lut[(d2 >> 24) & 0xff]}${UUID._lut[d3 & 0xff]}${ + UUID._lut[(d3 >> 8) & 0xff] + }${UUID._lut[(d3 >> 16) & 0xff]}${UUID._lut[(d3 >> 24) & 0xff]}`; + + // .toLowerCase() here flattens concatenated strings to save heap memory space. + return uuid.toLowerCase(); + } + + static validate(uuid: string) { + if (!UUID._pattern.test(uuid)) + throw new Error( + `${uuid} is not a valid UUID v4. + +- If you're the tool creator, you can take one from https://www.uuidgenerator.net/. + +- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`, + ); + } +} diff --git a/packages/components/src/core/Worlds/index.ts b/packages/components/src/core/Worlds/index.ts new file mode 100644 index 000000000..540546e01 --- /dev/null +++ b/packages/components/src/core/Worlds/index.ts @@ -0,0 +1,30 @@ +import { Component, Disposable, Updateable, World, Event } from "../Types"; + +export class Worlds extends Component implements Updateable, Disposable { + static readonly uuid = "fdb61dc4-2ec1-4966-b83d-54ea795fad4a" as const; + + readonly onAfterUpdate = new Event(); + + readonly onBeforeUpdate = new Event(); + + readonly onDisposed = new Event(); + + list = new Map(); + + enabled = true; + + dispose() { + this.enabled = false; + for (const [_id, world] of this.list) { + world.dispose(); + } + this.onDisposed.trigger(); + } + + update(delta?: number): void | Promise { + if (!this.enabled) return; + for (const [_id, world] of this.list) { + world.update(delta); + } + } +} diff --git a/packages/components/src/core/Worlds/src/index.ts b/packages/components/src/core/Worlds/src/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/components/src/core/Worlds/src/simple-world.ts b/packages/components/src/core/Worlds/src/simple-world.ts new file mode 100644 index 000000000..74b3d6ca0 --- /dev/null +++ b/packages/components/src/core/Worlds/src/simple-world.ts @@ -0,0 +1,106 @@ +import { UUID } from "../../UUID"; +import { + Event, + Base, + World, + BaseScene, + BaseCamera, + BaseRenderer, +} from "../../Types"; +import { Components } from "../../Components"; + +// const components = new Components(); +// const worlds = components.get(Worlds); +// const world = new SimpleWorld(components); +// worlds.list.add(world); +// +// world.scene = new SimpleScene(); +// world.renderer = new SimpleRenderer(container); +// world.camera = new SimpleCamera(); +// +// world.enabled = true; +// +// const {scene} = worlds.get("id"); + +export class SimpleWorld extends Base implements World { + readonly onAfterUpdate = new Event(); + + readonly onBeforeUpdate = new Event(); + + enabled = false; + + uuid = UUID.create(); + + readonly onDisposed = new Event(); + + private _scene?: BaseScene; + + private _camera?: BaseCamera; + + private _renderer: BaseRenderer | null = null; + + get scene() { + if (!this._scene) { + throw new Error("No scene initialized!"); + } + return this._scene; + } + + set scene(scene: BaseScene) { + if (this._scene) { + this._scene.world = null; + } + scene.world = this; + } + + get camera() { + if (!this._camera) { + throw new Error("No camera initialized!"); + } + return this._camera; + } + + set camera(camera: BaseCamera) { + if (this._camera) { + this._camera.world = null; + } + camera.world = this; + } + + get renderer() { + return this._renderer; + } + + set renderer(renderer: BaseRenderer | null) { + if (this._renderer) { + this._renderer.world = null; + } + if (renderer) { + renderer.world = this; + } + } + + constructor(components: Components) { + super(components); + } + + update() { + if (!this.enabled) return; + this.onBeforeUpdate.trigger(); + if (this.renderer) { + this.renderer.update(); + } + this.onAfterUpdate.trigger(); + } + + dispose() { + this.enabled = false; + this.scene.dispose(); + if (this.camera.isDisposeable()) { + this.camera.dispose(); + } + if (this.renderer) { + this.renderer.dispose(); + } + } +} diff --git a/packages/components/src/core/index.ts b/packages/components/src/core/index.ts index 98ed0cf18..3e4221faa 100644 --- a/packages/components/src/core/index.ts +++ b/packages/components/src/core/index.ts @@ -1,29 +1,8 @@ -import { MeshBVH, acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from "three-mesh-bvh"; - -// TODO: Find a better place to put this. -declare module 'three' { - export interface BufferGeometry { - boundsTree?: MeshBVH; - computeBoundsTree: typeof computeBoundsTree; - disposeBoundsTree: typeof disposeBoundsTree; - } - - export interface Mesh { - raycast: typeof acceleratedRaycast; - } -} - -export * from "./Disposer"; -export * from "./SimpleScene"; -export * from "./ToolsComponent"; -export * from "./SimpleRenderer"; -export * from "./SimpleCamera"; -export * from "./SimpleRaycaster"; -export * from "./SimpleGrid"; +export * from "./Cameras"; export * from "./Components"; -export * from "./SimpleClipper"; -export * from "./ScreenCuller"; -export * from "./SimpleSVGViewport"; -export * from "./Simple2DMarker"; -export * from "./MaterialManager"; -export * from "./Simple2DScene"; +export * from "./Disposer"; +export * from "./Renderers"; +export * from "./Scenes"; +export * from "./Types"; +export * from "./UUID"; +export * from "./Worlds"; diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index 7e2ac1e49..8d119dee8 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -1,12 +1 @@ -export * from "./base-types"; export * from "./core"; -export * from "./fragments"; -export * from "./ui"; -export * from "./services"; -export * from "./navigation"; -export * from "./annotation"; -export * from "./utils"; -export * from "./ifc"; -export * from "./measurement"; -export * from "./import-export"; -export * from "./civil"; diff --git a/packages/components/src/ui/ButtonComponent/index.ts b/packages/components/src/ui/ButtonComponent/index.ts deleted file mode 100644 index 11c7f8bbb..000000000 --- a/packages/components/src/ui/ButtonComponent/index.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { - createPopper, - Placement, - Instance as PopperInstance, - // @ts-ignore -} from "@popperjs/core/dist/esm"; -import { Event } from "../../base-types"; -import { Toolbar } from "../ToolbarComponent"; -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -interface IButtonOptions { - materialIconName?: string; - iconURL?: string; - id?: string; - name?: string; - tooltip?: string; - closeOnClick?: boolean; -} - -export class Button extends SimpleUIComponent { - name: string = "TooeenButton"; - menu: Toolbar; - - readonly onClick = new Event(); - - static Class = { - Base: ` - relative flex gap-x-2 items-center bg-transparent text-white rounded-[10px] - max-h-8 p-2 hover:cursor-pointer hover:bg-ifcjs-200 hover:text-black - data-[active=true]:cursor-pointer data-[active=true]:bg-ifcjs-200 data-[active=true]:text-black - disabled:cursor-default disabled:bg-gray-600 disabled:text-gray-400 pointer-events-auto - transition-all fill-white hover:fill-black - `, - Label: "text-sm tracking-[1.25px] whitespace-nowrap", - Tooltip: ` - transition-opacity bg-ifcjs-100 text-sm text-gray-100 rounded-md - absolute left-1/2 -translate-x-1/2 -translate-y-12 opacity-0 mx-auto p-4 w-max h-4 flex items-center - pointer-events-none - `, - }; - - protected _parent: Toolbar | null = null; - private _closeOnClick = true; - private _popper: PopperInstance; - - set tooltip(value: string | null) { - const element = this.innerElements.tooltip; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element.classList.add("hidden"); - } - } - - get tooltip() { - return this.innerElements.tooltip.textContent; - } - - set label(value: string | null) { - const element = this.innerElements.label; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - set parent(toolbar: Toolbar | null) { - this._parent = toolbar; - if (toolbar) { - this.menu.position = toolbar.position; - this.updateMenuPlacement(); - } - } - - get parent() { - return this._parent; - } - - set alignment(value: "start" | "center" | "end") { - this.domElement.classList.remove( - "justify-start", - "justify-center", - "justify-end" - ); - this.domElement.classList.add(`justify-${value}`); - } - - set materialIcon(name: string | null) { - const icon = this.innerElements.icon; - icon.textContent = name; - if (name) { - icon.style.display = "unset"; - } else { - icon.style.display = "none"; - } - } - - get materialIcon() { - return this.innerElements.icon.textContent; - } - - get customIcon() { - return this.innerElements.customIcon.innerHTML; - } - - innerElements: { - icon: HTMLSpanElement; - customIcon: HTMLSpanElement; - label: HTMLParagraphElement; - tooltip: HTMLSpanElement; - }; - - constructor(components: Components, options?: IButtonOptions) { - const template = ` - - `; - super(components, template); - - this.innerElements = { - customIcon: this.getInnerElement("custom-icon") as HTMLSpanElement, - icon: this.getInnerElement("icon") as HTMLSpanElement, - label: this.getInnerElement("label") as HTMLParagraphElement, - tooltip: this.getInnerElement("tooltip") as HTMLSpanElement, - }; - - this.materialIcon = options?.materialIconName ?? null; - this.label = options?.name ?? null; - this.tooltip = options?.tooltip ?? null; - this.alignment = "start"; - if (options?.closeOnClick !== undefined) { - this._closeOnClick = options.closeOnClick; - } - - this.domElement.onclick = async (e) => { - e.stopImmediatePropagation(); - - await this.onClick.trigger(e); - - if (this.menu.children.length) { - this.menu.visible = true; - this._popper.update(); - } else if (this._closeOnClick) { - this._components.ui.closeMenus(); - this._components.ui.contextMenu.visible = false; - - if (this.parent) { - if (!this.parent.parent) { - this._components.ui.closeMenus(); - } - if (this.parent.closeMenus) { - this.parent.closeMenus(); - } - } - } - }; - - this.domElement.addEventListener("mouseover", ({ target }) => { - if (this.isButton(target)) { - if (this._components.ui.tooltipsEnabled) { - this.innerElements.tooltip.classList.remove("opacity-0"); - } - } - }); - - this.domElement.addEventListener("mouseleave", ({ target }) => { - if (this.isButton(target)) { - this.innerElements.tooltip.classList.add("opacity-0"); - } - }); - - // #region Extensible menu - this.menu = new Toolbar(components); - this.menu.visible = false; - this.menu.parent = this; - this.menu.setDirection("vertical"); - this.domElement.append(this.menu.domElement); - this._popper = createPopper(this.domElement, this.menu.domElement, { - modifiers: [ - { - name: "offset", - options: { offset: [0, 15] }, - }, - { - name: "preventOverflow", - options: { boundary: this._components.ui.viewerContainer }, - }, - ], - }); - // #endregion - - this.onEnabled.add(() => (this.domElement.disabled = false)); - this.onDisabled.add(() => (this.domElement.disabled = true)); - } - - async dispose(onlyChildren = false) { - await super.dispose(onlyChildren); - await this.menu.dispose(); - if (!onlyChildren) { - this.domElement.remove(); - } - this.onClick.reset(); - this._popper.destroy(); - } - - addChild(...button: Button[]) { - this.menu.addChild(...button); - } - - closeMenus() { - this.menu.closeMenus(); - this.menu.visible = false; - } - - async setCustomIcon(url: string | null) { - const { customIcon } = this.innerElements; - if (url) { - const response = await fetch(url); - customIcon.innerHTML = await response.text(); - customIcon.style.display = "unset"; - } else { - customIcon.style.display = "none"; - } - } - - private updateMenuPlacement() { - let placement: Placement = "bottom"; - if (this.parent?.position === "bottom") { - placement = this.parent?.parent ? "right" : "top"; - } - if (this.parent?.position === "top") { - placement = this.parent?.parent ? "right" : "bottom"; - } - if (this.parent?.position === "left") { - placement = "right"; - } - if (this.parent?.position === "right") { - placement = "left"; - } - this._popper.setOptions({ placement }); - } - - private isButton(element: any) { - return ( - element === this.get() || - element === this.innerElements.icon || - element === this.innerElements.label - ); - } -} diff --git a/packages/components/src/ui/Canvas/index.ts b/packages/components/src/ui/Canvas/index.ts deleted file mode 100644 index e0956bedc..000000000 --- a/packages/components/src/ui/Canvas/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as THREE from "three"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { Components } from "../../core"; -import { Resizeable, Event } from "../../base-types"; - -export class Canvas - extends SimpleUIComponent - implements Resizeable -{ - name: string = "Canvas"; - readonly onResize = new Event(); - - private _size = new THREE.Vector2(320, 160); - - constructor(components: Components) { - const template = ` - - `; - super(components, template); - } - - getSize(): THREE.Vector2 { - return this._size; - } - - resize(size?: THREE.Vector2) { - if (size) { - this._size = size; - this.domElement.style.width = `${size.x}px`; - this.domElement.style.height = `${size.y}px`; - this.onResize.trigger(size); - } - } -} diff --git a/packages/components/src/ui/CheckboxInput/index.ts b/packages/components/src/ui/CheckboxInput/index.ts deleted file mode 100644 index 5980bebb7..000000000 --- a/packages/components/src/ui/CheckboxInput/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { UIManager } from "../UIManager"; - -export class CheckboxInput extends SimpleUIComponent { - name = "TooeenCheckboxInput"; - readonly onChange: Event = new Event(); - - set value(value: boolean) { - this.innerElements.input.checked = value; - this.onChange.trigger(this.value); - } - - get value() { - return this.innerElements.input.checked; - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - innerElements: { - label: HTMLLabelElement; - input: HTMLInputElement; - }; - - constructor(components: Components) { - const template = ` -
- - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - input: this.getInnerElement("input") as HTMLInputElement, - }; - - this.innerElements.input.addEventListener("change", () => { - this.onChange.trigger(this.value); - }); - - this.label = "Tooeen Checkbox"; - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onChange.reset(); - } -} diff --git a/packages/components/src/ui/ColorInput/index.ts b/packages/components/src/ui/ColorInput/index.ts deleted file mode 100644 index bba9ab752..000000000 --- a/packages/components/src/ui/ColorInput/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { UIManager } from "../UIManager"; - -export class ColorInput extends SimpleUIComponent { - name = "TooeenColorInput"; - readonly onChange: Event = new Event(); - - set value(value: string) { - this.innerElements.input.value = value; - this.onChange.trigger(this.value); - } - - get value() { - return this.innerElements.input.value; - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - innerElements: { - label: HTMLLabelElement; - input: HTMLInputElement; - }; - - // @ts-ignore - constructor(components: Components) { - const template = ` -
- - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - input: this.getInnerElement("input") as HTMLInputElement, - }; - - this.label = "Tooeen Color"; - this.value = "#BCF124"; - - this.innerElements.input.oninput = () => { - this.onChange.trigger(this.value); - }; - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onChange.reset(); - } -} diff --git a/packages/components/src/ui/CommandsMenu/index.ts b/packages/components/src/ui/CommandsMenu/index.ts deleted file mode 100644 index ad45c2c53..000000000 --- a/packages/components/src/ui/CommandsMenu/index.ts +++ /dev/null @@ -1,75 +0,0 @@ -import * as THREE from "three"; -import { Components } from "../../core"; -import { Button } from "../ButtonComponent"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -export interface UICommands { - [id: string]: (data?: T) => void; -} - -export class CommandsMenu extends SimpleUIComponent { - name = "CommandsMenu"; - - commandData?: T; - - offset = new THREE.Vector2(20, -10); - - innerElements: { - window: HTMLDivElement; - }; - - commands: UICommands = {}; - - get hasCommands() { - return Object.keys(this.commands).length !== 0; - } - - constructor(components: Components) { - const template = `
`; - super(components, template); - - this.innerElements = { - window: this.getInnerElement("window") as HTMLDivElement, - }; - - this.setupEvents(true); - } - - update() { - this.dispose(true); - for (const name in this.commands) { - const command = this.commands[name]; - const button = new Button(this._components, { name }); - button.name = name; - this.addChild(button); - button.onClick.add(() => command(this.commandData)); - } - } - - popup(x: number, y: number) { - this.domElement.style.left = `${x + this.offset.x}px`; - this.domElement.style.top = `${y + this.offset.y}px`; - this.visible = true; - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - if (!onlyChildren) { - this.setupEvents(false); - this.commands = {}; - (this.commandData as any) = null; - } - } - - private setupEvents(active: boolean) { - if (active) { - window.addEventListener("click", this.hideCommandsMenu); - } else { - window.removeEventListener("click", this.hideCommandsMenu); - } - } - - private hideCommandsMenu = () => { - this.visible = false; - }; -} diff --git a/packages/components/src/ui/DragAndDropInput/index.html b/packages/components/src/ui/DragAndDropInput/index.html deleted file mode 100644 index 49c716c7e..000000000 --- a/packages/components/src/ui/DragAndDropInput/index.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - Tools Component - - - -
- - - - diff --git a/packages/components/src/ui/DragAndDropInput/index.ts b/packages/components/src/ui/DragAndDropInput/index.ts deleted file mode 100644 index c3703495c..000000000 --- a/packages/components/src/ui/DragAndDropInput/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -interface DragAndDropConfig { - subTitle: string; -} - -export class DragAndDropInput extends SimpleUIComponent { - name = "DragAndDropInput"; - - onFilesLoaded = new Event(); - - constructor(components: Components, config?: DragAndDropConfig) { - const subtitle = config ? config.subTitle : ""; - const template = ` -
-
- -
-
- `; - - super(components, template); - const input = this.get().querySelector("input"); - if (!input) throw new Error("Input not found!"); - - const onFilesLoaded = async () => { - if (input.files === null) return; - await this.onFilesLoaded.trigger(input.files); - }; - - input.onchange = () => onFilesLoaded(); - - const allowDragDrop = (event: any) => event.preventDefault(); - this.get().ondragover = allowDragDrop; - this.get().ondragenter = allowDragDrop; - - this.get().ondrop = async (event: any) => { - event.preventDefault(); - input.files = event.dataTransfer.files; - await onFilesLoaded(); - }; - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onFilesLoaded.reset(); - } -} diff --git a/packages/components/src/ui/Drawer/index.html b/packages/components/src/ui/Drawer/index.html deleted file mode 100644 index c160b7f0a..000000000 --- a/packages/components/src/ui/Drawer/index.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - Tools Component - - - -
- - - - diff --git a/packages/components/src/ui/Drawer/index.ts b/packages/components/src/ui/Drawer/index.ts deleted file mode 100644 index ff23f3498..000000000 --- a/packages/components/src/ui/Drawer/index.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { Event } from "../../base-types"; - -// TODO: Fix tooltips for buttons in drawers - -export class Drawer extends SimpleUIComponent { - onResized = new Event(); - - protected _size = "10rem"; - protected _visible = true; - protected _type: "top" | "bottom" | "left" | "right" = "left"; - - slots: { - content: SimpleUIComponent; - }; - - get visible() { - return this._visible; - } - - set visible(value: boolean) { - const classes = this.domElement.classList; - const isHorizontal = this._type === "top" || this._type === "bottom"; - - if (isHorizontal) { - const sign = this._type === "top" ? "-" : ""; - if (value) { - classes.remove(`${sign}translate-y-full`); - } else { - classes.add(`${sign}translate-y-full`); - } - } else { - const sign = this._type === "left" ? "-" : ""; - if (value) { - classes.remove(`${sign}translate-x-full`); - } else { - classes.add(`${sign}translate-x-full`); - } - } - - this._visible = value; - } - - get size() { - return this._size; - } - - set size(value: string) { - this._size = value; - const horizontal = this._type === "top" || this._type === "bottom"; - const height = horizontal ? this._size : "inherit"; - const width = horizontal ? "inherit" : this._size; - this.domElement.style.height = height; - this.domElement.style.width = width; - } - - get containerSize() { - const height = this.domElement.clientHeight; - const width = this.domElement.clientWidth; - return { height, width }; - } - - set alignment(value: typeof Drawer.prototype._type) { - const classes = this.domElement.classList; - - this._type = value; - - classes.remove("h-full"); - classes.remove("w-full"); - classes.remove("top-0"); - classes.remove("bottom-0"); - classes.remove("left-0"); - classes.remove("right-0"); - classes.remove("-translate-x-full"); - classes.remove("-translate-y-full"); - classes.remove("translate-x-full"); - classes.remove("translate-y-full"); - - if (value === "top" || value === "bottom") { - classes.add("w-full"); - classes.add("left-0"); - classes.add(`${value}-0`); - } else { - classes.add("h-full"); - classes.add("top-0"); - classes.add(`${value}-0`); - } - - this.size = this._size; - this.visible = this._visible; - } - - constructor(components: Components) { - const template = ` -
-
-
- `; - - super(components, template); - - this.domElement.style.width = this._size; - - this.slots = { - content: new SimpleUIComponent( - components, - `
` - ), - }; - - this.setSlots(); - - const observer = new ResizeObserver(() => this.onResized.trigger()); - observer.observe(this.get()); - } - - addChild(...items: SimpleUIComponent[]) { - const content = this.slots.content; - content.addChild(...items); - if (!content.visible) content.visible = true; - } -} diff --git a/packages/components/src/ui/Dropdown/index.ts b/packages/components/src/ui/Dropdown/index.ts deleted file mode 100644 index 0b345777c..000000000 --- a/packages/components/src/ui/Dropdown/index.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { UIManager } from "../UIManager"; - -export class Dropdown extends SimpleUIComponent { - name = "TooeenDropdown"; - options: string[] = []; - - readonly onChange = new Event(); - - private _allowSearch = false; - - set value(value: string | null) { - const option = this.options.find((v) => v === value) ?? this.options[0]; - this.innerElements.button.textContent = option ?? null; - this.onChange.trigger(this.value as string); - } - - get value() { - return this.innerElements.button.textContent; - } - - set allowSearch(value: boolean) { - this._allowSearch = value; - if (value) { - this.innerElements.search.classList.remove("hidden"); - } else { - this.innerElements.search.classList.add("hidden"); - } - } - - get allowSearch() { - return this._allowSearch; - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - innerElements: { - label: HTMLLabelElement; - button: HTMLButtonElement; - dropdown: HTMLDivElement; - search: HTMLDivElement; - searchInput: HTMLInputElement; - dropdownList: HTMLUListElement; - }; - - constructor(components: Components, name: string = "Tooeen Dropdown") { - const template = ` -
- - - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - button: this.getInnerElement("button") as HTMLButtonElement, - dropdown: this.getInnerElement("dropdown") as HTMLDivElement, - search: this.getInnerElement("search") as HTMLDivElement, - searchInput: this.getInnerElement("searchInput") as HTMLInputElement, - dropdownList: this.getInnerElement("dropdownList") as HTMLUListElement, - }; - - this.setSearch(); - - this.innerElements.button.onclick = () => this.toggle(); - this.setupEvents(true); - - this.label = name; - } - - async dispose(onlyChildren: boolean = false) { - super.dispose(onlyChildren); - this.onChange.reset(); - this.setupEvents(false); - } - - toggle() { - if (this.innerElements.dropdown.classList.contains("hidden")) { - this.innerElements.dropdown.classList.remove("hidden"); - } else { - this.innerElements.dropdown.classList.add("hidden"); - } - } - - addOption(...value: string[]) { - const options = value.filter((option) => !this.options.includes(option)); - for (const option of options) { - this.options.push(option); - const li = document.createElement("li"); - li.id = `${option.replace(/\s+/g, "_")}-${this.id}`; - li.className = - "py-2 text-base cursor-pointer hover:text-ifcjs-200 m-0 p-0"; - li.textContent = option; - li.onclick = () => { - this.value = option; - this.innerElements.dropdown.classList.add("hidden"); - }; - this.innerElements.dropdownList.appendChild(li); - } - return this; - } - - removeOption(...value: string[]) { - const optionsToDelete = value.filter((option) => - this.options.includes(option) - ); - for (const name of optionsToDelete) { - const option = this.get().querySelector( - `#${name.replace(/\s+/g, "_")}-${this.id}` - ); - if (!option) continue; - option.remove(); - } - this.options = this.options.filter((option) => !value.includes(option)); - return this; - } - - private setSearch() { - this.innerElements.searchInput.oninput = () => { - const searchValue = this.innerElements.searchInput.value.toLowerCase(); - const list = this.innerElements.dropdownList.children; - for (const child of list) { - const childText = child.textContent?.toLowerCase(); - if (!childText) continue; - if (childText.includes(searchValue)) { - child.classList.remove("hidden"); - } else { - child.classList.add("hidden"); - } - } - }; - } - - private setupEvents(active: boolean) { - if (active) { - document.addEventListener("click", this.hide, true); - } else { - document.removeEventListener("click", this.hide, true); - } - } - - private hide = (event: MouseEvent) => { - if (!this.get().contains(event.target as Node)) { - this.innerElements.dropdown.classList.add("hidden"); - } - }; -} diff --git a/packages/components/src/ui/FloatingWindow/index.ts b/packages/components/src/ui/FloatingWindow/index.ts deleted file mode 100644 index 74d287d2c..000000000 --- a/packages/components/src/ui/FloatingWindow/index.ts +++ /dev/null @@ -1,283 +0,0 @@ -import { Vector2 } from "three"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { Event } from "../../base-types"; -import { Components } from "../../core"; - -export class FloatingWindow extends SimpleUIComponent { - private _resizeable = true; - private _movable = true; - - static Class = { - Base: "absolute flex flex-col backdrop-blur-xl shadow-md overflow-auto top-5 resize z-50 left-5 min-h-[80px] min-w-[150px] w-fit h-fit text-white bg-ifcjs-100 rounded-md", - Description: "text-base text-gray-400", - }; - - onMoved = new Event(); - onResized = new Event(); - - private _isMouseDown = false; - private _offsetX = 0; - private _offsetY = 0; - - referencePoints: { - topLeft: Vector2; - top: Vector2; - topRight: Vector2; - left: Vector2; - center: Vector2; - right: Vector2; - bottomLeft: Vector2; - bottom: Vector2; - bottomRight: Vector2; - }; - - get containerSize() { - const baseHeight = this.domElement.clientHeight; - const titleHeight = this.innerElements.titleContainer.clientHeight; - const height = baseHeight - titleHeight; - const width = this.domElement.clientWidth; - return { height, width }; - } - - get viewerContainer() { - return this._components.renderer.get().domElement - .parentElement as HTMLElement; - } - - set description(value: string | null) { - const element = this.innerElements.description; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element?.classList.add("hidden"); - } - } - - get description() { - return this.innerElements.description.textContent; - } - - set title(value: string | null) { - const element = this.innerElements.title; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element.classList.add("hidden"); - } - } - - get title() { - return this.innerElements.title.textContent; - } - - set resizeable(value: boolean) { - this._resizeable = value; - if (value) { - this.get().classList.add("resize"); - } else { - this.get().classList.remove("resize"); - } - } - - get resizeable() { - return this._resizeable; - } - - set movable(value: boolean) { - this._movable = value; - if (value) { - this.innerElements.titleContainer.classList.add("cursor-move"); - } else { - this.innerElements.titleContainer.classList.remove("cursor-move"); - } - } - - get movable() { - return this._movable; - } - - innerElements: { - title: HTMLHeadingElement; - description: HTMLHeadingElement; - titleContainer: HTMLDivElement; - closeBtn: HTMLSpanElement; - }; - - slots: { - content: SimpleUIComponent; - }; - - constructor(components: Components, id?: string) { - const template = ` -
-
-
-

Tooeen Floating Window

-

-
- close -
-
-
- `; - - super(components, template, id); - - this.innerElements = { - title: this.getInnerElement("title") as HTMLHeadingElement, - description: this.getInnerElement("description") as HTMLHeadingElement, - titleContainer: this.getInnerElement("title-container") as HTMLDivElement, - closeBtn: this.getInnerElement("close") as HTMLSpanElement, - }; - - this.slots = { - content: new SimpleUIComponent( - components, - `
` - ), - }; - this.setSlots(); - - this.innerElements.closeBtn.onclick = () => (this.visible = false); - this.setMovableListeners(); - - const observer = new ResizeObserver(() => this.onResized.trigger()); - observer.observe(this.get()); - - this.description = null; - this.movable = true; - this.resizeable = true; - - this.referencePoints = { - topLeft: new Vector2(), - top: new Vector2(), - topRight: new Vector2(), - left: new Vector2(), - center: new Vector2(), - right: new Vector2(), - bottomLeft: new Vector2(), - bottom: new Vector2(), - bottomRight: new Vector2(), - }; - this.domElement.style.width = "400px"; - this.domElement.style.height = "250px"; - } - - async dispose(onlyChildren = false) { - await super.dispose(onlyChildren); - this.setupEvents(false); - this.onMoved.reset(); - this.onResized.reset(); - } - - private setMovableListeners() { - // For node.js - try { - // eslint-disable-next-line no-unused-expressions - this._components.renderer; - } catch (_e) { - return; - } - - this.setupEvents(true); - } - - addChild(...items: SimpleUIComponent[]) { - const content = this.slots.content; - content.addChild(...items); - if (!content.visible) content.visible = true; - } - - updateReferencePoints() { - const uiElementRect = this.domElement.getBoundingClientRect(); - this.referencePoints.topLeft.set(uiElementRect.x, uiElementRect.y); - this.referencePoints.top.set( - uiElementRect.x + uiElementRect.width / 2, - uiElementRect.y - ); - this.referencePoints.topRight.set( - uiElementRect.x + uiElementRect.width, - uiElementRect.y - ); - this.referencePoints.left.set( - uiElementRect.x, - uiElementRect.y + uiElementRect.height / 2 - ); - this.referencePoints.center.set( - uiElementRect.x + uiElementRect.width / 2, - uiElementRect.y + uiElementRect.height / 2 - ); - this.referencePoints.right.set( - uiElementRect.x + uiElementRect.width, - uiElementRect.y + uiElementRect.height / 2 - ); - this.referencePoints.bottomLeft.set( - uiElementRect.x, - uiElementRect.y + uiElementRect.height - ); - this.referencePoints.bottom.set( - uiElementRect.x + uiElementRect.width / 2, - uiElementRect.y + uiElementRect.height - ); - this.referencePoints.bottomRight.set( - uiElementRect.x + uiElementRect.width, - uiElementRect.y + uiElementRect.height - ); - } - - private setupEvents(active: boolean) { - const title = this.innerElements.titleContainer; - const container = this.viewerContainer; - if (active) { - if (title) { - title.addEventListener("mousedown", this.onMOuseDown); - } - container.addEventListener("mousemove", this.onMouseMove); - container.addEventListener("mouseup", this.onMouseUp); - } else { - if (title) { - title.removeEventListener("mousedown", this.onMOuseDown); - } - container.removeEventListener("mousemove", this.onMouseMove); - container.removeEventListener("mouseup", this.onMouseUp); - } - } - - private onMOuseDown = (event: MouseEvent) => { - if (!this.movable) return; - this._isMouseDown = true; - const rect = this.domElement.getBoundingClientRect(); - this._offsetX = event.clientX - rect.left; - this._offsetY = event.clientY - rect.top; - }; - - private onMouseUp = () => { - this._isMouseDown = false; - }; - - private onMouseMove = (event: MouseEvent) => { - if (!(this._isMouseDown && this.movable)) return; - const { width, height } = this.domElement.getBoundingClientRect(); - const { - x, - y, - width: containerWidth, - height: containerHeight, - } = this.viewerContainer.getBoundingClientRect(); - const maxLeft = containerWidth - width; - const maxTop = containerHeight - height; - const left = Math.max( - 0, - Math.min(event.clientX - this._offsetX - x, maxLeft) - ); - const top = Math.max( - 0, - Math.min(event.clientY - this._offsetY - y, maxTop) - ); - this.domElement.style.left = `${left}px`; - this.domElement.style.top = `${top}px`; - this.onMoved.trigger(this); - }; -} diff --git a/packages/components/src/ui/Modal/index.html b/packages/components/src/ui/Modal/index.html deleted file mode 100644 index e1acc18cd..000000000 --- a/packages/components/src/ui/Modal/index.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - Tools Component - - - -
- - - - diff --git a/packages/components/src/ui/Modal/index.ts b/packages/components/src/ui/Modal/index.ts deleted file mode 100644 index 6545221ff..000000000 --- a/packages/components/src/ui/Modal/index.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Event } from "../../base-types"; -import { Components } from "../../core"; -import { Button } from "../ButtonComponent"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -export class Modal extends SimpleUIComponent { - readonly onAccept = new Event(); - readonly onCancel = new Event(); - - set description(value: string | null) { - const element = this.innerElements.description; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element?.classList.add("hidden"); - } - } - - get description() { - return this.innerElements.description.textContent; - } - - set title(value: string | null) { - const element = this.innerElements.title; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element.classList.add("hidden"); - } - } - - get title() { - return this.innerElements.title.textContent; - } - - set visible(value: boolean) { - this._visible = value; - if (value) { - this.get().showModal(); - this.onVisible.trigger(); - } else { - this.get().close(); - this.onHidden.trigger(); - } - } - - get visible() { - return this._visible; - } - - slots: { - content: SimpleUIComponent; - actionButtons: SimpleUIComponent; - }; - - innerElements: { - title: HTMLHeadElement; - description: HTMLParagraphElement; - }; - - constructor(components: Components, title = "Tooeen Modal") { - const template = ` - -
-
-

${title}

-

-
-
-
-
-
- `; - super(components, template); - - this.innerElements = { - title: this.getInnerElement("title") as HTMLHeadElement, - description: this.getInnerElement("description") as HTMLParagraphElement, - }; - - this.slots = { - content: new SimpleUIComponent(components), - actionButtons: new SimpleUIComponent( - components, - `
` - ), - }; - this.setSlots(); - - const acceptBtn = new Button(this._components); - acceptBtn.materialIcon = "check"; - acceptBtn.label = "Accept"; - acceptBtn.get().classList.remove("hover:bg-ifcjs-200"); - acceptBtn.get().classList.add("hover:bg-success"); - acceptBtn.onClick.add(() => this.onAccept.trigger()); - - const cancelBtn = new Button(this._components); - cancelBtn.materialIcon = "close"; - cancelBtn.label = "Cancel"; - cancelBtn.get().classList.remove("hover:bg-ifcjs-200"); - cancelBtn.get().classList.add("hover:bg-error"); - cancelBtn.onClick.add(() => this.onCancel.trigger()); - - this.slots.actionButtons.addChild(cancelBtn, acceptBtn); - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onCancel.reset(); - this.onAccept.reset(); - } -} diff --git a/packages/components/src/ui/RangeInput/index.ts b/packages/components/src/ui/RangeInput/index.ts deleted file mode 100644 index 205ff4668..000000000 --- a/packages/components/src/ui/RangeInput/index.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Components } from "../../core"; -import { UIManager } from "../UIManager"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -export class RangeInput extends SimpleUIComponent { - name = "TooeenRangeInput"; - readonly onChange: Event = new Event(); - - set value(value: number) { - this.innerElements.input.value = String(value); - this.onChange.trigger(this.value); - } - - get value() { - return Number(this.innerElements.input.value); - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - set min(value: number) { - this.innerElements.input.min = String(value); - } - - get min() { - return Number(this.innerElements.input.min); - } - - set max(value: number) { - this.innerElements.input.max = String(value); - } - - get max() { - return Number(this.innerElements.input.max); - } - - set step(value: number) { - this.innerElements.input.step = String(value); - } - - get step() { - return Number(this.innerElements.input.step); - } - - innerElements: { - label: HTMLLabelElement; - input: HTMLInputElement; - }; - - // @ts-ignore - constructor(components: Components) { - const template = ` -
- - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - input: this.getInnerElement("input") as HTMLInputElement, - }; - - this.label = "Tooeen Range"; - - this.innerElements.input.oninput = () => { - this.onChange.trigger(this.value); - }; - } -} diff --git a/packages/components/src/ui/SimpleUICard/index.ts b/packages/components/src/ui/SimpleUICard/index.ts deleted file mode 100644 index b0272ebff..000000000 --- a/packages/components/src/ui/SimpleUICard/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { Components } from "../../core"; - -export class SimpleUICard extends SimpleUIComponent { - name: string = "SimpleUICard"; - - set title(value: string | null) { - this.innerElements.title.textContent = value; - } - - get title() { - return this.innerElements.title.textContent; - } - - set description(value: string | null) { - this.innerElements.description.textContent = value; - } - - get description() { - return this.innerElements.description.textContent; - } - - innerElements: { - title: HTMLHeadElement; - description: HTMLParagraphElement; - }; - - slots: { - rightContainer: SimpleUIComponent; - }; - - constructor(components: Components, id?: string) { - const template = ` -
-
-

-

-
-
-
- `; - - super(components, template, id); - - this.innerElements = { - title: this.getInnerElement("title") as HTMLHeadElement, - description: this.getInnerElement("description") as HTMLParagraphElement, - }; - - this.slots = { - rightContainer: new SimpleUIComponent( - components, - `
` - ), - }; - this.setSlots(); - } - - addChild(...items: SimpleUIComponent[]) { - items.forEach((item) => { - this.slots.rightContainer.addChild(item); - }); - } -} diff --git a/packages/components/src/ui/SimpleUIComponent/index.ts b/packages/components/src/ui/SimpleUIComponent/index.ts deleted file mode 100644 index b5fbf69c2..000000000 --- a/packages/components/src/ui/SimpleUIComponent/index.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { generateUUID } from "three/src/math/MathUtils.js"; -import { Component, Disposable, Event, Hideable } from "../../base-types"; -import { Components } from "../../core"; - -export class SimpleUIComponent - extends Component - implements Hideable, Disposable -{ - name: string = "SimpleUIComponent"; - - /** {@link Disposable.onDisposed} */ - readonly onDisposed = new Event(); - - id: string; - - // TODO: Remove children and leave only slots? - children: SimpleUIComponent[] = []; - - data: Record = {}; - - // Slots are other UIComponents that inherits all the logic from SimpleUIComponent - slots: { [name: string]: SimpleUIComponent } = {}; - - // InnerElements are those HTML Elements which doesn't come from an UIComponent. - innerElements: { [name: string]: HTMLElement } = {}; - - static Class: { Base: string; [elementName: string]: string }; - - readonly onVisible = new Event(); - readonly onHidden = new Event(); - readonly onEnabled = new Event(); - readonly onDisabled = new Event(); - - protected _domElement?: T; - protected _components: Components; - protected _parent: SimpleUIComponent | null = null; - protected _enabled: boolean = true; - protected _visible: boolean = true; - protected _active: boolean = false; - - get domElement() { - if (!this._domElement) { - throw new Error("Dom element not initialized!"); - } - return this._domElement; - } - - set domElement(ele: T) { - if (this._domElement) { - this._domElement.remove(); - } - this._domElement = ele; - } - - set parent(value: SimpleUIComponent | null) { - this._parent = value; - } - - get parent() { - return this._parent; - } - - get active() { - return this._active; - } - set active(active: boolean) { - this.domElement.setAttribute("data-active", String(active)); - this._active = active; - } - - get visible() { - return this._visible; - } - - set visible(value: boolean) { - this._visible = value; - if (value) { - this.domElement.classList.remove("hidden"); - this.onVisible.trigger(this.get()); - } else { - this.domElement.classList.add("hidden"); - this.onHidden.trigger(this.get()); - } - } - - get enabled() { - return this._enabled; - } - - set enabled(value: boolean) { - this._enabled = value; - if (value) { - this.onEnabled.trigger(this.get()); - } else { - this.onDisabled.trigger(this.get()); - } - // this.onVisibilityChanged.trigger(value); - } - - get hasElements() { - return this.children.length > 0; - } - - private set template(value: string) { - const regex = /id="([^"]+)"/g; - const temp = document.createElement("div"); - temp.innerHTML = value.replace(regex, `id="$1-${this.id}"`); - const newElement = temp.firstElementChild as T; - newElement.id = this.id; - this.domElement = newElement; - temp.remove(); - } - - constructor(components: Components, template?: string, id?: string) { - super(components); - this._components = components; - this.id = id ?? generateUUID(); - this.template = template ?? "
"; - } - - cleanData() { - this.data = {}; - } - - get(): T { - return this.domElement; - } - - async dispose(onlyChildren = false) { - for (const name in this.slots) { - const slot = this.slots[name]; - if (!slot) continue; - await slot.dispose(); - } - for (const child of this.children) { - await child.dispose(); - this.removeChild(child); - } - for (const name in this.innerElements) { - const element = this.innerElements[name]; - if (element) { - element.remove(); - } - } - if (!onlyChildren) { - if (this._domElement) { - this._domElement.remove(); - } - this.onVisible.reset(); - this.onHidden.reset(); - this.onEnabled.reset(); - this.onDisabled.reset(); - this.innerElements = {}; - this.children = []; - this.slots = {}; - (this.parent as any) = null; - } - await this.onDisposed.trigger(); - this.onDisposed.reset(); - } - - addChild(...items: SimpleUIComponent[]) { - for (const item of items) { - this.children.push(item); - this.domElement.append(item.domElement); - item.parent = this; - } - } - - removeChild(...items: SimpleUIComponent[]) { - for (const item of items) { - item.domElement.remove(); - item.parent = null; - } - const filtered = this.children.filter((child) => !items.includes(child)); - this.children = filtered; - } - - removeFromParent() { - if (!this.parent) return; - this.get().removeAttribute("data-tooeen-slot"); - this.parent.removeChild(this); - } - - getInnerElement(id: string) { - return this.get().querySelector(`#${id}-${this.id}`) as T | null; - } - - setSlot(name: string, uiComponent: SimpleUIComponent) { - const slot = this.get().querySelector(`[data-tooeen-slot="${name}"]`); - if (!slot) - throw new Error( - `Slot ${name} not found. You need to declare it in the UIComponent template using data-tooeen-slot="${name}"` - ); - this.slots[name] = uiComponent; - uiComponent.get().setAttribute("data-tooeen-slot", name); - uiComponent.parent = this; - slot.replaceWith(uiComponent.get()); - this.children.push(uiComponent); - } - - setSlots() { - for (const name in this.slots) { - const component = this.slots[name]; - this.setSlot(name, component); - } - } -} diff --git a/packages/components/src/ui/Spinner/index.html b/packages/components/src/ui/Spinner/index.html deleted file mode 100644 index a5b578549..000000000 --- a/packages/components/src/ui/Spinner/index.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - Tools Component - - - -
- - - - diff --git a/packages/components/src/ui/Spinner/index.ts b/packages/components/src/ui/Spinner/index.ts deleted file mode 100644 index ddb8a8f85..000000000 --- a/packages/components/src/ui/Spinner/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { Components } from "../../core"; - -export class Spinner extends SimpleUIComponent { - name = "Spinner"; - - constructor(components: Components) { - const template = ` -
-
- - Loading... -
-
- `; - - super(components, template); - } -} diff --git a/packages/components/src/ui/TextArea/index.ts b/packages/components/src/ui/TextArea/index.ts deleted file mode 100644 index 76607ceba..000000000 --- a/packages/components/src/ui/TextArea/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { UIManager } from "../UIManager"; - -export class TextArea extends SimpleUIComponent { - name = "TooeenTextArea"; - readonly onChange: Event = new Event(); - - set value(value: string) { - this.innerElements.input.value = value; - this.onChange.trigger(this.value); - } - - get value() { - return this.innerElements.input.value; - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - set placeholder(value: string) { - this.innerElements.input.placeholder = value; - } - - get placeholder() { - return this.innerElements.input.placeholder; - } - - innerElements: { - label: HTMLLabelElement; - input: HTMLInputElement; - }; - - constructor(components: Components) { - const template = ` -
- - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - input: this.getInnerElement("input") as HTMLInputElement, - }; - - this.label = "Tooeen Text Area"; - this.placeholder = "Write something..."; - - this.innerElements.label.setAttribute("for", `input-${this.id}`); - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onChange.reset(); - } -} diff --git a/packages/components/src/ui/TextInput/index.ts b/packages/components/src/ui/TextInput/index.ts deleted file mode 100644 index 24f681ac0..000000000 --- a/packages/components/src/ui/TextInput/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Components } from "../../core"; -import { Event } from "../../base-types"; -import { SimpleUIComponent } from "../SimpleUIComponent"; -import { UIManager } from "../UIManager"; - -export class TextInput extends SimpleUIComponent { - name = "TooeenTextInput"; - readonly onChange: Event = new Event(); - - set value(value: string) { - this.innerElements.input.value = value; - this.onChange.trigger(this.value); - } - - get value() { - return this.innerElements.input.value; - } - - set label(value: string | null) { - this.innerElements.label.textContent = value; - if (value) { - this.innerElements.label.classList.remove("hidden"); - } else { - this.innerElements.label.classList.add("hidden"); - } - } - - get label() { - return this.innerElements.label.textContent; - } - - innerElements: { - label: HTMLLabelElement; - input: HTMLInputElement; - }; - - constructor(components: Components) { - const template = ` -
- - -
- `; - super(components, template); - - this.innerElements = { - label: this.getInnerElement("label") as HTMLLabelElement, - input: this.getInnerElement("input") as HTMLInputElement, - }; - - this.label = "Tooeen Text"; - - this.innerElements.label.setAttribute("for", `input-${this.id}`); - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - this.onChange.reset(); - } -} diff --git a/packages/components/src/ui/ToastNotification/index.html b/packages/components/src/ui/ToastNotification/index.html deleted file mode 100644 index b3ab19b6c..000000000 --- a/packages/components/src/ui/ToastNotification/index.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - Tools Component - - - -
- - - - diff --git a/packages/components/src/ui/ToastNotification/index.ts b/packages/components/src/ui/ToastNotification/index.ts deleted file mode 100644 index 6c0e5825a..000000000 --- a/packages/components/src/ui/ToastNotification/index.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -interface ToastConfig { - message: string; - materialIconName?: string; -} - -export class ToastNotification extends SimpleUIComponent { - name = "ToastNotification"; - duration = 3000; - innerElements: { - icon: HTMLSpanElement; - message: HTMLParagraphElement; - }; - - set materialIcon(name: string | null) { - this.innerElements.icon.textContent = name; - if (name) { - this.innerElements.icon.classList.remove("hidden"); - } else { - this.innerElements.icon.classList.add("hidden"); - } - } - - constructor(components: Components, config: ToastConfig) { - // TODO: Extract icon ui component and reuse it - const template = ` -
- -
- `; - - super(components, template); - - this.innerElements = { - icon: this.getInnerElement("icon") as HTMLSpanElement, - message: this.getInnerElement("message") as HTMLParagraphElement, - }; - - this.domElement.style.zIndex = "9999"; - - this.materialIcon = config.materialIconName ?? "done"; - this.message = config.message; - } - - get message() { - return this.innerElements.message.textContent; - } - - set message(value: string | null) { - this.innerElements.message.textContent = value; - } - - set visible(active: boolean) { - const delay = 200; - if (active) { - super.visible = active; - setTimeout(() => { - this.domElement.style.transform = "translateY(0)"; - this.hideAutomatically(); - }, delay); - } else { - this.domElement.style.transform = "translateY(10rem)"; - setTimeout(() => (super.visible = active), delay); - } - } - - private hideAutomatically() { - setTimeout(() => { - this.visible = false; - }, this.duration); - } -} diff --git a/packages/components/src/ui/ToolbarComponent/index.ts b/packages/components/src/ui/ToolbarComponent/index.ts deleted file mode 100644 index f54426518..000000000 --- a/packages/components/src/ui/ToolbarComponent/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { Button } from "../ButtonComponent"; -import { IContainerPosition } from "../UIManager"; -import { Components } from "../../core/Components"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -interface IToolbarOptions { - name?: string; - position?: IContainerPosition; -} - -type IToolbarDirection = "horizontal" | "vertical"; - -// export class Toolbar extends SimpleUIComponent { -export class Toolbar extends SimpleUIComponent { - name: string; - children: Button[] = []; - - protected _parent: Button | null = null; - - static Class = { - Base: `flex shadow-md w-fit h-fit gap-x-2 gap-y-2 p-2 text-white rounded pointer-events-auto backdrop-blur-xl - bg-ifcjs-100 z-50`, - }; - - private _position!: IContainerPosition; - - set visible(visible: boolean) { - this._visible = visible && this.hasElements; - if (visible && this.hasElements) { - this.domElement.classList.remove("hidden"); - this.onVisible.trigger(this.get()); - } else { - this.domElement.classList.add("hidden"); - this.onHidden.trigger(this.get()); - } - } - - get visible() { - return this._visible; - } - - set enabled(enabled: boolean) { - this.closeMenus(); - this.children.forEach((button) => { - button.enabled = enabled; - button.menu.enabled = enabled; - }); - this._enabled = enabled; - } - - set position(position: IContainerPosition) { - this._position = position; - this.updateElements(); - } - - get position() { - return this._position; - } - - constructor(components: Components, options?: IToolbarOptions) { - const _options: IToolbarOptions = { - position: "bottom", - ...options, - }; - const template = ` -
- `; - super(components, template); - this.name = _options.name ?? "Toolbar"; - this.position = _options.position ?? "bottom"; - this.visible = true; - } - - get hasElements() { - return this.children.length > 0; - } - - get(): HTMLDivElement { - return this.domElement; - } - - addChild(...button: Button[]) { - button.forEach((btn) => { - btn.parent = this; - this.children.push(btn); - this.domElement.append(btn.domElement); - }); - this._components.ui.updateToolbars(); - } - - updateElements() { - this.children.forEach((button) => (button.parent = this)); - } - - closeMenus() { - this.children.forEach((button) => button.closeMenus()); - } - - setDirection(direction: IToolbarDirection = "horizontal") { - this.domElement.classList.remove("flex-col"); - const directionClass = direction === "horizontal" ? ["flex"] : ["flex-col"]; - this.domElement.classList.add(...directionClass); - } -} diff --git a/packages/components/src/ui/TreeView/index.ts b/packages/components/src/ui/TreeView/index.ts deleted file mode 100644 index be5cd017d..000000000 --- a/packages/components/src/ui/TreeView/index.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Event } from "../../base-types/base-types"; -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -export class TreeView extends SimpleUIComponent { - private _expanded: boolean = true; - - readonly onExpand = new Event(); - readonly onCollapse = new Event(); - readonly onClick = new Event(); - - set description(value: string | null) { - const element = this.innerElements.description; - element.textContent = value; - if (value) { - element.classList.remove("hidden"); - } else { - element.classList.add("hidden"); - } - } - - get description() { - return this.innerElements.description.textContent; - } - - set title(value: string | null) { - this.innerElements.title.textContent = value; - } - - get title() { - return this.innerElements.title.textContent; - } - - set materialIcon(name: string) { - this.innerElements.expandBtn.textContent = name; - } - - get expanded() { - return this._expanded; - } - - set expanded(expanded: boolean) { - this._expanded = expanded; - this.slots.content.visible = expanded; - if (expanded) { - this.onExpand.trigger(); - this.innerElements.titleContainer.classList.add("bg-ifcjs-120"); - this.materialIcon = "arrow_drop_down"; - } else { - this.onCollapse.trigger(); - this.innerElements.titleContainer.classList.remove("bg-ifcjs-120"); - this.materialIcon = "arrow_right"; - } - } - - set onmouseover(listener: (e?: MouseEvent) => void) { - this.domElement.onmouseover = (e) => { - e.stopImmediatePropagation(); - listener(e); - }; - } - - innerElements: { - titleContainer: HTMLDivElement; - title: HTMLParagraphElement; - description: HTMLParagraphElement; - expandBtn: HTMLSpanElement; - }; - - slots: { - content: SimpleUIComponent; - titleRight: SimpleUIComponent; - }; - - constructor(components: Components, title?: string) { - const template = ` -
-
-
- -
-

-

-
-
-
-
-
-
- `; - super(components, template); - - this.domElement.onclick = async (e) => { - e.stopImmediatePropagation(); - await this.onClick.trigger(e as PointerEvent); - }; - - this.innerElements = { - titleContainer: this.getInnerElement( - "title-container" - ) as HTMLParagraphElement, - title: this.getInnerElement("title") as HTMLParagraphElement, - description: this.getInnerElement("description") as HTMLParagraphElement, - expandBtn: this.getInnerElement("expandBtn") as HTMLSpanElement, - }; - - this.innerElements.expandBtn.onclick = () => this.toggle(); - - this.slots = { - content: new SimpleUIComponent( - components, - `
` - ), - titleRight: new SimpleUIComponent(components), - }; - this.setSlots(); - - this.title = title ?? null; - this.collapse(); - } - - async dispose(onlyChildren: boolean = false) { - await super.dispose(onlyChildren); - if (!onlyChildren) { - this.onExpand.reset(); - this.onCollapse.reset(); - } - } - - toggle(deep = false) { - if (deep) { - if (this.expanded) { - this.collapse(); - } else { - this.expand(); - } - } else { - this.expanded = !this.expanded; - } - } - - addChild(...items: SimpleUIComponent[]) { - this.slots.content.addChild(...items); - } - - collapse(deep = true) { - if (!this.expanded) return; - this.expanded = false; - if (!deep) return; - for (const child of this.children) - if (child instanceof TreeView) child.collapse(deep); - } - - expand(deep = true) { - if (this.expanded) return; - this.expanded = true; - if (!deep) return; - for (const child of this.children) - if (child instanceof TreeView) child.expand(deep); - } -} diff --git a/packages/components/src/ui/UIManager/index.html b/packages/components/src/ui/UIManager/index.html deleted file mode 100644 index 4bbfd6ff8..000000000 --- a/packages/components/src/ui/UIManager/index.html +++ /dev/null @@ -1,325 +0,0 @@ - - - - - - - - - - - UI Manager Component - - - -
- - - - diff --git a/packages/components/src/ui/UIManager/index.ts b/packages/components/src/ui/UIManager/index.ts deleted file mode 100644 index a01672e00..000000000 --- a/packages/components/src/ui/UIManager/index.ts +++ /dev/null @@ -1,268 +0,0 @@ -// @ts-ignore -import { createPopper, Instance } from "@popperjs/core/dist/esm"; -import { Component, Disposable, Event } from "../../base-types"; -import { Toolbar } from "../ToolbarComponent"; -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -export type IContainerPosition = "top" | "right" | "bottom" | "left"; - -type IContainerAlingment = "start" | "center" | "end"; - -interface IContainers { - [key: string]: HTMLDivElement; -} - -/** - * A component that handles all UI components. - */ -export class UIManager extends Component implements Disposable { - name: string = "UIManager"; - enabled: boolean = true; - toolbars: Toolbar[] = []; - contextMenu: Toolbar; - - tooltipsEnabled = true; - - children: SimpleUIComponent[] = []; - - /** {@link Disposable.onDisposed} */ - readonly onDisposed = new Event(); - - private _components: Components; - private _contextMenuContainer: HTMLDivElement; - private _mouseMoved = false; - private _mouseDown = false; - private _popperInstance: Instance; - - private _containers: IContainers = { - top: document.createElement("div"), - right: document.createElement("div"), - bottom: document.createElement("div"), - left: document.createElement("div"), - }; - - // TODO: Does this need to be here? - static Class = { - Label: "block leading-6 text-gray-400 text-sm my-0", - }; - - get viewerContainer() { - return this._components.renderer.get().domElement - .parentElement as HTMLElement; - } - - constructor(components: Components) { - super(components); - this._components = components; - - this.contextMenu = new Toolbar(components); - this.contextMenu.setDirection("vertical"); - this.contextMenu.position = "left"; - - this._contextMenuContainer = document.createElement("div"); - this._contextMenuContainer.style.position = "absolute"; - this._contextMenuContainer.append(this.contextMenu.domElement); - - this._popperInstance = createPopper( - this._contextMenuContainer, - this.contextMenu.domElement, - { - placement: "bottom-start", - modifiers: [ - { - name: "preventOverflow", - options: { - boundary: Object.values(this._containers), - }, - }, - ], - } - ); - - const containerClasses: Record = { - top: ["top-0", "pt-4"], - right: ["top-0", "right-0", "pr-4"], - bottom: ["bottom-0", "pb-4"], - left: ["top-0", "left-0", "pl-4"], - }; - - for (const id in this._containers) { - const container = this._containers[id]; - container.className = - "absolute flex gap-y-3 gap-x-3 pointer-events-none p-4"; - container.classList.add(...containerClasses[id]); - container.id = `${id}-toolbar-container`; - this.setContainerAlignment(id as IContainerPosition, "center"); - } - - const hContainerClass = ["flex-row", "w-full"]; - const vContainerClass = ["flex-column", "h-full"]; - this._containers.top.classList.add(...hContainerClass); - this._containers.right.classList.add(...vContainerClass); - this._containers.bottom.classList.add(...hContainerClass); - this._containers.left.classList.add(...vContainerClass); - } - - get() { - return this.toolbars; - } - - async dispose() { - this.setupEvents(false); - for (const name in this._containers) { - const element = this._containers[name]; - element.remove(); - } - for (const toolbar of this.toolbars) { - await toolbar.dispose(); - } - for (const child of this.children) { - await child.dispose(); - } - this._popperInstance.destroy(); - this.children = []; - await this.contextMenu.dispose(); - this._containers = {}; - this._contextMenuContainer.remove(); - (this._popperInstance as any) = null; - (this._components as any) = null; - (this.contextMenu as any) = null; - (this._contextMenuContainer as any) = null; - await this.onDisposed.trigger(); - this.onDisposed.reset(); - } - - async init() { - this.setupEvents(true); - - this.viewerContainer.append( - this._containers.top, - this._containers.right, - this._containers.bottom, - this._containers.left, - this._contextMenuContainer - ); - - this.viewerContainer.style.position = "relative"; - this.viewerContainer.classList.add("obc-viewer"); - - // Get material icons - const materialIconsLink = document.createElement("link"); - materialIconsLink.rel = "stylesheet"; - materialIconsLink.href = - "https://fonts.googleapis.com/icon?family=Material+Icons"; - - // Get openbim-components styles - const fetchResponse = await fetch( - "https://raw.githubusercontent.com/ThatOpen/engine_components/main/resources/styles.css" - ); - const componentsCSS = await fetchResponse.text(); - const styleElement = document.createElement("style"); - styleElement.id = "openbim-components"; - styleElement.textContent = componentsCSS; - - const firstLinkTag = document.head.querySelector("link"); - if (firstLinkTag) { - // Inserting the styles before any link tag makes sure the developer can override the library styles - document.head.insertBefore(materialIconsLink, firstLinkTag); - document.head.insertBefore(styleElement, firstLinkTag); - } else { - document.head.append(materialIconsLink, styleElement); - } - } - - add(...uiComponents: SimpleUIComponent[]) { - for (const component of uiComponents) { - this.children.push(component); - this.viewerContainer.append(component.domElement); - } - } - - closeMenus() { - this.toolbars.forEach((toolbar) => toolbar.closeMenus()); - this.contextMenu.closeMenus(); - } - - setContainerAlignment( - container: IContainerPosition, - alingment: IContainerAlingment - ) { - this._containers[container].style.justifyContent = alingment; - this._containers[container].style.alignItems = alingment; - } - - addToolbar(...toolbar: Toolbar[]) { - toolbar.forEach((tlbr) => { - const container = this._containers[tlbr.position]; - if (!container) { - return; - } - container.append(tlbr.domElement); - this.toolbars.push(tlbr); - }); - this.updateToolbars(); - } - - updateToolbars() { - this.toolbars.forEach((toolbar) => { - toolbar.visible = true; - toolbar.updateElements(); - if (toolbar.position === "bottom" || toolbar.position === "top") { - toolbar.setDirection("horizontal"); - } else { - toolbar.setDirection("vertical"); - } - }); - } - - private setupEvents(active: boolean) { - if (active) { - this.viewerContainer.addEventListener("mouseup", this.onMouseUp); - this.viewerContainer.addEventListener("mousedown", this.onMouseDown); - this.viewerContainer.addEventListener("mousemove", this.onMouseMoved); - this.viewerContainer.addEventListener("contextmenu", this.onContextMenu); - } else { - this.viewerContainer.removeEventListener("mouseup", this.onMouseUp); - this.viewerContainer.removeEventListener("mousedown", this.onMouseDown); - this.viewerContainer.removeEventListener("mousemove", this.onMouseMoved); - this.viewerContainer.removeEventListener( - "contextmenu", - this.onContextMenu - ); - } - } - - private onMouseUp = () => { - this._mouseDown = false; - }; - - private onMouseMoved = () => { - if (this._mouseDown) { - this._mouseMoved = true; - } - }; - - private onMouseDown = (event: MouseEvent) => { - this._mouseDown = true; - const canvas = this._components.renderer.get().domElement; - if (event.target === canvas) { - this.closeMenus(); - this.contextMenu.visible = false; - } - }; - - private onContextMenu = (event: MouseEvent) => { - if (this._mouseMoved) { - this._mouseMoved = false; - return; - } - event.preventDefault(); - event.stopImmediatePropagation(); - this.closeMenus(); - this._contextMenuContainer.style.left = `${event.offsetX}px`; - this._contextMenuContainer.style.top = `${event.offsetY}px`; - this.contextMenu.visible = true; - this._popperInstance.update(); - }; -} diff --git a/packages/components/src/ui/UIManager/top.css b/packages/components/src/ui/UIManager/top.css deleted file mode 100644 index cbd2b9e6d..000000000 --- a/packages/components/src/ui/UIManager/top.css +++ /dev/null @@ -1,157 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&display=swap'); - -:root { - --primary-color: #BCF124; - --secondary-color: #6528D7; - /* TODO: Probably this needs to be called background-color */ - --secondary-color-100: #000000bb; - --secondary-color-120: #1a2128; -} - -/* Tailwind Base Directive */ -/* @tailwind base; */ -*, -::before, -::after { - box-sizing: border-box; - border-width: 0; - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; -} - -::before, -::after { - --tw-content: ''; -} - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - font-feature-settings: inherit; - font-variation-settings: inherit; -} - -::backdrop{ - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; -} - -/* Tailwind Components Directive */ -@tailwind components; - -/* Tailwind Utilities Directive */ -@tailwind utilities; - -.material-icons.md-18 { font-size: 18px; } -.material-icons.md-16 { font-size: 16px; } - -html { - font-family: 'Plus Jakarta Sans', sans-serif; -} - -::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -::-webkit-scrollbar-track { - background-color: var(--secondary-color-100); -} - -::-webkit-scrollbar-thumb { - background-color: var(--secondary-color); - border-radius: 9999px; -} \ No newline at end of file diff --git a/packages/components/src/ui/UIPool/index.ts b/packages/components/src/ui/UIPool/index.ts deleted file mode 100644 index 9c2f97f83..000000000 --- a/packages/components/src/ui/UIPool/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component } from "../../base-types"; -import { Components } from "../../core"; -import { SimpleUIComponent } from "../SimpleUIComponent"; - -type UIClass = new ( - components: Components, - ...args: any[] -) => T; - -export class UIPool extends Component { - name: string = "UIPool"; - enabled: boolean = true; - list: T[] = []; - - private _components: Components; - private _uiClass: UIClass; - - constructor(components: Components, uiClass: UIClass) { - super(components); - this._components = components; - this._uiClass = uiClass; - } - - return(element: T) { - if (element.parent) { - element.parent.removeChild(element); - } - this.list.push(element); - } - - get() { - if (this.list.length > 0) { - return this.list.pop()!; - } - return new this._uiClass(this._components); - } -} diff --git a/packages/components/src/ui/index.ts b/packages/components/src/ui/index.ts deleted file mode 100644 index 0f689bdfb..000000000 --- a/packages/components/src/ui/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export * from "./ButtonComponent"; -export * from "./ToolbarComponent"; -export * from "./TreeView"; -export * from "./UIManager"; -export * from "./SimpleUIComponent"; -export * from "./SimpleUICard"; -export * from "./FloatingWindow"; -export * from "./Dropdown"; -export * from "./TextInput"; -export * from "./CheckboxInput"; -export * from "./ColorInput"; -export * from "./RangeInput"; -export * from "./Canvas"; -export * from "./DragAndDropInput"; -export * from "./Spinner"; -export * from "./ToastNotification"; -export * from "./TextArea"; -export * from "./CommandsMenu"; -export * from "./Drawer"; -export * from "./Modal"; diff --git a/packages/components/tailwind.config.js b/packages/components/tailwind.config.js deleted file mode 100644 index c9eb042be..000000000 --- a/packages/components/tailwind.config.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = { - content: ['./src/**/*.html', './src/**/*.{js,ts}'], - important: ".obc-viewer", - theme: { - extend: { - colors: { - white: "#F2F2F2", - black: "#0D0D0D", - error: "#FF5252", - warning: "#FB8C00", - success: "#4CAF50", - ifcjs: { - 100: "var(--secondary-color-100)", - 120: "var(--secondary-color-120)", - 200: "var(--primary-color)", - 300: "var(--secondary-color)" - } - }, - borderWidth: { - '1': '1px', - '3': '3px', - }, - fontSize: { - 'xs': ['12px', { lineHeight: '1rem' }], - 'sm': ['14px', { lineHeight: '1.25rem' }], - 'base': ['16px', { lineHeight: '1.5rem' }], - 'lg': ['18px', { lineHeight: '1.75rem' }], - 'xl': ['20px', { lineHeight: '1.75rem' }], - '2xl': ['22px', { lineHeight: '2rem' }], - '3xl': ['24px', { lineHeight: '2.25rem' }], - '4xl': ['26px', { lineHeight: '2.5rem' }], - '5xl': ['28px', { lineHeight: '1' }], - '6xl': ['30px', { lineHeight: '1' }], - '7xl': ['32px', { lineHeight: '1' }], - '8xl': ['34px', { lineHeight: '1' }], - '9xl': ['36px', { lineHeight: '1' }], - }, - } - } -}; \ No newline at end of file diff --git a/packages/components/src/annotation/ArrowAnnotation/index.ts b/temp/annotation/ArrowAnnotation/index.ts similarity index 100% rename from packages/components/src/annotation/ArrowAnnotation/index.ts rename to temp/annotation/ArrowAnnotation/index.ts diff --git a/packages/components/src/annotation/CircleAnnotation/index.ts b/temp/annotation/CircleAnnotation/index.ts similarity index 100% rename from packages/components/src/annotation/CircleAnnotation/index.ts rename to temp/annotation/CircleAnnotation/index.ts diff --git a/packages/components/src/annotation/DrawManager/example.html b/temp/annotation/DrawManager/example.html similarity index 100% rename from packages/components/src/annotation/DrawManager/example.html rename to temp/annotation/DrawManager/example.html diff --git a/packages/components/src/annotation/DrawManager/example.ts b/temp/annotation/DrawManager/example.ts similarity index 100% rename from packages/components/src/annotation/DrawManager/example.ts rename to temp/annotation/DrawManager/example.ts diff --git a/packages/components/src/annotation/DrawManager/index.ts b/temp/annotation/DrawManager/index.ts similarity index 100% rename from packages/components/src/annotation/DrawManager/index.ts rename to temp/annotation/DrawManager/index.ts diff --git a/packages/components/src/annotation/RectangleAnnotation/index.ts b/temp/annotation/RectangleAnnotation/index.ts similarity index 100% rename from packages/components/src/annotation/RectangleAnnotation/index.ts rename to temp/annotation/RectangleAnnotation/index.ts diff --git a/packages/components/src/annotation/SVGArrow/index.ts b/temp/annotation/SVGArrow/index.ts similarity index 100% rename from packages/components/src/annotation/SVGArrow/index.ts rename to temp/annotation/SVGArrow/index.ts diff --git a/packages/components/src/annotation/SVGCircle/index.ts b/temp/annotation/SVGCircle/index.ts similarity index 100% rename from packages/components/src/annotation/SVGCircle/index.ts rename to temp/annotation/SVGCircle/index.ts diff --git a/packages/components/src/annotation/SVGRectangle/index.ts b/temp/annotation/SVGRectangle/index.ts similarity index 100% rename from packages/components/src/annotation/SVGRectangle/index.ts rename to temp/annotation/SVGRectangle/index.ts diff --git a/packages/components/src/annotation/SVGText/index.ts b/temp/annotation/SVGText/index.ts similarity index 100% rename from packages/components/src/annotation/SVGText/index.ts rename to temp/annotation/SVGText/index.ts diff --git a/packages/components/src/annotation/TextAnnotation/index.ts b/temp/annotation/TextAnnotation/index.ts similarity index 100% rename from packages/components/src/annotation/TextAnnotation/index.ts rename to temp/annotation/TextAnnotation/index.ts diff --git a/packages/components/src/annotation/index.ts b/temp/annotation/index.ts similarity index 100% rename from packages/components/src/annotation/index.ts rename to temp/annotation/index.ts diff --git a/packages/components/src/base-types/base-raycaster.ts b/temp/base-types/base-raycaster.ts similarity index 100% rename from packages/components/src/base-types/base-raycaster.ts rename to temp/base-types/base-raycaster.ts diff --git a/packages/components/src/base-types/base-renderer.ts b/temp/base-types/base-renderer.ts similarity index 100% rename from packages/components/src/base-types/base-renderer.ts rename to temp/base-types/base-renderer.ts diff --git a/packages/components/src/base-types/base-svg-annotation.ts b/temp/base-types/base-svg-annotation.ts similarity index 100% rename from packages/components/src/base-types/base-svg-annotation.ts rename to temp/base-types/base-svg-annotation.ts diff --git a/packages/components/src/base-types/index.ts b/temp/base-types/index.ts similarity index 100% rename from packages/components/src/base-types/index.ts rename to temp/base-types/index.ts diff --git a/packages/components/src/base-types/mouse.ts b/temp/base-types/mouse.ts similarity index 100% rename from packages/components/src/base-types/mouse.ts rename to temp/base-types/mouse.ts diff --git a/packages/components/src/base-types/ui-element.ts b/temp/base-types/ui-element.ts similarity index 100% rename from packages/components/src/base-types/ui-element.ts rename to temp/base-types/ui-element.ts diff --git a/packages/components/src/civil/Civil3DNavigator/example.html b/temp/civil/Civil3DNavigator/example.html similarity index 100% rename from packages/components/src/civil/Civil3DNavigator/example.html rename to temp/civil/Civil3DNavigator/example.html diff --git a/packages/components/src/civil/Civil3DNavigator/example.ts b/temp/civil/Civil3DNavigator/example.ts similarity index 100% rename from packages/components/src/civil/Civil3DNavigator/example.ts rename to temp/civil/Civil3DNavigator/example.ts diff --git a/packages/components/src/civil/Civil3DNavigator/index.ts b/temp/civil/Civil3DNavigator/index.ts similarity index 100% rename from packages/components/src/civil/Civil3DNavigator/index.ts rename to temp/civil/Civil3DNavigator/index.ts diff --git a/packages/components/src/civil/CivilCrossSectionNavigator/example.html b/temp/civil/CivilCrossSectionNavigator/example.html similarity index 100% rename from packages/components/src/civil/CivilCrossSectionNavigator/example.html rename to temp/civil/CivilCrossSectionNavigator/example.html diff --git a/packages/components/src/civil/CivilCrossSectionNavigator/example.ts b/temp/civil/CivilCrossSectionNavigator/example.ts similarity index 100% rename from packages/components/src/civil/CivilCrossSectionNavigator/example.ts rename to temp/civil/CivilCrossSectionNavigator/example.ts diff --git a/packages/components/src/civil/CivilCrossSectionNavigator/index.ts b/temp/civil/CivilCrossSectionNavigator/index.ts similarity index 100% rename from packages/components/src/civil/CivilCrossSectionNavigator/index.ts rename to temp/civil/CivilCrossSectionNavigator/index.ts diff --git a/packages/components/src/civil/CivilElevationNavigator/index.ts b/temp/civil/CivilElevationNavigator/index.ts similarity index 100% rename from packages/components/src/civil/CivilElevationNavigator/index.ts rename to temp/civil/CivilElevationNavigator/index.ts diff --git a/packages/components/src/civil/CivilFloatingWindow/index.ts b/temp/civil/CivilFloatingWindow/index.ts similarity index 100% rename from packages/components/src/civil/CivilFloatingWindow/index.ts rename to temp/civil/CivilFloatingWindow/index.ts diff --git a/packages/components/src/civil/CivilNavigator/index.ts b/temp/civil/CivilNavigator/index.ts similarity index 100% rename from packages/components/src/civil/CivilNavigator/index.ts rename to temp/civil/CivilNavigator/index.ts diff --git a/packages/components/src/civil/CivilNavigator/src/curve-highlighter.ts b/temp/civil/CivilNavigator/src/curve-highlighter.ts similarity index 100% rename from packages/components/src/civil/CivilNavigator/src/curve-highlighter.ts rename to temp/civil/CivilNavigator/src/curve-highlighter.ts diff --git a/packages/components/src/civil/CivilNavigator/src/kp-manager.ts b/temp/civil/CivilNavigator/src/kp-manager.ts similarity index 100% rename from packages/components/src/civil/CivilNavigator/src/kp-manager.ts rename to temp/civil/CivilNavigator/src/kp-manager.ts diff --git a/packages/components/src/civil/CivilPlanNavigator/example.html b/temp/civil/CivilPlanNavigator/example.html similarity index 100% rename from packages/components/src/civil/CivilPlanNavigator/example.html rename to temp/civil/CivilPlanNavigator/example.html diff --git a/packages/components/src/civil/CivilPlanNavigator/example.ts b/temp/civil/CivilPlanNavigator/example.ts similarity index 100% rename from packages/components/src/civil/CivilPlanNavigator/example.ts rename to temp/civil/CivilPlanNavigator/example.ts diff --git a/packages/components/src/civil/CivilPlanNavigator/index.ts b/temp/civil/CivilPlanNavigator/index.ts similarity index 100% rename from packages/components/src/civil/CivilPlanNavigator/index.ts rename to temp/civil/CivilPlanNavigator/index.ts diff --git a/packages/components/src/civil/CivilPlanNavigator/src/plan-highlighter.ts b/temp/civil/CivilPlanNavigator/src/plan-highlighter.ts similarity index 100% rename from packages/components/src/civil/CivilPlanNavigator/src/plan-highlighter.ts rename to temp/civil/CivilPlanNavigator/src/plan-highlighter.ts diff --git a/packages/components/src/civil/index.ts b/temp/civil/index.ts similarity index 100% rename from packages/components/src/civil/index.ts rename to temp/civil/index.ts diff --git a/packages/components/src/core/MaterialManager/example.html b/temp/core/MaterialManager/example.html similarity index 100% rename from packages/components/src/core/MaterialManager/example.html rename to temp/core/MaterialManager/example.html diff --git a/packages/components/src/core/MaterialManager/example.ts b/temp/core/MaterialManager/example.ts similarity index 100% rename from packages/components/src/core/MaterialManager/example.ts rename to temp/core/MaterialManager/example.ts diff --git a/packages/components/src/core/MaterialManager/index.ts b/temp/core/MaterialManager/index.ts similarity index 100% rename from packages/components/src/core/MaterialManager/index.ts rename to temp/core/MaterialManager/index.ts diff --git a/packages/components/src/core/ScreenCuller/example.html b/temp/core/ScreenCuller/example.html similarity index 100% rename from packages/components/src/core/ScreenCuller/example.html rename to temp/core/ScreenCuller/example.html diff --git a/packages/components/src/core/ScreenCuller/example.ts b/temp/core/ScreenCuller/example.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/example.ts rename to temp/core/ScreenCuller/example.ts diff --git a/packages/components/src/core/ScreenCuller/index.ts b/temp/core/ScreenCuller/index.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/index.ts rename to temp/core/ScreenCuller/index.ts diff --git a/packages/components/src/core/ScreenCuller/src/culler-renderer.ts b/temp/core/ScreenCuller/src/culler-renderer.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/src/culler-renderer.ts rename to temp/core/ScreenCuller/src/culler-renderer.ts diff --git a/packages/components/src/core/ScreenCuller/src/index.ts b/temp/core/ScreenCuller/src/index.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/src/index.ts rename to temp/core/ScreenCuller/src/index.ts diff --git a/packages/components/src/core/ScreenCuller/src/mesh-culler-renderer.ts b/temp/core/ScreenCuller/src/mesh-culler-renderer.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/src/mesh-culler-renderer.ts rename to temp/core/ScreenCuller/src/mesh-culler-renderer.ts diff --git a/packages/components/src/core/ScreenCuller/src/screen-culler-helper.ts b/temp/core/ScreenCuller/src/screen-culler-helper.ts similarity index 100% rename from packages/components/src/core/ScreenCuller/src/screen-culler-helper.ts rename to temp/core/ScreenCuller/src/screen-culler-helper.ts diff --git a/packages/components/src/core/Simple2DMarker/index.ts b/temp/core/Simple2DMarker/index.ts similarity index 100% rename from packages/components/src/core/Simple2DMarker/index.ts rename to temp/core/Simple2DMarker/index.ts diff --git a/packages/components/src/core/Simple2DMarker/src/marker-manager.ts b/temp/core/Simple2DMarker/src/marker-manager.ts similarity index 100% rename from packages/components/src/core/Simple2DMarker/src/marker-manager.ts rename to temp/core/Simple2DMarker/src/marker-manager.ts diff --git a/packages/components/src/core/Simple2DScene/example.html b/temp/core/Simple2DScene/example.html similarity index 100% rename from packages/components/src/core/Simple2DScene/example.html rename to temp/core/Simple2DScene/example.html diff --git a/packages/components/src/core/Simple2DScene/example.ts b/temp/core/Simple2DScene/example.ts similarity index 100% rename from packages/components/src/core/Simple2DScene/example.ts rename to temp/core/Simple2DScene/example.ts diff --git a/packages/components/src/core/Simple2DScene/index.ts b/temp/core/Simple2DScene/index.ts similarity index 100% rename from packages/components/src/core/Simple2DScene/index.ts rename to temp/core/Simple2DScene/index.ts diff --git a/packages/components/src/core/Simple2DScene/src/index.ts b/temp/core/Simple2DScene/src/index.ts similarity index 100% rename from packages/components/src/core/Simple2DScene/src/index.ts rename to temp/core/Simple2DScene/src/index.ts diff --git a/packages/components/src/core/Simple2DScene/src/infinite-2d-grid.ts b/temp/core/Simple2DScene/src/infinite-2d-grid.ts similarity index 100% rename from packages/components/src/core/Simple2DScene/src/infinite-2d-grid.ts rename to temp/core/Simple2DScene/src/infinite-2d-grid.ts diff --git a/packages/components/src/core/SimpleCamera/index.ts b/temp/core/SimpleCamera/index.ts similarity index 100% rename from packages/components/src/core/SimpleCamera/index.ts rename to temp/core/SimpleCamera/index.ts diff --git a/packages/components/src/core/SimpleClipper/example.html b/temp/core/SimpleClipper/example.html similarity index 100% rename from packages/components/src/core/SimpleClipper/example.html rename to temp/core/SimpleClipper/example.html diff --git a/packages/components/src/core/SimpleClipper/example.ts b/temp/core/SimpleClipper/example.ts similarity index 100% rename from packages/components/src/core/SimpleClipper/example.ts rename to temp/core/SimpleClipper/example.ts diff --git a/packages/components/src/core/SimpleClipper/index.ts b/temp/core/SimpleClipper/index.ts similarity index 100% rename from packages/components/src/core/SimpleClipper/index.ts rename to temp/core/SimpleClipper/index.ts diff --git a/packages/components/src/core/SimpleClipper/simple-plane.ts b/temp/core/SimpleClipper/simple-plane.ts similarity index 100% rename from packages/components/src/core/SimpleClipper/simple-plane.ts rename to temp/core/SimpleClipper/simple-plane.ts diff --git a/packages/components/src/core/SimpleGrid/index.ts b/temp/core/SimpleGrid/index.ts similarity index 100% rename from packages/components/src/core/SimpleGrid/index.ts rename to temp/core/SimpleGrid/index.ts diff --git a/packages/components/src/core/SimpleRaycaster/example.html b/temp/core/SimpleRaycaster/example.html similarity index 100% rename from packages/components/src/core/SimpleRaycaster/example.html rename to temp/core/SimpleRaycaster/example.html diff --git a/packages/components/src/core/SimpleRaycaster/example.ts b/temp/core/SimpleRaycaster/example.ts similarity index 100% rename from packages/components/src/core/SimpleRaycaster/example.ts rename to temp/core/SimpleRaycaster/example.ts diff --git a/packages/components/src/core/SimpleRaycaster/index.ts b/temp/core/SimpleRaycaster/index.ts similarity index 100% rename from packages/components/src/core/SimpleRaycaster/index.ts rename to temp/core/SimpleRaycaster/index.ts diff --git a/temp/core/SimpleRenderer/index.ts b/temp/core/SimpleRenderer/index.ts new file mode 100644 index 000000000..6b9bdf477 --- /dev/null +++ b/temp/core/SimpleRenderer/index.ts @@ -0,0 +1,176 @@ +import * as THREE from "three"; +import { CSS2DRenderer } from "three/examples/jsm/renderers/CSS2DRenderer.js"; +import { + Event, + Disposable, + Updateable, + Resizeable, + BaseRenderer, +} from "../../base-types"; +import { Components } from "../Components"; + +/** + * A basic renderer capable of rendering 3D and 2D objects + * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D) and + * [CSS2DObjects](https://threejs.org/docs/#examples/en/renderers/CSS2DRenderer) + * respectively). + */ +export class SimpleRenderer + extends BaseRenderer + implements Disposable, Updateable, Resizeable +{ + /** {@link Component.enabled} */ + enabled = true; + + /** The HTML container of the THREE.js canvas where the scene is rendered. */ + container: HTMLElement | null; + + /** {@link Disposable.onDisposed} */ + readonly onDisposed = new Event(); + + /** {@link Updateable.onBeforeUpdate} */ + readonly onBeforeUpdate = new Event(); + + /** {@link Updateable.onAfterUpdate} */ + readonly onAfterUpdate = new Event(); + + protected _renderer2D = new CSS2DRenderer(); + protected _renderer: THREE.WebGLRenderer; + protected _canvas: HTMLCanvasElement; + protected _parameters?: Partial; + + overrideScene?: THREE.Scene; + overrideCamera?: THREE.Camera; + + constructor( + components: Components, + container?: HTMLElement, + parameters?: Partial + ) { + super(components); + + this.container = container || null; + this._parameters = parameters; + + this._renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true, + ...parameters, + }); + + this._renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); + this.setupRenderers(); + this.setupEvents(true); + this.resize(); + + this._canvas = this._renderer.domElement; + + const context = this._renderer.getContext(); + const { canvas } = context; + canvas.addEventListener("webglcontextlost", this.onContextLost, false); + canvas.addEventListener("webglcontextrestored", this.onContextBack, false); + } + + /** {@link Component.get} */ + get() { + return this._renderer; + } + + /** {@link Updateable.update} */ + async update() { + if (!this.enabled) return; + await this.onBeforeUpdate.trigger(this); + const scene = this.overrideScene || this.components.scene.get(); + const camera = this.overrideCamera || this.components.camera.get(); + if (!scene || !camera) return; + this._renderer.render(scene, camera); + this._renderer2D.render(scene, camera); + await this.onAfterUpdate.trigger(this); + } + + /** {@link Disposable.dispose} */ + async dispose() { + this.enabled = false; + this.setupEvents(false); + this._renderer.domElement.remove(); + this._renderer.dispose(); + this._renderer2D.domElement.remove(); + this.onResize.reset(); + this.onAfterUpdate.reset(); + this.onBeforeUpdate.reset(); + await this.onDisposed.trigger(); + this.onDisposed.reset(); + } + + /** {@link Resizeable.getSize}. */ + getSize() { + return new THREE.Vector2( + this._renderer.domElement.clientWidth, + this._renderer.domElement.clientHeight + ); + } + + /** {@link Resizeable.resize}. */ + resize = (size?: THREE.Vector2) => { + this.updateContainer(); + if (!this.container) { + return; + } + const width = size ? size.x : this.container.clientWidth; + const height = size ? size.y : this.container.clientHeight; + this._renderer.setSize(width, height); + this._renderer2D.setSize(width, height); + this.onResize.trigger(size); + }; + + private resizeEvent = () => { + this.resize(); + }; + + setupEvents(active: boolean) { + if (active) { + window.addEventListener("resize", this.resizeEvent); + } else { + window.removeEventListener("resize", this.resizeEvent); + } + } + + private setupRenderers() { + this._renderer.localClippingEnabled = true; + this._renderer2D.domElement.style.position = "absolute"; + this._renderer2D.domElement.style.top = "0px"; + this._renderer2D.domElement.style.pointerEvents = "none"; + if (this.container) { + this.container.appendChild(this._renderer.domElement); + this.container.appendChild(this._renderer2D.domElement); + } + this.updateContainer(); + } + + private onContextLost = (event: any) => { + event.preventDefault(); + this.components.enabled = false; + }; + + private onContextBack = () => { + this._renderer.setRenderTarget(null); + this._renderer.dispose(); + this._renderer = new THREE.WebGLRenderer({ + canvas: this._canvas, + antialias: true, + alpha: true, + ...this._parameters, + }); + this.components.enabled = true; + }; + + private updateContainer() { + if (!this.container) { + const parent = this._renderer.domElement.parentElement; + if (parent) { + this.container = parent; + parent.appendChild(this._renderer2D.domElement); + } + } + } +} diff --git a/packages/components/src/core/SimpleSVGViewport/index.ts b/temp/core/SimpleSVGViewport/index.ts similarity index 100% rename from packages/components/src/core/SimpleSVGViewport/index.ts rename to temp/core/SimpleSVGViewport/index.ts diff --git a/packages/components/src/core/ToolsComponent/example.html b/temp/core/ToolsComponent/example.html similarity index 100% rename from packages/components/src/core/ToolsComponent/example.html rename to temp/core/ToolsComponent/example.html diff --git a/packages/components/src/core/ToolsComponent/example.ts b/temp/core/ToolsComponent/example.ts similarity index 100% rename from packages/components/src/core/ToolsComponent/example.ts rename to temp/core/ToolsComponent/example.ts diff --git a/packages/components/src/core/ToolsComponent/index.ts b/temp/core/ToolsComponent/index.ts similarity index 100% rename from packages/components/src/core/ToolsComponent/index.ts rename to temp/core/ToolsComponent/index.ts diff --git a/temp/core/index.ts b/temp/core/index.ts new file mode 100644 index 000000000..98ed0cf18 --- /dev/null +++ b/temp/core/index.ts @@ -0,0 +1,29 @@ +import { MeshBVH, acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from "three-mesh-bvh"; + +// TODO: Find a better place to put this. +declare module 'three' { + export interface BufferGeometry { + boundsTree?: MeshBVH; + computeBoundsTree: typeof computeBoundsTree; + disposeBoundsTree: typeof disposeBoundsTree; + } + + export interface Mesh { + raycast: typeof acceleratedRaycast; + } +} + +export * from "./Disposer"; +export * from "./SimpleScene"; +export * from "./ToolsComponent"; +export * from "./SimpleRenderer"; +export * from "./SimpleCamera"; +export * from "./SimpleRaycaster"; +export * from "./SimpleGrid"; +export * from "./Components"; +export * from "./SimpleClipper"; +export * from "./ScreenCuller"; +export * from "./SimpleSVGViewport"; +export * from "./Simple2DMarker"; +export * from "./MaterialManager"; +export * from "./Simple2DScene"; diff --git a/packages/components/src/fragments/.DS_Store b/temp/fragments/.DS_Store similarity index 100% rename from packages/components/src/fragments/.DS_Store rename to temp/fragments/.DS_Store diff --git a/packages/components/src/fragments/FragmentBoundingBox/example.html b/temp/fragments/FragmentBoundingBox/example.html similarity index 100% rename from packages/components/src/fragments/FragmentBoundingBox/example.html rename to temp/fragments/FragmentBoundingBox/example.html diff --git a/packages/components/src/fragments/FragmentBoundingBox/example.ts b/temp/fragments/FragmentBoundingBox/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentBoundingBox/example.ts rename to temp/fragments/FragmentBoundingBox/example.ts diff --git a/packages/components/src/fragments/FragmentBoundingBox/index.ts b/temp/fragments/FragmentBoundingBox/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentBoundingBox/index.ts rename to temp/fragments/FragmentBoundingBox/index.ts diff --git a/packages/components/src/fragments/FragmentClassifier/index.ts b/temp/fragments/FragmentClassifier/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentClassifier/index.ts rename to temp/fragments/FragmentClassifier/index.ts diff --git a/packages/components/src/fragments/FragmentClipStyler/example.html b/temp/fragments/FragmentClipStyler/example.html similarity index 100% rename from packages/components/src/fragments/FragmentClipStyler/example.html rename to temp/fragments/FragmentClipStyler/example.html diff --git a/packages/components/src/fragments/FragmentClipStyler/example.ts b/temp/fragments/FragmentClipStyler/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentClipStyler/example.ts rename to temp/fragments/FragmentClipStyler/example.ts diff --git a/packages/components/src/fragments/FragmentClipStyler/index.ts b/temp/fragments/FragmentClipStyler/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentClipStyler/index.ts rename to temp/fragments/FragmentClipStyler/index.ts diff --git a/packages/components/src/fragments/FragmentExploder/example.html b/temp/fragments/FragmentExploder/example.html similarity index 100% rename from packages/components/src/fragments/FragmentExploder/example.html rename to temp/fragments/FragmentExploder/example.html diff --git a/packages/components/src/fragments/FragmentExploder/example.ts b/temp/fragments/FragmentExploder/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentExploder/example.ts rename to temp/fragments/FragmentExploder/example.ts diff --git a/packages/components/src/fragments/FragmentExploder/index.ts b/temp/fragments/FragmentExploder/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentExploder/index.ts rename to temp/fragments/FragmentExploder/index.ts diff --git a/packages/components/src/fragments/FragmentHider/example.html b/temp/fragments/FragmentHider/example.html similarity index 100% rename from packages/components/src/fragments/FragmentHider/example.html rename to temp/fragments/FragmentHider/example.html diff --git a/packages/components/src/fragments/FragmentHider/example.ts b/temp/fragments/FragmentHider/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentHider/example.ts rename to temp/fragments/FragmentHider/example.ts diff --git a/packages/components/src/fragments/FragmentHider/index.ts b/temp/fragments/FragmentHider/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentHider/index.ts rename to temp/fragments/FragmentHider/index.ts diff --git a/packages/components/src/fragments/FragmentHighlighter/example.html b/temp/fragments/FragmentHighlighter/example.html similarity index 100% rename from packages/components/src/fragments/FragmentHighlighter/example.html rename to temp/fragments/FragmentHighlighter/example.html diff --git a/packages/components/src/fragments/FragmentHighlighter/example.ts b/temp/fragments/FragmentHighlighter/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentHighlighter/example.ts rename to temp/fragments/FragmentHighlighter/example.ts diff --git a/packages/components/src/fragments/FragmentHighlighter/index.ts b/temp/fragments/FragmentHighlighter/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentHighlighter/index.ts rename to temp/fragments/FragmentHighlighter/index.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/example.html b/temp/fragments/FragmentIfcLoader/example.html similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/example.html rename to temp/fragments/FragmentIfcLoader/example.html diff --git a/packages/components/src/fragments/FragmentIfcLoader/example.ts b/temp/fragments/FragmentIfcLoader/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/example.ts rename to temp/fragments/FragmentIfcLoader/example.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/index.ts b/temp/fragments/FragmentIfcLoader/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/index.ts rename to temp/fragments/FragmentIfcLoader/index.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/civil-reader.ts b/temp/fragments/FragmentIfcLoader/src/civil-reader.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/civil-reader.ts rename to temp/fragments/FragmentIfcLoader/src/civil-reader.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/ifc-fragment-settings.ts b/temp/fragments/FragmentIfcLoader/src/ifc-fragment-settings.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/ifc-fragment-settings.ts rename to temp/fragments/FragmentIfcLoader/src/ifc-fragment-settings.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/ifc-metadata-reader.ts b/temp/fragments/FragmentIfcLoader/src/ifc-metadata-reader.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/ifc-metadata-reader.ts rename to temp/fragments/FragmentIfcLoader/src/ifc-metadata-reader.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/index.ts b/temp/fragments/FragmentIfcLoader/src/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/index.ts rename to temp/fragments/FragmentIfcLoader/src/index.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/spatial-structure.ts b/temp/fragments/FragmentIfcLoader/src/spatial-structure.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/spatial-structure.ts rename to temp/fragments/FragmentIfcLoader/src/spatial-structure.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/transform-helper.ts b/temp/fragments/FragmentIfcLoader/src/transform-helper.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/transform-helper.ts rename to temp/fragments/FragmentIfcLoader/src/transform-helper.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/types.ts b/temp/fragments/FragmentIfcLoader/src/types.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/types.ts rename to temp/fragments/FragmentIfcLoader/src/types.ts diff --git a/packages/components/src/fragments/FragmentIfcLoader/src/units.ts b/temp/fragments/FragmentIfcLoader/src/units.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcLoader/src/units.ts rename to temp/fragments/FragmentIfcLoader/src/units.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/.DS_Store b/temp/fragments/FragmentIfcStreamer/.DS_Store similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/.DS_Store rename to temp/fragments/FragmentIfcStreamer/.DS_Store diff --git a/packages/components/src/fragments/FragmentIfcStreamer/example.html b/temp/fragments/FragmentIfcStreamer/example.html similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/example.html rename to temp/fragments/FragmentIfcStreamer/example.html diff --git a/packages/components/src/fragments/FragmentIfcStreamer/example.ts b/temp/fragments/FragmentIfcStreamer/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/example.ts rename to temp/fragments/FragmentIfcStreamer/example.ts diff --git a/temp/fragments/FragmentIfcStreamer/index.ts b/temp/fragments/FragmentIfcStreamer/index.ts new file mode 100644 index 000000000..3bd16e178 --- /dev/null +++ b/temp/fragments/FragmentIfcStreamer/index.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/base-types.ts b/temp/fragments/FragmentIfcStreamer/src/base-types.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/base-types.ts rename to temp/fragments/FragmentIfcStreamer/src/base-types.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.ts b/temp/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.ts rename to temp/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.ts b/temp/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.ts rename to temp/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/fragment-stream-loader.ts b/temp/fragments/FragmentIfcStreamer/src/fragment-stream-loader.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/fragment-stream-loader.ts rename to temp/fragments/FragmentIfcStreamer/src/fragment-stream-loader.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/geometry-culler-renderer.ts b/temp/fragments/FragmentIfcStreamer/src/geometry-culler-renderer.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/geometry-culler-renderer.ts rename to temp/fragments/FragmentIfcStreamer/src/geometry-culler-renderer.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/index.ts b/temp/fragments/FragmentIfcStreamer/src/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/index.ts rename to temp/fragments/FragmentIfcStreamer/src/index.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/streamer-db.ts b/temp/fragments/FragmentIfcStreamer/src/streamer-db.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/streamer-db.ts rename to temp/fragments/FragmentIfcStreamer/src/streamer-db.ts diff --git a/packages/components/src/fragments/FragmentIfcStreamer/src/streaming-settings.ts b/temp/fragments/FragmentIfcStreamer/src/streaming-settings.ts similarity index 100% rename from packages/components/src/fragments/FragmentIfcStreamer/src/streaming-settings.ts rename to temp/fragments/FragmentIfcStreamer/src/streaming-settings.ts diff --git a/packages/components/src/fragments/FragmentManager/example.html b/temp/fragments/FragmentManager/example.html similarity index 100% rename from packages/components/src/fragments/FragmentManager/example.html rename to temp/fragments/FragmentManager/example.html diff --git a/packages/components/src/fragments/FragmentManager/example.ts b/temp/fragments/FragmentManager/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentManager/example.ts rename to temp/fragments/FragmentManager/example.ts diff --git a/packages/components/src/fragments/FragmentManager/index.ts b/temp/fragments/FragmentManager/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentManager/index.ts rename to temp/fragments/FragmentManager/index.ts diff --git a/packages/components/src/fragments/FragmentPlans/example.html b/temp/fragments/FragmentPlans/example.html similarity index 100% rename from packages/components/src/fragments/FragmentPlans/example.html rename to temp/fragments/FragmentPlans/example.html diff --git a/packages/components/src/fragments/FragmentPlans/example.ts b/temp/fragments/FragmentPlans/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentPlans/example.ts rename to temp/fragments/FragmentPlans/example.ts diff --git a/packages/components/src/fragments/FragmentPlans/index.ts b/temp/fragments/FragmentPlans/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentPlans/index.ts rename to temp/fragments/FragmentPlans/index.ts diff --git a/packages/components/src/fragments/FragmentPlans/src/plan-objects.ts b/temp/fragments/FragmentPlans/src/plan-objects.ts similarity index 100% rename from packages/components/src/fragments/FragmentPlans/src/plan-objects.ts rename to temp/fragments/FragmentPlans/src/plan-objects.ts diff --git a/packages/components/src/fragments/FragmentPlans/src/types.ts b/temp/fragments/FragmentPlans/src/types.ts similarity index 100% rename from packages/components/src/fragments/FragmentPlans/src/types.ts rename to temp/fragments/FragmentPlans/src/types.ts diff --git a/packages/components/src/fragments/FragmentTree/example.html b/temp/fragments/FragmentTree/example.html similarity index 100% rename from packages/components/src/fragments/FragmentTree/example.html rename to temp/fragments/FragmentTree/example.html diff --git a/packages/components/src/fragments/FragmentTree/example.ts b/temp/fragments/FragmentTree/example.ts similarity index 100% rename from packages/components/src/fragments/FragmentTree/example.ts rename to temp/fragments/FragmentTree/example.ts diff --git a/packages/components/src/fragments/FragmentTree/index.ts b/temp/fragments/FragmentTree/index.ts similarity index 100% rename from packages/components/src/fragments/FragmentTree/index.ts rename to temp/fragments/FragmentTree/index.ts diff --git a/packages/components/src/fragments/FragmentTree/src/tree-item.ts b/temp/fragments/FragmentTree/src/tree-item.ts similarity index 100% rename from packages/components/src/fragments/FragmentTree/src/tree-item.ts rename to temp/fragments/FragmentTree/src/tree-item.ts diff --git a/packages/components/src/fragments/index.ts b/temp/fragments/index.ts similarity index 100% rename from packages/components/src/fragments/index.ts rename to temp/fragments/index.ts diff --git a/packages/components/src/ifc/IfcJsonExporter/index.ts b/temp/ifc/IfcJsonExporter/index.ts similarity index 100% rename from packages/components/src/ifc/IfcJsonExporter/index.ts rename to temp/ifc/IfcJsonExporter/index.ts diff --git a/packages/components/src/ifc/IfcJsonExporter/src/ifc-geometry-types.ts b/temp/ifc/IfcJsonExporter/src/ifc-geometry-types.ts similarity index 100% rename from packages/components/src/ifc/IfcJsonExporter/src/ifc-geometry-types.ts rename to temp/ifc/IfcJsonExporter/src/ifc-geometry-types.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/example.html b/temp/ifc/IfcPropertiesFinder/example.html similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/example.html rename to temp/ifc/IfcPropertiesFinder/example.html diff --git a/packages/components/src/ifc/IfcPropertiesFinder/example.ts b/temp/ifc/IfcPropertiesFinder/example.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/example.ts rename to temp/ifc/IfcPropertiesFinder/example.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/index.ts b/temp/ifc/IfcPropertiesFinder/index.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/index.ts rename to temp/ifc/IfcPropertiesFinder/index.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/src/attribute-query.ts b/temp/ifc/IfcPropertiesFinder/src/attribute-query.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/src/attribute-query.ts rename to temp/ifc/IfcPropertiesFinder/src/attribute-query.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/src/query-builder.ts b/temp/ifc/IfcPropertiesFinder/src/query-builder.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/src/query-builder.ts rename to temp/ifc/IfcPropertiesFinder/src/query-builder.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/src/query-group.ts b/temp/ifc/IfcPropertiesFinder/src/query-group.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/src/query-group.ts rename to temp/ifc/IfcPropertiesFinder/src/query-group.ts diff --git a/packages/components/src/ifc/IfcPropertiesFinder/src/types.ts b/temp/ifc/IfcPropertiesFinder/src/types.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesFinder/src/types.ts rename to temp/ifc/IfcPropertiesFinder/src/types.ts diff --git a/packages/components/src/ifc/IfcPropertiesManager/example.html b/temp/ifc/IfcPropertiesManager/example.html similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/example.html rename to temp/ifc/IfcPropertiesManager/example.html diff --git a/packages/components/src/ifc/IfcPropertiesManager/example.ts b/temp/ifc/IfcPropertiesManager/example.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/example.ts rename to temp/ifc/IfcPropertiesManager/example.ts diff --git a/packages/components/src/ifc/IfcPropertiesManager/index.ts b/temp/ifc/IfcPropertiesManager/index.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/index.ts rename to temp/ifc/IfcPropertiesManager/index.ts diff --git a/packages/components/src/ifc/IfcPropertiesManager/src/entity-actions.ts b/temp/ifc/IfcPropertiesManager/src/entity-actions.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/src/entity-actions.ts rename to temp/ifc/IfcPropertiesManager/src/entity-actions.ts diff --git a/packages/components/src/ifc/IfcPropertiesManager/src/prop-actions.ts b/temp/ifc/IfcPropertiesManager/src/prop-actions.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/src/prop-actions.ts rename to temp/ifc/IfcPropertiesManager/src/prop-actions.ts diff --git a/packages/components/src/ifc/IfcPropertiesManager/src/pset-actions.ts b/temp/ifc/IfcPropertiesManager/src/pset-actions.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesManager/src/pset-actions.ts rename to temp/ifc/IfcPropertiesManager/src/pset-actions.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/example.html b/temp/ifc/IfcPropertiesProcessor/example.html similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/example.html rename to temp/ifc/IfcPropertiesProcessor/example.html diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/example.ts b/temp/ifc/IfcPropertiesProcessor/example.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/example.ts rename to temp/ifc/IfcPropertiesProcessor/example.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/index.ts b/temp/ifc/IfcPropertiesProcessor/index.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/index.ts rename to temp/ifc/IfcPropertiesProcessor/index.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/src/attribute-set.ts b/temp/ifc/IfcPropertiesProcessor/src/attribute-set.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/src/attribute-set.ts rename to temp/ifc/IfcPropertiesProcessor/src/attribute-set.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/src/attribute-tag.ts b/temp/ifc/IfcPropertiesProcessor/src/attribute-tag.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/src/attribute-tag.ts rename to temp/ifc/IfcPropertiesProcessor/src/attribute-tag.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/src/index.ts b/temp/ifc/IfcPropertiesProcessor/src/index.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/src/index.ts rename to temp/ifc/IfcPropertiesProcessor/src/index.ts diff --git a/packages/components/src/ifc/IfcPropertiesProcessor/src/property-tag.ts b/temp/ifc/IfcPropertiesProcessor/src/property-tag.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesProcessor/src/property-tag.ts rename to temp/ifc/IfcPropertiesProcessor/src/property-tag.ts diff --git a/packages/components/src/ifc/IfcPropertiesUtils/index.ts b/temp/ifc/IfcPropertiesUtils/index.ts similarity index 100% rename from packages/components/src/ifc/IfcPropertiesUtils/index.ts rename to temp/ifc/IfcPropertiesUtils/index.ts diff --git a/packages/components/src/ifc/ifc-categories.ts b/temp/ifc/ifc-categories.ts similarity index 100% rename from packages/components/src/ifc/ifc-categories.ts rename to temp/ifc/ifc-categories.ts diff --git a/packages/components/src/ifc/ifc-category-map.ts b/temp/ifc/ifc-category-map.ts similarity index 100% rename from packages/components/src/ifc/ifc-category-map.ts rename to temp/ifc/ifc-category-map.ts diff --git a/packages/components/src/ifc/ifc-elements-map.ts b/temp/ifc/ifc-elements-map.ts similarity index 100% rename from packages/components/src/ifc/ifc-elements-map.ts rename to temp/ifc/ifc-elements-map.ts diff --git a/packages/components/src/ifc/index.ts b/temp/ifc/index.ts similarity index 100% rename from packages/components/src/ifc/index.ts rename to temp/ifc/index.ts diff --git a/packages/components/src/import-export/DXFExporter/example.html b/temp/import-export/DXFExporter/example.html similarity index 100% rename from packages/components/src/import-export/DXFExporter/example.html rename to temp/import-export/DXFExporter/example.html diff --git a/packages/components/src/import-export/DXFExporter/example.ts b/temp/import-export/DXFExporter/example.ts similarity index 100% rename from packages/components/src/import-export/DXFExporter/example.ts rename to temp/import-export/DXFExporter/example.ts diff --git a/packages/components/src/import-export/DXFExporter/index.ts b/temp/import-export/DXFExporter/index.ts similarity index 100% rename from packages/components/src/import-export/DXFExporter/index.ts rename to temp/import-export/DXFExporter/index.ts diff --git a/packages/components/src/import-export/DXFExporter/src/edge-projector.ts b/temp/import-export/DXFExporter/src/edge-projector.ts similarity index 100% rename from packages/components/src/import-export/DXFExporter/src/edge-projector.ts rename to temp/import-export/DXFExporter/src/edge-projector.ts diff --git a/packages/components/src/import-export/DXFExporter/src/edge-utils.ts b/temp/import-export/DXFExporter/src/edge-utils.ts similarity index 100% rename from packages/components/src/import-export/DXFExporter/src/edge-utils.ts rename to temp/import-export/DXFExporter/src/edge-utils.ts diff --git a/packages/components/src/import-export/index.ts b/temp/import-export/index.ts similarity index 100% rename from packages/components/src/import-export/index.ts rename to temp/import-export/index.ts diff --git a/temp/index.ts b/temp/index.ts new file mode 100644 index 000000000..7e2ac1e49 --- /dev/null +++ b/temp/index.ts @@ -0,0 +1,12 @@ +export * from "./base-types"; +export * from "./core"; +export * from "./fragments"; +export * from "./ui"; +export * from "./services"; +export * from "./navigation"; +export * from "./annotation"; +export * from "./utils"; +export * from "./ifc"; +export * from "./measurement"; +export * from "./import-export"; +export * from "./civil"; diff --git a/packages/components/src/measurement/AngleMeasurement/example.html b/temp/measurement/AngleMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/AngleMeasurement/example.html rename to temp/measurement/AngleMeasurement/example.html diff --git a/packages/components/src/measurement/AngleMeasurement/example.ts b/temp/measurement/AngleMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/AngleMeasurement/example.ts rename to temp/measurement/AngleMeasurement/example.ts diff --git a/packages/components/src/measurement/AngleMeasurement/index.ts b/temp/measurement/AngleMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/AngleMeasurement/index.ts rename to temp/measurement/AngleMeasurement/index.ts diff --git a/packages/components/src/measurement/AngleMeasurement/src/index.ts b/temp/measurement/AngleMeasurement/src/index.ts similarity index 100% rename from packages/components/src/measurement/AngleMeasurement/src/index.ts rename to temp/measurement/AngleMeasurement/src/index.ts diff --git a/packages/components/src/measurement/AreaMeasurement/example.html b/temp/measurement/AreaMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/AreaMeasurement/example.html rename to temp/measurement/AreaMeasurement/example.html diff --git a/packages/components/src/measurement/AreaMeasurement/example.ts b/temp/measurement/AreaMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/AreaMeasurement/example.ts rename to temp/measurement/AreaMeasurement/example.ts diff --git a/packages/components/src/measurement/AreaMeasurement/index.ts b/temp/measurement/AreaMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/AreaMeasurement/index.ts rename to temp/measurement/AreaMeasurement/index.ts diff --git a/packages/components/src/measurement/AreaMeasurement/src/index.ts b/temp/measurement/AreaMeasurement/src/index.ts similarity index 100% rename from packages/components/src/measurement/AreaMeasurement/src/index.ts rename to temp/measurement/AreaMeasurement/src/index.ts diff --git a/packages/components/src/measurement/EdgeMeasurement/example.html b/temp/measurement/EdgeMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/EdgeMeasurement/example.html rename to temp/measurement/EdgeMeasurement/example.html diff --git a/packages/components/src/measurement/EdgeMeasurement/example.ts b/temp/measurement/EdgeMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/EdgeMeasurement/example.ts rename to temp/measurement/EdgeMeasurement/example.ts diff --git a/packages/components/src/measurement/EdgeMeasurement/index.ts b/temp/measurement/EdgeMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/EdgeMeasurement/index.ts rename to temp/measurement/EdgeMeasurement/index.ts diff --git a/packages/components/src/measurement/FaceMeasurement/example.html b/temp/measurement/FaceMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/FaceMeasurement/example.html rename to temp/measurement/FaceMeasurement/example.html diff --git a/packages/components/src/measurement/FaceMeasurement/example.ts b/temp/measurement/FaceMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/FaceMeasurement/example.ts rename to temp/measurement/FaceMeasurement/example.ts diff --git a/packages/components/src/measurement/FaceMeasurement/index.ts b/temp/measurement/FaceMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/FaceMeasurement/index.ts rename to temp/measurement/FaceMeasurement/index.ts diff --git a/packages/components/src/measurement/LengthMeasurement/example.html b/temp/measurement/LengthMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/LengthMeasurement/example.html rename to temp/measurement/LengthMeasurement/example.html diff --git a/packages/components/src/measurement/LengthMeasurement/example.ts b/temp/measurement/LengthMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/LengthMeasurement/example.ts rename to temp/measurement/LengthMeasurement/example.ts diff --git a/packages/components/src/measurement/LengthMeasurement/index.ts b/temp/measurement/LengthMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/LengthMeasurement/index.ts rename to temp/measurement/LengthMeasurement/index.ts diff --git a/packages/components/src/measurement/MeasurementUtils/index.ts b/temp/measurement/MeasurementUtils/index.ts similarity index 100% rename from packages/components/src/measurement/MeasurementUtils/index.ts rename to temp/measurement/MeasurementUtils/index.ts diff --git a/packages/components/src/measurement/SimpleDimensionLine/index.ts b/temp/measurement/SimpleDimensionLine/index.ts similarity index 100% rename from packages/components/src/measurement/SimpleDimensionLine/index.ts rename to temp/measurement/SimpleDimensionLine/index.ts diff --git a/packages/components/src/measurement/SimpleDimensionLine/types.ts b/temp/measurement/SimpleDimensionLine/types.ts similarity index 100% rename from packages/components/src/measurement/SimpleDimensionLine/types.ts rename to temp/measurement/SimpleDimensionLine/types.ts diff --git a/packages/components/src/measurement/VolumeMeasurement/example.html b/temp/measurement/VolumeMeasurement/example.html similarity index 100% rename from packages/components/src/measurement/VolumeMeasurement/example.html rename to temp/measurement/VolumeMeasurement/example.html diff --git a/packages/components/src/measurement/VolumeMeasurement/example.ts b/temp/measurement/VolumeMeasurement/example.ts similarity index 100% rename from packages/components/src/measurement/VolumeMeasurement/example.ts rename to temp/measurement/VolumeMeasurement/example.ts diff --git a/packages/components/src/measurement/VolumeMeasurement/index.ts b/temp/measurement/VolumeMeasurement/index.ts similarity index 100% rename from packages/components/src/measurement/VolumeMeasurement/index.ts rename to temp/measurement/VolumeMeasurement/index.ts diff --git a/packages/components/src/measurement/index.ts b/temp/measurement/index.ts similarity index 100% rename from packages/components/src/measurement/index.ts rename to temp/measurement/index.ts diff --git a/packages/components/src/navigation/EdgesClipper/example.html b/temp/navigation/EdgesClipper/example.html similarity index 100% rename from packages/components/src/navigation/EdgesClipper/example.html rename to temp/navigation/EdgesClipper/example.html diff --git a/packages/components/src/navigation/EdgesClipper/example.ts b/temp/navigation/EdgesClipper/example.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/example.ts rename to temp/navigation/EdgesClipper/example.ts diff --git a/packages/components/src/navigation/EdgesClipper/index.ts b/temp/navigation/EdgesClipper/index.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/index.ts rename to temp/navigation/EdgesClipper/index.ts diff --git a/packages/components/src/navigation/EdgesClipper/src/clipping-edges.ts b/temp/navigation/EdgesClipper/src/clipping-edges.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/src/clipping-edges.ts rename to temp/navigation/EdgesClipper/src/clipping-edges.ts diff --git a/packages/components/src/navigation/EdgesClipper/src/clipping-fills.ts b/temp/navigation/EdgesClipper/src/clipping-fills.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/src/clipping-fills.ts rename to temp/navigation/EdgesClipper/src/clipping-fills.ts diff --git a/packages/components/src/navigation/EdgesClipper/src/edges-plane.ts b/temp/navigation/EdgesClipper/src/edges-plane.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/src/edges-plane.ts rename to temp/navigation/EdgesClipper/src/edges-plane.ts diff --git a/packages/components/src/navigation/EdgesClipper/src/edges-styles.ts b/temp/navigation/EdgesClipper/src/edges-styles.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/src/edges-styles.ts rename to temp/navigation/EdgesClipper/src/edges-styles.ts diff --git a/packages/components/src/navigation/EdgesClipper/src/types.ts b/temp/navigation/EdgesClipper/src/types.ts similarity index 100% rename from packages/components/src/navigation/EdgesClipper/src/types.ts rename to temp/navigation/EdgesClipper/src/types.ts diff --git a/packages/components/src/navigation/MiniMap/example.html b/temp/navigation/MiniMap/example.html similarity index 100% rename from packages/components/src/navigation/MiniMap/example.html rename to temp/navigation/MiniMap/example.html diff --git a/packages/components/src/navigation/MiniMap/example.ts b/temp/navigation/MiniMap/example.ts similarity index 100% rename from packages/components/src/navigation/MiniMap/example.ts rename to temp/navigation/MiniMap/example.ts diff --git a/packages/components/src/navigation/MiniMap/index.ts b/temp/navigation/MiniMap/index.ts similarity index 100% rename from packages/components/src/navigation/MiniMap/index.ts rename to temp/navigation/MiniMap/index.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/example.html b/temp/navigation/OrthoPerspectiveCamera/example.html similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/example.html rename to temp/navigation/OrthoPerspectiveCamera/example.html diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/example.ts b/temp/navigation/OrthoPerspectiveCamera/example.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/example.ts rename to temp/navigation/OrthoPerspectiveCamera/example.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/index.ts b/temp/navigation/OrthoPerspectiveCamera/index.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/index.ts rename to temp/navigation/OrthoPerspectiveCamera/index.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/src/first-person-mode.ts b/temp/navigation/OrthoPerspectiveCamera/src/first-person-mode.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/src/first-person-mode.ts rename to temp/navigation/OrthoPerspectiveCamera/src/first-person-mode.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/src/orbit-mode.ts b/temp/navigation/OrthoPerspectiveCamera/src/orbit-mode.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/src/orbit-mode.ts rename to temp/navigation/OrthoPerspectiveCamera/src/orbit-mode.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/src/plan-mode.ts b/temp/navigation/OrthoPerspectiveCamera/src/plan-mode.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/src/plan-mode.ts rename to temp/navigation/OrthoPerspectiveCamera/src/plan-mode.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/src/projections.ts b/temp/navigation/OrthoPerspectiveCamera/src/projections.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/src/projections.ts rename to temp/navigation/OrthoPerspectiveCamera/src/projections.ts diff --git a/packages/components/src/navigation/OrthoPerspectiveCamera/src/types.ts b/temp/navigation/OrthoPerspectiveCamera/src/types.ts similarity index 100% rename from packages/components/src/navigation/OrthoPerspectiveCamera/src/types.ts rename to temp/navigation/OrthoPerspectiveCamera/src/types.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/example.html b/temp/navigation/PostproductionRenderer/example.html similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/example.html rename to temp/navigation/PostproductionRenderer/example.html diff --git a/packages/components/src/navigation/PostproductionRenderer/example.ts b/temp/navigation/PostproductionRenderer/example.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/example.ts rename to temp/navigation/PostproductionRenderer/example.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/index.ts b/temp/navigation/PostproductionRenderer/index.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/index.ts rename to temp/navigation/PostproductionRenderer/index.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/src/custom-effects-pass.ts b/temp/navigation/PostproductionRenderer/src/custom-effects-pass.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/src/custom-effects-pass.ts rename to temp/navigation/PostproductionRenderer/src/custom-effects-pass.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/src/plane-distance-shader.ts b/temp/navigation/PostproductionRenderer/src/plane-distance-shader.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/src/plane-distance-shader.ts rename to temp/navigation/PostproductionRenderer/src/plane-distance-shader.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/src/postproduction.ts b/temp/navigation/PostproductionRenderer/src/postproduction.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/src/postproduction.ts rename to temp/navigation/PostproductionRenderer/src/postproduction.ts diff --git a/packages/components/src/navigation/PostproductionRenderer/src/projected-normal-shader.ts b/temp/navigation/PostproductionRenderer/src/projected-normal-shader.ts similarity index 100% rename from packages/components/src/navigation/PostproductionRenderer/src/projected-normal-shader.ts rename to temp/navigation/PostproductionRenderer/src/projected-normal-shader.ts diff --git a/packages/components/src/navigation/ShadowDropper/example.html b/temp/navigation/ShadowDropper/example.html similarity index 100% rename from packages/components/src/navigation/ShadowDropper/example.html rename to temp/navigation/ShadowDropper/example.html diff --git a/packages/components/src/navigation/ShadowDropper/example.ts b/temp/navigation/ShadowDropper/example.ts similarity index 100% rename from packages/components/src/navigation/ShadowDropper/example.ts rename to temp/navigation/ShadowDropper/example.ts diff --git a/packages/components/src/navigation/ShadowDropper/index.ts b/temp/navigation/ShadowDropper/index.ts similarity index 100% rename from packages/components/src/navigation/ShadowDropper/index.ts rename to temp/navigation/ShadowDropper/index.ts diff --git a/packages/components/src/navigation/ViewpointsManager/index.ts b/temp/navigation/ViewpointsManager/index.ts similarity index 100% rename from packages/components/src/navigation/ViewpointsManager/index.ts rename to temp/navigation/ViewpointsManager/index.ts diff --git a/packages/components/src/navigation/index.ts b/temp/navigation/index.ts similarity index 100% rename from packages/components/src/navigation/index.ts rename to temp/navigation/index.ts diff --git a/packages/components/src/services/CloudStorage/example.html b/temp/services/CloudStorage/example.html similarity index 100% rename from packages/components/src/services/CloudStorage/example.html rename to temp/services/CloudStorage/example.html diff --git a/packages/components/src/services/CloudStorage/example.ts b/temp/services/CloudStorage/example.ts similarity index 100% rename from packages/components/src/services/CloudStorage/example.ts rename to temp/services/CloudStorage/example.ts diff --git a/packages/components/src/services/CloudStorage/index.ts b/temp/services/CloudStorage/index.ts similarity index 100% rename from packages/components/src/services/CloudStorage/index.ts rename to temp/services/CloudStorage/index.ts diff --git a/packages/components/src/services/index.ts b/temp/services/index.ts similarity index 100% rename from packages/components/src/services/index.ts rename to temp/services/index.ts diff --git a/packages/components/src/typeless-libraries-handler.d.ts b/temp/typeless-libraries-handler.d.ts similarity index 100% rename from packages/components/src/typeless-libraries-handler.d.ts rename to temp/typeless-libraries-handler.d.ts diff --git a/packages/components/src/utils/GeometryUtils/bbox.ts b/temp/utils/GeometryUtils/bbox.ts similarity index 100% rename from packages/components/src/utils/GeometryUtils/bbox.ts rename to temp/utils/GeometryUtils/bbox.ts diff --git a/packages/components/src/utils/GeometryUtils/index.ts b/temp/utils/GeometryUtils/index.ts similarity index 100% rename from packages/components/src/utils/GeometryUtils/index.ts rename to temp/utils/GeometryUtils/index.ts diff --git a/packages/components/src/utils/GeometryUtils/misc.ts b/temp/utils/GeometryUtils/misc.ts similarity index 100% rename from packages/components/src/utils/GeometryUtils/misc.ts rename to temp/utils/GeometryUtils/misc.ts diff --git a/packages/components/src/utils/GeometryVerticesMarker/index.ts b/temp/utils/GeometryVerticesMarker/index.ts similarity index 100% rename from packages/components/src/utils/GeometryVerticesMarker/index.ts rename to temp/utils/GeometryVerticesMarker/index.ts diff --git a/packages/components/src/utils/LineIntersectionPicker/index.ts b/temp/utils/LineIntersectionPicker/index.ts similarity index 100% rename from packages/components/src/utils/LineIntersectionPicker/index.ts rename to temp/utils/LineIntersectionPicker/index.ts diff --git a/packages/components/src/utils/Misc/index.ts b/temp/utils/Misc/index.ts similarity index 100% rename from packages/components/src/utils/Misc/index.ts rename to temp/utils/Misc/index.ts diff --git a/packages/components/src/utils/VertexPicker/index.ts b/temp/utils/VertexPicker/index.ts similarity index 100% rename from packages/components/src/utils/VertexPicker/index.ts rename to temp/utils/VertexPicker/index.ts diff --git a/packages/components/src/utils/index.ts b/temp/utils/index.ts similarity index 100% rename from packages/components/src/utils/index.ts rename to temp/utils/index.ts diff --git a/yarn.lock b/yarn.lock index 11441837e..3dcc51199 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,13 +12,6 @@ __metadata: languageName: node linkType: hard -"@alloc/quick-lru@npm:^5.2.0": - version: 5.2.0 - resolution: "@alloc/quick-lru@npm:5.2.0" - checksum: bdc35758b552bcf045733ac047fb7f9a07c4678b944c641adfbd41f798b4b91fffd0fdc0df2578d9b0afc7b4d636aa6e110ead5d6281a2adc1ab90efd7f057f8 - languageName: node - linkType: hard - "@ampproject/remapping@npm:^2.2.0": version: 2.2.1 resolution: "@ampproject/remapping@npm:2.2.1" @@ -1080,13 +1073,6 @@ __metadata: languageName: node linkType: hard -"@popperjs/core@npm:2.11.8": - version: 2.11.8 - resolution: "@popperjs/core@npm:2.11.8" - checksum: e5c69fdebf52a4012f6a1f14817ca8e9599cb1be73dd1387e1785e2ed5e5f0862ff817f420a87c7fc532add1f88a12e25aeb010ffcbdc98eace3d55ce2139cf0 - languageName: node - linkType: hard - "@rollup/pluginutils@npm:^5.1.0": version: 5.1.0 resolution: "@rollup/pluginutils@npm:5.1.0" @@ -1280,21 +1266,14 @@ __metadata: version: 0.0.0-use.local resolution: "@thatopen/components@workspace:packages/components" dependencies: - "@popperjs/core": 2.11.8 - "@types/earcut": ^2.1.1 "@types/jest": 27.0.0 "@types/node": 20.11.30 - "@types/node-fetch": ^2.6.4 - "@types/stats": 0.16.30 "@types/three": 0.160.0 "@typescript-eslint/eslint-plugin": 7.2.0 "@typescript-eslint/parser": 7.2.0 bim-fragment: 1.5.0 camera-controls: 2.7.3 cpy-cli: 3.1.1 - dexie: ^3.2.3 - dxf-writer: ^1.18.4 - earcut: ^2.2.4 eslint: 8.57.0 eslint-config-airbnb-base: 15.0.0 eslint-config-prettier: 9.1.0 @@ -1302,20 +1281,13 @@ __metadata: eslint-plugin-prettier: 5.1.3 glob: latest jest: ^27.0.4 - n8ao: 1.5.1 - node-fetch: ^3.3.2 - openbim-clay: 0.0.5 - postprocessing: 6.34.2 prettier: 3.2.5 - stats.js: ^0.17.0 - tailwindcss: ^3.3.5 three: ^0.160.1 three-mesh-bvh: 0.7.0 top-tool-package-reader: 0.0.3 ts-jest: ^27.0.3 ts-node: ^10.0.0 typescript: 5.4.2 - unzipit: ^1.4.3 web-ifc: 0.0.53 peerDependencies: bim-fragment: 1.5.0 @@ -1407,13 +1379,6 @@ __metadata: languageName: node linkType: hard -"@types/earcut@npm:^2.1.1": - version: 2.1.4 - resolution: "@types/earcut@npm:2.1.4" - checksum: 167e1c6d60e9d964d0f496c11b5065b9d155b4c1df04fb9abcec88af2c16213999ea8ed7cddeec9475620152e7e9e99a0f118e1c8070e1396cf0f299642beb6b - languageName: node - linkType: hard - "@types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": version: 1.0.5 resolution: "@types/estree@npm:1.0.5" @@ -1503,16 +1468,6 @@ __metadata: languageName: node linkType: hard -"@types/node-fetch@npm:^2.6.4": - version: 2.6.11 - resolution: "@types/node-fetch@npm:2.6.11" - dependencies: - "@types/node": "*" - form-data: ^4.0.0 - checksum: 180e4d44c432839bdf8a25251ef8c47d51e37355ddd78c64695225de8bc5dc2b50b7bb855956d471c026bb84bd7295688a0960085e7158cbbba803053492568b - languageName: node - linkType: hard - "@types/node@npm:*": version: 20.11.13 resolution: "@types/node@npm:20.11.13" @@ -1566,13 +1521,6 @@ __metadata: languageName: node linkType: hard -"@types/stats@npm:0.16.30": - version: 0.16.30 - resolution: "@types/stats@npm:0.16.30" - checksum: cd526ff4bb6c3159531911d9a8a6f0928a783fcc9c4364a8b6626fb123e64ad895da2629f768781cada63f54fea93c85ba4b06a842d86bc1f63e6894c55f5d1d - languageName: node - linkType: hard - "@types/three@npm:0.160.0": version: 0.160.0 resolution: "@types/three@npm:0.160.0" @@ -1987,14 +1935,7 @@ __metadata: languageName: node linkType: hard -"any-promise@npm:^1.0.0": - version: 1.3.0 - resolution: "any-promise@npm:1.3.0" - checksum: 0ee8a9bdbe882c90464d75d1f55cf027f5458650c4bd1f0467e65aec38ccccda07ca5844969ee77ed46d04e7dded3eaceb027e8d32f385688523fe305fa7e1de - languageName: node - linkType: hard - -"anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": +"anymatch@npm:^3.0.3": version: 3.1.3 resolution: "anymatch@npm:3.1.3" dependencies: @@ -2011,13 +1952,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:^5.0.2": - version: 5.0.2 - resolution: "arg@npm:5.0.2" - checksum: 6c69ada1a9943d332d9e5382393e897c500908d91d5cb735a01120d5f71daf1b339b7b8980cbeaba8fd1afc68e658a739746179e4315a26e8a28951ff9930078 - languageName: node - linkType: hard - "argparse@npm:^1.0.7, argparse@npm:~1.0.9": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -2316,13 +2250,6 @@ __metadata: languageName: node linkType: hard -"binary-extensions@npm:^2.0.0": - version: 2.2.0 - resolution: "binary-extensions@npm:2.2.0" - checksum: ccd267956c58d2315f5d3ea6757cf09863c5fc703e50fbeb13a7dc849b812ef76e3cf9ca8f35a0c48498776a7478d7b4a0418e1e2b8cb9cb9731f2922aaad7f8 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -2360,7 +2287,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.2, braces@npm:~3.0.2": +"braces@npm:^3.0.2": version: 3.0.2 resolution: "braces@npm:3.0.2" dependencies: @@ -2490,13 +2417,6 @@ __metadata: languageName: node linkType: hard -"camelcase-css@npm:^2.0.1": - version: 2.0.1 - resolution: "camelcase-css@npm:2.0.1" - checksum: 1cec2b3b3dcb5026688a470b00299a8db7d904c4802845c353dbd12d9d248d3346949a814d83bfd988d4d2e5b9904c07efe76fecd195a1d4f05b543e7c0b56b1 - languageName: node - linkType: hard - "camelcase-keys@npm:^6.2.2": version: 6.2.2 resolution: "camelcase-keys@npm:6.2.2" @@ -2566,25 +2486,6 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.5.3": - version: 3.5.3 - resolution: "chokidar@npm:3.5.3" - dependencies: - anymatch: ~3.1.2 - braces: ~3.0.2 - fsevents: ~2.3.2 - glob-parent: ~5.1.2 - is-binary-path: ~2.1.0 - is-glob: ~4.0.1 - normalize-path: ~3.0.0 - readdirp: ~3.6.0 - dependenciesMeta: - fsevents: - optional: true - checksum: b49fcde40176ba007ff361b198a2d35df60d9bb2a5aab228279eb810feae9294a6b4649ab15981304447afe1e6ffbf4788ad5db77235dc770ab777c6e771980c - languageName: node - linkType: hard - "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -2708,13 +2609,6 @@ __metadata: languageName: node linkType: hard -"commander@npm:^4.0.0": - version: 4.1.1 - resolution: "commander@npm:4.1.1" - checksum: d7b9913ff92cae20cb577a4ac6fcc121bd6223319e54a40f51a14740a681ad5c574fd29a57da478a5f234a6fa6c52cbf0b7c641353e03c648b1ae85ba670b977 - languageName: node - linkType: hard - "commander@npm:^9.4.1": version: 9.5.0 resolution: "commander@npm:9.5.0" @@ -2830,15 +2724,6 @@ __metadata: languageName: node linkType: hard -"cssesc@npm:^3.0.0": - version: 3.0.0 - resolution: "cssesc@npm:3.0.0" - bin: - cssesc: bin/cssesc - checksum: f8c4ababffbc5e2ddf2fa9957dda1ee4af6048e22aeda1869d0d00843223c1b13ad3f5d88b51caa46c994225eacb636b764eb807a8883e2fb6f99b4f4e8c48b2 - languageName: node - linkType: hard - "cssom@npm:^0.4.4": version: 0.4.4 resolution: "cssom@npm:0.4.4" @@ -2862,13 +2747,6 @@ __metadata: languageName: node linkType: hard -"data-uri-to-buffer@npm:^4.0.0": - version: 4.0.1 - resolution: "data-uri-to-buffer@npm:4.0.1" - checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c - languageName: node - linkType: hard - "data-urls@npm:^2.0.0": version: 2.0.0 resolution: "data-urls@npm:2.0.0" @@ -3044,20 +2922,6 @@ __metadata: languageName: node linkType: hard -"dexie@npm:^3.2.3": - version: 3.2.4 - resolution: "dexie@npm:3.2.4" - checksum: 4e5294a954118b6862c864b8c3970904a1733daebcd919488624520696411e2e81ed1bceeac3634c5c15a21e37ce4b8502ed41c4edfbc5ba3f5925c34d56497b - languageName: node - linkType: hard - -"didyoumean@npm:^1.2.2": - version: 1.2.2 - resolution: "didyoumean@npm:1.2.2" - checksum: d5d98719d58b3c2fa59663c4c42ba9716f1fd01245c31d5fce31915bd3aa26e6aac149788e007358f778ebbd68a2256eb5973e8ca6f221df221ba060115acf2e - languageName: node - linkType: hard - "diff-sequences@npm:^26.6.2": version: 26.6.2 resolution: "diff-sequences@npm:26.6.2" @@ -3097,13 +2961,6 @@ __metadata: languageName: node linkType: hard -"dlv@npm:^1.1.3": - version: 1.1.3 - resolution: "dlv@npm:1.1.3" - checksum: d7381bca22ed11933a1ccf376db7a94bee2c57aa61e490f680124fa2d1cd27e94eba641d9f45be57caab4f9a6579de0983466f620a2cd6230d7ec93312105ae7 - languageName: node - linkType: hard - "doctrine@npm:^2.1.0": version: 2.1.0 resolution: "doctrine@npm:2.1.0" @@ -3131,20 +2988,6 @@ __metadata: languageName: node linkType: hard -"dxf-writer@npm:^1.18.4": - version: 1.18.4 - resolution: "dxf-writer@npm:1.18.4" - checksum: f40d281068fdd6f4f4d41d73113af67d63c831fd11e7d91fe882f37391c41781be6b14d144df5b460335c7ca17550a2d4f7eb10861b09309fd014ac664df2f10 - languageName: node - linkType: hard - -"earcut@npm:^2.2.4": - version: 2.2.4 - resolution: "earcut@npm:2.2.4" - checksum: aea0466cb2f24e0c3c57148d8d28ac9846f53c4f43ee66780826474303ac851b305ef988152d0bdeb31e8f7ca939dc0df737e7505cfb1c1bdf2ff9d7f9ea2faa - languageName: node - linkType: hard - "eastasianwidth@npm:^0.2.0": version: 0.2.0 resolution: "eastasianwidth@npm:0.2.0" @@ -3790,7 +3633,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0": +"fast-glob@npm:^3.2.9": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" dependencies: @@ -3835,16 +3678,6 @@ __metadata: languageName: node linkType: hard -"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": - version: 3.2.0 - resolution: "fetch-blob@npm:3.2.0" - dependencies: - node-domexception: ^1.0.0 - web-streams-polyfill: ^3.0.3 - checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf - languageName: node - linkType: hard - "fflate@npm:~0.6.10": version: 0.6.10 resolution: "fflate@npm:0.6.10" @@ -3964,26 +3797,6 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.0": - version: 4.0.0 - resolution: "form-data@npm:4.0.0" - dependencies: - asynckit: ^0.4.0 - combined-stream: ^1.0.8 - mime-types: ^2.1.12 - checksum: 01135bf8675f9d5c61ff18e2e2932f719ca4de964e3be90ef4c36aacfc7b9cb2fceb5eca0b7e0190e3383fe51c5b37f4cb80b62ca06a99aaabfcfd6ac7c9328c - languageName: node - linkType: hard - -"formdata-polyfill@npm:^4.0.10": - version: 4.0.10 - resolution: "formdata-polyfill@npm:4.0.10" - dependencies: - fetch-blob: ^3.1.2 - checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db - languageName: node - linkType: hard - "fragment-cache@npm:^0.2.1": version: 0.2.1 resolution: "fragment-cache@npm:0.2.1" @@ -4154,7 +3967,7 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": +"glob-parent@npm:^5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" dependencies: @@ -4667,15 +4480,6 @@ __metadata: languageName: node linkType: hard -"is-binary-path@npm:~2.1.0": - version: 2.1.0 - resolution: "is-binary-path@npm:2.1.0" - dependencies: - binary-extensions: ^2.0.0 - checksum: 84192eb88cff70d320426f35ecd63c3d6d495da9d805b19bc65b518984b7c0760280e57dbf119b7e9be6b161784a5a673ab2c6abe83abb5198a432232ad5b35c - languageName: node - linkType: hard - "is-boolean-object@npm:^1.1.0": version: 1.1.2 resolution: "is-boolean-object@npm:1.1.2" @@ -4793,7 +4597,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -5564,15 +5368,6 @@ __metadata: languageName: node linkType: hard -"jiti@npm:^1.19.1": - version: 1.21.0 - resolution: "jiti@npm:1.21.0" - bin: - jiti: bin/jiti.js - checksum: a7bd5d63921c170eaec91eecd686388181c7828e1fa0657ab374b9372bfc1f383cf4b039e6b272383d5cb25607509880af814a39abdff967322459cca41f2961 - languageName: node - linkType: hard - "jju@npm:~1.4.0": version: 1.4.0 resolution: "jju@npm:1.4.0" @@ -5791,20 +5586,6 @@ __metadata: languageName: node linkType: hard -"lilconfig@npm:^2.1.0": - version: 2.1.0 - resolution: "lilconfig@npm:2.1.0" - checksum: 8549bb352b8192375fed4a74694cd61ad293904eee33f9d4866c2192865c44c4eb35d10782966242634e0cbc1e91fe62b1247f148dc5514918e3a966da7ea117 - languageName: node - linkType: hard - -"lilconfig@npm:^3.0.0": - version: 3.0.0 - resolution: "lilconfig@npm:3.0.0" - checksum: a155f1cd24d324ab20dd6974db9ebcf3fb6f2b60175f7c052d917ff8a746b590bc1ee550f6fc3cb1e8716c8b58304e22fe2193febebc0cf16fa86d85e6f896c5 - languageName: node - linkType: hard - "lines-and-columns@npm:^1.1.6": version: 1.2.4 resolution: "lines-and-columns@npm:1.2.4" @@ -6034,7 +5815,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": +"micromatch@npm:^4.0.4": version: 4.0.5 resolution: "micromatch@npm:4.0.5" dependencies: @@ -6250,27 +6031,6 @@ __metadata: languageName: node linkType: hard -"mz@npm:^2.7.0": - version: 2.7.0 - resolution: "mz@npm:2.7.0" - dependencies: - any-promise: ^1.0.0 - object-assign: ^4.0.1 - thenify-all: ^1.0.0 - checksum: 8427de0ece99a07e9faed3c0c6778820d7543e3776f9a84d22cf0ec0a8eb65f6e9aee9c9d353ff9a105ff62d33a9463c6ca638974cc652ee8140cd1e35951c87 - languageName: node - linkType: hard - -"n8ao@npm:1.5.1": - version: 1.5.1 - resolution: "n8ao@npm:1.5.1" - peerDependencies: - postprocessing: ">=6.30.0" - three: ">=0.137" - checksum: 228ad7eba3833bda9941065c37ee83e9f273160e359a6978a8ff42059b8922ad823f8907424985a2cc970e2aa3413bda6b0f0a475c48d9b9cf697c04abdb25e1 - languageName: node - linkType: hard - "nanoid@npm:^3.3.7": version: 3.3.7 resolution: "nanoid@npm:3.3.7" @@ -6320,24 +6080,6 @@ __metadata: languageName: node linkType: hard -"node-domexception@npm:^1.0.0": - version: 1.0.0 - resolution: "node-domexception@npm:1.0.0" - checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f - languageName: node - linkType: hard - -"node-fetch@npm:^3.3.2": - version: 3.3.2 - resolution: "node-fetch@npm:3.3.2" - dependencies: - data-uri-to-buffer: ^4.0.0 - fetch-blob: ^3.1.4 - formdata-polyfill: ^4.0.10 - checksum: 06a04095a2ddf05b0830a0d5302699704d59bda3102894ea64c7b9d4c865ecdff2d90fd042df7f5bc40337266961cb6183dcc808ea4f3000d024f422b462da92 - languageName: node - linkType: hard - "node-gyp@npm:latest": version: 10.0.1 resolution: "node-gyp@npm:10.0.1" @@ -6395,7 +6137,7 @@ __metadata: languageName: node linkType: hard -"normalize-path@npm:^3.0.0, normalize-path@npm:~3.0.0": +"normalize-path@npm:^3.0.0": version: 3.0.0 resolution: "normalize-path@npm:3.0.0" checksum: 88eeb4da891e10b1318c4b2476b6e2ecbeb5ff97d946815ffea7794c31a89017c70d7f34b3c2ebf23ef4e9fc9fb99f7dffe36da22011b5b5c6ffa34f4873ec20 @@ -6418,13 +6160,6 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^4.0.1": - version: 4.1.1 - resolution: "object-assign@npm:4.1.1" - checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f - languageName: node - linkType: hard - "object-copy@npm:^0.1.0": version: 0.1.0 resolution: "object-copy@npm:0.1.0" @@ -6436,13 +6171,6 @@ __metadata: languageName: node linkType: hard -"object-hash@npm:^3.0.0": - version: 3.0.0 - resolution: "object-hash@npm:3.0.0" - checksum: 80b4904bb3857c52cc1bfd0b52c0352532ca12ed3b8a6ff06a90cd209dfda1b95cee059a7625eb9da29537027f68ac4619363491eedb2f5d3dddbba97494fd6c - languageName: node - linkType: hard - "object-inspect@npm:^1.13.1, object-inspect@npm:^1.9.0": version: 1.13.1 resolution: "object-inspect@npm:1.13.1" @@ -6550,16 +6278,6 @@ __metadata: languageName: node linkType: hard -"openbim-clay@npm:0.0.5": - version: 0.0.5 - resolution: "openbim-clay@npm:0.0.5" - dependencies: - earcut: ^2.2.4 - three: 0.152.2 - checksum: 94df015f0a7049a496c6f9a82fe72ce2e055febd021bf534fbd4f1c9effb659e5b814fa7debdd50335181d498a84d4c4ad431530906e2884fc14004dff72d84d - languageName: node - linkType: hard - "optionator@npm:^0.9.3": version: 0.9.3 resolution: "optionator@npm:0.9.3" @@ -6805,20 +6523,13 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" checksum: 050c865ce81119c4822c45d3c84f1ced46f93a0126febae20737bd05ca20589c564d6e9226977df859ed5e03dc73f02584a2b0faad36e896936238238b0446cf languageName: node linkType: hard -"pify@npm:^2.3.0": - version: 2.3.0 - resolution: "pify@npm:2.3.0" - checksum: 9503aaeaf4577acc58642ad1d25c45c6d90288596238fb68f82811c08104c800e5a7870398e9f015d82b44ecbcbef3dc3d4251a1cbb582f6e5959fe09884b2ba - languageName: node - linkType: hard - "pify@npm:^3.0.0": version: 3.0.0 resolution: "pify@npm:3.0.0" @@ -6833,7 +6544,7 @@ __metadata: languageName: node linkType: hard -"pirates@npm:^4.0.1, pirates@npm:^4.0.4": +"pirates@npm:^4.0.4": version: 4.0.6 resolution: "pirates@npm:4.0.6" checksum: 46a65fefaf19c6f57460388a5af9ab81e3d7fd0e7bc44ca59d753cb5c4d0df97c6c6e583674869762101836d68675f027d60f841c105d72734df9dfca97cbcc6 @@ -6856,87 +6567,6 @@ __metadata: languageName: node linkType: hard -"postcss-import@npm:^15.1.0": - version: 15.1.0 - resolution: "postcss-import@npm:15.1.0" - dependencies: - postcss-value-parser: ^4.0.0 - read-cache: ^1.0.0 - resolve: ^1.1.7 - peerDependencies: - postcss: ^8.0.0 - checksum: 7bd04bd8f0235429009d0022cbf00faebc885de1d017f6d12ccb1b021265882efc9302006ba700af6cab24c46bfa2f3bc590be3f9aee89d064944f171b04e2a3 - languageName: node - linkType: hard - -"postcss-js@npm:^4.0.1": - version: 4.0.1 - resolution: "postcss-js@npm:4.0.1" - dependencies: - camelcase-css: ^2.0.1 - peerDependencies: - postcss: ^8.4.21 - checksum: 5c1e83efeabeb5a42676193f4357aa9c88f4dc1b3c4a0332c132fe88932b33ea58848186db117cf473049fc233a980356f67db490bd0a7832ccba9d0b3fd3491 - languageName: node - linkType: hard - -"postcss-load-config@npm:^4.0.1": - version: 4.0.2 - resolution: "postcss-load-config@npm:4.0.2" - dependencies: - lilconfig: ^3.0.0 - yaml: ^2.3.4 - peerDependencies: - postcss: ">=8.0.9" - ts-node: ">=9.0.0" - peerDependenciesMeta: - postcss: - optional: true - ts-node: - optional: true - checksum: 7c27dd3801db4eae207a5116fed2db6b1ebb780b40c3dd62a3e57e087093a8e6a14ee17ada729fee903152d6ef4826c6339eb135bee6208e0f3140d7e8090185 - languageName: node - linkType: hard - -"postcss-nested@npm:^6.0.1": - version: 6.0.1 - resolution: "postcss-nested@npm:6.0.1" - dependencies: - postcss-selector-parser: ^6.0.11 - peerDependencies: - postcss: ^8.2.14 - checksum: 7ddb0364cd797de01e38f644879189e0caeb7ea3f78628c933d91cc24f327c56d31269384454fc02ecaf503b44bfa8e08870a7c4cc56b23bc15640e1894523fa - languageName: node - linkType: hard - -"postcss-selector-parser@npm:^6.0.11": - version: 6.0.15 - resolution: "postcss-selector-parser@npm:6.0.15" - dependencies: - cssesc: ^3.0.0 - util-deprecate: ^1.0.2 - checksum: 57decb94152111004f15e27b9c61131eb50ee10a3288e7fcf424cebbb4aba82c2817517ae718f8b5d704ee9e02a638d4a2acff8f47685c295a33ecee4fd31055 - languageName: node - linkType: hard - -"postcss-value-parser@npm:^4.0.0": - version: 4.2.0 - resolution: "postcss-value-parser@npm:4.2.0" - checksum: 819ffab0c9d51cf0acbabf8996dffbfafbafa57afc0e4c98db88b67f2094cb44488758f06e5da95d7036f19556a4a732525e84289a425f4f6fd8e412a9d7442f - languageName: node - linkType: hard - -"postcss@npm:^8.4.23": - version: 8.4.33 - resolution: "postcss@npm:8.4.33" - dependencies: - nanoid: ^3.3.7 - picocolors: ^1.0.0 - source-map-js: ^1.0.2 - checksum: 6f98b2af4b76632a3de20c4f47bf0e984a1ce1a531cf11adcb0b1d63a6cbda0aae4165e578b66c32ca4879038e3eaad386a6be725a8fb4429c78e3c1ab858fe9 - languageName: node - linkType: hard - "postcss@npm:^8.4.35": version: 8.4.38 resolution: "postcss@npm:8.4.38" @@ -6948,15 +6578,6 @@ __metadata: languageName: node linkType: hard -"postprocessing@npm:6.34.2": - version: 6.34.2 - resolution: "postprocessing@npm:6.34.2" - peerDependencies: - three: ">= 0.138.0 < 0.162.0" - checksum: 023d26c588bb4714ca017829f4dc02510c366ea5b0d2e72454d0e64be36cbc506536c54ea5abc615f117bac89857e120afc88e0a4a7f64c4bb4511b05e7ecc45 - languageName: node - linkType: hard - "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -7074,15 +6695,6 @@ __metadata: languageName: node linkType: hard -"read-cache@npm:^1.0.0": - version: 1.0.0 - resolution: "read-cache@npm:1.0.0" - dependencies: - pify: ^2.3.0 - checksum: cffc728b9ede1e0667399903f9ecaf3789888b041c46ca53382fa3a06303e5132774dc0a96d0c16aa702dbac1ea0833d5a868d414f5ab2af1e1438e19e6657c6 - languageName: node - linkType: hard - "read-pkg-up@npm:^7.0.1": version: 7.0.1 resolution: "read-pkg-up@npm:7.0.1" @@ -7106,15 +6718,6 @@ __metadata: languageName: node linkType: hard -"readdirp@npm:~3.6.0": - version: 3.6.0 - resolution: "readdirp@npm:3.6.0" - dependencies: - picomatch: ^2.2.1 - checksum: 1ced032e6e45670b6d7352d71d21ce7edf7b9b928494dcaba6f11fba63180d9da6cd7061ebc34175ffda6ff529f481818c962952004d273178acd70f7059b320 - languageName: node - linkType: hard - "redent@npm:^3.0.0": version: 3.0.0 resolution: "redent@npm:3.0.0" @@ -7211,7 +6814,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.20.0, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:~1.22.1": +"resolve@npm:^1.10.0, resolve@npm:^1.20.0, resolve@npm:^1.22.4, resolve@npm:~1.22.1": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -7234,7 +6837,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.7#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.2#~builtin, resolve@patch:resolve@^1.22.4#~builtin, resolve@patch:resolve@~1.22.1#~builtin": +"resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.4#~builtin, resolve@patch:resolve@~1.22.1#~builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=07638b" dependencies: @@ -7774,13 +7377,6 @@ __metadata: languageName: node linkType: hard -"stats.js@npm:^0.17.0": - version: 0.17.0 - resolution: "stats.js@npm:0.17.0" - checksum: 62d55d9e28e701f5638eac312ab45f66da8cc14b43d4eba4d3ab5a26f444a91d3e0dd1f52e8fc182b03cae955dae4af471d54f1975525cc1e47dfa89a54a47c6 - languageName: node - linkType: hard - "string-argv@npm:~0.3.1": version: 0.3.2 resolution: "string-argv@npm:0.3.2" @@ -7908,24 +7504,6 @@ __metadata: languageName: node linkType: hard -"sucrase@npm:^3.32.0": - version: 3.35.0 - resolution: "sucrase@npm:3.35.0" - dependencies: - "@jridgewell/gen-mapping": ^0.3.2 - commander: ^4.0.0 - glob: ^10.3.10 - lines-and-columns: ^1.1.6 - mz: ^2.7.0 - pirates: ^4.0.1 - ts-interface-checker: ^0.1.9 - bin: - sucrase: bin/sucrase - sucrase-node: bin/sucrase-node - checksum: 9fc5792a9ab8a14dcf9c47dcb704431d35c1cdff1d17d55d382a31c2e8e3063870ad32ce120a80915498486246d612e30cda44f1624d9d9a10423e1a43487ad1 - languageName: node - linkType: hard - "supports-color@npm:^5.3.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" @@ -7987,39 +7565,6 @@ __metadata: languageName: node linkType: hard -"tailwindcss@npm:^3.3.5": - version: 3.3.5 - resolution: "tailwindcss@npm:3.3.5" - dependencies: - "@alloc/quick-lru": ^5.2.0 - arg: ^5.0.2 - chokidar: ^3.5.3 - didyoumean: ^1.2.2 - dlv: ^1.1.3 - fast-glob: ^3.3.0 - glob-parent: ^6.0.2 - is-glob: ^4.0.3 - jiti: ^1.19.1 - lilconfig: ^2.1.0 - micromatch: ^4.0.5 - normalize-path: ^3.0.0 - object-hash: ^3.0.0 - picocolors: ^1.0.0 - postcss: ^8.4.23 - postcss-import: ^15.1.0 - postcss-js: ^4.0.1 - postcss-load-config: ^4.0.1 - postcss-nested: ^6.0.1 - postcss-selector-parser: ^6.0.11 - resolve: ^1.22.2 - sucrase: ^3.32.0 - bin: - tailwind: lib/cli.js - tailwindcss: lib/cli.js - checksum: e04bb3bb7f9f17e9b6db0c7ace755ef0d6d05bff36ebeb9e5006e13c018ed5566f09db30a1a34380e38fa93ebbb4ae0e28fe726879d5e9ddd8c5b52bffd26f14 - languageName: node - linkType: hard - "tar@npm:^6.1.11, tar@npm:^6.1.2": version: 6.2.0 resolution: "tar@npm:6.2.0" @@ -8062,24 +7607,6 @@ __metadata: languageName: node linkType: hard -"thenify-all@npm:^1.0.0": - version: 1.6.0 - resolution: "thenify-all@npm:1.6.0" - dependencies: - thenify: ">= 3.1.0 < 4" - checksum: dba7cc8a23a154cdcb6acb7f51d61511c37a6b077ec5ab5da6e8b874272015937788402fd271fdfc5f187f8cb0948e38d0a42dcc89d554d731652ab458f5343e - languageName: node - linkType: hard - -"thenify@npm:>= 3.1.0 < 4": - version: 3.3.1 - resolution: "thenify@npm:3.3.1" - dependencies: - any-promise: ^1.0.0 - checksum: 84e1b804bfec49f3531215f17b4a6e50fd4397b5f7c1bccc427b9c656e1ecfb13ea79d899930184f78bc2f57285c54d9a50a590c8868f4f0cef5c1d9f898b05e - languageName: node - linkType: hard - "three-mesh-bvh@npm:0.7.0": version: 0.7.0 resolution: "three-mesh-bvh@npm:0.7.0" @@ -8089,13 +7616,6 @@ __metadata: languageName: node linkType: hard -"three@npm:0.152.2": - version: 0.152.2 - resolution: "three@npm:0.152.2" - checksum: 6d2d990dbff60b99c7e58b7f1446bb4bd235c7db5dd848a671385e01ae5c72bec865265be7f5a82907ecc96186acc13177d7de1252bc9592f5c9ebaffd1da1e7 - languageName: node - linkType: hard - "three@npm:^0.160.1": version: 0.160.1 resolution: "three@npm:0.160.1" @@ -8208,13 +7728,6 @@ __metadata: languageName: node linkType: hard -"ts-interface-checker@npm:^0.1.9": - version: 0.1.13 - resolution: "ts-interface-checker@npm:0.1.13" - checksum: 20c29189c2dd6067a8775e07823ddf8d59a33e2ffc47a1bd59a5cb28bb0121a2969a816d5e77eda2ed85b18171aa5d1c4005a6b88ae8499ec7cc49f78571cb5e - languageName: node - linkType: hard - "ts-jest@npm:^27.0.3": version: 27.1.5 resolution: "ts-jest@npm:27.1.5" @@ -8525,7 +8038,7 @@ __metadata: languageName: node linkType: hard -"unzipit@npm:1.4.3, unzipit@npm:^1.4.3": +"unzipit@npm:1.4.3": version: 1.4.3 resolution: "unzipit@npm:1.4.3" dependencies: @@ -8581,13 +8094,6 @@ __metadata: languageName: node linkType: hard -"util-deprecate@npm:^1.0.2": - version: 1.0.2 - resolution: "util-deprecate@npm:1.0.2" - checksum: 474acf1146cb2701fe3b074892217553dfcf9a031280919ba1b8d651a068c9b15d863b7303cb15bd00a862b498e6cf4ad7b4a08fb134edd5a6f7641681cb54a2 - languageName: node - linkType: hard - "uzip-module@npm:^1.0.2": version: 1.0.3 resolution: "uzip-module@npm:1.0.3" @@ -8749,13 +8255,6 @@ __metadata: languageName: node linkType: hard -"web-streams-polyfill@npm:^3.0.3": - version: 3.3.2 - resolution: "web-streams-polyfill@npm:3.3.2" - checksum: 0292f4113c1bda40d8e8ecebee39eb14cc2e2e560a65a6867980e394537a2645130e2c73f5ef6e641fd3697d2f71720ccf659aebaf69a9d5a773f653a0fdf39d - languageName: node - linkType: hard - "webidl-conversions@npm:^5.0.0": version: 5.0.0 resolution: "webidl-conversions@npm:5.0.0" @@ -8936,13 +8435,6 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.3.4": - version: 2.3.4 - resolution: "yaml@npm:2.3.4" - checksum: e6d1dae1c6383bcc8ba11796eef3b8c02d5082911c6723efeeb5ba50fc8e881df18d645e64de68e421b577296000bea9c75d6d9097c2f6699da3ae0406c030d8 - languageName: node - linkType: hard - "yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9"