@aeco-dev/bonsaiweb
v0.0.1
Published
Browser BIM host: IfcOpenShell, a WebGPU viewer, and an optional gui shell.
Readme
@aeco-dev/bonsaiweb
Browser BIM host. It loads an IFC model, draws it in a WebGPU viewer, and exposes operators for a shell or a headless page.
npm install @aeco-dev/bonsaiwebThat installs this package and the libraries it imports: @aeco-dev/gui, @aeco-dev/layout, ifcopenshell, and @ifcopenshell/wasm. A bundler and a browser import map use those same names.
Bundler
import { start } from "@aeco-dev/bonsaiweb";
import { defaultPaths } from "@aeco-dev/bonsaiweb/paths";
import "@aeco-dev/gui/gui.css";
import "@aeco-dev/layout/layout.css";Headless, without the shell: import { start } from "@aeco-dev/bonsaiweb/headless".
Import map
A page without a bundler maps the same names onto jsDelivr. The versions match the package dependencies. The map has to be inline, because the convert worker copies it.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/gui.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/layout.css">
<script type="importmap">
{
"imports": {
"@aeco-dev/bonsaiweb": "https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/dist/bonsai.js",
"@aeco-dev/bonsaiweb/headless": "https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/dist/bonsai-headless.js",
"@aeco-dev/bonsaiweb/paths": "https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/dist/paths.js",
"@aeco-dev/gui": "https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/gui.js",
"@aeco-dev/layout": "https://cdn.jsdelivr.net/npm/@aeco-dev/[email protected]/layout.js",
"ifcopenshell": "https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js",
"ifcopenshell/geom": "https://cdn.jsdelivr.net/npm/[email protected]/dist/geom/index.js",
"ifcopenshell/util": "https://cdn.jsdelivr.net/npm/[email protected]/dist/util/index.js",
"@ifcopenshell/wasm": "https://cdn.jsdelivr.net/npm/@ifcopenshell/[email protected]/browser.js",
"@ifcopenshell/wasm/api": "https://cdn.jsdelivr.net/npm/@ifcopenshell/[email protected]/wasm/ifcopenshell_api.mjs"
}
}
</script>
<script type="module">
import { start } from "@aeco-dev/bonsaiweb";
import { defaultPaths } from "@aeco-dev/bonsaiweb/paths";
</script>The example in app/ uses that map, except @aeco-dev/bonsaiweb points at ../dist/ so a local rebuild shows up before the next publish.
defaultPaths is only the viewer scripts, zstd, and the worker shim. Those are not import specifiers.
The shell also needs configuration.ui, configuration.app, and configuration.ribbon. The example is app/configuration/config.js.
