@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,108 +1,133 @@
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/constants.ts
21
- var constants_exports = {};
22
- __export(constants_exports, {
23
- ABSOLUTE_MIN_ZOOM: () => ABSOLUTE_MIN_ZOOM,
24
- DEFAULT_ASPECT_RATIOS: () => DEFAULT_ASPECT_RATIOS,
25
- DEFAULT_KEYBOARD_STEP: () => DEFAULT_KEYBOARD_STEP,
26
- DEFAULT_STATE: () => DEFAULT_STATE,
27
- DEFAULT_WHEEL_ZOOM_SPEED: () => DEFAULT_WHEEL_ZOOM_SPEED,
28
- KEYBOARD_SHIFT_STEP_MULTIPLIER: () => KEYBOARD_SHIFT_STEP_MULTIPLIER,
29
- MAX_ROTATION_OFFSET: () => MAX_ROTATION_OFFSET,
30
- MAX_VIEW_SCALE: () => MAX_VIEW_SCALE,
31
- MAX_ZOOM: () => MAX_ZOOM,
32
- MIN_CROP_PIXELS: () => MIN_CROP_PIXELS,
33
- MIN_CROP_SCREEN_PX: () => MIN_CROP_SCREEN_PX,
34
- MIN_ZOOM: () => MIN_ZOOM,
35
- ORIGINAL_ASPECT_RATIO: () => ORIGINAL_ASPECT_RATIO,
36
- PIXEL_SNAP_DISPLAY_SCALE: () => PIXEL_SNAP_DISPLAY_SCALE,
37
- SETTLE_TARGET_CANVAS_FILL: () => SETTLE_TARGET_CANVAS_FILL
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
38
5
  });
