@wordpress/media-editor 0.9.0 → 0.10.1
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/build/components/media-editor/index.cjs +212 -170
- package/build/components/media-editor/index.cjs.map +3 -3
- package/build/components/media-editor/use-crop-options.cjs +63 -0
- package/build/components/media-editor/use-crop-options.cjs.map +7 -0
- package/build/components/media-editor/use-save-media-editor.cjs +185 -0
- package/build/components/media-editor/use-save-media-editor.cjs.map +7 -0
- package/build/components/media-editor-canvas/index.cjs +33 -12
- package/build/components/media-editor-canvas/index.cjs.map +2 -2
- package/build/components/media-editor-crop-panel/index.cjs +70 -84
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-fine-rotation/index.cjs +81 -0
- package/build/components/media-editor-fine-rotation/index.cjs.map +7 -0
- package/build/components/media-editor-modal/index.cjs +63 -16
- package/build/components/media-editor-modal/index.cjs.map +3 -3
- package/build/components/media-editor-transform-controls/index.cjs +84 -0
- package/build/components/media-editor-transform-controls/index.cjs.map +7 -0
- package/build/components/media-form/index.cjs +19 -1
- package/build/components/media-form/index.cjs.map +3 -3
- package/build/components/media-form/sidebar-datetime-view.cjs +53 -0
- package/build/components/media-form/sidebar-datetime-view.cjs.map +7 -0
- package/build/components/rotation-ruler/index.cjs +8 -2
- package/build/components/rotation-ruler/index.cjs.map +2 -2
- package/build/hooks/use-crop-gesture-handlers.cjs +41 -4
- package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
- package/build/image-editor/core/camera.cjs +29 -11
- package/build/image-editor/core/camera.cjs.map +2 -2
- package/build/image-editor/core/constants.cjs +6 -0
- package/build/image-editor/core/constants.cjs.map +2 -2
- package/build/image-editor/core/containment.cjs +71 -34
- package/build/image-editor/core/containment.cjs.map +2 -2
- package/build/image-editor/core/crop-rect.cjs +48 -0
- package/build/image-editor/core/crop-rect.cjs.map +7 -0
- package/build/image-editor/core/index.cjs +12 -0
- package/build/image-editor/core/index.cjs.map +2 -2
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/core/math/sanitize.cjs +92 -0
- package/build/image-editor/core/math/sanitize.cjs.map +7 -0
- package/build/image-editor/core/setter-helpers.cjs +64 -0
- package/build/image-editor/core/setter-helpers.cjs.map +7 -0
- package/build/image-editor/core/source-region.cjs +16 -14
- package/build/image-editor/core/source-region.cjs.map +2 -2
- package/build/image-editor/core/state.cjs +20 -10
- package/build/image-editor/core/state.cjs.map +2 -2
- package/build/image-editor/core/stencil-math.cjs +31 -20
- package/build/image-editor/core/stencil-math.cjs.map +2 -2
- package/build/image-editor/core/transform-style.cjs +12 -6
- package/build/image-editor/core/transform-style.cjs.map +2 -2
- package/build/image-editor/core/types.cjs.map +1 -1
- package/build/image-editor/index.cjs +12 -2
- package/build/image-editor/index.cjs.map +2 -2
- package/build/image-editor/react/components/cropper-provider.cjs +2 -2
- package/build/image-editor/react/components/cropper-provider.cjs.map +2 -2
- package/build/image-editor/react/components/cropper.cjs +120 -47
- package/build/image-editor/react/components/cropper.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +172 -0
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +19 -9
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +71 -0
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +7 -0
- package/build/image-editor/react/hooks/index.cjs +6 -3
- package/build/image-editor/react/hooks/index.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +113 -0
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +7 -0
- package/build/state/composite-reducer.cjs +103 -0
- package/build/state/composite-reducer.cjs.map +7 -0
- package/build/state/index.cjs +48 -0
- package/build/state/index.cjs.map +7 -0
- package/build/state/media-editor-state-provider.cjs +58 -0
- package/build/state/media-editor-state-provider.cjs.map +7 -0
- package/build/state/types.cjs +33 -0
- package/build/state/types.cjs.map +7 -0
- package/build/state/use-media-editor-state.cjs +287 -0
- package/build/state/use-media-editor-state.cjs.map +7 -0
- package/build/store/actions.cjs +4 -2
- package/build/store/actions.cjs.map +2 -2
- package/build/store/reducer.cjs +5 -3
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +5 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +224 -177
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor/use-crop-options.mjs +37 -0
- package/build-module/components/media-editor/use-crop-options.mjs.map +7 -0
- package/build-module/components/media-editor/use-save-media-editor.mjs +151 -0
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +7 -0
- package/build-module/components/media-editor-canvas/index.mjs +34 -13
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +73 -89
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-fine-rotation/index.mjs +50 -0
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +7 -0
- package/build-module/components/media-editor-modal/index.mjs +64 -17
- package/build-module/components/media-editor-modal/index.mjs.map +2 -2
- package/build-module/components/media-editor-transform-controls/index.mjs +68 -0
- package/build-module/components/media-editor-transform-controls/index.mjs.map +7 -0
- package/build-module/components/media-form/index.mjs +9 -1
- package/build-module/components/media-form/index.mjs.map +2 -2
- package/build-module/components/media-form/sidebar-datetime-view.mjs +32 -0
- package/build-module/components/media-form/sidebar-datetime-view.mjs.map +7 -0
- package/build-module/components/rotation-ruler/index.mjs +8 -2
- package/build-module/components/rotation-ruler/index.mjs.map +2 -2
- package/build-module/hooks/use-crop-gesture-handlers.mjs +41 -4
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
- package/build-module/image-editor/core/camera.mjs +34 -11
- package/build-module/image-editor/core/camera.mjs.map +2 -2
- package/build-module/image-editor/core/constants.mjs +4 -0
- package/build-module/image-editor/core/constants.mjs.map +2 -2
- package/build-module/image-editor/core/containment.mjs +75 -34
- package/build-module/image-editor/core/containment.mjs.map +2 -2
- package/build-module/image-editor/core/crop-rect.mjs +23 -0
- package/build-module/image-editor/core/crop-rect.mjs.map +7 -0
- package/build-module/image-editor/core/index.mjs +12 -0
- package/build-module/image-editor/core/index.mjs.map +2 -2
- package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
- package/build-module/image-editor/core/math/sanitize.mjs +63 -0
- package/build-module/image-editor/core/math/sanitize.mjs.map +7 -0
- package/build-module/image-editor/core/setter-helpers.mjs +39 -0
- package/build-module/image-editor/core/setter-helpers.mjs.map +7 -0
- package/build-module/image-editor/core/source-region.mjs +16 -14
- package/build-module/image-editor/core/source-region.mjs.map +2 -2
- package/build-module/image-editor/core/state.mjs +25 -11
- package/build-module/image-editor/core/state.mjs.map +2 -2
- package/build-module/image-editor/core/stencil-math.mjs +30 -19
- package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
- package/build-module/image-editor/core/transform-style.mjs +12 -6
- package/build-module/image-editor/core/transform-style.mjs.map +2 -2
- package/build-module/image-editor/index.mjs +11 -2
- package/build-module/image-editor/index.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper-provider.mjs +3 -3
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper.mjs +121 -48
- package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +147 -0
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +19 -9
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +46 -0
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/index.mjs +4 -2
- package/build-module/image-editor/react/hooks/index.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +100 -0
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +7 -0
- package/build-module/state/composite-reducer.mjs +82 -0
- package/build-module/state/composite-reducer.mjs.map +7 -0
- package/build-module/state/index.mjs +26 -0
- package/build-module/state/index.mjs.map +7 -0
- package/build-module/state/media-editor-state-provider.mjs +34 -0
- package/build-module/state/media-editor-state-provider.mjs.map +7 -0
- package/build-module/state/types.mjs +8 -0
- package/build-module/state/types.mjs.map +7 -0
- package/build-module/state/use-media-editor-state.mjs +278 -0
- package/build-module/state/use-media-editor-state.mjs.map +7 -0
- package/build-module/store/actions.mjs +4 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -3
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +4 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +97 -44
- package/build-style/style.css +97 -44
- package/build-types/components/media-editor/index.d.ts +14 -5
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +35 -0
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -0
- package/build-types/components/media-editor/use-save-media-editor.d.ts +29 -0
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -0
- package/build-types/components/media-editor-canvas/index.d.ts +5 -10
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +6 -25
- 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 +14 -0
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-transform-controls/index.d.ts +8 -0
- package/build-types/components/media-editor-transform-controls/index.d.ts.map +1 -0
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-form/sidebar-datetime-view.d.ts +10 -0
- package/build-types/components/media-form/sidebar-datetime-view.d.ts.map +1 -0
- package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
- package/build-types/hooks/use-crop-gesture-handlers.d.ts +13 -14
- package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts.map +1 -1
- package/build-types/image-editor/core/constants.d.ts +18 -0
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/containment.d.ts +10 -0
- package/build-types/image-editor/core/containment.d.ts.map +1 -1
- package/build-types/image-editor/core/crop-rect.d.ts +19 -0
- package/build-types/image-editor/core/crop-rect.d.ts.map +1 -0
- package/build-types/image-editor/core/index.d.ts +3 -1
- package/build-types/image-editor/core/index.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +5 -1
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +70 -0
- package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -0
- package/build-types/image-editor/core/setter-helpers.d.ts +24 -0
- package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -0
- package/build-types/image-editor/core/source-region.d.ts.map +1 -1
- package/build-types/image-editor/core/state.d.ts +12 -0
- package/build-types/image-editor/core/state.d.ts.map +1 -1
- package/build-types/image-editor/core/stencil-math.d.ts +23 -18
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
- package/build-types/image-editor/core/transform-style.d.ts.map +1 -1
- package/build-types/image-editor/core/types.d.ts +23 -4
- package/build-types/image-editor/core/types.d.ts.map +1 -1
- package/build-types/image-editor/index.d.ts +4 -4
- package/build-types/image-editor/index.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +11 -7
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +6 -4
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +36 -0
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +2 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +47 -0
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/index.d.ts +4 -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 +58 -0
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
- package/build-types/state/composite-reducer.d.ts +39 -0
- package/build-types/state/composite-reducer.d.ts.map +1 -0
- package/build-types/state/index.d.ts +7 -0
- package/build-types/state/index.d.ts.map +1 -0
- package/build-types/state/media-editor-state-provider.d.ts +34 -0
- package/build-types/state/media-editor-state-provider.d.ts.map +1 -0
- package/build-types/state/types.d.ts +96 -0
- package/build-types/state/types.d.ts.map +1 -0
- package/build-types/state/use-media-editor-state.d.ts +101 -0
- package/build-types/state/use-media-editor-state.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +3 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +3 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +19 -16
- package/src/components/media-editor/index.tsx +262 -229
- package/src/components/media-editor/style.scss +0 -9
- package/src/components/media-editor/test/use-crop-options.tsx +110 -0
- package/src/components/media-editor/use-crop-options.ts +79 -0
- package/src/components/media-editor/use-save-media-editor.ts +214 -0
- package/src/components/media-editor-canvas/index.tsx +57 -25
- package/src/components/media-editor-crop-panel/index.tsx +53 -87
- package/src/components/media-editor-crop-panel/test/index.tsx +46 -53
- package/src/components/media-editor-fine-rotation/index.tsx +74 -0
- package/src/components/media-editor-modal/index.tsx +70 -16
- package/src/components/media-editor-modal/style.scss +80 -0
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +14 -0
- package/src/components/media-editor-modal/test/index.tsx +146 -0
- package/src/components/media-editor-transform-controls/index.tsx +70 -0
- package/src/components/media-editor-transform-controls/style.scss +8 -0
- package/src/components/media-form/index.tsx +15 -1
- package/src/components/media-form/sidebar-datetime-view.tsx +47 -0
- package/src/components/media-form/test/sidebar-datetime-view.test.tsx +96 -0
- package/src/components/rotation-ruler/README.md +11 -25
- package/src/components/rotation-ruler/index.tsx +17 -2
- package/src/components/rotation-ruler/style.scss +49 -13
- package/src/hooks/use-crop-gesture-handlers.ts +64 -17
- package/src/image-editor/README.md +28 -129
- package/src/image-editor/core/camera.ts +51 -26
- package/src/image-editor/core/constants.ts +19 -0
- package/src/image-editor/core/containment.ts +102 -49
- package/src/image-editor/core/crop-rect.ts +45 -0
- package/src/image-editor/core/index.ts +16 -4
- package/src/image-editor/core/interaction-controller.ts +5 -1
- package/src/image-editor/core/math/sanitize.ts +158 -0
- package/src/image-editor/core/math/test/sanitize.ts +244 -0
- package/src/image-editor/core/setter-helpers.ts +66 -0
- package/src/image-editor/core/source-region.ts +21 -14
- package/src/image-editor/core/state.ts +67 -15
- package/src/image-editor/core/stencil-math.ts +55 -35
- package/src/image-editor/core/test/camera.ts +367 -1
- package/src/image-editor/core/test/state.ts +101 -8
- package/src/image-editor/core/test/stencil-math.ts +193 -0
- package/src/image-editor/core/transform-style.ts +21 -6
- package/src/image-editor/core/types.ts +24 -4
- package/src/image-editor/docs/architecture.md +48 -89
- package/src/image-editor/docs/recipes.md +123 -659
- package/src/image-editor/index.ts +12 -3
- package/src/image-editor/react/components/cropper-provider.tsx +16 -12
- package/src/image-editor/react/components/cropper.scss +23 -4
- package/src/image-editor/react/components/cropper.tsx +194 -89
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +269 -0
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +19 -8
- package/src/image-editor/react/components/test/cropper.tsx +55 -13
- package/src/image-editor/react/hooks/build-cropper-setters.ts +105 -0
- package/src/image-editor/react/hooks/index.ts +4 -2
- package/src/image-editor/react/hooks/test/{use-cropper-state.ts → use-cropper-reducer.ts} +142 -286
- package/src/image-editor/react/hooks/use-cropper-reducer.ts +204 -0
- package/src/image-editor/stories/rectangle-crop.story.tsx +7 -17
- package/src/state/composite-reducer.ts +137 -0
- package/src/state/index.ts +20 -0
- package/src/state/media-editor-state-provider.tsx +70 -0
- package/src/state/test/use-media-editor-state.ts +330 -0
- package/src/state/types.ts +101 -0
- package/src/state/use-media-editor-state.ts +472 -0
- package/src/store/actions.ts +3 -0
- package/src/store/reducer.ts +6 -1
- package/src/store/selectors.ts +4 -0
- package/src/store/test/reducer.ts +9 -0
- package/src/style.scss +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/media-editor-toolbar/index.cjs +0 -214
- package/build/components/media-editor-toolbar/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-cropper-state.cjs +0 -277
- package/build/image-editor/react/hooks/use-cropper-state.cjs.map +0 -7
- package/build-module/components/media-editor-toolbar/index.mjs +0 -190
- package/build-module/components/media-editor-toolbar/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs +0 -262
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +0 -7
- package/build-types/components/media-editor-toolbar/index.d.ts +0 -24
- package/build-types/components/media-editor-toolbar/index.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +0 -97
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +0 -1
- package/src/components/media-editor-toolbar/index.tsx +0 -209
- package/src/components/media-editor-toolbar/style.scss +0 -49
- package/src/image-editor/docs/roadmap.md +0 -66
- package/src/image-editor/react/hooks/use-cropper-state.ts +0 -457
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* Internal dependencies
|
|
6
6
|
*/
|
|
7
7
|
import type { CropperState, StencilProps, Size } from '../../core/types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { CropperController } from '../hooks/use-cropper-reducer';
|
|
9
9
|
/**
|
|
10
10
|
* Props for the Cropper component.
|
|
11
11
|
*/
|
|
12
12
|
export interface CropperProps {
|
|
13
13
|
/** Image source URL. */
|
|
14
14
|
src: string;
|
|
15
|
-
/** The
|
|
16
|
-
controller:
|
|
15
|
+
/** The cropper controller from `useCropperReducer` or a composite store. */
|
|
16
|
+
controller: CropperController;
|
|
17
17
|
/** Stencil component for the crop area. Defaults to RectangleStencil. */
|
|
18
18
|
stencil?: React.ComponentType<StencilProps>;
|
|
19
19
|
/** Show the rule-of-thirds grid overlay, or only during interactions. */
|
|
@@ -22,7 +22,9 @@ export interface CropperProps {
|
|
|
22
22
|
isPlacementActive?: boolean;
|
|
23
23
|
/** Show the dimming overlay outside the crop area. */
|
|
24
24
|
showDimming?: boolean;
|
|
25
|
-
/**
|
|
25
|
+
/** Show the live output dimensions tooltip during a resize. */
|
|
26
|
+
showDimensions?: boolean;
|
|
27
|
+
/** Minimum zoom level override. Defaults to the coverage-aware minimum. */
|
|
26
28
|
minZoom?: number;
|
|
27
29
|
/** Maximum zoom level. */
|
|
28
30
|
maxZoom?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAmBH;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAmBH;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EAEZ,YAAY,EACZ,IAAI,EAEJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAmBtE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,UAAU,EAAE,iBAAiB,CAAC;IAC9B,yEAAyE;IACzE,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,YAAY,CAAE,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACnC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACvC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,CAAE,KAAK,EAAE,YAAY,KAAM,IAAI,CAAC;IAChD,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAutBD,eAAO,MAAM,OAAO,yGAMnB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { HandlePosition, NormalizedRect, Size } from '../../../core/types';
|
|
5
|
+
interface DimensionsOverlayProps {
|
|
6
|
+
/** Crop rectangle in normalized coordinates. */
|
|
7
|
+
cropRect: NormalizedRect;
|
|
8
|
+
/** Container element dimensions in pixels. */
|
|
9
|
+
containerSize: Size;
|
|
10
|
+
/** Rendered image dimensions in pixels within the container. */
|
|
11
|
+
imageSize: Size;
|
|
12
|
+
/** Currently-dragged handle, or null when no pointer drag is active. */
|
|
13
|
+
activeHandle: HandlePosition | null;
|
|
14
|
+
/** Output crop width in source pixels. */
|
|
15
|
+
outputWidth: number;
|
|
16
|
+
/** Output crop height in source pixels. */
|
|
17
|
+
outputHeight: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tooltip that follows the active resize handle during a pointer drag,
|
|
21
|
+
* showing the current output dimensions of the crop in source pixels.
|
|
22
|
+
*
|
|
23
|
+
* Renders nothing outside of a pointer-driven resize, so keyboard
|
|
24
|
+
* arrow-key adjustments and pan/zoom gestures stay quiet.
|
|
25
|
+
*
|
|
26
|
+
* @param props
|
|
27
|
+
* @param props.cropRect
|
|
28
|
+
* @param props.containerSize
|
|
29
|
+
* @param props.imageSize
|
|
30
|
+
* @param props.activeHandle
|
|
31
|
+
* @param props.outputWidth
|
|
32
|
+
* @param props.outputHeight
|
|
33
|
+
*/
|
|
34
|
+
export declare function DimensionsOverlay({ cropRect, containerSize, imageSize, activeHandle, outputWidth, outputHeight }: DimensionsOverlayProps): import("react").JSX.Element | null;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=dimensions-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimensions-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/dimensions-overlay.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAgIhF,UAAU,sBAAsB;IAC/B,gDAAgD;IAChD,QAAQ,EAAE,cAAc,CAAC;IACzB,8CAA8C;IAC9C,aAAa,EAAE,IAAI,CAAC;IACpB,gEAAgE;IAChE,SAAS,EAAE,IAAI,CAAC;IAChB,wEAAwE;IACxE,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAE,EAClC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,EAAE,sBAAsB,sCA+FxB"}
|
|
@@ -25,8 +25,9 @@ type RectangleStencilProps = StencilProps;
|
|
|
25
25
|
* @param props.stencilTransition CSS transition string for settle animation.
|
|
26
26
|
* @param props.cropBounds Maximum crop rect bounds from camera (zoom/rotation-aware).
|
|
27
27
|
* @param props.onEscape Called when Escape is pressed on a resize handle.
|
|
28
|
+
* @param props.minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
28
29
|
* @return The rectangle stencil element.
|
|
29
30
|
*/
|
|
30
|
-
export declare function RectangleStencil({ cropRect, containerSize, imageSize, onCropChange, onResizeStart, onResizeEnd, aspectRatio, freeformCrop, stencilTransition, cropBounds, onEscape }: RectangleStencilProps): import("react").JSX.Element | null;
|
|
31
|
+
export declare function RectangleStencil({ cropRect, containerSize, imageSize, onCropChange, onResizeStart, onResizeEnd, aspectRatio, freeformCrop, stencilTransition, cropBounds, onEscape, minCropSize }: RectangleStencilProps): import("react").JSX.Element | null;
|
|
31
32
|
export {};
|
|
32
33
|
//# sourceMappingURL=rectangle-stencil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAkExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAkExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,EAAE,qBAAqB,sCAqavB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CropperAction, CropperState, Flip, NormalizedPoint, NormalizedRect, TransformOperation } from '../../core/types';
|
|
5
|
+
/**
|
|
6
|
+
* The named cropper setters shared by every hook that drives the
|
|
7
|
+
* cropper reducer — the pure `useCropperReducer` and any composite
|
|
8
|
+
* store that delegates cropper actions (e.g. `useMediaEditorState`).
|
|
9
|
+
*
|
|
10
|
+
* `setImage` and `reset` are intentionally NOT included: each hook
|
|
11
|
+
* has additional bookkeeping for them (dirty-baseline, history clear)
|
|
12
|
+
* that doesn't fit a shared factory.
|
|
13
|
+
*/
|
|
14
|
+
export interface CropperSetters {
|
|
15
|
+
setPan: (pan: NormalizedPoint) => void;
|
|
16
|
+
setZoom: (zoom: number) => void;
|
|
17
|
+
setZoomAtPoint: (zoom: number, pan: NormalizedPoint) => void;
|
|
18
|
+
setRotation: (rotation: number) => void;
|
|
19
|
+
setFlip: (flip: Flip) => void;
|
|
20
|
+
toggleFlip: (direction: 'horizontal' | 'vertical') => void;
|
|
21
|
+
snapRotate90: (direction: 1 | -1) => void;
|
|
22
|
+
setCropRect: (rect: NormalizedRect) => void;
|
|
23
|
+
settleCrop: () => void;
|
|
24
|
+
applyOperation: (op: TransformOperation) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build the named cropper setters from a dispatch function and a
|
|
28
|
+
* state getter. The two consuming hooks differ in how they dispatch:
|
|
29
|
+
*
|
|
30
|
+
* - `useCropperReducer` dispatches directly into its `useReducer`.
|
|
31
|
+
* - `useMediaEditorState` wraps cropper actions in a composite
|
|
32
|
+
* `CROPPER` envelope so the history machinery can record them.
|
|
33
|
+
*
|
|
34
|
+
* Both pass their own dispatch function and a getter that returns
|
|
35
|
+
* the current `CropperState`. The factory shape keeps the two hooks
|
|
36
|
+
* in lockstep — add a setter here once, both hooks get it.
|
|
37
|
+
*
|
|
38
|
+
* @param dispatchCropperAction Apply a `CropperAction` to the
|
|
39
|
+
* underlying reducer.
|
|
40
|
+
* @param getCropperState Return the current `CropperState`.
|
|
41
|
+
* Used by setters that need to read
|
|
42
|
+
* the latest state to compute their
|
|
43
|
+
* payload (focal-point zoom, flip toggle).
|
|
44
|
+
* @return The named cropper setters.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildCropperSetters(dispatchCropperAction: (action: CropperAction) => void, getCropperState: () => CropperState): CropperSetters;
|
|
47
|
+
//# sourceMappingURL=build-cropper-setters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-cropper-setters.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/build-cropper-setters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,IAAI,EACJ,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,CAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IACzC,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAClC,cAAc,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IAC/D,WAAW,EAAE,CAAE,QAAQ,EAAE,MAAM,KAAM,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IAChC,UAAU,EAAE,CAAE,SAAS,EAAE,YAAY,GAAG,UAAU,KAAM,IAAI,CAAC;IAC7D,YAAY,EAAE,CAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAM,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,EAAE,CAAE,EAAE,EAAE,kBAAkB,KAAM,IAAI,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAClC,qBAAqB,EAAE,CAAE,MAAM,EAAE,aAAa,KAAM,IAAI,EACxD,eAAe,EAAE,MAAM,YAAY,GACjC,cAAc,CA8ChB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { useCropperReducer } from './use-cropper-reducer';
|
|
2
|
+
export type { CropperController } from './use-cropper-reducer';
|
|
3
|
+
export { buildCropperSetters } from './build-cropper-setters';
|
|
4
|
+
export type { CropperSetters } from './build-cropper-setters';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CropperState, NormalizedRect, Size } from '../../core/types';
|
|
5
|
+
import { type CropperSetters } from './build-cropper-setters';
|
|
6
|
+
/**
|
|
7
|
+
* The cropper controller surface — the contract the Cropper component
|
|
8
|
+
* and its interaction hooks consume.
|
|
9
|
+
*
|
|
10
|
+
* History (undo / redo / commitHistory) is intentionally NOT part of
|
|
11
|
+
* this interface. The cropper is a pure state machine; history is a
|
|
12
|
+
* higher-layer concern owned by a composite store
|
|
13
|
+
* (see media-editor/src/state).
|
|
14
|
+
*/
|
|
15
|
+
export interface CropperController extends CropperSetters {
|
|
16
|
+
/** The current cropper state (read-only). */
|
|
17
|
+
state: CropperState;
|
|
18
|
+
/** Set the loaded image (natural size and src). */
|
|
19
|
+
setImage: (image: CropperState['image']) => void;
|
|
20
|
+
/** Reset the state. Optionally merge partial state overrides. */
|
|
21
|
+
reset: (resetState?: Partial<CropperState>) => void;
|
|
22
|
+
/** Whether the current state differs from the initial state. */
|
|
23
|
+
isDirty: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Export the cropped image as a Blob. Throws on failure — see
|
|
26
|
+
* `exportCroppedImage` for error semantics.
|
|
27
|
+
*/
|
|
28
|
+
getCroppedImage: (mimeType?: string, quality?: number) => Promise<Blob>;
|
|
29
|
+
/**
|
|
30
|
+
* Report the current rendered image size to the controller. The
|
|
31
|
+
* Cropper component calls this on visualSize changes; composite
|
|
32
|
+
* controllers use it to compute aspect-ratio reshapes. The pure
|
|
33
|
+
* cropper hook ignores it (no-op).
|
|
34
|
+
*/
|
|
35
|
+
setVisualSize: (size: Size) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Adjust the cropRect in response to a viewport change (window
|
|
38
|
+
* resize, canvas resize). Behaves like `setCropRect` but, in
|
|
39
|
+
* composite controllers, does NOT record an undo entry — viewport
|
|
40
|
+
* reshapes aren't editor actions. The pure cropper hook aliases
|
|
41
|
+
* this to `setCropRect` (history is a composite concern).
|
|
42
|
+
*/
|
|
43
|
+
adjustCropRectForViewport: (rect: NormalizedRect) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Pure reducer hook for the image cropper.
|
|
47
|
+
*
|
|
48
|
+
* Wraps the framework-agnostic `cropperReducer` and exposes named
|
|
49
|
+
* setters (built from the shared `buildCropperSetters` factory).
|
|
50
|
+
* Does NOT manage undo/redo history — that responsibility belongs to
|
|
51
|
+
* the surrounding application (see `useMediaEditorState` for the
|
|
52
|
+
* composite store used by the media editor).
|
|
53
|
+
*
|
|
54
|
+
* @param initialState Optional partial state to merge with DEFAULT_STATE.
|
|
55
|
+
* @return The cropper controller — state, setters, and helpers.
|
|
56
|
+
*/
|
|
57
|
+
export declare function useCropperReducer(initialState?: Partial<CropperState>): CropperController;
|
|
58
|
+
//# sourceMappingURL=use-cropper-reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cropper-reducer.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-cropper-reducer.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EAEZ,cAAc,EACd,IAAI,EACJ,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAEN,KAAK,cAAc,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACxD,6CAA6C;IAC7C,KAAK,EAAE,YAAY,CAAC;IACpB,mDAAmD;IACnD,QAAQ,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,OAAO,CAAE,KAAM,IAAI,CAAC;IACrD,iEAAiE;IACjE,KAAK,EAAE,CAAE,UAAU,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,KAAM,IAAI,CAAC;IACxD,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,eAAe,EAAE,CAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAM,OAAO,CAAE,IAAI,CAAE,CAAC;IAC5E;;;;;OAKG;IACH,aAAa,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACtC;;;;;;OAMG;IACH,yBAAyB,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;CAC5D;AAaD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAChC,YAAY,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,GACpC,iBAAiB,CA0GnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle-crop.story.d.ts","sourceRoot":"","sources":["../../../src/image-editor/stories/rectangle-crop.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAwB5D;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rectangle-crop.story.d.ts","sourceRoot":"","sources":["../../../src/image-editor/stories/rectangle-crop.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAwB5D;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAuBtD,OAAO,aAAa,CAAC;AA6ErB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAI/B,CAAC;eAEa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,OAAO,CAAE,CAAC;AAsBxC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AA6WF,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AA+hBF,eAAO,MAAM,KAAK,EAAE,KAEnB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type CropperState } from '../image-editor';
|
|
5
|
+
import { type CropOptionsSlice, type MediaEditorAction, type MediaEditorState } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Pure composite reducer for the media editor.
|
|
8
|
+
*
|
|
9
|
+
* Delegates `CROPPER`-tagged actions to the framework-agnostic
|
|
10
|
+
* `cropperReducer` and owns first-class transitions for the sidebar
|
|
11
|
+
* `cropOptions` slice. `RESTORE_SNAPSHOT` replaces the whole composite
|
|
12
|
+
* in one transaction (used by undo/redo).
|
|
13
|
+
*
|
|
14
|
+
* Note: this reducer carries NO history of its own. Snapshots and
|
|
15
|
+
* stacks live in the `useMediaEditorState` hook that wraps it.
|
|
16
|
+
*
|
|
17
|
+
* @param state Current composite state.
|
|
18
|
+
* @param action Action to apply.
|
|
19
|
+
* @return Next composite state.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mediaEditorReducer(state: MediaEditorState, action: MediaEditorAction): MediaEditorState;
|
|
22
|
+
/**
|
|
23
|
+
* Value-equality check for two composite states. Used by the history
|
|
24
|
+
* machinery to dedup snapshots when an action turned out to be a no-op.
|
|
25
|
+
*
|
|
26
|
+
* @param a First composite state.
|
|
27
|
+
* @param b Second composite state.
|
|
28
|
+
* @return Whether `a` and `b` are value-equal across all slices.
|
|
29
|
+
*/
|
|
30
|
+
export declare function areMediaEditorStatesEqual(a: MediaEditorState, b: MediaEditorState): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Build the initial composite state from optional partial overrides.
|
|
33
|
+
*
|
|
34
|
+
* @param initialCropper Initial cropper-slice fields to merge.
|
|
35
|
+
* @param initialOptions Initial cropOptions-slice fields to merge.
|
|
36
|
+
* @return Composite initial state.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildInitialMediaEditorState(initialCropper: CropperState, initialOptions?: Partial<CropOptionsSlice>): MediaEditorState;
|
|
39
|
+
//# sourceMappingURL=composite-reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composite-reducer.d.ts","sourceRoot":"","sources":["../../src/state/composite-reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,GACvB,gBAAgB,CAgElB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,gBAAgB,EACnB,CAAC,EAAE,gBAAgB,GACjB,OAAO,CAQT;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,cAAc,EAAE,YAAY,EAC5B,cAAc,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,GAC1C,gBAAgB,CAKlB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useMediaEditorState, resolveAspectRatio, } from './use-media-editor-state';
|
|
2
|
+
export type { MediaEditorController } from './use-media-editor-state';
|
|
3
|
+
export { MediaEditorStateProvider, useMediaEditor, } from './media-editor-state-provider';
|
|
4
|
+
export { mediaEditorReducer, areMediaEditorStatesEqual, buildInitialMediaEditorState, } from './composite-reducer';
|
|
5
|
+
export { DEFAULT_CROP_OPTIONS } from './types';
|
|
6
|
+
export type { CropOptionsSlice, MediaEditorState, MediaEditorAction, } from './types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACN,wBAAwB,EACxB,cAAc,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CropperState } from '../image-editor';
|
|
5
|
+
import { type MediaEditorController } from './use-media-editor-state';
|
|
6
|
+
import type { CropOptionsSlice } from './types';
|
|
7
|
+
interface MediaEditorStateProviderProps {
|
|
8
|
+
/** Optional cropper-slice initial state. */
|
|
9
|
+
initialCropperState?: Partial<CropperState>;
|
|
10
|
+
/** Optional cropOptions-slice initial state. */
|
|
11
|
+
initialCropOptions?: Partial<CropOptionsSlice>;
|
|
12
|
+
/** Child components. */
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Provider that vends the composite media-editor controller via
|
|
17
|
+
* context. Wrap the media editor in this so every consumer
|
|
18
|
+
* (canvas, toolbar, sidebar) reads from the same store.
|
|
19
|
+
*
|
|
20
|
+
* @param props
|
|
21
|
+
* @param props.initialCropperState
|
|
22
|
+
* @param props.initialCropOptions
|
|
23
|
+
* @param props.children
|
|
24
|
+
*/
|
|
25
|
+
export declare function MediaEditorStateProvider({ initialCropperState, initialCropOptions, children }: MediaEditorStateProviderProps): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Consume the composite media-editor controller. Throws if used
|
|
28
|
+
* outside a `<MediaEditorStateProvider>`.
|
|
29
|
+
*
|
|
30
|
+
* @return The composite controller.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useMediaEditor(): MediaEditorController;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=media-editor-state-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-editor-state-provider.d.ts","sourceRoot":"","sources":["../../src/state/media-editor-state-provider.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD,UAAU,6BAA6B;IACtC,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,CAAC;IAC9C,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,CAAC;IACjD,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAE,EACzC,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,EAAE,6BAA6B,+BAW/B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,qBAAqB,CAQtD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CropperAction, CropperState, NormalizedRect, Size } from '../image-editor';
|
|
5
|
+
/**
|
|
6
|
+
* Sidebar control state for the cropper. Lives in the composite store
|
|
7
|
+
* so it participates in the same undo history as cropper geometry.
|
|
8
|
+
*/
|
|
9
|
+
export interface CropOptionsSlice {
|
|
10
|
+
/**
|
|
11
|
+
* Selected aspect-ratio preset as a string (round-trippable through
|
|
12
|
+
* `<SelectControl>`). `'0'` = Free, `'-1'` = Original, any positive
|
|
13
|
+
* decimal = fixed ratio.
|
|
14
|
+
*/
|
|
15
|
+
aspectRatioValue: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Default values for the crop-options slice. Mirrors the initial state
|
|
19
|
+
* used by the sidebar before the user has touched anything.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_CROP_OPTIONS: CropOptionsSlice;
|
|
22
|
+
/**
|
|
23
|
+
* The full composite state for the media editor — cropper geometry
|
|
24
|
+
* plus the sidebar control slice. Future feature slices (text
|
|
25
|
+
* overlays, filters, …) extend this object.
|
|
26
|
+
*
|
|
27
|
+
* Every undo/redo snapshot is a full `MediaEditorState`. Slices stay
|
|
28
|
+
* referentially equal across actions that don't touch them.
|
|
29
|
+
*/
|
|
30
|
+
export interface MediaEditorState {
|
|
31
|
+
cropper: CropperState;
|
|
32
|
+
cropOptions: CropOptionsSlice;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Composite reducer action union.
|
|
36
|
+
*
|
|
37
|
+
* Cropper geometry actions are wrapped in a `CROPPER` envelope and
|
|
38
|
+
* delegated to the pure `cropperReducer`. Sidebar and history
|
|
39
|
+
* concerns are first-class actions on this reducer.
|
|
40
|
+
*/
|
|
41
|
+
export type MediaEditorAction =
|
|
42
|
+
/**
|
|
43
|
+
* Delegate to the underlying cropper reducer. Used for every
|
|
44
|
+
* geometry transition (pan / zoom / rotation / flip / cropRect /
|
|
45
|
+
* settle / etc.).
|
|
46
|
+
*/
|
|
47
|
+
{
|
|
48
|
+
type: 'CROPPER';
|
|
49
|
+
action: CropperAction;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Set the aspect-ratio preset. Atomically updates the preset key
|
|
53
|
+
* and the cropRect (computed from the resolved ratio and the
|
|
54
|
+
* current visualSize). One transaction = one undo entry.
|
|
55
|
+
*/
|
|
56
|
+
| {
|
|
57
|
+
type: 'SET_ASPECT_RATIO_VALUE';
|
|
58
|
+
payload: {
|
|
59
|
+
/** Preset key as it appears in the dropdown. */
|
|
60
|
+
presetKey: string;
|
|
61
|
+
/**
|
|
62
|
+
* Resolved width/height ratio. `undefined` = Free
|
|
63
|
+
* (no lock; cropRect stays where it is).
|
|
64
|
+
*/
|
|
65
|
+
resolved: number | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Rendered image size used to compute the inscribed
|
|
68
|
+
* rect. Caller supplies it because the reducer is
|
|
69
|
+
* framework-agnostic and has no DOM access.
|
|
70
|
+
*/
|
|
71
|
+
visualSize: Size;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Reset cropOptions to defaults. */
|
|
75
|
+
| {
|
|
76
|
+
type: 'RESET_CROP_OPTIONS';
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Replace the entire composite state with `payload`. Used by
|
|
80
|
+
* undo/redo to restore a full snapshot atomically.
|
|
81
|
+
*/
|
|
82
|
+
| {
|
|
83
|
+
type: 'RESTORE_SNAPSHOT';
|
|
84
|
+
payload: MediaEditorState;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Adjust the cropper's cropRect in response to a viewport change
|
|
88
|
+
* (e.g., window resize). Behaviorally identical to a `CROPPER
|
|
89
|
+
* SET_CROP_RECT` dispatch, but tagged so the hook layer can skip
|
|
90
|
+
* history recording — viewport reshapes aren't editor actions.
|
|
91
|
+
*/
|
|
92
|
+
| {
|
|
93
|
+
type: 'VIEWPORT_ADJUST_CROP_RECT';
|
|
94
|
+
payload: NormalizedRect;
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB;AAC5B;;;;GAIG;AACD;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;CACrB;AACH;;;;GAIG;GACD;IACA,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE;QACR,gDAAgD;QAChD,SAAS,EAAE,MAAM,CAAC;QAClB;;;WAGG;QACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B;;;;WAIG;QACH,UAAU,EAAE,IAAI,CAAC;KACjB,CAAC;CACD;AACH,qCAAqC;GACnC;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE;AAChC;;;GAGG;GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE;AACzD;;;;;GAKG;GACD;IACA,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,cAAc,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type CropperController, type CropperState, type NormalizedRect, type Size } from '../image-editor';
|
|
5
|
+
import type { CropOptionsSlice } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve an aspect-ratio preset value (the string the dropdown
|
|
8
|
+
* round-trips) into a numeric width/height ratio for the cropper.
|
|
9
|
+
*
|
|
10
|
+
* - `'0'` → `undefined` (Free; no lock)
|
|
11
|
+
* - `'-1'` (Original) → image's natural width / height, or `undefined`
|
|
12
|
+
* if no image is loaded.
|
|
13
|
+
* - Any positive decimal → the parsed number.
|
|
14
|
+
*
|
|
15
|
+
* Centralizing here means the dropdown, the action dispatcher, and
|
|
16
|
+
* the test harness all resolve the same way.
|
|
17
|
+
*
|
|
18
|
+
* @param presetKey Preset value from the dropdown.
|
|
19
|
+
* @param cropperImage The cropper's loaded image, or `null`.
|
|
20
|
+
* @return The resolved ratio, or `undefined` for Free / unresolvable.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveAspectRatio(presetKey: string, cropperImage: CropperState['image'] | null): number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The composite controller exposed by `useMediaEditorState`.
|
|
25
|
+
*
|
|
26
|
+
* Satisfies `CropperController` (so a `<Cropper>` can take this
|
|
27
|
+
* controller directly via the `controller` prop) and adds slice
|
|
28
|
+
* setters, undo/redo, gesture boundaries, and viewport reporting.
|
|
29
|
+
*/
|
|
30
|
+
export interface MediaEditorController extends CropperController {
|
|
31
|
+
/** The cropOptions slice. */
|
|
32
|
+
cropOptions: CropOptionsSlice;
|
|
33
|
+
/** Set the aspect-ratio preset. Atomic with the cropRect reshape. */
|
|
34
|
+
setAspectRatioValue: (presetKey: string) => void;
|
|
35
|
+
/** Reset cropOptions to defaults. */
|
|
36
|
+
resetCropOptions: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the cropper geometry differs from the initial baseline.
|
|
39
|
+
*/
|
|
40
|
+
isCropperDirty: boolean;
|
|
41
|
+
/** Whether there's an undoable change in history. */
|
|
42
|
+
hasUndo: boolean;
|
|
43
|
+
/** Whether there's a redoable change in history. */
|
|
44
|
+
hasRedo: boolean;
|
|
45
|
+
/** Undo the last committed action across all slices. */
|
|
46
|
+
undo: () => void;
|
|
47
|
+
/** Redo the last undone action across all slices. */
|
|
48
|
+
redo: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Open a gesture boundary. During a gesture all state-changing
|
|
51
|
+
* actions coalesce into one undo entry — the snapshot taken at
|
|
52
|
+
* `beginGesture`. Pair with `endGesture` on pointer-up / key-up.
|
|
53
|
+
*/
|
|
54
|
+
beginGesture: () => void;
|
|
55
|
+
/** Close a gesture boundary and commit the pre-gesture snapshot. */
|
|
56
|
+
endGesture: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Report the current rendered image size to the controller. The
|
|
59
|
+
* Cropper component calls this whenever its visualSize changes;
|
|
60
|
+
* the controller needs it to compute aspect-ratio reshapes.
|
|
61
|
+
*/
|
|
62
|
+
setVisualSize: (size: Size) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Reshape the cropRect in response to a viewport change. Behaves
|
|
65
|
+
* like `setCropRect` but does NOT record an undo entry — window
|
|
66
|
+
* resizes aren't editor actions.
|
|
67
|
+
*/
|
|
68
|
+
adjustCropRectForViewport: (rect: NormalizedRect) => void;
|
|
69
|
+
}
|
|
70
|
+
interface InitialMediaEditorState {
|
|
71
|
+
cropper?: Partial<CropperState>;
|
|
72
|
+
cropOptions?: Partial<CropOptionsSlice>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Composite store for the media editor.
|
|
76
|
+
*
|
|
77
|
+
* Owns the only undo/redo history for the editor. Cropper geometry
|
|
78
|
+
* actions and sidebar cropOptions actions flow through the same
|
|
79
|
+
* reducer and the same history stack.
|
|
80
|
+
*
|
|
81
|
+
* History semantics:
|
|
82
|
+
* - Each action's pre-state is pushed to the undo stack before the
|
|
83
|
+
* action commits, unless a gesture is open or the action is a
|
|
84
|
+
* no-op (post-state value-equal to pre-state).
|
|
85
|
+
* - During a gesture (`beginGesture` → `endGesture`) all mutations
|
|
86
|
+
* coalesce: only the pre-gesture snapshot is pushed, at gesture
|
|
87
|
+
* end. Any pending gesture is flushed on undo/redo.
|
|
88
|
+
* - Viewport-driven cropRect reshapes (window resize) use a
|
|
89
|
+
* dedicated non-recording dispatch path so they never produce
|
|
90
|
+
* undo entries.
|
|
91
|
+
*
|
|
92
|
+
* `isDirty` tracks the full editor session, including undoable UI
|
|
93
|
+
* state. Use `isCropperDirty` when deciding whether the image output
|
|
94
|
+
* needs saving.
|
|
95
|
+
*
|
|
96
|
+
* @param initialState Optional seed for the cropper and cropOptions slices.
|
|
97
|
+
* @return The composite controller.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useMediaEditorState(initialState?: InitialMediaEditorState): MediaEditorController;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=use-media-editor-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-editor-state.d.ts","sourceRoot":"","sources":["../../src/state/use-media-editor-state.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,EAQN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EACX,gBAAgB,EAGhB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,CAAE,OAAO,CAAE,GAAG,IAAI,GAC1C,MAAM,GAAG,SAAS,CAmBpB;AAaD;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC/D,6BAA6B;IAC7B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,qEAAqE;IACrE,mBAAmB,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACnD,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qDAAqD;IACrD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,oEAAoE;IACpE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB;;;;OAIG;IACH,aAAa,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACtC;;;;OAIG;IACH,yBAAyB,EAAE,CAAE,IAAI,EAAE,cAAc,KAAM,IAAI,CAAC;CAC5D;AAED,UAAU,uBAAuB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAE,YAAY,CAAE,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAE,gBAAgB,CAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAClC,YAAY,CAAC,EAAE,uBAAuB,GACpC,qBAAqB,CA8SvB"}
|
|
@@ -14,11 +14,13 @@ export interface MediaEditorModalUpdate {
|
|
|
14
14
|
interface OpenMediaEditorModalArgs {
|
|
15
15
|
id: number;
|
|
16
16
|
onUpdate?: (updated: MediaEditorModalUpdate) => void;
|
|
17
|
+
onClose?: () => void;
|
|
17
18
|
}
|
|
18
|
-
export declare function openMediaEditorModal({ id, onUpdate }: OpenMediaEditorModalArgs): {
|
|
19
|
+
export declare function openMediaEditorModal({ id, onUpdate, onClose }: OpenMediaEditorModalArgs): {
|
|
19
20
|
type: 'OPEN_MEDIA_EDITOR_MODAL';
|
|
20
21
|
id: number;
|
|
21
22
|
onUpdate: ((updated: MediaEditorModalUpdate) => void) | null;
|
|
23
|
+
onClose: (() => void) | null;
|
|
22
24
|
};
|
|
23
25
|
export declare function closeMediaEditorModal(): {
|
|
24
26
|
type: 'CLOSE_MEDIA_EDITOR_MODAL';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAE,EACrC,EAAE,EACF,QAAQ,EACR,OAAO,EACP,EAAE,wBAAwB;UAEnB,yBAAyB;;yBAVV,sBAAsB,KAAM,IAAI;oBACtC,IAAI;EAcpB;AAED,wBAAgB,qBAAqB;IAC3B,IAAI,EAAE,0BAA0B;EACzC"}
|
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { MediaEditorModalUpdate } from './actions';
|
|
5
5
|
type OnUpdateCallback = (updated: MediaEditorModalUpdate) => void;
|
|
6
|
+
type OnCloseCallback = () => void;
|
|
6
7
|
export interface State {
|
|
7
8
|
isOpen: boolean;
|
|
8
9
|
id: number | null;
|
|
9
10
|
onUpdate: OnUpdateCallback | null;
|
|
11
|
+
onClose: OnCloseCallback | null;
|
|
10
12
|
}
|
|
11
13
|
export declare const DEFAULT_STATE: State;
|
|
12
14
|
type Action = {
|
|
13
15
|
type: 'OPEN_MEDIA_EDITOR_MODAL';
|
|
14
16
|
id: number;
|
|
15
17
|
onUpdate: OnUpdateCallback | null;
|
|
18
|
+
onClose: OnCloseCallback | null;
|
|
16
19
|
} | {
|
|
17
20
|
type: 'CLOSE_MEDIA_EDITOR_MODAL';
|
|
18
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,KAAK,gBAAgB,GAAG,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,KAAK,gBAAgB,GAAG,CAAE,OAAO,EAAE,sBAAsB,KAAM,IAAI,CAAC;AACpE,KAAK,eAAe,GAAG,MAAM,IAAI,CAAC;AAElC,MAAM,WAAW,KAAK;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,aAAa,EAAE,KAK3B,CAAC;AAEF,KAAK,MAAM,GACR;IACA,IAAI,EAAE,yBAAyB,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B,GACD;IAAE,IAAI,EAAE,0BAA0B,CAAA;CAAE,CAAC;AAExC,MAAM,CAAC,OAAO,UAAU,OAAO,CAC9B,KAAK,EAAE,KAAK,YAAgB,EAC5B,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B,KAAK,CAkBP"}
|
|
@@ -5,4 +5,5 @@ import type { State } from './reducer';
|
|
|
5
5
|
export declare function isOpen(state: State): boolean;
|
|
6
6
|
export declare function getId(state: State): number | null;
|
|
7
7
|
export declare function getOnUpdate(state: State): ((updated: import("./actions").MediaEditorModalUpdate) => void) | null;
|
|
8
|
+
export declare function getOnClose(state: State): (() => void) | null;
|
|
8
9
|
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,wBAAgB,MAAM,CAAE,KAAK,EAAE,KAAK,GAAI,OAAO,CAE9C;AAED,wBAAgB,KAAK,CAAE,KAAK,EAAE,KAAK,GAAI,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,WAAW,CAAE,KAAK,EAAE,KAAK,0EAExC"}
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,wBAAgB,MAAM,CAAE,KAAK,EAAE,KAAK,GAAI,OAAO,CAE9C;AAED,wBAAgB,KAAK,CAAE,KAAK,EAAE,KAAK,GAAI,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,WAAW,CAAE,KAAK,EAAE,KAAK,0EAExC;AAED,wBAAgB,UAAU,CAAE,KAAK,EAAE,KAAK,uBAEvC"}
|