@wordpress/block-editor 11.8.0 → 12.0.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 (216) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +15 -3
  3. package/build/components/block-info-slot-fill/index.js +47 -0
  4. package/build/components/block-info-slot-fill/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -2
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-list/block.native.js +3 -4
  8. package/build/components/block-list/block.native.js.map +1 -1
  9. package/build/components/block-toolbar/index.js +2 -1
  10. package/build/components/block-toolbar/index.js.map +1 -1
  11. package/build/components/block-tools/block-contextual-toolbar.js +83 -9
  12. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  13. package/build/components/block-tools/selected-block-popover.js +11 -28
  14. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  15. package/build/components/editor-styles/index.js +4 -3
  16. package/build/components/editor-styles/index.js.map +1 -1
  17. package/build/components/font-sizes/fluid-utils.js +21 -14
  18. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  19. package/build/components/global-styles/border-panel.js +2 -32
  20. package/build/components/global-styles/border-panel.js.map +1 -1
  21. package/build/components/global-styles/color-panel.js +12 -12
  22. package/build/components/global-styles/color-panel.js.map +1 -1
  23. package/build/components/global-styles/color-panel.native.js +174 -0
  24. package/build/components/global-styles/color-panel.native.js.map +1 -0
  25. package/build/components/global-styles/dimensions-panel.js +6 -6
  26. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  27. package/build/components/global-styles/effects-panel.js +1 -1
  28. package/build/components/global-styles/effects-panel.js.map +1 -1
  29. package/build/components/global-styles/filters-panel.js +78 -14
  30. package/build/components/global-styles/filters-panel.js.map +1 -1
  31. package/build/components/global-styles/typography-panel.js +9 -9
  32. package/build/components/global-styles/typography-panel.js.map +1 -1
  33. package/build/components/global-styles/use-global-styles-output.js +87 -77
  34. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  35. package/build/components/index.js +7 -0
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/inserter/block-types-tab.js +12 -7
  38. package/build/components/inserter/block-types-tab.js.map +1 -1
  39. package/build/components/inserter/index.js +2 -1
  40. package/build/components/inserter/index.js.map +1 -1
  41. package/build/components/inspector-controls/groups.js +2 -0
  42. package/build/components/inspector-controls/groups.js.map +1 -1
  43. package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
  44. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  45. package/build/components/list-view/block-select-button.js +7 -2
  46. package/build/components/list-view/block-select-button.js.map +1 -1
  47. package/build/components/list-view/block.js +12 -21
  48. package/build/components/list-view/block.js.map +1 -1
  49. package/build/components/list-view/drop-indicator.js +37 -10
  50. package/build/components/list-view/drop-indicator.js.map +1 -1
  51. package/build/components/list-view/index.js +10 -4
  52. package/build/components/list-view/index.js.map +1 -1
  53. package/build/components/list-view/leaf.js +2 -1
  54. package/build/components/list-view/leaf.js.map +1 -1
  55. package/build/components/list-view/use-block-selection.js +1 -1
  56. package/build/components/list-view/use-block-selection.js.map +1 -1
  57. package/build/components/media-replace-flow/index.js +5 -5
  58. package/build/components/media-replace-flow/index.js.map +1 -1
  59. package/build/components/navigable-toolbar/index.js +12 -4
  60. package/build/components/navigable-toolbar/index.js.map +1 -1
  61. package/build/components/off-canvas-editor/appender.js +2 -7
  62. package/build/components/off-canvas-editor/appender.js.map +1 -1
  63. package/build/hooks/duotone.js +29 -4
  64. package/build/hooks/duotone.js.map +1 -1
  65. package/build/hooks/utils.js +15 -3
  66. package/build/hooks/utils.js.map +1 -1
  67. package/build/private-apis.js +10 -1
  68. package/build/private-apis.js.map +1 -1
  69. package/build/store/actions.js +7 -0
  70. package/build/store/actions.js.map +1 -1
  71. package/build/utils/object.js +5 -5
  72. package/build/utils/object.js.map +1 -1
  73. package/build/utils/transform-styles/index.js +2 -2
  74. package/build/utils/transform-styles/index.js.map +1 -1
  75. package/build/utils/use-should-contextual-toolbar-show.js +68 -0
  76. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
  77. package/build-module/components/block-info-slot-fill/index.js +34 -0
  78. package/build-module/components/block-info-slot-fill/index.js.map +1 -0
  79. package/build-module/components/block-inspector/index.js +3 -2
  80. package/build-module/components/block-inspector/index.js.map +1 -1
  81. package/build-module/components/block-list/block.native.js +3 -4
  82. package/build-module/components/block-list/block.native.js.map +1 -1
  83. package/build-module/components/block-toolbar/index.js +2 -1
  84. package/build-module/components/block-toolbar/index.js.map +1 -1
  85. package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
  86. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  87. package/build-module/components/block-tools/selected-block-popover.js +10 -27
  88. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  89. package/build-module/components/editor-styles/index.js +4 -3
  90. package/build-module/components/editor-styles/index.js.map +1 -1
  91. package/build-module/components/font-sizes/fluid-utils.js +21 -14
  92. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  93. package/build-module/components/global-styles/border-panel.js +2 -32
  94. package/build-module/components/global-styles/border-panel.js.map +1 -1
  95. package/build-module/components/global-styles/color-panel.js +13 -13
  96. package/build-module/components/global-styles/color-panel.js.map +1 -1
  97. package/build-module/components/global-styles/color-panel.native.js +150 -0
  98. package/build-module/components/global-styles/color-panel.native.js.map +1 -0
  99. package/build-module/components/global-styles/dimensions-panel.js +7 -7
  100. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  101. package/build-module/components/global-styles/effects-panel.js +2 -2
  102. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  103. package/build-module/components/global-styles/filters-panel.js +78 -16
  104. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  105. package/build-module/components/global-styles/typography-panel.js +10 -10
  106. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  107. package/build-module/components/global-styles/use-global-styles-output.js +87 -77
  108. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  109. package/build-module/components/index.js +1 -1
  110. package/build-module/components/index.js.map +1 -1
  111. package/build-module/components/inserter/block-types-tab.js +12 -6
  112. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  113. package/build-module/components/inserter/index.js +2 -1
  114. package/build-module/components/inserter/index.js.map +1 -1
  115. package/build-module/components/inspector-controls/groups.js +2 -0
  116. package/build-module/components/inspector-controls/groups.js.map +1 -1
  117. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
  118. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  119. package/build-module/components/list-view/block-select-button.js +7 -2
  120. package/build-module/components/list-view/block-select-button.js.map +1 -1
  121. package/build-module/components/list-view/block.js +14 -22
  122. package/build-module/components/list-view/block.js.map +1 -1
  123. package/build-module/components/list-view/drop-indicator.js +36 -10
  124. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  125. package/build-module/components/list-view/index.js +11 -5
  126. package/build-module/components/list-view/index.js.map +1 -1
  127. package/build-module/components/list-view/leaf.js +2 -1
  128. package/build-module/components/list-view/leaf.js.map +1 -1
  129. package/build-module/components/list-view/use-block-selection.js +1 -1
  130. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  131. package/build-module/components/media-replace-flow/index.js +5 -5
  132. package/build-module/components/media-replace-flow/index.js.map +1 -1
  133. package/build-module/components/navigable-toolbar/index.js +12 -4
  134. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  135. package/build-module/components/off-canvas-editor/appender.js +1 -5
  136. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  137. package/build-module/hooks/duotone.js +28 -5
  138. package/build-module/hooks/duotone.js.map +1 -1
  139. package/build-module/hooks/utils.js +16 -4
  140. package/build-module/hooks/utils.js.map +1 -1
  141. package/build-module/private-apis.js +7 -1
  142. package/build-module/private-apis.js.map +1 -1
  143. package/build-module/store/actions.js +7 -0
  144. package/build-module/store/actions.js.map +1 -1
  145. package/build-module/utils/object.js +4 -4
  146. package/build-module/utils/object.js.map +1 -1
  147. package/build-module/utils/transform-styles/index.js +2 -2
  148. package/build-module/utils/transform-styles/index.js.map +1 -1
  149. package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
  150. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
  151. package/build-style/content-rtl.css +9 -6
  152. package/build-style/content.css +9 -6
  153. package/build-style/style-rtl.css +223 -46
  154. package/build-style/style.css +223 -46
  155. package/package.json +32 -32
  156. package/src/components/block-info-slot-fill/index.js +24 -0
  157. package/src/components/block-inspector/index.js +3 -0
  158. package/src/components/block-list/block.native.js +2 -3
  159. package/src/components/block-list/content.scss +16 -15
  160. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
  161. package/src/components/block-mover/style.scss +10 -4
  162. package/src/components/block-mover/test/index.native.js +4 -4
  163. package/src/components/block-toolbar/index.js +4 -3
  164. package/src/components/block-toolbar/style.scss +56 -33
  165. package/src/components/block-tools/block-contextual-toolbar.js +94 -11
  166. package/src/components/block-tools/selected-block-popover.js +11 -44
  167. package/src/components/block-tools/style.scss +157 -3
  168. package/src/components/editor-styles/index.js +9 -5
  169. package/src/components/font-sizes/fluid-utils.js +31 -14
  170. package/src/components/font-sizes/test/fluid-utils.js +5 -16
  171. package/src/components/global-styles/border-panel.js +1 -30
  172. package/src/components/global-styles/color-panel.js +13 -13
  173. package/src/components/global-styles/color-panel.native.js +207 -0
  174. package/src/components/global-styles/dimensions-panel.js +17 -7
  175. package/src/components/global-styles/effects-panel.js +2 -2
  176. package/src/components/global-styles/filters-panel.js +90 -17
  177. package/src/components/global-styles/style.scss +2 -1
  178. package/src/components/global-styles/test/typography-utils.js +63 -22
  179. package/src/components/global-styles/test/use-global-styles-output.js +126 -4
  180. package/src/components/global-styles/typography-panel.js +37 -11
  181. package/src/components/global-styles/use-global-styles-output.js +64 -64
  182. package/src/components/index.js +1 -0
  183. package/src/components/inserter/block-types-tab.js +9 -6
  184. package/src/components/inserter/index.js +1 -1
  185. package/src/components/inspector-controls/groups.js +2 -0
  186. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  187. package/src/components/list-view/block-select-button.js +6 -1
  188. package/src/components/list-view/block.js +23 -31
  189. package/src/components/list-view/drop-indicator.js +67 -22
  190. package/src/components/list-view/index.js +8 -1
  191. package/src/components/list-view/leaf.js +1 -0
  192. package/src/components/list-view/style.scss +15 -3
  193. package/src/components/list-view/use-block-selection.js +1 -1
  194. package/src/components/media-replace-flow/README.md +3 -2
  195. package/src/components/media-replace-flow/index.js +4 -5
  196. package/src/components/navigable-toolbar/index.js +12 -3
  197. package/src/components/off-canvas-editor/appender.js +1 -4
  198. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  199. package/src/hooks/duotone.js +46 -25
  200. package/src/hooks/test/anchor.js +113 -0
  201. package/src/hooks/test/color.js +0 -9
  202. package/src/hooks/test/use-typography-props.js +2 -2
  203. package/src/hooks/test/utils.js +20 -101
  204. package/src/hooks/utils.js +20 -3
  205. package/src/private-apis.js +6 -0
  206. package/src/store/actions.js +7 -0
  207. package/src/utils/object.js +4 -4
  208. package/src/utils/test/object.js +21 -21
  209. package/src/utils/transform-styles/index.js +2 -2
  210. package/src/utils/use-should-contextual-toolbar-show.js +75 -0
  211. package/tsconfig.json +1 -0
  212. package/build/hooks/color-panel.native.js +0 -77
  213. package/build/hooks/color-panel.native.js.map +0 -1
  214. package/build-module/hooks/color-panel.native.js +0 -62
  215. package/build-module/hooks/color-panel.native.js.map +0 -1
  216. package/src/hooks/color-panel.native.js +0 -63
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","useSelect","BlockControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","store","blockEditorStore","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","style","duotoneStyle","color","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","newDuotone","maybePreset","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","isContentLocked","select","__unstableGetContentLockingParent","clientId","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","withDuotoneStyles","BlockListBlock","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,UAHD,QAIO,eAJP;AAKA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SACCC,uBAAuB,IAAIC,aAD5B,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,gCAAgC,IAAIC,sBAHrC,QAIO,uBAJP;AAKA,SAASC,mBAAT,QAAoC,oDAApC;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AAA,QAAQ,EAAE;AAD8C,OAA/B,CAA1B;AAGA;AACD,GArCuB,EAqCrB,CAAE/B,KAAK,CAACE,IAAR,CArCqB,CAAxB;AAuCA,QAAMQ,SAAS,GAAGV,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEpB,UAAV,+EAAG,kBAAmBE,KAAtB,oFAAG,sBAA0BE,KAA7B,2DAAG,uBAAiClB,OAAnD;AAEA,QAAMkE,WAAW,GAAI,cAAc5E,EAAI,EAAvC;AAEA,QAAM6E,YAAY,GAAG9E,QAAQ,IAAIuD,SAAjC;AAEA,QAAMwB,SAAS,GAAGD,YAAY,GAC3B5G,UAAU,CAAE2E,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEkC,SAAT,EAAoBF,WAApB,CADiB,GAE3BhC,KAF2B,aAE3BA,KAF2B,uBAE3BA,KAAK,CAAEkC,SAFV,CAhDkC,CAoDlC;AACA;AACA;AACA;;AACA,SACC,8BACGD,YAAY,IACb,cAAC,aAAD;AACC,IAAA,EAAE,EAAGD,WADN;AAEC,IAAA,QAAQ,EAAG7E,QAFZ;AAGC,IAAA,SAAS,EAAGuD;AAHb,IAFF,EAQC,cAAC,cAAD,eAAqBV,KAArB;AAA6B,IAAA,SAAS,EAAGkC;AAAzC,KARD,CADD;AAYA,CArEkD,EAsEnD,mBAtEmD,CAApD;AAyEArG,SAAS,CACR,0BADQ,EAER,oCAFQ,EAGR4D,oBAHQ,CAAT;AAKA5D,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRiE,mBAHQ,CAAT;AAKAjE,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGR4F,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { store as blockEditorStore } from '../store';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t);\n\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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 * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\nfunction DuotoneStyles( {\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst element = useContext( BlockList.__unstableElementContext );\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.editor-styles-wrapper .${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\treturn (\n\t\telement &&\n\t\tisValidFilter &&\n\t\tcreatePortal(\n\t\t\t<InlineDuotone\n\t\t\t\tselector={ selector }\n\t\t\t\tid={ filterId }\n\t\t\t\tcolors={ colors }\n\t\t\t/>,\n\t\t\telement\n\t\t)\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst id = useInstanceId( BlockListBlock );\n\n\t\tconst selector = useMemo( () => {\n\t\t\tconst blockType = getBlockType( props.name );\n\n\t\t\tif ( blockType ) {\n\t\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t\t// experimental property has been, the experimental property\n\t\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'filter.duotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t\t// to be treated as a selector and requires scoping.\n\t\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( experimentalDuotone ) {\n\t\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t\t: rootSelector;\n\t\t\t\t}\n\n\t\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\t\tfallback: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}, [ props.name ] );\n\n\t\tconst attribute = props?.attributes?.style?.color?.duotone;\n\n\t\tconst filterClass = `wp-duotone-${ id }`;\n\n\t\tconst shouldRender = selector && attribute;\n\n\t\tconst className = shouldRender\n\t\t\t? classnames( props?.className, filterClass )\n\t\t\t: props?.className;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRender && (\n\t\t\t\t\t<DuotoneStyles\n\t\t\t\t\t\tid={ filterClass }\n\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","useSelect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","store","blockEditorStore","default","StylesFiltersPanel","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","filter","newDuotone","newStyle","maybePreset","addDuotoneAttributes","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","isContentLocked","select","__unstableGetContentLockingParent","clientId","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","withDuotoneStyles","BlockListBlock","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,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BAAmBG,KAAtB,oFAAG,sBAA0BE,KAA7B,2DAAG,uBAAiCnB,OAAnD;AAEA,QAAMmE,WAAW,GAAI,cAAc7E,EAAI,EAAvC;AAEA,QAAM8E,YAAY,GAAG/E,QAAQ,IAAIwD,SAAjC;AAEA,QAAMwB,SAAS,GAAGD,YAAY,GAC3BjH,UAAU,CAAEiF,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEiC,SAAT,EAAoBF,WAApB,CADiB,GAE3B/B,KAF2B,aAE3BA,KAF2B,uBAE3BA,KAAK,CAAEiC,SAFV,CAhDkC,CAoDlC;AACA;AACA;AACA;;AACA,SACC,8BACGD,YAAY,IACb,cAAC,aAAD;AACC,IAAA,EAAE,EAAGD,WADN;AAEC,IAAA,QAAQ,EAAG9E,QAFZ;AAGC,IAAA,SAAS,EAAGwD;AAHb,IAFF,EAQC,cAAC,cAAD,eAAqBT,KAArB;AAA6B,IAAA,SAAS,EAAGiC;AAAzC,KARD,CADD;AAYA,CArEkD,EAsEnD,mBAtEmD,CAApD;AAyEA1G,SAAS,CACR,0BADQ,EAER,oCAFQ,EAGRmE,oBAHQ,CAAT;AAKAnE,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRuE,mBAHQ,CAAT;AAKAvE,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGRiG,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanel( { attributes, setAttributes, name } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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 * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\nfunction DuotoneStyles( {\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst element = useContext( BlockList.__unstableElementContext );\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.editor-styles-wrapper .${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\treturn (\n\t\telement &&\n\t\tisValidFilter &&\n\t\tcreatePortal(\n\t\t\t<InlineDuotone\n\t\t\t\tselector={ selector }\n\t\t\t\tid={ filterId }\n\t\t\t\tcolors={ colors }\n\t\t\t/>,\n\t\t\telement\n\t\t)\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst id = useInstanceId( BlockListBlock );\n\n\t\tconst selector = useMemo( () => {\n\t\t\tconst blockType = getBlockType( props.name );\n\n\t\t\tif ( blockType ) {\n\t\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t\t// experimental property has been, the experimental property\n\t\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'filter.duotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t\t// to be treated as a selector and requires scoping.\n\t\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( experimentalDuotone ) {\n\t\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t\t: rootSelector;\n\t\t\t\t}\n\n\t\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\t\tfallback: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}, [ props.name ] );\n\n\t\tconst attribute = props?.attributes?.style?.color?.duotone;\n\n\t\tconst filterClass = `wp-duotone-${ id }`;\n\n\t\tconst shouldRender = selector && attribute;\n\n\t\tconst className = shouldRender\n\t\t\t? classnames( props?.className, filterClass )\n\t\t\t: props?.className;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRender && (\n\t\t\t\t\t<DuotoneStyles\n\t\t\t\t\t\tid={ filterClass }\n\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
@@ -14,7 +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
+ import { setImmutably } from '../utils/object';
18
18
  /**
19
19
  * Removed falsy values from nested object.
20
20
  *
@@ -32,7 +32,7 @@ export const cleanEmptyObject = object => {
32
32
  return [key, cleanEmptyObject(value)];
33
33
  }).filter(_ref2 => {
34
34
  let [, value] = _ref2;
35
- return Boolean(value);
35
+ return value !== undefined;
36
36
  }));
37
37
  return isEmpty(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
38
38
  };
@@ -78,7 +78,7 @@ export function transformStyles(activeSupports, migrationPaths, result, source,
78
78
 
79
79
  if (styleValue) {
80
80
  returnBlock = { ...returnBlock,
81
- attributes: immutableSet(returnBlock.attributes, path, styleValue)
81
+ attributes: setImmutably(returnBlock.attributes, path, styleValue)
82
82
  };
83
83
  }
84
84
  });
@@ -142,9 +142,14 @@ export function useBlockSettings(name, parentLayout) {
142
142
  const borderWidth = useSetting('border.width');
143
143
  const customColorsEnabled = useSetting('color.custom');
144
144
  const customColors = useSetting('color.palette.custom');
145
+ const customDuotone = useSetting('color.customDuotone');
145
146
  const themeColors = useSetting('color.palette.theme');
146
147
  const defaultColors = useSetting('color.palette.default');
147
148
  const defaultPalette = useSetting('color.defaultPalette');
149
+ const defaultDuotone = useSetting('color.defaultDuotone');
150
+ const userDuotonePalette = useSetting('color.duotone.custom');
151
+ const themeDuotonePalette = useSetting('color.duotone.theme');
152
+ const defaultDuotonePalette = useSetting('color.duotone.default');
148
153
  const userGradientPalette = useSetting('color.gradients.custom');
149
154
  const themeGradientPalette = useSetting('color.gradients.theme');
150
155
  const defaultGradientPalette = useSetting('color.gradients.default');
@@ -166,10 +171,17 @@ export function useBlockSettings(name, parentLayout) {
166
171
  theme: themeGradientPalette,
167
172
  default: defaultGradientPalette
168
173
  },
174
+ duotone: {
175
+ custom: userDuotonePalette,
176
+ theme: themeDuotonePalette,
177
+ default: defaultDuotonePalette
178
+ },
169
179
  defaultGradients,
170
180
  defaultPalette,
181
+ defaultDuotone,
171
182
  custom: customColorsEnabled,
172
183
  customGradient: areCustomGradientsEnabled,
184
+ customDuotone,
173
185
  background: isBackgroundEnabled,
174
186
  link: isLinkEnabled,
175
187
  text: isTextEnabled
@@ -211,7 +223,7 @@ export function useBlockSettings(name, parentLayout) {
211
223
  layout,
212
224
  parentLayout
213
225
  };
214
- }, [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]);
226
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
215
227
  return useSettingsForBlockElement(rawSettings, name);
216
228
  }
217
229
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","immutableSet","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","map","key","value","filter","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,GAAlB,QAA6B,QAA7B;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,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,K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AhCE,EAiCFC,mBAjCE,EAkCFC,aAlCE,EAmCFC,aAnCE,CA1DwB,CAA3B;AAgGA,SAAO9E,0BAA0B,CAAE+E,WAAF,EAAepC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, 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( object )\n\t\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t\t.filter( ( [ , value ] ) => Boolean( value ) )\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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","setImmutably","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","map","key","value","filter","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","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AAC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C,QAAAA,KAAK,EAAEpC,WAHA;AAIPqC,QAAAA,KAAK,EAAEpC;AAJA,OApDF;AA0DNqC,MAAAA,UAAU,EAAE;AACX1C,QAAAA;AADW,OA1DN;AA6DNC,MAAAA,MA7DM;AA8DNjB,MAAAA;AA9DM,KAAP;AAgEA,GAjE0B,EAiExB,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,aAzBE,EA0BFC,WA1BE,EA2BFC,aA3BE,EA4BFC,cA5BE,EA6BFC,cA7BE,EA8BFC,kBA9BE,EA+BFC,mBA/BE,EAgCFC,qBAhCE,EAiCFC,mBAjCE,EAkCFC,oBAlCE,EAmCFC,sBAnCE,EAoCFC,gBApCE,EAqCFC,yBArCE,EAsCFC,mBAtCE,EAuCFC,aAvCE,EAwCFC,aAxCE,CAjEwB,CAA3B;AA4GA,SAAOlF,0BAA0B,CAAEmF,WAAF,EAAezC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, 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 { setImmutably } 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( object )\n\t\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t\t.filter( ( [ , value ] ) => value !== undefined )\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: setImmutably(\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 customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\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\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\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\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\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"]}
@@ -9,6 +9,9 @@ import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
9
9
  import ResizableBoxPopover from './components/resizable-box-popover';
10
10
  import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
11
11
  import { PrivateListView } from './components/list-view';
12
+ import BlockInfo from './components/block-info-slot-fill';
13
+ import { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';
14
+ import { cleanEmptyObject } from './hooks/utils';
12
15
  /**
13
16
  * Private @wordpress/block-editor APIs.
14
17
  */
@@ -20,6 +23,9 @@ lock(privateApis, { ...globalStyles,
20
23
  OffCanvasEditor,
21
24
  PrivateInserter,
22
25
  PrivateListView,
23
- ResizableBoxPopover
26
+ ResizableBoxPopover,
27
+ BlockInfo,
28
+ useShouldContextualToolbarShow,
29
+ cleanEmptyObject
24
30
  });
25
31
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ResizableBoxPopover","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,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPP,IAAI,CAAEO,WAAF,EAAe,EAClB,GAAGT,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA,eAJkB;AAKlBI,EAAAA,eALkB;AAMlBC,EAAAA,eANkB;AAOlBH,EAAAA;AAPkB,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 ResizableBoxPopover from './components/resizable-box-popover';\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\tResizableBoxPopover,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","PrivateListView","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","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,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,8BAAT,QAA+C,4CAA/C;AACA,SAASC,gBAAT,QAAiC,eAAjC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPV,IAAI,CAAEU,WAAF,EAAe,EAClB,GAAGZ,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA,eAJkB;AAKlBI,EAAAA,eALkB;AAMlBC,EAAAA,eANkB;AAOlBH,EAAAA,mBAPkB;AAQlBI,EAAAA,SARkB;AASlBC,EAAAA,8BATkB;AAUlBC,EAAAA;AAVkB,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 ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\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\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n} );\n"]}
@@ -544,6 +544,9 @@ export function moveBlockToPosition(clientId) {
544
544
  /**
545
545
  * Action that inserts a single block, optionally at a specific index respective a root block list.
546
546
  *
547
+ * Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
548
+ * a templateLock is active on the block list.
549
+ *
547
550
  * @param {Object} block Block object to insert.
548
551
  * @param {?number} index Index at which block should be inserted.
549
552
  * @param {?string} rootClientId Optional root client ID of block list on which to insert.
@@ -561,12 +564,16 @@ export function insertBlock(block, index, rootClientId, updateSelection, meta) {
561
564
  /**
562
565
  * Action that inserts an array of blocks, optionally at a specific index respective a root block list.
563
566
  *
567
+ * Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
568
+ * a templateLock is active on the block list.
569
+ *
564
570
  * @param {Object[]} blocks Block objects to insert.
565
571
  * @param {?number} index Index at which block should be inserted.
566
572
  * @param {?string} rootClientId Optional root client ID of block list on which to insert.
567
573
  * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
568
574
  * @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
569
575
  * @param {?Object} meta Optional Meta values to be passed to the action object.
576
+ *
570
577
  * @return {Object} Action object.
571
578
  */
572
579