@yorab/react-paint 0.2.2 → 0.4.1

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 (79) hide show
  1. package/Changelog.md +44 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +9 -90
  4. package/dist/components/App.js +233 -113
  5. package/dist/components/Canvas.js +45 -21
  6. package/dist/components/settings/ColorField.js +3 -7
  7. package/dist/components/settings/LayoutButton.js +3 -3
  8. package/dist/components/settings/Layouts.js +6 -19
  9. package/dist/components/settings/SettingsBar.js +3 -3
  10. package/dist/components/toolbox/EditTextBox.js +20 -13
  11. package/dist/components/toolbox/MenuGroup.js +48 -5
  12. package/dist/components/toolbox/PictureUrlInput.js +8 -7
  13. package/dist/components/toolbox/Toolbar.js +56 -33
  14. package/dist/components/toolbox/ToolbarGroup.js +3 -3
  15. package/dist/constants/shapes.js +7 -3
  16. package/dist/hooks/useDrawableCanvas.js +23 -20
  17. package/dist/hooks/useResizeObserver.js +40 -0
  18. package/dist/hooks/useShapes.js +14 -9
  19. package/dist/styles.css +32 -35
  20. package/dist/types/utils.js +5 -0
  21. package/dist/utils/data.js +71 -19
  22. package/dist/utils/draw.js +90 -51
  23. package/dist/utils/file.js +26 -60
  24. package/dist/utils/intersect.js +22 -18
  25. package/dist/utils/selection.js +6 -6
  26. package/dist/utils/shapeData.js +49 -54
  27. package/dist/utils/transform.js +48 -34
  28. package/package.json +6 -7
  29. package/dist/components/App.d.ts +0 -20
  30. package/dist/components/Canvas.d.ts +0 -28
  31. package/dist/components/common/Button.d.ts +0 -14
  32. package/dist/components/common/Loading.d.ts +0 -6
  33. package/dist/components/common/Modal.d.ts +0 -8
  34. package/dist/components/common/Panel.d.ts +0 -10
  35. package/dist/components/common/Snackbar.d.ts +0 -7
  36. package/dist/components/settings/ColorField.d.ts +0 -12
  37. package/dist/components/settings/DeleteButton.d.ts +0 -9
  38. package/dist/components/settings/FontFamilyField.d.ts +0 -10
  39. package/dist/components/settings/LayoutButton.d.ts +0 -8
  40. package/dist/components/settings/Layouts.d.ts +0 -18
  41. package/dist/components/settings/LineArrowField.d.ts +0 -10
  42. package/dist/components/settings/LineTypeField.d.ts +0 -14
  43. package/dist/components/settings/PointsNumberField.d.ts +0 -11
  44. package/dist/components/settings/RangeField.d.ts +0 -16
  45. package/dist/components/settings/SelectField.d.ts +0 -16
  46. package/dist/components/settings/SettingsBar.d.ts +0 -16
  47. package/dist/components/toolbox/EditTextBox.d.ts +0 -10
  48. package/dist/components/toolbox/LoadFileTool.d.ts +0 -11
  49. package/dist/components/toolbox/MenuGroup.d.ts +0 -23
  50. package/dist/components/toolbox/PictureUrlInput.d.ts +0 -7
  51. package/dist/components/toolbox/Tool.d.ts +0 -13
  52. package/dist/components/toolbox/Toolbar.d.ts +0 -20
  53. package/dist/components/toolbox/ToolbarGroup.d.ts +0 -18
  54. package/dist/constants/draw.d.ts +0 -2
  55. package/dist/constants/draw.js +0 -10
  56. package/dist/constants/icons.d.ts +0 -36
  57. package/dist/constants/shapes.d.ts +0 -5
  58. package/dist/constants/snackbar.d.ts +0 -11
  59. package/dist/constants/style.d.ts +0 -12
  60. package/dist/hooks/useComponent.d.ts +0 -9
  61. package/dist/hooks/useDrag.d.ts +0 -15
  62. package/dist/hooks/useDrawableCanvas.d.ts +0 -30
  63. package/dist/hooks/useKeyboard.d.ts +0 -15
  64. package/dist/hooks/useShapes.d.ts +0 -22
  65. package/dist/hooks/useSnackbar.d.ts +0 -16
  66. package/dist/schemas/drawableShape.json +0 -1021
  67. package/dist/types/Mode.d.ts +0 -51
  68. package/dist/types/Shapes.d.ts +0 -122
  69. package/dist/types/keyboard.d.ts +0 -15
  70. package/dist/utils/data.d.ts +0 -4
  71. package/dist/utils/draw.d.ts +0 -18
  72. package/dist/utils/file.d.ts +0 -33
  73. package/dist/utils/intersect.d.ts +0 -8
  74. package/dist/utils/selection.d.ts +0 -7
  75. package/dist/utils/shapeData.d.ts +0 -5
  76. package/dist/utils/string.d.ts +0 -3
  77. package/dist/utils/style.d.ts +0 -2
  78. package/dist/utils/toolbar.d.ts +0 -12
  79. package/dist/utils/transform.d.ts +0 -271
