@solostylist/image-editor 1.0.8 → 1.0.10

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 (270) hide show
  1. package/lib/actions/add-filter.js +11 -1
  2. package/lib/actions/change-pointer-icon.js +10 -1
  3. package/lib/actions/change-rotation.js +13 -1
  4. package/lib/actions/clear-annotations-selections.js +10 -1
  5. package/lib/actions/duplicate-annotations.js +26 -1
  6. package/lib/actions/enable-text-content-edit.js +10 -1
  7. package/lib/actions/hide-loader.js +10 -1
  8. package/lib/actions/index.js +36 -1
  9. package/lib/actions/redo.js +27 -1
  10. package/lib/actions/remove-annotations.js +27 -1
  11. package/lib/actions/reset.js +26 -1
  12. package/lib/actions/select-annotation.js +27 -1
  13. package/lib/actions/select-tab.js +16 -1
  14. package/lib/actions/select-tool.js +11 -1
  15. package/lib/actions/set-annotation.js +28 -1
  16. package/lib/actions/set-canvas-size.js +31 -1
  17. package/lib/actions/set-crop.js +25 -1
  18. package/lib/actions/set-feedback.js +11 -1
  19. package/lib/actions/set-finetune.js +13 -1
  20. package/lib/actions/set-latest-color.js +10 -1
  21. package/lib/actions/set-original-image.js +13 -1
  22. package/lib/actions/set-resize.js +14 -1
  23. package/lib/actions/set-saved.js +10 -1
  24. package/lib/actions/set-saving.js +11 -1
  25. package/lib/actions/set-show-tabs-menu.js +10 -1
  26. package/lib/actions/set-shown-image-dimensions.js +12 -1
  27. package/lib/actions/show-loader.js +10 -1
  28. package/lib/actions/toggle-flip.js +13 -1
  29. package/lib/actions/toggle-original-image-display.js +10 -1
  30. package/lib/actions/undo.js +27 -1
  31. package/lib/actions/update-state.js +7 -1
  32. package/lib/actions/zoom-canvas.js +37 -1
  33. package/lib/components/app/index.js +283 -1
  34. package/lib/components/assembly-point/index.js +23 -1
  35. package/lib/components/common/annotation-options/annotation-options.constants.js +10 -1
  36. package/lib/components/common/annotation-options/index.js +140 -1
  37. package/lib/components/common/annotation-options/opacity-field.js +23 -1
  38. package/lib/components/common/annotation-options/position-fields.js +39 -1
  39. package/lib/components/common/annotation-options/shadow-fields.js +62 -1
  40. package/lib/components/common/annotation-options/stroke-fields.js +33 -1
  41. package/lib/components/common/button-with-menu/index.js +86 -1
  42. package/lib/components/common/color-input/index.js +101 -1
  43. package/lib/components/common/color-picker-modal/index.js +70 -1
  44. package/lib/components/common/hidden-upload-input/index.js +17 -1
  45. package/lib/components/common/icon-wrapper/index.js +40 -1
  46. package/lib/components/common/image-preview-tile/index.js +57 -1
  47. package/lib/components/common/slider/index.js +38 -1
  48. package/lib/components/feedback-popup/index.js +41 -1
  49. package/lib/components/layers/design-layer/annotation-nodes/annotation-nodes.constants.js +10 -1
  50. package/lib/components/layers/design-layer/annotation-nodes/arrow-node.js +62 -1
  51. package/lib/components/layers/design-layer/annotation-nodes/ellipse-node.js +64 -1
  52. package/lib/components/layers/design-layer/annotation-nodes/image-node.js +78 -1
  53. package/lib/components/layers/design-layer/annotation-nodes/index.js +22 -1
  54. package/lib/components/layers/design-layer/annotation-nodes/line-node.js +60 -1
  55. package/lib/components/layers/design-layer/annotation-nodes/memoized-annotation.js +16 -1
  56. package/lib/components/layers/design-layer/annotation-nodes/polygon-node.js +63 -1
  57. package/lib/components/layers/design-layer/annotation-nodes/rect-node.js +65 -1
  58. package/lib/components/layers/design-layer/annotation-nodes/text-node.js +80 -1
  59. package/lib/components/layers/design-layer/index.js +202 -1
  60. package/lib/components/layers/design-layer/nodes-common-prop-types.js +16 -1
  61. package/lib/components/layers/design-layer/preview-group.js +9 -1
  62. package/lib/components/layers/index.js +2 -1
  63. package/lib/components/layers/transformers-layer/crop-transformer.js +248 -1
  64. package/lib/components/layers/transformers-layer/index.js +16 -1
  65. package/lib/components/layers/transformers-layer/nodes-transformer.js +73 -1
  66. package/lib/components/layers/transformers-layer/transformers-layer.utils.js +93 -1
  67. package/lib/components/main-canvas/canvas-node.js +177 -1
  68. package/lib/components/main-canvas/index.js +51 -1
  69. package/lib/components/main-canvas/touch-zooming-events.js +69 -1
  70. package/lib/components/node-controls/index.js +79 -1
  71. package/lib/components/tabs/index.js +66 -1
  72. package/lib/components/tabs/tabs.constants.js +27 -1
  73. package/lib/components/tabs-drawer/index.js +109 -1
  74. package/lib/components/tools/arrow/arrow-button.js +17 -1
  75. package/lib/components/tools/arrow/arrow-options.js +19 -1
  76. package/lib/components/tools/arrow/index.js +2 -1
  77. package/lib/components/tools/blur/blur-options.js +35 -1
  78. package/lib/components/tools/blur/blur.js +17 -1
  79. package/lib/components/tools/blur/index.js +2 -1
  80. package/lib/components/tools/brightness/brightness-options.js +36 -1
  81. package/lib/components/tools/brightness/brightness.js +17 -1
  82. package/lib/components/tools/brightness/index.js +2 -1
  83. package/lib/components/tools/contrast/contrast-options.js +35 -1
  84. package/lib/components/tools/contrast/contrast.js +17 -1
  85. package/lib/components/tools/contrast/index.js +2 -1
  86. package/lib/components/tools/crop/crop.constants.js +31 -1
  87. package/lib/components/tools/crop/crop.js +122 -1
  88. package/lib/components/tools/crop/index.js +1 -1
  89. package/lib/components/tools/ellipse/ellipse-button.js +17 -1
  90. package/lib/components/tools/ellipse/ellipse-options.js +17 -1
  91. package/lib/components/tools/ellipse/index.js +2 -1
  92. package/lib/components/tools/filters/filter-item.js +77 -1
  93. package/lib/components/tools/filters/filters.constants.js +139 -1
  94. package/lib/components/tools/filters/filters.js +74 -1
  95. package/lib/components/tools/filters/index.js +1 -1
  96. package/lib/components/tools/flip/flip-x.js +48 -1
  97. package/lib/components/tools/flip/flip-y.js +50 -1
  98. package/lib/components/tools/flip/index.js +2 -1
  99. package/lib/components/tools/hsv/hsv.js +17 -1
  100. package/lib/components/tools/hsv/hsvoptions.js +60 -1
  101. package/lib/components/tools/hsv/index.js +2 -1
  102. package/lib/components/tools/image/image-button.js +17 -1
  103. package/lib/components/tools/image/image-controls.js +12 -1
  104. package/lib/components/tools/image/image-options.js +162 -1
  105. package/lib/components/tools/image/images-gallery.js +55 -1
  106. package/lib/components/tools/image/index.js +2 -1
  107. package/lib/components/tools/line/index.js +2 -1
  108. package/lib/components/tools/line/line-button.js +17 -1
  109. package/lib/components/tools/line/line-options.js +19 -1
  110. package/lib/components/tools/pen/index.js +2 -1
  111. package/lib/components/tools/pen/pen-button.js +17 -1
  112. package/lib/components/tools/pen/pen-options.js +120 -1
  113. package/lib/components/tools/polygon/index.js +2 -1
  114. package/lib/components/tools/polygon/polygon-button.js +17 -1
  115. package/lib/components/tools/polygon/polygon-options.js +22 -1
  116. package/lib/components/tools/polygon/polygon-sides-field.js +23 -1
  117. package/lib/components/tools/polygon/polygon.constants.js +10 -1
  118. package/lib/components/tools/rect/index.js +2 -1
  119. package/lib/components/tools/rect/rect-button.js +17 -1
  120. package/lib/components/tools/rect/rect-corner-field.js +24 -1
  121. package/lib/components/tools/rect/rect-options.js +21 -1
  122. package/lib/components/tools/rect/rect.constants.js +10 -1
  123. package/lib/components/tools/resize/index.js +1 -1
  124. package/lib/components/tools/resize/resize.js +141 -1
  125. package/lib/components/tools/rotate/index.js +2 -1
  126. package/lib/components/tools/rotate/rotate-button.js +17 -1
  127. package/lib/components/tools/rotate/rotate-options.js +97 -1
  128. package/lib/components/tools/text/index.js +2 -1
  129. package/lib/components/tools/text/text-button.js +17 -1
  130. package/lib/components/tools/text/text-options/handle-text-change-area.js +122 -1
  131. package/lib/components/tools/text/text-options/index.js +17 -1
  132. package/lib/components/tools/text/text-options/text-alignment-fields.js +38 -1
  133. package/lib/components/tools/text/text-options/text-controls.js +147 -1
  134. package/lib/components/tools/text/text-options/text-options.constants.js +16 -1
  135. package/lib/components/tools/text/text-options/text-spacings-fields.js +34 -1
  136. package/lib/components/tools/tools.constants.js +98 -1
  137. package/lib/components/tools/warmth/index.js +2 -1
  138. package/lib/components/tools/warmth/warmth-options.js +35 -1
  139. package/lib/components/tools/warmth/warmth.js +17 -1
  140. package/lib/components/tools/watermark/index.js +1 -1
  141. package/lib/components/tools/watermark/watermark-padding.js +59 -1
  142. package/lib/components/tools/watermark/watermark.js +221 -1
  143. package/lib/components/tools/watermark/watermarks-gallery.js +77 -1
  144. package/lib/components/tools-bar/index.js +113 -1
  145. package/lib/components/tools-bar/tools-bar-item-button.js +39 -1
  146. package/lib/components/topbar/canvas-zooming.js +119 -1
  147. package/lib/components/topbar/confirmation-modal.js +53 -1
  148. package/lib/components/topbar/image-dimensions-and-display-toggle.js +68 -1
  149. package/lib/components/topbar/index.js +47 -1
  150. package/lib/components/topbar/redo-button.js +25 -1
  151. package/lib/components/topbar/reset-button.js +21 -1
  152. package/lib/components/topbar/save-button.js +251 -1
  153. package/lib/components/topbar/topbar.constants.js +31 -1
  154. package/lib/components/topbar/undo-button.js +27 -1
  155. package/lib/context/app-context.js +3 -1
  156. package/lib/context/app-provider-overriden-value.js +9 -1
  157. package/lib/context/app-provider.js +48 -1
  158. package/lib/context/app-reducer.js +5 -1
  159. package/lib/context/default-config.js +75 -1
  160. package/lib/context/default-translations.js +115 -1
  161. package/lib/context/get-initial-app-state.js +61 -1
  162. package/lib/context/index.js +4 -1
  163. package/lib/custom/filters/aden.js +8 -1
  164. package/lib/custom/filters/amaro.js +8 -1
  165. package/lib/custom/filters/ashby.js +8 -1
  166. package/lib/custom/filters/base-filters.js +82 -1
  167. package/lib/custom/filters/black-and-white.js +11 -1
  168. package/lib/custom/filters/brannan.js +8 -1
  169. package/lib/custom/filters/brooklyn.js +8 -1
  170. package/lib/custom/filters/charmes.js +8 -1
  171. package/lib/custom/filters/clarendon.js +9 -1
  172. package/lib/custom/filters/crema.js +8 -1
  173. package/lib/custom/filters/dogpatch.js +8 -1
  174. package/lib/custom/filters/earlybird.js +7 -1
  175. package/lib/custom/filters/gingham.js +8 -1
  176. package/lib/custom/filters/ginza.js +8 -1
  177. package/lib/custom/filters/hefe.js +8 -1
  178. package/lib/custom/filters/helena.js +8 -1
  179. package/lib/custom/filters/hudson.js +9 -1
  180. package/lib/custom/filters/index.js +40 -1
  181. package/lib/custom/filters/juno.js +8 -1
  182. package/lib/custom/filters/kelvin.js +9 -1
  183. package/lib/custom/filters/lark.js +9 -1
  184. package/lib/custom/filters/lo-fi.js +8 -1
  185. package/lib/custom/filters/ludwig.js +8 -1
  186. package/lib/custom/filters/maven.js +9 -1
  187. package/lib/custom/filters/mayfair.js +8 -1
  188. package/lib/custom/filters/moon.js +7 -1
  189. package/lib/custom/filters/nashville.js +8 -1
  190. package/lib/custom/filters/ninteen-seventy-seven.js +8 -1
  191. package/lib/custom/filters/perpetua.js +7 -1
  192. package/lib/custom/filters/reyes.js +9 -1
  193. package/lib/custom/filters/rise.js +9 -1
  194. package/lib/custom/filters/sierra.js +8 -1
  195. package/lib/custom/filters/skyline.js +8 -1
  196. package/lib/custom/filters/slumber.js +8 -1
  197. package/lib/custom/filters/stinson.js +8 -1
  198. package/lib/custom/filters/sutro.js +8 -1
  199. package/lib/custom/filters/toaster.js +8 -1
  200. package/lib/custom/filters/valencia.js +9 -1
  201. package/lib/custom/filters/vesper.js +9 -1
  202. package/lib/custom/filters/walden.js +8 -1
  203. package/lib/custom/filters/willow.js +8 -1
  204. package/lib/custom/filters/xpro2.js +9 -1
  205. package/lib/custom/finetunes/custom-threshold.js +19 -1
  206. package/lib/custom/finetunes/index.js +2 -1
  207. package/lib/custom/finetunes/warmth.js +15 -1
  208. package/lib/demo/app.js +175 -1
  209. package/lib/demo/index.js +1 -1
  210. package/lib/hooks/index.js +12 -1
  211. package/lib/hooks/use-annotation/get-bounding-rect-un-scaled.js +14 -1
  212. package/lib/hooks/use-annotation/get-new-annotation-preview.js +83 -1
  213. package/lib/hooks/use-annotation/index.js +138 -1
  214. package/lib/hooks/use-annotation/preview-then-call-annotation-adding.js +159 -1
  215. package/lib/hooks/use-annotation-events.js +83 -1
  216. package/lib/hooks/use-app-reducer.js +53 -1
  217. package/lib/hooks/use-debounced-callback.js +7 -1
  218. package/lib/hooks/use-drag.js +37 -1
  219. package/lib/hooks/use-filter.js +20 -1
  220. package/lib/hooks/use-finetune.js +31 -1
  221. package/lib/hooks/use-phone-screen.js +5 -1
  222. package/lib/hooks/use-popover.js +27 -1
  223. package/lib/hooks/use-resize-observer.js +60 -1
  224. package/lib/hooks/use-store.js +6 -1
  225. package/lib/hooks/use-transformed-img-data.js +156 -1
  226. package/lib/hooks/use-update-effect.js +18 -1
  227. package/lib/index.d.ts +2 -2
  228. package/lib/index.d.ts.map +1 -1
  229. package/lib/index.js +4 -1
  230. package/lib/types/actions.js +31 -1
  231. package/lib/types/annotations.js +42 -1
  232. package/lib/types/common.js +1 -1
  233. package/lib/types/config.js +34 -1
  234. package/lib/types/index.js +5 -1
  235. package/lib/types/state.js +1 -1
  236. package/lib/utils/assign-finetune-names-to-konva.js +7 -1
  237. package/lib/utils/calculate-zoom-data.js +36 -1
  238. package/lib/utils/compare-ratios.js +5 -1
  239. package/lib/utils/constants.js +84 -1
  240. package/lib/utils/crop-image.js +10 -1
  241. package/lib/utils/debounce.js +19 -1
  242. package/lib/utils/deep-merge.js +26 -1
  243. package/lib/utils/extract-current-design-state.js +15 -1
  244. package/lib/utils/extract-name-from-url.js +5 -1
  245. package/lib/utils/filter-str-to-class.js +9 -1
  246. package/lib/utils/finetunes-strs-to-classes.js +13 -1
  247. package/lib/utils/get-center-rotated-point.js +34 -1
  248. package/lib/utils/get-default-save-quality.js +5 -1
  249. package/lib/utils/get-dimensions-minimal-ratio.js +6 -1
  250. package/lib/utils/get-elem-document-coords.js +24 -1
  251. package/lib/utils/get-file-full-name.js +21 -1
  252. package/lib/utils/get-pointer-offset-position-bounded-to-object.js +26 -1
  253. package/lib/utils/get-proper-dimensions.js +21 -1
  254. package/lib/utils/get-proper-image-to-canvas-spacing.js +6 -1
  255. package/lib/utils/get-scroll-offset.js +13 -1
  256. package/lib/utils/get-size-after-rotation.js +31 -1
  257. package/lib/utils/get-zoom-fit-factor.js +5 -1
  258. package/lib/utils/image-to-base64.js +12 -1
  259. package/lib/utils/is-default-zero-values-only.js +6 -1
  260. package/lib/utils/is-same-image.js +4 -1
  261. package/lib/utils/load-image.js +19 -1
  262. package/lib/utils/map-crop-box.js +16 -1
  263. package/lib/utils/map-number.js +4 -1
  264. package/lib/utils/map-position-string-to-point.js +92 -1
  265. package/lib/utils/random-id.js +5 -1
  266. package/lib/utils/restrict-number.js +7 -1
  267. package/lib/utils/serialize-design-state.js +62 -1
  268. package/lib/utils/to-precised-float.js +5 -1
  269. package/lib/utils/translator.js +14 -1
  270. package/package.json +1 -1
