partforge 0.168.0 → 0.169.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -198,16 +198,27 @@ second>` (a model with no playing animation turns until the first camera grab,
198
198
  never under `prefers-reduced-motion`), `fill: 0.8` (frame the model so its
199
199
  bounding box, as seen from the opening view, spans that fraction of the preview
200
200
  along its tighter axis — larger in a small card; with a turntable the model swept
201
- a full turn is framed, so it never clips as it turns and a round part still fills; the model is
202
- centred on its geometry, so a lopsided part turns about its hub), `camera: "default"` (drop the carried camera
201
+ a full turn is framed, so it never clips as it turns and a round part still fills, and it
202
+ turns about its hub; a model that is not turning has its on-screen outline centred, since 0.169.0), `camera: "default"` (drop the carried camera
203
203
  and projection and keep the file's own framing; a carried render mode and
204
204
  environment still apply) and `renderMode: "cad" | "realistic"` (the opening
205
- mode, over any carried one; it can change afterwards). An unknown option key
205
+ mode, over any carried one; it can change afterwards), and `autostart: false`
206
+ (0.169.0+: the animation or turntable waits at its first frame until
207
+ `handle.motion.start()`). An unknown option key
206
208
  throws. A baked animation always plays as authored — it
207
209
  loops, or plays once and holds its end pose. Every handle carries `drawn`, which
208
210
  resolves after the first frame showing the meshes, so a host can cross-fade from
209
211
  a still image.
210
212
 
213
+ `handle.motion` (0.169.0+; `null` before `ready` and once disposed) drives that
214
+ motion: `start()` begins a waiting one (idempotent), `restart()` puts the model
215
+ back as it opened — the opening camera framing, the animation from its start or
216
+ the turntable turning again — and starts it, `state` is `"waiting"`,
217
+ `"playing"`, `"stopped"` (a drag stopped the turntable, or nothing moves) or
218
+ `"finished"` (a play-once animation ended), and `onChange(cb)` hears each change.
219
+ Under `prefers-reduced-motion` nothing moves and `restart()` only resets the
220
+ camera; a turntable mount is framed for its full turn either way.
221
+
211
222
  ```js
212
223
  const glb = await runtime.exportPreview(); // Uint8Array: the view on screen
213
224
  mount(part, { createWorker, elements, preview: glb }); // drawn at once, replaced by the build
@@ -218,6 +229,8 @@ const card = mountPreview(cardStage, { // a landing-page card
218
229
  zoom: false, pan: false, turntable: 14, fill: 0.8, camera: "default", renderMode: "cad",
219
230
  });
220
231
  await card.drawn; // the first frame is on the canvas
232
+ // With autostart: false the card waits at that frame: fade it in, then
233
+ // card.motion.start(); a "replay" button calls card.motion.restart().
221
234
  ```
222
235
 
223
236
  Every `elements` entry defaults to the legacy global ID (`#app`, `#controls`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "partforge",
3
- "version": "0.168.0",
3
+ "version": "0.169.1",
4
4
  "description": "Turn a declarative part definition into a parametric-CAD web app (three.js + Manifold/Replicad). Requires a Vite-based consumer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -149,7 +149,7 @@
149
149
  "@monogrid/gainmap-js": "^3.4.0",
150
150
  "eslint": "^10.10.0",
151
151
  "globals": "^17.12.0",
152
- "happy-dom": "^20.10.6",
152
+ "happy-dom": "^21.0.4",
153
153
  "knip": "^6.35.1",
154
154
  "playwright": "^1.49.0",
155
155
  "sharp": "^0.35.4",