@wordpress/media-editor 0.3.1-next.v.202602271551.0 → 0.3.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 (124) hide show
  1. package/build-types/components/media-editor/index.d.ts +42 -0
  2. package/build-types/components/media-editor/index.d.ts.map +1 -0
  3. package/build-types/components/media-editor/use-crop-options.d.ts +35 -0
  4. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -0
  5. package/build-types/components/media-editor/use-save-media-editor.d.ts +29 -0
  6. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -0
  7. package/build-types/components/media-editor-canvas/index.d.ts +26 -0
  8. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -0
  9. package/build-types/components/media-editor-crop-panel/index.d.ts +31 -0
  10. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -0
  11. package/build-types/components/media-editor-fine-rotation/index.d.ts +15 -0
  12. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -0
  13. package/build-types/components/media-editor-image-controls/index.d.ts +46 -0
  14. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -0
  15. package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts +6 -0
  16. package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -0
  17. package/build-types/components/media-editor-modal/build-modifiers.d.ts +83 -0
  18. package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -0
  19. package/build-types/components/media-editor-modal/index.d.ts +20 -0
  20. package/build-types/components/media-editor-modal/index.d.ts.map +1 -0
  21. package/build-types/components/rotation-ruler/index.d.ts +46 -0
  22. package/build-types/components/rotation-ruler/index.d.ts.map +1 -0
  23. package/build-types/components/rotation-ruler/stories/index.story.d.ts +14 -0
  24. package/build-types/components/rotation-ruler/stories/index.story.d.ts.map +1 -0
  25. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts +61 -0
  26. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -0
  27. package/build-types/hooks/use-crop-gesture-handlers.d.ts +41 -0
  28. package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -0
  29. package/build-types/image-editor/core/camera.d.ts +107 -0
  30. package/build-types/image-editor/core/camera.d.ts.map +1 -0
  31. package/build-types/image-editor/core/constants.d.ts +83 -0
  32. package/build-types/image-editor/core/constants.d.ts.map +1 -0
  33. package/build-types/image-editor/core/containment.d.ts +75 -0
  34. package/build-types/image-editor/core/containment.d.ts.map +1 -0
  35. package/build-types/image-editor/core/crop-rect.d.ts +19 -0
  36. package/build-types/image-editor/core/crop-rect.d.ts.map +1 -0
  37. package/build-types/image-editor/core/export/canvas-renderer.d.ts +106 -0
  38. package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +1 -0
  39. package/build-types/image-editor/core/index.d.ts +10 -0
  40. package/build-types/image-editor/core/index.d.ts.map +1 -0
  41. package/build-types/image-editor/core/interaction-controller.d.ts +194 -0
  42. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -0
  43. package/build-types/image-editor/core/math/rotation.d.ts +18 -0
  44. package/build-types/image-editor/core/math/rotation.d.ts.map +1 -0
  45. package/build-types/image-editor/core/math/sanitize.d.ts +70 -0
  46. package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -0
  47. package/build-types/image-editor/core/setter-helpers.d.ts +24 -0
  48. package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -0
  49. package/build-types/image-editor/core/source-region.d.ts +75 -0
  50. package/build-types/image-editor/core/source-region.d.ts.map +1 -0
  51. package/build-types/image-editor/core/state.d.ts +54 -0
  52. package/build-types/image-editor/core/state.d.ts.map +1 -0
  53. package/build-types/image-editor/core/stencil-math.d.ts +97 -0
  54. package/build-types/image-editor/core/stencil-math.d.ts.map +1 -0
  55. package/build-types/image-editor/core/transform-style.d.ts +23 -0
  56. package/build-types/image-editor/core/transform-style.d.ts.map +1 -0
  57. package/build-types/image-editor/core/transforms/pipeline.d.ts +27 -0
  58. package/build-types/image-editor/core/transforms/pipeline.d.ts.map +1 -0
  59. package/build-types/image-editor/core/types.d.ts +255 -0
  60. package/build-types/image-editor/core/types.d.ts.map +1 -0
  61. package/build-types/image-editor/core/viewport-state.d.ts +7 -0
  62. package/build-types/image-editor/core/viewport-state.d.ts.map +1 -0
  63. package/build-types/image-editor/index.d.ts +16 -0
  64. package/build-types/image-editor/index.d.ts.map +1 -0
  65. package/build-types/image-editor/react/components/cropper-provider.d.ts +41 -0
  66. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -0
  67. package/build-types/image-editor/react/components/cropper.d.ts +62 -0
  68. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -0
  69. package/build-types/image-editor/react/components/index.d.ts +4 -0
  70. package/build-types/image-editor/react/components/index.d.ts.map +1 -0
  71. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +36 -0
  72. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -0
  73. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +20 -0
  74. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -0
  75. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +30 -0
  76. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -0
  77. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +33 -0
  78. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -0
  79. package/build-types/image-editor/react/components/viewport-provider.d.ts +9 -0
  80. package/build-types/image-editor/react/components/viewport-provider.d.ts.map +1 -0
  81. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +47 -0
  82. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -0
  83. package/build-types/image-editor/react/hooks/index.d.ts +5 -0
  84. package/build-types/image-editor/react/hooks/index.d.ts.map +1 -0
  85. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +16 -0
  86. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -0
  87. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +58 -0
  88. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -0
  89. package/build-types/image-editor/react/hooks/use-interaction.d.ts +63 -0
  90. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -0
  91. package/build-types/image-editor/react/hooks/use-transform-style.d.ts +16 -0
  92. package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +1 -0
  93. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +19 -0
  94. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +1 -0
  95. package/build-types/image-editor/react/visually-hidden-style.d.ts +6 -0
  96. package/build-types/image-editor/react/visually-hidden-style.d.ts.map +1 -0
  97. package/build-types/image-editor/stories/rectangle-crop.story.d.ts +16 -0
  98. package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -0
  99. package/build-types/lock-unlock.d.ts +2 -0
  100. package/build-types/lock-unlock.d.ts.map +1 -0
  101. package/build-types/private-apis.d.ts +2 -0
  102. package/build-types/private-apis.d.ts.map +1 -0
  103. package/build-types/state/composite-reducer.d.ts +39 -0
  104. package/build-types/state/composite-reducer.d.ts.map +1 -0
  105. package/build-types/state/index.d.ts +7 -0
  106. package/build-types/state/index.d.ts.map +1 -0
  107. package/build-types/state/media-editor-state-provider.d.ts +34 -0
  108. package/build-types/state/media-editor-state-provider.d.ts.map +1 -0
  109. package/build-types/state/types.d.ts +96 -0
  110. package/build-types/state/types.d.ts.map +1 -0
  111. package/build-types/state/use-media-editor-state.d.ts +101 -0
  112. package/build-types/state/use-media-editor-state.d.ts.map +1 -0
  113. package/build-types/store/actions.d.ts +29 -0
  114. package/build-types/store/actions.d.ts.map +1 -0
  115. package/build-types/store/constants.d.ts +2 -0
  116. package/build-types/store/constants.d.ts.map +1 -0
  117. package/build-types/store/index.d.ts +4 -0
  118. package/build-types/store/index.d.ts.map +1 -0
  119. package/build-types/store/reducer.d.ts +26 -0
  120. package/build-types/store/reducer.d.ts.map +1 -0
  121. package/build-types/store/selectors.d.ts +9 -0
  122. package/build-types/store/selectors.d.ts.map +1 -0
  123. package/package.json +6 -6
  124. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,42 @@
