Documentation - v20.0.0-dev
    Preparing search index...

    Documentation - v20.0.0-dev

    TeiaViewer

    Lines of Code Duplicated Lines (%) Coverage Code Smells Vulnerabilities Bugs

    Web-based 3D viewer built on three.js. Since v20 it draws with its own engine (@stereograph/teiaviewer-engine: WebGPU, with a WebGL2 fallback) instead of the three.js render stack of v19. Moving an application from v19 to v20: see MIGRATION.md.

    You can automatically load a Twin or a File from TeiaTwin when logged in by using url params.

    Branch Version Deployed to
    master v20 (current major) https://teiaviewer.teia-solution.com
    legacy v19 (previous major) https://teiaviewerlegacy.teia-solution.com
    future/* next major, in preparation built and tested, never published

    Release branches follow release/<version>: release/19.* branches and v19.* tags build and merge back into legacy, the others into master.

    The code is a monorepo divided in packages, published to the npm feed, and apps using npm workspaces. Turborepo is used to manage the build dependency.

    • For production builds, packages are built in dependency order and their dist is used in further build steps
    • For development, the apps directly use the source code of the packages through the custom condition "@teiaviewer/custom-condition".
    Package Name Objective
    packages/engine @stereograph/teiaviewer-engine 3D engine: mesh storage, scene BVH, picking, rendering (WebGPU, WebGL2 fallback), file loading contract (headless); see its README
    packages/viewer @stereograph/teiaviewer Core 3D scene on the engine: scene graph, object state, loading, commands (undo/redo), camera (headless)
    packages/plugins @stereograph/teiaviewer-plugins Core add-ons, each adding an independent functionality (headless)
    packages/viewport @stereograph/teiaviewer-viewport-react React UI of the viewer, with the widgets system
    packages/plugins-ui @stereograph/teiaviewer-plugins-ui-react React UI widgets for the plugins (depends on plugins)
    packages/legacy-plugins @stereograph/teiaviewer-legacy-plugins Old plugins, independent, kept for backward compatibility

    Dependency direction (a ← b: b depends on a): engine ← viewer ← plugins ← plugins-ui, and viewer ← viewport ← plugins-ui. engine depends on no other package of the repository.

    Headless packages (engine, viewer, plugins) never depend on React. New features go to plugins / plugins-ui, not to legacy-plugins.

    App Objective
    apps/demo Demo application, the development entry point (npm run dev)
    apps/docs API reference of the packages, generated with TypeDoc
    apps/code-snippets Examples of the public API, listed on the demo website

    Warning: Since development is using source code from packages directly, any marked @internal function or property would be accessible to packages using other packages. You should not use these internals. This behavior is not allowed in production build. Thus, results may differ between development and production builds.

    The practical effect is:

    • In dev: everything resolves to src, hot reload works across package boundaries without intermediate builds
    • In production: the conditions aren't active, so normal dist resolution applies and @internal symbols are properly encapsulated

    Custom conditions are declared in tsconfig.json and activated in vite.config.ts of each package and app.

    dev -- Starts the development of the demo app

    build -- Build packages and apps via turbo

    build:watch -- Build packages and apps, and rebuild on change

    build:apps -- Build only apps (and dependent packages)

    build:packages -- Build only packages

    build:demo / build:demo:watch -- Build only the demo app (and its packages), once or on change

    build:website -- Build the main page of the demo website using the apps dist

    serve -- Will serve the website build

    pack:local -- Build the packages and pack them as local tarballs (local-packages/), to try them in another project

    publish:prepare -- CI only: rewrite the packages' package.json before publishing to the npm feed (never commit the result)

    test -- Starts the test via vitest in watch mode

    test:run -- Run the tests once and exit (for scripts and CI)

    test:coverage -- Run the tests once and gather coverage

    lint / lint:fix -- Lint the packages and apps sources (and fix what can be fixed)

    lint:errors -- Lint, reporting only the errors

    knip -- Find unused files, exports and dependencies

    i18n:extract -- Extract the i18n translation keys into the locales dict

    i18n:status -- Show the translation status of the locales

    spell -- Will check source code spelling

    clean -- Remove the dist, build and cache directories of the repository and every workspace