@wordpress/edit-site 6.0.0 → 6.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 (145) hide show
  1. package/build/components/add-new-page/index.js +2 -1
  2. package/build/components/add-new-page/index.js.map +1 -1
  3. package/build/components/block-editor/inserter-media-categories.js +1 -1
  4. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  5. package/build/components/editor/index.js +54 -60
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/editor/use-editor-title.js +39 -0
  8. package/build/components/editor/use-editor-title.js.map +1 -0
  9. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  10. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  11. package/build/components/global-styles/screen-css.js +1 -1
  12. package/build/components/global-styles/screen-css.js.map +1 -1
  13. package/build/components/global-styles/screen-revisions/index.js +4 -23
  14. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  15. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  16. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  17. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  18. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  19. package/build/components/global-styles/variations/variation.js +11 -16
  20. package/build/components/global-styles/variations/variation.js.map +1 -1
  21. package/build/components/global-styles/variations/variations-color.js +2 -1
  22. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  23. package/build/components/global-styles/variations/variations-typography.js +1 -0
  24. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  25. package/build/components/global-styles-sidebar/index.js +2 -0
  26. package/build/components/global-styles-sidebar/index.js.map +1 -1
  27. package/build/components/layout/index.js +16 -59
  28. package/build/components/layout/index.js.map +1 -1
  29. package/build/components/page-patterns/index.js +5 -5
  30. package/build/components/page-patterns/index.js.map +1 -1
  31. package/build/components/pagination/index.js +17 -8
  32. package/build/components/pagination/index.js.map +1 -1
  33. package/build/components/sidebar-dataviews/dataview-item.js +6 -2
  34. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen/index.js +1 -1
  36. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  38. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  40. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
  42. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
  44. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  45. package/build/components/site-hub/index.js +38 -128
  46. package/build/components/site-hub/index.js.map +1 -1
  47. package/build/deprecated.js +11 -0
  48. package/build/deprecated.js.map +1 -1
  49. package/build/hooks/push-changes-to-global-styles/index.js +3 -2
  50. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  51. package/build/lock-unlock.js +1 -1
  52. package/build/lock-unlock.js.map +1 -1
  53. package/build/store/private-actions.js +33 -18
  54. package/build/store/private-actions.js.map +1 -1
  55. package/build-module/components/add-new-page/index.js +2 -1
  56. package/build-module/components/add-new-page/index.js.map +1 -1
  57. package/build-module/components/block-editor/inserter-media-categories.js +1 -1
  58. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  59. package/build-module/components/editor/index.js +54 -60
  60. package/build-module/components/editor/index.js.map +1 -1
  61. package/build-module/components/editor/use-editor-title.js +31 -0
  62. package/build-module/components/editor/use-editor-title.js.map +1 -0
  63. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  64. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  65. package/build-module/components/global-styles/screen-css.js +1 -1
  66. package/build-module/components/global-styles/screen-css.js.map +1 -1
  67. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  68. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  69. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  70. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  71. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  72. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  73. package/build-module/components/global-styles/variations/variation.js +11 -16
  74. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  75. package/build-module/components/global-styles/variations/variations-color.js +3 -2
  76. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  77. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  78. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  79. package/build-module/components/global-styles-sidebar/index.js +2 -0
  80. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  81. package/build-module/components/layout/index.js +18 -61
  82. package/build-module/components/layout/index.js.map +1 -1
  83. package/build-module/components/page-patterns/index.js +5 -5
  84. package/build-module/components/page-patterns/index.js.map +1 -1
  85. package/build-module/components/pagination/index.js +17 -8
  86. package/build-module/components/pagination/index.js.map +1 -1
  87. package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
  88. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  89. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  90. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  91. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  92. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  93. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  94. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  95. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
  96. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  97. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
  98. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  99. package/build-module/components/site-hub/index.js +40 -130
  100. package/build-module/components/site-hub/index.js.map +1 -1
  101. package/build-module/deprecated.js +11 -0
  102. package/build-module/deprecated.js.map +1 -1
  103. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
  104. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  105. package/build-module/lock-unlock.js +1 -1
  106. package/build-module/lock-unlock.js.map +1 -1
  107. package/build-module/store/private-actions.js +33 -18
  108. package/build-module/store/private-actions.js.map +1 -1
  109. package/build-style/style-rtl.css +43 -85
  110. package/build-style/style.css +43 -85
  111. package/package.json +41 -41
  112. package/src/components/add-new-page/index.js +2 -1
  113. package/src/components/block-editor/inserter-media-categories.js +1 -3
  114. package/src/components/block-editor/style.scss +11 -0
  115. package/src/components/editor/index.js +69 -96
  116. package/src/components/editor/style.scss +1 -5
  117. package/src/components/editor/use-editor-title.js +35 -0
  118. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  119. package/src/components/global-styles/screen-css.js +1 -1
  120. package/src/components/global-styles/screen-revisions/index.js +4 -24
  121. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  122. package/src/components/global-styles/screen-revisions/style.scss +4 -8
  123. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  124. package/src/components/global-styles/variations/variation.js +14 -19
  125. package/src/components/global-styles/variations/variations-color.js +12 -4
  126. package/src/components/global-styles/variations/variations-typography.js +5 -1
  127. package/src/components/global-styles-sidebar/index.js +2 -0
  128. package/src/components/layout/index.js +17 -67
  129. package/src/components/layout/style.scss +18 -58
  130. package/src/components/page-patterns/index.js +15 -12
  131. package/src/components/pagination/index.js +21 -16
  132. package/src/components/sidebar-dataviews/dataview-item.js +6 -2
  133. package/src/components/sidebar-navigation-screen/index.js +1 -1
  134. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  135. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  136. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  137. package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
  138. package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
  139. package/src/components/site-hub/index.js +55 -146
  140. package/src/components/site-hub/style.scss +1 -4
  141. package/src/components/site-icon/style.scss +0 -4
  142. package/src/deprecated.js +14 -0
  143. package/src/hooks/push-changes-to-global-styles/index.js +3 -2
  144. package/src/lock-unlock.js +1 -1
  145. package/src/store/private-actions.js +58 -30
