@wordpress/media-editor 0.19.0 → 0.21.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 (196) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +2 -1
  3. package/build/components/media-editor/index.cjs +136 -63
  4. package/build/components/media-editor/index.cjs.map +3 -3
  5. package/build/components/media-editor/use-crop-options.cjs +2 -3
  6. package/build/components/media-editor/use-crop-options.cjs.map +2 -2
  7. package/build/components/media-editor/use-save-media-editor.cjs +36 -20
  8. package/build/components/media-editor/use-save-media-editor.cjs.map +2 -2
  9. package/build/components/media-editor-canvas/index.cjs +8 -8
  10. package/build/components/media-editor-canvas/index.cjs.map +3 -3
  11. package/build/components/media-editor-crop-panel/index.cjs +12 -8
  12. package/build/components/media-editor-crop-panel/index.cjs.map +3 -3
  13. package/build/components/media-editor-fine-rotation/index.cjs +1 -1
  14. package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
  15. package/build/components/media-editor-image-controls/index.cjs +46 -29
  16. package/build/components/media-editor-image-controls/index.cjs.map +2 -2
  17. package/build/components/media-editor-modal/index.cjs +19 -9
  18. package/build/components/media-editor-modal/index.cjs.map +2 -2
  19. package/build/components/media-editor-provider/index.cjs +2 -1
  20. package/build/components/media-editor-provider/index.cjs.map +2 -2
  21. package/build/components/media-form/index.cjs +28 -28
  22. package/build/components/media-form/index.cjs.map +3 -3
  23. package/build/components/media-preview/index.cjs.map +3 -3
  24. package/build/hooks/use-crop-gesture-handlers.cjs +1 -1
  25. package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
  26. package/build/image-editor/core/interaction-controller.cjs +5 -0
  27. package/build/image-editor/core/interaction-controller.cjs.map +2 -2
  28. package/build/image-editor/react/components/cropper.cjs +4 -14
  29. package/build/image-editor/react/components/cropper.cjs.map +2 -2
  30. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +1 -1
  31. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
  32. package/build/image-editor/react/hooks/use-aria-announcer.cjs +3 -1
  33. package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +2 -2
  34. package/build/image-editor/react/hooks/use-interaction.cjs +1 -1
  35. package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
  36. package/build/state/composite-reducer.cjs +35 -10
  37. package/build/state/composite-reducer.cjs.map +3 -3
  38. package/build/state/index.cjs.map +1 -1
  39. package/build/state/media-editor-state-provider.cjs +1 -6
  40. package/build/state/media-editor-state-provider.cjs.map +2 -2
  41. package/build/state/types.cjs.map +1 -1
  42. package/build/state/use-media-editor-state.cjs +57 -42
  43. package/build/state/use-media-editor-state.cjs.map +2 -2
  44. package/build/store/actions.cjs +2 -0
  45. package/build/store/actions.cjs.map +2 -2
  46. package/build/store/reducer.cjs +3 -1
  47. package/build/store/reducer.cjs.map +2 -2
  48. package/build/store/selectors.cjs +5 -0
  49. package/build/store/selectors.cjs.map +2 -2
  50. package/build-module/components/media-editor/index.mjs +151 -67
  51. package/build-module/components/media-editor/index.mjs.map +2 -2
  52. package/build-module/components/media-editor/use-crop-options.mjs +2 -3
  53. package/build-module/components/media-editor/use-crop-options.mjs.map +2 -2
  54. package/build-module/components/media-editor/use-save-media-editor.mjs +36 -20
  55. package/build-module/components/media-editor/use-save-media-editor.mjs.map +2 -2
  56. package/build-module/components/media-editor-canvas/index.mjs +10 -10
  57. package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
  58. package/build-module/components/media-editor-crop-panel/index.mjs +13 -9
  59. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  60. package/build-module/components/media-editor-fine-rotation/index.mjs +1 -1
  61. package/build-module/components/media-editor-fine-rotation/index.mjs.map +2 -2
  62. package/build-module/components/media-editor-image-controls/index.mjs +47 -36
  63. package/build-module/components/media-editor-image-controls/index.mjs.map +2 -2
  64. package/build-module/components/media-editor-modal/index.mjs +19 -9
  65. package/build-module/components/media-editor-modal/index.mjs.map +2 -2
  66. package/build-module/components/media-editor-provider/index.mjs +2 -1
  67. package/build-module/components/media-editor-provider/index.mjs.map +2 -2
  68. package/build-module/components/media-form/index.mjs +33 -30
  69. package/build-module/components/media-form/index.mjs.map +2 -2
  70. package/build-module/components/media-preview/index.mjs +2 -2
  71. package/build-module/components/media-preview/index.mjs.map +2 -2
  72. package/build-module/hooks/use-crop-gesture-handlers.mjs +1 -1
  73. package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
  74. package/build-module/image-editor/core/interaction-controller.mjs +5 -0
  75. package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
  76. package/build-module/image-editor/react/components/cropper.mjs +4 -14
  77. package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
  78. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +1 -1
  79. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
  80. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +3 -1
  81. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +2 -2
  82. package/build-module/image-editor/react/hooks/use-interaction.mjs +1 -1
  83. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +2 -2
  84. package/build-module/state/composite-reducer.mjs +25 -10
  85. package/build-module/state/composite-reducer.mjs.map +2 -2
  86. package/build-module/state/index.mjs.map +1 -1
  87. package/build-module/state/media-editor-state-provider.mjs +1 -6
  88. package/build-module/state/media-editor-state-provider.mjs.map +2 -2
  89. package/build-module/state/types.mjs.map +1 -1
  90. package/build-module/state/use-media-editor-state.mjs +57 -42
  91. package/build-module/state/use-media-editor-state.mjs.map +2 -2
  92. package/build-module/store/actions.mjs +2 -0
  93. package/build-module/store/actions.mjs.map +2 -2
  94. package/build-module/store/reducer.mjs +3 -1
  95. package/build-module/store/reducer.mjs.map +2 -2
  96. package/build-module/store/selectors.mjs +4 -0
  97. package/build-module/store/selectors.mjs.map +2 -2
  98. package/build-style/style-rtl.css +5 -5
  99. package/build-style/style.css +5 -5
  100. package/build-types/components/media-editor/index.d.ts +4 -3
  101. package/build-types/components/media-editor/index.d.ts.map +1 -1
  102. package/build-types/components/media-editor/use-crop-options.d.ts +0 -1
  103. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
  104. package/build-types/components/media-editor/use-save-media-editor.d.ts +15 -3
  105. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
  106. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  107. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  108. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
  109. package/build-types/components/media-editor-modal/index.d.ts +7 -2
  110. package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
  111. package/build-types/components/media-editor-provider/index.d.ts +7 -1
  112. package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
  113. package/build-types/components/media-form/index.d.ts +5 -2
  114. package/build-types/components/media-form/index.d.ts.map +1 -1
  115. package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
  116. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
  117. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  118. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
  119. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -1
  120. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
  121. package/build-types/state/composite-reducer.d.ts +5 -5
  122. package/build-types/state/composite-reducer.d.ts.map +1 -1
  123. package/build-types/state/index.d.ts +2 -2
  124. package/build-types/state/index.d.ts.map +1 -1
  125. package/build-types/state/media-editor-state-provider.d.ts +8 -16
  126. package/build-types/state/media-editor-state-provider.d.ts.map +1 -1
  127. package/build-types/state/types.d.ts +34 -5
  128. package/build-types/state/types.d.ts.map +1 -1
  129. package/build-types/state/use-media-editor-state.d.ts +53 -35
  130. package/build-types/state/use-media-editor-state.d.ts.map +1 -1
  131. package/build-types/store/actions.d.ts +9 -1
  132. package/build-types/store/actions.d.ts.map +1 -1
  133. package/build-types/store/reducer.d.ts +3 -0
  134. package/build-types/store/reducer.d.ts.map +1 -1
  135. package/build-types/store/selectors.d.ts +1 -0
  136. package/build-types/store/selectors.d.ts.map +1 -1
  137. package/package.json +41 -25
  138. package/src/components/media-editor/index.tsx +213 -79
  139. package/src/components/media-editor/use-crop-options.ts +1 -3
  140. package/src/components/media-editor/use-save-media-editor.ts +61 -20
  141. package/src/components/media-editor-canvas/index.tsx +9 -10
  142. package/src/components/media-editor-crop-panel/index.tsx +17 -9
  143. package/src/components/media-editor-fine-rotation/index.tsx +1 -1
  144. package/src/components/media-editor-image-controls/index.tsx +41 -41
  145. package/src/components/media-editor-image-controls/style.scss +1 -1
  146. package/src/components/media-editor-modal/index.tsx +26 -11
  147. package/src/components/media-editor-provider/index.tsx +8 -1
  148. package/src/components/media-form/index.tsx +48 -42
  149. package/src/components/media-preview/index.tsx +2 -2
  150. package/src/hooks/use-crop-gesture-handlers.ts +3 -1
  151. package/src/image-editor/core/interaction-controller.ts +8 -0
  152. package/src/image-editor/docs/architecture.md +10 -2
  153. package/src/image-editor/docs/recipes.md +8 -8
  154. package/src/image-editor/react/components/cropper.scss +5 -5
  155. package/src/image-editor/react/components/cropper.tsx +9 -18
  156. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +3 -1
  157. package/src/image-editor/react/hooks/use-aria-announcer.ts +3 -1
  158. package/src/image-editor/react/hooks/use-interaction.ts +3 -2
  159. package/src/state/composite-reducer.ts +29 -17
  160. package/src/state/index.ts +3 -1
  161. package/src/state/media-editor-state-provider.tsx +9 -22
  162. package/src/state/types.ts +37 -5
  163. package/src/state/use-media-editor-state.ts +124 -78
  164. package/src/store/actions.ts +9 -0
  165. package/src/store/reducer.ts +6 -1
  166. package/src/store/selectors.ts +4 -0
  167. package/global.d.ts +0 -5
  168. package/src/components/media-editor/test/use-crop-options.jsdom.test.tsx +0 -104
  169. package/src/components/media-editor-crop-panel/test/index.jsdom.test.tsx +0 -74
  170. package/src/components/media-editor-image-controls/test/index.jsdom.test.tsx +0 -180
  171. package/src/components/media-editor-modal/test/build-modifiers.test.ts +0 -359
  172. package/src/components/media-editor-modal/test/index.jsdom.test.tsx +0 -165
  173. package/src/components/rotation-ruler/stories/index.story.tsx +0 -43
  174. package/src/components/rotation-ruler/test/index.jsdom.test.tsx +0 -140
  175. package/src/image-editor/core/export/test/canvas-renderer.jsdom.test.ts +0 -823
  176. package/src/image-editor/core/math/test/sanitize.ts +0 -242
  177. package/src/image-editor/core/test/camera.ts +0 -1218
  178. package/src/image-editor/core/test/interaction-controller.ts +0 -1254
  179. package/src/image-editor/core/test/preview-export-parity.ts +0 -249
  180. package/src/image-editor/core/test/render-camera-bridge.ts +0 -349
  181. package/src/image-editor/core/test/state.ts +0 -876
  182. package/src/image-editor/core/test/stencil-math.ts +0 -665
  183. package/src/image-editor/core/transforms/test/pipeline.ts +0 -267
  184. package/src/image-editor/react/components/stencils/test/rectangle-stencil.browser.test.tsx +0 -438
  185. package/src/image-editor/react/components/test/cropper.browser.test.tsx +0 -1460
  186. package/src/image-editor/react/hooks/test/use-aria-announcer.jsdom.test.ts +0 -491
  187. package/src/image-editor/react/hooks/test/use-cropper-reducer.jsdom.test.ts +0 -1049
  188. package/src/image-editor/react/hooks/test/use-interaction.jsdom.test.ts +0 -213
  189. package/src/image-editor/react/hooks/test/use-transform-style.jsdom.test.ts +0 -140
  190. package/src/image-editor/stories/rectangle-crop.story.tsx +0 -1073
  191. package/src/image-editor/stories/style.module.css +0 -65
  192. package/src/state/test/use-media-editor-state.jsdom.test.ts +0 -324
  193. package/src/store/test/reducer.ts +0 -64
  194. package/tsconfig.build.json +0 -26
  195. package/tsconfig.build.tsbuildinfo +0 -1
  196. package/tsconfig.json +0 -37
