@wordpress/media-editor 0.22.0 → 0.24.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 (391) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/build/components/media-editor/index.cjs +229 -126
  3. package/build/components/media-editor/index.cjs.map +1 -1
  4. package/build/components/media-editor/use-crop-options.cjs +4 -5
  5. package/build/components/media-editor/use-crop-options.cjs.map +1 -1
  6. package/build/components/media-editor/use-save-media-editor.cjs +41 -11
  7. package/build/components/media-editor/use-save-media-editor.cjs.map +1 -1
  8. package/build/components/media-editor-canvas/index.cjs +15 -18
  9. package/build/components/media-editor-canvas/index.cjs.map +1 -1
  10. package/build/components/media-editor-crop-panel/index.cjs +26 -8
  11. package/build/components/media-editor-crop-panel/index.cjs.map +1 -1
  12. package/build/components/media-editor-fine-rotation/index.cjs +13 -12
  13. package/build/components/media-editor-fine-rotation/index.cjs.map +1 -1
  14. package/build/components/media-editor-image-controls/index.cjs +4 -6
  15. package/build/components/media-editor-image-controls/index.cjs.map +1 -1
  16. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +33 -33
  17. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -1
  18. package/build/components/media-editor-modal/index.cjs +10 -7
  19. package/build/components/media-editor-modal/index.cjs.map +1 -1
  20. package/build/components/media-editor-panel/error-boundary.cjs +68 -0
  21. package/build/components/media-editor-panel/error-boundary.cjs.map +1 -0
  22. package/build/components/media-editor-panel/index.cjs +158 -0
  23. package/build/components/media-editor-panel/index.cjs.map +1 -0
  24. package/build/components/media-form/index.cjs +7 -1
  25. package/build/components/media-form/index.cjs.map +1 -1
  26. package/build/components/media-preview/index.cjs +143 -37
  27. package/build/components/media-preview/index.cjs.map +1 -1
  28. package/build/components/rotation-ruler/index.cjs +9 -7
  29. package/build/components/rotation-ruler/index.cjs.map +1 -1
  30. package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -1
  31. package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -1
  32. package/build/index.cjs +10 -8
  33. package/build/private-apis.cjs.map +1 -1
  34. package/build/state/aspect-ratio-presets.cjs +12 -6
  35. package/build/state/aspect-ratio-presets.cjs.map +1 -1
  36. package/build/state/composite-reducer.cjs +41 -74
  37. package/build/state/composite-reducer.cjs.map +1 -1
  38. package/build/state/index.cjs +0 -39
  39. package/build/state/types.cjs +1 -2
  40. package/build/state/types.cjs.map +1 -1
  41. package/build/state/use-media-editor-state.cjs +70 -106
  42. package/build/state/use-media-editor-state.cjs.map +1 -1
  43. package/build/store/index.cjs +11 -9
  44. package/build/store/index.cjs.map +1 -1
  45. package/build/utils/get-media-type.cjs +8 -0
  46. package/build/utils/get-media-type.cjs.map +1 -1
  47. package/build/utils/index.cjs +6 -0
  48. package/build-module/components/media-editor/index.mjs +217 -117
  49. package/build-module/components/media-editor/index.mjs.map +1 -1
  50. package/build-module/components/media-editor/use-crop-options.mjs +4 -5
  51. package/build-module/components/media-editor/use-crop-options.mjs.map +1 -1
  52. package/build-module/components/media-editor/use-save-media-editor.mjs +32 -4
  53. package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -1
  54. package/build-module/components/media-editor-canvas/index.mjs +8 -13
  55. package/build-module/components/media-editor-canvas/index.mjs.map +1 -1
  56. package/build-module/components/media-editor-crop-panel/index.mjs +17 -1
  57. package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -1
  58. package/build-module/components/media-editor-fine-rotation/index.mjs +4 -5
  59. package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -1
  60. package/build-module/components/media-editor-image-controls/index.mjs +5 -7
  61. package/build-module/components/media-editor-image-controls/index.mjs.map +1 -1
  62. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +33 -33
  63. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -1
  64. package/build-module/components/media-editor-modal/index.mjs +1 -0
  65. package/build-module/components/media-editor-modal/index.mjs.map +1 -1
  66. package/build-module/components/media-editor-panel/error-boundary.mjs +63 -0
  67. package/build-module/components/media-editor-panel/error-boundary.mjs.map +1 -0
  68. package/build-module/components/media-editor-panel/index.mjs +123 -0
  69. package/build-module/components/media-editor-panel/index.mjs.map +1 -0
  70. package/build-module/components/media-form/index.mjs +7 -1
  71. package/build-module/components/media-form/index.mjs.map +1 -1
  72. package/build-module/components/media-preview/index.mjs +123 -41
  73. package/build-module/components/media-preview/index.mjs.map +1 -1
  74. package/build-module/state/aspect-ratio-presets.mjs +12 -7
  75. package/build-module/state/aspect-ratio-presets.mjs.map +1 -1
  76. package/build-module/state/composite-reducer.mjs +32 -67
  77. package/build-module/state/composite-reducer.mjs.map +1 -1
  78. package/build-module/state/index.mjs +2 -5
  79. package/build-module/state/types.mjs +1 -2
  80. package/build-module/state/types.mjs.map +1 -1
  81. package/build-module/state/use-media-editor-state.mjs +70 -105
  82. package/build-module/state/use-media-editor-state.mjs.map +1 -1
  83. package/build-module/utils/get-media-type.mjs +8 -1
  84. package/build-module/utils/get-media-type.mjs.map +1 -1
  85. package/build-module/utils/index.mjs +1 -1
  86. package/build-style/style-rtl.css +122 -87
  87. package/build-style/style.css +121 -87
  88. package/build-types/components/media-editor/index.d.ts +25 -3
  89. package/build-types/components/media-editor/index.d.ts.map +1 -1
  90. package/build-types/components/media-editor/use-crop-options.d.ts +2 -3
  91. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
  92. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
  93. package/build-types/components/media-editor-canvas/index.d.ts +3 -3
  94. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  95. package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
  96. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  97. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
  98. package/build-types/components/media-editor-image-controls/index.d.ts +1 -1
  99. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
  100. package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -1
  101. package/build-types/components/media-editor-modal/index.d.ts +1 -1
  102. package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
  103. package/build-types/components/media-editor-panel/error-boundary.d.ts +23 -0
  104. package/build-types/components/media-editor-panel/error-boundary.d.ts.map +1 -0
  105. package/build-types/components/media-editor-panel/index.d.ts +46 -0
  106. package/build-types/components/media-editor-panel/index.d.ts.map +1 -0
  107. package/build-types/components/media-form/index.d.ts.map +1 -1
  108. package/build-types/components/media-preview/index.d.ts.map +1 -1
  109. package/build-types/state/aspect-ratio-presets.d.ts +20 -3
  110. package/build-types/state/aspect-ratio-presets.d.ts.map +1 -1
  111. package/build-types/state/composite-reducer.d.ts +17 -19
  112. package/build-types/state/composite-reducer.d.ts.map +1 -1
  113. package/build-types/state/index.d.ts +2 -5
  114. package/build-types/state/index.d.ts.map +1 -1
  115. package/build-types/state/types.d.ts +20 -64
  116. package/build-types/state/types.d.ts.map +1 -1
  117. package/build-types/state/use-media-editor-state.d.ts +40 -54
  118. package/build-types/state/use-media-editor-state.d.ts.map +1 -1
  119. package/build-types/utils/get-media-type.d.ts +3 -1
  120. package/build-types/utils/get-media-type.d.ts.map +1 -1
  121. package/build-types/utils/index.d.ts +1 -1
  122. package/build-types/utils/index.d.ts.map +1 -1
  123. package/package.json +27 -24
  124. package/src/components/media-editor/index.tsx +372 -142
  125. package/src/components/media-editor/style.scss +21 -1
  126. package/src/components/media-editor/use-crop-options.ts +7 -11
  127. package/src/components/media-editor/use-save-media-editor.ts +48 -6
  128. package/src/components/media-editor-canvas/index.tsx +15 -26
  129. package/src/components/media-editor-canvas/style.scss +6 -6
  130. package/src/components/media-editor-crop-panel/index.tsx +38 -2
  131. package/src/components/media-editor-crop-panel/style.scss +21 -0
  132. package/src/components/media-editor-fine-rotation/index.tsx +6 -6
  133. package/src/components/media-editor-image-controls/index.tsx +11 -9
  134. package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +56 -63
  135. package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +1 -1
  136. package/src/components/media-editor-modal/index.tsx +4 -1
  137. package/src/components/media-editor-panel/error-boundary.tsx +88 -0
  138. package/src/components/media-editor-panel/index.tsx +211 -0
  139. package/src/components/media-form/index.tsx +7 -1
  140. package/src/components/media-preview/index.tsx +195 -37
  141. package/src/components/media-preview/style.scss +11 -32
  142. package/src/components/rotation-ruler/style.scss +3 -3
  143. package/src/state/README.md +34 -0
  144. package/src/state/aspect-ratio-presets.ts +22 -3
  145. package/src/state/composite-reducer.ts +42 -80
  146. package/src/state/index.ts +2 -18
  147. package/src/state/types.ts +18 -68
  148. package/src/state/use-media-editor-state.ts +162 -242
  149. package/src/style.scss +2 -1
  150. package/src/utils/get-media-type.ts +9 -1
  151. package/src/utils/index.ts +1 -1
  152. package/build/components/media-editor-modal/build-modifiers.cjs +0 -110
  153. package/build/components/media-editor-modal/build-modifiers.cjs.map +0 -1
  154. package/build/image-editor/core/camera.cjs +0 -277
  155. package/build/image-editor/core/camera.cjs.map +0 -1
  156. package/build/image-editor/core/constants.cjs +0 -133
  157. package/build/image-editor/core/constants.cjs.map +0 -1
  158. package/build/image-editor/core/containment.cjs +0 -289
  159. package/build/image-editor/core/containment.cjs.map +0 -1
  160. package/build/image-editor/core/crop-rect.cjs +0 -37
  161. package/build/image-editor/core/crop-rect.cjs.map +0 -1
  162. package/build/image-editor/core/export/canvas-renderer.cjs +0 -181
  163. package/build/image-editor/core/export/canvas-renderer.cjs.map +0 -1
  164. package/build/image-editor/core/index.cjs +0 -89
  165. package/build/image-editor/core/interaction-controller.cjs +0 -591
  166. package/build/image-editor/core/interaction-controller.cjs.map +0 -1
  167. package/build/image-editor/core/math/rotation.cjs +0 -32
  168. package/build/image-editor/core/math/rotation.cjs.map +0 -1
  169. package/build/image-editor/core/math/sanitize.cjs +0 -136
  170. package/build/image-editor/core/math/sanitize.cjs.map +0 -1
  171. package/build/image-editor/core/setter-helpers.cjs +0 -61
  172. package/build/image-editor/core/setter-helpers.cjs.map +0 -1
  173. package/build/image-editor/core/source-region.cjs +0 -236
  174. package/build/image-editor/core/source-region.cjs.map +0 -1
  175. package/build/image-editor/core/state.cjs +0 -296
  176. package/build/image-editor/core/state.cjs.map +0 -1
  177. package/build/image-editor/core/stencil-math.cjs +0 -203
  178. package/build/image-editor/core/stencil-math.cjs.map +0 -1
  179. package/build/image-editor/core/transform-style.cjs +0 -43
  180. package/build/image-editor/core/transform-style.cjs.map +0 -1
  181. package/build/image-editor/core/transforms/pipeline.cjs +0 -41
  182. package/build/image-editor/core/transforms/pipeline.cjs.map +0 -1
  183. package/build/image-editor/core/types.cjs +0 -5
  184. package/build/image-editor/core/viewport-state.cjs +0 -36
  185. package/build/image-editor/core/viewport-state.cjs.map +0 -1
  186. package/build/image-editor/index.cjs +0 -68
  187. package/build/image-editor/react/components/cropper-provider.cjs +0 -49
  188. package/build/image-editor/react/components/cropper-provider.cjs.map +0 -1
  189. package/build/image-editor/react/components/cropper.cjs +0 -595
  190. package/build/image-editor/react/components/cropper.cjs.map +0 -1
  191. package/build/image-editor/react/components/index.cjs +0 -25
  192. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +0 -147
  193. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +0 -1
  194. package/build/image-editor/react/components/overlays/dimming-overlay.cjs +0 -31
  195. package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +0 -1
  196. package/build/image-editor/react/components/overlays/grid-overlay.cjs +0 -61
  197. package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +0 -1
  198. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +0 -367
  199. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +0 -1
  200. package/build/image-editor/react/components/viewport-provider.cjs +0 -26
  201. package/build/image-editor/react/components/viewport-provider.cjs.map +0 -1
  202. package/build/image-editor/react/hooks/build-cropper-setters.cjs +0 -80
  203. package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +0 -1
  204. package/build/image-editor/react/hooks/index.cjs +0 -19
  205. package/build/image-editor/react/hooks/use-aria-announcer.cjs +0 -104
  206. package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +0 -1
  207. package/build/image-editor/react/hooks/use-cropper-controller.cjs +0 -80
  208. package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +0 -1
  209. package/build/image-editor/react/hooks/use-interaction.cjs +0 -187
  210. package/build/image-editor/react/hooks/use-interaction.cjs.map +0 -1
  211. package/build/image-editor/react/hooks/use-transform-style.cjs +0 -24
  212. package/build/image-editor/react/hooks/use-transform-style.cjs.map +0 -1
  213. package/build/image-editor/react/hooks/use-viewport-state.cjs +0 -40
  214. package/build/image-editor/react/hooks/use-viewport-state.cjs.map +0 -1
  215. package/build/image-editor/react/visually-hidden-style.cjs +0 -24
  216. package/build/image-editor/react/visually-hidden-style.cjs.map +0 -1
  217. package/build-module/components/media-editor-modal/build-modifiers.mjs +0 -105
  218. package/build-module/components/media-editor-modal/build-modifiers.mjs.map +0 -1
  219. package/build-module/image-editor/core/camera.mjs +0 -265
  220. package/build-module/image-editor/core/camera.mjs.map +0 -1
  221. package/build-module/image-editor/core/constants.mjs +0 -115
  222. package/build-module/image-editor/core/constants.mjs.map +0 -1
  223. package/build-module/image-editor/core/containment.mjs +0 -281
  224. package/build-module/image-editor/core/containment.mjs.map +0 -1
  225. package/build-module/image-editor/core/crop-rect.mjs +0 -32
  226. package/build-module/image-editor/core/crop-rect.mjs.map +0 -1
  227. package/build-module/image-editor/core/export/canvas-renderer.mjs +0 -170
  228. package/build-module/image-editor/core/export/canvas-renderer.mjs.map +0 -1
  229. package/build-module/image-editor/core/index.mjs +0 -7
  230. package/build-module/image-editor/core/interaction-controller.mjs +0 -586
  231. package/build-module/image-editor/core/interaction-controller.mjs.map +0 -1
  232. package/build-module/image-editor/core/math/rotation.mjs +0 -26
  233. package/build-module/image-editor/core/math/rotation.mjs.map +0 -1
  234. package/build-module/image-editor/core/math/sanitize.mjs +0 -127
  235. package/build-module/image-editor/core/math/sanitize.mjs.map +0 -1
  236. package/build-module/image-editor/core/setter-helpers.mjs +0 -56
  237. package/build-module/image-editor/core/setter-helpers.mjs.map +0 -1
  238. package/build-module/image-editor/core/source-region.mjs +0 -228
  239. package/build-module/image-editor/core/source-region.mjs.map +0 -1
  240. package/build-module/image-editor/core/state.mjs +0 -288
  241. package/build-module/image-editor/core/state.mjs.map +0 -1
  242. package/build-module/image-editor/core/stencil-math.mjs +0 -194
  243. package/build-module/image-editor/core/stencil-math.mjs.map +0 -1
  244. package/build-module/image-editor/core/transform-style.mjs +0 -38
  245. package/build-module/image-editor/core/transform-style.mjs.map +0 -1
  246. package/build-module/image-editor/core/transforms/pipeline.mjs +0 -35
  247. package/build-module/image-editor/core/transforms/pipeline.mjs.map +0 -1
  248. package/build-module/image-editor/core/types.mjs +0 -0
  249. package/build-module/image-editor/core/viewport-state.mjs +0 -30
  250. package/build-module/image-editor/core/viewport-state.mjs.map +0 -1
  251. package/build-module/image-editor/index.mjs +0 -4
  252. package/build-module/image-editor/react/components/cropper-provider.mjs +0 -43
  253. package/build-module/image-editor/react/components/cropper-provider.mjs.map +0 -1
  254. package/build-module/image-editor/react/components/cropper.mjs +0 -568
  255. package/build-module/image-editor/react/components/cropper.mjs.map +0 -1
  256. package/build-module/image-editor/react/components/index.mjs +0 -3
  257. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +0 -142
  258. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +0 -1
  259. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +0 -26
  260. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +0 -1
  261. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +0 -56
  262. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +0 -1
  263. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +0 -362
  264. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +0 -1
  265. package/build-module/image-editor/react/components/viewport-provider.mjs +0 -20
  266. package/build-module/image-editor/react/components/viewport-provider.mjs.map +0 -1
  267. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +0 -75
  268. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +0 -1
  269. package/build-module/image-editor/react/hooks/index.mjs +0 -3
  270. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +0 -99
  271. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +0 -1
  272. package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +0 -75
  273. package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +0 -1
  274. package/build-module/image-editor/react/hooks/use-interaction.mjs +0 -182
  275. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +0 -1
  276. package/build-module/image-editor/react/hooks/use-transform-style.mjs +0 -19
  277. package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +0 -1
  278. package/build-module/image-editor/react/hooks/use-viewport-state.mjs +0 -35
  279. package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +0 -1
  280. package/build-module/image-editor/react/visually-hidden-style.mjs +0 -19
  281. package/build-module/image-editor/react/visually-hidden-style.mjs.map +0 -1
  282. package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -81
  283. package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +0 -1
  284. package/build-types/image-editor/core/camera.d.ts +0 -128
  285. package/build-types/image-editor/core/camera.d.ts.map +0 -1
  286. package/build-types/image-editor/core/constants.d.ts +0 -98
  287. package/build-types/image-editor/core/constants.d.ts.map +0 -1
  288. package/build-types/image-editor/core/containment.d.ts +0 -72
  289. package/build-types/image-editor/core/containment.d.ts.map +0 -1
  290. package/build-types/image-editor/core/crop-rect.d.ts +0 -16
  291. package/build-types/image-editor/core/crop-rect.d.ts.map +0 -1
  292. package/build-types/image-editor/core/export/canvas-renderer.d.ts +0 -103
  293. package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +0 -1
  294. package/build-types/image-editor/core/index.d.ts +0 -10
  295. package/build-types/image-editor/core/index.d.ts.map +0 -1
  296. package/build-types/image-editor/core/interaction-controller.d.ts +0 -191
  297. package/build-types/image-editor/core/interaction-controller.d.ts.map +0 -1
  298. package/build-types/image-editor/core/math/rotation.d.ts +0 -18
  299. package/build-types/image-editor/core/math/rotation.d.ts.map +0 -1
  300. package/build-types/image-editor/core/math/sanitize.d.ts +0 -67
  301. package/build-types/image-editor/core/math/sanitize.d.ts.map +0 -1
  302. package/build-types/image-editor/core/setter-helpers.d.ts +0 -21
  303. package/build-types/image-editor/core/setter-helpers.d.ts.map +0 -1
  304. package/build-types/image-editor/core/source-region.d.ts +0 -94
  305. package/build-types/image-editor/core/source-region.d.ts.map +0 -1
  306. package/build-types/image-editor/core/state.d.ts +0 -51
  307. package/build-types/image-editor/core/state.d.ts.map +0 -1
  308. package/build-types/image-editor/core/stencil-math.d.ts +0 -102
  309. package/build-types/image-editor/core/stencil-math.d.ts.map +0 -1
  310. package/build-types/image-editor/core/transform-style.d.ts +0 -20
  311. package/build-types/image-editor/core/transform-style.d.ts.map +0 -1
  312. package/build-types/image-editor/core/transforms/pipeline.d.ts +0 -24
  313. package/build-types/image-editor/core/transforms/pipeline.d.ts.map +0 -1
  314. package/build-types/image-editor/core/types.d.ts +0 -269
  315. package/build-types/image-editor/core/types.d.ts.map +0 -1
  316. package/build-types/image-editor/core/viewport-state.d.ts +0 -4
  317. package/build-types/image-editor/core/viewport-state.d.ts.map +0 -1
  318. package/build-types/image-editor/index.d.ts +0 -17
  319. package/build-types/image-editor/index.d.ts.map +0 -1
  320. package/build-types/image-editor/react/components/cropper-provider.d.ts +0 -38
  321. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +0 -1
  322. package/build-types/image-editor/react/components/cropper.d.ts +0 -54
  323. package/build-types/image-editor/react/components/cropper.d.ts.map +0 -1
  324. package/build-types/image-editor/react/components/index.d.ts +0 -4
  325. package/build-types/image-editor/react/components/index.d.ts.map +0 -1
  326. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +0 -33
  327. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +0 -1
  328. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +0 -17
  329. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +0 -1
  330. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +0 -27
  331. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +0 -1
  332. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +0 -33
  333. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +0 -1
  334. package/build-types/image-editor/react/components/viewport-provider.d.ts +0 -6
  335. package/build-types/image-editor/react/components/viewport-provider.d.ts.map +0 -1
  336. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +0 -44
  337. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +0 -1
  338. package/build-types/image-editor/react/hooks/index.d.ts +0 -5
  339. package/build-types/image-editor/react/hooks/index.d.ts.map +0 -1
  340. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +0 -14
  341. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +0 -1
  342. package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts +0 -55
  343. package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts.map +0 -1
  344. package/build-types/image-editor/react/hooks/use-interaction.d.ts +0 -65
  345. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +0 -1
  346. package/build-types/image-editor/react/hooks/use-transform-style.d.ts +0 -13
  347. package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +0 -1
  348. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +0 -16
  349. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +0 -1
  350. package/build-types/image-editor/react/visually-hidden-style.d.ts +0 -6
  351. package/build-types/image-editor/react/visually-hidden-style.d.ts.map +0 -1
  352. package/src/components/media-editor-modal/build-modifiers.ts +0 -167
  353. package/src/image-editor/README.md +0 -61
  354. package/src/image-editor/core/camera.ts +0 -429
  355. package/src/image-editor/core/constants.ts +0 -137
  356. package/src/image-editor/core/containment.ts +0 -469
  357. package/src/image-editor/core/crop-rect.ts +0 -42
  358. package/src/image-editor/core/export/canvas-renderer.ts +0 -250
  359. package/src/image-editor/core/index.ts +0 -43
  360. package/src/image-editor/core/interaction-controller.ts +0 -976
  361. package/src/image-editor/core/math/rotation.ts +0 -26
  362. package/src/image-editor/core/math/sanitize.ts +0 -155
  363. package/src/image-editor/core/setter-helpers.ts +0 -63
  364. package/src/image-editor/core/source-region.ts +0 -367
  365. package/src/image-editor/core/state.ts +0 -484
  366. package/src/image-editor/core/stencil-math.ts +0 -379
  367. package/src/image-editor/core/transform-style.ts +0 -56
  368. package/src/image-editor/core/transforms/pipeline.ts +0 -40
  369. package/src/image-editor/core/types.ts +0 -230
  370. package/src/image-editor/core/viewport-state.ts +0 -30
  371. package/src/image-editor/docs/architecture.md +0 -63
  372. package/src/image-editor/docs/recipes.md +0 -184
  373. package/src/image-editor/index.ts +0 -43
  374. package/src/image-editor/react/components/cropper-provider.tsx +0 -70
  375. package/src/image-editor/react/components/cropper.scss +0 -259
  376. package/src/image-editor/react/components/cropper.tsx +0 -1108
  377. package/src/image-editor/react/components/index.ts +0 -3
  378. package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +0 -262
  379. package/src/image-editor/react/components/overlays/dimming-overlay.tsx +0 -55
  380. package/src/image-editor/react/components/overlays/grid-overlay.tsx +0 -77
  381. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +0 -623
  382. package/src/image-editor/react/components/viewport-provider.tsx +0 -32
  383. package/src/image-editor/react/hooks/build-cropper-setters.ts +0 -102
  384. package/src/image-editor/react/hooks/index.ts +0 -4
  385. package/src/image-editor/react/hooks/use-aria-announcer.ts +0 -193
  386. package/src/image-editor/react/hooks/use-cropper-controller.ts +0 -197
  387. package/src/image-editor/react/hooks/use-interaction.ts +0 -294
  388. package/src/image-editor/react/hooks/use-transform-style.ts +0 -23
  389. package/src/image-editor/react/hooks/use-viewport-state.ts +0 -41
  390. package/src/image-editor/react/visually-hidden-style.ts +0 -15
  391. package/src/image-editor/style.scss +0 -1
