@wordpress/media-editor 0.22.0 → 0.24.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 +34 -0
- package/build/components/media-editor/index.cjs +229 -126
- 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 +41 -11
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -1
- package/build/components/media-editor-canvas/index.cjs +15 -18
- package/build/components/media-editor-canvas/index.cjs.map +1 -1
- package/build/components/media-editor-crop-panel/index.cjs +26 -8
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -1
- package/build/components/media-editor-fine-rotation/index.cjs +13 -12
- 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 +33 -33
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -1
- package/build/components/media-editor-modal/index.cjs +10 -7
- package/build/components/media-editor-modal/index.cjs.map +1 -1
- package/build/components/media-editor-panel/error-boundary.cjs +68 -0
- package/build/components/media-editor-panel/error-boundary.cjs.map +1 -0
- package/build/components/media-editor-panel/index.cjs +158 -0
- package/build/components/media-editor-panel/index.cjs.map +1 -0
- 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 +143 -37
- package/build/components/media-preview/index.cjs.map +1 -1
- package/build/components/rotation-ruler/index.cjs +9 -7
- package/build/components/rotation-ruler/index.cjs.map +1 -1
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -1
- package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -1
- package/build/index.cjs +10 -8
- package/build/private-apis.cjs.map +1 -1
- package/build/state/aspect-ratio-presets.cjs +12 -6
- package/build/state/aspect-ratio-presets.cjs.map +1 -1
- package/build/state/composite-reducer.cjs +41 -74
- 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/store/index.cjs +11 -9
- package/build/store/index.cjs.map +1 -1
- package/build/utils/get-media-type.cjs +8 -0
- package/build/utils/get-media-type.cjs.map +1 -1
- package/build/utils/index.cjs +6 -0
- package/build-module/components/media-editor/index.mjs +217 -117
- 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 +32 -4
- 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 +33 -33
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -1
- package/build-module/components/media-editor-modal/index.mjs +1 -0
- package/build-module/components/media-editor-modal/index.mjs.map +1 -1
- package/build-module/components/media-editor-panel/error-boundary.mjs +63 -0
- package/build-module/components/media-editor-panel/error-boundary.mjs.map +1 -0
- package/build-module/components/media-editor-panel/index.mjs +123 -0
- package/build-module/components/media-editor-panel/index.mjs.map +1 -0
- 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 +123 -41
- package/build-module/components/media-preview/index.mjs.map +1 -1
- package/build-module/state/aspect-ratio-presets.mjs +12 -7
- 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-module/utils/get-media-type.mjs +8 -1
- package/build-module/utils/get-media-type.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-style/style-rtl.css +122 -87
- package/build-style/style.css +121 -87
- package/build-types/components/media-editor/index.d.ts +25 -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-editor-panel/error-boundary.d.ts +23 -0
- package/build-types/components/media-editor-panel/error-boundary.d.ts.map +1 -0
- package/build-types/components/media-editor-panel/index.d.ts +46 -0
- package/build-types/components/media-editor-panel/index.d.ts.map +1 -0
- 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 +40 -54
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/build-types/utils/get-media-type.d.ts +3 -1
- package/build-types/utils/get-media-type.d.ts.map +1 -1
- package/build-types/utils/index.d.ts +1 -1
- package/build-types/utils/index.d.ts.map +1 -1
- package/package.json +27 -24
- package/src/components/media-editor/index.tsx +372 -142
- package/src/components/media-editor/style.scss +21 -1
- 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 +56 -63
- package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +1 -1
- package/src/components/media-editor-modal/index.tsx +4 -1
- package/src/components/media-editor-panel/error-boundary.tsx +88 -0
- package/src/components/media-editor-panel/index.tsx +211 -0
- package/src/components/media-form/index.tsx +7 -1
- package/src/components/media-preview/index.tsx +195 -37
- package/src/components/media-preview/style.scss +11 -32
- package/src/components/rotation-ruler/style.scss +3 -3
- package/src/state/README.md +34 -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 +162 -242
- package/src/style.scss +2 -1
- package/src/utils/get-media-type.ts +9 -1
- package/src/utils/index.ts +1 -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":"cropper-provider.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,iCAAiC,CAAC;AACzC,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,54 +0,0 @@
|
|
|
1
|
-
import type { StencilProps, Size } from '../../core/types';
|
|
2
|
-
import type { CropperController } from '../hooks/use-cropper-controller';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the Cropper component.
|
|
5
|
-
*/
|
|
6
|
-
export interface CropperProps {
|
|
7
|
-
/** Image source URL. */
|
|
8
|
-
src: string;
|
|
9
|
-
/** The cropper controller from `useCropperController` 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
|
-
/** Callback fired when the image fails to load. */
|
|
45
|
-
onImageError?: () => void;
|
|
46
|
-
/** Fires when a continuous gesture begins (pan drag, handle resize, pinch zoom). */
|
|
47
|
-
onGestureStart?: () => void;
|
|
48
|
-
/** Fires when a continuous gesture ends (pointerup, resize settle). */
|
|
49
|
-
onGestureEnd?: () => void;
|
|
50
|
-
/** Additional className for the container. */
|
|
51
|
-
className?: string;
|
|
52
|
-
}
|
|
53
|
-
export declare const Cropper: import("react").ForwardRefExoticComponent<CropperProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
54
|
-
//# 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":"AAaA,OAAO,KAAK,EAEX,YAAY,EACZ,IAAI,EAEJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA2CzE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,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,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,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;AA89BD,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 `useCropperController` 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
|
-
* - `useCropperController` 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 { useCropperController } from './use-cropper-controller';
|
|
2
|
-
export type { CropperController } from './use-cropper-controller';
|
|
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,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-aria-announcer.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-aria-announcer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgJrD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,YAAY,GAAI,IAAI,CAkC5D"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { CropperState, NormalizedRect, Size } from '../../core/types';
|
|
2
|
-
import { type CropperSetters } from './build-cropper-setters';
|
|
3
|
-
/**
|
|
4
|
-
* The cropper controller surface — the contract the Cropper component
|
|
5
|
-
* and its interaction hooks consume.
|
|
6
|
-
*
|
|
7
|
-
* History (undo / redo / commitHistory) is intentionally NOT part of
|
|
8
|
-
* this interface. The cropper is a pure state machine; history is a
|
|
9
|
-
* higher-layer concern owned by a composite store
|
|
10
|
-
* (see media-editor/src/state).
|
|
11
|
-
*/
|
|
12
|
-
export interface CropperController extends CropperSetters {
|
|
13
|
-
/** The current cropper state (read-only). */
|
|
14
|
-
state: CropperState;
|
|
15
|
-
/** Set the loaded image (natural size and src). */
|
|
16
|
-
setImage: (image: CropperState['image']) => void;
|
|
17
|
-
/** Reset the state. Optionally merge partial state overrides. */
|
|
18
|
-
reset: (resetState?: Partial<CropperState>) => void;
|
|
19
|
-
/** Whether the current state differs from the initial state. */
|
|
20
|
-
isDirty: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Export the cropped image as a Blob. Throws on failure — see
|
|
23
|
-
* `exportCroppedImage` for error semantics.
|
|
24
|
-
*/
|
|
25
|
-
getCroppedImage: (mimeType?: string, quality?: number) => Promise<Blob>;
|
|
26
|
-
/**
|
|
27
|
-
* Called by `Cropper` whenever its rendered image size changes; not for
|
|
28
|
-
* consumers to call. A composite controller uses the size to reshape the
|
|
29
|
-
* crop for an aspect ratio. The pure cropper hook ignores it.
|
|
30
|
-
*/
|
|
31
|
-
setVisualSize: (size: Size) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Called by `Cropper` when the viewport changes (window or canvas
|
|
34
|
-
* resize); not for consumers to call. Like `setCropRect`, except that a
|
|
35
|
-
* composite controller records no undo entry for it, since a viewport
|
|
36
|
-
* reshape is not an editor action. The pure cropper hook aliases it to
|
|
37
|
-
* `setCropRect`.
|
|
38
|
-
*/
|
|
39
|
-
adjustCropRectForViewport: (rect: NormalizedRect) => void;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Controller hook for the image cropper: the state, the named setters and
|
|
43
|
-
* the export helpers, without history.
|
|
44
|
-
*
|
|
45
|
-
* Wraps the framework-agnostic `cropperReducer` and exposes named
|
|
46
|
-
* setters (built from the shared `buildCropperSetters` factory).
|
|
47
|
-
* Does NOT manage undo/redo history — that responsibility belongs to
|
|
48
|
-
* the surrounding application (see `useMediaEditorState` for the
|
|
49
|
-
* composite store used by the media editor).
|
|
50
|
-
*
|
|
51
|
-
* @param initialState Optional partial state to merge with DEFAULT_STATE.
|
|
52
|
-
* @return The cropper controller — state, setters, and helpers.
|
|
53
|
-
*/
|
|
54
|
-
export declare function useCropperController(initialState?: Partial<CropperState>): CropperController;
|
|
55
|
-
//# sourceMappingURL=use-cropper-controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-cropper-controller.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-cropper-controller.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACX,YAAY,EAEZ,cAAc,EACd,IAAI,EACJ,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAEN,KAAK,cAAc,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACxD,6CAA6C;IAC7C,KAAK,EAAE,YAAY,CAAC;IACpB,mDAAmD;IACnD,QAAQ,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,OAAO,CAAE,KAAM,IAAI,CAAC;IACrD,iEAAiE;IACjE,KAAK,EAAE,CAAE,UAAU,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,KAAM,IAAI,CAAC;IACxD,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,eAAe,EAAE,CAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAM,OAAO,CAAE,IAAI,CAAE,CAAC;IAC5E;;;;OAIG;IACH,aAAa,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACtC;;;;;;OAMG;IACH,yBAAyB,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;CAC5D;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,GACpC,iBAAiB,CA0GnB"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { CropperState, Size } from '../../core/types';
|
|
2
|
-
import { type CropperInteractionActions } from '../../core/interaction-controller';
|
|
3
|
-
/**
|
|
4
|
-
* The return type of the useInteraction hook.
|
|
5
|
-
*/
|
|
6
|
-
export interface UseInteractionReturn {
|
|
7
|
-
/** Event handler props to spread on the container element. */
|
|
8
|
-
handlers: {
|
|
9
|
-
onPointerDown: (e: React.PointerEvent) => void;
|
|
10
|
-
onTouchStart: (e: React.TouchEvent) => void;
|
|
11
|
-
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
12
|
-
};
|
|
13
|
-
/** Native wheel handler — must be registered with { passive: false }. */
|
|
14
|
-
onWheelNative: (e: WheelEvent) => void;
|
|
15
|
-
/** Whether a drag (pan) interaction is in progress. */
|
|
16
|
-
isDragging: boolean;
|
|
17
|
-
/** Whether a double-tap zoom animation is in progress. */
|
|
18
|
-
isZooming: boolean;
|
|
19
|
-
/** Whether the user is currently performing a placement interaction. */
|
|
20
|
-
isPlacementActive: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Options for the useInteraction hook.
|
|
24
|
-
*/
|
|
25
|
-
export interface UseInteractionOptions {
|
|
26
|
-
/** Minimum zoom level. Defaults to MIN_ZOOM. */
|
|
27
|
-
minZoom?: number;
|
|
28
|
-
/** Maximum zoom level. Defaults to MAX_ZOOM. */
|
|
29
|
-
maxZoom?: number;
|
|
30
|
-
/** Zoom speed multiplier for wheel events. Defaults to 0.0025. */
|
|
31
|
-
zoomSpeed?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Pan step size in normalized coords for keyboard events.
|
|
34
|
-
* Defaults to 0.01. Shift multiplies it by 10.
|
|
35
|
-
*/
|
|
36
|
-
keyboardStep?: number;
|
|
37
|
-
/** Zoom level for double-tap zoom. Defaults to 2. */
|
|
38
|
-
doubleTapZoom?: number;
|
|
39
|
-
/** Fires when a continuous gesture begins (pan drag, pinch zoom). */
|
|
40
|
-
onGestureStart?: () => void;
|
|
41
|
-
/** Fires when a continuous gesture ends (pointer release). */
|
|
42
|
-
onGestureEnd?: () => void;
|
|
43
|
-
/**
|
|
44
|
-
* Ignore all interaction. Any gesture already in flight is torn down,
|
|
45
|
-
* so a drag started before this flipped cannot keep moving the image.
|
|
46
|
-
*/
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Mouse, touch, and keyboard event handling for pan, zoom,
|
|
51
|
-
* and crop manipulation.
|
|
52
|
-
*
|
|
53
|
-
* Returns event handler props to spread on the container element.
|
|
54
|
-
* Uses requestAnimationFrame for drag/pinch updates to avoid
|
|
55
|
-
* layout thrashing.
|
|
56
|
-
*
|
|
57
|
-
* @param state The current cropper state.
|
|
58
|
-
* @param actions Named state updates for cropper interactions.
|
|
59
|
-
* @param containerSize The container dimensions in pixels.
|
|
60
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
61
|
-
* @param options Optional configuration for zoom and keyboard behavior.
|
|
62
|
-
* @return Event handler props for the container element.
|
|
63
|
-
*/
|
|
64
|
-
export declare function useInteraction(state: CropperState, actions: CropperInteractionActions, containerSize: Size, imageSize?: Size, options?: UseInteractionOptions): UseInteractionReturn;
|
|
65
|
-
//# sourceMappingURL=use-interaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-interaction.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-interaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8DAA8D;IAC9D,QAAQ,EAAE;QACT,aAAa,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAM,IAAI,CAAC;QACjD,YAAY,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC;QAC9C,SAAS,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,aAAa,KAAM,IAAI,CAAC;KAC9C,CAAC;IACF,yEAAyE;IACzE,aAAa,EAAE,CAAE,CAAC,EAAE,UAAU,KAAM,IAAI,CAAC;IACzC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AA6BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,yBAAyB,EAClC,aAAa,EAAE,IAAI,EACnB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,oBAAoB,CA8LtB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CropperState, Size } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* React hook that computes a memoized CSS matrix() transform string
|
|
4
|
-
* from the cropper state.
|
|
5
|
-
*
|
|
6
|
-
* Delegates to the pure `computeTransformStyle` function in core.
|
|
7
|
-
*
|
|
8
|
-
* @param state The current cropper state.
|
|
9
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
10
|
-
* @return A CSS transform string.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useTransformStyle(state: CropperState, imageSize: Size): string;
|
|
13
|
-
//# sourceMappingURL=use-transform-style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-transform-style.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-transform-style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG3D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,MAAM,CAKR"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ViewportState } from '../../core/types';
|
|
2
|
-
export interface UseViewportStateReturn {
|
|
3
|
-
viewport: ViewportState;
|
|
4
|
-
/**
|
|
5
|
-
* Unused in the current Cropper implementation — scaffolded for the
|
|
6
|
-
* upcoming navigator panel (viewport zoom slider).
|
|
7
|
-
*/
|
|
8
|
-
setViewportZoom: (zoom: number) => void;
|
|
9
|
-
setViewportPan: (pan: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
}) => void;
|
|
13
|
-
resetViewport: () => void;
|
|
14
|
-
}
|
|
15
|
-
export declare function useViewportState(): UseViewportStateReturn;
|
|
16
|
-
//# sourceMappingURL=use-viewport-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-viewport-state.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-viewport-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMtD,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,eAAe,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAC1C,cAAc,EAAE,CAAE,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAM,IAAI,CAAC;IAC1D,aAAa,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsBzD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visually-hidden-style.d.ts","sourceRoot":"","sources":["../../../src/image-editor/react/visually-hidden-style.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,aAUzC,CAAC"}
|