@wordpress/media-editor 0.20.0 → 0.22.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 +28 -0
- package/README.md +2 -1
- package/build/components/media-editor/index.cjs +533 -695
- package/build/components/media-editor/index.cjs.map +1 -7
- package/build/components/media-editor/use-crop-options.cjs +43 -58
- package/build/components/media-editor/use-crop-options.cjs.map +1 -7
- package/build/components/media-editor/use-save-media-editor.cjs +111 -185
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -7
- package/build/components/media-editor-canvas/index.cjs +122 -124
- package/build/components/media-editor-canvas/index.cjs.map +1 -7
- package/build/components/media-editor-crop-panel/index.cjs +65 -68
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -7
- package/build/components/media-editor-fine-rotation/index.cjs +62 -72
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -7
- package/build/components/media-editor-image-controls/index.cjs +183 -257
- package/build/components/media-editor-image-controls/index.cjs.map +1 -7
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +119 -157
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -7
- package/build/components/media-editor-modal/build-modifiers.cjs +107 -88
- package/build/components/media-editor-modal/build-modifiers.cjs.map +1 -7
- package/build/components/media-editor-modal/index.cjs +112 -153
- package/build/components/media-editor-modal/index.cjs.map +1 -7
- package/build/components/media-editor-provider/index.cjs +32 -54
- package/build/components/media-editor-provider/index.cjs.map +1 -7
- package/build/components/media-form/index.cjs +77 -78
- package/build/components/media-form/index.cjs.map +1 -7
- package/build/components/media-preview/index.cjs +114 -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/image-editor/core/camera.cjs +257 -205
- package/build/image-editor/core/camera.cjs.map +1 -7
- package/build/image-editor/core/constants.cjs +127 -102
- package/build/image-editor/core/constants.cjs.map +1 -7
- package/build/image-editor/core/containment.cjs +275 -262
- package/build/image-editor/core/containment.cjs.map +1 -7
- package/build/image-editor/core/crop-rect.cjs +33 -44
- package/build/image-editor/core/crop-rect.cjs.map +1 -7
- package/build/image-editor/core/export/canvas-renderer.cjs +165 -135
- package/build/image-editor/core/export/canvas-renderer.cjs.map +1 -7
- package/build/image-editor/core/index.cjs +88 -61
- package/build/image-editor/core/interaction-controller.cjs +583 -646
- package/build/image-editor/core/interaction-controller.cjs.map +1 -7
- package/build/image-editor/core/math/rotation.cjs +26 -35
- package/build/image-editor/core/math/rotation.cjs.map +1 -7
- package/build/image-editor/core/math/sanitize.cjs +124 -80
- package/build/image-editor/core/math/sanitize.cjs.map +1 -7
- package/build/image-editor/core/setter-helpers.cjs +57 -60
- package/build/image-editor/core/setter-helpers.cjs.map +1 -7
- package/build/image-editor/core/source-region.cjs +220 -190
- package/build/image-editor/core/source-region.cjs.map +1 -7
- package/build/image-editor/core/state.cjs +278 -265
- package/build/image-editor/core/state.cjs.map +1 -7
- package/build/image-editor/core/stencil-math.cjs +193 -206
- package/build/image-editor/core/stencil-math.cjs.map +1 -7
- package/build/image-editor/core/transform-style.cjs +39 -48
- package/build/image-editor/core/transform-style.cjs.map +1 -7
- package/build/image-editor/core/transforms/pipeline.cjs +36 -38
- package/build/image-editor/core/transforms/pipeline.cjs.map +1 -7
- package/build/image-editor/core/types.cjs +4 -18
- package/build/image-editor/core/viewport-state.cjs +31 -45
- package/build/image-editor/core/viewport-state.cjs.map +1 -7
- package/build/image-editor/index.cjs +65 -64
- package/build/image-editor/react/components/cropper-provider.cjs +44 -45
- package/build/image-editor/react/components/cropper-provider.cjs.map +1 -7
- package/build/image-editor/react/components/cropper.cjs +583 -720
- package/build/image-editor/react/components/cropper.cjs.map +1 -7
- package/build/image-editor/react/components/index.cjs +22 -33
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +135 -160
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +28 -59
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +58 -88
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +361 -420
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +1 -7
- package/build/image-editor/react/components/viewport-provider.cjs +21 -46
- package/build/image-editor/react/components/viewport-provider.cjs.map +1 -7
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +76 -67
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +1 -7
- package/build/image-editor/react/hooks/index.cjs +16 -31
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +90 -146
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-cropper-controller.cjs +80 -0
- package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +1 -0
- package/build/image-editor/react/hooks/use-interaction.cjs +179 -205
- package/build/image-editor/react/hooks/use-interaction.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-transform-style.cjs +20 -34
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-viewport-state.cjs +36 -47
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +1 -7
- package/build/image-editor/react/visually-hidden-style.cjs +21 -38
- package/build/image-editor/react/visually-hidden-style.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 +53 -0
- package/build/state/aspect-ratio-presets.cjs.map +1 -0
- package/build/state/composite-reducer.cjs +136 -89
- package/build/state/composite-reducer.cjs.map +1 -7
- package/build/state/index.cjs +63 -47
- 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 +12 -31
- package/build/state/types.cjs.map +1 -7
- package/build/state/use-media-editor-state.cjs +261 -281
- 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 +490 -682
- package/build-module/components/media-editor/index.mjs.map +1 -7
- package/build-module/components/media-editor/use-crop-options.mjs +38 -33
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -7
- package/build-module/components/media-editor/use-save-media-editor.mjs +89 -157
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -7
- package/build-module/components/media-editor-canvas/index.mjs +97 -95
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -7
- package/build-module/components/media-editor-crop-panel/index.mjs +44 -43
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -7
- package/build-module/components/media-editor-fine-rotation/index.mjs +39 -45
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -7
- package/build-module/components/media-editor-image-controls/index.mjs +172 -237
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -7
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +112 -137
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-modal/build-modifiers.mjs +103 -64
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +1 -7
- package/build-module/components/media-editor-modal/index.mjs +88 -122
- package/build-module/components/media-editor-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-provider/index.mjs +26 -28
- package/build-module/components/media-editor-provider/index.mjs.map +1 -7
- package/build-module/components/media-form/index.mjs +69 -54
- package/build-module/components/media-form/index.mjs.map +1 -7
- package/build-module/components/media-preview/index.mjs +105 -89
- 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/image-editor/core/camera.mjs +245 -178
- package/build-module/image-editor/core/camera.mjs.map +1 -7
- package/build-module/image-editor/core/constants.mjs +110 -64
- package/build-module/image-editor/core/constants.mjs.map +1 -7
- package/build-module/image-editor/core/containment.mjs +265 -237
- package/build-module/image-editor/core/containment.mjs.map +1 -7
- package/build-module/image-editor/core/crop-rect.mjs +29 -20
- package/build-module/image-editor/core/crop-rect.mjs.map +1 -7
- package/build-module/image-editor/core/export/canvas-renderer.mjs +155 -105
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +1 -7
- package/build-module/image-editor/core/index.mjs +5 -34
- package/build-module/image-editor/core/interaction-controller.mjs +579 -628
- package/build-module/image-editor/core/interaction-controller.mjs.map +1 -7
- package/build-module/image-editor/core/math/rotation.mjs +21 -10
- package/build-module/image-editor/core/math/rotation.mjs.map +1 -7
- package/build-module/image-editor/core/math/sanitize.mjs +116 -52
- package/build-module/image-editor/core/math/sanitize.mjs.map +1 -7
- package/build-module/image-editor/core/setter-helpers.mjs +52 -35
- package/build-module/image-editor/core/setter-helpers.mjs.map +1 -7
- package/build-module/image-editor/core/source-region.mjs +210 -160
- package/build-module/image-editor/core/source-region.mjs.map +1 -7
- package/build-module/image-editor/core/state.mjs +271 -243
- package/build-module/image-editor/core/state.mjs.map +1 -7
- package/build-module/image-editor/core/stencil-math.mjs +185 -178
- package/build-module/image-editor/core/stencil-math.mjs.map +1 -7
- package/build-module/image-editor/core/transform-style.mjs +34 -23
- package/build-module/image-editor/core/transform-style.mjs.map +1 -7
- package/build-module/image-editor/core/transforms/pipeline.mjs +29 -11
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +1 -7
- package/build-module/image-editor/core/types.mjs +0 -1
- package/build-module/image-editor/core/viewport-state.mjs +26 -20
- package/build-module/image-editor/core/viewport-state.mjs.map +1 -7
- package/build-module/image-editor/index.mjs +3 -38
- package/build-module/image-editor/react/components/cropper-provider.mjs +38 -21
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +1 -7
- package/build-module/image-editor/react/components/cropper.mjs +550 -696
- package/build-module/image-editor/react/components/cropper.mjs.map +1 -7
- package/build-module/image-editor/react/components/index.mjs +1 -7
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +130 -135
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +24 -35
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +54 -64
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +355 -407
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +1 -7
- package/build-module/image-editor/react/components/viewport-provider.mjs +15 -22
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +72 -43
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/index.mjs +2 -7
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +83 -119
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +75 -0
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +1 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs +175 -183
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +15 -9
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +32 -26
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +1 -7
- package/build-module/image-editor/react/visually-hidden-style.mjs +17 -14
- package/build-module/image-editor/react/visually-hidden-style.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 +48 -0
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -0
- package/build-module/state/composite-reducer.mjs +114 -75
- package/build-module/state/composite-reducer.mjs.map +1 -7
- package/build-module/state/index.mjs +5 -25
- 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 +8 -7
- package/build-module/state/types.mjs.map +1 -7
- package/build-module/state/use-media-editor-state.mjs +256 -273
- 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 +41 -4
- package/build-style/style.css +41 -4
- package/build-types/components/media-editor/index.d.ts +6 -1
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +0 -1
- 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.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +6 -5
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts +7 -2
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-provider/index.d.ts +7 -1
- package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts +5 -2
- 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/image-editor/core/constants.d.ts +0 -1
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/index.d.ts +1 -1
- package/build-types/image-editor/core/index.d.ts.map +1 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +1 -1
- package/build-types/image-editor/core/types.d.ts +1 -1
- package/build-types/image-editor/index.d.ts +7 -6
- package/build-types/image-editor/index.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +2 -2
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +5 -14
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +2 -2
- package/build-types/image-editor/react/hooks/index.d.ts +2 -2
- package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/{use-cropper-reducer.d.ts → use-cropper-controller.d.ts} +12 -12
- package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts.map +1 -0
- package/build-types/state/aspect-ratio-presets.d.ts +7 -0
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -0
- package/build-types/state/composite-reducer.d.ts +2 -2
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/index.d.ts +2 -1
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +36 -6
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +16 -5
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/package.json +35 -24
- package/src/components/media-editor/index.tsx +226 -183
- package/src/components/media-editor/style.scss +19 -0
- package/src/components/media-editor/use-crop-options.ts +5 -4
- package/src/components/media-editor/use-save-media-editor.ts +2 -6
- package/src/components/media-editor-canvas/index.tsx +18 -28
- package/src/components/media-editor-crop-panel/index.tsx +17 -9
- package/src/components/media-editor-image-controls/index.tsx +4 -2
- package/src/components/media-editor-image-controls/style.scss +1 -1
- package/src/components/media-editor-modal/build-modifiers.ts +13 -7
- package/src/components/media-editor-modal/index.tsx +8 -1
- package/src/components/media-editor-modal/style.scss +1 -1
- package/src/components/media-editor-provider/index.tsx +8 -1
- package/src/components/media-form/index.tsx +48 -42
- package/src/components/media-preview/index.tsx +68 -25
- package/src/components/media-preview/style.scss +16 -2
- package/src/components/rotation-ruler/style.scss +6 -2
- package/src/components/rotation-ruler/use-ruler-drag.ts +6 -11
- package/src/image-editor/README.md +8 -8
- package/src/image-editor/core/constants.ts +0 -13
- package/src/image-editor/core/index.ts +1 -5
- package/src/image-editor/core/setter-helpers.ts +1 -1
- package/src/image-editor/core/types.ts +1 -1
- package/src/image-editor/docs/architecture.md +5 -1
- package/src/image-editor/docs/recipes.md +3 -3
- package/src/image-editor/index.ts +7 -16
- package/src/image-editor/react/components/cropper-provider.tsx +5 -5
- package/src/image-editor/react/components/cropper.tsx +20 -42
- package/src/image-editor/react/hooks/build-cropper-setters.ts +2 -2
- package/src/image-editor/react/hooks/index.ts +2 -2
- package/src/image-editor/react/hooks/{use-cropper-reducer.ts → use-cropper-controller.ts} +11 -11
- package/src/state/aspect-ratio-presets.ts +18 -0
- package/src/state/composite-reducer.ts +26 -13
- package/src/state/index.ts +3 -0
- package/src/state/types.ts +39 -11
- package/src/state/use-media-editor-state.ts +53 -16
- package/build/image-editor/core/index.cjs.map +0 -7
- package/build/image-editor/core/types.cjs.map +0 -7
- package/build/image-editor/index.cjs.map +0 -7
- package/build/image-editor/react/components/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/index.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/index.cjs.map +0 -7
- package/build/state/index.cjs.map +0 -7
- package/build/utils/index.cjs.map +0 -7
- package/build-module/image-editor/core/index.mjs.map +0 -7
- package/build-module/image-editor/core/types.mjs.map +0 -7
- package/build-module/image-editor/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/index.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/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/image-editor/react/hooks/use-cropper-reducer.d.ts.map +0 -1
- package/global.d.ts +0 -5
- package/src/components/media-editor/test/restore-original.browser.test.tsx +0 -227
- package/src/components/media-editor/test/use-crop-options.jsdom.test.tsx +0 -106
- package/src/components/media-editor-crop-panel/test/index.jsdom.test.tsx +0 -72
- package/src/components/media-editor-image-controls/test/index.jsdom.test.tsx +0 -186
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +0 -359
- package/src/components/media-editor-modal/test/index.jsdom.test.tsx +0 -182
- package/src/components/rotation-ruler/stories/index.story.tsx +0 -43
- package/src/components/rotation-ruler/test/index.jsdom.test.tsx +0 -140
- package/src/image-editor/core/export/test/canvas-renderer.jsdom.test.ts +0 -823
- package/src/image-editor/core/math/test/sanitize.ts +0 -242
- package/src/image-editor/core/test/camera.ts +0 -1218
- package/src/image-editor/core/test/interaction-controller.ts +0 -1299
- package/src/image-editor/core/test/preview-export-parity.ts +0 -249
- package/src/image-editor/core/test/render-camera-bridge.ts +0 -349
- package/src/image-editor/core/test/state.ts +0 -876
- package/src/image-editor/core/test/stencil-math.ts +0 -665
- package/src/image-editor/core/transforms/test/pipeline.ts +0 -267
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.browser.test.tsx +0 -438
- package/src/image-editor/react/components/test/cropper.browser.test.tsx +0 -1462
- package/src/image-editor/react/hooks/test/use-aria-announcer.jsdom.test.ts +0 -491
- package/src/image-editor/react/hooks/test/use-cropper-reducer.jsdom.test.ts +0 -1049
- package/src/image-editor/react/hooks/test/use-interaction.jsdom.test.ts +0 -213
- package/src/image-editor/react/hooks/test/use-transform-style.jsdom.test.ts +0 -140
- package/src/image-editor/stories/rectangle-crop.story.tsx +0 -1073
- package/src/image-editor/stories/style.module.css +0 -65
- package/src/state/test/use-media-editor-state.browser.test.tsx +0 -79
- package/src/state/test/use-media-editor-state.jsdom.test.ts +0 -386
- package/src/store/test/reducer.ts +0 -64
- package/tsconfig.build.json +0 -26
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -37
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/image-editor/core/source-region.ts"],
|
|
4
|
-
"sourcesContent": ["import { mat2d, vec2 } from 'gl-matrix';\nimport type {\n\tCropperState,\n\tHandlePosition,\n\tNormalizedRect,\n\tSize,\n} from './types';\nimport { createCamera, getRotatedBBox, getVisibleBounds } from './camera';\nimport { isValidSize, sanitizeCropperState } from './math/sanitize';\nimport { normalizeRotation } from './math/rotation';\n\n/**\n * The selected image region in source-pixel coordinates.\n */\nexport interface SourceRegion {\n\t/** X offset in source pixels. */\n\tx: number;\n\t/** Y offset in source pixels. */\n\ty: number;\n\t/** Width in source pixels. */\n\twidth: number;\n\t/** Height in source pixels. */\n\theight: number;\n\t/** Rotation in degrees (0-360). */\n\trotation: number;\n\t/** Flip state. */\n\tflip: { horizontal: boolean; vertical: boolean };\n\t/** Zoom factor applied. */\n\tzoom: number;\n}\n\n/**\n * Get the selected image region in source-pixel coordinates.\n *\n * Converts the current crop state (normalized visual space) to the actual\n * region of the original image that's selected. This is the bridge between\n * the cropper's internal coordinate system and external tools (image\n * processing libraries, AI APIs, server-side processing) that work in\n * source-pixel coordinates.\n *\n * The returned rectangle accounts for pan, zoom, and the crop rect position,\n * but expresses the crop in the unrotated image's coordinate space. Rotation\n * and flip are included as separate fields since they represent transforms,\n * not a region.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @return The selected region in source pixels plus rotation/flip metadata.\n */\nexport function getSourceRegion(\n\tstate: CropperState,\n\timageSize: Size\n): SourceRegion {\n\t// Sanitize before the zero-size short-circuit so the early return\n\t// doesn't leak raw non-finite state.rotation or state.zoom out\n\t// through the metadata fields. (state.flip is boolean and isn't\n\t// at risk of NaN propagation.)\n\tconst safeState = sanitizeCropperState( state );\n\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\trotation: safeState.rotation,\n\t\t\tflip: { ...safeState.flip },\n\t\t\tzoom: safeState.zoom,\n\t\t};\n\t}\n\n\t// Use a synthetic 1:1 container so the camera maps normalized coords\n\t// to a known pixel space. The container size cancels out.\n\tconst syntheticContainer: Size = { width: 1000, height: 1000 };\n\tconst camera = createCamera( safeState, syntheticContainer, imageSize );\n\n\t// Inverse camera maps screen pixels back to normalized [0,1] world coords.\n\tconst inv = mat2d.create();\n\tmat2d.invert( inv, camera );\n\n\t// The crop rect center in screen space. We need the base camera\n\t// (zoom=1, no pan) to locate the visual bounds, then place the\n\t// crop rect within them.\n\tconst baseCamera = createCamera(\n\t\t{ ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },\n\t\tsyntheticContainer,\n\t\timageSize\n\t);\n\tconst visibleBounds = getVisibleBounds( baseCamera );\n\n\tconst cropRect = safeState.cropRect;\n\tconst cropCenterScreenX =\n\t\tvisibleBounds.left +\n\t\t( cropRect.x + cropRect.width / 2 ) * visibleBounds.width;\n\tconst cropCenterScreenY =\n\t\tvisibleBounds.top +\n\t\t( cropRect.y + cropRect.height / 2 ) * visibleBounds.height;\n\n\t// Transform crop center through inverse camera to get source position.\n\tconst srcCenter = vec2.create();\n\tvec2.transformMat2d(\n\t\tsrcCenter,\n\t\t[ cropCenterScreenX, cropCenterScreenY ],\n\t\tinv\n\t);\n\n\t// Crop rect size in the snap-rotation visual space, divided by zoom\n\t// for source-pixel dimensions. Matches the stencil's reference frame.\n\tconst snapRotation = Math.round( safeState.rotation / 90 ) * 90;\n\tconst { width: rotW, height: rotH } = getRotatedBBox(\n\t\timageSize.width,\n\t\timageSize.height,\n\t\tsnapRotation\n\t);\n\tconst sourceW = ( cropRect.width * rotW ) / safeState.zoom;\n\tconst sourceH = ( cropRect.height * rotH ) / safeState.zoom;\n\n\treturn {\n\t\tx: srcCenter[ 0 ] * imageSize.width - sourceW / 2,\n\t\ty: srcCenter[ 1 ] * imageSize.height - sourceH / 2,\n\t\twidth: sourceW,\n\t\theight: sourceH,\n\t\trotation: safeState.rotation,\n\t\tflip: { ...safeState.flip },\n\t\tzoom: safeState.zoom,\n\t};\n}\n\n/**\n * Convert a source-pixel region back to the cropper's normalized crop rect.\n *\n * The math intentionally mirrors `getSourceRegion`: map the requested source\n * center through the current camera, then express that screen point inside the\n * same base visible bounds used to position crop overlays.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param region The source-pixel region to represent as a crop rect.\n * @return The normalized crop rect, or null when inputs cannot be mapped.\n */\nfunction getCropRectFromSourceRegion(\n\tstate: CropperState,\n\timageSize: Size,\n\tregion: SourceRegion\n): NormalizedRect | null {\n\tif (\n\t\t! isValidSize( imageSize ) ||\n\t\tregion.width <= 0 ||\n\t\tregion.height <= 0\n\t) {\n\t\treturn null;\n\t}\n\n\tconst safeState = sanitizeCropperState( state );\n\tconst syntheticContainer: Size = { width: 1000, height: 1000 };\n\tconst baseCamera = createCamera(\n\t\t{ ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },\n\t\tsyntheticContainer,\n\t\timageSize\n\t);\n\tconst visibleBounds = getVisibleBounds( baseCamera );\n\tif ( visibleBounds.width <= 0 || visibleBounds.height <= 0 ) {\n\t\treturn null;\n\t}\n\n\tconst sourceCenter = vec2.fromValues(\n\t\t( region.x + region.width / 2 ) / imageSize.width,\n\t\t( region.y + region.height / 2 ) / imageSize.height\n\t);\n\tconst screenCenter = vec2.create();\n\tconst camera = createCamera( safeState, syntheticContainer, imageSize );\n\tvec2.transformMat2d( screenCenter, sourceCenter, camera );\n\n\tconst snapRotation = Math.round( safeState.rotation / 90 ) * 90;\n\tconst { width: rotW, height: rotH } = getRotatedBBox(\n\t\timageSize.width,\n\t\timageSize.height,\n\t\tsnapRotation\n\t);\n\tif ( rotW <= 0 || rotH <= 0 ) {\n\t\treturn null;\n\t}\n\n\tconst width = ( region.width * safeState.zoom ) / rotW;\n\tconst height = ( region.height * safeState.zoom ) / rotH;\n\tconst centerX =\n\t\t( screenCenter[ 0 ] - visibleBounds.left ) / visibleBounds.width;\n\tconst centerY =\n\t\t( screenCenter[ 1 ] - visibleBounds.top ) / visibleBounds.height;\n\n\treturn {\n\t\tx: centerX - width / 2,\n\t\ty: centerY - height / 2,\n\t\twidth,\n\t\theight,\n\t};\n}\n\ninterface SourcePixelSnapEdges {\n\tleft: boolean;\n\ttop: boolean;\n\tright: boolean;\n\tbottom: boolean;\n}\n\nconst CARDINAL_ROTATION_EPSILON = 1e-6;\n\n/**\n * Check whether a rotation is effectively at a 90-degree stop.\n *\n * @param rotation The rotation angle in degrees.\n * @return Whether the rotation is close enough to a cardinal angle.\n */\nfunction isCardinalRotation( rotation: number ): boolean {\n\tconst normalizedRotation = normalizeRotation( rotation );\n\tconst nearestCardinal = Math.round( normalizedRotation / 90 ) * 90;\n\treturn (\n\t\tMath.abs( normalizedRotation - nearestCardinal ) <\n\t\tCARDINAL_ROTATION_EPSILON\n\t);\n}\n\n/**\n * Snap a crop rect so the selected source-region edges land on whole pixels.\n *\n * This is a display-time affordance for visible pixel grids; it does not alter\n * pan/zoom/rotation. Callers decide when snapping is appropriate.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param cropRect The candidate crop rect from resize math.\n * @param handle The active resize handle. Only edges moved by the handle snap.\n * @return A crop rect whose selected source-region edges are whole pixels.\n */\nexport function snapCropRectToSourcePixels(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect,\n\thandle: HandlePosition\n): NormalizedRect {\n\tconst safeState = sanitizeCropperState( state );\n\tif ( ! isCardinalRotation( safeState.rotation ) ) {\n\t\treturn cropRect;\n\t}\n\n\treturn snapCropRectEdgesToSourcePixels( safeState, imageSize, cropRect, {\n\t\tleft: handle.includes( 'w' ),\n\t\ttop: handle.includes( 'n' ),\n\t\tright: handle.includes( 'e' ),\n\t\tbottom: handle.includes( 's' ),\n\t} );\n}\n\n/**\n * Snap all source-region edges for a crop rect to the nearest whole pixels.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param cropRect The crop rect to align to the source-pixel grid.\n * @return A crop rect whose source-region edges are whole pixels.\n */\nexport function snapCropRectToSourcePixelGrid(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect\n): NormalizedRect {\n\treturn snapCropRectEdgesToSourcePixels( state, imageSize, cropRect, {\n\t\tleft: true,\n\t\ttop: true,\n\t\tright: true,\n\t\tbottom: true,\n\t} );\n}\n\nfunction snapCropRectEdgesToSourcePixels(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect,\n\tedges: SourcePixelSnapEdges\n): NormalizedRect {\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn cropRect;\n\t}\n\n\tconst stateWithCrop = sanitizeCropperState( { ...state, cropRect } );\n\tconst region = getSourceRegion( stateWithCrop, imageSize );\n\tconst shouldSnapX = edges.left || edges.right;\n\tconst shouldSnapY = edges.top || edges.bottom;\n\tconst left = edges.left ? Math.round( region.x ) : region.x;\n\tconst top = edges.top ? Math.round( region.y ) : region.y;\n\tconst right = edges.right\n\t\t? Math.round( region.x + region.width )\n\t\t: region.x + region.width;\n\tconst bottom = edges.bottom\n\t\t? Math.round( region.y + region.height )\n\t\t: region.y + region.height;\n\tif ( right <= left || bottom <= top ) {\n\t\treturn cropRect;\n\t}\n\n\tconst snappedCropRect = getCropRectFromSourceRegion(\n\t\tstateWithCrop,\n\t\timageSize,\n\t\t{\n\t\t\t...region,\n\t\t\tx: left,\n\t\t\ty: top,\n\t\t\twidth: right - left,\n\t\t\theight: bottom - top,\n\t\t}\n\t);\n\tif ( ! snappedCropRect ) {\n\t\treturn cropRect;\n\t}\n\n\treturn {\n\t\tx: shouldSnapX ? snappedCropRect.x : cropRect.x,\n\t\ty: shouldSnapY ? snappedCropRect.y : cropRect.y,\n\t\twidth: shouldSnapX ? snappedCropRect.width : cropRect.width,\n\t\theight: shouldSnapY ? snappedCropRect.height : cropRect.height,\n\t};\n}\n\n/**\n * The selected crop region expressed as percentages of the source image.\n */\nexport interface SourceRegionPercent {\n\t/** X offset as a percentage (0–100) of the source image width. */\n\tx: number;\n\t/** Y offset as a percentage (0–100) of the source image height. */\n\ty: number;\n\t/** Width as a percentage (0–100) of the source image width. */\n\twidth: number;\n\t/** Height as a percentage (0–100) of the source image height. */\n\theight: number;\n}\n\n/**\n * Get the selected image region as percentages of the source image dimensions.\n *\n * Returns `{ x, y, width, height }` where each value is a percentage (0–100)\n * of the source image's natural width or height. This format is compatible\n * with the WordPress REST API attachments `/edit` endpoint and CSS-based\n * crop workflows.\n *\n * Internally delegates to `getSourceRegion` and divides by the image\n * dimensions, so accuracy is identical.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @return The crop region as percentages (0–100).\n */\nexport function getSourceRegionPercent(\n\tstate: CropperState,\n\timageSize: Size\n): SourceRegionPercent {\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn { x: 0, y: 0, width: 0, height: 0 };\n\t}\n\tconst region = getSourceRegion( state, imageSize );\n\treturn {\n\t\tx: ( region.x / imageSize.width ) * 100,\n\t\ty: ( region.y / imageSize.height ) * 100,\n\t\twidth: ( region.width / imageSize.width ) * 100,\n\t\theight: ( region.height / imageSize.height ) * 100,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4B;AAO5B,oBAA+D;AAC/D,sBAAkD;AAClD,sBAAkC;AAwC3B,SAAS,gBACf,OACA,WACe;AAKf,QAAM,gBAAY,sCAAsB,KAAM;AAE9C,MAAK,KAAE,6BAAa,SAAU,GAAI;AACjC,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG;AAAA,MACH,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU,UAAU;AAAA,MACpB,MAAM,EAAE,GAAG,UAAU,KAAK;AAAA,MAC1B,MAAM,UAAU;AAAA,IACjB;AAAA,EACD;AAIA,QAAM,qBAA2B,EAAE,OAAO,KAAM,QAAQ,IAAK;AAC7D,QAAM,aAAS,4BAAc,WAAW,oB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AAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,OAAO,QAAQ;AAAA,MACf,QAAQ,SAAS;AAAA,IAClB;AAAA,EACD;AACA,MAAK,CAAE,iBAAkB;AACxB,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,GAAG,cAAc,gBAAgB,IAAI,SAAS;AAAA,IAC9C,GAAG,cAAc,gBAAgB,IAAI,SAAS;AAAA,IAC9C,OAAO,cAAc,gBAAgB,QAAQ,SAAS;AAAA,IACtD,QAAQ,cAAc,gBAAgB,SAAS,SAAS;AAAA,EACzD;AACD;AA+BO,SAAS,uBACf,OACA,WACsB;AACtB,MAAK,KAAE,6BAAa,SAAU,GAAI;AACjC,WAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE;AAAA,EAC1C;AACA,QAAM,SAAS,gBAAiB,OAAO,SAAU;AACjD,SAAO;AAAA,IACN,GAAK,OAAO,IAAI,UAAU,QAAU;AAAA,IACpC,GAAK,OAAO,IAAI,UAAU,SAAW;AAAA,IACrC,OAAS,OAAO,QAAQ,UAAU,QAAU;AAAA,IAC5C,QAAU,OAAO,SAAS,UAAU,SAAW;AAAA,EAChD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"source-region.cjs","names":["sanitizeCropperState","isValidSize","createCamera","mat2d","getVisibleBounds","vec2","getRotatedBBox","normalizeRotation"],"sources":["../../../src/image-editor/core/source-region.ts"],"sourcesContent":["import { mat2d, vec2 } from 'gl-matrix';\nimport type {\n\tCropperState,\n\tHandlePosition,\n\tNormalizedRect,\n\tSize,\n} from './types';\nimport { createCamera, getRotatedBBox, getVisibleBounds } from './camera';\nimport { isValidSize, sanitizeCropperState } from './math/sanitize';\nimport { normalizeRotation } from './math/rotation';\n\n/**\n * The selected image region in source-pixel coordinates.\n */\nexport interface SourceRegion {\n\t/** X offset in source pixels. */\n\tx: number;\n\t/** Y offset in source pixels. */\n\ty: number;\n\t/** Width in source pixels. */\n\twidth: number;\n\t/** Height in source pixels. */\n\theight: number;\n\t/** Rotation in degrees (0-360). */\n\trotation: number;\n\t/** Flip state. */\n\tflip: { horizontal: boolean; vertical: boolean };\n\t/** Zoom factor applied. */\n\tzoom: number;\n}\n\n/**\n * Get the selected image region in source-pixel coordinates.\n *\n * Converts the current crop state (normalized visual space) to the actual\n * region of the original image that's selected. This is the bridge between\n * the cropper's internal coordinate system and external tools (image\n * processing libraries, AI APIs, server-side processing) that work in\n * source-pixel coordinates.\n *\n * The returned rectangle accounts for pan, zoom, and the crop rect position,\n * but expresses the crop in the unrotated image's coordinate space. Rotation\n * and flip are included as separate fields since they represent transforms,\n * not a region.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @return The selected region in source pixels plus rotation/flip metadata.\n */\nexport function getSourceRegion(\n\tstate: CropperState,\n\timageSize: Size\n): SourceRegion {\n\t// Sanitize before the zero-size short-circuit so the early return\n\t// doesn't leak raw non-finite state.rotation or state.zoom out\n\t// through the metadata fields. (state.flip is boolean and isn't\n\t// at risk of NaN propagation.)\n\tconst safeState = sanitizeCropperState( state );\n\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\trotation: safeState.rotation,\n\t\t\tflip: { ...safeState.flip },\n\t\t\tzoom: safeState.zoom,\n\t\t};\n\t}\n\n\t// Use a synthetic 1:1 container so the camera maps normalized coords\n\t// to a known pixel space. The container size cancels out.\n\tconst syntheticContainer: Size = { width: 1000, height: 1000 };\n\tconst camera = createCamera( safeState, syntheticContainer, imageSize );\n\n\t// Inverse camera maps screen pixels back to normalized [0,1] world coords.\n\tconst inv = mat2d.create();\n\tmat2d.invert( inv, camera );\n\n\t// The crop rect center in screen space. We need the base camera\n\t// (zoom=1, no pan) to locate the visual bounds, then place the\n\t// crop rect within them.\n\tconst baseCamera = createCamera(\n\t\t{ ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },\n\t\tsyntheticContainer,\n\t\timageSize\n\t);\n\tconst visibleBounds = getVisibleBounds( baseCamera );\n\n\tconst cropRect = safeState.cropRect;\n\tconst cropCenterScreenX =\n\t\tvisibleBounds.left +\n\t\t( cropRect.x + cropRect.width / 2 ) * visibleBounds.width;\n\tconst cropCenterScreenY =\n\t\tvisibleBounds.top +\n\t\t( cropRect.y + cropRect.height / 2 ) * visibleBounds.height;\n\n\t// Transform crop center through inverse camera to get source position.\n\tconst srcCenter = vec2.create();\n\tvec2.transformMat2d(\n\t\tsrcCenter,\n\t\t[ cropCenterScreenX, cropCenterScreenY ],\n\t\tinv\n\t);\n\n\t// Crop rect size in the snap-rotation visual space, divided by zoom\n\t// for source-pixel dimensions. Matches the stencil's reference frame.\n\tconst snapRotation = Math.round( safeState.rotation / 90 ) * 90;\n\tconst { width: rotW, height: rotH } = getRotatedBBox(\n\t\timageSize.width,\n\t\timageSize.height,\n\t\tsnapRotation\n\t);\n\tconst sourceW = ( cropRect.width * rotW ) / safeState.zoom;\n\tconst sourceH = ( cropRect.height * rotH ) / safeState.zoom;\n\n\treturn {\n\t\tx: srcCenter[ 0 ] * imageSize.width - sourceW / 2,\n\t\ty: srcCenter[ 1 ] * imageSize.height - sourceH / 2,\n\t\twidth: sourceW,\n\t\theight: sourceH,\n\t\trotation: safeState.rotation,\n\t\tflip: { ...safeState.flip },\n\t\tzoom: safeState.zoom,\n\t};\n}\n\n/**\n * Convert a source-pixel region back to the cropper's normalized crop rect.\n *\n * The math intentionally mirrors `getSourceRegion`: map the requested source\n * center through the current camera, then express that screen point inside the\n * same base visible bounds used to position crop overlays.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param region The source-pixel region to represent as a crop rect.\n * @return The normalized crop rect, or null when inputs cannot be mapped.\n */\nfunction getCropRectFromSourceRegion(\n\tstate: CropperState,\n\timageSize: Size,\n\tregion: SourceRegion\n): NormalizedRect | null {\n\tif (\n\t\t! isValidSize( imageSize ) ||\n\t\tregion.width <= 0 ||\n\t\tregion.height <= 0\n\t) {\n\t\treturn null;\n\t}\n\n\tconst safeState = sanitizeCropperState( state );\n\tconst syntheticContainer: Size = { width: 1000, height: 1000 };\n\tconst baseCamera = createCamera(\n\t\t{ ...safeState, pan: { x: 0, y: 0 }, zoom: 1 },\n\t\tsyntheticContainer,\n\t\timageSize\n\t);\n\tconst visibleBounds = getVisibleBounds( baseCamera );\n\tif ( visibleBounds.width <= 0 || visibleBounds.height <= 0 ) {\n\t\treturn null;\n\t}\n\n\tconst sourceCenter = vec2.fromValues(\n\t\t( region.x + region.width / 2 ) / imageSize.width,\n\t\t( region.y + region.height / 2 ) / imageSize.height\n\t);\n\tconst screenCenter = vec2.create();\n\tconst camera = createCamera( safeState, syntheticContainer, imageSize );\n\tvec2.transformMat2d( screenCenter, sourceCenter, camera );\n\n\tconst snapRotation = Math.round( safeState.rotation / 90 ) * 90;\n\tconst { width: rotW, height: rotH } = getRotatedBBox(\n\t\timageSize.width,\n\t\timageSize.height,\n\t\tsnapRotation\n\t);\n\tif ( rotW <= 0 || rotH <= 0 ) {\n\t\treturn null;\n\t}\n\n\tconst width = ( region.width * safeState.zoom ) / rotW;\n\tconst height = ( region.height * safeState.zoom ) / rotH;\n\tconst centerX =\n\t\t( screenCenter[ 0 ] - visibleBounds.left ) / visibleBounds.width;\n\tconst centerY =\n\t\t( screenCenter[ 1 ] - visibleBounds.top ) / visibleBounds.height;\n\n\treturn {\n\t\tx: centerX - width / 2,\n\t\ty: centerY - height / 2,\n\t\twidth,\n\t\theight,\n\t};\n}\n\ninterface SourcePixelSnapEdges {\n\tleft: boolean;\n\ttop: boolean;\n\tright: boolean;\n\tbottom: boolean;\n}\n\nconst CARDINAL_ROTATION_EPSILON = 1e-6;\n\n/**\n * Check whether a rotation is effectively at a 90-degree stop.\n *\n * @param rotation The rotation angle in degrees.\n * @return Whether the rotation is close enough to a cardinal angle.\n */\nfunction isCardinalRotation( rotation: number ): boolean {\n\tconst normalizedRotation = normalizeRotation( rotation );\n\tconst nearestCardinal = Math.round( normalizedRotation / 90 ) * 90;\n\treturn (\n\t\tMath.abs( normalizedRotation - nearestCardinal ) <\n\t\tCARDINAL_ROTATION_EPSILON\n\t);\n}\n\n/**\n * Snap a crop rect so the selected source-region edges land on whole pixels.\n *\n * This is a display-time affordance for visible pixel grids; it does not alter\n * pan/zoom/rotation. Callers decide when snapping is appropriate.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param cropRect The candidate crop rect from resize math.\n * @param handle The active resize handle. Only edges moved by the handle snap.\n * @return A crop rect whose selected source-region edges are whole pixels.\n */\nexport function snapCropRectToSourcePixels(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect,\n\thandle: HandlePosition\n): NormalizedRect {\n\tconst safeState = sanitizeCropperState( state );\n\tif ( ! isCardinalRotation( safeState.rotation ) ) {\n\t\treturn cropRect;\n\t}\n\n\treturn snapCropRectEdgesToSourcePixels( safeState, imageSize, cropRect, {\n\t\tleft: handle.includes( 'w' ),\n\t\ttop: handle.includes( 'n' ),\n\t\tright: handle.includes( 'e' ),\n\t\tbottom: handle.includes( 's' ),\n\t} );\n}\n\n/**\n * Snap all source-region edges for a crop rect to the nearest whole pixels.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @param cropRect The crop rect to align to the source-pixel grid.\n * @return A crop rect whose source-region edges are whole pixels.\n */\nexport function snapCropRectToSourcePixelGrid(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect\n): NormalizedRect {\n\treturn snapCropRectEdgesToSourcePixels( state, imageSize, cropRect, {\n\t\tleft: true,\n\t\ttop: true,\n\t\tright: true,\n\t\tbottom: true,\n\t} );\n}\n\nfunction snapCropRectEdgesToSourcePixels(\n\tstate: CropperState,\n\timageSize: Size,\n\tcropRect: NormalizedRect,\n\tedges: SourcePixelSnapEdges\n): NormalizedRect {\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn cropRect;\n\t}\n\n\tconst stateWithCrop = sanitizeCropperState( { ...state, cropRect } );\n\tconst region = getSourceRegion( stateWithCrop, imageSize );\n\tconst shouldSnapX = edges.left || edges.right;\n\tconst shouldSnapY = edges.top || edges.bottom;\n\tconst left = edges.left ? Math.round( region.x ) : region.x;\n\tconst top = edges.top ? Math.round( region.y ) : region.y;\n\tconst right = edges.right\n\t\t? Math.round( region.x + region.width )\n\t\t: region.x + region.width;\n\tconst bottom = edges.bottom\n\t\t? Math.round( region.y + region.height )\n\t\t: region.y + region.height;\n\tif ( right <= left || bottom <= top ) {\n\t\treturn cropRect;\n\t}\n\n\tconst snappedCropRect = getCropRectFromSourceRegion(\n\t\tstateWithCrop,\n\t\timageSize,\n\t\t{\n\t\t\t...region,\n\t\t\tx: left,\n\t\t\ty: top,\n\t\t\twidth: right - left,\n\t\t\theight: bottom - top,\n\t\t}\n\t);\n\tif ( ! snappedCropRect ) {\n\t\treturn cropRect;\n\t}\n\n\treturn {\n\t\tx: shouldSnapX ? snappedCropRect.x : cropRect.x,\n\t\ty: shouldSnapY ? snappedCropRect.y : cropRect.y,\n\t\twidth: shouldSnapX ? snappedCropRect.width : cropRect.width,\n\t\theight: shouldSnapY ? snappedCropRect.height : cropRect.height,\n\t};\n}\n\n/**\n * The selected crop region expressed as percentages of the source image.\n */\nexport interface SourceRegionPercent {\n\t/** X offset as a percentage (0–100) of the source image width. */\n\tx: number;\n\t/** Y offset as a percentage (0–100) of the source image height. */\n\ty: number;\n\t/** Width as a percentage (0–100) of the source image width. */\n\twidth: number;\n\t/** Height as a percentage (0–100) of the source image height. */\n\theight: number;\n}\n\n/**\n * Get the selected image region as percentages of the source image dimensions.\n *\n * Returns `{ x, y, width, height }` where each value is a percentage (0–100)\n * of the source image's natural width or height. This format is compatible\n * with the WordPress REST API attachments `/edit` endpoint and CSS-based\n * crop workflows.\n *\n * Internally delegates to `getSourceRegion` and divides by the image\n * dimensions, so accuracy is identical.\n *\n * @param state The current cropper state.\n * @param imageSize The natural dimensions of the source image.\n * @return The crop region as percentages (0–100).\n */\nexport function getSourceRegionPercent(\n\tstate: CropperState,\n\timageSize: Size\n): SourceRegionPercent {\n\tif ( ! isValidSize( imageSize ) ) {\n\t\treturn { x: 0, y: 0, width: 0, height: 0 };\n\t}\n\tconst region = getSourceRegion( state, imageSize );\n\treturn {\n\t\tx: ( region.x / imageSize.width ) * 100,\n\t\ty: ( region.y / imageSize.height ) * 100,\n\t\twidth: ( region.width / imageSize.width ) * 100,\n\t\theight: ( region.height / imageSize.height ) * 100,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgB,gBACf,OACA,WACe;CAKf,MAAM,aAAA,GAAYA,mBAAAA,qBAAAA,CAAsB,KAAM;CAE9C,IAAK,EAAA,GAAEC,mBAAAA,YAAAA,CAAa,SAAU,GAC7B,OAAO;EACN,GAAG;EACH,GAAG;EACH,OAAO;EACP,QAAQ;EACR,UAAU,UAAU;EACpB,MAAM,EAAE,GAAG,UAAU,KAAK;EAC1B,MAAM,UAAU;CACjB;CAKD,MAAM,qBAA2B;EAAE,OAAO;EAAM,QAAQ;CAAK;CAC7D,MAAM,UAAA,GAASC,YAAAA,aAAAA,CAAc,WAAW,oBAAoB,SAAU;CAGtE,MAAM,MAAMC,UAAAA,MAAM,OAAO;CACzB,UAAA,MAAM,OAAQ,KAAK,MAAO;CAK1B,MAAM,cAAA,GAAaD,YAAAA,aAAAA,CAClB;EAAE,GAAG;EAAW,KAAK;GAAE,GAAG;GAAG,GAAG;EAAE;EAAG,MAAM;CAAE,GAC7C,oBACA,SACD;CACA,MAAM,iBAAA,GAAgBE,YAAAA,iBAAAA,CAAkB,UAAW;CAEnD,MAAM,WAAW,UAAU;CAC3B,MAAM,oBACL,cAAc,QACZ,SAAS,IAAI,SAAS,QAAQ,KAAM,cAAc;CACrD,MAAM,oBACL,cAAc,OACZ,SAAS,IAAI,SAAS,SAAS,KA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