@wordpress/block-editor 11.6.0 → 11.7.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 (193) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -0
  3. package/build/components/block-list/block-html.js +1 -3
  4. package/build/components/block-list/block-html.js.map +1 -1
  5. package/build/components/block-preview/auto.js +6 -23
  6. package/build/components/block-preview/auto.js.map +1 -1
  7. package/build/components/editor-styles/index.js +20 -2
  8. package/build/components/editor-styles/index.js.map +1 -1
  9. package/build/components/global-styles/color-panel.js +583 -0
  10. package/build/components/global-styles/color-panel.js.map +1 -0
  11. package/build/components/global-styles/dimensions-panel.js +8 -30
  12. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  13. package/build/components/global-styles/get-block-css-selector.js +129 -0
  14. package/build/components/global-styles/get-block-css-selector.js.map +1 -0
  15. package/build/components/global-styles/hooks.js +53 -1
  16. package/build/components/global-styles/hooks.js.map +1 -1
  17. package/build/components/global-styles/index.js +18 -2
  18. package/build/components/global-styles/index.js.map +1 -1
  19. package/build/components/global-styles/typography-panel.js +9 -35
  20. package/build/components/global-styles/typography-panel.js.map +1 -1
  21. package/build/components/global-styles/use-global-styles-output.js +160 -86
  22. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  23. package/build/components/global-styles/utils.js +2 -1
  24. package/build/components/global-styles/utils.js.map +1 -1
  25. package/build/components/image-size-control/index.js +8 -5
  26. package/build/components/image-size-control/index.js.map +1 -1
  27. package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
  28. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  29. package/build/components/line-height-control/index.js +15 -1
  30. package/build/components/line-height-control/index.js.map +1 -1
  31. package/build/components/list-view/appender.js +105 -0
  32. package/build/components/list-view/appender.js.map +1 -0
  33. package/build/components/list-view/block.js +5 -5
  34. package/build/components/list-view/block.js.map +1 -1
  35. package/build/components/list-view/branch.js +25 -5
  36. package/build/components/list-view/branch.js.map +1 -1
  37. package/build/components/list-view/index.js +37 -13
  38. package/build/components/list-view/index.js.map +1 -1
  39. package/build/components/media-replace-flow/index.js +13 -4
  40. package/build/components/media-replace-flow/index.js.map +1 -1
  41. package/build/components/rich-text/format-edit.js +2 -30
  42. package/build/components/rich-text/format-edit.js.map +1 -1
  43. package/build/components/writing-flow/use-input.js +4 -8
  44. package/build/components/writing-flow/use-input.js.map +1 -1
  45. package/build/hooks/border.js +0 -1
  46. package/build/hooks/border.js.map +1 -1
  47. package/build/hooks/color.js +92 -229
  48. package/build/hooks/color.js.map +1 -1
  49. package/build/hooks/content-lock-ui.js +4 -2
  50. package/build/hooks/content-lock-ui.js.map +1 -1
  51. package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
  52. package/build/hooks/contrast-checker.js.map +1 -0
  53. package/build/hooks/dimensions.js +0 -1
  54. package/build/hooks/dimensions.js.map +1 -1
  55. package/build/hooks/duotone.js +3 -1
  56. package/build/hooks/duotone.js.map +1 -1
  57. package/build/hooks/position.js +2 -2
  58. package/build/hooks/position.js.map +1 -1
  59. package/build/hooks/style.js +23 -26
  60. package/build/hooks/style.js.map +1 -1
  61. package/build/hooks/typography.js +0 -1
  62. package/build/hooks/typography.js.map +1 -1
  63. package/build/hooks/utils.js +25 -76
  64. package/build/hooks/utils.js.map +1 -1
  65. package/build/layouts/grid.js +165 -0
  66. package/build/layouts/grid.js.map +1 -0
  67. package/build/layouts/index.js +3 -1
  68. package/build/layouts/index.js.map +1 -1
  69. package/build/private-apis.js +4 -1
  70. package/build/private-apis.js.map +1 -1
  71. package/build/utils/object.js +76 -0
  72. package/build/utils/object.js.map +1 -0
  73. package/build-module/components/block-list/block-html.js +1 -3
  74. package/build-module/components/block-list/block-html.js.map +1 -1
  75. package/build-module/components/block-preview/auto.js +6 -22
  76. package/build-module/components/block-preview/auto.js.map +1 -1
  77. package/build-module/components/editor-styles/index.js +19 -2
  78. package/build-module/components/editor-styles/index.js.map +1 -1
  79. package/build-module/components/global-styles/color-panel.js +554 -0
  80. package/build-module/components/global-styles/color-panel.js.map +1 -0
  81. package/build-module/components/global-styles/dimensions-panel.js +7 -30
  82. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  83. package/build-module/components/global-styles/get-block-css-selector.js +120 -0
  84. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
  85. package/build-module/components/global-styles/hooks.js +51 -1
  86. package/build-module/components/global-styles/hooks.js.map +1 -1
  87. package/build-module/components/global-styles/index.js +3 -1
  88. package/build-module/components/global-styles/index.js.map +1 -1
  89. package/build-module/components/global-styles/typography-panel.js +8 -35
  90. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  91. package/build-module/components/global-styles/use-global-styles-output.js +161 -87
  92. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  93. package/build-module/components/global-styles/utils.js +2 -1
  94. package/build-module/components/global-styles/utils.js.map +1 -1
  95. package/build-module/components/image-size-control/index.js +8 -5
  96. package/build-module/components/image-size-control/index.js.map +1 -1
  97. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
  98. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  99. package/build-module/components/line-height-control/index.js +15 -1
  100. package/build-module/components/line-height-control/index.js.map +1 -1
  101. package/build-module/components/list-view/appender.js +88 -0
  102. package/build-module/components/list-view/appender.js.map +1 -0
  103. package/build-module/components/list-view/block.js +5 -4
  104. package/build-module/components/list-view/block.js.map +1 -1
  105. package/build-module/components/list-view/branch.js +22 -5
  106. package/build-module/components/list-view/branch.js.map +1 -1
  107. package/build-module/components/list-view/index.js +32 -12
  108. package/build-module/components/list-view/index.js.map +1 -1
  109. package/build-module/components/media-replace-flow/index.js +12 -4
  110. package/build-module/components/media-replace-flow/index.js.map +1 -1
  111. package/build-module/components/rich-text/format-edit.js +3 -31
  112. package/build-module/components/rich-text/format-edit.js.map +1 -1
  113. package/build-module/components/writing-flow/use-input.js +4 -8
  114. package/build-module/components/writing-flow/use-input.js.map +1 -1
  115. package/build-module/hooks/border.js +0 -1
  116. package/build-module/hooks/border.js.map +1 -1
  117. package/build-module/hooks/color.js +90 -232
  118. package/build-module/hooks/color.js.map +1 -1
  119. package/build-module/hooks/content-lock-ui.js +4 -2
  120. package/build-module/hooks/content-lock-ui.js.map +1 -1
  121. package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
  122. package/build-module/hooks/contrast-checker.js.map +1 -0
  123. package/build-module/hooks/dimensions.js +0 -1
  124. package/build-module/hooks/dimensions.js.map +1 -1
  125. package/build-module/hooks/duotone.js +4 -2
  126. package/build-module/hooks/duotone.js.map +1 -1
  127. package/build-module/hooks/position.js +3 -3
  128. package/build-module/hooks/position.js.map +1 -1
  129. package/build-module/hooks/style.js +23 -26
  130. package/build-module/hooks/style.js.map +1 -1
  131. package/build-module/hooks/typography.js +0 -1
  132. package/build-module/hooks/typography.js.map +1 -1
  133. package/build-module/hooks/utils.js +23 -73
  134. package/build-module/hooks/utils.js.map +1 -1
  135. package/build-module/layouts/grid.js +151 -0
  136. package/build-module/layouts/grid.js.map +1 -0
  137. package/build-module/layouts/index.js +2 -1
  138. package/build-module/layouts/index.js.map +1 -1
  139. package/build-module/private-apis.js +3 -1
  140. package/build-module/private-apis.js.map +1 -1
  141. package/build-module/utils/object.js +69 -0
  142. package/build-module/utils/object.js.map +1 -0
  143. package/build-style/style-rtl.css +26 -6
  144. package/build-style/style.css +26 -6
  145. package/package.json +31 -31
  146. package/src/components/block-draggable/content.scss +1 -1
  147. package/src/components/block-list/block-html.js +1 -1
  148. package/src/components/block-preview/auto.js +2 -17
  149. package/src/components/colors-gradients/style.scss +8 -8
  150. package/src/components/editor-styles/index.js +29 -1
  151. package/src/components/global-styles/color-panel.js +706 -0
  152. package/src/components/global-styles/dimensions-panel.js +13 -42
  153. package/src/components/global-styles/get-block-css-selector.js +129 -0
  154. package/src/components/global-styles/hooks.js +80 -0
  155. package/src/components/global-styles/index.js +2 -1
  156. package/src/components/global-styles/test/use-global-styles-output.js +30 -1
  157. package/src/components/global-styles/typography-panel.js +26 -51
  158. package/src/components/global-styles/use-global-styles-output.js +163 -80
  159. package/src/components/global-styles/utils.js +3 -0
  160. package/src/components/image-size-control/index.js +4 -3
  161. package/src/components/image-size-control/test/index.js +2 -2
  162. package/src/components/inner-blocks/README.md +1 -1
  163. package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
  164. package/src/components/line-height-control/index.js +10 -1
  165. package/src/components/list-view/appender.js +101 -0
  166. package/src/components/list-view/block.js +5 -4
  167. package/src/components/list-view/branch.js +30 -1
  168. package/src/components/list-view/index.js +43 -10
  169. package/src/components/list-view/style.scss +19 -0
  170. package/src/components/media-replace-flow/index.js +36 -24
  171. package/src/components/media-replace-flow/style.scss +5 -2
  172. package/src/components/rich-text/format-edit.js +2 -32
  173. package/src/components/writing-flow/use-input.js +4 -5
  174. package/src/hooks/border.js +0 -1
  175. package/src/hooks/color.js +120 -296
  176. package/src/hooks/content-lock-ui.js +6 -2
  177. package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
  178. package/src/hooks/dimensions.js +0 -1
  179. package/src/hooks/duotone.js +8 -5
  180. package/src/hooks/position.js +3 -3
  181. package/src/hooks/style.js +29 -28
  182. package/src/hooks/test/utils.js +0 -104
  183. package/src/hooks/typography.js +0 -1
  184. package/src/hooks/utils.js +27 -70
  185. package/src/layouts/grid.js +172 -0
  186. package/src/layouts/index.js +2 -1
  187. package/src/layouts/test/grid.js +21 -0
  188. package/src/private-apis.js +2 -0
  189. package/src/utils/object.js +69 -0
  190. package/src/utils/test/object.js +107 -0
  191. package/tsconfig.tsbuildinfo +1 -1
  192. package/build/hooks/color-panel.js.map +0 -1
  193. package/build-module/hooks/color-panel.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","rawElementsStyles","elements","elementCssRules","keys","filteredElementsStyles","link","color","undefined","elementName","elementStyles","cssRule","selector","push","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,eAFD,EAGCC,uBAAuB,IAAIC,QAH5B,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,yBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,kBAAT,EAA6BC,WAA7B,QAAgD,UAAhD;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,SAA7C;AACA,SACCC,eADD,EAECC,sBAFD,EAGCC,uBAHD,QAIO,cAJP;AA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F,CAD7B;AAElC,GAAG,GAAGE,iBAAmB,kCAAzB,GAA8D,CAC7DA,iBAD6D,CAF5B;AAKlC,GAAG,GAAGG,sBAAwB,kCAA9B,GAAmE,CAClEA,sBADkE,CALjC;AAQlC,GAAG,GAAGE,sBAAwB,kCAA9B,GAAmE,CAClEA,sBADkE,CARjC;AAWlC,GAAG,GAAGC,mBAAqB,kCAA3B,GAAgE,CAC/DA,mBAD+D;AAX9B,CAAnC;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMuB,0BAA0B,GAAG,EAClC,GAAGD,0BAD+B;AAElC,GAAG,GAAGtB,mBAAqB,EAA3B,GAAgC,CAAE,kBAAF;AAFE,CAAnC;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMwB,eAAe,GAAG;AAAEC,EAAAA,SAAS,EAAE;AAAb,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBR,KAApB,EAA2BS,KAA3B,EAA8D;AAAA,MAA5BC,iBAA4B,uEAAR,KAAQ;;AACpE,MAAK,CAAEV,KAAP,EAAe;AACd,WAAOA,KAAP;AACA;;AAED,MAAIW,QAAQ,GAAGX,KAAf;;AACA,MAAK,CAAEU,iBAAP,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,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\tconst rawElementsStyles = props.attributes.style?.elements;\n\t\t\tconst elementCssRules = [];\n\t\t\tif (\n\t\t\t\trawElementsStyles &&\n\t\t\t\tObject.keys( rawElementsStyles ).length > 0\n\t\t\t) {\n\t\t\t\t// Remove values based on whether serialization has been skipped for a specific style.\n\t\t\t\tconst filteredElementsStyles = {\n\t\t\t\t\t...rawElementsStyles,\n\t\t\t\t\tlink: {\n\t\t\t\t\t\t...rawElementsStyles.link,\n\t\t\t\t\t\tcolor: ! skipLinkColorSerialization\n\t\t\t\t\t\t\t? rawElementsStyles.link?.color\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tfor ( const [ elementName, elementStyles ] of Object.entries(\n\t\t\t\t\tfilteredElementsStyles\n\t\t\t\t) ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t\t\t\t// styles to override element styles because of higher specificity.\n\t\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS[ elementName ] }`,\n\t\t\t\t\t} );\n\t\t\t\t\tif ( !! cssRule ) {\n\t\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0 ? elementCssRules : undefined;\n\t\t}, [ props.attributes.style?.elements ] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","elements","link","undefined","selector","elementCssRules","elementStyles","cssRule","push","join","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,eAFD,EAGCC,uBAAuB,IAAIC,QAH5B,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,yBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,kBAAT,EAA6BC,WAA7B,QAAgD,UAAhD;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,SAA7C;AACA,SACCC,eADD,EAECC,sBAFD,EAGCC,uBAHD,QAIO,cAJP;AAKA,SACCC,sBADD,EAECC,mBAFD,EAGCC,eAHD,QAIO,cAJP;AAKA,OAAOC,uBAAP,MAAoC,0CAApC;AACA,SAASC,uBAAT,QAAwC,SAAxC;AAEA,MAAMC,gBAAgB,GAAG,CACxB,GAAGN,uBADqB,EAExBN,kBAFwB,EAGxBE,iBAHwB,EAIxBK,sBAJwB,EAKxBC,mBALwB,CA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CAA3B,GAAgE,CAC/DA,mBAD+D;AAX9B,CAAnC;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMuB,0BAA0B,GAAG,EAClC,GAAGD,0BAD+B;AAElC,GAAG,GAAGtB,mBAAqB,EAA3B,GAAgC,CAAE,kBAAF;AAFE,CAAnC;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMwB,eAAe,GAAG;AAAEC,EAAAA,SAAS,EAAE;AAAb,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBR,KAApB,EAA2BS,KAA3B,EAA8D;AAAA,MAA5BC,iBAA4B,uEAAR,KAAQ;;AACpE,MAAK,CAAEV,KAAP,EAAe;AACd,WAAOA,KAAP;AACA;;AAED,MAAIW,QAAQ,GAAGX,KAAf;;AACA,MAAK,CAAEU,iBAAP,EAA2B;AAC1BC,IAAAA,QAAQ,GAAGC,IAAI,CAACC,KAAL,CAAYD,IAAI,CAACE,SAAL,CAAgBd,KAAhB,CAAZ,CAAX;AACA;;AAED,MAAK,CAAEe,KAAK,CAACC,OAAN,CAAeP,KAAf,CAAP,EAAgC;AAC/BA,IAAAA,KAAK,GAAG,CAAEA,KAAF,CAAR;AACA;;AAEDA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EAAiB;AAC1CF,UAAAA;AAD0C,SAAjB,CAA1B;AAGAC,QAAAA,eAAe,CAACG,IAAhB,CAAsBD,OAAtB;AACA;AACD;;AACD,WAAOF,eAAe,CAAC1B,MAAhB,GAAyB,CAAzB,GACJ0B,eAAe,CAACI,IAAhB,CAAsB,EAAtB,CADI,GAEJN,SAFH;AAGA,GA9BqB,EA8BnB,2BACFpB,KAAK,CAACxB,UAAN,CAAiBC,KADf,2DACF,uBAAwByC,QADtB,EAEFH,gCAFE,EAGFC,0BAHE,CA9BmB,CAAtB;AAoCA,QAAMW,OAAO,GAAGzF,UAAU,CAAEY,SAAS,CAAC8E,wBAAZ,CAA1B;AAEA,SACC,8BACG3D,MAAM,IACP0D,OADC,IAEDvF,YAAY,CACX;AACC,IAAA,uBAAuB,EAAG;AACzByF,MAAAA,MAAM,EAAE5D;AADiB;AAD3B,IADW,EAMX0D,OANW,CAHd,EAYC,cAAC,cAAD,eACM3B,KADN;AAEC,IAAA,SAAS,EACR,0BAAAA,KAAK,CAACxB,UAAN,CAAiBC,KAAjB,0EAAwByC,QAAxB,GACGjF,UAAU,CACV+D,KAAK,CAAC8B,SADI,EAEVf,gCAFU,CADb,GAKGf,KAAK,CAAC8B;AARX,KAZD,CADD;AA0BA,CA5EmD,CAArD;AA+EAzF,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,YAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0D,YAHQ,CAAT;AAMA1D,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkE,YAHQ,CAAT;AAMAlE,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRqE,iBAHQ,CAAT;AAMArE,SAAS,CACR,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
@@ -110,7 +110,6 @@ export function TypographyPanel(_ref3) {
110
110
  return createElement(StylesTypographyPanel, {
111
111
  as: TypographyInspectorControl,
112
112
  panelId: clientId,
113
- name: name,
114
113
  settings: settings,
115
114
  value: value,
116
115
  onChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onChange","newStyle","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OAAO,IAAIC,qBADZ,EAECC,qBAFD,QAGO,8CAHP;AAKA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,qBAAT,QAAsC,aAAtC;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;;AAEA,SAASC,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,wBAAwB,GAAG,wBAAjC;AACA,MAAMC,sBAAsB,GAAG,oCAA/B;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA,OAAO,MAAMC,sBAAsB,GAAG,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,MAAM;AAC5B,WAAO0C,iBAAiB,CAAE;AACzBb,MAAAA,KAAK,EAAEc,UAAU,CAACd,KADO;AAEzBM,MAAAA,UAAU,EAAEQ,UAAU,CAACR,UAFE;AAGzBF,MAAAA,QAAQ,EAAEU,UAAU,CAACV;AAHI,KAAF,CAAxB;AAKA,GANoB,EAMlB,CAAEU,UAAU,CAACd,KAAb,EAAoBc,UAAU,CAACV,QAA/B,EAAyCU,UAAU,CAACR,UAApD,CANkB,CAArB;;AAQA,QAAMsB,QAAQ,GAAKC,QAAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG7D,eAAe,CAAEqD,IAAF,EAAQ,CAC9CzB,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGkB,0BADN;AAEC,IAAA,OAAO,EAAGM,QAFX;AAGC,IAAA,IAAI,EAAGC,IAHR;AAIC,IAAA,QAAQ,EAAGG,QAJZ;AAKC,IAAA,KAAK,EAAGE,KALT;AAMC,IAAA,QAAQ,EAAGC,QANZ;AAOC,IAAA,eAAe,EAAGE;AAPnB,IADD;AAWA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgC5C,GAAF,IACpCnB,eAAe,CAAE8D,SAAF,EAAa3C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } 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 { cleanEmptyObject, useBlockSettings } from './utils';\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 TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\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_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onChange","newStyle","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA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AExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG7D,eAAe,CAAEqD,IAAF,EAAQ,CAC9CzB,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGkB,0BADN;AAEC,IAAA,OAAO,EAAGM,QAFX;AAGC,IAAA,QAAQ,EAAGI,QAHZ;AAIC,IAAA,KAAK,EAAGE,KAJT;AAKC,IAAA,QAAQ,EAAGC,QALZ;AAMC,IAAA,eAAe,EAAGE;AANnB,IADD;AAUA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgC5C,GAAF,IACpCnB,eAAe,CAAE8D,SAAF,EAAa3C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } 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 { cleanEmptyObject, useBlockSettings } from './utils';\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 TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\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_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\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\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"]}
@@ -14,6 +14,7 @@ import { useMemo } from '@wordpress/element';
14
14
 
15
15
  import { useSetting } from '../components';
16
16
  import { useSettingsForBlockElement } from '../components/global-styles/hooks';
17
+ import { immutableSet } from '../utils/object';
17
18
  /**
18
19
  * Removed falsy values from nested object.
19
20
  *
@@ -32,75 +33,6 @@ export const cleanEmptyObject = object => {
32
33
  }));
33
34
  return isEmpty(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
34
35
  };
35
- /**
36
- * Converts a path to an array of its fragments.
37
- * Supports strings, numbers and arrays:
38
- *
39
- * 'foo' => [ 'foo' ]
40
- * 2 => [ '2' ]
41
- * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]
42
- *
43
- * @param {string|number|Array} path Path
44
- * @return {Array} Normalized path.
45
- */
46
-
47
- function normalizePath(path) {
48
- if (Array.isArray(path)) {
49
- return path;
50
- } else if (typeof path === 'number') {
51
- return [path.toString()];
52
- }
53
-
54
- return [path];
55
- }
56
- /**
57
- * Clones an object.
58
- * Non-object values are returned unchanged.
59
- *
60
- * @param {*} object Object to clone.
61
- * @return {*} Cloned object, or original literal non-object value.
62
- */
63
-
64
-
65
- function cloneObject(object) {
66
- if (typeof object === 'object') {
67
- return { ...Object.fromEntries(Object.entries(object).map(_ref2 => {
68
- let [key, value] = _ref2;
69
- return [key, cloneObject(value)];
70
- }))
71
- };
72
- }
73
-
74
- return object;
75
- }
76
- /**
77
- * Perform an immutable set.
78
- * Handles nullish initial values.
79
- * Clones all nested objects in the specified object.
80
- *
81
- * @param {Object} object Object to set a value in.
82
- * @param {number|string|Array} path Path in the object to modify.
83
- * @param {*} value New value to set.
84
- * @return {Object} Cloned object with the new value set.
85
- */
86
-
87
-
88
- export function immutableSet(object, path, value) {
89
- const normalizedPath = normalizePath(path);
90
- const newObject = object ? cloneObject(object) : {};
91
- normalizedPath.reduce((acc, key, i) => {
92
- if (acc[key] === undefined) {
93
- acc[key] = {};
94
- }
95
-
96
- if (i === normalizedPath.length - 1) {
97
- acc[key] = value;
98
- }
99
-
100
- return acc[key];
101
- }, newObject);
102
- return newObject;
103
- }
104
36
  export function transformStyles(activeSupports, migrationPaths, result, source, index, results) {
105
37
  var _source$;
106
38
 
@@ -134,8 +66,8 @@ export function transformStyles(activeSupports, migrationPaths, result, source,
134
66
  }
135
67
 
136
68
  let returnBlock = result;
137
- Object.entries(activeSupports).forEach(_ref3 => {
138
- let [support, isActive] = _ref3;
69
+ Object.entries(activeSupports).forEach(_ref2 => {
70
+ let [support, isActive] = _ref2;
139
71
 
140
72
  if (isActive) {
141
73
  migrationPaths[support].forEach(path => {
@@ -210,6 +142,14 @@ export function useBlockSettings(name, parentLayout) {
210
142
  const themeColors = useSetting('color.palette.theme');
211
143
  const defaultColors = useSetting('color.palette.default');
212
144
  const defaultPalette = useSetting('color.defaultPalette');
145
+ const userGradientPalette = useSetting('color.gradients.custom');
146
+ const themeGradientPalette = useSetting('color.gradients.theme');
147
+ const defaultGradientPalette = useSetting('color.gradients.default');
148
+ const defaultGradients = useSetting('color.defaultGradients');
149
+ const areCustomGradientsEnabled = useSetting('color.customGradient');
150
+ const isBackgroundEnabled = useSetting('color.background');
151
+ const isLinkEnabled = useSetting('color.link');
152
+ const isTextEnabled = useSetting('color.text');
213
153
  const rawSettings = useMemo(() => {
214
154
  return {
215
155
  color: {
@@ -218,8 +158,18 @@ export function useBlockSettings(name, parentLayout) {
218
158
  theme: themeColors,
219
159
  default: defaultColors
220
160
  },
161
+ gradients: {
162
+ custom: userGradientPalette,
163
+ theme: themeGradientPalette,
164
+ default: defaultGradientPalette
165
+ },
166
+ defaultGradients,
221
167
  defaultPalette,
222
- custom: customColorsEnabled
168
+ custom: customColorsEnabled,
169
+ customGradient: areCustomGradientsEnabled,
170
+ background: isBackgroundEnabled,
171
+ link: isLinkEnabled,
172
+ text: isTextEnabled
223
173
  },
224
174
  typography: {
225
175
  fontFamilies: {
@@ -258,7 +208,7 @@ export function useBlockSettings(name, parentLayout) {
258
208
  layout,
259
209
  parentLayout
260
210
  };
261
- }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, themeColors, defaultColors, defaultPalette]);
211
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, themeColors, defaultColors, defaultPalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
262
212
  return useSettingsForBlockElement(rawSettings, name);
263
213
  }
264
214
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","mapValues","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","filter","value","Boolean","undefined","normalizePath","path","toString","cloneObject","map","key","immutableSet","normalizedPath","newObject","reduce","acc","i","length","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","themeColors","defaultColors","defaultPalette","rawSettings","color","palette","custom","theme","default","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,SAAlB,EAA6BC,GAA7B,QAAwC,QAAxC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,WAAP,CAC5BD,MAAM,CAACE,OAAP,CAAgBb,SAAS,CAAEO,MAAF,EAAUD,gBAAV,CAAzB,EAAwDQ,MAAxD,CACC;AAAA,QAAE,GAAIC,KAAJ,CAAF;AAAA,WAAmBC,OAAO,CAAED,KAAF,CAA1B;AAAA,GADD,CAD4B,CAA7B;AAKA,SAAOhB,OAAO,CAAEW,oBAAF,CAAP,GAAkCO,SAAlC,GAA8CP,oBAArD;AACA,CAdM;AAgBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASQ,aAAT,CAAwBC,IAAxB,EAA+B;AAC9B,MAAKX,KAAK,CAACC,OAAN,CAAeU,IAAf,CAAL,EAA6B;AAC5B,WAAOA,IAAP;AACA,GAFD,MAEO,IAAK,OAAOA,IAAP,KAAgB,QAArB,EAAgC;AACtC,WAAO,CAAEA,IAAI,CAACC,QAAL,EAAF,CAAP;AACA;;AAED,SAAO,CAAED,IAAF,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,WAAT,CAAsBd,MAAtB,EAA+B;AAC9B,MAAK,OAAOA,MAA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AA0BNwB,MAAAA,OAAO,EAAE;AACRpB,QAAAA,YAAY,EAAE;AACbgB,UAAAA,MAAM,EAAEhB;AADK,SADN;AAIRH,QAAAA,OAJQ;AAKRC,QAAAA,MALQ;AAMRC,QAAAA,QANQ;AAORE,QAAAA;AAPQ,OA1BH;AAmCNoB,MAAAA,MAAM,EAAE;AACPP,QAAAA,KAAK,EAAEV,WADA;AAEPkB,QAAAA,MAAM,EAAEjB,YAFD;AAGPkB,QAAAA,KAAK,EAAEjB,WAHA;AAIPkB,QAAAA,KAAK,EAAEjB;AAJA,OAnCF;AAyCNkB,MAAAA,UAAU,EAAE;AACXvB,QAAAA;AADW,OAzCN;AA4CNC,MAAAA,MA5CM;AA6CNjB,MAAAA;AA7CM,KAAP;AA+CA,GAhD0B,EAgDxB,CACFC,YADE,EAEFC,SAFE,EAGFC,cAHE,EAIFC,SAJE,EAKFC,UALE,EAMFC,UANE,EAOFC,WAPE,EAQFC,cARE,EASFC,aATE,EAUFC,aAVE,EAWFC,OAXE,EAYFC,MAZE,EAaFC,QAbE,EAcFC,YAdE,EAeFC,KAfE,EAgBFC,SAhBE,EAiBFC,MAjBE,EAkBFjB,YAlBE,EAmBFkB,WAnBE,EAoBFC,YApBE,EAqBFC,WArBE,EAsBFC,WAtBE,EAuBFC,mBAvBE,EAwBFC,YAxBE,EAyBFC,WAzBE,EA0BFC,aA1BE,EA2BFC,cA3BE,CAhDwB,CAA3B;AA8EA,SAAO9E,0BAA0B,CAAE+E,WAAF,EAAe5B,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, mapValues, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( mapValues( object, cleanEmptyObject ) ).filter(\n\t\t\t( [ , value ] ) => Boolean( value )\n\t\t)\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\n/**\n * Converts a path to an array of its fragments.\n * Supports strings, numbers and arrays:\n *\n * 'foo' => [ 'foo' ]\n * 2 => [ '2' ]\n * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]\n *\n * @param {string|number|Array} path Path\n * @return {Array} Normalized path.\n */\nfunction normalizePath( path ) {\n\tif ( Array.isArray( path ) ) {\n\t\treturn path;\n\t} else if ( typeof path === 'number' ) {\n\t\treturn [ path.toString() ];\n\t}\n\n\treturn [ path ];\n}\n\n/**\n * Clones an object.\n * Non-object values are returned unchanged.\n *\n * @param {*} object Object to clone.\n * @return {*} Cloned object, or original literal non-object value.\n */\nfunction cloneObject( object ) {\n\tif ( typeof object === 'object' ) {\n\t\treturn {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tcloneObject( value ),\n\t\t\t\t] )\n\t\t\t),\n\t\t};\n\t}\n\n\treturn object;\n}\n\n/**\n * Perform an immutable set.\n * Handles nullish initial values.\n * Clones all nested objects in the specified object.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function immutableSet( object, path, value ) {\n\tconst normalizedPath = normalizePath( path );\n\tconst newObject = object ? cloneObject( object ) : {};\n\n\tnormalizedPath.reduce( ( acc, key, i ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tacc[ key ] = {};\n\t\t}\n\t\tif ( i === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, newObject );\n\n\treturn newObject;\n}\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\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 textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tdefaultPalette,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t},\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\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","mapValues","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","immutableSet","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","filter","value","Boolean","undefined","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","themeColors","defaultColors","defaultPalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,SAAlB,EAA6BC,GAA7B,QAAwC,QAAxC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAA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gGA,SAAO5E,0BAA0B,CAAE6E,WAAF,EAAepC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, mapValues, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { immutableSet } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( mapValues( object, cleanEmptyObject ) ).filter(\n\t\t\t( [ , value ] ) => Boolean( value )\n\t\t)\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\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 textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\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\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
@@ -0,0 +1,151 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { BaseControl, Flex, FlexItem, RangeControl, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+
12
+ import { appendSelectors, getBlockGapCSS } from './utils';
13
+ import { getGapCSSValue } from '../hooks/gap';
14
+ import { shouldSkipSerialization } from '../hooks/utils';
15
+ const RANGE_CONTROL_MAX_VALUES = {
16
+ px: 600,
17
+ '%': 100,
18
+ vw: 100,
19
+ vh: 100,
20
+ em: 38,
21
+ rem: 38
22
+ };
23
+ export default {
24
+ name: 'grid',
25
+ label: __('Grid'),
26
+ inspectorControls: function GridLayoutInspectorControls(_ref) {
27
+ let {
28
+ layout = {},
29
+ onChange
30
+ } = _ref;
31
+ return createElement(GridLayoutMinimumWidthControl, {
32
+ layout: layout,
33
+ onChange: onChange
34
+ });
35
+ },
36
+ toolBarControls: function DefaultLayoutToolbarControls() {
37
+ return null;
38
+ },
39
+ getLayoutStyle: function getLayoutStyle(_ref2) {
40
+ var _style$spacing, _style$spacing2;
41
+
42
+ let {
43
+ selector,
44
+ layout,
45
+ style,
46
+ blockName,
47
+ hasBlockGapSupport,
48
+ layoutDefinitions
49
+ } = _ref2;
50
+ const {
51
+ minimumColumnWidth = '12rem'
52
+ } = layout; // If a block's block.json skips serialization for spacing or spacing.blockGap,
53
+ // don't apply the user-defined value to the styles.
54
+
55
+ const blockGapValue = style !== null && style !== void 0 && (_style$spacing = style.spacing) !== null && _style$spacing !== void 0 && _style$spacing.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing2 = style.spacing) === null || _style$spacing2 === void 0 ? void 0 : _style$spacing2.blockGap, '0.5em') : undefined;
56
+ let output = '';
57
+ const rules = [];
58
+
59
+ if (minimumColumnWidth) {
60
+ rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`);
61
+ }
62
+
63
+ if (rules.length) {
64
+ // Reason to disable: the extra line breaks added by prettier mess with the unit tests.
65
+ // eslint-disable-next-line prettier/prettier
66
+ output = `${appendSelectors(selector)} { ${rules.join('; ')}; }`;
67
+ } // Output blockGap styles based on rules contained in layout definitions in theme.json.
68
+
69
+
70
+ if (hasBlockGapSupport && blockGapValue) {
71
+ output += getBlockGapCSS(selector, layoutDefinitions, 'grid', blockGapValue);
72
+ }
73
+
74
+ return output;
75
+ },
76
+
77
+ getOrientation() {
78
+ return 'horizontal';
79
+ },
80
+
81
+ getAlignments() {
82
+ return [];
83
+ }
84
+
85
+ }; // Enables setting minimum width of grid items.
86
+
87
+ function GridLayoutMinimumWidthControl(_ref3) {
88
+ let {
89
+ layout,
90
+ onChange
91
+ } = _ref3;
92
+ const {
93
+ minimumColumnWidth: value = '12rem'
94
+ } = layout;
95
+ const [quantity, unit] = parseQuantityAndUnitFromRawValue(value);
96
+
97
+ const handleSliderChange = next => {
98
+ onChange({ ...layout,
99
+ minimumColumnWidth: [next, unit].join('')
100
+ });
101
+ }; // Mostly copied from HeightControl.
102
+
103
+
104
+ const handleUnitChange = newUnit => {
105
+ // Attempt to smooth over differences between currentUnit and newUnit.
106
+ // This should slightly improve the experience of switching between unit types.
107
+ let newValue;
108
+
109
+ if (['em', 'rem'].includes(newUnit) && unit === 'px') {
110
+ // Convert pixel value to an approximate of the new unit, assuming a root size of 16px.
111
+ newValue = (quantity / 16).toFixed(2) + newUnit;
112
+ } else if (['em', 'rem'].includes(unit) && newUnit === 'px') {
113
+ // Convert to pixel value assuming a root size of 16px.
114
+ newValue = Math.round(quantity * 16) + newUnit;
115
+ } else if (['vh', 'vw', '%'].includes(newUnit) && quantity > 100) {
116
+ // When converting to `vh`, `vw`, or `%` units, cap the new value at 100.
117
+ newValue = 100 + newUnit;
118
+ }
119
+
120
+ onChange({ ...layout,
121
+ minimumColumnWidth: newValue
122
+ });
123
+ };
124
+
125
+ return createElement("fieldset", null, createElement(BaseControl.VisualLabel, {
126
+ as: "legend"
127
+ }, __('Minimum column width')), createElement(Flex, {
128
+ gap: 4
129
+ }, createElement(FlexItem, {
130
+ isBlock: true
131
+ }, createElement(UnitControl, {
132
+ size: '__unstable-large',
133
+ onChange: newValue => {
134
+ onChange({ ...layout,
135
+ minimumColumnWidth: newValue
136
+ });
137
+ },
138
+ onUnitChange: handleUnitChange,
139
+ value: value,
140
+ min: 0
141
+ })), createElement(FlexItem, {
142
+ isBlock: true
143
+ }, createElement(RangeControl, {
144
+ onChange: handleSliderChange,
145
+ value: quantity,
146
+ min: 0,
147
+ max: RANGE_CONTROL_MAX_VALUES[unit] || 600,
148
+ withInputField: false
149
+ }))));
150
+ }
151
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/grid.js"],"names":["__","BaseControl","Flex","FlexItem","RangeControl","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","appendSelectors","getBlockGapCSS","getGapCSSValue","shouldSkipSerialization","RANGE_CONTROL_MAX_VALUES","px","vw","vh","em","rem","name","label","inspectorControls","GridLayoutInspectorControls","layout","onChange","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","blockGapValue","spacing","blockGap","undefined","output","rules","push","length","join","getOrientation","getAlignments","GridLayoutMinimumWidthControl","value","quantity","unit","handleSliderChange","next","handleUnitChange","newUnit","newValue","includes","toFixed","Math","round"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA,SACCC,WADD,EAECC,IAFD,EAGCC,QAHD,EAICC,YAJD,EAKCC,yBAAyB,IAAIC,WAL9B,EAMCC,8CAA8C,IAAIC,gCANnD,QAOO,uBAPP;AASA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,cAA1B,QAAgD,SAAhD;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,MAAMC,wBAAwB,GAAG;AAChCC,EAAAA,EAAE,EAAE,GAD4B;AAEhC,OAAK,GAF2B;AAGhCC,EAAAA,EAAE,EAAE,GAH4B;AAIhCC,EAAAA,EAAE,EAAE,GAJ4B;AAKhCC,EAAAA,EAAE,EAAE,EAL4B;AAMhCC,EAAAA,GAAG,EAAE;AAN2B,CAAjC;AASA,eAAe;AACdC,EAAAA,IAAI,EAAE,MADQ;AAEdC,EAAAA,KAAK,EAAEpB,EAAE,CAAE,MAAF,CAFK;AAGdqB,EAAAA,iBAAiB,EAAE,SAASC,2BAAT,OAGf;AAAA,QAHqD;AACxDC,MAAAA,MAAM,GAAG,EAD+C;AAExDC,MAAAA;AAFwD,KAGrD;AACH,WACC,cAAC,6BAAD;AACC,MAAA,MAAM,EAAGD,MADV;AAEC,MAAA,QAAQ,EAAGC;AAFZ,MADD;AAMA,GAba;AAcdC,EAAAA,eAAe,EAAE,SAASC,4BAAT,GAAwC;AACxD,WAAO,IAAP;AACA,GAhBa;AAiBdC,EAAAA,cAAc,EAAE,SAASA,cAAT,QAOZ;AAAA;;AAAA,QAPqC;AACxCC,MAAAA,QADwC;AAExCL,MAAAA,MAFwC;AAGxCM,MAAAA,KAHwC;AAIxCC,MAAAA,SAJwC;AAKxCC,MAAAA,kBALwC;AAMxCC,MAAAA;AANwC,KAOrC;AACH,UAAM;AAAEC,MAAAA,kBAAkB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AAA,IAAI,EAAG,kBADR;AAEC,IAAA,QAAQ,EAAKqD,QAAF,IAAgB;AAC1B7B,MAAAA,QAAQ,CAAE,EACT,GAAGD,MADM;AAETU,QAAAA,kBAAkB,EAAEoB;AAFX,OAAF,CAAR;AAIA,KAPF;AAQC,IAAA,YAAY,EAAGF,gBARhB;AASC,IAAA,KAAK,EAAGL,KATT;AAUC,IAAA,GAAG,EAAG;AAVP,IADD,CADD,EAeC,cAAC,QAAD;AAAU,IAAA,OAAO;AAAjB,KACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGG,kBADZ;AAEC,IAAA,KAAK,EAAGF,QAFT;AAGC,IAAA,GAAG,EAAG,CAHP;AAIC,IAAA,GAAG,EAAGlC,wBAAwB,CAAEmC,IAAF,CAAxB,IAAoC,GAJ3C;AAKC,IAAA,cAAc,EAAG;AALlB,IADD,CAfD,CAJD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n};\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t} ) {\n\t\treturn (\n\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\tlayout={ layout }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { minimumColumnWidth = '12rem' } = layout;\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( minimumColumnWidth ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${ minimumColumnWidth }, 100%), 1fr))`\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\t// Reason to disable: the extra line breaks added by prettier mess with the unit tests.\n\t\t\t// eslint-disable-next-line prettier/prettier\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\n\t\t\t\t'; '\n\t\t\t) }; }`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth: value = '12rem' } = layout;\n\tconst [ quantity, unit ] = parseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t} else if (\n\t\t\t[ 'vh', 'vw', '%' ].includes( newUnit ) &&\n\t\t\tquantity > 100\n\t\t) {\n\t\t\t// When converting to `vh`, `vw`, or `%` units, cap the new value at 100.\n\t\t\tnewValue = 100 + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Minimum column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth: newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</fieldset>\n\t);\n}\n"]}
@@ -4,7 +4,8 @@
4
4
  import flex from './flex';
5
5
  import flow from './flow';
6
6
  import constrained from './constrained';
7
- const layoutTypes = [flow, flex, constrained];
7
+ import grid from './grid';
8
+ const layoutTypes = [flow, flex, constrained, grid];
8
9
  /**
9
10
  * Retrieves a layout type by name.
10
11
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["flex","flow","constrained","layoutTypes","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,MAAMC,WAAW,GAAG,CAAEF,IAAF,EAAQD,IAAR,EAAcE,WAAd,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOF,WAAW,CAACG,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,GAA0B;AAChC,SAAOL,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\nimport constrained from './constrained';\n\nconst layoutTypes = [ flow, flex, constrained ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["flex","flow","constrained","grid","layoutTypes","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAMC,WAAW,GAAG,CAAEH,IAAF,EAAQD,IAAR,EAAcE,WAAd,EAA2BC,IAA3B,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOF,WAAW,CAACG,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,GAA0B;AAChC,SAAOL,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\nimport constrained from './constrained';\nimport grid from './grid';\n\nconst layoutTypes = [ flow, flex, constrained, grid ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}
@@ -7,6 +7,7 @@ import { lock } from './lock-unlock';
7
7
  import OffCanvasEditor from './components/off-canvas-editor';
8
8
  import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
9
9
  import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
10
+ import { PrivateListView } from './components/list-view';
10
11
  /**
11
12
  * Private @wordpress/block-editor APIs.
12
13
  */
@@ -16,6 +17,7 @@ lock(privateApis, { ...globalStyles,
16
17
  ExperimentalBlockEditorProvider,
17
18
  LeafMoreMenu,
18
19
  OffCanvasEditor,
19
- PrivateInserter
20
+ PrivateInserter,
21
+ PrivateListView
20
22
  });
21
23
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ComposedPrivateInserter","PrivateInserter","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,YAAP,MAAyB,+CAAzB;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPL,IAAI,CAAEK,WAAF,EAAe,EAClB,GAAGP,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA,eAJkB;AAKlBG,EAAAA;AALkB,CAAf,CAAJ","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';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n\tPrivateInserter,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ComposedPrivateInserter","PrivateInserter","PrivateListView","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,YAAP,MAAyB,+CAAzB;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPN,IAAI,CAAEM,WAAF,EAAe,EAClB,GAAGR,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA,eAJkB;AAKlBG,EAAAA,eALkB;AAMlBC,EAAAA;AANkB,CAAf,CAAJ","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';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n\tPrivateInserter,\n\tPrivateListView,\n} );\n"]}