@wordpress/media-editor 0.21.0 → 0.22.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 (339) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/components/media-editor/index.cjs +533 -686
  3. package/build/components/media-editor/index.cjs.map +1 -7
  4. package/build/components/media-editor/use-crop-options.cjs +43 -57
  5. package/build/components/media-editor/use-crop-options.cjs.map +1 -7
  6. package/build/components/media-editor/use-save-media-editor.cjs +111 -185
  7. package/build/components/media-editor/use-save-media-editor.cjs.map +1 -7
  8. package/build/components/media-editor-canvas/index.cjs +122 -124
  9. package/build/components/media-editor-canvas/index.cjs.map +1 -7
  10. package/build/components/media-editor-crop-panel/index.cjs +65 -72
  11. package/build/components/media-editor-crop-panel/index.cjs.map +1 -7
  12. package/build/components/media-editor-fine-rotation/index.cjs +62 -72
  13. package/build/components/media-editor-fine-rotation/index.cjs.map +1 -7
  14. package/build/components/media-editor-image-controls/index.cjs +183 -257
  15. package/build/components/media-editor-image-controls/index.cjs.map +1 -7
  16. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +119 -157
  17. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -7
  18. package/build/components/media-editor-modal/build-modifiers.cjs +107 -88
  19. package/build/components/media-editor-modal/build-modifiers.cjs.map +1 -7
  20. package/build/components/media-editor-modal/index.cjs +112 -155
  21. package/build/components/media-editor-modal/index.cjs.map +1 -7
  22. package/build/components/media-editor-provider/index.cjs +32 -55
  23. package/build/components/media-editor-provider/index.cjs.map +1 -7
  24. package/build/components/media-form/index.cjs +76 -77
  25. package/build/components/media-form/index.cjs.map +1 -7
  26. package/build/components/media-preview/index.cjs +114 -114
  27. package/build/components/media-preview/index.cjs.map +1 -7
  28. package/build/components/rotation-ruler/index.cjs +181 -188
  29. package/build/components/rotation-ruler/index.cjs.map +1 -7
  30. package/build/components/rotation-ruler/use-ruler-drag.cjs +132 -149
  31. package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -7
  32. package/build/hooks/use-crop-gesture-handlers.cjs +82 -76
  33. package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -7
  34. package/build/image-editor/core/camera.cjs +257 -205
  35. package/build/image-editor/core/camera.cjs.map +1 -7
  36. package/build/image-editor/core/constants.cjs +127 -102
  37. package/build/image-editor/core/constants.cjs.map +1 -7
  38. package/build/image-editor/core/containment.cjs +275 -262
  39. package/build/image-editor/core/containment.cjs.map +1 -7
  40. package/build/image-editor/core/crop-rect.cjs +33 -44
  41. package/build/image-editor/core/crop-rect.cjs.map +1 -7
  42. package/build/image-editor/core/export/canvas-renderer.cjs +165 -135
  43. package/build/image-editor/core/export/canvas-renderer.cjs.map +1 -7
  44. package/build/image-editor/core/index.cjs +88 -61
  45. package/build/image-editor/core/interaction-controller.cjs +583 -646
  46. package/build/image-editor/core/interaction-controller.cjs.map +1 -7
  47. package/build/image-editor/core/math/rotation.cjs +26 -35
  48. package/build/image-editor/core/math/rotation.cjs.map +1 -7
  49. package/build/image-editor/core/math/sanitize.cjs +124 -80
  50. package/build/image-editor/core/math/sanitize.cjs.map +1 -7
  51. package/build/image-editor/core/setter-helpers.cjs +57 -60
  52. package/build/image-editor/core/setter-helpers.cjs.map +1 -7
  53. package/build/image-editor/core/source-region.cjs +220 -190
  54. package/build/image-editor/core/source-region.cjs.map +1 -7
  55. package/build/image-editor/core/state.cjs +278 -265
  56. package/build/image-editor/core/state.cjs.map +1 -7
  57. package/build/image-editor/core/stencil-math.cjs +193 -206
  58. package/build/image-editor/core/stencil-math.cjs.map +1 -7
  59. package/build/image-editor/core/transform-style.cjs +39 -48
  60. package/build/image-editor/core/transform-style.cjs.map +1 -7
  61. package/build/image-editor/core/transforms/pipeline.cjs +36 -38
  62. package/build/image-editor/core/transforms/pipeline.cjs.map +1 -7
  63. package/build/image-editor/core/types.cjs +4 -18
  64. package/build/image-editor/core/viewport-state.cjs +31 -45
  65. package/build/image-editor/core/viewport-state.cjs.map +1 -7
  66. package/build/image-editor/index.cjs +65 -64
  67. package/build/image-editor/react/components/cropper-provider.cjs +44 -45
  68. package/build/image-editor/react/components/cropper-provider.cjs.map +1 -7
  69. package/build/image-editor/react/components/cropper.cjs +583 -710
  70. package/build/image-editor/react/components/cropper.cjs.map +1 -7
  71. package/build/image-editor/react/components/index.cjs +22 -33
  72. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +135 -160
  73. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +1 -7
  74. package/build/image-editor/react/components/overlays/dimming-overlay.cjs +28 -59
  75. package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +1 -7
  76. package/build/image-editor/react/components/overlays/grid-overlay.cjs +58 -88
  77. package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +1 -7
  78. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +361 -420
  79. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +1 -7
  80. package/build/image-editor/react/components/viewport-provider.cjs +21 -46
  81. package/build/image-editor/react/components/viewport-provider.cjs.map +1 -7
  82. package/build/image-editor/react/hooks/build-cropper-setters.cjs +76 -67
  83. package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +1 -7
  84. package/build/image-editor/react/hooks/index.cjs +16 -31
  85. package/build/image-editor/react/hooks/use-aria-announcer.cjs +90 -146
  86. package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +1 -7
  87. package/build/image-editor/react/hooks/use-cropper-controller.cjs +80 -0
  88. package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +1 -0
  89. package/build/image-editor/react/hooks/use-interaction.cjs +179 -205
  90. package/build/image-editor/react/hooks/use-interaction.cjs.map +1 -7
  91. package/build/image-editor/react/hooks/use-transform-style.cjs +20 -34
  92. package/build/image-editor/react/hooks/use-transform-style.cjs.map +1 -7
  93. package/build/image-editor/react/hooks/use-viewport-state.cjs +36 -47
  94. package/build/image-editor/react/hooks/use-viewport-state.cjs.map +1 -7
  95. package/build/image-editor/react/visually-hidden-style.cjs +21 -38
  96. package/build/image-editor/react/visually-hidden-style.cjs.map +1 -7
  97. package/build/index.cjs +45 -39
  98. package/build/lock-unlock.cjs +9 -35
  99. package/build/lock-unlock.cjs.map +1 -7
  100. package/build/private-apis.cjs +16 -37
  101. package/build/private-apis.cjs.map +1 -7
  102. package/build/state/aspect-ratio-presets.cjs +53 -0
  103. package/build/state/aspect-ratio-presets.cjs.map +1 -0
  104. package/build/state/composite-reducer.cjs +134 -112
  105. package/build/state/composite-reducer.cjs.map +1 -7
  106. package/build/state/index.cjs +63 -47
  107. package/build/state/media-editor-state-provider.cjs +35 -48
  108. package/build/state/media-editor-state-provider.cjs.map +1 -7
  109. package/build/state/types.cjs +12 -31
  110. package/build/state/types.cjs.map +1 -7
  111. package/build/state/use-media-editor-state.cjs +261 -294
  112. package/build/state/use-media-editor-state.cjs.map +1 -7
  113. package/build/store/actions.cjs +17 -44
  114. package/build/store/actions.cjs.map +1 -7
  115. package/build/store/constants.cjs +8 -29
  116. package/build/store/constants.cjs.map +1 -7
  117. package/build/store/index.cjs +33 -40
  118. package/build/store/index.cjs.map +1 -7
  119. package/build/store/reducer.cjs +28 -50
  120. package/build/store/reducer.cjs.map +1 -7
  121. package/build/store/selectors.cjs +16 -41
  122. package/build/store/selectors.cjs.map +1 -7
  123. package/build/utils/get-media-type.cjs +18 -41
  124. package/build/utils/get-media-type.cjs.map +1 -7
  125. package/build/utils/index.cjs +9 -28
  126. package/build-module/components/media-editor/index.mjs +490 -673
  127. package/build-module/components/media-editor/index.mjs.map +1 -7
  128. package/build-module/components/media-editor/use-crop-options.mjs +38 -32
  129. package/build-module/components/media-editor/use-crop-options.mjs.map +1 -7
  130. package/build-module/components/media-editor/use-save-media-editor.mjs +89 -157
  131. package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -7
  132. package/build-module/components/media-editor-canvas/index.mjs +98 -96
  133. package/build-module/components/media-editor-canvas/index.mjs.map +1 -7
  134. package/build-module/components/media-editor-crop-panel/index.mjs +43 -46
  135. package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -7
  136. package/build-module/components/media-editor-fine-rotation/index.mjs +39 -45
  137. package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -7
  138. package/build-module/components/media-editor-image-controls/index.mjs +172 -237
  139. package/build-module/components/media-editor-image-controls/index.mjs.map +1 -7
  140. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +112 -137
  141. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -7
  142. package/build-module/components/media-editor-modal/build-modifiers.mjs +103 -64
  143. package/build-module/components/media-editor-modal/build-modifiers.mjs.map +1 -7
  144. package/build-module/components/media-editor-modal/index.mjs +88 -124
  145. package/build-module/components/media-editor-modal/index.mjs.map +1 -7
  146. package/build-module/components/media-editor-provider/index.mjs +26 -29
  147. package/build-module/components/media-editor-provider/index.mjs.map +1 -7
  148. package/build-module/components/media-form/index.mjs +68 -56
  149. package/build-module/components/media-form/index.mjs.map +1 -7
  150. package/build-module/components/media-preview/index.mjs +106 -90
  151. package/build-module/components/media-preview/index.mjs.map +1 -7
  152. package/build-module/components/rotation-ruler/index.mjs +161 -164
  153. package/build-module/components/rotation-ruler/index.mjs.map +1 -7
  154. package/build-module/components/rotation-ruler/use-ruler-drag.mjs +125 -122
  155. package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +1 -7
  156. package/build-module/hooks/use-crop-gesture-handlers.mjs +76 -50
  157. package/build-module/hooks/use-crop-gesture-handlers.mjs.map +1 -7
  158. package/build-module/image-editor/core/camera.mjs +245 -178
  159. package/build-module/image-editor/core/camera.mjs.map +1 -7
  160. package/build-module/image-editor/core/constants.mjs +110 -64
  161. package/build-module/image-editor/core/constants.mjs.map +1 -7
  162. package/build-module/image-editor/core/containment.mjs +265 -237
  163. package/build-module/image-editor/core/containment.mjs.map +1 -7
  164. package/build-module/image-editor/core/crop-rect.mjs +29 -20
  165. package/build-module/image-editor/core/crop-rect.mjs.map +1 -7
  166. package/build-module/image-editor/core/export/canvas-renderer.mjs +155 -105
  167. package/build-module/image-editor/core/export/canvas-renderer.mjs.map +1 -7
  168. package/build-module/image-editor/core/index.mjs +5 -34
  169. package/build-module/image-editor/core/interaction-controller.mjs +579 -628
  170. package/build-module/image-editor/core/interaction-controller.mjs.map +1 -7
  171. package/build-module/image-editor/core/math/rotation.mjs +21 -10
  172. package/build-module/image-editor/core/math/rotation.mjs.map +1 -7
  173. package/build-module/image-editor/core/math/sanitize.mjs +116 -52
  174. package/build-module/image-editor/core/math/sanitize.mjs.map +1 -7
  175. package/build-module/image-editor/core/setter-helpers.mjs +52 -35
  176. package/build-module/image-editor/core/setter-helpers.mjs.map +1 -7
  177. package/build-module/image-editor/core/source-region.mjs +210 -160
  178. package/build-module/image-editor/core/source-region.mjs.map +1 -7
  179. package/build-module/image-editor/core/state.mjs +271 -243
  180. package/build-module/image-editor/core/state.mjs.map +1 -7
  181. package/build-module/image-editor/core/stencil-math.mjs +185 -178
  182. package/build-module/image-editor/core/stencil-math.mjs.map +1 -7
  183. package/build-module/image-editor/core/transform-style.mjs +34 -23
  184. package/build-module/image-editor/core/transform-style.mjs.map +1 -7
  185. package/build-module/image-editor/core/transforms/pipeline.mjs +29 -11
  186. package/build-module/image-editor/core/transforms/pipeline.mjs.map +1 -7
  187. package/build-module/image-editor/core/types.mjs +0 -1
  188. package/build-module/image-editor/core/viewport-state.mjs +26 -20
  189. package/build-module/image-editor/core/viewport-state.mjs.map +1 -7
  190. package/build-module/image-editor/index.mjs +3 -38
  191. package/build-module/image-editor/react/components/cropper-provider.mjs +38 -21
  192. package/build-module/image-editor/react/components/cropper-provider.mjs.map +1 -7
  193. package/build-module/image-editor/react/components/cropper.mjs +550 -686
  194. package/build-module/image-editor/react/components/cropper.mjs.map +1 -7
  195. package/build-module/image-editor/react/components/index.mjs +1 -7
  196. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +130 -135
  197. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +1 -7
  198. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +24 -35
  199. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +1 -7
  200. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +54 -64
  201. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +1 -7
  202. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +355 -407
  203. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +1 -7
  204. package/build-module/image-editor/react/components/viewport-provider.mjs +15 -22
  205. package/build-module/image-editor/react/components/viewport-provider.mjs.map +1 -7
  206. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +72 -43
  207. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +1 -7
  208. package/build-module/image-editor/react/hooks/index.mjs +2 -7
  209. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +83 -119
  210. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +1 -7
  211. package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +75 -0
  212. package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +1 -0
  213. package/build-module/image-editor/react/hooks/use-interaction.mjs +175 -183
  214. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +1 -7
  215. package/build-module/image-editor/react/hooks/use-transform-style.mjs +15 -9
  216. package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +1 -7
  217. package/build-module/image-editor/react/hooks/use-viewport-state.mjs +32 -26
  218. package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +1 -7
  219. package/build-module/image-editor/react/visually-hidden-style.mjs +17 -14
  220. package/build-module/image-editor/react/visually-hidden-style.mjs.map +1 -7
  221. package/build-module/index.mjs +3 -10
  222. package/build-module/lock-unlock.mjs +5 -10
  223. package/build-module/lock-unlock.mjs.map +1 -7
  224. package/build-module/private-apis.mjs +8 -9
  225. package/build-module/private-apis.mjs.map +1 -7
  226. package/build-module/state/aspect-ratio-presets.mjs +48 -0
  227. package/build-module/state/aspect-ratio-presets.mjs.map +1 -0
  228. package/build-module/state/composite-reducer.mjs +114 -90
  229. package/build-module/state/composite-reducer.mjs.map +1 -7
  230. package/build-module/state/index.mjs +5 -25
  231. package/build-module/state/media-editor-state-provider.mjs +29 -24
  232. package/build-module/state/media-editor-state-provider.mjs.map +1 -7
  233. package/build-module/state/types.mjs +8 -7
  234. package/build-module/state/types.mjs.map +1 -7
  235. package/build-module/state/use-media-editor-state.mjs +256 -286
  236. package/build-module/state/use-media-editor-state.mjs.map +1 -7
  237. package/build-module/store/actions.mjs +12 -19
  238. package/build-module/store/actions.mjs.map +1 -7
  239. package/build-module/store/constants.mjs +4 -5
  240. package/build-module/store/constants.mjs.map +1 -7
  241. package/build-module/store/index.mjs +8 -9
  242. package/build-module/store/index.mjs.map +1 -7
  243. package/build-module/store/reducer.mjs +23 -26
  244. package/build-module/store/reducer.mjs.map +1 -7
  245. package/build-module/store/selectors.mjs +8 -13
  246. package/build-module/store/selectors.mjs.map +1 -7
  247. package/build-module/utils/get-media-type.mjs +14 -17
  248. package/build-module/utils/get-media-type.mjs.map +1 -7
  249. package/build-module/utils/index.mjs +1 -6
  250. package/build-style/style-rtl.css +41 -4
  251. package/build-style/style.css +41 -4
  252. package/build-types/components/media-editor/index.d.ts +4 -0
  253. package/build-types/components/media-editor/index.d.ts.map +1 -1
  254. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
  255. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
  256. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  257. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
  258. package/build-types/components/media-editor-modal/build-modifiers.d.ts +6 -5
  259. package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -1
  260. package/build-types/components/media-preview/index.d.ts.map +1 -1
  261. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
  262. package/build-types/image-editor/core/constants.d.ts +0 -1
  263. package/build-types/image-editor/core/constants.d.ts.map +1 -1
  264. package/build-types/image-editor/core/index.d.ts +1 -1
  265. package/build-types/image-editor/core/index.d.ts.map +1 -1
  266. package/build-types/image-editor/core/setter-helpers.d.ts +1 -1
  267. package/build-types/image-editor/core/types.d.ts +1 -1
  268. package/build-types/image-editor/index.d.ts +7 -6
  269. package/build-types/image-editor/index.d.ts.map +1 -1
  270. package/build-types/image-editor/react/components/cropper-provider.d.ts +2 -2
  271. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
  272. package/build-types/image-editor/react/components/cropper.d.ts +5 -14
  273. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  274. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +2 -2
  275. package/build-types/image-editor/react/hooks/index.d.ts +2 -2
  276. package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
  277. package/build-types/image-editor/react/hooks/{use-cropper-reducer.d.ts → use-cropper-controller.d.ts} +12 -12
  278. package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts.map +1 -0
  279. package/build-types/state/aspect-ratio-presets.d.ts +7 -0
  280. package/build-types/state/aspect-ratio-presets.d.ts.map +1 -0
  281. package/build-types/state/composite-reducer.d.ts +1 -1
  282. package/build-types/state/composite-reducer.d.ts.map +1 -1
  283. package/build-types/state/index.d.ts +1 -0
  284. package/build-types/state/index.d.ts.map +1 -1
  285. package/build-types/state/types.d.ts +2 -1
  286. package/build-types/state/types.d.ts.map +1 -1
  287. package/build-types/state/use-media-editor-state.d.ts.map +1 -1
  288. package/package.json +21 -21
  289. package/src/components/media-editor/index.tsx +215 -162
  290. package/src/components/media-editor/style.scss +19 -0
  291. package/src/components/media-editor/use-crop-options.ts +5 -2
  292. package/src/components/media-editor/use-save-media-editor.ts +2 -6
  293. package/src/components/media-editor-canvas/index.tsx +16 -26
  294. package/src/components/media-editor-image-controls/index.tsx +4 -2
  295. package/src/components/media-editor-modal/build-modifiers.ts +13 -7
  296. package/src/components/media-editor-modal/style.scss +1 -1
  297. package/src/components/media-preview/index.tsx +66 -23
  298. package/src/components/media-preview/style.scss +16 -2
  299. package/src/components/rotation-ruler/style.scss +6 -2
  300. package/src/components/rotation-ruler/use-ruler-drag.ts +6 -11
  301. package/src/image-editor/README.md +8 -8
  302. package/src/image-editor/core/constants.ts +0 -13
  303. package/src/image-editor/core/index.ts +1 -5
  304. package/src/image-editor/core/setter-helpers.ts +1 -1
  305. package/src/image-editor/core/types.ts +1 -1
  306. package/src/image-editor/docs/architecture.md +1 -1
  307. package/src/image-editor/docs/recipes.md +3 -3
  308. package/src/image-editor/index.ts +7 -16
  309. package/src/image-editor/react/components/cropper-provider.tsx +5 -5
  310. package/src/image-editor/react/components/cropper.tsx +19 -27
  311. package/src/image-editor/react/hooks/build-cropper-setters.ts +2 -2
  312. package/src/image-editor/react/hooks/index.ts +2 -2
  313. package/src/image-editor/react/hooks/{use-cropper-reducer.ts → use-cropper-controller.ts} +11 -11
  314. package/src/state/aspect-ratio-presets.ts +18 -0
  315. package/src/state/composite-reducer.ts +2 -2
  316. package/src/state/index.ts +1 -0
  317. package/src/state/types.ts +2 -6
  318. package/src/state/use-media-editor-state.ts +7 -5
  319. package/build/image-editor/core/index.cjs.map +0 -7
  320. package/build/image-editor/core/types.cjs.map +0 -7
  321. package/build/image-editor/index.cjs.map +0 -7
  322. package/build/image-editor/react/components/index.cjs.map +0 -7
  323. package/build/image-editor/react/hooks/index.cjs.map +0 -7
  324. package/build/image-editor/react/hooks/use-cropper-reducer.cjs +0 -113
  325. package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +0 -7
  326. package/build/index.cjs.map +0 -7
  327. package/build/state/index.cjs.map +0 -7
  328. package/build/utils/index.cjs.map +0 -7
  329. package/build-module/image-editor/core/index.mjs.map +0 -7
  330. package/build-module/image-editor/core/types.mjs.map +0 -7
  331. package/build-module/image-editor/index.mjs.map +0 -7
  332. package/build-module/image-editor/react/components/index.mjs.map +0 -7
  333. package/build-module/image-editor/react/hooks/index.mjs.map +0 -7
  334. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +0 -100
  335. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +0 -7
  336. package/build-module/index.mjs.map +0 -7
  337. package/build-module/state/index.mjs.map +0 -7
  338. package/build-module/utils/index.mjs.map +0 -7
  339. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +0 -1
