@wordpress/media-editor 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/build/components/media-editor/index.cjs +212 -170
  2. package/build/components/media-editor/index.cjs.map +3 -3
  3. package/build/components/media-editor/use-crop-options.cjs +63 -0
  4. package/build/components/media-editor/use-crop-options.cjs.map +7 -0
  5. package/build/components/media-editor/use-save-media-editor.cjs +185 -0
  6. package/build/components/media-editor/use-save-media-editor.cjs.map +7 -0
  7. package/build/components/media-editor-canvas/index.cjs +33 -12
  8. package/build/components/media-editor-canvas/index.cjs.map +2 -2
  9. package/build/components/media-editor-crop-panel/index.cjs +70 -84
  10. package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
  11. package/build/components/media-editor-fine-rotation/index.cjs +81 -0
  12. package/build/components/media-editor-fine-rotation/index.cjs.map +7 -0
  13. package/build/components/media-editor-modal/index.cjs +63 -16
  14. package/build/components/media-editor-modal/index.cjs.map +3 -3
  15. package/build/components/media-editor-transform-controls/index.cjs +84 -0
  16. package/build/components/media-editor-transform-controls/index.cjs.map +7 -0
  17. package/build/components/media-form/index.cjs +19 -1
  18. package/build/components/media-form/index.cjs.map +3 -3
  19. package/build/components/media-form/sidebar-datetime-view.cjs +53 -0
  20. package/build/components/media-form/sidebar-datetime-view.cjs.map +7 -0
  21. package/build/components/rotation-ruler/index.cjs +8 -2
  22. package/build/components/rotation-ruler/index.cjs.map +2 -2
  23. package/build/hooks/use-crop-gesture-handlers.cjs +41 -4
  24. package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
  25. package/build/image-editor/core/camera.cjs +29 -11
  26. package/build/image-editor/core/camera.cjs.map +2 -2
  27. package/build/image-editor/core/constants.cjs +6 -0
  28. package/build/image-editor/core/constants.cjs.map +2 -2
  29. package/build/image-editor/core/containment.cjs +71 -34
  30. package/build/image-editor/core/containment.cjs.map +2 -2
  31. package/build/image-editor/core/crop-rect.cjs +48 -0
  32. package/build/image-editor/core/crop-rect.cjs.map +7 -0
  33. package/build/image-editor/core/index.cjs +12 -0
  34. package/build/image-editor/core/index.cjs.map +2 -2
  35. package/build/image-editor/core/interaction-controller.cjs.map +2 -2
  36. package/build/image-editor/core/math/sanitize.cjs +92 -0
  37. package/build/image-editor/core/math/sanitize.cjs.map +7 -0
  38. package/build/image-editor/core/setter-helpers.cjs +64 -0
  39. package/build/image-editor/core/setter-helpers.cjs.map +7 -0
  40. package/build/image-editor/core/source-region.cjs +16 -14
  41. package/build/image-editor/core/source-region.cjs.map +2 -2
  42. package/build/image-editor/core/state.cjs +20 -10
  43. package/build/image-editor/core/state.cjs.map +2 -2
  44. package/build/image-editor/core/stencil-math.cjs +31 -20
  45. package/build/image-editor/core/stencil-math.cjs.map +2 -2
  46. package/build/image-editor/core/transform-style.cjs +12 -6
  47. package/build/image-editor/core/transform-style.cjs.map +2 -2
  48. package/build/image-editor/core/types.cjs.map +1 -1
  49. package/build/image-editor/index.cjs +12 -2
  50. package/build/image-editor/index.cjs.map +2 -2
  51. package/build/image-editor/react/components/cropper-provider.cjs +2 -2
  52. package/build/image-editor/react/components/cropper-provider.cjs.map +2 -2
  53. package/build/image-editor/react/components/cropper.cjs +120 -47
  54. package/build/image-editor/react/components/cropper.cjs.map +2 -2
  55. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +172 -0
  56. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +7 -0
  57. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +19 -9
  58. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
  59. package/build/image-editor/react/hooks/build-cropper-setters.cjs +71 -0
  60. package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +7 -0
  61. package/build/image-editor/react/hooks/index.cjs +6 -3
  62. package/build/image-editor/react/hooks/index.cjs.map +2 -2
  63. package/build/image-editor/react/hooks/use-cropper-reducer.cjs +113 -0
  64. package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +7 -0
  65. package/build/state/composite-reducer.cjs +103 -0
  66. package/build/state/composite-reducer.cjs.map +7 -0
  67. package/build/state/index.cjs +48 -0
  68. package/build/state/index.cjs.map +7 -0
  69. package/build/state/media-editor-state-provider.cjs +58 -0
  70. package/build/state/media-editor-state-provider.cjs.map +7 -0
  71. package/build/state/types.cjs +33 -0
  72. package/build/state/types.cjs.map +7 -0
  73. package/build/state/use-media-editor-state.cjs +287 -0
  74. package/build/state/use-media-editor-state.cjs.map +7 -0
  75. package/build/store/actions.cjs +4 -2
  76. package/build/store/actions.cjs.map +2 -2
  77. package/build/store/reducer.cjs +5 -3
  78. package/build/store/reducer.cjs.map +2 -2
  79. package/build/store/selectors.cjs +5 -0
  80. package/build/store/selectors.cjs.map +2 -2
  81. package/build-module/components/media-editor/index.mjs +224 -177
  82. package/build-module/components/media-editor/index.mjs.map +2 -2
  83. package/build-module/components/media-editor/use-crop-options.mjs +37 -0
  84. package/build-module/components/media-editor/use-crop-options.mjs.map +7 -0
  85. package/build-module/components/media-editor/use-save-media-editor.mjs +151 -0
  86. package/build-module/components/media-editor/use-save-media-editor.mjs.map +7 -0
  87. package/build-module/components/media-editor-canvas/index.mjs +34 -13
  88. package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
  89. package/build-module/components/media-editor-crop-panel/index.mjs +73 -89
  90. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  91. package/build-module/components/media-editor-fine-rotation/index.mjs +50 -0
  92. package/build-module/components/media-editor-fine-rotation/index.mjs.map +7 -0
  93. package/build-module/components/media-editor-modal/index.mjs +64 -17
  94. package/build-module/components/media-editor-modal/index.mjs.map +2 -2
  95. package/build-module/components/media-editor-transform-controls/index.mjs +68 -0
  96. package/build-module/components/media-editor-transform-controls/index.mjs.map +7 -0
  97. package/build-module/components/media-form/index.mjs +9 -1
  98. package/build-module/components/media-form/index.mjs.map +2 -2
  99. package/build-module/components/media-form/sidebar-datetime-view.mjs +32 -0
  100. package/build-module/components/media-form/sidebar-datetime-view.mjs.map +7 -0
  101. package/build-module/components/rotation-ruler/index.mjs +8 -2
  102. package/build-module/components/rotation-ruler/index.mjs.map +2 -2
  103. package/build-module/hooks/use-crop-gesture-handlers.mjs +41 -4
  104. package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
  105. package/build-module/image-editor/core/camera.mjs +34 -11
  106. package/build-module/image-editor/core/camera.mjs.map +2 -2
  107. package/build-module/image-editor/core/constants.mjs +4 -0
  108. package/build-module/image-editor/core/constants.mjs.map +2 -2
  109. package/build-module/image-editor/core/containment.mjs +75 -34
  110. package/build-module/image-editor/core/containment.mjs.map +2 -2
  111. package/build-module/image-editor/core/crop-rect.mjs +23 -0
  112. package/build-module/image-editor/core/crop-rect.mjs.map +7 -0
  113. package/build-module/image-editor/core/index.mjs +12 -0
  114. package/build-module/image-editor/core/index.mjs.map +2 -2
  115. package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
  116. package/build-module/image-editor/core/math/sanitize.mjs +63 -0
  117. package/build-module/image-editor/core/math/sanitize.mjs.map +7 -0
  118. package/build-module/image-editor/core/setter-helpers.mjs +39 -0
  119. package/build-module/image-editor/core/setter-helpers.mjs.map +7 -0
  120. package/build-module/image-editor/core/source-region.mjs +16 -14
  121. package/build-module/image-editor/core/source-region.mjs.map +2 -2
  122. package/build-module/image-editor/core/state.mjs +25 -11
  123. package/build-module/image-editor/core/state.mjs.map +2 -2
  124. package/build-module/image-editor/core/stencil-math.mjs +30 -19
  125. package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
  126. package/build-module/image-editor/core/transform-style.mjs +12 -6
  127. package/build-module/image-editor/core/transform-style.mjs.map +2 -2
  128. package/build-module/image-editor/index.mjs +11 -2
  129. package/build-module/image-editor/index.mjs.map +2 -2
  130. package/build-module/image-editor/react/components/cropper-provider.mjs +3 -3
  131. package/build-module/image-editor/react/components/cropper-provider.mjs.map +2 -2
  132. package/build-module/image-editor/react/components/cropper.mjs +121 -48
  133. package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
  134. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +147 -0
  135. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +7 -0
  136. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +19 -9
  137. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
  138. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +46 -0
  139. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +7 -0
  140. package/build-module/image-editor/react/hooks/index.mjs +4 -2
  141. package/build-module/image-editor/react/hooks/index.mjs.map +2 -2
  142. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +100 -0
  143. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +7 -0
  144. package/build-module/state/composite-reducer.mjs +82 -0
  145. package/build-module/state/composite-reducer.mjs.map +7 -0
  146. package/build-module/state/index.mjs +26 -0
  147. package/build-module/state/index.mjs.map +7 -0
  148. package/build-module/state/media-editor-state-provider.mjs +34 -0
  149. package/build-module/state/media-editor-state-provider.mjs.map +7 -0
  150. package/build-module/state/types.mjs +8 -0
  151. package/build-module/state/types.mjs.map +7 -0
  152. package/build-module/state/use-media-editor-state.mjs +278 -0
  153. package/build-module/state/use-media-editor-state.mjs.map +7 -0
  154. package/build-module/store/actions.mjs +4 -2
  155. package/build-module/store/actions.mjs.map +2 -2
  156. package/build-module/store/reducer.mjs +5 -3
  157. package/build-module/store/reducer.mjs.map +2 -2
  158. package/build-module/store/selectors.mjs +4 -0
  159. package/build-module/store/selectors.mjs.map +2 -2
  160. package/build-style/style-rtl.css +97 -44
  161. package/build-style/style.css +97 -44
  162. package/build-types/components/media-editor/index.d.ts +14 -5
  163. package/build-types/components/media-editor/index.d.ts.map +1 -1
  164. package/build-types/components/media-editor/use-crop-options.d.ts +35 -0
  165. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -0
  166. package/build-types/components/media-editor/use-save-media-editor.d.ts +29 -0
  167. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -0
  168. package/build-types/components/media-editor-canvas/index.d.ts +5 -10
  169. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  170. package/build-types/components/media-editor-crop-panel/index.d.ts +6 -25
  171. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  172. package/build-types/components/media-editor-fine-rotation/index.d.ts +14 -0
  173. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -0
  174. package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
  175. package/build-types/components/media-editor-transform-controls/index.d.ts +8 -0
  176. package/build-types/components/media-editor-transform-controls/index.d.ts.map +1 -0
  177. package/build-types/components/media-form/index.d.ts.map +1 -1
  178. package/build-types/components/media-form/sidebar-datetime-view.d.ts +10 -0
  179. package/build-types/components/media-form/sidebar-datetime-view.d.ts.map +1 -0
  180. package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
  181. package/build-types/hooks/use-crop-gesture-handlers.d.ts +13 -14
  182. package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
  183. package/build-types/image-editor/core/camera.d.ts.map +1 -1
  184. package/build-types/image-editor/core/constants.d.ts +18 -0
  185. package/build-types/image-editor/core/constants.d.ts.map +1 -1
  186. package/build-types/image-editor/core/containment.d.ts +10 -0
  187. package/build-types/image-editor/core/containment.d.ts.map +1 -1
  188. package/build-types/image-editor/core/crop-rect.d.ts +19 -0
  189. package/build-types/image-editor/core/crop-rect.d.ts.map +1 -0
  190. package/build-types/image-editor/core/index.d.ts +3 -1
  191. package/build-types/image-editor/core/index.d.ts.map +1 -1
  192. package/build-types/image-editor/core/interaction-controller.d.ts +5 -1
  193. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
  194. package/build-types/image-editor/core/math/sanitize.d.ts +70 -0
  195. package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -0
  196. package/build-types/image-editor/core/setter-helpers.d.ts +24 -0
  197. package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -0
  198. package/build-types/image-editor/core/source-region.d.ts.map +1 -1
  199. package/build-types/image-editor/core/state.d.ts +12 -0
  200. package/build-types/image-editor/core/state.d.ts.map +1 -1
  201. package/build-types/image-editor/core/stencil-math.d.ts +23 -18
  202. package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
  203. package/build-types/image-editor/core/transform-style.d.ts.map +1 -1
  204. package/build-types/image-editor/core/types.d.ts +23 -4
  205. package/build-types/image-editor/core/types.d.ts.map +1 -1
  206. package/build-types/image-editor/index.d.ts +4 -4
  207. package/build-types/image-editor/index.d.ts.map +1 -1
  208. package/build-types/image-editor/react/components/cropper-provider.d.ts +11 -7
  209. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
  210. package/build-types/image-editor/react/components/cropper.d.ts +6 -4
  211. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  212. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +36 -0
  213. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -0
  214. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +2 -1
  215. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
  216. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +47 -0
  217. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -0
  218. package/build-types/image-editor/react/hooks/index.d.ts +4 -2
  219. package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
  220. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +58 -0
  221. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -0
  222. package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
  223. package/build-types/state/composite-reducer.d.ts +39 -0
  224. package/build-types/state/composite-reducer.d.ts.map +1 -0
  225. package/build-types/state/index.d.ts +7 -0
  226. package/build-types/state/index.d.ts.map +1 -0
  227. package/build-types/state/media-editor-state-provider.d.ts +34 -0
  228. package/build-types/state/media-editor-state-provider.d.ts.map +1 -0
  229. package/build-types/state/types.d.ts +96 -0
  230. package/build-types/state/types.d.ts.map +1 -0
  231. package/build-types/state/use-media-editor-state.d.ts +101 -0
  232. package/build-types/state/use-media-editor-state.d.ts.map +1 -0
  233. package/build-types/store/actions.d.ts +3 -1
  234. package/build-types/store/actions.d.ts.map +1 -1
  235. package/build-types/store/reducer.d.ts +3 -0
  236. package/build-types/store/reducer.d.ts.map +1 -1
  237. package/build-types/store/selectors.d.ts +1 -0
  238. package/build-types/store/selectors.d.ts.map +1 -1
  239. package/package.json +19 -16
  240. package/src/components/media-editor/index.tsx +262 -229
  241. package/src/components/media-editor/style.scss +0 -9
  242. package/src/components/media-editor/test/use-crop-options.tsx +110 -0
  243. package/src/components/media-editor/use-crop-options.ts +79 -0
  244. package/src/components/media-editor/use-save-media-editor.ts +214 -0
  245. package/src/components/media-editor-canvas/index.tsx +57 -25
  246. package/src/components/media-editor-crop-panel/index.tsx +53 -87
  247. package/src/components/media-editor-crop-panel/test/index.tsx +46 -53
  248. package/src/components/media-editor-fine-rotation/index.tsx +74 -0
  249. package/src/components/media-editor-modal/index.tsx +70 -16
  250. package/src/components/media-editor-modal/style.scss +80 -0
  251. package/src/components/media-editor-modal/test/build-modifiers.test.ts +14 -0
  252. package/src/components/media-editor-modal/test/index.tsx +146 -0
  253. package/src/components/media-editor-transform-controls/index.tsx +70 -0
  254. package/src/components/media-editor-transform-controls/style.scss +8 -0
  255. package/src/components/media-form/index.tsx +15 -1
  256. package/src/components/media-form/sidebar-datetime-view.tsx +47 -0
  257. package/src/components/media-form/test/sidebar-datetime-view.test.tsx +96 -0
  258. package/src/components/rotation-ruler/README.md +11 -25
  259. package/src/components/rotation-ruler/index.tsx +17 -2
  260. package/src/components/rotation-ruler/style.scss +49 -13
  261. package/src/hooks/use-crop-gesture-handlers.ts +64 -17
  262. package/src/image-editor/README.md +28 -129
  263. package/src/image-editor/core/camera.ts +51 -26
  264. package/src/image-editor/core/constants.ts +19 -0
  265. package/src/image-editor/core/containment.ts +102 -49
  266. package/src/image-editor/core/crop-rect.ts +45 -0
  267. package/src/image-editor/core/index.ts +16 -4
  268. package/src/image-editor/core/interaction-controller.ts +5 -1
  269. package/src/image-editor/core/math/sanitize.ts +158 -0
  270. package/src/image-editor/core/math/test/sanitize.ts +244 -0
  271. package/src/image-editor/core/setter-helpers.ts +66 -0
  272. package/src/image-editor/core/source-region.ts +21 -14
  273. package/src/image-editor/core/state.ts +67 -15
  274. package/src/image-editor/core/stencil-math.ts +55 -35
  275. package/src/image-editor/core/test/camera.ts +367 -1
  276. package/src/image-editor/core/test/state.ts +101 -8
  277. package/src/image-editor/core/test/stencil-math.ts +193 -0
  278. package/src/image-editor/core/transform-style.ts +21 -6
  279. package/src/image-editor/core/types.ts +24 -4
  280. package/src/image-editor/docs/architecture.md +48 -89
  281. package/src/image-editor/docs/recipes.md +123 -659
  282. package/src/image-editor/index.ts +12 -3
  283. package/src/image-editor/react/components/cropper-provider.tsx +16 -12
  284. package/src/image-editor/react/components/cropper.scss +23 -4
  285. package/src/image-editor/react/components/cropper.tsx +194 -89
  286. package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +269 -0
  287. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +19 -8
  288. package/src/image-editor/react/components/test/cropper.tsx +55 -13
  289. package/src/image-editor/react/hooks/build-cropper-setters.ts +105 -0
  290. package/src/image-editor/react/hooks/index.ts +4 -2
  291. package/src/image-editor/react/hooks/test/{use-cropper-state.ts → use-cropper-reducer.ts} +142 -286
  292. package/src/image-editor/react/hooks/use-cropper-reducer.ts +204 -0
  293. package/src/image-editor/stories/rectangle-crop.story.tsx +7 -17
  294. package/src/state/composite-reducer.ts +137 -0
  295. package/src/state/index.ts +20 -0
  296. package/src/state/media-editor-state-provider.tsx +70 -0
  297. package/src/state/test/use-media-editor-state.ts +330 -0
  298. package/src/state/types.ts +101 -0
  299. package/src/state/use-media-editor-state.ts +472 -0
  300. package/src/store/actions.ts +3 -0
  301. package/src/store/reducer.ts +6 -1
  302. package/src/store/selectors.ts +4 -0
  303. package/src/store/test/reducer.ts +9 -0
  304. package/src/style.scss +1 -1
  305. package/tsconfig.json +3 -0
  306. package/tsconfig.tsbuildinfo +1 -1
  307. package/build/components/media-editor-toolbar/index.cjs +0 -214
  308. package/build/components/media-editor-toolbar/index.cjs.map +0 -7
  309. package/build/image-editor/react/hooks/use-cropper-state.cjs +0 -277
  310. package/build/image-editor/react/hooks/use-cropper-state.cjs.map +0 -7
  311. package/build-module/components/media-editor-toolbar/index.mjs +0 -190
  312. package/build-module/components/media-editor-toolbar/index.mjs.map +0 -7
  313. package/build-module/image-editor/react/hooks/use-cropper-state.mjs +0 -262
  314. package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +0 -7
  315. package/build-types/components/media-editor-toolbar/index.d.ts +0 -24
  316. package/build-types/components/media-editor-toolbar/index.d.ts.map +0 -1
  317. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +0 -97
  318. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +0 -1
  319. package/src/components/media-editor-toolbar/index.tsx +0 -209
  320. package/src/components/media-editor-toolbar/style.scss +0 -49
  321. package/src/image-editor/docs/roadmap.md +0 -66
  322. package/src/image-editor/react/hooks/use-cropper-state.ts +0 -457