@@ -1 +1 @@
1
- {"version":3,"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","useSelect","noticesStore","coreStore","useSupportedStyles","unlock","cloneDeep","setNestedValue","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","cleanEmptyObject","GlobalStylesContext","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","className","help","children","VisualLabel","__next40pxDefaultSize","variant","disabled","PushChangesToGlobalStyles","props","blockEditingMode","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","supportsStyles","some","feature","isDisplayed","withPushChangesToGlobalStyles","BlockEdit","isSelected"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,mBAAmB,QACb,yBAAyB;AAChC,SAAS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,EAC9C6H,6BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","useSelect","noticesStore","coreStore","useSupportedStyles","unlock","cloneDeep","setNestedValue","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","cleanEmptyObject","GlobalStylesContext","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","className","help","children","VisualLabel","__next40pxDefaultSize","variant","__experimentalIsFocusable","disabled","PushChangesToGlobalStyles","props","blockEditingMode","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","supportsStyles","some","feature","isDisplayed","withPushChangesToGlobalStyles","BlockEdit","isSelected"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\t__experimentalIsFocusable\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,mBAAmB,QACb,yBAAyB;AAChC,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,6BAA6B,EAC7BC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACrE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAAShB,KAAK,IAAIiB,YAAY,QAAQ,oBAAoB;AAC1D,SAASjB,KAAK,IAAIkB,SAAS,QAA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B,GAAG9G,mBAAmB,CAAC,CAAC;EAC9C,MAAM+G,iBAAiB,GAAGnG,SAAS,CAChCoG,MAAM,IAAMA,MAAM,CAAElG,SAAU,CAAC,CAACmG,eAAe,CAAC,CAAC,EAAEC,cAAc,EACnE,EACD,CAAC;EACD,MAAMC,cAAc,GAAGnF,gBAAgB,CAACoF,IAAI,CAAIC,OAAO,IACtD9G,eAAe,CAAEsG,KAAK,CAACtD,IAAI,EAAE8D,OAAQ,CACtC,CAAC;EACD,MAAMC,WAAW,GAChBR,gBAAgB,KAAK,SAAS,IAAIK,cAAc,IAAIJ,iBAAiB;EAEtE,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,oBACClG,IAAA,CAACzB,yBAAyB;IAAA2G,QAAA,eACzBlF,IAAA,CAACwD,gCAAgC;MAAA,GAAMiC;IAAK,CAAI;EAAC,CACvB,CAAC;AAE9B;AAEA,MAAMU,6BAA6B,GAAG7H,0BAA0B,CAC7D8H,SAAS,IAAQX,KAAK,iBACvBvF,KAAA,CAAAE,SAAA;EAAA8E,QAAA,gBACClF,IAAA,CAACoG,SAAS;IAAA,GAAMX;EAAK,CAAI,CAAC,EACxBA,KAAK,CAACY,UAAU,iBAAIrG,IAAA,CAACwF,yBAAyB;IAAA,GAAMC;EAAK,CAAI,CAAC;AAAA,CAC/D,CAEJ,CAAC;AAEDpH,SAAS,CACR,kBAAkB,EAClB,8CAA8C,EAC9C8H,6BACD,CAAC","ignoreList":[]}
@@ -5,5 +5,5 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
  export const {
6
6
  lock,
7
7
  unlock
8
- } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-site');
8
+ } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site');
9
9
  //# sourceMappingURL=lock-unlock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,iHAAiH,EACjH,sBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,+HAA+H,EAC/H,sBACD,CAAC","ignoreList":[]}
