@chestnutlabs/gcode-preview-vue 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
  * and staying pure TypeScript keeps the package on the plain tsc build with typed props/emits.
11
11
  */
12
12
  import { type PropType } from 'vue';
13
- import type { BuildVolumeDef, ColorMode, QualityMode, TubeOptions } from '@chestnutlabs/gcode-renderer-three';
13
+ import type { BuildVolumeDef, CameraMode, ColorMode, QualityMode, Theme, TubeOptions } from '@chestnutlabs/gcode-renderer-three';
14
14
  import type { MachineGeometry, ProgressObservation } from '@chestnutlabs/toolpath-core';
15
15
  import type { WireParseOptions, WorkerLike } from '@chestnutlabs/gcode-parser';
16
16
  import { type UseGcodePreviewOptions } from './use-gcode-preview.js';
@@ -34,6 +34,16 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
34
34
  type: PropType<QualityMode | "auto">;
35
35
  default: string;
36
36
  };
37
+ /** #150 (DD-009 D3): camera projection. */
38
+ cameraMode: {
39
+ type: PropType<CameraMode>;
40
+ default: string;
41
+ };
42
+ /** #153 (DD-009 D4): bounded declarative theme. */
43
+ theme: {
44
+ type: PropType<Theme>;
45
+ default: undefined;
46
+ };
37
47
  colorMode: {
38
48
  type: PropType<ColorMode>;
39
49
  default: undefined;
@@ -56,6 +66,11 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
56
66
  type: BooleanConstructor;
57
67
  default: boolean;
58
68
  };
69
+ /** DD-009 D1 (#148): opt-in retraction/deretraction markers. */
70
+ showRetractions: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
59
74
  /** DD-006 live progress observation; null hides the overlay. */
60
75
  progress: {
61
76
  type: PropType<ProgressObservation | null>;
@@ -69,7 +84,7 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
69
84
  };
70
85
  /** Advanced/test renderer injectables (pass-throughs of the renderer contract). */
71
86
  rendererOptions: {
72
- type: PropType<Omit<NonNullable<UseGcodePreviewOptions["renderer"]>, "buildVolume" | "quality" | "colorMode" | "tube">>;
87
+ type: PropType<Omit<NonNullable<UseGcodePreviewOptions["renderer"]>, "buildVolume" | "quality" | "cameraMode" | "theme" | "colorMode" | "tube">>;
73
88
  default: undefined;
74
89
  };
75
90
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -128,6 +143,16 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
128
143
  type: PropType<QualityMode | "auto">;
129
144
  default: string;
130
145
  };
146
+ /** #150 (DD-009 D3): camera projection. */
147
+ cameraMode: {
148
+ type: PropType<CameraMode>;
149
+ default: string;
150
+ };
151
+ /** #153 (DD-009 D4): bounded declarative theme. */
152
+ theme: {
153
+ type: PropType<Theme>;
154
+ default: undefined;
155
+ };
131
156
  colorMode: {
132
157
  type: PropType<ColorMode>;
133
158
  default: undefined;
@@ -150,6 +175,11 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
150
175
  type: BooleanConstructor;
151
176
  default: boolean;
152
177
  };
178
+ /** DD-009 D1 (#148): opt-in retraction/deretraction markers. */
179
+ showRetractions: {
180
+ type: BooleanConstructor;
181
+ default: boolean;
182
+ };
153
183
  /** DD-006 live progress observation; null hides the overlay. */
154
184
  progress: {
155
185
  type: PropType<ProgressObservation | null>;
@@ -163,7 +193,7 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
163
193
  };
164
194
  /** Advanced/test renderer injectables (pass-throughs of the renderer contract). */
165
195
  rendererOptions: {
166
- type: PropType<Omit<NonNullable<UseGcodePreviewOptions["renderer"]>, "buildVolume" | "quality" | "colorMode" | "tube">>;
196
+ type: PropType<Omit<NonNullable<UseGcodePreviewOptions["renderer"]>, "buildVolume" | "quality" | "cameraMode" | "theme" | "colorMode" | "tube">>;
167
197
  default: undefined;
168
198
  };