@@ -1,283 +1,296 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/media-editor/src/image-editor/core/state.ts
21
- var state_exports = {};
22
- __export(state_exports, {
23
- areCropperStatesEqual: () => areCropperStatesEqual,
24
- cropperReducer: () => cropperReducer,
25
- enforceContainment: () => enforceContainment,
26
- isStateDirty: () => isStateDirty
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
27
5
  });
28
- module.exports = __toCommonJS(state_exports);
29
- var import_constants = require("./constants.cjs");
30
- var import_rotation = require("./math/rotation.cjs");
31
- var import_containment = require("./containment.cjs");
32
- var STATE_EPSILON = 1e-6;
6
+ let __constants_ts = require("./constants.cjs");
7
+ let __math_rotation_ts = require("./math/rotation.cjs");
8
+ let __containment_ts = require("./containment.cjs");
9
+ // packages/media-editor/src/image-editor/core/state.ts
10
+ /** Small tolerance for cropper floating-point comparisons. */
11
+ const STATE_EPSILON = 1e-6;
33
12
  function nearlyEqual(a, b) {
34
- return Math.abs(a - b) < STATE_EPSILON;
13
+ return Math.abs(a - b) < STATE_EPSILON;
35
14
  }
15
+ /**
16
+ * Value-equality check for two cropper states.
17
+ *
18
+ * Used by history machinery to dedup snapshots and detect no-op
19
+ * transitions. Compares every field that participates in the rendered
20
+ * output; ignores reference identity.
21
+ *
22
+ * @param a First cropper state.
23
+ * @param b Second cropper state.
24
+ * @return Whether the two states are value-equal across all tracked fields.
25
+ */
36
26
  function areCropperStatesEqual(a, b) {
37
- const aImage = a.image;
38
- const bImage = b.image;
39
- return aImage?.src === bImage?.src && aImage?.naturalWidth === bImage?.naturalWidth && aImage?.naturalHeight === bImage?.naturalHeight && nearlyEqual(a.pan.x, b.pan.x) && nearlyEqual(a.pan.y, b.pan.y) && nearlyEqual(a.zoom, b.zoom) && nearlyEqual(a.rotation, b.rotation) && a.flip.horizontal === b.flip.horizontal && a.flip.vertical === b.flip.vertical && nearlyEqual(a.cropRect.x, b.cropRect.x) && nearlyEqual(a.cropRect.y, b.cropRect.y) && nearlyEqual(a.cropRect.width, b.cropRect.width) && nearlyEqual(a.cropRect.height, b.cropRect.height);
27
+ const aImage = a.image;
28
+ const bImage = b.image;
29
+ return aImage?.src === bImage?.src && aImage?.naturalWidth === bImage?.naturalWidth && aImage?.naturalHeight === bImage?.naturalHeight && nearlyEqual(a.pan.x, b.pan.x) && nearlyEqual(a.pan.y, b.pan.y) && nearlyEqual(a.zoom, b.zoom) && nearlyEqual(a.rotation, b.rotation) && a.flip.horizontal === b.flip.horizontal && a.flip.vertical === b.flip.vertical && nearlyEqual(a.cropRect.x, b.cropRect.x) && nearlyEqual(a.cropRect.y, b.cropRect.y) && nearlyEqual(a.cropRect.width, b.cropRect.width) && nearlyEqual(a.cropRect.height, b.cropRect.height);
40
30
  }
