@sienci/gviewer 0.1.3 → 0.1.5
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-CfCN3kNu.js → GCodeSVGRenderer-DUQ-WgJi.js} +286 -270
- package/dist/GCodeSVGRenderer-hZ8tZwov.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +39 -38
- package/dist/types/react/GCodeSVGVisualizer.d.ts +6 -0
- package/dist/types/viewer/svg/GCodeSVGRenderer.d.ts +6 -0
- package/dist/viewer.cjs +1 -1
- package/dist/viewer.js +9 -9
- package/package.json +1 -1
- package/dist/GCodeSVGRenderer-mg1clEmp.cjs +0 -1
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),F=require("./GCodeSVGRenderer-hZ8tZwov.cjs");function w(l){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const s in l)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(l,s);Object.defineProperty(u,s,i.get?i:{enumerable:!0,get:()=>l[s]})}}return u.default=l,Object.freeze(u)}const o=w(V),G=o.forwardRef(function(u,s){const{id:i,options:a,callbacks:c,className:m,style:f}=u,d=o.useRef(null),t=o.useRef(null);return o.useEffect(()=>{const e=d.current;if(!e)return;const p=new F.GCodeViewer({id:i,container:e,options:a,callbacks:c});return t.current=p,()=>{t.current=null,p.dispose()}},[i]),o.useEffect(()=>{var e;(e=t.current)==null||e.setOptions(a??{})},[a]),o.useEffect(()=>{var e;(e=t.current)==null||e.setCallbacks(c??{})},[c]),o.useImperativeHandle(s,()=>{const e=()=>{const r=t.current;if(!r)throw new Error("GCodeViewer is not ready.");return r};return{get id(){return i},setCallbacks(r){e().setCallbacks(r)},snapCameraToView(r,n){e().snapCameraToView(r,n)},setBitPosition(r,n){e().setBitPosition(r,n)},setBitVisible(r){e().setBitVisible(r)},setToolpathRotationA(r){e().setToolpathRotationA(r)},hideUntilLine(r,n){e().hideUntilLine(r,n)},seekToLine(r,n){e().seekToLine(r,n)},showAll(){e().showAll()},resetColors(){e().resetColors()},loadFromUrl(r,n){return e().loadFromUrl(r,n)},loadFromFile(r){return e().loadFromFile(r)},loadFromText(r){return e().loadFromText(r)},loadFromLines(r){return e().loadFromLines(r)},loadFromWorkerData(r){return e().loadFromWorkerData(r)},unload(){e().unload()},setOptions(r){e().setOptions(r)},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:d,className:m,style:f})}),C=o.forwardRef(function(u,s){const{id:i,options:a,className:c,style:m}=u,f=o.useRef(null),d=o.useRef(null);return o.useEffect(()=>{const t=f.current;if(!t)return;const e=new F.GCodeSVGRenderer(t,a);return d.current=e,()=>{d.current=null,e.dispose()}},[]),o.useEffect(()=>{var t;a&&((t=d.current)==null||t.setOptions(a))},[a]),o.useImperativeHandle(s,()=>{const t=()=>{const e=d.current;if(!e)throw new Error("GCodeSVGRenderer is not ready.");return e};return{loadFromLines:e=>t().loadFromLines(e),loadFromFile:e=>t().loadFromFile(e),loadFromText:e=>t().loadFromText(e),loadFromWorkerData:e=>t().loadFromWorkerData(e),loadFromPrecomputedGroups:e=>t().loadFromPrecomputedGroups(e),clear:()=>t().clear(),resetView:()=>t().resetView(),setOptions:e=>t().setOptions(e),setProjectionMode:e=>t().setProjectionMode(e),getSVGElement:()=>t().getSVGElement(),dispose:()=>t().dispose()}},[]),o.createElement("div",{ref:f,className:c,style:{width:"100%",height:"100%",...m}})});exports.GCodeSVGVisualizer=C;exports.GCodeVisualizer=G;
|
package/dist/react.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { a as F, G as w } from "./GCodeSVGRenderer-
|
|
3
|
-
const C =
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { a as F, G as w } from "./GCodeSVGRenderer-DUQ-WgJi.js";
|
|
3
|
+
const C = t.forwardRef(
|
|
4
4
|
function(u, c) {
|
|
5
|
-
const { id: a, options: n, callbacks: l, className:
|
|
6
|
-
return
|
|
5
|
+
const { id: a, options: n, callbacks: l, className: m, style: d } = u, i = t.useRef(null), o = t.useRef(null);
|
|
6
|
+
return t.useEffect(() => {
|
|
7
7
|
const e = i.current;
|
|
8
8
|
if (!e)
|
|
9
9
|
return;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
|
|
10
|
+
const f = new F({ id: a, container: e, options: n, callbacks: l });
|
|
11
|
+
return o.current = f, () => {
|
|
12
|
+
o.current = null, f.dispose();
|
|
13
13
|
};
|
|
14
|
-
}, [a]),
|
|
14
|
+
}, [a]), t.useEffect(() => {
|
|
15
15
|
var e;
|
|
16
|
-
(e =
|
|
17
|
-
}, [n]),
|
|
16
|
+
(e = o.current) == null || e.setOptions(n ?? {});
|
|
17
|
+
}, [n]), t.useEffect(() => {
|
|
18
18
|
var e;
|
|
19
|
-
(e =
|
|
20
|
-
}, [l]),
|
|
19
|
+
(e = o.current) == null || e.setCallbacks(l ?? {});
|
|
20
|
+
}, [l]), t.useImperativeHandle(
|
|
21
21
|
c,
|
|
22
22
|
() => {
|
|
23
23
|
const e = () => {
|
|
24
|
-
const r =
|
|
24
|
+
const r = o.current;
|
|
25
25
|
if (!r)
|
|
26
26
|
throw new Error("GCodeViewer is not ready.");
|
|
27
27
|
return r;
|
|
@@ -99,43 +99,44 @@ const C = o.forwardRef(
|
|
|
99
99
|
};
|
|
100
100
|
},
|
|
101
101
|
[a]
|
|
102
|
-
),
|
|
102
|
+
), t.createElement("div", { ref: i, className: m, style: d });
|
|
103
103
|
}
|
|
104
|
-
), G =
|
|
104
|
+
), G = t.forwardRef(
|
|
105
105
|
function(u, c) {
|
|
106
|
-
const { id: a, options: n, className: l, style:
|
|
107
|
-
return
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
const e = new w(
|
|
106
|
+
const { id: a, options: n, className: l, style: m } = u, d = t.useRef(null), i = t.useRef(null);
|
|
107
|
+
return t.useEffect(() => {
|
|
108
|
+
const o = d.current;
|
|
109
|
+
if (!o) return;
|
|
110
|
+
const e = new w(o, n);
|
|
111
111
|
return i.current = e, () => {
|
|
112
112
|
i.current = null, e.dispose();
|
|
113
113
|
};
|
|
114
|
-
}, []),
|
|
115
|
-
var
|
|
116
|
-
n && ((
|
|
117
|
-
}, [n]),
|
|
118
|
-
const
|
|
114
|
+
}, []), t.useEffect(() => {
|
|
115
|
+
var o;
|
|
116
|
+
n && ((o = i.current) == null || o.setOptions(n));
|
|
117
|
+
}, [n]), t.useImperativeHandle(c, () => {
|
|
118
|
+
const o = () => {
|
|
119
119
|
const e = i.current;
|
|
120
120
|
if (!e) throw new Error("GCodeSVGRenderer is not ready.");
|
|
121
121
|
return e;
|
|
122
122
|
};
|
|
123
123
|
return {
|
|
124
|
-
loadFromLines: (e) =>
|
|
125
|
-
loadFromFile: (e) =>
|
|
126
|
-
loadFromText: (e) =>
|
|
127
|
-
loadFromWorkerData: (e) =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
124
|
+
loadFromLines: (e) => o().loadFromLines(e),
|
|
125
|
+
loadFromFile: (e) => o().loadFromFile(e),
|
|
126
|
+
loadFromText: (e) => o().loadFromText(e),
|
|
127
|
+
loadFromWorkerData: (e) => o().loadFromWorkerData(e),
|
|
128
|
+
loadFromPrecomputedGroups: (e) => o().loadFromPrecomputedGroups(e),
|
|
129
|
+
clear: () => o().clear(),
|
|
130
|
+
resetView: () => o().resetView(),
|
|
131
|
+
setOptions: (e) => o().setOptions(e),
|
|
132
|
+
setProjectionMode: (e) => o().setProjectionMode(e),
|
|
133
|
+
getSVGElement: () => o().getSVGElement(),
|
|
134
|
+
dispose: () => o().dispose()
|
|
134
135
|
};
|
|
135
|
-
}, []),
|
|
136
|
+
}, []), t.createElement("div", {
|
|
136
137
|
ref: d,
|
|
137
138
|
className: l,
|
|
138
|
-
style: { width: "100%", height: "100%", ...
|
|
139
|
+
style: { width: "100%", height: "100%", ...m }
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
142
|
);
|
|
@@ -6,6 +6,12 @@ export type GCodeSVGRendererHandle = {
|
|
|
6
6
|
loadFromFile(file: File): Promise<void>;
|
|
7
7
|
loadFromText(gcode: string): void;
|
|
8
8
|
loadFromWorkerData(data: WorkerGeometryData): void;
|
|
9
|
+
loadFromPrecomputedGroups(groups: {
|
|
10
|
+
hexColor: string;
|
|
11
|
+
opacity: number;
|
|
12
|
+
positionsBuffer: ArrayBuffer;
|
|
13
|
+
positionsLen: number;
|
|
14
|
+
}[]): void;
|
|
9
15
|
clear(): void;
|
|
10
16
|
resetView(): void;
|
|
11
17
|
setOptions(opts: Partial<GCodeSVGOptions>): void;
|
|
@@ -37,6 +37,12 @@ export declare class GCodeSVGRenderer {
|
|
|
37
37
|
loadFromText(gcode: string): void;
|
|
38
38
|
clear(): void;
|
|
39
39
|
loadFromWorkerData(data: WorkerGeometryData): void;
|
|
40
|
+
loadFromPrecomputedGroups(groups: {
|
|
41
|
+
hexColor: string;
|
|
42
|
+
opacity: number;
|
|
43
|
+
positionsBuffer: ArrayBuffer;
|
|
44
|
+
positionsLen: number;
|
|
45
|
+
}[]): void;
|
|
40
46
|
private syncSegmentGroupsFromLines;
|
|
41
47
|
resetView(): void;
|
|
42
48
|
setOptions(opts: Partial<GCodeSVGOptions>): void;
|
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-hZ8tZwov.cjs"),a={dark:{background:"#111827",opacity:.9,rapidOpacity:.3,colors:{rapid:"#0ef6ae",cutting:"#3e85c7",laser:"#a855f7",processed:"#6b7280",boundingBox:"#77a9d7",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",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",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",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",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",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",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,4 +1,4 @@
|
|
|
1
|
-
import { G as
|
|
1
|
+
import { G as e, a as d, V as i, d as c, b as s } from "./GCodeSVGRenderer-DUQ-WgJi.js";
|
|
2
2
|
const a = {
|
|
3
3
|
dark: {
|
|
4
4
|
background: "#111827",
|
|
@@ -10,7 +10,7 @@ const a = {
|
|
|
10
10
|
laser: "#a855f7",
|
|
11
11
|
processed: "#6b7280",
|
|
12
12
|
boundingBox: "#77a9d7",
|
|
13
|
-
grid: { major: "#
|
|
13
|
+
grid: { major: "#77a9d7", minor: "#3e6e9e" },
|
|
14
14
|
axes: { x: "#df3b3b", y: "#06b881", z: "#295d8d" }
|
|
15
15
|
}
|
|
16
16
|
},
|
|
@@ -24,7 +24,7 @@ const a = {
|
|
|
24
24
|
laser: "#FF0000",
|
|
25
25
|
processed: "#9ca3af",
|
|
26
26
|
boundingBox: "#5191cc",
|
|
27
|
-
grid: { major: "#
|
|
27
|
+
grid: { major: "#295d8d", minor: "#5191cc" },
|
|
28
28
|
axes: { x: "#df3b3b", y: "#06b881", z: "#295d8d" }
|
|
29
29
|
}
|
|
30
30
|
},
|
|
@@ -38,7 +38,7 @@ const a = {
|
|
|
38
38
|
laser: "#8B7EC8",
|
|
39
39
|
processed: "#6f6e69",
|
|
40
40
|
boundingBox: "#da702c",
|
|
41
|
-
grid: { major: "#
|
|
41
|
+
grid: { major: "#a89984", minor: "#6f6e69" },
|
|
42
42
|
axes: { x: "#d14d41", y: "#879a39", z: "#4385be" }
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -52,7 +52,7 @@ const a = {
|
|
|
52
52
|
laser: "#bb9af7",
|
|
53
53
|
processed: "#565f89",
|
|
54
54
|
boundingBox: "#73daca",
|
|
55
|
-
grid: { major: "#
|
|
55
|
+
grid: { major: "#7aa2f7", minor: "#414868" },
|
|
56
56
|
axes: { x: "#f7768e", y: "#9ece6a", z: "#7aa2f7" }
|
|
57
57
|
}
|
|
58
58
|
},
|
|
@@ -66,7 +66,7 @@ const a = {
|
|
|
66
66
|
laser: "#b16286",
|
|
67
67
|
processed: "#928374",
|
|
68
68
|
boundingBox: "#076678",
|
|
69
|
-
grid: { major: "#
|
|
69
|
+
grid: { major: "#7c6f64", minor: "#a89984" },
|
|
70
70
|
axes: { x: "#cc241d", y: "#98971a", z: "#458588" }
|
|
71
71
|
}
|
|
72
72
|
},
|
|
@@ -80,7 +80,7 @@ const a = {
|
|
|
80
80
|
laser: "#DFBFFF",
|
|
81
81
|
processed: "#6E7C8F",
|
|
82
82
|
boundingBox: "#95E6CB",
|
|
83
|
-
grid: { major: "#
|
|
83
|
+
grid: { major: "#77a9d7", minor: "#3e6590" },
|
|
84
84
|
axes: { x: "#F28779", y: "#D5FF80", z: "#5CCFE6" }
|
|
85
85
|
}
|
|
86
86
|
},
|
|
@@ -94,13 +94,13 @@ const a = {
|
|
|
94
94
|
laser: "#A37ACC",
|
|
95
95
|
processed: "#ADAEB1",
|
|
96
96
|
boundingBox: "#5C6773",
|
|
97
|
-
grid: { major: "#
|
|
97
|
+
grid: { major: "#5c6773", minor: "#9aacba" },
|
|
98
98
|
axes: { x: "#F07171", y: "#86B300", z: "#55B4D4" }
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
export {
|
|
103
|
-
|
|
103
|
+
e as GCodeSVGRenderer,
|
|
104
104
|
d as GCodeViewer,
|
|
105
105
|
i as ViewCube,
|
|
106
106
|
c as defaultGCodeViewerOptions,
|