@yorab/react-paint 0.10.1 → 0.11.1
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/README.md +191 -1
- package/dist/{components → canvas/components}/Canvas.d.ts +4 -4
- package/dist/{components/toolbox → canvas/components}/EditTextBox.d.ts +3 -4
- package/dist/canvas/constants/app.d.ts +44 -0
- package/dist/canvas/constants/grid.d.ts +1 -0
- package/dist/{constants → canvas/constants}/shapes.d.ts +1 -1
- package/dist/{hooks → canvas/hooks}/useComponent.d.ts +1 -1
- package/dist/{hooks → canvas/hooks}/useDrawableCanvas.d.ts +5 -5
- package/dist/{hooks → canvas/hooks}/useKeyboard.d.ts +2 -2
- package/dist/canvas/hooks/useReactPaint.d.ts +119 -0
- package/dist/{hooks → canvas/hooks}/useShapes.d.ts +9 -4
- package/dist/canvas/index.d.ts +15 -0
- package/dist/{utils → canvas/utils}/canvas.d.ts +2 -2
- package/dist/{utils → canvas/utils}/data.d.ts +4 -4
- package/dist/{utils → canvas/utils}/file.d.ts +3 -3
- package/dist/{utils → canvas/utils}/grid.d.ts +1 -1
- package/dist/{utils → canvas/utils}/intersect.d.ts +3 -3
- package/dist/{utils → canvas/utils}/selection/lineSelection.d.ts +2 -2
- package/dist/{utils → canvas/utils}/selection/rectSelection.d.ts +3 -3
- package/dist/canvas/utils/selection/selectionFrame.d.ts +3 -0
- package/dist/{utils → canvas/utils}/selection.d.ts +3 -3
- package/dist/{utils → canvas/utils}/shapes/brush.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/circle.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/curve.d.ts +5 -5
- package/dist/{utils → canvas/utils}/shapes/ellipse.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/index.d.ts +5 -5
- package/dist/{utils → canvas/utils}/shapes/line.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/path.d.ts +2 -2
- package/dist/{utils → canvas/utils}/shapes/picture.d.ts +3 -3
- package/dist/{utils → canvas/utils}/shapes/polygon.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/rectangle.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/text.d.ts +4 -4
- package/dist/{utils → canvas/utils}/shapes/triangle.d.ts +1 -1
- package/dist/{utils → canvas/utils}/string.d.ts +0 -1
- package/dist/canvas/utils/tools.d.ts +3 -0
- package/dist/{utils → canvas/utils}/transform.d.ts +3 -3
- package/dist/{utils → canvas/utils}/trigo.d.ts +4 -4
- package/dist/{types → common/types}/Shapes.d.ts +4 -4
- package/dist/common/utils/array.d.ts +1 -0
- package/dist/editor/components/common/Loading.d.ts +6 -0
- package/dist/{components → editor/components}/common/Modal.d.ts +2 -2
- package/dist/{components → editor/components}/common/Panel.d.ts +2 -2
- package/dist/{components → editor/components}/common/Snackbar.d.ts +2 -3
- package/dist/{components → editor/components}/settings/ColorField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/DeleteButton.d.ts +2 -3
- package/dist/{components → editor/components}/settings/FontFamilyField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/LayoutButton.d.ts +1 -2
- package/dist/{components → editor/components}/settings/Layouts.d.ts +5 -6
- package/dist/{components → editor/components}/settings/LineArrowField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/LineTypeField.d.ts +3 -3
- package/dist/{components → editor/components}/settings/PointsNumberField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/RangeField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/SelectField.d.ts +2 -2
- package/dist/{components → editor/components}/settings/SettingsBar.d.ts +4 -5
- package/dist/{components → editor/components}/settings/ToggleField.d.ts +2 -2
- package/dist/{components → editor/components}/toolbox/LoadFileTool.d.ts +2 -3
- package/dist/{components → editor/components}/toolbox/MenuGroup.d.ts +3 -4
- package/dist/{components → editor/components}/toolbox/PictureUrlInput.d.ts +1 -2
- package/dist/{components → editor/components}/toolbox/Tool.d.ts +2 -3
- package/dist/{components → editor/components}/toolbox/Toolbar.d.ts +3 -4
- package/dist/{components → editor/components}/toolbox/ToolbarGroup.d.ts +2 -3
- package/dist/editor/constants/grid.d.ts +7 -0
- package/dist/editor/constants/options.d.ts +13 -0
- package/dist/{constants → editor/constants}/snackbar.d.ts +1 -1
- package/dist/{constants → editor/constants}/style.d.ts +0 -3
- package/dist/{constants → editor/constants}/tools.d.ts +1 -1
- package/dist/{hooks → editor/hooks}/useDrag.d.ts +2 -2
- package/dist/{hooks → editor/hooks}/useSnackbar.d.ts +3 -3
- package/dist/editor/index.d.ts +24 -0
- package/dist/{utils → editor/utils}/style.d.ts +1 -1
- package/dist/editor/utils/toolbar.d.ts +11 -0
- package/dist/index.d.ts +6 -0
- package/dist/react-paint.css +1 -1
- package/dist/react-paint.js +970 -943
- package/dist/react-paint.umd.cjs +1 -1
- package/package.json +61 -56
- package/dist/components/App.d.ts +0 -20
- package/dist/components/common/Loading.d.ts +0 -7
- package/dist/constants/app.d.ts +0 -58
- package/dist/utils/array.d.ts +0 -1
- package/dist/utils/selection/selectionFrame.d.ts +0 -3
- package/dist/utils/toolbar.d.ts +0 -13
- /package/dist/{constants → canvas/constants}/picture.d.ts +0 -0
- /package/dist/{hooks → canvas/hooks}/useDoubleClick.d.ts +0 -0
- /package/dist/{hooks → canvas/hooks}/useResizeObserver.d.ts +0 -0
- /package/dist/{types → common/types}/Mode.d.ts +0 -0
- /package/dist/{types → common/types}/react.d.ts +0 -0
- /package/dist/{types → common/types}/tools.d.ts +0 -0
- /package/dist/{types → common/types}/utils.d.ts +0 -0
- /package/dist/{utils → common/utils}/dom.d.ts +0 -0
- /package/dist/{utils → common/utils}/object.d.ts +0 -0
- /package/dist/{utils → common/utils}/util.d.ts +0 -0
- /package/dist/{components → editor/components}/common/Button.d.ts +0 -0
- /package/dist/{constants → editor/constants}/icons.d.ts +0 -0
- /package/dist/{constants → editor/constants}/loading.d.ts +0 -0
- /package/dist/{types → editor/types}/snackbar.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UtilsSettings } from '
|
|
2
|
-
import { SelectionModeData } from '
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity } from '
|
|
4
|
-
import type { CustomTool } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeData } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Point, Rect, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
|
+
import type { CustomTool } from './../../../common/types/tools';
|
|
5
5
|
export declare const createShape: (ctx: CanvasRenderingContext2D, shape: Exclude<CustomTool, {
|
|
6
6
|
type: 'picture';
|
|
7
7
|
}>, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity;
|
|
@@ -22,7 +22,7 @@ export declare const drawShapeSelection: ({ ctx, shape, settings, selectionWidth
|
|
|
22
22
|
settings: UtilsSettings;
|
|
23
23
|
selectionWidth: number;
|
|
24
24
|
selectionColor: string;
|
|
25
|
-
withAnchors?: boolean
|
|
25
|
+
withAnchors?: boolean;
|
|
26
26
|
}) => void;
|
|
27
27
|
export declare const drawSelectionFrame: ({ ctx, selectionFrame, settings }: {
|
|
28
28
|
ctx: CanvasRenderingContext2D;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UtilsSettings } from '
|
|
2
|
-
import { SelectionModeResize } from '
|
|
3
|
-
import type { DrawableShape, Line, Point, Rect, ShapeEntity, StyleShape, Triangle } from '
|
|
4
|
-
import type { ToolsSettingsType } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Line, Point, Rect, ShapeEntity, StyleShape, Triangle } from './../../../common/types/Shapes';
|
|
4
|
+
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
export declare const refreshLine: <T extends DrawableShape<"line">>(line: T, settings: UtilsSettings) => T;
|
|
6
6
|
export declare const createLine: (shape: {
|
|
7
7
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UtilsSettings } from '
|
|
2
|
-
import { Circle, DrawableShape, Line, Rect } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { Circle, DrawableShape, Line, Rect } from './../../../common/types/Shapes';
|
|
3
3
|
export declare const createRecPath: (rect: Rect) => Path2D;
|
|
4
4
|
export declare const createCirclePath: (shape: Circle) => Path2D;
|
|
5
5
|
export declare const createEllipsePath: (ellipse: DrawableShape<'ellipse'>) => Path2D;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UtilsSettings } from '
|
|
2
|
-
import { SelectionModeResize } from '
|
|
3
|
-
import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T, settings: UtilsSettings) => T;
|
|
5
5
|
export declare const createPicture: (fileOrUrl: File | string, maxPictureWidth: number, maxPictureHeight: number, settings: UtilsSettings) => Promise<ShapeEntity<"picture">>;
|
|
6
6
|
export declare const drawPicture: (ctx: CanvasRenderingContext2D, picture: DrawableShape<'picture'>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UtilsSettings } from '
|
|
2
|
-
import { SelectionModeResize } from '
|
|
3
|
-
import type { DrawableShape, Point, Polygon, Rect, ShapeEntity } from '
|
|
4
|
-
import type { ToolsSettingsType } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Point, Polygon, Rect, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
|
+
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T, settings: UtilsSettings) => T;
|
|
6
6
|
export declare const createPolygon: (shape: {
|
|
7
7
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UtilsSettings } from '
|
|
2
|
-
import type { SelectionModeResize } from '
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity } from '
|
|
4
|
-
import type { ToolsSettingsType } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Point, Rect, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
|
+
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
type rectish = 'text' | 'rect' | 'square' | 'picture';
|
|
6
6
|
export declare const refreshRect: <T extends DrawableShape<rectish>>(rect: T, settings: UtilsSettings) => T;
|
|
7
7
|
export declare const createRectangle: <T extends "rect" | "square">(shape: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UtilsSettings } from '
|
|
2
|
-
import { SelectionModeResize } from '
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity, Text } from '
|
|
4
|
-
import type { ToolsSettingsType } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Point, Rect, ShapeEntity, Text } from './../../../common/types/Shapes';
|
|
4
|
+
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
export declare const refreshText: <T extends DrawableShape<"text">>(shape: T, settings: UtilsSettings) => T;
|
|
6
6
|
export declare const calculateTextFontSize: (ctx: CanvasRenderingContext2D, text: string[], maxWidth: number, fontBold: boolean, fontItalic: boolean, fontFamily?: string | undefined) => number;
|
|
7
7
|
export declare const createText: (ctx: CanvasRenderingContext2D, shape: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DrawableShape, Triangle } from '
|
|
1
|
+
import type { DrawableShape, Triangle } from './../../../common/types/Shapes';
|
|
2
2
|
export declare const createTriangle: (triangle: Triangle) => DrawableShape<'triangle'>;
|
|
3
3
|
export declare const drawTriangle: (ctx: CanvasRenderingContext2D, triangle: DrawableShape<'triangle'>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UtilsSettings } from '
|
|
2
|
-
import type { SelectionModeData } from '
|
|
3
|
-
import type { DrawableShape, Line, Point, ShapeEntity } from '
|
|
1
|
+
import type { UtilsSettings } from './../../canvas/constants/app';
|
|
2
|
+
import type { SelectionModeData } from './../../common/types/Mode';
|
|
3
|
+
import type { DrawableShape, Line, Point, ShapeEntity } from './../../common/types/Shapes';
|
|
4
4
|
export declare const getNormalizedSize: (originalWidth: number, originalHeight: number, width: number, height: number) => number[];
|
|
5
5
|
export declare const roundValues: (prop: number, precision?: number) => number;
|
|
6
6
|
export declare const scalePoint: (point: Point, minX: number, minY: number, scaleX?: number, scaleY?: number) => Point;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Circle, Point, Rect } from '
|
|
1
|
+
import type { Circle, Point, Rect } from './../../common/types/Shapes';
|
|
2
2
|
type Vector = [Point, Point];
|
|
3
3
|
export declare const degreesToRadians: (degrees: number) => number;
|
|
4
4
|
export declare const radiansToDegrees: (radians: number) => number;
|
|
5
5
|
export declare const isPointInsideRect: (rect: Rect, point: Point) => boolean;
|
|
6
6
|
export declare const isCircleIntersectRect: (rect: Rect, circle: Circle) => boolean;
|
|
7
7
|
export declare const rotatePoint: ({ origin, point, rotation }: {
|
|
8
|
-
origin?: Point
|
|
8
|
+
origin?: Point;
|
|
9
9
|
point: Point;
|
|
10
10
|
rotation: number;
|
|
11
11
|
}) => Point;
|
|
12
12
|
export declare const getAngleFromVector: ({ targetVector: [point1, point2], radian, originVector }: {
|
|
13
13
|
targetVector: Vector;
|
|
14
|
-
radian?: boolean
|
|
15
|
-
originVector?: Vector
|
|
14
|
+
radian?: boolean;
|
|
15
|
+
originVector?: Vector;
|
|
16
16
|
}) => number;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShapeTypeArray } from '
|
|
1
|
+
import type { ShapeTypeArray } from '../../canvas/constants/shapes';
|
|
2
2
|
export type ShapeType = (typeof ShapeTypeArray)[number];
|
|
3
3
|
export type Point = [number, number];
|
|
4
4
|
export type Rect = {
|
|
@@ -64,6 +64,7 @@ export type SelectionLinesType = {
|
|
|
64
64
|
anchors: Path2D[];
|
|
65
65
|
};
|
|
66
66
|
export type DrawableShape<T extends ShapeType = ShapeType> = {
|
|
67
|
+
toolId?: string;
|
|
67
68
|
visible?: boolean;
|
|
68
69
|
locked?: boolean;
|
|
69
70
|
rotation: number;
|
|
@@ -114,13 +115,12 @@ export type DrawableShape<T extends ShapeType = ShapeType> = {
|
|
|
114
115
|
scaleX?: number;
|
|
115
116
|
scaleY?: number;
|
|
116
117
|
} : never);
|
|
117
|
-
export type DrawableShapeJson<T extends ShapeType = ShapeType> = DrawableShape<T>;
|
|
118
118
|
export type ShapeEntity<T extends Exclude<ShapeType, 'triangle'> = Exclude<ShapeType, 'triangle'>> = {
|
|
119
119
|
id: string;
|
|
120
120
|
toolId?: string;
|
|
121
121
|
} & DrawableShape<T>;
|
|
122
|
-
export type
|
|
123
|
-
shapes?:
|
|
122
|
+
export type StateData = {
|
|
123
|
+
shapes?: DrawableShape[];
|
|
124
124
|
config?: {
|
|
125
125
|
width: number;
|
|
126
126
|
height: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const compact: <T>(array: (T | undefined | null)[]) => T[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import './Modal.css';
|
|
3
3
|
type ModalType = {
|
|
4
4
|
children: ReactNode;
|
|
@@ -6,5 +6,5 @@ type ModalType = {
|
|
|
6
6
|
position?: 'center' | 'bottom';
|
|
7
7
|
className?: string;
|
|
8
8
|
};
|
|
9
|
-
declare const Modal: ({ children, onClose, position, className }: ModalType) =>
|
|
9
|
+
declare const Modal: ({ children, onClose, position, className }: ModalType) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default Modal;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './Panel.css';
|
|
3
3
|
type PanelType = {
|
|
4
4
|
vertical?: boolean;
|
|
@@ -9,5 +9,5 @@ type PanelType = {
|
|
|
9
9
|
position?: 'bottom' | 'top';
|
|
10
10
|
alignment?: 'left' | 'right' | 'center';
|
|
11
11
|
};
|
|
12
|
-
declare const Panel: ({ children, title, className, position, fitContainer, alignment }: PanelType) =>
|
|
12
|
+
declare const Panel: ({ children, title, className, position, fitContainer, alignment }: PanelType) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default Panel;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { SnackBarType } from '../../types/snackbar';
|
|
1
|
+
import type { SnackBarType } from './../../../editor/types/snackbar';
|
|
3
2
|
import './Snackbar.css';
|
|
4
3
|
type SnackbarContainerType = {
|
|
5
4
|
snackbarList: SnackBarType[];
|
|
6
5
|
};
|
|
7
|
-
declare const SnackbarContainer: ({ snackbarList }: SnackbarContainerType) =>
|
|
6
|
+
declare const SnackbarContainer: ({ snackbarList }: SnackbarContainerType) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default SnackbarContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './ColorField.css';
|
|
3
3
|
type ShapeStyleColorType = {
|
|
4
4
|
selectedSettings: string | undefined;
|
|
@@ -11,5 +11,5 @@ type ShapeStyleColorType = {
|
|
|
11
11
|
values: string[];
|
|
12
12
|
valueChanged: (field: string, value: string | number) => void;
|
|
13
13
|
};
|
|
14
|
-
declare const ColorField: ({ selectedSettings, setSelectedSettings, title, mode, disabled, values, field, value, valueChanged }: ShapeStyleColorType) =>
|
|
14
|
+
declare const ColorField: ({ selectedSettings, setSelectedSettings, title, mode, disabled, values, field, value, valueChanged }: ShapeStyleColorType) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
15
|
export default ColorField;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ShapeEntity } from '../../types/Shapes';
|
|
1
|
+
import type { ShapeEntity } from './../../../common/types/Shapes';
|
|
3
2
|
type DeleteShapeButtonType = {
|
|
4
3
|
disabled?: boolean;
|
|
5
4
|
selectedShape: ShapeEntity;
|
|
6
5
|
removeShape: (shape: ShapeEntity) => void;
|
|
7
6
|
};
|
|
8
|
-
declare const DeleteButton: ({ disabled, selectedShape, removeShape }: DeleteShapeButtonType) =>
|
|
7
|
+
declare const DeleteButton: ({ disabled, selectedShape, removeShape }: DeleteShapeButtonType) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export default DeleteButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './FontFamilyField.css';
|
|
3
3
|
type FontFamilyFieldType = {
|
|
4
4
|
selectedSettings: string | undefined;
|
|
@@ -8,5 +8,5 @@ type FontFamilyFieldType = {
|
|
|
8
8
|
defaultValue?: number | string | undefined;
|
|
9
9
|
valueChanged: (field: string, value: string | number) => void;
|
|
10
10
|
};
|
|
11
|
-
declare const FontFamilyField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: FontFamilyFieldType) =>
|
|
11
|
+
declare const FontFamilyField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: FontFamilyFieldType) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
export default FontFamilyField;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './LayoutButton.css';
|
|
3
2
|
type LayoutButtonType = {
|
|
4
3
|
disabled: boolean;
|
|
5
4
|
toggleLayoutPanel: () => void;
|
|
6
5
|
};
|
|
7
|
-
declare const LayoutButton: ({ disabled, toggleLayoutPanel }: LayoutButtonType) =>
|
|
6
|
+
declare const LayoutButton: ({ disabled, toggleLayoutPanel }: LayoutButtonType) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default LayoutButton;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type { GridFormatType } from '../../constants/app';
|
|
1
|
+
import type { ShapeEntity } from './../../../common/types/Shapes';
|
|
2
|
+
import type { GridLabelType } from './../../../editor/constants/grid';
|
|
4
3
|
import './Layouts.css';
|
|
5
4
|
type LayoutsType = {
|
|
6
|
-
gridFormat:
|
|
7
|
-
setGridFormat:
|
|
5
|
+
gridFormat: GridLabelType;
|
|
6
|
+
setGridFormat: (value: GridLabelType) => void;
|
|
8
7
|
disabled?: boolean;
|
|
9
8
|
shapes: ShapeEntity[];
|
|
10
9
|
removeShape: (shape: ShapeEntity) => void;
|
|
@@ -15,5 +14,5 @@ type LayoutsType = {
|
|
|
15
14
|
moveShapes: (firstShapeId: string, lastShapeId: string) => void;
|
|
16
15
|
isLayoutPanelShown: boolean;
|
|
17
16
|
};
|
|
18
|
-
declare const Layouts: ({ gridFormat, setGridFormat, disabled, shapes, removeShape, toggleShapeVisibility, toggleShapeLock, selectedShape, moveShapes, selectShape, isLayoutPanelShown }: LayoutsType) =>
|
|
17
|
+
declare const Layouts: ({ gridFormat, setGridFormat, disabled, shapes, removeShape, toggleShapeVisibility, toggleShapeLock, selectedShape, moveShapes, selectShape, isLayoutPanelShown }: LayoutsType) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
18
|
export default Layouts;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './LineArrowField.css';
|
|
3
3
|
type LineArrowType = {
|
|
4
4
|
selectedSettings: string | undefined;
|
|
@@ -8,5 +8,5 @@ type LineArrowType = {
|
|
|
8
8
|
defaultValue?: number | string | undefined;
|
|
9
9
|
valueChanged: (field: string, value: string | number) => void;
|
|
10
10
|
};
|
|
11
|
-
declare const LineArrowField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: LineArrowType) =>
|
|
11
|
+
declare const LineArrowField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: LineArrowType) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
export default LineArrowField;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './LineTypeField.css';
|
|
3
3
|
type LineTypeOptionType = {
|
|
4
4
|
children: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const LineTypeOption: ({ children }: LineTypeOptionType) =>
|
|
6
|
+
export declare const LineTypeOption: ({ children }: LineTypeOptionType) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
type LineTypeType = {
|
|
8
8
|
selectedSettings: string | undefined;
|
|
9
9
|
setSelectedSettings: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
@@ -12,5 +12,5 @@ type LineTypeType = {
|
|
|
12
12
|
defaultValue?: number | string | undefined;
|
|
13
13
|
valueChanged: (field: string, value: string | number) => void;
|
|
14
14
|
};
|
|
15
|
-
declare const LineTypeField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: LineTypeType) =>
|
|
15
|
+
declare const LineTypeField: ({ selectedSettings, setSelectedSettings, disabled, values, defaultValue, valueChanged }: LineTypeType) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
export default LineTypeField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
type PointsNumberFieldType = {
|
|
3
3
|
selectedSettings: string | undefined;
|
|
4
4
|
setSelectedSettings: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
@@ -9,5 +9,5 @@ type PointsNumberFieldType = {
|
|
|
9
9
|
value?: number | undefined;
|
|
10
10
|
valueChanged: (field: string, value: string | number) => void;
|
|
11
11
|
};
|
|
12
|
-
declare const PointsNumberField: ({ selectedSettings, setSelectedSettings, disabled, min, max, step, value, valueChanged }: PointsNumberFieldType) =>
|
|
12
|
+
declare const PointsNumberField: ({ selectedSettings, setSelectedSettings, disabled, min, max, step, value, valueChanged }: PointsNumberFieldType) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
13
|
export default PointsNumberField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './RangeField.css';
|
|
3
3
|
type ShapeStyleColorType = {
|
|
4
4
|
selectedSettings: string | undefined;
|
|
@@ -14,5 +14,5 @@ type ShapeStyleColorType = {
|
|
|
14
14
|
value?: number | undefined;
|
|
15
15
|
valueChanged: (field: string, value: string | number, needHistorySave?: boolean) => void;
|
|
16
16
|
};
|
|
17
|
-
declare const RangeField: ({ selectedSettings, setSelectedSettings, title, icon, disabled, field, value, min, max, step, unity, valueChanged }: ShapeStyleColorType) =>
|
|
17
|
+
declare const RangeField: ({ selectedSettings, setSelectedSettings, title, icon, disabled, field, value, min, max, step, unity, valueChanged }: ShapeStyleColorType) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
18
|
export default RangeField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import './SelectField.css';
|
|
3
3
|
type SelectFieldType = {
|
|
4
4
|
CustomOption: React.FC<{
|
|
@@ -14,5 +14,5 @@ type SelectFieldType = {
|
|
|
14
14
|
defaultValue?: number | string | undefined;
|
|
15
15
|
valueChanged: (field: string, value: string | number) => void;
|
|
16
16
|
};
|
|
17
|
-
declare const SelectField: ({ CustomOption, selectedSettings, setSelectedSettings, title, disabled, field, icon, values, defaultValue, valueChanged }: SelectFieldType) =>
|
|
17
|
+
declare const SelectField: ({ CustomOption, selectedSettings, setSelectedSettings, title, disabled, field, icon, values, defaultValue, valueChanged }: SelectFieldType) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
18
|
export default SelectField;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ShapeEntity } from '
|
|
3
|
-
import type { CustomTool, ToolsType } from '
|
|
1
|
+
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
|
+
import type { ShapeEntity } from './../../../common/types/Shapes';
|
|
3
|
+
import type { CustomTool, ToolsType } from './../../../common/types/tools';
|
|
4
4
|
import './SettingsBar.css';
|
|
5
|
-
import { UtilsSettings } from 'src/constants/app';
|
|
6
5
|
type SettingsBoxType = {
|
|
7
6
|
width: number;
|
|
8
7
|
disabled?: boolean;
|
|
@@ -17,5 +16,5 @@ type SettingsBoxType = {
|
|
|
17
16
|
removeShape: (shape: ShapeEntity) => void;
|
|
18
17
|
toggleLayoutPanel: () => void;
|
|
19
18
|
};
|
|
20
|
-
declare const SettingsBar: ({ width, disabled, availableTools, updateToolSettings, layersManipulation, toggleLayoutPanel, activeTool, selectedShape, canvas, settings, updateShape, removeShape }: SettingsBoxType) =>
|
|
19
|
+
declare const SettingsBar: ({ width, disabled, availableTools, updateToolSettings, layersManipulation, toggleLayoutPanel, activeTool, selectedShape, canvas, settings, updateShape, removeShape }: SettingsBoxType) => import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default SettingsBar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
type ShapeStyleSelectType = {
|
|
3
3
|
setSelectedSettings: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
4
4
|
disabled?: boolean;
|
|
@@ -8,5 +8,5 @@ type ShapeStyleSelectType = {
|
|
|
8
8
|
value?: boolean;
|
|
9
9
|
valueChanged: (field: string, value: boolean) => void;
|
|
10
10
|
};
|
|
11
|
-
declare const ToggleField: ({ setSelectedSettings, disabled, field, icon, values, value, valueChanged }: ShapeStyleSelectType) =>
|
|
11
|
+
declare const ToggleField: ({ setSelectedSettings, disabled, field, icon, values, value, valueChanged }: ShapeStyleSelectType) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
export default ToggleField;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ToolsType } from '../../types/tools';
|
|
1
|
+
import type { ToolsType } from './../../../common/types/tools';
|
|
3
2
|
type LoadFileToolType = {
|
|
4
3
|
disabled?: boolean;
|
|
5
4
|
loadFile: (file: File) => void;
|
|
@@ -8,5 +7,5 @@ type LoadFileToolType = {
|
|
|
8
7
|
accept: string;
|
|
9
8
|
withText?: boolean;
|
|
10
9
|
};
|
|
11
|
-
declare const LoadFileTool: ({ disabled, withText, loadFile, type, img, accept }: LoadFileToolType) =>
|
|
10
|
+
declare const LoadFileTool: ({ disabled, withText, loadFile, type, img, accept }: LoadFileToolType) => import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export default LoadFileTool;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type { ToolsType } from '../../types/tools';
|
|
1
|
+
import type { ShapeType } from './../../../common/types/Shapes';
|
|
2
|
+
import type { ToolsType } from './../../../common/types/tools';
|
|
4
3
|
import './MenuGroup.css';
|
|
5
4
|
type ToolbarGroupType = {
|
|
6
5
|
activeTool: ToolsType;
|
|
@@ -31,5 +30,5 @@ type ToolbarGroupType = {
|
|
|
31
30
|
redoAction: () => void;
|
|
32
31
|
clearCanvas: () => void;
|
|
33
32
|
};
|
|
34
|
-
declare const MenuGroup: ({ activeTool, withActionsInMenu, hasActionToUndo, hasActionToRedo, hasActionToClear, undoAction, redoAction, clearCanvas, alignment, group, vertical, disabled, withLoadAndSave, withExport, addPicture: addPictureFromProps, loadFile: loadFileFromProps, togglePictureUrlModal, saveFile, exportCanvasInFile, withUploadPicture, withUrlPicture }: ToolbarGroupType) =>
|
|
33
|
+
declare const MenuGroup: ({ activeTool, withActionsInMenu, hasActionToUndo, hasActionToRedo, hasActionToClear, undoAction, redoAction, clearCanvas, alignment, group, vertical, disabled, withLoadAndSave, withExport, addPicture: addPictureFromProps, loadFile: loadFileFromProps, togglePictureUrlModal, saveFile, exportCanvasInFile, withUploadPicture, withUrlPicture }: ToolbarGroupType) => import("react/jsx-runtime").JSX.Element | null;
|
|
35
34
|
export default MenuGroup;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './PictureUrlInput.css';
|
|
3
2
|
type PictureUrlModalType = {
|
|
4
3
|
togglePictureUrlModal: () => void;
|
|
5
4
|
addPicture: (url: string) => Promise<void>;
|
|
6
5
|
};
|
|
7
|
-
declare const PictureUrlModal: ({ togglePictureUrlModal, addPicture }: PictureUrlModalType) =>
|
|
6
|
+
declare const PictureUrlModal: ({ togglePictureUrlModal, addPicture }: PictureUrlModalType) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default PictureUrlModal;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ToolsType } from '../../types/tools';
|
|
1
|
+
import type { ToolsType } from './../../../common/types/tools';
|
|
3
2
|
type ToolComponentType = {
|
|
4
3
|
type: ToolsType;
|
|
5
4
|
img?: string;
|
|
@@ -8,5 +7,5 @@ type ToolComponentType = {
|
|
|
8
7
|
disabled?: boolean;
|
|
9
8
|
setActive: (marker: ToolsType) => void;
|
|
10
9
|
};
|
|
11
|
-
declare const Tool: ({ type, img, isActive, withText, disabled, setActive }: ToolComponentType) =>
|
|
10
|
+
declare const Tool: ({ type, img, isActive, withText, disabled, setActive }: ToolComponentType) => import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export default Tool;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type { CustomTool } from '../../types/tools';
|
|
1
|
+
import type { ToolsType } from './../../../common/types/tools';
|
|
2
|
+
import type { CustomTool } from './../../../common/types/tools';
|
|
4
3
|
import './Toolbar.css';
|
|
5
4
|
type ToolboxType = {
|
|
6
5
|
width: number;
|
|
@@ -23,5 +22,5 @@ type ToolboxType = {
|
|
|
23
22
|
withUrlPicture: boolean;
|
|
24
23
|
withUploadPicture: boolean;
|
|
25
24
|
};
|
|
26
|
-
declare const Toolbar: ({ width, disabled, activeTool, hasActionToUndo, hasActionToRedo, hasActionToClear, withLoadAndSave, withExport, clearCanvas, setActiveTool: setActiveToolFromProps, undoAction, redoAction, addPicture, loadFile, saveFile, exportCanvasInFile, availableTools, withUrlPicture, withUploadPicture }: ToolboxType) =>
|
|
25
|
+
declare const Toolbar: ({ width, disabled, activeTool, hasActionToUndo, hasActionToRedo, hasActionToClear, withLoadAndSave, withExport, clearCanvas, setActiveTool: setActiveToolFromProps, undoAction, redoAction, addPicture, loadFile, saveFile, exportCanvasInFile, availableTools, withUrlPicture, withUploadPicture }: ToolboxType) => import("react/jsx-runtime").JSX.Element;
|
|
27
26
|
export default Toolbar;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { CustomTool, ToolsType } from '../../types/tools';
|
|
1
|
+
import type { CustomTool, ToolsType } from './../../../common/types/tools';
|
|
3
2
|
import './ToolbarGroup.css';
|
|
4
3
|
type ToolbarGroupType = {
|
|
5
4
|
activeTool: ToolsType;
|
|
@@ -14,5 +13,5 @@ type ToolbarGroupType = {
|
|
|
14
13
|
img?: string;
|
|
15
14
|
setActiveToolFromId: (id: string) => void;
|
|
16
15
|
};
|
|
17
|
-
declare const ToolbarGroup: ({ activeTool, alignment, group, disabled, setActiveToolFromId }: ToolbarGroupType) =>
|
|
16
|
+
declare const ToolbarGroup: ({ activeTool, alignment, group, disabled, setActiveToolFromId }: ToolbarGroupType) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
17
|
export default ToolbarGroup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const DEFAULT_EDITOR_OPTIONS: {
|
|
2
|
+
toolbarBackgroundColor: string;
|
|
3
|
+
dividerColor: string;
|
|
4
|
+
fontRadius: number;
|
|
5
|
+
fontDisabledColor: string;
|
|
6
|
+
fontDisabledBackgroundColor: string;
|
|
7
|
+
fontColor: string;
|
|
8
|
+
fontBackgroundColor: string;
|
|
9
|
+
fontSelectedColor: string;
|
|
10
|
+
fontSelectedBackgroundColor: string;
|
|
11
|
+
fontHoverColor: string;
|
|
12
|
+
fontHoverBackgroundColor: string;
|
|
13
|
+
};
|
|
@@ -8,10 +8,7 @@ export declare const STYLE_FONTS: string[];
|
|
|
8
8
|
export declare const STYLE_FONT_DEFAULT = "serif";
|
|
9
9
|
export declare const STYLE_FONT_SIZE_DEFAULT = 36;
|
|
10
10
|
export declare const STYLE_ZINDEX: {
|
|
11
|
-
APP: number;
|
|
12
11
|
LOADING: number;
|
|
13
12
|
PANEL: number;
|
|
14
13
|
SNACKBAR: number;
|
|
15
14
|
};
|
|
16
|
-
export declare const GRID_STEP: readonly [10, 20, 40];
|
|
17
|
-
export declare const GRID_ROTATION_STEPS = 18;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionsTool, CustomTool, ToolsBrushSettings, ToolsCircleSettings, ToolsCurveSettings, ToolsEllipseSettings, ToolsLineSettings, ToolsPictureSettings, ToolsPolygonSettings, ToolsRectSettings, ToolsSquareSettings, ToolsTextSettings } from '
|
|
1
|
+
import type { ActionsTool, CustomTool, ToolsBrushSettings, ToolsCircleSettings, ToolsCurveSettings, ToolsEllipseSettings, ToolsLineSettings, ToolsPictureSettings, ToolsPolygonSettings, ToolsRectSettings, ToolsSquareSettings, ToolsTextSettings } from './../../common/types/tools';
|
|
2
2
|
export declare const SETTINGS_DEFAULT_RECT: ToolsRectSettings;
|
|
3
3
|
export declare const SETTINGS_DEFAULT_SQUARE: ToolsSquareSettings;
|
|
4
4
|
export declare const SETTINGS_DEFAULT_CIRCLE: ToolsCircleSettings;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import type { ShapeEntity } from '
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { ShapeEntity } from './../../common/types/Shapes';
|
|
3
3
|
type useDragType = {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
ref: RefObject<HTMLDivElement>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { SnackBarType, SnackbarTypeType } from '
|
|
1
|
+
import type { SnackBarType, SnackbarTypeType } from './../../editor/types/snackbar';
|
|
2
2
|
declare const useSnackbar: () => {
|
|
3
3
|
snackbarList: SnackBarType[];
|
|
4
4
|
addSnackbar: ({ type, duration, text }: {
|
|
5
|
-
type?: SnackbarTypeType
|
|
6
|
-
duration?: number
|
|
5
|
+
type?: SnackbarTypeType;
|
|
6
|
+
duration?: number;
|
|
7
7
|
text: string;
|
|
8
8
|
}) => void;
|
|
9
9
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { UseReactPaintReturnType } from './../canvas/hooks/useReactPaint';
|
|
2
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
3
|
+
import './index.css';
|
|
4
|
+
type EditorProps = {
|
|
5
|
+
editorProps: UseReactPaintReturnType['editorProps'];
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
options?: {
|
|
10
|
+
toolbarBackgroundColor?: string;
|
|
11
|
+
dividerColor?: string;
|
|
12
|
+
fontRadius?: number;
|
|
13
|
+
fontDisabledColor?: string;
|
|
14
|
+
fontDisabledBackgroundColor?: string;
|
|
15
|
+
fontColor?: string;
|
|
16
|
+
fontBackgroundColor?: string;
|
|
17
|
+
fontSelectedColor?: string;
|
|
18
|
+
fontSelectedBackgroundColor?: string;
|
|
19
|
+
fontHoverColor?: string;
|
|
20
|
+
fontHoverBackgroundColor?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare const Editor: ({ editorProps, className, style, options, children }: EditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default Editor;
|