@@ -14,27 +14,42 @@ export const setCanvasMode = mode => ({
14
14
  registry,
15
15
  dispatch
16
16
  }) => {
17
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
18
- registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
19
- const isPublishSidebarOpened = registry.select(editorStore).isPublishSidebarOpened();
20
- dispatch({
21
- type: 'SET_CANVAS_MODE',
22
- mode
23
- });
24
- const isEditMode = mode === 'edit';
25
- if (isPublishSidebarOpened && !isEditMode) {
26
- registry.dispatch(editorStore).closePublishSidebar();
27
- }
17
+ const switchCanvasMode = () => {
18
+ registry.batch(() => {
19
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
20
+ registry.dispatch(blockEditorStore).clearSelectedBlock();
21
+ registry.dispatch(editorStore).setDeviceType('Desktop');
22
+ registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
23
+ const isPublishSidebarOpened = registry.select(editorStore).isPublishSidebarOpened();
24
+ dispatch({
25
+ type: 'SET_CANVAS_MODE',
26
+ mode
27
+ });
28
+ const isEditMode = mode === 'edit';
29
+ if (isPublishSidebarOpened && !isEditMode) {
30
+ registry.dispatch(editorStore).closePublishSidebar();
31
+ }
28
32
 
29
- // Check if the block list view should be open by default.
30
- // If `distractionFree` mode is enabled, the block list view should not be open.
31
- // This behavior is disabled for small viewports.
32
- if (isMediumOrBigger && isEditMode && registry.select(preferencesStore).get('core', 'showListViewByDefault') && !registry.select(preferencesStore).get('core', 'distractionFree')) {
33
- registry.dispatch(editorStore).setIsListViewOpened(true);
33
+ // Check if the block list view should be open by default.
34
+ // If `distractionFree` mode is enabled, the block list view should not be open.
35
+ // This behavior is disabled for small viewports.
36
+ if (isMediumOrBigger && isEditMode && registry.select(preferencesStore).get('core', 'showListViewByDefault') && !registry.select(preferencesStore).get('core', 'distractionFree')) {
37
+ registry.dispatch(editorStore).setIsListViewOpened(true);
38
+ } else {
39
+ registry.dispatch(editorStore).setIsListViewOpened(false);
40
+ }
41
+ registry.dispatch(editorStore).setIsInserterOpened(false);
42
+ });
43
+ };
44
+ if (!document.startViewTransition) {
45
+ switchCanvasMode();
34
46
  } else {
35
- registry.dispatch(editorStore).setIsListViewOpened(false);
47
+ document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
48
+ const transition = document.startViewTransition(() => switchCanvasMode());
49
+ transition.finished.finally(() => {
50
+ document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
51
+ });
36
52
  }
37
- registry.dispatch(editorStore).setIsInserterOpened(false);
38
53
  };
39
54
 
40
55
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tconst isPublishSidebarOpened = registry\n\t\t\t.select( editorStore )\n\t\t\t.isPublishSidebarOpened();\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\tconst isEditMode = mode === 'edit';\n\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t}\n\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t// This behavior is disabled for small viewports.\n\t\tif (\n\t\t\tisMediumOrBigger &&\n\t\t\tisEditMode &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;EAClDL,QAAQ,CAACC,QAAQ,CAAEN,gBAAiB,CAAC,CAACW,uBAAuB,CAAE,MAAO,CAAC;EACvE,MAAMC,sBAAsB,GAAGP,QAAQ,CACrCQ,MAAM,CAAEX,WAAY,CAAC,CACrBU,sBAAsB,CAAC,CAAC;EAC1BN,QAAQ,CAAE;IACTQ,IAAI,EAAE,iBAAiB;IACvBV;EACD,CAAE,CAAC;EACH,MAAMW,UAAU,GAAGX,IAAI,KAAK,MAAM;EAClC,IAAKQ,sBAAsB,IAAI,CAAEG,UAAU,EAAG;IAC7CV,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACc,mBAAmB,CAAC,CAAC;EACvD;;EAEA;EACA;EACA;EACA,IACCT,gBAAgB,IAChBQ,UAAU,IACVV,QAAQ,CACNQ,MAAM,CAAEZ,gBAAiB,CAAC,CAC1BgB,GAAG,CAAE,MAAM,EAAE,uBAAwB,CAAC,IACxC,CAAEZ,QAAQ,CACRQ,MAAM,CAAEZ,gBAAiB,CAAC,CAC1BgB,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;IACDZ,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACgB,mBAAmB,CAAE,IAAK,CAAC;EAC7D,CAAC,MAAM;IACNb,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACgB,mBAAmB,CAAE,KAAM,CAAC;EAC9D;EACAb,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACiB,mBAAmB,CAAE,KAAM,CAAC;AAC9D,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEf;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTQ,IAAI,EAAE,kCAAkC;IACxCO;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","clearSelectedBlock","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BF,QAAQ,CAACG,KAAK,CAAE,MAAM;MACrB,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;MAClDP,QAAQ,CAACC,QAAQ,CAAEN,gBAAiB,CAAC,CAACa,kBAAkB,CAAC,CAAC;MAC1DR,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACY,aAAa,CAAE,SAAU,CAAC;MAC3DT,QAAQ,CACNC,QAAQ,CAAEN,gBAAiB,CAAC,CAC5Be,uBAAuB,CAAE,MAAO,CAAC;MACnC,MAAMC,sBAAsB,GAAGX,QAAQ,CACrCY,MAAM,CAAEf,WAAY,CAAC,CACrBc,sBAAsB,CA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ACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6B,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE5B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTY,IAAI,EAAE,kCAAkC;IACxCgB;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -513,6 +513,7 @@
513
513
  .dataviews-view-list li .dataviews-view-list__item-actions .components-button {
514
514
  opacity: 0;
515
515
  position: fixed;
516
+ left: 0;
516
517
  }