41
31
  function clampRequestedZoom(state, zoom) {
42
- if (state.image) {
43
- return Math.min(import_constants.MAX_ZOOM, Math.max(import_constants.ABSOLUTE_MIN_ZOOM, zoom));
44
- }
45
- return Math.min(import_constants.MAX_ZOOM, Math.max(import_constants.MIN_ZOOM, zoom));
32
+ if (state.image) return Math.min(__constants_ts.MAX_ZOOM, Math.max(__constants_ts.ABSOLUTE_MIN_ZOOM, zoom));
33
+ return Math.min(__constants_ts.MAX_ZOOM, Math.max(__constants_ts.MIN_ZOOM, zoom));
46
34
  }
35
+ /**
36
+ * Translate a pipeline transform operation into the equivalent
37
+ * reducer action. Pipeline ops aren't 1:1 with reducer actions —
38
+ * `rotate` is a delta here, whereas SET_ROTATION takes an absolute
39
+ * angle — so deltas are resolved against the current state.
40
+ *
41
+ * Used by APPLY_OPERATION (and by the pipeline module's
42
+ * `applyOperationToState`, which is now a thin wrapper around the
43
+ * reducer) so that pipeline replay produces identical bounded
44
+ * state to UI interaction or direct setters.
45
+ *
46
+ * @param state The current cropper state.
47
+ * @param op The pipeline operation.
48
+ * @return The equivalent reducer action.
49
+ */
47
50
  function operationToAction(state, op) {
48
- switch (op.type) {
49
- case "crop":
50
- return { type: "SET_CROP_RECT", payload: { ...op.rect } };
51
- case "rotate": {
52
- const singleFlip = state.flip.horizontal !== state.flip.vertical;
53
- const fieldDelta = singleFlip ? -op.degrees : op.degrees;
54
- return {
55
- type: "SET_ROTATION",
56
- payload: (0, import_rotation.normalizeRotation)(state.rotation + fieldDelta)
57
- };
58
- }
59
- case "flip":
60
- return {
61
- type: "SET_FLIP",
62
- payload: {
63
- ...state.flip,
64
- [op.direction]: !state.flip[op.direction]
65
- }
66
- };
67
- case "zoom":
68
- return { type: "SET_ZOOM", payload: op.factor };
69
- }
51
+ switch (op.type) {
52
+ case "crop": return {
53
+ type: "SET_CROP_RECT",
54
+ payload: { ...op.rect }
55
+ };
56
+ case "rotate": {
57
+ const fieldDelta = state.flip.horizontal !== state.flip.vertical ? -op.degrees : op.degrees;
58
+ return {
59
+ type: "SET_ROTATION",
60
+ payload: (0, __math_rotation_ts.normalizeRotation)(state.rotation + fieldDelta)
61
+ };
62
+ }
63
+ case "flip": return {
64
+ type: "SET_FLIP",
65
+ payload: {
66
+ ...state.flip,
67
+ [op.direction]: !state.flip[op.direction]
68
+ }
69
+ };
70
+ case "zoom": return {
71
+ type: "SET_ZOOM",
72
+ payload: op.factor
73
+ };
74
+ }
70
75
  }
