frame.image 1.3.1 → 1.3.3

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.
@@ -0,0 +1,4 @@
1
+ export declare function Designer(props: {
2
+ onClose: () => void;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=Designer.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from '@mui/material';
3
+ import { DrawCanvas } from './DrawCanvas';
4
+ import { ScaleForm } from './ScaleForm';
5
+ import { ShowOptions } from './ShowOptions';
6
+ import { States } from './States';
7
+ import { ACTION, machine, STATUS } from 'frame.statemachine';
8
+ import { useMachine } from 'react-robot';
9
+ import { useState } from 'react';
10
+ import { Polygon } from './Polygon';
11
+ import { Point } from './Point';
12
+ import { Finish } from './Finish';
13
+ export function Designer(props) {
14
+ const nrPoints = 128;
15
+ const width = 600;
16
+ const height = 400;
17
+ const universeCenter = new Point(width / 2, height / 2);
18
+ const [currentMachine, sendCommand] = useMachine(machine);
19
+ const [imageUrl, setDataUrl] = useState(undefined);
20
+ const [axis, setAxis] = useState({});
21
+ const [rotationAngle, setRotationAngle] = useState(0);
22
+ const [coords, setCoords] = useState(new Polygon([], universeCenter));
23
+ const [show, setShow] = useState({
24
+ catmullRomPoints: true,
25
+ catmullRom: true,
26
+ catmullRomCenter: true,
27
+ points: true,
28
+ polygon: false,
29
+ center: false,
30
+ box: false,
31
+ scaledBox: true,
32
+ background: true,
33
+ });
34
+ const [status, setStatus] = useState(STATUS.START);
35
+ const [imageCoords, setImageCoords] = useState({
36
+ horizontal: 0,
37
+ vertical: 0,
38
+ });
39
+ const [catmullRomPoints, setCatmullRomPoints] = useState(undefined);
40
+ const [SH, setSH] = useState(0);
41
+ const [SL, setSL] = useState(0);
42
+ const styleStates = {
43
+ position: 'absolute',
44
+ top: '50%',
45
+ left: '50%',
46
+ transform: 'translate(-50%, -50%)',
47
+ width: 1000,
48
+ height: 700,
49
+ bgcolor: 'background.paper',
50
+ border: '2px solid #000',
51
+ boxShadow: 24,
52
+ p: 4,
53
+ };
54
+ const styleCanvas = {
55
+ position: 'absolute',
56
+ top: '58%',
57
+ left: '50%',
58
+ transform: 'translate(-80%, -50%)',
59
+ width,
60
+ height,
61
+ bgcolor: 'background.paper',
62
+ border: '2px solid #000',
63
+ boxShadow: 24,
64
+ p: 4,
65
+ padding: '2px',
66
+ };
67
+ const onClickReset = () => {
68
+ setCoords(new Polygon([], universeCenter));
69
+ // setCatmullRomPoints(undefined);
70
+ setDataUrl(undefined);
71
+ setAxis({ x1: undefined, x2: undefined });
72
+ setRotationAngle(0);
73
+ sendCommand(ACTION.RESET);
74
+ };
75
+ function onCloseScaleForm(cont = true) {
76
+ // if (cont) {
77
+ // props.command(ACTION.SCALE_FORM);
78
+ // }
79
+ // setShowModalScaleForm(false);
80
+ }
81
+ function handleCloseScaleFormCancel() {
82
+ onCloseScaleForm(false);
83
+ }
84
+ function handleCloseScaleFormContinue(length, height) {
85
+ currentMachine.context.length = length;
86
+ currentMachine.context.height = height;
87
+ onCloseScaleForm(true);
88
+ }
89
+ 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
+ ...styleCanvas,
91
+ display: 'flex',
92
+ flexDirection: 'row',
93
+ alignItems: 'flex-start',
94
+ 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 })] }));
96
+ }
@@ -0,0 +1,9 @@
1
+ import { Point } from './Point';
2
+ import { TCoordsHook } from './types';
3
+ export declare function Finish(props: {
4
+ universeCenter: Point;
5
+ nrPoints: number;
6
+ coords: TCoordsHook;
7
+ onClose: () => void;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=Finish.d.ts.map
@@ -0,0 +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"}
package/dist/Finish.js ADDED
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button } from '@mui/material';
3
+ import { useState } from 'react';
4
+ import { Point } from './Point';
5
+ export function Finish(props) {
6
+ const [originalCoords, setOriginalCoords] = useState(undefined);
7
+ const styleButton = {
8
+ position: 'absolute',
9
+ top: '78%',
10
+ left: '50%',
11
+ transform: 'translate(-50%, -50%)',
12
+ };
13
+ const refine = (coordinates) => {
14
+ // 1) Transform to Center
15
+ const prevCenter = coordinates.Center;
16
+ let transformed = coordinates.transform(prevCenter.x, prevCenter.y, props.universeCenter);
17
+ // 2) Convert to Spline
18
+ const xCenter = (coordinates.XMax + coordinates.XMin) / 2;
19
+ const yCenter = (coordinates.YMax + coordinates.YMin) / 2;
20
+ const catmullRomPolygon = transformed.createCatmullRomPoints(props.nrPoints, new Point(xCenter, yCenter));
21
+ // setCatmullRomPoints(catmullRomPolygon);
22
+ // 3) Reset Spline and adjust Points to new origin
23
+ // if (catmullRomPolygon) {
24
+ // setCoords(catmullRomPolygon);
25
+ // }
26
+ // setCatmullRomPoints(undefined);
27
+ const dist = Math.hypot(catmullRomPolygon.Center.X, catmullRomPolygon.Center.Y);
28
+ // 4) Retransform back to Center
29
+ transformed = catmullRomPolygon.transform(-prevCenter.X, -prevCenter.Y, props.universeCenter);
30
+ return { coords: transformed, dist };
31
+ };
32
+ const onTransform = () => {
33
+ let distance = 1000;
34
+ let coordinates = props.coords.coords.clone();
35
+ setOriginalCoords(props.coords.coords);
36
+ while (distance > 0.01) {
37
+ // find the point with the minimum distance to the center
38
+ const { dist, coords } = refine(coordinates);
39
+ distance = dist;
40
+ coordinates = coords;
41
+ }
42
+ props.coords.setCoords(coordinates);
43
+ console.log(`ready`);
44
+ };
45
+ const onReset = () => {
46
+ if (originalCoords) {
47
+ props.coords.setCoords(originalCoords);
48
+ setOriginalCoords(undefined);
49
+ }
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" })] }));
60
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDesigner.d.ts","sourceRoot":"","sources":["../src/ModalDesigner.tsx"],"names":[],"mappings":"AAiDA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,2CA4N5E"}
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,152 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Modal, Box, Button } from '@mui/material';
3
- import { States } from './States';
4
- import { DrawCanvas } from './DrawCanvas';
5
- import { Polygon } from './Polygon';
6
- import { Point } from './Point';
7
- import { ShowOptions } from './ShowOptions';
8
- import { ScaleForm } from './ScaleForm';
9
- import { useEffect, useState } from 'react';
10
- import { useMachine } from 'react-robot';
11
- import { ACTION, machine, STATUS } from 'frame.statemachine';
12
- const width = 600;
13
- const height = 400;
14
- const styleStates = {
15
- position: 'absolute',
16
- top: '50%',
17
- left: '50%',
18
- transform: 'translate(-50%, -50%)',
19
- width: 1000,
20
- height: 700,
21
- bgcolor: 'background.paper',
22
- border: '2px solid #000',
23
- boxShadow: 24,
24
- p: 4,
25
- };
26
- const styleCanvas = {
27
- position: 'absolute',
28
- top: '58%',
29
- left: '50%',
30
- transform: 'translate(-80%, -50%)',
31
- width,
32
- height,
33
- bgcolor: 'background.paper',
34
- border: '2px solid #000',
35
- boxShadow: 24,
36
- p: 4,
37
- padding: '2px',
38
- };
39
- const styleButton = {
40
- position: 'absolute',
41
- top: '78%',
42
- left: '50%',
43
- transform: 'translate(-50%, -50%)',
44
- };
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Modal } from '@mui/material';
3
+ import { Designer } from './Designer';
45
4
  export function ModalDesigner(props) {
46
- const [currentMachine, sendCommand] = useMachine(machine);
47
- const nrPoints = 128;
48
- const universeCenter = new Point(width / 2, height / 2);
49
- const [originalCoords, setOriginalCoords] = useState(undefined);
50
- const [coords, setCoords] = useState(new Polygon([], universeCenter));
51
- const [axis, setAxis] = useState({});
52
- const [rotationAngle, setRotationAngle] = useState(0);
53
- const [imageCoords, setImageCoords] = useState({
54
- horizontal: 0,
55
- vertical: 0,
56
- });
57
- const [imageUrl, setDataUrl] = useState(undefined);
58
- const [status, setStatus] = useState(STATUS.START);
59
- const [show, setShow] = useState({
60
- catmullRomPoints: true,
61
- catmullRom: true,
62
- catmullRomCenter: true,
63
- points: true,
64
- polygon: false,
65
- center: false,
66
- box: false,
67
- scaledBox: true,
68
- background: true,
69
- });
70
- const [catmullRomPoints, setCatmullRomPoints] = useState(undefined);
71
- const [SH, setSH] = useState(0);
72
- const [SL, setSL] = useState(0);
73
- function onCloseScaleForm(cont = true) {
74
- // if (cont) {
75
- // props.command(ACTION.SCALE_FORM);
76
- // }
77
- // setShowModalScaleForm(false);
78
- }
79
- function handleCloseScaleFormCancel() {
80
- onCloseScaleForm(false);
81
- }
82
- function handleCloseScaleFormContinue(length, height) {
83
- currentMachine.context.length = length;
84
- currentMachine.context.height = height;
85
- onCloseScaleForm(true);
86
- }
87
- const refine = (coordinates) => {
88
- // 1) Transform to Center
89
- const prevCenter = coordinates.Center;
90
- let transformed = coordinates.transform(prevCenter.x, prevCenter.y, universeCenter);
91
- // 2) Convert to Spline
92
- const xCenter = (coordinates.XMax + coordinates.XMin) / 2;
93
- const yCenter = (coordinates.YMax + coordinates.YMin) / 2;
94
- const catmullRomPolygon = transformed.createCatmullRomPoints(nrPoints, new Point(xCenter, yCenter));
95
- // setCatmullRomPoints(catmullRomPolygon);
96
- // 3) Reset Spline and adjust Points to new origin
97
- // if (catmullRomPolygon) {
98
- // setCoords(catmullRomPolygon);
99
- // }
100
- // setCatmullRomPoints(undefined);
101
- const dist = Math.hypot(catmullRomPolygon.Center.X, catmullRomPolygon.Center.Y);
102
- // 4) Retransform back to Center
103
- transformed = catmullRomPolygon.transform(-prevCenter.X, -prevCenter.Y, universeCenter);
104
- return { coords: transformed, dist };
105
- };
106
- const onClickReset = () => {
107
- setCoords(new Polygon([], universeCenter));
108
- // setCatmullRomPoints(undefined);
109
- setDataUrl(undefined);
110
- setAxis({ x1: undefined, x2: undefined });
111
- setRotationAngle(0);
112
- sendCommand(ACTION.RESET);
113
- };
114
- const onReset = () => {
115
- if (originalCoords) {
116
- setCoords(originalCoords);
117
- setOriginalCoords(undefined);
118
- }
119
- };
120
- const onTransform = () => {
121
- let distance = 1000;
122
- let coordinates = coords;
123
- setOriginalCoords(coords);
124
- while (distance > 0.01) {
125
- // find the point with the minimum distance to the center
126
- const { dist, coords } = refine(coordinates);
127
- distance = dist;
128
- coordinates = coords;
129
- }
130
- setCoords(coordinates);
131
- console.log(`ready`);
132
- };
133
- const onCreateRT1 = () => {
134
- const catmullRomPolygon = coords.createCatmullRomPoints(128);
135
- catmullRomPolygon.assertEquiDistantAngles();
136
- const rt1 = catmullRomPolygon.createRT1();
137
- setCoords(catmullRomPolygon);
138
- console.log(`RT1: ${rt1}`);
139
- props.onClose();
140
- };
141
- useEffect(() => {
142
- setSH(coords.YMax - coords.YMin);
143
- setSL(coords.XMax - coords.XMin);
144
- }, [coords]);
145
- return (_jsx(Modal, { open: props.isOpen, onClose: props.onClose, "aria-labelledby": "modal-title", "aria-describedby": "modal-description", children: _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: {
146
- ...styleCanvas,
147
- display: 'flex',
148
- flexDirection: 'row',
149
- alignItems: 'flex-start',
150
- gap: 2,
151
- }, 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 })] }), _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" })] })] }) }));
5
+ return (_jsx(Modal, { open: props.isOpen, onClose: props.onClose, "aria-labelledby": "modal-title", "aria-describedby": "modal-description", children: _jsx(Designer, { onClose: props.onClose }) }));
152
6
  }
