Skip to content

1.2.0

Choose a tag to compare

@matas-bitbybit-dev matas-bitbybit-dev released this 11 Sep 10:17
· 52 commits to master since this release
b500025

Release Notes v1.2.0

This release is about making the library honest and reliable: every CAD package is now compiled under the full TypeScript strict set, the test suites moved to Vitest with real assertions and a coverage floor, and the public API surface of every package is pinned with API Extractor reports. That work surfaced and fixed a long list of real defects - in cameras, drawing, colours, splitting, imports and worker dispatch - that the previous typings had been hiding. On top of that: a rebuilt draw entity model with proper result types, a generated worker API layer held in step with the kernel, and the Verb NURBS API is deprecated ahead of its removal in the next major.

If you consume the packages from TypeScript, expect better types, fewer anys and a few corrected behaviours listed below.


Type safety & API surface

Full strict mode across all packages

  • All thirteen packages compile with strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, noUnusedLocals and noUnusedParameters. Optional inputs are now spelled T | undefined, so a strict consumer can pass optional values straight through.
  • genericCallToWorkerPromise is generic (<T = unknown>), so a worker call's declared return type is the type you get instead of Promise<any>.
  • JSCAD entities are typed: JSCADEntity is now JSCADGeom2 | JSCADGeom3 | JSCADPath2 (structural mirrors of @jscad/modeling), no longer any. asSolid / asPath / asRegion name the operation and what arrived when a kind mismatches.
  • JSON API inputs are unknown instead of any; returns keep any deliberately (the caller knows the shape).
  • The public API of every package is pinned in etc/<package>.api.md; a surface change is now a reviewed diff.

A real entity model for draw

  • bitbybit.draw.drawAnyAsync / drawAny resolve their result from what you passed: a shape gives the engine scene object, a tag gives a tag, an empty list gives undefined (Draw.Drawn<E, T>, DrawnEntity). No more narrowing a four-arm union or asserting through unknown.
  • Entity detection is one ordered table shared by all three renderers (it was three hand-copied chains that had drifted apart), and drawingTypes is a string enum with identical membership everywhere.
  • JSCAD Path2 now has its own draw handler - it used to fall through to the 3D polyline path and draw the wrong thing. Its accumulated transforms are applied.
  • Manifold pointers carry a literal type tag, as OCCT pointers already did.

Deprecations

  • bitbybit.verb.* (curves, surfaces, intersections) is deprecated and will be removed in the next major. Verbnurbs has not been maintained upstream since 2022 and ships no usable typings. Drawing does not depend on it - anything with a tessellate still draws.
  • bitbybit.jscad.polygon.createFromCurve is deprecated with it.

Fixes

Geometry (OCCT, Manifold, JSCAD)

  • bitbybit.manifold.booleans.splitByPlaneOnOffsets was discarding the remainder after the last cut: n offsets gave n pieces and lost the rest. It now returns n + 1 pieces and the whole solid is accounted for; a solid entirely before an offset comes back whole.
  • Manifold from polygon points rebuilds vertex identity on a tolerance grid instead of exact equality, so closed geometry touched by floating-point arithmetic no longer fails with "Not manifold".
  • STEP / IGES readers now check the transferred shape as well as the reader status - a file that parses but yields no model returns nothing instead of a null shape.
  • List-variant fillets and chamfers and wire.fromPoints throw a clear error on mismatched lists or fewer than two points instead of silently returning undefined.
  • A failed STEP transfer rethrew a bare object ([object Object]); it throws a proper Error with the message and cause.
  • SVG import: elements that are neither drawn nor deliberately skipped (use, text, image, foreignObject, ...) now produce a warning per tag, with advice, instead of an empty scene.
  • Worker parity: several worker paths dispatched to kernel methods that did not exist or with DTO fields the kernel never read (assembly.manager.deleteDocument, setDocLabelColor, setDocLabelName, hull, fromBaseLines on edges and wires, vertexToPoint, manifold scale, mesh evaluate transform) - all now work. A parity check pins the two layers together.
  • Vector.removeAllDuplicateVectors is indexed rather than quadratic: 80 000 points went from ~11.5 s to ~30 ms with identical results.

Rendering (BabylonJS, ThreeJS, PlayCanvas)

  • Polyline colours: a polyline's own colour no longer repaints every polyline that had none (JSCAD geometry with baked colours rendered wrongly in all three engines; PlayCanvas ignored per-polyline colours entirely).
  • Redraw leaks: drawSurfacesMultiColour (Babylon) and polyline groups (ThreeJS) orphaned a container on every update; updates now reuse the instance you pass in.
  • Drawing a closed JSCAD path no longer appends a point to your own geometry, and the closing segment stays in the path's plane.
  • shapeToMesh now actually fills the normals array it always declared.
  • Colour components outside 0-1 are clamped and reported instead of producing an invalid hex string.
  • BabylonJS: arcRotate.create no longer flips negative alpha/beta; camera.getSpeed returns a number (it returned the target); mesh.createMeshInstanceAndTransform used radians for meshes with children and degrees for those without - degrees everywhere now; gaussianSplatting.getSplatPositions read the wrong stride and mixed splat coordinates; enablePointerMoveEvents with includeChildren disabled the children; targetCamera.create named every camera "freeCamera"; exportMeshesToStl pushed into a list that was never created; clearAllDrawn no longer leaves a null in the scene's transform nodes.
  • ThreeJS: the animation loop now measures the real frame delta instead of assuming 1/60 s, so camera inertia and onRender integration run at the correct speed on 120 Hz and 30 Hz displays (clamped to 0.1 s). Lines are never drawn thinner than a pixel.
  • PlayCanvas: drawing a tag threw on every call; two-sided and back-face colour options were read from the wrong place.

Tooling, packaging & docs

  • Packages are one pnpm workspace with exact pins; each package declares the dependencies it actually imports (verb-nurbs-web, jsonpath-plus, rxjs, @bitbybit-dev/base and the workers are explicit now instead of hoisted).
  • The three OCCT WASM kernels are no longer tracked in git - packages/dev/occt/kernels.json names each variant with its size and SHA-256, and npm run kernels:fetch downloads and verifies them. The @bitbybit-dev/occt tarball ships a NOTICE and the OCCT and Draco license texts.
  • The worker API layer is generated from the kernel and the OCCT inputs are authored as fragments assembled into one namespace; the build order is derived from the package manifests (tsc -b).
  • Packages are published with npm trusted publishing (OIDC); prereleases go to their own dist-tag.
  • @bitbybit-dev/cad-cloud-sdk types regenerated from the current OpenAPI document, with a version check before publish; ./package.json is exposed from its exports map.
  • @bitbybit-dev/create-app fails loudly if the kernel-architecture patch does not match the template, instead of scaffolding a kernel you did not choose.
  • Examples: every example is verified on its own and weekly; Create React App examples moved to Vite; high advisories cleared from every example lockfile.
  • Docs: the TypeScript API reference is now at https://docs.bitbybit.dev and linked from every package README; learn.bitbybit.dev SEO audit fixes; Docusaurus 3.7 -> 3.10; AI context files (llms.txt) are published beside the release assets.
  • Dependabot enabled and a GitHub Advisory Database check gates the tree; a nightly workflow runs the Node version matrix.

Dependencies

  • Engine versions are unchanged in this release: BabylonJS 9.13, ThreeJS 0.185.0, PlayCanvas 2.20.0, Manifold 3.3.2, JSCAD modeling 2.12.3.
  • OCCT kernel builds are unchanged from v1.1.1.
  • Development tooling: Jest -> Vitest 4, ESLint 10, TypeScript 5.9.3, pnpm 11.