@chestnutlabs/gcode-preview-core 0.1.0 → 0.2.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.
@@ -10,7 +10,7 @@
10
10
  * only (numbers/strings): IR/typed arrays NEVER enter the state model.
11
11
  */
12
12
  import { GcodeParseSession, type ParseProgress, type ParseResult, type SessionOptions, type WireParseOptions } from '@chestnutlabs/gcode-parser';
13
- import { ToolpathRenderer, type BuildVolumeDef, type ColorMode, type GLRendererLike, type ProgressPresentationMode, type QualityMode, type RenderTargetCanvas, type RendererEvent, type TubeOptions } from '@chestnutlabs/gcode-renderer-three';
13
+ import { ToolpathRenderer, type BuildVolumeDef, type CameraMode, type ColorMode, type GLRendererLike, type ProgressPresentationMode, type QualityMode, type RenderTargetCanvas, type RendererEvent, type Theme, type TubeOptions } from '@chestnutlabs/gcode-renderer-three';
14
14
  import { type Confidence, type DialectMetadata, type MachineGeometry, type MappedProgress, type ProgressObservation } from '@chestnutlabs/toolpath-core';
15
15
  /** Session/renderer events, re-emitted, plus the controller's own lifecycle events. */
16
16
  export type PreviewEvent = RendererEvent | {
@@ -42,8 +42,12 @@ export interface PreviewControllerOptions {
42
42
  renderer?: {
43
43
  buildVolume?: BuildVolumeDef;
44
44
  quality?: QualityMode | 'auto';
45
+ /** Camera projection (#150, DD-009 D3); default 'perspective'. */
46
+ cameraMode?: CameraMode;
45
47
  colorMode?: ColorMode;
46
48
  tube?: TubeOptions;
49
+ /** Bounded declarative theme (#153, DD-009 D4). */
50
+ theme?: Theme;
47
51
  /** Advanced/test injectables — pass-throughs of the renderer's own contract. */
48
52
  createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
49
53
  scheduleFrame?: (cb: () => void) => void;
@@ -95,8 +99,14 @@ export interface GcodePreviewControls {
95
99
  setLayerRange(startLayer: number, endLayer: number): void;
96
100
  setScrubPosition(segIndex: number | null): void;
97
101
  setKindVisible(kind: 'extrude' | 'travel', visible: boolean): void;
102
+ /** Opt-in retraction/deretraction markers (DD-009 D1, #148). Off by default. */
103
+ setShowRetractions(visible: boolean): void;
98
104
  setColorMode(mode: ColorMode): boolean;
99
105
  setQuality(quality: QualityMode | 'auto'): void;
106
+ /** Switch camera projection (#150, DD-009 D3). */
107
+ setCameraMode(mode: CameraMode): void;
108
+ /** Apply a bounded declarative theme (#153, DD-009 D4). */
109
+ setTheme(theme: Theme): void;
100
110
  /** Marks the volume consumer-configured: file-discovered geometry stops auto-applying. */
101
111
  setBuildVolume(def: BuildVolumeDef | MachineGeometry): void;
102
112
  frame(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,iBAAiB,EAGjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EAEzB,MAAM,6BAA6B,CAAC;AAErC,uFAAuF;AACvF,MAAM,MAAM,YAAY,GACpB,aAAa,GACb;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QA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IACnD,aAAa,IAAI,IAAI,CAAC;IACtB,iFAAiF;IACjF,QAAQ,IAAI,iBAAiB,CAAC;IAC9B,oEAAoE;IACpE,aAAa,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAClE,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,sEAAsE;IACtE,GAAG,EAAE;QAAE,OAAO,EAAE,iBAAiB,CAAC;QAAC,QAAQ,EAAE,MAAM,gBAAgB,GAAG,IAAI,CAAA;KAAE,CAAC;IAC7E,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC;CACjB;AAmBD,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,wBAA6B,GAAG,iBAAiB,CAmPjG"}
@@ -103,8 +103,10 @@ export function createPreviewController(options = {}) {
103
103
  canvas,
104
104
  buildVolume: r.buildVolume,
105
105
  quality: r.quality ?? 'auto',
106
+ cameraMode: r.cameraMode,
106
107
  colorMode: r.colorMode,
107
108
  tube: r.tube,
109
+ theme: r.theme,
108
110
  createRenderer: r.createRenderer,
109
111
  scheduleFrame: r.scheduleFrame,
110
112
  chunksPerTick: r.chunksPerTick
@@ -209,8 +211,11 @@ export function createPreviewController(options = {}) {
209
211
  setLayerRange: (a, b) => renderer?.setLayerRange(a, b),
210
212
  setScrubPosition: (s) => renderer?.setScrubPosition(s),
211
213
  setKindVisible: (k, v) => renderer?.setKindVisible(k, v),
214
+ setShowRetractions: (v) => renderer?.setShowRetractions(v),
212
215
  setColorMode: (m) => renderer?.setColorMode(m) ?? false,
213
216
  setQuality: (q) => renderer?.setQuality(q),
217
+ setCameraMode: (m) => renderer?.setCameraMode(m),
218
+ setTheme: (t) => renderer?.setTheme(t),
214
219
  setBuildVolume: (def) => {
215
220
  consumerVolumeSet = true;
216
221
  renderer?.setBuildVolume(def);
package/dist/index.d.ts CHANGED
@@ -6,4 +6,5 @@
6
6
  */
7
7
  export * from './controller.js';
8
8
  export { renderStill, type RenderStillOptions, type RenderStillResult, type StillCameraPose } from './render-still.js';
9
+ export type { Theme, MaterialPreset, ThemeColor } from '@chestnutlabs/gcode-renderer-three';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEvH,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC"}
@@ -19,7 +19,7 @@
19
19
  * identity is NOT promised (antialiasing varies); cache by job identity.
20
20
  */
21
21
  import { type SessionOptions, type WireParseOptions } from '@chestnutlabs/gcode-parser';
22
- import { type BuildVolumeDef, type ColorMode, type GLRendererLike, type QualityMode, type RenderTargetCanvas, type TubeOptions } from '@chestnutlabs/gcode-renderer-three';
22
+ import { type BuildVolumeDef, type CameraMode, type ColorMode, type GLRendererLike, type QualityMode, type RenderTargetCanvas, type Theme, type TubeOptions } from '@chestnutlabs/gcode-renderer-three';
23
23
  import { type MachineGeometry, type ToolpathIR } from '@chestnutlabs/toolpath-core';
24
24
  /** Explicit camera pose (scene coordinates), overriding the deterministic frame(). */
25
25
  export interface StillCameraPose {
@@ -36,8 +36,12 @@ export interface RenderStillOptions {
36
36
  height?: number;
37
37
  /** Quality tier (default 'auto': tubes ≤ 1 M segments, else lines). */
38
38
  quality?: QualityMode | 'auto';
39
+ /** Camera projection (#150, DD-009 D3); default 'perspective'. */
40
+ cameraMode?: CameraMode;
39
41
  colorMode?: ColorMode;
40
42
  tube?: TubeOptions;
43
+ /** Bounded declarative theme (#153, DD-009 D4); headless stills theme identically. */
44
+ theme?: Theme;
41
45
  /** Bed geometry — a renderer volume or discovered MachineGeometry. */
42
46
  buildVolume?: BuildVolumeDef | MachineGeometry;
43
47
  /** Inclusive layer clip [start, end]. Omitted → whole model. */
@@ -1 +1 @@
1
- {"version":3,"file":"render-still.d.ts","sourceRoot":"","sources":["../src/render-still.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEpF,sFAAsF;AACtF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,sFAAsF;IACtF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC/B,SAAS,C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IACxC,gFAAgF;IAChF,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,cAAc,CAAC;CACjE;AAED,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,OAAO,EAAE,WAAW,CAAC;IACrB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;CACjB;AAkBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,EAC7C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA6F5B"}
@@ -61,6 +61,8 @@ export async function renderStill(source, options) {
61
61
  const renderer = new ToolpathRenderer({
62
62
  canvas,
63
63
  quality: options.quality ?? 'auto',
64
+ ...(options.cameraMode ? { cameraMode: options.cameraMode } : {}),
65
+ ...(options.theme ? { theme: options.theme } : {}),
64
66
  ...(options.colorMode ? { colorMode: options.colorMode } : {}),
65
67
  ...(options.tube ? { tube: options.tube } : {}),
66
68
  ...(options.buildVolume ? { buildVolume: toVolume(options.buildVolume) } : {}),
@@ -99,9 +101,14 @@ export async function renderStill(source, options) {
99
101
  renderer.setScrubPosition(options.scrub);
100
102
  const pose = options.camera;
101
103
  if (pose) {
102
- if (pose.fov !== undefined) {
103
- renderer.camera.fov = pose.fov;
104
- renderer.camera.updateProjectionMatrix();
104
+ // `fov` only applies to the perspective projection; on an orthographic camera
105
+ // it is meaningless and absent from the union type. Ortho frustum sizing already
106
+ // happened in setIR()→frame() from the model bounds. Structural cast keeps this
107
+ // module free of a direct `three` import (three is the renderer's peer dep).
108
+ if (pose.fov !== undefined && (options.cameraMode ?? 'perspective') === 'perspective') {
109
+ const cam = renderer.camera;
110
+ cam.fov = pose.fov;
111
+ cam.updateProjectionMatrix();
105
112
  }
106
113
  renderer.camera.position.set(pose.position[0], pose.position[1], pose.position[2]);
107
114
  renderer.camera.lookAt(pose.target[0], pose.target[1], pose.target[2]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chestnutlabs/gcode-preview-core",
3
- "version": "0.1.0",
4
- "description": "Framework-neutral preview controller for the Chestnut Labs G-code viewer (DD-007 \u00a74.6): the shared engine glue, state model, and TypeScript contracts beneath the Vue/React/Svelte adapters.",
3
+ "version": "0.2.0",
4
+ "description": "Framework-neutral preview controller for the Chestnut Labs G-code viewer (DD-007 §4.6): the shared engine glue, state model, and TypeScript contracts beneath the Vue/React/Svelte adapters.",
5
5
  "keywords": [
6
6
  "gcode",
7
7
  "3d-printing",
@@ -52,8 +52,8 @@
52
52
  "test": "vitest run"
53
53
  },
54
54
  "dependencies": {
55
- "@chestnutlabs/gcode-parser": "0.1.0",
56
- "@chestnutlabs/gcode-renderer-three": "0.1.0",
57
- "@chestnutlabs/toolpath-core": "0.1.0"
55
+ "@chestnutlabs/gcode-parser": "0.2.0",
56
+ "@chestnutlabs/gcode-renderer-three": "0.2.0",
57
+ "@chestnutlabs/toolpath-core": "0.2.0"
58
58
  }
59
59
  }