@wordpress/block-library 9.12.1-next.082ed6819.0 → 9.13.1-next.cd6172eb0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/block/edit.js +2 -29
- package/build/block/edit.js.map +1 -1
- package/build/cover/edit/index.js +4 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +6 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +2 -2
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +9 -2
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation-submenu/edit.js +3 -0
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/recursion-detector.js +0 -1
- package/build/pattern/recursion-detector.js.map +1 -1
- package/build/query/edit/index.js +2 -2
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +0 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +0 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
- package/build/query/edit/pattern-selection.js.map +1 -0
- package/build/query/edit/query-content.js +5 -8
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +5 -11
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +31 -11
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/separator/deprecated.js +2 -1
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +29 -4
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +5 -0
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +3 -2
- package/build/separator/save.js.map +1 -1
- package/build/social-link/edit.js +35 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/index.js +4 -2
- package/build/social-link/index.js.map +1 -1
- package/build/template-part/edit/import-controls.js +0 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build-module/block/edit.js +3 -30
- package/build-module/block/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +6 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +2 -2
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +3 -0
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +0 -1
- package/build-module/pattern/recursion-detector.js.map +1 -1
- package/build-module/query/edit/index.js +1 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +0 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
- package/build-module/query/edit/pattern-selection.js.map +1 -0
- package/build-module/query/edit/query-content.js +5 -8
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +6 -12
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +31 -13
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/separator/deprecated.js +2 -1
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +32 -7
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +5 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +3 -2
- package/build-module/separator/save.js.map +1 -1
- package/build-module/social-link/edit.js +37 -3
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/index.js +4 -2
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +0 -1
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-style/comments-pagination/editor-rtl.css +1 -0
- package/build-style/comments-pagination/editor.css +1 -0
- package/build-style/comments-pagination/style-rtl.css +1 -0
- package/build-style/comments-pagination/style.css +1 -0
- package/build-style/editor-rtl.css +35 -0
- package/build-style/editor.css +35 -0
- package/build-style/image/style-rtl.css +3 -2
- package/build-style/image/style.css +3 -2
- package/build-style/pullquote/style-rtl.css +1 -0
- package/build-style/pullquote/style.css +1 -0
- package/build-style/query/editor-rtl.css +30 -0
- package/build-style/query/editor.css +30 -0
- package/build-style/social-link/editor-rtl.css +4 -0
- package/build-style/social-link/editor.css +4 -0
- package/build-style/style-rtl.css +5 -2
- package/build-style/style.css +5 -2
- package/build-types/lock-unlock.d.ts +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/package.json +34 -34
- package/src/block/edit.js +6 -51
- package/src/comments-pagination/editor.scss +1 -0
- package/src/comments-pagination/style.scss +1 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/edit/inspector-controls.js +10 -3
- package/src/cover/index.php +2 -2
- package/src/image/style.scss +4 -3
- package/src/list-item/hooks/use-merge.js +2 -2
- package/src/missing/test/edit.native.js +0 -1
- package/src/navigation/README.md +1 -0
- package/src/navigation/edit/deleted-navigation-warning.js +11 -2
- package/src/navigation/index.php +9 -35
- package/src/navigation-submenu/edit.js +5 -0
- package/src/navigation-submenu/index.php +17 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/edit/index.js +1 -1
- package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
- package/src/query/edit/query-content.js +4 -10
- package/src/query/edit/query-placeholder.js +5 -14
- package/src/query/edit/query-toolbar.js +38 -17
- package/src/query/editor.scss +30 -0
- package/src/search/index.php +3 -3
- package/src/separator/block.json +5 -0
- package/src/separator/deprecated.js +1 -0
- package/src/separator/edit.js +28 -3
- package/src/separator/save.js +2 -2
- package/src/separator/test/edit.js +1 -0
- package/src/social-link/block.json +4 -2
- package/src/social-link/edit.js +40 -0
- package/src/social-link/editor.scss +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +0 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
|
@@ -73,7 +73,8 @@ export default function CoverInspectorControls({
|
|
|
73
73
|
setOverlayColor,
|
|
74
74
|
coverRef,
|
|
75
75
|
currentSettings,
|
|
76
|
-
updateDimRatio
|
|
76
|
+
updateDimRatio,
|
|
77
|
+
featuredImage
|
|
77
78
|
}) {
|
|
78
79
|
const {
|
|
79
80
|
useFeaturedImage,
|
|
@@ -106,8 +107,9 @@ export default function CoverInspectorControls({
|
|
|
106
107
|
const image = useSelect(select => id && isImageBackground ? select(coreStore).getMedia(id, {
|
|
107
108
|
context: 'view'
|
|
108
109
|
}) : null, [id, isImageBackground]);
|
|
110
|
+
const currentBackgroundImage = useFeaturedImage ? featuredImage : image;
|
|
109
111
|
function updateImage(newSizeSlug) {
|
|
110
|
-
const newUrl =
|
|
112
|
+
const newUrl = currentBackgroundImage?.media_details?.sizes?.[newSizeSlug]?.source_url;
|
|
111
113
|
if (!newUrl) {
|
|
112
114
|
return null;
|
|
113
115
|
}
|
|
@@ -118,7 +120,7 @@ export default function CoverInspectorControls({
|
|
|
118
120
|
}
|
|
119
121
|
const imageSizeOptions = imageSizes?.filter(({
|
|
120
122
|
slug
|
|
121
|
-
}) =>
|
|
123
|
+
}) => currentBackgroundImage?.media_details?.sizes?.[slug]?.source_url)?.map(({
|
|
122
124
|
name,
|
|
123
125
|
slug
|
|
124
126
|
}) => ({
|
|
@@ -237,7 +239,7 @@ export default function CoverInspectorControls({
|
|
|
237
239
|
}), /*#__PURE__*/_jsx("br", {}), __('Leave empty if decorative.')]
|
|
238
240
|
})
|
|
239
241
|
})
|
|
240
|
-
}),
|
|
242
|
+
}), !!imageSizeOptions?.length && /*#__PURE__*/_jsx(ResolutionTool, {
|
|
241
243
|
value: sizeSlug,
|
|
242
244
|
onChange: updateImage,
|
|
243
245
|
options: imageSizeOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","ExternalLink","FocalPointPicker","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","store","blockEditorStore","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","privateApis","blockEditorPrivateApis","__","useSelect","coreStore","COVER_MIN_HEIGHT","mediaPosition","unlock","useToolsPanelDropdownMenuProps","DEFAULT_MEDIA_SIZE_SLUG","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","cleanEmptyObject","ResolutionTool","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","__next40pxDefaultSize","label","id","isResetValueOnUnitChange","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","sizeSlug","gradientValue","setGradient","getSettings","imageSizes","image","select","getMedia","context","updateImage","newSizeSlug","newUrl","media_details","sizes","source_url","imageSizeOptions","filter","slug","map","name","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","dropdownMenuProps","children","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","length","options","defaultValue","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","resetAllFilter","customOverlayColor","gradient","customGradient","clearable","panelId","newDimRatio","max","step","required","className","dimensions","aspectRatio","newMinHeight","nextUnit"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tExternalLink,\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\n\nconst { cleanEmptyObject, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst imageSizes = getSettings()?.imageSizes;\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getMedia( id, { context: 'view' } )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\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>\n\t\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\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</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\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} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t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AE;QAAS,CAAC,EACtC;UAAEuB,KAAK,EAAE,QAAQ;UAAEvB,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEuB,KAAK,EAAE,WAAW;UAAEvB,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEuB,KAAK,EAAE,WAAW;UAAEvB,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEuB,KAAK,EAAE,SAAS;UAAEvB,KAAK,EAAE;QAAQ,CAAC,EACpC;UAAEuB,KAAK,EAAE,UAAU;UAAEvB,KAAK,EAAE;QAAS,CAAC,CACpC;QACHA,KAAK,EAAG0C,OAAS;QACjB7C,QAAQ,EAAKG,KAAK,IACjB4B,aAAa,CAAE;UAAEc,OAAO,EAAE1C;QAAM,CAAE,CAClC;QACDgG,IAAI,EAAGnB,mBAAmB,CAAEnC,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useMemo","ExternalLink","FocalPointPicker","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","store","blockEditorStore","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","privateApis","blockEditorPrivateApis","__","useSelect","coreStore","COVER_MIN_HEIGHT","mediaPosition","unlock","useToolsPanelDropdownMenuProps","DEFAULT_MEDIA_SIZE_SLUG","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","cleanEmptyObject","ResolutionTool","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","__next40pxDefaultSize","label","id","isResetValueOnUnitChange","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","featuredImage","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","sizeSlug","gradientValue","setGradient","getSettings","imageSizes","image","select","getMedia","context","currentBackgroundImage","updateImage","newSizeSlug","newUrl","media_details","sizes","source_url","imageSizeOptions","filter","slug","map","name","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","dropdownMenuProps","children","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","length","options","defaultValue","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","resetAllFilter","customOverlayColor","gradient","customGradient","clearable","panelId","newDimRatio","max","step","required","className","dimensions","aspectRatio","newMinHeight","nextUnit"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tExternalLink,\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\n\nconst { cleanEmptyObject, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tfeaturedImage,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst imageSizes = getSettings()?.imageSizes;\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getMedia( id, { context: 'view' } )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tconst currentBackgroundImage = useFeaturedImage ? featuredImage : image;\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl =\n\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]\n\t\t\t\t?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) =>\n\t\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ slug ]\n\t\t\t\t\t?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\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>\n\t\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\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</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\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} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,YAAY,EACZC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,4BAA4B,IAAIC,cAAc,EAC9CC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,EACxCC,8CAA8C,IAAIC,gCAAgC,QAC5E,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SACCC,iBAAiB,EACjBC,WAAW,EACXC,KAAK,IAAIC,gBAAgB,EACzBC,2CAA2C,IAAIC,6BAA6B,EAC5EC,yBAAyB,EACzBC,iDAAiD,IAAIC,mCAAmC,EACxFC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASV,KAAK,IAAIW,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,WAAW;AAC3D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,8BAA8B,QAAQ,mBAAmB;AAClE,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AAE;YACda,aAAa,EAAEoF;UAChB,CAAE;QACF,CACD;MAAC,CACa;IAAC,CACC,CAAC,eACpBxI,IAAA,CAACpB,iBAAiB;MAACuI,KAAK,EAAC,UAAU;MAAAjB,QAAA,eAClClG,IAAA,CAAChC,aAAa;QACbuI,uBAAuB;QACvBtE,qBAAqB;QACrBC,KAAK,EAAG3C,EAAE,CAAE,cAAe,CAAG;QAC9ByH,OAAO,EAAG,CACT;UAAE9E,KAAK,EAAE3C,EAAE,CAAE,iBAAkB,CAAC;UAAEoB,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEuB,KAAK,EAAE,UAAU;UAAEvB,KAAK,EAAE;QAAS,CAAC,EACtC;UAAEuB,KAAK,EAAE,QAAQ;UAAEvB,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEuB,KAAK,EAAE,WAAW;UAAEvB,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEuB,KAAK,EAAE,WAAW;UAAEvB,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEuB,KAAK,EAAE,SAAS;UAAEvB,KAAK,EAAE;QAAQ,CAAC,EACpC;UAAEuB,KAAK,EAAE,UAAU;UAAEvB,KAAK,EAAE;QAAS,CAAC,CACpC;QACHA,KAAK,EAAG2C,OAAS;QACjB9C,QAAQ,EAAKG,KAAK,IACjB4B,aAAa,CAAE;UAAEe,OAAO,EAAE3C;QAAM,CAAE,CAClC;QACDkG,IAAI,EAAGnB,mBAAmB,CAAEpC,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -46,7 +46,7 @@ export default function useMerge(clientId, onMerge) {
|
|
|
46
46
|
* return the next list item of the parent list item if it exists.
|
|
47
47
|
*
|
|
48
48
|
* @param {string} id A list item client ID.
|
|
49
|
-
* @return {string
|
|
49
|
+
* @return {?string} The client ID of the next list item.
|
|
50
50
|
*/
|
|
51
51
|
function _getNextId(id) {
|
|
52
52
|
const next = getNextBlockClientId(id);
|
|
@@ -65,7 +65,7 @@ export default function useMerge(clientId, onMerge) {
|
|
|
65
65
|
* line, regardless of indentation level.
|
|
66
66
|
*
|
|
67
67
|
* @param {string} id The client ID of the current list item.
|
|
68
|
-
* @return {string
|
|
68
|
+
* @return {?string} The client ID of the next list item.
|
|
69
69
|
*/
|
|
70
70
|
function getNextId(id) {
|
|
71
71
|
const order = getBlockOrder(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string
|
|
1
|
+
{"version":3,"names":["useRegistry","useDispatch","useSelect","store","blockEditorStore","useOutdentListItem","useMerge","clientId","onMerge","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","mergeBlocks","moveBlocksToPosition","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) {\n\t\t\treturn;\n\t\t}\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {?string} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) {\n\t\t\treturn next;\n\t\t}\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) {\n\t\t\treturn;\n\t\t}\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {?string} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\t// If we are merging with the previous list item, and the\n\t\t\t\t\t// previous list item does not have nested list, move the\n\t\t\t\t\t// nested list to the previous list item.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgetPreviousBlockClientId( clientIdB ) === clientIdA &&\n\t\t\t\t\t\t! getBlockOrder( clientIdA ).length\n\t\t\t\t\t) {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ nestedListClientId ],\n\t\t\t\t\t\t\tclientIdB,\n\t\t\t\t\t\t\tclientIdA\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,yBAAyB;AAExD,eAAe,SAASC,QAAQA,CAAEC,QAAQ,EAA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D,CAAC,MAAM;MACN;MACA;MACA,MAAMC,qBAAqB,GAAGzB,wBAAwB,CAAEH,QAAS,CAAC;MAClE,IAAKe,mBAAmB,CAAEf,QAAS,CAAC,EAAG;QACtCU,eAAe,CAAEV,QAAS,CAAC;MAC5B,CAAC,MAAM,IAAK4B,qBAAqB,EAAG;QACnC,MAAMC,UAAU,GAAGlB,aAAa,CAAEiB,qBAAsB,CAAC;QACzDN,eAAe,CAAEO,UAAU,EAAE7B,QAAS,CAAC;MACxC,CAAC,MAAM;QACNC,OAAO,CAAEoB,OAAQ,CAAC;MACnB;IACD;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -4,17 +4,24 @@
|
|
|
4
4
|
import { Warning } from '@wordpress/block-editor';
|
|
5
5
|
import { Button, Notice } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
7
|
+
import { useState, createInterpolateElement } from '@wordpress/element';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
function DeletedNavigationWarning({
|
|
10
10
|
onCreateNew,
|
|
11
11
|
isNotice = false
|
|
12
12
|
}) {
|
|
13
|
+
const [isButtonDisabled, setIsButtonDisabled] = useState(false);
|
|
14
|
+
const handleButtonClick = () => {
|
|
15
|
+
setIsButtonDisabled(true);
|
|
16
|
+
onCreateNew();
|
|
17
|
+
};
|
|
13
18
|
const message = createInterpolateElement(__('Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'), {
|
|
14
19
|
button: /*#__PURE__*/_jsx(Button, {
|
|
15
20
|
__next40pxDefaultSize: true,
|
|
16
|
-
onClick:
|
|
17
|
-
variant: "link"
|
|
21
|
+
onClick: handleButtonClick,
|
|
22
|
+
variant: "link",
|
|
23
|
+
disabled: isButtonDisabled,
|
|
24
|
+
accessibleWhenDisabled: true
|
|
18
25
|
})
|
|
19
26
|
});
|
|
20
27
|
return isNotice ? /*#__PURE__*/_jsx(Notice, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Warning","Button","Notice","__","createInterpolateElement","jsx","_jsx","DeletedNavigationWarning","onCreateNew","isNotice","message","button","__next40pxDefaultSize","onClick","variant","status","isDismissible","children"],"sources":["@wordpress/block-library/src/navigation/edit/deleted-navigation-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\nfunction DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {\n\tconst message = createInterpolateElement(\n\t\t__(\n\t\t\t'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={
|
|
1
|
+
{"version":3,"names":["Warning","Button","Notice","__","useState","createInterpolateElement","jsx","_jsx","DeletedNavigationWarning","onCreateNew","isNotice","isButtonDisabled","setIsButtonDisabled","handleButtonClick","message","button","__next40pxDefaultSize","onClick","variant","disabled","accessibleWhenDisabled","status","isDismissible","children"],"sources":["@wordpress/block-library/src/navigation/edit/deleted-navigation-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Warning } from '@wordpress/block-editor';\nimport { Button, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\nfunction DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {\n\tconst [ isButtonDisabled, setIsButtonDisabled ] = useState( false );\n\n\tconst handleButtonClick = () => {\n\t\tsetIsButtonDisabled( true );\n\t\tonCreateNew();\n\t};\n\n\tconst message = createInterpolateElement(\n\t\t__(\n\t\t\t'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'\n\t\t),\n\t\t{\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tdisabled={ isButtonDisabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t);\n\n\treturn isNotice ? (\n\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t{ message }\n\t\t</Notice>\n\t) : (\n\t\t<Warning>{ message }</Warning>\n\t);\n}\n\nexport default DeletedNavigationWarning;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,yBAAyB;AACjD,SAASC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,wBAAwB,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExE,SAASC,wBAAwBA,CAAE;EAAEC,WAAW;EAAEC,QAAQ,GAAG;AAAM,CAAC,EAAG;EACtE,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CAAE,GAAGR,QAAQ,CAAE,KAAM,CAAC;EAEnE,MAAMS,iBAAiB,GAAGA,CAAA,KAAM;IAC/BD,mBAAmB,CAAE,IAAK,CAAC;IAC3BH,WAAW,CAAC,CAAC;EACd,CAAC;EAED,MAAMK,OAAO,GAAGT,wBAAwB,CACvCF,EAAE,CACD,yFACD,CAAC,EACD;IACCY,MAAM,eACLR,IAAA,CAACN,MAAM;MACNe,qBAAqB;MACrBC,OAAO,EAAGJ,iBAAmB;MAC7BK,OAAO,EAAC,MAAM;MACdC,QAAQ,EAAGR,gBAAkB;MAC7BS,sBAAsB;IAAA,CACtB;EAEH,CACD,CAAC;EAED,OAAOV,QAAQ,gBACdH,IAAA,CAACL,MAAM;IAACmB,MAAM,EAAC,SAAS;IAACC,aAAa,EAAG,KAAO;IAAAC,QAAA,EAC7CT;EAAO,CACF,CAAC,gBAETP,IAAA,CAACP,OAAO;IAAAuB,QAAA,EAAGT;EAAO,CAAW,CAC7B;AACF;AAEA,eAAeN,wBAAwB","ignoreList":[]}
|
|
@@ -396,6 +396,9 @@ export default function NavigationSubmenuEdit({
|
|
|
396
396
|
setOpenedBy(ref.current);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
+
}), description && /*#__PURE__*/_jsx("span", {
|
|
400
|
+
className: "wp-block-navigation-item__description",
|
|
401
|
+
children: description
|
|
399
402
|
}), !openSubmenusOnClick && isLinkOpen && /*#__PURE__*/_jsx(LinkUI, {
|
|
400
403
|
clientId: clientId,
|
|
401
404
|
link: attributes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","useDispatch","PanelBody","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","useState","useEffect","useRef","link","linkIcon","removeSubmenu","speak","createBlock","useMergeRefs","usePrevious","ItemSubmenuIcon","LinkUI","updateAttributes","getColors","getNavigationChildBlockProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","innerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","children","icon","shortcut","onClick","currentTarget","disabled","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","descriptionValue","help","titleValue","relValue","identifier","onMerge","placeholder","withoutInteractiveFormatting","allowedFormats","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel, title } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propogation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ label || '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,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AAE,IAAK,CAAC;YACpB,CAAC,MAAM;cACNJ,WAAW,CAAEX,QAAS,CAAC;YACxB;UACD,CAAG;UACHqG,MAAM,EAAGrF,aAAe;UACxBsF,QAAQ,EAAGA,CAAA,KAAM;YAChB1G,aAAa,CAAE;cAAEM,GAAG,EAAE;YAAG,CAAE,CAAC;YAC5BzC,KAAK,CAAElB,EAAE,CAAE,eAAgB,CAAC,EAAE,WAAY,CAAC;UAC5C,CAAG;UACHgJ,QAAQ,EAAKgB,YAAY,IAAM;YAC9BxI,gBAAgB,CACfwI,YAAY,EACZ3G,aAAa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACa,CAAC,EACd,CAAEY,eAAe,IAAIE,mBAAmB,kBACzCrC,IAAA;QAAMyF,SAAS,EAAC,mCAAmC;QAAAkB,QAAA,eAClD3G,IAAA,CAACN,eAAe,IAAE;MAAC,CACd,CACN,eACDM,IAAA;QAAA,GAAUiG;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","useDispatch","PanelBody","TextControl","TextareaControl","ToolbarButton","ToolbarGroup","displayShortcut","isKeyboardEvent","__","BlockControls","InnerBlocks","useInnerBlocksProps","InspectorControls","RichText","useBlockProps","store","blockEditorStore","getColorClassName","isURL","prependHTTP","useState","useEffect","useRef","link","linkIcon","removeSubmenu","speak","createBlock","useMergeRefs","usePrevious","ItemSubmenuIcon","LinkUI","updateAttributes","getColors","getNavigationChildBlockProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","NavigationSubmenuEdit","attributes","isSelected","setAttributes","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","__unstableMarkNextChangeAsNotPersistent","replaceBlock","selectBlock","isLinkOpen","setIsLinkOpen","openedBy","setOpenedBy","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","parentCount","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasChildren","selectedBlockHasChildren","onlyDescendantIsEmptyLink","select","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","getBlockCount","getBlockOrder","_onlyDescendantIsEmptyLink","selectedBlockId","selectedBlockChildren","length","singleBlock","prevHasChildren","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","primary","preventDefault","stopPropagation","blockProps","className","style","color","innerBlocksColors","allowedBlocks","filter","blockName","navigationChildBlockProps","innerBlocksProps","defaultBlock","directInsert","__experimentalCaptureToolbars","renderAppender","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","children","icon","shortcut","onClick","currentTarget","disabled","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","labelValue","autoComplete","urlValue","descriptionValue","help","titleValue","relValue","identifier","onMerge","placeholder","withoutInteractiveFormatting","allowedFormats","onClose","anchor","onRemove","updatedValue"],"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\nimport { useMergeRefs, usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { LinkUI } from '../navigation-link/link-ui';\nimport { updateAttributes } from '../navigation-link/update-attributes';\nimport {\n\tgetColors,\n\tgetNavigationChildBlockProps,\n} from '../navigation/edit/utils';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/navigation-submenu',\n\t'core/page-list',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { label, url, description, rel, title } = attributes;\n\n\tconst { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)\n\tconst [ openedBy, setOpenedBy ] = useState( null );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tparentCount,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasChildren,\n\t\tselectedBlockHasChildren,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst selectedBlockChildren = getBlockOrder( selectedBlockId );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockChildren?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockChildren[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentCount: getBlockParentsByBlockName(\n\t\t\t\t\tclientId,\n\t\t\t\t\t'core/navigation-submenu'\n\t\t\t\t).length,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tselectedBlockHasChildren: !! selectedBlockChildren?.length,\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst prevHasChildren = usePrevious( hasChildren );\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, parentCount > 0 );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\t// Required to prevent the command center from opening,\n\t\t\t// as it shares the CMD+K shortcut.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/59845.\n\t\t\tevent.preventDefault();\n\t\t\t// If we don't stop propogation, this event bubbles up to the parent submenu item\n\t\t\tevent.stopPropagation();\n\t\t\tsetIsLinkOpen( true );\n\t\t\tsetOpenedBy( ref.current );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus.\n\tconst innerBlocksColors = getColors( context, true );\n\n\tconst allowedBlocks =\n\t\tparentCount >= maxNestingLevel\n\t\t\t? ALLOWED_BLOCKS.filter(\n\t\t\t\t\t( blockName ) => blockName !== 'core/navigation-submenu'\n\t\t\t )\n\t\t\t: ALLOWED_BLOCKS;\n\n\tconst navigationChildBlockProps =\n\t\tgetNavigationChildBlockProps( innerBlocksColors );\n\tconst innerBlocksProps = useInnerBlocksProps( navigationChildBlockProps, {\n\t\tallowedBlocks,\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\n\t\t// Ensure block toolbar is not too far removed from item\n\t\t// being edited.\n\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t__experimentalCaptureToolbars: true,\n\n\t\trenderAppender:\n\t\t\tisSelected ||\n\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\thasChildren\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: false,\n\t} );\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tuseEffect( () => {\n\t\t// If block becomes empty, transform to Navigation Link.\n\t\tif ( ! hasChildren && prevHasChildren ) {\n\t\t\t// This side-effect should not create an undo level as those should\n\t\t\t// only be created via user interactions.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\ttransformToLink();\n\t\t}\n\t}, [ hasChildren, prevHasChildren ] );\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasChildren || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( event.currentTarget );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tdisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-link/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ label || '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Additional information to help clarify the purpose of the link.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Rel attribute' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The relationship of the linked URL as space-separated link types.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\tsetOpenedBy( ref.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\t\tsetIsLinkOpen( false );\n\t\t\t\t\t\t\t\tif ( openedBy ) {\n\t\t\t\t\t\t\t\t\topenedBy.focus();\n\t\t\t\t\t\t\t\t\tsetOpenedBy( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\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) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,SAAS,EACTC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SAASC,eAAe,EAAEC,eAAe,QAAQ,qBAAqB;AACtE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,aAAa,EACbC,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,QAAQ,EACRC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,iBAAiB,QACX,yBAAyB;AAChC,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AAChE,SAASC,IAAI,IAAIC,QAAQ,EAAEC,aAAa,QAAQ,kBAAkB;AAClE,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;;AAE9D;AACA;AACA;AACA,SAASC,eAAe,QAAQ,SAAS;AACzC,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SACCC,SAAS,EACTC,4BAA4B,QACtB,0BAA0B;AAAC,SAAAC,GAAA,IAA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,GAAG,EAAG;cACrCW,aAAa,CAAE,IAAK,CAAC;cACrBE,WAAW,CAAEK,GAAG,CAACpC,OAAQ,CAAC;YAC3B;UACD;QAAG,CACH,CAAC,EACAmB,WAAW,iBACZhC,IAAA;UAAMyF,SAAS,EAAC,uCAAuC;UAAAkB,QAAA,EACpD3E;QAAW,CACR,CACN,EACC,CAAEK,mBAAmB,IAAII,UAAU,iBACpCzC,IAAA,CAACL,MAAM;UACNkC,QAAQ,EAAGA,QAAU;UACrB1C,IAAI,EAAGoC,UAAY;UACnB0G,OAAO,EAAGA,CAAA,KAAM;YACfvF,aAAa,CAAE,KAAM,CAAC;YACtB,IAAKC,QAAQ,EAAG;cACfA,QAAQ,CAAC4B,KAAK,CAAC,CAAC;cAChB3B,WAAW,CAAE,IAAK,CAAC;YACpB,CAAC,MAAM;cACNJ,WAAW,CAAEX,QAAS,CAAC;YACxB;UACD,CAAG;UACHqG,MAAM,EAAGrF,aAAe;UACxBsF,QAAQ,EAAGA,CAAA,KAAM;YAChB1G,aAAa,CAAE;cAAEM,GAAG,EAAE;YAAG,CAAE,CAAC;YAC5BzC,KAAK,CAAElB,EAAE,CAAE,eAAgB,CAAC,EAAE,WAAY,CAAC;UAC5C,CAAG;UACHgJ,QAAQ,EAAKgB,YAAY,IAAM;YAC9BxI,gBAAgB,CACfwI,YAAY,EACZ3G,aAAa,EACbF,UACD,CAAC;UACF;QAAG,CACH,CACD;MAAA,CACa,CAAC,EACd,CAAEY,eAAe,IAAIE,mBAAmB,kBACzCrC,IAAA;QAAMyF,SAAS,EAAC,mCAAmC;QAAAkB,QAAA,eAClD3G,IAAA,CAACN,eAAe,IAAE;MAAC,CACd,CACN,eACDM,IAAA;QAAA,GAAUiG;MAAgB,CAAI,CAAC;IAAA,CAC3B,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","cachedParsers","WeakMap","useParsePatternDependencies","registry","has","deps","Map","set","parsePatternDependencies","bind","get","name","blocks","queue","length","block","shift","innerBlock","_block$innerBlocks","innerBlocks","unshift","registerDependency","attributes","slug","a","b","Set","add","hasCycle","TypeError","visitedNodes","currentPath","_deps$get","dependencies","dependency","delete"],"sources":["@wordpress/block-library/src/pattern/recursion-detector.js"],"sourcesContent":["/**\n * THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE.\n *\n * This is because this approach for preventing infinite loops due to\n * recursively rendering blocks is specific to the way that the `core/pattern`\n * block behaves in the editor. Any other block types that deal with recursion\n * SHOULD USE THE STANDARD METHOD for avoiding loops:\n *\n * @see https://github.com/WordPress/gutenberg/pull/31455\n * @see packages/block-editor/src/components/recursion-provider/README.md\n */\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Naming is hard.\n *\n * @see useParsePatternDependencies\n *\n * @type {WeakMap<Object, Function>}\n */\nconst cachedParsers = new WeakMap();\n\n/**\n * Hook used by PatternEdit to parse block patterns. It returns a function that\n * takes a pattern and returns nothing but throws an error if the pattern is\n * recursive.\n *\n * @example\n * ```js\n * const parsePatternDependencies = useParsePatternDependencies();\n * parsePatternDependencies( selectedPattern );\n * ```\n *\n * @see parsePatternDependencies\n *\n * @return {Function} A function to parse block patterns.\n */\nexport function useParsePatternDependencies() {\n\tconst registry = useRegistry();\n\n\t// Instead of caching maps, go straight to the point and cache bound\n\t// functions. Each of those functions is bound to a different Map that will\n\t// keep track of patterns in the context of the given registry.\n\tif ( ! cachedParsers.has( registry ) ) {\n\t\tconst deps = new Map();\n\t\tcachedParsers.set(\n\t\t\tregistry,\n\t\t\tparsePatternDependencies.bind( null, deps )\n\t\t);\n\t}\n\treturn cachedParsers.get( registry );\n}\n\n/**\n * Parse a given pattern and traverse its contents to detect any subsequent\n * patterns on which it may depend. Such occurrences will be added to an\n * internal dependency graph. If a circular dependency is detected, an\n * error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {Object} pattern Pattern.\n * @param {string} pattern.name Pattern name.\n * @param {Array} pattern.blocks Pattern's block list.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function parsePatternDependencies( deps, { name, blocks } ) {\n\tconst queue = [ ...blocks ];\n\twhile ( queue.length ) {\n\t\tconst block = queue.shift();\n\t\tfor ( const innerBlock of block.innerBlocks ?? [] ) {\n\t\t\tqueue.unshift( innerBlock );\n\t\t}\n\t\tif ( block.name === 'core/pattern' ) {\n\t\t\tregisterDependency( deps, name, block.attributes.slug );\n\t\t}\n\t}\n}\n\n/**\n * Declare that pattern `a` depends on pattern `b`. If a circular\n * dependency is detected, an error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} a Slug for pattern A.\n * @param {string} b Slug for pattern B.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function registerDependency( deps, a, b ) {\n\tif ( ! deps.has( a ) ) {\n\t\tdeps.set( a, new Set() );\n\t}\n\tdeps.get( a ).add( b );\n\tif ( hasCycle( deps, a ) ) {\n\t\tthrow new TypeError(\n\t\t\t`Pattern ${ a } has a circular dependency and cannot be rendered.`\n\t\t);\n\t}\n}\n\n/**\n * Determine if a given pattern has circular dependencies on other patterns.\n * This will be determined by running a depth-first search on the current state\n * of the graph represented by `patternDependencies`.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} slug Pattern slug.\n * @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph.\n * @param {Set<string>} [currentPath] Set to track and backtrack graph paths.\n * @return {boolean} Whether any cycle was found.\n */\nfunction hasCycle(\n\tdeps,\n\tslug,\n\tvisitedNodes = new Set(),\n\tcurrentPath = new Set()\n) {\n\tvisitedNodes.add( slug );\n\tcurrentPath.add( slug );\n\n\tconst dependencies = deps.get( slug ) ?? new Set();\n\n\tfor ( const dependency of dependencies ) {\n\t\tif ( ! visitedNodes.has( dependency ) ) {\n\t\t\tif ( hasCycle( deps, dependency, visitedNodes, currentPath ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if ( currentPath.has( dependency ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Remove the current node from the current path when backtracking\n\tcurrentPath.delete( slug );\n\treturn false;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["useRegistry","cachedParsers","WeakMap","useParsePatternDependencies","registry","has","deps","Map","set","parsePatternDependencies","bind","get","name","blocks","queue","length","block","shift","innerBlock","_block$innerBlocks","innerBlocks","unshift","registerDependency","attributes","slug","a","b","Set","add","hasCycle","TypeError","visitedNodes","currentPath","_deps$get","dependencies","dependency","delete"],"sources":["@wordpress/block-library/src/pattern/recursion-detector.js"],"sourcesContent":["/**\n * THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE.\n *\n * This is because this approach for preventing infinite loops due to\n * recursively rendering blocks is specific to the way that the `core/pattern`\n * block behaves in the editor. Any other block types that deal with recursion\n * SHOULD USE THE STANDARD METHOD for avoiding loops:\n *\n * @see https://github.com/WordPress/gutenberg/pull/31455\n * @see packages/block-editor/src/components/recursion-provider/README.md\n */\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Naming is hard.\n *\n * @see useParsePatternDependencies\n *\n * @type {WeakMap<Object, Function>}\n */\nconst cachedParsers = new WeakMap();\n\n/**\n * Hook used by PatternEdit to parse block patterns. It returns a function that\n * takes a pattern and returns nothing but throws an error if the pattern is\n * recursive.\n *\n * @example\n * ```js\n * const parsePatternDependencies = useParsePatternDependencies();\n * parsePatternDependencies( selectedPattern );\n * ```\n *\n * @see parsePatternDependencies\n *\n * @return {Function} A function to parse block patterns.\n */\nexport function useParsePatternDependencies() {\n\tconst registry = useRegistry();\n\n\t// Instead of caching maps, go straight to the point and cache bound\n\t// functions. Each of those functions is bound to a different Map that will\n\t// keep track of patterns in the context of the given registry.\n\tif ( ! cachedParsers.has( registry ) ) {\n\t\tconst deps = new Map();\n\t\tcachedParsers.set(\n\t\t\tregistry,\n\t\t\tparsePatternDependencies.bind( null, deps )\n\t\t);\n\t}\n\treturn cachedParsers.get( registry );\n}\n\n/**\n * Parse a given pattern and traverse its contents to detect any subsequent\n * patterns on which it may depend. Such occurrences will be added to an\n * internal dependency graph. If a circular dependency is detected, an\n * error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {Object} pattern Pattern.\n * @param {string} pattern.name Pattern name.\n * @param {Array} pattern.blocks Pattern's block list.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function parsePatternDependencies( deps, { name, blocks } ) {\n\tconst queue = [ ...blocks ];\n\twhile ( queue.length ) {\n\t\tconst block = queue.shift();\n\t\tfor ( const innerBlock of block.innerBlocks ?? [] ) {\n\t\t\tqueue.unshift( innerBlock );\n\t\t}\n\t\tif ( block.name === 'core/pattern' ) {\n\t\t\tregisterDependency( deps, name, block.attributes.slug );\n\t\t}\n\t}\n}\n\n/**\n * Declare that pattern `a` depends on pattern `b`. If a circular\n * dependency is detected, an error will be thrown.\n *\n * EXPORTED FOR TESTING PURPOSES ONLY.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} a Slug for pattern A.\n * @param {string} b Slug for pattern B.\n *\n * @throws {Error} If a circular dependency is detected.\n */\nexport function registerDependency( deps, a, b ) {\n\tif ( ! deps.has( a ) ) {\n\t\tdeps.set( a, new Set() );\n\t}\n\tdeps.get( a ).add( b );\n\tif ( hasCycle( deps, a ) ) {\n\t\tthrow new TypeError(\n\t\t\t`Pattern ${ a } has a circular dependency and cannot be rendered.`\n\t\t);\n\t}\n}\n\n/**\n * Determine if a given pattern has circular dependencies on other patterns.\n * This will be determined by running a depth-first search on the current state\n * of the graph represented by `patternDependencies`.\n *\n * @param {Map<string, Set<string>>} deps Map of pattern dependencies.\n * @param {string} slug Pattern slug.\n * @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph.\n * @param {Set<string>} [currentPath] Set to track and backtrack graph paths.\n * @return {boolean} Whether any cycle was found.\n */\nfunction hasCycle(\n\tdeps,\n\tslug,\n\tvisitedNodes = new Set(),\n\tcurrentPath = new Set()\n) {\n\tvisitedNodes.add( slug );\n\tcurrentPath.add( slug );\n\n\tconst dependencies = deps.get( slug ) ?? new Set();\n\n\tfor ( const dependency of dependencies ) {\n\t\tif ( ! visitedNodes.has( dependency ) ) {\n\t\t\tif ( hasCycle( deps, dependency, visitedNodes, currentPath ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if ( currentPath.has( dependency ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Remove the current node from the current path when backtracking\n\tcurrentPath.delete( slug );\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,2BAA2BA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAGJ,WAAW,CAAC,CAAC;;EAE9B;EACA;EACA;EACA,IAAK,CAAEC,aAAa,CAACI,GAAG,CAAED,QAAS,CAAC,EAAG;IACtC,MAAME,IAAI,GAAG,IAAIC,GAAG,CAAC,CAAC;IACtBN,aAAa,CAACO,GAAG,CAChBJ,QAAQ,EACRK,wBAAwB,CAACC,IAAI,CAAE,IAAI,EAAEJ,IAAK,CAC3C,CAAC;EACF;EACA,OAAOL,aAAa,CAACU,GAAG,CAAEP,QAAS,CAAC;AACrC;;AAEA;AACA;AACA;AACA;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,GAAG,CAAC,CAAC,EACxBK,WAAW,GAAG,IAAIL,GAAG,CAAC,CAAC,EACtB;EAAA,IAAAM,SAAA;EACDF,YAAY,CAACH,GAAG,CAAEJ,IAAK,CAAC;EACxBQ,WAAW,CAACJ,GAAG,CAAEJ,IAAK,CAAC;EAEvB,MAAMU,YAAY,IAAAD,SAAA,GAAG3B,IAAI,CAACK,GAAG,CAAEa,IAAK,CAAC,cAAAS,SAAA,cAAAA,SAAA,GAAI,IAAIN,GAAG,CAAC,CAAC;EAElD,KAAM,MAAMQ,UAAU,IAAID,YAAY,EAAG;IACxC,IAAK,CAAEH,YAAY,CAAC1B,GAAG,CAAE8B,UAAW,CAAC,EAAG;MACvC,IAAKN,QAAQ,CAAEvB,IAAI,EAAE6B,UAAU,EAAEJ,YAAY,EAAEC,WAAY,CAAC,EAAG;QAC9D,OAAO,IAAI;MACZ;IACD,CAAC,MAAM,IAAKA,WAAW,CAAC3B,GAAG,CAAE8B,UAAW,CAAC,EAAG;MAC3C,OAAO,IAAI;IACZ;EACD;;EAEA;EACAH,WAAW,CAACI,MAAM,CAAEZ,IAAK,CAAC;EAC1B,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
10
10
|
*/
|
|
11
11
|
import QueryContent from './query-content';
|
|
12
12
|
import QueryPlaceholder from './query-placeholder';
|
|
13
|
-
import PatternSelectionModal from './pattern-selection
|
|
13
|
+
import { PatternSelectionModal } from './pattern-selection';
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const QueryEdit = props => {
|
|
16
16
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useState","store","blockEditorStore","QueryContent","QueryPlaceholder","PatternSelectionModal","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","QueryEdit","props","clientId","attributes","isPatternSelectionModalOpen","setIsPatternSelectionModalOpen","hasInnerBlocks","select","getBlocks","length","Component","children","openPatternSelectionModal"],"sources":["@wordpress/block-library/src/query/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport QueryContent from './query-content';\nimport QueryPlaceholder from './query-placeholder';\nimport PatternSelectionModal from './pattern-selection
|
|
1
|
+
{"version":3,"names":["useSelect","useState","store","blockEditorStore","QueryContent","QueryPlaceholder","PatternSelectionModal","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","QueryEdit","props","clientId","attributes","isPatternSelectionModalOpen","setIsPatternSelectionModalOpen","hasInnerBlocks","select","getBlocks","length","Component","children","openPatternSelectionModal"],"sources":["@wordpress/block-library/src/query/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport QueryContent from './query-content';\nimport QueryPlaceholder from './query-placeholder';\nimport { PatternSelectionModal } from './pattern-selection';\n\nconst QueryEdit = ( props ) => {\n\tconst { clientId, attributes } = props;\n\tconst [ isPatternSelectionModalOpen, setIsPatternSelectionModalOpen ] =\n\t\tuseState( false );\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).getBlocks( clientId ).length,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? QueryContent : QueryPlaceholder;\n\treturn (\n\t\t<>\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\topenPatternSelectionModal={ () =>\n\t\t\t\t\tsetIsPatternSelectionModalOpen( true )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isPatternSelectionModalOpen && (\n\t\t\t\t<PatternSelectionModal\n\t\t\t\t\tclientId={ clientId }\n\t\t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,CACD,CACD;EAAA,CACA,CAAC;AAEL,CAAC;AAED,eAAeL,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","FormTokenField","useSelect","store","coreStore","getEntitiesInfo","jsx","_jsx","AUTHORS_QUERY","who","per_page","_fields","context","AuthorControl","value","onChange","authorsList","select","getUsers","authorsInfo","normalizedValue","toString","split","sanitizedValue","reduce","accumulator","authorId","author","mapById","push","id","name","getIdByValue","entitiesMappedByName","authorValue","onAuthorChange","newValue","ids","Array","from","mapByName","add","Set","join","label","suggestions","names","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/author-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenFiels` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonChange={ onAuthorChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n\nexport default AuthorControl;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["__","FormTokenField","useSelect","store","coreStore","getEntitiesInfo","jsx","_jsx","AUTHORS_QUERY","who","per_page","_fields","context","AuthorControl","value","onChange","authorsList","select","getUsers","authorsInfo","normalizedValue","toString","split","sanitizedValue","reduce","accumulator","authorId","author","mapById","push","id","name","getIdByValue","entitiesMappedByName","authorValue","onAuthorChange","newValue","ids","Array","from","mapByName","add","Set","join","label","suggestions","names","__experimentalShowHowTo","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/author-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenFiels` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonChange={ onAuthorChange }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n\nexport default AuthorControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,eAAe,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9C,MAAMC,aAAa,GAAG;EACrBC,GAAG,EAAE,SAAS;EACdC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;AAED,SAASC,aAAaA,CAAE;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAG;EAC7C,MAAMC,WAAW,GAAGd,SAAS,CAAIe,MAAM,IAAM;IAC5C,MAAM;MAAEC;IAAS,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACxC,OAAOc,QAAQ,CAAEV,aAAc,CAAC;EACjC,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEQ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EACA,MAAMG,WAAW,GAAGd,eAAe,CAAEW,WAAY,CAAC;EAClD;AACD;AACA;AACA;AACA;EACC,MAAMI,eAAe,GAAG,CAAEN,KAAK,GAAG,EAAE,GAAGA,KAAK,CAACO,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;EACpE;EACA;EACA,MAAMC,cAAc,GAAGH,eAAe,CAACI,MAAM,CAC5C,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IAC5B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