@yorab/react-paint 0.2.2 → 0.3.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.
Files changed (73) hide show
  1. package/Changelog.md +24 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +6 -89
  4. package/dist/components/App.js +125 -102
  5. package/dist/components/Canvas.js +17 -14
  6. package/dist/components/settings/LayoutButton.js +3 -3
  7. package/dist/components/settings/Layouts.js +6 -19
  8. package/dist/components/settings/SettingsBar.js +3 -3
  9. package/dist/components/toolbox/EditTextBox.js +3 -2
  10. package/dist/components/toolbox/MenuGroup.js +1 -0
  11. package/dist/components/toolbox/PictureUrlInput.js +8 -7
  12. package/dist/hooks/useDrawableCanvas.js +19 -17
  13. package/dist/hooks/useResizeObserver.js +40 -0
  14. package/dist/hooks/useShapes.js +12 -8
  15. package/dist/styles.css +16 -17
  16. package/dist/utils/data.js +71 -19
  17. package/dist/utils/draw.js +53 -44
  18. package/dist/utils/file.js +26 -60
  19. package/dist/utils/intersect.js +18 -14
  20. package/dist/utils/selection.js +3 -3
  21. package/dist/utils/transform.js +18 -2
  22. package/package.json +6 -7
  23. package/dist/components/App.d.ts +0 -20
  24. package/dist/components/Canvas.d.ts +0 -28
  25. package/dist/components/common/Button.d.ts +0 -14
  26. package/dist/components/common/Loading.d.ts +0 -6
  27. package/dist/components/common/Modal.d.ts +0 -8
  28. package/dist/components/common/Panel.d.ts +0 -10
  29. package/dist/components/common/Snackbar.d.ts +0 -7
  30. package/dist/components/settings/ColorField.d.ts +0 -12
  31. package/dist/components/settings/DeleteButton.d.ts +0 -9
  32. package/dist/components/settings/FontFamilyField.d.ts +0 -10
  33. package/dist/components/settings/LayoutButton.d.ts +0 -8
  34. package/dist/components/settings/Layouts.d.ts +0 -18
  35. package/dist/components/settings/LineArrowField.d.ts +0 -10
  36. package/dist/components/settings/LineTypeField.d.ts +0 -14
  37. package/dist/components/settings/PointsNumberField.d.ts +0 -11
  38. package/dist/components/settings/RangeField.d.ts +0 -16
  39. package/dist/components/settings/SelectField.d.ts +0 -16
  40. package/dist/components/settings/SettingsBar.d.ts +0 -16
  41. package/dist/components/toolbox/EditTextBox.d.ts +0 -10
  42. package/dist/components/toolbox/LoadFileTool.d.ts +0 -11
  43. package/dist/components/toolbox/MenuGroup.d.ts +0 -23
  44. package/dist/components/toolbox/PictureUrlInput.d.ts +0 -7
  45. package/dist/components/toolbox/Tool.d.ts +0 -13
  46. package/dist/components/toolbox/Toolbar.d.ts +0 -20
  47. package/dist/components/toolbox/ToolbarGroup.d.ts +0 -18
  48. package/dist/constants/draw.d.ts +0 -2
  49. package/dist/constants/draw.js +0 -10
  50. package/dist/constants/icons.d.ts +0 -36
  51. package/dist/constants/shapes.d.ts +0 -5
  52. package/dist/constants/snackbar.d.ts +0 -11
  53. package/dist/constants/style.d.ts +0 -12
  54. package/dist/hooks/useComponent.d.ts +0 -9
  55. package/dist/hooks/useDrag.d.ts +0 -15
  56. package/dist/hooks/useDrawableCanvas.d.ts +0 -30
  57. package/dist/hooks/useKeyboard.d.ts +0 -15
  58. package/dist/hooks/useShapes.d.ts +0 -22
  59. package/dist/hooks/useSnackbar.d.ts +0 -16
  60. package/dist/schemas/drawableShape.json +0 -1021
  61. package/dist/types/Mode.d.ts +0 -51
  62. package/dist/types/Shapes.d.ts +0 -122
  63. package/dist/types/keyboard.d.ts +0 -15
  64. package/dist/utils/data.d.ts +0 -4
  65. package/dist/utils/draw.d.ts +0 -18
  66. package/dist/utils/file.d.ts +0 -33
  67. package/dist/utils/intersect.d.ts +0 -8
  68. package/dist/utils/selection.d.ts +0 -7
  69. package/dist/utils/shapeData.d.ts +0 -5
  70. package/dist/utils/string.d.ts +0 -3
  71. package/dist/utils/style.d.ts +0 -2
  72. package/dist/utils/toolbar.d.ts +0 -12
  73. package/dist/utils/transform.d.ts +0 -271
@@ -1,15 +0,0 @@
1
- /// <reference types="react" />
2
- import { DrawableShape } from 'types/Shapes';
3
- declare type UseKeyboardType = {
4
- isInsideComponent: boolean;
5
- selectedShape: DrawableShape | undefined;
6
- pasteShape: (shape: DrawableShape) => void;
7
- updateShape: (shape: DrawableShape) => void;
8
- setSelectedShape: (value: React.SetStateAction<DrawableShape | undefined>) => void;
9
- removeShape: (shape: DrawableShape) => void;
10
- backwardShape: () => void;
11
- forwardShape: () => void;
12
- isEditingText: boolean;
13
- };
14
- declare const useKeyboard: ({ isInsideComponent, selectedShape, isEditingText, setSelectedShape, removeShape, pasteShape, updateShape, backwardShape, forwardShape }: UseKeyboardType) => {};
15
- export default useKeyboard;
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import { DrawableShape } from 'types/Shapes';
3
- declare const useShapes: (onDataChanged?: () => void) => {
4
- shapesRef: import("react").MutableRefObject<DrawableShape[]>;
5
- selectedShape: DrawableShape | undefined;
6
- addShape: (newShape: DrawableShape) => void;
7
- addPictureShape: (fileOrUrl: File | string, maxSize?: number) => Promise<import("types/Shapes").DrawablePicture>;
8
- moveShapes: (firstShapeId: string, lastShapeId: string) => void;
9
- saveShapes: () => void;
10
- setSelectedShape: import("react").Dispatch<import("react").SetStateAction<DrawableShape | undefined>>;
11
- toggleShapeVisibility: (shape: DrawableShape) => void;
12
- toggleShapeLock: (shape: DrawableShape) => void;
13
- removeShape: (shape: DrawableShape) => void;
14
- updateShape: (updatedShape: DrawableShape, withSave?: boolean) => void;
15
- backwardShape: () => void;
16
- forwardShape: () => void;
17
- clearShapes: (shapesToInit?: DrawableShape[], clearHistory?: boolean) => void;
18
- canGoBackward: boolean;
19
- canGoForward: boolean;
20
- canClear: boolean;
21
- };
22
- export default useShapes;
@@ -1,16 +0,0 @@
1
- import { SnackbarTypeEnum } from 'constants/snackbar';
2
- export declare type SnackBarType = {
3
- id: string;
4
- type: SnackbarTypeEnum;
5
- text: string;
6
- duration: number;
7
- };
8
- declare const useSnackbar: () => {
9
- snackbarList: SnackBarType[];
10
- addSnackbar: ({ type, duration, text }: {
11
- type?: SnackbarTypeEnum | undefined;
12
- duration?: number | undefined;
13
- text: string;
14
- }) => void;
15
- };
16
- export default useSnackbar;