517
518
  .dataviews-view-list li.is-selected .dataviews-view-list__item-actions, .dataviews-view-list li.is-hovered .dataviews-view-list__item-actions, .dataviews-view-list li:focus-within .dataviews-view-list__item-actions {
518
519
  padding-left: 32px;
@@ -928,12 +929,15 @@
928
929
  }
929
930
 
930
931
  .dataviews-bulk-actions {
931
- position: absolute;
932
+ position: sticky;
932
933
  display: flex;
933
934
  flex-direction: column;
934
935
  align-content: center;
935
936
  flex-wrap: wrap;
936
- width: 100%;
937
+ width: -moz-fit-content;
938
+ width: fit-content;
939
+ margin-right: auto;
940
+ margin-left: auto;
937
941
  bottom: 24px;
938
942
  z-index: 2;
939
943
  }
@@ -1110,6 +1114,18 @@
1110
1114
  align-items: flex-start;
1111
1115
  }
1112
1116
 
1117
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1118
+ ::view-transition-old(frame),
1119
+ ::view-transition-new(frame) {
1120
+ animation-duration: 0;
1121
+ }
1122
+
1123
+ /* stylelint-enable */
1124
+ .edit-site-visual-editor__editor-canvas {
1125
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1126
+ view-transition-name: frame;
1127
+ /* stylelint-enable */
1128
+ }
1113
1129
  .edit-site-visual-editor__editor-canvas.is-focused {
1114
1130
  outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
1115
1131
  outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
@@ -1504,18 +1520,12 @@
1504
1520
  will-change: opacity;
1505
1521
  }