76
+ /**
77
+ * Enforces containment: restricts the crop rect to fit within the
78
+ * rotated image, computes minimum zoom, clamps zoom, and restricts
79
+ * the pan position so the image always covers the crop area.
80
+ * Called after every relevant state transition.
81
+ *
82
+ * @param state The state to enforce containment on.
83
+ * @return The state with cropRect, zoom, and position restricted.
84
+ */
71
85
  function enforceContainment(state) {
72
- if (!state.image) {
73
- return state;
74
- }
75
- const imageSize = {
76
- width: state.image.naturalWidth,
77
- height: state.image.naturalHeight
78
- };
79
- const imageAspectRatio = imageSize.width / imageSize.height;
80
- const { pan: panAfterZoom, zoom } = (0, import_containment.restrictPanZoom)(
81
- state,
82
- imageSize,
83
- state.cropRect
84
- );
85
- const cropRect = (0, import_containment.restrictCropRect)(
86
- state.cropRect,
87
- zoom,
88
- state.rotation,
89
- imageAspectRatio
90
- );
91
- let pan = panAfterZoom;
92
- if (cropRect !== state.cropRect) {
93
- ({ pan } = (0, import_containment.restrictPanZoom)(
94
- { ...state, zoom, cropRect },
95
- imageSize,
96
- cropRect
97
- ));
98
- }
99
- if (pan.x === state.pan.x && pan.y === state.pan.y && zoom === state.zoom && cropRect === state.cropRect) {
100
- return state;
101
- }
102
- return { ...state, pan, zoom, cropRect };
86
+ if (!state.image) return state;
87
+ const imageSize = {
88
+ width: state.image.naturalWidth,
89
+ height: state.image.naturalHeight
90
+ };
91
+ const imageAspectRatio = imageSize.width / imageSize.height;
92
+ const { pan: panAfterZoom, zoom } = (0, __containment_ts.restrictPanZoom)(state, imageSize, state.cropRect);
93
+ const cropRect = (0, __containment_ts.restrictCropRect)(state.cropRect, zoom, state.rotation, imageAspectRatio);
94
+ let pan = panAfterZoom;
95
+ if (cropRect !== state.cropRect) ({pan} = (0, __containment_ts.restrictPanZoom)({
96
+ ...state,
97
+ zoom,
98
+ cropRect
99
+ }, imageSize, cropRect));
100
+ if (pan.x === state.pan.x && pan.y === state.pan.y && zoom === state.zoom && cropRect === state.cropRect) return state;
101
+ return {
102
+ ...state,
103
+ pan,
104
+ zoom,
105
+ cropRect
106
+ };
103
107
  }
