frame.image 1.3.2 → 1.3.4

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/App.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AACA,OAAO,WAAW,CAAC;AAUnB,iBAAS,GAAG,4CAmHX;AAED,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AACA,OAAO,WAAW,CAAC;AAUnB,iBAAS,GAAG,4CAqHX;AAED,eAAe,GAAG,CAAC"}
package/dist/App.js CHANGED
@@ -82,6 +82,10 @@ function App() {
82
82
  const shFactor = sh / extensions.y.extension;
83
83
  setCoords(coords.scale(slFactor, shFactor));
84
84
  }
85
- return (_jsxs(_Fragment, { children: [_jsx("h3", { children: "frame.image" }), _jsx(Scaling, { SL: scaledSL, setSL: setScaledSL, SH: scaledSH, setSH: setScaledSH, onScale: onScale }), _jsx(ImageHandler, { imageCoords: { imageCoords, setImageCoords } }), _jsx(Center, { coords: coords }), _jsx("button", { onClick: onOpenModalDesigner, children: "Designer" }), _jsx(ModalDesigner, { isOpen: modalDesigner, onClose: () => setModalDesigner(false) })] }));
85
+ function onClose(rt1) {
86
+ console.log(`RT1 from App: ${rt1}`);
87
+ setModalDesigner(false);
88
+ }
89
+ return (_jsxs(_Fragment, { children: [_jsx("h3", { children: "frame.image" }), _jsx(Scaling, { SL: scaledSL, setSL: setScaledSL, SH: scaledSH, setSH: setScaledSH, onScale: onScale }), _jsx(ImageHandler, { imageCoords: { imageCoords, setImageCoords } }), _jsx(Center, { coords: coords }), _jsx("button", { onClick: onOpenModalDesigner, children: "Designer" }), _jsx(ModalDesigner, { isOpen: modalDesigner, onClose: onClose })] }));
86
90
  }
87
91
  export default App;
@@ -1,4 +1,5 @@
1
1
  export declare function Designer(props: {
2
- onClose: () => void;
2
+ onClose: (rt1: string) => void;
3
+ nrPoints?: number;
3
4
  }): import("react/jsx-runtime").JSX.Element;
4
5
  //# sourceMappingURL=Designer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Designer.d.ts","sourceRoot":"","sources":["../src/Designer.tsx"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,2CAgJtD"}
