@wordpress/block-editor 15.21.1 → 15.22.1-next.v.202606191442.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.
Files changed (186) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-card/index.cjs +4 -5
  3. package/build/components/block-card/index.cjs.map +2 -2
  4. package/build/components/block-inspector/index.cjs +3 -4
  5. package/build/components/block-inspector/index.cjs.map +2 -2
  6. package/build/components/block-mover/mover-description.cjs +6 -6
  7. package/build/components/block-mover/mover-description.cjs.map +1 -1
  8. package/build/components/block-patterns-list/index.cjs.map +2 -2
  9. package/build/components/block-patterns-paging/index.cjs +4 -4
  10. package/build/components/block-patterns-paging/index.cjs.map +2 -2
  11. package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
  12. package/build/components/block-quick-navigation/index.cjs +7 -5
  13. package/build/components/block-quick-navigation/index.cjs.map +2 -2
  14. package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
  15. package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
  16. package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
  17. package/build/components/child-layout-control/index.cjs +51 -19
  18. package/build/components/child-layout-control/index.cjs.map +2 -2
  19. package/build/components/dimensions-tool/index.cjs +4 -5
  20. package/build/components/dimensions-tool/index.cjs.map +2 -2
  21. package/build/components/dimensions-tool/scale-tool.cjs +1 -1
  22. package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
  23. package/build/components/global-styles/dimensions-panel.cjs +1 -1
  24. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  25. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  26. package/build/components/grid/grid-item-resizer.cjs.map +1 -1
  27. package/build/components/grid/grid-visualizer.cjs.map +1 -1
  28. package/build/components/iframe/index.cjs +6 -3
  29. package/build/components/iframe/index.cjs.map +3 -3
  30. package/build/components/image-editor/use-transform-image.cjs.map +1 -1
  31. package/build/components/inserter/get-appender-label.cjs.map +1 -1
  32. package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
  33. package/build/components/inserter/search-items.cjs.map +1 -1
  34. package/build/components/inspector-controls/fill.cjs +1 -3
  35. package/build/components/inspector-controls/fill.cjs.map +2 -2
  36. package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
  37. package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
  38. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  39. package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
  40. package/build/components/line-height-control/index.cjs.map +1 -1
  41. package/build/components/link-control/index.cjs +1 -1
  42. package/build/components/link-control/index.cjs.map +1 -1
  43. package/build/components/link-control/normalize-url.cjs.map +1 -1
  44. package/build/components/list-view/block-select-button.cjs.map +2 -2
  45. package/build/components/list-view/utils.cjs.map +1 -1
  46. package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
  47. package/build/components/provider/index.cjs.map +1 -1
  48. package/build/components/provider/use-block-sync.cjs.map +1 -1
  49. package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
  50. package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
  51. package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
  52. package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
  53. package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
  54. package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
  55. package/build/hooks/anchor.cjs +1 -1
  56. package/build/hooks/anchor.cjs.map +1 -1
  57. package/build/hooks/background.cjs.map +1 -1
  58. package/build/hooks/block-fields/index.cjs +13 -2
  59. package/build/hooks/block-fields/index.cjs.map +2 -2
  60. package/build/hooks/dimensions.cjs +13 -2
  61. package/build/hooks/dimensions.cjs.map +2 -2
  62. package/build/hooks/layout-child.cjs +27 -2
  63. package/build/hooks/layout-child.cjs.map +2 -2
  64. package/build/hooks/list-view.cjs +10 -7
  65. package/build/hooks/list-view.cjs.map +2 -2
  66. package/build/hooks/spacing-visualizer.cjs.map +1 -1
  67. package/build/hooks/state-utils.cjs.map +1 -1
  68. package/build/hooks/style.cjs +42 -2
  69. package/build/hooks/style.cjs.map +2 -2
  70. package/build/private-apis.cjs +4 -0
  71. package/build/private-apis.cjs.map +2 -2
  72. package/build/store/actions.cjs.map +1 -1
  73. package/build/store/private-selectors.cjs +19 -2
  74. package/build/store/private-selectors.cjs.map +2 -2
  75. package/build/store/reducer.cjs.map +1 -1
  76. package/build/store/selectors.cjs.map +1 -1
  77. package/build/utils/dom.cjs.map +1 -1
  78. package/build/utils/selection.cjs +1 -1
  79. package/build-module/components/block-card/index.mjs +5 -6
  80. package/build-module/components/block-card/index.mjs.map +2 -2
  81. package/build-module/components/block-inspector/index.mjs +3 -5
  82. package/build-module/components/block-inspector/index.mjs.map +2 -2
  83. package/build-module/components/block-mover/mover-description.mjs +6 -6
  84. package/build-module/components/block-mover/mover-description.mjs.map +1 -1
  85. package/build-module/components/block-patterns-list/index.mjs.map +2 -2
  86. package/build-module/components/block-patterns-paging/index.mjs +4 -4
  87. package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
  88. package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
  89. package/build-module/components/block-quick-navigation/index.mjs +8 -6
  90. package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
  91. package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
  92. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
  93. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
  94. package/build-module/components/child-layout-control/index.mjs +51 -19
  95. package/build-module/components/child-layout-control/index.mjs.map +2 -2
  96. package/build-module/components/dimensions-tool/index.mjs +4 -5
  97. package/build-module/components/dimensions-tool/index.mjs.map +2 -2
  98. package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
  99. package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
  100. package/build-module/components/global-styles/dimensions-panel.mjs +1 -2
  101. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  102. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  103. package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
  104. package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
  105. package/build-module/components/iframe/index.mjs +6 -3
  106. package/build-module/components/iframe/index.mjs.map +2 -2
  107. package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
  108. package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
  109. package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
  110. package/build-module/components/inserter/search-items.mjs.map +1 -1
  111. package/build-module/components/inspector-controls/fill.mjs +1 -3
  112. package/build-module/components/inspector-controls/fill.mjs.map +2 -2
  113. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  114. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
  115. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  116. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
  117. package/build-module/components/line-height-control/index.mjs.map +1 -1
  118. package/build-module/components/link-control/index.mjs +1 -1
  119. package/build-module/components/link-control/index.mjs.map +1 -1
  120. package/build-module/components/link-control/normalize-url.mjs.map +1 -1
  121. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  122. package/build-module/components/list-view/utils.mjs.map +1 -1
  123. package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
  124. package/build-module/components/provider/index.mjs.map +1 -1
  125. package/build-module/components/provider/use-block-sync.mjs.map +1 -1
  126. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
  127. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
  128. package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
  129. package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
  130. package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
  131. package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
  132. package/build-module/hooks/anchor.mjs +1 -1
  133. package/build-module/hooks/anchor.mjs.map +1 -1
  134. package/build-module/hooks/background.mjs.map +1 -1
  135. package/build-module/hooks/block-fields/index.mjs +13 -2
  136. package/build-module/hooks/block-fields/index.mjs.map +2 -2
  137. package/build-module/hooks/dimensions.mjs +12 -2
  138. package/build-module/hooks/dimensions.mjs.map +2 -2
  139. package/build-module/hooks/layout-child.mjs +27 -2
  140. package/build-module/hooks/layout-child.mjs.map +2 -2
  141. package/build-module/hooks/list-view.mjs +10 -7
  142. package/build-module/hooks/list-view.mjs.map +2 -2
  143. package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
  144. package/build-module/hooks/state-utils.mjs.map +1 -1
  145. package/build-module/hooks/style.mjs +44 -3
  146. package/build-module/hooks/style.mjs.map +2 -2
  147. package/build-module/private-apis.mjs +8 -0
  148. package/build-module/private-apis.mjs.map +2 -2
  149. package/build-module/store/actions.mjs.map +1 -1
  150. package/build-module/store/private-selectors.mjs +18 -1
  151. package/build-module/store/private-selectors.mjs.map +2 -2
  152. package/build-module/store/reducer.mjs.map +1 -1
  153. package/build-module/store/selectors.mjs.map +1 -1
  154. package/build-module/utils/dom.mjs.map +1 -1
  155. package/build-module/utils/selection.mjs +1 -1
  156. package/package.json +45 -40
  157. package/src/components/block-card/index.js +7 -13
  158. package/src/components/block-inspector/index.js +2 -10
  159. package/src/components/block-patterns-list/index.js +0 -1
  160. package/src/components/block-quick-navigation/index.js +7 -7
  161. package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
  162. package/src/components/child-layout-control/index.js +65 -20
  163. package/src/components/child-layout-control/test/index.js +64 -0
  164. package/src/components/dimensions-tool/index.js +4 -9
  165. package/src/components/dimensions-tool/scale-tool.js +1 -2
  166. package/src/components/dimensions-tool/test/index.js +89 -11
  167. package/src/components/global-styles/dimensions-panel.js +1 -2
  168. package/src/components/global-styles/shadow-panel-components.js +0 -1
  169. package/src/components/iframe/index.js +8 -3
  170. package/src/components/inserter/media-tab/media-preview.js +0 -1
  171. package/src/components/inspector-controls/fill.js +6 -8
  172. package/src/components/inspector-controls-tabs/index.js +0 -1
  173. package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
  174. package/src/components/list-view/block-select-button.js +0 -1
  175. package/src/components/preset-input-control/custom-value-controls.js +0 -1
  176. package/src/hooks/block-fields/index.js +27 -2
  177. package/src/hooks/dimensions.js +14 -3
  178. package/src/hooks/layout-child.js +41 -2
  179. package/src/hooks/list-view.js +10 -11
  180. package/src/hooks/style.js +80 -2
  181. package/src/hooks/test/dimensions.js +71 -0
  182. package/src/hooks/test/layout-child.js +165 -0
  183. package/src/hooks/test/style.js +126 -4
  184. package/src/private-apis.js +8 -0
  185. package/src/store/private-selectors.js +47 -0
  186. package/src/store/test/private-selectors.js +138 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/inserter/media-tab/media-preview.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tSpinner,\n\tModal,\n\tFlex,\n\tFlexItem,\n\tButton,\n\tComposite,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { moreVertical, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isBlobURL } from '@wordpress/blob';\nimport { getFilename } from '@wordpress/url';\n\n// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport InserterDraggableBlocks from '../../inserter-draggable-blocks';\nimport { getBlockAndPreviewFromMedia } from './utils';\nimport { store as blockEditorStore } from '../../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst MEDIA_OPTIONS_POPOVER_PROPS = {\n\tplacement: 'bottom-end',\n\tclassName:\n\t\t'block-editor-inserter__media-list__item-preview-options__popover',\n};\n\nfunction MediaPreviewOptions( { category, media } ) {\n\tif ( ! category.getReportUrl ) {\n\t\treturn null;\n\t}\n\tconst reportUrl = category.getReportUrl( media );\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-inserter__media-list__item-preview-options\"\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ MEDIA_OPTIONS_POPOVER_PROPS }\n\t\t\ticon={ moreVertical }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\twindow.open( reportUrl, '_blank' ).focus()\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The media type to report e.g: \"image\", \"video\", \"audio\" */\n\t\t\t\t\t\t\t__( 'Report %s' ),\n\t\t\t\t\t\t\tcategory.mediaType\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction InsertExternalImageModal( { onClose, onSubmit } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Insert external image' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tclassName=\"block-editor-inserter-media-tab-media-preview-inserter-external-image-modal\"\n\t\t>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</VStack>\n\t\t\t<Flex\n\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ onSubmit }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Insert' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport function MediaPreview( { media, onClick, category } ) {\n\tconst [ showExternalUploadModal, setShowExternalUploadModal ] =\n\t\tuseState( false );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ isInserting, setIsInserting ] = useState( false );\n\tconst [ block, preview ] = useMemo(\n\t\t() => getBlockAndPreviewFromMedia( media, category.mediaType ),\n\t\t[ media, category.mediaType ]\n\t);\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { getSettings, getBlock } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onMediaInsert = useCallback(\n\t\t( previewBlock ) => {\n\t\t\t// Prevent multiple uploads when we're in the process of inserting.\n\t\t\tif ( isInserting ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst settings = getSettings();\n\t\t\tconst clonedBlock = cloneBlock( previewBlock );\n\t\t\tconst { id, url, caption } = clonedBlock.attributes;\n\n\t\t\t// User has no permission to upload media.\n\t\t\tif ( ! id && ! settings.mediaUpload ) {\n\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Media item already exists in library, so just insert it.\n\t\t\tif ( !! id ) {\n\t\t\t\tonClick( clonedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetIsInserting( true );\n\t\t\t// Media item does not exist in library, so try to upload it.\n\t\t\t// Fist fetch the image data. This may fail if the image host\n\t\t\t// doesn't allow CORS with the domain.\n\t\t\t// If this happens, we insert the image block using the external\n\t\t\t// URL and let the user know about the possible implications.\n\t\t\twindow\n\t\t\t\t.fetch( url )\n\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tconst fileName = getFilename( url ) || 'image.jpg';\n\t\t\t\t\tconst file = new File( [ blob ], fileName, {\n\t\t\t\t\t\ttype: blob.type,\n\t\t\t\t\t} );\n\n\t\t\t\t\tsettings.mediaUpload( {\n\t\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\t\tadditionalData: { caption },\n\t\t\t\t\t\tonFileChange( [ img ] ) {\n\t\t\t\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( ! getBlock( clonedBlock.clientId ) ) {\n\t\t\t\t\t\t\t\t// Ensure the block is only inserted once.\n\t\t\t\t\t\t\t\tonClick( {\n\t\t\t\t\t\t\t\t\t...clonedBlock,\n\t\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t__( 'Image uploaded and inserted.' ),\n\t\t\t\t\t\t\t\t\t{ type: 'snackbar', id: 'inserter-notice' }\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// For subsequent calls, update the existing block.\n\t\t\t\t\t\t\t\tupdateBlockAttributes( clonedBlock.clientId, {\n\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tcreateErrorNotice( message, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'inserter-notice',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tisInserting,\n\t\t\tgetSettings,\n\t\t\tonClick,\n\t\t\tcreateSuccessNotice,\n\t\t\tupdateBlockAttributes,\n\t\t\tcreateErrorNotice,\n\t\t\tgetBlock,\n\t\t]\n\t);\n\n\tconst title =\n\t\ttypeof media.title === 'string'\n\t\t\t? media.title\n\t\t\t: media.title?.rendered || __( 'no title' );\n\n\tconst onMouseEnter = useCallback( () => setIsHovered( true ), [] );\n\tconst onMouseLeave = useCallback( () => setIsHovered( false ), [] );\n\treturn (\n\t\t<>\n\t\t\t<InserterDraggableBlocks isEnabled blocks={ [ block ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-inserter__media-list__list-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Adding `is-hovered` class to the wrapper element is needed\n\t\t\t\t\t\tbecause the options Popover is rendered outside of this node. */ }\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip.Root>\n\t\t\t\t\t\t\t\t<Tooltip.Trigger\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__media-list__item\"\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\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tonMediaInsert( block )\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<div className=\"block-editor-inserter__media-list__item-preview\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t\t\t\t\t\t{ isInserting && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview-spinner\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\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</div>\n\t\t\t\t\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Tooltip.Popup>{ title }</Tooltip.Popup>\n\t\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t\t{ ! isInserting && (\n\t\t\t\t\t\t\t\t<MediaPreviewOptions\n\t\t\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\t\t\tmedia={ media }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</InserterDraggableBlocks>\n\t\t\t{ showExternalUploadModal && (\n\t\t\t\t<InsertExternalImageModal\n\t\t\t\t\tonClose={ () => setShowExternalUploadModal( false ) }\n\t\t\t\t\tonSubmit={ () => {\n\t\t\t\t\t\tonClick( cloneBlock( block ) );\n\t\t\t\t\t\tcreateSuccessNotice( __( 'Image inserted.' ), {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'inserter-notice',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetShowExternalUploadModal( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAWO;AACP,kBAA4B;AAC5B,qBAA+C;AAC/C,oBAA2B;AAC3B,mBAAuC;AACvC,kBAAuC;AACvC,qBAAsC;AACtC,kBAA0B;A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C;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tSpinner,\n\tModal,\n\tFlex,\n\tFlexItem,\n\tButton,\n\tComposite,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { moreVertical, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isBlobURL } from '@wordpress/blob';\nimport { getFilename } from '@wordpress/url';\n\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport InserterDraggableBlocks from '../../inserter-draggable-blocks';\nimport { getBlockAndPreviewFromMedia } from './utils';\nimport { store as blockEditorStore } from '../../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst MEDIA_OPTIONS_POPOVER_PROPS = {\n\tplacement: 'bottom-end',\n\tclassName:\n\t\t'block-editor-inserter__media-list__item-preview-options__popover',\n};\n\nfunction MediaPreviewOptions( { category, media } ) {\n\tif ( ! category.getReportUrl ) {\n\t\treturn null;\n\t}\n\tconst reportUrl = category.getReportUrl( media );\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-inserter__media-list__item-preview-options\"\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ MEDIA_OPTIONS_POPOVER_PROPS }\n\t\t\ticon={ moreVertical }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\twindow.open( reportUrl, '_blank' ).focus()\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The media type to report e.g: \"image\", \"video\", \"audio\" */\n\t\t\t\t\t\t\t__( 'Report %s' ),\n\t\t\t\t\t\t\tcategory.mediaType\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction InsertExternalImageModal( { onClose, onSubmit } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Insert external image' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tclassName=\"block-editor-inserter-media-tab-media-preview-inserter-external-image-modal\"\n\t\t>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</VStack>\n\t\t\t<Flex\n\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ onSubmit }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Insert' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport function MediaPreview( { media, onClick, category } ) {\n\tconst [ showExternalUploadModal, setShowExternalUploadModal ] =\n\t\tuseState( false );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ isInserting, setIsInserting ] = useState( false );\n\tconst [ block, preview ] = useMemo(\n\t\t() => getBlockAndPreviewFromMedia( media, category.mediaType ),\n\t\t[ media, category.mediaType ]\n\t);\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { getSettings, getBlock } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onMediaInsert = useCallback(\n\t\t( previewBlock ) => {\n\t\t\t// Prevent multiple uploads when we're in the process of inserting.\n\t\t\tif ( isInserting ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst settings = getSettings();\n\t\t\tconst clonedBlock = cloneBlock( previewBlock );\n\t\t\tconst { id, url, caption } = clonedBlock.attributes;\n\n\t\t\t// User has no permission to upload media.\n\t\t\tif ( ! id && ! settings.mediaUpload ) {\n\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Media item already exists in library, so just insert it.\n\t\t\tif ( !! id ) {\n\t\t\t\tonClick( clonedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetIsInserting( true );\n\t\t\t// Media item does not exist in library, so try to upload it.\n\t\t\t// Fist fetch the image data. This may fail if the image host\n\t\t\t// doesn't allow CORS with the domain.\n\t\t\t// If this happens, we insert the image block using the external\n\t\t\t// URL and let the user know about the possible implications.\n\t\t\twindow\n\t\t\t\t.fetch( url )\n\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tconst fileName = getFilename( url ) || 'image.jpg';\n\t\t\t\t\tconst file = new File( [ blob ], fileName, {\n\t\t\t\t\t\ttype: blob.type,\n\t\t\t\t\t} );\n\n\t\t\t\t\tsettings.mediaUpload( {\n\t\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\t\tadditionalData: { caption },\n\t\t\t\t\t\tonFileChange( [ img ] ) {\n\t\t\t\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( ! getBlock( clonedBlock.clientId ) ) {\n\t\t\t\t\t\t\t\t// Ensure the block is only inserted once.\n\t\t\t\t\t\t\t\tonClick( {\n\t\t\t\t\t\t\t\t\t...clonedBlock,\n\t\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t__( 'Image uploaded and inserted.' ),\n\t\t\t\t\t\t\t\t\t{ type: 'snackbar', id: 'inserter-notice' }\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// For subsequent calls, update the existing block.\n\t\t\t\t\t\t\t\tupdateBlockAttributes( clonedBlock.clientId, {\n\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tcreateErrorNotice( message, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'inserter-notice',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tisInserting,\n\t\t\tgetSettings,\n\t\t\tonClick,\n\t\t\tcreateSuccessNotice,\n\t\t\tupdateBlockAttributes,\n\t\t\tcreateErrorNotice,\n\t\t\tgetBlock,\n\t\t]\n\t);\n\n\tconst title =\n\t\ttypeof media.title === 'string'\n\t\t\t? media.title\n\t\t\t: media.title?.rendered || __( 'no title' );\n\n\tconst onMouseEnter = useCallback( () => setIsHovered( true ), [] );\n\tconst onMouseLeave = useCallback( () => setIsHovered( false ), [] );\n\treturn (\n\t\t<>\n\t\t\t<InserterDraggableBlocks isEnabled blocks={ [ block ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'block-editor-inserter__media-list__list-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Adding `is-hovered` class to the wrapper element is needed\n\t\t\t\t\t\tbecause the options Popover is rendered outside of this node. */ }\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip.Root>\n\t\t\t\t\t\t\t\t<Tooltip.Trigger\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__media-list__item\"\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\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tonMediaInsert( block )\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<div className=\"block-editor-inserter__media-list__item-preview\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t\t\t\t\t\t{ isInserting && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview-spinner\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\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</div>\n\t\t\t\t\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Tooltip.Popup>{ title }</Tooltip.Popup>\n\t\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t\t{ ! isInserting && (\n\t\t\t\t\t\t\t\t<MediaPreviewOptions\n\t\t\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\t\t\tmedia={ media }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</InserterDraggableBlocks>\n\t\t\t{ showExternalUploadModal && (\n\t\t\t\t<InsertExternalImageModal\n\t\t\t\t\tonClose={ () => setShowExternalUploadModal( false ) }\n\t\t\t\t\tonSubmit={ () => {\n\t\t\t\t\t\tonClick( cloneBlock( block ) );\n\t\t\t\t\t\tcreateSuccessNotice( __( 'Image inserted.' ), {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'inserter-notice',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetShowExternalUploadModal( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAWO;AACP,kBAA4B;AAC5B,qBAA+C;AAC/C,oBAA2B;AAC3B,mBAAuC;AACvC,kBAAuC;AACvC,qBAAsC;AACtC,kBAA0B;AAC1B,iBAA4B;AAE5B,gBAAwB;AAKxB,uCAAoC;AACpC,mBAA4C;AAC5C,mBAA0C;AAuBrC;AArBL,IAAM,sBAAsB,CAAE,OAAQ;AACtC,IAAM,8BAA8B;AAAA,EACnC,WAAW;AAAA,EACX,WACC;AACF;AAEA,SAAS,oBAAqB,EAAE,UAAU,MAAM,GAAI;AACnD,MAAK,CAAE,SAAS,cAAe;AAC9B,WAAO;AAAA,EACR;AACA,QAAM,YAAY,SAAS,aAAc,KAAM;AAC/C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,SAAU;AAAA,MACtB,cAAe;AAAA,MACf,MAAO;AAAA,MAEL,gBACD,4CAAC,+BACA;AAAA,QAAC;AAAA;AAAA,UACA,SAAU,MACT,OAAO,KAAM,WAAW,QAAS,EAAE,MAAM;AAAA,UAE1C,MAAO;AAAA,UAEL;AAAA;AAAA,gBAED,gBAAI,WAAY;AAAA,YAChB,SAAS;AAAA,UACV;AAAA;AAAA,MACD,GACD;AAAA;AAAA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,SAAI,WAAU,mDACZ;AAAA;AAAA,0BACA,eACD,4CAAC,SAAI,WAAU,2DACd,sDAAC,6BAAQ,GACV;AAAA,2BAEF;AAAA;AAAA,oBACD;AAAA;AAAA,gBAEF;AAAA,gBACA,4CAAC,kBAAQ,OAAR,EAAgB,iBAAO;AAAA,iBACzB;AAAA,cACE,CAAE,eACH;AAAA,gBAAC;AAAA;AAAA,kBACA;AAAA,kBACA;AAAA;AAAA,cACD;AAAA;AAAA;AAAA,QAEF;AAAA;AAAA,IACD,GAEF;AAAA,IACE,2BACD;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM,2BAA4B,KAAM;AAAA,QAClD,UAAW,MAAM;AAChB,sBAAS,0BAAY,KAAM,CAAE;AAC7B,kCAAqB,gBAAI,iBAAkB,GAAG;AAAA,YAC7C,MAAM;AAAA,YACN,IAAI;AAAA,UACL,CAAE;AACF,qCAA4B,KAAM;AAAA,QACnC;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
