@wordpress/block-editor 15.6.1-next.36001005c.0 → 15.6.1

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 (163) hide show
  1. package/build/components/background-image-control/index.js +2 -2
  2. package/build/components/background-image-control/index.js.map +2 -2
  3. package/build/components/block-list/block.js +3 -3
  4. package/build/components/block-list/block.js.map +2 -2
  5. package/build/components/block-list/index.js +2 -2
  6. package/build/components/block-list/index.js.map +1 -1
  7. package/build/components/block-quick-navigation/index.js +0 -1
  8. package/build/components/block-quick-navigation/index.js.map +2 -2
  9. package/build/components/global-styles/border-panel.js +1 -2
  10. package/build/components/global-styles/border-panel.js.map +2 -2
  11. package/build/components/global-styles/color-panel.js +1 -2
  12. package/build/components/global-styles/color-panel.js.map +2 -2
  13. package/build/components/global-styles/dimensions-panel.js +2 -3
  14. package/build/components/global-styles/dimensions-panel.js.map +2 -2
  15. package/build/components/global-styles/filters-panel.js +1 -2
  16. package/build/components/global-styles/filters-panel.js.map +2 -2
  17. package/build/components/global-styles/get-block-css-selector.js +78 -0
  18. package/build/components/global-styles/get-block-css-selector.js.map +7 -0
  19. package/build/components/global-styles/hooks.js +95 -23
  20. package/build/components/global-styles/hooks.js.map +2 -2
  21. package/build/components/global-styles/index.js +14 -0
  22. package/build/components/global-styles/index.js.map +2 -2
  23. package/build/components/global-styles/typography-panel.js +19 -3
  24. package/build/components/global-styles/typography-panel.js.map +2 -2
  25. package/build/components/global-styles/typography-utils.js +49 -2
  26. package/build/components/global-styles/typography-utils.js.map +2 -2
  27. package/build/components/global-styles/use-global-styles-output.js +998 -0
  28. package/build/components/global-styles/use-global-styles-output.js.map +7 -0
  29. package/build/components/global-styles/utils.js +377 -0
  30. package/build/components/global-styles/utils.js.map +2 -2
  31. package/build/components/rich-text/index.js +8 -7
  32. package/build/components/rich-text/index.js.map +2 -2
  33. package/build/hooks/block-bindings.js +111 -170
  34. package/build/hooks/block-bindings.js.map +2 -2
  35. package/build/hooks/block-style-variation.js +10 -6
  36. package/build/hooks/block-style-variation.js.map +2 -2
  37. package/build/hooks/custom-class-name.js +1 -1
  38. package/build/hooks/custom-class-name.js.map +1 -1
  39. package/build/hooks/duotone.js +3 -3
  40. package/build/hooks/duotone.js.map +2 -2
  41. package/build/hooks/fit-text.js +31 -18
  42. package/build/hooks/fit-text.js.map +2 -2
  43. package/build/hooks/font-size.js +6 -5
  44. package/build/hooks/font-size.js.map +2 -2
  45. package/build/hooks/metadata.js +48 -2
  46. package/build/hooks/metadata.js.map +2 -2
  47. package/build/hooks/typography.js +11 -4
  48. package/build/hooks/typography.js.map +3 -3
  49. package/build/hooks/use-typography-props.js +2 -2
  50. package/build/hooks/use-typography-props.js.map +2 -2
  51. package/build/store/private-selectors.js +3 -3
  52. package/build/store/private-selectors.js.map +2 -2
  53. package/build/store/selectors.js +38 -13
  54. package/build/store/selectors.js.map +2 -2
  55. package/build/store/utils.js +2 -1
  56. package/build/store/utils.js.map +2 -2
  57. package/build/utils/fit-text-utils.js +4 -4
  58. package/build/utils/fit-text-utils.js.map +2 -2
  59. package/build-module/components/background-image-control/index.js +1 -1
  60. package/build-module/components/background-image-control/index.js.map +2 -2
  61. package/build-module/components/block-list/block.js +3 -3
  62. package/build-module/components/block-list/block.js.map +2 -2
  63. package/build-module/components/block-list/index.js +2 -2
  64. package/build-module/components/block-list/index.js.map +1 -1
  65. package/build-module/components/block-quick-navigation/index.js +0 -1
  66. package/build-module/components/block-quick-navigation/index.js.map +2 -2
  67. package/build-module/components/global-styles/border-panel.js +1 -2
  68. package/build-module/components/global-styles/border-panel.js.map +2 -2
  69. package/build-module/components/global-styles/color-panel.js +1 -2
  70. package/build-module/components/global-styles/color-panel.js.map +2 -2
  71. package/build-module/components/global-styles/dimensions-panel.js +1 -2
  72. package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
  73. package/build-module/components/global-styles/filters-panel.js +1 -2
  74. package/build-module/components/global-styles/filters-panel.js.map +2 -2
  75. package/build-module/components/global-styles/get-block-css-selector.js +54 -0
  76. package/build-module/components/global-styles/get-block-css-selector.js.map +7 -0
  77. package/build-module/components/global-styles/hooks.js +95 -27
  78. package/build-module/components/global-styles/hooks.js.map +2 -2
  79. package/build-module/components/global-styles/index.js +14 -0
  80. package/build-module/components/global-styles/index.js.map +2 -2
  81. package/build-module/components/global-styles/typography-panel.js +19 -3
  82. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  83. package/build-module/components/global-styles/typography-utils.js +49 -1
  84. package/build-module/components/global-styles/typography-utils.js.map +2 -2
  85. package/build-module/components/global-styles/use-global-styles-output.js +979 -0
  86. package/build-module/components/global-styles/use-global-styles-output.js.map +7 -0
  87. package/build-module/components/global-styles/utils.js +364 -0
  88. package/build-module/components/global-styles/utils.js.map +2 -2
  89. package/build-module/components/rich-text/index.js +8 -7
  90. package/build-module/components/rich-text/index.js.map +2 -2
  91. package/build-module/hooks/block-bindings.js +112 -172
  92. package/build-module/hooks/block-bindings.js.map +2 -2
  93. package/build-module/hooks/block-style-variation.js +12 -4
  94. package/build-module/hooks/block-style-variation.js.map +2 -2
  95. package/build-module/hooks/custom-class-name.js +1 -1
  96. package/build-module/hooks/custom-class-name.js.map +1 -1
  97. package/build-module/hooks/duotone.js +3 -3
  98. package/build-module/hooks/duotone.js.map +2 -2
  99. package/build-module/hooks/fit-text.js +32 -19
  100. package/build-module/hooks/fit-text.js.map +2 -2
  101. package/build-module/hooks/font-size.js +5 -4
  102. package/build-module/hooks/font-size.js.map +2 -2
  103. package/build-module/hooks/metadata.js +46 -1
  104. package/build-module/hooks/metadata.js.map +2 -2
  105. package/build-module/hooks/typography.js +11 -4
  106. package/build-module/hooks/typography.js.map +3 -3
  107. package/build-module/hooks/use-typography-props.js +1 -1
  108. package/build-module/hooks/use-typography-props.js.map +2 -2
  109. package/build-module/store/private-selectors.js +2 -2
  110. package/build-module/store/private-selectors.js.map +2 -2
  111. package/build-module/store/selectors.js +39 -14
  112. package/build-module/store/selectors.js.map +2 -2
  113. package/build-module/store/utils.js +3 -2
  114. package/build-module/store/utils.js.map +2 -2
  115. package/build-module/utils/fit-text-utils.js +4 -4
  116. package/build-module/utils/fit-text-utils.js.map +2 -2
  117. package/build-style/style-rtl.css +6 -10
  118. package/build-style/style.css +6 -10
  119. package/package.json +35 -36
  120. package/src/components/background-image-control/index.js +1 -1
  121. package/src/components/block-card/style.scss +1 -1
  122. package/src/components/block-list/block.js +1 -1
  123. package/src/components/block-list/index.js +2 -2
  124. package/src/components/block-navigation/style.scss +1 -1
  125. package/src/components/block-quick-navigation/index.js +0 -1
  126. package/src/components/block-switcher/style.scss +1 -1
  127. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  128. package/src/components/global-styles/border-panel.js +1 -2
  129. package/src/components/global-styles/color-panel.js +1 -2
  130. package/src/components/global-styles/color-panel.native.js +1 -1
  131. package/src/components/global-styles/dimensions-panel.js +1 -2
  132. package/src/components/global-styles/filters-panel.js +1 -2
  133. package/src/components/global-styles/get-block-css-selector.js +114 -0
  134. package/src/components/global-styles/hooks.js +108 -29
  135. package/src/components/global-styles/index.js +8 -0
  136. package/src/components/global-styles/test/typography-utils.js +806 -0
  137. package/src/components/global-styles/test/use-global-styles-output.js +1131 -0
  138. package/src/components/global-styles/test/utils.js +442 -1
  139. package/src/components/global-styles/typography-panel.js +27 -3
  140. package/src/components/global-styles/typography-utils.js +133 -0
  141. package/src/components/global-styles/use-global-styles-output.js +1487 -0
  142. package/src/components/global-styles/utils.js +537 -0
  143. package/src/components/inserter/style.scss +2 -2
  144. package/src/components/multi-selection-inspector/style.scss +1 -1
  145. package/src/components/rich-text/index.js +8 -14
  146. package/src/hooks/block-bindings.js +79 -153
  147. package/src/hooks/block-style-variation.js +12 -4
  148. package/src/hooks/custom-class-name.js +1 -1
  149. package/src/hooks/duotone.js +3 -3
  150. package/src/hooks/fit-text.js +37 -28
  151. package/src/hooks/font-size.js +8 -4
  152. package/src/hooks/metadata.js +89 -0
  153. package/src/hooks/test/metadata.js +316 -0
  154. package/src/hooks/typography.js +15 -4
  155. package/src/hooks/use-typography-props.js +1 -1
  156. package/src/store/private-selectors.js +2 -2
  157. package/src/store/selectors.js +59 -21
  158. package/src/store/test/selectors.js +1 -1
  159. package/src/store/utils.js +2 -1
  160. package/src/style.scss +0 -1
  161. package/src/utils/fit-text-utils.js +4 -16
  162. package/tsconfig.json +0 -1
  163. package/src/components/block-quick-navigation/style.scss +0 -5