1
+ import type { Field } from '@wordpress/dataviews';
2
+ import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';
3
+ import type { Media } from '../media-editor-provider';
4
+ import type { AspectRatioPreset } from '../../image-editor/core/constants';
5
+ import { type MediaEditorSaveResult } from './use-save-media-editor';
6
+ export type { MediaEditorSaveResult } from './use-save-media-editor';
7
+ export interface MediaEditorFrameProps {
8
+ children: ReactNode;
9
+ headerActions: ReactNode;
10
+ footerActions: ReactNode;
11
+ /**
12
+ * Footer layout selector. Frames apply this to the footer container
13
+ * as a modifier class. Tracks the sidebar-collapse breakpoint (`medium`).
14
+ *
15
+ * - `wide` — sidebar is a column; footer is a single row of History |
16
+ * Cancel/Save (transform controls live in the Crop panel).
17
+ * - `narrow` — sidebar collapsed; transform controls sit above a
18
+ * History | Cancel/Save row.
19
+ */
20
+ footerLayout: 'wide' | 'narrow';
21
+ onRequestClose: () => void;
22
+ onKeyDown: (event: ReactKeyboardEvent<HTMLElement>) => void;
23
+ shouldCloseOnClickOutside: boolean;
24
+ isSaving: boolean;
25
+ hasChanges: boolean;
26
+ hasMedia: boolean;
27
+ }
28
+ export interface MediaEditorProps {
29
+ fields?: Field<Media>[];
30
+ id: number;
31
+ aspectRatioPresets?: AspectRatioPreset[];
32
+ onClose?: () => void;
33
+ onSaved?: (result: MediaEditorSaveResult) => void;
34
+ renderFrame: (props: MediaEditorFrameProps) => JSX.Element;
35
+ noticesClassName?: string;
36
+ noticesPortalElement?: Element | null;
37
+ showCloseButton?: boolean;
38
+ shouldCloseOnEsc?: boolean;
39
+ }
40
+ export declare function MediaEditor(props: MediaEditorProps): import("react").JSX.Element;
41
+ export default MediaEditor;
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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;;;;;;;;OAQG;IACH,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC;IAChC,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;AAkmBD,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"}
@@ -0,0 +1,26 @@
1
+ export interface MediaEditorCanvasProps {
2
+ /** Focus the crop area when the canvas mounts. */
3
+ focusOnMount?: boolean;
4
+ /** Whether external placement activity should reveal the grid. */
5
+ isPlacementActive?: boolean;
6
+ /** Fires when a canvas cropper gesture begins. */
7
+ onGestureStart?: () => void;
8
+ /** Fires when a canvas cropper gesture ends. */
9
+ onGestureEnd?: () => void;
10
+ }
11
+ /**
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.
15
+ *
16
+ * Returns `null` for missing or non-image media so the modal's outer
17
+ * guards can render a spinner or fall through to `<MediaPreview>`.
18
+ *
19
+ * @param props
20
+ * @param props.focusOnMount
21
+ * @param props.isPlacementActive
22
+ * @param props.onGestureStart
23
+ * @param props.onGestureEnd
24
+ */
25
+ export default function MediaEditorCanvas({ focusOnMount, isPlacementActive, onGestureStart, onGestureEnd }: MediaEditorCanvasProps): import("react").JSX.Element | null;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AAoBA,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,sCAkIxB"}
@@ -0,0 +1,31 @@
1
+ import type { AspectRatioPreset } from '../../image-editor/core/constants';
2
+ export interface MediaEditorCropPanelProps {
3
+ /**
4
+ * Selected aspect-ratio preset value as a string (so it round-trips
5
+ * through `<SelectControl>`). `'0'` = free, `'-1'` = original, any
6
+ * positive number = fixed ratio.
7
+ */
8
+ aspectRatioValue: string;
9
+ /** Setter for the aspect-ratio preset value. */
10
+ onAspectRatioChange: (value: string) => void;
11
+ /** Aspect-ratio presets to display in the selector. */
12
+ aspectRatioOptions: AspectRatioPreset[];
13
+ /**
14
+ * When `true`, render the rotate/flip/zoom image controls at the top of
15
+ * the panel. Used on wide viewports where the footer no longer carries
16
+ * them.
17
+ */
18
+ showTransformControls?: boolean;
19
+ }
20
+ /**
21
+ * Sidebar panel for crop controls. Renders the aspect-ratio selector, plus the
22
+ * rotate/flip and zoom controls on wide viewports (these move to the footer
23
+ * toolbar when the sidebar collapses).
24
+ * @param props
25
+ * @param props.aspectRatioValue
26
+ * @param props.onAspectRatioChange
27
+ * @param props.aspectRatioOptions
28
+ * @param props.showTransformControls
29
+ */
30
+ export default function MediaEditorCropPanel({ aspectRatioValue, onAspectRatioChange, aspectRatioOptions, showTransformControls }: MediaEditorCropPanelProps): import("react").JSX.Element;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAYA,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;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,qBAA6B,EAC7B,EAAE,yBAAyB,+BA0B3B"}
@@ -0,0 +1,15 @@
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. It renders under the canvas so it
7
+ * stays constrained to the canvas column at all viewport sizes. Lives
8
+ * separately from the snap-rotate / flip buttons so the two can be placed
9
+ * independently per viewport.
10
+ *
11
+ * @param props
12
+ * @param props.onPlacementControlInteraction
13
+ */
14
+ export default function MediaEditorFineRotation({ onPlacementControlInteraction }: MediaEditorFineRotationProps): import("react").JSX.Element;
15
+ //# 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;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAE,EAChD,6BAA6B,EAC7B,EAAE,4BAA4B,+BA6C9B"}
@@ -0,0 +1,46 @@
1
+ import { type AspectRatioPreset } from '../../image-editor/core/constants';
2
+ /**
3
+ * Default zoom factor per +/- click. Zooming is geometric, so a fixed
4
+ * multiplier — rather than an additive step — makes each click feel like the
5
+ * same amount of zoom at any level (an additive `+0.1` is a 10% jump at 1× but
6
+ * a ~1% nudge at 10×). `1.2` is ~+20% per click. Overridable via the
7
+ * `zoomFactor` prop.
8
+ */
9
+ export declare const DEFAULT_ZOOM_FACTOR = 1.2;
10
+ export interface MediaEditorImageControlsProps {
11
+ /**
12
+ * When `true`, render rotate, flip and zoom as labelled groups — the Crop
13
+ * panel layout used on wide viewports. When `false` (default), render a
14
+ * single flat row of icon buttons — the footer layout used at narrower
15
+ * widths.
16
+ */
17
+ withLabels?: boolean;
18
+ /**
19
+ * When `true`, include an aspect-ratio dropdown in the flat toolbar.
20
+ * Omitted from the labelled panel layout because the Crop panel already
21
+ * renders the full aspect-ratio select control.
22
+ */
23
+ showAspectRatioControl?: boolean;
24
+ /** Optional caller-supplied aspect-ratio presets. */
25
+ aspectRatioPresets?: AspectRatioPreset[];
26
+ /**
27
+ * Multiplier applied to the zoom per +/- click — zoom in multiplies by it,
28
+ * zoom out divides by it. Must be greater than 1. Defaults to
29
+ * `DEFAULT_ZOOM_FACTOR` (1.2).
30
+ */
31
+ zoomFactor?: number;
32
+ }
33
+ /**
34
+ * Image editing controls placed independently per viewport: on wide viewports
35
+ * rotate/flip/zoom render inside the Crop panel (`withLabels`), and at narrower
36
+ * widths they fall back into the footer toolbar (flat row), where the
37
+ * aspect-ratio dropdown can also be shown.
38
+ *
39
+ * @param props
40
+ * @param props.withLabels
41
+ * @param props.showAspectRatioControl
42
+ * @param props.aspectRatioPresets
43
+ * @param props.zoomFactor
44
+ */
45
+ export default function MediaEditorImageControls({ withLabels, showAspectRatioControl, aspectRatioPresets, zoomFactor }: MediaEditorImageControlsProps): import("react").JSX.Element;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAyBA,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;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,EAChC,EAAE,6BAA6B,+BAmL/B"}
@@ -0,0 +1,6 @@
1
+ interface MediaEditorKeyboardShortcutsModalProps {
2
+ onClose: () => void;
3
+ }
4
+ export default function MediaEditorKeyboardShortcutsModal({ onClose }: MediaEditorKeyboardShortcutsModalProps): import("react").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-keyboard-shortcuts-modal/index.tsx"],"names":[],"mappings":"AAoIA,UAAU,sCAAsC;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,iCAAiC,CAAE,EAC1D,OAAO,EACP,EAAE,sCAAsC,+BAsCxC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CropperState, Size } from '../../image-editor';
5
+ /**
6
+ * A single modifier in the Core REST `/edit` payload. Order is
7
+ * significant — the server applies modifiers sequentially (see
8
+ * `WP_REST_Attachments_Controller::edit_media_item`).
9
+ *
10
+ * Shape/units:
11
+ * - `flip`: booleans per axis. Applied first in this module's output.
12
+ * - `rotate`: `angle` in degrees, clockwise-positive (matches the
13
+ * cropper's own convention; Core negates it internally for
14
+ * `WP_Image_Editor::rotate`, which is counterclockwise-positive).
15
+ * - `crop`: percentages (0–100) of the image's dimensions **at the
16
+ * moment the crop is applied**. Because modifiers are applied in
17
+ * order, after a preceding `rotate` the server's
18
+ * `WP_Image_Editor::get_size()` reports the full post-rotate AABB,
19
+ * so the percentages are of that AABB. Origin is top-left.
20
+ */
21
+ export type Modifier = {
22
+ type: 'flip';
23
+ args: {
24
+ flip: {
25
+ horizontal: boolean;
26
+ vertical: boolean;
27
+ };
28
+ };
29
+ } | {
30
+ type: 'rotate';
31
+ args: {
32
+ angle: number;
33
+ };
34
+ } | {
35
+ type: 'crop';
36
+ args: {
37
+ left: number;
38
+ top: number;
39
+ width: number;
40
+ height: number;
41
+ };
42
+ };
43
+ /**
44
+ * Build a Core-compatible modifiers array from the cropper state.
45
+ *
46
+ * Emits `[flip, rotate, crop]` in that order. Identity operations are
47
+ * pruned — an absent flip, a rotation that normalizes to 0°, and a crop
48
+ * rect that covers (within tolerance) the full post-rotate AABB each
49
+ * produce no modifier. An identity state (fresh image, no edits) returns
50
+ * an empty array; callers can use that to skip the `/edit` call.
51
+ *
52
+ * Frames and math:
53
+ *
54
+ * The cropper's `cropRect` is stored as fractions of the **snap-rotation**
55
+ * bounding box (the stencil-reference frame — see `createCamera` /
56
+ * `createExportCamera`). Pan is in that frame; zoom scales the image
57
+ * beneath a fixed stencil. Two conversions are needed to reach the frame
58
+ * Core's crop modifier applies against:
59
+ *
60
+ * 1. Express the stencil rect in snap-AABB **pixels**:
61
+ * Image screen-normalized top-left with zoom/pan is
62
+ * `(0.5 + pan - zoom/2)`; the stencil's pixel footprint is the
63
+ * inverse of that transform applied to `cropRect`.
64
+ *
65
+ * 2. Translate from snap-AABB coords to full-AABB coords. Both AABBs
66
+ * share the source-image center, so the conversion is a pure
67
+ * translation by `(fullCenter - snapCenter)`. Finally, express the
68
+ * translated rect as percentages of the full AABB.
69
+ *
70
+ * Rotation sign: the cropper composes `flip · R(θ)` on the source (see
71
+ * `createExportCamera` — rotate then flip). Core's `[flip, rotate]`
72
+ * applies the opposite order: `R(θ') · flip`. For both to land on the
73
+ * same pixels we invert the rotation sign when exactly one flip axis
74
+ * is set (`flip_h · R(θ) = R(-θ) · flip_h`). Both-or-neither flips
75
+ * leave the sign alone because `flip_h · flip_v = -I` commutes with
76
+ * rotation.
77
+ *
78
+ * @param state Current cropper state.
79
+ * @param imageSize Natural dimensions of the source image.
80
+ * @return Ordered modifier array; empty when nothing is server-relevant.
81
+ */
82
+ export declare function buildModifiers(state: CropperState, imageSize: Size): Modifier[];
83
+ //# sourceMappingURL=build-modifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-modifiers.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/build-modifiers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GACjB;IACA,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,IAAI,EAAE;YAAE,UAAU,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;CAC1D,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC3C;IACA,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE,CAAC;AAUL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,QAAQ,EAAE,CAgFZ"}
@@ -0,0 +1,20 @@
1
+ import type { Field } from '@wordpress/dataviews';
2
+ import type { Media } from '../media-editor-provider';
3
+ import type { AspectRatioPreset } from '../../image-editor/core/constants';
4
+ interface MediaEditorModalProps {
5
+ /**
6
+ * Attachment fields to render in the Details tab.
7
+ *
8
+ * Passed from the editor layer (which owns the `usePostFields` hook),
9
+ * since `@wordpress/media-editor` cannot depend on `@wordpress/editor`.
10
+ */
11
+ fields?: Field<Media>[];
12
+ /**
13
+ * Fixed aspect-ratio presets for image cropping. Free and Original are
14
+ * always provided by the media editor.
15
+ */
16
+ aspectRatioPresets?: AspectRatioPreset[];
17
+ }
18
+ export declare function MediaEditorModal({ fields, aspectRatioPresets }: MediaEditorModalProps): import("react").JSX.Element | null;
19
+ export default MediaEditorModal;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,46 @@
1
+ export interface RotationRulerProps {
2
+ /** Current value. */
3
+ value: number;
4
+ /** Called with the next value on each change. */
5
+ onChange: (value: number) => void;
6
+ /** Lower bound of the range. Default: -45. */
7
+ min?: number;
8
+ /** Upper bound of the range. Default: 45. */
9
+ max?: number;
10
+ /**
11
+ * Value step for drag and keyboard arrows. Default: 1. Drag values
12
+ * are quantized to multiples of `step`. Holding Shift during drag
13
+ * or with arrow keys halves the step for precision adjustment.
14
+ */
15
+ step?: number;
16
+ /** Accessible label for the slider input. */
17
+ label: string;
18
+ /**
19
+ * Unit suffix shown in the active label and `aria-valuetext`.
20
+ * Default: `°`.
21
+ */
22
+ unit?: string;
23
+ /** CSS pixels of pointer travel per `step`. Default: 6. */
24
+ pixelsPerStep?: number;
25
+ /** Optional extra class for the wrapper. */
26
+ className?: string;
27
+ /**
28
+ * Optional id for the underlying input; auto-generated when
29
+ * omitted.
30
+ */
31
+ id?: string;
32
+ /** When true, ignores all input. */
33
+ disabled?: boolean;
34
+ }
35
+ /**
36
+ * Horizontal "scrub-the-ruler" slider for fine-grained numeric input
37
+ * such as rotation in degrees.
38
+ *
39
+ * Renders a visually hidden `<input type="range">` for assistive
40
+ * technologies and keyboard input alongside a decorative tick strip
41
+ * that the user can drag with a pointer.
42
+ *
43
+ * @param props Component props. See `RotationRulerProps`.
44
+ */
45
+ export default function RotationRuler(props: RotationRulerProps): import("react").JSX.Element;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/rotation-ruler/index.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,kBAAkB;IAClC,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IACpC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAqDD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,KAAK,EAAE,kBAAkB,+BAwK/D"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { Meta, StoryObj } from '@storybook/react-vite';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import RotationRuler from '../index';
9
+ import '../style.scss';
10
+ declare const meta: Meta<typeof RotationRuler>;
11
+ export default meta;
12
+ type Story = StoryObj<typeof RotationRuler>;
13
+ export declare const Default: Story;
14
+ //# sourceMappingURL=index.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/rotation-ruler/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQ5D;;GAEG;AACH,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,eAAe,CAAC;AAEvB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAerC,CAAC;eACa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,aAAa,CAAE,CAAC;AAE9C,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Convert a horizontal pointer delta (px) into a value delta.
3
+ *
4
+ * Negative because dragging the ruler to the right should expose
5
+ * smaller values to the left of the fixed center pointer (and vice
6
+ * versa) — the ruler scrubs *under* the pointer.
7
+ *
8
+ * @param deltaPx Pointer movement in CSS pixels.
9
+ * @param pixelsPerStep CSS pixels of pointer travel per `step`.
10
+ * @param step Value units per step.
11
+ */
12
+ export declare function pxToValueDelta(deltaPx: number, pixelsPerStep: number, step: number): number;
13
+ /**
14
+ * Clamp `value` to the inclusive `[min, max]` interval.
15
+ *
16
+ * @param value Value to clamp.
17
+ * @param min Lower bound (inclusive).
18
+ * @param max Upper bound (inclusive).
19
+ */
20
+ export declare function clampValue(value: number, min: number, max: number): number;
21
+ /**
22
+ * Round `value` to the nearest multiple of `step`.
23
+ *
24
+ * @param value Value to quantize.
25
+ * @param step Step granularity (must be > 0).
26
+ */
27
+ export declare function quantize(value: number, step: number): number;
28
+ export interface UseRulerDragOptions {
29
+ value: number;
30
+ onChange: (next: number) => void;
31
+ min: number;
32
+ max: number;
33
+ step: number;
34
+ pixelsPerStep: number;
35
+ disabled: boolean;
36
+ /** Called once on pointerdown so the caller can focus the input. */
37
+ onPointerDownStart?: () => void;
38
+ }
39
+ export interface RulerDragHandlers {
40
+ onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
41
+ onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
42
+ onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;
43
+ onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;
44
+ }
45
+ /**
46
+ * Drag-the-ruler gesture for a horizontal slider. Translates pointer
47
+ * movement into value changes quantized to `step`; the caller renders
48
+ * the visuals and holds the value.
49
+ *
50
+ * The hook owns no state of its own — every value change is reported
51
+ * through the supplied `onChange`. The "current value" is read from a
52
+ * ref so closure staleness during a drag is impossible. Drag continues
53
+ * past the wrapper's bounds (standard slider behaviour); a window-level
54
+ * `pointerup` listener guarantees the drag ends and pointer capture
55
+ * releases even if the underlying captured event never fires on the
56
+ * wrapper.
57
+ *
58
+ * @param options Ruler-drag configuration. See `UseRulerDragOptions`.
59
+ */
60
+ export declare function useRulerDrag(options: UseRulerDragOptions): RulerDragHandlers;
61
+ //# sourceMappingURL=use-ruler-drag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-ruler-drag.d.ts","sourceRoot":"","sources":["../../../src/components/rotation-ruler/use-ruler-drag.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACV,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAI,MAAM,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAI,MAAM,CAE9D;AAED,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IACpE,aAAa,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IACpE,WAAW,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IAClE,eAAe,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;CACtE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,GAC1B,iBAAiB,CA8InB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Data attribute applied to crop control wrappers. The modal's keyboard
3
+ * shortcut handler uses this to distinguish crop controls (where custom
4
+ * undo/redo should fire) from metadata text fields (where the browser's
5
+ * native undo should be preserved).
6
+ */
7
+ export declare const CROP_CONTROL_ATTR = "data-crop-control";
8
+ export interface UseCropGestureHandlersOptions {
9
+ /**
10
+ * When `true` (default), key-up closes the gesture so each
11
+ * discrete keypress becomes its own undo step. Set to `false` for
12
+ * continuous-input controls (e.g. the rotation ruler) where rapid
13
+ * keypresses should coalesce into a single history entry across
14
+ * the whole gesture.
15
+ */
16
+ commitOnKeyUp?: boolean;
17
+ }
18
+ /**
19
+ * Event handler props to spread onto a wrapper element around a crop
20
+ * control. Marks the wrapper as a crop control (via `data-crop-control`)
21
+ * so the modal's Cmd+Z handler can identify it, and wires gesture
22
+ * boundaries on the composite store so a slider drag becomes a single
23
+ * undo entry rather than one per tick.
24
+ *
25
+ * Usage:
26
+ * const gestureHandlers = useCropGestureHandlers();
27
+ * <div role="presentation" { ...gestureHandlers }>
28
+ * <RangeControl ... />
29
+ * </div>
30
+ *
31
+ * @param options Optional behavior flags.
32
+ */
33
+ export declare function useCropGestureHandlers(options?: UseCropGestureHandlersOptions): {
34
+ "data-crop-control": boolean;
35
+ onPointerDownCapture: () => void;
36
+ onPointerUp: () => void;
37
+ onPointerCancel: () => void;
38
+ onKeyDownCapture: () => void;
39
+ onKeyUp: () => void;
40
+ };
41
+ //# sourceMappingURL=use-crop-gesture-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-crop-gesture-handlers.d.ts","sourceRoot":"","sources":["../../src/hooks/use-crop-gesture-handlers.ts"],"names":[],"mappings":"AAUA;;;;;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"}