@@ -1 +1,97 @@
1
- import{RotateLeftOutlined,RotateRightOutlined,Rotate90DegreesCwOutlined}from"@mui/icons-material";import Slider from"@mui/material/Slider";import{useDebouncedCallback,usePhoneScreen,useStore}from"hooks";import{CHANGE_ROTATION,SET_RESIZE}from"actions";import restrictNumber from"utils/restrict-number";import getSizeAfterRotation from"utils/get-size-after-rotation";import{TOOLS_IDS}from"utils/constants";import ToolsBarItemButton from"components/tools-bar/tools-bar-item-button";import{SFlexBox,SIconButton}from"@solostylist/ui-kit/core";var RotateOptions=function(){var a=useStore(),b=a.dispatch,c=a.adjustments.rotation,d=void 0===c?0:c,e=a.resize,f=void 0===e?{}:e,g=a.config,h=g[TOOLS_IDS.ROTATE],i=usePhoneScreen(),j=useDebouncedCallback(function(a,c){var d=restrictNumber(c,-180,180);if(b({type:CHANGE_ROTATION,payload:{rotation:d}}),f.width&&f.height){var e=getSizeAfterRotation(f.width,f.height,d);b({type:SET_RESIZE,payload:{width:e.width,height:e.height}})}},20);return"buttons"===h.componentType?React.createElement(React.Fragment,null,React.createElement(ToolsBarItemButton,{id:TOOLS_IDS.IMAGE,label:"-".concat(h.angle,"\xB0"),Icon:RotateLeftOutlined,onClick:function(a){var b=d-h.angle;j(a,b)}}),React.createElement(ToolsBarItemButton,{id:TOOLS_IDS.IMAGE,label:"+".concat(null===h||void 0===h?void 0:h.angle,"\xB0"),Icon:RotateRightOutlined,onClick:function(a){var b=d+h.angle;j(a,b)}})):React.createElement(SFlexBox,{alignItems:"center",gap:2},React.createElement(SIconButton,{onClick:function(a){return j(a,d-90)}},React.createElement(Rotate90DegreesCwOutlined,null)),React.createElement(Slider,{valueLabelDisplay:"auto",marks:!0,min:-180,max:180,step:i?h.angle/3:1,value:d,onChange:j,sx:{width:200,"& .MuiSlider-thumb":{width:12,height:12},"& .MuiSlider-mark":{width:4,height:4,borderRadius:"50%"}}}),React.createElement(SIconButton,{onClick:function(a){return j(a,d+90)}},React.createElement(Rotate90DegreesCwOutlined,{sx:{transform:"scaleX(-1)"}})))};export default RotateOptions;
1
+ import { RotateLeftOutlined, RotateRightOutlined, Rotate90DegreesCwOutlined } from '@mui/icons-material';
2
+ import Slider from '@mui/material/Slider';
3
+ import { useDebouncedCallback, usePhoneScreen, useStore } from 'hooks';
4
+ import { CHANGE_ROTATION, SET_RESIZE } from 'actions';
5
+ import restrictNumber from 'utils/restrict-number';
6
+ import getSizeAfterRotation from 'utils/get-size-after-rotation';
7
+ import { TOOLS_IDS } from 'utils/constants';
8
+ import ToolsBarItemButton from 'components/tools-bar/tools-bar-item-button';
9
+ import { SFlexBox, SIconButton } from '@solostylist/ui-kit/core';
10
+ var RotateOptions = function RotateOptions() {
11
+ var _useStore = useStore(),
12
+ dispatch = _useStore.dispatch,
13
+ _useStore$adjustments = _useStore.adjustments.rotation,
14
+ rotation = _useStore$adjustments === void 0 ? 0 : _useStore$adjustments,
15
+ _useStore$resize = _useStore.resize,
16
+ resize = _useStore$resize === void 0 ? {} : _useStore$resize,
17
+ config = _useStore.config;
18
+ var rotateConfig = config[TOOLS_IDS.ROTATE];
19
+ var isPhoneScreen = usePhoneScreen();
20
+ var changeRotation = useDebouncedCallback(function (_e, newRotation) {
21
+ var rotationAngle = restrictNumber(newRotation, -180, 180);
22
+ dispatch({
23
+ type: CHANGE_ROTATION,
24
+ payload: {
25
+ rotation: rotationAngle
26
+ }
27
+ });
28
+ if (resize.width && resize.height) {
29
+ var sizeAfterRotation = getSizeAfterRotation(resize.width, resize.height, rotationAngle);
30
+ dispatch({
31
+ type: SET_RESIZE,
32
+ payload: {
33
+ width: sizeAfterRotation.width,
34
+ height: sizeAfterRotation.height
35
+ }
36
+ });
37
+ }
38
+ }, 20);
39
+ var changeRotationButtonPositive = function changeRotationButtonPositive(e) {
40
+ var newAngle = rotation + rotateConfig.angle;
41
+ changeRotation(e, newAngle);
42
+ };
43
+ var changeRotationButtonNegative = function changeRotationButtonNegative(e) {
44
+ var newAngle = rotation - rotateConfig.angle;
45
+ changeRotation(e, newAngle);
46
+ };
47
+ if (rotateConfig.componentType === 'buttons') {
48
+ return React.createElement(React.Fragment, null, React.createElement(ToolsBarItemButton, {
49
+ id: TOOLS_IDS.IMAGE,
50
+ label: "-".concat(rotateConfig.angle, "\xB0"),
51
+ Icon: RotateLeftOutlined,
52
+ onClick: changeRotationButtonNegative
53
+ }), React.createElement(ToolsBarItemButton, {
54
+ id: TOOLS_IDS.IMAGE,
55
+ label: "+".concat(rotateConfig === null || rotateConfig === void 0 ? void 0 : rotateConfig.angle, "\xB0"),
56
+ Icon: RotateRightOutlined,
57
+ onClick: changeRotationButtonPositive
58
+ }));
59
+ }
60
+ return React.createElement(SFlexBox, {
61
+ alignItems: "center",
62
+ gap: 2
63
+ }, React.createElement(SIconButton, {
64
+ onClick: function onClick(e) {
65
+ return changeRotation(e, rotation - 90);
66
+ }
67
+ }, React.createElement(Rotate90DegreesCwOutlined, null)), React.createElement(Slider, {
68
+ valueLabelDisplay: "auto",
69
+ marks: true,
70
+ min: -180,
71
+ max: 180,
72
+ step: isPhoneScreen ? rotateConfig.angle / 3 : 1,
73
+ value: rotation,
74
+ onChange: changeRotation,
75
+ sx: {
76
+ width: 200,
77
+ '& .MuiSlider-thumb': {
78
+ width: 12,
79
+ height: 12
80
+ },
81
+ '& .MuiSlider-mark': {
82
+ width: 4,
83
+ height: 4,
84
+ borderRadius: '50%'
85
+ }
86
+ }
87
+ }), React.createElement(SIconButton, {
88
+ onClick: function onClick(e) {
89
+ return changeRotation(e, rotation + 90);
90
+ }
91
+ }, React.createElement(Rotate90DegreesCwOutlined, {
92
+ sx: {
93
+ transform: 'scaleX(-1)'
94
+ }
95
+ })));
96
+ };
97
+ export default RotateOptions;
@@ -1 +1,2 @@
1
- export{default as TextButton}from"./text-button";export{default as TextOptions}from"./text-options";
1
+ export { default as TextButton } from "./text-button";
2
+ export { default as TextOptions } from "./text-options";
@@ -1 +1,17 @@
1
- import{TextFieldsOutlined as TextIcon}from"@mui/icons-material";import ToolsBarItemButton from"components/tools-bar/tools-bar-item-button";import{TOOLS_IDS}from"utils/constants";var TextButton=function(a){var b=a.selectTool,c=a.isSelected,d=a.t;return React.createElement(ToolsBarItemButton,{id:TOOLS_IDS.TEXT,label:d("textTool"),Icon:TextIcon,onClick:b,isSelected:void 0!==c&&c})};export default TextButton;
1
+ import { TextFieldsOutlined as TextIcon } from '@mui/icons-material';
2
+ import ToolsBarItemButton from 'components/tools-bar/tools-bar-item-button';
3
+ import { TOOLS_IDS } from 'utils/constants';
4
+ var TextButton = function TextButton(_ref) {
5
+ var selectTool = _ref.selectTool,
6
+ _ref$isSelected = _ref.isSelected,
7
+ isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
8
+ t = _ref.t;
9
+ return React.createElement(ToolsBarItemButton, {
10
+ id: TOOLS_IDS.TEXT,
11
+ label: t('textTool'),
12
+ Icon: TextIcon,
13
+ onClick: selectTool,
14
+ isSelected: isSelected
15
+ });
16
+ };
17
+ export default TextButton;
@@ -1 +1,122 @@
1
- var textarea,textNode,transformer,editFinishCallback,disableTextEditCallback;function deactivateTextChange(){textarea&&textarea.remove(),window&&window.removeEventListener("click",handleOutsideClick),textNode&&textNode.show(),transformer&&transformer.show(),"function"==typeof disableTextEditCallback&&disableTextEditCallback(),textNode=null,textarea=null,transformer=null}function handleOutsideClick(a){if(a.target!==textarea){var b=textarea.value;deactivateTextChange(),editFinishCallback(b)}}var activateTextChange=function(a,b,c,d,e){function f(a){var b=a;b||(b=textNode.placeholder.length*textNode.fontSize());var c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);(c||k)&&(b=Math.ceil(b));var d=!!document.documentMode||/Edge/.test(navigator.userAgent);d&&(b+=1),textarea.style.width="".concat(b,"px")}editFinishCallback=d,disableTextEditCallback=e,transformer=c,textNode=b.findOne("#".concat(a)),textNode.hide(),transformer.hide();var g=textNode.absolutePosition();textarea=document.createElement("textarea"),b.container().parentNode.appendChild(textarea),textarea.value=textNode.text(),textarea.style.position="absolute",textarea.style.top="".concat(g.y,"px"),textarea.style.left="".concat(g.x,"px"),textarea.style.width="".concat(textNode.width()-2*textNode.padding(),"px"),textarea.style.height="".concat(textNode.height()-2*textNode.padding()+5,"px"),textarea.style.maxWidth="".concat(textNode.width()-2*textNode.padding(),"px"),textarea.style.maxHeight="".concat(textNode.height()-2*textNode.padding()+5,"px"),textarea.style.fontSize="".concat(textNode.fontSize(),"px"),textarea.style.border="1px solid rgba(0, 0, 0, 0.5)",textarea.style.padding="0px",textarea.style.margin="0px",textarea.style.overflow="hidden",textarea.style.background="none",textarea.style.outline="none",textarea.style.resize="none",textarea.style.lineHeight=textNode.lineHeight(),textarea.style.fontFamily=textNode.fontFamily(),textarea.style.transformOrigin="left top",textarea.style.textAlign=textNode.align(),textarea.style.fontStyle=textNode.fontStyle(),textarea.style.letterSpacing=textNode.letterSpacing(),textarea.style.lineHeight=textNode.lineHeight(),textarea.style.color=textNode.fill();var h=textNode.rotation(),i="";h&&(i+="rotateZ(".concat(h,"deg)"));var j=0,k=-1<navigator.userAgent.toLowerCase().indexOf("firefox");k&&(j+=2+Math.round(textNode.fontSize()/20)),i+="translateY(-".concat(j,"px)"),textarea.style.transform=i,textarea.style.height="auto",textarea.style.height="".concat(textarea.scrollHeight+3,"px"),textarea.focus(),textarea.addEventListener("keydown",function(a){if("Enter"===a.key&&!a.shiftKey){var b=textarea.value;deactivateTextChange(),editFinishCallback(b)}"Escape"===a.key&&deactivateTextChange()}),textarea.addEventListener("keydown",function(a){if("Enter"!==a.key&&"Escape"!==a.key){var b=textNode.getAbsoluteScale().x;f(textNode.width()*b),textarea.style.height="auto",textarea.style.height="".concat(textarea.scrollHeight+textNode.fontSize(),"px")}}),window&&setTimeout(function(){window.addEventListener("click",handleOutsideClick)})};export{activateTextChange,deactivateTextChange};
1
+ var textarea;
2
+ var textNode;
3
+ var transformer;
4
+ var editFinishCallback;
5
+ var disableTextEditCallback;
6
+ function deactivateTextChange() {
7
+ if (textarea) {
8
+ textarea.remove();
9
+ }
10
+ if (window) {
11
+ window.removeEventListener('click', handleOutsideClick);
12
+ }
13
+ if (textNode) {
14
+ textNode.show();
15
+ }
16
+ if (transformer) {
17
+ transformer.show();
18
+ }
19
+ if (typeof disableTextEditCallback === 'function') {
20
+ disableTextEditCallback();
21
+ }
22
+ textNode = null;
23
+ textarea = null;
24
+ transformer = null;
25
+ }
26
+ function handleOutsideClick(e) {
27
+ if (e.target !== textarea) {
28
+ var textValue = textarea.value;
29
+ deactivateTextChange();
30
+ editFinishCallback(textValue);
31
+ }
32
+ }
33
+ var activateTextChange = function activateTextChange(textNodeId, canvasStage, currentTransformer, finishingCallback, dismissingTextEditing) {
34
+ editFinishCallback = finishingCallback;
35
+ disableTextEditCallback = dismissingTextEditing;
36
+ transformer = currentTransformer;
37
+ textNode = canvasStage.findOne("#".concat(textNodeId));
38
+ textNode.hide();
39
+ transformer.hide();
40
+ var textPosition = textNode.absolutePosition();
41
+ textarea = document.createElement('textarea');
42
+ canvasStage.container().parentNode.appendChild(textarea);
43
+ textarea.value = textNode.text();
44
+ textarea.style.position = 'absolute';
45
+ textarea.style.top = "".concat(textPosition.y, "px");
46
+ textarea.style.left = "".concat(textPosition.x, "px");
47
+ textarea.style.width = "".concat(textNode.width() - textNode.padding() * 2, "px");
48
+ textarea.style.height = "".concat(textNode.height() - textNode.padding() * 2 + 5, "px");
49
+ textarea.style.maxWidth = "".concat(textNode.width() - textNode.padding() * 2, "px");
50
+ textarea.style.maxHeight = "".concat(textNode.height() - textNode.padding() * 2 + 5, "px");
51
+ textarea.style.fontSize = "".concat(textNode.fontSize(), "px");
52
+ textarea.style.border = '1px solid rgba(0, 0, 0, 0.5)';
53
+ textarea.style.padding = '0px';
54
+ textarea.style.margin = '0px';
55
+ textarea.style.overflow = 'hidden';
56
+ textarea.style.background = 'none';
57
+ textarea.style.outline = 'none';
58
+ textarea.style.resize = 'none';
59
+ textarea.style.lineHeight = textNode.lineHeight();
60
+ textarea.style.fontFamily = textNode.fontFamily();
61
+ textarea.style.transformOrigin = 'left top';
62
+ textarea.style.textAlign = textNode.align();
63
+ textarea.style.fontStyle = textNode.fontStyle();
64
+ textarea.style.letterSpacing = textNode.letterSpacing();
65
+ textarea.style.lineHeight = textNode.lineHeight();
66
+ textarea.style.color = textNode.fill();
67
+ var rotation = textNode.rotation();
68
+ var transform = '';
69
+ if (rotation) {
70
+ transform += "rotateZ(".concat(rotation, "deg)");
71
+ }
72
+ var firefoxMovePx = 0;
73
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
74
+ if (isFirefox) {
75
+ firefoxMovePx += 2 + Math.round(textNode.fontSize() / 20);
76
+ }
77
+ transform += "translateY(-".concat(firefoxMovePx, "px)");
78
+ textarea.style.transform = transform;
79
+ textarea.style.height = 'auto';
80
+ textarea.style.height = "".concat(textarea.scrollHeight + 3, "px");
81
+ textarea.focus();
82
+ function setTextareaWidth(newTextWidth) {
83
+ var newWidth = newTextWidth;
84
+ if (!newWidth) {
85
+ newWidth = textNode.placeholder.length * textNode.fontSize();
86
+ }
87
+ var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
88
+ if (isSafari || isFirefox) {
89
+ newWidth = Math.ceil(newWidth);
90
+ }
91
+ var isEdge = !!document.documentMode || /Edge/.test(navigator.userAgent);
92
+ if (isEdge) {
93
+ newWidth += 1;
94
+ }
95
+ textarea.style.width = "".concat(newWidth, "px");
96
+ }
97
+ textarea.addEventListener('keydown', function (event) {
98
+ if (event.key === 'Enter' && !event.shiftKey) {
99
+ var textContent = textarea.value;
100
+ deactivateTextChange();
101
+ editFinishCallback(textContent);
102
+ }
103
+ if (event.key === 'Escape') {
104
+ deactivateTextChange();
105
+ }
106
+ });
107
+ textarea.addEventListener('keydown', function (event) {
108
+ if (event.key === 'Enter' || event.key === 'Escape') {
109
+ return;
110
+ }
111
+ var scale = textNode.getAbsoluteScale().x;
112
+ setTextareaWidth(textNode.width() * scale);
113
+ textarea.style.height = 'auto';
114
+ textarea.style.height = "".concat(textarea.scrollHeight + textNode.fontSize(), "px");
115
+ });
116
+ if (window) {
117
+ setTimeout(function () {
118
+ window.addEventListener('click', handleOutsideClick);
119
+ });
120
+ }
121
+ };
122
+ export { activateTextChange, deactivateTextChange };
@@ -1 +1,17 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useAnnotation}from"hooks";import{TOOLS_IDS}from"utils/constants";import TextControls from"./text-controls";var TextOptions=function(){var a=useAnnotation({name:TOOLS_IDS.TEXT}),b=_slicedToArray(a,2),c=b[0],d=b[1];return React.createElement(TextControls,{text:c,saveText:d})};export default TextOptions;
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useAnnotation } from 'hooks';
3
+ import { TOOLS_IDS } from 'utils/constants';
4
+ import TextControls from "./text-controls";
5
+ var TextOptions = function TextOptions() {
6
+ var _useAnnotation = useAnnotation({
7
+ name: TOOLS_IDS.TEXT
8
+ }),
9
+ _useAnnotation2 = _slicedToArray(_useAnnotation, 2),
10
+ text = _useAnnotation2[0],
11
+ saveText = _useAnnotation2[1];
12
+ return React.createElement(TextControls, {
13
+ text: text,
14
+ saveText: saveText
15
+ });
16
+ };
17
+ export default TextOptions;
@@ -1 +1,38 @@
1
- import{FormatAlignCenterOutlined,FormatAlignLeftOutlined}from"@mui/icons-material";import{SFlexBox}from"@solostylist/ui-kit/core";import SIconButtonWrapper from"components/common/icon-wrapper";import{TextAlignment}from"types/annotations";var rightAlignmentCssTransform={transform:"scaleX(-1)"},TextAlignmentFields=function(a){var b=a.annotation,c=a.updateAnnotation,d=b.align,e=function(a){c({align:a})};return React.createElement(SFlexBox,{gap:1},React.createElement(SIconButtonWrapper,{onClick:function(){return e(TextAlignment.LEFT)},active:d===TextAlignment.LEFT},React.createElement(FormatAlignLeftOutlined,null)),React.createElement(SIconButtonWrapper,{onClick:function(){return e(TextAlignment.CENTER)},active:d===TextAlignment.CENTER},React.createElement(FormatAlignCenterOutlined,null)),React.createElement(SIconButtonWrapper,{onClick:function(){return e(TextAlignment.RIGHT)},active:d===TextAlignment.RIGHT},React.createElement(FormatAlignLeftOutlined,{style:rightAlignmentCssTransform})))};export default TextAlignmentFields;
1
+ import { FormatAlignCenterOutlined, FormatAlignLeftOutlined } from '@mui/icons-material';
2
+ import { SFlexBox } from '@solostylist/ui-kit/core';
3
+ import SIconButtonWrapper from 'components/common/icon-wrapper';
4
+ import { TextAlignment } from 'types/annotations';
5
+ var rightAlignmentCssTransform = {
6
+ transform: 'scaleX(-1)'
7
+ };
8
+ var TextAlignmentFields = function TextAlignmentFields(_ref) {
9
+ var text = _ref.annotation,
10
+ updateText = _ref.updateAnnotation;
11
+ var align = text.align;
12
+ var changeHorizontalAlignment = function changeHorizontalAlignment(newHorizonalAlignment) {
13
+ updateText({
14
+ align: newHorizonalAlignment
15
+ });
16
+ };
17
+ return React.createElement(SFlexBox, {
18
+ gap: 1
19
+ }, React.createElement(SIconButtonWrapper, {
20
+ onClick: function onClick() {
21
+ return changeHorizontalAlignment(TextAlignment.LEFT);
22
+ },
23
+ active: align === TextAlignment.LEFT
24
+ }, React.createElement(FormatAlignLeftOutlined, null)), React.createElement(SIconButtonWrapper, {
25
+ onClick: function onClick() {
26
+ return changeHorizontalAlignment(TextAlignment.CENTER);
27
+ },
28
+ active: align === TextAlignment.CENTER
29
+ }, React.createElement(FormatAlignCenterOutlined, null)), React.createElement(SIconButtonWrapper, {
30
+ onClick: function onClick() {
31
+ return changeHorizontalAlignment(TextAlignment.RIGHT);
32
+ },
33
+ active: align === TextAlignment.RIGHT
34
+ }, React.createElement(FormatAlignLeftOutlined, {
35
+ style: rightAlignmentCssTransform
36
+ })));
37
+ };
38
+ export default TextAlignmentFields;
@@ -1 +1,147 @@
1
- import _typeof from"@babel/runtime/helpers/typeof";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";import{useCallback,useEffect}from"react";import{FormatBoldOutlined,FormatItalicOutlined}from"@mui/icons-material";import{TOOLS_IDS,TRANSFORMERS_LAYER_ID}from"utils/constants";import AnnotationOptions from"components/common/annotation-options";import SIconButtonWrapper from"components/common/icon-wrapper";import{ENABLE_TEXT_CONTENT_EDIT}from"actions";import restrictNumber from"utils/restrict-number";import{useStore}from"hooks";import{SFlexBox,SSelect,STextField}from"@solostylist/ui-kit/core";import{textOptionsPopupComponents,TEXT_POPPABLE_OPTIONS}from"./text-options.constants";import{activateTextChange,deactivateTextChange}from"./handle-text-change-area";var TextControls=function(a){var b=a.text,c=a.saveText,d=a.children,e=useStore(),f=e.dispatch,g=e.textIdOfEditableContent,h=e.designLayer,i=e.t,j=e.config,k=j[TOOLS_IDS.TEXT]||{},l=k.fonts,m=void 0===l?[]:l,n=k.onFontChange,o=useCallback(function(a){var b=a.target,d=b.name,e=b.value,f=b.type;c(function(a){return _defineProperty({id:a.id},d,"number"===f?restrictNumber(+e,1,500):e)})},[c]),p=useCallback(function(a){if(o({target:{name:"fontFamily",value:a}}),b.fontFamily!==a&&"function"==typeof n){var c=h.draw.bind(h);n(a,c)}},[o,b.fontFamily,n,h]),q=useCallback(function(a){var c,d=(null===(c=b.fontStyle)||void 0===c?void 0:c.replace("normal","").split(" "))||[];0<Object.keys(d).length&&d.includes(a)?d=d.filter(function(b){return b!==a}):d.push(a),o({target:{name:"fontStyle",value:d.join(" ").trim()||"normal"}})},[b.fontStyle,o]),r=useCallback(function(){f({type:ENABLE_TEXT_CONTENT_EDIT,payload:{textIdOfEditableContent:null}})},[]),s=useCallback(function(a){o({target:{name:"text",value:a}}),r()},[]);return useEffect(function(){var a;if(g&&b.id===g){var c=h.getStage(),d=c.findOne("#".concat(TRANSFORMERS_LAYER_ID));if(d){var e=d.children||[],f=_slicedToArray(e,1);a=f[0],activateTextChange(g,c,a,s,r)}}return function(){a&&g&&deactivateTextChange()}},[g]),React.createElement(AnnotationOptions,{annotation:b,updateAnnotation:c,morePoppableOptionsPrepended:TEXT_POPPABLE_OPTIONS,moreOptionsPopupComponentsObj:textOptionsPopupComponents},React.createElement(SFlexBox,{sx:{gap:1,alignItems:"center"}},Array.isArray(m)&&1<m.length&&React.createElement(SSelect,{onChange:function(a){return p(a.target.value)},value:b.fontFamily,placeholder:i("fontFamily"),options:m,optionLabel:"object"===_typeof(m[0])?"label":void 0,optionValue:"object"===_typeof(m[0])?"value":void 0,sx:{width:150,textAlign:"left"}}),React.createElement(STextField,{value:b.fontSize||"",name:"fontSize",onChange:o,inputMode:"numeric",type:"number",sx:{width:150},placeholder:i("size")}),React.createElement(SIconButtonWrapper,{active:(b.fontStyle||"").includes("bold"),onClick:function(){return q("bold")}},React.createElement(FormatBoldOutlined,null)),React.createElement(SIconButtonWrapper,{active:(b.fontStyle||"").includes("italic"),onClick:function(){return q("italic")}},React.createElement(FormatItalicOutlined,null)),d))};export default TextControls;
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { useCallback, useEffect } from 'react';
5
+ import { FormatBoldOutlined, FormatItalicOutlined } from '@mui/icons-material';
6
+ import { TOOLS_IDS, TRANSFORMERS_LAYER_ID } from 'utils/constants';
7
+ import AnnotationOptions from 'components/common/annotation-options';
8
+ import SIconButtonWrapper from 'components/common/icon-wrapper';
9
+ import { ENABLE_TEXT_CONTENT_EDIT } from 'actions';
10
+ import restrictNumber from 'utils/restrict-number';
11
+ import { useStore } from 'hooks';
12
+ import { SFlexBox, SSelect, STextField } from '@solostylist/ui-kit/core';
13
+ import { textOptionsPopupComponents, TEXT_POPPABLE_OPTIONS } from "./text-options.constants";
14
+ import { activateTextChange, deactivateTextChange } from "./handle-text-change-area";
15
+ var TextControls = function TextControls(_ref) {
16
+ var text = _ref.text,
17
+ saveText = _ref.saveText,
18
+ children = _ref.children;
19
+ var _useStore = useStore(),
20
+ dispatch = _useStore.dispatch,
21
+ textIdOfEditableContent = _useStore.textIdOfEditableContent,
22
+ designLayer = _useStore.designLayer,
23
+ t = _useStore.t,
24
+ config = _useStore.config;
25
+ var textConfig = config[TOOLS_IDS.TEXT] || {};
26
+ var _textConfig$fonts = textConfig.fonts,
27
+ fonts = _textConfig$fonts === void 0 ? [] : _textConfig$fonts,
28
+ onFontChange = textConfig.onFontChange;
29
+ var changeTextProps = useCallback(function (e) {
30
+ var _e$target = e.target,
31
+ name = _e$target.name,
32
+ value = _e$target.value,
33
+ type = _e$target.type;
34
+ saveText(function (latestText) {
35
+ return _defineProperty({
36
+ id: latestText.id
37
+ }, name, type === 'number' ? restrictNumber(Number(value), 1, 500) : value);
38
+ });
39
+ }, [saveText]);
40
+ var changeFontFamily = useCallback(function (newFontFamily) {
41
+ changeTextProps({
42
+ target: {
43
+ name: 'fontFamily',
44
+ value: newFontFamily
45
+ }
46
+ });
47
+ if (text.fontFamily !== newFontFamily && typeof onFontChange === 'function') {
48
+ var reRenderCanvasFn = designLayer.draw.bind(designLayer);
49
+ onFontChange(newFontFamily, reRenderCanvasFn);
50
+ }
51
+ }, [changeTextProps, text.fontFamily, onFontChange, designLayer]);
52
+ var changeFontStyle = useCallback(function (newStyle) {
53
+ var _text$fontStyle;
54
+ var fontStyle = ((_text$fontStyle = text.fontStyle) === null || _text$fontStyle === void 0 ? void 0 : _text$fontStyle.replace('normal', '').split(' ')) || [];
55
+ if (Object.keys(fontStyle).length > 0 && fontStyle.includes(newStyle)) {
56
+ fontStyle = fontStyle.filter(function (style) {
57
+ return style !== newStyle;
58
+ });
59
+ } else {
60
+ fontStyle.push(newStyle);
61
+ }
62
+ changeTextProps({
63
+ target: {
64
+ name: 'fontStyle',
65
+ value: fontStyle.join(' ').trim() || 'normal'
66
+ }
67
+ });
68
+ }, [text.fontStyle, changeTextProps]);
69
+ var disableTextEdit = useCallback(function () {
70
+ dispatch({
71
+ type: ENABLE_TEXT_CONTENT_EDIT,
72
+ payload: {
73
+ textIdOfEditableContent: null
74
+ }
75
+ });
76
+ }, []);
77
+ var changeTextContent = useCallback(function (newContent) {
78
+ changeTextProps({
79
+ target: {
80
+ name: 'text',
81
+ value: newContent
82
+ }
83
+ });
84
+ disableTextEdit();
85
+ }, []);
86
+ useEffect(function () {
87
+ var transformer;
88
+ if (textIdOfEditableContent && text.id === textIdOfEditableContent) {
89
+ var canvasStage = designLayer.getStage();
90
+ var transformersLayer = canvasStage.findOne("#".concat(TRANSFORMERS_LAYER_ID));
91
+ if (transformersLayer) {
92
+ var _ref3 = transformersLayer.children || [];
93
+ var _ref4 = _slicedToArray(_ref3, 1);
94
+ transformer = _ref4[0];
95
+ activateTextChange(textIdOfEditableContent, canvasStage, transformer, changeTextContent, disableTextEdit);
96
+ }
97
+ }
98
+ return function () {
99
+ if (transformer && textIdOfEditableContent) deactivateTextChange();
100
+ };
101
+ }, [textIdOfEditableContent]);
102
+ return React.createElement(AnnotationOptions, {
103
+ annotation: text,
104
+ updateAnnotation: saveText,
105
+ morePoppableOptionsPrepended: TEXT_POPPABLE_OPTIONS,
106
+ moreOptionsPopupComponentsObj: textOptionsPopupComponents
107
+ }, React.createElement(SFlexBox, {
108
+ sx: {
109
+ gap: 1,
110
+ alignItems: 'center'
111
+ }
112
+ }, Array.isArray(fonts) && fonts.length > 1 && React.createElement(SSelect, {
113
+ onChange: function onChange(e) {
114
+ return changeFontFamily(e.target.value);
115
+ },
116
+ value: text.fontFamily,
117
+ placeholder: t('fontFamily'),
118
+ options: fonts,
119
+ optionLabel: _typeof(fonts[0]) === 'object' ? 'label' : undefined,
120
+ optionValue: _typeof(fonts[0]) === 'object' ? 'value' : undefined,
121
+ sx: {
122
+ width: 150,
123
+ textAlign: 'left'
124
+ }
125
+ }), React.createElement(STextField, {
126
+ value: text.fontSize || '',
127
+ name: "fontSize",
128
+ onChange: changeTextProps,
129
+ inputMode: "numeric",
130
+ type: "number",
131
+ sx: {
132
+ width: 150
133
+ },
134
+ placeholder: t('size')
135
+ }), React.createElement(SIconButtonWrapper, {
136
+ active: (text.fontStyle || '').includes('bold'),
137
+ onClick: function onClick() {
138
+ return changeFontStyle('bold');
139
+ }
140
+ }, React.createElement(FormatBoldOutlined, null)), React.createElement(SIconButtonWrapper, {
141
+ active: (text.fontStyle || '').includes('italic'),
142
+ onClick: function onClick() {
143
+ return changeFontStyle('italic');
144
+ }
145
+ }, React.createElement(FormatItalicOutlined, null)), children));
146
+ };
147
+ export default TextControls;
@@ -1 +1,16 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import{FormatAlignCenterOutlined,FormatLineSpacingOutlined}from"@mui/icons-material";import TextAlignmentFields from"./text-alignment-fields";import TextSpacingsFields from"./text-spacings-fields";export var TEXT_ALIGNMENT="text-alignment";export var TEXT_SPACINGS="text-spacings";export var TEXT_POPPABLE_OPTIONS=[{titleKey:"textAlignment",name:"text-alignment",Icon:FormatAlignCenterOutlined},{titleKey:"textSpacings",name:"text-spacings",Icon:FormatLineSpacingOutlined}];export var textOptionsPopupComponents=_defineProperty(_defineProperty({},"text-alignment",TextAlignmentFields),"text-spacings",TextSpacingsFields);
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { FormatAlignCenterOutlined, FormatLineSpacingOutlined } from '@mui/icons-material';
3
+ import TextAlignmentFields from "./text-alignment-fields";
4
+ import TextSpacingsFields from "./text-spacings-fields";
5
+ export var TEXT_ALIGNMENT = 'text-alignment';
6
+ export var TEXT_SPACINGS = 'text-spacings';
7
+ export var TEXT_POPPABLE_OPTIONS = [{
8
+ titleKey: 'textAlignment',
9
+ name: TEXT_ALIGNMENT,
10
+ Icon: FormatAlignCenterOutlined
11
+ }, {
12
+ titleKey: 'textSpacings',
13
+ name: TEXT_SPACINGS,
14
+ Icon: FormatLineSpacingOutlined
15
+ }];
16
+ export var textOptionsPopupComponents = _defineProperty(_defineProperty({}, TEXT_ALIGNMENT, TextAlignmentFields), TEXT_SPACINGS, TextSpacingsFields);
@@ -1 +1,34 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import Slider from"components/common/slider";import restrictNumber from"utils/restrict-number";var MIN_VALUE=0,MAX_VALUE=100,SLIDER_STEP=1,TextSpacingsFields=function(a){var b=a.annotation,c=a.updateAnnotation,d=a.t,e=b.letterSpacing,f=b.lineHeight,g=function(a,b){c(_defineProperty({},a,restrictNumber(b,MIN_VALUE,MAX_VALUE)))};return React.createElement(React.Fragment,null,React.createElement(Slider,{annotation:"px",label:d("letterSpacing"),onChange:function(a){return g("letterSpacing",a)},value:e,step:SLIDER_STEP}),React.createElement(Slider,{annotation:"px",label:d("lineHeight"),onChange:function(a){return g("lineHeight",a)},value:f,step:SLIDER_STEP}))};export default TextSpacingsFields;
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import Slider from 'components/common/slider';
3
+ import restrictNumber from 'utils/restrict-number';
4
+ var MIN_VALUE = 0;
5
+ var MAX_VALUE = 100;
6
+ var SLIDER_STEP = 1;
7
+ var TextSpacingsFields = function TextSpacingsFields(_ref) {
8
+ var text = _ref.annotation,
9
+ updateText = _ref.updateAnnotation,
10
+ t = _ref.t;
11
+ var letterSpacing = text.letterSpacing,
12
+ lineHeight = text.lineHeight;
13
+ var updateValue = function updateValue(prop, val) {
14
+ updateText(_defineProperty({}, prop, restrictNumber(val, MIN_VALUE, MAX_VALUE)));
15
+ };
16
+ return React.createElement(React.Fragment, null, React.createElement(Slider, {
17
+ annotation: "px",
18
+ label: t('letterSpacing'),
19
+ onChange: function onChange(val) {
20
+ return updateValue('letterSpacing', val);
21
+ },
22
+ value: letterSpacing,
23
+ step: SLIDER_STEP
24
+ }), React.createElement(Slider, {
25
+ annotation: "px",
26
+ label: t('lineHeight'),
27
+ onChange: function onChange(val) {
28
+ return updateValue('lineHeight', val);
29
+ },
30
+ value: lineHeight,
31
+ step: SLIDER_STEP
32
+ }));
33
+ };
34
+ export default TextSpacingsFields;
@@ -1 +1,98 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";var _TOOLS_ITEMS;import{TABS_IDS,TOOLS_IDS}from"utils/constants";import{ArrowButton,ArrowOptions}from"./arrow";import{Blur,BlurOptions}from"./blur";import{Brightness,BrightnessOptions}from"./brightness";import{Contrast,ContrastOptions}from"./contrast";import{Crop}from"./crop";import{EllipseButton,EllipseOptions}from"./ellipse";import{Filters}from"./filters";import{FlipX,FlipY}from"./flip";import{HSV,HSVOptions}from"./hsv";import{ImageButton,ImageOptions}from"./image";import{LineButton,LineOptions}from"./line";import{PenButton,PenOptions}from"./pen";import{PolygonButton,PolygonOptions}from"./polygon";import{RectButton,RectOptions}from"./rect";import{Resize}from"./resize";import{RotateButton,RotateOptions}from"./rotate";import{TextButton,TextOptions}from"./text";import{Warmth,WarmthOptions}from"./warmth";import{Watermark}from"./watermark";export var TOOLS_ITEMS=(_TOOLS_ITEMS={},_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOOLS_ITEMS,TOOLS_IDS.CROP,{id:TOOLS_IDS.CROP,Item:Crop}),TOOLS_IDS.ROTATE,{id:TOOLS_IDS.ROTATE,Item:RotateButton,ItemOptions:RotateOptions}),TOOLS_IDS.FLIP_X,{id:TOOLS_IDS.FLIP_X,Item:FlipX}),TOOLS_IDS.FLIP_Y,{id:TOOLS_IDS.FLIP_Y,Item:FlipY}),TOOLS_IDS.BRIGHTNESS,{id:TOOLS_IDS.BRIGHTNESS,Item:Brightness,ItemOptions:BrightnessOptions}),TOOLS_IDS.CONTRAST,{id:TOOLS_IDS.CONTRAST,Item:Contrast,ItemOptions:ContrastOptions}),TOOLS_IDS.HSV,{id:TOOLS_IDS.HSV,Item:HSV,ItemOptions:HSVOptions}),TOOLS_IDS.BLUR,{id:TOOLS_IDS.BLUR,Item:Blur,ItemOptions:BlurOptions}),TOOLS_IDS.WARMTH,{id:TOOLS_IDS.WARMTH,Item:Warmth,ItemOptions:WarmthOptions}),TOOLS_IDS.FILTERS,{id:TOOLS_IDS.FILTERS,Item:Filters}),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOOLS_ITEMS,TOOLS_IDS.WATERMARK,{id:TOOLS_IDS.WATERMARK,Item:Watermark}),TOOLS_IDS.TEXT,{id:TOOLS_IDS.TEXT,Item:TextButton,ItemOptions:TextOptions}),TOOLS_IDS.IMAGE,{id:TOOLS_IDS.IMAGE,Item:ImageButton,ItemOptions:ImageOptions}),TOOLS_IDS.RECT,{id:TOOLS_IDS.RECT,Item:RectButton,ItemOptions:RectOptions}),TOOLS_IDS.POLYGON,{id:TOOLS_IDS.POLYGON,Item:PolygonButton,ItemOptions:PolygonOptions}),TOOLS_IDS.ELLIPSE,{id:TOOLS_IDS.ELLIPSE,Item:EllipseButton,ItemOptions:EllipseOptions}),TOOLS_IDS.PEN,{id:TOOLS_IDS.PEN,Item:PenButton,ItemOptions:PenOptions}),TOOLS_IDS.LINE,{id:TOOLS_IDS.LINE,Item:LineButton,ItemOptions:LineOptions}),TOOLS_IDS.ARROW,{id:TOOLS_IDS.ARROW,Item:ArrowButton,ItemOptions:ArrowOptions}),TOOLS_IDS.RESIZE,{id:TOOLS_IDS.RESIZE,Item:Resize}));export var TABS_TOOLS=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},TABS_IDS.ADJUST,[TOOLS_IDS.CROP,TOOLS_IDS.ROTATE,TOOLS_IDS.FLIP_X,TOOLS_IDS.FLIP_Y]),TABS_IDS.FINETUNE,[TOOLS_IDS.BRIGHTNESS,TOOLS_IDS.CONTRAST,TOOLS_IDS.HSV,TOOLS_IDS.BLUR,TOOLS_IDS.WARMTH]),TABS_IDS.FILTERS,[TOOLS_IDS.FILTERS]),TABS_IDS.WATERMARK,[TOOLS_IDS.WATERMARK]),TABS_IDS.ANNOTATE,[TOOLS_IDS.TEXT,TOOLS_IDS.IMAGE,TOOLS_IDS.RECT,TOOLS_IDS.ELLIPSE,TOOLS_IDS.POLYGON,TOOLS_IDS.PEN,TOOLS_IDS.LINE,TOOLS_IDS.ARROW]),TABS_IDS.RESIZE,[TOOLS_IDS.RESIZE]);
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ var _TOOLS_ITEMS;
3
+ import { TABS_IDS, TOOLS_IDS } from 'utils/constants';
4
+ import { ArrowButton, ArrowOptions } from "./arrow";
5
+ import { Blur, BlurOptions } from "./blur";
6
+ import { Brightness, BrightnessOptions } from "./brightness";
7
+ import { Contrast, ContrastOptions } from "./contrast";
8
+ import { Crop } from "./crop";
9
+ import { EllipseButton, EllipseOptions } from "./ellipse";
10
+ import { Filters } from "./filters";
11
+ import { FlipX, FlipY } from "./flip";
12
+ import { HSV, HSVOptions } from "./hsv";
13
+ import { ImageButton, ImageOptions } from "./image";
14
+ import { LineButton, LineOptions } from "./line";
15
+ import { PenButton, PenOptions } from "./pen";
16
+ import { PolygonButton, PolygonOptions } from "./polygon";
17
+ import { RectButton, RectOptions } from "./rect";
18
+ import { Resize } from "./resize";
19
+ import { RotateButton, RotateOptions } from "./rotate";
20
+ import { TextButton, TextOptions } from "./text";
21
+ import { Warmth, WarmthOptions } from "./warmth";
22
+ import { Watermark } from "./watermark";
23
+ export var TOOLS_ITEMS = (_TOOLS_ITEMS = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOOLS_ITEMS, TOOLS_IDS.CROP, {
24
+ id: TOOLS_IDS.CROP,
25
+ Item: Crop
26
+ }), TOOLS_IDS.ROTATE, {
27
+ id: TOOLS_IDS.ROTATE,
28
+ Item: RotateButton,
29
+ ItemOptions: RotateOptions
30
+ }), TOOLS_IDS.FLIP_X, {
31
+ id: TOOLS_IDS.FLIP_X,
32
+ Item: FlipX
33
+ }), TOOLS_IDS.FLIP_Y, {
34
+ id: TOOLS_IDS.FLIP_Y,
35
+ Item: FlipY
36
+ }), TOOLS_IDS.BRIGHTNESS, {
37
+ id: TOOLS_IDS.BRIGHTNESS,
38
+ Item: Brightness,
39
+ ItemOptions: BrightnessOptions
40
+ }), TOOLS_IDS.CONTRAST, {
41
+ id: TOOLS_IDS.CONTRAST,
42
+ Item: Contrast,
43
+ ItemOptions: ContrastOptions
44
+ }), TOOLS_IDS.HSV, {
45
+ id: TOOLS_IDS.HSV,
46
+ Item: HSV,
47
+ ItemOptions: HSVOptions
48
+ }), TOOLS_IDS.BLUR, {
49
+ id: TOOLS_IDS.BLUR,
50
+ Item: Blur,
51
+ ItemOptions: BlurOptions
52
+ }), TOOLS_IDS.WARMTH, {
53
+ id: TOOLS_IDS.WARMTH,
54
+ Item: Warmth,
55
+ ItemOptions: WarmthOptions
56
+ }), TOOLS_IDS.FILTERS, {
57
+ id: TOOLS_IDS.FILTERS,
58
+ Item: Filters
59
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOOLS_ITEMS, TOOLS_IDS.WATERMARK, {
60
+ id: TOOLS_IDS.WATERMARK,
61
+ Item: Watermark
62
+ }), TOOLS_IDS.TEXT, {
63
+ id: TOOLS_IDS.TEXT,
64
+ Item: TextButton,
65
+ ItemOptions: TextOptions
66
+ }), TOOLS_IDS.IMAGE, {
67
+ id: TOOLS_IDS.IMAGE,
68
+ Item: ImageButton,
69
+ ItemOptions: ImageOptions
70
+ }), TOOLS_IDS.RECT, {
71
+ id: TOOLS_IDS.RECT,
72
+ Item: RectButton,
73
+ ItemOptions: RectOptions
74
+ }), TOOLS_IDS.POLYGON, {
75
+ id: TOOLS_IDS.POLYGON,
76
+ Item: PolygonButton,
77
+ ItemOptions: PolygonOptions
78
+ }), TOOLS_IDS.ELLIPSE, {
79
+ id: TOOLS_IDS.ELLIPSE,
80
+ Item: EllipseButton,
81
+ ItemOptions: EllipseOptions
82
+ }), TOOLS_IDS.PEN, {
83
+ id: TOOLS_IDS.PEN,
84
+ Item: PenButton,
85
+ ItemOptions: PenOptions
86
+ }), TOOLS_IDS.LINE, {
87
+ id: TOOLS_IDS.LINE,
88
+ Item: LineButton,
89
+ ItemOptions: LineOptions
90
+ }), TOOLS_IDS.ARROW, {
91
+ id: TOOLS_IDS.ARROW,
92
+ Item: ArrowButton,
93
+ ItemOptions: ArrowOptions
94
+ }), TOOLS_IDS.RESIZE, {
95
+ id: TOOLS_IDS.RESIZE,
96
+ Item: Resize
97
+ }));
98
+ export var TABS_TOOLS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TABS_IDS.ADJUST, [TOOLS_IDS.CROP, TOOLS_IDS.ROTATE, TOOLS_IDS.FLIP_X, TOOLS_IDS.FLIP_Y]), TABS_IDS.FINETUNE, [TOOLS_IDS.BRIGHTNESS, TOOLS_IDS.CONTRAST, TOOLS_IDS.HSV, TOOLS_IDS.BLUR, TOOLS_IDS.WARMTH]), TABS_IDS.FILTERS, [TOOLS_IDS.FILTERS]), TABS_IDS.WATERMARK, [TOOLS_IDS.WATERMARK]), TABS_IDS.ANNOTATE, [TOOLS_IDS.TEXT, TOOLS_IDS.IMAGE, TOOLS_IDS.RECT, TOOLS_IDS.ELLIPSE, TOOLS_IDS.POLYGON, TOOLS_IDS.PEN, TOOLS_IDS.LINE, TOOLS_IDS.ARROW]), TABS_IDS.RESIZE, [TOOLS_IDS.RESIZE]);
@@ -1 +1,2 @@
1
- export{default as Warmth}from"./warmth";export{default as WarmthOptions}from"./warmth-options";
1
+ export { default as Warmth } from "./warmth";
2
+ export { default as WarmthOptions } from "./warmth-options";