@wordpress/block-editor 11.3.3 → 11.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-popover/inbetween.js +10 -33
  3. package/build/components/block-popover/inbetween.js.map +1 -1
  4. package/build/components/block-types-list/index.native.js +2 -0
  5. package/build/components/block-types-list/index.native.js.map +1 -1
  6. package/build/components/colors-gradients/control.js +6 -3
  7. package/build/components/colors-gradients/control.js.map +1 -1
  8. package/build/components/font-appearance-control/index.js +0 -3
  9. package/build/components/font-appearance-control/index.js.map +1 -1
  10. package/build/components/global-styles/hooks.js +106 -45
  11. package/build/components/global-styles/hooks.js.map +1 -1
  12. package/build/components/global-styles/index.js +24 -0
  13. package/build/components/global-styles/index.js.map +1 -1
  14. package/build/components/global-styles/typography-panel.js +421 -0
  15. package/build/components/global-styles/typography-panel.js.map +1 -0
  16. package/build/components/global-styles/use-global-styles-output.js +6 -2
  17. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  18. package/build/components/iframe/index.js +17 -11
  19. package/build/components/iframe/index.js.map +1 -1
  20. package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
  21. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  22. package/build/components/image-size-control/index.js +6 -11
  23. package/build/components/image-size-control/index.js.map +1 -1
  24. package/build/components/inserter/block-patterns-tab.js +9 -15
  25. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  26. package/build/components/inserter/block-types-tab.native.js +4 -1
  27. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  28. package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
  29. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  30. package/build/components/inserter/search-results.native.js +4 -1
  31. package/build/components/inserter/search-results.native.js.map +1 -1
  32. package/build/components/link-control/index.js +15 -15
  33. package/build/components/link-control/index.js.map +1 -1
  34. package/build/components/link-control/settings-drawer.js +72 -30
  35. package/build/components/link-control/settings-drawer.js.map +1 -1
  36. package/build/components/link-control/settings.js +52 -0
  37. package/build/components/link-control/settings.js.map +1 -0
  38. package/build/components/list-view/index.js +6 -1
  39. package/build/components/list-view/index.js.map +1 -1
  40. package/build/components/off-canvas-editor/block-contents.js +3 -2
  41. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  42. package/build/components/off-canvas-editor/leaf-more-menu.js +116 -0
  43. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
  44. package/build/components/off-canvas-editor/link-ui.js +1 -0
  45. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  46. package/build/components/rich-text/index.js +0 -2
  47. package/build/components/rich-text/index.js.map +1 -1
  48. package/build/components/url-input/index.js +2 -2
  49. package/build/components/url-input/index.js.map +1 -1
  50. package/build/hooks/dimensions.js +6 -0
  51. package/build/hooks/dimensions.js.map +1 -1
  52. package/build/hooks/font-family.js +2 -76
  53. package/build/hooks/font-family.js.map +1 -1
  54. package/build/hooks/font-size.js +3 -51
  55. package/build/hooks/font-size.js.map +1 -1
  56. package/build/hooks/gap.js +2 -1
  57. package/build/hooks/gap.js.map +1 -1
  58. package/build/hooks/index.js +2 -0
  59. package/build/hooks/index.js.map +1 -1
  60. package/build/hooks/line-height.js +0 -42
  61. package/build/hooks/line-height.js.map +1 -1
  62. package/build/hooks/typography.js +112 -127
  63. package/build/hooks/typography.js.map +1 -1
  64. package/build/private-apis.js +3 -0
  65. package/build/private-apis.js.map +1 -1
  66. package/build/store/selectors.js +18 -1
  67. package/build/store/selectors.js.map +1 -1
  68. package/build-module/components/block-popover/inbetween.js +10 -33
  69. package/build-module/components/block-popover/inbetween.js.map +1 -1
  70. package/build-module/components/block-types-list/index.native.js +2 -0
  71. package/build-module/components/block-types-list/index.native.js.map +1 -1
  72. package/build-module/components/colors-gradients/control.js +6 -3
  73. package/build-module/components/colors-gradients/control.js.map +1 -1
  74. package/build-module/components/font-appearance-control/index.js +2 -1
  75. package/build-module/components/font-appearance-control/index.js.map +1 -1
  76. package/build-module/components/global-styles/hooks.js +100 -46
  77. package/build-module/components/global-styles/hooks.js.map +1 -1
  78. package/build-module/components/global-styles/index.js +2 -1
  79. package/build-module/components/global-styles/index.js.map +1 -1
  80. package/build-module/components/global-styles/typography-panel.js +400 -0
  81. package/build-module/components/global-styles/typography-panel.js.map +1 -0
  82. package/build-module/components/global-styles/use-global-styles-output.js +6 -2
  83. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  84. package/build-module/components/iframe/index.js +17 -11
  85. package/build-module/components/iframe/index.js.map +1 -1
  86. package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
  87. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  88. package/build-module/components/image-size-control/index.js +7 -12
  89. package/build-module/components/image-size-control/index.js.map +1 -1
  90. package/build-module/components/inserter/block-patterns-tab.js +9 -15
  91. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  92. package/build-module/components/inserter/block-types-tab.native.js +3 -1
  93. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  94. package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
  95. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  96. package/build-module/components/inserter/search-results.native.js +3 -1
  97. package/build-module/components/inserter/search-results.native.js.map +1 -1
  98. package/build-module/components/link-control/index.js +16 -16
  99. package/build-module/components/link-control/index.js.map +1 -1
  100. package/build-module/components/link-control/settings-drawer.js +68 -30
  101. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  102. package/build-module/components/link-control/settings.js +43 -0
  103. package/build-module/components/link-control/settings.js.map +1 -0
  104. package/build-module/components/list-view/index.js +6 -1
  105. package/build-module/components/list-view/index.js.map +1 -1
  106. package/build-module/components/off-canvas-editor/block-contents.js +3 -2
  107. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  108. package/build-module/components/off-canvas-editor/leaf-more-menu.js +99 -0
  109. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
  110. package/build-module/components/off-canvas-editor/link-ui.js +1 -0
  111. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  112. package/build-module/components/rich-text/index.js +0 -2
  113. package/build-module/components/rich-text/index.js.map +1 -1
  114. package/build-module/components/url-input/index.js +2 -2
  115. package/build-module/components/url-input/index.js.map +1 -1
  116. package/build-module/hooks/dimensions.js +6 -0
  117. package/build-module/hooks/dimensions.js.map +1 -1
  118. package/build-module/hooks/font-family.js +3 -69
  119. package/build-module/hooks/font-family.js.map +1 -1
  120. package/build-module/hooks/font-size.js +6 -47
  121. package/build-module/hooks/font-size.js.map +1 -1
  122. package/build-module/hooks/gap.js +3 -2
  123. package/build-module/hooks/gap.js.map +1 -1
  124. package/build-module/hooks/index.js +1 -0
  125. package/build-module/hooks/index.js.map +1 -1
  126. package/build-module/hooks/line-height.js +0 -38
  127. package/build-module/hooks/line-height.js.map +1 -1
  128. package/build-module/hooks/typography.js +110 -123
  129. package/build-module/hooks/typography.js.map +1 -1
  130. package/build-module/private-apis.js +2 -0
  131. package/build-module/private-apis.js.map +1 -1
  132. package/build-module/store/selectors.js +18 -1
  133. package/build-module/store/selectors.js.map +1 -1
  134. package/build-style/style-rtl.css +35 -22
  135. package/build-style/style.css +35 -22
  136. package/package.json +31 -31
  137. package/src/components/block-popover/inbetween.js +21 -53
  138. package/src/components/block-types-list/index.native.js +2 -0
  139. package/src/components/colors-gradients/control.js +3 -0
  140. package/src/components/font-appearance-control/index.js +1 -1
  141. package/src/components/global-styles/hooks.js +186 -66
  142. package/src/components/global-styles/index.js +5 -0
  143. package/src/components/global-styles/typography-panel.js +403 -0
  144. package/src/components/global-styles/use-global-styles-output.js +6 -2
  145. package/src/components/iframe/index.js +20 -18
  146. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
  147. package/src/components/image-size-control/index.js +10 -12
  148. package/src/components/image-size-control/style.scss +3 -21
  149. package/src/components/inserter/block-patterns-tab.js +9 -23
  150. package/src/components/inserter/block-types-tab.native.js +2 -0
  151. package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
  152. package/src/components/inserter/search-results.native.js +2 -0
  153. package/src/components/link-control/index.js +22 -22
  154. package/src/components/link-control/settings-drawer.js +85 -30
  155. package/src/components/link-control/settings.js +41 -0
  156. package/src/components/link-control/style.scss +39 -7
  157. package/src/components/link-control/test/index.js +213 -4
  158. package/src/components/list-view/index.js +5 -0
  159. package/src/components/off-canvas-editor/block-contents.js +2 -1
  160. package/src/components/off-canvas-editor/leaf-more-menu.js +115 -0
  161. package/src/components/off-canvas-editor/link-ui.js +1 -0
  162. package/src/components/rich-text/index.js +0 -2
  163. package/src/components/url-input/index.js +3 -2
  164. package/src/hooks/dimensions.js +12 -0
  165. package/src/hooks/font-family.js +0 -58
  166. package/src/hooks/font-size.js +1 -36
  167. package/src/hooks/gap.js +9 -2
  168. package/src/hooks/index.js +1 -0
  169. package/src/hooks/line-height.js +0 -33
  170. package/src/hooks/typography.js +133 -212
  171. package/src/private-apis.js +2 -0
  172. package/src/store/selectors.js +16 -1
  173. package/build/hooks/font-appearance.js +0 -188
  174. package/build/hooks/font-appearance.js.map +0 -1
  175. package/build/hooks/letter-spacing.js +0 -129
  176. package/build/hooks/letter-spacing.js.map +0 -1
  177. package/build/hooks/text-decoration.js +0 -130
  178. package/build/hooks/text-decoration.js.map +0 -1
  179. package/build/hooks/text-transform.js +0 -130
  180. package/build/hooks/text-transform.js.map +0 -1
  181. package/build-module/hooks/font-appearance.js +0 -161
  182. package/build-module/hooks/font-appearance.js.map +0 -1
  183. package/build-module/hooks/letter-spacing.js +0 -107
  184. package/build-module/hooks/letter-spacing.js.map +0 -1
  185. package/build-module/hooks/text-decoration.js +0 -108
  186. package/build-module/hooks/text-decoration.js.map +0 -1
  187. package/build-module/hooks/text-transform.js +0 -108
  188. package/build-module/hooks/text-transform.js.map +0 -1
  189. package/src/hooks/font-appearance.js +0 -146
  190. package/src/hooks/letter-spacing.js +0 -101
  191. package/src/hooks/text-decoration.js +0 -102
  192. package/src/hooks/text-transform.js +0 -101
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["hasGapSupport","blockType","support","SPACING_SUPPORT_KEY","blockGap","hasGapValue","props","attributes","style","spacing","undefined","getGapBoxControlValueFromStyle","blockGapValue","isValueString","top","left","getGapCSSValue","defaultValue","blockGapBoxControlValue","row","column","resetGap","setAttributes","useIsGapDisabled","name","blockName","isDisabled","GapEdit","clientId","spacingSizes","units","availableUnits","sides","ref","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","hasOwnProperty","newStyle","isSafari","window","navigator","userAgent","current","parentNode","replaceChild","gapValue","boxControlGapValue","right","bottom","Platform","select","web","length","native"],"mappings":";;;;;;;;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,SAAxB,EAAoC;AAC1C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,QAAjC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AAAA;;AACpC,SAAO,0BAAAA,KAAK,CAACC,UAAN,CAAiBC,KAAjB,0GAAwBC,OAAxB,kFAAiCL,QAAjC,MAA8CM,SAArD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,8BAAT,CAAyCC,aAAzC,EAAyD;AAC/D,MAAK,CAAEA,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,QAAMC,aAAa,GAAG,OAAOD,aAAP,KAAyB,QAA/C;AACA,SAAO;AACNE,IAAA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f,MAzBF,CAFsB;AAuCvBwB,IAAAA,MAAM,EAAE;AAvCe,GAAjB,CAAP;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport useSetting from '../components/use-setting';\nimport { AXIAL_SIDES, SPACING_SUPPORT_KEY, useCustomSides } from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is gap support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasGapSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.blockGap );\n}\n\n/**\n * Checks if there is a current value in the gap block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a gap value set.\n */\nexport function hasGapValue( props ) {\n\treturn props.attributes.style?.spacing?.blockGap !== undefined;\n}\n\n/**\n * Returns a BoxControl object value from a given blockGap style value.\n * The string check is for backwards compatibility before Gutenberg supported\n * split gap values (row and column) and the value was a string n + unit.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @return {Object|null} A value to pass to the BoxControl component.\n */\nexport function getGapBoxControlValueFromStyle( blockGapValue ) {\n\tif ( ! blockGapValue ) {\n\t\treturn null;\n\t}\n\n\tconst isValueString = typeof blockGapValue === 'string';\n\treturn {\n\t\ttop: isValueString ? blockGapValue : blockGapValue?.top,\n\t\tleft: isValueString ? blockGapValue : blockGapValue?.left,\n\t};\n}\n\n/**\n * Returns a CSS value for the `gap` property from a given blockGap style.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @param {string?} defaultValue A default gap value.\n * @return {string|null} The concatenated gap value (row and column).\n */\nexport function getGapCSSValue( blockGapValue, defaultValue = '0' ) {\n\tconst blockGapBoxControlValue =\n\t\tgetGapBoxControlValueFromStyle( blockGapValue );\n\tif ( ! blockGapBoxControlValue ) {\n\t\treturn null;\n\t}\n\n\tconst row =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.top ) || defaultValue;\n\tconst column =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.left ) || defaultValue;\n\n\treturn row === column ? row : `${ row } ${ column }`;\n}\n\n/**\n * Resets the gap block support attribute. This can be used when disabling\n * the gap support controls for a block via a progressive discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetGap( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t},\n\t} );\n}\n\n/**\n * Custom hook that checks if gap settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether the gap setting is disabled.\n */\nexport function useIsGapDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.blockGap' );\n\treturn ! hasGapSupport( blockName ) || isDisabled;\n}\n\n/**\n * Inspector control panel containing the gap related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Gap edit element.\n */\nexport function GapEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes: { style },\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'blockGap' );\n\tconst ref = useBlockRef( clientId );\n\n\tif ( useIsGapDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst onChange = ( next ) => {\n\t\tlet blockGap = next;\n\n\t\t// If splitOnAxis activated we need to return a BoxControl object to the BoxControl component.\n\t\tif ( !! next && splitOnAxis ) {\n\t\t\tblockGap = { ...getGapBoxControlValueFromStyle( next ) };\n\t\t} else if ( next?.hasOwnProperty( 'top' ) ) {\n\t\t\t// If splitOnAxis is not enabled, treat the 'top' value as the shorthand gap value.\n\t\t\tblockGap = next.top;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\n\t\t// In Safari, changing the `gap` CSS value on its own will not trigger the layout\n\t\t// to be recalculated / re-rendered. To force the updated gap to re-render, here\n\t\t// we replace the block's node with itself.\n\t\tconst isSafari =\n\t\t\twindow?.navigator.userAgent &&\n\t\t\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chrome ' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chromium ' );\n\n\t\tif ( ref.current && isSafari ) {\n\t\t\tref.current.parentNode?.replaceChild( ref.current, ref.current );\n\t\t}\n\t};\n\n\tconst gapValue = getGapBoxControlValueFromStyle( style?.spacing?.blockGap );\n\n\t// The BoxControl component expects a full complement of side values.\n\t// Gap row and column values translate to top/bottom and left/right respectively.\n\tconst boxControlGapValue = splitOnAxis\n\t\t? {\n\t\t\t\t...gapValue,\n\t\t\t\tright: gapValue?.left,\n\t\t\t\tbottom: gapValue?.top,\n\t\t }\n\t\t: {\n\t\t\t\ttop: gapValue?.top,\n\t\t };\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) &&\n\t\t\t\t\t( splitOnAxis ? (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\t\tvalues={ boxControlGapValue }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t// Default to `row` for combined values.\n\t\t\t\t\t\t\tvalue={ boxControlGapValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ boxControlGapValue }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tsides={ splitOnAxis ? sides : [ 'top' ] } // Use 'top' as the shorthand property in non-axial configurations.\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["hasGapSupport","blockType","support","SPACING_SUPPORT_KEY","blockGap","hasGapValue","props","attributes","style","spacing","undefined","getGapBoxControlValueFromStyle","blockGapValue","isValueString","top","left","getGapCSSValue","defaultValue","blockGapBoxControlValue","row","column","resetGap","setAttributes","useIsGapDisabled","name","blockName","isDisabled","isInvalid","GapEdit","clientId","spacingSizes","units","availableUnits","sides","ref","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","hasOwnProperty","newStyle","isSafari","window","navigator","userAgent","current","parentNode","replaceChild","gapValue","boxControlGapValue","right","bottom","Platform","select","web","length","native"],"mappings":";;;;;;;;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAzBA;AACA;AACA;;AAUA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,SAAxB,EAAoC;AAC1C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,QAAjC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AAAA;;AACpC,SAAO,0BAAAA,KAAK,CAACC,UAAN,CAAiBC,KAAjB,0GAAwBC,OAAxB,kFAAiCL,QAAjC,MAA8CM,SAArD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,8BAAT,CAAyCC,aAAzC,EAAyD;AAC/D,MAAK,CAAEA,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,QAAMC,aAAa,GAAG,OAAOD,aAAP,KAAyB,QAA/C;AACA,SAAO;AACNE,IAAAA,GAAG,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K,EAAGF,KALT;AAMC,MAAA,UAAU,EAAG,KANd;AAOC,MAAA,WAAW,EAAGI;AAPf,MAzBF,CAFsB;AAuCvBwB,IAAAA,MAAM,EAAE;AAvCe,GAAjB,CAAP;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport useSetting from '../components/use-setting';\nimport {\n\tAXIAL_SIDES,\n\tSPACING_SUPPORT_KEY,\n\tuseCustomSides,\n\tuseIsDimensionsSupportValid,\n} from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is gap support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasGapSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.blockGap );\n}\n\n/**\n * Checks if there is a current value in the gap block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a gap value set.\n */\nexport function hasGapValue( props ) {\n\treturn props.attributes.style?.spacing?.blockGap !== undefined;\n}\n\n/**\n * Returns a BoxControl object value from a given blockGap style value.\n * The string check is for backwards compatibility before Gutenberg supported\n * split gap values (row and column) and the value was a string n + unit.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @return {Object|null} A value to pass to the BoxControl component.\n */\nexport function getGapBoxControlValueFromStyle( blockGapValue ) {\n\tif ( ! blockGapValue ) {\n\t\treturn null;\n\t}\n\n\tconst isValueString = typeof blockGapValue === 'string';\n\treturn {\n\t\ttop: isValueString ? blockGapValue : blockGapValue?.top,\n\t\tleft: isValueString ? blockGapValue : blockGapValue?.left,\n\t};\n}\n\n/**\n * Returns a CSS value for the `gap` property from a given blockGap style.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @param {string?} defaultValue A default gap value.\n * @return {string|null} The concatenated gap value (row and column).\n */\nexport function getGapCSSValue( blockGapValue, defaultValue = '0' ) {\n\tconst blockGapBoxControlValue =\n\t\tgetGapBoxControlValueFromStyle( blockGapValue );\n\tif ( ! blockGapBoxControlValue ) {\n\t\treturn null;\n\t}\n\n\tconst row =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.top ) || defaultValue;\n\tconst column =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.left ) || defaultValue;\n\n\treturn row === column ? row : `${ row } ${ column }`;\n}\n\n/**\n * Resets the gap block support attribute. This can be used when disabling\n * the gap support controls for a block via a progressive discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetGap( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t},\n\t} );\n}\n\n/**\n * Custom hook that checks if gap settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether the gap setting is disabled.\n */\nexport function useIsGapDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.blockGap' );\n\tconst isInvalid = ! useIsDimensionsSupportValid( blockName, 'blockGap' );\n\n\treturn ! hasGapSupport( blockName ) || isDisabled || isInvalid;\n}\n\n/**\n * Inspector control panel containing the gap related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Gap edit element.\n */\nexport function GapEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes: { style },\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'blockGap' );\n\tconst ref = useBlockRef( clientId );\n\n\tif ( useIsGapDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst onChange = ( next ) => {\n\t\tlet blockGap = next;\n\n\t\t// If splitOnAxis activated we need to return a BoxControl object to the BoxControl component.\n\t\tif ( !! next && splitOnAxis ) {\n\t\t\tblockGap = { ...getGapBoxControlValueFromStyle( next ) };\n\t\t} else if ( next?.hasOwnProperty( 'top' ) ) {\n\t\t\t// If splitOnAxis is not enabled, treat the 'top' value as the shorthand gap value.\n\t\t\tblockGap = next.top;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\n\t\t// In Safari, changing the `gap` CSS value on its own will not trigger the layout\n\t\t// to be recalculated / re-rendered. To force the updated gap to re-render, here\n\t\t// we replace the block's node with itself.\n\t\tconst isSafari =\n\t\t\twindow?.navigator.userAgent &&\n\t\t\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chrome ' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chromium ' );\n\n\t\tif ( ref.current && isSafari ) {\n\t\t\tref.current.parentNode?.replaceChild( ref.current, ref.current );\n\t\t}\n\t};\n\n\tconst gapValue = getGapBoxControlValueFromStyle( style?.spacing?.blockGap );\n\n\t// The BoxControl component expects a full complement of side values.\n\t// Gap row and column values translate to top/bottom and left/right respectively.\n\tconst boxControlGapValue = splitOnAxis\n\t\t? {\n\t\t\t\t...gapValue,\n\t\t\t\tright: gapValue?.left,\n\t\t\t\tbottom: gapValue?.top,\n\t\t }\n\t\t: {\n\t\t\t\ttop: gapValue?.top,\n\t\t };\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) &&\n\t\t\t\t\t( splitOnAxis ? (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\t\tvalues={ boxControlGapValue }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t// Default to `row` for combined values.\n\t\t\t\t\t\t\tvalue={ boxControlGapValue }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ boxControlGapValue }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tsides={ splitOnAxis ? sides : [ 'top' ] } // Use 'top' as the shorthand property in non-axial configurations.\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n"]}
@@ -92,6 +92,8 @@ require("./color");
92
92
 
