@yorab/react-paint 0.15.0 → 0.16.0
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/canvas/components/Canvas.d.ts +1 -0
- package/dist/canvas/constants/shapes.d.ts +2 -0
- package/dist/canvas/hooks/useDrawableCanvas.d.ts +2 -1
- package/dist/canvas/hooks/useReactPaint.d.ts +34 -0
- package/dist/canvas/hooks/useShapes.d.ts +25 -0
- package/dist/canvas/utils/file.d.ts +4 -0
- package/dist/canvas/utils/selection/groupSelection.d.ts +3 -2
- package/dist/canvas/utils/selection/rectSelection.d.ts +3 -1
- package/dist/canvas/utils/shapes/brush.d.ts +6 -2
- package/dist/canvas/utils/shapes/circle.d.ts +5 -2
- package/dist/canvas/utils/shapes/curve.d.ts +0 -1
- package/dist/canvas/utils/shapes/ellipse.d.ts +5 -2
- package/dist/canvas/utils/shapes/group.d.ts +33 -0
- package/dist/canvas/utils/shapes/index.d.ts +6 -12
- package/dist/canvas/utils/shapes/line.d.ts +5 -2
- package/dist/canvas/utils/shapes/path.d.ts +2 -2
- package/dist/canvas/utils/shapes/picture.d.ts +5 -2
- package/dist/canvas/utils/shapes/polygon.d.ts +0 -1
- package/dist/canvas/utils/shapes/rectangle.d.ts +7 -44
- package/dist/canvas/utils/shapes/text.d.ts +5 -2
- package/dist/common/types/Mode.d.ts +1 -0
- package/dist/common/types/Shapes.d.ts +4 -0
- package/dist/common/utils/object.d.ts +1 -1
- package/dist/editor/components/settings/RangeField.d.ts +2 -1
- package/dist/editor/components/settings/SettingsBar.d.ts +2 -1
- package/dist/react-paint.js +1303 -1301
- package/dist/react-paint.umd.cjs +1 -1
- package/package.json +13 -13
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity, Text } from './../../../common/types/Shapes';
|
|
3
|
+
import type { DrawableShape, Point, Rect, SelectionType, ShapeEntity, Text } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
|
+
import { type GroupResizeContext } from './group';
|
|
5
6
|
export declare const getComputedText: (text: DrawableShape<"text">, settings: UtilsSettings) => {
|
|
6
7
|
borders: Rect;
|
|
7
8
|
outerBorders: Rect;
|
|
@@ -19,6 +20,8 @@ export declare const createText: (ctx: CanvasRenderingContext2D, shape: {
|
|
|
19
20
|
}, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<"text">;
|
|
20
21
|
export declare const drawText: (ctx: CanvasRenderingContext2D, text: DrawableShape<"text">) => void;
|
|
21
22
|
export declare const getTextBorder: (text: Text, settings: Pick<UtilsSettings, "selectionPadding">) => Rect;
|
|
22
|
-
export declare const translateText: (cursorPosition: Point, originalShape: ShapeEntity<"text">, originalCursorPosition: Point, settings: UtilsSettings, singleAxis: boolean) => ShapeEntity<"text">;
|
|
23
23
|
export declare const resizeText: (ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: ShapeEntity<"text">, selectionMode: SelectionModeResize, settings: UtilsSettings, resizeFromCenter: boolean) => ShapeEntity<"text">;
|
|
24
|
+
export declare const resizeTextInGroup: (canvasCtx: CanvasRenderingContext2D, shape: ShapeEntity<"text">, group: SelectionType & {
|
|
25
|
+
type: "group";
|
|
26
|
+
}, groupCtx: GroupResizeContext) => ShapeEntity<"text">;
|
|
24
27
|
export declare const resizeTextShapeWithNewContent: (ctx: CanvasRenderingContext2D, shape: ShapeEntity<"text">, newValue: string[], settings: UtilsSettings) => ShapeEntity<"text">;
|
|
@@ -31,6 +31,7 @@ export type SelectionModeTranslate = {
|
|
|
31
31
|
mode: 'translate';
|
|
32
32
|
cursorStartPosition: Point;
|
|
33
33
|
originalShape: SelectionType;
|
|
34
|
+
hasBeenDuplicated: boolean;
|
|
34
35
|
dateStart: number;
|
|
35
36
|
};
|
|
36
37
|
export type SelectionModeData<AnchorType extends Point | number> = SelectionModeDefault | SelectionModeSelectionFrame | SelectionModeBrush | SelectionModeResize<AnchorType> | SelectionModeRotate | SelectionModeTranslate | SelectionModeEditText | SelectionModePreview;
|
|
@@ -75,8 +75,12 @@ export type DrawableShape<T extends ShapeType = ShapeType> = {
|
|
|
75
75
|
type: 'line';
|
|
76
76
|
} : T extends 'picture' ? Picture & {
|
|
77
77
|
img: HTMLImageElement;
|
|
78
|
+
flipX?: boolean;
|
|
79
|
+
flipY?: boolean;
|
|
78
80
|
type: 'picture';
|
|
79
81
|
} : T extends 'text' ? Text & {
|
|
82
|
+
flipX?: boolean;
|
|
83
|
+
flipY?: boolean;
|
|
80
84
|
type: 'text';
|
|
81
85
|
} : T extends 'rect' ? Rect & {
|
|
82
86
|
type: 'rect';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const omit: <T extends Record<string, unknown>>(keys: string[], obj: T) => T;
|
|
1
|
+
export declare const omit: <T extends Record<string, unknown>>(keys: (string | [string, unknown[]])[], obj: T) => T;
|
|
2
2
|
export declare const set: <T extends Record<string, any> | unknown[]>(path: string | number | (string | number)[], value: unknown, obj: T) => T;
|
|
3
3
|
export declare const mergeWith: (customMergeFn: (objValue: unknown, srcValue: unknown, key: string) => unknown, target: unknown, source: unknown) => unknown;
|
|
4
4
|
export declare const isEqual: (a: unknown, b: unknown) => boolean;
|
|
@@ -12,7 +12,8 @@ type ShapeStyleColorType = {
|
|
|
12
12
|
step?: number;
|
|
13
13
|
unity?: string;
|
|
14
14
|
value?: number | undefined;
|
|
15
|
+
saveShapes: () => void;
|
|
15
16
|
valueChanged: (field: string, value: string | number, needHistorySave?: boolean) => void;
|
|
16
17
|
};
|
|
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
|
+
declare const RangeField: ({ selectedSettings, setSelectedSettings, title, icon, disabled, field, value, min, max, step, unity, valueChanged, saveShapes }: ShapeStyleColorType) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
19
|
export default RangeField;
|
|
@@ -18,6 +18,7 @@ type SettingsBarType = {
|
|
|
18
18
|
isZoomPanelShown: boolean;
|
|
19
19
|
setIsZoomPanelShown: React.Dispatch<React.SetStateAction<boolean>>;
|
|
20
20
|
setCanvasZoom: (action: 'unzoom' | 'zoom' | 'default') => void;
|
|
21
|
+
saveShapes: () => void;
|
|
21
22
|
};
|
|
22
|
-
declare const SettingsBar: ({ width, availableTools, updateToolSettings, layersManipulation, toggleLayoutPanel, activeTool, selectedShape, canvas, settings, updateShape, removeShape, isZoomPanelShown, setIsZoomPanelShown }: SettingsBarType) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare const SettingsBar: ({ width, availableTools, updateToolSettings, layersManipulation, toggleLayoutPanel, activeTool, saveShapes, selectedShape, canvas, settings, updateShape, removeShape, isZoomPanelShown, setIsZoomPanelShown }: SettingsBarType) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export default SettingsBar;
|