@wordpress/edit-site 5.19.12 → 5.19.13

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.
@@ -255,14 +255,7 @@ function ScreenBlock({
255
255
  inheritedValue: inheritedStyleWithLayout,
256
256
  value: styleWithLayout,
257
257
  onChange: setStyle,
258
- settings: {
259
- ...settings,
260
- color: {
261
- ...settings.color,
262
- customDuotone: false //TO FIX: Custom duotone only works on the block level right now
263
- }
264
- },
265
-
258
+ settings: settings,
266
259
  includeLayoutControls: true
267
260
  }), hasImageSettingsPanel && (0, _element.createElement)(ImageSettingsPanel, {
268
261
  onChange: onChangeLightbox,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_blockEditor","_data","_coreData","_components","_i18n","_header","_interopRequireDefault","_blockPreviewPanel","_lockUnlock","_subtitle","_variationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","hasSplitBorders","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","unlock","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","getBlockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","useBlockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","useSelect","select","_globalStyles$_links$","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","useMemo","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","default","title","label","className","__experimentalVStack","__","VariationsPanel","inheritedValue","value","onChange","includeLayoutControls","customDuotone","PanelBody","initialOpen","sprintf","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";;;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AAFA,IAAAC,OAAA,GAAAD,OAAA;AAC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gB,CACjC,CACS,CAEX,CAAC;AAEL;AAAC,IAAAqE,QAAA,GAEc7E,WAAW;AAAA8E,OAAA,CAAAhB,OAAA,GAAAe,QAAA"}
1
+ {"version":3,"names":["_element","require","_blocks","_blockEditor","_data","_coreData","_components","_i18n","_header","_interopRequireDefault","_blockPreviewPanel","_lockUnlock","_subtitle","_variationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","hasSplitBorders","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","unlock","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","getBlockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","useBlockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","useSelect","select","_globalStyles$_links$","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","useMemo","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","default","title","label","className","__experimentalVStack","__","VariationsPanel","inheritedValue","value","onChange","includeLayoutControls","PanelBody","initialOpen","sprintf","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";;;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AAFA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAtBA;AACA;AACA;;AAaA;AACA;AACA;;AAOA,SAASa,kBAAkBA,CAAEC,MAAM,EAAG;EACrC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAOA,MAAM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EAAGA,QAAU;IACrB2D,qBAAqB;EAAA,CACrB,CACD,EACC1C,qBAAqB,IACtB,IAAApF,QAAA,CAAAkH,aAAA,EAACjE,kBAAkB;IAClB4E,QAAQ,EAAGlB,gBAAkB;IAC7BiB,KAAK,EAAG5D,YAAc;IACtB2D,cAAc,EAAGxD;EAAU,CAC3B,CACD,EAECoB,UAAU,IACX,IAAAvF,QAAA,CAAAkH,aAAA,EAAC5G,WAAA,CAAAyH,SAAS;IAACV,KAAK,EAAG,IAAAI,QAAE,EAAE,UAAW,CAAG;IAACO,WAAW,EAAG;EAAO,GAC1D,IAAAhI,QAAA,CAAAkH,aAAA,aACG,IAAAe,aAAO;EACR;EACA,IAAAR,QAAE,EACD,2IACD,CAAC,EACDrD,SAAS,EAAEiD,KACZ,CACE,CAAC,EACJ,IAAArH,QAAA,CAAAkH,aAAA,EAAC/D,mBAAmB;IACnByE,KAAK,EAAGzG,KAAO;IACf0G,QAAQ,EAAG9D,QAAU;IACrB4D,cAAc,EAAG7D;EAAgB,CACjC,CACS,CAEX,CAAC;AAEL;AAAC,IAAAoE,QAAA,GAEc5E,WAAW;AAAA6E,OAAA,CAAAf,OAAA,GAAAc,QAAA"}
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _element = require("@wordpress/element");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _downloadjs = _interopRequireDefault(require("downloadjs"));
11
10
  var _changeCase = require("change-case");
12
11
  var _blockEditor = require("@wordpress/block-editor");
13
12
  var _components = require("@wordpress/components");
@@ -34,6 +33,26 @@ var _lockUnlock = require("../../lock-unlock");
34
33
  * Internal dependencies
35
34
  */
36
35
 
36
+ /**
37
+ * Downloads a file.
38
+ * Also used in packages/list-reusable-blocks/src/utils/file.js.
39
+ *
40
+ * @param {string} fileName File Name.
41
+ * @param {string} content File Content.
42
+ * @param {string} contentType File mime type.
43
+ */
44
+ function download(fileName, content, contentType) {
45
+ const file = new window.Blob([content], {
46
+ type: contentType
47
+ });
48
+ const a = document.createElement('a');
49
+ a.href = URL.createObjectURL(file);
50
+ a.download = fileName;
51
+ a.style.display = 'none';
52
+ document.body.appendChild(a);
53
+ a.click();
54
+ document.body.removeChild(a);
55
+ }
37
56
  const {
38
57
  useGlobalStyle
39
58
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
@@ -103,7 +122,7 @@ function GridItem({
103
122
  content: item.patternBlock.content.raw,
104
123
  syncStatus: item.patternBlock.wp_pattern_sync_status
105
124
  };
106
- return (0, _downloadjs.default)(JSON.stringify(json, null, 2), `${(0, _changeCase.paramCase)(item.title || item.name)}.json`, 'application/json');
125
+ return download(`${(0, _changeCase.paramCase)(item.title || item.name)}.json`, JSON.stringify(json, null, 2), 'application/json');
107
126
  };
108
127
 
109
128
  // Only custom patterns or custom template parts can be renamed or deleted.
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_downloadjs","_changeCase","_blockEditor","_components","_data","_i18n","_icons","_notices","_reusableBlocks","_renameMenuItem","_duplicateMenuItem","_constants","_store","_link","_lockUnlock","useGlobalStyle","unlock","blockEditorPrivateApis","templatePartIcons","header","footer","uncategorized","GridItem","categoryId","item","props","descriptionId","useId","isDeleteDialogOpen","setIsDeleteDialogOpen","useState","backgroundColor","removeTemplate","useDispatch","editSiteStore","__experimentalDeleteReusableBlock","reusableBlocksStore","createErrorNotice","createSuccessNotice","noticesStore","isUserPattern","type","PATTERN_TYPES","user","isNonUserPattern","theme","isTemplatePart","TEMPLATE_PART_POST_TYPE","onClick","useLink","postType","postId","id","name","categoryType","isEmpty","blocks","length","patternClassNames","classnames","previewClassNames","deletePattern","sprintf","__","title","error","errorMessage","message","code","deleteItem","exportAsJSON","json","__file","content","patternBlock","raw","syncStatus","wp_pattern_sync_status","downloadjs","JSON","stringify","kebabCase","isCustomPattern","isCustom","hasThemeFile","templatePart","has_theme_file","ariaDescriptions","push","description","itemIcon","PATTERN_SYNC_TYPES","full","symbol","undefined","confirmButtonText","confirmPrompt","additionalStyles","css","createElement","className","map","_","index","join","BlockPreview","ariaDescription","key","hidden","__experimentalHStack","justify","alignment","spacing","Tooltip","placement","text","Icon","icon","Flex","as","gap","__experimentalHeading","level","Button","variant","tabIndex","lockSmall","size","DropdownMenu","moreVertical","label","popoverProps","toggleProps","describedBy","onClose","MenuGroup","default","MenuItem","isDestructive","__experimentalConfirmDialog","onConfirm","onCancel","_default","memo","exports"],"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport downloadjs from 'downloadjs';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId, memo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled as uncategorized,\n\tsymbol,\n\tmoreVertical,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport RenameMenuItem from './rename-menu-item';\nimport DuplicateMenuItem from './duplicate-menu-item';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n} from '../../utils/constants';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst templatePartIcons = { header, footer, uncategorized };\n\nfunction GridItem( { categoryId, item, ...props } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\tconst isNonUserPattern = item.type === PATTERN_TYPES.theme;\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: isUserPattern ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,\n\t} );\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-patterns__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-patterns__preview', {\n\t\t'is-inactive': isNonUserPattern,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The pattern's title e.g. 'Call to action'.\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\titem.title\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'edit-site-patterns-error',\n\t\t\t} );\n\t\t}\n\t};\n\tconst deleteItem = () =>\n\t\tisTemplatePart ? removeTemplate( item ) : deletePattern();\n\tconst exportAsJSON = () => {\n\t\tconst json = {\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item.patternBlock.content.raw,\n\t\t\tsyncStatus: item.patternBlock.wp_pattern_sync_status,\n\t\t};\n\n\t\treturn downloadjs(\n\t\t\tJSON.stringify( json, null, 2 ),\n\t\t\t`${ kebabCase( item.title || item.name ) }.json`,\n\t\t\t'application/json'\n\t\t);\n\t};\n\n\t// Only custom patterns or custom template parts can be renamed or deleted.\n\tconst isCustomPattern =\n\t\tisUserPattern || ( isTemplatePart && item.isCustom );\n\tconst hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;\n\tconst ariaDescriptions = [];\n\n\tif ( isCustomPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescriptions.push(\n\t\t\t__( 'Press Enter to edit, or Delete to delete the pattern.' )\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescriptions.push( item.description );\n\t}\n\n\tif ( isNonUserPattern ) {\n\t\tariaDescriptions.push(\n\t\t\t__( 'Theme & plugin patterns cannot be edited.' )\n\t\t);\n\t}\n\n\tlet itemIcon;\n\tif ( ! isUserPattern && templatePartIcons[ categoryId ] ) {\n\t\titemIcon = templatePartIcons[ categoryId ];\n\t} else {\n\t\titemIcon =\n\t\t\titem.syncStatus === PATTERN_SYNC_TYPES.full ? symbol : undefined;\n\t}\n\n\tconst confirmButtonText = hasThemeFile ? __( 'Clear' ) : __( 'Delete' );\n\tconst confirmPrompt = hasThemeFile\n\t\t? __( 'Are you sure you want to clear these customizations?' )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: The pattern or template part's title e.g. 'Call to action'.\n\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\titem.title || item.name\n\t\t );\n\n\tconst additionalStyles = ! backgroundColor\n\t\t? [ { css: 'body { background: #fff; }' } ]\n\t\t: undefined;\n\n\treturn (\n\t\t<li className={ patternClassNames }>\n\t\t\t<button\n\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t// Even though still incomplete, passing ids helps performance.\n\t\t\t\t// @see https://reakit.io/docs/composite/#performance.\n\t\t\t\tid={ `edit-site-patterns-${ item.name }` }\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? onClick : undefined\n\t\t\t\t}\n\t\t\t\taria-disabled={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? 'false' : 'true'\n\t\t\t\t}\n\t\t\t\taria-label={ item.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ isEmpty && isTemplatePart && __( 'Empty template part' ) }\n\t\t\t\t{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\tblocks={ item.blocks }\n\t\t\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ index }\n\t\t\t\t\thidden\n\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t>\n\t\t\t\t\t{ ariaDescription }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t<HStack\n\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\tjustify=\"space-between\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t>\n\t\t\t\t\t{ itemIcon && ! isNonUserPattern && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t'Editing this pattern will also update anywhere it is used'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme ? (\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\t\t// Required for the grid's roving tab index system.\n\t\t\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.title || item.name }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-lock-icon\"\n\t\t\t\t\t\t\t\t\ticon={ lockSmall }\n\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t</HStack>\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ isCustomPattern && ! hasThemeFile && (\n\t\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\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<DuplicateMenuItem\n\t\t\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tlabel={ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ item.type === PATTERN_TYPES.user && (\n\t\t\t\t\t\t\t\t<MenuItem onClick={ () => exportAsJSON() }>\n\t\t\t\t\t\t\t\t\t{ __( 'Export as JSON' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ isCustomPattern && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tisDestructive={ ! hasThemeFile }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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{ hasThemeFile\n\t\t\t\t\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t</HStack>\n\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tconfirmButtonText={ confirmButtonText }\n\t\t\t\t\tonConfirm={ deleteItem }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ confirmPrompt }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</li>\n\t);\n}\n\nexport default memo( GridItem );\n"],"mappings":";;;;;;;AA0BA,IAAAA,QAAA,GAAAC,OAAA;AAvBA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAL,OAAA;AAIA,IAAAM,WAAA,GAAAN,OAAA;AAWA,IAAAO,KAAA,GAAAP,OAAA;AAEA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AASA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAX,OAAA;AAKA,IA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A,IAAM;IACb8G,OAAO,EAAGA;EAAS,CACnB,CACD,EACD,IAAA1I,QAAA,CAAAuG,aAAA,EAACzF,kBAAA,CAAA8H,OAAiB;IACjBjH,UAAU,EAAGA,UAAY;IACzBC,IAAI,EAAGA,IAAM;IACb8G,OAAO,EAAGA,OAAS;IACnBJ,KAAK,EAAG,IAAAnE,QAAE,EAAE,WAAY;EAAG,CAC3B,CAAC,EACAvC,IAAI,CAACiB,IAAI,KAAKC,wBAAa,CAACC,IAAI,IACjC,IAAA/C,QAAA,CAAAuG,aAAA,EAAChG,WAAA,CAAAsI,QAAQ;IAACzF,OAAO,EAAGA,CAAA,KAAMsB,YAAY,CAAC;EAAG,GACvC,IAAAP,QAAE,EAAE,gBAAiB,CACd,CACV,EAECmB,eAAe,IAChB,IAAAtF,QAAA,CAAAuG,aAAA,EAAChG,WAAA,CAAAsI,QAAQ;IACRC,aAAa,EAAG,CAAEtD,YAAc;IAChCpC,OAAO,EAAGA,CAAA,KACTnB,qBAAqB,CAAE,IAAK;EAC5B,GAECuD,YAAY,GACX,IAAArB,QAAE,EAAE,sBAAuB,CAAC,GAC5B,IAAAA,QAAE,EAAE,QAAS,CACP,CAED,CAEC,CACP,CAAC,EAEPnC,kBAAkB,IACnB,IAAAhC,QAAA,CAAAuG,aAAA,EAAChG,WAAA,CAAAwI,2BAAa;IACb5C,iBAAiB,EAAGA,iBAAmB;IACvC6C,SAAS,EAAGvE,UAAY;IACxBwE,QAAQ,EAAGA,CAAA,KAAMhH,qBAAqB,CAAE,KAAM;EAAG,GAE/CmE,aACY,CAEb,CAAC;AAEP;AAAC,IAAA8C,QAAA,GAEc,IAAAC,aAAI,EAAEzH,QAAS,CAAC;AAAA0H,OAAA,CAAAR,OAAA,GAAAM,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_changeCase","_blockEditor","_components","_data","_i18n","_icons","_notices","_reusableBlocks","_renameMenuItem","_duplicateMenuItem","_constants","_store","_link","_lockUnlock","download","fileName","content","contentType","file","window","Blob","type","a","document","createElement","href","URL","createObjectURL","style","display","body","appendChild","click","removeChild","useGlobalStyle","unlock","blockEditorPrivateApis","templatePartIcons","header","footer","uncategorized","GridItem","categoryId","item","props","descriptionId","useId","isDeleteDialogOpen","setIsDeleteDialogOpen","useState","backgroundColor","removeTemplate","useDispatch","editSiteStore","__experimentalDeleteReusableBlock","reusableBlocksStore","createErrorNotice","createSuccessNotice","noticesStore","isUserPattern","PATTERN_TYPES","user","isNonUserPattern","theme","isTemplatePart","TEMPLATE_PART_POST_TYPE","onClick","useLink","postType","postId","id","name","categoryType","isEmpty","blocks","length","patternClassNames","classnames","previewClassNames","deletePattern","sprintf","__","title","error","errorMessage","message","code","deleteItem","exportAsJSON","json","__file","patternBlock","raw","syncStatus","wp_pattern_sync_status","kebabCase","JSON","stringify","isCustomPattern","isCustom","hasThemeFile","templatePart","has_theme_file","ariaDescriptions","push","description","itemIcon","PATTERN_SYNC_TYPES","full","symbol","undefined","confirmButtonText","confirmPrompt","additionalStyles","css","className","map","_","index","join","BlockPreview","ariaDescription","key","hidden","__experimentalHStack","justify","alignment","spacing","Tooltip","placement","text","Icon","icon","Flex","as","gap","__experimentalHeading","level","Button","variant","tabIndex","lockSmall","size","DropdownMenu","moreVertical","label","popoverProps","toggleProps","describedBy","onClose","MenuGroup","default","MenuItem","isDestructive","__experimentalConfirmDialog","onConfirm","onCancel","_default","memo","exports"],"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId, memo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled as uncategorized,\n\tsymbol,\n\tmoreVertical,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport RenameMenuItem from './rename-menu-item';\nimport DuplicateMenuItem from './duplicate-menu-item';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n} from '../../utils/constants';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Downloads a file.\n * Also used in packages/list-reusable-blocks/src/utils/file.js.\n *\n * @param {string} fileName File Name.\n * @param {string} content File Content.\n * @param {string} contentType File mime type.\n */\nfunction download( fileName, content, contentType ) {\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst a = document.createElement( 'a' );\n\ta.href = URL.createObjectURL( file );\n\ta.download = fileName;\n\ta.style.display = 'none';\n\tdocument.body.appendChild( a );\n\ta.click();\n\tdocument.body.removeChild( a );\n}\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst templatePartIcons = { header, footer, uncategorized };\n\nfunction GridItem( { categoryId, item, ...props } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\tconst isNonUserPattern = item.type === PATTERN_TYPES.theme;\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: isUserPattern ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,\n\t} );\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-patterns__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-patterns__preview', {\n\t\t'is-inactive': isNonUserPattern,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The pattern's title e.g. 'Call to action'.\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\titem.title\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'edit-site-patterns-error',\n\t\t\t} );\n\t\t}\n\t};\n\tconst deleteItem = () =>\n\t\tisTemplatePart ? removeTemplate( item ) : deletePattern();\n\tconst exportAsJSON = () => {\n\t\tconst json = {\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item.patternBlock.content.raw,\n\t\t\tsyncStatus: item.patternBlock.wp_pattern_sync_status,\n\t\t};\n\n\t\treturn download(\n\t\t\t`${ kebabCase( item.title || item.name ) }.json`,\n\t\t\tJSON.stringify( json, null, 2 ),\n\t\t\t'application/json'\n\t\t);\n\t};\n\n\t// Only custom patterns or custom template parts can be renamed or deleted.\n\tconst isCustomPattern =\n\t\tisUserPattern || ( isTemplatePart && item.isCustom );\n\tconst hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;\n\tconst ariaDescriptions = [];\n\n\tif ( isCustomPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescriptions.push(\n\t\t\t__( 'Press Enter to edit, or Delete to delete the pattern.' )\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescriptions.push( item.description );\n\t}\n\n\tif ( isNonUserPattern ) {\n\t\tariaDescriptions.push(\n\t\t\t__( 'Theme & plugin patterns cannot be edited.' )\n\t\t);\n\t}\n\n\tlet itemIcon;\n\tif ( ! isUserPattern && templatePartIcons[ categoryId ] ) {\n\t\titemIcon = templatePartIcons[ categoryId ];\n\t} else {\n\t\titemIcon =\n\t\t\titem.syncStatus === PATTERN_SYNC_TYPES.full ? symbol : undefined;\n\t}\n\n\tconst confirmButtonText = hasThemeFile ? __( 'Clear' ) : __( 'Delete' );\n\tconst confirmPrompt = hasThemeFile\n\t\t? __( 'Are you sure you want to clear these customizations?' )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: The pattern or template part's title e.g. 'Call to action'.\n\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\titem.title || item.name\n\t\t );\n\n\tconst additionalStyles = ! backgroundColor\n\t\t? [ { css: 'body { background: #fff; }' } ]\n\t\t: undefined;\n\n\treturn (\n\t\t<li className={ patternClassNames }>\n\t\t\t<button\n\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t// Even though still incomplete, passing ids helps performance.\n\t\t\t\t// @see https://reakit.io/docs/composite/#performance.\n\t\t\t\tid={ `edit-site-patterns-${ item.name }` }\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? onClick : undefined\n\t\t\t\t}\n\t\t\t\taria-disabled={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? 'false' : 'true'\n\t\t\t\t}\n\t\t\t\taria-label={ item.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ isEmpty && isTemplatePart && __( 'Empty template part' ) }\n\t\t\t\t{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\tblocks={ item.blocks }\n\t\t\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ index }\n\t\t\t\t\thidden\n\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t>\n\t\t\t\t\t{ ariaDescription }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t<HStack\n\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\tjustify=\"space-between\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t>\n\t\t\t\t\t{ itemIcon && ! isNonUserPattern && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t'Editing this pattern will also update anywhere it is used'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme ? (\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\t\t// Required for the grid's roving tab index system.\n\t\t\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.title || item.name }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-lock-icon\"\n\t\t\t\t\t\t\t\t\ticon={ lockSmall }\n\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t</HStack>\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ isCustomPattern && ! hasThemeFile && (\n\t\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\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<DuplicateMenuItem\n\t\t\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tlabel={ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ item.type === PATTERN_TYPES.user && (\n\t\t\t\t\t\t\t\t<MenuItem onClick={ () => exportAsJSON() }>\n\t\t\t\t\t\t\t\t\t{ __( 'Export as JSON' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ isCustomPattern && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tisDestructive={ ! hasThemeFile }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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{ hasThemeFile\n\t\t\t\t\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t</HStack>\n\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tconfirmButtonText={ confirmButtonText }\n\t\t\t\t\tonConfirm={ deleteItem }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ confirmPrompt }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</li>\n\t);\n}\n\nexport default memo( GridItem );\n"],"mappings":";;;;;;;AAyBA,IAAAA,QAAA,GAAAC,OAAA;AAtBA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AAWA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AASA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AAKA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,kBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAKA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,KAAA,GAAAf,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AAnDA;AACA;AACA;;AAIA;AACA;AACA;;AA+BA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASiB,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAG;EACnD,MAAMC,IAAI,GAAG,IAAIC,MAAM,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AA,GAEc,IAAAC,aAAI,EAAErH,QAAS,CAAC;AAAAsH,OAAA,CAAAR,OAAA,GAAAM,QAAA"}
@@ -33,9 +33,9 @@ const {
33
33
  useHistory
34
34
  } = (0, _lockUnlock.unlock)(_router.privateApis);
