@wordpress/media-editor 0.21.0 → 0.23.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.
- package/CHANGELOG.md +30 -0
- package/build/components/media-editor/index.cjs +586 -686
- package/build/components/media-editor/index.cjs.map +1 -7
- package/build/components/media-editor/use-crop-options.cjs +42 -57
- package/build/components/media-editor/use-crop-options.cjs.map +1 -7
- package/build/components/media-editor/use-save-media-editor.cjs +131 -185
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -7
- package/build/components/media-editor-canvas/index.cjs +117 -124
- package/build/components/media-editor-canvas/index.cjs.map +1 -7
- package/build/components/media-editor-crop-panel/index.cjs +81 -72
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -7
- package/build/components/media-editor-fine-rotation/index.cjs +61 -72
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -7
- package/build/components/media-editor-image-controls/index.cjs +181 -257
- package/build/components/media-editor-image-controls/index.cjs.map +1 -7
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +120 -157
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -7
- package/build/components/media-editor-modal/index.cjs +112 -155
- package/build/components/media-editor-modal/index.cjs.map +1 -7
- package/build/components/media-editor-provider/index.cjs +32 -55
- package/build/components/media-editor-provider/index.cjs.map +1 -7
- package/build/components/media-form/index.cjs +82 -77
- package/build/components/media-form/index.cjs.map +1 -7
- package/build/components/media-preview/index.cjs +113 -114
- package/build/components/media-preview/index.cjs.map +1 -7
- package/build/components/rotation-ruler/index.cjs +181 -188
- package/build/components/rotation-ruler/index.cjs.map +1 -7
- package/build/components/rotation-ruler/use-ruler-drag.cjs +132 -149
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -7
- package/build/hooks/use-crop-gesture-handlers.cjs +82 -76
- package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -7
- package/build/index.cjs +45 -39
- package/build/lock-unlock.cjs +9 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/private-apis.cjs +16 -37
- package/build/private-apis.cjs.map +1 -7
- package/build/state/aspect-ratio-presets.cjs +59 -0
- package/build/state/aspect-ratio-presets.cjs.map +1 -0
- package/build/state/composite-reducer.cjs +100 -113
- package/build/state/composite-reducer.cjs.map +1 -7
- package/build/state/index.cjs +22 -45
- package/build/state/media-editor-state-provider.cjs +35 -48
- package/build/state/media-editor-state-provider.cjs.map +1 -7
- package/build/state/types.cjs +11 -31
- package/build/state/types.cjs.map +1 -7
- package/build/state/use-media-editor-state.cjs +227 -296
- package/build/state/use-media-editor-state.cjs.map +1 -7
- package/build/store/actions.cjs +17 -44
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +8 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +33 -40
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +28 -50
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +16 -41
- package/build/store/selectors.cjs.map +1 -7
- package/build/utils/get-media-type.cjs +18 -41
- package/build/utils/get-media-type.cjs.map +1 -7
- package/build/utils/index.cjs +9 -28
- package/build-module/components/media-editor/index.mjs +545 -675
- package/build-module/components/media-editor/index.mjs.map +1 -7
- package/build-module/components/media-editor/use-crop-options.mjs +37 -32
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -7
- package/build-module/components/media-editor/use-save-media-editor.mjs +109 -157
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -7
- package/build-module/components/media-editor-canvas/index.mjs +95 -98
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -7
- package/build-module/components/media-editor-crop-panel/index.mjs +59 -46
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -7
- package/build-module/components/media-editor-fine-rotation/index.mjs +39 -46
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -7
- package/build-module/components/media-editor-image-controls/index.mjs +171 -238
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -7
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +113 -137
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-modal/index.mjs +88 -124
- package/build-module/components/media-editor-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-provider/index.mjs +26 -29
- package/build-module/components/media-editor-provider/index.mjs.map +1 -7
- package/build-module/components/media-form/index.mjs +74 -56
- package/build-module/components/media-form/index.mjs.map +1 -7
- package/build-module/components/media-preview/index.mjs +105 -90
- package/build-module/components/media-preview/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/index.mjs +161 -164
- package/build-module/components/rotation-ruler/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs +125 -122
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +1 -7
- package/build-module/hooks/use-crop-gesture-handlers.mjs +76 -50
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +1 -7
- package/build-module/index.mjs +3 -10
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/private-apis.mjs +8 -9
- package/build-module/private-apis.mjs.map +1 -7
- package/build-module/state/aspect-ratio-presets.mjs +53 -0
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -0
- package/build-module/state/composite-reducer.mjs +80 -91
- package/build-module/state/composite-reducer.mjs.map +1 -7
- package/build-module/state/index.mjs +3 -26
- package/build-module/state/media-editor-state-provider.mjs +29 -24
- package/build-module/state/media-editor-state-provider.mjs.map +1 -7
- package/build-module/state/types.mjs +7 -7
- package/build-module/state/types.mjs.map +1 -7
- package/build-module/state/use-media-editor-state.mjs +223 -288
- package/build-module/state/use-media-editor-state.mjs.map +1 -7
- package/build-module/store/actions.mjs +12 -19
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +4 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +8 -9
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +23 -26
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +8 -13
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/utils/get-media-type.mjs +14 -17
- package/build-module/utils/get-media-type.mjs.map +1 -7
- package/build-module/utils/index.mjs +1 -6
- package/build-style/style-rtl.css +145 -61
- package/build-style/style.css +144 -61
- package/build-types/components/media-editor/index.d.ts +20 -2
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +2 -3
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts +3 -3
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts +1 -1
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
- package/build-types/state/aspect-ratio-presets.d.ts +24 -0
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -0
- package/build-types/state/composite-reducer.d.ts +17 -19
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/index.d.ts +2 -4
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +20 -63
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +33 -52
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/package.json +22 -23
- package/src/components/media-editor/index.tsx +355 -167
- package/src/components/media-editor/style.scss +19 -0
- package/src/components/media-editor/use-crop-options.ts +9 -10
- package/src/components/media-editor/use-save-media-editor.ts +48 -10
- package/src/components/media-editor-canvas/index.tsx +30 -51
- package/src/components/media-editor-canvas/style.scss +6 -6
- package/src/components/media-editor-crop-panel/index.tsx +38 -2
- package/src/components/media-editor-crop-panel/style.scss +21 -0
- package/src/components/media-editor-fine-rotation/index.tsx +6 -6
- package/src/components/media-editor-image-controls/index.tsx +15 -11
- package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +1 -0
- package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +1 -1
- package/src/components/media-editor-modal/index.tsx +1 -1
- package/src/components/media-editor-modal/style.scss +1 -1
- package/src/components/media-form/index.tsx +7 -1
- package/src/components/media-preview/index.tsx +65 -23
- package/src/components/media-preview/style.scss +16 -2
- package/src/components/rotation-ruler/style.scss +9 -5
- package/src/components/rotation-ruler/use-ruler-drag.ts +6 -11
- package/src/state/README.md +32 -0
- package/src/state/aspect-ratio-presets.ts +37 -0
- package/src/state/composite-reducer.ts +42 -80
- package/src/state/index.ts +2 -17
- package/src/state/types.ts +18 -72
- package/src/state/use-media-editor-state.ts +155 -238
- package/src/style.scss +2 -1
- package/build/components/media-editor-modal/build-modifiers.cjs +0 -91
- package/build/components/media-editor-modal/build-modifiers.cjs.map +0 -7
- package/build/image-editor/core/camera.cjs +0 -225
- package/build/image-editor/core/camera.cjs.map +0 -7
- package/build/image-editor/core/constants.cjs +0 -108
- package/build/image-editor/core/constants.cjs.map +0 -7
- package/build/image-editor/core/containment.cjs +0 -276
- package/build/image-editor/core/containment.cjs.map +0 -7
- package/build/image-editor/core/crop-rect.cjs +0 -48
- package/build/image-editor/core/crop-rect.cjs.map +0 -7
- package/build/image-editor/core/export/canvas-renderer.cjs +0 -151
- package/build/image-editor/core/export/canvas-renderer.cjs.map +0 -7
- package/build/image-editor/core/index.cjs +0 -62
- package/build/image-editor/core/index.cjs.map +0 -7
- package/build/image-editor/core/interaction-controller.cjs +0 -654
- package/build/image-editor/core/interaction-controller.cjs.map +0 -7
- package/build/image-editor/core/math/rotation.cjs +0 -41
- package/build/image-editor/core/math/rotation.cjs.map +0 -7
- package/build/image-editor/core/math/sanitize.cjs +0 -92
- package/build/image-editor/core/math/sanitize.cjs.map +0 -7
- package/build/image-editor/core/setter-helpers.cjs +0 -64
- package/build/image-editor/core/setter-helpers.cjs.map +0 -7
- package/build/image-editor/core/source-region.cjs +0 -206
- package/build/image-editor/core/source-region.cjs.map +0 -7
- package/build/image-editor/core/state.cjs +0 -283
- package/build/image-editor/core/state.cjs.map +0 -7
- package/build/image-editor/core/stencil-math.cjs +0 -216
- package/build/image-editor/core/stencil-math.cjs.map +0 -7
- package/build/image-editor/core/transform-style.cjs +0 -52
- package/build/image-editor/core/transform-style.cjs.map +0 -7
- package/build/image-editor/core/transforms/pipeline.cjs +0 -43
- package/build/image-editor/core/transforms/pipeline.cjs.map +0 -7
- package/build/image-editor/core/types.cjs +0 -19
- package/build/image-editor/core/types.cjs.map +0 -7
- package/build/image-editor/core/viewport-state.cjs +0 -50
- package/build/image-editor/core/viewport-state.cjs.map +0 -7
- package/build/image-editor/index.cjs +0 -67
- package/build/image-editor/index.cjs.map +0 -7
- package/build/image-editor/react/components/cropper-provider.cjs +0 -50
- package/build/image-editor/react/components/cropper-provider.cjs.map +0 -7
- package/build/image-editor/react/components/cropper.cjs +0 -722
- package/build/image-editor/react/components/cropper.cjs.map +0 -7
- package/build/image-editor/react/components/index.cjs +0 -36
- package/build/image-editor/react/components/index.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +0 -172
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +0 -62
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +0 -91
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +0 -426
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +0 -7
- package/build/image-editor/react/components/viewport-provider.cjs +0 -51
- package/build/image-editor/react/components/viewport-provider.cjs.map +0 -7
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +0 -71
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +0 -7
- package/build/image-editor/react/hooks/index.cjs +0 -34
- package/build/image-editor/react/hooks/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +0 -160
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +0 -113
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-interaction.cjs +0 -213
- package/build/image-editor/react/hooks/use-interaction.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-transform-style.cjs +0 -38
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-viewport-state.cjs +0 -51
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +0 -7
- package/build/image-editor/react/visually-hidden-style.cjs +0 -41
- package/build/image-editor/react/visually-hidden-style.cjs.map +0 -7
- package/build/index.cjs.map +0 -7
- package/build/state/index.cjs.map +0 -7
- package/build/utils/index.cjs.map +0 -7
- package/build-module/components/media-editor-modal/build-modifiers.mjs +0 -66
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +0 -7
- package/build-module/image-editor/core/camera.mjs +0 -198
- package/build-module/image-editor/core/camera.mjs.map +0 -7
- package/build-module/image-editor/core/constants.mjs +0 -69
- package/build-module/image-editor/core/constants.mjs.map +0 -7
- package/build-module/image-editor/core/containment.mjs +0 -253
- package/build-module/image-editor/core/containment.mjs.map +0 -7
- package/build-module/image-editor/core/crop-rect.mjs +0 -23
- package/build-module/image-editor/core/crop-rect.mjs.map +0 -7
- package/build-module/image-editor/core/export/canvas-renderer.mjs +0 -120
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +0 -7
- package/build-module/image-editor/core/index.mjs +0 -36
- package/build-module/image-editor/core/index.mjs.map +0 -7
- package/build-module/image-editor/core/interaction-controller.mjs +0 -635
- package/build-module/image-editor/core/interaction-controller.mjs.map +0 -7
- package/build-module/image-editor/core/math/rotation.mjs +0 -15
- package/build-module/image-editor/core/math/rotation.mjs.map +0 -7
- package/build-module/image-editor/core/math/sanitize.mjs +0 -63
- package/build-module/image-editor/core/math/sanitize.mjs.map +0 -7
- package/build-module/image-editor/core/setter-helpers.mjs +0 -39
- package/build-module/image-editor/core/setter-helpers.mjs.map +0 -7
- package/build-module/image-editor/core/source-region.mjs +0 -178
- package/build-module/image-editor/core/source-region.mjs.map +0 -7
- package/build-module/image-editor/core/state.mjs +0 -260
- package/build-module/image-editor/core/state.mjs.map +0 -7
- package/build-module/image-editor/core/stencil-math.mjs +0 -187
- package/build-module/image-editor/core/stencil-math.mjs.map +0 -7
- package/build-module/image-editor/core/transform-style.mjs +0 -27
- package/build-module/image-editor/core/transform-style.mjs.map +0 -7
- package/build-module/image-editor/core/transforms/pipeline.mjs +0 -17
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +0 -7
- package/build-module/image-editor/core/types.mjs +0 -1
- package/build-module/image-editor/core/types.mjs.map +0 -7
- package/build-module/image-editor/core/viewport-state.mjs +0 -24
- package/build-module/image-editor/core/viewport-state.mjs.map +0 -7
- package/build-module/image-editor/index.mjs +0 -39
- package/build-module/image-editor/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/cropper-provider.mjs +0 -26
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +0 -7
- package/build-module/image-editor/react/components/cropper.mjs +0 -704
- package/build-module/image-editor/react/components/cropper.mjs.map +0 -7
- package/build-module/image-editor/react/components/index.mjs +0 -9
- package/build-module/image-editor/react/components/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +0 -147
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +0 -37
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +0 -66
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +0 -414
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +0 -7
- package/build-module/image-editor/react/components/viewport-provider.mjs +0 -27
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +0 -46
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/index.mjs +0 -8
- package/build-module/image-editor/react/hooks/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +0 -135
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +0 -100
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-interaction.mjs +0 -190
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +0 -13
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +0 -29
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +0 -7
- package/build-module/image-editor/react/visually-hidden-style.mjs +0 -16
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/state/index.mjs.map +0 -7
- package/build-module/utils/index.mjs.map +0 -7
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -80
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +0 -1
- package/build-types/image-editor/core/camera.d.ts +0 -128
- package/build-types/image-editor/core/camera.d.ts.map +0 -1
- package/build-types/image-editor/core/constants.d.ts +0 -99
- package/build-types/image-editor/core/constants.d.ts.map +0 -1
- package/build-types/image-editor/core/containment.d.ts +0 -72
- package/build-types/image-editor/core/containment.d.ts.map +0 -1
- package/build-types/image-editor/core/crop-rect.d.ts +0 -16
- package/build-types/image-editor/core/crop-rect.d.ts.map +0 -1
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +0 -103
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +0 -1
- package/build-types/image-editor/core/index.d.ts +0 -10
- package/build-types/image-editor/core/index.d.ts.map +0 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +0 -191
- package/build-types/image-editor/core/interaction-controller.d.ts.map +0 -1
- package/build-types/image-editor/core/math/rotation.d.ts +0 -18
- package/build-types/image-editor/core/math/rotation.d.ts.map +0 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +0 -67
- package/build-types/image-editor/core/math/sanitize.d.ts.map +0 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +0 -21
- package/build-types/image-editor/core/setter-helpers.d.ts.map +0 -1
- package/build-types/image-editor/core/source-region.d.ts +0 -94
- package/build-types/image-editor/core/source-region.d.ts.map +0 -1
- package/build-types/image-editor/core/state.d.ts +0 -51
- package/build-types/image-editor/core/state.d.ts.map +0 -1
- package/build-types/image-editor/core/stencil-math.d.ts +0 -102
- package/build-types/image-editor/core/stencil-math.d.ts.map +0 -1
- package/build-types/image-editor/core/transform-style.d.ts +0 -20
- package/build-types/image-editor/core/transform-style.d.ts.map +0 -1
- package/build-types/image-editor/core/transforms/pipeline.d.ts +0 -24
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +0 -1
- package/build-types/image-editor/core/types.d.ts +0 -269
- package/build-types/image-editor/core/types.d.ts.map +0 -1
- package/build-types/image-editor/core/viewport-state.d.ts +0 -4
- package/build-types/image-editor/core/viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/index.d.ts +0 -16
- package/build-types/image-editor/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +0 -38
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper.d.ts +0 -63
- package/build-types/image-editor/react/components/cropper.d.ts.map +0 -1
- package/build-types/image-editor/react/components/index.d.ts +0 -4
- package/build-types/image-editor/react/components/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +0 -33
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +0 -17
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +0 -27
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +0 -33
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +0 -1
- package/build-types/image-editor/react/components/viewport-provider.d.ts +0 -6
- package/build-types/image-editor/react/components/viewport-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +0 -44
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/index.d.ts +0 -5
- package/build-types/image-editor/react/hooks/index.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +0 -14
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +0 -55
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +0 -65
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +0 -13
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +0 -16
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/react/visually-hidden-style.d.ts +0 -6
- package/build-types/image-editor/react/visually-hidden-style.d.ts.map +0 -1
- package/src/components/media-editor-modal/build-modifiers.ts +0 -161
- package/src/image-editor/README.md +0 -61
- package/src/image-editor/core/camera.ts +0 -429
- package/src/image-editor/core/constants.ts +0 -150
- package/src/image-editor/core/containment.ts +0 -469
- package/src/image-editor/core/crop-rect.ts +0 -42
- package/src/image-editor/core/export/canvas-renderer.ts +0 -250
- package/src/image-editor/core/index.ts +0 -47
- package/src/image-editor/core/interaction-controller.ts +0 -976
- package/src/image-editor/core/math/rotation.ts +0 -26
- package/src/image-editor/core/math/sanitize.ts +0 -155
- package/src/image-editor/core/setter-helpers.ts +0 -63
- package/src/image-editor/core/source-region.ts +0 -367
- package/src/image-editor/core/state.ts +0 -484
- package/src/image-editor/core/stencil-math.ts +0 -379
- package/src/image-editor/core/transform-style.ts +0 -56
- package/src/image-editor/core/transforms/pipeline.ts +0 -40
- package/src/image-editor/core/types.ts +0 -230
- package/src/image-editor/core/viewport-state.ts +0 -30
- package/src/image-editor/docs/architecture.md +0 -63
- package/src/image-editor/docs/recipes.md +0 -184
- package/src/image-editor/index.ts +0 -52
- package/src/image-editor/react/components/cropper-provider.tsx +0 -70
- package/src/image-editor/react/components/cropper.scss +0 -259
- package/src/image-editor/react/components/cropper.tsx +0 -1116
- package/src/image-editor/react/components/index.ts +0 -3
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +0 -262
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +0 -55
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +0 -77
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +0 -623
- package/src/image-editor/react/components/viewport-provider.tsx +0 -32
- package/src/image-editor/react/hooks/build-cropper-setters.ts +0 -102
- package/src/image-editor/react/hooks/index.ts +0 -4
- package/src/image-editor/react/hooks/use-aria-announcer.ts +0 -193
- package/src/image-editor/react/hooks/use-cropper-reducer.ts +0 -197
- package/src/image-editor/react/hooks/use-interaction.ts +0 -294
- package/src/image-editor/react/hooks/use-transform-style.ts +0 -23
- package/src/image-editor/react/hooks/use-viewport-state.ts +0 -41
- package/src/image-editor/react/visually-hidden-style.ts +0 -15
- package/src/image-editor/style.scss +0 -1
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import type { mat2d } from 'gl-matrix';
|
|
2
|
-
/**
|
|
3
|
-
* A 2D camera represented as a 2×3 affine transformation matrix (`mat2d`).
|
|
4
|
-
*
|
|
5
|
-
* This is not a camera object with properties — it's a raw 6-element matrix
|
|
6
|
-
* `[a, b, c, d, tx, ty]` that maps normalized world coordinates [0,1] to
|
|
7
|
-
* screen pixels. It composes pan, rotation, flip, zoom, and contain-fit
|
|
8
|
-
* into a single transform.
|
|
9
|
-
*
|
|
10
|
-
* Use `createCamera()` to build one from `CropperState`, then pass it to
|
|
11
|
-
* `worldToScreen()` / `screenToWorld()` for coordinate conversion.
|
|
12
|
-
*
|
|
13
|
-
* A 3D camera would use `mat4`; this is strictly 2D (no perspective).
|
|
14
|
-
*/
|
|
15
|
-
export type Camera = mat2d;
|
|
16
|
-
/**
|
|
17
|
-
* A point with normalized coordinates (0-1 range relative to image dimensions).
|
|
18
|
-
*/
|
|
19
|
-
export interface NormalizedPoint {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A rectangle with normalized coordinates (0-1 range).
|
|
25
|
-
* Origin is the top-left corner of the image.
|
|
26
|
-
*/
|
|
27
|
-
export interface NormalizedRect {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Width and height dimensions.
|
|
35
|
-
*/
|
|
36
|
-
export interface Size {
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Flip state for horizontal and vertical axes.
|
|
42
|
-
*/
|
|
43
|
-
export interface Flip {
|
|
44
|
-
horizontal: boolean;
|
|
45
|
-
vertical: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A JSON-serializable transform operation for the non-destructive pipeline.
|
|
49
|
-
*/
|
|
50
|
-
export type TransformOperation = {
|
|
51
|
-
type: 'crop';
|
|
52
|
-
rect: NormalizedRect;
|
|
53
|
-
} | {
|
|
54
|
-
type: 'rotate';
|
|
55
|
-
degrees: number;
|
|
56
|
-
} | {
|
|
57
|
-
type: 'flip';
|
|
58
|
-
direction: 'horizontal' | 'vertical';
|
|
59
|
-
} | {
|
|
60
|
-
type: 'zoom';
|
|
61
|
-
factor: number;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Full cropper state.
|
|
65
|
-
*/
|
|
66
|
-
export interface CropperState {
|
|
67
|
-
/** The source image information. Null until an image is loaded. */
|
|
68
|
-
image: {
|
|
69
|
-
src: string;
|
|
70
|
-
naturalWidth: number;
|
|
71
|
-
naturalHeight: number;
|
|
72
|
-
} | null;
|
|
73
|
-
/**
|
|
74
|
-
* Image pan offset in normalized coordinates. Not the crop
|
|
75
|
-
* rectangle — that's `cropRect` below.
|
|
76
|
-
*/
|
|
77
|
-
pan: NormalizedPoint;
|
|
78
|
-
/** Zoom level. 1 = no zoom. */
|
|
79
|
-
zoom: number;
|
|
80
|
-
/** Rotation in degrees, normalized to 0-360. */
|
|
81
|
-
rotation: number;
|
|
82
|
-
/**
|
|
83
|
-
* Base pan/zoom/rotation — the pose the user last explicitly set.
|
|
84
|
-
*
|
|
85
|
-
* During continuous fine rotation (SET_ROTATION), every tick
|
|
86
|
-
* re-derives the transient `pan`/`zoom` from these base values
|
|
87
|
-
* rather than compounding on the previous tick. This prevents
|
|
88
|
-
* drift from accumulated containment clamping near image edges:
|
|
89
|
-
* rotating 0°→30°→0° returns to the exact starting pan, not a
|
|
90
|
-
* slightly-nudged version of it.
|
|
91
|
-
*
|
|
92
|
-
* These are updated by every action except SET_ROTATION itself —
|
|
93
|
-
* explicit zoom, pan, crop-rect, flip, and 90° snap all commit
|
|
94
|
-
* the post-containment state into base. SET_ROTATION reads from
|
|
95
|
-
* `basePan` and `baseRotation` to compute the new pan, and reads
|
|
96
|
-
* `baseZoom` as the zoom floor (enforceContainment may bump it up
|
|
97
|
-
* to cover the rotated crop, but never leaves it above baseZoom).
|
|
98
|
-
*/
|
|
99
|
-
basePan: NormalizedPoint;
|
|
100
|
-
baseZoom: number;
|
|
101
|
-
baseRotation: number;
|
|
102
|
-
/** Flip state. */
|
|
103
|
-
flip: Flip;
|
|
104
|
-
/** The crop rectangle in normalized coordinates. */
|
|
105
|
-
cropRect: NormalizedRect;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Internal reducer action union.
|
|
109
|
-
*
|
|
110
|
-
* This type is intentionally not exported from the image-editor public barrel.
|
|
111
|
-
* Consumers should drive state through the controller returned by
|
|
112
|
-
* `useCropperReducer()` (or a composite store) or through serializable
|
|
113
|
-
* `TransformOperation` values.
|
|
114
|
-
*/
|
|
115
|
-
export type CropperAction =
|
|
116
|
-
/** Sets the loaded image metadata (natural size, src). */
|
|
117
|
-
{
|
|
118
|
-
type: 'SET_IMAGE';
|
|
119
|
-
payload: CropperState['image'];
|
|
120
|
-
}
|
|
121
|
-
/** Sets the image pan offset. (Crop rectangle is SET_CROP_RECT.) */
|
|
122
|
-
| {
|
|
123
|
-
type: 'SET_PAN';
|
|
124
|
-
payload: NormalizedPoint;
|
|
125
|
-
}
|
|
126
|
-
/** Sets the zoom level, clamped to [coverage-aware min, MAX_ZOOM]. */
|
|
127
|
-
| {
|
|
128
|
-
type: 'SET_ZOOM';
|
|
129
|
-
payload: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Sets zoom and pan together atomically. Used by focal-point
|
|
133
|
-
* zoom (wheel, pinch) to keep a target point stationary while
|
|
134
|
-
* zoom changes.
|
|
135
|
-
*/
|
|
136
|
-
| {
|
|
137
|
-
type: 'SET_ZOOM_AT_POINT';
|
|
138
|
-
payload: {
|
|
139
|
-
zoom: number;
|
|
140
|
-
pan: NormalizedPoint;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/** Sets the absolute rotation angle in degrees. */
|
|
144
|
-
| {
|
|
145
|
-
type: 'SET_ROTATION';
|
|
146
|
-
payload: number;
|
|
147
|
-
}
|
|
148
|
-
/** Rotates by +/-90 degrees (snap). */
|
|
149
|
-
| {
|
|
150
|
-
type: 'SNAP_ROTATE_90';
|
|
151
|
-
payload: {
|
|
152
|
-
direction: 1 | -1;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/** Sets the flip state. */
|
|
156
|
-
| {
|
|
157
|
-
type: 'SET_FLIP';
|
|
158
|
-
payload: Flip;
|
|
159
|
-
}
|
|
160
|
-
/** Sets the crop rectangle. */
|
|
161
|
-
| {
|
|
162
|
-
type: 'SET_CROP_RECT';
|
|
163
|
-
payload: NormalizedRect;
|
|
164
|
-
}
|
|
165
|
-
/** Settle animation after resize drag, recentering the crop rect. */
|
|
166
|
-
| {
|
|
167
|
-
type: 'SETTLE_CROP';
|
|
168
|
-
}
|
|
169
|
-
/** Applies a single pipeline transform via the reducer. */
|
|
170
|
-
| {
|
|
171
|
-
type: 'APPLY_OPERATION';
|
|
172
|
-
payload: TransformOperation;
|
|
173
|
-
}
|
|
174
|
-
/** Resets to DEFAULT_STATE, optionally merging a partial override. */
|
|
175
|
-
| {
|
|
176
|
-
type: 'RESET';
|
|
177
|
-
payload?: Partial<CropperState>;
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Viewport camera state — display-only, does not affect export or undo.
|
|
181
|
-
*
|
|
182
|
-
* Applied as a CSS transform on the inner stage div so the user can scroll
|
|
183
|
-
* the view independently of the crop. zoom > 1 magnifies; pan shifts in CSS px.
|
|
184
|
-
*/
|
|
185
|
-
export interface ViewportState {
|
|
186
|
-
zoom: number;
|
|
187
|
-
pan: {
|
|
188
|
-
x: number;
|
|
189
|
-
y: number;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
export type ViewportAction = {
|
|
193
|
-
type: 'SET_VIEWPORT_ZOOM';
|
|
194
|
-
payload: number;
|
|
195
|
-
} | {
|
|
196
|
-
type: 'SET_VIEWPORT_PAN';
|
|
197
|
-
payload: {
|
|
198
|
-
x: number;
|
|
199
|
-
y: number;
|
|
200
|
-
};
|
|
201
|
-
} | {
|
|
202
|
-
type: 'RESET_VIEWPORT';
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Direction of a crop resize handle. Eight compass positions: four
|
|
206
|
-
* corners and four edge midpoints. Used by stencil callbacks and any
|
|
207
|
-
* overlay that needs to know which handle the user is dragging.
|
|
208
|
-
*/
|
|
209
|
-
export type HandlePosition = 'n' | 's' | 'e' | 'w' | 'nw' | 'ne' | 'sw' | 'se';
|
|
210
|
-
/**
|
|
211
|
-
* The contract for a pluggable stencil component.
|
|
212
|
-
* Stencils render the crop area overlay and handle resize interactions.
|
|
213
|
-
*/
|
|
214
|
-
export interface StencilProps {
|
|
215
|
-
/** The current crop rectangle in normalized coordinates. */
|
|
216
|
-
cropRect: NormalizedRect;
|
|
217
|
-
/** The container element dimensions in pixels. */
|
|
218
|
-
containerSize: Size;
|
|
219
|
-
/** The rendered image dimensions in pixels within the container. */
|
|
220
|
-
imageSize: Size;
|
|
221
|
-
/** Callback when the crop rectangle changes (during drag). */
|
|
222
|
-
onCropChange: (rect: NormalizedRect) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Callback when a resize interaction starts — pointerdown on a handle
|
|
225
|
-
* or the first arrow-key press on a focused handle. The handle direction
|
|
226
|
-
* is passed so downstream overlays can anchor to it. The argument is
|
|
227
|
-
* optional to keep custom stencils that don't track a direction
|
|
228
|
-
* backward-compatible.
|
|
229
|
-
*/
|
|
230
|
-
onResizeStart?: (handle?: HandlePosition) => void;
|
|
231
|
-
/** Callback when a resize drag ends (mouseup after handle drag). */
|
|
232
|
-
onResizeEnd?: () => void;
|
|
233
|
-
/** Optional fixed aspect ratio (width / height) in pixel space. */
|
|
234
|
-
aspectRatio?: number;
|
|
235
|
-
/** Whether the crop handles are shown for freeform resizing. */
|
|
236
|
-
freeformCrop?: boolean;
|
|
237
|
-
/** Whether resize handles should ignore pointer and keyboard input. */
|
|
238
|
-
isResizeDisabled?: boolean;
|
|
239
|
-
/** CSS transition string for settle animation. */
|
|
240
|
-
stencilTransition?: string;
|
|
241
|
-
/** Maximum crop rect bounds based on current zoom/rotation. */
|
|
242
|
-
cropBounds?: {
|
|
243
|
-
minX: number;
|
|
244
|
-
minY: number;
|
|
245
|
-
maxX: number;
|
|
246
|
-
maxY: number;
|
|
247
|
-
};
|
|
248
|
-
/** Called when Escape is pressed on a resize handle. */
|
|
249
|
-
onEscape?: () => void;
|
|
250
|
-
/**
|
|
251
|
-
* Minimum crop rect dimension in normalized space, per axis. Derived
|
|
252
|
-
* by the host from a pixel-based floor (see `MIN_CROP_PIXELS`) and
|
|
253
|
-
* the source image dimensions. Omit to use the stencil's default.
|
|
254
|
-
*/
|
|
255
|
-
minCropSize?: Size;
|
|
256
|
-
/**
|
|
257
|
-
* Optional post-processor for freeform resize output. Hosts use this for
|
|
258
|
-
* display-gated behavior such as snapping visible pixel grids to source
|
|
259
|
-
* pixel boundaries.
|
|
260
|
-
*/
|
|
261
|
-
snapCropRect?: (rect: NormalizedRect, handle: HandlePosition) => NormalizedRect;
|
|
262
|
-
/**
|
|
263
|
-
* Optional keyboard resize step in normalized space, per axis. Hosts use
|
|
264
|
-
* this when keyboard resize should follow the rendered image scale instead
|
|
265
|
-
* of the default percentage-based step.
|
|
266
|
-
*/
|
|
267
|
-
keyboardResizeStep?: Size;
|
|
268
|
-
}
|
|
269
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ViewportState, ViewportAction } from './types';
|
|
2
|
-
export declare const DEFAULT_VIEWPORT_STATE: ViewportState;
|
|
3
|
-
export declare function viewportReducer(state: ViewportState, action: ViewportAction): ViewportState;
|
|
4
|
-
//# sourceMappingURL=viewport-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-state.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/viewport-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,wBAAgB,eAAe,CAC9B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,GACpB,aAAa,CAmBf"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public image editor contract.
|
|
3
|
-
*
|
|
4
|
-
* Keep this barrel explicit so implementation details from `core/`,
|
|
5
|
-
* `react/hooks/`, or `react/components/` do not become supported API by
|
|
6
|
-
* accident. Internal modules may export additional helpers for local tests or
|
|
7
|
-
* React wiring; consumers should import through this file.
|
|
8
|
-
*/
|
|
9
|
-
export { useCropperReducer, buildCropperSetters } from './react/hooks';
|
|
10
|
-
export { Cropper, CropperProvider, useCropper } from './react/components';
|
|
11
|
-
export type { CropperController, CropperSetters } from './react/hooks';
|
|
12
|
-
export type { CropperProps } from './react/components';
|
|
13
|
-
export type { CropperState, CropperAction, TransformOperation, NormalizedPoint, NormalizedRect, Size, Flip, StencilProps, HandlePosition, } from './core';
|
|
14
|
-
export { DEFAULT_STATE, DEFAULT_ASPECT_RATIOS, ORIGINAL_ASPECT_RATIO, cropperReducer, enforceContainment, areCropperStatesEqual, computeInscribedRect, getSourceRegion, getSourceRegionPercent, applyOperationToState, stateFromPipeline, exportCroppedImage, applyToCanvas, } from './core';
|
|
15
|
-
export type { AspectRatioPreset, SourceRegion, SourceRegionPercent, } from './core';
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,YAAY,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,cAAc,GACd,MAAM,QAAQ,CAAC;AAMhB,OAAO,EACN,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACb,MAAM,QAAQ,CAAC;AAChB,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,GACnB,MAAM,QAAQ,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type CropperController } from '../hooks/use-cropper-reducer';
|
|
2
|
-
import type { CropperState } from '../../core/types';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the CropperProvider component.
|
|
5
|
-
*/
|
|
6
|
-
interface CropperProviderProps {
|
|
7
|
-
/** Optional partial initial state to merge with defaults. */
|
|
8
|
-
initialState?: Partial<CropperState>;
|
|
9
|
-
/** Child components. */
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Convenience context provider that wraps `useCropperReducer`.
|
|
14
|
-
*
|
|
15
|
-
* Provides the pure cropper controller (state + setters, NO undo
|
|
16
|
-
* history) to all descendant components via React context.
|
|
17
|
-
*
|
|
18
|
-
* History is a higher-layer concern owned by composite stores
|
|
19
|
-
* (see `useMediaEditorState` in media-editor/state for the media
|
|
20
|
-
* editor's composite controller with undo/redo).
|
|
21
|
-
*
|
|
22
|
-
* @param props
|
|
23
|
-
* @param props.initialState
|
|
24
|
-
* @param props.children
|
|
25
|
-
* @return The provider element wrapping children.
|
|
26
|
-
*/
|
|
27
|
-
export declare function CropperProvider({ initialState, children, }: CropperProviderProps): import("react").JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* Hook to consume the CropperProvider context.
|
|
30
|
-
*
|
|
31
|
-
* Must be used within a CropperProvider. Throws if used outside
|
|
32
|
-
* of the provider tree.
|
|
33
|
-
*
|
|
34
|
-
* @return The cropper controller.
|
|
35
|
-
*/
|
|
36
|
-
export declare function useCropper(): CropperController;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=cropper-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cropper-provider.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUrD;;GAEG;AACH,UAAU,oBAAoB;IAC7B,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,CAAC;IACvC,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAE,EAChC,YAAY,EACZ,QAAQ,GACR,EAAE,oBAAoB,+BAQtB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,iBAAiB,CAQ9C"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { CropperState, StencilProps, Size } from '../../core/types';
|
|
2
|
-
import type { CropperController } from '../hooks/use-cropper-reducer';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the Cropper component.
|
|
5
|
-
*/
|
|
6
|
-
export interface CropperProps {
|
|
7
|
-
/** Image source URL. */
|
|
8
|
-
src: string;
|
|
9
|
-
/** The cropper controller from `useCropperReducer` or a composite store. */
|
|
10
|
-
controller: CropperController;
|
|
11
|
-
/** Stencil component for the crop area. Defaults to RectangleStencil. */
|
|
12
|
-
stencil?: React.ComponentType<StencilProps>;
|
|
13
|
-
/** Show the rule-of-thirds grid overlay, or only during interactions. */
|
|
14
|
-
showGrid?: boolean | 'interactive';
|
|
15
|
-
/** Whether external placement activity should keep the grid visible. */
|
|
16
|
-
isPlacementActive?: boolean;
|
|
17
|
-
/** Show the dimming overlay outside the crop area. */
|
|
18
|
-
showDimming?: boolean;
|
|
19
|
-
/** Show the live output dimensions tooltip during a resize. */
|
|
20
|
-
showDimensions?: boolean;
|
|
21
|
-
/** Minimum zoom level override. Defaults to the coverage-aware minimum. */
|
|
22
|
-
minZoom?: number;
|
|
23
|
-
/** Maximum zoom level. */
|
|
24
|
-
maxZoom?: number;
|
|
25
|
-
/** Fixed aspect ratio (width / height) in pixel space for the crop area. */
|
|
26
|
-
aspectRatio?: number;
|
|
27
|
-
/**
|
|
28
|
-
* Enable freeform crop mode with resizable handles.
|
|
29
|
-
* When false (default), the crop area is fixed and centered.
|
|
30
|
-
* When true, the crop area has resize handles and can be freely repositioned.
|
|
31
|
-
*/
|
|
32
|
-
freeformCrop?: boolean;
|
|
33
|
-
/** Focus the crop area when the cropper mounts. */
|
|
34
|
-
focusOnMount?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Ignore all crop interaction: pointer drags, wheel zoom, keyboard
|
|
37
|
-
* pan/zoom and the stencil's resize handles. Any gesture already in
|
|
38
|
-
* flight is cancelled. Used while the edit is being saved, so the
|
|
39
|
-
* modifiers sent to the server cannot change after the request starts.
|
|
40
|
-
*/
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
/** Callback fired when the image is loaded. */
|
|
43
|
-
onImageLoaded?: (size: Size) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Callback fired on every state change. Fires at pointermove rate
|
|
46
|
-
* during drags, so keep the handler light — no heavy work, no
|
|
47
|
-
* expensive parent re-renders. For commit-style events (drag end,
|
|
48
|
-
* settled crop), use `onGestureEnd` instead.
|
|
49
|
-
*
|
|
50
|
-
* Useful for lightweight syncing with external tools, analytics,
|
|
51
|
-
* or AI agents. Receives the full state so consumers can derive
|
|
52
|
-
* whatever they need.
|
|
53
|
-
*/
|
|
54
|
-
onStateChange?: (state: CropperState) => void;
|
|
55
|
-
/** Fires when a continuous gesture begins (pan drag, handle resize, pinch zoom). */
|
|
56
|
-
onGestureStart?: () => void;
|
|
57
|
-
/** Fires when a continuous gesture ends (pointerup, resize settle). */
|
|
58
|
-
onGestureEnd?: () => void;
|
|
59
|
-
/** Additional className for the container. */
|
|
60
|
-
className?: string;
|
|
61
|
-
}
|
|
62
|
-
export declare const Cropper: import("react").ForwardRefExoticComponent<CropperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
-
//# sourceMappingURL=cropper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { HandlePosition, NormalizedRect, Size } from '../../../core/types';
|
|
2
|
-
interface DimensionsOverlayProps {
|
|
3
|
-
/** Crop rectangle in normalized coordinates. */
|
|
4
|
-
cropRect: NormalizedRect;
|
|
5
|
-
/** Container element dimensions in pixels. */
|
|
6
|
-
containerSize: Size;
|
|
7
|
-
/** Rendered image dimensions in pixels within the container. */
|
|
8
|
-
imageSize: Size;
|
|
9
|
-
/** Currently-dragged handle, or null when no pointer drag is active. */
|
|
10
|
-
activeHandle: HandlePosition | null;
|
|
11
|
-
/** Output crop width in source pixels. */
|
|
12
|
-
outputWidth: number;
|
|
13
|
-
/** Output crop height in source pixels. */
|
|
14
|
-
outputHeight: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Tooltip that follows the active resize handle during a pointer drag,
|
|
18
|
-
* showing the current output dimensions of the crop in source pixels.
|
|
19
|
-
*
|
|
20
|
-
* Renders nothing outside of a pointer-driven resize, so keyboard
|
|
21
|
-
* arrow-key adjustments and pan/zoom gestures stay quiet.
|
|
22
|
-
*
|
|
23
|
-
* @param props
|
|
24
|
-
* @param props.cropRect
|
|
25
|
-
* @param props.containerSize
|
|
26
|
-
* @param props.imageSize
|
|
27
|
-
* @param props.activeHandle
|
|
28
|
-
* @param props.outputWidth
|
|
29
|
-
* @param props.outputHeight
|
|
30
|
-
*/
|
|
31
|
-
export declare function DimensionsOverlay({ cropRect, containerSize, imageSize, activeHandle, outputWidth, outputHeight, }: DimensionsOverlayProps): import("react").JSX.Element | null;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=dimensions-overlay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dimensions-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/dimensions-overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAgIhF,UAAU,sBAAsB;IAC/B,gDAAgD;IAChD,QAAQ,EAAE,cAAc,CAAC;IACzB,8CAA8C;IAC9C,aAAa,EAAE,IAAI,CAAC;IACpB,gEAAgE;IAChE,SAAS,EAAE,IAAI,CAAC;IAChB,wEAAwE;IACxE,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAE,EAClC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,GACZ,EAAE,sBAAsB,sCA+FxB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NormalizedRect, Size } from '../../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the DimmingOverlay component.
|
|
4
|
-
*/
|
|
5
|
-
interface DimmingOverlayProps {
|
|
6
|
-
/** The crop rectangle in normalized coordinates. */
|
|
7
|
-
cropRect: NormalizedRect;
|
|
8
|
-
/** The container element dimensions in pixels. */
|
|
9
|
-
containerSize: Size;
|
|
10
|
-
/** The rendered image dimensions in pixels within the container. */
|
|
11
|
-
imageSize: Size;
|
|
12
|
-
/** CSS transition string, e.g. during settle animation. */
|
|
13
|
-
transition?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function DimmingOverlay({ cropRect, containerSize, imageSize, transition, }: DimmingOverlayProps): import("react").JSX.Element | null;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=dimming-overlay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dimming-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/dimming-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,UAAU,mBAAmB;IAC5B,oDAAoD;IACpD,QAAQ,EAAE,cAAc,CAAC;IACzB,kDAAkD;IAClD,aAAa,EAAE,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,IAAI,CAAC;IAChB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,cAAc,CAAE,EAC/B,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,GACV,EAAE,mBAAmB,sCA+BrB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { NormalizedRect, Size } from '../../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the GridOverlay component.
|
|
4
|
-
*/
|
|
5
|
-
interface GridOverlayProps {
|
|
6
|
-
/** The crop rectangle in normalized coordinates. */
|
|
7
|
-
cropRect: NormalizedRect;
|
|
8
|
-
/** The container element dimensions in pixels. */
|
|
9
|
-
containerSize: Size;
|
|
10
|
-
/** The rendered image dimensions in pixels within the container. */
|
|
11
|
-
imageSize: Size;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Renders a rule-of-thirds grid inside the crop rectangle.
|
|
15
|
-
*
|
|
16
|
-
* Displays 2 horizontal and 2 vertical lines at 1/3 and 2/3
|
|
17
|
-
* positions within the crop area.
|
|
18
|
-
*
|
|
19
|
-
* @param props Component props.
|
|
20
|
-
* @param props.cropRect The crop rectangle in normalized coordinates.
|
|
21
|
-
* @param props.containerSize The container element dimensions in pixels.
|
|
22
|
-
* @param props.imageSize The rendered image dimensions in pixels.
|
|
23
|
-
* @return The grid overlay element.
|
|
24
|
-
*/
|
|
25
|
-
export declare function GridOverlay({ cropRect, containerSize, imageSize, }: GridOverlayProps): import("react").JSX.Element | null;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=grid-overlay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/grid-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,UAAU,gBAAgB;IACzB,oDAAoD;IACpD,QAAQ,EAAE,cAAc,CAAC;IACzB,kDAAkD;IAClD,aAAa,EAAE,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAE,EAC5B,QAAQ,EACR,aAAa,EACb,SAAS,GACT,EAAE,gBAAgB,sCA8ClB"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { StencilProps } from '../../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Props for the RectangleStencil component.
|
|
4
|
-
*/
|
|
5
|
-
type RectangleStencilProps = StencilProps;
|
|
6
|
-
/**
|
|
7
|
-
* A rectangular crop stencil with resize handles.
|
|
8
|
-
*
|
|
9
|
-
* In freeform mode, handles resize the crop area. Clicks inside the
|
|
10
|
-
* crop pass through to the container for image panning. The crop
|
|
11
|
-
* auto-centers after resize via SETTLE_CROP.
|
|
12
|
-
*
|
|
13
|
-
* @param props Component props implementing StencilProps.
|
|
14
|
-
* @param props.cropRect The crop rectangle in normalized coordinates.
|
|
15
|
-
* @param props.containerSize The container element dimensions in pixels.
|
|
16
|
-
* @param props.imageSize The rendered image dimensions in pixels.
|
|
17
|
-
* @param props.onCropChange Callback fired when the crop rect changes.
|
|
18
|
-
* @param props.onResizeStart Callback fired when a resize drag starts.
|
|
19
|
-
* @param props.onResizeEnd Callback fired when a resize drag ends (mouseup).
|
|
20
|
-
* @param props.aspectRatio Optional fixed aspect ratio (width / height).
|
|
21
|
-
* @param props.freeformCrop Whether resize handles are shown.
|
|
22
|
-
* @param props.isResizeDisabled Whether resize handles should ignore pointer and keyboard input.
|
|
23
|
-
* @param props.stencilTransition CSS transition string for settle animation.
|
|
24
|
-
* @param props.cropBounds Maximum crop rect bounds from camera (zoom/rotation-aware).
|
|
25
|
-
* @param props.onEscape Called when Escape is pressed on a resize handle.
|
|
26
|
-
* @param props.minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
27
|
-
* @param props.snapCropRect Optional post-processor for freeform resize output.
|
|
28
|
-
* @param props.keyboardResizeStep Optional keyboard resize step in normalized space, per axis.
|
|
29
|
-
* @return The rectangle stencil element.
|
|
30
|
-
*/
|
|
31
|
-
export declare function RectangleStencil({ cropRect, containerSize, imageSize, onCropChange, onResizeStart, onResizeEnd, aspectRatio, freeformCrop, isResizeDisabled, stencilTransition, cropBounds, onEscape, minCropSize, snapCropRect, keyboardResizeStep, }: RectangleStencilProps): import("react").JSX.Element | null;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=rectangle-stencil.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,6 +0,0 @@
|
|
|
1
|
-
import { type UseViewportStateReturn } from '../hooks/use-viewport-state';
|
|
2
|
-
export declare function ViewportProvider({ children, }: {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}): import("react").JSX.Element;
|
|
5
|
-
export declare function useViewport(): UseViewportStateReturn;
|
|
6
|
-
//# sourceMappingURL=viewport-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-provider.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/viewport-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,sBAAsB,EAC3B,MAAM,6BAA6B,CAAC;AAMrC,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,GACR,EAAE;IACF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,+BAOA;AAED,wBAAgB,WAAW,IAAI,sBAAsB,CAQpD"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { CropperAction, CropperState, Flip, NormalizedPoint, NormalizedRect, TransformOperation } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* The named cropper setters shared by every hook that drives the
|
|
4
|
-
* cropper reducer — the pure `useCropperReducer` and any composite
|
|
5
|
-
* store that delegates cropper actions (e.g. `useMediaEditorState`).
|
|
6
|
-
*
|
|
7
|
-
* `setImage` and `reset` are intentionally NOT included: each hook
|
|
8
|
-
* has additional bookkeeping for them (dirty-baseline, history clear)
|
|
9
|
-
* that doesn't fit a shared factory.
|
|
10
|
-
*/
|
|
11
|
-
export interface CropperSetters {
|
|
12
|
-
setPan: (pan: NormalizedPoint) => void;
|
|
13
|
-
setZoom: (zoom: number) => void;
|
|
14
|
-
setZoomAtPoint: (zoom: number, pan: NormalizedPoint) => void;
|
|
15
|
-
setRotation: (rotation: number) => void;
|
|
16
|
-
setFlip: (flip: Flip) => void;
|
|
17
|
-
toggleFlip: (direction: 'horizontal' | 'vertical') => void;
|
|
18
|
-
snapRotate90: (direction: 1 | -1) => void;
|
|
19
|
-
setCropRect: (rect: NormalizedRect) => void;
|
|
20
|
-
settleCrop: () => void;
|
|
21
|
-
applyOperation: (op: TransformOperation) => void;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build the named cropper setters from a dispatch function and a
|
|
25
|
-
* state getter. The two consuming hooks differ in how they dispatch:
|
|
26
|
-
*
|
|
27
|
-
* - `useCropperReducer` dispatches directly into its `useReducer`.
|
|
28
|
-
* - `useMediaEditorState` wraps cropper actions in a composite
|
|
29
|
-
* `CROPPER` envelope so the history machinery can record them.
|
|
30
|
-
*
|
|
31
|
-
* Both pass their own dispatch function and a getter that returns
|
|
32
|
-
* the current `CropperState`. The factory shape keeps the two hooks
|
|
33
|
-
* in lockstep — add a setter here once, both hooks get it.
|
|
34
|
-
*
|
|
35
|
-
* @param dispatchCropperAction Apply a `CropperAction` to the
|
|
36
|
-
* underlying reducer.
|
|
37
|
-
* @param getCropperState Return the current `CropperState`.
|
|
38
|
-
* Used by setters that need to read
|
|
39
|
-
* the latest state to compute their
|
|
40
|
-
* payload (focal-point zoom, flip toggle).
|
|
41
|
-
* @return The named cropper setters.
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildCropperSetters(dispatchCropperAction: (action: CropperAction) => void, getCropperState: () => CropperState): CropperSetters;
|
|
44
|
-
//# sourceMappingURL=build-cropper-setters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-cropper-setters.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/build-cropper-setters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,IAAI,EACJ,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,CAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IACzC,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAClC,cAAc,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IAC/D,WAAW,EAAE,CAAE,QAAQ,EAAE,MAAM,KAAM,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IAChC,UAAU,EAAE,CAAE,SAAS,EAAE,YAAY,GAAG,UAAU,KAAM,IAAI,CAAC;IAC7D,YAAY,EAAE,CAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAM,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,EAAE,CAAE,EAAE,EAAE,kBAAkB,KAAM,IAAI,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAClC,qBAAqB,EAAE,CAAE,MAAM,EAAE,aAAa,KAAM,IAAI,EACxD,eAAe,EAAE,MAAM,YAAY,GACjC,cAAc,CA8ChB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { useCropperReducer } from './use-cropper-reducer';
|
|
2
|
-
export type { CropperController } from './use-cropper-reducer';
|
|
3
|
-
export { buildCropperSetters } from './build-cropper-setters';
|
|
4
|
-
export type { CropperSetters } from './build-cropper-setters';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CropperState } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Debounce and dedupe ARIA-live announcements for screen readers as the
|
|
4
|
-
* cropper state changes. Calls `speak()` from `@wordpress/a11y` to use the
|
|
5
|
-
* centralized, persistent live region instead of a local one that may be
|
|
6
|
-
* dynamically mounted.
|
|
7
|
-
*
|
|
8
|
-
* Debouncing avoids flooding announcements during drag/pointermove bursts;
|
|
9
|
-
* deduping avoids re-announcing the same state.
|
|
10
|
-
*
|
|
11
|
-
* @param state The current cropper state to announce.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useAriaAnnouncer(state: CropperState): void;
|
|
14
|
-
//# sourceMappingURL=use-aria-announcer.d.ts.map
|