@wordpress/media-editor 0.10.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/components/media-editor/index.cjs +41 -51
  3. package/build/components/media-editor/index.cjs.map +3 -3
  4. package/build/components/media-editor-crop-panel/index.cjs +15 -45
  5. package/build/components/media-editor-crop-panel/index.cjs.map +3 -3
  6. package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
  7. package/build/components/media-editor-image-controls/index.cjs +230 -0
  8. package/build/components/media-editor-image-controls/index.cjs.map +7 -0
  9. package/build/components/media-form/index.cjs +12 -23
  10. package/build/components/media-form/index.cjs.map +3 -3
  11. package/build/image-editor/core/constants.cjs +3 -0
  12. package/build/image-editor/core/constants.cjs.map +2 -2
  13. package/build/image-editor/core/stencil-math.cjs +11 -2
  14. package/build/image-editor/core/stencil-math.cjs.map +2 -2
  15. package/build/image-editor/react/components/cropper.cjs +12 -7
  16. package/build/image-editor/react/components/cropper.cjs.map +2 -2
  17. package/build-module/components/media-editor/index.mjs +41 -51
  18. package/build-module/components/media-editor/index.mjs.map +2 -2
  19. package/build-module/components/media-editor-crop-panel/index.mjs +8 -51
  20. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  21. package/build-module/components/media-editor-fine-rotation/index.mjs.map +2 -2
  22. package/build-module/components/media-editor-image-controls/index.mjs +221 -0
  23. package/build-module/components/media-editor-image-controls/index.mjs.map +7 -0
  24. package/build-module/components/media-form/index.mjs +12 -13
  25. package/build-module/components/media-form/index.mjs.map +2 -2
  26. package/build-module/image-editor/core/constants.mjs +2 -0
  27. package/build-module/image-editor/core/constants.mjs.map +2 -2
  28. package/build-module/image-editor/core/stencil-math.mjs +9 -1
  29. package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
  30. package/build-module/image-editor/react/components/cropper.mjs +12 -7
  31. package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
  32. package/build-style/style-rtl.css +136 -47
  33. package/build-style/style.css +136 -46
  34. package/build-types/components/media-editor/index.d.ts +6 -7
  35. package/build-types/components/media-editor/index.d.ts.map +1 -1
  36. package/build-types/components/media-editor-crop-panel/index.d.ts +11 -6
  37. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  38. package/build-types/components/media-editor-fine-rotation/index.d.ts +4 -3
  39. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
  40. package/build-types/components/media-editor-image-controls/index.d.ts +46 -0
  41. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -0
  42. package/build-types/components/media-editor-toolbar/index.d.ts +24 -0
  43. package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -0
  44. package/build-types/components/media-editor-transform-controls/index.d.ts +18 -5
  45. package/build-types/components/media-editor-transform-controls/index.d.ts.map +1 -1
  46. package/build-types/components/media-form/index.d.ts.map +1 -1
  47. package/build-types/image-editor/core/constants.d.ts +10 -0
  48. package/build-types/image-editor/core/constants.d.ts.map +1 -1
  49. package/build-types/image-editor/core/stencil-math.d.ts +16 -3
  50. package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
  51. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  52. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +108 -0
  53. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -0
  54. package/package.json +25 -20
  55. package/src/components/media-editor/index.tsx +69 -77
  56. package/src/components/media-editor/style.scss +124 -4
  57. package/src/components/media-editor-crop-panel/index.tsx +16 -62
  58. package/src/components/media-editor-crop-panel/test/index.tsx +25 -41
  59. package/src/components/media-editor-fine-rotation/index.tsx +4 -3
  60. package/src/components/media-editor-image-controls/index.tsx +262 -0
  61. package/src/components/media-editor-image-controls/style.scss +48 -0
  62. package/src/components/media-editor-image-controls/test/index.tsx +150 -0
  63. package/src/components/media-editor-modal/style.scss +32 -42
  64. package/src/components/media-form/index.tsx +17 -21
  65. package/src/components/media-form/style.scss +6 -0
  66. package/src/components/rotation-ruler/style.scss +10 -3
  67. package/src/image-editor/core/constants.ts +11 -0
  68. package/src/image-editor/core/stencil-math.ts +23 -0
  69. package/src/image-editor/core/test/stencil-math.ts +39 -0
  70. package/src/image-editor/react/components/cropper.scss +28 -17
  71. package/src/image-editor/react/components/cropper.tsx +17 -7
  72. package/src/style.scss +2 -1
  73. package/tsconfig.tsbuildinfo +1 -1
  74. package/build/components/media-editor-transform-controls/index.cjs +0 -84
  75. package/build/components/media-editor-transform-controls/index.cjs.map +0 -7
  76. package/build/components/media-form/sidebar-datetime-view.cjs +0 -53
  77. package/build/components/media-form/sidebar-datetime-view.cjs.map +0 -7
  78. package/build-module/components/media-editor-transform-controls/index.mjs +0 -68
  79. package/build-module/components/media-editor-transform-controls/index.mjs.map +0 -7
  80. package/build-module/components/media-form/sidebar-datetime-view.mjs +0 -32
  81. package/build-module/components/media-form/sidebar-datetime-view.mjs.map +0 -7
  82. package/src/components/media-editor-transform-controls/index.tsx +0 -70
  83. package/src/components/media-editor-transform-controls/style.scss +0 -8
  84. package/src/components/media-form/sidebar-datetime-view.tsx +0 -47
  85. package/src/components/media-form/test/sidebar-datetime-view.test.tsx +0 -96
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.11.1 (2026-06-16)
6
+
7
+ ## 0.11.0 (2026-06-10)
8
+
9
+ ### Bug Fixes
10
+
11
+ - Media Editor: Stop the details/crop sidebar overflowing the modal between the small and medium breakpoints.
12
+ - Media Editor: Remove the lag when toggling the details/crop sidebar open or closed.
13
+
14
+ ### Code Quality
15
+
16
+ - Add missing `@types/react` dependency. [#78882](https://github.com/WordPress/gutenberg/pull/78882).
@@ -49,7 +49,7 @@ var import_media_editor_provider = require("../media-editor-provider/index.cjs")
49
49
  var import_media_preview = __toESM(require("../media-preview/index.cjs"));
50
50
  var import_media_editor_canvas = __toESM(require("../media-editor-canvas/index.cjs"));
51
51
  var import_media_editor_fine_rotation = __toESM(require("../media-editor-fine-rotation/index.cjs"));
52
- var import_media_editor_transform_controls = __toESM(require("../media-editor-transform-controls/index.cjs"));
52
+ var import_media_editor_image_controls = __toESM(require("../media-editor-image-controls/index.cjs"));
53
53
  var import_media_editor_crop_panel = __toESM(require("../media-editor-crop-panel/index.cjs"));
54
54
  var import_media_form = __toESM(require("../media-form/index.cjs"));
55
55
  var import_lock_unlock = require("../../lock-unlock.cjs");
@@ -76,6 +76,7 @@ function MediaEditorSidebar({ tabs }) {
76
76
  className: "media-editor__sidebar",
77
77
  panelClassName: "media-editor__sidebar-panel",
78
78
  headerClassName: "media-editor__sidebar-header",
79
+ closeLabel: (0, import_i18n.__)("Close media panel"),
79
80
  header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: tab.id, children: tab.title }, tab.id)) }) }),
80
81
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
82
  Tabs.TabPanel,
@@ -174,6 +175,17 @@ function HistoryActions({
174
175
  expanded: false,
175
176
  gap: 2,
176
177
  children: [
178
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
+ import_components.Button,
180
+ {
181
+ size: "compact",
182
+ variant: "tertiary",
183
+ disabled: !isDirty,
184
+ accessibleWhenDisabled: true,
185
+ onClick: handleReset,
186
+ children: (0, import_i18n.__)("Reset")
187
+ }
188
+ ),
177
189
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
178
190
  import_components.Button,
179
191
  {
@@ -199,17 +211,6 @@ function HistoryActions({
199
211
  accessibleWhenDisabled: true,
200
212
  onClick: handleRedo
201
213
  }
202
- ),
203
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
204
- import_components.Button,
205
- {
206
- size: "compact",
207
- variant: "tertiary",
208
- disabled: !isDirty,
209
- accessibleWhenDisabled: true,
210
- onClick: handleReset,
211
- children: (0, import_i18n.__)("Reset")
212
- }
213
214
  )
214
215
  ]
215
216
  }
@@ -271,14 +272,8 @@ function MediaEditorContent({
271
272
  shouldCloseOnEsc = false
272
273
  }) {
273
274
  const cropper = (0, import_state.useMediaEditor)();
274
- const isWideViewport = (0, import_compose.useViewportMatch)("xlarge");
275
- const isMediumViewport = (0, import_compose.useViewportMatch)("medium");
276
- let footerLayout = "narrow";
277
- if (isWideViewport) {
278
- footerLayout = "wide";
279
- } else if (isMediumViewport) {
280
- footerLayout = "medium";
281
- }
275
+ const isPanelLayout = (0, import_compose.useViewportMatch)("small");
276
+ const footerLayout = isPanelLayout ? "wide" : "narrow";
282
277
  const { media, hasEdits } = (0, import_data.useSelect)(
283
278
  (select) => {
284
279
  const {
@@ -394,8 +389,8 @@ function MediaEditorContent({
394
389
  {
395
390
  aspectRatioValue,
396
391
  onAspectRatioChange: setAspectRatioValue,
397
- onPlacementControlInteraction: signalPlacementControlInteraction,
398
- aspectRatioOptions
392
+ aspectRatioOptions,
393
+ showTransformControls: isPanelLayout
399
394
  }
400
395
  )
401
396
  }
@@ -408,7 +403,7 @@ function MediaEditorContent({
408
403
  aspectRatioValue,
409
404
  setAspectRatioValue,
410
405
  aspectRatioOptions,
411
- signalPlacementControlInteraction
406
+ isPanelLayout
412
407
  ]);
413
408
  const handleChange = (updates) => {
414
409
  editEntityRecord("postType", "attachment", id, updates);
@@ -467,6 +462,12 @@ function MediaEditorContent({
467
462
  context: import_use_save_media_editor.MEDIA_EDITOR_NOTICES_CONTEXT
468
463
  }
469
464
  );
465
+ const ruler = isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
466
+ import_media_editor_fine_rotation.default,
467
+ {
468
+ onPlacementControlInteraction: signalPlacementControlInteraction
469
+ }
470
+ ) : null;
470
471
  const children = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
471
472
  import_media_editor_provider.MediaEditorProvider,
472
473
  {
@@ -484,15 +485,18 @@ function MediaEditorContent({
484
485
  body: isImage ? (0, import_i18n.__)("Image editor") : (0, import_i18n.__)("Media preview"),
485
486
  sidebar: (0, import_i18n.__)("Media details")
486
487
  },
487
- content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "media-editor__canvas", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
488
- import_media_editor_canvas.default,
489
- {
490
- focusOnMount: true,
491
- isPlacementActive,
492
- onGestureStart: handleCanvasGestureStart,
493
- onGestureEnd: handleCanvasGestureEnd
494
- }
495
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_preview.default, {}) }),
488
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "media-editor__content", children: [
489
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "media-editor__canvas-area", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
490
+ import_media_editor_canvas.default,
491
+ {
492
+ focusOnMount: true,
493
+ isPlacementActive,
494
+ onGestureStart: handleCanvasGestureStart,
495
+ onGestureEnd: handleCanvasGestureEnd
496
+ }
497
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_preview.default, {}) }),
498
+ isImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "media-editor__canvas-toolbar", children: ruler })
499
+ ] }),
496
500
  sidebar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.ComplementaryArea.Slot, { scope: "media-editor" })