@@ -1,5 +1,5 @@
1
- import type { Field } from '@wordpress/dataviews';
2
- import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';
1
+ import type { Field, Form } from '@wordpress/dataviews';
2
+ import type { KeyboardEvent as ReactKeyboardEvent, ReactElement, ReactNode } from 'react';
3
3
  import type { Media } from '../media-editor-provider';
4
4
  import type { AspectRatioPreset } from '../../image-editor/core/constants';
5
5
  import { type MediaEditorSaveResult } from './use-save-media-editor';
@@ -30,11 +30,12 @@ export interface MediaEditorFrameProps {
30
30
  }
31
31
  export interface MediaEditorProps {
32
32
  fields?: Field<Media>[];
33
+ form?: Form;
33
34
  id: number;
34
35
  aspectRatioPresets?: AspectRatioPreset[];
35
36
  onClose?: () => void;
36
37
  onSaved?: (result: MediaEditorSaveResult) => void;
37
- renderFrame: (props: MediaEditorFrameProps) => JSX.Element;
38
+ renderFrame: (props: MediaEditorFrameProps) => ReactElement;
38
39
  noticesClassName?: string;
39
40
  noticesPortalElement?: Element | null;
40
41
  shouldCloseOnEsc?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAStD,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;AA0BrE,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAE,KAAK,EAAE,kBAAkB,CAAE,WAAW,CAAE,KAAM,I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M,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iBAAS,aAAa,CAAE,EAAE,eAAuB,EAAE,EAAE,kBAAkB,+BAiGtE;AAED,iBAAS,cAAc,uCAiFtB;AAED,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC7B;AAED,iBAAS,WAAW,CAAE,EAAE,IAAgB,EAAE,EAAE,gBAAgB,+BAkC3D;AAigBD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;yBANe,WAAW;;;;;eAeZ,WAAW"}
@@ -7,7 +7,6 @@ interface UseCropOptionsReturn {
7
7
  setAspectRatioValue: (value: string) => void;
8
8
  aspectRatioOptions: AspectRatioPreset[];
9
9
  resolvedAspectRatio: number | undefined;
10
- resetCropOptions: () => void;
11
10
  }
12
11
  /**
13
12
  * Build the preset list shown in the dropdown — always include the
@@ -1 +1 @@
1
- {"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AAEA,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,GAClB,GAAE,kBAAuB,GAAI,oBAAoB,CAsBjD"}
1
+ {"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AAEA,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;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GACtC,iBAAiB,EAAE,CAMrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAE,EAC/B,kBAAkB,GAClB,GAAE,kBAAuB,GAAI,oBAAoB,CAqBjD"}
@@ -1,5 +1,5 @@
1
1
  import type { Media } from '../media-editor-provider';
2
- import type { MediaEditorController } from '../../state';
2
+ import type { MediaEditorSession } from '../../state';
3
3
  export declare const MEDIA_EDITOR_NOTICES_CONTEXT = "media-editor";
4
4
  export interface MediaEditorSaveResult {
5
5
  id: number;
@@ -11,16 +11,28 @@ export interface MediaEditorSaveResult {
11
11
  };
12
12
  }
13
13
  interface UseSaveMediaEditorArgs {
14
- cropper: MediaEditorController;
14
+ session: MediaEditorSession;
15
15
  id: number;
16
16
  isImage: boolean;
17
17
  media?: Media | null;
18
18
  onSaved?: (result: MediaEditorSaveResult) => void;
19
+ /**
20
+ * When another attachment has replaced the edited one (today, the original
21
+ * via "Restore original image"), the save targets the replacement:
22
+ * - with no fresh crop, the block is repointed at the replacement and any
23
+ * changed details are saved there (no `/edit`);
24
+ * - with a fresh crop, `/edit` runs against the replacement's id and url.
25
+ */
26
+ replacementSource?: {
27
+ id: number;
28
+ url?: string;
29
+ media: Media;
30
+ };
19
31
  }
