partforge 0.156.0 → 0.158.0

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/oracle.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  // report/mask/gap types a caller needs to annotate results. The semantic mesh
6
6
  // oracle (`describe`) is its own closed package now — its types ship with it, and
7
7
  // the direction of this seam is what lets that package consume these helpers.
8
+ import type { CameraCue, Easing, Keyframes, ParamValue, PartDefinition } from "./part.js";
8
9
  export type { GeometryKernel, Mesh, PartDefinition, ResolvedParams, Solid } from "./testing.js";
9
10
  export {
10
11
  // measurement + verification
@@ -29,3 +30,80 @@ export {
29
30
  annotationRay, rayPlane,
30
31
  type AnnotationRay, type RayPlaneHit, type PlaneSpec,
31
32
  } from "./testing.js";
33
+
34
+ /** One step of a normalized animation (every optional field filled in). */
35
+ export interface NormalizedAnimationStep {
36
+ /** `null` for the single anonymous step of a bare-`tracks` animation. */
37
+ label: string | null;
38
+ duration: number;
39
+ easing: Easing;
40
+ tracks: Record<string, Keyframes>;
41
+ opacity: Record<string, Keyframes>;
42
+ camera: CameraCue | null;
43
+ }
44
+
45
+ /** A camera cue on the normalized timeline: fires at `t`, sweeping for `sweep` seconds. */
46
+ export interface NormalizedAnimationCue {
47
+ t: number;
48
+ view: CameraCue;
49
+ /** Seconds; `null` for a lone intro angle. */
50
+ sweep: number | null;
51
+ }
52
+
53
+ /** An animation in the canonical shape every consumer (playback, lint, CLI, preview) works against. */
54
+ export interface NormalizedAnimation {
55
+ name: string;
56
+ label: string;
57
+ description: string | null;
58
+ loop: boolean;
59
+ autoplay: boolean;
60
+ steps: NormalizedAnimationStep[];
61
+ /** Each step's start as normalized t. */
62
+ stepStarts: number[];
63
+ /** Seconds. */
64
+ totalDuration: number;
65
+ cues: NormalizedAnimationCue[];
66
+ /** Params any step tracks. */
67
+ trackedKeys: string[];
68
+ /** Sub-parts any step fades. */
69
+ opacityKeys: string[];
70
+ }
71
+
72
+ /** One sampled instant of a baked preview animation. */
73
+ export interface PreviewAnimationSample {
74
+ /** Normalized time in [0, 1]. */
75
+ t: number;
76
+ /** Sub-part name → column-major model-frame place matrix (16 numbers). */
77
+ poses: Record<string, number[]>;
78
+ /** Sub-part name → opacity 0–1; `{}` when the animation declares no fades. */
79
+ opacity: Record<string, number>;
80
+ }
81
+
82
+ /** What `samplePreviewAnimation` returns for a bakeable autoplay animation. */
83
+ export interface PreviewAnimationInput {
84
+ anim: NormalizedAnimation;
85
+ /** Sorted by `t`; the first has `t === 0`, the last `t === 1`. */
86
+ samples: PreviewAnimationSample[];
87
+ /** Sub-part name → place matrix at the params handed in. */
88
+ base: Record<string, number[]>;
89
+ }
90
+
91
+ /** Sampling grid rate over the animation's real duration, in Hz. */
92
+ export const PREVIEW_SAMPLE_HZ: 30;
93
+ /** Most samples one preview animation carries; the grid thins, keyframe times never do. */
94
+ export const PREVIEW_SAMPLE_CAP: 600;
95
+
96
+ /**
97
+ * Decide whether the view's autoplay animation can be baked into the preview
98
+ * GLB — every tracked param place-only (the build reads none, and place() is a
99
+ * rigid motion at every sample) and the shown sub-parts constant — and if so
100
+ * sample the place matrices along its timeline. `buildReads(name)` returns the
101
+ * param keys that sub-part's build read, or `null` when unknown. Returns `null`
102
+ * when there is no autoplay animation or any check fails; never throws.
103
+ */
104
+ export function samplePreviewAnimation(
105
+ part: PartDefinition,
106
+ view: string,
107
+ params?: Record<string, ParamValue>,
108
+ options?: { buildReads: (name: string) => ReadonlySet<string> | null },
109
+ ): PreviewAnimationInput | null;
package/types/part.d.ts CHANGED
@@ -576,6 +576,8 @@ export interface SubPartExpectations {
576
576
  routedEmpty?: Expectation;
577
577
  /** Routed parts only: separate regions in the cut profile (volunteered check: `1`). */
578
578
  routedPieces?: Expectation;
579
+ /** Routed parts only: overlapping near- and far-face pocket pairs whose depths together exceed the stock (volunteered check: `0`). */
580
+ routedBreakthrough?: Expectation;
579
581
  }
580
582
 
581
583
  /**
@@ -11,6 +11,12 @@ import type { Derived, FontSource, PartDefinition, ResolvedParams } from "./part
11
11
  import type { KitOptions } from "./index.js";
12
12
 
13
13
  export type { Derived, GeometryKernel, Mesh, PartDefinition, ResolvedParams, Solid };
14
+ // Declared in oracle.d.ts (its own surface); testing.js re-exports all of oracle.js.
15
+ export {
16
+ samplePreviewAnimation, PREVIEW_SAMPLE_HZ, PREVIEW_SAMPLE_CAP,
17
+ type PreviewAnimationInput, type PreviewAnimationSample, type NormalizedAnimation,
18
+ type NormalizedAnimationStep, type NormalizedAnimationCue,
19
+ } from "./oracle.js";
14
20
 
15
21
  // --- kernels ----------------------------------------------------------------
16
22
 
@@ -184,12 +190,17 @@ export function meshGaps(built: BuiltSubPart[], opts?: { bvhCache?: Map<Mesh, BV
184
190
  /**
185
191
  * Build every sub-part of a view in its display pose. Keeps solids LIVE (does
186
192
  * NOT call `kernel.cleanup()`) so callers can read exact solid facts first.
193
+ *
194
+ * `readsBySubPart`, when given, is filled with each sub-part's name → the params
195
+ * its `build()` read (expanded through derived values). `place()` reads are
196
+ * excluded, so a pose-only param never reads as a rebuild.
187
197
  */
188
198
  export function buildView(
189
199
  kernel: GeometryKernel,
190
200
  part: PartDefinition,
191
201
  view: string,
192
202
  params?: ResolvedParams,
203
+ opts?: { readsBySubPart?: Map<string, string[]> },
193
204
  ): BuiltSubPart[];
194
205
 
195
206
  // --- mesh math --------------------------------------------------------------