@wordpress/edit-site 4.0.1 → 4.0.2

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.
Files changed (81) hide show
  1. package/build/components/add-new-template/new-template-part.js +4 -1
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/error-boundary/index.js +11 -27
  4. package/build/components/error-boundary/index.js.map +1 -1
  5. package/build/components/error-boundary/warning.js +70 -0
  6. package/build/components/error-boundary/warning.js.map +1 -0
  7. package/build/components/global-styles/navigation-button.js +7 -27
  8. package/build/components/global-styles/navigation-button.js.map +1 -1
  9. package/build/components/global-styles/typography-panel.js +5 -2
  10. package/build/components/global-styles/typography-panel.js.map +1 -1
  11. package/build/components/global-styles/use-global-styles-output.js +21 -4
  12. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  13. package/build/components/list/table.js +3 -1
  14. package/build/components/list/table.js.map +1 -1
  15. package/build/components/navigation-sidebar/navigation-toggle/index.js +15 -4
  16. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  17. package/build/components/routes/redirect-to-homepage.js +22 -3
  18. package/build/components/routes/redirect-to-homepage.js.map +1 -1
  19. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -11
  20. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  21. package/build/components/template-part-converter/convert-to-template-part.js +4 -1
  22. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  23. package/build/index.js +15 -1
  24. package/build/index.js.map +1 -1
  25. package/build/store/actions.js +191 -155
  26. package/build/store/actions.js.map +1 -1
  27. package/build/store/index.js +0 -3
  28. package/build/store/index.js.map +1 -1
  29. package/build/store/selectors.js +3 -2
  30. package/build/store/selectors.js.map +1 -1
  31. package/build-module/components/add-new-template/new-template-part.js +4 -1
  32. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  33. package/build-module/components/error-boundary/index.js +9 -26
  34. package/build-module/components/error-boundary/index.js.map +1 -1
  35. package/build-module/components/error-boundary/warning.js +60 -0
  36. package/build-module/components/error-boundary/warning.js.map +1 -0
  37. package/build-module/components/global-styles/navigation-button.js +8 -28
  38. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  39. package/build-module/components/global-styles/typography-panel.js +6 -3
  40. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  41. package/build-module/components/global-styles/use-global-styles-output.js +20 -4
  42. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  43. package/build-module/components/list/table.js +2 -1
  44. package/build-module/components/list/table.js.map +1 -1
  45. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +12 -4
  46. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  47. package/build-module/components/routes/redirect-to-homepage.js +22 -3
  48. package/build-module/components/routes/redirect-to-homepage.js.map +1 -1
  49. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -12
  50. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  51. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
  52. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  53. package/build-module/index.js +13 -1
  54. package/build-module/index.js.map +1 -1
  55. package/build-module/store/actions.js +170 -145
  56. package/build-module/store/actions.js.map +1 -1
  57. package/build-module/store/index.js +0 -2
  58. package/build-module/store/index.js.map +1 -1
  59. package/build-module/store/selectors.js +3 -2
  60. package/build-module/store/selectors.js.map +1 -1
  61. package/build-style/style-rtl.css +11 -10
  62. package/build-style/style.css +11 -10
  63. package/package.json +18 -18
  64. package/src/components/add-new-template/new-template-part.js +7 -1
  65. package/src/components/error-boundary/index.js +11 -28
  66. package/src/components/error-boundary/warning.js +59 -0
  67. package/src/components/global-styles/navigation-button.js +6 -25
  68. package/src/components/global-styles/typography-panel.js +12 -5
  69. package/src/components/global-styles/use-global-styles-output.js +19 -3
  70. package/src/components/list/table.js +5 -2
  71. package/src/components/navigation-sidebar/navigation-toggle/index.js +13 -4
  72. package/src/components/navigation-sidebar/navigation-toggle/style.scss +32 -31
  73. package/src/components/routes/redirect-to-homepage.js +27 -4
  74. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -11
  75. package/src/components/template-part-converter/convert-to-template-part.js +6 -1
  76. package/src/index.js +17 -1
  77. package/src/store/actions.js +161 -205
  78. package/src/store/index.js +0 -2
  79. package/src/store/selectors.js +3 -0
  80. package/src/store/test/actions.js +186 -92
  81. package/src/store/test/selectors.js +8 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["get","map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","uploadMedia","isTemplatePart","Platform","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","getEditedPostType","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId","getEditorMode","editorMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,EAAmBC,KAAnB,QAAgC,QAAhC;AACA,OAAOC,cAAP,MAA2B,QA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,CAA9D;AAoCP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,aAAT,CAAwB3E,KAAxB,EAAgC;AACtC,SAAOA,KAAK,CAACE,WAAN,CAAkB0E,UAAlB,IAAgC,QAAvC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t\tgetReusableBlocks( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select(\n\t\t\tcoreDataStore\n\t\t).getEntityRecords( 'postType', 'wp_template_part', { per_page: -1 } );\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn state.preferences.editorMode || 'visual';\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["get","map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","uploadMedia","isTemplatePart","Platform","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId","getEditorMode","editorMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,EAAmBC,KAAnB,QAAgC,QAAhC;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,qBAHD,EAICC,wBAJD,QAKO,6DALP;AAMA,SACCC,mBADD,EAECC,oBAFD,QAGO,sEAHP;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA2C;AACjD,SAAOlB,GAAG,CAAEiB,KAAK,CAACE,WAAN,CAAkBC,QAApB,EAA8B,CAAEF,OAAF,CAA9B,EAA2C,KAA3C,CAAV;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,kCAAT,CAA6CJ,KAA7C,EAAqD;AAC3D,SAAOA,KAAK,CAACK,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAGjB,sBAAsB,CAAIkB,MAAF,IAAc,MAC1EA,MAAM,CAAEnB,aAAF,CAAN,CAAwBoB,OAAxB,CAAiC,QAAjC,EAA2C,OAA3C,CAD0D,CAApD;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAAGpB,sBAAsB,CAAIkB,MAAF,IAAc,MAAM;AAC5E,QAAMG,KAAK,GAAGlB,QAAQ,CAACmB,EAAT,KAAgB,KAA9B;AACA,S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Ac,GAAI,GAAGD,KAAO,KAAKnB,IAAM,EAA7C;AACA,UAAMc,YAAY,GAAGD,iBAAiB,CAAEO,cAAF,CAAtC;AAEA,WAAO;AACNN,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAjCmE,CAA9D;AAoCP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,aAAT,CAAwB5E,KAAxB,EAAgC;AACtC,SAAOA,KAAK,CAACE,WAAN,CAAkB2E,UAAlB,IAAgC,QAAvC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select(\n\t\t\tcoreDataStore\n\t\t).getEntityRecords( 'postType', 'wp_template_part', { per_page: -1 } );\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn state.preferences.editorMode || 'visual';\n}\n"]}
