@wordpress/media-editor 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/build/components/media-editor/index.cjs +74 -21
- package/build/components/media-editor/index.cjs.map +1 -1
- package/build/components/media-editor/use-crop-options.cjs +4 -5
- package/build/components/media-editor/use-crop-options.cjs.map +1 -1
- package/build/components/media-editor/use-save-media-editor.cjs +23 -3
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -1
- package/build/components/media-editor-canvas/index.cjs +6 -11
- package/build/components/media-editor-canvas/index.cjs.map +1 -1
- package/build/components/media-editor-crop-panel/index.cjs +17 -1
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -1
- package/build/components/media-editor-fine-rotation/index.cjs +4 -5
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -1
- package/build/components/media-editor-image-controls/index.cjs +4 -6
- package/build/components/media-editor-image-controls/index.cjs.map +1 -1
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +1 -0
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -1
- package/build/components/media-editor-modal/index.cjs.map +1 -1
- package/build/components/media-form/index.cjs +7 -1
- package/build/components/media-form/index.cjs.map +1 -1
- package/build/components/media-preview/index.cjs +0 -1
- package/build/components/media-preview/index.cjs.map +1 -1
- package/build/state/aspect-ratio-presets.cjs +10 -4
- package/build/state/aspect-ratio-presets.cjs.map +1 -1
- package/build/state/composite-reducer.cjs +32 -67
- package/build/state/composite-reducer.cjs.map +1 -1
- package/build/state/index.cjs +0 -39
- package/build/state/types.cjs +1 -2
- package/build/state/types.cjs.map +1 -1
- package/build/state/use-media-editor-state.cjs +70 -106
- package/build/state/use-media-editor-state.cjs.map +1 -1
- package/build-module/components/media-editor/index.mjs +78 -25
- package/build-module/components/media-editor/index.mjs.map +1 -1
- package/build-module/components/media-editor/use-crop-options.mjs +4 -5
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -1
- package/build-module/components/media-editor/use-save-media-editor.mjs +23 -3
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -1
- package/build-module/components/media-editor-canvas/index.mjs +8 -13
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -1
- package/build-module/components/media-editor-crop-panel/index.mjs +17 -1
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -1
- package/build-module/components/media-editor-fine-rotation/index.mjs +4 -5
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -1
- package/build-module/components/media-editor-image-controls/index.mjs +5 -7
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -1
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +1 -0
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -1
- package/build-module/components/media-editor-modal/index.mjs.map +1 -1
- package/build-module/components/media-form/index.mjs +7 -1
- package/build-module/components/media-form/index.mjs.map +1 -1
- package/build-module/components/media-preview/index.mjs +0 -1
- package/build-module/components/media-preview/index.mjs.map +1 -1
- package/build-module/state/aspect-ratio-presets.mjs +10 -5
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -1
- package/build-module/state/composite-reducer.mjs +32 -67
- package/build-module/state/composite-reducer.mjs.map +1 -1
- package/build-module/state/index.mjs +2 -5
- package/build-module/state/types.mjs +1 -2
- package/build-module/state/types.mjs.map +1 -1
- package/build-module/state/use-media-editor-state.mjs +70 -105
- package/build-module/state/use-media-editor-state.mjs.map +1 -1
- package/build-style/style-rtl.css +104 -57
- package/build-style/style.css +103 -57
- package/build-types/components/media-editor/index.d.ts +17 -3
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +2 -3
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts +3 -3
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts +1 -1
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/state/aspect-ratio-presets.d.ts +20 -3
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -1
- package/build-types/state/composite-reducer.d.ts +17 -19
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/index.d.ts +2 -5
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +20 -64
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +33 -52
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/package.json +22 -23
- package/src/components/media-editor/index.tsx +163 -28
- package/src/components/media-editor/use-crop-options.ts +7 -11
- package/src/components/media-editor/use-save-media-editor.ts +48 -6
- package/src/components/media-editor-canvas/index.tsx +15 -26
- package/src/components/media-editor-canvas/style.scss +6 -6
- package/src/components/media-editor-crop-panel/index.tsx +38 -2
- package/src/components/media-editor-crop-panel/style.scss +21 -0
- package/src/components/media-editor-fine-rotation/index.tsx +6 -6
- package/src/components/media-editor-image-controls/index.tsx +11 -9
- package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +1 -0
- package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +1 -1
- package/src/components/media-editor-modal/index.tsx +1 -1
- package/src/components/media-form/index.tsx +7 -1
- package/src/components/media-preview/index.tsx +0 -1
- package/src/components/rotation-ruler/style.scss +3 -3
- package/src/state/README.md +32 -0
- package/src/state/aspect-ratio-presets.ts +22 -3
- package/src/state/composite-reducer.ts +42 -80
- package/src/state/index.ts +2 -18
- package/src/state/types.ts +18 -68
- package/src/state/use-media-editor-state.ts +155 -240
- package/src/style.scss +2 -1
- package/build/components/media-editor-modal/build-modifiers.cjs +0 -110
- package/build/components/media-editor-modal/build-modifiers.cjs.map +0 -1
- package/build/image-editor/core/camera.cjs +0 -277
- package/build/image-editor/core/camera.cjs.map +0 -1
- package/build/image-editor/core/constants.cjs +0 -133
- package/build/image-editor/core/constants.cjs.map +0 -1
- package/build/image-editor/core/containment.cjs +0 -289
- package/build/image-editor/core/containment.cjs.map +0 -1
- package/build/image-editor/core/crop-rect.cjs +0 -37
- package/build/image-editor/core/crop-rect.cjs.map +0 -1
- package/build/image-editor/core/export/canvas-renderer.cjs +0 -181
- package/build/image-editor/core/export/canvas-renderer.cjs.map +0 -1
- package/build/image-editor/core/index.cjs +0 -89
- package/build/image-editor/core/interaction-controller.cjs +0 -591
- package/build/image-editor/core/interaction-controller.cjs.map +0 -1
- package/build/image-editor/core/math/rotation.cjs +0 -32
- package/build/image-editor/core/math/rotation.cjs.map +0 -1
- package/build/image-editor/core/math/sanitize.cjs +0 -136
- package/build/image-editor/core/math/sanitize.cjs.map +0 -1
- package/build/image-editor/core/setter-helpers.cjs +0 -61
- package/build/image-editor/core/setter-helpers.cjs.map +0 -1
- package/build/image-editor/core/source-region.cjs +0 -236
- package/build/image-editor/core/source-region.cjs.map +0 -1
- package/build/image-editor/core/state.cjs +0 -296
- package/build/image-editor/core/state.cjs.map +0 -1
- package/build/image-editor/core/stencil-math.cjs +0 -203
- package/build/image-editor/core/stencil-math.cjs.map +0 -1
- package/build/image-editor/core/transform-style.cjs +0 -43
- package/build/image-editor/core/transform-style.cjs.map +0 -1
- package/build/image-editor/core/transforms/pipeline.cjs +0 -41
- package/build/image-editor/core/transforms/pipeline.cjs.map +0 -1
- package/build/image-editor/core/types.cjs +0 -5
- package/build/image-editor/core/viewport-state.cjs +0 -36
- package/build/image-editor/core/viewport-state.cjs.map +0 -1
- package/build/image-editor/index.cjs +0 -68
- package/build/image-editor/react/components/cropper-provider.cjs +0 -49
- package/build/image-editor/react/components/cropper-provider.cjs.map +0 -1
- package/build/image-editor/react/components/cropper.cjs +0 -595
- package/build/image-editor/react/components/cropper.cjs.map +0 -1
- package/build/image-editor/react/components/index.cjs +0 -25
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +0 -147
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +0 -31
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +0 -61
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +0 -1
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +0 -367
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +0 -1
- package/build/image-editor/react/components/viewport-provider.cjs +0 -26
- package/build/image-editor/react/components/viewport-provider.cjs.map +0 -1
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +0 -80
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +0 -1
- package/build/image-editor/react/hooks/index.cjs +0 -19
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +0 -104
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-cropper-controller.cjs +0 -80
- package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-interaction.cjs +0 -187
- package/build/image-editor/react/hooks/use-interaction.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-transform-style.cjs +0 -24
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +0 -1
- package/build/image-editor/react/hooks/use-viewport-state.cjs +0 -40
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +0 -1
- package/build/image-editor/react/visually-hidden-style.cjs +0 -24
- package/build/image-editor/react/visually-hidden-style.cjs.map +0 -1
- package/build-module/components/media-editor-modal/build-modifiers.mjs +0 -105
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +0 -1
- package/build-module/image-editor/core/camera.mjs +0 -265
- package/build-module/image-editor/core/camera.mjs.map +0 -1
- package/build-module/image-editor/core/constants.mjs +0 -115
- package/build-module/image-editor/core/constants.mjs.map +0 -1
- package/build-module/image-editor/core/containment.mjs +0 -281
- package/build-module/image-editor/core/containment.mjs.map +0 -1
- package/build-module/image-editor/core/crop-rect.mjs +0 -32
- package/build-module/image-editor/core/crop-rect.mjs.map +0 -1
- package/build-module/image-editor/core/export/canvas-renderer.mjs +0 -170
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +0 -1
- package/build-module/image-editor/core/index.mjs +0 -7
- package/build-module/image-editor/core/interaction-controller.mjs +0 -586
- package/build-module/image-editor/core/interaction-controller.mjs.map +0 -1
- package/build-module/image-editor/core/math/rotation.mjs +0 -26
- package/build-module/image-editor/core/math/rotation.mjs.map +0 -1
- package/build-module/image-editor/core/math/sanitize.mjs +0 -127
- package/build-module/image-editor/core/math/sanitize.mjs.map +0 -1
- package/build-module/image-editor/core/setter-helpers.mjs +0 -56
- package/build-module/image-editor/core/setter-helpers.mjs.map +0 -1
- package/build-module/image-editor/core/source-region.mjs +0 -228
- package/build-module/image-editor/core/source-region.mjs.map +0 -1
- package/build-module/image-editor/core/state.mjs +0 -288
- package/build-module/image-editor/core/state.mjs.map +0 -1
- package/build-module/image-editor/core/stencil-math.mjs +0 -194
- package/build-module/image-editor/core/stencil-math.mjs.map +0 -1
- package/build-module/image-editor/core/transform-style.mjs +0 -38
- package/build-module/image-editor/core/transform-style.mjs.map +0 -1
- package/build-module/image-editor/core/transforms/pipeline.mjs +0 -35
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +0 -1
- package/build-module/image-editor/core/types.mjs +0 -0
- package/build-module/image-editor/core/viewport-state.mjs +0 -30
- package/build-module/image-editor/core/viewport-state.mjs.map +0 -1
- package/build-module/image-editor/index.mjs +0 -4
- package/build-module/image-editor/react/components/cropper-provider.mjs +0 -43
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +0 -1
- package/build-module/image-editor/react/components/cropper.mjs +0 -568
- package/build-module/image-editor/react/components/cropper.mjs.map +0 -1
- package/build-module/image-editor/react/components/index.mjs +0 -3
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +0 -142
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +0 -26
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +0 -56
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +0 -1
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +0 -362
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +0 -1
- package/build-module/image-editor/react/components/viewport-provider.mjs +0 -20
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +0 -75
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/index.mjs +0 -3
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +0 -99
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +0 -75
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-interaction.mjs +0 -182
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +0 -19
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +0 -1
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +0 -35
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +0 -1
- package/build-module/image-editor/react/visually-hidden-style.mjs +0 -19
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +0 -1
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -81
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +0 -1
- package/build-types/image-editor/core/camera.d.ts +0 -128
- package/build-types/image-editor/core/camera.d.ts.map +0 -1
- package/build-types/image-editor/core/constants.d.ts +0 -98
- package/build-types/image-editor/core/constants.d.ts.map +0 -1
- package/build-types/image-editor/core/containment.d.ts +0 -72
- package/build-types/image-editor/core/containment.d.ts.map +0 -1
- package/build-types/image-editor/core/crop-rect.d.ts +0 -16
- package/build-types/image-editor/core/crop-rect.d.ts.map +0 -1
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +0 -103
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +0 -1
- package/build-types/image-editor/core/index.d.ts +0 -10
- package/build-types/image-editor/core/index.d.ts.map +0 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +0 -191
- package/build-types/image-editor/core/interaction-controller.d.ts.map +0 -1
- package/build-types/image-editor/core/math/rotation.d.ts +0 -18
- package/build-types/image-editor/core/math/rotation.d.ts.map +0 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +0 -67
- package/build-types/image-editor/core/math/sanitize.d.ts.map +0 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +0 -21
- package/build-types/image-editor/core/setter-helpers.d.ts.map +0 -1
- package/build-types/image-editor/core/source-region.d.ts +0 -94
- package/build-types/image-editor/core/source-region.d.ts.map +0 -1
- package/build-types/image-editor/core/state.d.ts +0 -51
- package/build-types/image-editor/core/state.d.ts.map +0 -1
- package/build-types/image-editor/core/stencil-math.d.ts +0 -102
- package/build-types/image-editor/core/stencil-math.d.ts.map +0 -1
- package/build-types/image-editor/core/transform-style.d.ts +0 -20
- package/build-types/image-editor/core/transform-style.d.ts.map +0 -1
- package/build-types/image-editor/core/transforms/pipeline.d.ts +0 -24
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +0 -1
- package/build-types/image-editor/core/types.d.ts +0 -269
- package/build-types/image-editor/core/types.d.ts.map +0 -1
- package/build-types/image-editor/core/viewport-state.d.ts +0 -4
- package/build-types/image-editor/core/viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/index.d.ts +0 -17
- package/build-types/image-editor/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +0 -38
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/components/cropper.d.ts +0 -54
- package/build-types/image-editor/react/components/cropper.d.ts.map +0 -1
- package/build-types/image-editor/react/components/index.d.ts +0 -4
- package/build-types/image-editor/react/components/index.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +0 -33
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +0 -17
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +0 -27
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +0 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +0 -33
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +0 -1
- package/build-types/image-editor/react/components/viewport-provider.d.ts +0 -6
- package/build-types/image-editor/react/components/viewport-provider.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +0 -44
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/index.d.ts +0 -5
- package/build-types/image-editor/react/hooks/index.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +0 -14
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts +0 -55
- package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +0 -65
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +0 -13
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +0 -16
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +0 -1
- package/build-types/image-editor/react/visually-hidden-style.d.ts +0 -6
- package/build-types/image-editor/react/visually-hidden-style.d.ts.map +0 -1
- package/src/components/media-editor-modal/build-modifiers.ts +0 -167
- package/src/image-editor/README.md +0 -61
- package/src/image-editor/core/camera.ts +0 -429
- package/src/image-editor/core/constants.ts +0 -137
- package/src/image-editor/core/containment.ts +0 -469
- package/src/image-editor/core/crop-rect.ts +0 -42
- package/src/image-editor/core/export/canvas-renderer.ts +0 -250
- package/src/image-editor/core/index.ts +0 -43
- package/src/image-editor/core/interaction-controller.ts +0 -976
- package/src/image-editor/core/math/rotation.ts +0 -26
- package/src/image-editor/core/math/sanitize.ts +0 -155
- package/src/image-editor/core/setter-helpers.ts +0 -63
- package/src/image-editor/core/source-region.ts +0 -367
- package/src/image-editor/core/state.ts +0 -484
- package/src/image-editor/core/stencil-math.ts +0 -379
- package/src/image-editor/core/transform-style.ts +0 -56
- package/src/image-editor/core/transforms/pipeline.ts +0 -40
- package/src/image-editor/core/types.ts +0 -230
- package/src/image-editor/core/viewport-state.ts +0 -30
- package/src/image-editor/docs/architecture.md +0 -63
- package/src/image-editor/docs/recipes.md +0 -184
- package/src/image-editor/index.ts +0 -43
- package/src/image-editor/react/components/cropper-provider.tsx +0 -70
- package/src/image-editor/react/components/cropper.scss +0 -259
- package/src/image-editor/react/components/cropper.tsx +0 -1108
- package/src/image-editor/react/components/index.ts +0 -3
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +0 -262
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +0 -55
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +0 -77
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +0 -623
- package/src/image-editor/react/components/viewport-provider.tsx +0 -32
- package/src/image-editor/react/hooks/build-cropper-setters.ts +0 -102
- package/src/image-editor/react/hooks/index.ts +0 -4
- package/src/image-editor/react/hooks/use-aria-announcer.ts +0 -193
- package/src/image-editor/react/hooks/use-cropper-controller.ts +0 -197
- package/src/image-editor/react/hooks/use-interaction.ts +0 -294
- package/src/image-editor/react/hooks/use-transform-style.ts +0 -23
- package/src/image-editor/react/hooks/use-viewport-state.ts +0 -41
- package/src/image-editor/react/visually-hidden-style.ts +0 -15
- package/src/image-editor/style.scss +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Field, Form } from '@wordpress/dataviews';
|
|
1
|
+
import type { Action, Field, Form } from '@wordpress/dataviews';
|
|
2
2
|
import type { KeyboardEvent as ReactKeyboardEvent, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { AspectRatioPreset } from '../../state/aspect-ratio-presets';
|
|
3
4
|
import type { Media } from '../media-editor-provider';
|
|
4
|
-
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
5
5
|
import { type MediaEditorSaveResult } from './use-save-media-editor';
|
|
6
6
|
export type { MediaEditorSaveResult } from './use-save-media-editor';
|
|
7
7
|
export interface MediaEditorFrameProps {
|
|
@@ -35,6 +35,8 @@ export interface MediaEditorProps {
|
|
|
35
35
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
36
36
|
onClose?: () => void;
|
|
37
37
|
onSaved?: (result: MediaEditorSaveResult) => void;
|
|
38
|
+
/** Called with the original's id when the user chooses "Edit original". */
|
|
39
|
+
onEditOriginal?: (originalId: number) => void;
|
|
38
40
|
renderFrame: (props: MediaEditorFrameProps) => ReactElement;
|
|
39
41
|
noticesClassName?: string;
|
|
40
42
|
noticesPortalElement?: Element | null;
|
|
@@ -50,7 +52,19 @@ export interface HeaderActionsProps {
|
|
|
50
52
|
showCloseButton?: boolean;
|
|
51
53
|
}
|
|
52
54
|
declare function PanelToggle(): import("react").JSX.Element;
|
|
53
|
-
|
|
55
|
+
export interface MoreMenuProps {
|
|
56
|
+
/**
|
|
57
|
+
* Actions for the attachment, such as those from the entity actions API.
|
|
58
|
+
* Only the ones whose `isEligible` passes for `item` are shown.
|
|
59
|
+
*/
|
|
60
|
+
actions?: Action<Media>[];
|
|
61
|
+
/**
|
|
62
|
+
* The attachment the actions apply to, with anything their `isEligible`
|
|
63
|
+
* checks need, such as `permissions`. Without it no actions are shown.
|
|
64
|
+
*/
|
|
65
|
+
item?: Media;
|
|
66
|
+
}
|
|
67
|
+
declare function MoreMenu({ actions, item }: MoreMenuProps): import("react").JSX.Element | null;
|
|
54
68
|
declare function HeaderActions({ showCloseButton }: HeaderActionsProps): import("react").JSX.Element;
|
|
55
69
|
declare function HistoryActions(): import("react").JSX.Element | null;
|
|
56
70
|
export interface SaveActionsProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,MAAM,EAAe,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EACX,aAAa,IAAI,kBAAkB,EACnC,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAWtD,OAAO,EAGN,KAAK,qBAAqB,EAC1B,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AA8CrE,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAE,KAAK,EAAE,kBAAkB,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IAChE,yBAAyB,EAAE,OAAO,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAE,MAAM,EAAE,qBAAqB,KAAM,IAAI,CAAC;IACpD,2EAA2E;IAC3E,cAAc,CAAC,EAAE,CAAE,UAAU,EAAE,MAAM,KAAM,IAAI,CAAC;IAChD,WAAW,EAAE,CAAE,KAAK,EAAE,qBAAqB,KAAM,YAAY,CAAC;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAsID,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iBAAS,WAAW,gCAmBnB;AAsCD,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAE,KAAK,CAAE,EAAE,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;CACb;AAED,iBAAS,QAAQ,CAAE,EAAE,OAAY,EAAE,IAAI,EAAE,EAAE,aAAa,sCAuGvD;AAED,iBAAS,aAAa,CAAE,EAAE,eAAuB,EAAE,EAAE,kBAAkB,+BAuBtE;AAED,iBAAS,cAAc,uCA6HtB;AAED,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC7B;AAED,iBAAS,WAAW,CAAE,EAAE,IAAgB,EAAE,EAAE,gBAAgB,+BAkC3D;AA2gBD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;yBANe,WAAW;;;;;;;eAiBZ,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AspectRatioPreset } from '../../state/aspect-ratio-presets';
|
|
2
2
|
interface UseCropOptionsArgs {
|
|
3
3
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
4
4
|
}
|
|
@@ -20,8 +20,7 @@ export declare function getAspectRatioOptions(aspectRatioPresets?: AspectRatioPr
|
|
|
20
20
|
/**
|
|
21
21
|
* Thin selector over the composite media-editor store for the Crop
|
|
22
22
|
* sidebar tab. Reads the cropOptions slice (preset key) and exposes
|
|
23
|
-
* the corresponding setters plus
|
|
24
|
-
* derivation.
|
|
23
|
+
* the corresponding setters plus the ratio the image editor has locked.
|
|
25
24
|
*
|
|
26
25
|
* No local React state, no refs, no synchronization effects — the
|
|
27
26
|
* composite store is the single source of truth.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,kCAAkC,CAAC;AAG1C,UAAU,kBAAkB;IAC3B,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,UAAU,oBAAoB;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GACtC,iBAAiB,EAAE,CAMrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAE,EAC/B,kBAAkB,GAClB,GAAE,kBAAuB,GAAI,oBAAoB,CAmBjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAwCtD,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAI3D,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACF;AAED,UAAU,sBAAsB;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAE,MAAM,EAAE,qBAAqB,KAAM,IAAI,CAAC;IACpD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,KAAK,CAAC;KACb,CAAC;CACF;AAED,UAAU,wBAAwB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,OAAO,CAAE,IAAI,CAAE,CAAC;CAC5B;AA+CD,wBAAgB,kBAAkB,CAAE,EACnC,OAAO,EACP,EAAE,EACF,OAAO,EACP,KAAK,EACL,OAAO,EACP,iBAAiB,GACjB,EAAE,sBAAsB,GAAI,wBAAwB,CAkJpD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface MediaEditorCanvasProps {
|
|
2
2
|
/** Whether external placement activity should reveal the grid. */
|
|
3
3
|
isPlacementActive?: boolean;
|
|
4
|
-
/** Fires when a canvas
|
|
4
|
+
/** Fires when a canvas gesture begins. */
|
|
5
5
|
onGestureStart?: () => void;
|
|
6
|
-
/** Fires when a canvas
|
|
6
|
+
/** Fires when a canvas gesture ends. */
|
|
7
7
|
onGestureEnd?: () => void;
|
|
8
8
|
/**
|
|
9
9
|
* Disable crop interaction on the canvas. Set while the edit is saving,
|
|
@@ -13,7 +13,7 @@ export interface MediaEditorCanvasProps {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Editing surface for image media in the media editor modal. Pulls
|
|
16
|
-
* its
|
|
16
|
+
* its image editor controller from the surrounding `<MediaEditorStateProvider>`
|
|
17
17
|
* so the bottom bar and Crop sidebar tab share the same state.
|
|
18
18
|
*
|
|
19
19
|
* Returns `null` for missing or non-image media so the modal's outer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,QAAgB,GAChB,EAAE,sBAAsB,sCA6GxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AspectRatioPreset } from '../../
|
|
1
|
+
import type { AspectRatioPreset } from '../../state/aspect-ratio-presets';
|
|
2
2
|
export interface MediaEditorCropPanelProps {
|
|
3
3
|
/**
|
|
4
4
|
* Selected aspect-ratio preset value as a string (so it round-trips
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAI1E,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,QAAgB,GAChB,EAAE,yBAAyB,+BAsE3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-fine-rotation/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-fine-rotation/index.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,4BAA4B;IAC5C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAE,EAChD,6BAA6B,EAC7B,QAAgB,GAChB,EAAE,4BAA4B,+BA+C9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AspectRatioPreset } from '../../state/aspect-ratio-presets';
|
|
2
2
|
/**
|
|
3
3
|
* Default zoom factor per +/- click. Zooming is geometric, so a fixed
|
|
4
4
|
* multiplier — rather than an additive step — makes each click feel like the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAG1E;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC7C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,EAChC,QAAgB,GAChB,EAAE,6BAA6B,+BAwM/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-keyboard-shortcuts-modal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-keyboard-shortcuts-modal/index.tsx"],"names":[],"mappings":"AAkIA,UAAU,sCAAsC;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,iCAAiC,CAAE,EAC1D,OAAO,GACP,EAAE,sCAAsC,+BAsCxC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Field, Form } from '@wordpress/dataviews';
|
|
2
|
+
import type { AspectRatioPreset } from '../../state/aspect-ratio-presets';
|
|
2
3
|
import type { Media } from '../media-editor-provider';
|
|
3
|
-
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
4
4
|
interface MediaEditorModalProps {
|
|
5
5
|
/**
|
|
6
6
|
* Attachment fields to render in the Details tab.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAItD,UAAU,qBAAqB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAqBD,wBAAgB,gBAAgB,CAAE,EACjC,MAAW,EACX,IAAI,EACJ,kBAAkB,GAClB,EAAE,qBAAqB,sCAiHvB;eAEc,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAOjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-form/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAOjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAuCvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAClC,IAAI,EAAE,aAAa,EACnB,MAAM,GACN,EAAE,cAAc,+BAkChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-preview/index.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,CAAE,GAAG,EAAE,MAAM,GAAI,GAAG,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-preview/index.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,CAAE,GAAG,EAAE,MAAM,GAAI,GAAG,CAAC;CACrB;AA2GD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,KAAK,EAAE,iBAAiB,+BAgE7D"}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import { type AspectRatioPreset } from '../image-editor';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
2
|
+
* An aspect ratio preset with a human-readable label.
|
|
3
|
+
*/
|
|
4
|
+
export interface AspectRatioPreset {
|
|
5
|
+
/** Display label (e.g., "Square (1:1)"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The aspect ratio value (width / height). 0 = free,
|
|
9
|
+
* `ORIGINAL_ASPECT_RATIO` = the image's own ratio.
|
|
10
|
+
*/
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Sentinel value for "Original" aspect ratio — resolved at runtime
|
|
15
|
+
* to the image's natural width / height.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ORIGINAL_ASPECT_RATIO = -1;
|
|
18
|
+
/**
|
|
19
|
+
* The presets the editor offers by default. They live here rather than
|
|
20
|
+
* in the image editor package, because which ratios to offer, and what
|
|
21
|
+
* to call them, is a product choice. The package takes a plain number.
|
|
5
22
|
*/
|
|
6
23
|
export declare const DEFAULT_ASPECT_RATIOS: AspectRatioPreset[];
|
|
7
24
|
//# sourceMappingURL=aspect-ratio-presets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aspect-ratio-presets.d.ts","sourceRoot":"","sources":["../../src/state/aspect-ratio-presets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aspect-ratio-presets.d.ts","sourceRoot":"","sources":["../../src/state/aspect-ratio-presets.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,EAUpD,CAAC"}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ImageEditorState } from '@wordpress/image-editor';
|
|
2
2
|
import { type MediaEditorAction, type MediaEditorState } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Pure
|
|
4
|
+
* Pure reducer for the media editor.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
* in one transaction (used by undo/redo).
|
|
6
|
+
* The image editor works out its own next state (through the controller from
|
|
7
|
+
* `@wordpress/image-editor`) and this reducer stores it. The reducer
|
|
8
|
+
* also owns the sidebar crop options and the named edits.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* stacks live in the `useMediaEditorState` hook that wraps it.
|
|
10
|
+
* This reducer keeps no history; `useMediaEditorState` does.
|
|
13
11
|
*
|
|
14
|
-
* @param state Current
|
|
12
|
+
* @param state Current state.
|
|
15
13
|
* @param action Action to apply.
|
|
16
|
-
* @return Next
|
|
14
|
+
* @return Next state.
|
|
17
15
|
*/
|
|
18
16
|
export declare function mediaEditorReducer(state: MediaEditorState, action: MediaEditorAction): MediaEditorState;
|
|
19
17
|
/**
|
|
20
|
-
* Value-equality check for two
|
|
21
|
-
*
|
|
18
|
+
* Value-equality check for two media editor states. The history uses it
|
|
19
|
+
* to skip snapshots when an action turned out to be a no-op.
|
|
22
20
|
*
|
|
23
|
-
* @param a First
|
|
24
|
-
* @param b Second
|
|
21
|
+
* @param a First state.
|
|
22
|
+
* @param b Second state.
|
|
25
23
|
* @return Whether `a` and `b` are value-equal across all slices.
|
|
26
24
|
*/
|
|
27
25
|
export declare function areMediaEditorStatesEqual(a: MediaEditorState, b: MediaEditorState): boolean;
|
|
28
26
|
/**
|
|
29
|
-
* Build the
|
|
30
|
-
*
|
|
27
|
+
* Build the state a session starts from: the given image editor state,
|
|
28
|
+
* default crop options, and no edits.
|
|
31
29
|
*
|
|
32
|
-
* @param
|
|
33
|
-
* @return
|
|
30
|
+
* @param imageEditor The image editor state.
|
|
31
|
+
* @return Initial state.
|
|
34
32
|
*/
|
|
35
|
-
export declare function buildInitialMediaEditorState(
|
|
33
|
+
export declare function buildInitialMediaEditorState(imageEditor: ImageEditorState): MediaEditorState;
|
|
36
34
|
//# sourceMappingURL=composite-reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composite-reducer.d.ts","sourceRoot":"","sources":["../../src/state/composite-reducer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"composite-reducer.d.ts","sourceRoot":"","sources":["../../src/state/composite-reducer.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,iBAAiB,GACvB,gBAAgB,CAwClB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,CAAC,EAAE,gBAAgB,EACnB,CAAC,EAAE,gBAAgB,GACjB,OAAO,CAST;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC3C,WAAW,EAAE,gBAAgB,GAC3B,gBAAgB,CAMlB"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export { useMediaEditorState
|
|
1
|
+
export { useMediaEditorState } from './use-media-editor-state';
|
|
2
2
|
export type { MediaEditorSession } from './use-media-editor-state';
|
|
3
3
|
export { MediaEditorStateProvider, useMediaEditor, } from './media-editor-state-provider';
|
|
4
|
-
export {
|
|
5
|
-
export { DEFAULT_CROP_OPTIONS } from './types';
|
|
6
|
-
export { DEFAULT_ASPECT_RATIOS } from './aspect-ratio-presets';
|
|
7
|
-
export type { CropOptionsSlice, EditsSlice, EditValue, MediaEditorState, MediaEditorAction, } from './types';
|
|
4
|
+
export type { EditsSlice, EditValue, MediaEditorState } from './types';
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACN,wBAAwB,EACxB,cAAc,GACd,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CropperAction } from '../image-editor/core';
|
|
1
|
+
import type { ImageEditorState } from '@wordpress/image-editor';
|
|
3
2
|
/**
|
|
4
|
-
* Sidebar control state for the
|
|
5
|
-
*
|
|
3
|
+
* Sidebar control state for the image editor, kept in the same undo history
|
|
4
|
+
* as the crop.
|
|
6
5
|
*/
|
|
7
6
|
export interface CropOptionsSlice {
|
|
8
7
|
/**
|
|
9
8
|
* Selected aspect-ratio preset as a string (round-trippable through
|
|
10
9
|
* `<SelectControl>`). `'0'` = Free, `'-1'` = Original, any positive
|
|
11
|
-
* decimal = fixed ratio.
|
|
10
|
+
* decimal = fixed ratio. The image editor holds the resolved ratio itself.
|
|
12
11
|
*/
|
|
13
12
|
aspectRatioValue: string;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
* used by the sidebar before the user has touched anything.
|
|
15
|
+
* The crop options a session starts from.
|
|
18
16
|
*/
|
|
19
17
|
export declare const DEFAULT_CROP_OPTIONS: CropOptionsSlice;
|
|
20
18
|
/**
|
|
@@ -35,64 +33,28 @@ export type EditValue = string | number | boolean | null | EditValue[] | {
|
|
|
35
33
|
*/
|
|
36
34
|
export type EditsSlice = Record<string, EditValue>;
|
|
37
35
|
/**
|
|
38
|
-
* The full
|
|
39
|
-
*
|
|
36
|
+
* The full state of the media editor: the image editor's state, the sidebar
|
|
37
|
+
* crop options and named edits.
|
|
40
38
|
*
|
|
41
39
|
* Every undo/redo snapshot is a full `MediaEditorState`. Slices stay
|
|
42
40
|
* referentially equal across actions that don't touch them.
|
|
43
41
|
*/
|
|
44
42
|
export interface MediaEditorState {
|
|
45
|
-
|
|
43
|
+
imageEditor: ImageEditorState;
|
|
46
44
|
cropOptions: CropOptionsSlice;
|
|
47
45
|
edits: EditsSlice;
|
|
48
46
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Composite reducer action union.
|
|
51
|
-
*
|
|
52
|
-
* Cropper geometry actions are wrapped in a `CROPPER` envelope and
|
|
53
|
-
* delegated to the pure `cropperReducer`. Sidebar and history
|
|
54
|
-
* concerns are first-class actions on this reducer.
|
|
55
|
-
*/
|
|
47
|
+
/** Actions the media editor reducer handles. */
|
|
56
48
|
export type MediaEditorAction =
|
|
57
|
-
/**
|
|
58
|
-
* Delegate to the underlying cropper reducer. Used for every
|
|
59
|
-
* geometry transition (pan / zoom / rotation / flip / cropRect /
|
|
60
|
-
* settle / etc.).
|
|
61
|
-
*/
|
|
49
|
+
/** Replace the image editor's state with the next one it reports. */
|
|
62
50
|
{
|
|
63
|
-
type: '
|
|
64
|
-
|
|
51
|
+
type: 'SET_IMAGE_EDITOR';
|
|
52
|
+
payload: ImageEditorState;
|
|
65
53
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Set the aspect-ratio preset. Atomically updates the preset key
|
|
68
|
-
* and the cropRect (computed from the resolved ratio and the
|
|
69
|
-
* current visualSize). One transaction = one undo entry.
|
|
70
|
-
*/
|
|
54
|
+
/** Set the aspect-ratio preset the dropdown shows. */
|
|
71
55
|
| {
|
|
72
56
|
type: 'SET_ASPECT_RATIO_VALUE';
|
|
73
|
-
payload:
|
|
74
|
-
/** Preset key as it appears in the dropdown. */
|
|
75
|
-
presetKey: string;
|
|
76
|
-
/**
|
|
77
|
-
* Resolved width/height ratio. `undefined` = Free
|
|
78
|
-
* (no lock; cropRect stays where it is).
|
|
79
|
-
*/
|
|
80
|
-
resolved: number | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Rendered image size used to compute the inscribed
|
|
83
|
-
* rect. Caller supplies it because the reducer is
|
|
84
|
-
* framework-agnostic and has no DOM access.
|
|
85
|
-
*/
|
|
86
|
-
visualSize: Size;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Put every slice back to its starting state, keeping the image:
|
|
91
|
-
* default geometry, default crop options, no edits. One action,
|
|
92
|
-
* so one undo entry.
|
|
93
|
-
*/
|
|
94
|
-
| {
|
|
95
|
-
type: 'RESET';
|
|
57
|
+
payload: string;
|
|
96
58
|
}
|
|
97
59
|
/** Set a named edit, or remove it when `value` is `undefined`. */
|
|
98
60
|
| {
|
|
@@ -103,21 +65,15 @@ export type MediaEditorAction =
|
|
|
103
65
|
};
|
|
104
66
|
}
|
|
105
67
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
68
|
+
* Put every slice back to its starting state, keeping the image. One
|
|
69
|
+
* action, so one undo entry.
|
|
108
70
|
*/
|
|
109
71
|
| {
|
|
110
|
-
type: '
|
|
111
|
-
payload: MediaEditorState;
|
|
72
|
+
type: 'RESET';
|
|
112
73
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Adjust the cropper's cropRect in response to a viewport change
|
|
115
|
-
* (e.g., window resize). Behaviorally identical to a `CROPPER
|
|
116
|
-
* SET_CROP_RECT` dispatch, but tagged so the hook layer can skip
|
|
117
|
-
* history recording — viewport reshapes aren't editor actions.
|
|
118
|
-
*/
|
|
74
|
+
/** Replace the whole state with a snapshot (undo/redo). */
|
|
119
75
|
| {
|
|
120
|
-
type: '
|
|
121
|
-
payload:
|
|
76
|
+
type: 'RESTORE_SNAPSHOT';
|
|
77
|
+
payload: MediaEditorState;
|
|
122
78
|
};
|
|
123
79
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAClB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAE,GAAG,EAAE,MAAM,GAAI,SAAS,CAAA;CAAE,CAAC;AAElC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAE,MAAM,EAAE,SAAS,CAAE,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC;CAClB;AAED,gDAAgD;AAChD,MAAM,MAAM,iBAAiB;AAC5B,qEAAqE;AACnE;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE;AACzD,sDAAsD;GACpD;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACrD,kEAAkE;GAChE;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAA;KAAE,CAAC;CACvD;AACH;;;GAGG;GACD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE;AACnB,2DAA2D;GACzD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC"}
|
|
@@ -1,47 +1,30 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ImageEditorController, type ImageEditorState } from '@wordpress/image-editor';
|
|
2
2
|
import type { CropOptionsSlice, EditsSlice, EditValue } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Resolve an aspect-ratio preset value (the string the dropdown
|
|
5
|
-
* round-trips) into a numeric width/height ratio for the cropper.
|
|
6
|
-
*
|
|
7
|
-
* - `'0'` → `undefined` (Free; no lock)
|
|
8
|
-
* - `'-1'` (Original) → image's natural width / height, or `undefined`
|
|
9
|
-
* if no image is loaded.
|
|
10
|
-
* - Any positive decimal → the parsed number.
|
|
11
|
-
*
|
|
12
|
-
* Centralizing here means the dropdown, the action dispatcher, and
|
|
13
|
-
* the test harness all resolve the same way.
|
|
14
|
-
*
|
|
15
|
-
* @param presetKey Preset value from the dropdown.
|
|
16
|
-
* @param cropperImage The cropper's loaded image, or `null`.
|
|
17
|
-
* @return The resolved ratio, or `undefined` for Free / unresolvable.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveAspectRatio(presetKey: string, cropperImage: CropperState['image'] | null): number | undefined;
|
|
20
3
|
/**
|
|
21
4
|
* The media editor session exposed by `useMediaEditorState`.
|
|
22
5
|
*
|
|
23
6
|
* The session owns what is being edited and how: the source image,
|
|
24
7
|
* every editing slice, the shared undo/redo history, gesture
|
|
25
8
|
* boundaries, and whether the edits change the saved image. The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
9
|
+
* image editor is one participant in the session — `imageEditor` is the
|
|
10
|
+
* controller an `<ImageEditorCanvas>` takes via its `controller` prop — rather
|
|
11
|
+
* than the session itself.
|
|
29
12
|
*/
|
|
30
13
|
export interface MediaEditorSession {
|
|
31
14
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
15
|
+
* Controller for the image editor. Its setters record history in the
|
|
16
|
+
* session; its `isDirty` covers the crop only. Its `setImage` is
|
|
17
|
+
* `setSourceImage`, so the `<ImageEditorCanvas>` reporting a newly loaded
|
|
18
|
+
* image starts a fresh session.
|
|
36
19
|
*/
|
|
37
|
-
|
|
20
|
+
imageEditor: ImageEditorController;
|
|
38
21
|
/** The cropOptions slice. */
|
|
39
22
|
cropOptions: CropOptionsSlice;
|
|
40
|
-
/** Set the aspect-ratio preset
|
|
23
|
+
/** Set the aspect-ratio preset and reshape the crop in one undo entry. */
|
|
41
24
|
setAspectRatioValue: (presetKey: string) => void;
|
|
42
25
|
/**
|
|
43
26
|
* Put every slice back to its starting state in one undo entry:
|
|
44
|
-
* default
|
|
27
|
+
* default crop and crop options, no edits. Keeps the image.
|
|
45
28
|
*/
|
|
46
29
|
reset: () => void;
|
|
47
30
|
/** The named edits other than crop, keyed by edit name. */
|
|
@@ -54,11 +37,10 @@ export interface MediaEditorSession {
|
|
|
54
37
|
setEdit: (name: string, value: EditValue | undefined) => void;
|
|
55
38
|
/**
|
|
56
39
|
* Replace the image being edited. A different image starts a
|
|
57
|
-
* fresh session: default
|
|
58
|
-
*
|
|
59
|
-
* no-op.
|
|
40
|
+
* fresh session: default crop and crop options, a clean baseline,
|
|
41
|
+
* and no history. Reporting the same image again is a no-op.
|
|
60
42
|
*/
|
|
61
|
-
setSourceImage: (image:
|
|
43
|
+
setSourceImage: (image: ImageEditorState['image']) => void;
|
|
62
44
|
/**
|
|
63
45
|
* Whether anything in the session differs from its baseline,
|
|
64
46
|
* including editor-only state such as the aspect-ratio preset.
|
|
@@ -73,14 +55,14 @@ export interface MediaEditorSession {
|
|
|
73
55
|
hasUndo: boolean;
|
|
74
56
|
/** Whether there's a redoable change in history. */
|
|
75
57
|
hasRedo: boolean;
|
|
76
|
-
/** Undo the last committed
|
|
58
|
+
/** Undo the last committed change across all slices. */
|
|
77
59
|
undo: () => void;
|
|
78
|
-
/** Redo the last undone
|
|
60
|
+
/** Redo the last undone change across all slices. */
|
|
79
61
|
redo: () => void;
|
|
80
62
|
/**
|
|
81
|
-
* Open a gesture boundary. During a gesture all
|
|
82
|
-
*
|
|
83
|
-
*
|
|
63
|
+
* Open a gesture boundary. During a gesture all changes coalesce
|
|
64
|
+
* into one undo entry — the snapshot taken at `beginGesture`. Pair
|
|
65
|
+
* with `endGesture` on pointer-up / key-up.
|
|
84
66
|
*/
|
|
85
67
|
beginGesture: () => void;
|
|
86
68
|
/** Close a gesture boundary and commit the pre-gesture snapshot. */
|
|
@@ -89,24 +71,23 @@ export interface MediaEditorSession {
|
|
|
89
71
|
/**
|
|
90
72
|
* The media editor session.
|
|
91
73
|
*
|
|
92
|
-
* Owns the only undo/redo history for the editor.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
74
|
+
* Owns the only undo/redo history for the editor. The image editor's state,
|
|
75
|
+
* the sidebar crop options and named edits are slices of one state, so
|
|
76
|
+
* one history stack covers them all. The image editor works out its own
|
|
77
|
+
* changes and reports each next state through `onChange`.
|
|
95
78
|
*
|
|
96
79
|
* History semantics:
|
|
97
|
-
* - Each
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* - During a gesture (`beginGesture` → `endGesture`)
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* -
|
|
104
|
-
*
|
|
105
|
-
* undo entries.
|
|
80
|
+
* - Each change pushes its pre-state to the undo stack, unless a
|
|
81
|
+
* gesture is open or the change is a no-op (post-state value-equal
|
|
82
|
+
* to pre-state).
|
|
83
|
+
* - During a gesture (`beginGesture` → `endGesture`) changes coalesce:
|
|
84
|
+
* only the pre-gesture snapshot is pushed, at gesture end. Undo and
|
|
85
|
+
* redo close an open gesture first.
|
|
86
|
+
* - Changes the image editor marks as not edits (an image loading, a refit
|
|
87
|
+
* after a window resize) are never recorded.
|
|
106
88
|
*
|
|
107
|
-
* `isDirty` tracks the full
|
|
108
|
-
*
|
|
109
|
-
* needs saving.
|
|
89
|
+
* `isDirty` tracks the full session, including undoable UI state. Use
|
|
90
|
+
* `hasOutputEdits` when deciding whether the image output needs saving.
|
|
110
91
|
*
|
|
111
92
|
* The session starts empty. Call `setSourceImage` to load an image.
|
|
112
93
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-media-editor-state.d.ts","sourceRoot":"","sources":["../../src/state/use-media-editor-state.ts"],"names":[],"mappings":"AAOA,OAAO,EAGN,KAAK,
|
|
1
|
+
{"version":3,"file":"use-media-editor-state.d.ts","sourceRoot":"","sources":["../../src/state/use-media-editor-state.ts"],"names":[],"mappings":"AAOA,OAAO,EAGN,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EAGT,MAAM,SAAS,CAAC;AA8CjB;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,WAAW,EAAE,qBAAqB,CAAC;IACnC,6BAA6B;IAC7B,WAAW,EAAE,gBAAgB,CAAC;IAC9B,0EAA0E;IAC1E,mBAAmB,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACnD;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,2DAA2D;IAC3D,KAAK,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,KAAM,IAAI,CAAC;IAChE;;;;OAIG;IACH,cAAc,EAAE,CAAE,KAAK,EAAE,gBAAgB,CAAE,OAAO,CAAE,KAAM,IAAI,CAAC;IAC/D;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;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;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,IAAI,kBAAkB,CAsQxD"}
|