package/dist/Point.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare class Point {
5
5
  private yOrigin;
6
6
  static drawBox(context: CanvasRenderingContext2D, p1: Point, p2: Point, color: string): void;
7
7
  constructor(x: number, y: number, origin?: Point);
8
+ clone(): Point;
8
9
  get X(): number;
9
10
  get Y(): number;
10
11
  get Origin(): Point;
@@ -1 +1 @@
1
- {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../src/Point.ts"],"names":[],"mappings":"AAAA,qBAAa,KA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E,EAAE,KAAK,EACT,KAAK,EAAE,MAAM;gBAaH,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK;IAOhD,KAAK,IAAI,KAAK;IAId,IAAI,CAAC,WAEJ;IAED,IAAI,CAAC,WAEJ;IAED,IAAI,MAAM,IAAI,KAAK,CAElB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM;IAW/B,IAAI,CACF,OAAO,EAAE,wBAAwB,EACjC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EACD,MAAM,SAAI,GACT,IAAI;IAsBP,SAAS,CACP,OAAO,EAAE,wBAAwB,EACjC,KAAK,SAAU,EACf,MAAM,SAAK,EACX,SAAS,SAAI,GACZ,IAAI;IAiBP,QAAQ,CACN,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,KAAK,EACZ,KAAK,SAAU,EACf,SAAS,SAAI,GACZ,IAAI;IASP,OAAO,CAAC,MAAM,SAAI,GAAG,KAAK;CAQ3B"}
package/dist/Point.js CHANGED
@@ -15,6 +15,9 @@ export class Point {
15
15
  this.x = x;
16
16
  this.y = y;
17
17
  }
18
+ clone() {
19
+ return new Point(this.X, this.Y, this.Origin);
20
+ }
18
21
  get X() {
19
22
  return this.x;
20
23
  }
package/dist/Polygon.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare class Polygon {
7
7
  private yMin;
8
8
  private yMax;
9
9
  constructor(points: Point[], universeCenter: Point);
10
+ clone(): Polygon;
10
11
  get Length(): number;
11
12
  get Points(): Point[];
12
13
  get XYPoints(): {
@@ -1 +1 @@
1
- {"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../src/Polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS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AM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO;IAyBjE,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAYtC,SAAS,IAAI,MAAM;IAuBnB,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
@@ -15,6 +15,10 @@ export class Polygon {
15
15
  this.yMax = Math.max(...points.map((point) => point.Y));
16
16
  this.universeCenter = universeCenter;
17
17
  }
18
+ clone() {
19
+ const clonedPoints = this.points.map((point) => point.clone());
20
+ return new Polygon(clonedPoints, this.universeCenter);
21
+ }
18
22
  get Length() {
19
23
  return this.points.length;
20
24
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export { DrawCanvas } from './DrawCanvas';
2
2
  export { ModalDesigner } from './ModalDesigner';
3
+ export { Designer } from './Designer';
4
+ export { Finish } from './Finish';
5
+ export { ScaleForm } from './ScaleForm';
6
+ export { ShowOptions } from './ShowOptions';
7
+ export { States } from './States';
3
8
  export { TCoordsHook, TStatusHook, TShowHook, TAxisHook, TMouseCoordsHook, TImageHook, TRotationHook, TCatmullRomPointsHook, } from './types';
4
9
  export { Polygon } from './Polygon';
5
10
  export { Point } from './Point';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  export { DrawCanvas } from './DrawCanvas';
2
2
  export { ModalDesigner } from './ModalDesigner';
3
+ export { Designer } from './Designer';
4
+ export { Finish } from './Finish';
5
+ export { ScaleForm } from './ScaleForm';
6
+ export { ShowOptions } from './ShowOptions';
7
+ export { States } from './States';
3
8
  export { Polygon } from './Polygon';
4
9
  export { Point } from './Point';
@@ -1 +1 @@
1
- {"root":["../src/action.tsx","../src/app.tsx","../src/center.tsx","../src/drawcanvas.tsx","../src/imagehandler.tsx","../src/lens.ts","../src/loadimage.tsx","../src/modaldesigner.tsx","../src/mousecoords.tsx","../src/point.ts","../src/pointsform.tsx","../src/polygon.ts","../src/scaleform.tsx","../src/scaling.tsx","../src/showoptions.tsx","../src/sortedpoints.ts","../src/states.tsx","../src/workflow.tsx","../src/enum.ts","../src/index.ts","../src/main.tsx","../src/types.ts","../src/vite-env.d.ts"],"version":"5.9.2"}
1
+ {"root":["../src/action.tsx","../src/app.tsx","../src/center.tsx","../src/designer.tsx","../src/drawcanvas.tsx","../src/finish.tsx","../src/imagehandler.tsx","../src/lens.ts","../src/loadimage.tsx","../src/modaldesigner.tsx","../src/mousecoords.tsx","../src/point.ts","../src/pointsform.tsx","../src/polygon.ts","../src/scaleform.tsx","../src/scaling.tsx","../src/showoptions.tsx","../src/sortedpoints.ts","../src/states.tsx","../src/workflow.tsx","../src/enum.ts","../src/index.ts","../src/main.tsx","../src/types.ts","../src/vite-env.d.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frame.image",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
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,22 +22,23 @@
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.statemachine": "^1.1.3",
27
27
  "react": "^18.3.1",
28
28
  "react-dom": "^18.3.1",
29
+ "react-error-boundary": "^6.0.0",
29
30
  "react-robot": "^1.2.0"
30
31
  },
31
32
  "devDependencies": {
32
- "@eslint/js": "^9.33.0",
33
+ "@eslint/js": "^9.34.0",
33
34
  "@types/react": "^18.0.0",
34
35
  "@types/react-dom": "^18.0.0",
35
36
  "@vitejs/plugin-react": "^5.0.1",
36
- "eslint": "^9.33.0",
37
+ "eslint": "^9.34.0",
37
38
  "eslint-plugin-react-hooks": "^5.2.0",
38
39
  "eslint-plugin-react-refresh": "^0.4.19",
39
40
  "globals": "^16.3.0",
40
- "typedoc": "^0.28.10",
41
+ "typedoc": "^0.28.11",
41
42
  "typescript": "~5.9.2",
42
43
  "typescript-eslint": "^8.40.0",
43
44
  "vite": "^7.1.3"