1
+ {"version":3,"file":"Designer.d.ts","sourceRoot":"","sources":["../src/Designer.tsx"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,2CA6JA"}
package/dist/Designer.js CHANGED
@@ -11,7 +11,7 @@ import { Polygon } from './Polygon';
11
11
  import { Point } from './Point';
12
12
  import { Finish } from './Finish';
13
13
  export function Designer(props) {
14
- const nrPoints = 128;
14
+ const nrPoints = props.nrPoints || 128;
15
15
  const width = 600;
16
16
  const height = 400;
17
17
  const universeCenter = new Point(width / 2, height / 2);
@@ -86,11 +86,21 @@ export function Designer(props) {
86
86
  currentMachine.context.height = height;
87
87
  onCloseScaleForm(true);
88
88
  }
89
+ const onClose = (pol) => () => {
90
+ const catmullRomPolygonRT1 = pol.createCatmullRomPoints(128);
91
+ catmullRomPolygonRT1.assertEquiDistantAngles();
92
+ const rt1 = catmullRomPolygonRT1.createRT1();
93
+ const catmullRomPolygonTR1 = pol.createCatmullRomPoints(1000);
94
+ catmullRomPolygonTR1.assertEquiDistantAngles();
95
+ const tr1 = catmullRomPolygonTR1.createTR1();
96
+ console.log(`TR1: ${tr1}`);
97
+ props.onClose(rt1);
98
+ };
89
99
  return (_jsxs("div", { children: [_jsxs(Box, { id: "boxStates", sx: styleStates, display: "flex", flexDirection: "column", gap: 2, children: [_jsx(States, { machine: currentMachine, command: sendCommand, onClickReset: onClickReset, setDataUrl: setDataUrl, coords: { coords, setCoords } }), _jsx(ShowOptions, { show: show, setShow: setShow })] }), _jsxs(Box, { id: "boxCanvas", sx: {
90
100
  ...styleCanvas,
91
101
  display: 'flex',
92
102
  flexDirection: 'row',
93
103
  alignItems: 'flex-start',
94
104
  gap: 2,
95
- }, children: [_jsx(DrawCanvas, { machine: currentMachine, command: sendCommand, width: width, height: height, status: { status, setStatus }, show: show, axis: { axis, setAxis }, imageUrl: imageUrl, coords: { coords, setCoords }, imageCoords: { imageCoords, setImageCoords }, rotation: { rotationAngle, setRotationAngle }, catmullRomPoints: { catmullRomPoints, setCatmullRomPoints } }), _jsx(ScaleForm, { title: "Apply Scale", currentPoints: currentMachine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue, sl: SL, sh: SH })] }), _jsx(Finish, { universeCenter: universeCenter, nrPoints: nrPoints, coords: { coords, setCoords }, onClose: props.onClose })] }));
105
+ }, children: [_jsx(DrawCanvas, { machine: currentMachine, command: sendCommand, width: width, height: height, status: { status, setStatus }, show: show, axis: { axis, setAxis }, imageUrl: imageUrl, coords: { coords, setCoords }, imageCoords: { imageCoords, setImageCoords }, rotation: { rotationAngle, setRotationAngle }, catmullRomPoints: { catmullRomPoints, setCatmullRomPoints } }), _jsx(ScaleForm, { title: "Apply Scale", currentPoints: currentMachine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue, sl: SL, sh: SH })] }), _jsx(Finish, { universeCenter: universeCenter, nrPoints: nrPoints, coords: { coords, setCoords }, onClose: onClose })] }));
96
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DrawCanvas.d.ts","sourceRoot":"","sources":["../src/DrawCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqD,MAAM,OAAO,CAAC;AAG/E,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,UAAU,EACV,aAAa,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xB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CA+fd"}
@@ -266,7 +266,9 @@ export function DrawCanvas(props) {
266
266
  const minIndex = props.coords.coords.findMinDistancePoint(point);
267
267
  const reducedPolygon = props.coords.coords.minus(minIndex);
268
268
  props.coords.setCoords(reducedPolygon);
269
- props.machine.context.nrPoints -= 1;
269
+ if (typeof props.machine.context.nrPoints === 'number') {
270
+ props.machine.context.nrPoints -= 1;
271
+ }
270
272
  // Force redraw after removing a point
271
273
  const canvas = canvasRef.current;
272
274
  if (canvas) {
package/dist/Finish.d.ts CHANGED
@@ -1,9 +1,10 @@
1
+ import { Polygon } from './Polygon';
1
2
  import { Point } from './Point';
2
3
  import { TCoordsHook } from './types';
3
4
  export declare function Finish(props: {
4
5
  universeCenter: Point;
5
6
  nrPoints: number;
6
7
  coords: TCoordsHook;
7
- onClose: () => void;
8
+ onClose: (pol: Polygon) => () => void;
8
9
  }): import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=Finish.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Finish.d.ts","sourceRoot":"","sources":["../src/Finish.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,2CA4GA"}
1
+ {"version":3,"file":"Finish.d.ts","sourceRoot":"","sources":["../src/Finish.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;CACvC,2CAmGA"}
package/dist/Finish.js CHANGED
@@ -48,13 +48,5 @@ export function Finish(props) {
48
48
  setOriginalCoords(undefined);
49
49
  }
50
50
  };
51
- const onCreateRT1 = () => {
52
- const catmullRomPolygon = props.coords.coords.createCatmullRomPoints(128);
53
- catmullRomPolygon.assertEquiDistantAngles();
54
- const rt1 = catmullRomPolygon.createRT1();
55
- props.coords.setCoords(catmullRomPolygon);
56
- console.log(`RT1: ${rt1}`);
57
- props.onClose();
58
- };
59
- return (_jsxs(Box, { id: "boxButtons", sx: styleButton, children: [_jsx(Button, { variant: "contained", disabled: originalCoords !== undefined, onClick: onTransform, sx: { mr: 2 }, children: "Start Transformation" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: onReset, sx: { mr: 2 }, children: "Reset to Original" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: onCreateRT1, children: "Create RT1" })] }));
51
+ return (_jsxs(Box, { id: "boxButtons", sx: styleButton, children: [_jsx(Button, { variant: "contained", disabled: originalCoords !== undefined, onClick: onTransform, sx: { mr: 2 }, children: "Start Transformation" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: onReset, sx: { mr: 2 }, children: "Reset to Original" }), _jsx(Button, { variant: "contained", disabled: originalCoords === undefined, onClick: props.onClose(props.coords.coords), children: "Create RT1" })] }));
60
52
  }
@@ -1,5 +1,5 @@
1
1
  export declare function ModalDesigner(props: {
2
2
  isOpen: boolean;
3
- onClose: () => void;
3
+ onClose: (rt1: string) => void;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
5
  //# sourceMappingURL=ModalDesigner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDesigner.d.ts","sourceRoot":"","sources":["../src/ModalDesigner.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,2CAW5E"}
1
+ {"version":3,"file":"ModalDesigner.d.ts","sourceRoot":"","sources":["../src/ModalDesigner.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,2CAaA"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Modal } from '@mui/material';
2
+ import { Box, Modal } from '@mui/material';
3
3
  import { Designer } from './Designer';
4
4
  export function ModalDesigner(props) {
5
- return (_jsx(Modal, { open: props.isOpen, onClose: props.onClose, "aria-labelledby": "modal-title", "aria-describedby": "modal-description", children: _jsx(Designer, { onClose: props.onClose }) }));
5
+ return (_jsx(Modal, { open: props.isOpen, onClose: props.onClose, "aria-labelledby": "modal-title", "aria-describedby": "modal-description", children: _jsx(Box, { children: _jsx(Designer, { onClose: props.onClose, nrPoints: 128 }) }) }));
6
6
  }
package/dist/Polygon.d.ts CHANGED
@@ -28,6 +28,8 @@ export declare class Polygon {
28
28
  createCatmullRomPoints(nrPoints: number, origin?: Point): Polygon;
29
29
  findNearestPoint(point: Point): number;
30
30
  createRT1(): string;
31
+ createTR1(): string;
32
+ createNidek(): string;
31
33
  assertEquiDistantAngles(): void;
32
34
  drawPoints(context: CanvasRenderingContext2D, linesFromOrigin: boolean, color?: string): void;
33
35
  drawPolygon(context: CanvasRenderingContext2D, color?: string, transparency?: number):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MAAM,EAAE,cAAc,EAAE,KAAK,GAAG,OAAO;IAQ/D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAU7C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO;IAyBjE,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAYtC,SAAS,IAAI,MAAM;IAuBnB,SAAS,IAAI,MAAM;IAOnB,WAAW,IAAI,MAAM;IASrB,uBAAuB,IAAI,IAAI;IAwB/B,UAAU,CACR,OAAO,EAAE,wBAAwB,EACjC,eAAe,EAAE,OAAO,EACxB,KAAK,SAAW,GACf,IAAI;IAsBP,WAAW,CACT,OAAO,EAAE,wBAAwB,EACjC,KAAK,SAAQ,EACb,YAAY,SAAM,GACjB,IAAI;IAuBP,UAAU,CAAC,OAAO,EAAE,wBAAwB,EAAE,KAAK,SAAU,GAAG,IAAI;CAMrE"}
package/dist/Polygon.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createPolarCatmullRom } from 'frame.akima';
2
2
  import { Point } from './Point';
3
+ import { Nidek } from 'frame.nidek';
3
4
  export class Polygon {
4
5
  points;
5
6
  universeCenter;
@@ -133,6 +134,18 @@ export class Polygon {
133
134
  }
134
135
  return rt1;
135
136
  }
137
+ createTR1() {
138
+ const tr1 = 'TR1' + '9999' + 'N3' + 'H' + '+ 0' + 'G' + this.createNidek();
139
+ return tr1;
140
+ }
141
+ createNidek() {
142
+ const scaleFactor = 5000 / (this.XMax - this.XMin);
143
+ const radii = this.points.map((point) => {
144
+ return Math.round(point.Radius * scaleFactor);
145
+ });
146
+ const nidek = Nidek.createNidekFromRadii(radii);
147
+ return nidek.createStringFromNidek();
148
+ }
136
149
  assertEquiDistantAngles() {
137
150
  const round = 1000000;
138
151
  const expectedAngle = (Math.PI * 2) / this.Length;
@@ -1 +1 @@
1
- {"version":3,"file":"ScaleForm.d.ts","sourceRoot":"","sources":["../src/ScaleForm.tsx"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,2CAqHA"}
1
+ {"version":3,"file":"ScaleForm.d.ts","sourceRoot":"","sources":["../src/ScaleForm.tsx"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D,2CA2HA"}
package/dist/ScaleForm.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  export function ScaleForm(props) {
4
+ if (typeof props.currentPoints !== 'number' &&
5
+ typeof props.currentPoints !== 'string') {
6
+ console.error('Invalid currentPoints in ScaleForm:', props.currentPoints);
7
+ }
4
8
  const [length, setLength] = useState(props.sl ?? 0);
5
9
  const [height, setHeight] = useState(props.sh ?? 0);
6
10
  const handleSubmit = (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"States.d.ts","sourceRoot":"","sources":["../src/States.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAoB,MAAM,OAAO,CAAC;AAM9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAwLd"}
1
+ {"version":3,"file":"States.d.ts","sourceRoot":"","sources":["../src/States.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAoB,MAAM,OAAO,CAAC;AAM9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAuNd"}
package/dist/States.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Input } from '@mui/material';
3
- import { State, ACTION, StateModal, STATUS, getValidActions, } from 'frame.statemachine';
3
+ import { ACTION, StateModal, STATUS, getValidActions, State, } from 'frame.statemachine';
4
4
  import { useRef, useState } from 'react';
5
5
  import { ScaleForm } from './ScaleForm';
6
6
  import { Action } from './Action';
@@ -102,5 +102,26 @@ export function States(props) {
102
102
  }
103
103
  return isEnabled;
104
104
  }
105
- return (_jsxs("div", { id: "idStates", children: [_jsxs(Box, { sx: { marginBottom: 2 }, children: [_jsx("div", { style: { fontWeight: 'bold', background: 'lightblue' }, children: props.machine.name }), _jsx("br", {}), _jsx(Input, { inputRef: fileInputRef, type: "file", inputProps: { accept: 'image/*' }, style: { display: 'none' }, onChange: handleFileChange, disabled: false }), _jsx(State, { status: STATUS.START, current: props.machine }), _jsx(State, { status: STATUS.IMAGE_LOADED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_STARTED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_FINISHED, current: props.machine }), _jsx(State, { status: STATUS.POINTS_DEFINED, label: `${props.machine.context.nrPoints} points defined`, current: props.machine, children: _jsx(StateModal, { isOpen: showModalPointsForm, onClose: onClosePointsForm, position: "top-right", children: _jsx(PointsForm, { title: "Import points", onCloseCancel: handleClosePointsFormCancel, onCloseContinue: handleClosePointsFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_SCALED, current: props.machine, children: _jsx(StateModal, { isOpen: showModalScaleForm, onClose: onCloseScaleForm, position: "top-right", children: _jsx(ScaleForm, { title: "Apply Scale", currentPoints: props.machine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_READY, label: `Form ready [${props.machine.context.length} x ${props.machine.context.height}]`, current: props.machine })] }), _jsx(Box, { sx: { display: 'flex', flexDirection: 'row', gap: 2 }, children: renderActions(getValidActions(props.machine, checkIfActionIsEnabled)) })] }));
105
+ if (typeof props.machine.context.nrPoints !== 'number' &&
106
+ typeof props.machine.context.nrPoints !== 'string') {
107
+ console.error('Invalid nrPoints:', props.machine.context.nrPoints);
108
+ }
109
+ // Defensive check for FORM_READY label values
110
+ const lengthValue = props.machine.context.length;
111
+ const heightValue = props.machine.context.height;
112
+ if ((typeof lengthValue !== 'number' && typeof lengthValue !== 'string') ||
113
+ (typeof heightValue !== 'number' && typeof heightValue !== 'string')) {
114
+ console.error('Invalid FORM_READY label values:', {
115
+ lengthValue,
116
+ heightValue,
117
+ });
118
+ }
119
+ return (_jsxs("div", { id: "idStates", children: [_jsxs(Box, { sx: { marginBottom: 2 }, children: [_jsx("div", { style: { fontWeight: 'bold', background: 'lightblue' }, children: props.machine.name }), _jsx("br", {}), _jsx(Input, { inputRef: fileInputRef, type: "file", inputProps: { accept: 'image/*' }, style: { display: 'none' }, onChange: handleFileChange, disabled: false }), _jsx(State, { status: STATUS.START, current: props.machine }), _jsx(State, { status: STATUS.IMAGE_LOADED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_STARTED, current: props.machine }), _jsx(State, { status: STATUS.X_AXIS_FINISHED, current: props.machine }), _jsx(State, { status: STATUS.POINTS_DEFINED, label: `${typeof props.machine.context.nrPoints === 'number' ||
120
+ typeof props.machine.context.nrPoints === 'string'
121
+ ? props.machine.context.nrPoints
122
+ : ''} points defined`, current: props.machine, children: _jsx(StateModal, { isOpen: showModalPointsForm, onClose: onClosePointsForm, position: "top-right", children: _jsx(PointsForm, { title: "Import points", onCloseCancel: handleClosePointsFormCancel, onCloseContinue: handleClosePointsFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_SCALED, current: props.machine, children: _jsx(StateModal, { isOpen: showModalScaleForm, onClose: onCloseScaleForm, position: "top-right", children: _jsx(ScaleForm, { title: "Apply Scale", currentPoints: props.machine.context.nrPoints, onCloseCancel: handleCloseScaleFormCancel, onCloseContinue: handleCloseScaleFormContinue }) }) }), _jsx(State, { status: STATUS.FORM_READY, label: `Form ready [${typeof props.machine.context.length === 'number'
123
+ ? props.machine.context.length
124
+ : ''} x ${typeof props.machine.context.height === 'number'
125
+ ? props.machine.context.height
126
+ : ''}]`, current: props.machine })] }), _jsx(Box, { sx: { display: 'flex', flexDirection: 'row', gap: 2 }, children: renderActions(getValidActions(props.machine, checkIfActionIsEnabled)) })] }));
106
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frame.image",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "A React component for drawing a frame on a canvas element.",
5
5
  "license": "MIT",
6
6
  "author": "Christian.Todd@rodenstock.com",
@@ -22,24 +22,26 @@
22
22
  "@emotion/react": "^11.14.0",
23
23
  "@emotion/styled": "^11.14.1",
24
24
  "@mui/material": "^7.3.1",
25
- "frame.akima": "^1.2.0",
26
- "frame.statemachine": "^1.1.2",
25
+ "frame.akima": "^1.2.1",
26
+ "frame.nidek": "^1.1.4",
27
+ "frame.statemachine": "^1.1.3",
27
28
  "react": "^18.3.1",
28
29
  "react-dom": "^18.3.1",
30
+ "react-error-boundary": "^6.0.0",
29
31
  "react-robot": "^1.2.0"
30
32
  },
31
33
  "devDependencies": {
32
- "@eslint/js": "^9.33.0",
34
+ "@eslint/js": "^9.34.0",
33
35
  "@types/react": "^18.0.0",
34
36
  "@types/react-dom": "^18.0.0",
35
- "@vitejs/plugin-react": "^5.0.1",
36
- "eslint": "^9.33.0",
37
+ "@vitejs/plugin-react": "^5.0.2",
38
+ "eslint": "^9.34.0",
37
39
  "eslint-plugin-react-hooks": "^5.2.0",
38
40
  "eslint-plugin-react-refresh": "^0.4.19",
39
41
  "globals": "^16.3.0",
40
- "typedoc": "^0.28.10",
42
+ "typedoc": "^0.28.11",
41
43
  "typescript": "~5.9.2",
42
- "typescript-eslint": "^8.40.0",
44
+ "typescript-eslint": "^8.41.0",
43
45
  "vite": "^7.1.3"
44
46
  }
45
47
  }