@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,94 +0,0 @@
|
|
|
1
|
-
import type { CropperState, HandlePosition, NormalizedRect, Size } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* The selected image region in source-pixel coordinates.
|
|
4
|
-
*/
|
|
5
|
-
export interface SourceRegion {
|
|
6
|
-
/** X offset in source pixels. */
|
|
7
|
-
x: number;
|
|
8
|
-
/** Y offset in source pixels. */
|
|
9
|
-
y: number;
|
|
10
|
-
/** Width in source pixels. */
|
|
11
|
-
width: number;
|
|
12
|
-
/** Height in source pixels. */
|
|
13
|
-
height: number;
|
|
14
|
-
/** Rotation in degrees (0-360). */
|
|
15
|
-
rotation: number;
|
|
16
|
-
/** Flip state. */
|
|
17
|
-
flip: {
|
|
18
|
-
horizontal: boolean;
|
|
19
|
-
vertical: boolean;
|
|
20
|
-
};
|
|
21
|
-
/** Zoom factor applied. */
|
|
22
|
-
zoom: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get the selected image region in source-pixel coordinates.
|
|
26
|
-
*
|
|
27
|
-
* Converts the current crop state (normalized visual space) to the actual
|
|
28
|
-
* region of the original image that's selected. This is the bridge between
|
|
29
|
-
* the cropper's internal coordinate system and external tools (image
|
|
30
|
-
* processing libraries, AI APIs, server-side processing) that work in
|
|
31
|
-
* source-pixel coordinates.
|
|
32
|
-
*
|
|
33
|
-
* The returned rectangle accounts for pan, zoom, and the crop rect position,
|
|
34
|
-
* but expresses the crop in the unrotated image's coordinate space. Rotation
|
|
35
|
-
* and flip are included as separate fields since they represent transforms,
|
|
36
|
-
* not a region.
|
|
37
|
-
*
|
|
38
|
-
* @param state The current cropper state.
|
|
39
|
-
* @param imageSize The natural dimensions of the source image.
|
|
40
|
-
* @return The selected region in source pixels plus rotation/flip metadata.
|
|
41
|
-
*/
|
|
42
|
-
export declare function getSourceRegion(state: CropperState, imageSize: Size): SourceRegion;
|
|
43
|
-
/**
|
|
44
|
-
* Snap a crop rect so the selected source-region edges land on whole pixels.
|
|
45
|
-
*
|
|
46
|
-
* This is a display-time affordance for visible pixel grids; it does not alter
|
|
47
|
-
* pan/zoom/rotation. Callers decide when snapping is appropriate.
|
|
48
|
-
*
|
|
49
|
-
* @param state The current cropper state.
|
|
50
|
-
* @param imageSize The natural dimensions of the source image.
|
|
51
|
-
* @param cropRect The candidate crop rect from resize math.
|
|
52
|
-
* @param handle The active resize handle. Only edges moved by the handle snap.
|
|
53
|
-
* @return A crop rect whose selected source-region edges are whole pixels.
|
|
54
|
-
*/
|
|
55
|
-
export declare function snapCropRectToSourcePixels(state: CropperState, imageSize: Size, cropRect: NormalizedRect, handle: HandlePosition): NormalizedRect;
|
|
56
|
-
/**
|
|
57
|
-
* Snap all source-region edges for a crop rect to the nearest whole pixels.
|
|
58
|
-
*
|
|
59
|
-
* @param state The current cropper state.
|
|
60
|
-
* @param imageSize The natural dimensions of the source image.
|
|
61
|
-
* @param cropRect The crop rect to align to the source-pixel grid.
|
|
62
|
-
* @return A crop rect whose source-region edges are whole pixels.
|
|
63
|
-
*/
|
|
64
|
-
export declare function snapCropRectToSourcePixelGrid(state: CropperState, imageSize: Size, cropRect: NormalizedRect): NormalizedRect;
|
|
65
|
-
/**
|
|
66
|
-
* The selected crop region expressed as percentages of the source image.
|
|
67
|
-
*/
|
|
68
|
-
export interface SourceRegionPercent {
|
|
69
|
-
/** X offset as a percentage (0–100) of the source image width. */
|
|
70
|
-
x: number;
|
|
71
|
-
/** Y offset as a percentage (0–100) of the source image height. */
|
|
72
|
-
y: number;
|
|
73
|
-
/** Width as a percentage (0–100) of the source image width. */
|
|
74
|
-
width: number;
|
|
75
|
-
/** Height as a percentage (0–100) of the source image height. */
|
|
76
|
-
height: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the selected image region as percentages of the source image dimensions.
|
|
80
|
-
*
|
|
81
|
-
* Returns `{ x, y, width, height }` where each value is a percentage (0–100)
|
|
82
|
-
* of the source image's natural width or height. This format is compatible
|
|
83
|
-
* with the WordPress REST API attachments `/edit` endpoint and CSS-based
|
|
84
|
-
* crop workflows.
|
|
85
|
-
*
|
|
86
|
-
* Internally delegates to `getSourceRegion` and divides by the image
|
|
87
|
-
* dimensions, so accuracy is identical.
|
|
88
|
-
*
|
|
89
|
-
* @param state The current cropper state.
|
|
90
|
-
* @param imageSize The natural dimensions of the source image.
|
|
91
|
-
* @return The crop region as percentages (0–100).
|
|
92
|
-
*/
|
|
93
|
-
export declare function getSourceRegionPercent(state: CropperState, imageSize: Size): SourceRegionPercent;
|
|
94
|
-
//# sourceMappingURL=source-region.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-region.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/source-region.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,IAAI,EACJ,MAAM,SAAS,CAAC;AAKjB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,IAAI,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,YAAY,CA0Ed;AAgGD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,EACf,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,cAAc,GACpB,cAAc,CAYhB;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,EACf,QAAQ,EAAE,cAAc,GACtB,cAAc,CAOhB;AAmDD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,kEAAkE;IAClE,CAAC,EAAE,MAAM,CAAC;IACV,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,mBAAmB,CAWrB"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { CropperAction, CropperState } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Value-equality check for two cropper states.
|
|
4
|
-
*
|
|
5
|
-
* Used by history machinery to dedup snapshots and detect no-op
|
|
6
|
-
* transitions. Compares every field that participates in the rendered
|
|
7
|
-
* output; ignores reference identity.
|
|
8
|
-
*
|
|
9
|
-
* @param a First cropper state.
|
|
10
|
-
* @param b Second cropper state.
|
|
11
|
-
* @return Whether the two states are value-equal across all tracked fields.
|
|
12
|
-
*/
|
|
13
|
-
export declare function areCropperStatesEqual(a: CropperState, b: CropperState): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Enforces containment: restricts the crop rect to fit within the
|
|
16
|
-
* rotated image, computes minimum zoom, clamps zoom, and restricts
|
|
17
|
-
* the pan position so the image always covers the crop area.
|
|
18
|
-
* Called after every relevant state transition.
|
|
19
|
-
*
|
|
20
|
-
* @param state The state to enforce containment on.
|
|
21
|
-
* @return The state with cropRect, zoom, and position restricted.
|
|
22
|
-
*/
|
|
23
|
-
export declare function enforceContainment(state: CropperState): CropperState;
|
|
24
|
-
/**
|
|
25
|
-
* Reducer function for cropper state management.
|
|
26
|
-
*
|
|
27
|
-
* Every state transition that could invalidate the containment invariant
|
|
28
|
-
* (crop, zoom, rotation, cropRect, flip) is followed by enforceContainment
|
|
29
|
-
* to ensure the image always covers the crop area.
|
|
30
|
-
*
|
|
31
|
-
* Committing actions (everything except SET_ROTATION) also call
|
|
32
|
-
* `commitBase` to snapshot the post-containment state as the new
|
|
33
|
-
* base pose. SET_ROTATION derives from that base without mutating
|
|
34
|
-
* it, which prevents accumulated-clamp drift during continuous fine
|
|
35
|
-
* rotation.
|
|
36
|
-
*
|
|
37
|
-
* @param state The current cropper state.
|
|
38
|
-
* @param action The action to process.
|
|
39
|
-
* @return The new cropper state.
|
|
40
|
-
*/
|
|
41
|
-
export declare function cropperReducer(state: CropperState, action: CropperAction): CropperState;
|
|
42
|
-
/**
|
|
43
|
-
* Shallow comparison of key cropper state fields to determine if
|
|
44
|
-
* the state has been modified from an initial snapshot.
|
|
45
|
-
*
|
|
46
|
-
* @param current The current cropper state.
|
|
47
|
-
* @param initial The initial cropper state snapshot.
|
|
48
|
-
* @return True if any tracked field differs.
|
|
49
|
-
*/
|
|
50
|
-
export declare function isStateDirty(current: CropperState, initial: CropperState): boolean;
|
|
51
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAiB/E;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,CAAC,EAAE,YAAY,EACf,CAAC,EAAE,YAAY,GACb,OAAO,CAkBT;AA6DD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAE,KAAK,EAAE,YAAY,GAAI,YAAY,CAgDtE;AAgCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,aAAa,GACnB,YAAY,CA8Od;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACnB,OAAO,CAaT"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { HandlePosition, NormalizedRect, Size } from './types';
|
|
2
|
-
export type { HandlePosition };
|
|
3
|
-
/** Axis whose resize distance controls the locked-ratio size projection. */
|
|
4
|
-
export type ResizeDriverAxis = 'width' | 'height';
|
|
5
|
-
/**
|
|
6
|
-
* Resolve the minimum crop dimension, in source-image pixels, for the current
|
|
7
|
-
* display scale.
|
|
8
|
-
*
|
|
9
|
-
* Two floors compete: a fixed source-pixel floor (`MIN_CROP_PIXELS`) that
|
|
10
|
-
* avoids sub-pixel crops, and an on-screen floor (`MIN_CROP_SCREEN_PX`) that
|
|
11
|
-
* keeps the crop large enough to grab. The on-screen floor converted to source
|
|
12
|
-
* pixels is `MIN_CROP_SCREEN_PX / displayScale`; the binding constraint is the
|
|
13
|
-
* larger of the two. When the image is shown small (small `displayScale`) the
|
|
14
|
-
* on-screen floor dominates; once it is shown large enough the source-pixel
|
|
15
|
-
* floor takes over.
|
|
16
|
-
*
|
|
17
|
-
* @param displayScale CSS pixels rendered per source pixel
|
|
18
|
-
* (fit scale × zoom × view scale).
|
|
19
|
-
* @return Minimum crop dimension in source-image pixels.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getMinCropPixels(displayScale: number): number;
|
|
22
|
-
/**
|
|
23
|
-
* Default minimum crop rect dimension in normalized space, used when no
|
|
24
|
-
* explicit per-axis minimum is supplied (e.g. before the source image
|
|
25
|
-
* has loaded). Real usage derives a pixel-based min from the source
|
|
26
|
-
* image dimensions and `MIN_CROP_PIXELS` in `constants.ts`.
|
|
27
|
-
*/
|
|
28
|
-
export declare const DEFAULT_MIN_CROP_SIZE: Size;
|
|
29
|
-
/**
|
|
30
|
-
* Bounds within which the crop rect must stay.
|
|
31
|
-
*/
|
|
32
|
-
export interface CropBounds {
|
|
33
|
-
minX: number;
|
|
34
|
-
minY: number;
|
|
35
|
-
maxX: number;
|
|
36
|
-
maxY: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Drag state for tracking a resize interaction.
|
|
40
|
-
*/
|
|
41
|
-
export interface ResizeDragState {
|
|
42
|
-
/** Which handle is being dragged. */
|
|
43
|
-
handle: HandlePosition;
|
|
44
|
-
/** The mouse position (pixels) when the drag started. */
|
|
45
|
-
startX: number;
|
|
46
|
-
startY: number;
|
|
47
|
-
/** The crop rect (normalized) when the drag started. */
|
|
48
|
-
startRect: NormalizedRect;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Compute the new crop rect for a free (no aspect ratio) resize.
|
|
52
|
-
*
|
|
53
|
-
* Each edge moves independently based on the handle being dragged.
|
|
54
|
-
* Edges are clamped to the provided bounds and maintain a minimum size.
|
|
55
|
-
*
|
|
56
|
-
* @param drag The current drag state.
|
|
57
|
-
* @param clientX Current mouse/touch X position in pixels.
|
|
58
|
-
* @param clientY Current mouse/touch Y position in pixels.
|
|
59
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
60
|
-
* @param bounds The allowed crop area bounds.
|
|
61
|
-
* @param minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
62
|
-
* @return The new crop rect in normalized coordinates.
|
|
63
|
-
*/
|
|
64
|
-
export declare function computeFreeResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, minCropSize?: Size): NormalizedRect;
|
|
65
|
-
/**
|
|
66
|
-
* Compute the new crop rect for a locked-aspect-ratio corner resize.
|
|
67
|
-
*
|
|
68
|
-
* The opposite corner is the anchor. The dragged corner moves freely
|
|
69
|
-
* but the result is clamped to maintain the aspect ratio and stay
|
|
70
|
-
* within bounds.
|
|
71
|
-
*
|
|
72
|
-
* @param drag The current drag state.
|
|
73
|
-
* @param clientX Current mouse/touch X position in pixels.
|
|
74
|
-
* @param clientY Current mouse/touch Y position in pixels.
|
|
75
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
76
|
-
* @param bounds The allowed crop area bounds.
|
|
77
|
-
* @param normalizedRatio The locked aspect ratio (width / height in normalized space).
|
|
78
|
-
* @param minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
79
|
-
* @param driverAxis Optional explicit driver axis. Used for keyboard
|
|
80
|
-
* resize, where one arrow axis should determine the step.
|
|
81
|
-
* @return The new crop rect in normalized coordinates.
|
|
82
|
-
*/
|
|
83
|
-
export declare function computeLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, normalizedRatio: number, minCropSize?: Size, driverAxis?: ResizeDriverAxis): NormalizedRect;
|
|
84
|
-
/**
|
|
85
|
-
* Compute the new crop rect for a resize that temporarily locks the
|
|
86
|
-
* aspect ratio to `drag.startRect`'s ratio (e.g. while Shift is held).
|
|
87
|
-
*
|
|
88
|
-
* Corner handles delegate to {@link computeLockedResizeRect}. Edge
|
|
89
|
-
* handles size the dragged axis freely, then expand the perpendicular
|
|
90
|
-
* axis symmetrically around the rect's center to preserve the ratio,
|
|
91
|
-
* clamping symmetrically so the rect stays within bounds.
|
|
92
|
-
*
|
|
93
|
-
* @param drag The current drag state.
|
|
94
|
-
* @param clientX Current mouse/touch X position in pixels.
|
|
95
|
-
* @param clientY Current mouse/touch Y position in pixels.
|
|
96
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
97
|
-
* @param bounds The allowed crop area bounds.
|
|
98
|
-
* @param minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
99
|
-
* @return The new crop rect in normalized coordinates.
|
|
100
|
-
*/
|
|
101
|
-
export declare function computeShiftLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, minCropSize?: Size): NormalizedRect;
|
|
102
|
-
//# sourceMappingURL=stencil-math.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stencil-math.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/stencil-math.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpE,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAE,YAAY,EAAE,MAAM,GAAI,MAAM,CAK/D;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,IAAoC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,SAAS,EAAE,cAAc,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,EAClB,WAAW,GAAE,IAA4B,GACvC,cAAc,CA6ChB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,GAAE,IAA4B,EACzC,UAAU,CAAC,EAAE,gBAAgB,GAC3B,cAAc,CAyFhB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,EAClB,WAAW,GAAE,IAA4B,GACvC,cAAc,CA0GhB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CropperState, Size } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Computes a CSS matrix() transform string from the cropper state.
|
|
4
|
-
*
|
|
5
|
-
* The combined transform is: translate(tx, ty) * scale(sx, sy) * rotate(r) * scale(z)
|
|
6
|
-
* expressed as a 2D CSS matrix(a, b, c, d, tx, ty).
|
|
7
|
-
*
|
|
8
|
-
* Flip is composed outside rotation so it is viewport-relative — horizontal
|
|
9
|
-
* flip mirrors across the viewport's vertical axis regardless of rotation.
|
|
10
|
-
* Must match the matrix order in `createCamera` / `getImageCropBounds`.
|
|
11
|
-
*
|
|
12
|
-
* This is a pure function with no framework dependencies. The React hook
|
|
13
|
-
* `useTransformStyle` wraps this in `useMemo` for memoization.
|
|
14
|
-
*
|
|
15
|
-
* @param state The current cropper state.
|
|
16
|
-
* @param imageSize The rendered image dimensions in pixels.
|
|
17
|
-
* @return A CSS transform string.
|
|
18
|
-
*/
|
|
19
|
-
export declare function computeTransformStyle(state: CropperState, imageSize: Size): string;
|
|
20
|
-
//# sourceMappingURL=transform-style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-style.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/transform-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAOlD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,MAAM,CA4BR"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { TransformOperation, CropperState } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Apply a single transform operation to a cropper state, returning
|
|
4
|
-
* a new state with the containment invariant enforced.
|
|
5
|
-
*
|
|
6
|
-
* Delegates to the reducer via APPLY_OPERATION so pipeline replay
|
|
7
|
-
* produces identical bounded state to UI interaction or setter
|
|
8
|
-
* calls. The same logical operation yields the same result
|
|
9
|
-
* regardless of entrypoint.
|
|
10
|
-
*
|
|
11
|
-
* @param state The current cropper state.
|
|
12
|
-
* @param op The operation to apply.
|
|
13
|
-
* @return A new cropper state with the operation applied.
|
|
14
|
-
*/
|
|
15
|
-
export declare function applyOperationToState(state: CropperState, op: TransformOperation): CropperState;
|
|
16
|
-
/**
|
|
17
|
-
* Replay all operations from an initial state to produce the final state.
|
|
18
|
-
*
|
|
19
|
-
* @param pipeline The array of transform operations to replay.
|
|
20
|
-
* @param initialState The starting state. Defaults to DEFAULT_STATE.
|
|
21
|
-
* @return The resulting cropper state after all operations are applied.
|
|
22
|
-
*/
|
|
23
|
-
export declare function stateFromPipeline(pipeline: TransformOperation[], initialState?: CropperState): CropperState;
|
|
24
|
-
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/core/transforms/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIjE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,kBAAkB,GACpB,YAAY,CAEd;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,YAAY,GAAE,YAAmC,GAC/C,YAAY,CAKd"}
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import type { mat2d } from 'gl-matrix';
|
|
2
|
-
/**
|
|
3
|
-
* A 2D camera represented as a 2×3 affine transformation matrix (`mat2d`).
|
|
4
|
-
*
|
|
5
|
-
* This is not a camera object with properties — it's a raw 6-element matrix
|
|
6
|
-
* `[a, b, c, d, tx, ty]` that maps normalized world coordinates [0,1] to
|
|
7
|
-
* screen pixels. It composes pan, rotation, flip, zoom, and contain-fit
|
|
8
|
-
* into a single transform.
|
|
9
|
-
*
|
|
10
|
-
* Use `createCamera()` to build one from `CropperState`, then pass it to
|
|
11
|
-
* `worldToScreen()` / `screenToWorld()` for coordinate conversion.
|
|
12
|
-
*
|
|
13
|
-
* A 3D camera would use `mat4`; this is strictly 2D (no perspective).
|
|
14
|
-
*/
|
|
15
|
-
export type Camera = mat2d;
|
|
16
|
-
/**
|
|
17
|
-
* A point with normalized coordinates (0-1 range relative to image dimensions).
|
|
18
|
-
*/
|
|
19
|
-
export interface NormalizedPoint {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A rectangle with normalized coordinates (0-1 range).
|
|
25
|
-
* Origin is the top-left corner of the image.
|
|
26
|
-
*/
|
|
27
|
-
export interface NormalizedRect {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Width and height dimensions.
|
|
35
|
-
*/
|
|
36
|
-
export interface Size {
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Flip state for horizontal and vertical axes.
|
|
42
|
-
*/
|
|
43
|
-
export interface Flip {
|
|
44
|
-
horizontal: boolean;
|
|
45
|
-
vertical: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A JSON-serializable transform operation for the non-destructive pipeline.
|
|
49
|
-
*/
|
|
50
|
-
export type TransformOperation = {
|
|
51
|
-
type: 'crop';
|
|
52
|
-
rect: NormalizedRect;
|
|
53
|
-
} | {
|
|
54
|
-
type: 'rotate';
|
|
55
|
-
degrees: number;
|
|
56
|
-
} | {
|
|
57
|
-
type: 'flip';
|
|
58
|
-
direction: 'horizontal' | 'vertical';
|
|
59
|
-
} | {
|
|
60
|
-
type: 'zoom';
|
|
61
|
-
factor: number;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Full cropper state.
|
|
65
|
-
*/
|
|
66
|
-
export interface CropperState {
|
|
67
|
-
/** The source image information. Null until an image is loaded. */
|
|
68
|
-
image: {
|
|
69
|
-
src: string;
|
|
70
|
-
naturalWidth: number;
|
|
71
|
-
naturalHeight: number;
|
|
72
|
-
} | null;
|
|
73
|
-
/**
|
|
74
|
-
* Image pan offset in normalized coordinates. Not the crop
|
|
75
|
-
* rectangle — that's `cropRect` below.
|
|
76
|
-
*/
|
|
77
|
-
pan: NormalizedPoint;
|
|
78
|
-
/** Zoom level. 1 = no zoom. */
|
|
79
|
-
zoom: number;
|
|
80
|
-
/** Rotation in degrees, normalized to 0-360. */
|
|
81
|
-
rotation: number;
|
|
82
|
-
/**
|
|
83
|
-
* Base pan/zoom/rotation — the pose the user last explicitly set.
|
|
84
|
-
*
|
|
85
|
-
* During continuous fine rotation (SET_ROTATION), every tick
|
|
86
|
-
* re-derives the transient `pan`/`zoom` from these base values
|
|
87
|
-
* rather than compounding on the previous tick. This prevents
|
|
88
|
-
* drift from accumulated containment clamping near image edges:
|
|
89
|
-
* rotating 0°→30°→0° returns to the exact starting pan, not a
|
|
90
|
-
* slightly-nudged version of it.
|
|
91
|
-
*
|
|
92
|
-
* These are updated by every action except SET_ROTATION itself —
|
|
93
|
-
* explicit zoom, pan, crop-rect, flip, and 90° snap all commit
|
|
94
|
-
* the post-containment state into base. SET_ROTATION reads from
|
|
95
|
-
* `basePan` and `baseRotation` to compute the new pan, and reads
|
|
96
|
-
* `baseZoom` as the zoom floor (enforceContainment may bump it up
|
|
97
|
-
* to cover the rotated crop, but never leaves it above baseZoom).
|
|
98
|
-
*/
|
|
99
|
-
basePan: NormalizedPoint;
|
|
100
|
-
baseZoom: number;
|
|
101
|
-
baseRotation: number;
|
|
102
|
-
/** Flip state. */
|
|
103
|
-
flip: Flip;
|
|
104
|
-
/** The crop rectangle in normalized coordinates. */
|
|
105
|
-
cropRect: NormalizedRect;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Internal reducer action union.
|
|
109
|
-
*
|
|
110
|
-
* This type is intentionally not exported from the image-editor public barrel.
|
|
111
|
-
* Consumers should drive state through the controller returned by
|
|
112
|
-
* `useCropperController()` (or a composite store) or through serializable
|
|
113
|
-
* `TransformOperation` values.
|
|
114
|
-
*/
|
|
115
|
-
export type CropperAction =
|
|
116
|
-
/** Sets the loaded image metadata (natural size, src). */
|
|
117
|
-
{
|
|
118
|
-
type: 'SET_IMAGE';
|
|
119
|
-
payload: CropperState['image'];
|
|
120
|
-
}
|
|
121
|
-
/** Sets the image pan offset. (Crop rectangle is SET_CROP_RECT.) */
|
|
122
|
-
| {
|
|
123
|
-
type: 'SET_PAN';
|
|
124
|
-
payload: NormalizedPoint;
|
|
125
|
-
}
|
|
126
|
-
/** Sets the zoom level, clamped to [coverage-aware min, MAX_ZOOM]. */
|
|
127
|
-
| {
|
|
128
|
-
type: 'SET_ZOOM';
|
|
129
|
-
payload: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Sets zoom and pan together atomically. Used by focal-point
|
|
133
|
-
* zoom (wheel, pinch) to keep a target point stationary while
|
|
134
|
-
* zoom changes.
|
|
135
|
-
*/
|
|
136
|
-
| {
|
|
137
|
-
type: 'SET_ZOOM_AT_POINT';
|
|
138
|
-
payload: {
|
|
139
|
-
zoom: number;
|
|
140
|
-
pan: NormalizedPoint;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/** Sets the absolute rotation angle in degrees. */
|
|
144
|
-
| {
|
|
145
|
-
type: 'SET_ROTATION';
|
|
146
|
-
payload: number;
|
|
147
|
-
}
|
|
148
|
-
/** Rotates by +/-90 degrees (snap). */
|
|
149
|
-
| {
|
|
150
|
-
type: 'SNAP_ROTATE_90';
|
|
151
|
-
payload: {
|
|
152
|
-
direction: 1 | -1;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/** Sets the flip state. */
|
|
156
|
-
| {
|
|
157
|
-
type: 'SET_FLIP';
|
|
158
|
-
payload: Flip;
|
|
159
|
-
}
|
|
160
|
-
/** Sets the crop rectangle. */
|
|
161
|
-
| {
|
|
162
|
-
type: 'SET_CROP_RECT';
|
|
163
|
-
payload: NormalizedRect;
|
|
164
|
-
}
|
|
165
|
-
/** Settle animation after resize drag, recentering the crop rect. */
|
|
166
|
-
| {
|
|
167
|
-
type: 'SETTLE_CROP';
|
|
168
|
-
}
|
|
169
|
-
/** Applies a single pipeline transform via the reducer. */
|
|
170
|
-
| {
|
|
171
|
-
type: 'APPLY_OPERATION';
|
|
172
|
-
payload: TransformOperation;
|
|
173
|
-
}
|
|
174
|
-
/** Resets to DEFAULT_STATE, optionally merging a partial override. */
|
|
175
|
-
| {
|
|
176
|
-
type: 'RESET';
|
|
177
|
-
payload?: Partial<CropperState>;
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Viewport camera state — display-only, does not affect export or undo.
|
|
181
|
-
*
|
|
182
|
-
* Applied as a CSS transform on the inner stage div so the user can scroll
|
|
183
|
-
* the view independently of the crop. zoom > 1 magnifies; pan shifts in CSS px.
|
|
184
|
-
*/
|
|
185
|
-
export interface ViewportState {
|
|
186
|
-
zoom: number;
|
|
187
|
-
pan: {
|
|
188
|
-
x: number;
|
|
189
|
-
y: number;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
export type ViewportAction = {
|
|
193
|
-
type: 'SET_VIEWPORT_ZOOM';
|
|
194
|
-
payload: number;
|
|
195
|
-
} | {
|
|
196
|
-
type: 'SET_VIEWPORT_PAN';
|
|
197
|
-
payload: {
|
|
198
|
-
x: number;
|
|
199
|
-
y: number;
|
|
200
|
-
};
|
|
201
|
-
} | {
|
|
202
|
-
type: 'RESET_VIEWPORT';
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Direction of a crop resize handle. Eight compass positions: four
|
|
206
|
-
* corners and four edge midpoints. Used by stencil callbacks and any
|
|
207
|
-
* overlay that needs to know which handle the user is dragging.
|
|
208
|
-
*/
|
|
209
|
-
export type HandlePosition = 'n' | 's' | 'e' | 'w' | 'nw' | 'ne' | 'sw' | 'se';
|
|
210
|
-
/**
|
|
211
|
-
* The contract for a pluggable stencil component.
|
|
212
|
-
* Stencils render the crop area overlay and handle resize interactions.
|
|
213
|
-
*/
|
|
214
|
-
export interface StencilProps {
|
|
215
|
-
/** The current crop rectangle in normalized coordinates. */
|
|
216
|
-
cropRect: NormalizedRect;
|
|
217
|
-
/** The container element dimensions in pixels. */
|
|
218
|
-
containerSize: Size;
|
|
219
|
-
/** The rendered image dimensions in pixels within the container. */
|
|
220
|
-
imageSize: Size;
|
|
221
|
-
/** Callback when the crop rectangle changes (during drag). */
|
|
222
|
-
onCropChange: (rect: NormalizedRect) => void;
|
|
223
|
-
/**
|
|
224
|
-
* Callback when a resize interaction starts — pointerdown on a handle
|
|
225
|
-
* or the first arrow-key press on a focused handle. The handle direction
|
|
226
|
-
* is passed so downstream overlays can anchor to it. The argument is
|
|
227
|
-
* optional to keep custom stencils that don't track a direction
|
|
228
|
-
* backward-compatible.
|
|
229
|
-
*/
|
|
230
|
-
onResizeStart?: (handle?: HandlePosition) => void;
|
|
231
|
-
/** Callback when a resize drag ends (mouseup after handle drag). */
|
|
232
|
-
onResizeEnd?: () => void;
|
|
233
|
-
/** Optional fixed aspect ratio (width / height) in pixel space. */
|
|
234
|
-
aspectRatio?: number;
|
|
235
|
-
/** Whether the crop handles are shown for freeform resizing. */
|
|
236
|
-
freeformCrop?: boolean;
|
|
237
|
-
/** Whether resize handles should ignore pointer and keyboard input. */
|
|
238
|
-
isResizeDisabled?: boolean;
|
|
239
|
-
/** CSS transition string for settle animation. */
|
|
240
|
-
stencilTransition?: string;
|
|
241
|
-
/** Maximum crop rect bounds based on current zoom/rotation. */
|
|
242
|
-
cropBounds?: {
|
|
243
|
-
minX: number;
|
|
244
|
-
minY: number;
|
|
245
|
-
maxX: number;
|
|
246
|
-
maxY: number;
|
|
247
|
-
};
|
|
248
|
-
/** Called when Escape is pressed on a resize handle. */
|
|
249
|
-
onEscape?: () => void;
|
|
250
|
-
/**
|
|
251
|
-
* Minimum crop rect dimension in normalized space, per axis. Derived
|
|
252
|
-
* by the host from a pixel-based floor (see `MIN_CROP_PIXELS`) and
|
|
253
|
-
* the source image dimensions. Omit to use the stencil's default.
|
|
254
|
-
*/
|
|
255
|
-
minCropSize?: Size;
|
|
256
|
-
/**
|
|
257
|
-
* Optional post-processor for freeform resize output. Hosts use this for
|
|
258
|
-
* display-gated behavior such as snapping visible pixel grids to source
|
|
259
|
-
* pixel boundaries.
|
|
260
|
-
*/
|
|
261
|
-
snapCropRect?: (rect: NormalizedRect, handle: HandlePosition) => NormalizedRect;
|
|
262
|
-
/**
|
|
263
|
-
* Optional keyboard resize step in normalized space, per axis. Hosts use
|
|
264
|
-
* this when keyboard resize should follow the rendered image scale instead
|
|
265
|
-
* of the default percentage-based step.
|
|
266
|
-
*/
|
|
267
|
-
keyboardResizeStep?: Size;
|
|
268
|
-
}
|
|
269
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ViewportState, ViewportAction } from './types';
|
|
2
|
-
export declare const DEFAULT_VIEWPORT_STATE: ViewportState;
|
|
3
|
-
export declare function viewportReducer(state: ViewportState, action: ViewportAction): ViewportState;
|
|
4
|
-
//# sourceMappingURL=viewport-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-state.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/viewport-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,wBAAgB,eAAe,CAC9B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,GACpB,aAAa,CAmBf"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public image editor contract.
|
|
3
|
-
*
|
|
4
|
-
* Keep this barrel explicit so implementation details from `core/`,
|
|
5
|
-
* `react/hooks/`, or `react/components/` do not become supported API by
|
|
6
|
-
* accident. The media editor's own state code imports the reducer-level
|
|
7
|
-
* helpers from `./core` and `./react/hooks` directly, as the package's
|
|
8
|
-
* components already do; everyone else uses what is here.
|
|
9
|
-
*/
|
|
10
|
-
export { useCropperController } from './react/hooks';
|
|
11
|
-
export { Cropper, CropperProvider, useCropper } from './react/components';
|
|
12
|
-
export type { CropperController } from './react/hooks';
|
|
13
|
-
export type { CropperProps } from './react/components';
|
|
14
|
-
export type { CropperState, TransformOperation, NormalizedPoint, NormalizedRect, Size, Flip, StencilProps, HandlePosition, } from './core';
|
|
15
|
-
export { ORIGINAL_ASPECT_RATIO, getSourceRegion, getSourceRegionPercent, stateFromPipeline, exportCroppedImage, applyToCanvas, } from './core';
|
|
16
|
-
export type { AspectRatioPreset, SourceRegion, SourceRegionPercent, } from './core';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image-editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,YAAY,EACX,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,cAAc,GACd,MAAM,QAAQ,CAAC;AAIhB,OAAO,EACN,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACb,MAAM,QAAQ,CAAC;AAChB,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,GACnB,MAAM,QAAQ,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type CropperController } from '../hooks/use-cropper-controller';
|
|
2
|
-
import type { CropperState } from '../../core/types';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the CropperProvider component.
|
|
5
|
-
*/
|
|
6
|
-
interface CropperProviderProps {
|
|
7
|
-
/** Optional partial initial state to merge with defaults. */
|
|
8
|
-
initialState?: Partial<CropperState>;
|
|
9
|
-
/** Child components. */
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Convenience context provider that wraps `useCropperController`.
|
|
14
|
-
*
|
|
15
|
-
* Provides the pure cropper controller (state + setters, NO undo
|
|
16
|
-
* history) to all descendant components via React context.
|
|
17
|
-
*
|
|
18
|
-
* History is a higher-layer concern owned by composite stores
|
|
19
|
-
* (see `useMediaEditorState` in media-editor/state for the media
|
|
20
|
-
* editor's composite controller with undo/redo).
|
|
21
|
-
*
|
|
22
|
-
* @param props
|
|
23
|
-
* @param props.initialState
|
|
24
|
-
* @param props.children
|
|
25
|
-
* @return The provider element wrapping children.
|
|
26
|
-
*/
|
|
27
|
-
export declare function CropperProvider({ initialState, children, }: CropperProviderProps): import("react").JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* Hook to consume the CropperProvider context.
|
|
30
|
-
*
|
|
31
|
-
* Must be used within a CropperProvider. Throws if used outside
|
|
32
|
-
* of the provider tree.
|
|
33
|
-
*
|
|
34
|
-
* @return The cropper controller.
|
|
35
|
-
*/
|
|
36
|
-
export declare function useCropper(): CropperController;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=cropper-provider.d.ts.map
|