@@ -3,7 +3,7 @@ import { parse as grammarParse } from "@wordpress/block-serialization-default-pa
3
3
  import { selectBlockPatternsKey } from "./private-keys";
4
4
  import { unlock } from "../lock-unlock";
5
5
  import { STORE_NAME } from "./constants";
6
- import { getSectionRootClientId } from "./private-selectors";
6
+ import { getSectionRootClientId, isSectionBlock } from "./private-selectors";
7
7
  import { getBlockEditingMode } from "./selectors";
8
8
  import { INSERTER_PATTERN_TYPES } from "../components/inserter/block-patterns-tab/utils";
9
9
  const isFiltered = Symbol("isFiltered");
@@ -112,7 +112,8 @@ const getInsertBlockTypeDependants = () => (state, rootClientId) => {
112
112
  state.settings.allowedBlockTypes,
113
113
  state.settings.templateLock,
114
114
  getBlockEditingMode(state, rootClientId),
115
- getSectionRootClientId(state)
115
+ getSectionRootClientId(state),
116
+ isSectionBlock(state, rootClientId)
116
117
  ];
117
118
  };
118
119
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\n\n/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\nimport { unlock } from '../lock-unlock';\nimport { STORE_NAME } from './constants';\nimport { getSectionRootClientId } from './private-selectors';\nimport { getBlockEditingMode } from './selectors';\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\n\nexport const isFiltered = Symbol( 'isFiltered' );\nconst parsedPatternCache = new WeakMap();\nconst grammarMapCache = new WeakMap();\n\nexport function mapUserPattern(\n\tuserPattern,\n\t__experimentalUserPatternCategories = []\n) {\n\treturn {\n\t\tname: `core/block/${ userPattern.id }`,\n\t\tid: userPattern.id,\n\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\ttitle: userPattern.title?.raw,\n\t\tcategories: userPattern.wp_pattern_category?.map( ( catId ) => {\n\t\t\tconst category = __experimentalUserPatternCategories.find(\n\t\t\t\t( { id } ) => id === catId\n\t\t\t);\n\t\t\treturn category ? category.slug : catId;\n\t\t} ),\n\t\tcontent: userPattern.content?.raw,\n\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t};\n}\n\nfunction parsePattern( pattern ) {\n\tconst blocks = parse( pattern.content, {\n\t\t__unstableSkipMigrationLogs: true,\n\t} );\n\tif ( blocks.length === 1 ) {\n\t\tblocks[ 0 ].attributes = {\n\t\t\t...blocks[ 0 ].attributes,\n\t\t\tmetadata: {\n\t\t\t\t...( blocks[ 0 ].attributes.metadata || {} ),\n\t\t\t\tcategories: pattern.categories,\n\t\t\t\tpatternName: pattern.name,\n\t\t\t\tname: blocks[ 0 ].attributes.metadata?.name || pattern.title,\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\t...pattern,\n\t\tblocks,\n\t};\n}\n\nexport function getParsedPattern( pattern ) {\n\tlet parsedPattern = parsedPatternCache.get( pattern );\n\tif ( ! parsedPattern ) {\n\t\tparsedPattern = parsePattern( pattern );\n\t\tparsedPatternCache.set( pattern, parsedPattern );\n\t}\n\treturn parsedPattern;\n}\n\nexport function getGrammar( pattern ) {\n\tlet grammarMap = grammarMapCache.get( pattern );\n\tif ( ! grammarMap ) {\n\t\tgrammarMap = grammarParse( pattern.content );\n\t\t// Block names are null only at the top level for whitespace.\n\t\tgrammarMap = grammarMap.filter( ( block ) => block.blockName !== null );\n\t\tgrammarMapCache.set( pattern, grammarMap );\n\t}\n\treturn grammarMap;\n}\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t];\n};\n\nexport const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {\n\treturn [\n\t\tstate.blockListSettings[ rootClientId ],\n\t\tstate.blocks.byClientId.get( rootClientId ),\n\t\tstate.settings.allowedBlockTypes,\n\t\tstate.settings.templateLock,\n\t\tgetBlockEditingMode( state, rootClientId ),\n\t\tgetSectionRootClientId( state ),\n\t];\n};\n"],
5
- "mappings": "AAGA,SAAS,aAAa;AACtB,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;AAAA,IACN,OAAQ,OAAQ,UAAW,CAAE,EAAE,kBAAkB;AAAA,EAClD;AACD;AAEO,MAAM,+BAA+B,MAAM,CAAE,OAAO,iBAAkB;AAC5E,SAAO;AAAA,IACN,MAAM,kBAAmB,YAAa;AAAA,IACtC,MAAM,OAAO,WAAW,IAAK,YAAa;AAAA,IAC1C,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,oBAAqB,OAAO,YAAa;AAAA,IACzC,uBAAwB,KAAM;AAAA,EAC/B;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\n\n/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\nimport { unlock } from '../lock-unlock';\nimport { STORE_NAME } from './constants';\nimport { getSectionRootClientId, isSectionBlock } from './private-selectors';\nimport { getBlockEditingMode } from './selectors';\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\n\nexport const isFiltered = Symbol( 'isFiltered' );\nconst parsedPatternCache = new WeakMap();\nconst grammarMapCache = new WeakMap();\n\nexport function mapUserPattern(\n\tuserPattern,\n\t__experimentalUserPatternCategories = []\n) {\n\treturn {\n\t\tname: `core/block/${ userPattern.id }`,\n\t\tid: userPattern.id,\n\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\ttitle: userPattern.title?.raw,\n\t\tcategories: userPattern.wp_pattern_category?.map( ( catId ) => {\n\t\t\tconst category = __experimentalUserPatternCategories.find(\n\t\t\t\t( { id } ) => id === catId\n\t\t\t);\n\t\t\treturn category ? category.slug : catId;\n\t\t} ),\n\t\tcontent: userPattern.content?.raw,\n\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t};\n}\n\nfunction parsePattern( pattern ) {\n\tconst blocks = parse( pattern.content, {\n\t\t__unstableSkipMigrationLogs: true,\n\t} );\n\tif ( blocks.length === 1 ) {\n\t\tblocks[ 0 ].attributes = {\n\t\t\t...blocks[ 0 ].attributes,\n\t\t\tmetadata: {\n\t\t\t\t...( blocks[ 0 ].attributes.metadata || {} ),\n\t\t\t\tcategories: pattern.categories,\n\t\t\t\tpatternName: pattern.name,\n\t\t\t\tname: blocks[ 0 ].attributes.metadata?.name || pattern.title,\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\t...pattern,\n\t\tblocks,\n\t};\n}\n\nexport function getParsedPattern( pattern ) {\n\tlet parsedPattern = parsedPatternCache.get( pattern );\n\tif ( ! parsedPattern ) {\n\t\tparsedPattern = parsePattern( pattern );\n\t\tparsedPatternCache.set( pattern, parsedPattern );\n\t}\n\treturn parsedPattern;\n}\n\nexport function getGrammar( pattern ) {\n\tlet grammarMap = grammarMapCache.get( pattern );\n\tif ( ! grammarMap ) {\n\t\tgrammarMap = grammarParse( pattern.content );\n\t\t// Block names are null only at the top level for whitespace.\n\t\tgrammarMap = grammarMap.filter( ( block ) => block.blockName !== null );\n\t\tgrammarMapCache.set( pattern, grammarMap );\n\t}\n\treturn grammarMap;\n}\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t];\n};\n\nexport const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {\n\treturn [\n\t\tstate.blockListSettings[ rootClientId ],\n\t\tstate.blocks.byClientId.get( rootClientId ),\n\t\tstate.settings.allowedBlockTypes,\n\t\tstate.settings.templateLock,\n\t\tgetBlockEditingMode( state, rootClientId ),\n\t\tgetSectionRootClientId( state ),\n\t\tisSectionBlock( state, rootClientId ),\n\t];\n};\n"],
5
+ "mappings": "AAGA,SAAS,aAAa;AACtB,SAAS,SAAS,oBAAoB;AAKtC,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB,sBAAsB;AACvD,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AAEhC,MAAM,aAAa,OAAQ,YAAa;AAC/C,MAAM,qBAAqB,oBAAI,QAAQ;AACvC,MAAM,kBAAkB,oBAAI,QAAQ;AAE7B,SAAS,eACf,aACA,sCAAsC,CAAC,GACtC;AACD,SAAO;AAAA,IACN,MAAM,cAAe,YAAY,EAAG;AAAA,IACpC,IAAI,YAAY;AAAA,IAChB,MAAM,uBAAuB;AAAA,IAC7B,OAAO,YAAY,OAAO;AAAA,IAC1B,YAAY,YAAY,qBAAqB,IAAK,CAAE,UAAW;AAC9D,YAAM,WAAW,oCAAoC;AAAA,QACpD,CA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AK,SAAS,MAAO;AAC5D,aAAO;AAAA,IACR;AACA,WAAO,KAAK,SAAU,IAAK;AAAA,EAC5B;AACA,SAAO;AACR;AAEO,MAAM,0BAA0B,CAAE,QAAQ,sBAAuB;AACvE,MAAK,OAAO,sBAAsB,WAAY;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,cAAc,CAAE,GAAG,MAAO;AAChC,SAAQ,YAAY,SAAS,GAAI;AAChC,UAAM,QAAQ,YAAY,MAAM;AAEhC,UAAM,YAAY;AAAA,MACjB;AAAA,MACA,MAAM,QAAQ,MAAM;AAAA,MACpB;AAAA,IACD;AACA,QAAK,CAAE,WAAY;AAClB,aAAO;AAAA,IACR;AAEA,UAAM,aAAa,QAAS,CAAE,eAAgB;AAC7C,kBAAY,KAAM,UAAW;AAAA,IAC9B,CAAE;AAAA,EACH;AAEA,SAAO;AACR;AAEO,MAAM,2BAA2B,CAAE,WAAY,CAAE,UAAW;AAClE,SAAO;AAAA,IACN,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,MAAM,SAAU,sBAAuB,IAAK,MAAO;AAAA,IACnD,MAAM;AAAA,IACN,OAAQ,OAAQ,UAAW,CAAE,EAAE,kBAAkB;AAAA,EAClD;AACD;AAEO,MAAM,+BAA+B,MAAM,CAAE,OAAO,iBAAkB;AAC5E,SAAO;AAAA,IACN,MAAM,kBAAmB,YAAa;AAAA,IACtC,MAAM,OAAO,WAAW,IAAK,YAAa;AAAA,IAC1C,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,oBAAqB,OAAO,YAAa;AAAA,IACzC,uBAAwB,KAAM;AAAA,IAC9B,eAAgB,OAAO,YAAa;AAAA,EACrC;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,10 @@
1
1
  function generateCSSRule(elementSelector, fontSize) {
2
2
  return `${elementSelector} { font-size: ${fontSize}px !important; }`;
3
3
  }
4
- function findOptimalFontSize(textElement, elementSelector, applyStylesFn, maxSize = 600) {
4
+ function findOptimalFontSize(textElement, elementSelector, applyStylesFn) {
5
5
  const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight;
6
6
  let minSize = 5;
7
+ let maxSize = 600;
7
8
  let bestSize = minSize;
8
9
  while (minSize <= maxSize) {
9
10
  const midSize = Math.floor((minSize + maxSize) / 2);
@@ -19,7 +20,7 @@ function findOptimalFontSize(textElement, elementSelector, applyStylesFn, maxSiz
19
20
  }
20
21
  return bestSize;
21
22
  }
22
- function optimizeFitText(textElement, elementSelector, applyStylesFn, maxSize) {
23
+ function optimizeFitText(textElement, elementSelector, applyStylesFn) {
23
24
  if (!textElement) {
24
25
  return;
25
26
  }
@@ -27,8 +28,7 @@ function optimizeFitText(textElement, elementSelector, applyStylesFn, maxSize) {
27
28
  const optimalSize = findOptimalFontSize(
28
29
  textElement,
29
30
  elementSelector,
30
- applyStylesFn,
31
- maxSize
31
+ applyStylesFn
32
32
  );
33
33
  const cssRule = generateCSSRule(elementSelector, optimalSize);
34
34
  applyStylesFn(cssRule);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/fit-text-utils.js"],
4
- "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Generate CSS rule for single text element.\n *\n * @param {string} elementSelector CSS selector for the text element\n * @param {number} fontSize Font size in pixels\n * @return {string} CSS rule string\n */\nfunction generateCSSRule( elementSelector, fontSize ) {\n\treturn `${ elementSelector } { font-size: ${ fontSize }px !important; }`;\n}\n\n/**\n * Find optimal font size using simple binary search between 5-600px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {string} elementSelector CSS selector for the text element\n * @param {Function} applyStylesFn Function to apply test styles\n * @param {number} maxSize Maximum font size in pixels (default: 600)\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize(\n\ttextElement,\n\telementSelector,\n\tapplyStylesFn,\n\tmaxSize = 600\n) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 5;\n\tlet bestSize = minSize;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyStylesFn( generateCSSRule( elementSelector, midSize ) );\n\n\t\tconst fitsWidth = textElement.scrollWidth <= textElement.clientWidth;\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= textElement.clientHeight;\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for style management.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {string} elementSelector CSS selector for the text element\n * @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear)\n * @param {number} maxSize Maximum font size in pixels.\n */\nexport function optimizeFitText(\n\ttextElement,\n\telementSelector,\n\tapplyStylesFn,\n\tmaxSize\n) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyStylesFn( '' );\n\n\tconst optimalSize = findOptimalFontSize(\n\t\ttextElement,\n\t\telementSelector,\n\t\tapplyStylesFn,\n\t\tmaxSize\n\t);\n\n\tconst cssRule = generateCSSRule( elementSelector, optimalSize );\n\tapplyStylesFn( cssRule );\n}\n"],
5
- "mappings": "AAYA,SAAS,gBAAiB,iBAAiB,UAAW;AACrD,SAAO,GAAI,eAAgB,iBAAkB,QAAS;AACvD;AAWA,SAAS,oBACR,aACA,iBACA,eACA,UAAU,KACT;AACD,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,gBAAiB,iBAAiB,OAAQ,CAAE;AAE3D,UAAM,YAAY,YAAY,eAAe,YAAY;AACzD,UAAM,aACL,8BACA,YAAY,gBAAgB,YAAY;AAEzC,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AAEA,SAAO;AACR;AAWO,SAAS,gBACf,aACA,iBACA,eACA,SACC;AACD,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,EAAG;AAElB,QAAM,cAAc;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,UAAU,gBAAiB,iBAAiB,WAAY;AAC9D,gBAAe,OAAQ;AACxB;",
4
+ "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Generate CSS rule for single text element.\n *\n * @param {string} elementSelector CSS selector for the text element\n * @param {number} fontSize Font size in pixels\n * @return {string} CSS rule string\n */\nfunction generateCSSRule( elementSelector, fontSize ) {\n\treturn `${ elementSelector } { font-size: ${ fontSize }px !important; }`;\n}\n\n/**\n * Find optimal font size using simple binary search between 5-600px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {string} elementSelector CSS selector for the text element\n * @param {Function} applyStylesFn Function to apply test styles\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, elementSelector, applyStylesFn ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 5;\n\tlet maxSize = 600;\n\tlet bestSize = minSize;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyStylesFn( generateCSSRule( elementSelector, midSize ) );\n\n\t\tconst fitsWidth = textElement.scrollWidth <= textElement.clientWidth;\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= textElement.clientHeight;\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for style management.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {string} elementSelector CSS selector for the text element\n * @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear)\n */\nexport function optimizeFitText( textElement, elementSelector, applyStylesFn ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyStylesFn( '' );\n\n\tconst optimalSize = findOptimalFontSize(\n\t\ttextElement,\n\t\telementSelector,\n\t\tapplyStylesFn\n\t);\n\n\tconst cssRule = generateCSSRule( elementSelector, optimalSize );\n\tapplyStylesFn( cssRule );\n}\n"],
5
+ "mappings": "AAYA,SAAS,gBAAiB,iBAAiB,UAAW;AACrD,SAAO,GAAI,eAAgB,iBAAkB,QAAS;AACvD;AAUA,SAAS,oBAAqB,aAAa,iBAAiB,eAAgB;AAC3E,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,gBAAiB,iBAAiB,OAAQ,CAAE;AAE3D,UAAM,YAAY,YAAY,eAAe,YAAY;AACzD,UAAM,aACL,8BACA,YAAY,gBAAgB,YAAY;AAEzC,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AAEA,SAAO;AACR;AAUO,SAAS,gBAAiB,aAAa,iBAAiB,eAAgB;AAC9E,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,EAAG;AAElB,QAAM,cAAc;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,QAAM,UAAU,gBAAiB,iBAAiB,WAAY;AAC9D,gBAAe,OAAQ;AACxB;",
6
6
  "names": []
7
7
  }
@@ -661,7 +661,7 @@ iframe[name=editor-canvas] {
661
661
  }
662
662
 
663
663
  .block-editor-block-card__title {
664
- font-weight: 499;
664
+ font-weight: 500;
665
665
  display: flex;
666
666
  align-items: center;
667
667
  flex-wrap: wrap;
@@ -979,7 +979,7 @@ iframe[name=editor-canvas] {
979
979
  color: #757575;
980
980
  text-transform: uppercase;
981
981
  font-size: 11px;
982
- font-weight: 499;
982
+ font-weight: 500;
983
983
  }
984
984
 
985
985
  .block-editor-block-patterns-list__list-item {
@@ -1132,10 +1132,6 @@ iframe[name=editor-canvas] {
1132
1132
  z-index: 1;
1133
1133
  }
1134
1134
 
1135
- .block-editor-block-quick-navigation__item {
1136
- font-weight: 400;
1137
- }
1138
-
1139
1135
  .block-editor-block-rename-modal {
1140
1136
  z-index: 1000001;
1141
1137
  }
@@ -1271,7 +1267,7 @@ iframe[name=editor-canvas] {
1271
1267
  color: #757575;
1272
1268
  text-transform: uppercase;
1273
1269
  font-size: 11px;
1274
- font-weight: 499;
1270
+ font-weight: 500;
1275
1271
  }
1276
1272
 
1277
1273
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
@@ -3114,7 +3110,7 @@ iframe[name=editor-canvas] {
3114
3110
  }
3115
3111
 
3116
3112
  .block-editor-multi-selection-inspector__card-title {
3117
- font-weight: 499;
3113
+ font-weight: 500;
3118
3114
  }
3119
3115
 
3120
3116
  .block-editor-multi-selection-inspector__card .block-editor-block-icon {
@@ -3921,7 +3917,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3921
3917
  color: #757575;
3922
3918
  text-transform: uppercase;
3923
3919
  font-size: 11px;
3924
- font-weight: 499;
3920
+ font-weight: 500;
3925
3921
  }
3926
3922
 
3927
3923
  .block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input {
@@ -4192,7 +4188,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4192
4188
  }
4193
4189
 
4194
4190
  .components-heading.block-editor-inserter__patterns-category-panel-title {
4195
- font-weight: 499;
4191
+ font-weight: 500;
4196
4192
  }
4197
4193
 
4198
4194
  .block-editor-inserter__patterns-explore-button.components-button,
@@ -661,7 +661,7 @@ iframe[name=editor-canvas] {
661
661
  }
662
662
 
663
663
  .block-editor-block-card__title {
664
- font-weight: 499;
664
+ font-weight: 500;
665
665
  display: flex;
666
666
  align-items: center;
667
667
  flex-wrap: wrap;
@@ -979,7 +979,7 @@ iframe[name=editor-canvas] {
979
979
  color: #757575;
980
980
  text-transform: uppercase;
981
981
  font-size: 11px;
982
- font-weight: 499;
982
+ font-weight: 500;
983
983
  }
984
984
 
985
985
  .block-editor-block-patterns-list__list-item {
@@ -1132,10 +1132,6 @@ iframe[name=editor-canvas] {
1132
1132
  z-index: 1;
1133
1133
  }
1134
1134
 
1135
- .block-editor-block-quick-navigation__item {
1136
- font-weight: 400;
1137
- }
1138
-
1139
1135
  .block-editor-block-rename-modal {
1140
1136
  z-index: 1000001;
1141
1137
  }
@@ -1271,7 +1267,7 @@ iframe[name=editor-canvas] {
1271
1267
  color: #757575;
1272
1268
  text-transform: uppercase;
1273
1269
  font-size: 11px;
1274
- font-weight: 499;
1270
+ font-weight: 500;
1275
1271
  }
1276
1272
 
1277
1273
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
@@ -3116,7 +3112,7 @@ iframe[name=editor-canvas] {
3116
3112
  }
3117
3113
 
3118
3114
  .block-editor-multi-selection-inspector__card-title {
3119
- font-weight: 499;
3115
+ font-weight: 500;
3120
3116
  }
3121
3117
 
3122
3118
  .block-editor-multi-selection-inspector__card .block-editor-block-icon {
@@ -3923,7 +3919,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3923
3919
  color: #757575;
3924
3920
  text-transform: uppercase;
3925
3921
  font-size: 11px;
3926
- font-weight: 499;
3922
+ font-weight: 500;
3927
3923
  }
3928
3924
 
3929
3925
  .block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input {
@@ -4194,7 +4190,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4194
4190
  }
4195
4191
 
4196
4192
  .components-heading.block-editor-inserter__patterns-category-panel-title {
4197
- font-weight: 499;
4193
+ font-weight: 500;
4198
4194
  }
4199
4195
 
4200
4196
  .block-editor-inserter__patterns-explore-button.components-button,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.6.1-next.36001005c.0",
3
+ "version": "15.6.1",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -56,40 +56,39 @@
56
56
  "@emotion/react": "^11.7.1",
57
57
  "@emotion/styled": "^11.6.0",
58
58
  "@react-spring/web": "^9.4.5",
59
- "@wordpress/a11y": "^4.33.1-next.36001005c.0",
60
- "@wordpress/api-fetch": "^7.33.1-next.36001005c.0",
61
- "@wordpress/base-styles": "^6.10.1-next.36001005c.0",
62
- "@wordpress/blob": "^4.33.1-next.36001005c.0",
63
- "@wordpress/block-serialization-default-parser": "^5.33.1-next.36001005c.0",
64
- "@wordpress/blocks": "^15.6.1-next.36001005c.0",
65
- "@wordpress/commands": "^1.33.1-next.36001005c.0",
66
- "@wordpress/components": "^30.7.1-next.36001005c.0",
67
- "@wordpress/compose": "^7.33.1-next.36001005c.0",
68
- "@wordpress/data": "^10.33.1-next.36001005c.0",
69
- "@wordpress/date": "^5.33.1-next.36001005c.0",
70
- "@wordpress/deprecated": "^4.33.1-next.36001005c.0",
71
- "@wordpress/dom": "^4.33.1-next.36001005c.0",
72
- "@wordpress/element": "^6.33.1-next.36001005c.0",
73
- "@wordpress/escape-html": "^3.33.1-next.36001005c.0",
74
- "@wordpress/global-styles-engine": "^1.0.1-next.36001005c.0",
75
- "@wordpress/hooks": "^4.33.1-next.36001005c.0",
76
- "@wordpress/html-entities": "^4.33.1-next.36001005c.0",
77
- "@wordpress/i18n": "^6.6.1-next.36001005c.0",
78
- "@wordpress/icons": "^11.0.1-next.36001005c.0",
79
- "@wordpress/is-shallow-equal": "^5.33.1-next.36001005c.0",
80
- "@wordpress/keyboard-shortcuts": "^5.33.1-next.36001005c.0",
81
- "@wordpress/keycodes": "^4.33.1-next.36001005c.0",
82
- "@wordpress/notices": "^5.33.1-next.36001005c.0",
83
- "@wordpress/preferences": "^4.33.1-next.36001005c.0",
84
- "@wordpress/priority-queue": "^3.33.1-next.36001005c.0",
85
- "@wordpress/private-apis": "^1.33.1-next.36001005c.0",
86
- "@wordpress/rich-text": "^7.33.1-next.36001005c.0",
87
- "@wordpress/style-engine": "^2.33.1-next.36001005c.0",
88
- "@wordpress/token-list": "^3.33.1-next.36001005c.0",
89
- "@wordpress/upload-media": "^0.18.1-next.36001005c.0",
90
- "@wordpress/url": "^4.33.1-next.36001005c.0",
91
- "@wordpress/warning": "^3.33.1-next.36001005c.0",
92
- "@wordpress/wordcount": "^4.33.1-next.36001005c.0",
59
+ "@wordpress/a11y": "^4.33.1",
60
+ "@wordpress/api-fetch": "^7.33.1",
61
+ "@wordpress/base-styles": "^6.9.1",
62
+ "@wordpress/blob": "^4.33.1",
63
+ "@wordpress/block-serialization-default-parser": "^5.33.1",
64
+ "@wordpress/blocks": "^15.6.1",
65
+ "@wordpress/commands": "^1.33.1",
66
+ "@wordpress/components": "^30.6.1",
67
+ "@wordpress/compose": "^7.33.1",
68
+ "@wordpress/data": "^10.33.1",
69
+ "@wordpress/date": "^5.33.1",
70
+ "@wordpress/deprecated": "^4.33.1",
71
+ "@wordpress/dom": "^4.33.1",
72
+ "@wordpress/element": "^6.33.1",
73
+ "@wordpress/escape-html": "^3.33.1",
74
+ "@wordpress/hooks": "^4.33.1",
75
+ "@wordpress/html-entities": "^4.33.1",
76
+ "@wordpress/i18n": "^6.6.1",
77
+ "@wordpress/icons": "^11.0.1",
78
+ "@wordpress/is-shallow-equal": "^5.33.1",
79
+ "@wordpress/keyboard-shortcuts": "^5.33.1",
80
+ "@wordpress/keycodes": "^4.33.1",
81
+ "@wordpress/notices": "^5.33.1",
82
+ "@wordpress/preferences": "^4.33.1",
83
+ "@wordpress/priority-queue": "^3.33.1",
84
+ "@wordpress/private-apis": "^1.33.1",
85
+ "@wordpress/rich-text": "^7.33.1",
86
+ "@wordpress/style-engine": "^2.33.1",
87
+ "@wordpress/token-list": "^3.33.1",
88
+ "@wordpress/upload-media": "^0.18.1",
89
+ "@wordpress/url": "^4.33.1",
90
+ "@wordpress/warning": "^3.33.1",
91
+ "@wordpress/wordcount": "^4.33.1",
93
92
  "change-case": "^4.1.2",
94
93
  "clsx": "^2.1.1",
95
94
  "colord": "^2.7.0",
@@ -112,5 +111,5 @@
112
111
  "publishConfig": {
113
112
  "access": "public"
114
113
  },
115
- "gitHead": "b73a8a22e779c59efb8f911e32b681652f237d60"
114
+ "gitHead": "5f84bafdec1bed05247c1080c12f6a237951b862"
116
115
  }
@@ -33,11 +33,11 @@ import { useRef, useState, useEffect, useMemo } from '@wordpress/element';
33
33
  import { useDispatch, useSelect } from '@wordpress/data';
34
34
  import { focus } from '@wordpress/dom';
35
35
  import { isBlobURL } from '@wordpress/blob';
36
- import { getResolvedValue } from '@wordpress/global-styles-engine';
37
36
 
38
37
  /**
39
38
  * Internal dependencies
40
39
  */
40
+ import { getResolvedValue } from '../global-styles/utils';
41
41
  import { hasBackgroundImageValue } from '../global-styles/background-panel';
42
42
  import { setImmutably } from '../../utils/object';
43
43
  import MediaReplaceFlow from '../media-replace-flow';
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .block-editor-block-card__title {
12
- font-weight: $font-weight-medium;
12
+ font-weight: 500;
13
13
  display: flex;
14
14
  align-items: center;
15
15
  flex-wrap: wrap;
@@ -633,6 +633,7 @@ function BlockListBlockProvider( props ) {
633
633
  : undefined,
634
634
  blockTitle: blockType?.title,
635
635
  isBlockHidden: attributes?.metadata?.blockVisibility === false,
636
+ bindableAttributes,
636
637
  };
637
638
 
638
639
  // When in preview mode, we can avoid a lot of selection and
@@ -718,7 +719,6 @@ function BlockListBlockProvider( props ) {
718
719
  ? blocksWithSameName[ 0 ]
719
720
  : false,
720
721
  isBlockHidden: _isBlockHidden( clientId ),
721
- bindableAttributes,
722
722
  };
723
723
  },
724
724
  [ clientId, rootClientId ]
@@ -184,7 +184,7 @@ function Items( {
184
184
  getTemplateLock,
185
185
  getBlockEditingMode,
186
186
  isSectionBlock,
187
- isContainerInsertableToInWriteMode,
187
+ isContainerInsertableToInContentOnlyMode,
188
188
  getBlockName,
189
189
  isZoomOut: _isZoomOut,
190
190
  canInsertBlockType,
@@ -223,7 +223,7 @@ function Items( {
223
223
  isZoomOut: _isZoomOut(),
224
224
  shouldRenderAppender:
225
225
  ( ! isSectionBlock( rootClientId ) ||
226
- isContainerInsertableToInWriteMode(
226
+ isContainerInsertableToInContentOnlyMode(
227
227
  getBlockName( selectedBlockClientId ),
228
228
  rootClientId
229
229
  ) ) &&
@@ -10,5 +10,5 @@
10
10
  color: $gray-700;
11
11
  text-transform: uppercase;
12
12
  font-size: 11px;
13
- font-weight: $font-weight-medium;
13
+ font-weight: 500;
14
14
  }
@@ -60,7 +60,6 @@ function BlockQuickNavigationItem( { clientId, onSelect } ) {
60
60
  return (
61
61
  <Button
62
62
  __next40pxDefaultSize
63
- className="block-editor-block-quick-navigation__item"
64
63
  isPressed={ isSelected }
65
64
  onClick={ async () => {
66
65
  await selectBlock( clientId );
@@ -94,7 +94,7 @@
94
94
  color: $gray-700;
95
95
  text-transform: uppercase;
96
96
  font-size: 11px;
97
- font-weight: $font-weight-medium;
97
+ font-weight: 500;
98
98
  }
99
99
 
100
100
  // The block switcher in the contextual toolbar should be bigger.
@@ -42,7 +42,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
42
42
 
43
43
  .emotion-6 {
44
44
  font-size: 11px;
45
- font-weight: 499;
45
+ font-weight: 500;
46
46
  line-height: 1.4;
47
47
  text-transform: uppercase;
48
48
  display: block;
@@ -11,14 +11,13 @@ import {
11
11
  } from '@wordpress/components';
12
12
  import { useCallback, useMemo } from '@wordpress/element';
13
13
  import { __ } from '@wordpress/i18n';
14
- import { getValueFromVariable } from '@wordpress/global-styles-engine';
15
14
 
16
15
  /**
17
16
  * Internal dependencies
18
17
  */
19
18
  import BorderRadiusControl from '../border-radius-control';
20
19
  import { useColorsPerOrigin } from './hooks';
21
- import { useToolsPanelDropdownMenuProps } from './utils';
20
+ import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
22
21
  import { setImmutably } from '../../utils/object';
23
22
  import { useBorderPanelLabel } from '../../hooks/border';
24
23
  import { ShadowPopover, useShadowPresets } from './shadow-panel-components';
@@ -21,14 +21,13 @@ import {
21
21
  } from '@wordpress/components';
22
22
  import { useCallback, useRef } from '@wordpress/element';
23
23
  import { __ } from '@wordpress/i18n';
24
- import { getValueFromVariable } from '@wordpress/global-styles-engine';
25
24
 
26
25
  /**
27
26
  * Internal dependencies
28
27
  */
29
28
  import ColorGradientControl from '../colors-gradients/control';
30
29
  import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
31
- import { useToolsPanelDropdownMenuProps } from './utils';
30
+ import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
32
31
  import { setImmutably } from '../../utils/object';
33
32
  import { unlock } from '../../lock-unlock';
34
33
  import { reset as resetIcon } from '@wordpress/icons';
@@ -5,13 +5,13 @@ import { useSelect } from '@wordpress/data';
5
5
  import { useEffect, useState, useMemo, useCallback } from '@wordpress/element';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
- import { getValueFromVariable } from '@wordpress/global-styles-engine';
9
8
 
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
13
12
  import PanelColorGradientSettings from '../colors-gradients/panel-color-gradient-settings';
14
13
  import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
14
+ import { getValueFromVariable } from './utils';
15
15
  import { setImmutably } from '../../utils/object';
16
16
  import ContrastChecker from '../contrast-checker';
17
17
  import InspectorControls from '../inspector-controls';
@@ -17,12 +17,11 @@ import {
17
17
  } from '@wordpress/components';
18
18
  import { Icon, alignNone, stretchWide } from '@wordpress/icons';
19
19
  import { useCallback, useState, Platform } from '@wordpress/element';
20
- import { getValueFromVariable } from '@wordpress/global-styles-engine';
21
20
 
22
21
  /**
23
22
  * Internal dependencies
24
23
  */
25
- import { useToolsPanelDropdownMenuProps } from './utils';
24
+ import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
26
25
  import SpacingSizesControl from '../spacing-sizes-control';
27
26
  import HeightControl from '../height-control';
28
27
  import ChildLayoutControl from '../child-layout-control';
@@ -24,12 +24,11 @@ import {
24
24
  import { __, _x } from '@wordpress/i18n';
25
25
  import { useCallback, useMemo, useRef } from '@wordpress/element';
26
26
  import { reset as resetIcon } from '@wordpress/icons';
27
- import { getValueFromVariable } from '@wordpress/global-styles-engine';
28
27
 
29
28
  /**
30
29
  * Internal dependencies
31
30
  */
32
- import { useToolsPanelDropdownMenuProps } from './utils';
31
+ import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
33
32
  import { setImmutably } from '../../utils/object';
34
33
 
35
34
  const EMPTY_ARRAY = [];
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { scopeSelector } from './utils';
5
+ import { getValueFromObjectPath } from '../../utils/object';
6
+
7
+ /**
8
+ * Determine the CSS selector for the block type and target provided, returning
9
+ * it if available.
10
+ *
11
+ * @param {import('@wordpress/blocks').Block} blockType The block's type.
12
+ * @param {string|string[]} target The desired selector's target e.g. `root`, delimited string, or array path.
13
+ * @param {Object} options Options object.
14
+ * @param {boolean} options.fallback Whether or not to fallback to broader selector.
15
+ *
16
+ * @return {?string} The CSS selector or `null` if no selector available.
17
+ */
18
+ export function getBlockCSSSelector(
19
+ blockType,
20
+ target = 'root',
21
+ options = {}
22
+ ) {
23
+ if ( ! target ) {
24
+ return null;
25
+ }
26
+
27
+ const { fallback = false } = options;
28
+ const { name, selectors, supports } = blockType;
29
+
30
+ const hasSelectors = selectors && Object.keys( selectors ).length > 0;
31
+ const path = Array.isArray( target ) ? target.join( '.' ) : target;
32
+
33
+ // Root selector.
34
+
35
+ // Calculated before returning as it can be used as a fallback for feature
36
+ // selectors later on.
37
+ let rootSelector = null;
38
+
39
+ if ( hasSelectors && selectors.root ) {
40
+ // Use the selectors API if available.
41
+ rootSelector = selectors?.root;
42
+ } else if ( supports?.__experimentalSelector ) {
43
+ // Use the old experimental selector supports property if set.
44
+ rootSelector = supports.__experimentalSelector;
45
+ } else {
46
+ // If no root selector found, generate default block class selector.
47
+ rootSelector =
48
+ '.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );
49
+ }
50
+
51
+ // Return selector if it's the root target we are looking for.
52
+ if ( path === 'root' ) {
53
+ return rootSelector;
54
+ }
55
+
56
+ // If target is not `root` or `duotone` we have a feature or subfeature
57
+ // as the target. If the target is a string convert to an array.
58
+ const pathArray = Array.isArray( target ) ? target : target.split( '.' );
59
+
60
+ // Feature selectors ( may fallback to root selector );
61
+ if ( pathArray.length === 1 ) {
62
+ const fallbackSelector = fallback ? rootSelector : null;
63
+
64
+ // Prefer the selectors API if available.
65
+ if ( hasSelectors ) {
66
+ // Get selector from either `feature.root` or shorthand path.
67
+ const featureSelector =
68
+ getValueFromObjectPath( selectors, `${ path }.root`, null ) ||
69
+ getValueFromObjectPath( selectors, path, null );
70
+
71
+ // Return feature selector if found or any available fallback.
72
+ return featureSelector || fallbackSelector;
73
+ }
74
+
75
+ // Try getting old experimental supports selector value.
76
+ const featureSelector = getValueFromObjectPath(
77
+ supports,
78
+ `${ path }.__experimentalSelector`,
79
+ null
80
+ );
81
+
82
+ // If nothing to work with, provide fallback selector if available.
83
+ if ( ! featureSelector ) {
84
+ return fallbackSelector;
85
+ }
86
+
87
+ // Scope the feature selector by the block's root selector.
88
+ return scopeSelector( rootSelector, featureSelector );
89
+ }
90
+
91
+ // Subfeature selector.
92
+ // This may fallback either to parent feature or root selector.
93
+ let subfeatureSelector;
94
+
95
+ // Use selectors API if available.
96
+ if ( hasSelectors ) {
97
+ subfeatureSelector = getValueFromObjectPath( selectors, path, null );
98
+ }
99
+
100
+ // Only return if we have a subfeature selector.
101
+ if ( subfeatureSelector ) {
102
+ return subfeatureSelector;
103
+ }
104
+
105
+ // To this point we don't have a subfeature selector. If a fallback has been
106
+ // requested, remove subfeature from target path and return results of a
107
+ // call for the parent feature's selector.
108
+ if ( fallback ) {
109
+ return getBlockCSSSelector( blockType, pathArray[ 0 ], options );
110
+ }
111
+
112
+ // We tried.
113
+ return null;
114
+ }