@wordpress/media-editor 0.22.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 +18 -0
- package/build/components/media-editor/index.cjs +74 -21
- package/build/components/media-editor/index.cjs.map +1 -1
- package/build/components/media-editor/use-crop-options.cjs +4 -5
- package/build/components/media-editor/use-crop-options.cjs.map +1 -1
- package/build/components/media-editor/use-save-media-editor.cjs +23 -3
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -1
- package/build/components/media-editor-canvas/index.cjs +6 -11
- package/build/components/media-editor-canvas/index.cjs.map +1 -1
- package/build/components/media-editor-crop-panel/index.cjs +17 -1
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -1
- package/build/components/media-editor-fine-rotation/index.cjs +4 -5
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -1
- package/build/components/media-editor-image-controls/index.cjs +4 -6
- package/build/components/media-editor-image-controls/index.cjs.map +1 -1
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +1 -0
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -1
- package/build/components/media-editor-modal/index.cjs.map +1 -1
- package/build/components/media-form/index.cjs +7 -1
- package/build/components/media-form/index.cjs.map +1 -1
- package/build/components/media-preview/index.cjs +0 -1
- package/build/components/media-preview/index.cjs.map +1 -1
- package/build/state/aspect-ratio-presets.cjs +10 -4
- package/build/state/aspect-ratio-presets.cjs.map +1 -1
- package/build/state/composite-reducer.cjs +32 -67
- package/build/state/composite-reducer.cjs.map +1 -1
- package/build/state/index.cjs +0 -39
- package/build/state/types.cjs +1 -2
- package/build/state/types.cjs.map +1 -1
- package/build/state/use-media-editor-state.cjs +70 -106
- package/build/state/use-media-editor-state.cjs.map +1 -1
- package/build-module/components/media-editor/index.mjs +78 -25
- package/build-module/components/media-editor/index.mjs.map +1 -1
- package/build-module/components/media-editor/use-crop-options.mjs +4 -5
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -1
- package/build-module/components/media-editor/use-save-media-editor.mjs +23 -3
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -1
- package/build-module/components/media-editor-canvas/index.mjs +8 -13
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -1
- package/build-module/components/media-editor-crop-panel/index.mjs +17 -1
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -1
- package/build-module/components/media-editor-fine-rotation/index.mjs +4 -5
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -1
- package/build-module/components/media-editor-image-controls/index.mjs +5 -7
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -1
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +1 -0
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -1
- package/build-module/components/media-editor-modal/index.mjs.map +1 -1
- package/build-module/components/media-form/index.mjs +7 -1
- package/build-module/components/media-form/index.mjs.map +1 -1
- package/build-module/components/media-preview/index.mjs +0 -1
- package/build-module/components/media-preview/index.mjs.map +1 -1
- package/build-module/state/aspect-ratio-presets.mjs +10 -5
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -1
- package/build-module/state/composite-reducer.mjs +32 -67
- package/build-module/state/composite-reducer.mjs.map +1 -1
- package/build-module/state/index.mjs +2 -5
- package/build-module/state/types.mjs +1 -2
- package/build-module/state/types.mjs.map +1 -1
- package/build-module/state/use-media-editor-state.mjs +70 -105
- package/build-module/state/use-media-editor-state.mjs.map +1 -1
- package/build-style/style-rtl.css +104 -57
- package/build-style/style.css +103 -57
- package/build-types/components/media-editor/index.d.ts +17 -3
- 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/state/aspect-ratio-presets.d.ts +20 -3
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -1
- 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 -5
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +20 -64
- 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 +163 -28
- package/src/components/media-editor/use-crop-options.ts +7 -11
- package/src/components/media-editor/use-save-media-editor.ts +48 -6
- package/src/components/media-editor-canvas/index.tsx +15 -26
- 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 +11 -9
- 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-form/index.tsx +7 -1
- package/src/components/media-preview/index.tsx +0 -1
- package/src/components/rotation-ruler/style.scss +3 -3
- package/src/state/README.md +32 -0
- package/src/state/aspect-ratio-presets.ts +22 -3
- package/src/state/composite-reducer.ts +42 -80
- package/src/state/index.ts +2 -18
- package/src/state/types.ts +18 -68
- package/src/state/use-media-editor-state.ts +155 -240
- package/src/style.scss +2 -1
- package/build/components/media-editor-modal/build-modifiers.cjs +0 -110
- package/build/components/media-editor-modal/build-modifiers.cjs.map +0 -1
- package/build/image-editor/core/camera.cjs +0 -277
- package/build/image-editor/core/camera.cjs.map +0 -1
- package/build/image-editor/core/constants.cjs +0 -133
- package/build/image-editor/core/constants.cjs.map +0 -1
- package/build/image-editor/core/containment.cjs +0 -289
- package/build/image-editor/core/containment.cjs.map +0 -1
- package/build/image-editor/core/crop-rect.cjs +0 -37
- package/build/image-editor/core/crop-rect.cjs.map +0 -1
- package/build/image-editor/core/export/canvas-renderer.cjs +0 -181
- package/build/image-editor/core/export/canvas-renderer.cjs.map +0 -1
- package/build/image-editor/core/index.cjs +0 -89
- package/build/image-editor/core/interaction-controller.cjs +0 -591
- package/build/image-editor/core/interaction-controller.cjs.map +0 -1
- package/build/image-editor/core/math/rotation.cjs +0 -32
- package/build/image-editor/core/math/rotation.cjs.map +0 -1
- package/build/image-editor/core/math/sanitize.cjs +0 -136
- package/build/image-editor/core/math/sanitize.cjs.map +0 -1
- package/build/image-editor/core/setter-helpers.cjs +0 -61
- package/build/image-editor/core/setter-helpers.cjs.map +0 -1
- package/build/image-editor/core/source-region.cjs +0 -236
- package/build/image-editor/core/source-region.cjs.map +0 -1
- package/build/image-editor/core/state.cjs +0 -296
- package/build/image-editor/core/state.cjs.map +0 -1
- package/build/image-editor/core/stencil-math.cjs +0 -203
- package/build/image-editor/core/stencil-math.cjs.map +0 -1
- package/build/image-editor/core/transform-style.cjs +0 -43
- package/build/image-editor/core/transform-style.cjs.map +0 -1
- package/build/image-editor/core/transforms/pipeline.cjs +0 -41
- package/build/image-editor/core/transforms/pipeline.cjs.map +0 -1
- package/build/image-editor/core/types.cjs +0 -5
- package/build/image-editor/core/viewport-state.cjs +0 -36
- package/build/image-editor/core/viewport-state.cjs.map +0 -1
- package/build/image-editor/index.cjs +0 -68
- package/build/image-editor/react/components/cropper-provider.cjs +0 -49
- package/build/image-editor/react/components/cropper-provider.cjs.map +0 -1
- package/build/image-editor/react/components/cropper.cjs +0 -595
- package/build/image-editor/react/components/cropper.cjs.map +0 -1
- package/build/image-editor/react/components/index.cjs +0 -25
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +0 -147
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +0 -31
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +0 -61
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +0 -367
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +0 -1
- package/build/image-editor/react/components/viewport-provider.cjs +0 -26
- package/build/image-editor/react/components/viewport-provider.cjs.map +0 -1
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +0 -80
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +0 -1
- package/build/image-editor/react/hooks/index.cjs +0 -19
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +0 -104
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-cropper-controller.cjs +0 -80
- package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-interaction.cjs +0 -187
- package/build/image-editor/react/hooks/use-interaction.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-transform-style.cjs +0 -24
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-viewport-state.cjs +0 -40
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +0 -1
- package/build/image-editor/react/visually-hidden-style.cjs +0 -24
- package/build/image-editor/react/visually-hidden-style.cjs.map +0 -1
- package/build-module/components/media-editor-modal/build-modifiers.mjs +0 -105
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +0 -1
- package/build-module/image-editor/core/camera.mjs +0 -265
- package/build-module/image-editor/core/camera.mjs.map +0 -1
- package/build-module/image-editor/core/constants.mjs +0 -115
- package/build-module/image-editor/core/constants.mjs.map +0 -1
- package/build-module/image-editor/core/containment.mjs +0 -281
- package/build-module/image-editor/core/containment.mjs.map +0 -1
- package/build-module/image-editor/core/crop-rect.mjs +0 -32
- package/build-module/image-editor/core/crop-rect.mjs.map +0 -1
- package/build-module/image-editor/core/export/canvas-renderer.mjs +0 -170
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +0 -1
- package/build-module/image-editor/core/index.mjs +0 -7
- package/build-module/image-editor/core/interaction-controller.mjs +0 -586
- package/build-module/image-editor/core/interaction-controller.mjs.map +0 -1
- package/build-module/image-editor/core/math/rotation.mjs +0 -26
- package/build-module/image-editor/core/math/rotation.mjs.map +0 -1
- package/build-module/image-editor/core/math/sanitize.mjs +0 -127
- package/build-module/image-editor/core/math/sanitize.mjs.map +0 -1
- package/build-module/image-editor/core/setter-helpers.mjs +0 -56
- package/build-module/image-editor/core/setter-helpers.mjs.map +0 -1
- package/build-module/image-editor/core/source-region.mjs +0 -228
- package/build-module/image-editor/core/source-region.mjs.map +0 -1
- package/build-module/image-editor/core/state.mjs +0 -288
- package/build-module/image-editor/core/state.mjs.map +0 -1
- package/build-module/image-editor/core/stencil-math.mjs +0 -194
- package/build-module/image-editor/core/stencil-math.mjs.map +0 -1
- package/build-module/image-editor/core/transform-style.mjs +0 -38
- package/build-module/image-editor/core/transform-style.mjs.map +0 -1
- package/build-module/image-editor/core/transforms/pipeline.mjs +0 -35
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +0 -1
- package/build-module/image-editor/core/types.mjs +0 -0
- package/build-module/image-editor/core/viewport-state.mjs +0 -30
- package/build-module/image-editor/core/viewport-state.mjs.map +0 -1
- package/build-module/image-editor/index.mjs +0 -4
- package/build-module/image-editor/react/components/cropper-provider.mjs +0 -43
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +0 -1
- package/build-module/image-editor/react/components/cropper.mjs +0 -568
- package/build-module/image-editor/react/components/cropper.mjs.map +0 -1
- package/build-module/image-editor/react/components/index.mjs +0 -3
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +0 -142
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +0 -26
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +0 -56
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +0 -362
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +0 -1
- package/build-module/image-editor/react/components/viewport-provider.mjs +0 -20
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +0 -75
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/index.mjs +0 -3
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +0 -99
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +0 -75
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-interaction.mjs +0 -182
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +0 -19
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +0 -35
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +0 -1
- package/build-module/image-editor/react/visually-hidden-style.mjs +0 -19
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +0 -1
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -81
- 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 -98
- 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 -17
- 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 -54
- 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-controller.d.ts +0 -55
- package/build-types/image-editor/react/hooks/use-cropper-controller.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 -167
- 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 -137
- 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 -43
- 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 -43
- 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 -1108
- 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-controller.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.mjs","names":[],"sources":["../../../../src/image-editor/core/transforms/pipeline.ts"],"sourcesContent":["import type { TransformOperation, CropperState } from '../types';\nimport { DEFAULT_STATE } from '../constants';\nimport { cropperReducer } from '../state';\n\n/**\n * Apply a single transform operation to a cropper state, returning\n * a new state with the containment invariant enforced.\n *\n * Delegates to the reducer via APPLY_OPERATION so pipeline replay\n * produces identical bounded state to UI interaction or setter\n * calls. The same logical operation yields the same result\n * regardless of entrypoint.\n *\n * @param state The current cropper state.\n * @param op The operation to apply.\n * @return A new cropper state with the operation applied.\n */\nexport function applyOperationToState(\n\tstate: CropperState,\n\top: TransformOperation\n): CropperState {\n\treturn cropperReducer( state, { type: 'APPLY_OPERATION', payload: op } );\n}\n\n/**\n * Replay all operations from an initial state to produce the final state.\n *\n * @param pipeline The array of transform operations to replay.\n * @param initialState The starting state. Defaults to DEFAULT_STATE.\n * @return The resulting cropper state after all operations are applied.\n */\nexport function stateFromPipeline(\n\tpipeline: TransformOperation[],\n\tinitialState: CropperState = { ...DEFAULT_STATE }\n): CropperState {\n\treturn pipeline.reduce(\n\t\t( state, op ) => applyOperationToState( state, op ),\n\t\tinitialState\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAgB,sBACf,OACA,IACe;CACf,OAAO,eAAgB,OAAO;EAAE,MAAM;EAAmB,SAAS;CAAG,CAAE;AACxE;;;;;;;;AASA,SAAgB,kBACf,UACA,eAA6B,EAAE,GAAG,cAAc,GACjC;CACf,OAAO,SAAS,QACb,OAAO,OAAQ,sBAAuB,OAAO,EAAG,GAClD,YACD;AACD"}
|
|
File without changes
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// packages/media-editor/src/image-editor/core/viewport-state.ts
|
|
2
|
-
const DEFAULT_VIEWPORT_STATE = {
|
|
3
|
-
zoom: 1,
|
|
4
|
-
pan: {
|
|
5
|
-
x: 0,
|
|
6
|
-
y: 0
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
function viewportReducer(state, action) {
|
|
10
|
-
switch (action.type) {
|
|
11
|
-
case "SET_VIEWPORT_ZOOM": {
|
|
12
|
-
const zoom = Math.min(4, Math.max(.1, action.payload));
|
|
13
|
-
return zoom === state.zoom ? state : {
|
|
14
|
-
...state,
|
|
15
|
-
zoom
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
case "SET_VIEWPORT_PAN": {
|
|
19
|
-
const { x, y } = action.payload;
|
|
20
|
-
return x === state.pan.x && y === state.pan.y ? state : {
|
|
21
|
-
...state,
|
|
22
|
-
pan: action.payload
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
case "RESET_VIEWPORT": return state.zoom === DEFAULT_VIEWPORT_STATE.zoom && state.pan.x === DEFAULT_VIEWPORT_STATE.pan.x && state.pan.y === DEFAULT_VIEWPORT_STATE.pan.y ? state : DEFAULT_VIEWPORT_STATE;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export { DEFAULT_VIEWPORT_STATE, viewportReducer };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=viewport-state.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-state.mjs","names":[],"sources":["../../../src/image-editor/core/viewport-state.ts"],"sourcesContent":["import type { ViewportState, ViewportAction } from './types';\n\nexport const DEFAULT_VIEWPORT_STATE: ViewportState = {\n\tzoom: 1,\n\tpan: { x: 0, y: 0 },\n};\n\nexport function viewportReducer(\n\tstate: ViewportState,\n\taction: ViewportAction\n): ViewportState {\n\tswitch ( action.type ) {\n\t\tcase 'SET_VIEWPORT_ZOOM': {\n\t\t\tconst zoom = Math.min( 4, Math.max( 0.1, action.payload ) );\n\t\t\treturn zoom === state.zoom ? state : { ...state, zoom };\n\t\t}\n\t\tcase 'SET_VIEWPORT_PAN': {\n\t\t\tconst { x, y } = action.payload;\n\t\t\treturn x === state.pan.x && y === state.pan.y\n\t\t\t\t? state\n\t\t\t\t: { ...state, pan: action.payload };\n\t\t}\n\t\tcase 'RESET_VIEWPORT':\n\t\t\treturn state.zoom === DEFAULT_VIEWPORT_STATE.zoom &&\n\t\t\t\tstate.pan.x === DEFAULT_VIEWPORT_STATE.pan.x &&\n\t\t\t\tstate.pan.y === DEFAULT_VIEWPORT_STATE.pan.y\n\t\t\t\t? state\n\t\t\t\t: DEFAULT_VIEWPORT_STATE;\n\t}\n}\n"],"mappings":";AAEA,MAAa,yBAAwC;CACpD,MAAM;CACN,KAAK;EAAE,GAAG;EAAG,GAAG;CAAE;AACnB;AAEA,SAAgB,gBACf,OACA,QACgB;CAChB,QAAS,OAAO,MAAhB;EACC,KAAK,qBAAqB;GACzB,MAAM,OAAO,KAAK,IAAK,GAAG,KAAK,IAAK,IAAK,OAAO,OAAQ,CAAE;GAC1D,OAAO,SAAS,MAAM,OAAO,QAAQ;IAAE,GAAG;IAAO;GAAK;EACvD;EACA,KAAK,oBAAoB;GACxB,MAAM,EAAE,GAAG,MAAM,OAAO;GACxB,OAAO,MAAM,MAAM,IAAI,KAAK,MAAM,MAAM,IAAI,IACzC,QACA;IAAE,GAAG;IAAO,KAAK,OAAO;GAAQ;EACpC;EACA,KAAK,kBACJ,OAAO,MAAM,SAAS,uBAAuB,QAC5C,MAAM,IAAI,MAAM,uBAAuB,IAAI,KAC3C,MAAM,IAAI,MAAM,uBAAuB,IAAI,IACzC,QACA;CACL;AACD"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { useCropperController } from "./react/hooks/index.mjs";
|
|
2
|
-
import { Cropper, CropperProvider, useCropper } from "./react/components/index.mjs";
|
|
3
|
-
import { ORIGINAL_ASPECT_RATIO, applyToCanvas, exportCroppedImage, getSourceRegion, getSourceRegionPercent, stateFromPipeline } from "./core/index.mjs";
|
|
4
|
-
export { Cropper, CropperProvider, ORIGINAL_ASPECT_RATIO, applyToCanvas, exportCroppedImage, getSourceRegion, getSourceRegionPercent, stateFromPipeline, useCropper, useCropperController };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "@wordpress/element";
|
|
2
|
-
import { useCropperController } from "../hooks/use-cropper-controller.mjs";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
// packages/media-editor/src/image-editor/react/components/cropper-provider.tsx
|
|
5
|
-
const CropperContext = createContext(null);
|
|
6
|
-
/**
|
|
7
|
-
* Convenience context provider that wraps `useCropperController`.
|
|
8
|
-
*
|
|
9
|
-
* Provides the pure cropper controller (state + setters, NO undo
|
|
10
|
-
* history) to all descendant components via React context.
|
|
11
|
-
*
|
|
12
|
-
* History is a higher-layer concern owned by composite stores
|
|
13
|
-
* (see `useMediaEditorState` in media-editor/state for the media
|
|
14
|
-
* editor's composite controller with undo/redo).
|
|
15
|
-
*
|
|
16
|
-
* @param props
|
|
17
|
-
* @param props.initialState
|
|
18
|
-
* @param props.children
|
|
19
|
-
* @return The provider element wrapping children.
|
|
20
|
-
*/
|
|
21
|
-
function CropperProvider({ initialState, children }) {
|
|
22
|
-
const cropperReturn = useCropperController(initialState);
|
|
23
|
-
return /* @__PURE__ */ jsx(CropperContext.Provider, {
|
|
24
|
-
value: cropperReturn,
|
|
25
|
-
children
|
|
26
|
-
});
|
|
27
|
-
}
|
|
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
|
-
function useCropper() {
|
|
37
|
-
const context = useContext(CropperContext);
|
|
38
|
-
if (!context) throw new Error("useCropper must be used within a CropperProvider.");
|
|
39
|
-
return context;
|
|
40
|
-
}
|
|
41
|
-
export { CropperProvider, useCropper };
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=cropper-provider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cropper-provider.mjs","names":[],"sources":["../../../../src/image-editor/react/components/cropper-provider.tsx"],"sourcesContent":["import { createContext, useContext } from '@wordpress/element';\nimport {\n\tuseCropperController,\n\ttype CropperController,\n} from '../hooks/use-cropper-controller';\nimport type { CropperState } from '../../core/types';\n\n/**\n * The context value type for the CropperProvider.\n * Contains the cropper controller from useCropperController.\n */\ntype CropperContextValue = CropperController | null;\n\nconst CropperContext = createContext< CropperContextValue >( null );\n\n/**\n * Props for the CropperProvider component.\n */\ninterface CropperProviderProps {\n\t/** Optional partial initial state to merge with defaults. */\n\tinitialState?: Partial< CropperState >;\n\t/** Child components. */\n\tchildren: React.ReactNode;\n}\n\n/**\n * Convenience context provider that wraps `useCropperController`.\n *\n * Provides the pure cropper controller (state + setters, NO undo\n * history) to all descendant components via React context.\n *\n * History is a higher-layer concern owned by composite stores\n * (see `useMediaEditorState` in media-editor/state for the media\n * editor's composite controller with undo/redo).\n *\n * @param props\n * @param props.initialState\n * @param props.children\n * @return The provider element wrapping children.\n */\nexport function CropperProvider( {\n\tinitialState,\n\tchildren,\n}: CropperProviderProps ) {\n\tconst cropperReturn = useCropperController( initialState );\n\n\treturn (\n\t\t<CropperContext.Provider value={ cropperReturn }>\n\t\t\t{ children }\n\t\t</CropperContext.Provider>\n\t);\n}\n\n/**\n * Hook to consume the CropperProvider context.\n *\n * Must be used within a CropperProvider. Throws if used outside\n * of the provider tree.\n *\n * @return The cropper controller.\n */\nexport function useCropper(): CropperController {\n\tconst context = useContext( CropperContext );\n\n\tif ( ! context ) {\n\t\tthrow new Error( 'useCropper must be used within a CropperProvider.' );\n\t}\n\n\treturn context;\n}\n"],"mappings":";;;;AAaA,MAAM,iBAAiB,cAAsC,IAAK;;;;;;;;;;;;;;;;AA2BlE,SAAgB,gBAAiB,EAChC,cACA,YACyB;CACzB,MAAM,gBAAgB,qBAAsB,YAAa;CAEzD,OACC,oBAAC,eAAe,UAAhB;EAAyB,OAAQ;EAC9B;CACsB,CAAA;AAE3B;;;;;;;;;AAUA,SAAgB,aAAgC;CAC/C,MAAM,UAAU,WAAY,cAAe;CAE3C,IAAK,CAAE,SACN,MAAM,IAAI,MAAO,mDAAoD;CAGtE,OAAO;AACR"}
|
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import { flushSync, forwardRef, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "@wordpress/element";
|
|
3
|
-
import { __ } from "@wordpress/i18n";
|
|
4
|
-
import { getImageFit, getRotatedBBox, getViewScale } from "../../core/camera.mjs";
|
|
5
|
-
import { getImageCropBounds, getMinZoom } from "../../core/containment.mjs";
|
|
6
|
-
import { MAX_VIEW_SCALE, PIXEL_SNAP_DISPLAY_SCALE, SETTLE_TARGET_CANVAS_FILL } from "../../core/constants.mjs";
|
|
7
|
-
import { computeInscribedRect } from "../../core/crop-rect.mjs";
|
|
8
|
-
import { getMinCropPixels } from "../../core/stencil-math.mjs";
|
|
9
|
-
import { useInteraction } from "../hooks/use-interaction.mjs";
|
|
10
|
-
import { useTransformStyle } from "../hooks/use-transform-style.mjs";
|
|
11
|
-
import { useAriaAnnouncer } from "../hooks/use-aria-announcer.mjs";
|
|
12
|
-
import { RectangleStencil } from "./stencils/rectangle-stencil.mjs";
|
|
13
|
-
import { DimmingOverlay } from "./overlays/dimming-overlay.mjs";
|
|
14
|
-
import { GridOverlay } from "./overlays/grid-overlay.mjs";
|
|
15
|
-
import { DimensionsOverlay } from "./overlays/dimensions-overlay.mjs";
|
|
16
|
-
import { getSourceRegion, snapCropRectToSourcePixelGrid, snapCropRectToSourcePixels } from "../../core/source-region.mjs";
|
|
17
|
-
import { ViewportProvider, useViewport } from "./viewport-provider.mjs";
|
|
18
|
-
import { VISUALLY_HIDDEN_STYLE } from "../visually-hidden-style.mjs";
|
|
19
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
-
// packages/media-editor/src/image-editor/react/components/cropper.tsx
|
|
21
|
-
/** Threshold for comparing normalized crop rect values. */
|
|
22
|
-
const CROP_RECT_EPSILON = 1e-6;
|
|
23
|
-
/** Threshold for deciding whether rotation is at a 90-degree stop. */
|
|
24
|
-
const CARDINAL_ROTATION_EPSILON = 1e-6;
|
|
25
|
-
/** Duration of the settle transform transition after resize end. */
|
|
26
|
-
const SETTLE_TRANSITION_DURATION_MS = 200;
|
|
27
|
-
const SETTLE_TRANSITION_FALLBACK_MS = 300;
|
|
28
|
-
const SETTLE_TRANSFORM_TRANSITION = `transform ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`;
|
|
29
|
-
const SETTLE_STENCIL_TRANSITION = [
|
|
30
|
-
`left ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
|
|
31
|
-
`top ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
|
|
32
|
-
`width ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`,
|
|
33
|
-
`height ${SETTLE_TRANSITION_DURATION_MS}ms ease-out`
|
|
34
|
-
].join(", ");
|
|
35
|
-
/**
|
|
36
|
-
* The main image cropper component.
|
|
37
|
-
*
|
|
38
|
-
* Renders an image within a container with interactive crop overlays.
|
|
39
|
-
* Creates the camera once per render via getImageFit, then passes
|
|
40
|
-
* derived values to stencil, overlays, and interaction hooks.
|
|
41
|
-
*
|
|
42
|
-
* The component fills its parent container (100% width and height).
|
|
43
|
-
* Wrap it in a sized container to control its dimensions.
|
|
44
|
-
*
|
|
45
|
-
* @param root0 Component props implementing CropperProps.
|
|
46
|
-
* @param root0.src Image source URL.
|
|
47
|
-
* @param root0.controller The cropper controller from `useCropperController` or a composite store.
|
|
48
|
-
* @param root0.stencil Custom stencil component.
|
|
49
|
-
* @param root0.showGrid Grid overlay mode: false | true | 'interactive'.
|
|
50
|
-
* @param root0.isPlacementActive Keep grid visible during external placement activity.
|
|
51
|
-
* @param root0.showDimming Show dimming overlay outside crop.
|
|
52
|
-
* @param root0.showDimensions Show live dimensions tooltip during resize.
|
|
53
|
-
* @param root0.minZoom Minimum zoom level override.
|
|
54
|
-
* @param root0.maxZoom Maximum zoom level.
|
|
55
|
-
* @param root0.aspectRatio Fixed aspect ratio (width/height).
|
|
56
|
-
* @param root0.freeformCrop Enable resize handles.
|
|
57
|
-
* @param root0.focusOnMount Focus the crop area on mount.
|
|
58
|
-
* @param root0.disabled Ignore all crop interaction.
|
|
59
|
-
* @param root0.onImageLoaded Image load callback.
|
|
60
|
-
* @param root0.onImageError Image error callback.
|
|
61
|
-
* @param root0.onGestureStart Gesture boundary start.
|
|
62
|
-
* @param root0.onGestureEnd Gesture boundary end.
|
|
63
|
-
* @param root0.className Additional CSS class.
|
|
64
|
-
* @param ref Forwarded ref for the container div.
|
|
65
|
-
*/
|
|
66
|
-
function CropperInner({ src, controller, stencil: StencilComponent = RectangleStencil, showGrid = false, isPlacementActive = false, showDimming = true, showDimensions = true, minZoom, maxZoom, aspectRatio, freeformCrop = false, focusOnMount = false, disabled = false, onImageLoaded, onImageError, onGestureStart, onGestureEnd, className }, ref) {
|
|
67
|
-
const { state, setImage, setCropRect, settleCrop, setVisualSize, adjustCropRectForViewport } = controller;
|
|
68
|
-
const { viewport: viewportState, setViewportPan, resetViewport } = useViewport();
|
|
69
|
-
const canvasRef = useRef(null);
|
|
70
|
-
const cropAreaDescriptionId = useId();
|
|
71
|
-
const [isCropAreaFocused, setIsCropAreaFocused] = useState(focusOnMount);
|
|
72
|
-
const [isFocusVisible, setIsFocusVisible] = useState(false);
|
|
73
|
-
const [canvasSize, setCanvasSize] = useState({
|
|
74
|
-
width: 0,
|
|
75
|
-
height: 0
|
|
76
|
-
});
|
|
77
|
-
useLayoutEffect(() => {
|
|
78
|
-
if (focusOnMount) canvasRef.current?.focus({ preventScroll: true });
|
|
79
|
-
}, [focusOnMount]);
|
|
80
|
-
const handleCropAreaFocus = useCallback((event) => {
|
|
81
|
-
const target = event.target;
|
|
82
|
-
if (target === event.currentTarget) setIsCropAreaFocused(true);
|
|
83
|
-
if (event.relatedTarget !== null && target.matches(":focus-visible")) setIsFocusVisible(true);
|
|
84
|
-
}, []);
|
|
85
|
-
const handleCropAreaBlur = useCallback((event) => {
|
|
86
|
-
if (event.target === event.currentTarget) setIsCropAreaFocused(false);
|
|
87
|
-
if (!event.currentTarget.contains(event.relatedTarget)) setIsFocusVisible(false);
|
|
88
|
-
}, []);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
const element = canvasRef.current;
|
|
91
|
-
if (!element) return;
|
|
92
|
-
const observer = new ResizeObserver((entries) => {
|
|
93
|
-
for (const entry of entries) {
|
|
94
|
-
const { width, height } = entry.contentRect;
|
|
95
|
-
flushSync(() => {
|
|
96
|
-
setCanvasSize((prev) => {
|
|
97
|
-
if (prev.width === width && prev.height === height) return prev;
|
|
98
|
-
return {
|
|
99
|
-
width,
|
|
100
|
-
height
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
observer.observe(element);
|
|
107
|
-
return () => {
|
|
108
|
-
observer.disconnect();
|
|
109
|
-
};
|
|
110
|
-
}, []);
|
|
111
|
-
useAriaAnnouncer(state);
|
|
112
|
-
const naturalWidth = state.image?.naturalWidth ?? 0;
|
|
113
|
-
const naturalHeight = state.image?.naturalHeight ?? 0;
|
|
114
|
-
const { elementSize, visualSize } = useMemo(() => getImageFit(canvasSize, {
|
|
115
|
-
width: naturalWidth,
|
|
116
|
-
height: naturalHeight
|
|
117
|
-
}, state.rotation), [
|
|
118
|
-
canvasSize,
|
|
119
|
-
naturalWidth,
|
|
120
|
-
naturalHeight,
|
|
121
|
-
state.rotation
|
|
122
|
-
]);
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
setVisualSize(visualSize);
|
|
125
|
-
}, [visualSize, setVisualSize]);
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
if (freeformCrop || visualSize.width === 0 || visualSize.height === 0 || !aspectRatio || aspectRatio <= 0) return;
|
|
128
|
-
const rect = computeInscribedRect(aspectRatio, visualSize);
|
|
129
|
-
const current = state.cropRect;
|
|
130
|
-
if (Math.abs(current.x - rect.x) < CROP_RECT_EPSILON && Math.abs(current.y - rect.y) < CROP_RECT_EPSILON && Math.abs(current.width - rect.width) < CROP_RECT_EPSILON && Math.abs(current.height - rect.height) < CROP_RECT_EPSILON) return;
|
|
131
|
-
adjustCropRectForViewport(rect);
|
|
132
|
-
}, [
|
|
133
|
-
freeformCrop,
|
|
134
|
-
aspectRatio,
|
|
135
|
-
visualSize,
|
|
136
|
-
adjustCropRectForViewport,
|
|
137
|
-
state.cropRect
|
|
138
|
-
]);
|
|
139
|
-
const prevAspectRatioRef = useRef(aspectRatio);
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
if (prevAspectRatioRef.current === aspectRatio) return;
|
|
142
|
-
prevAspectRatioRef.current = aspectRatio;
|
|
143
|
-
if (!freeformCrop || visualSize.width === 0 || visualSize.height === 0 || !aspectRatio || aspectRatio <= 0) return;
|
|
144
|
-
const rect = computeInscribedRect(aspectRatio, visualSize);
|
|
145
|
-
const current = state.cropRect;
|
|
146
|
-
if (Math.abs(current.x - rect.x) < CROP_RECT_EPSILON && Math.abs(current.y - rect.y) < CROP_RECT_EPSILON && Math.abs(current.width - rect.width) < CROP_RECT_EPSILON && Math.abs(current.height - rect.height) < CROP_RECT_EPSILON) return;
|
|
147
|
-
adjustCropRectForViewport(rect);
|
|
148
|
-
}, [
|
|
149
|
-
aspectRatio,
|
|
150
|
-
freeformCrop,
|
|
151
|
-
visualSize,
|
|
152
|
-
adjustCropRectForViewport,
|
|
153
|
-
state.cropRect
|
|
154
|
-
]);
|
|
155
|
-
const cropBounds = useMemo(() => {
|
|
156
|
-
if (!state.image || elementSize.width === 0) return;
|
|
157
|
-
return getImageCropBounds(state, elementSize, visualSize);
|
|
158
|
-
}, [
|
|
159
|
-
state,
|
|
160
|
-
elementSize,
|
|
161
|
-
visualSize
|
|
162
|
-
]);
|
|
163
|
-
const effectiveMinZoom = minZoom !== void 0 ? minZoom : getMinZoom(state);
|
|
164
|
-
const [isResizing, setIsResizing] = useState(false);
|
|
165
|
-
const isResizingRef = useRef(false);
|
|
166
|
-
const isSettlingRef = useRef(false);
|
|
167
|
-
const [isTouchPinching, setIsTouchPinchingState] = useState(false);
|
|
168
|
-
const isTouchPinchingRef = useRef(false);
|
|
169
|
-
const setTouchPinching = useCallback((isPinching) => {
|
|
170
|
-
isTouchPinchingRef.current = isPinching;
|
|
171
|
-
setIsTouchPinchingState(isPinching);
|
|
172
|
-
}, []);
|
|
173
|
-
const [activeHandle, setActiveHandle] = useState(null);
|
|
174
|
-
const viewScaleRest = useMemo(() => getViewScale(state.cropRect, canvasSize, visualSize, SETTLE_TARGET_CANVAS_FILL, MAX_VIEW_SCALE), [
|
|
175
|
-
state.cropRect,
|
|
176
|
-
canvasSize,
|
|
177
|
-
visualSize
|
|
178
|
-
]);
|
|
179
|
-
const [frozenViewScale, setFrozenViewScale] = useState(1);
|
|
180
|
-
const viewScale = isResizing ? frozenViewScale : viewScaleRest;
|
|
181
|
-
const scaledVisualSize = useMemo(() => ({
|
|
182
|
-
width: visualSize.width * viewScale,
|
|
183
|
-
height: visualSize.height * viewScale
|
|
184
|
-
}), [
|
|
185
|
-
visualSize.width,
|
|
186
|
-
visualSize.height,
|
|
187
|
-
viewScale
|
|
188
|
-
]);
|
|
189
|
-
const displayScale = naturalWidth > 0 ? elementSize.width / naturalWidth * state.zoom * viewScale : 0;
|
|
190
|
-
const keyboardResizeStep = useMemo(() => {
|
|
191
|
-
if (displayScale < PIXEL_SNAP_DISPLAY_SCALE || aspectRatio && aspectRatio > 0 || naturalWidth <= 0 || naturalHeight <= 0) return;
|
|
192
|
-
const snapRotation = Math.round(state.rotation / 90) * 90;
|
|
193
|
-
if (Math.abs(state.rotation - snapRotation) >= CARDINAL_ROTATION_EPSILON) return;
|
|
194
|
-
const bbox = getRotatedBBox(naturalWidth, naturalHeight, snapRotation);
|
|
195
|
-
if (bbox.width <= 0 || bbox.height <= 0) return;
|
|
196
|
-
return {
|
|
197
|
-
width: state.zoom / bbox.width,
|
|
198
|
-
height: state.zoom / bbox.height
|
|
199
|
-
};
|
|
200
|
-
}, [
|
|
201
|
-
displayScale,
|
|
202
|
-
aspectRatio,
|
|
203
|
-
naturalWidth,
|
|
204
|
-
naturalHeight,
|
|
205
|
-
state.rotation,
|
|
206
|
-
state.zoom
|
|
207
|
-
]);
|
|
208
|
-
const minCropSize = useMemo(() => {
|
|
209
|
-
if (naturalWidth <= 0 || naturalHeight <= 0) return;
|
|
210
|
-
const snapRotation = Math.round(state.rotation / 90) * 90;
|
|
211
|
-
const bbox = getRotatedBBox(naturalWidth, naturalHeight, snapRotation);
|
|
212
|
-
const minPixels = getMinCropPixels(displayScale);
|
|
213
|
-
return {
|
|
214
|
-
width: Math.min(1, minPixels * state.zoom / bbox.width),
|
|
215
|
-
height: Math.min(1, minPixels * state.zoom / bbox.height)
|
|
216
|
-
};
|
|
217
|
-
}, [
|
|
218
|
-
naturalWidth,
|
|
219
|
-
naturalHeight,
|
|
220
|
-
state.rotation,
|
|
221
|
-
state.zoom,
|
|
222
|
-
displayScale
|
|
223
|
-
]);
|
|
224
|
-
const snapCropRect = useCallback((rect, handle) => {
|
|
225
|
-
if (displayScale < PIXEL_SNAP_DISPLAY_SCALE || naturalWidth <= 0 || naturalHeight <= 0) return rect;
|
|
226
|
-
return snapCropRectToSourcePixels(state, {
|
|
227
|
-
width: naturalWidth,
|
|
228
|
-
height: naturalHeight
|
|
229
|
-
}, rect, handle);
|
|
230
|
-
}, [
|
|
231
|
-
displayScale,
|
|
232
|
-
naturalWidth,
|
|
233
|
-
naturalHeight,
|
|
234
|
-
state
|
|
235
|
-
]);
|
|
236
|
-
const wasPixelSnapEnabledRef = useRef(false);
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
const isPixelSnapEnabled = freeformCrop && (!aspectRatio || aspectRatio <= 0) && displayScale >= PIXEL_SNAP_DISPLAY_SCALE && naturalWidth > 0 && naturalHeight > 0;
|
|
239
|
-
const wasPixelSnapEnabled = wasPixelSnapEnabledRef.current;
|
|
240
|
-
wasPixelSnapEnabledRef.current = isPixelSnapEnabled;
|
|
241
|
-
if (!isPixelSnapEnabled || wasPixelSnapEnabled) return;
|
|
242
|
-
const snappedCropRect = snapCropRectToSourcePixelGrid(state, {
|
|
243
|
-
width: naturalWidth,
|
|
244
|
-
height: naturalHeight
|
|
245
|
-
}, state.cropRect);
|
|
246
|
-
const currentCropRect = state.cropRect;
|
|
247
|
-
if (Math.abs(currentCropRect.x - snappedCropRect.x) < CROP_RECT_EPSILON && Math.abs(currentCropRect.y - snappedCropRect.y) < CROP_RECT_EPSILON && Math.abs(currentCropRect.width - snappedCropRect.width) < CROP_RECT_EPSILON && Math.abs(currentCropRect.height - snappedCropRect.height) < CROP_RECT_EPSILON) return;
|
|
248
|
-
adjustCropRectForViewport(snappedCropRect);
|
|
249
|
-
}, [
|
|
250
|
-
adjustCropRectForViewport,
|
|
251
|
-
aspectRatio,
|
|
252
|
-
displayScale,
|
|
253
|
-
freeformCrop,
|
|
254
|
-
naturalWidth,
|
|
255
|
-
naturalHeight,
|
|
256
|
-
state
|
|
257
|
-
]);
|
|
258
|
-
const { handlers, onWheelNative, isDragging, isZooming, isPlacementActive: isInteractionPlacementActive } = useInteraction(state, controller, canvasSize, scaledVisualSize, {
|
|
259
|
-
minZoom: effectiveMinZoom,
|
|
260
|
-
maxZoom,
|
|
261
|
-
onGestureStart,
|
|
262
|
-
onGestureEnd,
|
|
263
|
-
disabled
|
|
264
|
-
});
|
|
265
|
-
const canvasHandlers = {
|
|
266
|
-
...handlers,
|
|
267
|
-
onPointerDownCapture: () => {
|
|
268
|
-
setIsFocusVisible(false);
|
|
269
|
-
},
|
|
270
|
-
onTouchStartCapture: (event) => {
|
|
271
|
-
if (event.touches.length > 1) setTouchPinching(true);
|
|
272
|
-
},
|
|
273
|
-
onTouchMoveCapture: (event) => {
|
|
274
|
-
if (event.touches.length > 1) setTouchPinching(true);
|
|
275
|
-
},
|
|
276
|
-
onTouchEndCapture: (event) => {
|
|
277
|
-
if (event.touches.length === 0) setTouchPinching(false);
|
|
278
|
-
},
|
|
279
|
-
onTouchCancelCapture: (event) => {
|
|
280
|
-
if (event.touches.length === 0) setTouchPinching(false);
|
|
281
|
-
},
|
|
282
|
-
onKeyDownCapture: (event) => {
|
|
283
|
-
if (![
|
|
284
|
-
"Shift",
|
|
285
|
-
"Control",
|
|
286
|
-
"Alt",
|
|
287
|
-
"Meta"
|
|
288
|
-
].includes(event.key)) setIsFocusVisible(true);
|
|
289
|
-
},
|
|
290
|
-
onPointerDown: (event) => {
|
|
291
|
-
if (disabled || isResizingRef.current || isTouchPinchingRef.current || event.pointerType === "touch" && event.isPrimary === false) {
|
|
292
|
-
event.preventDefault();
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
handlers.onPointerDown?.(event);
|
|
296
|
-
setIsFocusVisible(false);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
useEffect(() => {
|
|
300
|
-
const el = canvasRef.current;
|
|
301
|
-
if (!el) return;
|
|
302
|
-
const handleWheel = (event) => {
|
|
303
|
-
if (isResizingRef.current || isSettlingRef.current) {
|
|
304
|
-
event.preventDefault();
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
onWheelNative(event);
|
|
308
|
-
};
|
|
309
|
-
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
310
|
-
return () => {
|
|
311
|
-
el.removeEventListener("wheel", handleWheel);
|
|
312
|
-
};
|
|
313
|
-
}, [onWheelNative]);
|
|
314
|
-
const transformString = useTransformStyle(state, visualSize);
|
|
315
|
-
/**
|
|
316
|
-
* Handle the image load event.
|
|
317
|
-
*/
|
|
318
|
-
const handleImageLoad = useCallback((event) => {
|
|
319
|
-
const img = event.currentTarget;
|
|
320
|
-
const size = {
|
|
321
|
-
width: img.naturalWidth,
|
|
322
|
-
height: img.naturalHeight
|
|
323
|
-
};
|
|
324
|
-
setImage({
|
|
325
|
-
src,
|
|
326
|
-
naturalWidth: size.width,
|
|
327
|
-
naturalHeight: size.height
|
|
328
|
-
});
|
|
329
|
-
onImageLoaded?.(size);
|
|
330
|
-
}, [
|
|
331
|
-
src,
|
|
332
|
-
setImage,
|
|
333
|
-
onImageLoaded
|
|
334
|
-
]);
|
|
335
|
-
const handleCropChange = useCallback((rect) => {
|
|
336
|
-
if (isTouchPinchingRef.current) return;
|
|
337
|
-
setCropRect(rect);
|
|
338
|
-
if (isResizingRef.current && scaledVisualSize.width > 0 && scaledVisualSize.height > 0) {
|
|
339
|
-
const offsetX = (canvasSize.width - scaledVisualSize.width) / 2;
|
|
340
|
-
const offsetY = (canvasSize.height - scaledVisualSize.height) / 2;
|
|
341
|
-
const rightOverflow = Math.max(0, offsetX + (rect.x + rect.width) * scaledVisualSize.width - canvasSize.width);
|
|
342
|
-
const leftOverflow = Math.max(0, -(offsetX + rect.x * scaledVisualSize.width));
|
|
343
|
-
const bottomOverflow = Math.max(0, offsetY + (rect.y + rect.height) * scaledVisualSize.height - canvasSize.height);
|
|
344
|
-
const topOverflow = Math.max(0, -(offsetY + rect.y * scaledVisualSize.height));
|
|
345
|
-
setViewportPan({
|
|
346
|
-
x: -rightOverflow + leftOverflow,
|
|
347
|
-
y: -bottomOverflow + topOverflow
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}, [
|
|
351
|
-
setCropRect,
|
|
352
|
-
setViewportPan,
|
|
353
|
-
canvasSize,
|
|
354
|
-
scaledVisualSize
|
|
355
|
-
]);
|
|
356
|
-
const [settling, setSettling] = useState(false);
|
|
357
|
-
const settleTimerRef = useRef(void 0);
|
|
358
|
-
const finishSettling = useCallback(() => {
|
|
359
|
-
clearTimeout(settleTimerRef.current);
|
|
360
|
-
isSettlingRef.current = false;
|
|
361
|
-
setSettling(false);
|
|
362
|
-
}, []);
|
|
363
|
-
useEffect(() => {
|
|
364
|
-
return () => {
|
|
365
|
-
clearTimeout(settleTimerRef.current);
|
|
366
|
-
};
|
|
367
|
-
}, []);
|
|
368
|
-
const isInteractiveGrid = showGrid === "interactive";
|
|
369
|
-
const showInteractiveGrid = isInteractiveGrid && (isInteractionPlacementActive || isResizing || isPlacementActive);
|
|
370
|
-
const outputSize = useMemo(() => {
|
|
371
|
-
if (!showDimensions || !activeHandle || !state.image) return null;
|
|
372
|
-
const region = getSourceRegion(state, {
|
|
373
|
-
width: state.image.naturalWidth,
|
|
374
|
-
height: state.image.naturalHeight
|
|
375
|
-
});
|
|
376
|
-
return {
|
|
377
|
-
width: region.width,
|
|
378
|
-
height: region.height
|
|
379
|
-
};
|
|
380
|
-
}, [
|
|
381
|
-
showDimensions,
|
|
382
|
-
activeHandle,
|
|
383
|
-
state
|
|
384
|
-
]);
|
|
385
|
-
/**
|
|
386
|
-
* Handle Escape on a resize handle — return focus to the canvas so
|
|
387
|
-
* arrow keys pan the image rather than resize.
|
|
388
|
-
*/
|
|
389
|
-
const handleEscape = useCallback(() => {
|
|
390
|
-
setIsFocusVisible(true);
|
|
391
|
-
canvasRef.current?.focus({ preventScroll: true });
|
|
392
|
-
}, []);
|
|
393
|
-
const handleResizeStart = useCallback((handle) => {
|
|
394
|
-
if (isTouchPinchingRef.current) return;
|
|
395
|
-
setFrozenViewScale(viewScaleRest);
|
|
396
|
-
isResizingRef.current = true;
|
|
397
|
-
setIsResizing(true);
|
|
398
|
-
setActiveHandle(handle ?? null);
|
|
399
|
-
finishSettling();
|
|
400
|
-
resetViewport();
|
|
401
|
-
onGestureStart?.();
|
|
402
|
-
}, [
|
|
403
|
-
finishSettling,
|
|
404
|
-
onGestureStart,
|
|
405
|
-
resetViewport,
|
|
406
|
-
viewScaleRest
|
|
407
|
-
]);
|
|
408
|
-
/**
|
|
409
|
-
* Handle resize end — settle the crop rect (re-center, fill height)
|
|
410
|
-
* and reset the viewport pan back to neutral.
|
|
411
|
-
*/
|
|
412
|
-
const handleResizeEnd = useCallback(() => {
|
|
413
|
-
const isCancellingForPinch = isTouchPinchingRef.current;
|
|
414
|
-
isResizingRef.current = false;
|
|
415
|
-
setIsResizing(false);
|
|
416
|
-
setActiveHandle(null);
|
|
417
|
-
clearTimeout(settleTimerRef.current);
|
|
418
|
-
if (isCancellingForPinch) {
|
|
419
|
-
finishSettling();
|
|
420
|
-
resetViewport();
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
isSettlingRef.current = true;
|
|
424
|
-
setSettling(true);
|
|
425
|
-
resetViewport();
|
|
426
|
-
settleCrop();
|
|
427
|
-
onGestureEnd?.();
|
|
428
|
-
settleTimerRef.current = setTimeout(finishSettling, SETTLE_TRANSITION_FALLBACK_MS);
|
|
429
|
-
}, [
|
|
430
|
-
finishSettling,
|
|
431
|
-
settleCrop,
|
|
432
|
-
onGestureEnd,
|
|
433
|
-
resetViewport
|
|
434
|
-
]);
|
|
435
|
-
/**
|
|
436
|
-
* Finish settling when the settle transform transition actually completes.
|
|
437
|
-
* The handler lives on the stage, but in the common (un-panned) case the
|
|
438
|
-
* transform transition runs on the image layer and its `transitionend`
|
|
439
|
-
* bubbles up to here. Other transitionend events (stencil left/top/width/
|
|
440
|
-
* height) also bubble up, so only the transform transition should clear the
|
|
441
|
-
* settle state.
|
|
442
|
-
*/
|
|
443
|
-
const handleSettleTransitionEnd = useCallback((event) => {
|
|
444
|
-
if (!isSettlingRef.current || event.propertyName !== "transform") return;
|
|
445
|
-
finishSettling();
|
|
446
|
-
}, [finishSettling]);
|
|
447
|
-
let imageTransition;
|
|
448
|
-
if (settling) imageTransition = SETTLE_TRANSFORM_TRANSITION;
|
|
449
|
-
else if (isZooming) imageTransition = "transform 150ms linear";
|
|
450
|
-
const settleStencilTransition = settling ? SETTLE_STENCIL_TRANSITION : void 0;
|
|
451
|
-
const imageStyle = useMemo(() => {
|
|
452
|
-
if (elementSize.width === 0 || elementSize.height === 0) return {};
|
|
453
|
-
const centerX = (canvasSize.width - elementSize.width) / 2;
|
|
454
|
-
const centerY = (canvasSize.height - elementSize.height) / 2;
|
|
455
|
-
return {
|
|
456
|
-
width: elementSize.width,
|
|
457
|
-
height: elementSize.height,
|
|
458
|
-
maxWidth: elementSize.width,
|
|
459
|
-
maxHeight: elementSize.height,
|
|
460
|
-
left: centerX,
|
|
461
|
-
top: centerY,
|
|
462
|
-
transform: `scale(${viewScale}) ${transformString}`,
|
|
463
|
-
transition: imageTransition,
|
|
464
|
-
imageRendering: displayScale > 1 ? "pixelated" : void 0
|
|
465
|
-
};
|
|
466
|
-
}, [
|
|
467
|
-
canvasSize,
|
|
468
|
-
elementSize,
|
|
469
|
-
transformString,
|
|
470
|
-
imageTransition,
|
|
471
|
-
displayScale,
|
|
472
|
-
viewScale
|
|
473
|
-
]);
|
|
474
|
-
const settleTransition = settling ? SETTLE_TRANSFORM_TRANSITION : void 0;
|
|
475
|
-
const willChange = isResizing || settling ? "transform" : void 0;
|
|
476
|
-
let stageStyle;
|
|
477
|
-
if (viewportState.pan.x !== 0 || viewportState.pan.y !== 0) stageStyle = {
|
|
478
|
-
transform: `translate(${viewportState.pan.x}px, ${viewportState.pan.y}px)`,
|
|
479
|
-
transition: settleTransition,
|
|
480
|
-
willChange
|
|
481
|
-
};
|
|
482
|
-
else if (settling) stageStyle = {
|
|
483
|
-
transform: "translate(0px, 0px)",
|
|
484
|
-
transition: settleTransition,
|
|
485
|
-
willChange
|
|
486
|
-
};
|
|
487
|
-
return /* @__PURE__ */ jsx("div", {
|
|
488
|
-
ref,
|
|
489
|
-
className: clsx("wp-media-editor-image-editor", isDragging && "wp-media-editor-image-editor--dragging", className),
|
|
490
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
491
|
-
ref: canvasRef,
|
|
492
|
-
className: clsx("wp-media-editor-image-editor__canvas", isInteractiveGrid && "wp-media-editor-image-editor__canvas--grid-interactive", showInteractiveGrid && "wp-media-editor-image-editor__canvas--show-grid", settling && "wp-media-editor-image-editor__canvas--settling", isFocusVisible && "wp-media-editor-image-editor__canvas--focus-visible"),
|
|
493
|
-
tabIndex: 0,
|
|
494
|
-
role: "group",
|
|
495
|
-
"aria-label": __("Crop area"),
|
|
496
|
-
"aria-describedby": isCropAreaFocused ? cropAreaDescriptionId : void 0,
|
|
497
|
-
onFocus: handleCropAreaFocus,
|
|
498
|
-
onBlur: handleCropAreaBlur,
|
|
499
|
-
...canvasHandlers,
|
|
500
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
501
|
-
id: cropAreaDescriptionId,
|
|
502
|
-
style: VISUALLY_HIDDEN_STYLE,
|
|
503
|
-
children: __("When this area is focused, use arrow keys to move the image and plus or minus to zoom. Tab to resize handles and controls.")
|
|
504
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
505
|
-
className: "wp-media-editor-image-editor__stage",
|
|
506
|
-
"data-testid": "cropper-stage",
|
|
507
|
-
style: stageStyle,
|
|
508
|
-
onTransitionEnd: handleSettleTransitionEnd,
|
|
509
|
-
children: [
|
|
510
|
-
/* @__PURE__ */ jsx("img", {
|
|
511
|
-
className: "wp-media-editor-image-editor__image",
|
|
512
|
-
"data-testid": "cropper-image",
|
|
513
|
-
src,
|
|
514
|
-
alt: "",
|
|
515
|
-
onLoad: handleImageLoad,
|
|
516
|
-
onError: onImageError,
|
|
517
|
-
style: imageStyle,
|
|
518
|
-
draggable: false
|
|
519
|
-
}),
|
|
520
|
-
showDimming && /* @__PURE__ */ jsx(DimmingOverlay, {
|
|
521
|
-
cropRect: state.cropRect,
|
|
522
|
-
containerSize: canvasSize,
|
|
523
|
-
imageSize: scaledVisualSize,
|
|
524
|
-
transition: settleStencilTransition
|
|
525
|
-
}),
|
|
526
|
-
/* @__PURE__ */ jsx(StencilComponent, {
|
|
527
|
-
cropRect: state.cropRect,
|
|
528
|
-
containerSize: canvasSize,
|
|
529
|
-
imageSize: scaledVisualSize,
|
|
530
|
-
onCropChange: handleCropChange,
|
|
531
|
-
onResizeStart: handleResizeStart,
|
|
532
|
-
onResizeEnd: handleResizeEnd,
|
|
533
|
-
onEscape: handleEscape,
|
|
534
|
-
aspectRatio,
|
|
535
|
-
freeformCrop,
|
|
536
|
-
isResizeDisabled: isTouchPinching || disabled,
|
|
537
|
-
stencilTransition: settleStencilTransition,
|
|
538
|
-
cropBounds,
|
|
539
|
-
minCropSize,
|
|
540
|
-
snapCropRect,
|
|
541
|
-
keyboardResizeStep
|
|
542
|
-
}),
|
|
543
|
-
(showGrid === true || isInteractiveGrid) && /* @__PURE__ */ jsx(GridOverlay, {
|
|
544
|
-
cropRect: state.cropRect,
|
|
545
|
-
containerSize: canvasSize,
|
|
546
|
-
imageSize: scaledVisualSize
|
|
547
|
-
}),
|
|
548
|
-
activeHandle && outputSize && /* @__PURE__ */ jsx(DimensionsOverlay, {
|
|
549
|
-
cropRect: state.cropRect,
|
|
550
|
-
containerSize: canvasSize,
|
|
551
|
-
imageSize: scaledVisualSize,
|
|
552
|
-
activeHandle,
|
|
553
|
-
outputWidth: outputSize.width,
|
|
554
|
-
outputHeight: outputSize.height
|
|
555
|
-
})
|
|
556
|
-
]
|
|
557
|
-
})]
|
|
558
|
-
})
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
const CropperInnerWithRef = forwardRef(CropperInner);
|
|
562
|
-
const Cropper = forwardRef((props, ref) => /* @__PURE__ */ jsx(ViewportProvider, { children: /* @__PURE__ */ jsx(CropperInnerWithRef, {
|
|
563
|
-
...props,
|
|
564
|
-
ref
|
|
565
|
-
}) }));
|
|
566
|
-
export { Cropper };
|
|
567
|
-
|
|
568
|
-
//# sourceMappingURL=cropper.mjs.map
|