@wordpress/global-styles-ui 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/block-preview-panel.cjs +36 -3
- package/build/block-preview-panel.cjs.map +3 -3
- package/build/font-library/font-collection.cjs +0 -1
- package/build/font-library/font-collection.cjs.map +2 -2
- package/build/font-sizes/rename-font-size-dialog.cjs +0 -1
- package/build/font-sizes/rename-font-size-dialog.cjs.map +2 -2
- package/build/preview-wrapper.cjs +11 -0
- package/build/preview-wrapper.cjs.map +2 -2
- package/build/screen-block.cjs +35 -23
- package/build/screen-block.cjs.map +2 -2
- package/build/screen-color-palette.cjs +8 -10
- package/build/screen-color-palette.cjs.map +3 -3
- package/build/screen-typography-element.cjs +0 -1
- package/build/screen-typography-element.cjs.map +2 -2
- package/build/shadows-edit-panel.cjs +0 -3
- package/build/shadows-edit-panel.cjs.map +2 -2
- package/build/size-control/index.cjs +0 -2
- package/build/size-control/index.cjs.map +2 -2
- package/build/utils.cjs +7 -2
- package/build/utils.cjs.map +3 -3
- package/build-module/block-preview-panel.mjs +40 -4
- package/build-module/block-preview-panel.mjs.map +2 -2
- package/build-module/font-library/font-collection.mjs +0 -1
- package/build-module/font-library/font-collection.mjs.map +2 -2
- package/build-module/font-sizes/rename-font-size-dialog.mjs +0 -1
- package/build-module/font-sizes/rename-font-size-dialog.mjs.map +2 -2
- package/build-module/preview-wrapper.mjs +11 -0
- package/build-module/preview-wrapper.mjs.map +2 -2
- package/build-module/screen-block.mjs +35 -23
- package/build-module/screen-block.mjs.map +2 -2
- package/build-module/screen-color-palette.mjs +8 -10
- package/build-module/screen-color-palette.mjs.map +2 -2
- package/build-module/screen-typography-element.mjs +0 -1
- package/build-module/screen-typography-element.mjs.map +2 -2
- package/build-module/shadows-edit-panel.mjs +0 -3
- package/build-module/shadows-edit-panel.mjs.map +2 -2
- package/build-module/size-control/index.mjs +0 -2
- package/build-module/size-control/index.mjs.map +2 -2
- package/build-module/utils.mjs +11 -3
- package/build-module/utils.mjs.map +2 -2
- package/build-style/style-rtl.css +21 -7
- package/build-style/style.css +21 -7
- package/build-types/background-panel.d.ts +0 -3
- package/build-types/background-panel.d.ts.map +1 -1
- package/build-types/block-preview-panel.d.ts +5 -4
- package/build-types/block-preview-panel.d.ts.map +1 -1
- package/build-types/confirm-reset-shadow-dialog.d.ts +1 -1
- package/build-types/confirm-reset-shadow-dialog.d.ts.map +1 -1
- package/build-types/dimensions-panel.d.ts +0 -3
- package/build-types/dimensions-panel.d.ts.map +1 -1
- package/build-types/font-library/collection-font-variant.d.ts +1 -1
- package/build-types/font-library/collection-font-variant.d.ts.map +1 -1
- package/build-types/font-library/font-card.d.ts +1 -1
- package/build-types/font-library/font-card.d.ts.map +1 -1
- package/build-types/font-library/font-collection.d.ts.map +1 -1
- package/build-types/font-library/font-library.d.ts +1 -1
- package/build-types/font-library/font-library.d.ts.map +1 -1
- package/build-types/font-library/library-font-variant.d.ts +1 -1
- package/build-types/font-library/library-font-variant.d.ts.map +1 -1
- package/build-types/font-library/modal.d.ts +1 -1
- package/build-types/font-library/modal.d.ts.map +1 -1
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts +1 -1
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts.map +1 -1
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts +1 -1
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts.map +1 -1
- package/build-types/font-sizes/font-size-preview.d.ts +0 -3
- package/build-types/font-sizes/font-size-preview.d.ts.map +1 -1
- package/build-types/font-sizes/rename-font-size-dialog.d.ts +1 -1
- package/build-types/font-sizes/rename-font-size-dialog.d.ts.map +1 -1
- package/build-types/global-styles-ui.d.ts +1 -1
- package/build-types/global-styles-ui.d.ts.map +1 -1
- package/build-types/gradients-palette-panel.d.ts +1 -1
- package/build-types/gradients-palette-panel.d.ts.map +1 -1
- package/build-types/highlighted-colors.d.ts +1 -1
- package/build-types/highlighted-colors.d.ts.map +1 -1
- package/build-types/pagination/index.d.ts +1 -1
- package/build-types/pagination/index.d.ts.map +1 -1
- package/build-types/preview-styles.d.ts +1 -1
- package/build-types/preview-styles.d.ts.map +1 -1
- package/build-types/preview-wrapper.d.ts +1 -1
- package/build-types/preview-wrapper.d.ts.map +1 -1
- package/build-types/provider.d.ts +1 -1
- package/build-types/provider.d.ts.map +1 -1
- package/build-types/screen-block.d.ts.map +1 -1
- package/build-types/screen-color-palette.d.ts.map +1 -1
- package/build-types/screen-header.d.ts +1 -1
- package/build-types/screen-header.d.ts.map +1 -1
- package/build-types/screen-revisions/revisions-buttons.d.ts +1 -1
- package/build-types/screen-revisions/revisions-buttons.d.ts.map +1 -1
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts +1 -1
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts.map +1 -1
- package/build-types/screen-typography-element.d.ts.map +1 -1
- package/build-types/shadows-edit-panel.d.ts.map +1 -1
- package/build-types/size-control/index.d.ts.map +1 -1
- package/build-types/style-variations-container.d.ts +1 -1
- package/build-types/style-variations-container.d.ts.map +1 -1
- package/build-types/typography-example.d.ts +1 -1
- package/build-types/typography-example.d.ts.map +1 -1
- package/build-types/typography-panel.d.ts +1 -4
- package/build-types/typography-panel.d.ts.map +1 -1
- package/build-types/typography-preview.d.ts +1 -1
- package/build-types/typography-preview.d.ts.map +1 -1
- package/build-types/utils.d.ts +3 -2
- package/build-types/utils.d.ts.map +1 -1
- package/build-types/variations/variation.d.ts +1 -1
- package/build-types/variations/variation.d.ts.map +1 -1
- package/build-types/variations/variations-color.d.ts +1 -1
- package/build-types/variations/variations-color.d.ts.map +1 -1
- package/build-types/variations/variations-typography.d.ts +1 -1
- package/build-types/variations/variations-typography.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/block-preview-panel.tsx +56 -4
- package/src/font-library/font-collection.tsx +0 -1
- package/src/font-library/style.scss +4 -4
- package/src/font-sizes/rename-font-size-dialog.tsx +0 -1
- package/src/preview-wrapper.tsx +10 -0
- package/src/screen-block.tsx +40 -25
- package/src/screen-color-palette.tsx +15 -19
- package/src/screen-revisions/style.scss +1 -1
- package/src/screen-typography-element.tsx +0 -1
- package/src/shadows-edit-panel.tsx +0 -3
- package/src/size-control/index.tsx +0 -2
- package/src/stories/index.story.jsx +1 -1
- package/src/style.scss +10 -2
- package/src/utils.ts +26 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/font-library/font-collection.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseState,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalSpacer as Spacer,\n\t__experimentalText as WCText,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tNavigator,\n\t__experimentalHeading as Heading,\n\tNotice,\n\tSelectControl,\n\tFlex,\n\tButton,\n\tDropdownMenu,\n\tSearchControl,\n\tProgressBar,\n\tCheckboxControl,\n} from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { sprintf, __, _x, isRTL } from '@wordpress/i18n';\nimport {\n\tmoreVertical,\n\tnext,\n\tprevious,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport type {\n\tFontCollection as FontCollectionType,\n\tFontFace,\n\tFontFamily,\n\tCollectionFontFamily,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './context';\nimport FontCard from './font-card';\nimport filterFonts from './utils/filter-fonts';\nimport { toggleFont } from './utils/toggleFont';\nimport {\n\tgetFontsOutline,\n\tisFontFontFaceInOutline,\n} from './utils/fonts-outline';\nimport GoogleFontsConfirmDialog from './google-fonts-confirm-dialog';\nimport { downloadFontFaceAssets } from './utils';\nimport { sortFontFaces } from './utils/sort-font-faces';\nimport CollectionFontVariant from './collection-font-variant';\nimport type { FontFamilyToUpload } from './types';\n\nconst DEFAULT_CATEGORY = {\n\tslug: 'all',\n\tname: _x( 'All', 'font categories' ),\n};\n\nconst LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission';\nconst MIN_WINDOW_HEIGHT = 500;\n\nfunction FontCollection( { slug }: { slug: string } ) {\n\tconst requiresPermission = slug === 'google-fonts';\n\n\tconst getGoogleFontsPermissionFromStorage = () => {\n\t\treturn window.localStorage.getItem( LOCAL_STORAGE_ITEM ) === 'true';\n\t};\n\n\tconst [ selectedFont, setSelectedFont ] = useState< FontFamily | null >(\n\t\tnull\n\t);\n\tconst [ lastSelectedFontSlug, setLastSelectedFontSlug ] = useState<\n\t\tstring | undefined\n\t>( undefined );\n\tconst [ notice, setNotice ] = useState< {\n\t\ttype: 'success' | 'error' | 'info';\n\t\tmessage: string;\n\t} | null >( null );\n\tconst [ fontsToInstall, setFontsToInstall ] = useState< FontFamily[] >(\n\t\t[]\n\t);\n\tconst [ page, setPage ] = useState( 1 );\n\tconst [ filters, setFilters ] = useState< {\n\t\tcategory?: string;\n\t\tsearch?: string;\n\t} >( {} );\n\tconst [ renderConfirmDialog, setRenderConfirmDialog ] = useState(\n\t\trequiresPermission && ! getGoogleFontsPermissionFromStorage()\n\t);\n\tconst { installFonts, isInstalling } = useContext( FontLibraryContext );\n\tconst { record: selectedCollection, isResolving: isLoading } =\n\t\tuseEntityRecord< FontCollectionType >( 'root', 'fontCollection', slug );\n\n\tuseEffect( () => {\n\t\tconst handleStorage = () => {\n\t\t\tsetRenderConfirmDialog(\n\t\t\t\trequiresPermission && ! getGoogleFontsPermissionFromStorage()\n\t\t\t);\n\t\t};\n\t\thandleStorage();\n\t\twindow.addEventListener( 'storage', handleStorage );\n\t\treturn () => window.removeEventListener( 'storage', handleStorage );\n\t}, [ slug, requiresPermission ] );\n\n\tconst revokeAccess = () => {\n\t\twindow.localStorage.setItem( LOCAL_STORAGE_ITEM, 'false' );\n\t\twindow.dispatchEvent( new Event( 'storage' ) );\n\t};\n\n\tuseEffect( () => {\n\t\tsetSelectedFont( null );\n\t}, [ slug ] );\n\n\tuseEffect( () => {\n\t\t// If the selected fonts change, reset the selected fonts to install\n\t\tsetFontsToInstall( [] );\n\t}, [ selectedFont ] );\n\n\tconst collectionFonts = useMemo(\n\t\t() =>\n\t\t\t( selectedCollection?.font_families as\n\t\t\t\t| CollectionFontFamily[]\n\t\t\t\t| undefined ) ?? [],\n\t\t[ selectedCollection ]\n\t);\n\tconst collectionCategories = selectedCollection?.categories ?? [];\n\n\tconst categories = [ DEFAULT_CATEGORY, ...collectionCategories ];\n\n\tconst fonts = useMemo(\n\t\t() => filterFonts( collectionFonts, filters ),\n\t\t[ collectionFonts, filters ]\n\t);\n\n\t// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px\n\t// The height of each font family item is 61px.\n\tconst windowHeight = Math.max( window.innerHeight, MIN_WINDOW_HEIGHT );\n\tconst pageSize = Math.floor( ( windowHeight - 417 ) / 61 );\n\tconst totalPages = Math.ceil( fonts.length / pageSize );\n\tconst itemsStart = ( page - 1 ) * pageSize;\n\tconst itemsLimit = page * pageSize;\n\tconst items = fonts.slice( itemsStart, itemsLimit );\n\n\tconst handleCategoryFilter = ( category: string ) => {\n\t\tsetFilters( { ...filters, category } );\n\t\tsetPage( 1 );\n\t};\n\n\tconst handleUpdateSearchInput = ( value: string ) => {\n\t\tsetFilters( { ...filters, search: value } );\n\t\tsetPage( 1 );\n\t};\n\n\t// @ts-expect-error\n\tconst debouncedUpdateSearchInput = debounce( handleUpdateSearchInput, 300 );\n\n\tconst handleToggleVariant = ( font: FontFamily, face?: FontFace ) => {\n\t\tconst newFontsToInstall = toggleFont( font, face, fontsToInstall );\n\t\tsetFontsToInstall( newFontsToInstall );\n\t};\n\n\tconst fontToInstallOutline = getFontsOutline( fontsToInstall );\n\n\tconst resetFontsToInstall = () => {\n\t\tsetFontsToInstall( [] );\n\t};\n\n\tconst selectFontCount =\n\t\tfontsToInstall.length > 0\n\t\t\t? fontsToInstall[ 0 ]?.fontFace?.length ?? 0\n\t\t\t: 0;\n\n\t// Check if any fonts are selected.\n\tconst isIndeterminate =\n\t\tselectFontCount > 0 &&\n\t\tselectFontCount !== selectedFont?.fontFace?.length;\n\n\t// Check if all fonts are selected.\n\tconst isSelectAllChecked =\n\t\tselectFontCount === selectedFont?.fontFace?.length;\n\n\t// Toggle select all fonts.\n\tconst toggleSelectAll = () => {\n\t\tconst newFonts: FontFamily[] = [];\n\t\tif ( ! isSelectAllChecked && selectedFont ) {\n\t\t\tnewFonts.push( selectedFont );\n\t\t}\n\n\t\tsetFontsToInstall( newFonts );\n\t};\n\n\tconst handleInstall = async () => {\n\t\tsetNotice( null );\n\n\t\tconst fontFamily: FontFamilyToUpload = fontsToInstall[ 0 ];\n\n\t\ttry {\n\t\t\tif ( fontFamily?.fontFace ) {\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tfontFamily.fontFace.map( async ( fontFace ) => {\n\t\t\t\t\t\tif ( fontFace.src ) {\n\t\t\t\t\t\t\tfontFace.file = await downloadFontFaceAssets(\n\t\t\t\t\t\t\t\tfontFace.src\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If any of the fonts fail to download,\n\t\t\t// show an error notice and stop the request from being sent.\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'error',\n\t\t\t\tmessage: __(\n\t\t\t\t\t'Error installing the fonts, could not be downloaded.'\n\t\t\t\t),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait installFonts( [ fontFamily ] );\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'success',\n\t\t\t\tmessage: __( 'Fonts were installed successfully.' ),\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'error',\n\t\t\t\tmessage: ( error as Error ).message,\n\t\t\t} );\n\t\t}\n\t\tresetFontsToInstall();\n\t};\n\n\tconst getSortedFontFaces = ( fontFamily: FontFamily ) => {\n\t\tif ( ! fontFamily ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( ! fontFamily.fontFace || ! fontFamily.fontFace.length ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tfontFamily: fontFamily.fontFamily,\n\t\t\t\t\tfontStyle: 'normal',\n\t\t\t\t\tfontWeight: '400',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn sortFontFaces( fontFamily.fontFace );\n\t};\n\n\tif ( renderConfirmDialog ) {\n\t\treturn <GoogleFontsConfirmDialog />;\n\t}\n\n\tconst showActions =\n\t\tslug === 'google-fonts' && ! renderConfirmDialog && ! selectedFont;\n\n\treturn (\n\t\t<div className=\"font-library__tabpanel-layout\">\n\t\t\t{ isLoading && (\n\t\t\t\t<div className=\"font-library__loading\">\n\t\t\t\t\t<ProgressBar />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! isLoading && selectedCollection && (\n\t\t\t\t<>\n\t\t\t\t\t<Navigator\n\t\t\t\t\t\tinitialPath=\"/\"\n\t\t\t\t\t\tclassName=\"font-library__tabpanel-layout\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t\t\t<Heading level={ 2 } size={ 13 }>\n\t\t\t\t\t\t\t\t\t\t{ selectedCollection.name }\n\t\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t\t\t{ selectedCollection.description }\n\t\t\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t{ showActions && (\n\t\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\t\t\t\tposition: 'bottom left',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Revoke access to Google Fonts'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: revokeAccess,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<HStack spacing={ 4 } justify=\"space-between\">\n\t\t\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\t\t\tvalue={ filters.search }\n\t\t\t\t\t\t\t\t\tplaceholder={ __( 'Font name…' ) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\t\t\t\t\tonChange={ debouncedUpdateSearchInput }\n\t\t\t\t\t\t\t\t\thideLabelFromVision={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Category' ) }\n\t\t\t\t\t\t\t\t\tvalue={ filters.category }\n\t\t\t\t\t\t\t\t\tonChange={ handleCategoryFilter }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ categories &&\n\t\t\t\t\t\t\t\t\t\tcategories.map( ( category ) => (\n\t\t\t\t\t\t\t\t\t\t\t<option\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ category.slug }\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ category.name }\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</SelectControl>\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\n\t\t\t\t\t\t\t{ !! selectedCollection?.font_families?.length &&\n\t\t\t\t\t\t\t\t! fonts.length && (\n\t\t\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No fonts found. Try with a different search term.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<div className=\"font-library__fonts-grid__main\">\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items.map( ( font ) => (\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\tkey={\n\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings.slug\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list-item\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FontCard\n\t\t\t\t\t\t\t\t\t\t\t\tfont={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tnavigatorPath=\"/fontFamily\"\n\t\t\t\t\t\t\t\t\t\t\t\tshouldFocus={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.slug ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tlastSelectedFontSlug\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedFont(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Navigator.Screen>\n\n\t\t\t\t\t\t<Navigator.Screen path=\"/fontFamily\">\n\t\t\t\t\t\t\t<Flex justify=\"flex-start\">\n\t\t\t\t\t\t\t\t<Navigator.BackButton\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronRight : chevronLeft\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetLastSelectedFontSlug(\n\t\t\t\t\t\t\t\t\t\t\tselectedFont?.slug\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tsetSelectedFont( null );\n\t\t\t\t\t\t\t\t\t\tsetNotice( null );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\t\t\tclassName=\"global-styles-ui-header\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ selectedFont?.name }\n\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t{ notice && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Spacer margin={ 1 } />\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus={ notice.type }\n\t\t\t\t\t\t\t\t\t\tonRemove={ () => setNotice( null ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ notice.message }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t<Spacer margin={ 1 } />\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<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t{ __( 'Select font variants to install.' ) }\n\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\tclassName=\"font-library__select-all\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Select all' ) }\n\t\t\t\t\t\t\t\tchecked={ isSelectAllChecked }\n\t\t\t\t\t\t\t\tonChange={ toggleSelectAll }\n\t\t\t\t\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ selectedFont &&\n\t\t\t\t\t\t\t\t\t\tgetSortedFontFaces( selectedFont ).map(\n\t\t\t\t\t\t\t\t\t\t\t( face, i ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `face${ i }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list-item\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CollectionFontVariant\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfont={ selectedFont }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tface={ face }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleToggleVariant={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleToggleVariant\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected={ isFontFontFaceInOutline(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedFont.slug,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedFont.fontFace\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? face\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: null, // If the font has no fontFace, we want to check if the font is in the outline\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontToInstallOutline\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t<Spacer margin={ 16 } />\n\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t</Navigator>\n\n\t\t\t\t\t{ selectedFont && (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\tclassName=\"font-library__footer\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleInstall }\n\t\t\t\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tfontsToInstall.length === 0 || isInstalling\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Install' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! selectedFont && (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\tclassName=\"font-library__footer\"\n\t\t\t\t\t\t\tjustify=\"end\"\n\t\t\t\t\t\t\tspacing={ 6 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"font-library__page-selection\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: 1: Current page number, 2: Total number of pages.\n\t\t\t\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t\t\t\t'<div>Page</div>%1$s<div>of %2$d</div>',\n\t\t\t\t\t\t\t\t\t\t\t'paging'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t'<CurrentPage />',\n\t\t\t\t\t\t\t\t\t\ttotalPages\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdiv: <div aria-hidden />,\n\t\t\t\t\t\t\t\t\t\t// @ts-expect-error — Tag injected via sprintf argument, not visible in format string.\n\t\t\t\t\t\t\t\t\t\tCurrentPage: (\n\t\t\t\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Current page'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ page.toString() }\n\t\t\t\t\t\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t\t\t\t\t\t...Array( totalPages ),\n\t\t\t\t\t\t\t\t\t\t\t\t].map( ( e, i ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ti + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ti + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( newPage ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetPage(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparseInt( newPage )\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ () => setPage( page - 1 ) }\n\t\t\t\t\t\t\t\t\tdisabled={ page === 1 }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Previous page' ) }\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? next : previous }\n\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ () => setPage( page + 1 ) }\n\t\t\t\t\t\t\t\t\tdisabled={ page === totalPages }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Next page' ) }\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? previous : next }\n\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default FontCollection;\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,yBAAyB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,IAAI,IAAI,aAAa;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,uBAAuB;AAWhC,SAAS,0BAA0B;AACnC,OAAO,cAAc;AACrB,OAAO,iBAAiB;AACxB,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,OAAO,8BAA8B;AACrC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,OAAO,2BAA2B;AA0MzB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseState,\n\tuseMemo,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalSpacer as Spacer,\n\t__experimentalText as WCText,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tNavigator,\n\t__experimentalHeading as Heading,\n\tNotice,\n\tSelectControl,\n\tFlex,\n\tButton,\n\tDropdownMenu,\n\tSearchControl,\n\tProgressBar,\n\tCheckboxControl,\n} from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { sprintf, __, _x, isRTL } from '@wordpress/i18n';\nimport {\n\tmoreVertical,\n\tnext,\n\tprevious,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport type {\n\tFontCollection as FontCollectionType,\n\tFontFace,\n\tFontFamily,\n\tCollectionFontFamily,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './context';\nimport FontCard from './font-card';\nimport filterFonts from './utils/filter-fonts';\nimport { toggleFont } from './utils/toggleFont';\nimport {\n\tgetFontsOutline,\n\tisFontFontFaceInOutline,\n} from './utils/fonts-outline';\nimport GoogleFontsConfirmDialog from './google-fonts-confirm-dialog';\nimport { downloadFontFaceAssets } from './utils';\nimport { sortFontFaces } from './utils/sort-font-faces';\nimport CollectionFontVariant from './collection-font-variant';\nimport type { FontFamilyToUpload } from './types';\n\nconst DEFAULT_CATEGORY = {\n\tslug: 'all',\n\tname: _x( 'All', 'font categories' ),\n};\n\nconst LOCAL_STORAGE_ITEM = 'wp-font-library-google-fonts-permission';\nconst MIN_WINDOW_HEIGHT = 500;\n\nfunction FontCollection( { slug }: { slug: string } ) {\n\tconst requiresPermission = slug === 'google-fonts';\n\n\tconst getGoogleFontsPermissionFromStorage = () => {\n\t\treturn window.localStorage.getItem( LOCAL_STORAGE_ITEM ) === 'true';\n\t};\n\n\tconst [ selectedFont, setSelectedFont ] = useState< FontFamily | null >(\n\t\tnull\n\t);\n\tconst [ lastSelectedFontSlug, setLastSelectedFontSlug ] = useState<\n\t\tstring | undefined\n\t>( undefined );\n\tconst [ notice, setNotice ] = useState< {\n\t\ttype: 'success' | 'error' | 'info';\n\t\tmessage: string;\n\t} | null >( null );\n\tconst [ fontsToInstall, setFontsToInstall ] = useState< FontFamily[] >(\n\t\t[]\n\t);\n\tconst [ page, setPage ] = useState( 1 );\n\tconst [ filters, setFilters ] = useState< {\n\t\tcategory?: string;\n\t\tsearch?: string;\n\t} >( {} );\n\tconst [ renderConfirmDialog, setRenderConfirmDialog ] = useState(\n\t\trequiresPermission && ! getGoogleFontsPermissionFromStorage()\n\t);\n\tconst { installFonts, isInstalling } = useContext( FontLibraryContext );\n\tconst { record: selectedCollection, isResolving: isLoading } =\n\t\tuseEntityRecord< FontCollectionType >( 'root', 'fontCollection', slug );\n\n\tuseEffect( () => {\n\t\tconst handleStorage = () => {\n\t\t\tsetRenderConfirmDialog(\n\t\t\t\trequiresPermission && ! getGoogleFontsPermissionFromStorage()\n\t\t\t);\n\t\t};\n\t\thandleStorage();\n\t\twindow.addEventListener( 'storage', handleStorage );\n\t\treturn () => window.removeEventListener( 'storage', handleStorage );\n\t}, [ slug, requiresPermission ] );\n\n\tconst revokeAccess = () => {\n\t\twindow.localStorage.setItem( LOCAL_STORAGE_ITEM, 'false' );\n\t\twindow.dispatchEvent( new Event( 'storage' ) );\n\t};\n\n\tuseEffect( () => {\n\t\tsetSelectedFont( null );\n\t}, [ slug ] );\n\n\tuseEffect( () => {\n\t\t// If the selected fonts change, reset the selected fonts to install\n\t\tsetFontsToInstall( [] );\n\t}, [ selectedFont ] );\n\n\tconst collectionFonts = useMemo(\n\t\t() =>\n\t\t\t( selectedCollection?.font_families as\n\t\t\t\t| CollectionFontFamily[]\n\t\t\t\t| undefined ) ?? [],\n\t\t[ selectedCollection ]\n\t);\n\tconst collectionCategories = selectedCollection?.categories ?? [];\n\n\tconst categories = [ DEFAULT_CATEGORY, ...collectionCategories ];\n\n\tconst fonts = useMemo(\n\t\t() => filterFonts( collectionFonts, filters ),\n\t\t[ collectionFonts, filters ]\n\t);\n\n\t// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px\n\t// The height of each font family item is 61px.\n\tconst windowHeight = Math.max( window.innerHeight, MIN_WINDOW_HEIGHT );\n\tconst pageSize = Math.floor( ( windowHeight - 417 ) / 61 );\n\tconst totalPages = Math.ceil( fonts.length / pageSize );\n\tconst itemsStart = ( page - 1 ) * pageSize;\n\tconst itemsLimit = page * pageSize;\n\tconst items = fonts.slice( itemsStart, itemsLimit );\n\n\tconst handleCategoryFilter = ( category: string ) => {\n\t\tsetFilters( { ...filters, category } );\n\t\tsetPage( 1 );\n\t};\n\n\tconst handleUpdateSearchInput = ( value: string ) => {\n\t\tsetFilters( { ...filters, search: value } );\n\t\tsetPage( 1 );\n\t};\n\n\t// @ts-expect-error\n\tconst debouncedUpdateSearchInput = debounce( handleUpdateSearchInput, 300 );\n\n\tconst handleToggleVariant = ( font: FontFamily, face?: FontFace ) => {\n\t\tconst newFontsToInstall = toggleFont( font, face, fontsToInstall );\n\t\tsetFontsToInstall( newFontsToInstall );\n\t};\n\n\tconst fontToInstallOutline = getFontsOutline( fontsToInstall );\n\n\tconst resetFontsToInstall = () => {\n\t\tsetFontsToInstall( [] );\n\t};\n\n\tconst selectFontCount =\n\t\tfontsToInstall.length > 0\n\t\t\t? fontsToInstall[ 0 ]?.fontFace?.length ?? 0\n\t\t\t: 0;\n\n\t// Check if any fonts are selected.\n\tconst isIndeterminate =\n\t\tselectFontCount > 0 &&\n\t\tselectFontCount !== selectedFont?.fontFace?.length;\n\n\t// Check if all fonts are selected.\n\tconst isSelectAllChecked =\n\t\tselectFontCount === selectedFont?.fontFace?.length;\n\n\t// Toggle select all fonts.\n\tconst toggleSelectAll = () => {\n\t\tconst newFonts: FontFamily[] = [];\n\t\tif ( ! isSelectAllChecked && selectedFont ) {\n\t\t\tnewFonts.push( selectedFont );\n\t\t}\n\n\t\tsetFontsToInstall( newFonts );\n\t};\n\n\tconst handleInstall = async () => {\n\t\tsetNotice( null );\n\n\t\tconst fontFamily: FontFamilyToUpload = fontsToInstall[ 0 ];\n\n\t\ttry {\n\t\t\tif ( fontFamily?.fontFace ) {\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tfontFamily.fontFace.map( async ( fontFace ) => {\n\t\t\t\t\t\tif ( fontFace.src ) {\n\t\t\t\t\t\t\tfontFace.file = await downloadFontFaceAssets(\n\t\t\t\t\t\t\t\tfontFace.src\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If any of the fonts fail to download,\n\t\t\t// show an error notice and stop the request from being sent.\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'error',\n\t\t\t\tmessage: __(\n\t\t\t\t\t'Error installing the fonts, could not be downloaded.'\n\t\t\t\t),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait installFonts( [ fontFamily ] );\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'success',\n\t\t\t\tmessage: __( 'Fonts were installed successfully.' ),\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tsetNotice( {\n\t\t\t\ttype: 'error',\n\t\t\t\tmessage: ( error as Error ).message,\n\t\t\t} );\n\t\t}\n\t\tresetFontsToInstall();\n\t};\n\n\tconst getSortedFontFaces = ( fontFamily: FontFamily ) => {\n\t\tif ( ! fontFamily ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( ! fontFamily.fontFace || ! fontFamily.fontFace.length ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tfontFamily: fontFamily.fontFamily,\n\t\t\t\t\tfontStyle: 'normal',\n\t\t\t\t\tfontWeight: '400',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn sortFontFaces( fontFamily.fontFace );\n\t};\n\n\tif ( renderConfirmDialog ) {\n\t\treturn <GoogleFontsConfirmDialog />;\n\t}\n\n\tconst showActions =\n\t\tslug === 'google-fonts' && ! renderConfirmDialog && ! selectedFont;\n\n\treturn (\n\t\t<div className=\"font-library__tabpanel-layout\">\n\t\t\t{ isLoading && (\n\t\t\t\t<div className=\"font-library__loading\">\n\t\t\t\t\t<ProgressBar />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! isLoading && selectedCollection && (\n\t\t\t\t<>\n\t\t\t\t\t<Navigator\n\t\t\t\t\t\tinitialPath=\"/\"\n\t\t\t\t\t\tclassName=\"font-library__tabpanel-layout\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t\t\t<Heading level={ 2 } size={ 13 }>\n\t\t\t\t\t\t\t\t\t\t{ selectedCollection.name }\n\t\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t\t\t{ selectedCollection.description }\n\t\t\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t{ showActions && (\n\t\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\t\t\t\tposition: 'bottom left',\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\ttitle: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Revoke access to Google Fonts'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: revokeAccess,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<HStack spacing={ 4 } justify=\"space-between\">\n\t\t\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\t\t\tvalue={ filters.search }\n\t\t\t\t\t\t\t\t\tplaceholder={ __( 'Font name…' ) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\t\t\t\t\tonChange={ debouncedUpdateSearchInput }\n\t\t\t\t\t\t\t\t\thideLabelFromVision={ false }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Category' ) }\n\t\t\t\t\t\t\t\t\tvalue={ filters.category }\n\t\t\t\t\t\t\t\t\tonChange={ handleCategoryFilter }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ categories &&\n\t\t\t\t\t\t\t\t\t\tcategories.map( ( category ) => (\n\t\t\t\t\t\t\t\t\t\t\t<option\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ category.slug }\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ category.name }\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</SelectControl>\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\n\t\t\t\t\t\t\t{ !! selectedCollection?.font_families?.length &&\n\t\t\t\t\t\t\t\t! fonts.length && (\n\t\t\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No fonts found. Try with a different search term.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<div className=\"font-library__fonts-grid__main\">\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ items.map( ( font ) => (\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\tkey={\n\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings.slug\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list-item\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FontCard\n\t\t\t\t\t\t\t\t\t\t\t\tfont={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tnavigatorPath=\"/fontFamily\"\n\t\t\t\t\t\t\t\t\t\t\t\tshouldFocus={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.slug ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tlastSelectedFontSlug\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSelectedFont(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfont.font_family_settings\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Navigator.Screen>\n\n\t\t\t\t\t\t<Navigator.Screen path=\"/fontFamily\">\n\t\t\t\t\t\t\t<Flex justify=\"flex-start\">\n\t\t\t\t\t\t\t\t<Navigator.BackButton\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronRight : chevronLeft\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetLastSelectedFontSlug(\n\t\t\t\t\t\t\t\t\t\t\tselectedFont?.slug\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tsetSelectedFont( null );\n\t\t\t\t\t\t\t\t\t\tsetNotice( null );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\t\t\tclassName=\"global-styles-ui-header\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ selectedFont?.name }\n\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t{ notice && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Spacer margin={ 1 } />\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus={ notice.type }\n\t\t\t\t\t\t\t\t\t\tonRemove={ () => setNotice( null ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ notice.message }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t<Spacer margin={ 1 } />\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<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<WCText>\n\t\t\t\t\t\t\t\t{ __( 'Select font variants to install.' ) }\n\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\tclassName=\"font-library__select-all\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Select all' ) }\n\t\t\t\t\t\t\t\tchecked={ isSelectAllChecked }\n\t\t\t\t\t\t\t\tonChange={ toggleSelectAll }\n\t\t\t\t\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ selectedFont &&\n\t\t\t\t\t\t\t\t\t\tgetSortedFontFaces( selectedFont ).map(\n\t\t\t\t\t\t\t\t\t\t\t( face, i ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ `face${ i }` }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"font-library__fonts-list-item\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CollectionFontVariant\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfont={ selectedFont }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tface={ face }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleToggleVariant={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleToggleVariant\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected={ isFontFontFaceInOutline(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedFont.slug,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselectedFont.fontFace\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? face\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: null, // If the font has no fontFace, we want to check if the font is in the outline\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfontToInstallOutline\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t<Spacer margin={ 16 } />\n\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t</Navigator>\n\n\t\t\t\t\t{ selectedFont && (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\tclassName=\"font-library__footer\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleInstall }\n\t\t\t\t\t\t\t\tisBusy={ isInstalling }\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\tfontsToInstall.length === 0 || isInstalling\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Install' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! selectedFont && (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\tclassName=\"font-library__footer\"\n\t\t\t\t\t\t\tjustify=\"end\"\n\t\t\t\t\t\t\tspacing={ 6 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"font-library__page-selection\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: 1: Current page number, 2: Total number of pages.\n\t\t\t\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t\t\t\t'<div>Page</div>%1$s<div>of %2$d</div>',\n\t\t\t\t\t\t\t\t\t\t\t'paging'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t'<CurrentPage />',\n\t\t\t\t\t\t\t\t\t\ttotalPages\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdiv: <div aria-hidden />,\n\t\t\t\t\t\t\t\t\t\t// @ts-expect-error — Tag injected via sprintf argument, not visible in format string.\n\t\t\t\t\t\t\t\t\t\tCurrentPage: (\n\t\t\t\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Current page'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ page.toString() }\n\t\t\t\t\t\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t\t\t\t\t\t...Array( totalPages ),\n\t\t\t\t\t\t\t\t\t\t\t\t].map( ( e, i ) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ti + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ti + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( newPage ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetPage(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparseInt( newPage )\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ () => setPage( page - 1 ) }\n\t\t\t\t\t\t\t\t\tdisabled={ page === 1 }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Previous page' ) }\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? next : previous }\n\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ () => setPage( page + 1 ) }\n\t\t\t\t\t\t\t\t\tdisabled={ page === totalPages }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Next page' ) }\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? previous : next }\n\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default FontCollection;\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC,wBAAwB;AAAA,EACxB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,yBAAyB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,IAAI,IAAI,aAAa;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,uBAAuB;AAWhC,SAAS,0BAA0B;AACnC,OAAO,cAAc;AACrB,OAAO,iBAAiB;AACxB,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,OAAO,8BAA8B;AACrC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,OAAO,2BAA2B;AA0MzB,SAqJD,UArJC,KAqBD,YArBC;AAvMT,IAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN,MAAM,GAAI,OAAO,iBAAkB;AACpC;AAEA,IAAM,qBAAqB;AAC3B,IAA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W,SAAS;AAAA,kBACpB,wBAAsB;AAAA,kBACtB,OAAQ,GAAI,WAAY;AAAA,kBACxB,MAAO,MAAM,IAAI,WAAW;AAAA,kBAC5B,aAAW;AAAA,kBACX,MAAK;AAAA,kBACL,iBAAgB;AAAA;AAAA,cACjB;AAAA,eACD;AAAA;AAAA;AAAA,MACD;AAAA,OAEF;AAAA,KAEF;AAEF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/font-sizes/rename-font-size-dialog.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalInputControl as InputControl,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport type { FontSize } from '@wordpress/global-styles-engine';\n\ninterface RenameFontSizeDialogProps {\n\tfontSize: FontSize;\n\ttoggleOpen: () => void;\n\thandleRename: ( newName: string ) => void;\n}\n\nfunction RenameFontSizeDialog( {\n\tfontSize,\n\ttoggleOpen,\n\thandleRename,\n}: RenameFontSizeDialogProps ) {\n\tconst [ newName, setNewName ] = useState< string | undefined >(\n\t\tfontSize.name\n\t);\n\n\tconst handleConfirm = () => {\n\t\t// If the new name is not empty, call the handleRename function\n\t\tif ( newName && newName.trim() ) {\n\t\t\thandleRename( newName );\n\t\t}\n\t\ttoggleOpen();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\tonRequestClose={ toggleOpen }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleConfirm();\n\t\t\t\t\ttoggleOpen();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,8BAA8B;AAAA,EAC9B,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AAyCpB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalInputControl as InputControl,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport type { FontSize } from '@wordpress/global-styles-engine';\n\ninterface RenameFontSizeDialogProps {\n\tfontSize: FontSize;\n\ttoggleOpen: () => void;\n\thandleRename: ( newName: string ) => void;\n}\n\nfunction RenameFontSizeDialog( {\n\tfontSize,\n\ttoggleOpen,\n\thandleRename,\n}: RenameFontSizeDialogProps ) {\n\tconst [ newName, setNewName ] = useState< string | undefined >(\n\t\tfontSize.name\n\t);\n\n\tconst handleConfirm = () => {\n\t\t// If the new name is not empty, call the handleRename function\n\t\tif ( newName && newName.trim() ) {\n\t\t\thandleRename( newName );\n\t\t}\n\t\ttoggleOpen();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\tonRequestClose={ toggleOpen }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleConfirm();\n\t\t\t\t\ttoggleOpen();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tvalue={ newName }\n\t\t\t\t\t\tonChange={ setNewName }\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Font size preset name' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ toggleOpen }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport default RenameFontSizeDialog;\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,8BAA8B;AAAA,EAC9B,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AAyCpB,cAOA,YAPA;AAhCL,SAAS,qBAAsB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,GAA+B;AAC9B,QAAM,CAAE,SAAS,UAAW,IAAI;AAAA,IAC/B,SAAS;AAAA,EACV;AAEA,QAAM,gBAAgB,MAAM;AAE3B,QAAK,WAAW,QAAQ,KAAK,GAAI;AAChC,mBAAc,OAAQ;AAAA,IACvB;AACA,eAAW;AAAA,EACZ;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,gBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,OAAQ,GAAI,QAAS;AAAA,MACrB,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,0BAAc;AACd,uBAAW;AAAA,UACZ;AAAA,UAEA,+BAAC,UAAO,SAAQ,KACf;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAa;AAAA,gBACb,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,OAAQ,GAAI,MAAO;AAAA,gBACnB,aAAc,GAAI,uBAAwB;AAAA;AAAA,YAC3C;AAAA,YACA,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,SAAU;AAAA,kBAER,aAAI,QAAS;AAAA;AAAA,cAChB;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACA,uBAAqB;AAAA,kBACrB,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,aAAI,MAAO;AAAA;AAAA,cACd;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useResizeObserver
|
|
8
8
|
} from "@wordpress/compose";
|
|
9
9
|
import { useLayoutEffect, useState } from "@wordpress/element";
|
|
10
|
+
import { Skeleton } from "@wordpress/ui";
|
|
10
11
|
import { useStyle } from "./hooks.mjs";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
var normalizedWidth = 248;
|
|
@@ -51,6 +52,16 @@ function PreviewWrapper({
|
|
|
51
52
|
const isReady = !!width;
|
|
52
53
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
54
|
/* @__PURE__ */ jsx("div", { style: { position: "relative" }, children: containerResizeListener }),
|
|
55
|
+
!isReady && // Match the preview aspect ratio so layout doesn't jump once width is measured.
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
Skeleton,
|
|
58
|
+
{
|
|
59
|
+
className: "global-styles-ui-preview__wrapper",
|
|
60
|
+
style: {
|
|
61
|
+
aspectRatio: normalizedWidth / normalizedHeight
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
),
|
|
54
65
|
isReady && /* @__PURE__ */ jsx(
|
|
55
66
|
"div",
|
|
56
67
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preview-wrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport {\n\tuseThrottle,\n\tuseReducedMotion,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { useLayoutEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useStyle } from './hooks';\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\n// Throttle options for useThrottle. Must be defined outside of the component,\n// so that the object reference is the same on each render.\nconst THROTTLE_OPTIONS = {\n\tleading: true,\n\ttrailing: true,\n};\n\ninterface PreviewWrapperProps {\n\tchildren:\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )[];\n\tlabel?: string;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n}\n\nfunction PreviewWrapper( {\n\tchildren,\n\tlabel,\n\tisFocused,\n\twithHoverView,\n}: PreviewWrapperProps ) {\n\tconst [ backgroundColor = 'white' ] =\n\t\tuseStyle< string >( 'color.background' );\n\tconst [ gradientValue ] = useStyle< string >( 'color.gradient' );\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst [ throttledWidth, setThrottledWidthState ] = useState( width );\n\tconst [ ratioState, setRatioState ] = useState< number | undefined >();\n\n\tconst setThrottledWidth = useThrottle(\n\t\tsetThrottledWidthState,\n\t\t250,\n\t\tTHROTTLE_OPTIONS\n\t);\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tif ( width ) {\n\t\t\tsetThrottledWidth( width );\n\t\t}\n\t}, [ width, setThrottledWidth ] );\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tconst newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;\n\t\tconst ratioDiff = newRatio - ( ratioState || 0 );\n\n\t\t// Only update the ratio state if the difference is big enough\n\t\t// or if the ratio state is not yet set. This is to avoid an\n\t\t// endless loop of updates at particular viewport heights when the\n\t\t// presence of a scrollbar causes the width to change slightly.\n\t\tconst isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;\n\n\t\tif ( isRatioDiffBigEnough || ! ratioState ) {\n\t\t\tsetRatioState( newRatio );\n\t\t}\n\t}, [ throttledWidth, ratioState ] );\n\n\t// Set a fallbackRatio to use before the throttled ratio has been set.\n\tconst fallbackRatio = width ? width / normalizedWidth : 1;\n\t/*\n\t * Use the throttled ratio if it has been calculated, otherwise\n\t * use the fallback ratio. The throttled ratio is used to avoid\n\t * an endless loop of updates at particular viewport heights.\n\t * See: https://github.com/WordPress/gutenberg/issues/55112\n\t */\n\tconst ratio = ratioState ? ratioState : fallbackRatio;\n\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ isReady && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'global-styles-ui-preview__wrapper', {\n\t\t\t\t\t\t'is-hoverable': withHoverView,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ []\n\t\t\t\t\t\t\t.concat( children as any ) // This makes sure children is always an array.\n\t\t\t\t\t\t\t.map( ( child: any, key: number ) =>\n\t\t\t\t\t\t\t\tchild( { ratio, key } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PreviewWrapper;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,oBAAoB,cAAc;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,iBAAiB,gBAAgB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport {\n\tuseThrottle,\n\tuseReducedMotion,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { useLayoutEffect, useState } from '@wordpress/element';\nimport { Skeleton } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { useStyle } from './hooks';\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\n// Throttle options for useThrottle. Must be defined outside of the component,\n// so that the object reference is the same on each render.\nconst THROTTLE_OPTIONS = {\n\tleading: true,\n\ttrailing: true,\n};\n\ninterface PreviewWrapperProps {\n\tchildren:\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )\n\t\t| ( ( args: { ratio: number; key: number } ) => React.ReactNode )[];\n\tlabel?: string;\n\tisFocused?: boolean;\n\twithHoverView?: boolean;\n}\n\nfunction PreviewWrapper( {\n\tchildren,\n\tlabel,\n\tisFocused,\n\twithHoverView,\n}: PreviewWrapperProps ) {\n\tconst [ backgroundColor = 'white' ] =\n\t\tuseStyle< string >( 'color.background' );\n\tconst [ gradientValue ] = useStyle< string >( 'color.gradient' );\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst [ throttledWidth, setThrottledWidthState ] = useState( width );\n\tconst [ ratioState, setRatioState ] = useState< number | undefined >();\n\n\tconst setThrottledWidth = useThrottle(\n\t\tsetThrottledWidthState,\n\t\t250,\n\t\tTHROTTLE_OPTIONS\n\t);\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tif ( width ) {\n\t\t\tsetThrottledWidth( width );\n\t\t}\n\t}, [ width, setThrottledWidth ] );\n\n\t// Must use useLayoutEffect to avoid a flash of the container at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tconst newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;\n\t\tconst ratioDiff = newRatio - ( ratioState || 0 );\n\n\t\t// Only update the ratio state if the difference is big enough\n\t\t// or if the ratio state is not yet set. This is to avoid an\n\t\t// endless loop of updates at particular viewport heights when the\n\t\t// presence of a scrollbar causes the width to change slightly.\n\t\tconst isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;\n\n\t\tif ( isRatioDiffBigEnough || ! ratioState ) {\n\t\t\tsetRatioState( newRatio );\n\t\t}\n\t}, [ throttledWidth, ratioState ] );\n\n\t// Set a fallbackRatio to use before the throttled ratio has been set.\n\tconst fallbackRatio = width ? width / normalizedWidth : 1;\n\t/*\n\t * Use the throttled ratio if it has been calculated, otherwise\n\t * use the fallback ratio. The throttled ratio is used to avoid\n\t * an endless loop of updates at particular viewport heights.\n\t * See: https://github.com/WordPress/gutenberg/issues/55112\n\t */\n\tconst ratio = ratioState ? ratioState : fallbackRatio;\n\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ ! isReady && (\n\t\t\t\t// Match the preview aspect ratio so layout doesn't jump once width is measured.\n\t\t\t\t<Skeleton\n\t\t\t\t\tclassName=\"global-styles-ui-preview__wrapper\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\taspectRatio: normalizedWidth / normalizedHeight,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'global-styles-ui-preview__wrapper', {\n\t\t\t\t\t\t'is-hoverable': withHoverView,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ []\n\t\t\t\t\t\t\t.concat( children as any ) // This makes sure children is always an array.\n\t\t\t\t\t\t\t.map( ( child: any, key: number ) =>\n\t\t\t\t\t\t\t\tchild( { ratio, key } )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PreviewWrapper;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,oBAAoB,cAAc;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,iBAAiB,gBAAgB;AAC1C,SAAS,gBAAgB;AAKzB,SAAS,gBAAgB;AAgFvB,mBACC,KADD;AA9EF,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;AAIzB,IAAM,mBAAmB;AAAA,EACxB,SAAS;AAAA,EACT,UAAU;AACX;AAWA,SAAS,eAAgB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,CAAE,kBAAkB,OAAQ,IACjC,SAAoB,kBAAmB;AACxC,QAAM,CAAE,aAAc,IAAI,SAAoB,gBAAiB;AAC/D,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,KAAM;AACpD,QAAM,CAAE,yBAAyB,EAAE,MAAM,CAAE,IAAI,kBAAkB;AACjE,QAAM,CAAE,gBAAgB,sBAAuB,IAAI,SAAU,KAAM;AACnE,QAAM,CAAE,YAAY,aAAc,IAAI,SAA+B;AAErE,QAAM,oBAAoB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAIA,kBAAiB,MAAM;AACtB,QAAK,OAAQ;AACZ,wBAAmB,KAAM;AAAA,IAC1B;AAAA,EACD,GA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IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -77,7 +77,11 @@ var {
|
|
|
77
77
|
AdvancedPanel: StylesAdvancedPanel
|
|
78
78
|
} = unlock(blockEditorPrivateApis);
|
|
79
79
|
function ScreenBlock({ name, variation }) {
|
|
80
|
-
const {
|
|
80
|
+
const {
|
|
81
|
+
user: userConfig,
|
|
82
|
+
merged: mergedConfig,
|
|
83
|
+
onChange: onChangeGlobalStyles
|
|
84
|
+
} = useContext(GlobalStylesContext);
|
|
81
85
|
let prefixParts = [];
|
|
82
86
|
if (variation) {
|
|
83
87
|
prefixParts = ["variations", variation].concat(prefixParts);
|
|
@@ -85,12 +89,19 @@ function ScreenBlock({ name, variation }) {
|
|
|
85
89
|
const prefix = prefixParts.join(".");
|
|
86
90
|
const [selectedViewport, setSelectedViewport] = useState("default");
|
|
87
91
|
const [selectedPseudoState, setSelectedPseudoState] = useState("default");
|
|
88
|
-
const
|
|
92
|
+
const viewportSettings = mergedConfig.settings?.viewport;
|
|
93
|
+
const validViewportStates = useMemo(
|
|
94
|
+
() => getValidViewportStates(viewportSettings),
|
|
95
|
+
[viewportSettings]
|
|
96
|
+
);
|
|
97
|
+
const effectiveSelectedViewport = selectedViewport === "default" || validViewportStates.some(
|
|
98
|
+
(state) => state.value === selectedViewport
|
|
99
|
+
) ? selectedViewport : "default";
|
|
89
100
|
const validPseudoStates = useMemo(
|
|
90
101
|
() => getValidPseudoStates(name),
|
|
91
102
|
[name]
|
|
92
103
|
);
|
|
93
|
-
const stateParam = [
|
|
104
|
+
const stateParam = [effectiveSelectedViewport, selectedPseudoState].filter((value) => value !== "default").join(".");
|
|
94
105
|
const hasSelectedState = stateParam.length > 0;
|
|
95
106
|
const [style, setStyle] = useStyle(
|
|
96
107
|
prefix,
|
|
@@ -140,7 +151,7 @@ function ScreenBlock({ name, variation }) {
|
|
|
140
151
|
const hasBorderPanel = useHasBorderPanel(settings);
|
|
141
152
|
const hasDimensionsPanel = useHasDimensionsPanel(settings);
|
|
142
153
|
const hasFiltersPanel = useHasFiltersPanel(settings);
|
|
143
|
-
const shouldShowFiltersPanel = hasFiltersPanel &&
|
|
154
|
+
const shouldShowFiltersPanel = hasFiltersPanel && effectiveSelectedViewport === "default";
|
|
144
155
|
const hasImageSettingsPanel = useHasImageSettingsPanel(
|
|
145
156
|
name,
|
|
146
157
|
userSettings,
|
|
@@ -246,7 +257,7 @@ function ScreenBlock({ name, variation }) {
|
|
|
246
257
|
title: variation ? currentBlockStyle?.label : blockType?.title,
|
|
247
258
|
viewportStates: validViewportStates,
|
|
248
259
|
pseudoStates: validPseudoStates,
|
|
249
|
-
selectedViewport,
|
|
260
|
+
selectedViewport: effectiveSelectedViewport,
|
|
250
261
|
selectedPseudoState,
|
|
251
262
|
onChangeViewport: setSelectedViewport,
|
|
252
263
|
onChangePseudoState: setSelectedPseudoState
|
|
@@ -257,15 +268,26 @@ function ScreenBlock({ name, variation }) {
|
|
|
257
268
|
{
|
|
258
269
|
name,
|
|
259
270
|
variation,
|
|
260
|
-
selectedViewport,
|
|
271
|
+
selectedViewport: effectiveSelectedViewport,
|
|
261
272
|
selectedState: hasSelectedState ? stateParam : "default",
|
|
262
|
-
stateStyles: hasSelectedState ? inheritedStyle : void 0
|
|
273
|
+
stateStyles: hasSelectedState ? inheritedStyle : void 0,
|
|
274
|
+
viewportSettings
|
|
263
275
|
}
|
|
264
276
|
),
|
|
265
277
|
hasVariationsPanel && /* @__PURE__ */ jsx("div", { className: "global-styles-ui-screen-variations", children: /* @__PURE__ */ jsxs(VStack, { spacing: 3, children: [
|
|
266
278
|
/* @__PURE__ */ jsx(Subtitle, { children: __("Style Variations") }),
|
|
267
279
|
/* @__PURE__ */ jsx(VariationsPanel, { name })
|
|
268
280
|
] }) }),
|
|
281
|
+
hasTypographyPanel && /* @__PURE__ */ jsx(
|
|
282
|
+
StylesTypographyPanel,
|
|
283
|
+
{
|
|
284
|
+
inheritedValue: inheritedStyle,
|
|
285
|
+
value: style,
|
|
286
|
+
onChange: onChangeTypography,
|
|
287
|
+
settings,
|
|
288
|
+
isGlobalStyles: !hasSelectedState
|
|
289
|
+
}
|
|
290
|
+
),
|
|
269
291
|
hasBackgroundPanel && /* @__PURE__ */ jsx(
|
|
270
292
|
StylesBackgroundPanel,
|
|
271
293
|
{
|
|
@@ -276,14 +298,14 @@ function ScreenBlock({ name, variation }) {
|
|
|
276
298
|
defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES
|
|
277
299
|
}
|
|
278
300
|
),
|
|
279
|
-
|
|
280
|
-
|
|
301
|
+
shouldShowFiltersPanel && /* @__PURE__ */ jsx(
|
|
302
|
+
StylesFiltersPanel,
|
|
281
303
|
{
|
|
282
|
-
inheritedValue:
|
|
283
|
-
value:
|
|
284
|
-
onChange:
|
|
304
|
+
inheritedValue: inheritedStyleWithLayout,
|
|
305
|
+
value: styleWithLayout,
|
|
306
|
+
onChange: setStyle,
|
|
285
307
|
settings,
|
|
286
|
-
|
|
308
|
+
includeLayoutControls: true
|
|
287
309
|
}
|
|
288
310
|
),
|
|
289
311
|
hasDimensionsPanel && /* @__PURE__ */ jsx(
|
|
@@ -305,16 +327,6 @@ function ScreenBlock({ name, variation }) {
|
|
|
305
327
|
settings
|
|
306
328
|
}
|
|
307
329
|
),
|
|
308
|
-
shouldShowFiltersPanel && /* @__PURE__ */ jsx(
|
|
309
|
-
StylesFiltersPanel,
|
|
310
|
-
{
|
|
311
|
-
inheritedValue: inheritedStyleWithLayout,
|
|
312
|
-
value: styleWithLayout,
|
|
313
|
-
onChange: setStyle,
|
|
314
|
-
settings,
|
|
315
|
-
includeLayoutControls: true
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
330
|
hasColorPanel && /* @__PURE__ */ jsx(
|
|
319
331
|
StylesColorPanel,
|
|
320
332
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/screen-block.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n// @ts-expect-error: Not typed yet.\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useContext, useMemo, useState } 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';\nimport {\n\tsetStyle as setStyleHelper,\n\tsetSetting as setSettingHelper,\n} from '@wordpress/global-styles-engine';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { Subtitle } from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\nimport { useStyle, useSetting } from './hooks';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from './lock-unlock';\nimport { getValidPseudoStates, getValidViewportStates } from './utils';\n\n// Initial control values.\nconst BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\nfunction applyFallbackStyle( border: any ) {\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: any ) {\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\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseHasBackgroundPanel,\n\tBackgroundPanel: StylesBackgroundPanel,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\ninterface ScreenBlockProps {\n\tname: string;\n\tvariation?: string;\n}\n\nfunction ScreenBlock( { name, variation }: ScreenBlockProps ) {\n\tconst { user: userConfig, onChange: onChangeGlobalStyles } =\n\t\tuseContext( GlobalStylesContext );\n\n\tlet prefixParts: string[] = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\t// State selector state\n\tconst [ selectedViewport, setSelectedViewport ] =\n\t\tuseState< string >( 'default' );\n\tconst [ selectedPseudoState, setSelectedPseudoState ] =\n\t\tuseState< string >( 'default' );\n\tconst validViewportStates = useMemo( () => getValidViewportStates(), [] );\n\tconst validPseudoStates = useMemo(\n\t\t() => getValidPseudoStates( name ),\n\t\t[ name ]\n\t);\n\n\tconst stateParam = [ selectedViewport, selectedPseudoState ]\n\t\t.filter( ( value ) => value !== 'default' )\n\t\t.join( '.' );\n\tconst hasSelectedState = stateParam.length > 0;\n\tconst [ style, setStyle ] = useStyle(\n\t\tprefix,\n\t\tname,\n\t\t'user',\n\t\tfalse,\n\t\thasSelectedState ? stateParam : undefined\n\t);\n\tconst [ inheritedStyle ] = useStyle(\n\t\tprefix,\n\t\tname,\n\t\t'merged',\n\t\tfalse,\n\t\thasSelectedState ? stateParam : undefined\n\t);\n\n\tconst [ userSettings ] = useSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useSetting( '', name );\n\tconst settingsForBlockElement = useSettingsForBlockElement(\n\t\trawSettings,\n\t\tname\n\t);\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\tlet disableBlockGap = false;\n\tif (\n\t\tsettingsForBlockElement?.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: string ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tdisableBlockGap = true;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tlet disableAspectRatio = false;\n\tif (\n\t\tsettingsForBlockElement?.dimensions?.aspectRatio &&\n\t\tname === 'core/group'\n\t) {\n\t\tdisableAspectRatio = true;\n\t}\n\n\tconst settings = useMemo( () => {\n\t\tconst updatedSettings = structuredClone( settingsForBlockElement );\n\t\tif ( disableBlockGap ) {\n\t\t\tupdatedSettings.spacing.blockGap = false;\n\t\t}\n\t\tif ( disableAspectRatio ) {\n\t\t\tupdatedSettings.dimensions.aspectRatio = false;\n\t\t}\n\t\treturn updatedSettings;\n\t}, [ settingsForBlockElement, disableBlockGap, disableAspectRatio ] );\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst shouldShowFiltersPanel =\n\t\thasFiltersPanel && selectedViewport === 'default';\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: !! ( globalStyles as GlobalStylesConfig )?._links?.[\n\t\t\t\t'wp:action-edit-css'\n\t\t\t],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s: any ) => 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: any ) => {\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: any ) => {\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\n\tconst onChangeTypography = ( newStyle: any ) => {\n\t\t// Extract settings if present (e.g., from textIndent toggle)\n\t\tconst { settings: newSettings, ...styleWithoutSettings } = newStyle;\n\n\t\t// If there are settings changes, we need to update both styles and\n\t\t// settings atomically to avoid race conditions.\n\t\tif ( newSettings?.typography ) {\n\t\t\t// Build the state-aware path so that viewport styles (e.g. @mobile)\n\t\t\t// are written to the correct sub-path and do not overwrite the default.\n\t\t\tconst stylePathForState = [ prefix, stateParam ]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( '.' );\n\t\t\tlet updatedConfig = setStyleHelper(\n\t\t\t\tuserConfig,\n\t\t\t\tstylePathForState,\n\t\t\t\tstyleWithoutSettings,\n\t\t\t\tname\n\t\t\t);\n\t\t\tupdatedConfig = setSettingHelper(\n\t\t\t\tupdatedConfig,\n\t\t\t\t'typography',\n\t\t\t\t{\n\t\t\t\t\t...userSettings.typography,\n\t\t\t\t\t...newSettings.typography,\n\t\t\t\t},\n\t\t\t\tname\n\t\t\t);\n\t\t\tonChangeGlobalStyles( updatedConfig );\n\t\t} else {\n\t\t\tsetStyle( styleWithoutSettings );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle: any ) => {\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={\n\t\t\t\t\tvariation ? currentBlockStyle?.label! : blockType?.title!\n\t\t\t\t}\n\t\t\t\tviewportStates={ validViewportStates }\n\t\t\t\tpseudoStates={ validPseudoStates }\n\t\t\t\tselectedViewport={ selectedViewport }\n\t\t\t\tselectedPseudoState={ selectedPseudoState }\n\t\t\t\tonChangeViewport={ setSelectedViewport }\n\t\t\t\tonChangePseudoState={ setSelectedPseudoState }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel\n\t\t\t\tname={ name }\n\t\t\t\tvariation={ variation }\n\t\t\t\tselectedViewport={ selectedViewport }\n\t\t\t\tselectedState={ hasSelectedState ? stateParam : 'default' }\n\t\t\t\tstateStyles={ hasSelectedState ? inheritedStyle : undefined }\n\t\t\t/>\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"global-styles-ui-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{ hasBackgroundPanel && (\n\t\t\t\t<StylesBackgroundPanel\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\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\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={ onChangeTypography }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t// Only expose global-settings controls (e.g. \"Indent all\n\t\t\t\t\t// paragraphs\") when not editing a state-specific variation,\n\t\t\t\t\t// because those settings are global and cannot be per-breakpoint.\n\t\t\t\t\tisGlobalStyles={ ! hasSelectedState }\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{ shouldShowFiltersPanel && (\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{ 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{ hasImageSettingsPanel && ! hasSelectedState && (\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<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\thelp={ 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/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAE7B,SAAS,eAAe,8BAA8B;AACtD,SAAS,YAAY,SAAS,gBAAgB;AAC9C,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,OAC3B;AACP,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC,YAAY;AAAA,EACZ,cAAc;AAAA,OACR;AAMP,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAC9B,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,kBAAkB;AACrC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,sBAAsB,8BAA8B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n// @ts-expect-error: Not typed yet.\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useContext, useMemo, useState } 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';\nimport {\n\tsetStyle as setStyleHelper,\n\tsetSetting as setSettingHelper,\n} from '@wordpress/global-styles-engine';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { Subtitle } from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\nimport { useStyle, useSetting } from './hooks';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from './lock-unlock';\nimport { getValidPseudoStates, getValidViewportStates } from './utils';\n\n// Initial control values.\nconst BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\nfunction applyFallbackStyle( border: any ) {\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: any ) {\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\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseHasBackgroundPanel,\n\tBackgroundPanel: StylesBackgroundPanel,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\ninterface ScreenBlockProps {\n\tname: string;\n\tvariation?: string;\n}\n\nfunction ScreenBlock( { name, variation }: ScreenBlockProps ) {\n\tconst {\n\t\tuser: userConfig,\n\t\tmerged: mergedConfig,\n\t\tonChange: onChangeGlobalStyles,\n\t} = useContext( GlobalStylesContext );\n\n\tlet prefixParts: string[] = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\t// State selector state\n\tconst [ selectedViewport, setSelectedViewport ] =\n\t\tuseState< string >( 'default' );\n\tconst [ selectedPseudoState, setSelectedPseudoState ] =\n\t\tuseState< string >( 'default' );\n\tconst viewportSettings = mergedConfig.settings?.viewport;\n\tconst validViewportStates = useMemo(\n\t\t() => getValidViewportStates( viewportSettings ),\n\t\t[ viewportSettings ]\n\t);\n\tconst effectiveSelectedViewport =\n\t\tselectedViewport === 'default' ||\n\t\tvalidViewportStates.some(\n\t\t\t( state ) => state.value === selectedViewport\n\t\t)\n\t\t\t? selectedViewport\n\t\t\t: 'default';\n\tconst validPseudoStates = useMemo(\n\t\t() => getValidPseudoStates( name ),\n\t\t[ name ]\n\t);\n\n\tconst stateParam = [ effectiveSelectedViewport, selectedPseudoState ]\n\t\t.filter( ( value ) => value !== 'default' )\n\t\t.join( '.' );\n\tconst hasSelectedState = stateParam.length > 0;\n\tconst [ style, setStyle ] = useStyle(\n\t\tprefix,\n\t\tname,\n\t\t'user',\n\t\tfalse,\n\t\thasSelectedState ? stateParam : undefined\n\t);\n\tconst [ inheritedStyle ] = useStyle(\n\t\tprefix,\n\t\tname,\n\t\t'merged',\n\t\tfalse,\n\t\thasSelectedState ? stateParam : undefined\n\t);\n\n\tconst [ userSettings ] = useSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useSetting( '', name );\n\tconst settingsForBlockElement = useSettingsForBlockElement(\n\t\trawSettings,\n\t\tname\n\t);\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\tlet disableBlockGap = false;\n\tif (\n\t\tsettingsForBlockElement?.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: string ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tdisableBlockGap = true;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tlet disableAspectRatio = false;\n\tif (\n\t\tsettingsForBlockElement?.dimensions?.aspectRatio &&\n\t\tname === 'core/group'\n\t) {\n\t\tdisableAspectRatio = true;\n\t}\n\n\tconst settings = useMemo( () => {\n\t\tconst updatedSettings = structuredClone( settingsForBlockElement );\n\t\tif ( disableBlockGap ) {\n\t\t\tupdatedSettings.spacing.blockGap = false;\n\t\t}\n\t\tif ( disableAspectRatio ) {\n\t\t\tupdatedSettings.dimensions.aspectRatio = false;\n\t\t}\n\t\treturn updatedSettings;\n\t}, [ settingsForBlockElement, disableBlockGap, disableAspectRatio ] );\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst shouldShowFiltersPanel =\n\t\thasFiltersPanel && effectiveSelectedViewport === 'default';\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: !! ( globalStyles as GlobalStylesConfig )?._links?.[\n\t\t\t\t'wp:action-edit-css'\n\t\t\t],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s: any ) => 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: any ) => {\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: any ) => {\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\n\tconst onChangeTypography = ( newStyle: any ) => {\n\t\t// Extract settings if present (e.g., from textIndent toggle)\n\t\tconst { settings: newSettings, ...styleWithoutSettings } = newStyle;\n\n\t\t// If there are settings changes, we need to update both styles and\n\t\t// settings atomically to avoid race conditions.\n\t\tif ( newSettings?.typography ) {\n\t\t\t// Build the state-aware path so that viewport styles (e.g. @mobile)\n\t\t\t// are written to the correct sub-path and do not overwrite the default.\n\t\t\tconst stylePathForState = [ prefix, stateParam ]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( '.' );\n\t\t\tlet updatedConfig = setStyleHelper(\n\t\t\t\tuserConfig,\n\t\t\t\tstylePathForState,\n\t\t\t\tstyleWithoutSettings,\n\t\t\t\tname\n\t\t\t);\n\t\t\tupdatedConfig = setSettingHelper(\n\t\t\t\tupdatedConfig,\n\t\t\t\t'typography',\n\t\t\t\t{\n\t\t\t\t\t...userSettings.typography,\n\t\t\t\t\t...newSettings.typography,\n\t\t\t\t},\n\t\t\t\tname\n\t\t\t);\n\t\t\tonChangeGlobalStyles( updatedConfig );\n\t\t} else {\n\t\t\tsetStyle( styleWithoutSettings );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle: any ) => {\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={\n\t\t\t\t\tvariation ? currentBlockStyle?.label! : blockType?.title!\n\t\t\t\t}\n\t\t\t\tviewportStates={ validViewportStates }\n\t\t\t\tpseudoStates={ validPseudoStates }\n\t\t\t\tselectedViewport={ effectiveSelectedViewport }\n\t\t\t\tselectedPseudoState={ selectedPseudoState }\n\t\t\t\tonChangeViewport={ setSelectedViewport }\n\t\t\t\tonChangePseudoState={ setSelectedPseudoState }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel\n\t\t\t\tname={ name }\n\t\t\t\tvariation={ variation }\n\t\t\t\tselectedViewport={ effectiveSelectedViewport }\n\t\t\t\tselectedState={ hasSelectedState ? stateParam : 'default' }\n\t\t\t\tstateStyles={ hasSelectedState ? inheritedStyle : undefined }\n\t\t\t\tviewportSettings={ viewportSettings }\n\t\t\t/>\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"global-styles-ui-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{ 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={ onChangeTypography }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t// Only expose global-settings controls (e.g. \"Indent all\n\t\t\t\t\t// paragraphs\") when not editing a state-specific variation,\n\t\t\t\t\t// because those settings are global and cannot be per-breakpoint.\n\t\t\t\t\tisGlobalStyles={ ! hasSelectedState }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBackgroundPanel && (\n\t\t\t\t<StylesBackgroundPanel\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\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ shouldShowFiltersPanel && (\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{ 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{ 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{ hasImageSettingsPanel && ! hasSelectedState && (\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<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\thelp={ 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/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAE7B,SAAS,eAAe,8BAA8B;AACtD,SAAS,YAAY,SAAS,gBAAgB;AAC9C,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,OAC3B;AACP,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC,YAAY;AAAA,EACZ,cAAc;AAAA,OACR;AAMP,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAC9B,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,kBAAkB;AACrC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,sBAAsB,8BAA8B;AA+T3D,mBACC,KAqBE,YAtBH;AA5TF,IAAM,kCAAkC;AAAA,EACvC,gBAAgB;AAAA,EAChB,oBAAoB;AAAA;AACrB;AAEA,SAAS,mBAAoB,QAAc;AAC1C,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,kBAAkB,OAAO,SAAS,OAAO;AAE/C,MAAK,CAAE,OAAO,SAAS,iBAAkB;AACxC,WAAO,EAAE,GAAG,QAAQ,OAAO,QAAQ;AAAA,EACpC;AAEA,MAAK,OAAO,SAAS,CAAE,iBAAkB;AACxC,W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OAAQ;AAAA,QACR,UAAW;AAAA,QACX;AAAA;AAAA,IACD;AAAA,IAEC,iBACD;AAAA,MAAC;AAAA;AAAA,QACA,gBAAiB;AAAA,QACjB,OAAQ;AAAA,QACR,UAAW;AAAA,QACX;AAAA;AAAA,IACD;AAAA,IAEC,yBAAyB,CAAE,oBAC5B;AAAA,MAAC;AAAA;AAAA,QACA,UAAW;AAAA,QACX,OAAQ;AAAA,QACR,gBAAiB;AAAA;AAAA,IAClB;AAAA,IAGC,cACD,oBAAC,aAAU,OAAQ,GAAI,UAAW,GAAI,aAAc,OACnD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR,UAAW;AAAA,QACX,gBAAiB;AAAA,QACjB,MAAO;AAAA;AAAA,UAEN;AAAA,YACC;AAAA,UACD;AAAA,UACA,WAAW;AAAA,QACZ;AAAA;AAAA,IACD,GACD;AAAA,KAEF;AAEF;AAEA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// packages/global-styles-ui/src/screen-color-palette.tsx
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
|
-
import {
|
|
3
|
+
import { Tabs } from "@wordpress/ui";
|
|
4
4
|
import { ScreenHeader } from "./screen-header.mjs";
|
|
5
5
|
import ColorPalettePanel from "./color-palette-panel.mjs";
|
|
6
6
|
import GradientPalettePanel from "./gradients-palette-panel.mjs";
|
|
7
|
-
import { unlock } from "./lock-unlock.mjs";
|
|
8
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
var { Tabs } = unlock(componentsPrivateApis);
|
|
10
8
|
function ScreenColorPalette({ name }) {
|
|
11
9
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
10
|
/* @__PURE__ */ jsx(
|
|
@@ -18,13 +16,13 @@ function ScreenColorPalette({ name }) {
|
|
|
18
16
|
)
|
|
19
17
|
}
|
|
20
18
|
),
|
|
21
|
-
/* @__PURE__ */ jsxs(Tabs, { children: [
|
|
22
|
-
/* @__PURE__ */ jsxs(Tabs.
|
|
23
|
-
/* @__PURE__ */ jsx(Tabs.Tab, {
|
|
24
|
-
/* @__PURE__ */ jsx(Tabs.Tab, {
|
|
25
|
-
] }),
|
|
26
|
-
/* @__PURE__ */ jsx(Tabs.
|
|
27
|
-
/* @__PURE__ */ jsx(Tabs.
|
|
19
|
+
/* @__PURE__ */ jsxs(Tabs.Root, { defaultValue: "color", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "global-styles-ui-color-palette__tablist-container", children: /* @__PURE__ */ jsxs(Tabs.List, { className: "global-styles-ui-color-palette__tablist", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Tabs.Tab, { value: "color", children: __("Color") }),
|
|
22
|
+
/* @__PURE__ */ jsx(Tabs.Tab, { value: "gradient", children: __("Gradient") })
|
|
23
|
+
] }) }),
|
|
24
|
+
/* @__PURE__ */ jsx(Tabs.Panel, { value: "color", tabIndex: -1, children: /* @__PURE__ */ jsx(ColorPalettePanel, { name }) }),
|
|
25
|
+
/* @__PURE__ */ jsx(Tabs.Panel, { value: "gradient", tabIndex: -1, children: /* @__PURE__ */ jsx(GradientPalettePanel, { name }) })
|
|
28
26
|
] })
|
|
29
27
|
] });
|
|
30
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/screen-color-palette.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Tabs } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { ScreenHeader } from './screen-header';\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\n\nfunction ScreenColorPalette( { name }: { name?: string } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Edit palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'The combination of colors used across the site and in color pickers.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<Tabs.Root defaultValue=\"color\">\n\t\t\t\t<div className=\"global-styles-ui-color-palette__tablist-container\">\n\t\t\t\t\t<Tabs.List className=\"global-styles-ui-color-palette__tablist\">\n\t\t\t\t\t\t<Tabs.Tab value=\"color\">{ __( 'Color' ) }</Tabs.Tab>\n\t\t\t\t\t\t<Tabs.Tab value=\"gradient\">\n\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t</Tabs.List>\n\t\t\t\t</div>\n\t\t\t\t<Tabs.Panel value=\"color\" tabIndex={ -1 }>\n\t\t\t\t\t<ColorPalettePanel name={ name } />\n\t\t\t\t</Tabs.Panel>\n\t\t\t\t<Tabs.Panel value=\"gradient\" tabIndex={ -1 }>\n\t\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t\t</Tabs.Panel>\n\t\t\t</Tabs.Root>\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,YAAY;AAKrB,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,0BAA0B;AAI/B,mBACC,KAQE,YATH;AAFF,SAAS,mBAAoB,EAAE,KAAK,GAAuB;AAC1D,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,cAAe;AAAA,QAC3B,aAAc;AAAA,UACb;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,qBAAC,KAAK,MAAL,EAAU,cAAa,SACvB;AAAA,0BAAC,SAAI,WAAU,qDACd,+BAAC,KAAK,MAAL,EAAU,WAAU,2CACpB;AAAA,4BAAC,KAAK,KAAL,EAAS,OAAM,SAAU,aAAI,OAAQ,GAAG;AAAA,QACzC,oBAAC,KAAK,KAAL,EAAS,OAAM,YACb,aAAI,UAAW,GAClB;AAAA,SACD,GACD;AAAA,MACA,oBAAC,KAAK,OAAL,EAAW,OAAM,SAAQ,UAAW,IACpC,8BAAC,qBAAkB,MAAc,GAClC;AAAA,MACA,oBAAC,KAAK,OAAL,EAAW,OAAM,YAAW,UAAW,IACvC,8BAAC,wBAAqB,MAAc,GACrC;AAAA,OACD;AAAA,KACD;AAEF;AAEA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/screen-typography-element.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport { ScreenHeader } from './screen-header';\nimport TypographyPreview from './typography-preview';\n\nconst elements = {\n\ttext: {\n\t\tdescription: __( 'Manage the fonts used on the site.' ),\n\t\ttitle: __( 'Text' ),\n\t},\n\tlink: {\n\t\tdescription: __( 'Manage the fonts and typography used on the links.' ),\n\t\ttitle: __( 'Links' ),\n\t},\n\theading: {\n\t\tdescription: __( 'Manage the fonts and typography used on headings.' ),\n\t\ttitle: __( 'Headings' ),\n\t},\n\tcaption: {\n\t\tdescription: __( 'Manage the fonts and typography used on captions.' ),\n\t\ttitle: __( 'Captions' ),\n\t},\n\tbutton: {\n\t\tdescription: __( 'Manage the fonts and typography used on buttons.' ),\n\t\ttitle: __( 'Buttons' ),\n\t},\n};\n\ninterface ScreenTypographyElementProps {\n\telement: keyof typeof elements;\n}\n\nfunction ScreenTypographyElement( { element }: ScreenTypographyElementProps ) {\n\tconst [ headingLevel, setHeadingLevel ] = useState( 'heading' );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ elements[ element ].title }\n\t\t\t\tdescription={ elements[ element ].description }\n\t\t\t/>\n\t\t\t<Spacer marginX={ 4 }>\n\t\t\t\t<TypographyPreview\n\t\t\t\t\telement={ element }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t\t{ element === 'heading' && (\n\t\t\t\t<Spacer marginX={ 4 } marginBottom=\"1em\">\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ headingLevel }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetHeadingLevel( value as string )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,wBAAwB;AAAA,OAClB;AACP,SAAS,gBAAgB;AAKzB,OAAO,qBAAqB;AAC5B,SAAS,oBAAoB;AAC7B,OAAO,uBAAuB;AAiC5B,mBACC,KAYE,YAbH;AA/BF,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,IACL,aAAa,GAAI,oCAAqC;AAAA,IACtD,OAAO,GAAI,MAAO;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,IACL,aAAa,GAAI,oDAAqD;AAAA,IACtE,OAAO,GAAI,OAAQ;AAAA,EACpB;AAAA,EACA,SAAS;AAAA,IACR,aAAa,GAAI,mDAAoD;AAAA,IACrE,OAAO,GAAI,UAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,aAAa,GAAI,mDAAoD;AAAA,IACrE,OAAO,GAAI,UAAW;AAAA,EACvB;AAAA,EACA,QAAQ;AAAA,IACP,aAAa,GAAI,kDAAmD;AAAA,IACpE,OAAO,GAAI,SAAU;AAAA,EACtB;AACD;AAMA,SAAS,wBAAyB,EAAE,QAAQ,GAAkC;AAC7E,QAAM,CAAE,cAAc,eAAgB,IAAI,SAAU,SAAU;AAE9D,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,SAAU,OAAQ,EAAE;AAAA,QAC5B,aAAc,SAAU,OAAQ,EAAE;AAAA;AAAA,IACnC;AAAA,IACA,oBAAC,UAAO,SAAU,GACjB;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD,GACD;AAAA,IACE,YAAY,aACb,oBAAC,UAAO,SAAU,GAAI,cAAa,OAClC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,sBAAuB;AAAA,QACnC,qBAAmB;AAAA,QACnB,OAAQ;AAAA,QACR,UAAW,CAAE,UACZ,gBAAiB,KAAgB;AAAA,QAElC,SAAO;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport { ScreenHeader } from './screen-header';\nimport TypographyPreview from './typography-preview';\n\nconst elements = {\n\ttext: {\n\t\tdescription: __( 'Manage the fonts used on the site.' ),\n\t\ttitle: __( 'Text' ),\n\t},\n\tlink: {\n\t\tdescription: __( 'Manage the fonts and typography used on the links.' ),\n\t\ttitle: __( 'Links' ),\n\t},\n\theading: {\n\t\tdescription: __( 'Manage the fonts and typography used on headings.' ),\n\t\ttitle: __( 'Headings' ),\n\t},\n\tcaption: {\n\t\tdescription: __( 'Manage the fonts and typography used on captions.' ),\n\t\ttitle: __( 'Captions' ),\n\t},\n\tbutton: {\n\t\tdescription: __( 'Manage the fonts and typography used on buttons.' ),\n\t\ttitle: __( 'Buttons' ),\n\t},\n};\n\ninterface ScreenTypographyElementProps {\n\telement: keyof typeof elements;\n}\n\nfunction ScreenTypographyElement( { element }: ScreenTypographyElementProps ) {\n\tconst [ headingLevel, setHeadingLevel ] = useState( 'heading' );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ elements[ element ].title }\n\t\t\t\tdescription={ elements[ element ].description }\n\t\t\t/>\n\t\t\t<Spacer marginX={ 4 }>\n\t\t\t\t<TypographyPreview\n\t\t\t\t\telement={ element }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t\t{ element === 'heading' && (\n\t\t\t\t<Spacer marginX={ 4 } marginBottom=\"1em\">\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ headingLevel }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetHeadingLevel( value as string )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'All headings' ) }\n\t\t\t\t\t\t\tlabel={ _x( 'All', 'heading levels' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 1' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 2' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 3' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 4' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 5' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\taria-label={ __( 'Heading 6' ) }\n\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<TypographyPanel\n\t\t\t\telement={ element }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypographyElement;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,wBAAwB;AAAA,OAClB;AACP,SAAS,g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GAAI,OAAO,gBAAiB;AAAA;AAAA,UACrC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,OAAM;AAAA,cACN,aAAW;AAAA,cACX,cAAa,GAAI,WAAY;AAAA,cAC7B,OAAQ,GAAI,IAAK;AAAA;AAAA,UAClB;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IAED;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAEA,IAAO,oCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -203,7 +203,6 @@ function ShadowsEditPanel() {
|
|
|
203
203
|
/* @__PURE__ */ jsx(
|
|
204
204
|
InputControl,
|
|
205
205
|
{
|
|
206
|
-
__next40pxDefaultSize: true,
|
|
207
206
|
autoComplete: "off",
|
|
208
207
|
label: __("Name"),
|
|
209
208
|
placeholder: __("Shadow name"),
|
|
@@ -422,7 +421,6 @@ function ShadowPopover({ shadowObj, onChange }) {
|
|
|
422
421
|
isBlock: true,
|
|
423
422
|
onChange: (value) => onShadowChange("inset", value === "inset"),
|
|
424
423
|
hideLabelFromVision: true,
|
|
425
|
-
__next40pxDefaultSize: true,
|
|
426
424
|
children: [
|
|
427
425
|
/* @__PURE__ */ jsx(
|
|
428
426
|
ToggleGroupControlOption,
|
|
@@ -491,7 +489,6 @@ function ShadowInputControl({
|
|
|
491
489
|
UnitControl,
|
|
492
490
|
{
|
|
493
491
|
label,
|
|
494
|
-
__next40pxDefaultSize: true,
|
|
495
492
|
value,
|
|
496
493
|
onChange: onValueChange
|
|
497
494
|
}
|