20
32
  interface UseSaveMediaEditorReturn {
21
33
  isSaving: boolean;
22
34
  save: () => Promise<void>;
23
35
  }
24
- export declare function useSaveMediaEditor({ cropper, id, isImage, media, onSaved, }: UseSaveMediaEditorArgs): UseSaveMediaEditorReturn;
36
+ export declare function useSaveMediaEditor({ session, id, isImage, media, onSaved, replacementSource, }: UseSaveMediaEditorArgs): UseSaveMediaEditorReturn;
25
37
  export {};
26
38
  //# sourceMappingURL=use-save-media-editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"AAMA,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,GACP,EAAE,sBAAsB,GAAI,wBAAwB,CAuHpD"}
1
+ {"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiBtD,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,kBAAkB,CAAC;IAC5B,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;IACpD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,KAAK,CAAC;KACb,CAAC;CACF;AAED,UAAU,wBAAwB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,OAAO,CAAE,IAAI,CAAE,CAAC;CAC5B;AAiCD,wBAAgB,kBAAkB,CAAE,EACnC,OAAO,EACP,EAAE,EACF,OAAO,EACP,KAAK,EACL,OAAO,EACP,iBAAiB,GACjB,EAAE,sBAAsB,GAAI,wBAAwB,CAkJpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,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;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,QAAgB,GAChB,EAAE,sBAAsB,sCAmIxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,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;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,QAAgB,GAChB,EAAE,sBAAsB,sCAkIxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAKA,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,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,QAAgB,GAChB,EAAE,yBAAyB,+BA0B3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAIA,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,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,QAAgB,GAChB,EAAE,yBAAyB,+BAmC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,mCAAmC,CAAC;AAI3C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC7C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,EAChC,QAAgB,GAChB,EAAE,6BAA6B,+BA+L/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,mCAAmC,CAAC;AAI3C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC7C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,EAChC,QAAgB,GAChB,EAAE,6BAA6B,+BAmM/B"}
@@ -1,4 +1,4 @@
1
- import type { Field } from '@wordpress/dataviews';
1
+ import type { Field, Form } from '@wordpress/dataviews';
2
2
  import type { Media } from '../media-editor-provider';