93
93
  require("./duotone");
94
94
 
95
+ require("./font-family");
96
+
95
97
  require("./font-size");
96
98
 
97
99
  require("./border");
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.LINE_HEIGHT_SUPPORT_KEY = void 0;
9
9
  exports.LineHeightEdit = LineHeightEdit;
10
- exports.hasLineHeightValue = hasLineHeightValue;
11
- exports.resetLineHeight = resetLineHeight;
12
10
  exports.useIsLineHeightDisabled = useIsLineHeightDisabled;
13
11
 
14
12
  var _element = require("@wordpress/element");
@@ -83,44 +81,4 @@ function useIsLineHeightDisabled() {
83
81
  const isDisabled = !(0, _useSetting.default)('typography.lineHeight');
84
82
  return !(0, _blocks.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled;
85
83
  }
86
- /**
87
- * Checks if there is a current value set for the line height block support.
88
- *
89
- * @param {Object} props Block props.
90
- * @return {boolean} Whether or not the block has a line height value set.
91
- */
92
-
93
-
94
- function hasLineHeightValue(props) {
95
- var _props$attributes$sty, _props$attributes$sty2;
96
-
97
- return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.lineHeight);
98
- }
99
- /**
100
- * Resets the line height block support attribute. This can be used when
101
- * disabling the line height support controls for a block via a progressive
102
- * discovery panel.
103
- *
104
- * @param {Object} props Block props.
105
- * @param {Object} props.attributes Block's attributes.
106
- * @param {Object} props.setAttributes Function to set block's attributes.
107
- */
108
-
109
-
110
- function resetLineHeight(_ref) {
111
- let {
112
- attributes = {},
113
- setAttributes
114
- } = _ref;
115
- const {
116
- style
117
- } = attributes;
118
- setAttributes({
119
- style: (0, _utils.cleanEmptyObject)({ ...style,
120
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
121
- lineHeight: undefined
122
- }
123
- })
124
- });
125
- }
126
84
  //# sourceMappingURL=line-height.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled","hasLineHeightValue","resetLineHeight","undefined"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,kBAAF,IAA0B;AAC1C,UAAMC,QAAQ,GAAG,EAChB,GAAGJ,KADa;AAEhBK,MAAAA,UAAU,E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X,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEO;AAFD;AAFY,KAAlB;AADO,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'typography.lineHeight' );\n\n\treturn (\n\t\t! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled\n\t);\n}\n\n/**\n * Checks if there is a current value set for the line height block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a line height value set.\n */\nexport function hasLineHeightValue( props ) {\n\treturn !! props.attributes.style?.typography?.lineHeight;\n}\n\n/**\n * Resets the line height block support attribute. This can be used when\n * disabling the line height support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetLineHeight( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,kBAAF,IAA0B;AAC1C,UAAMC,QAAQ,GAAG,EAChB,GAAGJ,KADa;AAEhBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEH;AAFD;AAFI,KAAjB;AAQAF,IAAAA,aAAa,CAAE;AAAED,MAAAA,KAAK,EAAE,6BAAkBI,QAAlB;AAAT,KAAF,CAAb;AACA,GAVD;;AAWA,SACC,4BAAC,0BAAD;AACC,IAAA,oBAAoB,EAAC,MADtB;AAEC,IAAA,uBAAuB,EAAG,IAF3B;AAGC,IAAA,KAAK,EAAGJ,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEK,UAAV,sDAAG,kBAAmBC,UAH5B;AAIC,IAAA,QAAQ,EAAGJ,QAJZ;AAKC,IAAA,IAAI,EAAC;AALN,IADD;AASA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,uBAAT,GAA6D;AAAA,MAA3B;AAAEC,IAAAA,IAAI,EAAEC;AAAR,GAA2B,uEAAL,EAAK;AACnE,QAAMC,UAAU,GAAG,CAAE,yBAAY,uBAAZ,CAArB;AAEA,SACC,CAAE,6BAAiBD,SAAjB,EAA4Bb,uBAA5B,CAAF,IAA2Dc,UAD5D;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'typography.lineHeight' );\n\n\treturn (\n\t\t! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled\n\t);\n}\n"]}