35
35
  const SYNC_FILTERS = {
36
- all: (0, _i18n.__)('All'),
37
- [_constants.PATTERN_SYNC_TYPES.full]: (0, _i18n.__)('Synced'),
38
- [_constants.PATTERN_SYNC_TYPES.unsynced]: (0, _i18n.__)('Not synced')
36
+ all: (0, _i18n._x)('All', 'Option that shows all patterns'),
37
+ [_constants.PATTERN_SYNC_TYPES.full]: (0, _i18n._x)('Synced', 'Option that shows all synchronized patterns'),
38
+ [_constants.PATTERN_SYNC_TYPES.unsynced]: (0, _i18n._x)('Not synced', 'Option that shows all patterns that are not synchronized')
39
39
  };
40
40
  const SYNC_DESCRIPTIONS = {
41
41
  all: '',
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_i18n","_icons","_router","_compose","_header","_interopRequireDefault","_grid","_noPatterns","_usePatterns","_sidebarButton","_useDebouncedInput","_lockUnlock","_constants","_pagination","useLocation","useHistory","unlock","routerPrivateApis","SYNC_FILTERS","all","__","PATTERN_SYNC_TYPES","full","unsynced","SYNC_DESCRIPTIONS","PAGE_SIZE","PatternsList","categoryId","type","location","history","isMobileViewport","useViewportMatch","filterValue","setFilterValue","delayedFilterValue","useDebouncedInput","deferredFilterValue","useDeferredValue","syncFilter","setSyncFilter","useState","currentPage","setCurrentPage","deferredSyncedFilter","isUncategorizedThemePatterns","PATTERN_TYPES","theme","patterns","isResolving","usePatterns","search","syncStatus","undefined","updateSearchFilter","value","updateSyncFilter","id","useId","titleId","descriptionId","hasPatterns","length","title","description","totalItems","pageIndex","numPages","Math","ceil","list","useMemo","slice","asyncList","useAsyncList","step","changePage","page","scrollContainer","document","querySelector","scrollTo","createElement","Fragment","__experimentalVStack","className","spacing","default","Flex","alignment","wrap","icon","isRTL","chevronRight","chevronLeft","label","onClick","state","backPath","back","push","path","FlexBlock","SearchControl","onChange","placeholder","__nextHasNoMarginBottom","__experimentalToggleGroupControl","hideLabelFromVision","isBlock","Object","entries","map","key","__experimentalToggleGroupControlOption","justify","__experimentalHeading","as","level","__experimentalText","variant","items"],"sources":["@wordpress/edit-site/src/components/page-patterns/patterns-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';\nimport {\n\tSearchControl,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PatternsHeader from './header';\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\nimport { PATTERN_SYNC_TYPES, PATTERN_TYPES } from '../../utils/constants';\nimport Pagination from './pagination';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst SYNC_FILTERS = {\n\tall: __( 'All' ),\n\t[ PATTERN_SYNC_TYPES.full ]: __( 'Synced' ),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __( 'Not synced' ),\n};\n\nconst SYNC_DESCRIPTIONS = {\n\tall: '',\n\t[ PATTERN_SYNC_TYPES.full ]: __(\n\t\t'Patterns that are kept in sync across the site.'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __(\n\t\t'Patterns that can be changed freely without affecting the site.'\n\t),\n};\n\nconst PAGE_SIZE = 20;\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\tconst deferredFilterValue = useDeferredValue( delayedFilterValue );\n\n\tconst [ syncFilter, setSyncFilter ] = useState( 'all' );\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\n\tconst deferredSyncedFilter = useDeferredValue( syncFilter );\n\n\tconst isUncategorizedThemePatterns =\n\t\ttype === PATTERN_TYPES.theme && categoryId === 'uncategorized';\n\n\tconst { patterns, isResolving } = usePatterns(\n\t\ttype,\n\t\tisUncategorizedThemePatterns ? '' : categoryId,\n\t\t{\n\t\t\tsearch: deferredFilterValue,\n\t\t\tsyncStatus:\n\t\t\t\tdeferredSyncedFilter === 'all'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: deferredSyncedFilter,\n\t\t}\n\t);\n\n\tconst updateSearchFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetFilterValue( value );\n\t};\n\n\tconst updateSyncFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetSyncFilter( value );\n\t};\n\n\tconst id = useId();\n\tconst titleId = `${ id }-title`;\n\tconst descriptionId = `${ id }-description`;\n\n\tconst hasPatterns = patterns.length;\n\tconst title = SYNC_FILTERS[ syncFilter ];\n\tconst description = SYNC_DESCRIPTIONS[ syncFilter ];\n\n\tconst totalItems = patterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst numPages = Math.ceil( patterns.length / PAGE_SIZE );\n\n\tconst list = useMemo( () => {\n\t\treturn patterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, patterns ] );\n\n\tconst asyncList = useAsyncList( list, { step: 10 } );\n\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = document.querySelector( '.edit-site-patterns' );\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack className=\"edit-site-patterns__header\" spacing={ 6 }>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\tdescriptionId={ descriptionId }\n\t\t\t\t/>\n\t\t\t\t<Flex alignment=\"stretch\" wrap>\n\t\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t// Go back in history if we came from the Patterns page.\n\t\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tlocation.state?.backPath === '/patterns'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\thistory.push( { path: '/patterns' } );\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\t<FlexBlock className=\"edit-site-patterns__search-block\">\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__search\"\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateSearchFilter( value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t{ type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tlabel={ __( 'Filter by sync status' ) }\n\t\t\t\t\t\t\tvalue={ syncFilter }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => updateSyncFilter( value ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Object.entries( SYNC_FILTERS ).map(\n\t\t\t\t\t\t\t\t( [ key, label ] ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter-option\"\n\t\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</VStack>\n\t\t\t<VStack\n\t\t\t\tclassName=\"edit-site-patterns__section\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 6 }\n\t\t\t>\n\t\t\t\t{ syncFilter !== 'all' && (\n\t\t\t\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } id={ titleId }>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ description ? (\n\t\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\titems={ asyncList }\n\t\t\t\t\t\taria-labelledby={ titleId }\n\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t\t</VStack>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<Pagination\n\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\tchangePage={ changePage }\n\t\t\t\t\ttotalItems={ totalItems }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAUA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,WAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,YAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,cAAA,GAAAJ,sBAAA,CAAAP,OAAA;AACA,IAAAY,kBAAA,GAAAL,sBAAA,CAAAP,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAR,sBAAA,CAAAP,OAAA;AA9BA;AACA;AACA;;AAiBA;AACA;AACA;;AAWA,MAAM;EAAEgB,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/D,MAAMC,YAAY,GAAG;EACpBC,GAAG,EAAE,IAAAC,QA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H,qBAAO;IAACC,EAAE,EAAC,IAAI;IAACC,KAAK,EAAG,CAAG;IAAC7D,EAAE,EAAGE;EAAS,GACxCI,KACM,CAAC,EACRC,WAAW,GACZ,IAAAnE,QAAA,CAAAqF,aAAA,EAACnF,WAAA,CAAAwH,kBAAI;IAACC,OAAO,EAAC,OAAO;IAACH,EAAE,EAAC,GAAG;IAAC5D,EAAE,EAAGG;EAAe,GAC9CI,WACG,CAAC,GACJ,IACG,CACR,EACCH,WAAW,IACZ,IAAAhE,QAAA,CAAAqF,aAAA,EAAC5E,KAAA,CAAAiF,OAAI;IACJ5D,UAAU,EAAGA,UAAY;IACzB8F,KAAK,EAAGhD,SAAW;IACnB,mBAAkBd,OAAS;IAC3B,oBAAmBC;EAAe,CAClC,CACD,EACC,CAAEX,WAAW,IAAI,CAAEY,WAAW,IAAI,IAAAhE,QAAA,CAAAqF,aAAA,EAAC3E,WAAA,CAAAgF,OAAU,MAAE,CAC1C,CAAC,EACPpB,QAAQ,GAAG,CAAC,IACb,IAAAtE,QAAA,CAAAqF,aAAA,EAACrE,WAAA,CAAA0E,OAAU;IACV7C,WAAW,EAAGA,WAAa;IAC3ByB,QAAQ,EAAGA,QAAU;IACrBS,UAAU,EAAGA,UAAY;IACzBX,UAAU,EAAGA;EAAY,CACzB,CAED,CAAC;AAEL"}
1
+ {"version":3,"names":["_element","require","_components","_i18n","_icons","_router","_compose","_header","_interopRequireDefault","_grid","_noPatterns","_usePatterns","_sidebarButton","_useDebouncedInput","_lockUnlock","_constants","_pagination","useLocation","useHistory","unlock","routerPrivateApis","SYNC_FILTERS","all","_x","PATTERN_SYNC_TYPES","full","unsynced","SYNC_DESCRIPTIONS","__","PAGE_SIZE","PatternsList","categoryId","type","location","history","isMobileViewport","useViewportMatch","filterValue","setFilterValue","delayedFilterValue","useDebouncedInput","deferredFilterValue","useDeferredValue","syncFilter","setSyncFilter","useState","currentPage","setCurrentPage","deferredSyncedFilter","isUncategorizedThemePatterns","PATTERN_TYPES","theme","patterns","isResolving","usePatterns","search","syncStatus","undefined","updateSearchFilter","value","updateSyncFilter","id","useId","titleId","descriptionId","hasPatterns","length","title","description","totalItems","pageIndex","numPages","Math","ceil","list","useMemo","slice","asyncList","useAsyncList","step","changePage","page","scrollContainer","document","querySelector","scrollTo","createElement","Fragment","__experimentalVStack","className","spacing","default","Flex","alignment","wrap","icon","isRTL","chevronRight","chevronLeft","label","onClick","state","backPath","back","push","path","FlexBlock","SearchControl","onChange","placeholder","__nextHasNoMarginBottom","__experimentalToggleGroupControl","hideLabelFromVision","isBlock","Object","entries","map","key","__experimentalToggleGroupControlOption","justify","__experimentalHeading","as","level","__experimentalText","variant","items"],"sources":["@wordpress/edit-site/src/components/page-patterns/patterns-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';\nimport {\n\tSearchControl,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PatternsHeader from './header';\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\nimport { PATTERN_SYNC_TYPES, PATTERN_TYPES } from '../../utils/constants';\nimport Pagination from './pagination';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst SYNC_FILTERS = {\n\tall: _x( 'All', 'Option that shows all patterns' ),\n\t[ PATTERN_SYNC_TYPES.full ]: _x(\n\t\t'Synced',\n\t\t'Option that shows all synchronized patterns'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: _x(\n\t\t'Not synced',\n\t\t'Option that shows all patterns that are not synchronized'\n\t),\n};\n\nconst SYNC_DESCRIPTIONS = {\n\tall: '',\n\t[ PATTERN_SYNC_TYPES.full ]: __(\n\t\t'Patterns that are kept in sync across the site.'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __(\n\t\t'Patterns that can be changed freely without affecting the site.'\n\t),\n};\n\nconst PAGE_SIZE = 20;\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\tconst deferredFilterValue = useDeferredValue( delayedFilterValue );\n\n\tconst [ syncFilter, setSyncFilter ] = useState( 'all' );\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\n\tconst deferredSyncedFilter = useDeferredValue( syncFilter );\n\n\tconst isUncategorizedThemePatterns =\n\t\ttype === PATTERN_TYPES.theme && categoryId === 'uncategorized';\n\n\tconst { patterns, isResolving } = usePatterns(\n\t\ttype,\n\t\tisUncategorizedThemePatterns ? '' : categoryId,\n\t\t{\n\t\t\tsearch: deferredFilterValue,\n\t\t\tsyncStatus:\n\t\t\t\tdeferredSyncedFilter === 'all'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: deferredSyncedFilter,\n\t\t}\n\t);\n\n\tconst updateSearchFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetFilterValue( value );\n\t};\n\n\tconst updateSyncFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetSyncFilter( value );\n\t};\n\n\tconst id = useId();\n\tconst titleId = `${ id }-title`;\n\tconst descriptionId = `${ id }-description`;\n\n\tconst hasPatterns = patterns.length;\n\tconst title = SYNC_FILTERS[ syncFilter ];\n\tconst description = SYNC_DESCRIPTIONS[ syncFilter ];\n\n\tconst totalItems = patterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst numPages = Math.ceil( patterns.length / PAGE_SIZE );\n\n\tconst list = useMemo( () => {\n\t\treturn patterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, patterns ] );\n\n\tconst asyncList = useAsyncList( list, { step: 10 } );\n\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = document.querySelector( '.edit-site-patterns' );\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack className=\"edit-site-patterns__header\" spacing={ 6 }>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\tdescriptionId={ descriptionId }\n\t\t\t\t/>\n\t\t\t\t<Flex alignment=\"stretch\" wrap>\n\t\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t// Go back in history if we came from the Patterns page.\n\t\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tlocation.state?.backPath === '/patterns'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\thistory.push( { path: '/patterns' } );\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\t<FlexBlock className=\"edit-site-patterns__search-block\">\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__search\"\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateSearchFilter( value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t{ type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tlabel={ __( 'Filter by sync status' ) }\n\t\t\t\t\t\t\tvalue={ syncFilter }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => updateSyncFilter( value ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Object.entries( SYNC_FILTERS ).map(\n\t\t\t\t\t\t\t\t( [ key, label ] ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter-option\"\n\t\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</VStack>\n\t\t\t<VStack\n\t\t\t\tclassName=\"edit-site-patterns__section\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 6 }\n\t\t\t>\n\t\t\t\t{ syncFilter !== 'all' && (\n\t\t\t\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } id={ titleId }>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ description ? (\n\t\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\titems={ asyncList }\n\t\t\t\t\t\taria-labelledby={ titleId }\n\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t\t</VStack>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<Pagination\n\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\tchangePage={ changePage }\n\t\t\t\t\ttotalItems={ totalItems }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAUA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,WAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,YAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,cAAA,GAAAJ,sBAAA,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
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = RenameCategoryMenuItem;
8
+ var _element = require("@wordpress/element");
9
+ var _components = require("@wordpress/components");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _patterns = require("@wordpress/patterns");
12
+ var _usePatternCategories = _interopRequireDefault(require("../sidebar-navigation-screen-patterns/use-pattern-categories"));
13
+ var _lockUnlock = require("../../lock-unlock");
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+
26
+ const {
27
+ RenamePatternCategoryModal
28
+ } = (0, _lockUnlock.unlock)(_patterns.privateApis);
29
+ function RenameCategoryMenuItem({
30
+ category,
31
+ onClose
32
+ }) {
33
+ const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
34
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
35
+ onClick: () => setIsModalOpen(true)
36
+ }, (0, _i18n.__)('Rename')), isModalOpen && (0, _element.createElement)(RenameModal, {
37
+ category: category,
38
+ onClose: () => {
39
+ setIsModalOpen(false);
40
+ onClose();
41
+ }
42
+ }));
43
+ }
44
+ function RenameModal({
45
+ category,
46
+ onClose
47
+ }) {
48
+ // User created pattern categories have their properties updated when
49
+ // retrieved via `getUserPatternCategories`. The rename modal expects an
50
+ // object that will match the pattern category entity.
51
+ const normalizedCategory = {
52
+ id: category.id,
53
+ slug: category.slug,
54
+ name: category.label
55
+ };
56
+
57
+ // Optimization - only use pattern categories when the modal is open.
58
+ const existingCategories = (0, _usePatternCategories.default)();
59
+ return (0, _element.createElement)(RenamePatternCategoryModal, {
60
+ category: normalizedCategory,
61
+ existingCategories: existingCategories,
62
+ onClose: onClose,
63
+ overlayClassName: "edit-site-list__rename-modal"
64
+ });
65
+ }
66
+ //# sourceMappingURL=rename-category-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_components","_i18n","_patterns","_usePatternCategories","_interopRequireDefault","_lockUnlock","RenamePatternCategoryModal","unlock","patternsPrivateApis","RenameCategoryMenuItem","category","onClose","isModalOpen","setIsModalOpen","useState","createElement","Fragment","MenuItem","onClick","__","RenameModal","normalizedCategory","id","slug","name","label","existingCategories","usePatternCategories","overlayClassName"],"sources":["@wordpress/edit-site/src/components/page-patterns/rename-category-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n/**\n * Internal dependencies\n */\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { RenamePatternCategoryModal } = unlock( patternsPrivateApis );\n\nexport default function RenameCategoryMenuItem( { category, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction RenameModal( { category, onClose } ) {\n\t// User created pattern categories have their properties updated when\n\t// retrieved via `getUserPatternCategories`. The rename modal expects an\n\t// object that will match the pattern category entity.\n\tconst normalizedCategory = {\n\t\tid: category.id,\n\t\tslug: category.slug,\n\t\tname: category.label,\n\t};\n\n\t// Optimization - only use pattern categories when the modal is open.\n\tconst existingCategories = usePatternCategories();\n\n\treturn (\n\t\t<RenamePatternCategoryModal\n\t\t\tcategory={ normalizedCategory }\n\t\t\texistingCategories={ existingCategories }\n\t\t\tonClose={ onClose }\n\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AADA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,IAAAI,qBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEO;AAA2B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAErD,SAASC,sBAAsBA,CAAE;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EACvE,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEzD,OACC,IAAAhB,QAAA,CAAAiB,aAAA,EAAAjB,QAAA,CAAAkB,QAAA,QACC,IAAAlB,QAAA,CAAAiB,aAAA,EAACf,WAAA,CAAAiB,QAAQ;IAACC,OAAO,EAAGA,CAAA,KAAML,cAAc,CAAE,IAAK;EAAG,GAC/C,IAAAM,QAAE,EAAE,QAAS,CACN,CAAC,EACTP,WAAW,IACZ,IAAAd,QAAA,CAAAiB,aAAA,EAACK,WAAW;IACXV,QAAQ,EAAGA,QAAU;IACrBC,OAAO,EAAGA,CAAA,KAAM;MACfE,cAAc,CAAE,KAAM,CAAC;MACvBF,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CAED,CAAC;AAEL;AAEA,SAASS,WAAWA,CAAE;EAAEV,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EAC7C;EACA;EACA;EACA,MAAMU,kBAAkB,GAAG;IAC1BC,EAAE,EAAEZ,QAAQ,CAACY,EAAE;IACfC,IAAI,EAAEb,QAAQ,CAACa,IAAI;IACnBC,IAAI,EAAEd,QAAQ,CAACe;EAChB,CAAC;;EAED;EACA,MAAMC,kBAAkB,GAAG,IAAAC,6BAAoB,EAAC,CAAC;EAEjD,OACC,IAAA7B,QAAA,CAAAiB,aAAA,EAACT,0BAA0B;IAC1BI,QAAQ,EAAGW,kBAAoB;IAC/BK,kBAAkB,EAAGA,kBAAoB;IACzCf,OAAO,EAAGA,OAAS;IACnBiB,gBAAgB,EAAC;EAA8B,CAC/C,CAAC;AAEJ"}
@@ -248,14 +248,7 @@ function ScreenBlock({
248
248
  inheritedValue: inheritedStyleWithLayout,
249
249
  value: styleWithLayout,
250
250
  onChange: setStyle,
251
- settings: {
252
- ...settings,
253
- color: {
254
- ...settings.color,
255
- customDuotone: false //TO FIX: Custom duotone only works on the block level right now
256
- }
257
- },
258
-
251
+ settings: settings,
259
252
  includeLayoutControls: true
260
253
  }), hasImageSettingsPanel && createElement(ImageSettingsPanel, {
261
254
  onChange: onChangeLightbox,
@@ -1 +1 @@
1
- {"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","_globalStyles$_links$","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","customDuotone","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t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ACD,EACCa,eAAe,IAChB6B,aAAA,CAAC7D,kBAAkB;IAClBkE,cAAc,EAAGlB,wBAA0B;IAC3CmB,KAAK,EAAGjB,eAAiB;IACzBkB,QAAQ,EAAGrD,QAAU;IACrBI,QAAQ,EAAGA,QAAU;IACrBkD,qBAAqB;EAAA,CACrB,CACD,EACCpC,eAAe,IAChB4B,aAAA,CAAC3D,kBAAkB;IAClBgE,cAAc,EAAGlB,wBAA0B;IAC3CmB,KAAK,EAAGjB,eAAiB;IACzBkB,QAAQ,EAAGrD,QAAU;IACrBI,QAAQ,EAAG;MACV,GAAGA,QAAQ;MACX/C,KAAK,EAAE;QACN,GAAG+C,QAAQ,CAAC/C,KAAK;QACjBkG,aAAa,EAAE,KAAK,CAAE;MACvB;IACD,CAAG;;IACHD,qBAAqB;EAAA,CACrB,CACD,EACCnC,qBAAqB,IACtB2B,aAAA,CAAC1D,kBAAkB;IAClBiE,QAAQ,EAAGd,gBAAkB;IAC7Ba,KAAK,EAAGnD,YAAc;IACtBkD,cAAc,EAAG/C;EAAU,CAC3B,CACD,EAECkB,UAAU,IACXwB,aAAA,CAACzG,SAAS;IAAC2G,KAAK,EAAGtG,EAAE,CAAE,UAAW,CAAG;IAAC8G,WAAW,EAAG;EAAO,GAC1DV,aAAA,YACGnG,OAAO;EACR;EACAD,EAAE,CACD,2IACD,CAAC,EACD2D,SAAS,EAAE2C,KACZ,CACE,CAAC,EACJF,aAAA,CAACxD,mBAAmB;IACnB8D,KAAK,EAAG7F,KAAO;IACf8F,QAAQ,EAAGrD,QAAU;IACrBmD,cAAc,EAAGpD;EAAgB,CACjC,CACS,CAEX,CAAC;AAEL;AAEA,eAAeR,WAAW"}
1
+ {"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","_globalStyles$_links$","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,EAC9BC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,UAAU;AACnC,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,oBAAoB;AAExE,SAASC,kBAAkBA,CAAEC,MAAM,EAAG;EACrC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAOA,MAAM;EACd;EAEA,MAAMC,eAAe,GAAGD,MAAM,CAACE,KAAK,IAAIF,MAAM,CAACG,KAAK;EAEpD,IAAK,CAAEH,MAAM,CAACI,KAAK,IAAIH,eAAe,EAAG;IACxC,OAAO;MAAE,GAAGD,MAAM;MAAEI,KAAK,EAAE;IAAQ,CAAC;EACrC;EAEA,IAAKJ,MAAM,CAACI,KAAK,IAAI,CAAEH,eAAe,EAAG;I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AU;IACrBkD,qBAAqB;EAAA,CACrB,CACD,EACCvC,cAAc,IACf+B,aAAA,CAACrE,iBAAiB;IACjB0E,cAAc,EAAGpD,cAAgB;IACjCqD,KAAK,EAAG7F,KAAO;IACf8F,QAAQ,EAAGX,eAAiB;IAC5BtC,QAAQ,EAAGA;EAAU,CACrB,CACD,EACCa,eAAe,IAChB6B,aAAA,CAAC7D,kBAAkB;IAClBkE,cAAc,EAAGlB,wBAA0B;IAC3CmB,KAAK,EAAGjB,eAAiB;IACzBkB,QAAQ,EAAGrD,QAAU;IACrBI,QAAQ,EAAGA,QAAU;IACrBkD,qBAAqB;EAAA,CACrB,CACD,EACCpC,eAAe,IAChB4B,aAAA,CAAC3D,kBAAkB;IAClBgE,cAAc,EAAGlB,wBAA0B;IAC3CmB,KAAK,EAAGjB,eAAiB;IACzBkB,QAAQ,EAAGrD,QAAU;IACrBI,QAAQ,EAAGA,QAAU;IACrBkD,qBAAqB;EAAA,CACrB,CACD,EACCnC,qBAAqB,IACtB2B,aAAA,CAAC1D,kBAAkB;IAClBiE,QAAQ,EAAGd,gBAAkB;IAC7Ba,KAAK,EAAGnD,YAAc;IACtBkD,cAAc,EAAG/C;EAAU,CAC3B,CACD,EAECkB,UAAU,IACXwB,aAAA,CAACzG,SAAS;IAAC2G,KAAK,EAAGtG,EAAE,CAAE,UAAW,CAAG;IAAC6G,WAAW,EAAG;EAAO,GAC1DT,aAAA,YACGnG,OAAO;EACR;EACAD,EAAE,CACD,2IACD,CAAC,EACD2D,SAAS,EAAE2C,KACZ,CACE,CAAC,EACJF,aAAA,CAACxD,mBAAmB;IACnB8D,KAAK,EAAG7F,KAAO;IACf8F,QAAQ,EAAGrD,QAAU;IACrBmD,cAAc,EAAGpD;EAAgB,CACjC,CACS,CAEX,CAAC;AAEL;AAEA,eAAeR,WAAW"}
@@ -3,7 +3,6 @@ import { createElement } from "@wordpress/element";
3
3
  * External dependencies
4
4
  */
5
5
  import classnames from 'classnames';
6
- import downloadjs from 'downloadjs';
7
6
  import { paramCase as kebabCase } from 'change-case';
8
7
 
9
8
  /**
@@ -27,6 +26,27 @@ import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE, PATTERN_SYNC_TYPES } from '../.
27
26
  import { store as editSiteStore } from '../../store';
28
27
  import { useLink } from '../routes/link';
29
28
  import { unlock } from '../../lock-unlock';
29
+
30
+ /**
31
+ * Downloads a file.
32
+ * Also used in packages/list-reusable-blocks/src/utils/file.js.
33
+ *
34
+ * @param {string} fileName File Name.
35
+ * @param {string} content File Content.
36
+ * @param {string} contentType File mime type.
37
+ */
38
+ function download(fileName, content, contentType) {
39
+ const file = new window.Blob([content], {
40
+ type: contentType
41
+ });
42
+ const a = document.createElement('a');
43
+ a.href = URL.createObjectURL(file);
44
+ a.download = fileName;
45
+ a.style.display = 'none';
46
+ document.body.appendChild(a);
47
+ a.click();
48
+ document.body.removeChild(a);
49
+ }
30
50
  const {
31
51
  useGlobalStyle
32
52
  } = unlock(blockEditorPrivateApis);
@@ -96,7 +116,7 @@ function GridItem({
96
116
  content: item.patternBlock.content.raw,
97
117
  syncStatus: item.patternBlock.wp_pattern_sync_status
98
118
  };
99
- return downloadjs(JSON.stringify(json, null, 2), `${kebabCase(item.title || item.name)}.json`, 'application/json');
119
+ return download(`${kebabCase(item.title || item.name)}.json`, JSON.stringify(json, null, 2), 'application/json');
100
120
  };
101
121
 
102
122
  // Only custom patterns or custom template parts can be renamed or deleted.
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","downloadjs","paramCase","kebabCase","BlockPreview","privateApis","blockEditorPrivateApis","Button","__experimentalConfirmDialog","ConfirmDialog","DropdownMenu","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalHStack","HStack","Tooltip","Flex","useDispatch","useState","useId","memo","__","sprintf","Icon","header","footer","symbolFilled","uncategorized","symbol","moreVertical","lockSmall","store","noticesStore","reusableBlocksStore","RenameMenuItem","DuplicateMenuItem","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","editSiteStore","useLink","unlock","useGlobalStyle","templatePartIcons","GridItem","categoryId","item","props","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","backgroundColor","removeTemplate","__experimentalDeleteReusableBlock","createErrorNotice","createSuccessNotice","isUserPattern","type","user","isNonUserPattern","theme","isTemplatePart","onClick","postType","postId","id","name","categoryType","isEmpty","blocks","length","patternClassNames","previewClassNames","deletePattern","title","error","errorMessage","message","code","deleteItem","exportAsJSON","json","__file","content","patternBlock","raw","syncStatus","wp_pattern_sync_status","JSON","stringify","isCustomPattern","isCustom","hasThemeFile","templatePart","has_theme_file","ariaDescriptions","push","description","itemIcon","full","undefined","confirmButtonText","confirmPrompt","additionalStyles","css","createElement","className","map","_","index","join","ariaDescription","key","hidden","justify","alignment","spacing","placement","text","icon","as","gap","level","variant","tabIndex","size","label","popoverProps","toggleProps","describedBy","onClose","isDestructive","onConfirm","onCancel"],"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport downloadjs from 'downloadjs';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId, memo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled as uncategorized,\n\tsymbol,\n\tmoreVertical,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport RenameMenuItem from './rename-menu-item';\nimport DuplicateMenuItem from './duplicate-menu-item';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n} from '../../utils/constants';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst templatePartIcons = { header, footer, uncategorized };\n\nfunction GridItem( { categoryId, item, ...props } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\tconst isNonUserPattern = item.type === PATTERN_TYPES.theme;\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: isUserPattern ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,\n\t} );\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-patterns__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-patterns__preview', {\n\t\t'is-inactive': isNonUserPattern,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The pattern's title e.g. 'Call to action'.\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\titem.title\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'edit-site-patterns-error',\n\t\t\t} );\n\t\t}\n\t};\n\tconst deleteItem = () =>\n\t\tisTemplatePart ? removeTemplate( item ) : deletePattern();\n\tconst exportAsJSON = () => {\n\t\tconst json = {\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item.patternBlock.content.raw,\n\t\t\tsyncStatus: item.patternBlock.wp_pattern_sync_status,\n\t\t};\n\n\t\treturn downloadjs(\n\t\t\tJSON.stringify( json, null, 2 ),\n\t\t\t`${ kebabCase( item.title || item.name ) }.json`,\n\t\t\t'application/json'\n\t\t);\n\t};\n\n\t// Only custom patterns or custom template parts can be renamed or deleted.\n\tconst isCustomPattern =\n\t\tisUserPattern || ( isTemplatePart && item.isCustom );\n\tconst hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;\n\tconst ariaDescriptions = [];\n\n\tif ( isCustomPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescriptions.push(\n\t\t\t__( 'Press Enter to edit, or Delete to delete the pattern.' )\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescriptions.push( item.description );\n\t}\n\n\tif ( isNonUserPattern ) {\n\t\tariaDescriptions.push(\n\t\t\t__( 'Theme & plugin patterns cannot be edited.' )\n\t\t);\n\t}\n\n\tlet itemIcon;\n\tif ( ! isUserPattern && templatePartIcons[ categoryId ] ) {\n\t\titemIcon = templatePartIcons[ categoryId ];\n\t} else {\n\t\titemIcon =\n\t\t\titem.syncStatus === PATTERN_SYNC_TYPES.full ? symbol : undefined;\n\t}\n\n\tconst confirmButtonText = hasThemeFile ? __( 'Clear' ) : __( 'Delete' );\n\tconst confirmPrompt = hasThemeFile\n\t\t? __( 'Are you sure you want to clear these customizations?' )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: The pattern or template part's title e.g. 'Call to action'.\n\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\titem.title || item.name\n\t\t );\n\n\tconst additionalStyles = ! backgroundColor\n\t\t? [ { css: 'body { background: #fff; }' } ]\n\t\t: undefined;\n\n\treturn (\n\t\t<li className={ patternClassNames }>\n\t\t\t<button\n\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t// Even though still incomplete, passing ids helps performance.\n\t\t\t\t// @see https://reakit.io/docs/composite/#performance.\n\t\t\t\tid={ `edit-site-patterns-${ item.name }` }\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? onClick : undefined\n\t\t\t\t}\n\t\t\t\taria-disabled={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? 'false' : 'true'\n\t\t\t\t}\n\t\t\t\taria-label={ item.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ isEmpty && isTemplatePart && __( 'Empty template part' ) }\n\t\t\t\t{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\tblocks={ item.blocks }\n\t\t\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ index }\n\t\t\t\t\thidden\n\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t>\n\t\t\t\t\t{ ariaDescription }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t<HStack\n\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\tjustify=\"space-between\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t>\n\t\t\t\t\t{ itemIcon && ! isNonUserPattern && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t'Editing this pattern will also update anywhere it is used'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme ? (\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\t\t// Required for the grid's roving tab index system.\n\t\t\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.title || item.name }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-lock-icon\"\n\t\t\t\t\t\t\t\t\ticon={ lockSmall }\n\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t</HStack>\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ isCustomPattern && ! hasThemeFile && (\n\t\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\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<DuplicateMenuItem\n\t\t\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tlabel={ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ item.type === PATTERN_TYPES.user && (\n\t\t\t\t\t\t\t\t<MenuItem onClick={ () => exportAsJSON() }>\n\t\t\t\t\t\t\t\t\t{ __( 'Export as JSON' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ isCustomPattern && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tisDestructive={ ! hasThemeFile }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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{ hasThemeFile\n\t\t\t\t\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t</HStack>\n\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tconfirmButtonText={ confirmButtonText }\n\t\t\t\t\tonConfirm={ deleteItem }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ confirmPrompt }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</li>\n\t);\n}\n\nexport default memo( GridItem );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,SAAS,IAAIC,SAAS,QAAQ,a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,UAAU,EAAGA,UAAY;IACzBC,IAAI,EAAGA,IAAM;IACboF,OAAO,EAAGA,OAAS;IACnBJ,KAAK,EAAGzG,EAAE,CAAE,WAAY;EAAG,CAC3B,CAAC,EACAyB,IAAI,CAACW,IAAI,KAAKrB,aAAa,CAACsB,IAAI,IACjC+C,aAAA,CAAC/F,QAAQ;IAACoD,OAAO,EAAGA,CAAA,KAAMkB,YAAY,CAAC;EAAG,GACvC3D,EAAE,CAAE,gBAAiB,CACd,CACV,EAECqE,eAAe,IAChBe,aAAA,CAAC/F,QAAQ;IACRyH,aAAa,EAAG,CAAEvC,YAAc;IAChC9B,OAAO,EAAGA,CAAA,KACTZ,qBAAqB,CAAE,IAAK;EAC5B,GAEC0C,YAAY,GACXvE,EAAE,CAAE,sBAAuB,CAAC,GAC5BA,EAAE,CAAE,QAAS,CACP,CAED,CAEC,CACP,CAAC,EAEP4B,kBAAkB,IACnBwD,aAAA,CAAClG,aAAa;IACb8F,iBAAiB,EAAGA,iBAAmB;IACvC+B,SAAS,EAAGrD,UAAY;IACxBsD,QAAQ,EAAGA,CAAA,KAAMnF,qBAAqB,CAAE,KAAM;EAAG,GAE/CoD,aACY,CAEb,CAAC;AAEP;AAEA,eAAelF,IAAI,CAAEwB,QAAS,CAAC"}
1
+ {"version":3,"names":["classnames","paramCase","kebabCase","BlockPreview","privateApis","blockEditorPrivateApis","Button","__experimentalConfirmDialog","ConfirmDialog","DropdownMenu","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalHStack","HStack","Tooltip","Flex","useDispatch","useState","useId","memo","__","sprintf","Icon","header","footer","symbolFilled","uncategorized","symbol","moreVertical","lockSmall","store","noticesStore","reusableBlocksStore","RenameMenuItem","DuplicateMenuItem","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","editSiteStore","useLink","unlock","download","fileName","content","contentType","file","window","Blob","type","a","document","createElement","href","URL","createObjectURL","style","display","body","appendChild","click","removeChild","useGlobalStyle","templatePartIcons","GridItem","categoryId","item","props","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","backgroundColor","removeTemplate","__experimentalDeleteReusableBlock","createErrorNotice","createSuccessNotice","isUserPattern","user","isNonUserPattern","theme","isTemplatePart","onClick","postType","postId","id","name","categoryType","isEmpty","blocks","length","patternClassNames","previewClassNames","deletePattern","title","error","errorMessage","message","code","deleteItem","exportAsJSON","json","__file","patternBlock","raw","syncStatus","wp_pattern_sync_status","JSON","stringify","isCustomPattern","isCustom","hasThemeFile","templatePart","has_theme_file","ariaDescriptions","push","description","itemIcon","full","undefined","confirmButtonText","confirmPrompt","additionalStyles","css","className","map","_","index","join","ariaDescription","key","hidden","justify","alignment","spacing","placement","text","icon","as","gap","level","variant","tabIndex","size","label","popoverProps","toggleProps","describedBy","onClose","isDestructive","onConfirm","onCancel"],"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId, memo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled as uncategorized,\n\tsymbol,\n\tmoreVertical,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport RenameMenuItem from './rename-menu-item';\nimport DuplicateMenuItem from './duplicate-menu-item';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n} from '../../utils/constants';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Downloads a file.\n * Also used in packages/list-reusable-blocks/src/utils/file.js.\n *\n * @param {string} fileName File Name.\n * @param {string} content File Content.\n * @param {string} contentType File mime type.\n */\nfunction download( fileName, content, contentType ) {\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst a = document.createElement( 'a' );\n\ta.href = URL.createObjectURL( file );\n\ta.download = fileName;\n\ta.style.display = 'none';\n\tdocument.body.appendChild( a );\n\ta.click();\n\tdocument.body.removeChild( a );\n}\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst templatePartIcons = { header, footer, uncategorized };\n\nfunction GridItem( { categoryId, item, ...props } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\tconst isNonUserPattern = item.type === PATTERN_TYPES.theme;\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: isUserPattern ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,\n\t} );\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-patterns__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-patterns__preview', {\n\t\t'is-inactive': isNonUserPattern,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The pattern's title e.g. 'Call to action'.\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\titem.title\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'edit-site-patterns-error',\n\t\t\t} );\n\t\t}\n\t};\n\tconst deleteItem = () =>\n\t\tisTemplatePart ? removeTemplate( item ) : deletePattern();\n\tconst exportAsJSON = () => {\n\t\tconst json = {\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item.patternBlock.content.raw,\n\t\t\tsyncStatus: item.patternBlock.wp_pattern_sync_status,\n\t\t};\n\n\t\treturn download(\n\t\t\t`${ kebabCase( item.title || item.name ) }.json`,\n\t\t\tJSON.stringify( json, null, 2 ),\n\t\t\t'application/json'\n\t\t);\n\t};\n\n\t// Only custom patterns or custom template parts can be renamed or deleted.\n\tconst isCustomPattern =\n\t\tisUserPattern || ( isTemplatePart && item.isCustom );\n\tconst hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;\n\tconst ariaDescriptions = [];\n\n\tif ( isCustomPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescriptions.push(\n\t\t\t__( 'Press Enter to edit, or Delete to delete the pattern.' )\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescriptions.push( item.description );\n\t}\n\n\tif ( isNonUserPattern ) {\n\t\tariaDescriptions.push(\n\t\t\t__( 'Theme & plugin patterns cannot be edited.' )\n\t\t);\n\t}\n\n\tlet itemIcon;\n\tif ( ! isUserPattern && templatePartIcons[ categoryId ] ) {\n\t\titemIcon = templatePartIcons[ categoryId ];\n\t} else {\n\t\titemIcon =\n\t\t\titem.syncStatus === PATTERN_SYNC_TYPES.full ? symbol : undefined;\n\t}\n\n\tconst confirmButtonText = hasThemeFile ? __( 'Clear' ) : __( 'Delete' );\n\tconst confirmPrompt = hasThemeFile\n\t\t? __( 'Are you sure you want to clear these customizations?' )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: The pattern or template part's title e.g. 'Call to action'.\n\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\titem.title || item.name\n\t\t );\n\n\tconst additionalStyles = ! backgroundColor\n\t\t? [ { css: 'body { background: #fff; }' } ]\n\t\t: undefined;\n\n\treturn (\n\t\t<li className={ patternClassNames }>\n\t\t\t<button\n\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t// Even though still incomplete, passing ids helps performance.\n\t\t\t\t// @see https://reakit.io/docs/composite/#performance.\n\t\t\t\tid={ `edit-site-patterns-${ item.name }` }\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? onClick : undefined\n\t\t\t\t}\n\t\t\t\taria-disabled={\n\t\t\t\t\titem.type !== PATTERN_TYPES.theme ? 'false' : 'true'\n\t\t\t\t}\n\t\t\t\taria-label={ item.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ isEmpty && isTemplatePart && __( 'Empty template part' ) }\n\t\t\t\t{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\tblocks={ item.blocks }\n\t\t\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ index }\n\t\t\t\t\thidden\n\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t>\n\t\t\t\t\t{ ariaDescription }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t<HStack\n\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\tjustify=\"space-between\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t>\n\t\t\t\t\t{ itemIcon && ! isNonUserPattern && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t'Editing this pattern will also update anywhere it is used'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme ? (\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\t\t// Required for the grid's roving tab index system.\n\t\t\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.title || item.name }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-lock-icon\"\n\t\t\t\t\t\t\t\t\ticon={ lockSmall }\n\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t</HStack>\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ isCustomPattern && ! hasThemeFile && (\n\t\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\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<DuplicateMenuItem\n\t\t\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tlabel={ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ item.type === PATTERN_TYPES.user && (\n\t\t\t\t\t\t\t\t<MenuItem onClick={ () => exportAsJSON() }>\n\t\t\t\t\t\t\t\t\t{ __( 'Export as JSON' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ isCustomPattern && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tisDestructive={ ! hasThemeFile }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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{ hasThemeFile\n\t\t\t\t\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t</HStack>\n\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tconfirmButtonText={ confirmButtonText }\n\t\t\t\t\tonConfirm={ deleteItem }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t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AGA,CAAA,KACTX,qBAAqB,CAAE,IAAK;EAC5B,GAECwC,YAAY,GACXzF,EAAE,CAAE,sBAAuB,CAAC,GAC5BA,EAAE,CAAE,QAAS,CACP,CAED,CAEC,CACP,CAAC,EAEPgD,kBAAkB,IACnBjB,aAAA,CAAC7C,aAAa;IACbgH,iBAAiB,EAAGA,iBAAmB;IACvC8B,SAAS,EAAGnD,UAAY;IACxBoD,QAAQ,EAAGA,CAAA,KAAMhF,qBAAqB,CAAE,KAAM;EAAG,GAE/CkD,aACY,CAEb,CAAC;AAEP;AAEA,eAAepG,IAAI,CAAE4C,QAAS,CAAC"}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  */
5
5
  import { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';
6
6
  import { SearchControl, __experimentalVStack as VStack, Flex, FlexBlock, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
7
- import { __, isRTL } from '@wordpress/i18n';
7
+ import { __, _x, isRTL } from '@wordpress/i18n';
8
8
  import { chevronLeft, chevronRight } from '@wordpress/icons';
9
9
  import { privateApis as routerPrivateApis } from '@wordpress/router';
10
10
  import { useAsyncList, useViewportMatch } from '@wordpress/compose';
@@ -26,9 +26,9 @@ const {
26
26
  useHistory
27
27
  } = unlock(routerPrivateApis);
28
28
  const SYNC_FILTERS = {
29
- all: __('All'),
30
- [PATTERN_SYNC_TYPES.full]: __('Synced'),
31
- [PATTERN_SYNC_TYPES.unsynced]: __('Not synced')
29
+ all: _x('All', 'Option that shows all patterns'),
30
+ [PATTERN_SYNC_TYPES.full]: _x('Synced', 'Option that shows all synchronized patterns'),
31
+ [PATTERN_SYNC_TYPES.unsynced]: _x('Not synced', 'Option that shows all patterns that are not synchronized')
32
32
  };
33
33
  const SYNC_DESCRIPTIONS = {
34
34
  all: '',
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useDeferredValue","useId","useMemo","SearchControl","__experimentalVStack","VStack","Flex","FlexBlock","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalHeading","Heading","__experimentalText","Text","__","isRTL","chevronLeft","chevronRight","privateApis","routerPrivateApis","useAsyncList","useViewportMatch","PatternsHeader","Grid","NoPatterns","usePatterns","SidebarButton","useDebouncedInput","unlock","PATTERN_SYNC_TYPES","PATTERN_TYPES","Pagination","useLocation","useHistory","SYNC_FILTERS","all","full","unsynced","SYNC_DESCRIPTIONS","PAGE_SIZE","PatternsList","categoryId","type","location","history","isMobileViewport","filterValue","setFilterValue","delayedFilterValue","deferredFilterValue","syncFilter","setSyncFilter","currentPage","setCurrentPage","deferredSyncedFilter","isUncategorizedThemePatterns","theme","patterns","isResolving","search","syncStatus","undefined","updateSearchFilter","value","updateSyncFilter","id","titleId","descriptionId","hasPatterns","length","title","description","totalItems","pageIndex","numPages","Math","ceil","list","slice","asyncList","step","changePage","page","scrollContainer","document","querySelector","scrollTo","createElement","Fragment","className","spacing","alignment","wrap","icon","label","onClick","state","backPath","back","push","path","onChange","placeholder","__nextHasNoMarginBottom","hideLabelFromVision","isBlock","Object","entries","map","key","justify","as","level","variant","items"],"sources":["@wordpress/edit-site/src/components/page-patterns/patterns-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';\nimport {\n\tSearchControl,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PatternsHeader from './header';\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\nimport { PATTERN_SYNC_TYPES, PATTERN_TYPES } from '../../utils/constants';\nimport Pagination from './pagination';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst SYNC_FILTERS = {\n\tall: __( 'All' ),\n\t[ PATTERN_SYNC_TYPES.full ]: __( 'Synced' ),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __( 'Not synced' ),\n};\n\nconst SYNC_DESCRIPTIONS = {\n\tall: '',\n\t[ PATTERN_SYNC_TYPES.full ]: __(\n\t\t'Patterns that are kept in sync across the site.'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __(\n\t\t'Patterns that can be changed freely without affecting the site.'\n\t),\n};\n\nconst PAGE_SIZE = 20;\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\tconst deferredFilterValue = useDeferredValue( delayedFilterValue );\n\n\tconst [ syncFilter, setSyncFilter ] = useState( 'all' );\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\n\tconst deferredSyncedFilter = useDeferredValue( syncFilter );\n\n\tconst isUncategorizedThemePatterns =\n\t\ttype === PATTERN_TYPES.theme && categoryId === 'uncategorized';\n\n\tconst { patterns, isResolving } = usePatterns(\n\t\ttype,\n\t\tisUncategorizedThemePatterns ? '' : categoryId,\n\t\t{\n\t\t\tsearch: deferredFilterValue,\n\t\t\tsyncStatus:\n\t\t\t\tdeferredSyncedFilter === 'all'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: deferredSyncedFilter,\n\t\t}\n\t);\n\n\tconst updateSearchFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetFilterValue( value );\n\t};\n\n\tconst updateSyncFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetSyncFilter( value );\n\t};\n\n\tconst id = useId();\n\tconst titleId = `${ id }-title`;\n\tconst descriptionId = `${ id }-description`;\n\n\tconst hasPatterns = patterns.length;\n\tconst title = SYNC_FILTERS[ syncFilter ];\n\tconst description = SYNC_DESCRIPTIONS[ syncFilter ];\n\n\tconst totalItems = patterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst numPages = Math.ceil( patterns.length / PAGE_SIZE );\n\n\tconst list = useMemo( () => {\n\t\treturn patterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, patterns ] );\n\n\tconst asyncList = useAsyncList( list, { step: 10 } );\n\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = document.querySelector( '.edit-site-patterns' );\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack className=\"edit-site-patterns__header\" spacing={ 6 }>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\tdescriptionId={ descriptionId }\n\t\t\t\t/>\n\t\t\t\t<Flex alignment=\"stretch\" wrap>\n\t\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t// Go back in history if we came from the Patterns page.\n\t\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tlocation.state?.backPath === '/patterns'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\thistory.push( { path: '/patterns' } );\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\t<FlexBlock className=\"edit-site-patterns__search-block\">\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__search\"\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateSearchFilter( value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t{ type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tlabel={ __( 'Filter by sync status' ) }\n\t\t\t\t\t\t\tvalue={ syncFilter }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => updateSyncFilter( value ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Object.entries( SYNC_FILTERS ).map(\n\t\t\t\t\t\t\t\t( [ key, label ] ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter-option\"\n\t\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</VStack>\n\t\t\t<VStack\n\t\t\t\tclassName=\"edit-site-patterns__section\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 6 }\n\t\t\t>\n\t\t\t\t{ syncFilter !== 'all' && (\n\t\t\t\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } id={ titleId }>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ description ? (\n\t\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\titems={ asyncList }\n\t\t\t\t\t\taria-labelledby={ titleId }\n\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t\t</VStack>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<Pagination\n\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\tchangePage={ changePage }\n\t\t\t\t\ttotalItems={ totalItems }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,OAAO,QAAQ,oBAAoB;AAC/E,SACCC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,E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,KAAK,EAAG8C,GAAK;IACbf,KAAK,EAAGA;EAAO,CACf,CAEH,CACmB,CAEhB,CACC,CAAC,EACTP,aAAA,CAACpF,MAAM;IACNsF,SAAS,EAAC,6BAA6B;IACvCqB,OAAO,EAAC,YAAY;IACpBpB,OAAO,EAAG;EAAG,GAEXxC,UAAU,KAAK,KAAK,IACrBqC,aAAA,CAACpF,MAAM;IAACsF,SAAS,EAAC;EAAoC,GACrDF,aAAA,CAAC5E,OAAO;IAACoG,EAAE,EAAC,IAAI;IAACC,KAAK,EAAG,CAAG;IAAC/C,EAAE,EAAGC;EAAS,GACxCI,KACM,CAAC,EACRC,WAAW,GACZgB,aAAA,CAAC1E,IAAI;IAACoG,OAAO,EAAC,OAAO;IAACF,EAAE,EAAC,GAAG;IAAC9C,EAAE,EAAGE;EAAe,GAC9CI,WACG,CAAC,GACJ,IACG,CACR,EACCH,WAAW,IACZmB,aAAA,CAAChE,IAAI;IACJkB,UAAU,EAAGA,UAAY;IACzByE,KAAK,EAAGnC,SAAW;IACnB,mBAAkBb,OAAS;IAC3B,oBAAmBC;EAAe,CAClC,CACD,EACC,CAAET,WAAW,IAAI,CAAEU,WAAW,IAAImB,aAAA,CAAC/D,UAAU,MAAE,CAC1C,CAAC,EACPkD,QAAQ,GAAG,CAAC,IACba,aAAA,CAACxD,UAAU;IACVqB,WAAW,EAAGA,WAAa;IAC3BsB,QAAQ,EAAGA,QAAU;IACrBO,UAAU,EAAGA,UAAY;IACzBT,UAAU,EAAGA;EAAY,CACzB,CAED,CAAC;AAEL"}
1
+ {"version":3,"names":["useState","useDeferredValue","useId","useMemo","SearchControl","__experimentalVStack","VStack","Flex","FlexBlock","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalHeading","Heading","__experimentalText","Text","__","_x","isRTL","chevronLeft","chevronRight","privateApis","routerPrivateApis","useAsyncList","useViewportMatch","PatternsHeader","Grid","NoPatterns","usePatterns","SidebarButton","useDebouncedInput","unlock","PATTERN_SYNC_TYPES","PATTERN_TYPES","Pagination","useLocation","useHistory","SYNC_FILTERS","all","full","unsynced","SYNC_DESCRIPTIONS","PAGE_SIZE","PatternsList","categoryId","type","location","history","isMobileViewport","filterValue","setFilterValue","delayedFilterValue","deferredFilterValue","syncFilter","setSyncFilter","currentPage","setCurrentPage","deferredSyncedFilter","isUncategorizedThemePatterns","theme","patterns","isResolving","search","syncStatus","undefined","updateSearchFilter","value","updateSyncFilter","id","titleId","descriptionId","hasPatterns","length","title","description","totalItems","pageIndex","numPages","Math","ceil","list","slice","asyncList","step","changePage","page","scrollContainer","document","querySelector","scrollTo","createElement","Fragment","className","spacing","alignment","wrap","icon","label","onClick","state","backPath","back","push","path","onChange","placeholder","__nextHasNoMarginBottom","hideLabelFromVision","isBlock","Object","entries","map","key","justify","as","level","variant","items"],"sources":["@wordpress/edit-site/src/components/page-patterns/patterns-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';\nimport {\n\tSearchControl,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PatternsHeader from './header';\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\nimport { PATTERN_SYNC_TYPES, PATTERN_TYPES } from '../../utils/constants';\nimport Pagination from './pagination';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst SYNC_FILTERS = {\n\tall: _x( 'All', 'Option that shows all patterns' ),\n\t[ PATTERN_SYNC_TYPES.full ]: _x(\n\t\t'Synced',\n\t\t'Option that shows all synchronized patterns'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: _x(\n\t\t'Not synced',\n\t\t'Option that shows all patterns that are not synchronized'\n\t),\n};\n\nconst SYNC_DESCRIPTIONS = {\n\tall: '',\n\t[ PATTERN_SYNC_TYPES.full ]: __(\n\t\t'Patterns that are kept in sync across the site.'\n\t),\n\t[ PATTERN_SYNC_TYPES.unsynced ]: __(\n\t\t'Patterns that can be changed freely without affecting the site.'\n\t),\n};\n\nconst PAGE_SIZE = 20;\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\tconst deferredFilterValue = useDeferredValue( delayedFilterValue );\n\n\tconst [ syncFilter, setSyncFilter ] = useState( 'all' );\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\n\tconst deferredSyncedFilter = useDeferredValue( syncFilter );\n\n\tconst isUncategorizedThemePatterns =\n\t\ttype === PATTERN_TYPES.theme && categoryId === 'uncategorized';\n\n\tconst { patterns, isResolving } = usePatterns(\n\t\ttype,\n\t\tisUncategorizedThemePatterns ? '' : categoryId,\n\t\t{\n\t\t\tsearch: deferredFilterValue,\n\t\t\tsyncStatus:\n\t\t\t\tdeferredSyncedFilter === 'all'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: deferredSyncedFilter,\n\t\t}\n\t);\n\n\tconst updateSearchFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetFilterValue( value );\n\t};\n\n\tconst updateSyncFilter = ( value ) => {\n\t\tsetCurrentPage( 1 );\n\t\tsetSyncFilter( value );\n\t};\n\n\tconst id = useId();\n\tconst titleId = `${ id }-title`;\n\tconst descriptionId = `${ id }-description`;\n\n\tconst hasPatterns = patterns.length;\n\tconst title = SYNC_FILTERS[ syncFilter ];\n\tconst description = SYNC_DESCRIPTIONS[ syncFilter ];\n\n\tconst totalItems = patterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst numPages = Math.ceil( patterns.length / PAGE_SIZE );\n\n\tconst list = useMemo( () => {\n\t\treturn patterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, patterns ] );\n\n\tconst asyncList = useAsyncList( list, { step: 10 } );\n\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = document.querySelector( '.edit-site-patterns' );\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack className=\"edit-site-patterns__header\" spacing={ 6 }>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\tdescriptionId={ descriptionId }\n\t\t\t\t/>\n\t\t\t\t<Flex alignment=\"stretch\" wrap>\n\t\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t// Go back in history if we came from the Patterns page.\n\t\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tlocation.state?.backPath === '/patterns'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\thistory.push( { path: '/patterns' } );\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\t<FlexBlock className=\"edit-site-patterns__search-block\">\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__search\"\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateSearchFilter( value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t{ type === PATTERN_TYPES.theme && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tlabel={ __( 'Filter by sync status' ) }\n\t\t\t\t\t\t\tvalue={ syncFilter }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => updateSyncFilter( value ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Object.entries( SYNC_FILTERS ).map(\n\t\t\t\t\t\t\t\t( [ key, label ] ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter-option\"\n\t\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</VStack>\n\t\t\t<VStack\n\t\t\t\tclassName=\"edit-site-patterns__section\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 6 }\n\t\t\t>\n\t\t\t\t{ syncFilter !== 'all' && (\n\t\t\t\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } id={ titleId }>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ description ? (\n\t\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\titems={ asyncList }\n\t\t\t\t\t\taria-labelledby={ titleId }\n\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t\t</VStack>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<Pagination\n\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\tchangePage={ changePage }\n\t\t\t\t\ttotalItems={ totalItems }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,OAAO,QAAQ,oBAAoB;AAC/E,SACCC,aAAa,EACbC,oBAAoB,IAAIC,MAAM,EAC9BC,IAAI,EACJC,SAAS,EACTC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,EAClEC,qBAAqB,IAAIC,OAAO,EAChCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,S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MAAM;IACNuF,SAAS,EAAC,6BAA6B;IACvCqB,OAAO,EAAC,YAAY;IACpBpB,OAAO,EAAG;EAAG,GAEXxC,UAAU,KAAK,KAAK,IACrBqC,aAAA,CAACrF,MAAM;IAACuF,SAAS,EAAC;EAAoC,GACrDF,aAAA,CAAC7E,OAAO;IAACqG,EAAE,EAAC,IAAI;IAACC,KAAK,EAAG,CAAG;IAAC/C,EAAE,EAAGC;EAAS,GACxCI,KACM,CAAC,EACRC,WAAW,GACZgB,aAAA,CAAC3E,IAAI;IAACqG,OAAO,EAAC,OAAO;IAACF,EAAE,EAAC,GAAG;IAAC9C,EAAE,EAAGE;EAAe,GAC9CI,WACG,CAAC,GACJ,IACG,CACR,EACCH,WAAW,IACZmB,aAAA,CAAChE,IAAI;IACJkB,UAAU,EAAGA,UAAY;IACzByE,KAAK,EAAGnC,SAAW;IACnB,mBAAkBb,OAAS;IAC3B,oBAAmBC;EAAe,CAClC,CACD,EACC,CAAET,WAAW,IAAI,CAAEU,WAAW,IAAImB,aAAA,CAAC/D,UAAU,MAAE,CAC1C,CAAC,EACPkD,QAAQ,GAAG,CAAC,IACba,aAAA,CAACxD,UAAU;IACVqB,WAAW,EAAGA,WAAa;IAC3BsB,QAAQ,EAAGA,QAAU;IACrBO,UAAU,EAAGA,UAAY;IACzBT,UAAU,EAAGA;EAAY,CACzB,CAED,CAAC;AAEL"}
@@ -0,0 +1,58 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { MenuItem } from '@wordpress/components';
6
+ import { useState } from '@wordpress/element';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import { unlock } from '../../lock-unlock';
18
+ const {
19
+ RenamePatternCategoryModal
20
+ } = unlock(patternsPrivateApis);
21
+ export default function RenameCategoryMenuItem({
22
+ category,
23
+ onClose
24
+ }) {
25
+ const [isModalOpen, setIsModalOpen] = useState(false);
26
+ return createElement(Fragment, null, createElement(MenuItem, {
27
+ onClick: () => setIsModalOpen(true)
28
+ }, __('Rename')), isModalOpen && createElement(RenameModal, {
29
+ category: category,
30
+ onClose: () => {
31
+ setIsModalOpen(false);
32
+ onClose();
33
+ }
34
+ }));
35
+ }
36
+ function RenameModal({
37
+ category,
38
+ onClose
39
+ }) {
40
+ // User created pattern categories have their properties updated when
41
+ // retrieved via `getUserPatternCategories`. The rename modal expects an
42
+ // object that will match the pattern category entity.
43
+ const normalizedCategory = {
44
+ id: category.id,
45
+ slug: category.slug,
46
+ name: category.label
47
+ };
48
+
49
+ // Optimization - only use pattern categories when the modal is open.
50
+ const existingCategories = usePatternCategories();
51
+ return createElement(RenamePatternCategoryModal, {
52
+ category: normalizedCategory,
53
+ existingCategories: existingCategories,
54
+ onClose: onClose,
55
+ overlayClassName: "edit-site-list__rename-modal"
56
+ });
57
+ }
58
+ //# sourceMappingURL=rename-category-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MenuItem","useState","__","privateApis","patternsPrivateApis","usePatternCategories","unlock","RenamePatternCategoryModal","RenameCategoryMenuItem","category","onClose","isModalOpen","setIsModalOpen","createElement","Fragment","onClick","RenameModal","normalizedCategory","id","slug","name","label","existingCategories","overlayClassName"],"sources":["@wordpress/edit-site/src/components/page-patterns/rename-category-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n/**\n * Internal dependencies\n */\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { RenamePatternCategoryModal } = unlock( patternsPrivateApis );\n\nexport default function RenameCategoryMenuItem( { category, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction RenameModal( { category, onClose } ) {\n\t// User created pattern categories have their properties updated when\n\t// retrieved via `getUserPatternCategories`. The rename modal expects an\n\t// object that will match the pattern category entity.\n\tconst normalizedCategory = {\n\t\tid: category.id,\n\t\tslug: category.slug,\n\t\tname: category.label,\n\t};\n\n\t// Optimization - only use pattern categories when the modal is open.\n\tconst existingCategories = usePatternCategories();\n\n\treturn (\n\t\t<RenamePatternCategoryModal\n\t\t\tcategory={ normalizedCategory }\n\t\t\texistingCategories={ existingCategories }\n\t\t\tonClose={ onClose }\n\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,8DAA8D;;AAE/F;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAA2B,CAAC,GAAGD,MAAM,CAAEF,mBAAoB,CAAC;AAEpE,eAAe,SAASI,sBAAsBA,CAAE;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EACvE,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAGX,QAAQ,CAAE,KAAM,CAAC;EAEzD,OACCY,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACb,QAAQ;IAACe,OAAO,EAAGA,CAAA,KAAMH,cAAc,CAAE,IAAK;EAAG,GAC/CV,EAAE,CAAE,QAAS,CACN,CAAC,EACTS,WAAW,IACZE,aAAA,CAACG,WAAW;IACXP,QAAQ,EAAGA,QAAU;IACrBC,OAAO,EAAGA,CAAA,KAAM;MACfE,cAAc,CAAE,KAAM,CAAC;MACvBF,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CAED,CAAC;AAEL;AAEA,SAASM,WAAWA,CAAE;EAAEP,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EAC7C;EACA;EACA;EACA,MAAMO,kBAAkB,GAAG;IAC1BC,EAAE,EAAET,QAAQ,CAACS,EAAE;IACfC,IAAI,EAAEV,QAAQ,CAACU,IAAI;IACnBC,IAAI,EAAEX,QAAQ,CAACY;EAChB,CAAC;;EAED;EACA,MAAMC,kBAAkB,GAAGjB,oBAAoB,CAAC,CAAC;EAEjD,OACCQ,aAAA,CAACN,0BAA0B;IAC1BE,QAAQ,EAAGQ,kBAAoB;IAC/BK,kBAAkB,EAAGA,kBAAoB;IACzCZ,OAAO,EAAGA,OAAS;IACnBa,gBAAgB,EAAC;EAA8B,CAC/C,CAAC;AAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.19.12",
3
+ "version": "5.19.13",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,44 +27,44 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.42.12",
31
- "@wordpress/api-fetch": "^6.39.12",
32
- "@wordpress/block-editor": "^12.10.12",
33
- "@wordpress/block-library": "^8.19.12",
34
- "@wordpress/blocks": "^12.19.12",
35
- "@wordpress/commands": "^0.13.12",
36
- "@wordpress/components": "^25.8.12",
37
- "@wordpress/compose": "^6.19.12",
38
- "@wordpress/core-commands": "^0.11.12",
39
- "@wordpress/core-data": "^6.19.12",
40
- "@wordpress/data": "^9.12.12",
41
- "@wordpress/date": "^4.42.12",
42
- "@wordpress/deprecated": "^3.42.12",
43
- "@wordpress/dom": "^3.42.12",
44
- "@wordpress/editor": "^13.19.12",
45
- "@wordpress/element": "^5.19.12",
46
- "@wordpress/escape-html": "^2.42.12",
47
- "@wordpress/hooks": "^3.42.12",
48
- "@wordpress/html-entities": "^3.42.12",
49
- "@wordpress/i18n": "^4.42.12",
50
- "@wordpress/icons": "^9.33.12",
51
- "@wordpress/interface": "^5.19.12",
52
- "@wordpress/keyboard-shortcuts": "^4.19.12",
53
- "@wordpress/keycodes": "^3.42.12",
54
- "@wordpress/media-utils": "^4.33.12",
55
- "@wordpress/notices": "^4.10.12",
56
- "@wordpress/patterns": "^1.3.12",
57
- "@wordpress/plugins": "^6.10.12",
58
- "@wordpress/preferences": "^3.19.12",
59
- "@wordpress/primitives": "^3.40.12",
60
- "@wordpress/private-apis": "^0.24.12",
61
- "@wordpress/reusable-blocks": "^4.19.12",
62
- "@wordpress/router": "^0.11.12",
63
- "@wordpress/style-engine": "^1.25.12",
64
- "@wordpress/url": "^3.43.12",
65
- "@wordpress/viewport": "^5.19.12",
66
- "@wordpress/widgets": "^3.19.12",
67
- "@wordpress/wordcount": "^3.42.12",
30
+ "@wordpress/a11y": "^3.42.13",
31
+ "@wordpress/api-fetch": "^6.39.13",
32
+ "@wordpress/block-editor": "^12.10.13",
33
+ "@wordpress/block-library": "^8.19.13",
34
+ "@wordpress/blocks": "^12.19.13",
35
+ "@wordpress/commands": "^0.13.13",
36
+ "@wordpress/components": "^25.8.13",
37
+ "@wordpress/compose": "^6.19.13",
38
+ "@wordpress/core-commands": "^0.11.13",
39
+ "@wordpress/core-data": "^6.19.13",
40
+ "@wordpress/data": "^9.12.13",
41
+ "@wordpress/date": "^4.42.13",
42
+ "@wordpress/deprecated": "^3.42.13",
43
+ "@wordpress/dom": "^3.42.13",
44
+ "@wordpress/editor": "^13.19.13",
45
+ "@wordpress/element": "^5.19.13",
46
+ "@wordpress/escape-html": "^2.42.13",
47
+ "@wordpress/hooks": "^3.42.13",
48
+ "@wordpress/html-entities": "^3.42.13",
49
+ "@wordpress/i18n": "^4.42.13",
50
+ "@wordpress/icons": "^9.33.13",
51
+ "@wordpress/interface": "^5.19.13",
52
+ "@wordpress/keyboard-shortcuts": "^4.19.13",
53
+ "@wordpress/keycodes": "^3.42.13",
54
+ "@wordpress/media-utils": "^4.33.13",
55
+ "@wordpress/notices": "^4.10.13",
56
+ "@wordpress/patterns": "^1.3.13",
57
+ "@wordpress/plugins": "^6.10.13",
58
+ "@wordpress/preferences": "^3.19.13",
59
+ "@wordpress/primitives": "^3.40.13",
60
+ "@wordpress/private-apis": "^0.24.13",
61
+ "@wordpress/reusable-blocks": "^4.19.13",
62
+ "@wordpress/router": "^0.11.13",
63
+ "@wordpress/style-engine": "^1.25.13",
64
+ "@wordpress/url": "^3.43.13",
65
+ "@wordpress/viewport": "^5.19.13",
66
+ "@wordpress/widgets": "^3.19.13",
67
+ "@wordpress/wordcount": "^3.42.13",
68
68
  "change-case": "^4.1.2",
69
69
  "classnames": "^2.3.1",
70
70
  "colord": "^2.9.2",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "8447c60232efe04eb248a1c893bf3a1fc4e47ecc"
87
+ "gitHead": "70b30e9461372ae518e3d0e50f7e5085eda8b46e"
88
88
  }
@@ -284,13 +284,7 @@ function ScreenBlock( { name, variation } ) {
284
284
  inheritedValue={ inheritedStyleWithLayout }
285
285
  value={ styleWithLayout }
286
286
  onChange={ setStyle }
287
- settings={ {
288
- ...settings,
289
- color: {
290
- ...settings.color,
291
- customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
292
- },
293
- } }
287
+ settings={ settings }
294
288
  includeLayoutControls
295
289
  />
296
290
  ) }
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import downloadjs from 'downloadjs';
6
5
  import { paramCase as kebabCase } from 'change-case';
7
6
 
8
7
  /**
@@ -52,6 +51,25 @@ import { store as editSiteStore } from '../../store';
52
51
  import { useLink } from '../routes/link';
53
52
  import { unlock } from '../../lock-unlock';
54
53
 
54
+ /**
55
+ * Downloads a file.
56
+ * Also used in packages/list-reusable-blocks/src/utils/file.js.
57
+ *
58
+ * @param {string} fileName File Name.
59
+ * @param {string} content File Content.
60
+ * @param {string} contentType File mime type.
61
+ */
62
+ function download( fileName, content, contentType ) {
63
+ const file = new window.Blob( [ content ], { type: contentType } );
64
+ const a = document.createElement( 'a' );
65
+ a.href = URL.createObjectURL( file );
66
+ a.download = fileName;
67
+ a.style.display = 'none';
68
+ document.body.appendChild( a );
69
+ a.click();
70
+ document.body.removeChild( a );
71
+ }
72
+
55
73
  const { useGlobalStyle } = unlock( blockEditorPrivateApis );
56
74
 
57
75
  const templatePartIcons = { header, footer, uncategorized };
@@ -118,9 +136,9 @@ function GridItem( { categoryId, item, ...props } ) {
118
136
  syncStatus: item.patternBlock.wp_pattern_sync_status,
119
137
  };
120
138
 
121
- return downloadjs(
122
- JSON.stringify( json, null, 2 ),
139
+ return download(
123
140
  `${ kebabCase( item.title || item.name ) }.json`,
141
+ JSON.stringify( json, null, 2 ),
124
142
  'application/json'
125
143
  );
126
144
  };
@@ -12,7 +12,7 @@ import {
12
12
  __experimentalHeading as Heading,
13
13
  __experimentalText as Text,
14
14
  } from '@wordpress/components';
15
- import { __, isRTL } from '@wordpress/i18n';
15
+ import { __, _x, isRTL } from '@wordpress/i18n';
16
16
  import { chevronLeft, chevronRight } from '@wordpress/icons';
17
17
  import { privateApis as routerPrivateApis } from '@wordpress/router';
18
18
  import { useAsyncList, useViewportMatch } from '@wordpress/compose';
@@ -33,9 +33,15 @@ import Pagination from './pagination';
33
33
  const { useLocation, useHistory } = unlock( routerPrivateApis );
34
34
 
35
35
  const SYNC_FILTERS = {
36
- all: __( 'All' ),
37
- [ PATTERN_SYNC_TYPES.full ]: __( 'Synced' ),
38
- [ PATTERN_SYNC_TYPES.unsynced ]: __( 'Not synced' ),
36
+ all: _x( 'All', 'Option that shows all patterns' ),
37
+ [ PATTERN_SYNC_TYPES.full ]: _x(
38
+ 'Synced',
39
+ 'Option that shows all synchronized patterns'
40
+ ),
41
+ [ PATTERN_SYNC_TYPES.unsynced ]: _x(
42
+ 'Not synced',
43
+ 'Option that shows all patterns that are not synchronized'
44
+ ),
39
45
  };
40
46
 
41
47
  const SYNC_DESCRIPTIONS = {
@@ -0,0 +1,62 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { MenuItem } from '@wordpress/components';
5
+ import { useState } from '@wordpress/element';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import { unlock } from '../../lock-unlock';
17
+
18
+ const { RenamePatternCategoryModal } = unlock( patternsPrivateApis );
19
+
20
+ export default function RenameCategoryMenuItem( { category, onClose } ) {
21
+ const [ isModalOpen, setIsModalOpen ] = useState( false );
22
+
23
+ return (
24
+ <>
25
+ <MenuItem onClick={ () => setIsModalOpen( true ) }>
26
+ { __( 'Rename' ) }
27
+ </MenuItem>
28
+ { isModalOpen && (
29
+ <RenameModal
30
+ category={ category }
31
+ onClose={ () => {
32
+ setIsModalOpen( false );
33
+ onClose();
34
+ } }
35
+ />
36
+ ) }
37
+ </>
38
+ );
39
+ }
40
+
41
+ function RenameModal( { category, onClose } ) {
42
+ // User created pattern categories have their properties updated when
43
+ // retrieved via `getUserPatternCategories`. The rename modal expects an
44
+ // object that will match the pattern category entity.
45
+ const normalizedCategory = {
46
+ id: category.id,
47
+ slug: category.slug,
48
+ name: category.label,
49
+ };
50
+
51
+ // Optimization - only use pattern categories when the modal is open.
52
+ const existingCategories = usePatternCategories();
53
+
54
+ return (
55
+ <RenamePatternCategoryModal
56
+ category={ normalizedCategory }
57
+ existingCategories={ existingCategories }
58
+ onClose={ onClose }
59
+ overlayClassName="edit-site-list__rename-modal"
60
+ />
61
+ );
62
+ }