@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/shadows-edit-panel.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalInputControl as InputControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalGrid as Grid,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tuseNavigator,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdown,\n\tButton,\n\tFlex,\n\tFlexItem,\n\tColorPalette,\n\tModal,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tplus,\n\tshadow as shadowIcon,\n\treset,\n\tmoreVertical,\n} from '@wordpress/icons';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Subtitle } from './subtitle';\nimport { ScreenHeader } from './screen-header';\nimport { ScreenBody } from './screen-body';\nimport { defaultShadow } from './shadows-panel';\nimport {\n\tgetShadowParts,\n\tshadowStringToObject,\n\tshadowObjectToString,\n} from './shadow-utils';\nimport { useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nconst customShadowMenuItems = [\n\t{\n\t\tlabel: __( 'Rename' ),\n\t\taction: 'rename',\n\t},\n\t{\n\t\tlabel: __( 'Delete' ),\n\t\taction: 'delete',\n\t},\n];\n\nconst presetShadowMenuItems = [\n\t{\n\t\tlabel: __( 'Reset' ),\n\t\taction: 'reset',\n\t},\n];\n\nexport default function ShadowsEditPanel() {\n\tconst { goBack, params } = useNavigator();\n\tconst { category, slug } = params;\n\n\tconst [ shadows, setShadows ] = useSetting(\n\t\t`shadow.presets.${ category }`\n\t);\n\n\tuseEffect( () => {\n\t\tconst hasCurrentShadow = shadows?.some(\n\t\t\t( shadow: any ) => shadow.slug === slug\n\t\t);\n\t\t// If the shadow being edited doesn't exist anymore in the global styles setting, navigate back\n\t\t// to prevent the user from editing a non-existent shadow entry.\n\t\t// This can happen, for example:\n\t\t// - when the user deletes the shadow\n\t\t// - when the user resets the styles while editing a custom shadow\n\t\t//\n\t\t// The check on the slug is necessary to prevent a double back navigation when the user triggers\n\t\t// a backward navigation by interacting with the screen's UI.\n\t\tif ( !! slug && ! hasCurrentShadow ) {\n\t\t\tgoBack();\n\t\t}\n\t}, [ shadows, slug, goBack ] );\n\n\tconst [ baseShadows ] = useSetting(\n\t\t`shadow.presets.${ category }`,\n\t\tundefined,\n\t\t'base'\n\t);\n\tconst [ selectedShadow, setSelectedShadow ] = useState( () =>\n\t\t( shadows || [] ).find( ( shadow: any ) => shadow.slug === slug )\n\t);\n\tconst baseSelectedShadow = useMemo(\n\t\t() => ( baseShadows || [] ).find( ( b: any ) => b.slug === slug ),\n\t\t[ baseShadows, slug ]\n\t);\n\tconst [ isConfirmDialogVisible, setIsConfirmDialogVisible ] =\n\t\tuseState( false );\n\tconst [ isRenameModalVisible, setIsRenameModalVisible ] = useState( false );\n\tconst [ shadowName, setShadowName ] = useState< string | undefined >(\n\t\tselectedShadow?.name\n\t);\n\n\tif ( ! category || ! slug ) {\n\t\treturn null;\n\t}\n\n\tconst onShadowChange = ( shadow: string ) => {\n\t\tsetSelectedShadow( { ...selectedShadow, shadow } );\n\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\ts.slug === slug ? { ...selectedShadow, shadow } : s\n\t\t);\n\t\tsetShadows( updatedShadows );\n\t};\n\n\tconst onMenuClick = ( action: string ) => {\n\t\tif ( action === 'reset' ) {\n\t\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\t\ts.slug === slug ? baseSelectedShadow : s\n\t\t\t);\n\t\t\tsetSelectedShadow( baseSelectedShadow );\n\t\t\tsetShadows( updatedShadows );\n\t\t} else if ( action === 'delete' ) {\n\t\t\tsetIsConfirmDialogVisible( true );\n\t\t} else if ( action === 'rename' ) {\n\t\t\tsetIsRenameModalVisible( true );\n\t\t}\n\t};\n\n\tconst handleShadowDelete = () => {\n\t\tsetShadows( shadows.filter( ( s: any ) => s.slug !== slug ) );\n\t};\n\n\tconst handleShadowRename = ( newName: string | undefined ) => {\n\t\tif ( ! newName ) {\n\t\t\treturn;\n\t\t}\n\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\ts.slug === slug ? { ...selectedShadow, name: newName } : s\n\t\t);\n\t\tsetSelectedShadow( { ...selectedShadow, name: newName } );\n\t\tsetShadows( updatedShadows );\n\t};\n\n\treturn ! selectedShadow ? (\n\t\t<ScreenHeader title=\"\" />\n\t) : (\n\t\t<>\n\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t<ScreenHeader title={ selectedShadow.name } />\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Spacer marginTop={ 2 } marginBottom={ 0 } paddingX={ 4 }>\n\t\t\t\t\t\t<Menu>\n\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Menu' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Menu.Popover>\n\t\t\t\t\t\t\t\t{ ( category === 'custom'\n\t\t\t\t\t\t\t\t\t? customShadowMenuItems\n\t\t\t\t\t\t\t\t\t: presetShadowMenuItems\n\t\t\t\t\t\t\t\t).map( ( item ) => (\n\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\tkey={ item.action }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tonMenuClick( item.action )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\titem.action === 'reset' &&\n\t\t\t\t\t\t\t\t\t\t\tselectedShadow.shadow ===\n\t\t\t\t\t\t\t\t\t\t\t\tbaseSelectedShadow?.shadow\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</Spacer>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t\t<ScreenBody>\n\t\t\t\t<ShadowsPreview shadow={ selectedShadow.shadow } />\n\t\t\t\t<ShadowEditor\n\t\t\t\t\tshadow={ selectedShadow.shadow }\n\t\t\t\t\tonChange={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</ScreenBody>\n\t\t\t{ isConfirmDialogVisible && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\thandleShadowDelete();\n\t\t\t\t\t\tsetIsConfirmDialogVisible( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => {\n\t\t\t\t\t\tsetIsConfirmDialogVisible( false );\n\t\t\t\t\t} }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t\tsize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Name of the shadow preset. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Are you sure you want to delete \"%s\" shadow preset?'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tselectedShadow.name\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t\t{ isRenameModalVisible && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename' ) }\n\t\t\t\t\tonRequestClose={ () => setIsRenameModalVisible( false ) }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\thandleShadowRename( shadowName );\n\t\t\t\t\t\t\tsetIsRenameModalVisible( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Shadow name' ) }\n\t\t\t\t\t\t\tvalue={ shadowName ?? '' }\n\t\t\t\t\t\t\tonChange={ setShadowName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Spacer marginBottom={ 6 } />\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"block-editor-shadow-edit-modal__actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsRenameModalVisible( false )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\ninterface ShadowsPreviewProps {\n\tshadow: string;\n}\n\nfunction ShadowsPreview( { shadow }: ShadowsPreviewProps ) {\n\tconst shadowStyle = {\n\t\tboxShadow: shadow,\n\t};\n\n\treturn (\n\t\t<Spacer marginBottom={ 4 } marginTop={ -2 }>\n\t\t\t<HStack\n\t\t\t\talignment=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tclassName=\"global-styles-ui__shadow-preview-panel\"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"global-styles-ui__shadow-preview-block\"\n\t\t\t\t\tstyle={ shadowStyle }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n\ninterface ShadowEditorProps {\n\tshadow: string;\n\tonChange: ( shadow: string ) => void;\n}\n\nfunction ShadowEditor( { shadow, onChange }: ShadowEditorProps ) {\n\tconst addShadowButtonRef = useRef< HTMLButtonElement >( null );\n\tconst shadowParts = useMemo( () => getShadowParts( shadow ), [ shadow ] );\n\n\tconst onChangeShadowPart = ( index: number, part: string ) => {\n\t\tconst newShadowParts = [ ...shadowParts ];\n\t\tnewShadowParts[ index ] = part;\n\t\tonChange( newShadowParts.join( ', ' ) );\n\t};\n\n\tconst onAddShadowPart = () => {\n\t\tonChange( [ ...shadowParts, defaultShadow ].join( ', ' ) );\n\t};\n\n\tconst onRemoveShadowPart = ( index: number ) => {\n\t\tonChange( shadowParts.filter( ( p, i ) => i !== index ).join( ', ' ) );\n\t\taddShadowButtonRef.current?.focus();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Shadows' ) }</Subtitle>\n\t\t\t\t\t<FlexItem className=\"global-styles-ui__shadows-panel__options-container\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={ __( 'Add shadow' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonAddShadowPart();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tref={ addShadowButtonRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t\t<Spacer />\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t{ shadowParts.map( ( part, index ) => (\n\t\t\t\t\t<ShadowItem\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tshadow={ part }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tonChangeShadowPart( index, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcanRemove={ shadowParts.length > 1 }\n\t\t\t\t\t\tonRemove={ () => onRemoveShadowPart( index ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\ninterface ShadowItemProps {\n\tshadow: string;\n\tonChange: ( shadow: string ) => void;\n\tcanRemove: boolean;\n\tonRemove: () => void;\n}\n\nfunction ShadowItem( {\n\tshadow,\n\tonChange,\n\tcanRemove,\n\tonRemove,\n}: ShadowItemProps ) {\n\tconst popoverProps = {\n\t\tplacement: 'left-start' as const,\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\tconst shadowObj = useMemo(\n\t\t() => shadowStringToObject( shadow ),\n\t\t[ shadow ]\n\t);\n\tconst onShadowChange = ( newShadow: any ) => {\n\t\tonChange( shadowObjectToString( newShadow ) );\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"global-styles-ui__shadow-editor__dropdown\"\n\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\tconst toggleProps = {\n\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t'global-styles-ui__shadow-editor__dropdown-toggle',\n\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t),\n\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t};\n\t\t\t\tconst removeButtonProps = {\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t},\n\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t'global-styles-ui__shadow-editor__remove-button',\n\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t),\n\t\t\t\t\tlabel: __( 'Remove shadow' ),\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ shadowIcon }\n\t\t\t\t\t\t\t{ ...toggleProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ shadowObj.inset\n\t\t\t\t\t\t\t\t? __( 'Inner shadow' )\n\t\t\t\t\t\t\t\t: __( 'Drop shadow' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ reset }\n\t\t\t\t\t\t\t\t{ ...removeButtonProps }\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\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper\n\t\t\t\t\tpaddingSize=\"medium\"\n\t\t\t\t\tclassName=\"global-styles-ui__shadow-editor__dropdown-content\"\n\t\t\t\t>\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadowObj={ shadowObj }\n\t\t\t\t\t\tonChange={ onShadowChange }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\ninterface ShadowPopoverProps {\n\tshadowObj: any;\n\tonChange: ( shadow: any ) => void;\n}\n\nfunction ShadowPopover( { shadowObj, onChange }: ShadowPopoverProps ) {\n\tconst __experimentalIsRenderedInSidebar = true;\n\tconst enableAlpha = true;\n\n\tconst onShadowChange = ( key: string, value: any ) => {\n\t\tconst newShadow = {\n\t\t\t...shadowObj,\n\t\t\t[ key ]: value,\n\t\t};\n\t\tonChange( newShadow );\n\t};\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"global-styles-ui__shadow-editor-panel\">\n\t\t\t<ColorPalette\n\t\t\t\tclearable={ false }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tvalue={ shadowObj.color }\n\t\t\t\tonChange={ ( value ) => onShadowChange( 'color', value ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Shadow Type' ) }\n\t\t\t\tvalue={ shadowObj.inset ? 'inset' : 'outset' }\n\t\t\t\tisBlock\n\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\tonShadowChange( 'inset', value === 'inset' )\n\t\t\t\t}\n\t\t\t\thideLabelFromVision\n\t\t\t\t__next40pxDefaultSize\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"outset\"\n\t\t\t\t\tlabel={ __( 'Outset' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"inset\"\n\t\t\t\t\tlabel={ __( 'Inset' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t<Grid columns={ 2 } gap={ 4 }>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'X Position' ) }\n\t\t\t\t\tvalue={ shadowObj.x }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'x', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Y Position' ) }\n\t\t\t\t\tvalue={ shadowObj.y }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'y', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Blur' ) }\n\t\t\t\t\tvalue={ shadowObj.blur }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'blur', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Spread' ) }\n\t\t\t\t\tvalue={ shadowObj.spread }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'spread', value ) }\n\t\t\t\t/>\n\t\t\t</Grid>\n\t\t</VStack>\n\t);\n}\n\ninterface ShadowInputControlProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: ( value: string ) => void;\n}\n\nfunction ShadowInputControl( {\n\tlabel,\n\tvalue,\n\tonChange,\n}: ShadowInputControlProps ) {\n\tconst onValueChange = ( next: string | undefined ) => {\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : '0px';\n\t\tonChange( nextValue );\n\t};\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ label }\n\t\t\t__next40pxDefaultSize\n\t\t\tvalue={ value }\n\t\t\tonChange={ onValueChange }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,sBAAsB;AAAA,EACtB,wCAAwC;AAAA,EACxC;AAAA,EACA,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,+BAA+B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU,SAAS,WAAW,cAAc;AAKrD,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AA4GrB,SAEA,UAFA,KAOI,YAPJ;AA1GF,IAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;AAE/C,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO,GAAI,QAAS;AAAA,IACpB,QAAQ;AAA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AAA,QAEF;AAAA,QACA,oBAAC,KAAK,SAAL,EACI,wBAAa,WACd,wBACA,uBACD,IAAK,CAAE,SACR;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YAEA,SAAU,MACT,YAAa,KAAK,MAAO;AAAA,YAE1B,UACC,KAAK,WAAW,WAChB,eAAe,WACd,oBAAoB;AAAA,YAGtB,8BAAC,KAAK,WAAL,EACE,eAAK,OACR;AAAA;AAAA,UAZM,KAAK;AAAA,QAaZ,CACC,GACH;AAAA,SACD,GACD,GACD;AAAA,OACD;AAAA,IACA,qBAAC,cACA;AAAA,0BAAC,kBAAe,QAAS,eAAe,QAAS;AAAA,MACjD;AAAA,QAAC;AAAA;AAAA,UACA,QAAS,eAAe;AAAA,UACxB,UAAW;AAAA;AAAA,MACZ;AAAA,OACD;AAAA,IACE,0BACD;AAAA,MAAC;AAAA;AAAA,QACA,QAAM;AAAA,QACN,WAAY,MAAM;AACjB,6BAAmB;AACnB,oCAA2B,KAAM;AAAA,QAClC;AAAA,QACA,UAAW,MAAM;AAChB,oCAA2B,KAAM;AAAA,QAClC;AAAA,QACA,mBAAoB,GAAI,QAAS;AAAA,QACjC,MAAK;AAAA,QAEH;AAAA;AAAA,UAED;AAAA,YACC;AAAA,UACD;AAAA,UACA,eAAe;AAAA,QAChB;AAAA;AAAA,IACD;AAAA,IAEC,wBACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,QAAS;AAAA,QACrB,gBAAiB,MAAM,wBAAyB,KAAM;AAAA,QACtD,MAAK;AAAA,QAEL;AAAA,UAAC;AAAA;AAAA,YACA,UAAW,CAAE,UAAW;AACvB,oBAAM,eAAe;AACrB,iCAAoB,UAAW;AAC/B,sCAAyB,KAAM;AAAA,YAChC;AAAA,YAEA;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalInputControl as InputControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalGrid as Grid,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tuseNavigator,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdown,\n\tButton,\n\tFlex,\n\tFlexItem,\n\tColorPalette,\n\tModal,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tplus,\n\tshadow as shadowIcon,\n\treset,\n\tmoreVertical,\n} from '@wordpress/icons';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Subtitle } from './subtitle';\nimport { ScreenHeader } from './screen-header';\nimport { ScreenBody } from './screen-body';\nimport { defaultShadow } from './shadows-panel';\nimport {\n\tgetShadowParts,\n\tshadowStringToObject,\n\tshadowObjectToString,\n} from './shadow-utils';\nimport { useSetting } from './hooks';\nimport { unlock } from './lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nconst customShadowMenuItems = [\n\t{\n\t\tlabel: __( 'Rename' ),\n\t\taction: 'rename',\n\t},\n\t{\n\t\tlabel: __( 'Delete' ),\n\t\taction: 'delete',\n\t},\n];\n\nconst presetShadowMenuItems = [\n\t{\n\t\tlabel: __( 'Reset' ),\n\t\taction: 'reset',\n\t},\n];\n\nexport default function ShadowsEditPanel() {\n\tconst { goBack, params } = useNavigator();\n\tconst { category, slug } = params;\n\n\tconst [ shadows, setShadows ] = useSetting(\n\t\t`shadow.presets.${ category }`\n\t);\n\n\tuseEffect( () => {\n\t\tconst hasCurrentShadow = shadows?.some(\n\t\t\t( shadow: any ) => shadow.slug === slug\n\t\t);\n\t\t// If the shadow being edited doesn't exist anymore in the global styles setting, navigate back\n\t\t// to prevent the user from editing a non-existent shadow entry.\n\t\t// This can happen, for example:\n\t\t// - when the user deletes the shadow\n\t\t// - when the user resets the styles while editing a custom shadow\n\t\t//\n\t\t// The check on the slug is necessary to prevent a double back navigation when the user triggers\n\t\t// a backward navigation by interacting with the screen's UI.\n\t\tif ( !! slug && ! hasCurrentShadow ) {\n\t\t\tgoBack();\n\t\t}\n\t}, [ shadows, slug, goBack ] );\n\n\tconst [ baseShadows ] = useSetting(\n\t\t`shadow.presets.${ category }`,\n\t\tundefined,\n\t\t'base'\n\t);\n\tconst [ selectedShadow, setSelectedShadow ] = useState( () =>\n\t\t( shadows || [] ).find( ( shadow: any ) => shadow.slug === slug )\n\t);\n\tconst baseSelectedShadow = useMemo(\n\t\t() => ( baseShadows || [] ).find( ( b: any ) => b.slug === slug ),\n\t\t[ baseShadows, slug ]\n\t);\n\tconst [ isConfirmDialogVisible, setIsConfirmDialogVisible ] =\n\t\tuseState( false );\n\tconst [ isRenameModalVisible, setIsRenameModalVisible ] = useState( false );\n\tconst [ shadowName, setShadowName ] = useState< string | undefined >(\n\t\tselectedShadow?.name\n\t);\n\n\tif ( ! category || ! slug ) {\n\t\treturn null;\n\t}\n\n\tconst onShadowChange = ( shadow: string ) => {\n\t\tsetSelectedShadow( { ...selectedShadow, shadow } );\n\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\ts.slug === slug ? { ...selectedShadow, shadow } : s\n\t\t);\n\t\tsetShadows( updatedShadows );\n\t};\n\n\tconst onMenuClick = ( action: string ) => {\n\t\tif ( action === 'reset' ) {\n\t\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\t\ts.slug === slug ? baseSelectedShadow : s\n\t\t\t);\n\t\t\tsetSelectedShadow( baseSelectedShadow );\n\t\t\tsetShadows( updatedShadows );\n\t\t} else if ( action === 'delete' ) {\n\t\t\tsetIsConfirmDialogVisible( true );\n\t\t} else if ( action === 'rename' ) {\n\t\t\tsetIsRenameModalVisible( true );\n\t\t}\n\t};\n\n\tconst handleShadowDelete = () => {\n\t\tsetShadows( shadows.filter( ( s: any ) => s.slug !== slug ) );\n\t};\n\n\tconst handleShadowRename = ( newName: string | undefined ) => {\n\t\tif ( ! newName ) {\n\t\t\treturn;\n\t\t}\n\t\tconst updatedShadows = shadows.map( ( s: any ) =>\n\t\t\ts.slug === slug ? { ...selectedShadow, name: newName } : s\n\t\t);\n\t\tsetSelectedShadow( { ...selectedShadow, name: newName } );\n\t\tsetShadows( updatedShadows );\n\t};\n\n\treturn ! selectedShadow ? (\n\t\t<ScreenHeader title=\"\" />\n\t) : (\n\t\t<>\n\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t<ScreenHeader title={ selectedShadow.name } />\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Spacer marginTop={ 2 } marginBottom={ 0 } paddingX={ 4 }>\n\t\t\t\t\t\t<Menu>\n\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Menu' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Menu.Popover>\n\t\t\t\t\t\t\t\t{ ( category === 'custom'\n\t\t\t\t\t\t\t\t\t? customShadowMenuItems\n\t\t\t\t\t\t\t\t\t: presetShadowMenuItems\n\t\t\t\t\t\t\t\t).map( ( item ) => (\n\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\tkey={ item.action }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tonMenuClick( item.action )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\titem.action === 'reset' &&\n\t\t\t\t\t\t\t\t\t\t\tselectedShadow.shadow ===\n\t\t\t\t\t\t\t\t\t\t\t\tbaseSelectedShadow?.shadow\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</Spacer>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t\t<ScreenBody>\n\t\t\t\t<ShadowsPreview shadow={ selectedShadow.shadow } />\n\t\t\t\t<ShadowEditor\n\t\t\t\t\tshadow={ selectedShadow.shadow }\n\t\t\t\t\tonChange={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</ScreenBody>\n\t\t\t{ isConfirmDialogVisible && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\thandleShadowDelete();\n\t\t\t\t\t\tsetIsConfirmDialogVisible( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => {\n\t\t\t\t\t\tsetIsConfirmDialogVisible( false );\n\t\t\t\t\t} }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t\tsize=\"medium\"\n\t\t\t\t>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Name of the shadow preset. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Are you sure you want to delete \"%s\" shadow preset?'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tselectedShadow.name\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t\t{ isRenameModalVisible && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename' ) }\n\t\t\t\t\tonRequestClose={ () => setIsRenameModalVisible( false ) }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\thandleShadowRename( shadowName );\n\t\t\t\t\t\t\tsetIsRenameModalVisible( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Shadow name' ) }\n\t\t\t\t\t\t\tvalue={ shadowName ?? '' }\n\t\t\t\t\t\t\tonChange={ setShadowName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Spacer marginBottom={ 6 } />\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"block-editor-shadow-edit-modal__actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsRenameModalVisible( false )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\ninterface ShadowsPreviewProps {\n\tshadow: string;\n}\n\nfunction ShadowsPreview( { shadow }: ShadowsPreviewProps ) {\n\tconst shadowStyle = {\n\t\tboxShadow: shadow,\n\t};\n\n\treturn (\n\t\t<Spacer marginBottom={ 4 } marginTop={ -2 }>\n\t\t\t<HStack\n\t\t\t\talignment=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tclassName=\"global-styles-ui__shadow-preview-panel\"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"global-styles-ui__shadow-preview-block\"\n\t\t\t\t\tstyle={ shadowStyle }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n\ninterface ShadowEditorProps {\n\tshadow: string;\n\tonChange: ( shadow: string ) => void;\n}\n\nfunction ShadowEditor( { shadow, onChange }: ShadowEditorProps ) {\n\tconst addShadowButtonRef = useRef< HTMLButtonElement >( null );\n\tconst shadowParts = useMemo( () => getShadowParts( shadow ), [ shadow ] );\n\n\tconst onChangeShadowPart = ( index: number, part: string ) => {\n\t\tconst newShadowParts = [ ...shadowParts ];\n\t\tnewShadowParts[ index ] = part;\n\t\tonChange( newShadowParts.join( ', ' ) );\n\t};\n\n\tconst onAddShadowPart = () => {\n\t\tonChange( [ ...shadowParts, defaultShadow ].join( ', ' ) );\n\t};\n\n\tconst onRemoveShadowPart = ( index: number ) => {\n\t\tonChange( shadowParts.filter( ( p, i ) => i !== index ).join( ', ' ) );\n\t\taddShadowButtonRef.current?.focus();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Shadows' ) }</Subtitle>\n\t\t\t\t\t<FlexItem className=\"global-styles-ui__shadows-panel__options-container\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={ __( 'Add shadow' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonAddShadowPart();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tref={ addShadowButtonRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t\t<Spacer />\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t{ shadowParts.map( ( part, index ) => (\n\t\t\t\t\t<ShadowItem\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tshadow={ part }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tonChangeShadowPart( index, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcanRemove={ shadowParts.length > 1 }\n\t\t\t\t\t\tonRemove={ () => onRemoveShadowPart( index ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\ninterface ShadowItemProps {\n\tshadow: string;\n\tonChange: ( shadow: string ) => void;\n\tcanRemove: boolean;\n\tonRemove: () => void;\n}\n\nfunction ShadowItem( {\n\tshadow,\n\tonChange,\n\tcanRemove,\n\tonRemove,\n}: ShadowItemProps ) {\n\tconst popoverProps = {\n\t\tplacement: 'left-start' as const,\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\tconst shadowObj = useMemo(\n\t\t() => shadowStringToObject( shadow ),\n\t\t[ shadow ]\n\t);\n\tconst onShadowChange = ( newShadow: any ) => {\n\t\tonChange( shadowObjectToString( newShadow ) );\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"global-styles-ui__shadow-editor__dropdown\"\n\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\tconst toggleProps = {\n\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t'global-styles-ui__shadow-editor__dropdown-toggle',\n\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t),\n\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t};\n\t\t\t\tconst removeButtonProps = {\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t},\n\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t'global-styles-ui__shadow-editor__remove-button',\n\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t),\n\t\t\t\t\tlabel: __( 'Remove shadow' ),\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ shadowIcon }\n\t\t\t\t\t\t\t{ ...toggleProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ shadowObj.inset\n\t\t\t\t\t\t\t\t? __( 'Inner shadow' )\n\t\t\t\t\t\t\t\t: __( 'Drop shadow' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ reset }\n\t\t\t\t\t\t\t\t{ ...removeButtonProps }\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\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper\n\t\t\t\t\tpaddingSize=\"medium\"\n\t\t\t\t\tclassName=\"global-styles-ui__shadow-editor__dropdown-content\"\n\t\t\t\t>\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadowObj={ shadowObj }\n\t\t\t\t\t\tonChange={ onShadowChange }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\ninterface ShadowPopoverProps {\n\tshadowObj: any;\n\tonChange: ( shadow: any ) => void;\n}\n\nfunction ShadowPopover( { shadowObj, onChange }: ShadowPopoverProps ) {\n\tconst __experimentalIsRenderedInSidebar = true;\n\tconst enableAlpha = true;\n\n\tconst onShadowChange = ( key: string, value: any ) => {\n\t\tconst newShadow = {\n\t\t\t...shadowObj,\n\t\t\t[ key ]: value,\n\t\t};\n\t\tonChange( newShadow );\n\t};\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"global-styles-ui__shadow-editor-panel\">\n\t\t\t<ColorPalette\n\t\t\t\tclearable={ false }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tvalue={ shadowObj.color }\n\t\t\t\tonChange={ ( value ) => onShadowChange( 'color', value ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Shadow Type' ) }\n\t\t\t\tvalue={ shadowObj.inset ? 'inset' : 'outset' }\n\t\t\t\tisBlock\n\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\tonShadowChange( 'inset', value === 'inset' )\n\t\t\t\t}\n\t\t\t\thideLabelFromVision\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"outset\"\n\t\t\t\t\tlabel={ __( 'Outset' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"inset\"\n\t\t\t\t\tlabel={ __( 'Inset' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t<Grid columns={ 2 } gap={ 4 }>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'X Position' ) }\n\t\t\t\t\tvalue={ shadowObj.x }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'x', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Y Position' ) }\n\t\t\t\t\tvalue={ shadowObj.y }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'y', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Blur' ) }\n\t\t\t\t\tvalue={ shadowObj.blur }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'blur', value ) }\n\t\t\t\t/>\n\t\t\t\t<ShadowInputControl\n\t\t\t\t\tlabel={ __( 'Spread' ) }\n\t\t\t\t\tvalue={ shadowObj.spread }\n\t\t\t\t\tonChange={ ( value ) => onShadowChange( 'spread', value ) }\n\t\t\t\t/>\n\t\t\t</Grid>\n\t\t</VStack>\n\t);\n}\n\ninterface ShadowInputControlProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: ( value: string ) => void;\n}\n\nfunction ShadowInputControl( {\n\tlabel,\n\tvalue,\n\tonChange,\n}: ShadowInputControlProps ) {\n\tconst onValueChange = ( next: string | undefined ) => {\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : '0px';\n\t\tonChange( nextValue );\n\t};\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ label }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onValueChange }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,8BAA8B;AAAA,EAC9B,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,GAAI,KAAM,GACzB;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ,GAAI,YAAa;AAAA,UACzB,OAAQ,UAAU;AAAA,UAClB,UAAW,CAAE,UAAW,eAAgB,KAAK,KAAM;AAAA;AAAA,MACpD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ,GAAI,YAAa;AAAA,UACzB,OAAQ,UAAU;AAAA,UAClB,UAAW,CAAE,UAAW,eAAgB,KAAK,KAAM;AAAA;AAAA,MACpD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ,GAAI,MAAO;AAAA,UACnB,OAAQ,UAAU;AAAA,UAClB,UAAW,CAAE,UAAW,eAAgB,QAAQ,KAAM;AAAA;AAAA,MACvD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ,GAAI,QAAS;AAAA,UACrB,OAAQ,UAAU;AAAA,UAClB,UAAW,CAAE,UAAW,eAAgB,UAAU,KAAM;AAAA;AAAA,MACzD;AAAA,OACD;AAAA,KACD;AAEF;AAQA,SAAS,mBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACD,GAA6B;AAC5B,QAAM,gBAAgB,CAAE,SAA8B;AACrD,UAAM,YAAY,SAAS,UAAa,CAAE,MAAO,WAAY,IAAK,CAAE;AACpE,UAAM,YAAY,YAAY,OAAO;AACrC,aAAU,SAAU;AAAA,EACrB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAW;AAAA;AAAA,EACZ;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,6 @@ function SizeControl(props) {
|
|
|
34
34
|
/* @__PURE__ */ jsx(FlexItem, { isBlock: true, children: /* @__PURE__ */ jsx(
|
|
35
35
|
UnitControl,
|
|
36
36
|
{
|
|
37
|
-
__next40pxDefaultSize: true,
|
|
38
37
|
label,
|
|
39
38
|
hideLabelFromVision: true,
|
|
40
39
|
value,
|
|
@@ -47,7 +46,6 @@ function SizeControl(props) {
|
|
|
47
46
|
/* @__PURE__ */ jsx(FlexItem, { isBlock: true, children: /* @__PURE__ */ jsx(Spacer, { marginX: 2, marginBottom: 0, children: /* @__PURE__ */ jsx(
|
|
48
47
|
RangeControl,
|
|
49
48
|
{
|
|
50
|
-
__next40pxDefaultSize: true,
|
|
51
49
|
label,
|
|
52
50
|
hideLabelFromVision: true,
|
|
53
51
|
value: valueQuantity,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/size-control/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tRangeControl,\n\tFlex,\n\tFlexItem,\n\tuseBaseControlProps,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\nconst DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];\n\ninterface SizeControlProps {\n\tvalue?: string;\n\tonChange?: ( value: string | undefined ) => void;\n\tfallbackValue?: number;\n\tdisabled?: boolean;\n\tlabel?: string;\n}\n\nfunction SizeControl( props: SizeControlProps ) {\n\tconst { baseControlProps } = useBaseControlProps( props );\n\tconst { value, onChange, fallbackValue, disabled, label } = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: DEFAULT_UNITS,\n\t} );\n\n\tconst [ valueQuantity, valueUnit = 'px' ] =\n\t\tparseQuantityAndUnitFromRawValue( value, units );\n\n\tconst isValueUnitRelative =\n\t\t!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );\n\n\t// Receives the new value from the UnitControl component as a string containing the value and unit.\n\tconst handleUnitControlChange = ( newValue: string | undefined ) => {\n\t\tonChange?.( newValue );\n\t};\n\n\t// Receives the new value from the RangeControl component as a number.\n\tconst handleRangeControlChange = ( newValue: number | undefined ) => {\n\t\tif ( newValue !== undefined ) {\n\t\t\tonChange?.( newValue + valueUnit );\n\t\t} else {\n\t\t\tonChange?.( undefined );\n\t\t}\n\t};\n\n\treturn (\n\t\t<BaseControl { ...baseControlProps }>\n\t\t\t<Flex>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,kDAAkD;AAAA,EAClD,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,OAClB;AA0CJ,SAEE,KAFF;AAxCH,IAAM,gBAAgB,CAAE,MAAM,MAAM,OAAO,MAAM,IAAK;AAUtD,SAAS,YAAa,OAA0B;AAC/C,QAAM,EAAE,iBAAiB,IAAI,oBAAqB,KAAM;AACxD,QAAM,EAAE,OAAO,UAAU,eAAe,UAAU,MAAM,IAAI;AAE5D,QAAM,QAAQ,eAAgB;AAAA,IAC7B,gBAAgB;AAAA,EACjB,CAAE;AAEF,QAAM,CAAE,eAAe,YAAY,IAAK,IACvC,iCAAkC,OAAO,KAAM;AAEhD,QAAM,sBACL,CAAC,CAAE,aAAa,CAAE,MAAM,OAAO,MAAM,IAAK,EAAE,SAAU,SAAU;AAGjE,QAAM,0BAA0B,CAAE,aAAkC;AACnE,eAAY,QAAS;AAAA,EACtB;AAGA,QAAM,2BAA2B,CAAE,aAAkC;AACpE,QAAK,aAAa,QAAY;AAC7B,iBAAY,WAAW,SAAU;AAAA,IAClC,OAAO;AACN,iBAAY,MAAU;AAAA,IACvB;AAAA,EACD;AAEA,SACC,oBAAC,eAAc,GAAG,kBACjB,+BAAC,QACA;AAAA,wBAAC,YAAS,SAAO,MAChB;AAAA,MAAC;AAAA;AAAA,QACA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tRangeControl,\n\tFlex,\n\tFlexItem,\n\tuseBaseControlProps,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\nconst DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];\n\ninterface SizeControlProps {\n\tvalue?: string;\n\tonChange?: ( value: string | undefined ) => void;\n\tfallbackValue?: number;\n\tdisabled?: boolean;\n\tlabel?: string;\n}\n\nfunction SizeControl( props: SizeControlProps ) {\n\tconst { baseControlProps } = useBaseControlProps( props );\n\tconst { value, onChange, fallbackValue, disabled, label } = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: DEFAULT_UNITS,\n\t} );\n\n\tconst [ valueQuantity, valueUnit = 'px' ] =\n\t\tparseQuantityAndUnitFromRawValue( value, units );\n\n\tconst isValueUnitRelative =\n\t\t!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );\n\n\t// Receives the new value from the UnitControl component as a string containing the value and unit.\n\tconst handleUnitControlChange = ( newValue: string | undefined ) => {\n\t\tonChange?.( newValue );\n\t};\n\n\t// Receives the new value from the RangeControl component as a number.\n\tconst handleRangeControlChange = ( newValue: number | undefined ) => {\n\t\tif ( newValue !== undefined ) {\n\t\t\tonChange?.( newValue + valueUnit );\n\t\t} else {\n\t\t\tonChange?.( undefined );\n\t\t}\n\t};\n\n\treturn (\n\t\t<BaseControl { ...baseControlProps }>\n\t\t\t<Flex>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ handleUnitControlChange }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<Spacer marginX={ 2 } marginBottom={ 0 }>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ valueQuantity }\n\t\t\t\t\t\t\tinitialPosition={ fallbackValue }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tonChange={ handleRangeControlChange }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ isValueUnitRelative ? 10 : 100 }\n\t\t\t\t\t\t\tstep={ isValueUnitRelative ? 0.1 : 1 }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Spacer>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</BaseControl>\n\t);\n}\n\nexport { SizeControl };\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC,kDAAkD;AAAA,EAClD,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,OAClB;AA0CJ,SAEE,KAFF;AAxCH,IAAM,gBAAgB,CAAE,MAAM,MAAM,OAAO,MAAM,IAAK;AAUtD,SAAS,YAAa,OAA0B;AAC/C,QAAM,EAAE,iBAAiB,IAAI,oBAAqB,KAAM;AACxD,QAAM,EAAE,OAAO,UAAU,eAAe,UAAU,MAAM,IAAI;AAE5D,QAAM,QAAQ,eAAgB;AAAA,IAC7B,gBAAgB;AAAA,EACjB,CAAE;AAEF,QAAM,CAAE,eAAe,YAAY,IAAK,IACvC,iCAAkC,OAAO,KAAM;AAEhD,QAAM,sBACL,CAAC,CAAE,aAAa,CAAE,MAAM,OAAO,MAAM,IAAK,EAAE,SAAU,SAAU;AAGjE,QAAM,0BAA0B,CAAE,aAAkC;AACnE,eAAY,QAAS;AAAA,EACtB;AAGA,QAAM,2BAA2B,CAAE,aAAkC;AACpE,QAAK,aAAa,QAAY;AAC7B,iBAAY,WAAW,SAAU;AAAA,IAClC,OAAO;AACN,iBAAY,MAAU;AAAA,IACvB;AAAA,EACD;AAEA,SACC,oBAAC,eAAc,GAAG,kBACjB,+BAAC,QACA;AAAA,wBAAC,YAAS,SAAO,MAChB;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,qBAAmB;AAAA,QACnB;AAAA,QACA,UAAW;AAAA,QACX;AAAA,QACA,KAAM;AAAA,QACN;AAAA;AAAA,IACD,GACD;AAAA,IACA,oBAAC,YAAS,SAAO,MAChB,8BAAC,UAAO,SAAU,GAAI,cAAe,GACpC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,qBAAmB;AAAA,QACnB,OAAQ;AAAA,QACR,iBAAkB;AAAA,QAClB,gBAAiB;AAAA,QACjB,UAAW;AAAA,QACX,KAAM;AAAA,QACN,KAAM,sBAAsB,KAAK;AAAA,QACjC,MAAO,sBAAsB,MAAM;AAAA,QACnC;AAAA;AAAA,IACD,GACD,GACD;AAAA,KACD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/utils.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// packages/global-styles-ui/src/utils.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
areGlobalStylesEqual,
|
|
4
|
+
privateApis as globalStylesEnginePrivateApis
|
|
5
|
+
} from "@wordpress/global-styles-engine";
|
|
3
6
|
import { __ } from "@wordpress/i18n";
|
|
7
|
+
import { unlock } from "./lock-unlock.mjs";
|
|
8
|
+
var { getViewportBreakpoints } = unlock(globalStylesEnginePrivateApis);
|
|
4
9
|
var VALID_ELEMENT_STATES = {
|
|
5
10
|
link: [
|
|
6
11
|
{ value: ":link", label: __("Link") },
|
|
@@ -42,8 +47,11 @@ function getValidPseudoStates(name) {
|
|
|
42
47
|
}
|
|
43
48
|
return [];
|
|
44
49
|
}
|
|
45
|
-
function getValidViewportStates() {
|
|
46
|
-
|
|
50
|
+
function getValidViewportStates(viewportSettings) {
|
|
51
|
+
const breakpoints = getViewportBreakpoints(viewportSettings);
|
|
52
|
+
return RESPONSIVE_STATES.filter(
|
|
53
|
+
(state) => (state.value !== "@tablet" || breakpoints.tablet !== void 0) && (state.value !== "@mobile" || breakpoints.mobile !== void 0)
|
|
54
|
+
);
|
|
47
55
|
}
|
|
48
56
|
function removePropertiesFromObject(object, properties) {
|
|
49
57
|
if (!properties?.length) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/utils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { areGlobalStylesEqual } from '@wordpress/global-styles-engine';\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * State definition with value and label.\n */\nexport interface StateDefinition {\n\tvalue: string;\n\tlabel: string;\n}\n\n/**\n * Valid states for elements with their labels.\n * This mirrors the PHP constant in lib/class-wp-theme-json-gutenberg.php\n */\nexport const VALID_ELEMENT_STATES: Record< string, StateDefinition[] > = {\n\tlink: [\n\t\t{ value: ':link', label: __( 'Link' ) },\n\t\t{ value: ':any-link', label: __( 'Any Link' ) },\n\t\t{ value: ':visited', label: __( 'Visited' ) },\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n\tbutton: [\n\t\t{ value: ':link', label: __( 'Link' ) },\n\t\t{ value: ':any-link', label: __( 'Any Link' ) },\n\t\t{ value: ':visited', label: __( 'Visited' ) },\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n};\n\n/**\n * Valid states for blocks with their labels.\n * This mirrors the PHP constant in lib/class-wp-theme-json-gutenberg.php\n */\nexport const VALID_BLOCK_STATES: Record< string, StateDefinition[] > = {\n\t'core/button': [\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n};\n\n/**\n * Responsive breakpoint states available for all blocks.\n * These map to CSS media queries wrapping the block's styles.\n */\nexport const RESPONSIVE_STATES: StateDefinition[] = [\n\t{ value: '@tablet', label: __( 'Tablet' ) },\n\t{ value: '@mobile', label: __( 'Mobile' ) },\n];\n\n/**\n * Get the valid pseudo states for a given block or element.\n *\n * @param name The block name (e.g., 'core/button') or element name (e.g., 'button')\n * @return Array of valid pseudo state definitions, or empty array if none\n */\nexport function getValidPseudoStates( name: string ): StateDefinition[] {\n\t// Check if it's a block (contains a slash, e.g. 'core/button').\n\tif ( VALID_BLOCK_STATES[ name ] ) {\n\t\treturn VALID_BLOCK_STATES[ name ] ?? [];\n\t}\n\n\t// Check if it's an element\n\tif ( VALID_ELEMENT_STATES[ name ] ) {\n\t\treturn VALID_ELEMENT_STATES[ name ];\n\t}\n\n\treturn [];\n}\n\n/**\n * Get the valid viewport state definitions.\n *\n * @return Array of valid viewport state definitions.\n */\nexport function getValidViewportStates(): StateDefinition[] {\n\treturn RESPONSIVE_STATES;\n}\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param object The object to remove the properties from.\n * @param properties The properties to remove.\n * @return The modified object.\n */\nexport function removePropertiesFromObject(\n\tobject: any,\n\tproperties: string[]\n): any {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param object The object to filter\n * @param properties The properties to filter by\n * @return The merged object.\n */\nexport const filterObjectByProperties = (\n\tobject: any,\n\tproperties: string[]\n): any => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject: any = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param variation The variation to compare.\n * @param properties The properties to compare.\n * @return Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties(\n\tvariation: GlobalStylesConfig,\n\tproperties: string[]\n): boolean {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tstructuredClone( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStylesEqual( variationWithProperties, variation );\n}\n\nfunction getFontFamilyFromSetting( fontFamilies: any[], setting: string ): any {\n\tif ( ! Array.isArray( fontFamilies ) || ! setting ) {\n\t\treturn null;\n\t}\n\n\tconst fontFamilyVariable = setting.replace( 'var(', '' ).replace( ')', '' );\n\tconst fontFamilySlug = fontFamilyVariable?.split( '--' ).slice( -1 )[ 0 ];\n\n\treturn fontFamilies.find(\n\t\t( fontFamily ) => fontFamily.slug === fontFamilySlug\n\t);\n}\n\n/**\n * Extracts font families from a theme JSON configuration.\n *\n * @param themeJson The theme JSON configuration\n * @return Array containing [bodyFontFamily, headingFontFamily]\n */\nexport function getFontFamilies( themeJson: any ): [ any, any ] {\n\tconst themeFontFamilies =\n\t\tthemeJson?.settings?.typography?.fontFamilies?.theme;\n\tconst customFontFamilies =\n\t\tthemeJson?.settings?.typography?.fontFamilies?.custom;\n\n\tlet fontFamilies: any[] = [];\n\tif ( themeFontFamilies && customFontFamilies ) {\n\t\tfontFamilies = [ ...themeFontFamilies, ...customFontFamilies ];\n\t} else if ( themeFontFamilies ) {\n\t\tfontFamilies = themeFontFamilies;\n\t} else if ( customFontFamilies ) {\n\t\tfontFamilies = customFontFamilies;\n\t}\n\tconst bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;\n\tconst bodyFontFamily = getFontFamilyFromSetting(\n\t\tfontFamilies,\n\t\tbodyFontFamilySetting\n\t);\n\n\tconst headingFontFamilySetting =\n\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily;\n\n\tlet headingFontFamily;\n\tif ( ! headingFontFamilySetting ) {\n\t\theadingFontFamily = bodyFontFamily;\n\t} else {\n\t\theadingFontFamily = getFontFamilyFromSetting(\n\t\t\tfontFamilies,\n\t\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily\n\t\t);\n\t}\n\n\treturn [ bodyFontFamily, headingFontFamily ];\n}\n\nfunction findNearest( input: number, numbers: number[] ): number | null {\n\t// If the numbers array is empty, return null\n\tif ( numbers.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Sort the array based on the absolute difference with the input\n\tnumbers.sort( ( a, b ) => Math.abs( input - a ) - Math.abs( input - b ) );\n\t// Return the first element (which will be the nearest) from the sorted array\n\treturn numbers[ 0 ];\n}\n\nfunction extractFontWeights( fontFaces: any[] ): number[] {\n\tconst result: number[] = [];\n\n\tfontFaces.forEach( ( face ) => {\n\t\tconst weights = String( face.fontWeight ).split( ' ' );\n\n\t\tif ( weights.length === 2 ) {\n\t\t\tconst start = parseInt( weights[ 0 ] );\n\t\t\tconst end = parseInt( weights[ 1 ] );\n\n\t\t\tfor ( let i = start; i <= end; i += 100 ) {\n\t\t\t\tresult.push( i );\n\t\t\t}\n\t\t} else if ( weights.length === 1 ) {\n\t\t\tresult.push( parseInt( weights[ 0 ] ) );\n\t\t}\n\t} );\n\n\treturn result;\n}\n\n/*\n * Format the font family to use in the CSS font-family property of a CSS rule.\n *\n * The input can be a string with the font family name or a string with multiple font family names separated by commas.\n * It follows the recommendations from the CSS Fonts Module Level 4.\n * https://www.w3.org/TR/css-fonts-4/#font-family-prop\n *\n * @param input - The font family.\n * @return The formatted font family.\n */\nexport function formatFontFamily( input: string ): string {\n\t// Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens).\n\tconst regex = /^(?!generic\\([ a-zA-Z\\-]+\\)$)(?!^[a-zA-Z\\-]+$).+/;\n\tconst output = input.trim();\n\n\tconst formatItem = ( item: string ) => {\n\t\titem = item.trim();\n\t\tif ( item.match( regex ) ) {\n\t\t\t// removes leading and trailing quotes.\n\t\t\titem = item.replace( /^[\"']|[\"']$/g, '' );\n\t\t\treturn `\"${ item }\"`;\n\t\t}\n\t\treturn item;\n\t};\n\n\tif ( output.includes( ',' ) ) {\n\t\treturn output\n\t\t\t.split( ',' )\n\t\t\t.map( formatItem )\n\t\t\t.filter( ( item ) => item !== '' )\n\t\t\t.join( ', ' );\n\t}\n\n\treturn formatItem( output );\n}\n\n/**\n * Gets the preview style for a font family.\n *\n * @param family The font family object\n * @return CSS style object for the font family\n */\nexport function getFamilyPreviewStyle( family: any ): React.CSSProperties {\n\tconst style: React.CSSProperties = {\n\t\tfontFamily: formatFontFamily( family.fontFamily ),\n\t};\n\n\tif ( ! Array.isArray( family.fontFace ) ) {\n\t\tstyle.fontWeight = '400';\n\t\tstyle.fontStyle = 'normal';\n\t\treturn style;\n\t}\n\n\tif ( family.fontFace ) {\n\t\t//get all the font faces with normal style\n\t\tconst normalFaces = family.fontFace.filter(\n\t\t\t( face: any ) =>\n\t\t\t\tface?.fontStyle && face.fontStyle.toLowerCase() === 'normal'\n\t\t);\n\t\tif ( normalFaces.length > 0 ) {\n\t\t\tstyle.fontStyle = 'normal';\n\t\t\tconst normalWeights = extractFontWeights( normalFaces );\n\t\t\tconst nearestWeight = findNearest( 400, normalWeights );\n\t\t\tstyle.fontWeight = String( nearestWeight ) || '400';\n\t\t} else {\n\t\t\tstyle.fontStyle =\n\t\t\t\t( family.fontFace.length && family.fontFace[ 0 ].fontStyle ) ||\n\t\t\t\t'normal';\n\t\t\tstyle.fontWeight =\n\t\t\t\t( family.fontFace.length &&\n\t\t\t\t\tString( family.fontFace[ 0 ].fontWeight ) ) ||\n\t\t\t\t'400';\n\t\t}\n\t}\n\n\treturn style;\n}\n\n/**\n * Iterates through the presets array and searches for slugs that start with the specified\n * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found\n * and returns one greater than the highest found suffix, ensuring that the new index is unique.\n *\n * @param presets The array of preset objects, each potentially containing a slug property.\n * @param slugPrefix The prefix to look for in the preset slugs.\n *\n * @return The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found.\n */\n/**\n * Gets the variation class name for a block style variation.\n *\n * @param variation The variation name.\n * @return The variation class name.\n */\nexport function getVariationClassName( variation: string ): string {\n\tif ( ! variation ) {\n\t\treturn '';\n\t}\n\treturn `is-style-${ variation }`;\n}\n\nexport function getNewIndexFromPresets(\n\tpresets: any[],\n\tslugPrefix: string\n): number {\n\tconst nameRegex = new RegExp( `^${ slugPrefix }([\\\\d]+)$` );\n\tconst highestPresetValue = presets.reduce( ( currentHighest, preset ) => {\n\t\tif ( typeof preset?.slug === 'string' ) {\n\t\t\tconst matches = preset?.slug.match( nameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id > currentHighest ) {\n\t\t\t\t\treturn id;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn currentHighest;\n\t}, 0 );\n\treturn highestPresetValue + 1;\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tareGlobalStylesEqual,\n\tprivateApis as globalStylesEnginePrivateApis,\n} from '@wordpress/global-styles-engine';\nimport type {\n\tGlobalStylesConfig,\n\tGlobalStylesSettings,\n} from '@wordpress/global-styles-engine';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\n\nconst { getViewportBreakpoints } = unlock( globalStylesEnginePrivateApis );\n\n/**\n * State definition with value and label.\n */\nexport interface StateDefinition {\n\tvalue: string;\n\tlabel: string;\n}\n\n/**\n * Valid states for elements with their labels.\n * This mirrors the PHP constant in lib/class-wp-theme-json-gutenberg.php\n */\nexport const VALID_ELEMENT_STATES: Record< string, StateDefinition[] > = {\n\tlink: [\n\t\t{ value: ':link', label: __( 'Link' ) },\n\t\t{ value: ':any-link', label: __( 'Any Link' ) },\n\t\t{ value: ':visited', label: __( 'Visited' ) },\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n\tbutton: [\n\t\t{ value: ':link', label: __( 'Link' ) },\n\t\t{ value: ':any-link', label: __( 'Any Link' ) },\n\t\t{ value: ':visited', label: __( 'Visited' ) },\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n};\n\n/**\n * Valid states for blocks with their labels.\n * This mirrors the PHP constant in lib/class-wp-theme-json-gutenberg.php\n */\nexport const VALID_BLOCK_STATES: Record< string, StateDefinition[] > = {\n\t'core/button': [\n\t\t{ value: ':hover', label: __( 'Hover' ) },\n\t\t{ value: ':focus', label: __( 'Focus' ) },\n\t\t{ value: ':focus-visible', label: __( 'Focus-visible' ) },\n\t\t{ value: ':active', label: __( 'Active' ) },\n\t],\n};\n\n/**\n * Responsive breakpoint states available for all blocks.\n * These map to CSS media queries wrapping the block's styles.\n */\nexport const RESPONSIVE_STATES: StateDefinition[] = [\n\t{ value: '@tablet', label: __( 'Tablet' ) },\n\t{ value: '@mobile', label: __( 'Mobile' ) },\n];\n\n/**\n * Get the valid pseudo states for a given block or element.\n *\n * @param name The block name (e.g., 'core/button') or element name (e.g., 'button')\n * @return Array of valid pseudo state definitions, or empty array if none\n */\nexport function getValidPseudoStates( name: string ): StateDefinition[] {\n\t// Check if it's a block (contains a slash, e.g. 'core/button').\n\tif ( VALID_BLOCK_STATES[ name ] ) {\n\t\treturn VALID_BLOCK_STATES[ name ] ?? [];\n\t}\n\n\t// Check if it's an element\n\tif ( VALID_ELEMENT_STATES[ name ] ) {\n\t\treturn VALID_ELEMENT_STATES[ name ];\n\t}\n\n\treturn [];\n}\n\n/**\n * Get the valid viewport state definitions.\n *\n * @param viewportSettings\n * @return Array of valid viewport state definitions.\n */\nexport function getValidViewportStates(\n\tviewportSettings?: GlobalStylesSettings[ 'viewport' ]\n): StateDefinition[] {\n\tconst breakpoints = getViewportBreakpoints( viewportSettings );\n\n\treturn RESPONSIVE_STATES.filter(\n\t\t( state ) =>\n\t\t\t( state.value !== '@tablet' || breakpoints.tablet !== undefined ) &&\n\t\t\t( state.value !== '@mobile' || breakpoints.mobile !== undefined )\n\t);\n}\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param object The object to remove the properties from.\n * @param properties The properties to remove.\n * @return The modified object.\n */\nexport function removePropertiesFromObject(\n\tobject: any,\n\tproperties: string[]\n): any {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param object The object to filter\n * @param properties The properties to filter by\n * @return The merged object.\n */\nexport const filterObjectByProperties = (\n\tobject: any,\n\tproperties: string[]\n): any => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject: any = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param variation The variation to compare.\n * @param properties The properties to compare.\n * @return Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties(\n\tvariation: GlobalStylesConfig,\n\tproperties: string[]\n): boolean {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tstructuredClone( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStylesEqual( variationWithProperties, variation );\n}\n\nfunction getFontFamilyFromSetting( fontFamilies: any[], setting: string ): any {\n\tif ( ! Array.isArray( fontFamilies ) || ! setting ) {\n\t\treturn null;\n\t}\n\n\tconst fontFamilyVariable = setting.replace( 'var(', '' ).replace( ')', '' );\n\tconst fontFamilySlug = fontFamilyVariable?.split( '--' ).slice( -1 )[ 0 ];\n\n\treturn fontFamilies.find(\n\t\t( fontFamily ) => fontFamily.slug === fontFamilySlug\n\t);\n}\n\n/**\n * Extracts font families from a theme JSON configuration.\n *\n * @param themeJson The theme JSON configuration\n * @return Array containing [bodyFontFamily, headingFontFamily]\n */\nexport function getFontFamilies( themeJson: any ): [ any, any ] {\n\tconst themeFontFamilies =\n\t\tthemeJson?.settings?.typography?.fontFamilies?.theme;\n\tconst customFontFamilies =\n\t\tthemeJson?.settings?.typography?.fontFamilies?.custom;\n\n\tlet fontFamilies: any[] = [];\n\tif ( themeFontFamilies && customFontFamilies ) {\n\t\tfontFamilies = [ ...themeFontFamilies, ...customFontFamilies ];\n\t} else if ( themeFontFamilies ) {\n\t\tfontFamilies = themeFontFamilies;\n\t} else if ( customFontFamilies ) {\n\t\tfontFamilies = customFontFamilies;\n\t}\n\tconst bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;\n\tconst bodyFontFamily = getFontFamilyFromSetting(\n\t\tfontFamilies,\n\t\tbodyFontFamilySetting\n\t);\n\n\tconst headingFontFamilySetting =\n\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily;\n\n\tlet headingFontFamily;\n\tif ( ! headingFontFamilySetting ) {\n\t\theadingFontFamily = bodyFontFamily;\n\t} else {\n\t\theadingFontFamily = getFontFamilyFromSetting(\n\t\t\tfontFamilies,\n\t\t\tthemeJson?.styles?.elements?.heading?.typography?.fontFamily\n\t\t);\n\t}\n\n\treturn [ bodyFontFamily, headingFontFamily ];\n}\n\nfunction findNearest( input: number, numbers: number[] ): number | null {\n\t// If the numbers array is empty, return null\n\tif ( numbers.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Sort the array based on the absolute difference with the input\n\tnumbers.sort( ( a, b ) => Math.abs( input - a ) - Math.abs( input - b ) );\n\t// Return the first element (which will be the nearest) from the sorted array\n\treturn numbers[ 0 ];\n}\n\nfunction extractFontWeights( fontFaces: any[] ): number[] {\n\tconst result: number[] = [];\n\n\tfontFaces.forEach( ( face ) => {\n\t\tconst weights = String( face.fontWeight ).split( ' ' );\n\n\t\tif ( weights.length === 2 ) {\n\t\t\tconst start = parseInt( weights[ 0 ] );\n\t\t\tconst end = parseInt( weights[ 1 ] );\n\n\t\t\tfor ( let i = start; i <= end; i += 100 ) {\n\t\t\t\tresult.push( i );\n\t\t\t}\n\t\t} else if ( weights.length === 1 ) {\n\t\t\tresult.push( parseInt( weights[ 0 ] ) );\n\t\t}\n\t} );\n\n\treturn result;\n}\n\n/*\n * Format the font family to use in the CSS font-family property of a CSS rule.\n *\n * The input can be a string with the font family name or a string with multiple font family names separated by commas.\n * It follows the recommendations from the CSS Fonts Module Level 4.\n * https://www.w3.org/TR/css-fonts-4/#font-family-prop\n *\n * @param input - The font family.\n * @return The formatted font family.\n */\nexport function formatFontFamily( input: string ): string {\n\t// Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens).\n\tconst regex = /^(?!generic\\([ a-zA-Z\\-]+\\)$)(?!^[a-zA-Z\\-]+$).+/;\n\tconst output = input.trim();\n\n\tconst formatItem = ( item: string ) => {\n\t\titem = item.trim();\n\t\tif ( item.match( regex ) ) {\n\t\t\t// removes leading and trailing quotes.\n\t\t\titem = item.replace( /^[\"']|[\"']$/g, '' );\n\t\t\treturn `\"${ item }\"`;\n\t\t}\n\t\treturn item;\n\t};\n\n\tif ( output.includes( ',' ) ) {\n\t\treturn output\n\t\t\t.split( ',' )\n\t\t\t.map( formatItem )\n\t\t\t.filter( ( item ) => item !== '' )\n\t\t\t.join( ', ' );\n\t}\n\n\treturn formatItem( output );\n}\n\n/**\n * Gets the preview style for a font family.\n *\n * @param family The font family object\n * @return CSS style object for the font family\n */\nexport function getFamilyPreviewStyle( family: any ): React.CSSProperties {\n\tconst style: React.CSSProperties = {\n\t\tfontFamily: formatFontFamily( family.fontFamily ),\n\t};\n\n\tif ( ! Array.isArray( family.fontFace ) ) {\n\t\tstyle.fontWeight = '400';\n\t\tstyle.fontStyle = 'normal';\n\t\treturn style;\n\t}\n\n\tif ( family.fontFace ) {\n\t\t//get all the font faces with normal style\n\t\tconst normalFaces = family.fontFace.filter(\n\t\t\t( face: any ) =>\n\t\t\t\tface?.fontStyle && face.fontStyle.toLowerCase() === 'normal'\n\t\t);\n\t\tif ( normalFaces.length > 0 ) {\n\t\t\tstyle.fontStyle = 'normal';\n\t\t\tconst normalWeights = extractFontWeights( normalFaces );\n\t\t\tconst nearestWeight = findNearest( 400, normalWeights );\n\t\t\tstyle.fontWeight = String( nearestWeight ) || '400';\n\t\t} else {\n\t\t\tstyle.fontStyle =\n\t\t\t\t( family.fontFace.length && family.fontFace[ 0 ].fontStyle ) ||\n\t\t\t\t'normal';\n\t\t\tstyle.fontWeight =\n\t\t\t\t( family.fontFace.length &&\n\t\t\t\t\tString( family.fontFace[ 0 ].fontWeight ) ) ||\n\t\t\t\t'400';\n\t\t}\n\t}\n\n\treturn style;\n}\n\n/**\n * Iterates through the presets array and searches for slugs that start with the specified\n * slugPrefix followed by a numerical suffix. It identifies the highest numerical suffix found\n * and returns one greater than the highest found suffix, ensuring that the new index is unique.\n *\n * @param presets The array of preset objects, each potentially containing a slug property.\n * @param slugPrefix The prefix to look for in the preset slugs.\n *\n * @return The next available index for a preset with the specified slug prefix, or 1 if no matching slugs are found.\n */\n/**\n * Gets the variation class name for a block style variation.\n *\n * @param variation The variation name.\n * @return The variation class name.\n */\nexport function getVariationClassName( variation: string ): string {\n\tif ( ! variation ) {\n\t\treturn '';\n\t}\n\treturn `is-style-${ variation }`;\n}\n\nexport function getNewIndexFromPresets(\n\tpresets: any[],\n\tslugPrefix: string\n): number {\n\tconst nameRegex = new RegExp( `^${ slugPrefix }([\\\\d]+)$` );\n\tconst highestPresetValue = presets.reduce( ( currentHighest, preset ) => {\n\t\tif ( typeof preset?.slug === 'string' ) {\n\t\t\tconst matches = preset?.slug.match( nameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id > currentHighest ) {\n\t\t\t\t\treturn id;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn currentHighest;\n\t}, 0 );\n\treturn highestPresetValue + 1;\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AAKP,SAAS,UAAU;AAKnB,SAAS,cAAc;AAEvB,IAAM,EAAE,uBAAuB,IAAI,OAAQ,6BAA8B;AAclE,IAAM,uBAA4D;AAAA,EACxE,MAAM;AAAA,IACL,EAAE,OAAO,SAAS,OAAO,GAAI,MAAO,EAAE;AAAA,IACtC,EAAE,OAAO,aAAa,OAAO,GAAI,UAAW,EAAE;AAAA,IAC9C,EAAE,OAAO,YAAY,OAAO,GAAI,SAAU,EAAE;AAAA,IAC5C,EAAE,OAAO,UAAU,OAAO,GAAI,OAAQ,EAAE;AAAA,IACxC,EAAE,OAAO,UAAU,OAAO,GAAI,OAAQ,EAAE;AAAA,IACxC,EAAE,OAAO,kBAAkB,OAAO,GAAI,eAAgB,EAAE;AAAA,IACxD,EAAE,OAAO,WAAW,OAAO,GAAI,QAAS,EAAE;AAAA,EAC3C;AAAA,EACA,QAAQ;AAAA,IACP,EAAE,OAAO,SAAS,OAAO,GAAI,MAAO,EAAE;AAAA,IACtC,EAAE,OAAO,aAAa,OAAO,GAAI,UAAW,EAAE;AAAA,IAC9C,EAAE,OAAO,YAAY,OAAO,GAAI,SAAU,EAAE;AAAA,IAC5C,EAAE,OAAO,UAAU,OAAO,GAAI,OAAQ,EAAE;AAAA,IACxC,EAAE,OAAO,UAAU,OAAO,GAAI,OAAQ,EAAE;AAAA,IACxC,EAAE,OAAO,kBAAkB,OAAO,GA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AAM,qBAAqB,QAAQ,OAAQ,CAAE,gBAAgB,WAAY;AACxE,QAAK,OAAO,QAAQ,SAAS,UAAW;AACvC,YAAM,UAAU,QAAQ,KAAK,MAAO,SAAU;AAC9C,UAAK,SAAU;AACd,cAAM,KAAK,SAAU,QAAS,CAAE,GAAG,EAAG;AACtC,YAAK,KAAK,gBAAiB;AAC1B,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAE;AACL,SAAO,qBAAqB;AAC7B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -67,6 +67,12 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* Focus styles.
|
|
69
69
|
*/
|
|
70
|
+
/**
|
|
71
|
+
* Standard focus rings for the WordPress Design System.
|
|
72
|
+
*
|
|
73
|
+
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
|
|
74
|
+
* e.g. `&:focus { @include outset-ring__focus(); }`.
|
|
75
|
+
*/
|
|
70
76
|
/**
|
|
71
77
|
* Applies editor left position to the selector passed as argument
|
|
72
78
|
*/
|
|
@@ -101,7 +107,7 @@
|
|
|
101
107
|
}
|
|
102
108
|
.font-library-modal .font-library__subtitle {
|
|
103
109
|
text-transform: uppercase;
|
|
104
|
-
font-weight:
|
|
110
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
105
111
|
font-size: 11px;
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -149,20 +155,20 @@
|
|
|
149
155
|
|
|
150
156
|
.font-library__page-selection {
|
|
151
157
|
font-size: 11px;
|
|
152
|
-
font-weight:
|
|
158
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
153
159
|
text-transform: uppercase;
|
|
154
160
|
}
|
|
155
161
|
@media (min-width: 600px) {
|
|
156
162
|
.font-library__page-selection .font-library__page-selection-trigger {
|
|
157
163
|
font-size: 11px !important;
|
|
158
|
-
font-weight:
|
|
164
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
.font-library__fonts-title {
|
|
163
169
|
text-transform: uppercase;
|
|
164
170
|
font-size: 11px;
|
|
165
|
-
font-weight: 600;
|
|
171
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
166
172
|
margin-top: 0;
|
|
167
173
|
margin-bottom: 0;
|
|
168
174
|
}
|
|
@@ -373,7 +379,7 @@ button.font-library__upload-area {
|
|
|
373
379
|
}
|
|
374
380
|
.global-styles-ui-screen-revisions__description .global-styles-ui-screen-revisions__date {
|
|
375
381
|
text-transform: uppercase;
|
|
376
|
-
font-weight: 600;
|
|
382
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
377
383
|
font-size: 12px;
|
|
378
384
|
}
|
|
379
385
|
|
|
@@ -545,13 +551,13 @@ button.font-library__upload-area {
|
|
|
545
551
|
.global-styles-ui-subtitle {
|
|
546
552
|
margin-bottom: 0 !important;
|
|
547
553
|
text-transform: uppercase;
|
|
548
|
-
font-weight:
|
|
554
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600) !important;
|
|
549
555
|
font-size: 11px !important;
|
|
550
556
|
}
|
|
551
557
|
|
|
552
558
|
.global-styles-ui-section-title {
|
|
553
559
|
color: #2f2f2f;
|
|
554
|
-
font-weight: 600;
|
|
560
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
555
561
|
line-height: 1.2;
|
|
556
562
|
padding: 16px 16px 0;
|
|
557
563
|
margin: 0;
|
|
@@ -686,6 +692,14 @@ button.font-library__upload-area {
|
|
|
686
692
|
height: 100%;
|
|
687
693
|
}
|
|
688
694
|
|
|
695
|
+
.global-styles-ui-color-palette__tablist-container {
|
|
696
|
+
border-bottom: 1px solid #ddd;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.global-styles-ui-color-palette__tablist {
|
|
700
|
+
margin-bottom: -1px;
|
|
701
|
+
}
|
|
702
|
+
|
|
689
703
|
.global-styles-ui-sidebar__navigator-screen .single-column {
|
|
690
704
|
grid-column: span 1;
|
|
691
705
|
}
|
package/build-style/style.css
CHANGED
|
@@ -67,6 +67,12 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* Focus styles.
|
|
69
69
|
*/
|
|
70
|
+
/**
|
|
71
|
+
* Standard focus rings for the WordPress Design System.
|
|
72
|
+
*
|
|
73
|
+
* Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
|
|
74
|
+
* e.g. `&:focus { @include outset-ring__focus(); }`.
|
|
75
|
+
*/
|
|
70
76
|
/**
|
|
71
77
|
* Applies editor left position to the selector passed as argument
|
|
72
78
|
*/
|
|
@@ -101,7 +107,7 @@
|
|
|
101
107
|
}
|
|
102
108
|
.font-library-modal .font-library__subtitle {
|
|
103
109
|
text-transform: uppercase;
|
|
104
|
-
font-weight:
|
|
110
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
105
111
|
font-size: 11px;
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -149,20 +155,20 @@
|
|
|
149
155
|
|
|
150
156
|
.font-library__page-selection {
|
|
151
157
|
font-size: 11px;
|
|
152
|
-
font-weight:
|
|
158
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
153
159
|
text-transform: uppercase;
|
|
154
160
|
}
|
|
155
161
|
@media (min-width: 600px) {
|
|
156
162
|
.font-library__page-selection .font-library__page-selection-trigger {
|
|
157
163
|
font-size: 11px !important;
|
|
158
|
-
font-weight:
|
|
164
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
.font-library__fonts-title {
|
|
163
169
|
text-transform: uppercase;
|
|
164
170
|
font-size: 11px;
|
|
165
|
-
font-weight: 600;
|
|
171
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
166
172
|
margin-top: 0;
|
|
167
173
|
margin-bottom: 0;
|
|
168
174
|
}
|
|
@@ -373,7 +379,7 @@ button.font-library__upload-area {
|
|
|
373
379
|
}
|
|
374
380
|
.global-styles-ui-screen-revisions__description .global-styles-ui-screen-revisions__date {
|
|
375
381
|
text-transform: uppercase;
|
|
376
|
-
font-weight: 600;
|
|
382
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
377
383
|
font-size: 12px;
|
|
378
384
|
}
|
|
379
385
|
|
|
@@ -545,13 +551,13 @@ button.font-library__upload-area {
|
|
|
545
551
|
.global-styles-ui-subtitle {
|
|
546
552
|
margin-bottom: 0 !important;
|
|
547
553
|
text-transform: uppercase;
|
|
548
|
-
font-weight:
|
|
554
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600) !important;
|
|
549
555
|
font-size: 11px !important;
|
|
550
556
|
}
|
|
551
557
|
|
|
552
558
|
.global-styles-ui-section-title {
|
|
553
559
|
color: #2f2f2f;
|
|
554
|
-
font-weight: 600;
|
|
560
|
+
font-weight: var(--wpds-typography-font-weight-emphasis, 600);
|
|
555
561
|
line-height: 1.2;
|
|
556
562
|
padding: 16px 16px 0;
|
|
557
563
|
margin: 0;
|
|
@@ -688,6 +694,14 @@ button.font-library__upload-area {
|
|
|
688
694
|
height: 100%;
|
|
689
695
|
}
|
|
690
696
|
|
|
697
|
+
.global-styles-ui-color-palette__tablist-container {
|
|
698
|
+
border-bottom: 1px solid #ddd;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.global-styles-ui-color-palette__tablist {
|
|
702
|
+
margin-bottom: -1px;
|
|
703
|
+
}
|
|
704
|
+
|
|
691
705
|
.global-styles-ui-sidebar__navigator-screen .single-column {
|
|
692
706
|
grid-column: span 1;
|
|
693
707
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-panel.d.ts","sourceRoot":"","sources":["../src/background-panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"background-panel.d.ts","sourceRoot":"","sources":["../src/background-panel.tsx"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAE,KAAK,EAAE,GAAG,GAAI,OAAO,CAM7D;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,gCAmBtC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
interface BlockPreviewPanelProps {
|
|
5
2
|
name: string;
|
|
6
3
|
variation?: string;
|
|
7
4
|
selectedViewport?: string;
|
|
8
5
|
selectedState?: string;
|
|
9
6
|
stateStyles?: any;
|
|
7
|
+
viewportSettings?: {
|
|
8
|
+
mobile?: string;
|
|
9
|
+
tablet?: string;
|
|
10
|
+
};
|
|
10
11
|
}
|
|
11
|
-
declare const BlockPreviewPanel: ({ name, variation, selectedViewport, selectedState, stateStyles, }: BlockPreviewPanelProps) => import("react").JSX.Element | null;
|
|
12
|
+
declare const BlockPreviewPanel: ({ name, variation, selectedViewport, selectedState, stateStyles, viewportSettings, }: BlockPreviewPanelProps) => import("react").JSX.Element | null;
|
|
12
13
|
export default BlockPreviewPanel;
|
|
13
14
|
//# sourceMappingURL=block-preview-panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-preview-panel.d.ts","sourceRoot":"","sources":["../src/block-preview-panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block-preview-panel.d.ts","sourceRoot":"","sources":["../src/block-preview-panel.tsx"],"names":[],"mappings":"AAuBA,UAAU,sBAAsB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACF;AAgDD,QAAA,MAAM,iBAAiB,yFAOpB,sBAAsB,uCAoFxB,CAAC;eAEa,iBAAiB"}
|
|
@@ -5,6 +5,6 @@ interface ConfirmResetShadowDialogProps {
|
|
|
5
5
|
toggleOpen: () => void;
|
|
6
6
|
onConfirm: () => void;
|
|
7
7
|
}
|
|
8
|
-
declare function ConfirmResetShadowDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm }: ConfirmResetShadowDialogProps): import("react").JSX.Element;
|
|
8
|
+
declare function ConfirmResetShadowDialog({ text, confirmButtonText, isOpen, toggleOpen, onConfirm, }: ConfirmResetShadowDialogProps): import("react").JSX.Element;
|
|
9
9
|
export default ConfirmResetShadowDialog;
|
|
10
10
|
//# sourceMappingURL=confirm-reset-shadow-dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-reset-shadow-dialog.d.ts","sourceRoot":"","sources":["../src/confirm-reset-shadow-dialog.tsx"],"names":[],"mappings":"AAMA,UAAU,6BAA6B;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,iBAAS,wBAAwB,CAAE,EAClC,IAAI,EACJ,iBAAiB,EACjB,MAAM,EACN,UAAU,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"confirm-reset-shadow-dialog.d.ts","sourceRoot":"","sources":["../src/confirm-reset-shadow-dialog.tsx"],"names":[],"mappings":"AAMA,UAAU,6BAA6B;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,iBAAS,wBAAwB,CAAE,EAClC,IAAI,EACJ,iBAAiB,EACjB,MAAM,EACN,UAAU,EACV,SAAS,GACT,EAAE,6BAA6B,+BAsB/B;eAEc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimensions-panel.d.ts","sourceRoot":"","sources":["../src/dimensions-panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dimensions-panel.d.ts","sourceRoot":"","sources":["../src/dimensions-panel.tsx"],"names":[],"mappings":"AA6BA,MAAM,CAAC,OAAO,UAAU,eAAe,gCA0DtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CollectionFontVariantProps } from './types';
|
|
2
|
-
declare function CollectionFontVariant({ face, font, handleToggleVariant, selected }: CollectionFontVariantProps): import("react").JSX.Element;
|
|
2
|
+
declare function CollectionFontVariant({ face, font, handleToggleVariant, selected, }: CollectionFontVariantProps): import("react").JSX.Element;
|
|
3
3
|
export default CollectionFontVariant;
|
|
4
4
|
//# sourceMappingURL=collection-font-variant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-font-variant.d.ts","sourceRoot":"","sources":["../../src/font-library/collection-font-variant.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,iBAAS,qBAAqB,CAAE,EAC/B,IAAI,EACJ,IAAI,EACJ,mBAAmB,EACnB,QAAQ,
|
|
1
|
+
{"version":3,"file":"collection-font-variant.d.ts","sourceRoot":"","sources":["../../src/font-library/collection-font-variant.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,iBAAS,qBAAqB,CAAE,EAC/B,IAAI,EACJ,IAAI,EACJ,mBAAmB,EACnB,QAAQ,GACR,EAAE,0BAA0B,+BA8B5B;eAEc,qBAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FontFamily } from '@wordpress/core-data';
|
|
2
|
-
declare function FontCard({ font, onClick, variantsText, navigatorPath, shouldFocus }: {
|
|
2
|
+
declare function FontCard({ font, onClick, variantsText, navigatorPath, shouldFocus, }: {
|
|
3
3
|
font: FontFamily;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
variantsText?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-card.d.ts","sourceRoot":"","sources":["../../src/font-library/font-card.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,iBAAS,QAAQ,CAAE,EAClB,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,WAAW,
|
|
1
|
+
{"version":3,"file":"font-card.d.ts","sourceRoot":"","sources":["../../src/font-library/font-card.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAOvD,iBAAS,QAAQ,CAAE,EAClB,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,WAAW,GACX,EAAE;IACF,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,+BAqDA;eAEc,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-collection.d.ts","sourceRoot":"","sources":["../../src/font-library/font-collection.tsx"],"names":[],"mappings":"AAoEA,iBAAS,cAAc,CAAE,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+
|
|
1
|
+
{"version":3,"file":"font-collection.d.ts","sourceRoot":"","sources":["../../src/font-library/font-collection.tsx"],"names":[],"mappings":"AAoEA,iBAAS,cAAc,CAAE,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BA4flD;eAEc,cAAc"}
|
|
@@ -8,6 +8,6 @@ interface FontLibraryProps {
|
|
|
8
8
|
activeTab?: string;
|
|
9
9
|
onTabChange?: (tab: string) => void;
|
|
10
10
|
}
|
|
11
|
-
export declare function FontLibrary({ value, baseValue, onChange, activeTab }: FontLibraryProps): import("react").JSX.Element;
|
|
11
|
+
export declare function FontLibrary({ value, baseValue, onChange, activeTab, }: FontLibraryProps): import("react").JSX.Element;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=font-library.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-library.d.ts","sourceRoot":"","sources":["../../src/font-library/font-library.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAWH,UAAU,gBAAgB;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,CAAE,KAAK,EAAE,GAAG,KAAM,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,IAAI,CAAC;CACtC;AAED,wBAAgB,WAAW,CAAE,EAC5B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,SAA6B,
|
|
1
|
+
{"version":3,"file":"font-library.d.ts","sourceRoot":"","sources":["../../src/font-library/font-library.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAWH,UAAU,gBAAgB;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,CAAE,KAAK,EAAE,GAAG,KAAM,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,IAAI,CAAC;CACtC;AAED,wBAAgB,WAAW,CAAE,EAC5B,KAAK,EACL,SAAS,EACT,QAAQ,EACR,SAA6B,GAC7B,EAAE,gBAAgB,+BAsBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library-font-variant.d.ts","sourceRoot":"","sources":["../../src/font-library/library-font-variant.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASjE,iBAAS,kBAAkB,CAAE,EAC5B,IAAI,EACJ,IAAI,
|
|
1
|
+
{"version":3,"file":"library-font-variant.d.ts","sourceRoot":"","sources":["../../src/font-library/library-font-variant.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASjE,iBAAS,kBAAkB,CAAE,EAC5B,IAAI,EACJ,IAAI,GACJ,EAAE;IACF,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;CACjB,+BA2CA;eAEc,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/font-library/modal.tsx"],"names":[],"mappings":"AAyCA,iBAAS,gBAAgB,CAAE,EAC1B,cAAc,EACd,YAAgC,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/font-library/modal.tsx"],"names":[],"mappings":"AAyCA,iBAAS,gBAAgB,CAAE,EAC1B,cAAc,EACd,YAAgC,GAChC,EAAE;IACF,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,+BA8DA;eAEc,gBAAgB"}
|
|
@@ -5,6 +5,6 @@ interface ConfirmDeleteFontSizeDialogProps {
|
|
|
5
5
|
toggleOpen: () => void;
|
|
6
6
|
handleRemoveFontSize: (fontSize: FontSize) => void;
|
|
7
7
|
}
|
|
8
|
-
declare function ConfirmDeleteFontSizeDialog({ fontSize, isOpen, toggleOpen, handleRemoveFontSize }: ConfirmDeleteFontSizeDialogProps): import("react").JSX.Element;
|
|
8
|
+
declare function ConfirmDeleteFontSizeDialog({ fontSize, isOpen, toggleOpen, handleRemoveFontSize, }: ConfirmDeleteFontSizeDialogProps): import("react").JSX.Element;
|
|
9
9
|
export default ConfirmDeleteFontSizeDialog;
|
|
10
10
|
//# sourceMappingURL=confirm-delete-font-size-dialog.d.ts.map
|