@yorab/react-paint 0.10.1 → 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 +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 +131 -0
- package/dist/{hooks → canvas/hooks}/useShapes.d.ts +5 -3
- package/dist/canvas/index.d.ts +13 -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 +943 -916
- 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
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,58 +0,0 @@
|
|
|
1
|
-
import type { DrawableShapeJson, Point } 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
|
-
export type BrushAlgo = 'simple' | 'quadratic';
|
|
13
|
-
export type UtilsSettings = {
|
|
14
|
-
brushAlgo: BrushAlgo;
|
|
15
|
-
gridFormat: GridFormatType;
|
|
16
|
-
canvasOffset: Point;
|
|
17
|
-
canvasSize: {
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
scaleRatio: number;
|
|
21
|
-
};
|
|
22
|
-
selectionPadding: number;
|
|
23
|
-
};
|
|
24
|
-
type AppOptionsType = {
|
|
25
|
-
layersManipulation: boolean;
|
|
26
|
-
grid: GridFormatType;
|
|
27
|
-
canGrow: boolean;
|
|
28
|
-
canShrink: boolean;
|
|
29
|
-
availableTools: CustomToolInput[];
|
|
30
|
-
withExport: boolean;
|
|
31
|
-
withLoadAndSave: boolean;
|
|
32
|
-
withUploadPicture: boolean;
|
|
33
|
-
withUrlPicture: boolean;
|
|
34
|
-
withFrameSelection: boolean;
|
|
35
|
-
withSkeleton: boolean;
|
|
36
|
-
clearCallback: 'empty' | 'defaultShapes' | (() => DrawableShapeJson[]);
|
|
37
|
-
brushAlgo: BrushAlgo;
|
|
38
|
-
uiStyle: {
|
|
39
|
-
toolbarBackgroundColor: string;
|
|
40
|
-
dividerColor: string;
|
|
41
|
-
fontRadius: number;
|
|
42
|
-
fontDisabledColor: string;
|
|
43
|
-
fontDisabledBackgroundColor: string;
|
|
44
|
-
fontColor: string;
|
|
45
|
-
fontBackgroundColor: string;
|
|
46
|
-
fontSelectedColor: string;
|
|
47
|
-
fontSelectedBackgroundColor: string;
|
|
48
|
-
fontHoverColor: string;
|
|
49
|
-
fontHoverBackgroundColor: string;
|
|
50
|
-
canvasBackgroundColor: string;
|
|
51
|
-
canvasSelectionColor: string;
|
|
52
|
-
canvasSelectionWidth: number;
|
|
53
|
-
canvasSelectionPadding: number;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export type OptionalAppOptionsType = RecursivePartial<AppOptionsType>;
|
|
57
|
-
export declare const DEFAULT_OPTIONS: AppOptionsType;
|
|
58
|
-
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/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
|