@yorab/react-paint 0.10.0 → 0.11.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/README.md +173 -1
- package/dist/{components → canvas/components}/Canvas.d.ts +7 -9
- package/dist/{components/toolbox → canvas/components}/EditTextBox.d.ts +4 -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 +9 -16
- package/dist/{hooks → canvas/hooks}/useKeyboard.d.ts +4 -6
- package/dist/canvas/hooks/useReactPaint.d.ts +131 -0
- package/dist/{hooks → canvas/hooks}/useShapes.d.ts +7 -8
- package/dist/canvas/index.d.ts +13 -0
- package/dist/{utils → canvas/utils}/canvas.d.ts +3 -2
- package/dist/canvas/utils/data.d.ts +5 -0
- package/dist/{utils → canvas/utils}/file.d.ts +4 -3
- package/dist/canvas/utils/grid.d.ts +2 -0
- package/dist/{utils → canvas/utils}/intersect.d.ts +7 -6
- package/dist/{utils → canvas/utils}/selection/lineSelection.d.ts +5 -4
- package/dist/{utils → canvas/utils}/selection/rectSelection.d.ts +6 -6
- package/dist/canvas/utils/selection/selectionFrame.d.ts +3 -0
- package/dist/canvas/utils/selection.d.ts +8 -0
- package/dist/canvas/utils/shapes/brush.d.ts +20 -0
- package/dist/canvas/utils/shapes/circle.d.ts +17 -0
- package/dist/canvas/utils/shapes/curve.d.ts +17 -0
- package/dist/canvas/utils/shapes/ellipse.d.ts +17 -0
- package/dist/canvas/utils/shapes/index.d.ts +32 -0
- package/dist/canvas/utils/shapes/line.d.ts +17 -0
- package/dist/{utils → canvas/utils}/shapes/path.d.ts +3 -2
- package/dist/canvas/utils/shapes/picture.d.ts +12 -0
- package/dist/canvas/utils/shapes/polygon.d.ts +17 -0
- package/dist/canvas/utils/shapes/rectangle.d.ts +20 -0
- package/dist/{utils → canvas/utils}/shapes/text.d.ts +10 -10
- 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 +6 -6
- package/dist/{utils → canvas/utils}/trigo.d.ts +4 -4
- package/dist/{types → common/types}/Shapes.d.ts +4 -6
- 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 +5 -6
- 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 +1087 -1053
- 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 -45
- package/dist/utils/array.d.ts +0 -1
- package/dist/utils/data.d.ts +0 -4
- package/dist/utils/grid.d.ts +0 -3
- package/dist/utils/selection/selectionFrame.d.ts +0 -2
- package/dist/utils/selection.d.ts +0 -7
- package/dist/utils/shapes/brush.d.ts +0 -20
- package/dist/utils/shapes/circle.d.ts +0 -17
- package/dist/utils/shapes/curve.d.ts +0 -17
- package/dist/utils/shapes/ellipse.d.ts +0 -17
- package/dist/utils/shapes/index.d.ts +0 -35
- package/dist/utils/shapes/line.d.ts +0 -17
- package/dist/utils/shapes/picture.d.ts +0 -12
- package/dist/utils/shapes/polygon.d.ts +0 -17
- package/dist/utils/shapes/rectangle.d.ts +0 -20
- 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
package/package.json
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@yorab/react-paint",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Yohann Rabatel",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "./dist/react-paint.umd.cjs",
|
|
9
|
+
"module": "./dist/react-paint.js",
|
|
10
|
+
"types": "./dist/components/App.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/react-paint.js",
|
|
14
|
+
"require": "./dist/react-paint.umd.cjs",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./react-paint.css": "./dist/react-paint.css"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE.txt",
|
|
22
|
+
"package.json",
|
|
23
|
+
"dist/"
|
|
24
|
+
],
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@biomejs/biome": "1.7.3",
|
|
27
|
+
"@rollup/plugin-terser": "0.4.4",
|
|
28
|
+
"@storybook/addon-essentials": "8.1.5",
|
|
29
|
+
"@storybook/addon-interactions": "8.1.5",
|
|
30
|
+
"@storybook/addon-links": "8.1.5",
|
|
31
|
+
"@storybook/blocks": "8.1.5",
|
|
32
|
+
"@storybook/react": "8.1.5",
|
|
33
|
+
"@storybook/react-vite": "8.1.5",
|
|
34
|
+
"@storybook/test": "8.1.5",
|
|
35
|
+
"@storybook/testing-library": "0.2.2",
|
|
36
|
+
"@types/node": "20.13.0",
|
|
37
|
+
"@types/react": "18.3.3",
|
|
38
|
+
"@types/react-dom": "18.3.0",
|
|
39
|
+
"@vitejs/plugin-react": "4.3.0",
|
|
40
|
+
"lightningcss": "1.25.1",
|
|
41
|
+
"react": "18.3.1",
|
|
42
|
+
"react-dom": "18.3.1",
|
|
43
|
+
"storybook": "8.1.5",
|
|
44
|
+
"typescript": "5.4.5",
|
|
45
|
+
"vite": "5.2.12",
|
|
46
|
+
"vite-tsconfig-paths": "4.3.2"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": "18.x",
|
|
50
|
+
"react-dom": "18.x"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"declarationfiles": "pnpm tsc --project tsconfig.prod.json && node fixDtsPath.js",
|
|
54
|
+
"start": "storybook dev -p 6006",
|
|
55
|
+
"build-storybook": "storybook build",
|
|
56
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
57
|
+
"build": "vite build && pnpm declarationfiles",
|
|
58
|
+
"lint": "pnpm biome check --apply src stories",
|
|
59
|
+
"publishnpm": "pnpm publish --access public"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/dist/components/App.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import { OptionalAppOptionsType } from '../constants/app';
|
|
3
|
-
import type { DrawableShapeJson, ExportDataType } from '../types/Shapes';
|
|
4
|
-
import './App.css';
|
|
5
|
-
type AppType = {
|
|
6
|
-
className?: string;
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
shapes?: DrawableShapeJson[];
|
|
10
|
-
onDataChanged?: () => void;
|
|
11
|
-
mode?: 'editor' | 'viewer';
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
apiRef?: MutableRefObject<undefined | {
|
|
14
|
-
getCurrentImage: () => string | undefined;
|
|
15
|
-
getCurrentData: () => ExportDataType;
|
|
16
|
-
}>;
|
|
17
|
-
options?: OptionalAppOptionsType;
|
|
18
|
-
};
|
|
19
|
-
declare const App: ({ width, height, shapes: shapesFromProps, className, mode, disabled, onDataChanged, apiRef, options }: AppType) => React.JSX.Element;
|
|
20
|
-
export default App;
|
package/dist/constants/app.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { DrawableShapeJson } from '../types/Shapes';
|
|
2
|
-
import type { CustomToolInput } from '../types/tools';
|
|
3
|
-
import type { RecursivePartial } from '../types/utils';
|
|
4
|
-
export declare const APP_NAME = "react_paint";
|
|
5
|
-
export declare const DRAWCANVAS_CLASSNAME = "react-paint-editor-canvas-drawcanvas";
|
|
6
|
-
export declare const SELECTIONCANVAS_CLASSNAME = "react-paint-editor-canvas-selectioncanvas";
|
|
7
|
-
export declare const GRID_NONE = 0;
|
|
8
|
-
export declare const GRID_SMALL = 1;
|
|
9
|
-
export declare const GRID_MEDIUM = 2;
|
|
10
|
-
export declare const GRID_LARGE = 3;
|
|
11
|
-
export type GridFormatType = typeof GRID_NONE | typeof GRID_SMALL | typeof GRID_MEDIUM | typeof GRID_LARGE;
|
|
12
|
-
type AppOptionsType = {
|
|
13
|
-
layersManipulation: boolean;
|
|
14
|
-
grid: GridFormatType;
|
|
15
|
-
canGrow: boolean;
|
|
16
|
-
canShrink: boolean;
|
|
17
|
-
availableTools: CustomToolInput[];
|
|
18
|
-
withExport: boolean;
|
|
19
|
-
withLoadAndSave: boolean;
|
|
20
|
-
withUploadPicture: boolean;
|
|
21
|
-
withUrlPicture: boolean;
|
|
22
|
-
withFrameSelection: boolean;
|
|
23
|
-
withSkeleton: boolean;
|
|
24
|
-
clearCallback: 'empty' | 'defaultShapes' | (() => DrawableShapeJson[]);
|
|
25
|
-
uiStyle: {
|
|
26
|
-
toolbarBackgroundColor: string;
|
|
27
|
-
dividerColor: string;
|
|
28
|
-
fontRadius: number;
|
|
29
|
-
fontDisabledColor: string;
|
|
30
|
-
fontDisabledBackgroundColor: string;
|
|
31
|
-
fontColor: string;
|
|
32
|
-
fontBackgroundColor: string;
|
|
33
|
-
fontSelectedColor: string;
|
|
34
|
-
fontSelectedBackgroundColor: string;
|
|
35
|
-
fontHoverColor: string;
|
|
36
|
-
fontHoverBackgroundColor: string;
|
|
37
|
-
canvasBackgroundColor: string;
|
|
38
|
-
canvasSelectionColor: string;
|
|
39
|
-
canvasSelectionWidth: number;
|
|
40
|
-
canvasSelectionPadding: number;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type OptionalAppOptionsType = RecursivePartial<AppOptionsType>;
|
|
44
|
-
export declare const DEFAULT_OPTIONS: AppOptionsType;
|
|
45
|
-
export {};
|
package/dist/utils/array.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const compact: <T>(array: (T | null | undefined)[]) => T[];
|
package/dist/utils/data.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DrawableShape, DrawableShapeJson, ExportDataType, ShapeEntity } from '../types/Shapes';
|
|
2
|
-
export declare const cleanShapesBeforeExport: (shapes: DrawableShape[]) => DrawableShapeJson[];
|
|
3
|
-
export declare const buildDataToExport: (shapes: DrawableShape[], width: number, height: number) => ExportDataType;
|
|
4
|
-
export declare const addDefaultAndTempShapeProps: (shape: DrawableShape, currentScale: number, selectionPadding: number) => ShapeEntity;
|
package/dist/utils/grid.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../constants/app';
|
|
2
|
-
import type { Point } from '../types/Shapes';
|
|
3
|
-
export declare const drawGrid: (ctx: CanvasRenderingContext2D, width: number, height: number, responsiveScale: number, canvasOffset: Point, gridFormat: GridFormatType) => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { HoverModeData, SelectionModeData } from '../types/Mode';
|
|
2
|
-
import type { Point, ShapeEntity } from '../types/Shapes';
|
|
3
|
-
export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape: ShapeEntity, cursorPosition: Point, selectionPadding: number) => SelectionModeData<Point | number> | undefined;
|
|
4
|
-
export declare const selectShape: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], cursorPosition: Point, currentScale: number, canvasOffset: Point, selectedShape: ShapeEntity | undefined, selectionPadding: number, isTouchGesture: boolean, withFrameSelection: boolean) => {
|
|
5
|
-
mode: SelectionModeData<Point | number>;
|
|
6
|
-
shape: ShapeEntity | undefined;
|
|
7
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshBrush: <T extends DrawableShape<"brush">>(brush: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createBrush: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'brush';
|
|
9
|
-
settings: ToolsSettingsType<'brush'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'brush'>;
|
|
11
|
-
export declare const drawBrush: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'brush'>) => void;
|
|
12
|
-
export declare const getBrushBorder: (brush: DrawableShape<'brush'>, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const translateBrush: <U extends DrawableShape<"brush">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
-
points: Point[][];
|
|
15
|
-
};
|
|
16
|
-
export declare const resizeBrush: (cursorPosition: Point, originalShape: DrawableShape<'brush'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'brush'>;
|
|
17
|
-
export declare const addNewPointToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T & {
|
|
18
|
-
points: Point[][];
|
|
19
|
-
};
|
|
20
|
-
export declare const addNewPointGroupToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { Circle, DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshCircle: <T extends DrawableShape<"circle">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createCircle: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'circle';
|
|
9
|
-
settings: ToolsSettingsType<'circle'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'circle'>;
|
|
11
|
-
export declare const drawCircle: (ctx: CanvasRenderingContext2D, circle: DrawableShape<'circle'>) => void;
|
|
12
|
-
export declare const getCircleBorder: (circle: Circle, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const translateCircle: <U extends DrawableShape<"circle">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
};
|
|
17
|
-
export declare const resizeCircle: (cursorPosition: Point, originalShape: DrawableShape<'circle'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'circle'>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshCurve: <T extends DrawableShape<"curve">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createCurve: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'curve';
|
|
9
|
-
settings: ToolsSettingsType<'curve'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'curve'>;
|
|
11
|
-
export declare const resizeCurve: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'curve'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'curve'>;
|
|
12
|
-
export declare const drawCurve: (ctx: CanvasRenderingContext2D, curve: DrawableShape<'curve'>) => void;
|
|
13
|
-
export declare const getCurveBorder: (polygon: import("../../types/Shapes").Polygon, selectionPadding: number) => import("../../types/Shapes").Rect;
|
|
14
|
-
export declare const translateCurve: <U extends DrawableShape<"curve">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
|
-
points: [number, number][];
|
|
16
|
-
};
|
|
17
|
-
export declare const updateCurveLinesCount: <T extends DrawableShape<"curve">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Ellipse, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshEllipse: <T extends DrawableShape<"ellipse">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createEllipse: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'ellipse';
|
|
9
|
-
settings: ToolsSettingsType<'ellipse'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'ellipse'>;
|
|
11
|
-
export declare const drawEllipse: (ctx: CanvasRenderingContext2D, ellipse: DrawableShape<'ellipse'>) => void;
|
|
12
|
-
export declare const getEllipseBorder: (ellipse: Ellipse, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const translateEllipse: <U extends DrawableShape<"ellipse">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
};
|
|
17
|
-
export declare const resizeEllipse: (cursorPosition: Point, originalShape: DrawableShape<'ellipse'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<'ellipse'>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeData } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { CustomTool } from '../../types/tools';
|
|
5
|
-
export declare const createShape: (ctx: CanvasRenderingContext2D, shape: Exclude<CustomTool, {
|
|
6
|
-
type: 'picture';
|
|
7
|
-
}>, cursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
8
|
-
export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, responsiveScale: number, canvasOffset: Point, selectionPadding: number) => void;
|
|
9
|
-
export declare const getShapeInfos: (shape: DrawableShape, selectionPadding: number) => {
|
|
10
|
-
borders: Rect;
|
|
11
|
-
center: Point;
|
|
12
|
-
};
|
|
13
|
-
export declare const rotateShape: <T extends DrawableShape>(shape: T, cursorPosition: Point, originalShape: T, originalCursorPosition: Point, shapeCenter: Point, gridFormat: GridFormatType) => T & {
|
|
14
|
-
rotation: number;
|
|
15
|
-
};
|
|
16
|
-
export declare const resizeShape: <T extends DrawableShape>(ctx: CanvasRenderingContext2D, shape: T, cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeData<Point | number>, gridFormat: GridFormatType, selectionPadding: number, isShiftPressed: boolean, currentScale: number) => T;
|
|
17
|
-
export declare const translateShape: (cursorPosition: Point, originalShape: ShapeEntity, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
18
|
-
export declare const refreshShape: (shape: ShapeEntity, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
19
|
-
export declare const drawShapeSelection: ({ ctx, shape, currentScale, canvasOffset, selectionPadding, selectionWidth, selectionColor, withAnchors }: {
|
|
20
|
-
ctx: CanvasRenderingContext2D;
|
|
21
|
-
shape: DrawableShape;
|
|
22
|
-
currentScale: number;
|
|
23
|
-
canvasOffset: Point;
|
|
24
|
-
selectionPadding: number;
|
|
25
|
-
selectionWidth: number;
|
|
26
|
-
selectionColor: string;
|
|
27
|
-
withAnchors?: boolean | undefined;
|
|
28
|
-
}) => void;
|
|
29
|
-
export declare const drawSelectionFrame: ({ ctx, selectionFrame, currentScale, canvasOffset }: {
|
|
30
|
-
ctx: CanvasRenderingContext2D;
|
|
31
|
-
selectionFrame: [Point, Point];
|
|
32
|
-
currentScale: number;
|
|
33
|
-
canvasOffset: Point;
|
|
34
|
-
}) => void;
|
|
35
|
-
export declare const copyShape: (shape: ShapeEntity, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Line, Point, Rect, ShapeEntity, StyleShape, Triangle } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshLine: <T extends DrawableShape<"line">>(line: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createLine: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'line';
|
|
9
|
-
settings: ToolsSettingsType<'line'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'line'>;
|
|
11
|
-
export declare const buildTriangleOnLine: (center: Point, rotation: number, lineStyle: StyleShape) => Triangle;
|
|
12
|
-
export declare const drawLine: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'line'>) => void;
|
|
13
|
-
export declare const getLineBorder: (line: Line, selectionPadding: number) => Rect;
|
|
14
|
-
export declare const translateLine: <U extends DrawableShape<"line">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
|
-
points: [Point, Point];
|
|
16
|
-
};
|
|
17
|
-
export declare const resizeLine: <U extends DrawableShape<"line">>(cursorPosition: Point, canvasOffset: Point, originalShape: U, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => U;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
5
|
-
export declare const createPicture: (fileOrUrl: File | string, maxPictureWidth: number, maxPictureHeight: number, currentScale: number, selectionPadding: number) => Promise<ShapeEntity<"picture">>;
|
|
6
|
-
export declare const drawPicture: (ctx: CanvasRenderingContext2D, picture: DrawableShape<'picture'>) => void;
|
|
7
|
-
export declare const getPictureBorder: (picture: Picture, selectionPadding: number) => Rect;
|
|
8
|
-
export declare const translatePicture: <U extends DrawableShape<"picture">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
};
|
|
12
|
-
export declare const resizePicture: (cursorPosition: Point, originalShape: DrawableShape<'picture'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'picture'>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { GridFormatType } from '../../constants/app';
|
|
2
|
-
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, Polygon, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
6
|
-
export declare const createPolygon: (shape: {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'polygon';
|
|
9
|
-
settings: ToolsSettingsType<'polygon'>;
|
|
10
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'polygon'>;
|
|
11
|
-
export declare const drawPolygon: (ctx: CanvasRenderingContext2D, polygon: DrawableShape<'polygon'>) => void;
|
|
12
|
-
export declare const getPolygonBorder: (polygon: Polygon, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const translatePolygon: <U extends DrawableShape<"polygon">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
-
points: [number, number][];
|
|
15
|
-
};
|
|
16
|
-
export declare const resizePolygon: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'polygon'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'polygon'>;
|
|
17
|
-
export declare const updatePolygonLinesCount: <T extends DrawableShape<"polygon">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { GridFormatType } from '../../constants/app';
|
|
2
|
-
import type { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
4
|
-
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
-
type rectish = 'text' | 'rect' | 'square' | 'picture';
|
|
6
|
-
export declare const refreshRect: <T extends DrawableShape<rectish>>(rect: T, currentScale: number, selectionPadding: number) => T;
|
|
7
|
-
export declare const createRectangle: <T extends "rect" | "square">(shape: {
|
|
8
|
-
id: string;
|
|
9
|
-
type: T;
|
|
10
|
-
settings: ToolsSettingsType<T>;
|
|
11
|
-
}, cursorPosition: Point, currentScale: number, selectionPadding: number, width?: number, height?: number) => ShapeEntity<T>;
|
|
12
|
-
export declare const drawRect: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'rect' | 'square'>) => void;
|
|
13
|
-
export declare const getRectBorder: (rect: Rect, selectionPadding: number) => Rect;
|
|
14
|
-
export declare const getRectOppositeAnchorAbsolutePosition: <T extends DrawableShape & Rect>(anchor: Point, center: Point, shape: T, canvasOffset: Point, [negW, negH]?: [boolean, boolean]) => Point;
|
|
15
|
-
export declare const translateRect: <T extends "rect" | "square", U extends DrawableShape<T>>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
};
|
|
19
|
-
export declare const resizeRect: <T extends rectish>(cursorPosition: Point, originalShape: DrawableShape<T>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<T>;
|
|
20
|
-
export {};
|
package/dist/utils/toolbar.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ShapeType } from '../types/Shapes';
|
|
2
|
-
import type { CustomTool, CustomToolInput } from '../types/tools';
|
|
3
|
-
import type { RecursivePartial } from '../types/utils';
|
|
4
|
-
export declare const getCurrentStructure: (availableTools: CustomTool[], defaultStructure: (ShapeType | {
|
|
5
|
-
title: string;
|
|
6
|
-
toolsType: ShapeType[];
|
|
7
|
-
vertical: boolean;
|
|
8
|
-
})[]) => (CustomTool | {
|
|
9
|
-
title: string;
|
|
10
|
-
toolsType: CustomTool[];
|
|
11
|
-
vertical: boolean;
|
|
12
|
-
})[];
|
|
13
|
-
export declare const sanitizeTools: (tools: RecursivePartial<CustomToolInput>[], withPicture?: boolean) => CustomTool[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|