@wordpress/media-editor 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +2 -1
- package/build/components/media-editor/index.cjs +533 -695
- package/build/components/media-editor/index.cjs.map +1 -7
- package/build/components/media-editor/use-crop-options.cjs +43 -58
- package/build/components/media-editor/use-crop-options.cjs.map +1 -7
- package/build/components/media-editor/use-save-media-editor.cjs +111 -185
- package/build/components/media-editor/use-save-media-editor.cjs.map +1 -7
- package/build/components/media-editor-canvas/index.cjs +122 -124
- package/build/components/media-editor-canvas/index.cjs.map +1 -7
- package/build/components/media-editor-crop-panel/index.cjs +65 -68
- package/build/components/media-editor-crop-panel/index.cjs.map +1 -7
- package/build/components/media-editor-fine-rotation/index.cjs +62 -72
- package/build/components/media-editor-fine-rotation/index.cjs.map +1 -7
- package/build/components/media-editor-image-controls/index.cjs +183 -257
- package/build/components/media-editor-image-controls/index.cjs.map +1 -7
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +119 -157
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +1 -7
- package/build/components/media-editor-modal/build-modifiers.cjs +107 -88
- package/build/components/media-editor-modal/build-modifiers.cjs.map +1 -7
- package/build/components/media-editor-modal/index.cjs +112 -153
- package/build/components/media-editor-modal/index.cjs.map +1 -7
- package/build/components/media-editor-provider/index.cjs +32 -54
- package/build/components/media-editor-provider/index.cjs.map +1 -7
- package/build/components/media-form/index.cjs +77 -78
- package/build/components/media-form/index.cjs.map +1 -7
- package/build/components/media-preview/index.cjs +114 -114
- package/build/components/media-preview/index.cjs.map +1 -7
- package/build/components/rotation-ruler/index.cjs +181 -188
- package/build/components/rotation-ruler/index.cjs.map +1 -7
- package/build/components/rotation-ruler/use-ruler-drag.cjs +132 -149
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -7
- package/build/hooks/use-crop-gesture-handlers.cjs +82 -76
- package/build/hooks/use-crop-gesture-handlers.cjs.map +1 -7
- package/build/image-editor/core/camera.cjs +257 -205
- package/build/image-editor/core/camera.cjs.map +1 -7
- package/build/image-editor/core/constants.cjs +127 -102
- package/build/image-editor/core/constants.cjs.map +1 -7
- package/build/image-editor/core/containment.cjs +275 -262
- package/build/image-editor/core/containment.cjs.map +1 -7
- package/build/image-editor/core/crop-rect.cjs +33 -44
- package/build/image-editor/core/crop-rect.cjs.map +1 -7
- package/build/image-editor/core/export/canvas-renderer.cjs +165 -135
- package/build/image-editor/core/export/canvas-renderer.cjs.map +1 -7
- package/build/image-editor/core/index.cjs +88 -61
- package/build/image-editor/core/interaction-controller.cjs +583 -646
- package/build/image-editor/core/interaction-controller.cjs.map +1 -7
- package/build/image-editor/core/math/rotation.cjs +26 -35
- package/build/image-editor/core/math/rotation.cjs.map +1 -7
- package/build/image-editor/core/math/sanitize.cjs +124 -80
- package/build/image-editor/core/math/sanitize.cjs.map +1 -7
- package/build/image-editor/core/setter-helpers.cjs +57 -60
- package/build/image-editor/core/setter-helpers.cjs.map +1 -7
- package/build/image-editor/core/source-region.cjs +220 -190
- package/build/image-editor/core/source-region.cjs.map +1 -7
- package/build/image-editor/core/state.cjs +278 -265
- package/build/image-editor/core/state.cjs.map +1 -7
- package/build/image-editor/core/stencil-math.cjs +193 -206
- package/build/image-editor/core/stencil-math.cjs.map +1 -7
- package/build/image-editor/core/transform-style.cjs +39 -48
- package/build/image-editor/core/transform-style.cjs.map +1 -7
- package/build/image-editor/core/transforms/pipeline.cjs +36 -38
- package/build/image-editor/core/transforms/pipeline.cjs.map +1 -7
- package/build/image-editor/core/types.cjs +4 -18
- package/build/image-editor/core/viewport-state.cjs +31 -45
- package/build/image-editor/core/viewport-state.cjs.map +1 -7
- package/build/image-editor/index.cjs +65 -64
- package/build/image-editor/react/components/cropper-provider.cjs +44 -45
- package/build/image-editor/react/components/cropper-provider.cjs.map +1 -7
- package/build/image-editor/react/components/cropper.cjs +583 -720
- package/build/image-editor/react/components/cropper.cjs.map +1 -7
- package/build/image-editor/react/components/index.cjs +22 -33
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +135 -160
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +28 -59
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +58 -88
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +1 -7
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +361 -420
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +1 -7
- package/build/image-editor/react/components/viewport-provider.cjs +21 -46
- package/build/image-editor/react/components/viewport-provider.cjs.map +1 -7
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +76 -67
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +1 -7
- package/build/image-editor/react/hooks/index.cjs +16 -31
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +90 -146
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-cropper-controller.cjs +80 -0
- package/build/image-editor/react/hooks/use-cropper-controller.cjs.map +1 -0
- package/build/image-editor/react/hooks/use-interaction.cjs +179 -205
- package/build/image-editor/react/hooks/use-interaction.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-transform-style.cjs +20 -34
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +1 -7
- package/build/image-editor/react/hooks/use-viewport-state.cjs +36 -47
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +1 -7
- package/build/image-editor/react/visually-hidden-style.cjs +21 -38
- package/build/image-editor/react/visually-hidden-style.cjs.map +1 -7
- package/build/index.cjs +45 -39
- package/build/lock-unlock.cjs +9 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/private-apis.cjs +16 -37
- package/build/private-apis.cjs.map +1 -7
- package/build/state/aspect-ratio-presets.cjs +53 -0
- package/build/state/aspect-ratio-presets.cjs.map +1 -0
- package/build/state/composite-reducer.cjs +136 -89
- package/build/state/composite-reducer.cjs.map +1 -7
- package/build/state/index.cjs +63 -47
- package/build/state/media-editor-state-provider.cjs +35 -48
- package/build/state/media-editor-state-provider.cjs.map +1 -7
- package/build/state/types.cjs +12 -31
- package/build/state/types.cjs.map +1 -7
- package/build/state/use-media-editor-state.cjs +261 -281
- package/build/state/use-media-editor-state.cjs.map +1 -7
- package/build/store/actions.cjs +17 -44
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +8 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +33 -40
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +28 -50
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +16 -41
- package/build/store/selectors.cjs.map +1 -7
- package/build/utils/get-media-type.cjs +18 -41
- package/build/utils/get-media-type.cjs.map +1 -7
- package/build/utils/index.cjs +9 -28
- package/build-module/components/media-editor/index.mjs +490 -682
- package/build-module/components/media-editor/index.mjs.map +1 -7
- package/build-module/components/media-editor/use-crop-options.mjs +38 -33
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -7
- package/build-module/components/media-editor/use-save-media-editor.mjs +89 -157
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +1 -7
- package/build-module/components/media-editor-canvas/index.mjs +97 -95
- package/build-module/components/media-editor-canvas/index.mjs.map +1 -7
- package/build-module/components/media-editor-crop-panel/index.mjs +44 -43
- package/build-module/components/media-editor-crop-panel/index.mjs.map +1 -7
- package/build-module/components/media-editor-fine-rotation/index.mjs +39 -45
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +1 -7
- package/build-module/components/media-editor-image-controls/index.mjs +172 -237
- package/build-module/components/media-editor-image-controls/index.mjs.map +1 -7
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +112 -137
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-modal/build-modifiers.mjs +103 -64
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +1 -7
- package/build-module/components/media-editor-modal/index.mjs +88 -122
- package/build-module/components/media-editor-modal/index.mjs.map +1 -7
- package/build-module/components/media-editor-provider/index.mjs +26 -28
- package/build-module/components/media-editor-provider/index.mjs.map +1 -7
- package/build-module/components/media-form/index.mjs +69 -54
- package/build-module/components/media-form/index.mjs.map +1 -7
- package/build-module/components/media-preview/index.mjs +105 -89
- package/build-module/components/media-preview/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/index.mjs +161 -164
- package/build-module/components/rotation-ruler/index.mjs.map +1 -7
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs +125 -122
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +1 -7
- package/build-module/hooks/use-crop-gesture-handlers.mjs +76 -50
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +1 -7
- package/build-module/image-editor/core/camera.mjs +245 -178
- package/build-module/image-editor/core/camera.mjs.map +1 -7
- package/build-module/image-editor/core/constants.mjs +110 -64
- package/build-module/image-editor/core/constants.mjs.map +1 -7
- package/build-module/image-editor/core/containment.mjs +265 -237
- package/build-module/image-editor/core/containment.mjs.map +1 -7
- package/build-module/image-editor/core/crop-rect.mjs +29 -20
- package/build-module/image-editor/core/crop-rect.mjs.map +1 -7
- package/build-module/image-editor/core/export/canvas-renderer.mjs +155 -105
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +1 -7
- package/build-module/image-editor/core/index.mjs +5 -34
- package/build-module/image-editor/core/interaction-controller.mjs +579 -628
- package/build-module/image-editor/core/interaction-controller.mjs.map +1 -7
- package/build-module/image-editor/core/math/rotation.mjs +21 -10
- package/build-module/image-editor/core/math/rotation.mjs.map +1 -7
- package/build-module/image-editor/core/math/sanitize.mjs +116 -52
- package/build-module/image-editor/core/math/sanitize.mjs.map +1 -7
- package/build-module/image-editor/core/setter-helpers.mjs +52 -35
- package/build-module/image-editor/core/setter-helpers.mjs.map +1 -7
- package/build-module/image-editor/core/source-region.mjs +210 -160
- package/build-module/image-editor/core/source-region.mjs.map +1 -7
- package/build-module/image-editor/core/state.mjs +271 -243
- package/build-module/image-editor/core/state.mjs.map +1 -7
- package/build-module/image-editor/core/stencil-math.mjs +185 -178
- package/build-module/image-editor/core/stencil-math.mjs.map +1 -7
- package/build-module/image-editor/core/transform-style.mjs +34 -23
- package/build-module/image-editor/core/transform-style.mjs.map +1 -7
- package/build-module/image-editor/core/transforms/pipeline.mjs +29 -11
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +1 -7
- package/build-module/image-editor/core/types.mjs +0 -1
- package/build-module/image-editor/core/viewport-state.mjs +26 -20
- package/build-module/image-editor/core/viewport-state.mjs.map +1 -7
- package/build-module/image-editor/index.mjs +3 -38
- package/build-module/image-editor/react/components/cropper-provider.mjs +38 -21
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +1 -7
- package/build-module/image-editor/react/components/cropper.mjs +550 -696
- package/build-module/image-editor/react/components/cropper.mjs.map +1 -7
- package/build-module/image-editor/react/components/index.mjs +1 -7
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +130 -135
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +24 -35
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +54 -64
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +1 -7
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +355 -407
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +1 -7
- package/build-module/image-editor/react/components/viewport-provider.mjs +15 -22
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +72 -43
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/index.mjs +2 -7
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +83 -119
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs +75 -0
- package/build-module/image-editor/react/hooks/use-cropper-controller.mjs.map +1 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs +175 -183
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +15 -9
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +1 -7
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +32 -26
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +1 -7
- package/build-module/image-editor/react/visually-hidden-style.mjs +17 -14
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +1 -7
- package/build-module/index.mjs +3 -10
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/private-apis.mjs +8 -9
- package/build-module/private-apis.mjs.map +1 -7
- package/build-module/state/aspect-ratio-presets.mjs +48 -0
- package/build-module/state/aspect-ratio-presets.mjs.map +1 -0
- package/build-module/state/composite-reducer.mjs +114 -75
- package/build-module/state/composite-reducer.mjs.map +1 -7
- package/build-module/state/index.mjs +5 -25
- package/build-module/state/media-editor-state-provider.mjs +29 -24
- package/build-module/state/media-editor-state-provider.mjs.map +1 -7
- package/build-module/state/types.mjs +8 -7
- package/build-module/state/types.mjs.map +1 -7
- package/build-module/state/use-media-editor-state.mjs +256 -273
- package/build-module/state/use-media-editor-state.mjs.map +1 -7
- package/build-module/store/actions.mjs +12 -19
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +4 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +8 -9
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +23 -26
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +8 -13
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/utils/get-media-type.mjs +14 -17
- package/build-module/utils/get-media-type.mjs.map +1 -7
- package/build-module/utils/index.mjs +1 -6
- package/build-style/style-rtl.css +41 -4
- package/build-style/style.css +41 -4
- package/build-types/components/media-editor/index.d.ts +6 -1
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +0 -1
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +6 -5
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts +7 -2
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-provider/index.d.ts +7 -1
- package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts +5 -2
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
- package/build-types/image-editor/core/constants.d.ts +0 -1
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/index.d.ts +1 -1
- package/build-types/image-editor/core/index.d.ts.map +1 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +1 -1
- package/build-types/image-editor/core/types.d.ts +1 -1
- package/build-types/image-editor/index.d.ts +7 -6
- package/build-types/image-editor/index.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +2 -2
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +5 -14
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +2 -2
- package/build-types/image-editor/react/hooks/index.d.ts +2 -2
- package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/{use-cropper-reducer.d.ts → use-cropper-controller.d.ts} +12 -12
- package/build-types/image-editor/react/hooks/use-cropper-controller.d.ts.map +1 -0
- package/build-types/state/aspect-ratio-presets.d.ts +7 -0
- package/build-types/state/aspect-ratio-presets.d.ts.map +1 -0
- package/build-types/state/composite-reducer.d.ts +2 -2
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/index.d.ts +2 -1
- package/build-types/state/index.d.ts.map +1 -1
- package/build-types/state/types.d.ts +36 -6
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +16 -5
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/package.json +35 -24
- package/src/components/media-editor/index.tsx +226 -183
- package/src/components/media-editor/style.scss +19 -0
- package/src/components/media-editor/use-crop-options.ts +5 -4
- package/src/components/media-editor/use-save-media-editor.ts +2 -6
- package/src/components/media-editor-canvas/index.tsx +18 -28
- package/src/components/media-editor-crop-panel/index.tsx +17 -9
- package/src/components/media-editor-image-controls/index.tsx +4 -2
- package/src/components/media-editor-image-controls/style.scss +1 -1
- package/src/components/media-editor-modal/build-modifiers.ts +13 -7
- package/src/components/media-editor-modal/index.tsx +8 -1
- package/src/components/media-editor-modal/style.scss +1 -1
- package/src/components/media-editor-provider/index.tsx +8 -1
- package/src/components/media-form/index.tsx +48 -42
- package/src/components/media-preview/index.tsx +68 -25
- package/src/components/media-preview/style.scss +16 -2
- package/src/components/rotation-ruler/style.scss +6 -2
- package/src/components/rotation-ruler/use-ruler-drag.ts +6 -11
- package/src/image-editor/README.md +8 -8
- package/src/image-editor/core/constants.ts +0 -13
- package/src/image-editor/core/index.ts +1 -5
- package/src/image-editor/core/setter-helpers.ts +1 -1
- package/src/image-editor/core/types.ts +1 -1
- package/src/image-editor/docs/architecture.md +5 -1
- package/src/image-editor/docs/recipes.md +3 -3
- package/src/image-editor/index.ts +7 -16
- package/src/image-editor/react/components/cropper-provider.tsx +5 -5
- package/src/image-editor/react/components/cropper.tsx +20 -42
- package/src/image-editor/react/hooks/build-cropper-setters.ts +2 -2
- package/src/image-editor/react/hooks/index.ts +2 -2
- package/src/image-editor/react/hooks/{use-cropper-reducer.ts → use-cropper-controller.ts} +11 -11
- package/src/state/aspect-ratio-presets.ts +18 -0
- package/src/state/composite-reducer.ts +26 -13
- package/src/state/index.ts +3 -0
- package/src/state/types.ts +39 -11
- package/src/state/use-media-editor-state.ts +53 -16
- package/build/image-editor/core/index.cjs.map +0 -7
- package/build/image-editor/core/types.cjs.map +0 -7
- package/build/image-editor/index.cjs.map +0 -7
- package/build/image-editor/react/components/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +0 -113
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +0 -7
- package/build/index.cjs.map +0 -7
- package/build/state/index.cjs.map +0 -7
- package/build/utils/index.cjs.map +0 -7
- package/build-module/image-editor/core/index.mjs.map +0 -7
- package/build-module/image-editor/core/types.mjs.map +0 -7
- package/build-module/image-editor/index.mjs.map +0 -7
- package/build-module/image-editor/react/components/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +0 -100
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/state/index.mjs.map +0 -7
- package/build-module/utils/index.mjs.map +0 -7
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +0 -1
- package/global.d.ts +0 -5
- package/src/components/media-editor/test/restore-original.browser.test.tsx +0 -227
- package/src/components/media-editor/test/use-crop-options.jsdom.test.tsx +0 -106
- package/src/components/media-editor-crop-panel/test/index.jsdom.test.tsx +0 -72
- package/src/components/media-editor-image-controls/test/index.jsdom.test.tsx +0 -186
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +0 -359
- package/src/components/media-editor-modal/test/index.jsdom.test.tsx +0 -182
- package/src/components/rotation-ruler/stories/index.story.tsx +0 -43
- package/src/components/rotation-ruler/test/index.jsdom.test.tsx +0 -140
- package/src/image-editor/core/export/test/canvas-renderer.jsdom.test.ts +0 -823
- package/src/image-editor/core/math/test/sanitize.ts +0 -242
- package/src/image-editor/core/test/camera.ts +0 -1218
- package/src/image-editor/core/test/interaction-controller.ts +0 -1299
- package/src/image-editor/core/test/preview-export-parity.ts +0 -249
- package/src/image-editor/core/test/render-camera-bridge.ts +0 -349
- package/src/image-editor/core/test/state.ts +0 -876
- package/src/image-editor/core/test/stencil-math.ts +0 -665
- package/src/image-editor/core/transforms/test/pipeline.ts +0 -267
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.browser.test.tsx +0 -438
- package/src/image-editor/react/components/test/cropper.browser.test.tsx +0 -1462
- package/src/image-editor/react/hooks/test/use-aria-announcer.jsdom.test.ts +0 -491
- package/src/image-editor/react/hooks/test/use-cropper-reducer.jsdom.test.ts +0 -1049
- package/src/image-editor/react/hooks/test/use-interaction.jsdom.test.ts +0 -213
- package/src/image-editor/react/hooks/test/use-transform-style.jsdom.test.ts +0 -140
- package/src/image-editor/stories/rectangle-crop.story.tsx +0 -1073
- package/src/image-editor/stories/style.module.css +0 -65
- package/src/state/test/use-media-editor-state.browser.test.tsx +0 -79
- package/src/state/test/use-media-editor-state.jsdom.test.ts +0 -386
- package/src/store/test/reducer.ts +0 -64
- package/tsconfig.build.json +0 -26
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -37
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
// packages/media-editor/src/store/actions.ts
|
|
2
|
-
function openMediaEditorModal({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
id,
|
|
11
|
-
onUpdate: onUpdate ?? null,
|
|
12
|
-
onUndo: onUndo ?? null,
|
|
13
|
-
onClose: onClose ?? null
|
|
14
|
-
};
|
|
2
|
+
function openMediaEditorModal({ id, onUpdate, onUndo, onClose }) {
|
|
3
|
+
return {
|
|
4
|
+
type: "OPEN_MEDIA_EDITOR_MODAL",
|
|
5
|
+
id,
|
|
6
|
+
onUpdate: onUpdate ?? null,
|
|
7
|
+
onUndo: onUndo ?? null,
|
|
8
|
+
onClose: onClose ?? null
|
|
9
|
+
};
|
|
15
10
|
}
|
|
16
11
|
function closeMediaEditorModal() {
|
|
17
|
-
|
|
12
|
+
return { type: "CLOSE_MEDIA_EDITOR_MODAL" };
|
|
18
13
|
}
|
|
19
|
-
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=actions.mjs.map
|
|
14
|
+
export { closeMediaEditorModal, openMediaEditorModal };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=actions.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/actions.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shape passed to `onUpdate` after a successful save. Deliberately normalized\n * and minimal: `url` instead of REST's `source_url`, so consumers can drop\n * it straight into block attributes (matches the legacy `ImageEditor`'s\n * `onSaveImage` shape at\n * `packages/block-editor/src/components/image-editor/use-save-image.js`).\n * Keeping this decoupled from the REST field names also leaves room to reuse\n * the modal outside a WordPress REST context (e.g. native/Electron hosts).\n */\nexport interface MediaEditorModalUpdate {\n\tid: number;\n\turl?: string;\n}\n\ninterface OpenMediaEditorModalArgs {\n\tid: number;\n\tonUpdate?: ( updated: MediaEditorModalUpdate ) => void;\n\t/**\n\t * Restore the caller's state after a saved attachment change. May run\n\t * before an asynchronous `onUpdate` finishes; the caller should cancel\n\t * that update. Without this callback, Undo calls `onUpdate` with the\n\t * previous attachment's id and URL.\n\t */\n\tonUndo?: () => void;\n\tonClose?: () => void;\n}\n\nexport function openMediaEditorModal( {\n\tid,\n\tonUpdate,\n\tonUndo,\n\tonClose,\n}: OpenMediaEditorModalArgs ) {\n\treturn {\n\t\ttype: 'OPEN_MEDIA_EDITOR_MODAL' as const,\n\t\tid,\n\t\tonUpdate: onUpdate ?? null,\n\t\tonUndo: onUndo ?? null,\n\t\tonClose: onClose ?? null,\n\t};\n}\n\nexport function closeMediaEditorModal() {\n\treturn { type: 'CLOSE_MEDIA_EDITOR_MODAL' as const };\n}\n"],
|
|
5
|
-
"mappings": ";AA2BO,SAAS,qBAAsB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAA8B;AAC7B,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA,UAAU,YAAY;AAAA,IACtB,QAAQ,UAAU;AAAA,IAClB,SAAS,WAAW;AAAA,EACrB;AACD;AAEO,SAAS,wBAAwB;AACvC,SAAO,EAAE,MAAM,2BAAoC;AACpD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"actions.mjs","names":[],"sources":["../../src/store/actions.ts"],"sourcesContent":["/**\n * Shape passed to `onUpdate` after a successful save. Deliberately normalized\n * and minimal: `url` instead of REST's `source_url`, so consumers can drop\n * it straight into block attributes (matches the legacy `ImageEditor`'s\n * `onSaveImage` shape at\n * `packages/block-editor/src/components/image-editor/use-save-image.js`).\n * Keeping this decoupled from the REST field names also leaves room to reuse\n * the modal outside a WordPress REST context (e.g. native/Electron hosts).\n */\nexport interface MediaEditorModalUpdate {\n\tid: number;\n\turl?: string;\n}\n\ninterface OpenMediaEditorModalArgs {\n\tid: number;\n\tonUpdate?: ( updated: MediaEditorModalUpdate ) => void;\n\t/**\n\t * Restore the caller's state after a saved attachment change. May run\n\t * before an asynchronous `onUpdate` finishes; the caller should cancel\n\t * that update. Without this callback, Undo calls `onUpdate` with the\n\t * previous attachment's id and URL.\n\t */\n\tonUndo?: () => void;\n\tonClose?: () => void;\n}\n\nexport function openMediaEditorModal( {\n\tid,\n\tonUpdate,\n\tonUndo,\n\tonClose,\n}: OpenMediaEditorModalArgs ) {\n\treturn {\n\t\ttype: 'OPEN_MEDIA_EDITOR_MODAL' as const,\n\t\tid,\n\t\tonUpdate: onUpdate ?? null,\n\t\tonUndo: onUndo ?? null,\n\t\tonClose: onClose ?? null,\n\t};\n}\n\nexport function closeMediaEditorModal() {\n\treturn { type: 'CLOSE_MEDIA_EDITOR_MODAL' as const };\n}\n"],"mappings":";AA2BA,SAAgB,qBAAsB,EACrC,IACA,UACA,QACA,WAC6B;CAC7B,OAAO;EACN,MAAM;EACN;EACA,UAAU,YAAY;EACtB,QAAQ,UAAU;EAClB,SAAS,WAAW;CACrB;AACD;AAEA,SAAgB,wBAAwB;CACvC,OAAO,EAAE,MAAM,2BAAoC;AACpD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// packages/media-editor/src/store/constants.ts
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=constants.mjs.map
|
|
2
|
+
const STORE_NAME = "core/media-editor";
|
|
3
|
+
export { STORE_NAME };
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/constants.ts"],
|
|
4
|
-
"sourcesContent": ["export const STORE_NAME = 'core/media-editor';\n"],
|
|
5
|
-
"mappings": ";AAAO,IAAM,aAAa;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/store/constants.ts"],"sourcesContent":["export const STORE_NAME = 'core/media-editor';\n"],"mappings":";AAAA,MAAa,aAAa"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
// packages/media-editor/src/store/index.ts
|
|
2
1
|
import { createReduxStore, register } from "@wordpress/data";
|
|
3
2
|
import reducer from "./reducer.mjs";
|
|
4
3
|
import * as actions from "./actions.mjs";
|
|
5
4
|
import * as selectors from "./selectors.mjs";
|
|
6
5
|
import { STORE_NAME } from "./constants.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
// packages/media-editor/src/store/index.ts
|
|
7
|
+
const store = createReduxStore(STORE_NAME, {
|
|
8
|
+
reducer,
|
|
9
|
+
actions,
|
|
10
|
+
selectors
|
|
11
11
|
});
|
|
12
12
|
register(store);
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=index.mjs.map
|
|
13
|
+
export { store };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { createReduxStore, register } from '@wordpress/data';\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,kBAAkB,gBAAgB;AAC3C,OAAO,aAAa;AACpB,YAAY,aAAa;AACzB,YAAY,eAAe;AAC3B,SAAS,kBAAkB;AAEpB,IAAM,QAAQ,iBAAkB,YAAY;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAEF,SAAU,KAAM;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/store/index.ts"],"sourcesContent":["import { createReduxStore, register } from '@wordpress/data';\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],"mappings":";;;;;;AAMA,MAAa,QAAQ,iBAAkB,YAAY;CAClD;CACA;CACA;AACD,CAAE;AAEF,SAAU,KAAM"}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
// packages/media-editor/src/store/reducer.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const DEFAULT_STATE = {
|
|
3
|
+
isOpen: false,
|
|
4
|
+
id: null,
|
|
5
|
+
onUpdate: null,
|
|
6
|
+
onUndo: null,
|
|
7
|
+
onClose: null
|
|
8
8
|
};
|
|
9
9
|
function reducer(state = DEFAULT_STATE, action) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return state;
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case "OPEN_MEDIA_EDITOR_MODAL": {
|
|
12
|
+
const { id, onUpdate, onUndo, onClose } = action;
|
|
13
|
+
return {
|
|
14
|
+
isOpen: true,
|
|
15
|
+
id,
|
|
16
|
+
onUpdate,
|
|
17
|
+
onUndo,
|
|
18
|
+
onClose
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
case "CLOSE_MEDIA_EDITOR_MODAL": return DEFAULT_STATE;
|
|
22
|
+
}
|
|
23
|
+
return state;
|
|
25
24
|
}
|
|
26
|
-
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=reducer.mjs.map
|
|
25
|
+
export { DEFAULT_STATE, reducer as default };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=reducer.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/reducer.ts"],
|
|
4
|
-
"sourcesContent": ["import type { MediaEditorModalUpdate } from './actions';\n\ntype OnUpdateCallback = ( updated: MediaEditorModalUpdate ) => void;\ntype OnUndoCallback = () => void;\ntype OnCloseCallback = () => void;\n\nexport interface State {\n\tisOpen: boolean;\n\tid: number | null;\n\tonUpdate: OnUpdateCallback | null;\n\tonUndo: OnUndoCallback | null;\n\tonClose: OnCloseCallback | null;\n}\n\nexport const DEFAULT_STATE: State = {\n\tisOpen: false,\n\tid: null,\n\tonUpdate: null,\n\tonUndo: null,\n\tonClose: null,\n};\n\ntype Action =\n\t| {\n\t\t\ttype: 'OPEN_MEDIA_EDITOR_MODAL';\n\t\t\tid: number;\n\t\t\tonUpdate: OnUpdateCallback | null;\n\t\t\tonUndo: OnUndoCallback | null;\n\t\t\tonClose: OnCloseCallback | null;\n\t }\n\t| { type: 'CLOSE_MEDIA_EDITOR_MODAL' };\n\nexport default function reducer(\n\tstate: State = DEFAULT_STATE,\n\taction: Action | { type: string }\n): State {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MEDIA_EDITOR_MODAL': {\n\t\t\tconst { id, onUpdate, onUndo, onClose } = action as Extract<\n\t\t\t\tAction,\n\t\t\t\t{ type: 'OPEN_MEDIA_EDITOR_MODAL' }\n\t\t\t>;\n\t\t\treturn {\n\t\t\t\tisOpen: true,\n\t\t\t\tid,\n\t\t\t\tonUpdate,\n\t\t\t\tonUndo,\n\t\t\t\tonClose,\n\t\t\t};\n\t\t}\n\t\tcase 'CLOSE_MEDIA_EDITOR_MODAL':\n\t\t\treturn DEFAULT_STATE;\n\t}\n\treturn state;\n}\n"],
|
|
5
|
-
"mappings": ";AAcO,IAAM,gBAAuB;AAAA,EACnC,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AACV;AAYe,SAAR,QACN,QAAe,eACf,QACQ;AACR,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK,2BAA2B;AAC/B,YAAM,EAAE,IAAI,UAAU,QAAQ,QAAQ,IAAI;AAI1C,aAAO;AAAA,QACN,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,KAAK;AACJ,aAAO;AAAA,EACT;AACA,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"reducer.mjs","names":[],"sources":["../../src/store/reducer.ts"],"sourcesContent":["import type { MediaEditorModalUpdate } from './actions';\n\ntype OnUpdateCallback = ( updated: MediaEditorModalUpdate ) => void;\ntype OnUndoCallback = () => void;\ntype OnCloseCallback = () => void;\n\nexport interface State {\n\tisOpen: boolean;\n\tid: number | null;\n\tonUpdate: OnUpdateCallback | null;\n\tonUndo: OnUndoCallback | null;\n\tonClose: OnCloseCallback | null;\n}\n\nexport const DEFAULT_STATE: State = {\n\tisOpen: false,\n\tid: null,\n\tonUpdate: null,\n\tonUndo: null,\n\tonClose: null,\n};\n\ntype Action =\n\t| {\n\t\t\ttype: 'OPEN_MEDIA_EDITOR_MODAL';\n\t\t\tid: number;\n\t\t\tonUpdate: OnUpdateCallback | null;\n\t\t\tonUndo: OnUndoCallback | null;\n\t\t\tonClose: OnCloseCallback | null;\n\t }\n\t| { type: 'CLOSE_MEDIA_EDITOR_MODAL' };\n\nexport default function reducer(\n\tstate: State = DEFAULT_STATE,\n\taction: Action | { type: string }\n): State {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MEDIA_EDITOR_MODAL': {\n\t\t\tconst { id, onUpdate, onUndo, onClose } = action as Extract<\n\t\t\t\tAction,\n\t\t\t\t{ type: 'OPEN_MEDIA_EDITOR_MODAL' }\n\t\t\t>;\n\t\t\treturn {\n\t\t\t\tisOpen: true,\n\t\t\t\tid,\n\t\t\t\tonUpdate,\n\t\t\t\tonUndo,\n\t\t\t\tonClose,\n\t\t\t};\n\t\t}\n\t\tcase 'CLOSE_MEDIA_EDITOR_MODAL':\n\t\t\treturn DEFAULT_STATE;\n\t}\n\treturn state;\n}\n"],"mappings":";AAcA,MAAa,gBAAuB;CACnC,QAAQ;CACR,IAAI;CACJ,UAAU;CACV,QAAQ;CACR,SAAS;AACV;AAYA,SAAwB,QACvB,QAAe,eACf,QACQ;CACR,QAAS,OAAO,MAAhB;EACC,KAAK,2BAA2B;GAC/B,MAAM,EAAE,IAAI,UAAU,QAAQ,YAAY;GAI1C,OAAO;IACN,QAAQ;IACR;IACA;IACA;IACA;GACD;EACD;EACA,KAAK,4BACJ,OAAO;CACT;CACA,OAAO;AACR"}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
// packages/media-editor/src/store/selectors.ts
|
|
2
2
|
function isOpen(state) {
|
|
3
|
-
|
|
3
|
+
return state.isOpen;
|
|
4
4
|
}
|
|
5
5
|
function getId(state) {
|
|
6
|
-
|
|
6
|
+
return state.id;
|
|
7
7
|
}
|
|
8
8
|
function getOnUpdate(state) {
|
|
9
|
-
|
|
9
|
+
return state.onUpdate;
|
|
10
10
|
}
|
|
11
11
|
function getOnUndo(state) {
|
|
12
|
-
|
|
12
|
+
return state.onUndo;
|
|
13
13
|
}
|
|
14
14
|
function getOnClose(state) {
|
|
15
|
-
|
|
15
|
+
return state.onClose;
|
|
16
16
|
}
|
|
17
|
-
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getOnUndo,
|
|
21
|
-
getOnUpdate,
|
|
22
|
-
isOpen
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=selectors.mjs.map
|
|
17
|
+
export { getId, getOnClose, getOnUndo, getOnUpdate, isOpen };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=selectors.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/selectors.ts"],
|
|
4
|
-
"sourcesContent": ["import type { State } from './reducer';\n\nexport function isOpen( state: State ): boolean {\n\treturn state.isOpen;\n}\n\nexport function getId( state: State ): number | null {\n\treturn state.id;\n}\n\nexport function getOnUpdate( state: State ) {\n\treturn state.onUpdate;\n}\n\nexport function getOnUndo( state: State ) {\n\treturn state.onUndo;\n}\n\nexport function getOnClose( state: State ) {\n\treturn state.onClose;\n}\n"],
|
|
5
|
-
"mappings": ";AAEO,SAAS,OAAQ,OAAwB;AAC/C,SAAO,MAAM;AACd;AAEO,SAAS,MAAO,OAA8B;AACpD,SAAO,MAAM;AACd;AAEO,SAAS,YAAa,OAAe;AAC3C,SAAO,MAAM;AACd;AAEO,SAAS,UAAW,OAAe;AACzC,SAAO,MAAM;AACd;AAEO,SAAS,WAAY,OAAe;AAC1C,SAAO,MAAM;AACd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"selectors.mjs","names":[],"sources":["../../src/store/selectors.ts"],"sourcesContent":["import type { State } from './reducer';\n\nexport function isOpen( state: State ): boolean {\n\treturn state.isOpen;\n}\n\nexport function getId( state: State ): number | null {\n\treturn state.id;\n}\n\nexport function getOnUpdate( state: State ) {\n\treturn state.onUpdate;\n}\n\nexport function getOnUndo( state: State ) {\n\treturn state.onUndo;\n}\n\nexport function getOnClose( state: State ) {\n\treturn state.onClose;\n}\n"],"mappings":";AAEA,SAAgB,OAAQ,OAAwB;CAC/C,OAAO,MAAM;AACd;AAEA,SAAgB,MAAO,OAA8B;CACpD,OAAO,MAAM;AACd;AAEA,SAAgB,YAAa,OAAe;CAC3C,OAAO,MAAM;AACd;AAEA,SAAgB,UAAW,OAAe;CACzC,OAAO,MAAM;AACd;AAEA,SAAgB,WAAY,OAAe;CAC1C,OAAO,MAAM;AACd"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
// packages/media-editor/src/utils/get-media-type.ts
|
|
2
|
+
/**
|
|
3
|
+
* Determines the media type from a MIME type string.
|
|
4
|
+
*
|
|
5
|
+
* @param mimeType - The MIME type to check.
|
|
6
|
+
* @return Object with type property ('image', 'video', 'audio', or 'application').
|
|
7
|
+
*/
|
|
2
8
|
function getMediaTypeFromMimeType(mimeType) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
if (mimeType.startsWith("video/")) {
|
|
10
|
-
return { type: "video" };
|
|
11
|
-
}
|
|
12
|
-
if (mimeType.startsWith("audio/")) {
|
|
13
|
-
return { type: "audio" };
|
|
14
|
-
}
|
|
15
|
-
return { type: "application" };
|
|
9
|
+
if (!mimeType) return { type: "application" };
|
|
10
|
+
if (mimeType.startsWith("image/")) return { type: "image" };
|
|
11
|
+
if (mimeType.startsWith("video/")) return { type: "video" };
|
|
12
|
+
if (mimeType.startsWith("audio/")) return { type: "audio" };
|
|
13
|
+
return { type: "application" };
|
|
16
14
|
}
|
|
17
|
-
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=get-media-type.mjs.map
|
|
15
|
+
export { getMediaTypeFromMimeType };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=get-media-type.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/get-media-type.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Media type result.\n */\nexport interface MediaType {\n\ttype: 'image' | 'video' | 'audio' | 'application';\n}\n\n/**\n * Determines the media type from a MIME type string.\n *\n * @param mimeType - The MIME type to check.\n * @return Object with type property ('image', 'video', 'audio', or 'application').\n */\nexport function getMediaTypeFromMimeType( mimeType?: string ): MediaType {\n\tif ( ! mimeType ) {\n\t\treturn { type: 'application' };\n\t}\n\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn { type: 'image' };\n\t}\n\tif ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn { type: 'video' };\n\t}\n\tif ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn { type: 'audio' };\n\t}\n\treturn { type: 'application' };\n}\n"],
|
|
5
|
-
"mappings": ";AAaO,SAAS,yBAA0B,UAA+B;AACxE,MAAK,CAAE,UAAW;AACjB,WAAO,EAAE,MAAM,cAAc;AAAA,EAC9B;AAEA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO,EAAE,MAAM,QAAQ;AAAA,EACxB;AACA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO,EAAE,MAAM,QAAQ;AAAA,EACxB;AACA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO,EAAE,MAAM,QAAQ;AAAA,EACxB;AACA,SAAO,EAAE,MAAM,cAAc;AAC9B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"get-media-type.mjs","names":[],"sources":["../../src/utils/get-media-type.ts"],"sourcesContent":["/**\n * Media type result.\n */\nexport interface MediaType {\n\ttype: 'image' | 'video' | 'audio' | 'application';\n}\n\n/**\n * Determines the media type from a MIME type string.\n *\n * @param mimeType - The MIME type to check.\n * @return Object with type property ('image', 'video', 'audio', or 'application').\n */\nexport function getMediaTypeFromMimeType( mimeType?: string ): MediaType {\n\tif ( ! mimeType ) {\n\t\treturn { type: 'application' };\n\t}\n\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn { type: 'image' };\n\t}\n\tif ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn { type: 'video' };\n\t}\n\tif ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn { type: 'audio' };\n\t}\n\treturn { type: 'application' };\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,yBAA0B,UAA+B;CACxE,IAAK,CAAE,UACN,OAAO,EAAE,MAAM,cAAc;CAG9B,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO,EAAE,MAAM,QAAQ;CAExB,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO,EAAE,MAAM,QAAQ;CAExB,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO,EAAE,MAAM,QAAQ;CAExB,OAAO,EAAE,MAAM,cAAc;AAC9B"}
|
|
@@ -94,10 +94,23 @@
|
|
|
94
94
|
.media-editor-preview--audio audio {
|
|
95
95
|
max-width: 100%;
|
|
96
96
|
}
|
|
97
|
-
.media-editor-preview--
|
|
98
|
-
|
|
97
|
+
.media-editor-preview--pdf {
|
|
98
|
+
align-items: stretch;
|
|
99
|
+
width: 100%;
|
|
100
|
+
max-width: 1100px;
|
|
101
|
+
margin-inline: auto;
|
|
102
|
+
}
|
|
103
|
+
.media-editor-preview__pdf {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex: 1;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
border: 0;
|
|
110
|
+
border-radius: 2px;
|
|
99
111
|
}
|
|
100
112
|
.media-editor-preview__file-info {
|
|
113
|
+
text-align: center;
|
|
101
114
|
background: #f0f0f0;
|
|
102
115
|
padding: 24px;
|
|
103
116
|
border-radius: 2px;
|
|
@@ -392,6 +405,13 @@
|
|
|
392
405
|
@media (min-width: 600px) {
|
|
393
406
|
.media-editor .media-editor__content {
|
|
394
407
|
margin: 0 24px;
|
|
408
|
+
transition: margin-left 0.3s cubic-bezier(0.6, 0, 0.4, 1);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
@media (min-width: 600px) and (prefers-reduced-motion: reduce) {
|
|
412
|
+
.media-editor .media-editor__content {
|
|
413
|
+
transition-duration: 0s;
|
|
414
|
+
transition-delay: 0s;
|
|
395
415
|
}
|
|
396
416
|
}
|
|
397
417
|
@container media-editor-body (min-width: 864px) {
|
|
@@ -437,6 +457,18 @@
|
|
|
437
457
|
max-height: 100%;
|
|
438
458
|
object-fit: contain;
|
|
439
459
|
}
|
|
460
|
+
.media-editor .media-editor__sidebar-container {
|
|
461
|
+
display: flex;
|
|
462
|
+
flex: 1;
|
|
463
|
+
min-width: 0;
|
|
464
|
+
min-height: 0;
|
|
465
|
+
overflow: hidden;
|
|
466
|
+
}
|
|
467
|
+
@media (min-width: 600px) {
|
|
468
|
+
.media-editor .media-editor__sidebar-container {
|
|
469
|
+
flex: none;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
440
472
|
.media-editor .media-editor__sidebar {
|
|
441
473
|
display: flex;
|
|
442
474
|
flex: 1;
|
|
@@ -699,8 +731,8 @@
|
|
|
699
731
|
cursor: default;
|
|
700
732
|
}
|
|
701
733
|
.rotation-ruler:has(.rotation-ruler__input:focus-visible) {
|
|
702
|
-
outline: 2px solid var(--wp-admin-theme-color, #3858e9);
|
|
703
|
-
outline-offset: 2px;
|
|
734
|
+
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--focus-color, var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9)));
|
|
735
|
+
outline-offset: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px));
|
|
704
736
|
border-radius: 4px;
|
|
705
737
|
}
|
|
706
738
|
|
|
@@ -727,6 +759,11 @@
|
|
|
727
759
|
transform: translateX(50%);
|
|
728
760
|
pointer-events: none;
|
|
729
761
|
}
|
|
762
|
+
@media (forced-colors: active) {
|
|
763
|
+
.rotation-ruler__pointer {
|
|
764
|
+
background: CanvasText;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
730
767
|
|
|
731
768
|
.rotation-ruler__strip {
|
|
732
769
|
position: absolute;
|
package/build-style/style.css
CHANGED
|
@@ -94,10 +94,23 @@
|
|
|
94
94
|
.media-editor-preview--audio audio {
|
|
95
95
|
max-width: 100%;
|
|
96
96
|
}
|
|
97
|
-
.media-editor-preview--
|
|
98
|
-
|
|
97
|
+
.media-editor-preview--pdf {
|
|
98
|
+
align-items: stretch;
|
|
99
|
+
width: 100%;
|
|
100
|
+
max-width: 1100px;
|
|
101
|
+
margin-inline: auto;
|
|
102
|
+
}
|
|
103
|
+
.media-editor-preview__pdf {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex: 1;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
border: 0;
|
|
110
|
+
border-radius: 2px;
|
|
99
111
|
}
|
|
100
112
|
.media-editor-preview__file-info {
|
|
113
|
+
text-align: center;
|
|
101
114
|
background: #f0f0f0;
|
|
102
115
|
padding: 24px;
|
|
103
116
|
border-radius: 2px;
|
|
@@ -396,6 +409,13 @@
|
|
|
396
409
|
@media (min-width: 600px) {
|
|
397
410
|
.media-editor .media-editor__content {
|
|
398
411
|
margin: 0 24px;
|
|
412
|
+
transition: margin-right 0.3s cubic-bezier(0.6, 0, 0.4, 1);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
@media (min-width: 600px) and (prefers-reduced-motion: reduce) {
|
|
416
|
+
.media-editor .media-editor__content {
|
|
417
|
+
transition-duration: 0s;
|
|
418
|
+
transition-delay: 0s;
|
|
399
419
|
}
|
|
400
420
|
}
|
|
401
421
|
@container media-editor-body (min-width: 864px) {
|
|
@@ -441,6 +461,18 @@
|
|
|
441
461
|
max-height: 100%;
|
|
442
462
|
object-fit: contain;
|
|
443
463
|
}
|
|
464
|
+
.media-editor .media-editor__sidebar-container {
|
|
465
|
+
display: flex;
|
|
466
|
+
flex: 1;
|
|
467
|
+
min-width: 0;
|
|
468
|
+
min-height: 0;
|
|
469
|
+
overflow: hidden;
|
|
470
|
+
}
|
|
471
|
+
@media (min-width: 600px) {
|
|
472
|
+
.media-editor .media-editor__sidebar-container {
|
|
473
|
+
flex: none;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
444
476
|
.media-editor .media-editor__sidebar {
|
|
445
477
|
display: flex;
|
|
446
478
|
flex: 1;
|
|
@@ -704,8 +736,8 @@
|
|
|
704
736
|
cursor: default;
|
|
705
737
|
}
|
|
706
738
|
.rotation-ruler:has(.rotation-ruler__input:focus-visible) {
|
|
707
|
-
outline: 2px solid var(--wp-admin-theme-color, #3858e9);
|
|
708
|
-
outline-offset: 2px;
|
|
739
|
+
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--focus-color, var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9)));
|
|
740
|
+
outline-offset: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px));
|
|
709
741
|
border-radius: 4px;
|
|
710
742
|
}
|
|
711
743
|
|
|
@@ -732,6 +764,11 @@
|
|
|
732
764
|
transform: translateX(-50%);
|
|
733
765
|
pointer-events: none;
|
|
734
766
|
}
|
|
767
|
+
@media (forced-colors: active) {
|
|
768
|
+
.rotation-ruler__pointer {
|
|
769
|
+
background: CanvasText;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
735
772
|
|
|
736
773
|
.rotation-ruler__strip {
|
|
737
774
|
position: absolute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Field } from '@wordpress/dataviews';
|
|
1
|
+
import type { Field, Form } from '@wordpress/dataviews';
|
|
2
2
|
import type { KeyboardEvent as ReactKeyboardEvent, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import type { Media } from '../media-editor-provider';
|
|
4
4
|
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
@@ -30,6 +30,7 @@ export interface MediaEditorFrameProps {
|
|
|
30
30
|
}
|
|
31
31
|
export interface MediaEditorProps {
|
|
32
32
|
fields?: Field<Media>[];
|
|
33
|
+
form?: Form;
|
|
33
34
|
id: number;
|
|
34
35
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
35
36
|
onClose?: () => void;
|
|
@@ -48,6 +49,8 @@ export interface HeaderActionsProps {
|
|
|
48
49
|
*/
|
|
49
50
|
showCloseButton?: boolean;
|
|
50
51
|
}
|
|
52
|
+
declare function PanelToggle(): import("react").JSX.Element;
|
|
53
|
+
declare function MoreMenu(): import("react").JSX.Element | null;
|
|
51
54
|
declare function HeaderActions({ showCloseButton }: HeaderActionsProps): import("react").JSX.Element;
|
|
52
55
|
declare function HistoryActions(): import("react").JSX.Element | null;
|
|
53
56
|
export interface SaveActionsProps {
|
|
@@ -63,6 +66,8 @@ declare function SaveActions({ size }: SaveActionsProps): import("react").JSX.El
|
|
|
63
66
|
export declare function MediaEditor(props: MediaEditorProps): import("react").JSX.Element;
|
|
64
67
|
export declare namespace MediaEditor {
|
|
65
68
|
export { HeaderActions };
|
|
69
|
+
export { PanelToggle };
|
|
70
|
+
export { MoreMenu };
|
|
66
71
|
export { HistoryActions };
|
|
67
72
|
export { SaveActions };
|
|
68
73
|
}
|
|
@@ -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":"AAyCA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EACX,aAAa,IAAI,kBAAkB,EACnC,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAStD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,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,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;AAiID,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iBAAS,WAAW,gCAmBnB;AAED,iBAAS,QAAQ,uCAmChB;AAED,iBAAS,aAAa,CAAE,EAAE,eAAuB,EAAE,EAAE,kBAAkB,+BAuBtE;AAED,iBAAS,cAAc,uCA0HtB;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;AAqgBD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;yBANe,WAAW;;;;;;;eAiBZ,WAAW"}
|
|
@@ -7,7 +7,6 @@ interface UseCropOptionsReturn {
|
|
|
7
7
|
setAspectRatioValue: (value: string) => void;
|
|
8
8
|
aspectRatioOptions: AspectRatioPreset[];
|
|
9
9
|
resolvedAspectRatio: number | undefined;
|
|
10
|
-
resetCropOptions: () => void;
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* Build the preset list shown in the dropdown — always include the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-crop-options.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-crop-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAO3E,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;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAE,EAC/B,kBAAkB,GAClB,GAAE,kBAAuB,GAAI,oBAAoB,CAqBjD"}
|
|
@@ -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":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiBtD,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;
|
|
1
|
+
{"version":3,"file":"use-save-media-editor.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/use-save-media-editor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAiBtD,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;AA6BD,wBAAgB,kBAAkB,CAAE,EACnC,OAAO,EACP,EAAE,EACF,OAAO,EACP,KAAK,EACL,OAAO,EACP,iBAAiB,GACjB,EAAE,sBAAsB,GAAI,wBAAwB,CAkJpD"}
|
|
@@ -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,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,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,
|
|
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,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,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,sCAwHxB"}
|
|
@@ -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":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,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,+BAmC3B"}
|
|
@@ -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":"AAgBA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,mCAAmC,CAAC;AAI3C;;;;;;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,+BAmM/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CropperController } from '../../image-editor';
|
|
2
2
|
/**
|
|
3
3
|
* A single modifier in the Core REST `/edit` payload. Order is
|
|
4
4
|
* significant — the server applies modifiers sequentially (see
|
|
@@ -72,9 +72,10 @@ export type Modifier = {
|
|
|
72
72
|
* leave the sign alone because `flip_h · flip_v = -I` commutes with
|
|
73
73
|
* rotation.
|
|
74
74
|
*
|
|
75
|
-
* @param
|
|
76
|
-
*
|
|
77
|
-
* @return Ordered modifier array; empty when nothing is server-relevant
|
|
75
|
+
* @param cropper The cropper controller. The current edit and the loaded
|
|
76
|
+
* image's natural size are both read from its state.
|
|
77
|
+
* @return Ordered modifier array; empty when nothing is server-relevant or
|
|
78
|
+
* no image has loaded.
|
|
78
79
|
*/
|
|
79
|
-
export declare function buildModifiers(
|
|
80
|
+
export declare function buildModifiers(cropper: Pick<CropperController, 'state'>): Modifier[];
|
|
80
81
|
//# sourceMappingURL=build-modifiers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-modifiers.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/build-modifiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"build-modifiers.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-modal/build-modifiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GACjB;IACA,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,IAAI,EAAE;YAAE,UAAU,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;CAC1D,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC3C;IACA,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE,CAAC;AAUL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,IAAI,CAAE,iBAAiB,EAAE,OAAO,CAAE,GACzC,QAAQ,EAAE,CAsFZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Field } from '@wordpress/dataviews';
|
|
1
|
+
import type { Field, Form } from '@wordpress/dataviews';
|
|
2
2
|
import type { Media } from '../media-editor-provider';
|
|
3
3
|
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
4
4
|
interface MediaEditorModalProps {
|
|
@@ -9,12 +9,17 @@ interface MediaEditorModalProps {
|
|
|
9
9
|
* since `@wordpress/media-editor` cannot depend on `@wordpress/editor`.
|
|
10
10
|
*/
|
|
11
11
|
fields?: Field<Media>[];
|
|
12
|
+
/**
|
|
13
|
+
* Form the fields are laid out with in the Details tab. When omitted,
|
|
14
|
+
* a default layout of the core attachment fields is used.
|
|
15
|
+
*/
|
|
16
|
+
form?: Form;
|
|
12
17
|
/**
|
|
13
18
|
* Fixed aspect-ratio presets for image cropping. Free and Original are
|
|
14
19
|
* always provided by the media editor.
|
|
15
20
|
*/
|
|
16
21
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
17
22
|
}
|
|
18
|
-
export declare function MediaEditorModal({ fields, aspectRatioPresets, }: MediaEditorModalProps): import("react").JSX.Element | null;
|
|
23
|
+
export declare function MediaEditorModal({ fields, form, aspectRatioPresets, }: MediaEditorModalProps): import("react").JSX.Element | null;
|
|
19
24
|
export default MediaEditorModal;
|
|
20
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,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;AAGxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,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,4 +1,4 @@
|
|
|
1
|
-
import type { Field } from '@wordpress/dataviews';
|
|
1
|
+
import type { Field, Form } from '@wordpress/dataviews';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Media object from WordPress REST API.
|
|
@@ -29,6 +29,7 @@ export interface MediaEditorContextValue {
|
|
|
29
29
|
media?: Media;
|
|
30
30
|
onChange?: (updates: Partial<Media>) => void;
|
|
31
31
|
fields: Field<Media>[];
|
|
32
|
+
form?: Form;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Props for MediaEditorProvider.
|
|
@@ -46,6 +47,11 @@ export interface MediaEditorProviderProps {
|
|
|
46
47
|
/** Configuration settings for the media editor. */
|
|
47
48
|
settings?: {
|
|
48
49
|
fields?: Field<Media>[];
|
|
50
|
+
/**
|
|
51
|
+
* The form the fields are laid out with. When omitted, `MediaForm`
|
|
52
|
+
* uses a default layout of the core attachment fields.
|
|
53
|
+
*/
|
|
54
|
+
form?: Form;
|
|
49
55
|
};
|
|
50
56
|
/** Child components. */
|
|
51
57
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-provider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-provider/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,KAAK;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,CAAE,GAAG,EAAE,MAAM,GAAI,GAAG,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,OAAO,CAAE,KAAK,CAAE,KAAM,IAAI,CAAC;IACjD,MAAM,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,gCAAgC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAE,OAAO,EAAE,OAAO,CAAE,KAAK,CAAE,KAAM,IAAI,CAAC;IACjD,mDAAmD;IACnD,QAAQ,CAAC,EAAE;QACV,MAAM,CAAC,EAAE,KAAK,CAAE,KAAK,CAAE,EAAE,CAAC;QAC1B;;;WAGG;QACH,IAAI,CAAC,EAAE,IAAI,CAAC;KACZ,CAAC;IACF,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACpB;AAMD,wBAAgB,mBAAmB,CAAE,EACpC,KAAK,EACL,QAAQ,EACR,QAAa,EACb,QAAQ,GACR,EAAE,wBAAwB,+BAa1B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,uBAAuB,CAQ/D"}
|