108
+ /**
109
+ * Snapshot the current `crop`, `zoom`, and `rotation` into the
110
+ * corresponding `basePan`, `baseZoom`, `baseRotation` fields. Called
111
+ * by every committing action so that the next SET_ROTATION derives
112
+ * its transient pan from a fresh base (not from a drifted one).
113
+ *
114
+ * SET_ROTATION is the only action that does NOT commit base — it
115
+ * reads the base, computes a transient pan, and leaves the base
116
+ * alone. This is what eliminates rotation drift near edges.
117
+ *
118
+ * @param next The post-containment state to commit.
119
+ * @return The state with base fields synced to current.
120
+ */
104
121
  function commitBase(next) {
105
- if (next.basePan.x === next.pan.x && next.basePan.y === next.pan.y && next.baseZoom === next.zoom && next.baseRotation === next.rotation) {
106
- return next;
107
- }
108
- return {
109
- ...next,
110
- basePan: { x: next.pan.x, y: next.pan.y },
111
- baseZoom: next.zoom,
112
- baseRotation: next.rotation
113
- };
122
+ if (next.basePan.x === next.pan.x && next.basePan.y === next.pan.y && next.baseZoom === next.zoom && next.baseRotation === next.rotation) return next;
123
+ return {
124
+ ...next,
125
+ basePan: {
126
+ x: next.pan.x,
127
+ y: next.pan.y
128
+ },
129
+ baseZoom: next.zoom,
130
+ baseRotation: next.rotation
131
+ };
114
132
  }
