@wordpress/edit-site 5.3.6 → 5.5.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 +4 -0
- package/build/components/add-new-template/new-template.js +1 -20
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -0
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +3 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +5 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/color-utils.js +1 -1
- package/build/components/global-styles/color-utils.js.map +1 -1
- package/build/components/global-styles/context-menu.js +22 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -1
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -486
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/gradients-palette-panel.js +8 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +3 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +14 -51
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -2
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +13 -6
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +7 -5
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +8 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-heading-color.js +8 -6
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +3 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +2 -3
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/subtitle.js +3 -2
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +23 -303
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +6 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-inspector/index.js +0 -29
- package/build/components/navigation-inspector/index.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +22 -5
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +9 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/start-template-options/index.js +175 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +5 -4
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +1 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -0
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +6 -6
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +5 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/color-utils.js +2 -2
- package/build-module/components/global-styles/color-utils.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +20 -6
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -1
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -479
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +3 -1
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +12 -49
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +4 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +12 -5
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +8 -6
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -7
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-heading-color.js +9 -7
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +4 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +3 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +3 -2
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +24 -300
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +5 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-inspector/index.js +0 -27
- package/build-module/components/navigation-inspector/index.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +25 -8
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +9 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +156 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +73 -4
- package/build-style/style.css +73 -4
- package/package.json +31 -31
- package/src/components/add-new-template/new-template.js +1 -16
- package/src/components/app/index.js +0 -1
- package/src/components/block-editor/editor-canvas.js +1 -0
- package/src/components/editor/index.js +2 -0
- package/src/components/global-styles/border-panel.js +6 -6
- package/src/components/global-styles/color-palette-panel.js +3 -0
- package/src/components/global-styles/color-utils.js +2 -3
- package/src/components/global-styles/context-menu.js +25 -4
- package/src/components/global-styles/custom-css.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +43 -573
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/gradients-palette-panel.js +4 -1
- package/src/components/global-styles/header.js +7 -1
- package/src/components/global-styles/hooks.js +17 -90
- package/src/components/global-styles/palette.js +1 -1
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-background-color.js +3 -2
- package/src/components/global-styles/screen-block-list.js +16 -5
- package/src/components/global-styles/screen-button-color.js +8 -6
- package/src/components/global-styles/screen-colors.js +7 -7
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-heading-color.js +9 -7
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-link-color.js +3 -2
- package/src/components/global-styles/screen-text-color.js +3 -2
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/shadow-panel.js +6 -3
- package/src/components/global-styles/style.scss +5 -0
- package/src/components/global-styles/subtitle.js +5 -2
- package/src/components/global-styles/typography-panel.js +29 -395
- package/src/components/global-styles/ui.js +5 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/navigation-inspector/index.js +0 -32
- package/src/components/navigation-inspector/navigation-menu.js +24 -6
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
- package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
- package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +7 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
- package/src/components/start-template-options/index.js +171 -0
- package/src/components/start-template-options/style.scss +76 -0
- package/src/hooks/push-changes-to-global-styles/index.js +26 -21
- package/src/store/actions.js +2 -2
- package/src/style.scss +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","ScreenLinkColor","name","variation","prefix","supports","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","pseudoStates","default","label","value","handler","userValue","hover","tabs","Object","entries","map","selector","config","title","className","tab","pseudoSelectorConfig"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEA,SAASC,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","ScreenLinkColor","name","variation","prefix","supports","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","pseudoStates","default","label","value","handler","userValue","hover","tabs","Object","entries","map","selector","config","title","className","tab","pseudoSelectorConfig"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEA,SAASC,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAG,+BAAoBH,IAApB,CAAjB;AACA,QAAM,CAAEI,sBAAF,IAA6BR,gBAAgB,CAAE,cAAF,EAAkBI,IAAlB,CAAnD;AACA,QAAMK,eAAe,GAAG,+BAAoBL,IAApB,CAAxB;AACA,QAAM,CAAEM,aAAF,IAAoBV,gBAAgB,CAAE,YAAF,EAAgBI,IAAhB,CAA1C;AAEA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AAAA,SAAS,EAAG,cAAcH,QAAU;AAH9B,KAAP;AAKA,GAPW,CAAb;AAUA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,gDADa;AAFf,IADD,EAQC,4BAAC,oBAAD;AAAU,IAAA,IAAI,EAAGJ;AAAjB,KACKQ,GAAF,IAAW;AAAA;;AACZ,UAAMC,oBAAoB,4BACzBhB,YAAY,CAAEe,GAAG,CAACzB,IAAN,CADa,yEACG,IAD7B;;AAGA,QAAK,CAAE0B,oBAAP,EAA8B;AAC7B,aAAO,IAAP;AACA;;AAED,WACC,qDACC,4BAAC,+CAAD;AACC,MAAA,SAAS,EAAC,sCADX;AAEC,MAAA,MAAM,EAAGrB,eAFV;AAGC,MAAA,mBAAmB,EAAG,CAAED,sBAHzB;AAIC,MAAA,SAAS,EAAG,KAJb;AAKC,MAAA,WAAW,MALZ;AAMC,MAAA,iCAAiC,MANlC;AAOC,MAAA,UAAU,EAAGsB,oBAAoB,CAACb,KAPnC;AAQC,MAAA,aAAa,EAAGa,oBAAoB,CAACZ,OARtC;AASC,MAAA,SAAS,EACRY,oBAAoB,CAACb,KAArB,KACAa,oBAAoB,CAACX,SAXvB;AAaC,MAAA,YAAY,EAAG;AAbhB,MADD,CADD;AAmBA,GA5BF,CARD,CADD;AAyCA;;eAEchB,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { TabPanel } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenLinkColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = useSupportedStyles( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst pseudoStates = {\n\t\tdefault: {\n\t\t\tlabel: __( 'Default' ),\n\t\t\tvalue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname\n\t\t\t)[ 0 ],\n\t\t\thandler: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname\n\t\t\t)[ 1 ],\n\t\t\tuserValue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname,\n\t\t\t\t'user'\n\t\t\t)[ 0 ],\n\t\t},\n\t\thover: {\n\t\t\tlabel: __( 'Hover' ),\n\t\t\tvalue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname\n\t\t\t)[ 0 ],\n\t\t\thandler: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname\n\t\t\t)[ 1 ],\n\t\t\tuserValue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname,\n\t\t\t\t'user'\n\t\t\t)[ 0 ],\n\t\t},\n\t};\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst tabs = Object.entries( pseudoStates ).map(\n\t\t( [ selector, config ] ) => {\n\t\t\treturn {\n\t\t\t\tname: selector,\n\t\t\t\ttitle: config.label,\n\t\t\t\tclassName: `color-text-${ selector }`,\n\t\t\t};\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the colors used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<TabPanel tabs={ tabs }>\n\t\t\t\t{ ( tab ) => {\n\t\t\t\t\tconst pseudoSelectorConfig =\n\t\t\t\t\t\tpseudoStates[ tab.name ] ?? null;\n\n\t\t\t\t\tif ( ! pseudoSelectorConfig ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\t\t\tclassName=\"edit-site-screen-link-color__control\"\n\t\t\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tcolorValue={ pseudoSelectorConfig.value }\n\t\t\t\t\t\t\t\tonColorChange={ pseudoSelectorConfig.handler }\n\t\t\t\t\t\t\t\tclearable={\n\t\t\t\t\t\t\t\t\tpseudoSelectorConfig.value ===\n\t\t\t\t\t\t\t\t\tpseudoSelectorConfig.userValue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\theadingLevel={ 3 }\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</TabPanel>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
|
|
@@ -37,7 +37,7 @@ function ScreenTextColor(_ref) {
|
|
|
37
37
|
variation = ''
|
|
38
38
|
} = _ref;
|
|
39
39
|
const prefix = variation ? `variations.${variation}.` : '';
|
|
40
|
-
const supports = (0, _hooks.
|
|
40
|
+
const supports = (0, _hooks.useSupportedStyles)(name);
|
|
41
41
|
const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
|
|
42
42
|
const [isTextEnabled] = useGlobalSetting('color.text', name);
|
|
43
43
|
const colorsPerOrigin = (0, _hooks.useColorsPerOrigin)(name);
|
|
@@ -61,7 +61,8 @@ function ScreenTextColor(_ref) {
|
|
|
61
61
|
__experimentalIsRenderedInSidebar: true,
|
|
62
62
|
colorValue: color,
|
|
63
63
|
onColorChange: setColor,
|
|
64
|
-
clearable: color === userColor
|
|
64
|
+
clearable: color === userColor,
|
|
65
|
+
headingLevel: 3
|
|
65
66
|
}));
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","ScreenTextColor","name","variation","prefix","supports","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAQA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEA,SAASC,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","ScreenTextColor","name","variation","prefix","supports","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAQA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKA,MAAM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APd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE,SATvB;AAUC,IAAA,YAAY,EAAG;AAVhB,IAPD,CADD;AAsBA;;eAEcb,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenTextColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = useSupportedStyles( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useGlobalSetting( 'color.text', name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );\n\tconst [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t\theadingLevel={ 3 }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
|
|
@@ -102,7 +102,9 @@ function ScreenTypography(_ref2) {
|
|
|
102
102
|
className: "edit-site-global-styles-screen-typography"
|
|
103
103
|
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
104
104
|
spacing: 3
|
|
105
|
-
}, (0, _element.createElement)(_subtitle.default,
|
|
105
|
+
}, (0, _element.createElement)(_subtitle.default, {
|
|
106
|
+
level: 3
|
|
107
|
+
}, (0, _i18n.__)('Elements')), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
106
108
|
isBordered: true,
|
|
107
109
|
isSeparated: true
|
|
108
110
|
}, (0, _element.createElement)(Item, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["useGlobalStyle","blockEditorPrivateApis","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variation","undefined","variationClassName"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAUA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;;AAEA,SAASC,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC,EAAlC,GAAwC,YAA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A,aAAF,cAAEA,aAAF,GAAmBD,eAFtB;AAGPE,MAAAA,KAHO;AAIPL,MAAAA,SAJO;AAKPC,MAAAA,UALO;AAMPC,MAAAA,aANO;AAOP,SAAGL;AAPI;AAFT,KAYG,cAAI,IAAJ,CAZH,CADD,EAeC,4BAAC,oBAAD,QAAYH,KAAZ,CAfD,CAJD,CADD;AAwBA;;AAED,SAASc,gBAAT,QAAsD;AAAA,MAA3B;AAAEjB,IAAAA,IAAF;AAAQkB,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACrD,QAAMjB,UAAU,GAAGD,IAAI,KAAKmB,SAAT,GAAqB,EAArB,GAA0B,aAAanB,IAA1D;AACA,QAAMoB,kBAAkB,GAAG,kCAAuBF,SAAvB,CAA3B;AACA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,wDADa;AAFf,IADD,EAQC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGlB,IAA1B;AAAiC,IAAA,SAAS,EAAGoB;AAA7C,IARD,EAUG,CAAEpB,IAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,iBAAD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["useGlobalStyle","blockEditorPrivateApis","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variation","undefined","variationClassName"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAUA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;;AAEA,SAASC,IAAT,OAAsD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AA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,MAHT;AAIC,IAAA,KAAK,EAAG,cAAI,MAAJ;AAJT,IADD,EAOC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,MAHT;AAIC,IAAA,KAAK,EAAG,cAAI,OAAJ;AAJT,IAPD,EAaC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,SAHT;AAIC,IAAA,KAAK,EAAG,cAAI,UAAJ;AAJT,IAbD,EAmBC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,QAHT;AAIC,IAAA,KAAK,EAAG,cAAI,SAAJ;AAJT,IAnBD,CAFD,CADD,CAXF,EA4CG,CAAC,CAAED,IAAH,IACD,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,SAAS,EAAGkB,SAFb;AAGC,IAAA,OAAO,EAAC;AAHT,IA7CF,CADD;AAsDA;;eAEcD,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport Subtitle from './subtitle';\nimport TypographyPanel from './typography-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction Item( { name, parentMenu, element, label } ) {\n\tconst hasSupport = ! name;\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useGlobalStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ letterSpacing ] = useGlobalStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname\n\t);\n\tconst [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useGlobalStyle( prefix + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.\n\t\t__( 'Typography %s styles' ),\n\t\tlabel\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/typography/' + element }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenTypography( { name, variation = '' } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst variationClassName = getVariationClassName( variation );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t{ ! name && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Links' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"heading\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Headings' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"button\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Buttons' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ /* No typography elements support yet for blocks. */ }\n\t\t\t{ !! name && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariation={ variation }\n\t\t\t\t\telement=\"text\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
|
|
@@ -43,7 +43,7 @@ const {
|
|
|
43
43
|
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
44
44
|
|
|
45
45
|
function useHasShadowControl(name) {
|
|
46
|
-
const supports = (0, _hooks.
|
|
46
|
+
const supports = (0, _hooks.useSupportedStyles)(name);
|
|
47
47
|
return supports.includes('shadow');
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -58,8 +58,7 @@ function ShadowPanel(_ref) {
|
|
|
58
58
|
|
|
59
59
|
const hasShadow = () => !!userShadow;
|
|
60
60
|
|
|
61
|
-
const resetShadow = () => setShadow(undefined);
|
|
62
|
-
|
|
61
|
+
const resetShadow = (0, _element.useCallback)(() => setShadow(undefined), [setShadow]);
|
|
63
62
|
const resetAll = (0, _element.useCallback)(() => resetShadow(undefined), [resetShadow]);
|
|
64
63
|
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
65
64
|
label: (0, _i18n.__)('Shadow'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/shadow-panel.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","useHasShadowControl","name","supports","includes","ShadowPanel","variation","prefix","shadow","setShadow","userShadow","hasShadow","resetShadow","undefined","resetAll","ShadowPopover","onShadowChange","popoverProps","placement","offset","shift","renderShadowToggle","onToggle","isOpen","toggleProps","onClick","className","shadowIcon","ShadowPopoverContainer","defaultShadows","themeShadows","defaultPresetsEnabled","shadows","ShadowPresets","presets","activeShadow","onSelect","map","slug","ShadowIndicator","label","isActive","boxShadow","check"],"mappings":";;;;;;;;;;AAuBA;;AApBA;;AAKA;;AAaA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEO,SAASC,mBAAT,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMC,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/shadow-panel.js"],"names":["useGlobalSetting","useGlobalStyle","blockEditorPrivateApis","useHasShadowControl","name","supports","includes","ShadowPanel","variation","prefix","shadow","setShadow","userShadow","hasShadow","resetShadow","undefined","resetAll","ShadowPopover","onShadowChange","popoverProps","placement","offset","shift","renderShadowToggle","onToggle","isOpen","toggleProps","onClick","className","shadowIcon","ShadowPopoverContainer","defaultShadows","themeShadows","defaultPresetsEnabled","shadows","ShadowPresets","presets","activeShadow","onSelect","map","slug","ShadowIndicator","label","isActive","boxShadow","check"],"mappings":";;;;;;;;;;AAuBA;;AApBA;;AAKA;;AAaA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuC,yBAAQC,wBAAR,CAA7C;;AAEO,SAASC,mBAAT,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMC,QAAQ,GAAG,+BAAoBD,IAApB,CAAjB;AACA,SAAOC,QAAQ,CAACC,QAAT,CAAmB,QAAnB,CAAP;AACA;;AAEc,SAASC,WAAT,OAAiD;AAAA,MAA3B;AAAEH,IAAAA,IAAF;AAAQI,IAAAA,SAAS,GAAG;AAApB,GAA2B;AAC/D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,EAAC,2CADX;AAEC,IAAA,OAAO,EAAG4B,QAFX;AAGC,IAAA,KAAK,EAAGI,KAHT;AAIC,IAAA,KAAK,EAAG;AAAEE,MAAAA,SAAS,EAAElC;AAAb,KAJT;AAKC,IAAA,WAAW;AALZ,KAOGiC,QAAQ,IAAI,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGE;AAAb,IAPf,CADD,CADD;AAaA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalGrid as Grid,\n\t__experimentalHeading as Heading,\n\tFlexItem,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from './hooks';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nexport function useHasShadowControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn supports.includes( 'shadow' );\n}\n\nexport default function ShadowPanel( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst [ shadow, setShadow ] = useGlobalStyle( `${ prefix }shadow`, name );\n\tconst [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' );\n\tconst hasShadow = () => !! userShadow;\n\n\tconst resetShadow = useCallback(\n\t\t() => setShadow( undefined ),\n\t\t[ setShadow ]\n\t);\n\tconst resetAll = useCallback(\n\t\t() => resetShadow( undefined ),\n\t\t[ resetShadow ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Shadow' ) } resetAll={ resetAll }>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\thasValue={ hasShadow }\n\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t/>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nconst ShadowPopover = ( { shadow, onShadowChange } ) => {\n\tconst popoverProps = {\n\t\tplacement: 'left-start',\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"edit-site-global-styles__shadow-dropdown\"\n\t\t\trenderToggle={ renderShadowToggle() }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t<ShadowPopoverContainer\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ onShadowChange }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n};\n\nfunction renderShadowToggle() {\n\treturn ( { onToggle, isOpen } ) => {\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ shadowIcon } size={ 24 } />\n\t\t\t\t\t<FlexItem className=\"edit-site-global-styles__shadow-label\">\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t);\n\t};\n}\n\nfunction ShadowPopoverContainer( { shadow, onShadowChange } ) {\n\tconst [ defaultShadows ] = useGlobalSetting( 'shadow.presets.default' );\n\tconst [ themeShadows ] = useGlobalSetting( 'shadow.presets.theme' );\n\tconst [ defaultPresetsEnabled ] = useGlobalSetting(\n\t\t'shadow.defaultPresets'\n\t);\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...( themeShadows || [] ),\n\t];\n\n\treturn (\n\t\t<div className=\"edit-site-global-styles__shadow-panel\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<Heading level={ 5 }>{ __( 'Shadow' ) }</Heading>\n\t\t\t\t<ShadowPresets\n\t\t\t\t\tpresets={ shadows }\n\t\t\t\t\tactiveShadow={ shadow }\n\t\t\t\t\tonSelect={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction ShadowPresets( { presets, activeShadow, onSelect } ) {\n\treturn ! presets ? null : (\n\t\t<Grid columns={ 6 } gap={ 0 } align=\"center\" justify=\"center\">\n\t\t\t{ presets.map( ( { name, slug, shadow } ) => (\n\t\t\t\t<ShadowIndicator\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tlabel={ name }\n\t\t\t\t\tisActive={ shadow === activeShadow }\n\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\tonSelect( shadow === activeShadow ? undefined : shadow )\n\t\t\t\t\t}\n\t\t\t\t\tshadow={ shadow }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n\nfunction ShadowIndicator( { label, isActive, onSelect, shadow } ) {\n\treturn (\n\t\t<div className=\"edit-site-global-styles__shadow-indicator-wrapper\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-global-styles__shadow-indicator\"\n\t\t\t\tonClick={ onSelect }\n\t\t\t\tlabel={ label }\n\t\t\t\tstyle={ { boxShadow: shadow } }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ isActive && <Icon icon={ check } /> }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -14,11 +14,12 @@ var _components = require("@wordpress/components");
|
|
|
14
14
|
*/
|
|
15
15
|
function Subtitle(_ref) {
|
|
16
16
|
let {
|
|
17
|
-
children
|
|
17
|
+
children,
|
|
18
|
+
level
|
|
18
19
|
} = _ref;
|
|
19
20
|
return (0, _element.createElement)(_components.__experimentalHeading, {
|
|
20
21
|
className: "edit-site-global-styles-subtitle",
|
|
21
|
-
level: 2
|
|
22
|
+
level: level !== null && level !== void 0 ? level : 2
|
|
22
23
|
}, children);
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/subtitle.js"],"names":["Subtitle","children"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,QAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/subtitle.js"],"names":["Subtitle","children","level"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,QAAT,OAAyC;AAAA,MAAtB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAsB;AACxC,SACC,4BAAC,iCAAD;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,IAAA,KAAK,EAAGA,KAAH,aAAGA,KAAH,cAAGA,KAAH,GAAY;AAFlB,KAIGD,QAJH,CADD;AAQA;;eAEcD,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\nfunction Subtitle( { children, level } ) {\n\treturn (\n\t\t<Heading\n\t\t\tclassName=\"edit-site-global-styles-subtitle\"\n\t\t\tlevel={ level ?? 2 }\n\t\t>\n\t\t\t{ children }\n\t\t</Heading>\n\t);\n}\n\nexport default Subtitle;\n"]}
|
|
@@ -4,18 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = TypographyPanel;
|
|
7
|
-
exports.useHasTypographyPanel = useHasTypographyPanel;
|
|
8
7
|
|
|
9
8
|
var _element = require("@wordpress/element");
|
|
10
9
|
|
|
11
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
11
|
|
|
13
|
-
var _components = require("@wordpress/components");
|
|
14
|
-
|
|
15
|
-
var _i18n = require("@wordpress/i18n");
|
|
16
|
-
|
|
17
|
-
var _hooks = require("./hooks");
|
|
18
|
-
|
|
19
12
|
var _privateApis = require("../../private-apis");
|
|
20
13
|
|
|
21
14
|
/**
|
|
@@ -26,149 +19,12 @@ var _privateApis = require("../../private-apis");
|
|
|
26
19
|
* Internal dependencies
|
|
27
20
|
*/
|
|
28
21
|
const {
|
|
22
|
+
useGlobalStyle,
|
|
29
23
|
useGlobalSetting,
|
|
30
|
-
|
|
24
|
+
useSettingsForBlockElement,
|
|
25
|
+
TypographyPanel: StylesTypographyPanel
|
|
31
26
|
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
32
27
|
|
|
33
|
-
function useHasTypographyPanel(name) {
|
|
34
|
-
const hasFontFamily = useHasFontFamilyControl(name);
|
|
35
|
-
const hasLineHeight = useHasLineHeightControl(name);
|
|
36
|
-
const hasFontAppearance = useHasAppearanceControl(name);
|
|
37
|
-
const hasLetterSpacing = useHasLetterSpacingControl(name);
|
|
38
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
39
|
-
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function useHasFontFamilyControl(name) {
|
|
43
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
44
|
-
const [fontFamiliesPerOrigin] = useGlobalSetting('typography.fontFamilies', name);
|
|
45
|
-
const fontFamilies = (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default);
|
|
46
|
-
return supports.includes('fontFamily') && !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function useHasLineHeightControl(name) {
|
|
50
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
51
|
-
return useGlobalSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function useHasAppearanceControl(name) {
|
|
55
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
56
|
-
const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
57
|
-
const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
58
|
-
return hasFontStyles || hasFontWeights;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function useAppearanceControlLabel(name) {
|
|
62
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
63
|
-
const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
|
|
64
|
-
const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
|
|
65
|
-
|
|
66
|
-
if (!hasFontStyles) {
|
|
67
|
-
return (0, _i18n.__)('Font weight');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!hasFontWeights) {
|
|
71
|
-
return (0, _i18n.__)('Font style');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (0, _i18n.__)('Appearance');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function useHasLetterSpacingControl(name, element) {
|
|
78
|
-
const setting = useGlobalSetting('typography.letterSpacing', name)[0];
|
|
79
|
-
|
|
80
|
-
if (!setting) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!name && element === 'heading') {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
89
|
-
return supports.includes('letterSpacing');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function useHasTextTransformControl(name, element) {
|
|
93
|
-
const setting = useGlobalSetting('typography.textTransform', name)[0];
|
|
94
|
-
|
|
95
|
-
if (!setting) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (!name && element === 'heading') {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const supports = (0, _hooks.getSupportedGlobalStylesPanels)(name);
|
|
104
|
-
return supports.includes('textTransform');
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function useHasTextDecorationControl(name, element) {
|
|
108
|
-
// This is an exception for link elements.
|
|
109
|
-
// We shouldn't allow other blocks or elements to set textDecoration
|
|
110
|
-
// because this will be inherited by their children.
|
|
111
|
-
return !name && element === 'link';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function useStyleWithReset(path, blockName) {
|
|
115
|
-
const [style, setStyle] = useGlobalStyle(path, blockName);
|
|
116
|
-
const [userStyle] = useGlobalStyle(path, blockName, 'user');
|
|
117
|
-
|
|
118
|
-
const hasStyle = () => !!userStyle;
|
|
119
|
-
|
|
120
|
-
const resetStyle = () => setStyle(undefined);
|
|
121
|
-
|
|
122
|
-
return [style, setStyle, hasStyle, resetStyle];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function useFontSizeWithReset(path, blockName) {
|
|
126
|
-
const [fontSize, setStyleCallback] = useGlobalStyle(path, blockName);
|
|
127
|
-
const [userStyle] = useGlobalStyle(path, blockName, 'user');
|
|
128
|
-
|
|
129
|
-
const hasFontSize = () => !!userStyle;
|
|
130
|
-
|
|
131
|
-
const resetFontSize = () => setStyleCallback(undefined);
|
|
132
|
-
|
|
133
|
-
const setFontSize = (newValue, metadata) => {
|
|
134
|
-
if (!!(metadata !== null && metadata !== void 0 && metadata.slug)) {
|
|
135
|
-
newValue = `var:preset|font-size|${metadata === null || metadata === void 0 ? void 0 : metadata.slug}`;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
setStyleCallback(newValue);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
fontSize,
|
|
143
|
-
setFontSize,
|
|
144
|
-
hasFontSize,
|
|
145
|
-
resetFontSize
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function useFontAppearance(prefix, name) {
|
|
150
|
-
const [fontStyle, setFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name);
|
|
151
|
-
const [userFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name, 'user');
|
|
152
|
-
const [fontWeight, setFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name);
|
|
153
|
-
const [userFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name, 'user');
|
|
154
|
-
|
|
155
|
-
const hasFontAppearance = () => !!userFontStyle || !!userFontWeight;
|
|
156
|
-
|
|
157
|
-
const resetFontAppearance = () => {
|
|
158
|
-
setFontStyle(undefined);
|
|
159
|
-
setFontWeight(undefined);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
fontStyle,
|
|
164
|
-
setFontStyle,
|
|
165
|
-
fontWeight,
|
|
166
|
-
setFontWeight,
|
|
167
|
-
hasFontAppearance,
|
|
168
|
-
resetFontAppearance
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
28
|
function TypographyPanel(_ref) {
|
|
173
29
|
let {
|
|
174
30
|
name,
|
|
@@ -176,167 +32,31 @@ function TypographyPanel(_ref) {
|
|
|
176
32
|
headingLevel,
|
|
177
33
|
variation = ''
|
|
178
34
|
} = _ref;
|
|
179
|
-
|
|
180
|
-
let prefix = '';
|
|
35
|
+
let prefixParts = [];
|
|
181
36
|
|
|
182
37
|
if (element === 'heading') {
|
|
183
|
-
|
|
38
|
+
prefixParts = prefixParts.concat(['elements', headingLevel]);
|
|
184
39
|
} else if (element && element !== 'text') {
|
|
185
|
-
|
|
40
|
+
prefixParts = prefixParts.concat(['elements', element]);
|
|
186
41
|
}
|
|
187
42
|
|
|
188
43
|
if (variation) {
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
/* Disable font size controls when the option to style all headings is selected. */
|
|
207
|
-
|
|
208
|
-
let hasFontSizeEnabled = supports.includes('fontSize');
|
|
209
|
-
|
|
210
|
-
if (element === 'heading' && headingLevel === 'heading') {
|
|
211
|
-
hasFontSizeEnabled = false;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(prefix + 'typography.fontFamily', name);
|
|
215
|
-
const {
|
|
216
|
-
fontSize,
|
|
217
|
-
setFontSize,
|
|
218
|
-
hasFontSize,
|
|
219
|
-
resetFontSize
|
|
220
|
-
} = useFontSizeWithReset(prefix + 'typography.fontSize', name);
|
|
221
|
-
const {
|
|
222
|
-
fontStyle,
|
|
223
|
-
setFontStyle,
|
|
224
|
-
fontWeight,
|
|
225
|
-
setFontWeight,
|
|
226
|
-
hasFontAppearance,
|
|
227
|
-
resetFontAppearance
|
|
228
|
-
} = useFontAppearance(prefix, name);
|
|
229
|
-
const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(prefix + 'typography.lineHeight', name);
|
|
230
|
-
const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(prefix + 'typography.letterSpacing', name);
|
|
231
|
-
const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(prefix + 'typography.textTransform', name);
|
|
232
|
-
const [textDecoration, setTextDecoration, hasTextDecoration, resetTextDecoration] = useStyleWithReset(prefix + 'typography.textDecoration', name);
|
|
233
|
-
|
|
234
|
-
const resetAll = () => {
|
|
235
|
-
resetFontFamily();
|
|
236
|
-
resetFontSize();
|
|
237
|
-
resetFontAppearance();
|
|
238
|
-
resetLineHeight();
|
|
239
|
-
resetLetterSpacing();
|
|
240
|
-
resetTextTransform();
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
244
|
-
label: (0, _i18n.__)('Typography'),
|
|
245
|
-
resetAll: resetAll
|
|
246
|
-
}, hasFontFamilyEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
247
|
-
label: (0, _i18n.__)('Font family'),
|
|
248
|
-
hasValue: hasFontFamily,
|
|
249
|
-
onDeselect: resetFontFamily,
|
|
250
|
-
isShownByDefault: true
|
|
251
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalFontFamilyControl, {
|
|
252
|
-
fontFamilies: fontFamilies,
|
|
253
|
-
value: fontFamily,
|
|
254
|
-
onChange: setFontFamily,
|
|
255
|
-
size: "__unstable-large",
|
|
256
|
-
__nextHasNoMarginBottom: true
|
|
257
|
-
})), hasFontSizeEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
258
|
-
label: (0, _i18n.__)('Font size'),
|
|
259
|
-
hasValue: hasFontSize,
|
|
260
|
-
onDeselect: resetFontSize,
|
|
261
|
-
isShownByDefault: true
|
|
262
|
-
}, (0, _element.createElement)(_components.FontSizePicker, {
|
|
263
|
-
value: fontSize,
|
|
264
|
-
onChange: setFontSize,
|
|
265
|
-
fontSizes: fontSizes,
|
|
266
|
-
disableCustomFontSizes: disableCustomFontSizes,
|
|
267
|
-
withReset: false,
|
|
268
|
-
withSlider: true,
|
|
269
|
-
size: "__unstable-large",
|
|
270
|
-
__nextHasNoMarginBottom: true
|
|
271
|
-
})), hasAppearanceControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
272
|
-
className: "single-column",
|
|
273
|
-
label: appearanceControlLabel,
|
|
274
|
-
hasValue: hasFontAppearance,
|
|
275
|
-
onDeselect: resetFontAppearance,
|
|
276
|
-
isShownByDefault: true
|
|
277
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalFontAppearanceControl, {
|
|
278
|
-
value: {
|
|
279
|
-
fontStyle,
|
|
280
|
-
fontWeight
|
|
281
|
-
},
|
|
282
|
-
onChange: _ref2 => {
|
|
283
|
-
let {
|
|
284
|
-
fontStyle: newFontStyle,
|
|
285
|
-
fontWeight: newFontWeight
|
|
286
|
-
} = _ref2;
|
|
287
|
-
setFontStyle(newFontStyle);
|
|
288
|
-
setFontWeight(newFontWeight);
|
|
289
|
-
},
|
|
290
|
-
hasFontStyles: hasFontStyles,
|
|
291
|
-
hasFontWeights: hasFontWeights,
|
|
292
|
-
size: "__unstable-large",
|
|
293
|
-
__nextHasNoMarginBottom: true
|
|
294
|
-
})), hasLineHeightEnabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
295
|
-
className: "single-column",
|
|
296
|
-
label: (0, _i18n.__)('Line height'),
|
|
297
|
-
hasValue: hasLineHeight,
|
|
298
|
-
onDeselect: resetLineHeight,
|
|
299
|
-
isShownByDefault: true
|
|
300
|
-
}, (0, _element.createElement)(_blockEditor.LineHeightControl, {
|
|
301
|
-
__nextHasNoMarginBottom: true,
|
|
302
|
-
__unstableInputWidth: "auto",
|
|
303
|
-
value: lineHeight,
|
|
304
|
-
onChange: setLineHeight,
|
|
305
|
-
size: "__unstable-large"
|
|
306
|
-
})), hasLetterSpacingControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
307
|
-
className: "single-column",
|
|
308
|
-
label: (0, _i18n.__)('Letter spacing'),
|
|
309
|
-
hasValue: hasLetterSpacing,
|
|
310
|
-
onDeselect: resetLetterSpacing,
|
|
311
|
-
isShownByDefault: true
|
|
312
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalLetterSpacingControl, {
|
|
313
|
-
value: letterSpacing,
|
|
314
|
-
onChange: setLetterSpacing,
|
|
315
|
-
size: "__unstable-large",
|
|
316
|
-
__unstableInputWidth: "auto"
|
|
317
|
-
})), hasTextTransformControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
318
|
-
label: (0, _i18n.__)('Letter case'),
|
|
319
|
-
hasValue: hasTextTransform,
|
|
320
|
-
onDeselect: resetTextTransform,
|
|
321
|
-
isShownByDefault: true
|
|
322
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalTextTransformControl, {
|
|
323
|
-
value: textTransform,
|
|
324
|
-
onChange: setTextTransform,
|
|
325
|
-
showNone: true,
|
|
326
|
-
isBlock: true,
|
|
327
|
-
size: "__unstable-large",
|
|
328
|
-
__nextHasNoMarginBottom: true
|
|
329
|
-
})), hasTextDecorationControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
330
|
-
className: "single-column",
|
|
331
|
-
label: (0, _i18n.__)('Text decoration'),
|
|
332
|
-
hasValue: hasTextDecoration,
|
|
333
|
-
onDeselect: resetTextDecoration,
|
|
334
|
-
isShownByDefault: true
|
|
335
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalTextDecorationControl, {
|
|
336
|
-
value: textDecoration,
|
|
337
|
-
onChange: setTextDecoration,
|
|
338
|
-
size: "__unstable-large",
|
|
339
|
-
__unstableInputWidth: "auto"
|
|
340
|
-
})));
|
|
44
|
+
prefixParts = ['variations', variation].concat(prefixParts);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const prefix = prefixParts.join('.');
|
|
48
|
+
const [style] = useGlobalStyle(prefix, name, 'user', false);
|
|
49
|
+
const [inheritedStyle, setStyle] = useGlobalStyle(prefix, name, 'all', {
|
|
50
|
+
shouldDecodeEncode: false
|
|
51
|
+
});
|
|
52
|
+
const [rawSettings] = useGlobalSetting('', name);
|
|
53
|
+
const usedElement = element === 'heading' ? headingLevel : element;
|
|
54
|
+
const settings = useSettingsForBlockElement(rawSettings, name, usedElement);
|
|
55
|
+
return (0, _element.createElement)(StylesTypographyPanel, {
|
|
56
|
+
inheritedValue: inheritedStyle,
|
|
57
|
+
value: style,
|
|
58
|
+
onChange: setStyle,
|
|
59
|
+
settings: settings
|
|
60
|
+
});
|
|
341
61
|
}
|
|
342
62
|
//# sourceMappingURL=typography-panel.js.map
|