497
501
  }
498
502
  )
@@ -524,13 +528,13 @@ function MediaEditorContent({
524
528
  onReset: resetCropOptions
525
529
  }
526
530
  ) : null;
527
- const ruler = isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
528
- import_media_editor_fine_rotation.default,
531
+ const imageControls = isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
532
+ import_media_editor_image_controls.default,
529
533
  {
530
- onPlacementControlInteraction: signalPlacementControlInteraction
534
+ showAspectRatioControl: true,
535
+ aspectRatioPresets
531
536
  }
532
537
  ) : null;
533
- const transform = isImage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor_transform_controls.default, {}) : null;
534
538
  const actions = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
535
539
  FooterActions,
536
540
  {
@@ -545,25 +549,11 @@ function MediaEditorContent({
545
549
  if (footerLayout === "wide") {
546
550
  footerActions = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
547
551
  history,
548
- isImage && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "media-editor-modal__footer-toolbar", children: [
549
- ruler,
550
- transform
551
- ] }),
552
552
  actions
553
553
  ] });
554
- } else if (footerLayout === "medium") {
555
- footerActions = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
556
- ruler,
557
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "media-editor-modal__footer-row", children: [
558
- history,
559
- transform,
560
- actions
561
- ] })
562
- ] });
563
554
  } else {
564
555
  footerActions = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
565
- ruler,
566
- transform,
556
+ imageControls,
567
557
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "media-editor-modal__footer-row", children: [
568
558
  history,
569
559
  actions
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/media-editor/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFlex,\n\tSpinner,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close, drawerRight, keyboard, redo, undo } from '@wordpress/icons';\nimport {\n\tdisplayShortcut,\n\tisAppleOS,\n\tisKeyboardEvent,\n} from '@wordpress/keycodes';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport type { Field } from '@wordpress/dataviews';\nimport {\n\tComplementaryArea,\n\tInterfaceSkeleton,\n\tPinnedItems,\n\t// No type declarations available for @wordpress/interface.\n\t// @ts-expect-error\n} from '@wordpress/interface';\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { MediaEditorProvider } from '../media-editor-provider';\nimport type { Media } from '../media-editor-provider';\nimport MediaPreview from '../media-preview';\nimport MediaEditorCanvas from '../media-editor-canvas';\nimport MediaEditorFineRotation from '../media-editor-fine-rotation';\nimport MediaEditorTransformControls from '../media-editor-transform-controls';\nimport MediaEditorCropPanel from '../media-editor-crop-panel';\nimport MediaForm from '../media-form';\nimport { unlock } from '../../lock-unlock';\nimport { getMediaTypeFromMimeType } from '../../utils';\nimport { MediaEditorStateProvider, useMediaEditor } from '../../state';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\nimport { CROP_CONTROL_ATTR } from '../../hooks/use-crop-gesture-handlers';\nimport MediaEditorKeyboardShortcutsModal from '../media-editor-keyboard-shortcuts-modal';\nimport {\n\tMEDIA_EDITOR_NOTICES_CONTEXT,\n\tuseSaveMediaEditor,\n\ttype MediaEditorSaveResult,\n} from './use-save-media-editor';\nimport { useCropOptions } from './use-crop-options';\n\nexport type { MediaEditorSaveResult } from './use-save-media-editor';\n\n// Embed query for the attachment's author and parent post. Shared between\n// the `getEntityRecord` read and the matching `invalidateResolution` so the\n// two stay in lockstep.\nconst ATTACHMENT_EMBED_QUERY = { _embed: 'author,wp:attached-to' } as const;\n\nconst PLACEMENT_CONTROL_IDLE_MS = 300;\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\ninterface EditorTab {\n\tid: string;\n\ttitle: string;\n\tpanel: JSX.Element;\n}\n\nexport interface MediaEditorFrameProps {\n\tchildren: ReactNode;\n\theaderActions: ReactNode;\n\tfooterActions: ReactNode;\n\t/**\n\t * Footer layout selector. Frames apply this to the footer container\n\t * as a modifier class.\n\t *\n\t * - `wide` \u2014 single row: History | Ruler | Transform | Cancel/Save.\n\t * - `medium` \u2014 two rows: ruler on top; History | Transform | Cancel/Save\n\t * beneath.\n\t * - `narrow` \u2014 three rows: ruler; transform (centered); History |\n\t * Cancel/Save.\n\t */\n\tfooterLayout: 'wide' | 'medium' | 'narrow';\n\tonRequestClose: () => void;\n\tonKeyDown: ( event: ReactKeyboardEvent< HTMLElement > ) => void;\n\tshouldCloseOnClickOutside: boolean;\n\tisSaving: boolean;\n\thasChanges: boolean;\n\thasMedia: boolean;\n}\n\nexport interface MediaEditorProps {\n\tfields?: Field< Media >[];\n\tid: number;\n\taspectRatioPresets?: AspectRatioPreset[];\n\tonClose?: () => void;\n\tonSaved?: ( result: MediaEditorSaveResult ) => void;\n\trenderFrame: ( props: MediaEditorFrameProps ) => JSX.Element;\n\tnoticesClassName?: string;\n\tnoticesPortalElement?: Element | null;\n\tshowCloseButton?: boolean;\n\tshouldCloseOnEsc?: boolean;\n}\n\nfunction MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {\n\tconst tabsContextValue = useContext( Tabs.Context );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tscope=\"media-editor\"\n\t\t\tidentifier=\"media-editor/details\"\n\t\t\ttitle={ __( 'Details' ) }\n\t\t\ticon={ drawerRight }\n\t\t\tisActiveByDefault\n\t\t\tclassName=\"media-editor__sidebar\"\n\t\t\tpanelClassName=\"media-editor__sidebar-panel\"\n\t\t\theaderClassName=\"media-editor__sidebar-header\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.id } tabId={ tab.id }>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\tkey={ tab.id }\n\t\t\t\t\t\ttabId={ tab.id }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.panel }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\ninterface HeaderActionsProps {\n\tisSaving: boolean;\n\tisImage: boolean;\n\tshowCloseButton?: boolean;\n\tonCancel: () => void;\n}\n\nfunction HeaderActions( {\n\tisSaving,\n\tisImage,\n\tshowCloseButton = false,\n\tonCancel,\n}: HeaderActionsProps ) {\n\tconst [ isShortcutsModalOpen, setIsShortcutsModalOpen ] = useState( false );\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__header-actions\"\n\t\t\tjustify=\"flex-end\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t{ isImage && (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\ticon={ keyboard }\n\t\t\t\t\tlabel={ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\tonClick={ () => setIsShortcutsModalOpen( true ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<PinnedItems.Slot scope=\"media-editor\" />\n\t\t\t{ showCloseButton && (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isShortcutsModalOpen && (\n\t\t\t\t<MediaEditorKeyboardShortcutsModal\n\t\t\t\t\tonClose={ () => setIsShortcutsModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Flex>\n\t);\n}\n\ninterface HistoryActionsProps {\n\tisUndoRedoDisabled?: boolean;\n\tonReset: () => void;\n}\n\nfunction HistoryActions( {\n\tisUndoRedoDisabled = false,\n\tonReset,\n}: HistoryActionsProps ) {\n\tconst {\n\t\treset,\n\t\tisDirty,\n\t\thasUndo,\n\t\thasRedo,\n\t\tundo: undoCrop,\n\t\tredo: redoCrop,\n\t\tbeginGesture,\n\t\tendGesture,\n\t} = useMediaEditor();\n\tconst handleUndo = () => {\n\t\tif ( isUndoRedoDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tundoCrop();\n\t};\n\tconst handleRedo = () => {\n\t\tif ( isUndoRedoDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tredoCrop();\n\t};\n\tconst handleReset = () => {\n\t\tbeginGesture();\n\t\treset();\n\t\tonReset();\n\t\tendGesture();\n\t};\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__history-actions\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ undo }\n\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\tshowTooltip\n\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\tdisabled={ isUndoRedoDisabled || ! hasUndo }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleUndo }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ redo }\n\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\tshowTooltip\n\t\t\t\tshortcut={\n\t\t\t\t\tisAppleOS()\n\t\t\t\t\t\t? displayShortcut.primaryShift( 'z' )\n\t\t\t\t\t\t: displayShortcut.primary( 'y' )\n\t\t\t\t}\n\t\t\t\tdisabled={ isUndoRedoDisabled || ! hasRedo }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleRedo }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleReset }\n\t\t\t>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</Button>\n\t\t</Flex>\n\t);\n}\n\ninterface FooterActionsProps {\n\tisSaving: boolean;\n\thasMedia: boolean;\n\thasChanges: boolean;\n\tonCancel: () => void;\n\tonSave: () => void;\n}\n\nfunction FooterActions( {\n\tisSaving,\n\thasMedia,\n\thasChanges,\n\tonCancel,\n\tonSave,\n}: FooterActionsProps ) {\n\tconst saveDisabled = isSaving || ! hasMedia || ! hasChanges;\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__footer-actions\"\n\t\t\tjustify=\"flex-end\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tonClick={ onCancel }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ onSave }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tdisabled={ saveDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Save' ) }\n\t\t\t</Button>\n\t\t</Flex>\n\t);\n}\n\nfunction MediaEditorContent( {\n\tfields = [],\n\tid,\n\taspectRatioPresets,\n\tonClose,\n\tonSaved,\n\trenderFrame,\n\tnoticesClassName = 'media-editor__snackbar',\n\tnoticesPortalElement,\n\tshowCloseButton = false,\n\tshouldCloseOnEsc = false,\n}: MediaEditorProps ) {\n\tconst cropper = useMediaEditor();\n\t// Three footer layouts, picked from the viewport so DOM order matches\n\t// visual order in all three (no `order` reshuffling needed):\n\t// wide (\u2265 xlarge): single row.\n\t// medium (\u2265 medium): ruler on top; rest beneath.\n\t// narrow (< medium): ruler, then transform centered, then history/save.\n\tconst isWideViewport = useViewportMatch( 'xlarge' );\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tlet footerLayout: 'wide' | 'medium' | 'narrow' = 'narrow';\n\tif ( isWideViewport ) {\n\t\tfooterLayout = 'wide';\n\t} else if ( isMediumViewport ) {\n\t\tfooterLayout = 'medium';\n\t}\n\n\tconst { media, hasEdits } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\thasEditsForEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\t// Trigger an _embed fetch so `_embedded.author` and\n\t\t\t// `_embedded['wp:attached-to']` land on the record for the Details\n\t\t\t// fields to read. `getEditedEntityRecord` doesn't formally accept a\n\t\t\t// query, so we can't embed via that selector directly.\n\t\t\tgetEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\tATTACHMENT_EMBED_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tmedia: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t) as Media,\n\t\t\t\thasEdits: hasEditsForEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst hasChanges = cropper.isCropperDirty || hasEdits;\n\n\tconst { clearEntityRecordEdits, editEntityRecord, invalidateResolution } =\n\t\tuseDispatch( coreStore );\n\tconst { removeAllNotices } = useDispatch( noticesStore );\n\n\tconst [ isDiscardDialogOpen, setIsDiscardDialogOpen ] = useState( false );\n\tconst [ isPlacementActive, setIsPlacementActive ] = useState( false );\n\tconst [ isCanvasGestureActive, setIsCanvasGestureActive ] =\n\t\tuseState( false );\n\tconst placementControlTimerRef =\n\t\tuseRef< ReturnType< typeof setTimeout > >();\n\n\tconst signalPlacementControlInteraction = useCallback( () => {\n\t\tsetIsPlacementActive( true );\n\t\tclearTimeout( placementControlTimerRef.current );\n\t\tplacementControlTimerRef.current = setTimeout( () => {\n\t\t\tsetIsPlacementActive( false );\n\t\t}, PLACEMENT_CONTROL_IDLE_MS );\n\t}, [] );\n\tconst handleCanvasGestureStart = useCallback( () => {\n\t\tsetIsCanvasGestureActive( true );\n\t}, [] );\n\tconst handleCanvasGestureEnd = useCallback( () => {\n\t\tsetIsCanvasGestureActive( false );\n\t}, [] );\n\tconst isCropInteractionActive = isPlacementActive || isCanvasGestureActive;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( placementControlTimerRef.current );\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tsetIsPlacementActive( false );\n\t\tsetIsCanvasGestureActive( false );\n\t}, [ id ] );\n\n\t// Bust the cached `_embed` resolution each time the editor mounts (or the\n\t// id changes) so embedded data such as the attached post's title or the\n\t// author's name reflects any edits made elsewhere since the last open.\n\tuseEffect( () => {\n\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t'postType',\n\t\t\t'attachment',\n\t\t\tid,\n\t\t\tATTACHMENT_EMBED_QUERY,\n\t\t] );\n\t}, [ id, invalidateResolution ] );\n\n\tconst mediaType = getMediaTypeFromMimeType( media?.mime_type ).type;\n\tconst isImage = !! media && mediaType === 'image';\n\tconst {\n\t\taspectRatioValue,\n\t\tsetAspectRatioValue,\n\t\taspectRatioOptions,\n\t\tresetCropOptions,\n\t} = useCropOptions( {\n\t\taspectRatioPresets,\n\t} );\n\tconst { isSaving, save: saveMediaEditor } = useSaveMediaEditor( {\n\t\tcropper,\n\t\tid,\n\t\tisImage,\n\t\tmedia,\n\t\tonSaved,\n\t} );\n\n\tconst tabs = useMemo< EditorTab[] >( () => {\n\t\tconst detailsTab: EditorTab = {\n\t\t\tid: 'details',\n\t\t\ttitle: __( 'Details' ),\n\t\t\tpanel: (\n\t\t\t\t<Stack\n\t\t\t\t\tclassName=\"media-editor__panel\"\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap=\"lg\"\n\t\t\t\t>\n\t\t\t\t\t<MediaForm />\n\t\t\t\t</Stack>\n\t\t\t),\n\t\t};\n\t\tif ( ! isImage ) {\n\t\t\treturn [ detailsTab ];\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: 'crop',\n\t\t\t\ttitle: __( 'Crop' ),\n\t\t\t\tpanel: (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName=\"media-editor__panel\"\n\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaEditorCropPanel\n\t\t\t\t\t\t\taspectRatioValue={ aspectRatioValue }\n\t\t\t\t\t\t\tonAspectRatioChange={ setAspectRatioValue }\n\t\t\t\t\t\t\tonPlacementControlInteraction={\n\t\t\t\t\t\t\t\tsignalPlacementControlInteraction\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taspectRatioOptions={ aspectRatioOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t),\n\t\t\t},\n\t\t\tdetailsTab,\n\t\t];\n\t}, [\n\t\tisImage,\n\t\taspectRatioValue,\n\t\tsetAspectRatioValue,\n\t\taspectRatioOptions,\n\t\tsignalPlacementControlInteraction,\n\t] );\n\n\tconst handleChange = ( updates: Partial< Media > ) => {\n\t\teditEntityRecord( 'postType', 'attachment', id, updates );\n\t};\n\n\tconst discardAndClose = () => {\n\t\tremoveAllNotices( 'snackbar', MEDIA_EDITOR_NOTICES_CONTEXT );\n\t\tclearEntityRecordEdits( 'postType', 'attachment', id );\n\t\tonClose?.();\n\t};\n\n\tconst handleRequestClose = () => {\n\t\tif ( isSaving ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasChanges ) {\n\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\treturn;\n\t\t}\n\t\tdiscardAndClose();\n\t};\n\n\tconst handleKeyDown = ( event: ReactKeyboardEvent< HTMLElement > ) => {\n\t\tconst isUndoShortcut = isKeyboardEvent.primary( event, 'z' );\n\t\tconst isRedoShortcut =\n\t\t\tisKeyboardEvent.primaryShift( event, 'z' ) ||\n\t\t\t( ! isAppleOS() && isKeyboardEvent.primary( event, 'y' ) );\n\t\tif ( ( isUndoShortcut || isRedoShortcut ) && isImage ) {\n\t\t\tconst target = event.target as HTMLElement;\n\t\t\tconst isMetadataField =\n\t\t\t\t( target.tagName === 'INPUT' ||\n\t\t\t\t\ttarget.tagName === 'TEXTAREA' ||\n\t\t\t\t\ttarget.isContentEditable ) &&\n\t\t\t\t! target.closest( `[${ CROP_CONTROL_ATTR }]` );\n\t\t\tif ( ! isMetadataField ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( isCropInteractionActive ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( isRedoShortcut ) {\n\t\t\t\t\tcropper.redo();\n\t\t\t\t} else {\n\t\t\t\t\tcropper.undo();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( shouldCloseOnEsc ) {\n\t\t\tif ( event.code !== 'Escape' && event.key !== 'Escape' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( isSaving ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( hasChanges ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst snackbar = (\n\t\t<SnackbarNotices\n\t\t\tclassName={ noticesClassName }\n\t\t\tcontext={ MEDIA_EDITOR_NOTICES_CONTEXT }\n\t\t/>\n\t);\n\n\tconst children = (\n\t\t<MediaEditorProvider\n\t\t\tvalue={ media ?? undefined }\n\t\t\tonChange={ handleChange }\n\t\t\tsettings={ { fields } }\n\t\t>\n\t\t\t<div className=\"media-editor\">\n\t\t\t\t{ ! media ? (\n\t\t\t\t\t<div className=\"media-editor__loading\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t\t<MediaEditorSidebar tabs={ tabs } />\n\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tclassName=\"media-editor__skeleton\"\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\tbody: isImage\n\t\t\t\t\t\t\t\t\t? __( 'Image editor' )\n\t\t\t\t\t\t\t\t\t: __( 'Media preview' ),\n\t\t\t\t\t\t\t\tsidebar: __( 'Media details' ),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<div className=\"media-editor__canvas\">\n\t\t\t\t\t\t\t\t\t{ isImage ? (\n\t\t\t\t\t\t\t\t\t\t<MediaEditorCanvas\n\t\t\t\t\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\t\t\t\t\tisPlacementActive={\n\t\t\t\t\t\t\t\t\t\t\t\tisPlacementActive\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonGestureStart={\n\t\t\t\t\t\t\t\t\t\t\t\thandleCanvasGestureStart\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonGestureEnd={\n\t\t\t\t\t\t\t\t\t\t\t\thandleCanvasGestureEnd\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<MediaPreview />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"media-editor\" />\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isDiscardDialogOpen }\n\t\t\t\tconfirmButtonText={ __( 'Discard' ) }\n\t\t\t\tcancelButtonText={ __( 'Keep editing' ) }\n\t\t\t\tonCancel={ () => setIsDiscardDialogOpen( false ) }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\tsetIsDiscardDialogOpen( false );\n\t\t\t\t\tdiscardAndClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Are you sure you want to discard your unsaved changes?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t\t{ noticesPortalElement\n\t\t\t\t? createPortal( snackbar, noticesPortalElement )\n\t\t\t\t: snackbar }\n\t\t</MediaEditorProvider>\n\t);\n\n\tconst history = isImage ? (\n\t\t<HistoryActions\n\t\t\tisUndoRedoDisabled={ isCropInteractionActive }\n\t\t\tonReset={ resetCropOptions }\n\t\t/>\n\t) : null;\n\tconst ruler = isImage ? (\n\t\t<MediaEditorFineRotation\n\t\t\tonPlacementControlInteraction={ signalPlacementControlInteraction }\n\t\t/>\n\t) : null;\n\tconst transform = isImage ? <MediaEditorTransformControls /> : null;\n\tconst actions = (\n\t\t<FooterActions\n\t\t\tisSaving={ isSaving }\n\t\t\thasMedia={ !! media }\n\t\t\thasChanges={ hasChanges }\n\t\t\tonCancel={ handleRequestClose }\n\t\t\tonSave={ saveMediaEditor }\n\t\t/>\n\t);\n\n\t// One JSX tree per layout. DOM order matches visual order in all three.\n\t// `.media-editor-modal__footer-toolbar` (wide only) groups ruler +\n\t// transform with the centered cluster and divider that the wide layout\n\t// has always had.\n\tlet footerActions: ReactNode;\n\tif ( footerLayout === 'wide' ) {\n\t\tfooterActions = (\n\t\t\t<>\n\t\t\t\t{ history }\n\t\t\t\t{ isImage && (\n\t\t\t\t\t<div className=\"media-editor-modal__footer-toolbar\">\n\t\t\t\t\t\t{ ruler }\n\t\t\t\t\t\t{ transform }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ actions }\n\t\t\t</>\n\t\t);\n\t} else if ( footerLayout === 'medium' ) {\n\t\tfooterActions = (\n\t\t\t<>\n\t\t\t\t{ ruler }\n\t\t\t\t<div className=\"media-editor-modal__footer-row\">\n\t\t\t\t\t{ history }\n\t\t\t\t\t{ transform }\n\t\t\t\t\t{ actions }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t} else {\n\t\tfooterActions = (\n\t\t\t<>\n\t\t\t\t{ ruler }\n\t\t\t\t{ transform }\n\t\t\t\t<div className=\"media-editor-modal__footer-row\">\n\t\t\t\t\t{ history }\n\t\t\t\t\t{ actions }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn renderFrame( {\n\t\tchildren,\n\t\theaderActions: (\n\t\t\t<HeaderActions\n\t\t\t\tisSaving={ isSaving }\n\t\t\t\tisImage={ isImage }\n\t\t\t\tshowCloseButton={ showCloseButton }\n\t\t\t\tonCancel={ handleRequestClose }\n\t\t\t/>\n\t\t),\n\t\tfooterActions,\n\t\tfooterLayout,\n\t\tonRequestClose: handleRequestClose,\n\t\tonKeyDown: handleKeyDown,\n\t\tshouldCloseOnClickOutside: ! hasChanges && ! isSaving,\n\t\tisSaving,\n\t\thasChanges,\n\t\thasMedia: !! media,\n\t} );\n}\n\nexport function MediaEditor( props: MediaEditorProps ) {\n\treturn (\n\t\t<MediaEditorStateProvider key={ props.id }>\n\t\t\t<MediaEditorContent { ...props } />\n\t\t</MediaEditorStateProvider>\n\t);\n}\n\nexport default MediaEditor;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAMO;AACP,gBAAsB;AACtB,qBAAiC;AACjC,kBAAuC;AACvC,uBAAmC;AACnC,qBAQO;AACP,kBAAmB;AACnB,mBAAyD;AACzD,sBAIO;AACP,qBAAuD;AAEvD,uBAMO;AAMP,mCAAoC;AAEpC,2BAAyB;AACzB,iCAA8B;AAC9B,wCAAoC;AACpC,6CAAyC;AACzC,qCAAiC;AACjC,wBAAsB;AACtB,yBAAuB;AACvB,mBAAyC;AACzC,mBAAyD;AAEzD,uCAAkC;AAClC,mDAA8C;AAC9C,mCAIO;AACP,8BAA+B;AAuExB;AAhEP,IAAM,yBAAyB,EAAE,QAAQ,wBAAwB;AAEjE,IAAM,4BAA4B;AAElC,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AA4C/C,SAAS,mBAAoB,EAAE,KAAK,GAA2B;AAC9D,QAAM,uBAAmB,2BAAY,KAAK,OAAQ;AAClD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAM;AAAA,MACN,YAAW;AAAA,MACX,WAAQ,gBAAI,SAAU;AAAA,MACtB,MAAO;AAAA,MACP,mBAAiB;AAAA,MACjB,WAAU;AAAA,MACV,gBAAe;AAAA,MACf,iBAAgB;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UAAW;AAAA,MACX,QAAS;AAAA;AAAA,EACV;AAOD,MAAI;AACJ,MAAK,iBAAiB,QAAS;AAC9B,oBACC,4EACG;AAAA;AAAA,MACA,WACD,6CAAC,SAAI,WAAU,sCACZ;AAAA;AAAA,QACA;AAAA,SACH;AAAA,MAEC;AAAA,OACH;AAAA,EAEF,WAAY,iBAAiB,UAAW;AACvC,oBACC,4EACG;AAAA;AAAA,MACF,6CAAC,SAAI,WAAU,kCACZ;AAAA;AAAA,QACA;AAAA,QACA;AAAA,SACH;AAAA,OACD;AAAA,EAEF,OAAO;AACN,oBACC,4EACG;AAAA;AAAA,MACA;AAAA,MACF,6CAAC,SAAI,WAAU,kCACZ;AAAA;AAAA,QACA;AAAA,SACH;AAAA,OACD;AAAA,EAEF;AAEA,SAAO,YAAa;AAAA,IACnB;AAAA,IACA,eACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAW;AAAA;AAAA,IACZ;AAAA,IAED;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,2BAA2B,CAAE,cAAc,CAAE;AAAA,IAC7C;AAAA,IACA;AAAA,IACA,UAAU,CAAC,CAAE;AAAA,EACd,CAAE;AACH;AAEO,SAAS,YAAa,OAA0B;AACtD,SACC,4CAAC,yCACA,sDAAC,sBAAqB,GAAG,OAAQ,KADF,MAAM,EAEtC;AAEF;AAEA,IAAO,uBAAQ;",
6
- "names": ["componentsPrivateApis", "MediaEditorKeyboardShortcutsModal", "coreStore", "noticesStore", "MediaForm", "MediaEditorCropPanel", "MediaEditorCanvas", "MediaPreview", "ConfirmDialog", "MediaEditorFineRotation", "MediaEditorTransformControls"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFlex,\n\tSpinner,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close, drawerRight, keyboard, redo, undo } from '@wordpress/icons';\nimport {\n\tdisplayShortcut,\n\tisAppleOS,\n\tisKeyboardEvent,\n} from '@wordpress/keycodes';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport type { Field } from '@wordpress/dataviews';\nimport {\n\tComplementaryArea,\n\tInterfaceSkeleton,\n\tPinnedItems,\n\t// No type declarations available for @wordpress/interface.\n\t// @ts-expect-error\n} from '@wordpress/interface';\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { MediaEditorProvider } from '../media-editor-provider';\nimport type { Media } from '../media-editor-provider';\nimport MediaPreview from '../media-preview';\nimport MediaEditorCanvas from '../media-editor-canvas';\nimport MediaEditorFineRotation from '../media-editor-fine-rotation';\nimport MediaEditorImageControls from '../media-editor-image-controls';\nimport MediaEditorCropPanel from '../media-editor-crop-panel';\nimport MediaForm from '../media-form';\nimport { unlock } from '../../lock-unlock';\nimport { getMediaTypeFromMimeType } from '../../utils';\nimport { MediaEditorStateProvider, useMediaEditor } from '../../state';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\nimport { CROP_CONTROL_ATTR } from '../../hooks/use-crop-gesture-handlers';\nimport MediaEditorKeyboardShortcutsModal from '../media-editor-keyboard-shortcuts-modal';\nimport {\n\tMEDIA_EDITOR_NOTICES_CONTEXT,\n\tuseSaveMediaEditor,\n\ttype MediaEditorSaveResult,\n} from './use-save-media-editor';\nimport { useCropOptions } from './use-crop-options';\n\nexport type { MediaEditorSaveResult } from './use-save-media-editor';\n\n// Embed query for the attachment's author and parent post. Shared between\n// the `getEntityRecord` read and the matching `invalidateResolution` so the\n// two stay in lockstep.\nconst ATTACHMENT_EMBED_QUERY = { _embed: 'author,wp:attached-to' } as const;\n\nconst PLACEMENT_CONTROL_IDLE_MS = 300;\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\ninterface EditorTab {\n\tid: string;\n\ttitle: string;\n\tpanel: JSX.Element;\n}\n\nexport interface MediaEditorFrameProps {\n\tchildren: ReactNode;\n\theaderActions: ReactNode;\n\tfooterActions: ReactNode;\n\t/**\n\t * Footer layout selector. Frames apply this to the footer container\n\t * as a modifier class. Tracks the sidebar-collapse breakpoint (`medium`).\n\t *\n\t * - `wide` \u2014 sidebar is a column; footer is a single row of History |\n\t * Cancel/Save (transform controls live in the Crop panel).\n\t * - `narrow` \u2014 sidebar collapsed; transform controls sit above a\n\t * History | Cancel/Save row.\n\t */\n\tfooterLayout: 'wide' | 'narrow';\n\tonRequestClose: () => void;\n\tonKeyDown: ( event: ReactKeyboardEvent< HTMLElement > ) => void;\n\tshouldCloseOnClickOutside: boolean;\n\tisSaving: boolean;\n\thasChanges: boolean;\n\thasMedia: boolean;\n}\n\nexport interface MediaEditorProps {\n\tfields?: Field< Media >[];\n\tid: number;\n\taspectRatioPresets?: AspectRatioPreset[];\n\tonClose?: () => void;\n\tonSaved?: ( result: MediaEditorSaveResult ) => void;\n\trenderFrame: ( props: MediaEditorFrameProps ) => JSX.Element;\n\tnoticesClassName?: string;\n\tnoticesPortalElement?: Element | null;\n\tshowCloseButton?: boolean;\n\tshouldCloseOnEsc?: boolean;\n}\n\nfunction MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {\n\tconst tabsContextValue = useContext( Tabs.Context );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tscope=\"media-editor\"\n\t\t\tidentifier=\"media-editor/details\"\n\t\t\ttitle={ __( 'Details' ) }\n\t\t\ticon={ drawerRight }\n\t\t\tisActiveByDefault\n\t\t\tclassName=\"media-editor__sidebar\"\n\t\t\tpanelClassName=\"media-editor__sidebar-panel\"\n\t\t\theaderClassName=\"media-editor__sidebar-header\"\n\t\t\tcloseLabel={ __( 'Close media panel' ) }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.id } tabId={ tab.id }>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\tkey={ tab.id }\n\t\t\t\t\t\ttabId={ tab.id }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.panel }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\ninterface HeaderActionsProps {\n\tisSaving: boolean;\n\tisImage: boolean;\n\tshowCloseButton?: boolean;\n\tonCancel: () => void;\n}\n\nfunction HeaderActions( {\n\tisSaving,\n\tisImage,\n\tshowCloseButton = false,\n\tonCancel,\n}: HeaderActionsProps ) {\n\tconst [ isShortcutsModalOpen, setIsShortcutsModalOpen ] = useState( false );\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__header-actions\"\n\t\t\tjustify=\"flex-end\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t{ isImage && (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\ticon={ keyboard }\n\t\t\t\t\tlabel={ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\tonClick={ () => setIsShortcutsModalOpen( true ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<PinnedItems.Slot scope=\"media-editor\" />\n\t\t\t{ showCloseButton && (\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isShortcutsModalOpen && (\n\t\t\t\t<MediaEditorKeyboardShortcutsModal\n\t\t\t\t\tonClose={ () => setIsShortcutsModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Flex>\n\t);\n}\n\ninterface HistoryActionsProps {\n\tisUndoRedoDisabled?: boolean;\n\tonReset: () => void;\n}\n\nfunction HistoryActions( {\n\tisUndoRedoDisabled = false,\n\tonReset,\n}: HistoryActionsProps ) {\n\tconst {\n\t\treset,\n\t\tisDirty,\n\t\thasUndo,\n\t\thasRedo,\n\t\tundo: undoCrop,\n\t\tredo: redoCrop,\n\t\tbeginGesture,\n\t\tendGesture,\n\t} = useMediaEditor();\n\tconst handleUndo = () => {\n\t\tif ( isUndoRedoDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tundoCrop();\n\t};\n\tconst handleRedo = () => {\n\t\tif ( isUndoRedoDisabled ) {\n\t\t\treturn;\n\t\t}\n\t\tredoCrop();\n\t};\n\tconst handleReset = () => {\n\t\tbeginGesture();\n\t\treset();\n\t\tonReset();\n\t\tendGesture();\n\t};\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__history-actions\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleReset }\n\t\t\t>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ undo }\n\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\tshowTooltip\n\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\tdisabled={ isUndoRedoDisabled || ! hasUndo }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleUndo }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ redo }\n\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\tshowTooltip\n\t\t\t\tshortcut={\n\t\t\t\t\tisAppleOS()\n\t\t\t\t\t\t? displayShortcut.primaryShift( 'z' )\n\t\t\t\t\t\t: displayShortcut.primary( 'y' )\n\t\t\t\t}\n\t\t\t\tdisabled={ isUndoRedoDisabled || ! hasRedo }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tonClick={ handleRedo }\n\t\t\t/>\n\t\t</Flex>\n\t);\n}\n\ninterface FooterActionsProps {\n\tisSaving: boolean;\n\thasMedia: boolean;\n\thasChanges: boolean;\n\tonCancel: () => void;\n\tonSave: () => void;\n}\n\nfunction FooterActions( {\n\tisSaving,\n\thasMedia,\n\thasChanges,\n\tonCancel,\n\tonSave,\n}: FooterActionsProps ) {\n\tconst saveDisabled = isSaving || ! hasMedia || ! hasChanges;\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor__footer-actions\"\n\t\t\tjustify=\"flex-end\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tonClick={ onCancel }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ onSave }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tdisabled={ saveDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Save' ) }\n\t\t\t</Button>\n\t\t</Flex>\n\t);\n}\n\nfunction MediaEditorContent( {\n\tfields = [],\n\tid,\n\taspectRatioPresets,\n\tonClose,\n\tonSaved,\n\trenderFrame,\n\tnoticesClassName = 'media-editor__snackbar',\n\tnoticesPortalElement,\n\tshowCloseButton = false,\n\tshouldCloseOnEsc = false,\n}: MediaEditorProps ) {\n\tconst cropper = useMediaEditor();\n\t// The sidebar is a side column from the `small` breakpoint up and collapses\n\t// to an overlay below it \u2014 mirroring InterfaceSkeleton's behaviour, shifted\n\t// from `medium` to `small` (see the matching CSS overrides in style.scss).\n\t// Track that single breakpoint: in \"panel mode\" (\u2265 small) the\n\t// rotate/flip/zoom controls live in the Crop panel and the footer is just\n\t// History + Cancel/Save; below it the controls drop into the footer. (The\n\t// fine-rotation ruler always sits under the canvas.)\n\tconst isPanelLayout = useViewportMatch( 'small' );\n\tconst footerLayout: 'wide' | 'narrow' = isPanelLayout ? 'wide' : 'narrow';\n\n\tconst { media, hasEdits } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\thasEditsForEntityRecord,\n\t\t\t} = select( coreStore );\n\t\t\t// Trigger an _embed fetch so `_embedded.author` and\n\t\t\t// `_embedded['wp:attached-to']` land on the record for the Details\n\t\t\t// fields to read. `getEditedEntityRecord` doesn't formally accept a\n\t\t\t// query, so we can't embed via that selector directly.\n\t\t\tgetEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tid,\n\t\t\t\tATTACHMENT_EMBED_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tmedia: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t) as Media,\n\t\t\t\thasEdits: hasEditsForEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst hasChanges = cropper.isCropperDirty || hasEdits;\n\n\tconst { clearEntityRecordEdits, editEntityRecord, invalidateResolution } =\n\t\tuseDispatch( coreStore );\n\tconst { removeAllNotices } = useDispatch( noticesStore );\n\n\tconst [ isDiscardDialogOpen, setIsDiscardDialogOpen ] = useState( false );\n\tconst [ isPlacementActive, setIsPlacementActive ] = useState( false );\n\tconst [ isCanvasGestureActive, setIsCanvasGestureActive ] =\n\t\tuseState( false );\n\tconst placementControlTimerRef =\n\t\tuseRef< ReturnType< typeof setTimeout > >();\n\n\tconst signalPlacementControlInteraction = useCallback( () => {\n\t\tsetIsPlacementActive( true );\n\t\tclearTimeout( placementControlTimerRef.current );\n\t\tplacementControlTimerRef.current = setTimeout( () => {\n\t\t\tsetIsPlacementActive( false );\n\t\t}, PLACEMENT_CONTROL_IDLE_MS );\n\t}, [] );\n\tconst handleCanvasGestureStart = useCallback( () => {\n\t\tsetIsCanvasGestureActive( true );\n\t}, [] );\n\tconst handleCanvasGestureEnd = useCallback( () => {\n\t\tsetIsCanvasGestureActive( false );\n\t}, [] );\n\tconst isCropInteractionActive = isPlacementActive || isCanvasGestureActive;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( placementControlTimerRef.current );\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tsetIsPlacementActive( false );\n\t\tsetIsCanvasGestureActive( false );\n\t}, [ id ] );\n\n\t// Bust the cached `_embed` resolution each time the editor mounts (or the\n\t// id changes) so embedded data such as the attached post's title or the\n\t// author's name reflects any edits made elsewhere since the last open.\n\tuseEffect( () => {\n\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t'postType',\n\t\t\t'attachment',\n\t\t\tid,\n\t\t\tATTACHMENT_EMBED_QUERY,\n\t\t] );\n\t}, [ id, invalidateResolution ] );\n\n\tconst mediaType = getMediaTypeFromMimeType( media?.mime_type ).type;\n\tconst isImage = !! media && mediaType === 'image';\n\tconst {\n\t\taspectRatioValue,\n\t\tsetAspectRatioValue,\n\t\taspectRatioOptions,\n\t\tresetCropOptions,\n\t} = useCropOptions( {\n\t\taspectRatioPresets,\n\t} );\n\tconst { isSaving, save: saveMediaEditor } = useSaveMediaEditor( {\n\t\tcropper,\n\t\tid,\n\t\tisImage,\n\t\tmedia,\n\t\tonSaved,\n\t} );\n\n\tconst tabs = useMemo< EditorTab[] >( () => {\n\t\tconst detailsTab: EditorTab = {\n\t\t\tid: 'details',\n\t\t\ttitle: __( 'Details' ),\n\t\t\tpanel: (\n\t\t\t\t<Stack\n\t\t\t\t\tclassName=\"media-editor__panel\"\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap=\"lg\"\n\t\t\t\t>\n\t\t\t\t\t<MediaForm />\n\t\t\t\t</Stack>\n\t\t\t),\n\t\t};\n\t\tif ( ! isImage ) {\n\t\t\treturn [ detailsTab ];\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: 'crop',\n\t\t\t\ttitle: __( 'Crop' ),\n\t\t\t\tpanel: (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName=\"media-editor__panel\"\n\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaEditorCropPanel\n\t\t\t\t\t\t\taspectRatioValue={ aspectRatioValue }\n\t\t\t\t\t\t\tonAspectRatioChange={ setAspectRatioValue }\n\t\t\t\t\t\t\taspectRatioOptions={ aspectRatioOptions }\n\t\t\t\t\t\t\tshowTransformControls={ isPanelLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t),\n\t\t\t},\n\t\t\tdetailsTab,\n\t\t];\n\t}, [\n\t\tisImage,\n\t\taspectRatioValue,\n\t\tsetAspectRatioValue,\n\t\taspectRatioOptions,\n\t\tisPanelLayout,\n\t] );\n\n\tconst handleChange = ( updates: Partial< Media > ) => {\n\t\teditEntityRecord( 'postType', 'attachment', id, updates );\n\t};\n\n\tconst discardAndClose = () => {\n\t\tremoveAllNotices( 'snackbar', MEDIA_EDITOR_NOTICES_CONTEXT );\n\t\tclearEntityRecordEdits( 'postType', 'attachment', id );\n\t\tonClose?.();\n\t};\n\n\tconst handleRequestClose = () => {\n\t\tif ( isSaving ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasChanges ) {\n\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\treturn;\n\t\t}\n\t\tdiscardAndClose();\n\t};\n\n\tconst handleKeyDown = ( event: ReactKeyboardEvent< HTMLElement > ) => {\n\t\tconst isUndoShortcut = isKeyboardEvent.primary( event, 'z' );\n\t\tconst isRedoShortcut =\n\t\t\tisKeyboardEvent.primaryShift( event, 'z' ) ||\n\t\t\t( ! isAppleOS() && isKeyboardEvent.primary( event, 'y' ) );\n\t\tif ( ( isUndoShortcut || isRedoShortcut ) && isImage ) {\n\t\t\tconst target = event.target as HTMLElement;\n\t\t\tconst isMetadataField =\n\t\t\t\t( target.tagName === 'INPUT' ||\n\t\t\t\t\ttarget.tagName === 'TEXTAREA' ||\n\t\t\t\t\ttarget.isContentEditable ) &&\n\t\t\t\t! target.closest( `[${ CROP_CONTROL_ATTR }]` );\n\t\t\tif ( ! isMetadataField ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( isCropInteractionActive ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( isRedoShortcut ) {\n\t\t\t\t\tcropper.redo();\n\t\t\t\t} else {\n\t\t\t\t\tcropper.undo();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( shouldCloseOnEsc ) {\n\t\t\tif ( event.code !== 'Escape' && event.key !== 'Escape' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( isSaving ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( hasChanges ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\t}\n\t\t}\n\t};\n\n\tconst snackbar = (\n\t\t<SnackbarNotices\n\t\t\tclassName={ noticesClassName }\n\t\t\tcontext={ MEDIA_EDITOR_NOTICES_CONTEXT }\n\t\t/>\n\t);\n\n\tconst ruler = isImage ? (\n\t\t<MediaEditorFineRotation\n\t\t\tonPlacementControlInteraction={ signalPlacementControlInteraction }\n\t\t/>\n\t) : null;\n\n\tconst children = (\n\t\t<MediaEditorProvider\n\t\t\tvalue={ media ?? undefined }\n\t\t\tonChange={ handleChange }\n\t\t\tsettings={ { fields } }\n\t\t>\n\t\t\t<div className=\"media-editor\">\n\t\t\t\t{ ! media ? (\n\t\t\t\t\t<div className=\"media-editor__loading\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t\t<MediaEditorSidebar tabs={ tabs } />\n\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tclassName=\"media-editor__skeleton\"\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\tbody: isImage\n\t\t\t\t\t\t\t\t\t? __( 'Image editor' )\n\t\t\t\t\t\t\t\t\t: __( 'Media preview' ),\n\t\t\t\t\t\t\t\tsidebar: __( 'Media details' ),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<div className=\"media-editor__content\">\n\t\t\t\t\t\t\t\t\t<div className=\"media-editor__canvas-area\">\n\t\t\t\t\t\t\t\t\t\t{ isImage ? (\n\t\t\t\t\t\t\t\t\t\t\t<MediaEditorCanvas\n\t\t\t\t\t\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\t\t\t\t\t\tisPlacementActive={\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPlacementActive\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonGestureStart={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleCanvasGestureStart\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonGestureEnd={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleCanvasGestureEnd\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<MediaPreview />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t{ isImage && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"media-editor__canvas-toolbar\">\n\t\t\t\t\t\t\t\t\t\t\t{ ruler }\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"media-editor\" />\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isDiscardDialogOpen }\n\t\t\t\tconfirmButtonText={ __( 'Discard' ) }\n\t\t\t\tcancelButtonText={ __( 'Keep editing' ) }\n\t\t\t\tonCancel={ () => setIsDiscardDialogOpen( false ) }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\tsetIsDiscardDialogOpen( false );\n\t\t\t\t\tdiscardAndClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Are you sure you want to discard your unsaved changes?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t\t{ noticesPortalElement\n\t\t\t\t? createPortal( snackbar, noticesPortalElement )\n\t\t\t\t: snackbar }\n\t\t</MediaEditorProvider>\n\t);\n\n\tconst history = isImage ? (\n\t\t<HistoryActions\n\t\t\tisUndoRedoDisabled={ isCropInteractionActive }\n\t\t\tonReset={ resetCropOptions }\n\t\t/>\n\t) : null;\n\tconst imageControls = isImage ? (\n\t\t<MediaEditorImageControls\n\t\t\tshowAspectRatioControl\n\t\t\taspectRatioPresets={ aspectRatioPresets }\n\t\t/>\n\t) : null;\n\tconst actions = (\n\t\t<FooterActions\n\t\t\tisSaving={ isSaving }\n\t\t\thasMedia={ !! media }\n\t\t\thasChanges={ hasChanges }\n\t\t\tonCancel={ handleRequestClose }\n\t\t\tonSave={ saveMediaEditor }\n\t\t/>\n\t);\n\n\t// The fine-rotation ruler always lives under the canvas (in\n\t// `media-editor__content`), never the footer, so it stays constrained to\n\t// the canvas column at every viewport. One JSX tree per layout; DOM order\n\t// matches visual order.\n\tlet footerActions: ReactNode;\n\tif ( footerLayout === 'wide' ) {\n\t\t// Sidebar is a column: image controls live in the Crop panel, so\n\t\t// the footer is just History + Cancel/Save.\n\t\tfooterActions = (\n\t\t\t<>\n\t\t\t\t{ history }\n\t\t\t\t{ actions }\n\t\t\t</>\n\t\t);\n\t} else {\n\t\t// Sidebar collapsed: the image controls drop into the footer.\n\t\tfooterActions = (\n\t\t\t<>\n\t\t\t\t{ imageControls }\n\t\t\t\t<div className=\"media-editor-modal__footer-row\">\n\t\t\t\t\t{ history }\n\t\t\t\t\t{ actions }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn renderFrame( {\n\t\tchildren,\n\t\theaderActions: (\n\t\t\t<HeaderActions\n\t\t\t\tisSaving={ isSaving }\n\t\t\t\tisImage={ isImage }\n\t\t\t\tshowCloseButton={ showCloseButton }\n\t\t\t\tonCancel={ handleRequestClose }\n\t\t\t/>\n\t\t),\n\t\tfooterActions,\n\t\tfooterLayout,\n\t\tonRequestClose: handleRequestClose,\n\t\tonKeyDown: handleKeyDown,\n\t\tshouldCloseOnClickOutside: ! hasChanges && ! isSaving,\n\t\tisSaving,\n\t\thasChanges,\n\t\thasMedia: !! media,\n\t} );\n}\n\nexport function MediaEditor( props: MediaEditorProps ) {\n\treturn (\n\t\t<MediaEditorStateProvider key={ props.id }>\n\t\t\t<MediaEditorContent { ...props } />\n\t\t</MediaEditorStateProvider>\n\t);\n}\n\nexport default MediaEditor;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAMO;AACP,gBAAsB;AACtB,qBAAiC;AACjC,kBAAuC;AACvC,uBAAmC;AACnC,qBAQO;AACP,kBAAmB;AACnB,mBAAyD;AACzD,sBAIO;AACP,qBAAuD;AAEvD,uBAMO;AAMP,mCAAoC;AAEpC,2BAAyB;AACzB,iCAA8B;AAC9B,wCAAoC;AACpC,yCAAqC;AACrC,qCAAiC;AACjC,wBAAsB;AACtB,yBAAuB;AACvB,mBAAyC;AACzC,mBAAyD;AAEzD,uCAAkC;AAClC,mDAA8C;AAC9C,mCAIO;AACP,8BAA+B;AAuExB;AAhEP,IAAM,yBAAyB,EAAE,QAAQ,wBAAwB;AAEjE,IAAM,4BAA4B;AAElC,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AA2C/C,SAAS,mBAAoB,EAAE,KAAK,GAA2B;AAC9D,QAAM,uBAAmB,2BAAY,KAAK,OAAQ;AAClD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAM;AAAA,MACN,YAAW;AAAA,MACX,WAAQ,gBAAI,SAAU;AAAA,MACtB,MAAO;AAAA,MACP,mBAAiB;AAAA,MACjB,WAAU;AAAA,MACV,gBAAe;AAAA,MACf,iBAAgB;A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L;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW,CAAC,CAAE;AAAA,MACd;AAAA,MACA,UAAW;AAAA,MACX,QAAS;AAAA;AAAA,EACV;AAOD,MAAI;AACJ,MAAK,iBAAiB,QAAS;AAG9B,oBACC,4EACG;AAAA;AAAA,MACA;AAAA,OACH;AAAA,EAEF,OAAO;AAEN,oBACC,4EACG;AAAA;AAAA,MACF,6CAAC,SAAI,WAAU,kCACZ;AAAA;AAAA,QACA;AAAA,SACH;AAAA,OACD;AAAA,EAEF;AAEA,SAAO,YAAa;AAAA,IACnB;AAAA,IACA,eACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAW;AAAA;AAAA,IACZ;AAAA,IAED;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,2BAA2B,CAAE,cAAc,CAAE;AAAA,IAC7C;AAAA,IACA;AAAA,IACA,UAAU,CAAC,CAAE;AAAA,EACd,CAAE;AACH;AAEO,SAAS,YAAa,OAA0B;AACtD,SACC,4CAAC,yCACA,sDAAC,sBAAqB,GAAG,OAAQ,KADF,MAAM,EAEtC;AAEF;AAEA,IAAO,uBAAQ;",
6
+ "names": ["componentsPrivateApis", "MediaEditorKeyboardShortcutsModal", "coreStore", "noticesStore", "MediaForm", "MediaEditorCropPanel", "MediaEditorFineRotation", "MediaEditorCanvas", "MediaPreview", "ConfirmDialog", "MediaEditorImageControls"]
7
7
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // packages/media-editor/src/components/media-editor-crop-panel/index.tsx
@@ -26,35 +36,20 @@ module.exports = __toCommonJS(media_editor_crop_panel_exports);
26
36
  var import_components = require("@wordpress/components");
27
37
  var import_ui = require("@wordpress/ui");
28
38
  var import_i18n = require("@wordpress/i18n");
29
- var import_state = require("../../state/index.cjs");
30
39
  var import_use_crop_gesture_handlers = require("../../hooks/use-crop-gesture-handlers.cjs");
31
- var import_constants = require("../../image-editor/core/constants.cjs");
32
- var import_containment = require("../../image-editor/core/containment.cjs");
40
+ var import_media_editor_image_controls = __toESM(require("../media-editor-image-controls/index.cjs"));
33
41
  var import_jsx_runtime = (
34
42
  // Tag the whole panel as a crop-control region so the modal's
35
43
  // Cmd+Z handler doesn't mistake the SelectControl input for a
36
44
  // metadata field (which would suppress undo).
37
45
  require("react/jsx-runtime")
38
46
  );
39
- var ZOOM_PERCENTAGE_SCALE = 100;
40
- var MAX_ZOOM_PERCENTAGE = import_constants.MAX_ZOOM * ZOOM_PERCENTAGE_SCALE;
41
- function getZoomPercentageForDisplay(zoom) {
42
- return Math.round(zoom * ZOOM_PERCENTAGE_SCALE);
43
- }
44
- function getMinZoomPercentageForDisplay(zoom) {
45
- return Math.ceil(zoom * ZOOM_PERCENTAGE_SCALE);
46
- }
47
47
  function MediaEditorCropPanel({
48
48
  aspectRatioValue,
49
49
  onAspectRatioChange,
50
- onPlacementControlInteraction,
51
- aspectRatioOptions
50
+ aspectRatioOptions,
51
+ showTransformControls = false
52
52
  }) {
53
- const { state, setZoom } = (0, import_state.useMediaEditor)();
54
- const zoomGestureHandlers = (0, import_use_crop_gesture_handlers.useCropGestureHandlers)();
55
- const minZoom = (0, import_containment.getMinZoom)(state);
56
- const zoomPercentage = getZoomPercentageForDisplay(state.zoom);
57
- const minZoomPercentage = getMinZoomPercentageForDisplay(minZoom);
58
53
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
59
54
  import_ui.Stack,
60
55
  {
@@ -63,6 +58,7 @@ function MediaEditorCropPanel({
63
58
  ...{ [import_use_crop_gesture_handlers.CROP_CONTROL_ATTR]: true },
64
59
  children: [
65
60
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {}), children: (0, import_i18n.__)("Crop options") }),
61
+ showTransformControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor_image_controls.default, { withLabels: true }),
66
62
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
63
  import_components.SelectControl,
68
64
  {
@@ -75,33 +71,7 @@ function MediaEditorCropPanel({
75
71
  value: preset.value.toString()
76
72
  }))
77
73
  }
78
- ),
79
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { role: "presentation", ...zoomGestureHandlers, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
- import_components.RangeControl,
81
- {
82
- __next40pxDefaultSize: true,
83
- label: (0, import_i18n.__)("Zoom (%)"),
84
- min: minZoomPercentage,
85
- max: MAX_ZOOM_PERCENTAGE,
86
- step: 1,
87
- shiftStep: 10,
88
- value: zoomPercentage,
89
- onChange: (value) => {
90
- onPlacementControlInteraction?.();
91
- setZoom(
92
- typeof value === "number" ? value / ZOOM_PERCENTAGE_SCALE : minZoom
93
- );
94
- },
95
- renderTooltipContent: (value) => {
96
- const percentage = typeof value === "number" ? value : minZoomPercentage;
97
- return (0, import_i18n.sprintf)(
98
- /* translators: %d: zoom level as a percentage. */
99
- (0, import_i18n.__)("%d%%"),
100
- Math.round(percentage)
101
- );
102
- }
103
- }
104
- ) })
74
+ )
105
75
  ]