6
6
  "names": ["VStack", "noticesStore", "blockEditorStore", "InserterDraggableBlocks", "clsx"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inserter/search-items.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultGetCategory = ( item ) => item.category;\nconst defaultGetCollection = () => null;\n\n// Normalization regexes\nconst splitRegexp = [\n\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n];\nconst stripRegexp = /(\\p{C}|\\p{P}|\\p{S})+/giu; // Anything that's not a punctuation, symbol or control/format character.\n\n// Normalization cache\nconst extractedWords = new Map();\nconst normalizedStrings = new Map();\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nexport function extractWords( input = '' ) {\n\tif ( extractedWords.has( input ) ) {\n\t\treturn extractedWords.get( input );\n\t}\n\n\tconst result = noCase( input, {\n\t\tsplitRegexp,\n\t\tstripRegexp,\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n\n\textractedWords.set( input, result );\n\n\treturn result;\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nexport function normalizeString( input = '' ) {\n\tif ( normalizedStrings.has( input ) ) {\n\t\treturn normalizedStrings.get( input );\n\t}\n\n\t// Disregard diacritics.\n\t// Input: \"m\u00E9dia\"\n\tlet result = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tresult = result.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tresult = result.toLowerCase();\n\n\tnormalizedStrings.set( input, result );\n\n\treturn result;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeString( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\nexport const searchBlockItems = (\n\titems,\n\tcategories,\n\tcollections,\n\tsearchInput\n) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst config = {\n\t\tgetCategory: ( item ) =>\n\t\t\tcategories.find( ( { slug } ) => slug === item.category )?.title,\n\t\tgetCollection: ( item ) =>\n\t\t\tcollections[ item.name.split( '/' )[ 0 ] ]?.title,\n\t};\n\n\treturn searchItems( items, searchInput, config );\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [ item, getItemSearchRank( item, searchInput, config ) ];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > 0 );\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nexport function getItemSearchRank( item, searchTerm, config = {} ) {\n\tconst {\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\tgetCategory = defaultGetCategory,\n\t\tgetCollection = defaultGetCollection,\n\t} = config;\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\tconst category = getCategory( item );\n\tconst collection = getCollection( item );\n\n\tconst normalizedSearchInput = normalizeString( searchTerm );\n\tconst normalizedTitle = normalizeString( title );\n\n\tlet rank = 0;\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, categories, collection, variations match come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [\n\t\t\tname,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\t...keywords,\n\t\t\tcategory,\n\t\t\tcollection,\n\t\t].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\t// Give a better rank to \"core\" namespaced items.\n\tif ( rank !== 0 && name.startsWith( 'core/' ) ) {\n\t\tconst isCoreBlockVariation = name !== item.id;\n\t\t// Give a bit better rank to \"core\" blocks over \"core\" block variations.\n\t\trank += isCoreBlockVariation ? 1 : 2;\n\t}\n\n\treturn rank;\n}\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultGetCategory = ( item ) => item.category;\nconst defaultGetCollection = () => null;\n\n// Normalization regexes\nconst splitRegexp = [\n\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n];\nconst stripRegexp = /(\\p{C}|\\p{P}|\\p{S})+/giu; // Anything that's not a punctuation, symbol or control/format character.\n\n// Normalization cache\nconst extractedWords = new Map();\nconst normalizedStrings = new Map();\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nexport function extractWords( input = '' ) {\n\tif ( extractedWords.has( input ) ) {\n\t\treturn extractedWords.get( input );\n\t}\n\n\tconst result = noCase( input, {\n\t\tsplitRegexp,\n\t\tstripRegexp,\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n\n\textractedWords.set( input, result );\n\n\treturn result;\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nexport function normalizeString( input = '' ) {\n\tif ( normalizedStrings.has( input ) ) {\n\t\treturn normalizedStrings.get( input );\n\t}\n\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tlet result = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tresult = result.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tresult = result.toLowerCase();\n\n\tnormalizedStrings.set( input, result );\n\n\treturn result;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeString( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\nexport const searchBlockItems = (\n\titems,\n\tcategories,\n\tcollections,\n\tsearchInput\n) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst config = {\n\t\tgetCategory: ( item ) =>\n\t\t\tcategories.find( ( { slug } ) => slug === item.category )?.title,\n\t\tgetCollection: ( item ) =>\n\t\t\tcollections[ item.name.split( '/' )[ 0 ] ]?.title,\n\t};\n\n\treturn searchItems( items, searchInput, config );\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn items;\n\t}\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [ item, getItemSearchRank( item, searchInput, config ) ];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > 0 );\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nexport function getItemSearchRank( item, searchTerm, config = {} ) {\n\tconst {\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\tgetCategory = defaultGetCategory,\n\t\tgetCollection = defaultGetCollection,\n\t} = config;\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\tconst category = getCategory( item );\n\tconst collection = getCollection( item );\n\n\tconst normalizedSearchInput = normalizeString( searchTerm );\n\tconst normalizedTitle = normalizeString( title );\n\n\tlet rank = 0;\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, categories, collection, variations match come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [\n\t\t\tname,\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\t...keywords,\n\t\t\tcategory,\n\t\t\tcollection,\n\t\t].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\t// Give a better rank to \"core\" namespaced items.\n\tif ( rank !== 0 && name.startsWith( 'core/' ) ) {\n\t\tconst isCoreBlockVariation = name !== item.id;\n\t\t// Give a bit better rank to \"core\" blocks over \"core\" block variations.\n\t\trank += isCoreBlockVariation ? 1 : 2;\n\t}\n\n\treturn rank;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA0B;AAC1B,yBAAuB;AAGvB,IAAM,iBAAiB,CAAE,SAAU,KAAK,QAAQ;AAChD,IAAM,kBAAkB,CAAE,SAAU,KAAK;AACzC,IAAM,wBAAwB,CAAE,SAAU,KAAK,eAAe;AAC9D,IAAM,qBAAqB,CAAE,SAAU,KAAK,YAAY,CAAC;AACzD,IAAM,qBAAqB,CAAE,SAAU,KAAK;AAC5C,IAAM,uBAAuB,MAAM;AAGnC,IAAM,cAAc;AAAA,EACnB;AAAA;AAAA,EACA;AAAA;AACD;AACA,IAAM,cAAc,WAAC,2BAAqB,KAAG;AAG7C,IAAM,iBAAiB,oBAAI,IAAI;AAC/B,IAAM,oBAAoB,oBAAI,IAAI;AAS3B,SAAS,aAAc,QAAQ,IAAK;AAC1C,MAAK,eAAe,IAAK,KAAM,GAAI;AAClC,WA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AAK,SAAS,KAAK,KAAK,WAAY,OAAQ,GAAI;AAC/C,UAAM,uBAAuB,SAAS,KAAK;AAE3C,YAAQ,uBAAuB,IAAI;AAAA,EACpC;AAEA,SAAO;AACR;",
6
6
  "names": ["removeAccents"]
7
7
  }