@@ -13,27 +13,25 @@ var _element = require("@wordpress/element");
13
13
 
14
14
  var _blocks = require("@wordpress/blocks");
15
15
 
16
- var _components = require("@wordpress/components");
17
-
18
- var _i18n = require("@wordpress/i18n");
19
-
20
16
  var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
21
17
 
22
- var _fontAppearanceControl = require("../components/font-appearance-control");
18
+ var _typographyPanel = _interopRequireWildcard(require("../components/global-styles/typography-panel"));
23
19
 
24
20
  var _lineHeight = require("./line-height");
25
21
 
26
- var _fontAppearance = require("./font-appearance");
27
-
28
22
  var _fontFamily = require("./font-family");
29
23
 
30
24
  var _fontSize = require("./font-size");
31
25
 
32
- var _textDecoration = require("./text-decoration");
26
+ var _components = require("../components");
33
27
 
34
- var _textTransform = require("./text-transform");
28
+ var _utils = require("./utils");
35
29
 
36
- var _letterSpacing = require("./letter-spacing");
30
+ var _hooks = require("../components/global-styles/hooks");
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
35
 
38
36
  /**
39
37
  * WordPress dependencies
@@ -42,125 +40,118 @@ var _letterSpacing = require("./letter-spacing");
42
40
  /**
43
41
  * Internal dependencies
44
42
  */