106
76
  }
107
77
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/media-editor-crop-panel/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RangeControl, SelectControl } from '@wordpress/components';\nimport { Stack, VisuallyHidden } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useMediaEditor } from '../../state';\nimport {\n\tuseCropGestureHandlers,\n\tCROP_CONTROL_ATTR,\n} from '../../hooks/use-crop-gesture-handlers';\nimport { MAX_ZOOM } from '../../image-editor/core/constants';\nimport { getMinZoom } from '../../image-editor/core/containment';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\n\nconst ZOOM_PERCENTAGE_SCALE = 100;\nconst MAX_ZOOM_PERCENTAGE = MAX_ZOOM * ZOOM_PERCENTAGE_SCALE;\n\nfunction getZoomPercentageForDisplay( zoom: number ): number {\n\treturn Math.round( zoom * ZOOM_PERCENTAGE_SCALE );\n}\n\nfunction getMinZoomPercentageForDisplay( zoom: number ): number {\n\treturn Math.ceil( zoom * ZOOM_PERCENTAGE_SCALE );\n}\n\nexport interface MediaEditorCropPanelProps {\n\t/**\n\t * Selected aspect-ratio preset value as a string (so it round-trips\n\t * through `<SelectControl>`). `'0'` = free, `'-1'` = original, any\n\t * positive number = fixed ratio.\n\t */\n\taspectRatioValue: string;\n\t/** Setter for the aspect-ratio preset value. */\n\tonAspectRatioChange: ( value: string ) => void;\n\t/** Signal that a placement-oriented control is being adjusted. */\n\tonPlacementControlInteraction?: () => void;\n\t/** Aspect-ratio presets to display in the selector. */\n\taspectRatioOptions: AspectRatioPreset[];\n}\n\n/**\n * Sidebar panel for crop-shape controls. The tactile verbs (rotate, flip)\n * live in the bottom toolbar instead.\n * @param props\n * @param props.aspectRatioValue\n * @param props.onAspectRatioChange\n * @param props.onPlacementControlInteraction\n * @param props.aspectRatioOptions\n */\nexport default function MediaEditorCropPanel( {\n\taspectRatioValue,\n\tonAspectRatioChange,\n\tonPlacementControlInteraction,\n\taspectRatioOptions,\n}: MediaEditorCropPanelProps ) {\n\tconst { state, setZoom } = useMediaEditor();\n\tconst zoomGestureHandlers = useCropGestureHandlers();\n\tconst minZoom = getMinZoom( state );\n\tconst zoomPercentage = getZoomPercentageForDisplay( state.zoom );\n\tconst minZoomPercentage = getMinZoomPercentageForDisplay( minZoom );\n\n\treturn (\n\t\t// Tag the whole panel as a crop-control region so the modal's\n\t\t// Cmd+Z handler doesn't mistake the SelectControl input for a\n\t\t// metadata field (which would suppress undo).\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"xl\"\n\t\t\t{ ...{ [ CROP_CONTROL_ATTR ]: true } }\n\t\t>\n\t\t\t<VisuallyHidden render={ <h2 /> }>\n\t\t\t\t{ __( 'Crop options' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tvalue={ aspectRatioValue }\n\t\t\t\tonChange={ onAspectRatioChange }\n\t\t\t\toptions={ aspectRatioOptions.map( ( preset ) => ( {\n\t\t\t\t\tlabel: preset.label,\n\t\t\t\t\tvalue: preset.value.toString(),\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t\t<div role=\"presentation\" { ...zoomGestureHandlers }>\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Zoom (%)' ) }\n\t\t\t\t\tmin={ minZoomPercentage }\n\t\t\t\t\tmax={ MAX_ZOOM_PERCENTAGE }\n\t\t\t\t\tstep={ 1 }\n\t\t\t\t\tshiftStep={ 10 }\n\t\t\t\t\tvalue={ zoomPercentage }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonPlacementControlInteraction?.();\n\t\t\t\t\t\tsetZoom(\n\t\t\t\t\t\t\ttypeof value === 'number'\n\t\t\t\t\t\t\t\t? value / ZOOM_PERCENTAGE_SCALE\n\t\t\t\t\t\t\t\t: minZoom\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\trenderTooltipContent={ ( value ) => {\n\t\t\t\t\t\tconst percentage =\n\t\t\t\t\t\t\ttypeof value === 'number'\n\t\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t\t: minZoomPercentage;\n\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t/* translators: %d: zoom level as a percentage. */\n\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\tMath.round( percentage )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Stack>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4C;AAC5C,gBAAsC;AACtC,kBAA4B;AAK5B,mBAA+B;AAC/B,uCAGO;AACP,uBAAyB;AACzB,yBAA2B;AAsDzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAnDF,IAAM,wBAAwB;AAC9B,IAAM,sBAAsB,4BAAW;AAEvC,SAAS,4BAA6B,MAAuB;AAC5D,SAAO,KAAK,MAAO,OAAO,qBAAsB;AACjD;AAEA,SAAS,+BAAgC,MAAuB;AAC/D,SAAO,KAAK,KAAM,OAAO,qBAAsB;AAChD;AA0Be,SAAR,qBAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAA+B;AAC9B,QAAM,EAAE,OAAO,QAAQ,QAAI,6BAAe;AAC1C,QAAM,0BAAsB,yDAAuB;AACnD,QAAM,cAAU,+BAAY,KAAM;AAClC,QAAM,iBAAiB,4BAA6B,MAAM,IAAK;AAC/D,QAAM,oBAAoB,+BAAgC,OAAQ;AAElE,SAIC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,KAAI;AAAA,MACF,GAAG,EAAE,CAAE,kDAAkB,GAAG,KAAK;AAAA,MAEnC;AAAA,oDAAC,4BAAe,QAAS,4CAAC,QAAG,GAC1B,8BAAI,cAAe,GACtB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,WAAQ,gBAAI,cAAe;AAAA,YAC3B,OAAQ;AAAA,YACR,UAAW;AAAA,YACX,SAAU,mBAAmB,IAAK,CAAE,YAAc;AAAA,cACjD,OAAO,OAAO;AAAA,cACd,OAAO,OAAO,MAAM,SAAS;AAAA,YAC9B,EAAI;AAAA;AAAA,QACL;AAAA,QACA,4CAAC,SAAI,MAAK,gBAAiB,GAAG,qBAC7B;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,WAAQ,gBAAI,UAAW;AAAA,YACvB,KAAM;AAAA,YACN,KAAM;AAAA,YACN,MAAO;AAAA,YACP,WAAY;AAAA,YACZ,OAAQ;AAAA,YACR,UAAW,CAAE,UAAW;AACvB,8CAAgC;AAChC;AAAA,gBACC,OAAO,UAAU,WACd,QAAQ,wBACR;AAAA,cACJ;AAAA,YACD;AAAA,YACA,sBAAuB,CAAE,UAAW;AACnC,oBAAM,aACL,OAAO,UAAU,WACd,QACA;AACJ,yBAAO;AAAA;AAAA,oBAEN,gBAAI,MAAO;AAAA,gBACX,KAAK,MAAO,UAAW;AAAA,cACxB;AAAA,YACD;AAAA;AAAA,QACD,GACD;AAAA;AAAA;AAAA,EACD;AAEF;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { Stack, VisuallyHidden } from '@wordpress/ui';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { CROP_CONTROL_ATTR } from '../../hooks/use-crop-gesture-handlers';\nimport MediaEditorImageControls from '../media-editor-image-controls';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\n\nexport interface MediaEditorCropPanelProps {\n\t/**\n\t * Selected aspect-ratio preset value as a string (so it round-trips\n\t * through `<SelectControl>`). `'0'` = free, `'-1'` = original, any\n\t * positive number = fixed ratio.\n\t */\n\taspectRatioValue: string;\n\t/** Setter for the aspect-ratio preset value. */\n\tonAspectRatioChange: ( value: string ) => void;\n\t/** Aspect-ratio presets to display in the selector. */\n\taspectRatioOptions: AspectRatioPreset[];\n\t/**\n\t * When `true`, render the rotate/flip/zoom image controls at the top of\n\t * the panel. Used on wide viewports where the footer no longer carries\n\t * them.\n\t */\n\tshowTransformControls?: boolean;\n}\n\n/**\n * Sidebar panel for crop controls. Renders the aspect-ratio selector, plus the\n * rotate/flip and zoom controls on wide viewports (these move to the footer\n * toolbar when the sidebar collapses).\n * @param props\n * @param props.aspectRatioValue\n * @param props.onAspectRatioChange\n * @param props.aspectRatioOptions\n * @param props.showTransformControls\n */\nexport default function MediaEditorCropPanel( {\n\taspectRatioValue,\n\tonAspectRatioChange,\n\taspectRatioOptions,\n\tshowTransformControls = false,\n}: MediaEditorCropPanelProps ) {\n\treturn (\n\t\t// Tag the whole panel as a crop-control region so the modal's\n\t\t// Cmd+Z handler doesn't mistake the SelectControl input for a\n\t\t// metadata field (which would suppress undo).\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"xl\"\n\t\t\t{ ...{ [ CROP_CONTROL_ATTR ]: true } }\n\t\t>\n\t\t\t<VisuallyHidden render={ <h2 /> }>\n\t\t\t\t{ __( 'Crop options' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ showTransformControls && <MediaEditorImageControls withLabels /> }\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tvalue={ aspectRatioValue }\n\t\t\t\tonChange={ onAspectRatioChange }\n\t\t\t\toptions={ aspectRatioOptions.map( ( preset ) => ( {\n\t\t\t\t\tlabel: preset.label,\n\t\t\t\t\tvalue: preset.value.toString(),\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,gBAAsC;AACtC,kBAAmB;AAKnB,uCAAkC;AAClC,yCAAqC;AA0CnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAVa,SAAR,qBAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AACzB,GAA+B;AAC9B,SAIC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,KAAI;AAAA,MACF,GAAG,EAAE,CAAE,kDAAkB,GAAG,KAAK;AAAA,MAEnC;AAAA,oDAAC,4BAAe,QAAS,4CAAC,QAAG,GAC1B,8BAAI,cAAe,GACtB;AAAA,QACE,yBAAyB,4CAAC,mCAAAA,SAAA,EAAyB,YAAU,MAAC;AAAA,QAChE;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,WAAQ,gBAAI,cAAe;AAAA,YAC3B,OAAQ;AAAA,YACR,UAAW;AAAA,YACX,SAAU,mBAAmB,IAAK,CAAE,YAAc;AAAA,cACjD,OAAO,OAAO;AAAA,cACd,OAAO,OAAO,MAAM,SAAS;AAAA,YAC9B,EAAI;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACD;AAEF;",
6
+ "names": ["MediaEditorImageControls"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/media-editor-fine-rotation/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useMediaEditor } from '../../state';\nimport { useCropGestureHandlers } from '../../hooks/use-crop-gesture-handlers';\nimport { MAX_ROTATION_OFFSET } from '../../image-editor/core/constants';\nimport RotationRuler from '../rotation-ruler';\n\nexport interface MediaEditorFineRotationProps {\n\t/** Signal that a placement-oriented control is being adjusted. */\n\tonPlacementControlInteraction?: () => void;\n}\n\n/**\n * Fine-rotation slider for the media-editor footer. Lives separately from\n * the snap-rotate / flip buttons so the footer can place the two halves on\n * different rows at intermediate viewport widths.\n *\n * @param props\n * @param props.onPlacementControlInteraction\n */\nexport default function MediaEditorFineRotation( {\n\tonPlacementControlInteraction,\n}: MediaEditorFineRotationProps ) {\n\tconst { state, setRotation } = useMediaEditor();\n\t// `commitOnKeyUp: false` lets rapid arrow-key adjustments coalesce\n\t// into one undo entry via the gesture idle window. Pointer-up still\n\t// closes pointer drags immediately.\n\tconst rotationGestureHandlers = useCropGestureHandlers( {\n\t\tcommitOnKeyUp: false,\n\t} );\n\n\t// `setRotation` is an absolute-angle setter. When a single flip is active\n\t// the visual direction inverts, so slider input must flip sign to match\n\t// what the user sees. `snapRotate90` already handles this internally.\n\tconst baseAngle = Math.round( state.rotation / 90 ) * 90;\n\tconst singleFlip = state.flip.horizontal !== state.flip.vertical;\n\tconst visualDir = singleFlip ? -1 : 1;\n\tconst fineOffset = ( state.rotation - baseAngle ) * visualDir;\n\n\tconst handleRotationSlider = ( value: number ) => {\n\t\t// Clamp strictly inside [-MAX, MAX). Exactly \u00B1MAX lands state on a\n\t\t// 90\u00B0 midpoint and flips the derived baseAngle on the next render,\n\t\t// causing subsequent events to spiral.\n\t\tconst EPS = 0.01;\n\t\tconst clamped = Math.max(\n\t\t\t-MAX_ROTATION_OFFSET + EPS,\n\t\t\tMath.min( MAX_ROTATION_OFFSET - EPS, value )\n\t\t);\n\t\tonPlacementControlInteraction?.();\n\t\tsetRotation( baseAngle + clamped * visualDir );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\trole=\"presentation\"\n\t\t\tclassName=\"media-editor-fine-rotation\"\n\t\t\t{ ...rotationGestureHandlers }\n\t\t>\n\t\t\t<RotationRuler\n\t\t\t\tlabel={ __( 'Fine rotation' ) }\n\t\t\t\tmin={ -MAX_ROTATION_OFFSET }\n\t\t\t\tmax={ MAX_ROTATION_OFFSET }\n\t\t\t\tvalue={ fineOffset }\n\t\t\t\tonChange={ handleRotationSlider }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,mBAA+B;AAC/B,uCAAuC;AACvC,uBAAoC;AACpC,4BAA0B;AAqDvB;AAtCY,SAAR,wBAA0C;AAAA,EAChD;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,YAAY,QAAI,6BAAe;AAI9C,QAAM,8BAA0B,yDAAwB;AAAA,IACvD,eAAe;AAAA,EAChB,CAAE;AAKF,QAAM,YAAY,KAAK,MAAO,MAAM,WAAW,EAAG,IAAI;AACtD,QAAM,aAAa,MAAM,KAAK,eAAe,MAAM,KAAK;AACxD,QAAM,YAAY,aAAa,KAAK;AACpC,QAAM,cAAe,MAAM,WAAW,aAAc;AAEpD,QAAM,uBAAuB,CAAE,UAAmB;AAIjD,UAAM,MAAM;AACZ,UAAM,UAAU,KAAK;AAAA,MACpB,CAAC,uCAAsB;AAAA,MACvB,KAAK,IAAK,uCAAsB,KAAK,KAAM;AAAA,IAC5C;AACA,oCAAgC;AAChC,gBAAa,YAAY,UAAU,SAAU;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACR,GAAG;AAAA,MAEL;AAAA,QAAC,sBAAAA;AAAA,QAAA;AAAA,UACA,WAAQ,gBAAI,eAAgB;AAAA,UAC5B,KAAM,CAAC;AAAA,UACP,KAAM;AAAA,UACN,OAAQ;AAAA,UACR,UAAW;AAAA;AAAA,MACZ;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useMediaEditor } from '../../state';\nimport { useCropGestureHandlers } from '../../hooks/use-crop-gesture-handlers';\nimport { MAX_ROTATION_OFFSET } from '../../image-editor/core/constants';\nimport RotationRuler from '../rotation-ruler';\n\nexport interface MediaEditorFineRotationProps {\n\t/** Signal that a placement-oriented control is being adjusted. */\n\tonPlacementControlInteraction?: () => void;\n}\n\n/**\n * Fine-rotation slider for the media editor. It renders under the canvas so it\n * stays constrained to the canvas column at all viewport sizes. Lives\n * separately from the snap-rotate / flip buttons so the two can be placed\n * independently per viewport.\n *\n * @param props\n * @param props.onPlacementControlInteraction\n */\nexport default function MediaEditorFineRotation( {\n\tonPlacementControlInteraction,\n}: MediaEditorFineRotationProps ) {\n\tconst { state, setRotation } = useMediaEditor();\n\t// `commitOnKeyUp: false` lets rapid arrow-key adjustments coalesce\n\t// into one undo entry via the gesture idle window. Pointer-up still\n\t// closes pointer drags immediately.\n\tconst rotationGestureHandlers = useCropGestureHandlers( {\n\t\tcommitOnKeyUp: false,\n\t} );\n\n\t// `setRotation` is an absolute-angle setter. When a single flip is active\n\t// the visual direction inverts, so slider input must flip sign to match\n\t// what the user sees. `snapRotate90` already handles this internally.\n\tconst baseAngle = Math.round( state.rotation / 90 ) * 90;\n\tconst singleFlip = state.flip.horizontal !== state.flip.vertical;\n\tconst visualDir = singleFlip ? -1 : 1;\n\tconst fineOffset = ( state.rotation - baseAngle ) * visualDir;\n\n\tconst handleRotationSlider = ( value: number ) => {\n\t\t// Clamp strictly inside [-MAX, MAX). Exactly \u00B1MAX lands state on a\n\t\t// 90\u00B0 midpoint and flips the derived baseAngle on the next render,\n\t\t// causing subsequent events to spiral.\n\t\tconst EPS = 0.01;\n\t\tconst clamped = Math.max(\n\t\t\t-MAX_ROTATION_OFFSET + EPS,\n\t\t\tMath.min( MAX_ROTATION_OFFSET - EPS, value )\n\t\t);\n\t\tonPlacementControlInteraction?.();\n\t\tsetRotation( baseAngle + clamped * visualDir );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\trole=\"presentation\"\n\t\t\tclassName=\"media-editor-fine-rotation\"\n\t\t\t{ ...rotationGestureHandlers }\n\t\t>\n\t\t\t<RotationRuler\n\t\t\t\tlabel={ __( 'Fine rotation' ) }\n\t\t\t\tmin={ -MAX_ROTATION_OFFSET }\n\t\t\t\tmax={ MAX_ROTATION_OFFSET }\n\t\t\t\tvalue={ fineOffset }\n\t\t\t\tonChange={ handleRotationSlider }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,mBAA+B;AAC/B,uCAAuC;AACvC,uBAAoC;AACpC,4BAA0B;AAsDvB;AAtCY,SAAR,wBAA0C;AAAA,EAChD;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,YAAY,QAAI,6BAAe;AAI9C,QAAM,8BAA0B,yDAAwB;AAAA,IACvD,eAAe;AAAA,EAChB,CAAE;AAKF,QAAM,YAAY,KAAK,MAAO,MAAM,WAAW,EAAG,IAAI;AACtD,QAAM,aAAa,MAAM,KAAK,eAAe,MAAM,KAAK;AACxD,QAAM,YAAY,aAAa,KAAK;AACpC,QAAM,cAAe,MAAM,WAAW,aAAc;AAEpD,QAAM,uBAAuB,CAAE,UAAmB;AAIjD,UAAM,MAAM;AACZ,UAAM,UAAU,KAAK;AAAA,MACpB,CAAC,uCAAsB;AAAA,MACvB,KAAK,IAAK,uCAAsB,KAAK,KAAM;AAAA,IAC5C;AACA,oCAAgC;AAChC,gBAAa,YAAY,UAAU,SAAU;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACR,GAAG;AAAA,MAEL;AAAA,QAAC,sBAAAA;AAAA,QAAA;AAAA,UACA,WAAQ,gBAAI,eAAgB;AAAA,UAC5B,KAAM,CAAC;AAAA,UACP,KAAM;AAAA,UACN,OAAQ;AAAA,UACR,UAAW;AAAA;AAAA,MACZ;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": ["RotationRuler"]
7
7
  }