@@ -205,6 +205,19 @@
205
205
  height: 100%;
206
206
  width: 1px;
207
207
  }
208
+ .wp-media-editor-image-editor__dimensions-tooltip {
209
+ position: absolute;
210
+ padding: 2px 6px;
211
+ background: #fff;
212
+ color: #1e1e1e;
213
+ font-size: 11px;
214
+ line-height: 1.4;
215
+ font-variant-numeric: tabular-nums;
216
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.08);
217
+ pointer-events: none;
218
+ white-space: nowrap;
219
+ z-index: 2;
220
+ }
208
221
  .wp-media-editor-image-editor__stencil-rect {
209
222
  position: absolute;
210
223
  border: 1px solid rgba(255, 255, 255, 0.7);
@@ -212,7 +225,7 @@
212
225
  pointer-events: none;
213
226
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
214
227
  }
215
- .wp-media-editor-image-editor__canvas--focus-visible .wp-media-editor-image-editor__stencil-rect {
228
+ .wp-media-editor-image-editor__canvas--focus-visible:focus .wp-media-editor-image-editor__stencil-rect {
216
229
  border-color: var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
217
230
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
218
231
  }
@@ -235,7 +248,7 @@
235
248
  .wp-media-editor-image-editor__handle:focus {
236
249
  outline: none;
237
250
  }
238
- .wp-media-editor-image-editor__handle:focus-visible {
251
+ .wp-media-editor-image-editor__canvas--focus-visible .wp-media-editor-image-editor__handle:focus {
239
252
  background: var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
240
253
  border-color: transparent;
241
254
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
@@ -369,13 +382,6 @@
369
382
  min-width: 0;
370
383
  flex: 1;
371
384
  }
372
- .media-editor .interface-interface-skeleton__footer {
373
- position: relative;
374
- display: flex;
375
- }
376
- .media-editor .interface-interface-skeleton.has-footer .interface-interface-skeleton__body {
377
- padding-bottom: 0;
378
- }
379
385
  .media-editor .media-editor__canvas {
380
386
  display: flex;
381
387
  align-items: center;
@@ -447,6 +453,56 @@
447
453
  min-height: 0;
448
454
  }
449
455
 
456
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer {
457
+ flex-shrink: 0;
458
+ display: flex;
459
+ gap: 16px;
460
+ padding: 8px 24px;
461
+ border-top: 1px solid #ddd;
462
+ background: #fff;
463
+ }
464
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide {
465
+ flex-direction: row;
466
+ align-items: center;
467
+ }
468
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-modal__footer-toolbar {
469
+ flex: 1 1 0;
470
+ min-width: 0;
471
+ display: flex;
472
+ align-items: center;
473
+ justify-content: center;
474
+ gap: 8px;
475
+ }
476
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-fine-rotation {
477
+ flex: 1 1 280px;
478
+ min-width: 0;
479
+ max-width: 360px;
480
+ }
481
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-transform-controls {
482
+ border-right: 1px solid #ddd;
483
+ padding-right: 12px;
484
+ }
485
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor__footer-actions {
486
+ margin-right: auto;
487
+ }
488
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-medium, .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-narrow {
489
+ flex-direction: column;
490
+ }
491
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-narrow > .media-editor-transform-controls {
492
+ align-self: center;
493
+ }
494
+
495
+ .media-editor-modal__footer-row {
496
+ display: flex;
497
+ flex-wrap: wrap;
498
+ align-items: center;
499
+ gap: 16px;
500
+ }
501
+ .media-editor-modal__footer-row .media-editor-transform-controls,
502
+ .media-editor-modal__footer-row .media-editor__footer-actions {
503
+ margin-right: auto;
504
+ }
505
+
450
506
  .media-editor-modal {
451
507
  display: flex;
452
508
  flex-direction: column;
@@ -476,40 +532,13 @@
476
532
  height: 100%;
477
533
  }
478
534
 
479
- .media-editor-toolbar {
480
- width: 100%;
481
- padding: 8px 16px;
482
- }
483
-
484
- .media-editor-toolbar__rotation-slider {
485
- flex: 1 1 280px;
486
- min-width: 0;
487
- max-width: 360px;
488
- }
489
-
490
- .media-editor-toolbar__action-cluster {
535
+ .media-editor-transform-controls {
491
536
  display: flex;
492
537
  flex-wrap: nowrap;
493
538
  align-items: center;
494
539
  gap: 8px;
495
540
  }
496
541
 
497
- @media (min-width: 782px) {
498
- .media-editor-toolbar__action-cluster {
499
- border-right: 1px solid #ddd;
500
- padding-right: 12px;
501
- }
502
- }
503
- @media (max-width: 781px) {
504
- .media-editor-toolbar__rotation-slider {
505
- flex-basis: 100%;
506
- max-width: none;
507
- }
508
- .media-editor-toolbar__action-cluster {
509
- flex-basis: 100%;
510
- justify-content: center;
511
- }
512
- }
513
542
  .media-editor-keyboard-shortcuts-modal {
514
543
  min-width: 280px;
515
544
  }
@@ -594,11 +623,10 @@
594
623
  position: absolute;
595
624
  bottom: 0;
596
625
  right: 50%;
597
- width: 0;
598
- height: 0;
599
- border-right: 6px solid transparent;
600
- border-left: 6px solid transparent;
601
- border-bottom: 9px solid var(--wp-admin-theme-color, #3858e9);
626
+ width: 2px;
627
+ height: 18px;
628
+ background: var(--wp-admin-theme-color, #3858e9);
629
+ border-radius: 1px;
602
630
  transform: translateX(50%);
603
631
  pointer-events: none;
604
632
  }
@@ -646,14 +674,39 @@
646
674
  right: 50%;
647
675
  height: 14px;
648
676
  transform: translateX(50%);
649
- padding: 0 12px;
650
677
  font-size: 12px;
651
678
  font-weight: 600;
652
679
  line-height: 14px;
653
680
  color: #1e1e1e;
654
- background: linear-gradient(to left, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
655
681
  pointer-events: none;
656
682
  }
683
+ .rotation-ruler__active-label::before {
684
+ content: "";
685
+ position: absolute;
686
+ top: 0;
687
+ right: 50%;
688
+ width: 60px;
689
+ height: 100%;
690
+ transform: translateX(50%);
691
+ background: linear-gradient(to left, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
692
+ }
693
+
694
+ .rotation-ruler__active-label-number {
695
+ position: relative;
696
+ display: inline-block;
697
+ }
698
+
699
+ .rotation-ruler__active-label-sign {
700
+ position: absolute;
701
+ top: 0;
702
+ left: 100%;
703
+ }
704
+
705
+ .rotation-ruler__active-label-unit {
706
+ position: absolute;
707
+ top: 0;
708
+ right: 100%;
709
+ }
657
710
 
658
711
  @container (max-width: 220px) {
659
712
  .rotation-ruler__tick--minor {
@@ -205,6 +205,19 @@
205
205
  height: 100%;
206
206
  width: 1px;
207
207
  }
208
+ .wp-media-editor-image-editor__dimensions-tooltip {
209
+ position: absolute;
210
+ padding: 2px 6px;
211
+ background: #fff;
212
+ color: #1e1e1e;
213
+ font-size: 11px;
214
+ line-height: 1.4;
215
+ font-variant-numeric: tabular-nums;
216
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.08);
217
+ pointer-events: none;
218
+ white-space: nowrap;
219
+ z-index: 2;
220
+ }
208
221
  .wp-media-editor-image-editor__stencil-rect {
209
222
  position: absolute;
210
223
  border: 1px solid rgba(255, 255, 255, 0.7);
@@ -212,7 +225,7 @@
212
225
  pointer-events: none;
213
226
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
214
227
  }
215
- .wp-media-editor-image-editor__canvas--focus-visible .wp-media-editor-image-editor__stencil-rect {
228
+ .wp-media-editor-image-editor__canvas--focus-visible:focus .wp-media-editor-image-editor__stencil-rect {
216
229
  border-color: var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
217
230
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
218
231
  }
@@ -235,7 +248,7 @@
235
248
  .wp-media-editor-image-editor__handle:focus {
236
249
  outline: none;
237
250
  }
238
- .wp-media-editor-image-editor__handle:focus-visible {
251
+ .wp-media-editor-image-editor__canvas--focus-visible .wp-media-editor-image-editor__handle:focus {
239
252
  background: var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
240
253
  border-color: transparent;
241
254
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
@@ -369,13 +382,6 @@
369
382
  min-width: 0;
370
383
  flex: 1;
371
384
  }
372
- .media-editor .interface-interface-skeleton__footer {
373
- position: relative;
374
- display: flex;
375
- }
376
- .media-editor .interface-interface-skeleton.has-footer .interface-interface-skeleton__body {
377
- padding-bottom: 0;
378
- }
379
385
  .media-editor .media-editor__canvas {
380
386
  display: flex;
381
387
  align-items: center;
@@ -447,6 +453,56 @@
447
453
  min-height: 0;
448
454
  }
449
455
 
456
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer {
457
+ flex-shrink: 0;
458
+ display: flex;
459
+ gap: 16px;
460
+ padding: 8px 24px;
461
+ border-top: 1px solid #ddd;
462
+ background: #fff;
463
+ }
464
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide {
465
+ flex-direction: row;
466
+ align-items: center;
467
+ }
468
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-modal__footer-toolbar {
469
+ flex: 1 1 0;
470
+ min-width: 0;
471
+ display: flex;
472
+ align-items: center;
473
+ justify-content: center;
474
+ gap: 8px;
475
+ }
476
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-fine-rotation {
477
+ flex: 1 1 280px;
478
+ min-width: 0;
479
+ max-width: 360px;
480
+ }
481
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor-transform-controls {
482
+ border-left: 1px solid #ddd;
483
+ padding-left: 12px;
484
+ }
485
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-wide .media-editor__footer-actions {
486
+ margin-left: auto;
487
+ }
488
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-medium, .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-narrow {
489
+ flex-direction: column;
490
+ }
491
+ .media-editor-modal.components-modal__frame .media-editor-modal__footer.is-narrow > .media-editor-transform-controls {
492
+ align-self: center;
493
+ }
494
+
495
+ .media-editor-modal__footer-row {
496
+ display: flex;
497
+ flex-wrap: wrap;
498
+ align-items: center;
499
+ gap: 16px;
500
+ }
501
+ .media-editor-modal__footer-row .media-editor-transform-controls,
502
+ .media-editor-modal__footer-row .media-editor__footer-actions {
503
+ margin-left: auto;
504
+ }
505
+
450
506
  .media-editor-modal {
451
507
  display: flex;
452
508
  flex-direction: column;
@@ -476,40 +532,13 @@
476
532
  height: 100%;
477
533
  }
478
534
 
479
- .media-editor-toolbar {
480
- width: 100%;
481
- padding: 8px 16px;
482
- }
483
-
484
- .media-editor-toolbar__rotation-slider {
485
- flex: 1 1 280px;
486
- min-width: 0;
487
- max-width: 360px;
488
- }
489
-
490
- .media-editor-toolbar__action-cluster {
535
+ .media-editor-transform-controls {
491
536
  display: flex;
492
537
  flex-wrap: nowrap;
493
538
  align-items: center;
494
539
  gap: 8px;
495
540
  }
496
541
 
497
- @media (min-width: 782px) {
498
- .media-editor-toolbar__action-cluster {
499
- border-left: 1px solid #ddd;
500
- padding-left: 12px;
501
- }
502
- }
503
- @media (max-width: 781px) {
504
- .media-editor-toolbar__rotation-slider {
505
- flex-basis: 100%;
506
- max-width: none;
507
- }
508
- .media-editor-toolbar__action-cluster {
509
- flex-basis: 100%;
510
- justify-content: center;
511
- }
512
- }
513
542
  .media-editor-keyboard-shortcuts-modal {
514
543
  min-width: 280px;
515
544
  }
@@ -594,11 +623,10 @@
594
623
  position: absolute;
595
624
  bottom: 0;
596
625
  left: 50%;
597
- width: 0;
598
- height: 0;
599
- border-left: 6px solid transparent;
600
- border-right: 6px solid transparent;
601
- border-bottom: 9px solid var(--wp-admin-theme-color, #3858e9);
626
+ width: 2px;
627
+ height: 18px;
628
+ background: var(--wp-admin-theme-color, #3858e9);
629
+ border-radius: 1px;
602
630
  transform: translateX(-50%);
603
631
  pointer-events: none;
604
632
  }
@@ -646,14 +674,39 @@
646
674
  left: 50%;
647
675
  height: 14px;
648
676
  transform: translateX(-50%);
649
- padding: 0 12px;
650
677
  font-size: 12px;
651
678
  font-weight: 600;
652
679
  line-height: 14px;
653
680
  color: #1e1e1e;
654
- background: linear-gradient(to right, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
655
681
  pointer-events: none;
656
682
  }
683
+ .rotation-ruler__active-label::before {
684
+ content: "";
685
+ position: absolute;
686
+ top: 0;
687
+ left: 50%;
688
+ width: 60px;
689
+ height: 100%;
690
+ transform: translateX(-50%);
691
+ background: linear-gradient(to right, transparent 0, #fff 12px, #fff calc(100% - 12px), transparent 100%);
692
+ }
693
+
694
+ .rotation-ruler__active-label-number {
695
+ position: relative;
696
+ display: inline-block;
697
+ }
698
+
699
+ .rotation-ruler__active-label-sign {
700
+ position: absolute;
701
+ top: 0;
702
+ right: 100%;
703
+ }
704
+
705
+ .rotation-ruler__active-label-unit {
706
+ position: absolute;
707
+ top: 0;
708
+ left: 100%;
709
+ }
657
710
 
658
711
  @container (max-width: 220px) {
659
712
  .rotation-ruler__tick--minor {
@@ -2,14 +2,23 @@ import type { Field } from '@wordpress/dataviews';
2
2
  import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';
3
3
  import type { Media } from '../media-editor-provider';
4
4
  import type { AspectRatioPreset } from '../../image-editor/core/constants';
5
- export interface MediaEditorSaveResult {
6
- id: number;
7
- url?: string;
8
- media: Media;
9
- }
5
+ import { type MediaEditorSaveResult } from './use-save-media-editor';
6
+ export type { MediaEditorSaveResult } from './use-save-media-editor';
10
7
  export interface MediaEditorFrameProps {
11
8
  children: ReactNode;
12
9
  headerActions: ReactNode;
10
+ footerActions: ReactNode;
11
+ /**
12
+ * Footer layout selector. Frames apply this to the footer container
13
+ * as a modifier class.
14
+ *
15
+ * - `wide` — single row: History | Ruler | Transform | Cancel/Save.
16
+ * - `medium` — two rows: ruler on top; History | Transform | Cancel/Save
17
+ * beneath.
18
+ * - `narrow` — three rows: ruler; transform (centered); History |
19
+ * Cancel/Save.
20
+ */
21
+ footerLayout: 'wide' | 'medium' | 'narrow';
13
22
  onRequestClose: () => void;
14
23
  onKeyDown: (event: ReactKeyboardEvent<HTMLElement>) => void;
15
24
  shouldCloseOnClickOutside: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAQlD,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAWtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAgC3E,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAE,KAAK,EAAE,kBAAkB,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IAChE,yBAAyB,EAAE,OAAO,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAE,MAAM,EAAE,qBAAqB,KAAM,IAAI,CAAC;IACpD,WAAW,EAAE,CAAE,KAAK,EAAE,qBAAqB,KAAM,GAAG,CAAC,OAAO,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4kBD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;eAEc,WAAW"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAQlD,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAUtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAGN,KAAK,qBAAqB,EAC1B,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAiBrE,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,aAAa,EAAE,SAAS,CAAC;IACzB;;;;;;;;;OASG;IACH,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAE,KAAK,EAAE,kBAAkB,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IAChE,yBAAyB,EAAE,OAAO,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAE,MAAM,EAAE,qBAAqB,KAAM,IAAI,CAAC;IACpD,WAAW,EAAE,CAAE,KAAK,EAAE,qBAAqB,KAAM,GAAG,CAAC,OAAO,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAymBD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;eAEc,WAAW"}
@@ -0,0 +1,35 @@
1
+ import type { AspectRatioPreset } from '../../image-editor/core/constants';
2
+ interface UseCropOptionsArgs {
3
+ aspectRatioPresets?: AspectRatioPreset[];
4
+ }
5
+ interface UseCropOptionsReturn {
6
+ aspectRatioValue: string;
7
+ setAspectRatioValue: (value: string) => void;
8
+ aspectRatioOptions: AspectRatioPreset[];
9
+ resolvedAspectRatio: number | undefined;
10
+ resetCropOptions: () => void;
11
+ }
12
+ /**
13
+ * Build the preset list shown in the dropdown — always include the
14
+ * non-numeric presets (Free, Original) and append either the
15
+ * caller-supplied set or the defaults.
16
+ *
17
+ * @param aspectRatioPresets Optional caller-supplied presets.
18
+ * @return The full preset list to render.
19
+ */
20
+ export declare function getAspectRatioOptions(aspectRatioPresets?: AspectRatioPreset[]): AspectRatioPreset[];
21
+ /**
22
+ * Thin selector over the composite media-editor store for the Crop
23
+ * sidebar tab. Reads the cropOptions slice (preset key) and exposes
24
+ * the corresponding setters plus a render-time `resolvedAspectRatio`
25
+ * derivation.
26
+ *
27
+ * No local React state, no refs, no synchronization effects — the
28
+ * composite store is the single source of truth.
29
+ *
30
+ * @param args
31
+ * @param args.aspectRatioPresets Optional caller-supplied aspect-ratio presets.
32
+ */
33
+ export declare function useCropOptions({ aspectRatioPresets }?: UseCropOptionsArgs): UseCropOptionsReturn;
34
+ export {};
35
+ //# sourceMappingURL=use-crop-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,UAAU,kBAAkB;IAC3B,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,UAAU,oBAAoB;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GACtC,iBAAiB,EAAE,CAMrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAE,EAC/B,kBAAkB,EAClB,GAAE,kBAAuB,GAAI,oBAAoB,CAsBjD"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Media } from '../media-editor-provider';
5
+ import type { MediaEditorController } from '../../state';
6
+ export declare const MEDIA_EDITOR_NOTICES_CONTEXT = "media-editor";
7
+ export interface MediaEditorSaveResult {
8
+ id: number;
9
+ url?: string;
10
+ media: Media;
11
+ previous?: {
12
+ id: number;
13
+ url?: string;
14
+ };
15
+ }
16
+ interface UseSaveMediaEditorArgs {
17
+ cropper: MediaEditorController;
18
+ id: number;
19
+ isImage: boolean;
20
+ media?: Media | null;
21
+ onSaved?: (result: MediaEditorSaveResult) => void;
22
+ }
23
+ interface UseSaveMediaEditorReturn {
24
+ isSaving: boolean;
25
+ save: () => Promise<void>;
26
+ }
27
+ export declare function useSaveMediaEditor({ cropper, id, isImage, media, onSaved }: UseSaveMediaEditorArgs): UseSaveMediaEditorReturn;
28
+ export {};
29
+ //# sourceMappingURL=use-save-media-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAiBzD,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAI3D,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACF;AAED,UAAU,sBAAsB;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAE,MAAM,EAAE,qBAAqB,KAAM,IAAI,CAAC;CACpD;AAED,UAAU,wBAAwB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,OAAO,CAAE,IAAI,CAAE,CAAC;CAC5B;AAgCD,wBAAgB,kBAAkB,CAAE,EACnC,OAAO,EACP,EAAE,EACF,OAAO,EACP,KAAK,EACL,OAAO,EACP,EAAE,sBAAsB,GAAI,wBAAwB,CAuHpD"}
@@ -1,8 +1,4 @@
1
1
  export interface MediaEditorCanvasProps {
2
- /** Fixed aspect ratio (width / height). `undefined` means free. */
3
- aspectRatio?: number;
4
- /** Enable freeform crop mode (resize handles). */
5
- freeformCrop?: boolean;
6
2
  /** Focus the crop area when the canvas mounts. */
7
3
  focusOnMount?: boolean;
8
4
  /** Whether external placement activity should reveal the grid. */
@@ -13,19 +9,18 @@ export interface MediaEditorCanvasProps {
13
9
  onGestureEnd?: () => void;
14
10
  }
15
11
  /**
16
- * Editing surface for image media in the media editor modal. Pulls its
17
- * cropper controller from the surrounding `<CropperProvider>` so the
18
- * bottom bar and Crop sidebar tab share the same state.
12
+ * Editing surface for image media in the media editor modal. Pulls
13
+ * its cropper controller from the surrounding `<MediaEditorStateProvider>`
14
+ * so the bottom bar and Crop sidebar tab share the same state.
19
15
  *
20
16
  * Returns `null` for missing or non-image media so the modal's outer
21
17
  * guards can render a spinner or fall through to `<MediaPreview>`.
18
+ *
22
19
  * @param props
23
- * @param props.aspectRatio
24
- * @param props.freeformCrop
25
20
  * @param props.focusOnMount
26
21
  * @param props.isPlacementActive
27
22
  * @param props.onGestureStart
28
23
  * @param props.onGestureEnd
29
24
  */
30
- export default function MediaEditorCanvas({ aspectRatio, freeformCrop, focusOnMount, isPlacementActive, onGestureStart, onGestureEnd }: MediaEditorCanvasProps): import("react").JSX.Element | null;
25
+ export default function MediaEditorCanvas({ focusOnMount, isPlacementActive, onGestureStart, onGestureEnd }: MediaEditorCanvasProps): import("react").JSX.Element | null;
31
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,sBAAsB;IACtC,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,EAAE,sBAAsB,sCAmCxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,sBAAsB;IACtC,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,YAAY,EACZ,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,EAAE,sBAAsB,sCAoExB"}
@@ -8,38 +8,19 @@ export interface MediaEditorCropPanelProps {
8
8
  aspectRatioValue: string;
9
9
  /** Setter for the aspect-ratio preset value. */
10
10
  onAspectRatioChange: (value: string) => void;
11
- /** Whether the cropper is in freeform (resize-handle) mode. */
12
- freeformCrop: boolean;
13
- /** Setter for freeform mode. */
14
- onFreeformChange: (value: boolean) => void;
15
11
  /** Signal that a placement-oriented control is being adjusted. */
16
12
  onPlacementControlInteraction?: () => void;
17
- /**
18
- * Fixed aspect-ratio presets to display after Free and Original. When
19
- * omitted, the media editor's default fixed-ratio presets are used.
20
- */
21
- aspectRatioPresets?: AspectRatioPreset[];
13
+ /** Aspect-ratio presets to display in the selector. */
14
+ aspectRatioOptions: AspectRatioPreset[];
22
15
  }
23
16
  /**
24
- * Resolve an aspect-ratio preset value into a number suitable for
25
- * `<Cropper aspectRatio=...>`. Returns `undefined` for Free (no lock).
26
- *
27
- * @param value Preset value as a string.
28
- * @param imageAspectRatio Image's natural width / height — used for
29
- * the Original preset.
30
- */
31
- export declare function resolveAspectRatio(value: string, imageAspectRatio: number | null): number | undefined;
32
- /**
33
- * Sidebar panel for crop-shape controls — aspect-ratio presets and
34
- * freeform toggle. The tactile verbs (rotate, flip) live in the
35
- * bottom toolbar instead.
17
+ * Sidebar panel for crop-shape controls. The tactile verbs (rotate, flip)
18
+ * live in the bottom toolbar instead.
36
19
  * @param props
37
20
  * @param props.aspectRatioValue
38
21
  * @param props.onAspectRatioChange
39
- * @param props.freeformCrop
40
- * @param props.onFreeformChange
41
22
  * @param props.onPlacementControlInteraction
42
- * @param props.aspectRatioPresets
23
+ * @param props.aspectRatioOptions
43
24
  */
44
- export default function MediaEditorCropPanel({ aspectRatioValue, onAspectRatioChange, freeformCrop, onFreeformChange, onPlacementControlInteraction, aspectRatioPresets }: MediaEditorCropPanelProps): import("react").JSX.Element;
25
+ export default function MediaEditorCropPanel({ aspectRatioValue, onAspectRatioChange, onPlacementControlInteraction, aspectRatioOptions }: MediaEditorCropPanelProps): import("react").JSX.Element;
45
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,gCAAgC;IAChC,gBAAgB,EAAE,CAAE,KAAK,EAAE,OAAO,KAAM,IAAI,CAAC;IAC7C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC7B,MAAM,GAAG,SAAS,CAYpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,kBAAkB,EAClB,EAAE,yBAAyB,+BAgE3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAa3E,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3C,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EAClB,EAAE,yBAAyB,+BA6D3B"}
@@ -0,0 +1,14 @@
1
+ export interface MediaEditorFineRotationProps {
2
+ /** Signal that a placement-oriented control is being adjusted. */
3
+ onPlacementControlInteraction?: () => void;
4
+ }
5
+ /**
6
+ * Fine-rotation slider for the media-editor footer. Lives separately from
7
+ * the snap-rotate / flip buttons so the footer can place the two halves on
8
+ * different rows at intermediate viewport widths.
9
+ *
10
+ * @param props
11
+ * @param props.onPlacementControlInteraction
12
+ */
13
+ export default function MediaEditorFineRotation({ onPlacementControlInteraction }: MediaEditorFineRotationProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-fine-rotation/index.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,4BAA4B;IAC5C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAE,EAChD,6BAA6B,EAC7B,EAAE,4BAA4B,+BA6C9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,UAAU,qBAAqB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,wBAAgB,gBAAgB,CAAE,EACjC,MAAW,EACX,kBAAkB,EAClB,EAAE,qBAAqB,sCA6DvB;eAEc,gBAAgB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAOlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,UAAU,qBAAqB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,wBAAgB,gBAAgB,CAAE,EACjC,MAAW,EACX,kBAAkB,EAClB,EAAE,qBAAqB,sCAgHvB;eAEc,gBAAgB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Snap-rotate and flip controls for the media-editor footer. Rotation and
3
+ * reflection are both geometric transforms, hence "transform controls".
4
+ * Lives separately from the fine-rotation slider so the footer can place
5
+ * the two halves on different rows at intermediate viewport widths.
6
+ */
7
+ export default function MediaEditorTransformControls(): import("react").JSX.Element;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-transform-controls/index.tsx"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,4BAA4B,gCA8CnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EACN,EAAE,cAAc,+BAqDhB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,sBAAsB,CAAC;AAKxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EACN,EAAE,cAAc,+BAiEhB"}