43
+ function omit(object, keys) {
44
+ return Object.fromEntries(Object.entries(object).filter(_ref => {
45
+ let [key] = _ref;
46
+ return !keys.includes(key);
47
+ }));
48
+ }
49
+
50
+ const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
51
+ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
52
+ const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
53
+ const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
54
+ const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
45
55
  const TYPOGRAPHY_SUPPORT_KEY = 'typography';
46
56
  exports.TYPOGRAPHY_SUPPORT_KEY = TYPOGRAPHY_SUPPORT_KEY;
47
- const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY, _fontAppearance.FONT_STYLE_SUPPORT_KEY, _fontAppearance.FONT_WEIGHT_SUPPORT_KEY, _fontFamily.FONT_FAMILY_SUPPORT_KEY, _textDecoration.TEXT_DECORATION_SUPPORT_KEY, _textTransform.TEXT_TRANSFORM_SUPPORT_KEY, _letterSpacing.LETTER_SPACING_SUPPORT_KEY];
57
+ const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, _fontFamily.FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
48
58
  exports.TYPOGRAPHY_SUPPORT_KEYS = TYPOGRAPHY_SUPPORT_KEYS;
49
59
 
50
- function TypographyPanel(props) {
51
- const {
52
- clientId
53
- } = props;
54
- const isFontFamilyDisabled = (0, _fontFamily.useIsFontFamilyDisabled)(props);
55
- const isFontSizeDisabled = (0, _fontSize.useIsFontSizeDisabled)(props);
56
- const isFontAppearanceDisabled = (0, _fontAppearance.useIsFontAppearanceDisabled)(props);
57
- const isLineHeightDisabled = (0, _lineHeight.useIsLineHeightDisabled)(props);
58
- const isTextDecorationDisabled = (0, _textDecoration.useIsTextDecorationDisabled)(props);
59
- const isTextTransformDisabled = (0, _textTransform.useIsTextTransformDisabled)(props);
60
- const isLetterSpacingDisabled = (0, _letterSpacing.useIsLetterSpacingDisabled)(props);
61
- const hasFontStyles = !(0, _fontAppearance.useIsFontStyleDisabled)(props);
62
- const hasFontWeights = !(0, _fontAppearance.useIsFontWeightDisabled)(props);
63
- const isDisabled = useIsTypographyDisabled(props);
64
- const isSupported = hasTypographySupport(props.name);
65
- if (isDisabled || !isSupported) return null;
66
- const defaultControls = (0, _blocks.getBlockSupport)(props.name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
67
-
68
- const createResetAllFilter = attribute => newAttributes => {
69
- var _newAttributes$style;
70
-
71
- return { ...newAttributes,
72
- style: { ...newAttributes.style,
73
- typography: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.typography),
74
- [attribute]: undefined
75
- }
60
+ function TypographyInspectorControl(_ref2) {
61
+ let {
62
+ children
63
+ } = _ref2;
64
+ return (0, _element.createElement)(_inspectorControls.default, {
65
+ group: "typography"
66
+ }, children);
67
+ }
68
+
69
+ function useBlockSettings(name) {
70
+ const fontFamilies = (0, _components.useSetting)('typography.fontFamilies');
71
+ const fontSizes = (0, _components.useSetting)('typography.fontSizes');
72
+ const customFontSize = (0, _components.useSetting)('typography.customFontSize');
73
+ const fontStyle = (0, _components.useSetting)('typography.fontStyle');
74
+ const fontWeight = (0, _components.useSetting)('typography.fontWeight');
75
+ const lineHeight = (0, _components.useSetting)('typography.lineHeight');
76
+ const textDecoration = (0, _components.useSetting)('typography.textDecoration');
77
+ const textTransform = (0, _components.useSetting)('typography.textTransform');
78
+ const letterSpacing = (0, _components.useSetting)('typography.letterSpacing');
79
+ const supports = (0, _hooks.useSupportedStyles)(name, null);
80
+ return (0, _element.useMemo)(() => {
81
+ const rawSettings = {
82
+ typography: {
83
+ fontFamilies: {
84
+ custom: fontFamilies
85
+ },
86
+ fontSizes: {
87
+ custom: fontSizes
88
+ },
89
+ customFontSize,
90
+ fontStyle,
91
+ fontWeight,
92
+ lineHeight,
93
+ textDecoration,
94
+ textTransform,
95
+ letterSpacing
76
96
  }
77
97
  };
98
+ return (0, _hooks.overrideSettingsWithSupports)(rawSettings, supports);
99
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textDecoration, textTransform, letterSpacing, supports]);
100
+ }
101
+
102
+ function TypographyPanel(_ref3) {
103
+ let {
104
+ clientId,
105
+ name,
106
+ attributes,
107
+ setAttributes
108
+ } = _ref3;
109
+ const settings = useBlockSettings(name);
110
+ const isEnabled = (0, _typographyPanel.useHasTypographyPanel)(settings);
111
+ const value = (0, _element.useMemo)(() => {
112
+ var _attributes$style, _attributes$style2, _attributes$style2$ty;
113
+
114
+ return { ...attributes.style,
115
+ typography: { ...((_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography),
116
+ fontFamily: attributes.fontFamily ? 'var:preset|font-family|' + attributes.fontFamily : undefined,
117
+ fontSize: attributes.fontSize ? 'var:preset|font-size|' + attributes.fontSize : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize
118
+ }
119
+ };
120
+ }, [attributes.style, attributes.fontSize, attributes.fontFamily]);
121
+
122
+ const onChange = newStyle => {
123
+ var _newStyle$typography, _newStyle$typography2;
124
+
125
+ const updatedStyle = { ...omit(newStyle, ['fontFamily'])
126
+ };
127
+ const fontSizeValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography = newStyle.typography) === null || _newStyle$typography === void 0 ? void 0 : _newStyle$typography.fontSize;
128
+ const fontFamilyValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography2 = newStyle.typography) === null || _newStyle$typography2 === void 0 ? void 0 : _newStyle$typography2.fontFamily;
129
+ const fontSizeSlug = fontSizeValue !== null && fontSizeValue !== void 0 && fontSizeValue.startsWith('var:preset|font-size|') ? fontSizeValue.substring('var:preset|font-size|'.length) : undefined;
130
+ const fontFamilySlug = fontFamilyValue !== null && fontFamilyValue !== void 0 && fontFamilyValue.startsWith('var:preset|font-family|') ? fontFamilyValue.substring('var:preset|font-family|'.length) : undefined;
131
+ updatedStyle.typography = { ...omit(updatedStyle.typography, ['fontFamily']),
132
+ fontSize: fontSizeSlug ? undefined : fontSizeValue
133
+ };
134
+ setAttributes({
135
+ style: (0, _utils.cleanEmptyObject)(updatedStyle),
136
+ fontFamily: fontFamilySlug,
137
+ fontSize: fontSizeSlug
138
+ });
78
139
  };
79
140
 
80
- return (0, _element.createElement)(_inspectorControls.default, {
81
- group: "typography"
82
- }, !isFontFamilyDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
83
- hasValue: () => (0, _fontFamily.hasFontFamilyValue)(props),
84
- label: (0, _i18n.__)('Font family'),
85
- onDeselect: () => (0, _fontFamily.resetFontFamily)(props),
86
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontFamily,
87
- resetAllFilter: newAttributes => ({ ...newAttributes,
88
- fontFamily: undefined
89
- }),
90
- panelId: clientId
91
- }, (0, _element.createElement)(_fontFamily.FontFamilyEdit, props)), !isFontSizeDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
92
- hasValue: () => (0, _fontSize.hasFontSizeValue)(props)
93
- /* translators: Ensure translation is distinct from "Letter case" */
94
- ,
95
- label: (0, _i18n.__)('Font size'),
96
- onDeselect: () => (0, _fontSize.resetFontSize)(props),
97
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontSize,
98
- resetAllFilter: newAttributes => {
99
- var _newAttributes$style2;
100
-
101
- return { ...newAttributes,
102
- fontSize: undefined,
103
- style: { ...newAttributes.style,
104
- typography: { ...((_newAttributes$style2 = newAttributes.style) === null || _newAttributes$style2 === void 0 ? void 0 : _newAttributes$style2.typography),
105
- fontSize: undefined
106
- }
107
- }
108
- };
109
- },
110
- panelId: clientId
111
- }, (0, _element.createElement)(_fontSize.FontSizeEdit, props)), !isFontAppearanceDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
112
- className: "single-column",
113
- hasValue: () => (0, _fontAppearance.hasFontAppearanceValue)(props),
114
- label: (0, _fontAppearanceControl.getFontAppearanceLabel)(hasFontStyles, hasFontWeights),
115
- onDeselect: () => (0, _fontAppearance.resetFontAppearance)(props),
116
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontAppearance,
117
- resetAllFilter: newAttributes => {
118
- var _newAttributes$style3;
119
-
120
- return { ...newAttributes,
121
- style: { ...newAttributes.style,
122
- typography: { ...((_newAttributes$style3 = newAttributes.style) === null || _newAttributes$style3 === void 0 ? void 0 : _newAttributes$style3.typography),
123
- fontStyle: undefined,
124
- fontWeight: undefined
125
- }
126
- }
127
- };
128
- },
129
- panelId: clientId
130
- }, (0, _element.createElement)(_fontAppearance.FontAppearanceEdit, props)), !isLineHeightDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
131
- className: "single-column",
132
- hasValue: () => (0, _lineHeight.hasLineHeightValue)(props),
133
- label: (0, _i18n.__)('Line height'),
134
- onDeselect: () => (0, _lineHeight.resetLineHeight)(props),
135
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.lineHeight,
136
- resetAllFilter: createResetAllFilter('lineHeight'),
137
- panelId: clientId
138
- }, (0, _element.createElement)(_lineHeight.LineHeightEdit, props)), !isLetterSpacingDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
139
- className: "single-column",
140
- hasValue: () => (0, _letterSpacing.hasLetterSpacingValue)(props),
141
- label: (0, _i18n.__)('Letter spacing'),
142
- onDeselect: () => (0, _letterSpacing.resetLetterSpacing)(props),
143
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.letterSpacing,
144
- resetAllFilter: createResetAllFilter('letterSpacing'),
145
- panelId: clientId
146
- }, (0, _element.createElement)(_letterSpacing.LetterSpacingEdit, props)), !isTextDecorationDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
147
- className: "single-column",
148
- hasValue: () => (0, _textDecoration.hasTextDecorationValue)(props),
149
- label: (0, _i18n.__)('Decoration'),
150
- onDeselect: () => (0, _textDecoration.resetTextDecoration)(props),
151
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textDecoration,
152
- resetAllFilter: createResetAllFilter('textDecoration'),
153
- panelId: clientId
154
- }, (0, _element.createElement)(_textDecoration.TextDecorationEdit, props)), !isTextTransformDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
155
- hasValue: () => (0, _textTransform.hasTextTransformValue)(props)
156
- /* translators: Ensure translation is distinct from "Font size" */
157
- ,
158
- label: (0, _i18n.__)('Letter case'),
159
- onDeselect: () => (0, _textTransform.resetTextTransform)(props),
160
- isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textTransform,
161
- resetAllFilter: createResetAllFilter('textTransform'),
162
- panelId: clientId
163
- }, (0, _element.createElement)(_textTransform.TextTransformEdit, props)));
141
+ if (!isEnabled) {
142
+ return null;
143
+ }
144
+
145
+ const defaultControls = (0, _blocks.getBlockSupport)(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
146
+ return (0, _element.createElement)(_typographyPanel.default, {
147
+ as: TypographyInspectorControl,
148
+ panelId: clientId,
149
+ name: name,
150
+ settings: settings,
151
+ value: value,
152
+ onChange: onChange,
153
+ defaultControls: defaultControls
154
+ });
164
155
  }