@@ -1,5 +1,4 @@
1
1
  @use "@wordpress/base-styles/animations" as *;
2
- @use "@wordpress/base-styles/colors" as *;
3
2
  @use "@wordpress/base-styles/variables" as *;
4
3
 
5
4
  .media-editor-preview {
@@ -65,39 +64,19 @@
65
64
  border-radius: $radius-small;
66
65
  }
67
66
 
68
- &__file-info {
69
- text-align: center;
70
- background: $gray-100;
71
- padding: $grid-unit-30;
72
- border-radius: 2px;
73
- }
74
-
67
+ // Long filenames often have no spaces to break on.
75
68
  &__file-name {
76
- font-weight: var(--wpds-typography-font-weight-emphasis);
77
- margin-bottom: $grid-unit-10;
69
+ overflow-wrap: anywhere;
78
70
  }
79
71
 
80
- &__mime-type {
81
- color: $gray-700;
82
- font-size: 0.9em;
83
- margin-bottom: $grid-unit-20;
84
- }
85
-
86
- &__download-link {
87
- display: inline-block;
88
- margin-top: $grid-unit-10;
89
- }
90
-
91
- &--error,
92
- &--empty {
93
- color: $gray-700;
94
- text-align: center;
95
- }
96
-
97
- &__url {
98
- font-size: 0.9em;
99
- color: $gray-600;
100
- word-break: break-all;
101
- margin-top: $grid-unit-10;
72
+ // EmptyState.Actions switches between a column and a row on the viewport
73
+ // width, and the row doesn't wrap. The canvas can be narrow on a wide
74
+ // viewport, e.g. with the Details panel open, so wrap a row instead. Also
75
+ // widen its 4px gap between buttons.
76
+ &__actions {
77
+ flex-direction: row;
78
+ flex-wrap: wrap;
79
+ justify-content: center;
80
+ gap: var(--wpds-dimension-gap-sm);
102
81
  }
103
82
  }