133
+ /**
134
+ * Reducer function for cropper state management.
135
+ *
136
+ * Every state transition that could invalidate the containment invariant
137
+ * (crop, zoom, rotation, cropRect, flip) is followed by enforceContainment
138
+ * to ensure the image always covers the crop area.
139
+ *
140
+ * Committing actions (everything except SET_ROTATION) also call
141
+ * `commitBase` to snapshot the post-containment state as the new
142
+ * base pose. SET_ROTATION derives from that base without mutating
143
+ * it, which prevents accumulated-clamp drift during continuous fine
144
+ * rotation.
145
+ *
146
+ * @param state The current cropper state.
147
+ * @param action The action to process.
148
+ * @return The new cropper state.
149
+ */
115
150
  function cropperReducer(state, action) {
116
- switch (action.type) {
117
- case "SET_IMAGE":
118
- return commitBase(
119
- enforceContainment({
120
- ...state,
121
- image: action.payload
122
- })
123
- );
124
- case "SET_PAN":
125
- return commitBase(
126
- enforceContainment({
127
- ...state,
128
- pan: action.payload
129
- })
130
- );
131
- case "SET_ZOOM": {
132
- const z = clampRequestedZoom(state, action.payload);
133
- return commitBase(
134
- enforceContainment({
135
- ...state,
136
- zoom: z
137
- })
138
- );
139
- }
140
- case "SET_ZOOM_AT_POINT": {
141
- const z = clampRequestedZoom(state, action.payload.zoom);
142
- return commitBase(
143
- enforceContainment({
144
- ...state,
145
- zoom: z,
146
- pan: action.payload.pan
147
- })
148
- );
149
- }
150
- case "SET_ROTATION": {
151
- const newRotation = (0, import_rotation.normalizeRotation)(action.payload);
152
- const singleFlip = state.flip.horizontal !== state.flip.vertical;
153
- const deltaRad = (0, import_rotation.degreesToRadians)(
154
- newRotation - state.baseRotation
155
- );
156
- const cos = Math.cos(deltaRad);
157
- const sin = Math.sin(deltaRad) * (singleFlip ? -1 : 1);
158
- const cropCx = state.cropRect.x + state.cropRect.width / 2;
159
- const cropCy = state.cropRect.y + state.cropRect.height / 2;
160
- const ox = cropCx - 0.5;
161
- const oy = cropCy - 0.5;
162
- const dx = state.basePan.x - ox;
163
- const dy = state.basePan.y - oy;
164
- return enforceContainment({
165
- ...state,
166
- rotation: newRotation,
167
- zoom: state.baseZoom,
168
- pan: {
169
- x: ox + cos * dx - sin * dy,
170
- y: oy + sin * dx + cos * dy
171
- }
172
- });
173
- }
174
- case "SNAP_ROTATE_90": {
175
- const rawDir = action.payload.direction;
176
- const singleFlip = state.flip.horizontal !== state.flip.vertical;
177
- const fieldDir = singleFlip ? -rawDir : rawDir;
178
- const rot90 = (0, import_rotation.normalizeRotation)(state.rotation + fieldDir * 90);
179
- const rect = state.cropRect;
180
- const cx = rect.x + rect.width / 2;
181
- const cy = rect.y + rect.height / 2;
182
- const newPanX = rawDir === 1 ? -state.pan.y : state.pan.y;
183
- const newPanY = rawDir === 1 ? state.pan.x : -state.pan.x;
184
- return commitBase(
185
- enforceContainment({
186
- ...state,
187
- rotation: rot90,
188
- zoom: state.baseZoom,
189
- pan: { x: newPanX, y: newPanY },
190
- cropRect: {
191
- x: cx - rect.height / 2,
192
- y: cy - rect.width / 2,
193
- width: rect.height,
194
- height: rect.width
195
- }
196
- })
197
- );
198
- }
199
- case "SET_FLIP": {
200
- const oldFlip = state.flip;
201
- const newFlip = action.payload;
202
- const flippedH = oldFlip.horizontal !== newFlip.horizontal;
203
- const flippedV = oldFlip.vertical !== newFlip.vertical;
204
- const rect = state.cropRect;
205
- return commitBase(
206
- enforceContainment({
207
- ...state,
208
- flip: newFlip,
209
- pan: {
210
- x: flippedH ? -state.pan.x : state.pan.x,
211
- y: flippedV ? -state.pan.y : state.pan.y
212
- },
213
- cropRect: {
214
- x: flippedH ? 1 - rect.x - rect.width : rect.x,
215
- y: flippedV ? 1 - rect.y - rect.height : rect.y,
216
- width: rect.width,
217
- height: rect.height
218
- }
219
- })
220
- );
221
- }
222
- case "SET_CROP_RECT":
223
- return commitBase(
224
- enforceContainment({
225
- ...state,
226
- cropRect: action.payload
227
- })
228
- );
229
- case "SETTLE_CROP": {
230
- const rect = state.cropRect;
231
- if (rect.width === 0 || rect.height === 0 || !state.image) {
232
- return state;
233
- }
234
- const fitScale = 1 / Math.max(rect.width, rect.height);
235
- const zoomCap = state.zoom > 0 ? import_constants.MAX_ZOOM / state.zoom : fitScale;
236
- const s = Math.min(fitScale, zoomCap);
237
- const newW = rect.width * s;
238
- const newH = rect.height * s;
239
- const oldCx = rect.x + rect.width / 2;
240
- const oldCy = rect.y + rect.height / 2;
241
- return commitBase(
242
- enforceContainment({
243
- ...state,
244
- zoom: state.zoom * s,
245
- pan: {
246
- x: (state.pan.x - oldCx + 0.5) * s,
247
- y: (state.pan.y - oldCy + 0.5) * s
248
- },
249
- cropRect: {
250
- x: (1 - newW) / 2,
251
- y: (1 - newH) / 2,
252
- width: newW,
253
- height: newH
254
- }
255
- })
256
- );
257
- }
258
- case "APPLY_OPERATION":
259
- return cropperReducer(
260
- state,
261
- operationToAction(state, action.payload)
262
- );
263
- case "RESET":
264
- return commitBase(
265
- enforceContainment({
266
- ...import_constants.DEFAULT_STATE,
267
- image: state.image,
268
- ...action.payload
269
- })
270
- );
271
- }
151
+ switch (action.type) {
152
+ case "SET_IMAGE": return commitBase(enforceContainment({
153
+ ...state,
154
+ image: action.payload
155
+ }));
156
+ case "SET_PAN": return commitBase(enforceContainment({
157
+ ...state,
158
+ pan: action.payload
159
+ }));
160
+ case "SET_ZOOM": {
161
+ const z = clampRequestedZoom(state, action.payload);
162
+ return commitBase(enforceContainment({
163
+ ...state,
164
+ zoom: z
165
+ }));
166
+ }
167
+ case "SET_ZOOM_AT_POINT": {
168
+ const z = clampRequestedZoom(state, action.payload.zoom);
169
+ return commitBase(enforceContainment({
170
+ ...state,
171
+ zoom: z,
172
+ pan: action.payload.pan
173
+ }));
174
+ }
175
+ case "SET_ROTATION": {
176
+ const newRotation = (0, __math_rotation_ts.normalizeRotation)(action.payload);
177
+ const singleFlip = state.flip.horizontal !== state.flip.vertical;
178
+ const deltaRad = (0, __math_rotation_ts.degreesToRadians)(newRotation - state.baseRotation);
179
+ const cos = Math.cos(deltaRad);
180
+ const sin = Math.sin(deltaRad) * (singleFlip ? -1 : 1);
181
+ const cropCx = state.cropRect.x + state.cropRect.width / 2;
182
+ const cropCy = state.cropRect.y + state.cropRect.height / 2;
183
+ const ox = cropCx - .5;
184
+ const oy = cropCy - .5;
185
+ const dx = state.basePan.x - ox;
186
+ const dy = state.basePan.y - oy;
187
+ return enforceContainment({
188
+ ...state,
189
+ rotation: newRotation,
190
+ zoom: state.baseZoom,
191
+ pan: {
192
+ x: ox + cos * dx - sin * dy,
193
+ y: oy + sin * dx + cos * dy
194
+ }
195
+ });
196
+ }
197
+ case "SNAP_ROTATE_90": {
198
+ const rawDir = action.payload.direction;
199
+ const fieldDir = state.flip.horizontal !== state.flip.vertical ? -rawDir : rawDir;
200
+ const rot90 = (0, __math_rotation_ts.normalizeRotation)(state.rotation + fieldDir * 90);
201
+ const rect = state.cropRect;
202
+ const cx = rect.x + rect.width / 2;
203
+ const cy = rect.y + rect.height / 2;
204
+ const newPanX = rawDir === 1 ? -state.pan.y : state.pan.y;
205
+ const newPanY = rawDir === 1 ? state.pan.x : -state.pan.x;
206
+ return commitBase(enforceContainment({
207
+ ...state,
208
+ rotation: rot90,
209
+ zoom: state.baseZoom,
210
+ pan: {
211
+ x: newPanX,
212
+ y: newPanY
213
+ },
214
+ cropRect: {
215
+ x: cx - rect.height / 2,
216
+ y: cy - rect.width / 2,
217
+ width: rect.height,
218
+ height: rect.width
219
+ }
220
+ }));
221
+ }
222
+ case "SET_FLIP": {
223
+ const oldFlip = state.flip;
224
+ const newFlip = action.payload;
225
+ const flippedH = oldFlip.horizontal !== newFlip.horizontal;
226
+ const flippedV = oldFlip.vertical !== newFlip.vertical;
227
+ const rect = state.cropRect;
228
+ return commitBase(enforceContainment({
229
+ ...state,
230
+ flip: newFlip,
231
+ pan: {
232
+ x: flippedH ? -state.pan.x : state.pan.x,
233
+ y: flippedV ? -state.pan.y : state.pan.y
234
+ },
235
+ cropRect: {
236
+ x: flippedH ? 1 - rect.x - rect.width : rect.x,
237
+ y: flippedV ? 1 - rect.y - rect.height : rect.y,
238
+ width: rect.width,
239
+ height: rect.height
240
+ }
241
+ }));
242
+ }
243
+ case "SET_CROP_RECT": return commitBase(enforceContainment({
244
+ ...state,
245
+ cropRect: action.payload
246
+ }));
247
+ case "SETTLE_CROP": {
248
+ const rect = state.cropRect;
249
+ if (rect.width === 0 || rect.height === 0 || !state.image) return state;
250
+ const fitScale = 1 / Math.max(rect.width, rect.height);
251
+ const zoomCap = state.zoom > 0 ? __constants_ts.MAX_ZOOM / state.zoom : fitScale;
252
+ const s = Math.min(fitScale, zoomCap);
253
+ const newW = rect.width * s;
254
+ const newH = rect.height * s;
255
+ const oldCx = rect.x + rect.width / 2;
256
+ const oldCy = rect.y + rect.height / 2;
257
+ return commitBase(enforceContainment({
258
+ ...state,
259
+ zoom: state.zoom * s,
260
+ pan: {
261
+ x: (state.pan.x - oldCx + .5) * s,
262
+ y: (state.pan.y - oldCy + .5) * s
263
+ },
264
+ cropRect: {
265
+ x: (1 - newW) / 2,
266
+ y: (1 - newH) / 2,
267
+ width: newW,
268
+ height: newH
269
+ }
270
+ }));
271
+ }
272
+ case "APPLY_OPERATION": return cropperReducer(state, operationToAction(state, action.payload));
273
+ case "RESET": return commitBase(enforceContainment({
274
+ ...__constants_ts.DEFAULT_STATE,
275
+ image: state.image,
276
+ ...action.payload
277
+ }));
278
+ }
272
279
  }
