partforge 0.142.0 → 0.143.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/types/part.d.ts CHANGED
@@ -350,6 +350,7 @@ export type DeriveSpec<P = ResolvedParams, D = Derived> =
350
350
 
351
351
  // --- sub-parts --------------------------------------------------------------
352
352
 
353
+ /** The argument to the LEGACY `place` (views-array form); the `views` map form needs none. */
353
354
  export interface PlaceContext<P = ResolvedParams, D = Derived> {
354
355
  /** The active view. Display placement must NOT depend on it. */
355
356
  view: string;
@@ -367,12 +368,18 @@ export interface SubPartDefinition<P = ResolvedParams, D = Derived> {
367
368
  */
368
369
  build: (k: GeometryKernel, p: P, d: D, onProgress?: (phase: string) => void) => Solid;
369
370
  /**
370
- * Optional reposition (default identity), for a part whose display pose
371
+ * LEGACY form (with a `views` array); with a `views` map put each pose in its
372
+ * entry instead. Optional reposition (default identity), for a part whose display pose
371
373
  * differs from its export pose. Any such difference must be a RIGID motion.
372
374
  */
373
375
  place?: (solid: Solid, ctx: PlaceContext<P, D>) => Solid;
374
- /** Which views show this sub-part. Every name must exist in `views`. */
375
- views: string[];
376
+ /**
377
+ * Each view the sub-part appears in: a map of view name to `true` (shown as
378
+ * built) or a rigid pose `(s, p, d) => s.translate(…)`. Every name must exist in
379
+ * the part's `views`. The legacy form, an array of names (placed by `place`),
380
+ * still works.
381
+ */
382
+ views: string[] | Record<string, true | ((s: Solid, p: P, d: D) => Solid)>;
376
383
  /** Gate a conditional sub-part. Coerced with `!!`. */
377
384
  enabled?: (p: P) => unknown;
378
385
  /** `false` = reference/preview-only: shown in the viewer, never exported. */