@@ -954,7 +954,7 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
954
954
  width: 60px;
955
955
  }
956
956
 
957
- .edit-site-navigation-toggle__button {
957
+ .edit-site-navigation-toggle__button.components-button {
958
958
  align-items: center;
959
959
  background: #1e1e1e;
960
960
  border-radius: 0;
@@ -963,17 +963,15 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
963
963
  width: 60px;
964
964
  z-index: 1;
965
965
  margin-bottom: -1px;
966
- }
967
- .edit-site-navigation-toggle__button.has-icon {
968
966
  min-width: 60px;
969
967
  }
970
- .edit-site-navigation-toggle__button.has-icon:hover, .edit-site-navigation-toggle__button.has-icon:active {
968
+ .edit-site-navigation-toggle__button.components-button:hover, .edit-site-navigation-toggle__button.components-button:active {
971
969
  color: #fff;
972
970
  }
973
- .edit-site-navigation-toggle__button.has-icon:focus {
971
+ .edit-site-navigation-toggle__button.components-button:focus {
974
972
  box-shadow: none;
975
973
  }
976
- .edit-site-navigation-toggle__button.has-icon::before {
974
+ .edit-site-navigation-toggle__button.components-button::before {
977
975
  transition: box-shadow 0.1s ease;
978
976
  content: "";
979
977
  display: block;
@@ -986,18 +984,21 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
986
984
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e;
987
985
  }
988
986
  @media (prefers-reduced-motion: reduce) {
989
- .edit-site-navigation-toggle__button.has-icon::before {
987
+ .edit-site-navigation-toggle__button.components-button::before {
990
988
  transition-duration: 0s;
991
989
  transition-delay: 0s;
992
990
  }
993
991
  }
994
- .edit-site-navigation-toggle__button.has-icon:hover::before {
992
+ .edit-site-navigation-toggle__button.components-button:hover::before {
995
993
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575;
996
994
  }
997
- .edit-site-navigation-toggle__button.has-icon:focus::before {
995
+ .edit-site-navigation-toggle__button.components-button.has-icon:hover::before {
996
+ box-shadow: none;
997
+ }
998
+ .edit-site-navigation-toggle__button.components-button:focus::before {
998
999
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
999
1000
  }
1000
- .edit-site-navigation-toggle__button .edit-site-navigation-toggle__site-icon {
1001
+ .edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon {
1001
1002
  width: 36px;
1002
1003
  height: 36px;
1003
1004
  border-radius: 2px;
@@ -954,7 +954,7 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
954
954
  width: 60px;
955
955
  }
956
956
 
957
- .edit-site-navigation-toggle__button {
957
+ .edit-site-navigation-toggle__button.components-button {
958
958
  align-items: center;
959
959
  background: #1e1e1e;
960
960
  border-radius: 0;
@@ -963,17 +963,15 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
963
963
  width: 60px;
964
964
  z-index: 1;
965
965
  margin-bottom: -1px;
966
- }
967
- .edit-site-navigation-toggle__button.has-icon {
968
966
  min-width: 60px;
969
967
  }
970
- .edit-site-navigation-toggle__button.has-icon:hover, .edit-site-navigation-toggle__button.has-icon:active {
968
+ .edit-site-navigation-toggle__button.components-button:hover, .edit-site-navigation-toggle__button.components-button:active {
971
969
  color: #fff;
972
970
  }
973
- .edit-site-navigation-toggle__button.has-icon:focus {
971
+ .edit-site-navigation-toggle__button.components-button:focus {
974
972
  box-shadow: none;
975
973
  }
976
- .edit-site-navigation-toggle__button.has-icon::before {
974
+ .edit-site-navigation-toggle__button.components-button::before {
977
975
  transition: box-shadow 0.1s ease;
978
976
  content: "";
979
977
  display: block;
@@ -986,18 +984,21 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
986
984
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #1e1e1e;
987
985
  }
988
986
  @media (prefers-reduced-motion: reduce) {
989
- .edit-site-navigation-toggle__button.has-icon::before {
987
+ .edit-site-navigation-toggle__button.components-button::before {
990
988
  transition-duration: 0s;
991
989
  transition-delay: 0s;
992
990
  }
993
991
  }
994
- .edit-site-navigation-toggle__button.has-icon:hover::before {
992
+ .edit-site-navigation-toggle__button.components-button:hover::before {
995
993
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) #757575;
996
994
  }
997
- .edit-site-navigation-toggle__button.has-icon:focus::before {
995
+ .edit-site-navigation-toggle__button.components-button.has-icon:hover::before {
996
+ box-shadow: none;
997
+ }
998
+ .edit-site-navigation-toggle__button.components-button:focus::before {
998
999
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
999
1000
  }
1000
- .edit-site-navigation-toggle__button .edit-site-navigation-toggle__site-icon {
1001
+ .edit-site-navigation-toggle__button.components-button .edit-site-navigation-toggle__site-icon {
1001
1002
  width: 36px;
1002
1003
  height: 36px;
1003
1004
  border-radius: 2px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,29 +29,29 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.3.1",
31
31
  "@wordpress/api-fetch": "^6.0.1",
32
- "@wordpress/block-editor": "^8.1.2",
33
- "@wordpress/block-library": "^7.0.1",
34
- "@wordpress/blocks": "^11.2.1",
35
- "@wordpress/components": "^19.4.1",
36
- "@wordpress/compose": "^5.1.1",
37
- "@wordpress/core-data": "^4.1.1",
38
- "@wordpress/data": "^6.2.1",
39
- "@wordpress/data-controls": "^2.3.1",
40
- "@wordpress/editor": "^12.2.1",
32
+ "@wordpress/block-editor": "^8.2.0",
33
+ "@wordpress/block-library": "^7.0.2",
34
+ "@wordpress/blocks": "^11.2.2",
35
+ "@wordpress/components": "^19.5.0",
36
+ "@wordpress/compose": "^5.1.2",
37
+ "@wordpress/core-data": "^4.1.2",
38
+ "@wordpress/data": "^6.3.0",
39
+ "@wordpress/editor": "^12.2.2",
41
40
  "@wordpress/element": "^4.1.1",
42
41
  "@wordpress/hooks": "^3.3.1",
43
42
  "@wordpress/html-entities": "^3.3.1",
44
43
  "@wordpress/i18n": "^4.3.1",
45
- "@wordpress/icons": "^7.0.0",
46
- "@wordpress/interface": "^4.2.2",
47
- "@wordpress/keyboard-shortcuts": "^3.1.1",
44
+ "@wordpress/icons": "^7.0.1",
45
+ "@wordpress/interface": "^4.2.3",
46
+ "@wordpress/keyboard-shortcuts": "^3.1.2",
48
47
  "@wordpress/keycodes": "^3.3.1",
49
48
  "@wordpress/media-utils": "^3.1.1",
50
- "@wordpress/notices": "^3.3.1",
51
- "@wordpress/plugins": "^4.1.2",
52
- "@wordpress/reusable-blocks": "^3.1.2",
49
+ "@wordpress/notices": "^3.3.2",
50
+ "@wordpress/plugins": "^4.1.3",
51
+ "@wordpress/reusable-blocks": "^3.1.3",
52
+ "@wordpress/style-engine": "^0.2.0",
53
53
  "@wordpress/url": "^3.4.1",
54
- "@wordpress/viewport": "^4.1.1",
54
+ "@wordpress/viewport": "^4.1.2",
55
55
  "classnames": "^2.3.1",
56
56
  "downloadjs": "^1.4.7",
57
57
  "history": "^5.1.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "0f838547f37472e46e6d5a9d2e84b6c61f4bd3f0"
65
+ "gitHead": "4566ac290359553d04de4eb574545309343f790b"
66
66
  }
@@ -35,11 +35,17 @@ export default function NewTemplatePart( { postType } ) {
35
35
  }
36
36
 
37
37
  try {
38
+ // Currently template parts only allow latin chars.
39
+ // Fallback slug will receive suffix by default.
40
+ const cleanSlug =
41
+ kebabCase( title ).replace( /[^\w-]+/g, '' ) ||
42
+ 'wp-custom-part';
43
+
38
44
  const templatePart = await saveEntityRecord(
39
45
  'postType',
40
46
  'wp_template_part',
41
47
  {
42
- slug: kebabCase( title ),
48
+ slug: cleanSlug,
43
49
  title,
44
50
  content: '',
45
51
  area,
@@ -3,18 +3,11 @@
3
3
  */
4
4
  import { Component } from '@wordpress/element';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { Button } from '@wordpress/components';
7
- import { Warning } from '@wordpress/block-editor';
8
- import { useCopyToClipboard } from '@wordpress/compose';
9
6
 
10
- function CopyButton( { text, children } ) {
11
- const ref = useCopyToClipboard( text );
12
- return (
13
- <Button variant="secondary" ref={ ref }>
14
- { children }
15
- </Button>
16
- );
17
- }
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import ErrorBoundaryWarning from './warning';
18
11
 
19
12
  export default class ErrorBoundary extends Component {
20
13
  constructor() {
@@ -42,23 +35,13 @@ export default class ErrorBoundary extends Component {
42
35
  }
43
36
 
44
37
  return (
45
- <Warning
46
- className="editor-error-boundary"
47
- actions={ [
48
- <Button
49
- key="recovery"
50
- onClick={ this.reboot }
51
- variant="secondary"
52
- >
53
- { __( 'Attempt Recovery' ) }
54
- </Button>,
55
- <CopyButton key="copy-error" text={ error.stack }>
56
- { __( 'Copy Error' ) }
57
- </CopyButton>,
58
- ] }
59
- >
60
- { __( 'The editor has encountered an unexpected error.' ) }
61
- </Warning>
38
+ <ErrorBoundaryWarning
39
+ message={ __(
40
+ 'The editor has encountered an unexpected error.'
41
+ ) }
42
+ error={ error }
43
+ reboot={ this.reboot }
44
+ />
62
45
  );
63
46
  }
64
47
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { Button } from '@wordpress/components';
6
+ import { Warning } from '@wordpress/block-editor';
7
+ import { useCopyToClipboard } from '@wordpress/compose';
8
+
9
+ function CopyButton( { text, children } ) {
10
+ const ref = useCopyToClipboard( text );
11
+ return (
12
+ <Button variant="secondary" ref={ ref }>
13
+ { children }
14
+ </Button>
15
+ );
16
+ }
17
+
18
+ export default function ErrorBoundaryWarning( {
19
+ message,
20
+ error,
21
+ reboot,
22
+ dashboardLink,
23
+ } ) {
24
+ const actions = [];
25
+
26
+ if ( reboot ) {
27
+ actions.push(
28
+ <Button key="recovery" onClick={ reboot } variant="secondary">
29
+ { __( 'Attempt Recovery' ) }
30
+ </Button>
31
+ );
32
+ }
33
+
34
+ if ( error ) {
35
+ actions.push(
36
+ <CopyButton key="copy-error" text={ error.stack }>
37
+ { __( 'Copy Error' ) }
38
+ </CopyButton>
39
+ );
40
+ }
41
+
42
+ if ( dashboardLink ) {
43
+ actions.push(
44
+ <Button
45
+ key="back-to-dashboard"
46
+ variant="secondary"
47
+ href={ dashboardLink }
48
+ >
49
+ { __( 'Back to dashboard' ) }
50
+ </Button>
51
+ );
52
+ }
53
+
54
+ return (
55
+ <Warning className="editor-error-boundary" actions={ actions }>
56
+ { message }
57
+ </Warning>
58
+ );
59
+ }
@@ -2,7 +2,8 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- __experimentalUseNavigator as useNavigator,
5
+ __experimentalNavigatorButton as NavigatorButton,
6
+ __experimentalNavigatorBackButton as NavigatorBackButton,
6
7
  __experimentalItem as Item,
7
8
  FlexItem,
8
9
  __experimentalHStack as HStack,
@@ -25,32 +26,12 @@ function GenericNavigationButton( { icon, children, ...props } ) {
25
26
  );
26
27
  }
27
28
 
28
- function NavigationButton( { path, ...props } ) {
29
- const { goTo } = useNavigator();
30
-
31
- const dataAttrName = 'data-navigator-focusable-id';
32
- const dataAttrValue = path;
33
-
34
- const dataAttrCssSelector = `[${ dataAttrName }="${ dataAttrValue }"]`;
35
-
36
- const buttonProps = {
37
- ...props,
38
- [ dataAttrName ]: dataAttrValue,
39
- };
40
-
41
- return (
42
- <GenericNavigationButton
43
- onClick={ () =>
44
- goTo( path, { focusTargetSelector: dataAttrCssSelector } )
45
- }
46
- { ...buttonProps }
47
- />
48
- );
29
+ function NavigationButton( props ) {
30
+ return <NavigatorButton as={ GenericNavigationButton } { ...props } />;
49
31
  }
50
32
 
51
- function NavigationBackButton( { ...props } ) {
52
- const { goBack } = useNavigator();
53
- return <GenericNavigationButton onClick={ goBack } { ...props } />;
33
+ function NavigationBackButton( props ) {
34
+ return <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;
54
35
  }
55
36
 
56
37
  export { NavigationButton, NavigationBackButton };
@@ -7,7 +7,11 @@ import {
7
7
  __experimentalFontAppearanceControl as FontAppearanceControl,
8
8
  __experimentalLetterSpacingControl as LetterSpacingControl,
9
9
  } from '@wordpress/block-editor';
10
- import { PanelBody, FontSizePicker } from '@wordpress/components';
10
+ import {
11
+ PanelBody,
12
+ FontSizePicker,
13
+ __experimentalSpacer as Spacer,
14
+ } from '@wordpress/components';
11
15
 
12
16
  /**
13
17
  * Internal dependencies
@@ -143,10 +147,13 @@ export default function TypographyPanel( { name, element } ) {
143
147
  />
144
148
  ) }
145
149
  { hasLineHeightEnabled && (
146
- <LineHeightControl
147
- value={ lineHeight }
148
- onChange={ setLineHeight }
149
- />
150
+ <Spacer marginBottom={ 6 }>
151
+ <LineHeightControl
152
+ __nextHasNoMarginBottom={ true }
153
+ value={ lineHeight }
154
+ onChange={ setLineHeight }
155
+ />
156
+ </Spacer>
150
157
  ) }
151
158
  { hasAppearanceControl && (
152
159
  <FontAppearanceControl
@@ -23,6 +23,7 @@ import {
23
23
  getBlockTypes,
24
24
  } from '@wordpress/blocks';
25
25
  import { useEffect, useState, useContext } from '@wordpress/element';
26
+ import { getCSSRules } from '@wordpress/style-engine';
26
27
 
27
28
  /**
28
29
  * Internal dependencies
@@ -146,11 +147,11 @@ function flattenTree( input = {}, prefix, token ) {
146
147
  * @return {Array} An array of style declarations.
147
148
  */
148
149
  function getStylesDeclarations( blockStyles = {} ) {
149
- return reduce(
150
+ const output = reduce(
150
151
  STYLE_PROPERTY,
151
- ( declarations, { value, properties }, key ) => {
152
+ ( declarations, { value, properties, useEngine }, key ) => {
152
153
  const pathToValue = value;
153
- if ( first( pathToValue ) === 'elements' ) {
154
+ if ( first( pathToValue ) === 'elements' || useEngine ) {
154
155
  return declarations;
155
156
  }
156
157
 
@@ -188,6 +189,21 @@ function getStylesDeclarations( blockStyles = {} ) {
188
189
  },
189
190
  []
190
191
  );
192
+
193
+ // The goal is to move everything to server side generated engine styles
194
+ // This is temporary as we absorb more and more styles into the engine.
195
+ const extraRules = getCSSRules( blockStyles, { selector: 'self' } );
196
+ extraRules.forEach( ( rule ) => {
197
+ if ( rule.selector !== 'self' ) {
198
+ throw "This style can't be added as inline style";
199
+ }
200
+ const cssProperty = rule.key.startsWith( '--' )
201
+ ? rule.key
202
+ : kebabCase( rule.key );
203
+ output.push( `${ cssProperty }: ${ compileStyleValue( rule.value ) }` );
204
+ } );
205
+
206
+ return output;
191
207
  }
192
208
 
193
209
  export const getNodesWithStyles = ( tree, blockSelectors ) => {
@@ -8,6 +8,7 @@ import {
8
8
  VisuallyHidden,
9
9
  __experimentalHeading as Heading,
10
10
  } from '@wordpress/components';
11
+ import { decodeEntities } from '@wordpress/html-entities';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
@@ -98,8 +99,10 @@ export default function Table( { templateType } ) {
98
99
  postType: template.type,
99
100
  } }
100
101
  >
101
- { template.title?.rendered ||
102
- template.slug }
102
+ { decodeEntities(
103
+ template.title?.rendered ||
104
+ template.slug
105
+ ) }
103
106
  </Link>
104
107
  </Heading>
105
108
  { template.description }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -58,9 +63,8 @@ function NavigationToggle( { icon } ) {
58
63
 
59
64
  const effect = {
60
65
  expand: {
61
- scale: 1.7,
62
- borderRadius: 0,
63
- transition: { type: 'tween', duration: '0.2' },
66
+ scale: 1.25,
67
+ transition: { type: 'tween', duration: '0.3' },
64
68
  },
65
69
  };
66
70
 
@@ -79,6 +83,11 @@ function NavigationToggle( { icon } ) {
79
83
  buttonIcon = <Icon size="36px" icon={ icon } />;
80
84
  }
81
85
 
86
+ const classes = classnames( {
87
+ 'edit-site-navigation-toggle__button': true,
88
+ 'has-icon': siteIconUrl,
89
+ } );
90
+
82
91
  return (
83
92
  <motion.div
84
93
  className={
@@ -88,7 +97,7 @@ function NavigationToggle( { icon } ) {
88
97
  whileHover="expand"
89
98
  >
90
99
  <Button
91
- className="edit-site-navigation-toggle__button has-icon"
100
+ className={ classes }
92
101
  label={ __( 'Toggle navigation' ) }
93
102
  ref={ navigationToggleRef }
94
103
  // isPressed will add unwanted styles.
@@ -12,7 +12,7 @@
12
12
  width: $header-height;
13
13
  }
14
14
 
15
- .edit-site-navigation-toggle__button {
15
+ .edit-site-navigation-toggle__button.components-button {
16
16
  align-items: center;
17
17
  background: $gray-900;
18
18
  border-radius: 0;
@@ -21,42 +21,43 @@
21
21
  width: $header-height;
22
22
  z-index: 1;
23
23
  margin-bottom: - $border-width;
24
+ min-width: $header-height;
24
25
 
25
- &.has-icon {
26
- min-width: $header-height;
26
+ &:hover,
27
+ &:active {
28
+ color: $white;
29
+ }
27
30
 
28
- &:hover,
29
- &:active {
30
- color: $white;
31
- }
31
+ &:focus {
32
+ box-shadow: none;
33
+ }
32
34
 
33
- &:focus {
34
- box-shadow: none;
35
- }
35
+ &::before {
36
+ transition: box-shadow 0.1s ease;
37
+ @include reduce-motion("transition");
38
+ content: "";
39
+ display: block;
40
+ position: absolute;
41
+ top: 9px;
42
+ right: 9px;
43
+ bottom: 9px;
44
+ left: 9px;
45
+ border-radius: $radius-block-ui + $border-width + $border-width;
46
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
47
+ }
36
48
 
37
- &::before {
38
- transition: box-shadow 0.1s ease;
39
- @include reduce-motion("transition");
40
- content: "";
41
- display: block;
42
- position: absolute;
43
- top: 9px;
44
- right: 9px;
45
- bottom: 9px;
46
- left: 9px;
47
- border-radius: $radius-block-ui + $border-width + $border-width;
48
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
49
- }
49
+ // Hover color.
50
+ &:hover::before {
51
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-700;
52
+ }
50
53
 
51
- // Hover color.
52
- &:hover::before {
53
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-700;
54
- }
54
+ &.has-icon:hover::before {
55
+ box-shadow: none;
56
+ }
55
57
 
56
- // Lightened spot color focus.
57
- &:focus::before {
58
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba($white, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
59
- }
58
+ // Lightened spot color focus.
59
+ &:focus::before {
60
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba($white, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
60
61
  }
61
62
 
62
63
  .edit-site-navigation-toggle__site-icon {