@@ -43,7 +43,6 @@ var import_block_style_state = require("../../hooks/block-style-state.cjs");
43
43
  var import_list_view_content_popover = require("./list-view-content-popover.cjs");
44
44
  var import_jsx_runtime = require("react/jsx-runtime");
45
45
  var PATTERN_EDITING_GROUPS = ["content", "list"];
46
- var TEMPLATE_PART_GROUPS = ["default", "settings", "advanced"];
47
46
  function InspectorControlsFill({
48
47
  children,
49
48
  group = "default",
@@ -69,9 +68,8 @@ function InspectorControlsFill({
69
68
  }
70
69
  if (context[import_context.mayDisplayPatternEditingControlsKey]) {
71
70
  const isTemplatePart = context.name === "core/template-part";
72
- const isTemplatePartGroup = TEMPLATE_PART_GROUPS.includes(group);
73
71
  const isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes(group);
74
- const canShowGroup = isTemplatePart && isTemplatePartGroup || isPatternEditingGroup;
72
+ const canShowGroup = isTemplatePart || isPatternEditingGroup;
75
73
  if (!canShowGroup) {
76
74
  return null;
77
75
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inspector-controls/fill.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayPatternEditingControlsKey,\n\tisInListViewBlockSupportTreeKey,\n} from '../block-edit/context';\nimport groups from './groups';\nimport {\n\tscopeResetAllFilterToState,\n\tuseBlockStyleState,\n} from '../../hooks/block-style-state';\nimport { ListViewContentFill } from './list-view-content-popover';\n\nconst PATTERN_EDITING_GROUPS = [ 'content', 'list' ];\nconst TEMPLATE_PART_GROUPS = [ 'default', 'settings', 'advanced' ];\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst context = useBlockEditContext();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\t// During pattern editing:\n\t// - All blocks can show pattern editing groups (content, list).\n\t// - Template parts can show a settings tab (default, settings, advanced groups).\n\t// - Other blocks cannot show a settings tab.\n\tif ( context[ mayDisplayPatternEditingControlsKey ] ) {\n\t\t// Template parts are allowed to show a settings tab to allow access to the\n\t\t// 'Design' and 'Advanced' panels.\n\t\tconst isTemplatePart = context.name === 'core/template-part';\n\t\tconst isTemplatePartGroup = TEMPLATE_PART_GROUPS.includes( group );\n\t\tconst isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes( group );\n\n\t\tconst canShowGroup =\n\t\t\t( isTemplatePart && isTemplatePartGroup ) || isPatternEditingGroup;\n\n\t\tif ( ! canShowGroup ) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t// Outside pattern editing, use the standard rules for displaying controls.\n\tif (\n\t\t! context[ mayDisplayPatternEditingControlsKey ] &&\n\t\t! context[ mayDisplayControlsKey ]\n\t) {\n\t\treturn null;\n\t}\n\n\t// When inside a section with a parent that has ListView block support,\n\t// content controls are rendered as part of the ListView via a popover.\n\tif (\n\t\tgroup === 'content' &&\n\t\t!! context[ isInListViewBlockSupportTreeKey ] &&\n\t\t!! context[ mayDisplayPatternEditingControlsKey ]\n\t) {\n\t\tif ( context[ mayDisplayControlsKey ] ) {\n\t\t\treturn (\n\t\t\t\t<StyleProvider document={ document }>\n\t\t\t\t\t<ListViewContentFill>{ children }</ListViewContentFill>\n\t\t\t\t</StyleProvider>\n\t\t\t);\n\t\t}\n\n\t\t// When using the ListView fill, only render controls for the selected\n\t\t// block. Other blocks return `null`.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction RegisterResetAll( { resetAllFilter, children } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } =\n\t\tuseContext( ToolsPanelContext );\n\tconst selectedState = useBlockStyleState();\n\tconst scopedResetAllFilter = useMemo(\n\t\t() => scopeResetAllFilterToState( selectedState, resetAllFilter ),\n\t\t[ resetAllFilter, selectedState ]\n\t);\n\tuseEffect( () => {\n\t\tif (\n\t\t\tscopedResetAllFilter &&\n\t\t\tregisterResetAllFilter &&\n\t\t\tderegisterResetAllFilter\n\t\t) {\n\t\t\tregisterResetAllFilter( scopedResetAllFilter );\n\t\t\treturn () => {\n\t\t\t\tderegisterResetAllFilter( scopedResetAllFilter );\n\t\t\t};\n\t\t}\n\t}, [\n\t\tscopedResetAllFilter,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t] );\n\treturn children;\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\t// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,\n\t// that should wrap the fill markup.\n\tconst { forwardedContext = [] } = fillProps;\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst innerMarkup = (\n\t\t<RegisterResetAll resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</RegisterResetAll>\n\t);\n\treturn forwardedContext.reduce(\n\t\t( inner, [ Provider, props ] ) => (\n\t\t\t<Provider { ...props }>{ inner }</Provider>\n\t\t),\n\t\tinnerMarkup\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAAoB;AACpB,wBAAuB;AACvB,qBAA+C;AAK/C,qBAKO;AACP,oBAAmB;AACnB,+BAGO;AACP,uCAAoC;AAoE/B;AAlEL,IAAM,yBAAyB,CAAE,WAAW,MAAO;AACnD,IAAM,uBAAuB,CAAE,WAAW,YAAY,UAAW;AAElD,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AACD,GAAI;AACH,MAAK,qBAAsB;AAC1B,0BAAAA;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AACA,YAAQ;AAAA,EACT;AAEA,QAAM,cAAU,oCAAoB;AAEpC,QAAM,OAAO,cAAAC,QAAQ,KAAM,GAAG;AAC9B,MAAK,CAAE,MAAO;AACb,uBAAAC,SAAS,oCAAqC,KAAM,aAAc;AAClE,WAAO;AAAA,EACR;AAMA,MAAK,QAAS,kDAAoC,GAAI;AAGrD,UAAM,iBAAiB,QAAQ,SAAS;AACxC,UAAM,sBAAsB,qBAAqB,SAAU,KAAM;AACjE,UAAM,wBAAwB,uBAAuB,SAAU,KAAM;AAErE,UAAM,eACH,kBAAkB,uBAAy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AAW,GAAG,OAAU,iBAAO;AAAA,IAEjC;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n\tmayDisplayPatternEditingControlsKey,\n\tisInListViewBlockSupportTreeKey,\n} from '../block-edit/context';\nimport groups from './groups';\nimport {\n\tscopeResetAllFilterToState,\n\tuseBlockStyleState,\n} from '../../hooks/block-style-state';\nimport { ListViewContentFill } from './list-view-content-popover';\n\nconst PATTERN_EDITING_GROUPS = [ 'content', 'list' ];\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst context = useBlockEditContext();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\t// During pattern editing:\n\t// - All blocks can show pattern editing groups (content, list).\n\t// - Template parts can show any inspector group.\n\t// - Other blocks cannot show a settings tab.\n\tif ( context[ mayDisplayPatternEditingControlsKey ] ) {\n\t\t// Template parts have also historically supported\n\t\t// any block inspector groups for extenders. The settings\n\t\t// tab is also used by core for the 'Design' panel. Specifically\n\t\t// for that block the restrictions on allowed groups are lessened.\n\t\tconst isTemplatePart = context.name === 'core/template-part';\n\t\tconst isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes( group );\n\t\tconst canShowGroup = isTemplatePart || isPatternEditingGroup;\n\n\t\tif ( ! canShowGroup ) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t// Outside pattern editing, use the standard rules for displaying controls.\n\tif (\n\t\t! context[ mayDisplayPatternEditingControlsKey ] &&\n\t\t! context[ mayDisplayControlsKey ]\n\t) {\n\t\treturn null;\n\t}\n\n\t// When inside a section with a parent that has ListView block support,\n\t// content controls are rendered as part of the ListView via a popover.\n\tif (\n\t\tgroup === 'content' &&\n\t\t!! context[ isInListViewBlockSupportTreeKey ] &&\n\t\t!! context[ mayDisplayPatternEditingControlsKey ]\n\t) {\n\t\tif ( context[ mayDisplayControlsKey ] ) {\n\t\t\treturn (\n\t\t\t\t<StyleProvider document={ document }>\n\t\t\t\t\t<ListViewContentFill>{ children }</ListViewContentFill>\n\t\t\t\t</StyleProvider>\n\t\t\t);\n\t\t}\n\n\t\t// When using the ListView fill, only render controls for the selected\n\t\t// block. Other blocks return `null`.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction RegisterResetAll( { resetAllFilter, children } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } =\n\t\tuseContext( ToolsPanelContext );\n\tconst selectedState = useBlockStyleState();\n\tconst scopedResetAllFilter = useMemo(\n\t\t() => scopeResetAllFilterToState( selectedState, resetAllFilter ),\n\t\t[ resetAllFilter, selectedState ]\n\t);\n\tuseEffect( () => {\n\t\tif (\n\t\t\tscopedResetAllFilter &&\n\t\t\tregisterResetAllFilter &&\n\t\t\tderegisterResetAllFilter\n\t\t) {\n\t\t\tregisterResetAllFilter( scopedResetAllFilter );\n\t\t\treturn () => {\n\t\t\t\tderegisterResetAllFilter( scopedResetAllFilter );\n\t\t\t};\n\t\t}\n\t}, [\n\t\tscopedResetAllFilter,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t] );\n\treturn children;\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\t// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,\n\t// that should wrap the fill markup.\n\tconst { forwardedContext = [] } = fillProps;\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst innerMarkup = (\n\t\t<RegisterResetAll resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</RegisterResetAll>\n\t);\n\treturn forwardedContext.reduce(\n\t\t( inner, [ Provider, props ] ) => (\n\t\t\t<Provider { ...props }>{ inner }</Provider>\n\t\t),\n\t\tinnerMarkup\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAAoB;AACpB,wBAAuB;AACvB,qBAA+C;AAK/C,qBAKO;AACP,oBAAmB;AACnB,+BAGO;AACP,uCAAoC;AAkE/B;AAhEL,IAAM,yBAAyB,CAAE,WAAW,MAAO;AAEpC,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AACD,GAAI;AACH,MAAK,qBAAsB;AAC1B,0BAAAA;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AACA,YAAQ;AAAA,EACT;AAEA,QAAM,cAAU,oC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AA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACF,SAAO;AACR;AAEA,SAAS,2BAA4B,EAAE,UAAU,gBAAgB,UAAU,GAAI;AAG9E,QAAM,EAAE,mBAAmB,CAAC,EAAE,IAAI;AAMlC,QAAM,cACL,4CAAC,oBAAiB,gBACf,UACH;AAED,SAAO,iBAAiB;AAAA,IACvB,CAAE,OAAO,CAAE,UAAU,KAAM,MAC1B,4CAAC,YAAW,GAAG,OAAU,iBAAO;AAAA,IAEjC;AAAA,EACD;AACD;",
6
6
  "names": ["deprecated", "groups", "warning", "StyleProvider", "ToolsPanelContext"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inspector-controls-tabs/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon as WCIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useEffect, useState, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW, TAB_CONTENT } from './utils';\nimport SettingsTab from './settings-tab';\nimport StylesTab from './styles-tab';\nimport ContentTab from './content-tab';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function InspectorControlsTabs( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\ttabs,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) {\n\tconst listViewRef = useRef( null );\n\tconst showIconLabels = useSelect( ( select ) => {\n\t\treturn select( preferencesStore ).get( 'core', 'showIconLabels' );\n\t}, [] );\n\n\t// Get any requested inspector tab (used for initial state when programmatically switching)\n\tconst { requestedTab } = useSelect( ( select ) => ( {\n\t\trequestedTab: unlock(\n\t\t\tselect( blockEditorStore )\n\t\t).getRequestedInspectorTab(),\n\t} ) );\n\n\tconst [ selectedTabId, setSelectedTabId ] = useState(\n\t\t() => requestedTab?.tabName ?? tabs[ 0 ]?.name\n\t);\n\tconst hasUserSelectionRef = useRef( false );\n\tconst isProgrammaticSwitchRef = useRef( false );\n\tconst {\n\t\t__unstableSetOpenListViewPanel: setOpenListViewPanel,\n\t\t__unstableIncrementListViewExpandRevision:\n\t\t\tincrementListViewExpandRevision,\n\t\t__unstableSetAllListViewPanelsOpen: setAllListViewPanelsOpen,\n\t} = useDispatch( blockEditorStore );\n\tconst { clearRequestedInspectorTab } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\t// Reset when switching blocks\n\tuseEffect( () => {\n\t\thasUserSelectionRef.current = false;\n\t}, [ clientId ] );\n\n\t// Handle explicit inspector tab requests (panel opening, refs, clear).\n\t// Tab state is initialized from requestedTab above.\n\tuseEffect( () => {\n\t\tif ( ! requestedTab ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Switch to the requested tab\n\t\tsetSelectedTabId( requestedTab.tabName );\n\n\t\t// Handle tab-specific options\n\t\tif (\n\t\t\trequestedTab.tabName === TAB_LIST_VIEW.name &&\n\t\t\trequestedTab.options?.openPanel\n\t\t) {\n\t\t\t// Open the specific panel for List View\n\t\t\tsetOpenListViewPanel( requestedTab.options.openPanel );\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\n\t\t// Mark as handled (programmatic switch)\n\t\tisProgrammaticSwitchRef.current = true;\n\t\thasUserSelectionRef.current = true;\n\n\t\t// Clear the request\n\t\tclearRequestedInspectorTab();\n\t}, [\n\t\trequestedTab,\n\t\tsetOpenListViewPanel,\n\t\tincrementListViewExpandRevision,\n\t\tclearRequestedInspectorTab,\n\t] );\n\n\t// Initialize List View panels when the tab is selected and clientId changes\n\tuseEffect( () => {\n\t\tif (\n\t\t\tselectedTabId === TAB_LIST_VIEW.name &&\n\t\t\t! hasUserSelectionRef.current\n\t\t) {\n\t\t\tsetAllListViewPanelsOpen();\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tselectedTabId,\n\t\tsetAllListViewPanelsOpen,\n\t\tincrementListViewExpandRevision,\n\t] );\n\n\t// Auto-select first available tab unless user has made a selection\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! tabs?.length ||\n\t\t\t( hasUserSelectionRef.current &&\n\t\t\t\ttabs.some( ( tab ) => tab.name === selectedTabId ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstTabName = tabs[ 0 ]?.name;\n\t\tif ( selectedTabId !== firstTabName ) {\n\t\t\tsetSelectedTabId( firstTabName );\n\t\t}\n\t}, [ tabs, selectedTabId ] );\n\n\tconst handleTabSelect = ( tabId ) => {\n\t\tsetSelectedTabId( tabId );\n\t\thasUserSelectionRef.current = true;\n\n\t\t// If manually switching to List View tab (not via click-through), open all panels\n\t\tif (\n\t\t\ttabId === TAB_LIST_VIEW.name &&\n\t\t\t! isProgrammaticSwitchRef.current\n\t\t) {\n\t\t\tsetAllListViewPanelsOpen();\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\n\t\t// Reset the flag\n\t\tisProgrammaticSwitchRef.current = false;\n\t};\n\n\tconst hasListViewTab = tabs.some(\n\t\t( tab ) => tab.name === TAB_LIST_VIEW.name\n\t);\n\n\tconst switchToListView = ( targetClientId ) => {\n\t\tif ( hasListViewTab ) {\n\t\t\t// Open only the target panel\n\t\t\tsetOpenListViewPanel( targetClientId );\n\t\t\tincrementListViewExpandRevision();\n\t\t\t// Mark this as a programmatic switch\n\t\t\tisProgrammaticSwitchRef.current = true;\n\t\t\thandleTabSelect( TAB_LIST_VIEW.name );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector__tabs\">\n\t\t\t<Tabs\n\t\t\t\tselectedTabId={ selectedTabId }\n\t\t\t\tonSelect={ handleTabSelect }\n\t\t\t\tkey={ clientId }\n\t\t\t>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) =>\n\t\t\t\t\t\tshowIconLabels ? (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.name } tabId={ tab.name }>\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\t\t<Tooltip.Root key={ tab.name }>\n\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\taria-label={ tab.title }\n\t\t\t\t\t\t\t\t\trender={ <Tooltip.Trigger /> }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<WCIcon icon={ tab.icon } />\n\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t<Tooltip.Popup>{ tab.title }</Tooltip.Popup>\n\t\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_CONTENT.name } focusable={ false }>\n\t\t\t\t\t<ContentTab\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t\tonSwitchToListView={ switchToListView }\n\t\t\t\t\t\thasListViewTab={ hasListViewTab }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_LIST_VIEW.name } focusable={ false }>\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_SETTINGS.name } focusable={ false }>\n\t\t\t\t\t<SettingsTab showAdvancedControls={ !! blockName } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_STYLES.name } focusable={ false }>\n\t\t\t\t\t<StylesTab\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAA4C;AAC5C,yBAA0C;AAC1C,kBAAuC;AAGvC,gBAAwB;AAKxB,mBAAqE;AACrE,0BAAwB;AACxB,wBAAsB;AACtB,yBAAuB;AACvB,uCAAuC;AACvC,gCAA8B;AAC9B,yBAAuB;AACvB,mBAA0C;AAuJnC;AArJP,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAEhC,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,kBAAc,uBAAQ,IAAK;AACjC,QAAM,qBAAiB,uBAAW,CAAE,WAAY;AAC/C,WAAO,OAAQ,mBAAAC,KAAiB,EAAE,IAAK,QAAQ,gBAAiB;AAAA,EACjE,GAAG,CAAC,CAAE;AAGN,QAAM,EAAE,aAAa,QAAI,uBAAW,CAAE,YAAc;AAAA,IACnD,kBAAc;AAAA,MACb,OAAQ,aAAAC,KAAiB;AAAA,IAC1B,EAAE,yBAAyB;AAAA,EAC5B,EAAI;AAEJ,QA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C;AAAA,QACA,6CAAC,KAAK,UAAL,EAAc,OAAQ,2BAAc,MAAO,WAAY,OACvD;AAAA,sDAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,QAAO,KAAM,aAAc;AAAA,UACzD,4CAAC,2DAAuB,aAA4B;AAAA,WACrD;AAAA,QACA,4CAAC,KAAK,UAAL,EAAc,OAAQ,0BAAa,MAAO,WAAY,OACtD,sDAAC,oBAAAC,SAAA,EAAY,sBAAuB,CAAC,CAAE,WAAY,GACpD;AAAA,QACA,4CAAC,KAAK,UAAL,EAAc,OAAQ,wBAAW,MAAO,WAAY,OACpD;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACD,GACD;AAAA;AAAA;AAAA,IA7CM;AAAA,EA8CP,GACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon as WCIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useEffect, useState, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW, TAB_CONTENT } from './utils';\nimport SettingsTab from './settings-tab';\nimport StylesTab from './styles-tab';\nimport ContentTab from './content-tab';\nimport { ListViewContentPopover } from '../inspector-controls/list-view-content-popover';\nimport InspectorControls from '../inspector-controls';\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function InspectorControlsTabs( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\ttabs,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) {\n\tconst listViewRef = useRef( null );\n\tconst showIconLabels = useSelect( ( select ) => {\n\t\treturn select( preferencesStore ).get( 'core', 'showIconLabels' );\n\t}, [] );\n\n\t// Get any requested inspector tab (used for initial state when programmatically switching)\n\tconst { requestedTab } = useSelect( ( select ) => ( {\n\t\trequestedTab: unlock(\n\t\t\tselect( blockEditorStore )\n\t\t).getRequestedInspectorTab(),\n\t} ) );\n\n\tconst [ selectedTabId, setSelectedTabId ] = useState(\n\t\t() => requestedTab?.tabName ?? tabs[ 0 ]?.name\n\t);\n\tconst hasUserSelectionRef = useRef( false );\n\tconst isProgrammaticSwitchRef = useRef( false );\n\tconst {\n\t\t__unstableSetOpenListViewPanel: setOpenListViewPanel,\n\t\t__unstableIncrementListViewExpandRevision:\n\t\t\tincrementListViewExpandRevision,\n\t\t__unstableSetAllListViewPanelsOpen: setAllListViewPanelsOpen,\n\t} = useDispatch( blockEditorStore );\n\tconst { clearRequestedInspectorTab } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\t// Reset when switching blocks\n\tuseEffect( () => {\n\t\thasUserSelectionRef.current = false;\n\t}, [ clientId ] );\n\n\t// Handle explicit inspector tab requests (panel opening, refs, clear).\n\t// Tab state is initialized from requestedTab above.\n\tuseEffect( () => {\n\t\tif ( ! requestedTab ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Switch to the requested tab\n\t\tsetSelectedTabId( requestedTab.tabName );\n\n\t\t// Handle tab-specific options\n\t\tif (\n\t\t\trequestedTab.tabName === TAB_LIST_VIEW.name &&\n\t\t\trequestedTab.options?.openPanel\n\t\t) {\n\t\t\t// Open the specific panel for List View\n\t\t\tsetOpenListViewPanel( requestedTab.options.openPanel );\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\n\t\t// Mark as handled (programmatic switch)\n\t\tisProgrammaticSwitchRef.current = true;\n\t\thasUserSelectionRef.current = true;\n\n\t\t// Clear the request\n\t\tclearRequestedInspectorTab();\n\t}, [\n\t\trequestedTab,\n\t\tsetOpenListViewPanel,\n\t\tincrementListViewExpandRevision,\n\t\tclearRequestedInspectorTab,\n\t] );\n\n\t// Initialize List View panels when the tab is selected and clientId changes\n\tuseEffect( () => {\n\t\tif (\n\t\t\tselectedTabId === TAB_LIST_VIEW.name &&\n\t\t\t! hasUserSelectionRef.current\n\t\t) {\n\t\t\tsetAllListViewPanelsOpen();\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tselectedTabId,\n\t\tsetAllListViewPanelsOpen,\n\t\tincrementListViewExpandRevision,\n\t] );\n\n\t// Auto-select first available tab unless user has made a selection\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! tabs?.length ||\n\t\t\t( hasUserSelectionRef.current &&\n\t\t\t\ttabs.some( ( tab ) => tab.name === selectedTabId ) )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstTabName = tabs[ 0 ]?.name;\n\t\tif ( selectedTabId !== firstTabName ) {\n\t\t\tsetSelectedTabId( firstTabName );\n\t\t}\n\t}, [ tabs, selectedTabId ] );\n\n\tconst handleTabSelect = ( tabId ) => {\n\t\tsetSelectedTabId( tabId );\n\t\thasUserSelectionRef.current = true;\n\n\t\t// If manually switching to List View tab (not via click-through), open all panels\n\t\tif (\n\t\t\ttabId === TAB_LIST_VIEW.name &&\n\t\t\t! isProgrammaticSwitchRef.current\n\t\t) {\n\t\t\tsetAllListViewPanelsOpen();\n\t\t\tincrementListViewExpandRevision();\n\t\t}\n\n\t\t// Reset the flag\n\t\tisProgrammaticSwitchRef.current = false;\n\t};\n\n\tconst hasListViewTab = tabs.some(\n\t\t( tab ) => tab.name === TAB_LIST_VIEW.name\n\t);\n\n\tconst switchToListView = ( targetClientId ) => {\n\t\tif ( hasListViewTab ) {\n\t\t\t// Open only the target panel\n\t\t\tsetOpenListViewPanel( targetClientId );\n\t\t\tincrementListViewExpandRevision();\n\t\t\t// Mark this as a programmatic switch\n\t\t\tisProgrammaticSwitchRef.current = true;\n\t\t\thandleTabSelect( TAB_LIST_VIEW.name );\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector__tabs\">\n\t\t\t<Tabs\n\t\t\t\tselectedTabId={ selectedTabId }\n\t\t\t\tonSelect={ handleTabSelect }\n\t\t\t\tkey={ clientId }\n\t\t\t>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) =>\n\t\t\t\t\t\tshowIconLabels ? (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.name } tabId={ tab.name }>\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\t\t<Tooltip.Root key={ tab.name }>\n\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\taria-label={ tab.title }\n\t\t\t\t\t\t\t\t\trender={ <Tooltip.Trigger /> }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<WCIcon icon={ tab.icon } />\n\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t<Tooltip.Popup>{ tab.title }</Tooltip.Popup>\n\t\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_CONTENT.name } focusable={ false }>\n\t\t\t\t\t<ContentTab\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t\tonSwitchToListView={ switchToListView }\n\t\t\t\t\t\thasListViewTab={ hasListViewTab }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"content\" />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_LIST_VIEW.name } focusable={ false }>\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" ref={ listViewRef } />\n\t\t\t\t\t<ListViewContentPopover listViewRef={ listViewRef } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_SETTINGS.name } focusable={ false }>\n\t\t\t\t\t<SettingsTab showAdvancedControls={ !! blockName } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_STYLES.name } focusable={ false }>\n\t\t\t\t\t<StylesTab\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAA4C;AAC5C,yBAA0C;AAC1C,kBAAuC;AAEvC,gBAAwB;AAKxB,mBAAqE;AACrE,0BAAwB;AACxB,wBAAsB;AACtB,yBAAuB;AACvB,uCAAuC;AACvC,gCAA8B;AAC9B,yBAAuB;AACvB,mBAA0C;AAuJnC;AArJP,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAEhC,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,kBAAc,uBAAQ,IAAK;AACjC,QAAM,qBAAiB,uBAAW,CAAE,WAAY;AAC/C,WAAO,OAAQ,mBAAAC,KAAiB,EAAE,IAAK,QAAQ,gBAAiB;AAAA,EACjE,GAAG,CAAC,CAAE;AAGN,QAAM,EAAE,aAAa,QAAI,uBAAW,CAAE,YAAc;AAAA,IACnD,kBAAc;AAAA,MACb,OAAQ,aAAAC,KAAiB;AAAA,IAC1B,EAAE,yBAAyB;AAAA,EAC5B,EAAI;AAEJ,QAAM,CAAE,eAAe,gBAA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KAAK,UAAL,EAAc,OAAQ,2BAAc,MAAO,WAAY,OACvD;AAAA,sDAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,QAAO,KAAM,aAAc;AAAA,UACzD,4CAAC,2DAAuB,aAA4B;AAAA,WACrD;AAAA,QACA,4CAAC,KAAK,UAAL,EAAc,OAAQ,0BAAa,MAAO,WAAY,OACtD,sDAAC,oBAAAC,SAAA,EAAY,sBAAuB,CAAC,CAAE,WAAY,GACpD;AAAA,QACA,4CAAC,KAAK,UAAL,EAAc,OAAQ,wBAAW,MAAO,WAAY,OACpD;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACD,GACD;AAAA;AAAA;AAAA,IA7CM;AAAA,EA8CP,GACD;AAEF;",
6
6
  "names": ["componentsPrivateApis", "preferencesStore", "blockEditorStore", "WCIcon", "ContentTab", "InspectorControls", "SettingsTab", "StylesTab"]
7
7
  }
@@ -102,7 +102,7 @@ var StylesTab = ({
102
102
  contentClientIds
103
103
  }
104
104
  ),
105
- !isSectionBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
105
+ (!isSectionBlock || blockName === "core/template-part") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
106
106
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
107
  import_inspector_controls.default.Slot,
108
108
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inspector-controls-tabs/styles-tab.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport PositionControls from './position-controls-panel';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { ColorEdit } from '../../hooks/color';\nimport { ColorToolsPanel } from '../global-styles/color-panel';\n\nfunction SectionBlockColorControls( {\n\tblockName,\n\tclientId,\n\tcontentClientIds,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { hasButtons, hasHeading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNames =\n\t\t\t\tselect( blockEditorStore ).getBlockNamesByClientId(\n\t\t\t\t\tcontentClientIds\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\thasButtons: blockNames.includes( 'core/buttons' ),\n\t\t\t\thasHeading: blockNames.includes( 'core/heading' ),\n\t\t\t};\n\t\t},\n\t\t[ contentClientIds ]\n\t);\n\n\tconst setAttributes = ( newAttributes ) => {\n\t\tupdateBlockAttributes( clientId, newAttributes );\n\t};\n\n\treturn (\n\t\t<ColorEdit\n\t\t\tclientId={ clientId }\n\t\t\tname={ blockName }\n\t\t\tsettings={ settings }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tasWrapper={ ColorToolsPanel }\n\t\t\tlabel={ __( 'Color' ) }\n\t\t\tdefaultControls={ {\n\t\t\t\ttext: true,\n\t\t\t\tbackground: true,\n\t\t\t\tbutton: hasButtons,\n\t\t\t\theading: hasHeading,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nconst StylesTab = ( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) => {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }\n\t\t\t{ isSectionBlock && (\n\t\t\t\t<SectionBlockColorControls\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isSectionBlock && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<PositionControls />\n\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AAKvC,0BAAwB;AACxB,gCAA8B;AAC9B,qCAA6B;AAC7B,oBAAoC;AACpC,mBAAiC;AACjC,mBAA0C;AAC1C,mBAA0B;AAC1B,yBAAgC;AA6B9B;AA3BF,SAAS,0BAA2B;AAAA,EACnC;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AAM;AAAA,UACN,WAAQ,gBAAI,kBAAmB;AAAA,UAC/B,WAAU;AAAA;AAAA,MACX;AAAA,MACA,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,MACvC;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,QAAS;AAAA;AAAA,MACtB;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,OAAQ;AAAA;AAAA,MACT;AAAA,MACA,4CAAC,+BAAAC,SAAA,EAAiB;AAAA,MAClB,4CAAC,0BAAAD,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,OACxC;AAAA,KAEF;AAEF;AAEA,IAAO,qBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport PositionControls from './position-controls-panel';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { ColorEdit } from '../../hooks/color';\nimport { ColorToolsPanel } from '../global-styles/color-panel';\n\nfunction SectionBlockColorControls( {\n\tblockName,\n\tclientId,\n\tcontentClientIds,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { hasButtons, hasHeading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNames =\n\t\t\t\tselect( blockEditorStore ).getBlockNamesByClientId(\n\t\t\t\t\tcontentClientIds\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\thasButtons: blockNames.includes( 'core/buttons' ),\n\t\t\t\thasHeading: blockNames.includes( 'core/heading' ),\n\t\t\t};\n\t\t},\n\t\t[ contentClientIds ]\n\t);\n\n\tconst setAttributes = ( newAttributes ) => {\n\t\tupdateBlockAttributes( clientId, newAttributes );\n\t};\n\n\treturn (\n\t\t<ColorEdit\n\t\t\tclientId={ clientId }\n\t\t\tname={ blockName }\n\t\t\tsettings={ settings }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tasWrapper={ ColorToolsPanel }\n\t\t\tlabel={ __( 'Color' ) }\n\t\t\tdefaultControls={ {\n\t\t\t\ttext: true,\n\t\t\t\tbackground: true,\n\t\t\t\tbutton: hasButtons,\n\t\t\t\theading: hasHeading,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nconst StylesTab = ( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) => {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }\n\t\t\t{ isSectionBlock && (\n\t\t\t\t<SectionBlockColorControls\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{\n\t\t\t\t// Extenders have in the past always been allowed to add controls to group\n\t\t\t\t// the restrictions are lessened for that block.\n\t\t\t }\n\t\t\t{ ( ! isSectionBlock || blockName === 'core/template-part' ) && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<PositionControls />\n\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AAKvC,0BAAwB;AACxB,gCAA8B;AAC9B,qCAA6B;AAC7B,oBAAoC;AACpC,mBAAiC;AACjC,mBAA0C;AAC1C,mBAA0B;AAC1B,yBAAgC;AA6B9B;AA3BF,SAAS,0BAA2B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,eAAW,+BAAkB,SAAU;AAC7C,QAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAEhE,QAAM,EAAE,YAAY,WAAW,QAAI;A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ACvC;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,QAAS;AAAA;AAAA,MACtB;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,OAAQ;AAAA;AAAA,MACT;AAAA,MACA,4CAAC,+BAAAC,SAAA,EAAiB;AAAA,MAClB,4CAAC,0BAAAD,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,OACxC;AAAA,KAEF;AAEF;AAEA,IAAO,qBAAQ;",
6
6
  "names": ["blockEditorStore", "BlockStyles", "InspectorControls", "PositionControls"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/keyboard-shortcuts/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research \u2014 invalid character?\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/toggle-block-visibility',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Show or hide the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/rename',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Rename the selected block.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'r',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research invalid character?\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/toggle-block-visibility',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Show or hide the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/rename',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Rename the selected block.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'r',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAA4B;AAC5B,gCAAgD;AAChD,kBAAmB;AAEnB,SAAS,oBAAoB;AAC5B,SAAO;AACR;AAEA,SAAS,4BAA4B;AAEpC,QAAM,EAAE,iBAAiB,QAAI,yBAAa,0BAAAA,KAAuB;AACjE,gCAAW,M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AAAA,MAClD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,kCAAmC;AAAA,MACpD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAGF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,2BAA4B;AAAA,MAC7C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa;AAAA,QACZ;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,qCAAsC;AAAA,MACvD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,4BAA6B;AAAA,MAC9C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AACR;AAEA,kBAAkB,WAAW;AAE7B,IAAO,6BAAQ;",
6
6
  "names": ["keyboardShortcutsStore"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/line-height-control/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this \u2014 cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\tif (\n\t\t! __next40pxDefaultSize &&\n\t\t( otherProps.size === undefined || otherProps.size === 'default' )\n\t) {\n\t\tdeprecated( `36px default size for wp.blockEditor.LineHeightControl`, {\n\t\t\tsince: '6.8',\n\t\t\tversion: '7.1',\n\t\t\thint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',\n\t\t} );\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-line-height-control\">\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\tif (\n\t\t! __next40pxDefaultSize &&\n\t\t( otherProps.size === undefined || otherProps.size === 'default' )\n\t) {\n\t\tdeprecated( `36px default size for wp.blockEditor.LineHeightControl`, {\n\t\t\tsince: '6.8',\n\t\t\tversion: '7.1',\n\t\t\thint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',\n\t\t} );\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-line-height-control\">\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA6D;AAC7D,wBAAuB;AAKvB,mBAMO;AAyFJ;AAvFH,IAAM,oBAAoB,CAAE;AAAA;AAAA,EAE3B,wBAAwB;AAAA,EACxB,OAAO;AAAA,EACP;AAAA,EACA,uBAAuB;AAAA,EACvB,GAAG;AACJ,MAAO;AACN,QAAM,gBAAY,kCAAqB,UAAW;AAElD,QAAM,kBAAkB,CAAE,WAAW,qBAAsB;AAE1D,QAAK,WAAY;AAChB,aAAO;AAAA,IACR;AAWA,UAAM,OAAO,oBAAO;AACpB,YAAS,GAAI,SAAU,IAAK;AAAA,MAC3B,KAAK,GAAI,IAAK;AAEb,eAAO,kCAAqB;AAAA,MAC7B,KAAK,KAAK;AAGT,YAAK,kBAAmB;AACvB,iBAAO;AAAA,QACR;AAEA,eAAO,kCAAqB;AAAA,MAC7B;AAAA,MACA,KAAK;AACJ,eAAO;AAAA,MACR;AACC,eAAO;AAAA,IACT;AAAA,EACD;AAEA,QAAM,eAAe,CAAE,OAAO,WAAY;AAKzC,UAAM,mBAAmB,CAAE,cAAc,iBAAkB,EAAE;AAAA,MAC5D,OAAO,QAAQ,MAAM,aAAa;AAAA,IACnC;AACA,UAAMA,SAAQ,gBAAiB,MAAM,OAAO,gBAAiB;AAC7D,WAAO,EAAE,GAAG,OAAO,OAAAA,OAAM;AAAA,EAC1B;AAEA,QAAM,QAAQ,YAAY,aAAa;AAEvC,QAAM,iBAAiB,CAAE,WAAW,EAAE,MAAM,MAAO;AAClD,QAAK,cAAc,IAAK;AACvB,eAAS;AACT;AAAA,IACD;AAEA,QAAK,MAAM,SAAS,SAAU;AAC7B,eAAU,gBAAiB,GAAI,SAAU,IAAI,KAAM,CAAE;AACrD;AAAA,IACD;AAEA,aAAU,GAAI,SAAU,EAAG;AAAA,EAC5B;AAEA,MACC,CAAE,0BACA,WAAW,SAAS,UAAa,WAAW,SAAS,YACtD;AACD,0BAAAC,SAAY,0DAA0D;AAAA,MACrE,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,IACP,CAAE;AAAA,EACH;AAEA,SACC,4CAAC,SAAI,WAAU,oCACd;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACL,mCAAiC;AAAA,MACjC;AAAA,MACA;AAAA,MACA,wBAAyB;AAAA,MACzB,UAAW;AAAA,MACX,WAAQ,gBAAI,aAAc;AAAA,MAC1B,aAAc;AAAA,MACd,MAAO;AAAA,MACP,YAAa;AAAA,MACb;AAAA,MACA,KAAM;AAAA,MACN,cAAa;AAAA;AAAA,EACd,GACD;AAEF;AAKA,IAAO,8BAAQ;",
6
6
  "names": ["value", "deprecated", "NumberControl"]
7
7
  }
@@ -337,7 +337,7 @@ function LinkControl({
337
337
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}),
338
338
  " ",
339
339
  (0, import_i18n.__)("Creating"),
340
- "\u2026"
340
+ ""
341
341
  ] }),
342
342
  isEditing && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
343
343
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/link-control/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn, linkOff } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { isURL, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS, LINK_ENTRY_TYPES } from './constants';\nimport isURLLike, { isHashLink, isRelativePath } from './is-url-like';\nimport normalizeUrl from './normalize-url';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {Function=} onInputChange Callback fired when the search input value changes.\n * Use this for observation only (e.g., to track search state).\n * @property {string=} inputValue Initial value for the search input (uncontrolled).\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n * @property {boolean=} handleEntities Whether to handle entity links (links with ID). When true and a link has an ID, the input will be disabled and show an unlink button.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n * ## Usage Patterns\n *\n * The component does not support a fully controlled implementation,\n * but it does support an observable implementation.\n *\n * ### Uncontrolled (default)\n * The component manages its own search input state:\n * ```jsx\n * <LinkControl value={ link } onChange={ setLink } />\n * ```\n *\n * ### Observable\n * Observe input changes without controlling the value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * ### Uncontrolled with Initial Value\n * Pre-populate the search input with a default value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * inputValue=\"wordpress\"\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonInputChange,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n\thandleEntities = false,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\t// Sets if the URL value is valid when submitted. The value could be set to\n\t// { type: 'invalid', message: 'Please enter a valid URL.' } or { type: 'valid' }.\n\t// When it is undefined, the URL value has not been validated.\n\tconst [ customValidity, setCustomValidity ] = useState( undefined );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst searchInputRef = useRef();\n\t// TODO: Remove entityUrlFallbackRef and previewValue in favor of value prop after taxonomy entity binding\n\t// is stable and returns the correct URL instead of null while resolving when creating the entity.\n\t//\n\t// Preserve the URL from entity suggestions before binding overrides it\n\t// This is due to entity binding not being available immediately after the suggestion is selected.\n\t// The URL can return null, especially for taxonomy entities, while entity binding is being resolved.\n\t// To avoid unnecessary rerenders and focus loss, we preserve the URL from the suggestion and use it\n\t// as a fallback until the entity binding is available.\n\tconst entityUrlFallbackRef = useRef();\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\t// Wrapper for input changes that calls both internal and external handlers\n\tconst handleInputChange = ( newValue ) => {\n\t\tsetInternalURLInputValue( newValue );\n\t\tonInputChange?.( newValue );\n\t};\n\n\t// Compute isEntity internally based on handleEntities prop and presence of ID\n\tconst isEntity = handleEntities && !! internalControlValue?.id;\n\n\t// Generate help text ID for accessibility association\n\tconst baseId = useInstanceId( LinkControl, 'link-control' );\n\tconst helpTextId = isEntity ? `${ baseId }__help` : null;\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\t// Warn when inputValue changes after mount. inputValue only sets the\n\t// initial value. The component is uncontrolled and changes\n\t// from the parent will not update the search input.\n\tconst prevInputValueRef = useRef();\n\tuseEffect( () => {\n\t\tif ( prevInputValueRef.current === undefined ) {\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( prevInputValueRef.current !== propInputValue ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'LinkControl: The inputValue prop is uncontrolled and only sets the initial value. onInputChange is an observer for the input value. Changes to inputValue from the parent will not update the search input.'\n\t\t\t);\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t}\n\t}, [ propInputValue ] );\n\n\t// Trigger validation display when customValidity becomes invalid.\n\t// This effect runs after React has applied the customValidity state update\n\t// and ControlWithError's useEffect has set the native validity on the input.\n\tuseEffect( () => {\n\t\tif ( customValidity?.type === 'invalid' ) {\n\t\t\tconst inputElement = searchInputRef.current;\n\t\t\tif (\n\t\t\t\tinputElement &&\n\t\t\t\ttypeof inputElement.reportValidity === 'function'\n\t\t\t) {\n\t\t\t\tinputElement.reportValidity();\n\t\t\t}\n\t\t}\n\t}, [ customValidity ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state.\n\t */\n\tconst stopEditing = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\t/**\n\t * Validates a URL string using a multi-stage validation process.\n\t * This helper consolidates URL validation logic used throughout the component.\n\t *\n\t * @param {string} urlToValidate - The URL string to validate\n\t * @return {Object} Validation result with isValid boolean and optional errorMessage\n\t */\n\tconst validateUrl = ( urlToValidate ) => {\n\t\tconst invalidResult = {\n\t\t\ttype: 'invalid',\n\t\t\tmessage: __( 'Please enter a valid URL.' ),\n\t\t};\n\n\t\tconst validResult = {\n\t\t\ttype: 'valid',\n\t\t};\n\n\t\tconst trimmedValue = urlToValidate?.trim();\n\n\t\t// If empty or not URL-like, return invalid\n\t\tif ( ! trimmedValue?.length || ! isURLLike( trimmedValue ) ) {\n\t\t\treturn invalidResult;\n\t\t}\n\n\t\t// Hash links (internal anchor links) and relative paths (/, ./, ../) are\n\t\t// valid href values but cannot be validated by the native URL constructor\n\t\t// (which requires absolute URLs). These are already validated by isURLLike.\n\t\t// Skip URL constructor validation for these cases.\n\t\tif ( isHashLink( trimmedValue ) || isRelativePath( trimmedValue ) ) {\n\t\t\treturn validResult;\n\t\t}\n\n\t\t// Perform URL validation using the native URL constructor as the authoritative source.\n\t\t// The native URL constructor is the standard for URL validity - if it accepts a URL,\n\t\t// we should allow it. For URLs without a protocol (e.g., \"www.wordpress.org\"),\n\t\t// prepend \"http://\" before validating, as the URL constructor requires a protocol.\n\t\t//\n\t\t// Note: Protocol URLs (mailto:, tel:, etc.) are also validated by the native\n\t\t// URL constructor, so we don't need special handling for them.\n\t\t//\n\t\t// Note: We rely on the native URL constructor rather than implementing custom TLD\n\t\t// validation to avoid blocking valid URLs. If a URL passes the native constructor,\n\t\t// it's technically valid according to web standards.\n\t\tconst urlToCheck = prependHTTPS( trimmedValue );\n\t\treturn isURL( urlToCheck ) ? validResult : invalidResult;\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Validate URL suggestions (link, mailto, tel, internal) or manually entered URLs.\n\t\t// Entity suggestions (post, page, category, etc.) don't need validation as they come from the database.\n\t\t// However, URL suggestions (created from user input with types like 'link', 'mailto', etc.)\n\t\t// still need validation as they may contain invalid URLs like \"www.wordp\".\n\t\tconst isEntitySuggestion =\n\t\t\tupdatedValue &&\n\t\t\tupdatedValue.id &&\n\t\t\tupdatedValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( updatedValue.type );\n\n\t\tif ( ! isEntitySuggestion ) {\n\t\t\t// URL suggestion (link, mailto, tel, internal) or manually entered URL - validate before submitting\n\t\t\t// Use the URL from the suggestion, or fall back to currentUrlInputValue\n\t\t\tconst urlToValidate = updatedValue?.url || currentUrlInputValue;\n\n\t\t\t// Validate the URL using the shared validation helper\n\t\t\tconst validation = validateUrl( urlToValidate );\n\t\t\tif ( validation.type === 'invalid' ) {\n\t\t\t\tsetCustomValidity( validation );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Validation passed - normalize the URL\n\t\t\tconst { url: normalizedUrl } = normalizeUrl( urlToValidate );\n\t\t\tupdatedValue = {\n\t\t\t\t...updatedValue,\n\t\t\t\turl: normalizedUrl,\n\t\t\t};\n\t\t}\n\n\t\t// Preserve the URL for taxonomy entities before binding overrides it\n\t\tif ( updatedValue?.kind === 'taxonomy' && updatedValue?.url ) {\n\t\t\tentityUrlFallbackRef.current = updatedValue.url;\n\t\t}\n\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\t// Reset validation state when a suggestion is selected\n\t\tsetCustomValidity( undefined );\n\n\t\tstopEditing();\n\t};\n\n\t// Centralized validation function\n\tconst validateAndSetValidity = () => {\n\t\tif ( currentInputIsEmpty ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst trimmedValue = currentUrlInputValue.trim();\n\n\t\t// If the current value is an entity link (has id and type not in LINK_ENTRY_TYPES)\n\t\t// and the URL hasn't changed from the original value, skip validation.\n\t\t// This allows entity links with permalink formats like \"?p=2\" to work without\n\t\t// requiring URL validation when only settings are being changed.\n\t\tconst isEntityLink =\n\t\t\tinternalControlValue &&\n\t\t\tinternalControlValue.id &&\n\t\t\tinternalControlValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( internalControlValue.type );\n\t\tconst urlUnchanged = value?.url === trimmedValue;\n\n\t\tif ( isEntityLink && urlUnchanged ) {\n\t\t\t// Entity link with unchanged URL - skip validation\n\t\t\tsetCustomValidity( undefined );\n\t\t\treturn true;\n\t\t}\n\n\t\t// Validate the URL using the shared validation helper\n\t\tconst validation = validateUrl( currentUrlInputValue );\n\n\t\tif ( validation.type === 'invalid' ) {\n\t\t\tsetCustomValidity( validation );\n\t\t\treturn false;\n\t\t}\n\n\t\t// Valid URL\n\t\tsetCustomValidity( undefined );\n\t\treturn true;\n\t};\n\n\t// Centralized submission function\n\tconst submitUrlValue = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: normalizeUrl( currentUrlInputValue ).url,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t\tsetCustomValidity( undefined );\n\t};\n\n\tconst handleSubmit = () => {\n\t\t// Validate URL before submitting\n\t\tif ( ! validateAndSetValidity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Validation passed - proceed with submission\n\t\tsubmitUrlValue();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\t// Reset validation state\n\t\tsetCustomValidity( undefined );\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst [ shouldFocusSearchInput, setShouldFocusSearchInput ] =\n\t\tuseState( false );\n\n\tconst handleUnlink = () => {\n\t\t// Clear the internal state to remove the ID and re-enable the field\n\t\t// Explicitly set id, kind, and type to undefined so they override\n\t\t// the original values when spread in handleSubmit. This ensures that\n\t\t// when the user types a custom URL and submits, the entity link is\n\t\t// properly severed (not just when selecting a different entity from suggestions).\n\t\tconst { id, kind, type, ...restValue } = internalControlValue;\n\t\tsetInternalControlValue( {\n\t\t\t...restValue,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\n\t\t// Request focus after the component re-renders with the cleared state\n\t\t// We can't focus immediately because the input might still be disabled\n\t\tsetShouldFocusSearchInput( true );\n\t};\n\n\t// Focus the search input when requested, once the component has re-rendered\n\t// This ensures the input is enabled and ready to receive focus\n\tuseEffect( () => {\n\t\tif ( shouldFocusSearchInput ) {\n\t\t\tsearchInputRef.current?.focus();\n\t\t\tsetShouldFocusSearchInput( false );\n\t\t}\n\t}, [ shouldFocusSearchInput ] );\n\n\t// Prioritize internal value (even if empty string), but allow propInputValue to set\n\t// the initial default value.\n\tconst currentUrlInputValue =\n\t\tinternalControlValue?.url !== undefined\n\t\t\t? internalControlValue.url\n\t\t\t: propInputValue || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\t// Reset validation state when the URL value changes\n\tuseEffect( () => {\n\t\tsetCustomValidity( undefined );\n\t}, [ currentUrlInputValue ] );\n\n\tconst isUrlValid = ! customValidity;\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\t// When creating a new link (no existing value), allow submission if input is not empty and URL is valid\n\t// When editing an existing link, also require that the value has changed\n\tconst isDisabled =\n\t\tcurrentInputIsEmpty || ! isUrlValid || ( value && ! valueHasChanges );\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\tconst previewValue = useMemo( () => {\n\t\t// There is a chance that the value is not yet set from the entity binding, so we use the preserved URL.\n\t\tif (\n\t\t\tvalue?.kind === 'taxonomy' &&\n\t\t\t! value?.url &&\n\t\t\tentityUrlFallbackRef.current\n\t\t) {\n\t\t\t// combine the value prop with the preserved URL from the suggestion\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\turl: entityUrlFallbackRef.current,\n\t\t\t};\n\t\t}\n\n\t\t// If we don't have a fallback URL, use the value prop.\n\t\treturn value;\n\t}, [ value ] );\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }\u2026\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tref={ searchInputRef }\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ handleInputChange }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<SearchSuffixControl\n\t\t\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\t\t\tshowActions={ showActions }\n\t\t\t\t\t\t\t\t\tisDisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\tonUnlink={ handleUnlink }\n\t\t\t\t\t\t\t\t\tonSubmit={ handleSubmit }\n\t\t\t\t\t\t\t\t\thelpTextId={ helpTextId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isEntity && helpTextId && (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tid={ helpTextId }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__help\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: entity type (e.g., page, post) */\n\t\t\t\t\t\t\t\t\t__( 'Synced with the selected %s.' ),\n\t\t\t\t\t\t\t\t\tinternalControlValue?.type || 'item'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ previewValue?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\n/**\n * Suffix control component for LinkControl search input.\n * Handles the display of unlink button for entities and submit button for regular links.\n *\n * @param {Object} props - Component props\n * @param {boolean} props.isEntity - Whether the link is bound to an entity\n * @param {boolean} props.showActions - Whether to show action buttons\n * @param {boolean} props.isDisabled - Whether the submit button should be disabled\n * @param {Function} props.onUnlink - Callback when unlink button is clicked\n * @param {Function} props.onSubmit - Callback when submit button is clicked\n * @param {string} props.helpTextId - ID of the help text element for accessibility\n */\nfunction SearchSuffixControl( {\n\tisEntity,\n\tshowActions,\n\tisDisabled,\n\tonUnlink,\n\tonSubmit,\n\thelpTextId,\n} ) {\n\tif ( isEntity ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ticon={ linkOff }\n\t\t\t\tonClick={ onUnlink }\n\t\t\t\taria-describedby={ helpTextId }\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ __( 'Unsync and edit' ) }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( showActions ) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t<Button\n\t\t\t\tonClick={ isDisabled ? noop : onSubmit }\n\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\tsize=\"small\"\n\t\t\t/>\n\t\t</InputControlSuffixWrapper>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn, linkOff } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { isURL, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS, LINK_ENTRY_TYPES } from './constants';\nimport isURLLike, { isHashLink, isRelativePath } from './is-url-like';\nimport normalizeUrl from './normalize-url';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {Function=} onInputChange Callback fired when the search input value changes.\n * Use this for observation only (e.g., to track search state).\n * @property {string=} inputValue Initial value for the search input (uncontrolled).\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n * @property {boolean=} handleEntities Whether to handle entity links (links with ID). When true and a link has an ID, the input will be disabled and show an unlink button.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n * ## Usage Patterns\n *\n * The component does not support a fully controlled implementation,\n * but it does support an observable implementation.\n *\n * ### Uncontrolled (default)\n * The component manages its own search input state:\n * ```jsx\n * <LinkControl value={ link } onChange={ setLink } />\n * ```\n *\n * ### Observable\n * Observe input changes without controlling the value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * ### Uncontrolled with Initial Value\n * Pre-populate the search input with a default value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * inputValue=\"wordpress\"\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonInputChange,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n\thandleEntities = false,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\t// Sets if the URL value is valid when submitted. The value could be set to\n\t// { type: 'invalid', message: 'Please enter a valid URL.' } or { type: 'valid' }.\n\t// When it is undefined, the URL value has not been validated.\n\tconst [ customValidity, setCustomValidity ] = useState( undefined );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst searchInputRef = useRef();\n\t// TODO: Remove entityUrlFallbackRef and previewValue in favor of value prop after taxonomy entity binding\n\t// is stable and returns the correct URL instead of null while resolving when creating the entity.\n\t//\n\t// Preserve the URL from entity suggestions before binding overrides it\n\t// This is due to entity binding not being available immediately after the suggestion is selected.\n\t// The URL can return null, especially for taxonomy entities, while entity binding is being resolved.\n\t// To avoid unnecessary rerenders and focus loss, we preserve the URL from the suggestion and use it\n\t// as a fallback until the entity binding is available.\n\tconst entityUrlFallbackRef = useRef();\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\t// Wrapper for input changes that calls both internal and external handlers\n\tconst handleInputChange = ( newValue ) => {\n\t\tsetInternalURLInputValue( newValue );\n\t\tonInputChange?.( newValue );\n\t};\n\n\t// Compute isEntity internally based on handleEntities prop and presence of ID\n\tconst isEntity = handleEntities && !! internalControlValue?.id;\n\n\t// Generate help text ID for accessibility association\n\tconst baseId = useInstanceId( LinkControl, 'link-control' );\n\tconst helpTextId = isEntity ? `${ baseId }__help` : null;\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\t// Warn when inputValue changes after mount. inputValue only sets the\n\t// initial value. The component is uncontrolled and changes\n\t// from the parent will not update the search input.\n\tconst prevInputValueRef = useRef();\n\tuseEffect( () => {\n\t\tif ( prevInputValueRef.current === undefined ) {\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( prevInputValueRef.current !== propInputValue ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'LinkControl: The inputValue prop is uncontrolled and only sets the initial value. onInputChange is an observer for the input value. Changes to inputValue from the parent will not update the search input.'\n\t\t\t);\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t}\n\t}, [ propInputValue ] );\n\n\t// Trigger validation display when customValidity becomes invalid.\n\t// This effect runs after React has applied the customValidity state update\n\t// and ControlWithError's useEffect has set the native validity on the input.\n\tuseEffect( () => {\n\t\tif ( customValidity?.type === 'invalid' ) {\n\t\t\tconst inputElement = searchInputRef.current;\n\t\t\tif (\n\t\t\t\tinputElement &&\n\t\t\t\ttypeof inputElement.reportValidity === 'function'\n\t\t\t) {\n\t\t\t\tinputElement.reportValidity();\n\t\t\t}\n\t\t}\n\t}, [ customValidity ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state.\n\t */\n\tconst stopEditing = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\t/**\n\t * Validates a URL string using a multi-stage validation process.\n\t * This helper consolidates URL validation logic used throughout the component.\n\t *\n\t * @param {string} urlToValidate - The URL string to validate\n\t * @return {Object} Validation result with isValid boolean and optional errorMessage\n\t */\n\tconst validateUrl = ( urlToValidate ) => {\n\t\tconst invalidResult = {\n\t\t\ttype: 'invalid',\n\t\t\tmessage: __( 'Please enter a valid URL.' ),\n\t\t};\n\n\t\tconst validResult = {\n\t\t\ttype: 'valid',\n\t\t};\n\n\t\tconst trimmedValue = urlToValidate?.trim();\n\n\t\t// If empty or not URL-like, return invalid\n\t\tif ( ! trimmedValue?.length || ! isURLLike( trimmedValue ) ) {\n\t\t\treturn invalidResult;\n\t\t}\n\n\t\t// Hash links (internal anchor links) and relative paths (/, ./, ../) are\n\t\t// valid href values but cannot be validated by the native URL constructor\n\t\t// (which requires absolute URLs). These are already validated by isURLLike.\n\t\t// Skip URL constructor validation for these cases.\n\t\tif ( isHashLink( trimmedValue ) || isRelativePath( trimmedValue ) ) {\n\t\t\treturn validResult;\n\t\t}\n\n\t\t// Perform URL validation using the native URL constructor as the authoritative source.\n\t\t// The native URL constructor is the standard for URL validity - if it accepts a URL,\n\t\t// we should allow it. For URLs without a protocol (e.g., \"www.wordpress.org\"),\n\t\t// prepend \"http://\" before validating, as the URL constructor requires a protocol.\n\t\t//\n\t\t// Note: Protocol URLs (mailto:, tel:, etc.) are also validated by the native\n\t\t// URL constructor, so we don't need special handling for them.\n\t\t//\n\t\t// Note: We rely on the native URL constructor rather than implementing custom TLD\n\t\t// validation to avoid blocking valid URLs. If a URL passes the native constructor,\n\t\t// it's technically valid according to web standards.\n\t\tconst urlToCheck = prependHTTPS( trimmedValue );\n\t\treturn isURL( urlToCheck ) ? validResult : invalidResult;\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Validate URL suggestions (link, mailto, tel, internal) or manually entered URLs.\n\t\t// Entity suggestions (post, page, category, etc.) don't need validation as they come from the database.\n\t\t// However, URL suggestions (created from user input with types like 'link', 'mailto', etc.)\n\t\t// still need validation as they may contain invalid URLs like \"www.wordp\".\n\t\tconst isEntitySuggestion =\n\t\t\tupdatedValue &&\n\t\t\tupdatedValue.id &&\n\t\t\tupdatedValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( updatedValue.type );\n\n\t\tif ( ! isEntitySuggestion ) {\n\t\t\t// URL suggestion (link, mailto, tel, internal) or manually entered URL - validate before submitting\n\t\t\t// Use the URL from the suggestion, or fall back to currentUrlInputValue\n\t\t\tconst urlToValidate = updatedValue?.url || currentUrlInputValue;\n\n\t\t\t// Validate the URL using the shared validation helper\n\t\t\tconst validation = validateUrl( urlToValidate );\n\t\t\tif ( validation.type === 'invalid' ) {\n\t\t\t\tsetCustomValidity( validation );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Validation passed - normalize the URL\n\t\t\tconst { url: normalizedUrl } = normalizeUrl( urlToValidate );\n\t\t\tupdatedValue = {\n\t\t\t\t...updatedValue,\n\t\t\t\turl: normalizedUrl,\n\t\t\t};\n\t\t}\n\n\t\t// Preserve the URL for taxonomy entities before binding overrides it\n\t\tif ( updatedValue?.kind === 'taxonomy' && updatedValue?.url ) {\n\t\t\tentityUrlFallbackRef.current = updatedValue.url;\n\t\t}\n\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\t// Reset validation state when a suggestion is selected\n\t\tsetCustomValidity( undefined );\n\n\t\tstopEditing();\n\t};\n\n\t// Centralized validation function\n\tconst validateAndSetValidity = () => {\n\t\tif ( currentInputIsEmpty ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst trimmedValue = currentUrlInputValue.trim();\n\n\t\t// If the current value is an entity link (has id and type not in LINK_ENTRY_TYPES)\n\t\t// and the URL hasn't changed from the original value, skip validation.\n\t\t// This allows entity links with permalink formats like \"?p=2\" to work without\n\t\t// requiring URL validation when only settings are being changed.\n\t\tconst isEntityLink =\n\t\t\tinternalControlValue &&\n\t\t\tinternalControlValue.id &&\n\t\t\tinternalControlValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( internalControlValue.type );\n\t\tconst urlUnchanged = value?.url === trimmedValue;\n\n\t\tif ( isEntityLink && urlUnchanged ) {\n\t\t\t// Entity link with unchanged URL - skip validation\n\t\t\tsetCustomValidity( undefined );\n\t\t\treturn true;\n\t\t}\n\n\t\t// Validate the URL using the shared validation helper\n\t\tconst validation = validateUrl( currentUrlInputValue );\n\n\t\tif ( validation.type === 'invalid' ) {\n\t\t\tsetCustomValidity( validation );\n\t\t\treturn false;\n\t\t}\n\n\t\t// Valid URL\n\t\tsetCustomValidity( undefined );\n\t\treturn true;\n\t};\n\n\t// Centralized submission function\n\tconst submitUrlValue = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: normalizeUrl( currentUrlInputValue ).url,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t\tsetCustomValidity( undefined );\n\t};\n\n\tconst handleSubmit = () => {\n\t\t// Validate URL before submitting\n\t\tif ( ! validateAndSetValidity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Validation passed - proceed with submission\n\t\tsubmitUrlValue();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\t// Reset validation state\n\t\tsetCustomValidity( undefined );\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst [ shouldFocusSearchInput, setShouldFocusSearchInput ] =\n\t\tuseState( false );\n\n\tconst handleUnlink = () => {\n\t\t// Clear the internal state to remove the ID and re-enable the field\n\t\t// Explicitly set id, kind, and type to undefined so they override\n\t\t// the original values when spread in handleSubmit. This ensures that\n\t\t// when the user types a custom URL and submits, the entity link is\n\t\t// properly severed (not just when selecting a different entity from suggestions).\n\t\tconst { id, kind, type, ...restValue } = internalControlValue;\n\t\tsetInternalControlValue( {\n\t\t\t...restValue,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\n\t\t// Request focus after the component re-renders with the cleared state\n\t\t// We can't focus immediately because the input might still be disabled\n\t\tsetShouldFocusSearchInput( true );\n\t};\n\n\t// Focus the search input when requested, once the component has re-rendered\n\t// This ensures the input is enabled and ready to receive focus\n\tuseEffect( () => {\n\t\tif ( shouldFocusSearchInput ) {\n\t\t\tsearchInputRef.current?.focus();\n\t\t\tsetShouldFocusSearchInput( false );\n\t\t}\n\t}, [ shouldFocusSearchInput ] );\n\n\t// Prioritize internal value (even if empty string), but allow propInputValue to set\n\t// the initial default value.\n\tconst currentUrlInputValue =\n\t\tinternalControlValue?.url !== undefined\n\t\t\t? internalControlValue.url\n\t\t\t: propInputValue || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\t// Reset validation state when the URL value changes\n\tuseEffect( () => {\n\t\tsetCustomValidity( undefined );\n\t}, [ currentUrlInputValue ] );\n\n\tconst isUrlValid = ! customValidity;\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\t// When creating a new link (no existing value), allow submission if input is not empty and URL is valid\n\t// When editing an existing link, also require that the value has changed\n\tconst isDisabled =\n\t\tcurrentInputIsEmpty || ! isUrlValid || ( value && ! valueHasChanges );\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\tconst previewValue = useMemo( () => {\n\t\t// There is a chance that the value is not yet set from the entity binding, so we use the preserved URL.\n\t\tif (\n\t\t\tvalue?.kind === 'taxonomy' &&\n\t\t\t! value?.url &&\n\t\t\tentityUrlFallbackRef.current\n\t\t) {\n\t\t\t// combine the value prop with the preserved URL from the suggestion\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\turl: entityUrlFallbackRef.current,\n\t\t\t};\n\t\t}\n\n\t\t// If we don't have a fallback URL, use the value prop.\n\t\treturn value;\n\t}, [ value ] );\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tref={ searchInputRef }\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ handleInputChange }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<SearchSuffixControl\n\t\t\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\t\t\tshowActions={ showActions }\n\t\t\t\t\t\t\t\t\tisDisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\tonUnlink={ handleUnlink }\n\t\t\t\t\t\t\t\t\tonSubmit={ handleSubmit }\n\t\t\t\t\t\t\t\t\thelpTextId={ helpTextId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isEntity && helpTextId && (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tid={ helpTextId }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__help\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: entity type (e.g., page, post) */\n\t\t\t\t\t\t\t\t\t__( 'Synced with the selected %s.' ),\n\t\t\t\t\t\t\t\t\tinternalControlValue?.type || 'item'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ previewValue?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\n/**\n * Suffix control component for LinkControl search input.\n * Handles the display of unlink button for entities and submit button for regular links.\n *\n * @param {Object} props - Component props\n * @param {boolean} props.isEntity - Whether the link is bound to an entity\n * @param {boolean} props.showActions - Whether to show action buttons\n * @param {boolean} props.isDisabled - Whether the submit button should be disabled\n * @param {Function} props.onUnlink - Callback when unlink button is clicked\n * @param {Function} props.onSubmit - Callback when submit button is clicked\n * @param {string} props.helpTextId - ID of the help text element for accessibility\n */\nfunction SearchSuffixControl( {\n\tisEntity,\n\tshowActions,\n\tisDisabled,\n\tonUnlink,\n\tonSubmit,\n\thelpTextId,\n} ) {\n\tif ( isEntity ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ticon={ linkOff }\n\t\t\t\tonClick={ onUnlink }\n\t\t\t\taria-describedby={ helpTextId }\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ __( 'Unsync and edit' ) }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( showActions ) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t<Button\n\t\t\t\tonClick={ isDisabled ? noop : onSubmit }\n\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\tsize=\"small\"\n\t\t\t/>\n\t\t</InputControlSuffixWrapper>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAOO;AACP,kBAA4B;AAC5B,qBAAqD;AACrD,qBAA8B;AAC9B,iBAAsB;AACtB,sBAAsB;AACtB,8BAAsC;AACtC,kBAAuC;AACvC,yBAA0C;AAC1C,mBAAwC;AACxC,wBAAuB;AACvB,iBAAoC;AAKpC,6BAAsC;AACtC,0BAAmC;AACnC,0BAAwB;AACxB,sBAAyB;AACzB,6BAA0B;AAC1B,gCAA6B;AAC7B,yBAA2B;AAC3B,uBAAwD;AACxD,yBAAsD;AACtD,2BAAyB;AAymBrB;AA3hBJ,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,mBAAmB;AACzB,IAAM,iBAAiB;AAwCvB,SAAS,YAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,iBAAiB;AAAA,EAC7B,mBAAmB,CAAC;AAAA,EACpB,kBAAkB;AAAA,EAClB;AAAA,EACA,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,iBAAiB;AAClB,GAAI;AACH,MAAK,yBAAyB,UAAa,kBAAmB;AAC7D,2BAAuB;AAAA,EACxB;AAEA,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAI1D,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,MAAU;AAElE,QAAM,EAAE,2BAA2B,QAAI,uBAAW,CAAE,WAAY;AAC/D,UAAM,aAAa,OAAQ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,IAAC;AAAA;AAAA,MACA,SAAU,aAAa,OAAO;AAAA,MAC9B,WAAQ,gBAAI,QAAS;AAAA,MACrB,MAAO;AAAA,MACP,WAAU;AAAA,MACV,iBAAgB;AAAA,MAChB,MAAK;AAAA;AAAA,EACN,GACD;AAEF;AAEA,YAAY,aAAa;AACzB,YAAY,wBAAwB;AAEpC,IAAM,oCAAoC,CAAE,UAAW;AACtD,wBAAAC,SAAY,4CAA4C;AAAA,IACvD,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,4CAAC,eAAc,GAAG,OAAQ;AAClC;AAEA,kCAAkC,aAAa,YAAY;AAC3D,kCAAkC,wBACjC,YAAY;AAGb,IAAO,uBAAQ;",
6
6
  "names": ["preferencesStore", "useInternalValue", "useCreatePage", "isURLLike", "normalizeUrl", "clsx", "LinkControlSearchInput", "LinkPreview", "LinkControlSettingsDrawer", "LinkSettings", "HStack", "InputControlSuffixWrapper", "deprecated"]
7
7
  }