@wordpress/media-editor 0.7.0 → 0.8.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/build/components/media-editor-canvas/index.cjs +54 -0
- package/build/components/media-editor-canvas/index.cjs.map +7 -0
- package/build/components/media-editor-crop-panel/index.cjs +116 -0
- package/build/components/media-editor-crop-panel/index.cjs.map +7 -0
- package/build/components/media-editor-modal/build-modifiers.cjs +91 -0
- package/build/components/media-editor-modal/build-modifiers.cjs.map +7 -0
- package/build/components/media-editor-modal/index.cjs +497 -0
- package/build/components/media-editor-modal/index.cjs.map +7 -0
- package/build/components/media-editor-toolbar/index.cjs +146 -0
- package/build/components/media-editor-toolbar/index.cjs.map +7 -0
- package/build/components/media-preview/index.cjs +1 -1
- package/build/components/media-preview/index.cjs.map +2 -2
- package/build/image-editor/core/camera.cjs +194 -0
- package/build/image-editor/core/camera.cjs.map +7 -0
- package/build/image-editor/core/constants.cjs +81 -0
- package/build/image-editor/core/constants.cjs.map +7 -0
- package/build/image-editor/core/containment.cjs +245 -0
- package/build/image-editor/core/containment.cjs.map +7 -0
- package/build/image-editor/core/export/canvas-renderer.cjs +151 -0
- package/build/image-editor/core/export/canvas-renderer.cjs.map +7 -0
- package/build/image-editor/core/index.cjs +50 -0
- package/build/image-editor/core/index.cjs.map +7 -0
- package/build/image-editor/core/interaction-controller.cjs +608 -0
- package/build/image-editor/core/interaction-controller.cjs.map +7 -0
- package/build/image-editor/core/math/rotation.cjs +41 -0
- package/build/image-editor/core/math/rotation.cjs.map +7 -0
- package/build/image-editor/core/source-region.cjs +95 -0
- package/build/image-editor/core/source-region.cjs.map +7 -0
- package/build/image-editor/core/state.cjs +269 -0
- package/build/image-editor/core/state.cjs.map +7 -0
- package/build/image-editor/core/stencil-math.cjs +197 -0
- package/build/image-editor/core/stencil-math.cjs.map +7 -0
- package/build/image-editor/core/transform-style.cjs +46 -0
- package/build/image-editor/core/transform-style.cjs.map +7 -0
- package/build/image-editor/core/transforms/pipeline.cjs +43 -0
- package/build/image-editor/core/transforms/pipeline.cjs.map +7 -0
- package/build/image-editor/core/types.cjs +19 -0
- package/build/image-editor/core/types.cjs.map +7 -0
- package/build/image-editor/index.cjs +57 -0
- package/build/image-editor/index.cjs.map +7 -0
- package/build/image-editor/react/components/cropper-provider.cjs +50 -0
- package/build/image-editor/react/components/cropper-provider.cjs.map +7 -0
- package/build/image-editor/react/components/cropper.cjs +365 -0
- package/build/image-editor/react/components/cropper.cjs.map +7 -0
- package/build/image-editor/react/components/index.cjs +36 -0
- package/build/image-editor/react/components/index.cjs.map +7 -0
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +58 -0
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +91 -0
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +351 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +7 -0
- package/build/image-editor/react/hooks/index.cjs +31 -0
- package/build/image-editor/react/hooks/index.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +68 -0
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-cropper-state.cjs +158 -0
- package/build/image-editor/react/hooks/use-cropper-state.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-interaction.cjs +161 -0
- package/build/image-editor/react/hooks/use-interaction.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-transform-style.cjs +38 -0
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +7 -0
- package/build/index.cjs +5 -2
- package/build/index.cjs.map +2 -2
- package/build/lock-unlock.cjs +37 -0
- package/build/lock-unlock.cjs.map +7 -0
- package/build/private-apis.cjs +38 -0
- package/build/private-apis.cjs.map +7 -0
- package/build/store/actions.cjs +45 -0
- package/build/store/actions.cjs.map +7 -0
- package/build/store/constants.cjs +31 -0
- package/build/store/constants.cjs.map +7 -0
- package/build/store/index.cjs +51 -0
- package/build/store/index.cjs.map +7 -0
- package/build/store/reducer.cjs +51 -0
- package/build/store/reducer.cjs.map +7 -0
- package/build/store/selectors.cjs +43 -0
- package/build/store/selectors.cjs.map +7 -0
- package/build-module/components/media-editor-canvas/index.mjs +33 -0
- package/build-module/components/media-editor-canvas/index.mjs.map +7 -0
- package/build-module/components/media-editor-crop-panel/index.mjs +100 -0
- package/build-module/components/media-editor-crop-panel/index.mjs.map +7 -0
- package/build-module/components/media-editor-modal/build-modifiers.mjs +66 -0
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +7 -0
- package/build-module/components/media-editor-modal/index.mjs +483 -0
- package/build-module/components/media-editor-modal/index.mjs.map +7 -0
- package/build-module/components/media-editor-toolbar/index.mjs +130 -0
- package/build-module/components/media-editor-toolbar/index.mjs.map +7 -0
- package/build-module/components/media-preview/index.mjs +1 -1
- package/build-module/components/media-preview/index.mjs.map +2 -2
- package/build-module/image-editor/core/camera.mjs +163 -0
- package/build-module/image-editor/core/camera.mjs.map +7 -0
- package/build-module/image-editor/core/constants.mjs +51 -0
- package/build-module/image-editor/core/constants.mjs.map +7 -0
- package/build-module/image-editor/core/containment.mjs +218 -0
- package/build-module/image-editor/core/containment.mjs.map +7 -0
- package/build-module/image-editor/core/export/canvas-renderer.mjs +120 -0
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +7 -0
- package/build-module/image-editor/core/index.mjs +24 -0
- package/build-module/image-editor/core/index.mjs.map +7 -0
- package/build-module/image-editor/core/interaction-controller.mjs +583 -0
- package/build-module/image-editor/core/interaction-controller.mjs.map +7 -0
- package/build-module/image-editor/core/math/rotation.mjs +15 -0
- package/build-module/image-editor/core/math/rotation.mjs.map +7 -0
- package/build-module/image-editor/core/source-region.mjs +69 -0
- package/build-module/image-editor/core/source-region.mjs.map +7 -0
- package/build-module/image-editor/core/state.mjs +242 -0
- package/build-module/image-editor/core/state.mjs.map +7 -0
- package/build-module/image-editor/core/stencil-math.mjs +169 -0
- package/build-module/image-editor/core/stencil-math.mjs.map +7 -0
- package/build-module/image-editor/core/transform-style.mjs +21 -0
- package/build-module/image-editor/core/transform-style.mjs.map +7 -0
- package/build-module/image-editor/core/transforms/pipeline.mjs +17 -0
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +7 -0
- package/build-module/image-editor/core/types.mjs +1 -0
- package/build-module/image-editor/core/types.mjs.map +7 -0
- package/build-module/image-editor/index.mjs +30 -0
- package/build-module/image-editor/index.mjs.map +7 -0
- package/build-module/image-editor/react/components/cropper-provider.mjs +26 -0
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +7 -0
- package/build-module/image-editor/react/components/cropper.mjs +337 -0
- package/build-module/image-editor/react/components/cropper.mjs.map +7 -0
- package/build-module/image-editor/react/components/index.mjs +9 -0
- package/build-module/image-editor/react/components/index.mjs.map +7 -0
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +33 -0
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +66 -0
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +330 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/index.mjs +6 -0
- package/build-module/image-editor/react/hooks/index.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +43 -0
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs +137 -0
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs +138 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +13 -0
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +7 -0
- package/build-module/index.mjs +3 -1
- package/build-module/index.mjs.map +2 -2
- package/build-module/lock-unlock.mjs +11 -0
- package/build-module/lock-unlock.mjs.map +7 -0
- package/build-module/private-apis.mjs +13 -0
- package/build-module/private-apis.mjs.map +7 -0
- package/build-module/store/actions.mjs +19 -0
- package/build-module/store/actions.mjs.map +7 -0
- package/build-module/store/constants.mjs +6 -0
- package/build-module/store/constants.mjs.map +7 -0
- package/build-module/store/index.mjs +16 -0
- package/build-module/store/index.mjs.map +7 -0
- package/build-module/store/reducer.mjs +26 -0
- package/build-module/store/reducer.mjs.map +7 -0
- package/build-module/store/selectors.mjs +16 -0
- package/build-module/store/selectors.mjs.map +7 -0
- package/build-style/style-rtl.css +315 -0
- package/build-style/style.css +315 -0
- package/build-types/components/media-editor-canvas/index.d.ts +22 -0
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -0
- package/build-types/components/media-editor-crop-panel/index.d.ts +45 -0
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +83 -0
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/index.d.ts +20 -0
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -0
- package/build-types/components/media-editor-toolbar/index.d.ts +21 -0
- package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -0
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts +107 -0
- package/build-types/image-editor/core/camera.d.ts.map +1 -0
- package/build-types/image-editor/core/constants.d.ts +46 -0
- package/build-types/image-editor/core/constants.d.ts.map +1 -0
- package/build-types/image-editor/core/containment.d.ts +61 -0
- package/build-types/image-editor/core/containment.d.ts.map +1 -0
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +106 -0
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +1 -0
- package/build-types/image-editor/core/index.d.ts +8 -0
- package/build-types/image-editor/core/index.d.ts.map +1 -0
- package/build-types/image-editor/core/interaction-controller.d.ts +178 -0
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -0
- package/build-types/image-editor/core/math/rotation.d.ts +18 -0
- package/build-types/image-editor/core/math/rotation.d.ts.map +1 -0
- package/build-types/image-editor/core/source-region.d.ts +75 -0
- package/build-types/image-editor/core/source-region.d.ts.map +1 -0
- package/build-types/image-editor/core/state.d.ts +42 -0
- package/build-types/image-editor/core/state.d.ts.map +1 -0
- package/build-types/image-editor/core/stencil-math.d.ts +79 -0
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -0
- package/build-types/image-editor/core/transform-style.d.ts +23 -0
- package/build-types/image-editor/core/transform-style.d.ts.map +1 -0
- package/build-types/image-editor/core/transforms/pipeline.d.ts +27 -0
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +1 -0
- package/build-types/image-editor/core/types.d.ts +211 -0
- package/build-types/image-editor/core/types.d.ts.map +1 -0
- package/build-types/image-editor/index.d.ts +16 -0
- package/build-types/image-editor/index.d.ts.map +1 -0
- package/build-types/image-editor/react/components/cropper-provider.d.ts +37 -0
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -0
- package/build-types/image-editor/react/components/cropper.d.ts +59 -0
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -0
- package/build-types/image-editor/react/components/index.d.ts +4 -0
- package/build-types/image-editor/react/components/index.d.ts.map +1 -0
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +30 -0
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +30 -0
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +32 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/index.d.ts +3 -0
- package/build-types/image-editor/react/hooks/index.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +16 -0
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +68 -0
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +60 -0
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +16 -0
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +1 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts +16 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/private-apis.d.ts +2 -0
- package/build-types/private-apis.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +27 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +2 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/index.d.ts +4 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +23 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +8 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/package.json +21 -8
- package/src/components/media-editor-canvas/index.tsx +56 -0
- package/src/components/media-editor-canvas/style.scss +9 -0
- package/src/components/media-editor-crop-panel/index.tsx +143 -0
- package/src/components/media-editor-modal/build-modifiers.ts +164 -0
- package/src/components/media-editor-modal/index.tsx +639 -0
- package/src/components/media-editor-modal/style.scss +139 -0
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +343 -0
- package/src/components/media-editor-toolbar/index.tsx +150 -0
- package/src/components/media-editor-toolbar/style.scss +21 -0
- package/src/components/media-preview/index.tsx +2 -1
- package/src/image-editor/README.md +162 -0
- package/src/image-editor/core/camera.ts +352 -0
- package/src/image-editor/core/constants.ts +93 -0
- package/src/image-editor/core/containment.ts +435 -0
- package/src/image-editor/core/export/canvas-renderer.ts +253 -0
- package/src/image-editor/core/export/test/canvas-renderer.ts +813 -0
- package/src/image-editor/core/index.ts +35 -0
- package/src/image-editor/core/interaction-controller.ts +889 -0
- package/src/image-editor/core/math/rotation.ts +26 -0
- package/src/image-editor/core/source-region.ts +166 -0
- package/src/image-editor/core/state.ts +428 -0
- package/src/image-editor/core/stencil-math.ts +330 -0
- package/src/image-editor/core/test/camera.ts +593 -0
- package/src/image-editor/core/test/interaction-controller.ts +996 -0
- package/src/image-editor/core/test/preview-export-parity.ts +242 -0
- package/src/image-editor/core/test/render-camera-bridge.ts +348 -0
- package/src/image-editor/core/test/state.ts +762 -0
- package/src/image-editor/core/test/stencil-math.ts +321 -0
- package/src/image-editor/core/transform-style.ts +44 -0
- package/src/image-editor/core/transforms/pipeline.ts +43 -0
- package/src/image-editor/core/transforms/test/pipeline.ts +269 -0
- package/src/image-editor/core/types.ts +177 -0
- package/src/image-editor/docs/architecture.md +96 -0
- package/src/image-editor/docs/recipes.md +720 -0
- package/src/image-editor/docs/roadmap.md +66 -0
- package/src/image-editor/index.ts +43 -0
- package/src/image-editor/react/components/cropper-provider.tsx +73 -0
- package/src/image-editor/react/components/cropper.scss +195 -0
- package/src/image-editor/react/components/cropper.tsx +534 -0
- package/src/image-editor/react/components/index.ts +3 -0
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +57 -0
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +80 -0
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +513 -0
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +265 -0
- package/src/image-editor/react/components/test/cropper.tsx +140 -0
- package/src/image-editor/react/hooks/index.ts +2 -0
- package/src/image-editor/react/hooks/test/use-cropper-state.ts +913 -0
- package/src/image-editor/react/hooks/test/use-interaction.ts +218 -0
- package/src/image-editor/react/hooks/test/use-transform-style.ts +146 -0
- package/src/image-editor/react/hooks/use-aria-announcer.ts +64 -0
- package/src/image-editor/react/hooks/use-cropper-state.ts +238 -0
- package/src/image-editor/react/hooks/use-interaction.ts +223 -0
- package/src/image-editor/react/hooks/use-transform-style.ts +30 -0
- package/src/image-editor/stories/rectangle-crop.story.tsx +1085 -0
- package/src/image-editor/stories/style.css +94 -0
- package/src/image-editor/style.scss +1 -0
- package/src/index.ts +3 -0
- package/src/lock-unlock.ts +10 -0
- package/src/private-apis.ts +12 -0
- package/src/store/actions.ts +33 -0
- package/src/store/constants.ts +1 -0
- package/src/store/index.ts +20 -0
- package/src/store/reducer.ts +48 -0
- package/src/store/selectors.ts +16 -0
- package/src/store/test/reducer.ts +57 -0
- package/src/style.scss +4 -0
- package/tsconfig.json +10 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/core/transforms/pipeline.ts
|
|
2
|
+
import { DEFAULT_STATE } from "../constants.mjs";
|
|
3
|
+
import { cropperReducer } from "../state.mjs";
|
|
4
|
+
function applyOperationToState(state, op) {
|
|
5
|
+
return cropperReducer(state, { type: "APPLY_OPERATION", payload: op });
|
|
6
|
+
}
|
|
7
|
+
function stateFromPipeline(pipeline, initialState = { ...DEFAULT_STATE }) {
|
|
8
|
+
return pipeline.reduce(
|
|
9
|
+
(state, op) => applyOperationToState(state, op),
|
|
10
|
+
initialState
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
applyOperationToState,
|
|
15
|
+
stateFromPipeline
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=pipeline.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/image-editor/core/transforms/pipeline.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { TransformOperation, CropperState } from '../types';\nimport { DEFAULT_STATE } from '../constants';\nimport { cropperReducer } from '../state';\n\n/**\n * Apply a single transform operation to a cropper state, returning\n * a new state with the containment invariant enforced.\n *\n * Delegates to the reducer via APPLY_OPERATION so pipeline replay\n * produces identical bounded state to UI interaction or setter\n * calls. The same logical operation yields the same result\n * regardless of entrypoint.\n *\n * @param state The current cropper state.\n * @param op The operation to apply.\n * @return A new cropper state with the operation applied.\n */\nexport function applyOperationToState(\n\tstate: CropperState,\n\top: TransformOperation\n): CropperState {\n\treturn cropperReducer( state, { type: 'APPLY_OPERATION', payload: op } );\n}\n\n/**\n * Replay all operations from an initial state to produce the final state.\n *\n * @param pipeline The array of transform operations to replay.\n * @param initialState The starting state. Defaults to DEFAULT_STATE.\n * @return The resulting cropper state after all operations are applied.\n */\nexport function stateFromPipeline(\n\tpipeline: TransformOperation[],\n\tinitialState: CropperState = { ...DEFAULT_STATE }\n): CropperState {\n\treturn pipeline.reduce(\n\t\t( state, op ) => applyOperationToState( state, op ),\n\t\tinitialState\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAexB,SAAS,sBACf,OACA,IACe;AACf,SAAO,eAAgB,OAAO,EAAE,MAAM,mBAAmB,SAAS,GAAG,CAAE;AACxE;AASO,SAAS,kBACf,UACA,eAA6B,EAAE,GAAG,cAAc,GACjC;AACf,SAAO,SAAS;AAAA,IACf,CAAE,OAAO,OAAQ,sBAAuB,OAAO,EAAG;AAAA,IAClD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/index.ts
|
|
2
|
+
import { useCropperState } from "./react/hooks/index.mjs";
|
|
3
|
+
import { Cropper, CropperProvider, useCropper } from "./react/components/index.mjs";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_STATE,
|
|
6
|
+
DEFAULT_ASPECT_RATIOS,
|
|
7
|
+
ORIGINAL_ASPECT_RATIO,
|
|
8
|
+
getSourceRegion,
|
|
9
|
+
getSourceRegionPercent,
|
|
10
|
+
applyOperationToState,
|
|
11
|
+
stateFromPipeline,
|
|
12
|
+
exportCroppedImage,
|
|
13
|
+
applyToCanvas
|
|
14
|
+
} from "./core/index.mjs";
|
|
15
|
+
export {
|
|
16
|
+
Cropper,
|
|
17
|
+
CropperProvider,
|
|
18
|
+
DEFAULT_ASPECT_RATIOS,
|
|
19
|
+
DEFAULT_STATE,
|
|
20
|
+
ORIGINAL_ASPECT_RATIO,
|
|
21
|
+
applyOperationToState,
|
|
22
|
+
applyToCanvas,
|
|
23
|
+
exportCroppedImage,
|
|
24
|
+
getSourceRegion,
|
|
25
|
+
getSourceRegionPercent,
|
|
26
|
+
stateFromPipeline,
|
|
27
|
+
useCropper,
|
|
28
|
+
useCropperState
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/image-editor/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Public image editor contract.\n *\n * Keep this barrel explicit so implementation details from `core/`,\n * `react/hooks/`, or `react/components/` do not become supported API by\n * accident. Internal modules may export additional helpers for local tests or\n * React wiring; consumers should import through this file.\n */\n\n// React surface.\nexport { useCropperState } from './react/hooks';\nexport { Cropper, CropperProvider, useCropper } from './react/components';\nexport type { UseCropperStateReturn } from './react/hooks';\nexport type { CropperProps } from './react/components';\n\n// State and extension types.\nexport type {\n\tCropperState,\n\tTransformOperation,\n\tNormalizedPoint,\n\tNormalizedRect,\n\tSize,\n\tFlip,\n\tStencilProps,\n} from './core';\n\n// Deterministic cropper helpers.\nexport {\n\tDEFAULT_STATE,\n\tDEFAULT_ASPECT_RATIOS,\n\tORIGINAL_ASPECT_RATIO,\n\tgetSourceRegion,\n\tgetSourceRegionPercent,\n\tapplyOperationToState,\n\tstateFromPipeline,\n\texportCroppedImage,\n\tapplyToCanvas,\n} from './core';\nexport type {\n\tAspectRatioPreset,\n\tSourceRegion,\n\tSourceRegionPercent,\n} from './core';\n"],
|
|
5
|
+
"mappings": ";AAUA,SAAS,uBAAuB;AAChC,SAAS,SAAS,iBAAiB,kBAAkB;AAgBrD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/react/components/cropper-provider.tsx
|
|
2
|
+
import { createContext, useContext } from "@wordpress/element";
|
|
3
|
+
import {
|
|
4
|
+
useCropperState
|
|
5
|
+
} from "../hooks/use-cropper-state.mjs";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var CropperContext = createContext(null);
|
|
8
|
+
function CropperProvider({
|
|
9
|
+
initialState,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
const cropperReturn = useCropperState(initialState);
|
|
13
|
+
return /* @__PURE__ */ jsx(CropperContext.Provider, { value: cropperReturn, children });
|
|
14
|
+
}
|
|
15
|
+
function useCropper() {
|
|
16
|
+
const context = useContext(CropperContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("useCropper must be used within a CropperProvider.");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
CropperProvider,
|
|
24
|
+
useCropper
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=cropper-provider.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/image-editor/react/components/cropper-provider.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseCropperState,\n\ttype UseCropperStateReturn,\n} from '../hooks/use-cropper-state';\nimport type { CropperState } from '../../core/types';\n\n/**\n * The context value type for the CropperProvider.\n * Contains the full return value of useCropperState.\n */\ntype CropperContextValue = UseCropperStateReturn | null;\n\nconst CropperContext = createContext< CropperContextValue >( null );\n\n/**\n * Props for the CropperProvider component.\n */\ninterface CropperProviderProps {\n\t/** Optional partial initial state to merge with defaults. */\n\tinitialState?: Partial< CropperState >;\n\t/** Child components. */\n\tchildren: React.ReactNode;\n}\n\n/**\n * Convenience context provider that wraps useCropperState.\n *\n * Provides the full cropper state and action creators to all\n * descendant components via React context.\n *\n * @param props Provider props.\n * @param props.initialState\n * @param props.children\n * @return The provider element wrapping children.\n */\nexport function CropperProvider( {\n\tinitialState,\n\tchildren,\n}: CropperProviderProps ) {\n\tconst cropperReturn = useCropperState( initialState );\n\n\treturn (\n\t\t<CropperContext.Provider value={ cropperReturn }>\n\t\t\t{ children }\n\t\t</CropperContext.Provider>\n\t);\n}\n\n/**\n * Hook to consume the CropperProvider context.\n *\n * Must be used within a CropperProvider. Throws if used outside\n * of the provider tree.\n *\n * @return The cropper state and action creators.\n */\nexport function useCropper(): UseCropperStateReturn {\n\tconst context = useContext( CropperContext );\n\n\tif ( ! context ) {\n\t\tthrow new Error( 'useCropper must be used within a CropperProvider.' );\n\t}\n\n\treturn context;\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe,kBAAkB;AAK1C;AAAA,EACC;AAAA,OAEM;AAuCL;AA9BF,IAAM,iBAAiB,cAAsC,IAAK;AAuB3D,SAAS,gBAAiB;AAAA,EAChC;AAAA,EACA;AACD,GAA0B;AACzB,QAAM,gBAAgB,gBAAiB,YAAa;AAEpD,SACC,oBAAC,eAAe,UAAf,EAAwB,OAAQ,eAC9B,UACH;AAEF;AAUO,SAAS,aAAoC;AACnD,QAAM,UAAU,WAAY,cAAe;AAE3C,MAAK,CAAE,SAAU;AAChB,UAAM,IAAI,MAAO,mDAAoD;AAAA,EACtE;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/react/components/cropper.tsx
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import {
|
|
4
|
+
useState,
|
|
5
|
+
useCallback,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useEffect,
|
|
9
|
+
forwardRef
|
|
10
|
+
} from "@wordpress/element";
|
|
11
|
+
import { __ } from "@wordpress/i18n";
|
|
12
|
+
import { getImageFit } from "../../core/camera.mjs";
|
|
13
|
+
import { getCropBounds } from "../../core/containment.mjs";
|
|
14
|
+
import { useInteraction } from "../hooks/use-interaction.mjs";
|
|
15
|
+
import { useTransformStyle } from "../hooks/use-transform-style.mjs";
|
|
16
|
+
import { useAriaAnnouncer } from "../hooks/use-aria-announcer.mjs";
|
|
17
|
+
import { RectangleStencil } from "./stencils/rectangle-stencil.mjs";
|
|
18
|
+
import { DimmingOverlay } from "./overlays/dimming-overlay.mjs";
|
|
19
|
+
import { GridOverlay } from "./overlays/grid-overlay.mjs";
|
|
20
|
+
|
|
21
|
+
// packages/media-editor/src/image-editor/react/components/cropper.scss
|
|
22
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='d3d6b4ac29']")) {
|
|
23
|
+
const style = document.createElement("style");
|
|
24
|
+
style.setAttribute("data-wp-hash", "d3d6b4ac29");
|
|
25
|
+
style.appendChild(document.createTextNode('.wp-media-editor-image-editor{cursor:grab;height:100%;overflow:hidden;position:relative;touch-action:none;user-select:none;width:100%}.wp-media-editor-image-editor__canvas{inset:22px;position:absolute}.wp-media-editor-image-editor--dragging{cursor:grabbing}.wp-media-editor-image-editor__image{left:0;position:absolute;top:0;transform-origin:center center;will-change:transform}.wp-media-editor-image-editor__stencil{pointer-events:none;position:absolute}.wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px #000000b3;pointer-events:none;position:absolute;transition:box-shadow .15s ease}.wp-media-editor-image-editor--dragging .wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px #00000080}.wp-media-editor-image-editor__grid{overflow:hidden;pointer-events:none;position:absolute;transition:opacity .15s ease}.wp-media-editor-image-editor__canvas--grid-interactive .wp-media-editor-image-editor__grid{opacity:0;transition-delay:.1s}.wp-media-editor-image-editor__canvas--show-grid .wp-media-editor-image-editor__grid{opacity:1;transition-delay:0s}.wp-media-editor-image-editor__grid-line{background:#fff6;position:absolute}.wp-media-editor-image-editor__grid-line--horizontal{height:1px;left:0;width:100%}.wp-media-editor-image-editor__grid-line--vertical{height:100%;top:0;width:1px}.wp-media-editor-image-editor__stencil-rect{border:1px solid #ffffffb3;box-sizing:border-box;pointer-events:none;position:absolute}.wp-media-editor-image-editor__handle{appearance:none;background:#fff9;border:1px solid #ffffffe6;border-radius:50%;box-sizing:border-box;cursor:default;font:inherit;height:12px;margin:0;padding:0;pointer-events:auto;position:absolute;transition:background-color .15s ease,box-shadow .15s ease;width:12px}.wp-media-editor-image-editor__handle:focus{outline:none}.wp-media-editor-image-editor__handle:focus-visible{background:var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba));border-color:#0000;box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba))}.wp-media-editor-image-editor__handle:before{content:"";height:44px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:44px}.wp-media-editor-image-editor__handle--n{cursor:ns-resize;left:50%;margin-left:-6px;top:-6px}.wp-media-editor-image-editor__handle--s{bottom:-6px;cursor:ns-resize;left:50%;margin-left:-6px}.wp-media-editor-image-editor__handle--e{cursor:ew-resize;margin-top:-6px;right:-6px;top:50%}.wp-media-editor-image-editor__handle--w{cursor:ew-resize;left:-6px;margin-top:-6px;top:50%}.wp-media-editor-image-editor__handle--nw{cursor:nwse-resize;left:-6px;top:-6px}.wp-media-editor-image-editor__handle--ne{cursor:nesw-resize;right:-6px;top:-6px}.wp-media-editor-image-editor__handle--sw{bottom:-6px;cursor:nesw-resize;left:-6px}.wp-media-editor-image-editor__handle--se{bottom:-6px;cursor:nwse-resize;right:-6px}'));
|
|
26
|
+
document.head.appendChild(style);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// packages/media-editor/src/image-editor/react/components/cropper.tsx
|
|
30
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
+
var CROP_RECT_EPSILON = 1e-6;
|
|
32
|
+
function computeInscribedRect(aspectRatio, visualSize) {
|
|
33
|
+
let w = 1;
|
|
34
|
+
let h = 1;
|
|
35
|
+
if (aspectRatio && aspectRatio > 0 && visualSize.width > 0) {
|
|
36
|
+
const normalizedRatio = aspectRatio * visualSize.height / visualSize.width;
|
|
37
|
+
if (normalizedRatio <= 1) {
|
|
38
|
+
w = normalizedRatio;
|
|
39
|
+
} else {
|
|
40
|
+
h = 1 / normalizedRatio;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
x: (1 - w) / 2,
|
|
45
|
+
y: (1 - h) / 2,
|
|
46
|
+
width: w,
|
|
47
|
+
height: h
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function CropperInner({
|
|
51
|
+
src,
|
|
52
|
+
controller,
|
|
53
|
+
stencil: StencilComponent = RectangleStencil,
|
|
54
|
+
showGrid = false,
|
|
55
|
+
isPlacementActive = false,
|
|
56
|
+
showDimming = true,
|
|
57
|
+
minZoom,
|
|
58
|
+
maxZoom,
|
|
59
|
+
aspectRatio,
|
|
60
|
+
freeformCrop = false,
|
|
61
|
+
onImageLoaded,
|
|
62
|
+
onStateChange,
|
|
63
|
+
onGestureStart,
|
|
64
|
+
onGestureEnd,
|
|
65
|
+
className
|
|
66
|
+
}, ref) {
|
|
67
|
+
const { state, setImage, setCropRect, settleCrop } = controller;
|
|
68
|
+
const canvasRef = useRef(null);
|
|
69
|
+
const [canvasSize, setCanvasSize] = useState({
|
|
70
|
+
width: 0,
|
|
71
|
+
height: 0
|
|
72
|
+
});
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const element = canvasRef.current;
|
|
75
|
+
if (!element) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const observer = new ResizeObserver((entries) => {
|
|
79
|
+
for (const entry of entries) {
|
|
80
|
+
const { width, height } = entry.contentRect;
|
|
81
|
+
setCanvasSize((prev) => {
|
|
82
|
+
if (prev.width === width && prev.height === height) {
|
|
83
|
+
return prev;
|
|
84
|
+
}
|
|
85
|
+
return { width, height };
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
observer.observe(element);
|
|
90
|
+
return () => {
|
|
91
|
+
observer.disconnect();
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
onStateChange?.(state);
|
|
96
|
+
}, [state, onStateChange]);
|
|
97
|
+
const ariaMessage = useAriaAnnouncer(state);
|
|
98
|
+
const naturalWidth = state.image?.naturalWidth ?? 0;
|
|
99
|
+
const naturalHeight = state.image?.naturalHeight ?? 0;
|
|
100
|
+
const { elementSize, visualSize } = useMemo(
|
|
101
|
+
() => getImageFit(
|
|
102
|
+
canvasSize,
|
|
103
|
+
{ width: naturalWidth, height: naturalHeight },
|
|
104
|
+
state.rotation
|
|
105
|
+
),
|
|
106
|
+
[canvasSize, naturalWidth, naturalHeight, state.rotation]
|
|
107
|
+
);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (freeformCrop || visualSize.width === 0 || visualSize.height === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const rect = computeInscribedRect(aspectRatio, visualSize);
|
|
113
|
+
const current = state.cropRect;
|
|
114
|
+
if (Math.abs(current.x - rect.x) < CROP_RECT_EPSILON && Math.abs(current.y - rect.y) < CROP_RECT_EPSILON && Math.abs(current.width - rect.width) < CROP_RECT_EPSILON && Math.abs(current.height - rect.height) < CROP_RECT_EPSILON) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
setCropRect(rect);
|
|
118
|
+
}, [freeformCrop, aspectRatio, visualSize, setCropRect, state.cropRect]);
|
|
119
|
+
const prevAspectRatioRef = useRef(aspectRatio);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (prevAspectRatioRef.current === aspectRatio) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
prevAspectRatioRef.current = aspectRatio;
|
|
125
|
+
if (!freeformCrop || visualSize.width === 0 || visualSize.height === 0 || !aspectRatio || aspectRatio <= 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setCropRect(computeInscribedRect(aspectRatio, visualSize));
|
|
129
|
+
}, [aspectRatio, freeformCrop, visualSize, setCropRect]);
|
|
130
|
+
const cropBounds = useMemo(() => {
|
|
131
|
+
if (!state.image || elementSize.width === 0) {
|
|
132
|
+
return void 0;
|
|
133
|
+
}
|
|
134
|
+
return getCropBounds(state, elementSize, visualSize, canvasSize);
|
|
135
|
+
}, [state, elementSize, visualSize, canvasSize]);
|
|
136
|
+
const {
|
|
137
|
+
handlers,
|
|
138
|
+
onWheelNative,
|
|
139
|
+
isDragging,
|
|
140
|
+
isZooming,
|
|
141
|
+
isPlacementActive: isInteractionPlacementActive
|
|
142
|
+
} = useInteraction(state, controller, canvasSize, visualSize, {
|
|
143
|
+
minZoom,
|
|
144
|
+
maxZoom,
|
|
145
|
+
onGestureStart,
|
|
146
|
+
onGestureEnd
|
|
147
|
+
});
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
const el = canvasRef.current;
|
|
150
|
+
if (!el) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
el.addEventListener("wheel", onWheelNative, {
|
|
154
|
+
passive: false
|
|
155
|
+
});
|
|
156
|
+
return () => {
|
|
157
|
+
el.removeEventListener("wheel", onWheelNative);
|
|
158
|
+
};
|
|
159
|
+
}, [onWheelNative]);
|
|
160
|
+
const transformString = useTransformStyle(state, visualSize);
|
|
161
|
+
const handleImageLoad = useCallback(
|
|
162
|
+
(event) => {
|
|
163
|
+
const img = event.currentTarget;
|
|
164
|
+
const size = {
|
|
165
|
+
width: img.naturalWidth,
|
|
166
|
+
height: img.naturalHeight
|
|
167
|
+
};
|
|
168
|
+
setImage({
|
|
169
|
+
src,
|
|
170
|
+
naturalWidth: size.width,
|
|
171
|
+
naturalHeight: size.height
|
|
172
|
+
});
|
|
173
|
+
onImageLoaded?.(size);
|
|
174
|
+
},
|
|
175
|
+
[src, setImage, onImageLoaded]
|
|
176
|
+
);
|
|
177
|
+
const handleCropChange = useCallback(
|
|
178
|
+
(rect) => {
|
|
179
|
+
setCropRect(rect);
|
|
180
|
+
},
|
|
181
|
+
[setCropRect]
|
|
182
|
+
);
|
|
183
|
+
const [settling, setSettling] = useState(false);
|
|
184
|
+
const settleTimerRef = useRef();
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
return () => {
|
|
187
|
+
clearTimeout(settleTimerRef.current);
|
|
188
|
+
};
|
|
189
|
+
}, []);
|
|
190
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
191
|
+
const isInteractiveGrid = showGrid === "interactive";
|
|
192
|
+
const showInteractiveGrid = isInteractiveGrid && (isInteractionPlacementActive || isResizing || isPlacementActive);
|
|
193
|
+
const handleEscape = useCallback(() => {
|
|
194
|
+
canvasRef.current?.focus({ preventScroll: true });
|
|
195
|
+
}, []);
|
|
196
|
+
const handleResizeStart = useCallback(() => {
|
|
197
|
+
setIsResizing(true);
|
|
198
|
+
onGestureStart?.();
|
|
199
|
+
}, [onGestureStart]);
|
|
200
|
+
const handleResizeEnd = useCallback(() => {
|
|
201
|
+
setIsResizing(false);
|
|
202
|
+
setSettling(true);
|
|
203
|
+
settleCrop();
|
|
204
|
+
onGestureEnd?.();
|
|
205
|
+
clearTimeout(settleTimerRef.current);
|
|
206
|
+
settleTimerRef.current = setTimeout(() => {
|
|
207
|
+
setSettling(false);
|
|
208
|
+
}, 200);
|
|
209
|
+
}, [settleCrop, onGestureEnd]);
|
|
210
|
+
const imageTransition = settling || isZooming ? "transform 150ms linear" : void 0;
|
|
211
|
+
const settleStencilTransition = settling ? "left 150ms linear, top 150ms linear, width 150ms linear, height 150ms linear" : void 0;
|
|
212
|
+
const imageStyle = useMemo(() => {
|
|
213
|
+
if (elementSize.width === 0 || elementSize.height === 0) {
|
|
214
|
+
return {};
|
|
215
|
+
}
|
|
216
|
+
const centerX = (canvasSize.width - elementSize.width) / 2;
|
|
217
|
+
const centerY = (canvasSize.height - elementSize.height) / 2;
|
|
218
|
+
return {
|
|
219
|
+
width: elementSize.width,
|
|
220
|
+
height: elementSize.height,
|
|
221
|
+
maxWidth: elementSize.width,
|
|
222
|
+
maxHeight: elementSize.height,
|
|
223
|
+
left: centerX,
|
|
224
|
+
top: centerY,
|
|
225
|
+
transform: transformString,
|
|
226
|
+
transition: imageTransition
|
|
227
|
+
};
|
|
228
|
+
}, [canvasSize, elementSize, transformString, imageTransition]);
|
|
229
|
+
const setContainerRef = useCallback(
|
|
230
|
+
(element) => {
|
|
231
|
+
if (typeof ref === "function") {
|
|
232
|
+
ref(element);
|
|
233
|
+
} else if (ref) {
|
|
234
|
+
ref.current = element;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
[ref]
|
|
238
|
+
);
|
|
239
|
+
return /* @__PURE__ */ jsx(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
ref: setContainerRef,
|
|
243
|
+
className: clsx(
|
|
244
|
+
"wp-media-editor-image-editor",
|
|
245
|
+
isDragging && "wp-media-editor-image-editor--dragging",
|
|
246
|
+
className
|
|
247
|
+
),
|
|
248
|
+
children: /* @__PURE__ */ jsxs(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
ref: canvasRef,
|
|
252
|
+
className: clsx(
|
|
253
|
+
"wp-media-editor-image-editor__canvas",
|
|
254
|
+
isInteractiveGrid && "wp-media-editor-image-editor__canvas--grid-interactive",
|
|
255
|
+
showInteractiveGrid && "wp-media-editor-image-editor__canvas--show-grid"
|
|
256
|
+
),
|
|
257
|
+
tabIndex: 0,
|
|
258
|
+
role: "group",
|
|
259
|
+
"aria-label": __("Image editor"),
|
|
260
|
+
...handlers,
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ jsx(
|
|
263
|
+
"img",
|
|
264
|
+
{
|
|
265
|
+
className: "wp-media-editor-image-editor__image",
|
|
266
|
+
src,
|
|
267
|
+
alt: "",
|
|
268
|
+
onLoad: handleImageLoad,
|
|
269
|
+
style: imageStyle,
|
|
270
|
+
draggable: false
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
showDimming && /* @__PURE__ */ jsx(
|
|
274
|
+
DimmingOverlay,
|
|
275
|
+
{
|
|
276
|
+
cropRect: state.cropRect,
|
|
277
|
+
containerSize: canvasSize,
|
|
278
|
+
imageSize: visualSize
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx(
|
|
282
|
+
StencilComponent,
|
|
283
|
+
{
|
|
284
|
+
cropRect: state.cropRect,
|
|
285
|
+
containerSize: canvasSize,
|
|
286
|
+
imageSize: visualSize,
|
|
287
|
+
onCropChange: handleCropChange,
|
|
288
|
+
onResizeStart: handleResizeStart,
|
|
289
|
+
onResizeEnd: handleResizeEnd,
|
|
290
|
+
onEscape: handleEscape,
|
|
291
|
+
aspectRatio,
|
|
292
|
+
freeformCrop,
|
|
293
|
+
stencilTransition: settleStencilTransition,
|
|
294
|
+
cropBounds
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
(showGrid === true || isInteractiveGrid) && /* @__PURE__ */ jsx(
|
|
298
|
+
GridOverlay,
|
|
299
|
+
{
|
|
300
|
+
cropRect: state.cropRect,
|
|
301
|
+
containerSize: canvasSize,
|
|
302
|
+
imageSize: visualSize
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ jsx(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
"aria-live": "polite",
|
|
309
|
+
"aria-atomic": "true",
|
|
310
|
+
className: "wp-media-editor-image-editor__aria-live",
|
|
311
|
+
style: {
|
|
312
|
+
position: "absolute",
|
|
313
|
+
width: 1,
|
|
314
|
+
height: 1,
|
|
315
|
+
padding: 0,
|
|
316
|
+
margin: -1,
|
|
317
|
+
overflow: "hidden",
|
|
318
|
+
clip: "rect(0, 0, 0, 0)",
|
|
319
|
+
whiteSpace: "nowrap",
|
|
320
|
+
border: 0
|
|
321
|
+
},
|
|
322
|
+
children: ariaMessage
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
var Cropper = forwardRef(
|
|
332
|
+
CropperInner
|
|
333
|
+
);
|
|
334
|
+
export {
|
|
335
|
+
Cropper
|
|
336
|
+
};
|
|
337
|
+
//# sourceMappingURL=cropper.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/image-editor/react/components/cropper.tsx", "../../../../src/image-editor/react/components/cropper.scss"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tforwardRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tCropperState,\n\tStencilProps,\n\tSize,\n\tNormalizedRect,\n} from '../../core/types';\nimport type { UseCropperStateReturn } from '../hooks/use-cropper-state';\nimport { getImageFit } from '../../core/camera';\nimport { getCropBounds } from '../../core/containment';\nimport { useInteraction } from '../hooks/use-interaction';\nimport { useTransformStyle } from '../hooks/use-transform-style';\nimport { useAriaAnnouncer } from '../hooks/use-aria-announcer';\nimport { RectangleStencil } from './stencils/rectangle-stencil';\nimport { DimmingOverlay } from './overlays/dimming-overlay';\nimport { GridOverlay } from './overlays/grid-overlay';\nimport './cropper.scss';\n\n/** Threshold for comparing normalized crop rect values. */\nconst CROP_RECT_EPSILON = 1e-6;\n\n// Largest rect of the given pixel aspect ratio that fits inside the visual\n// bounds, centered in [0,1] \u00D7 [0,1] normalized space. Returns a full-frame\n// rect (1\u00D71) if `aspectRatio` is unset or non-positive.\nfunction computeInscribedRect(\n\taspectRatio: number | undefined,\n\tvisualSize: Size\n): NormalizedRect {\n\tlet w = 1;\n\tlet h = 1;\n\tif ( aspectRatio && aspectRatio > 0 && visualSize.width > 0 ) {\n\t\t// normalizedRatio = w/h in normalized space that produces the\n\t\t// desired pixel aspect ratio.\n\t\t// pixelW = w * visualW, pixelH = h * visualH\n\t\t// pixelW / pixelH = aspectRatio\n\t\t// => w / h = aspectRatio * visualH / visualW\n\t\tconst normalizedRatio =\n\t\t\t( aspectRatio * visualSize.height ) / visualSize.width;\n\t\tif ( normalizedRatio <= 1 ) {\n\t\t\tw = normalizedRatio;\n\t\t} else {\n\t\t\th = 1 / normalizedRatio;\n\t\t}\n\t}\n\treturn {\n\t\tx: ( 1 - w ) / 2,\n\t\ty: ( 1 - h ) / 2,\n\t\twidth: w,\n\t\theight: h,\n\t};\n}\n\n/**\n * Props for the Cropper component.\n */\nexport interface CropperProps {\n\t/** Image source URL. */\n\tsrc: string;\n\t/** The full state/setter object from `useCropperState`. */\n\tcontroller: UseCropperStateReturn;\n\t/** Stencil component for the crop area. Defaults to RectangleStencil. */\n\tstencil?: React.ComponentType< StencilProps >;\n\t/** Show the rule-of-thirds grid overlay, or only during interactions. */\n\tshowGrid?: boolean | 'interactive';\n\t/** Whether external placement activity should keep the grid visible. */\n\tisPlacementActive?: boolean;\n\t/** Show the dimming overlay outside the crop area. */\n\tshowDimming?: boolean;\n\t/** Minimum zoom level. */\n\tminZoom?: number;\n\t/** Maximum zoom level. */\n\tmaxZoom?: number;\n\t/** Fixed aspect ratio (width / height) in pixel space for the crop area. */\n\taspectRatio?: number;\n\t/**\n\t * Enable freeform crop mode with resizable handles.\n\t * When false (default), the crop area is fixed and centered.\n\t * When true, the crop area has resize handles and can be freely repositioned.\n\t */\n\tfreeformCrop?: boolean;\n\t/** Callback fired when the image is loaded. */\n\tonImageLoaded?: ( size: Size ) => void;\n\t/**\n\t * Callback fired on every state change. Fires at pointermove rate\n\t * during drags, so keep the handler light \u2014 no heavy work, no\n\t * expensive parent re-renders. For commit-style events (drag end,\n\t * settled crop), use `onGestureEnd` instead.\n\t *\n\t * Useful for lightweight syncing with external tools, analytics,\n\t * or AI agents. Receives the full state so consumers can derive\n\t * whatever they need.\n\t */\n\tonStateChange?: ( state: CropperState ) => void;\n\t/** Fires when a continuous gesture begins (pan drag, handle resize, pinch zoom). */\n\tonGestureStart?: () => void;\n\t/** Fires when a continuous gesture ends (pointerup, resize settle). */\n\tonGestureEnd?: () => void;\n\t/** Additional className for the container. */\n\tclassName?: string;\n}\n\n/**\n * The main image cropper component.\n *\n * Renders an image within a container with interactive crop overlays.\n * Creates the camera once per render via getImageFit, then passes\n * derived values to stencil, overlays, and interaction hooks.\n *\n * The component fills its parent container (100% width and height).\n * Wrap it in a sized container to control its dimensions.\n *\n * @param root0 Component props implementing CropperProps.\n * @param root0.src Image source URL.\n * @param root0.controller The full state/setter object from `useCropperState`.\n * @param root0.stencil Custom stencil component.\n * @param root0.showGrid Grid overlay mode: false | true | 'interactive'.\n * @param root0.isPlacementActive Keep grid visible during external placement activity.\n * @param root0.showDimming Show dimming overlay outside crop.\n * @param root0.minZoom Minimum zoom level.\n * @param root0.maxZoom Maximum zoom level.\n * @param root0.aspectRatio Fixed aspect ratio (width/height).\n * @param root0.freeformCrop Enable resize handles.\n * @param root0.onImageLoaded Image load callback.\n * @param root0.onStateChange Every-frame state callback.\n * @param root0.onGestureStart Gesture boundary start.\n * @param root0.onGestureEnd Gesture boundary end.\n * @param root0.className Additional CSS class.\n * @param ref Forwarded ref for the container div.\n */\nfunction CropperInner(\n\t{\n\t\tsrc,\n\t\tcontroller,\n\t\tstencil: StencilComponent = RectangleStencil,\n\t\tshowGrid = false,\n\t\tisPlacementActive = false,\n\t\tshowDimming = true,\n\t\tminZoom,\n\t\tmaxZoom,\n\t\taspectRatio,\n\t\tfreeformCrop = false,\n\t\tonImageLoaded,\n\t\tonStateChange,\n\t\tonGestureStart,\n\t\tonGestureEnd,\n\t\tclassName,\n\t}: CropperProps,\n\tref: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst { state, setImage, setCropRect, settleCrop } = controller;\n\t// Canvas measurement via ResizeObserver. The canvas is the inner\n\t// positioning context for image/stencil/handles \u2014 inset from the root\n\t// by the handle gutter, so crop math operates on the reduced box.\n\tconst canvasRef = useRef< HTMLDivElement >( null );\n\tconst [ canvasSize, setCanvasSize ] = useState< Size >( {\n\t\twidth: 0,\n\t\theight: 0,\n\t} );\n\n\tuseEffect( () => {\n\t\tconst element = canvasRef.current;\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new ResizeObserver( ( entries ) => {\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst { width, height } = entry.contentRect;\n\t\t\t\tsetCanvasSize( ( prev ) => {\n\t\t\t\t\tif ( prev.width === width && prev.height === height ) {\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t}\n\t\t\t\t\treturn { width, height };\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t\tobserver.observe( element );\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [] );\n\n\t// Notify consumer of state changes.\n\tuseEffect( () => {\n\t\tonStateChange?.( state );\n\t}, [ state, onStateChange ] );\n\n\t// ARIA live region: announce significant state changes for screen readers.\n\tconst ariaMessage = useAriaAnnouncer( state );\n\n\t// Compute fitted image dimensions and visual bounds from camera math.\n\tconst naturalWidth = state.image?.naturalWidth ?? 0;\n\tconst naturalHeight = state.image?.naturalHeight ?? 0;\n\tconst { elementSize, visualSize } = useMemo(\n\t\t() =>\n\t\t\tgetImageFit(\n\t\t\t\tcanvasSize,\n\t\t\t\t{ width: naturalWidth, height: naturalHeight },\n\t\t\t\tstate.rotation\n\t\t\t),\n\t\t[ canvasSize, naturalWidth, naturalHeight, state.rotation ]\n\t);\n\n\t// In fixed-crop mode, auto-size the crop rect to fill the visual area\n\t// while respecting the aspect ratio. The crop is always centered.\n\tuseEffect( () => {\n\t\tif (\n\t\t\tfreeformCrop ||\n\t\t\tvisualSize.width === 0 ||\n\t\t\tvisualSize.height === 0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst rect = computeInscribedRect( aspectRatio, visualSize );\n\t\tconst current = state.cropRect;\n\t\tif (\n\t\t\tMath.abs( current.x - rect.x ) < CROP_RECT_EPSILON &&\n\t\t\tMath.abs( current.y - rect.y ) < CROP_RECT_EPSILON &&\n\t\t\tMath.abs( current.width - rect.width ) < CROP_RECT_EPSILON &&\n\t\t\tMath.abs( current.height - rect.height ) < CROP_RECT_EPSILON\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tsetCropRect( rect );\n\t}, [ freeformCrop, aspectRatio, visualSize, setCropRect, state.cropRect ] );\n\n\t// In freeform mode, when aspectRatio changes, reshape the crop to the\n\t// largest inscribed rect of the new ratio.\n\tconst prevAspectRatioRef = useRef( aspectRatio );\n\tuseEffect( () => {\n\t\tif ( prevAspectRatioRef.current === aspectRatio ) {\n\t\t\treturn;\n\t\t}\n\t\tprevAspectRatioRef.current = aspectRatio;\n\n\t\tif (\n\t\t\t! freeformCrop ||\n\t\t\tvisualSize.width === 0 ||\n\t\t\tvisualSize.height === 0 ||\n\t\t\t! aspectRatio ||\n\t\t\taspectRatio <= 0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tsetCropRect( computeInscribedRect( aspectRatio, visualSize ) );\n\t}, [ aspectRatio, freeformCrop, visualSize, setCropRect ] );\n\n\t// Compute the crop handle bounds from the actual image footprint.\n\t// Depends on the full state object because getCropBounds reads\n\t// crop, zoom, rotation, flip, and image. React Compiler requires\n\t// the complete dependency; the computation is lightweight (a few\n\t// trig ops + 4 corner transforms).\n\tconst cropBounds = useMemo( () => {\n\t\tif ( ! state.image || elementSize.width === 0 ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn getCropBounds( state, elementSize, visualSize, canvasSize );\n\t}, [ state, elementSize, visualSize, canvasSize ] );\n\n\t// Use the interaction hook for mouse, touch, and keyboard events.\n\tconst {\n\t\thandlers,\n\t\tonWheelNative,\n\t\tisDragging,\n\t\tisZooming,\n\t\tisPlacementActive: isInteractionPlacementActive,\n\t} = useInteraction( state, controller, canvasSize, visualSize, {\n\t\tminZoom,\n\t\tmaxZoom,\n\t\tonGestureStart,\n\t\tonGestureEnd,\n\t} );\n\n\t// Register wheel handler natively with { passive: false } so\n\t// preventDefault works. React's onWheel registers as passive. Bound\n\t// to the canvas (not the root) so pointer geometry inside the handler\n\t// resolves against the canvas box.\n\tuseEffect( () => {\n\t\tconst el = canvasRef.current;\n\t\tif ( ! el ) {\n\t\t\treturn;\n\t\t}\n\t\tel.addEventListener( 'wheel', onWheelNative, {\n\t\t\tpassive: false,\n\t\t} );\n\t\treturn () => {\n\t\t\tel.removeEventListener( 'wheel', onWheelNative );\n\t\t};\n\t}, [ onWheelNative ] );\n\n\t// Use the transform style hook for the image CSS transform.\n\tconst transformString = useTransformStyle( state, visualSize );\n\n\t/**\n\t * Handle the image load event.\n\t */\n\tconst handleImageLoad = useCallback(\n\t\t( event: React.SyntheticEvent< HTMLImageElement > ) => {\n\t\t\tconst img = event.currentTarget;\n\t\t\tconst size: Size = {\n\t\t\t\twidth: img.naturalWidth,\n\t\t\t\theight: img.naturalHeight,\n\t\t\t};\n\n\t\t\tsetImage( {\n\t\t\t\tsrc,\n\t\t\t\tnaturalWidth: size.width,\n\t\t\t\tnaturalHeight: size.height,\n\t\t\t} );\n\n\t\t\tonImageLoaded?.( size );\n\t\t},\n\t\t[ src, setImage, onImageLoaded ]\n\t);\n\n\t/**\n\t * Handle crop rect changes from the stencil (during drag).\n\t */\n\tconst handleCropChange = useCallback(\n\t\t( rect: NormalizedRect ) => {\n\t\t\tsetCropRect( rect );\n\t\t},\n\t\t[ setCropRect ]\n\t);\n\n\t// Settling animation: brief linear transition after resize end.\n\tconst [ settling, setSettling ] = useState( false );\n\tconst settleTimerRef = useRef< ReturnType< typeof setTimeout > >();\n\n\t// Clear the pending settle timer on unmount so it can't fire a\n\t// state update on an unmounted component.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( settleTimerRef.current );\n\t\t};\n\t}, [] );\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst isInteractiveGrid = showGrid === 'interactive';\n\tconst showInteractiveGrid =\n\t\tisInteractiveGrid &&\n\t\t( isInteractionPlacementActive || isResizing || isPlacementActive );\n\n\t/**\n\t * Handle Escape on a resize handle \u2014 return focus to the canvas so\n\t * arrow keys pan the image rather than resize.\n\t */\n\tconst handleEscape = useCallback( () => {\n\t\tcanvasRef.current?.focus( { preventScroll: true } );\n\t}, [] );\n\n\tconst handleResizeStart = useCallback( () => {\n\t\tsetIsResizing( true );\n\t\tonGestureStart?.();\n\t}, [ onGestureStart ] );\n\n\t/**\n\t * Handle resize end \u2014 settle the crop rect (re-center, fill height).\n\t */\n\tconst handleResizeEnd = useCallback( () => {\n\t\tsetIsResizing( false );\n\t\tsetSettling( true );\n\t\tsettleCrop();\n\t\tonGestureEnd?.();\n\t\tclearTimeout( settleTimerRef.current );\n\t\tsettleTimerRef.current = setTimeout( () => {\n\t\t\tsetSettling( false );\n\t\t}, 200 );\n\t}, [ settleCrop, onGestureEnd ] );\n\n\tconst imageTransition =\n\t\tsettling || isZooming ? 'transform 150ms linear' : undefined;\n\tconst settleStencilTransition = settling\n\t\t? 'left 150ms linear, top 150ms linear, width 150ms linear, height 150ms linear'\n\t\t: undefined;\n\n\t// Compute the image's CSS style.\n\tconst imageStyle = useMemo( (): React.CSSProperties => {\n\t\tif ( elementSize.width === 0 || elementSize.height === 0 ) {\n\t\t\treturn {};\n\t\t}\n\t\tconst centerX = ( canvasSize.width - elementSize.width ) / 2;\n\t\tconst centerY = ( canvasSize.height - elementSize.height ) / 2;\n\t\treturn {\n\t\t\twidth: elementSize.width,\n\t\t\theight: elementSize.height,\n\t\t\tmaxWidth: elementSize.width,\n\t\t\tmaxHeight: elementSize.height,\n\t\t\tleft: centerX,\n\t\t\ttop: centerY,\n\t\t\ttransform: transformString,\n\t\t\ttransition: imageTransition,\n\t\t};\n\t}, [ canvasSize, elementSize, transformString, imageTransition ] );\n\n\t// Forward the root element to the consumer's ref.\n\tconst setContainerRef = useCallback(\n\t\t( element: HTMLDivElement | null ) => {\n\t\t\tif ( typeof ref === 'function' ) {\n\t\t\t\tref( element );\n\t\t\t} else if ( ref ) {\n\t\t\t\t(\n\t\t\t\t\tref as React.MutableRefObject< HTMLDivElement | null >\n\t\t\t\t ).current = element;\n\t\t\t}\n\t\t},\n\t\t[ ref ]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ setContainerRef }\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-media-editor-image-editor',\n\t\t\t\tisDragging && 'wp-media-editor-image-editor--dragging',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t{ /*\n\t\t\t * The canvas is the interactive, inset surface. Handles and\n\t\t\t * the ARIA role/tabIndex live here so pointer geometry\n\t\t\t * (getBoundingClientRect on e.currentTarget) resolves against\n\t\t\t * the same box that crop math uses. The root stays as the\n\t\t\t * clipping shell for the dimming overlay's box-shadow.\n\t\t\t *\n\t\t\t * Not role=\"application\" \u2014 that disables the screen reader's\n\t\t\t * normal keyboard interception, too heavy-handed for a single\n\t\t\t * widget. Screen reader users get the ARIA live region below\n\t\t\t * as the announcement channel.\n\t\t\t */ }\n\t\t\t<div\n\t\t\t\tref={ canvasRef }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-media-editor-image-editor__canvas',\n\t\t\t\t\tisInteractiveGrid &&\n\t\t\t\t\t\t'wp-media-editor-image-editor__canvas--grid-interactive',\n\t\t\t\t\tshowInteractiveGrid &&\n\t\t\t\t\t\t'wp-media-editor-image-editor__canvas--show-grid'\n\t\t\t\t) }\n\t\t\t\ttabIndex={ 0 }\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ __( 'Image editor' ) }\n\t\t\t\t{ ...handlers }\n\t\t\t>\n\t\t\t\t{ /* The image layer */ }\n\t\t\t\t<img\n\t\t\t\t\tclassName=\"wp-media-editor-image-editor__image\"\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\talt=\"\"\n\t\t\t\t\tonLoad={ handleImageLoad }\n\t\t\t\t\tstyle={ imageStyle }\n\t\t\t\t\tdraggable={ false }\n\t\t\t\t/>\n\n\t\t\t\t{ /* Dimming overlay outside the crop area */ }\n\t\t\t\t{ showDimming && (\n\t\t\t\t\t<DimmingOverlay\n\t\t\t\t\t\tcropRect={ state.cropRect }\n\t\t\t\t\t\tcontainerSize={ canvasSize }\n\t\t\t\t\t\timageSize={ visualSize }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* The stencil (crop area with handles) */ }\n\t\t\t\t<StencilComponent\n\t\t\t\t\tcropRect={ state.cropRect }\n\t\t\t\t\tcontainerSize={ canvasSize }\n\t\t\t\t\timageSize={ visualSize }\n\t\t\t\t\tonCropChange={ handleCropChange }\n\t\t\t\t\tonResizeStart={ handleResizeStart }\n\t\t\t\t\tonResizeEnd={ handleResizeEnd }\n\t\t\t\t\tonEscape={ handleEscape }\n\t\t\t\t\taspectRatio={ aspectRatio }\n\t\t\t\t\tfreeformCrop={ freeformCrop }\n\t\t\t\t\tstencilTransition={ settleStencilTransition }\n\t\t\t\t\tcropBounds={ cropBounds }\n\t\t\t\t/>\n\n\t\t\t\t{ /* Rule-of-thirds grid */ }\n\t\t\t\t{ ( showGrid === true || isInteractiveGrid ) && (\n\t\t\t\t\t<GridOverlay\n\t\t\t\t\t\tcropRect={ state.cropRect }\n\t\t\t\t\t\tcontainerSize={ canvasSize }\n\t\t\t\t\t\timageSize={ visualSize }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* ARIA live region for screen reader announcements */ }\n\t\t\t\t<div\n\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\tclassName=\"wp-media-editor-image-editor__aria-live\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\theight: 1,\n\t\t\t\t\t\tpadding: 0,\n\t\t\t\t\t\tmargin: -1,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tclip: 'rect(0, 0, 0, 0)',\n\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\tborder: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ariaMessage }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport const Cropper = forwardRef< HTMLDivElement, CropperProps >(\n\tCropperInner\n);\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='d3d6b4ac29']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"d3d6b4ac29\");\n\tstyle.appendChild(document.createTextNode(\".wp-media-editor-image-editor{cursor:grab;height:100%;overflow:hidden;position:relative;touch-action:none;user-select:none;width:100%}.wp-media-editor-image-editor__canvas{inset:22px;position:absolute}.wp-media-editor-image-editor--dragging{cursor:grabbing}.wp-media-editor-image-editor__image{left:0;position:absolute;top:0;transform-origin:center center;will-change:transform}.wp-media-editor-image-editor__stencil{pointer-events:none;position:absolute}.wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px #000000b3;pointer-events:none;position:absolute;transition:box-shadow .15s ease}.wp-media-editor-image-editor--dragging .wp-media-editor-image-editor__dimming{box-shadow:0 0 0 9999px #00000080}.wp-media-editor-image-editor__grid{overflow:hidden;pointer-events:none;position:absolute;transition:opacity .15s ease}.wp-media-editor-image-editor__canvas--grid-interactive .wp-media-editor-image-editor__grid{opacity:0;transition-delay:.1s}.wp-media-editor-image-editor__canvas--show-grid .wp-media-editor-image-editor__grid{opacity:1;transition-delay:0s}.wp-media-editor-image-editor__grid-line{background:#fff6;position:absolute}.wp-media-editor-image-editor__grid-line--horizontal{height:1px;left:0;width:100%}.wp-media-editor-image-editor__grid-line--vertical{height:100%;top:0;width:1px}.wp-media-editor-image-editor__stencil-rect{border:1px solid #ffffffb3;box-sizing:border-box;pointer-events:none;position:absolute}.wp-media-editor-image-editor__handle{appearance:none;background:#fff9;border:1px solid #ffffffe6;border-radius:50%;box-sizing:border-box;cursor:default;font:inherit;height:12px;margin:0;padding:0;pointer-events:auto;position:absolute;transition:background-color .15s ease,box-shadow .15s ease;width:12px}.wp-media-editor-image-editor__handle:focus{outline:none}.wp-media-editor-image-editor__handle:focus-visible{background:var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba));border-color:#0000;box-shadow:0 0 0 2px #fff,0 0 0 4px var(--wp-image-editor-focus-color,var(--wp-admin-theme-color,#007cba))}.wp-media-editor-image-editor__handle:before{content:\\\"\\\";height:44px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:44px}.wp-media-editor-image-editor__handle--n{cursor:ns-resize;left:50%;margin-left:-6px;top:-6px}.wp-media-editor-image-editor__handle--s{bottom:-6px;cursor:ns-resize;left:50%;margin-left:-6px}.wp-media-editor-image-editor__handle--e{cursor:ew-resize;margin-top:-6px;right:-6px;top:50%}.wp-media-editor-image-editor__handle--w{cursor:ew-resize;left:-6px;margin-top:-6px;top:50%}.wp-media-editor-image-editor__handle--nw{cursor:nwse-resize;left:-6px;top:-6px}.wp-media-editor-image-editor__handle--ne{cursor:nesw-resize;right:-6px;top:-6px}.wp-media-editor-image-editor__handle--sw{bottom:-6px;cursor:nesw-resize;left:-6px}.wp-media-editor-image-editor__handle--se{bottom:-6px;cursor:nwse-resize;right:-6px}\"));\n\tdocument.head.appendChild(style);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/react/components/index.ts
|
|
2
|
+
import { Cropper } from "./cropper.mjs";
|
|
3
|
+
import { CropperProvider, useCropper } from "./cropper-provider.mjs";
|
|
4
|
+
export {
|
|
5
|
+
Cropper,
|
|
6
|
+
CropperProvider,
|
|
7
|
+
useCropper
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/image-editor/react/components/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { Cropper } from './cropper';\nexport type { CropperProps } from './cropper';\nexport { CropperProvider, useCropper } from './cropper-provider';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,eAAe;AAExB,SAAS,iBAAiB,kBAAkB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// packages/media-editor/src/image-editor/react/components/overlays/dimming-overlay.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function DimmingOverlay({
|
|
4
|
+
cropRect,
|
|
5
|
+
containerSize,
|
|
6
|
+
imageSize
|
|
7
|
+
}) {
|
|
8
|
+
if (containerSize.width === 0 || containerSize.height === 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const offsetX = (containerSize.width - imageSize.width) / 2;
|
|
12
|
+
const offsetY = (containerSize.height - imageSize.height) / 2;
|
|
13
|
+
const left = offsetX + cropRect.x * imageSize.width;
|
|
14
|
+
const top = offsetY + cropRect.y * imageSize.height;
|
|
15
|
+
const width = cropRect.width * imageSize.width;
|
|
16
|
+
const height = cropRect.height * imageSize.height;
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: "wp-media-editor-image-editor__dimming",
|
|
21
|
+
style: {
|
|
22
|
+
left,
|
|
23
|
+
top,
|
|
24
|
+
width,
|
|
25
|
+
height
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
DimmingOverlay
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=dimming-overlay.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/image-editor/react/components/overlays/dimming-overlay.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { NormalizedRect, Size } from '../../../core/types';\n\n/**\n * Props for the DimmingOverlay component.\n */\ninterface DimmingOverlayProps {\n\t/** The crop rectangle in normalized coordinates. */\n\tcropRect: NormalizedRect;\n\t/** The container element dimensions in pixels. */\n\tcontainerSize: Size;\n\t/** The rendered image dimensions in pixels within the container. */\n\timageSize: Size;\n}\n\n/**\n * Renders a semi-transparent overlay outside the crop rectangle.\n *\n * Uses the box-shadow approach: a div matching the crop rect position\n * with a large box-shadow that dims everything outside it.\n *\n * @param props Component props.\n * @param props.cropRect The crop rectangle in normalized coordinates.\n * @param props.containerSize The container element dimensions in pixels.\n * @param props.imageSize The rendered image dimensions in pixels.\n * @return The dimming overlay element.\n */\nexport function DimmingOverlay( {\n\tcropRect,\n\tcontainerSize,\n\timageSize,\n}: DimmingOverlayProps ) {\n\tif ( containerSize.width === 0 || containerSize.height === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst offsetX = ( containerSize.width - imageSize.width ) / 2;\n\tconst offsetY = ( containerSize.height - imageSize.height ) / 2;\n\tconst left = offsetX + cropRect.x * imageSize.width;\n\tconst top = offsetY + cropRect.y * imageSize.height;\n\tconst width = cropRect.width * imageSize.width;\n\tconst height = cropRect.height * imageSize.height;\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"wp-media-editor-image-editor__dimming\"\n\t\t\tstyle={ {\n\t\t\t\tleft,\n\t\t\t\ttop,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AA8CE;AAjBK,SAAS,eAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,MAAK,cAAc,UAAU,KAAK,cAAc,WAAW,GAAI;AAC9D,WAAO;AAAA,EACR;AAEA,QAAM,WAAY,cAAc,QAAQ,UAAU,SAAU;AAC5D,QAAM,WAAY,cAAc,SAAS,UAAU,UAAW;AAC9D,QAAM,OAAO,UAAU,SAAS,IAAI,UAAU;AAC9C,QAAM,MAAM,UAAU,SAAS,IAAI,UAAU;AAC7C,QAAM,QAAQ,SAAS,QAAQ,UAAU;AACzC,QAAM,SAAS,SAAS,SAAS,UAAU;AAE3C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|