@sienci/gviewer 0.1.24 → 0.1.25

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/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),F=require("./GCodeSVGRenderer-BS3n-2zr.cjs");function C(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=C(V),G=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 F.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)},setCameraFollowEnabled(t){e().setCameraFollowEnabled(t)},screenToWorld(t,n,w){return e().screenToWorld(t,n,w)},worldToScreen(t,n,w){return e().worldToScreen(t,n,w)},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})}),b=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 F.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=b;exports.GCodeVisualizer=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),F=require("./GCodeSVGRenderer-BsWhrQaK.cjs");function C(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=C(V),G=o.forwardRef(function(d,s){const{id:i,options:l,callbacks:c,className:p,style:m}=d,u=o.useRef(null),r=o.useRef(null);return o.useEffect(()=>{const e=u.current;if(!e)return;const f=new F.GCodeViewer({id:i,container:e,options:l,callbacks:c});return r.current=f,()=>{r.current=null,f.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)},setCameraFollowEnabled(t){e().setCameraFollowEnabled(t)},screenToWorld(t,n,w){return e().screenToWorld(t,n,w)},worldToScreen(t,n,w){return e().worldToScreen(t,n,w)},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:p,style:m})}),b=o.forwardRef(function(d,s){const{id:i,options:l,className:c,style:p}=d,m=o.useRef(null),u=o.useRef(null);return o.useEffect(()=>{const r=m.current;if(!r)return;const e=new F.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,f)=>r().loadFromPrecomputedGroups(e,f),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:m,className:c,style:{width:"100%",height:"100%",...p}})});exports.GCodeSVGVisualizer=b;exports.GCodeVisualizer=G;
package/dist/react.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import * as o from "react";
2
- import { a as w, G as V } from "./GCodeSVGRenderer-BrTJFrH-.js";
2
+ import { a as w, G as V } from "./GCodeSVGRenderer-BhyNQYf7.js";
3
3
  const G = o.forwardRef(
4
- function(u, c) {
5
- const { id: l, options: n, callbacks: a, className: m, style: d } = u, i = o.useRef(null), t = o.useRef(null);
4
+ function(c, m) {
5
+ const { id: l, options: n, callbacks: a, className: f, style: u } = c, i = o.useRef(null), t = o.useRef(null);
6
6
  return o.useEffect(() => {
7
7
  const e = i.current;
8
8
  if (!e)
9
9
  return;
10
- const f = new w({ id: l, container: e, options: n, callbacks: a });
11
- return t.current = f, () => {
12
- t.current = null, f.dispose();
10
+ const d = new w({ id: l, container: e, options: n, callbacks: a });
11
+ return t.current = d, () => {
12
+ t.current = null, d.dispose();
13
13
  };
14
14
  }, [l]), o.useEffect(() => {
15
15
  var e;
@@ -18,7 +18,7 @@ const G = o.forwardRef(
18
18
  var e;
19
19
  (e = t.current) == null || e.setCallbacks(a ?? {});
20
20
  }, [a]), o.useImperativeHandle(
21
- c,
21
+ m,
22
22
  () => {
23
23
  const e = () => {
24
24
  const r = t.current;
@@ -114,13 +114,13 @@ const G = o.forwardRef(
114
114
  };
115
115
  },
116
116
  [l]
117
- ), o.createElement("div", { ref: i, className: m, style: d });
117
+ ), o.createElement("div", { ref: i, className: f, style: u });
118
118
  }
119
119
  ), R = o.forwardRef(
120
- function(u, c) {
121
- const { id: l, options: n, className: a, style: m } = u, d = o.useRef(null), i = o.useRef(null);
120
+ function(c, m) {
121
+ const { id: l, options: n, className: a, style: f } = c, u = o.useRef(null), i = o.useRef(null);
122
122
  return o.useEffect(() => {
123
- const t = d.current;
123
+ const t = u.current;
124
124
  if (!t) return;
125
125
  const e = new V(t, n);
126
126
  return i.current = e, () => {
@@ -129,7 +129,7 @@ const G = o.forwardRef(
129
129
  }, []), o.useEffect(() => {
130
130
  var t;
131
131
  n && ((t = i.current) == null || t.setOptions(n));
132
- }, [n]), o.useImperativeHandle(c, () => {
132
+ }, [n]), o.useImperativeHandle(m, () => {
133
133
  const t = () => {
134
134
  const e = i.current;
135
135
  if (!e) throw new Error("GCodeSVGRenderer is not ready.");
@@ -140,7 +140,7 @@ const G = o.forwardRef(
140
140
  loadFromFile: (e) => t().loadFromFile(e),
141
141
  loadFromText: (e) => t().loadFromText(e),
142
142
  loadFromWorkerData: (e) => t().loadFromWorkerData(e),
143
- loadFromPrecomputedGroups: (e) => t().loadFromPrecomputedGroups(e),
143
+ loadFromPrecomputedGroups: (e, d) => t().loadFromPrecomputedGroups(e, d),
144
144
  clear: () => t().clear(),
145
145
  resetView: () => t().resetView(),
146
146
  setOptions: (e) => t().setOptions(e),
@@ -151,9 +151,9 @@ const G = o.forwardRef(
151
151
  dispose: () => t().dispose()
152
152
  };
153
153
  }, []), o.createElement("div", {
154
- ref: d,
154
+ ref: u,
155
155
  className: a,
156
- style: { width: "100%", height: "100%", ...m }
156
+ style: { width: "100%", height: "100%", ...f }
157
157
  });
158
158
  }
159
159
  );
@@ -11,11 +11,15 @@ export type GCodeSVGRendererHandle = {
11
11
  opacity: number;
12
12
  positionsBuffer: ArrayBuffer;
13
13
  positionsLen: number;
14
- }[]): void;
14
+ stride?: 4 | 6;
15
+ }[], meta?: {
16
+ minZ?: number;
17
+ maxZ?: number;
18
+ }): void;
15
19
  clear(): void;
16
20
  resetView(): void;
17
21
  setOptions(opts: Partial<GCodeSVGOptions>): void;
18
- setProjectionMode(mode: 'perspective' | 'isometric'): void;
22
+ setProjectionMode(mode: 'perspective' | 'isometric' | 'top'): void;
19
23
  setBitPosition(pos: {
20
24
  x: number;
21
25
  y: number;
@@ -34,6 +34,7 @@ export declare class GCodeSVGRenderer {
34
34
  private rapidVerts;
35
35
  private cutVerts;
36
36
  private bounds;
37
+ private hasZInfo;
37
38
  constructor(container: HTMLElement, options?: Partial<GCodeSVGOptions>);
38
39
  loadFromLines(lines: string[]): void;
39
40
  loadFromFile(file: File): Promise<void>;
@@ -45,11 +46,15 @@ export declare class GCodeSVGRenderer {
45
46
  opacity: number;
46
47
  positionsBuffer: ArrayBuffer;
47
48
  positionsLen: number;
48
- }[]): void;
49
+ stride?: 4 | 6;
50
+ }[], meta?: {
51
+ minZ?: number;
52
+ maxZ?: number;
53
+ }): void;
49
54
  private syncSegmentGroupsFromLines;
50
55
  resetView(): void;
51
56
  setOptions(opts: Partial<GCodeSVGOptions>): void;
52
- setProjectionMode(mode: 'perspective' | 'isometric'): void;
57
+ setProjectionMode(mode: 'perspective' | 'isometric' | 'top'): void;
53
58
  getSVGElement(): SVGSVGElement;
54
59
  setBitPosition(pos: {
55
60
  x: number;
@@ -5,7 +5,7 @@ export type GCodeSVGOptions = {
5
5
  strokeWidth: number;
6
6
  arcSegments: number;
7
7
  padding: number;
8
- projectionMode: 'perspective' | 'isometric';
8
+ projectionMode: 'perspective' | 'isometric' | 'top';
9
9
  showOrigin: boolean;
10
10
  originColor: string;
11
11
  crosshairColor: string;
package/dist/viewer.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-BS3n-2zr.cjs"),a={dark:{background:"#111827",opacity:.9,rapidOpacity:.3,colors:{rapid:"#0ef6ae",cutting:"#3e85c7",laser:"#a855f7",processed:"#6b7280",boundingBox:"#e2e8f0",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:"#4b5563",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:"#cecdc3",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:"#c0caf5",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:"#7c6f64",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:"#CBCCC6",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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-BsWhrQaK.cjs"),a={dark:{background:"#111827",opacity:.9,rapidOpacity:.3,colors:{rapid:"#0ef6ae",cutting:"#3e85c7",laser:"#a855f7",processed:"#6b7280",boundingBox:"#e2e8f0",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:"#4b5563",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:"#cecdc3",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:"#c0caf5",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:"#7c6f64",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:"#CBCCC6",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,4 +1,4 @@
1
- import { G as o, a as i, V as c, d as r, b as n } from "./GCodeSVGRenderer-BrTJFrH-.js";
1
+ import { G as o, a as i, V as c, d as r, b as n } from "./GCodeSVGRenderer-BhyNQYf7.js";
2
2
  const e = {
3
3
  dark: {
4
4
  background: "#111827",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sienci/gviewer",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "GCode visualization library using Three.js",
5
5
  "repository": {
6
6
  "type": "git",