package/Changelog.md CHANGED
@@ -1,3 +1,47 @@
1
+ # V.0.4.1
2
+
3
+ - prevent mounting selection canvas when viewer mode
4
+ - prevent drawing selection when not needed
5
+ - Click on toolbar tool group always enable a tool
6
+ - fix input and select options not being impacted by
7
+ - new reponsive for toolbar
8
+
9
+ # V.0.4.0
10
+
11
+ - Add possibility to customize UI from props
12
+
13
+ # V.0.3.1
14
+
15
+ - Add prop to change canvas background color
16
+ - Move some props to options
17
+ - fix Picture shape not being saved and not triggering onDataChanged
18
+ - small picture are upscaled to fit container when imported
19
+ - Add prop to choose to display save/load/export
20
+
21
+ # V.0.3.0 :
22
+
23
+ - prevent picture from url submit to reload page
24
+ - add gridVisible prop and default to false
25
+ - rename withLayouts to layersManipulation and reduce possible values
26
+ - move every options inside options prop
27
+ - remove ajv and any kind of json validation
28
+ - limit snackbar use on success and always log errors
29
+ - fit size and center uploaded picture
30
+ - Add new viewer mode
31
+ - add borders on bars
32
+ - display shape id in layer panel
33
+ - Export : round values to 2 decimal points
34
+ - Export and import : remove temporary values (id) from stored file
35
+ - Clean unknown shape format from imported data
36
+ - Use ref for onDataChanged prop to avoid rerender if callback changes
37
+ - Calculate container size to resize canvas instead of CSS
38
+ - use requestAnimationFrame to improve perf
39
+ - fix TextEdit position and size not working with canvas resized
40
+ - fix anchors area becoming too small after rezsize
41
+ - add MIT license to project
42
+ - other minor fixes
43
+ - minor design improvements
44
+
1
45
  # V.0.2.2 :
2
46
 
3
47
  - Migrate to react 18
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Yohann Rabatel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,99 +1,18 @@
1
- ## To regenerate schema :
2
-
3
- typescript-json-schema "src/types/Shapes.ts" DrawableShapeJson --out 'src/schemas/drawableShape.json'
4
-
5
1
  # known issues :
6
2
 
7
- ## mobile/touch
3
+ ## To resolve before beta release
8
4
 
9
- - dnd layout on mobile not working CRITIC (fix : use dnd lib, or add touch listener to fake dnd, or provide alt UI)
10
- - double click not working with touch CRITIC (fix: fake it countinng delay between touch)
5
+ - Text tool broken since 0.2.2
6
+ - double click not working with touch (fix: fake it counting delay between touch)
11
7
 
12
- ## canvas resizing
8
+ ## mobile/touch
13
9
 
14
- - TextEdit position and size not working with canvas resized MINOR (fix : apply current canvas ratio to position and font size)
15
- - anchors become too small MAJOR (possible fix : increase size with current canvas ratio )
10
+ - dnd layout on mobile not working (fix : use dnd lib, or add touch listener to fake dnd, or provide alt UI)
16
11
 
17
12
  ## other
18
13
 
19
- - TextEdit cursor overflow MINOR (quick fix : edit on modale)
14
+ - TextEdit cursor overflow MINOR (quick fix : edit on modale ?)
15
+ - TextEdit copy/paste containing html breaks display
20
16
  - circle resizing only goes one direction