@@ -18,8 +18,7 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
18
18
  height: 32px;
19
19
  padding: 0 $grid-unit-10;
20
20
  box-sizing: border-box;
21
- color: $gray-900;
22
- font-family: $font-family-body;
21
+ font-family: var(--wpds-typography-font-family-body);
23
22
  user-select: none;
24
23
  touch-action: none;
25
24
  cursor: ew-resize;
@@ -89,6 +88,8 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
89
88
 
90
89
  .rotation-ruler__ticks {
91
90
  position: absolute;
91
+ // Keep SVG ticks visible when the browser forces dark colors.
92
+ color: CanvasText;
92
93
  // The tick offset is applied as a JS-set inline `transform: translateX()`
93
94
  // (see rotation-ruler/index.tsx), which rtlcss can't mirror. If rtlcss
94
95
  // flipped this `left` to `right`, the anchor and the transform would
@@ -145,7 +146,6 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
145
146
  font-size: 12px;
146
147
  font-weight: var(--wpds-typography-font-weight-emphasis);
147
148
  line-height: 14px;
148
- color: $gray-900;
149
149
  pointer-events: none;
150
150
 
151
151
  &::before {
@@ -0,0 +1,34 @@
1
+ # Media Editor Session
2
+
3
+ The media editor's session owns its undo and redo history. The image editor's state from `@wordpress/image-editor` is one slice of the session's state, next to the sidebar crop options and named edits, kept through `useImageEditor( { state, onChange } )`, so one history covers them all.
4
+
5
+ `useMediaEditorState()` creates a media editor session; `<MediaEditorStateProvider>` calls it, and `useMediaEditor()` reads the one it made. Calling `useMediaEditorState()` again inside the provider makes a second session that shares nothing with the first, so components use `useMediaEditor()`. The session owns the source image, every editing slice, the shared undo/redo history, gesture boundaries, and whether the edits change the saved image (`hasOutputEdits`). The image editor is one participant: `session.imageEditor` is a geometry-only `ImageEditorController` that an `<ImageEditorCanvas>` takes via its `controller` prop, and its `isDirty` covers geometry alone. Replacing the source image (`setSourceImage`, which the image editor's `setImage` also calls) starts a fresh session with default geometry and crop options, a clean baseline, and no history. Save code asks the session, not the image editor, whether image output needs saving.
6
+
7
+ The session also holds named edits other than crop: `session.edits`, set with `session.setEdit( name, value )` and removed by passing `undefined`. They share the crop history, so undo, redo and gestures treat them like any crop change, and a different source image clears them. Values are plain data (`EditValue`: strings, numbers, booleans, `null`, and arrays and objects of those), because the session compares them by content to tell a real change from a no-op. They are session state for the editor's own edit pipeline, not an extension API. `isDirty` counts them, so Reset clears them; `hasOutputEdits` does not, so the editor's unsaved-changes check and Save ignore them, and nothing persists them. That holds until the pipeline applies them to the output, and a panel has no reason to set one before then.
8
+
9
+ `session.reset()` puts every slice back to its starting state in one undo entry: default geometry and crop options, no edits, same image. The Reset button calls it; it does not compose per-slice resets itself.
10
+
11
+ Sidebar panels are React: a `MediaEditorPanel` rendered anywhere inside the editor announces `{ name, title, mediaTypes }` while mounted and fills a slot with its content, and the sidebar turns the mounted panels into tabs. Core's Crop and Details panels are rendered with that component, so the editor itself exercises the extension point. The editor also mounts `registerPlugin` callbacks in the `media-editor` scope through `PluginArea`, inside the session provider. This follows the post editor's `PluginSidebar`: plugin UI arrives as components through Slot/Fill, not as entries in a store.
12
+
13
+ ## Use the Session With the Canvas
14
+
15
+ Use the media editor session when image editor state must share history with controls such as aspect ratio. The session owns history and gesture boundaries; pass its `imageEditor` controller to `<ImageEditorCanvas>`.
16
+
17
+ ```tsx
18
+ import { ImageEditorCanvas } from '@wordpress/image-editor';
19
+ import { useMediaEditor } from '../state';
20
+
21
+ function MediaEditorCanvas( { src }: { src: string } ) {
22
+ const session = useMediaEditor();
23
+
24
+ return (
25
+ <ImageEditorCanvas
26
+ src={ src }
27
+ controller={ session.imageEditor }
28
+ freeformCrop
29
+ onGestureStart={ session.beginGesture }
30
+ onGestureEnd={ session.endGesture }
31
+ />
32
+ );
33
+ }
34
+ ```
@@ -1,9 +1,28 @@
1
1
  import { __ } from '@wordpress/i18n';
2
- import { ORIGINAL_ASPECT_RATIO, type AspectRatioPreset } from '../image-editor';
3
2
 
4
3
  /**
5
- * The presets the editor offers by default. The labels live here rather
6
- * than in the cropper core, which has no user-facing strings.
4
+ * An aspect ratio preset with a human-readable label.
5
+ */
6
+ export interface AspectRatioPreset {
7
+ /** Display label (e.g., "Square (1:1)"). */
8
+ label: string;
9
+ /**
10
+ * The aspect ratio value (width / height). 0 = free,
11
+ * `ORIGINAL_ASPECT_RATIO` = the image's own ratio.
12
+ */
13
+ value: number;
14
+ }
15
+
16
+ /**
17
+ * Sentinel value for "Original" aspect ratio — resolved at runtime
18
+ * to the image's natural width / height.
19
+ */
20
+ export const ORIGINAL_ASPECT_RATIO = -1;
21
+
22
+ /**
23
+ * The presets the editor offers by default. They live here rather than
24
+ * in the image editor package, because which ratios to offer, and what
25
+ * to call them, is a product choice. The package takes a plain number.
7
26
  */
8
27
  export const DEFAULT_ASPECT_RATIOS: AspectRatioPreset[] = [
9
28
  { label: __( 'Free' ), value: 0 },
@@ -1,81 +1,47 @@
1
1
  import fastDeepEqual from 'fast-deep-equal/es6/index.js';
2
- import type { CropperState } from '../image-editor';
3
2
  import {
4
- cropperReducer,
5
- areCropperStatesEqual,
6
- computeInscribedRect,
7
- } from '../image-editor/core';
3
+ areImageEditorStatesEqual,
4
+ createImageEditorState,
5
+ type ImageEditorState,
6
+ } from '@wordpress/image-editor';
8
7
  import {
9
8
  DEFAULT_CROP_OPTIONS,
10
- type CropOptionsSlice,
11
9
  type MediaEditorAction,
12
10
  type MediaEditorState,
13
11
  } from './types';
14
12
 
15
13
  /**
16
- * Pure composite reducer for the media editor.
14
+ * Pure reducer for the media editor.
17
15
  *
18
- * Delegates `CROPPER`-tagged actions to the framework-agnostic
19
- * `cropperReducer` and owns first-class transitions for the sidebar
20
- * `cropOptions` slice. `RESTORE_SNAPSHOT` replaces the whole composite
21
- * in one transaction (used by undo/redo).
16
+ * The image editor works out its own next state (through the controller from
17
+ * `@wordpress/image-editor`) and this reducer stores it. The reducer
18
+ * also owns the sidebar crop options and the named edits.
22
19
  *
23
- * Note: this reducer carries NO history of its own. Snapshots and
24
- * stacks live in the `useMediaEditorState` hook that wraps it.
20
+ * This reducer keeps no history; `useMediaEditorState` does.
25
21
  *
26
- * @param state Current composite state.
22
+ * @param state Current state.
27
23
  * @param action Action to apply.
28
- * @return Next composite state.
24
+ * @return Next state.
29
25
  */
30
26
  export function mediaEditorReducer(
31
27
  state: MediaEditorState,
32
28
  action: MediaEditorAction
33
29
  ): MediaEditorState {
34
30
  switch ( action.type ) {
35
- case 'CROPPER': {
36
- const nextCropper = cropperReducer( state.cropper, action.action );
37
- if ( nextCropper === state.cropper ) {
38
- return state;
39
- }
40
- return { ...state, cropper: nextCropper };
41
- }
42
- case 'SET_ASPECT_RATIO_VALUE': {
43
- const { presetKey, resolved, visualSize } = action.payload;
44
- // Atomically: update the preset key AND reshape the
45
- // cropRect (when the ratio is non-Free and we have a
46
- // visualSize). One transaction = one undo entry.
47
- const shouldReshape =
48
- resolved !== undefined &&
49
- resolved > 0 &&
50
- visualSize.width > 0 &&
51
- visualSize.height > 0;
52
- const nextCropOptions: CropOptionsSlice = {
53
- ...state.cropOptions,
54
- aspectRatioValue: presetKey,
55
- };
56
- if ( ! shouldReshape ) {
57
- if ( state.cropOptions.aspectRatioValue === presetKey ) {
58
- return state;
59
- }
60
- return { ...state, cropOptions: nextCropOptions };
61
- }
62
- const newCropRect = computeInscribedRect( resolved, visualSize );
63
- const nextCropper = cropperReducer( state.cropper, {
64
- type: 'SET_CROP_RECT',
65
- payload: newCropRect,
66
- } );
67
- return {
68
- ...state,
69
- cropper: nextCropper,
70
- cropOptions: nextCropOptions,
71
- };
72
- }
73
- case 'RESET': {
74
- const next = buildInitialMediaEditorState(
75
- cropperReducer( state.cropper, { type: 'RESET' } )
76
- );
77
- return areMediaEditorStatesEqual( state, next ) ? state : next;
78
- }
31
+ case 'SET_IMAGE_EDITOR':
32
+ return action.payload === state.imageEditor
33
+ ? state
34
+ : { ...state, imageEditor: action.payload };
35
+ case 'SET_ASPECT_RATIO_VALUE':
36
+ return state.cropOptions.aspectRatioValue === action.payload
37
+ ? state
38
+ : {
39
+ ...state,
40
+ cropOptions: {
41
+ ...state.cropOptions,
42
+ aspectRatioValue: action.payload,
43
+ },
44
+ };
79
45
  case 'SET_EDIT': {
80
46
  const { name, value } = action.payload;
81
47
  if ( value === undefined ) {
@@ -91,27 +57,23 @@ export function mediaEditorReducer(
91
57
  }
92
58
  return { ...state, edits: { ...state.edits, [ name ]: value } };
93
59
  }
60
+ case 'RESET': {
61
+ const next = buildInitialMediaEditorState(
62
+ createImageEditorState( { image: state.imageEditor.image } )
63
+ );
64
+ return areMediaEditorStatesEqual( state, next ) ? state : next;
65
+ }
94
66
  case 'RESTORE_SNAPSHOT':
95
67
  return action.payload;
96
- case 'VIEWPORT_ADJUST_CROP_RECT': {
97
- const nextCropper = cropperReducer( state.cropper, {
98
- type: 'SET_CROP_RECT',
99
- payload: action.payload,
100
- } );
101
- if ( nextCropper === state.cropper ) {
102
- return state;
103
- }
104
- return { ...state, cropper: nextCropper };
105
- }
106
68
  }
107
69
  }
108
70
 
109
71
  /**
110
- * Value-equality check for two composite states. Used by the history
111
- * machinery to dedup snapshots when an action turned out to be a no-op.
72
+ * Value-equality check for two media editor states. The history uses it
73
+ * to skip snapshots when an action turned out to be a no-op.
112
74
  *
113
- * @param a First composite state.
114
- * @param b Second composite state.
75
+ * @param a First state.
76
+ * @param b Second state.
115
77
  * @return Whether `a` and `b` are value-equal across all slices.
116
78
  */
117
79
  export function areMediaEditorStatesEqual(
@@ -122,24 +84,24 @@ export function areMediaEditorStatesEqual(
122
84
  return true;
123
85
  }
124
86
  return (
125
- areCropperStatesEqual( a.cropper, b.cropper ) &&
87
+ areImageEditorStatesEqual( a.imageEditor, b.imageEditor ) &&
126
88
  a.cropOptions.aspectRatioValue === b.cropOptions.aspectRatioValue &&
127
89
  fastDeepEqual( a.edits, b.edits )
128
90
  );
129
91
  }
130
92
 
131
93
  /**
132
- * Build the composite state a session starts from: the given cropper
133
- * slice, default crop options, and no edits.
94
+ * Build the state a session starts from: the given image editor state,
95
+ * default crop options, and no edits.
134
96
  *
135
- * @param cropper The cropper slice.
136
- * @return Composite initial state.
97
+ * @param imageEditor The image editor state.
98
+ * @return Initial state.
137
99
  */
138
100
  export function buildInitialMediaEditorState(
139
- cropper: CropperState
101
+ imageEditor: ImageEditorState
140
102
  ): MediaEditorState {
141
103
  return {
142
- cropper,
104
+ imageEditor,
143
105
  cropOptions: { ...DEFAULT_CROP_OPTIONS },
144
106
  edits: {},
145
107
  };
@@ -1,23 +1,7 @@
1
- export {
2
- useMediaEditorState,
3
- resolveAspectRatio,
4
- } from './use-media-editor-state';
1
+ export { useMediaEditorState } from './use-media-editor-state';
5
2
  export type { MediaEditorSession } from './use-media-editor-state';
6
3
  export {
7
4
  MediaEditorStateProvider,
8
5
  useMediaEditor,
9
6
  } from './media-editor-state-provider';
10
- export {
11
- mediaEditorReducer,
12
- areMediaEditorStatesEqual,
13
- buildInitialMediaEditorState,
14
- } from './composite-reducer';
15
- export { DEFAULT_CROP_OPTIONS } from './types';
16
- export { DEFAULT_ASPECT_RATIOS } from './aspect-ratio-presets';
17
- export type {
18
- CropOptionsSlice,
19
- EditsSlice,
20
- EditValue,
21
- MediaEditorState,
22
- MediaEditorAction,
23
- } from './types';
7
+ export type { EditsSlice, EditValue, MediaEditorState } from './types';
@@ -1,22 +1,20 @@
1
- import type { CropperState, NormalizedRect, Size } from '../image-editor';
2
- import type { CropperAction } from '../image-editor/core';
1
+ import type { ImageEditorState } from '@wordpress/image-editor';
3
2
 
4
3
  /**
5
- * Sidebar control state for the cropper. Lives in the composite store
6
- * so it participates in the same undo history as cropper geometry.
4
+ * Sidebar control state for the image editor, kept in the same undo history
5
+ * as the crop.
7
6
  */
8
7
  export interface CropOptionsSlice {
9
8
  /**
10
9
  * Selected aspect-ratio preset as a string (round-trippable through
11
10
  * `<SelectControl>`). `'0'` = Free, `'-1'` = Original, any positive
12
- * decimal = fixed ratio.
11
+ * decimal = fixed ratio. The image editor holds the resolved ratio itself.
13
12
  */
14
13
  aspectRatioValue: string;
15
14
  }
16
15
 
17
16
  /**
18
- * Default values for the crop-options slice. Mirrors the initial state
19
- * used by the sidebar before the user has touched anything.
17
+ * The crop options a session starts from.
20
18
  */
21
19
  export const DEFAULT_CROP_OPTIONS: CropOptionsSlice = {
22
20
  aspectRatioValue: '0',
@@ -46,81 +44,33 @@ export type EditValue =
46
44
  export type EditsSlice = Record< string, EditValue >;
47
45
 
48
46
  /**
49
- * The full composite state for the media editor — cropper geometry,
50
- * the sidebar control slice, and named edits.
47
+ * The full state of the media editor: the image editor's state, the sidebar
48
+ * crop options and named edits.
51
49
  *
52
50
  * Every undo/redo snapshot is a full `MediaEditorState`. Slices stay
53
51
  * referentially equal across actions that don't touch them.
54
52
  */
55
53
  export interface MediaEditorState {
56
- cropper: CropperState;
54
+ imageEditor: ImageEditorState;
57
55
  cropOptions: CropOptionsSlice;
58
56
  edits: EditsSlice;
59
57
  }
60
58
 
61
- /**
62
- * Composite reducer action union.
63
- *
64
- * Cropper geometry actions are wrapped in a `CROPPER` envelope and
65
- * delegated to the pure `cropperReducer`. Sidebar and history
66
- * concerns are first-class actions on this reducer.
67
- */
59
+ /** Actions the media editor reducer handles. */
68
60
  export type MediaEditorAction =
69
- /**
70
- * Delegate to the underlying cropper reducer. Used for every
71
- * geometry transition (pan / zoom / rotation / flip / cropRect /
72
- * settle / etc.).
73
- */
74
- | {
75
- type: 'CROPPER';
76
- action: CropperAction;
77
- }
78
- /**
79
- * Set the aspect-ratio preset. Atomically updates the preset key
80
- * and the cropRect (computed from the resolved ratio and the
81
- * current visualSize). One transaction = one undo entry.
82
- */
83
- | {
84
- type: 'SET_ASPECT_RATIO_VALUE';
85
- payload: {
86
- /** Preset key as it appears in the dropdown. */
87
- presetKey: string;
88
- /**
89
- * Resolved width/height ratio. `undefined` = Free
90
- * (no lock; cropRect stays where it is).
91
- */
92
- resolved: number | undefined;
93
- /**
94
- * Rendered image size used to compute the inscribed
95
- * rect. Caller supplies it because the reducer is
96
- * framework-agnostic and has no DOM access.
97
- */
98
- visualSize: Size;
99
- };
100
- }
101
- /**
102
- * Put every slice back to its starting state, keeping the image:
103
- * default geometry, default crop options, no edits. One action,
104
- * so one undo entry.
105
- */
106
- | { type: 'RESET' }
61
+ /** Replace the image editor's state with the next one it reports. */
62
+ | { type: 'SET_IMAGE_EDITOR'; payload: ImageEditorState }
63
+ /** Set the aspect-ratio preset the dropdown shows. */
64
+ | { type: 'SET_ASPECT_RATIO_VALUE'; payload: string }
107
65
  /** Set a named edit, or remove it when `value` is `undefined`. */
108
66
  | {
109
67
  type: 'SET_EDIT';
110
68
  payload: { name: string; value: EditValue | undefined };
111
69
  }
112
70
  /**
113
- * Replace the entire composite state with `payload`. Used by
114
- * undo/redo to restore a full snapshot atomically.
71
+ * Put every slice back to its starting state, keeping the image. One
72
+ * action, so one undo entry.
115
73
  */
116
- | { type: 'RESTORE_SNAPSHOT'; payload: MediaEditorState }
117
- /**
118
- * Adjust the cropper's cropRect in response to a viewport change
119
- * (e.g., window resize). Behaviorally identical to a `CROPPER
120
- * SET_CROP_RECT` dispatch, but tagged so the hook layer can skip
121
- * history recording — viewport reshapes aren't editor actions.
122
- */
123
- | {
124
- type: 'VIEWPORT_ADJUST_CROP_RECT';
125
- payload: NormalizedRect;
126
- };
74
+ | { type: 'RESET' }
75
+ /** Replace the whole state with a snapshot (undo/redo). */
76
+ | { type: 'RESTORE_SNAPSHOT'; payload: MediaEditorState };