165
156
 
166
157
  const hasTypographySupport = blockName => {
@@ -168,10 +159,4 @@ const hasTypographySupport = blockName => {
168
159
  };
169
160
 
170
161
  exports.hasTypographySupport = hasTypographySupport;
171
-
172
- function useIsTypographyDisabled() {
173
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
174
- const configs = [(0, _fontAppearance.useIsFontAppearanceDisabled)(props), (0, _fontSize.useIsFontSizeDisabled)(props), (0, _lineHeight.useIsLineHeightDisabled)(props), (0, _fontFamily.useIsFontFamilyDisabled)(props), (0, _textDecoration.useIsTextDecorationDisabled)(props), (0, _textTransform.useIsTextTransformDisabled)(props), (0, _letterSpacing.useIsLetterSpacingDisabled)(props)];
175
- return configs.filter(Boolean).length === configs.length;
176
- }
177
162
  //# sourceMappingURL=typography.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","LETTER_SPACING_SUPPORT_KEY","TypographyPanel","props","clientId","isFontFamilyDisabled","isFontSizeDisabled","isFontAppearanceDisabled","isLineHeightDisabled","isTextDecorationDisabled","isTextTransformDisabled","isLetterSpacingDisabled","hasFontStyles","hasFontWeights","isDisabled","useIsTypographyDisabled","isSupported","hasTypographySupport","name","defaultControls","createResetAllFilter","attribute","newAttributes","style","typography","undefined","fontFamily","fontSize","fontAppearance","fontStyle","fontWeight","lineHeight","letterSpacing","textDecoration","textTransform","blockName","some","key","configs","filter","Boolean","length"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAOA;;AAUA;;AAOA;;AAOA;;AAOA;;AAOA;;AA1DA;AACA;AACA;;AAKA;AACA;AACA;AAyDO,MAAMA,sBAAsB,GAAG,YAA/B;;AACA,MAAMC,uBAAuB,GAAG,CACtCC,mCADsC,EAEtCC,+BAFsC,EAGtCC,sCAHsC,EAItCC,uCAJsC,EAKtCC,mCALsC,EAMtCC,2CANsC,EAOtCC,yCAPsC,EAQtCC,yCARsC,CAAhC;;;AAWA,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAeD,KAArB;AACA,QAAME,oBAAoB,GAAG,yCAAyBF,KAAzB,CAA7B;AACA,QAAMG,kBAAkB,GAAG,qCAAuBH,KAAvB,CAA3B;AACA,QAAMI,wBAAwB,GAAG,iDAA6BJ,KAA7B,CAAjC;AACA,QAAMK,oBAAoB,GAAG,yCAAyBL,KAAzB,CAA7B;AACA,QAAMM,wBAAwB,GAAG,iDAA6BN,KAA7B,CAAjC;AACA,QAAMO,uBAAuB,GAAG,+CAA4BP,KAA5B,CAAhC;AACA,QAAMQ,uBAAuB,GAAG,+CAA4BR,KAA5B,CAAhC;AAEA,QAAMS,aAAa,GAAG,CAAE,4CAAwBT,KAAxB,CAAxB;AACA,QAAMU,cAAc,GAAG,CAAE,6CAAyBV,KAAzB,CAAzB;AAEA,QAAMW,UAAU,GAAGC,uBAAuB,CAAEZ,KAAF,CAA1C;AACA,QAAMa,WAAW,GAAGC,oBAAoB,CAAEd,KAAK,CAACe,IAAR,CAAxC;AAEA,MAAKJ,UAAU,IAAI,CAAEE,WAArB,EAAmC,OAAO,IAAP;AAEnC,QAAMG,eAAe,GAAG,6BAAiBhB,KAAK,CA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AA,UAAU,EAAG,MAAM,uCAAoBA,KAApB,CAJpB;AAKC,IAAA,gBAAgB,EAAGgB,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAEe,aALrC;AAMC,IAAA,cAAc,EAAGd,oBAAoB,CAAE,eAAF,CANtC;AAOC,IAAA,OAAO,EAAGhB;AAPX,KASC,4BAAC,gCAAD,EAAwBD,KAAxB,CATD,CAzGF,CADD;AAwHA;;AAEM,MAAMc,oBAAoB,GAAKkB,SAAF,IAAiB;AACpD,SAAO1C,uBAAuB,CAAC2C,IAAxB,CAAgCC,GAAF,IACpC,6BAAiBF,SAAjB,EAA4BE,GAA5B,CADM,CAAP;AAGA,CAJM;;;;AAMP,SAAStB,uBAAT,GAA+C;AAAA,MAAbZ,KAAa,uEAAL,EAAK;AAC9C,QAAMmC,OAAO,GAAG,CACf,iDAA6BnC,KAA7B,CADe,EAEf,qCAAuBA,KAAvB,CAFe,EAGf,yCAAyBA,KAAzB,CAHe,EAIf,yCAAyBA,KAAzB,CAJe,EAKf,iDAA6BA,KAA7B,CALe,EAMf,+CAA4BA,KAA5B,CANe,EAOf,+CAA4BA,KAA5B,CAPe,CAAhB;AAUA,SAAOmC,OAAO,CAACC,MAAR,CAAgBC,OAAhB,EAA0BC,MAA1B,KAAqCH,OAAO,CAACG,MAApD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { getFontAppearanceLabel } from '../components/font-appearance-control';\n\nimport {\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tLineHeightEdit,\n\thasLineHeightValue,\n\tresetLineHeight,\n\tuseIsLineHeightDisabled,\n} from './line-height';\nimport {\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFontAppearanceEdit,\n\thasFontAppearanceValue,\n\tresetFontAppearance,\n\tuseIsFontAppearanceDisabled,\n\tuseIsFontStyleDisabled,\n\tuseIsFontWeightDisabled,\n} from './font-appearance';\nimport {\n\tFONT_FAMILY_SUPPORT_KEY,\n\tFontFamilyEdit,\n\thasFontFamilyValue,\n\tresetFontFamily,\n\tuseIsFontFamilyDisabled,\n} from './font-family';\nimport {\n\tFONT_SIZE_SUPPORT_KEY,\n\tFontSizeEdit,\n\thasFontSizeValue,\n\tresetFontSize,\n\tuseIsFontSizeDisabled,\n} from './font-size';\nimport {\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTextDecorationEdit,\n\thasTextDecorationValue,\n\tresetTextDecoration,\n\tuseIsTextDecorationDisabled,\n} from './text-decoration';\nimport {\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tTextTransformEdit,\n\thasTextTransformValue,\n\tresetTextTransform,\n\tuseIsTextTransformDisabled,\n} from './text-transform';\nimport {\n\tLETTER_SPACING_SUPPORT_KEY,\n\tLetterSpacingEdit,\n\thasLetterSpacingValue,\n\tresetLetterSpacing,\n\tuseIsLetterSpacingDisabled,\n} from './letter-spacing';\n\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nexport function TypographyPanel( props ) {\n\tconst { clientId } = props;\n\tconst isFontFamilyDisabled = useIsFontFamilyDisabled( props );\n\tconst isFontSizeDisabled = useIsFontSizeDisabled( props );\n\tconst isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );\n\tconst isLineHeightDisabled = useIsLineHeightDisabled( props );\n\tconst isTextDecorationDisabled = useIsTextDecorationDisabled( props );\n\tconst isTextTransformDisabled = useIsTextTransformDisabled( props );\n\tconst isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );\n\n\tconst hasFontStyles = ! useIsFontStyleDisabled( props );\n\tconst hasFontWeights = ! useIsFontWeightDisabled( props );\n\n\tconst isDisabled = useIsTypographyDisabled( props );\n\tconst isSupported = hasTypographySupport( props.name );\n\n\tif ( isDisabled || ! isSupported ) return null;\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\ttypography: {\n\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls group=\"typography\">\n\t\t\t{ ! isFontFamilyDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontFamilyValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\tonDeselect={ () => resetFontFamily( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontFamily }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontFamily: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontSizeDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontSizeValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Letter case\" */\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () => resetFontSize( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontSize }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontSize: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizeEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontAppearanceDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasFontAppearanceValue( props ) }\n\t\t\t\t\tlabel={ getFontAppearanceLabel(\n\t\t\t\t\t\thasFontStyles,\n\t\t\t\t\t\thasFontWeights\n\t\t\t\t\t) }\n\t\t\t\t\tonDeselect={ () => resetFontAppearance( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontAppearance }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontStyle: undefined,\n\t\t\t\t\t\t\t\tfontWeight: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLineHeightDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLineHeightValue( props ) }\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\tonDeselect={ () => resetLineHeight( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.lineHeight }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'lineHeight' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLetterSpacingDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLetterSpacingValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\tonDeselect={ () => resetLetterSpacing( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.letterSpacing }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'letterSpacing' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextDecorationDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextDecorationValue( props ) }\n\t\t\t\t\tlabel={ __( 'Decoration' ) }\n\t\t\t\t\tonDeselect={ () => resetTextDecoration( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textDecoration }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textDecoration' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextTransformDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasTextTransformValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Font size\" */\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\tonDeselect={ () => resetTextTransform( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textTransform }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textTransform' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n\nfunction useIsTypographyDisabled( props = {} ) {\n\tconst configs = [\n\t\tuseIsFontAppearanceDisabled( props ),\n\t\tuseIsFontSizeDisabled( props ),\n\t\tuseIsLineHeightDisabled( props ),\n\t\tuseIsFontFamilyDisabled( props ),\n\t\tuseIsTextDecorationDisabled( props ),\n\t\tuseIsTextTransformDisabled( props ),\n\t\tuseIsLetterSpacingDisabled( props ),\n\t];\n\n\treturn configs.filter( Boolean ).length === configs.length;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","TypographyInspectorControl","children","useBlockSettings","name","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","supports","rawSettings","typography","custom","TypographyPanel","clientId","attributes","setAttributes","settings","isEnabled","value","style","fontFamily","undefined","fontSize","onChange","newStyle","updatedStyle","fontSizeValue","fontFamilyValue","fontSizeSlug","startsWith","substring","length","fontFamilySlug","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AApBA;AACA;AACA;;AAIA;AACA;AACA;AAiBA,SAASA,IAAT,CAAeC,MAAf,EAAuBC,IAAvB,EAA8B;AAC7B,SAAOC,MAAM,CAACC,WAAP,CACND,MAAM,CAACE,OAAP,CAAgBJ,MAAhB,EAAyBK,MAAzB,CAAiC;AAAA,QAAE,CAAEC,GAAF,CAAF;AAAA,WAAe,CAAEL,IAAI,CAACM,QAAL,CAAeD,GAAf,CAAjB;AAAA,GAAjC,CADM,CAAP;AAGA;;AAED,MAAME,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,2BAA2B,GAAG,yCAApC;AACA,MAAMC,sBAAsB,GAAG,oCAA/B;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACO,MAAMC,sBAAsB,GAAG,YAA/B;;AACA,MAAMC,uBAAuB,GAAG,CACtCC,mCADsC,EAEtCC,+BAFsC,EAGtCL,sBAHsC,EAItCC,uBAJsC,EAKtCK,mCALsC,EAMtCP,2BANsC,EAOtCD,0BAPsC,EAQtCD,0BARsC,CAAhC;;;AAWP,SAASU,0BAAT,QAAoD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,SACC,4BAAC,0BAAD;AAAmB,IAAA,KAAK,EAAC;AAAzB,KAAwCA,QAAxC,CADD;AAGA;;AAED,SAASC,gBAAT,CAA2BC,IAA3B,EAAkC;AACjC,QAAMC,YAAY,GAAG,4BAAY,yBAAZ,CAArB;AACA,QAAMC,SAAS,GAAG,4BAAY,sBAAZ,CAAlB;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EACzB,GAAGlC,IAAI,CAAEiD,YAAY,CAACf,UAAf,EAA2B,CAAE,YAAF,CAA3B,CADkB;AAEzBY,MAAAA,QAAQ,EAAEM,YAAY,GAAGP,SAAH,GAAeK;AAFZ,KAA1B;AAIAX,IAAAA,aAAa,CAAE;AACdI,MAAAA,KAAK,EAAE,6BAAkBM,YAAlB,CADO;AAEdL,MAAAA,UAAU,EAAEY,cAFE;AAGdV,MAAAA,QAAQ,EAAEM;AAHI,KAAF,CAAb;AAKA,GAvBD;;AAyBA,MAAK,CAAEX,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMgB,eAAe,GAAG,6BAAiBnC,IAAjB,EAAuB,CAC9CR,sBAD8C,EAE9C,+BAF8C,CAAvB,CAAxB;AAKA,SACC,4BAAC,wBAAD;AACC,IAAA,EAAE,EAAGK,0BADN;AAEC,IAAA,OAAO,EAAGkB,QAFX;AAGC,IAAA,IAAI,EAAGf,IAHR;AAIC,IAAA,QAAQ,EAAGkB,QAJZ;AAKC,IAAA,KAAK,EAAGE,KALT;AAMC,IAAA,QAAQ,EAAGK,QANZ;AAOC,IAAA,eAAe,EAAGU;AAPnB,IADD;AAWA;;AAEM,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAO5C,uBAAuB,CAAC6C,IAAxB,CAAgCrD,GAAF,IACpC,6BAAiBoD,SAAjB,EAA4BpD,GAA5B,CADM,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { useSetting } from '../components';\nimport { cleanEmptyObject } from './utils';\nimport {\n\toverrideSettingsWithSupports,\n\tuseSupportedStyles,\n} from '../components/global-styles/hooks';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction TypographyInspectorControl( { children } ) {\n\treturn (\n\t\t<InspectorControls group=\"typography\">{ children }</InspectorControls>\n\t);\n}\n\nfunction useBlockSettings( name ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst supports = useSupportedStyles( name, null );\n\n\treturn useMemo( () => {\n\t\tconst rawSettings = {\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t};\n\t\treturn overrideSettingsWithSupports( rawSettings, supports );\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tsupports,\n\t] );\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst settings = useBlockSettings( name );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn {\n\t\t\t...attributes.style,\n\t\t\ttypography: {\n\t\t\t\t...attributes.style?.typography,\n\t\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t\t: undefined,\n\t\t\t\tfontSize: attributes.fontSize\n\t\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t\t},\n\t\t};\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tconst updatedStyle = { ...omit( newStyle, [ 'fontFamily' ] ) };\n\t\tconst fontSizeValue = newStyle?.typography?.fontSize;\n\t\tconst fontFamilyValue = newStyle?.typography?.fontFamily;\n\t\tconst fontSizeSlug = fontSizeValue?.startsWith(\n\t\t\t'var:preset|font-size|'\n\t\t)\n\t\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t\t: undefined;\n\t\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t\t'var:preset|font-family|'\n\t\t)\n\t\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t\t: undefined;\n\t\tupdatedStyle.typography = {\n\t\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t\t};\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\t\tfontFamily: fontFamilySlug,\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tname={ name }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
@@ -15,6 +15,8 @@ var _lockUnlock = require("./lock-unlock");
15
15
 
16
16
  var _offCanvasEditor = _interopRequireDefault(require("./components/off-canvas-editor"));
17
17
 
18
+ var _leafMoreMenu = _interopRequireDefault(require("./components/off-canvas-editor/leaf-more-menu"));
19
+
18
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
21
 
20
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -30,6 +32,7 @@ const privateApis = {};
30
32
  exports.privateApis = privateApis;
31
33
  (0, _lockUnlock.lock)(privateApis, { ...globalStyles,
32
34
  ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider,
35
+ LeafMoreMenu: _leafMoreMenu.default,
33
36
  OffCanvasEditor: _offCanvasEditor.default
34
37
  });
35
38
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider","OffCanvasEditor"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;;;;;AANA;AACA;AACA;;AAMA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,eAAe,EAAfA;AAHkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport OffCanvasEditor from './components/off-canvas-editor';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tOffCanvasEditor,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider","LeafMoreMenu","OffCanvasEditor"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,YAAY,EAAZA,qBAHkB;AAIlBC,EAAAA,eAAe,EAAfA;AAJkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport OffCanvasEditor from './components/off-canvas-editor';\nimport LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n} );\n"]}
@@ -154,6 +154,17 @@ const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
154
154
  */
