@chestnutlabs/gcode-preview-element 0.6.0 → 0.7.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.
|
@@ -16,7 +16,7 @@ import type { MachineGeometry, MappedProgress, ProgressObservation } from '@ches
|
|
|
16
16
|
import type { WireParseOptions, WorkerLike } from '@chestnutlabs/gcode-parser';
|
|
17
17
|
export type GcodePreviewSource = Uint8Array | ArrayBuffer | File | null;
|
|
18
18
|
/** Advanced/test renderer injectables (pass-throughs of the controller's renderer contract). */
|
|
19
|
-
export type ElementRendererOptions = Omit<NonNullable<PreviewControllerRenderer>, 'buildVolume' | 'quality' | 'cameraMode' | 'theme' | 'colorMode' | 'tube'>;
|
|
19
|
+
export type ElementRendererOptions = Omit<NonNullable<PreviewControllerRenderer>, 'buildVolume' | 'quality' | 'cameraMode' | 'frameContent' | 'interactionQuality' | 'theme' | 'colorMode' | 'tube'>;
|
|
20
20
|
type PreviewControllerRenderer = NonNullable<Parameters<typeof createPreviewController>[0]>['renderer'];
|
|
21
21
|
/** The default tag name (DD-009 §4.5). */
|
|
22
22
|
export declare const DEFAULT_TAG = "gcode-preview";
|
|
@@ -56,6 +56,12 @@ export declare class GcodePreviewElement extends HTMLElement {
|
|
|
56
56
|
set quality(v: string | null);
|
|
57
57
|
get cameraMode(): string | null;
|
|
58
58
|
set cameraMode(v: string | null);
|
|
59
|
+
/** #306/#6: frame the printed 'object' (excl. skirt/prime) or 'all' extrusion. */
|
|
60
|
+
get frameContent(): string | null;
|
|
61
|
+
set frameContent(v: string | null);
|
|
62
|
+
/** #306/2 (DD-020): 'auto' reduces detail while the camera moves. */
|
|
63
|
+
get interactionQuality(): string | null;
|
|
64
|
+
set interactionQuality(v: string | null);
|
|
59
65
|
/** #268/#275/M6: preset orientation attribute (top/front/iso/…). */
|
|
60
66
|
get view(): string | null;
|
|
61
67
|
set view(v: string | null);
|
|
@@ -72,6 +78,9 @@ export declare class GcodePreviewElement extends HTMLElement {
|
|
|
72
78
|
/** Default false; only `show-retractions="true"` shows markers. */
|
|
73
79
|
get showRetractions(): boolean;
|
|
74
80
|
set showRetractions(v: boolean);
|
|
81
|
+
/** #306/#6: build-volume cage, independent of the plate. Default true; `show-volume-cage="false"` hides it. */
|
|
82
|
+
get showVolumeCage(): boolean;
|
|
83
|
+
set showVolumeCage(v: boolean);
|
|
75
84
|
get scrub(): number | null;
|
|
76
85
|
set scrub(v: number | null);
|
|
77
86
|
/** Time-based scrub cut in ms of print time (#181). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcode-preview-element.d.ts","sourceRoot":"","sources":["../src/gcode-preview-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAElB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EAEX,SAAS,EACT,KAAK,EACL,WAAW,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE/E,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AAExE,gGAAgG;AAChG,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,CAAC,yBAAyB,CAAC,EACtC,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"gcode-preview-element.d.ts","sourceRoot":"","sources":["../src/gcode-preview-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,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AAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAExC;IACD,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAExC;IAGD,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IACD,IAAI,QAAQ,IAAI,oBAAoB,CAEnC;IACD,IAAI,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAElC;IACD,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAG7F,eAAe,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc,GAAG,IAAI;IAGhE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAGlD,aAAa,IAAI,IAAI;IAGrB,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI;IAKlD,iBAAiB,IAAI,IAAI;IAsCzB,oBAAoB,IAAI,IAAI;IAO5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAiDvF,kGAAkG;IAClG,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,iBAAiB;IAOzB,kEAAkE;IAClE,OAAO,CAAC,MAAM;CAmDf;AASD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAoB,GAAG,IAAI,CAGlE"}
|
|
@@ -15,10 +15,13 @@ import { createPreviewController } from '@chestnutlabs/gcode-preview-core';
|
|
|
15
15
|
const OBSERVED = [
|
|
16
16
|
'quality',
|
|
17
17
|
'camera-mode',
|
|
18
|
+
'frame-content',
|
|
19
|
+
'interaction-quality',
|
|
18
20
|
'view',
|
|
19
21
|
'show-travel',
|
|
20
22
|
'show-wipe',
|
|
21
23
|
'show-retractions',
|
|
24
|
+
'show-volume-cage',
|
|
22
25
|
'scrub',
|
|
23
26
|
'scrub-time',
|
|
24
27
|
'layer-range'
|
|
@@ -119,6 +122,20 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
119
122
|
set cameraMode(v) {
|
|
120
123
|
this.reflect('camera-mode', v);
|
|
121
124
|
}
|
|
125
|
+
/** #306/#6: frame the printed 'object' (excl. skirt/prime) or 'all' extrusion. */
|
|
126
|
+
get frameContent() {
|
|
127
|
+
return this.getAttribute('frame-content');
|
|
128
|
+
}
|
|
129
|
+
set frameContent(v) {
|
|
130
|
+
this.reflect('frame-content', v);
|
|
131
|
+
}
|
|
132
|
+
/** #306/2 (DD-020): 'auto' reduces detail while the camera moves. */
|
|
133
|
+
get interactionQuality() {
|
|
134
|
+
return this.getAttribute('interaction-quality');
|
|
135
|
+
}
|
|
136
|
+
set interactionQuality(v) {
|
|
137
|
+
this.reflect('interaction-quality', v);
|
|
138
|
+
}
|
|
122
139
|
/** #268/#275/M6: preset orientation attribute (top/front/iso/…). */
|
|
123
140
|
get view() {
|
|
124
141
|
return this.getAttribute('view');
|
|
@@ -157,6 +174,13 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
157
174
|
set showRetractions(v) {
|
|
158
175
|
this.setAttribute('show-retractions', v ? 'true' : 'false');
|
|
159
176
|
}
|
|
177
|
+
/** #306/#6: build-volume cage, independent of the plate. Default true; `show-volume-cage="false"` hides it. */
|
|
178
|
+
get showVolumeCage() {
|
|
179
|
+
return this.getAttribute('show-volume-cage') !== 'false';
|
|
180
|
+
}
|
|
181
|
+
set showVolumeCage(v) {
|
|
182
|
+
this.setAttribute('show-volume-cage', v ? 'true' : 'false');
|
|
183
|
+
}
|
|
160
184
|
get scrub() {
|
|
161
185
|
const a = this.getAttribute('scrub');
|
|
162
186
|
return a === null ? null : Number(a);
|
|
@@ -225,6 +249,8 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
225
249
|
buildVolume: isMachine ? undefined : this._buildVolume,
|
|
226
250
|
quality: this.getAttribute('quality') ?? 'auto',
|
|
227
251
|
cameraMode: this.getAttribute('camera-mode') ?? undefined,
|
|
252
|
+
frameContent: this.getAttribute('frame-content') ?? undefined,
|
|
253
|
+
interactionQuality: this.getAttribute('interaction-quality') ?? undefined,
|
|
228
254
|
colorMode: this._colorMode,
|
|
229
255
|
tube: this._tube,
|
|
230
256
|
theme: this._theme,
|
|
@@ -259,6 +285,14 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
259
285
|
if (value !== null)
|
|
260
286
|
c.setCameraMode(value);
|
|
261
287
|
break;
|
|
288
|
+
case 'frame-content':
|
|
289
|
+
if (value !== null)
|
|
290
|
+
c.setFrameContent(value);
|
|
291
|
+
break;
|
|
292
|
+
case 'interaction-quality':
|
|
293
|
+
if (value !== null)
|
|
294
|
+
c.setInteractionQuality(value);
|
|
295
|
+
break;
|
|
262
296
|
case 'view':
|
|
263
297
|
if (value !== null)
|
|
264
298
|
c.setView(value);
|
|
@@ -269,6 +303,9 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
269
303
|
case 'show-wipe':
|
|
270
304
|
c.setKindVisible('wipe', value !== 'false');
|
|
271
305
|
break;
|
|
306
|
+
case 'show-volume-cage':
|
|
307
|
+
c.setBuildVolumeCage(value !== 'false');
|
|
308
|
+
break;
|
|
272
309
|
case 'show-retractions':
|
|
273
310
|
c.setShowRetractions(value === 'true');
|
|
274
311
|
break;
|
|
@@ -297,6 +334,7 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
297
334
|
c.setKindVisible('travel', this.showTravel);
|
|
298
335
|
c.setKindVisible('wipe', this.showWipe);
|
|
299
336
|
c.setShowRetractions(this.showRetractions);
|
|
337
|
+
c.setBuildVolumeCage(this.showVolumeCage);
|
|
300
338
|
const r = this.layerRange;
|
|
301
339
|
if (r === null)
|
|
302
340
|
c.setLayerRange(0, Number.POSITIVE_INFINITY);
|
|
@@ -338,7 +376,8 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
338
376
|
layers: e.layers,
|
|
339
377
|
complete: e.complete,
|
|
340
378
|
capabilities: e.capabilities,
|
|
341
|
-
warnings: e.warnings
|
|
379
|
+
warnings: e.warnings,
|
|
380
|
+
metadata: e.metadata
|
|
342
381
|
});
|
|
343
382
|
break;
|
|
344
383
|
case 'camera-changed':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chestnutlabs/gcode-preview-element",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Framework-free <gcode-preview> Web Component for the Chestnut Labs G-code viewer (DD-007 D1 / DD-009 D5): a custom element bridging @chestnutlabs/gcode-preview-core, no framework peer dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gcode",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"test": "vitest run"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@chestnutlabs/gcode-parser": "0.
|
|
56
|
-
"@chestnutlabs/gcode-preview-core": "0.
|
|
57
|
-
"@chestnutlabs/gcode-renderer-three": "0.
|
|
58
|
-
"@chestnutlabs/toolpath-core": "0.
|
|
55
|
+
"@chestnutlabs/gcode-parser": "0.7.0",
|
|
56
|
+
"@chestnutlabs/gcode-preview-core": "0.7.0",
|
|
57
|
+
"@chestnutlabs/gcode-renderer-three": "0.7.0",
|
|
58
|
+
"@chestnutlabs/toolpath-core": "0.7.0"
|
|
59
59
|
}
|
|
60
60
|
}
|