39
- module.exports = __toCommonJS(constants_exports);
40
- var import_i18n = require("@wordpress/i18n");
41
- var MIN_ZOOM = 1;
42
- var ABSOLUTE_MIN_ZOOM = 0.1;
43
- var MAX_ZOOM = 10;
44
- var MIN_CROP_PIXELS = 16;
45
- var MIN_CROP_SCREEN_PX = 44;
46
- var SETTLE_TARGET_CANVAS_FILL = 0.8;
47
- var MAX_VIEW_SCALE = 8;
48
- var PIXEL_SNAP_DISPLAY_SCALE = 1;
49
- var DEFAULT_WHEEL_ZOOM_SPEED = 25e-4;
50
- var DEFAULT_KEYBOARD_STEP = 0.01;
51
- var KEYBOARD_SHIFT_STEP_MULTIPLIER = 10;
52
- var MAX_ROTATION_OFFSET = 45;
53
- var DEFAULT_CROP_RECT = {
54
- x: 0,
55
- y: 0,
56
- width: 1,
57
- height: 1
6
+ // packages/media-editor/src/image-editor/core/constants.ts
7
+ /**
8
+ * Default/resting zoom. A full, unrotated crop needs at least 1x to cover the
9
+ * crop area, but smaller/fine-rotated crops can be valid below 1x — the true
10
+ * floor for those comes from `getMinZoom`.
11
+ */
12
+ const MIN_ZOOM = 1;
13
+ /**
14
+ * Safety floor for coverage-aware zoom. Degenerate crops can have a geometric
15
+ * coverage minimum of 0, but camera and inverse-matrix math need a stable,
16
+ * positive scale.
17
+ */
18
+ const ABSOLUTE_MIN_ZOOM = .1;
19
+ const MAX_ZOOM = 10;
20
+ /**
21
+ * Minimum crop rect dimension in source-image pixels, enforced per axis
22
+ * during resize. Prevents accidental sub-pixel crops while staying small
23
+ * enough to allow tight crops (favicons, icons). Adjust here to tune the
24
+ * floor globally.
25
+ */
26
+ const MIN_CROP_PIXELS = 16;
27
+ /**
28
+ * Minimum on-screen crop rect dimension in CSS pixels. The source-pixel
29
+ * floor (`MIN_CROP_PIXELS`) keeps crops from going sub-pixel, but on a large
30
+ * image fit into a small canvas it can render only a few CSS pixels wide —
31
+ * too small to grab the resize handles. This floor keeps the crop operable
32
+ * regardless of display scale; it binds when zoomed out and yields to the
33
+ * source-pixel floor once the image is shown large enough. Sized to one
34
+ * handle touch target (`$handle-touch-target-size` in `cropper.scss`).
35
+ */
36
+ const MIN_CROP_SCREEN_PX = 44;
37
+ /**
38
+ * Fraction of the constraining canvas axis the settled crop should occupy on
39
+ * screen. When a crop is shown smaller than this (e.g. a square crop in a tall
40
+ * image, capped by the contain-fit footprint's narrow axis), the view magnifies
41
+ * to fill the canvas. `1` = always fill the canvas; lower = rescue only the
42
+ * under-filled cases. See `getViewScale`.
43
+ */
44
+ const SETTLE_TARGET_CANVAS_FILL = .8;
45
+ /**
46
+ * Upper bound on the presentational view magnification (`getViewScale`).
47
+ * Prevents a near-degenerate crop from magnifying the scene without limit.
48
+ */
49
+ const MAX_VIEW_SCALE = 8;
50
+ /**
51
+ * CSS pixels per source pixel required before resize handles snap the selected
52
+ * source region to whole-pixel edges. Below 1:1, a source pixel is sub-pixel on
53
+ * screen, so snapping would feel notchy without a visible pixel boundary.
54
+ */
55
+ const PIXEL_SNAP_DISPLAY_SCALE = 1;
56
+ /**
57
+ * Wheel zoom sensitivity. A deltaY of 100 changes zoom by 0.25.
58
+ * This could be made configurable as a prop to the Cropper component.
59
+ */
60
+ const DEFAULT_WHEEL_ZOOM_SPEED = .0025;
61
+ /** Fine step for keyboard-driven cropper movement, in normalized coordinates. */
62
+ const DEFAULT_KEYBOARD_STEP = .01;
63
+ /** Coarse keyboard movement multiplier when Shift is held. */
64
+ const KEYBOARD_SHIFT_STEP_MULTIPLIER = 10;
65
+ /**
66
+ * Maximum free-rotation offset in degrees from the nearest 90° step.
67
+ * The rotation slider allows ±45° around the current cardinal angle.
68
+ */
69
+ const MAX_ROTATION_OFFSET = 45;
70
+ const DEFAULT_CROP_RECT = {
71
+ x: 0,
72
+ y: 0,
73
+ width: 1,
74
+ height: 1
58
75
  };
59
- var DEFAULT_FLIP = {
60
- horizontal: false,
61
- vertical: false
76
+ const DEFAULT_FLIP = {
77
+ horizontal: false,
78
+ vertical: false
62
79
  };
63
- var DEFAULT_PAN = {
64
- x: 0,
65
- y: 0
80
+ const DEFAULT_PAN = {
81
+ x: 0,
82
+ y: 0
66
83
  };
67
- var DEFAULT_STATE = {
68
- image: null,
69
- pan: { ...DEFAULT_PAN },
70
- zoom: MIN_ZOOM,
71
- rotation: 0,
72
- basePan: { ...DEFAULT_PAN },
73
- baseZoom: MIN_ZOOM,
74
- baseRotation: 0,
75
- flip: { ...DEFAULT_FLIP },
76
- cropRect: { ...DEFAULT_CROP_RECT }
84
+ const DEFAULT_STATE = {
85
+ image: null,
86
+ pan: { ...DEFAULT_PAN },
87
+ zoom: 1,
88
+ rotation: 0,
89
+ basePan: { ...DEFAULT_PAN },
90
+ baseZoom: 1,
91
+ baseRotation: 0,
92
+ flip: { ...DEFAULT_FLIP },
93
+ cropRect: { ...DEFAULT_CROP_RECT }
77
94
  };
78
- var ORIGINAL_ASPECT_RATIO = -1;
79
- var DEFAULT_ASPECT_RATIOS = [
80
- { label: (0, import_i18n.__)("Free"), value: 0 },
81
- { label: (0, import_i18n.__)("Original"), value: ORIGINAL_ASPECT_RATIO },
82
- { label: (0, import_i18n.__)("Square (1:1)"), value: 1 },
83
- { label: (0, import_i18n.__)("Landscape (16:9)"), value: 16 / 9 },
84
- { label: (0, import_i18n.__)("Portrait (9:16)"), value: 9 / 16 },
85
- { label: (0, import_i18n.__)("Classic (4:3)"), value: 4 / 3 },
86
- { label: (0, import_i18n.__)("Classic portrait (3:4)"), value: 3 / 4 },
87
- { label: (0, import_i18n.__)("Photo (3:2)"), value: 3 / 2 },
88
- { label: (0, import_i18n.__)("Photo portrait (2:3)"), value: 2 / 3 }
89
- ];
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- ABSOLUTE_MIN_ZOOM,
93
- DEFAULT_ASPECT_RATIOS,
94
- DEFAULT_KEYBOARD_STEP,
95
- DEFAULT_STATE,
96
- DEFAULT_WHEEL_ZOOM_SPEED,
97
- KEYBOARD_SHIFT_STEP_MULTIPLIER,
98
- MAX_ROTATION_OFFSET,
99
- MAX_VIEW_SCALE,
100
- MAX_ZOOM,
101
- MIN_CROP_PIXELS,
102
- MIN_CROP_SCREEN_PX,
103
- MIN_ZOOM,
104
- ORIGINAL_ASPECT_RATIO,
105
- PIXEL_SNAP_DISPLAY_SCALE,
106
- SETTLE_TARGET_CANVAS_FILL
107
- });
108
- //# sourceMappingURL=constants.cjs.map
95
+ /**
96
+ * Default aspect ratio presets. Consumers can use these as-is, override
97
+ * with their own list, or extend with additional presets.
98
+ *
99
+ * @example
100
+ * // Use defaults:
101
+ * <CropControls presets={ DEFAULT_ASPECT_RATIOS } />
102
+ *
103
+ * // Custom presets:
104
+ * const socialPresets = [
105
+ * { label: 'Instagram Post', value: 1 },
106
+ * { label: 'Instagram Story', value: 9 / 16 },
107
+ * { label: 'YouTube Thumbnail', value: 16 / 9 },
108
+ * ];
109
+ *
110
+ * // Extend defaults:
111
+ * const extended = [ ...DEFAULT_ASPECT_RATIOS, { label: 'Cinema (21:9)', value: 21 / 9 } ];
112
+ */
113
+ /**
114
+ * Sentinel value for "Original" aspect ratio — resolved at runtime
115
+ * to the image's natural width / height.
116
+ */
117
+ const ORIGINAL_ASPECT_RATIO = -1;
118
+ exports.ABSOLUTE_MIN_ZOOM = ABSOLUTE_MIN_ZOOM;
119
+ exports.DEFAULT_KEYBOARD_STEP = DEFAULT_KEYBOARD_STEP;
120
+ exports.DEFAULT_STATE = DEFAULT_STATE;
121
+ exports.DEFAULT_WHEEL_ZOOM_SPEED = DEFAULT_WHEEL_ZOOM_SPEED;
122
+ exports.KEYBOARD_SHIFT_STEP_MULTIPLIER = KEYBOARD_SHIFT_STEP_MULTIPLIER;
123
+ exports.MAX_ROTATION_OFFSET = MAX_ROTATION_OFFSET;
124
+ exports.MAX_VIEW_SCALE = MAX_VIEW_SCALE;
125
+ exports.MAX_ZOOM = MAX_ZOOM;
126
+ exports.MIN_CROP_PIXELS = MIN_CROP_PIXELS;
127
+ exports.MIN_CROP_SCREEN_PX = MIN_CROP_SCREEN_PX;
128
+ exports.MIN_ZOOM = MIN_ZOOM;
129
+ exports.ORIGINAL_ASPECT_RATIO = ORIGINAL_ASPECT_RATIO;
130
+ exports.PIXEL_SNAP_DISPLAY_SCALE = PIXEL_SNAP_DISPLAY_SCALE;
131
+ exports.SETTLE_TARGET_CANVAS_FILL = SETTLE_TARGET_CANVAS_FILL;
132
+
133
+ //# sourceMappingURL=constants.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/image-editor/core/constants.ts"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport type { NormalizedRect, Flip, CropperState } from './types';\n\n/**\n * Default/resting zoom. A full, unrotated crop needs at least 1x to cover the\n * crop area, but smaller/fine-rotated crops can be valid below 1x — the true\n * floor for those comes from `getMinZoom`.\n */\nexport const MIN_ZOOM = 1;\n/**\n * Safety floor for coverage-aware zoom. Degenerate crops can have a geometric\n * coverage minimum of 0, but camera and inverse-matrix math need a stable,\n * positive scale.\n */\nexport const ABSOLUTE_MIN_ZOOM = 0.1;\nexport const MAX_ZOOM = 10;\n\n/**\n * Minimum crop rect dimension in source-image pixels, enforced per axis\n * during resize. Prevents accidental sub-pixel crops while staying small\n * enough to allow tight crops (favicons, icons). Adjust here to tune the\n * floor globally.\n */\nexport const MIN_CROP_PIXELS = 16;\n\n/**\n * Minimum on-screen crop rect dimension in CSS pixels. The source-pixel\n * floor (`MIN_CROP_PIXELS`) keeps crops from going sub-pixel, but on a large\n * image fit into a small canvas it can render only a few CSS pixels wide —\n * too small to grab the resize handles. This floor keeps the crop operable\n * regardless of display scale; it binds when zoomed out and yields to the\n * source-pixel floor once the image is shown large enough. Sized to one\n * handle touch target (`$handle-touch-target-size` in `cropper.scss`).\n */\nexport const MIN_CROP_SCREEN_PX = 44;\n\n/**\n * Fraction of the constraining canvas axis the settled crop should occupy on\n * screen. When a crop is shown smaller than this (e.g. a square crop in a tall\n * image, capped by the contain-fit footprint's narrow axis), the view magnifies\n * to fill the canvas. `1` = always fill the canvas; lower = rescue only the\n * under-filled cases. See `getViewScale`.\n */\nexport const SETTLE_TARGET_CANVAS_FILL = 0.8;\n\n/**\n * Upper bound on the presentational view magnification (`getViewScale`).\n * Prevents a near-degenerate crop from magnifying the scene without limit.\n */\nexport const MAX_VIEW_SCALE = 8;\n\n/**\n * CSS pixels per source pixel required before resize handles snap the selected\n * source region to whole-pixel edges. Below 1:1, a source pixel is sub-pixel on\n * screen, so snapping would feel notchy without a visible pixel boundary.\n */\nexport const PIXEL_SNAP_DISPLAY_SCALE = 1;\n\n/**\n * Wheel zoom sensitivity. A deltaY of 100 changes zoom by 0.25.\n * This could be made configurable as a prop to the Cropper component.\n */\nexport const DEFAULT_WHEEL_ZOOM_SPEED = 0.0025;\n\n/** Fine step for keyboard-driven cropper movement, in normalized coordinates. */\nexport const DEFAULT_KEYBOARD_STEP = 0.01;\n\n/** Coarse keyboard movement multiplier when Shift is held. */\nexport const KEYBOARD_SHIFT_STEP_MULTIPLIER = 10;\n\n/**\n * Maximum free-rotation offset in degrees from the nearest 90° step.\n * The rotation slider allows ±45° around the current cardinal angle.\n */\nexport const MAX_ROTATION_OFFSET = 45;\n\nconst DEFAULT_CROP_RECT: NormalizedRect = {\n\tx: 0,\n\ty: 0,\n\twidth: 1,\n\theight: 1,\n};\n\nconst DEFAULT_FLIP: Flip = {\n\thorizontal: false,\n\tvertical: false,\n};\n\nconst DEFAULT_PAN: { x: number; y: number } = {\n\tx: 0,\n\ty: 0,\n};\n\nexport const DEFAULT_STATE: CropperState = {\n\timage: null,\n\tpan: { ...DEFAULT_PAN },\n\tzoom: MIN_ZOOM,\n\trotation: 0,\n\tbasePan: { ...DEFAULT_PAN },\n\tbaseZoom: MIN_ZOOM,\n\tbaseRotation: 0,\n\tflip: { ...DEFAULT_FLIP },\n\tcropRect: { ...DEFAULT_CROP_RECT },\n};\n\n/**\n * An aspect ratio preset with a human-readable label.\n */\nexport interface AspectRatioPreset {\n\t/** Display label (e.g., \"Square (1:1)\"). */\n\tlabel: string;\n\t/** The aspect ratio value (width / height). 0 = free / original. */\n\tvalue: number;\n}\n\n/**\n * Default aspect ratio presets. Consumers can use these as-is, override\n * with their own list, or extend with additional presets.\n *\n * @example\n * // Use defaults:\n * <CropControls presets={ DEFAULT_ASPECT_RATIOS } />\n *\n * // Custom presets:\n * const socialPresets = [\n * { label: 'Instagram Post', value: 1 },\n * { label: 'Instagram Story', value: 9 / 16 },\n * { label: 'YouTube Thumbnail', value: 16 / 9 },\n * ];\n *\n * // Extend defaults:\n * const extended = [ ...DEFAULT_ASPECT_RATIOS, { label: 'Cinema (21:9)', value: 21 / 9 } ];\n */\n/**\n * Sentinel value for \"Original\" aspect ratio — resolved at runtime\n * to the image's natural width / height.\n */\nexport const ORIGINAL_ASPECT_RATIO = -1;\n\nexport const DEFAULT_ASPECT_RATIOS: AspectRatioPreset[] = [\n\t{ label: __( 'Free' ), value: 0 },\n\t{ label: __( 'Original' ), value: ORIGINAL_ASPECT_RATIO },\n\t{ label: __( 'Square (1:1)' ), value: 1 },\n\t{ label: __( 'Landscape (16:9)' ), value: 16 / 9 },\n\t{ label: __( 'Portrait (9:16)' ), value: 9 / 16 },\n\t{ label: __( 'Classic (4:3)' ), value: 4 / 3 },\n\t{ label: __( 'Classic portrait (3:4)' ), value: 3 / 4 },\n\t{ label: __( 'Photo (3:2)' ), value: 3 / 2 },\n\t{ label: __( 'Photo portrait (2:3)' ), value: 2 / 3 },\n];\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AAQZ,IAAM,WAAW;AAMjB,IAAM,oBAAoB;AAC1B,IAAM,WAAW;AAQjB,IAAM,kBAAkB;AAWxB,IAAM,qBAAqB;AAS3B,IAAM,4BAA4B;AAMlC,IAAM,iBAAiB;AAOvB,IAAM,2BAA2B;AAMjC,IAAM,2BAA2B;AAGjC,IAAM,wBAAwB;AAG9B,IAAM,iCAAiC;AAMvC,IAAM,sBAAsB;AAEnC,IAAM,oBAAoC;AAAA,EACzC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,EACP,QAAQ;AACT;AAEA,IAAM,eAAqB;AAAA,EAC1B,YAAY;AAAA,EACZ,UAAU;AACX;AAEA,IAAM,cAAwC;AAAA,EAC7C,GAAG;AAAA,EACH,GAAG;AACJ;AAEO,IAAM,gBAA8B;AAAA,EAC1C,OAAO;AAAA,EACP,KAAK,EAAE,GAAG,YAAY;AAAA,EACtB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS,EAAE,GAAG,YAAY;AAAA,EAC1B,UAAU;AAAA,EACV,cAAc;AAAA,EACd,MAAM,EAAE,GAAG,aAAa;AAAA,EACxB,UAAU,EAAE,GAAG,kBAAkB;AAClC;AAkCO,IAAM,wBAAwB;AAE9B,IAAM,wBAA6C;AAAA,EACzD,EAAE,WAAO,gBAAI,MAAO,GAAG,OAAO,EAAE;AAAA,EAChC,EAAE,WAAO,gBAAI,UAAW,GAAG,OAAO,sBAAsB;AAAA,EACxD,EAAE,WAAO,gBAAI,cAAe,GAAG,OAAO,EAAE;AAAA,EACxC,EAAE,WAAO,gBAAI,kBAAmB,GAAG,OAAO,KAAK,EAAE;AAAA,EACjD,EAAE,WAAO,gBAAI,iBAAkB,GAAG,OAAO,IAAI,GAAG;AAAA,EAChD,EAAE,WAAO,gBAAI,eAAgB,GAAG,OAAO,IAAI,EAAE;AAAA,EAC7C,EAAE,WAAO,gBAAI,wBAAyB,GAAG,OAAO,IAAI,EAAE;AAAA,EACtD,EAAE,WAAO,gBAAI,aAAc,GAAG,OAAO,IAAI,EAAE;AAAA,EAC3C,EAAE,WAAO,gBAAI,sBAAuB,GAAG,OAAO,IAAI,EAAE;AACrD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"constants.cjs","names":[],"sources":["../../../src/image-editor/core/constants.ts"],"sourcesContent":["import type { NormalizedRect, Flip, CropperState } from './types';\n\n/**\n * Default/resting zoom. A full, unrotated crop needs at least 1x to cover the\n * crop area, but smaller/fine-rotated crops can be valid below 1x — the true\n * floor for those comes from `getMinZoom`.\n */\nexport const MIN_ZOOM = 1;\n/**\n * Safety floor for coverage-aware zoom. Degenerate crops can have a geometric\n * coverage minimum of 0, but camera and inverse-matrix math need a stable,\n * positive scale.\n */\nexport const ABSOLUTE_MIN_ZOOM = 0.1;\nexport const MAX_ZOOM = 10;\n\n/**\n * Minimum crop rect dimension in source-image pixels, enforced per axis\n * during resize. Prevents accidental sub-pixel crops while staying small\n * enough to allow tight crops (favicons, icons). Adjust here to tune the\n * floor globally.\n */\nexport const MIN_CROP_PIXELS = 16;\n\n/**\n * Minimum on-screen crop rect dimension in CSS pixels. The source-pixel\n * floor (`MIN_CROP_PIXELS`) keeps crops from going sub-pixel, but on a large\n * image fit into a small canvas it can render only a few CSS pixels wide —\n * too small to grab the resize handles. This floor keeps the crop operable\n * regardless of display scale; it binds when zoomed out and yields to the\n * source-pixel floor once the image is shown large enough. Sized to one\n * handle touch target (`$handle-touch-target-size` in `cropper.scss`).\n */\nexport const MIN_CROP_SCREEN_PX = 44;\n\n/**\n * Fraction of the constraining canvas axis the settled crop should occupy on\n * screen. When a crop is shown smaller than this (e.g. a square crop in a tall\n * image, capped by the contain-fit footprint's narrow axis), the view magnifies\n * to fill the canvas. `1` = always fill the canvas; lower = rescue only the\n * under-filled cases. See `getViewScale`.\n */\nexport const SETTLE_TARGET_CANVAS_FILL = 0.8;\n\n/**\n * Upper bound on the presentational view magnification (`getViewScale`).\n * Prevents a near-degenerate crop from magnifying the scene without limit.\n */\nexport const MAX_VIEW_SCALE = 8;\n\n/**\n * CSS pixels per source pixel required before resize handles snap the selected\n * source region to whole-pixel edges. Below 1:1, a source pixel is sub-pixel on\n * screen, so snapping would feel notchy without a visible pixel boundary.\n */\nexport const PIXEL_SNAP_DISPLAY_SCALE = 1;\n\n/**\n * Wheel zoom sensitivity. A deltaY of 100 changes zoom by 0.25.\n * This could be made configurable as a prop to the Cropper component.\n */\nexport const DEFAULT_WHEEL_ZOOM_SPEED = 0.0025;\n\n/** Fine step for keyboard-driven cropper movement, in normalized coordinates. */\nexport const DEFAULT_KEYBOARD_STEP = 0.01;\n\n/** Coarse keyboard movement multiplier when Shift is held. */\nexport const KEYBOARD_SHIFT_STEP_MULTIPLIER = 10;\n\n/**\n * Maximum free-rotation offset in degrees from the nearest 90° step.\n * The rotation slider allows ±45° around the current cardinal angle.\n */\nexport const MAX_ROTATION_OFFSET = 45;\n\nconst DEFAULT_CROP_RECT: NormalizedRect = {\n\tx: 0,\n\ty: 0,\n\twidth: 1,\n\theight: 1,\n};\n\nconst DEFAULT_FLIP: Flip = {\n\thorizontal: false,\n\tvertical: false,\n};\n\nconst DEFAULT_PAN: { x: number; y: number } = {\n\tx: 0,\n\ty: 0,\n};\n\nexport const DEFAULT_STATE: CropperState = {\n\timage: null,\n\tpan: { ...DEFAULT_PAN },\n\tzoom: MIN_ZOOM,\n\trotation: 0,\n\tbasePan: { ...DEFAULT_PAN },\n\tbaseZoom: MIN_ZOOM,\n\tbaseRotation: 0,\n\tflip: { ...DEFAULT_FLIP },\n\tcropRect: { ...DEFAULT_CROP_RECT },\n};\n\n/**\n * An aspect ratio preset with a human-readable label.\n */\nexport interface AspectRatioPreset {\n\t/** Display label (e.g., \"Square (1:1)\"). */\n\tlabel: string;\n\t/** The aspect ratio value (width / height). 0 = free / original. */\n\tvalue: number;\n}\n\n/**\n * Default aspect ratio presets. Consumers can use these as-is, override\n * with their own list, or extend with additional presets.\n *\n * @example\n * // Use defaults:\n * <CropControls presets={ DEFAULT_ASPECT_RATIOS } />\n *\n * // Custom presets:\n * const socialPresets = [\n * { label: 'Instagram Post', value: 1 },\n * { label: 'Instagram Story', value: 9 / 16 },\n * { label: 'YouTube Thumbnail', value: 16 / 9 },\n * ];\n *\n * // Extend defaults:\n * const extended = [ ...DEFAULT_ASPECT_RATIOS, { label: 'Cinema (21:9)', value: 21 / 9 } ];\n */\n/**\n * Sentinel value for \"Original\" aspect ratio — resolved at runtime\n * to the image's natural width / height.\n */\nexport const ORIGINAL_ASPECT_RATIO = -1;\n"],"mappings":";;;;;;;;;;;AAOA,MAAa,WAAW;;;;;;AAMxB,MAAa,oBAAoB;AACjC,MAAa,WAAW;;;;;;;AAQxB,MAAa,kBAAkB;;;;;;;;;;AAW/B,MAAa,qBAAqB;;;;;;;;AASlC,MAAa,4BAA4B;;;;;AAMzC,MAAa,iBAAiB;;;;;;AAO9B,MAAa,2BAA2B;;;;;AAMxC,MAAa,2BAA2B;;AAGxC,MAAa,wBAAwB;;AAGrC,MAAa,iCAAiC;;;;;AAM9C,MAAa,sBAAsB;AAEnC,MAAM,oBAAoC;CACzC,GAAG;CACH,GAAG;CACH,OAAO;CACP,QAAQ;AACT;AAEA,MAAM,eAAqB;CAC1B,YAAY;CACZ,UAAU;AACX;AAEA,MAAM,cAAwC;CAC7C,GAAG;CACH,GAAG;AACJ;AAEA,MAAa,gBAA8B;CAC1C,OAAO;CACP,KAAK,EAAE,GAAG,YAAY;CACtB,MAAA;CACA,UAAU;CACV,SAAS,EAAE,GAAG,YAAY;CAC1B,UAAA;CACA,cAAc;CACd,MAAM,EAAE,GAAG,aAAa;CACxB,UAAU,EAAE,GAAG,kBAAkB;AAClC;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,wBAAwB"}