169
199
  }>> & Readonly<{
@@ -205,22 +235,27 @@ export declare const GcodePreview: import("vue").DefineComponent<import("vue").E
205
235
  source: GcodePreviewSource;
206
236
  buildVolume: BuildVolumeDef | MachineGeometry;
207
237
  quality: QualityMode | "auto";
238
+ cameraMode: CameraMode;
239
+ theme: Theme;
208
240
  colorMode: ColorMode;
209
241
  tube: TubeOptions;
210
242
  parseOptions: WireParseOptions;
211
243
  layerRange: [number, number] | null;
212
244
  scrub: number | null;
213
245
  showTravel: boolean;
246
+ showRetractions: boolean;
214
247
  progress: ProgressObservation | null;
215
248
  createWorker: () => WorkerLike;
216
249
  rendererOptions: Omit<{
217
250
  buildVolume?: BuildVolumeDef;
218
251
  quality?: QualityMode | "auto";
252
+ cameraMode?: CameraMode;
219
253
  colorMode?: ColorMode;
220
254
  tube?: TubeOptions;
255
+ theme?: Theme;
221
256
  createRenderer?: (canvas: import("@chestnutlabs/gcode-renderer-three").RenderTargetCanvas) => import("@chestnutlabs/gcode-renderer-three").GLRendererLike;
222
257
  scheduleFrame?: (cb: () => void) => void;
223
258
  chunksPerTick?: number;
224
- }, "buildVolume" | "quality" | "colorMode" | "tube">;
259
+ }, "buildVolume" | "quality" | "cameraMode" | "theme" | "colorMode" | "tube">;
225
260
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
226
261
  //# sourceMappingURL=gcode-preview-component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gcode-preview-component.d.ts","sourceRoot":"","sources":["../src/gcode-preview-component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAA6C,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAC9G,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAsC,KAAK,sBA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CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;;;IACzE,iFAAiF;;cACxD,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;;;;IAEhD,gEAAgE;;;;;IAEhE,gEAAgE;;cACpC,QAAQ,CAAC,mBAAmB,GAAG,IAAI,CAAC;;;IAChE;sFACkF;;cAE9D,QAAQ,CAAC,MAAM,UAAU,CAAC;;;IAG9C,mFAAmF;;cAEjE,QAAQ,CACtB,IAAI,CACF,WAAW,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,EAC/C,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAC1E,CACF;;;;;;cAgBiB,MAAM;iBAAW,MAAM;;;kBAVb,MAAM;gBAAU,MAAM;kBAAY,OAAO;;;cAC3C,MAAM;iBAAW,MAAM;;;;wBAEV,MAAM;oBAAc,MAAM;;;kBAChC,MAAM;iBAAW,WAAW;;;cAC9B,WAAW;YAAM,WAAW;gBAAU,MAAM;;;;;cAG/B,MAAM;iBAAW,MAAM;;;;;;;;;;;;;;;;wBAxBlC,UAAU;;;;;;;;;;;;4EAsK/C,CAAC"}
@@ -20,6 +20,10 @@ export const GcodePreview = defineComponent({
20
20
  /** Consumer-configured volume — wins over file-discovered geometry (DD-005 precedence). */
21
21
  buildVolume: { type: Object, default: undefined },
22
22
  quality: { type: String, default: 'auto' },
23
+ /** #150 (DD-009 D3): camera projection. */
24
+ cameraMode: { type: String, default: 'perspective' },
25
+ /** #153 (DD-009 D4): bounded declarative theme. */
26
+ theme: { type: Object, default: undefined },
23
27
  colorMode: { type: Object, default: undefined },
24
28
  tube: { type: Object, default: undefined },
25
29
  /** Inclusive [start, end]; null shows every layer. */
@@ -27,6 +31,8 @@ export const GcodePreview = defineComponent({
27
31
  /** Scrub cut (IR segment index); null shows everything up to the layer range. */
28
32
  scrub: { type: Number, default: null },
29
33
  showTravel: { type: Boolean, default: true },
34
+ /** DD-009 D1 (#148): opt-in retraction/deretraction markers. */
35
+ showRetractions: { type: Boolean, default: false },
30
36
  /** DD-006 live progress observation; null hides the overlay. */
31
37
  progress: { type: Object, default: null },
32
38
  /** Worker factory escape hatch (DD-005 slim/custom entries; D2). Factory form only —
@@ -62,6 +68,8 @@ export const GcodePreview = defineComponent({
62
68
  renderer: {
63
69
  buildVolume: 'bed' in (props.buildVolume ?? {}) ? undefined : props.buildVolume,
64
70
  quality: props.quality,
71
+ cameraMode: props.cameraMode,
72
+ theme: props.theme,
65
73
  colorMode: props.colorMode,
66
74
  tube: props.tube,
67
75
  ...props.rendererOptions
@@ -124,11 +132,17 @@ export const GcodePreview = defineComponent({
124
132
  });
125
133
  watch(() => props.scrub, (scrub) => preview.controls.setScrubPosition(scrub));
126
134
  watch(() => props.showTravel, (visible) => preview.controls.setKindVisible('travel', visible));
135
+ watch(() => props.showRetractions, (visible) => preview.controls.setShowRetractions(visible));
127
136
  watch(() => props.colorMode, (mode) => {
128
137
  if (mode !== undefined)
129
138
  preview.controls.setColorMode(mode);
130
139
  });
131
140
  watch(() => props.quality, (quality) => preview.controls.setQuality(quality));
141
+ watch(() => props.cameraMode, (mode) => preview.controls.setCameraMode(mode));
142
+ watch(() => props.theme, (theme) => {
143
+ if (theme !== undefined)
144
+ preview.controls.setTheme(theme);
145
+ }, { deep: true });
132
146
  watch(() => props.buildVolume, (volume) => {
133
147
  if (volume !== undefined)
134
148
  preview.controls.setBuildVolume(volume);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chestnutlabs/gcode-preview-vue",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Thin Vue 3 integration for the Chestnut Labs G-code viewer (DD-007): useGcodePreview composable + GcodePreview component over the framework-neutral parser/renderer/progress packages.",
5
5
  "keywords": [
6
6
  "gcode",
@@ -50,10 +50,10 @@
50
50
  "test": "vitest run"
51
51
  },
52
52
  "dependencies": {
53
- "@chestnutlabs/gcode-parser": "0.1.0",
54
- "@chestnutlabs/gcode-renderer-three": "0.1.0",
55
- "@chestnutlabs/toolpath-core": "0.1.0",
56
- "@chestnutlabs/gcode-preview-core": "0.1.0"
53
+ "@chestnutlabs/gcode-parser": "0.2.0",
54
+ "@chestnutlabs/gcode-renderer-three": "0.2.0",
55
+ "@chestnutlabs/toolpath-core": "0.2.0",
56
+ "@chestnutlabs/gcode-preview-core": "0.2.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "vue": "^3.4.0"