155
155
 
156
156
  const EMPTY_ARRAY = [];
157
+ /**
158
+ * Shared reference to an empty Set for cases where it is important to avoid
159
+ * returning a new Set reference on every invocation, as in a connected or
160
+ * other pure component which performs `shouldComponentUpdate` check on props.
161
+ * This should be used as a last resort, since the normalized data should be
162
+ * maintained by the reducer result in state.
163
+ *
164
+ * @type {Set}
165
+ */
166
+
167
+ const EMPTY_SET = new Set();
157
168
  /**
158
169
  * Returns a block's name given its client ID, or null if no block exists with
159
170
  * the client ID.
@@ -2738,7 +2749,13 @@ function isBlockVisible(state, clientId) {
2738
2749
 
2739
2750
 
2740
2751
  const __unstableGetVisibleBlocks = (0, _rememo.default)(state => {
2741
- return new Set(Object.keys(state.blockVisibility).filter(key => state.blockVisibility[key]));
2752
+ const visibleBlocks = new Set(Object.keys(state.blockVisibility).filter(key => state.blockVisibility[key]));
2753
+
2754
+ if (visibleBlocks.size === 0) {
2755
+ return EMPTY_SET;
2756
+ }
2757
+
2758
+ return visibleBlocks;
2742
2759
  }, state => [state.blockVisibility]);
2743
2760
  /**
2744
2761
  * DO-NOT-USE in production.