@yorab/react-paint 0.9.2 → 0.9.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.
@@ -42,7 +42,7 @@ export type Ellipse = {
42
42
  };
43
43
  export type StyleShape = {
44
44
  fillColor?: string;
45
- globalAlpha?: number;
45
+ opacity?: number;
46
46
  strokeColor?: string;
47
47
  lineWidth?: number;
48
48
  lineDash?: number;
@@ -0,0 +1 @@
1
+ export declare const compact: <T>(array: (T | null | undefined)[]) => T[];
@@ -2,7 +2,7 @@ import type { Point } from '../types/Shapes';
2
2
  export declare const initCanvasContext: (ctx: CanvasRenderingContext2D) => void;
3
3
  export declare const updateCanvasContext: (ctx: CanvasRenderingContext2D, style?: {
4
4
  fillColor?: string;
5
- globalAlpha?: number;
5
+ opacity?: number;
6
6
  strokeColor?: string;
7
7
  lineWidth?: number;
8
8
  lineDash?: number;
@@ -1,147 +1,2 @@
1
- import { DrawableShapeJson, Point } from '../types/Shapes';
2
- export declare const migrateShapesV065: (shapes: DrawableShapeJson[]) => (({
3
- visible?: boolean | undefined;
4
- locked?: boolean | undefined;
5
- rotation: number;
6
- style?: import("../types/Shapes").StyleShape | undefined;
7
- } & import("../types/Shapes").Triangle & {
8
- type: "triangle";
9
- path?: Path2D | undefined;
10
- } & {
11
- translation?: Point | undefined;
12
- }) | ({
13
- visible?: boolean | undefined;
14
- locked?: boolean | undefined;
15
- rotation: number;
16
- style?: import("../types/Shapes").StyleShape | undefined;
17
- } & import("../types/Shapes").Line & {
18
- type: "line";
19
- selection?: import("../types/Shapes").SelectionLinesType | undefined;
20
- path?: Path2D | undefined;
21
- arrows?: import("../types/Shapes").DrawableShape<"triangle">[] | undefined;
22
- } & {
23
- translation?: Point | undefined;
24
- }) | ({
25
- visible?: boolean | undefined;
26
- locked?: boolean | undefined;
27
- rotation: number;
28
- style?: import("../types/Shapes").StyleShape | undefined;
29
- } & import("../types/Shapes").Rect & {
30
- src: string;
31
- } & {
32
- type: "picture";
33
- img: HTMLImageElement;
34
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
35
- } & {
36
- translation?: Point | undefined;
37
- }) | ({
38
- visible?: boolean | undefined;
39
- locked?: boolean | undefined;
40
- rotation: number;
41
- style?: import("../types/Shapes").StyleShape | undefined;
42
- } & import("../types/Shapes").Rect & {
43
- value: string[];
44
- fontSize: number;
45
- } & {
46
- type: "text";
47
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
48
- } & {
49
- translation?: Point | undefined;
50
- }) | ({
51
- visible?: boolean | undefined;
52
- locked?: boolean | undefined;
53
- rotation: number;
54
- style?: import("../types/Shapes").StyleShape | undefined;
55
- } & import("../types/Shapes").Rect & {
56
- type: "rect";
57
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
58
- path?: Path2D | undefined;
59
- } & {
60
- translation?: Point | undefined;
61
- }) | ({
62
- visible?: boolean | undefined;
63
- locked?: boolean | undefined;
64
- rotation: number;
65
- style?: import("../types/Shapes").StyleShape | undefined;
66
- } & import("../types/Shapes").Rect & {
67
- type: "square";
68
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
69
- path?: Path2D | undefined;
70
- } & {
71
- translation?: Point | undefined;
72
- }) | ({
73
- visible?: boolean | undefined;
74
- locked?: boolean | undefined;
75
- rotation: number;
76
- style?: import("../types/Shapes").StyleShape | undefined;
77
- } & import("../types/Shapes").Circle & {
78
- type: "circle";
79
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
80
- path?: Path2D | undefined;
81
- } & {
82
- translation?: Point | undefined;
83
- }) | ({
84
- visible?: boolean | undefined;
85
- locked?: boolean | undefined;
86
- rotation: number;
87
- style?: import("../types/Shapes").StyleShape | undefined;
88
- } & import("../types/Shapes").Ellipse & {
89
- type: "ellipse";
90
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
91
- path?: Path2D | undefined;
92
- } & {
93
- translation?: Point | undefined;
94
- }) | ({
95
- visible?: boolean | undefined;
96
- locked?: boolean | undefined;
97
- rotation: number;
98
- style?: import("../types/Shapes").StyleShape | undefined;
99
- } & import("../types/Shapes").Polygon & {
100
- type: "polygon";
101
- selection?: import("../types/Shapes").SelectionLinesType | undefined;
102
- path?: Path2D | undefined;
103
- } & {
104
- translation?: Point | undefined;
105
- }) | ({
106
- visible?: boolean | undefined;
107
- locked?: boolean | undefined;
108
- rotation: number;
109
- style?: import("../types/Shapes").StyleShape | undefined;
110
- } & import("../types/Shapes").Curve & {
111
- type: "curve";
112
- selection?: import("../types/Shapes").SelectionLinesType | undefined;
113
- path?: Path2D | undefined;
114
- } & {
115
- translation?: Point | undefined;
116
- }) | ({
117
- visible?: boolean | undefined;
118
- locked?: boolean | undefined;
119
- rotation: number;
120
- style?: import("../types/Shapes").StyleShape | undefined;
121
- } & import("../types/Shapes").Brush & {
122
- type: "brush";
123
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
124
- path?: Path2D | undefined;
125
- scaleX?: number | undefined;
126
- scaleY?: number | undefined;
127
- } & {
128
- translation?: Point | undefined;
129
- }) | {
130
- x: number;
131
- y: number;
132
- selection?: import("../types/Shapes").SelectionDefaultType | undefined;
133
- style?: import("../types/Shapes").StyleShape | undefined;
134
- type: "rect" | "square" | "circle" | "ellipse" | "picture";
135
- rotation: number;
136
- visible?: boolean | undefined;
137
- locked?: boolean | undefined;
138
- } | {
139
- points: Point[];
140
- selection?: import("../types/Shapes").SelectionLinesType | undefined;
141
- style?: import("../types/Shapes").StyleShape | undefined;
142
- type: "polygon" | "curve";
143
- rotation: number;
144
- path?: Path2D | undefined;
145
- visible?: boolean | undefined;
146
- locked?: boolean | undefined;
147
- } | undefined)[];
1
+ import { DrawableShapeJson } from '../types/Shapes';
2
+ export declare const migrateShapesV065: (shapes: DrawableShapeJson[]) => (DrawableShapeJson | undefined)[];
@@ -0,0 +1,4 @@
1
+ export declare const omit: <T extends Record<string, unknown>>(keys: string[], obj: T) => T;
2
+ export declare const set: <T extends Record<string, any> | unknown[]>(path: string | number | (string | number)[], value: unknown, obj: T) => T;
3
+ export declare const mergeWith: (customMergeFn: (objValue: unknown, srcValue: unknown, key: string) => unknown, target: unknown, source: unknown) => unknown;
4
+ export declare const isEqual: (a: unknown, b: unknown) => boolean;
@@ -14,3 +14,4 @@ export declare const getCurveBorder: (polygon: import("../../types/Shapes").Poly
14
14
  export declare const translateCurve: <U extends DrawableShape<"curve">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
15
15
  points: [number, number][];
16
16
  };
17
+ export declare const updateCurveLinesCount: <T extends DrawableShape<"curve">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
@@ -0,0 +1 @@
1
+ export declare const uniqueId: (prefix?: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorab/react-paint",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "author": "Yohann Rabatel",
@@ -22,10 +22,8 @@
22
22
  "package.json",
23
23
  "dist/"
24
24
  ],
25
- "dependencies": {
26
- "lodash": "4.17.21"
27
- },
28
25
  "devDependencies": {
26
+ "@rollup/plugin-terser": "^0.4.4",
29
27
  "@storybook/addon-essentials": "7.6.3",
30
28
  "@storybook/addon-interactions": "7.6.3",
31
29
  "@storybook/addon-links": "7.6.3",
@@ -34,7 +32,6 @@
34
32
  "@storybook/react-vite": "7.6.3",
35
33
  "@storybook/test": "^7.6.3",
36
34
  "@storybook/testing-library": "0.2.2",
37
- "@types/lodash": "4.14.196",
38
35
  "@types/node": "20.4.5",
39
36
  "@types/react": "18.2.17",
40
37
  "@types/react-dom": "18.2.7",