1506
1522
  .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination .components-button.is-tertiary {
1507
- font-size: 28px;
1508
- font-weight: 200;
1509
1523
  color: #1e1e1e;
1510
- margin-bottom: 4px;
1511
- line-height: 1.2;
1512
1524
  }
1513
- .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination .components-button.is-tertiary:disabled {
1525
+ .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination .components-button.is-tertiary:disabled,
1526
+ .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination .components-button.is-tertiary[aria-disabled=true] {
1514
1527
  color: #949494;
1515
1528
  }
1516
- .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination .components-button.is-tertiary:hover {
1517
- background: transparent;
1518
- }
1519
1529
 
1520
1530
  .edit-site-global-styles-screen-revisions__footer {
1521
1531
  height: 56px;
@@ -2011,17 +2021,17 @@
2011
2021
  border-bottom: 1px solid #f0f0f0;
2012
2022
  }
2013
2023
 
2014
- .edit-site-editor__interface-skeleton {
2024
+ .edit-site-editor__editor-interface {
2015
2025
  opacity: 1;
2016
2026
  transition: opacity 0.1s ease-out;
2017
2027
  }
2018
2028
  @media (prefers-reduced-motion: reduce) {
2019
- .edit-site-editor__interface-skeleton {
2029
+ .edit-site-editor__editor-interface {
2020
2030
  transition-duration: 0s;
2021
2031
  transition-delay: 0s;
2022
2032
  }
2023
2033
  }
2024
- .edit-site-editor__interface-skeleton.is-loading {
2034
+ .edit-site-editor__editor-interface.is-loading {
2025
2035
  opacity: 0;
2026
2036
  }
2027
2037
 
@@ -2035,10 +2045,6 @@
2035
2045
  justify-content: center;
2036
2046
  }
2037
2047
 
2038
- .editor-header {
2039
- padding-right: 60px;
2040
- }
2041
-
2042
2048
  .edit-site-welcome-guide {
2043
2049
  width: 312px;
2044
2050
  }
@@ -2089,38 +2095,8 @@
2089
2095
  display: flex;
2090
2096
  flex-direction: column;
2091
2097
  }
2092
-
2093
- .edit-site-layout__hub {
2094
- position: fixed;
2095
- top: 0;
2096
- right: 0;
2097
- width: calc(100vw - 32px);
2098
- height: 60px;
2099
- z-index: 3;
2100
- }
2101
- @media (min-width: 782px) {
2102
- .edit-site-layout__hub {
2103
- width: calc(360px - 12px);
2104
- }
2105
- }
2106
- .edit-site-layout.is-full-canvas .edit-site-layout__hub {
2107
- padding-left: 0;
2108
- border-radius: 0;
2109
- width: 60px;
2110
- box-shadow: none;
2111
- }
2112
-
2113
- .edit-site-layout__header-container:has(+ .edit-site-layout__content > .edit-site-layout__mobile > .edit-site-page) {
2114
- margin-bottom: 60px;
2115
- }
2116
- @media (min-width: 782px) {
2117
- .edit-site-layout__header-container:has(+ .edit-site-layout__content > .edit-site-layout__mobile > .edit-site-page) {
2118
- margin-bottom: 0;
2119
- }
2120
- }
2121
-
2122
- .edit-site-layout__header-container {
2123
- z-index: 4;
2098
+ .edit-site-layout:not(.is-full-canvas) .editor-visual-editor {
2099
+ background: #1e1e1e;
2124
2100
  }
2125
2101
 
2126
2102
  .edit-site-layout__content {
@@ -2231,10 +2207,22 @@
2231
2207
  height: 100%;
2232
2208
  }
2233
2209
 
2210
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
2211
+ html.canvas-mode-edit-transition::view-transition-group(toggle) {
2212
+ animation-delay: 255ms;
2213
+ }
2214
+
2215
+ /* stylelint-enable */
2216
+ .edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
2217
+ display: none;
2218
+ }
2219
+
2234
2220
  .edit-site-layout__view-mode-toggle.components-button {
2221
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
2222
+ view-transition-name: toggle;
2223
+ /* stylelint-enable */
2235
2224
  position: relative;
2236
2225
  color: #fff;
2237
- border-radius: 0;
2238
2226
  height: 60px;
2239
2227
  width: 60px;
2240
2228
  overflow: hidden;
@@ -2242,6 +2230,8 @@
2242
2230
  display: flex;
2243
2231
  align-items: center;
2244
2232
  justify-content: center;
2233
+ background: #1e1e1e;
2234
+ border-radius: 0;
2245
2235
  }
2246
2236
  .edit-site-layout__view-mode-toggle.components-button:hover, .edit-site-layout__view-mode-toggle.components-button:active {
2247
2237
  color: #fff;
@@ -2272,7 +2262,6 @@
2272
2262
  }
2273
2263
  .edit-site-layout__view-mode-toggle.components-button .edit-site-layout__view-mode-toggle-icon {
2274
2264
  display: flex;
2275
- border-radius: 2px;
2276
2265
  height: 64px;
2277
2266
  width: 64px;
2278
2267
  justify-content: center;
@@ -2303,27 +2292,6 @@
2303
2292
  }
2304
2293
  }
2305
2294
 
2306
- .edit-site-layout.is-distraction-free .edit-site-layout__header-container {
2307
- height: 60px;
2308
- position: absolute;
2309
- top: 0;
2310
- right: 0;
2311
- left: 0;
2312
- z-index: 4;
2313
- width: 100%;
2314
- }
2315
- .edit-site-layout.is-distraction-free .edit-site-layout__header-container:focus-within {
2316
- opacity: 1 !important;
2317
- }
2318
- .edit-site-layout.is-distraction-free .edit-site-layout__header-container:focus-within div {
2319
- transform: translateX(0) translateY(0) translateZ(0) !important;
2320
- }
2321
- .edit-site-layout.is-distraction-free .edit-site-site-hub {
2322
- position: absolute;
2323
- top: 0;
2324
- z-index: 3;
2325
- }
2326
-
2327
2295
  .edit-site-layout__area {
2328
2296
  flex-grow: 1;
2329
2297
  margin: 0;
@@ -2549,7 +2517,7 @@
2549
2517
  position: sticky;
2550
2518
  top: 0;
2551
2519
  background: #1e1e1e;
2552
- padding-top: 108px;
2520
+ padding-top: 48px;
2553
2521
  margin-bottom: 8px;
2554
2522
  padding-bottom: 8px;
2555
2523
  z-index: 1;
@@ -2557,8 +2525,8 @@
2557
2525
 
2558
2526
  .edit-site-sidebar-navigation-screen__title {
2559
2527
  flex-grow: 1;
2560
- padding: 6px 0 0 0;
2561
2528
  overflow-wrap: break-word;
2529
+ padding: 2px 0 0 0;
2562
2530
  }
2563
2531
 
2564
2532
  .edit-site-sidebar-navigation-screen__actions {
@@ -2727,6 +2695,7 @@
2727
2695
  align-items: center;
2728
2696
  justify-content: space-between;
2729
2697
  gap: 8px;
2698
+ margin-left: 12px;
2730
2699
  }
2731
2700
 
2732
2701
  .edit-site-site-hub__actions {
@@ -2738,9 +2707,6 @@
2738
2707
  width: 60px;
2739
2708
  flex-shrink: 0;
2740
2709
  }
2741
- .edit-site-site-hub__view-mode-toggle-container .edit-site-layout__view-mode-toggle-icon {
2742
- background: #1e1e1e;
2743
- }
2744
2710
  .edit-site-site-hub__view-mode-toggle-container.has-transparent-background .edit-site-layout__view-mode-toggle-icon {
2745
2711
  background: transparent;
2746
2712
  }
@@ -2830,13 +2796,6 @@
2830
2796
 
2831
2797
  .edit-site-site-icon__icon {
2832
2798
  fill: currentColor;
2833
- transition: padding 0.3s ease-out;
2834
- }
2835
- @media (prefers-reduced-motion: reduce) {
2836
- .edit-site-site-icon__icon {
2837
- transition-duration: 0s;
2838
- transition-delay: 0s;
2839
- }
2840
2799
  }
2841
2800
  .edit-site-layout.is-full-canvas .edit-site-site-icon__icon {
2842
2801
  padding: 6px;
@@ -2845,7 +2804,6 @@
2845
2804
  .edit-site-site-icon__image {
2846
2805
  width: 100%;
2847
2806
  height: 100%;
2848
- border-radius: 4px;
2849
2807
  object-fit: cover;
2850
2808
  background: #333;
2851
2809
  }