280
+ /**
281
+ * Shallow comparison of key cropper state fields to determine if
282
+ * the state has been modified from an initial snapshot.
283
+ *
284
+ * @param current The current cropper state.
285
+ * @param initial The initial cropper state snapshot.
286
+ * @return True if any tracked field differs.
287
+ */
273
288
  function isStateDirty(current, initial) {
274
- return !nearlyEqual(current.pan.x, initial.pan.x) || !nearlyEqual(current.pan.y, initial.pan.y) || !nearlyEqual(current.zoom, initial.zoom) || !nearlyEqual(current.rotation, initial.rotation) || current.flip.horizontal !== initial.flip.horizontal || current.flip.vertical !== initial.flip.vertical || !nearlyEqual(current.cropRect.x, initial.cropRect.x) || !nearlyEqual(current.cropRect.y, initial.cropRect.y) || !nearlyEqual(current.cropRect.width, initial.cropRect.width) || !nearlyEqual(current.cropRect.height, initial.cropRect.height);
289
+ return !nearlyEqual(current.pan.x, initial.pan.x) || !nearlyEqual(current.pan.y, initial.pan.y) || !nearlyEqual(current.zoom, initial.zoom) || !nearlyEqual(current.rotation, initial.rotation) || current.flip.horizontal !== initial.flip.horizontal || current.flip.vertical !== initial.flip.vertical || !nearlyEqual(current.cropRect.x, initial.cropRect.x) || !nearlyEqual(current.cropRect.y, initial.cropRect.y) || !nearlyEqual(current.cropRect.width, initial.cropRect.width) || !nearlyEqual(current.cropRect.height, initial.cropRect.height);
275
290
  }
276
- // Annotate the CommonJS export names for ESM import in node:
277
- 0 && (module.exports = {
278
- areCropperStatesEqual,
279
- cropperReducer,
280
- enforceContainment,
281
- isStateDirty
282
- });
283
- //# sourceMappingURL=state.cjs.map
291
+ exports.areCropperStatesEqual = areCropperStatesEqual;
292
+ exports.cropperReducer = cropperReducer;
293
+ exports.enforceContainment = enforceContainment;
294
+ exports.isStateDirty = isStateDirty;
295
+
296
+ //# sourceMappingURL=state.cjs.map