3
3
  import type { AspectRatioPreset } from '../../image-editor/core/constants';
4
4
  interface MediaEditorModalProps {
@@ -9,12 +9,17 @@ interface MediaEditorModalProps {
9
9
  * since `@wordpress/media-editor` cannot depend on `@wordpress/editor`.
10
10
  */
11
11
  fields?: Field<Media>[];
12
+ /**
13
+ * Form the fields are laid out with in the Details tab. When omitted,
14
+ * a default layout of the core attachment fields is used.
15
+ */
16
+ form?: Form;
12
17
  /**
13
18
  * Fixed aspect-ratio presets for image cropping. Free and Original are
14
19
  * always provided by the media editor.
15
20
  */
16
21
  aspectRatioPresets?: AspectRatioPreset[];
17
22
  }
18
- export declare function MediaEditorModal({ fields, aspectRatioPresets, }: MediaEditorModalProps): import("react").JSX.Element | null;
23
+ export declare function MediaEditorModal({ fields, form, aspectRatioPresets, }: MediaEditorModalProps): import("react").JSX.Element | null;
19
24
  export default MediaEditorModal;
20
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,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;AAqBD,wBAAgB,gBAAgB,CAAE,EACjC,MAAW,EACX,kBAAkB,GAClB,EAAE,qBAAqB,sCAwGvB;eAEc,gBAAgB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGxD,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,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAqBD,wBAAgB,gBAAgB,CAAE,EACjC,MAAW,EACX,IAAI,EACJ,kBAAkB,GAClB,EAAE,qBAAqB,sCAiHvB;eAEc,gBAAgB"}
@@ -1,4 +1,4 @@
1
- import type { Field } from '@wordpress/dataviews';
1
+ import type { Field, Form } from '@wordpress/dataviews';
2
2
  import type { ReactNode } from 'react';
3
3
  /**
4
4
  * Media object from WordPress REST API.
@@ -29,6 +29,7 @@ export interface MediaEditorContextValue {
29
29
  media?: Media;
30
30
  onChange?: (updates: Partial<Media>) => void;
31
31
  fields: Field<Media>[];
32
+ form?: Form;
32
33
  }
33
34
  /**
34
35
  * Props for MediaEditorProvider.
@@ -46,6 +47,11 @@ export interface MediaEditorProviderProps {
46
47
  /** Configuration settings for the media editor. */
47
48
  settings?: {
48
49
  fields?: Field<Media>[];
50
+ /**
51
+ * The form the fields are laid out with. When omitted, `MediaForm`
52
+ * uses a default layout of the core attachment fields.
53
+ */
54
+ form?: Form;
49
55
  };
50
56
  /** Child components. */
51
57
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-provider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,KAAK;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CA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M,IAAI,CAAC;IACjD,mDAAmD;IACnD,QAAQ,CAAC,EAAE;QACV,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;QAC1B;;;WAGG;QACH,IAAI,CAAC,EAAE,IAAI,CAAC;KACZ,CAAC;IACF,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACpB;AAMD,wBAAgB,mBAAmB,CAAE,EACpC,KAAK,EACL,QAAQ,EACR,QAAa,EACb,QAAQ,GACR,EAAE,wBAAwB,+BAa1B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,uBAAuB,CAQ/D"}
@@ -11,10 +11,13 @@ export interface MediaFormProps {
11
11
  * MediaForm component for editing media metadata.
12
12
  *
13
13
  * Renders a DataForm with fields for editing media properties like
14
- * title, alt text, caption, description, etc.
14
+ * title, alt text, caption, description, etc. The fields are laid out with
15
+ * the `form` prop, else the form of the provider settings, else a default
16
+ * form of the core attachment fields.
15
17
  *
16
18
  * @param props - Component props.
17
- * @param props.form - Optional form configuration.
19
+ * @param props.form - Optional form configuration, which takes precedence
20
+ * over the form of the provider settings.
18
21
  * @param props.header - Optional header content to display above the form.
19
22
  * @return The MediaForm component.
20
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;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,GACN,EAAE,cAAc,+BA+DhB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAOjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiCvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAClC,IAAI,EAAE,aAAa,EACnB,MAAM,GACN,EAAE,cAAc,+BAkChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-crop-gesture-handlers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-crop-gesture-handlers.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAKrD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,GAAE,6BAAkC;;;;;;;EAoD3C"}
1
+ {"version":3,"file":"use-crop-gesture-handlers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-crop-gesture-handlers.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAKrD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,GAAE,6BAAkC;;;;;;;EAsD3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE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AU,GAAI,IAAI,CA0DjC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CACf,CAAC,EAAE,UAAU,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,GAAE,QAAmB,GACtB,IAAI,CA6FN;IAOD,OAAO,CAAC,eAAe,CA2JrB;IAQF,OAAO,CAAC,YAAY;IAkFpB;;;;;;OAMG;IACH,aAAa,CAAE,CAAC,EAAE,aAAa,GAAI,IAAI,CAwHtC;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAmBd;CACD"}
1
+ {"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA6CnE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,0DAA0D;IAC1D,MAAM,EAAE,CAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAClC,sDAAsD;IACtD,cAAc,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IAC/D,iCAAiC;IACjC,YAAY,EAAE,CAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAM,IAAI,CAAC;IAC5C,qCAAqC;IACrC,UAAU,CAAC,EAAE,CAAE,SAAS,EAAE,YAAY,GAAG,UAAU,KAAM,IAAI,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC5C,sEAAsE;IACtE,QAAQ,EAAE,MAAM,YAAY,CAAC;IAC7B,6EAA6E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E,4BAA4B,EAEjD;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,uEAAuE;IACvE,OAAO,KAAK,SAAS,GAEpB;IAED,0EAA0E;IAC1E,OAAO,KAAK,YAAY,GAEvB;IAED;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAMvB,2EAA2E;IAC3E,OAAO,KAAK,aAAa,GAExB;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS;IA0BjB;;;;;;;;;OASG;IACH,iBAAiB,CAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,GAAI,IAAI,CAyG1D;IAED;;;;;;;;;OASG;IACH,WAAW,CAAE,CAAC,EAAE,UAAU,GAAI,IAAI,CA0DjC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CACf,CAAC,EAAE,UAAU,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,GAAE,QAAmB,GACtB,IAAI,CA6FN;IAOD,OAAO,CAAC,eAAe,CA2JrB;IAQF,OAAO,CAAC,YAAY;IAkFpB;;;;;;OAMG;IACH,aAAa,CAAE,CAAC,EAAE,aAAa,GAAI,IAAI,CAwHtC;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAmBd;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACX,YAAY,EAEZ,YAAY,EACZ,IAAI,EAEJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA2CtE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,UAAU,EAAE,iBAAiB,CAAC;IAC9B,yEAAyE;IACzE,OAAO,CAAC,EAAE,KAAK,CA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xB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,UAAU,EAAE,iBAAiB,CAAC;IAC9B,yEAAyE;IACzE,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,YAAY,CAAE,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACnC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACvC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,CAAE,KAAK,EAAE,YAAY,KAAM,IAAI,CAAC;IAChD,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AA69BD,eAAO,MAAM,OAAO,yGAMnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAmExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAoB,EACpB,gBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,kBAAkB,GAClB,EAAE,qBAAqB,sCAmfvB"}
1
+ {"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAmExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAoB,EACpB,gBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,kBAAkB,GAClB,EAAE,qBAAqB,sCAqfvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-aria-announcer.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-aria-announcer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgJrD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,YAAY,GAAI,IAAI,CAgC5D"}
1
+ {"version":3,"file":"use-aria-announcer.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-aria-announcer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgJrD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,YAAY,GAAI,IAAI,CAkC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-interaction.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-interaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8DAA8D;IAC9D,QAAQ,EAAE;QACT,aAAa,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAM,IAAI,CAAC;QACjD,YAAY,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC;QAC9C,SAAS,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,aAAa,KAAM,IAAI,CAAC;KAC9C,CAAC;IACF,yEAAyE;IACzE,aAAa,EAAE,CAAE,CAAC,EAAE,UAAU,KAAM,IAAI,CAAC;IACzC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AA6BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,yBAAyB,EAClC,aAAa,EAAE,IAAI,EACnB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,oBAAoB,CA6LtB"}
1
+ {"version":3,"file":"use-interaction.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-interaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8DAA8D;IAC9D,QAAQ,EAAE;QACT,aAAa,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAM,IAAI,CAAC;QACjD,YAAY,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC;QAC9C,SAAS,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,aAAa,KAAM,IAAI,CAAC;KAC9C,CAAC;IACF,yEAAyE;IACzE,aAAa,EAAE,CAAE,CAAC,EAAE,UAAU,KAAM,IAAI,CAAC;IACzC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AA6BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,yBAAyB,EAClC,aAAa,EAAE,IAAI,EACnB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,oBAAoB,CA8LtB"}
@@ -1,5 +1,5 @@
1
1
  import { type CropperState } from '../image-editor';
2
- import { type CropOptionsSlice, type MediaEditorAction, type MediaEditorState } from './types';
2
+ import { type MediaEditorAction, type MediaEditorState } from './types';
3
3
  /**
4
4
  * Pure composite reducer for the media editor.
5
5
  *
@@ -26,11 +26,11 @@ export declare function mediaEditorReducer(state: MediaEditorState, action: Medi
26
26
  */
27
27
  export declare function areMediaEditorStatesEqual(a: MediaEditorState, b: MediaEditorState): boolean;
28
28
  /**
29
- * Build the initial composite state from optional partial overrides.
29
+ * Build the composite state a session starts from: the given cropper
30
+ * slice, default crop options, and no edits.
30
31
  *
31
- * @param initialCropper Initial cropper-slice fields to merge.
32
- * @param initialOptions Initial cropOptions-slice fields to merge.
32
+ * @param cropper The cropper slice.
33
33
  * @return Composite initial state.
34
34
  */
35
- export declare function buildInitialMediaEditorState(initialCropper: CropperState, initialOptions?: Partial<CropOptionsSlice>): MediaEditorState;
35
+ export declare function buildInitialMediaEditorState(cropper: CropperState): MediaEditorState;
36
36
  //# sourceMappingURL=composite-reducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composite-reducer.d.ts","sourceRoot":"","sources":["../../src/state/composite-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,GACvB,gBAAgB,CAgElB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,gBAAgB,EACnB,CAAC,EAAE,gBAAgB,GACjB,OAAO,CAQT;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,cAAc,EAAE,YAAY,EAC5B,cAAc,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,GAC1C,gBAAgB,CAKlB"}
1
+ {"version":3,"file":"composite-reducer.d.ts","sourceRoot":"","sources":["../../src/state/composite-reducer.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,GACvB,gBAAgB,CA0ElB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,gBAAgB,EACnB,CAAC,EAAE,gBAAgB,GACjB,OAAO,CAST;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,YAAY,GACnB,gBAAgB,CAMlB"}
@@ -1,7 +1,7 @@
1
1
  export { useMediaEditorState, resolveAspectRatio, } from './use-media-editor-state';
2
- export type { MediaEditorController } from './use-media-editor-state';
2
+ export type { MediaEditorSession } from './use-media-editor-state';
3
3
  export { MediaEditorStateProvider, useMediaEditor, } from './media-editor-state-provider';
4
4
  export { mediaEditorReducer, areMediaEditorStatesEqual, buildInitialMediaEditorState, } from './composite-reducer';
5
5
  export { DEFAULT_CROP_OPTIONS } from './types';
6
- export type { CropOptionsSlice, MediaEditorState, MediaEditorAction, } from './types';
6
+ export type { CropOptionsSlice, EditsSlice, EditValue, MediaEditorState, MediaEditorAction, } from './types';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACN,wBAAwB,EACxB,cAAc,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACN,wBAAwB,EACxB,cAAc,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,SAAS,CAAC"}
@@ -1,31 +1,23 @@
1
- import type { CropperState } from '../image-editor';
2
- import { type MediaEditorController } from './use-media-editor-state';
3
- import type { CropOptionsSlice } from './types';
1
+ import { type MediaEditorSession } from './use-media-editor-state';
4
2
  interface MediaEditorStateProviderProps {
5
- /** Optional cropper-slice initial state. */
6
- initialCropperState?: Partial<CropperState>;
7
- /** Optional cropOptions-slice initial state. */
8
- initialCropOptions?: Partial<CropOptionsSlice>;
9
3
  /** Child components. */
10
4
  children: React.ReactNode;
11
5
  }
12
6
  /**
13
- * Provider that vends the composite media-editor controller via
14
- * context. Wrap the media editor in this so every consumer
15
- * (canvas, toolbar, sidebar) reads from the same store.
7
+ * Provider that vends the media editor session via context. Wrap
8
+ * the media editor in this so every consumer (canvas, toolbar,
9
+ * sidebar) reads from the same store.
16
10
  *
17
11
  * @param props
18
- * @param props.initialCropperState
19
- * @param props.initialCropOptions
20
12
  * @param props.children
21
13
  */
22
- export declare function MediaEditorStateProvider({ initialCropperState, initialCropOptions, children, }: MediaEditorStateProviderProps): import("react").JSX.Element;
14
+ export declare function MediaEditorStateProvider({ children, }: MediaEditorStateProviderProps): import("react").JSX.Element;
23
15
  /**
24
- * Consume the composite media-editor controller. Throws if used
16
+ * Consume the media editor session. Throws if used
25
17
  * outside a `<MediaEditorStateProvider>`.
26
18
  *
27
- * @return The composite controller.
19
+ * @return The media editor session.
28
20
  */
29
- export declare function useMediaEditor(): MediaEditorController;
21
+ export declare function useMediaEditor(): MediaEditorSession;
30
22
  export {};
31
23
  //# sourceMappingURL=media-editor-state-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media-editor-state-provider.d.ts","sourceRoot":"","sources":["../../src/state/media-editor-state-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD,UAAU,6BAA6B;IACtC,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,CAAC;IAC9C,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,CAAC;IACjD,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAE,EACzC,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,GACR,EAAE,6BAA6B,+BAW/B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,qBAAqB,CAQtD"}
1
+ {"version":3,"file":"media-editor-state-provider.d.ts","sourceRoot":"","sources":["../../src/state/media-editor-state-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAMlC,UAAU,6BAA6B;IACtC,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAE,EACzC,QAAQ,GACR,EAAE,6BAA6B,+BAQ/B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,kBAAkB,CAQnD"}
@@ -17,9 +17,25 @@ export interface CropOptionsSlice {
17
17
  */
18
18
  export declare const DEFAULT_CROP_OPTIONS: CropOptionsSlice;
19
19
  /**
20
- * The full composite state for the media editor — cropper geometry
21
- * plus the sidebar control slice. Future feature slices (text
22
- * overlays, filters, …) extend this object.
20
+ * A value an edit can hold: plain data only, because the session
21
+ * compares values by content to tell a real change from a no-op.
22
+ * Anything else, such as a `Blob`, would compare equal to any other
23
+ * and the change would be dropped — keep bytes behind a URL instead.
24
+ *
25
+ * Objects must satisfy the index signature, so type a value with a
26
+ * `type` alias rather than an `interface`.
27
+ */
28
+ export type EditValue = string | number | boolean | null | EditValue[] | {
29
+ [key: string]: EditValue;
30
+ };
31
+ /**
32
+ * Named edits other than crop, keyed by edit name (for example
33
+ * `my-plugin/vignette`). An edit that is not present means "no edit".
34
+ */
35
+ export type EditsSlice = Record<string, EditValue>;
36
+ /**
37
+ * The full composite state for the media editor — cropper geometry,
38
+ * the sidebar control slice, and named edits.
23
39
  *
24
40
  * Every undo/redo snapshot is a full `MediaEditorState`. Slices stay
25
41
  * referentially equal across actions that don't touch them.
@@ -27,6 +43,7 @@ export declare const DEFAULT_CROP_OPTIONS: CropOptionsSlice;
27
43
  export interface MediaEditorState {
28
44
  cropper: CropperState;
29
45
  cropOptions: CropOptionsSlice;
46
+ edits: EditsSlice;
30
47
  }
31
48
  /**
32
49
  * Composite reducer action union.
@@ -68,9 +85,21 @@ export type MediaEditorAction =
68
85
  visualSize: Size;
69
86
  };
70
87
  }
71
- /** Reset cropOptions to defaults. */
88
+ /**
89
+ * Put every slice back to its starting state, keeping the image:
90
+ * default geometry, default crop options, no edits. One action,
91
+ * so one undo entry.
92
+ */
93
+ | {
94
+ type: 'RESET';
95
+ }
96
+ /** Set a named edit, or remove it when `value` is `undefined`. */
72
97
  | {
73
- type: 'RESET_CROP_OPTIONS';
98
+ type: 'SET_EDIT';
99
+ payload: {
100
+ name: string;
101
+ value: EditValue | undefined;
102
+ };
74
103
  }
75
104
  /**
76
105
  * Replace the entire composite state with `payload`. Used by
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO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AErD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB;AAC5B;;;;GAIG;AACD;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;CACrB;AACH;;;;GAIG;GACD;IACA,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE;QACR,gDAAgD;QAChD,SAAS,EAAE,MAAM,CAAC;QAClB;;;WAGG;QACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B;;;;WAIG;QACH,UAAU,EAAE,IAAI,CAAC;KACjB,CAAC;CACD;AACH;;;;GAIG;GACD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE;AACnB,kEAAkE;GAChE;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAA;KAAE,CAAC;CACvD;AACH;;;GAGG;GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE;AACzD;;;;;GAKG;GACD;IACA,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,cAAc,CAAC;CACvB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { type CropperController, type CropperState, type NormalizedRect, type Size } from '../image-editor';
2
- import type { CropOptionsSlice } from './types';
1
+ import { type CropperController, type CropperState } from '../image-editor';
2
+ import type { CropOptionsSlice, EditsSlice, EditValue } from './types';
3
3
  /**
4
4
  * Resolve an aspect-ratio preset value (the string the dropdown
5
5
  * round-trips) into a numeric width/height ratio for the cropper.
@@ -18,23 +18,57 @@ import type { CropOptionsSlice } from './types';
18
18
  */
19
19
  export declare function resolveAspectRatio(presetKey: string, cropperImage: CropperState['image'] | null): number | undefined;
20
20
  /**
21
- * The composite controller exposed by `useMediaEditorState`.
21
+ * The media editor session exposed by `useMediaEditorState`.
22
22
  *
23
- * Satisfies `CropperController` (so a `<Cropper>` can take this
24
- * controller directly via the `controller` prop) and adds slice
25
- * setters, undo/redo, gesture boundaries, and viewport reporting.
23
+ * The session owns what is being edited and how: the source image,
24
+ * every editing slice, the shared undo/redo history, gesture
25
+ * boundaries, and whether the edits change the saved image. The
26
+ * cropper is one participant in the session — `cropper` is a
27
+ * geometry-only controller that a `<Cropper>` takes via its
28
+ * `controller` prop — rather than the session itself.
26
29
  */
27
- export interface MediaEditorController extends CropperController {
30
+ export interface MediaEditorSession {
31
+ /**
32
+ * Geometry controller for the cropper slice. Its setters record
33
+ * history in the session; its `isDirty` covers geometry only.
34
+ * Its `setImage` is `setSourceImage`, so the `<Cropper>` reporting
35
+ * a newly loaded image starts a fresh session.
36
+ */
37
+ cropper: CropperController;
28
38
  /** The cropOptions slice. */
29
39
  cropOptions: CropOptionsSlice;
30
40
  /** Set the aspect-ratio preset. Atomic with the cropRect reshape. */
31
41
  setAspectRatioValue: (presetKey: string) => void;
32
- /** Reset cropOptions to defaults. */
33
- resetCropOptions: () => void;
34
42
  /**
35
- * Whether the cropper geometry differs from the initial baseline.
43
+ * Put every slice back to its starting state in one undo entry:
44
+ * default geometry and crop options, no edits. Keeps the image.
45
+ */
46
+ reset: () => void;
47
+ /** The named edits other than crop, keyed by edit name. */
48
+ edits: EditsSlice;
49
+ /**
50
+ * Set a named edit, or remove it by passing `undefined`. Recorded
51
+ * in the session history like any crop change. Setting a value
52
+ * equal in content to the current one is a no-op.
53
+ */
54
+ setEdit: (name: string, value: EditValue | undefined) => void;
55
+ /**
56
+ * Replace the image being edited. A different image starts a
57
+ * fresh session: default geometry and crop options, a clean
58
+ * baseline, and no history. Reporting the same image again is a
59
+ * no-op.
60
+ */
61
+ setSourceImage: (image: CropperState['image']) => void;
62
+ /**
63
+ * Whether anything in the session differs from its baseline,
64
+ * including editor-only state such as the aspect-ratio preset.
36
65
  */
37
- isCropperDirty: boolean;
66
+ isDirty: boolean;
67
+ /**
68
+ * Whether the edits change the saved image, so saving has to
69
+ * produce new image output rather than only metadata.
70
+ */
71
+ hasOutputEdits: boolean;
38
72
  /** Whether there's an undoable change in history. */
39
73
  hasUndo: boolean;
40
74
  /** Whether there's a redoable change in history. */
@@ -51,29 +85,13 @@ export interface MediaEditorController extends CropperController {
51
85
  beginGesture: () => void;
52
86
  /** Close a gesture boundary and commit the pre-gesture snapshot. */
53
87
  endGesture: () => void;
54
- /**
55
- * Report the current rendered image size to the controller. The
56
- * Cropper component calls this whenever its visualSize changes;
57
- * the controller needs it to compute aspect-ratio reshapes.
58
- */
59
- setVisualSize: (size: Size) => void;
60
- /**
61
- * Reshape the cropRect in response to a viewport change. Behaves
62
- * like `setCropRect` but does NOT record an undo entry — window
63
- * resizes aren't editor actions.
64
- */
65
- adjustCropRectForViewport: (rect: NormalizedRect) => void;
66
- }
67
- interface InitialMediaEditorState {
68
- cropper?: Partial<CropperState>;
69
- cropOptions?: Partial<CropOptionsSlice>;
70
88
  }
71
89
  /**
72
- * Composite store for the media editor.
90
+ * The media editor session.
73
91
  *
74
92
  * Owns the only undo/redo history for the editor. Cropper geometry
75
- * actions and sidebar cropOptions actions flow through the same
76
- * reducer and the same history stack.
93
+ * actions, sidebar cropOptions actions and named edits flow through
94
+ * the same reducer and the same history stack.
77
95
  *
78
96
  * History semantics:
79
97
  * - Each action's pre-state is pushed to the undo stack before the
@@ -87,12 +105,12 @@ interface InitialMediaEditorState {
87
105
  * undo entries.
88
106
  *
89
107
  * `isDirty` tracks the full editor session, including undoable UI
90
- * state. Use `isCropperDirty` when deciding whether the image output
108
+ * state. Use `hasOutputEdits` when deciding whether the image output
91
109
  * needs saving.
92
110
  *
93
- * @param initialState Optional seed for the cropper and cropOptions slices.
94
- * @return The composite controller.
111
+ * The session starts empty. Call `setSourceImage` to load an image.
112
+ *
113
+ * @return The media editor session.
95
114
  */
96
- export declare function useMediaEditorState(initialState?: InitialMediaEditorState): MediaEditorController;
97
- export {};
115
+ export declare function useMediaEditorState(): MediaEditorSession;
98
116
  //# sourceMappingURL=use-media-editor-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-media-editor-state.d.ts","sourceRoot":"","sources":["../../src/state/use-media-editor-state.ts"],"names":[],"mappings":"AAOA,OAAO,EAQN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EACX,gBAAgB,EAGhB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,CAAE,OAAO,CAAE,GAAG,IAAI,GAC1C,MAAM,GAAG,SAAS,CAmBpB;AAaD;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC/D,6BAA6B;IAC7B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,qEAAqE;IACrE,mBAAmB,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACnD,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qDAAqD;IACrD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,oEAAoE;IACpE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;;OAIG;IACH,aAAa,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACtC;;;;OAIG;IACH,yBAAyB,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;CAC5D;AAED,UAAU,uBAAuB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAClC,YAAY,CAAC,EAAE,uBAAuB,GACpC,qBAAqB,CA8SvB"}
1
+ {"version":3,"file":"use-media-editor-state.d.ts","sourceRoot":"","sources":["../../src/state/use-media-editor-state.ts"],"names":[],"mappings":"AAOA,OAAO,EAQN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAGjB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EAGT,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,CAAE,OAAO,CAAE,GAAG,IAAI,GAC1C,MAAM,GAAG,SAAS,CAmBpB;AAaD;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAC3B,6BAA6B;IAC7B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,qEAAqE;IACrE,mBAAmB,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACnD;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,2DAA2D;IAC3D,KAAK,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,KAAM,IAAI,CAAC;IAChE;;;;;OAKG;IACH,cAAc,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,OAAO,CAAE,KAAM,IAAI,CAAC;IAC3D;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qDAAqD;IACrD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,oEAAoE;IACpE,UAAU,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,IAAI,kBAAkB,CA0UxD"}
@@ -14,12 +14,20 @@ export interface MediaEditorModalUpdate {
14
14
  interface OpenMediaEditorModalArgs {
15
15
  id: number;
16
16
  onUpdate?: (updated: MediaEditorModalUpdate) => void;
17
+ /**
18
+ * Restore the caller's state after a saved attachment change. May run
19
+ * before an asynchronous `onUpdate` finishes; the caller should cancel
20
+ * that update. Without this callback, Undo calls `onUpdate` with the
21
+ * previous attachment's id and URL.
22
+ */
23
+ onUndo?: () => void;
17
24
  onClose?: () => void;
18
25
  }
19
- export declare function openMediaEditorModal({ id, onUpdate, onClose, }: OpenMediaEditorModalArgs): {
26
+ export declare function openMediaEditorModal({ id, onUpdate, onUndo, onClose, }: OpenMediaEditorModalArgs): {
20
27
  type: 'OPEN_MEDIA_EDITOR_MODAL';
21
28
  id: number;
22
29
  onUpdate: ((updated: MediaEditorModalUpdate) => void) | null;
30
+ onUndo: (() => void) | null;
23
31
  onClose: (() => void) | null;
24
32
  };
25
33
  export declare function closeMediaEditorModal(): {
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAE,EACrC,EAAE,EACF,QAAQ,EACR,OAAO,GACP,EAAE,wBAAwB;UAEnB,yBAAyB;;yBAVV,sBAAsB,KAAM,IAAI;oBACtC,IAAI;EAcpB;AAED,wBAAgB,qBAAqB;IAC3B,IAAI,EAAE,0BAA0B;EACzC"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;IACvD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAE,EACrC,EAAE,EACF,QAAQ,EACR,MAAM,EACN,OAAO,GACP,EAAE,wBAAwB;UAEnB,yBAAyB;;yBAlBV,sBAAsB,KAAM,IAAI;mBAOvC,IAAI;oBACH,IAAI;EAgBpB;AAED,wBAAgB,qBAAqB;IAC3B,IAAI,EAAE,0BAA0B;EACzC"}