21
-
22
- # Remarques de thomas :
23
-
24
- ## done
25
-
26
- - les options (épaisseurs, style de trait...) ont une UI très peu utilisable (on sait pas quel option fait quoi et comment, on teste au pif)
27
- l'option de changement de couleur :
28
- ne s'applique qu'à la validation, c'est pas top pour savoir quelle couleur on veut parce qu'on est obligé de validé, voir que c'est pas beau, rouvrir... et ainsi de suite
29
- - a un petit bug : j'ouvre la modale de sélection, je clique à côté (ça unselect la forme), je change la couleur et valide : il ne se passe rien. Je comprends la logique derrière, mais à l'usage ça n'a pas trop de sens
30
- - pas de possibilité de setter l'opacité des objets, dommage je pense qu'il y a une vraie utilité à ça
31
- - croix qui efface le canvas
32
- il faut une confirmation ! :D
33
-
34
- ## remaining
35
-
36
- - pas de possibilité de sélectionner plusieurs objets avec un press/trace une zone avec la souris/relache (mécanique assez courante quand il y a de la manipulation d'objets)
37
- - pas de possibilité de zoom/dezoom dans le canvas, et ça c'est super utile amha
38
-
39
- ### pinceau
40
-
41
- - certains outils lisse le trait une fois que tu valides le tracé, et ça donne un rendu plus naturel et propre que ce qu'on trace au pad/souris. Du nice to have loin d'être prioritaire
42
- - avoir plusieurs style de pinceau (mode surligneur par exemple). ca serait utile sur des exo et techniquement c'est peut-être juste des preset de taille/couleur/opacité de l'outil actuel
43
- - je ne sais pas pourquoi, mais il a l'air moins fluide/smooth au tracé que marker.js (peut-être une illusion)
44
-
45
- ### trait
46
-
47
- - j'ai été surpris que ça me trace la "forme" dans un rectangle plutôt que d'avoir juste les 2 points sélectionnés (sans le cadre autour quoi)
48
-
49
- ### polygone
50
-
51
- - démarrer avec un polygone à 2 côté, c'est pas possible ça :sourire:
52
- quand on change le nombre de côté ça reste un truc plat et ensuite on tire des points :
53
- c'est pas du tout évident
54
- ça donne des formes qui ne sont pas des polygones (genre un noeuf papillon)
55
- idéalement, il faudrait démarrer avec un pentagone parfait -5 côtés de même longueur- (en dessous se sont des polygones trop communs) et quand on change le nombre de côté ça reset la forme sur un polygone parfait de X côtés
56
-
57
- ### Texte
58
-
59
- - options trop limitée, il faudrait à minima pouvoir changer la taille de la police, choisir plus de police, et faire un peu de mise en forme (i, b, u)
60
-
61
- ## bof
62
-
63
- - avoir les options dans un tooltip-like, au dessus de la forme, serait merveilleux (comme sur Miro, ou comme sur nos manuels avec la barre de mise en forme de texte)
64
- - rectangle: pas de carré avec maj, snif
65
- une option de la forme pour bloqué le ratio en "carré" ?
66
- - cercle/elipse
67
- redondant, la diff des outils me parait too much et pas clair
68
- bloqué en ratio cercle avec maj ou une option de forme (cf rectangle/carré) ?
69
-
70
- # En prévision / Future MAJ
71
-
72
- - fix text
73
-
74
- - Migrer sous Vite +
75
-
76
- - configurer npm publish
77
-
78
- - possibility to have presets
79
- - possibility to provide presets in props
80
- - add presets
81
-
82
- - add more settings
83
- - settings ui
84
- - add settings customization
85
-
86
- # A prévoir
87
-
88
- - ladle (wait for windows support https://github.com/tajo/ladle/issues/67)
89
- - get rid of enum for better typescript
90
- - add shortcuts (for tools) and show it in titles
91
- - Menu contextuel au clic droit (changement de plan, supprimer, duplicate, copy, lock)
92
- - bordure des traits à revoir
93
- - améliorer perfs avec précalculs + usage de path
94
- - lissage de traits
95
- - Move + zoom functionnality
96
- - UI customization
97
- - Tests !
98
- - fix remaining issues
99
- - fullscreen mode ?
17
+ - New text component opacity range is dancing
18
+ - adding padding to selection result in wrong intersection calculs