@wordpress/media-editor 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/build/components/media-editor/index.cjs +586 -686
- package/build/components/media-editor/index.cjs.map +1 -7
- package/build/components/media-editor/use-crop-options.cjs +42 -57
- package/build/components/media-editor/use-crop-options.cjs.map +1 -7
- package/build/components/media-editor/use-save-media-editor.cjs +131 -185
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -7
- package/build/components/media-editor-canvas/index.cjs +117 -124
- package/build/components/media-editor-canvas/index.cjs.map +1 -7
- package/build/components/media-editor-crop-panel/index.cjs +81 -72
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -7
- package/build/components/media-editor-fine-rotation/index.cjs +61 -72
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -7
- package/build/components/media-editor-image-controls/index.cjs +181 -257
- package/build/components/media-editor-image-controls/index.cjs.map +1 -7
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +120 -157
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -7
- package/build/components/media-editor-modal/index.cjs +112 -155
- package/build/components/media-editor-modal/index.cjs.map +1 -7
- package/build/components/media-editor-provider/index.cjs +32 -55
- package/build/components/media-editor-provider/index.cjs.map +1 -7
- package/build/components/media-form/index.cjs +82 -77
- package/build/components/media-form/index.cjs.map +1 -7
- package/build/components/media-preview/index.cjs +113 -114
- package/build/components/media-preview/index.cjs.map +1 -7
- package/build/components/rotation-ruler/index.cjs +181 -188
- package/build/components/rotation-ruler/index.cjs.map +1 -7
- package/build/components/rotation-ruler/use-ruler-drag.cjs +132 -149
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -7
- package/build/hooks/use-crop-gesture-handlers.cjs +82 -76
- package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -7
- package/build/index.cjs +45 -39
- package/build/lock-unlock.cjs +9 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/private-apis.cjs +16 -37
- package/build/private-apis.cjs.map +1 -7
- package/build/state/aspect-ratio-presets.cjs +59 -0
- package/build/state/aspect-ratio-presets.cjs.map +1 -0
- package/build/state/composite-reducer.cjs +100 -113
- package/build/state/composite-reducer.cjs.map +1 -7
- package/build/state/index.cjs +22 -45
- package/build/state/media-editor-state-provider.cjs +35 -48
- package/build/state/media-editor-state-provider.cjs.map +1 -7
- package/build/state/types.cjs +11 -31
- package/build/state/types.cjs.map +1 -7
- package/build/state/use-media-editor-state.cjs +227 -296
- package/build/state/use-media-editor-state.cjs.map +1 -7
- package/build/store/actions.cjs +17 -44
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +8 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +33 -40
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +28 -50
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +16 -41
- package/build/store/selectors.cjs.map +1 -7
- package/build/utils/get-media-type.cjs +18 -41
- package/build/utils/get-media-type.cjs.map +1 -7
- package/build/utils/index.cjs +9 -28
- package/build-module/components/media-editor/index.mjs +545 -675
- package/build-module/components/media-editor/index.mjs.map +1 -7
- package/build-module/components/media-editor/use-crop-options.mjs +37 -32
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -7
- package/build-module/components/media-editor/use-save-media-editor.mjs +109 -157
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -7
- package/build-module/components/media-editor-canvas/index.mjs +95 -98
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -7
- package/build-module/components/media-editor-crop-panel/index.mjs +59 -46
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -7
- package/build-module/components/media-editor-fine-rotation/index.mjs +39 -46
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -7
- package/build-module/components/media-editor-image-controls/index.mjs +171 -238
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -7
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +113 -137
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-modal/index.mjs +88 -124
- package/build-module/components/media-editor-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-provider/index.mjs +26 -29
- package/build-module/components/media-editor-provider/index.mjs.map +1 -7
- package/build-module/components/media-form/index.mjs +74 -56
- package/build-module/components/media-form/index.mjs.map +1 -7
- package/build-module/components/media-preview/index.mjs +105 -90
- package/build-module/components/media-preview/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/index.mjs +161 -164
- package/build-module/components/rotation-ruler/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs +125 -122
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +1 -7
- package/build-module/hooks/use-crop-gesture-handlers.mjs +76 -50
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +1 -7
- package/build-module/index.mjs +3 -10
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/private-apis.mjs +8 -9
- package/build-module/private-apis.mjs.map +1 -7
- package/build-module/state/aspect-ratio-presets.mjs +53 -0
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -0
- package/build-module/state/composite-reducer.mjs +80 -91
- package/build-module/state/composite-reducer.mjs.map +1 -7
- package/build-module/state/index.mjs +3 -26
- package/build-module/state/media-editor-state-provider.mjs +29 -24
- package/build-module/state/media-editor-state-provider.mjs.map +1 -7
- package/build-module/state/types.mjs +7 -7
- package/build-module/state/types.mjs.map +1 -7
- package/build-module/state/use-media-editor-state.mjs +223 -288
- package/build-module/state/use-media-editor-state.mjs.map +1 -7
- package/build-module/store/actions.mjs +12 -19
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +4 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +8 -9
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +23 -26
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +8 -13
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/utils/get-media-type.mjs +14 -17
- package/build-module/utils/get-media-type.mjs.map +1 -7
- package/build-module/utils/index.mjs +1 -6
- package/build-style/style-rtl.css +145 -61
- package/build-style/style.css +144 -61
- package/build-types/components/media-editor/index.d.ts +20 -2
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +2 -3
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts +3 -3
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts +1 -1
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
- package/build-types/state/aspect-ratio-presets.d.ts +24 -0
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -0
- package/build-types/state/composite-reducer.d.ts +17 -19
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/index.d.ts +2 -4
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +20 -63
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +33 -52
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/package.json +22 -23
- package/src/components/media-editor/index.tsx +355 -167
- package/src/components/media-editor/style.scss +19 -0
- package/src/components/media-editor/use-crop-options.ts +9 -10
- package/src/components/media-editor/use-save-media-editor.ts +48 -10
- package/src/components/media-editor-canvas/index.tsx +30 -51
- package/src/components/media-editor-canvas/style.scss +6 -6
- package/src/components/media-editor-crop-panel/index.tsx +38 -2
- package/src/components/media-editor-crop-panel/style.scss +21 -0
- package/src/components/media-editor-fine-rotation/index.tsx +6 -6
- package/src/components/media-editor-image-controls/index.tsx +15 -11
- package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +1 -0
- package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +1 -1
- package/src/components/media-editor-modal/index.tsx +1 -1
- package/src/components/media-editor-modal/style.scss +1 -1
- package/src/components/media-form/index.tsx +7 -1
- package/src/components/media-preview/index.tsx +65 -23
- package/src/components/media-preview/style.scss +16 -2
- package/src/components/rotation-ruler/style.scss +9 -5
- package/src/components/rotation-ruler/use-ruler-drag.ts +6 -11
- package/src/state/README.md +32 -0
- package/src/state/aspect-ratio-presets.ts +37 -0
- package/src/state/composite-reducer.ts +42 -80
- package/src/state/index.ts +2 -17
- package/src/state/types.ts +18 -72
- package/src/state/use-media-editor-state.ts +155 -238
- package/src/style.scss +2 -1
- package/build/components/media-editor-modal/build-modifiers.cjs +0 -91
- package/build/components/media-editor-modal/build-modifiers.cjs.map +0 -7
- package/build/image-editor/core/camera.cjs +0 -225
- package/build/image-editor/core/camera.cjs.map +0 -7
- package/build/image-editor/core/constants.cjs +0 -108
- package/build/image-editor/core/constants.cjs.map +0 -7
- package/build/image-editor/core/containment.cjs +0 -276
- package/build/image-editor/core/containment.cjs.map +0 -7
- package/build/image-editor/core/crop-rect.cjs +0 -48
- package/build/image-editor/core/crop-rect.cjs.map +0 -7
- package/build/image-editor/core/export/canvas-renderer.cjs +0 -151
- package/build/image-editor/core/export/canvas-renderer.cjs.map +0 -7
- package/build/image-editor/core/index.cjs +0 -62
- package/build/image-editor/core/index.cjs.map +0 -7
- package/build/image-editor/core/interaction-controller.cjs +0 -654
- package/build/image-editor/core/interaction-controller.cjs.map +0 -7
- package/build/image-editor/core/math/rotation.cjs +0 -41
- package/build/image-editor/core/math/rotation.cjs.map +0 -7
- package/build/image-editor/core/math/sanitize.cjs +0 -92
- package/build/image-editor/core/math/sanitize.cjs.map +0 -7
- package/build/image-editor/core/setter-helpers.cjs +0 -64
- package/build/image-editor/core/setter-helpers.cjs.map +0 -7
- package/build/image-editor/core/source-region.cjs +0 -206
- package/build/image-editor/core/source-region.cjs.map +0 -7
- package/build/image-editor/core/state.cjs +0 -283
- package/build/image-editor/core/state.cjs.map +0 -7
- package/build/image-editor/core/stencil-math.cjs +0 -216
- package/build/image-editor/core/stencil-math.cjs.map +0 -7
- package/build/image-editor/core/transform-style.cjs +0 -52
- package/build/image-editor/core/transform-style.cjs.map +0 -7
- package/build/image-editor/core/transforms/pipeline.cjs +0 -43
- package/build/image-editor/core/transforms/pipeline.cjs.map +0 -7
- package/build/image-editor/core/types.cjs +0 -19
- package/build/image-editor/core/types.cjs.map +0 -7
- package/build/image-editor/core/viewport-state.cjs +0 -50
- package/build/image-editor/core/viewport-state.cjs.map +0 -7
- package/build/image-editor/index.cjs +0 -67
- package/build/image-editor/index.cjs.map +0 -7
- package/build/image-editor/react/components/cropper-provider.cjs +0 -50
- package/build/image-editor/react/components/cropper-provider.cjs.map +0 -7
- package/build/image-editor/react/components/cropper.cjs +0 -722
- package/build/image-editor/react/components/cropper.cjs.map +0 -7
- package/build/image-editor/react/components/index.cjs +0 -36
- package/build/image-editor/react/components/index.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +0 -172
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +0 -62
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +0 -91
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +0 -7
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +0 -426
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +0 -7
- package/build/image-editor/react/components/viewport-provider.cjs +0 -51
- package/build/image-editor/react/components/viewport-provider.cjs.map +0 -7
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +0 -71
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +0 -7
- package/build/image-editor/react/hooks/index.cjs +0 -34
- package/build/image-editor/react/hooks/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +0 -160
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +0 -113
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-interaction.cjs +0 -213
- package/build/image-editor/react/hooks/use-interaction.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-transform-style.cjs +0 -38
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-viewport-state.cjs +0 -51
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +0 -7
- package/build/image-editor/react/visually-hidden-style.cjs +0 -41
- package/build/image-editor/react/visually-hidden-style.cjs.map +0 -7
- package/build/index.cjs.map +0 -7
- package/build/state/index.cjs.map +0 -7
- package/build/utils/index.cjs.map +0 -7
- package/build-module/components/media-editor-modal/build-modifiers.mjs +0 -66
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +0 -7
- package/build-module/image-editor/core/camera.mjs +0 -198
- package/build-module/image-editor/core/camera.mjs.map +0 -7
- package/build-module/image-editor/core/constants.mjs +0 -69
- package/build-module/image-editor/core/constants.mjs.map +0 -7
- package/build-module/image-editor/core/containment.mjs +0 -253
- package/build-module/image-editor/core/containment.mjs.map +0 -7
- package/build-module/image-editor/core/crop-rect.mjs +0 -23
- package/build-module/image-editor/core/crop-rect.mjs.map +0 -7
- package/build-module/image-editor/core/export/canvas-renderer.mjs +0 -120
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +0 -7
- package/build-module/image-editor/core/index.mjs +0 -36
- package/build-module/image-editor/core/index.mjs.map +0 -7
- package/build-module/image-editor/core/interaction-controller.mjs +0 -635
- package/build-module/image-editor/core/interaction-controller.mjs.map +0 -7
- package/build-module/image-editor/core/math/rotation.mjs +0 -15
- package/build-module/image-editor/core/math/rotation.mjs.map +0 -7
- package/build-module/image-editor/core/math/sanitize.mjs +0 -63
- package/build-module/image-editor/core/math/sanitize.mjs.map +0 -7
- package/build-module/image-editor/core/setter-helpers.mjs +0 -39
- package/build-module/image-editor/core/setter-helpers.mjs.map +0 -7
- package/build-module/image-editor/core/source-region.mjs +0 -178
- package/build-module/image-editor/core/source-region.mjs.map +0 -7
- package/build-module/image-editor/core/state.mjs +0 -260
- package/build-module/image-editor/core/state.mjs.map +0 -7
- package/build-module/image-editor/core/stencil-math.mjs +0 -187
- package/build-module/image-editor/core/stencil-math.mjs.map +0 -7
- package/build-module/image-editor/core/transform-style.mjs +0 -27
- package/build-module/image-editor/core/transform-style.mjs.map +0 -7
- package/build-module/image-editor/core/transforms/pipeline.mjs +0 -17
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +0 -7
- package/build-module/image-editor/core/types.mjs +0 -1
- package/build-module/image-editor/core/types.mjs.map +0 -7
- package/build-module/image-editor/core/viewport-state.mjs +0 -24
- package/build-module/image-editor/core/viewport-state.mjs.map +0 -7
- package/build-module/image-editor/index.mjs +0 -39
- package/build-module/image-editor/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/cropper-provider.mjs +0 -26
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +0 -7
- package/build-module/image-editor/react/components/cropper.mjs +0 -704
- package/build-module/image-editor/react/components/cropper.mjs.map +0 -7
- package/build-module/image-editor/react/components/index.mjs +0 -9
- package/build-module/image-editor/react/components/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +0 -147
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +0 -37
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +0 -66
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +0 -7
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +0 -414
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +0 -7
- package/build-module/image-editor/react/components/viewport-provider.mjs +0 -27
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +0 -46
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/index.mjs +0 -8
- package/build-module/image-editor/react/hooks/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +0 -135
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +0 -100
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-interaction.mjs +0 -190
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +0 -13
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +0 -29
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +0 -7
- package/build-module/image-editor/react/visually-hidden-style.mjs +0 -16
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/state/index.mjs.map +0 -7
- package/build-module/utils/index.mjs.map +0 -7
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -80
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +0 -1
- package/build-types/image-editor/core/camera.d.ts +0 -128
- package/build-types/image-editor/core/camera.d.ts.map +0 -1
- package/build-types/image-editor/core/constants.d.ts +0 -99
- package/build-types/image-editor/core/constants.d.ts.map +0 -1
- package/build-types/image-editor/core/containment.d.ts +0 -72
- package/build-types/image-editor/core/containment.d.ts.map +0 -1
- package/build-types/image-editor/core/crop-rect.d.ts +0 -16
- package/build-types/image-editor/core/crop-rect.d.ts.map +0 -1
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +0 -103
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +0 -1
- package/build-types/image-editor/core/index.d.ts +0 -10
- package/build-types/image-editor/core/index.d.ts.map +0 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +0 -191
- package/build-types/image-editor/core/interaction-controller.d.ts.map +0 -1
- package/build-types/image-editor/core/math/rotation.d.ts +0 -18
- package/build-types/image-editor/core/math/rotation.d.ts.map +0 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +0 -67
- package/build-types/image-editor/core/math/sanitize.d.ts.map +0 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +0 -21
- package/build-types/image-editor/core/setter-helpers.d.ts.map +0 -1
- package/build-types/image-editor/core/source-region.d.ts +0 -94
- package/build-types/image-editor/core/source-region.d.ts.map +0 -1
- package/build-types/image-editor/core/state.d.ts +0 -51
- package/build-types/image-editor/core/state.d.ts.map +0 -1
- package/build-types/image-editor/core/stencil-math.d.ts +0 -102
- package/build-types/image-editor/core/stencil-math.d.ts.map +0 -1
- package/build-types/image-editor/core/transform-style.d.ts +0 -20
- package/build-types/image-editor/core/transform-style.d.ts.map +0 -1
- package/build-types/image-editor/core/transforms/pipeline.d.ts +0 -24
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +0 -1
- package/build-types/image-editor/core/types.d.ts +0 -269
- package/build-types/image-editor/core/types.d.ts.map +0 -1
- package/build-types/image-editor/core/viewport-state.d.ts +0 -4
- package/build-types/image-editor/core/viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/index.d.ts +0 -16
- package/build-types/image-editor/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +0 -38
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper.d.ts +0 -63
- package/build-types/image-editor/react/components/cropper.d.ts.map +0 -1
- package/build-types/image-editor/react/components/index.d.ts +0 -4
- package/build-types/image-editor/react/components/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +0 -33
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +0 -17
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +0 -27
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +0 -33
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +0 -1
- package/build-types/image-editor/react/components/viewport-provider.d.ts +0 -6
- package/build-types/image-editor/react/components/viewport-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +0 -44
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/index.d.ts +0 -5
- package/build-types/image-editor/react/hooks/index.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +0 -14
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +0 -55
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +0 -65
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +0 -13
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +0 -16
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/react/visually-hidden-style.d.ts +0 -6
- package/build-types/image-editor/react/visually-hidden-style.d.ts.map +0 -1
- package/src/components/media-editor-modal/build-modifiers.ts +0 -161
- package/src/image-editor/README.md +0 -61
- package/src/image-editor/core/camera.ts +0 -429
- package/src/image-editor/core/constants.ts +0 -150
- package/src/image-editor/core/containment.ts +0 -469
- package/src/image-editor/core/crop-rect.ts +0 -42
- package/src/image-editor/core/export/canvas-renderer.ts +0 -250
- package/src/image-editor/core/index.ts +0 -47
- package/src/image-editor/core/interaction-controller.ts +0 -976
- package/src/image-editor/core/math/rotation.ts +0 -26
- package/src/image-editor/core/math/sanitize.ts +0 -155
- package/src/image-editor/core/setter-helpers.ts +0 -63
- package/src/image-editor/core/source-region.ts +0 -367
- package/src/image-editor/core/state.ts +0 -484
- package/src/image-editor/core/stencil-math.ts +0 -379
- package/src/image-editor/core/transform-style.ts +0 -56
- package/src/image-editor/core/transforms/pipeline.ts +0 -40
- package/src/image-editor/core/types.ts +0 -230
- package/src/image-editor/core/viewport-state.ts +0 -30
- package/src/image-editor/docs/architecture.md +0 -63
- package/src/image-editor/docs/recipes.md +0 -184
- package/src/image-editor/index.ts +0 -52
- package/src/image-editor/react/components/cropper-provider.tsx +0 -70
- package/src/image-editor/react/components/cropper.scss +0 -259
- package/src/image-editor/react/components/cropper.tsx +0 -1116
- package/src/image-editor/react/components/index.ts +0 -3
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +0 -262
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +0 -55
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +0 -77
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +0 -623
- package/src/image-editor/react/components/viewport-provider.tsx +0 -32
- package/src/image-editor/react/hooks/build-cropper-setters.ts +0 -102
- package/src/image-editor/react/hooks/index.ts +0 -4
- package/src/image-editor/react/hooks/use-aria-announcer.ts +0 -193
- package/src/image-editor/react/hooks/use-cropper-reducer.ts +0 -197
- package/src/image-editor/react/hooks/use-interaction.ts +0 -294
- package/src/image-editor/react/hooks/use-transform-style.ts +0 -23
- package/src/image-editor/react/hooks/use-viewport-state.ts +0 -41
- package/src/image-editor/react/visually-hidden-style.ts +0 -15
- package/src/image-editor/style.scss +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import type { CropperState, NormalizedPoint, Size } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Status reported by the interaction controller when drag/zoom state changes.
|
|
4
|
-
*/
|
|
5
|
-
export interface InteractionStatus {
|
|
6
|
-
/** Whether a drag (pan) interaction is in progress. */
|
|
7
|
-
isDragging: boolean;
|
|
8
|
-
/** Whether a double-tap zoom animation is in progress. */
|
|
9
|
-
isZooming: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* State updates the interaction controller can request from its host UI.
|
|
13
|
-
*/
|
|
14
|
-
export interface CropperInteractionActions {
|
|
15
|
-
/** Set the image pan offset in normalized coordinates. */
|
|
16
|
-
setPan: (pan: NormalizedPoint) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Set the zoom level. Cursorless surfaces (slider, keyboard `+`/`-`)
|
|
19
|
-
* rely on this anchoring at the crop center; pointer-driven zoom
|
|
20
|
-
* paths use `setZoomAtPoint` with an explicit focal point instead.
|
|
21
|
-
*/
|
|
22
|
-
setZoom: (zoom: number) => void;
|
|
23
|
-
/** Set zoom and pan together for focal-point zoom. */
|
|
24
|
-
setZoomAtPoint: (zoom: number, pan: NormalizedPoint) => void;
|
|
25
|
-
/** Snap rotate by 90 degrees. */
|
|
26
|
-
snapRotate90: (direction: 1 | -1) => void;
|
|
27
|
-
/** Toggle flip on the given axis. */
|
|
28
|
-
toggleFlip?: (direction: 'horizontal' | 'vertical') => void;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Options for creating an InteractionController.
|
|
32
|
-
*
|
|
33
|
-
* Scalar options (minZoom, maxZoom, etc.) are read lazily on each
|
|
34
|
-
* interaction, so changes to the options object take effect immediately
|
|
35
|
-
* without recreating the controller.
|
|
36
|
-
*/
|
|
37
|
-
export interface InteractionControllerOptions {
|
|
38
|
-
/** Returns the current cropper state. Called on every interaction. */
|
|
39
|
-
getState: () => CropperState;
|
|
40
|
-
/** State updates the interaction controller can request from its host UI. */
|
|
41
|
-
actions: CropperInteractionActions;
|
|
42
|
-
/** Returns the container dimensions in pixels. */
|
|
43
|
-
getContainerSize: () => Size;
|
|
44
|
-
/** Returns the rendered image dimensions in pixels, if available. */
|
|
45
|
-
getImageSize: () => Size | undefined;
|
|
46
|
-
/** Minimum zoom level. Defaults to MIN_ZOOM. Read lazily. */
|
|
47
|
-
minZoom?: number;
|
|
48
|
-
/** Maximum zoom level. Defaults to MAX_ZOOM. Read lazily. */
|
|
49
|
-
maxZoom?: number;
|
|
50
|
-
/** Zoom speed multiplier for wheel events. Defaults to 0.0025. Read lazily. */
|
|
51
|
-
zoomSpeed?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Pan step size in normalized coords for keyboard events.
|
|
54
|
-
* Defaults to 0.01. Read lazily. Shift multiplies it by 10.
|
|
55
|
-
*/
|
|
56
|
-
keyboardStep?: number;
|
|
57
|
-
/** Zoom level for double-tap zoom. Defaults to 2. Read lazily. */
|
|
58
|
-
doubleTapZoom?: number;
|
|
59
|
-
/** Fires when a continuous gesture begins (pan drag, pinch zoom). */
|
|
60
|
-
onGestureStart?: () => void;
|
|
61
|
-
/** Fires when a continuous gesture ends (pointer release). */
|
|
62
|
-
onGestureEnd?: () => void;
|
|
63
|
-
/** Called when isDragging or isZooming changes. */
|
|
64
|
-
onStatusChange?: (status: InteractionStatus) => void;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Framework-agnostic imperative controller for image cropper interactions.
|
|
68
|
-
*
|
|
69
|
-
* Handles mouse, touch, and keyboard event processing for pan, zoom,
|
|
70
|
-
* and crop manipulation. Uses requestAnimationFrame for drag/pinch
|
|
71
|
-
* updates to avoid layout thrashing.
|
|
72
|
-
*
|
|
73
|
-
* The controller does not register DOM event listeners itself — that is the
|
|
74
|
-
* responsibility of the UI layer (React hook, Vue directive, or vanilla JS).
|
|
75
|
-
* Instead it exposes `handlePointerDown`, `handleWheel`, `handleTouchStart`,
|
|
76
|
-
* and `handleKeyDown` methods that the UI layer calls with native DOM events.
|
|
77
|
-
*
|
|
78
|
-
* Scalar options (minZoom, maxZoom, zoomSpeed, keyboardStep, doubleTapZoom)
|
|
79
|
-
* are read lazily from `this.options` on each interaction, so the UI layer
|
|
80
|
-
* can update them without recreating the controller.
|
|
81
|
-
*
|
|
82
|
-
* Call `destroy()` to clean up timers and pending animation frames.
|
|
83
|
-
*/
|
|
84
|
-
export declare class InteractionController {
|
|
85
|
-
private readonly options;
|
|
86
|
-
/** Current drag/zoom status. */
|
|
87
|
-
private isDragging;
|
|
88
|
-
private isZooming;
|
|
89
|
-
/** Active drag state during pointer interactions. */
|
|
90
|
-
private drag;
|
|
91
|
-
/** Active touch state during touch interactions. */
|
|
92
|
-
private touch;
|
|
93
|
-
/** Cleanup function for active touch listeners on document. */
|
|
94
|
-
private touchCleanup;
|
|
95
|
-
/**
|
|
96
|
-
* Cleanup function for active pointer-drag listeners on the
|
|
97
|
-
* captured element. Set while a pointer drag is in progress so
|
|
98
|
-
* `destroy()` can tear the drag down cleanly if the consumer
|
|
99
|
-
* unmounts mid-drag. Cleared on pointerup/lostpointercapture.
|
|
100
|
-
*/
|
|
101
|
-
private pointerCleanup;
|
|
102
|
-
/** Last tap info for double-tap detection. */
|
|
103
|
-
private lastTap;
|
|
104
|
-
/** Timer for the zoom animation state (double-tap). */
|
|
105
|
-
private zoomTimer;
|
|
106
|
-
/** Timer for wheel gesture debounce. */
|
|
107
|
-
private wheelGestureTimer;
|
|
108
|
-
/** Whether a wheel gesture is currently active. */
|
|
109
|
-
private wheelGestureActive;
|
|
110
|
-
/** Current requestAnimationFrame ID. */
|
|
111
|
-
private rafId;
|
|
112
|
-
constructor(options: InteractionControllerOptions);
|
|
113
|
-
/** Read minZoom lazily so option changes take effect immediately. */
|
|
114
|
-
private get minZoom();
|
|
115
|
-
/** Read maxZoom lazily so option changes take effect immediately. */
|
|
116
|
-
private get maxZoom();
|
|
117
|
-
/** Read zoomSpeed lazily so option changes take effect immediately. */
|
|
118
|
-
private get zoomSpeed();
|
|
119
|
-
/** Read keyboardStep lazily so option changes take effect immediately. */
|
|
120
|
-
private get keyboardStep();
|
|
121
|
-
/**
|
|
122
|
-
* Get the keyboard pan step, including modifier-based coarse movement.
|
|
123
|
-
*
|
|
124
|
-
* @param event The native KeyboardEvent.
|
|
125
|
-
* @return The normalized pan step.
|
|
126
|
-
*/
|
|
127
|
-
private getKeyboardStep;
|
|
128
|
-
/** Read doubleTapZoom lazily so option changes take effect immediately. */
|
|
129
|
-
private get doubleTapZoom();
|
|
130
|
-
/**
|
|
131
|
-
* Update the drag/zoom status and notify via callback if changed.
|
|
132
|
-
*
|
|
133
|
-
* @param update Partial status with isDragging and/or isZooming.
|
|
134
|
-
*/
|
|
135
|
-
private setStatus;
|
|
136
|
-
/**
|
|
137
|
-
* Handle a pointer-down event on the container element.
|
|
138
|
-
*
|
|
139
|
-
* Initiates a drag (pan) interaction. Captures the pointer on the
|
|
140
|
-
* provided element and registers pointermove/pointerup/lostpointercapture
|
|
141
|
-
* listeners for the duration of the drag.
|
|
142
|
-
*
|
|
143
|
-
* @param e The native PointerEvent.
|
|
144
|
-
* @param el The DOM element to capture the pointer on.
|
|
145
|
-
*/
|
|
146
|
-
handlePointerDown(e: PointerEvent, el: HTMLElement): void;
|
|
147
|
-
/**
|
|
148
|
-
* Handle a wheel event on the container element.
|
|
149
|
-
*
|
|
150
|
-
* Implements focal-point zoom: the point under the cursor stays
|
|
151
|
-
* stationary on screen while the zoom level changes.
|
|
152
|
-
*
|
|
153
|
-
* Must be registered with `{ passive: false }` to allow preventDefault.
|
|
154
|
-
*
|
|
155
|
-
* @param e The native WheelEvent.
|
|
156
|
-
*/
|
|
157
|
-
handleWheel(e: WheelEvent): void;
|
|
158
|
-
/**
|
|
159
|
-
* Handle a touch-start event on the container element.
|
|
160
|
-
*
|
|
161
|
-
* Supports single-finger pan, two-finger pinch zoom, and
|
|
162
|
-
* double-tap to toggle between fit and 2x zoom. Registers
|
|
163
|
-
* touchmove/touchend/touchcancel on the provided document for the
|
|
164
|
-
* duration of the gesture.
|
|
165
|
-
*
|
|
166
|
-
* @param e The native TouchEvent.
|
|
167
|
-
* @param containerRect The bounding rect of the container element.
|
|
168
|
-
* @param doc The document to register move/end listeners on.
|
|
169
|
-
* Defaults to globalThis.document. Pass the iframe's
|
|
170
|
-
* contentDocument when running inside an iframe.
|
|
171
|
-
*/
|
|
172
|
-
handleTouchStart(e: TouchEvent, containerRect: DOMRect, doc?: Document): void;
|
|
173
|
-
private handleTouchMove;
|
|
174
|
-
private tryDoubleTap;
|
|
175
|
-
/**
|
|
176
|
-
* Handle a keydown event on the container element.
|
|
177
|
-
*
|
|
178
|
-
* Supports arrow keys for panning, +/- for zoom, and r/R for rotation.
|
|
179
|
-
*
|
|
180
|
-
* @param e The native KeyboardEvent.
|
|
181
|
-
*/
|
|
182
|
-
handleKeyDown(e: KeyboardEvent): void;
|
|
183
|
-
/**
|
|
184
|
-
* Clean up all timers, animation frames, and active touch listeners.
|
|
185
|
-
*
|
|
186
|
-
* Must be called when the controller is no longer needed (e.g., on
|
|
187
|
-
* component unmount or element removal).
|
|
188
|
-
*/
|
|
189
|
-
destroy(): void;
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=interaction-controller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA6CnE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,0DAA0D;IAC1D,MAAM,EAAE,CAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAClC,sDAAsD;IACtD,cAAc,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IAC/D,iCAAiC;IACjC,YAAY,EAAE,CAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAM,IAAI,CAAC;IAC5C,qCAAqC;IACrC,UAAU,CAAC,EAAE,CAAE,SAAS,EAAE,YAAY,GAAG,UAAU,KAAM,IAAI,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC5C,sEAAsE;IACtE,QAAQ,EAAE,MAAM,YAAY,CAAC;IAC7B,6EAA6E;IAC7E,OAAO,EAAE,yBAAyB,CAAC;IACnC,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,qEAAqE;IACrE,YAAY,EAAE,MAAM,IAAI,GAAG,SAAS,CAAC;IACrC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAE,MAAM,EAAE,iBAAiB,KAAM,IAAI,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,qBAAqB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IAEvD,gCAAgC;IAChC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAE1B,qDAAqD;IACrD,OAAO,CAAC,IAAI,CAKI;IAEhB,oDAAoD;IACpD,OAAO,CAAC,KAAK,CAoBG;IAEhB,+DAA+D;IAC/D,OAAO,CAAC,YAAY,CAA+B;IAEnD;;;;;OAKG;IACH,OAAO,CAAC,cAAc,CAA+B;IAErD,8CAA8C;IAC9C,OAAO,CAAC,OAAO,CAIC;IAEhB,uDAAuD;IACvD,OAAO,CAAC,SAAS,CAA8C;IAE/D,wCAAwC;IACxC,OAAO,CAAC,iBAAiB,CAA8C;IAEvE,mDAAmD;IACnD,OAAO,CAAC,kBAAkB,CAAS;IAEnC,wCAAwC;IACxC,OAAO,CAAC,KAAK,CAAK;IAElB,YAAa,OAAO,EAAE,4BAA4B,EAEjD;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,uEAAuE;IACvE,OAAO,KAAK,SAAS,GAEpB;IAED,0EAA0E;IAC1E,OAAO,KAAK,YAAY,GAEvB;IAED;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAMvB,2EAA2E;IAC3E,OAAO,KAAK,aAAa,GAExB;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS;IA0BjB;;;;;;;;;OASG;IACH,iBAAiB,CAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,GAAI,IAAI,CAyG1D;IAED;;;;;;;;;OASG;IACH,WAAW,CAAE,CAAC,EAAE,UAAU,GAAI,IAAI,CA0DjC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CACf,CAAC,EAAE,UAAU,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,GAAE,QAAmB,GACtB,IAAI,CA6FN;IAOD,OAAO,CAAC,eAAe,CA2JrB;IAQF,OAAO,CAAC,YAAY;IAkFpB;;;;;;OAMG;IACH,aAAa,CAAE,CAAC,EAAE,aAAa,GAAI,IAAI,CAwHtC;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAmBd;CACD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizes a rotation value to the range [0, 360).
|
|
3
|
-
*
|
|
4
|
-
* Negative rotations are converted to their positive clockwise equivalent.
|
|
5
|
-
* For example, -90 becomes 270, -45 becomes 315, and 450 becomes 90.
|
|
6
|
-
*
|
|
7
|
-
* @param degrees The rotation value in degrees.
|
|
8
|
-
* @return The normalized rotation in the range [0, 360).
|
|
9
|
-
*/
|
|
10
|
-
export declare function normalizeRotation(degrees: number): number;
|
|
11
|
-
/**
|
|
12
|
-
* Converts an angle from degrees to radians.
|
|
13
|
-
*
|
|
14
|
-
* @param degrees The angle in degrees.
|
|
15
|
-
* @return The angle in radians.
|
|
16
|
-
*/
|
|
17
|
-
export declare function degreesToRadians(degrees: number): number;
|
|
18
|
-
//# sourceMappingURL=rotation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rotation.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/core/math/rotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAE,OAAO,EAAE,MAAM,GAAI,MAAM,CAM3D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,MAAM,GAAI,MAAM,CAE1D"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { CropperState, NormalizedRect, Size } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Returns `value` if it's finite and within `[-MAX_SAFE_MAGNITUDE,
|
|
4
|
-
* MAX_SAFE_MAGNITUDE]`, otherwise `fallback`. Stricter than `Number.isFinite`
|
|
5
|
-
* because extreme finite magnitudes (e.g. `Number.MAX_VALUE`) overflow
|
|
6
|
-
* downstream trig/matrix math even though the spec reports them as finite.
|
|
7
|
-
*
|
|
8
|
-
* Note: sub-normal denormals (e.g. `Number.MIN_VALUE`) are accepted by this
|
|
9
|
-
* function — they don't overflow on their own. Protection against divisions
|
|
10
|
-
* by sub-normal values lives in `sanitizeCropperState`'s zoom guard.
|
|
11
|
-
*
|
|
12
|
-
* @param value The candidate value.
|
|
13
|
-
* @param fallback The replacement to return when `value` is unsafe.
|
|
14
|
-
* @return Either `value` or `fallback`.
|
|
15
|
-
*/
|
|
16
|
-
export declare function safeBoundedNumber(value: number, fallback: number): number;
|
|
17
|
-
/**
|
|
18
|
-
* Returns `true` when `value` is finite and within `[-MAX_SAFE_MAGNITUDE,
|
|
19
|
-
* MAX_SAFE_MAGNITUDE]`. The predicate companion to {@link safeBoundedNumber}
|
|
20
|
-
* for callers that need to short-circuit rather than substitute a fallback.
|
|
21
|
-
*
|
|
22
|
-
* @param value The candidate value.
|
|
23
|
-
* @return Whether `value` is safe to use in math.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isSafeNumber(value: number): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Returns `true` when both dimensions are finite and within the safe
|
|
28
|
-
* range `[Number.EPSILON, MAX_SAFE_MAGNITUDE]`. The lower bound matters
|
|
29
|
-
* because sub-normal dimensions (e.g. `Number.MIN_VALUE`) pass `> 0` but
|
|
30
|
-
* make `container / dim` overflow to `Infinity` downstream in
|
|
31
|
-
* `getImageFit` / `createCamera`. Use this to short-circuit math that
|
|
32
|
-
* would otherwise produce non-finite output.
|
|
33
|
-
*
|
|
34
|
-
* @param size The size to check.
|
|
35
|
-
* @return Whether `size` is safe to use in math.
|
|
36
|
-
*/
|
|
37
|
-
export declare function isValidSize(size: Size): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Returns a copy of `rect` with every numeric field replaced by a safe
|
|
40
|
-
* value via {@link safeBoundedNumber}. Returns the same reference when no
|
|
41
|
-
* field needed substitution so callers can keep their reference-equality
|
|
42
|
-
* short-circuits intact for clean inputs.
|
|
43
|
-
*
|
|
44
|
-
* @param rect The rect to sanitize.
|
|
45
|
-
* @return A rect with all numeric fields finite.
|
|
46
|
-
*/
|
|
47
|
-
export declare function sanitizeRect(rect: NormalizedRect): NormalizedRect;
|
|
48
|
-
/**
|
|
49
|
-
* Returns a copy of `state` with the cropper-math numeric fields replaced
|
|
50
|
-
* by safe defaults. Covers `pan`, `zoom`, `rotation`, the matching base
|
|
51
|
-
* pose, and `cropRect`. The `state.image` numeric fields (naturalWidth /
|
|
52
|
-
* naturalHeight) are intentionally NOT sanitized — image dimensions reach
|
|
53
|
-
* the math layer as a separate `imageSize` argument, and cloning the
|
|
54
|
-
* image object here would break the reducer's reference-equality
|
|
55
|
-
* short-circuit.
|
|
56
|
-
*
|
|
57
|
-
* Returns the same `state` reference when no field needed substitution
|
|
58
|
-
* so callers in hot paths (every pointermove via `restrictPanZoom`) can
|
|
59
|
-
* keep their reference-equality optimizations. Sub-object references
|
|
60
|
-
* (`pan`, `basePan`, `cropRect`) are also preserved when their fields
|
|
61
|
-
* are individually clean.
|
|
62
|
-
*
|
|
63
|
-
* @param state The cropper state to sanitize.
|
|
64
|
-
* @return A cropper state with the math-relevant numeric fields finite.
|
|
65
|
-
*/
|
|
66
|
-
export declare function sanitizeCropperState(state: CropperState): CropperState;
|
|
67
|
-
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/core/math/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAUnE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAI,MAAM,CAQ3E;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAE,KAAK,EAAE,MAAM,GAAI,OAAO,CAErD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAE,IAAI,EAAE,IAAI,GAAI,OAAO,CASjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAE,IAAI,EAAE,cAAc,GAAI,cAAc,CAcnE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,YAAY,GAAI,YAAY,CA2CxE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { CropperState, CropperAction } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Build the reducer action that produces a "cursorless" zoom — zoom
|
|
4
|
-
* anchored at the current crop-rect center, with pan clamped to keep
|
|
5
|
-
* the image covering the crop.
|
|
6
|
-
*
|
|
7
|
-
* The slider, the `+`/`-` keys, and the toolbar buttons have no
|
|
8
|
-
* natural focal point (unlike wheel/pinch zoom), so they default to
|
|
9
|
-
* the crop center. Returns `null` when the clamped zoom matches the
|
|
10
|
-
* current zoom (no-op).
|
|
11
|
-
*
|
|
12
|
-
* Extracted so multiple hooks (the pure `useCropperReducer` and the
|
|
13
|
-
* composite `useMediaEditorState`) can share the math without
|
|
14
|
-
* duplicating it.
|
|
15
|
-
*
|
|
16
|
-
* @param state The current cropper state.
|
|
17
|
-
* @param requestedZoom The zoom value the caller asked for.
|
|
18
|
-
* @return A `SET_ZOOM_AT_POINT` action, or `null` if no change is required.
|
|
19
|
-
*/
|
|
20
|
-
export declare function buildFocalPointZoomAction(state: CropperState, requestedZoom: number): CropperAction | null;
|
|
21
|
-
//# sourceMappingURL=setter-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setter-helpers.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/setter-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAC;AAI5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,YAAY,EACnB,aAAa,EAAE,MAAM,GACnB,aAAa,GAAG,IAAI,CAqCtB"}
|
|
@@ -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"}
|