@sienci/gviewer 0.1.17 → 0.1.19
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/dist/GCodeSVGRenderer-BXu7J5xR.cjs +15 -0
- package/dist/{GCodeSVGRenderer-Onjhdwbv.js → GCodeSVGRenderer-D4yqZ1WL.js} +872 -788
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/types/viewer/GCodeViewer.d.ts +3 -0
- package/dist/types/viewer/bed/machineBed.d.ts +19 -0
- package/dist/types/viewer/grid/grid.d.ts +6 -3
- package/dist/types/viewer/types.d.ts +25 -1
- package/dist/viewer.cjs +1 -1
- package/dist/viewer.js +22 -8
- package/package.json +1 -1
- package/dist/GCodeSVGRenderer-_n8GbXrI.cjs +0 -15
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),V=require("./GCodeSVGRenderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),V=require("./GCodeSVGRenderer-BXu7J5xR.cjs");function G(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(d,s,i.get?i:{enumerable:!0,get:()=>a[s]})}}return d.default=a,Object.freeze(d)}const o=G(w),C=o.forwardRef(function(d,s){const{id:i,options:l,callbacks:c,className:m,style:f}=d,u=o.useRef(null),r=o.useRef(null);return o.useEffect(()=>{const e=u.current;if(!e)return;const p=new V.GCodeViewer({id:i,container:e,options:l,callbacks:c});return r.current=p,()=>{r.current=null,p.dispose()}},[i]),o.useEffect(()=>{var e;(e=r.current)==null||e.setOptions(l??{})},[l]),o.useEffect(()=>{var e;(e=r.current)==null||e.setCallbacks(c??{})},[c]),o.useImperativeHandle(s,()=>{const e=()=>{const t=r.current;if(!t)throw new Error("GCodeViewer is not ready.");return t};return{get id(){return i},setCallbacks(t){e().setCallbacks(t)},snapCameraToView(t,n){e().snapCameraToView(t,n)},setRotateEnabled(t){e().setRotateEnabled(t)},screenToWorld(t,n,F){return e().screenToWorld(t,n,F)},setBitPosition(t,n){e().setBitPosition(t,n)},setBitVisible(t){e().setBitVisible(t)},setBitSpinning(t){e().setBitSpinning(t)},setToolpathRotationA(t){e().setToolpathRotationA(t)},hideUntilLine(t,n){e().hideUntilLine(t,n)},seekToLine(t,n){e().seekToLine(t,n)},showAll(){e().showAll()},resetColors(){e().resetColors()},loadFromUrl(t,n){return e().loadFromUrl(t,n)},loadFromFile(t){return e().loadFromFile(t)},loadFromText(t){return e().loadFromText(t)},loadFromLines(t){return e().loadFromLines(t)},loadFromWorkerData(t){return e().loadFromWorkerData(t)},unload(){e().unload()},setOptions(t){e().setOptions(t)},getOptions(){return e().getOptions()},resize(){e().resize()},focusToModel(){e().focusToModel()},resetCamera(){e().resetCamera()},getBounds(){return e().getBounds()},dispose(){e().dispose()}}},[i]),o.createElement("div",{ref:u,className:m,style:f})}),g=o.forwardRef(function(d,s){const{id:i,options:l,className:c,style:m}=d,f=o.useRef(null),u=o.useRef(null);return o.useEffect(()=>{const r=f.current;if(!r)return;const e=new V.GCodeSVGRenderer(r,l);return u.current=e,()=>{u.current=null,e.dispose()}},[]),o.useEffect(()=>{var r;l&&((r=u.current)==null||r.setOptions(l))},[l]),o.useImperativeHandle(s,()=>{const r=()=>{const e=u.current;if(!e)throw new Error("GCodeSVGRenderer is not ready.");return e};return{loadFromLines:e=>r().loadFromLines(e),loadFromFile:e=>r().loadFromFile(e),loadFromText:e=>r().loadFromText(e),loadFromWorkerData:e=>r().loadFromWorkerData(e),loadFromPrecomputedGroups:e=>r().loadFromPrecomputedGroups(e),clear:()=>r().clear(),resetView:()=>r().resetView(),setOptions:e=>r().setOptions(e),setProjectionMode:e=>r().setProjectionMode(e),setBitPosition:e=>r().setBitPosition(e),setBitVisible:e=>r().setBitVisible(e),getSVGElement:()=>r().getSVGElement(),dispose:()=>r().dispose()}},[]),o.createElement("div",{ref:f,className:c,style:{width:"100%",height:"100%",...m}})});exports.GCodeSVGVisualizer=g;exports.GCodeVisualizer=C;
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as o from "react";
|
|
2
|
-
import { a as w, G as V } from "./GCodeSVGRenderer-
|
|
2
|
+
import { a as w, G as V } from "./GCodeSVGRenderer-D4yqZ1WL.js";
|
|
3
3
|
const G = o.forwardRef(
|
|
4
4
|
function(u, c) {
|
|
5
5
|
const { id: a, options: n, callbacks: l, className: m, style: d } = u, i = o.useRef(null), r = o.useRef(null);
|
|
@@ -20,6 +20,7 @@ export declare class GCodeViewer implements GCodeViewerHandle {
|
|
|
20
20
|
private axesGroup;
|
|
21
21
|
private gridLabelsGroup;
|
|
22
22
|
private boundingBoxGroup;
|
|
23
|
+
private machineBedGroup;
|
|
23
24
|
private bitMarker;
|
|
24
25
|
private preLaserBitType;
|
|
25
26
|
private toolpathStreams;
|
|
@@ -103,11 +104,13 @@ export declare class GCodeViewer implements GCodeViewerHandle {
|
|
|
103
104
|
private renderGridAndAxes;
|
|
104
105
|
private refreshGridLabels;
|
|
105
106
|
private refreshBoundingBox;
|
|
107
|
+
private refreshMachineBed;
|
|
106
108
|
private setBitMarker;
|
|
107
109
|
private setGridGroup;
|
|
108
110
|
private setAxesGroup;
|
|
109
111
|
private setGridLabelsGroup;
|
|
110
112
|
private setBoundingBoxGroup;
|
|
113
|
+
private setMachineBedGroup;
|
|
111
114
|
private setGeometryEmpty;
|
|
112
115
|
private setToolpathGeometry;
|
|
113
116
|
private refreshToolpathColors;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { GCodeViewerOptions } from "../types";
|
|
3
|
+
export declare function createMachineBedGroup(min: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}, max: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, options: GCodeViewerOptions, keepout?: {
|
|
10
|
+
min: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
max: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
} | null): THREE.Group;
|
|
19
|
+
export declare function disposeMachineBedGroup(group: THREE.Object3D): void;
|
|
@@ -3,18 +3,21 @@ import type { GCodeViewerOptions, GridUnits } from "../types";
|
|
|
3
3
|
import { disposeSpriteGroup } from "../render/textSprite";
|
|
4
4
|
export declare function createUnitGrid(args: {
|
|
5
5
|
units: GridUnits;
|
|
6
|
-
|
|
6
|
+
sizeXMm: number;
|
|
7
|
+
sizeYMm: number;
|
|
7
8
|
theme: GCodeViewerOptions["render"]["theme"];
|
|
8
9
|
}): THREE.Group;
|
|
9
10
|
export declare function disposeLineSegmentsGroup(group: THREE.Object3D): void;
|
|
10
11
|
export declare function createAxes(args: {
|
|
11
|
-
|
|
12
|
+
sizeXWorld: number;
|
|
13
|
+
sizeYWorld: number;
|
|
12
14
|
depthWorld: number;
|
|
13
15
|
theme: GCodeViewerOptions["render"]["theme"];
|
|
14
16
|
}): THREE.Group;
|
|
15
17
|
export declare function disposeAxesGroup(group: THREE.Object3D): void;
|
|
16
18
|
export declare function createGridLabels(args: {
|
|
17
|
-
|
|
19
|
+
sizeXMm: number;
|
|
20
|
+
sizeYMm: number;
|
|
18
21
|
units: GridUnits;
|
|
19
22
|
theme: GCodeViewerOptions["render"]["theme"];
|
|
20
23
|
}): THREE.Group;
|
|
@@ -10,6 +10,8 @@ export type GCodeViewerTheme = {
|
|
|
10
10
|
laser?: string;
|
|
11
11
|
processed?: string;
|
|
12
12
|
boundingBox: string;
|
|
13
|
+
machineBed: string;
|
|
14
|
+
machineBedKeepout: string;
|
|
13
15
|
grid: {
|
|
14
16
|
major: string;
|
|
15
17
|
minor: string;
|
|
@@ -55,7 +57,8 @@ export type GCodeViewerOptions = {
|
|
|
55
57
|
mode: "hide" | "grey";
|
|
56
58
|
};
|
|
57
59
|
grid: {
|
|
58
|
-
|
|
60
|
+
sizeX: number;
|
|
61
|
+
sizeY: number;
|
|
59
62
|
axisDepth: number;
|
|
60
63
|
labels: boolean;
|
|
61
64
|
};
|
|
@@ -63,6 +66,27 @@ export type GCodeViewerOptions = {
|
|
|
63
66
|
visible: boolean;
|
|
64
67
|
labels: boolean;
|
|
65
68
|
};
|
|
69
|
+
machineBed: {
|
|
70
|
+
visible: boolean;
|
|
71
|
+
min: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
} | null;
|
|
75
|
+
max: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
} | null;
|
|
79
|
+
keepout: {
|
|
80
|
+
min: {
|
|
81
|
+
x: number;
|
|
82
|
+
y: number;
|
|
83
|
+
};
|
|
84
|
+
max: {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
};
|
|
88
|
+
} | null;
|
|
89
|
+
};
|
|
66
90
|
geometry: {
|
|
67
91
|
arcSegments: number;
|
|
68
92
|
batching: {
|
package/dist/viewer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-BXu7J5xR.cjs"),a={dark:{background:"#111827",opacity:.9,rapidOpacity:.3,colors:{rapid:"#0ef6ae",cutting:"#3e85c7",laser:"#a855f7",processed:"#6b7280",boundingBox:"#77a9d7",machineBed:"#f5a623",machineBedKeepout:"#df3b3b",grid:{major:"#77a9d7",minor:"#3e6e9e"},axes:{x:"#df3b3b",y:"#06b881",z:"#295d8d"}}},light:{background:"#e5e7eb",opacity:.9,rapidOpacity:.3,colors:{rapid:"#295d8d",cutting:"#111827",laser:"#FF0000",processed:"#9ca3af",boundingBox:"#5191cc",machineBed:"#b45309",machineBedKeepout:"#df3b3b",grid:{major:"#295d8d",minor:"#5191cc"},axes:{x:"#df3b3b",y:"#06b881",z:"#295d8d"}}},"flexoki-dark":{background:"#100f0f",opacity:.9,rapidOpacity:.3,colors:{rapid:"#DA702C",cutting:"#3AA99F",laser:"#8B7EC8",processed:"#6f6e69",boundingBox:"#da702c",machineBed:"#ffcc66",machineBedKeepout:"#d14d41",grid:{major:"#a89984",minor:"#6f6e69"},axes:{x:"#d14d41",y:"#879a39",z:"#4385be"}}},"tokyo-night":{background:"#1a1b26",opacity:.9,rapidOpacity:.3,colors:{rapid:"#ff9e64",cutting:"#7dcfff",laser:"#bb9af7",processed:"#565f89",boundingBox:"#73daca",machineBed:"#e0af68",machineBedKeepout:"#f7768e",grid:{major:"#7aa2f7",minor:"#414868"},axes:{x:"#f7768e",y:"#9ece6a",z:"#7aa2f7"}}},"gruvbox-light":{background:"#fbf1c7",opacity:.9,rapidOpacity:.3,colors:{rapid:"#d65d0e",cutting:"#3c3836",laser:"#b16286",processed:"#928374",boundingBox:"#076678",machineBed:"#d79921",machineBedKeepout:"#cc241d",grid:{major:"#7c6f64",minor:"#a89984"},axes:{x:"#cc241d",y:"#98971a",z:"#458588"}}},"ayu-dark":{background:"#0b0e14",opacity:.9,rapidOpacity:.3,colors:{rapid:"#FFA659",cutting:"#73D0FF",laser:"#DFBFFF",processed:"#6E7C8F",boundingBox:"#95E6CB",machineBed:"#FFD173",machineBedKeepout:"#F28779",grid:{major:"#77a9d7",minor:"#3e6590"},axes:{x:"#F28779",y:"#D5FF80",z:"#5CCFE6"}}},"ayu-light":{background:"#fafafa",opacity:.9,rapidOpacity:.3,colors:{rapid:"#FA8D3E",cutting:"#22A4E6",laser:"#A37ACC",processed:"#ADAEB1",boundingBox:"#5C6773",machineBed:"#F2AE49",machineBedKeepout:"#F07171",grid:{major:"#5c6773",minor:"#9aacba"},axes:{x:"#F07171",y:"#86B300",z:"#55B4D4"}}}};exports.GCodeSVGRenderer=e.GCodeSVGRenderer;exports.GCodeViewer=e.GCodeViewer;exports.ViewCube=e.ViewCube;exports.defaultGCodeViewerOptions=e.defaultGCodeViewerOptions;exports.defaultGCodeViewerTheme=e.defaultGCodeViewerTheme;exports.gCodeViewerThemePresets=a;
|
package/dist/viewer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
const
|
|
1
|
+
import { G as o, a as i, V as c, d as r, b as n } from "./GCodeSVGRenderer-D4yqZ1WL.js";
|
|
2
|
+
const e = {
|
|
3
3
|
dark: {
|
|
4
4
|
background: "#111827",
|
|
5
5
|
opacity: 0.9,
|
|
@@ -10,6 +10,8 @@ const a = {
|
|
|
10
10
|
laser: "#a855f7",
|
|
11
11
|
processed: "#6b7280",
|
|
12
12
|
boundingBox: "#77a9d7",
|
|
13
|
+
machineBed: "#f5a623",
|
|
14
|
+
machineBedKeepout: "#df3b3b",
|
|
13
15
|
grid: { major: "#77a9d7", minor: "#3e6e9e" },
|
|
14
16
|
axes: { x: "#df3b3b", y: "#06b881", z: "#295d8d" }
|
|
15
17
|
}
|
|
@@ -24,6 +26,8 @@ const a = {
|
|
|
24
26
|
laser: "#FF0000",
|
|
25
27
|
processed: "#9ca3af",
|
|
26
28
|
boundingBox: "#5191cc",
|
|
29
|
+
machineBed: "#b45309",
|
|
30
|
+
machineBedKeepout: "#df3b3b",
|
|
27
31
|
grid: { major: "#295d8d", minor: "#5191cc" },
|
|
28
32
|
axes: { x: "#df3b3b", y: "#06b881", z: "#295d8d" }
|
|
29
33
|
}
|
|
@@ -38,6 +42,8 @@ const a = {
|
|
|
38
42
|
laser: "#8B7EC8",
|
|
39
43
|
processed: "#6f6e69",
|
|
40
44
|
boundingBox: "#da702c",
|
|
45
|
+
machineBed: "#ffcc66",
|
|
46
|
+
machineBedKeepout: "#d14d41",
|
|
41
47
|
grid: { major: "#a89984", minor: "#6f6e69" },
|
|
42
48
|
axes: { x: "#d14d41", y: "#879a39", z: "#4385be" }
|
|
43
49
|
}
|
|
@@ -52,6 +58,8 @@ const a = {
|
|
|
52
58
|
laser: "#bb9af7",
|
|
53
59
|
processed: "#565f89",
|
|
54
60
|
boundingBox: "#73daca",
|
|
61
|
+
machineBed: "#e0af68",
|
|
62
|
+
machineBedKeepout: "#f7768e",
|
|
55
63
|
grid: { major: "#7aa2f7", minor: "#414868" },
|
|
56
64
|
axes: { x: "#f7768e", y: "#9ece6a", z: "#7aa2f7" }
|
|
57
65
|
}
|
|
@@ -66,6 +74,8 @@ const a = {
|
|
|
66
74
|
laser: "#b16286",
|
|
67
75
|
processed: "#928374",
|
|
68
76
|
boundingBox: "#076678",
|
|
77
|
+
machineBed: "#d79921",
|
|
78
|
+
machineBedKeepout: "#cc241d",
|
|
69
79
|
grid: { major: "#7c6f64", minor: "#a89984" },
|
|
70
80
|
axes: { x: "#cc241d", y: "#98971a", z: "#458588" }
|
|
71
81
|
}
|
|
@@ -80,6 +90,8 @@ const a = {
|
|
|
80
90
|
laser: "#DFBFFF",
|
|
81
91
|
processed: "#6E7C8F",
|
|
82
92
|
boundingBox: "#95E6CB",
|
|
93
|
+
machineBed: "#FFD173",
|
|
94
|
+
machineBedKeepout: "#F28779",
|
|
83
95
|
grid: { major: "#77a9d7", minor: "#3e6590" },
|
|
84
96
|
axes: { x: "#F28779", y: "#D5FF80", z: "#5CCFE6" }
|
|
85
97
|
}
|
|
@@ -94,16 +106,18 @@ const a = {
|
|
|
94
106
|
laser: "#A37ACC",
|
|
95
107
|
processed: "#ADAEB1",
|
|
96
108
|
boundingBox: "#5C6773",
|
|
109
|
+
machineBed: "#F2AE49",
|
|
110
|
+
machineBedKeepout: "#F07171",
|
|
97
111
|
grid: { major: "#5c6773", minor: "#9aacba" },
|
|
98
112
|
axes: { x: "#F07171", y: "#86B300", z: "#55B4D4" }
|
|
99
113
|
}
|
|
100
114
|
}
|
|
101
115
|
};
|
|
102
116
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
117
|
+
o as GCodeSVGRenderer,
|
|
118
|
+
i as GCodeViewer,
|
|
119
|
+
c as ViewCube,
|
|
120
|
+
r as defaultGCodeViewerOptions,
|
|
121
|
+
n as defaultGCodeViewerTheme,
|
|
122
|
+
e as gCodeViewerThemePresets
|
|
109
123
|
};
|